text stringlengths 14 5.77M | meta dict | __index_level_0__ int64 0 9.97k ⌀ |
|---|---|---|
Pimentel, Hontiveros slam provisional WPP coverage for Napoles | Inquirer News
Pimentel, Hontiveros slam provisional WPP coverage for Napoles
By: Maila Ager - Reporter / @MAgerINQ
Even Senate President Aquilino "Koko" Pimentel III was stunned by the "crazy" development of Janet Lim Napoles being placed under the government's protection.
"What an unbelievable crazy' development," Pimentel said in a viber message to Senate reporters on Friday.
"Do some people in the DOJ (Department of Justice) really believe that Janet Lim Napoles is qualified to be a state witness in the PDAF scam which she herself invented organized and perpetuated???" he added.
PDAF is the lawmakers' priority development assistance fund also known as "pork barrel", which was later declared unconstitutional by the Supreme Court.
Justice Secretary Vitaliano Aguirre II has confirmed that Napoles, the principal accused in the pork barrel scam, has been placed under the provisional coverage of the government's Witness Protection Program (WPP).
READ: Napoles now under provisional WPP coverage
Senator Risa Hontiveros, an opposition member, lambasted the government's decision, calling it a "travesty of justice."
"It reverses the gains won by the people in their anti-corruption struggle, which culminated in the historic Million People March," Hontiveros said.
"This is expected, however. After all, this is the same government that used the testimonies of convicted and self-confessed drug lords (who have everything to gain and nothing to lose) to intimidate and unjustly incarcerates one of the leading figures of the political opposition."
Hontiveros said she would not be surprised if Napoles would also be used as a "political weapon" to further harass other opposition members and create a "chilling effect."
"Napoles could also be used as a means to enforce loyalty within the Duterte camp. All those who will not toe the line and have strong opinions against the government's policies and the President himself could easily be included in Napoles' pork barrel list," she added. /muf
VACC lawyer castigates Aquino for crying harassment
TAGS: DoJ, favors of office, Hontiveros, Napoles, PDAF, Pimentel, Senate, WPP | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,889 |
'use strict';
var $ = require('jquery'),
_ = require('lodash');
var footers = $('.footer');
var html = require('./footer.html');
const translator = require('../../../translation/exports');
_.each(footers, function (footer) {
footer.innerHTML = html;
translator.replace("common-footer-allrightsreserved",
"nav",
"allRightsReserved",
{titleCase: true});
});
| {
"redpajama_set_name": "RedPajamaGithub"
} | 3,668 |
Blow of heart assured for this very nice home of village on 410m2 of closed and sported ground. Steeped in history, this stone house will seduce you with its beautiful old elements and the quality of its restoration. Beautiful volumes, it comes in a large living room facing the garden, a fitted kitchen opening onto terrace, 3 large bedrooms, a boudoir, garage and outbuildings. An undeniable asset, its location: 20 minutes from Avignon, Uzes and Nîmes. Access to the motorway network in 5 minutes. | {
"redpajama_set_name": "RedPajamaC4"
} | 1,880 |
Q: BSOD whea during Virtualbox installation With Windows 7 or Windows 10 64-bit, I always had Virtualbox installed on this computer.
A few weeks ago, I format and reinstalled Windows 10 64-bit from scratch (the previous Windows 10 installation was an update from Windows 7).
Yesterday, I wanted to install Virtualbox again, but during the installation, and it seems close to the end of the installation, the PC crashes with a BSOD error (WHEA_UNCORRECTABLE ERROR).
I opened the MEMORY.DMP with Windbg and this is the result after an !analyze -v : http://pastebin.com/LDXnhbbp
I searched on the Internet and it seems that the CPU can be the problem : for information, I never had BSOD before, and I play many games.
I downloaded the Intel CPU Identification utility, and it seems that my processor was overclocked by the Intel Turbo technology : I disabled it in the BIOS, but the problem is still there.
My drivers are up-to-date with the Snappy drivers tools.
Is there any fix to this problem?
A: I found the solution : disabling Intel Virtualization Technology in the BIOS.
After that, I could installed VirtualBox with no problem.
I enabled again the turbo options and the Virtualization technology in the BIOS in order to see if it's okay when I will running VMs.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 4,622 |
Q: iPhone localization does not work I'm trying to localize my App.
Steps:
*
*Create a Localizable.strings file with Xcode 5.1
*Add a language from Project-Info
*Press localize in utility of Localizable.strings file and add a language
*Use NSlocalizedString function
It work in a blank App but did not work when use in my App, infact it write the key instead the value.
What can I do to resolve it?
A: You need to be sure your string is localized and that you publish your app with the correct locations selected (when you submit, choose the countries you want the app to be localized in, otherwise the localization is ignored).
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 9,381 |
Q: Where does the loading of keyboard layout happen in android startup? I want to understand the process of where keyboard layout is loaded and mapped to the system.
Where is the qwerty.kl config file is been used?
Probably it's in the linux level..
Any references?
A: Here's the qwerty.kl file...
key 399 GRAVE
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 139 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 127 SEARCH WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
key 212 CAMERA
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 26 LEFT_BRACKET
key 27 RIGHT_BRACKET
key 43 BACKSLASH
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 39 SEMICOLON
key 40 APOSTROPHE
key 14 DEL
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 53 SLASH
key 28 ENTER
key 56 ALT_LEFT
key 100 ALT_RIGHT
key 42 SHIFT_LEFT
key 54 SHIFT_RIGHT
key 15 TAB
key 57 SPACE
key 150 EXPLORER
key 155 ENVELOPE
key 12 MINUS
key 13 EQUALS
key 215 AT
It's under system/usr/keylayout going by your question I assumed that you were asking where it was and how it is mapped, if you provided more info I can help more
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 1,807 |
Q: How to split each value of foreach statement with different classes PHP I need to split up each return $val with different class. Let's say the value has 7 value inside and I wish to have each value have different classes.
foreach ($arrNum as $val) {
?>
<li class="col-15"><?php echo $val; ?></li>
<?php } ?>
i try amend with below code , its seems not working :
foreach ($arrNum as $i => $val) {
?>
<?php if($i == 0): ?>
<div class="col-03">
<?php elseif($i == 1): ?>
<div class="col-28">
<?php elseif($i == 2): ?>
<div class="col-15">
<?php elseif($i == 3): ?>
<div class="col-48">
<?php elseif($i == 4): ?>
<div class="col-02">
<?php elseif($i == 5): ?>
<div class="col-46">
<?php elseif($i == 6): ?>
<div class="col-33">
<?php endif; ?>
Rest of html
</div>
<!-- <li class="col-15"><?php echo $val; ?></li> -->
<?php } ?>
A: Do you looking for something like this PHP-Code
<?php
// Create array
$arrNum = array();
$arrNum['03'] = 'Rest of html';
$arrNum['28'] = 'Rest of html';
$arrNum['15'] = 'Rest of html';
$arrNum['48'] = 'Rest of html';
$arrNum['02'] = 'Rest of html';
$arrNum['46'] = 'Rest of html';
$arrNum['33'] = 'Rest of html';
foreach ($arrNum as $i=>$val) {
echo '<div class="col-'.$i.'">'.$val.'</div>';
}
?>
this will return HTML-Code
<div class="col-03">Rest of html</div>
<div class="col-28">Rest of html</div>
<div class="col-15">Rest of html</div>
<div class="col-48">Rest of html</div>
<div class="col-02">Rest of html</div>
<div class="col-46">Rest of html</div>
<div class="col-33">Rest of html</div>
if your text ("Rest of html") is every time the same you can simplify the code
<?php
$arrNum = array('03', '28', '15', '48', '02', '46', '33');
foreach ($arrNum as $i) {
echo '<div class="col-'.$i.'">Rest of html</div>';
}
?>
A: You try this
`$no=1;
foreach ($arrNum as $val) {
?>
<li class="col-<?php echo $no;?>"><?php echo $val; ?></li>
<?php $no++; } ?>`
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 3,508 |
Ranking the Most Engaged MLB Fan Bases
Ashley Kubiszyn April 18, 2013 MLB
We're excited to share our first annual ranking of the most engaged fan bases in the MLB. The ranking is based on an algorithm that evaluates fan activity in terms of:
Home game attendance (% of total capacity)
Median ticket price
Ticket demand
Team social media following
The San Francisco Giants hold the #1 spot on the list with an especially active fan base. Boasting two World Series championships in the last three years, Giants fans have been filling their stadium to 100% capacity at the beginning of the 2013 season. In addition to driving one of the most in-demand tickets in the MLB, Giants fans are engaged online as well. The Giants have more than two million followers on Facebook and Twitter combined, trailing only the Yankees and Red Sox.
Other franchises represented on this list reveal the importance of marquee players and post-season success in driving fan engagement. Six of the teams included in the top 10 have made World Series appearances since 2007, many of which set home attendance records the following season.
The attractiveness of home stadiums may also benefit top 10 teams in engaging fans. Post-McCourt, the Dodgers have returned to the top of the attendance rankings in 2013, and there's no arguing that Dodgers Stadium is an absolute gem. Other franchises like the Cubs, who haven't been to a World Series since 1908, have built a fan culture around Wrigley Field.
With the 2013 MLB season underway, there will be plenty of opportunities for fans to show their support at the games. It's going to be a dog fight in the West between the Dodgers and defending champion Giants, who will meet in early May. The New York Yankees, who will be looking to re-stake their claim as AL champions this year, will meet the promising Red Sox in early June. There's lots of time for any team to make a run in 2013, but there's no doubt that fan support will play a role in who goes to the playoffs in September.
So what do you think? Did your team make the list? Click on the infographic below to enlarge & zoom.
Written by Ashley Kubiszyn | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,383 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="height=device-height, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header class="navbar navbar-default navbar-fixed-top" >
<nav class="container">
<div class="nav navbar-header" >
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mainMenu" aria-expanded="false" aria-controls="navbar" style="">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="nav navbar-brand" >
<img src="../images/LogoBDE.png" alt="BDE Logo" class="img-responsive BDE-image"/>BDE Website
</div>
</div>
<div id="mainMenu" class="navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li class="active"><a href="#">Home</a></li>
<li><a href="futurActivities.html">Activities</a></li>
<li><a href="shop.html">Shop</a></li>
<li><a href="BDEmembers.html">BDE Members</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="connexion.html">Log in</a></li>
<li><a href="profilInscription.html">Sign up</a></li>
<li><a href="">FR</a></li>
<li><a href="">EN</a></li>
</ul>
</div>
</nav>
</header>
<div class="container-fluid body">
<div class="row">
<section class="jumbotron col-md-7 col-md-offset-1 essai">
<article>
<h1 class="home-title">Welcome <br>to BDE WebSite<br> of Exia Cesi Lyon</h1>
<img src="https://images.alphacoders.com/555/555941.jpg" class="img-responsive img-home" alt="BDE Members">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</article>
</section>
<aside class="jumbotron col-md-2 col-md-offset-1">
<div class="aside-block">
<h3 class="aside-title">Futur Events</h3>
<ul>
<li>Event 1 - 13/04/2017</li>
<li>Event 2 - 13/04/2017</li>
<li>Event 3 - 13/04/2017</li>
</ul>
</div>
<div class="aside-block">
<h3 class="aside-title">Last Events</h3>
<ul>
<li>Event 1 - 13/04/2017</li>
<li>Event 2 - 13/04/2017</li>
<li>Event 3 - 13/04/2017</li>
</ul>
</div>
<div class="aside-block">
<h3 class="aside-title">New goodies</h3>
<ul>
<li>Event 1 - 13/04/2017</li>
<li>Event 2 - 13/04/2017</li>
<li>Event 3 - 13/04/2017</li>
</ul>
</div>
</aside>
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<p class="col-sm-2">
<a href="https://www.google.com/maps/place/19+Avenue+Guy+de+Collongue,+69130+Écully,+France/@45.783385,4.763146,17" class="footer-color">19 Guy de Collongue Avenue, Ecully 69130 France.</a>
</p>
<p class="col-sm-3"><a href="MentionLegal.html"><img src="../images/justice-logo.png " alt="legal notices" class="img-responsive legal-notices">Legal Notices</a></p>
<p class="col-sm-3"><a href="contact.html"><img src="../images/logo-email.png " alt="contact" class="img-responsive contact"> Contact</a></p>
<img src="../images/logoExia.png" alt="logoExia" class="col-sm-2 img-responsive logoExia">
<img src="../images/logoEI2.png" alt="logoEI" class="col-sm-1 img-responsive logoEI">
<p class="col-sm-3"><a href="https://www.facebook.com/BDECesiLyon/"><img src="../images/facebook.png" alt="facebook" class="img-responsive facebook" /></a></p>
</div>
</div>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function(){
var taille = $(".body").height() ;
var tf = $(".footer").height();
var th = $("header").height();
var resultat = taille - tf -th;
$(".essai").css('min-height', resultat- 16) ;
});
$(window).resize(function () {
$('body').css('padding-top', parseInt($('header').css("height")));
});
$(window).ready(function () {
$('body').css('padding-top', parseInt($('header').css("height")));
});
</script>
</body>
</html> | {
"redpajama_set_name": "RedPajamaGithub"
} | 4,453 |
Q: Understanding the ternary operator I have the following example:
$a=false;
$b=true;
$c=false;
if($a ? $b : $c){
echo 'false';
} else {
echo 'true';
}
I can't seem to understand this statement,and i need someone to explain me how it works...
A: $a=false;
$b=true;
$c=false;
if($a ? $b : $c){
echo 'false';
} else {
echo 'true';
}
expands to:
$a=false;
$b=true;
$c=false;
if ($a) {
$temp = $b; // TRUE
} else {
$temp = $c; //FALSE
}
if($temp){
echo 'false';
} else {
echo 'true';
}
because $a is false, $temp is assigned $c value (which is false), second if checks if $temp is true (which is not), so else statement is executed echo 'true'
A: It's an equivalent of this:
<?php
$a = false;
$b = true;
$c = false;
if(($a && $b) || (!$a && $c)) {
echo 'false';
} else {
echo 'true';
}
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 9,225 |
\section{Introduction}
The contact line between three phases is a particular \emph{locus} conducive to physical couplings between the macroscopic and the molecular scales. Diverse phenomena are intrinsically bound to the presence of a contact line, such as heterogeneous nucleation \cite{guillemot_activated_2012,remsing_pathways_2015, Tinti2017}, formation of nanovesicles from a membrane \cite{Satarifard2018}, dynamical wetting \cite{dG1985,Bonn2009,Lhermerout2019}, and as a last example among others stabilisation and pinning of nanoinclusions at an interface (bubbles, droplets, colloids, etc.) \cite{lohse_surface_2015, bresme_computer_1998, Tan2017}. To better understand these phenomena, which play a key role in several applicative fields such as biotechnology (nanoemulsion, encapsulation) \cite{Singh2017}, chemical engineering (catalysis, electrochemistry) \cite{Debe2012} or process engineering (boiling, condensation) \cite{Karayiannis2017}, a challenge remains in deciphering the effects due to the presence of a contact line. At the micron scale, the wedge that is formed in the vicinity of a solid/liquid/vapor contact line may be responsible for enhanced heat and mass transfer at the origin for instance of the well known coffee ring effect \cite{Deegan1997}. At the nanometer scale, such a wedge has been identified to give rise to specific molecular interactions close to the three-phase contact line, at the origin of a specific free energy contribution: the line tension \cite{joanny_role_1986, Drelich1996, weijs_origin_2011}. This specific thermodynamical quantity was first mentioned by Gibbs \cite{gibbs_1876}, who introduced the line tension $\tau$ as an excess free energy per unit length of contact line or a tangential force along this line. Unlike surface tension of planar fluid/fluid interfaces, line tension can be either positive or negative as there is no thermodynamical argument to predict its sign \cite{rowlinson}. From simple scaling arguments, the order of magnitude of $\tau$ for water is expected to be $\left|\tau\right | \sim \gamma_{lv} \sigma\sim 20$~pN with $\gamma_{lv}$ the liquid/vapor surface tension and $\sigma$ the molecular size \cite{guillemot_activated_2012}. Such a scaling implicitly suggests that the impact of line tension is limited to the molecular scale \cite{Drelich1996}. Nevertheless, in the case of nanostructured materials, the effect of line tension can be scaled up and impact macroscopic phenomena. For instance, it has been recently shown that line tension could control the macroscopic bulk pressure required to induce capillary drying within hydrophobic nanoporous material \cite{guillemot_activated_2012,Tinti2017}.
Despite its wide range of possible contributions, the understanding of line tension is still limited. Available measurements, either from experiments \cite{Wang1999,Pompe2000,checco_nonlinear_2003,kameda2008,berg_impact_2010, mcbride2012,Heim2013} or based on numerical simulations \cite{werder2003,Hirvi2006,winter2009,weijs_origin_2011,zhang_influence_2014}, lead to mostly negative but also positive values for the line tension with magnitude spanning from $10^{-6}$ to $10^{-12}$~N, this dispersion being probably due to the diversity of methods and systems under investigation \cite{law2017}. Moreover, from analytical predictions of Joanny and De Gennes, a divergence of line tension towards infinite positive values is expected for Lennard-Jones fluids at the wetting transition \cite{joanny_role_1986}. From this variability of $\tau$, one must admit that estimating accurately line tension remains a delicate task with long-standing debates about the role of competing effects, such as line pinning \cite{checco_nonlinear_2003} or surface curvature corrections \cite{Joswiak2013,kanduc_going_2017,das_contact_nodate}. Up to date, no consensus has been met on the dependence of line tension on physical parameters such as temperature, substrate hydrophilicity or fluid molecular structure.
Most experimental and molecular simulation measurements of line tension consist of evaluating the dependence of the contact angle $\theta$ of a sessile drop on the radius $r$ of its circular contact line. In this approach, a simple decomposition into surface and line free energies reveals that a geometrical scaling, known as the modified Young equation, is expected \cite{boruvka_generalization_1977}:
\begin{equation}
\cos\theta = \cos\theta_{Y}-\frac{\tau}{\gamma_{lv}r}
\label{Eq1}
\end{equation}
where $\cos \theta_{Y} = (\gamma_{sv}-\gamma_{sl})/\gamma_{lv}$ is the Young contact angle defined from the solid-vapor $\gamma_{sv}$, solid-liquid $\gamma_{sl}$ and liquid-vapor $\gamma_{lv}$ surface tensions. Eq. [\ref{Eq1}] implicitly assumes that surface and line tensions only depend on the nature of the materials so that changes in $\cos \theta$ are proportional to $1/r$. However, surface and line tensions can vary with the fluid chemical potential as well as with surface and line curvatures \cite{boruvka_generalization_1977, ward_effect_2008}. In this respect, while curvature seems to have a negligible impact on $\gamma_{lv}$ (expressed with the so-called Tolman length) down to submolecular sizes, its effect on line tension remains to be established \cite{ das_contact_nodate, kanduc_going_2017}. Moreover, the geometrical approach in Eq. [\ref{Eq1}] suffers from difficulties in evaluating
the shape of the sessile drop. In particular, experimental departures from Eq. [\ref{Eq1}] \cite{checco_nonlinear_2003,berg_impact_2010} cast doubt on the relevance of the geometrical scaling methodology to measure line tensions $\tau$ \cite{marmur_line_1997,ward_effect_2008,das_contact_nodate}. Even in molecular simulation approaches, the position of interfaces and lines is ambiguous at the molecular scale
so that line tensions estimated numerically are subjected to large error bars.
In this paper, a molecular simulation methodology is developed to estimate line tensions $\tau$ without geometrical scaling. The effects of temperature, confinement, solid/fluid interactions, and chemical potential are investigated for any dispersive fluid modeled by a Lennard-Jones potential (LJ) and for water. In the spirit of the seminal work of Tarazona \cite{Tarazona1981} and recent approach of Shao et al \cite{shao_anisotropy_2015}, statistical mechanics expressions are used to determine $\tau$ from the stress anisotropy in the vicinity of a triple line. {While the approach of Shao et al \cite{shao_anisotropy_2015} is mostly applicable to three fluid systems with limited interface curvature, our approach addresses the case of two fluids confined between solid walls (Fig. \ref{Fig1}) without any restriction on the curvature of the fluid/fluid interface, that is for any contact angle and any confinement}. In this approach, a liquid in contact with its vapor is confined, at a temperature $T$, in a slit pore of a width $h$ formed by two solid planar walls perpendicular to the $z$ direction (Fig. \ref{Fig1}). The system is infinite in the $x$ and $y$ directions thanks to the use of periodic boundary conditions (see methodological details in \emph{Materials and Methods} and \emph{Supplementary Information}).
\begin{figure}[ht]
\centering
\includegraphics[width=8.6cm, keepaspectratio=true]{Fig1.pdf}
\caption{Set-up consisting of a liquid in contact with its vapor confined between two solid walls (perpendicular to the $z$ direction). {Solid/fluid interfaces are} separated by a distance $h$. Periodic boundary conditions are applied along the $x$ and $y$ directions which are parallel and perpendicular to the red contact lines. The line tension $\tau$ {of these straight contact lines} is estimated from the forces $\Sigma_{x}$, $\Sigma_{y}$ and $\Sigma_{z}$ exerted along $x$, $y$ and $z$.}
\label{Fig1}
\end{figure}
Our approach avoids the delicate computation of local stresses or pressures at the vicinity of the contact line. The value of $\tau$ is directly extracted from the measurement of total forces $\Sigma_{x}$, $\Sigma_{y}$ and $\Sigma_{z}$ in the three space directions. This approach is used to probe the line tension of the contact line of a Lennard-Jones fluid or water within various confinements.
\section{Material and methods}
\subsection{A mechanical route to measure line tension}
At mechanical equilibrium the total force $\Sigma_x$ exerted on the fluid system through a $yz$ plane does not depend on the $x$ location of the plane. For a plane within the vapor phase far from the liquid phase, $\Sigma_x$ relies on the vapor pressure $P_v$ and the solid-vapor surface tension $\gamma_{sv}$ while for a plane within the liquid phase far from the vapor phase it relies on the liquid pressure $P_l$ and the solid-liquid surface tension $\gamma_{sl}$:
\begin{equation}
\Sigma_{x}=L_{y}(-P_{v}h+2\gamma_{sv})=L_{y}(-P_{l}h+2\gamma_{sl})
\label{Eq2}
\end{equation}
Due to translational invariance the force $\Sigma_{y}$ exerted on a slice of fluid (vapor + liquid) in the $y$ direction does not depend on the location of the cutting plane. It arises from the three surface tensions $\gamma_{lv}$, $\gamma_{sl}$ and $\gamma_{sv}$, the liquid and vapor pressures $P_{l}$ and $P_{v}$, and the line {tension $\tau$:
\begin{equation}
\Sigma_{y}=-P_{v}A_{v}-P_{l}A_{l} +l_{sv}\gamma_{sv}+l_{sl}\gamma_{sl}+l_{lv}\gamma_{lv}+4\tau
\label{Eq3}
\end{equation}
where $A_{v}$ and $A_{l}$ are the surface areas of the vapor and liquid phases in $xz$ plane, $l_{sv}$, $l_{sl}$ and $l_{lv}$ the lengths corresponding to the intersections of respectively solid/vapor, solid/liquid and liquid/vapor interfaces with $xz$ plane. To facilitate the determination of $\tau$ from Eq. [\ref{Eq3}] we introduce} the algebraic area $A_{m}$ of each meniscus region (dark blue regions in Fig. \ref{Fig1}), from which the liquid and vapor areas write respectively $A_{l}=hl_{sl}/2+2A_{m}$ and $A_{v}=h(L_{x}-l_{sl}/2)-2A_{m}$. The algebraic area $A_{m}$, of the same sign as $P_{l}-P_{v}$, is positive for contact angle $\theta >\pi/2$ and negative for $\theta <\pi/2$. Replacing $A_{l}$ and $A_{v}$ by their respective expressions and using the mechanical balance in the $x$ direction Eq. [\ref{Eq2}], the force in the $y$ direction simplifies without the solid/fluid surface tensions :
\begin{equation}
\Sigma_{y}=\frac{L_{x}}{L_{y}}\Sigma_{x}
- 2 A_{m}(P_{l}-P_{v}) +l_{lv} \gamma_{lv}+4 \tau
\label{SI.equation8}
\end{equation}
As $P_{l}$, $P_{v}$ and $\gamma_{lv}$ are considered as uniform, the radius of curvature $R$, of the liquid/vapor interface, is constant. The role of the line tension $\tau$ is precisely to take into account the molecular interactions between the three phases at the vicinity of the contact line that may alter locally this uniformity \cite{joanny_role_1986}.
From the circular geometry of the liquid vapor interface, $A_{m}={R^{2}}( \beta -\sin(2 \beta)/2)$ and $l_{lv}/2=2R\beta$ with $\beta=\theta-\pi/2$ standing for half the angle of the arc formed by a cut in a zx plan of the confined liquid/vapor interface (blue lines in Fig. \ref{Fig1}). In these expressions the radius of curvature $R={h}/({2 \sin \beta})$ is an algebraic quantity the same sign as $\beta$. Replacing $A_{m}$, $l_{lv}$ and $R$ by their expressions and using Laplace's law of capillarity, $P_{l}-P_{v}=2\gamma_{lv}/R$, the force $\Sigma_{y}$ further simplifies without pressures:
\begin{equation}
\Sigma_{y}=\frac{L_{x}}{L_{y}}\Sigma_{x}+ \gamma_{lv}h \frac{\sin(2 \beta)+2\beta}{ 2\sin(\beta)}+ 4 \tau
\label{SI.equation11}
\end{equation}
Isolating $\tau$ from Eq. [\ref{SI.equation11}] leads to the central relation of the paper:
\begin{equation}
\tau=\frac{1}{2}\Sigma_{m}-\gamma_{lv}hK(\theta)
\label{Eq4}
\end{equation}
where the force $\Sigma_{m}=(\Sigma_{y}-\Sigma_{x}L_{x}/L_{y})/2$ corresponds to the total force in the $y$ direction acting on each meniscus region ({dark blue regions, blue lines and red dots} in Fig. \ref{Fig1}). The function $K(\theta)$ is a combination of trigonometric functions, which weakly depends on the contact angle (see Fig. \ref{Kp}):
\begin{equation}
K(\theta)=\frac{\sin(2\beta)+2 \beta}{8 \sin(\beta)}=\frac{1}{4}\Big(\sin(\theta)-\frac{\theta-\pi/2}{\cos(\theta)}\Big)
\label{SI.equation12}
\end{equation}
The function K is symmetric with respect to the angle $\theta=\pi/2$ (or $\beta=0$). The line tension {$\tau$ given by Eq. [\ref{Eq4}] is thus obtained from the difference of half the total force applied} on a meniscus region in the $y$ direction, that is the total force $\Sigma_{m}/2$ based on line, surface and bulk contributions, minus the term $\gamma_{lv}hK(\theta)$ which stands for the force due to bulk and surfaces only.
The forces $\Sigma_{x}$ and $\Sigma_{y}$ are computed using the virial expression of anisotropic stresses at an unstructured solid surface from the positions of the $N$ fluid particles \cite{schofield1982,thompson_general_2009}:
\begin{equation}
\Sigma_{\alpha}=\Big\langle - \frac{Nk_{B}T}{L_\alpha}+W_\alpha\Big\rangle
\label{Eq7}
\end{equation}
with $\alpha=x,y$ and $k_{B}$ Boltzmann's constant. $W_\alpha$ is the energy derivative relative to a homogeneous affine expansion of all the {fluid} atomic positions and the system boundaries in the direction $\alpha$.
Unlike the forces $\Sigma_{x}$, $\Sigma_{y}$ and $\Sigma_{m}$, line tension $\tau$ depends on the geometrical parameterization of the system. This dependence underlines that line tension is not an intrinsic parameter \cite{schimmele_conceptual_2007} except {in the special case} of a straight triple line formed by three fluids at the same pressure \cite{rowlinson}. This 1D {exception} is analogous to the 2D case of the intrinsic surface tension characterizing a planar interface that separates two phases at the same pressure. In the absence of pressure uniformity (as encountered here), line and surface tensions depend on the definition of interface position \cite{ward_effect_2008}. This is the case if interfaces are curved or in the presence of a solid phase under non-isotropic stress for which the concept of scalar pressure must be replaced by an elastic stress tensor. Surface and line tensions are therefore dependent on the choice made to define the position of the surface and contact angle {as it appears in Eq. [\ref{Eq4}] where the value of $\tau$ depends on the geometrical quantities $h$ and $\theta$ that may be defined according to various conventions at the molecular scale}.
{To adopt a definition of the distance $h$ that is based on physical parameters, we consider the surface excess $\Gamma_{l}$ of fluid at the solid-liquid interface. The conservation of fluid mass in a vertical slab located in the liquid phase writes $2\Gamma_{l} + h\rho_{l} = n_{l}$ with $\rho_{l}$ the bulk liquid density (see \emph{Supplementary Information} and Fig. \ref{Fig2}) and $n_{l}$ the average number of molecules per unit of solid surface area in a slab perpendicular to the $x$ direction taken within the liquid (inset of Fig. \ref{Fig2}). Using the Gibbs convention, that is a zero fluid adsorption $\Gamma_{l} = 0$, leads to the definition of $h$ that verifies $h = n_{l}/\rho_{l}$.
The second geometric parameter, the contact angle $\theta$, is then deduced from Laplace's law of capillarity:}
\begin{equation}
\cos \theta = -\frac{(P_{l}-P_{v})h}{2\gamma_{lv}}= \frac{h}{l}\Big[ \frac{1}{2\gamma_{lv}L_{y}}\Big(\Sigma_{z}+P_{v}L_{x}L_{y}\Big)-1\Big]
\label{Eq9}
\end{equation}
where $\Sigma_{z}$, the force exerted by the fluid on the bottom solid surface, subdivides into volume and surface contributions $\Sigma_{z}~=~L_{y}[2 \gamma_{lv} -P_{l}l -P_{v}(L_{x}-l)]$.
This definition is self consistent with the establishment of Eqs. [\ref{Eq4}] and [\ref{SI.equation12}]. In the end, the numerical values of $\gamma_{sl}$ and $\gamma_{sv}$ are not needed to extract $\tau$ as these quantities simplify in the derivation.
The distance $l$ between the two vapor/liquid menisci is defined through the zero adsorption criterion at the liquid-vapor interface: $l= [n_{m}-\rho_{v}L_{x}]/[\rho_{l}-\rho_{v}]$ where $n_{m}$ is the average number of fluid molecules per unit of surface area in a slab perpendicular to the $z$ direction at the center of the slit (inset Fig. \ref{Fig2}). The vapor pressure $P_v$ is determined from the mean vapor density $\rho_{v}$ in the middle of the dry pore region using the ideal gas law, $P_{v}=\rho_{v} k_{\textrm{B}}T$.
{Liquid-vapor surface tension $\gamma_{lv}$ is measured in an independent simulation of an infinite planar liquid-vapor interface following the classical mechanical route (see Supplementary Information).
The definition Eq. [\ref{Eq9}]} of the contact angle was used as it is relevant for any confinement $h$ and solid-fluid interaction $\varepsilon_{s}$.
\begin{figure}[ht]
\centering
\subfigure[]{\label{Kp}\includegraphics[width=0.49\linewidth, keepaspectratio=true]{SI-K.pdf}}\hfill\subfigure[]{\label{HBp}\includegraphics[width=0.49\linewidth, keepaspectratio=true]{SI-HB.pdf}}
\caption{\subref{Kp} Trigonometric function $K(\theta)$ accounting for bulk and surface contributions to the meniscus free energy $\Sigma_{m}$. \subref{HBp} Interaction potentials of the hydrogen-bonding solid used in the water simulations. The hydrogen of water is strongly attracted towards the solid, therefore mimicking a hydrogen bond interaction.}
\label{SI.fig}
\end{figure}
\subsection{Lennard-Jones fluid}
The Lennard-Jones fluid involves repulsive and dispersive interactions with a total energy given by
\begin{equation}
U=\sum_{i<j}u_{ij}^{f}+\sum_{i}\sum_s u_{i}^{s}
\end{equation}
where $u_{ij}^{f}$ is the pair additive fluid interaction
\begin{equation}
u_{ij}^{f}=4\varepsilon\Big[\Big(\frac{\sigma}{r_{ij}}\Big)^{12}-\Big(\frac{\sigma}{r_{ij}}\Big)^{6}\Big]
\label{Eq11}
\end{equation}
and $u_{i}^{s}$ is the fluid-wall interaction
\begin{equation}
u_{i}^{s}=\varepsilon_{s}\Big[\frac{2}{15}\Big(\frac{\sigma_{s}}{\vert z_{i}-z_{s}\vert}\Big)^{9}-\Big(\frac{\sigma_{s}}{\vert z_{i}-z_{s}\vert}\Big)^{3}\Big]
\label{Eq12}
\end{equation}
{with $s$ referring to the lower or upper solid plates located at $z_{s}$ ($s = l,u$), $r_{ij}$ the distance between fluid particles $i$ and $j$, $z_{i}$ the z-position of fluid particle $i$ and $(\varepsilon, \sigma)$ and $(\varepsilon_s, \sigma_s)$ respectively the LJ fluid-fluid and solid-fluid interaction parameters (unless stated otherwise, $\sigma_{s}=2\sigma$). The fluid-wall 9-3 interaction Eq. [\ref{Eq12}] corresponds to the regular LJ potential integrated over a half space infinite solid. A truncation cutoff radius of $r_{c}=4 \sigma$ is used for fluid-fluid interactions. The temperature $T$ is constrained using a Nos\' e-Hoover thermostat with a damping time $t_{\text{damp}}=100\Delta t$.}
In our simulation, the number of particles $N$ varies between 560 and 18900. Each molecular dynamics simulation runs at constant volume $V$ adjusted according to the number of particles, $42\sigma<L_{x}<90\sigma$, $L_{y}=21\sigma$ and $L_{z}=80\sigma$. The simulations consist of $10^{8}$ timesteps with $\Delta t=0.005\, \sigma\sqrt{m/\varepsilon}$ ($m$ is the mass of the particle). The forces $\Sigma_\alpha$ ($\alpha=x,y$) expressed in Eq. [\ref{Eq7}] of the main article are computed every $100\Delta t$. For post analysis, the configurations are stored every $10^4 \Delta t$. Error bars are computed using the block averaging method on {blocks of size} $9\times 10^{6}\Delta t$, and are of the order of the symbol size in Fig. \ref{Fig3}.
\subsection{Water}
Water molecular dynamics simulations were carried out with 480 to 3960 rigid SPC/E molecules in simulation boxes of dimensions
\begin{align*}
L_{x}&=[12,24]~\textrm{nm}\\
L_{y}&=4~\textrm{nm}\\
L_{z}&=[3.35,3.45,3.55,3.65,3.75,3.85,4.85,6.15]~\textrm{nm}
\end{align*}
The confinement parameter $h$ defined through the zero fluid adsorption condition at the solid-liquid surface varies between $1$ and $5$~nm. The line tensions shown in Fig. [\ref{Fig5}] correspond to the case $L_z=3.75$~nm and $h=2.6$~nm. In the SPC/E model, fluid-fluid dispersive interactions are modeled using a Lennard-Jones potential with a cutoff radius of $9$ \AA. Electrostatic forces are computed using a cutoff radius of 9 $\textrm{\AA}$ coupled to a long-range correction computed through the PPPM algorithm. To avoid interactions between periodic images in the $z$ direction, the methodology exposed in \cite{yeh_ewald_1999} is applied, inserting 3 empty boxes between the periodic images in $z$ direction.
The motion of the water molecules is integrated using a rigid-body integrator with a timestep of $\Delta t =2$ fs. The temperature is constrained to $T=300$~K using a Nos\'e-Hoover thermostat with a characteristic damping time $t_{damp}=1$ ps. Configurations are stored every $2$ ps for post-analysis. Simulations are run for a total duration of $50$ ns. Error bars are computed using the block averaging method on blocks of $450$~ps.
The interaction between water and the solid is either chosen to be dispersive or to involve hydrogen-bonding. In the dispersive case, only oxygen atoms interact with the solid. To model this interaction, using Eq. [\ref{Eq12}], we choose $\sigma_{s}=3$ $\textrm{\AA}$ and $\varepsilon_{s}$ is varied between $1.57$ and $7.22$ kJ/mol to scan a broad range of hydrophilicities. In the hydrogen-bonding case, we model the water-solid interactions through a potential:\begin{equation}
u^{s}_i=\frac{\eta \varepsilon_{s}}{n-m}\Big[m\Big(\frac{\sigma_{s}}{\vert z_i-z_s \vert}\Big)^{n}-n\Big(\frac{\sigma_{s}}{\vert z_i-z_s \vert}\Big)^{m}\Big]
\label{equation29}
\end{equation}
with $[n,m]=[12,6]$, $\sigma_{s}=3.85$ $\textrm{\AA}$ and $\varepsilon_{s}=1.05$ kJ/mol for oxygen atoms and $[n,m]=[12,8]$, $\sigma_{s}=2.14$ $\textrm{\AA}$ and $\varepsilon_{s}=6.36$ kJ/mol for hydrogen atoms.
The parameter $\eta$ is varied between $1$ and $5.25$ to scan a broad range of hydrophilicities. This would correspond, for real polar sites, to a variation of site density on the solid surface. The interaction potential with $\eta=1$ is shown in Fig.~\ref{HBp}. This interaction potential is inspired by similar potentials calibrated in the case of atomically structured solids to model H-bonding. Yoshida et al. \cite{yoshida_molecular_2014} proposed the potential described by Eq. [\ref{equation29}] to model the interatomic interactions between the atoms of the first solid layer and the water molecules using a parameter $\eta=2.34$.
\section{Results}
Molecular dynamics simulations were performed using LAMMPS \cite{plimpton_fast_1993}. We considered the strategy above to determine $\tau$ for the prototypical LJ fluid (parameters $\varepsilon$ and $\sigma$).
Full details regarding the molecular simulations can be found in \emph{Materials and Methods} and \emph{Supplementary Information}.
\begin{figure}[ht]
\centering
\includegraphics[width=8.6cm]{Fig2.pdf}
\caption{Contact angles $\theta$ obtained for a Lennard-Jones fluid from Eq. [\ref{Eq9}] for large confinements (filled circles) or from shape regression for large hemicylinders (empty squares, right insets, see \emph{Supplementary Information}). Contact angles are plotted according to the ratio of the fluid/solid to the fluid/fluid interaction strengths $\varepsilon_S/\varepsilon$ (values increasing from purple to red). The top inset shows the density of the structured fluid in blue with the yellow and red areas denoting the regions used to define the confinement $h$ and the meniscus separation $l$
(these regions contain $n_{l}$ and $n_{m}$ molecules, respectively, see text).}
\label{Fig2}
\end{figure}
As shown in Fig. \ref{Fig2}, $\cos \theta$ determined using Eq. [\ref{Eq9}] follows the expected linear dependence on $\varepsilon_{s}$ \cite{evans_critical_2016} and, for large $h$, agrees with contact angles measured through the shape regression technique of fluid density maps. {The contact angle as defined by Eq. [\ref{Eq9}] is however not only dependent on the wall/fluid interaction strengths but also on other physical and geometrical parameters such as the confinement (Fig. \ref{fig3right}). This variation emerges from the dependence of solid/vapor and solid/liquid surface tensions on the separation $h$ due to solid-fluid-solid interactions and adsorption effects (see \emph{Supplementary Information}). In particular, solid-fluid-solid interactions induce a significant increase of the contact angle when perfectly wetting surfaces are brought together.}
\begin{figure}[ht]
\centering
\subfigure[]{\label{fig3left}\includegraphics[height=0.57\linewidth, keepaspectratio=true]{Fig3left.pdf}}\hfill
\subfigure[]{\label{fig3right}\includegraphics[height=0.57\linewidth, keepaspectratio=true]{Fig3right.pdf}}
\caption{(a) Dimensionless ratio of the line tension $\tau$ over the total force $h\gamma_{sl}K$ due to bulk and surface contributions for several fluid/solid to fluid/fluid interaction strength ratio $\varepsilon_{s}/\varepsilon$ increasing from purple to red. For a given color, the intensity from opaque to transparent indicates increasing $h$. (b) Dependence of the contact angle $\theta$ on the relative confinement $h/\sigma$ according to the interaction strength ratio (colors).}
\label{Fig3BC}
\end{figure}
Different wall/fluid interaction strengths $\varepsilon_{s}$, confinements $h$ and temperatures $T$ were considered to probe the value of the line tension $\tau$ on a broad range of parameters for the LJ fluid.
{At the higher considered temperature, of the order of 0.7 times the critical temperature, the error on the vapor pressure $P_{v}$ given by the perfect gas law is smaller than 5\% \cite{Schlaich2019}.}
We checked for each parameter set, that the magnitude of $\tau$ is significantly larger than the fluctuations on each of the two terms used in the difference in Eq. [\ref{Eq4}] to extract $\tau$ (see Supplementary Information and Fig. S3). Moreover, as shown in Fig. \ref{fig3left}, in most considered cases $\tau$ is larger than 10\% of the last term of Eq. [\ref{Eq4}] which fully legitimate its measurement from the difference between the two terms of Eq. [\ref{Eq4}]. Among the various considered cases, an important variability in the line tension values is observed. However, as shown in Fig. \ref{Fig3}, all line tension values almost collapse on a single master curve when plotted according to the contact angle $\theta$ extracted for each set of parameters. {Despite the large range of values explored for each parameter the limited departure from this general trend is particularly unexpected. The collapse of $\tau$ on a single curve for different $\varepsilon_{s}$, $\sigma_{s}$, $T$ and $h$ suggests that, to first order, the line tension can be estimated using $\theta$ only.
This parameterization is possible when using the zero adsorption definition for $h$ and the corresponding definition for $\theta$ given in Eq. [\ref{Eq9}]. }
The line tension plotted according to the contact angle demonstrates a non monotonic behavior with a minimum negative value for $\tau$ around $\theta=90$\textdegree\xspace and a divergence towards positive values close to the wetting transition. This behavior makes the bridge between nonlocal Density Functional Theory (DFT) calculations \cite{weijs_origin_2011} (dashed line in Fig. \ref{Fig3}) and Interface Displacement Model (IDM) by Joanny and de Gennes \cite{joanny_role_1986} (solid line in Fig. \ref{Fig3}) at the wetting transition. At the dewetting transition $\theta \to 180$\textdegree\xspace, the vapor wedge separating the liquid from the solid vanishes together with its contact line and its associated free energy $\tau$. For intermediate solid/fluid interaction strengths $0\text{\textdegree\xspace} < \theta < 180\text{\textdegree\xspace}$, the line tension is driven by a combination of microscopic effects that arise from the competition between the different molecular interactions but also potentially from fluid layering at interfaces. Here, analytic sums over molecular interactions do not allow estimating $\tau$ as it corresponds to a free energy contribution that also includes an entropy term \cite{getta_line_1998}. For $\theta =90$\textdegree\xspace, $\tau$ can be seen as a correction of the liquid-vapor surface tension which accounts for the progressive vanishing of pressure anisotropy close to the solid surface. This reduced pressure anisotropy lowers the free energy cost related to the liquid-vapor interface so that $\tau$ is negative (as discussed in \emph{Supplementary Information}, $\tau(90\text{\textdegree\xspace}) \sim -\gamma_{lv}\sigma = -0.74\varepsilon/ \sigma$).
At the wetting transition $\theta \rightarrow 0$\textdegree\xspace, liquid-vapor and solid-liquid interfaces become parallel and close to each other in the vicinity of the contact line. In this configuration, the line tension $\tau$ is mainly controlled by the disjoining pressure which arises from the interaction between these two interfaces.
In this case, the IDM \cite{joanny_role_1986} predicts that the line tension diverges as $\tau = \gamma_{lv}a (\ln (1/\theta)-1)$ with $a$ a solid-fluid interaction length (see \emph{Supplementary Information}). The molecular simulation data in Fig. \ref{Fig3} are consistent with the divergence predicted at the wetting transition by the IDM (solid line in Fig. \ref{Fig3}).
\begin{figure}[h!]
\centering
\includegraphics[width=8.6cm, keepaspectratio=true]{Fig3.pdf}
\caption{Line tension $\tau$ for a LJ fluid confined in slit pores of width $h$ ranging from 2 to 21 $\sigma$. For a given $h$, different interaction strengths $\varepsilon_{s}$ are considered (same color code as in Figs. \ref{Fig2} and \ref{Fig3BC} ). For a given color, the intensity from opaque to transparent indicates increasing $h$ (see inset showing $\tau$ as a function of $h$ for different $\varepsilon_{s}$). Different $T$ were considered: $k_{\textrm{B}}T/\varepsilon=0.7~\square, 0.75~\Diamond, 0.85~\pentagon, 0.9~\bigstar, 0.95~\triangledown$, and $1.0~\vartriangle$. The dashed line represents a nonlocal DFT model in a wedge \cite{weijs_origin_2011}. The solid line corresponds to the Interface Displacement Model at the wetting transition \cite{joanny_role_1986}. Simulations with $\sigma_{s}=\sigma$ lead to a similar behavior (black circles). Right axis: same $\tau$ but in real units using LJ parameters for argon ( $\sigma = 3.4$ \AA, $\varepsilon/k_b$ = 120 K). }
\label{Fig3}
\end{figure}
For wetting surfaces $\theta < 90$\textdegree\xspace, the effect of confinement on line tension provides evidence for the limitation of the scaling methodology based on Eq. [\ref{Eq1}] (inset of Fig. \ref{Fig3}). Line tensions are sometimes assumed to correspond to the curvature dependence of the liquid-vapor surface tension described through the Tolman length \cite{kanduc_going_2017,das_contact_nodate}. Yet, a major difference between effects arising from the stress anisotropy close to the contact line and curvature effects lies in the the spatial distribution of the excess free energy. While $\tau$ corresponds to effects localized in the vicinity of the contact line, curvature effects are distributed over the whole liquid-vapor interface (meniscus).
Fig. \ref{phibs} shows an estimate of the distribution of local stress anisotropy $p_y - p_x$ and local excess free energy $\varphi(x,z)$ with respect to the bulk and surface value for a representative example $\theta \sim 90$\textdegree\xspace (stresses were calculated using the Irving-Kirkwood convention \cite{irving_statistical_1950}). Fig. \ref{phiz} shows that the excess free energy $\phi(z)$, obtained from the integration of $\varphi(x,z)$ along the x direction, is strongly localized close to the triple lines, therefore supporting the line tension concept {(see \emph{Supplementary Information} for computation details)}.
\begin{figure}[ht]
\centering
\subfigure[]{\label{phibs}\includegraphics[width=\linewidth, keepaspectratio=true]{Fig4B.pdf}}
\subfigure[]{\label{phiz}\includegraphics[width=\linewidth]{Fig4.pdf}}
\caption{(a) Local pressure anisotropy $p_{x}-p_{y}$ and excess free energy $\varphi(x,z)$ for a LJ fluid confined in a slit pore. The solid-fluid interaction strength $\varepsilon_s$ was chosen so that $\theta = 96$\textdegree\xspace. (b) Distribution of the excess free energy $\phi(z)$ obtained as the integral along $x$ of $\varphi(x,z)$ . Each color plot corresponds to a different $h$ which increases from purple to green. The colored areas, which represent the integral of the excess free energy along the $z$ direction, correspond to $2\tau$. }
\label{Fig4}
\end{figure}
The novel strategy presented here was also used to determine the line tension $\tau$ for water (SPC/E water model) in the vicinity of structureless solid surfaces which interact with water through dispersive interactions or through homogeneously distributed hydrogen bonding \cite{yoshida_molecular_2014} (see \emph{Materials and Methods} and \cite{yoshida_molecular_2014}). Wall-induced polarization effects, ignored with the first type of interaction, are taken into account with the second type of interaction which mimics proton-acceptor sites of real surfaces.
Fig. \ref{Fig5} shows $\tau$ for water as a function of $\theta$ for both solid surfaces to investigate the effect of the molecular interactions at play. The two data sets feature a non monotonic behavior similar to that observed for the Lennard-Jones fluid. In both cases $\tau$ is minimum around $90$\textdegree\xspace and vanishes at the dewetting transition $\theta \rightarrow 180$\textdegree\xspace. This general non monotonic behavior suggests that the unifying formalism, described earlier for the LJ fluid, can be used for various fluids and solid/fluid interactions.
However, an important difference is observed at the wetting transition $\theta \rightarrow 0$\textdegree\xspace. The line tension $\tau$ for water close to dispersive surfaces becomes positive and diverges while it converges to a finite, seemingly negative, value for hydrogen-bonding surfaces. In view of the difference between the two interaction types, it is tempting to qualitatively relate such a behavior to the theoretical predictions of Indekeu \cite{indekeu_line_1992,joanny_role_1986} in the framework of the IDM. In the dispersive case, characterized by $z^{-3}$ attractive interactions between the solid and oxygen atoms of water, like for the LJ fluid, a divergence of the line tension at wetting is predicted. In the hydrogen-bonding case, water interactions with the solid differ in terms of oxygen/solid and hydrogen/solid interactions. Attractive interactions of oxygen and hydrogen atoms with solid plates scale respectively as $z^{-6}$ and $z^{-8}$ (see Fig.~\ref{HBp}). In both cases, these interactions decay faster than those corresponding to Van der Waals interactions (see Fig.~\ref{HBp}) so that they can be referred to short-range interactions according to Indekeu's formalism. The IDM model predicts for such short-range fluid/solid interactions that the line tension converges towards a finite and positive value. The fact that a finite line tension is measured at the wetting transition in the hydrogen bonding case suggests that it is indeed mainly controlled by these so called short-range interactions when $\theta \rightarrow 0$\textdegree\xspace.
\begin{figure}[ht]
\centering
\includegraphics[width=8.6cm, keepaspectratio=true]{Fig5.pdf}
\caption{Line tension $\tau$ for water confined at room temperature in a slit pore of a width $h =2.6$~nm between dispersive (circles) and hydrogen bonding (triangles) surfaces. For dispersive surfaces, the hydrophilicity is controlled by the solid-liquid interaction strength $\varepsilon_{s}$. For hydrogen bonding surfaces, the hydrophilicity is controlled by the parameter $\eta$ (see \emph{Materials and Methods}). }
\label{Fig5}
\end{figure}
The line tension tension in the case of water confined between either of the two types of surfaces is found to be about $-5$ pN for a contact angle close to $90$\textdegree\xspace. This value, measured at room temperature, is comparable with the value of $-11$ pN extracted by Tinti et al from out of equilibrium simulation of bubble nucleation within a hydrophobic cylindrical nanopore corresponding to a contact angle of $119$\textdegree\xspace \cite{Tinti2017}. The similarity between these two line tension values is remarkable given the strong difference between the two numerical approaches. Even more striking is the proximity of these values with the experimental value of $-25$ pN deduced from the measurement of the extrusion pressure of water out from hydrophobic nanopores having a similar contact angle \cite{guillemot_activated_2012}.
\section{Conclusion}
This study sheds light on the concept of line tension. It unravels a generic behavior, with in the case of dispersive fluids, a main dependence on the contact angle only. Using a novel strategy relying on a mechanical measurement at the molecular scale, our data for the Lennard-Jones fluid and water provide robust line tensions which depend on the wetting properties of the solid surface by the liquid phase. Our line tension values are found to be consistent with a series of theoretical, numerical and experimental data. The generic behavior emerging from our data, established on a full range of contact angles, allows unifying the different, sometimes conflicting, pictures in the literature. Far from the wetting transition, the line tensions inferred from our analysis suggest that this concept is robust down to the molecular scale with a simple dependence on confinement, temperature and solid-fluid interaction encompassed in the contact angle. For a contact angle about $90$\textdegree\xspace, the line tension for water at room temperature is consistent with that inferred from {out of equilibrium numerical and experimental measurements} based on water extrusion from hydrophobic porous materials. {Beyond measuring line tension values, the computational approach is particularly useful to identify the molecular structures, which are not accessible experimentally, such as layering, adsorption, presence of chemical groups such as OH$^{-}$ responsible for the measured line tension.}
While the present study is limited to a single liquid/vapor system at equilibrium on unstructured solid surfaces, additional physical features are to be expected for structured and thermalized surfaces, fluid mixtures, and out of equilibrium processes such as bubble nucleation.
\begin{acknowledgements}
This work was supported by the French Research Agency (ANR TAMTAM 15-CE08-0008 and LyStEn 15-CE06-0006). We thank E. Charlaix for fruitful discussions and NVIDIA Corporation for the donation of a Tesla K40 GPU used for this research.
\end{acknowledgements}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 4,891 |
Navillera (; lit. Like a Butterfly) é uma telenovela sul-coreana estrelada por , , e . Estreou na tvN em 22 de março de 2021 e está disponível para streaming na plataforma de streaming Netflix.
Sinopse
Shim Deok-chul () é um carteiro aposentado de 70 anos que decide perseguir seu sonho de aprender balé, o que não agrada sua família. Na academia de dança, ele conhece Lee Chae-rok (), um dançarino de 23 anos que se interessou por balé depois de experimentar diferentes esportes - sua mãe era dançarina de balé antes de morrer de uma doença quando ele era jovem. Ele está com dificuldades financeiras e pensa em desistir do balé quando conhece Deok-chul, o que o faz mudar de ideia.
Elenco
Principais
Park In-hwan como Shim Deok-chul
Song Kang como Lee Chae-rok
Na Moon-hee como Choi Hae-nam
Hong Seung-hee como Shim Eun-ho
Secundários
Shin Eun-jung como Kim Ae-ran
Jung Hae-kyun como Shim Sung-san
Kim Soo-jin como Shim Sung-suk
Jo Sung-ha como Lee Moo-young
Yoon Ji-hye como Eun So-ri
Kim Tae-hoon como Ki Seung-joo
Jeong Hee-tae como Young-il
Jo Bok-rae como Shim Sung-gwan
Kim Hyun-mok como Kim Se-jong
Kim Kwon como Yang Ho-beom
Lee So-yeong como Yoo An-na
Recepção
Audiência (em milhões)
Ligações externas
Dramas da Coreia do Sul
Programas da Netflix
Programas de televisão produzidos pelo Studio Dragon
Programas de televisão da Coreia do Sul que estrearam em 2021
Programas de televisão da Coreia do Sul encerrados em 2021
Telenovelas da TVN (Coreia do Sul)
Telenovelas em coreano
Telenovelas da década de 2020 | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 8,223 |
\section{The incomplete revolution}
Quantum mechanics (QM) and general relativity (GR) have modified
our understanding of the physical world in depth. But they have
left us with a general picture of the physical world which is
unclear, incomplete, and fragmented. Combining what we have
learn about our world from the two theories and finding a new
synthesis is a major challenge, perhaps {\em the\/} major
challenge, in today's fundamental physics.
The two theories have a opened a major scientific revolution, but
this revolution is not completed. Most of the physics of this
century has been a sequel of triumphant explorations of the new
worlds opened by QM and GR. QM lead to nuclear physics, solid
state physics, and particle physics. GR to relativistic
astrophysics, cosmology and is today leading us towards
gravitational astronomy. The urgency of applying the two
theories to larger and larger domains, the momentous
developments, and the dominant pragmatic attitude of the middle
of this century, have obscured the fact that a consistent picture
of the physical world, more or less stable for three centuries,
has been lost with the advent of QM and GR. This pragmatic
attitude cannot be satisfactory, or productive, in the long run.
The basic Cartesian-Newtonian notions such as matter, space,
time, causality, have been modified in depth. The new notions do
not stay together. At the basis of our understanding of the
world reigns a surprising confusion. From QM and GR we know that
we live in a spacetime with quantum properties, that is, a {\em
quantum spacetime}. But what is a quantum spacetime?
In the last decade, the attention of the theoretical physicists
has been increasingly focusing on this major problem. Whatever
the outcome of the enterprise, we are witnessing a large scale
intellectual effort for accomplishing a major aim: completing the
XXth scientific revolution, and finding a new synthesis.
In this effort, physics is once more facing {\em conceptual\/}
problems: {\em What is matter? What is causality? What is the
role of the observer in physics? What is time? What is the
meaning of ``being somewhere''? What is the meaning of ``now''?
What is the meaning of ``moving''? Is motion to be defined with
respect to objects or with respect to space?\/} These
foundational questions, or sophisticated versions of these
questions, were central in the thinking and in the results of
Einstein, Heisenberg, Bohr, Dirac and their colleagues. But
these are also precisely the same questions that Descartes,
Galileo, Huygens, Newton and their contemporaries debated with
passion -- the questions that lead them to create modern science.
For the physicists of the middle of this century, these questions
were irrelevant: one does not need to worry about first
principles in order to apply the Schr\"odinger equation to the
helium atom, or to understand how a neutron star stays together.
But today, if we want to find a novel picture of the world, if we
want to understand what is quantum spacetime, we have to return,
once again, to those foundational issues. We have to find a new
answer to these questions --different from Newton's answer--
which took into account what we have learned about the world with
QM and GR.
Of course, we have little, if any, direct empirical access to the
regimes in which we expect genuine quantum gravitational
phenomena to appear. Anything could happen at those
fantastically small distance scales, far removed from our
experience. Nevertheless, we do have information about quantum
gravity, and we do have indications on how to search it. In
fact, we are precisely in one of the very typical situations in
which good fundamental theoretical physics has been working at
its best in the past: we have learned two new extremely general
``facts'' about our world, QM and GR, and we have ``just'' to
figure out what they imply, when taken together. The most
striking advances in theoretical physics happened in situations
analogous to this one.
Here, I present some reflections on these issues.\footnote{For
recent general overviews of current approaches to quantum gravity, see
(Isham 1999) and (Rovelli 1999).} What have we
learned about the world from QM and, especially, GR? What do we
know about space, time and matter? What can we expect from a
quantum theory of spacetime? To which extent does taking QM and
GR into account force us to modify the notion of time? What can
we already say about quantum spacetime?
I present also a few reflections on issues raised by the relation
between philosophy of science and research in quantum gravity. I
am not a philosopher, and I can touch philosophical issues only
at the risk of being naive. I nevertheless take this risk here,
encouraged by Craig Callender and Nick Huggett extremely
stimulating idea of this volume. I present some methodological
considerations --How shall we search? How can the present
successful theories can lead us towards a theory that does not
yet exist?-- as well as some general consideration. In
particular, I discuss the relation between physical theories that
supersed each others and the attitude we may have with respect to
the truth-content of a physical theory, with respect to the
reality of the theoretical objects the theory postulates in
particular, and to its factual statements on the world in
general.
I am convinced of the reciprocal usefulness of a dialog between
physics and philosophy (Rovelli 1997a). This dialog has played a
major role during the other periods in which science faced
foundational problems. In my opinion, most physicists
underestimate the effect of their own epistemological prejudices
on their research. And many philosophers underestimate the
influence --positive or negative-- they have on fundamental
reserach. On the one hand, a more acute philosphical awarness
would greatly help the physicists engaged in fundamental
research: Newton, Heisenberg and Einstein couldn't have done what
they have done if they weren't nurtured by (good or bad)
philosophy. On the other hand, I wish contemporary philosophers
concerned with science would be more interested in the ardent
lava of the foundational problems science is facing today. It is
here, I believe, that stimulating and vital issues lie.
\section{The problem}
What is the task of a quantum theory of gravity, and how should
we search for such a theory? The task of the search is clear and
well defined. It is determined by recalling the three major
steps that lead to the present problematic situation.
\subsection{First step. A new actor on the stage: the field}
The first step is in the works of Faraday, Maxwell and Einstein.
Faraday and Maxwell have introduced a new fundamental notion in
physics, the field. Faraday's book includes a fascinating
chapter with the discussion of whether the field (in Faraday's
terminology, the ``lines of force'') is ``real''. As far as I
understand this subtle chapter (understanding Faraday is tricky:
it took the genius of Maxwell), in modern terms what Faraday is
asking is whether there are independent degrees of freedom in the
electric and magnetic fields. A degree of freedom is a quantity
that I need to specify (more precisely: whose value and whose
time derivative I need to specify) in order to be able to predict
univocally the future evolution of the system. Thus Faraday is
asking: if we have a system of interacting charges, and we know
their positions and velocities, is this knowledge sufficient to
predict the future motions of the charges? Or rather, in order
to predict the future, we have to specify the instantaneous
configuration of the field (the fields degrees of freedom), as
well? The answer is in Maxwell equations: the field has
independent degrees of freedom. We cannot predict the future
evolution of the system from its present state unless we know the
instantaneous field configuration. Learning to use these degrees
of freedom lead to radio, TV and cellular phone.
To which physical entity do the degrees of freedom of the
electromagnetic field refer? This was one of the most debated
issues in physics towards the end of last century. The
electromagnetic waves have aspects in common with water waves, or
with sound waves, which describe vibrations of some material
medium. The natural interpretation of the electromagnetic field
was that it too describes the vibrations of some material medium
-- for which the name ``ether'' was chosen. A strong argument
supports this idea: The wave equations for water or sound waves
fail to be Galilean invariant. They do so because they describe
propagation over a medium (water, air) whose state of motion
breaks Galilean invariance and defines a preferred reference
frame. Maxwell equations break Galilean invariance as well and
it was thus natural to hypothesize a material medium determining
the preferred reference frame. But a convincing dynamical theory
of the ether compatible with the various experiments (for
instance on the constancy of the speed of light) could not be
found.
Rather, physics took a different course. Einstein {\em
believed\/} Maxwell theory as a fundamental theory and {\em
believed\/} the Galilean insight that velocity is relative and
inertial system are equivalent. Merging the two, he found
special relativity. A main result of special relativity is that
the field cannot be regarded as describing vibrations of
underlying matter. The idea of the ether is abandoned, and {\em
the field has to be taken seriously as elementary constituent of
reality}. This is a major change from the ontology of
Cartesian-Newtonian physics. In the best description we can give
of the physical world, there is a new actor: the field. The
electromagnetic field can be described by the Maxwell potential
$A_{\mu}(x),\ \mu=0,1,2,3$. The entity described by $A_{\mu}(x)$
(more precisely, by a gauge-equivalent class of $A_{\mu}(x)$'s)
is one of the elementary constituents of the physical world,
according to the best conceptual scheme physics has find, so far,
for grasping our world.
\subsection{Second step. Dynamical entities have quantum properties}
The second step (out of chronological order) is the replacement
of the mechanics of Newton, Lagrange and Hamilton with quantum
mechanics (QM). As did classical mechanics, QM provides a very
general framework. By formulating a specific dynamical theory
within this framework, one has a number of important physical
consequences, substantially different from what is implied by the
Newtonian scheme. Evolution is probabilistically determined
only; some physical quantities can take certain discrete values
only (are ``quantized''); if a system can be in a state $A$,
where a physical quantity $q$ has value $a$, as well as in state
$B$, where $q$ has value $b$, then the system can also be in
states (denoted $\Psi=c_{a}A+c_{b}B$) where $q$, has value $a$
with probability $|c_{a}|^{2}/(|c_{a}|^{2}+|c_{b}|^{2})$, or,
alternatively, $b$ with probability $|c_{b}|^{2} /(|c_{a}|^{2}
+|c_{b}|^{2})$ (superposition principle); conjugate variables
cannot be assumed to have value at the same time (uncertainty
principle); and what we can say about the properties that the
system will have the-day-after-tomorrow is not determined just by
what we can say about the system today, but also on what we will
be able to say about the system tomorrow. (Bohr would had simply
said that observations affect the system. Formulations such as
Bohm's or consistent histories force us to use intricate wording
for naming the same physical fact.)
The formalism of QM exists in a number of more or less equivalent
versions: Hilbert spaces and self-adjoint observables, Feynman's
sum over histories, algebraic formulation, and others. Often, we
are able to translate from one formulation to another. However,
often we cannot do easily in one formulation, what we can do in
another.
QM is not the theory of micro-objects. It is our best form of
mechanics. If quantum mechanics failed for macro-objects, we
would have detected the boundary of its domain of validity in
mesoscopic physics. We haven't.\footnote{Following Roger
Penrose's opposite suggestions of a failure of conventional QM
induced by gravity (Penrose 1995), Antony Zeilinger is preparing
an experiment to test such a possible failure of QM (Zeilinger
1997). It would be very exciting if Roger turned out to be
right, but I am afraid that QM, as usual, will win.} The
classical regime raises some problems (why effects of macroscopic
superposition are difficult to detect?). Solving these problems
requires good understanding of physical decoherence and perhaps
more. But there is no reason to doubt that QM represents a
deeper, not a shallower level of understanding of nature than
classical mechanics. Trying to resolve the difficulties in our
grasping of our quantum world by resorting to old classical
intuition is just lack of courage. We have learned that the
world has quantum properties. This discovery will stay with us,
like the discovery that velocity is only relational or like the
discovery that the Earth is not the center of the universe.
The empirical success of QM is immense. Its physical obscurity
is undeniable. Physicists do not yet agree on what QM precisely
says about the world (the difficulty, of course, refers to
physical meaning of notions such as ``measurement'', ``history'',
``hidden variable'', \ldots). It is a bit like the Lorentz
transformations before Einstein: correct, but what do they mean?
In my opinion, what QM means is that the contingent (variable)
properties of any physical system, or the state of the system,
are relational notion which only make sense when referred to a
second physical system. I have argued for this thesis in
(Rovelli 1996, Rovelli 1998). However, I will not enter in this
discussion here, because the issue of the interpretation of QM
has no direct connection with quantum gravity. Quantum gravity
and the interpretation of QM are two major but (virtually)
completely unrelated problems.
QM was first developed for systems with a finite number of
degrees of freedom. As discussed in the previous section,
Faraday, Maxwell and Einstein had introduced the field, which has
an infinite number of degrees of freedom. Dirac put the two
ideas together. He {\em believed\/} quantum mechanics and he
{\em believed\/} Maxwell's field theory much beyond their
established domain of validity (respectively: the dynamics of
finite dimensional systems, and the classical regime) and
constructed quantum field theory (QFT), in its first two
incarnations, the quantum theory of the electromagnetic field and
the relativistic quantum theory of the electron. In this
exercise, Dirac derived the existence of the photon just from
Maxwell theory and the basics of QM. Furthermore, by just {\em
believing\/} special relativity and {\em believing\/} quantum
theory, namely assuming their validity far beyond their
empirically explored domain of validity, he predicted the
existence of antimatter.
The two embryonal QFT's of Dirac were combined in the fifties by
Feynman and his colleagues, giving rise to quantum
electrodynamics, the first nontrivial interacting QFT. A
remarkable picture of the world was born: quantum fields over
Minkowski space. Equivalently, \`a la Feynman: the world as a
quantum superposition of histories of real and virtual
interacting particles. QFT had ups and downs, then triumphed with
the standard model: a consistent QFT for all interactions (except
gravity), which, in principle, can be used to predict anything we
can measure (except gravitational phenomena), and which, in the
last fifteen years has received nothing but empirical
verifications.
\subsection{Third step. The stage becomes an actor}
Descartes, in {\em Le Monde}, gave a fully relational definition
of localization (space) and motion (on the
relational/substantivalist issue, see Earman and Norton 1987,
Barbour 1989, Earman 1989, Rovelli 1991a, Belot 1998). According
to Descartes, there is no ``empty space''. There are only
objects, and it makes sense to say that an object A is contiguous
to an object B. The ``location'' of an object A is the set of the
objects to which A is contiguous. ``Motion'' is change in
location. That is, when we say that A moves we mean that A goes
from the contiguity of an object B to the contiguity of an object
C\footnote{``We can say that movement is the transference of one
part of matter or of one body, from the vicinity of those bodies
immediately contiguous to it, and considered at rest, into the
vicinity of some others'', (Descartes, {\em Principia
Philosophiae}, Sec II-25, pg 51).}. A consequence of this
relationalism is that there is no meaning in saying ``A moves'',
except if we specify with respect to which other objects (B,
C,\ldots) it is moving. Thus, there is no ``absolute'' motion.
This is the same definition of space, location, and motion, that
we find in Aristotle. \footnote{Aristotle insists on this point,
using the example of the river that moves with respect to the
ground, in which there is a boat that moves with respect to the
water, on which there is a man that walks with respect to the
boat \ldots. Aristotle's relationalism is tempered by the fact
that there is, after all, a preferred set of objects that we can
use as universal reference: the Earth at the center of the
universe, the celestial spheres, the fixed stars. Thus, we can
say, if we desire so, that something is moving ``in absolute
terms'', if it moves with respect to the Earth. Of course, there
are {\em two\/} preferred frames in ancient cosmology: the one of
the Earth and the one of the fixed stars; the two rotates with
respect to each other. It is interesting to notice that the
thinkers of the middle ages did not miss this point, and
discussed whether we can say that the stars rotate around the
Earth, rather than being the Earth that rotates under the {\em
fixed\/} stars. Buridan concluded that, on ground of reason, in
no way one view is more defensible than the other. For
Descartes, who writes, of course, after the great Copernican
divide, the Earth is not anymore the center of the Universe and
cannot offer a naturally preferred definition of stillness.
According to malignants, Descartes, fearing the Church and scared
by what happened to Galileo's stubborn defense of the idea that
``the Earth moves'', resorted to relationalism, in {\em Le
Monde}, precisely to be able to hold Copernicanism without having
to commit himself to the absolute motion of the Earth!}
Relationalism, namely the idea that motion can be defined only in
relation to other objects, should not be confused with Galilean
relativity. Galilean relativity is the statement that
``rectilinear uniform motion'' is a priori indistinguishable from
stasis. Namely that velocity (but just velocity!), is relative
to other bodies. Relationalism holds that {\em any\/} motion
(however zigzagging) is a priori indistinguishable from stasis.
The very formulation of Galilean relativity requires a
nonrelational definition of motion (``rectilinear and uniform''
with respect to what?).
Newton took a fully different course. He devotes much energy to
criticise Descartes' relationalism, and to introduce a different
view. According to him, {\em space\/} exists. It exists even if
there are no bodies in it. Location of an object is the part of
space that the object occupies. Motion is change of
location.\footnote{
``So, it is necessary that the definition of places, and hence
local motion, be referred to some motionless thing such as
extension alone or {\em space\/}, in so far as space is seen
truly distinct from moving bodies'', (Newton {\it De gravitatione et
Aequipondio Fluidorum} 89-156). Compare with the
quotation of Descartes in the footnote above.}
Thus, we can say whether an object moves or not, irrespectively
from surrounding objects. Newton argues that the notion of
absolute motion is necessary for constructing mechanics. His
famous discussion of the experiment of the rotating bucket in the
{\em Principia\/} is one of the arguments to prove that motion is
absolute.
This point has often raised confusion because one of the
corollaries of Newtonian mechanics is that there is no detectable
preferred referential frame. Therefore the notion of {\em
absolute velocity\/} is, actually, meaningless, in Newtonian
mechanics. The important point, however, is that in Newtonian
mechanics velocity is relative, but any other feature of motion
is not relative: it is absolute. In particular, acceleration is
absolute. It is acceleration that Newton needs to construct his
mechanics; it is acceleration that the bucket experiment is
supposed to prove to be absolute, against Descartes. In a sense,
Newton overdid a bit, introducing the notion of absolute position
and velocity (perhaps even just for explanatory purposes?). Many
people have later criticised Newton for his unnecessary use of
absolute position. But this is irrelevant for the present
discussion. The important point here is that Newtonian
mechanics requires absolute acceleration, against Aristotle and
against Descartes. Precisely the same does special relativistic
mechanics.
Similarly, Newton introduce absolute time. Newtonian space and
time or, in modern terms, spacetime, are like a {\em stage\/}
over which the action of physics takes place, the various
dynamical entities being the actors.
The key feature of this stage, Newtonian spacetime, is its
metrical structure. Curves have length, surfaces have area,
regions of spacetime have volume. Spacetime points are at fixed
{\em distance\/} the one from the other. Revealing, or
measuring, this distance, is very simple. It is sufficient to
take a rod and put it between two points. Any two points which
are one rod apart are at the same distance. Using modern
terminology, physical space is a linear three-dimensional (3d)
space, with a preferred metric. On this space there exist
preferred coordinates $x^{i},\ i=1,2,3$, in terms of which the
metric is just $\delta_{ij}$. Time is described by a single
variable $t$. The metric $\delta_{ij}$ determines lengths, areas
and volumes and defines what we mean by straight lines in space.
If a particle deviates with respect to this straight line, it is,
according to Newton, accelerating. It is not accelerating with
respect to this or that dynamical object: it is accelerating in
absolute terms.
Special relativity changes this picture only marginally, loosing
up the strict distinction between the ``space'' and the ``time''
components of spacetime. In Newtonian spacetime, space is given
by fixed 3d planes. In special relativistic spacetime, which 3d
plane you call space depends on your state of motion. Spacetime
is now a 4d manifold $M$ with a flat Lorentzian metric
$\eta_{\mu\nu}$. Again, there are preferred coordinates
$x^{\mu},\ \mu=0,1,2,3$, in terms of which $\eta _{\mu\nu} =
diag[1,-1,-1,-1]$. This tensor, $\eta_{\mu\nu}$, enters all
physical equations, representing the determinant influence of the
stage and of its metrical properties on the motion of anything.
Absolute acceleration is deviation of the world line of a
particle from the straight lines defined by $\eta_{\mu\nu}$. The
only essential novelty with special relativity is that the
``dynamical objects'', or ``bodies'' moving over spacetime now
include the fields as well. Example: a violent burst of
electromagnetic waves coming from a distant supernova has {\em
traveled across space\/} and has reached our instruments. For
the rest, the Newtonian construct of a fixed background stage
over which physics happen is not altered by special relativity.
The profound change comes with general relativity (GR). The
central discovery of GR, can be enunciated in three points. One
of these is conceptually simple, the other two are tremendous.
First, the gravitational force is mediated by a field, very much
like the electromagnetic field: the gravitational field. Second,
Newton's {\em spacetime}, the background stage that Newton
introduced introduced, against most of the earlier European
tradition, {\em and the gravitational field, are the same thing}.
Third, the dynamics of the gravitational field, of the other
fields such as the electromagnetic field, and any other dynamical
object, is fully relational, in the Aristotelian-Cartesian sense.
Let me illustrate these three points.
First, the gravitational field is represented by a field on
spacetime, $g_{\mu\nu}(x)$, just like the electromagnetic field
$A_{\mu}(x)$. They are both very concrete entities: a strong
electromagnetic wave can hit you and knock you down; and so can a
strong gravitational wave. The gravitational field has
independent degrees of freedom, and is governed by dynamical
equations, the Einstein equations.
Second, the spacetime metric $\eta_{\mu\nu}$ disappears from all
equations of physics (recall it was ubiquitous). At its place
--we are instructed by GR-- we must insert the gravitational
field $g_{\mu\nu}(x)$. This is a spectacular step: Newton's
background spacetime was nothing but the gravitational field!
The stage is promoted to be one of the actors. Thus, in all
physical equations one now sees the direct influence of the
gravitational field. How can the gravitational field determine
the metrical properties of things, which are revealed, say, by
rods and clocks? Simply, the inter-atomic separation of the rods'
atoms, and the frequency of the clock's pendulum are determined
by explicit couplings of the rod's and clock's variables with the
gravitational field $g_{\mu\nu}(x)$, which enters the equations
of motion of these variables. Thus, any measurement of length,
area or volume is, in reality, a measurement of features of the
gravitational field.
But what is really formidable in GR, the truly momentous
novelty, is the third point: the Einstein equations, as well as
{\em all other equations of physics} appropriately modified
according to GR instructions, are fully relational in the
Aristotelian-Cartesian sense. This point is independent from the
previous one. Let me give first a conceptual, then a technical
account of it.
The point is that the only physically meaningful definition of
location that makes physical sense within GR is relational. GR
describes the world as a set of interacting fields and, possibly,
other objects. One of these interacting fields is
$g_{\mu\nu}(x)$. Motion can be defined only as positioning and
displacements of these dynamical objects relative to each other
(for more details on this, see Rovelli 1991a and especially
1997a).
To describe the motion of a dynamical object, Newton had to
assume that acceleration is absolute, namely it is not relative
to this or that other dynamical object. Rather, it is relative
to a background space. Faraday Maxwell and Einstein extended the
notion of ``dynamical object'': the stuff of the world is fields,
not just bodies. Finally, GR tells us that the background space
is itself one of these fields. Thus, the circle is closed, and
we are back to relationalism: Newton's motion with respect to
space is indeed motion with respect to a dynamical object: the
gravitational field.
All this is coded in the active diffeomorphism invariance (diff
invariance) of GR.\footnote{Active diff invariance should not be
confused with passive diff invariance, or invariance under change
of coordinates. GR can be formulated in a coordinate free
manner, where there are no coordinates, and no changes of
coordinates. In this formulation, there field equations are {\em
still\/} invariant under active diffs. Passive diff invariance
is a property of a formulation of a dynamical theory, while
active diff invariance is a property of the dynamical theory
itself. A field theory is formulated in manner invariant under
passive diffs (or change of coordinates), if we can change the
coordinates of the manifold, re-express all the geometric
quantities (dynamical {\em and non-dynamical\/}) in the new
coordinates, and the form of the equations of motion does not
change. A theory is invariant under active diffs, when a smooth
displacement of the dynamical fields ({\em the dynamical fields
alone\/}) over the manifold, sends solutions of the equations of
motion into solutions of the equations of motion. Distinguishing
a truly dynamical field, namely a field with independent degrees
of freedom, from a nondynamical filed disguised as dynamical
(such as a metric field $g$ with the equations of motion
Riemann[g]=0) might require a detailed analysis (for instance,
hamiltonian) of the theory.} Because active diff invariance is a
gauge, the physical content of GR is expressed only by those
quantities, derived from the basic dynamical variables, which are
fully independent from the points of the manifold.
In introducing the background stage, Newton introduced two
structures: a spacetime manifold, and its non-dynamical metric
structure. GR gets rid of the non-dynamical metric, by replacing
it with the gravitational filed. More importantly, it gets rid
of the manifold, by means of active diff invariance. In GR, the
objects of which the world is made do not live over a stage and
do not live on spacetime: they live, so to say, over each
other's shoulders.
Of course, nothing prevents us, if we wish to do so, from
singling out the gravitational field as ``the more equal among
equals'', and declaring that location is absolute in GR, because
it can be defined with respect to it. But this can be done
within any relationalism: we can always single out a set of
objects, and declare them as not-moving by
definition\footnote{Notice that Newton, in the passage quoted in
the footnote above argues that motion must be defined with respect
to motionless space ``in so far as space is seen truly distinct
from moving bodies''. That is: motion should be defined with
respect to something that has no dynamics.}. The problem with
this attitude is that it fully misses the great Einsteinian
insight: that Newtonian spacetime is just one field among the
others. More seriously, this attitude sends us into a nightmare
when we have to deal with the motion of the gravitational field
itself (which certainly ``moves'': we are spending millions for
constructing gravity wave detectors to detect its tiny
vibrations). There is no absolute referent of motion in GR: the
dynamical fields ``move'' with respect to each other.
Notice that the third step was not easy for Einstein, and came
later than the previous two. Having well understood the first
two, but still missing the third, Einstein actively searched for
non-generally covariant equations of motion for the gravitational
field between 1912 and 1915. With his famous ``hole argument''
he had convinced himself that generally covariant equations of
motion (and therefore, in this context, active diffeomorphism
invariance) would imply a truly dramatic revolution with respect
to the Newtonian notions of space and time (on the hole argument,
see Earman and Norton 1987, Rovelli 1991a, Belot 1998). In 1912
he was not able to take this profoundly revolutionary step
(Norton 1984, Stachel 1989). In 1915 he took this step, and
found what Landau calls ``the most beautiful of the physical
theories''.
\subsection{Bringing the three steps together}
At the light of the three steps illustrated above, the task of
quantum gravity is clear and well defined. He have learned from
GR that spacetime is a dynamical field among the others, obeying
dynamical equations, and having independent degrees of freedom. A
gravitational wave is extremely similar to an electromagnetic
wave. We have learned from QM that every dynamical object has
quantum properties, which can be captured by appropriately
formulating its dynamical theory within the general scheme of QM.
{\em Therefore\/}, spacetime itself must exhibit quantum
properties. Its properties, including the metrical
properties it defines, must be represented in quantum mechanical
terms. Notice that the strength of this ``therefore'' derives
from the confidence we have in the two theories, QM and GR.
Now, there is nothing in the basics of QM which contradicts the
physical ideas of GR. Similarly, there is nothing in the basis of
GR that contradicts the physical ideas of QM. Therefore, there is
no a priori impediment in searching for a quantum theory of the
gravitational fields, that is, a quantum theory of spacetime.
The problem is (with some qualification) rather well posed: is
there a quantum theory (say, in one formulation, a Hilbert space
$H$, and a set of self-adjoint operators) whose classical limit
is GR?
On the other hand, all previous applications of QM to {\em
field\/} theory, namely conventional QFT's, rely heavily on the
existence of the ``stage'', the fixed, non-dynamical, background
metric structure. The Minkowski metric $\eta_{\mu\nu}$is
essentially for the construction of a conventional QFT (in enters
everywhere; for instance, in the canonical commutation relations,
in the propagator, in the Gaussian measure \ldots). We certainly
cannot simply replace $\eta_{\mu\nu}$ with a quantum field,
because all equations become nonsense.
Therefore, to search for a quantum theory of gravity, we have two
possible directions. One possibility is to ``disvalue'' the GR
conceptual revolution, reintroduce a background spacetime with a
non-dynamical metric $\eta_{\mu\nu}$, expand the gravitational
field $g_{\mu\nu}$ as $g_{\mu\nu} = \eta_{\mu\nu} +
fluctuations$, quantize only the fluctuations, and hope to
recover the full of GR somewhere down the road. This is the road
followed for instance by perturbative string theory.
The second direction is to be faithful to what we have learned
about the world so far. Namely to the QM and the GR insights.
We must then search a QFT that, genuinely, does not
require a background space to be defined. But the last three
decades whave been characterized by the great success of
conventional QFT, which neglects GR and is based on the existence
of a background spacetime. We live in the aftermath of this
success. It is not easy to get out from the mental habits and
from the habits to the technical tools of conventional QFT.
Still, this is necessary if we want to build a QFT which fully
incorporates active diff invariance, and in which localization is
fully relational. In my opinion, this is the right way to go.
\section{Quantum spacetime}
\subsection{Space}
Spacetime, or the gravitational field, is a dynamical entity
(GR). All dynamical entities have quantum properties (QM).
Therefore spacetime is a quantum object. It must be described
(picking one formulation of QM, but keeping in mind that others
may be equivalent, or more effective) in terms of states $\Psi$
in a Hilbert space. Localization is relational. Therefore these
states cannot represent quantum excitations localized in some
space. They must define space themselves. They must be quantum
excitations ``of'' space, not ``in'' space. Physical quantities
in GR, that capture the true degrees of freedom of the theory are
invariant under active diff. Therefore the
self-adjoint operators that correspond to physical (predictable)
observables in quantum gravity must be associated to
diff invariant quantities.
Examples of diff-invariant geometric quantities are physical
lengths, areas, volumes, or time intervals, of regions determined
by dynamical physical objects. These must be represented by
operators. Indeed, a measurement of length, area or volume is a
measurement of features of the gravitational field. If the
gravitational field is a quantum field, then length, area and
volume are quantum observables. If the corresponding operator
has discrete spectrum, they will be quantized, namely they can
take certain discrete values only. In this sense we should
expect a discrete geometry. This discreteness of the geometry,
implied by the conjunction of GR and QM is very different from
the naive idea that the world is made by discrete bits of
something. It is like the discreteness of the quanta of the
excitations of an harmonic oscillator. A generic state of
spacetime will be a continuous quantum superposition of states
whose geometry has discrete features, not a collection of
elementary discrete objects.
A concrete attempt to construct such a theory, is loop quantum
gravity. I refer the reader to Rovelli (1997b) for an
introduction to the theory, an overview of its structure and
results, and full references. Here, I present only a few remarks
on the theory. Loop quantum gravity is a rather straightforward
application of quantum mechanics to hamiltonian general
relativity. It is a QFT in the sense that it is a quantum
version of a field theory, or a quantum theory for an infinite
number of degrees of freedom, but it is profoundly different from
conventional, non-general-relativistic QFT theory. In
conventional QFT, states are quantum excitations of a field over
Minkowski (or over a curved) spacetime. In loop quantum gravity,
the quantum states turn out to be represented by (suitable linear
combinations of) spin networks (Rovelli and Smolin 1995a, Baez
1996, Smolin 1997). A spin network is an abstract graphs with
links labeled by half-integers. See Figure 1.
\begin{figure}
\centerline{\mbox{\epsfig{file=Fig1.eps}}}
\caption{A simple spin network.}
\end{figure}
Intuitively, we can view each node of the graph as an elementary
``quantum chunk of space''. The links represent (transverse)
surfaces separating the quanta of space. The half-integers
associated to the links determine the (quantized) area of these
surfaces. The spin network represent relational quantum states:
they are not located in a space. Localization must be defined in
relation to them. For instance, if we have, say, a matter
quantum excitation, this will be located on the spin network;
while the spin network itself is not located anywhere.
The operators corresponding to area and volume have been
constructed in the theory, simply by starting from the classical
expression for the area in terms of the metric, then replacing
the metric with the gravitational field (this is the input of GR)
and then replacing the gravitational field with the corresponding
quantum field operator (this is the input of QM). The
construction of these operators requires appropriate generally
covariant regularization techniques, but no renormalization: no
infinities appear. The spectrum of these operators has been
computed and turns out to be discrete (Rovelli and Smolin 1995b,
Ashtekar Lewandowski 1997a, 1997b). Thus, loop quantum gravity
provides a family of precise quantitative predictions: the
quantized values of area and volume. For instance, the (main
sequence) of the spectrum of the area is
\begin{displaymath}
A = 8\,\pi\,\hbar\,G \sum_{i=1,n}\sqrt{j_i(j_i+1)}
\end{displaymath}
where $(j_{i})=(j_{1}\ldots j_{n})$ is any finite sequence of
half integers. This formula gives the area of a surface pinched
by $n$ links of a spin network state. The half integers
$j_{1}\ldots j_{n}$ are ones associated with the $n$ links that
pinch the surface. This illustrates how the links of the spin
network states can be viewed as transversal ``quanta of area''.
The picture of macroscopic physical space that emerges is then
that of a tangle of one-dimensional intersecting quantum
excitation, called the weave (Ashtekar Rovelli and Smolin 1992).
Continuous space is formed by the weave in the same manner in
which the continuous 2d surface of a T-shirt is formed by weaved
threads.
\subsection{Time}
The aspect of the GR's relationalism that concerns space was
largely anticipated by the earlier European thinking. Much less
so (as far as I am aware) was the aspect of this relationalism
that concerns time. GR's treatment of time is surprising,
difficult to fully appreciate, and hard to digest. The time of
our perceptions is very different from the time that theoretical
physics finds in the world as soon as one exits the minuscule
range of physical regimes we are accustomed to. We seem to
have a very special difficulty in being open minded about this
particular notion.
Already special relativity teaches us something about time which
many of us have difficulties to accept. According to special
relativity, there is absolute no meaning in saying ``right now on
Andromeda''. There is no physical meaning in the idea of ``the
state of the world right now'', because which set of events we
consider as ``now'' is perspectival. The ``now'' on Andromeda
for me might correspond to ``a century ago'' on Andromeda for
you. Thus, there is no single well defined universal time in
which the history of the universe ``happens''. The modification
of the concept of time introduced by GR is much deeper. Let me
illustrate this modifications.
Consider a simple pendulum described by a variable $Q$. In
Newtonian mechanics, the motion of the pendulum is given by the
evolution of $Q$ in time, namely by $Q(T)$, which is governed by
the equation of motion, say $\ddot Q=-\omega Q$, which has (the
two-parameter family of) solutions $Q(T)=A\sin(\omega T+\phi)$.
The state of the pendulum at time $T$ can be characterized by its
position and velocity. From these two, we can
compute $A$ and $\phi$ and therefore $Q(T)$ at any $T$. From the
physical point of view, we are really describing a situation in
which there are {\em two\/} physical objects: a pendulum, whose
position is $Q$, and a clock, indicating $T$. If we want to take
data, we have to repeatedly observe $Q$ and $T$. Their {\em
relation\/} will be given by the equation above. The relation
can be represented (for given $A$ and $\phi$) by a line in the
$(Q,T)$ plane.
In Newtonian terms, time flows in its absolute way, the clock is
just a devise to keep track of it, and the dynamical system is
formed by the pendulum alone. But we can view the same physical
situation from a different perspective. We can say that we have
a physical system formed by the clock and the pendulum together
and view the dynamical system as expressing the relative motion
of one with respect to the other. This is precisely the
perspective of GR: to express the relative motion of the
variables, with respect to each other, in a ``democratic''
fashion.
To do that, we can introduce an ``arbitrary parameter time''
$\tau$ as a coordinate on the line in the $(Q,T)$ plane. (But
keep in mind that the physically relevant information is in the
line, not in its coordinatization!). Then the line is
represented by two functions, $Q(\tau)$ and $T(\tau)$, but a
reparametrization of $\tau$ in the two functions is a gauge,
namely it does not modify the physics described. Indeed, $\tau$
does not correspond to anything observable, and the equations of
motion satisfied by $Q(\tau)$ and $T(\tau)$ (easy to write, but I
will not write them down here) will be invariant under arbitrary
reparametrizations of $\tau$. Only $\tau$-independent quantities
have physical meaning.
This is precisely what happens in GR, where the ``arbitrary
parameters'', analogous to the $\tau$ of the example, are the
coordinates $x^\mu$. Namely, the spatial coordinate $\vec x$ and
the temporal coordinate $t$. These have no physical meaning
whatsoever in GR: the connection between the theory and the
measurable physical quantities that the theory predict is only
via quantities independent from $\vec x$ and $t$. Thus, $\vec x$
and $t$ in GR have a very different physical meaning than their
homonymous in non-general-relativistic physics. The later
correspond to readings on rods and clocks. The formed,
correspond to nothing at all. Recall that Einstein described his
great intellectual struggle to find GR as ``understanding the
meaning of the coordinates''.
In the example, the invariance of the equations of motion for
$Q(\tau)$ and $T(\tau)$ under reparametrization of $\tau$,
implies that if we develop the Hamiltonian formalism in $\tau$ we
obtain a constrained system with a (weakly) vanishing
hamiltonian. This is because the hamiltonian generates
evolutions in $\tau$, evolution in $\tau$ is a gauge, and the
generators of gauge transformations are constraints. In
canonical GR we have precisely the same situation: the hamiltonian
vanishes, the constraints generate evolution in $t$, which is
unobservable -- it is gauge. GR does not describe evolution in time:
it describes the relative evolution of many variables with
respect to each other. All these variables are democratically
equal: there isn't a preferred one that ``is the true time''.
This is the temporal aspect of GR's relationalism.
A large part of the machinery of theoretical physics relies on
the notion of time (on the different meanings of time in
different physical theories, see Rovelli 1995). A theory of
quantum gravity should do without. Fortunately, many essential
tools that are usually introduced using the notion of time can
equally well be defined without mentioning time at all. This, by
the way, shows that time plays a much weaker role in the
structure of theoretical physics than what is mostly assumed.
Two crucial examples are ``phase space'' and ``state''.
The phase space is usually introduced in textbooks as the space
of the states of the systems ``at a given time''. In a general
relativistic context, this definition is useless. However, it
is known since Lagrange that there is an alternative, equivalent,
definition of phase space as the space of the solutions of the
equations of motion. This definition does not require that we
know what we mean by time. Thus, in the example above the phase
space can be coordinatized by $A$ and $\phi$, which coordinatize
the space of the solutions of the equations of motion.
A time independent notion of ``state'' is then provided by a
point of this phase space, namely by a particular solution of the
equations of motion. For instance, for an oscillator a
``state'', in this atemporal sense, is characterized by an
amplitude $A$ and a phase $\phi$. Notice that given the
(time-independent) state ($A$ and $\phi$), we can compute any
observable: in particular, the value $Q_{T}$ of $Q$ at any
desired $T$. Notice also that $Q_{T}$ is independent from
$\tau$. This point often raises confusion: one may think that if
we restrict to $\tau$-independent quantities then we cannot
describe evolution. This is wrong: the true evolution is the
relation between $Q$ and $T$, which is $\tau$-independent. This
relation is expressed in particular by the value (let us denote
it $Q_{T}$) of $Q$ at a given $T$. $Q_{T}$ is given, obviously,
by
\begin{displaymath}
Q_{T}(A,\phi)=A \sin(\omega T+\phi).
\end{displaymath}
This can be seen as a one-parameter (the parameter is $T$) family
of observables on the gauge invariant phase space coordinatized
by $A$ and $\phi$. Notice that this is a perfectly
$\tau$-independent expression. In fact, an explicit computation
shows that the Poisson bracket between $Q_{T}$ and the
hamiltonian constraint that generates evolution in $\tau$
vanishes.
This time independent notion of states is well known in its
quantum mechanical version: it is the Heisenberg state (as
opposed to Schr\"odinger state). Similarly, the operator
corresponding to the observable $Q_{T}$ is the Heisenberg
operator that gives the value of $Q$ at $T$. The Heisenberg and
Schr\"odinger pictures are equivalent if there is a normal time
evolution in the theory. In the absence of a normal notion of
time evolution, the Heisenberg picture remains viable, the
Shr\"odinger picture becomes meaningless.\footnote{In the first
edition of his celebrated book on quantum mechanics, Dirac used
Heisenberg states (he calls them relativistic). In later
editions, he switched to Shr\"odinger states, explaining in a
preface that it was easier to calculate with these, but it was
nevertheless a pity to give up the Heisenberg states, which are
more fundamental. In what was perhaps his last public seminar,
in Sicily, Dirac used just a single transparency, with just one
sentence: ``The Heisenberg picture is the right one''.} In
quantum gravity, only the Heisenberg picture makes sense (Rovelli
1991c, 1991d).
In classical GR, a point in the physical phase space, or a state,
is a solution of Einstein equations, up to active
diffeomorphisms. A state represents a ``history'' of spacetime.
The quantity that can be univocally predicted are the ones that
are independents from the coordinates, namely that are invariant
under diffeomorphisms. These quantities have vanishing Poisson
brackets with all the constraints. Given a state, the value of
each of these quantities is determined. In quantum gravity, a
quantum state represents a ``history'' of quantum spacetime. The
observables are represented by operators that commute with {\em
all\/} the quantum constraints. If we know the quantum state of
spacetime, we can then compute the expectation value of any
diffeomorphism invariant quantity, by taking the mean value of
the corresponding operator. The observable quantities in quantum
gravity are precisely the same as in classical GR.
Some of these quantities may express the value of certain
variables ``when and where'' certain other quantities have
certain given values. They are the analog of the
reparametrization invariant observable $Q_{T}$ in the example
above. These quantities describe evolution in a way which is
fully invariant under the parameter time, unphysical gauge
evolution (Rovelli 1991d, 1991e). The corresponding quantum
operators are Heisenberg operators. There is no Schr\"odinger
picture, because there is no unitary time evolution. There is no
need to expect or to search for unitary time evolution in quantum
gravity, because there is no time in which we should have unitary
evolution. A prejudice hard to die wants that unitary evolution
is required for the consistency of the probabilistic
interpretation. This idea is wrong.
What I have described is the general form that one may expect a
quantum theory of GR to have. I have used the Hilbert space
version of QM; but this structure can be translated in other
formulations of QM. Of course, physics works then with dirty hands:
gauge dependent quantities, approximations, expansions,
unphysical structures, and so on. A fully satisfactory
construction of the above does not yet exist. A concrete attempt
to construct the physical states and the physical observables in
loop quantum gravity is given by the spin foam models approach,
which is the formulation one obtains by starting from loop
quantum gravity and constructing a Feynman sum over histories
(Reisenberger Rovelli 1997, Baez 1998, Barret and Crane 1998).
See (Baez 1999) in this volume for more details on ideas
underlying these developments.
In quantum gravity, I see no reason to expect a fundamental
notion of time to play any role. But the {\em nostalgia for
time\/} is hard to resist. For technical as well as for
emotional reasons. Many approaches to quantum gravity go out of
their way to reinsert in the theory what GR is teaching us we
should abandon: a preferred time. The time ``along which''
things happen is a notion which makes sense only for describing a
limited regime of reality. This notion is meaningless already in
the (gauge invariant) general relativistic classical dynamics of
the gravitational field. At the fundamental level, we should,
simply, forget time.
\subsection{Glimpses}
I close this section by briefly mentioning two more speculative ideas.
One regards the emergence of time, the second the connection
between the relationalism in GR and the relationalism in QM.
(i) In the previous section, I have argued that we should search
for a quantum theory of gravity in which there is no independent
time variable ``along'' which dynamics ``happens''. A problem
left open by this position is to understand the emergence of time
in our world, with its features, which are familiar to us. An
idea discussed in (Rovelli 1993a 1993b, Connes and Rovelli 1994)
is that the notion of time isn't dynamical but rather
thermodynamical. We can never give a complete account of the
state of a system in a field theory (we cannot access the
infinite amount of data needed to completely characterize a
state). Therefore we have at best a statistical description of
the state. Given a statistical state of a generally covariant
system, a notion of a flow (more precisely a one-parameter group
of automorphisms of the algebra of the observables) follows
immediately. In the quantum context, this corresponds to the
Tomita flow of the state. The relation between this flow and the
state is the relation between the time flow generated by the
hamiltonian and a Gibbs state: the two essentially determine each
other. In the absence of a preferred time, however, any
statistical state selects its own notion of statistical time.
This statistical time has a striking number of properties that
allow us to identify it with the time of non-general relativistic
physics. In particular, a Schr\"odinger equation with respect to
this statistical time holds, in an appropriate sense. In
addition, the time flows generated by different states are
equivalent up to inner automorphisms of the observable algebra
and therefore define a common ``outer'' flow: a one paramater
group of outer automorphisms. This determines a state
independent notion of time flow, which shows that a general
covariant QFT has an intrinsic ``dynamics'', even in the absence
of a hamiltonian and of a time variable. The suggestion is
therefore that the temporal aspects of our world have statistical
and thermodynamical origin, rather than dynamical. ``Time'' is
ignorance: a reflex of our incomplete knoweldge of the state of
the world.
(ii) What is QM really telling us about our world? In (Rovelli
1996, 1998), I have argued that what QM is telling us is that the
contingent properties of any system --or: the state of any
system-- must be seen as relative to a second physical system,
the ``observing system''. That is, quantum state and values that
an observables take are relational notions, in the same sense in
which velocity is relational in classical mechanics (it is a
relation between two systems, not a properties of a single
system). I find the consonance between this relationalism in QM
and the relationalism in GR quite striking. It is tempting to
speculate that they are related. Any quantum interaction (or
quantum measurement) involving a system $A$ and a system $B$
requires $A$ and $B$ to be spatiotemporally contiguous.
Viceversa, spatiotemporal contiguity, which is the grounding of
the notions of space and time (derived and dynamical, not
primary, in GR) can only be verified quantum mechanically (just
because any interaction is quantum mechanical in nature). Thus,
the net of the quantum mechanical elementary interactions and the
spacetime fabric are actually the same thing. Can we build a
consistent picture in which we take this fact into account? To
do that, we must identify two notions: the notion of a
spatiotemporal (or spatial?) region, and the notion of quantum
system. For intriguing ideas in this direction, see (Crane 1991)
and, in this volume, (Baez 1999).
\section{Considerations on method and content}
\subsection{Method}
Part of the recent reflection about science has emphasized the
``non cumulative'' aspect in the development of scientific
knowledge. According to this view, the evolution of scientific
theories is marked by large or small breaking points, in which,
to put it very crudely, the empirical facts are just reorganized
within new theories. These would be to some extent
``incommensurable'' with respect to their antecedent. These
ideas have influenced physicists.
The reader has remarked that the discussion of quantum gravity I
have given above assumes a different reading of the evolution
of scientific knowledge. I have based the above discussion on
quantum gravity on the idea that the central physical ideas of QM
and GR represent our best guide for accessing the extreme and
unexplored territories of the quantum-gravitational regime. In
my opinion, the emphasis on the incommensurability between
theories has probably clarified an important aspect of science,
but risks to obscure something of the internal logic according to
which, historically, physics finds knowledge. There is a subtle,
but definite, cumulative aspect in the progress of physics, which
goes far beyond the growth of validity and precision of the
empirical content of the theories. In moving from a theory to
the theory that supersedes it, we do not save just the verified
empirical content of the old theory, but more. This ``more'' is
a central concern for good physics. It is the source, I think,
of the spectacular and undeniable predicting power of theoretical
physics.
Let me illustrate the point I am trying to make with a historical
case. There was a problem between Maxwell equations and Galilei
transformations. There were two obvious way out. To disvalue
Maxwell theory, degrading it to a phenomenological theory of some
yet-to-be-discovered ether's dynamics. Or to disvalue Galilean
invariance, accepting the idea that inertial systems are not
equivalent in electromagnetic phenomena. Both ways were pursued
at the end of the century. Both are sound applications of the
idea that a scientific revolution may very well change in depth
what old theories teach us about the world. Which of the two
ways did Einstein take?
None of them. For Einstein, Maxwell theory was a source of great
awe. Einstein rhapsodizes about his admiration for Maxwell
theory. For him, Maxwell had opened a new window over the world.
Given the astonishing success of Maxwell theory, empirical
(electromagnetic waves), technological (radio) as well as
conceptual (understanding what is light), Einstein admiration is
comprehensible. But Einstein had a tremendous respect for
Galileo's insight as well. Young Einstein was amazed by a book
with Huygens' derivation of collision theory virtually out of
Galilean invariance alone. Einstein understood that Galileo's
great intuition --that the notion of velocity is only relative--
{\it could not be wrong}. I am convinced that in this faith of
Einstein in the core of the great Galilean discovery there is
very much to learn, for the philosophers of science, as well as
for the contemporary theoretical physicists. So, Einstein {\em
believed the two theories, Maxwell and Galileo}. He assumed that
they would hold far beyond the regime in which they had been
tested. He assumed that Galileo had grasped something about the
physical world, which was, simply, {\em correct}. And so had
Maxwell. Of course, details had to be adjusted. The core of
Galileo's insight was that all inertial systems are equivalent
and that velocity is relative, not the details of the galilean
transformations. Einstein knew the Lorentz transformations
(found, of course, by Lorentz, not by Einstein), and was able to
see that they do not contradict Galileo's insight. If there was
contradiction in putting the two together, the problem was ours:
we were surreptitiously sneaking some incorrect assumption into
our deductions. He found the incorrect assumption, which, of
course, was that simultaneity could be well defined. It was
Einstein's faith in the {\em essential physical correctness\/} of
the old theories that guided him to his spectacular discovery.
There are innumerable similar examples in the history of physics,
that equally well could illustrate this point. Einstein found GR
``out of pure thought'', having Newton theory on the one hand and
special relativity --the understanding that any interaction is
mediated by a field-- on the other; Dirac found quantum field
theory from Maxwell equations and quantum mechanics; Newton
combined Galileo's insight that acceleration governs dynamics
with Kepler's insight that the source of the force that governs
the motion of the planets is the sun \ldots\ The list could be
long. In all these cases, confidence in the insight that came
with some theory, or ``taking a theory seriously'', lead to major
advances that largely extended the original theory itself. Of
course, far from me suggesting that there is anything simple, or
automatic, in figuring out where the true insights are and in
finding the way of making them work together. But what I am
saying is that figuring out where the true insights are and
finding the way of making them work together is the work of
fundamental physics. This work is grounded on the {\em
confidence\/} in the old theories, not on random search of new
ones.
One of the central concerns of modern philosophy of science is
to face the apparent paradox that scientific theories change, but
are nevertheless credible. Modern philosophy of science is to
some extent an after-shock reaction to the fall of Newtonian
mechanics. A tormented recognition that an extremely successful
scientific theory can nevertheless be untrue. But it is a
narrow-minded notion of truth the one which is questioned by the
event of a successful physical theory being superseded by a more
successful one.
A physical theory, in my view, is a conceptual structure that we
use in order to organize, read and understand the world, and
make prediction about it. A successful physical theory is a
theory that does so effectively and consistently. At the light
of our experience, there is no reason not to expect that a more
effective conceptual structure might always exist. Therefore an
effective theory may always show its limits and be replaced by a
better one. On the other hand, however, a novel
conceptualization cannot but rely on what the previous one has
already achieved.
When we move to a new city, we are at first confused about its
geography. Then we find a few reference points, and we make a
rough mental map of the city in terms of these points. Perhaps
we see that there is part of the city on the hills and part on
the plane. As time goes on, the map gets better. But there are
moments, in which we suddenly realize that we had it wrong.
Perhaps there were indeed two areas with hills, and we were
previously confusing the two. Or we had mistaken a big red
building for the City Hall, when it was only a residential
construction. So we adjourn the mental map. Sometime later, we
have learned names and features of neighbors and streets; and the
hills, as references, fade away. The neighbors structure of
knowledge is more effective that the hill/plane one \ldots
The structure changes, but the knowledge increases. And the big
red building, now we know it, is not the City Hall, and we know
it forever.
There are discoveries that are forever. That the Earth is not
the center of the universe, that simultaneity is relative. That
we do not get rain by dancing. These are steps humanity takes,
and does not take back. Some of these discoveries amount simply to
cleaning our thinking from wrong, encrusted, or provisional
credences. But also discovering classical mechanics, or
discovering electromagnetism, or quantum mechanics, are
discoveries forever. Not because the details of these theories
cannot change, but because we have discovered that a large
portion of the world admits to be understood in certain terms,
and this is a {\em fact\/} that we will have to keep facing
forever.
One of the thesis of this essay, is that general relativity is
the expression of one of these insights, which will stay with us
``forever''. The insight is that the physical world does not
have a stage, that localization and motion are relational only,
that diff-invariance (or something physically analogous) is
required for any fundamental description of our world.
How can a theory be effective even outside the domain for which
it was found? How could Maxwell predict radio waves, Dirac
predict antimatter and GR predict black holes? How can
theoretical thinking be so magically powerful? Of course, we may
think that these successes are chance, and historically deformed
perspective. There are hundred of theories proposed, most of
them die, the ones that survive are the ones remembered. There
is alway somebody who wins the lottery, but this is not a sign
that humans can magically predict the outcome of the lottery. My
opinion is that such an interpretation of the development of
science is unjust, and, worse, misleading. It may explain
something, but there is more in science. There are tens of
thousand of persons playing the lottery, there were only two
relativistic theories of gravity, in 1916, when Einstein
predicted that the light would be defected by the sun precisely
by an angle of 1.75''. Familiarity with the history of physics,
I feel confident to claim, rules out the lottery picture.
I think that the answer is simpler. Somebody predicts that the
sun will rise tomorrow, and the sun rises. It is not a matter of
chance (there aren't hundreds of people making random predictions
on each sort of strange objects appearing at the horizon). The
prediction that tomorrow the sun will rise, is sound. However,
it is not granted either. A neutron star could rush in, close to
the speed of light, and sweep the sun away. More
philosophically, who grants me the right of induction? Why
should I be confident that the sun would rise, just because it
has been rising so many time in the past? I do not know the
answer to {\em this\/} question. But what I know is that the
predictive power of a theory beyond its own domain is {\em
precisely of the same sort.} Simply, we learn something about
nature (whatever this mean). And what we learn is effective in
guiding us to predict nature's behavior. Thus, the spectacular
predictive power of theoretical physics is nothing less and
nothing more than common induction. And it is as comprehensible
(or as incomprehensible) as my ability to predict that the sun
will rise tomorrow. Simply, nature around us happens to be full
of regularities {\em that we understand\/}, whether or not we
understand why regularities exist at all. These regularities
give us strong confidence -although not certainty- that the sun
will rise tomorrow, as well as in the fact that the basic facts
about the world found with QM and GR will be confirmed, not
violated, in the quantum gravitational regimes that we have not
empirically probed.
This view is not dominant nowadays in theoretical physics. Other
attitudes dominate. The ``pragmatic'' scientist ignores
conceptual questions and physical insights, and only cares about
developing a theory. This is an attitude, that has been
successful in the sixties in getting to the standard model. The
``pessimistic'' scientist has little faith in the possibilities
of theoretical physics, because he worries that all possibilities
are open, and anything might happen between here and the Planck
length. The ``wild'' scientist observes that great scientists
had the courage of breaking with old and respected ideas and
assumptions, and explore new and strange hypothesis. From this
observation, the ``wild'' scientist concludes that to do great
science one has to explore strange hypotheses, and {\em violate
respected ideas\/}. The wildest the hypothesis, the best. I
think wilderness in physics is sterile. The greatest
revolutionaries in science were extremely, almost obsessively,
conservative. So was certainly the greatest revolutionary,
Copernicus, and so was Planck. Copernicus was pushed to the
great jump from his pedantic labor on the minute technicalities
of the Ptolemaic system (fixing the equant). Kepler was forced
to abandon the circles by his extremely technical work on the
details of Mars orbit. He was using ellipses as approximations
to the epicycle-deferent system, when he begun to realize that
the approximation was fitting the data better than the
(supposedly) exact curve. And extremely conservative were
also Einstein and Dirac. Their vertiginous steps ahead were not
pulled out of the blue sky. They did not come from violating
respected ideas, but, on the contrary, from respect towards
physical insights. In physics, novelty has always emerged from
new data and from a humble, devoted interrogation of the old
theories. From turning these theories around and around,
immerging into them, making them clash, merge, talk, until,
through them, the missing gear could be seen. In my opinion,
precious research energies are today lost in these attitudes. I
worry that a philosophy of science that downplays the component
of factual knowledge in physical theories might have part of the
responsibility.
\subsection{On content and truth in physical theories}
If a physical theory is a conceptual structure that we use to
organize, read and understand the world, then scientific thinking
is not much different from common sense thinking. In fact, it is
only a better instance of the same activity: thinking about the
world. Science is the enterprise of continuously exploring the
possible ways of thinking about the world, and constantly
selecting the ones that work best.
If so, there cannot be any qualitative difference between the
theoretical notions introduced in science and the terms in our
everyday language. A fundamental intuition of classical
empiricism is that nothing grants us the ``reality'' of the
referents of the notions we use to organize our perceptions.
Some modern philosophy of science has emphasized the application
of this intuition to the concepts introduced by science. Thus,
we are warned to doubt the ``reality'' of the theoretical objects
(electrons, fields, black holes \ldots). I find these warning
incomprehensible. Not because they are ill founded, but because
they are not applied consistently. The fathers of empiricism
consistently applied this intuition to {\em any\/} physical
object. Who grants me the reality of a chair? Why should a
chair be more than a theoretical concept organizing certain
regularities in my perceptions? I will not venture here in
disputing nor in agreeing with this doctrine. What I find
incomprehensible is the position of those who grant the solid
status of reality to a chair, but not to an electron. The
arguments against the reality of the electron apply to the chair
as well. The arguments in favor of the reality of the chair
apply to the electron as well. A chair, as well as an electron,
is a concept that we use to organize, read and understand the
world. They are equally real. They are equally volatile and
uncertain.
Perhaps, this curious schizophrenic attitude of being antirealist
with electrons and iron realist with chairs is the result of a
complex historical evolution. First there was the rebellion
against ``metaphysics'', and, with it, the granting of confidence
to science alone. From this point of view, metaphysical
questioning on the reality of chairs is sterile -- true knowledge
is in science. Thus, it is to scientific knowledge that we apply
empiricist rigor. But understanding science in empiricists'
terms required making sense of the raw empirical data on which
science is based. With time, the idea of raw empirical data
showed more and more its limits. The common sense view of the
world was reconsidered as a player in our picture of knowledge.
This common sense view should give us a language and a ground
from which to start -- the old anti-metaphysical prejudice still
preventing us, however, from applying empiricist rigor to this
common sense view of the world as well. But if one is not
interested in questioning the reality of chairs, for the very
same reason why should one be interested in questioning the
``reality of the electrons''?
Again, I think this point is important for science itself. The
factual content of a theory is our best tool. The faith in this
factual content does not prevent us from being ready to question
the theory itself, if sufficiently compelled to do so by novel
empirical evidence or by putting the theory in relation to other
things {\em we know\/} about the world. Scientific antirealism,
in my opinion, is not only a short sighted application of a deep
classical empiricist insight; it is also a negative influence
over the development of science. H.\ Stein (1999) has recently
beautifully illustrated a case in which a great scientist,
Poincar\'e, was blocked from getting to a major discovery
(special relativity) by a philosophy that restrained him from
``taking seriously'' his own findings.
Science teaches us that our naive view of the world is imprecise,
inappropriate, biased. It constructs better views of the world.
Electrons, if anything at all, are ``more real'' that chairs, not
``less real'', in the sense that they ground a more powerful way
of conceptualizing the world. On the other hand, the process of
scientific discovery, and the experience of this century in
particular, has made us painfully aware of the provisional
character of {\em any\/} form of knowledge. Our mental and
mathematical pictures of the world are only mental and
mathematical pictures. This is true for abstract scientific
theories as well as from the image we have of our dining room.
Nevertheless, the pictures are powerful and effective and we
can't do any better than that.
So, is there anything we can say with confidence about the ``real
world''? A large part of the recent reflection on science has
taught us that row data do not exist, and that any information
about the world is already deeply filtered and interpreted by the
theory. Further than that, we could even think, as in the dream
of Berkeley, that there is no ``reality'' outside there. The
European reflection (and part of the American as well) has
emphasized the fact that truth is always internal to the theory,
that we can never exit language, we can never exit the circle of
discourse within which we are speaking. It might very well be
so. But, if the only notion of truth is internal to the theory,
then {\em this internal truth\/} is what we mean by truth. We
cannot exit from our own conceptual scheme. We cannot put
ourself outside our discourse. Outside our theory. There may be
no notion of truth outside our own discourse. But it is
precisely ``from within the language'' that we can assert the
reality of the world. And we certainly do so. Indeed, it is
more than that: it is structural to our language to be a language
{\em about\/} the world, and to our thinking to be a thinking
{\em of\/} the world. Therefore, precisely because there is no
notion of truth except the one in our own discourse, precisely
for this reason, there is no sense in denying the reality of the
world. The world is real, solid, and understandable by science.
The best we can say about the physical world, and about what is
there in the world, is what good physics says about it.
At the same time, our perceiving, understanding, and
conceptualizing the world is in continuous evolution, and science
is the form of this evolution. At every stage, the best we can
say about the reality of the world is precisely what we are
saying. The fact we will understand it better later on does not
make our present understanding less valuable, or less credible.
A map is not false because there is a better map, even if the
better one looks quite different. Searching for a fixed point on
which to rest our restlessness, is, in my opinion, naive, useless
and counterproductive for the development of science. It is only
by believing our insights and, at the same time, questioning our
mental habits, that we can go ahead. This process of cautious
faith and self-confident doubt is the core of scientific
thinking. Exploring the possible ways of thinking of the world,
being ready to subvert, if required, our ancient prejudices, is
among the greatest and the most beautiful of the human
adventures. Quantum gravity, in my view, in its effort to
conceptualize quantum spacetime, and to modify in depth the
notion of time, is a step of this adventure.
\vskip 2cm
\begin{itemize}
\item[]
Ashtekar A, Rovelli C, Smolin L (1992). Weaving a classical
metric with quantum threads, {\it Physical Review Letters} {\bf 69},
237.
\item[]
Ashtekar A , Lewandowski J (1997a). Quantum Theory of Gravity I:
Area Operators, {\it Class and Quantum Grav} {\bf 14}, A55--A81.
\item[]
Ashtekar A, Lewandowski J (1997b). Quantum Theory
of Geometry II: Volume operators, gr-qc/9711031.
\item[]
Baez J (1997). Spin networks in nonperturbative quantum gravity,
in {\it The interface of knots and physics}, ed L Kauffman
(American Mathematical Society, Providence).
\item[]
Baez J (1998). Spin foam models, {\it Class Quantum Grav}, {\bf 15},
1827--1858.
\item[]
Baez J (1999). In ``Physics Meets Philosophy at the Planck
scale'', C Callender N Hugget eds, Cambridge University
Press, to appear.
\item[]
Barbour J (1989). {\em Absolute or Relative Motion?} (Cambridge University
Press, Cambridge).
\item[]
Barret J, Crane L (1998). Relativistic spin networks and quantum
gravity, {\em Journ Math Phys} {\bf 39}, 3296--3302.
\item[]
Belot G (1998). Why general relativity does need an
interpretation, {\it Philosophy of Science}, {\bf 63}, S80--S88.
\item[]
Connes A and Rovelli C (1994). Von Neumann algebra automorphisms and
time versus thermodynamics relation in general covariant quantum
theories, {\it Classical and Quantum Gravity} {\bf 11}, 2899.
\item[]
Crane L (1991). 2d physics and 3d topology, {\em Comm Math
Phys} {\bf 135}, 615--640.
\item[]
Descartes R (1983): {\em Principia Philosophiae},
Translated by VR Miller and RP Miller (Reidel, Dordrecht
[1644]).
\item[]
Earman J (1989). {\it World Enough and Spacetime:
Absolute versus Relational Theories of Spacetime} (MIT Press,
Cambridge).
\item[]
Earman J, Norton J (1987). What Price Spacetime
Substantivalism? The Hole Story, {\it British Journal for the
Philosophy of Science}, {\bf 38}, 515--525.
\item[]
Isham C (1999). In ``Physics Meets Philosophy at the Planck
scale'', C Callender N Hugget eds, Cambridge University
Press, to appear.
\item[]
Newton I (1962): {\em De Gravitatione et Aequipondio
Fluidorum}, translation in AR Hall and MB Hall eds {\it Unpublished
papers of Isaac Newton} (Cambridge University Press, Cambridge).
\item[]
Norton J D (1984). How Einstein Found His Field Equations:
1912-1915, {\em Historical Studies in the Physical Sciences}, {\bf
14}, 253--315. Reprinted in {\it Einstein and the History of
General Relativity: Einstein Studies}, D Howard and J Stachel
eds., Vol.I, 101-159 ( Birkh\"auser, Boston).
\item[]
Penrose R (1995). {\em The Emperor's new mind} (Oxford University
Press)
\item[]
Reisenberger M, Rovelli C (1997). Sum over Surfaces
Form of Loop Quantum Gravity, {\it Physical Review}, {\bf D56},
3490--3508, gr-qc/9612035.
\item[]
Rovelli C (1991a). What is observable in classical and quantum gravity?,
{\em Classical and Quantum Gravity}, {\bf 8}, 297.
\item[]
Rovelli C (1991b). Quantum reference systems,
{\it Classical and Quantum Gravity}, {\bf 8}, 317.
\item[]
Rovelli C (1991c). Quantum mechanics without time: a model,
{\it Physical Review}, {\bf D42}, 2638.
\item[]
Rovelli C (1991d). Time in quantum gravity: an hypothesis,
{\it Physical Review}, {\bf D43}, 442.
\item[]
Rovelli C (1991e). Quantum evolving constants.
{\it Physical Review} {\bf D44}, 1339.
\item[]
Rovelli C (1993a). Statistical mechanics of
gravity and thermodynamical origin of time, {\it Classical and
Quantum Gravity}, {\bf 10}, 1549.
\item[]
Rovelli C (1993b). The statistical state of the
universe, {\it Classical and Quantum Gravity}, {\bf 10}, 1567.
\item[]
Rovelli C (1993c). A generally covariant quantum field theory
and a prediction on quantum measurements of geometry,
{\it Nuclear Physics}, {\bf B405}, 797.
\item[]
Rovelli C (1995). Analysis of the different meaning of
the concept of time in different physical theories, {\it Il Nuovo
Cimento}, {\bf 110B}, 81.
\item[]
Rovelli C (1996). Relational Quantum Mechanics, {\it International
Journal of Theoretical Physics}, {\bf 35}, 1637.
\item[]
Rovelli C (1997a). Half way through the woods, in
{\it The Cosmos of Science}, J Earman and JD Norton editors,
(University of Pittsburgh Press and Universit\"ats Verlag
Konstanz).
\item[]
Rovelli, C. (1997b) Loop Quantum Gravity,
Living Reviews in Relativity (refereed electronic journal),
http://www.livingreviews.org/ Articles/Volume1/1998-1rovelli; gr-qc/9709008
\item[]
Rovelli C (1998). Incerto tempore, incertisque loci: Can
we compute the exact time at which the quantum measurement
happens?, {\it Foundations of Physics}, {\bf 28}, 1031--1043,
quant-ph/9802020.
\item[]
Rovelli C (1999). Strings, loops and the others: a critical
survey on the present approaches to quantum gravity, in
{\it Gravitation and Relativity: At the turn of the millennium}, N
Dadhich J Narlikar eds (Poona University Press), gr-qc/9803024.
\item[]
Rovelli C and Smolin L (1988). Knot theory and quantum
gravity, {\it Physical Review Letters}, {\bf 61}, 1155.
\item[]
Rovelli C and Smolin L (1990). Loop space representation for quantum
general relativity, {\it Nuclear Physics}, {\bf B331}, 80.
\item[]
Rovelli C, Smolin L (1995a). Spin Networks and Quantum Gravity,
{\it Physical Review}, {\bf D 53}, 5743.
\item[]
Rovelli C and Smolin L (1995b). Discreteness of Area and Volume
in Quantum Gravity, {\em Nuclear Physics} {\bf B442}, 593.
Erratum: {\em Nuclear Physics} {\bf B 456}, 734.
\item[]
Smolin L (1997). The future of spin networks, gr-qc/9702030.
\item[]
Stachel J (1989). Einstein search for general covariance
1912-1915, in {\em Einstein Studies}, D Howard and J Stachel eds,
vol 1, 63-100 (Birkh\"auser, Boston).
\item[]
Stein H (1999). Physics and philosophy meet: the strange case of
Poincar\'e. Unpublished.
\item[]
Zeilinger A, in {\it Gravitation and Relativity: At the turn of
the millennium}, N Dadhich J Narlikar eds (Poona University
Press).
\end{itemize}
\end{document}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 1,112 |
\section{\label{sec:level1}First-level heading:\protect\\ The line
break was forced \lowercase{via} \textbackslash\textbackslash}
This sample document demonstrates proper use of REV\TeX~4.1 (and
\LaTeXe) in manuscripts prepared for submission to AIP
journals. Further information can be found in the documentation included in the distribution or available at
\url{http://authors.aip.org} and in the documentation for
REV\TeX~4.1 itself.
When commands are referred to in this example file, they are always
shown with their required arguments, using normal \TeX{} format. In
this format, \verb+#1+, \verb+#2+, etc. stand for required
author-supplied arguments to commands. For example, in
\verb+\section{#1}+ the \verb+#1+ stands for the title text of the
author's section heading, and in \verb+\title{#1}+ the \verb+#1+
stands for the title text of the paper.
Line breaks in section headings at all levels can be introduced using
\textbackslash\textbackslash. A blank input line tells \TeX\ that the
paragraph has ended.
\subsection{\label{sec:level2}Second-level heading: Formatting}
This file may be formatted in both the \texttt{preprint} (the default) and
\texttt{reprint} styles; the latter format may be used to
mimic final journal output. Either format may be used for submission
purposes; however, for peer review and production, AIP will format the
article using the \texttt{preprint} class option. Hence, it is
essential that authors check that their manuscripts format acceptably
under \texttt{preprint}. Manuscripts submitted to AIP that do not
format correctly under the \texttt{preprint} option may be delayed in
both the editorial and production processes.
The \texttt{widetext} environment will make the text the width of the
full page, as on page~\pageref{eq:wideeq}. (Note the use the
\verb+\pageref{#1}+ to get the page number right automatically.) The
width-changing commands only take effect in \texttt{twocolumn}
formatting. It has no effect if \texttt{preprint} formatting is chosen
instead.
\subsubsection{\label{sec:level3}Third-level heading: Citations and Footnotes}
Citations in text refer to entries in the Bibliography;
they use the commands \verb+\cite{#1}+ or \verb+\onlinecite{#1}+.
Because REV\TeX\ uses the \verb+natbib+ package of Patrick Daly,
its entire repertoire of commands are available in your document;
see the \verb+natbib+ documentation for further details.
The argument of \verb+\cite+ is a comma-separated list of \emph{keys};
a key may consist of letters and numerals.
By default, citations are numerical; \cite{feyn54} author-year citations are an option.
To give a textual citation, use \verb+\onlinecite{#1}+: (Refs.~\onlinecite{witten2001,epr,Bire82}).
REV\TeX\ ``collapses'' lists of consecutive numerical citations when appropriate.
REV\TeX\ provides the ability to properly punctuate textual citations in author-year style;
this facility works correctly with numerical citations only with \texttt{natbib}'s compress option turned off.
To illustrate, we cite several together \cite{feyn54,witten2001,epr,Berman1983},
and once again (Refs.~\onlinecite{epr,feyn54,Bire82,Berman1983}).
Note that, when numerical citations are used, the references were sorted into the same order they appear in the bibliography.
A reference within the bibliography is specified with a \verb+\bibitem{#1}+ command,
where the argument is the citation key mentioned above.
\verb+\bibitem{#1}+ commands may be crafted by hand or, preferably,
generated by using Bib\TeX.
The AIP styles for REV\TeX~4 include Bib\TeX\ style files
\verb+aipnum.bst+ and \verb+aipauth.bst+, appropriate for
numbered and author-year bibliographies,
respectively.
REV\TeX~4 will automatically choose the style appropriate for
the document's selected class options: the default is numerical, and
you obtain the author-year style by specifying a class option of \verb+author-year+.
This sample file demonstrates a simple use of Bib\TeX\
via a \verb+\bibliography+ command referencing the \verb+aipsamp.bib+ file.
Running Bib\TeX\ (in this case \texttt{bibtex
aipsamp}) after the first pass of \LaTeX\ produces the file
\verb+aipsamp.bbl+ which contains the automatically formatted
\verb+\bibitem+ commands (including extra markup information via
\verb+\bibinfo+ commands). If not using Bib\TeX, the
\verb+thebibiliography+ environment should be used instead.
\paragraph{Fourth-level heading is run in.}%
Footnotes are produced using the \verb+\footnote{#1}+ command.
Numerical style citations put footnotes into the
bibliography\footnote{Automatically placing footnotes into the bibliography requires using BibTeX to compile the bibliography.}.
Author-year and numerical author-year citation styles (each for its own reason) cannot use this method.
Note: due to the method used to place footnotes in the bibliography, \emph{you
must re-run BibTeX every time you change any of your document's
footnotes}.
\section{Math and Equations}
Inline math may be typeset using the \verb+$+ delimiters. Bold math
symbols may be achieved using the \verb+bm+ package and the
\verb+\bm{#1}+ command it supplies. For instance, a bold $\alpha$ can
be typeset as \verb+$\bm{\alpha}$+ giving $\bm{\alpha}$. Fraktur and
Blackboard (or open face or double struck) characters should be
typeset using the \verb+\mathfrak{#1}+ and \verb+\mathbb{#1}+ commands
respectively. Both are supplied by the \texttt{amssymb} package. For
example, \verb+$\mathbb{R}$+ gives $\mathbb{R}$ and
\verb+$\mathfrak{G}$+ gives $\mathfrak{G}$
In \LaTeX\ there are many different ways to display equations, and a
few preferred ways are noted below. Displayed math will center by
default. Use the class option \verb+fleqn+ to flush equations left.
Below we have numbered single-line equations, the most common kind:
\begin{eqnarray}
\chi_+(p)\alt{\bf [}2|{\bf p}|(|{\bf p}|+p_z){\bf ]}^{-1/2}
\left(
\begin{array}{c}
|{\bf p}|+p_z\\
px+ip_y
\end{array}\right)\;,
\\
\left\{%
\openone234567890abc123\alpha\beta\gamma\delta1234556\alpha\beta
\frac{1\sum^{a}_{b}}{A^2}%
\right\}%
\label{eq:one}.
\end{eqnarray}
Note the open one in Eq.~(\ref{eq:one}).
Not all numbered equations will fit within a narrow column this
way. The equation number will move down automatically if it cannot fit
on the same line with a one-line equation:
\begin{equation}
\left\{
ab12345678abc123456abcdef\alpha\beta\gamma\delta1234556\alpha\beta
\frac{1\sum^{a}_{b}}{A^2}%
\right\}.
\end{equation}
When the \verb+\label{#1}+ command is used [cf. input for
Eq.~(\ref{eq:one})], the equation can be referred to in text without
knowing the equation number that \TeX\ will assign to it. Just
use \verb+\ref{#1}+, where \verb+#1+ is the same name that used in
the \verb+\label{#1}+ command.
Unnumbered single-line equations can be typeset
using the \verb+\[+, \verb+\]+ format:
\[g^+g^+ \rightarrow g^+g^+g^+g^+ \dots ~,~~q^+q^+\rightarrow
q^+g^+g^+ \dots ~. \]
\subsection{Multiline equations}
Multiline equations are obtained by using the \verb+eqnarray+
environment. Use the \verb+\nonumber+ command at the end of each line
to avoid assigning a number:
\begin{eqnarray}
{\cal M}=&&ig_Z^2(4E_1E_2)^{1/2}(l_i^2)^{-1}
\delta_{\sigma_1,-\sigma_2}
(g_{\sigma_2}^e)^2\chi_{-\sigma_2}(p_2)\nonumber\\
&&\times
[\epsilon_jl_i\epsilon_i]_{\sigma_1}\chi_{\sigma_1}(p_1),
\end{eqnarray}
\begin{eqnarray}
\sum \vert M^{\text{viol}}_g \vert ^2&=&g^{2n-4}_S(Q^2)~N^{n-2}
(N^2-1)\nonumber \\
& &\times \left( \sum_{i<j}\right)
\sum_{\text{perm}}
\frac{1}{S_{12}}
\frac{1}{S_{12}}
\sum_\tau c^f_\tau~.
\end{eqnarray}
\textbf{Note:} Do not use \verb+\label{#1}+ on a line of a multiline
equation if \verb+\nonumber+ is also used on that line. Incorrect
cross-referencing will result. Notice the use \verb+\text{#1}+ for
using a Roman font within a math environment.
To set a multiline equation without \emph{any} equation
numbers, use the \verb+\begin{eqnarray*}+,
\verb+\end{eqnarray*}+ format:
\begin{eqnarray*}
\sum \vert M^{\text{viol}}_g \vert ^2&=&g^{2n-4}_S(Q^2)~N^{n-2}
(N^2-1)\\
& &\times \left( \sum_{i<j}\right)
\left(
\sum_{\text{perm}}\frac{1}{S_{12}S_{23}S_{n1}}
\right)
\frac{1}{S_{12}}~.
\end{eqnarray*}
To obtain numbers not normally produced by the automatic numbering,
use the \verb+\tag{#1}+ command, where \verb+#1+ is the desired
equation number. For example, to get an equation number of
(\ref{eq:mynum}),
\begin{equation}
g^+g^+ \rightarrow g^+g^+g^+g^+ \dots ~,~~q^+q^+\rightarrow
q^+g^+g^+ \dots ~. \tag{2.6$'$}\label{eq:mynum}
\end{equation}
A few notes on \verb=\tag{#1}=. \verb+\tag{#1}+ requires
\texttt{amsmath}. The \verb+\tag{#1}+ must come before the
\verb+\label{#1}+, if any. The numbering set with \verb+\tag{#1}+ is
\textit{transparent} to the automatic numbering in REV\TeX{};
therefore, the number must be known ahead of time, and it must be
manually adjusted if other equations are added. \verb+\tag{#1}+ works
with both single-line and multiline equations. \verb+\tag{#1}+ should
only be used in exceptional case - do not use it to number all
equations in a paper.
Enclosing single-line and multiline equations in
\verb+\begin{subequations}+ and \verb+\end{subequations}+ will produce
a set of equations that are ``numbered'' with letters, as shown in
Eqs.~(\ref{subeq:1}) and (\ref{subeq:2}) below:
\begin{subequations}
\label{eq:whole}
\begin{equation}
\left\{
abc123456abcdef\alpha\beta\gamma\delta1234556\alpha\beta
\frac{1\sum^{a}_{b}}{A^2}
\right\},\label{subeq:1}
\end{equation}
\begin{eqnarray}
{\cal M}=&&ig_Z^2(4E_1E_2)^{1/2}(l_i^2)^{-1}
(g_{\sigma_2}^e)^2\chi_{-\sigma_2}(p_2)\nonumber\\
&&\times
[\epsilon_i]_{\sigma_1}\chi_{\sigma_1}(p_1).\label{subeq:2}
\end{eqnarray}
\end{subequations}
Putting a \verb+\label{#1}+ command right after the
\verb+\begin{subequations}+, allows one to
reference all the equations in a subequations environment. For
example, the equations in the preceding subequations environment were
Eqs.~(\ref{eq:whole}).
\subsubsection{Wide equations}
The equation that follows is set in a wide format, i.e., it spans
across the full page. The wide format is reserved for long equations
that cannot be easily broken into four lines or less:
\begin{widetext}
\begin{equation}
{\cal R}^{(\text{d})}=
g_{\sigma_2}^e
\left(
\frac{[\Gamma^Z(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}
+\frac{[\Gamma^Z(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}
\right)
+ x_WQ_e
\left(
\frac{[\Gamma^\gamma(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}
+\frac{[\Gamma^\gamma(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}
\right)\;. \label{eq:wideeq}
\end{equation}
\end{widetext}
This is typed to show the output is in wide format.
(Since there is no input line between \verb+\equation+ and
this paragraph, there is no paragraph indent for this paragraph.)
\section{Cross-referencing}
REV\TeX{} will automatically number sections, equations, figure
captions, and tables. In order to reference them in text, use the
\verb+\label{#1}+ and \verb+\ref{#1}+ commands. To reference a
particular page, use the \verb+\pageref{#1}+ command.
The \verb+\label{#1}+ should appear in a section heading, within an
equation, or in a table or figure caption. The \verb+\ref{#1}+ command
is used in the text where the citation is to be displayed. Some
examples: Section~\ref{sec:level1} on page~\pageref{sec:level1},
Table~\ref{tab:table1},%
\begin{table}
\caption{\label{tab:table1}This is a narrow table which fits into a
text column when using \texttt{twocolumn} formatting. Note that
REV\TeX~4 adjusts the intercolumn spacing so that the table fills the
entire width of the column. Table captions are numbered
automatically. This table illustrates left-aligned, centered, and
right-aligned columns. }
\begin{ruledtabular}
\begin{tabular}{lcr}
Left\footnote{Note a.}&Centered\footnote{Note b.}&Right\\
\hline
1 & 2 & 3\\
10 & 20 & 30\\
100 & 200 & 300\\
\end{tabular}
\end{ruledtabular}
\end{table}
and Fig.~\ref{fig:epsart}.
\section{Figures and Tables}
Figures and tables are typically ``floats''; \LaTeX\ determines their
final position via placement rules.
\LaTeX\ isn't always successful in automatically placing floats where you wish them.
Figures are marked up with the \texttt{figure} environment, the content of which
imports the image (\verb+\includegraphics+) followed by the figure caption (\verb+\caption+).
The argument of the latter command should itself contain a \verb+\label+ command if you
wish to refer to your figure with \verb+\ref+.
Import your image using either the \texttt{graphics} or
\texttt{graphix} packages. These packages both define the
\verb+\includegraphics{#1}+ command, but they differ in the optional
arguments for specifying the orientation, scaling, and translation of the figure.
Fig.~\ref{fig:epsart}%
\begin{figure}
\includegraphics{fig_1
\caption{\label{fig:epsart} A figure caption. The figure captions are
automatically numbered.}
\end{figure}
is small enough to fit in a single column, while
Fig.~\ref{fig:wide}%
\begin{figure*}
\includegraphics{fig_2
\caption{\label{fig:wide}Use the \texttt{figure*} environment to get a wide
figure, spanning the page in \texttt{twocolumn} formatting.}
\end{figure*}
is too wide for a single column,
so instead the \texttt{figure*} environment has been used.
The analog of the \texttt{figure} environment is \texttt{table}, which uses
the same \verb+\caption+ command.
However, you should type your caption command first within the \texttt{table},
instead of last as you did for \texttt{figure}.
The heart of any table is the \texttt{tabular} environment,
which represents the table content as a (vertical) sequence of table rows,
each containing a (horizontal) sequence of table cells.
Cells are separated by the \verb+&+ character;
the row terminates with \verb+\\+.
The required argument for the \texttt{tabular} environment
specifies how data are displayed in each of the columns.
For instance, a column
may be centered (\verb+c+), left-justified (\verb+l+), right-justified (\verb+r+),
or aligned on a decimal point (\verb+d+).
(Table~\ref{tab:table4}%
\begin{table}
\caption{\label{tab:table4}Numbers in columns Three--Five have been
aligned by using the ``d'' column specifier (requires the
\texttt{dcolumn} package).
Non-numeric entries (those entries without
a ``.'') in a ``d'' column are aligned on the decimal point.
Use the
``D'' specifier for more complex layouts. }
\begin{ruledtabular}
\begin{tabular}{ccddd}
One&Two&\mbox{Three}&\mbox{Four}&\mbox{Five}\\
\hline
one&two&\mbox{three}&\mbox{four}&\mbox{five}\\
He&2& 2.77234 & 45672. & 0.69 \\
C\footnote{Some tables require footnotes.}
&C\footnote{Some tables need more than one footnote.}
& 12537.64 & 37.66345 & 86.37 \\
\end{tabular}
\end{ruledtabular}
\end{table}
illustrates the use of decimal column alignment.)
Extra column-spacing may be be specified as well, although
REV\TeX~4 sets this spacing so that the columns fill the width of the
table.
Horizontal rules are typeset using the \verb+\hline+
command.
The doubled (or Scotch) rules that appear at the top and
bottom of a table can be achieved by enclosing the \texttt{tabular}
environment within a \texttt{ruledtabular} environment.
Rows whose columns span multiple columns can be typeset using \LaTeX's
\verb+\multicolumn{#1}{#2}{#3}+ command
(for example, see the first row of Table~\ref{tab:table3}).%
\begin{table*}
\caption{\label{tab:table3}This is a wide table that spans the page
width in \texttt{twocolumn} mode. It is formatted using the
\texttt{table*} environment. It also demonstrates the use of
\textbackslash\texttt{multicolumn} in rows with entries that span
more than one column.}
\begin{ruledtabular}
\begin{tabular}{ccccc}
&\multicolumn{2}{c}{$D_{4h}^1$}&\multicolumn{2}{c}{$D_{4h}^5$}\\
Ion&1st alternative&2nd alternative&lst alternative
&2nd alternative\\ \hline
K&$(2e)+(2f)$&$(4i)$ &$(2c)+(2d)$&$(4f)$ \\
Mn&$(2g)$\footnote{The $z$ parameter of these positions is $z\sim\frac{1}{4}$.}
&$(a)+(b)+(c)+(d)$&$(4e)$&$(2a)+(2b)$\\
Cl&$(a)+(b)+(c)+(d)$&$(2g)$\footnote{This is a footnote in a table that spans the full page
width in \texttt{twocolumn} mode. It is supposed to set on the full width of the page, just as the caption does. }
&$(4e)^{\text{a}}$\\
He&$(8r)^{\text{a}}$&$(4j)^{\text{a}}$&$(4g)^{\text{a}}$\\
Ag& &$(4k)^{\text{a}}$& &$(4h)^{\text{a}}$\\
\end{tabular}
\end{ruledtabular}
\end{table*}
The tables in this document illustrate various effects.
Tables that fit in a narrow column are contained in a \texttt{table}
environment.
Table~\ref{tab:table3} is a wide table, therefore set with the
\texttt{table*} environment.
Lengthy tables may need to break across pages.
A simple way to allow this is to specify
the \verb+[H]+ float placement on the \texttt{table} or
\texttt{table*} environment.
Alternatively, using the standard \LaTeXe\ package \texttt{longtable}
gives more control over how tables break and allows headers and footers
to be specified for each page of the table.
An example of the use of \texttt{longtable} can be found
in the file \texttt{summary.tex} that is included with the REV\TeX~4
distribution.
There are two methods for setting footnotes within a table (these
footnotes will be displayed directly below the table rather than at
the bottom of the page or in the bibliography).
The easiest
and preferred method is just to use the \verb+\footnote{#1}+
command. This will automatically enumerate the footnotes with
lowercase roman letters.
However, it is sometimes necessary to have
multiple entries in the table share the same footnote.
In this case,
create the footnotes using
\verb+\footnotemark[#1]+ and \verb+\footnotetext[#1]{#2}+.
\texttt{\#1} is a numeric value.
Each time the same value for \texttt{\#1} is used,
the same mark is produced in the table.
The \verb+\footnotetext[#1]{#2}+ commands are placed after the \texttt{tabular}
environment.
Examine the \LaTeX\ source and output for Tables~\ref{tab:table1} and
\ref{tab:table2}%
\begin{table}
\caption{\label{tab:table2}A table with more columns still fits
properly in a column. Note that several entries share the same
footnote. Inspect the \LaTeX\ input for this table to see
exactly how it is done.}
\begin{ruledtabular}
\begin{tabular}{cccccccc}
&$r_c$ (\AA)&$r_0$ (\AA)&$\kappa r_0$&
&$r_c$ (\AA) &$r_0$ (\AA)&$\kappa r_0$\\
\hline
Cu& 0.800 & 14.10 & 2.550 &Sn\footnotemark[1]
& 0.680 & 1.870 & 3.700 \\
Ag& 0.990 & 15.90 & 2.710 &Pb\footnotemark[2]
& 0.450 & 1.930 & 3.760 \\
Au& 1.150 & 15.90 & 2.710 &Ca\footnotemark[3]
& 0.750 & 2.170 & 3.560 \\
Mg& 0.490 & 17.60 & 3.200 &Sr\footnotemark[4]
& 0.900 & 2.370 & 3.720 \\
Zn& 0.300 & 15.20 & 2.970 &Li\footnotemark[2]
& 0.380 & 1.730 & 2.830 \\
Cd& 0.530 & 17.10 & 3.160 &Na\footnotemark[5]
& 0.760 & 2.110 & 3.120 \\
Hg& 0.550 & 17.80 & 3.220 &K\footnotemark[5]
& 1.120 & 2.620 & 3.480 \\
Al& 0.230 & 15.80 & 3.240 &Rb\footnotemark[3]
& 1.330 & 2.800 & 3.590 \\
Ga& 0.310 & 16.70 & 3.330 &Cs\footnotemark[4]
& 1.420 & 3.030 & 3.740 \\
In& 0.460 & 18.40 & 3.500 &Ba\footnotemark[5]
& 0.960 & 2.460 & 3.780 \\
Tl& 0.480 & 18.90 & 3.550 & & & & \\
\end{tabular}
\end{ruledtabular}
\footnotetext[1]{Here's the first, from Ref.~\onlinecite{feyn54}.}
\footnotetext[2]{Here's the second.}
\footnotetext[3]{Here's the third.}
\footnotetext[4]{Here's the fourth.}
\footnotetext[5]{And etc.}
\end{table}
for an illustration.
All AIP journals require that the initial citation of
figures or tables be in numerical order.
\LaTeX's automatic numbering of floats is your friend here:
just put each \texttt{figure} environment immediately following
its first reference (\verb+\ref+), as we have done in this example file.
\begin{acknowledgments}
We wish to acknowledge the support of the author community in using
REV\TeX{}, offering suggestions and encouragement, testing new versions,
\dots.
\end{acknowledgments}
\section*{Data Availability Statement}
AIP Publishing believes that all datasets underlying the conclusions of the paper should be available to readers. Authors are encouraged to deposit their datasets in publicly available repositories or present them in the main manuscript. All research articles must include a data availability statement stating where the data can be found. In this section, authors should add the respective statement from the chart below based on the availability of data in their paper.
\begin{center}
\renewcommand\arraystretch{1.2}
\begin{tabular}{| >{\raggedright\arraybackslash}p{0.3\linewidth} | >{\raggedright\arraybackslash}p{0.65\linewidth} |}
\hline
\textbf{AVAILABILITY OF DATA} & \textbf{STATEMENT OF DATA AVAILABILITY}\\
\hline
Data available on request from the authors
&
The data that support the findings of this study are available from the corresponding author upon reasonable request.
\\\hline
Data available in article or supplementary material
&
The data that support the findings of this study are available within the article [and its supplementary material].
\\\hline
Data openly available in a public repository that issues datasets with DOIs
&
The data that support the findings of this study are openly available in [repository name] at http://doi.org/[doi], reference number [reference number].
\\\hline
Data openly available in a public repository that does not issue DOIs
&
The data that support the findings of this study are openly available in [repository name], reference number [reference number].
\\\hline
Data sharing not applicable – no new data generated
&
Data sharing is not applicable to this article as no new data were created or analyzed in this study.
\\\hline
Data generated at a central, large scale facility
&
Raw data were generated at the [facility name] large scale facility. Derived data supporting the findings of this study are available from the corresponding author upon reasonable request.
\\\hline
Embargo on data due to commercial restrictions
&
The data that support the findings will be available in [repository name] at [DOI link] following an embargo from the date of publication to allow for commercialization of research findings.
\\\hline
Data available on request due to privacy/ethical restrictions
&
The data that support the findings of this study are available on request from the corresponding author. The data are not publicly available due [state restrictions such as privacy or ethical restrictions].
\\\hline
Data subject to third party restrictions
&
The data that support the findings of this study are available from [third party]. Restrictions apply to the availability of these data, which were used under license for this study. Data are available from the authors upon reasonable request and with the permission of [third party].
\\\hline
\end{tabular}
\end{center}
\section{}
\subsection{}
\subsubsection{}
\section{\label{Intro}Introduction}
The investigation of the equilibrium properties
of particles whose motion is confined to curved surfaces is surely challenging, but it is essential to achieve a satisfactory understanding of processes such as the lateral diffusion of proteins in membranes \cite{malchusAnomalousDiffusionReports2010,javanainenAnomalousNormalDiffusion2013,metzlerNonBrownianDiffusionLipid2016}, the controlled synthesis of colloidal aggregates\cite{savaralaStabilizationSoftLipid2011}, and demixing in lipid bilayers\cite{andersonRoleLipidShells2002,binderDomainsRaftsLipid2003,veatchCriticalFluctuationsPlasma2008}.
Confining particles to the surface of a sphere introduces
several constraints to their placement that are absent in Euclidean
(flat) space. Both the curvature and the topology of
the sphere play a role in the way particles can be arranged
on it—most prominently, no regular lattice can be fit onto
its surface, as the topology of the sphere requires \textcolor{myc}{the presence of 12 pentagonal disclinations \cite{bowickTwodimensionalMatterOrder2009}, and introduces structural defects characterizing glassy fluids at large area fractions \cite{singhCooperativelyRearrangingRegions2020}}. The compactness of the sphere also requires a careful treatment: instead of the straightforward thermodynamic limit, configurations of finite
(small) numbers of particles become more relevant, and both
the number of particles and the size of the sphere need to be
considered as two independent parameters \cite{postStatisticalThermodynamicsParticles1986}.
Among all possible spherical systems, multicomponent mixtures are of particular importance since they represent the class of systems including biological membranes in which the self-organisation of lipids into different domains is critical for many cell properties such as recognition, signalling, or endocytosis and exocytosis \cite{salaunLipidRaftsRegulation2004}.
Demixing and segregation in bulk systems can proceed via a number
of distinct physical mechanisms (such as spinodal decomposition
and nucleation), and it is generally well understood. However, the impact of spatial confinement and the interaction with external agents on the structure of multicomponent mixtures are less clear. Confinement can arise from the presence of external fields, produced, for example,
by substrates or random obstacles, but they can also be imposed
by the geometry of the embedding space. The latter type of
confinement is particularly relevant to biological cells, for
which the mobile fluid particles constituting the cell membrane
are constrained to lie on the surface of a quasi-spherical
body. \textcolor{myc}{This has boosted the interest for a deep understanding of multiphase fluids on smooth manifolds, especially on spheres and spheroids, and so in the past 2 decades many numerical studies have been focused on the particular problem of the phase separation of binary systems on surfaces and its dependence on the surface curvature. \cite{tangPhaseSeparationPatterns2005,greerFourthOrderPartial2006,marenduzzoPhaseSeparationDynamics2013,barreiraSurfaceFiniteElement2011}
Biological membranes} are indeed described as a quasi two-
dimensional fluids \cite{saffmanBrownianMotionBiological1975, camleyDynamicScalingPhase2011} in which the different constituents flow within the membrane manifold, being still partially free to move orthogonally to the membrane tangent plane and coupled to a less viscous three-dimensional surrounding medium.
They exhibit very often stable domains, whose spatial
distribution is important for many cell properties\cite{lennePhysicsPuzzlesMembrane2009,lingwoodLipidRaftsMembraneOrganizing2010}.
One common view is that the domains on the surface of
a cell are a consequence of an arrested or incomplete phase
separation, however it remains to be established whether the
observed states are permanent or metastable in character.
If the heterogeneous domain structure on the cell surface
is an equilibrium state, then some stabilizing mechanism
is required; the line tension present at interfaces between
domains would make inhomogeneous phases energetically
unfavorable when compared to a fully phase-separated system.
Many works have suggested that biological membranes are close to a demixing line in the temperature-composition plane.
When the lipid mixture is close to the miscibility critical point\cite{onukiPhaseTransitionDynamics2002,honerkamp-smithIntroductionCriticalPoints2009a} (the so-called weak-segregation limit) the temperature $T$ is close to a critical temperature $T_c$. In this limit, density fluctuations give rise to wide interfaces between fluctuating lipid domains, which do not have a precise shape\cite{destainvilleRationaleMesoscopicDomain2018}.
As a matter of fact, if a membrane is composed of two or more lipids (as most
biomembranes are), the segregation of one of the
lipid components in a set of domains is often encountered, as for example rafts rich in cholesterol and sphingolipids that have been implicated recently in signal transduction and membrane trafficking pathways\cite{andersonRoleLipidShells2002,binderDomainsRaftsLipid2003}.
Veatch and coworkers\cite{veatchCriticalFluctuationsPlasma2008} suggested
that lateral heterogeneities in living cells at physiological conditions correspond to critical fluctuations and that perturbations that alter the phase boundary could have a large effect on the size, composition, and
lifetime of fluctuations at physiological
temperatures. Also, lipid demixing due to the existence of a miscibility critical point in red blood cell (RBC) membranes has been highlighted via Langmuir trough and epifluorescence experiments by Keller and coworkers \cite{kellerRedBloodCell1998}, who showed that monolayers of lipids extracted from RBC membranes at room temperature segregate and form domains above a threshold surface pressure at the air-water interface.
In addition to single membrane properties, the interaction potential between
a pair of cells is also strongly influenced by the distribution and
size of the domains covering its surface. In this sense, cells
may be regarded as a naturally occurring type of "patchy
particles," which are particles with distinct
surface sites generating anisotropic interparticle interactions.
While synthetically fabricated patchy particles have attractive
patches strategically arranged on their surface
\cite{bianchiPatchyColloidsState2011}, the domains covering a cell emerge as a result of self-organization.
Recent developments in the controlled fabrication of patchy particles have raised hopes that materials with desired properties may be tailored by prescribing the number and geometrical arrangement of the patches \cite{bianchiPatchyColloidsState2011}.
In this framework, confined binary mixtures of active and passive particles on a sphere have also been studied\cite{aiBinaryMixturesActive2020} very recently, since particle activity coupled to the presence of intrinsic surface curvature frustrates local order, giving rise to novel phenomena \cite{shankarTopologicalSoundFlocking2017,keberTopologyDynamicsActive2014,sanchezSpontaneousMotionHierarchically2012}, such as curvature-induced defects and unforced flow.
On top of the spontaneous formation of domains and defects on spheres, both loss of miscibility and domain destabilization in spherically confined fluids can be also caused by the addition of adsorbing agents, \textcolor{myc}{like multivalent ions, polyelectrolytes and polyampholytes whose adsorption-desorption mechanism represents one the key problem tackled in soft matter physics\cite{caetanoCriticalAdsorptionMultiple2020,caetanoCriticalAdsorptionPeriodic2017}}. \textcolor{myc}{Induced-demixing has been widely investigated in the past}. Domain and raft formation in membranes has been found in the presence of bivalent ions \cite{jacobsonPhaseTransitionsPhase1975}, RNA and DNA strands \cite{michanekRNADNAInteractions2010}, charged proteins \cite{mbamalaDomainFormationInduced2005}, and oppositely charged polyelectrolytes \cite{macdonaldPolyelectrolyteinducedDomainsLipid1998}. By contrast, induced mixing has been documented much less and only very recently it has been shown that the addition of functionalized nanoparticles \cite{canepaAmphiphilicGoldNanoparticles2020} or thermoplastic polymers can indeed give rise to a suppression of lipid segregation \cite{bochicchioInteractionHydrophobicPolymers2017}. The general mechanisms dictating a mixing induced by adsorbing molecules, polymers or colloids and the thermodynamic conditions under which this occurs, have not been explored neither understood in depth.
Finally, domain formation and lipid miscibility plays a crucial role for the membrane permeability. Passive transport through biomembranes and bilayer lipid membranes is in many cases controlled by existing small holes (or voids) within them \cite{kotykMembraneTransport1977,kashchievBilayerLipidMembrane1983}.
There are several experimental evidences that proton, water and potentially drug permeability of mixed lipid membranes is enhanced by raft formation\cite{laroccaProvingLipidRafts2013,ghyselsPermeabilityMembranesLiquid2019,gensureLipidRaftComponents2006,sciollaInfluenceDrugLipid2021}, since inter-domain interfaces enhances ions and small molecules intrusion, and that membranes can be even destabilized by lipid substitution\cite{laroccaProvingLipidRafts2013} or multivalent ions\cite{haStabilizationDestabilizationCell2001}. In addition to biological membranes, hole formation have been used to describe the rupture of bilayer (Newtonian) black foam films \cite{derjaguinTheoryRuptureBlack,kashchievNucleationMechanismRupture1980}, the evaporation of liquids through adsorbed monolayers
\cite{dickinsonHardDiskFluid1978}, as well as the thermodynamic equilibrium of monolayers on liquid surfaces\cite{stoecklyEquationStateFattyacid1977}.\\
This said, despite an undisputed relevance of liquid mixtures lying on spheres and void formation in them, a systematic investigation through simple models on the role played by miscibility and its coupling to bulk particle adsorption in determining the mixture structure and in triggering void nucleation is still lacking.
In this work we introduce a minimal model to study the structure across a consolute point\cite{wildingLiquidvaporPhaseBehavior1998} of a symmetric Lennard-Jones binary mixture confined on a spherical surface by a harmonic potential, leaving particles free to oscillate along the radial direction. Such a quasi-2D model is employed first to characterize the structure of bare liquid mixtures at fixed temperature (here $T^*=0.5$) and varying miscibility parameter ($\ensuremath{\alpha_{\scriptscriptstyle AB}}$) ruling the demixing of the two fluid components (A and B). We compute both the total and the partial geodesic pair correlation functions, and we introduce a geodesic mixing parameter ($\Xi$) through which we describe both the spontaneous demixing and the effect of adsorbing bulk particle (AP) addition on the mixture structure. We focused on the role of the AP preferential affinity with one of the two mixture components and we give a simple structural criterion to distinguish between AP induced mixing and demixing, showing that the former occurs only for nearly demixed systems with large spatial fluctuations of domain boundaries.
For both AP-free mixtures and AP-decorated ones, we further investigate void size distributions. We show that in the presence of spatially fluctuating domains and inter-domain interfaces, large void formation is not favoured, and that AP adsorption can both enhance and disfavour the onset of large voids, depending on the miscibility of the two fluid constituents.
\section{Model}
The binary mixture studied in this paper consists of
fluids ($A$ and $B$) made of spherical particles of the same
size, $\sigma_{AA}=\sigma_{BB}$, and at concentrations of 50\% each. Particles of the same type interact through a truncated 12–6 Lennard-Jones (LJ) potential\cite{diaz-herreraWettingPhenomenonLiquidvapor2004}:
\begin{equation}\label{LJ}
\begin{cases}
U_{LJ}(r_{ij})=4\varepsilon_{ij}\left[\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{12}-\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{6}\right],&\mbox{if } r<3$\ensuremath{\sigma_{\scriptscriptstyle AA}}$\\
0, &\mbox{if } r>3$\ensuremath{\sigma_{\scriptscriptstyle AA}}$
\end{cases}
\end{equation}
with a mixing rule
\begin{equation}
\ensuremath{\sigma_{\scriptscriptstyle AB}}=\frac{1}{2}(\ensuremath{\sigma_{\scriptscriptstyle AA}}+\ensuremath{\sigma_{\scriptscriptstyle BB}}),\quad \ensuremath{\varepsilon_{\scriptscriptstyle AB}} =\ensuremath{\alpha_{\scriptscriptstyle AB}}\ensuremath{\varepsilon_{\scriptscriptstyle AA}},
\end{equation}
where $\ensuremath{\varepsilon_{\scriptscriptstyle AA}}=\ensuremath{\varepsilon_{\scriptscriptstyle BB}}$, and $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ is the parameter controlling the miscibility of the two fluids.
Notice that when, $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0$, we obtain two independent LJ fluids
while in the opposite case, $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$, the system reduces to a
single LJ fluid. By choosing, $0<\ensuremath{\alpha_{\scriptscriptstyle AB}}<1$, the attractive part of
the interaction between dissimilar particles becomes weaker than that of the $AA$ and $BB$ interactions, favouring demixing\cite{diaz-herreraWettingPhenomenonLiquidvapor2004}. Each particle vibrates around the ideal surface of a sphere of radius $R_s$ since they are further confined via a parabolic potential:
\begin{equation}
U_c(r_i)=\frac{1}{2}\kappa_c(r_{i}-R_s)^2,
\end{equation}
where $\frac{\kappa_c\ensuremath{\sigma_{\scriptscriptstyle AA}}^2}{2k_BT}=10$ and $r_i$ is the distance between particle $i$ and the center of the confining sphere. To check the influence of the system size on demixing, we simulated three systems characterized by different particle numbers ($N_p=250,500,1000$) and the same area fraction occupied by the particles $\phi=\frac{N_p\ensuremath{\sigma_{\scriptscriptstyle AA}}^2}{16R_s^2}=0.5$, corresponding to a reduced density $\rho^*=\frac{4\phi}{\pi}=0.63$. \textcolor{myc}{The choice of the system size has been made to ensure that the particle-to-sphere size ratio $\ensuremath{\sigma_{\scriptscriptstyle AA}}/2R_s$, ranging here from 0.044 to 0.089, was comparable to the bilayer-to-vesicle size ratios encountered in small lipid vesicles \cite{sciollaInfluenceDrugLipid2021}, the latter being $\approx 0.05$.
The attractive interaction between the confined particles ($\leq 2k_BT$, see section \ref{simu}) and the energy scale ($\frac{\kappa_c\ensuremath{\sigma_{\scriptscriptstyle AA}}^2}{2}$) of the confining potential have been chosen to reproduce the same order of magnitude respectively of the in-plane lipid-lipid interactions (few $k_BT$ units\cite{komuraLateralPhaseSeparation2004} for homogeneous systems and possibly less than $k_BT$ for dissimilar lipids\cite{almeidaThermodynamicsMembraneDomains2005}) and the bending energy of membranes per lipid (from few tens to hundreds of $k_BT$ per molecule \cite{pelitiBiologicallyInspiredPhysics1991}). The first allows molecules to diffuse and structure itself as a fluid and its variation determines whether demixing occurs at room temperature if more than one lipid type is present. The second gives rise to membrane stability. The magnitude of the confining potential has been further selected so as to preserve equipartition of kinetic energy during all the simulation runs and avoid flying ice-cube artifacts.}
Free unconfined APs interacting with the mixture via the potential (\ref{LJ}) with LJ diameter $\ensuremath{\sigma_{\scriptscriptstyle PP}}=\ensuremath{\sigma_{\scriptscriptstyle AA}}$ have been further added to mixtures composed by $N_p=500$ particles in order to study the effect of physical adsorption on the structure of the confined AB-system. The interaction between APs and the mixtures is set by equation \ref{LJ}, where miscibility between APs and A-type particles has been fixed by setting their miscibility parameter to $\ensuremath{\alpha_{\scriptscriptstyle AP}}=1$, while that between APs and B-type particles has been tuned by varying their mutual miscibility parameter (hereinafter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$) in the range $1-0.025$. In this way the interaction between the adsorbing particles and the confined mixtures is such as to be preferential (for $\ensuremath{\alpha_{\scriptscriptstyle BP}}<\ensuremath{\alpha_{\scriptscriptstyle AP}}$) or, let's say, symmetrical (for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=\ensuremath{\alpha_{\scriptscriptstyle AP}}$) while the total adsorption energy decreases when $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ is lowered.
\textcolor{myc}{In such a way the simulated systems mimic the weak physical adsorption of small molecules whose adsorption energies do not exceed few $k_BT$ units.}
The surface of the confining sphere has been further made impenetrable to bulk APs via the purely repulsive potential:
\begin{equation}\label{LJAPrep}
U_{LJ}(r_{\scriptscriptstyle PS})=4\varepsilon_{\scriptscriptstyle PS}\left[\left(\frac{2R_s+\ensuremath{\sigma_{\scriptscriptstyle PP}}}{r_{\scriptscriptstyle PS}}\right)^{12}\right],
\end{equation}
where $\varepsilon_{\scriptscriptstyle PS}/(k_BT)=2\cdot 10^{-4}$ and $r_{PS}$ is the center-to-center distance between an AP and the sphere confining the AB mixture.
\section{Simulation details}\label{simu}
We have carried out extensive MD simulations to investigate the structural properties of this model binary mixture as a function of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ and $\ensuremath{\alpha_{\scriptscriptstyle BP}}$. The equations of motion were integrated using a velocity-Verlet algorithm with reduced time step $\Delta t^*=\frac{\Delta t}{\ensuremath{\sigma_{\scriptscriptstyle AA}}}\sqrt{\frac{\ensuremath{\varepsilon_{\scriptscriptstyle AA}}}{m_A}}=5\cdot10^{-6}$. $m_A$ is the particle mass for species $A$ and $m_A=m_B=m_P$. We fixed in all simulations the reduced temperature at $T^*=\frac{k_BT}{\varepsilon_{AA}}=0.5$, where 2D Lennard-Jones fluids are in a condensed liquid state \cite{barkerPhaseDiagramTwodimensional1981,holianFragmentationMolecularDynamics1988}.
For the chosen set of miscibility parameters ($\ensuremath{\alpha_{\scriptscriptstyle AB}}$,$\ensuremath{\alpha_{\scriptscriptstyle BP}}$) we equilibrated the systems using the Berendsen's thermostat with a large coupling constant $\tau_T=2\cdot 10^3\Delta t$ to obtain a stable trajectory in equilibrium. Equilibration runs have been performed for $2\cdot10^8$ time steps and production runs have been carried out in the NVE ensemble for \textcolor{myc}{$5.2$} $\cdot 10^7$ time steps during which total and kinetic energy drifts were absent. To exclude the presence of important ballistic collective motions of the confined particles due to an eventual rigid rotation of mixtures on the sphere, and energy transfer from high to low frequency modes, we have further performed long NVT simulations for $N_p=1000$ and $N_p=500$ at $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ to compute the mean angular square displacements: a pure diffusive behavior has been observed (see Appendix \ref{appA}).
To minimize correlations between measurements we calculated structural
quantities every $\Delta t_s=5\cdot 10^{\textcolor{myc}{5}}$ time steps (\textcolor{myc}{see Appendix \ref{appD}}).
Simulations including $N_{\scriptscriptstyle AP}=1000$ free bulk particles have been carried out only for mixtures with $N_p=500$. The choice of such an excess of bulk particles has been inspired by the experimental system recently investigated by the author and coworkers \cite{sciollaInfluenceDrugLipid2021} in which lipid phase separation in mixed liposomes has been observed in excess of Isoniazide, one of the primary drugs used in the tuberculosis treatment.
An investigation on the effect of bulk particle concentration, temperature and mixture composition are currently in progress and will be the subject of a future publication. Bare mixtures confined on the sphere have been simulated in a cubic box of size $L=10R_s$ with no extra periodic boundary conditions, with the sphere being at the center of the box. We underline here that the main characteristic of such systems is to be finite but without boundaries, with periodic boundary conditions being not an artifact of the simulations,
but an essential feature of it. Hence, in this case there is no need for further
assumptions or corrections: the complete system is simulated.
Conversely, we carried out simulations including bulk APs in a box of size $L=4.2R_s$, correspondent to a reduced density for the bulk particles $\rho^*=\frac{N_{\scriptscriptstyle AP}\sigma_{CC}^3}{(L^3-4/3\pi R_s^3)}=0.029$, with cubic periodic boundary conditions applied only to free APs.
\section{Bare mixtures}
The structure of bare mixtures has been studied by inspecting the total $g(s)$ and the partial $g_m(s)$ pair correlation functions defined as:
\begin{equation}\label{g(s)}
g(s)=\frac{1}{2N_p^2sin(s)} \frac{dn(s)}{ds}
\end{equation}
\begin{multline}\label{gAB(s)}
g_m(s)=\frac{1}{2}(g_{\scriptscriptstyle AB}(s)+g_{\scriptscriptstyle BA}(s))=\\ \frac{1}{2}\left[\frac{1}{2N_A^2sin(s)}\frac{dn_{\scriptscriptstyle AB}(s)}{ds}+\right.\\
\left.\frac{1}{2N_B^2sin(s)}\frac{dn_{\scriptscriptstyle BA}(s)}{ds}\right]
\end{multline}
where $s\in[0,\pi]$ is the normalized geodesic distance on the unit sphere, $dn(s)$ is the average number of particles at geodesic distance comprised between $s$ and $s+ds$ from one test particle and $dn_{\scriptscriptstyle AB}(s)$ ($dn_{\scriptscriptstyle BA}(s)$) is the average number of particles of type B (A) at geodesic distance comprised between $s$ and $s+ds$ from a test particle of type A (B). For homogeneous mixtures ($\ensuremath{\varepsilon_{\scriptscriptstyle AA}}=\ensuremath{\varepsilon_{\scriptscriptstyle BB}}=\ensuremath{\varepsilon_{\scriptscriptstyle AB}}$) $g_m(s)=g(s)$, while the largest difference between the two functions is attained when the two fluids are fully separated on the sphere in a Janus-like configuration.\\
Figure \ref{snapshots} shows snapshots of equilibrated samples of mixtures for $N_p=1000$ with different mixing parameters $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ ranging from 1 down to 0.05. A continuous transition from fully miscible to Janus-like patterns characterizes the demixing transition with an intermediate regime $0.5\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq 0.8$ where large spatial interfacial fluctuations and domains emerge.
\begin{figure}[htbp]
\includegraphics[width=8cm]{Snapshots-noparticles-with0p50p8_crop.pdf}
\caption{Snapshots of binary 50:50 AB-mixtures ($N_p=1000$) confined to move on a spherical surface with radius of curvature $R_s=11.18\ensuremath{\sigma_{\scriptscriptstyle AA}}$ and different miscibility parameters $0.05\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq 1$, as indicated in the figure. All snapshots refer to equilibrium states.}\label{snapshots}
\end{figure}
By computing both $g(s)$ (Figure \ref{grtot-noions}) and $g_m(s)$ (Figure \ref{grAB-noions}) we follow both the structure of the whole fluid and the demixing of the two components on the sphere. Though demixing does not affect remarkably the local structure, we unambiguously observe a weak melting of the mixture induced by the formation of large domains, as signalled by the global minimum of the height of the first peak of $g(s)$ as a function of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. The decrease of the first peak reveals that the average local density of the fluid in the immediate vicinity of any particle decreases with respect to the homogeneous system when fluctuating domains coexist (inset of Figure \ref{grtot-noions}), since a complete structural demixing is not achieved, the number of weak AB bonds is still large and particles are on average less bound. On the contrary, when the Janus-like configuration is attained and small spatial fluctuations characterize the interface between the A-rich and the B-rich phases, the number of AB contacts decreases and the average particle-particle distance in the fluid goes back to about the one obtained for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$.
\begin{figure}[htbp]
\includegraphics[width=8cm]{gr-total-N1000resub.pdf}
\caption{Total pair correlation functions $g(s)$ for $N_p=1000$ and selected values of the miscibility parameter $0.2\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq1$. Inset: height of the first peak $g(s_{max})$ for the whole set of miscibility parameters investigated in this work.}\label{grtot-noions}
\end{figure}
The partial correlation functions $g_m(s)$ (Figure \ref{grAB-noions}) follow the demixing of the two components: when particles are fully mixed $g_m(s)=g(s)$, while when $\ensuremath{\alpha_{\scriptscriptstyle AB}}\ll 1$ and full demixing occurs, the probability to find an AB contact drastically decreases (small $s$ region) and it increases progressively until it reaches its maximum at angular distance $s=\pi$. This is accompanied by the disappearence of the correlation peaks of $g_m(s)$ when $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ decreases, as shown in the inset of Figure \ref{grAB-noions} for representative values of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$.\\
\begin{figure}[htbp]
\includegraphics[width=8cm]{gAB-N1000resub.pdf
\caption{Partial pair correlation functions $g_m(s)$ for $N_p=1000$ and selected values of the miscibility parameter $0.1\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq 1$. Inset: Same data of the main panel for $0\leq s\leq 0.8$.}\label{grAB-noions}
\end{figure}
Since confining spherical surfaces are a closed manifold with uniform curvature, we can describe in a nutshell the demixing by defining a geodesic mixing parameter as the square distance between $g(s)$ and $g_m(s)$ on $[0,\pi]$:
\begin{equation}\label{xi}
\Xi=\|g(s)-g_m(s)\|^2=\int_0^{\pi}[g(s)-g_m(s)]^2ds.
\end{equation}
$\Xi$ is zero when the two components of the mixtures are fully mixed and larger than zero to an extent depending on the structural demixing.
In Figure \ref{distmix-energy} we show $\Xi(\ensuremath{\alpha_{\scriptscriptstyle AB}})$ obtained for the three simulated system sizes ($N_p=250,500,1000$). $\Xi(\ensuremath{\alpha_{\scriptscriptstyle AB}})$ smoothly passes from very low values compatible with zero (given the simulation noise) for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ to larger values, that depends weakly on $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ when the latter is lower than $\approx 0.2$ for each system size, pointing out that radius of curvature $R_s$ does not impact remarkably the structural demixing transition apart from a very small shift of the critical miscibility parameter $\ensuremath{\alpha_{\scriptscriptstyle AB}}^c$ defined as the point where $\frac{d^2\Xi}{d\ensuremath{\alpha_{\scriptscriptstyle AB}}^2}=0$, that we extract as detailed in Appendix \ref{appB}.
Actually, we expect that compositional fluctuations start to play a role for very small radius of curvatures impacting more the angular particle distribution, favouring mixing.
\begin{figure}[htbp]
\includegraphics[width=8cm]{spheresize-resub.pdf
\caption{Geodesic mixing parameter $\Xi$ \textcolor{myc}{as a function of} the miscibility parameters $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ for the three different system sizes $N_p=250,500,1000$, and fixed area fraction \textcolor{myc}{$\phi=0.5$}. Dashed line are fits obtained via equation \ref{fitxi} (Appendix \ref{appB}).}\label{distmix-energy}
\end{figure}
To gain a complementary insight on the structure of the mixtures and their stability against void formation we computed the normalized large-void size distribution $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$ defined as
\begin{equation}\label{def-Pvoid}
P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)=\frac{N(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)}{\sum\limits_{h=1}^{\infty}N(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)},\quad \mbox{with\hspace{0.2cm}} A_h\geq \frac{\ensuremath{\sigma_{\scriptscriptstyle AA}}^2}{4}
\end{equation}
where $A_h$ is the area of a void with size $h\ensuremath{\sigma_{\scriptscriptstyle AA}}^2/4$ and $N(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$ is the number of voids with normalized size $A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2$. We therefore restrict the search of voids to those having area larger than a particle radius square, since we are not interested to the distribution of small interstitial spaces between particles but rather to those voids that are compatible with inclusion of adsorbing particles or molecules in real systems. Indeed the minimal void-to-particle size ratio taken into consideration in this work ($A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2=1/4$) is of the same order of magnitude of that characterizing water molecules and lipid cross section in membrane lipids\cite{israelachviliModelPackingLipids1975}.
To compute each void area $A_h$ we applied a spherical grid to the confining sphere, where $N_{g}$ grid points are almost-equidistant and have been generated following the scheme proposed in\cite{desernoHowGenerateEquidistributed}, with a lattice spacing $a \simeq \ensuremath{\sigma_{\scriptscriptstyle AA}}/2$.
We consider as a void a subset of $n_g$ grid points such that: i) each point of the subset is far from any particles by a geodesic distance larger than $3/4\ensuremath{\sigma_{\scriptscriptstyle AA}}$; ii) a void has $n_g>1$ if each point of the subset have at least one grid point distant one lattice spacing and belonging to the same subset (cluster of points). The area of the void is then well approximated by $A_h=n_g \ensuremath{\sigma_{\scriptscriptstyle AA}}^2/4$, with a minimum measurable value equal to $\ensuremath{\sigma_{\scriptscriptstyle AA}}^2/4$. In figure \ref{voids-noions} we report the normalized distribution of void sizes for selected values of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. The reentrant behavior of the distribution tails goes along with the already mentioned fluidization of the system (Figure \ref{grtot-noions}) when jagged domain boundaries characterize the mixtures. In this regime, since $AB$ contacts are maximized and particles are on average less bound, the formation of large voids is hampered. To describe exhaustively this behavior we have fitted the void distributions with a phenomenological function of the following type:
\begin{equation}\label{Pvoid}
P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)=P_0+\frac{a}{1+\left(b\frac{A_h}{\ensuremath{\sigma_{\scriptscriptstyle AA}}^2}\right)^c}\cdot e^{-A_h/A_c}
\end{equation}
where $A_c$ is the exponential characteristic cutoff area of the distribution, $P_0$ is an offset set to zero for distribution showing exponential tails and larger than zero when large voids are created by bulk particle adsorption (see section \ref{withads}). Finally $a$, $b$ and $c$ characterize the power law regime observed for small void sizes.
The choice of the fitting function has not been made by chance. Boutreux and De Gennes \cite{boutreuxCompactionGranularMixtures1997} first postulated exponential decays for void size distributions in granular matter and based on this, Caglioti and coworkers \cite{cagliotiCooperativeLengthApproach1999} related quantitatively the characteristic dynamical properties for the same systems to quasistatic quantities, e.g. free-volume and configurational entropy. In our mixtures, however thermal (and stress) fluctuations are important and the void formation should also be related to the probability of spontaneous rupture events of a given size. Rupture events often show power-law size distributions \cite{amitranoVariabilityPowerlawDistributions2012}
with an exponential cut-off due to the finite size of the system, while shifted gamma functions with exponential tails have proven to be appropriate to describe the statistics of void sizes in packed protein cores and jammed packings of amino-acid-shaped particles \cite{treadoVoidDistributionsReveal2019} and attractive emulsion droplets\cite{jorjadzeAttractiveEmulsionDroplets2011}. These Boltzmann-type distribution tails are those maximizing configurational entropy in packed systems \cite{jorjadzeAttractiveEmulsionDroplets2011}.
Our results are in line with these previous findings and point to void distribution tails with two distinct regimes: a power-law decay followed by an exponential cut-off. Finally, the deviation from a simple power-law at very low void areas ($\lim_{A_h\to 0}P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)=P_0+a$) reflects the fact that the void size is limited by the interstitial space between LJ sphere, so that the distribution must converge to 0 as $A_h\rightarrow 0$\cite{treadoVoidDistributionsReveal2019}. Such a deviation is found systematically for all the sets of parameters employed in our simulations, hence the need to use equation \ref{Pvoid} to fit satisfactorily all our data. A finite non-zero value for $P_0$ further points to a non-exponential (fat) tail of the distribution. This will be the case of some of the mixtures in presence of APs.
The inset of Figure \ref{voids-noions}-A shows $A_c/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2$ together with the probability to have unit voids ($A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2=1/4$). The two quantities show two non-monotonic trends with opposite concavity, corroborating the scenario in which demixing on small confining spheres is structurally a smooth process with the formation of small (large) voids being enhanced (suppressed) in the presence of fluctuating domains.
Similarly to what we observed for the cut-off areas, the total (large-)void size $A_{tot}=\sum\limits_{h=1}^{\infty}N(A_h/\sigma_{AA}^2)$shows a minimum for mixtures with large fluctuating domain interfaces (Figure \ref{voids-noions}-B). This further suggests that the integrity of spherical mixtures is stabilized by compositional fluctuations.
\begin{figure}[htbp]
\includegraphics[width=8cm]{voids-no-ions_ABpanels-resub.pdf
\caption{Panel A: Void size distribution $P(A_h/\sigma_{AA}^2)$ for different miscibility parameter $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ as indicated in the panel. The inset shows the cut-of area $A_c$ (black sqaures) defined in equation \ref{Pvoid} and the fraction the smallest voids $P(1/4)$ (blue circles) as a function of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. Panel B: Total void area in function of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. The area takes into account only voids with size $A_h\geq\ensuremath{\sigma_{\scriptscriptstyle AA}}^2/4$.}\label{voids-noions}
\end{figure}
All in all, the driving forces dictating large void formation are two: the ability of particles to form long-lived clusters, that is enhanced by increasing the total cohesive energy (here increasing $\ensuremath{\alpha_{\scriptscriptstyle AB}}$) and dewetting, occurring for fully demixed fluids ($\ensuremath{\alpha_{\scriptscriptstyle AB}}\ll 1$) where void formation is favored in the inter-domain regions.
\section{Mixtures with adsorbing particles}\label{withads}
The adsorption of particles on the confined mixtures modifies their structure and, largely affect the mixing-demixing transition. Figures \ref{Snap1}, \ref{Snap06} and \ref{Snap005} show selected equilibrium snapshot with $N_{\scriptscriptstyle AP}=1000$ APs for three representative cases: fully mixed fluids ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$), fluctuating domains ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$) and fully demixed fluids ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.05$). and we show also, for comparison, the configurations in the absence of APs. For fully mixed fluids, the addition of bulk particles with decreasing $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ coefficients gives rise to a progressive induced-demixing on the sphere. This is due to the large energy loss attained when bulk particles adsorb only on a condensed domain rich in one of the two species on the sphere that hence tend to segregate. In this case adsorbed particle can be viewed as energetic bridges between particles of type A.\\
\begin{figure*}[htbp]
\includegraphics[width=\textwidth]{Snapshots-withparticles-a121p0-crop.pdf
\caption{Snapshots of binary 50:50 AB-mixtures ($N_p=500$) confined to move on a spherical surface with radius of curvature $R_s=7.90\ensuremath{\sigma_{\scriptscriptstyle AA}}$, with $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1.0$ and 3 selected AP-mixture interaction parameter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$. A snapshot taken in absence of AP is given for reference. All snapshots refer to equilibrium states. By decreasing the affinity between APs and B-particles (snapshots from left to right), particle adsorption favours particle demixing and domain formation on the sphere, until reaching a Janus-like configuration for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$.}\label{Snap1}
\end{figure*}
In the intermediate regime (Figure \ref{Snap06}), where large spatial compositional fluctuations characterize the confined mixture, particle adsorption induces contrasting effects, depending on whether the interaction of APs with the particles belonging to the mixtures is symmetric ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$) or not. When $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ large domains break up, pushing the mixture towards mixing. Such a non-trivial behavior is the result of the subtle balance between the configurational entropy of the APs, that adsorb uniformly on the sphere when $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$, lowering the line tension between the domains and causing their dissolution, and the energy gain that takes place when more energetic AA (or BB) bond are replaced by AB bonds.
\begin{figure*}[htbp]
\includegraphics[width=\textwidth]{Snapshots-withparticles-a120p6-crop.pdf
\caption{Snapshots of binary 50:50 AB-mixtures ($N_p=500$) confined to move on a spherical surface with radius of curvature $R_s=7.90\ensuremath{\sigma_{\scriptscriptstyle AA}}$, with $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ and 3 selected AP-mixture interaction parameter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$. A snapshot taken in absence of AP is given for reference. All snapshots refer to equilibrium states. Particle adsorption favours particle mixing first ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$) and then, by decreasing the affinity between APs and B-particles (snapshots from left to right), domain formation is progressively promoted on the sphere until reaching a Janus-like configuration ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$)}\label{Snap06}
\end{figure*}
By contrast, when lower values of $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ are used and AP interact preferentially with particle of type A, the mixture adopts a Janus-like (fully separated) configuration, as already discussed for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$.\\Finally for low miscibility (Figure \ref{Snap005}) particle adsorption does not affect much the mixture structure and only a very weak effect can be observed when $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ is progressively lowered.
\begin{figure*}[htbp]
\includegraphics[width=\textwidth]{Snapshots-withparticles-a120p05-crop.pdf}
\caption{Snapshots of binary 50:50 AB-mixtures ($N_p=500$) confined to move on a spherical surface with radius of curvature $R_s=7.90\ensuremath{\sigma_{\scriptscriptstyle AA}}$, with $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.05$ and 3 selected AP-mixture interaction parameter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$. A snapshot taken in absence of AP is given for reference. All snapshots refer to equilibrium states. In this case particle adsorption does not relevantly impact the initially demixed state of the confined fluid.}\label{Snap005}
\end{figure*}
We quantify all these changes on the structure of the confined mixture by computing the total pair correlation function $g(s)$ and the partial correlation function $g_m(s)$ for the AB-mixtures, and the normalized structural mixing parameter
\begin{equation}\label{xinorm}
\Xi^*=\frac{\Xi_{\scriptscriptstyle AP}}{\Xi_{bare}},
\end{equation}
where $\Xi_{\scriptscriptstyle AP}$ and $\Xi_{bare}$ are calculated according to equation \ref{xi} in the presence and absence of adsorbing particles, respectively.
The visual inspection of the mixture structure can be substantiated quantitatively in a first instance by comparing $g_m(s)$ with and without APs.
\begin{figure*}[htbp]
\includegraphics[width=\textwidth]{gAB-ionseffect-resub.pdf
\caption{Partial pair correlation functions $g_m(s)$ for symmetric AP-mixture interaction parameter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$=1 (panels A,B,C), large preferential affinity of the APs and A-type particles, $\ensuremath{\alpha_{\scriptscriptstyle BP}}$=0.025 (panels D,E,F), and three selected miscibility parameters $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ as indicated in the figure. In all the cases $g_m(s)$ of the mixtures in absence of APs is also reported for reference. Insets show the same data in the range $0\leq s\leq 1$ to zoom on the AP effect on the local structure.} \label{grAB-ionseffect}
\end{figure*}
This is shown in figure \ref{grAB-ionseffect} for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ (panels A,D), $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ (panels B,E) and $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.3$ (panels C,F). We show the two representative cases of fully symmetric interactions between the APs and two components of the mixture ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$, panels A,B,C), and the most asymmetric case investigated ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$, panels D,E,F). The remarkable effect of APs on the mixtures at $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ catches immediately the eye, with contrasting relative variations passing from symmetric interactions (Figure \ref{grAB-ionseffect}-B) to strongly asymmetric ones (Figure \ref{grAB-ionseffect}-E). This is not observed for the fully miscible case ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$) or for Janus-like mixtures ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.3$), for which a decrease in ($\ensuremath{\alpha_{\scriptscriptstyle BP}}$) gives rise to a progressive induced-demixing, the extent of the latter being much more pronounced for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$. In more detail, when large domain fluctuation dominates and AP addition induces particle mixing partial correlation functions show augmented local structure peaks and lower values (closer to one) at large distance with respect to the bare case. This is the case $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ and $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ (Figure \ref{grAB-ionseffect}-B). On the other hand when AP addition gives rise to induced demixing, $g_m(s)$ show reduced correlation peaks at small geodesic distance while it increases at large distance with respect to the bare system. This is the case $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ and $\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$ (Figure \ref{grAB-ionseffect}-E). For the other values of the miscibility parameter, namely $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ and $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.3$, the AP addition has a relatively weak effect on the structure of the mixtures when $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ (Figure \ref{grAB-ionseffect}-A,C), while it produces an important fluid demixing of the initially miscible system ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$) for strongly asymmetric AP-mixture interactions ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$, Figure \ref{grAB-ionseffect}-D). This, again, is reflected by the net decrease of the structure peaks at small $s$ and a continuous increase of $g_m(s)$ at large $s$.
\begin{figure}[htbp]
\includegraphics[width=8.0cm]{normalized-norm-resub.pdf}
\caption{Normalized geodesic mixing parameter $\Xi^*$ in function of the interaction parameter $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ for the $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ values indicated in the figure. Solid lines are only a guide to the eye.}\label{normonorm}
\end{figure}
To build up and visualize more clearly a general scenario based on all our results we computed $\Xi^*(\ensuremath{\alpha_{\scriptscriptstyle BP}})$ for all the investigated systems in the presence of AP. This is shown in figure \ref{normonorm} for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1,0.8,0.5,0.3,0.05$. We note that: i) for large asymmetries of the AP-mixture interaction ($\ensuremath{\alpha_{\scriptscriptstyle BP}}\ll 1$) the extent of the induced demixing increases for increasing values of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$; ii) the dependence of $\Xi^*$ on $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ weakens when AB miscibility decreases, reflecting the fact that the structure is affected by AP addition if particle segregation is poor;
iii) mixtures that are characterized by large fluctuating domains and interfaces between A-rich domains and B-rich domains show both induced demixing ($\Xi^*>1$) and induced mixing ($\Xi^*<1$) depending on the magnitude of the asymmetry $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ of the AP-mixture interactions. This is quite remarkable since many experimental systems are close to a demixing line and shows that both mixing and demixing are possible in such systems when particles or complex molecules, other than those composing the mixtures, are co-suspended.
\begin{figure}[htbp]
\includegraphics[width=8.0cm]{voids-withAP-1-1effect-resub-crop.pdf
\caption{Void size distribution $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$ with no preferential affinity ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$) and varying miscibility parameter $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ as indicated in the panels (A,B,C,D,E). Distributions obtained in absence of APs are also reported for reference. Solid lines are best fits obtained via equation \ref{Pvoid}.
For each $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ value one snapshot of an equilibrium configuration with $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ shows the biggest visible void. APs are not shown for clarity.}\label{voids-1-1}
\end{figure}
Finally, as done for bare mixtures, we report the void size distributions for representative systems in the presence of APs and we separate the case $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ from the rest of the systems since only in the former case we observe the formation of very large deviations from a simple exponential decay of the distribution tails. Figure \ref{voids-1-1} (panels A,B,C,D,E) shows the distributions $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$ and five representative configuration snapshots obtained for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ and $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1,0.6,0.5,0.3,0.05$. The distributions are further compared to those obtained for bare mixtures. In all the cases, the effect of the AP addition is to enhance the formation of large voids since particle adsorption increases the cohesive energy between the particles confined on the sphere. This results in the suppression of the exponential tails of the void size distributions and the onset of fat tails, that we attribute to the transition from a regime where voids are uniformly distributed on the sphere (no APs) to one where one very large void, whose size fluctuates, dominates. In all such cases we find tails compatible with a power-law decay ($A_c=\infty$) with $P_0>1$ for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ and $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.05$ (Figure \ref{voids-1-1}-A,E).
However, such enhancement of large void formation, though present for each $\ensuremath{\alpha_{\scriptscriptstyle AB}}$, does depend on the mixture structure. First of all, a reduced distribution widening is observed for intermediate $\ensuremath{\alpha_{\scriptscriptstyle AB}}$, where large compositional fluctuations characterize the mixtures (see the $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ case in figure \ref{voids-1-1}-B). This is due to the large free energy cost that a large void would produce, since it would suppress domain fluctuations and enhance segregation while, in such a regime, the bare mixture is on average less packed (see Figure \ref{grtot-noions}) and irregular interfaces between domains form. Thus, the appearance of many voids of intermediate size is favoured at the expense of one very large void with fluctuating size.
Upon decreasing further the value of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ large voids develop again and, for Janus-like configurations, are spatially located at the interface between the A-rich domain and the B-rich domain, since the weaker bonds are those between dissimilar particles. Such interfacial void formation is reflected again by the extended (non-exponential) tails of the distributions $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$.\\
\begin{figure}[htbp]
\includegraphics[width=8.0cm]{voids-other-alphaBC-resub.pdf}\\
\includegraphics[width=4.0cm]{dc-rel.pdf}\includegraphics[width=4.0cm]{dAc-rel.pdf}\\
\caption{Panels A,B,C,D,E: Void size distribution $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$ for varying miscibility parameter $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ and AP-preferential affinity ($0.025\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq 0.5$) as indicated in the figure. Distributions obtained in absence of APs are also reported for reference. Solid lines are best fits obtained via equation \ref{Pvoid} for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=0.025$ and for bare mixtures.
Bottom panels: relative variation $\Delta c/c_{bare}$ and $\Delta A_c/A_c^{bare}$ of the exponent and the cut-off area defined in equation (\ref{Pvoid})}\label{voids-1-X}
\end{figure}
For lower $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ (Figure \ref{voids-1-X}-A,B,C,D,E) the AP addition affects much less the distributions $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$, that preserve their exponential tails. Notwithstanding this, it's worth noting that AP addition in mixtures at $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ and $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ give rise to contrasting effects: for the fully miscible system, an increase of the asymmetry of the AP-mixture interaction (i.e. decreasing $\ensuremath{\alpha_{\scriptscriptstyle BP}}$) reduces the void sizes for large enough interaction asymmetry (small $\ensuremath{\alpha_{\scriptscriptstyle BP}}$), pushing the distributions towards narrower tails; on the contrary when large irregular domains characterize the bare mixture, AP addition gives rise always to a widening of the distribution tails, reflecting the creation of larger voids. In the first case ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$, Figure \ref{voids-1-X}-A) the void size reduction is principally due to the fact that, by progressively breaking the interaction symmetry between particles, APs induce demixing and trigger the formation of large fluctuating domains. This suppresses, albeit weakly, large voids akin to the case of the bare mixtures at intermediate $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. In the second case ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$, Figure \ref{voids-1-X}-B), the enhanced particle adhesion due to the AP presence dominates, favouring large void formation as for the aforementioned $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$ case. For the other cases, namely $\ensuremath{\alpha_{\scriptscriptstyle AB}}<0.6$ (Figure \ref{voids-1-X}-C,D,E), the effect of APs on $P(A_h/\ensuremath{\sigma_{\scriptscriptstyle AA}}^2)$, stay very weak but still detectable. The relative variation of the power-law decay exponent $\Delta c/c_{bare}$ and the cut-off area $\Delta A_c/A_c^{bare}$ are reported in figure \ref{voids-1-X} (bottom panels), where $\Delta c=(c-c_{bare})$, $\Delta A_c=(A_c-A_c^{bare})$, and $c_{bare}$ and $A_c^{bare}$ are the power-law exponent and the cut-off area extracted from the distributions in the absence of APs, respectively. We note that i) the power-law exponent varies almost to the same extent for any values of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ by decreasing the AP-mixture interaction asymmetry (increasing $\ensuremath{\alpha_{\scriptscriptstyle BP}}$), pointing in this case to a net reduction of the small void fraction; ii) the cut-off area variation is maximum for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$ and decreases down to negative values for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ and large interaction asymmetry (low $\ensuremath{\alpha_{\scriptscriptstyle BP}}$), confirming that the largest relative variation of the cut-off area, when APs interact preferentially with one species of particles, occurs for intermediate values of $\ensuremath{\alpha_{\scriptscriptstyle AB}}$. This, we stress once more, is due to the fact that bare mixtures with intermediate $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ values are characterized the least number of large voids (small cut-off areas) and the addition of APs with preferential interaction with one of the two particle types (A here) gives rise to spatially localized (large) voids at the interface between the formed domains, since AP addition induces particle demixing as well as an increase of the cohesive energy in the system.
The entire set of best-fit parameters for the data shown in figures \ref{voids-1-1} and \ref{voids-1-X} are in Table \ref{paramP} (appendix \ref{appC}).
\begin{figure}[htbp]
\includegraphics[width=8.0cm]{gmax_ions-resub.pdf}
\caption{Ratio $g(s_{max})/g(s_{max})|_{bare}$ in function of $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ for different miscibility parameters $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ as indicated in the figure. Solid lines are a guide to the eye.}\label{gmaxions}
\end{figure}
In line with the large variation of the void distribution observed for miscible systems the local structure of mixtures is most affected by the AP addition for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$. Figure \ref{gmaxions} shows the height of the first peak of the total pair correlation function $g(s_{max})$ normalized by its value in the absence of APs $g(s_{max})|_{bare}$. For $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ this quantity changes the most for varying $\ensuremath{\alpha_{\scriptscriptstyle BP}}$ going from values larger than 1 (AP-induced condensation) for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1,0.8$ to values lower than 1 (AP-induced fluidization) for $\ensuremath{\alpha_{\scriptscriptstyle BP}}\leq 0.5$. In the other cases $0.05\leq\ensuremath{\alpha_{\scriptscriptstyle AB}}\leq 0.6$ the local structure is less affected by the AP adsorption, though we may note that in this case $g(s_{max})/g(s_{max})|_{bare}$ is always larger than one for $\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$, for which the minimum value is attained at $\ensuremath{\alpha_{\scriptscriptstyle AB}}=0.6$, where the void size distribution resulted less affected by AP addition (Figure \ref{voids-1-1}). Finally, we may note that the normalized peak height shows, albeit very weakly, a systematic non-monotonic behavior, suggesting a weak melting of the structure for intermediate values of $\ensuremath{\alpha_{\scriptscriptstyle BP}}$. More detailed simulations would be required to reach more quantitative conclusions on this aspect.
\section{Conclusions}\label{conclusion}
In this paper we have studied the mixing-demixing transition of symmetric mixtures characterized by varying miscibility and confined to move on a sphere by using a minimal quasi-2D model. By computing the total and the partial pair correlation functions, and by employing a geodesic mixing parameter $\Xi$, we have shown that: i) demixing on 3D-spheres is a structurally smooth process, in which fully mixed and Janus-like configurations are separated by states of spatially fluctuating domains appearing for intermediate miscibility; ii) void size distributions show exponential tails preceded by a power-law decay with large void formation being hampered by large compositional fluctuations, that instead favor the appearance of small ($\sim$one-particle sized) voids. Such a scenario does not vary remarkably in the range of system sizes investigated ($R_s=11.18\ensuremath{\sigma_{\scriptscriptstyle AA}},7.90\ensuremath{\sigma_{\scriptscriptstyle AA}},5.59\ensuremath{\sigma_{\scriptscriptstyle AA}}$). iii) Particle adsorption can give rise to both induced-mixing and induced-demixing, depending on whether mixtures are characterized by strongly fluctuating inter-domain boundaries or not. On the one hand, when coexisting domains and fluctuating interfaces characterize the fluids, uniformly adsorbed particles ($\ensuremath{\alpha_{\scriptscriptstyle BP}}=1$) enhance miscibility, while the latter is reduced for a large preferential affinity of APs for one of the two components of the mixtures ($\ensuremath{\alpha_{\scriptscriptstyle BP}}\ll 1$). On the other hand, for fully miscible ($\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$) or Janus-like mixtures ($\ensuremath{\alpha_{\scriptscriptstyle AB}}\ll 1$) AP addition mainly produces particle demixing, whose extent, quantified by the normalized geodesic parameter $\Xi^*$, increases progressively with increasing miscibility, reaching its apex for $\ensuremath{\alpha_{\scriptscriptstyle AB}}=1$ and $\ensuremath{\alpha_{\scriptscriptstyle BP}}\ll 1$.
Void size distributions are also affected by AP addition. A transition from exponentially-tailed to fat-tailed distributions, where one single large void dominates over the others, is observed for uniform particle adsorption, namely where AP-mixture cohesion energy is maximum. The extent of such a transition also depends on the AB miscibility: fat-tailed distributions are less pronounced by large domain fluctuations occurring for intermediate $\ensuremath{\alpha_{\scriptscriptstyle AB}}$ values, while for large enough AP-mixture interaction asymmetry, we recover exponentially-tailed distributions, with the largest tail widening and narrowing obtained respectively for an intermediate miscibility ($\ensuremath{\alpha_{\scriptscriptstyle AB}}$=0.6) and fully miscible fluids ($\ensuremath{\alpha_{\scriptscriptstyle AB}}$=1). Our model, albeit simple, allowed to discern under which mixing conditions a quasi 2D multicomponent fluid confined to move on a sphere is more susceptible to incur structural changes due to the interaction with an external agent. Further studies, based on the same model, will elucidate the role of mixture composition, temperature and AP concentration, \textcolor{myc}{while the effect of local curvature can be inspected by changing the confining manifold, passing from spheres to ellipsoids or tori.} We hope that our results can pave the way for more targeted experiments to investigate the role of complex molecules and particles on the mixing state of quasi-2D liquids.
\begin{acknowledgments}
I wish to thank Dr. Simona Sennato for inspiring discussions.
We acknowledge financial support from the Agence Nationale
de la Recherche (Grant ANR-20-CE06-0030-01; THELECTRA).
\end{acknowledgments}
\section*{Data Availability Statement}
The data that support the findings of this study are all available
within the article.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 3,333 |
\section{Introduction}
Numerous sectors of the global economy are positioned for rapid advancements in automation, due to recent progress in artificial intelligence and machine learning \citep{dirican2015impacts,makridakis2017forthcoming,huang2018artificial,wirtz2018brave,hatcher2018survey}. In fact, many experts speculate that AI technology will eventually outperform humans on a very wide variety of tasks \citep{muller2016future,brynjolfsson2017business,grace2018will}.
This potentiality means it is important to understand how automated decision-making systems can interact, especially in cases where their behavior might come as a surprise to their designers, such as in the stock market ``flash crash'' of 2010 \citep{madhavan2012exchange}.
In addition, opportunities abound in the structuring of novel human institutions both for using and for governing AI technology. There is already a great deal of academic interest in establishing policy and governance norms around the development and deployment of AI \citep{calo2017artificial,gasser2017layered,dafoe2018ai,dwivedi2019artificial,cihon2019standards}. \citet{dafoe2020open} specifically call for further attention to the risks and benefits of designing AI systems to cooperate with each other.
What body of game-theoretic research and intuitions should be informing the deliberation of policy-makers in the AI governance arena, or of AI researchers in the development and deployment of software-based agents? Numerous results from classical game theory, bargaining, and mechanism design will no doubt prove useful. However, as we shall see, novel possibilities arise in strategic interactions between algorithms, some of which are counterintuitive to humans, and some of which might shed new light on existing institutional behaviors or provide new routes to advantageous outcomes.
In this paper, we demonstrate a series of counterintuitive results showing that certain cooperative-seeming formal institution designs turn out to defect against each other---or conversely, turn out to cooperate when seeming like they would defect---in settings where each institution's true operating polices are visible to the other institution. We formalize each institution as an \emph{open-source agent}, i.e., a program whose \emph{source code} is readable by other programs. Source code provides a written specification of how a program will behave; it's what a software developer writes to create a new application, and can be seen as a formal model of the processes by which an institution will operate.
A natural starting point for analyzing open-source agents is the setting of \emph{program equilibria} introduced by \citet{tennenholtz2004program}. In this setting, given a game $G$ to be played by two agents (``programs'' in the terminology of \citeauthor{tennenholtz2004program}), we consider a higher-level game $G'$ being played by the designers of those agents. In $G'$, each designer chooses an agent to play in the game $G$, and each agent reads the other agent's source code (as a string of text) before choosing its action (or `strategy') for $G$. Mathematically, a similar formalism is employed by \citet{kalai2010commitment}, where again, each agent (`device response function' in their terminology) gets to read the other agent's source code (`commitment device') before choosing its action (`strategy'). We call this area \emph{open-source game theory}.
While the frameworks of Tennenholtz and Kalai et al.~differ on when exactly the designers are allowed to introduce randomization, in both settings the agents are open-source.
Tennenholtz mainly takes the perspective that the open-source condition will be necessary for modelling the economic interaction of real-world software systems via the Internet.
This perspective could become increasingly important as artificial intelligence progresses, or if so-called ``decentralized autonomous organizations'' (DAOs) ever become economically prominent \citep{jentzsch2016decentralized,chohan2017decentralized,dupont2017experiments}.
On the other hand, \citeauthor{kalai2010commitment} view their formalism mainly as a means of representing commitments between human institutions, such as in price competitions or legal contracts. In our view, both potential applications of the open-source agent concept---to artificial agents and to human institutions---are important. Another shortcoming of Tennenholtz' approach is that he invents a particular programming language in which to write agents, which is not immediately applicable to agents written in other programming languages or formalisms.
In this paper, we prove theorems about open-source agents \emph{that do not depend on which programming language they're written in}, using the formalism of mathematical proofs as applicable to arbitrary Turing machines. We argue that the consequences of the open-source condition are, in short, more significant than previously made apparent in the game theory literature. In particular, even the \emph{outcome} of a single game between fully specified open-source agents can be quite counterintuitive, as the theorems of this paper will demonstrate. It is possible, therefore, that the overlap between computer science and game theory, with a helping of logic, could progress into what von Neumann, E. Kalai, and Shoham would call ``the third stage'' of scientific development, where theory is able to make accurate predictions beyond what practitioners would intuitively expect \citep{shoham2008computer}.
Intriguingly, such results may be \emph{necessary} for historically earlier concepts from game theory, such as equilibria, to be applicable in reality: without these results, the designers of artificial agents cannot acquire an adequate understanding of those agents to be able to foresee even a single game outcome, so it would make little sense to model those designers as being in equilibrium with one another
For this reason, we call for the study of open-source games in their own right, irrespective of whether the designers of the agents in the games are in equilibrium. Thus, the study of open-source game theory as construed here is both broader and more fundamental than that of program equilibria. We begin this study by examining interactions between very simple agents who reason about each other using mathematical proofs and make decisions based on that reasoning (Section \ref{sec:setup}). We show how results in mathematical logic can be applied to resolve the outcomes of such games (Section \ref{sec:results}) and conjecture that perhaps these results may be reducible to a form more easily applied to human institutions (Section \ref{sec:intuition}).
We anticipate that the methods of this paper will be unfamiliar to many readers in game theory and economics. Facing this difficulty may be inevitable if we wish to understand the game theory of artificial agents or to learn from that theory in our modelling of human institutions. To encourage readers to think about this
topic through fresh eyes, we include simple workable examples alongside theorems and open problems, with the hope of inspiring more interdisciplinary work spanning game theory, computer science, and logic.
\subsection{Related work}\label{sec:rw}
As discussed in the introduction, \citet{tennenholtz2004program} and \citet{kalai2010commitment} have previously examined the interaction of open-source agents and characterized the equilibria between the designers of such agents in the form of so-called ``folk theorems.'' \citeauthor{tennenholtz2004program} calls the open-source agents ``programs'' and \citeauthor{kalai2010commitment} call them ``device response functions.'' \citeauthor{tennenholtz2004program}, as we sometimes do, allows the agents to randomize at runtime, and does not examine settings where the designers can randomize.
By contrast, the equilibrium concept of \citeauthor{kalai2010commitment} assumes the agents are deterministic at runtime whereas the designers are allowed to randomize in choosing their agents.
Kalai's equilibrium concept also allows the designers to choose whether their agents are open-source. In this paper, we focus away from designer equilibria and toward understanding the details of what kinds of agents can be built and how they interact.
\citet{tennenholtz2004program} also demonstrates a fairly trivial means of achieving a mutually cooperative equilibrium between agent designers: by writing an agent that checks if its opponent is exactly equal to itself, and cooperates only in that case. \citet{lavictoire2014program} remark that this cooperative criterion is too fragile for practical use and put forward the idea that formal logic, particularly L\"{o}b's theorem and more generally G\"{o}del\xspace-L\"{o}b\xspace provability logic, should play a role in agents thinking about each other before making decisions.
For the case in which the agents are given infinite time and space in which to do their thinking, \citet{barasz2014robust} exhibit a finite-time algorithm for ascertaining the outcomes of games between these (necessarily physically impossible) infinitely resourced agents, called \emph{modal agents} because of their use of modal logic.
Currently it remains unclear to the present authors whether existing results in logic are truly adequate to establish bounded versions of \emph{all} of the modal agents described by \citet{barasz2014robust} and \citet{lavictoire2014program}; it is, however, a highly promising line of investigation.
\citet{oesterheld2019robust} exhibits a mutual simulation approach to cooperation in an open-source setting and argues that this approach is more computationally efficient than formally verifying properties of the opponent's program using proofs, as we do in this paper. However, as Section \ref{sec:efficiency} will elaborate, mutual program verification can be made more efficient than mutual simulation, by designing the verification strategy to prioritize hypotheses with the potential to collapse certain loops in the metacognition of the agents.
\citet{halpern2018game} and \citet{capraro2019translucent} have shown how partial transparency, or ``translucency'', between players is more representative of real-world interactions between human institutions and creates more opportunity for pro-social outcomes. Their results assume a state of common knowledge in which the agents are known to be rational and counterfactually rational, which may be predictably unrealistic for present-day systems and institutions. However, the normative appeal of their results could be used to motivate the design of more translucent and counterfactually rational entities.
Loosely speaking, \emph{revision games} \citep{kamada2020revision} and \emph{mechanism games} \citep{yamashita2010mechanism,peters2013folk,peters2014competing} are settings in which some players make plans or commitments visible to others. Since plans and sometimes commitments can be written as programs, results from studying interactions between open-source agents might reveal interesting new strategies for revision games and mechanism games.
\section{Setup}\label{sec:setup}
In this paper, agents will make decisions in part by formally verifying certain properties of each other, i.e., by generating mathematical proofs about each other's source code. We'll call such agents \emph{formal verifier agents}.
For ease of exposition, pseudocode for the agents will be written in Python because it is a widely known programming language. However, we emphasize that unlike \citet{tennenholtz2004program}, we \textit{are not} inventing a programming language for representing agents. Rather, we analyze agents (and describe agents that analyze each other) using a proof-based approach, because proofs can be written that are independent of the particular programming language used to create the agents. The agents could even be written in different programming languages altogether, as long as they are Turing machines. Still, empirical or exploratory research in this area will probably be more efficient if the agents are written in a programming language more specifically designed for formal verifiability, such as HOL/ML \citep{nipkow2002isabelle,klein2009sel4} or Coq \citep{barras1997coq,chlipala2013certified}, but we emphasize that our results do not depend on this.
Below is a simple agent, called \Verb{CB} for ``CooperateBot'', who simply ignores its opponent's source code \Verb{opp_source} and returns \Verb{C}\xspace for ``cooperate''. ``DefectBot'' is the opposite, returning \Verb{D}\xspace for ``defect''. For any agent $A$, $A$\Verb{.source} will carry a valid copy of the agent's source code, like this:
\begin{minted}{python}
# "CooperateBot":
def CB(opp_source):
return C
CB.source = """
def CB(opp_source):
return C
"""
\end{minted}
\begin{minted}{python}
# "DefectBot":
def DB(opp_source):
return D
DB.source = """
def DB(opp_source):
return D
"""
\end{minted}
To save space when defining subsequent agents, we'll avoid writing out the full \Verb{agent.source} definition in this document, since it's always just a copy of the lines directly above it.
The outcome of a game is defined by providing each agent's source code as input to the other:
\begin{minted}{python}
# Game outcomes:
def outcome(agent1, agent2):
return (agent1(agent2.source),agent2(agent1.source))
\end{minted}
To get warmed up to thinking about these agents, and to check that our definitions are being conveyed as intended, we ask the reader to work through each of the short examples\xspace posed throughout this paper. Later examples\xspace will turn out to be open problems, but we'll start with easier ones:
\vspace{1ex}
\begin{exm} {\color{mintedgreen}[easy]}\hspace{1ex} What is \Verb{outcome(CB,DB)}? \answer{\Verb{CB(DB)} returns \Verb{C}\xspace because \Verb{CB} always returns \Verb{C}\xspace by definition; similarly \Verb{DB(CB)} returns \Verb{D}\xspace. Hence the outcome is the pair \Verb{(C,D)}.}
\end{exm}
\subsection{Proof-searching via proof-checking}\label{ssec:proofsearch}
In this paper, our goal is to look at agents who perform some kind of check on the opponent before deciding whether to cooperate or defect. For this, let's suppose the agents are equipped with the ability to read and write formal proofs about each other's source code using a formal proof language, such as Peano Arithmetic or an extension thereof. Peano Arithmetic and its extensions are useful because they allow proofs about programs \emph{written in arbitrary programming languages}, by representing arbitrary computable functions in a mathematical form \citep{cori2001mathematical}. In this way, we move past what might have seemed like a limitation of previous works on program equilibria, which invented and employed domain-specific programming languages for representing agents \citep{tennenholtz2004program, lavictoire2014program}.\footnote{The perception that program equilibrium results require agents to be written in domain-specific languages work was remarked by several earlier reviewers of the present draft. The issue of whether it's ``obvious'' that the programming language requirements can be broadly generalized seems to depend starkly on the reader. In any case, in light of the programming-language-independent results presented here and by \citet{critch2019parametric}, earlier works \citep{tennenholtz2004program, lavictoire2014program} can be argued to be more generalizable than they may have seemed at the time.} Specifically, we will assume the agents can invoke a function called \Verb{proof_checker} which, given a source code for an opponent agent (encoded as a string), can check whether a given argument (encoded as a string, referring to the opponent as ``opp'') is a valid proof of a given proposition (also encoded as a string) about the opponent:
\begin{minted}{python}
def proof_checker(opp_source, proof_string, hypothesis_string):
# This is the only function in this paper that won't be
# be written out explicitly. Our assumption is that it
# checks if proof_string encodes a logically valid
# proof that hypothesis_string is a true statement about
# the opponent defined by opp_source. The hypothesis_string
# can refer to the opponent as a function (not just its
# source) as 'opp'. If the hypothesis_string is a valid
# proof about that function, this function returns True;
# otherwise it returns False. For detailed assumptions on
# the proof system, see (Critch, 2019).
...
\end{minted}
Such proof-checking functionalities are available in programming languages such as HOL/ML \citep{nipkow2002isabelle,klein2009sel4} and Coq \citep{barras1997coq,chlipala2013certified} that are designed to enable formal verifiability, but in principle formal verifiers can be built for any programming language, including probabilistic programming languages. HOL in particular has been used to formally verify proofs involving metamathematics and modal logic \citep{paulson2015mechanised,benzmuller2016inconsistency}, which might make it particularly suited to the kinds of proofs in this paper. Some basic efficiency assumptions on the proof system are laid out in \ref{app:proofsystem}.
When trying to prove or disprove a given hypothesis about an opponent, how will our agents search through potential proofs? For simplicity, we assume a trivial search method: the agents will search through finite strings in alphabetical order, and check each string to see if it is a proof. Real-world formal verifiers use heuristics to more efficiently guide their search for proofs or disproofs of desired properties; we expect our results will apply in those settings as well. For concreteness, and to eliminate any ambiguity as to what is meant in our examples and results, we exhibit the code for proof searching below:
\begin{minted}{python}
# string_generator iterates lexicographically through all
# strings up to a given length; see appendix:
from appendix import string_generator
# proof_search checks each generated proof string to see
# if it encodes a valid proof of a given hypothesis:
def proof_search(length_bound, opp_source, hypothesis):
for proof in string_generator(length_bound):
if proof_checker(opp_source, proof, hypothesis):
return True
# otherwise, if no valid proof of hypothesis is found:
return False
\end{minted}
\subsection{Basic formal verifier agents}
A \Verb{proof_search} function like the one above can be used to design more interesting agents, who try for a while to formally verify properties about each other before deciding to cooperate or defect.
The following class of agents are called \Verb{CUPOD} for ``Cooperate Unless Proof of Defection'', defined by a function \Verb{CUPOD} that constructs an agent \Verb{CUPOD(k)} for each $k\ge 0$. Specifically, \Verb{CUPOD(k)} is a particular agent that behaves as follows: \Verb{CUPOD(k)(opp_source)} searches for a proof, in $k$ characters or less, that the opponent \Verb{opp} is going to defect against \Verb{CUPOD(k)}. If a proof of defection is found, \Verb{CUPOD(k)} defects; otherwise it ``gives the benefit of the doubt'' to its opponent and cooperates:
\newcommand{\Verb{CUPOD(k)}\xspace}{\Verb{CUPOD(k)}\xspace}
\begin{minted}{python}
# "Cooperate Unless Proof Of Defection" (CUPOD):
def CUPOD(k):
def CUPOD_k(opp_source):
if proof_search(k, opp_source, "opp(CUPOD_k.source) == D"):
return D
else:
return C
CUPOD_k.source = ... # the last 5 lines with k filled in
return CUPOD_k
\end{minted}
\newcommand{\Verb{DUPOC(k)}\xspace}{\Verb{DUPOC(k)}\xspace}
Next we have \Verb{DUPOC}, for ``Defect Unless Proof of Cooperation", the mirror image of \Verb{CUPOD}. \Verb{DUPOC(k)} will defect unless it finds affirmative proof, in \Verb{k} characters or less, that its opponent is going to cooperate:
\begin{minted}{python}
# "Defect Unless Proof Of Cooperation" (DUPOC):
def DUPOC(k):
def DUPOC_k(opp_source):
if proof_search(k, opp_source, "opp(DUPOC_k.source) == C"):
return C
else:
return D
DUPOC_k.source = ... # the last 5 lines with k filled in
return DUPOC_k
\end{minted}
\section{Results, Part I}\label{sec:results}
Our results are easiest to explain in the context of examples, and some of our open problems are easiest to explain in the context of results, so we deliver them all together.
\subsection{Basic properties of CUPOD and DUPOC}
Let us first examine some basic properties and examples of interactions with formal verifier agents, as a foundation for understanding the more difficult results.
\begin{exm} {\color{mintedblue}[medium]}\hspace{1ex}}%\color{orange!90!black What is \Verb{outcome(CUPOD(10), DB)}?
\answer{\Verb{CUPOD(10)(DB.source)} searches for a proof, using 10 characters or less, that \Verb{DB(CUPOD(10).source) == D}. While it is true that \Verb{DB(CUPOD(10).source) == D}, the proof of this fact will take more than 10 characters of text to write down, so \Verb{CUPOD(10)} won't find the proof and will fall back on its default action. Hence, the outcome is \Verb{(C,D)}\xspace.}
\end{exm}
\begin{exm} {\color{mintedblue}[medium]}\hspace{1ex}}%\color{orange!90!black What is \Verb{outcome(CUPOD(10^9), DB)}? Here \Verb{10^9} denotes $10^9$.
\answer{The fact that \Verb{DB(CUPOD(10^9).source) == D} is relatively easy to prove, via writing down a proof that \Verb{DB} always returns D; a hardworking undergrad could probably write out a fully rigorous proof by hand. The length of the proof depends a bit on the specifics of the proof language we use to write down the proof, but for any reasonable proof language the proof shouldn't take more than a billion characters (around 200 thousand pages!). So, \Verb{CUPOD(10^9)(DB.source)} will find the proof and return D, yielding the outcome \Verb{(D,D)}\xspace.}
\end{exm}
These examples show the role of the length bound $k$. Next, let us observe the following interesting property of \Verb{CUPOD(k)}\xspace: that it never defects on an opponent unless that opponent ``deserves it'' it in a certain sense:
\begin{proposition}\label{prop:cupod:doesntexploit} \Verb{CUPOD(k)}\xspace never exploits its opponent. That is, for all opponents \Verb{opp} and all $k$, \Verb{outcome(CUPOD(k),opp)} is never \Verb{(D,C)}.
\end{proposition}
\begin{proof}
If \Verb{CUPOD(k)(opp.source)==D}, it must be because \Verb{CUPOD(k)} managed to prove that \Verb{opp(CUPOD(k).source)==D}. Under the assumption that the \Verb{proof_check} function employed by \Verb{CUPOD(k)} is sound, it must be that \Verb{opp(CUPOD(k).source)==D}, so the outcome cannot be \Verb{(D,C)}\xspace.
\end{proof}
Dually, we have the following:
\begin{proposition}\label{prop:dupoc:unexploitable} \Verb{DUPOC(k)}\xspace is never exploited by its opponent. That is, for all opponents \Verb{opp} and all $k$, \Verb{outcome(DUPOC(k),opp)} is never \Verb{(C,D)}.
\end{proposition}
\begin{proof} The proof is the same as for Proposition \ref{prop:cupod:doesntexploit}, with \Verb{C}\xspace and \Verb{D}\xspace switched.
\end{proof}
\subsection{CUPOD vs CUPOD: What happens?}
Now let us examine our first example interaction between two open-source agents who both who both employ formal verifiers:
\vspace{1ex}
\begin{exm}\label{ex:cupod} {\color{mintedred}[difficult]}\hspace{1ex} What is \Verb{outcome(CUPOD(k), CUPOD(k))} when we set $k=10^{12}$?
\end{exm}
We respectfully urge the reader to work through the earlier examples\xspace before attending seriously to Example\xspace \ref{ex:cupod}, to understand how the proof length bound can affect the answer. These nuances represent a key feature of bounded rationality: when an agent thinks for a while about a hypothesis and reaches no conclusion about it, it still takes an action, if only a ``null'' or ``further delay'' action.
The next step is to notice what exactly \Verb{CUPOD(k)(CUPOD(k).source)} is seeking to prove and what it will do based on that proof. Specifically, \Verb{CUPOD(k)(CUPOD(k).source)} is searching for a proof in $k$ characters or less that \Verb{CUPOD(k)(CUPOD(k).source) == D}, and if it finds such a proof, it will return \Verb{D}\xspace. Thus, we face a kind of circular dependency: the only way \Verb{CUPOD(k)(CUPOD(k).source)} will return \Verb{D}\xspace is if it \emph{first} finds a proof in fewer than $k$ characters that \Verb{CUPOD(k)(CUPOD(k).source)} will return \Verb{D}\xspace!
\textbf{Common approaches to resolving circularity.} How does this circular thinking in the \Verb{CUPOD(k)}\xspace vs \Verb{CUPOD(k)}\xspace interaction resolve? Questions of this sort are key to any situation where two agents reasoning about each other interact, as each agent is analyzing the other agent analyzing itself analyzing the other agent [...]. Below are some common approaches to resolving how this circularity plays out for the \Verb{CUPOD(k)}\xspace{}s.
Approach 1 is to look for some kind of reduction to smaller values of $k$, as one might do when studying an iterated game. But this game is not iterated; it's a one-shot interaction. \Verb{CUPOD(k)(CUPOD(k).source)} will base its cooperation or defection on whether it proves \Verb{CUPOD(k)(CUPOD(k).source) == D}, not on the behavior of any \Verb{CUPOD(j)} for any smaller $j<k$. This inability to reduce to smaller $k$ values might suggest the problem is in some sense intractable. However, from the outside looking in, if the problem is so intractable that no short proof can answer it, then the result will have to be \Verb{C}\xspace, because that's what happens when no shorter-than-k proof of \Verb{D}\xspace can be found.
Approach 2 is to wonder if both C and D are possible answers. One can imagine the answer being \Verb{C}\xspace, so the algorithm finds a proof of D and therefore returns \Verb{C}\xspace, or the answer being D, so algorithm finds no proof of D and therefore returns \Verb{C}\xspace. However, the programs involved here are deterministic, and have a bounded runtime! They must halt and return something. So what do they return, \Verb{C}\xspace or \Verb{D}\xspace? Again, if one cannot write down a shorter-than-$k$ proof of either answer, the answer must be \Verb{C}\xspace.
Approach 3 is to envision the circularity unrolling into a kind of stack overflow: for defection to occur, \Verb{CUPOD(k)(CUPOD(k).source)} must prove that \Verb{CUPOD(k)(CUPOD(k).source)} proves that \Verb{CUPOD(k)(CUPOD(k).source)} proves that\ldots. Such a proof would seem to be infinite in length, and thus would not fit within any finite length bound $k$. This way of thinking gives an intuitive reason for why the answer should be \Verb{C}\xspace: the proof search for defection will find nothing, hit the length bound $k$, and then \Verb{CUPOD(k)(CUPOD(k).source)} will return \Verb{C}\xspace:
\emph{No-proof conjecture}: \Verb{CUPOD(k)(CUPOD(k).source) == C}, because there exists no finite-length-proof that \Verb{CUPOD(k)(CUPOD(k).source) == D}.
\subsection{Self-play results}
The first surprise of this paper is that the \emph{no-proof conjecture} directly above is false. Because of a computationally bounded version of a theorem in logic called L\"{o}b's theorem \citep{critch2019parametric}, a fairly short proof that \Verb{CUPOD(k)(CUPOD(k).} \Verb{source) == D} in fact does exist, and as a result \Verb{CUPOD(k)(CUPOD(k).source)} finds the proof and defects because of it. In other words, each of Approaches 1-3 for resolving the circular dependency in the previous section is incorrect:
\begin{theorem}\label{thm:cupod} For $k$ large, \Verb{outcome(CUPOD(k),CUPOD(k)) == (D,D)}.
\end{theorem}
\vspace{1ex}
\noindent The proof of this theorem, and several others throughout this paper, will make use of the lemma below, which depends on the following notation:
\begin{notation}[$S$, $\vdash$, $\Box$, and $\succ$]{\ }
\begin{itemize}
\item $S$ stands for the formal proof system being used by the agents; see \ref{app:proofsystem} for more details about it.
\item $\proves{} xyz...$ means ``the statement `xyz...' can be proved using the proof system $S$.
\item $\bxof{k}{xyz...}$ means ``a natural number exists which, taken as a string, encodes a proof of $xyz...$, and that proof when written in the proof language of $S$ requires at most $k$ characters of text.''
\item $f(k) \succ \mathcal{O}(\lg{k})$ means there is some positive constant $c>0$ and some threshold $\hat k$ such that for all $k>\hat k$, $f(k)>c\lg{k}$.
\end{itemize}
\end{notation}
\newcommand{\hyperref[lem:pblt]{PBLT}\xspace}{\hyperref[lem:pblt]{PBLT}\xspace}
\begin{lemma}[\textbf{PBLT: Parametric Bounded L\"{o}b Theorem}]\label{lem:pblt}
Let $p[k]$ be a formula with a single unquantified variable $k$ in the proof language of the a proof system $S$, satisfying the conditions in \ref{app:proofsystem}. Suppose that $k_1\in\mathbb{N}$ and $f:\mathbb{N} \to \mathbb{N}$ is an increasing computable function satisfying $f(k) \succ \mathcal{O}(\lg{k})$, and $S$ can verify that the formula $p[k]$ is ``potentially self-fulfilling for large $k$'' in the sense that
\[\proves{} \Forall{k>k_1}{\bxof{f(k)}{p[k]} \to p[k]}.\\
\]
Then there is some threshold $k_2 \in \mathbb{N}$ such that
\[
\proves{} \Forall{k>k_2}{p[k]}.
\]
\end{lemma}
\begin{proof}[Proof of Lemma \ref{lem:pblt}] This is a special case of \citet[Theorem 4.2]{critch2019parametric} where the proof expansion function $e(k)$ is in $\mathcal{O}(k)$. Specifically, in this paper we have assumed (see \ref{app:proofsystem}) that a proof can be expanded and checked in time linear in the length of the proof, i.e., $e(k)=e^*\cdot k$ for some constant $e^*$. This assumption makes the condition $f(k) \succ \mathcal{O}(\lg{k})$ sufficient to apply \citet[Theorem 4.2]{critch2019parametric}, as described by \citet[Section 4.2]{critch2019parametric}.
\end{proof}
\begin{proof}[Proof of Theorem \ref{thm:cupod}] This follows directly from \hyperref[lem:pblt]{PBLT}\xspace, via the substitutions \\
$p[k]$=\Verb{(CUPOD(k)(CUPOD(k).source) == D)}, $f(k) = k$, and $k_1=0$.
\end{proof}
On the flip side of Theorem \ref{thm:cupod}, we also have the following symmetric result:
\begin{theorem}\label{thm:dupoc} For $k$ large, \Verb{outcome(DUPOC(k),DUPOC(k)) == (C,C)}.
\end{theorem}
\begin{proof} This follows directly from \hyperref[lem:pblt]{PBLT}\xspace, via the substitutions \\
$p[k]=$\Verb{((DUPOC(k)(DUPOC(k).source) == C)}, $f(k) = k$, and $k_1=0$.
\end{proof}
This theorem may be equally surprising to Theorem \ref{thm:cupod}: most computer science graduate students guess that the answer is \Verb{D} when asked to predict the value of
\Verb{DUPOC(k)(DUPOC(k).source)}, even when given a few minutes to reflect and discuss with each other.\footnotemark{} These guesses are almost always on the basis of one of the three misleading thinking approaches in the previous section, most commonly Approach 3, which expects the proof search to fail for stack-overflow-like reasons.
\footnotetext{Across several presentations to a total of around 100 computer science graduate students and faculty, when the audience is given around 5 minutes to discuss in small groups, around 95\% of attendees conjecture that the proof search would run out and the program would return \Verb{D}.}
\subsection{Intuition behind the proofs of Theorems \ref{thm:cupod} and \ref{thm:dupoc}}\label{sec:intuition}
Exactly what mechanism allows \Verb{DUPOC(k)}\xspace to avoid these circularity and stack overflow problems?
A key feature of the proof of L\"{o}b's theorem, and \hyperref[lem:pblt]{PBLT}\xspace which underlies Theorems \ref{thm:cupod} and \ref{thm:dupoc}, is the ability to a construct a statement that in some sense refers to itself. This self-reference ability allows the proof to avoid the stack overflow problem one might otherwise expect. In broad brushstrokes, the proof of \hyperref[lem:pblt]{PBLT}\xspace follows a similar structure to the classical modal proof of L\"{o}b's theorem \citep{daryl2011modal}, which can be summarized in words for the case of Theorem \ref{thm:dupoc} as follows:
\begin{enumerate}
\item We construct a sentence $\Psi$ that says ``If this sentence is verified, then the agents will cooperate,'' using a theorem in logic called the modal fixed point theorem.
\item We show that if $\Psi$ can be verified by the agents, then mutual cooperation can also be verified by the agents, without using any facts about the agents' strategies other than their ability to find proofs of a certain length.
\item We use the fact that verifying mutual cooperation causes the agents to cooperate, to show that $\Psi$ is true.
\item Finally, we use the above proof of $\Psi$ to construct a formal verification of $\Psi$, which implies (by $\Psi$!) that cooperation occurs.
\end{enumerate}
This explanation, and the underlying mathematical proof, may be somewhat intuitively unsatisfying, because the meaning of the sentence $\Psi$ is somewhat abstract and difficult to relate directly to the agents. Nonetheless, the result is true. Moreover, we conjecture that a more illuminating proof may be possible:
\begin{definition} Let $S$ be the formal (proof) system used by \Verb{proof_checker}. $\vdash X$ means ``the proof system $S$ can prove $X$'', and $\Box X$ means ``a natural number exists which encodes (via a G\"{o}del encoding) a proof of $X$ within the proof language and rules of $S$.''.
\end{definition}
\begin{problem}\label{prob:lob}
L\"{o}b's theorem states that $\vdash(\Box C \to C)$ implies $\vdash(C)$. We conjecture that L\"{o}b's Theorem can be proven without the use of the modal fixed point $\Psi \leftrightarrow (\Box\Psi \to C)$, by constructing an entire proof that refers to itself, according to the following intuitive template:
\begin{enumerate}
\item This proof is a proof of $C$.
\item Therefore $\Box C$.
\item By assumption, $\Box C \to C$.
\item Therefore, by (2) and (3), $C$.
\end{enumerate}
Is such a proof possible? If not, why not?
\end{problem}
Such a proof would be suggestive of the following argument for one-shot cooperation between institutions, assuming each institution is DUPOC-like, in that it has already adopted internal policies, culture and personnel that will make it cooperate if it knows the other institution is going to cooperate:
\newpage
\begin{mdframed}
\vspace{1ex}
\noindent \underline{Cooperative affidavit for DUPOC-like institutions:}
\vspace{1ex}\noindent Institutions A and B have each recently undergone structural developments to prepare for cooperating with each other. Moreover, representatives from each institution have thoroughly inspected the other institution's policies, culture, and personnel, and produced the attached inspection records with our findings, effectively rendering A and B ``open-source'' to one another. These records show a readiness to cooperate from both institutions. Moreover, the records are sufficient supporting evidence for the following argument:
\begin{enumerate}
\item This signed document and the attached records constitute a self-evident (and self-fulfilling) prediction that Institutions A and B are going to cooperate.
\item Members of Institutions A and B can all read and understand this document and attached records, and can therefore tell that the other institution is going to cooperate.
\item Institution A's internal policies and culture are such that, upon concluding that Institution B is going to cooperate, Institution A will cooperate. The same is true of Institution B's policies and culture with regards to Institution A.
\item Therefore, by (2) and (3), the Institutions A and B are going to cooperate.
\end{enumerate}
\end{mdframed}
Points (1)-(4) of this ``cooperative affidavit'' are manifestly a kind of circular argument. However, the lesson of \hyperref[lem:pblt]{PBLT}\xspace is that certain kinds of circular arguments about bounded reasoners can be logically valid. In this case, most of the ``work'' toward achieving cooperation is carried out in each institution's adoption of DUPOC-like internal culture and policies (``we cooperate once we know they're going to cooperate''), and in the furnishing of mutual inspection records adequate to create common knowledge of that fact. Once that much is done, the validation of the circular argument for cooperation becomes both logically feasible and sufficient to trigger cooperation.
It is also interesting to note that the above ``cooperative affidavit'' is not a contract; it is merely a signed statement of fact made valid by each company's DUPOC-like internal policies and culture. As such, the document would add no mechanism of enforcement to ensure cooperation; it would simply trigger each institution's internal policies and culture to take effect in a cooperative manner, assuming those policies and culture are sufficiently DUPOC-like. In Section \ref{sec:prophecies} we will discuss this prospect further in the context of existing literature spanning social psychology, economics, and education.
Finally, we remark that a similar phenomenon could result in CUPOD-like institutions turning out to defect against each other. In other words, when two institutions are cooperating primarily on the basis of failing to understand each other, but stand ready to defect if they gain enough information about the counterparty to confidently predict defection, then a self-fulfilling prophecy of defection can arise as soon as the institutions believe they have become sufficiently ``open-source''.
Thus, CUPOD-like institutions could turn out to defect, and DUPOC-like institutions can turn out to cooperate, as a result of self-fulfilling prophecies analogous to Theorems \ref{thm:cupod} and \ref{thm:dupoc}. This suggests that institutions who are going to (intentionally or inadvertently) reveal their inner workings should consider first shifting from CUPOD-like policies and culture to DUPOC-like policies and culture.
\subsection{Further properties of \Verb{DUPOC(k)}\xspace}
Another counterintuitive observation is that \Verb{CUPOD(k)}\xspace seems ``nicer'' than \Verb{DUPOC(k)}\xspace, since by Propositions \ref{prop:cupod:doesntexploit} and \ref{prop:dupoc:unexploitable}, \Verb{CUPOD(k)}\xspace never exploits its opponent, while \Verb{DUPOC(k)}\xspace is more ``defensive'' in that it never allows itself to be exploited. This observation has given many readers the intuition that \Verb{CUPOD(k)}\xspace would have an easier time achieving mutual cooperation than \Verb{DUPOC(k)}\xspace, but by Theorems \ref{thm:cupod} and \ref{thm:dupoc}, the opposite turns out to be true. In fact, the agents \Verb{DUPOC(k)} for large values of $k$ --- henceforth ``DUPOCs'' --- have some very interesting and desirable game-theoretic properties:
\newcommand{\itemname}[1]{\item \textbf{(#1)} }
\begin{enumerate}
\itemname{unexploitability} A DUPOC never cooperates with an opponent who is going to defect, i.e., it never receives the outcome \Verb{(C,D)}\xspace in a game; only \Verb{(D,D)}\xspace, \Verb{(D,C)}\xspace, or \Verb{(C,C)}\xspace.
\itemname{broad cooperativity} \label{item:cc} DUPOCs achieve \Verb{(C,C)}\xspace not just with other DUPOCs, but with a very broad class of agents, as long as those agents follow a certain basic principle of ``G-fairness'' described in \citet{critch2019parametric}. Roughly speaking, if an opponent always cooperates with agents who exhibit legible (easy-to-verify) cooperation, then DUPOCs cooperate with that opponent.
\itemname{rewarding legible cooperation} In order to achieve \Verb{(C,C)}\xspace with a DUPOC, the opponent must not only cooperate, but \emph{legibly cooperate}, i.e., cooperate in a way that the DUPOC is able to verify with its bounded proof search. So, if there are opponents around that are made of ``spaghetti code'' that the DUPOCs are unable to efficiently analyze, those opponents won't be rewarded.
\itemname{rewarding \emph{rewarding} legible cooperation} Moreover, by item \ref{item:cc} above, the presence of DUPOCs in a population also rewards \emph{rewarding} legible cooperation, by cooperating with all agents who do it.
\end{enumerate}
Because of these points, one can imagine DUPOCs having a powerful effect on any population that contains them:
\vspace{1ex}
\begin{problem}\label{prob:modalpopulation} Determine conditions under which a population containing DUPOCs will evolve into a population where all agents reward legible cooperation, i.e., are \emph{G-fair} in the sense defined by \citet{critch2019parametric}.
\end{problem}
Note that a DUPOC does not cooperate with every agent who has some tendency to cooperate; in fact we have the following open problem:
\vspace{1ex}
\begin{problem}
\label{prob:dupoccupod} For large values of $k$, we conjecture that \\
\Verb{outcome(DUPOC(k),CUPOD(k))==(D,C)}. Is this the case?
\end{problem}
\begin{challenging}
A natural approach would be to argue by symmetry that the result must be \Verb{(C,D)}\xspace or \Verb{(D,C)}\xspace, and rule out \Verb{(C,D)}\xspace on the grounds that \Verb{DUPOC(k)}\xspace is unexploitable. However, the proposed symmetry argument isn't quite valid: \Verb{DUPOC(k)}\xspace is not a perfect mirror image of \Verb{CUPOD(k)}\xspace, because the letters \Verb{C}\xspace and \Verb{D}\xspace are not switched inside the \Verb{proof_checker} subroutine. It seems we need some way to reason about one agent's proof search running out, while the other agent is unable to prove that the first agent's proof search runs out.
\end{challenging}
\section{Generalizability of results}
\subsection{Nondeterministic interactions}
A common question to ask about these results is whether they depend on the `rigidity' of logic in some way. The answer is, roughly speaking, no. To see this, let us examine a nondeterministic version of DUPOC, using a "\Verb{Prob}" symbol to write proofs about the probability of random events. This agent tries to show that the opponent cooperates with probability at least $q$, and if successful, cooperates with probability $q$:
\newcommand{\Verb{PDUPOC(k)}\xspace}{\Verb{PDUPOC(k)}\xspace}
\begin{minted}{python}
# Probabilistic DUPOC (PDUPOC):
def PDUPOC(K,Q):
def PDUPOC_k(opp_source):
k = K; q = Q
if proof_search(k, opp_source,
"Prob('opp(DUPOC_k.source) == C' >= q")):
if random.uniform(0,1) <= q:
return C
else:
return D
PDUPOC_k.source = ... # the last 8 lines with K,Q filled in
return DUPOC_k
\end{minted}
\begin{theorem}\label{thm:pdupoc}
For large $k$ and $q\geq 0.5$, with probability at least $2q-1$, \\
\Verb{outcome(PDUPOC(k,q),PDUPOC(k,q))==(C,C)}.
In particular, for $q \approx 1$, the probability of mutual cooperation is also $\approx 1$.
\end{theorem}
\begin{proof} This follows directly from \hyperref[lem:pblt]{PBLT}\xspace, using the substitutions \\
$p[k]=$\Verb{(Prob('PDUPOC(k,q)(PDUPOC(k,q).source)==C') >= q)}, $f(k) = k$, and $k_1=0$. We use the fact that two events with probability $q$ must have a conjunction with probability at least $2q-1$. If the sources of randomness are known to be independent, the bound $2q-1$ can be increased to $q^2$.
\end{proof}
\subsection{More efficient \Verb{proof_search} methods}\label{sec:efficiency}
For simplicity of analysis, we assumed that our \Verb{proof_search} method searches alphabetically through arbitrary strings until it finds a proof, which is terribly inefficient, taking exponential time in the length of the proof. This problem has been noted as potentially prohibitive~\citep{oesterheld2019robust}.
However, much more efficient strategies are possible. As a trivial example, if \Verb{string_generator} is reconfigured to output, as its first string, the proof of Theorem \ref{thm:dupoc}, then both agents will terminate their searches in a tiny fraction of a second and cooperate immediately!
Indeed, the proof of \hyperref[lem:pblt]{PBLT}\xspace makes no use of the order in which potential proofs are examined. In reality, the details of the proofs employing \hyperref[lem:pblt]{PBLT}\xspace will need to vary based on the particularities of the implementations of each agent, so heuristic searches such as those used to complete proof goals in hybrid proof-and-programming languages such as HOL \citep{nipkow2002isabelle,klein2009sel4} and Coq \citep{barras1997coq,chlipala2013certified} will likely be crucial to automating these strategies in real-world systems. And of course, there is a trade-off between flexibility on implementation standards and speed of verification. This poses an interesting research project:
\begin{problem}\label{prob:holdupoc}
Implement \Verb{DUPOC} using heuristic proof search in HOL/ML or Coq. Can \Verb{outcome(DUPOC(k),DUPOC(k))} run and halt with mutual cooperation on a present-day retail computer? We conjecture the answer is yes. If so, how much can the implementations of the two agents be allowed to vary while cooperative halting is preserved?
\end{problem}
\section{Results, Part II: Strategies that verify conditionals}
\subsection{Rewarding conditional cooperation: CIMCIC}
Notice how a DUPOC's strategy is to prove that the opponent is going to cooperate \emph{unconditionally}. In other words, a DUPOC doesn't check ``If I cooperate, then the opponent cooperates''; rather, it checks the stronger statement ``The opponent cooperates''. The following is the ``conditional cooperation'' version of DUPOC:
\begin{minted}{python}
# "Cooperate If My Cooperation Implies Cooperation from
# the opponent" (CIMCIC):
def CIMCIC(k):
def CIMCIC_k(opp_source):
if proof_search(k, opp_source,
"(CIMCIC_k(opp.source)==C) => (opp(CIMCIC_k.source)==C)"):
return C
else:
return D
CIMCIC_k.source = ... # the last 6 lines with k filled in
return CIMCIC_k
\end{minted}
\begin{proposition} CIMCIC is unexploitable, i.e., \Verb{outcome(CIMCIC(k),opp)} is never \Verb{(C,D)} for any any opponent.
\end{proposition}
\begin{proof}
This proof works the same as that of Proposition \ref{prop:cupod:doesntexploit}. Specifically,
if \Verb{CIMCIC(k)(opp.source)==C}, it must be because \Verb{CIMCIC(k)} managed to prove \Verb{CIMCIC(k)}'s cooperative criterion, namely \\
\indent \Verb{(opp(CIMCIC(k).source)==C) => (opp(CIMCIC_k.source)==C)}.\\
Under the assumption that the \Verb{proof_check} function employed by \Verb{CIMCIC(k)} is sound, this implication must hold, implying \Verb{opp(CIMCIC(k).source)==C}, so the outcome cannot be \Verb{(C,D)}\xspace.
\end{proof}
\vspace{1ex}
\begin{exm} Evaluate the following (answered below):
\begin{enumerate}[label=\alph*)]
\item {\color{mintedblue}[medium]}\hspace{1ex}}%\color{orange!90!black \Verb{Outcome(CIMCIC(k),CIMCIC(k))}
\item {\color{mintedred}[difficult]}\hspace{1ex} \Verb{Outcome(DUPOC(k),CIMCIC(k))}
\end{enumerate}
\end{exm}
Since CIMCIC's cooperative criterion is \emph{conditional}, one can imagine two CIMCICs being in a kind of stand-off, with each one thinking ``I'll cooperate if I know it will imply you cooperate'', but never achieving cooperation because there are no provisions in its code to break the cycle of ``I'll do it if you will'' reasoning. However, the following theorem shows that, by \hyperref[lem:pblt]{PBLT}\xspace, no such provision is necessary:
\begin{theorem}\label{thm:cimcic} For large $k$,
\begin{enumerate}[label=\alph*)]
\item \Verb{outcome(CIMCIC(k),CIMCIC(k)) == (C,C)}
\item \Verb{outcome(DUPOC(k),CIMCIC(k)) == (C,C)}
\end{enumerate}
\end{theorem}
\begin{proof}[Proof of (a)] A short proof of the outcome \Verb{(C,C)}\xspace will lead, in a few additional lines comprising some number of characters $c$, to a proof of the material implication
\vspace{-1.1ex}
\begin{minted}{python}
"(CIMCIC_k(CIMCIC_k.source)==C)=>(CIMCIC_k(CIMCIC_k.source)==C)"
\end{minted}
\vspace{-1.1ex}
This in turn will cause the agents to cooperate, bringing about the outcome \Verb{(C,C)}\xspace. Thus, we have a ``self-fulfilling prophecy'' situation of the kind where \hyperref[lem:pblt]{PBLT}\xspace can be applied. Specifically, if we let $f(k)=\floor{k/2}$, $k_1=2c$, and $p[k]$ be the statement
\vspace{-1.1ex}
\begin{minted}{python}
"outcome(CIMCIC(k),CIMCIC(k))==(C,C)"
\end{minted}
\vspace{-1.1ex}
\noindent then the conditions of \hyperref[lem:pblt]{PBLT}\xspace are satisfied. Therefore, for some constant $k_2$, we have $\vdash \Forall{k>k_2}{p[k]}$.
\end{proof}
\begin{proof}[Proof of (b)] Again, a short proof of the outcome \Verb{(C,C)}\xspace will lead, in a few additional lines comprising some number of characters $c$, to a proof of CIMCICs' cooperation condition, namely
\vspace{-1.1ex}
\begin{minted}{python}
"(CIMCIC_k(DUPOC_k.source)==C)=>(DUPOC_k(CIMCIC_k.source)==C)"
\end{minted}
\vspace{-1.1ex}
as well as DUPOC's cooperation condition,
\vspace{-1.1ex}
\begin{minted}{python}
"CIMCIC(k)(DUPOC(k).source)==C"
\end{minted}
\vspace{-1.1ex}
Thus, letting $f(k)=\floor{k/2}$, $k_1=2c$, and $p[k]$ be the statement
\vspace{-1.1ex}
\begin{minted}{python}
"outcome(DUPOC(k),CIMCIC(k))==(C,C)"
\end{minted}
\vspace{-1.1ex}
satisfies the conditions of \hyperref[lem:pblt]{PBLT}\xspace. Therefore, for some constant $k_2$, we have $\vdash \Forall{k>k_2}{p[k]}$.
\end{proof}
\begin{problem}\label{prob:cupodcimcic}
What is \Verb{outcome(CUPOD(k),CIMCIC(k))}?
\end{problem}
\newcommand{\Verb{CIMCIC(k)}\xspace}{\Verb{CIMCIC(k)}\xspace}
\begin{challenging} Write $CC, CD, DC,$ and $DD$ as shorthand for \Verb{(C,C)}, \Verb{(C,D)}, \Verb{(D,C)}, and \Verb{(D,D)} respectively, and write $C*$ for ``$CC\textrm{ or }CD$'' and $*C$ for ``$CC\textrm{ or }DC$''. We know that the outcome $DC$ is impossible, because \Verb{CUPOD(k)}\xspace never exploits its opponent. However, the other possibilities are difficult to prove or rule out. If the outcome is $CC$, it means \Verb{CIMCIC(k)}\xspace manages to prove mutual cooperation, which is consistent with \Verb{CUPOD(k)}\xspace failing to prove defection. If the outcome is $DD$, then it means \Verb{CUPOD(k)}\xspace manages to prove that \Verb{CIMCIC(k)}\xspace defects, but somehow \Verb{CIMCIC(k)}\xspace fails to find a short proof \emph{of the fact that \Verb{CUPOD(k)}\xspace proves that \Verb{CIMCIC(k)}\xspace defects}. Otherwise \Verb{CIMCIC(k)}\xspace could prove the material conditional $*C \to C*$ with just a few more lines, which would cause it to cooperate, a contradiction. If the outcome is $CD$, it means both agents' proof searches run out. It's not immediately clear which of these outcomes will actually obtain.
\end{challenging}
\subsection{Preempting exploitation: DIMCID}
Another interesting strategy to consider is to preempt exploitation by defecting if the opponent would exploit you:
\begin{minted}{python}
# "Defect if My Cooperation Implies Defection from
# the opponent (DIMCID):
def DIMCID(k):
def DIMCID_k(opp_source):
if proof_search(k, opp_source,
"(DIMCID_k(opp.source)==C) => (opp(DIMCID_k.source)==D)"):
return D
else:
return C
DIMCID_k.source = ... # the last 6 lines with k filled in
return DIMCID_k
\end{minted}
\begin{exm} {\color{mintedgreen}[easy]}\hspace{1ex} Evaluate the following \answer{\Verb{(C,C)}\xspace and \Verb{(D,D)}\xspace, respectively.}:
\begin{enumerate}[label=\alph*)]
\item \Verb{outcome(DIMCID(k), CB)}
\item \Verb{outcome(DIMCID(k), DB)}
\end{enumerate}
\end{exm}
\vspace{1ex}
\begin{exm} {\color{mintedblue}[medium]}\hspace{1ex}}%\color{orange!90!black Evaluate the following (answered below):
\begin{enumerate}[label=\alph*)]
\item \Verb{outcome(DIMCID(k), DIMCID(k))}
\item \Verb{outcome(CUPOD(k), DIMCID(k))}
\end{enumerate}
\end{exm}
\vspace{1ex}
\begin{theorem}\label{thm:dimcid} For large $k$,
\begin{itemize}
\item \Verb{outcome(DIMCID(k), DIMCID(k)) == (D,D)}
\item \Verb{outcome(CUPOD(k), DIMCID(k)) == (D,D)}.
\end{itemize}
\end{theorem}
\begin{proof}[Proof of (a)] A short proof of the outcome \Verb{(D,D)}\xspace will lead, in a few additional lines comprising some number of characters $c$, to a proof of the material implication
\vspace{-1.1ex}
\begin{minted}{python}
"(DIMCID_k(DIMCID_k.source)==C)=>(DIMCID_k(DIMCID_k.source)==D)"
\end{minted}
\vspace{-1.1ex}
which in turn will cause the agents to defect, bringing about the outcome \Verb{(D,D)}\xspace. Thus, we have a ``self-fulfilling prophecy'' situation of the kind where \hyperref[lem:pblt]{PBLT}\xspace can be applied. Specifically, if we let $f(k)=\floor{k/2}$, $k_1=2c$, and $p[k]$ be the statement
\vspace{-1.1ex}
\begin{minted}{python}
"outcome(DIMCID(k),DIMCID(k))==(D,D)"
\end{minted}
\vspace{-1.1ex}
\noindent then the conditions of \hyperref[lem:pblt]{PBLT}\xspace are satisfied. Therefore, for some constant $k_2$, we have $\vdash \forall k>k_2, p[k]$.
\end{proof}
\begin{proof}[Proof of (b)] Again, a short proof of the outcome \Verb{(D,D)}\xspace will lead, in a few additional lines comprising some number of characters $c$, to a proof of DIMCID's defection condition, namely
\vspace{-1.1ex}
\begin{minted}{python}
"(DIMCID_k(CUPOD_k.source)==C)=>(CUPOD_k(DIMCID_k.source)==D)"
\end{minted}
\vspace{-1.1ex}
as well as CUPOD's defection condition,
\vspace{-1.1ex}
\begin{minted}{python}
"DIMCID(k)(CUPOD(k).source)==D"
\end{minted}
\vspace{-1.1ex}
Thus, letting $f(k)=\floor{k/2}$, $k_1=2c$, and $p[k]$ be the statement
\vspace{-1.1ex}
\begin{minted}{python}
"outcome(CUPOD(k),DIMCID(k))==(D,D)"
\end{minted}
\vspace{-1.1ex}
satisfies the conditions of \hyperref[lem:pblt]{PBLT}\xspace. Therefore, for some constant $k_2$, we have $\vdash \Forall{k>k_2}{p[k]}$.
\end{proof}
\begin{problem}\label{prob:dupocdimcid} What is \Verb{outcome(DUPOC(k),DIMCID(k))}?
\end{problem}
\begin{challenging} This problem is very similar to Open Problem \ref{prob:cupodcimcic}: one of the agent's proof searches might fail while the other succeeds. If so, which way does it go? If both proof searches fail, why is that?
\end{challenging}
\section{Discussion}
\subsection{Applicability to non-logical reasoning processes}
Must the agents in these theorems form their beliefs using logical proofs, or would the same results hold true if they employed other belief-forming procedures, such as machine learning? What abstract properties of these proofs and proof systems are key to applying \hyperref[lem:pblt]{PBLT}\xspace in Theorems \ref{thm:cupod}, \ref{thm:dupoc}, \ref{thm:pdupoc}, \ref{thm:cimcic}, and \ref{thm:dimcid}?
The following features of the agents' reasoning capabilities are key to the proof of \hyperref[lem:pblt]{PBLT}\xspace, and hence to the results of this paper:
\begin{enumerate}
\item The proof language for representing the agents' beliefs needs to be expressive enough to represent numbers and computable functions and to introduce and expand abbreviations.
\item There must be a process the agents can follow for deriving beliefs from other beliefs (writing a proof is such a process).
\item The proof language must also be able to represent belief derivations (e.g., proofs) as objects in some way, and refer to the cost (e.g., in time or space) of producing various belief derivations.
\end{enumerate}
Agents lacking some of these reasoning capabilities should not be expected to behave in accordance with the theorems of this paper. However, these capabilities are all features of \emph{general intelligence}, in the sense that a reasoning process that lacks these capabilities can be made more deductively powerful by adding them. Thus, there is some reason to expect that agents designed to exhibit highly general reasoning capabilities may be amenable to these results. The task of formalizing highly general definitions of ``beliefs'' and ``belief derivations'' could itself make for interesting follow-up work.
\subsection{Further open problems}
\newcommand{\problemarea}[1]{\textbf{In #1:}}
As mentioned earlier in Section \ref{sec:rw}, \citet{barasz2014robust} exhibit a finite-time algorithm written in Haskell for settling interactions between agents that write proofs about each other, which unfortunately assumes the agents themselves have unbounded (infinite) computation with which to conduct their proof searches.
The Haskell algorithm---based on Kripke semantics for G\"{o}del\xspace--L\"{o}b\xspace provability logic \citep[Chapter 4]{boolos1995logic}---is sound for settling these unbounded cases using abstract mathematics and is efficient enough to run tournaments between dozens of their abstractly specified agents, which they call \emph{modal agents}. The results of \citet{critch2019parametric} go some of the way toward generalizing their results for bounded versions of very simple modal agent interactions, but not for all interactions, such as those in Open Problems \ref{prob:dupoccupod}, \ref{prob:cupodcimcic}, and \ref{prob:dupocdimcid}.
Thus, it would be quite interesting to work out the details of how and when theorems in the logic used by \citet{barasz2014robust} (G\"{o}del\xspace--L\"{o}b\xspace provability logic) have analogues with bounded proof lengths, and if they could really be applied to make resource-bounded (and hence physically realizable) analogues of all the modal agents of \citet{barasz2014robust} and \citet{lavictoire2014program}. At this level of generality, it would be useful to also carry through those details to ascertain concrete proof lengths needed for any given game outcome, so their Haskell algorithm could be modified to return the value of $k$ needed for each proof search to find the requisite proofs:
\begin{problem}\label{prob:bgl} Generalize \hyperref[lem:pblt]{PBLT}\xspace to a bounded analogue of G\"{o}del\xspace--L\"{o}b\xspace that systematically tracks the proof lengths necessary or sufficient for each instance of the provability operator $\Box$.
\end{problem}
\begin{problem}\label{prob:haskellupgrade}
Apply the result of Open Problem \ref{prob:bgl} to improve the Haskell algorithm at \url{github.com/klao/provability}, so that it returns the proof length needed for each proof search conducted by each agent in a given open-source interaction.
\end{problem}
\citet{lavictoire2014program} exhibit a computationally unbounded agent called PrudentBot, which is similar to DUPOC except that it uses employs an additional proof search that allows it to defect against CooperateBot. Such agents are particularly interesting at a population scale because they have the potential to drive CooperateBots out of existence, which in turn would make it more difficult for DefectBot to survive. Hence we ask:
\vspace{1ex}
\begin{problem}\label{prob:prudentbot}
Does a computationally bounded version of PrudentBot \citep{lavictoire2014program} exist?
\end{problem}
If so, questions regarding population dynamics among CooperateBots, DefectBots, DUPOCs, and PrudentBots would be interesting to examine, especially if the game payoffs take into account the additional cost of proof-searching incurred by PrudentBot.
\newcommand{\Verb{E}\xspace}{\Verb{E}\xspace}
Finally, to begin generalizing this theory to games with more than two actions, consider next an extended Prisoners' Dilemma with a third option, \Verb{E}\xspace for ``encroachment'', that is even more tempting and harmful than defection:
\begin{game}{3}{3}
& $C$ & $D$ & $E$ \\
$C$ & $2,2$ & $0,3$ & $-2,4$ \\
$D$ & $3,0$ & $1,1$ & $-1,2$ \\
$E$ & $4,-2$ & $2,-1$ & $0,0$
\end{game}
\medskip
\newcommand{\Verb{EUPOD(k)}\xspace}{\Verb{EUPOD(k)}\xspace}
\noindent In such a setting, it is natural for an agent to first target mutual cooperation, and failing that, target mutual defection, and failing that, encroach. If the agent uses proof searches to ``target'' outcomes, this means it would first cooperate if a proof of \Verb{(C,C)}\xspace can be found, and failing that, defect if a proof of \Verb{(D,D)}\xspace can be found, and failing that, encroach. Let's call this vaguely described agent concept ``CDEBot.'' An interesting opponent for CDEBot is \Verb{EUPOD(k)}\xspace, for ``Encroach Unless Proof of Defection,'' which is just like \Verb{DUPOC(k)}\xspace with with \Verb{D}\xspace and \Verb{E}\xspace respectively in place of \Verb{C}\xspace and \Verb{D}\xspace.
\begin{problem}\label{prob:cdebot}
Implement a version of CDEBot using bounded proof searches, ensuring that it achieves \Verb{(C,C)}\xspace with \Verb{DUPOC(k)}\xspace, and \Verb{(D,D)}\xspace with \Verb{EUPOD(k)}\xspace.
\end{problem}
\begin{challenging} CDEBot's proof search for \Verb{(D,D)}\xspace needs to be somehow predicated on the failure of the proof search for \Verb{(C,C)}\xspace by one or both of the agents, and it's not immediately clear how \hyperref[lem:pblt]{PBLT}\xspace can be applied in that setting.
\end{challenging}
\subsection{Applicability to humans and human institutions: modelling self-fulfilling prophecies}\label{sec:prophecies}
How and when might our framework be applicable to interactions between individual humans or human institutions who reason about themselves and each other?
One important and immediate observation is that the open-source condition provides a model under which certain \emph{self-fulfilling prophecies} will turn out to be true, by virtue of the single ``speech act'' of each agent's source code being revealed. Specifically, our main theorems (\ref{thm:cupod}, \ref{thm:dupoc},
\ref{thm:pdupoc},
\ref{thm:cimcic}, and
\ref{thm:dimcid}) each involve a kind of self-fulfilling prophecy: upon the agents verifying that a certain outcome is going to happen, they choose to make it happen, on the basis of the verification. For \Verb{DUPOC(k)}\xspace{}s, the prophecy is ``made'' once each agent has successfully written down a proof that they will cooperate, and it ``comes true'' in their reaction to that proof (deciding to cooperate).
Self-fulfilling prophecies are known to be an important phenomenon in the social sciences, as Milton \citet{friedman1977nobel} remarked in his Nobel Lecture:
\begin{quote}
``Do not the social sciences, in which scholars are analyzing the behavior of themselves and their fellow men, who are in turn observing and reacting to what the scholars say, require fundamentally different methods of investigation than the physical and biological sciences? Should they not be judged by different criteria? I have never myself accepted this view. [...] In both, there is no way to have a self-contained closed system or to avoid interaction between the observer and the observed. The G\"{o}del theorem in mathematics, the Heisenberg uncertainty principle in physics, the self-fulfilling or self-defeating prophecy in the social sciences all exemplify these limitations.''
\end{quote}
\noindent Indeed, as Friedman alludes, G\"{o}del\xspace's incompleteness theorems are special cases of L\"{o}b's theorem (itself a special case of \hyperref[lem:pblt]{PBLT}\xspace) where the self-fulfilling prophecy $p$ is a contradiction. L\"{o}b's theorem essentially says ``If a particular statement $p$ \emph{would be} self-fulfilling (i.e., $\Box(p) \to p$) then it \emph{does} self-fulfill ($\Box(p)$ follows, and then $p$ follows).'' The logician Raymond \citet{smullyan1986logicians} also noted, in ``Logicians who reason about themselves,'' that L\"{o}b's theorem ``reflects itself in a variety of beliefs which of their own nature are necessarily self-fulfilling.'' He tells a story of a cure that works only if the recipient believes in it, and argues by L\"{o}b's theorem that the cure is therefore bound to work. \hyperref[lem:pblt]{PBLT}\xspace shows that this kind of argument can really be applied in the minds of bounded reasoners.
In which areas of social science do self-fulfilling prophecies play an important role? Each of the following disciplines have included analyses of the conditions and mechanisms by which self-fulfilling prophecies can arise and affect the world, and might therefore present interesting domains in which to apply open-source agent models and \hyperref[lem:pblt]{PBLT}\xspace more specifically:
\begin{itemize}
\item In social psychology, \citet{merton1948self,kelley1970social,word1974nonverbal,snyder1977social,darley1980expectancy}, and at least a dozen other authors have examined conditions and mechanisms whereby believing in things can cause them to become true, such as stereotypes or interracial conflicts.
\item In education research, \citet{rist1970student,wilkins1976concept,brophy1983research,wineburg1987self,jussim1996social} and \citet{jussim2005teacher} have examined how and when teachers' positive or negative expectations of students can cause those expectations to be fulfilled by students.
\item In the study of management and leadership, \citet{ferraro2005economics} have examined how theories of economics and social science can cause their own validity, and \citet{eden1992leadership,eden1984self} has examined how leaders' expectations can cause organization members to conform to those expectations.
\item In political and international relations theory, \citet{zulaika2003self,bottici2006rethinking,verhoeven2009self,houghton2009role,frisell2009theory,ahler2014self} and \citet{swiketek2017yemen} have examined how peace and conflict can both arise as self-fulfilling prophecies.
\end{itemize}
In economics specifically, there has been considerable work examining the potential causes and effects of self-fulfilling prophecies. Typically these studies employ dynamical systems models of repeated interactions between players, or equilibrium assumptions that do not specify how exactly the players manage to know each other's strategy. By contrast, the open-source condition makes it clear and concrete how each player's strategy could be known to the others, and the theorems of this paper show that open-source agents do not require repeated interaction for self-fulfilling prophecies to manifest. Being open-source can also be seen as a limiting case of an agent being nontrivially but imperfectly understood by its opponents. Thus, in real-world institutions or software systems that are only imperfectly visible to each other, one-shot, self-fulfilling prophecies might still arise from merely probabilistic mutual knowledge, as in Theorem \ref{thm:pdupoc}.
When do economic self-fulfilling prophecies occur in the real world? Numerous authors have argued that currency crises can arise from self-fulfilling prophecies \citep{obstfeld1996models,morris1998unique,metz2002private,hellwig2006self,guimaraes2007risk}. Relatedly,
\citet{obstfeld1986rational} showed conditions under which balance-of-payments crises may be ``purely self-fulfilling events rather than the inevitable result of unsustainable macroeconomic policies.''
\citet{azariadis1981self} exhibits a model of intergenerational production and consumption in which self-fulfilling prophecies constitute between one third and one half of the possible pricing equilibria.
Others have argued that self-fulfilling prophecies can give rise to
debt crises \citep{cole2000self},
credit market freezes \citep{bebchuk2011self}, and liquidity dry-ups \citep{malherbe2014self}. On the other hand, \citet{krugman1996currency} argues that ``the actual currency experience of the 1990s does not make as strong a case for self-fulfilling crises as has been argued by some researchers. In general, it will be very difficult to distinguish between crises that need not have happened and those that were made inevitable by concerns about future viability that seemed reasonable at the time.''
In our view, these observations and debates are an invitation to develop a new and more rigorous formalism for the study of bounded agents who reason about themselves and each other. As can be seen from our main theorems, such a formalism can be used to construct and model self-fulfilling prophecies using \hyperref[lem:pblt]{PBLT}\xspace, even in single-shot games with no repetition of interactions between players. Going further, understanding self-fulling prophecies should not be the extent of our ambition with open-source game theory. For instance, we should also address self-defeating prophecies, as alluded to by \citet{friedman1977nobel}, or prophecies that plausibly-but-don't-quite self-fulfill, as noted by \citet{krugman1996currency}.
\subsection{Comparison to Nash Equilibria}
In this section we argue that, in real-world single-shot games, the conditions under which a genuine Nash (or correlated) equilibrium could arise are often conditions under which an open-source game (or commitment game) could be played instead, enabling more desirable equilibria. In short, the reason is that the Nash equilibrium concept already assumes a certain degree of mutual transparency, and often that transparency could instead be used to reveal programs/plans/commitments.
For a more detailed argument, let us first reflect on the following important observation due to Moulin regarding Nash equilibria:
\begin{quote}
``Nash equilibria are self-fulfilling prophecies. If every player guesses what strategies are chosen by the others, this guess is consistent with selfish maximization of utilities if and only if all players bet on the same Nash equilibrium. Here, we need an invisible mediator or some theory that pronounces x the rational strategic choice for Player i.''
\citep[Ch. 5]{moulin1986game}
\end{quote}
\noindent How does this ``pronouncement'' play out in the minds of the players? Suppose in a game with two real-world players, before any discussion about what equilibrium they should play, Player $i$'s subjective probability distribution over Player $j$'s action is denoted $a^i_j(0)$.
\newcommand{\textrm{BR}}{\textrm{BR}}
Let $BR_i$ denote player $i$'s best response function, so $b_i(0):=\textrm{BR}_i(a^i_{-i}(0))$ is the action distribution Player $i$ will use if no discussion happens and no prescribed equilibrium is ``pronounced.'' Then, suppose a discussion or mediation occurs between the players in which a particular Nash equilibrium $x=(x_1,x_2)$ is prescribed to be played instead of the defaults $(b_1(0),b_2(0))$ that they would have played otherwise. How can each player $i$ become convinced that the other is really going to play $x_{-i}$, before their action is taken? There are (at least) two perspectives commonly taken on this question.
The first perspective is simply to say that each player has ``no reason to deviate'' from the prescription: ``I am not forced to follow our agreement, but as long as you guys are faithful to it, I have no incentive to betray'' \citep[Introduction]{moulin1986game}. But this does not answer the question: what reason do the players have to believe the prescription will be carried out to begin with?
Player 1 can think, ``If Player 2 is thinking that I (Player 1) will play $x_1$, then Player 2 will play $x_2$''... but how would Player 1 know that Player 2 knows that Player 1 is going to do that?
Indeed, Player 1 might reason, ``My posterior says Player $2$ \emph{might} play the prescribed distribution $x_2$, but they might instead do some other thing, such as a `safe' action, or sampling from some prior distribution over actions. Reflecting on this, my posterior over Player 2's action has updated to a new value, $a^i_j(1)$, and my best response is $b_1(1):=\textrm{BR}_1(a^1_{2}(1))$.'' Player 2 can update similarly, yielding sequences $a^i_j(n)$ and $b_i(n)$ as the number of rounds $n$ of discussion and reflection grows. This process is different from a simple best-response iteration, because there is also a discussion component giving rise to each $a^i_j(n)$. Is there any reason to think it will converge on a fixed point? And if so, does it converge on the ``pronounced'' equilibrium $(x_1,x_2)$, or some other point $(x'_1,x'_2)$?
These questions inspire a second perspective for applying the Nash equilibrium concept, which is to simply \emph{define} $(x_1,x_2)$ to be whatever the players converge to deciding and believing about each other through this discussion process, \emph{assuming it converges}. In this view, if a mediator or compelling bargaining theory is available, perhaps it can help to ``steer'' the conversation toward a particular desirable equilibrium, rather than merely stating it once and assuming conformity.
In both perspectives, the players \emph{end up} in a state of mutual understanding, where each is satisfied (at equilibrium) with her model of the other. Indeed:
\begin{quote}
``Some kind of communication among the players is necessary to endow them with mutually consistent beliefs, and/or allow mutual observation of past outcomes.''
\citep[Ch. 5]{moulin1986game}
\end{quote}
\noindent In other words, by the end of the discussion, the players no longer have full privacy: they understand each other to some extent. Why not use that understanding to make and reveal commitments to perform better than the Nash equilibrium in games like the Prisoner's Dilemma?
That is to say, why don't the players simply make internal structural changes in the form of unexploitable cooperative commitments ({\`a} la Theorem \ref{thm:dupoc}), and then reveal those changes through the same process that would have allowed them to understand each other in the Nash case?
If the players are either institutions or software systems capable of self-repair, such self-imposed changes are both possible and potentially legible. If we suppose they make themselves fully transparent, a question still arises to whether their discussion of plans will converge, but as we've seen that question can sometimes be resolved using \hyperref[lem:pblt]{PBLT}\xspace. Specifically, when there appears to be an infinite regress of social metacognition, sometimes that regress can be collapsed into a single self-reflective observation that the equilibrium is going to be observed, along the lines of Theorem \ref{thm:dupoc}.
In summary, the kinds of mutual transparency adequate to allow Nash equilibria in one-shot games might often allow the players to reveal enough of their internal structure or ``source codes'' to enable open-source equilibria or commitment game equilibria to arise instead.
\subsection{Conclusion}
Our most important conclusion is that fundamental questions regarding the interaction of open-source agents should not be left unaddressed. As the global economy becomes increasingly automated and artificial agents become increasingly capable, more research is needed to prepare for novel possibilities that the open-source condition might enable. Some results in this area might also be applicable to self-fulfilling and self-defeating prophecies in the beliefs and policies of human institutions.
Theorems \ref{thm:cupod}, \ref{thm:dupoc},
\ref{thm:pdupoc},
\ref{thm:cimcic}, and
\ref{thm:dimcid} each illustrate how one-shot interactions between open-source agents can sometimes ``short-circuit'' unbounded recursions of metacognition,
leading to somewhat counterintuitive instances of both mutual cooperation and mutual defection. Theorem \ref{thm:pdupoc} in particular illustrates how similar results hold for probabilistic open-source agents.
The properties of the \Verb{DUPOC(k)}\xspace agents, and correspondingly their probabilistic variants \Verb{PDUPOC(k)}\xspace, are particularly interesting: \Verb{DUPOC(k)}\xspace is unexploitable, and for large $k$, \Verb{DUPOC(k)}\xspace and \Verb{PDUPOC(k)}\xspace reward both cooperation and legibility in their opponents; they even reward the principle of \emph{rewarding} legible cooperation.
If Open Problem \ref{prob:lob} is answered affirmatively, it might shed light on ways to implement DUPOC-like human institutions. If Open Problem \ref{prob:holdupoc} is answered affirmatively, it might allow a practical implementation standard for DUPOC-like automated systems. And, many scenarios that would enable enough mutual understanding to achieve a Nash equilibrium in one round might also allow enough mutual understanding to make and reveal new source code or commitments, allowing better-than-Nash outcomes.
Further open problems need to be resolved before these one-shot open-source interactions can be thoroughly understood.
Certainly it would be satisfying to implement and investigate an efficient version of \Verb{DUPOC(k)}\xspace or \Verb{CUPOD(k)}\xspace using HOL/ML or Coq as in Open Problem
\ref{prob:holdupoc}, or to look at population dynamics among agents with known interaction outcomes as in Open Problem \ref{prob:modalpopulation}.
In Open Problems
\ref{prob:dupoccupod},
\ref{prob:cupodcimcic}, and
\ref{prob:dupocdimcid}, there seems to be no obvious self-fulfilling prophecy that can be proven using \hyperref[lem:pblt]{PBLT}\xspace.
For these cases we may need new techniques, or perhaps more general theoretical results such as those described in Open Problems
\ref{prob:lob},
\ref{prob:bgl}, and
\ref{prob:haskellupgrade}.
As for the successful design of additional resource-bounded proof-based agents, such as the PrudentBot and CDEBot described in Open Problems
\ref{prob:prudentbot} and \ref{prob:cdebot}, these designs might be easily achievable with currently available methods. Conversely, attempts at their design might unfold into needing or generating progress on the more general theoretical results.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 6,859 |
Contact the Office of Indian Services
OIS Sub navigation
For the Division of Human Services:
Office of Indian Services Division of Human Services Bureau of Indian Affairs 1849 C Street, N.W. MS-3645-MIB Washington, D.C. 20240
Telephone: (202) 513-7642 Fax: (202) 208-5113
For the Division of Self-Determination:
Office of Indian Services Division of Self-Determination Bureau of Indian Affairs 1849 C Street, N.W. MS-3645-MIB Washington, D.C. 20240
For the Division of Transporation:
Mailing Address (East): Office of Indian Services Division of Transportation Bureau of Indian Affairs 1849 C Street, N.W. MS-3645-MIB Washington, D.C. 20240
Telephone: (202) 513-7714 Telefax: (202) 208-4696
Mailing Address (West): Office of Indian Services Division of Transportation Bureau of Indian Affairs 1001 Indian School Road, N.W. Albuquerque, N.M. 87104
For the Division of Tribal Government:
Office of Indian Services Division of Tribal Government Bureau of Indian Affairs 1849 C Street, N.W. MS-3645-MIB Washington, D.C. 20240
For the Division of Workforce Development:
Office of Indian Services Division of Workforce Development Bureau of Indian Affairs 1849 C Street, N.W. MS-3645-MIB Washington, D.C. 20245 | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 5,640 |
Menorah vandalized in Hollis Hill
In the early evening of Saturday, November 27, a large menorah at the intersection of Union Turnpike and 220th Street in Hollis Hills was knocked into the road, breaking most of its lights.
The incident was reported to the NYPD by Rabbi Zalmanov, co-director of the Chabad of Eastern Queens.
In response, local leaders and elected officials denounced the act of vandalism, leading up to the rededication of a new menorah just steps from where the original one was damaged. Governor Kathy Hochul also instructed the state Hate Crimes Task Force to investigate the incident.
Assemblyman David Weprin said a similar act occurred at the site in 2014.
"Chanukah is a time of peace and joy," said Weprin. "No acts of vandalism or anti-Semitism will ever be tolerated. We are watching, the hard-working members of law enforcement are watching, and this community, where we always have each other's backs, is watching."
Weprin was joined by State Senator John Liu, who noted that just a few weeks prior there was an unrelated act of anti-Semitism at Bagels & Co. in Fresh Meadows.
"That this vandalism occurred as New Yorkers celebrated the first night of Hanukkah stings all the more, but our community will never waiver in our determination to fight back against hatred and division in any form," said Liu.
According to the FBI's 2020 statistics, crimes targeting Jewish people made up nearly 55 percent of all religious bias crimes last year. More than half of hate incidents targeting Jews involved the destruction, damage, or vandalism of property, with a third of incidents being instances of intimidation.
Congresswoman Grace Meng co-chairs the House Antisemitism Task Force.
"There is no place anywhere in our society for anti-Semitism and hate, particularly here in Queens, where we welcome and embrace the great diversity throughout our borough," she said. "Those responsible must be held accountable."
Roughly a week after the incident, elected officials joined together for a rededication of a new menorah.
Statue vandalized at St. Michael's in Flushing
At approximately 3:30 a.m. last Wednesday morning, a man vandalized a statue of St. Bernadette outside St. Michael's Roman Catholic Church at 136-76 41st Avenue in Flushing. The attack is the latest in a string of incidents at churches in the Diocese of Brooklyn.
The statue of St. Bernadette was dedicated earlier this summer as a memorial to parishioners who died from coronavirus. St. Bernadette is the patron saint of the poor, those ridiculed for their faith, and the sick.
Wednesday's perpetrator jumped over the church fence and knocked the statue over, damaging portions near the left forearm and wrist.
While St. Michael's is already planning to repair the statue, parish leaders are hoping to use the incident as an opportunity to strengthen the community.
"St. Michael's plays a central role in the faith and care of our neighbors through our masses and faith-based services that feed the hungry," said Father Vincentius Do, pastor of St. Michael's Church. "For sure this act of vandalism is upsetting, but the faithful of St. Michael's and I are praying for the person who committed this act against our church.
"It is important to find the good in all things, and so I wish to take this opportunity to encourage the public to respect our church and our property, as well as that of all houses of worship," he added.
Authorities from the 109th Precinct are currently investigating the incident. Anyone with information is asked to call Crime Stoppers at (800) 577-TIPS (8477).
The St. Bernadette is the latest in series of vandalism incidents at churches in Queens and Brooklyn.
In July, a person damaged two statues outside of Our Lady of Mercy Roman Catholic Church at 70-01 Kissel Street in Forest Hills. The two statues had been in place since the church's opening in 1937.
The vandal dragged the statues close to 200 feet across 70th Avenue before destroying them completely with a hammer.
In May, two separate incidents occurred at churches in Brooklyn. On May 14, a crucifix was toppled and damaged and an American flag lit on fire at St. Athanasius Roman Catholic Church in Bensonhurst.
On May 17, a statue of Mary holding the Baby Jesus was found vandalized near the Diocese's administrative office in Windsor Terrace. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,248 |
{"url":"https:\/\/de.zxc.wiki\/wiki\/Vorschubantrieb","text":"# Feed drive\n\nMetal milling machine in material processing - the tool was guided over the workpiece by a feed drive.\n\nThe feed drive is a drive that is responsible for the feed movement of a tool or workpiece in a machine tool .\n\nThe feed drive regulates the feed speed , which can be constant or variable or leads to the workpiece approaching the tool with precise positioning. Different motors and gears can be used depending on the specific requirements . Asynchronous motors are usually used at a constant feed rate . Further motor types used are stepper motors , synchronous motors , linear motors or torque motors . The feed and the speed adjustment are usually carried out via electronic controls, but mechanical gears such as toothed gears can also be used to set the speed. ${\\ displaystyle v_ {f}}$\n\nMost motors generate a rotational movement that needs to be converted into linear movement for the feed. The peripheral speed can be converted into a propulsion speed, for example, by means of a gear unit consisting of threaded spindles or racks .\n\n## literature\n\n\u2022 Rico Emmler, Hans-J\u00fcrgen Gittel, Thorsten Leps, Maximilian Ober, Frieder Scholz, Andr\u00e9 Wagenf\u00fchr: Woodworking. In: Andr\u00e9 Wagenf\u00fchr, Frieder Scholz: Taschenbuch der Holztechnik. Specialized book publisher at Carl Hanser Verlag, Leipzig 2008; P. 285 ff. ISBN 978-3-446-22852-8 .","date":"2021-06-14 09:29:28","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 1, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.580075740814209, \"perplexity\": 7304.613873550982}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2021-25\/segments\/1623487611641.26\/warc\/CC-MAIN-20210614074543-20210614104543-00361.warc.gz\"}"} | null | null |
{"url":"https:\/\/photoatelier.org\/2015\/01\/05\/epicycloid\/","text":"## Epicycloid\n\nIn\u00a0geometry, an\u00a0epicycloid\u00a0is a plane\u00a0curve\u00a0produced by tracing the path of a chosen point of a\u00a0circle\u00a0\u2014 called an\u00a0epicycle\u00a0\u2014 which rolls without slipping around a fixed circle. It is a particular kind of\u00a0roulette.\n\nIf the smaller circle has radius\u00a0r, and the larger circle has radius\u00a0R\u00a0=\u00a0kr, then the\u00a0parametric equations\u00a0for the curve can be given by either:\n\n$x (\\theta) = (R + r) \\cos \\theta - r \\cos \\left( \\frac{R + r}{r} \\theta \\right)$\n$y (\\theta) = (R + r) \\sin \\theta - r \\sin \\left( \\frac{R + r}{r} \\theta \\right),$\n\nor:\n\n$x (\\theta) = r (k + 1) \\cos \\theta - r \\cos \\left( (k + 1) \\theta \\right) \\,$\n$y (\\theta) = r (k + 1) \\sin \\theta - r \\sin \\left( (k + 1) \\theta \\right). \\,$\n\nIf\u00a0k\u00a0is an integer, then the curve is closed, and has\u00a0k\u00a0cusps (i.e., sharp corners, where the curve is not\u00a0differentiable).\n\nIf\u00a0k\u00a0is a\u00a0rational number, say\u00a0k=p\/q\u00a0expressed in simplest terms, then the curve has\u00a0p\u00a0cusps.\n\nIf\u00a0k\u00a0is an\u00a0irrational number, then the curve never closes, and fills the space between the larger circle and a circle of radius\u00a0R\u00a0+ 2r.\n\nwikipedia\n\nvia:\n\nhttps:\/\/clearcircle.wordpress.com\/page\/2\/","date":"2017-07-22 08:53:14","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 4, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.9643957614898682, \"perplexity\": 390.0946576121105}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2017-30\/segments\/1500549423927.54\/warc\/CC-MAIN-20170722082709-20170722102709-00712.warc.gz\"}"} | null | null |
Нервьо́н (, ) — река в северной Испании (Кастилия-Леон и Страна Басков), протекает через город Бильбао, впадает в Бискайский залив. В нижнем течении от впадения реки Ибайсабаль образует эстуарий Бильбао. Длина реки составляет 75,6 км, площадь водосборного бассейна — 1595-1814 км² (крупнейшая в Стране басков).
Среднегодовой расход воды составляет 29,14 м³/с, минимальный среднегодовой — 13,56 м³/с, максимальный — 41,0 м³/с.
География
Исток расположен недалеко от Бургоса. Недалеко от истока река образует водопад Salto del Nervión (высочайший водопад Испании) в каньоне Делика (Алава), течёт по узкому каньону, и протекает через муниципалитеты Амуррио и Льодио. Ниже Льодио река образует меандры, после чего втекает на территорию Гран-Бильбао. В Бильбао в реку впадает Кадагуа, далее она протекает через Сестао и Португалете и впадает в Бискайский залив.
Верхняя часть эстуария узкая (50-150 м) и мелкая (2-9 м), нижняя — широкая (до 3,8 км) и глубокая (14-30 м).
Крупнейшими притоками являются Альтубе (26,3 км), Себерио (14,0 км), Ибайсабаль (45,2 км) и Кадагуа (61,6 км).
Наводнения
Река неоднократно становилась причиной наводнений в городе. Большинство наводнений в реке происходили весной и осенью.
Последнее крупное наводнение произошло в августе 1983 года. 27 августа, во время праздненств . В некоторых точках вода поднялась более чем на 5 м. Наводнение, вызванное проливными дождями, оставило весь регион без света и телефонной связи и привело к гибели десятков человек и ущербу около 1,2 млрд евро.
Продолжаются работы по борьбе с наводнениями.
История и экономика
Перевал возле Ордунии, связывающий внутреннее плато Испании с долиной Нервьон на протяжении многих лет служил перевалочным пунктом. С древних времён долина реки являлась важным связующим звеном для провинции Бискайя — основная ж/д, соединяющая Бильбао с остальной Испанией была построена вдоль реки в 1863 году.
Раньше работоспособность порта Бильбао полностью зависела от судоходства на последних 15 км реки, сейчас же порт вынесен к морю.
Архитектурные и инженерные объекты
На берегу реки стоит Музей Гуггенхейма в Бильбао.
Португалете и Санта-Аренас соединяет Бискайский мост, построенный в 1893 году, действующий по принципу летающего парома. Мост имеет высоту 45 м и длину 160 м. В 2006 году мост был признан объектом всемирного наследия ЮНЕСКО.
Экология
Низовья реки загрязнены, измерения 1980-х годов показали концентрацию кислорода ниже 4 мг/л.
В среднем течении реки высока концентрация кальция, сульфата и хлорида, так как в бассейне распространены меловые скалы.
Измерения 2018—2019 годов показали содержание взвешенных частиц 10,8-32,0 мг/л; ТОС — 5,3-14,0 мг/л; кислотность воды — 7,8-8,4; концентарция арстворимого кислорода — 8,0-12,1 мг/л. Солёность воды в эстуарии составляет 22-32 ‰.
Примечания
Ссылки
Реки, впадающие в Бискайский залив
Реки Кастилии-Леона
Реки Страны Басков
География Бильбао
Бискайя | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 9,538 |
Dianie
Lost in Tulum
Posted on July 28, 2017 July 29, 2017 Travel
Land of beautiful beaches, clear water, tasty food and breathtaking views.
Malibu TanPrevious
Beaching in Laguna BeachNext
2,048 thoughts on "Lost in Tulum"
History amberoz Minutes to the Fed's rate-setting committee's last meeting on policy are due this week and there has been more than the usual amount of talk on trading floors about what they will or won't reveal.
online drugs pharmacy Defense attorney Steven Levine said Thursday he intends to appeal the ruling to New York's highest court. He cited the lack of a New York law on comfort dogs in court, and said the ruling leaves such a decision up to a trial judge's discretion that could differ from county to county. The appeals court also failed to address the defense argument that comfort dogs also make it easier for witnesses to give convincing false testimony, he said.
fitness pro super whey 5 lbs Senior U.S. defense officials said they remained confidentthat the United States was already well protected againstpossible missile attacks from North Korea by the two existingmissile interceptor sites, one in California and that in Alaska,where the Pentagon plans to add 14 more interceptors by 2017.
can you buy metformin over the counter "Pentobarbital will kill Yowell in five to eighteen minutes and his consciousness will be diminished almost immediately; therefore, infections like meningitis will not hurt him because they require weeks to incubate," wrote U.S. District Judge Lynn Hughes.
yasmin webmd The disease weakens and enlarges the heart muscles, making it harder for the heart to pump blood to the rest of the body, according to the Mayo Clinic's website. The condition can lead to heart failure. Treatments may include medicines and surgery.
Emile says:
I'd like to change some money how to get the best price on prescription drugs "If there is that degree of disruption, that lack ofcertainty, that lack of trust in the U.S. signature, it wouldmean massive disruption the world over," Lagarde said in aninterview with NBC'S "Meet the Press" program about the impactof not raising the borrowing limit. "And we would be at risk oftipping, yet again, into recession."
allcures.com voucher "We didn't know how to make conversation with him, so we were talking about his tour and where he had come from," she said. "He had just been in Cincinnati and he said, 'I'm taking a short break after this one because I have to drop my daughters off at camp.'
losartan potassium 50 mg pictures PARIS, July 11 (Reuters) – Two French human rights groupsfiled a legal complaint on Thursday targeting the U.S. NationalSecurity Agency, the FBI and seven technology companies they saymay have helped the United States snoop on French citizens'emails and phone calls.
pro supps karbolic nutrition facts Companies using crowdfunding would also have to make somedisclosures about their businesses, and how much they couldraise from an unaccredited investor would be limited based oncertain income thresholds.
turner pharmacy carrollton ga Russia proposed on Monday that Damascus could avoid U.S. military action to punish it for allegedly using chemical weapons in an attack in Damascus last month by agreeing to put its stockpiles under international control.
I'm about to run out of credit cipralex compared to zoloft "There's nothing horrible on the surface about someone withshaky hands," he said. "There's nothing horrible about someonein their life saying, 'God, I'm really tired of this shaky handthing' and me saying, 'Me, too.' That's our reality."
thermo maxq 8000 At the same time, U.S. refiners have taken advantage of supplies of cheap domestic oil to ramp up throughput. U.S.companies have looked overseas for new markets to supply withfuel as domestic demand declines.
viprosta uk On a volumes basis, PCE rose 0.2% in August as increases in real spending on durable gods (0.8%) and services (0.2%) more than offset weakness in spending on non-durable goods (-0.2%). The PCE deflator rose 1.2% on a year-over-year basis in August, which was down from July's 1.3% pace. In contrast, the annual increase in the core PCE deflator edged up to 1.2% in August from 1.1% in July.
woodman pharmacy dayton ohio Several sources close to the discussions have told Reuters adeal to avoid bankruptcy is unlikely. Even a pre-negotiatedbankruptcy – in which sides agree to a basic framework beforefiling for Chapter 11 – would be difficult to achieve by theNov. 1 bond payment date, the people said.
jspharmaceutical.net While the constitution gives the government more power, the king still retains the ultimate authority in the North African kingdom and the PJD's new partner, the RNI, is allied to a palace ill at ease at sharing power with Islamists.
I'll send you a text medicalclownproject.org "Firstly, I think it really manages anxiety. If you have someone in your family who's had cancer you do worry about having it and if you have a negative test it allays that anxiety and that's a really big thing.
online buy cheap cycle assistant The show, which premieres on Sept. 29, explores the earlyrelationship of groundbreaking sex researchers Virginia Johnsonand William Masters. It documents their discoveries based onThomas Maier's 2009 biography "Masters of Sex."
pharmacist directory uk The U.S. and China introduced a new round of sanctions against North Korea at the United Nations that the U.S. said would significantly impede the development of Pyongyang's nuclear and missile programs, in response to its test last month of an atomic bomb.
forzest 20 review Cashman said the decision to send Jeter for a CT scan Saturday came in part because the shortstop was slated to undergo one as part of his season-ending physical. We heard a similar story five years ago, when Girardi said Rivera had been sent back to New York for an MRI as part of his physical process. A few weeks later, Rivera underwent shoulder surgery.
azelaic acid yahoo answers Jermaine Beckford, a £1 million summer signing from Leicester, has yet to provide the goalscoring qualities that Freedman craves and missed a great first-half chance, but despite four league games now without a win and a widening gap between them and their promotion rivals, captain Zat Knight remains unperturbed.
What do you do for a living? priceline pharmacy launceston opening hours This comes from our ad serving technology and is used to track how many times you have seen a particular ad on our sites, so that you don't just see one advert but an even spread. This information is not used by us for any other type of audience recording or monitoring.
does alphaviril work On Friday, cabinet unity collapsed after ministers failed to agree on a vital package of budget measures to cut the deficit below the EU limit of 3 percent of gross domestic product and fund measures to halt an increase in sales tax to 22 percent from 21 percent.
number of kmart pharmacies Located about 63 light years from Earth, HD 189733b is about the size of Jupiter, but is much closer to its star – so close that a "year" on the planet is only about 2.2 days. Surface temperatures on the side facing its star reach 2,000 degrees and scientists in 2007 estimated that its winds probably reach up to 4,500 miles per hour.
levonorgestrel & ethinyl estradiol tablets The moon revolves around the Earth but we are not be able to tell by looking at it because we always see its same face . That's because it takes 27 days for the moon to circle the Earth, which is the same amount of time it takes for the moon to spin on its axis.
trileptal kaufen In emerging Europe, the Czech Republic exited recession in the second quarter while the European Union's other bigger eastern economies improved, although there was little sign yet of the outright optimism among consumers needed to drive a stronger upturn.
Deadman says:
Could I make an appointment to see ? asap-pharmacy.com In what has to be one of the cutest travel snafus in New York City history, two rogue kittens shut down Brooklyn's B and Q subway lines for over an hour Thursday, as staff staged a successful rescue mission.
asda pharmacy barnes hill opening hours Howard Webb and referee Kevin Friend are standing on the sidelines. They look close to tears – I have made a mockery of their day. Then I realised they are actually convulsed with laughter.
triphala gdje kupiti u zagrebu Banking industry sources had said the results could providea window of opportunity for UK Financial Investments, whichmanages the government's 39 percent stake in Lloyds, to initiatean immediate first sale of up to a quarter of the shares, valuedat around 5 billion pounds.
crestor cena 5 mg Rallies and protests were held across Pakistan on the appeal of Jamaatud Dawah Ameer Hafiz Muhammad Saied, where leaders demanded Prime Minister Naas Sharif to reverse back channel diplomacy for friendship with India and instead expel Delhi's ambassador and take up Kashmir issue in the UN afresh. Prayer leaders highlighted the Indian army atrocities on helpless Kashmiri Muslims and silence of world bodies and Muslim rulers. Protesters raised slogans against the Indian army and set ablaze Indian flag.
purchase oxyerect pro The impasse has sent the cost of insuring against a U.S. sovereign default to its highest level in four months. U.S. stock index futures signaled a weak start on Wall Street .N and the dollar slipped by around 0.1 percent against a basket of major currencies .DXY.
Bryon says:
Sorry, I ran out of credit anabolic freak czy test freak Benetton's chief executive Baigio Chiarolanza said manycompanies had not joined the Geneva talks due to a "lack ofclarity" around objectives and a lack of involvement by severalkey stakeholders, without elaborating.
universaldrugstore.com "Telefonica does not want to go (to the Sept. 19 boardmeeting) empty-handed, but the challenge is finding a solutionthat offers liquidity to Telco stakeholders without increasingTelefonica's debt," the source said, without elaborating on whatspecific format the solution might take.
miracle essential oils immunity The two, along with UK Life and Aviva France, are key cash flow generators. In the first six months of this year, the division, along with UK health, generated £216m of operating capital, 23pc of the group's total.
clicks pharmacy soshanguve crossing Alzheimer observed plaques (clumps of brain tissue), tangles (abnormal bundles of nerves) and shrunken brain tissue in his deceased patient. Later, changes in brain chemistry, resulting in loss of connections among brain cells, were observed as well.
bakers pharmacy fremont ne CVC Capital Partners, another private equity firm that has significant expertise in sports rights management with its controlling investment in Formula One, is also involved in IMG's sale process, the sources said.
Could I make an appointment to see ? technipharm.com.au The Latino population in America has been booming — but the most progressive music made by those of Latin descent still has problems getting on mainstream radio. Surprisingly, it can be even harder for performers to crack the conservative Spanish-speaking airwaves and TV outlets than it is to get play on English-language stations.
fleming medical center llc At the same time, cooler temps have activated our bluefish population, although their numbers are still scattered. We're keeping an eye out for diving terns and gulls that give good clues to some of their whereabouts. And those hungry choppers are responding to both bait or diamond rigs.
express scripts mail order pharmacy address Corocoro scans have leaked on the internet, revealing a handful of new Pokemon for X and Y as well as a new feature called 'Mega' forms, which is a kind of evolution that drastically changes existing Pokemon.
kamagra rezeptfrei wien "Having stated this quite clearly, and with the unemployment rate having come down to 7.4 percent, I would say that the (Fed's policy-setting) committee is now closer to execution mode," Fisher told the National Association of State Retirement Administrators in Portland, Oregon.
oral clindamycin hcl for acne Isobel, from Acton, west London, took two Ecstasy tablets and some form of powder, Westminster Coroner's Court heard. She became unwell, and was sweating and shaking, but would not let her friends call an ambulance for fear of getting into trouble.
Do you like it here? promopharm s.a.r.l Senator Edward Markey, a Massachusetts Democrat, said Hagel's action was "the right decision for the hundreds of thousands of patriots who support our soldiers, and now it's time to end this harmful government shutdown that has left hundreds of thousands of other federal workers sitting at home."
neurontin yahoo answers Ralph Neas, chief executive of the Generic PharmaceuticalAssociation industry group, said that the Supreme Court'sdecision to refrain from declaring the deals illegal would leadlawmakers to be wary of Klobuchar's bill.
cipro kaufen In a separate blogpost Mitch Lasky, one of the venture capitalists who helped raise the cash, said Android's growth was opening up opportunities for companies such as Cyanogen that could improve on the experience provided to users by Google, handset makers and operators.
viagra in hyderabad price Nonetheless, some clients will take the opportunity to review accounts, particularly if they hadn't been briefed on the deal. Contracts between major advertisers and agencies sometimes include clauses that say they can be renegotiated in the case of major M&A deals that pose new conflict issues.
ogoplex best price The system, backed by technology giant Parker Hannifin Corp, will fill up quicker than some models – about one gallon an hour – and last up to 20 years, according to Go Natural CNG Chief Executive Lucas Kjar. The unit, expected by the end of the year, will use hydraulic technology to compress the gas for vehicle use, he said. He did not say how much the unit would cost.
I do some voluntary work actualmd.com In keeping with tradition, this season's first three major winners have been grouped together – Australian Adam Scott (Masters), Englishman Justin Rose (U.S. Open) and American Phil Mickelson (British Open).
cheap viagra pills london uk "Fantastic Beasts and Where to Find Them" will be the firstin a series of films about the adventures of Scamander and willbe familiar to anyone who has read the Harry Potter books orseen the films, the 48-year-old Rowling said.
viasure certest A mother from Clapham has described her shock when she found a fox in her daughters bedroom. Corporate Lawyer Jo Williams said she did a double take when she saw the fox licking the face of her daughter. Are you worried about foxes in your area?
best price rogaine foam In all of that time, there has not been enough evidence tosuggest he engaged in insider-trading. In addition, despite thefact that several of his employees have been charged criminallywith insider-trading, no one has stepped forward to testifyagainst him as a government witness.
dude wipes shark tank pitch That was the message from workers at the city's port, alarmed at calls to outlaw cruise ships from the tourist destination in the wake of Italy's Costa Concordia disaster and amid fears over structural damage and pollution.
How much does the job pay? ceraloft amazon "As I have acknowledged in the past, I am not perfect," Braun said in a joint statement with the league. "I realize now that I have made some mistakes. I am willing to accept the consequences of those actions. This situation has taken a toll on me and my entire family, and it is has been a distraction to my teammates and the Brewers organization."
keflex 500 precio mexico News24 allows you to edit the display of certain components based on a location. If you wish to personalise the page based on your preferences, please select a location for each component and click "Submit" in order for the changes to take affect.
zithromax rxlist A Financial Industry Regulatory Authority arbitration panelalso ordered Edward Mulcahy, a former Citigroup broker, to pay$250,000 to the investor, John Leopoldo Fiorilla, according to aJuly 30 ruling.
beverly hills pharmacy abu dhabi In Romania the government has been in conflict with the president and judiciary in the past year, while Bulgarians have staged protests for weeks against endemic corruption and to demand the resignation of the new Socialist-led government.
life pill laboratories The Saudi funds comprise a USD2bn central bank deposit,USD2bn in energy products and USD1bn in cash; Kuwait will divideaid into a USD2bn central bank deposit, a USD1bn grant andUSD1bn in oil reserves; and the UAE will make a USD1bn grant andwill offer a USD2bn loan, the three respective state newsagencies reported last week.
Theron says:
Could you give me some smaller notes? 3dintermedical.com Sunday's assault was significant in that it struck in the heart of el-Arish and killed a 32-year-old man driving his car in the most populated city in northern Sinai, which is also its provincial capital. The city is home to about 150,000 people.
buy furosemide online australia The U.S. House of Representatives committee looking into thepractices of the federal tax-collection agency will question aCincinnati-based IRS employee who was in charge of examining TeaParty-linked applications and two Washington IRS officials whoplayed a role in overseeing her work.
synergy pharmacy services Lawyers also questioned the efficiency of judicial cooperation after the Turkish pro-government newspaper Bugun wrote that the prosecutor in Ankara had accused French authorities in August of failing to respond to his requests for details in the case.
does alphaviril work Also, I had forgotten that he was a psychiatrist. Is there any oversight committee in the military for psychiatrists? In civilian life, my psychiatrist is routinely evaluated by his peers and other entities to ensure that he is still practicing according to guidelines. Granted, he refuses to take any insurance whatsoever, but this is because the insurance companies won't pay for the time used to conduct individual therapy sessions. His practice is the only one in Florida that still offers 50 minute therapy sessions, and patients drive from as far as four hours away to see him and his two associates. I just wonder what Hasan was thinking, and why no one noticed that he had effectively gone off the deep end.
pharmavital.de FORT MEADE, Md. (AP) — Pfc. Bradley Manning could learn as early as Tuesday afternoon whether he will be convicted of aiding the enemy — punishable by life in prison without parole — for sending more than 700,000 government documents to the anti-secrecy website WikiLeaks, a military judge said Monday.
What sort of work do you do? med-shop.mediaplace.biz Italian bonds meanwhile braved growing political uncertaintyafter Italy's top court upheld a jail sentence against formerpremier Silvio Berlusconi that could throw the country'scoalition into crisis. {ID:nL6N0G30ZF]
program yourself thin These autoimmune diseases are typically treated withimmunosuppressant drugs, while SetPoint uses an implantablepulse generator to stimulate the vagus nerve, which runs fromthe head to the abdomen, producing a systemic anti-inflammatoryeffect.
hsp70i vitiligo clinical trials 2015 The issue of how to help working people stay in their jobs while also caring for relatives is becoming a key policy battleground for the main parties ahead of the next election. Health secretary Jeremy Hunt last week urged employers to allow workers greater flexibility to decide their hours so they can combine a job with caring duties.
no prescription acyclovir cream New York's 38-0 loss to the Carolina Panthers yesterday was the most lopsided defeat in Coughlin's 10 seasons with the Giants. It speaks volumes about just how far they are from being a competitive team.
slippery stuff gel uk On one side of the bond spectrum you have investment grade with very low probabilities of default. In the corporate world, these issuers are large companies with steady cash flow and little chance of not being able to make their interest payments each month. On the other side you have high yield with much higher rates of default. While bank loans are closer to high yield bonds in terms of credit risk, they have a unique feature which results in much higher recovery rates. Holders of bank loans are the first group of people to get paid if the borrower goes bankrupt because the loan is backed by company assets. Bank loans get an extra layer of protection not offered by high yield debt because of their seniority in line to get some of their money back.
I'm sorry, he's como comprar cialis en espaa "It's hard to put 'The Good Wife' [starring Julianna Margulies, above] in the same category as 'Game of Thrones,' " CBS boss Les Moonves said, but if broadcast networks lack cable's buzz , the ratings may console them.
biogenesis of phytopharmaceuticals pdf The two stars were involved in an incident earlier this year at a recording studio in Los Angeles where the two men came to blows over a parking space, with Ocean reportedly suffering a cut finger while Brown sported a cast on his hand in the days after, though no charges were filed from either party.
supreme medical centre n3 Gazprom, the Russian state-owned company which operates the rig, says that this base is so heavy that it cannot be moved, even by thick ice. The company insists that drilling here is no different just because it is in the Arctic. It says there are many rigs – off Sakhalin Island in the far east for example – which have to cope with frozen seas.
prc pharmacy board exam 2017 schedule The cooperation will further strengthen ties between the twocompanies. GM is eager to tap Isuzu's strength in SoutheastAsian markets and its diesel technology, while Isuzu wants toshare the burden of developing technologies.
reverse my tinnitus system alan watson Abu Shadi ordered the purchase of 300,000 metric tons of Romanian, Ukrainian, and Russian wheat on Thursday, his second day in office. It dwarfed a July 2 tender of 180,000 metric tons ordered by his Mursi-era predecessor Ouda.
Grover says:
Punk not dead bony to brawny download But that was offset on Friday by fresh signs of a pick-up inthe pace of economic growth, with data showing the UK economyhad grown more than first thought in the second quarter – comingon the heels of a batch of upbeat macroeconomic data from aroundthe world on Thursday. Germany also confirmed solidsecond-quarter growth.
avigra side effects The Phi Alpha Social Work Honor Society, the U of A chapter of the National Alliance on Mental Illness and the Northwest Arkansas Suicide Prevention Coalition are working together to host the day's events.
manforce condom advertisement video song "The discretion afforded to doctors under the current law in assessing the risk to the mental or physical health of a patient is wide and, having consulted an experienced consultant in obstetrics and gynaecology, it appears that there is no generally accepted approach among the medical profession." He also concluded that, had a prosecution been mounted, "there is a real risk that different juries would reach different decisions on essentially the same facts".
marinol for cancer patients Best's style of play – selfish, impudent, spontaneous – lent itself to the tall tale, the far-fetched anecdote. He did things nobody had done before in little explosions of outrageous skill. And just as Best's play was all about embellishment and improvisation, so the accounts of these very feats were exaggerated in the telling and retelling. Hamilton is surely right when he claims that "no footballer has imposed himself so completely on the romantic imagination".
lawmedicine.com.py Meanwhile, pension liabilities loom large. For years many states contributed less than actuaries suggested to their retirement systems, and during the recession they pulled back even more. At the same time, the financial crisis ravaged the primary source of pension revenue – investment returns, which have only recently improved.
good material thanks generic clomid cheap The global battle for mobile supremacy is not just between Apple and Samsung. Huawei and ZTE Corp are growing across their Chinese home base, and South Korea's LG Electronics said on Wednesday it sold a record 12.1 million smartphones in April-June, more than double its year-ago sales.
alli lowest price uk He was a student of history at a university in Karachi, but abandoned higher education and took to the mountains of Balochistan. The faction of Baloch nationalists he now leads is outlawed by the authorities and described as an anti-Pakistan militant group.
where to buy apcalis bangkok Among U.S. economic data, first-time weekly claims for stateunemployment benefits, the last major reading on the labormarket before the Fed's meeting, fell to the lowest level since2006, but the picture was confused because two states did notprocess all their claims.
can finasteride raise blood pressure "I worked for $5 an hour, which seemed like so much money atthe time. I did everything from filing scripts, to catalogingart for Michael Ovitz, to working as an assistant forRichard Lovett, who had just been made an agent and now runs thewhole show there. But basically my job involved a whole lot ofnothing.
dulcolax dragees dosierungsanleitung Teams of engineers were dispatched by Boeing worldwide to install the stronger battery casing and other components designed to prevent a repeat of the meltdowns that led to the first U.S. fleet grounding in 34 years.
Bryce says:
I'd like to order some foreign currency meaning of rx in pharma With an Internet radio show, speaking invitations to gun rallies around the country, and a newly formed "Constitution Security Force" that he claims already has chapters in 45 states, the 41-year-old coal miner-turned-cop said his message _ that the federal government is too big, too powerful and wants to grab guns _ is resonating with a segment of the public that believes as he does.
mass.fi Among decliners, Eli Lilly lost 3 percent to$51.04 and was among the biggest drags on the S&P 500 after itsexperimental cancer drug failed to improve survival among breastcancer patients without their cancer worsening in a late-stagetrial.
endurox r4 vanilla "Suicide bombings have been the centerpiece of every major, spectacular al-Shabab attack over the last seven years. And it's only in 2013 that we have seen attacks in which suicide bombers have become accessories to the main assault, which is carried out by gunmen," says Bryden. "Suicide bombers are no longer the center of gravity of al-Shabab tactics — and that is the shift that has enabled the attack to take place here in Nairobi."
megaroids.net reviews "We believe BBRY needs to act quickly and decisively in coming to a conclusion with regard to any potential sale of the company and should look to sell assets to bolster its cash position," Wells Fargo analysts said.
waterside pharma consultancy Blankfein implicitly criticized Republicans for usingObamacare as a weapon. "You can litigate these policy issues.You can re-litigate these policy issues in a political forum,but they shouldn't use the threat of causing the U.S. to fail onits … obligations to repay on its debt as a cudgel," he said.
What sort of music do you listen to? north american express cialis "African consumers demand quality products and are brandconscious, belying the view that the continent is a backwaterwhere companies can sell second-rate merchandise," it said, based on a survey of 13,000 consumers in 10 countries.
loperamide yahoo Family and community members came together the night the toddler died. They prayed with arms extended at Sertoma Park during a candlelight vigil in his memory. One blonde-haired boy wore a purple No. 28 Adrian Peterson jersey under his jacket as he held his candle high. Attendees sang church hymns and prayed for Ruffin's parents.
viarex enhancement cream ROME, July 20 (Reuters) – Four Costa Concordia crew membersand a company official were sentenced to jail in Italy onSaturday for their part in the 2012 cruise ship disaster thatkilled 32 people, leaving only Captain Francesco Schettino stillon trial.
prilosec rxlist Physicians initially diagnosed Gilbert with twin-to-twin transfusion syndrome (TTTS) – only in her case, it was considered triplet-to-triplet. With TTTS pregnancies, the identical fetuses must share the same space and resources in the womb, and sometimes the placenta will deliver a disproportionate amount of nourishment to one fetus over the other. These types of pregnancies can have a high mortality rate of 60 to even 100 percent.
north park pharmacy loves park illinois The Giants have lost 10 of their last 13 games after starting last season 6-2. Reese's two Super Bowl teams got red-hot in the postseason but the 2007 team was only 10-6, at the time tying for the worst regular season record for a Super Bowl champ before the 2011 team broke the record at 9-7.
Very interesting tale buy bimatoprost in canada Human Rights Watch also said those who are bright enough for higher education are often denied admission under guidelines set up by the government. The guidelines advise universities of the types of "physiological defects" and "illnesses" that make a person "unable to take care of themselves or complete their studies."
nexium news articles With the 30-year fixed loan now bumping around about a percentage point above its record lows, a refinancing boom has tapered off. But the rates are still a bargain by historic standards, and strong demand to purchase homes does not appear to have been dampened much by the increase.
plant viagra for sale "I was only in second gear," joked Cian O'Connor yesterday after he got Ireland off to a winning start at the Discover Ireland Dublin Horse Show, before Bertram Allen, made it two-in-a-row for the home side in the second international class.
first pharma pty Of the total, 1,271 were termed "risk analysis events," or incidents serious enough to warrant further review because aircraft had flown more than 34 percent closer together than FAA regulations allow, and 41 were termed "high risk events."
cellucor c4 extreme workout supplement ingredients He added: "This too was a distressing experience because it was clear that certain parts of Mrs Veal's body were missing and had, the officer formed the view, effectively been gnawed and eaten away by the animals."
I'll text you later nexium billiger Hospital officials say that medical records for 14 patients were "inappropriately accessed" between June 18 and June 24, days after Kardashian gave birth to her daughter by rapper Kanye West.
chess pharmacy Westpac was set to win the auction after rivals MacquarieGroup and a consortium led by Pepper Australia and GECapital dropped out of the race, according to thesources, who asked not to be identified as they were notauthorised to speak publicly about the matter.
how to use viagra 100mg Al-Shehri had been a prisoner in Guantanamo where he says he was tortured. On his release in 2007 he was put in a rehabilitation programme in Saudi Arabia for returned Guantanamo prisoners but escaped, rejoining al-Qaeda in Yemen.
sumatriptan 100 mg tab So our government must borrow constantly in order to pay for laws and programs that it has previously created. We borrow more and more as time passes. We stimulate the economy with at least a $ trillion (which is enough money to give a million people each a million dollars) every year.
clonidine hcl 0.2 mg tablet Regulated commercial banks had long been permitted to trade in commodity derivatives such as futures, but at the time did not enjoy the same freedom in physical markets, unlike investment banks like Goldman Sachs and Morgan Stanley.
Hold the line, please l-arginine for sperm volume "We are simply asking for sufficient burden of proof that a species is truly endangered or under a threat of extinction," Pyle said in a statement. "Not all state agencies are required to play by the same rules when it comes to these designations, and my bill would essentially level the playing field."
donde puedo comprar el arbol de neem en monterrey "I've never seen anything quite like they had over there at Chesapeake," said the source close to the company's board. "I think (McClendon) carried it to an extreme, especially when you look at what it cost you to do all that stuff and how much people were being paid."
body groove dvd uk "We're going to move forward with the vote," McCain said. "I thank all of our colleagues for believing in what I think is very important in our relations in the United States Senate."
cannon hill discount pharmacy warehouse Even the dashboard is made of weight-saving wood, but it has the quality look and feel of any other VW. There's a stereo, Bluetooth connection and air-con – luxuries have not been scrimped on, but they're all lightweight luxuries.
anaprox pharmacy2uds The league's motion is based on jurisdictional grounds. MLB claims that the lawsuit does not belong in state court because Rodriguez is committed to labor agreements between baseball and its Players Association and that "disputes that arise over those agreements are governed by the Labor Management Relations Act," a federal law.
Barrett says:
How many weeks' holiday a year are there? generic cialis results Pavel Karpov, an unemployed former Russian police officer, is suing Mr Browder and his UK-based fund Hermitage Capital for saying he was complicit in the "torture and murder" of anti-corruption whistleblower Sergei Magnitsky four years ago.
iperboreal pharma At least two other congressional committees areinvestigating the glitches and whether the administration wasforthright about the problems. Several contractors are due toappear at a hearing on Thursday about their work on the website.
mmusa melt cream Broader demonstrations against Prime Minister Tayyip Erdogan this summer have resurfaced again in recent days, including in at least two Alevi districts of Istanbul. Protests have also erupted in Hatay province, an ethnic and religious melting pot right on the southern border with Syria.
nutrabio pre workout reviews US Airways and American Airlines parent AMR Corp said they would ask their boards to extend the termination dateof their proposed $11 billion merger due to uncertaintiesrelated to a government lawsuit, the Wall Street Journalreported, citing sources.
anabolics.ws reviews Scything is making a comeback. I had a lesson last night from Richard Brown of Emorsgate Seeds, a botanist, whose other day job is to develop wild flower meadows. Last week he taught the gardeners from London Zoo, with the poor anteaters in headbanging mode at the noise of the strimmers.
Best Site Good Work super p force usa Judge Giuseppe Dalla Torre, the president of the Vatican tribunal who presided over Gabriele's trial, acknowledged Thursday that the Gabriele case could be seen as having an influence on the new crime, though he said the crime itself was "irrelevant" to the overall reform.
canadian discount viagra The question for Tickle and his new business partners is whether they will be able to evade the rightful owner of the shine long enough to sell it off, not to mention restrain themselves from drinking it all. Because if there is one maxim of the black market that Tickle is particularly adept at ignoring, it's the old, "Don't get high on your own supply."
buyonlineventolin.com reviews The document was filed as part of an effort by the feds to keep the salacious information from being introduced when Madoff's former secretary, Annette Bongiorno, and others face trial in the fall on charges of securities fraud and conspiracy. Prosecutors told the court they anticipate lawyers for Bongiorno and her co-defendants would attempt to use the sex secrets to damage the credibility of witnesses the feds plan to call. They then called on the judge to issue "an order excluding any such evidence – by either side."
breakspearmedical.com Mary Catherine Roper, a lawyer for the plaintiffs, said that the biggest difference between the Philly and NYPD cases is "the Philadelphia Police Department never contended that it's above the Fourth Amendment," which protects against illegal search and seizures.
olanzapine yan etkileri "It is really quite remarkable that Kluger could not even wait to graduate from law school before using his employment at a law firm to initiate his illegal activities," he continued. "It is equally remarkable that during most of his legal career he was involved in criminal activity, so that in an actual though perhaps not in a legal technical sense … he truly was a career criminal."
Britt says:
In a meeting how does amitriptyline work for back pain Production was around 2 million tons last year, and grain traders and experts contacted in Syria say the country would require at least two million tons of imported wheat this year to help cover the shortfall. That compared with FAO estimates of 1.5 million tons, based on official agricultural sources.
supplement350.com The letter to Fifa guaranteed that the Nigeria Police "will provide adequate security to ensure a conducive environment before, during and after the match between Nigeria and Malawi scheduled for 7 September at the U. J. Esuene Stadium, Calabar".
cmc clinic barrie A final report and subsequent recommendations will then be provided by the end of the year "so that we can move forward with a better understanding of how these programs impact our security, our privacy and our foreign policy," President Obama said two weeks ago.
does vigorexin really work "Evictions are only ever a last resort. However, rent arrears fundamentally threaten the financial position of housing associations. Since associations are not for profit and charitable social businesses with a responsibility to a wide range of tenants, preventing landlords from evicting will ultimately affect more tenants than the 'bedroom tax'.
creatine x3 instructions A NASA satellite headed for Mars accidentally lands on the castaway's island, and the group tries to use its nifty camera to get in touch with someone on the mainland. But, somehow, Gilligan gets everyone covered in feathers (yes, feathers) just as the camera captures their image and they are mistaken for strange alien chickens. Yes, alien chickens.
Languages hay femigra en mexico Moscow and Washington disagree over a long list of issues, from Syria's civil war to human rights and Russia's ban on homosexual "propaganda," but there are some areas, critical to global security, where they have been able to work together.
cw hemp stock ticker The Daily News has some of the most memorable photos in sports history. From legendary boxers and iconic tennis players to golfing greats and fabled Olympians, the Daily News has the photos you want of the once-in-a-lifetime sports moments. Find yours today and relive history.
pharmoutcomes.org The government hopes to see a feasibility study for Phase 2by early 2014, he said, and wants a detailed breakdown of costsfor each phase of the mine's development, rather than accepting a figure of more than $14 billion for the whole development.
buy kohinoor gold uk Dear Fabrice: I'm sorry your negligent bosses gave you so much responsibility, so young. I wish they never had. I'm sorry you were the only one to get caught. I wish more of you were. I'm sorry you've been made into a scapegoat for the entire financial crisis. I wish that on Dick Fuld instead. But thems the breaks. Man up, take your ban, and good luck on the PhD market.
carvedilol 3.125 mg indications Chappell hasn't had much of a year with only three top 10 appearances on the season but he has a chance to change all that with a win at The Barclays and a blast into the top 10 of the FedEx Cup rankings.
Carey says:
We were at school together preis fr acai berry max That pales in comparison to the experience of the victim's family. Trayvon Martin, 17, was on his way to see his father when he got killed. He was unarmed and merely walking through the neighborhood when the confrontation happened, and Trayvon got shot and killed anyway. The police at the time didn't take action against the man who shot him. After more than a year of demanding justice, his family doesn't even have the comfort of a verdict.
medicaresupplement.com "We were cautious in discharging him but he was managing his sentences and did not need his nebulisers. We don't discharge children and not see them again. He would be seen by another doctor in one month."
jenasol original On Friday, on BBC News, Home Office bully boys were shown rounding up dark-skinned folk in specially targeted multiracial localities. In Southall in west London, outraged Asian women defied them and objected volubly. Some were from Southall Black Sisters, a collective which, for years, has defended gender and minority rights. I recognised some – grey-haired now, but still full of indignation and passion. In previous decades they demonstrated against virginity tests for Asian women, carried out to check if they were really brides-to-be. And again against the law which denied foreign-born wives legal status for years. And again when the National Front marched through Southall.
propecia dosage Mark Steinberg of Excel Sports Management, the agent for Woods, was so incensed by Chamblee's column that he released a statement to ESPN.com that accused the analyst of a desperate attempt to garner attention. In an interview with ESPN.com, Steinberg said he would "have to give some thought to legal action."
para que sirve sumatriptan 50 mg "The Fed is still likely to taper next week or in Octoberbut the trajectory of the tapering that we had assumed can nolonger be taken for granted," said Ned Rumpeltin, head of G10 FXstrategy at Standard Chartered Bank.
How would you like the money? femmed.com.pl Cook had a lot of questions, and the episode also prompted him to fast-track his thinking on the future direction of the critical phone and tablet software known as iOS, a person close to Apple recounted.
blog.imedicina.com.br The deal ends a bitter takeover saga in which Elan rejected three hostile bids by US investment firm Royalty Pharma amid injunctions, court hearings and a war of words in which Royalty Pharma said Elan was only worth $13 per share because of its "high risk strategy of hastily arranged and value destructive acquisitions".
buy prescription drugs online safely And for the reflexive Obama critics who dismiss the idea that his threat of U.S. military force was unrelated to Syria's sudden – if questionable – willingness to give up its chemical arms, what was it then? Just remarkable timing?
mgc pharmaceuticals subsidiaries An Asian American watchdog group has panned the upcoming series, 'Dads,' for scenes they deem offensive – including one where actress Brenda Song dresses up like a 'sexy Asian schoolgirl.'
acheter sildigra There will be — there will be some ongoing costs associated with these products. And in, I mean, obviously, part of the idea of the products is, as far as possible, to exploit the underlying and existing and paid-for high-quality journalism from our newsroom. But there will be some ongoing continued costs associated with continuing to offer these products.
I'm in a band levitra 20 mg precio argentina In fact this assault is different to most that have gone before. Al-Shabaab came prepared for a long siege as opposed to a short sharp bloody attack. It seems their goal was to take control of an easily-defendable position with hostages to buy themselves the time to stage a propaganda coup. In a normal siege those surrounded are prisoners, ringed by security and only able to speak to those in authority. This group came prepared to wage propaganda war, continually tweeting via Twitter all throughout the siege to its supporters worldwide. It is the first known use of this social media in this way by terrorists.
beta sitosterol hair loss facts Rowe, who has rarely spoken publicly about Jackson, said the King of Pop was treated for several ailments, including lupus and severe scarring from burns on his head. She cried during parts of her testimony.
cena cialis 'In using Safari, the plaintiff accidentally misspelled "facebook.com" which lead him to "f***book.com" and a host of web sites that caused him to see pornographic images that appealed to his biological sensibilities as a male and lead to an unwanted addiction with adverse consequences.'
http://www.meddev.info/_documents "My confidence would be in betting on ownership here, because their intent is always to compete for a championship," Cashman said. "What took place this year, it could have been easy for them to give up and say, 'There's no chance.' They had no interest in doing that. They obviously had every interest in trying to not only keep us relevant but qualify for the playoffs and make a run at the championship."
clotrimazole otic medscape Shepherd said authorities became aware of the ongoing contact earlier this month, when the alleged victim's father contacted them after finding out about the ongoing contact. Sheriff's detectives then examined the iPod and found lewd photographs and a video of Hunt.
I can't get through at the moment protocolsupplements.com Children should be supervised while eating, and should never run, walk, play or lie down with food in their mouth, the AAP says. Parents and caregivers should be familiar with techniques to rescue their children if choking does occur.
kamagralondon.com I have spent the last 10 years having to deal with eczema. I was then told to try a homeopath and haven't looked back since. I have in effect saved the NHS quite a bit of money as i do not need to see my GP continuously anymore or need to have repeat prescriptions for steroid creams. I think people that don't think that homeopathy works obviously have never been in the situation where you will try anything to make themselves feel better. I did actually think that this would not work when i first went and was a bit sceptical but was willing to try anything and now i haven't got a bad word to say about homeopathic medicines.
super p force usa He revealed he is no longer able to touch-type, because his left arm is "no good any more", and was obliged to use the "terrible" voice-recognition software Dragon Dictate. As a result, a mistake has crept into the book: "Where I had talked of Scots waving Saltires, it appears as 'sole tyres', for which I apologise."
comprare viagra su internet sicuro Backed by Norway's Altor, Cercley said Rossignol had abetter chance of elbowing its way into an outdoor clothingmarket crowded by brands such as The North Face, Patagonia,Columbia and, at the high-end, IPO-candidate Moncler.
dutasteride precio peru She said: "We've heard today that he was driving home within the speed limit and in the correct lane when Jessica Christie-Sturges, for reasons unknown, apparently lost control of the vehicle she was driving and drifted into Robert's lane, hitting his car."
Cortez says:
We used to work together vitalex drug One of the biggest culprits for those lost hours is when customers are forced to repeat their story, over and over again, to different customer service representatives. The Kana survey found that during their most recent complaint, 69 percent of customers said they had to repeat themselves multiple times before reaching a resolution. Indeed, reaching a resolution took an average of three tries. Almost two in 10 customers went so far as to call their experience a "customer service death spiral," requiring at least an hour of repeated explanations.
buy fluticasone/salmeterol Terms of an agreement have yet to be finalized, but thecompanies are negotiating a price of $130 per share, or nearly$9.5 billion based on shares outstanding. Onyx has indicated itwould likely accept a deal at that price, the sources said.
antihistaminique sans ordonnance zyrtec Michael Morell, the deputy director of the Central Intelligence Agency, turned in his resignation on Wednesday, the same day President Barack Obama appointed him to become a top intelligence adviser to the White House. His retirement will not prevent him from serving in this advisory role.
champix kostenlos "I just couldn't locate anything," Harvey said. "I tried to go in and it was over the middle. When I tried to go away, I was yanking it, and against a team like that, when you are not hitting your spots and making quality pitches, they are going to put it in play.
huizhou foryou medical devices co A spokeswoman for Scottish Women's Aid said: "We have significant concerns about why domestic abuse continues to be routinely prosecuted in summary courts and intend to raise this with the Scottish Government and the Crown Office."
We'll need to take up references core alpha bodybuilding The military has installed an interim cabinet and promised a new election under a constitution now being amended to replace one drafted last year by a body dominated by Islamists and approved despite objections from Christians and liberals.
dr oz male enhancement Ibragim Todashev, 27, who has been identified as an acquaintance of Tsarnaev from their days as mixed martial-arts fighters in Boston, told investigators Tsarnaev participated in the murders of three men found stabbed to death in September 2011 in an apartment in Waltham, Massachusetts, according to the filing.
stallion pharmaceutical Detroit, a former manufacturing powerhouse and cradle of theU.S. automotive industry and Motown music, has struggled fordecades as companies moved or closed, crime became rampant andits population shriveled by about 25 percent in the past decadeto 700,000. The city's revenue failed to keep pace withspending, leading to years of budget deficits and a dependenceon borrowing to stay afloat.
black 3k male enhancement Clearly U.S. govt services hasnt shutdown within the sending of Mr Kerry upon more missions of threatening global terror and instability, whilst back in his own country,(on another continent) memorial sites for another questionable Corporation directed, foreign misadventure, sees Vietnam Vets unable to reach their very own memorials for their very own personal Hamburger Hills!
harga cefixime kapsul 100 mg NEW ORLEANS, Oct 1 (Reuters) – BP Plc unnecessarilydelayed the capping of its Macondo well and worsened the extentof the 2010 Gulf of Mexico oil spill through dithering andindecision, according to allegations by plaintiffs' lawyers onTuesday that the British company denied.
magic story very thanks ghr1000 supplement Karen Hinton, who works for top Albany lobbying and consulting firm Mercury Public Affairs and whose husband, Howard Glaser, is Cuomo's director of state operations, is organizing the Sept. 16 fund-raiser at her firm's city office. Hinton had been the firm's managing director but is now listed as "of counsel."
data.medience.co.jp Although many details of the new school are still to beironed out, students in subsequent years will pay tuition of $10,000 a year along with about $19,000 annually for room andboard – still well below the cost of many other top U.S.universities that can run upwards of $50,000 and $60,000 a year.
nu life therapeutics Britain's Financial Conduct Authority (FCA) said in June it was examining allegations banks had manipulated foreign exchange benchmarks by trading ahead of their own customers' orders, a practice known in the markets as "front running".
illegal prescription drugs Brazil "will demand explanations from Canada," said Rousseff, via Twitter. Because many Canadian companies are active in Brazil's mining industry, the spying could be a clear case of industrial espionage, Rousseff said.
profusion organic protein bread For the second year in a row, Microsoft Corp. directors awarded Chief Executive Steve Ballmer a smaller-than-projected bonus, this time because he fell short of his own goals and the company's finances slipped.
Garrett says:
Nice to meet you average renovation cost per square foot nyc The scientists analyzed the genomic data by focusing on more than 500,000 genetic markers called single nucleotide polymorphisms (SNPs). Each SNP represents a single variation in the DNA sequence at a particular location within the genome.
salbutamol syrop cena HTC Chief Executive Peter Chou, the driving force behind its award-winning handsets, has temporarily handed some of his duties to the company's chairwoman in order to focus on innovation and product development, the Financial Times reported on Monday.
noble drug store discount code "I can understand the need for a government to protect itself, but when you go ahead and stomp on everyone's civil liberties – as we've seen with all the mass surveillance stories that have been out over the past year – I think you can rest assured that you're going to repel talented people," he said.
duluthcathmed.org Due to high gas prices, electricity generation moved further from gas to coal in 2012, accounting for the highest share of generation at 39%. The share of nuclear remained unchanged at 19% despite a slight increase in generation.
sports.healthxtourism.com But the Warsaw-based agency, which coordinates and develops border management and joint operations, has seen its budget fall over the past three years and relies on donations from member states for ships, helicopters and other equipment.
I'm not sure how to know if you are addicted to prescription drugs Contemporary thriller Gone Girl, by Gillian Flynn, J.K. Rowling's The Casual Vacancy, and four books about or by celebrities – Bradley Wiggins's My Time; Cheryl Cole's My Story; David Walliams's Camp David; and Dawn French's Oh Dear Silvia – also made the top 20, as did F. Scott Fitzgerald's classic The Great Gatsby – clearly enjoying a resurgence following the release of a new film adaptation.
where to buy vitrix Why is it, then, that annuities languish as a retirement product? Is there any way the nation's widely projected retirement shortfalls can be addressed without turning to this product or something similar to it?
testofen xt review With flat-screen televisions replacing the bulky counterparts of the past, the number of children injured from televisions tipping over has nearly doubled in the past two decades, according to the study.
diem duroil malaysia Mark Post, whose team at Maastricht University in the Netherlands developed the burger after five years of research, hopes that making meat in labs could eventually help solve the food crisis and fight climate change.
germany sex drops shah alam "Our central bank and other relevant institutions are takingthe necessary steps in a timely fashion in coordination and withdetermination to minimise the negative impact of thesedevelopments which are affecting all emerging markets," it said.
Through friends buy tamoxifen uk Like: Haloti Ngata disguised as a giant sun (talk about playing the fool) for Thompson Creek Windows. John Gruden for Hooters, Jarod Mayo for Old Spice, and the Manning Brothers ("football on your phone") for DirectTV.
low dose anadrol-50 Meanwhile, three of those convicted for the mensalão still hold seats in Congress, including Jose Genoino, who was president of the ruling Workers' Party when the scandal erupted, and João Paulo Cunha, a former speaker of the lower house.
ramsaysimedarby.com At £170, they're around £90 cheaper than the over-ear Momentums, but still sound fantastic and are comfortable to wear. These are the best on-ear headphones we've ever heard. However, for long-term listening sessions at home, we found the over-ear design and slightly flatter sound of the full-sized Momentums just that little bit more comfortable.
hd special ops glasses Sure for Mo Farah, Usain Bolt and Jessica Ennis-Hill, the roar of recognition when they were introduced to the crowd must have re-tingled the spine. But for the corporation there was an even more poignant sense of longing for those now lost days when it was reporting from the heart of the sporting world.
ginseng ginkgo biloba While many children were aboard the plane and have been treated, many appear to have escaped the severe kinds of spinal injuries seen in the adults, Manley says. "Most of the severe injuries were in adults," he said.
Could you ask her to call me? where to buy orlistat (xenical) "It will be vital for Iran to live up to the standards that other nations that have nuclear programs live up to as they prove that those programs are indeed peaceful," he said as the two started meeting at the U.S. ambassador's residence in Rome.
cloridrato de ciprofloxacino 500mg ems bula Former world number one Watt, who was runner-up to Briton Greg Rutherford at the London Games, said he would not be able to compete at his full potential in Moscow in August and needed more time to get back to full fitness.
pharmacie silvie – totum pharmaciens Recent studies have shown that rising water temperatures from climate change have increased the risk of Vibrio vulnificus infection in higher latitudes, especially the northern European countries that surround the Baltic Sea.
medphano.de The indictment also includes 512 counts of kidnapping, 446 counts of rape, seven counts of gross sexual imposition, six counts of felony assault, and one count of possessing tools such as a Ruger handgun.
consultorio.unimeds.com.br "I saw it on the schedule a long time ago," he said, "but I just assumed I wouldn't pitch because I'd be getting ready to make a playoff start. Even now it's kind of hard to believe this is it for us."
Porter says:
The National Gallery william murray pharmacy The attackers threw the acid on the women's faces and arms as they were walking, said Mkadam Khamis, a police commander on the island. The attack took place Wednesday night in an area of the island's capital city known as Stone Town, an area popular with tourists.
best website to buy clomid "The evidence we've gathered suggests that hundreds of people died in military custody in 2013 alone. This is a staggeringly high figure that requires urgent action by the Nigerian government," Lucy Freeman, Amnesty International's deputy Africa director, said in a statement.
lso medical meaning The São Paulo-based bank was "surprised" by the leak ofinformation that the Federal Revenue Service wanted back taxesrelated to the merger that created Itaú Unibanco five years ago,Claudia Politanski, Itaú's senior vice president for legalaffairs, said in a telephone interview on Friday.
order cheap high t black NEW YORK, July 19 (Reuters) – U.S. stock index futures weremixed on Friday, after the Dow and S&P 500 closed at recordhighs a day earlier, in the wake of disappointing results fromtech giants Microsoft and Google.
antibiotico cephalexin 500mg "The fans have been asking a long time for a book, so we just decided we'd be able to do a book on what we do on a regular basis," said Shannon. "Alana actually came up with the catch phrase, 'Performed by a Redneck: Unless you're a redneck, don't try this at home.'"
Cristobal says:
I saw your advert in the paper tedor pharma stock That reality is beginning to dawn in the federal government, which allowed this year's $72 billion round of cuts to take effect. Officials have a few months to try to replace an even deeper round of cuts expected to take effect in January.
compounding corner pharmacy sugar land tx "The coaches are saying we should think team first, but this is just crazy," an anonymous player told Jeff McLane of the Philadelphia Inquirer. "Was he thinking about the team when he said that?"
overnightfioricet.com "We see this merely as a delay of the M&A angle … that should materialise at some point in the future," BPI said in a research note, adding that it does not rule out another party trying to buy Campofrio in the meantime.
ordine dottori commercialisti vicenza albo Private companies are now only allowed to solicit investors deemed to be "accredited," meaning they have a net worth of $1 million, excluding the value of their home, or an individual annual income over $200,000. The crowdfunding rule would let small businesses raise over $1 million a year by tapping unaccredited investors.
super filagra india Snowden's leaks about U.S. spy methods, includingeavesdropping on global email traffic, have upset Washington'sfriends and foes alike. Stuck at Sheremetyevo airport with hispassport revoked, he has become an irritant in relations betweenthe United States and Russia.
Coolman says:
Who do you work for? is it safe to take 2 ibuprofen every day Other accounts, though, are firm with their figures and it would be better to live from the savings lost down the back of a sofa than risk breaching the overdraft limit. Do so and you face huge charges: RBS and Natwest charge £6 per day and £6 per item (up to £60 worth in a charging period). The way these charges rapidly stack up, it can be almost impossible to escape the debt.
what does prescription drugs do to the brain Participants discussed how best to communicate the Committee's approach to decisions about its asset purchase program and how to reduce uncertainty about how the Committee might adjust its purchases in response to economic developments. Importantly, participants wanted to emphasize that the pace, composition, and extent of asset purchases would continue to be dependent on the Committee's assessment of the implications of incoming information for the economic outlook, as well as the cumulative progress toward the Committee's economic objectives since the institution of the program last September. The discussion centered on the possibility of providing a rough description of the path for asset purchases that the Committee would anticipate implementing if economic conditions evolved in a manner broadly consistent with the outcomes the Committee saw as most likely. Several participants pointed to the challenge of making it clear that policymakers necessarily weigh a broad range of economic variables and longer-run economic trends in assessing the outlook. As an alternative, some suggested providing forward guidance about asset purchases based on numerical values for one or more economic variables, broadly akin to the Committee's guidance regarding its target for the federal funds rate, arguing that such guidance would be more effective in reducing uncertainty and communicating the conditionality of policy. However, participants also noted possible disadvantages of such an approach, including that such forward guidance might inappropriately constrain the Committee's decisionmaking, or that it might prove difficult to communicate to investors and the general public.
reddit ibuprofen "After having to dedicate significant man hours getting insight out of a number of unwieldy databases, the Clinical Research Network now has the ability to get a full view of study metrics in one central, easily accessible location," QlikTech said.
finehealthcheap.trade "This has important consequences for modeling the solar dynamo," said Zhao. "We hope our results on the sun's interior flow will provide a new opportunity to study the generation of solar magnetism and solar cycles."
pharmamax mayaguez numero "Here's my team sitting there, after they are just charging and making a comeback, and then they have to sit," Mallon said. "And so, not only does it change the psyche of my team, but it changes the psyche of the other team, because they can have time to regroup."
Where's the postbox? mates discount pharmacy lavington As Gretl, Sarah Huttlestone – just eight years old – proved to be a formidable scene stealer. I'd be surprised if she didn't one day become a big West End star – quite possibly, when this production makes its inevitable West End transfer.
custom rx pharmacy brookfield NEW COLUMBIA, Pa. — A Greyhoud bus plowed into the rear of a tractor-trailer early Wednesday on Interstate 80 in central Pennsylvania, killing a woman passenger and injuring 44 others, state police reported.
where to buy semenax in south africa If there was ever any doubt about what happened to the only U.S. Navy ship that is being held by a foreign government, North Korea has cleared it up. It's in Pyongyang. And it looks like it's here to stay.
drugstore cowboy online sehen He headed back to Washington on Wednesday after basking in the glow of his re-election together with thousands of elated supporters at a victory rally in his hometown of Chicago in the early hours of the morning.
cost of cymbalta in canada "I tried to give the letter back to him but he didn't want it. This closure made him suffer greatly. Each time I saw him, each time I came to his place or when he visited me, this was the only topic of conversation," said union representative Frédérick Gillot.
Isidro says:
Is this a temporary or permanent position? alpha fuel xt negative reviews Chemicals experts were overseeing a second day of work on Monday, which the official described as similar to Sunday's when Syrian forces used cutting torches and angle grinders to render missile warheads, bombs and mixing equipment unusable.
hydroxyzine mg/kg WASHINGTON—The Senate on Thursday confirmed Jason Furman to a top post in the White House, elevating one of President Barack Obama's closest advisers, as policy makers wrangle through budget discussions.
medica iq One up, one down. Saint Patrick Rooo-Ahhh led his Avalanche to another win, beating the Stars last night, 3-2. Unfortunately, the Tigers could not push a run across against the Red Sox, and came up on the short end of a 1-0 score. Picked up half a Benj on the Avs, dropped $72.50 in Motown, leaving a $22 negative for the day. After pressing the proper buttons, the calculator says that $1940 is the current figure, and you KNOW where the extra 50 cents will go.
green dragon pills The honour of taking the torch outside the station on November 9 will fall on Russian cosmonauts Oleg Kotov and Sergei Ryazansky, who went up to the station together with NASA's Michael Hopkins on September 26.
25 mg fentanyl patch cost Iranian officials have said they expect gas exports to Oman to start inunder two years, but Rumhy has said it is unlikely construction of thephysically challenging subsea pipeline could even start in that time.
Laverne says:
Hello good day kimiya-pharma.com Alternatively, they could force a debt restructuring whichmight allow them to take equity in return for writing off theloans. Other types of investors are thinking up new types ofdeals, including charging a premium to lend to companiesrejected by the banks.
where to buy acyclovir zovirax famciclovir famvir and valacyclovir valtrex The Rangers assigned the following nine players to the AHL's Hartford Wolf Pack: goalie Cam Talbot, defensemen Tommy Hughes, Aaron Johnson, Dylan McIlrath and Danny Syvret, and forwards Micheal Haley, Michael Kantor, Danny Kristo and Andrew Yogan.
omeprazole ratiopharm 20 mg cena (Additional reporting by Dasha Afanasieva in Istanbul, Roberta Rampton and Jeff Mason in Washington and Jack Kim in Seoul; Writing by Alastair Macdonald and Claudia Parsons; Editing by David Stamp and Tim Dobbyn)
metformin hcl 500 mg tablet picture * Prime Minister Stephen Harper is girding for the nextelection with a huge cabinet shuffle that enlists and promotesyounger ministers to fashion a team he can take into an expected2015 campaign. ()
cytomel t3 dosage weight loss Revlimid, with 2012 sales of $3.8 billion, is Celgene'sflagship blood cancer drug and is already approved for use invarious types of blood cancer, including multiple myeloma andmantle cell lymphoma.
I'd like to transfer some money to this account 4rx.mx Conversations about sexual activity should start before a patient leaves the hospital, and continue throughout the rehabilitation process. Because the patient's partners often have concerns as well, they should be included in sex counseling, the guidelines say.
svhealthcare.org/portal Netanyahu will be looking for proof of Obama's commitment to confront Tehran with a "credible military threat" if diplomatic efforts fall through. Obama has insisted he is not bluffing, but has not been as explicit as Netanyahu wants.
stgmed.com Labour is looking for a less statist solution. The party's thinkers are considering introducing school commissioners, who would scrutinise new foundations, and encourage schools to link together in networks. (Labour is not convinced that competition is the main driver of standards in education.) All these ideas are circulating in a policy review led by David Blunkett, which will report next year.
zovirax goodrx CP All is scheduled to hold a shareholders' meeting toapprove the bond plan on Thursday. ($1 = 31.7500 Thai baht) (Reporting by Manunphattr Dhanananphorn; Writing by KhettiyaJittapong; Editing by Miral Fahmy)
orlistat xenical price philippines Aronson said "Turbo" had "very strong openings"internationally, and an A-plus Cinemascore rating frommoviegoers under age 25, which he said "bodes very well for itsplayability," or future box office prospects.
Lawerence says:
very best job gabapentin for anxiety webmd Federal prosecutors insisted his arrest last September had nothing to do with the film's content but with conduct that violated the terms of his probation, such as his use of aliases and the Internet, in the course of making the video.
para que sirve kamagra gel oral The President called the House leaders into his office to tell them "Check and Mate, game, set and match". "You lost and you don't even know it". "YOU WILL GET NOTHING". Then, when The Boehner starts sniveling and crying, Obama will tell them to go back to work and send up a clean resolution, hostage taking is over, the ransom will not be paid. He will call Ted Cruz over to his desk to where he has a trap door waiting to spring and the Cuban-Canadian will never be heard from again. Humiliated, the GOP House members will run to Fox News to spin their utter defeat into a bizarro world fantasy. Then America can get back to work.
generic vs brand name drugs list The Enterprise Group is HP's largest business unit after personal computers, and is a critical component of Whitman's efforts to boost margins and profitability, while trying to minimize revenue declines.
penomet pump review Probably because our Reuters group had a Korean American journalist, we got "special treatment": two minders. One was a meek translator with no experience (I will refer him as Minder M) and the other a gruff chap (Minder G), who later turned out to be the head of a surveillance team assigned to the journalists' shuttle bus. Upon our arrival in Pyongyang, I received a friendly warning from both of them: Please check with us before you take any picture.
highrisepills.com "We should be able to get you involved in a weapons transaction within 30 minutes," Torrez said, sitting at his computer with van Zeller. "And that's travel time, too. Using the Internet, it's very easy to purchase a weapon here in Arizona."
Free medical insurance order viagra online canada The judge in George Zimmerman's murder trial has ruled that jurors can know that Trayvon Martin had marijuana in his system when he was shot and killed by the accused in a gated community in Florida last year.
affordable bathroom renovations sunshine coast Hensarling's panel passed his bill in July, setting thestage for a vote by the full House. The Senate Banking Committeein July approved a bipartisan bill that would set a floor onpremiums the agency charges and require it to hold more money inreserve.
affinityehealth.com If Carl Icahn's decision to sell is proven to be the right investment call and Netflix's shares fall, both father and son will see their profits from the investment pared, given they still own 2.67 million shares, or a 4.5 percent stake. There will be no additional penalty for his son's funds if the share price falls below the Icahn selling price.
celexa side effects drugs.com The rest is smuggled by truck to China by so-called "jockeys" through territory belonging to either the Burmese military or the Kachin Independence Army (KIA), both of whom extract tolls. The All China Jade Trade Association, a state-linked industry group based in Beijing, declined repeated requests for an interview.
zugmed.com "We are optimistic that Telecom Italia can be worthsignificantly more and be a better part of the Italian economyin its next phase of life," Bernstein analyst Robin Bienenstock,who rates the stock "Outperform" and has a 1 euro price target,said in a note.
Kendrick says:
I'm in my first year at university when does the costco pharmacy open The long-haired maverick entrepreneur has become one of theworld's most recognizable businessmen, and is also known for hisother ventures in deep-sea submarines, an effort to circumventthe globe in a hot air balloon, and suborbital space travel withVirgin Galactic.
free viagra by mail going high is not going to get you fined its leading with your helmet that gets the fine, so going low leading with your helmet should get the same a helmet to the knee should be at lest a fine and or suspension what happen to wraping up, the helmet is for protection for the player not be use as a weapon against them. So wrap up it could be you. It is your lively hood, Texans teach this young man to wrap up that explanation was Crap!
when does atorvastatin come off patent in uk "We are calling for their immediate and unconditional release of this team which was delivering humanitarian assistance to those most in need – and we do that on both sides of the frontlines," he said.
clintonhealthaccess.org/jobs BTW, once the US goes to a Canada style system, you will get the Canadian style quality, wait and doctor shortages, so a $6,000 premium today doesn't get you the care the $6,000 taxes under a Canadian system.
food pavilion pharmacy east wenatchee "There is no reason to think that suddenly in his 70s he started acting inappropriately with children," said David Clohessy, national director of SNAP, the St. Louis-based Survivors Network of those Abused by Priests.
Some First Class stamps when to take levitra for best results "At the beginning you have to run under control," he said. "I don't agree with 'don't run hard' because you always run hard. … If it's a two-hopper to first base and he's two feet from the base, you don't run as hard as you can. You have to run under control."
pillsonline.biz Westports will expand capacity by 68 percent to 16 millionTEUs, in part to comply with requirements from the Malaysiangovernment before it extends the company's concession by 30years to 2054. Gnanalingam said Westports will tap debt marketsto fund growth.
pro supps karbolic nutrition facts The clueless dad was not aware of all those transactions until he realized that his bank account was finally frozen. He was too busy with work to give attention to the notifications sent by Apple through email about the purchases made on his iPad. As it turned out, Lily spent that much amount from March to July.
buy testofuel The airlines have vowed to fight the lawsuit and argue that their union would actually make the market more competitive. Other airlines have been allowed to merge in recent years including United/Continental and Southwest/AirTran.
bioscript pharmacy One of those programs is a database of telephone "metadata,"including numbers called and the length and time of calls, goingback seven years. U.S. officials said they had used the databaseonly in limited circumstances and that it had proven essentialto stopping attacks against civilians.
I have my own business pharmacyonesource forum A competing information provider, Cattle Fax, expects an increase in demand for its reports on the beef industry if the shutdown persists, senior market analyst Kevin Good said. The member-owned organization, formed by cattlemen in 1968, claims to have the largest private database of beef data in the country.
sun pharma share price fall That has given traders and investors the fuel they need to look beyond other Fed debates about the labor market and the potential economic impact of budget cuts, also revealed in the minutes, and to continue unwinding bets that have been the biggest beneficiaries of the Fed's easy-money era over recent years.
footsmart It all adds up to an amazing feast of high-octane entertainment that no one with even the slightest interest in cars will want to miss. Size certainly counts when it comes to the Silverstone Classic.
http://www.pharmweb.net/gmp.html In rejecting Condamin-Gerbier's appeal against being held, the federal criminal court in Bellinzona said in a statement that custodial measures were appropriate given the weight of evidence against him and the risk that he could try to leave the country. The Swiss federal prosecutor's office said Condamin-Gerbier was being held in prison but declined to say where.
zenerx real reviews "He's funny," says the guitar-slinging Bromberg, who plays at City Winery on Tuesday. "The first time we talked, he told me he wanted to ride on my tour bus and meet hot chicks. Boy, will he be disappointed."
Gayle says:
I'll send you a text st mary prescription pharmacy "These exchanges are going live today with too many unanswered questions and too many unsolved problems," Orrin Hatch, a Republican senator from Utah said in a speech on the Senate floor. "The Obama administration should have acknowledged the ample warning signs of problems in the exchanges and heeded the many calls for delay."
metoprolol carvedilol heart failure Ah, what changes in the space of one generation – there was no talk of paternity leave when William and his brother were born. Does this mean dad's royal duties will now include getting up during the night to mix the formula and deal with nappies?
ornidazole kaufen Henderson entered the market as a restricted free agent, but now will head back to Charlotte for the only pro team he's ever known. Henderson averaged a career-high 15.5 points per game for the Bobcats last season on 44.7 percent shooting. He also tallied 3.7 rebounds, 2.6 assists and 1.0 steals per game. Henderson's biggest improvement may have been at the three-point line. After never shooting better than 23 percent from deep, the 25-year-old swingman set a career mark by hitting 33 percent of his triples.
lifeextension.com super sale Records show that Concerned Home Care Providers also has been paying an influential Albany lobbying firm that boasts Michael Avella, a former Senate Republican counsel, and Brian Meara, who has strong ties to Assembly Speaker Sheldon Silver, a Democrat.
longinexx how long does it take to work The cause is rooted in greed and purchase of any cheap goods is only the "temporary-result" of this greed and less to do with the "cause". This cause too, runs its course, where it will meet its end in this self-correcting system, with an outcome such as the following –
Quincy says:
Where are you calling from? medicinska naklada radno vrijeme "This extreme policy-making volatility has discouragedinvestors and is a serious disincentive to global miningcompanies," said Aly Khan Satchu, a Nairobi-based analyst whowas at the conference where Balala spoke.
cosrx triple c lightning liquid australia "Despite the best efforts of Europe's health community, the long phasing-in of the proposals contained in the Directive shows extraordinary efforts by the tobacco industry to obstruct and delay plans to reduce the number of people who smoke."
telmisartan 40 He had been at the Manhattan zoo since 1988, when he was 3. He was born at the Toledo Zoo in 1985 and left for the Philadelphia Zoo shortly after he was weaned from his mother. His parents, Nanook and Snowball, both died in 1996 at the Toledo Zoo, according to The Blade archives.
does penatropin have permanent results The pan-Arab Al-Arabiya TV is showing images of collapsed tents and burning tires at the Nasr City protest site. Ambulances are also seen at the scene, as well as some protesters being arrested and led away by the troops.
ainslie bluebell pharmacy "I would warn those intent on engaging in violence on our streets to think through the consequences of their actions," he said. "My message is clear; do not get involved in rioting on our streets, but if you choose to do so then be prepared to face the courts within hours."
Jonny was here metoprolol receptors Who is giving her death threats I wonder? People who are against violence and guns? I highly doubt there would be threats against her. Sounds like she is a tad paranoid. I have noticed a lot of pro gun advocates who seemingly act the same way. Her husband is one of them.
http://www.pharmedx.com Chinese solar panel production quadrupled in 2009-11 to 55GW as it took advantage of renewable energy market growth amidconcerns about climate change. But the global financial crisisand euro zone paralysis forced EU governments to withdrawgenerous industry subsidies. That, along with cut-price Chineseimports, pushed many European solar firms into bankruptcy.
lexicon medical supply company cleveland ohio Ship and aircraft have for months played a cat-and-mouse game near the islands, known as the Senkaku in Japan and Diaoyu in China, boosting tensions, with Chinese ships venturing in and out of what Japan considers its territorial waters.
escitalopram official site A guilty verdict and long jail sentence remain the most likely outcomes, but authorities are taking longer to deal with the confident and articulate man at the heart of China's biggest political scandal for decades.
cheap viagra pills london uk Currently, the 16 GB model of the smartphone costs around Rs 25,000 in India but since the Rupee is tumbling against dollar every day (at the time of writing it was 68.70 against Dollar), LG or Google may not have the elbow-room to reduce its price further.
Are you a student? icarepharm.in On Sunday, police found the body of Hannah's mother — 44-year-old Christina Anderson — when they extinguished flames at DiMaggio's rural home. A child's body also was discovered as they sifted through rubble in Boulevard, 65 miles east of San Diego.
royal care pharmacy new york ny 10029 In this week's photos from around New York, a fire devastates Seaside Heights, a Greenpoint restaurant hosts a silent dinner and activists mark the second anniversary of the Occupy Wall Street movement.
e-gopharm24.de The school district in question took a group of 7th graders on a field trip to a camp in Massachusetts where, on the 3rd night of the trip, they were instructed to reenact slavery, complete with hurling "n-bombs" at their fellow classmates and told to do chores that slaves would have done back in the day.
gamma labs g fuel side effects Wayne Hemingway said: "What better place than Southbank Centre, home of the 1951 Festival of Britain, to host London's first classic car boot sale? Expect beautifully designed classic cars, cool caravans, vintage clothes, accessories and collectibles, evocative food trucks selling the best street food, bars and vintage vinyl DJs and all manner of vintage fun to be had on wheels."
en.medico-online.com Pakistan Prime Minister Nawaz Sharif is in the United States this week to meet with President Obama. Before going to the White House, he met with reporters and Pakistani Americans to speak on issues between his country and the USA.
What's the current interest rate for personal loans? valtrex dosage for cold sores pediatric "We'll continue support in areas like education thatdirectly benefit the Egyptian people," he added. "But we havenot proceeded with the delivery of certain military systems, andour support will depend upon Egypt's progress in pursuing a moredemocratic path."
celebrex 200 mg para que serve The first woman to head the U.S. central bank, the67-year-old Yellen is seen largely sticking to Bernanke'spolicies that are aimed at keeping economic recovery on track. AWhite House official said President Barack Obama would nominateYellen, who is now deputy Fed chief, later in the day.
misoprostol cytotec precio colombia Countries like Libya, Iraq deserve to be ruled by high profile iron-fist showmanship dictators when unrest was seldom heard of. These people just can't govern by themselves, with deep conflict in factional beliefs and interests.
female viagra webmd Syrian activists have filmed the bodies of several skeletal children who doctors said died of malnutrition. The most recent victim was one-year-old Rana Obeid, who died on Tuesday. Footage showed her with her ribs protruding and belly swollen.
rx media pharma 2014 indir In the past new Czech governments have commonly changedpersonnel, but these were formed by elected parties. This time,the Rusnok cabinet has fired between 60 and 80 officials,including deputy heads of ministries and the chief of the staterailways, without any parliamentary confirmation.
Janni says:
I'd like to change some money yas pharma "At the time these contested communications occurred,Deutsche Bank had not implemented clear rules or controls toensure a strict separation between submitters and derivativestraders," the judge said.
wiki-drugstore.com A day later, it started to rain heavily in the afternoon. My TV colleagues and I decided to go to a mass dance performance that night, although many journalists were willing to skip it, including our Korean American text reporter. As we were leaving the hotel, I found out only Minder M was with us. Before I could start to feel lucky, he began yelling at us out of the blue: "You must listen to me. Stay together!" I tried to calm him down: "Relax, this is the last event. It's going to be a simple one, very simple." I even convinced him to let me bring my laptop, so that I could file my pictures earlier.
espnfarm24.com "The demonstration CNN saw was for an identified issue that was fixed earlier this year on all network extender devices," the company said in a written statement. "The fix prevents the network extender from being compromised in the same manner."
clomid days 3 7 late ovulation Dominican Republic Immigration Director Jose Ricardo Taveras, who has long warned of the "Haitianization" of the nation, welcomed the controversial ruling and told the Associated Press, "Far from remaining in limbo like some critics are arguing, (they) will for the first time benefit from a defined status and identity without having to violate the law."
tribestan vita atsauksmes Kazakhmys's closely watched core profit, however, missedforecasts, even after gross costs – a measure which excludes theimpact of by-products like gold and silver – rose a modest 5percent, prompting the group to lower full-year inflationguidance to 5-8 percent from an increase of up to 12 percent.
Keven says:
Will I be paid weekly or monthly? edmedihelp.com Wyshak has pursued the case against Bulger for two decades. He will have to review a mountain of evidence, including testimony from about 70 witnesses. He also will have to go over the charges: 32 counts in all.
color doctor australia Nine investment analysts have rated the stock with a sell rating, eleven have assigned a hold rating and eight have assigned a buy rating to the company's stock. The company currently has a consensus rating of Hold and an average price target of $16.96.
fire in the belly sam keen pdf Djokovic, a four-time runner-up on the Cincinnati hardcourts, had been eager to take the final step this year and become the first player to complete what the ATP Tour has dubbed the Career Golden Masters by winning all nine World Tour Masters titles.
zyflamend uses LONDON, Aug 1 (Reuters) – Temporary power provider Aggreko reported a rise in first-half revenues on Thursday butgave a cautious outlook as cash-strapped governments remainedhesitant to commit to spending, and its shares fell more than 5percent.
medic air systems florida The decision came as U.S. officials, including the Americanambassador in Brasilia, sought to reassure Brazil that O Globoreports on Sunday and Monday about NSA surveillance of Braziliancommunications were incorrect.
Sidney says:
We used to work together pro complex amazon The first iftar of Ramadan is traditionally spent with family, so El-Sayyed talked his father into bringing the whole clan down to the mosque rally — a move clearly followed by thousands of others as families picnicked around them.
http://www.acesportsmedicine.com.au Gumbinger's body was found Wednesday morning after a caretaker suspected something was wrong inside the woman's house and called police. An autopsy Thursday determined that Gumbinger died from multiple injuries inside the home she'd lived alone in since her husband's death in 2007.
wellbutrin xl 450 mg day The late-night blast ripped through the Classico Cafe in Kirkuk, 290 kilometres (180 miles) north of Baghdad, as patrons were enjoying tea and water pipes hours after the sunset meal that breaks the daylong Ramadan fast, police officials said.
st john pharmacy 21 romeo plank Any pleasure we derived in those days was in spite of, rather than thanks to, those in charge of the game. Our enjoyment came from communality, the shared sense of resistance, of sticking it to The Man.
deer antler spray for working out Simon Ringrose, from the Crown Prosecution Service, said: "Following an investigation by Cambridgeshire Police, we have decided that Hugh Mennie, who ran as a Ukip candidate in a local council election in May 2013, should be charged with making false statements in a nomination form.
This is the job description promescent work A study by Professor Sir Brian Jarman, the world expert on hospital performance, calculated over the past three years there had been 526 "excess" deaths at the trust over the last three years, above what would be considered the norm.
http://www.kirkburtonhealthcentre.nhs.uk "In the last few decades there has been some success at reducing fleet size and the number of days that vessels fish for. But that has to stay that way – if you don't do that things will just deteriorate to where they were in the past.
1xu.net Indeed, this has already happened at Trelai Primary School; this week the children will be taken to The National Library for a free trip to see their painting in an exhibition of landscape artists.
almehealthcoach.com The two sides hope to conclude the deal by Obama's arrival, but a senior Philippine military officer familiar with the negotiations said this was looking unlikely. "There are some legal issues they have to untangle," he said, speaking on condition of anonymity.
viviscal hair filler fibers black "Like many foundations, we were hit by the economic slowdown in 2007 and the crash in 2008. Thankfully, we had the cash reserves to cover our largest budgets, in our HIV/AIDS, malaria, and health training programs, and we decided to do it because so many lives were at stake," Clinton said. "For 2012, the reported deficit of $8 million is incorrect, and was based on unaudited numbers included in our 2012 annual report. When the audited financials are released, they will show a surplus."
I don't like pubs healthspace.eu A capital allocation of £52m will also support a number of other Health projects, including £1m for a paediatric centre of excellence at Daisy Hill Hospital, £1m for a paediatric ward and ambulatory care unit at Craigavon Area Hospital and £14m to address elective care waiting times.
epharmacy.com.gr The only media I have seen sympathetic to Putin's op ed is RT television. US media not only doesn't know, it doesn't even suspect, that it is much like Pravda and Izvestia in the days of the Soviet Union.
pxlpills.com According to the plea agreement, Kwiatkowski was fired from a Michigan hospital in 2004 after failing a drug test and was fired from another that year for gross misconduct. He resigned from two more Michigan hospitals while under investigation for drug use.
finaflex px ketoburn Northern Ireland leaders appealed for calm and police braced for trouble in advance of Friday's Protestant parades and bonfires on "the Twelfth," an annual sectarian holiday that always inflames tensions with the Catholic minority.
unleashed coffee "Three years ago on this very day I was in the street near the University of Tehran, and they shot a guy next to me. His blood was on this T-shirt. I also saw the guy who shot him, who must have been 17 years old," he says through a translator, adding that the shooter was working for the Basij, a paramilitary volunteer militia engaged in internal security and the suppression of dissident gatherings.
I can't stand football recipharm pharmaceuticals "Today we had a situation; we needed guys just to get one out," Collins said. "(Josh Edgin) worked multiple innings last night. We needed him tonight. He's hanging, I am sure. We needed Aardsma to get one inning. He had multiple innings last night, he's hanging.
can women use viagra for men This is the most recent example of the ongoing problem Mr Boehner has controlling the Republican caucus, especially a rebellious faction hailing from solidly conservative, mostly rural areas across the country.
simple skincare thailand "There was an honest discussion about how both governments could be productive in reducing trade barriers that have an impact on trade and commerce," he said according to a pool report. "We mean what we say when we say that the relationship between India and the U.S. has unlimited potential and there is no reason why trade, commerce and intercourse between our countries can't increase exponentially over time."
amitriptyline cost uk "I wore a hoodie to the photo shoot and all of my teammates followed me in," Seltzer said of his senior portrait. "Then I took off the hoodie and it was this grand moment where everyone burst out laughing and fell on the ground."
pharmaspecific.com What already made for bleak reading appeared bleaker still after a little probing. McDonald's budget breakdown relied on workers each receiving $2,060 a month. In actual fact, someone working full time in one of the chain's fast-food restaurants would earn only $1,105 – little more than half that figure. The other $955 would come from some other part-time job, apparently.
It's a bad line e-med.net.cn Now, though, education officials are beginning to grade teacher preparation. The city Department of Education has published the first such marks for 12 colleges and universities that provided more than half the 10,000 teachers hired between 2008 and last year. The state plans to release still broader marks by year's end.
cephalexin side effects peeling skin Fast Retailing held the guidance steady in April despitesigns the economy was picking up under Prime Minister ShinzoAbe's reflationary policies. The company derives the bulk of itsearnings from its Uniqlo stores in Japan.
epharmacy.com.gr "The only thing I can do is continue to preach it to him. I've told him once and I'll tell him again before the game 'I know it's not in your DNA, but you're going to have to find a way to run under control when it calls for it. If there's a situation where you have to run hard, you have to run hard, but you have to protect your leg and your body for a few days to get through this,'" Girardi said.
spreemo health dallas Some businesses said predictions of recovery in the secondhalf of 2013 were optimistic. Marco Milani, Chief Executive ofItaly's Indesit, said he wasn't confident of recovery in 2014and consequently was cutting back investment and shiftingmanufacturing out of Europe.
ingredients in p-boost Everyone knows that Shanahan loved working with John Elway and his incredible passing abilities back in the 90s when Shanahan coached the Denver Broncos. With the Redskins, Shanahan has a QB with talent that he's never gotten the opportunity to work with—the scrambling ability. So far, RG3 has been putting up the numbers. However, the defense is not holding out for the Redskins.
Ezekiel says:
Best Site Good Work activemedicalsupplies.com.au "DECC could help resolve this by giving developers clarity over the eligibility date, which would allow projects to start generating and using renewable heat if they have commissioned their plant within a set period," she concluded.
gabapentin used for sciatic nerve pain Here's an intriguing question. What would be worse for the Jets: The Patriots making it to the Super Bowl and practicing all week at their training facility or the Giants getting into the Super Bowl?
shop n save pharmacy florissant mo Under the simplified procedure, the Commission announces theclearance of uncontroversial first-stage mergers without givingany reason for its decision. Cases may be reclassified asnon-simplified — that is, ordinary first-stage reviews — untilthey are approved. (Editing by Foo Yun Chee)
clomid days 3 7 late ovulation There is, though, a line of thought which has it that Britain working with its former colonies grouped as the Commonwealth for sporting events, trade and a literary prize celebrates a common heritage, one that America rejected in 1776.
bovally pharmacy limavady JDS Uniphase makes instruments and test tools used to help deploy and optimize communications equipment and broadband networks for customers such as AT&T Inc, Time Warner Cable Inc and Verizon Communications Inc.
Infest says:
I like watching TV diovan amlo fix desconto novartis In 1975, Business Week ran a cover article called The Office Of The Future. In it, George E Pake, head of research at Xerox, predicted "a revolution… over the next 20 years", involving a television display terminal sitting on his desk.
fallout 4 no fusion core drain mod Thriving ecosystems tend to feature vigorous collaboration between, competition amongst, and constraints on a diverse array of institutions. From this perspective, we need more than a few competing banks, states and multinationals to keep the juice flowing. We need multiple competing institutions, groups, and even models. The key is that they have many, not just a handful, of healthy rivals and partners, along with (to return to the image of the playing field) institutions powerful and independent enough to keep leveling the field.
comprar cialis paypal Royal Navy warship HMS Westminster and two auxiliary vessels will arrive in Gibraltar on Monday morning. The visit is described by the Ministry of Defence as "long planned" and "routine", but in the current political climate the trio of vessels are expected to be welcomed by crowds of flag-waving Gibraltarians.
vswitz.com "Six key shareholders, representing 62.3 percent of thecompany's equity, are already committed to supporting L'Oreal'sproposal," the French company said in a statement, adding thatthe deal would be subject to approval from the Chinese Ministryof Commerce.
hair loss treatment without finasteride A member of Congress retiring with 30 years of service under the CSRS offset plan would get $130,500 year, though at age 62 or older, this amount would be reduced by the amount received from Social Security attributable to federal service.
We'd like to offer you the job effexor bulimia treatment "I am exactly where I want to be now. You can't go backward. I'm not going backward. I'm grateful that I'm here, blessed to have what I have. Nobody can be prepared for anything," the A-lister continued.
official kamagra uk At the end of its conveyor belt, the device spits out pellets made from cellulose fibers, which are found in manydiscarded items, like baby wipes or fruits and vegetables, saidchief executive Refael Aharon.
blog.imedicina.com.br In starting the funds, the New York-based asset manager enters a somewhat crowded market. Almost half of the 247 alternative mutual funds on the market today have been launched in the last three years, according to Morningstar Inc.
will diflucan cure jock itch After eight weeks, the ginseng group reported a 20-point score increase, on average, compared to a 10-point improvement for the placebo group, according to results published in the Journal of the National Cancer Institute.
50 mg fentanyl patch gel Late Tuesday, a breakaway Catholic group, the Catholic Society of St. Pius, best known as SSPX, said it would conduct his funeral in Albano Laziale, a town just outside of Rome. But the plans were dashed after protesters, who blocked the path to the small church picked for the funeral, kicked and rocked the car carrying Priebke's remains until it reversed course. Priebke's body now lies in a military airport near Rome and will stay there until an alternative plan can be worked out.
I'd like to open an account biofuel no2 free trial At the same time their development system is sputtering, the Yankees did not sign any of the recent stars from the international market — Yu Darvish, Aroldis Chapman, Yoenis Cespedes or Yasiel Puig. When Darvish and Chapman were free agents, some executives in baseball just assumed they'd end up in the Bronx, but the Yankees didn't believe the cost, plus 40% in luxury tax, was worth it.
homedna.com coupon There are millions of Americans who have either given uplooking for work or are getting fewer hours of employment thanthey would like, due to the still-tepid state of the labormarket following the nation's severe 2007-2009 recession.
health.eclinicalworks.com/cva "Although the dollar rebounded against the yen yesterday, itdoesn't feel like it has bottomed out. The chart looks stillvery weak and I suspect there's a chance the dollar will test 95yen in the near future," a trader at a Japanese bank said.
ultimate male supplement ingredients She barely picked up a racket from 2008-2011, but has played a lot of exhibitions and senior doubles during the past two years and has also coached, mostly notably world number 25 Anastasia Pavlyuchenkova of Russia, whom she stopped coaching after this year's French Open.
groupe pharma 5 casablanca Companies are doing the offshore fracking — which involves pumping hundreds of thousands of gallons of salt water, sand and chemicals into undersea shale and sand formations — to stimulate old existing wells into new oil production.
Incorrect PIN city lips promo Though members of the clergy say interfaith relations between top religious leaders have never been stronger, and police have been more responsive to such attacks in recent years, they say attacks continue unabated. Some activists say not enough is being done to stop them.
ez fertility diet Our Classified websites (Photos, Motors, Jobs and Property Today) use cookies to ensure you get the correct local newspaper branding and content when you visit them. These cookies store no personally identifiable information.
1healthplace.net As he outlined how he had prevailed by more than five minutes in what he felt was a fittingly marvellous, exhilarating Tour, Froome explained how the memory of Jane came to his rescue, particularly on the second weekend of racing.
highmark mail order pharmacy Our group of four adults and a child – our two-year-old granddaughter – opted for the platinum ticket, booked through the Thomson rep. Together we spent 40 minutes doing tricks with the dolphins, and the session was filmed and photographed. We bought a photo package that included a DVD, a memory stick containing the photos, a number of enlargements and a wonderful album. The whole thing was truly memorable.
geodon webmd For example, Time Inc, a division of Time Warner Inc, the largest magazine publisher in the United States, was one of the last holdouts to join Apple's newsstand. The standoff was because the world's largest technology company did not want to share subscriber data with the publisher of Sports Illustrated and People.
I'm a member of a gym acetazolamide 250 mg order Last week's series defeat in New Zealand was offset by the 3-0 series victory over the world champions here last autumn. England, who had won seven successive Six Nations, targeted the Sevens World Cup this season only to lose to New Zealand in the quarters.
costco pharmacy bayers lake And as dying patients were being routinely ignored, researchers found many were keeping quiet in a bid to be "cooperative" with staff and "minimise the trouble and inconvenience they caused" – vulnerable patients feeling too much of a burden, even in their final hours.
que pastilla es mejor que la viagra "I just ask people to consider, if Trayvon Martin was of age and armed, could he have stood his ground on that sidewalk? And do we actually think that he would have been justified in shooting Mr. Zimmerman, who had followed him in a car, because he felt threatened? And if the answer to that question is at least ambiguous, then it seems to me that we might want to examine those kinds of laws," said Obama.
peacehealth.jobs Cyclone Phailin packed winds of more than 200 kph (125 mph)as it made landfall from the Bay of Bengal on Saturday, tearingapart dwellings and uprooting trees, but it lost momentum as itheaded inland and was expected to dissipate with about 36 hours.
save rite pharmacy Diageo says the event is a "showcasing of Ireland's talentand creativity", but it has been derided by some of Ireland'smost famous musicians as a cynical marketing ploy, attacked bydoctors concerned with high levels of binge drinking, andcriticised by music fans who have called for a boycott on socialmedia sites.
I'm unemployed med-1partners.com Fortunately, all is not lost – yet. The Davies Commission was established to come up with options for maintaining the UK's status as an international hub for aviation – in layman's terms, that means deciding where to put the extra runways which London, and the whole of the UK, desperately need.
apo- amoxicillin 500mg dosage En route to a brutal 38-13 loss to the Titans on Sunday, Smith — taking a cue from Sanchez — committed a behind-the-butt fumble that is sure to keep the blooper reels running. The rookie attempted to switch the the ball from his right hand behind his back to his left while being sacked, resulting not only in a fumble, but a Titans recovery for a touchdown. It was only one of many errors for Gang Green.
bb tonery szczecin Existing U.S and European sanctions cover investment inIranian gas, but do not specifically outlaw imports. Othercountries that import Iranian oil, like South Korea, must makecontinuous cuts to keep getting six-month waivers on the U.S.sanctions.
nama generik acyclovir "I think the really interesting question is why it is that my friends in the other party have made the idea of preventing these people from getting health care their holy grail, their No. 1 priority. The one unifying principle in the Republican Party at the moment is making sure that 30 million people don't have health care and, presumably, repealing all those benefits," Obama said.
anabolics.ws reviews When Confidenti@l passed the Langham, barricades had been erected to keep large groups of scantily clad teens at bay. The ladies also have been subject to obnoxious behavior by the Biebs' tour bus driver.
A law firm manforce picture Organic revenue declined by 3.4 percent at its Europe andJapan arm, although the firm said its decision last year tostart cutting loss-making contracts and selling businesses insouthern Europe had offset the impact on profitability.
nitric rush ingredients That is because the Financial Stability Oversight Council(FSOC), which called for the study, has been contemplatingwhether or not certain large, complex asset management firmsshould be designated as "systemically important financialinstitutions."
alesse rxlist A study by Kings College London of thousands of servicemen and women in Iraq and Afghanistan found six per cent of reservists suffered from PTSD, compared with three per cent in a control group.
kamagra fiyatlari The European automakers' association, ACEA, said that there were 6.205 million new car registrations from January to June in the European Union, providing further grim reading for an industry that is struggling amid a deep recession and high unemployment.
lisinopril 20 mg description "I think that these shows actually work when they are incredibly specific," Davies says. "The reality is that social media has changed everything, and TV networks are realizing that huge fans of the biggest shows want to converse about it on social media afterward.
I'd like to pay this cheque in, please deer antler spray taste Sutcliffe said she received no money from the moviemakers and is angry they distributed photos of her house, making it easy for fans to find her address. A lawyer has told her she probably has no case to sue, and she said she doesn't want money, just to be left alone.
how effective is clindamycin cream for bv Things got bad again the next spring. It was AliReza's birthday, and his family had left the house to him for the evening so he could throw a birthday party. Police showed up and arrested everyone. "I was really afraid after what had happened to me," he says. One of his sisters came to the police station and posted bail, using her house as collateral. Not feeling safe, AliReza didn't go home but hid at an aunt's house. A few days later, he left Iran.
acti-med.de Meanwhile agencies are offering assistance to the shocked and bereaved. But as the focus turns to gathering evidence, the leader of Somalia's al-Shabaab movement has confirmed his group carried out the attack.
bioksan pharma telefono * Facebook Inc has loosened its privacy rules forteenagers as a debate swirls over online threats to childrenfrom bullies and sexual predators. The move, announced onWednesday, allows teenagers to post status updates, videos andimages that can be seen by anyone, not just their friends orpeople who know their friends. ()
augmentin pharmacy2us I won't be at all surprised when China becomes the bastion of civil rights and individual freedoms and good standards of living while the western liberal societies all sink into bankruptcy and stagnation to become the 21st century's feudal regimes. I am sure it can happen.
Dirtbill says:
I want to make a withdrawal nitric rush ingredients A prominent body of scientists have placed the blame for global climate change squarely at the feet of humanity. The American Geophysical Union, a body of more than 62,000 scientists, made the announcement on Monday.
vistagra 100 benefits
Karsten Nohl, the chief scientist who led the research team and will reveal the details at Black Hat, said the hacking only works on SIMs that use an old encryption technology known as DES. The technology is still used on at least one out of eight SIMs, or a minimum of 500 million phones, according to Nohl.
isotretinoin ratiopharm hinta The audience responded enthusiastically when Holder said the Justice Department shared their concerns about the Martin case, and again when he said he wanted to take action to counter the "underlying attitudes, mistaken beliefs and stereotypes that serve as the basis for these too common incidents."
where can i buy chloroquine in the uk In the first few years of hosting the race, work would go on 24 hours a day, seven days a week. But in recent years, with experience, the majority of the workforce do normal five-day, 40-hour weeks.
berwickpharmacy.com.au Katherine Jackson's lead attorney, Brian Panish, built his case on the notion that AEG created a dangerous conflict of interest when it drafted a contract with Murray that pulled the plug on his generous salary if Jackson didn't perform.
Could you tell me my balance, please? what does diclofenac sodium 50 mg do I hope not to sound too cynical. I have always had a soft spot for Egypt. The people are gracious and aware that theirs is a storied and wonderful civilization. But the issue is not whether Egypt is a democracy or something else, but whether it provides for its people and keeps out of trouble. After that, if Ramses II returns, it's okay with me.
precision medicine alliance "Anybody else would probably get arrested for that fight" at the Jets game, added Ferrer's still-grieving 78-year-old father, Robert. "As far as I'm concerned, he should spent quite a few years in jail. That's what he deserves."
risperidone yahoo answers When Girardi suggested that he might put Rivera in center field for an inning this weekend in Houston, the closer suddenly didn't sound very enthusiastic about an idea that had always been a fantasy for him.
el nahar for medical solutions Copyright 2013 Catholic Online. All materials contained on this site, whether written, audible or visual are the exclusive property of Catholic Online and are protected under U.S. and International copyright laws, © Copyright 2013 Catholic Online. Any unauthorized use, without prior written consent of Catholic Online is strictly forbidden and prohibited.
side effects of cyvita Even those numbers are comparatively tepid, given that they're core Obama support groups. Were the Russian plan to fail and Obama to return to Congress for authorization, these results suggest he'd face a further difficult battle for public opinion – unless and until the case is made that vital U.S. interests are in fact at stake.
Refugio says:
Can I call you back? dianabol 75 The Dow Jones industrial average rose 68.06 points or0.45 percent, to 15,197.73, the S&P 500 gained 13.33points or 0.79 percent, to 1,694.88 and the Nasdaq Composite added 38.734 points or 1.03 percent, to 3,810.214.
mlk pharmacy winston-salem north carolina "We now watch a lot of the adaptations like Inspector Montalbano, like Commissario Brunetti (novels written by Donna Leon), food is a central part of that as well. We get to see these incredible images of food being eaten with a Mediterranean backdrop. Reading the books will make you feel hungry, so will the television series."
lloyds pharmacy buy out That's the part that drives me up a wall! The ACA was a free market alternative to "HillaryCare", designed and devised by the GOP. And a significant percentage of the population that "opposes" the ACA, does so because they would rather have a single payer system, NOT because they think it's "socialism" or socialized medicine, but because it ISN'T.
australian testosterone enanthate bladders Packing a sandwich or wrap for lunch just makes sense in the summer. But if you spend the afternoon sitting at a desk, you may not be able to afford all those carbs. A sundried tomato or spinach wrap (which contain just a scant amount of veggies and are primarily made from white flour by the way) contain about 50 grams of carb, and two slices of artisan bread can easily pack 45 grams.
tight me up The activity PMI hit 57.2, the highest in 30 months, where a reading above 50 indicates expansion. The output measure jumped to 62.4 and new orders hit 61.8 – both the highest since 1994. Factories also continued to take on new staff for a fourth month running.
Looking for a job uslu airlines lipstick fbu Fairfax has generally not been known as an activist investor, but Watsa has not shied away from a fight, launching a $6 billion lawsuit against a group of hedge funds in 2006, accusing them of conspiring to the drive the company's shares down so they could be shorted.
puli-pharm.com "Behind the case of Mr Garcia Lucero, there are more than 200,000 others who were expelled or forced into exile – many of whom were also tortured. And we are trying to make them and their right to justice visible to the world," says Clara Sandoval, a lawyer for the charity Redress, which is representing Mr Garcia.
metformin use in pregnancy and lactation "They didn't secure her right. One of the employees from the park — one of the ladies — she asked her to click her more than once, and they were like, `As long you heard it click, you're OK.' Everybody else is like, `Click, click, click.' Hers only clicked once. Hers was the only one that went down once, and she didn't feel safe, but they let her still get on the ride," Brown told The Dallas Morning News.
liquid cialis sale He added: "Let us aspire and take steps at all levels to ensure it improves in subsequent weeks. That is the responsibility of every member and right honourable member from the person most recently arrived to the most longest serving."
cheap dbol pills "But this was the group that on March 30, in Memphis, Tenn., marched to protest the changing of the Confederate names of three parks, including Nathan Bedford Forrest Park," named after an early Klan leader, Potok said.
Looking for a job drugsupport.co.uk "That's the matchup she wants," said Doug Muzzio, political science professor at Baruch College. "Her strengths look the best against him, especially since he has again revealed himself to be a self-destructive candidate."
buy viagra in australia The GD 61 system also gives us a glimpse of what is likely to occur one day in the vicinity of our own star – the Sun. Billions of years into the future, it too will burn out and shrink into a white dwarf, consuming asteroids and other debris.
canada drug viagra Even though he declined to answer an analyst question aboutthe performance of Buddy Media, another costly acquisition,Benioff said he intended to make ExactTarget a centerpiece ofSalesforce's growth strategy. The Indiana-based company makessoftware that lets marketers target specific customers withemail and social media campaigns.
doxycycline dosage for dogs ear infection Professor Sephton said: "The direction of exploration of Mars has progressed from in situ analysis to sample return to bring back rocks from the surface. That is a stepping stone towards sending humans to Mars.
myorangepharmacy.com The survey's jump in August was an encouraging sign that growth may be picking up. But other data have been mixed. Consumers boosted their spending in August only slightly. And while the ISM's index suggested services firms added jobs at a faster pace in August, the government's employment report showed that hiring by services firms slowed that month.
I stay at home and look after the children ed-strength.com "That's a helluva thing to have your name attached to," he said. "It feels like crap. Every time you go out on the football field, you look at the NY on your helmet and you realize all the people, the great ones that came before you, all the championships. It's hard walking in the locker room looking at your owner's face when you're 0-4. How do you think it feels? It feels like s—."
pharmavital.de "Let's face it, dating is a very superficial game," founder Brandon Wade told the Daily News. "We're simply saying, let's dangle a carrot to get that first date. It's like a pickup line, but more classy and interesting."
pharmacy online australia review Dr Saurabh Adlakha knew of a family history of deep vein thrombosis, Southwark Coroner's Court heard, but Jacqueline Allwood, 47, died 10 days after the advice was given when a blood clot travelled from her leg to her lung.
http://www.myprimemail.com login "I represent an English artist called Luke Newton. He is very close to the public, even with young arts collectors, he's always able to get the message across, so, yes, his work sold well," said arts dealer Anthony Phuong.
ibd medical abbreviation icd 10 The survey – conducted by YouGov – covered more than 400 businesses which together employ 1.5 million people. Small and medium-sized enterprises (SMEs) were just as likely to favour Britain's continued EU membership.
Looking for a job achat tadalafil generique Sex Box, said Channel 4 commissioning editor David Glover, is "a rather mischievous, fun idea that actually allows sex to be completely private but the conversation to be truthful and immediate".
generic drugs from india company Standard Chartered, Fitch and Credit Suisse have estimatedlocal government debt in China at the equivalent of anywherebetween 15 percent and 36 percent of the country's output, or asmuch as $3 trillion based on World Bank GDP figures for 2012.
is imipramine used for pain Furyk hit all 14 fairways and 17 of 18 greens on the par 71 layout and sank 16 of 17 putts inside 15 feet. He had 11 birdies, including a holeout from the sand on 15, one eagle and overcame a three-putt bogey on his 14th hole of the day. He became the first player in PGA Tour history to have a bogey in a round and still shoot 59.
professional village compounding pharmacy "The markets have moved quite a bit lower over the course ofJune and have likely priced in a good amount of the negativenews that has come our way over the past few weeks. They are,therefore, due for a modest bounce from here," Edward Meir,metals analyst at INTL FC Stone, wrote in his daily commentary.
valeo ab straps amazon The Blueshirts' next two games, Thursday in Philadelphia and Saturday in Detroit, will wrap up a season-opening, nine-game road stretch prior to next Monday's home opener against the Montreal Canadiens at the Garden.
Can I call you back? pharmacy benefit consultants linda cahn The results were analysed in 2004 and also revealed Armstrong tested positive for EPO in 1999. He has been stripped of his seven Tour titles but no action has been taken against the late Pantani and Ullrich who have kept their podium places.
topamax 25 mg cost Call the medical billing office at your hospital and propose a lower rate for your care. Your negotiation might take dozens of calls, lots of unreturned voice mails and yield several "no's," but it's worth the time and effort if the hospital is willing to negotiate.
buffalo barrels "I understand full well where some of these big companiesare coming from. They're important parts of the Canadian economyand they have a responsibility to protect their profits, protecttheir bottom lines for their shareholders," Harper said.
wellbutrin xl 150 mg effectiveness An upgrade of DFCC's IDRs and VR is unlikely over medium-term given Fitch's expectation for the direction of the group's risk profile and potential lower capitalisation. The IDRs and VR could be downgraded if there is a sustained and substantial weakening in DFCC's credit profile, together with a material decline in its capital position and other loss absorption indicators.
ashwagandha 1200 mg "None of us in the team have ever seen a lead coffin within a stone coffin before," Grey Friars site director Mathew Morris of the University of Leicester reportedly said. "We will now need to work out how to open it safely, as we don't want to damage the contents when we are opening the lid."
Please call back later retin-a micro vs. tretinoin gel Won't cognitive decline make technology toys useless for many seniors in their eighties and beyond? Perhaps – but Orlov thinks most of the future growth will be in products like remote health monitoring that will not require mastery from their users. "Caregiving technology for family members and healthcare professionals will a big driver," she says.
epibright Protesters said Monday's shooting started as they performed morning prayers outside the barracks. Military spokesman Ahmed Ali said that at 4 a.m. (10 p.m. EDT Monday) armed men attacked troops in the area in the northeast of the city.
good mail order pharmacy As a proportion of the overall bond issuance in the EMEA region, unrated issuance has remained at around 10% during that time. This confirms Fitch's belief that the market for this issuance is capped at these levels by both a lack of depth of demand from retail investors and by institutional investor constraints. Other factors such as the limited liquidity of unrated bonds and lack of benchmarking also lie behind the limitation on the extent of unrated issuance the market will accept.
complete body detox diet Moreover, the tech and telecoms giant is also in finalstages of talks to buy a majority stake in U.S. wireless devicedistributor Brightstar Corp in a deal estimated to be worthslightly more than 100 billion yen, according to a Nikkeireport.
silagra 100 tablets Thomas, the former Knicks president and head coach, coached World Peace for two seasons with the Indiana Pacers when the Metta still went by the name on his birth certificate, Ron Artest. Thomas, according to a source, enjoyed his brief time with Artest, who was named to the All-Defense second team in 2003. The following season, Artest was named to the All-Star team and was the Defensive Player of the Year.
I love this site official kamagra uk MIT's posture, which Abelson's team describes as "neutrality," reflected a deeper ambivalence among members of the university community. Some saw heavy criminal penalties for hackers as a violation of MIT's spirit and a threat to Internet freedom. Others, according to Abelson's team, felt it was important that Swartz be punished; still others decided that since Swartz wasn't an MIT student, there was no need for the university to defend him.
gardenparkdoctors.com The cast and crew of fan favorite "The Walking Dead" gathered this past weekend for the San Diego Comic-con festivities andteased the New York Daily News with an inkling of what to expect in an explosive upcoming 4th season:
flutamide androgen receptor "Given the harm caused, this environmental permit has proveditself to be illegal and illegitimate," said Lorenzo Soto, whorepresents the group of Diaguitas. "The project has to remainsuspended until it is completely re-evaluated."
boschpharmaceuticals.com ** Turkish industrial group Yildirim Holding has expressedan interest in investing in Romanian state-owned copper minerCupru Min and insolvent petrochemicals plant Oltchim, theBucharest economy ministry said on Thursday.
priefert pharmacy hebron nebraska They found that women who consumed the highest amounts of marine n-3 PUFAs – those found in oily fish – had a 14% reduced risk of developing breast cancer compared to women who consumed the lowest amounts.
The line's engaged levitra kaufen 10mg "I have said many times before that the US needs to "slow down and hurry up" – by that I mean less fiscal adjustment today and more tomorrow," Lagarde said. She added that the world's biggest economy needed to put its finances in order, but favoured back-loaded measures to raise revenues and limit entitlement spending such as medicare that did not jeopardise short-term growth.
miracle teeth whitener natural charcoal powder "Mayors get a small salary but I don't draw mine, I do this as voluntary work. I'm paying others to do my job while I'm working for free. If you had to give up the source of your income, no matter how noble the cause, you'd struggle too."
sito migliore per comprare viagra Musk's plan all along has been to extend the company's product line with lower-priced models while increasing production at the factory. Arriving next year is the Model X, an SUV-minivan combo that will seat seven adults and probably sell in the $40,000 range. Following that, the company plans to deliver a sedan priced at about $35,000. The biggest concern among investors, though, is that the Model X and the new sedan won't be cheap enough to attract regular buyers.
mandelay amazon London-based Tropical Storm Risk said the storm was alreadyin that category, and classed it as a Category 5 storm – thestrongest. The U.S. Navy's weather service said wind at sea wasgusting at 314 kph.
metoclopramide rxlist That's a sure sign that Cruz isn't just anyone anymore — not even among rich, successful athletes. He has the attention of Jay Z, one of the world's most successful artists, as one of the flagship clients of Roc Nation Sports, Jay Z's foray into the sports representation business. Cruz was one of the first of a remarkably select group (at least so far) that includes the Yankees' Robinson Cano, NBA superstar Kevin Durant, Jets rookie quarterback Geno Smith and WNBA rookie Skylar Diggins.
Do you know what extension he's on? peut on avoir du viagra sans ordonnance en pharmacie Stephen Gandel has covered Wall Street and investing for over 15 years. He joins Fortune from sister publication TIME, where he was a senior business writer and lead blogger for The Curious Capitalist. He has also held positions at Money and Crain's New York Business. Stephen is a four-time winner of the Henry R. Luce Award. His work has also been recognized by the National Association of Real Estate Editors, the New York State Society of CPA and the Association of Area Business Publications. He is a graduate of Washington University, and lives in Brooklyn with his wife and two children.
m stane side effects Putin's sending of a telegram wishing former President George W. Bush well after a heart procedure this week was viewed by some Kremlin watchers as a sign that Putin was sending an implicit message to Obama.
pharmacie-la-plus-proche.com San Diego County has 19 federally recognized Indian tribes and 10 Indian casinos, more than any other county in the United States. Industry experts estimate that casinos nationwide lose tens of millions of dollars a year in various cheating scams.
feminax express tabletki "They have already been fairly tech-savvy," said Levie. "It's a business that has to transform itself from print to digital and they've done a pretty good job doing so. The benefit of having an owner like Jeff Bezos is you'll be able to continue to fund those experiments."
webmail.catholichealth.net It had called a news conference for Friday afternoon inSingapore, but then postponed it without giving details.($1 = 1.2493 Singapore dollars) (Reporting by Anshuman Daga, Rujun Shen and Eveline Danubrata;Editing by Rachel Armstrong and Richard Pullin)
I'm sorry, I'm not interested new hanover regional medical center phone directory "This may be due to a number of factors such as increased participation in higher education, increased female participation in the labour force, the increasing importance of a career, the rising opportunity costs of childbearing, labour market uncertainty, housing factors and instability of partnership."
darpa brain chip implant The recently approved Shanghai FTZ is slated to be a testbed for convertibility of China's yuan currency and furtherliberalisation of interest rates, as well as reforms of foreigndirect investment and taxation, the State Council, or cabinet,has said. The zone will be formally launched on Sept. 29, theSecurities Times reported earlier this month.
le jeune cream price He loves the integration of the spiritual and the constitutional. Recently he preached the sermon for the 60th anniversary of the Coronation. "I felt almost surprise, reading the order of service for 1953, that it opened with her own private prayer. Extraordinary. Her own allegiance to God was given ahead of our own allegiance to her."
deltasone medscape That is the question I have been seeking to answer through the craft of photography, documenting the ravages of AIDS in Africa, tuberculosis in Asia, and polio in Angola and Afghanistan. And I have learned that of all these deadly diseases, diarrhea is uniquely vexing.
coastcaremed.com.au @RD137 – You can't "hack" bitcoin. It's based on military grade cryptography. This is the same technology the entire banking system uses, so if it gets "hacked" then bitcoin will be the least of our problems.
International directory enquiries diflucan receptfritt pris If the Jets had won, they would have at least been playing for a share of first place and remained the talk of New York football and owned the town for another week. Instead, two damaging second-half interceptions by Smith — what is it with the New York quarterbacks this season? — deep in Pittsburgh territory destroyed any chance the Jets had to build on the positive vibes they created in Atlanta.
forma stanzol v3 side effects Homs lies on the main north-south highway which links most of Syria's main cities, and also forms a link between Assad's capital in Damascus and the heartland of his minority Alawite community in the mountains overlooking the Mediterranean.
naltrexone kappa receptor The executive shuffle comes as just as Time Warner Cable,the second largest U.S. cable provider behind Comcast, with 12million customers, has become an acquisition target for JohnMalone, chairman of Liberty Media Corp.
male climax control exercises The speed improvements appeared to come mainly from changes that enabled the boat to consistently "foil," or lift almost completely out of the water on small horizontal wings, even when heading upwind. The team also changed tacticians after its early losses, installing Britain's Ben Ainslie – the winningest Olympic sailor in history – in that spot in place of San Francisco native John Kostecki.
peut on avoir du viagra sans ordonnance en pharmacie Sporadic shooting continued for several hours after the attack, which began at around 12.30 p.m. (5.30 a.m. EDT) on Saturday but had become a tense calm by the evening. Soldiers had joined the security operation backed by armored personnel carriers.
Wilson says:
I'm only getting an answering machine vaso 9 legit Dirty Tasting Spoons (the ice cream flavor) started out as an inside joke between Malu's husband-and-wife owners Sergio Garcia, 39, and Jennifer Dudek, 35, who decided to combine leftover ice cream into one blast of flavor.
vimax not working He was the 2008-2009 board president of the InvestmentManagement Consultants Association, which credentials advisersactive in portfolio management, and was the firstAfrican-American to be hired by a major broker-dealer inMississippi, according to Morgan Stanley.
levitra 10 mg 20 mg filmtabletten The opposition will decide in early November whether it will participate in the talks. Yasser Tabbara, the legal adviser to Mustafa Sabbagh, who leads the main bloc in the NC opposing the talks told the Telegraph the "Friends of Syria" communique and Jarba's statement are a "significant step".
generic and brand name of drugs Crude traders and brokers said the announcement of the shutdown explained the stronger price for Bonito on Tuesday, whenAugust barrels for the cash crude grade traded at $4.45 and$4.60 a barrel over the benchmark U.S. crude futures.
pharmacymall.com reviews ChemCam Co-investigator, Olivier Gasnault, told us about one such journey for the machine and outlines the thinking behind it: "We went to a little basin which looks like an ancient lake. And that allows us to ask questions about whether life could have existed in the area. That's to say, did we ever have the climatic conditions for life – if life can appear somewhere other than Earth – could life have appeared there?"
What line of work are you in? pill box pharmacy fresno hours "The 49ers organization has been informed of a tragedy," the team said in a statement. "We were saddened to learn Dr. Dan Garza died unexpectedly Tuesday. Our sincerest thoughts and prayers are with his family and friends during this trying time."
simvastatine 20 mg generique "People will come in here and fall in love," Ryan said, witha house flipper's standard issue optimism. "This is an emotionalsale. If it takes a week to sell, I will be surprised. There area lot of young, wealthy people here, and a lot of money outthere."
precio del cialis en farmacias del ahorro en mexico Luis Alaez, the investigative judge, was to question the driver in private and was not expected to comment about it afterward. The judge also was to have access to the information contained in the train's "black box," which is similar to those found on aircraft, officials said.
acti-med.de "Those who applied online and chose to hold their shares in the Royal Mail nominee share service can expect to be emailed that number within two days of admission. Those who applied by post and online applicants who chose a share certificate were told they would be sent their shareholder reference numbers within one week of admission."
stendra cost cvs I think it a shame that that these entertainment shows are considered "news". They are not. They are purely for entertainment, and profit. The motivation for them to taint the "news" for better ratings is far to great. Since they are entertainment, they have completely removed any senesce of journalist ethics. I think the authors defense of such shows proves my point. I am truly a news junky. I monitor many left and right wing outlets and from at least six or seven countries. This is a must to actually get enough information to make an informed decision about what is going. on. I do not troll any of the "mainstream" American outlets (NBC, ABC, CBS, Fox, CNN) as these have repeatedly shown that they are merely entertainment and will happily and reliable change the story for the best possible ratings.
When can you start? pharmacy tech quizzes online Manning, the father of Peyton and Eli, was a star quarterback for Mississippi and had a long NFL career, mostly with the New Orleans Saints. He, along with Osborne, is a member of College Football Hall of Fame.
premarin cream price in pakistan Compared with earlier in the decade, "servers in 2010 havemuch higher processing power, more memory, faster networkconnections and bigger power supplies", according to StanfordUniversity's Jonathan Koomey. But "they also have powermanagement and other clever technologies to reduce electricityconsumption". ("Growth in Data Center Electricity Use 2005 to2010" Aug 2011)
proventil goodrx With the third day of the shutdown dawning and the deadline to raise the debt ceiling fast approaching, House Republican leaders believe maintaining party unity over the budget bill is paramount. Any divisions or concessions would only bolster Obama's hand in the debt ceiling talks.
medrol dose pack adverse effects Federal Reserve chairman Bernanke is expected to step down when his term ends in January. Yellen, vice chair of the Fed's Board of Governors, has been tipped as Bernanke's successor. But according to recent press reports, U.S. President Barack Obama may be leaning towards nominating Summers as the next head of the Fed.
satibo canada For starters, the snails are hermaphrodites, equipped with both male and female apparatus. Once they mate, both can lay eggs, up to 1,200 annually. They can live for up to nine years, and reach eight inches in length.
Wilfredo says:
Could you transfer $1000 from my current account to my deposit account? ascend micellar casein review Sacking a bishop who had protected one or more abusive priests "would do far more to protect kids and deter cover-ups than this small change to a rule that's likely never been, and never will be, used".
dcpills.com.apnpc.com Rosas began as a video coordinator and scout with the Rockets and rose throughout the organization over nine years to become the vice president of basketball operations. Rosas is the second Rockets executive to be employed by another NBA franchise this year as Sam Hinkie left Houston to become the Philadelphia 76ers general manager in May.
dundela pharmacy limited It looked closely at potential profits in businesses where it was long a laggard. In commodities trading, it ranked in the bottom tier among global banks. Consulting firm McKinsey said then that across Wall Street, the return on equity in commodities was poised to fall from around 20 percent pre-crisis to around 8 percent after new regulations are fully implemented.
virgo uap pharma pvt. ltd career LONDON, Sept 18 (Reuters) – Stock market investors wereleaning towards the U.S. Federal Reserve doing no more thanlightly trimming its economic stimulus programme on Wednesday,keeping European shares near five-year highs.
test prop cycle before and after pics "Getty is still a business-to-business company and the majorcustomers of Getty are the Madison Avenue advertising agencies.If someone is going to be doing things for WPP Plc andOmnicom Group Inc that are looking for exclusivephotographs, Getty is one of those players," said Moody'sInvestors Service Inc senior analyst Carl Salas.
Weldon says:
How would you like the money? dbol only cycle dosage For now, firms in New Zealand can capitalize. And not just through cost savings – Australian customers of Quickflix and other companies can ring up operators who have similar accents and shared sense of humor.
steroid-forums.com not working On the other side, actor Robert Redford, former New Mexico Gov. Bill Richardson, current New Mexico Gov. Susana Martinez and New Mexico Attorney General Gary King are among those who strongly oppose a return to domestic horse slaughter, citing the horse's iconic role as a companion animal in the West.
beverly hills pharmacy abu dhabi The oil-rich OPEC member country has been plagued by worsening power outages since 2010. The opposition blames neglect and poor maintenance, while alleging mismanagement and corruption at struggling state-owned aluminum, iron and bauxite foundries in Bolivar.
bactrim for sinus staph infection Other specifications for the device, according to Tinhte, includeBlackBerry OS 10.2, a 1.7GHz dual-core Qualcomm MSM8960 processor, 2GB of RAM, that 5-inch 1280 x 768 AMOLED screen and 4G connectivity.
healthynutritionforme.com "There was a crackhouse on my block growing up, but there was also a doctor's office," King explains. "That's always been the beauty of Bed-Stuy. It's a working-class, middle-class, poor neighborhood — it's all of those things.
Thanks for calling purchase cheap naturally huge The new anti-money-laundering regulations were "a continuation of the efforts to update Vatican City State's legal system, building upon the measures adopted since 2010 during the pontificate of Benedict XVI," the Vatican said in a statement.
trusted-health.com Republican leaders sent letters of protest to both networkslast week complaining that a planned CNN documentary and an NBCminiseries amount to political ads for the former secretary ofstate and wife of former President Bill Clinton. She has notsaid she is running.
crestor 10 mg film-coated tablets CommScope is a major manufacturer of cables that underpinhigh-speed data networks. It traces its roots to Superior CableCorp, a telephone cable company created in 1953, and changedownership several times until it went public in 1997.
old court pharmacy and medical supply Santorum was responding to reports that a local branch of the Austin YMCA had prohibited the group from using its facilities to shower when they were in town last month to support a controversial anti-abortion bill.
iso fuzion gfr By the third year of this radio contract, who knows what the Yankees will look like with the absence of franchise icons such as Derek Jeter, Mariano Rivera and Andy Pettitte, who have been fixtures for the team for nearly two decades?
A few months pharmacy price check uk They were joined on Thursday by New York RepublicanRepresentative Peter King, who told CNN that the party was"carrying out a fraud with the people by somehow implying oreven saying that this strategy is going to win."
houstonsportsmedicine.com Several Braves, including Heyward, said they weren't surprised by the move. "Play the matchups," Heyward said. "That's what the postseason is about. You go lefty-lefty there. Me, personally, I'm glad to have an opportunity to come through big for my team right there. Got a pitch and I didn't miss it."
uslu airlines lipstick fbu On this week's Daily News Fifth Yankees Podcast, Mark Feinsand sits down with outfielder Vernon Wells to discuss the Yankees' fading postseason hopes, the tough road trip and what the team's recent stumble means going forward.
kamagra fizz Unlike jogging on lonely treadmills or swimming solitary laps in a pool, CrossFit is famed for both the social and the team atmosphere it creates as well as its dedicated followers, meaning you're pretty much guaranteed to have multiple opportunities to strike up conversations.
maxi omega 3 "Everybody sees China as an enormous opportunity," says Jeffrey Lau, an investor in Village Roadshow Asia, a two-year-old branch of the media company behind The Great Gatsby, Ocean's Eleven and The Matrix. "Companies facing a stable market in the West are going to turn to China. Strategies differ – some are going for big budget movies made in China which can go worldwide. We are more conservative, our model is to make money from the Chinese market. We do not assume any other revenues in the budget."
What's the current interest rate for personal loans? cialis with dapoxetine review The companies said they expected to achieve $250 million of savings by the end of the first fiscal year of operation. The new company will also buy back $3 billion of its shares within 12 months of the combination, they said.
genacol collagen gel "We are all concerned about rising prices and the impact on consumers, but we also have a very real responsibility that we find supplies to make sure the lights stay on," Sir Roger Carr said.
basilea pharmaceutica china ltd Excluding Tuesday's gains, shares of the Boulder,Colorado-based company had soared more than 300 percent sincethe beginning of this year, in line with a spate of positivenews about the company's cancer drugs pipeline.
pharmacy one source madison wi The surface of a Thompson table is fashioned with an adze, which results in a smooth honeycomb pattern. Chair backs are centred with a lattice pattern carved from a single piece of oak, which looks for all the world as though it has been woven in wood. But the signature of Robert Thompson is the thing that really identifies his furniture – a mouse. It may be climbing up the leg of a chair or fashioned into the handle of a tray. But every piece, however large or small, will have a mouse upon it somewhere.
ojifs.synergyhealthltd.com "We continue to pursue accountability and recovery in the wake of billions of dollars in sales of faulty securities that led to the collapse of several corporate credit unions and handed the industry the costly bill of paying for the losses," NCUA Board Chairman Debbie Matz said.
Chadwick says:
Punk not dead prix bijoux ginette "They are working on a solution that can allow Telefonicanot to buy new shares in Telecom Italia and keep the status quofor a while," one of the sources said. "The idea is apostponement of six months, perhaps one year."
cialis online buy The infraction cited was the building's co-owners' direct assistance to the Iranian government, which breaches the International Emergency Economic Powers Act as well as U.S. money laundering regulations.
solu medrol im dose for asthma Under pressure from a handful of lawmakers to explain whybanks including JPMorgan Chase & Co. and Goldman Sachs have been allowed to own warehouses and trade physicalcommodities, regulators have scrambled this month to demonstratethat they are tackling the issue.
generic prednisone name "Whether you're with a team at work [or] your family dinner, all of that hinges on how we adapt our behaviors to the behaviors of other people," he says. "And power takes a bite out of that ability, which is too bad."
what is betamethasone dipropionate lotion usp 0.05 used for On the prospect of a U.S. strike, he said: "We stand by the will of the Syrian people. They know best their interests, so whatever they accept, we accept, and whatever they refuse, we refuse." The meeting was expected formally to blame Assad for the gas attack.
Jordon says:
I'll put him on prix sotalol 160 This limited distribution could spoil its ambition to be thedestination for viewers who want to watch breaking news, saidDeborah Potter, the president of NewsLab, a group dedicated toimproving news quality.
pronto pharmacy houston tx "Unfortunately, the war-mongering lobby in the U.S. is opposed to constructive [talks] and only protects the interests of the foreign regime, and often receives orders from that regime," Rouhani told reporters in Tehran on Tuesday. "The interests of the lobby and the foreign regime have been imposed on the American lawmakers. We see that they even ignore U.S. interests."
kamagra oral jelly erfahrungen 2013 Detroit Police Sgt. Michael Woody said the roughly 4-foot long, 3-foot tall sheep with a numbered tag in its ear and a purple paint stripe down its back, was seen running on Eight Mile Road before it entered the shop.
forzest 20 mg dosage Allianz plans integrate its internal networks and globaldata centres into what it calls the Allianz Private Cloud by theend of 2017, in a move that will cut the number of data centresto six from 140 currently, the insurer said in a statement.
rxedeuro.com About 2,000 people were at the school, many checking their names against lists to find out which voting station they were due to go to. Each classroom is a voting station for 500 people. It has a single clear plastic ballot box, a screen for voting and a bank of party agents overseeing procedures.
Get a job combivent 0.5 mg/2.5 ml Drainville said institutions could apply for a five-year exemption from the charter, but gave few details. The government will unveil formal draft legislation later this year after a period of public comment.
acetaminophen or ibuprofen for sinus headache A Tustin, Calif., woman is suing a veterinary office for $1 million, alleging they used extortion by threatening to report her for animal cruelty when she couldn't pay for a $10,000 surgical procedure for her dog.
xtralarge tv The observatory, which cost £850 million, is the most expensive and sophisticated in the world. It was funded by European, North American and east Asian astronomical agencies, of which Britain is a member.
tretinoin gel vs cream for acne The DOJ on Aug. 13 filed a lawsuit to block the proposed $11billion merger, which is the basis for AMR's plan to exitbankruptcy and pay back creditors. The DOJ said the merger wouldincrease fares and hurt consumers.
core skincare For the rider, it feels like having a secret muscle, or suddenly finding out you're Lance Armstrong — but with an artificial enhancement that's out in the open. E-bikes are super popular in Switzerland, logical given the nation's daunting topography. But the bikes would even make sense on New York City's largely flat terrain.
Do you play any instruments? wells rx pharmacy chicago il In 2012, 23 incidents of excessive force were reported at YSI facilities. By comparison, G4S Youth Services — the state's largest private provider of youth prison beds — generated 21 such reports, despite overseeing nearly three times as many beds.
neosize xl guatemala The Bruins head to Pittsburgh on Oct. 30, where Jarome Iginla will meet up with the Penguins. Iginla will also have a big day Dec. 10, in his return to Calgary and the city in which he played from 1996 to the trading deadline last season.
bloomshealth.com.au Family reported two hospitalizations and home visits by a state social worker. Recently reported delusions included her belief that she was capable of communicating with President Obama and believed that he was electronically monitoring her Connecticut home in order to broadcast her life on television.
lily-medical.com "Michael paid the ultimate price. He's not here," Panish said. "Sure he took propofol, but remember, every time he took propofol, he didn't die until one thing happened: an unfit, incompetent doctor in a conflict of interest situation did it in an inappropriate setting."
where to buy real viagra online uk An acknowledged alcoholic, Lohan has a lot to lose if she falls off the wagon. Her reality show with Oprah's OWN network has been following her post-rehab recovery. She was paid a whopping $2 million to document her sobriety and O has publicly encouraged her to stay clean and seek help.
Mckinley says:
Languages online stim-u sens
Manuel's daughter was in the train and is in hospital with minor injuries. He told euronews: "I was coming down here to the bar to have a glass of wine, and saw the wagon in the open field, and my daughter was the first thing I saw… she was outside… the neighbours were heroes, total heroes… I don't really know how I feel… nervous I guess. I can't sleep now…"
hoodia gordonii wo kaufen "We will not be silent; we will not obey; we will not allow our government to destroy our humanity," Kokesh says in the video while loading the shotgun and standing in a plaza between the White House and the Capitol. "We are the final American Revolution. See you next Independence Day."
best drugstore concealer for dry skin "The supermarket prices are so unreal that people are choosing to buy beer and drink it at home," says Davies. "I probably have eight or nine gentlemen that are by themselves and they want to come out to talk to other people and some of them can't do that any more."
cost of methotrexate tablets in uk "The pope is not condemning his predecessors," Burke told The Associated Press. "What he is saying is 'We've spent a lot of time talking about the boundaries. We've spent a lot of time talking about what is sin and what's not. Now let's move on. Let's talk about mercy. Let's talk about love.'"
is it legal to buy viagra on craigslist A friend of the deceased Boston Marathon bombing suspect told investigators that two years before allegedly setting off explosives that killed 5 people and wounded more than 250 others, Tamerlan Tsarnaev participated in an unsolved 2011 triple homicide, according to a court filing made Monday by federal prosecutors..
Orval says:
How much were you paid in your last job? effexor 225 mg dosage Brazil's justice and defense ministers, along with a top army commander, urged the pope to use an armored popemobile instead, but the Vatican has responded that Francis likes to jump in and out of his vehicle to greet the faithful, which wouldn't be possible in the more protected vehicle.
medic-rx365.com And so the Giants don't. In a business where planning for the future is so important, both Reese and Mara insist they really have no idea how much longer Coughlin will occupy his office, and neither of them wants to ask. They may wonder what kind of coach they'd have to hire to replace him, and both men insist they have a "short list" ready. But when Mara sees Coughlin in action he sees a man who's healthy, determined and "has the same energy level he had when he was an assistant here in the 1990s."
thedoctorstv.com uncut The Mets are committed to a six-man rotation for the next few weeks to try and limit the innings of young right handers Matt Harvey and Zack Wheeler. Niese's return would allow the Mets to continue that if they want despite the struggles of spot starter Carlos Torres.
anti aging online pharmacy Almost 37,000 left last year, the highest level since 2001, and outstripping the number returning. The rich buy property in Dubai, but changes last year to legislation making it easier for foreigners to buy property in Turkey have made that country an attractive destination for Kabul's middle class.
animalhealthdirect.co.nz As part of the proposed settlement, Actavis agreed to sellall rights and assets related to generic Femcon FE, Loestrin 24FE and its generic equivalents, and Lo Loestrin FE and itsgeneric equivalents, all contraceptives; and the osteoporosistreatment Atelvia and its generic equivalents.
I have my own business dong nai pharmacy Under the stewardship of property developer Urban Splash, part of the estate has been reimagined and renovated to suit 21st Century tastes and design standards. Many of the original residents were moved out to make way for the construction workers, and most have not been allowed back. Instead, most of the new dwellings have been sold to private buyers. A controversial redevelopment, Park Hill nevertheless shows the potential that exists in buildings which have been otherwise been largely written off.
snowanimalhealth.com Last month, New York's Department of Financial Services said it had sent letters to 35 payday loan companies asking them to stop offering exploitative payday loans in New York via the Internet or by other means.
meloxicam dog overdose "That's the exciting part about it … even with my mistakes," Smith said. "When I do something good, it's like, 'Yeah, okay. You're supposed to do that.' But when I make a mistake, I got to correct it now.
potenz-laden.org erfahrungen It said earnings before interest, taxes and amortization(EBITA) fell 6 percent over the first half of the year to 865million pounds, on a 1 percent rise in sales to 8.45 billion.Its underlying earnings per share fell 4 percent.
diamox ohne rezept Obama has been bombarded with criticism for his handling of Syria and a muddled message. First, he took U.S. forces to the brink of a military strike over an August 21 poison gas attack in Syria that Washington blames on Syrian President Bashar al-Assad. He then asked Congress to authorize the strike, but less than a week later requested lawmakers hold off on a vote to allow diplomacy more time.
Darnell says:
The National Gallery hairmax laserband qvc The former secretary-general allegedly urged local party leaders "to do their best and break the law" in falsifying data in an effort to meet a required turnout of 50%, according to Agence France-Presse.
buy cheap vasotechums "But after two months … I started getting some of the benefits of all the work that I was putting in with my daughter. I mean, she liked me more," he said. "She would, like, smile and kind of light up when I was around. She would come to me for comfort. Those things felt really good."
permethrin cream scabies walmart Such moves have been welcomed by investors. Abbott shares, for example, outperformed the sector and the wider market significantly after it unveiled its planned split in 2011, while Pfizer and GSK have both enjoyed a re-rating, helped by hopes that their more focused businesses will be better able to leverage a number of promising new drugs.
glutimax customer reviews The cheerful town of Ketchikan provides a final glimpse of Alaska before the ship returns to Vancouver. There's no finer way to appreciate the landscapes and culinary traditions of Canada and Alaska than on one of APT's outstanding tours.
russian bear nutrition Whatever internal disagreement there may still be over Bo's fate, the Party has clearly united on the need to deliberately stage-manage the Chinese public's response to the case from on high.
Is this a temporary or permanent position? webmdhealth.com The target valuation is between 38-44 roubles per share,said another banking source, and 40-47 roubles per share,according to a separate banking source. This would put the stakesale in a $1.4-1.8 billion range.
herbaland vegan protein gummy bear The Patriots ran the same play against the Saints last week, but Rex Ryan denied on ESPN Radio that his brother, Saints defensive coordinator Rob Ryan, tipped him off regarding the Patriots' technique.
salacia reticulata extract for sale Dvorkovich, who has broad responsibility for energy policy,is however seen as no match for Igor Sechin, a former aide toPutin who, despite no longer being in government, is arguablyRussia's second most powerful man.
lithium rxlist Chris Clemes, director of a London-based fishing equipment firm, said he had referred customers to Atlantic Salmon Reserve, which he said was one of only two companies offering fishing trips in the region, and the only one on the Rynda River.
does tetracycline make acne worse before better "Killer was just a real character," Gene Michael said Thursday. "Right out of Damon Runy on. I loved playing gin rummy with him on the planes. I'd always beat him, and then he'd have to borrow the money from me to pay me back."
I'm a member of a gym winslette pharmacy hours rome ga Six global powers and Iran held talks last week in Geneva on ways towards a diplomatic deal, their first such negotiations since the June election of Rouhani, a relative moderate, opened doors for compromise after years of escalating confrontation.
bodyecology.com/articles/top_ten_foods_that_prevent_inflammation.php I don't expect this to happen very soon. But this memo provides, for the first time really, a script of how it will happen if it does. Subscription growth declines as they saturate some markets and fail to capture others. Ad revenue continues to drop and video isn't enough to stanch the losses. There's nothing left but the core product to chip away at, but attrition becomes necessary.
mullins discount drugs Soros, who established one of the first hedge funds in 1969 and is probably best known for his big bet against the British pound in 1992, met Bolton at a dinner party in 2008. Their engagement was announced in August 2012.
http://www.nepharm.com Wright was sidelined one night after he was hit in the helmet by an 86 mph changeup. The Mets reiterated that his head is fine — Wright said he passed all the concussion tests — but the medical staff recommended he rest his thumb for a day.
yohimbine uk buy Federal payments to subsidize insurance for eligible buyers- those with incomes less than four times the federal povertylevel, or $62,040 for a couple – would not be in jeopardybecause they are due just before coverage begins, not whensomeone enrolls. Anyone buying health insurance by Dec. 15,2013, is covered as of Jan. 1, 2014.
I like watching football bellemeade discount drugs Before embarking on a rare holiday, Bertie Wooster's immaculate manservant Jeeves briefed his understudy. "You will find Mr Wooster an exceedingly pleasant and amiable young gentleman," he said, "but not intelligent. By no means intelligent. Mentally he is negligible – quite negligible."
taking keflex in early pregnancy "Uncertainty is inherent in every scientific judgment," said Johns Hopkins University epidemiologist Thomas Burke. "Will the sun come up in the morning?" Scientists know the answer is yes, but they can't really say so with 100 percent certainty because there are so many factors out there that are not quite understood or under control.
hylant.medtipster.com Nearby, Estonia's Eli Airborne Solutions is demonstrating its own smaller quadrocopter, already in service with Estonia's border guard and hoping for exports to Latin America and other emerging markets.
kamagra te koop antwerpen But in the country where resources like accurate records and data are extremely hard to come by, one participant posed a critical question: "How can we get together and monitor violence against women?"
medica iq Rep. Mike Thompson, D-Calif., a member of the House Intelligence Committee, said: "Reports that the NSA repeatedly overstepped its legal boundaries, broke privacy regulations and attempted to shield required disclosure of violations are outrageous, inappropriate and must be addressed."
I'll put her on beglammed reviews san francisco Other companies rushed to cut their ties with Deen, dropping her as a celebrity endorser and announcing they would no longer carry the cookbooks, housewares and other products that helped Deen build a multi-million dollar enterprise.
carvedilol 25 mg photo While some people have kindly kept in touch, as illustrated by the last two letters quoted, some have not. This has taken up time that would have been better spent on other cases. For example, very late in the day I learnt that NT received a warrant for £1,347.98 four days after he wrote to me – and other money shortly after that. Similarly WJ of the United States actually received a warrant for £10,471 some six weeks after I spoke to ELPS for him, which he cashed a month after that.
absmeds.com As experts have analyzed and re-analyzed WHI trial data and other studies, they have found support for a "timing hypothesis" — that estrogen's heart protection occurs when it is started close to the time of menopause. By age 60, research suggests, changes in blood vessel cells compromise estrogen's ability to inhibit hardening of the arteries (a heart disease risk) and to promote good blood flow.
nebido 1000mg injektionslsung bayer This year, the exploits of some of baseball's best have been overshadowed and in the case of young Baltimore Orioles slugger Chris Davis called into question due to MLB's ongoing probe into some 20 players linked to a Florida anti-aging clinic purported to have supplied them with performance enhancing drugs.
terbinafine tablets and alcohol France were certainly well in contention, especially as they were playing on their home ground. There are 15 motoball clubs in France, with Neuville being French champions in four of the last five years, and winners of the French cup eight times since 2002. As the French national squad includes four Neuville players, it is not surprising that the town should have been awarded the privilege of hosting this year's championship.
real beauty page narcotic conversion fentanyl patch to ms contin Amid ongoing concerns about contamination, there are strict limits on the species that can be caught and only areas more than 50 kilometres out to sea from the stricken power plant can be fished, at a depth of over 150 metres.
amoxicillin 500mg alcohol "We can't get planning permission so we can't get a licence. We have got nowhere to go it looks like every year we have got to get a large fine and a summons to court and we can't do anything about it because the council won't do their side.
country boy pharmacy choctaw The majority's decision to uphold the lower-court order came even as new attention is being focused on California prisons since thousands of inmates launched a hunger strike last month to protest conditions in special housing units where some prisoners are held for prolonged periods in isolation.
erythromycin tgp One of my favorite things that I really like to do in Nevada and here, in Washington, is go grocery shopping. It's such a diversion for me. I love going grocery shopping to look around, buy the things. Landra and I are without our children and our grandchildren. We live alone. But we still buy food. And I enjoy that so very, very much.
portmans pharmacy whitecross street A spate of unusually public complaints from leading members of the Saudi ruling family has shed new light on the kingdom's frustration with the United States over its perceived inaction on Syria, its diplomatic engagement with Iran and its coldness toward the military government in Egypt.
How many days will it take for the cheque to clear? doxepin hydrochloride other names "They apparently don't want to take the time to form a coalition, which I think is an error," Heinbecker, now a fellow at the Waterloo, Ontario-based think tank, the Centre for International Governance Innovation, tells GlobalPost about America's push for Western intervention.
vaso 9 xpdc Since peaking at $3.78 a gallon in late February, gasoline prices have beaten a choppy retreat for most of 2013. The end of the year usually brings lower gasoline prices as refiners switch to less-expensive grades than they run in the warmer months.
loratadine generique de quel medicament Yet Stephen King, chief economist with HSBC, said the global picture was still uncomfortable. "The problem is that the imbalances that have narrowed in those two countries have reappeared elsewhere," he said.
albuterol sulfate used for pneumonia This property gave astronomers the chance to measure the Sun's magnetic field. Interestingly, astronomers discovered the Sun's atmosphere has a magnetic field that is approximately ten times weaker than a normal fridge magnet.
adaptive body boost scam Consider asking, for instance: Is a mile really a mile? This is exactly the same, silly kind of question. A mile is, irrefutably, a mile: 5,280 feet. If it were otherwise, it would not be a mile. In just that way, a calorie (kilocalorie, actually) is exactly the energy required to raise the temperature of one liter of water one degree Celsius at sea level. If it is any other quantity of energy, it is not a calorie.
Rigoberto says:
History xanogen and hgh factor price in india On the one hand, this stand-off between two beasts is compelling. There is no doubt it is as much driven by ego as by strategy, with CBS's famously aggressive boss Les Moonves on one side of the ring, and Time Warner's Glenn Britt in the other. Both companies are losing money as long as they engage in this corporate game of chicken – analysts estimate CBS is down $40m a day. Meanwhile, their rivals benefit from picking up all those displaced viewers looking for something other than a black screen to fill their evening.
avocado green mattress coupons Southern Copper, a unit of Grupo Mexico andone of the biggest copper producers in world, expects a littleover 650,000 tons in output this year because of strongeractivity at its Buenavista mine in Mexico, Gonzalez said.
collagenhealth.co.uk Corn basis bids fell as much as $1 a bushel at Midwestprocessing plants as Chicago Board of Trade September futures fell to a contract low of $4.92-1/4. The declines raisedspeculation that corn cash markets could see the same wave ofselling that hit soybeans this week.
doxycycline price in pakistan Carney said that Bulger was glad to have his story told at trial. "At the end of a person's life, when people think he is the only bad person in the courtroom, it's important to show that that's not true," he said.
vitaminshoppe.com/careers With euro zone growth expected to return in the second half of this year, buying opportunities abound after the recent global stock retreat, according to Standard & Poor's Capital IQ analyst Robert Quinn. He expects "fragile growth" by the end of this year as businesses start spending again.
I'm unemployed fematril 90 pastillas The afternoon best-ball pairings looked like this: Jodi Ewart-Shadoff and Charley Hull against Creamer and Lexi Thompson; Munoz and Carlota Ciganda against Gerina Piller and Angela Stanford; Hedwall and Masson against Wie and Korda; and Recari and Icher against Pressel and Cristie Kerr.
medsuk.net NEW YORK, July 14 (Reuters) – Proxy advisory firmInstitutional Shareholder Services (ISS) is urging shareholdersof McKesson Corp to vote against the re-election of fourdirectors, citing the firm's persistent problems in addressingshareholders' concerns about executive compensation.
precio de montelukast en mexico The CCC quickly figured out how to use high resolution photographs of fingerprints to trick biometric scanners into unlocking iPhones. That should be a lesson to the public about the myth of biometric security, according to CCC spokesperson Frank Rieger.
kaufen tadalafil JPMorgan Chase & Co, the largest U.S. bank byassets, reported a 31 percent jump in quarterly profits. Thestock was down 0.3 percent at $54.97 in late trading aftertrading higher for most of the day.
hondrocream forum The Commitments opened doors for Ball in Hollywood and she was soon in Los Angeles, auditioning for more blonde-bombshell roles. But she found the experience dispiriting and admitted later that all she really wanted was to "go home and see my mother in Ireland".
Frederic says:
Please call back later best australian drugstore foundation Contractors led by CGI Group Inc and QualitySoftware Services Inc have built and will operate much of theinformation technology (IT) underpinning the exchanges. Even ifthe data hub is allowed to operate during a government shutdown,"it needs continuous maintenance," said Michael Marchand,spokesman for Washington Health Plan Finder, that state's ACAmarketplace.
arch health medical group pomerado outpatient pavilion The diagnosis: vibrio vulnificus, an infection caused by a bacteria found in warm salt water. It's in the same family of bacterium that causes cholera. So far this year, 31 people across Florida have been infected by the severe strain of vibrio, and 10 have died.
baclofen reviews drugs.com Funding wise, the project is built up of £7.4m from the BDUK, £4.9m CountyCouncil, £2.5m from EU ERDF and £12.87m from BT. While FTTC is the maintechnology an unknown amount of FTTP will be deployed, and fibre on demand willbe available in FTTC areas. Hopefully once roll-out starts in 2014 we will havemore information on technologies for each area.
medicineshoppeonfort.com "I'm not even interested in girls," said Little King, real name: Nati Wai, son of a deceased dockworker. At the age of 11, he dropped out of school, stepped into his father's role and became a dockworker himself. That was four years ago. "I already have a woman to take care of," he said. "That's my mother."
red devils pills report
Borrowers need a minimum 5pc deposit and must take out a mortgage to cover the remaining 75pc of the cost of the property, which can be worth up to £600,000. The Government has set aside £3.5bn to help up to 74,000 home buyers through the scheme, which will run until the end of March 2016, or when the funding runs out.
Could you tell me the dialing code for ? can finasteride raise blood pressure The lawyer, Michael Nicholson, said Orr's representativeswanted an agreement that he would not repeat anything he learnedin the meeting to anyone outside of the meeting. The secrecyagreement also required a pledge that the union would not useinformation from the meeting in any future court proceedings.
first pharma pty ltd It is a shift that has seen the dollar give back three-quarters of June's 5 percent gain and the greenback remained under pressure as U.S. trading began, having earlier hit a five-week low against a basket of currencies .DXY and one-month low against the yen.
shanghai medicilon inc china — M&G Investment Management Ltd, which is a subsidiary ofBritish insurer Prudential plc, to acquire sole controlof medical product maker Alliance Medical (notified Aug.2/deadline Sept. 9/simplified)
commonly abused prescription drugs uk Bloomberg blocked reporter access to the data in April 2013after a customer complained. The report found that Bloomberg hastaken key steps to protect customer data from reporters and isadding more controls that Promontory and Hogan Lovellsrecommended.
healthclubie.inslinett.com Not immediately realizing the extent of the damage, he headed to the engine room to assess the situation. When he looked over his shoulder, he saw ocean and sky where there should have been hull. Water started pouring in, and he and Cynthia knew it was time to abandon ship — but not without Jasper and Topaz.
A staff restaurant pharmacy research uk research priorities "He also said that as part of an agreement with the actuarial firm Milliman, which drew up some scenarios for the city's two pension funds, the company insisted that anyone viewing the information sign a nondisclosure agreement." What, Milliman can't defend their analysis? Detroit's documents are a matter of national security. Release them all!
prematurex pills uk Still, the EEG brain scans indicated "poor prognosis" on Oct. 18, so doctors planned to "wait and see" whether Burns would improve over the next few days, they told HHS investigators in August 2010, according to the report. That same day, however, doctors told the family that Burns' brain damage was irreversible and that she'd undergone "cardiorespiratory arrest."
bimatoprost eyelash growth buy uk The Dow Jones industrial average was up 75.24 points,or 0.50 percent, at 15,201.31. The Standard & Poor's 500 Index was up 7.18 points, or 0.42 percent, at 1,699.74. TheNasdaq Composite Index was up 23.80 points, or 0.63percent, at 3,784.55.
aetna cvs pharmacy prescription drug plan reviews Publicis and Omnicom have so far not commented on whetherthey do intend to merge and what the rationale would be. Thecombined group would have a market capitalisation of around $30billion and annual sales of around $23 billion.
http://www.prohealth.com.mt "Maybe now, with the amount of time and distance, a black President, with all these sort of anniversaries, 150 years since the abolition, 50 years since the March on Washington, people feel that there's enough time and distance to reflect on things as well as a desire to move forward," Ejiofor said.
Cool site goodluck 🙂 npd pharmaceutical Schumer, in a statement to Reuters, said the confidentialfiling provision has been one of the most successful parts ofthe JOBS Act. He said investors still have all the informationthey need to analyze well in advance of the IPO.
medecell.com.br During the past couple of weeks, a Texas House committee andthe North Carolina Senate both approved new abortionrestrictions. Texas Democrat Wendy Davis made headlines lastmonth by stalling a Republican-backed measure with a filibuster.
lotrisone cream uk But having inspired Islamists across the Middle East by rising to power following Tunisia's 2011 popular revolution, Ghannouchi's moderate Islamist Ennahda party now finds itself within weeks of voluntarily stepping down.
glycomet gp1 forte composition Goldman and Morgan Stanley, the so-called "Wall Street refiners" who helped create the modern oil market, are expecting to find out whether they will continue to enjoy much wider commodity-related activities than their peers, including the ability to own and operate assets as they like. A five-year grace period to sell or adapt their business following their conversion to regulated banks runs out on September 21.
zantrex 3 red bottle results The trio lived a life of luxury after their international crime gang defrauded over 2,300 Britons. The con men spent the stolen money on a private jet, yachts and holiday homes in the Caribbean.
Cordell says:
I'd like a phonecard, please http://www.doversaddlery.com coupon code "Two individuals, one with susceptibility [to obesity] and one without, on the same exact diet, with the same exact exercise, the one with susceptibility to develop obesity will develop obesity," Skinner said.
manforce tablets side effects "Germany is no longer a country of fainthearts but of people who are realistic about their problems," says Manfred Schmidt, a political scientist at Heidelberg University who presented an annual survey on the "Fears of the Germans" last week in Berlin.
metformin xr 500mg sa tablets Italy's banks are battling bad debts from the country's weakeconomy. Analysts have predicted that a banking health check-upby the European Central Bank next year will show Italian bankswill need to raise more capital.
shattuck pharmacy Navalny began his rise to prominence by blogging about his investigations into corruption at state-owned companies where he owned shares. Supporters and funding poured in, turning this one-man show into the leader of a team of 14 lawyers and activists. Although state-controlled broadcasters ignored him, he exploited social media and his blog to reach hundreds of thousands.
pulmicort 0.5 nebul fiyat A U.S. defense official said a check on Pentagon recordsshowed Alexis has had "secret"-level security clearance since2008, when he passed his background check. The background checkwas initiated in 2007. That would have been before one of hisgun-related arrests and a citation for disorderly conduct.
Carmine says:
Have you got any ? absolut medical healthcare Maura Tierney, who gave a beautiful portrayal of Mike McAlary's wife Alice, was there. So was Richard Masur, and Deirdre Lovejoy, and Brian Dykstra, who himself once worked at a sports paper, now gone, known as The National.
rexavar and longinexx After 20 of 54 members of the Democratic caucus in theSenate sent Obama a letter in July urging him to nominate Yellento lead the central bank, there was little to no communicationbetween the White House and members of the Banking Committee,Senate aides said.
journal of cellular and molecular medicine impact factor 2015 "With Twittering I'm still building it," says Gruber who has a modest 171 Twitter followers. "I don't understand it well, so I'm still trying to get to know Twitter. But I do have my own website, which is NickGruber.com. So that's one thing I'm building up as well." The site, which now links to a holding page, apparently is under construction.
amoxicillin and potassium clavulanate tablets ip used for "It is really quite remarkable that Kluger could not even wait to graduate from law school before using his employment at a law firm to initiate his illegal activities," he continued. "It is equally remarkable that during most of his legal career he was involved in criminal activity, so that in an actual though perhaps not in a legal technical sense … he truly was a career criminal."
land institute prairie festival 2017 House Republicans are moving forward again Wednesday with a legislative strategy to advance piecemeal funding bills to reopen popular parts of the federal government including parks and national memorials and the Department of Veterans Affairs until a broader budget agreement is reached. Republicans continue to ask for a one-year delay in the requirement in the Affordable Care Act that uninsured Americans buy health insurance in exchange for passage of the funding bill.
Alphonso says:
Have you seen any good films recently? pygeum livestrong Over an 18-month monitoring period, the participants were asked to exercise for one hour a day, which was primarily composed of less strenuous activities such as walking or muscle workouts. The females who were on a diet plan had balanced nutrition and calorie-limit, with approximately 1,100 calories per day. Males had no less than 1,200 calories per day, all of which were specialized based on the needs of the individual.
carvedilol 25 mg tab The S&P 500 rose 3.8 percent over the previous six sessions,its best six-day run since early January and longest winningstreak since early March. At midday, the benchmark index was up2.6 percent for the week.
pronto pharmacy houston tx I spoke to Santander which, having looked into this, now said an error occurred during the processing of your remortgage application with it and this is what led to your request being incorrectly declined. In the light of the error, Santander, entirely as a result of my involvement, is waiving the full £12,000 early repayment charge and has sent you a hamper for the inconvenience caused.
radha beauty diffuser People tend to feel guilty about their coffee consumption, but some research suggests it's good for the brain, Kendrick said. It may reduce risk of dementia, Alzheimer's and Parkinson's disease. And antioxidants help with cell repair.
prise parlodel Wealthy seniors already pay more for Medicare – a lot more. High-income surcharges are levied for on premiums for Part B (outpatient services) and Part D (prescription drugs). The surcharges currently start for individuals with $85,000 or more in ordinary income, and joint filers making $170,000 or more. Anyone above those numbers pays $42 per month for Part B this year in addition to the basic premium of $104.09. The surcharges move up in bands from there; if you're lucky enough to have ordinary income greater than $214,000 this year, your monthly Part B surcharge is $230.80.
I'll text you later meloxicam 15 mg yellow pill The country's central bank has called on banks to hold corecapital equivalent to at least 9 percent of risk-weighted assetsby the end of 2014 as part of a global drive to strengthen theindustry and prevent a repeat of the 2008 financial crisis.
rayh health care viagra Viviane Reding, the European commissoner for justice, said: "The most recent spying scandals show data protection must apply to everyone – whether we are taking about citizens' emails or Angela Merkel's mobile phone.
the medical marketing doctors You simply go to the Mac App Store and press buy to download the new version. It's probably wise to back sure your computer is backed up via Time Machine first in case anything goes wrong, but it shouldn't. There have been no major reports from developers who've been playing with the new OS for the last couple of months.
cialis price sydney Wearing a loose-fitting pink shawl that had belonged to assassinated former Pakistani leader Benazir Bhutto, she continued: "I am not against anyone. Nor am I here to speak against the Taliban or any other terrorist group. I am here to speak up for the right to education of every child."
amoxicillin cost in india Supplying arms to the Syrian armed groups not only contravenes the UN Charter, but is a clear breaking of international law. Exactly what would the US do if Mexico announced its intention to arm the drug traffickers in defence of 'Free Trade'?
Could you ask her to call me? fluconazole cena apteka And this after Terry Collins had been floating a theory that his team was now better suited to win in its big ballpark, thanks to the speed and defense Eric Young Jr. has added since coming over from the Rockies a month ago, and the Mets' overall improved play in the field in recent weeks.
murad resurgence reviews blog Park's comments are the administration's most detailed explanation for the glitches that have frustrated millions of consumers who have tried to enter the site or complete applications for health insurance under the Affordable Care Act.
olanzapine medicine.bg The RBI's rupee defence measures this month have squeezedcorporate borrowers and prompted economists to lower theirgrowth forecasts for Asia's third-largest economy, which grew atjust 5 percent in the last fiscal year, its weakest in a decade.
uk-rxcart.com "I didn't play my best today but I was still hanging in there," said Stenson, who was second at both the British Open and WGC Bridgestone and third at the Scottish Open, all within the last month. "All credit to the guys behind. They played some good golf."
cialis one a day 2mg – Give up. If you don't get the pay rise now, at least the conversation has raised the idea in your boss's mind. Keep recording your successes and repeat the conversation when the time is right.
I'd like to pay this in, please perito medico judicial curso Also, many investors believe Lloyds shares are almost certain to rise in coming weeks, partly because the British economy seems to be reviving and partly for the mechanistic reason that the government has fewer shares left to sell.
gs-supplements.com/probioticreview "Ian Bell scored a hundred in each of the three victories, yet couldn't buy a man-of-the-match award, with bowlers James Anderson, Graeme Swann and Stuart Broad taking it in turns to decimate Australia.
buy garden of life raw protein uk There is something terribly wrong when you can make money (no matter how little) for only looking at ads. Ads are a way to entice the consumer to spend money, this is simply promoting ads for the hell of it.
roadrunner pharmacy east carefree highway phoenix az The one certain result of the Common Core standards is that they cause test scores to plummet. Kentucky saw its passing rates fall by 30 percentage points using the Common Core. New York students have experienced the same blow.
kpa vermox receptfritt The watchdog complains that far too little information is provided to consumers on the performance of private hospitals and consultants. Which makes it impossible for those seeking treatment to shop around in a proper way.
Best Site good looking admedes.com But with 20 projects in line for permission to send U.S. gasto foreign countries, the lawmakers said waiting two monthsbetween project decisions would push the ruling on the finalproject out to two years from now.
arrows-biomedical.com Dow Chemical Chief Executive Andrew Liveris said the company would divest more businesses in the next 12 months and focus on making high-margin products for markets such as electronics, water, packaging and agriculture.
baclofen 10 mg tablet para que sirve Target-date funds and other retirement portfolios traditionally place a lot of investor funds in bonds, both to generate interest income and because bonds have been considered safer and less volatile than stocks. Today, however, bonds may be more volatile and thus even less safe.
ratigra 50 mg
Anyone interested in a career with the police force is encouraged to look on the Lincolnshire Police website Join Us section, where more information is available about the force and its career opportunities.
pharmacross springs Guidance calling on institutional investors to takeresponsibility for their voting decisions "would go a long waytoward mitigating the concerns arising from the outsized andpotentially conflicted role of proxy advisory firms," he said.
A few months burke pharmacy "Of those who become infected and who develop invasive disease, one in three will develop pneumonia, one in three will develop meningitis and one in 10 will die. People who are at risk should ask their GP about the vaccine," he said.
healthie.in founder Born in 1845, the Victorian social realist painter Frank Holl's early career coincided with a late glorious flowering of the Victorian subject picture, a phenomenon paralleled (and to an extent created) by the popularity of the novels of Charles Dickens and Charlotte M Young.
ofloxacin otic solution 0.3 directions For parents who are worried about the mercury content of the flu vaccines, Woo said there are mercury-free ones available for kids. If parents don't want to get their child vaccinated, they run the risk of their kid catching the virus.
goodlife discount pharmacy ord ne China Central Television said the company's Dumex unit hadpaid medical staff at a city hospital in Tianjin to promote itsproducts, allegations that the French food group said it wasshocked by and would investigate immediately.
dulcolax tem generico The engineering company said it would use its free cash flowto return at least $500 million to its shareholders by the endof 2015 by issuing dividends and buying shares. The remainingcash would be used to pay debt and fund growth. URS does notexpect to look for any "significant acquisitions" during theperiod, the company said. (Compiled by Varun Aggarwal; Editing by Don Sebastian)
I've just started at cost prosvent The online poll was not based on typical probability sample. Jumio released the results but refrained to share copies of the survey questions used. No other information about the techniques and manner or survey administration was disclosed. It was also not clear if mobile phone usage during interesting activities refer to phone calls, video or text messages, Internet browsing, or use of applications.
alendronate sodium tablets usp 5 mg Alain Vigneault observed an "average" training camp from Chris Kreider, as the coach said Monday in Greenburgh, but average sure beats the Rangers' performance through seven games. And since Kreider has shown improvement during his time in the AHL, the front office ran out of reasons to keep him there.
prjktruby.com Hospital officials said only she was in fair condition when she disappeared. May said the exterior stairwell where Spalding was found was locked from the outside and equipped with an alarm. It was unclear how far the stairway was from her bed.
prescription drugs for migraine prevention "July seems to reflect a return to a 'normal', relatively uninspiring trend after a weak June, rather than the beginning of an acceleration in growth," said Alaistair Chan from Moody's Analytics in a report. "While the worst seems to be over, the upturn will be relatively flat."
generique paroxetine It included a provision known as the IPO on-ramp thatallowed "emerging growth companies" to keep draft filings withthe Securities and Exchange Commission under wraps whilenegotiations over the disclosures occur.
Dorsey says:
I never went to university wellbutrin 75 mg xl Big things are at stake in the world and America's allies need for us to be engaged. The White House found its way to a potentially productive process with the Syrians to remove their chemical weapons capacity. Secretary of State John Kerry is engaged with his Iranian counterpart on nuclear issues in the first direct conversations at that level since 2007. The president is still waging pinpoint attacks on terrorist targets in Libya and Somalia.
metformin cost walmart The hope was an agreement could be reached by October 21, when EU foreign ministers hold a regular monthly meeting. But EU officials are not convinced the date will hold. They are also not sure a deal can be clinched by the meeting after that on November 18 – just 10 days before the eastern partnership summit.
purchase viagra fast in australia Miami forward Shane Battier — who wasn't exactly thrilled about the nickname idea — said he wanted to wear "Batman" on his jersey, though was told that Warner Brothers holds the rights to that name, and other players have also had to deal with copyright-related issues with their suggested monikers. Battier said he'll go with "Shaneo" instead.
vacu vin wine saver walmart "I think the facts show he actually didn't manipulate anybody's vote, interfere with anybody's ballot," Henry Bell said. "All they did was request the ballots. The way they did it was in violation of the applicable statutes, and that's it."
amoxicillin clavulanate webmd Cousins' words are an important step, but his actions will speak louder. He must display more consistent on-court focus, prove his coachability and interact positively with his teammates. That, and only that, will quiet the questions about Cousins' willingness and ability to commit to Sacramento.
Marcelino says:
We need someone with experience repaglinide webmd Be sure to spend sufficient time brainstorming and outlining your essays – in my decade of admissions experience, these two steps, more than any others, have proven to be the key to essay-writing success. Consider asking for input from teachers, family or friends, as they may have insight into which of the stories from which you are choosing sound the most authentic and compelling.
para que serve o betnovate capilar Perez told the AFL-CIO members that he had three newspaper routes and worked at a department store and on a trash truck before going to college and law school with the help of scholarships, work-study programs and government grants.
viviscal professional hair vitamins Though the "Horrible Bosses" star and her beau haven't put a date on their pending nuptials, despite being engaged for over a year and dating for more than 2 years, the actress previously said they "already feel married."
dairy free diet cured my acne "You could envision an airplane wing where you had full-spanflaps that did a number of functions," Speer said. "They wouldmove together for both roll control and as landing flaps or formaneuver load alleviation and so forth."
is it safe to use albuterol during pregnancy Like Facebook, Twitter enjoys strong brand recognition, which typically translates to outsized retailinvestor interest. That was one of the reasons Facebook was ableto raise its IPO price to $38 a share, giving the company avaluation of $100 billion, or about 99 times its 2011 earnings.
I'd like to apply for this job goodrx femara On this week's Daily News Fifth Yankees Podcast, Mark Feinsand is joined by WFAN's Sweeny Murti during the final day of the season at Yankee Stadium as they talk about Mariano Rivera's emotional Bronx farewell.
dove comprare il cialis online Spain says it is mulling measures such as a higher borderfee for people entering Gibraltar from Spain, tax investigationsof Gibraltarians with property in Spain and restrictions on useof its airspace for flights going to Gibraltar's airport.
nite rider sex pills With no one seeming to know how to bring the crisis to an end, Tepco said last week it would invite foreign decommissioning experts to advise it on how to deal with the highly radioactive water leaking from the site.
Other notable recent drug-related deaths in Hollywood include Oscar-winning Australian actor Heath Ledger, who died in 2008 from an accidental overdose of prescription drugs at age 28, and former child star Brad Renfro, who died from an accidental heroin overdose a week before Ledger at age 25.
drugsincontext.com "Justin's international experience, coupled with his leadership in growing media businesses across new and old platforms, shows that he is the ideal candidate to lead our Media Group," said Bloomberg Chairman Peter T. Grauer, in a statement.
Some First Class stamps nmsportsmed.com The council attempted to bully a large corporation by changing an existing minimum wage law and, in the end, denied 1,800 people a chance to work. The council members can indeed boast that they fought and stood on the side of workers, but the reality is that there are now 1,800 fewer jobs in D.C. Where I'm from, that's called winning the battle and losing the war.
el ciprofloxacino sirve para la garganta The letter, also signed by Louisiana Gov. Bobby Jindal and Mississippi Gov. Phil Bryant, says, "The furlough hits us at a historically inopportune time, as evidenced by many years of hurricanes, wildfires and flooding in our states from May through October." The three governors point out that under sequestration, nearly 50 percent of their full-time uniformed military personnel will be furloughed one day a week from July through September.
cantuspharmacy.com The study highlights drug-resistant tuberculosis as an example of a growing problem, with an estimated 630,000 cases worldwide. This and other multi-drug resistant bacteria such as E. coli are areas of potentially the greatest future burden. Hence, "there is a compelling case for increased funding for antimicrobial resistance research, particularly in disciplines such as epidemiology, modelling, economics, policy, and behavioural research," say the authors.
prescription drugs cause tinnitus Together with 60 other Jewish refugees, Bent Melchior's father brought his wife and four youngest children into hiding at the home of a bishop. From there, they hoped to flee across the sea to neutral Sweden, which offered safety for refugees.
generique paroxetine I do wonder if they have any playing time to give him at all. If he's unhealthy and unable to play, the Spurs will obviously sit him. But with Coach Pop and crew attempting to keep a closing championship window open, San Antonio may not have time to mess around with an ambiguous endeavor like the one Oden presents.
Could I have , please? hulkbody.biz They attacked simultaneously about 10 p.m., using surprise to assault the flight line where they they completely destroyed six AV-8B Harrier jets , which cost about $24 million each. Flames from three burning fuel bladders shot into the darkened sky.
abilify 10 mg dosage The administration "has already completed the majority of the development of the services required to support open enrollment beginning on October 1," Marilyn Tavenner, administrator of the Centers for Medicare and Medicaid Services, or CMS, said in written testimony that appeared on the website of a congressional oversight committee on Wednesday.
clindamycine creme kopen Israeli officials insist an understanding has been reached allowing continued building in large settlements for the nine-month duration of the reconvened talks in exchange for releasing 104 long-term Palestinian prisoners, one of Mr Abbas's other key demands.
tadalafil-ar.com "It was at our cousin's birthday party," she says. "The day was perfect — too perfect. Darius was in a great mood. His youngest sister, Aaniyah, is 7 and has asthma, and she had gotten wet because they had a water slide. Darius came over to me and said, 'Mama, don't fuss at her. She's just a kid having fun.' "
euro-drugs.biz Ms Cullinane noted that the same trigger food can give rise to different symptoms, resulting in an allergic reaction in one patient and signs of intolerance in another. As a result, it is 'vital' that those who care for children 'have a clear understanding of the difference' between both.
Will I get travelling expenses? tenoretic generique Footage from an outside security camera shows the passenger-side rearview mirror snagging a garbage can as he backed out and dragged it down the driveway before the car lodged in the partially opened gate.
community care rx totowa Moody's Investors Service said on Tuesday that BP's credit ratings could tolerate a moderate penalty under the Clean Water Act but warned that "a severe penalty resulting from a finding of gross negligence could change the equation."
paracetamol codein ohne rezept "In the interests of our U.S. colleagues, we're open to suchan allocation (of an order)." Osterloh, also a member of the IGMetall engineering union, said the UAW was prepared to cede someof its rights to a works council.
vi shape superfood The anti-Morsi protesters erupted in celebration with fireworks being shot into the sky, but earlier in the day armored vehicles were used to separate them from an enormous crowd of Morsi supporters.
superdrug online pharmacy "This operation was run with full U.S. knowledge, and the arms were only meant to go to the FSA," Higgins said, referring to the secular-leaning Free Syrian Army that U.S. officials prefer to deal with. "After a couple of months, they began to appear in the hands of groups like Ahrar al-Sham and Jabhat al-Nusra, showing they had spread beyond the FSA."
I work for myself uc davis medical center parking ticket Bayerische Motoren Werke AG's spokesman in South Africa spokesman, Guy Kilfoil, said the strike started last Thursday and was likely to lead to loss of production of nearly 1,700 3-Series sedans as of the end of Wednesday.
para que sirve el femalefil If you've been hanging around here for a while, you'll know that I'm interested in drug resistance in food, because it distributes drug-resistant infection more broadly through the world, and because it often indicates that the resistance arose from antibiotic use in agriculture. If you're new to this topic, start with this: When people with a foodborne illness go to the doctor, they are often treated "empirically" — that is, they are given what is widely agreed to be the right drug for the organism most likely to be causing what is making them sick. But they often are not tested to see what the actual bacterial cause is, and it is even less likely that the bacterial cause, once cultured, will be tested for drug susceptibility. What all that comes down to: If someone is given a drug to which their organism is resistant, they will not get better — and the longer the infection lasts, the more likely they are to suffer serious long-term consequences down the road.
healthbizinabox.com Tony Preedy, Lakeland's marketing director, added, "Our experts analysing the situation have not been able to confirm whether any data has been taken but we decided it was appropriate to tell customers there was a risk. We had not left the doors unlocked, so to speak, but nevertheless they were able to penetrate."
natural max slimming capsules blue 50 pills Chesapeake said the carrying value of its $10 millioninvestment in a 1.1 percent stake in the 17-year-old company,backed by Texas oil billionaire T. Boone Pickens, had increasedby $3 million before the stake sale last month.
ball refill price Tuesday's latest readout from the malaria trial, which is Africa's largest ever clinical trial involving almost 15,500 children in seven countries, were presented at a medical meeting in Durban, South Africa.
I'm on business internalmedicineltd.com The telescope will be used to help astronomers detect and characterize exoplanets while investigating dark matter and dark energy, among studying other space phenomenon such as the physics of black holes.
rusan pharma kandla contact number But, without concrete Iranian concessions on key issues such as uranium enrichment, the Arak heavy water reactor and the need for more intrusive IAEA inspections, the talks will go nowhere. This is why the US and EU should leave sanctions in place during the talks and not agree to diminish or remove them until Iran has committed to a fundamentally different course in their actions and not just in words.
isordil 5 fiyat "He was very confident this morning, relaxed, and excited for the day. He said 'I'm going to bring you home a Claret Jug'. I always have confidence in him but he was especially relaxed today."
amoxicillin prophylaxis dose for dental work On this week's Daily News Fifth Yankees Podcast, Mark Feinsand sits down with Yankees captain Derek Jeter to discuss his frustrating season, the A-Rod situation and his take on Mariano Rivera's final season.
harga obat cipralex 10 mg The A-line sleeveless dress has a fitted waist, high neckline and a pleated skirt. It's 100% cotton — breathable enough for hot summer days, like when Abedin wore it last month while on the campaign trail with husband and mayoral candidate Anthony Weiner.
Barney says:
I'm a partner in schwabe pharmaceuticals group Boulder and towns along the Front Range of the Rockies northof Denver were especially hard hit as water poured downrain-soaked mountains and rushed through canyons that funneledthe runoff into populated areas.
legalsteroidstobuy.com "Yankee fans should be so appreciative to have a guy like Alex Rodriguez on their team. Do you know how good he is? Do you realize what a player he is, the things he's accomplished already before the age of 30?"
singulair tablets Not only have the unions only managed to muster a small minority in support, it's also been a year since members were balloted. Any claims that these strikes, planned for October, are democratically mandated are, to put it charitably, extremely thin.
generic4all-global.com A senior white house aide told ABC News that after watching the debate over the Zimmerman verdict for five days and talking about it privately with family and friends, including first lady Michelle Obama, the president called his senior staff into the Oval Office Thursday afternoon to say he wanted to "speak from the heart" and make some personal remarks about Martin's death and trial.
herbal alternative cialis Property tax revenues provide the bulk of school funding.But with the bursting of the housing bubble and financial criseshitting cities, state aid to school districts became increasingvital. States often determine funding using student populations.
Incorrect PIN male intense stomach pain The planned acquisition follows Baidu's announcement in Maythat it would buy the online video business of PPS Net TV for$370 million. Chinese rivals Tencent and Alibaba Groupare also investing to stimulate revenue growth, with Alibabathis year buying stakes in Sina Corp's social-networking website Weibo and in navigation and maps firmAutoNavi.
medilabest.fr Economists have warned that a debt default would createglobal economic chaos, and analysts warned on Friday that if theshutdown lasts more than a month, it would cause a sharpslowdown in fourth-quarter economic growth.
viramax directions Two people were rescued on Old Conover Startown Road after a motorist was swept off the roadway, and a second motorist was swept away in an attempt to save the first. Both were rescued and taken to the hospital.
veinerect capsules The low-energy part of the spec is particularly important, since anybody who's used almost any Bluetooth accessory with their iPhone can attest to its effect on bottom-line battery life. Apple, like any other company in the mobile device market, is always trying to wring more longevity out of its products; lately, that's been in the form of more and more intelligence power management. With control over both the hardware and the software, Apple has the potential to squeeze even more performance optimizations out of these types of application.
prediktormedical.com In fact, the Chromebook 11 isn't much heavier than Microsoft's upcoming Surface Pro 2 tablet, which weighs 2 pounds. The Chromebook's 11.6-inch screen, measured diagonally, isn't much larger than the screen of the typical full-size tablet. The new Chromebook even uses the same Micro-USB charger that non-Apple tablets and smartphones use. No longer do you have to keep track of which charger goes with which device or pack an extra charger for a vacation.
An envelope rrssupplements.com 1. Don't trust a government that doesn't trust you. As a country of the people for the people, I feel that the people should have the right to defend it's self against any abusive power that may come to be. That would include the right to RPG's or tanks or nuclear weapons if necessary. If our government has them then the people should have them too. The fact that you trust our government is foolish at best. No government is benign. My ancestors knew this, that why they wrote the right to bear arms in the constitution.
garden of life raw organic protein chocolate review Khalil Alamour's comfortable house in the Bedouin village of al-Sira boasts many things: a well-tended garden, a clutch of chickens, a complex home-built water system. There's also a government demolition order pasted to the front door.
methylprednisolone conversion to po After nearly 10 months in a North Korean prison camp, Kenneth Bae could be set free. Bae, an American Christian missionary, was detained last November after officials accused him of "hostile acts" against North Korea, and for encouraging citizens to overthrow the government. He was sentenced in April to 15 years of hard labor.
mrm veggie meal replacement vanilla bean There has been a consensus for some time that bond prices have peaked. They were driven to unprecedented levels by investors seeking safe havens during the financial crisis. But now that economies are improving investors are prepared to take more risk in the hunt for higher yields; bond yields, which move in the opposite direction to prices, are very low by historical standards.
health.department.bihar It began with a filmed sequence in which Daniel Craig's James Bond escorted Queen Elizabeth II from Buckingham Palace and into a helicopter. Stunt doubles of Bond and the queen then performed a live parachute jump into the Olympic Stadium. Sutton was the tuxedo-clad Bond, while his friend Gary Connery wore a pink dress and wig to play the queen.
Cyril says:
Children with disabilities esomeprazole magnesium generic vs nexium The deal came after Republicans relented on demands for a roll back of Mr Obama's signature healthcare law and the votes in Congress exposed a wrenching divide between hard-line conservatives and their more moderate colleagues.
can i buy prilosec otc in canada In his June 14 proposal to creditors, Orr listed pensions asunsecured debt of the city. Payment on pensions, retireehealthcare and $641 million of general obligation bonds allwould be made from the city's proceeds from $2 billion of notesOrr plans to sell as part of his restructuring plan.
methylprednisolone dose to prednisone "I understand full well where some of these big companiesare coming from. They're important parts of the Canadian economyand they have a responsibility to protect their profits, protecttheir bottom lines for their shareholders," Harper said.
male enhancement pills china Patel said, however, that the bond market sell-off has beendriven more by anticipation of the Fed's pullback thanfundamentals, since inflation has not changed and there has been"no sign of material improvement" in the labor market.
musclepharm combat crunch bars chocolate chip cookie dough 12 bars Therefore Labour leaders often run in fear of being soft on unions, and this in turn can lead them into being trapped, or trapping themselves, into situations where they end up trying to take the unions on in order the get electoral credibility. This worked for Blair in 1995 when he abolished Labour's commitment to nationalisation. It worked less well for Callaghan in the winter of 1978-79, or for Wilson 'In Place of Strife', his plans to reform union law, in 1969. The danger for Miliband is that in trying to satisfy the anti-union agenda of his opponents he will lose control of the debate and support within his party. The opportunity, perhaps, is that by being 'tough' he can win over new supporters. But those new supporters are unlikely to remain supporters for very long if this is all he has to offer. It is interesting that Lord Whitty has refused the invitation to oversee the changes – seeing them as 'unworkable'. Whitty is no fool, having been the party's general secretary at a time of considerable positive reform under Neil Kinnock in the 1980s.
Booker says:
I'm on business http://www.essencehealthcare.com/member/site-map.aspx A 2010 lawsuit filed by College Health against a formersecretary, Esther Spero, in the U.S. District Court for theSouthern District of Florida sheds light on the Miami-basedpartnership's troubles. It said Spero forged names of CollegeHealth employees who were authorized to transfer funds from itsaccounts, but transferred the funds for her personal use.
start up costs for a new pharmacy So really, what is there to say? You know what you're going to get, and that is, indeed, what Sandler delivers. It's juvenile, it's obvious and it's crass. But with Sandler at the helm, at least it's as easy to like as it is to forget.
online.medservice.kz The administration also confronts a fiscal deadline on October 1, when spending legislation is needed to keep government programs running. Lawmakers will also need to raise the nation's debt limit, probably in November, to avoid a debt default.
moxifloxacin rxlist The world of infosec was shocked to learn today that Barnaby Jack has passed away. Jack–who worked by day as director of embedded security research at IOActive, was a hacker and security researcher known for grandiose exploits like the "jackpotting" attack that causes ATMs to spit out cash.
healthcareforallmn.org It currently has a 33.5 percent holding and is under pressure to complete the sale quickly because the bank needs to carry out a 2.5 billion euros capital increase by end-2014 to meet EU conditions for approving a state bailout.
I'm interested in southside pharmacy corpus christi tx The world's third-largest smartphone maker after SamsungElectronics Co and Apple hopes the new tablet with asharper display will help it gain traction during the year-endholiday season as Android-based tablets continue to win marketshare from Apple's iPad.
macro greens lawsuit Earlier this year, a group of 41 geologists, paleontologists and other researchers affirmed the theory, first posited in 1980, that an asteroid impact, later found at Chicxulub, Mexico, wiped out the dinosaurs 65 million years ago.
mapharma.fr.benefito.com Other operators that applied to offer online gaming includeCaesars Entertainment ; Donald Trump's TrumpEntertainment Resorts; the Tropicana Casino and Resort, sold ina bankruptcy sale to a group of creditors led by Carl Icahn in2009; and The Golden Nugget, owned by Landry's Inc.
ashwagandha keeps me awake An OGX bankruptcy would lead to the largest-ever corporatedebt default in Latin America, involving $3.6 billion of bonds,according to Thomson Reuters data. Once a Brazilian courtaccepts a filing, the company has 60 days to negotiate withcreditors and present a corporate restructuring plan.
propharma regulatory services Johnson directs his own wildly imaginative but also scrupulously researched play with panache, achieving a farcical comic momentum that somehow finds space for moments of both deep emotion and intellectual rigour. Lez Brotherston's design meticulously re-creates Freud's study as well as offering some spectacular dream-like surprises in the course of the play, while the cast is outstanding.
magic story very thanks malibu pharmacy ltd nairobi Even though the study uncovered some of the reasons for survival differences, the disparity can't yet be completely explained. "We don't fully understand why blacks present with worse disease characteristics," Silber said.
viagra zollprobleme Merkel, Germany's chancellor since 2005 and the de facto leader of the European crisis response that has mixed aid with austerity, told supporters it was "a super result." She wouldn't immediately speculate about the shape of the next government, but made clear she plans to serve a full term.
intimax 100 fake The 2012 figures may offer a glimmer of hope, but the latest comparisons by the Organisation for Economic Co-operation and Development showed South Korea was by far the most suicidal society, followed by Hungary, Russia and Japan.
dfepharma.com.br "We found that differences in language development in early childhood and school age predict alcohol-use behaviors in adolescence and up to young adulthood," study corresponding author Antti Latvala, a post-doctoral researcher at the University of Helsinki, said in a journal news release.
barangaroo pharmacy sydney Jeter, who went hitless in three trips (one strikeout) to drop to 1-for-9 with four walks over four rehab appearances, admitted the Yanks' ongoing offensive woes without several injured regulars have made it more frustrating that he was not yet back in the Bronx before Thursday.
Whereabouts in are you from? kamagra soft tabs uk Still, that all parties have agreed to meet again is a sign that there was enough progress to continue to keep the talks going. Iranian officials have stated publicly that they would like a deal within the year.
what does the bible say about taking prescription drugs The plant processes around 200,000 barrels of oil a day and supplies most of Scotland's fuel, however, Ed Davey, the energy secretary has said that the shutdown would not hit petrol and diesel supplies.
quetiapine 50 mg uses Verizon agreed to pay $130 billion for Vodafone's stake in their U.S. joint venture, an enormous deal that gives Verizon full control of its wireless operations after more than a decade of negotiations.
worldmedicine.kz Babacan has been a key figure in the cabinet since the AK Party came to power, overseeing the economy for all but a brief period when he served as foreign minister, and winning a reputation for prudent policy in the years after a 2001 crisis.
testo boost xs testosterone booster gnc The ECB will start supervising the euro zone's banks from late next year as part of a closer integration of the European financial system, in response to the crisis that threatened to overwhelm the bloc's weakest government debtors and some of the banks that hold their bonds.
Nilson says:
I'll call back later trenthillshealth.com The revelation comes as Cuomo's anti-corruption commission has sought more detailed information on the outside employment of state lawmakers. On Friday, the Legislature refused to give up the info.
donde venden vigorelle "It does hurt the heavier driver, and it's very unfair to say 'lose weight' because some of us can't lose any more," said Button, who reckoned 10 extra kilos equated to three-tenths of a second in lap time.
bionorica.de I guess we can talk about this drug, in 2018 or 2019. Maybe patients can take the Tesla Hyperloop to their doctor by that time. Throw out the clinical trials of belviq. Early Belviq users have experienced 200-300% greater weight loss than the clinical trials. Wowza, check ellie wenker blog, 293-268, in only 9.5 weeks. Belviq also helps controls blood sugar levels, users have reported lowering insulin intake by as much as 80%. wowza.
regenix hair loss treatment reviews "Going away to college is the one opportunity to invest in yourself," says Tanner. "It is the one time in your life where you have the opportunity to go and think, 'Who do I want to become? What kinds of friends do I want to have?' College is as much about that as it is about preparing for your career – if not more."
what is betamethasone dipropionate lotion usp 0.05 used for LITTLE ROCK – Attorney General Dustin McDaniel and other attorneys general from across the country today urged the U.S. Food and Drug Administration to implement restrictions on the advertising of electronic cigarettes and to prohibit the sale of the products to minors.
Odell says:
What company are you calling from? cialis generico tadalista Sunday's death toll was the highest Alaska has seen in any plane crash in more than a decade. The NTSB assembled a "go team" of six experts, joined by one Alaska-based NTSB official, to investigate the accident.
dr mao slimming capsules The Euro STOXX 50 rose 0.4 percent to itshighest since mid-2011 and the DAX gained 0.5 percentto a new high after U.S. Senate Majority Leader Harry Reid, aDemocrat, and his Republican counterpart, Mitch McConnell, endeda day of talks on Monday, with Reid saying they had made"tremendous progress".
generic.list to generic.ienumerable Somali police said seven people were killed in Barawe. U.S.officials said their forces took no casualties but had brokenoff the fighting to avoid harming civilians. They failed tocapture or kill their target during fighting around dawn at aseaside villa that al Shabaab said was one of its bases.
menevit new zealand The 25-year-old woman died in July in a Southern California hospital after giving birth in Las Vegas to twins, including one who also died of TB. Local health officials say at least 26 people with whom the mother came in contact have tested positive for the disease.
cheap bathroom renovation supplies Sanchez was his maddening self. He showed poise by hanging in the pocket and firing a first-down completion to rookie Ryan Spadola. However, as has been the case in recent years with Sanchez, the prosperity didn't last long.
Winfred says:
I'd like a phonecard, please prilosec nexium compare A third drawback to the technique, Murji added, is that it could cost more if surgical tools have to be modified – although Shepherd said the same instrumentation can be used and the cost should not be any different.
beli saw palmetto Perhaps Fama's biggest contribution to the happiness andsanity, not to mention wealth, of the average investor is inproviding the intellectual underpinnings for the growth of theindex fund movement.
herbal pharmacist salary The wave of upcoming student transfers is opening old wounds and reviving difficult public conversations about race, class, income inequality and other thorny social problems that many thought — or at least hoped — has been set aside decades ago. Students at the two troubled district are predominantly black, with the schools and communities they're headed to largely white.
kracked out caffeine "He said he would recommend 215 reform, but he said 'appropriate' reform and we don't know what that means," said Electronic Frontier Foundation digital rights analyst Trevor Timm. "There were no concrete changes to the actual surveillance programs."
how long after eating to take viagra Girardi might have been on to something. In his 11th Yankee outing on Wednesday, Soriano homered against Hector Santiago in his first at-bat, the second time he's taken the lefty deep in six career meetings. He finished 2-for-3.
Numbers says:
Have you seen any good films recently? atka pharma south africa The government has been partially shuttered since October 1. The shutdown has lasted longer than many expected, and while proposals from both President Barack Obama and congressional Republicans have been viewed as signs of progress, a final agreement remains elusive.
bactohealth.com Putin has frequently accused the United States of double standards on human rights and has championed its critics, but he has invited Obama to Russia for a summit in early September and does not want to ruin the chances for that.
penatropin negative reviews Citigroup, Union Bank and BB&T were among the first toannounce benchmark-sized deals Thursday, quickly followed bySweden's Svenska Handelsbanken, Brazil's development bank BNDES,Nissan Motor Acceptance Corp and Reinsurance Group of America.
precio aldara On his return to Norwich, he said: "It feels like sitting in a warm bath whilst having a cup of cocoa and peanut butter on toast whilst watching Air Crash Investigation on a TV – it feels good."
bayhealth.org/volunteer Brown gave Veronica to her white adoptive parents, Matt and Melanie Capobianco of South Carolina, at 7:30 p.m. CDT on Monday in an emotional but peaceful handoff, Cherokee Nation Attorney General Todd Hembree said in a statement released late Monday.
Arnulfo says:
Please call back later day lewis pharmacy thorne doncaster The International Monetary Fund's governing panel, after asemi-annual meeting, acknowledged the risks posed by atransition toward more normal policies in advanced economies,and it urged nations not to delay preparations.
levitra 10mg bayer preisvergleich Fire department officials have said Ye's body was covered by a one-foot-thick (30-cm-thick) blanket of firefighting foam when she was found. Hayes-White said on Friday she did not know whether Ye was covered in the foam at the time when she was struck by the truck.
precio cialis generico en farmacias "It takes some of the sheen away because over the last few days there was a lot of satisfaction and pride in the country that though these were modest steps – launching an aircraft carrier is a big deal for a country that till 10 years ago was not even making a scooter, forget about a car," said defence expert Uday Bhaskar.
john gilbride pharmacy glasgow The debate has lurked over golf since Martha Burk and her women's advocacy group targeted the home of the Masters in 2002 for admitting only men as members. Then-chairman Johnson famously said the club would not be bullied into accepting women "at the point of a bayonet," even at the cost of cutting loose television sponsors for two years.
precio cialis 5 mg When Spitzer made his first run for attorney general in 1994, he claimed to have financed the unsuccessful race with personal funds. In fact, he had borrowed from a bank and, in an end-run around campaign laws, used a $3 million bailout from his father, a wealthy real estate magnate.
We were at school together nome genrico do lexapro The cost for insurance against a J.C. Penney default has shot back to near record-high levels during the last week. With about $2.6 billion in bonds outstanding, the company has a "CCC " credit rating from Standard & Poor's, reflecting a substantial risk in owning its debt.
hec pharmaceutical co. ltd "Restoring confidence and trust is not simply about Libor… it's by no means the only one capable of knocking marketconfidence," Wheatley told the same conference. "Do we hold allbenchmarks to the same broad standards, or do we allow thereputation of some to climb, others to fall?"
metformin hcl er 500 mg tablet Many, such as the famed short-seller Jim Chanos, were also big clients of Morgan Stanley's prime brokerage and stock trading businesses, and expressed their displeasure by taking their money elsewhere.
tablet endurex That sums up why Democrats can't (and, hopefully, won't) agree to the piecemeal approach – it would become a backdoor defund mechanism where the House would fund the parts of the government it likes and leave the rest to wallow.
meow meow tweet underarm primer U.K. companies were ordered to put their audits out to tender every 10 years and give shareholders a vote on their accounting reports, in an effort by competition authorities to sever the cozy ties between some companies and their auditors.
I'm doing a phd in chemistry heatherhealthcoach.com Scout its array of boats, inflatables, electronics and fishing gear. Sunday especially will offer whole-family fun, including two afternoon animal shows and kids' fishing lessons. Admission is $10 adults, $8 for seniors and free for ages 12 and under.
complete body detox diet The tie-up with China Minsheng, the country'sseventh-largest listed bank, includes cooperating on wealthmanagement and credit card businesses, direct banking andinformation technology, the lender said in a securities filingwith the Hong Kong stock exchange on Monday.
trazodone 300 mg Petraeus played vital roles in the Iraq and Afghanistan Wars during his military career. He was appointed as director of the CIA in 2011, but resigned that post last year after an extramarital affair scandal.
http://www.adlershop.ch In retrospect, it was too late. The investigative report says the men were overcome by a 2,000-degree firestorm two minutes after the emergency call. Flames reached 60 feet skyward. Some hotshots did not even make it into shelters. The area was shrouded in smoke, so air support could not have helped even if the crew's location was known.
mobile.reachpharmacy.com Mr Gohar, who is due to resume full duties at his Grangemouth church on Sunday, stressed that most Muslims had been "respectful and kindly" in the 130 years of the Christian Church's existence in Pakistan – and displayed those same qualities after the tragedy.
How many more years do you have to go? cheapmedstore.com "I've had three shoulder surgeries," Bedard, who was once traded to the Mariners for three eventual All-Stars, explained to reporters. "I'm not going over 110 [pitches]. I'd rather pitch a couple more years than face another batter."
levitra schmelztabletten erfahrungsberichte Three years later, an even bigger hallmark of the financialsector was almost shattered when Cyprus made a botched bid toburden small depositors. In March, it became the first eurozonecountry to impose losses on large depositors, following a pathbeaten far more quietly by Lithuania a month earlier, whenlosses were imposed on large depositors of failed Ukio Bankas.
williams medical supply in nashville tn There were more misadventures by the Yankee fielders the next inning after Sabathia loaded the bases on a pair of walks around a double to center by Brian Dozier that took a crazy bounce away from the charging Ichiro. A popup by Joe Mauer over CC's head and just out of his reach delivered another Twins run and then Lyle Overbay allowed Doumit's grounder to first get past him to make it an 8-1 game.
green envee hong kong NIOSH researchers found that silica concentrations exceeded the current, more lax OSHA standard in 47% of the 116 samples taken at the 11 sites. More than three-quarters of the samples, or 79%, were greater than the more stringent 50-microgram standard now proposed by OSHA.
careersinpharmaceutical.com For instance, companies could use statistical sampling, anoption that the SEC's Chief Economist Craig Lewis said couldreduce compliance costs. The SEC would also permit annualizedfigures for permanent employees who did not work a full year,such as new hires.
I'm from England rx care pharmacy lady lake fl Warner Bros., a unit of Time Warner Inc, released"Gravity" and "Prisoners." "Cloudy 2" and "Captain Phillips"were released by Sony Corp's movie studio."Rush" was distributed by Universal Pictures, a unit of ComcastCorp.
illegal drugs price list uk The U.S. Treasury Department on Tuesday sold $30 billion ofone-month bills that will pay an interest rate of 0.35 percentto investors. This was the highest one-month federal borrowingcost since October 2008 when markets worldwide were roiled bythe global credit crisis.
flovent ventolin order "I was surprised at how well [the technique] worked, not only for persistent chemicals but for hormones that typically rapidly degrade," says Usenko. "It allows us to ask more complex questions that are difficult to get at, like: What are the impacts of contaminants or stress on these animals?"
stanozolol injection price in delhi BlackBerry's Toronto-listed shares fell as much as 23.7 percent to C$8.25 on Friday, their lowest this year, before closing down 16 percent at C$9.08. The company's Nasdaq-listed shares ended 17 percent lower at $8.73, after falling as low as $8.01.
albuterol sulfate street price "Full thrust achieved on 2 sec static fire," company founder, chief executive and technical lead Elon Musk posted on Twitter early Friday. "Some anomalies to be investigated, so launch date tbd."
Newton says:
I'm on work experience farmaihealthyshop.com Majority of those who admitted using smartphones during their intimate moments with their partners are in the age group 18 years old to 34 years old. In that bracket, about 20% or one in five said they are doing it. About 12% of those people also revealed that the practice somehow affects their relationships.
reliable-tablets.com reviews In the interview, the Archbishop criticised Conservative ministers for trying to drive a wedge between "scroungers" on benefits and "strivers" in work. He said: "The rhetoric is very damaging.
flagyl 25 mg/ml dosage "That being said, there are sales of whale meat to places that prepare the meat for tourists as well," she added, "although the locals claim that they depend on such sales in order to be able to afford necessary goods for their every day life."
cialis-store.net The recent rally in material counters was further stalled bycomments from China's industry minister, cited in the officialShanghai Securities News, that Beijing will push ahead withefforts to cull excess capacity a year earlier than planned.
uscamx.com reviews Canadian Natural said in an email that production has beenreduced following the incident on TransCanada's 1.6 billioncubic foot per day North Central Corridor pipeline, whichdelivers gas to the Athabasca oil sands region.
I'd like a phonecard, please elizabeth pharmacy flushing It usually takes about 10 to 15 minutes for kids to get settled onto the table and hooked up to an IV. The test itself lasts under a minute, but the radiologists are depending on the kids to stay very still during that time.
harga lithium battery cr2016 3v The struggle between the military and the Brotherhood escalated in the early hours of Monday morning when more than 50 people were killed. Security forces opened fire on pro-Morsi demonstrators outside a Republic Guard facility in Cairo's Nasr City.
loperamide yahoo "To an extent, yes," he replied. "We're still talking about trying to sort testing out and we're in October. I just hope the engine manufacturers for next year have been able to do their work, and as they desire.
costco pharmacy application online Dr Sarah Wollaston, the MP for Totnes, said the veils are "deeply offensive" and are "making women invisible". She suggested that the niqab should be banned in schools and colleges.
coconut cream concentrate walmart A combination of healthy U.S. corporate profits, arecovering economy and low interest rates is feeding the bullmarket in stocks, which most analysts expect will continuethrough the end of the year. Profits are expected to rise about6 percent this year, on average, according to Thomson Reuters,which gives stock prices some more room to grow.
Could I order a new chequebook, please? family medicine group oxford ms DUBAI, July 23 (Reuters) – Shares in Dubai construction firmDrake & Scull surged to an all-time high on speculationthat the firm might become a takeover target, while earningsoptimism lifted United Arab Emirates markets in general onTuesday. Other Gulf bourses were flat to higher in thin trading.
lekarna-bez-receptu.com recenze The long/short strategy has struggled in the past few yearsas macro issues were dictating market moves, but there has beena strong revival of the approach this year, with brisk inflowscoming into the funds as volatility dropped and stocks startedto trade more independently of each other, allowing stockpickers to thrive.
nubreed whiplash ingredients Still, RBC argues that a smooth transition to full marketsfinancing by mid-2014 was still unlikely due to a combination ofstill weak growth, high debt and political resistance toausterity, meaning "a follow-on programme remains necessary".
prelox blue prezzo Congressional committees are holding up a plan to send U.S. arms to the rebels because they doubt the deliveries will be decisive in the war and they fear the weapons might end up in the hands of Islamist militants, U.S. national security sources have told Reuters.
rsahealthcare.com Weiss, who covers top college events for the Daily News, including the BCS national championship and the NCAA tournament, and writes columns for Basketball Times, coach George Raveling's web site and Blue Star media, and O'Connell will be honored on Thursday night, Oct. 24, at New York's University Club, Fairfield Athletic Director Gene Doris announced Thursday.
It's a bad line apaxil giorno prezzo Ortiz said he had not spoken with Dempster since Thursday's story in USA TODAY Sports, in which the Red Sox slugger was quoted as saying he did not agree with Dempster's hitting Rodriguez with a pitch.
micro touch max all in one personal hair trimmer "Member states acknowledged that, regarding the vehicleswhich do not conform with EU law, corrective measures shall betaken to bring the vehicles into conformity including thewithdrawal of those vehicles already sold on the market, as ithas already been done by a member state," the Commission said ina statement, referring to the French registration ban.
buy enthusia The position limits rules are among the most contentious of the 2010 Dodd-Frank legislation reforms that aim to prevent a repeat of the financial crisis but they threaten to compound the troubles facing Wall Street's biggest banks whose role in physical commodity markets is under fire.
vazopren liquid
"Some of the limitations are that if a species doesn't make any sounds you are not going to capture it. But a large range of species – birds, animals, amphibians, marine mammals and insects – there are many species that we can monitor in this way."
actionhealth.com Has anyone thought of giving small business a tax break for hiring unemployed people. I mean they do not have to pay any taxes at all. On the other had greatly increase the tax on business who do not hirer unemployed. Want to end the unemployment issues this will do it.
I can't stand football is viagra banned in singapore In a 2012 poll by CBC and the NHL players' association, 98 percent of players said they did not believe fighting should be completely banned. Even after the Parros incident, there has not been any player call for drastic change.
costco pharmacy open to the public It appears that the 28-year-old Busch is coming of age before our eyes. So far in the Chase he has finished second at Chicagoland and second at Loudon. He's showing newfound patience and prudence behind the wheel. As a result, he trails Kenseth by only 14 points in the standings.
cocaine and viagra side effects Professor C. Bodin is accompanied by Diner Waitress, Evil Mech, Jazz Musician, Holiday Elf, Constable, Dirndl Girl, Scarecrow, Barbarian, Welder, Mountain Climber, Grandma, Island Warrior and a Gingerbread Man in Lego's latest minifig collection. In stark contrast to the Scientist, there is also the Lady Robot, decorated in pink accessories and rosy cheeks. She has a feat others can't claim: She claims to party like nobody else.
meridian medical supply many louisiana The new laws will also apply to threats made against trains,ferries as well as other public facilities like shopping malls,the China Daily said. It also warned people from disseminatingrumours about such threats via text messages or social media,saying they could be criminally charged.
alpha rax xtreme uk "The economics are hot although the politics are stillcold," said Zhang Zhexin, who studies Taiwan policy at theShanghai Institute for International Studies. He estimates Chinahas rebuffed at least five countries' requests to switchdiplomatic recognition to Beijing.
Children with disabilities topamax and zoloft together "I want to thank every American who participated in this election, whether you voted for the very first time, or waited in line for a very long time," Obama said in Chicago. "By the way, we have to fix that."
taking seroquel and zyprexa together The Congo is a land far away, yet our histories are so closely linked. We have thrived from a lopsided relationship, yet we are utterly blind to it. The price of that myopia has been human suffering on an unimaginable scale.
landmark specialty pharmacy inc While there may be questions about Flores' defense — he made an error and had one other shaky throw — Terry Collins seemed eager to see Flores take on major-league pitching. This is a guy who was batting .321 at Triple-A Las Vegas and leading the Pacific Coast League with 86 RBI.
best drugstore matte orange lipstick Laura Mvula, 27, graduated from the Birmingham Conservatoire with a degree in composition. But it took two years working as a receptionist, while recording songs on her laptop, before she was signed by the Sony subsidiary RCA. The past 12 months have been non-stop: she released her debut EP last November and the following month was nominated for a Brit Awards Critics' Choice. In March she released her debut album, Sing to the Moon, and she has had a sell-out national tour and played at festivals including Glastonbury and the Urban Proms earlier this month. Her latest single, She, is released tomorrow. Mvula lives in Birmingham with her husband, Themba.
bodybuildingsupplementss.com "What we want to talk about is the lighting on the barges," he said. "We want to pursue that because this is crazy. You've got two anchor lights, one on each side of the barge. With the glare off the bridge, you can't see it."
Have you read any good books lately? acheter kamagra moins cher Bond yields spiked higher in May and June on fears of rising interest rates tied to a potential pullback this year of the Federal Reserve's bond purchases. The Fed is buying $85 billion in Treasuries and agency mortgages monthly in an effort to spur hiring and lower long-term borrowing costs.
citalopram online canada The singer's "Beyhive" may be going through some changes, but the star exuded her usual fabulousness rocking denim short-shorts, a loose "Name Brand" tank, a pair of aviator shades and a gold headband.
i pharma solutions karachi "I understand the pain of losing someone very close. My father too was killed… Anger over violence is natural but it only hurts common people. The Bharatiya Janata Party (BJP – India's main opposition party) makes use of people's anger," the Hindustan Times quotes Mr Gandhi as saying.
drug-consult.com The Major League Baseball All-Star Game was the third most-watched prime-time program last week and first among young adults, despite near record-low viewership for the annual midsummer classic, according to live- plus-same-day figures released today by Nielsen.
shatavari ghulam As previously reported by Reuters, EADS will be calledAirbus Group and and will combine its defence and spaceactivities in one Munich-based division together with AirbusMilitary transporters, currently twinned with passenger jets.
I saw your advert in the paper revatio 20 mg preã§o "What I can tell you with certainty is we will not be able to meet all of the obligations, pay all of the bills if we don't have enough cash. And there's no good outcome to where you end up," he said. "I mean I think that everyone understands that not paying interest and principal on the debt would be catastrophic."
lexapro or prozac for pregnancy Down through the long echoing corridors of time, throughout our history, our US Constitution was our Guiding Light, our Safety net in times of doubt, our life preserver at such moments when the Ship of State was in danger of capsizing and going under.
buy rogaine canada walmart "This is my favorite Interview of all time. If I disappear or die in the next week – you'll know who kidnapped and killed me. @katgraham – because I publicly outed her deepest darkest secrets! Whoops!"
4umedical.com At the end of the day it comes down to do you actually want information delivered to you from your mobile via another device, or can we all just live with the fact we'll need to fish our phone out of a pocket if we want an update?
taiyoupharmacy.com GAZA CITY, Gaza Strip (AP) — Egypt's new government has imposed the toughest border restrictions on the Hamas-run Gaza Strip in years, sealing smuggling tunnels, blocking most passenger traffic and causing millions of dollars in economic losses.
Branden says:
How much does the job pay? coat hanger prostate massager "It doesn't seem like a reconciliation is any closer to happening. It's like the situation is just too far gone at this point for a split to be anything but unavoidable," another source added to the mag.
naltrexone mu-opioid receptor Income tax is currently capped at 30 percent but the reformwould levy a top rate of income tax of 32 percent on peopleearning over 500,000 pesos ($37,900) a year. The proposed reformalso intends to charge a 10 percent rate on capital gains anddividends on the stock market.
medrol vet costo Pneumococcal disease is easily spread by close contact, coughing and sneezing, however a vaccine is available and recommended for infants, those over the age of 65 and those with certain conditions, such as chronic heart disease, chronic lung disease, chronic renal (kidney) disease and diabetes.
clopidogrel drugs.com The debut of the one-pound iPad Air and MacBook Pro withsharper 'retina' display repeats a pattern of recent launcheswith improvements in existing lines rather than totally newproducts, and Apple shares fell 0.3 percent for the day.
viagra pills for women in india The dress however, in it's creamy hue is working the new neutral trend beautifully. Washed out dusky pinks, stones, beige and white are the key colours of this look and were seen on the catwalks at Celine and Carven for SS/13.
Languages just-health.co.uk "We were informed that, not only had the Commission rejectedthe proposed settlement agreement in principle that had beennegotiated between defendants and the SEC staff, but it was alsounwilling to settle with defendants on any other terms," hewrote, italicizing the last four words for effect.
China's official Xinhua news agency, in a commentary on Saturday, said the time was right for all sides to seek a permanent end to the state of hostilities on the peninsula, but added North Korea had to live up to its responsibilities.
ibuprofen 800 mg tablet itp Orders picked up in the first half of 2013 and ChiefFinancial Officer Kevin March told Reuters on Monday thatbusiness continues to improve, following weak demand last yeardue to concerns about the global economy.
wunder2 coverproof foundation boots The smiles vanished when we reached our destination: Hama. Lying back on my bed and opening my Rough Guide, I read of the thousands who died there during the last rebellion in 1982. I had read about the country's ancient history but was woefully naive about its more modern events.
cialis 20 mg bestellen In the interview, he also said that he would not run for re-election next year if he felt that he had lost the support of the Syrian people, but that he still felt safe in Syria. "If I were afraid," he said, "I would have left Syria a long time ago."
I'm on work experience apex ipo allotment status bigshare While Kerry dismissed any long-term impact from theshutdown, he said it would however delay payments for securityassistance to Israel and funding support for a U.S.-ledpeacekeeping mission in the Sinai peninsula, which divides Egyptand Israel.
supplements.trgym.co.uk I also found his reference to draconian penalties for assaulting police officers odd. In my 10 years as a police officer, I think 10 people have been charged with assaulting me and not one has received what most of us would recognise as punishment.
harford pharmacy forest hill md This time, however, the Odisha government said it was betterprepared. Half a million people are expected to shelter inschools and other strong buildings when the storm hits,officials said. At least 60,000 people left their homes in neighbouring Andhra Pradesh on Friday.
cornerstonehealth.com Michael Carrick says Manchester United's teenage midfielder Adnan Januzaj is "at the right place" to develop his game, amid reported interest from Barcelona and other leading clubs around Europe.
derma promedics customer service Rising prices typically go hand-in-hand with rising consumerspending, and the government's "Help to Buy" scheme has givenproperty developers the confidence to build again. Theconstruction sector grew last month at its fastest pace in threeyears, with the residential sector the best performer.
Caden says:
I like it a lot achatmedical.com Regardless, forms of crackdown and violence at the hands of the state are not new, she said. They are part of repressive state and security policies that endured over the past two years, including under Morsi's rule, she said.
finpecia review india The researchers searched electronic databases for randomised controlled trials assessing the effects of vitamin D (D3 or D2, but not vitamin D by-products) on bone density published before July 8 2012 (the date of the search for the literature).
icewood.com.au Proud of their accomplishments and enthralled by the presence of a camera, these regime-sanctioned "strongmen" give a peek into their psyche through interviews and preparations for homegrown movies. American films, they say, gave them models to follow ("Scarface" gets a morbid shout-out) as they worked with paramilitary organizations. Can't-look-away stuff, though it's tough to believe your eyes and ears.
apollopharmacy.in "The next few days are very important in terms of integrating the baby into the troop, but we feel very blessed to be able to contribute to the population of this critically endangered species," Peterson said.
amoxicillin 500mg capsules during pregnancy Rothschild, whose relationship with Bumi Plc's board and the Bakries has soured, has asked Britain's financial market watchdog to look into whether Bumi Plc has made misleading statements to the market.
Irea says:
Your account's overdrawn anti progesterone bodybuilding Selig acknowledged that baseball officials remained on the bench while drug abuse — the cocaine scandal of the 1980s, the steroid explosion of the 1990s and 2000s, and the amphetamines that for decades were as common in baseball as rosin bags — continued unabated.
ibuysteroids.com review Share markets worldwide gained after local media in Chinareported the government was looking to increase investment inrailway projects as part of efforts aimed at ensuring annualeconomic growth does not sink below 7 percent.
carefirst pharmacy in broken arrow It hadn't worked that way in the Great Depression. Nobody wanted to borrow because there was no demand for their products and services. Bernanke understood that the full faith and credit of the U.S. government was required for a bailout, so he devised a whole menu of unique liquidity facilities to restore credit and confidence. More than a trillion dollars in lending programs helped troubled financial firms, especially the banks. Debt from industrial corporations was bought up, and distressed mortgage assets were put onto the Fed's books. The Fed's policy sustained money market funds, commercial paper, consumer loans and more. His intervention was decisive in easing the panic.
lamictal orally disintegrating tablets Effective July 17, ESPN will be transitioning all conversations to Facebook comments. At that time a Facebook account will be required to post comments on new articles. Previous comments and conversations will be closed to comment but can still be viewed.
salmeterol fluticasone brands in india In general, morning appointments will have the shortest wait times, but it also helps to find out a thing or two about your doctor's schedule, Ramani said. A cardiologist, for example, might start his morning at the hospital and be running late for your a.m. appointment. Other offices close for lunch hour, so the first appointment of the afternoon will have the shortest wait.
I'm a housewife mission pharmabio quebec-chinese symbols The Special Supplemental Nutrition Program for Women, Infants and Children – better known as WIC – supplies low-income women with checks or debit cards that can be used for infant formula and cereal, fruits and vegetables, dairy items and other healthy food. WIC also provides breast-feeding support and nutrition classes. Poor women with children under 5 are eligible.
cialis online compare The nomination was approved by lawmakers in the NationalAssembly, which is dominated by Maduro's supporters. Tovar, 56,is an economist who was the head of Venezuela's currencyexchange board, CADIVI, and before that served as a vicepresident at the central bank.
nexium 10 mg pret "I am happy to report that this morning we for the first time glimpsed on the horizon the prospect of indefinite endurance, albeit at a very considerable cost for converting the main coal-fired power stations to dual firing," he wrote.
prc pharmacy board exam schedule 2017 result "I have worked for NBA organizations," Williams says, sitting at his desk at Findlay Prep. "I have worked for the NBA. So I'm pretty well-versed in all of the things pertaining to basketball as a business. And with that knowledge if you're able to equip young people who are potentially McDonald's All-Americans — who you and I both know have a great potential to become NBA players — it's imperative that they have certain information in today's social media (for their) long-term capabilities of making money."
the veil brewing company But other trends in the film industry may be working against GLAAD's goals of greater LGBT inclusion. The report found comedies to be the most LGBT-friendly films, with nine out of 24 including LGBT characters.
Which team do you support? eyequestion napping "This is undoubtedly anti-Western and anti-Christian but it also taps into a lot of deep popular anger against the political economy in which they find themselves, in which a very small group of people are basically raking off the wealth," he said.
betterlife.com reviews The purpose of incorporation is to legally separate the owners from the business. This has a bunch of benefits from taxes to liability because the owner is NOT the business. It protects the owners in many ways. But at the same time the rights of the owner do not extend to the corporation because it is a separate entity. If these people want their business to be an extension of themselves and have their rights they should reform their businesses as proprietorships or partnerships and assume the personal liability that goes along with exercising one's right. Or do these people lack the courage of their convictions.
new zealand viagra sales "We're trying to correlate what makes them unique and maybe what part of their genetic makeup makes them do so well," Bishop said, adding that exceptional response would be defined as being alive for a long time without their disease getting worse.
the generics pharmacy card People who suffer from this acquired neurological disorder experience repeated, often painful, muscle spasms as well as muscular rigidity and stiffness. According to the National Organization of Rare Diseases, spasms can occur at random or they can be caused by something as seemingly benign as light physical contact or an unexpected noise. The cause of Stiff Person Syndrome isn't yet known, but symptoms can be stabilized with medication. Left untreated, however, a person can lose the ability to walk.
nwcanadianpharmacy.com Rodriguez told the Daily News during an interview in the Fenway Park visitor's dugout on Friday that the "60 Minutes" report is untrue and that he already cleared the air with Cervelli, who he said he loves "like a brother."
Thanks for calling omeprazole capsule sizes The New Zealand currency was a standout performer, havingjumped 1.1 percent against the dollar on Thursday to $0.8105, its highest in six weeks. It last traded at $0.8094,0.4 percent above its late U.S. levels.
dapoxetine trade name in india "Icahn also wants Dell Inc to reverse its decision to nullify abstentions from the buyout offer's vote count, reverting to treating them as opposing votes. Such a move is negative for the CEO's camp, which estimates almost a quarter of eligible shares will abstain from voting."
champix kostenlos "He is a physical runner," Rex Ryan said. "He might not be the fastest, he might not be the biggest or whatever, but he is just a good back. He runs hard. He really had a great day, he was breaking tackles."
purchase cheap odorless garlic The new look is a drastic departure from the kits the Americans wore in Vancouver in 2010. The blue jerseys featured "USA" across the chest with a white stripe and a red bottom, while the white jerseys featured "USA" diagonally across the chest with blue and red touches in a nod to the 1980 gold medal-wining team's sweaters.
humanhealthguru.com Last, the nature of Rosen's report was almost guaranteed to attract attention from the intelligence establishment. The story described the CIA's findings, "through sources inside North Korea," of that country's plans should an upcoming U.N. Security Council resolution pass.
Please call back later hexpress.net viagra Sandeep Aggarwal, who worked as an analyst covering technology stocks before moving to India to start his own internet company, was arrested on Monday by FBI agents in San Jose while visiting the United States. He made his initial appearance in San Francisco federal court on Tuesday, charged with conspiracy to commit securities fraud and wire fraud related to insider trading.
priceline pharmacy macarthur central Surprises? A couple. Apple interestingly opted to make its new Mac operating system, OS X Mavericks, available for free. Its CEO, obviously taking aim at Office, claimed that by doing so, "We are turning the industry on its ear." Microsoft stock, down 1.17% on the day, clearly didn't like the sound of that.
fish pharma.nl "Wall Street has high regard for Rob Marcus," Moffett said. "But Time Warner Cable's stock, at the moment of transition, prices in a relatively high expectation of consolidation with Charter, and that makes his path forward much more complicated."
clonidine hcl 0.2 mg tablet These two terms are often used interchangeably. To make things even more confusing, the term "gluten sensitivity" is also thrown into the mix. However, these terms are not the same thing. Rachel Begun, a food and nutrition consultant and gluten-free expert based in Boulder, Colo., explains that "an international group of celiac disease and gluten-related experts got together a couple of years ago to come to an agreement on terminology, so that everyone is speaking the same language. The scientifically accurate terminology is non-celiac gluten sensitivity, although many use the more informal term gluten sensitivity." The term gluten intolerance is no longer used in the medical community, though many folks still use this term.
purchase sparxx rx Boston-based NewStar Financial, which provides debtfinancing solutions to middle-market businesses and commercialreal estate borrowers, is working with Credit Suisse Group AG tosolicit offers, Bloomberg said, citing a source. ()
How many are there in a book? svhealthcare.org/portal Please could the Telegraph publish details of any 'Risk Assessment' that the Government has done regarding 'fracking' and human health, including possible contamination of water supplies, and the radioactive impact of the fracking process (Cuadrilla has just applied to the Environment Agency for a 'Permit application for proposed radioactive substances activity' in Balcombe).
bloomshealth.com.au "[Alley] was absolutely stunned when it was announced that Leah would be a contestant on the show," the source told Radar. "Kirstie did feel extremely betrayed. Kirstie was livid that Leah made those comments about the church on Monday night."
costco pharmacy application online Around modern fishing vessels the same scavenging appetite often means that albatross seize the baits and are snagged and dragged under, to be retrieved only hours later when the fishermen recover their longlines. The euphemism applied to this inadvertent death is 'by-catch'. What it means in reality is that each trawler crew, as it processes the fish, builds up an ancillary heap of drowned seabirds. For the fishermen they are nothing but an inconvenience. Each dead and worthless albatross caught on a hook means one less valuable fish for the hold. In a single fishery for bluefin tuna off the Australian continental shelf, Japanese trawlers were estimated to be losing A$7 million (£4.3 million) annually because of birds.
ht rush and no2 maximus for sale The cargo plane, an Airbus A300, clipped trees andnearly hit a house before plowing across about 200 yards (183meters) of empty field well short of theBirmingham-Shuttlesworth International Airport, a senior NTSBofficial said on Wednesday.
1mexgear.net review Yet most of these buyers are likely to be banks and giant City firms. Individuals keen to dive in will have to study the valuations very carefully when the initial share price is announced. Royal Mail has only recently become profitable again after a tumultuous five years leading up to 2011, during which some 50,000 staff were laid off.
I'm in my first year at university avanafil approval The complex is owned by a Jewish entrepreneur, and Kenya has special ties with Israel, although the Israelis today denied they had sent special forces to Kenya to assist, some three days after that fact was first reported. Westgate is the retail and social focal point for Nairobi's wealthy, and foreigners living and working in the country, yet no special security measures appeared to be in place to prevent a determined assault.
seizure medications gabapentin side effects In 1996, J.P. Morgan was named as one of at least four bankscaught up in the Sumitomo Corp. copper trading scandal, whenrogue trader Yasuo Hamanaka racked up $2.6 billion inunauthorized losses. Morgan, which had loaned money to theJapanese trading firm, was the only bank to be rapped byregulators for lax controls. It wound down the London desk by1997 to focus on customer business, it said at the time.
clonidine patch dose equivalent In April, Apple apologized to Chinese consumers and altered iPhone warranty policies in its second-biggest market after its after-sales service suffered more more than two weeks of condemnation by the state-run media.
can i buy diflucan over the counter in canada While the researchers are still trying to determine why some monkeys did not successfully respond to the vaccine, they are hopeful that this technique could work in humans. They have licensed the CMV method to the International AIDS Vaccine Initiative, and if it is approved by the proper regulatory authorities, Picker said they could potentially start clinical trials in humans in the next two years.
can i use voltaren gel when pregnant After several years on large capacity road bikes, the KTM feels like a push bike. It feels so unintimidating that you question that it is actually a KTM – the brand whose slogan is "ready to race". But even for an off-road novice like me there's the knowledge that, perfect bike though it might be, there's still a serious risk of coming a cropper if you take liberties.
I'll put her on nexium prescription prices The Dow Jones industrial average fell 39.09 points or0.25 percent, to 15,445.17, the S&P 500 lost 7.14 pointsor 0.42 percent, to 1,675.36 and the Nasdaq Composite dropped 10.86 points or 0.3 percent, to 3,596.63.
androstenedione levels On Monday data showed German exports fell the most sincelate 2009 in May and industrial output tumbled, suggesting theeconomy is struggling to regain traction, although a rise inimports pointed to robust domestic demand.
anabolic rx24 y nitric max muscle mercadolibre colombia "It is very aggravating that it has been six months and nothing has changed," Soto says. "Senators like [Flake] clearly don't care that 7-year-olds were murdered. He is being a coward and there really is no changing his mind. But there is hope that other senators who did vote 'No' can look at what we are saying and think about [it]."
memd.me coupon code "There are cells in the gut and neurons in the brain that can also detect taste," she told ABC News. Instead of sending a taste sensation to the brain, they might instead send signals to the gut to start the metabolic pathways involved in digesting and absorbing sugars and other nutrients. She said there were other taste receptors whose purpose is less easily explained, such as those in the testes.
trazodone prozac serotonin syndrome Laboratory worker Silvina Caceres agreed: "It's not OK that the president of the republic doesn't keep the people informed about her health. Her life is not private … If not, all she feeds to the people is paranoia."
Punk not dead do you need coq10 with statins A coordinated response can be rolled out in the event of a crisis, such as collapsing building. Transport systems can be shut down, emergency services mobilised and gas supplies can be cut off, while citizens can be informed of alternative routes via Twitter.
weis pharmacy generic drug list McRaven's directive sent the only copies of the military's records about its daring raid to the CIA, which has special authority to prevent the release of "operational files" in ways that can't effectively be challenged in federal court. The Defense Department can prevent the release of its own military files, citing risks to national security, but that can be contested in court and a judge can compel it to turn over non-sensitive portions of records.
falcon pharmacy abingdon virginia * Because of the shutdown, up to 1 million Federal employeeswere put on furlough, and the release of government economicdata – including potentially the key payroll report scheduledfor release on Friday – has been delayed. A Federal Reserveofficial said the impasse could delay the central bank's abilityto assess whether its monetary stimulus efforts are stillneeded.
co.alameda.ca.us (Top left to bottom right) Brandon Banks, 19, Brandon Vandenburg, 20, Jaborian "Tip" McKenzie, 19 and Corey Batey, 19. Vanderbilt dismissed the players June 29 and barred them from the campus pending the investigation.
cvs millbrook pharmacy hours The state analyses also simplify the matter in a way that will not be apparent to consumers who must choose among different plans. Not only must they pick among competing providers – they can choose high-end platinum, gold, silver, or low-end bronze plans.
Efren says:
What company are you calling from? tmjtreatmentsc.com MSCI's world equity index was flat on theday though still near a five-year high. It was last up 0.03percent at 376.15, held back partly due to weakness in Asianshares on concerns over China's outlook.
wild yam extract progesterone The search for a murder weapon in the case reached spectacle status in Bristol. Police found five shell casings at the murder scene in North Attleborough, but there was no gun. For all the ammunition collected from searches of Hernandez's home and flophouse, authorities have yet to uncover what they believe was the .45-caliber Glock used in Lloyd's death. On July 24, prosecutors requested a 30-day continuance for Hernandez's probable cause hearing, and District Court Judge Daniel O'Shea granted it.
endurosport outlet toronto Disposable incomes tend to be higher in countries such as Hong Kong, Australia and Saudi Arabia compared to the UK due to the combination of higher salaries and lower taxes. But the cost of living is also spiralling, forcing many foreigners living in these areas to increase their spending to keep pace.
dr mao slimming capsules The government has also indicated it does not want the bigdomestic players, BCE Inc, Telus Corp and RogersCommunications Inc, to acquire the startups. In June,Canada rejected the transfer of Mobilicity's wireless spectrumlicenses to Telus, stating that it would not approve deals thatled to undue spectrum concentration.
testofen in australia "There was a point that I stopped crying," she said. "It's not just because I didn't feel pain any more, not because I didn't feel sorrow. It was just to keep going. I mean, it just was to survive, to live."
Another service? caffe primo blackwood sa You can also take calls from Gear, where the device functions much like a speakerphone, but it's useless if you're actually doing something with your hands (unless you want the person calling you to hear a bunch of noise). While it could be useful for people driving, hands-free car systems are far more effective. In all other cases, you're better off taking your calls with a microphone-equipped headset.
green pharmacy herbal cosmetics Think of them as giant science fairs for adults and children, where thousands of people congregate around giant fighting robots and life-size mousetraps, displaying their do-it-yourself (DIY) projects.
sps pharma services sarl Boehner's spokesman, Michael Steel, criticized the proposal even before Obama's speech, saying: "Republicans want to help families and small businesses, too. This proposal allows President Obama to support President Obama's position on taxes and President Obama's position on spending, while leaving small businesses and American families behind."
silymarin reddit Miners fell 1.3 percent, the top sectoralfaller. Gold is set for its worst week in two months and copperis at five week lows on expectations the Fed will curb thebond-buying that has spurred a flood of money into riskierassets such as equities.
vertimax v8 vs v8 ex Even the one today against a winless Steelers team — never been a season in all of recorded history when both the Giants and Steelers were both winless at this point in the season — feels just as big.
Arnoldo says:
I'd like a phonecard, please home health care pharmacies Global markets reacted violently to Bernanke's announcementlast month that the days of the Fed's bond purchases were likelynumbered. Stocks swooned and bond yields shot higher, takingmortgage rates up with them.
maca x power In the filing, JPMorgan also said the U.S. Office of the Comptroller of the Currency has said it intends to seek an administrative order over how it had handled collections of consumer credit card debt.
cocokind rosewater toner review It was only under protest that one of the proposed formats for a European competition included the guarantee of having at least one Scottish and one Italian team, no matter that the rest of the 20-team line-up would be based on finishing places in the respective leagues.
advanced care rx pharmacy las vegas Investigators are trying to understand whether automated cockpit equipment Asiana flight 214's pilots say they were relying on to control the airliner's speed may have contributed to the plane's dangerously low and slow approach just before it crashed.
ehealthforum.com I have been a healthcare assistant at a paediatrics ward since November. I think the standardised training is a very good idea as it seems to me that despite going through the trust induction, there is a confusion as to what an assistant is allowed to do.
Norris says:
I'd like to apply for this job sativex canada cost T-Mobile said in August that it added 1.1 million customers in the second quarter (after accounting for those who dropped the service). Its post-paid plans, considered the most profitable part of the wireless business, drew 688,000 new customers during the quarter.
ondansetrone teva prezzo This plan may get republicans ahead in the short term, when residents of red states are astounded by the high insurance rates. In the long run, though, it will backfire when they realize that residents of blue states are paying absurdly lower rates. Ultimately they will realize that they are pawns in a political game, being sacrificed by their own governors to prove a point.
customer-status.com It is doubtful whether airstrikes would establish deterrence. General Martin Dempsey, the chairman of the joint chiefs of staff, has told Congress that while the US could intervene in the war, no moderate rebel group was ready to fill the vacuum. That leaves a regional war in freefall. This chemical attack may not be the last.
penatropin uk order The former Hannah Montana star is also adamant she is proud of the performance, adding, "I feel like music is really stale right now… The reaction to what I did has been insane. I think it was a breath of fresh air!"
make schisandra chinensis tea But Sinai's status as an incubator of extremism has deeper roots that should not be overlooked. Infrastructure in the region is poorly developed, employment opportunities are scarce and locals receive very few services. They say that their encounters with Egypt's authorities have almost always included repression or mistrust, based largely on their status as a community apart from the rest of the country. This has made them feel increasingly isolated and unwilling to join in the current fight against the militants, many of whom live within their communities.Â
Guillermo says:
I can't stand football sna-medicine.mm.aptoide.com But contraception and family planning aren't the only tools the U.S. can use to help stem the population boom: there's also education. Women's empowerment and education, specifically women's education, should be a core component of U.S. foreign aid and U.S. foreign policy, says Weisman. It's a case where the U.S. can "have its cake and eat it too," because it both educates women generally, thereby building stronger civil society, and staves off unhealthily rapid population growth. Not only, as Weisman says, is "this…a way to empower women," but you also "give women the opportunity to choose how many children they want."
cost of ivf drugs in uk Whether the shutdown represents another bump in the road fora Congress increasingly plagued by dysfunction or is a sign of amore alarming breakdown in the political process could bedetermined by the reaction among voters and on Wall Street.
http://www.aetna.com/employer-plans/index.html Dr Vivek Muthu, director for healthcare at the Economist Intelligence Unit and chief executive of the healthcare evidence consultancy, Bazian, says the evidence suggests that even a low alcohol intake can risk damaging the developing foetus.
can you order femara online Both the authors come from think tanks that support policies which encourage growth/innovation. I think they are frustrated with trying to convince policy makers of the virtues of policies which support innovation, such as tax credits for R&D. This must be especially the case in America, where half the republicans think any involvement by govt is bad and use econ101 type arguments to defend their case. I think the real beef is not with economists dumbing things down to econ101 type explanations, but non-economist politicians bending the science of econ101 to support whatever their agenda is.
flovent hfa 110 mcg inhaler coupons Many Republicans were criticizing the program long before its rocky launch. A 16-day partial government shutdown that ended last week was precipitated by Republican demands to delay or defund Obamacare.
Carroll says:
How do I get an outside line? tigert pharmacy ardmore ok New Orleans is famed for its contrasts, so it feels quite natural to find yourself the same afternoon skimming over the alligator swamps in an airboat (propelled at hair-tousling speed by a giant fan!). Don't be surprised if your guide hops over the side to fetch you a baby alligator to hold, introduces you to a coypu or helps you to feed a giant catfish.
perfecthealthdiet.com pain Less than an hour before the opening bell, Dow Jones Industrial Average futures gained 58 points, or 0.4%, to 14975. S&P 500-stock index futures tacked on seven points, or 0.4%, to 1660, and Nasdaq 100 futures added 11 points, or 0.4%, to 3139. Changes in stock futures don't always accurately predict stock moves after the opening bell.
alesse rxlist He said three years on, the firm was getting "21st century"systems, including for accounting, supply chain management andautomated cash-handling, through a 300 million pounds ($448million) investment.
alprostadil for sale uk "But we saw also Hamilton starting in his first year nearly winning the championship, and in his second year winning the championship. But then he didn't win any more. Sometimes you have the car to do it, sometimes not. At the moment Red Bull and Vettel are a very good combination and too good for us."
how much does viagra cost at walgreens NEW YORK, Aug 5 (Reuters) – U.S. stock index futures pointedto a flat open on Monday as investors looked for new reasons tobuy following a recent rally that repeatedly took major indexesto record levels.
Do you like it here? medical professional services Also in southeastern Baghdad, officials said a car bomb went off inside a parking lot in the mainly Shiite New Baghdad neighborhood, killing three people. Another car bomb exploded in a busy street in the Shiite neighborhood of Amil, killing three people and wounding 14, authorities said. They said another car bomb in Amil killed 3 people and wounded 14.
onde comprar naltrexone no brasil The surprise move likely would delay, or even derail, a merger set to close next month and could stall a broad industry restructuring that investors were counting on to support airline profits, triggering a 5.4 percent decline in U.S. airline shares. It also could hinder American parent AMR Corp's efforts to emerge from its nearly 2-year-old bankruptcy.
bio kult candida BEIJING/HONG KONG – China reiterated its opposition on Thursday to a European Union plan to limit airline carbon dioxide emissions and called for talks to resolve the issue a day after its major airlines refused to pay any carbon costs under the new law.
price chopper pharmacy gardner Nippon Paper, Japan's No. 2 paper producer by sales, is also branching out on its own. It registered last year to be an independent electricity supplier to sell excess in-house generated power, spokesman Koji Yoshino said, and plans to build power generation facilities in its factories around Japan, including a 110 MW coal-fired plant in Miyagi prefecture, north of Tokyo. The company has used biomass and solar power in three other locations, Yoshino said.
pearl butter "The task of getting on top of these groups and figuring out what they're doing has never been harder, in a way," McLaughlin says. The very idea of publicly discussing methods of oversight erodes the effectiveness of "what you do against the adversary."
Willard says:
What sort of music do you like? cvs brentwood pharmacy phone number And without a revived Tuck there would be a personal cost as well, since he's entering the final season of the five-year, $30 million contract extension he signed in 2008. It was once unthinkable that the Giants would let Tuck, one of their most popular stars, inch so close to unrestricted free agency. Now, based on his recent play, it's hard to see them offering any kind of long-term deal at all.
generikaonline.com erfahrungen The indictment also cited Albert Gonzalez as a co-conspirator. He is serving 20 years in federal prison after pleading guilty to helping mastermind one of the biggest hacking fraud schemes in U.S. history, helping steal millions of credit and debit cards.
carnitine core reviews The All India Organisation of Chemists and Druggists(AIOCD), a lobby group for pharmaceutical retailers andwholesalers, was aware of some members not buying from companiesthat have reduced the margins, its president, J.S. Shinde said.
centerpills.com review Celebrities may look phenomenal on the red carpet, but they also have hordes of makeup artists at the ready for even the tiniest of touchups. Catch them without the thick layers of powder, smoky eyesh…
ihcginjections.com coupons Republican Governor Pat McCrory signed the state's sweeping voting changes into law in August, saying: "Common practices like boarding an airplane and purchasing Sudafed require photo ID, and we should expect nothing less for the protection of our right to vote."
Have you got any experience? anaprox yahoo answers When rebel fighters have held confined areas, such as the border town of Qusair, which was overrun by Hezbollah and Assad loyalists two months ago, they have put themselves at a serious disadvantage, the sources said.
buy trenbolone oral Security forces smashed pro-Mursi protest camps in Cairo on August 14, killing hundreds of people. In an ensuing crackdown, many Muslim Brotherhood leaders were arrested in an attempt to decapitate Egypt's oldest Islamist movement.
diflucan otc uk The initial version will be rolled out for computers and tablet devices and organized into seven different "collections" for navigation: "London Film Festival Presents", "Backed by the BFI", "Edwardian Britain", "Gothic", "Cult cinema", "Inside Film" and a selection from industry magazine Sight and Sound.
procyclidine medscape The monarch is head of the organisation known as the Family of Nations but will be represented at next month's meeting of Commonwealth leaders in Sri Lanka by the Prince of Wales following a review of her long-haul travel.
bupropion patient uk This fossil belongs to the multituberculate order of mammals. Greg Wilson, an assistant professor of biology who specializes in early mammal history, says that these animals were incredibly successful at living and reproducing alongside dinosaurs during the Jurassic period. "Other mammals were cowering in [the dinosaurs'] shadows, but the multituberculates were unfazed," he told ABC News.
Elmer says:
Sorry, you must have the wrong number unisom webmd The former ruling coalition parties have seen their popularity slip sharply after three years of tax rises and spending cuts that along with the euro zone crisis pushed the European Union state into its longest recession in two decades.
minoxidil espuma comprar The waiter looked quite distressed: it was, he assured me, the first time it had ever happened, and I suppose it is quite a troubling moment when Scotland's most famous hotel runs out of porridge at breakfast time. Especially when there is a Quaker Oats production plant only half an hour down the road.
cheap vegro
I'm sure there is a free market think tank or two more than willing to explain this to anyone caring to listen. It is one thing to manipulate morons – it is something entirely different to let them have a say in matters involving real money.
linkopharm.com "What happens next may depend on Amazon," said Keith Hylton,a Boston University law professor and antitrust specialist. "IfAmazon feels a need to keep driving e-book prices down tomaximize Kindle sales, it could put downward pressure on pricesoverall, and perhaps help Amazon win market share back."
clindamycin phosphate 1.2 and tretinoin 0.025 "Natural High," sung at the beginning and end of the show, is most eloquent. Joe wants Heather to sing so it ends on an "up" and unambiguous note. She prefers a wistful little chorus of oohs that fades away. In the end, "Act" is about living life unedited — even with its uncertainties. Those powerful little ooh's leave you on a high.
We used to work together ginseng ginkgo biloba Veeva, which competes with Oracle Corp, providesweb-based software for pharmaceutical representatives thatallows them to track drug information and to providedocumentation and data to their sales forces.
thaiger pharma boldenone price in india Rodriguez was the only one of 13 players disciplined by MLB on Aug. 5 for their ties to the now-defunct Biogenesis clinic to appeal his suspension. The other dozen players, including Texas Rangers outfielder Nelson Cruz, San Diego Padres shortstop Everth Cabrera and Jhonny Peralta of the Detroit Tigers, agreed to 50-game suspensions. Milwaukee Brewers star Ryan Braun, who successfully appealed his 2012 doping suspension, had agreed earlier this summer to a 65-game suspension.
cialis 20mg preco Mineral-rich Guinea is the world's largest bauxite exporter, and mining firms have signed multi-billion dollar deals in a bid to secure untapped mineral riches, especially iron ore. However, political instability has led to some investment being frozen.
ordercheapcialishere.com Leeds, London Paddington and London Liverpool Street stations have seen the highest number of accidents, including one fatality, 51 bone fractures, 19 dislocations, five concussions and dozens of bruises, cuts and abrasions as people have fallen on steps and escalators, over luggage and even off platforms between trains.
viaxus male enhancement reviews Standard Life has recorded a 28 per cent increase in UK pre-tax operating profit for the first six months of 2013, from £126m last year to £161m this year, driven by a rise in profit from new fee-based business.
Sorry, I ran out of credit combivent respimat precio mexico "While the threat of terror had a defining influence on livability in the last decade, we can clearly see that civil unrest has already had a significant impact on livability in this decade."
depo testosterone price south africa The company said it expects to ask regulators to let itsbank move excess cash to its holding company when the ratioreaches 9.5 percent, giving the brokerage cash for growth andallowing for a potential distribution to investors throughdividends or share buybacks.
buy cialis 5mg uk In addition, there is no evidence that middle-class parents' efforts reached beyond those their children attended. According to grant proposals, public and private spending on the initiative topped $500, 000 but the vast majority of Philadelphia's schools—and especially its poorer students—did not benefit. The marketing initiative targeted 13 elementary schools, and actually focused on only four or five in the most affluent downtown neighborhoods. Meanwhile, the other 160 elementary schools received no special attention. As a district official observed, comparing downtown schools to those in poorer neighborhoods, "making sure the schools in Center City are successful is pretty high on the radar screen. As opposed to, say, Tilden [in impoverished Southwest Philadelphia]. Nobody is really that focused on Tilden, until there's a major incident."
alpharma laboratorios telefono Latin America wants international standing and chafes at any attempt by the United States to downplay its stature, hence the ruffled feathers when Kerry referred to the region as "America's backyard." Latin America is now home to 600 million people. The U.S. looks to the region for oil and is heavily vested in bilateral trade agreements.
shengjingpian ingredients Only seven of Barrick's 13 directors are independent, aratio that Barrick says meets New York Stock Exchange rules. Butproxy advisory firm Glass Lewis says the board lacks two-thirdsindependence – a best practice for big, widely held companies.
I've been cut off petoskey family medicine "This is the moment that the stones are under risk because they can be passed hand-by-hand, they can be exchanged," said Melchionni, chief operating officer for Asia-Pacific at the Ferrari Group, an Italian logistics company for luxury goods.
neopharma uae products India's weakest economic growth in a decade and a recordhigh deficit in the current account, the broadest measure of acountry's international trade, have made the rupee theworst-performing emerging Asian currency so far this year.
starting dose of methotrexate for ra "Carrie" is based on based on thriller writer Stephen King's 1974 novel. That novel was first adapted by Brian De Palma and received Academy Award nominations for Spacek and Piper Laurie, who plays her abusive mother.
best way to smuggle drugs abroad They were climbing Pen Y Fan, the highest mountain in southern Britain, which is known for the "Fan Dance" where soldiers hoping to join the special forces march over the mountain carrying a heavy pack and a rifle, then do the route in reverse in a set time.
how effective is clindamycin cream for bv The memo underscores what experts say is one of the biggestchallenges facing President Xi Jinping and his drive to tacklecorruption – rampant graft in engineering, procurement andconstruction contracts awarded by state firms.
What university do you go to? 10mg amitriptyline withdrawal Under the simplified procedure, the Commission announces theclearance of uncontroversial first-stage mergers without givingany reason for its decision. Cases may be reclassified asnon-simplified — that is, ordinary first-stage reviews — untilthey are approved.
buy ezetimibe uk Tony Hall said: "Arts programming sits right at the heart of the BBC and is a vital part of who we are. But I want us to be much more ambitious. We need to showcase more of the incredible talent that this country has to offer to the widest possible audiences."
amoxicillin side effects urinary tract Napolitano, who has been serving in her current post since 2009, was the first woman to helm of the Department of Homeland Security. A Democrat, she previously served as governor of Arizona from 2003 to 2009 and before that was the state's attorney general.
ranitidine lloyds pharmacy Richmond has already offered to buy more than 620 delinquentand performing underwater mortgages from their trusts at deepdiscount pegged to the properties' current appraised prices torefinance them and reduce their principal.
giant cherryvale pharmacy That's how Coughlin described this difficult week in an interview with the Giants' team website. The Giants coach has spoken little about the loss of his 63-year-old brother, John, who died tragically on Monday after a freak fall. He mentioned it only briefly to his players and later to the media, preferring to keep the focus on the Giants' game this Sunday in Carolina.
I work here sex and the city essentials fashion The holding company, which also houses internet sites suchas adultfriendfinder.com, listed out estimated liabilities of$500 million to $1 billion and assets of $1 million to $10million, a court filing showed.
prijs van paracetamol/codeinefosfaat It found that consumers spent on average 26 percent less time interacting with the apps during each session, but that they opened the apps 39 percent more often, for an average 25 times a month, up sharply from 18 times the previous year.
arcoxia 90 mg precio farmacia san pablo More than 30 people were killed and scores wounded in Baghdad on Thursday after a series of car bombs, part of a wave of violence that has taken the monthly death toll to the highest levels in around five years.
trending songs on vine Danny Kushlick, head of external affairs at think-tank Transform Drug Policy Foundation, said: "This research should serve as a wake-up call to policymakers to legally regulate drugs as an urgent priority.
walgreens pharmacy coupons new prescription 2013 Roku 2 features a remote with built-in headphone jack for private listening and dual- wireless for better Internet connectivity. Both are popular features that were previously available only with the Roku 3.
How much notice do you have to give? diclofenac potassium tablet usp 100 mg BEIJING/HONG KONG – China reiterated its opposition on Thursday to a European Union plan to limit airline carbon dioxide emissions and called for talks to resolve the issue a day after its major airlines refused to pay any carbon costs under the new law.
red river pharmaceuticals There had been doubt over world number two Nadal's participation in the three-day tie in Madrid after his recent exertions in New York where he beat top-ranked Novak Djokovic in Monday's U.S. Open final.
supercare medical services inc ermita manila contact number Energy Future Holdings has not yet given any signal aboutwhether the November interest payments to unsecured bondholderswould be made. The sources said the company has suggested that apayment could be made to buy additional time to avoid afree-fall, prolonged bankruptcy.
bodyecology.com/articles/top_ten_foods_that_prevent_inflammation.php The wealthy enclave, population 30,000, has been under virtual siege for the past week as Spanish customs officials have performed exhaustive checks on all traffic at the frontier just north of the airport runway, creating long queues of traffic.
diflucan used for jock itch In Panzano, a modest entry fee is charged – your "ticket" is a tasting glass which you take with you from stand to stand. The villages also have some fine ristorante and trattorie worth a trial. Happy tasting.
Withdraw cash cena viagra 100 Imari Love, a Chicago-based telecom analyst at Morningstar, questions the economic viability of a Verizon foray into Canada, given the company would have to spend heavily to buy the small players, compete in the auction, build a network and then win subscribers in an established marketplace.
buy premarin uk Flanked by the foreign ministers of Qatar, a major financier of Mursi's government, and the United Arab Emirates, a supporter of the military takeover, U.S. and EU negotiators sought to coax both sides into a series of mutual confidence-building measures. They would have begun with prisoner releases and led to an honorable exit for Mursi, an amended constitution and fresh elections next year.
secotex medicamento Rachel Hughes, 37: "I do sometimes use the market on a Sunday and that probably means I spend a few pounds going for lunch in the pub or having a coffee but as for making sure I spend £5 it's not something I always do."
what if i take too much viagra ThyssenKrupp has sunk roughly 12 billion euros ($16 billion)into Steel Americas. The disaster resulted in former ChiefExecutive Ekkehard Schulz's resignation from the supervisoryboard followed by that of supervisory board chairman GerhardCromme this year.
kamagra-for-you.com A former railways minister, Liu Zhijun, was given a suspended death penalty in July for accepting bribes, but the most sensational case is likely to be that of former high-flying politician Bo Xilai, expected to face trial this month.
I have my own business fallout 4 no fusion core drain mod An American victim was identified by the Diocese of Arlington as Ana Maria Cordoba, an administrative employee from northern Virginia. Also among the dead were an Algerian and a Mexican, Spanish police said Friday.
prilosec otc side effects long term Whether or not 9-year-old children can defend themselves isn't addressing the problem. Instead of wondering whether or not elementary school-age children can be taught to defend themselves against junk food's inappropriate and constant provision, what we should be questioning is why junk food has become society's constant child-minding crutch, and what means we might employ to change our awful new normal.
sandylight pharmacy UTSanDiego.com reported that the sheriff's office announced Friday that it would be the lead investigative agency for any complaints against Filner and any information gleaned via the hotline would be turned over to the California Attorney General's office for possible prosecution.
24italia-med.com It's strange how popular the iPhone remains in the U.S. despite a barrage of very good high-end Android phones like the Galaxy S4 and HTC One. It looks like its Western popularity is all that's really holding sales from falling worldwide.
buy ivermectin dogs Wenger then appeared to take a dig at those clubs whose success has been underpinned by the extraordinary investment of their billionaire owners. "I believe we have a huge advantage in that our club is well respected all over the world because we have values, because we are not artificial, because we are based on tradition, because we are as well forward thinking and we give a chance to young people who deserve it," he said.
Can I use your phone? generic viagra good Wow – the article lays it out pretty well. The Mayor gets to wave the Green flag. And no one will touch any new City bonds. In a week we'll here that no new or refi mortgages are being issued within the City as companies react to this increase in risk. Can't wait to see the next update.
hoodia gordonii p57 reviews But he's the epitome of modest. While a lot of people at Cern would have loved a Nobel, Higgs ran for the hills and didn't even take calls from the Nobel committee. One of the biggest advances in physics was the result of genius at its most humble.
nexium mups mexico You can't overstate or overanalyze Williams' health, even in the preseason, because he has attributed nearly everything that has gone wrong during his Nets tenure to some ailment. That's why he needs to rest. It's as good for his confidence as it is for his body. Williams, who sprained his ankle nearly two months ago, doesn't need another excuse. King and Prokhorov have weeded out the rest.
eckerd pharmacy online Capital co-editor and co-founder Tom McGeveran recently told a still-unpaid freelancer that all outstanding checks were supposedly paid out with the site's sale to Politico owner Robert Allbritton.
skelaxin hydrocodone Of course pilots rely upon their auto-throttles. That is what the auto-throttle is there for, as a labour saving device. One sets the desired approach speed and the aircraft's computer manipulates the power setting through digital electronic controls to maintain a preselected speed no matter what. That is how virtually all airliners are landed. What is not being noted here is that the technology malfunctioned.
Floyd says:
Will I have to work on Saturdays? can buy viagra online uk The Daily News has some of the most memorable photos in sports history. From legendary boxers and iconic tennis players to golfing greats and fabled Olympians, the Daily News has the photos you want of the once-in-a-lifetime sports moments. Find yours today and relive history.
medisense.org.uk IRS staffers who assist delinquent taxpayers in defendingthemselves from collectors have been furloughed, while some IRStax collectors who pursue individuals and businesses that aredelinquent are still working through the shutdown.
cooperhealth.org "The policy divergences between the Fed and the developedcountries like…UK and Japan are likely to widen over time andthat will continue to favour dollar strength," said Sim MohSiong, FX strategist for Bank of Singapore.
alpha booster pack opening Every year, my best friend and I have a birthday tradition of sending a humorous birthday card to each other along with a heartfelt letter. Sending your loved ones reminders of what they mean to you by doing something a little more special makes it worth the effort of stopping by the post office.
online shopping trends Wide midfielders Ashley Young and Antonio Valencia were weak while newcomer Marouane Fellaini big hair, small impact — was a non-factor as United lost for the second time this month under first-year manager, Moyes.
Octavio says:
An envelope amoxicillin dosage jaw infection "We were still very close. It wasn't a bitter divorce," she said, referring to their split earlier this year. "We still talked every day, and we lived 10 minutes away from each other."
embracesportsmedicine.com.au Looking further, bonuses based simply on share price can be viewed as contrary to long term company success as the short-termism this leads to often precludes expensive investments that would pay out over the long term more than the short term, share price boosting cuts in expenditure save.
prosupps dr jekyll nitro x * U.S. stocks rose on Friday, extending gains from a majorrally in the previous session, as investors were hopeful for asolution to end the partial U.S. government shutdown and raisethe U.S. borrowing limit to avoid a possible default.
lotensin 20 mg cena The Mariel container terminal and logistical rail andhighway support, a $900 million project, is largely beingfinanced by Brazil and built in conjunction with Brazil's GrupoOdebrecht SA. The container facility will be operated bySingaporean port operator PSA International Pte Ltd.
cebrian geokonsult services Congress acted the day before U.S. borrowing authority wasscheduled to lapse as lawmakers engaged in their fourth round offiscal brinkmanship in less than three years. Lawmakers didn'tresolve any of their long-term divides on fiscal policy and willhave to return to the same issues over the next four months.
Quaker says:
I was made redundant two months ago precio entrada cine la calandria One of my fondest childhood memories is the smell of apple tart coming from my aunt Suzanne's oven. She was a master of baking. We visited her smallholding, near my hometown of Lure in Franche-Comté, to help cut the hay in the field by hand at weekends. I didn't fancy that too much because the smells from the kitchen were just superb. I vividly remember her sponge cake, made with eggs from her chickens. The yolks were so absolutely orange that when she cut the cake it was orange too.
pills-andhealth.net reviews It has music and lyrics by Tori Amos, the flame-haired American singer-songwriter who at her best can give Joni Mitchell and Kate Bush a run for their money. Meanwhile the book and additional lyrics have been written by that highly intelligent dramatist, Samuel Adamson.
dipyridamole yahoo answers The action in Sri Lanka follows a global food scare afterFonterra said that some of its products could contain a bacteriathat can cause botulism. Its products have been removed fromshelves in around nine countries, including China, while othercountries have restricted imports.
http://www.indian.com.uy catalogo "Matt, it's good your doing your laundry to help your mom. It's smart to add the detergent as the machine fills, but, it's also important to remember to add the clothes before the machine runs through all 4 cycles. Hint: Don't do it while watching a game or movie."
peticion cita clinica moncloa A mayor from the region, Jazmin Cano, gave a slightly higher death toll, telling the Reforma newspaper that six people were killed and 22 injured. It was possible the number of deaths would rise as the army and other rescuers continued to search the wreckage.
Tommy says:
I've come to collect a parcel apps.pharmacyonesource.com BEIJING/HONG KONG – China reiterated its opposition on Thursday to a European Union plan to limit airline carbon dioxide emissions and called for talks to resolve the issue a day after its major airlines refused to pay any carbon costs under the new law.
sarcosine oxidase subunit alpha "On the one hand, you've got a government pursuing a taxstrategy to make the UK one of the most completive regimes. Butthen you've got a push by the PAC and by others to say…we wantto make sure everyone's paying their fair share of tax and we'lldetermine what that fair share of tax is," Sproul was quoted assaying.
harga olay anti aging + fairness cream The family owns or controls dozens of retailers and foodcompanies through George Weston Ltd in Canada and WittingtonInvestments in Britain, which in turn owns a majority stake inAssociated British Foods, Fortnum & Mason and Heal &Son.
drugs.ie competition winners 2017 The retiring Yankee closer seemed appreciative of Leyland's plan to get him into the game regardless of the score, but the all-time saves leader is hoping to protect a lead in the ninth, something he's done in four All-Star Games.
minoxidil side effects reddit Omer Perchik, founder and chief executive of to-do list app maker Any.do, said apps will now have an ability to respond to the context of where customers are, what time it is and what they're doing. "It's a major change and it allows you to do more than you could earlier," he said.
Have you got any ? supplements.my A senior figure in British business, Norman has previouslybeen chief executive of supermarket chain Asda and also servedas a member of parliament for eight years and was chiefexecutive of the Conservative Party.
grand medical group ag luzern "St. Joseph's provides compassionate care to more than 2,000 people every day throughout our system. Anytime something doesn't go right, we take it extremely seriously. In this case, we have made personnel and policy changes and re-examined everything we do related to quality," the hospital said.
titanium pro x ingredients "The Care Bill presents the ideal opportunity to ensure that vulnerable adults living in our community are given the best possible protection from neglect and abuse. We welcome the advances that the Bill already makes in safeguarding older and disabled people, but with some additional changes that protection could be so much more effective.
hgh xl safe to use With great power comes great responsibility – or so thinks one 27-year-old Japanese citizen, who dons a superhero costume to wait by the stairs of subway stations, lending his strength to the elderly, people lugging heavy packages and mothers with prams.
viagra levitra price "I chose this ring because the bands are tight-knit and I felt like those were kind of like stories of both of us coming together," he said. "And all the jewels leading up to the single diamond are little experiences we've shared along the way. And it comes to one and that's the new experience we're sharing together."
What sort of work do you do? super beta prostate farmingdale ny NEW YORK, July 9 (Reuters) – U.S. stocks rose for the fourthsession in a row on Tuesday, as investors bet companies will beable to surpass the low bar that has been set for earningsseason, leaving room for better-than-expected results that couldfuel the rally further.
thera-med.com The group has called for a range of other options to be explored that they claim would improve safety on the road. These include extending the Highland Railcard scheme to make trains a viable alternative to driving, implementing a ban on HGVs from overtaking, and increasing the number of police patrols on the route.
buysteroidsuk.com The victims were Dorothy Wu, 85, and Alma Smith, 73, who both died at the scene; 87-year-old Reginald Green; Lola Bennett, 86, Ella Wood, 97, Urbana Alipio, 79, Caesar Galea, 82, Doris Becke, 96, Verna Webeck, 83, Dorothy Sterling, 80, and Neeltje Valkay, 90, who all died in various hospitals after the fire.
posologia ciprofloxacino infeco urinria However, single dahlias often fail to form robust tubers, so some of the best, such as 'Magenta Star' and 'Dovegrove', are almost impossible to find. The flowers fade quickly, too, and that means more deadheading.
prime pharmacy dubai Rehn made no mention of Hollande's pension reform plans,which do not raise the country's retirement age as theCommission has demanded. Germany also wants to see the eurozone's second largest economy address overspending.
Elliott says:
Where do you study? teloyears kit Judge Debra Nelson told jurors they must find, beyond a reasonable doubt, that Zimmerman is guilty of a crime. "You must presume innocence. … Zimmerman is not required … to prove anything," she said. "The state must prove the alleged crime was committed. It's up to the state to prove his guilt."
women's casual ladies long sleeve hoodie sweatshirt outerwear coat pullovers "We are convinced that the signing (of the agreements withthe EU) does not hold any risks (for Russia)," he said, addingthat he would give personal assurances of this to Russia and itstrade allies in the Moscow-led Customs Union.
apo-escitalopram 20 mg tab There was plenty of food. "It was partially Korean, such as different vegetables with national sauces," says Valentina. But alongside the boiled onions, cabbage and rice were fried eggs, ham and even ice-creams and cheesecakes for dessert.
medizinisches-zentrum.de Since The Bay of Pigs, Watergate, The Pentagon Papers, Iran Contra, Iraq WMDs, Abu Grahib, CIA black sites & rendition, Torture, NSA warrantless surveillance… all of those were technically classified and if you used the same standards Obama is using, all of those reporters could have been named 'conspirators' and prosecuted, and we wouldn't know about any of those things.
premastop au canada United Technologies Corp, which makes Sikorskyhelicopters and other items for the military, said it would beforced to furlough as many as 4,000 employees, if the U.S.government shutdown continues through next week, due to theabsence of government quality inspectors.
Wilton says:
I love this site how to take prevacid 30 mg Miami-Dade Fire Rescue authorities report that the exposed drum was found Thursday near a dismantled plane at the airport. A hazmat team from Miami International Airport went to the site. Authorities say teams are monitoring for any radiation but only minimal levels have been detected.
para que es tretinoin cream 0.025 While broadly satisfied with the level of Schneider's 505pence a share proposal, some British fund managers who are onlypermitted to hold London-listed shares are worried about howmuch they might lose out by immediately having to sell theFrench stock they stand to inherit as part of the deal.
pony dry where to buy Since 1999, Rivera has jogged out of center field during home games to the thunderous "Enter Sandman," and an iconic sequence has played out at both the old and new Yankee Stadium ever since. Rivera became the greatest pitchman the band could probably ever ask for, and Hetfield thanked Rivera at the end of Sunday's performance, while the sold-out crowd exploded with cheers.
ketoconazole shampoo bodybuilding The settlement was reached earlier on Wednesday before JudgeWilliam Pauley III of the U.S. District Court for the SouthernDistrict of New York, Christopher Lovell, the lead plaintiff'sattorney, told Reuters in an email.
intrinsa patches online When they got to the theater, it was packed. The only place they could find five seats together was in the second row, close to the emergency exit that accused shooter James Holmes would soon enter through.
Seymour says:
I've just graduated theophylline rxlist "Will a few succeed due either to chance or skill? Of course. For some intermediate period of years a few are bound to look better than average due to chance just as would be the case if l,000 'coin managers' engaged in a coin-flipping contest."
tadalista 20 vs cialis That might be good for consumers in the short term, butScott Kennedy, director of the Research Center for ChinesePolitics & Business at Indiana University, questioned the NDRC'scredentials as a consumer watchdog, given its central role inChina's export- and investment-led expansion of the past twodecades.
kur var nopirkt levitra The job of a space psychologist is to advise selection panels which astronauts are most suited to a particular team or mission, support crews before, during and after their flight, and develop "countermeasures" to help them stay sane during their long confinement.
cipralex generic ontario Alison Singh Gee's memoir, "Where the Peacocks Sing: A Palace, a Prince, and the Search for Home," begins in Hong Kong, where Gee is living luxuriously as an expat journalist. She doesn't think twice about spending money on fancy artwork, pricey dinners or designer shoes, and that's partly because her lifestyle is funded by her wealthy boyfriend. Soon, though, she breaks up with that boyfriend, meets her future husband and realizes she has to seriously rethink her spending habits.
nutritionalsupplements.tips Residents of a trailer park were evacuated as a precaution after the fire was reported about 5 p.m. Monday. It was unclear how it started. The Arizona Republic reported (http://bit.ly/170Ocja) the fire had spread across 300 acres by late Monday.
Recorded Delivery duodart equivalent in usa It is, as former Giants receiver Amani Toomer said on SiriusXM NFL Radio on Monday "a little bit of a pickle." Finding the nice, tidy, win-win solution with Nicks that the Giants found with Cruz won't be easy at all.
ordering cialis online from canada A statement from the United Nations in Damascus on Fridaysaid the team expected to finalise its work in Syria on Monday,and was working on a comprehensive report which it hoped wouldbe ready by late October.
can you buy drugs in gta 5 Italy's Monte dei Paschi di Siena said on Wednesday itsboard had discussed the guidelines for a new restructuring planas it seeks to win a green light from the European Commissionfor a 4.1 billion euro state bailout.
buy valacyclovir uk He enters his second season as a 23-year-old former fourth-round draft pick with one start under his belt. On the young and revamped Minnesota Vikings receiver corps, that practically qualifies him as a grizzled veteran and he's acting like one.
espnfarm24.com The great challenge facing him over the next two days is to somehow work himself into the lead because, as we all know, he's never won a major coming from behind after 54 holes. He's a frontrunner extraordinaire. But locked into a tie for 50th, six shots out of the lead, he's got a bunch of elite players in front of him. It's also going to be extra hard if those guys are hitting driver and he's laying back.
Yes, I love it! betnovate scalp application for ears Alwar Pouryan, a U.S. citizen of Iranian Kurdish descent, was one of seven men indicted in 2011 following an undercover investigation by the U.S. Drug Enforcement Administration into drug trafficking in West Africa.
side effects of rx drugs The Wall Street Journal, citing French briefing documentsahead of the summit, said France would ask the EuropeanCommission to draw up proposals by spring 2014 aimed at"establishing a tax regime for digital companies that ensuresthat the profits they make on the European market are subject totaxation and that the revenues are shared between the MemberStates, linking the tax base to the place where the profits aremade."
super male t v2x powered by sst He said concentrating specialists services was key – citing stroke services in London where 31 hospitals used to provide stroke care, with the city having some of the worst outcomes for patients. Services are now concentrated in eight hospitals – and outcomes are some of the best in Europe.
med pharmacy argus denver co The Kansas City district, which stretches from Missouri andKansas to Nebraska and Oklahoma, is home to thousands of farmersand is a leading producer of wheat, corn and cattle, among otherfarm commodities. The value of farmland has soared to all-timehighs in recent years, selling for $10,000 an acre more in thetop growing regions of the district.
rusfarma.net More than 10 years of planning, $10 million of government funding and tireless work from the team that discovered life in a lake buried beneath an Antarctic glacier earlier this year may largely go to waste because of the government shutdown.
Dorian says:
I didn't go to university http://www.healthhelpnow-nhs.net If anyone's fingerprints are all over the financial crisis, it's the mortgage bankers who only originate loans in order to pass them off to investors and the Wall Street firms who manufactured supposedly AAA-rated assets out of the mortgage bankers' junk loans. If mortgage securitization is really a safe and efficient mechanism as its advocates claim, it should be able to survive without a government guarantee.
accutane uk online A decade ago when unemployment was high and immigration laws strict, Merkel's party campaigned on slogans like "Kinder statt Inder" (Children instead of Indians). Now they are calling for a "welcome culture" towards migrants.
naprosyn cena The RESTORE Act, passed by Congress last year, dictates that 80 percent of the Clean Water Act penalties paid by BP be divided among Louisiana, Mississippi, Alabama, Florida and Texas. Not only would a large chunk of that money be spread out evenly among the Gulf states, but the legislation also gives them some flexibility in deciding how the money is spent.
sizegenetics hours per day The FBI said it was notified by Deen's attorney after an email and follow-up phone call were sent to her office threatening to expose information that would "bring hardship and financial ruin" to Deen if it was released.
geriforte cena They failed to register a single shot on target in 90 minute. After the game finished 0-0, they lost 3-1 on penalties – with Bjorn Sigurdarson and Kevin Foley shooting over the bar and James Henry's kick saved.
I work here vitality biopharma inc. (otc vbio) Actress Megan Fox and tennis champ Rafael Nadal are helping Emporio Armani turn up the heat with its new underwear and jeans campaign. Both Fox and Nadal show lots of skin in the black-and-white ads shot by Mert Alas and Marcus Piggot. This is the second season that Fox will be lending her famous shape to the sexy lingerie and denim brand.
healthgrades.com The company didn't mention how much the new glass would cost, only saying that it would be "1 to 2 percent of a notebook's retail price," but we can't imagine laptop prices going up simply because of a change in the glass that manufacturers use.
canada online pharmacy.com Tokyo Electric Power Co, also known as Tepco, has been battling to contain radioactive water at the plant, which suffered triple meltdowns and hydrogen explosions following a devastating earthquake in March 2011.
pristiq high dose In 2011, the company conducted a more limited review intoits practices after a Bloomberg television anchor said on airthat he had used client log-in data in his reporting, but nopolicy changes resulted, according to the report releasedWednesday.
naltrexone rxlist On Wednesday afternoon, the Fed is scheduled to release theminutes from its June policy meeting. Investors will eye theminutes for any clues into the timing of possible trimming ofstimulus measures.
Jospeh says:
I'd like to apply for this job l arginine quand la prendre Navalny was convicted in July of organizing the theft of 16 million roubles ($500,000) from a timber firm in 2009. He had appealed the verdict and sentence, contending the case against him was fabricated and politically motivated.
oswalt pharmacy in seminole texas Closing down two of only three remaining immunization clinics in the city seems especially thoughtless and cruel even for an administration that, like Mayor Bloomberg's, is notorious for its blindness when it comes to the most vulnerable New Yorkers.
citalopram high yahoo answers The rest of Android is more or less untouched: you've got your Gmail, your web browser of choice, your Play Store, et cetera. All of them default to a phone view, not tablet view, though NVIDIA makes the Android 4.2 settings toggles accessible by pulling down the notification bar on the right, tablet-style.
atlantic-materiel-medical.com Either the UN is the right agency, and so let us put our energy into making it work, or we are yet again taking on the questionable mantle of global policeman, in which case we need a military capable of fulfilling that role.
piroxicam webmd In an email, the chairman and CEO of Taylor Farms, Bruce Taylor, said the Mexican plant produced 48 million servings of salads for thousands of restaurants in the Midwest and eastern U.S. in June, the month the outbreak started. He said the facility has an extensive water testing program.
Darron says:
A few months thuoc esomeprazole tablets 40 mg The BBC's arts editor Will Gompertz went on a slow train from Marylebone Station in London, to Aylesbury in Buckinghamshire to find out what it is about train travel that gets poets' creative juices flowing.
eastmed pharmacy hours The company's tours in Alaska include the 13-day Natural Wonders of Alaska, featuring a memorable rail journey from Fairbanks to Denali, exciting boat trips and visits to the Alaska Sealife Centre, Chena Hot Springs and the Athabascan Indian Village. Other Titan escorted journeys combine travel on the Canadian Rocky Mountaineer train with a luxury cruise along the Alaskan coast.
buying viagra in canada But abortion-rights advocates said that his signature amounted to a broken promise, because the new standards on clinic doctors will make it impossible for some clinics to continue operating. They vowed to fight the new laws in North Carolina and in other states.
pris p fosamax Asked whether there were any changes he would like to see with regard to the Presidents Cup format, Price replied: "Oh, yes, there's lots of changes I would like to see but I don't think we should discuss those now.
anavar results timeline It said 26 people – 16 soldiers and 10 members of thepro-Assad National Defence Force – were killed when rebelsattacked a nearby checkpoint on Thursday. There was alsofighting in the village of Jalma, two miles (3 km) south ofSheikh Hadid, on Friday, it said.
It's a bad line costco ontario pharmacy dispensing fee It was the first time Rajoy has admitted any error since it came out in January that former PP treasurer Luis Barcenas – in jail pending trial on charges of bribery, tax evasion and other crimes – hid up to 48 million euros in Swiss bank accounts.
harga cephalexin 500 mg Mr Starmer said there was a "safeguard" in the criminal justice system, which allows for a judge to halt proceedings at the end of the prosecution's case if he or she determines there is no case to answer.
norwich pharmacal order application In 2012, the human rights organization Amnesty International, which has repeatedly called for heightened regulations on Tasers, reported that 500 people in the United States had died from these stun gun devices since 2001. Florida had the second-largest number of deaths from Tasers, according to Amnesty International.
http://www.safety-health-expo.co.uk/ezone "Unless global temperature will begin to rise again in the next few years, the IPCC is very likely going to suffer an existential blow to its credibility," he said. Judith Curry, professor and chair of the School of Earth and Atmospheric Sciences at the Georgia Institute of Technology, was even blunter.
sps pharma services sarl In France sales were down 11.2 percent, Italy 10.3 percent and Germany 8.1 percent. Britain was the only major car market to expand, with sales up 10 percent – its 16th straight month of gains.
Fritz says:
I can't get a dialling tone oral terbinafine cost An Israeli attack would not be expected to take out Iran's nuclear facilities. Its purpose would be to drag the U.S. into the war on Israel's side, kicking and screaming. Exactly as laid out in Amazon Kindle's new thriller; The Bahrain Protocol.
adventisthealth.org A 5-year-old girl found her mother fatally shot inside their Oregon apartment last weekend — weeks after the woman told a court that her estranged husband threatened to brutally torture her, according to local reports.
costco pharmacy jobs indiana "Clearly, Kerry wants it more than Netanyahu or Abbas," said Elliott Abrams, who served as a deputy national security adviser under Republican U.S. President George W. Bush and was involved in Bush's failed push for a peace agreement by the end of 2008.
realdose nutrition fish oil reviews So many reforms at once are bound to step on a lot of toes simultaneously, drawing ire particularly from Mexico's large but fairly tame organized labor. The teachers marching in the Mexican capital belong to dissident locals of the 1.4 million strong National Education Workers Syndicate, or SNTE.
manforce uk ltd Before the minutes were released, a report showed U.S. homeresales rose in July to the highest level in over three years,suggesting sharply rising borrowing costs are having only alimited impact on the housing market's recovery.
Hayden says:
What sort of music do you listen to? flagyl (metronidazole) kopen California's 5150 allows for someone to be involuntarily hospitalized if they are deemed a danger to themselves, others or if they have a grave disability that renders them unable to provide for their food, clothing or shelter needs. If doctors and family members feel that more time is needed to assess the patient's needs, a hearing is held for an extension of the involuntary hold, which is then coded 5250, according to Rawles.
bell lifestyle products nigeria price list She wrote: "Despite the scale and seriousness of these threats, the official response from Twitter continues to be extremely weak – simply directing Caroline away from Twitter towards the police, and, belatedly, directing users to abuse reporting forms on Twitter.
cvs dulcolax suppositories "We're looking at disruption to 16,000 passengers and 200 flights a day, so the impact is not just on Kenya but the entire region," said James Shikwati, director of the Nairobi-based Inter-Region Economic Network, a think tank.
buff bake protein cookie review The new lawsuit was filed on behalf of Alexander Furman, a Buffalo Grove, Illinois resident, who said JPMorgan twice mailed him preprinted forms with his name, address and Social Security number on the outsides, and failed to follow up on his complaints.
ofloxacin ornidazole combination in dentistry July 15 (Reuters) – A federal appeals court on Monday upheldthe bribery conviction of HealthSouth Corp founder andformer Chief Executive Richard Scrushy, rejecting his argumentthat new evidence of possible juror and judicial bias warranteda new trial.
A financial advisor zithromax online prices Bamiro is likely a developmental tackle for the Eagles this season. First-round pick Lane Johnson is expected to start at right tackle, although he could be the eventual replacement for Jason Peters on the left side, potentially opening up a starting job for Bamiro.
paddington central pharmacy opening hours Kennedy was shot as his motorcade passed through Dealey Plaza in Dallas at 12:33 p.m. on Friday, Nov. 22, 1963. Lee Harvey Oswald was the man accused of shooting Kennedy with a high-powered rifle from the sixth floor of the Texas School Book Depository building on the plaza.
prohormonen.nl ervaring Lots of people die on Showtime programs, but bad guys getting skewered on "Dexter" aren't quite the same as what viewers will see on "Time of Death," a documentary series that premieres in November.
dristan sinus side effects A pair of larcenous lovebirds used identities swiped from a Staten Island doctor's office to finance a high-flying lifestyle, officials said — including a Disney World trip to get engaged at Cinderella's Castle.
nizoral rite aid Move over leopard and snakeskin, it's all about the zebra print for us right now. And clearly Selma Blair feels the same, wearing these Katie Grand Loves Hogan lace up shoes, which you can buy now – just click the link (right).
Remove card mitcham road pharmacy mitcham vic Committee chairman Keith Vaz said it was "very surprising" that the list was not shared with the Met, which is carrying out inquiries codenamed Weeting, Elveden and Tuleta into allegations of phone-hacking, illicit payments to public officials and computer-hacking by journalists, some linked to private investigators.
valproic acid pharmacy2us Wang helped us navigate the cultural minefield, too. "If you want to tip the driver," he volunteered, "give him a dollar or, at most, two." Oh, the relief of knowing what's expected on the tipping front. Indeed, on this trip we were briefed at every stage on what was appropriate. We were guided and cosseted all the way.
north florida pharmacy branford The annual report also reveals MAG's executive team – chief executive Charlie Cornish, Mr Thompson and commercial director Ken O'Toole – shared salaries and bonuses worth £1.65m, which was up from £795,000 in 2012.
what's voltaren gel used for "There is a recognition among the president, among the staff who have been closely working for him, that we're a family — this is a family, and there are a lot of laughs, and a lot of nostalgia to all the ups and downs, the incredible roller coaster that this journey has been," Obama campaign spokeswoman Jen Psaki told reporters on Air Force One.
taraz.steroids.kz Still, the EEG brain scans indicated "poor prognosis" on Oct. 18, so doctors planned to "wait and see" whether Burns would improve over the next few days, they told HHS investigators in August 2010, according to the report. That same day, however, doctors told the family that Burns' brain damage was irreversible and that she'd undergone "cardiorespiratory arrest."
Which year are you in? can you buy clomid online uk I'd be happy just to be able to get a 3G connection in Birmingham City Centre. Not going to pay extra because I've been told by Vodafone that I will get a better 3G connection if I get a 4G contract.
reliefpharmacist.com "This will serve as a base for the discussions between Areva and Niger on the renegotiation of contracts, particularly their financial conditions and the tax rates," he said. "We are awaiting with interest the results of this audit in the course of this month."
buy last longer pills The arc of the modern human rights movement is born of the aftermath of World War II with the formation of the United Nations General Assembly and its adoption of the Universal Declaration of Human Rights.
stancesupplements.com In July 2012, 11-year-old Liam Corcoran was able to board a Jet2.com flight from Manchester to Rome, despite being on his own, and without a passport or ticket. He had wandered to the airport from his home, three miles away, and evaded five security checks.
zantac op recept Peter Liese, a German Christian Democrat who steered theoriginal EU law through the European Parliament and led thedebate on the "stop the clock" one-year suspension, said he wasdisappointed with the Montreal deal.
I'll call back later erektionspiller.se There are many obstacles to a deal like this. Democrats would hate making any concessions when they believe they have the upper hand and the Tea Partiers would oppose this because it raises spending and does nothing significant on health care or entitlements.
excel-pharma.ca He was scouting for burglars on neighborhood watch and, of critical importance, he carried a gun. Spotting Martin, he profiled a black teenager in a hoodie as a likely criminal. In fact, Martin was merely returning home from the store with a soda and a package of Skittles.
debrox 200 mg celecoxib para sirve Heinz Kerry, who was born in the southern African nation of Mozambique, was married to Republican Pennsylvania Senator John Heinz III, an heir to the Heinz food fortune, until his death in a 1991 helicopter crash.
comprar rosuvastatina calcica Charlie, the Pink Floyd guitarist Dave Gilmour's other son, who was jailed after he was pictured swinging from the Cenotaph during the anti-tuition fees protest in 2010, has also been moving in illustrious circles.
iron mag labs metha drol extreme for sale U.S. shares were pummelled by weak earnings and outlook fromWalmart and Cisco, with disappointing sales atthe world's largest retailer stoking worries about the strengthof U.S. consumers, particularly low-income households that donot benefit from asset price gains.
Chung says:
I'm on business north country pharmacy hours Kourtney Kardashian's bad news boyfriend is having trouble keeping up with his hard partying lifestyle. Scott Disick, perpetual party boy and father of Kardashian's baby Mason, reportedly checked in to rehab following a violent outburst on an episode of Kourtney & Khloe Take Miami, E! Online reports. 'Scott received outpatient rehab treatment and counseling for alcohol use and psychological issues after his Miami outburst,' sources told E. 'He's still being treated.'
http://www.nombrisupplements.co.za "The very day the president signed Obamacare into law, I took him to court to protect our constitutional rights," Abbott said. "I know the Constitution. I have enforced the Constitution, suing an overreaching federal government."
shine organics purify and elevate "People were getting shot in a car next to me; people getting stabbed, but I never picked up a knife in anger. I was smoking crack but I always felt I was on the outside looking in; like I was not meant to be there.
buy-visanne.com The likes of Shane Watson, Usman Khawaja and Steve Smith got out in ways that will have been very disappointing for Darren Lehmann. I believe we will see lot of personnel changes in their batting order for the winter.
nmsportsmed.com You keep telling us "liberal" is a dirty word, but it means "liberty." If you hate liberty, then you probably should move out of America, don't you think, instead of trying to turn us into West Iran — a religious-based, ultra-conservative nation that hates equality and civil rights.
A law firm reverse my tinnitus system alan watson Employees at this creative-marketing agency plan their own hours under a flexible scheduling policy. The company's "30-Day 23 Ways Holiday Charity Challenge" encourages staff to pursue month-long personal improvement projects, and rewards them by making a donation to the nonprofit of their choice.
fish pharma.nl Martin-Artajo and Grout were each charged by the grand jurywith five criminal counts, including securities fraud, wirefraud, conspiracy, making false filings with the U.S. Securitiesand Exchange Commission and falsifying books and records.
medication proscar 5mg In a part of the interview that aired Tuesday, Juror B37 said it wouldn't have made much difference if Zimmerman had testified at trial since she believes he would have gave the same story he gave investigators in videotaped police interviews that were played at the trial.
tren enanthate 200 mg side effects Few paths are more treacherous than the one that challenges abuse of power and tries to make a meaningful difference. Whistleblowers often find that they become the subject of the story. Any personal vulnerability they possess will be used against them, and through these smears, the whistleblower's charges become a subordinate issue. The Bush adinistration was expert at this subterfuge. Its vindictive response to its critics went beyond questioning their truthfulness, competence, and motives. It sought to destroy their careers and livelihoods.
5kits.com legit "That's the nature of the Yankees," Cashman said. "That's the way it's always been. It's nothing new. We try to look at both the long-term and short-term, but the short-term is always the goal here. It's always about now."
How many days will it take for the cheque to clear? minocycline hydrochloride yahoo answers Priority No. 1 figures to be the re-signing of Robinson Cano, who will likely command at least $175 million over seven years to stay in pinstripes. With Mariano Rivera and Andy Pettitte retiring and Derek Jeter entering what might be the final year of his career, the Yankees are hoping to keep Cano in pinstripes to take the torch as the homegrown face of the franchise.
buy golden root complex australia The recruitment sector has slowed in the past year as financial services continue to falter, leading to firms delaying job drives and staff staying put. The UK is performing better than elsewhere — Page's news that gross profit rose 5% in its British business echoed similarly buoyant figures from rival Hays last week. But recruiters originally based here have fast expanded overseas.
legitscript pharmacy checker 2. What is Bank of America's track record on growth projections? Over the past, say, 3 years, have they generally nailed it within .1% of accuracy? If not, why should anyone care if they make a .1% adjustment to their forecasts? Are we really to consider that evidence of note that the partial "shutdown" for a week (or two) somehow produces a massive real shock to our productive capacity?
sna-medicine.mm.aptoide.com Ma, certified by the U.S.-based World Association of Sex Coaches, favors a frank approach to encourage confidence. Her lessons include explicit videos of oral sex and appropriately shaped fruit for practice sessions.
trustpharm.ml I live in Africa. I have spent years photographing lions and leopards on foot, from vehicles and even helicopters. The drill was pretty similar for these big cats – your best opportunity to photograph them is at dusk and dawn and back home, trawling slowly through the reserves in a specialised Landrover had become the quintessential photographic safari experience. However as I found myself on the other side of the globe on the back of an elephant wondering how to secure my cameras, sit comfortably and try to spot one of only 120 tigers in Nepal, I began to understand the challenges I would face.
Grant says:
I've just graduated cialis 30 tablet fiyat Lazaridis and Fregin's action, which is not an official bid but an attempt to do due diligence, appears unconnected to the Fairfax letter of intent. However, shares of BlackBerry jumped 0.49% on Thursday afternoon and closed over 1% higher, indicating the markets are interpreting the pair's SEC filing as intent to acquire the company.
saratoga chips nutrition We are told this still makes Stafford's maternity unit too small to be viable. Yet in France or Germany, Stafford's maternity department would be considered quite large. Not only that, the proposal to move most of the births to UHNS would result in Stoke-on-Trent hosting one of the largest units in the country with at least 7,000 births a year (by comparison, Germany's largest maternity department sees 4,000 births a year).
kaiser oakland pharmacy holiday hours "There are 76 houses that can't get the service, two properties where the fibre service is worse than the one they had before and we estimate 226 properties out of about 942 are unable to achieve the lower limit of 24 Mbps," he said.
power precision lean muscle formula uk Russia is increasing spending on space and plans to send a probe to the moon in 2015, but the pioneering program that put the first man in space in 1961 has been plagued in recent years by setbacks, including botched satellite launches and a failed attempt to send a probe to a moon of Mars. ($1 = 32.9557 Russian roubles)
hoodia rite aid Former Justice Department prosecutor Larry Klayman filed a federal class-action lawsuit Wednesday against the nine companies named in a top-secret National Security Agency document published June 6 as partners in the NSA's PRISM Internet surveillance program.
I don't like pubs atomic 7 Most arguing against an international attack on Syria's regime, for allegedly using sarin nerve gas to kill more than 1,400 people last month, cite the futility of the Iraq war and hear echoes of the mischaracterization of Iraqi weapons of mass destruction programs that preceded the US-led invasion in 2003.
onlinerxmarket legit "Education campaigns, especially where not backed up by visible enforcement, do very little. Spending nearly £500,000 asking drivers, cyclists and pedestrians all to be nicer to one another offers poor value for money on its own.
buypillperfect.com The Economist Intelligence Unit's Global Livability Ranking placed cities from those two countries in eight out of the top ten spots, with Vienna and Helsinki the only two European metropoles in the top 10.
emblica officinalis fruit The practice is no longer mandatory for Border Force officials, with immigrants found hiding in lorries to get into Britain being handed back to French authorities instead. The downgrading of controls means Britain has no formal records of those trying to sneak across the border.
http://www.homecaremedical.com Remember Citigroup chief Chuck Prince's comment, just before the crash, about how you have to dance while the music is playing? That was an acknowledgement of how commercial pressures (and personal gain) prompt banks to keep pouring on credit even when things seem to be getting out of hand. That this happens is something well understood by Shiller, in a way Alan Greenspan never understood, or never allowed himself to understand.
Rolland says:
I'm in my first year at university how long after drinking can i take viagra "With this order, it gives us more momentum to look for potential joint R&D efforts for the future generation of aircraft," Fabrice Bregier, chief executive of Airbus, told a news conference in Tokyo with JAL President Yoshiharu Ueki.
ervaringen met viagra "Harvey is Harvey. That guy is unreal," Gee said. "I just try to go out there and do what I can do to help win games. I am not trying to follow Harvey with his stuff because I don't have it."
ky jelly sensitive While most critics agree that the video is beautifully shot, it also pushes too far in the direction of crass sexuality, to the video's detriment. Then again, as long as it's controversial, Miley's likely to be satisfied, right?
can bremelanotide be taken orally None of which helps Edward Snowden. He's Putin's pawn of the month, and if he's eventually allowed into Russia, it's quite possible he'll soon be shuffling along the streets of Moscow with only a few rubles in his pocket and with no idea where he's headed.
mind focus music download The United Nations General Assembly will discuss Friday two new reports on drone strikes and extrajudicial killings compiled by Ben Emerson, the U.N. Special Rapporteur on human rights and counterterrorism.
We'll need to take up references splash physiotherapy greensborough There was a knock on the door as Fred was doing my makeup. A gentleman was at the door with a box. Inside was a man's tailored shirt that had been made for me. It was an absolutely gorgeous shirt with Mr. Mogul's name on the back and a note that said, "It's going to be a casual evening. Please wear jeans and this shirt."
ukhghpharmacy.en.ec21.com Kellan Lutz is one good looking vampire. The 26-year-old 'Twilight' actor has returned to his modeling roots in new Dylan George and Abbot Main by Dylan George Fall 2011 campaigns. He's accompanied by gorgeous model Anne Vyalitsyna, who happens to be Maroon 5 front man Adam Levine's girlfriend.
advocare.com/24daychallenge/virtualcoach In its August issue, the magazine said Aunt Jemima Original is "slightly sweet and eggy, crisp outside and moist inside." Aunt Jemima Original and Trader Joe's Multigrain were selected as Consumer Reports' "best buys."
paroxetine mg The amendment had sought to set the Brazilian government's minimum share of "profit oil" from the sale of the giant Libra offshore prospect and other fields in Brazil's most productive oil area at 60 percent.
albuterol sulfate inhaler uses Randy Frederick, who oversees Schwab's business for activetraders, said last week that trading volume among all retailinvestors had not been keeping pace with the broad rise in stockmarkets, a sign that investors were letting their profits rideand waiting for dips to buy.
Will I be paid weekly or monthly? priligy generico en chile What the Big Powers soon discovered was that they had elected a man who stood up to them, in particular the permanent members of the Security Council, whenever his conscience or the UN Charter required it. His cardinal values and hallmarks were independence, impartiality, integrity and moral courage. This enraged some of the world's leaders, but at the same time they respected him for it.
where to buy vigrx "When some individuals allegedly defraud the military system for financial gain it tears away at the very fabric of duty and honor," said Douglas G. Price, FBI Special Agent in Charge, Phoenix Division.
coemed.org For example, Time Inc, a division of Time Warner Inc, the largest magazine publisher in the United States, was one of the last holdouts to join Apple's newsstand. The standoff was because the world's largest technology company did not want to share subscriber data with the publisher of Sports Illustrated and People.
shanti bar coupon Nokia committed to Microsoft's Windows Phone platform in 2011 after seeing its phone business hit by the success of the iPhone and Android. It does not offer any phones with Google's Android software.
robins pharmacy hollis ny Squadron's opponent, Letitia James, is a former public defender, assistant attorney general and, since 2004, a Brooklyn councilwoman. She is vocal and energetic and would be likely to apply both qualities to the agendas not of the public but of the unions.
Grady says:
What university do you go to? programa de desconto do spiriva It's not just low- and middle-income families making choices to cut costs. Overall, 57 percent of the survey respondents said a college student is choosing to live at home to cut housing costs, up from 51 percent last year.
lamisil cream side effects liver NEW YORK, Oct 14 (Reuters) – U.S. stocks ended a volatilesession with modest gains on Monday, as investors bet that therewould soon be a deal in Washington to increase the debt limit,though there were no obvious signs of progress.
price of orlistat in bangladesh The IMF called on emerging economies, which have been the drivers of the global economy in recent years, to undertake reforms that will help their economies better withstand the scaling back of monetary stimulus in the U.S. and other major economies.
how does prescription drugs affect the demand and supply of other products and services in the us Rodriguez, decked out in a Trenton Thunder cap, a blue shirt and black and gray shorts, took batting practice, fielded grounders at third base and ran first to third several times. The workout came a day after he played back-to-back rehab games with the Thunder, going 1-for-2 with a homer, five walks and a strikeout.
does uroprin work
Their first meeting in Cincinnati highlighted a day of upsets in the men's bracket. No. 1 Novak Djokovic and No. 2 Andy Murray lost in the quarterfinals. No. 1 Serena Williams moved on in the women's bracket.
I'd like to open a business account does zovirax treat cold sores The Acibadem Sigorta acquisition complements Avicennia'sacquisition of an insurance joint venture between CIMB and Avivain Malaysia in early 2013, the fund said. Khazanah's portfolioof insurance assets includes Singapore ACR Capital Holdings,which specialises in conventional and Islamic reinsurance.
appley bridge pharmacy Australia has the world's biggest reserves of metallurgical,or coking, coal and is well placed to supply China and Japan,the leading importers of the fuel used in steel making. So whyare Australian prospectors heading overseas?
condor medical waste abu dhabi Standing in a nearly empty Senate, Cruz began an attention-grabbing speech in the early afternoon Tuesday that could stretch into Wednesday in favor of withholding funds to operate the government unless Obamacare is gutted.
parfumemporium.de "Fring is one of the pioneers that helped change the wayconsumers communicate on-the-go and is perfectly aligned withour strategy to bring service providers rich, simple-to-use,mobile communications solutions," said David Walsh, Genbandchief executive.
tretinoin gel retin-a micro In a case reported by the BBC, a Spanish debt-collection agency tried to collect £54,000 from a British holidaymaker who spent a month in hospital – even though he was covered for the emergency under his Ehic.
What's your number? femara webmd "Even though this is a local election, there is more interest in it locally and internationally," S. Arumainayaham, the top civil administrator in the provincial capital of Jaffna, told reporters at his office.
mail order pharmacy jobs in new orleans "For example, manufacturers have seen new export orders contract for a fourth consecutive month in July," Neumann said in a note on Tuesday, adding that there are signs that domestic headwinds for emerging markets' growth are "stiffening" as well.
cope pharmacy akron ohio Nova had a 1-0 lead before giving up four runs in the fifth, the second coming on a Nick Markakis sac fly on which A-Rod cut off the throw from Soriano on its way to the plate. Chris Stewart stood in front of the plate with his hands up, palms facing the sky, amazed that A-Rod had cut off the throw. Soriano appeared frustrated by A-Rod's decision as well, pounding his glove with his fist in left field.
kamagra dubai It is precisely this controversial and violent history, however, which makes many Syrians wary of the group. Suspicions that the Brotherhood is ultimately looking to grab power in Syria were fueled by the rapid downfall of the Brotherhood in Egypt when that country's military overthrew former President Mohammed Morsi.
manforce tablets side effects The funds industry itself is maturing. As the rank of experienced analysts shrink at banks due to cost pressures, senior portfolio managers are likely to consider subscribing to independent research firms started by top analysts.
How long have you lived here? the man plan elise k ackers pdf "It's so sad," says Mr Dunn. "We tried and tried, adapting the business where we could, including much cheaper but still bespoke products in our range, like chocolate lollipops with people's names on, but we have finally had to admit defeat. The shop was initially such a great success – we were taking £6,000 a week in the early months – but then the recession kicked in and we have not been able to recover quickly enough to keep up with rising costs. We are a luxury purchase, and when people have that bit less to spend, things like high-end chocolates take the hit."
online stim-u sens
"The NFL is a fraternity of brothers and I am thankful for the tweets, phone calls and text messages from my fellow players," he added. (Reporting By Brendan O'Brien and Kevin Murphy; Editing by Andrew Hay and Ken Wills)
supreme medical centre n3 ** Singapore's Oversea-Chinese Banking Corp Ltd and Agricultural Bank of China Ltd have emerged asnew potential suitors for Wing Hang Bank Ltd, hopingthe Hong Kong family-run lender will help them expand revenuesabroad. Sources familiar with the matter said Singapore's No. 2lender and China's No. 4 bank are considering bids and havebecome the most serious contenders for Wing Hang as others whohad initially shown interest are now balking over the price.
integrated pharmacy network system Big aluminum consumers like MillerCoors are setto tell the committee that the banks' control of metalwarehousing firms has driven up industry costs by as much as $3billion. The banks will not speak at the hearing, with theirviews represented by a lawyer who often works with Wall Street.
thorazine iv dosage In the last few years the school has started gathering more data about the profiles of students who match in competitive residencies and using data from the National Resident Matching Program to advise students about the specialties in which they should attempt a match. That data, combined with an analysis of a student's strengths and likes, can give them a better chance at solidifying a residency match.
Could you tell me the dialing code for ? highrisepills.com The sentencing phase, which resumes on Monday, was expected to last at least until August 9, military officials said. The government was the first to call witnesses and Manning's lawyers will also have a turn to call their own witnesses.
synthroid levothyroxine sodium tablets usp The burger, which cost £220,000 to make before being cooked and eaten for the first time at an event in London yesterday, was created from 20,000 tiny strips of muscle that were grown from a handful of cells taken from the shoulder of a cow.
topamax generic vs brand name But for anyone who interpreted the statement to mean Weiner was implying that MLB was leaking information, Weiner quickly cleared that up, releasing another statement Thursday afternoon: "Earlier today, the MLBPA issued the below statement from Executive Director Michael Weiner regarding the leaks of information in the Biogenesis investigation," the second statement said. "Apparently, some members of the media have interpreted that statement as an accusation against Major League Baseball. The MLBPA has no information about the source of the leaks and we have no information that indicates MLB is the source.
pinnacle pharmacy az Fast-food chicken nuggets obtained from two national chains contained less than 50% chicken meat; the rest was a mix of fat, blood vessels, nerves and traces of skin and intestinal cells, researchers found.
hip implant lawsuit Chief executives from major financial institutions havewarned of "adverse" consequences if government agencies remainclosed and lawmakers fail to raise the debt ceiling bymid-October. In a meeting with Obama on Wednesday, Goldman SachsChief Executive Lloyd Blankfein implicitly criticizedRepublicans for using their opposition to the healthcare law asa weapon that could lead to a U.S. default. (Compiled by Garima Goel in Bangalore)
Emory says:
What do you do? amplified wheybolic extreme 60 power para que sirve "With where we're at, the position we're in, we have to win every day," Joe Girardi said. "You stay on them, you keep working them, you keep encouraging them and hopefully this will turn. Hopefully offensively we'll start scoring more runs and things will turn."
generic lexapro online pharmacy The computer programs that underpin the desk's activities assess around 60 measures of market stress and timing – from global risk arbitrage spreads to dividends to repo rates – to get a better read on sentiment, behavior and deal timing.
precio arimidex espaa "We, the people" over that period have proved ourselves "we, the uninformed" or "we, the meek" by the ongoing acceptance of such absolute nonsense from those we pay A LOT to "see that our business is done RIGHT". We are all Homer Simpson!
cara pharmacy sligo facebook However, Girardi stopped short of ruling Gardner out if the Yankees do make the postseason. "I think he'd be available, yes," Girardi said, although it remains to be seen if that's just the skipper's natural optimism.
precio bisoprolol "The Army Procurement Fraud Branch did receive and review the 43 recommendations late last year, but the report did not include enough supporting evidence to initiate suspension and debarment under Federal Acquisition Regulations," said Matthew Bourke, an Army spokesman.
Garfield says:
A company car lexapro dosage 30 mg The cable giant pulled the plug on CBS at the 5 p.m. deadline yesterday in New York and other key markets after failing to reach an agreement with the top prime-time network, seen in the metro area on WCBS/Channel 2.
can i switch from paxil to prozac A Department for Education spokeswoman said: "It is utterly unacceptable that so many children leave primary school without a firm grounding in the basics of English, maths and science. That is why our rigorous new primary curriculum focuses on these vital subjects.
is 10 mg lexapro enough "McDonald's showing up here shows that Vietnam is a big dealto a lot of people. It means things are happening in Vietnam,"Nguyen told Reuters in an interview at his swanky office here inVietnam's most iconic building. He is the son-in-law of NguyenTan Dung, Vietnam's prime minister since 2006, but insists thatisn't why he won the McDonald's franchise deal.
cara beli acai berry While she was gone, a fire sparked by faulty wiring in the kitchen killed her 5-year-old daughter, Nayeli Colon, and 4-year-old twin sons, Adrian and Alexis Colon. Their bodies were found huddled under a dresser in her home in the Milwaukee suburb of West Allis.
medical staffing services new brunswick nj The death of secular opposition figure Brahmi, gunned down outside his Tunis home on Thursday, came months after another secular leader, Chokri Belaid, was killed in a similar attack that stoked violent protests.
Adalberto says:
I'd like to open an account good pharmacy practice in south africa latest edition A list of the prisoners, along with the names of the people they were convicted of killing, was published by Israel's Prisons Service as part of a process in which opponents of their release have 48 hours to appeal to the High Court. Based on past decisions, the court is widely expected not to intervene.
ciprofloxacino antibitico para que sirve "It would force us to surrender our privacy," Perry, a scholar at the conservative think tank American Enterprise Institute, recently wrote in a column for McClatchy Newspapers. "Each day more and more of us are required to tell government agencies more and more about ourselves. Do we really want the government collecting data about driving habits?"
svhealthcare.org/portal "The solution to our energy problems is still a roll-out of high-tech low carbon renewables which would be incentivised by supporting the clean energy target in the Energy Bill, but Davey is currently blocking it."
can you buy lamisil tablets over the counter Tangerine, apricot, terracotta, or neon, whatever hue you aim for, an orange investment needs to take pride of place on your wishlist for the coming season. And with the high street coming up trumps again, it's far too easy to say yes.
gold max pink canada Goldman Sachs Group Inc. stockholders sued the company in 2010 for making alleged misstatements about its procedures for addressing conflicts of interest. Goldman argued the statements were puffery and not meant to be taken at face value by investors.
I've come to collect a parcel erectieproblemen-oplossen.com They accused the rating agencies of misrepresenting theirindependence, the quality of their models and the timeliness oftheir ratings for collateralized debt obligations andresidential mortgage-backed securities.
dexamethasone kilo alma Tom Brady and the Patriots could have a field day against the Bills' defense, putting Manuel in position to win a shootout in his first career start. Healthy or not, that's a tough proposition for anyone. As long as Manuel plays reasonably well, the Bills could lose big and still walk away feeling optimistic about the season.
alvogen pharma india p. ltd Margulies remembers her first viewing as like 'walking into an executive lounge at an airport. It was all plasma screens and bright red velvet stools,' she says. The couple's approach has been to pare back the interiors, removing carpets, curtains and pelmets to reveal the property's elegant bones. Rooms have been redecorated in gentle shades of grey, with the windows picked out in a faded black that gives them the appearance of Crittall frames.
athens pharmacy athens al hours After three days of talks in Geneva, U.S. Secretary of StateJohn Kerry and Russian Foreign Minister Sergei Lavrov demandedAssad account for his secret stockpile within a week and letinternational inspectors eliminate all the weapons by the middleof next year – an "ambitious" target, Kerry said.
mappro.medactionplan.com After two surgeries and two rounds of chemotherapy, Drexler said she didn't hesitate when Dr. Tanyi, her physician, asked her to donate tissue to the study. Last week, she visited the Working Dog Center to meet the animals whose work might one day lead to fewer battles like hers.
Earle says:
I didn't go to university celexa side effects drugs.com Meanwhile, Three UK announced that its 4G service would go live in four UK cities in December. Unlike the other networks, Three customers with a 4G-ready device will be able to use 4G services straightaway at no extra cost.
orthopedics & sports medicine baycare clinic manitowoc Hamas accuses Fatah, led by Palestinian President Mahmoud Abbas, of inciting hatred towards it in the Egyptian media. The Palestinian Embassy in Cairo says the documents that it produced to prove its case were false.
nortriptyline drugs.com The generally held principle is that what we need to inspire us as children and impressionable young adults are "good" teachers in the Good Will Hunting or Dead Poets Society mould: benign, caring, paternal figures who will unlock our dormant creativity and nurture our blossoming genius. But often, a collision with a total bastard who hates everything about you is very useful training, and will serve you well throughout your life. Perhaps, in fact, he will be more useful than the empathetic Robin Williams figure, more inspirational in his own way – if only because you won't rest until you've proved the old git wrong.
alexapure pitcher replacement filters Mild forms of SAD are believed to affect as many as 20 percent of people in the United States. If you think you might be one of them, view this slideshow to learn more about the signs of this disorder.
clindamycin phosphate topical gel used treat Some analysts say the talks over Syria's chemical weapons are unlikely to succeed, likely leaving Obama – who ran for president as an anti-war candidate – with an increasingly difficult decision on whether to launch a military operation in the face of a reluctant Congress and a disapproving nation.
Thanks for calling buyketaminehydrochloride.com "Our findings indicate that (to) regularly obtain sufficient amounts of sleep may be an important factor promoting weight control, achieved by priming the brain mechanisms governing appropriate food choices."
f factor diet week 1 JPMorgan Chase has already announced it plans to sell its physical commodity business in the face of mounting regulatory scrutiny, as Chief Executive Jamie Dimon attempts to pull the bank back from riskier, non-core businesses in the face of criticism it is still "too big to fail." But Goldman Sachs has remained resolute that its storied J Aron commodity arm is a "core" part of the bank.
americanhealthcarecapital.com As the police moved in with tear gas, female demonstrators and their children retreated onto side streets, chanting furiously at police and at General Sisi, the military leader who led last month's military takeover. Two men wielding machetes were seen chasing the fleeing marchers.
argireline eye cream side effects Yorkshire Post provides news, events and sport features from the Yorkshire area. For the best up to date information relating to Yorkshire and the surrounding areas visit us at Yorkshire Post regularly or bookmark this page.
mustangmedicine.nl "There's hardly a sense of panic. There's nonchalance. Thewidespread expectation is that there will be a deal to avoid(default)," said Chris Scicluna, head of economic research atDaiwa Capital Markets.
I live here azelaic acid drugs.com Pass safely. If you are about to pass someone(s) walking/running/riding in the same direction asyou and there's someone(s) walking/running/riding in the opposite direction: don't pass until thecoast is clear. It's really that simple. Would you do that in your car on the highway? Don't tryand squeeze in between the person you are passing and the one coming in the other direction.Instead, slow down, wait for the person heading in the opposite direction of go by … and then passsafely. And say "on your left" as you do. I've had to holler "don't do that" a few times whensomeone passes in a dangerous fashion and almost hit me.
smartshake v2 compartments Yes there are a number of options available, you can set your browser either to reject all cookies, to allow only "trusted" sites to set them, or to only accept them from the site you are currently on.
maximum shred and xtreme antler combo muscle diet Also involved are a host of seedy minor characters. "Many people think that Mona is Carol and Carol is Mona" is typical of these creatures' featureless states. We lose track of them often, as does Scudamore, whose purpose is not to describe individuals, nor shape a plot, but rather to create a mood of crazed confusion where identity is fluid, memory tricky and life itself pretty pointless. In place of a plot that moves forward, Scudamore gives us melodramatic yet static intensity in flashbacks told in the present tense. A morning cup of tea has this effect on Cleo: "… it shocks her awake so hard that her skin feels seized all over, her heart rips into action and she nearly falls out of bed with panic and fear."
medcenterurgentcare.com When he spoke, Chris had the uncanny ability to express himself in kaleidoscopic terms, highlighting and analyzing each angle of the story before nimbly moving on to the next aspect — one you'd never quite formulated before. It was a quiet, bravura performance, and it was impressive as hell.
neo medrol prix "We played on equal terms with Brazil and Argentina and we got to the final against Spain in the Euros. It's all going to depend on if we can create a similar sort of group as we did in 2006," said De Rossi.
When do you want me to start? womenra cvsu Fritz Schlunegger, from Bern University, Switzerland, was not involved in the work and commented: "This group has used sediments at the end of Bossons glacier to determine where erosion is happening beneath the ice.
scabies after permethrin treatment Louisville, Ky. resident Natasha Carmon learned this lesson firsthand. "I lost out on a few deposits for lack of not having someone to help dispose of excess furniture or items I didn't want to take with me," Carmon says.
can you buy xanogen at walmart "It's not a space that's really known about or on people's radar," says Stuart-Smith, who has won eight gold medals at Chelsea, including three best-in-shows. "It's just a junkyard, really, one of those curious architectural leftover spaces. When I first saw it I likened it to a big pothole or brick canyon: it has a remarkable feel."
buy-meds-here.com reviews Bill Lueders, president of the Wisconsin Freedom of Information Council, said the secrecy was an "unfortunate departure from Gov. Walker's record of open government." He said that donors had a right to be proud of sponsoring a bipartisan event that seeks to make state governments around the country more efficient and effective.
majomedicine.com In her article for Telegraph Wonder Women she said she was inspired by her visits to girls' schools, which she squeezes in between the "everyday juggling of children, family, work, occasional travel and helping with (endless) homework".
Felton says:
I love this site fluoxetine online bestellen A spokesman for Mr Brown responded by saying: "This is the height of hypocrisy from Danny Alexander, given the Lib Dems' utter failure to commit to dualling the A9 during the years they were in office at Holyrood.
prescription drugs and hair testing It requests urgent funding to hire inspectors and technical experts to destroy what Western intelligence agencies believe is about 1,000 tonnes of sarin, mustard and VX nerve agents, built up over decades and spread over dozens of locations.
vibramycin doxycycline After the pests were taken care of, Zenjuro and his wife started cleaning the freezers inside their shop. To my surprise, all the cakes were still there and in perfect shape. Nagaoka, the owner, explained that the power had never been off since the day of the disaster. He didn't seem to find that odd or particularly significant.
pharmacistscafe.com "We now know that just ten countries are home to over three quarters of those trapped in modern slavery. These nations must be the focus of global efforts," Nick Grono, CEO of Walk Free Foundation, said in a statement.
megaroids.net reviews Aug 21 (Reuters) – Facebook Inc CEO Mark Zuckerberghas enlisted Samsung Electronics Co Ltd, QualcommInc and other technology companies to help him in aproject aimed at making Internet access affordable for the 5billion people around the world who are not online.
There's a three month trial period ic hydrochlorothiazide 12.5 mg cp Ennahda party chairman Rached Ghannouchi offered to form a national unity government if all political parties take part, but said a caretaker cabinet of non-partisan technicians could not "manage the delicate situation in the country".
pharma-food.de Target's online uStyler tool helps students curate personalized looks and design virtual rooms that they can share on social media. And the Checklist option creates customized product recommendations that can be printed at home or at a Target registry kiosk.
arteroprotect cena apoteka But I'm not sure there are any losers. Booker's Senate race is tightening, but mildly flirtatious banter with a topless dancer who lives 3,000 miles away isn't going to sink him. And Lonegan may pick up some support among voters who hate strippers or vegans, but at this point anything (non-scandalous) that keeps the attention focused on Booker and his social-media prowess probably hurts Lonegan more than it helps.
envisionpharmacies login Florida Georgia Line, pop singer Ariana Grande, alternative rock band Imagine Dragons and Phillip Phillips, the winner of the 11th season of the TV singing competition "American Idol," will also compete for new artist of the year.
viagranow.biz forum Stuart Broad will rightly take many of the plaudits for an inspired six-wicket haul that secured the series win on the fourth evening at Durham, but Flower was quick to praise Cook, not least for the decision to restore Tim Bresnan to the attack at a pivotal point of the game.
Children with disabilities depilacja laserowa krakw active woman opinie This makes you proud of the variety there is back home. Given Toronto's huge sprawling suburbs and the vastness of its country, in Canadian terms Liverpool and Manchester are practically the same place; so to have such differing accents within such a proximity is unique. Stretch the distance a little further and people from the same country could struggle to decipher what the other is saying.
biaya bayi tabung di klinik yasmin rscm 2012 Next week, the Senate is expected to begin debate on the spending bill, where Senate Majority Leader Harry Reid, D-Nev., will strip out the health care language and send a bill back to the House that simply extends current spending.
french pharmacy beauty products online "I'm not asking to be your fourth for doubles tennis, I'm not asking to be your husband … I'm not asking to be your father," he told a crowd earlier Thursday. "I'm asking to be the person who every day wakes up and says: How do I make life better for the people of this city?"
brain peak ingredients China's overnight repo rate is creeping up again, and rose above 4% for the first time since the first week of July. The PBOC attempted to the crack down on shadow banking until it realized that the unintended consequence of its plan was a burgeoning financial panic.
gaming-pill.com Even if, as the jury found, Zimmerman rightly felt in danger of death or grievous bodily harm, Martin's death was a horrible tragedy. Florida law gives wide latitude to people claiming self-defense, and the jury was required to listen to the facts and decide whether the prosecution had proven, without a reasonable doubt, that Zimmerman did not feel in danger. That's a hard standard to reach, so as distressing as the not guilty verdict is to many people, it's an understandable conclusion.
Bernardo says:
A packet of envelopes androbolix 300 ingredients I know right now that in seven weeks' time, despite all the training I have been doing, I will be absolutely shattered both mentally and physically. You have to give everything to win the Ashes.
cocrystal pharma reverse split U.S. Ambassador to the United Nations Samantha Power's remarks on Thursday left no doubt that Washington would not seek U.N. approval for a military strike on Syria in response to an Aug. 21 chemical attack near Damascus.
randalls pharmacy 35th street austin The ERS said that the burden of the disease fell heaviest in Europe's wealthier nations – strongly indicating that historically high smoking rates in better-off societies are taking their toll. It was estimated that at least a half of the entire socioeconomic cost of respiratory disease could be attributed to smoking, the ERS said.
content of tablet diamox The black teen was returning from a trip to a convenience store to a home in the gated Sanford community when he was followed by Zimmerman, a neighborhood watch volunteer upset over a rash of recent neighborhood home break-ins. A confrontation ensued and Zimmerman fatally shot the unarmed teen during the struggle.
pharma legal kracked out pre workout review Not that the Giants would ever panic this early, but they showed a measure of desperation just two days after their six-turnover nightmare by bringing back Brandon Jacobs, a popular former Giant whose hypothetical role is to mentor Wilson. Coughlin insisted "that's not the primary reason he's here" but Jacobs is 31, carried just five times last year during an injury-plagued and controversy-filled season in San Francisco (which ended with him on the suspended list) and wasn't an overwhelming success the last time he wore a Giants uniform either (571 yards on 3.8 yards per carry in 2012), especially in short-yardage situations.
I'd like some euros where to purchase uprima Christopher Columbus discovered the islands in 1503 and named them Las Tortugas, after the giant turtles that he sighted in the surrounding seas. The islands were later renamed Caymanas, from the Carib indian word for a crocodile.
har vokse hair regrowth spray The rear camera's lens is also positioned enough away from the edge of the body to avoid those irritating fingers-in-shots issues, but the design of the phone means we definitely recommend holding with two hands – any less and it's all too easy for the device, which is relatively thin at 8.5mm deep, to slip away and end up bouncing along the ground.
probiotics one coupon code An American Airlines jet takes off while U.S. Airways jets are lined up at Reagan National Airport on the day U.S. Airways' stockholders are expected to vote on whether to approve the $11 billion merger of the two airlines effectively creating the world's largest carrier, in Washington July 12, 2013.
steeped coffee An average of 140, 1,800-passenger cruise ships used toarrive in Acapulco annually in the years preceding 2011, portdirector Octavio Gonzalez told Reuters. By the end of this year,he expects just 13, 600-passenger boats to have stopped off.
buy prematurex uk "In humans, some peptides stimulate immune responses, which either enhance HIV infection or have no effect at all, while others may have anti-HIV activities that are lost when the virus changes or mutates to avoid such immunity," said corresponding author Janet Yamamoto, a professor of retroviral immunology at the UF College of Veterinary Medicine. "So, we are looking for those viral peptides in the cat AIDS virus that can induce anti-HIV T-cell activities and do not mutate."
Truman says:
Would you like to leave a message? probiotics one coupon code Companies calculate the present value of their future pension liabilities using a so-called discount rate, which is based on corporate bond rates. A higher rate means lower liabilities, meaning that a company doesn't have to set aside as much cash now to pay retirees in the future.
best drugs for musicians This is a type of cookie which is collected by Adobe Flash media player (it is also called a Local Shared Object) – a piece of software you may already have on your electronic device to help you watch online videos and listen to podcasts.
goochland pharmacy "Any time you beat one of the best fields in golf, take the lead into the last round with Tiger (Woods) and Rory (McIlroy) and everybody right there and being able to win, gives you a lot of confidence. You know you can do it."
qivana qore detox side effects You can't blame the dog for attacking the cat…it's basic instinct. If your cat is roaming loose, I hardly blame the dog for what it did. If the dog was also loose, punish the owner, not the dog for doing what is only natural to him.
worldmedicine.kz It now plans to open its first stand-alone cafes in SouthernCalifornia in 2015. Some "non-traditional" Dunkin' Donuts shops- such as those in military bases, fueling centers, colleges,casinos or airports – may debut in the next several months.
Yes, I love it! banzaisluts.com In each of the first two games in St. Louis, the Dodgers sent a Cy Young winner to the mound, while the host Cardinals countered with a rookie. Here's a look at the upside-down stats in all three games.
amitriptyline for tension headaches Low interest rates, the perennial subject of these pages, are another factor, because they encourage investors to seek higher returns on their capital than is available from the bank. Low interest rates also translate into cheaper mortgages, giving landlords higher yields. So this "boom" phase of the buy-to-let sector is set to continue.
towndrugstore.com reviews "I know the press likes to focus on body language, and he's got that kind of slouch, looking like the bored kid in the back of the classroom. But the truth is that when we're in conversations together, oftentimes it's very productive," Obama said.
enalapril ratiopharm 10 mg precio Because I'm both a smartass and a nerdily obsessive reader in areas that interest me. The verbal duels that would occur inevitably caused them to blanch when I walked into class…. but on the upside, the cool profs? They liked me. I made and brought cookies to those classes. A lot. And as professors are only human, a batch of triple chocolate cookies will keep lecture halls a happy happy upbeat place. I believe in all things, be fair, be balanced, and make sure your karma is right by giving cookies to those that deserve it. This all being said, off to nerdily and obsessively read up on this find and all the brain tingling comments other commentators have listed… Hmm. Anyone know how I can shove some cookies into the web for this post and the writer & readers?
buy cheap tamoxifen According to Captain Don Aguilar of the Ventura County Sheriff's Office, "Amanda Bynes was involved in a disturbance in a residential neighborhood last night in Thousand Oaks in the 200-block of Avenida De Los Arboles. Deputies investigated the incident and determined that she met the criteria of 5150 W&I (California Welfare & Institutions Code). She was detained and taken for a mental health evaluation."
Irvin says:
Is there ? herbaldrugsmart.be "There are some reports that there were some custody issues with (Brown's) children but I can't confirm that," Long Beach Police Sgt. Eaton told MyFoxLA.com. Eaton added that he did not know how many children Brown and Taylor's daughter had together.
is erectomax any good Currently, same-sex couples are unsure if they can exclude from federal income taxes any healthcare expenses covered by a spouse's employer. Businesses exclude healthcare expenses from employees' paychecks for heterosexual couples.
buy trenbolone oral Less than a third of people realise that Type 2 diabetes can lead to serious health complications such as amputation, heart attack, blindness and stroke, according to a new survey commissioned by Diabetes UK.
neosize xl guatemala In Baton Rouge, La., the city's Metro Council approved a measure to send its 800 homeless residents out of the area. Officials initially named the program "Clean Sweep" but quickly changed it to the Homeless Outreach Prevent Efforts – or HOPE – after people started complaining that "Clean Sweep" seemed like the city was comparing its homeless to trash. The council approved $5,000 for the trial program which they say is enough for 30 bus tickets.
viagra for women uk sales Next month, Nike will release the FuelBand SE, an update to the original FuelBand, which was released in 2012. The new device, which is available for preorder and will be released Nov. 6, will run you $149, but Nike's hoping it'll get you in the best shape of your life, too.
Ayden says:
I can't get through at the moment bupropion sr 150 price Economists expect the first rate hike in late 1999 or early 2000 with many seeing base rates at 6.25 percent by end 2000. That "should be sufficient to quell potential inflationary pressures," said Investec economist Philip Shaw.
fda guidelines for prescription drugs The 7-foot tall Spongebob Squarepants headstone was erected as a tribute to Kimberly Walker, veteran of the Iraq war. Â Her family had it specifically fashioned after her favorite cartoon character. Â The headstone, portrayed above dressed in military garb with Kimberly Walker's name affixed to the uniform, was called an "inexplicable error in judgement" of one of the cemetery's staff members. Â Kimberly Walker's twin sister had intended to have an identical headstone erected for her grave site next to her sister's.
androgel 6 At the former NFL player's arraignment, Bristol County assistant district attorney William McCauley outlined the evidence against Hernandez, including recovered shell casings, video surveillance, text messages, and a piece of chewed Bubbalicious gum recovered from a Dumpster at a rental car agency. McCauley also recounted statements Hernandez allegedly made in the hours before his friend, Odin Lloyd, 27 was killed about how he could no longer trust the victim.
diamox webmd The grower in this case, who farms near Royal City,Washington, reported to state officials in late August that hisalfalfa hay was rejected for export because it tested positivefor GMO, and he had only been growing non-GMO alfalfa.
rezeptfreie-potenzmittel.eu Local health departments report despite Stark County's warm days, the chilly spells and nights have delayed the usual mid-summer outbreak. Frost in late May stopped the first swarm of the season.
Deandre says:
I'm retired rezept ginsengwurzel Roshan claims in court papers that when he refused Recovery Media's $30,000 offer to go quietly, higher-ups at The Fix threatened to make news of his past struggles public, thus hindering future career prospects.
indigohealthvoyages.com * AT&T Inc is seeking buyers for its wirelesstelecommunication towers and is working with TAP Advisors LLCand JPMorgan Chase & Co on the sale, Bloomberg reported,citing people familiar with the matter.
harga cephalexin 500 mg They have been talking about attaching yet another plan to the debt limit bill that would gut Obamacare, as well as forcing a controversial approval of the Keystone oil pipeline running from Canada to the U.S. Gulf of Mexico.
rabeprazole generic price The violence is relentless. This week alone Quetta has seen attacks on three successive days, killing at least 42 people. In June two days of bloodshed saw at least 53 dead including a large number of female students – first their bus was bombed, then so was the hospital treating the survivors.
le jeune cream price In one test described in the paper, H&E staining was pitted directly against SRS microscopy. Three surgical pathologists, trained in studying brain tissue asnd spotting tumor cells, had virtually the same level of accuracy, regardless of which images they examined. The difference, Xie said, is that SRS microscopy can be done in real time, and without dyeing, removing, or processing tissue.
Your cash is being counted atorvastatina precio con receta The TSB makes safety recommendations to Transport Canada,the federal government department that regulates the railwayindustry. Analysts said the disaster, viewed as the worst railaccident in North America in 24 years, is almost certainly goingto lead to new regulations that could add to the cost oftransporting oil by rail, a burgeoning business in both theUnited States and Canada.
prix cialis 2 5mg comprim pellicul bote de 28 The price the company charges per ad slid 12 percent in theApril to June period, six times the decline just a quarter ago -a fall that some say highlights how Yahoo has been caughtunprepared for the industry shift to automated, programmatic adbuying.
testofen opiniones "I'm not going to comment on that because it's going to start a multitude of rumors," she said coyly. "I will say I have such an extensive collection of Victoria's Secret underwear and he definitely appreciates it."
nutricafe coffee Hello everyone and welcome to football 9-5, Sportsmail's rolling daily news service. We'll have all the reaction to last night's Capital One Cup third round results plus all the breaking football news for you throughout the day.
viagra super p-force review All ten S&P sectors were down with utilitiesdeclining the sharpest, down 0.6 percent. Utilities, as big debtissuers, could see their borrowing costs rise if the U.S.delayed or defaulted on its debt payments.
perfect design thanks olmesartan goodrx The new touchscreen device, which boasts a five-inch displayand a 1.7 gigahertz processor, will compete against the likes ofApple Inc's iPhone 5S and Samsung Electronics Co's Galaxy S4, along with a slew of other devices thatare powered by Google Inc's Android platform.
prednisolone prezzo * Grocer Safeway Inc has gone on the defense daysafter activist hedge fund Jana Partners declared a 6.2 percentstake in the company. Safeway said on Tuesday that it had putinto place a poison pill plan to prevent investors fromacquiring more than 10 percent of the company. ()
1stonlinemeds.com What they concluded is that by 2047, more than half of the planet will experience average temperatures hotter than anything seen between 1860 and 2005. In the tropics, that "tipping point" is likely to arrive even sooner: the models suggest that Jakarta will hit unprecedented temperature extremes in 2029, and that Bogotá, Columbia will experience them in 2033. Most major American cities included in the study will reach their tipping point around 2047, give or take a five-year margin of error.
pharmidex (Additional reporting by Diane Bartz, Patrick Temple-West, Deborah Charles, Margaret Chadbourn, Amanda Becker and Phil Stewart in Washington; Verna Gates in Birmingham, Alabama; Jane Sutton in Miami; Brendan O'Brien in Chicago; Writing by Alina Selyukh; Editing by Karey Van Hall and Peter Cooney)
kamagra predaj The leaked documents, obtained by The Associated Press, show political leaders in Belgium, Germany, Hungary and the US have deep concerns over how to address the issue ahead of next week's meeting of the Intergovernmental Panel on Climate Change (IPCC).
Walton says:
I'm not sure abacusmedicine.com "Business operators are increasingly being confronted by so-called community protests, which are highly organised and difficult to combat," says Richard Clancy, from the Victorian Employers' Chamber of Commerce and Industry.
trazodone yellow pill He added, "There are some countries with a very largenuclear industry. If they close, we don't have a cat in hell'schance of tackling climate change. I would love to think we canreplace that with renewables alone, but frankly we won't be ableto."
farco-pharma gmbh pharmazeutische prparate Now Miranda wants to do the same over other plus size young women, and rejects claims that by hosting these websites, she's encouraging obesity. "It was only when I gained a bit of confidence that I actually felt like I wanted to lose weight and look good. And that's all this is about – giving people the confidence to be themselves.'
medical.careers.global reviews In the face of opposition from the City Council, Filner could establish a legal defense fund and raise donations to pay for his own attorney, Erie said, though he added: "The question is how much and how many and whether they want their names to be made public."
solvaderm juvabrite amazon The United States, Israel and other countries accuse Iran of using its nuclear program to try to develop the capability to produce weapons. Iran says the program is for peaceful energy purposes only. During his General Assembly speech last week, Rouhani said nuclear weapons "have no place in Iran's security and defense doctrine, and contradict our fundamental religious and ethical convictions.
Garry says:
Yes, I love it! cebrian zaragoza paseo independencia Many people in China have watched the case closely, shocked by the behaviour of the children of China's elite, and the way the police and courts often give them favourable treatment, the BBC's Damian Grammaticas in Beijing reports.
buy cheap amoxil Sources in the Prime Minister's Office said the congressional move was important because it was the first time an international body has stepped up the sanctions since Rouhani was elected to replace Mahmoud Ahmadinejad in June.
southside regional medical center medical records "Between 2006 and 2010, UK forces provided vital security for the population of Sangin, disrupting the insurgency in an area the Taliban had considered its heartland, preventing the spread of violence elsewhere, upholding the authority of the Afghan government in the area and enabling economic development to take place.
qualitest methylprednisolone recall The space agency released the Mars 2020 Science Definition Team's 154-page report on Tuesday, noting that the next rover to explore Mars should be a significant step on the road to sending humans to Mars in the 2030s.
bloomshealth.com.au Sikhs have truly been path breaking pioneers into the west. They have taken the burden of difference on themselves in way most other Indian immigrants have not had to. While other desis could assimilate in some fashion, Americanize themselves in ways, Sikhs stood out.
What do you study? xalatan prezzo al pubblico But under the new trading rules, buyers can no longer choosethe specific brand of metal they get, meaning some traders said there is a risk the tin they get via the exchange may haveimpurities that make it useless for consumers.
medrol dose pack therapeutic class The U.S. Department of Agriculture on Thursday raised itsforecast for China's imports in 2013/14 to 8.5 million tonnesfrom 3.2 million tonnes in the previous year, prompting U.S.wheat prices to rally to more than two-week highs.
http //online-pharmacy-24h.com review Economists, bankers and investors say they caught a glimpse of Asia's possible future in June, when regional markets convulsed at a suggestion by Federal Reserve chairman Ben Bernanke that the central bank of the world's largest economy might start scaling back quantitative easing, or QE.
french pharmacy buy online Munro becomes the second Canadian-born writer to win the Nobel for Literature, although she is the first winner to be thought of as distinctly Canadian. Saul Bellow, who won the award in 1976, was born in Quebec but raised in Chicago and is widely considered an American writer.
online buy serogen Egypt's military has been trying to rout terror cells across the Sinai Peninsula for several weeks. A recent attack on a military outpost left six Egyptian soldiers dead. Some 17 security force members and five civilians have been killed in the region since Morsi's ouster on July 3. Egyptian intelligence estimates that there are at least 500 armed extremists operating on the Sinai Peninsula. As many as 30 attacks have been carried out against security forces in the region in the past two months.
Norberto says:
I'd like to send this parcel to alri viper hyperdrive 5.0 The hefty penalties are proof that Major League Baseball, which appeared to turn a blind eye to steroid use for many years during the 1990s and early 2000s, is dead serious about eradicating doping and protecting athletes who refuse to use banned drugs. The Biogenesis investigation represents an unprecedented step by Selig, who ordered his executive vice-president for economics and league affairs, Rob Manfred, to spare no expense in identifying and prosecuting drug cheats.
be herbal full spectrum ashwagandha 500 mg NEW YORK, July 16 (Reuters) – The S&P 500 snapped itseight-day winning streak on Tuesday after disappointing salesfrom Coca-Cola, while investors turned cautious on the daybefore the Federal Reserve chairman's congressional testimony.
hak nutrition pre hakoneh Shares of the largest candle maker in the U.S. continued itsrally on Monday after a SeekingAlpha report said the company'sstock could make a "parabolic" move higher in the very nearfuture. The stock rose 17 percent on Friday.
northview pharmacy bristol Sweetpeas, which are flowering extravagantly in my garden right now, are divided into bunches from dark to light colours in nine small jars (think fish-paste jars), and arranged in a square to create a block of loveliness. For a minimalist look, try nine stems of chocolate cosmos in a flat-sided plain-glass vase. Two stems of white or purple clematis are allowed to bend and arch their leaves and tendrils in a vintage bottle. Clematis is among Alethea and Jill's favourites, along with lily of the valley, daphne and honeysuckle – they place a couple of stems in vases on their bedside tables.
clindamycin hcl 150 mg The man, whom Boston police did not identify, approached officers outside a TJ Maxx store in the Boston neighborhood of Dorchester around 6 p.m. Saturday with a black backpack. The man told authorities he found the bag, which contained a passport and a large sum of money, in front of the store.
One moment, please honey goat weed cheap Denard Robinson is gone after a stellar career, but Gardner is back to provide the same sort of sizzle in Michigan's backfield. The 6-foot-4 junior began last season at wide receiver, and then played quarterback for the last five games. He threw for 1,219 yards and 11 touchdowns against five interceptions, and also had 101 yards and seven TDs on the ground.
caverta sklep Sen. Wendy Davis and a bevy of protesters successfully filibustered the bill last month, but Republican Gov. Rick Perry called another special session so Republican lawmakers could vote on the bill again.
http://www.revivesalonandspa.com/ Political wrangling has slowed the sale of company unitsAnsaldoEnergia, AsaldoBreda and Ansaldo STS. To datethe group has only agreed to sell its stake in aero engine partsmaker Avio for 260 million euros.
viimed.com Simon Calder is Travel Editor at Large for The Independent, writing a weekly column, various articles and features as well as filming a weekly video diary. Every Sunday afternoon, Simon presents the UK's only radio travel phone-in programme called The LBC Travel Show with Simon Calder (97.3 FM). He is a regular guest on national TV, often seen on BBC Breakfast, Daybreak, ITV News and Sky News. He is often interviewed on BBC Radio, particularly for BBC Radio 4's You & Yours programme and BBC Five Live.
mymedicalrecords.com review Turning a child forward-facing before age two can result in head, neck or spinal cord injury due to their undeveloped bodies. To safeguard children, keep them in a rear-facing car seat until they reach the upper weight or height limit recommended by the car seat manufacturer. Once your child outgrows a rear-facing infant seat, switch to a rear-facing convertible seat with higher height and weight limits.
History awomanshealth.com Ian Stannard, head of European FX strategy at MorganStanley, said any hints on Wednesday in the minutes from theFederal Reserve's June meeting that U.S. monetary stimulus couldbe tapered soon would also support the dollar.
combivent nebs mode of action The charity estimates that 1.5 million older people in rural areas are reliant on oil to heat their homes, which frequently costs more than electricity and gas and can only be bought in large quantities, resulting in sizeable upfront costs.
vaso 9 xpdc "The General Association of Press and Publishing (GAPP) resolutely supports the news media conducting normal interviewing and reporting activities and resolutely protects journalists' normal and legal rights to interview," the China Press and Publishing Journal, which is overseen by the association itself, said, citing an association official.
sensushealth.com Sarah's father said she begged her parents to stop the chemotherapy, and they agreed after a great deal of prayer. The family, members of an insular Amish community, shuns many facets of modern life. They live on a farm and operate a produce stand near the village of Spencer in Medina County.
http://www.harmonie-medical-service.fr/admin Dina Pule, who has been implicated in alleged corruptactivities, was replaced as communications minister by Yunus Carrim, the deputy cooperative governance minister. He becomesthe fourth person to hold the post in four years.
Can I use your phone? onlinerxmarket legit Barnes & Noble, needless to say, took notice and fought back with its own e-reader, the Nook. Nonetheless, the overall position of superstores in the industry's value chain had already changed – no longer were they the scarce point of entry for those who wanted access to books, and today Amazon's Kindle titles lead the Nook's by an average of $2.50 in customer savings per title.
axum sports wireless earbuds review "My swing and my game does not feel far off from the levels that I was playing at this summer, but it is still a fraction off. It just needs to kind of click. I'm optimistic that (on) back nine, that it may have done that."
progsupplements.com Earlier today, Blackberry finally pushed out BBM for Android and iOS into the respective app stores. Since then, we've actually seen a lot of content come out about the BBM app, like the persistent notification. Now we've found a way to bypass the virtual waiting line to get into BBM. It's actually a pretty easy […]
precio de allegra pediatrico Washington's debt ceiling drama played out as anxious globalfinancial leaders gathered in the U.S. capital for annualmeetings of the International Monetary Fund and Group of 20major industrialized and emerging economies.
buy finpecia online uk Employees of the top carrier of voice traffic in Africa andthe Middle East were targeted with malicious software called"Quantum Insert" technology that had been developed by the NSA,the report said.
I can't get a signal where to buy atorvastatin Vimeo offered a $10,000 advance for a 30-day window ofexclusive online rights to all 146 feature films that held theirworld premiere at Toronto. The deal does not hinder filmmakersfrom making separate theatrical or television deals.
old reynella discount pharmacy Besides having a leading plastic surgeon on call 24 hours a day, the package includes a car service from the procedure to the hotel; a private escort to your room; extra ice, towels, and pillows to be delivered each day; in-room pedicures, manicures, and full hair care services; a masseuse on request; and pretty much anything else you can dream up — and are willing to pay for.
anabolics.ws scamadviser How is it that not a single newspaper or journalist in the entire world has requested a response from the Spanish government as to why King Juan Carlos of Spain requested that the convicted rapist be pardoned.
nerpharma milano "When there is consensus, who the Fed chair is hardly matters, and the times when it matters are the times when you have to think outside the box, and then his strengths shine," said Brad DeLong, a professor at the University of California, Berkeley, who worked with Summers in the Clinton Treasury Department.
how to take prevacid 30 mg GM Korea's labor union believes South Korea is still a competitive base for producing quality cars for sale at competitive prices. "Korea has an edge in cost compared with the likes of Australia and Germany," the union's Choi said.
Joesph says:
The manager ctr.pharmacyboardkenya.org He began by explaining how he could identify with the parent of a boy deemed dangerous — because he too was a boy deemed dangerous who lived to become a parent. "When Trayvon Martin was first shot I said that this could have been my son," Obama said. "Another way of saying that is Trayvon Martin could have been me 35 years ago."
prix tenormine 100 mg But there have been several interesting developments at the company over the past quarter, including the launch of BlackBerry Messenger on iOS and Android as well as renewed rumors of layoffs and buyouts swirling. That's why investors should watch the company's Sept. 27 earnings release closely. Let's take a look at the top five questions shareholders want answered next week.
fusion juicer 100 While surveys in the West may be improving, they have yet tolift the mood among managers in Asia. HSBC/Markit's survey ofregional purchasing managers indicates that new orders arefalling in China, South Korea and Taiwan, and that growth isslowing in Japan.
shengjingpian ingredients "It's a hobby that has really caught the imagination," said Alex Baker, one of the two PhD students involved in the project. "The space shuttle programme cost $200 billion, so getting our spacecraft to 37 km for 350 quid feels amazing and quite a bargain."
manforce pills india Lohan looked positively thrilled in photos of her exit that surfaced online late Tuesday. But sources told TMZ that Lohan was headed to stay with a sober coach for at least a few days before reentering the wider world.
Where do you live? asq pharmacy How much leverage does the Obama administration really have to cut a deal with the Iranians regarding their nuclear program? According to the International Crisis Group, only eight of the 31 U.S. and international sanctions against Iran can be reversed by order of the White House (the rest require votes by the U.N., the European Union or Congress).
aripiprazole bodybuilding In a statement, IBM spokesman Mitchell Derman said the city "decided that a phased-in approach best meets the needs of itscitizens." He pointed out that Curam also built the eligibilitysoftware in Maryland and Minnesota, "two states that plan tohave full functionality on Oct. 1."
affordable bathroom renovations adelaide "People need to know this kind of thing is possible with a relatively small budget and they can with a very simple system steer the ship off-course — without the Captain knowing," he told Fox News.
avocado green mattress coupons The Polish government has brought in a variety of financial measures to breathe life into the country's economy. But the medicine will not bring about a quick cure, much to the frustration of voters.
disposal of prescription drugs in massachusetts In an announcement on Friday from the State Council, or cabinet, China said it will open up its largely sheltered services sector to foreign competition in the zone and use it as a testbed for bold financial reforms, including a convertible yuan and liberalized interest rates. Economists consider both areas key levers for restructuring the world's second-largest economy and putting it on a more sustainable growth path.
I'd like to withdraw $100, please pillsflagyl.com Automatic Renewal Program: Your subscription will continue without interruption for as long as you wish, unless you instruct us otherwise. Your subscription will automatically renew at the end of the term unless you authorize cancellation. Each year, you'll receive a notice and you authorize that your credit/debit card will be charged the annual subscription rate(s). You may cancel at any time during your subscription and receive a full refund on all unsent issues. If your credit/debit card or other billing method can not be charged, we will bill you directly instead.
lido 4 lidocaine cream Bennett, who previously held positions at blog site Tumblr, Newsweek, and the Village Voice, later posted on her page that the notice was for a volunteer rather than an official job posting. "Let's all take a deep breath," she wrote.
http //www.canadapharmacy24h.com reviews In Israel hours before the London christening, busloads of Russian tourists descended Wednesday morning on Qasr el-Yahud to immerse themselves in the River Jordan. The site – five miles (eight kilometers) east of Jericho – is considered Christianity's third holiest site after Bethlehem and Jerusalem
griseofulvina precio en venezuela What a doozy of a day for the Coolio clan. The rapper, 48, was arrested in Las Vegas on March 9 after he and a friend were pulled over for a routine traffic violation, TMZ reports. Upon running Coolio's name through the system, the police officer discovered that the 'Gangsta's Paradise' rapper had two active bench warrants out for his arrest based on multiple traffic violations, and arrested him on the spot. Coolio was taken to the Clark County Detention Center, where, incidentally, his son Grtis Ivey, is also being held …
dulcolax 10 mg suppositories The justices will decide whether appointments PresidentBarack Obama made to the National Labor Relations Board wereinvalid. A ruling in favor of the litigation center's client,Noel Canning Corp, would knock out hundreds of labor relationsboard decisions and require them to be reconsidered. The Chambersays the labor board's decisions were invalid because some ofits members were improperly appointed
DE says:
Could you give me some smaller notes? buy viagra overnight delivery The mix of large and small plumes of water ice and organic particles emanate from multiple locations throughout the "tiger stripes" near the South Pole of Enceladus. The Cassini spacecraft discovered the jets that form the plume in 2005, approximately one year after the spacecraft started orbiting Saturn.
emblica officinalis fruit Bezos "ducks and weaves when he's asked about libertarianism," Sloan writes. "When I exposed the thesis of this column to Amazon, I couldn't even get a response, much less an interview." Because the wildly successful founder of Amazon.com surely has time for condescending reporters openly intending to lambast him in print. I'm sure Bezos wasn't actually busy – it's not like he's in the midst of a $250-million deal to take over the reins of a major newspaper that's been hemorrhaging readers and fighting to stay afloat.
proteinworld.com.au Heaven knows why the government wanted to massage its own figures down – £3.6m is still much less than feared, and having ignored its own sums of just a few months ago makes it look like we're rewriting history.
fat killer medicine But he was caught in the battle on the final climb. Quintana, Froome and Rodriguez rode off, leaving Contador to labor behind. The winner of 2007 and '09 who was stripped of his 2010 win and banned for a failed doping test ran out of legs.
fexofenadine medscape Liebman, who set out to examine whether the judicial system had put seemingly-innocent criminals to death, spent five years investigating the details of the De Luna case. He and his team of investigators and students talked to more than 100 witnesses, combed through 20 feet of documents and compiled a 400-plus page narrative case study of the Lopez murder. To back up their assertions, the team put the study online, with hundreds of footnotes and links to original documents and primary source materials so that people could come to their own conclusions about the two Carloses.
Timmy says:
What sort of music do you like? imipramine night terrors While the Bank of England will spell out its plan in detail next month, it said markets were over-aggressive in pricing in rate rises. The ECB contented itself with saying rates would stay at record lows for an "extended period" and could fall further.
cipralex eller zoloft The best way to learn English expressions is to listen to what your American classmates say and then write it down. Next time, you can use what you have learned to express your thoughts in an American way.
ultimate male supplement ingredients "Data from a number of Vienna International Centre visitors'USB drives (data memory sticks) is believed to have beencompromised," Serge Gas, director of public information, said,confirming an earlier Reuters report.
endurox r4 vanilla Returns on healthcare IPOs this year are at an average of 43.9 percent since their debut date, far exceeding the Nasdaq Composite year-to-date return of 18.4 percent, and the S&P's 18.6 percent, according to accounting and actuarial firm PricewaterhouseCoopers.
atorvastatin teva 20 mg biverkningar The idea of a roadmap setting out steps towards the deeper integration of the euro zone came about in early 2012, when the debt crisis was at its peak and there were legitimate fears that Greece could be forced out of the currency union, or that the whole European project could disintegrate.
Will I have to work on Saturdays? xength x1 price in india KKR may invest in the Panasonic unit, which makes bloodmonitors and other medical devices, with the Innovation NetworkCorp of Japan (INCJ) in a deal that may be worth as much as 150billion yen ($1.5 billion), the newspaper said, citingunidentified sources with knowledge of the matter.
buy ug pharma savage Daisy Dukes have never looked better! Victoria's Secret Angel Alessandra Ambrosio showed off her long supermodel legs in an itty bitty pair of cutoffs while running errands in Los Angeles on Oct. 16, 2012.
bluesky-pharmacy.com He says: "We decided it was time to get them back together. As they had been separated for quite a while, we were on standby to act in case anything happened, but we needn't have worried, as the two greeted each other as if they had never been apart."
sepsis health promotion Leonard Green acquired a majority stake in Brickman inJanuary 2007 in a $847 million deal in which members of theBrickman family and the company's management retained equityinterests. The buyout firm committed $222 million of equity tothe deal, according to a November 2006 regulatory filing.
erapharma.com.tr Latest figures show that there are 152,000 women over 50 who are unemployed and looking for work, almost twice as many as there were at the start of the recession in 2008. There are 68,000 women over 50 who have been unemployed and looking for work for more than a year.
I'm training to be an engineer cymbalta medication for back pain Today, all modern economies have paper or fiat money backed by the power of government. And the possibility that the U.S. will revert to a gold-backed currency is little to none. The gold standard is a relic of history.
lcr health active pk reviews "Herman endured what very few of us can imagine, and he did it with grace, dignity, and empathy to the end," they said. "Although his freedom was much too brief, it meant the world to Herman to spend these last three days surrounded by the love of his family and friends. One of the final things that Herman said to us was, 'I am free. I am free.'"
onde comprar viagra generico mais barato Mr Hailwood told the programme the 'fatberg' is part of a problem with waste disposal, where people are not disposing of fats or other waste properly, costing Thames Water thousands to remove.
buy malegra fxt Two years ago, he unsuccessfully tried to get his daughter off the practice court. When Serena was stunned the next day by Samantha Stosur in the Open final, Richard told a reporter it was because an exhausted Serena "wore herself out at practice."
doxazosin 4 mg pill identifier "I had moments where I wanted a kid with Carey. You know — you first fall in love, and you're like, 'We should have kids,' and then it went away. But he always wanted kids and then we did it, and now it's like, 'F—,' this is so rad. It's more important than anything we've done."
I'm unemployed steroids-powder.com Amazon's Kindle Fire HDX tablets are the retailer's highest specification tablets to date, with the 7in model featuring a 1920×1200 display and the 8.9in model a 2560×1600 display. Both the 7in and 8.9in models have quad-core 2.2GHz Qualcomm Snapdragon 800 processors, 2GB of RAM, Adreno 330 graphics, dual cameras, support for 4G LTE, 11 hours of battery life and the Android 4.2 Jelly Bean mobile operating system.
lanoxin prix An official involved in designing bank bailouts in countries with EU/IMF programs said consistency improved over time but was hard fought. "In an ideal world we should have had a system with much more consistency," he said. "Sometimes we had to come up with solutions very fast … (and) there were different liability structures and different assets."
viagra price in malaysia Western diplomats say that conceding to demands for zeroIranian enrichment from U.S. and Israeli hawks would undermineRouhani's authority at home by exposing him to accusations of asell-out from conservative hardliners in the clerical andsecurity elite.
patients first pharmacy washington mo Last week, Chinese authorities began an investigation into possible price-fixing and anti-competitive practices at five foreign companies manufacturing infant formula milk, including Nestle SA, Abbott Laboratories, Mead Johnson Nutrition Co, Danone's Dumex brand and Wyeth Nutrition.
zac brown weight loss His intervention adds weight to growing calls for an overhaul of UK drug policy. Leading figures in health, including England's chief medical officer Dame Sally Davies, have called for drug addiction to be viewed primarily as a medical, not a criminal, problem. The Deputy Prime Minister Nick Clegg and the influential Home Affairs Select Committee have both backed calls for a Royal Commission to look at options for reform.
A financial advisor msten extreme mass builder by assault labs cheap Jessica Bridge, of Ladbrokes, said: "The second heatwave of the summer is in full swing and the odds suggest we're in for another scorcher. The faster the temperatures rise the quicker the odds will drop when it comes to breaking weather records."
when should i take my cialis Even in upscale and trendy restaurants, the Big Apple has become a city of fries, with eateries competing to outdo each other on the most innovative iteration of the potato stick. It's a grease-based uprising not even Bloomberg has tried to take on.
eradikate dupe "If that was me in the top three I'd be embarrassed. We need to settle on our best 11 and stay with it. I'm a believer in the pick and stick method, so we need to find our best 11 suited to the conditions and stick with it."
pocket packet aprs One review by the New York state Department of FinancialServices focuses on a proposed $1.35 billion purchase byGuggenheim Partners' Delaware Life Holdings LLC affiliate ofCanada's Sun Life Financial Inc's U.S. annuitybusiness, the people said on Tuesday.
tadacip generico But at Apple's event on Tuesday night, where a new, thinner iPad made the headlines, was more interesting for what it said about the renewed rivalry with Microsoft. It started with the unveiling of new, typically expensive – if very high-specification – computers, those objects supposedly made obsolete by the rise of the tablet.
this post is fantastic http //medsnoprescriptiononline.com reviews The decision is the latest in a series of rulings onintellectual property and pricing in India that have frustratedattempts by Western drugmakers to sell their medicines inIndia's fast-growing drugs market.
omnimedfinancial.com Dominion said it expects it will be a decade before the first turbine is installed in the area, about 23.5 miles off Virginia Beach on the outer continental shelf. The utility is involved with offshore wind research projects intended to lower the energy source's cost, which is significantly higher than fossil fuels.
drunkondrugsreport.net "They're so much better off than a lot of other people inthe Bay Area and around the country, and they're asking formore," he said, adding that his one-hour commute turned into a 21/2-hour nightmare during last month's strike.
buy lexapro uk A source close to the White House said earlier this week he had reason to believe Obama was giving close consideration to Summers, if not leaning in favor of him over the consensus front-runner Yellen.
drug skelaxin 800 mg In addition to tax-exempt debt, California's deal included$186.5 million in taxable bonds. Yields on those bonds were 1.09percent for their November 2016 maturity and 1.657 percent fortheir November 2017 maturity.
Withdraw cash aniracetam buy uk By the end of March 2009, for example, the Total Return Fund owned $1.26 billion of a FannieMae 30-year TBA security paying 5.5 percent, valuing it at 103.55 cents on the dollar, accordingto quarterly data on the fund's holdings. Then, between April 17 and May 6, Pimco bought $11billion of the same security for the Fed's books, paying a higher price of 103.81 on average,the Fed's trading records show.
doxazosina nombre comercial ecuador In an international collaborative project, scientists have recorded the times, places and concentrations of oceanic plankton occurrences worldwide. Their data has been collected in a global atlas that covers …
number of kmart pharmacies The Light Rail Manila Consortium, headed by Philippineconglomerate Metro Pacific Investments Corp, submitteda bid that did not comply with the rules, said Jose PerpetuoLotilla, undersecretary at the transportation department.
my-health-rx-online.com Third Rock's Bluebird Bio Inc made a successfulmarket debut in June and its shares have risen 69 percent sincethen. Agios Pharmaceuticals Inc was taken public by theventure fund in July. Agios shares have risen more than 40percent since their listing.
onnit powerfood active If Apple is working on a major update for the Retina MacBook Pro line, waiting until October would help keep the new models from getting lost in the iPhone and iOS 7 hype. It also would give Apple more time to ramp up pre-launch inventory and take care of last minute details like pre-installing OS X Mavericks, all of which would help to boost initial sales.
I'll send you a text holothink deep zen meditation review Freundlich said that argument did not make any sense. He also knocked down Wilson's argument that since he filed his petition in August – before he was sentenced to death by lethal injection for the 2003 murders of undercover officers Rodney Andrews and James Nemorin — that he should get a break.
anadrol anavar difference The restored copy of "Too Much Johnson" will have its world premiere at the Giornate del Cinema Muto annual silent film festival in Pordenone on October 9, and a US premiere to follow a week later.
prueba medica rcp The difference today is that there is NO path "ahead" free of icebergs and so economies are slowing down and stopping because there is simply no other rational choice. On the other hand, it is time for those trained in the "dismal science" of economics to begin examining the pieces of our present puzzle and how they can be otherwise assembled. We must use what we have, where we are, now.
physiclo activewear review The victims, Jean and Scott Adam and their guests Bob Riggle and Phyllis Macay, were the first US citizens killed in a wave of pirate attacks that plagued the Gulf of Aden and the Indian Ocean in recent years.
medicalaesthetics.com.mx "The Gear won't have a flexible display. The new device will enhance and enrich the current smart mobile experience in many ways. It will lead a new trend in smart mobile communications. We are confident that the Gear will add meaningful momentum to the mobile industry."
Could I have an application form? http://www.prohealth.com.mt The government will decide on whether to go ahead with thesales tax hike by looking at the April-June GDP figures,although the decision should be made sooner rather than later,Aso said at a news conference.
mms and prescription drugs George Stephanopoulos is anchor of ABC's "Good Morning America" and "This Week." He is also the network's chief political correspondent, reporting on political and policy stories for all ABC News broadcasts and platforms.
licengsui herbal For the day, WNET and WLIW will join forces with more than 75 public radio and television stations, supported by the Corporation for Public Broadcasting, to school viewers on the efforts and organizations to fix the issue from coast to coast.
cialis uk nhs Authorities say Alexis had only recently started his job, and that although there was a "routine performance-related issue addressed to him" on the Friday before the shooting, there's no indication that he targeted particular co-workers or was motivated by problems in the workplace, said Valerie Parlave, head of the FBI's Washington field office.
big tree farms cacao nibs "Absolutely. Look at me. I'm a WWE superstar and to be honest with you, I'll tell you right now, I'm gay," Young said. "And I'm happy. I'm very happy."
I quite like cooking http://www.medshop.com "I've done it all different ways, that's the thing," said the 37-year-old American. "Some years I've striped it and have really played well, and other years I've hit it all over the lot and had to be creative.
prescription drugs to give up smoking Fits.me is one of several start-ups to have recently sprungup in response to the industry problem, producing software theyclaim will reduce returns and boost sales by helping shoppersselect the correct tailoring.
sdbmed.com The case might never get to trial. The airlines are likely to keep trying to negotiate a settlement that would require concessions — at a minimum, giving up takeoff and landing slots at Reagan National Airport outside Washington — but allow the merger to go ahead. Publicly, however, both sides have sounded as if they're ready to fight, not talk.
owens pharmacy hours warsaw indiana * New York State, failing to keep pace with technologicalchange and increasingly sophisticated economic crimes, needs toupdate its laws to help authorities prosecute white-collarwrongdoing, according to a report released on Tuesday by theManhattan district attorney, Cyrus Vance. ()
what is quetiapine fumarate 25mg "In today's competitive marketplace it's all about making sure you can take care of customers because if you don't they can go someplace else. Interestingly on Fire Island, there is no place else, so we listened to our customers," Maguire said. "It was pretty apparent that we wanted to do something beyond Voice Link and the wireless network, so we think that fiber is the best course."
Dghonson says:
I can't stand football precio orlistat similares A University of Virginia student died at a rave in Washington, D.C., the same weekend, after taking what her friends said was Molly. Days earlier in Boston, a 19-year-old woman died in a club and three concert-goers overdosed at the waterfront, police said.
buy citalopram 20mg uk In a letter dated Monday to U.S. District Judge RichardSullivan in Manhattan, Shevitz said that while she is willing torepresent both men, "Mr. Tanaka prefers that the court appointanother lawyer for him to help shoulder some of the load."
flagyl 250 mg tablets The syndicates allow one angel – typically an affluentperson who provides capital for a startup – to lead a group ofaccredited investors to back companies that list themselves onthe site as looking for cash. Accredited investors are thosewith net worth, not including their homes, of $1 million ormore. No money changes hands until a startup is selected forfunding.
pass-my-drug-test.com A Department for Business, Innovation and Skills spokesman said: "The Government takes its export responsibilities very seriously and operates one of the most rigorous arms export control regimes in the world.
sildenafil medana gdzie kupi bez recepty Maggie Morgan-Cooke, head of relationships at the NHS Institute for Innovation and Improvement, said: "Actively involving staff, patients, carers and other stakeholders, backed by visible executive support from a nominated board member and steering group, will help embed the cultural change that is needed to sustain improvement."
I'd like to apply for this job coopers pharmacy vass north carolina If you're searching for the magical elixir to cure a hangover, Chinese researchers may have found it. The solution: lemon-lime flavored soda Sprite. But if you prefer to skip the sweet stuff, soda water is a good alternative, findings showed.
what is the generic name for celebrex The Ad Age report suggests to me a back story – that theadvertising people (from Google, Yahoo, and other industryleaders) were really only going through the motions, and neverwould have agreed to the kind of strong protections againsttracking that the privacy advocates have insisted on. Rather,they've been stringing the privacy people along by pledging avoluntary solution, hoping to avert an all-out push for strongregulation.
acheter-levitra.com The fashion house, whose glittering gowns are worn by stars such as Lady Gaga and Madonna, is seeking to strengthen its balance sheet to help fund expansion in overseas markets such as Asia before a possible listing further down the road.
cheeba chews high cbd review Tiger starters entered with a 1.00 ERA in the series, but Sanchez allowed three runs in the second inning alone, though one was unearned. He went six innings and gave up four runs (three earned) and nine hits.
viagra price in malaysia The researchers estimated that around 664,000 people had dementia in the UK in 1991. Based on these findings, and taking into account that people are living longer, the researchers estimated that around 884,000 people would have dementia in 2011, or around 8 in every 100 people aged 65 and older.
I'm only getting an answering machine price of testosterone cypionate in india "Investors should take the Silver Lake-Michael Dell bid andrun for the hills," said Brian Marshall, analyst with ISI Group.He said the company may end up underperforming his earningsforecast of 26 cents per share on revenue of $14.3 billion.
garden state pharmacy owners association GTAV's lead writer Dan Houser has said that this game's story "needed to be masculine", which is, of course, his and Rockstar's prerogative. One of the wonderful things about modern video games is that new stories can be told through downloadable content. Now their masculine story has been told, Rockstar has the chance to take a fresh look at Los Santos through a woman's eyes. I hope they take it.
motilium generic The three rented South of France villas that the former Kazakh energy minister hopped between last week as he tried to evade arrest in connection with the £12bn collapse of Kazakhstan's BTA Bank cost an average of £8,000 to hire per week.
roidszone.com review "Michael told me all the time this is a great club, with great people in this club, like a big family," said Schurrle. "He told me if I had to change then I had to do this move to Chelsea. Everybody knows that Jose Mourinho is really good for the players. That's what Michael told me. He convinced me that he could make me a better player.
healthyheartsclub.com The U.S. Federal Aviation Administration instructed airlineson Thursday to remove or inspect Honeywell fixed emergencybeacons in the model which caught fire, the 787, but has not sofar widened its mandatory checks to other models.
Do you know each other? uat1.health.money2.com 'But what I can assure you, that all the measures that we have taken already or which we are contemplating, one of the basic objectives of our inclusive growth is empowerment. Empowerment of weaker sections, empowerment of women. In our local bodies, more than 3 million elected local representative participate in the decision making. Right now when I am talking to you,more than 1.2 million women chiefs of these local bodies are exercising their authority!"
ednorxmedshop.com Lavrov and Fabius agreed that there should be a renewed push for a political solution in Syria. Lavrov also thanked France for supporting a U.S.-Russian deal which calls for Syria to account fully for its chemical weapons within a week and for the removal and destruction of the entire arsenal by mid-2014.
thedoctorstv.com cyst removal uncut Separately, a legal Kurdish political grouping on Wednesday called on the justice ministry to send to Imrali island an independent committee of doctors to assess the health of Ocalan, who has long suffered from an eye ailment.
anavar only cycle results Between playdates, school deadlines, work and getting dinner on the table, it's easy to lose track of something like vaccination schedules. This app does all the remembering for you, creating a comprehensive and customizable schedule of all vaccinations through age 7, as recommended by the World Health Organization. 99 cents at iTunes App Store.
truehealthnm.com Covered California also experienced heavy call volume in the first five days, with 59,003 calls. Average wait time for those calls was just over 15 minutes, although the exchange said that was reduced to less than four minutes by Friday, Oct. 4. Â Mr. Lee said the eventual goal is to lower the average wait time significantly, to ideally around 30 seconds.
Delmer says:
I sing in a choir cost of prescription drugs in us vs other countries Eliquis, which was approved in December to prevent strokescaused by an irregular heartbeat called atrial fibrillation,posted sales of $41 million. Analysts said that was adisappointing showing for a drug expected to eventually claimannual sales of $5 billion or more.
price for maxoderm The deadline for applying for Royal Mail shares may have passed at midnight but the postal service is still on the agenda. Business Secretary Vince Cable will be talking to a committee of MPs about the flotation this afternoon.
hersolution coupon code Mieses' wife, Dayana Mieses, told The News her husband is in a medically induced coma at St. Luke's-Roosevelt Hospital Center. She said her husband was trying to help Cruz, who was knocked off his bike, when Lien punched the gas and ran him over.
resep masakan chef arjuna Since Carly, Sam and their friends have proven teenagers don't need adults, Carly starts a business where parents who are sick of their teenage kids and teenage kids who are sick of their parents can sign up to live in total separation in iCarly world. An hour later her company is more valuable than Apple.
trust-pharm.net review Sheriff's officials referred to Brett Anderson, who arrived from out of town to talk to investigators Tuesday, as her ex-husband, but he told The Associated Press that the couple had still been married.
Garland says:
I'm doing a phd in chemistry can amoxicillin and clavulanate potassium treat tooth infection The move follows reports a Chinese flight attendant died after receiving a massive shock when she answered her charging iPhone 5. News stories differed over whether she was using a cloned charger or an official Apple product.
red leaf medical stock Our correspondent in Athens, Fay Doulgkeri, who spent some time with the charity 'Smile of the Child' said: "The phones in the operational centre of the charity haven't stopped ringing. Thousands of people from Greece and abroad have been calling to help in any way they can, in the ongoing police searches for the child's parents."
pharmabooks editora Woodcock said she has begun giving certain people within theFDA more responsibility but some say it is has been hard fortalent to rise easily to the top. For example, a 2006 report bythe Institute of Medicine described a work environment at theCenter for Drug Evaluation and Research "that is notsufficiently supportive of staff."
inner armour mtor bcaa stack review Custer County Sheriff Bruce Peoples was quoted on Tuesday by local media as saying the second vehicle may date back to a cold case from the early 1960s. In that case, a car with two or three unidentified people was last seen in Canute, Oklahoma, about 14 miles south of Foss Lake. But the missing persons database has no records before 1969 for Canute.
buy maxidus canada Al Qaeda blamed Israel for the attack in the Egyptian Sinai near Gaza, where there has been a decade of fighting between Palestinians and Israelis. Israel dismissed reports of its responsibility and said it respected Egypt's sovereignty.
I can't get a dialling tone goochland pharmacy Forstmann Little acquired the company in 2004. In May itbegan working with Morgan Stanley and Evercore Partners to finda buyer for the agency that represents sports stars such asquarterback Peyton Manning and tennis champion Venus Williams.
pharma buy clane "I did stop breathing," he insists. (Yes, that's what we remember seeing.) His return required more than fancy off-screen CPR, but Hill's whisper of "he can never know!" behind his back tables the discussion.
muse clinic hcmc Moretz has graduated from bloody knuckles to being doused in fake blood as the lead in the upcoming remake of the horror classic "Carrie." She already has credits like 2009's "(500) Days of Summer," 2010's "Let Me In" and last year's "Dark Shadows" under her belt.
amoxicillin 500 mg dosage sinus infection Some see this as a now-or-never opportunity for overduechange. Long a critic of trade union practices and state waste,Mitsotakis is clearly bent on reform, but whether he can succeedwhere others before him have failed remains to be seen.
dennyhealth.com The Independent, which tries – when possible – not to report on the Royal Family, acknowledged the arrival of the new baby with the headline: "Special delivery Duchess gives birth to a prince – and a media feeding frenzy begins."
Have you got a telephone directory? prosolution gel real reviews Overseas media, including the South China Morning Post, had said Zhou was being investigated for corruption. Sources told Reuters last month he was helping in a graft probe, rather than being targeted himself.
thyroid t3 normal range Mobile phone providers could make life easier for customers by implementing a number of minor changes, such as a cap on bills run up by thieves or monitoring of unusual behaviour on a mobile phone account. The Government is currently in discussion with the industry.
olanzapine dose for depression More moments of silence came at 9:37 a.m. (1337 GMT), when American Airlines Flight 77 hit the Pentagon; at 9:59 a.m. (1359 GMT) when the South Tower collapsed; at 10:03 a.m. (1403 GMT) when United Flight 93 hit the ground near Shanksville, Pennsylvania; and at 10:28 a.m. (1428 GMT), when the North Tower fell.
stendra pills for sale Police documents also allege "Ferrante did not want an autopsy performed" and instructed that Klein's body be cremated. Despite those instructions, police say, an autopsy was performed and revealed the cause of death as "cyanide poisoning."
imodium lloyds pharmacy The former school bus driver was accused of the aggravated murder of a fetus after forcibly causing an abortion in one of his victims that he is accused of impregnating. That charge would have carried the death penalty had he been convicted.
I'm doing an internship herculin extreme side effects He applied to switch his major from mathematics to computer science, but the authorities forbade it. "That is what tipped me to accept the idea that perhaps Russia is not the best place for me," he says. "When they wouldn't allow me to study computer science."
can you take ibuprofen 800 mg with tylenol 3 Your post is very timely for me, as I am about to read an economics textbook for the first time in 40 years. (I have chosen Mankiw's Macroeconomics. I am not going to take a class because I think I am too old for that sort of thing.)
cijena panadola Becerra called website problems disturbing, but said, "I think it's even more disturbing when individuals intentionally work against the American people and the rights that they have now secured to access quality, affordable healthcare."
drugs having zero order kinetics "Thinking back to December 2012 when the fiscal cliff wasfast approaching, investor confidence was repeatedly batteredfollowing a series of meetings that failed to hammer a positiveoutcome. Bottom line, we'll believe it when we see it."
http //www.indianpharmaonline.com review Richard Calvocoressi, co-curator and director of the Henry Moore Foundation at his former estate in Hertfordshire, said Moore and Bacon had both continued to depict the human body at a time when the trend in art was towards greater levels of abstraction.
Until August si-logi.com For months, BART management and employee unions have been atodds over pay and benefits for union workers who are demandinglarge pay raises, in part to offset being asked to contribute totheir pensions and pay more for healthcare.
generico do trental 400 "I got so many kids that look up to me, as a role model, to look at me as a hero, as a superhero, even as a father and brother at times, I got a responsibility to hold up," James said, when asked if two titles were enough. "I got the talent, and I'm gonna take full advantage of it. The championships are all great, but I'm playing for more than that. I got a bigger calling than that."
amoxicillin 500 mg yellow capsule The chef's uncompromising insistence on using only the highest quality ingredients and his deep respect for Catalan regional produce soon led to greater recognition which saw him earn and maintain an almost unattainable Michelin three-star status from 1994 to 2011, continuously.
mefenamic acid cvs HHS said the average price was 16 percent lower than its ownprojections on premiums. In addition, consumers who earn up to400 percent of the federal poverty level, or $62,040 for acouple, will qualify for subsidies that will lower the pricefurther.
maui clinic pharmacy hours The complaint, which denounces U.S. spying methods revealedby former intelligence contractor Edward Snowden, is filedagainst "persons unknown" but names Microsoft, Yahoo, Google, Paltalk, Facebook, AOL and Apple as "potential accomplices" of the NSA andFBI.
Augustus says:
I was born in Australia but grew up in England prostanol People who take cocaine over many years without becoming addicted have a brain structure which is significantly different from those individuals who developed cocaine-dependence, researchers have discovered. New research …
lamisil cream price uk The giant AC72 weighs just 13,000 pounds (6.5 tons, orroughly the weight of two average sedans), thanks to the highstrength-to-weight ratio of carbon fiber. The boats are liftedout of the water each night, and the wings are removed fortuning, storage and to remove cameras.
buy catuaba bark China Oilfield Services Ltd jumped 5.9percent in Shanghai and reached a five-year high in Hong Kongwith a 1.6 percent gain there after the company on Monday posteda 33 percent increase in first-half net profit.
tocaremedical.com For college students with autism and other learning disabilities, this is the kind of balancing act that takes place every day — accommodating a disability while also pushing beyond it toward normalcy and a degree, which is increasingly essential for finding a meaningful career.
savse smoothies "I never ran a day in my life until I joined the program," said Adel, 39, who began running in March. "It was pretty hard for me at the beginning. I actually wanted to quit. But then I started to push myself."
Erasmo says:
What sort of work do you do? cost cialis walmart pharmacy "The only goal … is to set the conditions for the handoverof power and to ensure justice through prosecutions of everyonewho has committed war crimes against our people," Ahmed Jarba,president of the opposition coalition, said on Monday.
fluoxetine hcl 40 mg for dogs As much as all of this sounds like a recipe for one of those upbeat, earnest, we've-got-to-help-the-children sagas, that's not really what the filmmaker has cooked up. Having worked in a facility of this sort, Cretton pretty effortlessly makes the ambiance persuasive, the conflicts convincing, the teens vibrant and real. He's actually making a second pass at the material, his short film of the same title having won a jury prize at Sundance in 2009. What's striking here is that he takes us inside the heads of the counselors, weaving their doubts and conflicts with those of their charges to create a complex, welcome-to-the-asylum, the-inmates-are-in-charge style portrait of institutional life.
penegra 50 mg dosage Should kids play sports? Yes, of course. Including football. No sport is without risks. Softball, soccer, cross-country, volleyball and others invite all manner of sprains, injuries, dodgy knees and bruising contact. I think players deflecting a soccer ball on the fly with their heads is crazy.
trending styles for guys Only nine players in the field of 153 ended the round under par after 36 holes, among them overnight co-leader Kenny Perry who followed his opening 67 with a 73 to sit joint 10th, with Fred Couples (69) and Tom Watson (70) among others.
edex injection reviews The royal salutes by the cannons are typical for royal anniversaries with the most ever fired of 124 shots being when the Queen's birthday coincides with the Duke of Edinburgh's birthday in June, combining two 62-shot rounds.
I'm unemployed nexium control uk advert song Slabs of Italian marble used in the bathrooms can be picked up for inspection. A plank of the Siberian oak floor — baked eight times, then treated with a wire brush to withstand even the sharpest stiletto — is set along a wall.
liv.52 kaufen in der schweiz Not surprisingly, it underscores the need for newantibiotics, citing ever-slowing development efforts bypharmaceutical companies due to the high cost of such programsand relatively low profit margins of the drugs.
venlafaxine price uk It says that "contrary to defendants' unfounded, subjective (and incorrect) belief," hoisting the Gadsden flag was not meant to support the tea party. It was meant "to honor the veterans who have served and died for our country under the rattlesnake image and the words 'Don't Tread on Me' since the American Revolution," the lawsuit says.
cheapest pharmacy to get vyvanse "With the exception of the Insight transaction and some smaller deals, we've generally concluded that the better value creation opportunity was in buying back our own shares," said Marcus. "The same principles will continue to guide us."
fetalmed.net curitiba – pr All of this would follow immediately after President Obama's trip to Africa that fellow staff photographer Jason Reed and I were assigned to. While looking forward to the Gettysburg assignment, Africa (three countries in seven days with numerous events and time zones) would have to come first. And the temperatures experienced in Africa would break me in for the sweltering heat and humidity of 12 hour days in Pennsylvania. Not quite….
I never went to university leigh pharmacy kingsbury Labour leader Ed Miliband has said that if he wins the general election in 2015, Labour would introduce an Immigration bill to make larger employers take on an apprentice for every skilled foreign worker they employed from outside the European Union.
Who's calling? rubber wonderbroom British expat and stay-at-home mum Jessica Foster has two children at an international school in Singapore. She said: "We are lucky in that we kept our flat in London and rent it out. But we are unlucky as the pound has weakened which means less money is coming across."
I can't stand football light blue viagra In her instruction to the jury, Judge Debra Nelson wrote that "to convict of manslaughter by act, it is not necessary for the State to prove that George Zimmerman had an intent to cause death, only an intent to commit an act that was not merely negligent, justified, or excusable and which caused death."
Shelton says:
I'm not sure cost trends in health benefits for ontario Paulina Gretzky sure knows how to grab attention. The 24-year-old daughter of hockey legend Wayne Gretzky showed off her slim bikini bod while in Barbados with her pro-golfer beau Dustin Johnson on June 26, 2013. Not only did the singer/model flaunt her phenomenal figure in a red two-piece, she also snapped pictures with a new furry friend.
I'm in my first year at university antibiotic ciprofloxacin hcl It had also warned that in India – against strong international health warnings – many pesticide containers are not thrown away after use but recycled and used for storing water, food and other consumables.
very best job japan4health.com Reid moved ahead last week with plans to confirm Cordray, three nominees to the National Labor Relations Board and President Obama's picks to lead the Labor Department, U.S. Export-Import Bank and Environmental Protection Agency.
Darell says:
I'll text you later mediglobe.rf.gd "We're confident he will eventually be cleared of all wrongdoing," he told Reuters in New York before the indictment. "He's in France only because he moved there several months ago, not because he was fleeing anything."
Heyjew says:
Could I order a new chequebook, please? endowmax no brasil The financing values San Francisco-based Uber at about $3.5billion, according to a person familiar with the matter, whodeclined to be named because the valuation wasn't disclosed.Uber announced the funding on its blog.
Could I have a statement, please? motrin bodybuilding "He'll be remembered for calming the city after a racially turbulent time, [but] this indicates you can't avoid the issue entirely," said Ken Sherrill, professor emeritus at Hunter College. "This is a policy that did not have racially neutral effects."
Cornelius says:
I've got a full-time job all-medications.biz review Singapore trade agency International Enterprise (IE) opened an office in Yangon last year to help companies from the city-state invest in the country. Singapore is Myanmar's third-largest trading partner, with trade between the two countries reaching S$1.8 billion ($1.44 billion) in 2012.
Ernie says:
I went to generic and brand name of drugs She probably won't win an Oscar anytime soon, but Lindsay Lohan could certainly win the top prize for the most stints at rehab in the shortest amount of time. Following her fifth trip to jail, Lindsay Lohan embarks upon her sixth trip to rehab. The actress was to rehab on Oct. 22 through Jan. 2, 2011, but this is by no means her first time getting help.
Demarcus says:
A First Class stamp inner armour mtor bcaa stack review There are six players left from that team and six new ones have come in including 6-6 senior J.J. Moore, a senior from Long Island who transferred from Pittsburgh. "I feel for what these guys went through. Some of them said that when there was no coach and no AD, they couldn't even get into the gym here to practice," he said. "But I also see something in them for coming through it. Everyone here is trying to put it all behind this program. Everyone wants to go forward strong."
I'd like to change some money kamagra gold 100 elado For example, at present, residential solar generation costsare below utility tariff rates in many European countries, butpeak solar generation does not coincide with peak electricitydemand, meaning households still depend on incentives to selltheir surplus electricity to the grid.
Lioncool says:
I'll call back later ibuprofen 400 mg ingredients Churches would have to "opt-in" to conduct gay marriages under Marriage and Civil Partnership (Scotland) Bill. But concerns have been raised that the change would open the door to a human rights challenge against churches or individual minsters and priests which refuse to marry same sex couples.
real beauty page nuclear pharmacist jobs california With the Jets already trailing the Patriots, 14-0, in the second half, Mark Sanchez dropped back to pass, then started scrambling. He didn't get far, as he ran head-first into Moore's buttocks, fumbling the ball. New England's Steve Gregory picked it up and ran it in for a 32-yard touchdown.
I'm originally from Dublin but now live in Edinburgh terraminds singapore Sarah Jessica Parker wasn't always so glamorous – in fact, she was known for her roles as a geeky teenager on the show "Square Pegs" and in the movie "Girls Just Want to Have Fun." Today, Parker's fashion sense has helped make her "Sex and the City" character Carrie Bradshaw a household name.
An accountancy practice simvastatin ratiopharm 40 mg preis "We need to go trough this process of determining value," he said. "(VEBA) have been very clear that they are not long-term holders of the assets. They want to monetize so we need to find a way that … does not create what I consider to be exceptionally high or abnormal expectations of value."
Snoopy says:
What's your number? apex vitality serum of youth reviews "While competition online is thriving, we've made the difficult decision to agree to [the Commission's] requirements in the interests of reaching a settlement," Google general counsel Kent Walker said.
What sort of music do you listen to? hydroxycut price at walgreens "The proposed regulatory system will not only unnecessarily delay by three years patient access to the latest lifesaving medical technology, but also deliver a devastating financial blow to Europe's 25,000 small and medium-sized device makers," EU trade group Eucomed said in a statement.
real beauty page cw hemp discount code Otto is also working with data analysis firm Blue Yonder, which has found that customers are less likely to return a garment the more online pictures they can see of it while ordering. It has also found companies can cut returns by making customers aware of the environmental impact – from transport to packaging – of ordering multiple sizes in the same item, a habit adopted by many shoppers who prefer to try several sizes at home before buying just one.
I'd like to withdraw $100, please pure testo xplode and black label no men 39s health "With the recovery still proceeding at only a moderate pace, the economy remains vulnerable to unanticipated shocks, including the possibility that global economic growth may be slower than currently anticipated," Bernanke said.
I'd like to cancel this standing order mail.unimedgoiania.coop.br The Kremlin has watched with alarm at frequent outbreaks of violence in Russian cities between members of the Slavic majority and people with roots in the mostly Muslim North Caucasus, ex-Soviet South Caucasus states and Central Asia.
Foster says:
How do you do? cialis 5 mg ile 20 mg arasndaki fark Now that all this is unfolding, the GOP's tactics have become crystal clear. What the GOP has been doing by playing opossum is selling the Democrats the rope that would be used to hang them. The GOP has allows the Democrats to become inseparable from the climate change issue, they have made the Democrats own this issue, all the while knowing that the data supporting this "science" was melting faster than an ice cube on a Solyndra solar panel.
What do you do for a living? canadian-pharmacy-center.com As Wiggins recovers former glories, showing strong form ahead of the Road World Championships time-trial next Wednesday, the race also showed Britain has a bright future in Yates, who in February won the points race world title on the track.
Incorrect PIN nottingham pharmacy interview student room ZTE, China's second-biggest phone-equipment maker, may beactive. China will issue the 4G license before the end of thisyear, the Shanghai Securities News reported, citing Miao Wei,minister of the Ministry of Industry and Information Technology.
Who's calling? anabolic running reddit Afterwards, he said: "Everyone was cheering and we definitely let everyone know that it gets redder," he said. "I just want to thank all my fellow gingers who took the time to attend today's inaugural Ginger Pride event.
A few months erythromycin ophthalmic ointment usp directions With the world's biggest fleet of Dreamliners and the firstto fly the innovative carbon composite plane, ANA has been mostaffected by delays and the aircraft's grounding this yearresulting in millions of dollars of losses.
I'd like to take the job generic prednisone name Responding Sunday, Paul said King and Christie are "precisely the same people who are unwilling to cut the spending" while saying "'Gimme, gimme, gimme – give me all my Sandy money now.'"
I'm not interested in football biohackingsupplements.com Mr Travis, who was charged under his real name, David Patrick Griffin, was first arrested last November by officers from Operation Yewtree, Scotland Yard's investigation into allegations of historical sexual abuse.
Jarrett says:
A Second Class stamp diltiazem hcl yahoo answers 4. Late, illegible, inaudible, incomplete, defaced or corrupt entries or entries sent through agencies and third parties will not be accepted. No responsibility can be accepted for lost entries and proof of despatch will not be accepted as proof of receipt. The winners will be drawn at random from all entries received by the closing date. The winners' names and counties can be obtained by sending a sae to Sainsbury's Anniversary Games Winners, Telegraph Create Department, 111 Buckingham Palace Road, London SW1W 0DT within one month of the closing date.
I saw your advert in the paper super dmz 2.0 review 2013 Sales of its make-or-break new line of smartphones came in well below some analysts' expectations. The results offered little evidence that the company could quickly win back market share from Apple Inc's iPhone as well as Samsung Electronics Co Ltd's Galaxy devices and other phones powered by Google Inc's Android operating system.
International directory enquiries iscmediplex.com The company's most recent buy was more traditional hardware – in September it acquired the firedoors business of Polish-based Mercor to give it access to growing markets in Poland, the Czech Republic and Slovakia.
energizer lithium aaa cena MEXICO CITY/LONDON, Aug 9 (Reuters) – Mexican billionaireCarlos Slim's America Movil has made a 7.2 billion euro($9.6 billion) bid for the 70 percent of Dutch telecoms groupKPN it does not own, challenging an arch-rival'sattempt to buy KPN's German business.
alpha jym before and after Mollie King looks great here, having teamed hers with a simple pair of shorts and a white tee. For a more season-savvy approach however, consider using yours to rock up a pair of black skinnies, or simply head out on the town with it slung over your shoulders. Whatever look you choose, a leather jacket is guaranteed to make it.
nacptpharmacollege.com Snowden has not overtly threatened to release more damaging documents, though a journalist with whom he has been working, Glenn Greenwald, has said that blueprints detailing how the NSA operates would be made public if something should happen to Snowden.
farmaciadelucia.net The White House on Friday reiterated Obama's position that he did not intend to put "boots on the ground" in Syria, and an administration official said Thursday's meeting also steered clear of the idea of enforcing a "no-fly" zone there.
Which year are you in? ladyboss challenge reviews He told Learning World: "What we do know is that the countries which do best in the international tests of achievement, countries like Finland for instance, have very low levels of homework. Countries that have very high levels of homework tend to do less well in the tests of international achievement and there is now very clear evidence from German research that spending more time on homework leads to lower achievement outcomes."
moduretic compra online Mr D'Oyly said supermarkets are taking steps to counter the efforts of bargain hunters, as well as the more serious fraudsters. Valassis checks coupons ahead of their release for errors and advises supermarkets on how to make their coupons difficult to copy. "Making sure the right checks are in place at the point of sale would be a big step forward," he said.
medsne.org Swift revenge for Federer's Wimbledon triumph last summer came in the Olympic final, but if a gold medal is something to treasure, it is not the same as beating the champion of champions in one of the four tournaments that matter most.
thomas jefferson pharmacy walnut street The researchers suspect that diesel pollution may be yet another factor playing into colony collapse disorder, and that these new findings should provide further impetus to reduce diesel emissions, said study co-author Guy Poppy.
liberate medical
It was thought that savings rates had hit a floor in the summer of 2012. Bank of England figures showed that the average new easy-access rate with a bonus was 1.53pc. By contrast, the equivalent easy-access account without a bonus paid just 0.48pc. This suggested that rates were being held up by banks that used temporary bonuses to attract savers.
A law firm aspirinas pirkti The trust received the holding as part of Chrysler's government-backed bankruptcy in 2009. Although Fiat already has the right to buy the stake for around $6 billion, Marchionne has said that he's seeking to pay much less.
amino xl The Holocaust almost eliminated Poland's Jewish community, Europe's biggest before World War Two broke out in 1939. Nazi concentration camps including Auschwitz and Treblinka were located on Polish soil.
how to take tamoxifen citrate liquid "He deserves to be the guy going out there, and I think (Lackey) is right behind him. I think that the way that things are shaking out to set up, they're the right way," he added. "The Boston Red Sox have a way of doing things right."
highest wellbutrin mgs5 An official US report into the incident released last month described how Taliban fighters dressed in American uniforms walked past an unmanned watchtower onto the airfield and opened fire with machine guns and rocket-propelled grenades.
trend micro support contact email The judge approved the city's offer to pay costs associated with the retiree committee's work. And Edward McNeil, the lead negotiator for a coalition of 33 of Detroit's 48 labor unions, told Reuters the union expects the city's funding to cover the cost of an independent actuarial study of the city's unfunded pension liability.
I'm doing a phd in chemistry xdoctor.eu The latest financial results are sure to add to the criticism that the firm is boosting profits at the expense of hardpressed UK households who have just suffered the longest winter since the 1960's.
affordable pharmacy services nashville tn LT D'Brickashaw Ferguson was fined $15,000 by the league for his role in the fight at the end of the Jets-Patriots game on Thursday, according to a source. Ferguson was ejected from the game following the fight.
amlodipine besylate 10 mg pill Though Sanchez is taking a non-surgical route at the moment, surgery could be an option down the road. Sanchez would not address his injury or his comments on Thursday beyond addressing a report on Wednesday that said he was likely to have surgery.
family of the year hero tabs guitar The Mall of America, the nation's largest shopping mall, is in Minnesota — also home to the nation's largest Somali population. It was a Somali militant group, al-Shabab, that masterminded the mall assault in Kenya, and the group recruits in the state.
viagra cheap coupon "Eddie on camera is the same off-camera,†| {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 7,662 |
Carriera
Club
Dopo essere cresciuto nella florida cantera dell'Athletic Bilbao, debutta in Primera División spagnola nella stagione 1939-1940, nella partita Athletic Bilbao- (1-3) del 3 dicembre 1939.
Con i Rojiblancos trascorre dodici stagioni, in cui colleziona 247 presenze e vince un campionato e tre Coppe del Re.
Conclude la carriera nel 1950 senza mai aver cambiato squadra.
Nazionale
Conta due presenza con la Nazionale di calcio della Spagna. Il suo debutto risale al 26 gennaio 1947 in Portogallo-Spagna (4-1).
Palmarès
Competizioni nazionali
Athletic Bilbao: 1943, 1944, 1945
Athletic Bilbao: 1942-1943
Collegamenti esterni
Calciatori della Nazionale spagnola | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 7,818 |
package com.sshtools.forker.client.impl.jna.win32;
import com.sun.jna.platform.win32.WinNT.HANDLE;
/**
* TODO
*/
public class WindowsAuthenticationTokens {
HANDLE hProfile;
HANDLE hToken;
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 8,773 |
Happy Birthday Jesus Mylar Balloons is rated 3.5 out of 5 by 4.
Rated 5 out of 5 by Jesusson from Love the balloons The Dollar store wouldn't blow them up for me but Kroger did for free! Blew them up 6 days ago and no sign of deflating yet. So glad I found these happy birthday Jesus balloons in your catalog because none of my local stores carry them. Thanks so much! Great product!
Rated 5 out of 5 by Mamaandteachoflittles from Very pleased Vibrant colors, excellent condition, blew up fine and lasted a week.
Rated 1 out of 5 by Roscoeblue from Poor quality Of the nine balloons I ordered, 3 had faulty stems so no air could be put in them, and 2 went flat in 30 min.
Rated 3 out of 5 by GayleJune from Hard to inflate I took these to a local floral department to have them inflated with helium. They broke one and two others wouldn't seal well. They made it through the party, but did not last.
Do these balloons have a history of leaking helium? I need to have them filled the day before the event.
I didn't experience that. I filled ours the day before and they were fine. They even lasted a week. | {
"redpajama_set_name": "RedPajamaC4"
} | 1,737 |
Jerry Hammer
Jerald Allen Hammer was born on March 31, 1945, in Granite Falls, the son of Marvin and Hazel (Bottcher) Hammer. He was baptized and confirmed in his faith at St. Paul Lutheran Church. Jerry grew up in Granite Falls and graduated in 1963 from Granite Falls High School and was the Vice President of his senior class. He continued his education at Mankato State University and South Dakota State University. Jerry was united in marriage on March 18, 1967 to Nancy Johnson at Our Savior's Lutheran Church in Montevideo. Jerry and Nancy made their home in Granite Falls and were blessed with three children, Angela, Tracy and Brett. Jerry and his brother Merle, worked together in the family business started by their father, Marvin. "Hammers" was a plumbing, heating, air conditioning and refrigeration business. He drove school bus for Granite Falls and enjoyed driving truck, hauling many loads. He enjoyed serving the community and was on the Granite Falls Rescue Squad for 31 years and served as the captain for several years. Jerry was a Firearms Safety Instructor for over 40 years. He was also a member of Duck's Unlimited. Jerry loved hunting, fishing, camping and farming. He spent many days in the woods with his family, cutting wood for the winter months. Jerry could fix most anything that needed attention and was very skilled in mechanical things. If you ever met Jerry, you wouldn't forget him. He never met a stranger and he had a story to share with everyone he would meet. Jerry is survived by his wife, Nancy of Granite Falls; children, Angela (John Grimes) Hammer of Seward, Alaska, Tracy (Mike Kontz) Hammer of Granite Falls, Brett (Diana) Hammer of Granite Falls; grandchildren, Coty (Jean) Beck, Shelah (Steven Adkins) Grimes, Dylan (Marissa Amor-Hegna) Beck, Kylie Grimes, Ethan Kontz, Keaunna (Jeremy) Oaks, Cherish Hammer, Brayton Hammer; great grandchildren, Landen Beck, Layken Beck, Lawsen Beck, Jaxson Grimes, Jude Beck; sister, Jean Schultz of Montevideo; sisters-in-law, Becky (Tony) Nelson-Quinata of Helendale, California, Mary Hammer of Granite Falls, DeLisa Johnson of North Augusta, South Carolina; as well as nieces, nephews and many dear friends. Jerry is preceded in death by his parents, Marvin and Hazel Hammer; step-father, Monroe Rachie; grandson, Joel Grimes; brother, Merle Hammer; brothers-in-law, Floyd Schultz, Gary Johnson.
Jerald Allen Hammer was born on March 31, 1945, in Granite Falls, the son of Marvin and Hazel (Bottcher) Hammer. He was baptized and confirmed in his faith at St. Paul Lutheran Church. Jerry grew up in Granite Falls and graduated in 1963 from... View Obituary & Service Information
The family of Jerry Hammer created this Life Tributes page to make it easy to share your memories.
Jerald Allen Hammer was born on March 31, 1945, in Granite Falls,...
Send flowers to the Hammer family. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,522 |
\section{Introduction}\label{sect:intro}
The advent of wide-field surveys on the one hand, and deep pencil-beam
observation of selected blank fields on the other, have produced,
in recent years, extensive
multi-wavelength photometric information for very large numbers of galaxies.
Optical and near-infrared (NIR) surveys such as the Sloan Digital Sky Survey \citep[SDSS,][]{york2000}, the
Two Degree Field survey \citep{colless1999}, the Two Micron All Sky Survey
\citep[2MASS,][]{kleinmann1994}, the Cosmic Evolution Survey \citep[COSMOS,][]{scoville2007}, the Great Observatories
Origins Deep Survey (GOODS, Dickinson et al. \citeyear{dickinson2001}),
the All-wavelength Extended Groth Strip International Survey \citep[Aegis,][]{davis2007} survey, the
\textit{Spitzer} Wide-Area Infrared Extragalactic (SWIRE) Legacy
survey \citep{lonsdale2003,lonsdale2004}, among many others,
include now millions of galaxies spanning across all epochs, to $z>4$
in the deepest cases, and covering the whole electromagnetic spectrum from
X-rays to radio wavelengths.
At long wavelengths, extragalactic surveys with the
Infrared Astronomical Satellite \citep[IRAS,][]{neugebauer1984},
Infrared Space Observatory \citep[ISO, e.g. ELAIS,][]{rowanrobinson2004},
\textit{Spitzer} \citep[e.g.][Dickinson et al. 2001]{frayer2009,lefloch2009,magnelli2009,lonsdale2003,lonsdale2004}
and AKARI \citep[e.g.][]{matsuura2009,matsuhara2006}
revealed the mid- and far-infrared (MIR, FIR) counterparts of local galaxies first, and
of several thousands of distant sources up to $z\sim3$ in the latest incarnation
of 80-cm class IR space telescopes.
While detailed spectroscopic studies are still very demanding in terms
of observing time, and include a relatively limited number of sources,
especially at $z>1.0-1.5$ and at the faint end of the luminosity function,
a variety of techniques has been developed to extract the wealth of information
stored in photometric data.
Fitting the broad band spectral energy distribution (SED) of each source by
adopting a library of galaxy templates can provide a classification, together with
an estimate of luminosity (in the desired bands), stellar mass
and other possible parameters. However, success depends
on the predefined templates being representative of the galaxies
under consideration.
Basic approaches to SED fitting follow different paths, depending
on goals and wavelength coverage. Evolutionary and mixed
stellar population synthesis, including global or age-selective
extinction corrections, has proven to be very successful
in the optical and near-infrared
\citep[e.g.][]{bruzual2003,poggianti2001,bressan1994,renzini1986}
to study galaxy properties such as stellar mass, star formation rate and history,
and has been sometimes extended to longer wavelengths by means of energy balance
arguments \citep[e.g.][]{dacunha2008,berta2004}. Modeling
from the ultraviolet (UV) to FIR, making use of radiative transfer and ray
tracing techniques \citep[e.g.][]{siebenmorgen2007,piovan2006,dopita2005,efstathiou2000,silva1998},
provides extensive information on the physical properties of
star-forming regions, molecular clouds, and the diffuse dust component, as
well as of stellar populations. Finally semi-empirical libraries
(e.g. Polletta et al. \citeyear{polletta2007}; Kirkpatrick et al.
\citeyear{kirkpatrick2012}; and this work) offer flexible
templates to be compared in a fast manner to large observed catalogs
for quick classification and derivation of basic properties.
The semi-empirical library built by \citet{polletta2007} spans from the UV to submm,
and covers a wide range of spectral types, from elliptical galaxies to
spirals and irregulars, and includes templates of
prototype starbursts, ultra-luminous infrared galaxies (ULIRGs),
and objects with different amounts of an active galactic nucleus (AGN) power (both type-1 and type-2).
Alternatives in the infrared domain focus on
star-forming objects and are based on locally determined properties such as
the local luminosity-temperature relation, implying that a single SED shape is associated with each value of $L(\textnormal{IR})$
\citep[e.g.][the latter two already pointing out weaknesses of this approach]{chary2001,dale2002,elbaz2010,nordon2010}.
Recent works indicate that the SED shape of infrared galaxies is
more naturally explained in relation to their distance from the
so-called ``main sequence'' of star formation (Elbaz et al. \citeyear{elbaz2011},
Nordon et al. \citeyear{nordon2012}; see also Magnelli et al., in prep.).
Defined in the $M_\ast-\textnormal{SFR}$ plane, this main sequence (MS)
represents the ``secular'' and dominant mode
of baryon transformation into stars
\citep[e.g.][]{elbaz2011,rodighiero2011,wuyts2011b,daddi2009,daddi2007a,elbaz2007},
likely supported by accretion of gas from the intergalactic medium
\citep[e.g.][and references therein]{dave2010}. In this picture, galaxies lying above
the MS would be undergoing powerful, starbursting events,
possibly triggered by major mergers.
The above-mentioned SED libraries, as well as others not listed,
have not only been employed to derive properties of
individual sources, but have also been widely used in describing
the statistical properties of galaxy populations, for example
while interpreting and modeling observed number counts
\citep[e.g.][]{berta2011,berta2010,bethermin2011b,franceschini2010}
or assessing luminosity functions at different wavelengths \citep[e.g.][]{gruppioni2013,gruppioni2010,rodighiero2010b}.
Most of the templates adopted in the literature
have actually been built using local galaxies
\citep[e.g.][]{rieke2009,polletta2007,dale2002,chary2001}, and
although they have proven to reproduce the SEDs of
high-$z$ galaxies reasonably well, their applicability can be subject to
criticism. \citet{gruppioni2010} have shown, for example,
that the observed SEDs of \textit{Herschel} detected galaxies
are in general well reproduced by the \citet{polletta2007}
library, but very bright FIR emitters, or objects
intermediate between spirals and starburst, are actually poorly
represented.
After three years of operation, the \textit{Herschel} Space Observatory \citep{pilbratt2010}
has proven to be the ultimate machine to build
detailed FIR SEDs of galaxies up to $z>3$, without being limited to
very luminous sources.
The sensitivity reached by
the Photodetector Array Camera and Spectrometer \citep[PACS,][]{poglitsch2010} and
the Spectral and Photometric Imaging REceiver \citep[SPIRE,][]{griffin2010}
instruments aboard \textit{Herschel} has guaranteed the detection not only of
the most extreme star-forming galaxies, with
star formation time scales on the order of $\sim0.1$ Gyr or less \citep[e.g.][]{magnelli2010,magnelli2012,rodighiero2011},
but also objects lying on the MS of star formation up to $z\sim2$.
In addition, the variety of \textit{Herschel} detections includes objects with MIR power-law spectra, dominated by an
AGN torus emission, but with optical stellar SEDs \citep[e.g.][]{hatziminaoglou2010}, as well as type-1 AGN.
This paper is based on \textit{Herschel} FIR observations carried out
in the framework of the PACS Evolutionary Probe \citep[PEP,][]{lutz2011} and the
\textit{Herschel} Multi-tiered Extragalactic Survey \citep[HerMES,][]{oliver2012} in three of the
most popular extragalactic ``blank fields'': GOODS-N, GOODS-S, and COSMOS (Dickinson et al. \citeyear{dickinson2001};
Scoville et al. \citeyear{scoville2007}).
Combining \textit{Herschel} and \textit{Spitzer} data, it is now possible to sample
the 8--500 $\mu$m SEDs of galaxies
with 7 to 10 bands, thus accurately probing the shape
of the dust emission peak, as well as MIR light dominated by warmer dust.
Extending to the UV, optical, and NIR, the number of bands
increases up to 43 in the most favorable case (COSMOS, including intermediate bands).
We take advantage of this rich multi-wavelength data-sets to build a new set of
semi-empirical templates, based on the observed UV to FIR photometry
of galaxies detected by \textit{Herschel} (but not only), without any restriction in
redshift.
The objects are going to be grouped on the basis of their UV-FIR restframe
colors: following the inspiring work of \citet{davoodi2006}, we model the multi-color distribution
of galaxies with a mixture of multivariate Gaussians \citep{connolly2000,nichol2001b}.
This technique is independent of the predetermined galaxy template libraries,
and provides the identification, classification, and characterization of
both existing and new object types, a compact
description of the data, and a recipe for the identification of outliers.
Each source is then classified as belonging to one of these Gaussian modes,
and a median SED is derived for all identified groups.
These SEDs are going to be fitted using a custom, modified version of {\sc magphys}
\citep{dacunha2008}, combining
stellar light, emission from dust heated by stellar populations and
a possible AGN contribution.
Our main product is a robust library of templates
which can cope with the very large scatter in observed colors of infrared galaxies
over the full UV, optical, NIR, MIR and FIR spectral range, thus
discriminating between different classes of galaxies, including AGN-harboring objects,
and other obscured sources.
This paper is structured as follows. Section \ref{sect:data} describes the available
data-sets and the simple procedure adopted to derive restframe colors; Sect. \ref{sect:FastEM}
deals with the classification scheme, based on the parametric description of
the multi-variate distribution in the chosen $N$-dimensional color space.
Interpolation of median SEDs by means of a multi-component fit is presented in
Sect. \ref{sect:sed_fit}. In Sect. \ref{sect:outliers} we use the results of
the previous decomposition of the restframe multi-color distribution to identify
outliers and very rare sources.
Finally, Sect. \ref{sect:discussion} applies the new library to the derivation of
infrared luminosities, comparing results to eight other popular methods often adopted in
the literature. The newly derived UV-to-submm templates are used to classify
MIPS 24~$\mu$m detected objects in the GOODS fields.
Throughout our analysis, we adopt a standard $\Lambda$CDM cosmology
with $H_0=71$ $[$km s$^{-1}$ Mpc$^{-1}]$, $\Omega_\textnormal{m}=0.27$, and $\Omega_\Lambda=0.73$.
\section{Building color catalogs}\label{sect:data}
The PACS Evolutionary Probe survey
(PEP\footnote{http://www.mpe.mpg.de/ir/Research/PEP/}, Lutz et al.
\citeyear{lutz2011}) observed
the most popular and widely studied extragalactic blank fields
(The Lockman Hole, EGS, ECDFS, COSMOS, GOODS-N, and GOODS-S) with the PACS \citep{poglitsch2010}
instrument aboard \textit{Herschel} \citep{pilbratt2010} at 70, 100 and 160 $\mu$m.
In parallel, the HerMES survey \citep{oliver2012} covered the same (and additional)
fields at longer wavelengths (250, 350, 500 $\mu$m) with the SPIRE instrument
\citep{griffin2010}. We first describe the multi-wavelength data-sets available
in the adopted fields, and then enter into the details of source selection,
which is mostly driven by the need to derive restframe colors of galaxies.
\subsection{Available data}
Here we exploit PEP and HerMES data in the Great Observatories Origins Deep Survey
(GOODS, Dickinson et al. \citeyear{dickinson2001}) northern and southern fields, as well as in COSMOS \citep{scoville2007}.
\textit{Herschel} data are combined with ancillary catalogs covering the electromagnetic spectrum
from UV to FIR wavelengths. Table \ref{tab:depths} summarizes
\textit{Herschel} depths reached in the three fields considered.
We defer to dedicated publications for details on reduction, map making and
simulations for PACS \citep{lutz2011,popesso2012,berta2010} and
SPIRE \citep{levenson2010,viero2012} datasets.
\textit{Herschel} photometry was performed through point spread function (PSF) fitting, adopting
\textit{Spitzer} MIPS 24 $\mu$m detected sources as positional priors.
This approach maximizes depth, optimizes deblending, and facilitates
the match of the FIR photometry to ancillary data, because
24 $\mu$m catalogs are linked to \textit{Spitzer}/IRAC (3.6 to 8.0 $\mu$m)
and then optical bands, either through
prior extraction (e.g. see Magnelli et al. \citeyear{magnelli2009} for GOODS
fields) or PSF-matching (e.g. see Berta et al. \citeyear{berta2011}).
PACS priors source extraction followed the method described by \citet{magnelli2009},
while SPIRE fluxes were obtained with the \citet{roseboom2010} recipe.
Images at all \textit{Herschel} wavelengths have undergone extractions using the same MIPS prior catalogs, i.e.
those presented by \citet{magnelli2009,magnelli2011} in the GOODS fields and
by \citet{lefloch2009} in COSMOS.
In GOODS-S we make use of the MUSIC \citep{grazian2006} photometric catalog,
with the addition of GALEX and \textit{Spitzer} IRS 16 $\mu$m \citep{teplitz2011} data,
matched to the 24--500 $\mu$m catalog via a simple closest neighbor algorithm.
Spectroscopic redshifts were collected for more than 3000 sources
\citep[see][and references therein]{berta2011}.
A PSF-matched catalog\footnote{The multi-wavelength GOODS-N catalog is available on the
PEP web page at the URL http://www.mpe.mpg.de/ir/Research/PEP/public\_data\_releases.php.} was created in GOODS-N, including
photometry from GALEX UV to \textit{Spitzer}, IRAC and MIPS 24 $\mu$m
\citep[see][for further details]{berta2011,berta2010}. This catalog includes
the collection of spectroscopic redshifts by \citet{barger2008} and
new photometric redshifts derived with the {\sc eazy} \citep{brammer2008} code.
To these, we add the \textit{Spitzer} IRS 16 $\mu$m photometry by \citet{teplitz2011}.
Finally, in COSMOS we adopt the public\footnote{http://irsa.ipac.caltech.edu/data/COSMOS/}
UV-optical catalog, including $U$ to $K$ broad and intermediate bands \citep{capak2007,ilbert2009},
combined with public spectroscopic \citep{lilly2009,trump2009} redshifts. New photometric
redshifts have been computed with {\sc eazy}, including all available
UV-optical-NIR bands up to 4.5 $\mu$m \citep[see][]{berta2011}.
We defer to \citet{lutz2011} and \citet{roseboom2010} for further details
on PACS and SPIRE catalogs, and to \citet{berta2011} and \citet{nguyen2010}
for a derivation of the respective confusion noise. A thorough
description of photometric redshifts incidence and accuracy in
the three fields considered is provided in \citet{berta2011}.
Finally, \citet{berta2011,berta2010} provide additional information about
ancillary catalogs.
\begin{table}[!ht]
\centering
\begin{tabular}{l c c c}
\hline
\hline
Band & GOODS-S & GOODS-N & COSMOS \\
\hline
24 $\mu$m & 0.02 & 0.02 & 0.045 \\
70 $\mu$m & 1.1 & -- & -- \\
100 $\mu$m & 1.2 & 3.0 & 5.0 \\
160 $\mu$m & 2.4 & 5.7 & 10.2 \\
250 $\mu$m\tablefootmark{a} & 2.6 & 2.3 & 4.8 \\
350 $\mu$m\tablefootmark{a} & 2.2 & 1.9 & 4.0 \\
500 $\mu$m\tablefootmark{a} & 3.1 & 2.7 & 5.7 \\
\hline
\end{tabular}
\tablefoot{\tablefoottext{a}{The SPIRE values refer to instrumental noise and are derived from
\citet{oliver2012}, using the deepest sections of each field and rescaling to the 3 $\sigma$
level. The 3 $\sigma$ confusion noise (after 3 $\sigma$ cut) from \citet{nguyen2010}
is 11.4, 13.8, 15.6 mJy (at 250, 350 and 500 $\mu$m).}}
\caption{MIPS and \textit{Herschel} 3 $\sigma$ depth $[$mJy$]$ reached in the three selected fields.}
\label{tab:depths}
\end{table}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.32\textwidth]{b2013f1a.eps}
\includegraphics[width=0.32\textwidth]{b2013f1b.eps}
\includegraphics[width=0.32\textwidth]{b2013f1c.eps}
\caption{Redshift distribution of GOODS-S ({\em left}), GOODS-N ({\em center}) and COSMOS ({\em right}) sources, obtained by applying single-band cuts
at local $\textnormal{S/N}=3$, and while adopting the restframe interpolation scheme described in the text. For each field, the {\em top-left} panel
includes all sources in the adopted optical-NIR catalogs, i.e. those built by \citet{grazian2006},
\citet{berta2011}, and \citet{capak2007}.}
\label{fig:selection_effects}
\end{figure*}
\subsection{Restframe colors and source selection}
We are going to group galaxies in an
$N$-dimensional color space, using a parametric, multi-dimensional technique;
here we describe the choice of bands and
colors that will be adopted in this analysis.
Avoiding restrictions in redshift space or galaxy type, we opted to apply the classification technique
to restframe colors. This approach has the
advantage of maximizing the number of available sources; moreover
a classification process in the observed frame would be dominated
by color-redshift dependences.
Adopting a library of SED templates, one could in principle
derive restframe luminosities, by integrating through the desired passbands,
but the results would depend on the models/templates adopted.
Alternative methods, such as the one described in \citet{rudnick2003},
still imply a hybrid of templates and interpolation, which
include some dependence on models and the need for a priori SED fitting.
We hence derive restframe colors by simply
interpolating between bands -- once redshift is known -- excluding any model assumption. This might
be a dangerous approximation in some wavelength ranges, where the gap
between available bands is wide (e.g. in the MIR).
To avoid this problem, the choice of restframe bands to be used
is optimized to be fully covered by observed photometry, once
redshift is taken into account.
Moreover, when performing interpolation, we impose the conditions
that no more than two adjacent observed bands around each restframe filter
miss a detection.
This approach does not strictly require a detection in each
band, but only that each restframe filter (in the range between 1400 \AA\ and 100 $\mu$m) is
bracketed by two observed bands
having detections, with any gap -- due to nondetections -- not larger than two observed bands.
This allows more sources to take
part in the grouping, but significantly complicates the selection function.
Figure \ref{fig:selection_effects} shows the redshift distribution
of sources in the three fields obtained from \textit{Herschel}, \textit{Spitzer} or GALEX
brightness cuts and
resulting from our restframe interpolation scheme. The gap around
redshift $z\simeq 1.5$ is mainly due to the combination of \textit{Herschel} (or 24 $\mu$m,
to sample MIR-FIR wavelengths) and GALEX (sampling the UV), with blue optical bands
covering the ultraviolet regime on the high redshift side.
A total of 234, 343 and 4498 sources from GOODS-N, GOODS-S and COSMOS are
included, out of 540, 782, and 22659 \textit{Herschel}-detected objects, respectively.
To fulfill the aim of grouping and defining new templates, we need to construct
a sample representative of the bulk of galaxy populations in color space.
Nevertheless, because of the requirement to cover as wide a wavelength range as possible,
the risk of missing some part of color space cannot be fully avoided.
In fact, by imposing a restframe FIR and UV coverage, over a wide range
of redshifts, we incur into losses of sources mainly due to the limited sensitivity
of \textit{Herschel} and GALEX surveys. In particular, un-obscured galaxies with
faint FIR emission might slip away from the selection, and passive galaxies
are likely poorly represented. In Sect. \ref{sect:outliers} rare objects, outliers of the
parametric grouping used to define templates, will be identified, thus partially recovering
parts of color space not sampled otherwise.
Finally, in Sect. \ref{sect:classification} we will compare the new templates --
based on the median SEDs of the selected sources -- to observed objects, regardless
of selection cuts, showing that most of the observed UV-FIR color-redshift space is effectively
covered.
\section{Parametric description of multi-color data}\label{sect:FastEM}
We describe galaxies by means of their colors,
as derived from our multi-wavelength catalogs, i.e. their position in
an $N$-dimensional color space. Our aim is to identify structures
in the $N$-dimensional distribution of galaxies, thus identifying potentially
different galaxy populations.
We assume that the $N$-dimensional color distribution function of these sources
can be reproduced as the superposition of $M$ multivariate Gaussians.
In what follows, we will refer to these Gaussian components also
as ``groups'', ``modes'' or ``classes'', without distinction.
As we are reasoning in restframe, each Gaussian mode would then represent a different
population of galaxies, and can be used to define median colors, to be later fit
with SED synthesis codes.
The $M$ components are sought using the code
by \citet{connolly2000}, further developed and distributed by
the Auton Lab\footnote{http://autonlab.org/} Team, and now called {\sc FastEM}. The code
fits the $n$ datapoints, representing our galaxies in the $N$-dimensional space,
with $M$ multivariate Gaussian distributions. {\sc FastEM} uses an expectation-minimization
algorithm for parameter estimation and a Bayesian information
criterion to decide how many components are
statistically justified by the data
\citep{connolly2000,nichol2001a,nichol2001b}, i.e. the number $M$ of
Gaussians to be used is a free parameter and is optimized
by {\sc FastEm} on the basis of the actual amount and distribution of
datapoints.
For each $j$-th Gaussian component, the code
provides its mean coordinates $\mu_j$ and an $N\times N$
covariance matrix $\Sigma_j$ describing its $N$-dimensional shape (including cross terms).
Assuming that the distribution of sources in our $N$-dimensional
color-space are described by the superposition of
the $M$ multivariate normal distributions,
the probability of the $i$-th object to belong to
the $j$-th multivariate Gaussian is given by
\begin{equation}\label{eq:probability1}
P\left( x_i , \mu_j , \Sigma_j \right) = A_j \frac{1}{\sqrt{{\left( 2\pi\right)}^N \left|\Sigma_j\right|}}
\exp\left[ -\frac{1}{2}{\left(x_i-\mu_j\right)}^T \Sigma_j^{-1}\left(x_i-\mu_j\right)\right]\textnormal{,}
\end{equation}
where $x_i$ is the position of the given object in the $N$-dimensional space, $\Sigma_j$ is the covariance matrix
of the $j$-th multivariate Gaussian group, $\mu_j$ is its barycenter (mean coordinate), $A_j$ is its
amplitude (probability normalization), and the superscript {\small $T$} represent matrix transposition. Note that $x$ and $\mu$
are $N$-dimensional arrays and the rank of $\Sigma$ is $N\times N$.
We define as total probability that the $i$-th source belongs to {\em any} of the Gaussian groups, the sum
\begin{equation}\label{eq:probability2}
P_{\rm tot}\left(x_i\right) = \sum_{j=1}^{M} P\left( x_i , \mu_j , \Sigma_j \right)\textnormal{.}
\end{equation}
This quantity integrates to unity and is therefore a probability density function (PDF),
describing the probability for a single $i$-th object in the sample to lie at the position
$\mathbf{x_i}=\left(x_{i,1},\ x_{i,2},\ \dots,\ x_{i,N}\right)$ \citep[see][]{davoodi2006}.
Given Eq. \ref{eq:probability1}, the PDF determines the relative probability
for any galaxy in the sample to come from any of the $M$ components. We assign each galaxy to
the mode that maximizes its probability density. \citet{davoodi2006} demonstrated that
an alternative choice, consisting in randomly assigning each galaxy to one of the modes
with a probability proportional to the PDF value at its position, gives equivalent results.
\subsection{Grouping in PEP fields}
The three fields adopted for this analysis (GOODS-S, GOODS-N and COSMOS)
have been observed by PACS and SPIRE down to very different depths (see Table \ref{tab:depths})
and over different areas ($\sim 200$ arcmin$^2$ in the GOODS fields and
$\sim 2$ deg$^2$ in COSMOS). As a consequence, different luminosities
as a function of redshift are covered, potentially
probing different regimes with respect to the so-called ``main sequence of star formation'' (MS)
at different redshifts in different fields.
We therefore chose to keep the three fields separate for classification, in order not to dilute
the information available. In this way we would like to avoid objects which may be
peculiar to deep fields (e.g. MS galaxies at high redshift) from getting lost
in the plethora of COSMOS sources. Furthermore, this choice will lead to a wider variety
of SED shapes and a better sampling of the observed scatter in the colors.
As a result of the parametric grouping, the color distributions
of sources in GOODS-S and COSMOS are reproduced by the
superposition of nine Gaussian modes, while only six components are required
in GOODS-N.
The latter misses those groups with bluer MIR-FIR colors.
These are missed also in the large, shallow COSMOS field, where
-- on the other hand -- a larger population of NIR-MIR power-law sources
is detected.
Through Monte Carlo simulations, it is possible to estimate the chance that
one source effectively belonging
to a given group is nevertheless assigned by {\sc FastEM} to a different one because
of scatter.
Based on the groups defined using observed data, we build an
artificial data-set (see Sect. \ref{sect:simu}), which is then
evaluated by running {\sc FastEM} using the known set of multivariate Gaussians.
The incidence of mis-classifications -- defined as the fraction
of sources in a given class being assigned to {\em any}
other group belonging to the same data-set/field -- turns out to vary depending on classes,
with a maximum of 15\% in the worst cases. Mis-classifications happen
in the regions of color space where there are overlapping modes
with similar amplitudes.
Overlap of classes between different fields
exists. This is evident in subspaces of reduced dimensions, especially due
to the large dispersion in some colors (see Fig. \ref{fig:sed_fit1}
for error bars on median SEDs),
but becomes difficult to trace when working in the full 10-dimensional set.
In this context, Table \ref{tab:sed_fits}
lists a subset of colors derived after fitting the median SEDs
of each Gaussian mode (see next Section). Keeping fields separate results in a finer sampling
of multi-color space.
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.9\textwidth]{b2013f2.eps}
\caption{Rest-frame spectral energy distributions of the Gaussian modes found in
the three fields. Black squares represent median SEDs obtained through restframe filters
(see Table \ref{tab:avg_sed_filters}). Colored dots trace the de-redshifted
photometry of individual sources.
The number of objects contributing to each group is
quoted in the respective panel.}
\label{fig:median_SEDs}
\end{figure*}
\section{Fitting SEDs}\label{sect:sed_fit}
Once that Gaussian modes have been identified, we
derive the weighted-median\footnote{A weighted percentile
is defined as the percentage in the total weight is counted, instead of the total number.
The weighted median corresponds to the 50$^{\rm th}$
weighted percentile. In practice, having $N$ values $v_1,\ v_2,\ \dots,\ v_N$ and their corresponding weights
$w_1,\ w_2,\ \dots,\ w_N$, they are first sorted in order of ascending $v$,
and then the partial sum of the weights $S_n=\sum_{k=1}^n w_k$ is computed for each $n$-th (sorted) value.
The weighted median is defined as the value $v_n$ having $S_n=\frac{1}{2} \sum_{k=1}^N w_k$.}
restframe SEDs of each group. This is done by
shifting all objects to restframe wavelengths and normalizing at a common
wavelength: 1.6 $\mu$m in our case. Different normalization wavelengths have
been attempted, but the NIR turned out to be the most effective choice, as it is well covered by
the observed bands (i.e. there are no large gaps in wavelength), and it lies in a relatively
central position of the covered frequency range. Therefore normalizing at 1.6 $\mu$m
minimizes both uncertainties in interpolation at the normalization wavelength itself and
scatter at the extremes of the covered spectral range.
\begin{table}[!ht]
\centering
\begin{tabular}{l l}
\hline
\hline
Filter & $\lambda_{eff}$ \\
Name & $[\mu$m$]$\\
\hline
ST-UV14 & 0.1405 \\
GALEX-FUV & 0.1539 \\
ST-UV17 & 0.1751 \\
OAO-UV2 & 0.1913 \\
ST-UV27 & 0.22 \\
GALEX-NUV & 0.2316 \\
OAO-UV4 & 0.2986 \\
SDSS-$u$ & 0.3562 \\
ESO-WFI-$B$ & 0.4606 \\
SDSS-$g$ & 0.4719 \\
Subaru-$V$ & 0.5478 \\
SDSS-$r$ & 0.6186 \\
SDSS-$i$ & 0.7506 \\
SDSS-$z$ & 0.8961 \\
ISAAC-$J$ & 1.238 \\
ISAAC-$H$ & 1.652 \\
ISAAC-$K_{\rm s}$ & 2.168 \\
IRAC-3.6 & 3.563 \\
IRAC-4.5 & 4.511 \\
IRAC-5.8 & 5.759 \\
IRAC-8.0 & 7.959 \\
IRAS-12 & 11.69 \\
ISO-LW3 & 14.57 \\
MIPS-24 & 23.84 \\
IRAS-60 & 62.22 \\
PACS-070 & 72.48 \\
PACS-100 & 102.8 \\
PACS-160 & 165.9 \\
SPIRE-250 & 251.5 \\
SPIRE-350 & 352.8 \\
\hline
\end{tabular}
\caption{Filters adopted to produce rest-frame weighted-median SEDs for each
Gaussian mode.}
\label{tab:avg_sed_filters}
\end{table}
Median SEDs are computed through a set of passbands, aimed at optimizing
spectral coverage, as listed in Table \ref{tab:avg_sed_filters}.
When computing weighted medians, weights are given by photometric uncertainties
combined to passbands (i.e. we take the position of de-redshifted points within
the filter transmission curve into account),
and are propagated into uncertainties on median fluxes by means of an unbiased variance estimator.
Figure \ref{fig:median_SEDs} shows the SEDs of all Gaussian modes in the
three fields, including de-redshifted photometry of all sources
belonging to each group (colored points) and median photometry (black squares).
The median SEDs thus obtained are discretized in passbands (Table \ref{tab:avg_sed_filters}),
and therefore need to be fit with an SED synthesis code to provide a
reliable ``interpolation'' and description of the whole spectrum.
\subsection{Fitting with {\sc magphys}}
Among the numerous codes available for SED fitting, we adopt the {\sc magphys}
software \citep{dacunha2008}, because of a number of features:
\begin{itemize}
\item it covers the whole wavelength range from UV to FIR and submm;
\item it links the energy absorbed by dust in the UV-optical domain to dust emission in the MIR and FIR in a self-consistent way;
\item it is user friendly and simple to use; moreover
the code is structured in such a way that it can be easily modified, if desired.
\end{itemize}
{\sc magphys} combines the Bruzual \& Charlot (\citeyear{bruzual2003}, BC03, see also
Bruzual \citeyear{bruzual2007}) optical/NIR stellar library, including
the effects of dust attenuation as prescribed by \citet{charlot2000}, with MIR/FIR dust emission
computed as in \citet{dacunha2008}. The optical and infrared libraries are
linked together, taking into account energy balance (no radiation transfer involved).
The total energy absorbed by dust in stellar birth clouds and in the ambient
interstellar medium (ISM)
is re-distributed at infrared wavelengths.
The main assumptions are that the energy re-radiated by dust
is equal to that absorbed, and that starlight is the only significant source of
dust heating.
It is worth to note that, since we are fitting the median photometry
of several galaxies, possible
variations of the effective attenuation law \citep[e.g.][]{buat2012,reddy2012,reddy2006,wild2011}
are diluted. Such variations would mainly
influence star formation histories and thus the ages of the
dominant stellar populations in the {\sc magphys} modeling. Nevertheless,
our results on infrared luminosities and AGN fractions (see next Sections)
would not be affected by this effect.
We defer to \citet{dacunha2008} for a thorough formal description of
how galaxy SEDs are built \citep[see also][for an application to \textit{Herschel}-selected
$z<0.5$ galaxies]{smith2012}. Here we only recall that
the SED
of the power re-radiated by dust in stellar birth clouds is computed as the sum of three components:
polycyclic aromatic hydrocarbons (PAHs); a mid-infrared continuum describing
the emission of hot grains with temperatures $T=130$--$250$ K; and
grains in thermal equilibrium with $T=30$--$60$ K.
The ``ambient'' ISM is modeled by fixing the relative proportions of these three
components to reproduce the cirrus emission of the Milky Way, and adding a component
of cold grains in thermal equilibrium, with adjustable temperature in the range $T=15$--$25$ K.
Different combinations of star formation histories, metallicities and dust content
can lead to similar amounts of energy absorbed by dust in the stellar birth clouds, and
these energies can be distributed in wavelength using different
combinations of dust parameters. Consequently, in the process of fitting,
a wide range of optical models is associated with a wide range of infrared spectra and compared to
observed photometry, seeking for $\chi^2$ minimization. The number
of possible combinations is on the order of $10^9$ at $z=0$.
Figure \ref{fig:sed_fit1} in Appendix \ref{sect:sed_fit_imgs}
presents the best fits, and Table \ref{tab:sed_fits} summarizes the results.
\subsection{Adding an AGN component}
As mentioned above, one of the main underlying assumptions of the
{\sc magphys} code is that starlight is the only significant source of
dust heating, i.e. so far a possible AGN component has been ignored
while fitting our median SEDs.
We have therefore developed a modified version of the {\sc magphys} code,
adding a warm dust component to the modeled SED emission. This represents
dust surrounding the active nucleus, often assumed to be distributed
in a toroidal region (hence hereafter referred as ``torus'' for simplicity).
The \citet{dacunha2008} original code is now combined with the \citet{fritz2006}
AGN torus library \citep[see also][]{feltre2012}.
The quest for a best fit is still
based on $\chi^2$ minimization; the stars+dust model is freely normalized
and subtracted from the observed photometry;
the torus emission is then added to reproduce what is left
out from this subtraction.
Thanks to the {\sc magphys} structure, dust emission --
no more limited to single templates as in some older attempts -- is linked
to the stellar optical component.
Allowing the normalization of stars+dust to be free, i.e. not strictly anchored to the observed photometry
but simply randomly picked from a grid of values,
the torus is effectively fit to the data in a simultaneous 3-component model
\citep[see also][for alternative implementations]{fritz2006,berta2007a,noll2009,santini2012,lusso2012,bongiorno2012}.
The torus/AGN library of Fritz et al. spans several geometries of the dust distribution
around the central AGN nucleus, varying the ratio between outer and inner radii ($R_{\rm out}/R_{\rm in}=20$--$300$),
and the aperture angle of the torus (measured starting from the equatorial plane, $\Theta=40^\circ$--$140^\circ$).
The optical depth at the equator covers the range $\tau=0.1-10.0$ at 9.7 $\mu$m.
The spectrum emitted by the central engine is modeled with a
broken power-law $\lambda\, L(\lambda)\propto\lambda^\alpha$, with indexes $\alpha_1=1.2$, $\alpha_2=0.0$, $\alpha_3=-0.5$ or $-1.0$,
in the ranges $\lambda_1=0.001$--$0.03$, $\lambda_2=0.03$--$0.125$, and $\lambda_3=0.125$--$20$ $\mu$m, respectively.
Two different sets of models are included, differing for the UV-optical-IR
slope of this power law, $\alpha_3$.
When visible along the line of sight, the direct AGN light is included in these SED models.
The full library comprises a total of roughly 700 models, each one computed at 10
different lines of sight angles $\Phi$, but we limit the fit to $R_{\rm out}/R_{\rm in}\le100$,
as extreme values have so far not been confirmed by observations \citep[e.g.][]{mullaney2011,hatziminaoglou2008,netzer2007a}.
See \citet{fritz2006} for more details on this model.
In terms of computational time, the performance of our modified code is comparable to
the original {\sc magphys} code. On an Intel\textsuperscript{\textregistered}
Xeon$^{\mathrm{TM}}$ 3.2 GHz CPU, $10^{10}$ model combinations
are sampled in roughly 80--100 minutes, to be compared to 10--15 minutes
spent for $\sim10^9$ evaluations in {\sc magphys}.
Best fits obtained with {\sc magphys}+AGN are shown in Fig.~\ref{fig:sed_fit1}
in Appendix~\ref{sect:sed_fit_imgs},
and results are summarized in Table~\ref{tab:sed_fits}.
A description of all physical parameters involved in the fit, and their
marginalized likelihood distributions (with or without AGN) goes beyond the scope
of this work. Here we limit to describe the fraction of infrared
luminosity, $L(8$--$1000\ \mu\textnormal{m})$ powered by the torus component
(see Table \ref{tab:sed_fits}). When sampling the wide parameter space in
searching for a best fit, the code registers the details of all attempted model
combinations and builds the probability distribution function of a wide number of
physical quantities. In this way degeneracies in the fit are taken into
account and are translated into uncertainty ranges. Table \ref{tab:sed_fits}
includes the AGN fraction of the best fit, as well as its 2.5$^{\rm th}$, 50$^{\rm th}$ and 97.5$^{\rm th}$
percentiles, and gives a short description in terms of their main properties
(AGN component, star formation strength, colors, etc).
\section{Rare sources}\label{sect:outliers}
The probability of a given object to belong to
any of the Gaussian modes found by {\sc FastEM} and
its total probability to belong to {\em any} of these groups is described by
Eqs. \ref{eq:probability1} and \ref{eq:probability2}.
We build the cumulative total probability distribution function over all
objects in each field and perform Monte Carlo simulations in order to identify
a potential excess of observed objects at the low probability end.
Such an excess can be used to define potential {\em outliers}, or rare sources
which cannot be categorized in any of the Gaussian modes found.
Figure \ref{fig:total_pdf_cos} shows the cumulative $P_{\rm tot}$ distribution
in COSMOS (red dashed line).
\begin{figure}[!ht]
\centering
\includegraphics[width=0.35\textwidth]{b2013f3.eps}
\caption{Cumulative distribution of probability densities in COSMOS. The red dashed line
is for the observed sources, and is compared to simulated results (blue dotted line).
The excess of observed sources, with respect to expectations from simulations, at the low
probability side is due to rare objects, not complying with the restframe colors of
Gaussian groups.}
\label{fig:total_pdf_cos}
\end{figure}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.75\textwidth]{b2013f4.eps}
\caption{SEDs of outliers (black symbols), grouped in classes, and compared to the
rest of {\sc FastEM}-based templates (grey), normalized to 1.6 $\mu$m. }
\label{fig:outlier_SEDs}
\end{figure*}
\subsection{Simulations}\label{sect:simu}
Given the $M$ multivariate normal distributions that build up our $N$-dimensional color-space,
we run a Monte Carlo simulation aimed at constructing the expected total probability distribution
function PDF$_{\rm exp}$. The code designed for this goal, produces a set of $n$
random points for each $j$-th $N$-dimensional multivariate normal distribution,
where $n$ is the actual number of real sources belonging to the $j$-th group.
Then the artificial catalogs thus built are ``evaluated'' by {\sc FastEM}
using the multivariate normal groups previously found on real catalogs, and
already used to build the random artificial catalogs themselves.
The probability of each artificial object to belong to any of the $j=1,\, \dots,\, M$ multivariate
distributions (i.e. including all others that were {\em not} used to build the random
sample) is thus computed in the same way as for real objects (Eq. \ref{eq:probability2}).
The $M$
probabilities are summed together for each of the $i=1,\, \dots, n\times M$ random points in
the $N$-dimensional space. The expected cumulative distribution of
probability densities expected from simulations (using all random
points) is then compared to the ``observed'' one in Fig. \ref{fig:total_pdf_cos} (blue dotted line).
The analysis of these simulations is not straightforward. In principle, we
would like to define a probability threshold $P_{\rm thresh}$, below which a source can
be considered an {\em outlier} \citep[see][]{davoodi2006}.
In practice, in the COSMOS case, the observed and simulated curves intersect each other
at roughly $P_{\rm tot}\simeq10^{-4}$. In our case $N(\textnormal{obs})=2\times N(\textnormal{exp})$
holds at $P_{\rm tot}\simeq10^{-5}$.
Simulations for the GOODS fields (not shown here for simplicity)
have a different behavior:
the observed and simulated PDFs do not cross each other, but are
roughly parallel, with PDF$_{\rm exp}\gtrsim$PDF$_{\rm tot}$.
The two GOODS fields include a rather limited number of
sources, i.e. our $N$-dimensional space is rather sparsely sampled. In such a
small-number limit, simulated and real probabilities
follow the same trend, but real catalogs are missing a fraction of sources.
On the other hand, the large COSMOS (Fig. \ref{fig:total_pdf_cos}) indeed contains
some significant fraction of unexpected objects at the low-probability end.
To be conservative, we adopt $P_{\rm thresh}=10^{-5}$ as threshold for
all fields.
\subsection{Outliers}
Using the probability threshold defined above, we identify outlier candidates
in the $N$-dimensional color space. In this way, 5, 21, and 32 potential outliers are
identified in GOODS-N, GOODS-S and COSMOS, respectively.
The SEDs of selected objects are checked
individually against photometric oddities (e.g. glitches, cosmic ray hits,
etc.) and multi-wavelength images (in the F814W or F850LP ACS bands, together with 3.6 $\mu$m, 24 $\mu$m, 100 $\mu$m, 250 $\mu$m, and
others if needed) are visually inspected.
Several outlier candidates turn out to be sources affected by potential
photometric problems in some band, mostly
due to blending, wrong associations, and (consequently) also wrong photometric redshifts.
These cases are often related to each other.
For example a faint galaxy in the vicinity of a bright star would have an optical SED
resembling that of a passive object, but would be also bright in the FIR.
The warning bell in such a case would be rung by the fact that
the 1.6 $\mu$m stellar peak would appear to lie at the wrong wavelength,
with respect to the tabulated redshift. Another exemplary case is an object appearing isolated
in the optical, but double at 24 $\mu$m and finally being the blend of two components
in \textit{Herschel} maps.
In addition, objects at the edge of a given {\sc FastEM} group definition
might be identified as outlier candidates, but it might happen that
they are reproduced by the SED of a neighboring mode.
Since we are here searching for objects not covered by any of the SEDs defined so far,
these cases are not considered as real outliers.
After these individual checks, 12 definite outliers are left. Their SEDs are shown in
Fig. \ref{fig:outlier_SEDs}, and compared to the median SEDs of {\sc FastEM} groups
(see Sects. \ref{sect:FastEM} and \ref{sect:sed_fit}). We have assigned them to eight new
groups, according to their SEDs and visual inspection of ACS images.
Outliers of the {\bf group 1} are two GOODS-S and one COSMOS sources with torus-dominated, almost featureless SEDs.
They are characterized by moderate FIR emission, a prominent MIR excess and red optical
colors. All three are known X-ray sources \citep{luo2008,luo2010,brusa2010,cappelluti2009}
and two are detected at radio frequencies \citep{miller2008,schinnerer2010}.
Galaxies in {\bf groups 2 and 3} have featureless continua from the UV to the MIR and their
IRAC-MIPS emission is likely dominated by an AGN component. The two differ from each other
in their optical colors. Both SEDs have flat power-law like shape, while group 1 is convex
in the NIR-MIR regime. Both are detected in the X-rays \citep{luo2008}.
The prototype galaxy of group 3 is a bright radio emitter with a 1.4 GHz
flux of $\sim3.31\pm0.01$ mJy at $z\simeq1.6$, while the other is not detected at radio frequencies \citep{miller2008}.
{\bf Group 4} includes two $z\sim3$ galaxies with very bright FIR and far- to mid-infrared flux
ratio much redder than any class found by {\sc FastEM}.
Outliers of {\bf class 5} represent bright FIR emitters with very red optical
SEDs. With an observed flux ratio $S_\nu(100)/S_\nu(24)=90$ and a redshift $z\sim1.8$,
this outlier is similar to the high redshift ``silicate break''
galaxies described by \citet{magdis2011}, although no 16 $\mu$m information
is available in our case.
Outliers of {\bf class 6} are represented by a $z\sim1.1$ Lyman break galaxy,
detected well in the near-UV band by GALEX, but barely seen in the far-UV. The optical emission is very blue and
does not comply with any previously defined SED.
{\bf Class 7} includes a nice and isolated spiral galaxy at $z=0.11$, with no
MIR emission and very weak FIR.
Finally, {\bf group 8} comprises two large nearby spheroidal galaxies at redshifts $z=0.10$ and $z=0.38$.
They both are characterized by a slight MIR excess, with
respect to a pure old stellar population Rayleigh-Jeans spectrum and faint FIR emission,
which can be interpreted as circumstellar dust of AGB stars and emission
from diffuse dust even in these passive systems \citep[see, for example,][]{bressan2006,panuzzo2011}.
As in the case of the Gaussian modes, the SEDs of outliers have been
fit using the original {\sc magphys} \citep{dacunha2008} and our modified version including
an AGN component. Results are shown in Appendix \ref{sect:sed_fit_imgs} and
summarized in Table \ref{tab:sed_fits}.
\section{Discussion}\label{sect:discussion}
Combining the modeled SEDs of multivariate Gaussian modes and outliers,
a library of new templates spanning from the
ultraviolet to submillimiter spectral domains is now defined.
Here we apply this new library to full multi-wavelength
data sets in GOODS-N and GOODS-S, with the aim of testing its performance
in evaluating infrared luminosities of galaxies and
classifying 24 $\mu$m-selected objects on the basis of their
AGN content, FIR colors and far-to-near infrared flux ratios.
\subsection{Deriving infrared luminosities}\label{sect:testing}
We would now like to compare the new library of templates to other existing
templates and methods, focusing our attention
on the estimate of infrared (8--1000 $\mu$m) luminosity.
Figure \ref{fig:all_templates} shows all templates, as in Table \ref{tab:sed_fits},
normalized to 1.6 $\mu$m and color coded by their $L(8$--$1000\, \mu\textrm{m})/L(1.6\, \mu\textrm{m})$
color.
A normalization in correspondence of the NIR stellar emission peak stresses
color differences and highlights the wide variety of FIR SEDs describing real
sources.
The PEP team defined a test case catalog, extracted semi-randomly from
the GOODS-S MUSIC+PEP source list \citep{lutz2011,berta2010,berta2011,grazian2006},
aimed at comparing different $L(\textnormal{IR})$ estimators.
The list of sources was designed to cover as wide a redshift and PACS flux
range as possible, and includes 200 entries. No SPIRE data were included at this stage.
In this analysis, the following approaches are being tested:
\begin{figure}[!ht]
\centering
\includegraphics[width=0.45\textwidth]{b2013f5.eps}
\caption{SEDs of all templates, belonging to all groups and outliers.
Color coding is based on the infrared bolometric
(8--1000 $\mu$m) to NIR (1.6 $\mu$m) luminosity ratio.}
\label{fig:all_templates}
\end{figure}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.9\textwidth]{b2013f6.eps}
\caption{Testing $L(\textnormal{IR})$ estimates using 8 different methods, and including
\textit{Herschel} data. The employed methods and templates are: \citet[][W08]{wuyts2008};
\citet[][CE01]{chary2001}; \citet[][P07]{polletta2007} fitted using {\sc hyper-z};
\citet[][SK07]{siebenmorgen2007} fitted with a custom code; \citet[][DH02]{dale2002};
\citet[][E11]{elbaz2011}; \citet[][N12]{nordon2012}; and this work (B13).
\citet{elbaz2011} adopt two different templates (``main sequence'', shown in black, and ``starburst'', in blue).
See text for more detail about each method. Red diagonal lines simply mark the one to one
relation.
The large bottom left panel shows the distribution of the relative spread per object,
computed as $\textnormal{M.A.D.}/\textnormal{median}$ using the 8 different $L(\textnormal{IR})$
estimates per object. The large upper left panel, instead, depicts the distribution of
scatter computed for each pair of methods as M.A.D. of the quantity $\left(y-x\right)/x$.
In this case, $x$ and $y$ denote pairs of $L(\textnormal{IR})$ estimates on the
abscissa and ordinate axes, for each pair of methods.}
\label{fig:test_LIR_1}
\end{figure*}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.6\textwidth]{b2013f7.eps}
\caption{Comparison of infrared luminosities, as obtained with and without \textit{Herschel} data
included in the fit. In the latter case, 24 $\mu$m flux densities are used.
The methods and templates used are: \citet[][W08]{wuyts2008};
\citet[][CE01]{chary2001}; \citet[][P07]{polletta2007} fitted using {\sc hyper-z};
\citet[][SK07]{siebenmorgen2007} fitted with a custom code; \citet[][DH02]{dale2002};
\citet[][E11]{elbaz2011}; \citet[][N12]{nordon2012}; \citet[][R11]{rujopakarn2011}; and this work (B13).
The fit obtained with SK07 templates was designed to
work with multi-band photometry, hence was not tested on 24 $\mu$m data alone and is not shown here.
\citet{rujopakarn2011} provide an estimate of $L(\textnormal{TIR})$ using 24 $\mu$m only, but no \textit{Herschel} information, therefore
it is here compared to the results obtained with the new templates (B13) including \textit{Herschel} data.
A correction to transform $L(\textnormal{TIR}, 5-1000\, \mu\textnormal{m})$
into $L(\textnormal{IR},8$--$1000\, \mu\textnormal{m})$
has been computed by integrating \citet{rieke2009} templates, as used in \citet{rujopakarn2011};
this correction ranges between 8\% and 1\% depending on luminosity.
Red diagonal lines simply mark the one to one relation.}
\label{fig:test_LIR_2}
\end{figure*}
\begin{enumerate}
\item the luminosity-independent conversion between observed flux density and
luminosity by \citet[][W08]{wuyts2008}, based on a single template,
constructed by averaging the logarithm of \citet[][DH02]{dale2002} templates.
In terms of local analogs, its mid- to far-infrared SED shape is reminiscent of M82.
\item fit of FIR SEDs with the \citet[][CE01]{chary2001} luminosity-dependent
template library \citep[see also][]{nordon2010,elbaz2010,hwang2010}.
\item standard UV-to-FIR SED fitting using the {\sc hyper-z} code \citep{bolzonella2000} and
\citet[][P07]{polletta2007} templates, allowing for extinction with $A_V=0$--$3$.
\item maximum likelihood analysis using a custom code and the starburst SED library
by \citet[][SK07]{siebenmorgen2007}, which is based on radiative transfer and spans
a 3 dimensional parameter grid of luminosity, nuclear radius, and visual
extinction.
\item fit of PACS flux densities using DH02 templates, normalized
to an IR luminosity (8--1000 $\mu$m) using the \citet{marcillac2006} relation
between $L(\textnormal{IR})$ and the $F(60)/F(100)$ color, and corrected on
the basis of \citet{papovich2007} recipe to account for the overestimation
of 24\,$\mu$m-based $L(\textrm{IR})$ \citep[see][]{santini2009}.
\item rescaling of the two \citet[][E11]{elbaz2011} templates of ``main sequence'' (MS) and ``starburst'' (SB)
galaxies to observed FIR data.
\item the \citet[][N12]{nordon2012} recipe, based on the offset from the star-forming ``main sequence'',
$\Delta(\textnormal{sSFR})_{\rm MS}$, to re-calibrate CE01
templates.
\item fit of UV-FIR data, using {\sc hyper-z} and the templates defined in this work (hereafter labeled B13).
\end{enumerate}
In all cases, redshifts have been fixed to known values
(see Sect. \ref{sect:data} for details).
Estimations of $L(\textnormal{IR})$ with each method have been performed both including and
excluding \textit{Herschel} data. In the latter case, 24 $\mu$m data were used in the
estimation of infrared luminosities. Most approaches are based on $\chi^2$ minimization
while fitting the data. Methods number 6 and 7 need additional knowledge of stellar mass
(and SFR). Ideally, method 6 would also require
an estimate of either IR8 (i.e. $L_{\rm IR}/L_{8 \mu{\rm m}}$) or
compactness, in order to distinguish between the MS and SB templates. Since these
pieces of information are not available in our case, we apply both templates to all objects,
thus deriving two $L(\textnormal{IR})$ values for each source.
In addition to the above listed techniques, when excluding \textit{Herschel} data
we also applied to our test case the recipe
by \citet[][R11]{rujopakarn2011}, mapping 24 $\mu$m fluxes into total
infrared luminosities $L(\textnormal{TIR})$. This method was defined by
parameterizing galaxy SEDs as a function of luminosity surface density,
$\Sigma_{L({\rm TIR})}$, and adopting the \citet{rieke2009} templates.
The correction needed to transform $L(\textnormal{TIR}, 5-1000\, \mu\textnormal{m})$
into $L(\textnormal{IR},8$--$1000\, \mu\textnormal{m})$
has been computed by integrating these templates;
this correction ranges between 8\% and 1\%, depending on luminosity.
Figure \ref{fig:test_LIR_1} shows the direct comparison of $L(\textnormal{IR})$
estimates based on the different techniques.
Infrared luminosities derived including \textit{Herschel} data are
globally very consistent with each other. When computing the
dispersion of all 8 determinations around their median value for each
object (i.e. computing the median absolute deviation, M.A.D., per object), it turns
out that the relative uncertainties peak at $\sim$10\% with a tail
extending to $>50$\% for a few cases only (large bottom-left panel in Fig. \ref{fig:test_LIR_1}).
In other words, by implementing \textit{Herschel} photometry in SED fitting,
it is possible to estimate $L(\textnormal{IR})$
within $\sim10$\% (M.A.D.), regardless of the adopted technique.
No trends of M.A.D. as a function of redshift or infrared luminosity are
detected.
To quantify the scatter in each possible combination of two methods
shown in Fig. \ref{fig:test_LIR_1}, the upper large panel on the left presents
the distribution of the M.A.D. of the quantity $\left(y-x\right)/x$, computed for
each pair of methods using all sources. In this case $x$ and $y$ simply
represent the $L(\textnormal{IR})$ values computed with methods in the abscissa or
ordinate axis. When comparing two methods, the scatter over all objects
ranges between a few percent to $\sim20$\% (in M.A.D. terms again).
Most of the adopted
techniques present only few catastrophic outliers, defined as those sources
having $\left| \frac{y-x}{x} \right|>2.0$, when compared to other methods.
In some cases the scatter between two methods is remarkably small,
pointing to their similarities.
The \citet{chary2001}, \citet{elbaz2011} and \citet{nordon2012} approaches are
conceptually very similar and produce the lowest scatter when compared to
each other. Also the \citet{wuyts2008} approach produces scatter lower than 10\%,
when compared to the above mentioned three techniques.
These four $L(\textnormal{IR})$ estimates practically reduce to
fitting a single template to the observed photometry, either chosen
from a library on the basis of luminosity itself or the offset from the ``main sequence''
of star formation $\Delta(\textnormal{sSFR})_{\rm MS}$ (CE01, N12), or
simply being the only available choice (W08, E11).
As the complexity of fits increases, the scatter also grows: techniques employing
a variety of templates with free normalization, and/or extending
the wavelength range all the way to the NIR, optical or UV, naturally produce
a larger scatter, when compared to others.
It is worth pointing out (not shown for the sake of conciseness) that, in
UV-to-FIR SED fitting,
scatter seems to be dominated more by the choice of code and its setup, rather than specific templates.
Fitting SEDs with the new template library or with Polletta's,
but adopting {\sc hyper-z} \citep{bolzonella2000}, {\sc eazy} \citep{brammer2008},
or {\sc Le Phare} \citep{arnouts1999,ilbert2006} produces significantly
different amounts of scatter. Determining the source
of this effect is not trivial, because tuning these
codes so that the adopted configurations are equivalent is not
straightforward.
To give an idea of the size of this effect, when considering these three codes
with standard setup
and employing the same template library, the peak of the distribution of relative
M.A.D. scatter per source (see the large bottom-left panel in Fig. \ref{fig:test_LIR_1} for comparison) can
shift to values as high as 20\%.
Deep \textit{Spitzer} blank field observations at 24 $\mu$m contain a large number of objects
not detected by \textit{Herschel}.
It is thus important to verify how reliable the
$L(\textnormal{IR})$ derivation will be in the absence of FIR photometry.
This is particularly relevant in light of the short \textit{Herschel} lifetime and because of the spectral range
covered by other
current/future space missions (e.g. WISE, 3--25 $\mu$m; JWST,
0.6--28 $\mu$m), before the launch of next generation projects extending
to the FIR again (e.g. SPICA).
Figure \ref{fig:test_LIR_2} compares $L(\textnormal{IR})$ estimates obtained with
and without the inclusion of \textit{Herschel} data, for each approach.
The well known bending in luminosity-dependent, locally-calibrated (e.g. CE01-based) approaches
\citep[see][]{elbaz2010,nordon2010}
and its correction \citep{elbaz2011,nordon2012} can be seen here.
It is worth noting that -- since higher luminosity objects tend to lie at a higher redshift because of Malmquist bias --
the deviation from the one to one line affects mainly
distant galaxies \citep[$z\ge1.5$, see also][]{elbaz2010,elbaz2011}, while all methods
show self consistency below $L(\textnormal{IR})\simeq10^{12}$ L$_\odot$, i.e. at lower redshift.
We warn that since the knowledge of IR8 (i.e. $L_{\rm IR}/L_{8 \mu{\rm m}}$) or
compactness is not available, a proper choice between the \citet{elbaz2011} MS or SB
templates is not possible; thus a direct comparison
between the two should not necessarily be taken at face value for this test case.
Classical SED-fitting methods, allowing for template luminosity rescaling,
seem to be less affected by this problem at the high luminosity end, highlighting conceptual
differences between linear and nonlinear $L(\textnormal{IR})$ derivations/corrections.
\citet{nordon2012} analyze in detail the systematics in $L(\textnormal{IR},160)/L(\textnormal{IR},24)$
affecting luminosity-dependent methods at $z\sim2$, showing that N12 seems to be the
most effective one in reducing trends, at the expense of a 1.2--1.5 times larger scatter
with respect to other approaches. For comparison, when extending to all redshifts (Fig. \ref{fig:test_LIR_2} here), the scatter
in $L(\textnormal{IR,\textit{Herschel}})/L(\textnormal{IR},24)$ is $\sim0.3$ dex (in terms of $\sigma$)
for most methods, with the exception of CE01 and N12 ($\sim0.45$ dex).
Summarizing, when including \textit{Herschel} photometry,
all libraries and methods provide $L(\textnormal{IR})$ estimates
within a $\sim10-20$\% scatter, modulo tuning subtleties;
known caveats \citep[see, e.g.,][]{elbaz2010,nordon2010} apply to
derivations limited to MIR wavelengths. The latter
are still affected by a large scatter, when compared to FIR-based
$L(\textnormal{IR})$ estimates, thus pointing out the importance of
\textit{Herschel}-based surveys and future upcoming FIR missions.
\subsection{Classification of MIR and FIR sources}\label{sect:classification}
\begin{figure*}[!ht]
\centering
\includegraphics[height=0.90\textheight]{b2013f8aa.eps}
\caption{Trends of colors as a function of redshift for the new {\sc FastEM} templates
({\em left}) and \citet{polletta2007} templates ({\em right}), compared to GOODS-S data.
In each panel, only sources detected in the two bands needed to build the given color
are taken into account. We plot the density of sources in each color-redshift bin, using a logarithmic
color scale ranging from magenta (lowest density) to light green (highest density).}
\label{fig:k_corr}
\end{figure*}
\addtocounter{figure}{-1}
\begin{figure*}[!ht]
\centering
\includegraphics[height=0.45\textheight]{b2013f8bb.eps}
\caption{continued.}
\end{figure*}
The newly generated SED templates were obtained
on a limited selection of sources drawn from GOODS-N/S and COSMOS
multi-wavelength catalogs (see Sect. \ref{sect:data}).
Thus, it is worth comparing them against the photometry of all sources detected
in any band.
In the left panels of Fig. \ref{fig:k_corr}, we show the color tracks
as a function of redshift, computed for the new set of templates (dark blue, solid lines).
These are plotted onto the position of all real sources in the GOODS-S field
(roughly 18\,000 sources in total),
with the sole requirement that a detection in the two bands giving each color
is guaranteed. To avoid confusion due to the plethora of points, in this Figure we
actually draw the density of objects in small color-redshift bins, logarithmically color-coded
from magenta (lowest density) to light green.
The right-hand panels of Fig. \ref{fig:k_corr} show the same color-redshift tracks for
the \citet{polletta2007} template set.
The main advantage of our new library, based on actual \textit{Herschel} data, is that
it spans a wider color range,
with respect to the \citet{polletta2007} one, both on the blue and red
MIR-FIR color sides. The same applies also to the optical and NIR
domains, with slight differences varying from case to case.
When comparing to observed data, the new library based on \textit{Herschel} data
covers most of the observed colors, with the exception of the bluest side of the
NIR color space. This can be due to a combination of the large scatter in
the IRAC observed photometry and a possible missing set
of passive templates (remember that the library was defined on \textit{Herschel}-detected objects).
However note that the Polletta library spans a similar NIR color range, although
it contains a number of elliptical galaxy templates of different ages, obtained with
GraSil \citep{silva1998}.
The SEDs of all 24 $\mu$m objects in the GOODS-N/S catalogs are then
fit with the same B13 setup as in Sect. \ref{sect:testing}, with the purpose of classifying
the whole population of infrared galaxies with the information provided by the
new library. The list of sources detected by MIPS in the MIR (see Table \ref{tab:depths})
comprises 2575 objects in GOODS-N and 1712 in GOODS-S.
Three main parameters are examined: the fraction of infrared luminosity
$L(8$--$1000\,\mu\textnormal{m})$ contributed by the possible AGN component,
the $L(60)/L(100)$ restframe FIR color, and the ratio $L(160)/L(1.6)$ between
FIR and NIR restframe luminosities.
For ease of interpretation, templates are grouped in three classes for each
of the parameters considered:
\begin{description}
\item{(a)} $f(\textnormal{AGN})=0.0$,\\ \ $0.0<f(\textnormal{AGN})\le0.3$,\\ \ $f(\textnormal{AGN})>0.3$;
\item{(b)} $L(60)/L(100)\le0.5$,\\ \ $0.5<L(60)/L(100)\le1.0$,\\ \ $L(60)/L(100)>1.0$;
\item{(c)} $L(160)/L(1.6)\le10$,\\ \ $10<L(160)/L(1.6)\le100$,\\ \ $L(160)/L(1.6)>100$.
\end{description}
In what follows we analyze GOODS-S data; similar results are obtained in GOODS-N.
Figure \ref{fig:classification1} reports on the relative distribution of
sources at all redshifts in each bin of $f(\textnormal{AGN})$, $L(60)/L(100)$ and $L(160)/L(1.6)$,
grouped in 1 dex wide bins of IR luminosity.
When analyzing classes {\em (b)} and {\em (c)} objects hosting an AGN (on the basis of our SED fitting)
have been excluded, because of the contamination of MIR and NIR
fluxes by the torus component.
As infrared luminosity increases,
the fraction of detected objects hosting an AGN with respect to the total
number in the given $L(\textnormal{IR})$ bin tends to increase. This is particularly true
for extreme sources, with $f(\textnormal{AGN})>0.30$. Nevertheless, their incidence over the
whole detected sample is well below 10\%.
As far as the $L(60)/L(100)$ color is concerned, the classification based
on SED fitting shows how the relative number of bluer objects increases
as a function of luminosity, at the expense of $L(60)/L(100)\le0.5$ sources.
At the same time, FIR emission becomes more prominent, with
respect to NIR, and $L(160)/L(1.6)>100$ galaxies dominate the
bright end. Results obtained including (right hand panels) and excluding (left panels)
\textit{Herschel} bands in the fit are remarkably similar, but one should keep in mind that
roughly 75\% of the sources in the analysis benefit from
a \textit{Herschel} detection. The reader is thus
warned that results based on $L(60)/L(100)$ and 24 $\mu$m detections only (left panels) should
be taken with care, if a higher fraction of objects is missing a FIR detection.
The $L(160)/L(1.6)$ ratio is a proxy for the specific star formation rate (sSFR),
while $L(60)/L(100)$ has often been adopted as a tracer of dust temperature \citep[e.g.][]{dale2002}.
Figure \ref{fig:m_sfr} shows the $M_\ast$--$\textnormal{SFR}$--$z$ space
for GOODS-S 24 $\mu$m detected sources. Star formation rates are based on
our estimate of $L(\textnormal{IR})$ and the \citet{kennicutt1998} conversion
to SFR. An independent estimate, obtained through a ladder of SFR tracers, and
calibrated on SFR$_{{\rm UV+IR}}$ \citep{wuyts2011a,wuyts2011b} produces similar results.
Stellar masses $M_\ast$
are based on \citet{bruzual2003} models, as applied to our data by \citet{wuyts2011b}.
Note that, if the \citet{maraston2005} models with enhanced emission by TP-AGB
(thermally pulsating asymptotic giant branch) stars
would have been adopted, best fits would correspond to younger, less massive (and more actively starforming)
systems than inferred with BC03 \citep{wuyts2011a,santini2009,salimbeni2009}.
When the two color classification schemes are adopted (middle and bottom panels), we exclude
sources with an AGN component. The incidence of warmer sources
(larger 60 to 100 $\mu$m luminosity ratio) grows for objects with larger
FIR ``excess''.
This is in line with what is found by Magnelli et al. (in prep.)
studying the dependence of dust temperature $T_{\rm dust}$ as a function of
position in the $M_\ast$--$\textnormal{SFR}$--$z$ space and distance from the so-called ``main sequence''
of star formation, and by \citet{symeonidis2013} studying the $L$--$T$ relation
of \textit{Herschel}-selected IR-luminous galaxies. For reference,
the MS locus defined by stacking 4.5 $\mu$m selected galaxies \citep{rodighiero2010}
is shown by dashed lines (obtained by interpolating between Rodighiero's redshift bins),
and the levels of MS +0.6 and +1.0 dex are marked with dotted lines.
\citet{rodighiero2011} used a +0.6 dex threshold to isolate off-sequence galaxies at $1.5<z<2.5$.
Note that, when limiting the analysis to \textit{Herschel}-detected sources only, objects lying below the main sequence
at $z\ge0.5$ are excluded.
\begin{figure}[!ht]
\centering
\includegraphics[width=0.45\textwidth]{b2013f9.eps}
\caption{Relative distribution of GOODS-S sources as a function of
AGN $L(\textnormal{IR})$ fraction, $L(60)/L(100)$ and $L(160)/L(1.6)$, as indicated by the labeling in
the right-hand panels, in different IR luminosity bins. Histograms are normalized to the number
of sources in each $L(\textnormal{IR})$ bin.
Left/right panels refer to a 24 $\mu$m selection and sources detected by \textit{Herschel}, respectively. Infrared luminosity bins are 1 dex wide, i.e.
they cover ranges $10^8-10^9$, $10^9-10^{10}$, etc.}
\label{fig:classification1}
\end{figure}
\begin{figure*}[!ht]
\centering
\rotatebox{-90}{\includegraphics[height=0.70\textwidth]{b2013f10.eps}}
\caption{Position of GOODS-S 24 $\mu$m sources in the
$M_\ast$--$\textnormal{SFR}$--$z$ space. Top, middle, and bottom panels depict objects color coded
on the basis of $L(\textnormal{IR})$ AGN fraction, $L(60)/L(100)$ luminosity ratio and
$L(160)/L(1.6)$ color, respectively. Color coding is the same as in
Fig. \ref{fig:classification1}. Dashed lines represent the position of the
``main sequence'' of star formation, as derived by \citet{rodighiero2010}
by stacking 4.5\,$\mu$m-selected sources. Dotted lines trace the MS +0.6 and +1.0 dex, respectively.}
\label{fig:m_sfr}
\end{figure*}
Segregation on the basis of $L(60)/L(100)$
or $L(160)/L(1.6)$ is clearly seen, although it becomes
gradually diluted at larger cosmic distances, possibly because an increasing incompleteness
affects the locus of MS galaxies (see e.g. Magnelli et al., in prep.).
The $L(160)/L(1.6)<10$ bin is hardly sampled by MIR-FIR detections:
the few sources belonging to this class indeed turn out to lie off-sequence, in the
locus occupied by passive galaxies in the $M_\ast-SFR$ plane, and are characterized by our
{\em outlier} quiescent templates.
Finally, in the $M_\ast$--$\textnormal{SFR}$ diagram, above $M_\ast\sim 10^{10}$~M$_\odot$, AGN appear to be distributed along with all
other galaxies \citep[see also][]{santini2012}.
They have a tendency to lie on the high SFR side of the source distribution across the
``main sequence'', but with no evident dependence on the fraction
of infrared luminosity -- $f(AGN)$ -- they are powering.
\section{Summary}
Starting from FIR detected sources and including multi-wavelength
information from the ultraviolet to optical, NIR and MIR,
we have grouped a subsample of sources in the deepest and in the widest
fields observed by \textit{Herschel} within the overlapping PEP plus HerMES dataset: GOODS-S, GOODS-N and COSMOS.
Following the work by \citet{davoodi2006}, the color distribution of
galaxies has been modeled as the superposition of multi-variate Gaussian
modes. The chosen parameter space, consisting of 10 restframe colors in the wavelength
range between 1400 \AA\ and 100 $\mu$m, covers
galaxy properties such as the UV slope, D4000 break, 1.6 $\mu$m stellar peak,
PAH and warm dust emission, possible AGN contamination and cold dust contribution.
A modified version of the {\sc magphys} \citep{dacunha2008} code has been developed,
aimed at reproducing galaxy SEDs with the combination
of three emitting components: stellar emission, thermal emission from dust heated by stellar
UV-optical radiation, and a possible AGN torus. The median SEDs of each Gaussian mode
have been fit with this code and with the original {\sc magphys} code, thus providing
a reliable interpolation over a continuous wavelength range. A new library of SED
templates has thus been defined.
The main results of this grouping and SED fitting classification are:
\begin{itemize}
\item the distribution of \textit{Herschel}-detected galaxies in the 10 restframe color space
can be reproduced by six to nine multivariate Gaussian modes in the three fields considered,
with some differences due to depth of data, wavelength coverage, and how fine the grid
of observed bands is.
\item the classification thus obtained has been used to identify rare objects,
so-called ``outliers'' in the grouping scheme. The main classes of outliers
identified are torus-dominated objects, type-1 AGN with featureless SEDs, and very bright
FIR emitters. Two low redshift elliptical and one passively evolving spiral,
well detected by \textit{Herschel}, provide the completion of the classification picture.
\item fitting the median SED of each group and outlier with multi-component SED synthesis,
a new set of templates has been defined\footnote{The new library can be retrieved at
http://www.mpe.mpg.de/ir/Research/PEP/uvfir\_templ,
normalized by $L(\textnormal{IR})$, $L(1.6\ \mu{\rm m})$, and $M_\ast$ (based on the results of SED fitting).}.
Among others, it includes five type-1 AGN models,
and five type-2, characterized by different AGN torus contributions to total
infrared (8-1000 $\mu$m) luminosity.
\item the new set of templates has been compared to other libraries and methods
often adopted in the literature to derive infrared luminosities of galaxies (see Sect. \ref{sect:testing} for a list).
When including FIR data, the $L(\textnormal{IR})$ estimates obtained
with the different methods are consistent with each other to within 10--20\%.
Scatter in comparing different derivations of $L(\textnormal{IR})$ strongly depends
on the choice of codes and their fine tuning.
\item comparing $L(\textnormal{IR})$ derived with or without the inclusion of \textit{Herschel} data, all
methods are affected by a significant scatter.
Luminosity-dependent approaches, calibrated on local galaxies, turn out to be affected by more critical problems
\citep[e.g.][]{elbaz2010,nordon2010} than
simple SED fitting allowing for free rescaling, but appropriate corrections account for
most systematics \citep[e.g.][]{elbaz2011,nordon2012}.
\item when compared to full catalogs, independently from any selection cut,
the new templates cover most of the color range occupied by real sources at all wavelengths.
\item 24 $\mu$m sources in the two GOODS fields have been classified on the basis
of their $L(\textnormal{IR})$ AGN fraction, $L(60)/L(100)$ color and $L(160)/L(1.6)$ flux
ratio, as derived by SED fitting with our new library.
The incidence of warmer sources grows for objects with higher
sSFR, in line with what is found by Magnelli et al.
(in prep.) through a detailed study of $T_{\rm dust}$
in the $M_\ast$--$\textnormal{SFR}$ plane, and with results on the $L-T$ relation
of IR SEDs by \citet{symeonidis2013}.
AGN appear to be distributed along with all
other galaxies, above $M_\ast\sim 10^{10}$ M$_\odot$,
with the tendency to lie on the high SFR side of the
``main sequence'', but with no evident dependence on the fraction
of infrared luminosity they are powering.
\end{itemize}
The new library of semi-empirical SEDs describes
the actual scatter of FIR detected sources in color space, from the UV to
the FIR itself. Direct applications can span from deriving the
contribution of AGN and various populations to mid and FIR luminosity functions
and $L(\textnormal{IR})$ or SFR density as a function of look-back time \citep[see also][]{gruppioni2013},
to describing the SEDs of individual sources.
\begin{acknowledgements}
The authors wish to thank Dr. Jacopo Fritz for providing his
library of AGN torus emission models, and the anonymous referee for
her/his useful comments.
This work made use of the code {\sc FastEM}, distributed by the Auton Lab, and developed by
Andrew Moore, Paul Hsiung, Peter Sand, point of contact Saswati Ray.
PACS has been developed by a consortium of institutes led by MPE (Germany) and
including UVIE (Austria); KU Leuven, CSL, IMEC (Belgium); CEA, LAM (France);
MPIA (Germany); INAF-IFSI/OAA/OAP/OAT, LENS, SISSA (Italy); IAC (Spain).
This development has been supported by the funding agencies BMVIT (Austria),
ESA-PRODEX (Belgium), CEA/CNES (France), DLR (Germany), ASI/INAF (Italy),
and CICYT/MCYT (Spain). SPIRE has been developed by a consortium of institutes
led by Cardiff University (UK) and including University of Lethbridge (Canada),
NAOC (China), CEA, LAM (France), IFSI, University of Padua (Italy), IAC
(Spain), Stockholm Observatory (Sweden), Imperial College London, RAL,
UCL-MSSL, UKATC, University of Sussex (UK), Caltech, JPL, NHSC,
University of Colorado (USA). This development has been supported by national
funding agencies: CSA (Canada); NAOC (China); CEA, CNES, CNRS (France);
ASI (Italy); MCINN (Spain); SNSB (Sweden); STFC, UKSA (UK) and NASA
(USA).
\end{acknowledgements}
\bibliographystyle{aa}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,145 |
# Table of Contents
Node.js Web Development Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. About Node.js
The capabilities of Node.js
Server-side JavaScript
Why should you use Node.js?
Popularity
JavaScript at all levels of the stack
Leveraging Google's investment in V8
Leaner asynchronous event-driven model
Microservice architecture
The Node.js is stronger for having survived a major schism and hostile fork
Performance and utilization
Is Node.js a cancerous scalability disaster?
Server utilization, the bottom line, and green web hosting
Node.js, the microservice architecture, and easily testable systems
Node.js and the Twelve-Factor app model
Summary
2. Setting up Node.js
System requirements
Installing Node.js using package managers
Installing on Mac OS X with MacPorts
Installing on Mac OS X with Homebrew
Installing on Linux, *BSD, or Windows from package management systems
Installing the Node.js distribution from nodejs.org
Installing from source on POSIX-like systems
Installing prerequisites
Native code modules and node-gyp
Installing developer tools on Mac OS X
Installing from source for all POSIX-like systems
Installing development instances with nvm
Node.js versions policy and what to use
Running and testing commands
Node.js's command-line tools
Running a simple script with Node.js
Launching a server with Node.js
NPM – the Node.js package manager
Node.js and ECMAScript 6 (ES-2015, ES-2016, and so on)
Using Babel to use experimental JavaScript features
Summary
3. Node.js Modules
Defining a module
Node.js module format
File modules
Demonstrating module-level encapsulation
Directories as modules
Node.js's algorithm for require (module)
Module identifiers and path names
An example application directory structure
npm – the Node.js package management system
The npm package format
Finding npm packages
Other npm commands
Installing an npm package
Initializing a new npm package
Maintaining package dependencies with npm
Fixing bugs by updating package dependencies
Declaring Node.js version compatibility
Updating outdated packages you've installed
Installing packages from outside the npm repository
Publishing an npm package
Package version numbers
A quick note about CommonJS
Summary
4. HTTP Servers and Clients – A Web Application's First Steps
Sending and receiving events with EventEmitters
The EventEmitter theory
HTTP server applications
ES-2015 multiline and template strings
HTTP Sniffer – listening to the HTTP conversation
Web application frameworks
Getting started with Express
Walking through the default Express application
The Express middleware
Middleware and request paths
Error handling
Calculating the Fibonacci sequence with an Express application
Computationally intensive code and the Node.js event loop
Algorithmic refactoring
Making HTTP Client requests
Calling a REST backend service from an Express application
Implementing a simple REST server with Express
Refactoring the Fibonacci application for REST
Some RESTful modules and frameworks
Summary
5. Your First Express Application
ES-2015 Promises and Express router functions
Promises and error handling
Flattening our asynchronous code
Additional tools
Express and the MVC paradigm
Creating the Notes application
Your first Notes model
The Notes home page
Adding a new note – create
Viewing notes – read
Editing an existing note – update
Deleting notes – destroy
Theming your Express application
Scaling up – running multiple Notes instances
Summary
6. Implementing the Mobile-First Paradigm
Problem – the Notes app isn't mobile friendly
Mobile-first paradigm
Using Twitter Bootstrap on the Notes application
Setting it up
Adding Bootstrap to application templates
Mobile-first design for the Notes application
Laying the Bootstrap grid foundation
Improving the notes list on the front page
Breadcrumbs for the page header
Cleaning up the add/edit note form
Building a customized Bootstrap
Bootstrap customizers
Summary
7. Data Storage and Retrieval
Data storage and asynchronous code
Logging
Request logging with Morgan
Debugging messages
Capturing stdout and stderr
Uncaught exceptions
Storing notes in the filesystem
Storing notes with the LevelUP data store
Storing notes in SQL with SQLite3
SQLite3 database scheme
SQLite3 model code
Running Notes with SQLite3
Storing notes the ORM way with Sequelize
Sequelize model for the Notes application
Configuring a Sequelize database connection
Running the Notes application with Sequelize
Storing notes in MongoDB
MongoDB model for the Notes application
Running the Notes application with MongoDB
Summary
8. Multiuser Authentication the Microservice Way
Creating a user information microservice
User information model
A REST server for user information
Scripts to test and administer the User Authentication server
Login support for the Notes application
Accessing the user authentication REST API
Login and logout routing functions
Login/logout changes to app.js
Login/logout changes in routes/index.js
Login/logout changes required in routes/notes.js
View template changes supporting login/logout
Running the Notes application with user authentication
Twitter login support for the Notes application
Registering an application with Twitter
Implementing TwitterStrategy
The Notes application stack
Summary
9. Dynamic Interaction between Client and Server with Socket.IO
Introducing Socket.IO
Initializing Socket.IO with Express
Real time updates on the Notes home page
The Notes model as an EventEmitter class
Real-time changes in the Notes home page
Changing the home page template
Running Notes with real-time home page updates
Real-time action while viewing notes
Changing the note view template for real-time action
Running Notes with real-time updates while viewing a note
Inter-user chat and commenting for Notes
Data model for storing messages
Adding messages to the Notes router
Changing the note view template for messages
Using a Modal window to compose messages
Sending, displaying, and deleting messages
Running Notes and passing messages
Other applications of Modal windows
Summary
10. Deploying Node.js Applications
Notes application architecture
Traditional Linux Node.js service deployment
Prerequisite – provisioning the databases
Installing Node.js on Ubuntu
Setting up Notes and User Authentication on the server
Setting up PM2 to manage Node.js processes
Twitter support for the hosted Notes app
Node.js microservice deployment with Docker
Installing Docker on your laptop
Starting Docker using Docker Toolbox and Docker Machine
Starting Docker with Docker for Windows/Mac
Kicking the tires of Docker
Creating the AuthNet for the User Authentication service
MySQL for the Authentication service
Dockerizing the Authentication service
Putting Authnet together
Creating FrontNet for the Notes application
MySQL for the Notes application
Dockerizing the Notes application
Putting FrontNet together
Configuring remote access on Docker for Windows or Mac
Configuring remote access in VirtualBox on Docker toolbox
Exploring the Docker Toolbox VirtualBoxMachine
Controlling the location of MySQL data volumes
Deploying to the cloud with Docker compose
Docker compose files
Running the Notes application with Docker Compose
Deploying to cloud hosting with Docker Compose
Summary
11. Unit Testing
Testing asynchronous code
Assert – the simplest testing methodology
Testing a model
Mocha and Chai the chosen test tools
Notes model test suite
Configuring and running tests
More tests for the Notes model
Testing database models
Using Docker to manage test database servers
Docker Compose to orchestrate test infrastructure
Package.json scripts for Dockerized test infrastructure
Executing tests under Docker Compose
Testing REST backend services
Frontend headless browser testing with CasperJS
Setup
Improving testability in Notes UI
CasperJS test script for Notes
Running the UI test with CasperJS
Summary
Index
# Node.js Web Development Third Edition
* * *
# Node.js Web Development Third Edition
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2011
Second published: July 2013
Third edition: June 2016
Production reference: 1220616
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-150-3
www.packtpub.com
# Credits
**Author**
David Herron
**Reviewer**
Nicholas Duffy
**Commissioning Editor**
Amarabha Banerjee
**Acquisition Editor**
Larissa Pinto
**Content Development Editor**
Samantha Gonsalves
**Technical Editor**
Vivek Pala
**Copy Editor**
Pranjali Chury
**Project Coordinator**
Sanchita Mandal
**Proofreader**
Safis Editing
**Indexer**
Mariammal Chettiyar
**Graphics**
Disha Haria
**Production Coordinator**
Manu Joseph
**Cover Work**
Manu Joseph
# About the Author
**David Herron** has worked as a software engineer in Silicon Valley for over 20 years. This includes companies both tiny and large. He has worked on a wide variety of projects, from an X.400 e-mail server and client application to assisting with the launch of the OpenJDK project (open source Java rocks), to Yahoo's Node.js application-hosting platform (Mojito and Manhattan), and applications to monitor solar power array performance.
While a staff engineer at Sun Microsystems, David worked as the architect of the Java SE Quality Engineering team where he focused on test automation tools, including co-developing the AWT Robot class. He was involved in open source activities related to Java, including the OpenJDK project.
Before Sun, he worked for VXtreme on software which eventually became Windows Media Player when Microsoft bought the company. At Mainsoft, David worked on a library that allowed developers to recompile Windows applications on Unix, and then participated in porting Internet Explorer to Unix. At The Wollongong Group, he worked on both e-mail client and server software and was part of several IETF working groups improving e-mail-related protocols.
David is interested in electric vehicles, world energy supplies, climate change, and environmental issues, and he is a co-founder of Transition Silicon Valley. As an online journalist, he writes about electric cars and other green technology on LongTailPipe.com after having written for PlugInCars.com. He runs a large electric vehicle discussion website on VisForVoltage.org, and he blogs about other topics, including Node.js, Drupal, and Doctor Who on DavidHerron.com. Using Node.js, he developed a Content Management System that produces static HTML websites or EPUB3 eBooks, AkashaCMS (akashacms.com).
****
There are many people I am grateful to.
I wish to thank my mother, Evelyn, for, well everything; my father, Jim; my sister, Patti; and my brother, Ken. What would life be without all of you?
I wish to thank my girlfriend, Maggie, for being there and encouraging me, her belief in me, her wisdom, and humor. May we have many more years of this.
I wish to thank Dr. Ken Kubota of the University of Kentucky for believing in me and giving me my first job in computing. It was six years of learning not just the art of computer system maintenance, but so much more.
I wish to thank my former employers, University of Kentucky Mathematical Sciences Department, The Wollongong Group, MainSoft, VXtreme, Sun Microsystems, Yahoo!, Recargo, Laplace Systems, and all the people I worked with in each company.
I am grateful to Ryan Dahl, the creator of Node.js, and the current Node.js core team members. They have the rare combination of wisdom and vision needed to create such a joy-filled fluid software development platform. Some platforms are just plain hard to work with, but not this one.
# About the Reviewer
**Nicholas Duffy** has had a wide-ranging career, holding positions from analyst to business intelligence architect, to software engineer, and even golf professional. He has a passion for all things data and software engineering, specializing in data warehouse architecture, Python, and Node.js. He is a frequent contributor to open source projects and is, unfortunately, also a lifelong New York Mets fan.
You can read more about Nicholas' interests on this blog at <https://medium.com/@duffn> or contact him via GitHub at `@duffn`.
****
I'd like to thank my wife, Anne, and boys, Jack and Chuck, for their never ending support in whatever endeavor.
# www.PacktPub.com
# eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at `<customercare@packtpub.com>` for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
<https://www2.packtpub.com/books/subscription/packtlib>
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
## Why subscribe?
* Fully searchable across every book published by Packt
* Copy and paste, print, and bookmark content
* On demand and accessible via a web browser
# Preface
Welcome to the world of software development on the Node.js platform. This is an up-and-coming software platform that liberates JavaScript from the web browser, allowing us to reuse our JavaScript skills for general software development on a large range of systems. It runs atop the ultra-fast JavaScript engine at the heart of Google's Chrome browser, V8, and adds a fast and robust library of asynchronous network I/O modules. The Node.js community have developed a dizzyingly large body of third-party modules for nearly every conceivable purpose. While the primary focus of Node.js is high performance highly-scalable web applications, it is seeing widespread use in Internet of Things (IoT) applications, microservice development, asset build workflow for frontend engineers, and even in desktop applications like the Atom editor.
Microservices are one of the brightest ideas in computing today, and Node.js is right there as one of the best platforms for microservice development. This is doubly true when combined with Docker.
In just a few years, Node.js has gone from being a brand new "will anyone adopt it" technology to a major force in software development. It is now widely used in companies big and small, and the MEAN Stack (MongoDB, Express, AngularJS, and Node.js) has become a leading application model.
The Node.js platform was developed by Ryan Dahl in 2009 after a couple years of experimenting with web server component development in Ruby and other languages. His goal was to create an event-oriented system with a low-overhead architecture. This led Dahl toward an asynchronous single-thread system, as opposed to a more traditional thread-based architecture.
This model was chosen for simplicity, under the theory that threaded systems are notoriously difficult to develop and debug for lower overhead and for speed. Node.js's goal is to provide "an easy way to build scalable network servers." The design is similar to, and influenced by, other systems, such as Event Machine (Ruby) and the Twisted framework (Python).
JavaScript was chosen as the language because anonymous functions and other language elements provide an excellent base to implement asynchronous computation. Event handler functions are often coded in-line as anonymous functions. The Node.js runtime is ingeniously designed to support asynchronous I/O operations.
Now that ECMA Script 2016 is on the scene, new features, such as arrow functions and Promises, are coming to JavaScript engines, including Node.js. These powerful new capabilities will change JavaScript programming for the better. We now have a path toward taming some of the difficulties with asynchronous coding. The Promise object gives us a way to organize asynchronously-executed procedures in a semi-linear sequence, rather than the pyramid-shaped structures of callback functions.
The result is a platform that allows developers to not only succinctly write code of great power but to have a lot of fun while doing so.
Having JavaScript on both the server and the client (browser) lets us implement a vision dating back to the earliest days of the World Wide Web. Java's proponents first showed us dynamic stuff, powered by Java, running inside a web page. With Java on both client and server side, developers were supposed to reach nirvana. Java did not achieve success promoted by Sun Microsystems. Instead, it is JavaScript that is quickly advancing to implement that vision in a big way.
With Node.js, we have JavaScript on both the client and the server. While this probably won't help developers reach nirvana, our work is made much easier. We can use common code, common data structures, and more team members speak the same code language.
This book, _Node.js Web Development, Third Edition_ , focuses on building web applications using Node.js. We assume that you have some knowledge of JavaScript and maybe even have server-side development experience. We will take a tour through the important concepts in order to understand Node.js programming.
To do so, we'll develop several applications, including a Note-taking application that will take several chapters to implement data storage with several database engines, user authentication, including OAuth2 against Twitter, real-time communications between users, and server deployment, including Docker. Along the way, we'll explore leading application development best practices, distributing heavy workloads to backend servers, and implementing REST microservices for multitiered architectures.
# What this book covers
Chapter 1, _About Node.js_ , introduces you to the Node.js platform. It covers its uses, the technological architecture choices in Node.js, its history, the history of server-side JavaScript, and why JavaScript should be liberated from the browser.
Chapter 2, _Setting up Node.js_ , goes over setting up a Node.js developer environment. This includes installing Node.js on Windows, Mac OS X, and Linux, the command-line tools using ECMA Script 2015 features in Node.js, and the npm package management system.
Chapter 3, _Node.js Modules_ , explores the module as the unit of modularity of Node.js applications. We dive deep into understanding and developing Node.js modules and using npm to maintain our dependency list.
Chapter 4, _HTTP Servers and Clients – A Web Applications First Steps_ , starts exploring web development with Node.js. We develop several small webserver and client applications in Node.js. We use the Fibonacci algorithm to explore the effects of heavy-weight long-running computations on a Node.js application, as well as several mitigation strategies. This gives us our first exposure to REST-based service development.
Chapter 5, _Your First Express Application_ , begins several chapters of developing a note-taking application. The first step is getting a basic application running.
Chapter 6, _Implementing the Mobile-First Paradigm_ , uses the Bootstrap framework to implement responsive web design. Supporting mobile devices from the outset is a driving paradigm in modern software development.
Chapter 7, _Data Storage and Retrieval_ , ensures that we don't lose our notes when restarting the application. We explore several database engines, and a method to make it easy to switch between them at will.
Chapter 8, _Multiuser Authentication the Microservice Way_ , adds user authentication to the note-taking application. It can be used by both logged in and anonymous users with different capabilities for each. Authentication is supported against both a local user registry and using OAuth2 against Twitter.
Chapter 9, _Dynamic Interaction between Client and Server with Socket.IO_ , lets our users talk to each other in real time. JavaScript code will be written in both browser and server, with Socket.IO providing the plumbing needed for real-time event exchange. Users will see notes change as they're edited by other users, or they will read and write notes that others can see.
Chapter 10, _Deploying Node.js Applications_ , helps us understand Node.js application deployment. We look at both traditional Linux service deployment using an `/etc/init` script and using Docker to easily deploy an infrastructure of two databases and two Node.js services.
Chapter 11, _Unit Testing_ , takes a look at three test development models: Unit Testing, REST testing, and functional testing. In addition to the Mocha and Chai frameworks, we use CasperJS to run automated tests in a headless browser component. Docker is used to facilitate test infrastructure deployment.
# What you need for this book
The basic requirement is to install Node.js and to have a programmer-oriented text editor. We will show you how to install everything that you need, all of which is open source software, easily downloaded from the web. The most important tool is the one between your ears.
The examples here were tested using Node.js v5.x and ECMA Script 2015 features are widely used.
Some chapters require the database engines, MySQL and MongoDB.
While Node.js supports cross-platform software development, some of the third-party modules require compilation from source code. This means that one must have C/C++ compiler tools and Python installed. The details are covered in Chapter 2, _Setting up Node.js_.
While this book is about developing web applications, it does not require you to have a web server. Node.js provides its own web server stack.
# Who this book is for
This book is written for any software engineer who wants the adventure that comes with a new software platform embodying a new programming paradigm.
Server-side engineers may find the concepts behind Node.js refreshing, giving you a different perspective on web application development. JavaScript is a powerful language, and Node.js's asynchronous nature plays to its strengths.
Developers experienced with JavaScript in the browser may find it fun to bring that knowledge to new territory.
We assume that you already know how to write software and have an understanding of modern programming languages such as JavaScript.
# Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The implementation of this is in `views/pageHeader.ejs`."
A block of code is set as follows:
router.get('/auth/twitter/callback',
passport.authenticate('twitter', { successRedirect: '/',
failureRedirect: '/users/login' }));
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
<a class="btn btn-primary" href="/users/login">Log in</a>
**< a class="btn btn-primary" href="/users/auth/twitter"><img width="15px" src="/images/twitter-brand-logos/TwitterLogo_white.png"/>Log in with Twitter</a>**
<% } %>
Any command-line input or output is written as follows:
**$ npm start**
**New terms** and **important words** are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "You now have both **Log Out** and **ADD Note** buttons."
### Note
Warnings or important notes appear in a box like this.
### Tip
Tips and tricks appear like this.
# Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail `<feedback@packtpub.com>`, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
# Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
## Downloading the example code
You can download the example code files for this book from your account at <http://www.packtpub.com>. If you purchased this book elsewhere, you can visit <http://www.packtpub.com/support> and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the **SUPPORT** tab at the top.
3. Click on **Code Downloads & Errata**.
4. Enter the name of the book in the **Search** box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on **Code Download**.
You can also download the code files by clicking on the **Code Files** button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the **Search** box. Please note that you need to be logged in to your Packt account.
* WinRAR / 7-Zip for Windows
* Zipeg / iZip / UnRarX for Mac
* 7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at <https://github.com/PacktPublishing/Node.js-Web-Development-Third-Edition> We also have other code bundles from our rich catalog of books and videos available at <https://github.com/PacktPublishing/>. Check them out!
## Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting <http://www.packtpub.com/submit-errata>, selecting your book, clicking on the **Errata Submission Form** link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to <https://www.packtpub.com/books/content/support> and enter the name of the book in the search field. The required information will appear under the **Errata** section.
## Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at `<copyright@packtpub.com>` with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
## Questions
If you have a problem with any aspect of this book, you can contact us at `<questions@packtpub.com>`, and we will do our best to address the problem.
# Chapter 1. About Node.js
Node.js is an exciting new platform for developing web applications, application servers, any sort of network server or client, and general purpose programming. It is designed for extreme scalability in networked applications through an ingenious combination of server-side JavaScript, asynchronous I/O, asynchronous programming, built around JavaScript anonymous functions, and a single execution thread event-driven architecture.
While only a few years old, Node.js has quickly grown in prominence to where it's playing a significant role. Companies, small and large, are using it for large-scale and small-scale projects. PayPal, for example, has converted many services from Java to Node.js.
The Node.js model is very different from common application server platforms using threads. The claim is that with the single-thread event-driven architecture, memory footprint is low, throughput is high, the latency profile under load is better, and the programming model is simpler. The Node.js platform is in a phase of rapid growth, and many are seeing it as a compelling alternative to the traditional Java, PHP, Python, Ruby on Rails, and so on, approach to building web applications.
At its heart, it is a standalone JavaScript engine with extensions making it suitable for general purpose programming and with a clear focus on application server development. Even though we're comparing Node.js to application server platforms, it is not an application server. Instead, Node.js is a programming runtime akin to Python, Go, or Java SE. There are web application frameworks and application servers written in Node.js, however. In the few years that Node.js has been available, it's quickly gained a significant role, fulfilling the prediction that it could potentially supplant other web application stacks.
It is implemented around a non-blocking I/O event loop and a layer of file and network I/O libraries, all built on top of the V8 JavaScript engine (from the Chrome web browser). At the time of writing this, Microsoft had just proposed a patch to allow Node.js to utilize the ChakraCore JavaScript engine (from the Edge web browser). The theoretical possibility of hosting the Node.js API on top of a different JavaScript engine may come true, in the due course of time. Visit <https://github.com/nodejs/node-chakracore> to take a look at the project.
The I/O library is general enough to implement any sort of server implementing any TCP or UDP protocol, whether it's DNS, HTTP, IRC, or FTP. While it supports developing servers or clients for any network protocol, its biggest use case is in regular websites in place of technology such as an Apache/PHP or Rails stack or to complement existing websites. For example, adding real-time chat or monitoring existing websites can be easily done with the Socket.IO library for Node.js.
A particularly intriguing combination is deploying small services using Docker into cloud hosting infrastructure. A large application can be divided into what's now called microservices and easily deployed at scale using Docker. The result fits agile project management methods since each microservice can be easily managed by a small team which collaborates at the boundary of their individual API.
This book will give you an introduction to Node.js. We presume the following:
* You already know how to write software
* You are familiar with JavaScript
* You know something about developing web applications in other languages
We will cover the following topics in this chapter:
* An introduction to Node.js
* Why you should use Node.js
* The architecture of Node.js
* Performance, utilization, and scalability with Node.js
* Node.js, microservice architecture, and testing
* Implementing the Twelve-Factor App model with Node.js
We will dive right into developing working applications and recognize that often the best way to learn is by rummaging around in working code.
# The capabilities of Node.js
Node.js is a platform for writing JavaScript applications outside web browsers. This is not the JavaScript we are familiar with in web browsers! For example, there is no DOM built into Node.js, nor any other browser capability.
Beyond its native ability to execute JavaScript, the bundled modules provide capabilities of this sort:
* Command-line tools (in shell script style)
* An interactive-TTY style of program (REPL which stands for Read-Eval-Print Loop)
* Excellent process control functions to oversee child processes
* A buffer object to deal with binary data
* TCP or UDP sockets with comprehensive event-driven callbacks
* DNS lookup
* An HTTP and HTTPS client/server layered on top of the TCP library filesystem access
* Built-in rudimentary unit testing support through assertions
The network layer of Node.js is low level while being simple to use. For example, the HTTP modules allow you to write an HTTP server (or client) using a few lines of code. This is powerful, but it puts you, the programmer, very close to the protocol requests and makes you implement precisely those HTTP headers that you should return in request responses.
In other words, it's very easy to write an HTTP server in Node.js, but the typical web application developer doesn't need to work at that level of detail. For example, PHP coders assume that Apache is already there, and that they don't have to implement the HTTP server portion of the stack. The Node.js community has developed a wide range of web application frameworks such as Express, allowing developers to quickly configure an HTTP server that provides all of the basics we've come to expect—sessions, cookies, serving static files, logging, and so on—thus letting developers focus on their business logic.
## Server-side JavaScript
Quit scratching your head already. Of course you're doing it, scratching your head and mumbling to yourself, "What's a browser language doing on the server?". In truth, JavaScript has a long and largely unknown history outside the browser. JavaScript is a programming language, just like any other language, and the better question to ask is "Why should JavaScript remain trapped inside browsers?".
Back in the dawn of the web age, the tools for writing web applications were at a fledgling stage. Some were experimenting with Perl or TCL to write CGI scripts, and the PHP and Java languages had just been developed. Even then, JavaScript saw use on the server side. One early web application server was Netscape's LiveWire server, which used JavaScript. Some versions of Microsoft's ASP used JScript, their version of JavaScript. A more recent server-side JavaScript project is the RingoJS application framework in the Java universe In other words, JavaScript outside the browser is not a new thing, even if it is uncommon.
# Why should you use Node.js?
Among the many available web application development platforms, why should you chose Node.js? There are many stacks to choose from; What is it about Node.js that makes it rise above the others? We will see in the following sections.
## Popularity
Node.js is quickly becoming a popular development platform with adoption from plenty of big and small players. One of those is PayPal, who are replacing their incumbent Java-based system with one written in Node.js. For PayPal's blog post about this, visit <https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/>. Other large Node.js adopters include Walmart's online e-commerce platform, LinkedIn, and eBay.
Since we shouldn't just follow the crowd, let's look at technical reasons to adopt Node.js.
## JavaScript at all levels of the stack
Having the same programming language on the server and client has been a long time dream on the web. This dream dates back to the early days of Java, where Java applets were to be the frontend to server applications written in Java, and JavaScript was originally envisioned as a lightweight scripting language for those applets. Java never fulfilled the hype and we ended up with JavaScript as the principle in-browser client-side language, rather than Java. With Node.js we may finally be able to implement applications with the same programming language on the client and server by having JavaScript at both ends of the web, in the browser and server.
A common language for frontend and backend offers several potential wins:
* The same programming staff can work on both ends of the wire
* Code can be migrated between server and client more easily
* Common data formats (JSON) exist between server and client
* Common software tools exist for server and client
* Common testing or quality reporting tools for server and client
* When writing web applications, view templates can be used on both sides
The JavaScript language is very popular due to its ubiquity in web browsers. It compares favorably against other languages while having many modern advanced language concepts. Thanks to its popularity, there is a deep talent pool of experienced JavaScript programmers out there.
## Leveraging Google's investment in V8
To make Chrome a popular and excellent web browser, Google invested in making V8 a super-fast JavaScript engine. The competition to make the best web browser leads Google to keep on improving V8. As a result, Node.js programmers automatically win as each V8 iteration ratchets up performance and capabilities.
The Node.js community may change things to utilize any JavaScript engine, in case another one ends up surpassing V8.
## Leaner asynchronous event-driven model
We'll get into this later. The Node.js architecture, a single execution thread and a fast JavaScript engine, has less overhead than thread-based architectures.
## Microservice architecture
A new hotness in software development is the microservice idea. Node.js is an excellent platform for implementing microservices. We'll get into this later.
## The Node.js is stronger for having survived a major schism and hostile fork
During 2014 and 2015, the Node.js community faced a major split over policy, direction, and control. The _io.js_ project was a hostile fork driven by a group who wanted to incorporate several features and change who's in control of making decisions. What resulted is a merge of the Node.js and io.js repositories, an independent Node.js foundation to run the show, and the community is working together to move forward in a common direction.
Threaded versus event-driven architecture Node.js's blistering performance is said to be because of its asynchronous event-driven architecture, and its use of the V8 JavaScript engine. That's a nice thing to say, but what's the rationale for the statement?
The normal application server model uses blocking I/O to retrieve data, and it uses threads for concurrency. Blocking I/O causes threads to wait, causing a churn between threads as they are forced to wait on I/O while the application server handles requests. Threads add complexity to the application server as well as server overhead.
Node.js has a single execution thread with no waiting on I/O or context switching. Instead, there is an event loop looking for events and dispatching them to handler functions. The paradigm is that any operation that would block or otherwise take time to complete must use the asynchronous model. These functions are to be given an anonymous function to act as a handler callback, or else (with the advent of ES2015 promises), the function would return a Promise. The handler function, or promise, is invoked when the operation is complete. In the meantime, control returns to the event loop, which continues dispatching events.
To help us wrap our heads around this, Ryan Dahl, the creator of Node.js, (in his _Cinco de Node_ presentation) asked us what happens while executing a line of code like this:
result = query('SELECT * from db');
// operate on the result
Of course, the program pauses at that point while the database layer sends the query to the database, which determines the result and returns the data. Depending on the query, that pause can be quite long. Well, a few milliseconds, which is an eon in computer time. This pause is bad because while the entire thread is idling, another request might come in and need to be handled. This is where a thread-based server architecture would need to make a thread context switch. The more outstanding connections to the server, the greater the number of thread context switches. Context switching is not free because more threads requires more memory for per-thread state and more time for the CPU to spend on thread management overhead.
Simply using an asynchronous event-driven I/O, Node.js removes most of this overhead while introducing very little of its own.
Using threads to implement concurrency often comes with admonitions like these: _expensive and error-prone_ , _the error-prone synchronization primitives of Java_ , or _designing concurrent software can be complex and error prone_. The complexity comes from the access to shared variables and various strategies to avoid deadlock and competition between threads. The _synchronization primitives of Java_ are an example of such a strategy, and obviously many programmers find them difficult to use. There's the tendency to create frameworks such as `java.util.concurrent` to tame the complexity of threaded concurrency, but some might argue that papering over complexity does not make things simpler.
Node.js asks us to think differently about concurrency. Callbacks fired asynchronously from an event loop are a much simpler concurrency model—simpler to understand, and simpler to implement.
Ryan Dahl points to the relative access time of objects to understand the need for asynchronous I/O. Objects in memory are more quickly accessed (on the order of nanoseconds) than objects on disk or objects retrieved over the network (milliseconds or seconds). The longer access time for external objects is measured in zillions of clock cycles, which can be an eternity when your customer is sitting at their web browser ready to move on if it takes longer than two seconds to load the page.
In Node.js, the query discussed previously will read as follows:
query('SELECT * from db', function (err, result) {
if (err) throw err; // handle errors
// operate on result
});
Or if written with an ES2015 Promise:
query('SELECT * from db')
.then(result => {
// operate on result
})
.catch(err => {
// handle errors
});
This code performs the same query written earlier. The difference is that the query result is not the result of the function call, but it is provided to a callback function that will be called later. The order of execution is not one line after another, but it is instead determined by the order of callback function execution.
Once the call to the `query` function finishes, control will return almost immediately to the event loop, which goes on to servicing other requests. One of those requests will be the response to the query, which invokes the callback function.
Commonly, web pages bring together data from dozens of sources. Each one has a query and response as discussed earlier. Using asynchronous queries, each one can happen in parallel, where the page construction function can fire off dozens of queries—no waiting, each with their own callback—and then go back to the event loop, invoking the callbacks as each is done. Because it's in parallel, the data can be collected much more quickly than if these queries were done synchronously one at a time. Now, the reader on the web browser is happier because the page loads more quickly.
## Performance and utilization
Some of the excitement over Node.js is due to its throughput (the requests per second it can serve). Comparative benchmarks of similar applications, for example, Apache show that Node.js has tremendous performance gains.
One benchmark going around is this simple HTTP server (borrowed from <https://nodejs.org/en/>), which simply returns a "Hello World" message directly from memory:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
This is one of the simpler web servers one can build with Node.js. The `http` object encapsulates the HTTP protocol, and its `http.createServer` method creates a whole web server, listening on the port specified in the `listen` method. Every request (whether a `GET` or `POST` on any URL) on that web server calls the provided function. It is very simple and lightweight. In this case, regardless of the URL, it returns a simple `text/plain` Hello World response.
Ryan Dahl (Node.js's original author) showed a simple benchmark (<http://nodejs.org/cinco_de_node.pdf>) that returned a 1-megabyte binary buffer; Node.js gave 822 req/sec while Nginx gave 708 req/sec, for a 15% improvement over Nginx. He also noted that Nginx peaked at 4 megabytes memory, while Node.js peaked at 64 megabytes.
Yahoo! search engineer Fabian Frank published a performance case study of a real-world search query suggestion widget implemented with Apache/PHP and two variants of Node.js stacks (<http://www.slideshare.net/FabianFrankDe/nodejs-performance-case-study>). The application is a pop-up panel showing search suggestions as the user types in phrases, using a JSON-based HTTP query. The Node.js version could handle eight times the number of requests per second with the same request latency. Fabian Frank said both Node.js stacks scaled linearly until CPU usage hit 100%. In another presentation (<http://www.slideshare.net/FabianFrankDe/yahoo-scale-nodejs>), he discussed how Yahoo!Axis is running on Manhattan + Mojito and the value of being able to use the same language (JavaScript) and framework (YUI/YQL) on both frontend and backend.
LinkedIn did a massive overhaul of their mobile app using Node.js for the server-side to replace an old Ruby on Rails app. The switch let them move from 30 servers down to three, and allowed them to merge the frontend and backend team because everything was written in JavaScript. Before choosing Node.js, they'd evaluated Rails with Event Machine, Python with Twisted, and Node.js, choosing Node.js for the reasons that we just discussed. For a look at what LinkedIn did, see <http://arstechnica.com/information-technology/2012/10/a-behind-the-scenes-look-at-linkedins-mobile-engineering/>.
Mikito Takada blogged about benchmarking and performance improvements in a _48 hour hackathon_ application (<http://blog.mixu.net/2011/01/17/performance-benchmarking-the-node-js-backend-of-our-48h-product-wehearvoices-net/>) he built comparing Node.js with what he claims is a similar application written with Django (a web application framework for Python). The unoptimized Node.js version is quite a bit slower (in response time) than the Django version but a few optimizations (MySQL connection pooling, caching, and so on) made drastic performance improvements handily beating out Django.
## Is Node.js a cancerous scalability disaster?
In October 2011, software developer and blogger Ted Dziuba wrote an infamous blog post (since pulled from his blog) claiming that Node.js is a cancer, calling it a "scalability disaster". The example he showed for proof is a CPU-bound implementation of the Fibonacci sequence algorithm. While his argument was flawed, he raised a valid point that Node.js application developers have to consider—where do you put the heavy computational tasks?
A key to maintaining high throughput of Node.js applications is ensuring that events are handled quickly. Because it uses a single execution thread, if that thread is bogged down with a big calculation, it cannot handle events, and the system performance will suffer.
The Fibonacci sequence, serving as a stand-in for heavy computational tasks, quickly becomes computationally expensive to calculate, especially for a naïve implementation like this:
var fibonacci = exports.fibonacci = function(n) {
if (n === 1 || n === 2)
return 1;
else
return fibonacci(n-1) + fibonacci(n-2);
}
Yes, there are many ways to calculate Fibonacci numbers more quickly. We are showing this as a general example of what happens to Node.js when event handlers are slow, and not to debate the best ways to calculate mathematics functions:
var http = require('http');
var url = require('url');
var fibonacci = // as above
http.createServer(function (req, res) {
var urlP = url.parse(req.url, true);
var fibo;
res.writeHead(200, {'Content-Type': 'text/plain'});
if (urlP.query['n']) {
fibo = fibonacci(urlP.query['n']);
res.end('Fibonacci '+ urlP.query['n'] +'='+ fibo);
} else {
res.end('USAGE: http://127.0.0.1:8124?n=## where ## is the Fibonacci number desired');
}
}).listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124');
If you call this from the request handler in a Node.js HTTP server, for sufficiently large values of `n` (for example, 40), the server becomes completely unresponsive because the event loop is not running, as this function is grinding through the calculation.
Does this mean that Node.js is a flawed platform? No, it just means that the programmer must take care to identify code with long-running computations and develop a solution. The possible solutions include rewriting the algorithm to work with the event loop or to foist computationally expensive calculations to a backend server.
A simple rewrite dispatches the computations through the event loop, letting the server continue handling requests on the event loop. Using callbacks and closures (anonymous functions), we're able to maintain asynchronous I/O and concurrency promises:
var fibonacciAsync = exports.fibonacciAsync = function(n, done) {
if (n === 1 || n === 2) done(1);
else {
process.nextTick(function() {
fibonacciAsync(n-1, function(val1) {
process.nextTick(function() {
fibonacciAsync(n-2, function(val2) {
done(val1+val2);
});
});
});
});
}
}
Dziuba's valid point wasn't expressed well in his blog post, and it was somewhat lost in the flames following that post. Namely, that while Node.js is a great platform for I/O-bound applications, it isn't a good platform for computationally intensive ones.
## Server utilization, the bottom line, and green web hosting
The striving for optimal efficiency (handling more requests per second) is not just about the geeky satisfaction that comes from optimization. There are real business and environmental benefits. Handling more requests per second, as Node.js servers can do, means the difference between buying lots of servers and buying only a few servers. Node.js can let your organization do more with less.
Roughly speaking, the more servers you buy, the greater the cost, and the greater the environmental impact. There's a whole field of expertise around reducing cost and the environmental impact of running web server facilities, to which that rough guideline doesn't do justice. The goal is fairly obvious—fewer servers, lower costs, and lower environmental impact.
Intel's paper, _Increasing Data Center Efficiency with Server Power Measurements_ (<http://download.intelintel.com/it/pdf/Server_Power_Measurement_final.pdf>), gives an objective framework for understanding efficiency and data center costs. There are many factors such as buildings, cooling systems, and computer system designs. Efficient building design, efficient cooling systems, and efficient computer systems (datacenter efficiency, datacenter density, and storage density) can decrease costs and environmental impact. But you can destroy those gains by deploying an inefficient software stack compelling you to buy more servers than you would if you had an efficient software stack. Alternatively, you can amplify gains from datacenter efficiency with an efficient software stack.
This talk about efficient software stacks isn't just for altruistic environmental purposes. This is one of those cases where being green can help your business bottom line.
## Node.js, the microservice architecture, and easily testable systems
New capabilities such as cloud deployment systems and Docker make it possible to implement a new kind of service architecture. Docker makes it possible to define server process configuration in a repeatable container that's easy to deploy by the millions into a cloud hosting system. It lends itself best to small single-purpose service instances that can be connected together to make a complete system. Docker isn't the only tool to help simplify cloud deployments; however, its features are well attuned to modern application deployment needs.
Some have popularized the microservice concept as a way to describe this kind of system. According to the microservices.io website, a microservice consists of a set of narrowly focused, independently deployable services. They contrast this with the monolithic application deployment pattern where every aspect of the system is integrated into one bundle (such as a single `WAR` file for a Java EE appserver). The microservice model gives developers much needed flexibility.
Some advantages of microservices are as follows:
* Each microservice can be managed by a small team
* Each team can work on its own schedule, so long as the service API compatibility is maintained
* Microservices can be deployed independently, such as for easier testing
* It's easier to switch technology stack choices
Where does Node.js fit with this? Its design fits the microservice model like a glove:
* Node.js encourages small, tightly focused, single purpose modules
* These modules are composed into an application by the excellent npm package management system
* Publishing modules is incredibly simple, whether via the NPM repository or a Git URL
## Node.js and the Twelve-Factor app model
Throughout this book, we'll call out aspects of the Twelve-Factor application model, and ways to implement those ideas in Node.js. This model is published on <http://12factor.net>, and it is a set of guidelines for application deployment in the modern cloud computing era.
The guidelines are straightforward, and once you read them, they seem like pure common sense. As a best practice, the Twelve-Factor model is a compelling strategy for delivering the kind of fluid self-contained cloud deployed applications called for by our current computing environment.
# Summary
You learned a lot in this chapter. Specifically, you saw that JavaScript has a life outside web browsers and you learned about the difference between asynchronous and blocking I/O. We then covered the attributes of Node.js and where it fits in the overall web application platform market and threaded versus asynchronous software. Lastly, we saw the advantages of fast event-driven asynchronous I/O, coupled with a language with great support for anonymous closures.
Our focus in this book is real-world considerations of developing and deploying Node.js applications. We'll cover as many aspects as we can of developing, refining, testing, and deploying Node.js applications.
Now that we've had this introduction to Node.js, we're ready to dive in and start using it. In Chapter 2, _Setting up Node.js_ , we'll go over setting up a Node.js environment, so let's get started.
# Chapter 2. Setting up Node.js
Before getting started with using Node.js, you must set up your development environment. In the following chapters, we'll use this for development and for non-production deployment.
In this chapter, we will cover the following topics:
* How to install Node.js from source and prepackaged binaries on Linux, Mac, or Windows
* How to install the NPM package manager and some popular tools
* The Node.js module system
So let's get on with it.
# System requirements
Node.js runs on POSIX-like operating systems, various UNIX derivatives (Solaris, for example) or workalikes (Linux, Mac OS X, and so on), as well as on Microsoft Windows thanks to extensive assistance from Microsoft. It can run on machines both large and small, including the tiny ARM devices such as the Raspberry Pi microscale embeddable computer for DIY software/hardware projects.
Node.js is now available via package management systems, limiting the need to compile and install from source.
Because many Node.js packages are written in C or C++, you must have a C compiler (such as GCC), Python 2.7 (or later), and the `node-gyp` package. If you plan to use encryption in your networking code, you will also need the OpenSSL cryptographic library. The modern UNIX derivatives almost certainly come with these, and Node.js's configure script, used when installing from source, will detect their presence. If you need to install them, Python is available at <http://python.org> and OpenSSL is available at <http://openssl.org>.
# Installing Node.js using package managers
The preferred method for installing Node.js, now, is to use the versions available in package managers, such as `apt-get`, or Macports. Package managers simplify your life by helping to maintain the current version of the software on your computer, ensuring to update dependent packages as necessary, all by typing a simple command such as `apt-get update`. Let's go over this first.
## Installing on Mac OS X with MacPorts
The MacPorts project (<http://www.macports.org/>) has for years been packaging a long list of open source software packages for Mac OS X, and they have packaged Node.js. After you have installed MacPorts using the installer on their website, installing Node.js is pretty much this simple:
**$ sudo port search nodejs npm**
**nodejs @4.4.3 (devel, net)**
**Evented I/O for V8 JavaScript**
**nodejs-devel @5.10.0 (devel, net)**
**Evented I/O for V8 JavaScript**
**Found 2 ports.**
**--**
**npm @2.15.2 (devel)**
**node package manager**
**npm-devel @3.8.6 (devel)**
**node package manager**
**$ sudo port install nodejs npm**
**.. long log of downloading and installing prerequisites and Node**
**$ which node**
**/opt/local/bin/node**
**$ node --version**
**v4.4.3**
## Installing on Mac OS X with Homebrew
Homebrew is another open source software package manager for Mac OS X, which some say is the perfect replacement for MacPorts. It is available through their home page at <http://brew.sh/>. After installing Homebrew using the instructions on their website and ensuring that Homebrew is correctly set up, use the following:
**$ brew search node**
**leafnode node**
Then, install it this way:
**$ brew install node**
**== > Downloading https://homebrew.bintray.com/bottles/node-5.10.1.el_capitan.bottle.tar.gz**
**######################################################################## 100.0%**
**== > Pouring node-5.10.1.el_capitan.bottle.tar.gz**
**== > Caveats**
**Please note by default only English locale support is provided. If you need**
**full locale support you should:**
**`brew reinstall node --with-full-icu`**
**Bash completion has been installed to:**
**/usr/local/etc/bash_completion.d**
**== > Summary**
**bin /usr/local/Cellar/node/5.10.1: 3,663 files, 35.7M**
Once installed this way, the Node.js command can be run as follows:
**$ node --version**
**v5.5.0**
## Installing on Linux, *BSD, or Windows from package management systems
Node.js is now available through most of the package management systems. Instructions on the Node.js website currently list packaged versions of Node.js for a long list of Linux, as well as FreeBSD, OpenBSD, NetBSD, Mac OS X, and even Windows. Visit <https://nodejs.org/en/download/package-manager/> for more information.
For example, on Debian and other Debian-based Linux' (such as Ubuntu), use the following commands:
**# curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -**
**# sudo apt-get install -y nodejs**
**# sudo apt-get install -y build-essential**
In earlier Node.js releases, a Launchpad PPA maintained by Chris Lea was used instead. That PPA has transitioned to become Nodesource. Visit the Node.js website for further documentation.
## Installing the Node.js distribution from nodejs.org
The <https://nodejs.org/en/> website offers built-in binaries for Windows, Mac OS X, Linux, and Solaris. We can simply go to the website, click on the **install** button, and run the installer. For systems with package managers, such as the ones we've just discussed, it's preferable to use the package management system. That's because you'll find it easier to stay up-to-date with the latest version. Some will prefer to install a binary.
Simply go to <https://nodejs.org/en/> and you'll see something like the following screenshot. Click on the **DOWNLOADS** link in the header to look at all possible downloads:
For Mac OS X, the installer is a `PKG` file giving the typical installation process. For Windows, the installer simply takes you through the typical Install Wizard process.
Once finished with the installer, you have a command-line tool with which you can run Node.js programs.
# Installing from source on POSIX-like systems
Installing the prepackaged Node.js distributions is currently the preferred installation method. However, installing Node.js from source is desirable in a few situations:
* It can let you optimize the compiler settings as desired
* It can let you cross-compile, say, for an embedded ARM system
* You might need to keep multiple Node.js builds for testing
* You might be working on Node.js itself
Now that you have the high-level view, let's get our hands dirty mucking around in some build scripts. The general process follows the usual `configure`, `make`, and `make install` routine that you may already have performed with other open source software packages. If not, don't worry, we'll guide you through the process.
### Note
The official installation instructions are in the README contained within the source distribution at <https://github.com/nodejs/node/blob/master/README.md>.
## Installing prerequisites
As noted in the preceding section, there are three prerequisites: a C compiler, Python, and the OpenSSL libraries. The Node.js installation process checks for their presence and will fail if the C compiler or Python is not present. The specific method of installing these is dependent on your operating system
These commands will check for their presence:
**$ cc --version**
**Apple LLVM version 7.0.2 (clang-700.1.81)**
**Target: x86_64-apple-darwin15.3.0**
**Thread model: posix**
**$ python**
**Python 2.7.11 (default, Jan 8 2016, 22:23:13)**
**[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin**
**Type "help", "copyright", "credits" or "license" for more information.**
**> >>**
## Native code modules and node-gyp
While we won't discuss native code module development in this book, we do need to make sure that they can be built. Some modules in the NPM repository are native code, and they must be compiled with a C or C++ compiler, and build the requisite `.node` files.
The module will often describe itself as a wrapper for some other library. For example, the `libxslt` and `libxmljs` modules are wrappers around the C/C++ libraries of the same name. The module includes the C/C++ source code, and when installed, a script is automatically run to do the compilation with `node-gyp`.
You can easily see this in action by running these commands:
**$ mkdir temp**
**$ cd temp**
**$ npm install libxmljs libxslt**
This is done in a temporary directory, so you can delete it afterward. You'll see in the output a `node-gyp` execution, followed by many lines of text obviously related to compiling C/C++ files.
The `node-gyp` tool is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. We've mentioned native code modules several times, and it is this tool that compiles them for use with Node.js.
Normally, you won't need to worry about installing `node-gyp`. That's because it is installed behind the scenes as part of NPM. It's done so that NPM can automatically build native code modules.
Its GitHub repository contains documentation at <https://github.com/nodejs/node-gyp>.
Reading the `node-gyp` documentation, in its repository, will give you a clearer understanding of the compilation prerequisites discussed previously, as well as developing native code modules.
# Installing developer tools on Mac OS X
Developer tools (such as GCC) are an optional installation on Mac OS X. Fortunately, they're easy to acquire.
You start with Xcode, which is available, for free through the Mac App Store. Simply search for Xcode and click on the **Get** button. Once you have Xcode installed, open a Command Prompt window and type the following:
**$ xcnwode-select --install**
This installs the Xcode command-line tools.
For additional information, visit <http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/>.
## Installing from source for all POSIX-like systems
First, download the source from <http://nodejs.org/download>. One way to do this is with your browser and another way is as follows, substituting your preferred version:
**$ mkdir src**
**$ cd src**
**$ wget https://nodejs.org/dist/v4.2.6/node-v4.2.6.tar.gz**
**$ tar xvfz node-v4.2.6.tar.gz**
**$ cd node-v4.2.6**
The next step is to configure the source so that it can be built. It is done with the typical sort of configure script and you can see its long list of options by running the following:
**$ ./configure –help.**
To cause the installation to land in your home directory, run it this way:
**$ ./configure –prefix=$HOME/node/4.2.6**
**..output from configure**
If you're going to install multiple Node.js versions side by side, it's useful to put the version number in the path like this.
If you want to install Node.js in a system-wide directory, simply leave off the `-prefix` option and it will default to installing in `/usr/local`.
After a moment, it'll stop and will likely have successfully configured the source tree for installation in your chosen directory. If this doesn't succeed, it will print a message about something that needs to be fixed. Once the configure script is satisfied, you can go on to the next step.
With the configure script satisfied, you compile the software:
**$ make**
**.. a long log of compiler output is printed**
**$ make install**
If you are installing into a system-wide directory, do the last step this way, instead:
**$ make**
**$ sudo make install**
Once installed, you should make sure that you add the installation directory to your `PATH` variable as follows:
**$ echo 'export PATH=$HOME/node/4.2.6/bin:${PATH}' >>~/.bashrc**
**$ . ~/.bashrc**
Alternatively, for `csh` users, use this syntax to make an exported environment variable:
**$ echo 'setenv PATH $HOME/node/4.2.6/bin:${PATH}' >>~/.cshrc**
**$ source ~/.cshrc**
This should result in some directories like this:
**$ ls ~/node/4.2.6/**
**bin include lib share**
**$ ls ~/node/4.2.6/bin**
## Installing development instances with nvm
Normally, you won't have multiple versions of Node.js installed and doing so adds complexity to your system. But if you are hacking on Node.js itself, or are testing against different Node.js releases, or are in any similar situation, you may want to have multiple Node.js installations. The method to do so is a simple variation on what we've already discussed.
If you noticed during the instructions discussed earlier, the `–prefix` option was used in a way that directly supports installing several Node.js versions side by side in the same directory:
**$ ./configure –prefix=$HOME/node/4.2.7**
And:
**$ ./configure –prefix=/usr/local/node/4.2.7**
This initial step determines the install directory. Clearly when version 4.2.7 or version 5.5.3 or whichever version is released, you can change the `install` prefix to have the new version installed side by side with previous versions.
To switch between Node.js versions is simply a matter of changing the `PATH` variable (on POSIX systems), as follows:
**$ export PATH=/usr/local/node/4.2.7/bin:${PATH}**
It starts to be a little tedious to maintain this after a while. For each release, you have to set up Node.js, NPM, and any third-party modules you desire in your Node install. Also, the command shown to change your `PATH` is not quite optimal. Inventive programmers have created several version managers to simplify setting up not only Node.js but also NPM and providing commands to change your `PATH` the smart way:
* <https://github.com/visionmedia/n> – Node version manager
* <https://github.com/creationix/nvm> – Node version manager
Both maintain multiple simultaneous versions of Node and let you easily switch between versions. Installation instructions are available on their respective websites.
For example, with `nvm`, you can run commands like these:
**$ nvm ls**
**v0.10.40**
**v0.12.7**
**v4.0.0**
**v4.1.1**
**v4.1.2**
**v4.2.0**
**v5.1.0**
**v5.3.0**
**v5.5.0**
**- > system**
**node - > stable (-> v5.5.0) (default)**
**stable - > 5.5 (-> v5.5.0) (default)**
**$ nvm use v5**
**Now using node v5.5.0 (npm v3.3.12)**
**$ node --version**
**v5.5.0**
**$ nvm use v4.2**
**Now using node v4.2.0 (npm v2.14.7)**
**$ node --version**
**v4.2.0**
**$ nvm install v5.4**
**######################################################################## 100.0%**
**Checksums empty**
**Now using node v5.4.1 (npm v3.3.12)**
**$ node --version**
**v5.4.1**
**$ /usr/bin/node --version**
**v0.10.40**
This demonstrates that you can have a system-wide Node.js installed and keep multiple private Node.js versions and switch between them as needed. When new Node.js versions are released, they are simple to install with `nvm` even if the official packaged version for your OS doesn't immediately update.
# Node.js versions policy and what to use
We just threw around so many different Node.js version numbers in the previous section that you may have become confused over which version to use. This book is targeting Node.js version 5.x, and it's expected that everything we'll cover is compatible with Node.js 5.x and any subsequent release.
Starting with Node.js 4.x, the Node.js team is following a dual-track approach. The even numbered releases (4.x, 6.x, and so on) are what they're calling **Long Term Support** ( **LTS** ), while the odd numbered releases (5.x, 7.x, and so on) are where current new feature development occurs. While the development branch is kept stable, the LTS releases are more positioned as being more appropriate for production use.
At the time of writing this, Node.js 4.x is the current LTS release; Node.js 6.x was just released and will eventually become the LTS release. Refer to <https://github.com/nodejs/LTS/>.
It's likely that everything shown in this book will work on 4.x, but that's not guaranteed.
A major impact of each new Node.js release, beyond the usual performance improvements and bug fixes, is bringing in the latest V8 JavaScript engine release. In turn, this means that we can use more and more of the ES-2015 features as the V8 team progresses towards full ES-2015 and ES-2016 adoption.
A practical consideration is whether a new Node.js release will break your code. New language features are always being added as V8 catches up with ECMA Script, and the Node.js team sometimes makes breaking changes in the Node.js API. If you've tested on one Node.js version, will it work on an earlier version? Will a Node.js change break some assumptions we made?
The NPM Package Manager helps us ensure that our packages execute on the correct Node.js version. This means that we can specify in the `package.json` file, which we'll explore in Chapter 3, _Node.js Modules_ , the compatible Node.js versions for a package.
We can add an entry to `package.json` like this:
engines: {
"node": ">=5.x"
}
This means exactly what it implies—that the given package is compatible with Node.js version 5.x or later.
# Running and testing commands
Now that you've installed Node.js, we want to do two things—verify that the installation was successful and familiarize you with the command-line tools.
## Node.js's command-line tools
The basic install of Node.js includes two commands, `node` and `npm`. We've already seen the `node` command in action. It's used either for running command-line scripts or server processes. The other, `npm`, is a package manager for Node.js.
The easiest way to verify that your Node.js installation works is also the best way to get help with Node.js. Type the following command:
**$ node --help**
**Usage: node [options] [ -e script | script.js ] [arguments]**
**node debug script.js [arguments]**
**Options:**
**-v, --version print Node.js version**
**-e, --eval script evaluate script**
**-p, --print evaluate script and print result**
**-c, --check syntax check script without executing**
**-i, --interactive always enter the REPL even if stdin**
**does not appear to be a terminal**
**-r, --require module to preload (option can be repeated)**
**--no-deprecation silence deprecation warnings**
**--trace-deprecation show stack traces on deprecations**
**--throw-deprecation throw an exception anytime a deprecated function is used**
**--trace-sync-io show stack trace when use of sync IO**
**is detected after the first tick**
**--track-heap-objects track heap object allocations for heap snapshots**
**--prof-process process v8 profiler output generated**
**using --prof**
**--v8-options print v8 command line options**
**--tls-cipher-list=val use an alternative default TLS cipher list**
**--icu-data-dir=dir set ICU data load path to dir**
**(overrides NODE_ICU_DATA)**
**Environment variables:**
**NODE_PATH ':'-separated list of directories**
**prefixed to the module search path.**
**NODE_DISABLE_COLORS set to 1 to disable colors in the REPL**
**NODE_ICU_DATA data path for ICU (Intl object) data**
**NODE_REPL_HISTORY path to the persistent REPL history file**
**Documentation can be found at https://nodejs.org/**
**It prints the USAGE message giving you the command-line options.**
Note that there are options for both Node.js and V8 (not shown in the previous command line). Remember that Node.js is built on top of V8; it has its own universe of options that largely focus on details of bytecode compilation or garbage collection and heap algorithms. Enter `node --v8-options` to see the full list of them.
On the command line, you can specify options, a single script file, and a list of arguments to that script. We'll discuss script arguments further in the next section, _Running a simple script with Node.js_.
Running Node.js with no arguments plops you in an interactive JavaScript shell:
**$ node**
**> console.log('Hello, world!');**
**Hello, world!**
**undefined**
Any code you can write in a Node.js script can be written here. The command interpreter gives a good terminal-orientated user experience and is useful for interactively playing with your code. You do play with your code, don't you? Good!
## Running a simple script with Node.js
Now let's see how to run scripts with Node.js. It's quite simple and let's start by referring back to the help message shown above. It's just a script filename and some script arguments, which should be familiar for anyone who has written scripts in other languages.
### Tip
Creating and editing Node.js scripts can be done with any text editor that deals with plain text files, such as VI/VIM, Emacs, Notepad++, Jedit, BB Edit, TextMate, or Komodo. It's helpful if it's a programmer-oriented editor, if only for the syntax coloring.
For this and other examples in this book, it doesn't truly matter where you put the files. However, for the sake of neatness, you can start by making a directory named `node-web-dev` in the home directory of your computer, and then inside that creating one directory per chapter (for example, `chap02` and `chap03`).
First, create a text file named `ls.js` with the following content:
var fs = require('fs');
var files = fs.readdirSync('.');
for (fn in files) {
console.log(files[fn]);
}
Next, run it by typing the following command:
**$ node ls.js**
**ls.js**
This is a pale cheap imitation of the Unix `ls` command (as if you couldn't figure that out from the name). The `readdirSync` function is a close analogue to the Unix `readdir` system call (type `man 3 readdir` in a terminal window to learn more) and is used to list the files in a directory.
The script arguments land in a global array named `process.argv`, and you can modify `ls.js`, copying it as `ls2.js`, as follows to see how this array works:
var fs = require('fs');
var dir = '.';
if (process.argv[2]) dir = process.argv[2];
var files = fs.readdirSync(dir);
for (fn in files) {
console.log(files[fn]);
}
You can run it as follows:
**$ node ls2 ~/.nvm/versions/node/v5.5.0/bin**
**node**
**npm**
## Launching a server with Node.js
Many scripts that you'll run are server processes. We'll be running lots of these scripts later on. Since we're still in the dual mode of verifying the installation and familiarizing you with using Node.js, we want to run a simple HTTP server. Let's borrow the simple serverscript on the Node.js home page (<http://nodejs.org>).
Create a file named `app.js` containing the following:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, World!\n');
}).listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124');
Run it this way:
**$ node app.js**
**Server running at http://127.0.0.1:8124**
This is the simplest of web servers you can build with Node.js. If you're interested in how it works, flip forward to Chapter 4, _HTTP Servers and Clients – A Web Application's First Steps_ ; Chapter 5, _Your First Express Application_ ; and Chapter 6, _Implementing the Mobile-First Paradigm_. At the moment just visit `http://127.0.0.1:8124` in your browser to see the **"Hello, World!"** message.
A question to ponder is why this script did not exit when `ls.js` did exit. In both cases, execution of the script reaches the end of the script; the Node.js process does not exit in `app.js`, while in `ls.js` it does.
The reason is the presence of active event listeners. Node.js always starts up an event loop, and in `app.js`, the `listen` function creates an event `listener` that implements the HTTP protocol. This event listener keeps `app.js` running until you do something like typing `Control-C` in the terminal window. In `ls.js`, there is nothing that creates a long-running event listener, so when `ls.js` reaches the end of its script, the `node` process will exit.
# NPM – the Node.js package manager
Node.js by itself is a pretty basic system, being a JavaScript interpreter with a few interesting asynchronous I/O libraries. One of the things that make Node.js interesting is the rapidly growing ecosystem of third-party modules for Node.js. At the center of that ecosystem is NPM. The modules can be downloaded as source and assembled manually for use with Node.js programs. NPM gives us a simpler way; NPM is the de-facto standard package manager for Node.js and it greatly simplifies downloading and using these modules. We will talk about NPM at length in the next chapter.
The sharp-eyed will have noticed that `npm` is already installed via all the installation methods discussed previously. In the past, `npm` was installed separately, but today, it is bundled with Node.js.
Now that we have `npm` installed, let's take it for a quick spin. **Hexy** is a utility program for printing hex dumps of files. It serves our purpose right now in giving us something to quickly install and try out:
**$ npm install -g hexy**
**/home/david/.nvm/versions/node/v5.9.1/bin/hexy - > /home/david/.nvm/versions/node/v5.9.1/lib/node_modules/hexy/bin/hexy_cmd.js**
**/home/david/.nvm/versions/node/v5.9.1/lib**
**`-- hexy@0.2.7**
Adding the `-g` flag makes the module available globally, irrespective of which directory it is installed in. It is most useful when the module provides a command-line interface because `npm` ensures that the command is installed correctly for use by all users of the computer.
Depending on how Node.js is installed for you, that may need to be run with `sudo`:
**$ sudo npm install -g hexy**
Once it is installed, you'll be able to run the newly installed program this way:
**$ hexy --width 12 ls.js**
**00000000: 7661 7220 6673 203d 2072 6571 var.fs.=.req**
**0000000c: 7569 7265 2827 6673 2729 3b0a uire('fs');.**
**00000018: 7661 7220 6669 6c65 7320 3d20 var.files.=.**
**00000024: 6673 2e72 6561 6464 6972 5379 fs.readdirSy**
**00000030: 6e63 2827 2e27 293b 0a66 6f72 nc('.');.for**
**0000003c: 2028 666e 2069 6e20 6669 6c65 .(fn.in.file**
**00000048: 7329 207b 0a20 2063 6f6e 736f s).{...conso**
**00000054: 6c65 2e6c 6f67 2866 696c 6573 le.log(files**
**00000060: 5b66 6e5d 293b 0a7d 0a [fn]);.}.**
Again, we'll be doing a deep dive into NPM in the next chapter. The `hexy` utility is both a Node.js library and a script for printing out these old style hex dumps.
# Node.js and ECMAScript 6 (ES-2015, ES-2016, and so on)
In 2015, the ECMAScript committee released a major update of the JavaScript language. The browser makers are adding those much-needed features, meaning the V8 engine is adding those features as well. These features are making their way into Node.js starting with version 4.x.
### Note
To learn about the current status of ES-2015 in Node.js, visit <https://nodejs.org/en/docs/es6/>.
By default, only the ES-2015 features which V8 considers _stable_ are enabled. Further features can be enabled with command-line options. The _almost complete_ features are enabled with the `--es_staging` option. The features still in progress are enabled by the `--harmony_destructuring` option. The website documentation gives more information.
The ES-2015 features make a big improvement in the JavaScript language. One feature, the `Promise` class, should mean a fundamental rethinking of common idioms in Node.js programming. In ES-2016, a pair of new keywords, `async` and `await`, will simplify coding asynchronous code in Node.js, and it should encourage the Node.js community to further rethink the common idioms of the platform.
There's a long list of new JavaScript features, but let's quickly go over two of them we'll use extensively.
The first is lighter weight function syntax called the Arrow Function:
fs.readFile('file.txt', 'utf8', (err, data) => {
if (err)...; // do something with the error
else...; // do something with the data
});
This is more than the syntactic sugar of replacing the `function` keyword with the fat arrow. The value of `this` is the same as it was outside this invocation. This means that, when using an arrow function, we don't have to jump through hoops to bring `this` into the callback function because `this` is the same at both levels of the code.
The next feature is the `Promise` class, which is used for deferred and asynchronous computations. Deferred code execution to implement asynchronous behavior is a key paradigm for Node.js, and it requires two idiomatic conventions:
* The last argument to an asynchronous function is a callback function which is called when asynchronous execution is to be performed
* The first argument to the callback function is an error indicator
While convenient, these conventions resulted in multilayer code pyramids that can be difficult to understand and maintain:
doThis(arg1, arg2, (err, result1, result2) => {
if (err)...;
else {
// do some work
doThat(arg2, arg3, (err2, results) => {
if (err2)...;
else {
doSomethingElse(arg5, err => {
if (err) .. ;
else ..;
});
}
});
}
});
Depending on how many steps are required for a specific task, a code pyramid can get quite deep. Promises will let us unravel the code pyramid and improve reliability because error handling is more straightforward and easily captures all errors.
A `Promise` class is created as follows:
function doThis(arg1, arg2) {
return new Promise((resolve, reject) => {
// execute some asynchronous code
if (errorIsDetected) return reject(errorObject);
// When the process is finished call this:
resolve(result1, result2);
});
}
Rather than passing in a callback function, the caller receives a `Promise` object. When properly utilized the above pyramid can be coded as follows:
doThis(arg1, arg2)
.then((result1, result2) => {
return doThat(arg2, arg3);
})
.then((results) => {
return doSomethingElse(arg5);
})
.then(() => {
// do a final something
})
.catch(err => {
// errors land here
});
This works because the `Promise` class supports chaining if a `then` function returns a `Promise` object.
At the time of writing, the Node.js community has barely begun to use this new paradigm, and instead it is still using the old _pass in a callback function_ paradigm. In the interim, we'll have to be flexible enough to use both paradigms. Over the long term, there should be a switch to this paradigm.
## Using Babel to use experimental JavaScript features
The Babel transpiler (<http://babeljs.io/>) is a great way to use cutting edge JavaScript features on older implementations. The word _transpile_ means Babel rewrites JavaScript code into other JavaScript code, specifically to rewrite ES-2015 or ES-2016 features to older JavaScript code. Babel does this by converting JavaScript source to an abstract syntax tree, then manipulating that tree to rewrite the code using older JavaScript features, and then writing that tree to a JavaScript source code file.
Since Node.js doesn't yet support all the ES-2015 features, we can use Babel to go ahead and use those features.
### Note
We're not ready to show example code for these features, but we can go ahead and document the setup of the Babel tool. For further information on setup documentation, visit <http://babeljs.io/docs/setup/>.
In the root directory of your project, type these commands:
**$ npm install --save-dev babel-cli**
**$ npm install babel-preset-es2015 –save-dev**
This installs the Babel software, saving references in the `package.json` file. We'll go over that file in more depth in the next chapter, but NPM uses `package.json` to document attributes of the module. Some of those attributes are dependencies on other modules, and in this case, we're documenting a development dependency on Babel.
Because we installed `babel-cli`, a `babel` command is installed such that we can type the following:
**$ ./node_modules/.bin/babel –help**
Next, in the same directory as `package.json`, create a file named `.babelrc` containing the following:
{
"presets": ["es2015"]
}
This instructs Babel to use `presets` to configure the set of transformations it will perform.
The last step is to create a directory named `src` to store code written with ES2015 or ES2016 features. The transpiled code will land in the directory named `lib` and it's that code which will be executed.
To transpile your code, run the following command:
**$ ./node_modules/.bin/babel src -d lib**
This command asks to take all files in the `src` directory and transpile each to a matching file name in the `lib` directory.
To automate the process, edit the `package.json` file and insert the following snippet:
"scripts": {
"build": "babel src -d lib"
},
With this, you can use the following command:
**$ npm run build**
We'll go over `npm` scripts in more depth later, but this is a way to record certain commands for later use.
# Summary
You learned a lot in this chapter about installing Node.js, using its command-line tools, and running a Node.js server. We also breezed past a lot of details that will be covered later in the book, so be patient.
Specifically, we covered downloading and compiling the Node.js source code, installing Node.js either for development use in your home directory or for deployment in system directories and installing **Node Package Manager** ( **npm** )—the de-facto standard package manager used with Node.js. We also saw how to run Node.js scripts or Node.js servers. We then took a look at the new features in ES-2015. Finally, we saw how to use Babel to implement those features in your code.
Now that we've seen how to set up the basic system, we're ready to start working on implementing applications with Node.js. First, you must learn the basic building block of Node.js applications, modules, which we will cover in the next chapter.
# Chapter 3. Node.js Modules
Before writing Node.js applications, you must learn about Node.js modules and packages. Modules and packages are the building blocks for breaking down your application into smaller pieces.
In this chapter, we will cover the following topics:
* Defining a module
* The CommonJS module specification
* Using ES-2015 modules in Node.js
* Understanding how Node.js finds modules
* The npm package management system
So, let's get on with it.
# Defining a module
Modules are the basic building block for constructing Node.js applications. A Node.js module encapsulates functions, hiding details inside a well-protected container, and exposing an explicitly declared list of functions.
We have already seen modules in action in the previous chapter. Every JavaScript file we use in Node.js is itself a module. It's time to see what they are and how they work.
In the `ls.js` example in Chapter 2, _Setting up Node.js_ , we wrote the following code to pull in the `fs` module, giving us access to its functions:
var fs = require('fs');
The `require` function searches for modules, loading the module definition into the Node.js runtime, and makes its functions available. In this case, the `fs` object contains the code (and data) exported by the `fs` module.
This is true of every Node.js module, the `exports` object within the module is the interface provided to other code. Anything assigned to a field of the `exports` object is available to other pieces of code, and everything else is hidden.
Let's look at a brief example of this before diving into the details. Ponder over the `simple.js` module:
var count = 0;
exports.next = function() { return count++; }
We have one variable , `count`, which is not attached to the `exports` object and a function, `next`, which is attached. Now, let's use it.
The `exports` object is what's returned by `require('./simple')`. Therefore each call to `s.next` calls the `next` function in `simple.js`. Each returns (and increments) the value of the local variable, `count`. An attempt to access the private field, `count`, shows it's unavailable from outside the module.
To reiterate the rule:
* Anything (functions or objects) assigned as a field of `exports` is available to other code outside the module
* Objects not assigned to `exports` are not available
This is how Node.js solves the global object problem of browser-based JavaScript. The variables that look like they're global variables are only global to the module containing that variable. These variables are not visible to any other code.
Now that we've got a taste for modules, let's take a deeper look.
## Node.js module format
Node.js's module implementation is strongly inspired by, but not identical to, the CommonJS module specification. The differences between them might only be important if you need to share code between Node and other CommonJS systems.
One change that came with ES2015 is a standard module format. It has some interesting features, but it is incompatible with the CommonJS/Node.js module system. Further, the Node.js runtime (as of versions 5.x and 6.x) does not support ES2015 modules.
Babel supports transpiling ES2015 modules to Node.js modules. This suggests a possible strategy for code to be shared between Node.js and browser applications. Namely, to write ES2015 modules, transpiling them as needed to either Node.js or straight to JavaScript for browsers that don't support ES2015 modules.
In the long run, the Node.js community will face a choice once compatibility with ES2015 modules comes about. It will be extremely important for the `require` function to support both CommonJS style Node.js modules and ES2015 modules. The specifics for doing so are under discussion.
In the meantime, we need to focus on the task at hand, which is to learn about Node.js modules.
## File modules
The `simple.js` module we just saw is what the Node.js documentation describes as a **file module**. Such modules are contained within a single file, whose filename ends with either `.js` or `.node`. The latter are compiled from C or C++ source code, while the former are of course written in JavaScript.
Node.js modules provide a simple encapsulation mechanism to hide implementation details while exposing an API. Modules are treated as if they were written as follows:
(function() {... contents of module file... })();
Thus, everything within the module is contained within an anonymous private namespace context. This is how the global object problem is resolved; everything in a module which looks global is actually contained within this private context.
There are two free variables inserted by Node.js into this private context: `module` and `exports`. The `module` object contains several fields you might find useful. Refer to the online Node.js documentation for details.
The `exports` object is an alias of the `module.exports` field. This means that the following two lines of code are equivalent:
exports.funcName = function(arg, arg1) {... }
module.exports.funcName = function(arg, arg2) { .. }
Your code can break the alias between the two if you do this:
exports = function(arg, arg1) {... }
If you want the module to return a single function, you must instead do this:
module.exports = function(arg, arg1) {... }
Some modules do export a single function because that's how the module author envisioned delivering the desired functionality.
### Demonstrating module-level encapsulation
That was a lot of words, so let's do a quick example. Create a file named `module1.js` containing this:
var A = "value A";
var B = "value B";
exports.values = function() {
return { A: A, B: B };
}
Then create a file named `module2.js` containing the following:
var util = require('util');
var A = "a different value A";
var B = "a different value B";
var m1 = require('./module1');
util.log('A='+A+' B='+B+' values='+util.inspect(m1.values()));
Then, run it as follows (you must have Node.js already installed):
**$ node module2.js**
**19 May 21:36:30 - A=a different value A B=a different value B values={ A: 'value A', B: 'value B' }**
This artificial example demonstrates encapsulation of the values in `module1.js` from those in `module2.js`. The A and B values in `module1.js` don't overwrite A and B in `module2.js` because they're encapsulated within `module1.js`. Values encapsulated within a module can be exported, such as the `.values` function in `module1.js`.
## Directories as modules
A module can contain a whole directory structure full of stuff. Such a module might contain several internal modules, data files, template files, documentation, tests, assets, and more. Once stored within a properly constructed directory structure, Node.js will treat these as a module that satisfies a `require('moduleName')` call.
### Note
This may be a little confusing because the word _module_ is being overloaded with two meanings. In some cases, a _module_ is a file, and in other cases, a _module_ is a directory containing one or more file _modules_.
One way to implement this is with a `package.json` file. As the name implies, it is in the JSON format, and it contains data about the module (package). The `npm` package management system puts a lot of data into the `package.json` file, but the Node.js runtime recognizes only these two values:
{ name: "myAwesomeLibrary",
main: "./lib/awesome.js" }
If this `package.json` file is in a directory named `awesomelib`, then `require('./awesomelib')` will load the file module in `./awesomelib/lib/awesome.js`.
If there is no `package.json`, then Node.js will look for either `index.js` or `index.node`. In this case, `require('./awesomelib')` will load the file module in `./awesomelib/index.js`.
In either case, the directory module can easily contain other file modules. The module that's initially loaded would simply use `require('./anotherModule')` one or more times to load other, private modules.
# Node.js's algorithm for require (module)
In Node.js, modules are either stored in a single file, as discussed previously, or as a directory with particular characteristics. There are several ways to specify module names and several ways to organize module deployment in the filesystem. It's quite flexible, especially when used with the `npm` package management system for Node.js.
## Module identifiers and path names
Generally speaking, the module name is a pathname but with the file extension removed. Earlier, when we wrote `require('./simple')`, Node.js knew to add `.js` to the filename and load in `simple.js`.
Modules whose filenames end in `.js` are of course expected to be written in JavaScript. Node.js also supports binary code native libraries as Node.js modules, whose filename extension is `.node`. It's outside the scope of this book to discuss implementation of native code Node.js modules. This gives you enough knowledge to recognize them when you come across one.
Some Node.js modules are not files in the filesystem, but they are baked into the Node.js executable. These are the core modules, the ones documented on `nodejs.org`. Their original existence is as files in the Node.js source tree, but the build process compiles them into the binary Node.js executable.
There are three types of module identifiers: _relative_ , _absolute_ , and _top-level_
* **Relative module identifiers** : These begin with `./` or `../` and absolute identifiers begin with `/`. The module name is identical with POSIX filesystem semantics. The resulting pathname is interpreted relative to the location of the file being executed. That is, a module identifier beginning with `./` is looked for in the current directory; whereas, one starting with `../` is looked for in the parent directory.
* **Absolute module identifiers** : These begin with`/`and are, of course, looked for in the root of the filesystem, but this is not a recommended practice.
* **Top-level module identifiers** : These begin with none of those strings and are just the module name. These must be stored in a `node_modules` directory, and the Node.js runtime has a nicely flexible algorithm for locating the correct `node_modules` directory.
The search begins in the directory containing the file calling `require()`. If that directory contains a `node_modules` directory, which then contains either a matching directory module or a matching file module, then the search is satisfied. If the local `node_modules` directory does not contain a suitable module, it tries again in the parent directory, and it will continue upward in the filesystem until it either finds a suitable module or it reaches the root directory.
That is, with a `require` call in `/home/david/projects/notes/foo.js`, the following directories will be consulted:
* /home/david/projects/notes/node_modules
* /home/david/projects/node_modules
* /home/david/node_modules
* /home/node_modules
* /node_modules
If the module is not found through this search, there are global folders in which folders can be located. The first is specified in the `NODE_PATH` environment variable. This is interpreted as a colon-delimited list of absolute paths similar to the `PATH` environment variable. Node.js will search those directories for a matching module.
### Tip
The `NODE_PATH` approach is not recommended because of surprising behavior, which can happen if people are unaware this variable must be set.
There are three additional locations that can hold modules:
* `$HOME/.node_modules`
* `$HOME/.node_libraries`
* `$PREFIX/lib/node`
In this case, `$HOME` is what you expect, the user's home directory, and `$PREFIX` is the directory where Node.js is installed.
Some are beginning to recommend against using global modules. The rationale is the desire for repeatability and deployability. If you've tested an app, and all its code is conveniently located within a directory tree, you can copy that tree for deployment to other machines. But, what if the app depended on some other file which was magically installed elsewhere on the system? Will you remember to deploy such files?
## An example application directory structure
Let's take a look at files and directories in a filesystem.
This is an Express application (we'll start using Express in Chapter 5, _Your First Express Application_ ) containing a few modules installed in the `node_modules` directory.
The `async` module can be used with `require('async')` in any file shown here. Its `package.json` must include the following attribute:
"main": "./lib/async.js"
Then, when `require('async')` is called, the `node_modules/async/lib/async.js` file is loaded.
For `app.js` to load `models-sequelize/notes.js`, it calls the following:
var notesModel = require('./models-sequelize/notes');
Use the following code to do the reverse in `models-sequelize/notes.js`:
var app = require('../app');
Any of the modules in the `node_modules` directory can contain other `node_modules` directories. Indeed, the two `Passport` modules do include `node_modules` directories. In such a case, the search algorithm works as described earlier. Since the search proceeds upward in the directory hierarchy, a `require` call will not resolve to a directory deeper in the directory hierarchy.
# npm – the Node.js package management system
As described in Chapter 2, _Setting up Node.js_ , npm is a package management and distribution system for Node.js. It has become the de-facto standard for distributing modules (packages) for use with Node.js. Conceptually, it's similar to tools such as `apt-get` (Debian), `rpm`/`yum` (Redhat/Fedora), `MacPorts` (Mac OS X), `CPAN` (Perl), or `PEAR` (PHP). Its' purpose is publishing and distributing Node.js packages over the Internet using a simple command-line interface. With npm, you can quickly find packages to serve specific purposes, download them, install them, and manage packages you've already installed.
The `npm` package defines a package format for Node.js largely based on the CommonJS package specification. It uses the same `package.json` file that's supported natively by Node.js, but with additional fields to build in additional functionality.
## The npm package format
An npm package is a directory structure with a `package.json` file describing the package. This is exactly what we just referred to as a directory module except that npm recognizes many more `package.json` tags than Node.js does. The starting point for npm's `package.json` are the CommonJS Packages/1.0 specification. The documentation for npm's `package.json `implementation is accessed using the following command:
**$ npm help json**
A basic `package.json` file is as follows:
{ "name": "packageName",
"version": "1.0",
"main": "mainModuleName",
"modules": {
"mod1": "lib/mod1",
"mod2": "lib/mod2"
}
}
The file is in JSON format, which, as a JavaScript programmer, you should be familiar with.
The most important tags are `name` and `version`. The name will appear in URLs and command names, so choose one that's safe for both. If you desire to publish a package in the public `npm` repository, it's helpful to check whether a particular name is already being used at <http://npmjs.com> or with the following command:
**$ npm search packageName**
The `main` tag is treated the same as we discussed in the previous section on directory modules. It defines which file module will be returned when invoking `require('packageName')`. Packages can contain many modules within themselves and they can be listed in the `modules` list.
Packages can be bundled as tar-gzip (tarballs), especially to send them over the Internet.
A package can declare dependencies on other packages. That way, `npm` can automatically install other modules required by the module being installed. Dependencies are declared as follows:
"dependencies": {
"foo" : "1.0.0 – 2.x.x",
"bar" : ">=1.0.2 <2.1.2"
}
The description and keyword fields help people find the package when searching in an npm repository (<http://search.npmjs.org>). Ownership of a package can be documented in the homepage, author, or contributors fields:
"description": "My wonderful packages that walks dogs",
"homepage": "http://npm.dogs.org/dogwalker/",
"author": "dogwhisperer@dogs.org"
Some `npm` packages provide executable programs meant to be in the user's `PATH`. These are declared using the `bin` tag. It's a map of command names to the script which implements that command. The command scripts are installed into the directory containing the node executable using the name given:
bin: {
'nodeload.js': './nodeload.js',
'nl.js': './nl.js'
},
The `directories` tag describes the package directory structure. The `lib` directory is automatically scanned for modules to load. There are other directory tags for binaries, manuals, and documentation:
directories: { lib: './lib', bin: './bin' },
The script tags are script commands run at various events in the life cycle of the package. These events include `install`, `activate`, `uninstall`, `update`, and more. For more information about script commands, use the following command:
**$ npm help scripts**
We've already used the scripts feature when showing how to set up Babel. We'll use these later for automating the build, test, and execution processes.
This was only a taste of the npm package format; see the documentation (`npm help json`) for more.
## Finding npm packages
By default, `npm` modules are retrieved over the Internet from the public package registry maintained on <http://npmjs.com>. If you know the module name, it can be installed simply by typing the following:
**$ npm install moduleName**
But what if you don't know the module name? How do you discover the interesting modules? The website <http://npmjs.com> publishes a searchable index of the modules in that registry.
The npm package also has a command-line search function to consult the same index:
Of course, upon finding a module, it's installed as follows:
**$ npm install acoustid**
After installing a module you may want to see the documentation, which would be on the module's website. The `homepage` tag in `package.json` lists that URL. The easiest way to look at the `package.json` file is with the `npm view` command, as follows:
**$ npm view akashacms**
**...**
**{ name: 'akashacms',**
**description: 'A content management system to generate static websites using latest HTML5/CSS3/JS goodness.',**
**'dist-tags': { latest: '0.4.16' },**
**versions:**
**[ '0.0.1',**
**...**
**author: 'David Herron <david@davidherron.com> (http://davidherron.com)',**
**repository: { type: 'git', url: 'git://github.com/akashacms/akashacms.git' },**
**homepage: 'http://akashacms.com/',**
**...**
You can use `npm view` to extract any tag from `package.json`, like the following which lets you view just the `homepage` tag:
**$ npm view akashacms homepage**
**http://akashacms.org/**
Other fields in the `package.json` can be viewed by simply giving the desired tag name.
## Other npm commands
The main `npm` command has a long list of subcommands for specific package management operations. These cover every aspect of the life cycle of publishing packages (as a package author), and downloading, using, or removing packages (as an npm consumer).
You can view the list of these commands just by typing `npm` (with no arguments). If you see one you want to learn more about, view the help information:
**$ npm help <command>**
**The help text will be shown on your screen.**
**Or, see the website: http://docs.npmjs.com**
### Installing an npm package
The `npm install` command makes it easy to install packages upon finding the one of your dreams, as follows:
**$ npm install express**
**/home/david/projects/notes/**
**– express@4.13.4**
**...**
The named module is installed in `node_modules` in the current directory.
If you instead want to install a module globally, add the `-g` option:
**$ npm install -g grunt-cli**
If you get an error, and you're on a Unix-like system (Linux/Mac), you may need to run this with `sudo`:
**$ sudo npm install -g grunt-cli**
### Initializing a new npm package
If you want to create a new package, you can create the `package.json` file by hand or you can get npm's help. The `npm init` command leads you through a little dialog to get starting values for the `package.json` file.
Once you get through the questions, the `package.json` file is written to disk.
### Maintaining package dependencies with npm
In the preceding screenshot, you'll see that npm instructs you how to add package dependencies to `package.json`. What happens is npm looks in `package.json` for the `dependencies` or `devDependencies` field, and it will automatically install the mentioned npm packages.
Suppose you've run this:
**$ npm install akashacms –-save**
In response, npm will add a `dependencies` tag to `package.json`:
"dependencies": {
"akashacms": "^0.4.16"
}
Now, when your application is installed, npm will automatically also install any packages listed in the `dependencies`.
The `devDependencies` are modules used during development. That field is initialized the same as above but with the `–-save-dev` flag.
By default, when an npm install is run, modules listed in both `dependencies` and `devDependencies` are installed. Of course, the purpose for having two lists is to not install the `devDependencies` in some cases:
**$ npm install –-production**
This installs only the modules listed in `dependencies` and none of the `devDependencies` modules.
In the **Twelve-Factor** application model, it's suggested that we explicitly identify the dependencies required by the application. On the Node.js platform, npm gives us this dependencies section, including a flexible mechanism to declare compatible package versions by their version number.
Throughout this book, we'll do the following:
**$ npm install express@4.x --save**
This combination installs the specified version, and adds the dependency declaration to the `package.json` file. Using a version number such as `4.x` is a convenience because it will automatically install the latest of a given version number range.
For example, we know that Express 5.x is in its alpha phase at the time of writing this, with the full release some time in the future, and that 5.x will introduce changes that might break the code shown in this book. By instructing you to install 4.x, you'll be insulated from potential breaking changes.
### Fixing bugs by updating package dependencies
Bugs exist in every piece of software. An update to the Node.js platform may break an existing package, as might an upgrade to packages used by the application, or your application may trigger a bug in a package it uses. In these and other cases, fixing the problem might be as simple as updating a package dependency to a later (or earlier) version.
You must first identify whether the problem exists in the package or in your code. Once you've determined that it's a problem in another package, it's time to investigate whether the package maintainers have already fixed the bug. Is the package hosted on Github or another service with a public issue queue? Look for an open issue on this problem. That investigation will tell you whether to update the package dependency to a later version. Sometimes, it will tell you to revert to an earlier version; for example, if the package maintainer introduced a bug that doesn't exist in an earlier version.
Sometimes, you will find that the package maintainers are unprepared to issue a new release. In such a case, you can fork their repository and create a patched version of their package. The `package.json` dependencies section lets you reference packages in many ways other than npm version numbers. For example, you can list a URL to a tarball or a reference to repositories on services such as Github. Refer to "`npm help package.json`" for more information on your options. Consider the following example:
"dependencies": {
"express": "http://example.com/my/patched/express.tar.gz"
}
During the development of this book, an example of breakage due to a Node.js platform update occurred. Node.js 6.0 was released, bringing with it many great new features, including deeper compatibility with ES-2015 language features. It also introduced changes that broke some modules, including the `sqlite3` module we will use starting in Chapter 7, _Data Storage and Retrieval_. An updated release was quickly made, but this begs a question of what to do when this happens.
A situation like this generally prevents us from moving to the newer platform version until all our dependent packages work with the new version. The specific action to take depends on if, or how badly, the new platform version breaks your application.
It is for these reasons that the Twelve-Factor application model recommends explicitly declaring specific dependencies to install. Listing an explicit version number in `package.json` means that the package maintainer can release a new version, but you're in control of if, or when, you adopt that version.
### Declaring Node.js version compatibility
It's important that your Node.js software run on the correct version of Node.js. Breaking changes are introduced from time to time in the platform. It's either intentional when new features are added or unintentional when a bug is added. What's most common is to require a specific Node.js version, or later, because of which release in which feature was added.
For example, the ES2015 features started to be implemented in the 4.2.x release, and a large number of other ES2015 features were added in 6.0.
This dependency is declared in `package.json` using the `engines` tag:
"engines": {
"node": ">= "5.x"
}
This, of course, uses the same version number matching that we just discussed.
### Updating outdated packages you've installed
The coder codes, updating their package, leaving you in their dust unless you keep up.
To find out if your installed packages are out of date, use the following command:
**$ npm outdated**
The report shows the current npm packages, the currently installed version, as well as the current version in the `npm` repository. Updating the outdated packages is very simple:
**$ npm update express**
**$ npm update**
### Installing packages from outside the npm repository
As awesome as the npm repository is, we don't want to push everything we do through their service. This is especially true for internal development teams who cannot publish their code for all the world to see. While you can rent a private npm repository, there's another way. You can install packages from other locations. Details about this are in `package.json help`.
Your package dependency can be any URL that downloads a tarball, that is, a `.tar.gz` file:
**$ npm install http://dev.mydomain.com/path/to/v1.2.3/packageName.tar.gz --save**
One way to use this from a Github repository is that each time a _release_ is made, a new tarball is generated at a versioned URL. Simply navigate to the **Releases** tab of the Github repository.
There's also direct support for Git URLs' even ones using SSH authentication. Since Git URLs can include a hash code for a specific repository revision, branch, or tag, this is also versioned:
**$ npm install git+ssh://user@hostname:project.git#tag --save**
The `#tag` portion is where you can specify the release tag. For Git repositories on Github, there's a shortcut:
**$ npm install strongloop/express --save**
### Publishing an npm package
All those packages in the npm repository came from people like you with an idea of a better way of doing something. It is very easy to get started with publishing packages. Online docs can be found at <https://docs.npmjs.com/getting-started/publishing-npm-packages>.
You first use the `npm adduser` command to register yourself with the npm repository. You can also sign up with the website.
Next, you log in using the `npm login` command.
Finally, while sitting in the package root directory, use the `npm publish` command. Then, stand back so that you don't get stampeded by the crush of thronging fans. Or, maybe not. There are over 250,000 packages in the repository, with well over 400 packages added every day. To get yours to stand out, you will require some marketing skill, which is another topic beyond the scope of this book.
## Package version numbers
We've been showing version numbers all along without explaining how npm uses them.
Node.js doesn't know anything about version numbers. It knows about modules, and it can treat a directory structure as if it were a module. It has a fairly rich system of looking for modules, but it doesn't know version numbers.
The npm package, however, knows about version numbers. It uses the Semantic Versioning model (<http://semver.org>), and as we saw, you can install modules over the Internet, query for out-of-date modules, and update them with npm. All of this is version controlled, so let's take a closer look at the things npm can do with version numbers and version tags.
Earlier, we used `npm list` to list installed packages, and the listing includes version numbers of installed packages. If instead, you wish to see the version number of a specific module, type the following command:
**$ npm view express version**
**4.13.4**
Whenever `npm` commands take a package name, you can append a version number or version tag to the package name. This way, you can deal with specific package versions if needed. Sometimes, package maintainers introduce bugs that you want to avoid. The `dependencies` in your application can list a specific version number. You can list specific version numbers, changing the version dependency only when you're satisfied it is safe to do so. The `npm install` command, and several other npm commands, take version numbers as follows:
**$ npm install express@2.3.1**
The `npm help package.json` documentation has a full discussion of what you can do with version number strings, including these choices:
* **Exact version match** : 1.2.3
* **At least version N** : >1.2.3
* **Up to version N** : <1.2.3
* **Between two releases** : >=1.2.3 <1.3.0
One feature of the Twelve-Factor methodology is step 2, explicitly declaring your dependencies. We've already touched on this, but it's worth reiterating and to see how npm makes this easy to accomplish.
Step 1 of the Twelve-Factor methodology is ensuring that your application code is checked into a source code repository. You probably already know this, and even have the best of intentions to ensure that everything is checked in. With Node.js, each module should have its own repository rather than putting every single last piece of code in one repository.
Doing so ensures that each module progresses on its own timeline. For example, a breakage in one module is easy to back out by changing the version dependency in `package.json`.
This gets us to step 2. There are two aspects of this step, one of which is the package versioning we discussed previously. With npm, we can explicitly declare module version numbers in `dependencies` and `devDependencies`. It's extremely easy, then, to ensure that everyone on the team is on the same page, developing against the same versions of the same modules. When it's time to deploy to testing, staging, or production servers, and the deployment script runs `npm install` or `npm update`, the code will use a known version of the module.
The lazy way to declare dependencies is putting `*` in the version field. Doing so uses whatever is the latest version in the npm repository. Maybe this will work for you, until one day the maintainers of that package introduce a bug. You'll head over to the Github site for the package, look in the issue queue, and see that others have already reported the problem you're seeing. Some of them will say that they've pinned on the previous release until this bug is fixed. What that means is their `package.json` file does not depend on `*` for the latest version but on a specific version number before the bug was created.
Don't do the lazy thing, do the smart thing.
The other aspect of explicitly declaring dependencies is to not implicitly depend on global packages. Earlier, we said that some in the Node.js community caution against installing modules in the global directories. This might seem like an easy shortcut to sharing code between applications. Just install it globally, and you don't have to install the code in each application.
But, doesn't that make deployment harder? Will the new team member be instructed on all the special files to install here and there to make the application run? Will you remember to install that global module on all destination machines?
You don't want installation instructions to be the length of a small book full of arcane steps to ensure correct setup. That's error prone and hard to automate for modern cloud-based computing systems. Instead, you would want to automate as much of the installation and setup as possible.
For Node.js, that means listing all the module dependencies in `package.json`, and then the installation instructions are simply `npm install`, followed perhaps by editing a configuration file.
# A quick note about CommonJS
The Node.js package format is derived from the CommonJS module system (<http://commonjs.org>). When developed, the CommonJS team aimed to fill a gap in the JavaScript ecosystem. At that time, there was no standard module system, making it trickier to package JavaScript applications.
The `require` function, the `exports` object, and other aspects of Node.js modules come directly from the `Modules/1.0` spec.
With ES2015, the JavaScript community now has a native module format which is different than the CommonJS spec. At the time of writing this, Node.js does not support that format. If you wish, Babel supports transpiling from the new modules format to the Node.js format.
# Summary
You learned a lot in this chapter about modules and packages for Node.js.
Specifically, we covered implementing modules and packages for Node.js, managing installed modules and packages, and saw how Node.js locates modules.
Now that you've learned about modules and packages, we're ready to use them to build applications, which is the topic for the next chapter.
# Chapter 4. HTTP Servers and Clients – A Web Application's First Steps
Now that you've learned about Node.js modules, it's time to put this knowledge to work in building a simple Node.js web application. In this chapter, we'll keep to a simple application, enabling us to explore three different application frameworks for Node.js. In later chapters, we'll build some more complex applications, but before we can walk, we must learn to crawl.
We will cover the following topics in this chapter:
* EventEmitters
* Listening to HTTP events and the HTTP Server object
* HTTP request routing
* ES-2015 template strings
* Building a simple web application with no frameworks
* The Express application framework
* Express middleware functions
* How to deal with computationally intensive code
* The HTTP Client object
* Creating a simple REST service with Express
# Sending and receiving events with EventEmitters
`EventEmitters` are one of the core idioms of Node.js. Many of the core modules are EventEmitters, and also EventEmitters make an excellent skeleton to implement asynchronous programming. EventEmitters have nothing to do with web application development, but they are so much part of the woodwork that you may skip over their existence. It is with the HTTP classes that we will get our first taste of EventEmitters.
In this chapter, we'll work with the `HTTPServer` and `HTTPClient` objects. Both of them are subclasses of `EventEmitter` and rely on it to send events for each step of the HTTP protocol. Understanding `EventEmitter` will help you understand not only these objects but many other objects in Node.js.
The `EventEmitter` object is defined in the events module of Node.js. Directly using the `EventEmitter` class means performing `require('events')`. In most cases, you won't require this module, but there are cases where the program needs to implement a subclass of `EventEmitter`.
Create a file named `pulser.js` that will contain the following code. It shows both sending as well as receiving events while directly using the `EventEmitter` class:
var events = require('events');
var util = require('util');
// Define the Pulser object
function Pulser() {
events.EventEmitter.call(this);
}
util.inherits(Pulser, events.EventEmitter);
Pulser.prototype.start = function() {
setInterval(() => {
util.log('>>>> pulse');
this.emit('pulse');
util.log('<<<< pulse');
}, 1000);
};
This defines a `Pulser` class, which inherits from `EventEmitter` (using `util.inherits`). Its purpose is to send timed events, once a second, to any listeners. The `start` method uses `setInterval` to kick off repeated callback execution, scheduled for every second, and call `emit` to send the `pulse` events to any listeners.
This much could be the starting point of a general-purpose module to send events at a given interval. Instead, we're just exploring how `EventEmitter` works.
Now, let's see how to use the `Pulser` object by adding the following code to `pulser.js`:
// Instantiate a Pulser object
var pulser = new Pulser();
// Handler function
pulser.on('pulse', () => {
util.log('pulse received');
});
// Start it pulsing
pulser.start();
Here we create a `Pulser` object and consume its `pulse` events. Calling `pulser.on('pulse')` sets up connections for the `pulse` events to invoke the callback function. It then calls the `start` method to get the process going.
Enter this into a file and name the file `pulser.js`. When you run it, you should see the following output:
**$ node pulser.js**
**19 Apr 16:58:04 - >>>> pulse**
**19 Apr 16:58:04 - pulse received**
**19 Apr 16:58:04 - <<<< pulse**
**19 Apr 16:58:05 - >>>> pulse**
**19 Apr 16:58:05 - pulse received**
**19 Apr 16:58:05 - <<<< pulse**
**19 Apr 16:58:06 - >>>> pulse**
**19 Apr 16:58:06 - pulse received**
**19 Apr 16:58:06 - <<<< pulse**
## The EventEmitter theory
The `EventEmitter` event has many names, and it can be anything that makes sense to you. You can define as many event names as you like. Event names are defined simply by calling `.emit` with the event name. There's nothing formal to do, no registry of event names. Simply making a call to `.emit` is enough to define an event name.
### Note
By convention, the event name `error` indicates errors.
An object sends events using the `.emit` function. Events are sent to any listeners that have registered to receive events from the object. The program registers to receive an event by calling that object's `.on` method, giving the event name and an event handler function.
Often, it is required to send data along with an event. To do so, simply add the data as arguments to the `.emit` call, as follows:
this.emit('eventName', data1, data2, ..);
When the program receives that event, the data appears as arguments to the callback function. Your program would listen to such an event as follows:
emitter.on('eventName', (data1, data2, ..) => {
// act on event
});
There is no handshaking between event receivers and the event sender. That is, the event sender simply goes on with its business, and it gets no notifications about any events received, any action taken, or any error occurred.
# HTTP server applications
The HTTP server object is the foundation of all Node.js web applications. The object itself is very close to the HTTP protocol, and its use requires knowledge of that protocol. In most cases, you'll be able to use an application framework such as Express that hides the HTTP protocol details, allowing the programmer to focus on business logic.
We already saw a simple HTTP server application in Chapter 2, _Setting up Node.js_ , which is as follows:
var http = require('http');
http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, World!\n');
}).listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124');
The `http.createServer` function creates an `http.Server` object. Because it is an `EventEmitter`, this can be written in another way to make that fact explicit:
var http = require('http');
var server = http.createServer();
server.on('request', (req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, World!\n');
});
server.listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124');
The `request` event takes a function, which receives `request` and `response` objects. The `request` object has data from the web browser, while the `response` object is used to gather the data to be sent in the response. The `listen` function causes the server to start listening and arranging to dispatch an event for every request arriving from a web browser.
Now, let's look at something more interesting with different actions based on the URL.
Create a new file named `server.js` containing the following code:
var http = require('http');
var util = require('util');
var url = require('url');
var os = require('os');
var server = http.createServer();
server.on('request', (req, res) => {
**var requrl = url.parse(req.url, true);**
**if (requrl.pathname === '/') {**
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(
`<html><head><title>Hello, world!</title></head>
<body><h1>Hello, world!</h1>
<p><a href='/osinfo'>OS Info</a></p>
</body></html>`);
**} else if (requrl.pathname === "/osinfo") {**
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(
`<html><head><title>Operating System Info</title></head>
<body><h1>Operating System Info</h1>
<table>
<tr><th>TMP Dir</th><td>${os.tmpDir()}</td></tr>
<tr><th>Host Name</th><td>${os.hostname()}</td></tr>
<tr><th>OS Type</th><td>${os.type()} ${os.platform()} ${os.arch()} ${os.release()}</td></tr>
<tr><th>Uptime</th><td>${os.uptime()} ${util.inspect(os.loadavg())}</td></tr>
<tr><th>Memory</th><td>total: ${os.totalmem()} free: ${os.freemem()}</td></tr>
<tr><th>CPU's</th><td><pre>${util.inspect(os.cpus())}</pre></td></tr>
<tr><th>Network</th><td><pre>${util.inspect(os.networkInterfaces())}</pre></td></tr>
</table>
</body></html>`);
} else {
res.writeHead(404, {'Content-Type': 'text/plain'});
res.end("bad URL "+ req.url);
}
});
server.listen(8124);
console.log('listening to http://localhost:8124');
To run it, type the following command:
**$ node server.js**
**listening to http://localhost:8124**
This application is meant to be similar to PHP's `sysinfo` function. Node's `os` module is consulted to give information about the server. This example can easily be extended to gather other pieces of data about the server:
A central part of any web application is the method of routing requests to request handlers. The `request` object has several pieces of data attached to it, two of which are useful for routing requests, the `request.url` and `request.method` fields.
In `server.js`, we consult the `request.url` data to determine which page to show, after parsing (using `url.parse`) to ease the digestion process. In this case, this lets us do a simple comparison of the `pathname` to determine what to do.
Some web applications care about the HTTP verb (`GET`, `DELETE`, `POST`, and so on) used and must consult the `request.method` field of the `request` object. For example, `POST` is frequently used for `FORM` submissions.
The `pathname` portion of the request URL is used to dispatch the handler code. While this routing method, based on simple string comparison, will work for a small application, it'll quickly become unwieldy. Larger applications will use pattern matching to use part of the request URL to select the request handler function and other parts to extract request data out of the URL. We'll see this in action while looking at Express later in the _Getting started with Express_ section.
If the request URL is not recognized, the server sends back an error page using a `404` result code. The result code informs the browser about the status of the request, where a `200` code means everything is fine, and a `404` code means the requested page doesn't exist. There are, of course, many other HTTP response codes, each with their own meaning.
# ES-2015 multiline and template strings
The previous example showed two of the new features introduced with ES-2015, multiline and template strings. The feature is meant to simplify our life while creating text strings.
The existing string representations use single quotes and double quotes. Template strings are delimited with the backtick character that's also known as the _grave accent_ (or, in French, accent grave):
`template string text`
Before ES-2015, one way to implement a multiline string was this construct:
["<html><head><title>Hello, world!</title></head>",
"<body><h1>Hello, world!</h1>",
"<p><a href='/osinfo'>OS Info</a></p>",
"</body></html>"]
.join('\n')
Yes, this is the code used in the same example in previous versions of this book. This is what we can do with ES-2015:
`<html><head><title>Hello, world!</title></head>
<body><h1>Hello, world!</h1>
<p><a href='/osinfo'>OS Info</a></p>
</body></html>`
This is more succinct and straightforward. The opening quote is on the first line, the closing quote on the last line, and everything in between is part of our string.
The real purpose of the _template strings_ feature is supporting strings where we can easily substitute values directly into the string. Most other programming languages support this ability, and now JavaScript does too.
Pre-ES-2015, a programmer would do this:
[...
"<tr><th>OS Type</th><td>{ostype} {osplat} {osarch} {osrelease}</td></tr>"
... ].join('\n')
.replace("{ostype}", os.type())
.replace("{osplat}", os.platform())
.replace("{osarch}", os.arch())
.replace("{osrelease}", os.release())
Again, this is extracted from the same example in previous versions of this book. With template strings, this can be written as follows:
`...<tr><th>OS Type</th><td>${os.type()} ${os.platform()} ${os.arch()} ${os.release()}</td></tr>...`
Within a template string, the part within the `${ .. }` brackets is interpreted as an expression. It can be a simple mathematical expression, a variable reference, or, as in this case, a function call.
The last thing to mention is a matter of indentation. In normal coding, one indents a long argument list to the same level as the containing function call. But, for these multiline string examples, the text content is flush with column 0. What's up?
This may impede readability of your code, so it's worth weighing code readability against another issue, excess characters in the HTML output. The blanks we would use to indent the code for readability will become part of the string and will be output in the HTML. By making the code flush with column 0, we don't add excess blanks to the output at the cost of some code readability.
# HTTP Sniffer – listening to the HTTP conversation
The events emitted by the HTTPServer object can be used for additional purposes beyond the immediate task of delivering a web application. The following code demonstrates a useful module that listens to all the HTTP Server events. It could be a useful debugging tool, which also demonstrates how HTTP server objects operate.
Node.js's HTTP Server object is an `EventEmitter` and the HTTP Sniffer simply listens to every server event, printing out information pertinent to each event.
Create a file named `httpsniffer.js` containing the following code:
var util = require('util');
var url = require('url');
exports.sniffOn = function(server) {
server.on('request', (req, res) => {
util.log('e_request');
util.log(reqToString(req));
});
server.on('close', errno => { util.log('e_close errno='+ errno); });
server.on('checkContinue', (req, res) => {
util.log('e_checkContinue');
util.log(reqToString(req));
res.writeContinue();
});
server.on('upgrade', (req, socket, head) => {
util.log('e_upgrade');
util.log(reqToString(req));
});
server.on('clientError', () => { util.log('e_clientError'); });
};
var reqToString = exports.reqToString = function(req) {
var ret=`req ${req.method} ${req.httpVersion} ${req.url}` +'\n';
ret += JSON.stringify(url.parse(req.url, true)) +'\n';
var keys = Object.keys(req.headers);
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
ret += `${i} ${key}: ${req.headers[key]}` +'\n';
}
if (req.trailers)
ret += req.trailers +'\n';
return ret;
};
That was a lot of code! But the key to it is the `sniffOn` function. When given an HTTP Server function, it uses the `.on` function to attach listener functions that print data about each event emitted by the HTTP Server object. It gives a fairly detailed trace of HTTP traffic on an application.
In order to use it, simply insert this code just before the `listen` function in `server.js`:
**require('./httpsniffer').sniffOn(server);**
server.listen(8124);
console.log('listening to http://localhost:8124');
With this in place, run the server as we did earlier. You can visit `http://localhost:8124/` in your browser and see the following console output:
**$ node server.js**
**listening to http://localhost:8124**
**30 Jan 16:32:39 - request**
**30 Jan 16:32:39 - request GET 1.1 /**
**{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":"","query":{},"pathname":"/","path":"/","href":"/"}**
**0 host: localhost:8124**
**1 connection: keep-alive**
**2 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8**
**3 upgrade-insecure-requests: 1**
**4 user-agent: Mozilla/5.0 (X11; CrOS x86_64 7520.67.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.110 Safari/537.36**
**5 accept-encoding: gzip, deflate, sdch**
**6 accept-language: en-US,en;q=0.8**
**[object Object]**
**30 Jan 16:32:49 - request**
**30 Jan 16:32:49 - request GET 1.1 /osinfo**
**{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":"","query":{},"pathname":"/osinfo","path":"/osinfo","href":"/osinfo"}**
**0 host: localhost:8124**
**1 connection: keep-alive**
**2 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8**
**3 upgrade-insecure-requests: 1**
**4 user-agent: Mozilla/5.0 (X11; CrOS x86_64 7520.67.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.110 Safari/537.36**
**5 referer: http://localhost:8124/**
**6 accept-encoding: gzip, deflate, sdch**
**7 accept-language: en-US,en;q=0.8**
**[object Object]**
You now have a tool for snooping on HTTPServer events. This simple technique prints a detailed log of event data. The pattern can be used for any `EventEmitter` object. You can use this technique as a way to inspect the actual behavior of `EventEmitter` objects in your program.
# Web application frameworks
The HTTPServer object is very close to the HTTP protocol. While this is powerful in the same way that driving a stick shift car gives you low-level control over a car, typical web application programming is better done at a higher level. It's better to abstract away the HTTP details and concentrate on your application.
The Node.js developer community has developed quite a few modules to help with different aspects of abstracting away HTTP protocol details. You can take a look at a couple of curated lists at <http://nodeframework.com/> and <https://github.com/vndmtrx/awesome-nodejs>.
One reason to use a web framework is that they often provide all the usual best practices that have come from web application development of over 20 years. They have been listed as follows:
* Providing a page for bad URLs (the _404_ page)
* Screening URLs and forms for any injected scripting attacks
* Supporting the use of cookies to maintain sessions
* Logging requests for both usage tracking and debugging
* Authentication
* Handling static files, such as images, CSS, JavaScript, or HTML
* Providing cache control headers to caching proxies
* Limiting things such as page size or execution time
Web frameworks help you invest your time in the task without getting lost in the details of implementing HTTP protocol. Abstracting away details is a time-honored way for programmers to be more efficient. This is especially true when using a library or framework providing prepackaged functions that take care of the details.
# Getting started with Express
Express is perhaps the most popular Node.js web app framework. It's so popular that it's part of the MEAN Stack acronym. MEAN refers to MongoDB, ExpressJS, AngularJS, and Node.js. Express is described as being _Sinatra-like_ , referring to a popular Ruby application framework, and that it isn't very opinionated. This means Express is not at all strict about how your code is structured; you just write it the way you think is best.
You can visit the home page for Express at <http://expressjs.com/>.
Shortly, we'll implement a simple application to calculate Fibonacci numbers using Express, and in later chapters, we'll do quite a bit more with Express. We'll also explore how to mitigate the performance problems from computationally intensive code we discussed earlier.
Let's start by installing the **Express Generator**. While we can just start writing some code, the Express Generator gives a blank starting application. We'll take that and modify it.
Install it using following commands:
**$ mkdir fibonacci**
**$ cd fibonacci**
**$ npm install express-generator@4.x**
This is different from the suggested installation method on the Express website, which was to use the `-g` tag for a global install. We're also using an explicit version number to ensure compatibility.
Earlier, we discussed how many now recommend against installing modules globally. In the Twelve-Factor model, it's strongly recommended to not install global dependencies, and that's what we're doing.
The result is that an `express` command is installed in the `./node_modules/.bin` directory:
**$ ls node_modules/.bin/**
**express**
To run the command:
**$ ./node_modules/.bin/express --help**
**Usage: express [options] [dir]**
**Options:**
**-h, --help output usage information**
**-V, --version output the version number**
**-e, --ejs add ejs engine support (defaults to jade)**
**--hbs add handlebars engine support**
**-H, --hogan add hogan.js engine support**
**-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)**
**--git add .gitignore**
**-f, --force force on non-empty directory**
We probably don't want to type `./node_modules/.bin/express` every time we run the Express Generator application, or, for that matter, any of the other applications that provide command-line utilities. Fortunately, modifying the `PATH` environment variable is an easy solution:
**$ export PATH=node_modules/.bin:${PATH}**
This works for a `bash` shell. But, for `csh` users, try this:
**$ setenv PATH node_modules/.bin:${PATH}**
With the `PATH` environment variable set like this, the `express` command can be directly executed. Let's now use it to generate a blank starter application.
Now that you've installed `express-generator` in the `fibonacci` directory, use it to set up the blank framework application:
This created for us a bunch of files which we'll walk through in a minute. The `node_modules` directory still has the `express-generator` module, which is now not useful. We can just leave it there and ignore it, or we can add it to the `devDependencies` of the `package.json` it generated. Alternatively, we can uninstall it as shown in the preceding screenshot.
The next thing to do is run the blank application in the way we're told. The command shown, `npm start`, relies on a section of the supplied `package.json` file:
"scripts": {
"start": "node ./bin/www"
},
The npm tool supports scripts that are ways to automate various tasks. We'll use this capability throughout the book to do various things. Most npm scripts are run with the `npm run scriptName` command, but the `start` command is explicitly recognized by npm and can be run as shown previously.
The first step is to install the dependencies (`npm install`), then to start the application:
We can modify the supplied `npm start` script to print debugging information on the screen. Change the `scripts` section to the following:
"scripts": {
"start": "DEBUG=fibonacci:* node ./bin/www"
},
Adding `DEBUG=fibonacci:*` this way sets an environment variable, `DEBUG`, as shown in the screenshot. In Express applications, the `DEBUG` variable turns on debugging code, which prints an execution trace that's useful for debugging.
Since the output says it is listening on port `3000`, we direct our browser to `http://localhost:3000/` and see the following output:
## Walking through the default Express application
We have a working blank Express application; let's look at what was generated for us. We're doing this to familiarize ourselves with Express before diving in to start coding our Fibonacci application.
Because we used the `--ejs` option, this application is set up to use the EJS template engine. The template engine chosen assists with generating HTML. EJS is documented at <http://ejs.co/>.
The `views` directory contains two files, `error.ejs` and `index.ejs`. These are both EJS templates that we'll modify later.
The `routes` directory contains the initial routing setup, that is, the code to handle specific URLs. We'll modify these later.
The `public` directory will contain assets that the application doesn't generate, but are simply sent to the browser. What's initially installed is a CSS file, `public/stylesheets/style.css`.
The `package.json` file contains our dependencies and other metadata.
The `bin` directory contains the `www` script that we saw earlier. That's a Node.js script, which initializes the `HTTPServer` objects, starts it listening on a TCP port, and calls the last file we'll discuss, `app.js`. These scripts initialize Express, hook up the routing modules, and do other things.
There's a lot going on in the `www` and `app.js` scripts, so let's start with the application initialization. Let's first take a look at a couple of lines in `app.js`:
var express = require('express');
...
var app = express();
...
module.exports = app;
This means that `app.js` is a module that exports the object returned by the `express` module.
Now, let's turn to the `www` script. The first thing to see is it starts with this line:
#!/usr/bin/env node
This is a Unix/Linux technique to make a command script. It says to run the following as a script using the `node` command.
It calls the `app.js` module as follows:
var app = require('../app');
...
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
...
var server = http.createServer(app);
...
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
We see where port `3000` comes from; it's a parameter to the `normalizePort` function. We also see that setting the `PORT` environment variable will override the default port `3000`. Try running the following command:
**$ PORT=4242 DEBUG=fibonacci:* npm start**
The application now tells you that it's listening on port `4242`, where you can ponder the meaning of life.
The `app` object is next passed to `http.createServer()`. A look in the Node.js documentation tells us this function takes a `requestListener`, which is simply a function that takes the `request` and `response` objects we've seen previously. This tells us the `app` object is such a function.
Finally, the `www` script starts the server listening on the port we specified.
Let's now walk through `app.js` in more detail:
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
This tells Express to look for templates in the `views` directory and to use the EJS templating engine.
The `app.set` function is used for setting application properties. It'll be useful to browse the API documentation as we go through (<http://expressjs.com/en/4x/api.html>).
Next is a series of `app.use` calls:
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
The `app.use` function mounts middleware functions. This is an important piece of Express jargon we will discuss shortly. At the moment, let's say that middleware functions are executed during the processing of routes. This means all the features named here are enabled in `app.js`:
* Logging is enabled using the Morgan request logger. Visit <https://www.npmjs.com/package/morgan> for its documentation.
* The `body-parser` module handles parsing HTTP request bodies. Visit <https://www.npmjs.com/package/body-parser> for its documentation.
* The `cookie-parser` module is used to parse HTTP cookies. Visit <https://www.npmjs.com/package/cookie-parser> for its documentation.
* A static file web server configured to serve the asset files in the `public` directory.
* Two router modules, `routes` and `users`, to set up which functions handle which URLs.
## The Express middleware
Let's round out the walkthrough of `app.js` by discussing what middleware functions do for our application. We have an example at the end of the script:
app.use(function(req, res, next) {
var err = new Error('Not found');
err.status = 404;
next(err);
});
The comment says `catch 404 and forward to error handler`. As you probably know, an `HTTP 404` status means the requested resource was not found. We need to tell the user their request wasn't satisfied, and this is the first step in doing so. Before getting to the last step of reporting this error, you must learn how middleware works.
We do have a middleware function right in front of us. Refer to its documentation at <http://expressjs.com/en/guide/writing-middleware.html>.
Middleware functions take three arguments. The first two, `request` and `response`, are equivalent to the `request` and `response` of the Node.js HTTP request object. However, Express expands the objects with additional data and capabilities. The last, `next`, is a callback function controlling when the request-response cycle ends, and it can be used to send errors down the middleware pipeline.
The incoming request gets handled by the first middleware function, then the next, then the next, and so on. Each time the request is to be passed down the chain of middleware functions, the `next` function is called. If `next` is called with an error object, as shown here, an error is being signaled. Otherwise, the control simply passes to the next middleware function in the chain.
What happens if `next` is not called? The HTTP request will _hang_ because no response has been given. A middleware function gives a response when it calls functions on the `response` object, such as `res.send` or `res.render`.
For example, consider the inclusion of `app.js`:
app.get('/', function(req, res) {
res.send('Hello World!');
});
This does not call `next`, but instead calls `res.send`. This is the correct method of ending the request-response cycle, by sending a response (`res.send`) to the request. If neither `next` nor `res.send` is called, the request never gets a response.
Hence, a middleware function does one of the following four things:
* Executes its own business logic. The request logger middleware shown earlier is an example.
* Modifies the request or response objects. Both the `body-parser` and `cookie-parser` do so, looking for data to add to the `request` object.
* Calls `next` to proceed to the next middleware function or else signals an error.
* Sends a response, ending the cycle.
The ordering of middleware execution depends on the order they're added to the `app` object. The first added is executed first, and so on.
## Middleware and request paths
We've seen two kinds of middleware functions so far. In one, the first argument is the handler function. In the other, the first argument is a string containing a URL snippet, and the second argument is the handler function.
What's actually going on is `app.use` has an optional first argument the path the middleware is _mounted_ on. The path is a pattern match against the request URL, and the given function is triggered if the URL matches the pattern. There's even a method to supply named parameters in the URL:
app.use('/user/profile/:id', function(req, res, next) {
userProfiles.lookup(req.params.id, (err, profile) => {
if (err) return next(err);
// do something with the profile
// Such as display it to the user
res.send(profile.display());
});
});
This path specification has a pattern, `:id`, and the value will land in `req.params.id`. In this example, we're suggesting a user profiles service, and that for this URL we want to display information about the named user.
Another way to use a middleware function is on a specific HTTP request method. With `app.use`, any request will be matched, but in truth, `GET` requests are supposed to behave differently than `POST` requests. You call `app.METHOD` where `METHOD` matches one of the HTTP request verbs. That is, `app.get` matches the `GET` method, `app.post` matches `POST`, and so on.
Finally, we get to the `router` object. This is a kind of middleware used explicitly for routing requests based on their URL. Take a look at `routes/users.js`:
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
module.exports = router;
We have a module whose `exports` object is a router. This router has only one route, but it can have any number of routes you think is appropriate.
Back in `app.js`, this is added as follows:
app.use('/users', users);
All the functions we discussed for the `app` object apply to the `router` object. If the request matches, the router is given the request for its own chain of processing functions. An important detail is that the request URL prefix is stripped when the request is passed to the router instance.
You'll notice that the `router.get` in `users.js` matches `'/'` and that this router is mounted on `'/users'`. In effect that `router.get` matches `/users` as well, but because the prefix was stripped, it specifies `'/'` instead. This means a router can be mounted on different path prefixes, without having to change the router implementation.
## Error handling
Now, we can finally get back to the generated `app.js`, the `404` error ( _page not found_ ), and any other errors the application might want to show to the user.
A middleware function indicates an error by passing a value to the `next` function call. Once Express sees an error, it will skip any remaining non-error routing, and it will only pass it to error handlers instead. An error handler function has a different signature than what we saw earlier.
In `app.js` that we're examining, this is our error handler:
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
Error handler functions take four parameters, with `err` added to the familiar `req`, `res`, and `next`. For this handler, we use `res.status` to set the HTTP response status code, and we use `res.render` to format an HTML response using the `views/error.ejs` template. The `res.render` function takes data, rendering it with a template to produce HTML.
This means any error in our application will land here, bypassing any remaining middleware functions.
# Calculating the Fibonacci sequence with an Express application
The Fibonacci numbers are the integer sequence: _0 1 1 2 3 5 8 13 21 34 ..._
Each entry in the list is the sum of the previous two entries in the list, and the sequence was invented in 1202 by Leonardo of Pisa, who was also known as Fibonacci. One method to calculate entries in the Fibonacci sequence is the recursive algorithm we showed earlier. We will create an Express application that uses the Fibonacci implementation and then explore several methods to mitigate performance problems in computationally intensive algorithms.
Let's start with the blank application we created in the previous step. We had you name that application `fibonacci` for a reason. We were thinking ahead.
In `app.js`, make the following changes:
* Delete the line `require('./routes/users')` and replace it with `var fibonacci = require('./routes/fibonacci');`
* Delete the line: `app.use('/users', users)` and replace it with `app.use('/fibonacci', fibonacci);`
For the Fibonacci application, we don't need to support users. We need a page to query for a number for which we'll calculate the Fibonacci number. The `fibonacci` module we'll show next will serve that purpose.
In the top-level directory, create a file, `math.js`, containing this extremely simplistic Fibonacci implementation:
var fibonacci = exports.fibonacci = function(n) {
if (n === 1) return 1;
else if (n === 2) return 1;
else return fibonacci(n-1) + fibonacci(n-2);
}
In the `views` directory, create a file named `top.ejs`:
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1><%= title %></h1>
<div class='navbar'>
<p><a href='/'>home</a>
| <a href='/fibonacci'>Fibonacci's</a></p>
</div>
This file contains the top part of HTML pages we'll send to the users.
Another file named `bottom.ejs` contains the following:
</body>
</html>
This file contains the bottom part of the HTML pages.
Change `views/index.ejs` to just contain the following:
<% include top %>
<p>Welcome to the Math calculator</p>
<% include bottom %>
This serves as the front page of our application. While it doesn't contain any functionality, note that `top.ejs` has a link to `/fibonacci`, which we'll look at next.
Together, `top.ejs` and `bottom.ejs` let us use a consistent look and overall page layout without having to replicate it in every page.
Create a file, `views/fibonacci.ejs`, containing the following code:
<% include top %>
<% if (typeof fiboval !== "undefined") { %>
<p>Fibonacci for <%= fibonum %> is <%= fiboval %></p>
<hr/>
<% } %>
<p>Enter a number to see its' Fibonacci number</p>
<form name='fibonacci' action='/fibonacci' method='get'>
<input type='text' name='fibonum' />
<input type='submit' value='Submit' />
</form>
<% include bottom %>
### Tip
Remember that the files in `views` are templates into which data is rendered. They serve the **View** aspect of the **Model-View-Controller** paradigm, hence the directory name.
Each of the two views, `views/index.ejs` and `views/fibonacci.ejs`, are truncated pieces of a full HTML page. Where does the rest come from? It comes from `top.ejs` and `bottom.ejs`, which are meant to be included by the every template to give us a consistent page layout.
In the `routes` directory, delete the `user.js` module. It is generated by the Express framework, but we will not use it in this application.
In `routes/index.js`, change the router function to the following:
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: "Math Calculator" });
});
Then, finally, in the `routes` directory, create a file named `fibonacci.js` containing the following code:
var express = require('express');
var router = express.Router();
var math = require('../math');
router.get('/', function(req, res, next) {
if (req.query.fibonum) {
// Calculate directly in this server
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fibonum: req.query.fibonum,
fiboval: math.fibonacci(req.query.fibonum)
});
} else {
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fiboval: undefined
});
}
});
module.exports = router;
In `package.json`, change the `scripts` section to the following:
"scripts": {
"start": "DEBUG=fibonacci:* node ./bin/www"
},
This lets us use `npm start` to run the script and always have debugging messages enabled. And, now we're ready to do so:
**$ npm start**
**> fibonacci@0.0.0 start /Users/david/chap04/fibonacci**
**> DEBUG=fibonacci:* node ./bin/www**
**fibonacci:server Listening on port 3000 +0ms**
As it suggests, you can visit `http://localhost:3000/` and see what we have:
This page is rendered from the `views/index.ejs` template. Simply click on the Fibonacci link to go to the next page, which is of course rendered from the `views/fibonacci.ejs` template. On that page, you'll be able to enter a number, click on the **Submit** button, and get an answer (hint: pick a number below 40 if you want your answer in a reasonable amount of time):
Let's walk through the application to discuss how it works.
There are two routes in `app.js`, the route for `/`, which is handled by `routes/index.js`, and the route for `/fibonacci`, which is handled by `routes/fibonacci.js`.
The `res.render` function renders the named template, using the provided data values and emits the result as an HTTP response. For the home page of this application, the rendering code (`routes/index.js`) and template (`views/index.ejs`) aren't much, and it is on the Fibonacci page where all the action is happening.
The `views/fibonacci.ejs` template contains a form in which the user enters a number. Because it is a `GET` form, when the user clicks on the **Submit** button, the browser will issue an HTTP `GET` on the `/fibonacci` URL. What distinguishes one `GET` on `/fibonacci` from another is whether the URL contains a query parameter named `fibonum`. When the user first enters the page, there is no `fibonum` and hence nothing to calculate. After the user has entered a number and clicked on **Submit** , there is a `fibonum` and something to calculate.
Express automatically parses the query parameters, making them available as `req.query`. That means `routes/fibonacci.js` can quickly check whether there is a `fibonum`. If there is, it calls the `fibonacci` function to calculate the value.
Earlier, we asked you to enter a number less than 40. Go ahead and enter a larger number, such as 50, but go take a coffee break because this is going to take a while to calculate.
## Computationally intensive code and the Node.js event loop
This Fibonacci example is purposely inefficient to demonstrate an important consideration for your applications. What happens to the Node.js event loop when running long computations? To see the effect, open two browser windows, each visiting the Fibonacci page. In one, enter the number 55 or greater, and in the other, enter 10. Note that the second window freezes, and if you leave it running long enough, the answer will eventually pop up in both windows. What's happening is the Node.js event loop is blocked from processing events because the Fibonacci algorithm is running and does not ever yield to the event loop.
Since Node.js has a single execution thread, processing requests depends on request handlers quickly returning to the event loop. Normally, the asynchronous coding style ensures that the event loop executes regularly. This is true even for requests that load data from a server halfway around the globe because asynchronous I/O is non-blocking and control is quickly returned to the event loop. The naïve Fibonacci function we chose doesn't fit into this model because it's a long-running blocking operation. This type of event handler prevents the system from processing requests and stops Node.js from doing what it's meant to do, namely to be a blistering fast web server.
In this case, the long-response-time problem is obvious. Response time quickly escalates to the point where you can take a vacation to Tibet during the time it takes to respond with the Fibonacci number!
To see this more clearly, create a file named `fibotimes.js` containing the following code:
var math = require('./math');
var util = require('util');
for (var num = 1; num < 80; num++) {
util.log('Fibonacci for '+ num +' = '+ math.fibonacci(num));
}
Now run it. You will get the following output:
**$ node fibotimes.js**
**31 Jan 14:41:28 - Fibonacci for 1 = 1**
**31 Jan 14:41:28 - Fibonacci for 2 = 1**
**31 Jan 14:41:28 - Fibonacci for 3 = 2**
**31 Jan 14:41:28 - Fibonacci for 4 = 3**
**31 Jan 14:41:28 - Fibonacci for 5 = 5**
**31 Jan 14:41:28 - Fibonacci for 6 = 8**
**31 Jan 14:41:28 - Fibonacci for 7 = 13**
**31 Jan 14:41:28 - Fibonacci for 8 = 21**
**31 Jan 14:41:28 - Fibonacci for 9 = 34**
**...**
**31 Jan 14:42:27 - Fibonacci for 38 = 39088169**
**31 Jan 14:42:28 - Fibonacci for 39 = 63245986**
**31 Jan 14:42:31 - Fibonacci for 40 = 102334155**
**31 Jan 14:42:34 - Fibonacci for 41 = 165580141**
**31 Jan 14:42:40 - Fibonacci for 42 = 267914296**
**31 Jan 14:42:50 - Fibonacci for 43 = 433494437**
**31 Jan 14:43:06 - Fibonacci for 44 = 701408733**
This quickly calculates the first 40 or so members of the Fibonacci sequence, but after the 40th member, it starts taking a couple of seconds per result and quickly degrades from there. It is untenable to execute code of this sort on a single-threaded system that relies on a quick return to the event loop.
There are two general ways in Node.js to solve this problem:
* **Algorithmic refactoring** : Perhaps, like the Fibonacci function we chose, one of your algorithms is suboptimal and can be rewritten to be faster. Or, if not faster, it can be split into callbacks dispatched through the event loop. We'll look at one such method in a moment.
* **Creating a backend service** : Can you imagine a backend server dedicated to calculating Fibonacci numbers? Okay, maybe not, but it's quite common to implement backend servers to offload work from frontend servers, and we will implement a backend Fibonacci server at the end of this chapter.
### Algorithmic refactoring
To prove that we have an artificial problem on our hands, here is a much more efficient Fibonacci function:
var fibonacciLoop = exports.fibonacciLoop = function(n) {
var fibos = [];
fibos[0] = 0;
fibos[1] = 1;
fibos[2] = 1;
for (var i = 3; i <= n; i++) {
fibos[i] = fibos[i-2] + fibos[i-1];
}
return fibos[n];
}
If we substitute a call to `math.fibonacciLoop` in place of `math.fibonacci`, these programs run much faster. Even this isn't the most efficient implementation; for example, a simple prewired lookup table is much faster at the cost of some memory.
Edit `fibotimes.js` as follows and rerun the script. The numbers will fly by so fast your head will spin:
for (var num = 1; num < 8000; num++) {
// util.log('Fibonacci for '+ num +' = '+
// math.fibonacci(num));
util.log('Fibonacci for '+ num +' = '+
math.fibonacciLoop(num));
}
Some algorithms aren't so simple to optimize and still take a long time to calculate the result. In this section, we're exploring how to handle inefficient algorithms, and therefore will stick with the inefficient Fibonacci implementation.
It is possible to divide the calculation into chunks and then dispatch computation of those chunks through the event loop. Add the following code to `math.js`:
var fibonacciAsync = exports.fibonacciAsync = function(n, done) {
if (n === 0)
done(undefined, 0);
else if (n === 1 || n === 2)
done(undefined, 1);
else {
setImmediate(function() {
fibonacciAsync(n-1, function(err, val1) {
if (err) done(err);
else setImmediate(function() {
fibonacciAsync(n-2, function(err, val2) {
if (err) done(err);
else done(undefined, val1+val2);
});
});
});
});
}
}
This converts the `fibonacci` function from a synchronous function to an asynchronous function one with a callback. Using `setImmediate`, each stage of the calculation is managed through Node.js's event loop and the server can easily handle other requests while churning away on a calculation. It does nothing to reduce the computation required; this is still the silly, inefficient Fibonacci algorithm. All we've done is spread the computation through the event loop.
Because it's an asynchronous function, we will need to change our application code in `router/fibonacci.js` to the following:
var express = require('express');
var router = express.Router();
var math = require('../math');
router.get('/', function(req, res, next) {
if (req.query.fibonum) {
math.fibonacciAsync(req.query.fibonum, (err, fiboval) => {
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fibonum: req.query.fibonum,
fiboval: fiboval
});
});
} else {
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fiboval: undefined
});
}
};
With this change, the server no longer freezes when calculating a large Fibonacci number. The calculation of course still takes a long time, but at least other users of the application aren't blocked.
You can verify this by again opening two browser windows on the application, entering 55 in one window and in the other start requesting smaller Fibonacci numbers. Unlike the previous behavior, the second browser window will give you Fibonacci numbers while the other is still computing away.
It's up to you, and your specific algorithms, to choose how to best optimize your code and to handle any long-running computations you may have.
# Making HTTP Client requests
The next way to mitigate computationally intensive code is to push the calculation to a backend process. To explore that strategy, we'll request computations from a backend Fibonacci server using the HTTP Client object to do so. However, before we look at that, let's first talk in general about using the HTTP Client object.
Node.js includes an HTTP Client object useful for making HTTP requests. It has enough capability to issue any kind of HTTP request, but, for example, it does not emulate a full browser, so don't get delusions of this being a full-scale test automation tool. Its scope focuses solely on the HTTP protocol. It's possible to build a browser emulator on top of this HTTP client, for example, to build a test automation tool. The HTTP Client object can be used for any kind of HTTP request, such as calling a **Representational State Transfer** ( **REST** ) web service.
Let's start with some code inspired by the `wget` or `curl` commands to make HTTP requests and show the results. Create a file named `wget.js` containing this code:
var http = require('http');
var url = require('url');
var util = require('util');
var argUrl = process.argv[2];
var parsedUrl = url.parse(argUrl, true);
// The options object is passed to http.request
// telling it the URL to retrieve
var options = {
host: parsedUrl.hostname,
port: parsedUrl.port,
path: parsedUrl.pathname,
method: 'GET'
};
if (parsedUrl.search) options.path += "?"+parsedUrl.search;
var req = http.request(options);
// Invoked when the request is finished
req.on('response', res => {
util.log('STATUS: ' + res.statusCode);
util.log('HEADERS: ' + util.inspect(res.headers));
res.setEncoding('utf8');
res.on('data', chunk => { util.log('BODY: ' + chunk); });
res.on('error', err => { util.log('RESPONSE ERROR: ' + err); });
});
// Invoked on errors
req.on('error', err => { util.log('REQUEST ERROR: ' + err); });
req.end();
You can run the script as follows:
**$ node wget.js http://example.com**
**31 Jan 15:04:29 - STATUS: 200**
**31 Jan 15:04:29 - HEADERS: { 'accept-ranges': 'bytes',**
**'cache-control': 'max-age=604800',**
**'content-type': 'text/html',**
**date: 'Sun, 31 Jan 2016 23:04:29 GMT',**
**etag: '"359670651+gzip"',**
**expires: 'Sun, 07 Feb 2016 23:04:29 GMT',**
**'last-modified': 'Fri, 09 Aug 2013 23:54:35 GMT',**
**server: 'ECS (rhv/818F)',**
**vary: 'Accept-Encoding',**
**'x-cache': 'HIT',**
**'x-ec-custom-error': '1',**
**'content-length': '1270',**
**connection: 'close' }**
There's more in the printout, namely the HTML of the page at `http://example.com/`.
The purpose of `wget.js` is to make an HTTP request and show you voluminous detail of the response.
An HTTP request is initiated with the `http.request` method, as follows:
var http = require('http');
var options = {
host: 'example.com',
port: 80,
path: null,
method: 'GET'
};
var request = http.request(options,
function(response) { .. });
The `options` object describes the request to make, and the `callback` function is called when the response arrives. The `options` object is fairly straightforward with the `host`, `port`, and `path` fields specifying the URL being requested. The `method` field must be one of the HTTP verbs (`GET`, `PUT`, `POST`, and so on). You can also give a `headers` array for the headers in the HTTP request. For example, you might need to provide a cookie:
var options = {
headers: {
'Cookie': '.. cookie value'
}
};
The `response` object is itself an `EventEmitter`, which emits the `data` and `error` events. The `data` event is called as data arrives, and the `error` event is, of course, called on errors.
The request object is a `WritableStream`, which is useful for HTTP requests containing data, such as `PUT` or `POST`. This means the `request` object has a `write` function that writes data to the requester. The data format in an HTTP request is specified by the MIME standard originally created to give us better e-mail. Around 1992, the WWW community worked with the MIME standard committee to apply portions of MIME for use in HTTP. HTML forms will post with a Content-Type of `multipart/form-data`, for example.
# Calling a REST backend service from an Express application
Now that we've seen how to make HTTP client requests, we can look at how to make a REST query inside an Express web application. What that effectively means is to make an HTTP `GET` request to a backend server, which responds with the Fibonacci number represented by the URL. To do so, we'll refactor the Fibonacci application to make a Fibonacci server that is called from the application. While this is overkill for calculating Fibonacci numbers, it lets us look at the basics of implementing a multi-tier application stack.
Inherently, calling a REST service is an asynchronous operation. That means calling the REST service will involve a function call to initiate the request and a callback function to receive the response. REST services are accessed over HTTP, so we'll use the HTTP client object to do so.
## Implementing a simple REST server with Express
While Express has a powerful templating system, making it suitable for delivering HTML web pages to browsers, it can also be used to implement a simple REST service. The parameterized URL's we showed earlier (`/user/profile/:id`) can act like parameters to a REST call. And Express makes it easy to return data encoded in JSON.
Now, create a file named `fiboserver.js` containing this code:
var math = require('./math');
var express = require('express');
var logger = require('morgan');
var app = express();
app.use(logger('dev'));
app.get('/fibonacci/:n', (req, res, next) => {
math.fibonacciAsync(Math.floor(req.params.n), (err, val) => {
if (err) next('FIBO SERVER ERROR ' + err);
else {
res.send({
n: req.params.n,
result: val
});
}
});
});
app.listen(process.env.SERVERPORT);
This is a stripped-down Express application that gets right to the point of providing a Fibonacci calculation service. The one route it supports, handles the Fibonacci computation using the same functions we've already worked with.
This is the first time we've seen `res.send` used. It's a flexible way to send responses which can take an array of header values (for the HTTP response header), and an HTTP status code. As used here, it automatically detects the object, formats it as JSON text, and sends it with the correct `Content-Type`.
Then, in `package.json`, add this to the `scripts` section:
"server": "SERVERPORT=3002 node ./fiboserver"
This automates launching our Fibonacci service.
### Note
Note that we're specifying the TCP/IP port via an environment variable and using that variable in the application. This is another aspect of the Twelve-Factor application model; to put configuration data in the environment.
Now, let's run it:
**$ npm run server**
**> fibonacci@0.0.0 server /Users/david/chap04/fibonacci**
**> SERVERPORT=3002 node ./fiboserver**
Then, in a separate command window, we can use the `curl` program to make some requests against this service:
**$ curl -f http://localhost:3002/fibonacci/10**
**{"n":"10","result":55}**
**$ curl -f http://localhost:3002/fibonacci/11**
**{"n":"11","result":89}**
**$ curl -f http://localhost:3002/fibonacci/12**
**{"n":"12","result":144}**
Over in the window where the service is running, we'll see a log of `GET` requests and how long each took to process.
Now, let's create a simple client program, `fiboclient.js`, to programmatically call the Fibonacci service:
var http = require('http');
var util = require('util');
[
"/fibonacci/30", "/fibonacci/20", "/fibonacci/10",
"/fibonacci/9", "/fibonacci/8", "/fibonacci/7",
"/fibonacci/6", "/fibonacci/5", "/fibonacci/4",
"/fibonacci/3", "/fibonacci/2", "/fibonacci/1"
].forEach(path => {
util.log('requesting ' + path);
var req = http.request({
host: "localhost",
port: 3002,
path: path,
method: 'GET'
}, res => {
res.on('data', chunk => {
util.log('BODY: ' + chunk);
});
});
req.end();
});
Then, in `package.json`, add this to the `scripts` section:
"client": "node ./fiboclient"
Then run the client app:
**$ npm run client**
**> fibonacci@0.0.0 client /Users/david/chap04/fibonacci**
**> node ./fiboclient**
**31 Jan 16:37:48 - requesting /fibonacci/30**
**31 Jan 16:37:48 - requesting /fibonacci/20**
**31 Jan 16:37:48 - requesting /fibonacci/10**
**31 Jan 16:37:48 - requesting /fibonacci/9**
**31 Jan 16:37:48 - requesting /fibonacci/8**
**31 Jan 16:37:48 - requesting /fibonacci/7**
**31 Jan 16:37:48 - requesting /fibonacci/6**
**31 Jan 16:37:48 - requesting /fibonacci/5**
**31 Jan 16:37:48 - requesting /fibonacci/4**
**31 Jan 16:37:48 - requesting /fibonacci/3**
**31 Jan 16:37:48 - requesting /fibonacci/2**
**31 Jan 16:37:48 - requesting /fibonacci/1**
**31 Jan 16:37:48 - BODY: {"n":"2","result":1}**
**31 Jan 16:37:48 - BODY: {"n":"1","result":1}**
**31 Jan 16:37:48 - BODY: {"n":"3","result":2}**
**31 Jan 16:37:48 - BODY: {"n":"4","result":3}**
**31 Jan 16:37:48 - BODY: {"n":"5","result":5}**
**31 Jan 16:37:48 - BODY: {"n":"6","result":8}**
**31 Jan 16:37:48 - BODY: {"n":"7","result":13}**
**31 Jan 16:37:48 - BODY: {"n":"8","result":21}**
**31 Jan 16:37:48 - BODY: {"n":"9","result":34}**
**31 Jan 16:37:48 - BODY: {"n":"10","result":55}**
**31 Jan 16:37:48 - BODY: {"n":"20","result":6765}**
**31 Jan 16:37:59 - BODY: {"n":"30","result":832040}**
We're building our way toward adding the REST service to the web application. At this point, we've proved several things, one of which is the ability to call the REST service and use the value as data in our program.
We also, inadvertently, demonstrated the issue with long-running calculations. You'll notice the requests were made from the largest to the smallest, but the results appeared in almost exactly the opposite order. Why? It's because of the processing time for each request, and the inefficient algorithm we're using. The computation time increases enough to ensure that the larger request values require enough time to reverse the order.
What happened is that `fiboclient.js` sends all its requests right away, and then each one goes into a wait for the response to arrive. Because the server is using `fibonacciAsync`, it will work on calculating all responses simultaneously. The values which are quickest to calculate are the ones which will be ready first. As the responses arrive in the client, the matching response handler fires, and in this case, the result is printed to the console. The results will arrive when they're ready and not a millisecond sooner.
## Refactoring the Fibonacci application for REST
Now that we've implemented a REST-based server, we can return to the Fibonacci application, applying what you've learned to improve it. We will lift some of the code from `fiboclient.js` and transplant it into the application to do this. Change `routes/fibonacci.js` to the following code:
router.get('/', function(req, res, next) {
if (req.query.fibonum) {
var httpreq = require('http').request({
host: "localhost",
port: process.env.SERVERPORT,
path: "/fibonacci/"+Math.floor(req.query.fibonum),
method: 'GET'
},
httpresp => {
httpresp.on('data', chunk => {
var data = JSON.parse(chunk);
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fibonum: req.query.fibonum,
fiboval: data.result
});
});
httpresp.on('error', err => { next(err); });
});
httpreq.on('error', err => { next(err); });
httpreq.end();
} else {
res.render('fibonacci', {
title: "Calculate Fibonacci numbers",
fiboval: undefined
});
}
});
module.exports = router;
Then, in `package.json`, change the `scripts` entry to the following:
"start": "SERVERPORT=3002 DEBUG=fibonacci:* node ./bin/www",
This way, we duplicate the same environmental configuration for running both the Fibonacci service and the Fibonacci application.
In one command window, start the server:
**$ npm run server**
**> fibonacci@0.0.0 server /Users/david/chap04/fibonacci**
**> SERVERPORT=3002 node ./fiboserver**
In the other window, start the application:
**$ npm start**
**> fibonacci@0.0.0 start /Users/david/chap04/fibonacci**
**> SERVERPORT=3002 DEBUG=fibonacci:* node ./bin/www**
**fibonacci:server Listening on port 3000 +0ms**
Because we haven't changed the templates, the screen will look exactly as it did earlier.
We'll run into another problem with this solution. The asynchronous implementation of our inefficient Fibonacci algorithm will easily cause the Fibonacci service process to run out of memory. In the Node.js FAQ, <https://github.com/nodejs/node/wiki/FAQ>, it's suggested to use the `--max_old_space_size` flag. You'd add this in `package.json` as follows:
"server": "SERVERPORT=3002 node ./fiboserver --max_old_space_size 5000",
However, the FAQ also says that if you're running into maximum memory space problems, your application should probably be refactored. This gets back to our point several pages ago, that there are several approaches to addressing performance problems. One of which is algorithmic refactoring of your application.
Why did we go to this trouble when we could just directly call `fibonacciAsync`?
We can now push the CPU load for this heavyweight calculation to a separate server. Doing so would preserve CPU capacity on the frontend server so it can attend to web browsers. The heavy computation can be kept separate, and you can even deploy a cluster of backend servers sitting behind a load balancer evenly distributing requests. Decisions like this are made all the time to create multitier systems.
What we've demonstrated is that it's possible to implement simple multitier REST services in a few lines of Node.js and Express. The whole exercise gave us a chance to think about computationally intensive code in Node.js.
## Some RESTful modules and frameworks
Here are a few available packages and frameworks to assist your REST-based projects:
* Restify (<http://restify.com/>): This offers both client-side and server-side frameworks for both ends of REST transactions. The server-side API is similar to Express.
* Loopback (<https://strongloop.com/node-js/loopback-framework/>): This is an offering from StrongLoop, the current sponsor of the Express project. It offers a lot of features and is, of course, built on top of Express.
# Summary
You learned a lot in this chapter about Node's HTTP support and implementing web applications.
Now we can move on to implementing a more complete application, one for taking notes. We will use the Notes application for several upcoming chapters as a vehicle to explore the Express application framework, database access, deployment to cloud services or on your own server, and user authentication.
In the next chapter, we will build the basic infrastructure.
# Chapter 5. Your First Express Application
Now that we've got our feet wet building an Express application for Node.js, let's work on an application that performs a useful function. The application we'll build will keep a list of notes, and it will let us explore some aspects of a real application.
In this chapter, we'll only build the basic infrastructure of the application, and in the later chapters, we'll add features such as using different database engines to store the notes, user authentication, deployment on public servers, and other things.
# ES-2015 Promises and Express router functions
Before we get into developing our application, we have another new ES-2015 feature to discuss—the `Promise` class. Promise objects are used for deferred and asynchronous computation. A `Promise` class represents an operation that hasn't completed yet, but is expected to be completed in the future.
In Chapter 1, _About Node.js_ , we briefly discussed the `Promise` class while discussing Node.js's asynchronous execution model. Since Node.js was designed before the `Promise` class, the Node.js community follows a different convention for writing asynchronous code; this is the callback function. Those callback functions are called to perform any kind of deferred or asynchronous computation.
The `Promise` class approaches the same problem from a different angle. It has one large advantage in avoiding the so-called **Pyramid of Doom** that's inevitable with deeply nested callback functions.
Promises are just one way to work around this so-called _callback hell_. Over the years, several other approaches have been developed, some of which are very popular:
* <https://www.npmjs.com/package/bluebird>: This is a Promise implementation that predates ES-2015 and adds additional functionality
* <https://www.npmjs.com/package/q>: This is another Promise implementation
* <https://www.npmjs.com/package/async>: This is a collection of functions implementing many common patterns for using asynchronous functions
While the callback function approach to asynchronous programming has proved to be extremely flexible, we recognize there's a problem: the _Pyramid of Doom_. It's named after the shape the code takes after a few layers of nesting. Any multistage process can quickly escalate to code nested 15 levels deep.
Consider the following example:
router.get('/path/to/something', (req, res, next) => {
doSomething(arg1, arg2, (err, data1) => {
if (err) return next(err);
doAnotherThing(arg3, arg2, data1, (err2, data2) => {
if (err2) return next(err2);
somethingCompletelyDifferent(arg1, arg42, (err3, data3) => {
if (err3) return next(err3);
doSomethingElse((err4, data4) => {
if (err4) return next(err4);
res.render('page', { data });
});
});
});
});
});
We're about to write some code that, in the old style of Node.js, would have looked something like the following code. But, with the `Promise` class, we can take this problem.
We generate a Promise this way:
exports.asyncFunction = function(arg1, arg2) {
return new Promise((resolve, reject) => {
// perform some task or computation that's asynchronous
// for any error detected:
if (errorDetected) return reject(dataAboutError);
// When the task is finished
resolve(any, results);
});
};
### Note
Note that `asyncFunction` is an asynchronous function, but it does not take a callback. Instead, it returns a `Promise` object, and the asynchronous code is executed within a callback passed to the `Promise` class.
Your code must indicate the asynchronous status via the `resolve` and `reject` functions. Your caller then uses the function as follows:
asyncFunction(arg1, arg2)
.then((any, results) => {
// the operation succeeded
// do something with the results
})
.catch(err => {
// an error occurred
});
The system is fluid enough that the function passed in a `.then` can return something, such as another Promise, and you can chain the `.then` objects together. The `.then` and `.catch` add handler functions to the `Promise` object that you can think of as a handler queue.
The handler functions are executed one at a time. The result given by one `.then` function is used as the argument list of the next `.then` function.
## Promises and error handling
Promise objects can be in one of three states:
* **Pending** : This is the initial state, neither fulfilled nor rejected
* **Fulfilled** : This is the final state where it executed successfully and produced a result
* **Rejected** : This is the final state where execution failed
Consider this code segment similar to the one we'll use later in this chapter:
notes.read(req.query.key)
.then(note => { return filterNote(note); })
.then(note => { return swedishChefSpeak(note); })
.then(note => {
res.render('noteview', {
title: note ? note.title : "",
notekey: req.query.key,
note: note
});
})
.catch(err => { next(err); });
There are several places where errors can occur in this little bit of code. The `notes.read` function has several possible failure modes: the `filterNote` function might want to raise an alarm if it detects a cross-site scripting attack. The Swedish chef could be on strike. There could be a failure in `res.render` or the template being used. But we have only one way to catch and report errors. Are we missing something?
The `Promise` class automatically captures errors, sending them down the chain of operations attached to Promise. If the `Promise` class has an error on its hands, it skips over the `.then` functions and will instead invoke the first `.catch` function it finds. In other words, using instances of Promise provides a higher assurance of capturing and reporting errors. With the older convention, error reporting was trickier, and it was easy to forget to add correct error handling.
## Flattening our asynchronous code
The problem being addressed is that asynchronous coding in JavaScript results in the **Pyramid of Doom**. This coding pattern looks like simple ordinary function calls, ones that would execute in linear order from top to bottom. Instead, the pyramid is a nest of code that could execute in any order depending on the whims of event processing.
To explain, let's reiterate the example Ryan Dahl gave as the primary Node.js idiom:
db.query('SELECT ..etc..', function(err, resultSet) {
if (err) {
// Instead, errors arrive here
} else {
// Instead, results arrive here
}
});
// We WANT the errors or results to arrive here
The purpose—to avoid blocking the event loop with a long operation—has an excellent solution here: to defer processing the results or errors until "later". But this solution created this pyramid-shaped problem.
If the `resultSet` requires asynchronous processing, there's another layer of callbacks and so on, until this becomes a little pyramid. The problem is that results and errors land in the callback. Rather than delivering them to the next line of code, the errors and results are buried.
Promise objects help flatten the code so that it no longer takes a pyramidal shape. They also capture errors, ensuring delivery to a useful location. But those errors and results are still buried inside an anonymous function and do not get delivered to the next line of code.
The ECMAScript Committee is working on a proposal for ES-2016 to add two new keywords, `await` and `async`, that should give us the ability to land asynchronous errors and results in the place they belong: the next line of code. Refer to the official documentation at <https://tc39.github.io/ecmascript-asyncawait/> for details.
As proposed, you might be able to write the following code:
async UserFind(params) {
return await dbLookupFunction(params);
}
var userData = async UserFind({ email });
## Additional tools
While the `Promise` class is a big step forward, it doesn't solve everyone's needs. Additional libraries are becoming available with extra functionality or to wrap existing libraries so they return `Promise` objects.
Here are a few libraries to help you sail through commonly encountered scenarios:
* <https://www.npmjs.com/package/promise-tools>: This extends the `Promise` class with additional processing patterns beyond `Promise.all`
* <https://github.com/jwalton/node-promise-breaker>: This assists writing libraries that optionally accept an asynchronous callback function or return a `Promise` object if no callback is provided
* <https://www.npmjs.com/package/co>: This uses ES-2015 generators and generator functions to get very close to `async`/`await` functionality
* <https://www.npmjs.com/package/fs-promise>: This wraps Node.js filesystem functions to return `Promise` objects
# Express and the MVC paradigm
Express doesn't enforce an opinion on how you should structure the Model, View and Controller modules of your application. As we learned in the previous chapter, the blank application created by the Express Generator provides two aspects of the MVC model:
* The `views` directory contains template files, controlling the display portion, corresponding to the View.
* The `routes` directory contains code implementing the URLs recognized by the application and coordinating the response to each URL. This corresponds to the Controller.
This leaves one wondering where to put code corresponding to the Model. The role of the Model is to hold application data, changing it as instructed by the Controller, and supplying data requested by View code. At a minimum, the Model code should be in separate modules from the Controller code. This is to ensure a clean separation of concerns, for example, to ease unit testing of each.
The approach we'll use is to create a `models` directory as a sibling of the `views` and `routes` directories. The `models` directory will hold modules for storing the notes and related data. The API of these modules will provide functions to create, read, update, or delete data items (the CRUD model) and other functions necessary for the View code to do its thing.
The CRUD model stands for **C** reate, **R** ead, **U** pdate and **D** elete (or **D** estroy). These are the four basic operations of persistent data storage. The Notes application is structured as a CRUD application, to demonstrate the implementation of each of these operations.
We'll use functions named `create`, `read`, `update`, and `destroy` to implement each of the basic operations.
### Note
We're using the verb _destroy_ rather than _delete_ , because `delete` is a reserved word in JavaScript.
# Creating the Notes application
Let's start creating the Notes application as before, by using the Express Generator to give us a starting point:
**$ mkdir notes**
**$ cd notes**
**$ npm install express-generator@4.x**
**.. output**
**$ ./node_modules/.bin/express --ejs .**
**destination is not empty, continue? [y/N] y**
**create : .**
**create : ./package.json**
**create : ./app.js**
**create : ./public**
**create : ./public/javascripts**
**create : ./public/images**
**create : ./public/stylesheets**
**create : ./public/stylesheets/style.css**
**create : ./routes**
**create : ./routes/index.js**
**create : ./routes/users.js**
**create : ./views**
**create : ./views/index.ejs**
**create : ./views/error.ejs**
**create : ./bin**
**create : ./bin/www**
**install dependencies:**
**$ cd . && npm install**
**run the app:**
**$ DEBUG=notes:* npm start**
**$ npm install**
**.. output**
**$ ls**
**app.js bin node_modules package.json public routes views**
**$ npm uninstall express-generator**
**unbuild express-generator@4.13.1**
If you wish, you can run `npm start` and view the blank application in your browser. Instead, let's move on to setting up the code.
## Your first Notes model
Create a directory named `models`, as a sibling of the `views` and `routes` directories.
Then, create a file named `Note.js` in that directory, and put this code in it:
'use strict';
module.exports = class Note {
constructor(key, title, body) {
this.key = key;
this.title = title;
this.body = body;
}
};
This defines a new class, `Note`, for use within our Notes application. This sort of object class definition is new to JavaScript with ES-2015. Previously, we would have just created an anonymous object to hold the data. However, we gain a few advantages by defining a class for our notes.
We can reliably determine whether an object is a note with the `instanceof` operator:
if (!(note instanceof Note)) throw new Error('Must be a Note');
Classes can also have functions, and you can create subclasses using an `extend` clause (`class LoveNote extends Note { .. }`). The notation is similar to other languages (such as Java) that use classical inheritance, whereas JavaScript has traditionally used prototypal inheritance. If you scratch beneath the surface of ES-2015 classes, you'll find it's still using prototypal inheritance.
Then, create a file named `notes-memory.js` in that directory, and put this code in it:
'use strict';
var notes = [];
const Note = require('./Note');
exports.update = exports.create = function(key, title, body) {
return new Promise((resolve, reject) => {
**notes[key] = new Note(key, title, body);**
resolve(notes[key]);
});
};
exports.read = function(key) {
return new Promise((resolve, reject) => {
if (notes[key]) resolve(notes[key]);
else reject(`Note ${key} does not exist`);
});
};
exports.destroy = function(key) {
return new Promise((resolve, reject) => {
if (notes[key]) {
delete notes[key];
resolve();
} else reject(`Note ${key} does not exist`);
});
};
exports.keylist = function() {
return new Promise((resolve, reject) => {
resolve(Object.keys(notes));
});
};
exports.count = function() {
return new Promise((resolve, reject) => {
resolve(notes.length);
});
};
This is a simple in-memory data store that's fairly self-explanatory. It does not support any long-term data persistence. Any data stored in this model will disappear when the server is killed.
The `create` and `update` functions are being handled by the same function. At this stage of the Notes application, the code for both these functions can be exactly the same because they perform the exact same operation.
Later, when we add database support to Notes, the `create` and `update` functions will need to be different. For example, in a SQL data model, `create` would be implemented with an `INSERT INTO` command, while `update` would be implemented with an `UPDATE` command.
Creating an instance of an ES-2015 class is done like so:
notes[key] = new Note(key, title, body);
If you have experience with other languages, this will be a familiar way of constructing objects. The `constructor` method is automatically called. In our case, the arguments are simply assigned to matching fields of the object.
Each note is identified by a key, which is allowed to be any value JavaScript supports as an array index. As we'll see, the key is passed around as an identifier in forms for creating or editing notes and for retrieving notes from the data store.
Each of these functions returns a `Promise` object. In this case, this is technically unnecessary. Because the data is in memory, there's no time delay in accessing the data and little chance of error, so there's no need for deferred asynchronous execution. However, in later chapters we'll store data in databases, which definitely will involve asynchronous access and in which we will want to use Promises.
In this case, we are using Promises to detect errors in the arguments and reliably indicate such errors.
## The Notes home page
We're going to modify the starter application to support creating, editing, updating, viewing, and deleting notes. Let's start by fixing up the home page. It should show a list of notes, and the top navigation bar should link to an _Add Note_ page so that we can always add a new note.
The generated `app.js` file needs no modification for the home page. There will be modifications to this file, just not yet. To support the home page are these lines of code:
var routes = require('./routes/index');
..
app.use('/', routes);
Change `routes/index.js` to this:
var express = require('express');
var router = express.Router();
var notes = require('../models/notes-memory');
router.get('/', function(req, res, next) {
notes.keylist()
.then(keylist => {
var keyPromises = [];
for (var key of keylist) {
keyPromises.push(
notes.read(key)
.then(note => {
return { key: note.key, title: note.title };
})
);
}
return Promise.all(keyPromises);
})
.then(notelist => {
res.render('index', { title: 'Notes', notelist: notelist });
})
.catch(err => { next(err); });
});
module.exports = router;
This gathers data about the notes that we'll be displaying on the home page.
We're using a new kind of loop supported in ES-2015:
for (var key of iterable) { code }
An **iterable** is a generalized list of items, and the `for..of` loop makes it easy to iterate over those items. Several built-in objects, such as arrays, are iterable, and it is possible to define your own iterable if needed.
The `Promise.all` function executes an array of Promises. If any Promise in the array fails, execution jumps to the `.catch` function; otherwise, it's handled by the `.then` function. The result of the Promise returned by `Promise.all` is an array containing the result of each Promise.
Because we wrote `notes.read` to be an asynchronous operation, we must use a mechanism to wait until all the `notes.read` calls are finished. We do that with `Promise.all`. We first construct an array of Promises resulting from calling `notes.read`, using a `.then` clause to construct an anonymous object containing the `key` and `title` of the note. `Promise.all` captures all those results, bundling them into the array passed as `notelist`.
What we've done is enqueue a list of asynchronous operations and neatly wait for them all to finish.
The `notelist` array is then passed into a `view` template we're about to write.
Change `views/index.ejs` to this:
<!DOCTYPE html>
<html>
<head>
<% include headerStuff %>
</head>
<body>
<% include pageHeader %>
<% if (notelist.length > 0) { %>
<ul><%
for (var note of notelist) {
%><li><%= note.key %>:
<a href="/notes/view?key=<%= note.key %>"><%= note.title %></a>
</li><%
}
%></ul>
<% } %>
<% include footer %>
</body>
</html>
This simply steps through the array of note data and formats a simple listing. Each item links to the `/noteview` URL with a `key` parameter. We have yet to look at that code, but this URL will obviously display the note. Another thing of note is that no HTML for the list is generated if the `notelist` is empty.
This page follows a different strategy than the one we used in the previous chapter. The general principle is **don't repeat yourself** ( **DRY** ), and there are multiple ways to avoid repeating code in templates. Using `top.ejs` and `bottom.ejs` was an approach that worked for a simple application, but it could be limiting. It's debatable which approach is better. At least with this approach, you have the entire HTML structure in your hands and can easily customize each page as desired.
Create `views/headerStuff.ejs` with this text:
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
There's of course a whole lot more that could be put into this. For example, it's easy to add jQuery support to every page just by adding the appropriate `script` tags here.
Now, create `views/pageHeader.ejs`, containing the following:
<header>
<h1><%= title %></h1>
<div class='navbar'>
<p><a href='/'>Home</a> | <a href='/notes/add'>ADD Note</a></p>
</div>
</header>
Finally, add `views/footer.ejs`, with this code inside:
<footer></footer>
For our purposes, right now, we don't have anything to use at the bottom. Of course, public websites often have administrative links or a brief site map.
In your applications, you'll need to plan how to support flexible layout choices while avoiding repeating the same code in multiple template files.
We now have enough written to run the application; let's view the home page:
**$ npm start**
**> notes@0.0.0 start /Users/david/chap05/notes**
**> node ./bin/www**
**GET / 200 36.965 ms - 281**
**GET /stylesheets/style.css 304 6.147 ms - -**
If we visit `http://localhost:3000`, we will see the following page:
Because there aren't any notes (yet), there's nothing to show. Clicking on the **Home** link just refreshes the page. Clicking on the **ADD Note** link throws an error because we haven't (yet) implemented that code. This shows that the provided error handler in `app.js` is performing as expected.
## Adding a new note – create
Now, let's look at creating notes. Because the application doesn't have a route configured for the `/notes/add` URL, we must add one. To do that, we need a Controller for the notes.
In `app.js`, make the following changes.
Comment out these lines:
// var users = require('./routes/users');
..
// app.use('/users', users);
These aren't required currently, but will be in the future.
Next, we'll add similar lines for the notes Controller:
// var users = require('./routes/users');
var notes = require('./routes/notes');
..
// app.use('/users', users);
app.use('/notes', notes);
Now, we'll add a Controller module containing the notes router. Create a file named `routes/notes.js`, with this content:
'use strict';
var util = require('util');
var express = require('express');
var router = express.Router();
var notes = require('../models/notes-memory');
// Add Note.
router.get('/add', (req, res, next) => {
res.render('noteedit', {
title: "Add a Note",
docreate: true,
notekey: "",
note: undefined
});
});
module.exports = router;
The resulting `/notes/add` URL corresponds to the link in `pageHeader.ejs`.
In the `views` directory, add a template named `noteedit.ejs`, containing the following:
<!DOCTYPE html>
<html>
<head>
<% include headerStuff %>
</head>
<body>
<% include pageHeader %>
<form method='POST' action='/notes/save'>
<input type='hidden' name='docreate' value='<%=
docreate ? "create" : "update"%>'>
<p>Key:
<% if (docreate) { %>
<input type='text' name='notekey' value=''/>
<% } else { %>
<%= note ? notekey : "" %>
<input type='hidden' name='notekey' value='<%=
note ? notekey : "" %>'/>
<% } %>
</p>
<p>Title: <input type='text' name='title' value='<%=
note ? note.title : "" %>' /></p>
<br/><textarea rows=5 cols=40 name='body' ><%=
note ? note.body : "" %></textarea>
<br/><input type='submit' value='Submit' />
</form>
<% include footer %>
</body>
</html>
We'll be reusing this template to support both editing notes and creating new ones.
Notice that the `note` and `notekey` objects passed to the template are empty in this case. The template detects this condition and ensures the input areas are empty. Additionally, a flag, `docreate`, is passed in so that the form records whether it is being used to create or update a note. At this point, we're adding a new note, so of course, no note object exists. The template code is being written defensively, so it won't throw errors if it doesn't have a note.
This template is a FORM that will `POST` its data to the `/notes/save` URL. If you were to run the application at this time, it would give you an error message because no route is configured for that URL.
To support the `/notes/save` URL, add this to `routes/notes.js`:
// Save Note
router.post('/save', (req, res, next) => {
var p;
if (req.body.docreate === "create") {
p = notes.create(req.body.notekey,
req.body.title, req.body.body);
} else {
p = notes.update(req.body.notekey,
req.body.title, req.body.body);
}
p.then(note => {
res.redirect('/notes/view?key='+ req.body.notekey);
})
.catch(err => { next(err); });
});
Because this URL will also be used for both creating and updating notes, it needs to detect the `docreate` flag and call the appropriate model operation.
The model returns a Promise for both `notes.create` and `notes.update`. Normally, we'd chain the .`then` and `.catch` functions off those calls, but in this case, we need to take the same action for either operation. This is a simple matter of saving the Promise into a variable and then attaching our .`then` and `.catch` functions.
Because this code is called by a `POST` operation, the form data is added to the `req.body` object that's created by the `bodyParser` middleware. The fields attached to `req.body` correspond directly to elements in the HTML form.
Now, we can run the application again and use the **Add a Note** form:
But upon clicking on the **Submit** button, we get an error message. There isn't anything, yet, to implement the `/notes/view` URL.
You can modify the URL in the location box to revisit `http://localhost:3000`, and you'll see something like the following screenshot on the home page:
The note is actually there; we just need to implement `/notes/view`.
## Viewing notes – read
Now that we've looked at how to create notes, we need to move on to reading them. This means implementing controller logic and view templates for the `/notes/view` URL.
To `routes/notes.js`, add this router function:
router.get('/view', (req, res, next) => {
notes.read(req.query.key)
.then(note => {
res.render('noteview', {
title: note ? note.title : "",
notekey: req.query.key,
note: note
});
})
.catch(err => { next(err); });
});
Because this route is mounted on a router handling `/notes`, this route handles `/notes/view`.
If `notes.read` successfully reads the note, it is rendered with the `noteview` template. If something goes wrong, we'll instead display an error to the user through Express.
To the `views` directory, add the `noteview.ejs` template, referenced by this code:
<!DOCTYPE html>
<html>
<head>
<% include headerStuff %>
</head>
<body>
<% include pageHeader %>
<h3><%= note ? note.title : "" %></h3>
<p><%= note ? note.body : "" %></p>
<p>Key: <%= notekey %></p>
<% if (notekey) { %>
<hr/>
<p><a href="/notes/destroy?key=<%= notekey %>">Delete</a>
| <a href="/notes/edit?key=<%= notekey %>">Edit</a></p>
<% } %>
<% include footer %>
</body>
</html>
This is straightforward: taking data out of the note object and displaying using HTML. At the bottom are two links, one to `/notes/destroy` to delete the note and the other to `/notes/edit` to edit it.
The code for neither of these exists at the moment. But that won't stop us from going ahead and executing the application, will it?
As expected, with this code, the application correctly redirects to `/notes/view`, and we can see our handiwork. Also, as expected, clicking on either the **Delete** or **Edit** links will give you an error, because the code hasn't been implemented.
## Editing an existing note – update
Now that we've looked at the create and read operations, let's look at how to update or edit a note. This will be the third of the four CRUD operations.
To `routes/notes.js`, add this router function:
router.get('/edit', (req, res, next) => {
notes.read(req.query.key)
.then(note => {
res.render('noteedit', {
title: note ? ("Edit " + note.title) : "Add a Note",
docreate: false,
notekey: req.query.key,
note: note
});
})
.catch(err => { next(err); });
});
Of course, we're reusing the `noteedit.ejs` template, because we made sure it can be used for both create and update/edit operations.
In this case, we first retrieve the note object and then pass it through to the template. This way, the template is set up for editing rather than note creation. When the user clicks on the **Submit** button, we'll end up in the same `/notes/save` route handler shown in the preceding screenshot. It already does the right thing of calling the `notes.update` method in the model, rather than `notes.create`.
Because that's all we need do, we can go ahead and rerun the application:
Click on the **Submit** button here, and you'll come to the `/notes/view` screen and will be able to read our newly created note.
Back to the `/notes/view` screen: we've just taken care of the **Edit** link, but the **Delete** link still produces an error.
## Deleting notes – destroy
Now, let's look at how to implement the `/notes/destroy` URL, to delete notes.
To `routes/notes.js`, add the following router function:
router.get('/destroy', (req, res, next) => {
notes.read(req.query.key)
.then(note => {
res.render('notedestroy', {
title: note ? note.title : "",
notekey: req.query.key,
note: note
});
})
.catch(err => { next(err); });
});
Destroying a note is a significant step if only because there's no trash can to retrieve it from if we make a mistake. Therefore, we want to ask the user whether they're sure they want to delete that note. In this case, we retrieve the note and then render the following page, displaying a question to ensure they do want to delete the note.
To the `views` directory, add a `notedestroy.ejs` template:
<!DOCTYPE html>
<html>
<head>
<% include headerStuff %>
</head>
<body>
<% include pageHeader %>
<form method='POST' action='/notes/destroy/confirm'>
<input type='hidden' name='notekey' value='<%=
note ? notekey : "" %>'>
<p>Delete <%= note.title %> ?</p>
<br/>
<input type='submit' value='DELETE' /> <a href="/notes/view?key=<%= notekey %>">Cancel</a>
</form>
<% include footer %>
</body>
</html>
This is a simple form, asking the user to confirm by clicking on the button. The **Cancel** link just sends them back to the `/notes/view` page.
Clicking on the **Submit** button generates a `POST` request on the `/notes/destroy/confirm` URL.
That URL needs a request handler. Add this code to `routes/notes.js`:
router.post('/destroy/confirm', (req, res, next) => {
notes.destroy(req.body.notekey)
.then(() => { res.redirect('/'); })
.catch(err => { next(err); });
});
This calls the `notes.destroy` function in the model. If it succeeds, the browser is redirected to the home page. If not, an error message is shown to the user.
Rerunning the application, we can now view it in action:
Now that everything is working in the application, you can click on any button or link and keep all the notes you want.
# Theming your Express application
The Express team has done a decent job of making sure Express applications look okay out the gate. Our Notes application won't win any design awards, but at least it isn't ugly. There's a lot of ways to improve it, now that the basic application is running. Let's take a quick look at theming an Express application. In Chapter 6, _Implementing the Mobile-First Paradigm_ , we'll take a deeper dive, focusing on that all-important goal of addressing the mobile market.
If you're running the Notes app using the recommended method, `npm start`, a nice log of activity is being printed in your console window. One of those is the following line of code:
GET /stylesheets/style.css 304 0.702 ms - -
This is due to this line of code that we put in `headerStuff.ejs`:
<link rel='stylesheet' href='/stylesheets/style.css' />
This file was autogenerated for us by the Express Generator at the outset and dropped inside the `public` directory. The `public` directory is managed by the Express static file server, using this line in `app.js`:
app.use(express.static(path.join(__dirname, 'public')));
Let's open `public/stylesheets/style.css` and take a look:
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
Something that leaps out is that the application content has a lot of white space at the top and left-hand sides of the screen. The reason is that `BODY` tags have the `padding: 50px `style. Changing it is a quick business.
Since there is no caching in the Express static file server, we can simply edit the CSS file and reload the page, and the CSS will be reloaded as well. It's possible to turn on cache-control headers and ETAGS generation, as you would do for a production website. Look in the online Express documentation for details.
It involves a little bit of work:
body {
padding: 5px;
..
}
..
header {
background: #eeeeee;
padding: 5px;
}
As a result, we'll have this:
We're not going to win any design awards with this either, but there's the beginning of some branding and theming possibilities.
Generally speaking, the way we've structured the page templates, applying a site-wide theme is just a matter of adding appropriate code to `headerStuff.ejs`. Many of the modern theming frameworks, such as Twitter's Bootstrap, serve up CSS and JavaScript files out of a CDN server, making it incredibly easy to incorporate into a site design.
For jQuery, refer to <http://jquery.com/download/>.
Google's Hosted Libraries service provides a long list of libraries, hosted on Google's CDN infrastructure. Refer to <https://developers.google.com/speed/libraries/>.
# Scaling up – running multiple Notes instances
Now that we've got ourselves a running application, you'll have played around a bit and created, read, updated, and deleted many notes.
Suppose for a moment this isn't a toy application, but one that is interesting enough to draw a million users a day. Serving a high load typically means adding servers, load balancers, and many other things. A core part is to have multiple instances of the application running at the same time to spread the load.
Let's see what happens when you run multiple instances of the Notes application at the same time.
The first thing is to make sure the instances are on different ports. In `bin/www`, you'll find these lines, which control the port being used:
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
Meaning it's just a matter of setting the PORT environment variable to the desired value. If the `PORT` variable is not set, it defaults to `http://localhost:3000`, or what we've been using all along.
Let's open up `package.json` and add these lines to the `scripts` section:
"scripts": {
"start": "node ./bin/www",
"server1": "PORT=3001 node ./bin/www",
"server2": "PORT=3002 node ./bin/www"
},
The `server1` script runs on `PORT 3001`, while the `server2` script runs on `PORT 3002`. Isn't it nice to have all this documented in one place?
Then, in one command window, run this:
**$ npm run server1**
**> notes@0.0.0 server1 /Users/david/chap05/notes**
**> PORT=3001 node ./bin/www**
In another command window, run this:
**$ npm run server2**
**> notes@0.0.0 server2 /Users/david/chap05/notes**
**> PORT=3002 node ./bin/www**
This gives us two instances of the Notes application. Use two browser windows to visit `http://localhost:3001` and `http://localhost:3002`. Enter a couple of notes, and you might see something like this:
After some editing and adding notes, your two browser windows could look like the preceding screenshot. What's going on is that the two instances do not share the same data pool. Each is instead running in its own memory space. You add a note in one, and it does not show in the other screen.
Additionally, because the model code does not persist data anywhere, the notes are not saved. You might have written the greatest novel of all time, but as soon as the application server restarts, it's gone.
Typically, you run multiple instances of an application to scale performance. That's the old "throw more servers at it" trick. For this to work, the data of course must be shared, and each instance must access the same data source. Typically, this involves a database.
# Summary
We've come a long way in this chapter.
We started with the Pyramid of Doom and how the ES-2015 Promise object can help us tame asynchronous code. We'll be using Promises all through this book.
We quickly moved to writing the foundation of a real application with Express. At the moment, it keeps its data in memory, but it has the basic functionality of what will become a note-taking application supporting real-time collaborative commenting on the notes.
In the next chapter, we'll dip our toes in the water of responsive, mobile-friendly web design. Due to the growing popularity of mobile computing devices, it's become necessary to address mobile devices first before desktop computer users. In order to reach those millions of users a day, the Notes application users need a good user experience using their smartphone.
Afterward, we'll keep growing the capabilities of the Notes application, starting with database storage models.
# Chapter 6. Implementing the Mobile-First Paradigm
Now that we have a useful first Express application, we must do what's the mantra of this age of software development: make it mobile-friendly from the outset. Mobile devices, be it smart phones, tablet computers, automobile dashboards, refrigerator doors, or bathroom mirrors, are taking over the world. In 30 or 40 years, we may be fighting a war with robots who want equal rights, if _The Matrix_ movies have any predictive value. In the meantime, we have gizmos to build and software to write.
Overwhelmingly, that software needs to display on a mobile device. Thankfully, modern mobile devices have real web browsers that use modern technology such as HTML5 and CSS3, and they have fast JavaScript engines.
The primary considerations in designing for mobiles are the small screen sizes, the touch-oriented interaction, that there's no mouse, and the somewhat different user interface expectations. With the **Notes** application, our user interface needs are modest, and the lack of a mouse doesn't make any difference to us. However, these are certainly big considerations for other kinds of applications.
In this chapter, we won't do much Node.js development. Instead, we'll modify the templates, editing CSS (LESS actually) files, and learning about a couple useful tools in the frontend web development arena. And, we'll dip our toes in the water of what it means to be a full stack web engineer.
# Problem – the Notes app isn't mobile friendly
Let's start by quantifying the problem. We need to explore how well (or not) the application behaves on a mobile device. This is simple to do:
1. Start the Notes app. Determine the IP address of the host system.
2. Using your mobile device, connect to the service using the IP address, and browse around the Notes application, putting it through its paces.
Another way to approach this is to use your desktop browser, resizing it to be very narrow. That way, you can mimic a smart phone screen's small size, showing you many of the user interface difficulties, even if it doesn't otherwise behave as a mobile app.
You may also find development-oriented browser extensions to assist. For example, in the **Chrome Developer Tools** , you can view the current webpage as if it were any of several popular mobile devices.
To see a real user interface problem on a mobile screen, edit `views/noteedit.ejs` to change this line:
<br/><textarea rows=5 **cols=80** name='body' ><%= note ? note.body : "" %></textarea>
What's changed is the `cols=80` parameter. We want this `textarea` element to be overly large so that you can experience how a non-responsive web app appears on a mobile device. View the application on a mobile device and you'll see something like the following screenshot:
Viewing a note works well on an iPhone 6, but the screen for editing/adding a note is not good. The text entry area is so wide that it runs off the side of the screen. The interaction with the `FORM` elements works well. In general, browsing around the Notes application gives an acceptable user experience.
We can improve the Notes application all around.
# Mobile-first paradigm
Mobile devices have a smaller screen, are generally touch oriented, and have different user experience expectations than a desktop computer.
To accommodate the smaller screen, we use **responsive web design** techniques. This means designing the application in such a way that it accommodates the screen size and other device attributes. The idea is crafting websites to provide an optimal viewing and interaction experience across a wide range of devices. The techniques include changing font sizes, rearranging elements on the screen, using collapsible elements that open when touched, and resizing images or videos to fit the available space. This is called _responsive_ because the application responds to device characteristics by making these changes.
### Note
By _mobile-first_ , we mean that you design the application first to work well on a mobile device and then move on to devices with larger screens. It's about prioritizing mobile devices first.
The primary technique is to use media queries in the stylesheet to detect device characteristics. Within sections controlled by media queries targeting a range of devices, the CSS declarations must match the targeted devices.
It may help to consult a concrete example. The **Twenty Twelve** theme for Wordpress has a fairly straightforward responsive design implementation. It's not built with any framework, so you can see clearly how the mechanism works, and the stylesheet is small enough to be easily digestible. Refer to its source code in the Wordpress repository at <https://themes.svn.wordpress.org/twentytwelve/1.9/style.css>.
The stylesheet starts with a number of **resets** , where the stylesheet overrides some typical browser style settings with clear defaults. Then, the bulk of the stylesheet defines styling for mobile devices. Toward the bottom of the stylesheet is a section labeled **Media queries** where, for certain sized screens, the styles defined for mobile devices are overridden to make sense for devices with larger screens.
It does this with the following two media queries:
@media screen and (min-width: 600px) {
/* For screens above 600px width */}
@media screen and (min-width: 960px) {
/* For screens above 960px width */}
In other words, the first segment of the stylesheet configures the page layout for all devices. Next, for any browser viewport at least `600px` wide, reconfigure the page to display on the larger screen. Then, for any browser viewport at least `960px` wide, reconfigure it again. The stylesheet has a final media query to cover print devices.
The pixel widths given earlier are what's called a **breakpoint**. Meaning, those threshold viewport widths are where the design changes itself around. You can see these breakpoints in action easily by going to any website with a responsive design, then resizing the browser window. Watch how the design jumps at certain sizes. Those are the breakpoints chosen by the author of that website.
There's a wide range of differing opinions about the best strategy to choose your breakpoints. Do you target specific devices or do you target more general characteristics? The Twenty Twelve theme did fairly well on mobile devices using only two media queries. At the other end of the scale, the _CSS-Tricks_ blog posted an extensive list of specific media queries for every known device, which is available at <https://css-tricks.com/snippets/css/media-queries-for-standard-devices/>.
We should at least target these device scenarios:
* **Small** : This includes iPhone 4.
* **Medium** : This can refer to tablet computers, or the larger smart phones.
* **Large** : This includes larger tablet computers, or the smaller desktop computers.
* **Extra-large** : This refers to larger desktop computers and other large screens.
* **Landscape/portrait** : You may want to create a distinction between landscape mode and portrait mode. Switching between the two of course changes viewport width, possibly pushing it past a breakpoint. However, your application may need to behave differently in the two modes.
Enough with the theory, let's get back to our code.
# Using Twitter Bootstrap on the Notes application
Bootstrap is a mobile-first framework consisting of HTML5, CSS3, and JavaScript code providing a comprehensive set of world class responsive web design components. It was developed by engineers at Twitter, and then released to the world in August 2011.
The framework includes code to retrofit modern features onto older browsers, a responsive 12-column grid system, and a long list of components (some that use JavaScript) for building web applications and websites. It's meant to provide a strong foundation on which to build your application.
Refer to <http://getbootstrap.com> for more details.
## Setting it up
The first step is to duplicate the code you created in the previous chapter. If, for example, you created a directory named `chap05/notes`, then create one named `chap06/notes` from the content of `chap05/notes`.
Now, we need to go about adding Bootstrap's code in the Notes application. The Bootstrap website suggests loading the required CSS and JavaScript files out of the Bootstrap (and jQuery) public CDN. While that's easy to do, we won't do this for two reasons:
* It violates the principle of keeping all dependencies local to the application and not relying on global dependencies
* It prevents us from generating a custom theme
Instead, we'll install a local copy of Bootstrap. There are several ways to install Bootstrap. We'll use a tool, **Bower** , that's widely used in frontend engineering projects. Bower gives access to a huge repository of JavaScript packages for frontend coding. It serves a similar role for frontend engineering as npm does for Node.js. Visit <http://bower.io> for details.
We install Bower using the following command:
**$ npm install bower@1.x --save-dev**
The Bower website recommends a global install (with the `-g` flag) but, as mentioned earlier, we will avoid installing global dependencies.
Next, we initialize the Notes application to use Bower, and use it to install Bootstrap and jQuery:
**$ bower init**
**.. answer some questions posed by Bower**
**$ bower install 'bootstrap#3.3.6' --save**
The first step sets up a `bower.json` file to contain package information used by Bower. The purpose is similar to the `package.json` file we use for Node.js. For our purposes, we need this so that Bower can properly pull down the required dependencies.
The second step installs a specific version of Bootstrap. One principle from the Twelve Factor application model is explicitly declaring dependencies, and that applies to Bootstrap just as much as anything else. At the time of writing this, we see the Bootstrap team is preparing version 4.0, and are promising lots of changes—changes that theoretically could break the code in this book, giving us an example of that principle in action. By naming a specific version dependency, we avoid a future potential application failure if an incompatibility sneaks into third-party code.
Now, when setting up the Notes application, we will run these two commands:
**$ npm install**
**$ bower install**
The two together set up packages from both the npm and Bower repositories. However, this isn't optimal because we need to remember to run both the commands.
In step 12 of the Twelve Factor guideline, it is recommended to automate all administrative functions. How do we ensure that `bower install` is run whenever the Notes application is installed?
Add this to the `scripts` section of `package.json`:
"postinstall": "bower install"
As it suggests, this script is run after `npm install` is executed. Therefore, we've ensured that `bower install` will execute at the appropriate time. We can verify this works, as follows:
**$ npm install**
**> notes@0.0.0 postinstall /Users/david/chap06/notes**
**> bower install**
Finally, let's see what this installed for us:
**$ ls bower_components/**
**bootstrap jquery**
We only installed Bootstrap, but because Bootstrap depends on jQuery, it was automatically installed for us.
Within each package is a `dist` directory containing the prebuilt code for the respective package:
**$ ls bower_components/bootstrap/dist/**
**css fonts js**
**$ ls bower_components/jquery/dist/**
**jquery.js jquery.min.js jquery.min.map**
These files are what need to be referenced from our templates in order to use Bootstrap and jQuery.
## Adding Bootstrap to application templates
On the Bootstrap website, they give a recommended HTML structure. Refer to the **Getting Started** page at <http://getbootstrap.com/getting-started/>.
There are `meta` elements to set up browser characteristics, `link` elements pointing to CSS files, and `script` elements pointing to JavaScript files. Each of these plays a role in properly initializing Bootstrap on the page, and ensuring a consistent experience across all web browsers.
To implement this, we'll need to modify `headerStuff.ejs` and `footer.ejs`.
Change `views/headerStuff.ejs` to have this content:
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title><%= title %></title>
<!-- Bootstrap -->
<link href="/vendor/bootstrap/css/bootstrap.min.css"
rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements
and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page
via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
</script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
</script>
<![endif]-->
<link rel='stylesheet' href='/stylesheets/style.css' />
While most of this is from the Bootstrap site, it incorporates the previous content of `headerStuff.ejs`. Our own stylesheet is loaded following the Bootstrap stylesheet, giving us the opportunity to override anything in Bootstrap we want to change. The path to load `bootstrap.min.css` is different than recommended, and we'll go over that in a minute.
Similarly, we need to edit `views/footer.ejs` to add the code to load JavaScript files:
<footer></footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="/vendor/jquery/jquery.min.js"></script>
<!-- Include all compiled plugins (below),
or include individual files as needed -->
<script src="/vendor/bootstrap/js/bootstrap.min.js"></script>
### Tip
This is the same as recommended on the Bootstrap website except the URLs point to our own site rather than relying on the public CDN.
This `/vendor` URL is not currently recognized by the Notes application. To add support, edit `app.js` to add these lines:
app.use('/vendor/bootstrap', express.static(
path.join(__dirname, 'bower_components', 'bootstrap', 'dist')));
app.use('/vendor/jquery', express.static(
path.join(__dirname, 'bower_components', 'jquery', 'dist')));
This configures the static file server middleware to handle `/vendor/bootstrap` and `/vendor/jquery`. The content of each will come from the `dist` directory within the content of each package.
Now we have enough in place to run the application and see that Bootstrap gets loaded as pages are visited:
**$ npm start**
**> notes@0.0.0 start /Users/david/chap06/notes**
**> node ./bin/www**
**GET / 200 26.419 ms - 1255**
**GET /stylesheets/style.css 304 5.063 ms - -**
**GET /vendor/jquery/jquery.min.js 304 3.700 ms - -**
**GET /vendor/bootstrap/js/bootstrap.min.js 304 0.566 ms - -**
**GET /vendor/bootstrap/css/bootstrap.min.css 304 160.282 ms - -**
The onscreen differences are minor, but this is the proof necessary that the CSS and JavaScript files for Bootstrap are being loaded.
# Mobile-first design for the Notes application
We've come a fair way already, learning about the basics of responsive design and Bootstrap, and we hooked the Bootstrap framework into our application. Now ,we're ready to launch into a redesign of the application so that it works well on mobiles and uses some Bootstrap components to make improvements.
## Laying the Bootstrap grid foundation
Bootstrap uses a 12-column grid system to control layout, giving applications a responsive mobile-first foundation on which to build. It automatically scales components as the viewport changes size or shape. The method relies on `<div>` elements with classes to describe the role each `<div>` plays in the layout.
The basic layout pattern is as follows:
<div class="container-fluid">
<div class="row">
<div class="col-sm-3">Column 1 content</div>
<div class="col-sm-9">Column 2 content</div>
</div>
<div class="row">
<div class="col-sm-3">Column 1 content</div>
<div class="col-sm-6">Column 2 content</div>
<div class="col-sm-3">Column 3 content</div>
</div>
</div>
The outermost layer is the `.container` or `.container-fluid` element. The latter is fluid, meaning it fills the width available to it. Within that are the `.row` elements for each row of the presentation, and within those are elements to contain individual columns of the presentation. The preceding example has two rows, the first having two columns, the second having three.
The column specifiers follow a naming convention that tells you which media breakpoint it applies to and the number of columns it claims:
* Using `col-xs-#` targets extra-small devices (smart phones)
* Using `col-sm-#` targets small devices
* Using `col-md-#` targets medium devices
* Using `col-lg-#` targets large devices
The number of columns claimed within a row should add up to 12 columns or less. If the columns add to more than 12, the columns beyond the 12th column wrap around to become a new row.
The grid system can do a lot more, but this gives us enough to start modifying our application. We structured each of the page templates as follows:
<!DOCTYPE html>
<html>
<head> .. headerStuff </head>
<body>
.. pageHeader
.. main content
.. footer
</body>
</html>
The page content therefore has three rows: the header, the main content, and the footer.
Let's start with editing `views/index.ejs`:
<!DOCTYPE html>
<html>
<head><% include headerStuff %></head>
<body>
**< div class="container-fluid">**
<% include pageHeader %>
<% if (notelist.length > 0) { %>
**< div class="row"><div class="col-xs-12">**
.. show the notelist
**< /div></div>**
<% include footer %>
**< /div>**
</body>
</html>
The `<div class="container-fluid"> .. </div>` tags set up the grid container for the whole page. We add the first just after the `<body>` tag, and the second just before the closing `</body>` tag. This way, everything visible to the user is controlled by the fluid Bootstrap layout grid.
The next addition is to add the `<div>` tag for the main content row. It's one row, and the content claims the full 12 columns.
Similar changes are required in `views/noteedit.ejs` and `views/notedestroy.ejs`. We want every page to use Bootstrap for page layout and its components. Therefore, we must add Bootstrap layout `<div>` elements to every page.
In `views/noteview.ejs`, there is an additional row required for buttons to act on the note:
<!DOCTYPE html>
<html>
<head><% include headerStuff %></head>
<body>
<div class="container-fluid">
<% include pageHeader %>
<div class="row"><div class="col-xs-12">
<h3><%= note ? note.title : "" %></h3>
<p><%= note ? note.body : "" %></p>
<p>Key: <%= notekey %></p>
</div></div>
<% if (notekey) { %>
<div class="row">
<div class="btn-group col-sm-12">
<a class="btn btn-default" href="/notes/destroy?key=<%= notekey %>" role="button">Delete</a>
<a class="btn btn-default" href="/notes/edit?key=<%= notekey %>" role="button">Edit</a>
</div>
</div>
<% } %>
<% include footer %>
</div>
</body>
</html>
We have added a row for a pair of buttons to _Edit_ or _Delete_ the note. This row is what Bootstrap calls a **button group** , which Bootstrap will render nicely for us. Even though these are links, the `class="btn btn-default"` attribute means Bootstrap will configure these links to act like buttons; there will be a box around the button, mouseovers cause the background to change color, and a click anywhere within the box (not just on the link text) will cause the link to trigger.
There is one final change to complete coding the initial grid structure. In `views/pageHeader.ejs`, make this change:
<header **class="page-header"** >
<h1><%= title %></h1>
<div class='navbar'>
<p><a href='/'>Home</a> | <a href='/notes/add'>ADD Note</a></p>
</div>
</header>
Adding `class="page-header"` informs Bootstrap this is, well, the page header.
## Improving the notes list on the front page
The current home page has a simple text list, that's not terribly touch friendly, and showing the _key_ at the front of the line might be inexplicable to the user. Let's fix this.
Again, edit `views/index.ejs` and make this change:
<div class="row"><div class="col-xs-12">
**< div class="btn-group-vertical" role="group" style="width: 100%;">**<%
for (var note of notelist) {
%>
<a **class="btn btn-lg btn-block btn-default"** href="/notes/view?key=<%= note.key %>">
<%= note.title %>
</a><%
}
%></div>
<% } %>
</div></div>
The first change is to switch away from using a list and to use a vertical button group. By again making the text links look and behave like buttons, we're improving the user interface, especially its touch friendliness.
The next step is to add the classes converting the links into buttons. This time, we're making it a large button (`btn-lg`) that fills the width of its container (`btn-block`).
Finally, we eliminate showing the note key to the user. This information doesn't add anything to the user experience, does it?
This is beginning to take shape, with a decent looking home page that handles resizing very nicely, and is touch friendly. That page header though, it takes up too much space.
## Breadcrumbs for the page header
The _Breadcrumb_ component gives us an easy way to construct a breadcrumb trail of links. We can use that for navigation within the Notes application. Another change to make is converting the **Add New** link into a touch-friendly proper button. And, finally, while we're here, the header takes up too much vertical space, so let's tighten it up a bit.
Change `views/pageHeader.ejs` to this:
<header class="page-header">
<h1><%= title %></h1>
<% if (typeof hideAddNote === 'undefined') { %>
<a class="btn btn-primary" href='/notes/add'>ADD Note</a>
<% } %>
<% if (typeof breadcrumbs !== 'undefined' && breadcrumbs) { %>
<ol class="breadcrumb">
<%
for (var crumb of breadcrumbs) {
if (crumb.active) {
%><li class="active"><%= crumb.text %></li><%
} else {
%><li><a href="<%= crumb.href %>">
<%= crumb.text %></a></li><%
}
}
%>
</ol>
<% } %>
</header>
We converted the _add note_ link to a button. The `btn-primary` class gives it a bold background so it'll stand out. We're also allowing this button to be hidden because it isn't necessary on every page.
Next is the breadcrumb trail. Bootstrap uses a normal list, with `class="breadcrumb"`, and arranges the list items horizontally. It even inserts a separator between each item. An item with `class="active"` gets a different presentation, and is supposed to be the final breadcrumb in the trail.
Both of these require adding parameters to the object passed to the `res.render` calls. The template looks for this data, and if it doesn't exist, there'll be nothing to output.
In `routes/index.js`, change the `res.render` call to the following:
res.render('index', {
title: 'Notes',
notelist: notelist,
**breadcrumbs: [**
**{ href: '/', text: 'Home' }**
**]**
});
The `breadcrumbs` parameter will simply be an array of items describing each segment of the breadcrumb trail.
In `routes/notes.js`, we have several `res.render` calls to change.
For the `/add` route use the following code:
res.render('noteedit', {
title: "Add a Note",
docreate: true,
notekey: "",
note: undefined,
breadcrumbs: [
{ href: '/', text: 'Home' },
**{ active: true, text: "Add Note" }**
**],**
**hideAddNote: true**
});
Here, we want to hide the **Add Note** button. Simply add the parameter, and give it any value. The template simply looks to check whether `hideAddNote` exists, and if it does, it suppresses the code for the button The _add note_ portion of the breadcrumb trail is the active element, and therefore does not need an `href`.
For the `/view` route:
res.render('noteview', {
title: note ? note.title : "",
notekey: req.query.key,
note: note,
**breadcrumbs: [**
**{ href: '/', text: 'Home' },**
**{ active: true, text: note.title }**
**]**
});
For the `/edit` route, you'll need the same breadcrumbs array and also the `hideAddNote` flag:
res.render('noteedit', {
title: note ? ("Edit " + note.title) : "Add a Note",
docreate: false,
notekey: req.query.key,
note: note,
hideAddNote: true,
breadcrumbs: [
{ href: '/', text: 'Home' },
{ active: true, text: note.title }
**]**
});
Finally, the `/destroy` route:
res.render('notedestroy', {
title: note ? note.title : "",
notekey: req.query.key,
note: note,
breadcrumbs: [
{ href: '/', text: 'Home' },
{ active: true, text: 'Delete Note' }
]
});
To tighten up the page header, we need to override some default Bootstrap behavior. Add these CSS declarations to `public/stylesheets/style.css`:
header.page-header h1 {
margin-top: 5px;
}
header.page-header .breadcrumb {
margin-bottom: 5px;
}
header.page-header a.btn-primary {
float: right;
}
Bootstrap puts too much margin around those items, making the page header bigger than it should be. This CSS overrides those settings, nicely tightening things up.
Browse around the application, and you'll see the breadcrumbs add some refinement.
## Cleaning up the add/edit note form
The next major glaring problem is the form for adding and editing notes. Bootstrap has extensive support for making nice looking forms that work well on mobile devices.
Change the `FORM` in `views/noteedit.ejs` to this:
<div class="row"><div class="col-xs-12">
<form method='POST' action='/notes/save'>
<input type='hidden' name='docreate' value='<%= docreate ? "create" : "update"%>'>
<div class="form-group">
<label for="notekey">Key</label>
<% if (docreate) { %>
<input class="form-control" type='text' id='notekey'
name='notekey' value='' placeholder='key'/>
<% } else { %>
<%= note ? notekey : "" %>
<input class="form-control" type='hidden' id='notekey'
name='notekey' value='<%= note ? notekey : "" %>'/>
<% } %>
</div>
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" id='title' name='title'
placeholder="note title" value='<%= note ? note.title : "" %>'>
</div>
<div class="form-group">
<textarea class="form-control" name='body' rows="5">
<%= note ? note.body : "" %></textarea>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div></div>
There's a lot going on here, and what we've done is reorganize the `FORM` so Bootstrap can do the right things with it.
The first thing to note is that we have several instances of this:
<div class="form-group"> .. </div>
Bootstrap uses this to group together elements related to one item in the `FORM`. It's good practice to use a `<label>` with every `<input>` so the browser can do better things than if you simply left some dangling text around. Bootstrap wants us to put both the `<label>` and the `<input>` inside the `form-group`.
The next item of note is that every form element has `class="form-control"`. Bootstrap uses this to identify the controls, for its own purposes.
This attribute, `placeholder='key'`, puts some sample text in an otherwise empty text input element. This sample text disappears as soon as the user types something. It's an excellent way to prompt the user with what's expected.
Finally, we changed the **Submit** button to be a Bootstrap button. These look nice, and Bootstrap makes sure that they work great.
The result looks good, and works well on the iPhone. It automatically sizes itself to whatever screen it's on. Everything behaves nicely.
# Building a customized Bootstrap
One of the reasons to use Bootstrap is that you can rebuild a customized version fairly easily. The stylesheets are built using LESS, which is one of the CSS preprocessors to simplify CSS development. In Bootstrap's code, one file (`less/variables.less`) contains variables used throughout the rest of Bootstrap's `.less` files. Change one variable, and it can automatically affect the rest of Bootstrap.
Earlier, we overrode a couple of Bootstrap behaviors with our custom CSS file, `public/stylesheets/style.css`. This is acceptable for changing a couple of specific things, but that technique doesn't work for large-scale changes to Bootstrap. For serious Bootstrap customizations you'll want to learn your way around this file.
Let's set ourselves up to allow rebuilding a customized Bootstrap. First, run this:
**$ cd bower_components/bootstrap**
**$ npm install**
**$ npm install grunt-cli**
These commands install dependencies to support building Bootstrap. Fair warning, this can take a while. You can test it right now by running Grunt:
**$ grunt**
**.. Grunt output from building Bootstrap**
Grunt is a build tool written in Node.js that's widely used for frontend development projects. It's worth learning to use Grunt, but we won't do anything more with it than this. What we need to do next is modify `variables.less`.
Browse through this file, and you'll see a number of lines like these:
@brand-primary: darken(#428bca, 6.5%); // #337ab7
@brand-success: #5cb85c;
@brand-info: #5bc0de;
@brand-warning: #f0ad4e;
@brand-danger: #d9534f;
These are variable definitions, and you'll see them used throughout the other `.less` files in this directory. Change one of these variables, rebuild Bootstrap, and it'll affect everything that uses that variable.
A quick and easy change that quickly demonstrates rebuilding Bootstrap is to change the background color:
@body-bg: #fff;
Change it to this:
@body-bg: @brand-danger;
Next, rebuild Bootstrap:
**$ grunt**
Then reload the application, and you'll see the following:
That's cool, we can now rework the Bootstrap color scheme any way we want. Now we need to automate this. Don't show this to your user experience team, because they'll throw a fit. We did this to prove the point that we can edit `variables.less` and change the Bootstrap theme.
Because of where `variables.less` is located, the next time we run `bower install`, any modifications will be overwritten. What we need is a way to keep our copy of `variables.less` outside the `bower_components` directory and still use it when building Bootstrap.
If you want to make deeper Bootstrap customizations, you probably instead need to maintain a fork of the Bootstrap Git repository. Instead, let's plan how we'll keep a custom `variables.less` file.
To start, simply copy the modified `variables.less` object into the root directory of the Notes application. It's this copy of the file you'll modify to customize Boostrap, not the copy in `bower_components/bootstrap/less`.
As a good student of the Twelve Factor application recommendations, we'll automate the build process with these scripts in `package.json`:
"bootstrapsetup": "cd bower_components/bootstrap && npm install && npm install grunt-cli ",
"buildbootstrap": "cp variables.less bower_components/bootstrap/less && cd bower_components/bootstrap && grunt"
This technique, `command && command && command`, is a way to execute a multistep process as an npm script. It will automatically fail if one of the commands fails and otherwise execute one command at a time.
The `bootstrapsetup` script runs the commands shown earlier to install the dependencies required to rebuild Bootstrap.
With `buildbootstrap`, we copy our customized `variables.less` object into the Bootstrap package and then use `grunt` for the rebuild.
## Bootstrap customizers
In case all this is too complicated for you, several websites make it easy to build a customized Bootstrap:
* <http://getbootstrap.com/customize/>: The Bootstrap website offers this customizer. You enter values for all the `variables.less` entries, and then a button at the bottom of the page rebuilds Bootstrap and downloads it to you.
* <http://paintstrap.com/>: This site builds Boostrap themes using Adobe Kuler or COLOURlovers color schemes.
* <https://jetstrap.com/>: This site bills itself as the premium interface-building tool for Bootstrap.
* <https://wrapbootstrap.com/>: This is a Bootstrap theme marketplace.
* <http://bootswatch.com/>: This has a number of free Bootstrap themes.
In some cases, these prebuilt themes provide just `bootstrap.min.css` and `variables.less`. Using this with the Notes application means a couple of small changes to `app.js`.
Let's use the **Cyborg** theme from Bootswatch to explore the needed changes. You can download the theme from the website or use a command-line tool such as `curl` or `wget` as shown here:
**$ mkdir cyborg**
**$ cd cyborg**
**$ curl http://bootswatch.com/cyborg/bootstrap.min.css -o bootstrap.min.css**
**$ curl http://bootswatch.com/cyborg/bootstrap.css -o bootstrap.css**
**$ curl http://bootswatch.com/cyborg/variables.less -o variables.less**
**$ curl http://bootswatch.com/cyborg/bootswatch.less -o bootswatch.less**
Now in `app.js`, change the mounts for `/vendor/bootstrap` to the following:
app.use('/vendor/bootstrap/css', express.static(path.join(__dirname, 'cyborg')));
app.use('/vendor/bootstrap/fonts', express.static(path.join(__dirname, 'bower_components', 'bootstrap', 'dist', 'fonts')));
app.use('/vendor/bootstrap/js', express.static(path.join(__dirname, 'bower_components', 'bootstrap', 'dist', 'js')));
app.use('/vendor/jquery', express.static(path.join(__dirname, 'bower_components', 'jquery', 'dist')));
Instead of one mount for `/vendor/bootstrap`, we now have three mounts for each of the subdirectories. Simply make the `/vendor/bootstrap/css` mount point to a directory containing the CSS files you download from the theme provider.
# Summary
The possibilities for using Bootstrap are endless. While we covered a lot of material, we only touched the surface, and we could have done much more to the Notes application.
You learned what the Twitter Bootstrap framework can do for us. Bootstrap's goal is to make mobile-responsive development easy. We used Bootstrap to make great improvements to the way the Notes app looks and feels. We customized Bootstrap, dipping our toes into generating a custom theme.
Now, we want to get back to writing Node.js code. We left off Chapter 5, _Your First Express Application_ , with the problem of persistence so that the Notes application can be stopped and restarted without losing our notes. In Chapter 7, _Data Storage and Retrieval_ , we'll dive into using databases to store our data.
# Chapter 7. Data Storage and Retrieval
In the previous two chapters, we built a small and somewhat useful application for storing notes, and then made it work on mobile devices. While the application works reasonably well, it doesn't store those notes anywhere for long-term storage, which means the notes are lost when you stop the server. Further, if you run multiple instances of Notes, each instance has its own set of notes; this makes it difficult to scale the application to serve lots of users.
The typical next step in such an application is to introduce a database tier. Databases provide long-term reliable storage, while enabling easy sharing of data between multiple application instances.
In this chapter, we will look at database support in Node.js in order to provide these capabilities:
* The user must see the same set of notes for any Notes instance accessed
* Reliably store notes for long-term retrieval
We'll start with the Notes application code used in the previous chapter. We started with a simple, in-memory data model using an array to store the notes, and then made it mobile friendly. In this chapter, we'll add additional model implementations using several database engines.
Let's get started!
The first step is to duplicate the code from the previous chapter. For instance, if you were working in `chap06/notes`, duplicate that to be `chap07/notes`.
# Data storage and asynchronous code
It's worth discussing the concept of asynchronous code again, since external data storage systems, by definition, require asynchronous code. The access time to retrieve data from disk, from another process, or from a database always takes enough time to require deferred execution.
Accessing in-memory data takes a few clock cycles, making it possible to directly operate on in-memory data without delays that would prevent a Node.js server from handling events. Data stored anywhere else, even in the memory space of another process, requires a delay to access that data. This is long enough to prevent the Node.js server from handling events. The rule of thumb is that asynchronous coding is not required for data retrievable within microseconds. But when the time to retrieve the data takes longer, asynchronous coding is required. Since Node.js is a single-thread system, application code cannot block the event loop.
The existing Notes application used an in-memory data store. Going by that rule of thumb, we can write the Notes model with non-asynchronous code, but instead we wrote it to use Promises for asynchronous access. That's because we thought ahead and knew we will extend the Notes application to use a database.
# Logging
Before we get into databases, we have to address one of the attributes of a high-quality software system—managing logged information, including normal system activity, system errors, and debugging information. Logs are supposed to give us visibility into the behavior of the system. How much traffic is it getting? If it's a website, which pages are people hitting the most? How many errors occur and of what kind? Do attacks occur? Are malformed requests being sent?
Log management is also an issue. Log rotation means moving the log file out of the way every day, or so, to start with a fresh one. You should process logged data to produce reports. A high priority on screening for security vulnerabilities is a must.
The Twelve-Factor application model suggests simply sending logging information to the console, and then some other software system captures that output and directs it to a logging service. Following their advice can reduce system complexity by having fewer things that can break. In a later chapter, we'll use PM2 for that purpose.
Let's first complete a tour of information logging as it stands right now in Notes.
When we used the Express Generator to initially create the Notes app, it configured an activity logging system using Morgan:
var logger = require('morgan');
..
app.use(logger('dev'));
This is what prints the requests on the terminal window. Visit <https://github.com/expressjs/morgan> for more information.
Internally, Express uses the **Debug** package for debugging traces. You can turn these on using the `DEBUG` environment variable. We should try to use this package in our application code. For more information, visit <https://www.npmjs.com/package/debug>.
There may be random instances where we print stuff to `stdout` or `stderr`. This should be done using the Debug package, but third-party modules might do this and we should capture their output somehow.
Finally, the application might generate uncaught exceptions. The `uncaughtException` error needs to be captured, logged, and dealt with appropriately.
## Request logging with Morgan
The Morgan package has two general areas for configuration:
* Log format
* Log location
As it stands, the code uses the `dev` format, which is described as a concise status output meant for developers. This can be used to log web requests as a way to measure website activity and popularity. The Apache log format already has a large ecosystem of reporting tools, and sure enough Morgan can produce log files in this format. It also has a nice method to generate a custom log format, if you prefer.
To change the format, simply change this line in `app.js`:
app.use(logger(process.env.REQUEST_LOG_FORMAT || 'dev'));
Then run Notes as follows:
**$ REQUEST_LOG_FORMAT=common npm start**
**> notes@0.0.0 start /Users/david/chap07/notes**
**> node ./bin/www**
**::1 - - [12/Feb/2016:05:51:21 +0000] "GET / HTTP/1.1" 304 -**
**::1 - - [12/Feb/2016:05:51:21 +0000] "GET /vendor/bootstrap/css/bootstrap.min.css HTTP/1.1" 304 -**
**::1 - - [12/Feb/2016:05:51:21 +0000] "GET /stylesheets/style.css HTTP/1.1" 304 -**
**::1 - - [12/Feb/2016:05:51:21 +0000] "GET /vendor/bootstrap/js/bootstrap.min.js HTTP/1.1" 304 -**
To revert to the previous logging output, simply do not set this environment variable.
According to the Morgan documentation, we can even pass a format string this way. If we need a custom log format, it's easy to define one.
We can declare victory on request logging and move on to debugging messages. However, let's look at logging this to a file directly. While it's possible to capture `stdout` through a separate process, Morgan is already installed in Notes and it does provide the capability to direct its output to a file.
The Morgan documentation suggests this:
// create a write stream (in append mode)
var accessLogStream = fs.createWriteStream(
__dirname + '/access.log', {flags: 'a'})
// setup the logger
app.use(morgan('combined', {stream: accessLogStream}));
But this has a problem; it's impossible to perform log rotation without killing and restarting the server. Instead, we'll use their `file-stream-rotator` package.
First, install the package:
**$ npm install file-stream-rotator --save**
Then we add this code to `app.js`:
var FileStreamRotator = require('file-stream-rotator');
..
var accessLogStream;
if (process.env.REQUEST_LOG_FILE) {
var logDirectory = path.dirname(process.env.REQUEST_LOG_FILE);
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory);
accessLogStream = FileStreamRotator.getStream({
filename: process.env.REQUEST_LOG_FILE,
frequency: 'daily',
verbose: false
});
}
..
app.use(logger(process.env.REQUEST_LOG_FORMAT || 'dev', {
stream: accessLogStream ? accessLogStream : process.stdout
}));
Here, we're using an environment variable, `REQUEST_LOG_FILE`, to control whether to send the log to `stdout` or to a file. The log can go into a directory, and the code will automatically create that directory if it doesn't exist. By using the `file-stream-rotator` (<https://www.npmjs.com/package/file-stream-rotator>), we're guaranteed to have log file rotation with no extra systems required.
## Debugging messages
You can generate quite a detailed trace of what Express does by running Notes this way:
**$ DEBUG=express:* npm start**
This is a pretty useful thing if you want to debug Express. But, we can use this in our own code as well. This is like debugging with the `console.log` statements, but without having to remember to comment out the debugging code.
It is very simple to enable debugging in a module:
var debug = require('debug')('module-name');
..
debug('some message');
..
debug('got file %s', fileName);
## Capturing stdout and stderr
Important messages can be printed to `process.stdout` or `process.stderr`, which can be lost if you don't capture that output. The Twelve Factor model suggests using a system facility to capture these output streams. With Notes, we'll use PM2 for that purpose, which we'll cover in Chapter 10, _Deploying Node.js Applications_.
The `logbook` module (<https://github.com/jpillora/node-logbook>) offers some useful capabilities to not only capture `process.stdout` and `process.stderr`, but to send that output to useful places.
## Uncaught exceptions
Uncaught exceptions is another area where important information can be lost. This is easy to fix in the Notes application:
var error = require('debug')('notes:error');
process.on('uncaughtException', function(err) {
error("I've crashed!!! - "+ (err.stack || err));
});
..
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
// util.log(err.message);
res.status(err.status || 500);
error((err.status || 500) +' '+ error.message);
res.render('error', {
message: err.message,
error: err
});
});
}
..
app.use(function(err, req, res, next) {
// util.log(err.message);
res.status(err.status || 500);
error((err.status || 500) +' '+ error.message);
res.render('error', {
message: err.message,
error: {}
});
});
The `Debug` package has a convention we're following. For an application with several modules, all debugger objects should use the naming pattern `app-name:module-name`. In this case, we used `notes:error` that will be used for all error messages. We could also use `notes:memory-model` or `notes:mysql-model` for debugging different models.
While we were setting up the handler for uncaught exceptions, it is also a good idea to add error logging in the error handlers.
# Storing notes in the filesystem
The filesystem is an often overlooked database engine. While filesystems don't have the sort of query features supported by database engines, they are a reliable place to store files. The notes schema is simple enough that the filesystem can easily serve as its data storage layer.
Let's start by adding a function to Note.js:
get JSON() {
return JSON.stringify({
key: this.key, title: this.title, body: this.body
});
}
This is a **getter** , which means `note.JSON` (no parenthesis) will simply give us the JSON representation. We'll use this later for writing to JSON files.
Take a peek at the static function mentioned in the following code:
static fromJSON(json) {
var data = JSON.parse(json);
var note = new Note(data.key, data.title, data.body);
return note;
}
This is a static function to aid in constructing Note objects if we have a JSON string. In other words, `fromJSON` is a factory method. The difference is that JSON is associated with an instance of the `Note` class, while `fromJSON` is associated with the class. That means if you have a `Note` instance:
var note = new Note("key", "title", "body");
var json = note.JSON();
But if you have JSON text, you can generate a `Note` instance as follows:
var note = Note.fromJSON(jsonText);
Now, let's create a new module, `models/notes-fs.js`, to hold the filesystem model:
'use strict';
const fs = require('fs-extra');
const path = require('path');
const util = require('util');
const log = require('debug')('notes:fs-model');
const error = require('debug')('notes:error');
const Note = require('./Note');
function notesDir() {
const dir = process.env.NOTES_FS_DIR || "notes-fs-data";
return new Promise((resolve, reject) => {
fs.ensureDir(dir, err => {
if (err) reject(err);
else resolve(dir);
});
});
}
function filePath(notesdir, key) {
return path.join(notesdir, key + ".json");
}
function readJSON(notesdir, key) {
const readFrom = filePath(notesdir, key);
return new Promise((resolve, reject) => {
fs.readFile(readFrom, 'utf8', (err, data) => {
if (err) return reject(err);
log('readJSON '+ data);
resolve(Note.fromJSON(data));
});
});
}
### Tip
You'll note this script starts with:
'use strict';
This is necessary to use some of the new ES-2015 features. It's highly recommended that you get into the habit of putting this line at the beginning of each file.
We're using another environment variable, `NOTES_FS_DIR`, to configure a directory within which to store notes. We'll have one file per note and store the note as JSON. If no environment variable is specified, we'll fall back on using `notes-fs-data` as the directory name.
The `notesDir` function will be used throughout `notes-fs` to ensure that the directory exists. To make this simple, we're using the `fs-extra` module because of the useful functions it adds to the regular `fs` module (<https://www.npmjs.com/package/fs-extra>). In this case, the `fs.ensureDir` function checks if the named directory structure exists. If not, it creates the named directory path for us.
Because we're adding another dependency:
**$ npm install fs-extra --save**
The filename for each data file is the `key` with `.json` appended. That gives one limitation that filenames cannot contain the `/` character, so we test for that using the following code:
exports.update = exports.create = function(key, title, body) {
return notesDir().then(notesdir => {
if (key.indexOf('/') >= 0)
throw new Error(`key ${key} cannot contain '/'`);
var note = new Note(key, title, body);
const writeTo = filePath(notesdir, key);
const writeJSON = note.JSON;
log('WRITE '+ writeTo +' '+ writeJSON);
return new Promise((resolve, reject) => {
fs.writeFile(writeTo, writeJSON, 'utf8', err => {
if (err) reject(err);
else resolve(note);
});
});
});
};
To flatten the code a little bit, we receive a `Promise` object from the `notesDir` function, and then chain our code in a `.then` clause.
Another advantage is we can simply throw an error in the natural way. The thrown error will naturally bubble out to a `.catch` handler.
Since the final step, `fs.writeFile`, is an asynchronous function, we had to wrap it with a Promise.
Otherwise, this is straightforward. The `filePath` function gives us a pathname to the data file, and then we use `fs.writeFile` to write the JSON to that file.
Where's the error handling code? We do check for a couple of errors, but where are they handled? Aren't there potential unchecked errors here? We have Promise objects that are generated, but no `.catch` function to capture any errors.
Notice that the `notesDir` function returns a `Promise` object, and this function is returning that Promise. We already know that Promise objects capture thrown exceptions, channeling them to a `.catch` function. For example, if one of these variables was `undefined` for some reason, triggering an unexpected exception, the `Promise` object will capture that exception.
As for _where's the error handler_ , consider that these functions will be called from router functions in `routes/index.js` or `routes/notes.js`. The missing `.catch` function is located in those router functions. That `.catch` function causes the error to get passed through the Express middleware chain until it lands in an error handler. That error handler is in `app.js`, and it causes an error page to be shown:
exports.read = function(key) {
return notesDir().then(notesdir => {
return readJSON(notesdir, key).then(thenote => {
log('READ '+ notesdir +'/'+ key
+' '+ util.inspect(thenote));
return thenote;
});
});
};
Using `readJSON`, read the file from the disk. It already generates the `Note` object, so all we have to do is hand the note to the promise chain:
exports.destroy = function(key) {
return notesDir().then(notesdir => {
return new Promise((resolve, reject) => {
fs.unlink(filePath(notesdir, key), err => {
if (err) reject(err);
else resolve();
});
});
});
};
The `fs.unlink` function deletes our file. Because this module uses the filesystem, deleting the file is all that's necessary to delete the note object.
Because it's an asynchronous function, we have to wrap `fs.unlink` within a Promise. You'll be doing a lot of this, so get used to this pattern:
exports.keylist = function() {
return notesDir().then(notesdir => {
return new Promise((resolve, reject) => {
fs.readdir(notesdir, (err, filez) => {
if (err) return reject(err);
if (!filez) filez = [];
resolve({ notesdir, filez });
});
});
})
.then(data => {
log('keylist dir='+ data.notesdir
+' files='+ util.inspect(data.filez));
var thenotes = data.filez.map(fname => {
var key = path.basename(fname, '.json');
log('About to READ '+ key);
return readJSON(data.notesdir, key).then(thenote => {
return thenote.key;
});
});
return Promise.all(thenotes);
});
};
The contract for `keylist` is to return a Promise that will resolve to an array of keys for existing note objects. Since they're stored as individual files in the `notesdir`, we have to read every file in that directory to retrieve its key.
`Array.map` constructs a new array from an existing array, using the return values of the provided function. We're using `Array.map` to construct an array containing Promise `objects` that read each file and resolve the promise with the `key`. We then use `Promise.all` to process that array of Promises:
exports.count = function() {
return notesDir().then(notesdir => {
return new Promise((resolve, reject) => {
fs.readdir(notesdir, (err, filez) => {
if (err) return reject(err);
resolve(filez.length);
});
});
});
};
Counting the number of notes is simply a matter of counting the number of files in `notesdir`.
We're almost ready to do this, but there's a few changes required in the router modules.
Let's start with `routes/index.js`, the router module for the home page:
'use strict';
..
var path = require('path');
var notes = require(process.env.NOTES_MODEL
? path.join('..', process.env.NOTES_MODEL)
: '../models/notes-memory');
const log = require('debug')('notes:router-home');
const error = require('debug')('notes:error');
We're changing how Notes model is being loaded.
We want to be able to use different Notes models at different times, making it easy to switch between them. This is the most flexible method to set an environment variable naming the path to the desired module.
`NOTES_MODEL` must be set to the path from the application's root directory. In this case, that would be `models/notes-fs`. This code then generates a relative pathname, because the router code and model code are in sibling directories, as shown.
In `routes/notes.js`, we make the same change:
var path = require('path');
var notes = require(process.env.NOTES_MODEL
? path.join('..', process.env.NOTES_MODEL)
: '../models/notes-memory');
const log = require('debug')('notes:router-notes');
const error = require('debug')('notes:error');
In `package.json`, add this to the `scripts` section:
"start-fs": "NOTES_MODEL=models/notes-fs node ./bin/www",
### Tip
When you put these entries in `package.json`, make sure that you use correct JSON syntax. In particular, if you leave a comma at the end of the `scripts` section, it will fail to parse and npm will throw up an error message.
In `app.js`, you might want to readjust the theme to the default Bootstrap look:
// app.use('/vendor/bootstrap/css',
// express.static(path.join(__dirname, 'cyborg')));
app.use('/vendor/bootstrap/css', express.static(path.join(
__dirname, 'bower_components', 'bootstrap', 'dist', 'css')));
app.use('/vendor/bootstrap/fonts', express.static(path.join(
__dirname, 'bower_components', 'bootstrap', 'dist', 'fonts')));
app.use('/vendor/bootstrap/js', express.static(path.join(
__dirname, 'bower_components', 'bootstrap', 'dist', 'js')));
With this code in place, we can now run the notes application as follows:
**$ DEBUG=notes:* npm run start-fs**
**> notes@0.0.0 start-fs /Users/david/chap07/notes**
**> NOTES_MODEL=models/notes-fs node ./bin/www**
**notes:server Listening on port 3000 +0ms**
**notes:fs-model keylist dir=notes-fs-data files=[ ] +4s**
Then we can use the application at `http://localhost:3000` as before. Because we did not change any template or CSS files, the application will look exactly as you left it at the end of Chapter 6, _Implementing the Mobile-First Paradigm_.
Because debugging is turned on for `notes:*`, we'll see a log of whatever the Notes application is doing. It's easy to turn this off simply by not setting the `DEBUG` variable.
You can now kill and restart the Notes application and see the exact same notes. You can also edit the notes at the command line using regular text editors like `vi`. You can now start multiple servers on different ports and see exactly the same notes:
"server1": "NOTES_MODEL=models/notes-fs PORT=3001 node ./bin/www",
"server2": "NOTES_MODEL=models/notes-fs PORT=3002 node ./bin/www",
Then you start `server1` and `server2` in separate command windows as we did in Chapter 5, _Your First Express Application_. Then, visit the two servers in separate browser windows, and you will see that both browser windows show the same notes.
The final check is to create a note where the _key_ has a `/` character. Remember that the key is used to generate the filename where we store the note, and therefore the key cannot contain a `/` character. With the browser open, click on **Add Note** and enter a note, ensuring that you use a `/` character in the `key` field. On clicking the **Submit** button, you'll see an error saying this isn't allowed.
## Storing notes with the LevelUP data store
To get started with actual databases, let's look at an extremely lightweight, small-footprint database engine: **LevelUP**. This is a Node.js-friendly wrapper around the LevelDB engine developed by Google, which is normally used in web browsers for local data persistence. It is a non-indexed, NoSQL data store designed originally for use in browsers. The Node.js module, LevelUP, uses the LevelDB API, and supports multiple backends, including `LevelDOWN` that integrates the C++ LevelDB database into Node.js.
Visit <https://www.npmjs.com/package/levelup> for information on the module.
To install the database engine, run this command:
**$ npm install levelup@1.x leveldown@1.x --save**
Then, start creating the module `models/notes-levelup.js`:
'use strict';
const util = require('util');
const levelup = require('levelup');
const log = require('debug')('notes:levelup-model');
const error = require('debug')('notes:error');
const Note = require('./Note');
var db; // store the database connection here
function connectDB() {
return new Promise((resolve, reject) => {
if (db) return resolve(db);
levelup(process.env.LEVELUP_DB_LOCATION
|| 'notes.levelup', {
createIfMissing: true,
valueEncoding: "json"
},
(err, _db) => {
if (err) return reject(err);
db = _db;
resolve();
});
});
}
When connected to a `LevelUP` database, the `levelup` module gives us a `db` object through which to interact with the database. We're storing that object as a global within the module for easy usage. If the `db` object is set, we can just return it immediately. Otherwise, we open the database, telling `createIfMissing` to go ahead and create the database if needed:
exports.update = exports.create = function(key, title, body) {
return connectDB().then(() => {
var note = new Note(key, title, body);
return new Promise((resolve, reject) => {
db.put(key, note, err => {
if (err) reject(err);
else resolve(note);
});
});
});
};
Calling `db.put` either creates a new database entry, or replaces an existing one. Therefore, both `exports.update` and `exports.create` are set to be the same function.
Under the covers, `LevelUP` automatically encodes our object as JSON, and then reconstitutes an object when reading from the database. Therefore, we don't need to convert to and from JSON ourselves:
exports.read = function(key) {
return connectDB().then(() => {
return new Promise((resolve, reject) => {
db.get(key, (err, note) => {
if (err) reject(err);
else resolve(new Note(note.key,
note.title, note.body));
});
});
});
};
`LevelUP` makes it easy: just call `db.get` and it retrieves the data. While the data is reconstituted as an object, we need to ensure it's converted into a Note object:
exports.destroy = function(key) {
return connectDB().then(() => {
return new Promise((resolve, reject) => {
db.del(key, err => {
if (err) reject(err);
else resolve();
});
});
});
};
The `db.destroy` function deletes a record from the database:
exports.keylist = function() {
return connectDB().then(() => {
var keyz = [];
return new Promise((resolve, reject) => {
db.createReadStream()
.on('data', data => keyz.push(data.key))
.on('error', err => reject(err))
.on('end', () => resolve(keyz));
});
});
};
exports.count = function() {
return connectDB().then(() => {
var total = 0;
return new Promise((resolve, reject) => {
db.createReadStream()
.on('data', data => total++)
.on('error', err => reject(err))
.on('end', () => resolve(total));
});
});
};
Where other operations were easy with `LevelUP`, these two are not straightforward. The `LevelUP` database doesn't give us an easy way to retrieve the keys or count the items in the database. `LevelUP` does not provide any indexing or a query function.
Instead we have to read the items one at a time. It provides an `EventEmitter` style interface to make the code more readable, at least.
Now, because of our preparation, we can go straight to using the `LevelUP` model. First, add this to `package.json` in the `scripts` section:
"start-levelup": "NOTES_MODEL=models/notes-levelup node ./bin/www",
Then, you can run the Notes application:
**$ DEBUG=notes:* npm run start-levelup**
**> notes@0.0.0 start /Users/david/chap07/notes**
**> node ./bin/www**
**notes:server Listening on port 3000 +0ms**
The printout in the console will be the same, and the application will also look the same. You can put it through its paces and see that everything works correctly.
`LevelUP` does not support simultaneous access to a database from multiple instances. Therefore, you won't be able to use the multiple Notes application scenario. You will, however, be able to stop and restart the application at will without losing any notes.
## Storing notes in SQL with SQLite3
To get started with actual databases, let's see how to use SQL from Node.js. First, we'll use SQLite3, a lightweight, simple-to-set-up database engine eminently suitable for many applications.
To learn about that database engine, visit <http://www.sqlite.org/>.
To learn about the Node.js module, visit <https://github.com/mapbox/node-sqlite3/wiki/API> or <https://www.npmjs.com/package/sqlite3>.
The primary advantage of SQLite3 is that it doesn't require a server; it is a self-contained, no-set-up-required SQL database.
The first step is to install the module:
**$ npm install sqlite3@3.x --save**
### SQLite3 database scheme
Next, we need to make sure our database is configured. We're using this SQL table definition for the schema (save this as `models/schema-sqlite3.sql`):
CREATE TABLE IF NOT EXISTS notes (
notekey VARCHAR(255),
title VARCHAR(255),
author VARCHAR(255),
body TEXT
);
How do we initialize this schema before writing some code? One way is to ensure the `sqlite3` package is installed through your operating system package management system, such as using `apt-get` on Ubuntu/Debian, Macports on Mac OS X, and so on. Once it's installed, you can run this command:
**$ sqlite3 chap07.sqlite3**
**SQLite version 3.10.2 2016-01-20 15:27:19**
**Enter ".help" for usage hints.**
**sqlite > CREATE TABLE IF NOT EXISTS notes (**
**... > notekey VARCHAR(255),**
**... > title VARCHAR(255),**
**... > author VARCHAR(255),**
**... > body TEXT**
**... > );**
**sqlite > .schema notes**
**CREATE TABLE notes (**
**notekey VARCHAR(255),**
**title VARCHAR(255),**
**author VARCHAR(255),**
**body TEXT**
**);**
**sqlite > ^D**
While we can do that, the Twelve Factor application model says we must automate any administrative processes like this. To that end, we should instead write a little script to run a SQL operation on SQLite3 and use that to initialize the database.
Fortunately, the `sqlite3` command offers us a way to do this. Add the following to the `scripts` section of `package.json`:
"sqlite3-setup": "sqlite3 chap07.sqlite3 --init models/schema-sqlite3.sql",
Run it:
**$ npm run sqlite3-setup**
**> notes@0.0.0 sqlite3-setup /Users/david/chap07/notes**
**> sqlite3 chap07.sqlite3 --init models/schema-sqlite3.sql **
**-- Loading resources from models/schema-sqlite3.sql**
**SQLite version 3.10.2 2016-01-20 15:27:19**
**Enter ".help" for usage hints.**
**sqlite > .schema notes**
**CREATE TABLE notes (**
**notekey VARCHAR(255),**
**title VARCHAR(255),**
**author VARCHAR(255),**
**body TEXT**
**);**
**sqlite > ^D**
We could have written a small Node.js script to do this, and it's easy to do so. However, by using the tools provided by the package, we have less code to maintain in our own project.
### SQLite3 model code
Now, we can write code to use this database in the Notes application.
Create the file `models/notes-sqlite3.js`:
'use strict';
const util = require('util');
const sqlite3 = require('sqlite3');
const log = require('debug')('notes:sqlite3-model');
const error = require('debug')('notes:error');
const Note = require('./Note');
sqlite3.verbose();
var db; // store the database connection here
exports.connectDB = function() {
return new Promise((resolve, reject) => {
if (db) return resolve(db);
var dbfile = process.env.SQLITE_FILE || "notes.sqlite3";
db = new sqlite3.Database(dbfile,
sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE,
err => {
if (err) reject(err);
else {
log('Opened SQLite3 database '+ dbfile);
resolve(db);
}
});
});
};
This serves the same purpose as the `connectDB` function in `notes-levelup.js`: to manage the database connection. If the database is not open, it'll go ahead and do so, and even make sure the database file is created (if it doesn't exist). Whether or not the database is already open, the database connection will be passed to the next stage of the Promise.
You could, if needed, insert a `.then` function to automatically create the table if it does not exist. The SQL for that would be:
CREATE TABLE IF NOT EXISTS notes ( .. schema definition );
This way there would be no need for a separate step to initialize the table, but it would carry the overhead of executing this SQL every time the database is opened:
exports.create = function(key, title, body) {
return exports.connectDB().then(() => {
var note = new Note(key, title, body);
return new Promise((resolve, reject) => {
db.run("INSERT INTO notes ( notekey, title, body) "+
"VALUES ( ?, ? , ? );",
[ key, title, body ], err => {
if (err) reject(err);
else {
log('CREATE '+ util.inspect(note));
resolve(note);
}
});
});
});
};
exports.update = function(key, title, body) {
return exports.connectDB().then(() => {
var note = new Note(key, title, body);
return new Promise((resolve, reject) => {
db.run("UPDATE notes "+
"SET title = ?, body = ? "+
"WHERE notekey = ?",
[ title, body, key ], err => {
if (err) reject(err);
else {
log('UPDATE '+ util.inspect(note));
resolve(note);
}
});
});
});
};
These are our `create` and `update` functions. As promised, we are now justified in defining the Notes model to have separate functions for `create` and `update` operations. The SQL statement for each is different.
Calling `db.run` executes a SQL query, giving us the opportunity to insert parameters into the query string.
The `sqlite3` module uses a parameter substitution paradigm that's common in SQL programming interfaces. The programmer puts the SQL query into a string, and then places a question mark in each place it's desired to insert a value into the query string. Each question mark in the query string has to match with a value in the array provided by the programmer. The module takes care of encoding the values correctly so that the query string is properly formatted, while preventing SQL injection attacks.
The `db.run` function simply runs the SQL query it is given, and does not retrieve any data:
exports.read = function(key) {
return exports.connectDB().then(() => {
return new Promise((resolve, reject) => {
db.get("SELECT * FROM notes WHERE notekey = ?",
[ key ], (err, row) => {
if (err) reject(err);
else {
var note = new Note(row.notekey,
row.title, row.body);
log('READ '+ util.inspect(note));
resolve(note);
}
});
});
});
};
To retrieve data using the `sqlite3` module, you use the `db.get`, `db.all`, or `db.each` functions. The `db.get` function used here returns the first row of the result set. The `db.all` function returns all rows of the result set at once, which can be a problem for available memory if the result set is large. The `db.each` function retrieves one row at a time, while still allowing processing of the entire result set.
For the Notes application, using `db.get` to retrieve a note is sufficient because there is only one note per `notekey`. Therefore, our `SELECT` query will return at most one row anyway. But what if your application will see multiple rows in the result set? We'll see what to do about that in a minute.
By the way, this `read` function has a bug in it. See if you can spot the error. We'll read more about this in Chapter 11, _Unit Testing_ , when our testing efforts uncover the bug.
exports.destroy = function(key) {
return exports.connectDB().then(() => {
return new Promise((resolve, reject) => {
db.run("DELETE FROM notes WHERE notekey = ?;",
[ key ], err => {
if (err) reject(err);
else {
log('DESTROY '+ key);
resolve();
}
});
});
});
};
To destroy a note, we simply execute the `DELETE FROM` statement:
exports.keylist = function() {
return exports.connectDB().then(() => {
return new Promise((resolve, reject) => {
var keyz = [];
db.each("SELECT notekey FROM notes",
(err, row) => {
if (err) reject(err);
else keyz.push(row.notekey);
},
(err, num) => {
if (err) reject(err);
else resolve(keyz);
});
});
});
};
The `db.each` function conveniently iterates over each row of the result set, calling the first function on each. This avoids the memory footprint of loading the whole result set into memory at once. Instead, you process it one item at a time.
There are two callback functions for the `db.each` function. The first is executed for each row of the result set, and here we use that to construct the array of keys. The second is called when the result set is finished, and here we use it to resolve the Promise to return the key array. The code is as follows:
exports.count = function() {
return exports.connectDB().then(() => {
return new Promise((resolve, reject) => {
db.get("select count(notekey) as count from notes",
(err, row) => {
if (err) return reject(err);
resolve(row.count);
});
});
});
};
We can simply use SQL to count the number of notes for us. In this case, `db.get` returns a row with a single column, `count`, which is the value we want to return.
### Running Notes with SQLite3
Finally, we're ready to run the Notes application with SQLite3. Add the following code to the `scripts` section of `package.json`:
"start-sqlite3": "SQLITE_FILE=chap07.sqlite3 NOTES_MODEL=models/notes-sqlite3 node ./bin/www",
Run the Notes application:
**$ DEBUG=notes:* npm run start-sqlite3**
**> notes@0.0.0 start-sqlite3 /Users/david/chap07/notes**
**> SQLITE_FILE=chap07.sqlite3 NOTES_MODEL=models/notes-sqlite3 node ./bin/www**
**notes:server Listening on port 3000 +0ms**
**notes:sqlite3-model Opened SQLite3 database chap07.sqlite3 +5s**
You can now browse the application at `http://localhost:3000`, and run it through its paces as before.
Because SQLite3 supports simultaneous access from multiple instances, you can run the multiserver example by adding this to the `scripts` section of `package.json`:
"server1-sqlite3": "SQLITE_FILE=chap07.sqlite3 NOTES_MODEL=models/notes-sqlite3 PORT=3001 node ./bin/www",
"server2-sqlite3": "SQLITE_FILE=chap07.sqlite3 NOTES_MODEL=models/notes-sqlite3 PORT=3002 node ./bin/www",
Then, run each of these in separate command windows, as before.
Because we still haven't made any changes to the View templates or CSS files, the application will look the same as before.
Of course, you can use the `sqlite` command to inspect the database:
**$ sqlite3 chap07.sqlite3**
**SQLite version 3.10.2 2016-01-20 15:27:19**
**Enter ".help" for usage hints.**
**sqlite > select * from notes;**
**hithere|Hi There||ho there what there**
**himom|Hi Mom||This is where we say thanks**
## Storing notes the ORM way with Sequelize
There are several popular SQL database engines, such as PostgreSQL, MySQL (<https://www.npmjs.com/package/mysql>), and MariaDB (<https://www.npmjs.com/package/mariasql>). These modules are similar in nature to the `sqlite3` module we just used. The programmer is close to the SQL, which can be good in the same way that driving a stick shift car is fun. But what if we want a higher-level view of the database so that we can think in terms of using the database to store objects rather than rows of a database table? **Object Relation Mapping** (ORM) systems provide such a higher-level interface and even offer the ability to use the data model with several databases.
The **Sequelize** module (<http://www.sequelizejs.com/>) is Promise-based, offers strong, well-developed ORM features, and can connect with SQLite3, MySQL, and PostgreSQL, MariaDB, and MSSQL. Because Sequelize is Promise-based, it will fit naturally with the application code we're writing.
A prerequisite is to have access to a suitable database server. Most web hosting providers offer MySQL or PostgreSQL as part of the service.
Before we start on the code, let's install two modules:
**$ npm install sequelize@3.x --save**
**$ npm install js-yaml@3.x --save**
The first obviously installs the Sequelize package. The second, `js-yaml`, is installed so that we can store the Sequelize connection configuration as a YAML file.
Perhaps the best place to learn about YAML is its Wikipedia page at <https://en.wikipedia.org/wiki/YAML>. It is a human-readable _data serialization language_ , which simply means YAML is an easy-to-use text file format to describe data objects.
### Sequelize model for the Notes application
Let's create a new file `models/notes-sequelize.js`:
'use strict';
const util = require('util');
const fs = require('fs-extra');
const jsyaml = require('js-yaml');
const Sequelize = require("sequelize");
const log = require('debug')('notes:sequelize-model');
const error = require('debug')('notes:error');
const Note = require('./Note');
exports.connectDB = function() {
var SQNote;
var sequlz;
if (SQNote) return SQNote.sync();
return new Promise((resolve, reject) => {
fs.readFile(process.env.SEQUELIZE_CONNECT, 'utf8',
(err, data) => {
if (err) reject(err);
else resolve(data);
});
})
.then(yamltext => {
return jsyaml.safeLoad(yamltext, 'utf8');
})
.then(params => {
sequlz = new Sequelize(params.dbname,
params.username, params.password,
params.params);
SQNote = sequlz.define('Note', {
notekey: { type: Sequelize.STRING,
primaryKey: true, unique: true },
title: Sequelize.STRING,
body: Sequelize.TEXT
});
return SQNote.sync();
});
};
This is a little bigger than our other `connectDB` functions. We're using a three-stage process, which first reads in a configuration file for Sequelize connection parameters, parses that with the YAML parser, uses Sequelize to open the database, and finally sets up the schema.
The Sequelize connection parameters are stored in a YAML file we specify in the `SEQUELIZE_CONNECT` environment variable. We'll go over the format of this file later.
The line `new Sequelize(..)` opens the database connection. The parameters obviously contain any needed database name, username, password, and other options required to connect with the database.
The line `sequlz.define` is where we define the database schema. Instead of defining the schema as the SQL command to create the database table, we're giving a high-level description of the fields and their characteristics. Sequelize maps the object attributes into columns in tables. Here, we defined a simple object with the same attributes in the other Notes model implementations. Finally, the `SQNote.sync()` function ensures the table is set up.
We're telling Sequelize to call this schema Note, but we're using a variable `SQNote` to refer to that schema. That's because we already defined Note as a class to represent notes. To avoid a clash of names, we'll keep using the Note class, and use SQNote to interact with Sequelize about the notes stored in the database.
Online documentation can be found at the following locations:
* **Sequelize class** : <http://docs.sequelizejs.com/en/latest/api/sequelize/>
* **Defining models** : <http://docs.sequelizejs.com/en/latest/api/model/>
exports.create = function(key, title, body) {
return exports.connectDB()
.then(SQNote => {
return SQNote.create({
notekey: key,
title: title,
body: body
});
});
};
exports.update = function(key, title, body) {
return exports.connectDB()
.then(SQNote => {
return SQNote.find({ where: { notekey: key } })
.then(note => {
if (!note) {
throw new Error("No note found for key " + key);
} else {
return note.updateAttributes({
title: title,
body: body
});
}
});
});
};
There are several ways to create a new object instance in Sequelize, the simplest of which is to call an object's `create` function (in this case, `SQNote.create`). This function collapses together two other functions, `build` (to create the object) and `save` (to write it to the database).
Updating an object instance is a little different. First, we must retrieve its entry from the database using the `find` operation. It uses an object specifying the query to perform. The `find` operation retrieves one instance, whereas the `findAll` operation retrieves all matching instances.
For documentation on Sequelize queries, visit <http://docs.sequelizejs.com/en/latest/docs/querying/>.
You'll notice that `SQNote.find` returns a Promise, and we've attached a `.then` function to that Promise. There are instances where the `.then` function is called, but the `note` object is empty. We account for that case by throwing an error saying no note was found.
Once the instance is found, we can update its values simply with the `updateAttributes` function.
exports.read = function(key) {
return exports.connectDB()
.then(SQNote => {
return SQNote.find({ where: { notekey: key } })
.then(note => {
if (!note) {
throw new Error("No note found for " + key);
} else {
return new Note(note.notekey,
note.title, note.body);
}
});
});
};
To read a note, we use the `find` operation again. There is the possibility of an empty result, and we have to throw an error to match.
The contract for this function is to return a `Note` object. That means taking the fields retrieved using Sequelize and using that to create a `Note` object.
exports.destroy = function(key) {
return exports.connectDB()
.then(SQNote => {
return SQNote.find({ where: { notekey: key } })
.then(note => {
return note.destroy();
});
});
};
To destroy a note, we must use the `find` operation to retrieve its instance, and then call its `destroy()` method:
exports.keylist = function() {
return exports.connectDB().then(SQNote => {
return SQNote.findAll({ attributes: [ 'notekey' ] })
.then(notes => {
return notes.map(note => note.notekey);
});
});
};
Because the `keylist` function needs to act on all `Note` objects, we use the `findAll` operation. We query for the `notekey` attribute on all notes. Because we're given an array of objects with a field named `notekey`, to match our contract we use the `.map` function to convert this into an array of the note keys.
This uses the ES-2015 arrow function to its fullest to collapse this code to pure succinctness. When written as `note => note.notekey`, an arrow function behaves as if it had been written this way:
(note) => {
return note.notekey;
}
Remember that the `map` function constructs a new array from the return value of the function passed to `map`. Thus, we're taking the array of `Note` objects and converting it into an array of keys, on one line of code.
exports.count = function() {
return exports.connectDB().then(SQNote => {
return SQNote.count().then(count => {
log('COUNT '+ count);
return count;
});
});
};
For the `count` function, we can just use the `count()` method to calculate the needed result.
### Configuring a Sequelize database connection
Sequelize supports several SQL database engines. Earlier, we said we needed a YAML file to store the database access credentials, but didn't give specifics of that file. Let's do so.
Let's first use SQLite3, because no further setup is required. After that, we'll get adventurous and reconfigure our Sequelize module to use MySQL. For connection configuration, create a file named `models/sequelize-sqlite.yaml` containing the following code:
dbname: notes
username:
password:
params:
dialect: sqlite
storage: notes-sequelize.sqlite3
If you refer back to the Sequelize constructor above, it requires `dbname`, `username,` and `password` as connection credentials, and the `params` object gives additional parameters. That's exactly what we have in the YAML file.
The `dialect` field tells Sequelize what kind of database to use. For a SQLite database, the database filename is given in the `storage` field.
How do you switch to another database server? Create a new file, such as `models/sequelize-mysql.yaml`, containing something like the following code:
dbname: notes
username: .. user name
password: .. password
params:
host: localhost
port: 3306
dialect: mysql
This is straightforward. Set the database `dialect` and other connection information, and you're good to go.
You will need to install the base MySQL driver so that Sequelize can use MySQL:
**$ npm install mysql@2.x --save**
Add an entry into the `scripts` section of `package.json`:
"start-sequelize-mysql": "SEQUELIZE_CONNECT=models/sequelize-mysql.yaml NOTES_MODEL=models/notes-sequelize node ./bin/www",
No other change is needed; Sequelize takes care of any difference between the SQL database engines.
Running with Sequelize against other databases it supports, such as PostgreSQL, is just as simple. Just create a configuration file, install the Node.js driver, and install/configure the database engine.
### Running the Notes application with Sequelize
Now we can get ready to run the Notes application using Sequelize. We can run this against both SQLite3 and MySQL, but let's start with SQLite. Add this entry to the `scripts` entry in `package.json`:
"start-sequelize": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize node ./bin/www"
Then run it as follows:
**$ DEBUG=notes:* npm run start-sequelize**
**> notes@0.0.0 start-sequelize /Users/david/chap07/notes**
**> SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize node ./bin/www**
**notes:server Listening on port 3000 +0ms**
As before, the application looks exactly the same because we've not changed the View templates or CSS files. Put it through its paces and everything should work.
With Sequelize, multiple Notes application instances is as simple as adding these lines to the `scripts` section of `package.json`, then starting both instances as before:
"server1-sequelize": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize PORT=3001 node ./bin/www",
"server2-sequelize": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize PORT=3001 node ./bin/www",
You will be able to start both instances, use separate browser windows to visit both instances, and see that they show the same set of notes.
Now that we have run Notes using Sequelize with SQLite, we need to also run it with MySQL. We already created the `models/sequelize-mysql.yaml` configuration file and the scripts entry in `package.json`. Before we can proceed, you need to provision a MySQL server.
The specific method you follow depends on your preferences. For example, MySQL is available through all package management systems, making it easy to install an instance on your laptop. You can head to <http://dev.mysql.com/downloads/mysql/> and follow the official installation instructions. Since MariaDB is API compatible with MySQL, you can use it instead of MySQL if you prefer.
If you prefer to use PostgreSQL, it's possible to do so with a small adjustment to the instructions, since Sequelize supports that database as well. Simply create a configuration file, `models/sequelize-postgresql.yaml`, by duplicating the MySQL config. You then use `postgres` as the dialect, rather than `mysql`. The Node.js database driver is installed using the following command:
**$ npm install --save pg pg-hstore**
Then you add a line to the `scripts` section of `package.json`:
"start-sequelize-postgres": "SEQUELIZE_CONNECT=models/sequelize-postgres.yaml NOTES_MODEL=models/notes-sequelize node ./bin/www",
These steps to use PostgreSQL have not been tested, but the Sequelize website says it should work. It also says a similar set of steps will get you running on MySQL.
Once you have a MySQL or PostgreSQL instance installed, you can run Notes against the database as follows:
**$ DEBUG=notes:* npm run start-sequelize-mysql**
**> notes@0.0.0 start-sequelize-mysql /Users/david/chap07/notes**
**> SEQUELIZE_CONNECT=models/sequelize-mysql.yaml NOTES_MODEL=models/notes-sequelize node ./bin/www**
**notes:server Listening on port 3000 +0ms**
With Notes running on your preferred database server, such as MySQL, put it through its paces and verify that Notes works.
## Storing notes in MongoDB
MongoDB is widely used with Node.js applications, if only because of the popular MEAN acronym: MongoDB (or MySQL), Express, Angular, and Node.js. Because MongoDB uses JavaScript as its native scripting language, it'll be instantly familiar to JavaScript programmers.
MongoDB is one of the leading NoSQL databases. It is described as a _scalable, high-performance, open source, document-oriented database_. It uses JSON-style documents with no predefined, rigid schema and a large number of advanced features. You can visit their website for more information and documentation: <http://www.mongodb.org>.
Documentation on the Node.js driver for MongoDB can be found at <https://www.npmjs.com/package/mongodb> and <http://mongodb.github.io/node-mongodb-native/>.
Mongoose is a popular ORM for MongoDB (<http://mongoosejs.com/>).
You will need a running MongoDB instance. **Mongolab** (<https://mongolab.com/>), **compose.io** (<https://www.compose.io/>), and **ScaleGrid.io** (<https://scalegrid.io/>) offer hosted MongoDB services.
It's possible to set up a temporary MongoDB instance for testing on, say, your laptop. It is available in all the operating system package management systems, and the MongoDB website has instructions (<https://docs.mongodb.org/manual/installation/>).
Once installed, it's not necessary to set up MongoDB as a background service. Instead, you can run a couple of simple commands to get a MongoDB instance running in the foreground of a command window, which you can kill and restart any time you like.
In one command window, run:
**$ mkdir data**
**$ mongod --dbpath data**
In another command window, you can test it like this:
**$ mongo**
**MongoDB shell version: 3.0.8**
**connecting to: test**
**Welcome to the MongoDB shell.**
**For interactive help, type "help".**
**For more comprehensive documentation, see**
**http://docs.mongodb.org/**
**Questions? Try the support group**
**http://groups.google.com/group/mongodb-user**
**> db.foo.save({ a: 1});**
**WriteResult({ "nInserted" : 1 })**
**> db.foo.find();**
**{ "_id" : ObjectId("56c0c98673f65b7988a96a77"), "a" : 1 }**
**> **
**bye**
This saves a _document_ in the collection named `foo`. The second command finds all documents in `foo`, printing them out for you. The `_id` field is added by MongoDB and serves as a document identifier. This is useful for testing and debugging. For a real deployment, your MongoDB server must be properly on a server. See the MongoDB documentation for these instructions.
### MongoDB model for the Notes application
Now that you've proved you have a working MongoDB server, let's get to work.
Installing the Node.js driver is as simple as running the following command:
**$ npm install mongodb@2.x --save**
While Mongoose is a good ORM for MongoDB, the API provided by the `mongodb` driver is very good and easy to use. Because the MongoDB shell uses JavaScript for its command set, the `mongodb` driver implements a nearly identical API.
Now create a new file, `models/notes-mongodb.js`:
'use strict';
const util = require('util');
const mongodb = require("mongodb");
const MongoClient = require('mongodb').MongoClient;
const log = require('debug')('notes:mongodb-model');
const error = require('debug')('notes:error');
const Note = require('./Note');
var db;
exports.connectDB = function() {
return new Promise((resolve, reject) => {
if (db) return resolve(db);
// Connection URL
var url = process.env.MONGO_URL;
// Use connect method to connect to the Server
MongoClient.connect(url, (err, _db) => {
if (err) return reject(err);
db = _db;
resolve(_db);
});
});
};
The `MongoClient` class is used to connect with a MongoDB instance. The required URL, which will be specified through an environment variable, uses a straightforward format: `mongodb://localhost/chap07`.
This opens the database connection, unless the database connection is already open. In either case, the connection object is passed down the Promise chain:
exports.create = function(key, title, body) {
return exports.connectDB()
.then(db => {
var note = new Note(key, title, body);
var collection = db.collection('notes');
return collection.insertOne({
notekey: key, title: title, body: body
}).then(result => { return note; });
});
};
exports.update = function(key, title, body) {
return exports.connectDB()
.then(db => {
var note = new Note(key, title, body);
var collection = db.collection('notes');
return collection.updateOne({ notekey: key },
{ $set: { title: title, body: body } })
.then(result => { return note; } );
});
};
MongoDB stores all documents in _collections_. Each document is a BSON object (a binary form of JSON) under the covers. A collection is a group of related documents, and a collection is analogous to a table in a relational database. This means creating a new document or updating an existing one starts by constructing it as a JavaScript object, and then asking MongoDB to save that object to the database. MongoDB automatically encodes the object into its internal representation.
The `db.collection` method gives us a `Collection` object with which we can manipulate the named collection. See its documentation at <http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html>.
As the method name implies, `insertOne` inserts one document into the collection. Likewise, the `updateOne` method first finds a document (in this case, by looking up the document with the matching `notekey` field), and then changes fields in the document as specified.
You'll see that we're using these methods as if they return a Promise. Indeed, that is what they return. The `mongodb` driver supports both callbacks and Promises. If you call a method and provide a callback function, it will provide results and errors through the callback. But if you leave out the callback function, it returns a Promise that you can use to receive the results and errors.
Further documentation can be found at the following links:
* **Insert** : <https://docs.mongodb.org/getting-started/node/insert/>
* **Update** : <https://docs.mongodb.org/getting-started/node/update/>
Next, let's look at reading a note from MongoDB:
exports.read = function(key) {
return exports.connectDB()
.then(db => {
var collection = db.collection('notes');
// Find some documents
return collection.findOne({ notekey: key })
.then(doc => {
var note = new Note(doc.notekey, doc.title, doc.body);
return note;
});
});
};
The `mongodb` driver supports several variants of `find` operations. In this case, the Notes application ensures there is exactly one document matching a given key. Therefore, we can use the `findOne` method. As the name implies, `findOne` will return the first matching document.
The argument to `findOne` is a query descriptor. This simple query looks for documents whose `notekey` field matches the requested `key`. An empty query will, of course, match all documents in the collection. You can match against other fields in a similar way, and the query descriptor can do much more. For documentation on queries, visit <https://docs.mongodb.org/getting-started/node/query/>.
The `insertOne` method we used earlier also took the same kind of query descriptor.
In order to satisfy the contract for this function, we create a `Note` object and then return it to the Promise chain. Hence, we create a Note using the data retrieved from the database.
exports.destroy = function(key) {
return exports.connectDB()
.then(db => {
var collection = db.collection('notes');
return collection.findOneAndDelete({ notekey: key });
});
};
One of the `find` variants is `findOneAndDelete`. As the name implies, it finds one document matching the query descriptor, and then deletes that document.
The status, including possible errors, is returned to the Promise chain.
exports.keylist = function() {
return exports.connectDB()
.then(db => {
var collection = db.collection('notes');
return new Promise((resolve, reject) => {
var keyz = [];
collection.find({}).forEach(
note => { keyz.push(note.notekey); },
err => {
if (err) reject(err);
else resolve(keyz);
}
);
});
});
};
Here, we're using the base `find` operation and giving it an empty query so that it matches every document. What we're to return is an array containing the `notekey` for every document.
All of the `find` operations return a `Cursor` object. The documentation can be found at <http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html>.
The Cursor object is, as the name implies, a pointer into a result set from a query. It has a number of useful functions related to operating on a result set. For example, you can skip the first few items in the results, or limit the size of the result set, or perform the `filter` and `map` operations.
The `Cursor.forEach` method takes two callback functions. The first is called on every element in the result set. In this case, we can use that to record just the `notekey` into an array. The second callback is called after all elements in the result set have been processed. We use this to indicate success or failure, and to pass the `keyz` array to the Promise chain.
exports.count = function() {
return exports.connectDB()
.then(db => {
var collection = db.collection('notes');
return new Promise((resolve, reject) => {
collection.count({}, (err, count) => {
if (err) reject(err);
else resolve(count);
});
});
});
};
The `count` method takes a query descriptor and, as the name implies, counts the number of matching documents.
### Running the Notes application with MongoDB
Now that we have our MongoDB model, we can get ready to run Notes with it.
By now you know the drill; add this to the `scripts` section of `package.json`:
"start-mongodb": "MONGO_URL=mongodb://localhost/chap07 NOTES_MODEL=models/notes-mongodb node ./bin/www",
The `MONGO_URL` environment variable is the URL to connect with your MongoDB database.
You can start the Notes application as follows:
**$ DEBUG=notes:* npm run start-mongodb**
**> notes@0.0.0 start-mongodb /Users/david/chap07/notes**
**> MONGO_URL=mongodb://localhost/chap07 NOTES_MODEL=models/notes-mongodb node ./bin/www**
**notes:server Listening on port 3000 +0ms**
You can browse the application at `http://localhost:3000` and put it through its paces. You can kill and restart the application, and your notes will still be there.
Add this to the `scripts` section of `package.json`:
"server1-mongodb": "MONGO_URL=mongodb://localhost/chap07 NOTES_MODEL=models/notes-mongodb PORT=3001 node ./bin/www",
"server2-mongodb": "MONGO_URL=mongodb://localhost/chap07 NOTES_MODEL=models/notes-mongodb PORT=3002 node ./bin/www",
You will be able to start two instances of the Notes application, and see that both share the same set of notes.
# Summary
We went through a real whirlwind of different database technologies. While we looked at the same seven functions over and over, it's useful to be exposed to the various data storage models and ways of getting things done. Even so, we only touched the surface of options for accessing databases and data storage engines from Node.js.
By abstracting the model implementations correctly, we were able to easily switch data storage engines while not changing the rest of the application.
By focusing the model code on the purpose of storing data, both the models and the application should be easier to test. The application can be tested with a mock data module that provides known predictable notes that can be checked predictably. We'll look at this in more depth in Chapter 11, _Unit Testing_.
In the next chapter, we'll focus on deploying our application for real use by real people.
# Chapter 8. Multiuser Authentication the Microservice Way
Now that our Notes application can save its data in a database, we can think about the next phase of making this a real application, namely authenticating our users. In this chapter, we'll discuss the following three aspects of this phase:
* Creating a microservice to store user profile/authentication data.
* User authentication with a locally stored password.
* Using OAuth2 to support authentication via third-party services. Specifically, we'll use Twitter as a third-party authentication service.
### Note
It seems so natural to log in to a website to use its services. We do it every day, and we even trust banking and investment organizations to secure our financial information through login procedures on a website. HTTP is a stateless protocol, and a web application cannot tell much about one HTTP request versus another. Because HTTP is stateless, HTTP requests do not natively know whether the user driving the web browser is logged in, the user's identity, or even whether the HTTP request was initiated by a human being.
The typical method for user authentication is to send a cookie to the browser containing a token to carry user identity. The cookie needs to contain data identifying the browser and whether that browser is logged in. The cookie will then be sent with every request, letting the application track which user account is associated with the browser.
With Express, the best way to do this is with the `express-session` middleware. It stores data as a cookie and looks for that data on every browser request. It is easy to configure, but is not a complete solution for user authentication. There are several add-on modules that handle user authentication, and some even support authenticating users against third-party websites such as Facebook or Twitter.
One package appears to be leading the pack in user authentication: **Passport** (<http://passportjs.org/>). It supports a long list of services against which to authenticate, making it easy to develop a website that lets users sign up with credentials from another website, for example, Twitter. Another, express-authentication (<https://www.npmjs.com/package/express-authentication>), bills itself as the opinionated alternative to Passport.
We will use Passport to authenticate users against both a locally stored user credentials database and using OAuth2 to authenticate against a Twitter account. We'll also take this as an opportunity to explore REST-based microservice implementation with Node.js. The idea is to simulate keeping user identity data in a secured server. When storing user credentials, it's important to use extra caution. You don't want your application to be associated with the latest massive leak of user data, do you?
Let's get started!
The first thing to do is duplicate the code used for the previous chapter. For example, if you kept that code in `chap07/notes`, create a new directory, `chap08/notes`.
# Creating a user information microservice
We could implement user authentication and accounts by simply adding a user model, and a few routes and views to the existing Notes application. While it would be easy to accomplish, is this what we would do in a real-world production application?
Consider the following considerations:
* It's important to keep user identity data under tight security
* The Notes application may be a small portion of a larger website; therefore, user authentication must be shared between multiple applications
* The microservice approach—dividing the application into small chunks, each deployed as separate services—is a popular architecture choice that increases software development flexibility
It's claimed that the microservice approach is easier to manage than when developing a monolithic large application. By dividing the total system into small services, each service can be developed by a small team, whose engineers can fully grow their service, with each able to proceed on his/her own time schedule independent of every other service in the overall system. Microservice implementations can even be completely replaced as long as the replacement service implements the same API.
Microservices are, of course, not a panacea, meaning we shouldn't try to force-fit every application into the microservice box. By analogy, microservices are like the Unix philosophy of small tools that do one thing well, that we mix/match/combine into larger tools. Another word for this is composability. While we can build a lot of useful software tools with that philosophy, does it work for applications such as Photoshop or LibreOffice? A key trade-off of the microservice architecture is that one loses the advantages gained by tight integration of components.
Which path you choose is up to you. While we'll develop the user authentication service as a microservice, it could easily be directly integrated into the Notes application.
While we can use Express to develop REST services, there is another framework that is specialized to developing REST services— **Restify** (<http://restify.com/>).
The server will require two modules: one using Restify to implement the REST interface and the other acting as a data model using Sequelize to store user data objects in a SQL database. To test the service, we'll write a couple of simple scripts for administering user information in the database. Then we'll set about modifying the Notes application to use this service to access user information, while using Passport to handle authentication.
The first step is creating a new directory to hold the User Information microservice. This should be a sibling directory to the Notes application. If you created a directory named `chap08/notes` to hold the Notes application, then create a directory named `chap08/users` to hold the microservice.
Then run the following commands:
**$ cd users**
**$ npm init**
**.. answer questions**
**.. name – user-auth-server**
**$ npm install debug@2.x --save**
**$ npm install js-yaml@3.x --save**
**$ npm install restify@4.x --save**
**$ npm install sequelize@3.x --save**
**$ npm install mysql@2.x sqlite3@3.x --save**
This gets us ready to start coding. We'll use the `debug` module for logging messages, `js-yaml` to read the Sequelize configuration file, `restify` for its REST framework, and `sequelize/mysql/sqlite3` for database access.
## User information model
We'll be storing the user information using a Sequelize-based model in an SQL database. As we go through this, ponder a question: should we integrate the database code directly into the REST API implementation? Doing so would reduce the user information microservice to one module. By separating the REST service from the data storage model, we have the freedom to adopt other data storage systems besides Sequelize/SQL.
Maybe you want to skip creating the microservice and instead integrate the user authentication service into Notes? The first step is to place the module we're about to write into the `users` directory.
Create a new file named `users-sequelize.js` in `users` containing:
'use strict';
const Sequelize = require("sequelize");
const jsyaml = require('js-yaml');
const fs = require('fs');
const util = require('util');
const log = require('debug')('users:model-users');
const error = require('debug')('users:error');
var SQUser;
var sequlz;
exports.connectDB = function() {
if (SQUser) return SQUser.sync();
return new Promise((resolve, reject) => {
fs.readFile(process.env.SEQUELIZE_CONNECT, 'utf8',
(err, data) => {
if (err) reject(err);
else resolve(data);
});
})
.then(yamltext => {
return jsyaml.safeLoad(yamltext, 'utf8');
})
.then(params => {
if (!sequlz) sequlz = new Sequelize(
params.dbname, params.username, params.password,
params.params);
if (!SQUser) SQUser = sequlz.define('User', {
username: { type: Sequelize.STRING, unique: true },
password: Sequelize.STRING,
provider: Sequelize.STRING,
familyName: Sequelize.STRING,
givenName: Sequelize.STRING,
middleName: Sequelize.STRING,
emails: Sequelize.STRING(2048),
photos: Sequelize.STRING(2048)
});
return SQUser.sync();
});
};
Like with our Sequelize-based model for Notes, we use a YAML file to store connection configuration. We're even using the same environment variable, `SEQUELIZE_CONNECT`.
One question at this point is: where do we store the data? By using Sequelize, we have our pick of SQL databases to choose from.
It's tempting to simplify the overall system by using the same database instance to store notes and user information, and to use Sequelize for both.
But we've chosen to simulate a secured server for user data. Theoretically, the ideal implementation at least has user data in a separate database. A highly secure application deployment might put the user information service on completely separate servers, perhaps in a physically isolated data center, with carefully configured firewalls, and there might even be armed guards at the door. We won't go quite that far, but at least we can simulate the conditions by maintaining a clean separation.
The user profile schema shown here is derived from the normalized profile provided by Passport; refer to <http://www.passportjs.org/docs/profile> for more information. Passport will harmonize information given by third-party services into a single object definition.
To simplify our code, we're simply using the schema defined by Passport.
As with the models used in the Notes application, we're using `Promise` objects and will return a `Promise` object to the REST interface module:
exports.create = function(username, password, provider, familyName, givenName, middleName, emails, photos) {
return exports.connectDB().then(SQUser => {
return SQUser.create({
username: username,
password: password,
provider: provider,
familyName: familyName,
givenName: givenName,
middleName: middleName,
emails: JSON.stringify(emails),
photos: JSON.stringify(photos)
});
});
};
exports.update = function(username, password, provider, familyName, givenName, middleName, emails, photos) {
return exports.find(username).then(user => {
return user ? user.updateAttributes({
password: password,
provider: provider,
familyName: familyName,
givenName: givenName,
middleName: middleName,
emails: JSON.stringify(emails),
photos: JSON.stringify(photos)
}) : undefined;
});
};
Our `create` and `update` functions take user information and either add a new record or update an existing record.
This treatment of the `emails` and `photos` fields is not quite correct. Both fields are provided by Passport as arrays. The correct modeling would be to add another two database tables: one for `emails` and the other for `photos`. Serializing these fields with JSON is a simplification:
exports.find = function(username) {
log('find '+ username);
return exports.connectDB().then(SQUser => {
return SQUser.find({ where: { username: username } });
})
.then(user => user ? exports.sanitizedUser(user) : undefined);
};
This lets us look up a user information record, and we return a sanitized version of that data.
### Note
Remember that Sequelize returns a `Promise` object, which is resolved, meaning that either the `.then` or `.catch` function is called when the data is retrieved. The `.then` function will receive a `SQUser` object containing the field data, or else `null` if no user was found.
Because we're segregating the user data from the rest of the Notes application, we want to return a sanitized object rather than the actual `SQUser` object. What if there was some information leakage because we simply sent the `SQUser` object back to the caller? The `sanitizedUser` function, shown later, creates an anonymous object with exactly the fields we want exposed to the other modules.
exports.destroy = function(username) {
return exports.connectDB().then(SQUser => {
return SQUser.find({ where: { username: username } })
})
.then(user => {
if (!user) throw new Error('Did not find requested '
+ username +' to delete');
user.destroy();
return;
});
};
This lets us support deleting user information. We do this as we did for the Notes Sequelize model, by first finding the user object then calling its `destroy` method.
exports.userPasswordCheck = function(username, password) {
return exports.connectDB().then(SQUser => {
return SQUser.find({ where: { username: username } })
})
.then(user => {
if (!user) {
return { check: false, username: username,
message: "Could not find user" };
} else if (user.username === username
&& user.password === password) {
return { check: true, username: user.username };
} else {
return { check: false, username: username,
message: "Incorrect password" };
}
});
};
And this lets us support checking user passwords.
The three conditions to handle are as follows:
* Whether there's no such user
* Whether the passwords matched
* Whether they did not match
The object we return lets the caller distinguish between those cases. The `check` field indicates whether to allow this user to be logged in. If `check` is false, there's some reason to deny their request to log in, and the `message` is what should be displayed to the user.
exports.findOrCreate = function(profile) {
return exports.find(profile.id).then(user => {
if (user) return user;
return exports.create(profile.id, profile.password,
profile.provider, profile.familyName,
profile.givenName, profile.middleName,
profile.emails, profile.photos);
});
};
This combines two actions in one function: first to verify if the named user exists and, if not, to create that user. Primarily, this will be used while authenticating against third-party services.
exports.listUsers = function() {
return exports.connectDB()
.then(SQUser => SQUser.findAll({}) )
.then(userlist => userlist.map(user =>
exports.sanitizedUser(user)))
.catch(err => console.error(err));
};
List the existing users. The first step is using `findAll` to give us the list of the users as an array of `SQUser` objects. Then we sanitize that list so we don't expose any data we don't want exposed:
exports.sanitizedUser = function(user) {
return {
id: user.username,
username: user.username,
provider: user.provider,
familyName: user.familyName,
givenName: user.givenName,
middleName: user.middleName,
emails: user.emails,
photos: user.photos
};
};
This is our utility function to ensure we expose a carefully controlled set of information to the caller. With this service, we're emulating a secured user information service that's walled off from other applications. Therefore, as we said earlier, this function returns an anonymous sanitized object where we know exactly what's in the object.
## A REST server for user information
We are building our way toward integrating user information and authentication into the Notes application. The next step is to wrap the user data model we just created into a REST server. After that, we'll create a couple of scripts so that we can add some users, perform other administrative tasks, and generally verify the service works. Finally, we'll extend the Notes application with login and logout support.
In the `package.json` file, change the `main` tag to the following line of code:
"main": "user-server.js",
And then create a file named `user-server.js` containing the following code:
'use strict';
const restify = require('restify');
const util = require('util');
const log = require('debug')('users:server');
const error = require('debug')('users:error');
const usersModel = require('./users-sequelize');
var server = restify.createServer({
name: "User-Auth-Service",
version: "0.0.1"
});
server.use(restify.authorizationParser());
server.use(check);
server.use(restify.queryParser());
server.use(restify.bodyParser({
mapParams: true
}));
This part initializes a Restify server application.
The `createServer` method can take a long list of configuration options. These two may be useful identifying information.
As with Express applications, the `server.use` calls initialize what Express would call middleware functions, but which Restify calls handler functions. These are callback functions whose API is `function (req, res, next)`. Like for Express, this is the request and response objects, and `next` is a function which, when called, proceeds execution to the next handler function.
Unlike Express, every handler function must call the `next` function. In order to tell Restify to stop processing through handlers, the `next` function must be called as `next(false)`. Calling `next` with an error object also causes execution to end, and the error is sent back to the requestor.
The handler functions listed here do two things: authorize requests and handle parsing parameters from both the URL and the `post` request body. The `authorizationParser` function looks for HTTP basic auth headers. The `check` function is shown later and emulates the idea of an API token to control access.
Refer to <http://restify.com/#bundled-plugins> for more information on the built-in handlers available in Restify.
// Create a user record
server.post('/create-user', (req, res, next) => {
usersModel.create(req.params.username, req.params.password,
req.params.provider, req.params.lastName,
req.params.givenName, req.params.middleName,
req.params.emails, req.params.photos)
.then(result => {
log('created '+ util.inspect(result));
res.send(result);
next(false);
})
.catch(err => { res.send(500, err); error(err.stack); next(false); });
});
As for Express, the `server.VERB` functions let us define the handlers for specific HTTP actions. This route handles a POST on `/create-user`, and as the name implies, this will create a user by calling the `usersModel.create` function.
As a `POST` request, the parameters arrive in the body of the request rather than as URL parameters. Because of the `mapParams` flag on the `bodyParams` handler, the arguments passed in the HTTP body are added to `req.params`.
We simply call `usersModel.create` with the parameters sent to us. When completed, the `result` object should be a user object, which we send back to the requestor using `res.send`.
// Update an existing user record
server.post('/update-user/:username', (req, res, next) => {
usersModel.update(req.params.username, req.params.password,
req.params.provider, req.params.lastName,
req.params.givenName, req.params.middleName,
req.params.emails, req.params.photos)
.then(foo => {
log('updated '+ util.inspect(result));
res.send(result);
next(false);
})
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
The `/update-user` route is handled in a similar way. However, we have put the `username` parameter on the URL. Like Express, Restify lets you put named parameters in the URL like this. Such named parameters are also added to `req.params`.
We simply call `usersModel.update` with the parameters sent to us. That, too, returns an object we send back to the caller with `res.send`.
// Find a user, if not found create one given profile information
server.post('/find-or-create', (req, res, next) => {
usersModel.findOrCreate({
id: req.params.username, username: req.params.username,
password: req.params.password,
provider: req.params.provider,
familyName: req.params.familyName,
givenName: req.params.givenName,
middleName: req.params.middleName,
emails: req.params.emails, photos: req.params.photos
})
.then(result => {
res.send(result);
next(false);
})
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
This handles our `findOrCreate` operation. We simply delegate this to the model code, as done previously.
As the name implies, we'll look to see if the named user already exists and, if so, simply return that user, otherwise it will be created.
// Find the user data (does not return password)
server.get('/find/:username', (req, res, next) => {
usersModel.find(req.params.username).then(user => {
if (!user) {
res.send(404, new Error("Did not find "
+ req.params.username));
} else {
res.send(user);
}
next(false);
})
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
Here we support looking up the user object for the provided `username`.
If the user was not found, then we return a 404 status code because it indicates a resource that does not exist. Otherwise, we send the object that was retrieved.
// Delete/destroy a user record
server.del('/destroy/:username', (req, res, next) => {
usersModel.destroy(req.params.username)
.then(() => { res.send({}); next(false); } )
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
This is how we delete a user from the Notes application. The `DEL HTTP` verb is meant to be used to delete things on a server, making it the natural choice for this functionality.
// Check password
server.post('/passwordCheck', (req, res, next) => {
usersModel.userPasswordCheck(req.params.username,
req.params.password)
.then(check => { res.send(check); next(false); })
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
This is another aspect of keeping the password solely within this server. The password check is performed by this server, rather than in the Notes application. We simply call the `usersModel.userPasswordCheck` function shown earlier and send back the object it returns.
// List users
server.get('/list', (req, res, next) => {
usersModel.listUsers().then(userlist => {
if (!userlist) userlist = [];
res.send(userlist);
next(false);
})
.catch(err => { res.send(500, err);
error(err.stack); next(false); });
});
Then, finally, in case we send a list of Notes application users back to the requestor. In case no list of users is available, we at least send an empty array.
server.listen(process.env.PORT, "localhost", function() {
log(server.name +' listening at '+ server.url);
});
// Mimic API Key authentication.
var apiKeys = [ {
user: 'them',
key: 'D4ED43C0-8BD6-4FE2-B358-7C0E230D11EF'
} ];
function check(req, res, next) {
if (req.authorization) {
var found = false;
for (let auth of apiKeys) {
if (auth.key === req.authorization.basic.password
&& auth.user === req.authorization.basic.username) {
found = true;
break;
}
}
if (found) next();
else {
res.send(401, new Error("Not authenticated"));
error('Failed authentication check '
+ util.inspect(req.authorization));
next(false);
}
} else {
res.send(500, new Error('No Authorization Key'));
error('NO AUTHORIZATION');
next(false);
}
}
As with the Notes application, we listen to the port named in the `PORT` environment variable. By explicitly listening only on `localhost`, we'll limit the scope of systems that can access the user authentication server. In a real deployment, we might have this server behind a firewall with a tight list of host systems allowed to have access.
This last function, `check`, implements authentication for the REST API itself. This is the handler function we added earlier.
It requires the caller to provide credentials on the HTTP request using the basic auth headers. The `authorizationParser` handler looks for this and gives it to us on the `req.authorization.basic` object. The `check` function simply verifies that the named user and password combination exists in the local array.
This is meant to mimic assigning an API key to an application. There are several ways of doing so; this is just one.
This approach is not limited to just authenticating using HTTP basic auth. The Restify API lets us look at any header in the HTTP request, meaning we could implement any kind of security mechanism we like. The `check` function could implement some other security method, with the right code.
Because we added `check` with the initial set of `server.use` handlers, it is called on every request. Therefore, every request to this server must provide the HTTP basic auth credentials required by this check.
This strategy is good if you want to control access to every single function in your API. For the user authentication service, that's probably a good idea. Some REST services in the world have some API functions that are open to the world and others protected by an API token. To implement that, the `check` function should not be configured among the `server.use` handlers. Instead it should be added to the appropriate route handlers like so:
server.get('/request/url', authHandler, (req, res, next) => {
..
});
Such an `authHandler` would be coded similarly to our `check` function. A failure to authenticate is indicated by sending an error code and using `next(false)` to end the routing function chain.
We now have the complete code for the user authentication server. It defines several request URLs, and for each, the corresponding function in the user model is called.
Now we need a YAML file to hold the database credentials, so create `sequelize-sqlite.yaml` containing the following code:
dbname: users
username:
password:
params:
dialect: sqlite
storage: users-sequelize.sqlite3
Since this is Sequelize, it's easy to switch to other database engines simply by supplying a different configuration file. Remember that the filename of this configuration file must appear in the `SEQUELIZE_CONNECT` environment variable.
And, finally, `package.json` should look like the following:
{
"name": "user-auth-server",
"version": "0.0.1",
"description": "",
"main": "user-server.js",
"scripts": {
"start": "DEBUG=users:* PORT=3333 SEQUELIZE_CONNECT=sequelize-sqlite.yaml node user-server"
},
"author": "",
"license": "ISC",
"dependencies": {
"debug": "^2.2.0",
"js-yaml": "^3.5.3",
"mysql": "^2.10.2",
"restify": "^4.0.4",
"sequelize": "^3.19.3",
"sqlite3": "^3.1.1"
}
}
We configure this server to listen on port `3333` using the database credentials we just gave and with debugging output for the server code.
You can now start the user authentication server:
**$ npm start**
**> user-auth-server@0.0.1 start /Users/david/chap08/users**
**> DEBUG=users:* PORT=3333 SEQUELIZE_CONNECT=sequelize-mysql.yaml node user-server**
**users:server User-Auth-Service listening at http://127.0.0.1:3333 +0ms**
But we don't have any way to interact with this server, yet.
## Scripts to test and administer the User Authentication server
To give ourselves assurance that the user authentication server works, we can write a couple of scripts to exercise the API. And, because we're not going to take the time to write a full administrative backend to the Notes application, these scripts will let us add and delete users who are allowed access to Notes.
These scripts will live within the user authentication server package directory, but will make calls using the REST API.
The Restify package supports coding not only in REST servers but also in REST clients. We'll use its client code in these scripts, and later when we integrate authentication into the Notes application.
Create a file named `users-add.js` containing the following code:
'use strict';
const util = require('util');
const restify = require('restify');
var client = restify.createJsonClient({
url: 'http://localhost:'+process.env.PORT,
version: '*'
});
client.basicAuth('them', 'D4ED43C0-8BD6-4FE2-B358-7C0E230D11EF');
client.post('/create-user', {
username: "me", password: "w0rd", provider: "local",
familyName: "Einarrsdottir", givenName: "Ashildr",
middleName: "", emails: [], photos: []
},
(err, req, res, obj) => {
if (err) console.error(err.stack);
else console.log('Created '+ util.inspect(obj));
});
This is the basic structure of a Restify client. We create the `Client` object—we have a choice between the `JsonClient`, as here, the `StringClient`, and the `HttpClient`. The HTTP basic auth credentials are easy to set, as shown here.
Then we make the request, in this case a `POST` request on `/create-user`. Because it is a `POST` request, the object we specify here is formatted by Restify into `HTTP POST` body parameters. As we saw earlier, the server has the `bodyParser` handler function configured, which converts those body parameters into the `req.param` object.
In the Restify client, as for the Restify server, we use the various HTTP methods by calling `client.METHOD`. Because it is a `POST` request, we use `client.post`.
When the request finishes, the callback function is invoked.
Before running these scripts, start the authentication server in one window using the following command:
**$ npm start**
Now run the test script using the following command:
**$ PORT=3333 node users-add.js**
**Created { id: 1,**
**username: 'me',**
**password: 'w0rd',**
**provider: 'local',**
**familyName: 'Einarrsdottir',**
**givenName: 'Ashildr',**
**middleName: '',**
**emails: '[]',**
**photos: '[]',**
**updatedAt: '2016-02-24T02:34:41.661Z',**
**createdAt: '2016-02-24T02:34:41.661Z' }**
And we can inspect our handiwork using the following command:
**$ sqlite3 users-sequelize.sqlite3**
**SQLite version 3.10.2 2016-01-20 15:27:19**
**Enter ".help" for usage hints.**
**sqlite > .schema users**
**CREATE TABLE `Users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `username` VARCHAR(255) UNIQUE, `password` VARCHAR(255), `provider` VARCHAR(255), `familyName` VARCHAR(255), `givenName` VARCHAR(255), `middleName` VARCHAR(255), `emails` VARCHAR(2048), `photos` VARCHAR(2048), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, UNIQUE (username));**
**sqlite > select * from users;**
**1|me|w0rd|local|Einarrsdottir|Ashildr||[]|[]|2016-02-24 02:34:41.661 +00:00|2016-02-24 02:34:41.661 +00:00**
**sqlite > ^D**
Now let's write a script, `users-find.js`, to look up a given user:
'use strict';
const util = require('util');
const restify = require('restify');
var client = restify.createJsonClient({
url: 'http://localhost:'+process.env.PORT,
version: '*'
});
client.basicAuth('them', 'D4ED43C0-8BD6-4FE2-B358-7C0E230D11EF');
client.get('/find/'+ process.argv[2],
(err, req, res, obj) => {
if (err) console.error(err.stack);
else console.log('Found '+ util.inspect(obj));
});
This simply calls the `/find` URL, specifying the `username` the user supplies as a command-line argument. Note that the `get` operation does not take an object full of parameters. Instead, any parameters would be added to the URL.
It's run as so:
**$ PORT=3333 node users-find.js me**
**Found { username: 'me',**
**provider: 'local',**
**familyName: 'Einarrsdottir',**
**givenName: 'Ashildr',**
**middleName: '',**
**emails: '[]',**
**photos: '[]' }**
Similarly, we can write scripts against the other REST functions. But we need to get on with the real goal of integrating this into the Notes application.
## Login support for the Notes application
Now that we have proved that the user authentication service is working, we can set up the Notes application to support user logins. We'll be using Passport to support login/logout, and the authentication server to store the required data.
### Accessing the user authentication REST API
The first step is to create a user data model for the Notes application. Rather than retrieving data from data files or a database, it will use REST to query the server we just created. We could have created user model code that directly accesses the database but, for reasons already discussed, we've decided to segregate user authentication into a separate service.
Let us now turn to the Notes application, which you may have stored as `chap08/notes`.
Because we're using Restify for its client library, install its package as so:
**$ npm install restify@4.x --save**
Create a new file, `models/users-rest.js`, containing the following code:
'use strict';
const restify = require('restify');
const log = require('debug')('notes:users-rest-client');
const error = require('debug')('notes:error');
var connectREST = function() {
return new Promise((resolve, reject) => {
try {
resolve(restify.createJsonClient({
url: process.env.USER_SERVICE_URL,
version: '*'
}));
} catch (err) {
reject(err);
}
})
.then(client => {
client.basicAuth('them',
'D4ED43C0-8BD6-4FE2-B358-7C0E230D11EF');
return client;
});
};
As we did for the Notes model code, we start with a `connectREST` function that sets up the REST client connection to the server. The `restify.createJsonClient` function gives us a `client` object that we're using to connect to the server. The `USER_SERVICE_URL` environment variable specifies the URL for our server. With the configuration we put in `users/package.json`, this URL would be `http://localhost:3333`.
The client is configured with HTTP basic auth credentials matching what we programmed into the server:
exports.create = function(username, password, provider, familyName, givenName, middleName, emails, photos) {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.post('/create-user', {
username, password, provider,
familyName, givenName, middleName, emails, photos
},
(err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
exports.update = function(username, password, provider, familyName, givenName, middleName, emails, photos) {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.post('/update-user/'+ username, {
password, provider,
familyName, givenName, middleName, emails, photos
},
(err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
These are our `create` and `update` functions. In each case, they take the data provided, construct an anonymous object, and `POST` it to the server.
### Note
These anonymous objects are a little different than usual. We're using a new ES-2015 feature here that we haven't discussed so far. Rather than specifying the object fields using the `fieldName: fieldValue` notation, ES-2015 gives us the option to shorten this when the variable name used for `fieldValue` matches the desired `fieldName`. In other words, we can just list the variable names, and the field name will automatically match the variable name.
In this case, we've purposely chosen variable names for the parameters to match field names of the object to match parameter names used by the server. By doing so, we can use this shortened notation for anonymous objects, and our code is a little cleaner by using consistent variable names from beginning to end.
exports.find = function(username) {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.get('/find/'+ username,
(err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
Our `find` operation lets us look up user information.
exports.userPasswordCheck = function(username, password) {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.post('/passwordCheck', {
username, password
},
(err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
And we're sending the request to check passwords to the server.
exports.findOrCreate = function(profile) {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.post('/find-or-create', {
username: profile.id,
password: profile.password,
provider: profile.provider,
familyName: profile.familyName,
givenName: profile.givenName,
middleName: profile.middleName,
emails: profile.emails, photos: profile.photos
},
(err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
Following is the `findOrCreate` function. The `profile` object will come from Passport, but notice carefully what we do with `profile.id`. The Passport documentation says it will provide the username in the `profile.id` field. But we want to store it as `username`, instead.
exports.listUsers = function() {
return connectREST().then(client => {
return new Promise((resolve, reject) => {
client.get('/list', (err, req, res, obj) => {
if (err) return reject(err);
resolve(obj);
});
});
});
};
And, finally, we can retrieve a list of users.
### Login and logout routing functions
What we've built so far is a user data model, with a REST API wrapping that model to create our authentication information service. Then, within the Notes application, we have a module that requests user data from this server. The next step is to create a routing module for login/logout URLs and to change the rest of Notes to use user data.
The routing module is where we use Passport to handle user authentication. The first task is to install the required modules:
**$ npm install passport@0.x passport-local@1.x --save**
The Passport module gives us the authentication algorithms. To support different authentication mechanisms, the Passport authors have developed several strategy implementations. The authentication mechanisms, or strategies, correspond to the various third-party services that support authentication, such as using OAuth2 to authenticate against services like Facebook, Twitter, or GitHub.
The `LocalStrategy` authenticates solely using data stored local to the application, for example, our user authentication information service.
Let's start by creating the routing module, `routes/users.js`:
'use strict';
const path = require('path');
const log = require('debug')('notes:router-users');
const error = require('debug')('notes:error');
const express = require('express');
const router = express.Router();
exports.router = router;
const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
**const usersModel = require(process.env.USERS_MODEL**
**? path.join('..', process.env.USERS_MODEL)**
**: '../models/users-rest');**
This brings in the modules we need for this router. This includes the two Passport modules and the REST-based user authentication model. We've coded this so that this can be overridden with an environment variable, if needed.
Notice that for the other router modules, we had the following line of code:
module.exports = router;
But for this router, the preceding line reads:
exports.router = router;
What's going on is we have a few functions to export from this module. Rather than having the `Router` object be the sole export, we make it one of several exports. In `app.js`, the following line will be there:
app.use('/users', users.router);
But we haven't gotten there yet, so let's not get ahead of ourselves.
exports.initPassport = function(app) {
app.use(passport.initialize());
app.use(passport.session());
};
exports.ensureAuthenticated = function(req, res, next) {
// req.user is set by Passport in the deserialize function
if (req.user) next();
else res.redirect('/users/login');
};
The `initPassport` function will be called from `app.js`, and it installs the Passport middleware into the Express configuration. We'll discuss the implications of this later when we get to `app.js` changes, but Passport uses sessions to detect whether this HTTP request is authenticated or not. It looks at every request coming into the application, looks for clues about whether this browser is logged in or not, and attaches data to the request object as `req.user`.
The `ensureAuthenticated` function will be used by other routing modules and inserted into any route definition that requires an authenticated logged-in user. For example, editing or deleting a Note requires the user to be logged in, and therefore the corresponding routes in `routes/notes.js` must use `ensureAuthenticated`. If the user is not logged in, this function redirects them to `/users/login` so that they can do so.
router.get('/login', function(req, res, next) {
// log(util.inspect(req));
res.render('login', {
title: "Login to Notes",
user: req.user,
});
});
router.post('/login',
passport.authenticate('local', {
successRedirect: '/', // SUCCESS: Go to home page
failureRedirect: 'login', // FAIL: Go to /user/login
})
);
Because this router is mounted on `/users`, all these routes will have `/user` prepended. The `/users/login` route simply shows a form requesting a _username_ and _password_. When this form is submitted, we land in the second route declaration, with a `POST` on `/users/login`. If Passport deems this a successful login attempt using `LocalStrategy`, then the browser is redirected to the home page. Otherwise it is redirected to the `/users/login` page.
router.get('/logout', function(req, res, next) {
req.logout();
res.redirect('/');
});
When the user requests to log out of Notes, they are to be sent to `/users/logout`. When we get to changes in the templates, we'll add a button for this purpose. The `req.logout` function instructs Passport to erase their login credentials, and they are then redirected to the home page.
passport.use(new LocalStrategy(
function(username, password, done) {
usersModel.userPasswordCheck(username, password)
.then(check => {
if (check.check) {
done(null, { id: check.username,
username: check.username });
} else {
done(null, false, check.message);
}
return check;
})
.catch(err => done(err));
}
));
Here is where we define our implementation of `LocalStrategy`. In the callback function, we call `usersModel.userPasswordCheck`, which makes a REST call to the user authentication service. Remember that this performs the password check and then returns an object indicating whether they're logged in or not.
A successful login is indicated when `check.check` is `true`. For this case, we tell Passport to use an object containing the `username` in the session object. Otherwise, we have two ways to tell Passport the login attempt was unsuccessful.
passport.serializeUser(function(user, done) {
done(null, user.username);
});
passport.deserializeUser(function(username, done) {
usersModel.find(username)
.then(user => done(null, user))
.catch(err => done(err));
});
The preceding functions take care of encoding and decoding authentication data for the session. All we need to attach to the session is the `username`, as we did in `serializeUser`. The `deserializeUser` object is called while processing an incoming HTTP requests and is where we look up the user profile data. Passport will attach this to the request object.
### Login/logout changes to app.js
We have a few changes required in `app.js`, some of which we've already touched on. We did carefully isolate the Passport module dependencies to `routes/users.js`. The changes required in `app.js` support the code in `routes/users.js`.
It's now time to uncomment a line we told you to comment out way back in Chapter 5, _Your First Express Application_ :
var users = require('./routes/users');
We need to use the routes we just implemented to support user login/logout:
const session = require('express-session');
const FileStore = require('session-file-store')(session);
Because Passport uses sessions, we need to enable session support in Express. These modules do so. The `session-file-store` module saves our session data to disk so that we can kill and restart the application without losing sessions. It's also possible to save sessions to databases with appropriate modules.
Use the following command to install the modules:
**$ npm install express-session@1.x session-file-store@0.x --save**
Express Session support, including all the various Session Store implementations, is documented on its GitHub project page at <https://github.com/expressjs/session>:
app.use(session({
store: new FileStore({ path: "sessions" }),
secret: 'keyboard mouse',resave: true,saveUninitialized: true
}));
users.initPassport(app);
Here we initialize the session support. The field named `secret` is used to sign the session ID cookie. The session cookie is an encoded string that is encrypted in part using this secret. In the Express Session documentation, they suggest the string `keyboard cat` for the secret. But, in theory, what if Express has a vulnerability such that knowing this secret can make it easier to break the session logic on your site? Hence, we chose a different string for the secret just to be a little different and perhaps a little more secure.
The `FileStore` will store its session data records in a directory named `sessions`. This directory will be autocreated as needed:
app.use('/', routes);
**app.use('/users', users.router);**
app.use('/notes', notes);
The preceding are the three routers used in the Notes application. As we saw previously, the user login/logout router is on `users.router`, whereas for the other router modules, the router is the solitary export.
### Login/logout changes in routes/index.js
This router module handles the home page. It does not require the user to be logged in, but we want to change the display a little if they are logged in:
router.get('/', function(req, res, next) {
notes.keylist()
.then(keylist => {
var keyPromises = keylist.map(key => {
return notes.read(key).then(note => {
return { key: note.key, title: note.title };
});
});
return Promise.all(keyPromises);
})
.then(notelist => {
res.render('index', {
title: 'Notes',
notelist: notelist,
**user: req.user ? req.user : undefined,**
breadcrumbs: [
{ href: '/', text: 'Home' }
]
});
})
.catch(err => { error(err); next(err); });
});
Remember that we ensured `req.user` has the user profile data, which we did in `deserializeUser`. We simply check for this and make sure to add that data when rendering the views template.
We'll be making similar changes to most of the other route definitions. After that, we'll go over the changes to the view templates in which we use `req.user` to show the correct buttons on each page.
### Login/logout changes required in routes/notes.js
The changes required here are more significant, but still straightforward:
const usersRouter = require('./users');
We need to use the `ensureAuthenticated` function to protect certain routes from being used by users who are not logged in. Since that function is in the user router module, we need to `require` it here:
router.get('/add', **usersRouter.ensureAuthenticated** , (req, res, next) => {
res.render('noteedit', {
title: "Add a Note",
docreate: true,
notekey: "",
note: undefined,
**user: req.user ? req.user : undefined,**
breadcrumbs: [
{ href: '/', text: 'Home' },
{ active: true, text: "Add Note" }
],
hideAddNote: true
});
});
The first thing we added is to call `usersRouter.ensureAuthenticated` in the route definition. If the user is not logged in, they'll redirect to `/users/login`, thanks to that function.
Because we've ensured the user is authenticated, we know that `req.user` will already have their profile information. We can then simply pass it to the view template.
For the other routes, we need to make similar changes:
router.post('/save', usersRouter.ensureAuthenticated, (req, res, next) => {
..
});
The `/save` route requires only this change to call `ensureAuthenticated` to make sure the user is logged in:
router.get('/view', (req, res, next) => {
..
.then(note => {
res.render('noteview', {
..
user: req.user ? req.user : undefined,
..
});
})
..
});
For this route, we don't require the user to be logged in. But we do need the user's profile information sent to the view template:
router.get('/edit', usersRouter.ensureAuthenticated, (req, res, next) => {
..
res.render('noteedit', {
..
user: req.user ? req.user : undefined,
..
});
..
});
router.get('/destroy', usersRouter.ensureAuthenticated, (req, res, next) => {
..
res.render('notedestroy', {
..
user: req.user ? req.user : undefined,
..
});
..
});
router.post('/destroy/confirm', usersRouter.ensureAuthenticated, (req, res, next) => {
..
});
For these routes, we require the user to be logged in. In most cases, we need to send the `req.user` value to the view template.
### View template changes supporting login/logout
We're almost ready, but we've got a number of outstanding changes to make in the templates. We're passing the `req.user` object to every template because each one must be changed to accommodate whether the user is logged in or not.
In `views/pageHeader.ejs`, make the following additions:
<header class="page-header">
<h1><%= title %></h1>
**< % if (user && typeof hideAddNote === 'undefined') { %>**
**< a class="btn btn-primary" href='/notes/add'>ADD Note</a>**
**< % } %>**
**< % if (user) { %>**
**< a class="btn btn-primary" href="/users/logout">**
**Log Out <span class="badge"><%= user.username %></span></a>**
**< % } else { %>**
**< a class="btn btn-primary" href="/users/login">Log in</a>**
**< % } %>**
<% if (typeof breadcrumbs !== 'undefined' && breadcrumbs) { %>
..
<% } %>
</header>
What we're doing here is controlling which buttons to display at the top of the screen depending on whether the user is logged in or not. What we've done with the earlier changes is ensure that the `user` variable will be `undefined` if the user is logged out, otherwise it will have the user profile object.
A logged-out user doesn't get the **Add Note** button, and gets a **Login** button. Otherwise, the user gets an **Add Note** button and a **Logout** button. The **Login** button takes the user to `/users/login`, while the **Logout** button takes them to `/users/logout`. Both of those are handled in `routes/users.js`, and perform the expected function.
The **Log Out** button has a Bootstrap badge component displaying the username. This adds a little visual splotch, in which we'll put the username that's logged in. As we'll see later, it will serve as a visual cue to the user what identity they have.
We need to create `views/login.ejs`:
<!DOCTYPE html>
<html>
<head><% include headerStuff %></head>
<body>
<div class="container-fluid">
<% include pageHeader %>
<div class="row"><div class="col-xs-12">
<form method='POST' action='/users/login'>
<div class="form-group">
<label for="username">User name:</label>
<input class="form-control" type='text' id='username'
name='username' value='' placeholder='User Name'/>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input class="form-control" type='password' id='password'
name='password' value='' placeholder='Password'/>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div></div>
<% include footer %>
</div>
</body>
</html>
This is a simple form decorated with Bootstrap goodness to ask for the username and password. When submitted, it creates a `POST` request to `/users/login`, which invokes the desired handler to verify the login request.
In `views/notedestroy.ejs`, we want to display a message if the user is not logged in. Normally, the form to cause the note to be deleted is displayed, but if the user is not logged in, we want to explain the situation:
..
<div class="row"><div class="col-xs-12">
**< % if (user) { %>**
<form method='POST' action='/notes/destroy/confirm'>
<input type='hidden' name='notekey' value='<%=
note ? notekey : "" %>'>
<p>Delete <%= note.title %> ?</p>
<br/>
<input type='submit' value='DELETE' /> <a class="btn btn-default" href="/notes/view?key=<%= notekey %>">Cancel</a>
</form>
**< % } else { %><% include not-logged-in %><% } %>**
</div></div>
..
That's straightforward; if the user is logged in, display the form, otherwise display this other thing, `not-logged-in.ejs`.
In `views/noteedit.ejs`, we need a similar change:
..
<div class="row"><div class="col-xs-12">
<% if (user) { %>
..
<% } else { %><% include not-logged-in %><% } %>
</div></div>
..
And then we need to create `views/not-logged-in.ejs`:
<div class="jumbotron">
<h1>Not Logged In</h1>
<p>You are required to be logged in for this action, but you are not. You should not see this message. It's a bug if this message appears. </p>
<p><a class="btn btn-primary" href="/users/login">Log in</a></p>
</div>
The **Bootstrap Jumbotron** component makes a nice and large text display that stands out nicely, and will catch the viewer's attention. However, the user should never see this because each of those templates is used only when we've preverified the user is logged in.
A message like this is useful as a check against bugs in your code. Suppose that we slipped up and failed to properly ensure that these forms were displayed only to logged-in users. Suppose that we had other bugs that didn't check the form submission to ensure it's requested only by a logged-in user. Fixing the template like this is another layer of prevention against displaying forms to users who are not allowed to use that functionality.
### Running the Notes application with user authentication
Now we're ready to run the Notes application and to try our hand at logging in and out.
We need to change the scripts section of `package.json` as so:
"scripts": {
"start": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 node ./bin/www",
"postinstall": "bower install",
"bootstrapsetup": "cd bower_components/bootstrap && npm install && npm install grunt-cli ",
"buildbootstrap": "cp variables.less bower_components/bootstrap/less && cd bower_components/bootstrap && grunt"
},
In the previous chapters, we built up quite a few combinations of models and databases for running the Notes application. This leaves us with one, configured to use the Sequelize model for Notes, using the **SQLite3** database, and to use the new user authentication service we wrote earlier. All the other Notes data models are still available just by setting the environment variables appropriately. The `USER_SERVICE_URL` needs to match the port number we designated for that service.
In one window, start the user authentication service as so:
**$ cd users**
**$ npm start**
**> user-auth-server@0.0.1 start /Users/david/chap08/users**
**> DEBUG=users:* PORT=3333 SEQUELIZE_CONNECT=sequelize-sqlite.yaml node user-server**
**users:server User-Auth-Service listening at http://127.0.0.1:3333 +0ms**
Then, in another window, start the Notes application:
**$ cd notes**
**$ DEBUG=notes:* npm start**
**> notes@0.0.0 start /Users/david/chap08/notes**
**> SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 node ./bin/www**
**notes:server Listening on port 3000 +0ms**
And you'll be greeted with the following:
Notice the new button, **Log in** , and the lack of an **Add Note** button.
Click on the **Log in** button, and you will see the login screen:
This is our login form from `views/login.ejs`. You can now log in, create a note or three, and you might end up with the following on the home page:
You now have both **Log Out** and **ADD Note** buttons.
You'll notice that the **Log Out** button has the username ( **me** ) shown. After some thought and consideration, this seemed the most compact way to show whether the user is logged in or not, and which user is logged in. This might drive the user experience team nuts, and you won't know if this user interface design works until its tested with users, but it's good enough for our purpose now.
The implementation of this is in `views/pageHeader.ejs`.
## Twitter login support for the Notes application
If you want your application to hit the big time, it's a great idea to allow users to register using third-party credentials. Websites all over the Internet allow you to log in using Facebook, Twitter, or accounts from other services. Doing so removes hurdles to prospective users signing up for your service. Passport makes it extremely easy to do this.
Supporting Twitter requires installing **TwitterStrategy** , registering a new application with Twitter, and adding a couple of routes into `routes/user.js` and a small change in `views/pageHeader.ejs`. Integrating other third-party services requires similar steps.
### Registering an application with Twitter
Twitter, as with every other third-party service, uses **OAuth2** to handle authentication and requires an authentication key to write software using their API. It's their service, so you have to play by their rules, of course.
To register a new application with Twitter, go to <https://apps.twitter.com/>.
The signup process asks for two URLs (website and callback URL) that may be problematic for the Notes application. The problem is that `http://localhost:3000` is not an acceptable URL to register with Twitter. But this is the URL we've used so far to use the Notes application. It seems that Twitter wants to see a proper domain name.
One option is, if you have a server available that has a domain name, to install Node.js on that server and then run the Notes application stack on that server. That is, if you have a web server hosting a domain, for instance, `example.com`, it may be possible to copy the Notes application to the command-line environment on that server and then run the Notes application on the server just as you've been doing on your laptop. You would access the application at `http://example.com:3000` and you can then tell Twitter to use that domain name.
Mac OS X users have another option because of the `.local` domain name which is automatically assigned to their laptop. All along, we could have used a URL similar to this to access the Notes application at `http://MacBook-Pro-2.local:3000/`. Fortunately, Twitter accepts that domain name in its application registration form. You can also enter an IP address such as `http://192.168.0.100:3000/`, which, of course, must match the IP address of your laptop:
For the website URL, use the domain name you've chosen.
For the callback URL, add `/users/auth/twitter/callback` to that URL, such as `http://MacBook-Pro-2.local:3000/users/auth/twitter/callback`.
### Implementing TwitterStrategy
Like with many web applications, we have decided to allow our users to log in using Twitter credentials. The OAuth2 protocol is widely used for this purpose and is the basis for authenticating on one website using credentials maintained by another website.
Within the Passport ecosystem are dozens of Strategy packages for various third-party services. Let's install the package required to use `TwitterStrategy`:
**$ npm install passport-twitter@1.x --save**
And in `routes/users.js`, let's start making some changes:
const TwitterStrategy = require('passport-twitter').Strategy;
To bring in the package we just installed, add the following:
passport.use(new TwitterStrategy({
consumerKey: ".. consumer key",
consumerSecret: ".. consumer secret",
callbackURL: ".. your callback URL"
},
function(token, tokenSecret, profile, done) {
usersModel.findOrCreate({
id: profile.username, username: profile.username, password: "", provider: profile.provider, familyName: profile.displayName, givenName: "", middleName: "", photos: profile.photos, emails: profile.emails
})
.then(user => done(null, user))
.catch(err => done(err));
}
));
This registers `TwitterStrategy` with Passport, arranging to call the user authentication service as users register with the Notes application. This callback function is called when users successfully authenticate using Twitter.
We defined the `usersModel.findOrCreate` function specifically to handle user registration from third-party services such as Twitter. Its task is to look for the user described in the profile object and, if that user does not exist, to autocreate that user account in Notes.
### Note
The `consumerKey` and `consumerSecret` values are supplied by Twitter. These are used in the OAuth2 protocol as proof of identity to Twitter.
It was found while debugging that the profile object supplied by the `TwitterStrategy` did not match the documentation on the Passport website. Therefore, we have mapped the object actually supplied by Passport into something Notes can use:
router.get('/auth/twitter', passport.authenticate('twitter'));
To start the user logging in with Twitter, we'll send them to this URL. Remember that this URL is really `/users/auth/twitter`. When this is called, the Passport middleware starts the user authentication and registration process using `TwitterStrategy`.
Once the user's browser visits this URL, the OAuth2 dance begins. Passport sends the browser over to the correct URL at Twitter, where Twitter asks the user if they agree to authenticate using Twitter, and then Twitter redirects the user back to your callback URL. Along the way, specific tokens are passed back and forth in a very carefully designed dance between websites.
Once the OAuth2 dance concludes, the browser lands here:
router.get('/auth/twitter/callback',
passport.authenticate('twitter', { successRedirect: '/',
failureRedirect: '/users/login' }));
This route handles the callback URL. Depending on whether it indicates a successful registration or not, Passport will redirect the browser to either the home page or back to the `/users/login` page.
In the process of handling the callback URL, Passport will invoke the callback function shown earlier. Because our callback uses the `usersModel.findOrCreate` function, the user will be automatically registered if necessary.
We're almost ready, but we need to make a couple of small changes elsewhere in Notes.
In `views/pageHeader.ejs`, make the following changes in the code:
<% if (user) { %>
<a class="btn btn-primary" href="/users/logout">
Log Out <span class="badge"><%= user.username %></span></a>
<% } else { %>
<a class="btn btn-primary" href="/users/login">Log in</a>
**< a class="btn btn-primary" href="/users/auth/twitter"><img width="15px" src="/images/twitter-brand-logos/TwitterLogo_white.png"/>Log in with Twitter</a>**
<% } %>
This adds a new button that, when clicked, takes the user to `/users/auth/twitter`, which, of course, kicks off the Twitter authentication process.
The image being used is from the official Twitter Brand Assets page at <https://about.twitter.com/company/brand-assets>. Twitter recommends using these branding assets for a consistent look across all services using Twitter.
With these changes, we're ready to try logging in with Twitter.
Start the Notes application server as done previously:
**$ npm start**
And then use a browser to visit `http://localhost:3000`:
Notice the new button. It looks about right, thanks to having used the official Twitter branding image. The button is a little large, so maybe you want to consult a designer. Obviously, a different design is required if you're going to support dozens of authentication services.
Clicking on this button takes the browser to `/users/auth/twitter`, which starts Passport running the OAuth2 protocol transactions necessary to authenticate.
When this is finished, the browser lands at `/users/auth/twitter/callback`, which we've configured to redirect the user to the Notes home page.
And then, once you're logged in with Twitter, you'll see something like the following screenshot:
We're now logged in, and notice that our Notes username is the same as our Twitter username. You can browse around the application and create, edit, or delete notes. In fact, you can do this to any note you like, even ones created by others.
That's because we did not create any sort of access control or permissions system, and therefore every user has complete access to every note.
By using multiple browsers or computers, you can simultaneously log in as different users, one user per browser.
You can run multiple instances of the Notes application by doing what we did earlier:
"scripts": {
"start": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 node ./bin/www",
"start-server1": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3000 node ./bin/www",
"start-server2": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3002 node ./bin/www",
"postinstall": "bower install",
"bootstrapsetup": "cd bower_components/bootstrap && npm install && npm install grunt-cli ",
"buildbootstrap": "cp variables.less bower_components/bootstrap/less && cd bower_components/bootstrap && grunt"
},
Then, in one command window, run the following command:
**$ npm run start-server1**
And in another command window, run the following command:
**$ npm run start-server2**
As previously, this starts two instances of the Notes server, each with a different value in the `PORT` environment variable. In this case, each instance will use the same user authentication service. As shown here, you'll be able to visit the two instances at `http://localhost:3000` and `http://localhost:3002`. And, as previously, you'll be able to start and stop the servers as you wish, see the same notes in each, and see that the notes are retained after restarting the server.
Another thing to try is to fiddle with the **session store**. Our session data is being stored in the `sessions` directory. These are just files in the filesystem, and we can take a look:
**$ ls -l sessions/**
**total 8**
**-rw-r--r-- 1 david staff 139 Feb 27 18:16 vMwgX8i9rs7QqWDeHCF7Ok63iKidwMhj.json**
**$ cat sessions/vMwgX8i9rs7QqWDeHCF7Ok63iKidwMhj.json**
**{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1456625814823,"passport":{"user":"7genblogger"}}**
This is after logging in using a Twitter account; you can see the Twitter account name is stored here in the session data.
What if you want to clear a session? It's just a file in the filesystem. Deleting the session file erases the session, and the user's browser will be forcefully logged out.
The session will time out if the user leaves their browser idle for long enough. One of the `session-file-store` options, `ttl`, controls the timeout period, which defaults to 3,600 seconds (1 hour). With a timed-out session, the application reverts to a logged-out state.
# The Notes application stack
Did you notice earlier when we said _run the Notes application stack_? It's time to ask the marketing team to explain what they meant by that phrase.
We've created enough of a system that a diagram might be helpful, in other words:
# Summary
You've covered a lot of ground in this chapter, looking at not only user authentication in Express applications but also microservice development.
Specifically, you covered session management in Express, using Passport for user authentication, including Twitter/OAuth2, using router middleware to limit access, creating a REST service with Restify, and when to create a microservice.
In the next chapter, we'll take the Notes application to a new level—semi-real-time communication between application users. To do this, we'll write some browser-side JavaScript and explore how the `Socket.io` package can let us send messages between users.
# Chapter 9. Dynamic Interaction between Client and Server with Socket.IO
The original design model of the Web is similar to the way that mainframes worked in the 1970s. Both old-school dumb terminals, such as the IBM 3270, and web browsers follow a request-response paradigm. The user sends a request and the far-off computer sends a response screen. While web browsers can show more complex information than old-school dumb terminals, the interaction pattern in both cases is a back and forth of user requests, each resulting in a _screen_ of data sent by the server screen after screen or, in the case of web browsers, page after page.
We are progressing rapidly. Web browsers with modern JavaScript engines can do so much more than the dumb terminals of yesteryear, or even the web browsers of just a couple years ago. One new technique is to keep a connection open with the server for continual data exchange between server and client, representing a change in the web application model; some call this the real-time web.
With JavaScript on both the server and client, we can now implement a dream that dates back to the days when Java applets tried to convince us that the browser could host interactive stuff on web pages. Modern JavaScript browser-side engines make it possible to build amazingly rich applications. In some cases, this means keeping the server connection open for exchanging data with the server. Having JavaScript on both the server and client means more facile and fluid data sharing between the frontend and backend of the application.
One observation we can make is that traditional web applications can untruthfully display their data; that is, if two people are looking at a page, such as a wiki page, and one person edits that page, that person's browser will update with the correct copy of the page, while the other browser will not updated. The two browsers show different versions of the page, one of which is untruthful. The second browser can even show a page that no longer exists if the user at the first browser deletes that page. Some think it would be better if the other person's browser is refreshed to show the new content as soon as the page is edited.
This is one possible role of the real-time web; pages that update themselves as the page content changes. We're about to implement this behavior in the Notes application.
The more common role of the real-time web is the way some of the social networking websites now dynamically update the page as other people make posts or comments, or when there is a pop-up activity notification for an activity within the social network. We're about to implement a tiny messaging system inside the Notes application as well.
Instead of a page-by-page interaction between the browser and the server, the real-time web maintains a continual stream of data going between the two, with application code living in the browser, to implement the browser-side behavior.
One of the original purposes for inventing Node.js was to support real-time web implementation. The **Comet** application architecture (Comet is related to AJAX, and both happen to be names of household cleaning products) involves holding the HTTP connection open for a long time with data flowing back and forth between browser and server over that channel. The term Comet was introduced by Alex Russell on his blog in 2006 (<http://infrequently.org/2006/03/comet-low-latency-data-for-the-browser/>) as a general term for the architectural pattern to implement this real-time two-way data exchange between the client and server. That blog post called for development of a programming platform very similar to Node.js.
To explore this, we will add some real-time web functionality to the Notes application.
To simplify the task, we'll lean on the **Socket.IO** library (<http://socket.io/>). This library simplifies two-way communication between the browser and server, and can support a variety of protocols with fallback to old-school web browsers.
A common companion to Socket.IO is Backbone.js, because it supports data models, allowing the programmer to exchange high-level data over Socket.IO connections. Because the data in the Notes application is so simple, we won't use Backbone. However, it is worth exploring (<http://backbonejs.org/>).
# Introducing Socket.IO
The aim of Socket.IO is:
> _To make real time apps possible in every browser and mobile device._
It supports several transport protocols, choosing the best one for the specific browser.
If you were to implement your application with WebSocket, it would be limited to the modern browsers supporting that protocol. Because Socket.IO falls back on so many alternate protocols (WebSockets, Flash, XHR, and JSONP), it supports a wide range of web browsers, including some old crufty browsers. Older Socket.IO versions claimed to support back to Internet Explore 5.5, but that claim is no longer printed on their website.
As the application author, you don't have to worry about the specific protocol Socket.IO uses in a given browser. Instead, you can implement the business logic and the library takes care of the details for you.
Socket.IO requires that a client library make its way into the browser. That library is provided, and it is easy to instantiate. You'll be writing code on both the browser side and server side using similar Socket.IO API's at each end.
The model that Socket.IO provides is similar to the `EventEmitter` object. The programmer uses the `.on` method to listen for events and the `.emit` method to send them. The emitted events are sent between the browser and the server with the Socket.IO library taking care of sending them back and forth.
# Initializing Socket.IO with Express
Socket.IO works by wrapping itself around an HTTP Server object. Think back to Chapter 4, _HTTP Servers and Clients – A Web Applications First Steps_ , where we wrote a module which hooked into HTTP Server methods so that we could spy on HTTP transactions. The HTTP Sniffer attaches a listener to every HTTP event to print out the events. But what if you used that idea to do real work? Socket.IO uses a similar concept, listening to HTTP requests and responding to specific ones by using the Socket.IO protocol to communicate with client code in the browser.
To get started, let's first make a duplicate of the code from the previous chapter. If you created a directory named `chap08` for that code, create a new directory named `chap09` and copy the source tree there.
We won't make changes to the user authentication microservice, but we will use it for user authentication, of course.
In the Notes source directory, install these new modules:
**$ npm install socket.io@1.x passport.socketio@3.x --save**
We will incorporate user authentication with the Passport module, used in Chapter 8, _Multiuser Authentication the Microservice Way_ , into some of the real time interactions we'll implement.
To initialize Socket.IO, we must do some major surgery on how the Notes application is started. So far, we used the `bin/www` script along with `app.js`, with each script hosting different steps of launching Notes. Socket.IO initialization requires that these steps occur in a different order than what we've been doing, and that we must merge these two scripts into one. What we'll do is copy the contents of the `bin/www` script into appropriate parts of `app.js`, and from there, we'll use `app.js` to launch Notes.
At the beginning of `app.js`, insert this:
#!/usr/bin/env node
Add this to the `require` statements:
const passportSocketIo = require("passport.socketio");
const http = require('http');
const log = require('debug')('notes:server');
const error = require('debug')('notes:error');
The last three lines are copied from `bin/www`. The `passport.socketio` module integrates Socket.IO with PassportJS-based user authentication. We'll configure this support shortly.
const sessionCookie = 'notes.sid';
const sessionSecret = 'keyboard mouse';
const sessionStore = new FileStore({ path: "sessions" });
The configuration for session management is now shared between Socket.IO, Express, and Passport. These lines centralize that configuration to one place in `app.js`, so we can change it once to affect every place it's needed.
Use this to initialize the HTTP Server object:
var app = express();
var server = http.createServer(app);
var io = require('socket.io')(server);
io.use(passportSocketIo.authorize({
cookieParser: cookieParser,
key: sessionCookie,
secret: sessionSecret,
store: sessionStore
}));
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
The `io` object is our entry point into the Socket.IO API. We need to pass this object to any code that needs to use that API. It won't be enough to simply require the `socket.io` module in other modules because the `io` object is what wraps the `server` object.
The `io.use` function installs in Socket.IO functions similar to Express middleware. In this case, we integrate Passport authentication into Socket.IO:
app.use(session({
store: sessionStore,
secret: sessionSecret,
key: sessionCookie,
resave: true,
saveUninitialized: true
}));
This changes the configuration of Express session support to match the configuration variables we set up earlier.
Use this to initialize Socket.IO code in the router modules:
app.use('/', routes);
app.use('/users', users.router);
app.use('/notes', notes);
routes.socketio(io);
// notes.socketio(io);
We haven't written these functions yet. This injects the object into the `routes/index.js` and `routes/notes.js` modules. The call to `notes.socketio` is commented out so that we can get to it later.
Then, at the end of `app.js`, we'll copy in the code so the HTTP Server starts listening on our selected port:
module.exports = app;
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
log('Listening on ' + bind);
}
Then, in `package.json`, we must start `app.js `rather than `bin/www`:
"scripts": {
"start": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 node ./app",
"start-server1": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3000 node ./app",
"start-server2": "SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3002 node ./app",
...
},
At this point, you can delete `bin/www` if you like. You can also try starting the server, but it'll fail because the `routes.socketio` function does not exist yet.
# Real time updates on the Notes home page
The first thing we'll do with Socket.IO is change the Notes home page to automatically update the list of notes as notes are edited or deleted. It means a little bit of work in `routes/index.js` and `views/index.ejs`, and a lot of work in the Notes model.
Where the Notes model so far has been a passive repository of documents, it now needs to emit events to any interested parties. This is the listener pattern, and, in theory, there will be code that is interested in knowing when notes are created, edited, or destroyed. At the moment, we'll use that knowledge to update the Notes home page, but there are many potential other uses of that knowledge.
## The Notes model as an EventEmitter class
The `EventEmitter` is the class that implements listener support. Let's create a new module, `models/notes-events.js`, containing the following:
'use strict';
const EventEmitter = require('events');
class NotesEmitter extends EventEmitter {}
module.exports = new NotesEmitter();
module.exports.noteCreated = function(note) {
module.exports.emit('notecreated', note);
};
module.exports.noteUpdate = function(note) {
module.exports.emit('noteupdate', note);
};
module.exports.noteDestroy = function(data) {
module.exports.emit('notedestroy', data);
};
This module maintains for us the listeners to notes-related events. Because we have multiple Notes models, it is useful to handle listener maintenance in a common module.
This module exports an `EventEmitter` object, meaning that the module exports two functions: `.on` and `.emit`. We then add additional methods to emit specific events related to the notes life cycle.
Let's now update `models/notes-sequelize.js` to use `notes-events` to emit events. Similar changes can be made in the other Notes models. Add the following code to it:
exports.events = require('./notes-events');
This technique adds the content of one module to the exports of another module. Not every export from a module needs to be implemented by that module. A Node.js module is simply an object, `module.exports`, that is returned by the `require` statement. The contents of that module object can come from a variety of sources. In this case, the `events` export will come from the `notes-events` module.
In the `create` function, add the following:
exports.create = function(key, title, body) {
return exports.connectDB()
.then(SQNote => {
return SQNote.create({
notekey: key,
title: title,
body: body
});
})
**.then(newnote = > {**
**exports.events.noteCreated({**
**key: newnote.key,**
**title: newnote.title,**
**body: newnote.body**
**});**
**return newnote;**
**});**
};
This is the pre-existing `create` function but with a second step to emit the `notecreated` event. We'll make similar changes throughout this module, adding an additional step to emit events.
Remember that the `exports.events` object came from `require('./notes-events')`. That object exported a set of functions, one of which is `noteCreated`. This is how we'll use that module.
In this case, we add a clause to the promise to emit an event for every note that is created. The Promise still returns the `SQNote` object that was created. We simply add this side effect of emitting an event.
Then, make a similar change for updating a note:
exports.update = function(key, title, body) {
return exports.connectDB()
.then(SQNote => {
return SQNote.find({ where: { notekey: key } })
})
.then(note => {
if (!note) {
throw new Error("No note found for key " + key);
} else {
return note.updateAttributes({
title: title,
body: body
});
}
})
**.then(newnote = > {**
**exports.events.noteUpdate({**
**key,**
**title: newnote.title,**
**body: newnote.body**
**});**
**return newnote;**
**});**
};
Here, we send a notification that a note was edited.
Finally, the `destroy` method:
exports.destroy = function(key) {
return exports.connectDB()
.then(SQNote => {
return SQNote.find({ where: { notekey: key } })
})
.then(note => note.destroy())
**.then(() = > exports.events.noteDestroy({ key }));**
};
This sends a notification that a note was destroyed.
We only changed the `notes-sequelize.js` module. The other notes models will require similar changes should you want to use one of them to store notes.
## Real-time changes in the Notes home page
The changes in the Notes model are only the first step. Making the events visible to our users means the controller and view portions of the application must consume those events.
Let's start making changes to `routes/index.js`:
router.get('/', function(req, res, next) {
**getKeyTitlesList()**.then(notelist => {
var user = req.user ? req.user : undefined;
res.render('index', {
title: 'Notes',
notelist: notelist,
user: user,
breadcrumbs: [{ href: '/', text: 'Home' }]
});
})
.catch(err => { error('home page '+ err); next(err); });
});
We need to reuse part of the code that had been in this router function. Let's now add this function:
module.exports = router;
var getKeyTitlesList = function() {
return notes.keylist()
.then(keylist => {
var keyPromises = keylist.map(key => {
return notes.read(key).then(note => {
return { key: note.key, title: note.title };
});
});
return Promise.all(keyPromises);
});
};
This is the same as earlier, just in its own function. It generates an array of items containing the `key` and `title` for all existing notes:
module.exports.socketio = function(io) {
var emitNoteTitles = () => {
getKeyTitlesList().then(notelist => {
io.of('/home').emit('notetitles', { notelist });
});
};
notes.events.on('notecreated', emitNoteTitles);
notes.events.on('noteupdate', emitNoteTitles);
notes.events.on('notedestroy', emitNoteTitles);
};
This is where `app.js` injects the `io` object into the home page routing module.
Now, we get to some actual Socket.IO code. Remember that this function is called from `app.js`, and it is given the `io` object we created there.
### Note
The `io.of` method defines what Socket.IO calls a **namespace**. Namespaces limit the scope of messages sent through Socket.IO. The default namespace is `/`, and namespaces look like pathnames; in that, they're a series of slash-separated names. An event emitted into a namespace is delivered to any socket listening to that namespace.
The code in this case is fairly straightforward. It listens to the events we just implemented, `notecreated`, `noteupdate`, and `notedestroy`. For each of these events, it emits an event, `notetitles`, containing the list of note keys and titles.
That's it!
As notes are created, updated, and destroyed, we ensure that the home page will be refreshed to match. The home page template, `views/index.ejs`, will require code to receive that event and rewrite the page to match.
### Changing the home page template
Socket.IO runs on both client and server, with the two communicating back and forth over the HTTP connection. This requires loading the client JavaScript library into the client browser. Each page of the Notes application in which we seek to implement Socket.IO services must load the client library and have custom client code for our application.
In `views/index.ejs`, add the following code:
<% include footer %>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready(function () {
var socket = io('/home');
socket.on('notetitles', function(data) {
var notelist = data.notelist;
$('#notetitles').empty();
for (var i = 0; i < notelist.length; i++) {
notedata = notelist[i];
$('#notetitles')
.append('<a class="btn btn-lg btn-block btn-default" href="/notes/view?key='+
notedata.key +'">'+ notedata.title +'</a>');
}
});
});
</script>
The first line is where we load the Socket.IO client library. You'll notice that we never set up any Express route to handle the `/socket.io` URL. Instead, the Socket.IO library did that for us.
Because we've already loaded jQuery (to support Bootstrap), we can easily ensure that this code is executed once the page is fully loaded using `$(document).ready`.
This code first connects a `socket` object to the `/home` namespace. That namespace is being used for events related to the Notes homepage. We then listen for the `notetitles` events, for which some jQuery DOM manipulation erases the current list of notes and renders a new list on the screen.
That's it. Our code in `routes/index.js` listened to various events from the Notes model, and, in response, sent a `notetitles` event to the browser. The browser code takes that list of note information and redraws the screen.
### Running Notes with real-time home page updates
We now have enough implemented to run the application and see some real-time action.
As you did earlier, start the user information microservice in one window:
**$ cd chap09/users**
**$ npm start**
**> user-auth-server@0.0.1 start /Users/david/chap08/users**
**> DEBUG=users:* PORT=3333 SEQUELIZE_CONNECT=sequelize-sqlite.yaml node user-server**
**users:server User-Auth-Service listening at http://127.0.0.1:3333 +0ms**
Then, in another window, start the Notes application:
**$ cd chap09/notes**
**$ npm start**
**> notes@0.0.0 start /Users/david/chap09/notes**
**> SEQUELIZE_CONNECT=models/sequelize-sqlite.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 node ./app**
**notes:server Listening on port 3000 +0ms**
Then, in a browser window, go to `http://localhost:3000` and log in to the Notes application. To see the real-time effects, open multiple browser windows. If you can use Notes from multiple computers, then do that as well.
In one browser window, start creating and deleting notes, while leaving the other browser windows viewing the home page. Create a note, and it should show up immediately on the home page in the other browser windows. Delete a note and it should disappear immediately as well.
## Real-time action while viewing notes
It's cool how we can now see real-time changes in a part of the Notes application. Let's turn to the `/notes/view` page to see what we can do. What comes to mind is this functionality:
* Update the note if someone else edits it
* Redirect the viewer to the homepage if someone else deletes the note
* Allow users to leave comments on the note
For the first two features, we can rely on the existing events coming from the Notes model. The third feature will require a messaging subsystem, so we'll get to that later in this chapter.
In `routes/notes.js`, add this to the end of the module:
module.exports.socketio = function(io) {
var nspView = io.of('/view');
var forNoteViewClients = function(cb) {
nspView.clients((err, clients) => {
clients.forEach(id => {
cb(nspView.connected[id]);
});
});
};
notes.events.on('noteupdate', newnote => {
forNoteViewClients(socket => {
socket.emit('noteupdate', newnote);
});
});
notes.events.on('notedestroy', data => {
forNoteViewClients(socket => {
socket.emit('notedestroy', data);
});
});
};
Now is the time to uncomment that line of code in `app.js` because we've now implemented the function we said we'd get to later.
routes.socketio(io);
notes.socketio(io);
First, we will connect to the `/view` namespace. This means any browser viewing any note in the application will connect to this namespace. Every such browser will receive events about any note being changed, even those notes that are not being viewed. This means that the client code will have to check the key, and only take action if the event refers to the note being displayed.
What we're doing is listening to the `noteupdate` and `notedestroy` messages from the Notes model and sending them to the `/view` Socket.IO namespace. However, the code shown here doesn't use the method documented on the Socket.IO website.
We should be able to write the code as follows:
notes.events.on('noteupdate', newnote => {
io.of('/view').emit('noteupdate', newnote);
});
However, with this, there were difficulties initializing communications that meant reloading the page twice.
With this code, we dig into the data that each namespace uses to track the connected clients. We simply loop through those clients and invoke a callback function on each. In this case, the callback emits the message we need to be sent to the browser.
### Changing the note view template for real-time action
As we did earlier, to make these events visible to the user, we must add client code to the template; in this case, `views/noteview.ejs`:
<div class="row"><div class="col-xs-12">
<h3 id="notetitle"><%= note ? note.title : "" %></h3>
<p id="notebody"><%= note ? note.body : "" %></p>
<p>Key: <span id="notekey"><%= notekey %></span></p>
</div></div>
<% if (notekey && user) { %>
<div class="row">
<div class="btn-group col-sm-12">
<a class="btn btn-default" href="/notes/destroy?key=<%= notekey %>" role="button">Delete</a>
<a class="btn btn-default" href="/notes/edit?key=<%= notekey %>" role="button">Edit</a>
</div>
</div>
<% } %>
<% include footer %>
<% if (notekey) { %>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready(function () {
io('/view').on('noteupdate', function(note) {
if (note.key === "<%= notekey %>") {
$('h3#notetitle').empty();
$('h3#notetitle').text(note.title);
$('p#notebody').empty();
$('p#notebody').text(note.body);
}
});
io('/view').on('notedestroy', function(data) {
if (data.key === "<%= notekey %>") {
window.location.href = "/";
}
});
});
</script>
<% } %>
We connect to the namespace where the messages are sent. As `noteupdate` or `notedestroy` messages arrive, we check the key to see whether it matches the key for the note being displayed. There is a technique used here that's important to understand; it mixes JavaScript executed on the server with JavaScript executed in the browser.
For example, remember that the code within the `<% .. %>` or `<%= .. %>` delimiters is interpreted by the EJS template engine on the server. Consider the following:
if (note.key === "<%= notekey %>") {
..
}
This comparison is between the `notekey` value in the browser, which arrived inside the message from the server, against the `notekey` variable on the server. That variable contains the key of the note being displayed. Therefore, in this case, we are able to ensure these code snippets are executed only for the note being shown on the screen.
For the `noteupdate` event, we take the new note content and display it on the screen. For this to work, we had to add `id=` attributes to the HTML so we could use jQuery selectors in manipulating the DOM.
For the `notedestroy` event, we simply redirect the browser window back to the home page. The note being viewed has been deleted, and there's no point for the user to continue looking at a note which no longer exists.
### Running Notes with real-time updates while viewing a note
At this point, you can now rerun the Notes application and try this out.
Launch the user authentication server and the Notes application as before. Then, in the browser, open multiple windows on the Notes application. This time, have one viewing the home page, and two viewing a note. In one of those windows, edit the note to make a change, and see the text change on both the homepage and note viewing page.
Then delete the note, and watch it disappear from the homepage, and the browser window which had viewed the note is now on the homepage.
# Inter-user chat and commenting for Notes
This is cool, we now have real-time updates in Notes as we edit or delete or create notes. Let's now take it to the next level and implement something akin to inter-user chatting.
It's possible to pivot our Notes application concept and take it in the direction of a social network. In most such networks, users post thing (notes, pictures, videos, and so on), and other users comment on those things. Done well, these basic elements can develop a large community of people sharing notes with each other. While the Notes application is kind of a toy, it's not too terribly far from being a basic social network. Commenting the way we will do now is a tiny step in that direction.
On each note page, we'll have an area to display messages from Notes users. Each message will show the user name, a time stamp, and their message. We'll also need a method for users to post a message, and we'll also allow users to delete messages.
Each of those operations will be performed without refreshing the screen. Instead, code running inside the web page will send commands to/from the server and take actions dynamically.
Let's get started.
## Data model for storing messages
We need to start by implementing a data model for storing messages. The basic fields required are a unique ID, the username of the person sending the message, the namespace the message is sent to, their message, and finally a timestamp for when the message was sent. As messages are received or deleted, events must be emitted from the model so we can do the right thing on the webpage.
This model implementation will be written for Sequelize. If you prefer a different storage solution, you can re-implement the same API on other data storage systems by all means.
Create a new file, `models/messages-sequelize.js`, containing the following:
'use strict';
const Sequelize = require("sequelize");
const jsyaml = require('js-yaml');
const fs = require('fs');
const util = require('util');
const EventEmitter = require('events');
class MessagesEmitter extends EventEmitter {}
const log = require('debug')('messages:model-messages');
const error = require('debug')('messages:error');
var SQMessage;
var sequlz;
module.exports = new MessagesEmitter();
This sets up the modules being used and also initializes the `EventEmitter` interface. The module itself will be an `EventEmitter` interface because the object is assigned to `module.exports`.
var connectDB = function() {
if (SQMessage) return SQMessage.sync();
return new Promise((resolve, reject) => {
fs.readFile(process.env.SEQUELIZE_CONNECT, 'utf8',
(err, data) => {
if (err) reject(err);
else resolve(data);
});
})
.then(yamltext => jsyaml.safeLoad(yamltext, 'utf8'))
.then(params => {
if (!sequlz) sequlz = new Sequelize(params.dbname, params.username, params.password, params.params);
if (!SQMessage) SQMessage = sequlz.define('Message', {
id: { type: Sequelize.INTEGER, autoIncrement: true,
primaryKey: true },
from: Sequelize.STRING,
namespace: Sequelize.STRING,
message: Sequelize.STRING(1024),
timestamp: Sequelize.DATE
});
return SQMessage.sync();
});
};
This defines our message schema in the database. We'll use the same database that we used for Notes, but the messages will be stored in their own table.
The `id` field won't be supplied by the caller; instead, it will be autogenerated. Because it is an `autoIncrement` field, each message that's added will be assigned a new `id` number by the database:
module.exports.postMessage = function(from, namespace, message) {
return connectDB()
.then(SQMessage => SQMessage.create({
from, namespace, message, timestamp: new Date()
}))
.then(newmsg => {
var toEmit = {
id: newmsg.id,
from: newmsg.from,
namespace: newmsg.namespace,
message: newmsg.message,
timestamp: newmsg.timestamp
};
module.exports.emit('newmessage', toEmit);
});
};
This is to be called when a user posts a new comment/message. We first store it in the database, and then we emit an event saying the message was created:
module.exports.destroyMessage = function(id, namespace) {
return connectDB()
.then(SQMessage => SQMessage.find({ where: { id } }))
.then(msg => msg.destroy())
.then(result => {
module.exports.emit('destroymessage', { id, namespace });
});
};
This is to be called when a user requests that a message should be deleted. With Sequelize, we must first find the message and then delete it by calling its `destroy` method. Once that's done, we emit a message saying the message was destroyed:
module.exports.recentMessages = function(namespace) {
return connectDB().then(SQMessage => {
return SQMessage.findAll({
where: { namespace },
order: 'timestamp DESC',
limit: 20
});
})
.then(messages => {
return messages.map(message => {
return {
id: message.id,
from: message.from,
namespace: message.namespace,
message: message.message,
timestamp: message.timestamp
};
});
});
};
While this is meant to be called when viewing a note, it is generalized to work for any Socket.IO namespace. It finds the most recent 20 messages associated with the given namespace and returns a cleaned up list to the caller.
## Adding messages to the Notes router
Now that we can store messages in the database, let's integrate this into the Notes router module.
In `routes/notes.js`, add this to the require statements:
const messagesModel = require('../models/messages-sequelize');
If you wish to implement a different data storage model for messages, you'll need to change this `require` statement. One should consider using an environment variable to specify the module name, as we've done elsewhere:
// Save incoming message to message pool, then broadcast it
router.post('/make-comment', usersRouter.ensureAuthenticated,
(req, res, next) => {
messagesModel.postMessage(req.body.from,
req.body.namespace, req.body.message)
.then(results => { res.status(200).json({ }); })
.catch(err => { res.status(500).end(err.stack); });
});
// Delete the indicated message
router.post('/del-message', usersRouter.ensureAuthenticated,
(req, res, next) => {
messagesModel.destroyMessage(req.body.id, req.body.namespace)
.then(results => { res.status(200).json({ }); })
.catch(err => { res.status(500).end(err.stack); });
});
This pair of routes, `/notes/make-comment` and `/notes/del-message`, is used to post a new comment or delete an existing one. Each calls the corresponding data model function and then sends an appropriate response back to the caller.
Remember that `postMessage` stores a message in the database, and then it turns around and emits that message to other browsers. Likewise, `destroyMessage` deletes the message from the database, then emits a message to other browsers saying that the message has been deleted. Finally, the results from `recentMessages` will reflect the current set of messages in the database.
Both of these will be called by AJAX code in the browser.
module.exports.socketio = function(io) {
var nspView = io.of('/note/view');
nspView.on('connection', function(socket) {
// 'cb' is a function sent from the browser, to which we
// send the messages for the named note.
socket.on('getnotemessages', (namespace, cb) => {
messagesModel.recentMessages(namespace)
.then(cb)
.catch(err => console.error(err.stack));
});
});
..
messagesModel.on('newmessage', newmsg => {
forNoteViewClients(socket => {
socket.emit('newmessage', newmsg);
});
});
messagesModel.on('destroymessage', data => {
forNoteViewClients(socket => {
socket.emit('destroymessage', data);
});
});
..
};
This is the Socket.IO glue code, which we will add to the code we looked at earlier.
The `getnotemessages` message from the browser requests the list of messages for the given note. This calls the `recentMessages` function in the model. This uses a feature of Socket.IO where the client can pass a callback function, and server-side Socket.IO code can invoke that callback giving it some data.
We also listen to the `newmessage` and `destroymessage` messages emitted by the messages model, sending corresponding messages to the browser. These are sent using the method described earlier.
## Changing the note view template for messages
We need to dive back into `views/noteview.ejs` with more changes so that we can view, create, and delete messages. This time we will add a lot of code, including using a **Bootstrap Modal** popup to get the message, several AJAX calls to communicate with the server, and of course, more Socket.IO stuff.
### Using a Modal window to compose messages
The Bootstrap framework has a Modal component that serves a similar purpose to Modal dialogs in desktop applications. You pop up the Modal, it prevents interaction with other parts of the webpage, you enter stuff into fields in the Modal, and then click a button to make it close.
This new segment of code replaces the existing segment defining the **Edit** and **Delete** buttons:
<% if (notekey && user) { %>
<div class="row">
<div class="btn-group col-sm-12">
<a class="btn btn-default" href="/notes/destroy?key=<%= notekey %>" role="button">Delete</a>
<a class="btn btn-default" href="/notes/edit?key=<%= notekey %>" role="button">Edit</a>
<button type="button" class="btn btn-default"
data-toggle="modal"
data-target=".notes-comment-modal">Comment</button>
</div>
</div>
<div class="modal fade notes-comment-modal" tabindex="-1" role="dialog" aria-labelledby="noteCommentModalLabel">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="noteCommentModalLabel">Leave a Comment</h4>
</div>
<div class="modal-body">
<form id="submit-comment" class="well"
data-async data-target="#rating-modal"
action="/notes/make-comment" method="POST">
<input type="hidden" name="from"
value="<%= user.id %>">
<input type="hidden" name="namespace"
value="/view-<%= notekey %>">
<input type="hidden" name="key"
value="<%= notekey %>">
<fieldset>
<div class="form-group">
<label for="noteCommentTextArea">
Your Excellent Thoughts, Please</label>
<textarea id="noteCommentTextArea" name="message" class="form-control" rows="3"></textarea>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button id="submitNewComment" type="submit" class="btn btn-default">Make Comment</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
<% } %>
This adds support for posting comments on a note. The user will see a Modal pop-up window in which they write their comment.
We added a new button labeled **Comment** that the user will click to start the process of posting a message. This button is connected to the Modal by way of the class name specified in the `data-target` attribute. Note that the class name matches one of the class names on the outermost `div` wrapping the Modal. This structure of `div` elements and class names are from the Bootstrap website at <http://getbootstrap.com/javascript/#modals>.
The key portion of this is the HTML form contained within the `div.modal-body` element. It's a straightforward normal Bootstrap augmented form with a normal **Submit** button at the bottom. A few hidden `input` elements are used to pass extra information inside the request.
With the HTML set up this way, Bootstrap will ensure that this Modal is triggered when the user clicks on the **Comment** button. The user can close the Modal by clicking on the **Close** button. Otherwise, it's up to us to implement code to handle the form submission using AJAX so that it doesn't cause the page to reload:
<% if (user) { %>
<div id="noteMessages" style="display: none"></div>
<% } %>
<% include footer %>
This gives us a place to display the messages.
### Sending, displaying, and deleting messages
Note that these code snippets are wrapped with `if` statements. The effect is so that certain user interface elements are displayed only to sufficiently privileged users. A user that isn't logged in perhaps shouldn't see the messages, and they certainly shouldn't be able to post a message.
Now we have a lot of code to add to this block:
<% if (notekey) { %>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready(function () { .. });
</script>
We need to handle the form submission for posting a new comment, get the recent messages when first viewing a note, listen for events from the server about new messages or deleted messages, render the messages on the screen, and handle requests to delete a message:
$(document).ready(function () {
io('/view').on('noteupdate', function(note) { .. });
io('/view').on('notedestroy', function(data) { .. });
<% if (user) { %>
// Request the recent list of messages
io('/view').emit('getnotemessages', '/view-<%= notekey %>',
function(msgs) {
console.log("RECEIVE getnotemessages reply");
$('#noteMessages').empty();
if (msgs.length > 0) {
msgs.forEach(function(newmsg) {
$('#noteMessages').append(formatMessage(newmsg));
});
$('#noteMessages').show();
connectMsgDelButton();
} else $('#noteMessages').hide();
});
// Handler for the .message-del-button's
var connectMsgDelButton = function() {
$('.message-del-button').on('click', function(event) {
$.post('/notes/del-message', {
id: $(this).data("id"),
namespace: $(this).data("namespace")
},
function(response) { });
event.preventDefault();
});
};
// Emit the code to show a message, and the
// buttons that will sit next to it.
var formatMessage = function(newmsg) {
return '<p id="note-message-'
+ newmsg.id +'" class="well"><strong>'
+ newmsg.from +'</strong>: '
+ newmsg.message
+' <small style="float: right">'
+ newmsg.timestamp +'</small>'
+' <button style="float: right" type="button" class="btn btn-primary btn-xs message-del-button" data-id="'
+ newmsg.id +'" data-namespace="'
+ newmsg.namespace +'">Delete</button></p>';
};
// Act on newmessage and destroymessage events
io('/view').on('newmessage', function(newmsg) {
if (newmsg.namespace === '/view-<%= notekey %>') {
$('#noteMessages').prepend(formatMessage(newmsg));
connectMsgDelButton();
}
});
io('/view').on('destroymessage', function(data) {
if (data.namespace === '/view-<%= notekey %>') {
$('#noteMessages #note-message-'+ data.id).remove();
}
});
// Handle form submission for the comment form
$('form#submit-comment').submit(function(event) {
// Abort any pending request
if (request) { request.abort(); }
var $form = $('form#submit-comment');
var $target = $($form.attr('data-target'));
var request = $.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize()
});
request.done(function (response, textStatus, jqXHR) { });
request.fail(function (jqXHR, textStatus, errorThrown) {
alert("ERROR "+ jqXHR.responseText);
});
request.always(function () {
$('.notes-comment-modal').modal('hide');
});
event.preventDefault();
});
<% } %>
});
The code within `$('form#submit-comment').submit` handles the form submission for the comment form. Because we already have jQuery available, we can use its AJAX support to `POST` a request to the server without causing a page reload.
Using `event.preventDefault`, we ensure that the default action does not occur. For the FORM submission, that means the browser page does not reload. What happens is an HTTP `POST` is sent to `/notes/make-comment` with a data payload consisting of the values of the form's `input` elements. Included in those values are three hidden inputs, `from`, `namespace`, and `key`, providing useful identification data.
If you refer to the `/notes/make-comment` route definition, this calls `messagesModel.postMessage` to store the message in the database. That function then posts an event, `newmessage`, which our server-side code forwards to any browser that's connected to the namespace. Shortly, we'll show the response to that event.
When the page is first loaded, we want to retrieve the current messages. This is kicked off with `io('/view').emit('getnotemessages', ..`. This function, as the name implies, sends a `getnotemessages` message to the server. We showed the implementation of the server-side handler for this message earlier, in `routes/notes.js`.
If you remember, we said that Socket.IO supports providing a callback function that is called by the server in response to an event. You simply pass a function as the last parameter to a `.emit` call. That function is made available at the other end of the communication to be called when appropriate. To make this clear, we have a callback function on the browser being invoked by server-side code.
In this case, our callback function takes a list of messages and displays them on the screen. It uses jQuery DOM manipulation to erase any existing messages, then render each message into the messages area using the `formatMessage` function. The message display area (`#noteMessages`) is also hidden or shown depending on whether we have messages to display.
The message display template, in `formatMessage`, is straightforward. It uses a Bootstrap well to give a nice visual effect. And, there is a button for deleting messages.
In `formatMessage` we created a **Delete** button for each message. Those buttons need an event handler, and the event handler is set up using the `connectMsgDelButton` function. In this case, we send an HTTP `POST` request to `/notes/del-message`. We again use the jQuery AJAX support again to post that HTTP request.
The `/notes/del-message` route in turn calls `messagesModel.destroyMessage` to do the deed. That function then emits an event, `destroymessage`, which gets sent back to the browser. As you see here, the `destroymessage` event handler causes the corresponding message to be removed using jQuery DOM manipulation. We were careful to add an `id=` attribute to every message to make removal easy.
Since the flip side of destruction is creation, we need to have the `newmessage` event handler sitting next to the `destroymessage` event handler. It also uses jQuery DOM manipulation to insert the new message into the `#noteMessages` area.
### Running Notes and passing messages
That was a lot of code, but we now have the ability to compose messages, display them on the screen, and delete them, all with no page reloads. Watch out Facebook! We're coming for you now that the Notes application is becoming a social network!
Okay, maybe not. We do need to see what this can do.
You can run the application as we did earlier, first starting the user authentication server in one command-line window and the Notes application in another:
This is what a note might look like after entering a few comments.
While entering a message, the Modal looks like this.
Try this with multiple browser windows viewing the same note or different notes. This way, you can verify that notes show up only on the corresponding note window.
### Other applications of Modal windows
We used a Modal and some AJAX code to avoid one page reload due to a form submission. In the Notes application, as it stands, a similar technique could be used when creating a new note, editing existing notes, and deleting existing notes. In each case, we would use a Modal, some AJAX code to handle the form submission, and some jQuery code to update the page without causing a reload.
But wait, that's not all. Consider the sort of dynamic real-time user interface wizardry on the popular social networks. Imagine what events and/or AJAX calls are required.
When you click on an image in Twitter, it pops up, you guessed it, a Modal window to show a larger version of the image. The Twitter **Compose new Tweet** window is also a Modal window. Facebook uses many different Modal windows, such as when sharing a post, reporting a spam post, or while doing a lot of other things Facebook's designers deem to require a pop-up window.
Socket.IO, as we've seen, gives us a rich foundation of event passing between server and client, which can build multiuser multichannel communication experiences for your users.
# Summary
While we came a long way in this chapter, maybe Facebook doesn't have anything to fear from the baby steps we took toward converting the Notes application into a social network. This chapter gave us the opportunity to explore some really cool technology for pseudo-real-time communication between browser sessions.
In this chapter, you learned about using Socket.IO for pseudo-real-time web experiences, using the `EventEmitter` class to send messages between parts of an application, jQuery, AJAX, and other browser-side JavaScript technologies, and avoiding page reloads while making AJAX calls.
In the next chapter, we will look into Node.js application deployment on real servers. Running code on our laptop is cool, but to hit the big time, the application needs to be properly deployed.
# Chapter 10. Deploying Node.js Applications
Now that the `Notes` application is fairly complete, it's time to think about how to deploy it to a real server. We've created a minimal implementation of the collaborative note concept that works fairly well. To get input and advice from others, Notes needs to escape our laptop and live on a real server. Therefore, the goal of this chapter to look at a couple of deployment methods for Node.js applications.
In this chapter, we will cover the following topics:
* Traditional LSB-compliant Node.js deployment
* Using PM2 to improve reliability
* Deployment to a Virtual Private Server provider
* Microservice deployment with Docker (we have four distinct services to deploy)
* Deployment to a Docker hosting provider
The first task is to duplicate the source code from the previous chapter. It's suggested to create a new directory, `chap10`, as a sibling of the `chap09` directory and copy everything from `chap09` to `chap10`.
# Notes application architecture
Before we get into deploying the `Notes` application, we need to review its architecture. We put together several pieces in the last several chapters without giving ourselves the chance to step back a few feet and gather some perspective on the results. To deploy the `Notes` application, we must understand what we're planning to do:
It's been our goal to segment the services into two groups. The user authentication server should be the more secure portion of the system so that we can earn the trust of our users. On our laptop, we weren't able to create the envisioned protective wall around that service, but we're about to implement such protection.
One strategy to enhance security is to expose as few ports as possible to the outside. That reduces the avenues miscreants can probe for vulnerabilities, thus simplifying our work in hardening the application against security bugs. With the `Notes` application, we have exactly one port to expose, the HTTP service through which users access the application. The other ports, the two for MySQL servers and the user authentication service port, should be hidden from public view.
Internally, the `Notes` application needs to access both the Notes database and the User Authentication service. That service, in turn, needs to access the User Authentication database. As currently envisaged, no service outside the Notes application requires access to either database or the authentication service.
Implementation of this segmentation requires either two or three subnets, depending on the lengths you wish to go. The first subnet, `FrontNet`, contains the `Notes` application and its database. The second subnet, `AuthNet`, contains the authentication service and its database. The subnets must be configured to limit the hosts that can access that subnet. It's this subnet configuration that creates the security wall that will let us breathe a little easier because miscreants will have a much harder time doing any damage.
But if the authentication service and `Notes` application are on different subnets, they will be unable to talk to each other. One could create a third subnet, `NotesAuthConnector` maybe, so that those services can talk to each other. Or one could do as shown here and allow the authentication service to connect to both `FrontNet` and `AuthNet`.
That picture is the desired end result of the chapter. First, we need to get our feet wet with traditional deployment methodologies.
# Traditional Linux Node.js service deployment
In a normal server, application deployment on Linux, and other Unix-like systems, is to write an **init script** to manage any needed daemon processes. The required daemons are to start every time the system boots and cleanly shut down when the system is halted. While it's a simple model, the specifics of this vary widely from one operating system (OS) to another.
A common method is for the `init` daemon to manage background processes using shell scripts in the `/etc/init.d` directory. Other OSes use other daemon managers such as `upstart` or `launchd`.
The Node.js project itself does not include any scripts to manage server processes on any OS. Node.js is more like a construction kit with the pieces and parts to build servers and is not a complete polished server framework itself. Implementing a complete web service based on Node.js means creating the scripting to integrate with daemon process management on your OS. It's up to us to develop those scripts.
Web services have to be:
* Reliable, for example, to auto-restart when the server process crashes
* Manageable, meaning it integrates well with system management practices
* Observable, meaning the administrator must be able to get status and activity information from the service
To demonstrate a little of what's involved, let's use PM2 along with an LSB-style init script (<http://wiki.debian.org/LSBInitScripts>) to implement background server process management for the `Notes` application. These scripts are pretty simple; they take a command-line argument saying whether the service should start or stop the service and do whatever is necessary to do so. Because LSB-style init scripts are not used on all Linux systems, you'll need to adjust the scripts shown in this chapter to match the specific needs of your system. Fortunately, PM2 makes that easy for us.
PM2 generates scripts for a long list of OSes. Additionally, PM2 will handle bringing a multiprocess service up and down for us. Since we have two Node.js processes to administer, it will be a big help.
For this deployment, we'll set up a single Ubuntu 15.10 server. You should secure a Virtual Private Service ( **VPS** ) from a hosting provider and do all installation and configuration there. Renting a small machine instance from one of the major providers for the time needed to go through this chapter will only cost a couple of dollars.
You can also do the tasks in this section using **VirtualBox** on your laptop. Simply install Debian or Ubuntu and pretend that it's hosted on a remote VPS hosting provider.
Both the Notes and User Authentication services will be on that server, along with a single MySQL instance. While our goal is a strong separation between `FrontNet` and `AuthNet`, with two MySQL instances, we won't do so at this time.
## Prerequisite – provisioning the databases
The Linux package management systems don't allow us to install two MySQL instances. We can implement some separation in the same MySQL instance by using separate databases with different usernames and access privileges for each database.
The first step is to ensure that MySQL is installed on your server. For Ubuntu, **Digital Ocean** has a fairly good tutorial: <https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-14-04>.
The MySQL server must support TCP connections from `localhost`. Edit the configuration file, `/etc/mysql/my.cnf`, to have the following line:
**bind-address = 127.0.0.1**
This limits MySQL server connections to the processes on the server. A miscreant would have to break into the server to access your database.
Now that our database server is available, let's set up two databases.
In the `chap10/notes/models` directory, create a file named `mysql-create-db.sql` containing the following:
**CREATE DATABASE notes;**
**CREATE USER 'notes'@'localhost' IDENTIFIED BY 'notes';**
**GRANT ALL PRIVILEGES ON notes.* TO 'notes'@'localhost'**
**WITH GRANT OPTION;**
And in the `chap10/users` directory, create a file named `mysql-create-db.sql` containing the following:
**CREATE DATABASE userauth;**
**CREATE USER 'userauth'@'localhost' IDENTIFIED BY 'userauth';**
**GRANT ALL PRIVILEGES ON userauth.* TO 'userauth'@'localhost'**
**WITH GRANT OPTION;**
When the Notes application source code is copied to the server, we'll run the scripts as:
**$ mysql -u root -p <chap10/users/mysql-create-db.sql**
**$ mysql -u root -p <chap10/notes/models/mysql-create-db.sql**
This will create the two databases, `notes` and `userauth`, with associated usernames and passwords. Each user can access only its associated database. Later we'll set up Notes and the User Authentication service with YAML configuration files to access these databases.
## Installing Node.js on Ubuntu
According to the Node.js documentation (<https://nodejs.org/en/download/package-manager/>), the recommended installation method for Debian or Ubuntu Linux distributions is the following:
**$ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -**
**$ sudo apt-get install -y nodejs**
**$ sudo apt-get install -y build-essential**
Installing this way means that as new Node.js releases are issued, upgrades are easily accomplished with the normal package management procedures. The `build-essential` package brings in all the compilers and other development tools required to build native code Node.js packages.
## Setting up Notes and User Authentication on the server
Before copying the Notes and User Authentication code to this server, let's do a little coding to prepare for the move. We know that the Notes and Authentication services must access the MySQL instance on `localhost` using the usernames and passwords given earlier.
Using the approach we've followed so far, this means a pair of YAML files for **Sequelize** parameters, and changing environment variables in the `package.json` files to match.
Create a `chap10/notes/models/sequelize-server-mysql.yaml` file containing:
dbname: notes
username: notes
password: notes
params:
host: localhost
port: 3306
dialect: mysql
In `chap10/notes/package.json`, add the following line to the `scripts` section:
"on-server": "SEQUELIZE_CONNECT=models/sequelize-server-mysql.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3000 node ./app",
Then create a `chap10/users/sequelize-server-mysql.yaml` file containing:
dbname: userauth
username: userauth
password: userauth
params:
host: localhost
port: 3306
dialect: mysql
And in `chap10/users/package.json`, add the following line to the `scripts` section:
"on-server": "PORT=3333 SEQUELIZE_CONNECT=sequelize-server-mysql.yaml node ./user-server",
This configures the authentication service to access the databases just created.
Now we need to select a place on the server to install the application code:
**# ls /opt**
This empty directory looks to be as good a place as any. Simply upload `chap10/notes` and `chap10/users` to your preferred location, so you have the following:
**# ls /opt**
**notes users**
Then, in each directory, run these commands:
**# rm -rf node_modules**
**# npm install**
### Note
Note that we're running these commands as `root` rather than a user ID that can use the `sudo` command. The machine offered by the hosting provider is configured to be used in this way. Other VPS hosting providers will provide machines where you log in as a regular user and then use `sudo` to perform privileged operations. As you read these instructions, pay attention to the command prompt we show. We've followed the convention where `$` is used for commands run as a regular user and `#` is used for commands run as `root`. If you're running as a regular user, and need to run a `root` command, then run the command with `sudo`.
When uploading the source to the server, you may have included the `node_modules` directory. That directory was built on your laptop and probably isn't suitable for the server you're running. It's unlikely your laptop is running the same OS as the server, so any native code modules will fail. The `node_modules` directory should be created on the target machine so that native code modules are compiled on the target machine.
The simplest method to do so is to just delete the whole `node_modules` directory and then let `npm install` do its job.
Remember that we set up the `PATH` environment variable the following way:
**# export PATH=./node_modules/.bin:${PATH}**
Also remember that in the `chap10/notes` directory, the `npm install` step will run `bower install`. This is likely to fail because `bower` insists on not being run with root privileges, for good reasons. If necessary, you can run bower the following way:
**# apt-get install git**
**# bower --allow-root install**
It's useful to record this in the `package.json` script as well:
"postinstall": "bower --allow-root install"
Finally, at this time, you can now run the SQL scripts written earlier to set up the database instances:
**# mysql -u root -p <users/mysql-create-db.sql**
**# mysql -u root -p <notes/models/mysql-create-db.sql**
Then you should be able to start up the services by hand to check that everything is working correctly. The MySQL instance has already been tested, so we just need to start the User Authentication and Notes services:
**# cd /opt/users**
**# npm run on-server**
**> users@0.0.1 on-server /opt/users**
**> PORT=3333 SEQUELIZE_CONNECT=sequelize-server-mysql.yaml node ./user-server**
Then log in to the server on another terminal session and run the following:
**# cd /opt/users/**
**# PORT=3333 node users-add.js**
**Created { id: 1,**
**username: 'me', password: 'w0rd', provider: 'local',**
**familyName: 'Einarrsdottir',givenName: 'Ashildr',**
**middleName: '', emails: '[]', photos: '[]',**
**updatedAt: '2016-03-22T01:28:21.000Z',**
**createdAt: '2016-03-22T01:28:21.000Z' }**
**# PORT=3333 node users-list.js**
**List [ { id: 'me', username: 'me', provider: 'local',**
**familyName: 'Einarrsdottir', givenName: 'Ashildr', middleName: '',**
**emails: '[]', photos: '[]' } ]**
The preceding command both tests the backend user authentication service is functioning and gives us a user account we can use to log in. The `users-list` command demonstrates that it works.
Now we can start the Notes service:
**# cd ../notes**
**# npm run on-server**
**> notes@0.0.0 on-server /opt/notes**
**> SEQUELIZE_CONNECT=models/sequelize-server-mysql.yaml NOTES_MODEL=models/notes-sequelize USERS_MODEL=models/users-rest USER_SERVICE_URL=http://localhost:3333 PORT=3000 node ./app**
And then we can use our web browser to connect to the application. Since you probably do not have a domain name associated with this server, Notes can be accessed via the IP address of the server, such as: `http://104.131.55.236:3000`.
The `Twitter` application we set up for Notes previously won't work because the authentication URL is incorrect for the server. For now, we can log in using the user profile created previously.
By now you know that the drill of verifying Notes is working. Create a few notes, open a few browser windows, see that real-time notifications work, and so on. Once you're satisfied that Notes is working on the server, kill the processes and move on to the next section, where we'll set this up to run when the server starts.
## Setting up PM2 to manage Node.js processes
There are many ways to manage server processes, to ensure restarts if the process crashes, and so on. **Supervisord** (<http://supervisord.org/>) is a likely candidate for this purpose. However, we'll instead use **PM2** (<http://pm2.keymetrics.io/>) because it's optimized for Node.js processes. It bundles process management and monitoring into one application whose purpose is managing background processes.
Install it as so (using `sudo` if needed):
**# npm install -g pm2@1.x**
In `users/package.json`, we can add the following line to the `scripts` section:
"on-server-pm2": "PORT=3333 SEQUELIZE_CONNECT=sequelize-server-mysql.yaml pm2 start --env PORT --env SEQUELIZE_CONNECT user-server.js",
In normal `pm2` usage, we launch scripts with `pm2 start script-name.js`.
Because our services use environment variables for configuration, we have to add the `--env` options so that PM2 knows it should pay attention to these variables. We could go ahead and add a similar line in `notes/package.json`, but let's try something else instead. PM2 offers a better way for us to describe the processes it should start.
In the `/opt` directory, create a file named `ecosystem.json` containing the following:
{
apps : [
{
name : "User Authentication",
script : "user-server.js",
"cwd" : "/opt/users",
env: {
PORT: "3333",
SEQUELIZE_CONNECT: "sequelize-server-mysql.yaml"
},
env_production : {
NODE_ENV: "production"
}
},
{
name : "Notes",
script : "app.js",
"cwd" : "/opt/notes",
env: {
PORT: "3000",
SEQUELIZE_CONNECT: "models/sequelize-server-mysql.yaml",
NOTES_MODEL: "models/notes-sequelize",
USERS_MODEL: "models/users-rest",
USER_SERVICE_URL: "http://localhost:3333"
},
env_production : {
NODE_ENV: "production"
}
}
]
}
This file describes the directories containing both services, the script to run each service, and the environment variables to use.
We then start the services as so: `pm2 start ecosystem.json`, which looks like the following on the screen:
You can again navigate your browser to the URL for your server, such as `http://104.131.55.236:3000`, and check that the `Notes` application is working.
Once started, some useful commands are as follows:
**# pm2 list**
**# pm2 describe 1**
**# pm2 logs 1**
These commands let you query the status of the services.
The `pm2 monit` command gives you a pseudo-graphical monitor of system activity, as shown in the following screenshot:
As you access Notes, watch how those red bars grow and shrink showing the changes in CPU consumption. This is all cool, but if we restart the server, these processes don't start with the server. How do we handle that? It's very simple because PM2 can generate an `init` script for us:
**# pm2 startup ubuntu**
**[PM2] Generating system init script in /etc/init.d/pm2-init.sh**
**[PM2] Making script booting at startup...**
**[PM2] -ubuntu- Using the command:**
**su -c "chmod +x /etc/init.d/pm2-init.sh && update-rc.d pm2-init.sh defaults"**
**[PM2] Done.**
Because we're using an Ubuntu server, we generated an Ubuntu startup script. Make sure to generate this script for the platform ( **Gentoo** and so on) you are using. If you simply leave off the platform name, PM2 will autodetect the platform for you.
The script generated doesn't include specifics about the currently executing set of processes. Instead, it simply runs some of the PM2 commands needed to start or stop a list of processes it has been told to manage. PM2 keeps its own data about the processes you've asked it to manage.
It is necessary to run the following command:
**# pm2 save**
This saves the current process state so that the processes can be restarted later, such as when the system restarts.
### Twitter support for the hosted Notes app
The only thing we're lacking is support for logging in with Twitter. When we registered the `Notes` application with Twitter, we registered a domain such as `http://MacBook-Pro-2.local:3000` for our laptop. The `Notes` application is now deployed on the server and is used by a URL that Twitter doesn't recognize. We therefore have a couple of things to change.
On apps.twitter.com in the `Notes` application registration screen, we can enter the IP address of the website as so: `http://104.131.55.236:3000`.
Then, in `notes/routes/users.js`, we need to make a corresponding change to the **TwitterStrategy** definition:
passport.use(new TwitterStrategy({
consumerKey: ".. KEY",
consumerSecret: ".. SECRET",
callbackURL: "http://104.131.55.236:3000/users/auth/twitter/callback"
},
});
Upon making those changes, restart the services:
And then you'll be able to log in using your Twitter account.
We now have the `Notes` application under a fairly good management system. We can easily update its code on the server and restart the service. If the service crashes, PM2 will automatically restart it. Log files are automatically kept for our perusal.
PM2 also supports deployment from the source on our laptop, which we can push to staging or production environments. To support this, we must add deployment information to the `ecosystem.json` file and then run the `pm2 deploy` command to push the code to the server. See the PM2 website for more information.
While PM2 does a good job at managing server processes, the system we've developed is insufficient for an _Internet-scale_ service. What if the `Notes` application were to become a viral hit and suddenly we need to deploy a million servers spread around the planet? Deploying and maintaining servers one at a time, like this, is not scalable.
We also skipped over implementing the architectural decisions at the beginning. Putting the user authentication data on the same server is a security risk. We want to deploy that data on a different server, under tighter security.
In the next section, we'll explore a new system, **Docker** , that solves these problems and more.
# Node.js microservice deployment with Docker
Docker (<http://docker.com>) is the new attraction in the software industry. Interest is taking off like crazy, spawning many projects, many with names containing puns around shipping containers.
It is described as "an open platform for distributed applications for developers and sysadmins". It is designed around Linux containerization technology and focuses on describing the configuration of software on any variant of Linux.
Docker automates the application deployment within software containers. The basic concepts of Linux containers date back to `chroot` jail's first implemented in the 1970s, and other systems like Solaris Zones. The Docker implementation creates a layer of software isolation and virtualization based on Linux cgroups, kernel namespaces, and union-capable filesystems, which blend together to make Docker what it is. That was some heavy geek-speak, so let's try a simpler explanation. A Docker container is a running instantiation of a Docker image. An image is a given Linux OS and application configuration designed by developers for whatever purpose they have in mind. Developers describe an image using a **Dockerfile**. The Dockerfile is a fairly simple-to-write script showing Docker how to build an image.
A running container will make you feel like you're inside a virtual server running on a virtual machine. But Docker containerization is very different from a virtual machine system such as VirtualBox. The processes running inside the container are actually running on the host OS. The containerization technology (cgroups, kernel namespaces, and so on) create the illusion of running on the Linux variant specified in the Dockerfile, even if the host OS is completely different. Your host OS could be Ubuntu and the container OS could be Fedora or OpenSUSE; Docker makes it all work. The only requirement is that both host OS and container OS must be a Linux variant.
By contrast, with Virtual Machine software (VirtualBox, VMWare, and so on), you're using what feels like a real computer. There is a virtual BIOS and system hardware, and you must install a full-fledged guest OS inside this virtual computer. You must follow every ritual of computer ownership, including securing licenses, if it's a closed source system like Windows. Processes running inside the virtual machine are running solely on the guest OS, and the host OS has no clue what's going on inside that machine.
It means Docker has much lower overhead than a virtual machine. For example, network traffic on Docker is handled by the host OS, whereas in a virtual machine, it has to be translated back and forth between host and guest OS network drivers. The same is true for access to any other resource, such as disk space, USB devices, and so on.
While Docker is primarily targeted at x86 flavors of Linux, some teams support Docker on ARM and other processors. You can even run Docker on single-board computers such as Raspberry Pis for hardware-oriented Internet of Things projects.
The Docker ecosystem contains many tools, and their number is quickly increasing. For our purposes, we'll be focusing on the following three specific tools:
* **Docker Engine** : This is the core execution system that orchestrates everything. It runs on a Linux host system, exposing a network-based API that client applications use to make Docker requests such as building, deploying, and running containers.
* **Docker Machine** : This is a client application performing functions around provisioning Docker Engine instances on host computers.
* **Docker Compose** : This helps you define, in a single file, a multicontainer application, with all its dependencies defined.
With the Docker ecosystem, you can create a whole universe of subnets and services to implement your dream application. That universe can run on your laptop or be deployed to a globe-spanning network of cloud-hosting facilities around the world. The surface area through which miscreants can attack is small and is strictly defined by the developer. A multicontainer application will even limit access so strongly between services that even miscreants who manage to break into a container will find it difficult to break out of the container.
Using Docker, we'll first design on our laptop the system shown in the earlier diagram. Then we'll migrate that system to a Docker instance on a server.
## Installing Docker on your laptop
The best place to learn how to install Docker on your laptop is the Docker documentation website: <https://docs.docker.com/engine/installation/>.
For users on Linux distributions, you can directly use the Docker command-line tools to manage local Docker containers, with no additional configuration required. The Linux Docker tools are easily installed using the package management systems on several Linux distros.
Because Docker runs on Linux, installing it on Mac OS X or Windows requires installing Linux inside a virtual machine and then running Docker tools within that Linux. The days when you had to craft that yourself are long gone. The Docker team has made this easy by developing easy-to-use Docker applications for Mac and Windows. They bundle together Docker tools and virtual machine software, letting you run containers on your laptop and use the Docker command-line tools.
Docker Toolbox bundles together VirtualBox, the full set of Docker command-line tools, and the **Kitematic GUI**. It replaces an earlier application named **boot2docker**. When installed (<https://docs.docker.com/toolbox/overview/>), it automatically installs a VirtualBox instance behind the scenes, along with all the Docker command-line tools set up, so that they easily manage Docker infrastructure inside VirtualBox. With the command-line tools, you can also use any Docker Engine instance anywhere, whether on your laptop or in a server room on the other side of the planet.
Two new applications, Docker for Windows and Docker for Mac, are native Docker implementations for their respective platforms. They integrate more tightly with the platform, making Docker work similarly to other native applications. Most importantly, it does not require VirtualBox, which fixes several problems. It is claimed to have higher performance by using lighter-weight virtual machine technology. It's so lightweight that it's feasible to leave Docker for Windows or Mac running full-time in the background.
As of this writing, Docker for Windows and Docker for Mac are in a limited-access Beta.
After installing Docker or Docker Toolbox or Docker for Windows/Mac and following the instructions for your OS, you can try a couple of commands to get your feet wet.
### Starting Docker using Docker Toolbox and Docker Machine
If you installed Docker Toolbox, there is a prerequisite step before you can run Docker commands. That is to use the local Docker Machine tool to create a local Docker instance, and initialize some environment variables so the Docker commands know which Docker Engine to access.
Even if the Docker team ends up discontinuing Docker Toolbox, you must know how to use Docker Machine. That's because Docker Machine is used for installing Docker Engine onto host machine instances, either local or remote, and to manage Docker instances using `docker-machine` command-line operations.
Starting `docker-machine` on your local machine boots up the VirtualBox instance, and as we see in the following, the first time it runs, it provisions the Docker environment inside VirtualBox. This is required when using Docker Toolbox, but not when using Docker for Windows or Mac:
**$ docker-machine start**
**Starting "default"...**
**(default) Check network to re-create if needed...**
**(default) Waiting for an IP...**
**Machine "default" was started.**
**Waiting for SSH to be available...**
**Detecting the provisioner...**
Started machines may have new IP addresses. You may need to rerun the `docker-machine env` command.
This starts a Docker Engine instance on the localhost, and behind the scenes, Docker is running in a Linux instance inside VirtualBox. If you look at background processes, you'll see that a VirtualBox instance has started:
**$ docker-machine env**
**export DOCKER_TLS_VERIFY="1"**
**export DOCKER_HOST="tcp://192.168.99.100:2376"**
**export DOCKER_CERT_PATH="/Users/david/.docker/machine/machines/default"**
**export DOCKER_MACHINE_NAME="default"**
**# Run this command to configure your shell:**
**# eval $(docker-machine env)**
These are the Docker environment variables describing how the Docker commands should access the local Docker instance. These variables obviously include a TCP address and a directory full of PEM certificates. It also helpfully suggests an easy way to add these variables to the environment of your shell.
The `docker-machine` command lets us start multiple Docker Engine instances, either on the localhost or, as we'll see later, on remote servers. The `docker-machine create` command is used for creating these instances. Later, we'll see how this command can even reach out to specific cloud-hosting providers and create, from the command line of your laptop, Docker hosts on the cloud.
In the meantime, the following is what we have:
The name for this newly created Docker instance is `default`. When creating a Docker host with `docker-machine`, you can specify any name you like.
Because VirtualBox is fairly heavyweight, you probably won't want to leave it running full-time in the background. For that and many other reasons, you may want to shut down a Docker instance. This is done using the following `docker-machine` command:
**$ docker-machine stop**
This contacts the Docker instance identified by the `DOCKER` environment variables, sending it a command to shut down containers and the Docker service.
### Starting Docker with Docker for Windows/Mac
If you instead installed Docker for Windows or Mac, the startup process is much simpler. You simply find and double-click on the application icon. It launches as would any other native application, and when started, it manages a virtual machine (not VirtualBox) within which is a Linux instance running the Docker Engine. On Mac OS X, a menu bar icon shows up with which you control `Docker.app`, and on Windows, an icon is available in the system tray.
The `docker-machine` command is not used to provision this instance. Instead, you use the `docker` and `docker-compose` command-line tools, and they interact directly with this Docker instance with no configuration required.
### Kicking the tires of Docker
With the setup accomplished, we can use the local Docker instance to create Docker containers, run a few commands, and in general learn how to use this amazing system.
As in so many software journeys, this one starts with saying Hello to the world:
The `docker run` command downloads a Docker image, named on the command line, initializes a Docker container from that image, and then runs that container. In this case, the image, named `hello-world`, was not present on the local computer and had to be downloaded and initialized. Once that was done, the `hello-world` container was executed and it printed out these instructions.
You can query your computer to see that while the `hello-world` container has executed and finished, it still exists:
The `docker ps` command lists the running Docker containers. As we see here, the `hello-world` container is no longer running, but with the `-a` switch, `docker ps` also shows those containers that exist but are not currently running.
When you're done using a container, you can clean up with the following command:
**$ docker rm amazing_boyd hopeful_almeida**
**amazing_boyd**
**hopeful_almeida**
We used these names because these are the container names. While the image name was `hello-world`, that's not the container name. Docker generated these two container names so you have a more user-friendly identifier for the containers than the hex ID shown in the container ID column. When creating a container, it's easy to specify any container name you like.
## Creating the AuthNet for the User Authentication service
With all that theory spinning around our heads, it's time to do something practical. Let's start by setting up the User Authentication service. In the diagram shown earlier, this will be the box labeled `AuthNet` containing a MySQL instance and the authentication server.
### MySQL for the Authentication service
Create a directory named `db-auth` as a sibling to the `users` and `notes` directories. In that directory, create a file named `Dockerfile` containing the following:
FROM mysql:5.7
ENV MYSQL_RANDOM_ROOT_PASSWORD=yes
ENV MYSQL_DATABASE=userauth
ENV MYSQL_USER=userauth
ENV MYSQL_PASSWORD=userauth
RUN sed -i "s/^#bind-address.*$/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
RUN sed -i "s/^pid-file/# pid-file/" /etc/mysql/my.cnf
RUN sed -i "s/^socket/# socket/" /etc/mysql/my.cnf
VOLUME /var/lib/mysql
EXPOSE 3306
CMD ["mysqld"]
Dockerfiles describe the installation of an application on a server (see <https://docs.docker.com/engine/reference/builder/>). The purpose is to document how to assemble the bits which go into a Docker container image. Docker uses the instructions in a Dockerfile to build a Docker image.
The `FROM` command specifies a pre-existing image from which to derive this image. The `mysql` image (<https://hub.docker.com/_/mysql/>) used here was created by the MySQL team. While there are plenty of MySQL images available in the Docker Hub, this is the official image. The :5.7 attribute is a version tag, specifying we'll be using MySQL 5.7. If it's important to you, the `mysql:5.7` image itself is built on the `debian:jessie` image, meaning that we'll ultimately be executing under Debian.
The subsequent commands tailor the MySQL container to be useful for the authentication service. The environment variable definitions (`ENV` command) instruct the MySQL image to create the named user identity, database, and passwords the first time this container is executed. The `RUN sed` commands modify the `my.cnf` file so that we can use a TCP port to communicate with the MySQL instance.
The `VOLUME` command says that the MySQL data directory, `/var/lib/mysql`, will be stored outside the container and then mapped so that it's visible inside the container. Generally speaking, what happens inside a Docker container stays within the Docker container. Normally, that's useful not just for bad puns on lines from movies but also for improved security. Sometimes, however, we need to reuse data generated by a container in other contexts. For example, a database might need to be migrated elsewhere or preserved when the container is deleted.
Docker containers are designed to be cheap and easy to create, and to be thrown away and recreated whenever needed. This includes throwing away all data inside the container. Databases, on the other hand, are meant to live on for years sometimes, making it useful for the database files to exist separately from the container.
The `EXPOSE` command informs Docker that the container listens on the named TCP port. This does not expose the port beyond the container.
Finally, the `CMD` command documents the process to launch when the container is executed. The `RUN` commands are executed while building the container, while `CMD` says what's executed when the container starts.
Make sure that Docker is running on your machine. If necessary, run the `docker-machine` command or start the Docker for Windows or Mac application.
Now we can build the `db-auth` image as follows:
**$ cd db-auth**
**$ docker build -t node-web-development/db-auth .**
This builds the image and gives it a full name by which we can refer to this image. The image can even be pushed, under this name, to a Docker image repository and used by others.
And then execute it as so:
**$ docker run -it --name db-auth node-web-development/db-auth**
Voluminous information will be printed about the initialization of the database. If you look carefully, the randomly generated password is printed out and you're told that the server is listening to `0.0.0.0` on port `3306`. Normally, this means that this MySQL instance is open to access from the entire Internet, but because it is inside a Docker container, we are in control of where and when that port is visible. At the moment, the port is not published outside the container.
The `-it` option tells Docker to run this in an interactive (`-i`) terminal (`-t`) session. That's why the voluminous output is printed on the terminal.
The `--name db-auth` option assigns a user-friendly name to the container. Otherwise the container is identified by its `sha256` hash, the shortened version of which might be an utterly forgettable identifier like `c1d731d589ae`.
The final argument is the name of the image to execute. The image will be retrieved from a Docker repository or from the local machine.
Once the image is running, we can't do much with it because the MySQL port is invisible outside the container. But we can get into the container and run a MySQL command there. In another command window, run the following:
The `exec` command will execute a process inside a running container. Notice that the shell prompt changes from the laptop to root on a host named `c1d731d589ae` because we ran `bash` inside the container. We can then run the MySQL client and examine the database. We could also poke around the filesystem and see what's there.
At the moment, though, we don't need this container image. Let's remove it:
**$ docker stop db-auth**
**db-auth**
**$ docker rm db-auth**
**db-auth**
We'll be recreating the `db-auth` container later with some additional options. As implied by the command names, the first stops the running container, while the second deletes the container.
### Dockerizing the Authentication service
In the `users` directory, create a file named `Dockerfile` containing the following:
FROM node:5.9
ENV DEBUG="users:*"
ENV PORT="3333"
ENV SEQUELIZE_CONNECT="sequelize-docker-mysql.yaml"
ENV REST_LISTEN="0.0.0.0"
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN apt-get update -y \
&& apt-get -y install curl python build-essential git ca-certificates \
&& npm install --unsafe-perm
EXPOSE 3333
CMD npm run docker
We're deriving this image from the official Node.js Docker image maintained by the Node.js team (<https://hub.docker.com/_/node/>). Like the `MySQL` container used earlier, this one is also derived from `debian:jessie`.
The authentication service code is copied to the `/usr/src/app` directory of the container. The `build-essential` package and other tools are installed to support building native code Node.js modules.
It's recommended to always combine `apt-get update` with `apt-get install` in the same command line, like this, because of the Docker build cache. When building a Docker image, not all the lines are executed. Instead, the first change in the file is the first line executed. By putting those two together, you ensure that `apt-get update` is executed any time you change the list of packages to be installed. For a complete discussion, see the documentation at <https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/>.
At the end of this command is `npm install --unsafe-perm`. We obviously need to run `npm install` inside the container so that Node.js dependencies are installed and that native code Node.js modules are compiled for the OS running inside the container. What's the `--unsafe-perm` flag, however?
The issue here is that these commands are being run as `root`. Normally, when `npm` is run as `root`, it changes its user ID to a nonprivileged user. This can cause failure, however, and the `--unsafe-perm` option prevents changing the user ID.
The environment variables used are the same as we used in `package.json`, with two differences.
First, we're using a different file for `SEQUELIZE_CONNECT`. Create a new file named `sequelize-docker-mysql.yaml` containing the following:
dbname: userauth
username: userauth
password: userauth
params:
host: db-auth
port: 3306
dialect: mysql
We'll explain the hostname in a little bit, and yes it purposely does not have a top-level domain name. The database name, user name, and password must match with what we gave in the `db-auth` Dockerfile.
Second is a new variable named `REST_LISTEN`. Previously, the Authentication Server had listened only to `http://localhost:3333`. We'd done this for security purposes, that is, to limit which processes could connect to the service. Under Docker, we need to connect to this service from outside its container so that other containers can connect to this service. Therefore, it must listen to connections from outside the localhost.
In `users-server.js`, we need to make the following change:
server.listen(process.env.PORT,
process.env.REST_LISTEN ? process.env.REST_LISTEN : "localhost",
() => { log(server.name +' listening at '+ server.url); });
That is, if the `REST_LISTEN` variable exists, the REST server is told to listen to whatever it says, otherwise the service is to listen to `localhost`. With the environment variable in the Dockerfile, the authentication service will listen to the world (`0.0.0.0`). Are we throwing caution to the wind and abrogating our fiduciary duty in keeping the sacred trust of storing all this user identification information? No. Be patient. We'll describe momentarily how to connect this service and its database to `AuthNet` and will prevent access to `AuthNet` by any other process.
In `package.json`, add the following line to the `scripts` section:
"docker": "node user-server"
Previously, we've put the configuration environment variables into `package.json`. In this case, the configuration environment variables are in the Dockerfile. This means we need a way to run the server with no environment variables other than those in the Dockerfile. With this `scripts` entry, we can do `npm run docker` and then the Dockerfile environment variables will supply all configuration.
We can build the authentication service as so:
**$ docker build -t node-web-development/userauth .**
### Putting Authnet together
We can't go ahead and run the `userauth` container because we have a couple of missing pieces. For example, the domain name `db-auth` specified in `sequelize-docker-mysql.yaml` doesn't exist. And we have an authentication service that listens to the whole world when its scope needs to be limited. What we need is to create the `AuthNet` box shown on the earlier diagram.
With Docker, we can create virtual networks with strictly limited access. We can then attach Docker containers to those networks, and Docker even includes an embedded DNS server to set up the hostnames required so containers can find each other.
Type the following:
**$ docker network create --driver bridge authnet**
A bridge network is a virtual network that exists solely within the host computer. Docker manages this network, and bridge networks can only be accessed by containers attached to the bridge network. A DNS server is configured for that network, whose job is to publish domain names for the containers. Those domain names match the container name given when creating the container. Containers are meant to find other containers, a.k.a. "service discovery", by using the container name as a domain name.
In older days of Docker, we were told to link containers using the `--link` option. With that option, Docker would create entries in `/etc/hosts` so that one container can refer to another container by its host name. That option also arranged access to TCP ports and volumes between linked containers. This allowed creation of multicontainer services, using private TCP ports for communication that exposed nothing to processes outside the containers. Today, we are told that the `--link` option is a legacy feature, and that instead we should use `bridge` networks.
This is "service discovery" using host names or domain names. In our case, the service named `db-auth` contains a MySQL instance, and we desire to use the `db-auth` service from the `userauth` service. We'll use `AuthNet` to connect the two. The containers find each other by looking for hosts with a preconfigured hostname. With a Docker `bridge` network, the container hostnames are found using the embedded DNS server, while with the earlier `--link` option, hostnames were found via the `/etc/hosts` files created by Docker.
How do we attach a container to a bridge network?
**$ docker run -it --name db-auth --net=authnet \**
**node-web-development/db-auth**
**$ docker run -it --name userauth --net=authnet \**
**node-web-development/userauth**
One way to attach a container to a network is with the `--net=authnet` option. We'll look at a second method later.
Let's explore what we just created:
**$ docker network inspect authnet**
This prints out a large JSON object describing the network, and its attached containers. The `db-auth` container might be at the `172.19.0.2` IP address. But try pinging that address and we'll see failure:
**$ ping 172.19.0.2**
**PING 172.19.0.2 (172.19.0.2): 56 data bytes**
**Request timeout for icmp_seq 0**
**Request timeout for icmp_seq 1**
If we execute a shell in the `userauth` container, we can now ping the IP address of the `db-auth container`:
**$ docker exec -it userauth bash**
**root@1f2e3de3be6d:/usr/src/app# ping 172.19.0.2**
**PING 172.19.0.2 (172.19.0.2): 56 data bytes**
**64 bytes from 172.19.0.2: icmp_seq=0 ttl=64 time=0.126 ms**
**64 bytes from 172.19.0.2: icmp_seq=1 ttl=64 time=0.153 ms**
That is Docker container isolation in practice. Access to the container is strictly limited by the container and network topology we create. `AuthNet` is a virtual subnet living solely inside the computer. Making a TCP/IP connection to processes inside the container is limited to whatever we connect to `AuthNet`.
It's useful to look at the DNS resolver configuration inside the container:
**root@1f2e3de3be6d:/usr/src/app# cat /etc/resolv.conf**
**search gateway.sonic.net**
**nameserver 127.0.0.11**
**options ndots:0**
The `sonic.net` line comes from the laptop on which this is being executed, meaning domain name resolution will fall back to the Internet at large. The nameserver at `127.0.0.11` is the one implemented within Docker itself. It's also configured to support domain names with no dots in them, such as `db-auth` or `userauth`. This means we can ping `db-auth` and that domain name will work.
That's how service discovery works in Docker. We give a meaningful name to each service using the `--name` option when building the container. Docker then uses that meaningful name as the container's domain name. The embedded DNS server contains the name and IP address of each container. The DNS resolver configuration uses that internal DNS server to look up names. The resolution algorithm is set up to not require dots in domain names, thus simplifying setup of the service-naming structure.
Since we are conveniently inside the container, we can easily test whether the authentication service can reach the database:
**root@1f2e3de3be6d:/usr/src/app# PORT=3333 node users-add**
**Created { id: 1, username: 'me', password: 'w0rd', provider: 'local',**
**familyName: 'Einarrsdottir', givenName: 'Ashildr',**
**middleName: '', emails: '[]', photos: '[]',**
**updatedAt: '2016-03-23T04:45:29.000Z',**
**createdAt: '2016-03-23T04:45:29.000Z' }**
This behaves exactly as it has in every other instance we've run this script, proving that the Authentication service code in the `userauth` container accessed the MySQL instance in the `db-auth` container. In all the previous examples, the MySQL instance was on localhost, but now it's on what is effectively a separate computer. It's possible with Docker to deploy `db-auth` to a completely separate computer, if you like.
As a side effect, we created a user account we can later use to log in to the `Notes` application for testing.
## Creating FrontNet for the Notes application
We have the back half of our system set up in Docker container, as well as the private bridge network to connect the backend containers. We now need to set up another private bridge network, `frontnet`, and attach the other half of our system to that network.
Let's go ahead and create the `frontnet` bridge network:
**$ docker network create --driver bridge frontnet**
### MySQL for the Notes application
Dockerizing the front half of the `Notes` application will more or less follow the pattern we've already discussed.
Create a directory, `db-notes`, as a sibling of the `users` and `notes` directories. In that directory, create a Dockerfile:
FROM mysql:5.7
ENV MYSQL_RANDOM_ROOT_PASSWORD=yes
ENV MYSQL_DATABASE=notes
ENV MYSQL_USER=notes
ENV MYSQL_PASSWORD=notes
RUN sed -i "s/^#bind-address.*$/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
RUN sed -i "s/^pid-file/# pid-file/" /etc/mysql/my.cnf
RUN sed -i "s/^socket/# socket/" /etc/mysql/my.cnf
VOLUME /var/lib/mysql
EXPOSE 3306
CMD ["mysqld"]
This is almost exactly what we used before, except for the difference in user name, database name, and password.
Now we build the image:
**$ docker build -t node-web-development/db-notes .**
And then run it:
**$ docker run -it --name db-notes --net=frontnet \**
**node-web-development/db-notes**
This database will be available at the `db-notes` domain name on `frontnet`. Because it's attached to `frontnet`, it won't be reachable by containers connected to `authnet`.
### Dockerizing the Notes application
In the `notes` directory, create a file named `Dockerfile` containing the following:
FROM node:5.9.0
ENV DEBUG="notes:*,messages:*"
ENV SEQUELIZE_CONNECT="models/sequelize-docker-mysql.yaml"
ENV NOTES_MODEL="models/notes-sequelize"
ENV USERS_MODEL="models/users-rest"
ENV USER_SERVICE_URL="http://userauth:3333"
ENV PORT="3000"
ENV NOTES_SESSIONS_DIR="/sessions"
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN apt-get update -y \
&& apt-get -y install curl python build-essential git ca-certificates \
&& npm install --unsafe-perm
VOLUME /sessions
EXPOSE 3000
CMD npm run docker
This is similar to the Dockerfile we used for the authentication service. We're using the environment variables from `notes/package.json`, and the application is installed in the same way.
Because this `npm install` also runs `bower install`, we face the same permissions problem discussed earlier. We're using the `--unsafe-perm` flag so that `npm` doesn't change its user ID, but what about bower? Earlier, we discussed Bower's `--allow-root` option and the need to add that option in the `postinstall` script.
We also have a new `SEQUELIZE_CONNECT` file. Create `models/sequelize-docker-mysql.yaml` containing the following:
dbname: notes
username: notes
password: notes
params:
host: db-notes
port: 3306
dialect: mysql
This will access a database server on the `db-notes` domain name using the named database, user name, and password. These parameters of course must match the environment variables defined in `db-notes/Dockerfile`.
Notice that the `USER_SERVICE_URL` variable no longer accesses the authentication service at `localhost`, but at `userauth`. The `userauth` domain name is currently only advertised by the DNS server on `AuthNet`, but the Notes service is on `FrontNet`. This means we'll have to connect the `userauth` container to the `FrontNet` bridge network so that its name is known there as well. We'll get to that in a minute.
A new variable is `NOTES_SESSIONS_DIR` and the matching `VOLUME` declaration. If we were to run multiple `Notes` instances, they could share session data by sharing this volume.
Supporting the `NOTES_SESSIONS_DIR` variable requires one change in `app.js`:
const sessionStore = new FileStore({
path: process.env.NOTES_SESSIONS_DIR ?
process.env.NOTES_SESSIONS_DIR : "sessions"
});
Instead of a hardcoded directory name, we can use an environment variable to define the location where session data is stored. Alternatively, there are `sessionStore` implementations for various servers such as REDIS, enabling session data sharing between containers on separate host systems.
Now we can build the container image:
**$ docker build -t node-web-development/notesapp .**
And then run it as so:
**$ docker run -it --name notes --net=frontnet -p 3000:3000 \**
**node-web-development/notesapp**
This container is the one we want to publish on the Internet. The `-p` option is what lets us publish a port so the world can beat a path to our doorstep. We could also map the port number to the usual HTTP port (`80`) by using `-p 80:3000`.
You can inspect FrontNet's details now:
**$ docker network inspect frontnet**
### Putting FrontNet together
We're almost ready to test this, but for connecting the `userauth` container to `FrontNet`. So far we've created two bridge networks, with no connection between them. For Notes to use the authentication service, it must be able to access the `userauth` container.
The `userauth` container is already on `AuthNet`. We can add it to `FrontNet` in the following way:
**$ docker network connect frontnet userauth**
The `userauth` container is now attached to both bridge networks. This means the `notes` service will be able to access `userauth` for its authentication needs.
Now we can finally turn to our web browser and use the `Notes` application. The issue is which access URL to use.
Previously we'd accessed Notes using `http://localhost:3000` because it was running via the laptop OS. But it's now running inside a virtualized Linux container, and that container has its own IP address. Depending on the configuration of this virtualized Linux, the IP address might not even be visible outside our laptop.
If you are using Docker Toolbox, first find out the IP address of the `Notes` application service using the following:
**$ docker-machine ip**
Then use that IP address in the URL, such as: `http://192.168.55.101:3000`. If instead you're using Docker for Windows or Mac, you should run `docker ps`. The output of that command is another way to learn the IP address of the container, and which container has an exposed port:
In the **PORTS** column, it shows which ports are published from which container. When the listing shows `0.0.0.0` for the IP address, that port is visible to the world. In such a case, you can access Notes via `http://localhost:3000` as previously. It may instead show a fixed IP address, in which case you use that to access Notes. Twitter login will work if you reconfigure the Twitter application registration to use the IP address we just determined. But we did create a local user profile earlier while testing `AuthNet`, so we could use that to log in and test Notes.
But let's explore the current system. Compare the output of the following commands:
**$ docker network inspect frontnet**
**$ docker network inspect authnet**
You'll see that `userauth` is listed in both networks, as expected. This means that from `userauth`, you can reach hosts on both networks and, for example, pinging both `db-auth` and `db-notes` will work:
**$ docker exec -it userauth bash**
**# ping db-auth**
**PING db-auth (172.19.0.2): 56 data bytes**
**64 bytes from 172.19.0.2: icmp_seq=0 ttl=64 time=0.087 ms**
**# ping db-notes**
**PING db-notes (172.20.0.3): 56 data bytes**
**64 bytes from 172.20.0.3: icmp_seq=0 ttl=64 time=0.104 ms**
This is the only container in our system where this is true. Try accessing the other containers and try the same test. Whether this is acceptable depends on you. If a miscreant were able to break into the `userauth` container, they could access the rest of the system. Maybe we need to erect a barrier against that possibility.
There is a fairly simple solution, which is to create a third bridge network solely for the purpose of connecting `notesapp` to `userauth`:
**$ docker network create --driver bridge notesauth**
**$ docker network connect notesauth notesapp**
**$ docker network disconnect frontnet userauth**
**$ docker network connect notesauth userauth**
**$ docker network inspect authnet**
**$ docker network inspect notesauth**
**$ docker network inspect frontnet**
The `notesauth` network serves as the connector between `notes` and `userauth`. Those containers can contact each other, and now `userauth` cannot connect to `db-notes`, a service which it had no need to connect with:
**$ docker exec -it userauth bash**
**# ping db-notes**
**ping: unknown host**
If we use our browser to peruse the `Notes` application, it still works perfectly.
Accessing the Dockerized Notes app from another device In your testing, you might have whipped out a mobile computer, or another computer, and tried to use the application. This is likely to have failed, however, because of the virtual machine configuration on your laptop.
The virtual machine Docker has its own OS and network stack. By default, Docker configures this virtual machine so that it cannot be accessed from outside your laptop.
It's recommended to routinely test the application on mobile devices.
Over the next couple of sections, we'll see what configuration changes to make, depending on what you've installed on your laptop.
### Configuring remote access on Docker for Windows or Mac
Unfortunately, at the time of writing, Docker for Windows and Docker for Mac products are rapidly changing and therefore we cannot give precise steps to follow. You should consult the previosuly mentioned documentation instead.
There are two behaviors to consider:
* Whether ports published by the Docker host are visible only to a private IP address on your laptop or if those ports are forwarded to your laptop's Internet connection
* Whether software inside a Docker container connects out to the Internet as if it's behind a NAT firewall or if the Docker process proxies that traffic
At the time of writing, the out-of-the-box behavior appears to be to publish ports from Docker via your laptop's IP address. This means you can use `http://localhost` from browsers running on your laptop, and the IP address of your laptop from other devices.
The Docker application can be configured so that ports are not exported from your laptop. You'll only have access from the laptop's browser, and not from any other device.
### Configuring remote access in VirtualBox on Docker toolbox
The same considerations exist when using VirtualBox. It has different defaults, and fortunately the actions to take are well documented.
By default, with VirtualBox, TCP ports from guest machines are not exposed outside your laptop, the guest machine has a private IP address that is not available from outside the laptop, and software inside the guest machine can access the Internet as if it's behind a NAT firewall.
The issues are explained in the VirtualBox user guide. We're told that, by default, guest machines running inside VirtualBox are configured as if they are behind a NAT router. Machines behind a NAT router are able to access services outside their network, but it is difficult to go the other direction, unless you configure _port forwarding_ in the NAT router.
You might do this with your home Wi-Fi router so that, for example, you can host a website on your home network connection. In this case, the NAT router is embedded in VirtualBox, and we need to configure port forwarding in its NAT router. To do so, you start the VirtualBox GUI, select the Docker host instance, and then click on the **Settings** button:
At the bottom of the screen is a **Port Forwarding** button. Click on that:
Then add an entry so that host port `3000` maps to guest port `3000`. Presto, you'll now be able to access Notes, hosted inside the Docker instance on your laptop, from other computers.
Any ports you wish to expose outside your laptop need to be configured here.
### Exploring the Docker Toolbox VirtualBoxMachine
As long as we're poking at VirtualBox, let's take a peek under the covers of the virtual machine we just hosted these containers on. Fortunately, Docker makes this easy:
We can easily log in to the Docker Machine host and see that, yes, indeed, `boot2docker` still lives behind the scenes:
Running a `ps` command tells us that there's a full complement of Linux background processes. Most important is this group of processes, which are exactly what we started in these containers. We see the two MySQL instances and two Node.js processes started by the containers.
This innocently looks like any process list, doesn't it? But we've demonstrated that access to processes inside a container is strictly limited. How can that be if these are host OS processes?
That's the containerization technology at work, the details of which are not visible in this process listing.
If instead you've installed Docker for Windows or Mac, you also have a virtual Linux system running inside virtualization software that is not VirtualBox. There will be a command to `ssh` into that virtual Linux box. Once inside that virtual machine, you'll see a similar process list.
### Controlling the location of MySQL data volumes
The `db-auth` and `db-notes` Dockerfiles contain `VOLUME /var/lib/mysql`.
Doing this is the first step to ensuring that the database files persist even if we delete the container. As said previously, Docker containers are quick and cheap to create and delete, while databases are meant to last for years or decades.
The `VOLUME` instruction instructs Docker to create a directory outside the container and to map that directory so that it's mounted inside the container on the named path. The `VOLUME` instruction by itself doesn't control the directory name on the host computer. But at least the data is available outside the container.
The first step is to discover where Docker put the volume:
**$ docker inspect --format '{{json .Mounts}}' db-notes**
**[{**
**"Name":"e05b81e4dee1c71f1e1a48e119c48a35bfdc9e0bec742b20577b71fbc71d294b",**
**"Source":"/mnt/sda1/var/lib/docker/volumes/e05b81e4dee1c71f1e1a48e119c48a35bfdc9e0bec742b20577b71fbc71d294b/_data",**
**"Destination":"/var/lib/mysql",**
**"Driver":"local",**
**"Mode":"",**
**"RW":true,**
**"Propagation":""**
**}]**
That's not exactly a user-friendly pathname, but you can snoop into that directory and see that indeed the MySQL database is stored there. You'll have to do it this way if you've installed Docker Toolbox:
**$ docker-machine ssh**
**$ sudo ls /mnt/path/to/volume/location**
If you've installed Docker for Windows or Mac, consult the documentation on how to access the Docker host.
We make these user-friendly pathnames with the following command:
**$ docker volume create --name db-auth-data**
**$ docker volume create --name db-notes-data**
As the command string implies, this creates a volume. We can then recreate the container so it references the volume like so:
**$ docker run -it --name db-auth --net=authnet \**
**--volume=db-auth-data:/var/lib/mysql:rw \**
**node-web-development/db-auth**
**$ docker run -it --name db-notes --net=frontnet \**
**--volume=db-notes-data:/var/lib/mysql:rw \**
**node-web-development/db-notes**
The `--volume` argument is what connects the exported volume to a specific location in the filesystem.
And now the volume location has a nicer pathname:
**$ docker volume inspect db-auth-data**
**[{**
**"Name": "db-auth-data", "Driver": "local",**
**"Mountpoint": "/mnt/sda1/var/lib/docker/volumes/db-auth-data/_data"**
**}]**
This is improved, but all we've done is make the pathname easier to read. We haven't controlled the directory location.
Docker allows us to specify the volume mapping in another way:
**docker .. --volume=/Host/Path:/Container/Path ..**
This says to map a specific directory on the host into the container.
Unfortunately, we run into a problem with the MySQL container and mapping its volume from inside a VirtualBox Docker Engine. Docker does configure VirtualBox so that any path under `/Users` is automatically available for containers to share data on the host computer filesystem. But this only works for certain user IDs. Many containers, like MySQL, execute their processes under a specific user ID, which then does not map correctly to the host computer filesystem.
### Note
It's a known issue which you can read about; refer to <https://github.com/boot2docker/boot2docker/issues/581> and <https://github.com/boot2docker/boot2docker/issues/1101>.
This exact issue is one of the primary reasons why Docker for Windows or Mac was created. It fixes this problem and allows you to use host paths in the volume mapping, with the Docker software correctly mapping file permissions.
When running with Docker for Windows or Mac, you do not have to run the `docker volume create` command shown earlier, and can instead run the following command:
**$ docker run -it --name db-auth --net=authnet \**
**--volume=./db-auth/data:/var/lib/mysql:rw \**
**node-web-development/db-auth**
**$ docker run -it --name db-notes --net=frontnet \**
**--volume=./db-notes/data:/var/lib/mysql:rw \**
**node-web-development/db-notes**
This uses `db-auth/data` and `db-notes/data` for the data directories.
Because the volumes exist on the host filesystem, we can read and write these files using normal Linux tools. That makes it easy to perform backups, copy volume data to other systems, and so on. But do this with care since the processes running inside the container may not be compatible with their files being manipulated.
For example, the MySQL server should be shut down before attempting to copy the raw database files. And importing raw MySQL database files into another server has to be done with care.
## Deploying to the cloud with Docker compose
This is cool, but we need to take all this learning and apply it to the task we set ourselves. Namely, to deploy the `Notes` application on a public Internet server with a fairly high degree of security. We've demonstrated that, with Docker, the `Notes` application can be decomposed into four containers that have a high degree of isolation from each other and from the outside world. It's claimed that this greatly improves security, while giving huge deployability benefits. Deployment containers are described with Dockerfiles that are used to build deployment images, which can be easily deployed to target systems.
Docker Compose (<https://docs.docker.com/compose/overview/>) lets us easily define and run several Docker containers together as a complete application. It uses a YAML file, `docker-compose.yml`, to describe the containers, their dependencies, the virtual networks, and the volumes. While we'll be using it to describe the deployment onto a single host machine, Compose can be used for multimachine deployments, especially when combined with Docker Swarm.
The `docker-compose` command is used not only to build a set of containers and intercontainer configuration, but also to deploy the whole lot to a local or remote Docker server.
### Docker compose files
Let's start by creating a directory, `compose`, as a sibling to the `users` and `notes` directories. In that directory, create a file named `docker-compose.yml`:
version: '2'
services:
db-auth:
build: ../db-auth
container_name: db-auth
networks:
- authnet
volumes:
- db-auth-data:/var/lib/mysql
userauth:
build: ../users
container_name: userauth
networks:
- authnet
- notesauth
expose:
- 3333
depends_on:
- db-auth
restart: always
db-notes:
build: ../db-notes
container_name: db-notes
networks:
- frontnet
volumes:
- db-notes-data:/var/lib/mysql
notesapp:
build: ../notes
container_name: notesapp
networks:
- frontnet
- notesauth
expose:
- 3000
ports:
- "3000:3000"
depends_on:
- db-notes
- userauth
restart: always
networks:
authnet:
driver: bridge
frontnet:
driver: bridge
notesauth:
driver: bridge
volumes:
db-auth-data:
db-notes-data:
That's the description of the entire `Notes` application deployment. It's at a fairly high level of abstraction, roughly equivalent to the options on the command-line tools we've used so far. Further details are located inside the Dockerfiles, which are referenced from this `Compose` file.
The `version` line says that this is a version 2 `Compose` file. Previous versions of `Compose` did not have this line and had a number of differences to the contents of the `Compose` file.
There are three major sections used here: _services_ , _volumes_ , and _networks_. The services section describes the containers being used, the networks section, of course, describes the networks, and the volumes section, of course, describes the volumes. The contents of each section match exactly the commands we ran earlier.
For example, each of the three networks in our system is a `bridge` network. This fact is described in the `Compose` file.
The `build` attribute on containers specifies a directory containing a Dockerfile. That directory contains everything related to building the specific container. We have four such containers: `db-auth`, `db-notes`, `userauth`, and `notesapp`.
It's possible to directly use a Docker image without having to write a Dockerfile. Instead of using the `build` attribute, you use the `image` attribute listing the image name. We could have used this approach for the two MySQL containers, except there were customizations required which could not be described in the `Compose` file.
The `container_name` attribute is equivalent to the `--name` attribute and specifies a user-friendly name for the container.
The `networks` attribute lists the networks to which this container must be connected and is exactly equivalent to the `--net` argument. The networks in question are, of course, listed in the `networks` section later in the file.
The `expose` attribute declares which ports are exposed from the container. The exposed ports are not published outside the host machine, however. The `ports` attribute declares the ports which are to be published. In the ports declaration, we have two port numbers: the first being the published port number and the second being the port number inside the container. This is exactly equivalent to the `-p` option used earlier.
The `depends_on` attribute lets us control the startup order. A container that depends on another will wait to start until the depended-upon container is running.
The `volumes` attribute describes mappings of a container directory to a `host` directory. In this case, we've defined two volume names, `db-auth-data` and `db-notes-data`, and then used them for the volume mapping. You can, of course, inspect the volume location using the `docker` command line:
**$ docker volume inspect compose_db-notes-data**
**$ docker volume inspect compose_db-auth-data**
The preceding volume configuration is correct when running under Docker Toolbox. Because of limitations while using VirtualBox, `docker-compose.yml` cannot specify a host-side pathname for the volume. But, if you're instead using Docker for Windows or Mac, you can take a different approach in `docker-compose.yml`.
First, comment out the `volumes` section because you won't need it. Then change the `volumes` attribute of `db-auth` and `db-notes` as follows:
db-auth:
..
volumes:
# - db-auth-data:/var/lib/mysql
- ../db-auth/data:/var/lib/mysql
db-notes:
..
volumes:
# - db-notes-data:/var/lib/mysql
- ../db-notes/data:/var/lib/mysql
This is the same configuration change we made earlier. It uses `db-auth/data` and `db-notes/data` as the data directories for their respective database containers.
The `restart` attribute controls what happens if or when the container dies. When a container starts, it runs the program named in the `CMD` instruction, and when that program exits, the container exits. But what if that program is meant to run _forever_ , shouldn't Docker know it should restart the process? We could use a background process supervisor, like Supervisord or PM2. But, we can also use the Docker restart option.
The restart attribute can take one of the following four values:
* `no`: Do not restart
* `on-failure:count`: Restart up to _N_ times
* `always`: Always restart
* `unless-stopped`: Start the container unless it was explicitly stopped
### Running the Notes application with Docker Compose
Before deploying this to a server, let's run it on our laptop using `docker-compose`:
**$ docker stop db-notes userauth db-auth notesapp**
**db-notes**
**userauth**
**db-auth**
**notesapp**
**$ docker rm db-notes userauth db-auth notesapp**
**db-notes**
**userauth**
**db-auth**
**notesapp**
We first needed to stop and delete the existing containers. Because the `Compose` file wants to launch containers with the same names as we'd built earlier, we also have to remove the existing containers:
**$ docker-compose build**
**Building db-auth**
**.. lots of output**
**$ docker-compose up**
**Creating db-auth**
**Recreating compose_db-notes_1**
**Recreating compose_userauth_1**
**Recreating compose_notesapp_1**
**Attaching to db-auth, db-notes, userauth, notesapp**
Once that's done, we can build the containers, `docker-compose build`, and then start them running, `docker-compose up`.
The first test is to execute a shell in `userauth` to run our user database script:
**$ docker exec -it userauth bash**
**# PORT=3333 node users-add.js**
**Created { id: 1, username: 'me', password: 'w0rd', provider: 'local',**
**familyName: 'Einarrsdottir', givenName: 'Ashildr',**
**middleName: '', emails: '[]', photos: '[]',**
**updatedAt: '2016-03-24T01:22:38.000Z',**
**createdAt: '2016-03-24T01:22:38.000Z' }**
Now that we've proved that the authentication service will work, and by the way created a user account, you should be able to browse to the `Notes` application and run it through its paces.
You can also try pinging different containers to ensure that the application network topology has been created correctly.
### Note
If you use Docker command-line tools to explore the running containers and networks, you'll see they have new names. The new names are similar to the old names, but prefixed with the string `compose_`. This is a side effect of using Docker Compose.
## Deploying to cloud hosting with Docker Compose
Now that we've verified on our laptop that the services described by the `Compose` file work as intended, we can deploy the whole thing to cloud hosting.
So far we've used Docker Machine to interact with a Docker instance on the localhost. The `docker-machine` command comes with _drivers_ supporting a long list of cloud-hosting providers. With these commands, we can create host systems preconfigured as Docker Machine from the convenience of the command line on our laptop.
In this section, we'll use the Digital Ocean service to deploy the `Notes` application. If you prefer a different cloud host, by all means use it. You'll simply have to translate certain details over to your chosen hosting provider.
After signing up for a Digital Ocean account, click on the API link in the dashboard. We need an API token to grant `docker-machine` access to the account. Go through the process of creating a token and save away the token string you're given. The Docker website has a tutorial at <https://docs.docker.com/machine/examples/ocean/>.
With the token in hand, type the following:
**$ docker-machine create --driver digitalocean --digitalocean-size 2gb --digitalocean-access-token ..TOKEN.. sandbox**
**Running pre-create checks...**
**Creating machine...**
**(sandbox) Creating SSH key...**
**(sandbox) Creating Digital Ocean droplet...**
**(sandbox) Waiting for IP address to be assigned to the Droplet...**
**Waiting for machine to be running, this may take a few minutes...**
**Detecting operating system of created instance...**
**Waiting for SSH to be available...**
**Detecting the provisioner...**
**Provisioning with ubuntu(systemd)...**
**Installing Docker...**
**Copying certs to the local machine directory...**
**Copying certs to the remote machine...**
**Setting Docker configuration on the remote daemon...**
**Checking connection to Docker...**
**Docker is up and running!**
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: `docker-machine env sandbox`.
This reaches out over the Internet to Digital Ocean's servers, causes Digital Ocean to create what they call a **Droplet** , and initializes that Droplet as a Docker Engine host. Where we would use `-d virtualbox` to create another Docker Machine on our laptop, we use `-d digitalocean` to do so on Digital Ocean.
We gave this machine the name `sandbox`.
Once the command finishes, you can see the new Droplet in your Digital Ocean dashboard.
As we do with the Docker Machine on our laptop, set up the environment variables:
**$ eval $(docker-machine env sandbox)**
With this method, we can create multiple Docker Machine instances. We switch between the machines by rerunning this command, thus specifying the desired machine instance name.
The next step is to build our containers for the new machine. Because we've switched the environment variables to point to the new server, these commands cause action to happen there rather than inside our laptop:
**$ docker-compose build**
This time, because we changed the environment variables, the build occurs on the `sandbox` machine rather than on our laptop as previously.
This will take a while. The Docker image cache on the remote machine is empty, meaning that every container build starts from scratch. Additionally, building the `notesapp` and `userauth` containers copies the entire source tree to the server and reruns `npm install` there.
The build may fail if the default memory size is 500 MB, the default on Digital Ocean at the time this was written. If so, the first thing to try is resizing the memory on the host to at least 2 GB.
Once the build is finished, launch the containers on the remote machine:
**$ docker-compose up**
Once the containers start, you should test the `userauth` container as we've done previously. Execute a shell in `userauth` to test and set up the user database:
**$ docker exec -it userauth bash**
**# PORT=3333 node users-add.js**
**Created { id: 1, username: 'me', password: 'w0rd', provider: 'local',**
**familyName: 'Einarrsdottir', givenName: 'Ashildr',**
**middleName: '', emails: '[]', photos: '[]',**
**updatedAt: '2016-03-24T01:22:38.000Z',**
**createdAt: '2016-03-24T01:22:38.000Z' }**
As mentioned previously, this verifies that the `userauth` service works, that the remote containers are set up, and that we can proceed to using the `Notes` application.
The question is: What's the URL to use? We don't have a domain name assigned, but there is an IP address for the server.
Run the following command:
**$ docker-machine ip sandbox**
**159.203.105.135**
Docker tells you the IP address, which you should use as the basis of the URL.
This is much simpler than when we deployed to Docker containers on our laptop. In this case, there's no virtual machine between the containers and the host system. The ports exposed from Docker containers on the Docker host are simply visible to the Internet.
With Notes deployed to the remote server, you should check out all the things we've looked at previously. The three bridge networks should exist, as shown previously, with the same limited access between containers. The only public access should be port `3000` on the `notesapp` container. If you reconfigure the `Twitter` application to recognize the server's IP address, you should be able to log in to Notes using a Twitter account. By now, you know the drill.
Because our database containers mount a volume to store the data, let's see where that volume landed on the server:
**$ docker volume ls**
**DRIVER VOLUME NAME**
**local compose_db-auth-data**
**local compose_db-notes-data**
Those are the expected volumes, one for each container:
**$ docker volume inspect compose_db-auth-data compose_db-notes-data**
**[**
**{**
**"Name": "compose_db-auth-data",**
**"Driver": "local",**
**"Mountpoint":**
**"/var/lib/docker/volumes/compose_db-auth-data/_data",**
**"Labels": null**
**},**
**{**
**"Name": "compose_db-notes-data",**
**"Driver": "local",**
**"Mountpoint":**
**"/var/lib/docker/volumes/compose_db-notes-data/_data",**
**"Labels": null**
**}**
**]**
Those are the directories, but they're not located on our laptop. Instead they're on the remote server. Accessing these directories means logging into the remote server to take a look:
**$ docker-machine ssh sandbox**
**Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-27-generic x86_64)**
*** Documentation: https://help.ubuntu.com/**
**New release '16.04 LTS' available.**
**Run 'do-release-upgrade' to upgrade to it.**
**Last login: Sat Apr 30 19:09:01 2016 from ###.###.###.###**
**root@sandbox:~# docker volume ls**
**DRIVER VOLUME NAME**
**local compose_db-auth-data**
**local compose_db-notes-data**
From this point, you can inspect the directories corresponding to these volumes and see that indeed they contain MySQL configuration and data files.
You'll also find that the Docker command-line tools will work with no configuration such as setting environment variables.
Once you're satisfied that Notes is working on the remote server, you can shut it down and remove it as so:
**$ docker-compose stop**
**Stopping notesapp ... done**
**Stopping userauth ... done**
**Stopping db-notes ... done**
**Stopping db-auth ... done**
This shuts down all the containers at once.
**$ docker-machine stop sandbox**
**Stopping "sandbox"...**
**Machine "sandbox" was stopped.**
This shuts down the remote machine. The Digital Ocean dashboard will show that the Droplet has stopped.
At this point, you can use the Digital Ocean dashboard to save a snapshot of the Droplet. This way you can go ahead and delete the Droplet, but still reinstate it any time you like.
**$ docker-machine rm sandbox**
**About to remove sandbox**
**Are you sure? (y/n): y**
**Successfully removed sandbox**
And, if you're truly certain you want to delete the machine, the preceding command does the deed. As soon as you do this, the Droplet will be erased from your Digital Ocean dashboard.
# Summary
This chapter has been quite a journey in learning two ways to deploy Node.js applications to a production server.
You started by reviewing the `Notes` application architecture and how that will affect deployment. That let you understand what you had to do for server deployment.
Then you learned the traditional way to deploy services on Linux using an init script. The `PM2` command is a useful tool for managing background processes. You also learned how to provision a remote server using a virtual machine hosting service.
Then you took a long trip into the land of Docker, a new and exciting system for deploying services on machines. You learned how to write a Dockerfile so that Docker knows how to construct a service image. You learned several ways to deploy Docker images on our laptop or on a remote server. And you learned how to describe a multicontainer application using Docker Compose.
You're almost ready to wrap up this book. You've learned a lot along the way, but you have one final thing to cover.
While a core principle of test-driven development is to write the unit tests before writing the application, we've done it the other way around and put the chapter about unit testing at the end of this book, which is the next and final chapter in this book. That's not to say unit testing is unimportant because it is extremely important. But, to jump-start your knowledge of application development with Node.js and Express, we had to first cover that technology stack.
# Chapter 11. Unit Testing
Unit testing has become a primary part of good software development practice. It is a method by which individual units of source code are tested to ensure proper functioning. Each unit is theoretically the smallest testable part of an application. In a Node.js application, you might consider each module as a unit.
In unit testing, each unit is tested separately, isolating the unit under test as much as possible from other parts of the application. If a test fails, you would want it to be due to a bug in your code rather than a bug in the package that your code happens to use. Common technologies to use are mock objects and other methods to present a faked dependency implementation. We will focus on that testing model in this chapter.
Functional testing, on the other hand, doesn't try to test individual components, but instead it tests the whole system. Generally speaking, unit testing is performed by the development team, and functional testing is performed by a QA or Quality Engineering (QE) team. Both testing models are needed to fully certify an application. An analogy might be that unit testing is similar to ensuring that each word in a sentence is correctly spelled, while functional testing ensures that the paragraph containing that sentence has a good structure. We'll also do a little bit of functional testing.
Now that we've written several chunks of software in this book, let's use that software to explore unit test implementation.
# Testing asynchronous code
The asynchronous nature of the Node.js platform means accounting for asynchronous behavior in tests. Fortunately, the Node.js unit test frameworks help in dealing with this, but it's worth spending a few moments considering the underlying problem.
Consider a code snippet like this, which you could save in a file named `deleteFile.js`:
const fs = require('fs');
exports.deleteFile = function(fname, callback) {
fs.stat(fname, (err, stats) => {
if (err)
callback(new Error(`the file ${fname} does not exist`));
else {
fs.unlink(fname, err2 => {
if (err)
callback(new Error(`could not delete ${fname}`));
else callback();
});
}
});
};
The nature of asynchronous code is such that its execution order is nonlinear, meaning that there is a complex relationship between time and the lines of code. Since this is the real world, and not science fiction, we don't have a time machine (blue box or not) to help us traverse the web of time, and therefore, we must rely on software tools. The code is not executed one line after another, but each callback is called according to the flow of events. This snippet, like many written with Node.js, has a couple of layers of callback, making the result arrive in an indeterminate amount of time in the future.
Testing the `deleteFile` function can be accomplished with this code which you can save in `test-deleteFile.js`:
const df = require('./deleteFile');
df.deleteFile("no-such-file", err => {
// the test passes if err is an Error with the message
// "the file no-such-file does not exist"
// otherwise the test fails
});
This is what we call a negative test. It verifies that the failure path actually executes. It's relatively easy to verify which path was taken within the `deleteFile` function, by inspecting the `err` variable. But, what if the callback is never called? That would also be a failure of the `deleteFile` function, but how do you detect that condition? You might be asking, how could it be that the callback is never called? The behavior of file access over NFS includes conditions where the NFS server is wedged and filesystem requests never finish, in which case the callbacks shown here would never be called.
# Assert – the simplest testing methodology
Node.js has a useful testing tool built-in with the `assert` module. It's not any kind of testing framework but simply a tool that can be used to write test code by making assertions of things that must be true or false at a given location in the code.
The `assert` module has several methods providing various ways to assert conditions that must be true (or false) if the code is properly functioning.
The following is an example of using `assert` for testing, providing an implementation of `test-deleteFile.js`:
const fs = require('fs');
const assert = require('assert');
const df = require('./deleteFile');
df.deleteFile("no-such-file", (err) => {
assert.throws(
function() { if (err) throw err; },
function(error) {
if ((error instanceof Error)
&& /does not exist/.test(error)) {
return true;
} else return false;
},
"unexpected error"
);
});
If you are looking for a quick way to test, the `assert` module can be useful when used this way. If it runs and no messages are printed, then the test passes.
**$ node test-deleteFile.js**
The assert module is used by many of the test frameworks as a core tool for writing test cases. What the test frameworks do is create a familiar test suite and test case structure to encapsulate your test code.
There are many styles of assertion libraries available in contributed modules. Later in this chapter, we'll use the Chai assertion library (<http://chaijs.com/>) which gives you a choice between three different assertion styles (should, expect, and assert).
# Testing a model
Let's start our unit testing journey with the data models we wrote for the Notes application. Because this is unit testing, the models should be tested separately from the rest of the Notes application.
In the case of most of the Notes models, isolating their dependencies implies creating a mock database. Are you going to test the data model or the underlying database? Testing a data model and not mocking out the database means that to run the test, one must first launch the database, making that a dependency of running the test. On the other hand, avoiding the overhead of launching a database engine means that you will have to create a fake Sequelize implementation. That does not look like a productive use of our time. One can argue that testing a data model is really about testing the interaction between your code and the database, that mocking out the database means not testing that interaction, and therefore we should test our code against the database engine used in production.
With that line of reasoning in mind, we'll skip mocking out the database, and test the models against a real database server. Instead of running the test against the live production database, it should be run against a database containing test data.
To simplify launching the test database, we'll use Docker to start and stop a version of the Notes application that's set up for testing.
## Mocha and Chai the chosen test tools
If you haven't already done so, duplicate the source tree to use in this chapter. For example, if you had a directory named `chap10`, create one named `chap11` containing everything from `chap10`.
In the `notes` directory, create a new directory named `test`.
Mocha (<http://mochajs.org/>) is one of many test frameworks available for Node.js. As you'll see shortly, it helps us write test cases and test suites, and it provides a test results reporting mechanism. It was chosen over the alternatives because it supports Promise's.
While in the `notes` directory, type this to install Mocha and Chai:
**$ npm install mocha@2.x chai@3.x --save-dev**
We saw similar commands plenty of times, but this time, we used `--save-dev` rather than the `--save `we saw earlier. This new option saves the package name to the `devDependencies` list in `package.json` rather than the `dependencies` list. The idea is to record which dependencies to use in production and which are used in development or testing environments.
We only want Mocha and Chai installed on a development machine, not on a production machine. With npm, installing, the production version of our code is done this way:
**$ npm install --production**
Alternatively, it can be done as follows:
**$ NODE_ENV=production npm install**
Either approach causes npm to skip installing packages listed in `devDependencies`.
In `compose/compose-docker.yml`, we should then add this to both the `userauth` and `notesapp` sections:
environment:
- NODE_ENV="production"
When the production deployment Dockerfile executes `npm install`, this ensures that development dependencies are not installed.
## Notes model test suite
Because we have several Notes models, the test suite should run against any model. We can write tests using the Notes model API we developed, and an environment variable should be used to declare the model to test.
In the `test` directory, create a file named `test-model.js` containing this as the outer shell of the test suite:
'use strict';
const assert = require('chai').assert;
const model = require(process.env.MODEL_TO_TEST);
describe("Model Test", function() {
..
});
The Chai library supports three flavors of assertions. We're using the `assert` style here, but it's easy to use a different style if you prefer. For the other styles supported by Chai, see <http://chaijs.com/guide/styles/>.
We'll specify the Notes model to test with the `MODEL_TO_TEST` environment variable. For the models that also consult environment variables, we'll need to supply that configuration as well.
With Mocha, a test suite is contained within a `describe` block. The first argument is descriptive text, which you use to tailor presentation of test results.
Rather than maintaining a separate test database, we can create one on the fly while executing tests. Mocha has what are called "hooks" which are functions executed before or after test case execution. The hook functions let you the test suite author, set up and tear down required conditions for the test suite to operate as desired. For example, to create a test database with known test content.
describe("Model Test", function() {
beforeEach(function() {
return model.keylist().then(keyz => {
var todel = keyz.map(key => model.destroy(key));
return Promise.all(todel);
})
.then(() => {
return Promise.all([
model.create("n1", "Note 1", "Note 1"),
model.create("n2", "Note 2", "Note 2"),
model.create("n3", "Note 3", "Note 3")
]);
});
});
..
});
This defines a `beforeEach` hook, which is executed before every test case. The other hooks are `before`, `after`, `beforeEach`, and `afterEach`. The Each hooks are triggered before or after each test case execution.
This uses our Notes API to first delete all notes from the database (if any) and then create a set of new notes with known characteristics. This technique simplifies tests by ensuring that we have known conditions to test against.
We also have a side effect of testing the `model.keylist` and `model.create` methods.
In Mocha, test cases are written using an `it` block contained within a `describe` block. You can nest the `describe` blocks as deeply as you like. Add the following `beforeEach` block as shown:
describe("check keylist", function() {
it("should have three entries", function() {
return model.keylist().then(keyz => {
assert.equal(3, keyz.length, "length 3");
});
});
it("should have keys n1 n2 n3", function() {
return model.keylist().then(keyz => {
keyz.forEach(key => {
assert.match(key, /n[123]/, "correct key");
});
});
});
it("should have titles Node #", function() {
return model.keylist().then(keyz => {
var keyPromises = keyz.map(key => model.read(key));
return Promise.all(keyPromises);
})
.then(notez => {
notez.forEach(note => {
assert.match(note.title, /Note [123]/);
});
});
});
});
The idea is of course to call Notes API functions, then to test the results to check whether they matched the expected results.
This `describe` block is within the outer `describe` block. The descriptions given in the `describe` and `it` blocks are used to make the test report more readable.
### Tip
It is important with Mocha to not use arrow functions in the `describe` and `it` blocks. By now, you will have grown fond of these because of how much easier they are to write. But, Mocha calls these functions with a `this` object containing useful functions for Mocha. Because arrow functions avoid setting up a `this` object, Mocha would break.
You'll see that we used a few arrow functions here. It's the function supplied to the `describe` or `it` block, which must be a traditional `function` declaration. The others can be arrow functions.
How does Mocha know whether the test code passes? How does it know when the test finishes? This segment of code shows one of the three methods.
Namely, the code within the `it` block can return a Promise object. The test finishes when the promise finishes, and it passes or fails depending on whether the Promise concludes successfully or not.
Another method for writing tests in Mocha is with non-asynchronous code. If that code executes without throwing an error then the test is deemed to have passed. Assertion libraries such as Chai are used to assist writing checks for expected conditions. Any assertion library can be used, so long as it throws an error.
In the tests shown earlier, we did use Chai assertions to check values. However, those assertions were performed within a Promise. Remember that Promises catch errors thrown within the `.then` functions, which will cause the Promise to fail, which Mocha will interpret as a test failure.
The last method for writing tests in Mocha is used for asynchronous code. You write the `it` block callback function so that it takes an argument. Mocha supplies a callback function to that argument, and when your test is finished, you invoke that callback to inform Mocha whether the test succeeded or failed.
it("sample asynchronous test", function(done) {
performAsynchronousOperation(arg1, arg2, function(err, result) {
if (err) return done(err); // test failure
// check attributes of result against expected result
if (resultShowsFail) return done(new Error("describe fail");
done(); // Test passes
});
});
Using Mocha to test asynchronous functions is simple. Call the function and asynchronously receive results, verifying that the result is what's expected, then call `done(err)` to indicate a fail or `done()` to indicate a pass.
### Configuring and running tests
We have more tests to write, but let's first get set up to run the tests.
The simplest model to test is the in-memory model. Let's add this to the `scripts` section of `package.json`:
"test-notes-memory": "MODEL_TO_TEST=../models/notes-memory mocha",
Then, we can run it as follows:
**$ npm run test-notes-memory**
**> notes@0.0.0 test-notes-memory /Users/david/chap11/notes**
**> MODEL_TO_TEST=../models/notes-memory mocha**
**Model Test**
**check keylist**
****
**✓**
**should have three entries**
****
**✓**
**should have keys n1 n2 n3**
****
**✓**
**should have titles Node #**
**3 passing (23ms)**
The `mocha` command is used to run the test suite. With no arguments, it looks in the `test` directory and executes everything there. Command-line arguments can be used to tailor this, so you can run a subset of tests or change the reporting format.
### More tests for the Notes model
That wasn't enough to test much, so let's go ahead and add the some more tests:
describe("read note", function() {
it("should have proper note", function() {
return model.read("n1").then(note => {
assert.equal(note.key, "n1");
assert.equal(note.title, "Note 1");
assert.equal(note.body, "Note 1");
});
});
it("Unknown note should fail", function() {
return model.read("badkey12")
.then(note => { throw new Error("should not get here"); })
.catch(err => {
// this is expected, so do not indicate error
});
})
});
describe("change note", function() {
it("after a successful model.update", function() {
return model.update("n1",
"Note 1 title changed",
"Note 1 body changed")
.then(newnote => { return model.read("n1"); })
.then(newnote => {
assert.equal(newnote.key, "n1");
assert.equal(newnote.title, "Note 1 title changed");
assert.equal(newnote.body, "Note 1 body changed");
});
})
});
describe("destroy note", function() {
it("should remove note", function() {
return model.destroy("n1").then(() => {
return model.keylist()
.then(keyz => { assert.equal(2, keyz.length); });
})
});
it("should fail to remove unknown note", function() {
return model.destroy("badkey12")
.then(() => { throw new Error("should not get here"); })
.catch(err => {
// this is expected, so do not indicate error
});
})
});
And now, the test report:
**Model Test**
**check keylist**
**✓ should have three entries**
**✓ should have keys n1 n2 n3**
**✓ should have titles Node #**
**read note**
**✓ should have proper note**
**✓ Unknown note should fail**
**change note**
**✓ after a successful model.update**
**destroy note**
**✓ should remove note**
**✓ should fail to remove unknown note**
**8 passing (31ms)**
In these additional tests, we have a couple of negative tests. In each test that we expect to fail, we supply a `notekey` that we know is not in the database, and we then ensure that the model gives us an error.
Notice how the test report reads well. Mocha's design is what produces this sort of descriptive results report. While writing a test suite, it's useful to choose the descriptions so the report reads well.
### Testing database models
That was good, but we obviously won't run Notes in production with the in-memory Notes model. This means that we need to test all the other models. While each model implements the same API, we can easily make a mistake in one of them.
Testing the LevelUP and filesystem models is easy, just add this to the `scripts` section of `package.json`:
"test-notes-levelup": "MODEL_TO_TEST=../models/notes-levelup mocha",
"test-notes-fs": "MODEL_TO_TEST=../models/notes-fs mocha",
Then run the following command:
**$ npm run test-notes-fs**
**$ npm run test-notes-levelup**
This will produce a successful test result.
The simplest database to test is SQLite3, since it requires zero setup. We have two SQLite3 models to test, let's start with `notes-sqlite3.js`. Add the following to the `scripts` section of `package.json`:
"test-notes-sqlite3": "rm -f chap11.sqlite3 && sqlite3 chap11.sqlite3 --init models/schema-sqlite3.sql </dev/null && MODEL_TO_TEST=../models/notes-sqlite3 SQLITE_FILE=chap11.sqlite3 mocha"
This command sequence puts the test database in the `chap11.sqlite3` file. It first initializes that database using the `sqlite3` command-line tool. Note that we've connected its input to `/dev/null` because the `sqlite3` command will prompt for input otherwise. Then, it runs the test suite passing in environment variables required to run against the SQLite3 model.
Running the test suite does find an error:
**$ npm run test-notes-sqlite3**
**..**
**read note**
****
**✓ should have proper note**
**1) Unknown note should fail**
**..**
**7 passing (385ms)**
**1 failing**
**1) Model Test read note Unknown note should fail:**
**Uncaught TypeError: Cannot read property 'notekey' of undefined**
**at Statement. <anonymous> (models/notes-sqlite3.js:72:44)**
**-- > in Database#get('SELECT * FROM notes WHERE notekey = ?', [ 'badkey12' ], [Function])**
**at models/notes-sqlite3.js:68:16**
**at models/notes-sqlite3.js:67:16**
The failure indicators in this report are as follows:
* The lack of a checkmark in the report
* The line reading "1 failing"
* The stack trace at the end of the report
The failing test calls `model.read("badkey12")`, which we know does not exist. Writing negative tests paid off.
The failing line of code at `models/notes-sqlite3.js` (line 72) reads as follows:
var note = new Note(row.notekey, row.title, row.body);
It's easy enough to insert "`util.log(util.inspect(row));`" just before this and learn that, for the failing call, SQLite3 gave us a "`row`" object with the `undefined` value.
The test suite calls the `read` function multiple times with a `notekey` value that does exist. Obviously, when given an invalid `notekey` value, the query gives an empty results set and SQLite3 invokes the callback with both the `undefined` error and the `undefined` row values. This is common behavior for database modules. An empty result set isn't an error, and therefore we received no error and an undefined row.
In fact, we saw this behavior earlier with `models/notes-sequelize.js`. The equivalent code in `models/notes-sequelize.js` does the right thing, and it has a check which we can adapt. Let's rewrite the `read` function in `models/notes-sqlite.js` to this:
exports.read = function(key) {
return exports.connectDB().then(() => {
return new Promise((resolve, reject) => {
db.get("SELECT * FROM notes WHERE notekey = ?",
[ key ], (err, row) => {
if (err) reject(err);
**else if (!row) {**
**reject(new Error("No note found for " + key));**
**}** else {
var note = new Note(row.notekey,
row.title, row.body);
log('READ '+ util.inspect(note));
resolve(note);
}
});
});
});
};
This is simple, we just check whether `row` is undefined and, if so, throw an error. While the database doesn't see an empty results set as an error, Notes does. Further, Notes already knows how to deal with a thrown error.
Make this change and the test passes.
This is the bug we referred to in Chapter 7, _Data Storage and Retrieval_. We simply forgot to check for this condition in this particular method. Thankfully, our diligent testing caught the problem. At least that's the story to tell the managers rather than telling them that we forgot to check for something we already knew could happen.
Now that we've fixed `models/notes-sqlite3.js`, let's also test `models/notes-sequelize.js` using the SQLite3 database. To do this, we need a connection object to specify in the `SEQUELIZE_CONNECT` variable. While we can reuse the existing one, let's create a new one. Create a file named `test/sequelize-sqlite.yaml` containing this:
dbname: notestest
username:
password:
params:
dialect: sqlite
storage: notestest-sequelize.sqlite3
logging: false
This way, we don't overwrite the "production" database instance with our test suite. Since the test suite destroys the database it tests, it must be run against a database we are comfortable destroying. The `logging` parameter turns off the voluminous output Sequelize produces so that we can read the test results report.
Add the following to the `scripts` section of `package.json`:
"test-notes-sequelize-sqlite": "MODEL_TO_TEST=../models/notes-sequelize SEQUELIZE_CONNECT=test/sequelize-sqlite.yaml mocha",
Then run the test suite:
**$ npm run test-notes-sequelize-sqlite**
**..**
**8 passing (2s)**
And, we pass with flying colors!
We've been able to leverage the same test suite against multiple Notes models. We even found a bug in one model. But, we have two test configurations remaining to test. Our test matrix reads as follows:
* `models-fs`: PASS
* `models-memory`: PASS
* `models-levelup`: PASS
* `models-sqlite3`: 1 failure, now fixed
* `models-sequelize` with SQLite3: PASS
* `models-sequelize` with MySQL: untested
* `models-mongodb`: untested
The two untested models both require the setup of a database server. We avoided testing these combinations because setting up the database server makes it more difficult to run the test. But our manager won't accept that excuse because the CEO needs to know we've tested Notes while configured similarly to the production environment.
In production, we'll be using a regular database server, of course, with MySQL or MongoDB—the primary choices. Therefore, we need a way that incurs a low overhead to run tests against those databases because they're the production configuration. Testing against the production configuration must be so easy that we should feel no resistance in doing so. That's to ensure that tests are run against that configuration often enough for testing to make the desired impact.
# Using Docker to manage test database servers
One advantage Docker gives is the ability to install the production environment on our laptop. If the production environment is a Docker image, that image can be run just as easily on our laptop as on the cloud hosting environment. Generally speaking, it's important to replicate the production environment when running tests. Docker can make this an easy thing to do.
What we'll do in this section is demonstrate making minimal changes to the Docker environment we defined previously and develop a shell script to automate executing the Notes test suite inside the appropriate containers.
Using Docker, we'll be able to easily test against a database, and have a simple method for starting and stopping a test version of our production environment. Let's get started.
## Docker Compose to orchestrate test infrastructure
We had a great experience using Docker Compose to orchestrate the Notes application deployment. The whole system, with four independent services, is easily described in `compose/docker-compose.yml`. What we'll do is duplicate that script, then make a couple small changes required to support test execution.
Let's start by making a new directory, `test-compose`, as a sibling to the `notes`, `users`, and `compose` directories. Copy `compose/docker-compose.yml` to the newly created `test-compose` directory. We'll be making several changes to this file and a couple of small changes to the existing `Dockerfile`s.
We want to change the container and network names so our test infrastructure doesn't clobber the production infrastructure. We'll constantly delete and recreate the test containers, so to keep the developers happy, we'll leave development infrastructure alone and perform testing on separate infrastructure. By maintaining separate test containers and networks, our test scripts can do anything they like without disturbing the development or production containers.
Consider this change to the `db-auth` and `db-notes` containers:
db-auth-test:
build: ../db-auth
container_name: db-auth-test
networks:
- authnet-test
..
db-notes-test:
build: ../db-notes
container_name: db-notes-test
networks:
- frontnet-test
This is the same as earlier, but with "`-test`" appended to container and network names.
That's the first change we must make, append `-test` to every container and network name in `test-compose/docker-compose.yml`. Everything we'll do with tests will run on completely separate containers, hostnames, and networks than that of the development instance.
This change will affect the `notesapp-test` and `userauth-test` services because the database server hostnames are now `db-auth-test` and `db-notest-test`. There are several environment variables or configuration files to update.
Previously, we defined all environment variables in the `Dockerfile`. But now, we want to reuse the same containers in test and production environments, with slightly tweaked environment variables to reflect where the container is executing. This raises a question over the location, `Dockerfile` or `docker-compose.yml`, to define a given environment variable. The environment variables which must be different between the production or test environment must be defined in the corresponding `docker-compose.yml`, while all other variables can be defined in the corresponding `Dockerfile`.
userauth-test:
build: ../users
container_name: userauth-test
environment:
DEBUG: ""
NODE_ENV: "test"
SEQUELIZE_CONNECT: "userauth-test/sequelize-docker-mysql.yaml"
HOST_USERS_TEST: "localhost"
networks:
- authnet-test
- notesauth-test
depends_on:
- db-auth-test
volumes:
- ./reports-userauth:/reports
- ./userauth:/usr/src/app/userauth-test
..
notesapp-test:
build: ../notes
container_name: notesapp-test
environment:
DEBUG: ""
NODE_ENV: "test"
SEQUELIZE_CONNECT: "notesmodel-test/sequelize-docker-mysql.yaml"
USER_SERVICE_URL: "http://userauth-test:3333"
networks:
- frontnet-test
- notesauth-test
expose:
- 3000
ports:
- "3000:3000"
depends_on:
- db-notes-test
- userauth-test
volumes:
- ./reports-notes:/reports
- ./notesmodel:/usr/src/app/notesmodel-test
Again, we changed the container and network names to append `-test`. We moved some of the environment variables from `Dockerfile` to `docker-compose.yml`. Finally, we added some data volumes to mount host directories inside the container.
The existing variables, corresponding to the ones shown here, must be copied into `compose/docker-compose.yml`. As you do so, delete the variable definition from the corresponding `Dockerfile`. What we'll end up with is this arrangement:
* `compose/docker-compose.yml` holding environment variables for the production environment
* `test-compose/docker-compose.yml` holding environment variables for the test environment
* `Dockerfile`s hold the environment variables common to both environments
An option is to not record any environment variables in `Dockerfile`s, and instead put them all in the two `docker-compose.yml` files. You'd avoid the decision of what goes where but end up with duplicated variables with identical values. Forgetting to update variable definitions in both locations risks potential disasters.
Another thing to do is to set up directories to store test code. A common practice in Node.js projects is to put test code in the same directory as the application code. That would mean avoiding copying the test code to a production server, or when publishing as an npm module. As it stands the `Dockerfile`s simply copy everything from the notes and users directories into the corresponding containers. We can either change the `Dockerfile`, or we can mount the test code into the container as is done with the corresponding `volume` sections of `test-compose/docker-compose.yml`. That way, the test code is injected into the container rather than ignored while creating the container.
Let's start with these shell commands:
**$ mv notes/test test-compose/notesmodel**
**$ mkdir test-compose/userauth**
The first command moves the Notes models test suite we just created into `test-compose`, and the second sets up a directory for a test suite we're about to write. With the volume definitions shown earlier, `test-compose/notesmodel` appears as `notesmodel-test` in the notes application directory, and `test-compose/userauth` appears as `userauth-test` in the users application directory.
Now add the `test-compose/userauth/sequelize-docker-mysql.yaml` file containing the following:
dbname: userauth
username: userauth
password: userauth
params:
host: db-auth-test
port: 3306
dialect: mysql
logging: false
This is the same as `users/sequelize-docker-mysql.yaml`, but for the hostname change.
Similarly we add `test-compose/notesmodel/sequelize-docker-mysql.yaml` containing the following:
dbname: notes
username: notes
password: notes
params:
host: db-notes-test
port: 3306
dialect: mysql
logging: false
Again, this is the same as `notes/models/sequelize-docker-mysql.yaml` but for the hostname change.
## Package.json scripts for Dockerized test infrastructure
Now we can add a few `package.json` lines for the Dockerized test execution. We'll see later how we'll actually run the tests under Docker.
In `notes/package.json`, add the following to the scripts section:
"test-docker-notes-sequelize-sqlite": "MODEL_TO_TEST=../models/notes-sequelize mocha -R json notesmodel-test/test-model.js >/reports/notes-sequelize-sqlite.json",
"test-docker-notes-sequelize-mysql": "MODEL_TO_TEST=../models/notes-sequelize mocha -R json notesmodel-test/test-model.js >/reports/notes-sequelize-mysql.json",
"test-docker-notes-memory": "MODEL_TO_TEST=../models/notes-memory mocha -R json notesmodel-test/test-model.js >/reports/notes-memory.json",
"test-docker-notes-fs": "MODEL_TO_TEST=../models/notes-fs mocha -R json notesmodel-test/test-model.js >/reports/notes-fs.json",
"test-docker-notes-levelup": "MODEL_TO_TEST=../models/notes-levelup mocha -R json notesmodel-test/test-model.js >/reports/notes-levelup.json",
"test-docker-notes-sqlite3": "rm -f chap11.sqlite3 && sqlite3 chap11.sqlite3 --init models/schema-sqlite3.sql </dev/null && MODEL_TO_TEST=../models/notes-sqlite3 SQLITE_FILE=chap11.sqlite3 mocha -R json notesmodel-test/test-model.js >/reports/notes-sqlite3.json"
We removed the `SEQUELIZE_CONNECT` variable because it's now defined in `test-compose/docker-compose.yml`.
The Mocha invocation is different now. Previously, there'd been no arguments, but now, we're executing it with `-R json notesmodel-test/test-model.js` and then redirecting `stdout` to a file. Because the test is no longer in the `test` directory, we must explicitly instruct Mocha the filename to execute. We're also, with the `-R` option, using a different results reporting format. You can leave the test results reporting as they are, but the test results would be printed on the screen mixed together with a bunch of other output. There'd be no opportunity to collect results data for publishing in a report or showing a success or failure badge on a project dashboard website. The large amount of output might make it hard to spot a test failure.
Mocha supports different reporter modules that print results in different formats. So far, we used what Mocha calls the spec reporter. The HTML reporter is useful for generating test suite documentation. With the JSON reporter (`-R json`), test results are printed as JSON on the `stdout`. We're redirecting that output to a file in `/reports`, a directory which we've defined in the volumes section.
The `test-compose/docker-compose.yml` file contains volume declarations connecting the `/reports` container directory to a directory on the host filesystem. What will happen is these files will be stored on the host in the named directories, letting us easily access the JSON test results data so that we can make a report.
In `users/package.json`, let's make a similar addition to the scripts section:
"test-docker": "mocha -R json userauth-test/test.js >/reports/userauth.json"
We still haven't written the corresponding test suite for the user authentication REST service.
## Executing tests under Docker Compose
Now we're ready to execute some of the tests inside a container. In `test-compose`, let's make a shell script called `run.sh`:
docker-compose up --build --force-recreate -d
docker exec -it notesapp-test npm install mocha@2.4.5 chai@3.5.0
docker exec -it notesapp-test npm run test-docker-notes-memory
docker exec -it notesapp-test npm run test-docker-notes-fs
docker exec -it notesapp-test npm run test-docker-notes-levelup
docker exec -it notesapp-test npm run test-docker-notes-sqlite3
docker exec -it notesapp-test \
npm run test-docker-notes-sequelize-sqlite
docker exec -it notesapp-test \
npm run test-docker-notes-sequelize-mysql
docker-compose stop
### Tip
It's common practice to run tests out of a continuous integration system such as Jenkins. Continuous integration systems automatically run builds or tests against software products. The build and test results data is used to automatically generate status pages. Visit <https://jenkins.io/index.html>, which is a good starting point for a Jenkins job.
After quite a lot of experimentation, these "`docker-compose up`" options were found to most reliably execute the tests. These options ensure that the images are rebuilt and new containers are built from the images. The "`-d`" option puts the containers in the background, so the script can go on to the next step and execute the tests.
Next, the script uses "`docker exec`" to execute commands inside the `notesapp-test` container. With the first we ensure that Mocha and Chai are installed, and with the subsequent commands, we execute the test suite. We ran these tests earlier outside the container, which was easier to do but at the cost of test execution running in a different environment than we have in production.
We've also been able to add test execution on the Sequelize MySQL combination. If you remember, that combination was left out of our test matrix earlier because it was "too difficult" to set up a test database. With `test-compose/docker-compose.yml`, we no longer have that excuse. But, we're still a little lazy because we've left the MongoDB model untested.
Testing on MongoDB would simply require defining a container for the MongoDB database and a little bit of configuration. Visit <https://hub.docker.com/_/mongo/> for the official MongoDB container. We'll leave this as an exercise for you to try.
To run the tests, simply type:
**$ sh -x run.sh**
Lots of output will be printed concerning building the containers and executing the test commands. The test results will be left in the directories named as volumes in `test-compose/docker-compose.yml`.
# Testing REST backend services
It's now time to turn our attention to the user authentication service. We've mentioned tests of this service, saying that we'll get to them later. "Later" is now, it seems. While we can test this service as we did for the Notes models, which would be to just call the methods and check the results, we have an opportunity to test its REST API instead. The customer of this service, the Notes application, uses it through the REST API, giving us a perfect rationalization to test using REST.
The approach we'll take is to use Mocha and Chai as we did earlier using the `restify` client to make REST calls inside test cases.
We've already made the `test-compose/userauth` directory. In that directory, create a file named `test.js`:
'use strict';
const assert = require('chai').assert;
const restify = require('restify');
const url = require('url');
var usersClient;
describe("Users Test", function() {
before(function() {
usersClient = restify.createJsonClient({
url: url.format({
protocol: 'http',
hostname: process.env.HOST_USERS_TEST,
port: process.env.PORT
}),
version: '*'
});
usersClient.basicAuth('them',
'D4ED43C0-8BD6-4FE2-B358-7C0E230D11EF');
});
..
});
This sets up Mocha and the Restify client. The `HOST_USERS_TEST` environment variable specifies the hostname to run the test against. This variable was already set in `test-compose/docker-compose.yml` to "`localhost`". The `before` hook, used to set up the REST client, is run once at the beginning of the test suite:
beforeEach(function() {
return new Promise((resolve, reject) => {
usersClient.post('/find-or-create', {
username: "me", password: "w0rd", provider: "local",
familyName: "Einarrsdottir", givenName: "Ashildr",
middleName: "", emails: [], photos: []
},
(err, req, res, obj) => {
if (err) reject(err);
else resolve();
});
});
});
afterEach(function() {
return new Promise((resolve, reject) => {
usersClient.del('/destroy/me', (err, req, res, obj) => {
if (err) reject(err);
else resolve();
});
});
});
This uses the API to create our test account before each test case execution, then used again later to delete that account:
describe("List user", function() {
it("list created users", function() {
return new Promise((resolve, reject) => {
usersClient.get('/list', (err, req, res, obj) => {
if (err) reject(err);
else if (obj.length <= 0)
reject(new Error("no users found"));
else resolve();
});
});
});
});
Now, we can turn to testing some API methods, such as the `/list` operation.
We'd already guaranteed that there is an account, in the `before` method, so `/list` should give us an array with at least one entry.
This particular `testcase` can be written using Mocha's support for asynchronous test cases rather than using a Promise object.
describe("List user", function() {
it("list created users", function(done) {
usersClient.get('/list', (err, req, res, obj) => {
if (err) done(err);
else if (obj.length <= 0)
done(new Error("no users found"));
else done();
});
});
});
You should take the approach you prefer. Maybe as you grow comfortable with the Promise object, you'll start applying it everywhere.
This approach uses the traditional Node.js asynchronous coding model. The two are equivalent, other than the lines of code. Perhaps, for this test, this implementation is preferable:
describe("find user", function() {
it("find created users", function() {
return new Promise((resolve, reject) => {
usersClient.get('/find/me', (err, req, res, obj) => {
if (err) reject(err);
else if (!obj)
reject(new Error("me should exist"));
else resolve();
});
});
});
it("fail to find non-existent users", function() {
return new Promise((resolve, reject) => {
usersClient.get('/find/nonExistentUser',
(err, req, res, obj) => {
if (err) resolve();
else if (!obj) resolve();
else reject(new Error("nonExistentUser should not exist"));
});
});
});
});
We can check the `/find` operation in two ways, looking for the account we know exists, and for the one we know does not exist. In the first case, we indicate failure if the user account is for some reason not found. In the second, we indicate failure if the user account is found:
describe("delete user", function() {
it("delete nonexistent users", function() {
return new Promise((resolve, reject) => {
usersClient.del('/destroy/nonExistentUser',
(err, req, res, obj) => {
if (err) resolve();
else reject(new Error("Should throw error"));
});
});
});
});
Finally, we should check the `/destroy` operation. We already check this operation in the `after` method, where we destroy a known user account. We need to also perform the negative test and verify its behavior against an account we know does not exist.
We have already added configuration to `test-compose/docker-compose.yml` and the necessary script in `users/package.json`. Therefore, we go ahead and add these lines to the `run.sh` file:
docker exec -it userauth-test npm install mocha@2.4.5 chai@3.5.0
docker exec -it userauth-test npm run test-docker
Then, execute `run.sh` to rerun the tests, and you'll see this new test run giving its results.
# Frontend headless browser testing with CasperJS
A big cost area in testing is manual tests of the user interface. Therefore, a wide range of tools have been developed to automate running tests at the HTTP level. Selenium is a popular tool implemented in Java, for example. In the Node.js world, we have a few interesting choices. The `chai-http` plugin to Chai would let us interact at the HTTP level with the Notes application, while staying within the now-familiar Chai environment. ZombieJS is a popular tool that implements a simulated browser which we can direct to visit web pages and perform simulated clicks on simulated buttons, verifying application behavior by inspecting the resulting behavior.
However, for this section, we'll use CasperJS (<http://casperjs.org>). This tool runs on top of PhantomJS, which is a headless version of Webkit. Webkit is a real browser engine that's at the heart of the Safari browser. PhantomJS encapsulates Webkit so it runs completely headless, meaning that there is no GUI window popping up on the screen during test execution. It otherwise behaves exactly as a web browser, and CasperJS can even generate screenshots if its desired to verify visual elements.
While CasperJS is installed using npm, and CasperJS scripts are written in JavaScript that looks like Node.js, the CasperJS website repeatedly says that this is not Node.js. ES-2015 constructs do not work, and while there's a `require` statement it doesn't access Node.js packages. Fortunately, it comes with a fairly rich API that supports a wide range of tasks including screen scraping and UI test automation.
CasperJS scripts are run using the `casperjs` command. When run as `casperjs test`, additional methods are made available that are useful for functional testing.
## Setup
Let's first set up the directory and other configurations:
**$ mkdir test-compose/notesui**
Then in `test-compose/docker-compose.yml`, update the volumes as follows:
notesapp-test:
..
volumes:
- ./reports-notes:/reports
- ./notesui:/usr/src/app/notesui-test
- ./notesmodel:/usr/src/app/notesmodel-test
This ensures that the directory just created appears as `notesui-test` in the application directory.
In `run.sh`, add this line to install CasperJS and PhantomJS:
docker exec -it notesapp-test npm install -g phantomjs-prebuilt@2.1.7 casperjs@1.1.0-beta5
In the script we're about to write, we need a user account that we can use to log in and perform some actions. Fortunately, we already have a script to set up a test account. In `users/package.json`, add this line to the `scripts` section:
"setupuser": "PORT=3333 node users-add",
Then in `notes/package.json`, add this line to the `scripts` section:
"test-docker-ui": "cd notesui-test && casperjs test uitest.js"
We're about to write this test script, but let's finish the setup, the final bit of which is adding these lines to `run.sh`:
docker exec -it userauth-test npm run setupuser
docker exec -it notesapp-test npm run test-docker-ui
When executed, these two lines ensure that the test user is set up, and it then runs the user interface tests.
## Improving testability in Notes UI
Adding a few `id` or `class` attributes to HTML elements can improve testability. In the test we're about to write, we'll inspect the HTML to ensure that the browser has gone to the right page, and that the application is in the expected state. We'll also be clicking on buttons. Both of these tasks are made easier if we can refer to certain HTML elements by an `id`.
In `notes/views/pageHeader.ejs`, change these lines:
<% if (user && typeof hideAddNote === 'undefined') { %>
<a class="btn btn-primary" **id="btnaddnote"** href='/notes/add'>
ADD Note</a>
<% } %>
<% if (user) { %>
<a class="btn btn-primary" **id="btnlogout"** href="/users/logout">
Log Out <span class="badge"><%= user.username %></span></a>
<% } else { %>
<a class="btn btn-primary" **id="btnloginlocal"** href="/users/login">Log in</a>
<a class="btn btn-primary" **id="btnlogintwitter"** href="/users/auth/twitter"><img width="15px" src="/images/twitter-brand-logos/TwitterLogo_white.png"/>Log in with Twitter</a>
<% } %>
In `notes/views/noteview.ejs`, make these changes:
<a class="btn btn-default" **id="btndestroynote"** href="/notes/destroy?key=<%= notekey %>" role="button">Delete</a>
<a class="btn btn-default" **id="btneditnote"** href="/notes/edit?key=<%= notekey %>" role="button">Edit</a>
In both cases, we added the `id` attributes. In writing the test code, the `id` attribute made it easier to check for or click on these buttons.
## CasperJS test script for Notes
In `test-compose/notesui`, create a file named `uitest.js` containing the following:
var notes = 'http://localhost:3000';
casper.test.begin('Can login to Notes application',
function suite(test) {
casper.start(notes, function() {
test.assertTitle("Notes");
test.assertExists('a#btnloginlocal',
"Login button is found");
this.click("a#btnloginlocal");
});
..
casper.run(function() {
test.done();
});
});
The `casper.test.begin` function contains a block of tests. You see that the callback is given a `test` object that has methods useful for testing. Inside this block, certain `casper` methods are called, the result of which is to create a queue of test instructions to perform. That queue is executed when `casper.run` is called.
The `casper.start` function must be called, well, at the start of the script. You give it a URL, as shown here, and you can optionally pass in a callback function.
The `casper.run` function must be called at the end of the script. In between these two, you'll write steps of the test scenario.
In callback functions, you can make the `test` assertions or you can call other `casper` functions that are available on `this`. In this case, the browser is on the Notes home page and we're checking a couple things to ensure that this is where the browser is located and that the browser is not logged in.
For example, because of the change we made to `notes/views/pageHeader.ejs`, the presence of `#btnloginlocal` is a sure indication that Notes is not logged in. If it were logged in, that button would not be visible and `#btnlogout` would be present instead.
When you take an action that causes an asynchronous request and response, it's necessary to start a new navigation step, that is the following:
casper.then(function() {
test.assertHttpStatus(200);
test.assertUrlMatch(/users\/login/,
'should be on /users/login');
this.fill('form', {
username: "me",
password: "w0rd"
});
this.click('button[type="submit"]');
});
We have just told the browser to click on the **Login** button. We should then end up on the `/users/login` page. We then put login parameters into the form inputs, and click on the **Submit** button.
This step is why we needed the `setupuser` script to be run:
casper.waitForSelector('#btnlogout', function() {
test.assertHttpStatus(200);
test.assertTitle("Notes");
test.assertExists('a#btnlogout', "logout button is found");
test.assertExists('a#btnaddnote', "Add Note button is found");
this.click("#btnaddnote");
});
Once we click on the login form, we need to wait for the screen to refresh. It should, of course, navigate to the Notes home page. The `waitForSelector` method waits until an element with that selector is available on the page.
In CasperJS, many functions take selector parameters. These are used to select elements in the DOM of the current page. By default, it takes CSS3 selector strings, but you can also use XPath selectors.
The final step is to click on the **Add Note** button.
casper.waitForUrl(/notes\/add/, function() {
test.assertHttpStatus(200);
test.assertTitle("Add a Note");
test.assertField("docreate", "create");
this.fill('form', {
notekey: 'testkey',
title: 'Test Note Title',
body: 'Test Note Body with various textual delights'
});
this.click('button[type="submit"]');
});
And, of course, the response to that is to go to `/notes/add`. We again check a few things to make sure that the browser has gone to the correct page. We then fill in the entry form with a dummy note and click on the **Submit** button:
casper.waitForUrl(/notes\/view/, function() {
test.assertHttpStatus(200);
test.assertTitle("Test Note Title");
test.assertSelectorHasText("p#notebody",
'Test Note Body with various textual delights');
this.click('#btndestroynote');
});
The browser should of course go to `/notes/view`. We're checking a few parameters on the screen to verify this. We then click on the **Destroy** button:
casper.waitForUrl(/notes\/destroy/, function() {
test.assertHttpStatus(200);
test.assertTitle("Test Note Title");
test.assertField("notekey", "testkey");
this.click('input[type="submit"]');
});
Once the browser gets to `/notes/destroy`, we check that the page indeed has all the right elements. We can click on the **Submit** button to verify that the note should be deleted:
casper.waitForUrl(notes, function() {
test.assertHttpStatus(200);
test.assertTitle("Notes");
test.assertExists('a#btnlogout', "logout button is found");
this.click("#btnlogout");
});
The browser should again be on the home page. Let's now verify the ability to log out by clicking on the **Logout** button:
casper.waitForUrl(notes, function() {
test.assertHttpStatus(200);
test.assertTitle("Notes");
test.assertExists('a#btnloginlocal', "Login button is found");
});
The browser should again be on the home page, but logged out. We distinguish between being logged-in and logged-out by which buttons are present.
## Running the UI test with CasperJS
Now that you have the test entered, we can run it. Looking at `run.sh`, these steps will run just the UI test:
docker-compose stop
docker-compose up --build --force-recreate -d
docker exec -it notesapp-test npm install -g phantomjs-prebuilt@2.1.7 casperjs@1.1.0-beta5
docker exec -it userauth-test npm run setupuser
docker exec -it notesapp-test npm run test-docker-ui
The last step of which will look like this:
**$ docker exec -it notesapp-test npm run test-docker-ui**
**npm info it worked if it ends with ok**
**npm info using npm@3.7.3**
**npm info using node@v5.9.0**
**npm info lifecycle notes@0.0.0~pretest-docker-ui: notes@0.0.0**
**npm info lifecycle notes@0.0.0~test-docker-ui: notes@0.0.0**
**> notes@0.0.0 test-docker-ui /usr/src/app**
**> cd notesui-test && casperjs test uitest.js**
**Test file: uitest.js**
**# Can login to Notes application**
**PASS Can login to Notes application (5 tests)**
**PASS Page title is: "Notes"**
**PASS Login button is found**
**PASS HTTP status code is: 200**
**PASS should be on /users/login**
**PASS HTTP status code is: 200**
**PASS Page title is: "Notes"**
**PASS logout button is found**
**PASS Add Note button is found**
**PASS HTTP status code is: 200**
**PASS Page title is: "Add a Note"**
**PASS "docreate" input field has the value "create"**
**PASS HTTP status code is: 200**
**PASS Page title is: "Test Note Title"**
**PASS Find "Test Note Body with various textual delights" within the selector "p#notebody"**
**PASS HTTP status code is: 200**
**PASS Page title is: "Test Note Title"**
**PASS "notekey" input field has the value "testkey"**
**PASS HTTP status code is: 200**
**PASS Page title is: "Notes"**
**PASS logout button is found**
**PASS HTTP status code is: 200**
**PASS Page title is: "Notes"**
**PASS Login button is found**
**PASS 23 tests executed in 88.227s, 23 passed, 0 failed, 0 dubious, 0 skipped.**
While this report output looks cool, you probably want to generate a test results data file so your continuous build system (Jenkins, et al.) can display a green or red dot on the dashboard as appropriate. CasperJS supports outputting XUnit results as follows:
**"test-docker-ui": "cd notesui-test && casperjs test uitest.js --xunit=/reports/notesui.xml"**
Earlier we configured Mocha to output JSON that theoretically we can use to generate a test results report. In this case XUnit test results can be used the same way.
# Summary
We've covered a lot of territory in this chapter, looking at three distinct areas of testing: unit testing, REST API testing, and UI functional tests. Ensuring that an application is well tested is an important step on the road to software success. A team which does not follow good testing practices is often bogged down with fixing regression after regression.
Testing is of course a large topic area, but with this information, you can take the steps required to improve your application quality.
We've talked about the potential simplicity of simply using the `assert` module for testing. While the test frameworks such as Mocha provide great features, we can go long ways with a simple script.
There is a place for test frameworks, such as Mocha, if only to regularize our test cases, and to produce test results reports. We used Mocha and Chai for this, and these tools were quite successful.
When starting down the unit testing road, one design consideration is mocking out dependencies. But it's not always a good use of our time to replace every dependency with a mock version.
To ease the administrative burden of running tests, we used Docker to automate setting up and tearing down the test infrastructure. Just as Docker was useful in automating deployment of the Notes application, it's also useful in automating test infrastructure deployment.
Finally, we were able to test the Notes web user interface. We can't trust that unit testing will find every bug; some bugs will only show up in the web browser.
Even so, we've only touched the beginning of what could be tested in Notes.
In this book, we've covered the gamut of Node.js development, giving you a strong foundation from which to start developing Node.js applications.
What is Node.js, and why is it an important programming platform? As professional software engineers, is it a good idea to jump onto any new programming platform just because it's new and cool? No, we should evaluate their value in implementing our applications.
Once you've decided to use Node.js, we've given you a soup-to-nuts introduction to developing software on this platform. We started with developing and using Node.js modules and using the npm package manager to manage the modules used in your application.
Express is a popular framework for developing web applications in Node.js, and we spent many chapters developing and refining an application. While Notes started as a modest note-taking application that lost everything you wrote when the server restarted, it became a full-fledged application that even included real-time commenting between multiple people. Along the way, we used several database engines (MySQL, SQLite, and MongoDB) for data storage, and the Socket.IO library for real-time communication between users. We integrated user authentication, and we looked at what's required to use OAuth2 to authenticate users from other services such as Twitter.
Distributed microservice architectures are very popular today, if only because it's a very agile approach to writing software systems. To that end, we used two different methods to develop RESTFUL services using Node.js, and we used Docker to automate not only the deployment of the application stack, but the testing infrastructure.
# Index
## A
* absolute module identifiers
* about / Module identifiers and path names
* algorithm
* used, for resolving module / Node.js's algorithm for require (module)")
* module identifiers / Module identifiers and path names
* path names / Module identifiers and path names
* application directory structure, example / An example application directory structure
* application directory structure
* example / An example application directory structure
* assert module
* used, for testing / Assert – the simplest testing methodology
* asynchronous code
* about / Data storage and asynchronous code
* testing / Testing asynchronous code
* Authnet
* implementing / Putting Authnet together
* AuthNet
* creating, for User Authentication service / Creating the AuthNet for the User Authentication service
## B
* *BSD
* Node.js, installing / Installing on Linux, *BSD, or Windows from package management systems
* Babel
* URL / Using Babel to use experimental JavaScript features
* used, for rewriting JavaScript code / Using Babel to use experimental JavaScript features
* URL, for setup / Using Babel to use experimental JavaScript features
* body-parser module
* URL / Walking through the default Express application
* boot2docker
* URL / Installing Docker on your laptop
* Bootstrap
* adding, to application templates / Adding Bootstrap to application templates
* URL / Adding Bootstrap to application templates
* grid foundation, laying / Laying the Bootstrap grid foundation
* Bootstrap Jumbotron component / View template changes supporting login/logout
* Bower
* using / Setting it up
* URL / Setting it up
* Breadcrumb component
* using / Breadcrumbs for the page header
* breakpoint / Mobile-first paradigm
## C
* callback hell
* about / ES-2015 Promises and Express router functions
* CasperJS
* used, for testing frontend headless browser / Frontend headless browser testing with CasperJS
* setting up / Setup
* testability, improving / Improving testability in Notes UI
* test script, writing / CasperJS test script for Notes
* UI test, executing / Running the UI test with CasperJS
* Chai
* used, for testing / Mocha and Chai the chosen test tools
* URL / Notes model test suite
* Chrome Developer Tools / Problem – the Notes app isn't mobile friendly
* Collection object
* URL / MongoDB model for the Notes application
* command-line tools
* running / Running and testing commands
* testing / Running and testing commands
* about / Node.js's command-line tools
* script, executing / Running a simple script with Node.js
* server, launching / Launching a server with Node.js
* CommonJS
* about / A quick note about CommonJS
* URL / A quick note about CommonJS
* cookie-parser module
* URL / Walking through the default Express application
* CRUD model / Express and the MVC paradigm
* CSS-Tricks blog
* URL / Mobile-first paradigm
* Cursor object
* URL / MongoDB model for the Notes application
* customized Bootstrap
* building / Building a customized Bootstrap
* references / Bootstrap customizers
* Cyborg theme, using / Bootstrap customizers
* Cyborg theme
* using / Bootstrap customizers
## D
* data models
* testing / Testing a model, Testing database models
* testing, with Mocha / Mocha and Chai the chosen test tools
* testing, with Chai / Mocha and Chai the chosen test tools
* test suite / Notes model test suite
* tests, configuring / Configuring and running tests
* tests, executing / Configuring and running tests
* tests, adding / More tests for the Notes model
* data storage
* about / Data storage and asynchronous code
* Debug package
* using / Logging
* URL / Logging
* default Express application
* about / Walking through the default Express application
* developer tools
* installing, on Mac OS X / Installing developer tools on Mac OS X
* installing, from source for all POSIX-like systems / Installing from source for all POSIX-like systems
* development instances, installing with nvm / Installing development instances with nvm
* Digital Ocean
* URL / Prerequisite – provisioning the databases
* directories
* as modules / Directories as modules
* div elements
* URL / Using a Modal window to compose messages
* Docker
* URL / Node.js microservice deployment with Docker, Installing Docker on your laptop
* about / Node.js microservice deployment with Docker
* installing / Installing Docker on your laptop
* starting, for Windows/Mac / Starting Docker with Docker for Windows/Mac
* containers, creating / Kicking the tires of Docker
* remote access, configuring / Configuring remote access on Docker for Windows or Mac
* used, for managing test database servers / Using Docker to manage test database servers
* package.json scripts, adding for Dockerized test infrastructure / Package.json scripts for Dockerized test infrastructure
* Docker
* for microservice deployment / Node.js microservice deployment with Docker
* Docker Compose
* about / Node.js microservice deployment with Docker
* cloud, deploying / Deploying to the cloud with Docker compose
* URL / Deploying to the cloud with Docker compose
* compose files / Docker compose files
* Notes application, executing / Running the Notes application with Docker Compose
* cloud hosting, deploying / Deploying to cloud hosting with Docker Compose
* used, for orchestrating test infrastructure / Docker Compose to orchestrate test infrastructure
* tests, executing / Executing tests under Docker Compose
* Docker Engine
* about / Node.js microservice deployment with Docker
* Dockerfile
* using / Node.js microservice deployment with Docker
* Docker Machine
* about / Node.js microservice deployment with Docker
* used, for starting Docker / Starting Docker using Docker Toolbox and Docker Machine
* Docker Toolbox
* used, for starting Docker / Starting Docker using Docker Toolbox and Docker Machine
* VirtualBoxMachine, exploring / Exploring the Docker Toolbox VirtualBoxMachine
* Droplet / Deploying to cloud hosting with Docker Compose
## E
* ECMAScript 6
* and Node.js / Node.js and ECMAScript 6 (ES-2015, ES-2016, and so on)")
* URL / Node.js and ECMAScript 6 (ES-2015, ES-2016, and so on)")
* Babel, using / Using Babel to use experimental JavaScript features
* EJS template engine
* URL / Walking through the default Express application
* ES-2015 multiline
* about / ES-2015 multiline and template strings
* ES-2015 Promises
* about / ES-2015 Promises and Express router functions
* error handling / Promises and error handling
* asynchronous code, writing / Flattening our asynchronous code
* tools, using / Additional tools
* references / Additional tools
* EventEmitters
* events, receiving / Sending and receiving events with EventEmitters
* events, sending / Sending and receiving events with EventEmitters
* theory / The EventEmitter theory
* Express
* about / Getting started with Express
* URL / Getting started with Express
* installing / Getting started with Express
* API documentation, URL / Walking through the default Express application
* middleware function / The Express middleware
* error handling / Error handling
* router functions / ES-2015 Promises and Express router functions
* MVC model / Express and the MVC paradigm
* Socket.IO, initializing with / Initializing Socket.IO with Express
* Express application
* Fibonacci sequence, calculating with / Calculating the Fibonacci sequence with an Express application
* REST backend service, calling / Calling a REST backend service from an Express application
* REST server, implementing / Implementing a simple REST server with Express
* Fibonacci application, refactoring / Refactoring the Fibonacci application for REST
* theming / Theming your Express application
## F
* Fibonacci application
* refactoring / Refactoring the Fibonacci application for REST
* Fibonacci sequence
* calculating, with Express application / Calculating the Fibonacci sequence with an Express application
* Node.js event loop / Computationally intensive code and the Node.js event loop
* computationally intensive code, executing / Computationally intensive code and the Node.js event loop
* algorithmic refactoring / Algorithmic refactoring
* HTTP Client requests, creating / Making HTTP Client requests
* file-stream-rotator
* URL / Request logging with Morgan
* file module
* about / File modules
* module-level encapsulation, demonstrating / Demonstrating module-level encapsulation
* filesystem
* notes, storing / Storing notes in the filesystem
* FrontNet
* creating / Creating FrontNet for the Notes application
* MySQL, using / MySQL for the Notes application
* dockerizing / Dockerizing the Notes application
* implementing / Putting FrontNet together
* Dockerized Notes app, accessing / Putting FrontNet together
* remote access, configuring / Configuring remote access on Docker for Windows or Mac
* remote access, configuring in VirtualBox / Configuring remote access in VirtualBox on Docker toolbox
* Docker Toolbox VirtualBoxMachine, exploring / Exploring the Docker Toolbox VirtualBoxMachine
* location of MySQL data volumes, controlling / Controlling the location of MySQL data volumes
* fs module
* URL / Storing notes in the filesystem
## G
* Google's Hosted Libraries
* URL / Theming your Express application
## H
* Hexy
* about / NPM – the Node.js package manager
* Homebrew
* Node.js, installing with / Installing on Mac OS X with Homebrew
* URL / Installing on Mac OS X with Homebrew
* HTTP server applications
* about / HTTP server applications
* HTTP Sniffer
* HTTP conversation, listening / HTTP Sniffer – listening to the HTTP conversation
## I
* inter-user chat
* implementing / Inter-user chat and commenting for Notes
* data model, implementing for storing messages / Data model for storing messages
* messages, adding to Notes router / Adding messages to the Notes router
* note view template, modifying for messages / Changing the note view template for messages
* Modal window, using to compose messages / Using a Modal window to compose messages
* messages, sending / Sending, displaying, and deleting messages
* messages, displaying / Sending, displaying, and deleting messages
* messages, deleting / Sending, displaying, and deleting messages
* messages, passing / Running Notes and passing messages
## J
* jQuery
* URL / Theming your Express application
## K
* Kitematic GUI
* about / Installing Docker on your laptop
## L
* LevelUP data store
* notes, storing with / Storing notes with the LevelUP data store
* Linux
* Node.js, installing / Installing on Linux, *BSD, or Windows from package management systems
* Linux Node.js service deployment
* demonstrating / Traditional Linux Node.js service deployment
* prerequisite / Prerequisite – provisioning the databases
* User Authentication, setting up on server / Setting up Notes and User Authentication on the server
* Notes application, setting up / Setting up Notes and User Authentication on the server
* PM2, setting up / Setting up PM2 to manage Node.js processes
* logbook module
* URL / Capturing stdout and stderr
* about / Capturing stdout and stderr
* logging
* implementing / Logging
* request logging, with Morgan / Request logging with Morgan
* messages, debugging / Debugging messages
* stdout, capturing / Capturing stdout and stderr
* stderr, capturing / Capturing stdout and stderr
* uncaught exceptions, handling / Uncaught exceptions
* login support, for Notes application
* implementing / Login support for the Notes application
* user authentication REST API, accessing / Accessing the user authentication REST API
* logout routing function / Login and logout routing functions
* login routing function / Login and logout routing functions
* login/logout, modifying to app.js / Login/logout changes to app.js
* login/logout, modifying in routes/index.js / Login/logout changes in routes/index.js
* login/logout, modifying in routes/notes.js / Login/logout changes required in routes/notes.js
* template changes, viewing / View template changes supporting login/logout
* Notes application, executing / Running the Notes application with user authentication
* Long Term Support (LTS)
* about / Node.js versions policy and what to use
* URL / Node.js versions policy and what to use
* Loopback
* about / Some RESTful modules and frameworks
* URL / Some RESTful modules and frameworks
* LSB-style init script
* URL / Traditional Linux Node.js service deployment
## M
* Mac OS X
* Node.js, installing with MacPorts / Installing on Mac OS X with MacPorts
* Node.js, installing with Homebrew / Installing on Mac OS X with Homebrew
* developer tools, installing / Installing developer tools on Mac OS X
* MacPorts
* URL / Installing on Mac OS X with MacPorts
* Node.js, installing with / Installing on Mac OS X with MacPorts
* MariaDB
* URL / Storing notes the ORM way with Sequelize
* middleware function
* about / The Express middleware
* URL / The Express middleware
* request paths / Middleware and request paths
* mobile-first design, for Notes application
* building / Mobile-first design for the Notes application
* Bootstrap grid foundation, laying / Laying the Bootstrap grid foundation
* notes list, improving / Improving the notes list on the front page
* Breadcrumb component, using / Breadcrumbs for the page header
* add/edit note form, cleaning up / Cleaning up the add/edit note form
* mobile-first paradigm
* about / Mobile-first paradigm
* Mocha
* used, for testing / Mocha and Chai the chosen test tools
* URL / Mocha and Chai the chosen test tools
* Modal windows
* usage / Other applications of Modal windows
* module
* defining / Defining a module
* format / Node.js module format
* file module / File modules
* directories / Directories as modules
* resolving, with algorithm / Node.js's algorithm for require (module)")
* module-level encapsulation
* demonstrating / Demonstrating module-level encapsulation
* module identifiers
* about / Module identifiers and path names
* relative module identifiers / Module identifiers and path names
* absolute module identifiers / Module identifiers and path names
* top-level module identifiers / Module identifiers and path names
* MongoDB
* notes, storing / Storing notes in MongoDB
* URL / Storing notes in MongoDB
* model, creating / MongoDB model for the Notes application
* Notes application, executing / Running the Notes application with MongoDB
* Mongolab
* URL / Storing notes in MongoDB
* Mongoose
* URL / Storing notes in MongoDB
* Morgan
* used, for request logging / Request logging with Morgan
* Morgan request logger
* URL / Walking through the default Express application
* MySQL
* URL / Storing notes the ORM way with Sequelize, Running the Notes application with Sequelize
* for User Authentication service / MySQL for the Authentication service
## N
* namespace
* about / Real-time changes in the Notes home page
* native code module
* about / Native code modules and node-gyp
* node-gyp
* about / Native code modules and node-gyp
* URL / Native code modules and node-gyp
* Node.js
* capabilities / The capabilities of Node.js
* server-side JavaScript / Server-side JavaScript
* URL / Performance and utilization, Launching a server with Node.js, Installing Node.js on Ubuntu
* URL, for case study / Performance and utilization
* system requisites / System requirements
* URL, for installation / Installing from source on POSIX-like systems
* URL, for downloading / Installing from source for all POSIX-like systems
* and ECMAScript 6 / Node.js and ECMAScript 6 (ES-2015, ES-2016, and so on)")
* installing, on Ubuntu / Installing Node.js on Ubuntu
* Node.js, advantages
* about / Why should you use Node.js?
* popularity / Popularity
* JavaScript support / JavaScript at all levels of the stack
* V8, surpassing / Leveraging Google's investment in V8
* asynchronous event-driven model / Leaner asynchronous event-driven model
* microservice architecture / Microservice architecture, Node.js, the microservice architecture, and easily testable systems
* hostile fork / The Node.js is stronger for having survived a major schism and hostile fork
* asynchronous event-driven I/O / The Node.js is stronger for having survived a major schism and hostile fork
* utilization / Performance and utilization
* performance / Performance and utilization
* event handling / Is Node.js a cancerous scalability disaster?
* server utilization / Server utilization, the bottom line, and green web hosting
* web hosting / Server utilization, the bottom line, and green web hosting
* testable systems / Node.js, the microservice architecture, and easily testable systems
* Twelve-Factor app model / Node.js and the Twelve-Factor app model
* Node.js installation
* package managers, using / Installing Node.js using package managers
* on Mac OS X, with MacPorts / Installing on Mac OS X with MacPorts
* on Mac OS X, with Homebrew / Installing on Mac OS X with Homebrew
* on Linux / Installing on Linux, *BSD, or Windows from package management systems
* on *BSD / Installing on Linux, *BSD, or Windows from package management systems
* on Windows / Installing on Linux, *BSD, or Windows from package management systems
* from nodejs.org / Installing the Node.js distribution from nodejs.org
* from source, on POSIX-like systems / Installing from source on POSIX-like systems
* prerequisites / Installing prerequisites
* Node.js module
* URL / Storing notes in SQL with SQLite3
* nodejs.org
* Node.js distribution, installing / Installing the Node.js distribution from nodejs.org
* URL / Installing the Node.js distribution from nodejs.org
* notes
* storing, in filesystem / Storing notes in the filesystem
* storing, with LevelUP data store / Storing notes with the LevelUP data store
* storing, with SQLite3 / Storing notes in SQL with SQLite3
* storing, with Sequelize module / Storing notes the ORM way with Sequelize
* storing, in MongoDB / Storing notes in MongoDB
* Notes application
* creating / Creating the Notes application
* Notes model, creating / Your first Notes model
* home page, creating / The Notes home page
* note, adding / Adding a new note – create
* notes, Viewing / Viewing notes – read
* existing note, editing / Editing an existing note – update
* notes, deleting / Deleting notes – destroy
* multiple Notes instances, executing / Scaling up – running multiple Notes instances
* problem, quantifying / Problem – the Notes app isn't mobile friendly
* Twitter Bootstrap, using / Using Twitter Bootstrap on the Notes application
* Bootstrap, adding to application templates / Adding Bootstrap to application templates
* executing, with SQLite3 / Running Notes with SQLite3
* executing, with Sequelize module / Running the Notes application with Sequelize
* executing, with MongoDB / Running the Notes application with MongoDB
* Twitter login support, implementing / Twitter login support for the Notes application
* real time updates, implementing / Real time updates on the Notes home page
* inter-user chat, implementing / Inter-user chat and commenting for Notes
* commenting / Inter-user chat and commenting for Notes
* Notes Application
* application architecture / Notes application architecture
* Notes application stack
* executing / The Notes application stack
* NPM
* about / NPM – the Node.js package manager
* npm command
* about / Other npm commands
* npm package
* about / npm – the Node.js package management system
* format / The npm package format
* URL / The npm package format, Finding npm packages
* searching / Finding npm packages
* npm commands / Other npm commands
* installing / Installing an npm package
* initializing / Initializing a new npm package
* dependencies, maintaining / Maintaining package dependencies with npm
* package dependencies, updating for bugs / Fixing bugs by updating package dependencies
* Node.js version compatibility, declaring / Declaring Node.js version compatibility
* outdated packages, updating / Updating outdated packages you've installed
* installing, from npm repository / Installing packages from outside the npm repository
* publishing / Publishing an npm package
* URL, for publishing / Publishing an npm package
* version numbers, displaying / Package version numbers
* npm repository
* URL / The npm package format
* nvm
* used, for installing development instances / Installing development instances with nvm
* URL / Installing development instances with nvm
## O
* OpenSSL
* URL / System requirements
## P
* package manager
* URL / Installing on Linux, *BSD, or Windows from package management systems
* package managers
* used, for installing Node.js / Installing Node.js using package managers
* path names
* about / Module identifiers and path names
* PM2
* URL / Setting up PM2 to manage Node.js processes
* setting up / Setting up PM2 to manage Node.js processes
* Twitter support, for hosted Notes app / Twitter support for the hosted Notes app
* POSIX-like systems
* Node.js, installing from source / Installing from source on POSIX-like systems
* Promise class
* about / ES-2015 Promises and Express router functions
* Promise objects
* about / Promises and error handling
* Pending state / Promises and error handling
* Fulfilled state / Promises and error handling
* Rejected state / Promises and error handling
* Pyramid of Doom
* about / ES-2015 Promises and Express router functions, Flattening our asynchronous code
* Python
* URL / System requirements
## R
* real time updates
* implementing, on Notes home page / Real time updates on the Notes home page
* EventEmitter class, implementing / The Notes model as an EventEmitter class
* modifying / Real-time changes in the Notes home page
* home page template, modifying / Changing the home page template
* Notes application, executing / Running Notes with real-time home page updates
* notes, viewing / Real-time action while viewing notes
* note view template, modifying / Changing the note view template for real-time action
* Notes application, executing while viewing notes / Running Notes with real-time updates while viewing a note
* relative module identifiers
* about / Module identifiers and path names
* Representational State Transfer (REST)
* about / Making HTTP Client requests
* REST backend services
* testing / Testing REST backend services
* RESTful frameworks / Some RESTful modules and frameworks
* RESTful modules / Some RESTful modules and frameworks
* Restify
* about / Some RESTful modules and frameworks
* URL / Some RESTful modules and frameworks, Creating a user information microservice
* router functions
* using / ES-2015 Promises and Express router functions
## S
* ScaleGrid.io
* URL / Storing notes in MongoDB
* Semantic Versioning model
* URL / Package version numbers
* Sequelize module
* notes, storing with / Storing notes the ORM way with Sequelize
* URL / Storing notes the ORM way with Sequelize, Sequelize model for the Notes application
* about / Storing notes the ORM way with Sequelize
* model, creating / Sequelize model for the Notes application
* references / Sequelize model for the Notes application
* database connection, configuring / Configuring a Sequelize database connection
* Notes application, executing with / Running the Notes application with Sequelize
* server-side JavaScript
* about / Server-side JavaScript
* Socket.IO
* about / Introducing Socket.IO
* initializing, with Express / Initializing Socket.IO with Express
* source
* Node.js, installing on POSIX-like systems / Installing from source on POSIX-like systems
* SQLite3
* notes, storing with / Storing notes in SQL with SQLite3
* URL / Storing notes in SQL with SQLite3
* database scheme / SQLite3 database scheme
* model code / SQLite3 model code
* Notes application, executing / Running Notes with SQLite3
* Supervisord
* URL / Setting up PM2 to manage Node.js processes
## T
* template strings
* about / ES-2015 multiline and template strings
* top-level module identifiers
* about / Module identifiers and path names
* Twelve-Factor application model
* about / Maintaining package dependencies with npm
* Twelve-Factor app model
* about / Node.js and the Twelve-Factor app model
* URL / Node.js and the Twelve-Factor app model
* Twenty Twelve theme
* about / Mobile-first paradigm
* URL / Mobile-first paradigm
* Twitter
* URL / Registering an application with Twitter
* Twitter Bootstrap
* using, on Notes application / Using Twitter Bootstrap on the Notes application
* URL / Using Twitter Bootstrap on the Notes application
* setting up / Setting it up
* Twitter login support
* for Notes application / Twitter login support for the Notes application
* application, registering with Twitter / Registering an application with Twitter
* TwitterStrategy, implementing / Implementing TwitterStrategy
## U
* Ubuntu
* Node.js, installing / Installing Node.js on Ubuntu
* User Authentication service
* AuthNet, creating / Creating the AuthNet for the User Authentication service
* with MySQL / MySQL for the Authentication service
* dockerizing / Dockerizing the Authentication service
* user information microservice
* creating / Creating a user information microservice
* user information model, creating / User information model
* REST server, using / A REST server for user information
* user authentication server, testing / Scripts to test and administer the User Authentication server
* user authentication server, administering / Scripts to test and administer the User Authentication server
## V
* versions policy
* about / Node.js versions policy and what to use
* considerations / Node.js versions policy and what to use
* VirtualBox
* using / Traditional Linux Node.js service deployment
* remote access, configuring / Configuring remote access in VirtualBox on Docker toolbox
* Virtual Private Service (VPS)
* about / Traditional Linux Node.js service deployment
## W
* web application frameworks
* using / Web application frameworks
* Windows
* Node.js, installing / Installing on Linux, *BSD, or Windows from package management systems
* Windows/Mac
* Docker, starting / Starting Docker with Docker for Windows/Mac
## Y
* Yahoo! scale Node.js
* URL / Performance and utilization
* YAML
* reference link / Storing notes the ORM way with Sequelize
| {
"redpajama_set_name": "RedPajamaBook"
} | 764 |
A new ESOL course this term for women who have little or no English. This course focuses on speaking and listening skills so parents are better able to communicate with their children, teachers in school and the broader community, in English. Women who have not previously attended an ESOL programme at Hillcrest and who have little or no English are encouraged to attend. | {
"redpajama_set_name": "RedPajamaC4"
} | 3,502 |
As discussed in our Sleeping Systems 101 article your sleeping system is one of your most expensive outdoor equipment investments. With that in mind it is extremely important that you care for your sleeping bag and mattress as proper care will increase the bag & mats life and your personal comfort level in colder conditions.
Unfortunately when you use your sleeping bag your body produces moisture and oils which impede the ability of down to clump and loft as efficiently as it could. Packing your sleeping bag away into its stuff sack only perpetuates the problem. Here are some aftercare tips to help you properly care for your sleeping bag.
When not in use your sleeping bag should always be stored uncompressed out of its stuff sack, allowing air to flow through the down. (Many of the leading sleeping bag manufacturers provide mesh or cotton storage bags with your sleeping bag). If you didn't receive one or have misplaced it mesh storage bags are available for purchase from Paddy Pallin stores or online. A large pillow slip can also be used.
Using a sleeping bag liner will protect the down from perspiration, grime and body oils which as mentioned will inhibit the lofting ability of your down. This will mean that your sleeping bag will require washing less often. Liners are available from Paddy Pallin stores or online in varying materials including Silk, Cotton, and Thermolite polypropylene all of which also act as another layer of insulation and can add extra warmth to your sleeping bags.
Undo zippers turn the bag inside out and soak the bag overnight in a bath or large tub of lukewarm water.
Hand wash using a non-detergent soap or one of the specially formulated down soaps available at Paddy Pallin stores or online. Gently knead the suds through the bag.
If the bag is really grimy, leave it submerged in the soapy water for a few hours.
Rinse with fresh water to remove all traces of soap. Keep rinsing with fresh water until you can`t see any more suds.
Gently squeeze out all excess moisture while your sleeping is still in bath or tub.
Carefully lift the soggy bag, placing your arms underneath it to support its entire weight, and place into a washing basket. Down is very heavy when wet and can cause damage to the internal baffles, so be very careful when moving the bag.
Prepare a clean, dry area out of direct sunlight and carefully lay the bag out flat.
Pat the down from both sides of the bag to help minimise down clumping.
Your down bag may require several days to dry completely. Hot, non-humid days are best.
A method of speeding up the drying process is to place the sleeping bag into a large delicates calico wash bag and if your washing machine has no agitator, you can place the sleeping bag in on a low spin cycle to disperse excess liquid prior to drying.
If you wish you use a large front load washing machine at a laundromat be careful to run your hand around the drum to make sure there are no sharp burrs. Compress the air out of the sleeping bag and quickly but carefully load the sleeping bag into the machine inside out with the zips undone and make sure your using a specially formulated down soap. To dry use a large tumble dryer making sure your carefully place the bag in as not to damage the baffles. Select low heat and the lowest speed (do not use dryers without a heat setting). Adding a tennis ball can help to break up the clumps as it bounces around the drum of the dryer, however its not necessary as the natural flopping of the bag inside the dryer will be sufficient. Be aware that the bag will still take a long time to dry.
The solvents used in dry cleaning can cause a reduction in the down's loft, and they are generally not environmentally friendly, so we suggest dry cleaning as a last resort. A better option for those who don't wish to personally clean their sleeping bag is to have it cleaned by a professional outdoor equipment repairer. Both Venus Repairs in Sydney and Remote Repairs in Melbourne offer an excellent service.
If dry cleaning is your only option, check with your local outdoor store for a recommendation, and ensure the cleaner uses only clean fluids and clear distilled solvent for the rinse. After cleaning, hang up the bag to air for at least a week to ensure any hazardous and toxic fumes have evaporated.
It`s a good idea to remove your sleeping bag from its stuff sack and lay it out to give the down time to loft fully before you get into it. As soon as you have set up camp, A gentle shake will also help ensure the down lofts to its potential.
When packing up camp always stuff your sleeping bag back into its stuff sack. Never roll it as this can damage the baffles (the internal walls which separate the down into panels). Sea To Summit Dry Compression Sack is a great investment as it will both compress your bag for carrying but also keep it waterproof if any misadventures are to be had.
Most modern sleeping bags use nylon coil zippers which are 'self-repairing'. This means the teeth can move about a little so they are less prone to damage if snagged. A lot of manufacturers recognize that snagging zippers is an issue and there are many snag proof zip systems built to modern sleeping bags. If a snag occurs, carefully ease cloth out of zip teeth. Coil zips have rounded teeth that are less likely to chew your sleeping bag fabric.
When opening or closing a zipper it is best to use the pull tag inside the bag. Placing your fingers or hand between the cloth and the zip as you slide it will virtually eliminate snagging of the fabric. When joining zips back together make sure both sliders are hard up against each other.
Quality sleeping bags use down-proof fabrics which effectively prevent the down fill from leaking out. The majority of the warmth-trapping down consists of soft, spidery clusters that cannot poke through the fabric, and thus remain safely contained inside. However, there is often a small percentage of feather quills in the down mix, which can occasionally pierce the cloth and escape. This minor leakage from a new down sleeping bag is no cause for alarm, and some of the escaping quills can be pulled back inside simply by feeling through the fabric and easing them in from the other side.
Sometimes a small amount of down may appear on the surface of a new down sleeping bag, particularly where the fill is a very high quality down. This is quite normal and will cease after the bag has been used a few times.
After each trip, air dry your sleeping pad for at least 24 hours before storing. Avoid storing your sleeping pad for extended periods of time in its stuff sack, especially if there are open cell foam or insulation components. Over time, tightly compressed foam and insulation can lose its ability to rebound or insulate, and may be permanently compressed or creased. If possible, keep the product stored flat or otherwise, loosely rolled, uncompressed, and away from direct sunlight. Under a bed or behind a couch that's against a wall are good, space-saving options.
Store your closed cell foam mattress flat or loosely rolled. Though fine for active use in the field, closed cell mattresses should be stored long-term with straps to hold it rolled or attached to a pack or under heavy objects. This can permanently deform a closed-cell mattress.
To clean your sleeping mattress, wipe down the surface with a wet and/or soapy cloth. Make sure to keep water out of the valves (keep valves closed) if necessary. Do not machine wash your mattress.
Do not machine dry your sleeping mattress. Be sure to let your sleeping mattress fully line-dry before storing in a cool, dry environment. Make sure to dry your sleeping mattress away from direct sunlight as exposure to UV is harmful to the fabrics.
It is highly recommended that you don't leave your mattress in the tent or car inflated with the valve closed during the day. Once the sun hits your tent can get very warm and as air heats it expands. If the valve is closed you mattress has no way to let this expanding air escape and your mat may get damaged.
Always place your mattress on some kind of ground sheet or inside the tent. If you lay your mattress directly on the ground you may puncture your mattress.
If your unfortunate and do puncture your mattress you can repair it by patching the hole. For patching mattresses, most brands come with patches for repairs in the field. These can be either self bonding or a simple fabric patch.
If a fabric patch is supplied cut the patch to fully cover the hole and round the edges of the patch to keep them from peeling up. Use an adhesive like Gear Aid Seam Grip to bond the patch to the pad. Follow the adhesive manufacturer's directions for application and curing time.
If you have misplaced your repair patch kit you can also fix a leak using clear Tenacious Tape patches by Gear Aid. Just clean the surface, let dry, and peel and stick on the patch. You'll have a durable, nearly invisible repair that won't leave behind a sticky residue like duct tape will.
We hope this has given you some ideas on how to care for your Sleeping System and if you need more tips on your other equipment head to our Rainwear, Footwear and Tent care articles. | {
"redpajama_set_name": "RedPajamaC4"
} | 1,253 |
India vs Sri Lanka, 5th ODI, Highlights: Virat Kohli, Bhuvneshwar Kumar guide IND to 5-0 whitewash
Virat Kohli slammed his 8th ton vs Sri Lanka and 30th overall while Bhuvneshwar Kumar took his maiden five-wicket haul as India whitewashed the hosts 5-0. Catch full cricket score of India vs Sri Lanka, 5th ODI, Colombo here
india vs sri lanka 2017 Updated: Sep 03, 2017 22:54 IST
Sidharth Gulati
Hindustan Times, New Delhi
Virat Kohli played a captain's knock as India crushed Sri Lanka by six wickets in the fifth and final ODI on Sunday to complete a 5-0 whitewash. Catch full cricket score of India vs Sri Lanka, 5th ODI, Colombo, here (Twitter )
Virat Kohli played a captain's knock as India crushed Sri Lanka by six wickets in the fifth and final ODI on Sunday to complete a 5-0 whitewash. Kohli remained unbeaten on 110 to help his team achieve the target of 239 runs with 21 balls to spare at R. Premadasa stadium in Colombo. Earlier, India had won the Test series 3-0. Catch full cricket score of India vs Sri Lanka, 5th ODI, Colombo, here. (SCORECARD | STREAMING INFO)
22:41 hrs IST: And that's it. Thank you for joining us. Until next time, it's goodbye. Cheers!
Virat Kohli (India captain): "It's quite amazing to have won the series 5-0. We always thought the shorter format is going to be much more challenging. The youngsters and the spunk on the field has worked for us. All round, it's been a complete series for us. We've been playing some good cricket. We didn't win three games in the shorter format before this, and now we have six in a row including the West Indies series."
Jasprit Bumrah (Man of the Series): "It's always a dream to play Test cricket, but I'll wait for my chance. It was my first visit to Sri Lanka and I'm glad I did well. I was focussing on my preparation, I had time to rest and it makes you hungry. It's been a long journey with Malinga and I've learnt a lot."
Upul Tharanga (Sri Lanka captain): "These are difficult times for us. India were brilliant throughout the tournament. Once we were looking at 260-70 but we lost some wickets. Our batting disappointed. We could not get the partnerships going. Losing a few main players was also the reason."
Bhuvneshwar Kumar (Man of the Match): "I wasn't among wickets in the first few matches. But I was happy with the way I bowled today. We knew they were not strong against slower balls. I did not want to prove anything. Whenever I got the opportunity I wanted to do well for my team."
22:15 hrs IST: India is now the first team to whitewash Sri Lanka in Sri Lanka.
22:13 hrs IST: Single and that's it. India beat Sri Lanka by six wickets to complete 5-0 whitewash.
22:03 hrs IST: Kohli's knock has put him level with former Australia skipper Ricky Ponting, who also has 30 centuries.
22:01 hrs IST: Virat Kohli, take a bow. Slams 30th century, 19th in a chase and eighth against Sri Lanka. What a player!
21:58 hrs IST: FOUR! Tossed up from Dananjaya, Jadhav comes down the track and hits it straight over the bowler's head.
21:54 hrs IST: Single and that's fifty for Kedar Jadhav, second in ODIs. What an innings this has been!
21:48 hrs IST: It has been a matured knock from Kedar Jadhav. He needs to score consistently in the ODIs to come against Australia, New Zealand and Sri Lanka (again).
21:42 hrs IST: Virat Kohli goes past 1000 runs in ODIs in 2017.
21:39 hrs IST: FOUR! Too short from Malinga and Jadhav pulls it to fine leg boundary. India need 46 off 78 balls.
21:34 hrs IST: Seven runs off Hasaranga's fourth. India need 54 off 84 balls.
21:31 hrs IST: FOUR! Tossed up from Hasaranga and Kohli hits it well through covers. Moves to 87.
21:26 hrs IST: FOUR! Poor delivery from Hasaranga, too short, Jadhav rocks back and smacks it over mid-wicket. India need 65 off 96 balls.
21:22 hrs IST: Good over from Fernando, just three runs off it. India need 74 off 102 balls.
21:18 hrs IST: FOUR! Pitched up from Pushpakumara and Jadhav slog sweeps to deep mid-wicket boundary. India need 77 off 108 balls.
21:12 hrs IST: Eighteen balls since the last boundary. India need 92 off 120 balls. Seems easy.
21:07 hrs IST: The chase master is at it again! With India playing only six batsmen, it was important for him to play such an innings.
21:02 hrs IST: FOUR! Brilliant stuff from Jadhav. Waits for the ball and cuts it past the fielder at short third-man. India need 100 off 138.
20:59 hrs IST: Kedar Jadhav is in at No. 5.
20:57 hrs IST: WICKET! Pandey attempts a slog-sweep but gets a top-edge and Tharanga completes a neat catch at short mid-wicket.
20:55 hrs IST: It would be fair to say that apart from a couple from instances, India haven't been tested throughout the tour.
20:51 hrs IST: Sixteen runs in the last two overs. India are 124/2 after 24 overs.
20:45 hrs IST: Consecutive boundaries and that's fifty for Kohli, 12th against Sri Lanka and 45th overall.
20:38 hrs IST: FOUR! Juicy full-toss from Pushpakumara, Pandey steps out and clobbers it in the gap between mid-on and mid-wicket. India are 100/2 after 20 overs.
20:36 hrs IST: Sri Lanka need Dananjaya to get breakthroughs. All India need to do is to dispatch the loose balls.
20:32 hrs IST: FOUR! Virat Kohli at it again. The India captain directed the ball towards third-man fence well. He looks to be in good touch. India 88/2 in 18 overs
20:28 hrs IST: Manish Pandey hit a half-century in the fourth ODI and has the potential to be India's answer for middle-order woes. That is an area concern for Virat Kohli's men with the larger picture being doing well at the 2019 ICC World Cup. India 82/2 in 17 overs
20:25 hrs IST: Single and that's fifty partnership between Kohli and Pandey. India are 79/2 after 16 overs.
20:21 hrs IST: Just the partnership India needed for stability. They are 74/2 after 15 overs.
20:17 hrs IST: Considering sterner opposition, India previously beat New Zealand and England 5-0 in 2010-11 and 2012-13 respectively, both series wins coming at home.
20:14 hrs IST: The 5-0 win against Sri Lanka in 2014-15 was India's last ODI series whitewash.
20:12 hrs IST: If India win 5th ODI, they will become the 1st team to clean sweep a bilateral ODI series in Sri Lanka.
20:09 hrs IST: Angelo Mathews now
20:07 hrs IST: Good start from Dananjaya. India are 57/2 after 11 overs. Kohli 21*, Pandey 9*
20:04 hrs IST: Akila Dananjaya comes in as the first change
20:03 hrs IST: BOUNDARY! Too full from Fernando and Kohli smacks it straight down the ground for one bounce four. Moves to 19. India are 53/2 after 10 overs.
20:02 hrs IST: FOUR! Too much width, Kohli comes on the front foot and times it sweetly through covers.
19:59 hrs IST: Single off the final delivery for Pandey. India are 40/2 after 9 overs.
19:56 hrs IST: FOUR! Stand and deliver. Shortish length from Malinga and Pandey hits it well to the left of the fielder at mid-on for his first boundary.
19:53 hrs IST: Manish Pandey at No. 4
19:51 hrs IST: OUT! Slower delivery from Fernando, Rohit sweeps but doesn't generate enough power and Pushpakumara takes a good catch at short fine leg.
19:47 hrs IST: This has been Malinga's best spell in the series so far. Needs to keep going. India are 28/1 after 7 overs.
19:40 hrs IST: Nine runs off the next 12 balls. Slow yet steady start from India.
19:36 hrs IST: Virat Kohli comes to the crease
19:35 hrs IST: WICKET! Short ball from Malinga, Rahane looks to pull but gets a top edge and Munaweera does the rest at fine leg.
19:32 hrs IST: Expensive over from Fernando, eight runs off it. India are 15/0 after 4 overs.
19:30 hrs IST: FOUR! Poor delivery from Fernando, on Rohit's pads and the right-hander just helps it to fine leg boundary.
19:27 hrs IST: Maiden over from Malinga. No margin for error. India are 7/0 after 3 overs. Rohit 4*, Dhawan 3*
19:24 hrs IST: Single off the last ball for Rahane. India are 7/0 after 2 overs.
19:21 hrs IST: Vishwa Fernando comes into the attack
19:19 hrs IST: Solid start from Malinga. India are 4/0 after first over. Rohit 3*, Rahane 1*
19:15 hrs IST: Rohit Sharma to take strike. Lasith Malinga to bowl the first over.
19:12 hrs IST: Welcome back!
18:36 hrs IST: OUT! And that's it. Malinga gets caught at deep mid-wicket. Maiden five-wicket haul for Bhuvneshwar in ODIs. Sri Lanka bundled out for 238. We'll be back in a few minutes time.
18:34 hrs IST: FOUR! Knuckle ball and Fernando hits it straight down the ground for his first boundary.
18:33 hrs IST: Bhuvi to bowl the final over.
18:31 hrs IST: Another good overs from Bumrah. Only three runs off it. Sri Lanka are 233/9 after 49 overs.
18:27 hrs IST: Excellent over from Bhuvi. Two runs and a wicket. Sri Lanka are 230/9 after 48 overs.
18:24 hrs IST: MS Dhoni becomes the first wicket-keeper to affect 100 stumping dismissals in ODIs.
18:22 hrs IST: WICKET! Pushpakumara misses the full-toss and it hits his middle stump. Sri Lanka are 228/8 after 47 overs.
18:17 hrs IST: SIX! Slower delivery from Bhuvneshwar and Siriwardana creams it over mid-wicket for a maximum. Sri Lanka are 222/7 after 46 overs.
18:13 hrs IST: OUT! Chahal gets his first. Flatter delivery, Dananjaya charges down but misses and Dhoni does the rest. Sri Lanka are 212/7 after 45 overs.
18:10 hrs IST: Fine over from Kuldeep and that's the end of his spell. Finishes with figures of 1/40. Sri Lanka are 208/6 after 44 overs.
18:07 hrs IST: WICKET! Another one bites the dust. Good piece of fielding from Dhoni and Hasaranga is gone. Sri Lanka are 205/6 after 43 overs.
18:04 hrs IST: Another day but it's the same story for Sri Lanka. Losing their settled batsmen at crucial intervals.
17:59 hrs IST: Wanidu Hasaranga comes to the crease
17:57 hrs IST: OUT! Just the wicket India wanted. Mathews c Dhoni b Kuldeep Yadav 55(98).
17:53 hrs IST: FOUR! Much needed boundary for Sri Lanka. Short of a length delivery and Mathews hits it well in the gap between cover and mid-off.
17:48 hrs IST: Milinda Siriwardana is in at No. 6
17:46 hrs IST:OUT! Thirimanne 67(102), SL 185/4 in 38.5 Ovs
Bhuvneshwar does the trick in his first ball of a fresh spell. Thirimanne wanted to direct Bhuvi towards third man but is cramped for space and is bowled.
17:43 hrs IST: Bhuvneshwar Kumar comes from the other end and starts with a short ball. India need to break Mathews-Thirimanne stand. The run-rate is close to 5 but it might increase in the latter overs if these two set batsman remain at the crease.
17:42 hrs IST: Decent over from Bumrah. Four runs off it. Sri Lanka are 181/3 after 38 overs.
17:39 hrs IST: This is Mathews' eighth fifty against India and second in the series.
17:37 hrs IST: Jasprit Bumrah comes back into the attack.
17:35 hrs IST: Double and that's fifty from Mathews. Solid show from the former skipper. Sri Lanka are 177/3 after 37 overs.
17:28 hrs IST: If Thirimanne and Mathews can stick around for another 8-10 overs, Sri Lanka can post well above 320.
17:24 hrs IST: Sri Lanka are 164/3 after 34 overs. Thirimanne 55*, Mathews 44*. Time for drinks.
17:20 hrs IST: This is the highest stand (99) of the series for any wicket for Sri Lanka. They are 162/3 after 33 overs.
17:16 hrs IST: FOUR! Full-toss from Kedar Jadhav, Mathews steps out and flicks it to wide long-on boundary. Sri Lanka are 158/3 after 32 overs.
17:13 hrs IST: Single and that's fifty for Lahiru Thirimanne, 18th in ODIs. Well played!
17:09 hrs IST: Another day, another chance for Ajinkya Rahane. Can he score a 100 secure his position?
17:04 hrs IST: This is the time Sri Lanka need to keep calm. There's no need to rush as the platform is set for a score of above 300.
17:00 hrs IST: SIX! Flighted delivery from Chahal, Thirimanne dances down the track and smacks it down the ground for a maximum. Sri Lanka are 142/3 after 28 overs.
16:55 hrs IST: Brilliant over from Bumrah. Only one run. No boundaries from the last 17 balls. Sri Lanka are 134/3 after 27 overs.
16:52 hrs IST: Kuldeep Yadav and Yuzvendra Chahal - First time India playing two specialist wrist spinners in their ODI history of 922 matches.
16:47 hrs IST: Dot ball to finish off from Shardul. Sri Lanka are 130/3 after 25 overs.
16:44 hrs IST: FOUR! Length ball from Shardul, Mathews comes down the track and looks it to hit it over covers but instead gets a thick outside edge and it runs away to third man boundary.
16:40 hrs IST: Bad news. Some dark clouds are hovering over the ground.
16:37 hrs IST: Sharp turn for Chahal. Mathews plays him cautiously. Sri Lanka are 118/3 after 22 overs.
16:34 hrs IST: Leggie Chahal comes into the attack.
16:33 hrs IST: Fifty partnership between Thirimanne and Mathews. The duo need to keep the momentum. Sri Lanka are 116/3 after 21 overs.
16:30 hrs IST: FOUR! Tossed up from Kuldeep, Thirimanne gets down on one knee and slog-sweeps it to deep mid-wicket boundary.
16:28 hrs IST: Excellent spell from India. 24 balls since the last boundary. Sri Lanka are 110/3 after 20 overs.
16:23 hrs IST: What Sri Lanka need to sort out is the batting positions of Mathews, Thirimanne and Tharanga. All three along with Dickwella should form the top four.
16: 21 hrs IST: Here comes Kedar Jadhav - The Man with the Golden Arm.
16:20 hrs IST: Another economical over from Kuldeep. Just three runs off it. Sri Lanka are 97/3 after 17 overs.
16:16 hrs IST: Sri Lanka's run-rate has been pretty good but the wickets column has been an issue.
16:13 hrs IST: FOUR! Mathews edges it in the gap between slip and wicket-keeper. Rahane, at first slip, was standing a bit wider. Sri Lanka are 94/3 after 16 overs. Time for drinks.
16:06 hrs IST: Another good over from Sri Lanka. Twelve runs off it. Sri Lanka are 83/3 after 14 overs.
16:03 hrs IST: FOUR! Full-toss from Bumrah and Mathews flicks it in the gap between mid-on and mid-wicket for his first boundary.
15:59 hrs IST: Bumrah's 14 wickets is also the most by an Indian pacer in a bilateral series of five or fewer ODIs.
15:56 hrs IST: Magnificent over from Bumrah. Just one run off it. Mathews need to use his feet more. Sri Lanka are 69/3 after 12 overs.
15:53 hrs IST: Four singles off the over. Sri Lanka need an inspired show from both Mathews and Thirimanne or else, it's 5-0 for India. Sri Lanka are 68/3 after 11 overs.
15:51 hrs IST: Kuldeep Yadav comes into the attack. This is excellent captaincy from Kohli. Looking to put more pressure on the hosts.
15:50 hrs IST: Bumrah now has 14 wickets in the series - joint most by a pacer in a bilateral series in Sri Lanka, tied with England's Chris Woakes.
15:49 hrs IST: Good start from Bumrah. Five runs and a wicket. Sri Lanka are 64/3 after 10 overs.
15:47 hrs IST: Angelo Mathews is in at No. 5. Two slips for him
15:45 hrs IST: OUT! Pitched up from Bumrah, nips away from Tharanga - who looks to play towards leg but instead edges it to Dhoni. Missed a well-deserved fifty (48).
15:43 hrs IST: Here comes the first change in bowling - Jasprit Bumrah
15:42 hrs IST: Tidy over from Bhuvneshwar, only two runs off it. Sri Lanka are 59/2 after 9 overs.
15:39 hrs IST: Bhuvneshwar to continue
15:38 hrs IST: Costliest over of the innings so far. 17 runs off it. Sri Lanka are 57/2 after 8 overs. Tharanga 44*, Thirimanne 1*
15:37 hrs IST: Consecutive boundaries for Tharanga. Races into 40s (off just 31 balls). Sri Lanka would hope for a big knock from him.
15:33 hrs IST: Same old story for Sri Lanka. They've the talent but the application part is missing. With another whitewash on the cards, there was no point in resting Kusal Mendis.
15:31 hrs IST: Lahiru Thirimanne is in at No. 4
15:29 hrs IST: OUT! Another knuckle ball from Bhuvneshwar, Munaweera looks to hit towards leg but mistimes and Kohli takes a running catch from mid-off.
15:27 hrs IST: Expensive over from Bhuvi, eight runs off it. Sri Lanka are 36/1 after 6 overs.
15:25 hrs IST: FOUR! Too short from Shardul, Tharanga picks the length early and slams past Chahal at short mid-wicket.
15:24 hrs IST: Shardul Thakur from around the wicket.
15:23 hrs IST: Another good six balls from Bhuvneshwar. No margin for error. Get a feeling another wicket is around the corner. Sri Lanka are 28/1 after 5 overs.
15:19 hrs IST: Seven runs off Shardul's second. Sri Lanka are 21/1 after 4 overs.
15:18 hrs IST: FOUR! Too wide from Shardul and Tharanga hits it well in the gap between cover point and point. Third boundary for him. Looks in top form.
15:17 hrs IST: This was Bhuvneshwar Kumar's first wicket in four ODIs against Sri Lanka.
15:15 hrs IST: Munaweera is the next man in.
15:13 hrs IST: WICKET! Dickwella c & b Bhuvneshwar 2(6). Knuckle ball, Dickwella looks to flick but instead hits in the air and the Indian seamer does the rest.
STAT ATTACK - Niroshan Dickwella has had four partners in the series (Gunathilaka, Chandimal, Munaweera and Tharanga.
15:10 hrs IST: Good comeback from Shardul. Finds the right length. Sri Lanka are 12/0 after 2 overs.
15:07 hrs IST: FOUR! Loose delivery from Shardul. Too much width and Tharanga laces it through covers. As good as it gets!
15:06 hrs IST: Shardul Thakur comes into the attack. The Mumbaikar got rid of Dickwella in his debut game.
15:05 hrs IST: Bhuvneshwar finishes it off with consecutive dot deliveries. Still a decent start from him. Sri Lanka are 6/0 after first over.
15:04 hrs IST: FOUR! Width on offer and Tharanga times it well through the covers for his first boundary.
15:02 hrs IST: Good length delivery from Bhuvi, Dickwella tucks it off his pads to backward square leg for a single.
15:00 hrs IST: Time for live action. Dickwella to take strike. Bhuvneshwar to start the proceedings for the visitors.
14:45 hrs IST: So Tharanga returns for Sri Lanka. India have opted to go for five bowlers. No Hardik Pandya and KL Rahul. Ajinkya Rahane replaces Shikhar Dhawan.
14:43 hrs IST: Here are the playing XI of both teams -
Sri Lanka: Niroshan Dickwella(wk), Upul Tharanga(c), Dilshan Munaweera, Lahiru Thirimanne, Angelo Mathews, Milinda Siriwardana, Wanidu Hasaranga, Akila Dananjaya, Malinda Pushpakumara, Vishwa Fernando, Lasith Malinga
India: Rohit Sharma, Ajinkya Rahane, Virat Kohli(c), Manish Pandey, Kedar Jadhav, MS Dhoni(wk), Bhuvneshwar Kumar, Kuldeep Yadav, Jasprit Bumrah, Yuzvendra Chahal, Shardul Thakur
14:41 hrs IST: Sri Lanka have won the toss and have opted to bat. It's still drizzling though.
14:35 hrs IST: Toss delayed for the second time now. Chances of a short game are pretty high
14:30 hrs IST: Ravi Shastri - "We've demanded consistency across all formats. The balance of this side is right. Even the younger guys are a lot experienced now. It's pretty much the same, like it was when I first took over as director in 2014. This tour has been excellent so far. The way they handed pressure, like in the game in Kandy, where we were down in the dumps, was great."
14:28 hrs IST: It's drizzling again. An official confirmation on toss awaited!
14:18 hrs IST: Virat Kohli's India are currently dominating world cricket but the skipper must take this important decision in order to sort the team out ahead of tougher foreign tours.
14:08 hrs IST: Yipiee! Toss will take place at 14:30 IST. Play to start at 15:00, no overs lost.
14:00 hrs IST: Good news. Covers are coming off. Stay tuned!
13:50 hrs IST: The forecast isn't all that great. Delayed start for sure. We'll keep you posted.
13:25 hrs IST:<?EM-dummyText> Can you imagine? Sri Lanka haven't even won a single match (so far) irrespective of the format!
13:13 hrs IST: The entire ground is under covers at the moment.
Not the ideal scenario ahead of the 5th ODI in Colombo #SLvIND pic.twitter.com/HlgPCADJFo
— BCCI (@BCCI) September 3, 2017
12:55 hrs IST: It is raining quite heavily in Colombo!
12:49 hrs IST: It is Md. Shami's birthday today!
12:35 hrs IST: After thrashing the island nation 3-0 in the Tests, the Virat Kohli led side has romped away to a 4-0 lead in the ongoing series.
12:25 hrs IST: Virat Kohli-led India have completely dominated the hosts, and are yet to lose a match so far.
12:15 hrs IST: Hello and welcome to HT's live coverage of the fifth and the final ODI between India and Sri Lanka.
Virat Kohli has two five-nil sweeps before (2013 vs Zimbabwe and 2014 vs Sri Lanka at home). A third in Colombo on Sunday will make him the first Indian skipper to score three separate 5-0 sweeps. On form, there is no reason why India should not be able to do this.
India, playing three new players in the fourth ODI in Colombo on Thursday, smashed Sri Lanka by 168 runs. For Sri Lanka nothing worked again. Their poor fielding only compounded their growing worries.
India should retain their squad but will be forced to play a new opening batsman since Shikhar Dhawan has returned to attend to his ailing mother. Lokesh Rahul opening the innings with the inform Rohit Sharma looks a distinct possibility with Ajinkya Rahane returning to bolster the top order.
Tharanga to return
Meanwhile, Sri Lanka are expected to make at least one chance to their playing XI. Skipper Upul Tharanga will be back in charge after sitting out of the last two games owing to his suspension for slow-over rate. He is expected to slot into the middle order once again and Lahiru Thirimanne could be asked to open the innings instead. Stand-in captain and an off-colour Lasith Malinga will be back to his bowling duties.
It remains to be seen if the Sri Lankan captain can inspire his side to score a consolation win in what has been a nightmare of a summer.
more from india vs sri lanka 2017 | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 7,163 |
Q: How do you import a txt file and create a two column table splitting on /t? I am trying to import a file.txt and read it as alist with two columns
the Format of the txt file is as follows.
1 1.234567
2 2.345678
Thank you
I can open it as a list but I couldt split \t so I could get two rows.
o=open('file.txt')
csv_o = csv.reader(o)
for line in csv_o:
print (line)
o.close()
What I get is
['1\t1.234567']
['2\t2.345678']
and What I want is
['1','1.234567']
['2','2.345678']
A: Use delimiter="\t"
Ex:
import csv
with open(filename) as csvfile:
reader = csv.reader(csvfile, delimiter="\t")
for row in reader:
print(row)
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 1,155 |
\section{Introduction}
V405~And is an active binary system, which was first studied by \cite{chil}, who analyzed spectroscopy and photometric observations in $B$ and $V$ passbands, and found a rotation period of 0.465 days, a grazing eclipse, and strong H$\alpha$ emission. They also concluded that -- according to the H$\alpha$ region -- both components are active.
\cite{vida09} studied photometry in $BV(RI)_C$ passbands, and spectroscopic measurements. The authors found that the primary component has radius that is too large for its mass, while the secondary component fits quite well to the mass--radius relation.
Their results were later confirmed by \cite{ribeiro}, who found very similar radius values using an independent spectroscopic method based on Doppler imaging.
\section{Results from binary modeling}
\begin{figure}
\centering
\includegraphics[angle=-0,width=0.45\textwidth]{vida_fig1.eps}
\caption{$V$ light curve of V405~And (top), and phased $V$ light curves from different observing runs, together with the binary+spot model fit.}
\label{fig:lc}
\end{figure}
\begin{figure}
\centering
\includegraphics[angle=-90,width=0.70\textwidth]{vida_fig2.eps}
\caption{Mass--radius curve from \cite{1998AA...337..403B} and observed values from
\cite{data1,data2,data3,data4} . Three systems, a binary from NGC 1647 \citep{hebb}, T-Lyr1-17236 \citep{tlyr}, and V405 And (present paper) are plotted with special characters.
}
\label{fig:MR}
\end{figure}
Figure \ref{fig:lc} shows photometric measurements in $V$ passband covering about 1800 days. We used the same iterative modeling method described in \cite{vida09} to fit the new observations. The basic idea is to create an initial binary model using PHOEBE \citep{phoebe} based on the radial velocity data of \cite{chil} and the light curve, which rudimentarily describes the effects of binarity. This model is subtracted from the observed light curve, resulting in a dataset, where the changes are caused by the spottedness. This data is then modeled by {\sc SpotModeL} \citep{sml}. By subtracting this model from the observed light curve we get a dataset, where the changes are due to the binarity (eclipse and proximity effects), which is fed again to PHOEBE. The previous steps are then repeated, until the combined binary and spot model describes the observed light curve satisfactorily.
The bottom four panels of Figure \ref{fig:lc} show different parts of the observations together with the combined binary and spot model.
We found that all the previous and newly observed light curves can be described by the same binary model that was found in \cite{vida09} confirming the results of that paper, namely, that the radius of the primary component is much larger than expected, while the secondary fits well to the mass--radius relation (see Fig. \ref{fig:MR}). There are more known systems that show similarly a larger radius for the primary component, but the discrepancy is the largest in the case of V405~And.
We do not know, what is behind this behavior. \cite{activerad} showed that very strong magnetic field (which manifests itself in activity features) increases stellar radii, although not to this extent.
\cite{morales} showed that starspots in certain cases can cause systematic deviations of a few percent in the determined stellar radii during modeling, but the difference in the case of V405~And is higher than that, too.
The components have different structures: the secondary has a mass of $0.21M_\mathrm{Sun}$, thus it is probably fully convective. The primary has a mass of $0.49M_\mathrm{Sun}$, so it has a radiative core and a convective envelope. If our results and the similar values of \cite{ribeiro} are correct, the study and modeling of similar active systems, with components of different structures could be very interesting in the future.
\section{Long-term behavior}
\begin{figure}
\centering
\begin{minipage}[h]{0.47\linewidth}
\centering
\includegraphics[angle=-90,width=\textwidth]{vida_fig3a.eps}
\end{minipage}
\begin{minipage}[h]{0.47\linewidth}
\centering
\includegraphics[angle=0, width=\textwidth]{vida_fig3b.eps}
\end{minipage}
\caption{Left: Fourier spectrum of the $V$ light curve showing the signal of the rotational modulation/orbital period at 0.465 days, and a peak at about 300 days, a result of an activity cycle (top), and the spectral window (bottom). Right: $V$ light curve pre-whitened with the rotational modulation, phased with the period of the activity cycle. }
\label{fig:cyc}
\end{figure}
We studied the $V$ light curve by discrete Fourier analysis using MUFRAN \cite{mufran}. The resulting Fourier spectrum and spectral window is plotted in Fig. \ref{fig:cyc}). The spectrum shows two main features. One can be associated with the rotational/orbital modulation at the frequency corresponding to the period of 0.465 days. The other one is a longer cycle, with a period of about 300 days. This is most probably a result of a stellar activity cycle, which is similar to the 11 year-long cycle of the Sun. As a result of the ultrafast rotation, the length of the stellar activity cycle is also very short (see \citealt{2002AN....323..361O}). The cycle found on V405~And is one of the shortest cycles ever found (cf. \citealt{eydra,shortcyc}).
\section*{Acknowledgements}
The financial support of the OTKA grant K-81421, is acknowledged.
This work was also supported by the ``Lend\"ulet-2009'', and ``Lend\"ulet-2012'' Young Researchers' Programs of the Hungarian Academy of Sciences, and by the HUMAN MB08C 81013 grant of the MAG Zrt.
We would like to thank the anonymous referee for his helpful comments.
\bibliographystyle{ceab}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 1,662 |
Всевідоф — стратовулкан у штаті Аляска, США, один із 6 найактивніших вулканів Алеутських островів. Його вершина є найвищою точкою на Умнаке, одному зі східних Алеутських островів. Має симетричний конус, який різко височить над околицями. Останнє виверження було викликано землетрусом, що стався 9 березня 1957 року, а вже саме виверження почалося 11 березня і закінчилося наступного дня. Відомі і інші виверження вулкану Всевідоф : в 1250, 1450 - 1455, 1490, 1500, 1530, 1757 і в 1957 роках. Тип виверження Плінійський.
Примітки
Volcanoes of the Alaska Peninsula і Aleutian Islands-Selected Photographs
Mount Vsevidof on the Alaska Volcano Observatory Website
Vsevidof (англ.) . Global Volcanism Program . Smithsonian Institution .
Західні Алеутські острови (зона перепису населення, Аляска)
Активні вулкани
Вулкани Алеутських островів
Вулкани Аляски | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,350 |
Fidel Alejandro Castro Ruz ( ) (Birán, 1926. augusztus 13. – Havanna, 2016. november 25.) kommunista politikus, 1965–2008 között Kuba első számú vezetője: az ország és a minisztertanács elnöke, pártvezér.
Fulgencio Batista rezsimjének megdöntése után 1959-től 1976-ig az ország miniszterelnöke volt, amikor az Államtanács és a Minisztertanács elnöke lett.
1965-ben ő lett a Kubai Kommunista Párt első főtitkára, és az ő vezetésével vált az ország egypárti szocialista köztársasággá.
2008-ban lemondott elnöki és hadvezéri posztjáról és elismerte, hogy fizikai állapota miatt nem tud eleget tenni olyan feladatnak, amely teljes elhivatottságot és mozgékonyságot kíván.
2011-ben megvált első titkári posztjától és távozott a párt központi bizottságából is.
Kisgyermekkora
1926, de egyes források szerint 1927. augusztus 13-án született egy kubai cukornádültetvényen, Mayarí város közelében. Apja Ángel Castro y Argiz, spanyol bevándorló, aki kemény munka árán vált sikeres cukornádtermesztővé. Anyja, kubai kreol, Lina Ruz González apja birtokán volt szolgáló lány. Fidelnek hét testvére született, három fiú (Raúl, Ramon, Pedro Emilio) és négy lány (Juanita, Emma, Ángela Maria, Lidia), melyek közül Pedro Emilio és Lidia a féltestvérei voltak.
Fidel éles eszű, tehetséges diák volt. Leginkább a sportok után mutatott érdeklődést. 1941-ben került a Havannai El Colegio de Belénbe, Kuba legelőkelőbb gimnáziumába, ahol nyers, vidékies temperamentuma és megnyilvánulásai miatt az El Loco (Az őrült) nevet kapta osztálytársaitól, valamint részt vett a diákok politikai harcaiban. Világnézeti képe itt indult fejlődésnek a jezsuita papok hatására, akik a spanyol nyelvű katolikus világot felsőbbrendűnek tartották az anyagias angolszász világhoz képest.
Középiskolai tanulmányai befejezése után 1945-ben a Havannai Egyetemre ment jogot tanulni.
Castro forradalma
1952. március 10-én Batista, a valamikor jelentéktelen kis őrmester katonai puccsal átvette a hatalmat az országban, kiszolgáltatva azt az USA-nak, és katonai diktatúrát vezetett be. Ebben az időben Castro már ismert politikus volt, az Ortodox Párt radikális szárnyát vezette. Megkezdődött a felkészülés egy katonai felkelésre, melynek a célja az erkölcsi megtisztulás és a nemzeti méltóság visszaállítása.
A Castro vezette mozgalom, a Movimiento megkezdte a harcosok kiképzését. A kiképzés a legnagyobb titokban zajlott. A résztvevőket 15-20 fős sejtekbe osztották. A sejtek nem tudhattak egymásról, mert a besúgók és a katonai rendőrség, a SIM miatt rendkívül nagy volt a lebukás veszélye.
A gyengén felszerelt, Castro vezette csapat 1953. július 26-án, a santiagói karnevál idején, a felfordulást kihasználva megtámadta Kuba második legnagyobb katonai támaszpontját, a Moncada laktanyát. A támadás nem volt sikeres, ennek ellenére ezt az eseményt tekintik a kubai forradalom kezdetének. A laktanyában szolgáló katonák a felkelők nagy részét borzasztó kínzásoknak vetették alá, majd tárgyalás nélkül kivégezték őket. Az életben maradt felkelők – közöttük két nő – pere nagy nyilvánosság előtt zajlott. A felkelők elnyerték a nép szimpátiáját. A vezetőket 13, a közkatonákat 10 évi börtönre ítélték. Castro pere azonban a santiagói kórházban, a nyilvánosság teljes kizárásával, egy kórteremben zajlott. Közel négy órán át tartó védőbeszéde – melyet utolsó mondatáról "La historia me absolverá" (A történelem fel fog menteni) címen ismernek – vádirat a Batista-rezsim ellen, illetve saját politikai programjának kihirdetése. Ez a szónoklat titokban elterjedt egész Kubában, és szimpatizánsokat szerzett a Movimientónak. Castrót 15 évre ítélték. Népszerűsége megugrott, és nemzeti mozgalom indult a moncadisták amnesztiája érdekében. Batista az USA nyomására kénytelen volt közkegyelmet hirdetni. A mozgalomhoz azonnal csatlakoztak a különböző katonai csoportok is, elkezdődött a pénzgyűjtés és a titkos katonai felkészülés.
1955-ben Castro elhagyta Kubát, és a pénzügyi-katonai háttér kialakításán fáradozott. Kijelentette, hogy nem terrorizmust, hanem forradalmat akar, és bízik abban, hogy a tömegek mögé fognak állni. Bejelentette a sajtóban, hogy expedíciós hadsereget indít Kubába, hogy elűzze Batistát. A Granma kihajózása azonban nem volt jól megszervezett akció, így megsemmisítő vereséget szenvedett a 82 fős hadoszlop, amely ezután szétszóródott.
Batista első "vereségét" egy interjú okozta, ugyanis a riporter erősen szimpatizált Castróval. A riport hatására számos befolyásos ember csatlakozott a mozgalomhoz. Castro a rádióban szólította fel a kubaiakat, hogy aktívan vegyenek részt a harcban (sztrájk, munkalassítás).
Castro sikereinek hírére a mérsékelt ellenzék is csatlakozott a mozgalomhoz. 1957 júliusában aláírták a Sierra Maestra-i Nyilatkozatot, amelyben Batista lemondását és új választások kiírását követelték. A kormány közben egyre idegesebben és agresszívabban lépett fel az ellenzékkel szemben. Castróék közben egy Batista-ellenes erőket tömörítő egységfront létrehozásán fáradoztak.
Castro a radikális baloldaliak mellé állt, ezzel megkönnyítette a kommunisták dolgát, akik eddig gondolkoztak, hogy a harc mellé álljanak-e, így azonban támogatták Castrót.
1958 márciusában Batista szükségállapotot hirdetett, és elhalasztotta a júniusra kiírt választásokat. Erre válaszul Castro totális háborút hirdetett, de ez nem volt jól megszervezve, ráadásul Batistának kellemes meglepetést jelentett, hogy a térség diktátorai szolidaritásból fegyvereket küldtek neki. Május végén Batista összehangolt támadást indított, de az offenzíva végül kudarcba fulladt, mert hiába állt szemben katonája Castro 1000 gerillájával, azok sokkal jobban ismerték a terepet, ami óriási előnyt jelentett.
1958 őszén Fidel Castro úgy döntött, hogy az ország egész területére kiterjeszti a gerillaháborút. Erre két hadosztály kapott megbízást: az egyik Havanna felé, a másik nyugatra vonult. Az volt a taktikájuk, hogy a városokat összekötő utakat, hidakat tönkretették, így Batista csapatai nem jutottak utánpótláshoz, és könnyű volt őket felszámolni. November végén a kormánycsapatok próbálták megállítani őket, de a támadás december elején összeomlott, és a gerillacsapatok kezdtek támadásba. Nem sokkal később már az egész ország Castro kezén volt, három nagyvárost kivéve.
Batista és közvetlen hívei 1958 decemberének végén elmenekültek az országból, a Castro vezette Forradalmi Hadsereg 1959. január 1-jén bevonult Havannába, ahol semmiféle ellenállás nem fogadta őket. A Moncada-laktanyát január 2-án egyetlen puskalövés nélkül foglalták el. Győzött a forradalom. Az államosítások miatt konfliktusba keveredtek az Egyesült Államokkal, amely 1961 januárjában megszakította a diplomáciai kapcsolatokat, április 15-én pedig már bombázta Havannát. Két nap múlva a Disznó-öbölnél 1300 kubai emigráns (amerikai támogatással) partraszállást kísérelt meg, de támadásuk három nap alatt összeomlott. 1962 februárjában Washington kereskedelmi embargót rendelt el Kuba ellen, válaszul Castro Moszkva támogatását kérte, s a szovjetek rakétákat telepítettek Kubába.
A két szuperhatalom atomháborúval fenyegető konfliktusa 1962 őszén végül békésen oldódott meg, Kuba pedig egyre jobban a Szovjetunióhoz és a kommunista ideológiához kötődött. A földbirtokos osztályt egy új földreform felszámolta, bevezették a gazdaság központi irányítását. Fő exportterméküket, a nádcukrot a szovjet tömb vette meg. Kuba kilépett az Amerikai Államok Szervezetéből, 1972-ben a KGST tagja lett, s mind aktívabbá vált az el nem kötelezett országok csoportjában. 1975-ben katonailag segítette az angolai felszabadító mozgalmat, 1977-ben az etiópiai forradalmat.
Az Egyesült Államok 1975-ben lazított az embargón, 1978-tól lehetővé vált az emigránsok hazalátogatása, a családok egyesítése. A szocialista világrendszer 1989-es összeomlása után sokan azt várták, hogy Castro is megbukik, ám alábecsülték őt. Kuba elszigetelődött ugyan, de a "Líder Máximo" belső ellenzéke nem tudott felülkerekedni.
A demokráciák világában Castro továbbra is korlátlan hatalmú vezetőként állt országának élén, jelszava nem változott: "Szocializmus vagy halál".
A szovjet támogatás elmaradása miatti ellátási válságot ügyesen kezelte: az ellenzéket szigorúan kordában tartva korlátozott gazdasági reformokat vezetett be. Megengedte a dollár birtoklását magánszemélyeknek, elfogadta a magánvállalkozást és tűrte a külföldi tőke behatolását, s megindult a gazdasági növekedés. Castro valós vagy vélt ellenfeleivel keményen bánt el: több tízezerre teszik a megkínzott vagy kivégzett ellenzékiek és ellenállók számát, újabb tízezrek lélekvesztőn Floridába menekülve vesztették életüket. Hatalma azonban nemcsak a félelmen alapult: legendás volt meggyőző ereje, gyengéje viszont saját tévedhetetlenségébe vetett hite.
Nyugállománya és halála
Gyakran jelent meg a nyilvánosság előtt, és még idős korában is többórás beszédeket tartott. 2006. július 31-én jelentették be, hogy Castro súlyos bélműtéten esett át, és "ideiglenesen" átadja a hatalmat öccsének, a nála öt évvel fiatalabb Raúl Castrónak. A hivatalos közlések szerint folyamatosan javuló állapotú Castro ezt követően csak ritkán jelent meg a nyilvánosság előtt, de többször célzott arra, hogy nem ragaszkodik a hatalomhoz.
A nyugati világ utolsó kommunista vezetője, a világ egyik legrégebben hivatalban lévő államfője (ekkor csak a thaiföldi király és II. Erzsébet brit uralkodó előzte meg hivatalban töltött idő tekintetében) fél évszázad után engedte ki a hatalmat kezéből. 2008. február 19-én hivatalosan lemondott elnöki, kormányfői és hadvezéri posztjáról öccse, Raúl Castro javára, azonban a pártfőtitkári posztot megtartotta. 2011. április 19-én lemondott a Kubai Kommunista Párt első titkári posztjáról, és kilépett a párt központi bizottságából is. A párt élén szintén öccse követte.
2016. november 25-én hunyt el. A Santa Ifigenia temetőben temették el Santiago de Cubában. Végrendeletében megtiltotta, hogy utcákat, szervezeteket nevezzenek el róla, vagy szobrokat állítsanak fel emlékére.
Magyarul megjelent művei
Fidel Castro beszéde a szocialista Forradalmi Egységpártról; Kubai Nagykövetség, Bp., 1962
Fidel Castro válogatott beszédei; Kossuth, Bp., 1962
Fidel Castro beszédei; MSZMP Politikai Főiskola, Bp., 1971
Kuba Kommunista Pártjának I. kongresszusa. 1975. december 17–22. / Fidel Castro előadásával, Kádár János felszólalásával; ford. Benczik Vilmos, Lonkai Péterné; Kossuth, Bp., 1976
La historia me absolverá / A történelem feloldoz engem; sajtó alá rend. Györkei Jenő; Honvédelmi Minisztérium Központi Ny., Bp., 1978
Beszédek és beszélgetések; vál. Kerekes György, ford. Gulyás András, Koroncz Ágnes, Pál Ferenc; Kossuth, Bp., 1979
Kuba Kommunista Pártjának II. kongresszusa. 1980. december 17–20. / Fidel Castro beszámolójával, zárszavával és Korom Mihály felszólalásával; ford. Gulyás András; Kossuth, Bp., 1981
Kuba Kommunista Pártjának III. Kongresszusa. 1986. február 4–7. / Fidel Castro beszámolójával és Sarlós István felszólalásával; ford. Nagy Imre, Vincze Istvánné; Kossuth, Bp., 1986
Fidel. Ifjú éveim. Önarcképek Fidel Castrótól; ford. Dornbach Mária, előszó Gabriel García Márquez; Ulpius-ház, Bp., 2005
Fidel Castro válogatott beszédei; Fapadoskönyv Kiadó, Bp., 2011 (A demagógia klasszikusai)
Irodalom
Anderle Ádám: Kuba története
Quirk, Robert: Fidel Castro
Roca, Blas: A kubai forradalom
Robert Merle: Moncada. Fidel Castro első csatája; ford. Dankó Éva; Európa, Bp., 1967
Frei Betto: Fidel és a vallás; ford. Hargitai György; Kossuth, Bp., 1987
Marita Lorenz: Szerelmem, Fidel; ford. Deréky Géza; Magyar Könyvklub, Bp., 2002
Juan Gasparini: Diktátorok asszonyai. Fidel Castro, Augusto Pinochet, Ferdinand Marcos, Alberto Fujimori, Jorge Rafael Videla, Szlobodan Milosevics; ford. Dornbach Mária, Csikós Zsuzsa; Gabo, Bp., 2003
Nemere István: Castro. Szabálytalan életrajz. Egy diktátor a huszonegyedik században; Pallas, Gyöngyös, 2005
Noble Alexander–Kay D. Rizzo: Szabadon halok meg. Fidel Castro börtönében voltam; ford. Hegyes H. Géza; Élet és Egészség, Bp., 2005
Thomas M. Leonard: Fidel Castro élete; ford. Kincse Szabolcs; Sirály!, Bp., 2005
Konok Péter: Castro és a castrozimus. szocializmus.cu Rubicon, 2006. 8. 14–25. pp.
Brian Latell: Kuba Fidel Castro után; ford. Rákócza Richárd; HVG Könyvek, Bp., 2008
Juanita Castro: Fidel Castro magánélete. Három Castro-testvér története. Juanita Castro visszaemlékezései; lejegyezte María Antonieta Collins, ford. Bethlen József; Duna International, Bp., 2010 (Ember – sors – történelem)
Norberto Fuentes: Fidel Castro önéletrajza. Regény; ford. Babits Péter; Alexandra, Pécs, 2011
Jegyzetek
Források
Fidel Castro (1926 – napjainkig)
Fidel Castro Biography
Fidel Castro History Archive
További információk
A Karib-tenger kommunistája – index.hu
1926-ban született személyek
2016-ban elhunyt személyek
Kubai politikusok
Kubai kommunisták
Lenin-renddel kitüntetettek
Kommunista pártvezetők | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 3,045 |
Q: php date function returning incorrect value I'm attempting to convert user inputted 12 hour time to 24 hour time in php so I can better sort and report on it. below code returns 16:00 no matter what is entered.
$starttime1 = date("H:i", strtotime("$starttime"));
in this instance what is being fed to $starttime is g:i:s:A or 4:00:00:AM
In the last hour of searching it appears to be an issue with the date function not getting the right information, so I tried DateTime::createFromFormat
$starttime = DateTime::createFromFormat('g:i:s:A', $starttime);
$starttime1 = $starttime->format( 'H:i');
generates null
I feel like I'm doing something stupid.. need to take a break from coding and will keep googling, but hoping someone can point me in the right direction.
A: That's probably because you have a :AM in your time string. It should be a space instead of the :
$time = '4:00:00 AM';
$time = date('H:i', strtotime($time));
And the var_dump of $time would be:
string(5) "04:00"
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 6,247 |
Stay Hungry (englisch für "Bleib' hungrig" oder "hungrig bleiben") steht für:
Mr. Universum (Film), US-amerikanischer Film von 1976, Originaltitel Stay Hungry
Stay Hungry (Album), Album der US-amerikanischen Rockband Twisted Sister von 1984 | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 2,358 |
This entry was posted in Pet Care Articles & Tips and tagged ingredients, pet food, video on January 18, 2012 by DogSmith.
Is your best friend getting the healthy diet they need?
This entry was posted in Pet Products and tagged holistic pet food, pet food on November 15, 2011 by DogSmith.
If You Had One Sentence To Share Advice On Pet Food!
Now…what is your one sentence?
Are you subscribed to Truth About Pet Food Newsletter? Click Here to subscribe.
Follow Truth about Pet Food on Twitter.
Become a Fan of Truth and Vindication on Facebook.
This entry was posted in Pet Care Articles & Tips and tagged pet food on October 31, 2011 by DogSmith.
Is your choice of pet food APHIS EU Certified?
Animal Plant Health Inspection Services (APHIS) European Union (EU) Certification; this is what a pet food manufacturer must have before a pet food can be shipped to Europe. This certification could provide the answer to quality of ingredients many pet parents have.
A pet food manufactured in the US and sold in the US, thanks to FDA Compliance Policies, can include rendered ingredients sourced from 4D (diseased, dying, disabled, and dead) animals. However, a pet food manufactured in the US and exported to Europe must be made from ingredients "fit for human consumption".
So what does this mean to petsumers?
Regardless if you live in the US or in Europe, a pet food that has APHIS EU certification provides you with several guarantees.
1. meat ingredients are sourced from animals fit for human consumption (human grade).
2. knowledge of GM ingredients (manufacturer would be required to know and provide this information to US or Canadian pet parents, would be listed on the label for EU pet parents).
3. Suppliers of ingredients are inspected and approved by USDA.
And yes, pet foods can have APHIS EU certification and be sold in the US (and anywhere else in the world).
Call your pet food manufacturer and ask if the food has APHIS EU certification. Warning: I've had some pet foods over the years try to tell me they are inspected by APHIS; this is not a complete or correct answer. You need to know if the pet food manufacturing plant specifically has APHIS EU certification. Yes, you can ask for a copy of that certification for proof.
And by the way, don't assume that because a pet food is sold in Europe but known to be a US pet food has APHIS EU certification. Many brands that are sold internationally have manufacturing plants in various countries around the world; this is a way to avoid stricter import/export laws.
This entry was posted in Canine Rescue Resources Program and tagged aphis certified, pet food on August 31, 2011 by DogSmith.
Note that the above company uses "whole-egg waste from egg-grading plants" – in other words, eggs rejected for use as human food – and turns it into powdered pet food ingredients. Waste, eggs rejected for human use, become pet food.
Egg liquids were (and we have to assume are still) treated with NaOH…which is "Sodium Hydroxide, which is also commonly referred to as Caustic Soda, Caustic or Lye." Yes…Lye…as in soap.
Wouldn't lye (or sodium hydroxide) be dangerous for pets to consume? Yes it is.
The pet food ingredient that could be made from waste eggs would be listed as "egg product" on the pet food label. If your choice of pet food contains this ingredient, call the manufacturer and ask if the eggs are sourced from "whole-egg waste from egg-grading plants" or if the egg product is sourced from USDA approved eggs. If the manufacturer representative doesn't know or won't tell you, you might want to consider a new pet food.
It continues to baffle me as to why regulatory authorities continue to allow the pet food industry to be the dumping ground for all things waste. Regardless of federal law, regardless of the potential hazard to the pet consuming these waste ingredients…pet food continues to be THE place to sell your garbage.
Why wait? Order Your Free Samples Today!!!
Dog food samples are approximately 3.8 ounces and cat food samples are 2.2 ounces. The samples are NOT meal-size and are enough to satisfy the taste, feel and smell senses. Since Life's Abundance Premium Health Food For Dogs and Cats has a 30-day money back guarantee, rather than ordering a sample, you might consider ordering the smallest bag of Life's Abundance Dog Food. This is a great way to try our other HealthyPetNet products, too! What have you got to lose?
This entry was posted in Pet Care Articles & Tips and tagged egg waste, holistic pet food, lifes abundance, pet food on August 24, 2011 by DogSmith.
We have another study proving pet foods are often not what their labels claim they are. This time, alternative meat protein dog foods (venison) were tested. They found 75% included ingredients not listed on the label.
In the Journal of Animal Physiology and Animal Nutrition, first published late last year, authors D. M. Raditic, R. L. Remillard, and K. C. Tater provides "ELISA testing for common food antigens in four dry dog foods used in dietary elimination trials." This study took a close look at four venison kibble dog foods for common food allergens (a venison dog food would be commonly recommended as an alternative diet for dogs suffering from food allergies). They found that three of the four dog foods tested – that did NOT have soy listed on the ingredient panel – tested positive for soy. One of the four venison dog foods tested positive for beef, yet no beef ingredient was listed on the ingredient panel.
When you read the full text of this study, it does allude to be in support of prescription pet foods. However, these scientists did not include brands of prescription pet foods in their study. To read the full study, click here.
Thanks to FreshFetch pet foods for sharing this study with us.
This entry was posted in Pet Care Articles & Tips and tagged DogSmith, holistic, labels, lifes abundance, pet food, truth on May 3, 2011 by DogSmith.
This entry was posted in Pet Care Articles & Tips and tagged fda testing, pentobarbital, pet food on April 21, 2011 by DogSmith. | {
"redpajama_set_name": "RedPajamaC4"
} | 6,181 |
Home / Library / Books / Wahhabism-A Critical Essay by Hamid Algar
Wahhabism-A Critical Essay by Hamid Algar
March 15, 2018 Books, Library, Publication
In this Critical essay, Hamid Algar, Professor of Islamic Studies at the University of California, Berkeley, writes about the rise of Wahhabism in Saudi Arabia, arguing throughout that it has seriously distorted the fundamental teaching of Islam and functioned for decades as the ideological mainstay of the Saudi regime.
What follows is a modest survey of the history, the doctrines, and the contemporary significance of Wahhabism. Persons sympathetic to the teachings we call here "Wahhabism" might, of course, object to this designation, for it is a tide given to the movement by those standing outside of it, often with pejorative intent. Wahhabis themselves prefer the titles al-Muwahhidun or Ahl al-Tauhid, "the asserters of the divine unity." But precisely this self-awarded tide springs from a desire to lay exclusive claim to the principle of tauhid that is the foundation of Islam itself; it implies a dismissal of all other Muslims as tainted by shirk. There is no reason to acquiesce in this assumption of a monopoly, and because the movement in question was ultimately the work of one man, Muhammad b. 'Abd al-Wahhab, it is reasonable as well as conventional to speak of "Wahhabism" and "Wahhabis."
Two other preliminary remarks. First, in the extremely lengthy and rich history of Islamic thought, Wahhabism does not occupy a particularly important place. Intellectually marginal, the Wahhabi movement had the good fortune to emerge in the Arabian Peninsula (albeit in Najd, a relatively remote part of the peninsula) and thus in the proximity of the Haramayn, a major geographical focus of the Muslim world; and its Saudi patrons had the good fortune, in the twentieth century, to acquire massive oil wealth, a portion of which has been used in attempts to propagate Wahhabism in the Muslim world and beyond. In the absence of these two factors, Wahhabism might well have passed into history as a marginal and shortlived sectarian movement. Those same two factors, reinforced by a partial congruity with other contemporary tendencies in the Islamic world, have endowed Wahhabism with a degree of longevity.
Second, Wahhabism is an entirely specific phenomenon, calling for recognition as a separate school of thought or even as a sect of its own. Sometimes the Wahhabis are characterized, particularly by non-Muslim observers searching for a brief description, as "extreme" or as "conservative" Sunnis, with adjectives such as "stem" or "austere" added for good measure. It has, however, been observed by knowledgeable Sunnis since the earliest times that the Wahhabis do not count as part of the Ahl al-Sunna wa al-Jama'a, for almost all the practices, traditions and beliefs denounced by Muhammad b. 'Abd al-Wahhab have been historically integral to Sunni Islam, enshrined in a vast body of literature and accepted by the great majority of Muslims. Precisely for that reason, many of the 'ulama contemporary with the first emergence of Wahhabism denounced its followers as standing outside the pale of Ahl al-Sunna wa al-Jama'a. That Wahhabis are now counted as Sunni is one indication that the term "Sunni" has come to acquire an extraordinarily loose meaning, not extending much beyond recognition of the legitimacy of the first four caliphs (regarded by Sunnis as the Khulafa al-Rashidun ["the Righdy Guided Caliphs"]); in fact, it signifies little more than "non-Shi'i." Our characterization of Wahhabis as non-Sunni is therefore above all a historical clarification; it has in itself no polemical purpose, if only because for the present writer Sunnism is but one representation and interpretation of Islam.
Another general notion concerning Wahhabism fixed in the minds of many Muslims is that it stood at the origin of a series of reform movements which in some cases are still active in the Muslim world. Thus it is imagined that a direct line of descent led from the Wahhabis in Arabia first to Jamal al-Din al-Afghani, Muhammad 'Abduh, and Rashid Rida, and from them to the Muslim Brotherhood (al-Ikhwan al-Muslimun)—in short, to the conglomeration of persons and movements known as the Salafiyya. There are, indeed, points held in common by Wahhabis and Salafis, as will be discussed later in this essay, and it was not entirely by accident that from the 1960's onwards many activists of the Ikhwan chose Saudi Arabia as their place of refuge from persecution by 'Abd al-Nasir. There is, however, no genetic connection between Wahhabism and movements that subsequently arose in the Muslim world. The relative prevalence of Wahhabi modes of thought now observable in various Muslim countries is a more recent phenomenon, due to a variety of contingencies unconnected with the first appearance of that sect. A related error is to think of Wahhabism as having been from the time of its origin a reform movement that found a widespread and sympathetic echo in the Muslim world, or that it conformed to a general pattern of "renewal" (tajdid) then underway in the Middle East, in South Asia, in Africa and elsewhere. All those movements were largely different in their nature from Wahhabism, which must be regarded within the specific context of its own time as an exception, an aberration, or at best an anomaly.
English-born Hamid Algar received his Ph.D. in oriental studies from Cambridge. Since 1965, he has served on the faculty of the Department of Near Eastern Studies at the University of California, Berkeley, where he teaches Persian and Islamic history and philosophy. Dr. Algar has written extensively on the subject of Iran and Islam, including the books Religion and State in Iran, 1785-1906 and Mirza Malkum Khan: A Biographical Study in Iranian Modernism. He has been following the Islamic movement in Iran with interest for many years. In an article published in 1972, he assessed the situation there and forecast the Revolution "more accurately than all the U.S. government's political officers and intelligence analysts," in the words of Nicholas Wade, Science magazine. Dr. Algar has translated numerous books from Arabic, Turkish, and Persian, including the book Islam and Revolution: Writings and Declarations of Imam Khomeini.
Wahhabism, a critical essay
A: from the writing of Muhammad b. ʻAbd al-Wahhab
B: A near contemporary view of early Wahhabism
C: A Shia Response to Wahhabism
Title: Wahhabism, a critical essay
Author: Hamid Algar
Publisher: Islamic Publications International
Pub. Date: 1 Mar. 2002
Where does ISIS come from and what does it want?
Ziyarah (visitation) according to Sunnis and Shiah
MWM Chief Vows Sunni and Shia Muslims to Crush Tak...
The Great Theft: Wrestling Islam from the Extremis...
Hamid Algar Muhammad b. ʻAbd al-Wahhab Saudi Arabia Takfirism Wahhabism 2018-03-15
Tags Hamid Algar Muhammad b. ʻAbd al-Wahhab Saudi Arabia Takfirism Wahhabism
The Great Theft: Wrestling Islam from the Extremists
Book: Wahhabis Fitna Exposed +PDF
Video: Advertising Halal Alcoholic Drinks in Saudi Arabia!!
A footage of a car carrying alcoholic drinks to different quarters of the city was spread recently that was recorded by a Saudi man. A point which is important in this video is that a...
Forbiddin
Please provide the download link
Salaam Alaykum dear friend. Thank you for comment. I searched for the PDF file of the book, but I couldn't find it. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 7,306 |
\section{Introduction}\label{sec:Intro}
Understanding the dynamics of charged particles in reconnecting solar processes, in particular the acceleration of particles in solar flares, is of fundamental importance for advancing our knowledge of plasma behaviour in general \citep[for example, recent reviews on particle acceleration in flares include][]{review:Vilmeretal2011,review:Fletcheretal2011,review:Zharkovaetal2011,review:Cargilletal2012}. There has been growing observational evidence that accelerated particle populations also occur in smaller scale processes such as micro-flares \citep[see e.g.][and references therein]{review:Hannahetal2011} or nano-flares \citep[][]{paper:Testaetal2014}; these processes are also often associated with magnetic reconnection.
In the context of the solar atmosphere, it is now widely accepted that magnetic reconnection contributes to the maintenance of thermal \citep[contributing to coronal heating as discussed in][]{review:ParnelldeMoortel2012,review:Parnelletal2015} and sporadic generation of non-thermal (high-energy) particle populations. Since magnetic reconnection is intrinsically associated with field aligned electric fields \citep[e.g.][]{paper:Schindleretal1988,paper:HesseSchindler1988,paper:Schindleretal1991} and these electric fields are well-known accelerators of charged particles, the question of how the local particle dynamics on all scales are affected by these reconnection electric fields remains open and important. Additionally, magnetic reconnection can lead to rapid magnetic field changes that can also cause particle acceleration, such as collapsing magnetic traps \citep[e.g.][]{paper:GradyNeukirch2009, paper:Gradyetal2012, paper:EradatOskouietal2014,paper:EradatOskouiNeukirch2014}.
Previous studies of particle behaviour typically use a test particle approach to study a wide variety of configurations, all of which are underpinned by or directly investigate magnetic reconnection. For instance, the acceleration of particles at specific topological features has been explored in studies at/near 2/2.5D null points \citep[e.g.][]{paper:BulanovSasorov1976,paper:BruhwilerZweibel1992,paper:Kliem1994,paper:Litvinenko1996,paper:BrowningVekstein2001,paper:ZharkovaGordovskyy2004,paper:ZharkovaGordovskyy2005,paper:WoodNeukirch2005,paper:HannahFletcher2006,paper:Drakeetal2006} and, more recently, 3D null points (e.g. \citealp[][]{paper:DallaBrowning2005,paper:DallaBrowning2006,paper:DallaBrowning2008,paper:Guoetal2010,paper:Stanieretal2012}), stressed magnetic fields/current sheets \citep[e.g.][]{paper:Turkmanietal2005,paper:Onofrietal2006,paper:Gordovskyyetal2010b} and 3D magnetic separators \citep{paper:Threlfalletal2015,paper:Threlfalletal2015b}. Acceleration in more complex 3D models, such as twisted coronal loops \citep{paper:GordovskyyBrowning2011,paper:Gordovskyyetal2014}, have also been investigated.
A significant step forward from the analysis of a localised reconnection site was taken by \citet{paper:Baumannetal2013}, who combined localised particle-in-cell (PIC) analysis in the vicinity of a reconnecting null-point with a magnetohydrodynamic (MHD) model of the surrounding active region (AR). This allowed the global impact sites of the particles to be identified.
Instead of considering an isolated reconnection process, whether embedded in a global field or not, we take a different approach and investigate the particle acceleration in an observationally driven MHD simulation of an AR. A decade ago, the first MHD simulations of downscaled ARs were produced that were based on extrapolated observed magnetograms, driven in a manner which approximated motions arising from convection cells on a range of scales \citep[e.g.][]{paper:Gudiksen2005b,paper:Gudiksen2005a}. Only recently have large-scale computations been performed that model a full AR without downscaling \citep{paper:Bourdin+al:2013_overview}.
The MHD simulation we will use was designed to model the coronal response to photospheric driving by advection of field-lines resulting from horizontal granular motions in the photosphere, where the plasma beta is greater than one \citep{paper:Bourdin+al:2013_overview}. The base of the simulation is prescribed by an observed AR magnetogram with the subsequent field-line braiding inducing currents in the corona caused by quasi-static changes propagating at the Alfv{\'e}n speed along the field into the corona. In effect, this is one implementation of the field-line braiding mechanism of \citet{paper:Parker1972} and results in coronal loops with temperatures of around 1.5\unit{MK}. The location, apex height, and plasma flows along these loops all broadly match observations \citep{paper:Bourdin+al:2013_overview}. The feasibility of this field-line braiding mechanism to heat the corona sufficiently by Ohmic dissipation of induced currents is demonstrated in \citet{paper:Bourdin+al:2015_energy-input}. This suggests that reconnection occurs regularly throughout the AR, and, hence, there must be widespread parallel electric fields.
In this paper, we investigate what, if any, particle acceleration occurs in this MHD simulation of an observed non-flaring AR \citep{paper:Bourdin+al:2013_overview}. In this kind of model there are a wide range of locations (magnetic configurations) at which reconnection occurs, as well as a range of different reconnection regimes in operation. Thus, the MHD model we investigate here incorporates many of the particle acceleration scenarios that have been considered in isolation, as mentioned above. Thus, in this paper we consider the electromagnetic fields that have been generated in a non-flaring active-region simulation based on observations and determine the effects they have on charged particle dynamics.
\begin{figure*}[t]
\centering
\resizebox{.98\textwidth}{!}{\includegraphics{JT2015b_fig1}}
\caption{Panels, from L-R, showing a) a Hinode/SOT magnetogram of an AR core seen on the 14th Nov 2007 saturated at $\pm300$\unit{G}, b) a Hinode/EIS image of the \ion{Fe}{xv} emission (at $1.5\unit{MK}$) of the corona above this region and c) the co-spatial and co-temporal simulated parallel electric field strength and orientation within this region (where pink/purple represents positive/negative $E_{||}$, and the opacity represents the relative strength of $E_{||}$ - fully opaque regions identify \new{$E_{||}=0.25E_{||}^{\rm{peak}}$ while transparent regions show $E_{||}=0.01E_{||}^{\rm{peak}}$, for a peak coronal electric field strength $E_{||}^{\rm{peak}}\sim3.5\unit{Vm^{-1}}$ in the simulation domain)}. The right hand panel is generated by simulations described in \citet{paper:Bourdin+al:2013_overview}, which also describes field lines which cross the intensity maxima of several EUV-emissive coronal loops, which have been overlaid in each panel; "CL" indicates core loops, while "SL" indicates shorter loops. The circles indicate EUV-emissive loop footpoints in the model and the corresponding plasma motion (and observed Doppler shifts) at these locations; red represents draining (i.e. motion along the line-of-sight away from an observer) while blue represents upflows (motion towards an observer).}
\label{fig:Eparconfig}
\end{figure*}
The primary objective of the present work is to survey the particle dynamics which result from MHD simulations of a non-flaring AR, and to determine the extent and locations to which particles may be accelerated this type of model. The paper is organised as follows: in Sect.~\ref{sec:model} we discuss the model itself, introducing both the MHD simulation domain (described in Sect.~\ref{subsec:ARsim}) and the equations which govern test particle motion (in Sect.~\ref{subsec:guidingcentre}). A survey of orbit behaviour throughout the AR core is outlined and discussed in Sect.~\ref{sec:global}, before examining specific test particle examples in detail in Sect.~\ref{sec:localbehaviour}. A discussion of our findings is presented in Sect.~\ref{sec:discussion} before conclusions and future areas of study are outlined in Sect.~\ref{sec:conclusions}.
\section{Model setup}\label{sec:model}
Our model can be broadly split into two parts: a time-dependent MHD simulation (modelling the solar corona above an AR) on time-scales of hours into which we insert particles (using a single evolved snapshot), and the test particle motion itself on time scales of seconds. A brief overview of both parts are described in the following sections:
\subsection{MHD active region model}\label{subsec:ARsim}
The AR MHD simulation of \citet{paper:Bourdin+al:2013_overview} that we use is observationally driven;
\new{a potential-field extrapolation from an observed line-of-sight (LOS) magnetogram on the base determines the initial magnetic field state within the numerical domain. During the simulation the magnetic field is self-consistently computed within the domain, while the lower boundary is evolved in line with the observed time-series of LOS magnetograms.}\new{ These} magnetogram\new{s were} obtained from the {{Hinode}} solar observatory \citep{paper:Kosugietal2007,paper:Culhaneetal2007,paper:Golubetal2007}. The region in question is located close to the centre of the solar disk on the 14th November 2007; while not assigned an NOAA AR number, the observed region displayed many typical AR characteristics (for example, a system of closed loop structures, visible in both EUV and X-ray wavelengths, linking a pair of strong magnetic field patches of opposite polarity; see Fig.~\ref{fig:Eparconfig}).
While data from the {{Reuven Ramaty High Energy Solar Spectroscopic Imager}} \citep[RHESSI,][]{paper:Lineetal2002} was unavailable for this date, the Geostationary Operational Environmental Satellite (GOES) X-ray data suggests that solar activity at this time was particularly low. The most significant GOES event on the 14th November (and indeed for the preceding fortnight) was an A1-class event, while the emergence of a second AR (NOAA 10974) coincided with a B1-class event on the 17th November. From the available data, we characterise the chosen region as a relatively isolated, stable, and slowly evolving AR which (crucially) does not produce a flare within one day before and two days after the observation. Hence, it was an ideal choice for the original aim of the simulation, namely to study coronal heating.
The computational domain is periodic in the horizontal directions. To sufficiently isolate the main AR polarities from their periodic images, the AR observation is surrounded by a region of quiet Sun. The full horizontal extent of 235$\times$235\unit{Mm^2} is covered by 1024$^2$ grid points; approximately a quarter of this area covers the AR core (see Fig.~\ref{fig:Eparconfig}, which shows this core region alone). Thus the grid cells in the $x$$y$ directions are square with lengths of 230 km on either side.
The initial model atmosphere contains vertical stratification and is initialised smoothly to avoid spurious oscillations \citep[see][for more details]{paper:Bourdin+al:2014_switch-on}. Thus the domain has a stretched grid in the vertical direction that reaches up to 156\unit{Mm} above the photosphere. The vertical extent of each cell covers between 100\unit{km}, near the photosphere, up to a maximum of 800\unit{km} in the corona. For the top boundary, a potential-field extrapolation allows closed and "open" field lines to relax into a force-free state.
The compressible resistive MHD simulation was performed using the Pencil Code \citep{paper:BrandenburgDobler2002} and incorporates gravity, viscosity, and an isotropic magnetic diffusivity
$\eta (=1/\mu\sigma) = 10^{10}\unit{m^2/s}$ \citep[for electrical conductivity $\sigma$ and permeability of free space $\mu$; more details may be found in][]{paper:Bourdin+al:2013_overview}.
\new{This value achieves diffusion of the generated current density structures at the grid scale, and is equivalent to setting the magnetic Reynolds number around unity for length scales on the order of the simulation grid scale (which is necessary to achieve numerical stability).} \new{
More details of the implementation and selection of finite resistive effects for this (and related) model(s) may be found in e.g. \citet[][]{paper:GalsgaardNordlund1996,paper:BingertPeter2011,paper:Peter2015}. We address implications of the chosen parameter regime for the recovered particle behaviour in Sect.~\ref{sec:discussion}. An image highlighting the distribution of the parallel electric field in a single snapshot of the simulation domain can be seen in Fig.~\ref{fig:Eparconfig}. Parallel electric fields are a necessary and sufficient condition for magnetic reconnection, which dissipates electric currents via Ohmic heating.}
The initial magnetic field is evolved according to the advection of photospheric field-lines \new{using a time-series of line-of-sight magnetograms and} caused by a driver on the base which simulates horizontal granular motions in the photosphere. In this region the plasma beta is greater than one, but falls off \new{in height} as the density falls, such that the plasma beta is less than one in the corona. During the simulation run the magnetic field evolves self-consistently according to compressible resistive MHD, and subject to an energy equation that incorporates both heat conduction and radiative losses.
In particular, the energy input in the model results from the Poynting flux across the base, which provides approximately $10^7\unit{erg s^{-1} cm^{-2}}$ (vertical signed flux average) that passes through the transition-region layer and reaches the corona. This balances the expected coronal energy requirement of an AR core region by (partial) conversion of magnetic energy into heat, which forms EUV-emissive coronal loops \citep{paper:Bourdin+al:2014_coronal-loops}. A Spitzer-type heat conduction term is included in the energy equation to model energy losses in the corona due to fast electrons \citep{book:Spitzer1962}. In addition, X-ray and EUV emission is implemented through a radiative loss function which is parametrised by the local plasma density and temperature \citep{paper:Cooketal1989}.
\begin{figure*}[t]
\centering
\subfloat[Initial particle grid and high $E_{||}$ regions]{\label{subfig:ie}\resizebox{0.49\textwidth}{!}
{\includegraphics{JT2015b_fig2a}}}
\subfloat[Moderate and high $E_{||}$ regions]{\label{subfig:ip}\resizebox{0.49\textwidth}{!}
{\includegraphics{JT2015b_fig2b}}}
\caption{Illustration of initial particle grid and electromagnetic environment in our study. \protect\subref{subfig:ie} shows the grid of initial particle positions (shown as black orbs) located in the coronal region of MHD simulations of a stable AR \citep{paper:Bourdin+al:2013_overview}. Both \protect\subref{subfig:ie} \& \protect\subref{subfig:ip} show interpolated magnetic field lines (grey lines) and observed magnetogram at the base of the simulations, and isosurfaces of parallel electric field $E_{||}$; \protect\subref{subfig:ie} shows opaque \new{pink and purple} surfaces of \new{positive and negative $E_{||}$ respectively}, \new{encompassing regions of current} at $25\%$ of the peak value of $E_{||}$ in the corona, while \protect\subref{subfig:ip} also includes transparent surfaces of \new{$E_{||}$ at $1\%$} of the coronal peak value ($\sim3.5\unit{Vm^{-1}}$). For reference, three \new{green} orbs labelled "A", "B" and "C" indicate the initial positions of orbits studied in detail in Section.~\ref{sec:localbehaviour}.}
\label{fig:inisurvey}
\end{figure*}
The lack of flaring activity and the reported agreement with observations makes this simulation an ideal candidate to study \new{particle behaviour in a realistic solar configuration}.
\subsection{Relativistic particle dynamics}\label{subsec:guidingcentre}
Having established the global environment which we will study, all that remains is to outline the equations which will govern particle behaviour. Despite the lack of flaring activity, we anticipate particle velocities may achieve values of a significant fraction of the speed of light ($c$). We therefore make use of the full relativistic set of guiding-centre-motion equations, outlined in \citet{book:Northrop1963} \citep[based on the treatment of][]{paper:Vandervoort1960}, presented here in normalised form:
\begin{subequations}
\begin{align}
\frac{d{u_\parallel}}{dt}&=\frac{d}{dt}\left(\gamma v_{\parallel} \right)=\gamma{{\bf{u}}_E}\cdot{\frac{d{\bf{b}}}{dt}}+{\color{OliveGreen}{\Omega_{e}^{scl}}}{\color{OliveGreen}{t_{scl}}} E_\parallel-\frac{\mu_r}{\gamma}\frac{\partial{B^\star}}{\partial s}, \label{eq:Rnorm1} \\
{\bf\dot{R}_\perp}&={{\bf{u}}_E}+\frac{\bf{b}}{B^{\star\star}}\times\left\lbrace \frac{{1}}{{\color{OliveGreen}{\Omega_{e}^{scl}}}{\color{OliveGreen}{t_{scl}}}}\left[ \frac{\mu_r}{\gamma}\left( \boldnabla{B^\star}+ \frac{{\color{OliveGreen}{{v_{scl}}^2}}}{{c^2}}{{\bf{u}}_E}\frac{\partial B^\star}{\partial t}\right)\right.\right. \nonumber \\
&\qquad\quad\qquad\qquad\left.\left. +u_\parallel\frac{d{\bf{b}}}{dt}+\gamma\frac{d{{\bf{u}}_E}}{dt}\right]+\frac{{\color{OliveGreen}{{v_{scl}}^2}}}{{c^2}}\frac{u_\parallel}{\gamma}{E_\parallel}{{\bf{u}}_E} \right\rbrace, \label{eq:Rnorm2} \\
\frac{d\gamma}{dt}&=\frac{{\color{OliveGreen}{{v_{scl}}^2}}}{{c^2}}\left[{\color{OliveGreen}{\Omega_{e}^{scl}}}{\color{OliveGreen}{t_{scl}}}\left({\bf\dot{R}_\perp}+\frac{u_\parallel}{\gamma}{\bf{b}}\right)\cdot{\bf{E}}+\frac{\mu_r}{\gamma}\frac{\partial B^\star}{\partial t}\right], \label{eq:Rnorm3} \\
\mu_r&=\frac{\gamma^2{ v_{\perp} ^2}}{B}. \label{eq:Rnorm4}
\end{align}
\label{eq:rel_norm}
\end{subequations}
{\noindent}Here $\mu_r$ is the relativistic magnetic moment, for a particle with rest-mass $m_0$ and charge $q$, whose guiding centre is located at ${\bf{R}}$, subject to an electric field ${\bf{E}}$ and a magnetic field ${\bf{B}}$ (with magnitude $B(=|{\bf{B}}|)$ and unit vector ${\bf{b}}(={\bf{B}}/B)$). Local conditions will dictate aspects of the orbit behaviour, particularly through guiding centre drifts; the largest in magnitude is typically the ${E}\times{B}$ drift, which has a velocity ${{\bf{u}}_E}(={\bf{E}}\times{\bf{b}}/B)$. The component of velocity parallel to the magnetic field is $ v_{\parallel} (={\bf{b}}\cdot{\dot{\bf{R}}})$, while $E_{\parallel}(={\bf{b}}\cdot{\bf{E}})$ is the magnitude of the electric field parallel to the local magnetic field, $\dot{\bf{R}}_\perp(=\dot{\bf{R}}- v_{\parallel} {\bf{b}})$ is the component of velocity perpendicular to ${\bf{b}}$, and $s$ is a line element parallel to ${\bf{b}}$. Finally, $\gamma$ is the Lorentz factor ($\gamma^2=1/\left(1-v^2/c^2\right)=c^2/\left(c^2-v^2\right)$). Using this factor, we define a relativistic parallel velocity $u_{\parallel}(=\gamma v_{\parallel} )$ for simplicity of notation.
\begin{figure*}[t]
\centering
\subfloat[Final electron positions and peak energies]{\label{subfig:esurvey}\resizebox{0.425\textwidth}{!}{\includegraphics{JT2015b_fig3a}}}
\resizebox{0.135\textwidth}{!}{\includegraphics{JT2015b_fig3x}}
\subfloat[Final proton positions and peak energies]{\label{subfig:psurvey}\resizebox{0.425\textwidth}{!}{\includegraphics{JT2015b_fig3b}}}
\caption{Survey of the behaviour of 2000 \protect\subref{subfig:esurvey} electron and \protect\subref{subfig:psurvey} proton orbits, for initial position grid seen in Fig.~\ref{subfig:ie}. Final particle positions are colour-coded by peak energy achieved during the orbit calculation lasting 10$\rm{s}$ (or upon leaving the MHD simulation domain) with interpolated magnetic field lines (thin grey lines) included for reference.}
\label{fig:bigsurvey}
\end{figure*}
\new{Equations~(\ref{eq:rel_norm}) have been expressed in dimensionless form,} using a field strength ${\color{OliveGreen}{b_{scl}}}$, lengthscale ${\color{OliveGreen}{l_{scl}}}$ and timescale ${\color{OliveGreen}{t_{scl}}}$. Dimensionless quantities are related to their dimensional equivalent through:
\[
\bar{\bf{B}}={\color{OliveGreen}{b_{scl}}}\,{\bf{B}}, \qquad \bar{x}={\color{OliveGreen}{l_{scl}}}\,{x}, \qquad \bar{t}={\color{OliveGreen}{t_{scl}}}\,t,
\]
where the barred quantities represent dimensional counterparts of the variables \new{seen in Eqs~(\ref{eq:rel_norm})}. This choice of quantities fixes the remaining normalising constants; for example, velocities in the model are scaled by ${\color{OliveGreen}{v_{scl}}}(={{\color{OliveGreen}{l_{scl}}}}{{\color{OliveGreen}{t_{scl}}}}^{-1})$, energies by ${{{KE}_{scl}}}(=0.5m{{\color{OliveGreen}{v_{scl}}}}^2)$ and (assessing the dimensions of Faraday's Law) electric fields are scaled by ${\color{OliveGreen}{e_{scl}}}(={{\color{OliveGreen}{b_{scl}}}\,{\color{OliveGreen}{l_{scl}}}}{{\color{OliveGreen}{t_{scl}}}}^{-1}={\color{OliveGreen}{b_{scl}}}\,{\color{OliveGreen}{v_{scl}}})$. This investigation is motivated by the behaviour of particles in a solar coronal environment. \new{Equations~(\ref{eq:rel_norm}) have been normalised} accordingly; unless otherwise stated, all experiments take ${\color{OliveGreen}{b_{scl}}}=0.001$\unit{T}, ${\color{OliveGreen}{l_{scl}}}=100$\unit{km} and ${\color{OliveGreen}{t_{scl}}}=10$\unit{s}.
To further simplify Eqs.~(\ref{eq:rel_norm}), only electrons or protons are considered here; this fixes the rest mass $m_0=m_e=9.1\times10^{-31}\rm{kg}$ and charge $q=e=-1.6022\times10^{-19}\unit{C}$ for electrons, or $m_0=m_p=1.67\times10^{-27}\unit{kg}$ and $q=|e|=1.6022\times10^{-19}\unit{C}$ for protons. In this way, several normalising constants are expressed in terms of a normalising electron/proton gyro-frequency, ${\color{OliveGreen}{\Omega_{e}^{scl}}}(={q\,{\color{OliveGreen}{b_{scl}}}}{m_0}^{-1})$. The factor of ${\color{OliveGreen}{\Omega_{e}^{scl}}}{\color{OliveGreen}{t_{scl}}}$ controls the scales at which certain guiding centre drifts become important.
Finally, several terms in Eqs.~(\ref{eq:rel_norm}) now also depend on the ratio of perpendicular electric field ($E_\perp$) to the magnitude of the magnetic field ($B$); \new{for a given magnetic field strength $B$, $B^{\star}$ and $B^{\star\star}$ are defined as
\[
B^\star=B\left( 1-\frac{1}{c^2}\frac{{ E_{\perp} }^2}{B^2}\right)^{\frac{1}{2}} , \qquad B^{\star\star}=B\left(1-\frac{1}{c^2}\frac{{ E_{\perp} }^2}{B^2}\right).
\]
(NB. $B^\star$ and $B^{\star\star}$ retain the dimensions of $B$)}.
We evolve each of Eqs.~(\ref{eq:rel_norm}) in time using a 4th order Runge-Kutta scheme with a variable timestep, subject to the numerically derived values of electric and magnetic fields found in a single snapshot of the MHD simulations of \citet{paper:Bourdin+al:2013_overview} (discussed in Section~\ref{subsec:ARsim}). A similar approach has been used by, for example \citet{paper:GordovskyyBrowning2011,paper:Gordovskyyetal2014}. Each orbit is also terminated after the normalising timescale is reached, i.e. after $10$\unit{s} of real time. The MHD simulation timescale is determined by the cadence of the observed magnetogram timeseries used to drive the photospheric boundary, which \citep[for the results reported in][]{paper:Bourdin+al:2013_overview} is $90$\unit{s}. A comparison of the time between MHD snapshots and the timescale used in the guiding centre approximation code implies that these scales are well separated. We also assume that the spatial scales of the gyro-motion and the global MHD environment are similarly separated, and will test this assumption for all orbits (see Sect.~\ref{sec:global}).
\begin{figure*}[t]
\centering
\resizebox{0.77\textwidth}{!}{\includegraphics{JT2015b_fig4x}}\\
\subfloat[${\bf{E}}=0.1{\bf{E}}_{\rm{orig}}$; electrons]{\label{subfig:esurvey10}\resizebox{0.45\textwidth}{!}{\includegraphics{JT2015b_fig4a}}}
\subfloat[${\bf{E}}=0.1{\bf{E}}_{\rm{orig}}$; protons]{\label{subfig:psurvey10}\resizebox{0.45\textwidth}{!}{\includegraphics{JT2015b_fig4b}}}\\
\subfloat[${\bf{E}}=0.01{\bf{E}}_{\rm{orig}}$; electrons]{\label{subfig:esurvey100}\resizebox{0.45\textwidth}{!}{\includegraphics{JT2015b_fig4c}}}
\subfloat[${\bf{E}}=0.01{\bf{E}}_{\rm{orig}}$; protons]{\label{subfig:psurvey100}\resizebox{0.45\textwidth}{!}{\includegraphics{JT2015b_fig4d}}}
\caption{Surveys of electron and proton orbits, for initial position grid seen in Fig.~\ref{subfig:ie}, subject to electric field reductions of a factor $10$ (Figs.~\protect\subref{subfig:esurvey10}-\protect\subref{subfig:psurvey10}) and $100$ (Figs.~\protect\subref{subfig:esurvey100}-\protect\subref{subfig:psurvey100}) from the original electric field (${\bf{E}}_{\rm{orig}}$) determined by \new{the} MHD active region simulations. Final particle positions are colour-coded by peak energy \new{(using the same colour bar as in Fig.~\ref{fig:bigsurvey} to enable direct comparisons)} achieved during the orbit calculation lasting 10$\rm{s}$ for electrons or 1000$\rm{s}$ for protons (or upon leaving the MHD simulation domain) with interpolated magnetic field lines (thin grey lines) included for reference.}
\label{fig:bigsurvey10}
\end{figure*}
\section{Characteristics of global behaviour}\label{sec:global}
We begin by studying the particle orbit behaviour for a uniform grid of initial positions spread throughout the computational domain in the horizontal direction at several different heights. Our aim is to obtain an overview of the global orbit behaviour one might typically expect to find throughout the AR.
For this investigation, an identical number of particles for each species were studied; 2000 electron orbits and 2000 proton orbits were given an initial pitch angle of $45^{\circ}$ and an initial kinetic energy of $20$\unit{eV}. These choices are motivated by the findings of previous work \citep{paper:Threlfalletal2015}, where it was shown that (if present) the contributions from any local parallel electric fields typically outweigh the choice of initial kinetic energy and pitch angle in impacting particle behaviour. Furthermore, while the initial kinetic energy chosen here is relatively low compared to the equivalent thermal energy ($20\unit{eV}\approx0.23\unit{MK}$), this simply serves to aid illustration of particle orbit behaviour. We have also checked that a tenfold increase in initial particle energy does not significantly alter the overall findings reported here.
Our particles are distributed in a $20\times20\times5$ grid in $(x$,$y$,$z)$; the grid is evenly spaced and extends from $x,y\in[10,200]$\unit{Mm} in five $z-$planes, at $z=[60,65,70,75,80]$\unit{Mm} above the photosphere. A visual representation of this grid is shown in Fig.~\ref{subfig:ie}. This distribution of initial conditions of particle orbits was chosen to establish particle behaviour in a region encompassing the main AR features (including examples of both open and closed field structures), at large enough heights that both chromospheric effects (such as collisionality and partial ionisation) and numerical effects (primarily the inclusion of a stretched grid in $z$ close to the photospheric boundary) could be minimised. Figure~\ref{fig:bigsurvey} shows the results of both the electron and proton orbit calculations for this distribution of initial conditions.
We will now highlight some key findings illustrated by Fig.~\ref{fig:bigsurvey}. Firstly, all orbits (both protons and electrons) are accelerated to some degree, almost always because of the local parallel electric field. The majority of orbits achieve at least keV energies; the vast majority are accelerated to energies of $50$-$500$\unit{keV}. By comparing Fig.~\ref{subfig:esurvey} with Fig.~\ref{subfig:psurvey}, it is clear that a similar number of electron and proton orbits achieve $\gtrsim$\unit{MeV} energies. All of the orbits which achieve the highest energy levels in the survey have trajectories which head towards the lower solar atmosphere. Additionally, more electron than proton orbits may be found at the lowest energy levels. It is also apparent that several orbits, both proton and electron, appear to be continually reflected between mirror points; we will label these as "trapped" orbits.
\new{To estimate the number of trapped orbits, we count any orbit which contains two or more mirror points (locations where the parallel velocity reverses sign) as being "trapped". We estimate that, out of the $2000$ orbits initialised in the manner described earlier, $1061$ electron and $228$ proton orbits are mirrored twice or more. To present a fair comparison (with protons taking longer to reach two or more mirror points), we extended the simulation time of proton orbits \new{from 10s} to $1000\unit{s}$. While this is much longer than the $90\unit{s}$ cadence of the MHD simulations, our objective here is simply to assess under what conditions similar number of protons and electrons may be trapped. With an extended time-range, the number of trapped proton orbits rises to $840$. Thus, this trapping occurs for a significant fraction of the orbits considered in these surveys, but the true number of particles per species trapped by this mechanism is related to the time over which the MHD fields evolve, how these fields evolve, and the species mass and charge. Individual particle orbit examples, including trapped orbits, are studied in greater detail in Sec~\ref{sec:localbehaviour}.}
The maximum kinetic energy of any orbit was achieved by an electron, whose kinetic energy reached $41.5$\unit{MeV} (the highest energy reached by a proton was $28.7$\unit{MeV}). The minimum kinetic energy was achieved by an electron, which gained $0.09$\unit{eV} (the lowest energy gained by a proton was $0.5$\unit{eV}). Regarding the question of scale separation, the maximum electron gyro-radius recorded was $0.41$\unit{m}, while the maximum proton gyro-radius achieved during any orbit in the survey was $16.2$\unit{m}. The $x/y$ grid-point resolution of the MHD simulation is always $230$\unit{km}; the resolution in the $z-$direction varies between $100$ and $800$\unit{km} (caused by a non-equidistant grid). By comparison with the largest gyro-radii recorded, we can state that, at least in the case of the initial survey, the length scales of the MHD simulation and the particle orbits are sufficiently separate that our use of the guiding centre approximation is clearly justified.
\new{The amount of particle acceleration recovered in these orbit calculations is extreme, both in the number of particles which achieve modest/high energy gains, and the sizes of the gains themselves. The acceleration is a direct result of the electric field configuration used in the MHD active region model; the magnitudes of the electric fields are a consequence of the parameters used which were chosen such that the emission derived from the model matches the observed emission. This electric field is super-Dreicer over $40\%$ of the volume, particularly low down in the atmosphere. Super-Dreicer electric fields are known to lead to runaway particle acceleration, where collisional effects can no longer compensate for increasing particle velocities \citep[see e.g.][]{paper:Holman1985}. In these circumstances, it is perhaps unsurprising that we observe that many orbits are strongly accelerated, to highly non-thermal energies. What is surprising, though, is that not all particles which encounter strong electric fields immediately reach one of the boundaries. Many particles orbits which achieve moderate to high energies are retained at various heights in the atmosphere (resulting from particle trapping, as mentioned earlier).
To investigate the impact of the original MHD electric field upon particle behaviour, and in light of the amount of acceleration illustrated in Fig.~\ref{fig:bigsurvey}, we repeat the orbit calculations, subject to the same initial conditions outlined earlier, but for electric fields which have been reduced by a certain factor. Figure~\ref{fig:bigsurvey10} illustrates how the peak orbit energies and final positions change when the electric field strength of the MHD simulation (which we will henceforth label as ${\bf{E}}_{\rm{orig}}$) is reduced by a factor of $10$ (for electron orbits in Fig.~\ref{subfig:esurvey10}, and proton orbits in Fig.~\ref{subfig:psurvey10}), and $100$ (electrons/protons in Figs.~\ref{subfig:esurvey100}-\ref{subfig:psurvey100}). These figures show that each decrease in electric field strength brings a corresponding reduction in the peak energy gains achieved by the orbits, while having minimal impact on the final particle positions.
The maximum energy gained in each experiment falls linearly with the electric field strength; peak energies in the experiment with a tenth of the original electric field strength (i.e. ${\bf{E}}=0.1{\bf{E}}_{\rm{orig}}$) were found to be $4.1\unit{MeV}$/$2.87\unit{MeV}$, exactly one tenth of the peak energies recorded in the original orbit surveys for electrons/protons respectively. This pattern continues for a hundred-fold electric field strength reduction (${\bf{E}}=0.01{\bf{E}}_{\rm{orig}}$), where the peak energies fall to $0.41\unit{MeV}$/$0.287\unit{MeV}$, \new{again} exactly one hundredth of the original peak energy values. Finally, we have once again counted the number of orbits which exhibit two or more mirror points. The trapped particle populations remain relatively consistent; out of 2000 orbits initialised in these reduced field strength cases, $821$ electron orbits remaining trapped when ${\bf{E}}=0.1{\bf{E}}_{\rm{orig}}$, and $843$ when ${\bf{E}}=0.01{\bf{E}}_{\rm{orig}}$. For protons (which were followed for 1000s), we recover $759$ and $850$ orbits in each respective field strength case which remain trapped within this electro-magnetic environment.}
To investigate the reasons behind the range of energies recovered and particle behaviours seen in this single AR system, we now focus on several examples of individual particle orbit behaviour.
\section{Examples of orbit behaviour encountered}\label{sec:localbehaviour}
A fairly broad range of behaviour was recovered in our initial survey of orbit behaviour, detailed in Section~\ref{sec:global}. We will now study specific examples of particle orbits whose initial positions are highlighted in Fig.~\ref{fig:inisurvey}; these examples illustrate different types of characteristic particle behaviour observed in the simulations, which are discussed in detail below. \new{It should be noted that, while each example highlights a single specific type of generic behaviour, the other particle behaviour may be present in each example, to a greater or lesser extent. For instance, directly accelerated particles also exhibit guiding centre drift and vice versa.}
\begin{figure*}
\centering
\sbox{\bigleftbox}{%
\begin{minipage}[b]{.48\textwidth}
\centering
\vspace*{\fill}
\subfloat["Trapped" electron orbit (inc. initial/final locations, interpolated field lines, and local contour of $E_{||}=0$).]
{\label{subfig:e25}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig5a}}}
\end{minipage}%
}\usebox{\bigleftbox}%
\begin{minipage}[b][\ht\bigleftbox][s]{.42\textwidth}
\centering
\subfloat[Kinetic energy and $E_{\parallel}$]
{\label{subfig:e25KEvEpar}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig5b}}}
\vfill
\subfloat[Normalised $ v_{\parallel} $ and $|B|$]
{\label{subfig:e25VvB}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig5c}}}
\end{minipage}
\caption{Position A: example of electron which becomes "trapped". \protect\subref{subfig:e25} displays a zoomed view of the electron orbit (thick black line), which begins at the location shown by a green orb, and ends at the location shown by the blue orb, while black trapezoids indicate locations where the parallel velocity of the particle changes sign. The thin grey line indicates the locally interpolated $B$-field line based on the initial position \new{(but almost exactly matches the particle orbit path)}. The red isosurface denotes where the parallel electric field changes sign ($E_{||}=0$). Orbit properties for this electron are displayed in \protect\subref{subfig:e25KEvEpar} and \protect\subref{subfig:e25VvB}; \protect\subref{subfig:e25KEvEpar} shows the change in kinetic energy (KE) and parallel electric field component ($E_{||}$) as a function of time, while \protect\subref{subfig:e25VvB} shows the normalised parallel velocity ($v_{||}/\rm{max}(v_{||})$) and magnetic field strength ($|B|$) for this orbit.}
\label{fig:e25}
\end{figure*}
\subsection{Particle A: trapped orbits}\label{subsec:e25}
We begin with the particle labelled "A" in Fig.~\ref{subfig:ip}. This is one of many orbits which are accelerated to high (but not extreme) energies over the course of the simulation. This orbit also remains within the coronal region of the AR core throughout the orbit lifetime, as with many of the particles seen in Fig.~\ref{fig:bigsurvey}. For reference, the specific electron orbit we discuss is initially located at the centre of the grid, at position $(x,y,z)=(150,150,75)$\unit{Mm}, and remains trapped in the immediate vicinity of this position for the duration of the calculation ($10$\unit{s}), achieving a maximum kinetic energy of $14$\unit{keV} in that time.
In Fig.~\ref{fig:e25}, we present a close-up view of this specific orbit during this time, together with a study of the local conditions (determined by the MHD simulation) encountered by the particle over the course of \new{its}
orbit. From Fig.~\ref{subfig:e25}, it is clear that the particle is trapped between mirror points (locations where the local parallel particle velocity reverses sign). One common cause of particle trapping is the \emph{magnetic mirror effect} (where regions of increasing magnetic field strength cause the particle to reverse direction because of the adiabatic invariance of the magnetic moment, $\mu$). To establish the role played by the magnetic mirror effect in this particular case, we study both the local parallel velocity and encountered magnetic field strength, in Fig.~\ref{subfig:e25VvB}, which suggests that changes in sign of $v_{||}$ are not strongly associated with locations of peaks of $|B|$. To further clarify the role of the magnetic mirror effect, we calculate the loss cone angle for this position. Particles with pitch angle $\theta$ are naturally trapped by the magnetic mirror effect (in a so-called `magnetic bottle') if
\[
\sin{(\theta)}>\sqrt{\frac{B}{B_M}},
\]
\begin{figure}[t]
\centering
\subfloat[Parallel electric field strength]{\label{subfig:E1055}\resizebox{0.47\textwidth}{!}{\includegraphics{JT2015b_fig6a}}}\\
\subfloat[Parallel velocity]{\label{subfig:v1055}\resizebox{0.47\textwidth}{!}{\includegraphics{JT2015b_fig6b}}}
\caption{\new{Impact of decreasing electric field strength upon electric field trapping mechanism. An electron orbit (which initially is trapped between regions of strong, oppositely oriented electric field) continues to repeatedly mirror when the electric field strength is reduced by a factor of 10 (purple) and 100 (orange). \protect\subref{subfig:E1055} shows the parallel component of electric field, $E_{||}$, experienced in each field strength case (see legend) while \protect\subref{subfig:v1055} shows the corresponding changes in parallel velocity, $v_{||}$.}}
\label{fig:changeE}
\end{figure}
where $B_M$ is the maximum magnetic field strength achieved at any location along a given field line; particles which escape this magnetic trap (i.e those with pitch angles which do not satisfy the above inequality) are said to be in the `loss cone'. The field line orbited by this electron (represented in Fig.~\ref{subfig:e25KEvEpar} by a thin grey line) is actually a closed field line, anchored in the photosphere at both ends. We estimate the peak magnetic field strength at one foot-point to be $137$\unit{G}, and $558$\unit{G} at the other; these are the locations of greatest magnetic field strength at any point along this single field line (which are of course of opposite sign in the vertical direction at the photosphere). Thus, to be in the loss cone for this particular field line, a particle must have a pitch angle $\theta<8.68^{\circ}$ in one direction and $\theta<4.30^{\circ}$ in the other. We repeated the orbit calculation for an electron with the same initial position, but with a reduced initial pitch angle of $\theta=4.0^{\circ}$; this now would ordinarily be sufficient for the particle to escape the natural magnetic trap caused by increasing magnetic field strength near the field-line foot-points. The orbit yielded by this second calculation was almost identical to that with $\theta=45^{\circ}$; the particle remains trapped regardless of initial pitch angle. We can therefore exclude magnetic mirroring as the cause of this type of electron trapping. This naturally leads to a question; if the electrons are not magnetically trapped, then how are they trapped?
The answer lies in the variation of the local electric field. For this electron, the orbit path encounters a change in the sign of the local parallel electric field, $E_{||}$, as shown by the red curve in Fig.~\ref{subfig:e25KEvEpar}. An iso-surface of the contour for which $E_{||}=0$ can be seen in Fig.~\ref{subfig:e25}; the electron repeatedly crosses this contour over the course of its orbit.
Upon crossing the contour of $E_{||}=0$, the electron begins to decelerate. At the time when the local parallel velocity is approximately zero, the parallel electric field strength peaks; the orbit reverses direction (parallel to the magnetic field), re-crosses the $E_{||}=0$ contour and re-enters the region of oppositely signed $E_{||}$, leading to further (and repeated) mirroring. This pattern repeats for the entire duration of the orbit simulation. This is not an isolated example; the vast majority of electrons which do not encounter the simulation boundaries are typically "trapped" this way. This trap is particularly effective for electrons. Even relatively weak regions of oppositely signed parallel electric field strength are sufficient to repeatedly accelerate electrons this way.
By comparison, protons are much heavier; for a proton to be trapped in this manner requires both extreme and prolonged changes in the local value of $E_{||}$ in order for the proton to be decelerated sufficiently to reverse direction. Figure~\ref{subfig:psurvey} shows that a significant number (840) of protons are also trapped, and hence are retained close to the centre of the AR core. This is unsurprising, from the size and extent of the $E_{||}$ regions near the footpoints of field-lines which thread the AR core shown in Fig.~\ref{subfig:ip}. An example of a proton which is trapped in this manner will be studied in more detail in Sect.~\ref{subsec:ep10}.
\new{This trapping mechanism is clearly highly dependent on the (orientation of the) local electric field. However, the electric fields used in the simulation might be considered to be too strong for an active region which does not produce a flare, as they lead to highly accelerated particles. We therefore investigate how this trap is affected if the simulated electric field strength is reduced. In Fig.~\ref{fig:changeE}, we illustrate the parallel electric field strength and parallel velocity of three electron orbits for electrons that all have the same initial conditions and start from the same initial position, $(110,110,80)\unit{Mm}$, but are affected by electric fields whose strengths have been scaled to different values. Beginning with the original electric field strength, ${\bf{E}}={\bf{E}}_{\rm{orig}}$, we see from Fig.~\ref{subfig:v1055} that the orbit repeatedly mirrors, at \new{the} instants when the electric field strength peaks in Fig.~\ref{subfig:E1055}. Reducing the electric field strength by a factor of $10$ (${\bf{E}}=0.1{\bf{E}}_{\rm{orig}}$, shown in purple) shows that the orbit still repeatedly mirrors, but takes longer to reach each mirror point compared to the original field strength case. Further reducing the electric field strength
so ${\bf{E}}=0.01{\bf{E}}_{\rm{orig}}$ (shown in orange) demonstrates that this trap is
robust; once again the orbit repeatedly mirrors until the orbit calculation is terminated, even when the orbit calculations are allowed to continue for longer timescales.}
\begin{figure*}
\centering
\sbox{\bigleftbox}{%
\begin{minipage}[b]{.5\textwidth}
\centering
\vspace*{\fill}
\subfloat[Drifting proton orbit (inc. initial/final locations, mirror points, interpolated field lines and contour of $E_{||}=0$).]
{\label{subfig:p14}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig7a}}}
\end{minipage}%
}\usebox{\bigleftbox}%
\begin{minipage}[b][\ht\bigleftbox][s]{.4\textwidth}
\centering
\subfloat[Kinetic energy and $E_{\parallel}$]
{\label{subfig:p14KEvEpar}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig7b}}}
\vfill
\subfloat[Normalised $ v_{\parallel} $ and $|B|$]
{\label{subfig:p14VvB}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig7c}}}
\end{minipage}
\caption{Position B: example of proton which exhibits a slow guiding centre drift. \protect\subref{subfig:p14} displays a zoomed view of the proton orbit (black), which begins at the location shown by a green orb, and ends at the location shown by a blue orb, with black trapezoids indicating the location of a change in sign of parallel velocity. The thin grey lines indicate locally interpolated $B$-field lines based on several orbit positions. The red isosurface denotes where the parallel electric field changes sign ($E_{||}=0$). Orbit properties for this proton are displayed in \protect\subref{subfig:p14KEvEpar} and \protect\subref{subfig:p14VvB}; \protect\subref{subfig:p14KEvEpar} shows the change in kinetic energy (KE) and parallel electric field component ($E_{||}$) as a function of time, while \protect\subref{subfig:p14VvB} shows the normalised parallel velocity ($v_{||}/\rm{max}(v_{||})$) and magnetic field strength ($|B|$) for this orbit.}
\label{fig:p14}
\end{figure*}
\subsection{Particle B: proton drifts}\label{subsec:p14}
Turning our attention to protons, we now focus on another type of behaviour seen in the initial survey. Several proton orbits are also seen \new{to
gain only} a relatively small amount of energy during the $10$s calculation. One such orbit (labelled "B" in Fig.~\ref{subfig:ip}) was initialised at $(x,y,z)=(125,125,80)$\unit{Mm} and gained (at its peak) $361$\unit{eV} in kinetic energy. Once again we present a close-up view of the orbit path, together with local plasma conditions in Fig.~\ref{fig:p14}.
It is clear from Fig.~\ref{subfig:p14} that this proton experiences a relatively constant (anti-)parallel electric field strength throughout its lifetime; the orbit path remains distant from the contour representing $E_{||}=0$ (also shown by the value of $E_{||}$ in Fig.~\ref{subfig:p14KEvEpar}). However, despite the lack of a change in sign of $E_{||}$ or a clear peak in $|B|$ (\new{see Fig.~\ref{subfig:p14VvB}) which would potentially signal the magnetic mirror effect, a} mirror point is clearly visible close to the point of initialisation (green orb), and in-between the initial and final particle positions (c.f. Fig.~\ref{subfig:e25}, where the mirror points enclose the initial and final particle positions!). The mirror point location may be understood by again considering local plasma conditions.
Having initialised the proton orbit with a positive parallel velocity (i.e. a velocity parallel to ${\bf{B}}$), the proton decelerates from its slow initialisation speed (caused by the sign of the local parallel electric field). \new{This deceleration takes place over a long timescale compared to the equivalent deceleration of an electron, resulting from the difference in species mass. During the phase where parallel orbit velocities are small,} particle drifts (primarily the $E\times B$ drift) begin to play a significant role in the proton trajectory.
Figure~\ref{subfig:p14} includes interpolated magnetic field lines based on the changing position of the proton guiding centre over time. From this, it is clear that the proton no longer follows the same field line for all time, but instead drifts across many field lines{\footnote{The $E\times B$ drift velocity can be effectively regarded as the kinetic equivalent of the MHD fluid velocity recovered in the simulations of the (macroscopic) environmental behaviour. The fact that the $E\times B$ drift is responsible for orbits crossing many field lines in a single snapshot may initially appear to suggest \new{that a single snapshot alone may not be sufficient to accurately generate full particle orbit characteristics}.
However, the total distance drifted in the orbit simulations remains well below the spatial and temporal resolution of the MHD simulation. Thus, on an MHD level, the particle would orbit around a single field line which moves with the fluid velocity from snapshot to snapshot. However, using only a single MHD snapshot, this motion is instead seen as a drift across several (static) field lines.}}, before finally beginning to accelerate in the opposite direction to the initial direction of travel. For this particular orbit, after $10$\unit{s}, the perpendicular displacement of the proton from its original field line is approximately $77$\unit{km}; by comparison, the final parallel displacement is $1.03$\unit{Mm} (with a peak positive displacement along the field of approximately $31$\unit{km}, before being accelerated in the opposite direction over a distance of $1.06$\unit{Mm}).
Over the course of the orbit, the proton experiences a near-constant $E\times B$ drift velocity of approximately $7.81\unit{km/s}$; integrating this value over the $10$\unit{s} orbit lifetime yields a perpendicular displacement which agrees with that observed in Fig.~\ref{subfig:p14}. Furthermore, the perpendicular displacement is well-aligned with the local ${\bf{E}}\times{\bf{B}}$ vector. While the parallel displacement is likely to further increase with time and typically will dominate over perpendicular drifts (particularly for large values of $E_{||}$ or long timescales), this case demonstrates that proton orbits may in fact drift over relatively vast distances, particularly upon encountering regions of deceleration.
\begin{figure*}
\centering
\sbox{\bigleftbox}{%
\begin{minipage}[b]{.5\textwidth}
\centering
\vspace*{\fill}
\subfloat[Accelerated proton \& electron orbits, initial/final locations, interpolated field lines, regions of strong $E_{||}$ and photospheric magnetogram data.]
{\label{subfig:ep10}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig8a}}}
\end{minipage}%
}\usebox{\bigleftbox}%
\begin{minipage}[b][\ht\bigleftbox][s]{.44\textwidth}
\centering
\subfloat[Kinetic energy and $E_{\parallel}$]
{\label{subfig:ep10KEvEpar}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig8b}}}
\vfill
\subfloat[Normalised $ v_{\parallel} $ and $|B|$]
{\label{subfig:ep10VvB}\resizebox{\textwidth}{!}{\includegraphics{JT2015b_fig8c}}}
\end{minipage}
\caption{Position C: example of strong proton and electron acceleration. \protect\subref{subfig:ep10} displays a zoomed view of the proton (blue) and electron (black) orbits, which both begin at the location shown by a green orb, ending at a location(s) shown by a blue orb, and with changes in sign of $v_{||}$ indicated by black trapezoids \new{(noting that, on this scale, several symbols occur close together; these symbols are shown in the dark green box)}. The thin grey lines indicate locally interpolated $B$-field lines based on the initial position \new{(which, for the most part, closely match orbit paths)}, while contours of strong positive/negative $E_{||}$, and the photospheric magnetogram of vertical magnetic field strength are included for context (see Fig.~\ref{fig:inisurvey}). Orbit properties for the electron and proton are displayed in \protect\subref{subfig:ep10KEvEpar} and \protect\subref{subfig:ep10VvB} as diamonds (electron) and plus-signs (proton); \protect\subref{subfig:ep10KEvEpar} shows the change in kinetic energy (KE) and parallel electric field component ($E_{||}$) as a function of time, while \protect\subref{subfig:ep10VvB} shows the normalised parallel velocity ($v_{||}/\rm{max}(v_{||})$) and magnetic field strength ($|B|$) for each orbit.}
\label{fig:ep10}
\end{figure*}
\subsection{Particle C: Accelerated electrons/trapped protons}\label{subsec:ep10}
Many examples of both the electron "trapping" and proton drifting can be observed in our survey. \new{However, whether or not an orbit becomes trapped is determined by the local electromagnetic configuration, the timescale over which the orbit is simulated, and the particle species. Some orbits in the initial survey are strongly accelerated in only a single direction, until they leave the simulation domain. To understand this category of behaviour, we illustrate} the orbits of both an electron and a proton which are both initialised in the same location (labelled "C" in Fig.~\ref{subfig:ip}), and which (initially) encounter (the same) strong parallel electric fields. As with previous examples, we will illustrate a close-up view of the orbit path and the local plasma parameters encountered, in Fig.~\ref{fig:ep10}. For reference, the initial position used in this example is $(x,y,z)=(100,200,80)$\unit{Mm}. To further emphasise the differences in behaviour between species, we extend the simulation time from $10$\unit{s} to $100$\unit{s} for this case. This extends the particle simulations beyond the cadence of the MHD simulations; in extending the simulation time in this manner, we simply aim to illustrate particle behaviour over a longer term.
In Fig.~\ref{subfig:ep10}, the initial position is located near the apex of a closed field line which links the foot-points of the AR studied. The proton (\new{blue} orbit) and electron (black orbit) are accelerated towards opposing foot-points (as one might expect from the charge difference between the species). Furthermore, while the electron is rapidly accelerated almost all the way to the photospheric boundary, the proton never leaves the (upper) corona, but is ultimately reflected and returns along the initial trajectory. \new{In Fig.~\ref{subfig:ep10VvB}, we see that the electron (diamonds) reaches the photosphere after approximately $0.5$\unit{s}. In this time, the proton (plus signs) has barely moved. The proton achieves maximum parallel speed after approximately $4$\unit{s} and mirrors approximately seven times in $100$\unit{s}, with the first mirroring taking place after approximately $10$\unit{s}.}
To assess the reason for the proton becoming trapped \new{in this way}, we once again calculate the loss cone (see discussion in Sect.~\ref{subsec:e25} for more details). Along the field line in question, we estimate that initial pitch angles less than $5.81^{\circ}$ and $6.61^{\circ}$ would able particles to escape the trap caused by increasing magnetic field strength. As with the case shown in Sect.~\ref{subsec:e25}, repeating this experiment with an initial pitch angle of $4.0^{\circ}$ shows negligible differences in proton/electron behaviour; both the acceleration and trapping behaviour displayed in Fig.~\ref{fig:ep10} are caused by the electric field. In extending the simulation time from $10$\unit{s} to $100$\unit{s}, we demonstrate that the electric field continues to trap the proton in the upper atmosphere for all time, while accelerating the electron until it reaches the loop foot-point at the photospheric boundary.
All particle orbit calculations are automatically terminated upon reaching a $5$\unit{Mm} layer above the lower simulation boundary (which results from the limited applicability of our test-particle approach in this region). At termination, the electron has travelled approximately $118$\unit{Mm} in less than $0.5$\unit{s}. By comparison, the distance between mirror points for the proton is approximately $38$\unit{Mm}. The reason for the differences between the proton and electron results are twofold; from Fig.~\ref{subfig:ep10VvB}, we can see that the proton achieves its peak velocity after approximately $4$\unit{s}, taking much longer to accelerate. Upon encountering a region of oppositely oriented $E_{||}$, the proton is unable to overcome the resulting deceleration, and mirrors. By comparison, the electron is continually accelerated as it plummets towards the photosphere. \new{The sign of the electric field strength is positive throughout the lifetime of the electron orbit (see Fig.~\ref{subfig:ep10KEvEpar}), hence the electric field trapping mechanism plays no role in the electron orbit. Furthermore, the magnetic mirror effect also plays no role in this orbit, as the strong, uni-directional electric field encountered by this electron results in a high parallel velocity ($1875\unit{km\,s^{-1}}$ or $0.006c$).}
\section{Discussion}\label{sec:discussion}
We have conducted a survey of test-particle behaviour in an environment which aims to describe the behaviour of a solar AR. From this survey (detailed in Sect.~\ref{sec:global}), it is clear that this environment \new{(at the electric field strengths derived by the MHD model)} would cause a significant amount of particle acceleration to non-thermal energies. \new{To avoid confusion, we must first emphasise that our results are based on particle orbits and not particle fluxes. In our surveys, we have used a relatively coarse grid of initial positions to describe particle behaviour at specific locations, for a single value of initial kinetic energy and pitch angle. Such choices mean that a direct comparison with observed particle spectra from this region is not possible; we can only broadly compare common types of particle orbit behaviour.}
\new{Even with the constraint that we cannot directly compare our findings with observed spectra, it is clear that typical orbit energy gains found in our work are much greater than would be expected from a non-flaring active region. MHD models (like the one considered here) have been shown to accurately reproduce specific observational aspects of the solar feature they have been designed to model. Our orbit calculation results show that kinetic processes also have implications for the parameter regimes chosen in such models; in our case, our orbit calculations imply that the extent of regions of strong electric field created within the MHD model would lead to significant amounts of runaway particle acceleration, which (crucially) was not observed for this specific active region. Thus particle orbit calculations could and should be used in future to inform in the design of MHD models of specific structures, with the goal of being able to closely represent the physical processes taking place within those structures, and accurately reflect observations of both heating and particle behaviour.}
The \new{effects of the} strength and extent of the electric fields \new{determined in this model} are clearly illustrated in \new{the orbit results seen in} Fig.~\ref{fig:inisurvey}. We estimate the peak parallel electric field in the simulation domain to be $E_{||}^{\rm{peak}} = 295\unit{V/m}$, while in the corona (i.e. above the lowest 10 gridpoints), $E_{||}^{\rm{peak}}\approx5\unit{V/m}$. For comparison, we estimate the Dreicer electric field to approach $6\times10^{-2}\unit{V/m}$ (for $n=1\times10^{16}\unit{m^{-3}}$, $T=1$\unit{MK}). \new{Regions of super-Dreicer electric field cover extensive areas of the domain} (resulting in the orbit energies seen in Fig.~\ref{fig:inisurvey}). In \citet{paper:Threlfalletal2015}, a magnetic reconnection experiment with $E_{||}^{\rm{peak}}\approx0.1\unit{V/m}$ was sufficient to rapidly accelerate many particles to non-thermal energies, despite the apparent strength appearing too small to be considered relevant for solar flares. In fact, both the electric field strength and the \emph{extent} of the reconnection region \citep[which, for some cases in][reached $20$\unit{Mm}]{paper:Threlfalletal2015} determine the reconnection rate and (ultimately) the energy gained by the particle through direct acceleration. Thus both the strength and extent of the electric fields in the work of \citet{paper:Bourdin+al:2013_overview} are responsible for the non-thermal particle populations recovered here.
\new{We have also shown that reductions of the electric field strength \new{from} the MHD simulations (by factors of both ten and one hundred) reduce the peak energies gained by the particles by the same amount. Once again, with the energy gains directly resulting from the presence of parallel electric field, $E_{||}$, reductions in the strength of ${\bf{E}}$ reduce the voltage through which each particle may be accelerated, lowering the ultimate amount of energy they gain.}
While many of the particles experience direct acceleration, \new{not all are accelerated out of the domain. A significant number remain trapped in the upper regions of the model atmosphere instead.}
In Sect.~\ref{subsec:e25}, we illustrate an electron which is "trapped" between weak regions of oppositely oriented parallel electric field\new{, continuously re-accelerating to a kinetic energy of approximately $10$\unit{keV}. In Sect.~\ref{subsec:ep10}, we show an example of a proton which is similarly trapped; notably protons take much longer to be repeatedly re-accelerated, but can still achieve high kinetic energy gains ($100$\unit{keV} in the case of the proton in Sect.~\ref{subsec:ep10}) in between mirror points. The strength and extent of the two regions of oppositely oriented electric field are the primary factor that controls the peak energy which may be repeatedly gained and lost by particles of either species in an electric field trap.}
\new{The presence of this type of trap has been noted in studies of magnetic reconnection at stochastic current sheets \citep{paper:Turkmanietal2006} and 3D magnetic null-points \citep{thesis:Stanier}\new{, but neither paper investigates the cause of the trapping}. In our work, we have studied this trap in detail, and find that the number of particles trapped by this mechanism may remain relatively unchanged despite reductions in electric field strength in the MHD model.
For a general coronal structure, one might expect that particles are likely to encounter regions where the parallel electric \new{fields change sign} (for example between different coronal loop footpoints, or at fragmented current sheets). Our results show that this potentially may occur at many locations throughout a specific active region, and trap energised particles at heights above the photosphere, particularly in the corona. A likely way for particles to escape such a trap would be from changes in the global electro-magnetic environment; such changes would take place over much longer timescales than those considered here.}
Whether or not this type of trapping would yield an observational signature (e.g. in radio wavelengths) is at present unknown, and may be worthy of further investigation. While trapped, these particles would also likely lose energy via collisional effects, particularly lower down in the atmosphere, or at low speeds (e.g. during deceleration/reflection).
\new{Other, more familiar types of particle behaviour are also present in our orbit surveys.} Particularly in cases which involve proton deceleration (in Sect.~\ref{subsec:p14}), particle drifts \new{may
play} a significant role in particle trajectories, \new{enabling a proton to} drift upto (potentially) tens/hundreds of kilometres from its original field line. Such drifts may contribute to the lack of alignment in X-ray and $\gamma$-ray features observed during a single solar flare event \citep[e.g.][]{paper:Hurfordetal2003}.
\new{Finally, it is worth noting that, of the characteristic types of behaviour discussed in Sect.~\ref{sec:localbehaviour}, \new{some types are more affected by} the choice of numerical resistivity used in the simulation \new{than others}. Reducing the resistivity would weaken the strength of the electric fields generated, which (in turn) reduces the magnitude of the $E\times B$ drift velocity, and the voltage differences through which particles are accelerated. However, we have shown in Sect.~\ref{sec:global} that the number of trapped orbits remains relatively constant even when decreasing electric field strengths by factors of up to $100$.}
\new{Further investigation (Sect.~\ref{subsec:e25}) reveals that electric field strength reductions simply allow orbits to travel further prior to mirroring. \new{This results from} the orientation of the electric field, {which is unaffected by the scaling so that in weaker electric fields} orbits have further to travel before encountering \new{a} sufficiently strong electric field to be reflected, causing the majority \new{of particle orbits} to remain trapped. Indeed, with broader regions of no parallel electric field, more particles find themselves mirroring between smaller weaker regions of oppositely oriented parallel electric field. Only by encountering regions of strong $E_{||}$ (and thus achieving high velocities) or by-passing the electric field regions all-together (resulting from long-term changes in the MHD environment in which the orbits are performed) are such orbits capable of avoiding the trap set by these weak electric field regions.}
\section{Conclusions and future work}\label{sec:conclusions}
We have studied the relativistic guiding centre behaviour of test particles in an observationally driven large-scale 3D magnetic reconnection experiment \citep{paper:Bourdin+al:2013_overview}.
We find that the majority of particle motion is controlled by the strength, orientation and extent of the local parallel electric field; in \new{a significant number of cases}, the electric field causes strong direct acceleration of particles to non-thermal energies. \new{On the one hand, the strength of the electric field (which reaches super-Drecier levels throughout a significant fraction of the domain) means that collisions would play no role in the particle behaviour. On the other hand, }the lack of evidence for a flare-like event within this AR combined with our results imply that the resistivity and current structures created in the MHD simulation \new{generate too many orbits which are ultimately accelerated to unacceptably high kinetic energies. Reducing the electric field strength of the simulations leads to less strongly accelerated particles. However, even weak electric fields stretched over long distances have the capability to accelerate particles to very high energies.}
As part of this investigation, we have identified several behavioural characteristics of particles within this environment. Direct acceleration and drifting of particles were anticipated and \new{are} weakened by simulations containing weaker/shorter electric field regions. However, we also observe a type of trapping of particles between regions of oppositely oriented parallel electric field which has \new{previously only been seen in isolated, idealised studies of magnetic reconnection \citep{paper:Turkmanietal2006,thesis:Stanier}}. This type of trap results from a change in sign of the parallel electric fields, and \new{is likely to}
be present in any test particle calculations based on compressible resistive MHD simulations of AR behaviour. Reducing the electric field strengths in the model does not appear to affect the efficiency of this trap. Whether or not this type of trap would produce an observational signature is unknown, but if it does it could allow for further insights into electric field structures within the solar atmosphere.
Following on from the present investigation, several opportunities for further work present themselves. The work of \citet{paper:Bourdin+al:2013_overview} merits repeating, particularly to see how the results presented here change for lower magnetic \new{diffusivities}.
The use of observations to drive MHD simulations is important, and worthy of repeating for a more recent active-region system (including regions that produce or do not produce a flare) which can be observed by a full suite of modern instruments, e.g. RHESSI, AIA/SDO, STEREO and ground-based telescopes. This might also allow for a comparison of synthetic hard X-ray data (generated by test-particle simulations) and a specific flare-like event, in a similar manner to that used in \citet{paper:Gordovskyyetal2014}. Furthermore, development of the test-particle model (for example, by studying the effect of collisions, or through the use of a distribution function which better reflects the initial state of particles in a coronal environment) would also be beneficial.
\begin{acknowledgements}
The authors gratefully acknowledge the support of the U.K. Science and Technology Facilities Council [Consolidated Grant ST/K000950/1]. The research leading to these results has received funding from the European Commission's Seventh Framework Programme FP7 under the grant agreement SHOCK (project number 284515).
This work was supported by the International Max-Planck Research School (IMPRS) on Solar System Physics.
The results of this research have been achieved using the PRACE Research Infrastructure resource \emph{Curie} based in France at TGCC, as well as \emph{JuRoPA} hosted by the J{\"u}lich Supercomputing Centre in Germany.
Preparatory work has been executed at the Kiepenheuer-Institut f{\"u}r Sonnenphysik in Freiburg, as well as on the bwGRiD facility located at the Universit{\"a}t Freiburg, Germany.
We thank Suguru Kamio for his help finding active region observations.
Hinode is a Japanese mission developed, launched, and operated by ISAS/JAXA, in partnership with NAOJ, NASA, and STFC (UK). Additional operational support is provided by ESA and NSC (Norway).
\end{acknowledgements}
\bibliographystyle{aa}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 290 |
{"url":"http:\/\/physics.stackexchange.com\/questions\/17948\/why-does-a-gas-get-hot-when-suddenly-compressed-what-is-happening-at-the-molecu","text":"# Why does a gas get hot when suddenly compressed? What is happening at the molecular level?\n\nMy guess is that the molecules of gas all have the same speed as before, but now there are much more collisions per unit area onto the thermometer, thus making the thermometer read a higher temperature. If this is so, then density is directly related to temperature when a substance experiences a change in density.\n\nIs this the case?\n\n-\n\nBecause you are doing work to compress the gas, and the energy has to go somewhere. The molecules speed up because they collide with the wall moving forward--- if you move a wall forward, a ball which bounces off the wall reflects going faster by twice the speed of the wall, because if you move along with the wall, it reflects at the same speed.\n\n\u2022 After the gas cools off, the gas molecules are moving at the same speed as before.\n\u2022 The second question is a form of Maxwell demon. If you know when the molecular collisions come with such precision that you can move the wall when the molecules will not bounce, you can compress the gas without doing any work. But in order to do this, you must get and store the information about where all the molecules are, a process which requires a huge amount of entropy production. The information about the molecules allows you to reduce their volume without increasing their energy.\n\u2022 In any situation where classical mechanics works, for kinetic energy of gasses in particular, the temperature is just the same as the average molecular kinetic energy. For all nonrelativistic systems, the average kinetic energy in each atom is $3T\\over 2$ in Boltzmann units (k=1). This is a special case of the equipartition law--- every quadratic degree of freedom gets ${kT\\over 2}$ energy in equilibrium. Because of the relation between temperature and kinetic energy, the speeds of molecules in two gasses at the same temperature are the same. So after the gas comes to equilibrium with the surroundings, it has the same average speed for the molecules independent of its volume (this is a molecular kinetic-energy potential-energy separation theorem, which is even true when the material liquifies or solidifies, at least at room temperature where normal solids obey the Dulong Petit law).\n\n### Entropy increase\n\nThere is a second way to understand the temperature increase. When you squeeze the gas, you are increasing your knowledge of where the molecules are, you are decreasing their wandering volume. This means that, if nothing else happens, you decrease their entropy. So something must have happened to make you know less about the state of the universe. If they are not allowed to dump heat and entropy into the exterior universe, the only thing that can happen is that they move faster, increasing your uncertainty about how fast they are going.\n\nThe decrease in entropy with a decrease in volume from $V_i$ to $V_f$ is\n\n$$N\\log({V_f\\over V_i})$$\n\nThis is intuitive--- the logarithm of the number of configuration is the log of $V^N$ (ignoring an N! denominator from indistinguishable particles.\n\nThe increase in entropy from a change in temperature from $T_i$ to $T_f$ is given by\n\n$$NC_V \\log({T_f\\over T_i})$$\n\nWhere $C_v$ is the rate of entropy increase per unit temperature. So that the relation that the entropy is constant gives the adiabatic expansion law: $V\\over T^{C_v}$ is constant, that is, the ratio of absolute temperatures before and after is a certain power of the ratio of the volumes after and before.\n\nI should point out that if you move the piston extremely quickly, at comparable to the speed of sound of the gas, you will produce extra heat in addition to the minimum necessary to ensure the entropy doesn't go down. The extra heat can be understood in two equivalent ways:\n\n\u2022 you are overcompressing a thin skin of gas near the piston, that momentarily exerts a greater back-pressure on the piston than the gas would normally if you did things slowly. So you are doing more work to compress the gas quickly.\n\u2022 You are learning more about the positions of the molecules from the slow rate of pressure relaxation--- you know that a large fraction of the volume of the gas is mushed near the piston.\n\nThis is a classical more-you-know less-you-know statement, that the more precisely you know where the molecules in a gas are, the less precisely you know how fast they are moving (the hotter the gas gets), at constant information (entropy). This is not the Heisenberg uncertainty principle, it is just classical thermodyanamics, and here the knowledge interpretation is exact, because the entropy is a measure of classical knowledge you have about the microstate. The quantum mechanical uncertainty principle is not a statement of ignorance about hidden variables, at least not in any obvious way, so it doesn't have a precise informational interpretation like this does.\n\n-\nOk, so question: once the system has cooled off in temperature and reached equilibrium with the surroundings, is the average speed of each molecule the same as it was before being compressed? \u2013\u00a0 trusktr Dec 7 '11 at 3:46\nAlso, lets imagine that the wall only moves when there are no collisions happening, and that the wall stops for an instant when a ball needs to bounce off it, thus not changing the speed of the ball which loses no energy to the collision. So, now, the volume is small and all the balls have the same speed as before. Now, lets imagine we allow for energy to be lost to collisions. This is where I imagine that the increased temperature comes from because now more balls hit the wall, releasing energy at a higher rate due to more collisions than before. Is this the case? \u2013\u00a0 trusktr Dec 7 '11 at 3:51\nI think this merits an entirely different question: Do gas molecules in a bigger volume with move at the same speed as gas molecules of the same type in a smaller volume when both volumes have the same temperature? \u2013\u00a0 trusktr Dec 7 '11 at 3:53\nFirst of all I believe that you cant say that the heat has been transferred to the gas molecules because of your work done on the piston, that work is translated into the movement of the piston and that's that. Now if you are saying that the temperature of the 2 volumes are the same then what is your original question?! There is no temperature change! Therefore the gas does not get hot. \u2013\u00a0 Adir Peretz Dec 7 '11 at 4:55\n@truskr: I expanded the answer. \u2013\u00a0 Ron Maimon Dec 7 '11 at 5:09\n\ntemperature is the measure of speed of molecules. when you compress the gas molecules start moving faster, which is the same as saying the temperature increases.\n\nwhy do molecules start moving faster? there are many ways of explaining this. here's one. when molecules are squeezed into a smaller volume their location is now more certain, it's locked in a smaller space. we seem to get more order and less chaos? this should come at a price, and it does: the molecules resist to being ordered. so they pay back by moving faster. so, in the end there no more order than it was before. the nature resists order.\n\n-\n\nThe reason why a gas heats up when it is compressed into a smaller space, is because the ambient heat that the gas possessed in its original volume, has now been confined to a smaller volume\u2014same amount of heat but now more concentrated\u2014the temperature goes up. When the vessel storing the newly compressed gas cools off to the ambient temperature of its environment, energy in the form of heat is lost to the environment. If the air is now released into the atmosphere, it expands from its compressed state to resume the volume that it previously occupied\u2014except that it can't because it has lost energy. In order for the gas to occupy its original volume, it requires heat from the surrounding environment\u2014which may include your hand, which is why the expanding gas feels cool\u2014it's sucking heat energy from your body.\n\n-\n\nThe gas gets hotter because the energy has no where to go and it must convert into heat. The molecules bounce back and forth with one another creating more and more energy and less space, so the molecules began to compress through the helical rotors.\n\n-\nIs energy \"created\"? \u2013\u00a0 Jimmy360 Apr 26 at 18:32\n\n## protected by ACuriousMindApr 26 at 18:04\n\nThank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.","date":"2015-08-01 03:43:25","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.7792855501174927, \"perplexity\": 324.15931754472473}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2015-32\/segments\/1438042988458.74\/warc\/CC-MAIN-20150728002308-00026-ip-10-236-191-2.ec2.internal.warc.gz\"}"} | null | null |
Philips LEDs use 90% less energy* than traditional incandescent lights, while producing the same warm and familiar light. They can last up to 22 years, which is equal to 25 incandescent bulbs. So not only will you have fewer bulbs to change, there will be less waste as a result. Watch the video to learn how LED bulbs save energy.
*An 8.5 Watt LED bulb uses up to 86% less energy than traditional incandescent bulbs.
Learn about wattage and wattage equivalent on LED bulb packaging. Watch our video to learn about brightness and saving energy.
LED bulbs last much longer than traditional bulbs, like incandescent. Longer lasting bulbs mean changing them less often. Watch the video to learn more.
Change from soft white, daylight to a cozy warm glow with the flip of your existing light switch.
Learn how to find the right LED bulb with our soft short guides on brightness, color, efficiency and more.
Find Philips consumer lighting product information or contact us with questions and other inquiries. | {
"redpajama_set_name": "RedPajamaC4"
} | 311 |
Ghanaian Award winning singer Becca Africa and her Nigerian Husband have welcomed their first child, a baby girl months after their beautiful union.
The couple who had a flamboyant traditional wedding in Nigeria and Ghana back in August 2018 are now proud parents.
Becca took to her instagram page to share the good news and also share a few pics of her baby bump. | {
"redpajama_set_name": "RedPajamaC4"
} | 5,331 |
Confessions of a plumber
TNP PHICTURE: ARIFFIN JAMAR
Benita Aw Yeong
Plumber David Chi has extricated everything from dead animals to compact powder cases from chocked toilet systems.
But the most memorable involved a crab on the eve of Chinese New Year.
"The home owner bought it as part of the spread for the night's dinner, but it crawled into the bathroom and fell into the squatting pan," he explains with a laugh.
To get the toilet working properly again, the creature's legs had to be broken, so it could be extracted.
"It was cruel, but it had to be done," says the 52-year-old, who has been in the plumbing line for over three decades.
Reflecting on the recent case of an 82-year-old man who had his arm trapped for 12 hours in a water pipe before being rescued, Mr Chi says: "The pipe may look wide from the outside, but the inside may be a lot narrower because there are other substances which may have collected over time.
"Also, the hand can be smaller than the forearm and the arm, which could lead to disastrous consequences when you stretch it into a pipe. A space of 5mm and 10mm can make all the difference," he remarks.
While many feel squeamish just discussing human waste, Mr Chi does not bat an eyelid at the sight, or smell, of it.
He once even got poop on his face.
"It happened while I was trying to release a soiled pipe located at a void deck of a housing estate," he says matter-of-factly.
"That was when I was inexperienced. These days, I stand further back, so it doesn't happen any more," he adds with a chuckle.
The amicable man, who runs Speedlight Plumbing Services,was first exposed to the trade by his brother, who also worked as a plumber.
A secondary school student then, he began formal training as an apprentice after completing his national service.
The job is technical and hands-on in nature, which means experience and frequent practice is the best way to hone one's skills.
But to remain competitive, Mr Chi studied for the National Trades Certificate in plumbing, and is now a licensed plumber.
An average day sees him handling between one and five plumbing cases.
Unlike other companies that offer 24-hour services, Mr Chi works only from 10am to 5pm, Mondays to Saturdays.
"I used to be on call 24-hours when I worked with the town council, but eventually decided to make a lifestyle switch so as to spend more time with my children," says the father of two grown-up children. He also looks after his elderly mother, who lives with him.
Few Singaporeans want to do the job these days, he admits, because the work is laborious and far from glamorous.
"These days, more foreigners are being trained to do the job," he says.
But he reveals that being good with one's hands isn't the only trait of a good plumber - one has to know how to handle people too.And clients are as varied as they come, he says.
"I was once five minutes late for a job, because of a delay in the previous one.
"The client gave me a real shelling, and told me that he could do many things within a span of his five minutes, which I had wasted," he recounts.
Over the years, he has learnt to let such nasty encounters slide.
"It's the only way to keep going. Don't let it get you down."
Mr Chi also has to contend with customers who do not pay up.
He recalled an incident where the client didn't have any cash, and paid by cheque, which could not be cashed at the bank.
The plumber had to make a repeat visit to ask for another cheque - all for $55.
Despite all that, Mr Chi says he loves the job.
"The satisfied look on a customer's face, knowing that you've solved the problem, makes everything all worthwhile," he adds.
Secrets of the trade
1 Have a mild temper. Or consciously develop one. Getting upset at a customer's remarks - even if they are unreasonable, never helps the situation.
2 This isn't the job for you if you dislike getting smelly or dirty. Learn to get used to it.
3 Make use of technology. Getting the client to send you a photo of the situation may help you give a better quote, and subsequently save you time and transport, should he choose to patronise someone else.
Read articles by Benita Aw Yeong | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 5,173 |
With a sound enterprise credit history, exceptional after-sales services and modern production facilities, we've earned an outstanding track record amongst our consumers across the whole world for Silicone Ball Whisk , Silicone Spiral Whisk , Silicone Ball Mold , invite all intrigued buyers to go to our web page or call us instantly for further more info.
"We rely upon strategic thinking, constant modernisation in all segments, technological advances and of course upon our employees that directly participate inside our success for Silicone Ball Whisk , Silicone Spiral Whisk , Silicone Ball Mold , we're now looking forward to even greater cooperation with overseas customers based on mutual benefits. We are going to work wholeheartedly to improve our products and services. We also promise to work jointly with business partners to elevate our cooperation to a higher level and share success together. Warmly welcome you to visit our factory sincerely. | {
"redpajama_set_name": "RedPajamaC4"
} | 4,534 |
{"url":"http:\/\/www.mathjournals.org\/jot\/2004-051-001\/2004-051-001-001.html","text":"Previous issue \u00b7\u00a0 Next issue \u00b7\u00a0 Most recent issue \u00b7\u00a0All issues\n\n# Journal of Operator Theory\n\nVolume 51, Issue 1, Winter 2004 \u00a0pp. 3-18.\n\nFonctions perturbation et formules du rayon spectral essentiel et de distance au spectre essentiel\n\nAuthors Mostafa Mbekhta\nAuthor institution: Universite de Lille I, UFR de Math\\'ematiques, UMR-CNRS 8524, F-59655 Villeneuve d'Ascq, France\n\nSummary:\u00a0 Let ($X, \\| \\cdot\\|$) be a Banach space. Let $\\mathcal{N}$ be the set of norms on $X$ that are equivalent with $\\| \\cdot\\|$. For $T\\in B(X)$ and $| \\cdot | \\in \\mathcal{N}$, we introduce a Fredholm perturbation function $\\mathcal{F}_{|\\cdot|}(T)$ (for example: the measure of non-compactness; the essential norm, etc.). In this article we show that $r_{\\rm e}(T)$, the essential spectral radius of $T$, can be calculated by the following formula: $r_{\\rm e}(T) = \\inf \\{\\mathcal{F}_{|\\cdot|}(T)\\mid |\\cdot| \\in \\mathcal{N} \\}.$ In addition, we introduce another perturbation function $\\mathcal{G}_{|\\cdot|}(T)$ (for example: the essential conorm, the distance with respect to the set of Fredholm operators, etc.) and we show that if $T$ is Fredholm then $\\dist (0,\\sigma _{\\rm e}(T)) = \\sup \\{ \\mathcal{G}_{|\\cdot|}(T)\\mid |\\cdot| \\in \\mathcal{N} \\}.$\n\nContents \u00a0\u00a0 Full-Text PDF","date":"2018-01-23 14:03:16","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.7641162872314453, \"perplexity\": 1234.8823110460553}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": false}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2018-05\/segments\/1516084891976.74\/warc\/CC-MAIN-20180123131643-20180123151643-00083.warc.gz\"}"} | null | null |
Marc Berdoll, né le à Trélazé, dans l'agglomération d'Angers (Maine-et-Loire), est un footballeur international français.
Il a joué comme attaquant dans les clubs d'Angers SCO, du 1.FC Sarrebruck (RFA), de l'Olympique de Marseille et de l'US Orléans.
Au niveau international, il compte 16 sélections et 5 buts en équipe de France de 1973 à 1979 et 3 sélections en Espoir en 1974 et 1978. Il a notamment participé à la Coupe du monde 1978 en Argentine où il n'a disputé que le dernier match de l'équipe de France dans cette compétition, au premier tour face à la Hongrie (3-1), lors duquel il a marqué un but d'un tir croisé.
Biographie
Débuts à Angers
Lors de la saison 1973-1974, Marc Berdoll termine deuxième meilleur buteur du championnat, un but derrière Carlos Bianchi (30 buts marqués), alors attaquant de Reims. Face à Saint-Étienne, il devient même le plus jeune joueur à marquer un quadruplé en championnat (ce record de précocité ne sera battu qu'en 2018 par Kylian Mbappé).
Après un différend avec le président d'Angers en 1976, il rejoint le club allemand de Sarrebruck.
L'expérience sarroise
Durant le chaud été 1976, l'international Marc Berdoll, âgé de 23 ans, qui a marqué une moyenne de 23 buts par saison lors des trois dernières années, est transféré d'Angers à Sarrebruck pour 440 000 DM, un contrat de deux ans et un salaire mensuel, hors primes, de 15 000 DM. D'origine lorraine et marié à une Lorraine, Marc Berdoll s'installe à Sarreguemines, en Moselle, située à 20 min de route de Sarrebruck.
Il fait ses débuts en Bundesliga le , lors de la première journée de la saison, devant spectateurs, au Ludwigspark de Sarrebruck, lors de la défaite du FCS face à Bochum (0-1). A Sarrebruck, il découvre le caractère intensif du football allemand : deux séances d'entraînement par jour de deux heures trente chacune, des matches rythmés et physiques où les défenseurs sont impitoyables.
Marc Berdoll a du mal à digérer. Il peine. Il marque pourtant son premier but lors de son second match, le à Dortmund (défaite 1-2). Ensuite, il ne marquera plus. Son entraîneur, Slobodan Cendic, le lui reproche. En fait, Marc Berdoll ne parle pas la langue et ne comprend pas les consignes. De plus, il doit assimiler les contraintes collectives en vigueur en Allemagne. Il se replie sur lui-même, devient méfiant et perd sa confiance.
Le , Sarrebruck est battu 0-3 par Essen en de finale de la coupe d'Allemagne. L'entraîneur Cendic avait laissé Marc Berdoll sur la touche et appelé ses propres compatriotes Spasovki et Acimovic. L'attaque n'en tourne pas mieux pour autant. En première mi-temps, elle ne se créée que deux occasions de buts par Traser et Acimovic qui tirèrent tous deux à côtés.
Le public se fâcha et demanda le départ de Cendic et le retour de Berdoll. Le président prit alors le parti des 25 000 spectateurs du Ludwigspark et demanda à son entraîneur de faire entrer Berdoll en seconde mi-temps, ce qui fut fait mais n'empêcha pas le 0-3. « L'affaire Berdoll-Cendic » n'était pas terminée mais, depuis ce samedi là, les actions de l'ex-Angevin étaient à la hausse… Deux jours après, Cendic était limogé.
Marc Berdoll reprit alors espoir. On ne lui avait peut-être pas donné réellement sa chance jusqu'ici. Mais il n'est pas long à se rendre compte que l'arrivée du nouveau responsable technique, Manfred Krafft, ancien joueur et entraîneur de Düsseldorf, ne va rien changer à l'affaire. Pire même. « Krafft a ramené avec lui un avant-centre qu'il connaissait bien, Harry Ellbracht » indique simplement Marc Berdoll. A quatre reprises, entre le et le , les deux hommes sont alignés ensemble et tous deux ne marquent aucun but. Pourtant, en ce , c'est Berdoll que sort l'entraîneur Krafft à une demi-heure de la fin et non l'ancien joueur de Bochum.
Ainsi c'est Berdoll qui va devoir jouer les doublures. Il ne joue plus ou est mis en balance avec Peter Hayduk. Ellbracht joue tous les matches retour, inscrivant 9 buts, dont celui du maintien, Marc aucun. À la fin des matches retours, Berdoll a perdu ses dernières illusions, ne jouera pratiquement plus et attendra que la fin de saison lui donne la possibilité de revenir dans son pays. Sa dernière sortie, à deux journées de la fin, le , est totalement anecdotique, lorsqu'il rentre à cinq minutes de la fin au Ludwigspark face à l'ex-futur champion Mönchengladbach. Personne au FCS ne semble s'être vraiment interrogé sur le gâchis annoncé, un joueur – un buteur né – qui peine à apprendre la langue donc à s'adapter pour trouver les moyens de renouer avec son efficacité, ses 23 buts de moyenne par saison, le trésor dont le FCS avait pourtant bien besoin au milieu d'une faillite avant tout collective.
« J'ai gâché un an en jouant à Sarrebruck. Je le reconnais, c'était une erreur » explique Marc. « J'ignorais tout du football allemand, de sa dureté, de sa discipline, de ses contraintes. Je n'étais vraiment pas fait pour m'y adapter et y réussir. Si je m'étais imposé véritablement j'aurais été un titulaire indiscutable. Or, je n'ai fait que huit matches pleins et huit autres comme douzième homme. C'est donc que je ne m'étais pas adapté complètement à ce genre de football physique. De plus, il y avait la barrière du langage qui m'a joué des tours. Difficile de se faire comprendre de ses partenaires et incapable de saisir tout ce qu'ils pouvaient dire » confiait-il, résigné (France-Football, ) alors qu'il venait pourtant de renouer avec la réussite, marquant le quatrième but de la victoire de Marseille face à Sochaux.
L'Allemagne avait pourtant mûri Marc Berdoll. Il y abandonna quelques-unes de ses illusions mais s'y était forgé le caractère à la dure école de la vie. Transféré de Sarrebruck à Marseille pour 300 000 DM, il y marquera 20 buts lors de sa première saison et disputera la phase finale du Mundial 78. La même année, Sarrebruck sera relégué de la Bundesliga. Aujourd'hui, Marc Berdoll, vit à Saint-Avold, en Moselle, à 25 min de Sarrebruck. Joueur réputé rapide, vif, opportuniste et travailleur, Marc Berdoll aura marqué 102 buts en , dont un en Bundesliga, et un en phase finale de coupe du monde.
L'Olympique de Marseille
Le , lors d'un match de championnat de France à Bordeaux, Marc Berdoll fracture la jambe de Daniel Jeandupeux avec un tacle violent qui mettra fin à sa carrière, lors du match qui est resté, jusqu'au début 2022, la dernière victoire de l'OM à Bordeaux.
Retour à Angers
Fin de carrière
Carrière
Foyer de Trélazé
1968-76 : S.C.O. Angers
1976-77 : Sarrebruck
1977-80 : O. Marseille
1980-82 : S.C.O. Angers
1982 : Amiens SC
1982-85 : U.S. Orléans
1985-87 : L'Hopital
Palmarès
En club
Champion de France de Division 2 en 1976 avec Angers
En équipe de France
16 sélections et 5 buts entre 1973 et 1979
Participation à la Coupe du Monde en 1978 (Premier Tour)
Distinction personnelle
Meilleur buteur de Division 2 en 1976 (25 buts) avec Angers
Notes et références
Liens externes
Articles de presse sur Marc Berdoll
Footballeur international français
Joueur du SCO Angers
Joueur du 1. FC Sarrebruck
Joueur de l'Olympique de Marseille
Joueur de l'Amiens SC
Joueur de l'US Orléans
Naissance en avril 1953
Naissance à Trélazé | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,934 |
\section{Introduction}
As spin degeneracy is lifted through crystal field and exchange interactions, intermetallic compounds containing rare earth ions display intricate thermodynamic, magnetic, and transport anomalies. In the Kondo effect dilute rare earth impurities in a metal give rise to a minimum in the resistivity due to resonant electron scattering from the impurity spin\cite{kondo}$^,$ \cite{coqblin}. When the rare-earth ions form a full crystalline lattice and when hybridization with more dispersive bands is sufficiently strong, a full band gap can open in so-called Kondo insulators which may support topologically protected surface states\cite{Fisk}$^,$\cite{Dzero}$^,$\cite{Mason}. The Kondo lattice regime between these limits is defined by an intricate balance between inter-site super-exchange and intra-site Kondo screening\cite{Doniach}. When the former interactions prevail, magnetic order occurs concomitant with transport anomalies, while the ground state in the latter case is a heavy Fermi Liquid (FL). At the quantum critical point (QCP) where these phases meet, there are non-Fermi-Liquid (NFL) characteristics and in some cases superconductivity\cite{Stewart}$^,$\cite{Coleman}.
The search for materials to expose this strongly correlated regime recently led to the discovery of a family of rare earth bearing quasi-two-dimensional metals of the form $\rm R_3T_4As_4O_{2-\delta}$ \cite{kaiser, cava, jiakui} that is structurally related to the iron superconductors. Here R indicates a rare earth ion and T a transition metal ion. While T appears to be non-magnetic in this structure,\cite{jiakui} it strongly influences the sequence of transitions so there are three transitions for $\rm Ce_3Cu_4As_4O_2$ but just a single low temperature transition for $\rm Ce_3Ni_4As_4O_2$. The presence of {\em two} distinct rare earth sites appears to underlie the complicated magnetic and transport properties of these materials. Focusing on $\rm Ce_3Cu_4As_4O_2$, we seek in this paper to understand the physics underlying the previously reported sequence of phase transitions in this class of materials. While the absence of single crystalline samples limits the specificity of our conclusions, the combination of thermodynamic, transport and neutron scattering data that we shall report, as well as ab-initio band structure calculations, provides a first atomic scale view of the intricate electronic properties of these materials. It is also apparent however, that the complexity of the material is such that a full understanding will require much more detailed experiment that can only be carried out on single crystalline samples.
So far our experiments indicate that incompatible in-plane magnetic interactions and magnetic anisotropies produce separate as well as coordinated magnetic phase transitions reminiscent of phase transitions in magnetic multilayer thin-film structures. The strongly anisotropic nature of the cerium spins and/or their interactions also plays an important role by allowing for a thermodynamic phase transition for an isolated 2D layer. The highest temperature transition at $T_{N}=24$~K is to an antiferromagnetic (AFM) stacking of ferromagnetically (FM) aligned tetragonal layers of spins oriented along the c axis, with characteristic magnetic wave vector ${\bf k}_1=1.0(2){\bf c^*}$. This order is predominantly associated with the $\rm Ce_2O_2$ layers. The $T_2$ = 16 K transition is associated with the loss of low energy spin fluctuations in the square sublattice $\rm CeCu_4As_4$. While we do not have direct diffraction evidence for this, the paramagnetic spin fluctuations indicate that the spin structure in $\rm CeCu_4As_4$ layers for $T<T_{2}$ has a characteristic wave vector ${\bf k}_2=0.50(2){\bf a}^*$ with spins along ${\bf k}_2$. Such longitudinally striped structures are also found among iron spins in the parent compounds of iron superconductors\cite{su}$^,$\cite{Clarina}, and is supported by our DFT calculations. The lowest temperature transition at $T_{3}=1.9$~K is associated with the development of a component of the ${\bf k}_1$-type magnetic order polarized within the basal plane. Indeed the data is consistent with the rotation of the entire polarization of $\rm Ce_2O_2$ layers into the basal plane and perpendicular to an anisotropic striped AFM of the $\rm CeCu_4As_4$ layers. The paper thus exposes an intricate interplay between distinct forms of rare earth magnetism in the two different layers that make up $\rm Ce_3Cu_4As_4O_2$.
After the methods section, our experimental results and initial observations are presented in section~\ref{results} followed by analysis in section~\ref{analysis}. Section~\ref{discussion} draws together a physical picture of $\rm Ce_3Cu_4As_4O_2$ and in the concluding section (\ref{conclusion}) we put the results into the broader context of the $\rm R_3T_4As_4O_2$ family of compounds and rare earth based strongly correlated electron systems in general.
\section{Methods}
\label{methods}
\subsection{Synthesis and bulk measurements}
Polycrystalline Ce$_3$Cu$_4$As$_4$O$_2$ was synthesized using a previously described solid state method\cite{jiakui}. The sample employed for neutron scattering was a loose powder with a total mass of 5.8 g.
Magnetization measurements for temperatures between 2 K and 300 K were performed in a Quantum Design (QD) Magnetic Property Measurement System (MPMS) \cite{quantumdesign} in magnetic fields up to 7 T. Specific heat measurements were performed in a QD Physical Property Measurement System (PPMS) \cite{quantumdesign}, using an adiabatic relaxation method for temperature down to 0.4 K and fields up to 9 T. DC electrical resistivity was measured on dense samples in the QD PPMS \cite{quantumdesign}, using a standard four point contact method.
\subsection{Neutron scattering}
All neutron scattering experiments were conducted on instrumentation at the NIST Center for Neutron Research. For determination of the chemical structure powder diffraction data was acquired on BT1 using the Ge(311) monochromator $\lambda = 1.5398 ~ \AA$, with 60$^\prime$ in-pile collimation and the standard 20$^\prime$ and 7$^\prime$ collimation before and after the sample respectively. In this measurement the powder sample was held in a thin walled vanadium can with $^4$He as exchange gas and the sample was cooled by a closed cycle compressor system.
Rietveld refinement of the BT1 data was carried out using the General Structure Analysis System (\textit{GSAS}) \cite{gsas}.
To detect magnetic diffraction from the relatively small moment magnetism of Ce$_3$Cu$_4$As$_4$O$_2$, high intensity diffraction data were acquired for temperatures between 50 mK and 45 K on the Multi-Axis Crystal Spectrometer (MACS) at NIST\cite{macs}. For these long wave length measurements the powder was held in a thin-walled aluminum can with $^4$He as exchange gas. A total of three different MACS experiments employing as many cryogenic systems contributed to the paper: In May 2013 we used an "Orange" $^4$He flow cryostat with access to temperatures from 1.5 K to 50 K. In November 2013 we used an Oxford Instruments dilution fridge with an 11.5 T magnet for the temperature range from 0.05 K to 14 K. Finally in May 2014 a dilution insert with access to temperatures from 0.1 K to 40 K was employed.
The incident and final neutron energies on MACS were defined by PG(002) monochromatization to be 5 meV. The full double focusing configuration of the MACS monochromator was used for temperature scans while higher resolution data were collected with the monochromator set for vertical focusing only and the beam width limited to 10 cm at the pre-monochromator beam aperture. The horizontal angular divergence of the incident neutron beam was $3.8^\circ$ and $0.6^\circ$ for the doubly and singly focused configurations respectively.
A second set of energy integrating detectors on MACS were utilized in this experiment. These ``two-axis'' detectors are behind the PG(002) double bounce analyzers and detect scattered neutrons irrespectively of the final energy of scattering. With an incident energy $E_i= 5$~meV and a beryllium filter between the powder sample and the analyzer the measured quantity can be written as follows\cite{Squires}:
\begin{equation}
\frac{d\sigma}{d\Omega}=r_0^2\int_0^{E_i}\sqrt{1-\frac{\hbar\omega}{E_i}}|\frac{g}{2}F(Q_\omega)|^2 2\tilde{\cal S}(Q_\omega,\omega) \hbar d\omega
\label{energyintegrated}
\end{equation}
Here $Q_\omega=|{\bf k}_i-{\bf k}_f|$, ${\bf k}_i$ and ${\bf k}_f$ being the wave vectors of incident and scattered neutrons respectively, and $\tilde{\cal S}(Q_\omega,\omega)$ is the spherically averaged dynamic correlation function defined so as to include elastic scattering.
For the ultimate sensitivity to weak temperature-dependent scattering we plot and analyze temperature difference intensity data from the spectroscopic detectors on MACS. While this removes $T-$independent scattering on average, thermal expansion produces peak derivative line shapes in place of nuclear Bragg peaks. These features can be accounted for quantitatively based on thermal expansion coefficients and a Rietveld refinement \cite{rietveld} of the nuclear diffraction data as follows.
Using angular variables as is customary for monochromatic beam diffraction data, the Rietveld refined nuclear diffraction pattern is written as follows:
\begin{equation}
{\cal I}(\theta)={\cal C}\sum_{\tau}\frac{I(\tau)}{2\sigma(\tau)}g\left(\frac{\theta-\Theta(\tau)}{\sigma(\tau)}\right).
\end{equation}
Here ${\cal C}$ is the ratio between the experimental count rate and the macroscopic scattering cross section of the sample, $2\theta$ is the scattering angle, $\tau$ indicates distinct reciprocal lattice vectors, $2\sigma(\tau)$ is the standard deviation for $2\theta$ near the Bragg peak at scattering angle $2\Theta(\tau)$, and $g(x)=\exp (-x^2/2)/\sqrt{2\pi}$ is a unity normalized gaussian distribution. $I(\tau)$ is the $2\theta-$integrated powder cross section for $|\vec{\tau}|=\tau$, which can be expressed as:
\begin{equation}
I(\tau)=\frac{4\pi^2\tan\Theta}{v_0\tau^3} N\sum_{|\vec{\tau}|=\tau}|F(\vec{\tau})|^2.
\end{equation}
Here $v_0$ is the unit cell volume, $N$ is the number of unit cells in the sample, and $F(\vec{\tau})$ is the unit cell structure factor including Debye Waller factors.
Thermal expansion gives rise to a small shift in the scattering angle that can be written as follows:
\begin{equation}
\Delta\Theta=\frac{\Delta\tau}{\tau}{\tan \Theta},
\end{equation}
Neglecting changes in the intensity of nuclear Bragg peaks, the resulting difference intensity is given by
\begin{eqnarray}
\Delta {\cal I}(\theta) &=& \frac{\partial {\cal I}(\theta)}{\partial \Theta}\Delta\Theta\\
&=&{\cal C}\sum_{\tau}\frac{I(\tau)}{2\sigma(\tau)} g^{\prime}\left(\frac{\theta-\Theta(\tau)}{\sigma(\tau)}\right)\nonumber\\
&&\times\left(-\frac{1}{\sigma(\tau)}\right) \frac{\Delta \tau}{\tau} \tan \Theta (\tau).
\label{dI}
\end{eqnarray}
Here $g^{\prime}(x)=-xg(x)$. In general we have
\begin{equation}
\frac{\Delta\tau}{\tau}=\sum_i\frac{\partial \ln \tau}{\partial a_i}\Delta a_i,
\end{equation}
where the summation is over all temperature dependent lattice parameters including angular variables. In the present case of persistent tetragonal symmetry we have
\begin{equation}
\frac{\Delta\tau}{\tau}=-\left[ (1-(\hat{\tau}_{\parallel})^2)\frac{\Delta a}{a} +(\hat{\tau}_\parallel)^2\frac{\Delta c}{c}\right]
\label{dtot}
\end{equation}
where $\hat{\tau}_\parallel$ is the projection of the unit vector $\hat{\tau}$ on the tetragonal c-axis.
Having determined $\sigma(\tau)$ and $I(\tau)$ from Rietveld refinement in the paramagnetic phase, we then Rietveld refined the difference between the low and high $T$ data with a functional consisting of the magnetic diffraction profile plus Eq.~\ref{dI} allowing only for adjustable thermal expansion coefficients $\Delta a/a$ and $\Delta c/c$ (Eq.~\ref{dtot}). The magnetic diffraction profile was developed using representation analysis as implemented in \textit{SARAh} \cite{sarah} and \textit{FULLPROF} \cite{fullprof}.
\subsection{Electronic Structure}
Band structure calculations were performed using the full-potential linearized augmented plane wave (FP-LAPW) method implemented in the WIEN2K package \cite{wien2k}. The Perdew, Burke, Ernzerhof version of the generalized gradient approximation \cite{pbe-gga} (PBE-GGA) was used for the exchange correlation potential and an onsite Coulomb repulsion of 5 eV was added to Ce sites to approximately account for electronic correlations in the narrow 4f bands\cite{alyahyaei,andersson}. Because the Ce states do not contribute to the electronic states at the Fermi level, spin-orbit coupling was not included in the calculation. The lattice parameters and atomic positions used for the calculation were taken from the neutron diffraction refinement at T = 300 K and are listed in Table \ref{ST300}.
\section{Experimental Results}
\label{results}
\subsection{Chemical Structure}
\label{chem_el_structure}
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{structurefit5K.pdf}
\caption{\label{structurefit5K} Rietveld analysis of neutron diffraction from $\rm Ce_3Cu_4As_4O_2$ powder at T = 5 K. The data were acquired on BT1 at NIST with $\lambda = 1.5398 \AA$, with a Ge(311) monochromator and 60$^\prime$ in-pile collimation. The red line shows the GSAS fit \cite{gsas}. The blue line shows the difference between model and diffraction data, while the green vertical lines show the calculated peak positions.The insert shows the detailed fit near the (004) and (006) nuclear Bragg peaks. All peaks are resolution limited and the Rietveld fit provides an acceptable account of the data. }
\end{figure}
\begin{figure}
\includegraphics[width=1.0\columnwidth,clip]{spin_new.pdf}
\caption{\label{structure} (a) Ce$_3$Cu$_4$As$_4$O$_2$ crystal structure with space group \textit{I 4/mmm}. (b) Spin structures proposed for the magnetic phases \textit{I}, \textit{II} and \textit{III}. In frame (b), the arrows represent the spin direction and relative length. The spin structures for phase \textit{I} and \textit{III} can be determined directly from neutron diffraction Bragg intensities, while that for phase \textit{II} is proposed based on the T - and Q - dependence of inelastic magnetic scattering. More details are referred to the section IV (B).}
\end{figure}
The low temperature (T = 5 K) crystal structure was determined from the Rietveld refinement of the powder neutron diffraction data shown in Fig.~\ref{structurefit5K}. A single phase fit can account for the data with space group \textit{I4/mmm} and $\chi^2$ = 2.7. Powder X-ray diffraction data had indicated small oxygen defficiency in most reported $\rm R_3T_4As_4O_{2-\delta}$ compounds (T = Ni or Cu)\cite{jiakui}. However, the inset to Fig.~\ref{structurefit5K} shows the refinement of the oxygen stoichiometry in $\rm Ce_3Cu_4As_4O_{2-\delta}$ based on the present neutron data, which yields the best refinement (lowest $\chi^2$) for $\delta=0.00(5)$ and therefore indicates the compound is stoichiometric. No magnetic diffraction is visible in the BT1 data. This is however not inconsistent with the MACS data where the strongest magnetic peak at T = 5 K has an integrated intensity of just 0.4\% of the strongest nuclear peak, which is too weak to be detected by BT1. A summary of the structural information is provided in table~\ref{ST300} and ~\ref{ST}.
\begin{table}[h!]
\setlength{\tabcolsep}{8pt}
\caption{ T = 300 K atomic positions for Ce$_3$Cu$_4$As$_4$O$_2$ with space group \textit{I 4/mmm} determined by the Rietveld analysis\cite{gsas} of neutron powder diffraction data. The corresponding reduced chi-square measure of goodness of fit is $\chi^2$ = 2.7. The room temperature lattice constants are \textit{a} = 4.07733(10) \AA ~ and \textit{c} = 27.4146(9) \AA. } \label{ST300}
\begin{tabular}{ c || c| c | c | c | c }
\hline
Atom & Site & x & y & z & $U_{iso}(\AA)$ \\ \hline
& & & & & \\
Ce1 & 2a & 0 & 0 & 0 & 0.0088(6)\\
& & & & & \\
Ce2 & 4e & 1/2 & 1/2 & 0.2069(1) & 0.0088(6)\\
& & & & & \\
Cu & 8g & 1/2 & 0 & 0.0975(5) & 0.0133(4)\\
& & & & & \\
As1 & 4e & 0 & 0 & 0.1459(1) & 0.0067(4)\\
& & & & & \\
As2 & 4e & 1/2 & 1/2 & 0.0454(2) & 0.0067(4)\\
& & & & & \\
O & 4d & 1/2 & 0 & 1/4 & 0.0051(5)\\\hline
\end{tabular}
\end{table}
\begin{table}[h!]
\setlength{\tabcolsep}{8pt}
\caption{T = 4.5 K Atomic positions for Ce$_3$Cu$_4$As$_4$O$_2$ in space group \textit{I 4/mmm} determined by the Rietveld analysis \cite{gsas} of powder diffraction data. The corresponding reduced chi-square measure of goodness of fit is $\chi^2$ = 3.4. The corresponding lattice constants are \textit{a} = 4.06344(9) \AA ~ and \textit{c} = 27.3365(7) \AA. } \label{ST}
\begin{tabular}{ c || c| c | c | c | c }
\hline
Atom & Site & x & y & z & $U_{iso}(\AA)$ \\ \hline
& & & & & \\
Ce1 & 2a & 0 & 0 & 0 & 0.0029(5)\\
& & & & & \\
Ce2 & 4e & 1/2 & 1/2 & 0.2068(1) & 0.0029(5)\\
& & & & & \\
Cu & 8g & 1/2 & 0 & 0.0973(4) & 0.0030(5)\\
& & & & & \\
As1 & 4e & 0 & 0 & 0.1462(7) & 0.0002(3)\\
& & & & & \\
As2 & 4e & 1/2 & 1/2 & 0.04504(7) & 0.0002(3)\\
& & & & & \\
O & 4d & 1/2 & 0 & 1/4 & 0.0007(4)\\\hline
\end{tabular}
\end{table}
Illustrated in Fig.~\ref{structure}(a), the structure of $\rm Ce_3Cu_4As_4O_2$ consists of alternating layers of $\rm CeCu_4As_4$ (blue box) and $\rm Ce_2O_2$ (red box). In $\rm CeCu_4As_4$, Ce atoms lie at the vertices of a simple square lattice sandwiched between $\rm Cu_2As_2$ layers. This structural unit is found in the $\rm ThCr_2Si_2$ structure, which is familiar from 122 iron superconductors such as $\rm BaFe_2As_2$ where Ba occupies the site equivalent to Ce in the $\rm CeCu_4As_4$ layer \cite{su}. There are also a number of heavy fermion systems with a magnetic ion on this site including $\rm CeT_2Si_2$ \cite{shuzo}$^,$\cite{stockert}$^,$\cite{regnault}$^,$\cite{dijk} (T=Pd, Ru, Rh, Cu) and $\rm URu_2Si_2$ \cite{collin}.
\begin{figure}[t!]
\includegraphics[width=\columnwidth,clip,angle=0]{Diffslice.pdf}
\caption{\label{Neutron2} Color image of (a) elastic and (b) energy integrated neutron scattering versus temperature and wave vector. The data were acquired on the MACS instrument at NIST using the spectroscopic and energy integrating detectors respectively. Corresponding data sets acquired at $T=32$~K were subtracted from each to expose small temperature dependent effects. The incident neutron energy was 5 meV. Gray vertical regions indicate temperature intervals within 5\% of the peak maxima in the magnetic specific heat\cite{jiakui}. Horizontal dashes lines indicate the locations of allowed nuclear Bragg peaks. (c) Temperature dependence of the average scattering intensity in select ranges of wave vector transfer. Black symbols are from the data presented in frame (b). Red and blue symbols are from (a). In all the figures where data are from neutron scattering experiments, the error bars indicate one standard deviation.}
\end{figure}
In the $\rm Ce_2O_2$ layer, a 45$^0$ rotated square lattice of O with lattice parameter $a/\sqrt{2}$ is sandwiched by square lattices of Ce with lattice parameter $a$, such that half of the squares of the O lattice have Ce above and the other half have Ce below. This structural element is also found in the 1111 type Fe superconductors and specifically in CeFeAsO\cite{zhao} and CeNiAsO\cite{luo}.
\subsection{Magnetic Neutron Scattering}
\label{mag_neutron_results}
\subsubsection{Temperature dependence}
Three peaks in the specific heat of polycrystalline $\rm Ce_3Cu_4As_4O_2$ were previously reported and associated with magnetic transitions\cite{jiakui}. In order of decreasing temperature, we shall denote the corresponding phases by I ($T_{2}<T<T_{N}$), II ($T_{3}<T<T_{2}$), and III ($T<T_{3}$) respectively. In search for the associated atomic scale magnetic correlations, we acquired neutron diffraction data for temperatures between 1.5 K ($<$ T$_3$) and 40 K ($>$ T$_N$) using a high intensity configuration of the MACS spectrometer. For sensitivity to weak temperature dependent scattering we subtract a high statistics data set acquired at $T=32$~K and plot the difference data as a color image in Fig.~\ref{Neutron2}. The MACS instrument offers simultaneous energy resolved data and final energy integrated data shown respectively in frames Fig.~\ref{Neutron2}(a) and Fig.~\ref{Neutron2}(b). Coincident with each of the transition regimes inferred from specific heat data (vertical grey regions) are anomalies in the temperature dependent neutron scattering data. Fig.~\ref{Neutron2}(c) provides a detailed view of the temperature dependent intensity averaged over relevant ranges of wave vector transfer.
Below $T_{N}$ we observe the development of Bragg diffraction for 1.5~$\AA^{-1}<Q<1.9~\AA^{-1}$ in Fig.~\ref{Neutron2}(a). In being associated with a net increase in intensity, these features in the ``thermo-diffractogram" are distinguished from the effects of thermal expansion, which produce matched minima and maxima surrounding each nuclear Bragg peak (thin dashed lines).
Fig.~\ref{Neutron2}(b) and Fig.~\ref{Neutron2}(c) (black symbols and line) show a distinct reduction in inelastic scattering for temperatures below the characteristic temperature $T_{2}$ extracted from bulk properties. This observation was reproduced in experiments using both a flow cryostat and a dilution fridge, and the temperature and momentum regimes are inconsistent with contributions from cryogenic fluids such as nitrogen or helium. We therefore associate this feature with a reduction in inelastic magnetic scattering for $T<T_{2}$. The total scattering sum-rule requires that reduced inelastic scattering appears elsewhere in ${\cal S}(Q\omega)$. One option is a shift of all the lost spectral weight beyond the 5 meV cut-off of the experiment (see Eq.~\ref{energyintegrated}).Alternatively a reduction in inelastic scattering can be associated with the development of elastic scattering and static correlations. In that case a possible explanation for the absence of elastic magnetic scattering associated with $T_{2}$ (see Fig.~\ref{Neutron2}(a)) is that the associated component in ${\cal S}(Q\omega)$ is extinguished or severely weakened by the so-called polarization factor, which removes scattering associated with spin components parallel to wave vector transfer. This would be the case for a modulated in-plane spin structure in phase II where the staggered moment is oriented along the characteristic wave vector of the magnetic structure.
\begin{figure}[t!]
\includegraphics[width=\columnwidth,clip,angle=0]{lowt.pdf}
\caption{\label{Neutron4} (a) Image of elastic neutron scattering versus temperature and wave vector transfer in the low temperature regime. Data collected at T = 15 K has been subtracted to remove scattering intensities of nuclear Bragg peaks. (b) Intensity and (c) inverse correlation length versus temperature extracted from fits of a Lorentzian convoluted with a Gaussian of the resolution width (horizontal bar within inset) to the most intense magnetic peak. An example of such a fit is shown in the inset to (c).}
\end{figure}
The clearest anomaly in scattering is associated with the lowest temperature transition. The temperature regime for $T<T_{3}$ (phase III) is detailed in Fig.~\ref{Neutron4}. Phase III is associated with the development of strong Bragg peaks and we shall argue that only in this phase is the spin direction perpendicular to the direction of modulation so the polarization factor does not extinguish the low $Q$ peaks. Fig.~\ref{Neutron4}(b) shows the integrated intensity, that develops in an order parameter like fashion for $T<T_{3}$ and Fig.~\ref{Neutron4}(c) shows the half width at half maximum of the Lorentzian fit (inset to Fig. \ref{Neutron4}(c)). After correcting for resolution effects the low T limit corresponds to a correlation length above 75 $\AA$.
While we have identified distinct anomalies in the $T$ dependence of neutron scattering at each transition, all except perhaps those associated with $T_{3}$ are unusually broad in temperature compared to a standard second order phase transition observed through diffraction with a cold neutron beam. This mirrors the specific heat anomalies\cite{jiakui} and suggests we are dealing with cross-over phenomena rather than critical phase transitions, which could result from disorder.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{diffraction_pattern.pdf}
\caption{\label{diffraction_pattern} Neutron diffraction patterns for Ce$_3$Cu$_4$As$_4$O$_2$ obtained at MACS with T = (a) 17 K, (b) 6 K and (c) 30 mK. The fitted lines in (a)-(c) include a conventional Rietveld model for the magnetic scattering plus the peak derivative profile (dashed line in (c)) described in Section II(B). The pattern in panel (b) includes the calculated diffraction pattern corresponding to the proposed spin structure in Phase \textit{II} (Fig. \ref{structure}) with moment size listed in table \ref{summary}. Such contribution would go undetected experimentally due to the polarization factor when spins are almost parallel to the wave vector. The line in (c) is a Rietveld fit to the structural peaks.}
\end{figure}
\subsubsection{Diffraction in each phase}
To elucidate the nature of each magnetic phase, we isolate the $Q$ dependence of the associated scattering by subtracting data collected for $T>T_{N}$ from high statistics data acquired in each phase.
For phase I the difference pattern is shown in Fig \ref{diffraction_pattern} (a). Apart from the characteristic zig-zag anomalies associated with thermal expansion, two distinct Bragg peaks are associated with Phase I. A detailed view of these peaks is provided in Fig.~\ref{detailph}. Discounting peak derivative line shapes indicated with the dashed lines described by Eq.~\ref{dI}, we identify two peaks (shadowed in bright green lines) whose intensities are less than $1\%$ of nuclear ones at wave vector transfer $Q\sim 1.57 ~ \AA^{-1}$ and $Q\sim 1.63 ~ \AA^{-1}$. Nearby there are no strong nuclear peaks and is therefore possible to obtain reliable magnetic diffraction.The additional intensity at $Q\sim 1.8 \AA^{-1}$ could be misleading due to nuclear subtraction. The figure shows the peaks are resolution limited and this sets a low T limit of 75 \AA\ on the correlation length associated with translational symmetry breaking. The position of the peaks is indicated by the two vertical hatched regions in Fig.~\ref{kvectors} for $Q>1.5 \AA^{-1}$. Assuming that a single propagation vector is associated with Phase I, Fig. \ref{kvectors} shows that this must be $\textbf{k}_1\equiv (0, 0, 1.0(2))$. The absence of magnetic Bragg peaks of the form $(0, 0,2n+1)$, where $n$ is an integer, indicates these peaks are extinguished by the polarization factor and so calls for spins polarization along $\bf c$.
\begin{figure}[t!]
\includegraphics[width=0.95\columnwidth,clip,angle=0]{detailph.pdf}
\caption{\label{detailph} Detailed Q-dependence of neutron scattering data characterizing the magnetic order in (a) phase I ($16K < T < 24K$) and (b) phase II ($2K < T < 16K$). A background data set acquired at $T=40$~K was subtracted to expose temperature dependent features associated with the phase transitions. The lines through the data include the peak derivative features associated with thermal expansion (Eq.~\ref{dI} and the calculated magnetic diffraction associated with the structures proposed in Fig.~\ref{structure}).
}
\end{figure}
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{check_q.pdf}
\caption{\label{kvectors} Relationship between high symmetry magnetic modulation wave vectors distinguished by colors and the location of magnetic satellite peaks in the powder diffraction pattern for $\rm Ce_3Cu_4As_4O_2$. The vertical grey regions show the locations of the experimentally observed magnetic Bragg peaks. The low $T$ phase III has all indicated Bragg peaks whereas only the peaks near 1.5 $\AA^{-1}$ are visible in Fig.~\ref{detailph} for phases I-II. The calculated wave vector transfer associated with the horizontal yellow line in (a) ${\bf k}_1={\bf c}^*$ or equivalently ${\bf k}_1={\bf a}^*$ are consistent with the observed magnetic Bragg peaks. Frames (b) and (c) show the remaining singly indexed high symmetry magnetic wave vectors that fail to account for the magnetic Bragg peaks observed in phase III.
}
\end{figure}
The diffraction pattern for Phase II is shown in Fig \ref{diffraction_pattern} (b) with the detail in Fig.~\ref{detailph} (b). Surprisingly there is virtually no change in the position or widths of the Bragg peaks observed for Phase I. The black symbols in Fig. 3(c) however, show that Phase II is associated with the loss of inelastic scattering. To better understand the associated dynamic correlations, Fig.~\ref{Neutron3} shows the $Q-$dependence of the energy integrated scattering that is lost upon cooling into phase II. It takes the form of asymmetric peaks, which, in the direction of increasing $Q$, rise more abruptly than they decay. This Warren-like line shape\cite{warren} is a clear indication of low dimensional correlations. We shall later show the correlations to be quasi-two-dimensional. In that case rods of scattering extend perpendicular to the plane of long range correlations. The sharp leading edge is associated with these rods becoming tangents to the Ewald sphere and the long trailing tail results from the fraction of the Ewald sphere pierced by that rod decreasing in inverse proportion to the area of the sphere.
From Fig.~\ref{Neutron3} we see that the characteristic wave vector of the rod is 0.8 $\AA^{-1}$. The proximity of this number to $a^*/2=0.77 ~ \AA^{-1}$ indicates that the spin fluctuations of phase II are associated with doubling the unit cell in the basal plane. Possible explanations for the absence of a corresponding magnetic Bragg peak in Fig.~\ref{detailph} (c) are (1) that a competing instability prevails so that static long range AFM correlations of the ${\bf k}_2={\bf a}^*/2$ variety never materialize and (2) that a polarization factor extinguishes the magnetic Bragg peaks associated with this order in the low $Q$ regime where the experiment has sufficient sensitivity to detect them.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{fluctuation.pdf}
\caption{\label{Neutron3} $\tilde{Q}$-dependence difference intensity 20~K and 10~K from the energy integrating detectors on the MACS spectrometer. The data is plotted as a function of wave vector transfer $\tilde{Q}(\theta,\omega)$ for energy transfer $\langle\hbar\omega\rangle=1.2(3)$~meV inferred from the fitting analysis (see section~\ref{analysis}). The upper horizontal axis shows wave vector transfer for elastic scattering. The solid blue line is a Warren-like line shape for quasi-two-dimensional AFM correlations with characteristic wave vector ${\bf k}_2=(1/2,0,0)$ and in-plane dynamic correlation length $\xi=8.2(6)$~\AA. The dashed line is a $Q^2$ background ascribed to the difference in the Debye Waller factor for incoherent scattering at the two temperatures involved. The inset shows the pattern of quasi-two-dimensional fluctuation associated with ${\bf k}_2$, with black and grey spots representing alternative spin . The proposed ordered state for phase II has spins parallel to ${\bf k}_2$ (Fig.~\ref{structure}(b)).}
\end{figure}
Shown in Fig.~\ref{diffraction_pattern} (c), the strongest magnetic diffraction peaks are associated with Phase III. As indicated in Fig.~\ref{kvectors} all observed peaks associated with phase III can be accounted for by a wave vector ${\bf k}_1={\bf c}^*$ or equivalently ${\bf k}_1={\bf a}^*$. The appearance of Bragg peaks of the form $(0 0,2n+1)$ in Phase III indicate spin components within the basal plane and a spin-flop type transition relative to phases I and II. To be quantified in section \ref{analysis}, the magnetic peaks are slightly broader than the nuclear peaks even at 30 mK indicating an element of disorder in the magnetic structure or strong thermal diffuse magnetic scattering with a length scale shorter than the coherence length of the chemical structure. Upon heating, the intensity of the magnetic peaks decreases precipitously above 2 K, though a broad feature remains at all magnetic Bragg positions up to T = 2.6 K. This indicates dynamic diffuse scattering near the critical temperature of the spin-flop transition.
\subsection{Physical properties}
\subsubsection{Magnetization}
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{CeCu-MT.pdf}
\caption{\label{CeCu-MT} (a) ZFC (solid lines) and FC (dotted lines) temperature-dependent M/H measured in applied magnetic fields up to H = 7 T. (b) The temperature derivatives of M/H$*$T for different magnetic fields. The three transition temperatures are marked by vertical arrows for H = 0.}
\end{figure}
The magnetization versus temperature was measured in different fields and the corresponding data are shown in Fig. \ref{CeCu-MT}(a). All magnetization measurements were conducted on polycrystalline samples, so the data represent the spherical average of the longitudinal response to the magnetic field $H$.
For temperatures below $\sim$ 30 K, the bifurcation between zero field cooled (ZFC) (solid lines) and field cooled (FC) (dashed lines) magnetization data occurs for fields up to H = 0.4 T. To identify potential magnetic transitions, Fig. \ref{CeCu-MT}(b) shows the derivatives $H^{-1}d(MT)/dT$ \cite{fisher}, for which peaks are expected at magnetic phase transitions. Indeed, anomalies in $H^{-1}d(MT)/dT$, marked by vertical arrows, occur near each of the transitions previously identified in specific heat data \cite{jiakui}. As the field increases, $H^{-1}d(MT)/dT$ data (Fig. \ref{CeCu-MT}(b)) indicate that the lowest transition temperature T$_{3}$ increases and reaches $\approx$ 7 K for H = 7 T, while the upper two transitions at $T_{N}$ and $T_{2}$ are largely unaffected by $H~<~7$~T.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{CeCu-R.pdf}
\caption{\label{CeCu-R} The resistivity of Ce$_3$Cu$_4$As$_4$O$_2$ for H = 0 (squares) and H = 9 T (circles). Inset: enlarged view of the low temperature resistivity in this field range. Solid orange line is an example of polynomial fits for H = 0 T to determine the transition temperature. }
\end{figure}
\subsubsection{Resistivity}
The field dependence of the resistivity measured on a dense polycrystalline sample is shown in Fig. \ref{CeCu-R}. The resistivity increases upon cooling below room temperature, reaching a maximum at T $\approx$ 150 K. The increase is typically associated with the single ion Kondo effect, with the maximum signaling the onset of inter-site coherence. Below 150 K, poor metallic behavior is observed, as the resistivity decreases with temperature, albeit with large resistivity values $\rho > 10~{\rm m}\Omega$cm. As the temperature decreases below 50 K, a difference between H = 0 (full symbols) and H = 9 ~T (open symbols) data develops, well above the upper transition temperature $T_{N}$ inferred from specific heat data\cite{jiakui}. Notably however, the magnetoresistance reaches a maximum near $T_{3}$, as will be shown explicitly below. The inset of Fig. \ref{CeCu-R} shows the low temperature resistivity measured in different magnetic fields up to H = 9 ~T. The resistivity decreases monotonically with increasing magnetic field. For H = 0, a broad peak around 4 K is observed, which shifts to higher temperature with increasing field. In phase III, Fermi liquid (FL) behavior is evidenced by the quadratic temperature dependence of the resistivity (Fig. \ref{CeCu-NFL}a) up to H $\approx$ 3 T. This behavior is reminiscent of a Kondo lattice system, in which the competition between magnetic coupling and Kondo screening gives rise to a peak around the coherence temperature T$_{coh}$ and FL behavior below T$_N$\cite{schweitzer}. For fields beyond H $\approx 2.5 - 3$ T however, a finite-T minimum in the resistivity develops, followed by a logarithmic increase of the resistivity upon cooling below $\approx$ 1 K as apparent in the semi-log plot in Fig. \ref{CeCu-NFL} (b). The $\rho \propto \log T$ behavior persists up to a temperature $T^*$ that increases with magnetic field.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{CeCu-NFL.pdf}
\caption{\label{CeCu-NFL} (a): The quadratic dependence of resistivity for small magnetic fields between H = 0 T and H = 3 T. (b): The logarithmic dependence of resistivity for large fields between H = 2.5 T and H = 9 T. }
\end{figure}
The origin of the logarithmic temperature dependence of resistivity in Ce$_3$Cu$_4$As$_4$O$_2$ is not clear: either the formation of Kondo singlet \cite{hewson} or weak Anderson localization in a 2D systems \cite{anderson} could lead to $\rho(T) \propto \log T$ behavior, however neither phenomenon is relevant for Ce$_3$Cu$_4$As$_4$O$_2$. For the former scenario, a magnetic field breaks up the Kondo singlet, which is inconsistent with the observation that the logarithmic temperature dependence extends over a larger T-regime for higher magnetic fields. In the latter scenario, the magnetic field may tune the localization-delocalization transition. The upturn in resistivity could be observed in a system with weak localization\cite{giordano}. However, this localization usually increases the resistivity compared to the delocalized state. The magnetic field induced localization is not consistent with the observation of negative magnetoresistance in Ce$_3$Cu$_4$As$_4$O$_2$.
A complication in the interpretation of these data is that the polycrystalline nature of the sample implies the transport measurement is an average over all possible field and current directions with $ \bf H \parallel J$ in the tetragonal structure. For an anisotropic magnetic material such as Ce$_3$Cu$_4$As$_4$O$_2$ the high field low $T$ behavior could therefore be uncharacteristic and dominated by specific field directions.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{CeCu-MR.pdf}
\caption{\label{CeCu-MR} Magnetoresistance data for Ce$_3$Cu$_4$As$_4$O$_2$ (symbols) for various temperatures, with the magnetoresistance of non-magnetic La$_3$Cu$_4$As$_4$O$_2$ (line) at T = 2 K shown for comparison.}
\end{figure}
The magnetoresistance is shown in Fig. \ref{CeCu-MR} for Ce$_3$Cu$_4$As$_4$O$_2$ (symbols) and the non-magnetic analogue La$_3$Cu$_4$As$_4$O$_2$ (line). For the La compound, the magnetoresistance is positive and small (less than 5\%), as expected for a normal metal in which the Lorentz force introduces electron scattering. For the Ce compound, the T = 2 K magnetoresistance is negative and reaches $\approx$ --30\% at H = 9 T. This suggests that the magnetism associated with the Ce$^{3+}$ ions is responsible for the large magnetoresistance in Ce$_3$Cu$_4$As$_4$O$_2$.
The magnetoresistance for Ce$_3$Cu$_4$As$_4$O$_2$ is largest at T = 2 K, close to T$_3$. Similar negative large magnetoresistance was also observed in the Kondo lattice systems Ce$_2$Ni$_3$Ge$_5$, CeB$_6$ and CeRhSn$_2$.\cite{steglich, woods, geibel} Above the magnetic ordering temperature, an important contribution to the resistivity is the Kondo scattering of conduction electrons off local moments. The magnetic field could effectively suppress the Kondo scattering and induce a negative magnetoresistance. This negative magnetoresistance will reach its maximum at the magnetic ordering temperature where the magnetic fluctuations dominate all other contributions to the resistivity.
\begin{figure}[t!]
\includegraphics[width=0.8\columnwidth,clip]{CeCu-Cp.pdf}
\caption{\label{CeCu-Cp} (a) The specific heat of Ce$_3$Cu$_4$As$_4$O$_2$ measured from T = 0.4 K to T = 14 K, in applied magnetic fields between H = 0 and H = 9 T. (b) Quadratic temperature dependence of $C_p$ in magnetic fields between H = 2 T and H = 9 T. }
\end{figure}
\subsubsection{Specific Heat}
Additional information relevant to understanding the unusual low $T$ behaviors indicated by magnetization and transport measurements is provided by field-dependent specific heat data in Fig. \ref{CeCu-Cp}. From Fig. \ref{CeCu-Cp}(a), the broad peak associated with low $T$ magnetic ordering at $T_{3}~=~2.0$ K shifts to higher temperatures and broadens for lager fields applied to the polycrystalline sample. $C_p$ is quadratic in temperature for H $~\geq~2.5$ T (Fig. \ref{CeCu-Cp}(b)). At H = 9 T, the quadratic dependence extends up to T = 4 K. This behavior can be associated with gapless excitations with a quasi-two-dimensional linear dispersion relation as in a two dimensional antiferromagnet. This indication of reduced dimensionality is consistent with the tube-like Fermi surface inferred from DFT (see section IV (C)). In zero field the low $T$ state indicated in Fig.~\ref{structure} would be expected to have an excitation gap similar in magnitude to $T_{3}$. The high field $C_p(T)~\propto~T^2$ regime might be associated with specific field directions in the polycrystalline experiment that are transverse to the easy axes and induce gapless behavior.
\section{Analysis}
\label{analysis}
\subsection{Phase Diagram}
From the thermal anomalies observed in the wide range of experimental data presented, a phase diagram can be sketched. As previously emphasized, all anomalies are broad, indicative of cross-overs between different regimes as opposed to sharp symmetry breaking phase transitions. It also means that different measurements will display slightly different characteristic temperatures. In combination though such measurements lead us to the definition of well defined cross over lines that we have labeled $T_{N}$, $T_{2}$, and $T_{3}$ bordering the corresponding phases I-III. The upper cross-over lines are remarkably field independent. The predominant effect of field appears to be broadening that can be associated with a spherically averaged result on an anisotropic material. At low temperatures a distinct non-Fermi liquid (NFL) regime is present for H $\geq$ 2.5 T where $\rho(T)~\propto~\log T$ and $C_p~\propto~T^2$.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{phase-diagram.pdf}
\caption{\label{phase_diagram} Phase diagram of temperature vs. magnetic field for Ce$_3$Cu$_4$As$_4$O$_2$, with phase boundaries determined by features in the physical property measurements and neutron diffractions. }
\end{figure}
\subsection{Magnetic Structures}
From the neutron scattering data presented in section \ref{mag_neutron_results} we have inferred the following principal features of magnetism in $\rm Ce_3Cu_4As_4O_2$: For $T< T_{N}=24$~K Ce spins are polarized along the tetragonal $\bf c$ axis, with a characteristic propagation vector $\textbf{k}_{1} = 001$. This structure persists in the second phase for $T~<~T_{2}~=~16$ K, which is marked by the loss of low energy spin fluctuations that have quasi-two-dimensional spatial correlations, a characteristic wave vector ${\bf k}_2=(0.5,0,0)$, and a component of polarization perpendicular to ${\bf k}_2$. Finally, for $T~<~T_{3}~=~2~K$ there is a spin-flop transition where the orientation of spins modulated in accordance with ${\bf k}_1$ rotates from the $\bf c$ axis to the tetragonal basal plane.
While the the present powder diffraction data are insufficient to definitely determine the complex spin structures of $\rm Ce_3Cu_4As_4O_2$, we shall develop a specific picture of the ordered spin structures that is consistent with the diffraction profiles and provides a logical sequence of phase transitions. One of the main outcomes that is supported by Rietveld analysis of the data is an association of the two wave vectors with the two different Ce sites in $\rm Ce_3Cu_4As_4O_2$. The sequence of spin structures inferred from this analysis is shown in Fig.~\ref{structure}.
\subsubsection{Phase I}
We use representation theory to classify the magnetic structures with wave vector ${\bf k}_1=(001)$ that can develop from the paramagnetic phase of space group I4/mmm in a second order phase transitions. Using Kovalev notation \cite{Kova}, the representations associated with ${\bf k}_1$ and each of the two cerium sites decompose into irreducible representations (IR) as follows. For the Ce1 cite associated with $\rm CeRu_4As_4$ layers: $\Gamma_{mag}(\rm Ce1) = \Gamma_3 + 2\Gamma_9$. For the Ce2 sites associated with the $\rm Ce_2O_2$ layers: $\Gamma_{mag}(\rm Ce2) = \Gamma_3 + \Gamma_2 + 2\Gamma_9 + 2\Gamma_{10}$.
There are a total of nine basis vectors (BVs) and these are listed in Table \ref{BVs}. These were obtained using the \textit{SARAh} program \cite{sarah}. For both cerium sites the two-dimensional $\Gamma_9$ and $\Gamma_{10}$ IRs describe magnetic structures with in-plane moments while the one-dimensional $\Gamma_3$ and $\Gamma_2$ IRs describe structures with moments along the tetragonal c-axis.
\begin{table}
\setlength{\tabcolsep}{8pt}
\caption{The nine basis vectors associated with magnetic structures that transform according to irreducible representations of the I \textit{/4mmm} space group with propagation vector \textbf{k}=(0,0,1). The irreducible representations and basis vectors were obtained using \textit{SARAh} \cite{sarah} and the notation is based on Kovalev\cite{Kova}. }
\begin{tabular}{| c | c | c | c | c |}
\hline
\multirow{2}{*}{IR} & \multirow{2}{*}{Atom} & \multicolumn{3}{l|}{Basis Vectors} \\ \cline{3-5}
& & $m_a$ & $m_b$ & $m_c$ \\ \hline
$\Gamma_3$ & $\rm Ce_1$ & 0 & 0 & 1 \\
& $\rm Ce_2$ & 0 & 0 & 1 \\ \hline
\multirow{4}{*}{$\Gamma_9$} & \multirow{2}{*}{$\rm Ce_1$} & 1 & 0 & 0 \\ \cline{3-5}
& & 0 & -1 & 0 \\ \cline{2-5}
& \multirow{2}{*}{$\rm Ce_2$} & 1 & 0 & 0 \\ \cline{3-5}
& & 0 & -1 & 0 \\ \hline
$\Gamma_2$ & $\rm Ce_2$ & 0 & 0 & -1 \\ \hline
\multirow{2}{*}{$\Gamma_{10}$ } & \multirow{2}{*}{ $\rm Ce_2$} & -1 & 0 & 0 \\ \cline{3-5}
& & 0 & 1 & 0 \\ \hline
\end{tabular}
\label{BVs}
\end{table}
Because no magnetic peaks of the form $(0,0,2n+1)$ are observed for $T_{2}<T<T_{N}$ (Fig.~\ref{diffraction_pattern}), the moment is oriented along the c-axis and we must focus on the one-dimensional IRs $\Gamma_2$ and $\Gamma_3$. For the Ce1 sites this leaves just one option namely $\Gamma_3$, which corresponds to the centered site antiparallel to the nearest neighbors (Fig.~\ref{structure}). For Ce2 sites there are two options corresponding to FM ($\Gamma_2$) or AFM ($\Gamma_3$) alignment of spins within a $\rm Ce_2O_2$ bi-layer.
Assuming the $\Gamma_2$ representation for Ce2 sites only (and no order on Ce1 sites) leads to $\chi^2=23.7$, which is larger than $\chi^2=17.5$ corresponding to $\Gamma_3$ with order on both cerium sites. Here the reduced $\chi^2$ goodness is reported for difference data in the range $1.5\AA^{-1}<Q<1.8\AA^{-1}$. Fig.~\ref{detailph} shows three fit lines corresponding to $\Gamma_3$ order on Ce2, on Ce1 sites only and on both sites.The constrained differential line shape associated with thermal expansion is included with $\Delta a/a=1.3\%$ and $\Delta c/c=0.6\%$. The fit with order on both sites provides the best account for the relative intensity of the two peaks and the corresponding ordered moments inferred are $\mu_{Ce_1} =0.14(6)~\mu_B $ and $\mu_{Ce_2} = 0.18(2)~\mu_B$. A sketch of the corresponding spin configuration is shown as phase I in Fig.~\ref{structure} (b). The weak nuclear Bragg peak (101) is close to the magnetic peaks. Subtle changes in the chemical structure thus could also play a role in the temperature dependence of diffraction in this Q-range.
\subsubsection{Phase II}
While the present experiment detects no new elastic peaks upon entering phase II, a distinct loss of low energy inelastic scattering is observed in the energy integrating detectors of the MACS instrument for $T<T_{2}$ (Fig.~\ref{Neutron2}(b-c)). In Fig.~\ref{Neutron3} the broad anisotropic peaks associated with the scattering that vanishes for $T<T_{\rm 2}$ is compared to the spherical average of the following dynamic correlation function associated with quasi-two-dimensional magnetic correlations:
\begin{equation}
{\cal S}(\textbf{Q})= \sum_m \frac{\langle S^2\rangle \cdot \xi^2/\pi}{[1+(\xi|{\bf Q_{\perp}-Q_m}|)^2]^2}.
\end{equation}
Here ${\bf Q}_m = \tau \pm \textbf {k}_{2}$ indicates the location of critical points in the 2D reciprocal lattice. Because the incident neutron energy is similar to the energy scale of the spin system, actual wave vector transfer differs from that calculated neglecting energy transfer as follows
\begin{equation}
\tilde{Q}(\theta,\omega) = k_{i}\sqrt{2-\frac{\hbar\omega}{E_i}-2\sqrt{1-\frac{\hbar\omega}{E_i}}\cos 2\theta}.
\end{equation}
With $\hbar\omega=1.2(3)$~meV, in-plane correlations length $\xi = 8.2(6) \AA$ and an effective fluctuating moment of $(g_J\mu_B)^2\langle S^2\rangle\leq0.3~\mu_B^2$ this model provides a satisfactory account of the difference data in Fig.~\ref{Neutron3}. Here we have plotted the data versus the inferred wave vector transfer for inelastic scattering $\tilde{Q}$ showing also wave vector transfer for elastic scattering on the upper horizontal axis.
Ce2 sites play the dominant role both in Phase I and Phase III. We therefore pursue the hypothesis that the ${\bf k}_2=(1/2,0,0)$ type scattering in Fig.~\ref{Neutron3} is associated with Ce1 sites. The total scattering can decrease if the kinematically accessible Bragg peaks of the corresponding order are extinguished by the polarization factor. Fig.~\ref{diffraction_pattern} (b) includes the calculated elastic scattering that would result from the longitudinally polarized in-plane antiferromagnetic spin structure indicated in Fig.~\ref{structure}(b) for Phase II. Because spins are almost parallel to ${\bf k}_2$ at low wave vector transfer, this structure produces very little magnetic powder diffraction and would go undetected in the present experiment. This structure is therefore a viable candidate to account for the loss of critical scattering with wave vector ${\bf k}_2$ without the appearance of appreciable magnetic Bragg scattering.
\subsubsection{Phase III}
The appearance of low-$Q$ peaks in Phase III of the ${\bf k}_1=(001)$ variety is indicative of in-plane magnetic moments that are described by IR $\Gamma_9$ or $\Gamma_{10}$ (Table~\ref{BVs}). Of these $\Gamma_{10}$ is inconsistent with the observed relative intensities while $\Gamma_9$ provides for the excellent fit shown in Fig.~\ref{diffraction_pattern}(c). The contribution to magnetic scattering from out of plane moments (Fig.~\ref{diffraction_pattern}(a-b)) is so weak that we cannot place meaningful limits on how much might remain in Phase III. The experimental data in Fig.~\ref{diffraction_pattern}(c) is consistent with an AFM spin structure of the $\Gamma_9$ variety (Fig.~\ref{structure}(b)) with moments within the tetragonal basal plane. The total moment obtained is ($\mu_{Ce_1}+\mu_{Ce_2}) =0.85(2) \mu_B$. Consistent with the assignment of Ce1 with moment $\leq0.45 \mu_B$ to the ${\bf k}_2$ structure, the Rietveld refinement displayed in Fig.~\ref{diffraction_pattern}(c) indicates the Ce1 site contributes less than 0.1 $\mu_B$ to the ${\bf k}_1$ structure of Phase III.
In a field of 7 Tesla the magnetization per cerium site reaches a value of 0.6~$\mu_B$ corresponding to 2/3 of the low $T$ ordered moment on the Ce2 sites, which make up 2/3 of the cerium in $\rm Ce_3Cu_4As_4O_2$. This is consistent with the magnetization in 7 T of only the Ce2 sites that consist of FM layers leaving the Ce1 layers in the proposed in-plane ${\bf k}_2=(0.5,0,0)$ type AFM order. This hypothesis could be examined by higher field magnetization measurements.
\subsection{Electronic Structure}
Density functional calculations were done on Ce$_3$Cu$_4$As$_4$O$_2$ for three types of magnetic configurations. The first is the ferromagnetic (FM) state. The second is the AFM (0, 0, 1) periodicity, which corresponds to phase I in Fig. \ref{structure} and is referred to as AFM1. The third magnetic configuration is to model phase III in Fig. \ref{structure}, with the same magnetic moment arrangements for Ce2 sites as in the AFM1 state and (1/2, 0, 0) periodicity for Ce1 sites. This structure is referred to as AFM2. The magnetic unit cell for the AFM2 state is $2\times1\times1$ times the crystallographic unit cell.
Among all three magnetic configuration considered, AFM2 has the lowest energy. The relative energy for AFM2 state is E(AFM2) - E(FM) = - 127 meV/F.U., while the relative energy for AFM1 is E(AFM1) - E(FM) = 2 meV/F.U. The energy comparison directly supports AFM2 as the ground state, which is consistent with the neutron scattering result. For the AFM2 state, the magnetic moments on both Ce sites are between 0.96 $\sim$ 0.97 $\mu_B$, significantly larger than the experimentally observed values on Ce1 sites (0.45 $\mu_B$), but close to Ce2 sites (0.85 $\mu_B$). One possible reason for the reduced moment on Ce1 compared to DFT is that the Ce1 atoms and As2 atoms are both spatially and energetically close to each other, resulting in Kondo hybridization between them. Such Kondo hybridization can strongly reduce the sizes of magnetic moments \cite{weibao, kawarazaki}.
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{fixed_moment.pdf}
\caption{\label{fixed_moment} Energy versus magnetic moment from the fixed spin moment calculation for La$_3$Cu$_4$As$_4$O$_2$, the non-magnetic analogue of Ce$_3$Cu$_4$As$_4$O$_2$. Inset: M(H) isotherm for both Ce$_3$Cu$_4$As$_4$O$_2$ and La$_3$Cu$_4$As$_4$O$_2$. }
\end{figure}
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{DOS.pdf}
\caption{\label{DOS} The total and atom-projected DOS calculated for Ce$_3$Cu$_4$As$_4$O$_2$ in the AFM2 state. The spin down DOS is multiplied by -1. Inset is an enlarged view for DOS close to the Fermi level. }
\end{figure}
\begin{figure}[t!]
\includegraphics[width=0.8\columnwidth,clip]{band_structure.pdf}
\caption{\label{band_structure} The band structure calculated along an in-plane k-path for Ce$_3$Cu$_4$As$_4$O$_2$ in the AFM2 state, with only the spin up component shown.}
\end{figure}
\begin{figure}[t!]
\includegraphics[width=1.0\columnwidth,clip]{fermi_surface.pdf}
\caption{\label{fermi_surface} The Fermi surface for Ce$_3$Cu$_4$As$_4$O$_2$ in the AFM2 state(spin up component only).}
\end{figure}
To examine the magnetism on the Cu site, a fixed spin moment calculation was performed for La$_3$Cu$_4$As$_4$O$_2$ (Fig. \ref{fixed_moment}), the non-magnetic analogue of Ce$_3$Cu$_4$As$_4$O$_2$, with methods similar to those for the Ce compound. The energy of La$_3$Cu$_4$As$_4$O$_2$ increases monotonically with increasing spin moment, indicative of a paramagnetic ground state. This monotonic behavior implies that there is no tendency for the 3d electrons to become magnetic, which is consistent with the experimental observations\cite{jiakui}.
The density of states (DOS) for Ce$_3$Cu$_4$As$_4$O$_2$ in the AFM2 state is shown in Fig. \ref{DOS}. Unlike for Fe-pnictides case, the majority of the Cu bands lie in the energy interval close to the O bands, despite the fact that O has lower electronegativity than Cu. The increased energy of O bands might be due to their proximity to Ce atoms. At the Fermi level, Cu and As contribute most to the DOS. The non-zero DOS at the DFT Fermi level is indicative of a metal. The Ce1 atoms have a lower energy, and their bands are broader than for the Ce2 atoms.
The Cu 3d band is very broad, with a bandwidth of about 10 eV. Although centered around -3 eV, the tail of the 3d band is visible up to 5 eV, and the Fermi level just crosses this tail. This indicates a weakly correlated 3d band, consistent with a non-magnetic state for Cu.
The band structure for Ce$_3$Cu$_4$As$_4$O$_2$ in the AFM2 state is shown in Fig. \ref{band_structure}. A quasi-two-dimensional nature is apparent from the similarity of the bands along the in-plane $\Gamma$-X-S-$\Gamma$ path and Z-U-R-Z paths. As for the iron pnictides, most bands crossing the Fermi levels are anti-bonding \cite{singh} and associated with Cu or As. The flat band near -2.1 eV is from Ce1, while the less visible Ce2 band is centered around -1.0 eV.
The Fermi surface is shown in Fig. \ref{fermi_surface} plotted in the folded Brillouin zone corresponding to the orthorhombic magnetic unit cell which is $2\times1\times1$ times the tetragonal crystallographic unit cell. Extended along the c-axis with almost no corrugation, the Fermi surface indicates electron hopping is mainly confined to the tetragonal basal plane so that that the electronic state for Ce$_3$Cu$_4$As$_4$O$_2$ is very two dimensional. The pockets near the $\Gamma$ points are however more dispersive along c-axis than the pockets far away the $\Gamma$ points.
\begin{table*}
\setlength{\tabcolsep}{6pt}
\caption{Our working hypothesis for the magnetic structure in the three distinct phases of $\rm Ce_3Cu_4As_4O_2$: phase \textit{I} ( $16~{\rm K} < T <24$~K), and phase \textit{II} ( $ 2~{\rm K} < T < 16$~K ) and phase \textit{III} ($ T < 2$~K ). In the table, $\bf k_1$ = (0, 0, 1) and $\bf k_2$ = (1/2, 0, 0). One dimensional IR $\Gamma_2$ associated with $\bf k_2$ represents Basis Vectors as (100). The hypothesis is consistent with the experimental data but more specific than can be proven on their basis. }
\label{summary}
\begin{tabular}{|l|l|c|c|c|c|c| }
\hline
\multirow{2}{*}{ \textbf{Site} } & \multirow{2}{*}{ \textbf{Property} } & \multicolumn{2}{c|}{ \textbf{ Phase \textit{III} } } & \multicolumn{2}{c|}{ \textbf{ Phase \textit{II} } } & \textbf{ Phase \textit{I} }
\\ & & \multicolumn{2}{c|}{ $ T < 2$~K } & \multicolumn{2}{c|}{ $ 2~{\rm K} < T < 16$~K } & $16~{\rm K} < T <24$~K
\\\hline
\multirow{4}{*}{$\rm Ce1$ in $\rm CeCu_4As_4$ } & Propagation vector ($\bf k$) &$\bf k_1$ & $\bf k_2$ & $\bf k_1$ & $\bf k_2$ & $\bf k_1$ \\
& Classification (IR) & $\Gamma_9$ & $\Gamma_2$ & $\Gamma_3$ & $\Gamma_2$ & $\Gamma_3$ \\
& Spin orientation & \textbf{b} & \textbf{a} & \textbf{c} & \textbf{a} &\textbf{c} \\
& Moment size ($\mu_B$) & $< 0.1$ & $\leq0.45$ & 0.17(2) & $\leq$0.3 & 0.14(6) \\ \hline
\multirow{4}{*}{$\rm Ce2$ in $\rm Ce_2O_2$ } & Propagation vector ($\bf k$) & \multicolumn{2}{c|}{$\bf k_1$} & \multicolumn{2}{c|}{$\bf k_1$} & {$\bf k_1$ } \\
& Classification (IR) &\multicolumn{2}{c|}{ $\Gamma_9$ } & \multicolumn{2}{c|}{ $\Gamma_3$ } &{$\Gamma_3$} \\
& Spin orientation & \multicolumn{2}{c|}{ \textbf{b}} & \multicolumn{2}{c|}{ \textbf{c}} &{ \textbf{c}} \\
& Moment size ($\mu_B$) &\multicolumn{2}{c|}{0.85(1)} &\multicolumn{2}{c|}{0.22(3)} &{0.18(2)} \\ \hline
\end{tabular}
\end{table*}
\section{Discussion}
\label{discussion}
Having presented and analyzed comprehensive data for the magnetic and electronic properties of $\rm Cu_3Cu_4As_4O_2$ we now discuss the overall physical picture of this material. Table~\ref{summary} provides a summary of the spin structures proposed for the three magnetic phases. While the upper two transitions mark the development of distinct magnetic modulations with wave vectors ${\bf k}_1$ = (001) and ${\bf k}_2$ = (1/2, 0, 0) in the $\rm Ce_2O_2$ and the $\rm CeCu_4As_4$ layers respectively, the transition to phase III is a spin flop transition where the staggered magnetization already established for $\rm Ce_2O_2$ in phase I rotates into the basal plane. This last transition is by far the most prominent as observed by magnetic neutron scattering because it allows for diffraction at low $Q$ which is extinguished by the polarization factor in the higher temperature phases.
The lower transition to phase III might be understood as follows. If we allow for isotropic bilinear spin exchange interactions between different cerium sites then the effect of the $\rm Ce_2O_2$ layers on the $\rm CeCu_4As_4$ layers is analogous to a uniform magnetic field, which in phase II is oriented perpendicular to the staggered magnetization and perpendicular to the basal plane. Rotation of the $\rm Ce_2O_2$ magnetization into the basal plane can then be understood as the result of a competition between incompatible single ion and/or exchange anisotropy for the Ce1 and Ce2 sites. Having ordered antiferromagnetically with spins within the basal plane in phase II, $\rm CeCu_4As_4$ layers apparently have an easy plane character. Phase I on the other hand demonstrates an easy axis character to $\rm Ce_2O_2$ layers. The final spin flop transition might then be understood as the easy-plane character prevailing if $\rm Ce_2O_2$ spins rotate into the basal plane and perpendicular to ${\bf k}_2$. This is consistent with the diffraction data though the diffraction data do not establish the orientation of $\rm Ce_2O_2$ spins within the basal plane.
Comparison to $\rm Pr_3Cu_4As_4O_{2-\delta}$ is instructive. The strength of RKKY exchange interactions can be expected to vary between rare earth ions in accordance with the so-called de Gennes factor $F=(g-1)^2J(J+1))$, which is 0.18 for cerium and 0.8 for praseodymium for a ratio of $F({\rm Pr})/F({\rm Ce})=4.4$. While the ordered spin structures for $\rm Pr_3Cu_4As_4O_{2-\delta}$ are as yet unknown, there are two phase transitions at $T_{N}=35(3)$~K and $T_{2}=22$~K \cite{jiakui}. The enhancement of $T_N$ is not nearly as large as might be expected based on de Gennes scaling but the similar ratio for $T_{2}/T_{N}$ of approximately 1.5 for Ce and 1.6 for Pr is consistent with an analogy between phases I and II of the two compounds. The absence of a third transition for the praseodymium compound is consistent with $T_{3}$ for $\rm Ce_3Cu_4As_4O_{2}$ being contingent on competing anisotropies that might be absent for $\rm Pr_3Cu_4As_4O_{2-\delta}$.
Replacing Ni for Cu in $\rm CeNi_4As_4O_{2-\delta}$ results in just a single peak in the specific heat at $T_{N}=1.7$~K\cite{jiakui}. The change in entropy up to 40~K, the effective moment, and the Weiss temperature are however, similar to $\rm CeCu_4As_4O_2$, which indicates the cerium moment persists with similar interaction strengths. Increased magnetic frustration and quenched chemical or structural disorder are potentially relevant factors to account for the suppression relative to $\rm Ce_3Cu_4As_4O_{2}$ of the higher temperature transitions. Here we note that the rare earth layers are separated by transition metal ions so that all inter-layer interactions must proceed through the copper or nickel layer. The dramatic effect of changing these layers from copper to nickel thus might indicate the upper transitions are driven by interlayer interactions.
A curious feature of $\rm Ce_3Cu_4As_4O_{2}$ are the broad nature of the specific anomalies. The diffraction experiments presented here reveal magnetic order above the 75 $\AA$ length scale but in harmony with the specific heat data, the corresponding staggered magnetization emerges gradually upon cooling and without a critical onset (Fig.~\ref{Neutron2} and Fig.~\ref{Neutron4}). These specific heat and scattering data consistently point to cross-over phenomena rather than actual phase transitions and thus an absence of true symmetry breaking. Potentially relevant features that could lead to this unusual situation are (1) disorder, particularly for the weak interactions between layers (2) frustration (3) the interplay of alternating layers of spins with distinct quasi-2D Ising transitions and (4) Kondo screening. To distinguish between these scenarios and achieve a deeper understanding of the unusual sequence of transitions in $\rm Ce_3Cu_4As_4O_{2}$ will require single crystalline samples from which more specific information can be obtained via magnetic neutron diffraction.
\section{Conclusions}
\label{conclusion}
In conclusion, field dependent physical properties and neutron scattering measurements as well as band structure calculations were carried out on the layered transition metal pnictide compound $\rm Ce_3Cu_4As_4O_{2}$. All investigations point to a quasi-two-dimensional electronic state and modulated complex magnetic structure. The crystal structure resembles an interleaving 122 and 1111 Fe pnictide structures, resulting in two rare earth sites with very different local environments, which in turn lead to the complex magnetic structure. The neutron scattering measurements reveal three successive transitions, consistent with the magnetization and specific heat measurements. For the first transition at T$_{N}$ = 24 K, neutron scattering indicates alternative FM layers with spins oriented along c. Below the second transition T$_{2}$ = 16 K neutron scattering reveals the loss of spin fluctuations which we can account for by in-plane AFM ordering of Ce1 site. The third transition $T_{3}$ = 1.9 K appears to be a spin-flop transition where all the magnetic moment directions switch to in-plane polarization. Band structure calculation confirm the AFM2 state, which models the magnetic phase below $T_{3}$. A notably large negative magneto-resistance ($\approx$-30 $\%$) around $T_{3}$ is observed up to H = 9 T, implying significant impact for magnetic fluctuations on the transport behavior. Under high magnetic field H $>$ 3 T, the temperature dependence for both resistivity and heat capacity violate Fermi liquid behavior. This is possibly due to the anisotropic quasi-two-dimensional nature of the electronic state as indicated by neutron data and the band structure calculations.
\section{Acknowledgements}
The work at Rice University was supported by AFOSR MURI. Work at IQM was supported by the US Department of Energy, office of Basic Energy Sciences, Division of Material Sciences and Engineering under grant DE-FG02-08ER46544. This work utilized facilities supported in part by the National Science Foundation under Agreement No. DMR-0944772. The authors thank Andriy Nevidomskyy, Meigan Aronson and Liang Zhao for useful discussions.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 9,969 |
The funniest, most awkward small talk ensues (mostly thanks to Annie), which then leads to her offering Alvy a ride up town and a glass of wine on her balcony. This isn't the first scene she appears in: we've already seen her in two previous sequences. But it is the moment we are truly introduced to Annie Hall.
That clumsy attempt to have a casual yet smart conversation and that girl-dressed- as-boy look that on Keaton was so impossibly feminine and cool were what sealed the fascination with Annie Hall and with the Annie Hall style. People had a love affair with Annie Hall in 1977. Everyone watching or re-watching the film today might still do.
Annie Hall set the stylistic template for what many people would mean by "a Woody Allen film": the long takes; the shots of people walking on a sidewalk taken from a camera running parallel on the opposite side of the street; the breaking of the fourth wall; the sight, or rather the sound, of two people talking off screen, a technique developed by cinematographer Gordon Willis and which Allen would continue to use in all his films in honour of Willis.
Annie Hall was the starting point of Willis and Allen's collaboration (they would make seven more films together, including Interiors and Manhattan) and the director accounts their their teaming-up as the first step toward maturity in some way in making films, towards more realistic and deeper movies. But the film belongs to Keaton. "She is all over the film the way Anna Karina is in Vivre sa vie, or Jeanne Moreau is in Jules et Jim – like a fragrance", says Tohone in the book Woody Allen: A Retrospective.
I couldn't agree more – and if I think about the costumes, Shone's words make even more sense. The approach very much reminds me of the French New Wave films, which, among all the other cinema conventions they played with, were "the chance of a lifetime to escape the 'star' style," as Jeanne Moreau described her experience on Jules et Jim.
Therein lies Annie Hall's charm. That's Diane Keaton. That's her personality. Her way of talking, dressing, ordering food. "She's like all very smart people; extremely modest, extremely self-effacing. She's got that quality," Allen would say about Keaton. And he let her play herself and captured her persona, her flavour, that rare quality. When the camera hits Keaton, that's what you want to see. Here was something new: a modern woman, carving out a new identity, insecure, but brainy and self-conscious, a little neurotic and clumsy but endlessly funny, free and original. | {
"redpajama_set_name": "RedPajamaC4"
} | 6,475 |
# Contents
1. Introduction
2. Assessment Test
3. Chapter 1: Install Windows Server 2012 R2
1. Features and Advantages of Windows Server 2012 and Server 2012 R2
2. Planning the Windows Server 2012 R2 Installation
3. Understanding Features On Demand
4. Storage in Windows Server 2012 R2
5. Summary
6. Exam Essentials
7. Review Questions
4. Chapter 2: Configure Network Services
1. Introducing DNS
2. Introducing DNS Database Zones
3. Advantages of DNS in Windows Server 2012 R2
4. Introducing DNS Record Types
5. Configuring DNS
6. Monitoring and Troubleshooting DNS
7. Overview of DHCP
8. Installing and Authorizing DHCP
9. Creating and Managing DHCP Scopes
10. Summary
11. Exam Essentials
12. Review Questions
5. Chapter 3: Plan and Install Active Directory
1. Verifying the File system
2. Verifying Network Connectivity
3. Understanding Domain and Forest Functionality
4. Planning the Domain Structure
5. Installing Active Directory
6. Verifying Active Directory Installation
7. Creating and Configuring Application Data Partitions
8. Configuring DNS Integration with Active Directory
9. Summary
10. Exam Essentials
11. Review Questions
6. Chapter 4: Configure Windows Server 2012 R2
1. Understanding File Servers
2. Configuring File Servers
3. Configuring Disk Quotas
4. Configuring Print Services
5. Configuring Remote Management
6. Summary
7. Exam Essentials
8. Review Questions
7. Chapter 5: Administer Active Directory
1. An Overview of OUs
2. Planning the OU Structure
3. Creating OUs
4. Managing OUs
5. Troubleshooting OUs
6. Creating and Managing Active Directory Objects
7. Publishing Active Directory Objects
8. Using the Command Prompt for Active Directory Configuration
9. Summary
10. Exam Essentials
11. Review Questions
8. Chapter 6: Manage GPOs
1. Introducing Group Policy
2. Planning a Group Policy Strategy
3. Implementing Group Policy
4. Managing Group Policy
5. Deploying Software Through a GPO
6. Implementing Software Deployment
7. Configuring Software Deployment Settings
8. Troubleshooting Group Policies
9. Summary
10. Exam Essentials
11. Review Questions
9. Chapter 7: Manage Security
1. Managing Security
2. Implementing an Audit Policy
3. Configuring Windows Firewall Options
4. Summary
5. Exam Essentials
6. Review Questions
10. Chapter 8: Configure TCP/IP
1. Understanding TCP/IP
2. Understanding IP Addressing
3. Subnetting a Network
4. Understanding IPv6
5. Summary
6. Exam Essentials
7. Review Questions
11. Chapter 9: Use Virtualization in Windows Server 2012
1. Hyper-V Overview
2. Hyper-V Installation and Configuration
3. Configuring Virtual Machines
4. Summary
5. Exam Essentials
6. Review Questions
12. Appendix A: Answers to Review Questions
13. Appendix B: About the Additional Study Tools483
14. Free Interactive Online Study Environment
15. End User License Agreement
## List of Illustrations
1. FIGURE 1.1 Available roles in Windows Server 2012 R2
2. FIGURE 1.2 Windows key on a standard keyboard
3. FIGURE 1.3 Select Disks page of the New Mirrored Volume Wizard
4. FIGURE 1.4 Adding the second disk to complete a mirrored volume set
5. FIGURE 1.5 Newly created mirrored volume set
6. FIGURE 1.6 Newly created RAID-5 volume set
7. FIGURE 1.7 The DSM Install tab in the MPIO Properties dialog box
8. FIGURE 1.8 `DiskPart` commands
9. FIGURE 2.1 HOSTS file
10. FIGURE 2.2 The DNS hierarchy
11. FIGURE 2.3 Setting the Dynamic Updates option
12. FIGURE 2.4 DHCP settings for DNS
13. FIGURE 2.5 A sample DNS query
14. FIGURE 2.6 Setting up an Active Directory Integrated zone
15. FIGURE 2.7 DNS stub zone type
16. FIGURE 2.8 DNS Notify dialog box
17. FIGURE 2.9 DNS Zone Transfers tab
18. FIGURE 2.10 DNS zone replication scope
19. FIGURE 2.11 The Root Hints tab of the DNS server's Properties dialog box
20. FIGURE 2.12 The Start Of Authority (SOA) tab of the zone Properties dialog box
21. FIGURE 2.13 The Name Servers tab of the zone Properties dialog box
22. FIGURE 2.14 The Event Logging tab of the server's Properties dialog box
23. FIGURE 2.15 The Monitoring tab of the server's Properties dialog box
24. FIGURE 2.16 Enabling BIND secondaries
25. FIGURE 2.17 DHCP snap-in
26. FIGURE 2.18 Welcome page of the New Scope Wizard
27. FIGURE 2.19 IP Address Range page of the New Scope Wizard
28. FIGURE 2.20 Add Exclusions And Delay page of the New Scope Wizard
29. FIGURE 2.21 Lease Duration page of the New Scope Wizard
30. FIGURE 2.22 Configure DHCP Options page of the New Scope Wizard
31. FIGURE 2.23 Router (Default Gateway) page of the New Scope Wizard
32. FIGURE 2.24 Domain Name And DNS Servers page of the New Scope Wizard
33. FIGURE 2.25 WINS Servers page of the New Scope Wizard
34. FIGURE 2.26 Activate Scope page of the New Scope Wizard
35. FIGURE 2.27 IPv6 Scope Name page of the New Scope Wizard
36. FIGURE 2.28 Scope Prefix page of the New Scope Wizard
37. FIGURE 2.29 Add Exclusions page of the New Scope Wizard
38. FIGURE 2.30 Scope Lease page of the New Scope Wizard
39. FIGURE 2.31 Completing The New Scope Wizard page of the New Scope Wizard
40. FIGURE 2.32 General tab of the scope's Properties dialog box for an IPv4 scope
41. FIGURE 2.33 General tab of the IPv4 Properties dialog box for the server
42. FIGURE 2.34 The Advanced tab of the IPv4 Properties dialog box for the server
43. FIGURE 2.35 The Network Access Protection tab of the IPv4 Properties dialog box for the server
44. FIGURE 2.36 Server's IPv6 Properties, General tab
45. FIGURE 2.37 Server's IPv6 Properties, Advanced tab
46. FIGURE 2.38 Add Exclusion dialog boxes for IPv4 and IPv6
47. FIGURE 2.39 New Reservation dialog boxes for IPv4 and IPv6
48. FIGURE 2.40 The Scope Options dialog box
49. FIGURE 2.41 General tab of the Multicast Scope Properties dialog box
50. FIGURE 2.42 Lifetime tab of the Multicast Scope Properties dialog box
51. FIGURE 2.43 DNS tab of the scope's IPv4 Properties dialog box
52. FIGURE 3.1 Format options on Windows Server 2012 R2
53. FIGURE 3.2 Viewing TCP/IP information with the `**ipconfig**` utility
54. FIGURE 3.3 Viewing Active Directory information using the Active Directory Users and Computers tool
55. FIGURE 3.4 Using the LDP tool to view Active Directory schema information
56. FIGURE 3.5 Viewing naming contexts on the local domain controller
57. FIGURE 4.1 Synchronization options in a GPO
58. FIGURE 4.2 Setting up compression on a folder
59. FIGURE 4.3 Setting up encryption on a folder
60. FIGURE 4.4 Security settings on the `Stellacon Documents` folder
61. FIGURE 4.5 Individual permissions
62. FIGURE 4.6 Setting up permissions on a shared folder
63. FIGURE 4.7 NTFS security and shared permissions example
64. FIGURE 4.8 NTFS security and shared permissions
65. FIGURE 4.9 The General tab of the printer's Properties dialog box
66. FIGURE 4.10 The Sharing tab of the printer's Properties dialog box
67. FIGURE 4.11 The Ports tab of the printer's Properties dialog box
68. FIGURE 4.12 Advanced tab of the printer's Properties dialog box
69. FIGURE 4.13 Security tab of the printer's Properties dialog box
70. FIGURE 4.14 `Netsh` `advfirewall` options
71. FIGURE 5.1 Relationships of users, groups, and OUs
72. FIGURE 5.2 Mapping a business organization to an OU structure
73. FIGURE 5.3 A geographically based OU structure
74. FIGURE 5.4 The General tab of the OU's Properties dialog box
75. FIGURE 5.5 The Managed By tab of the OU's Properties dialog box
76. FIGURE 5.6 The Filter Options dialog box
77. FIGURE 5.7 Advanced Features in the `System` folder of the Active Directory Users and Computers tool
78. FIGURE 5.8 Active Directory Administrative Center
79. FIGURE 5.9 Administrative Center Overview screen
80. FIGURE 6.1 Group Policy configuration options
81. FIGURE 6.2 Viewing GPO links to an Active Directory OU
82. FIGURE 6.3 A GPO's Security Settings dialog box
83. FIGURE 6.4 Blocking GPO inheritance
84. FIGURE 6.5 Setting the Enforced GPO option
85. FIGURE 6.6 Viewing Startup/Shutdown script policy settings
86. FIGURE 6.7 Setting scripting options
87. FIGURE 6.8 Viewing Group Policy User network configuration options
88. FIGURE 6.9 Viewing the properties of an MSI package file
89. FIGURE 6.10 Deployment tab of the Software Installation Properties dialog box
90. FIGURE 6.11 Advanced Deployment dialog box
91. FIGURE 6.12 The Categories tab of the Software Installation Properties dialog box
92. FIGURE 6.13 Removing a software package
93. FIGURE 6.14 Software removal options
94. FIGURE 6.15 GPO settings for Windows Installer
95. FIGURE 6.16 The Computer Selection page of the Group Policy Results Wizard
96. FIGURE 6.17 The User Selection page of the Group Policy Results Wizard
97. FIGURE 6.18 The Summary Of Selections page of the Group Policy Results Wizard
98. FIGURE 6.19 The User Selection page for the administrator on computer SERVER1
99. FIGURE 6.20 Details of event pertaining to the administrator account on computer SERVER1
100. FIGURE 6.21 The Details tab of the object's Properties window
101. FIGURE 7.1 The New Object – Group dialog box
102. FIGURE 7.2 The Sales Security Group's Properties dialog box
103. FIGURE 7.3 Default built-in local groups
104. FIGURE 7.4 Contents of the default `Users` folder
105. FIGURE 7.5 The `ForeignSecurityPrincipals` folder
106. FIGURE 7.6 An overview of security management
107. FIGURE 7.7 The ACL for an OU named Sales
108. FIGURE 7.8 Domain Profile tab of Windows Firewall Settings
109. FIGURE 7.9 Private Profile tab of Windows Firewall Settings
110. FIGURE 7.10 Public Profile tab of Windows Firewall
111. FIGURE 7.11 IPsec Settings tab of Windows Firewall Settings
112. FIGURE 7.12 Windows Firewall with Advanced Security snap-in
113. FIGURE 7.13 Inbound rules
114. FIGURE 7.14 An inbound rule's Properties dialog box for WSUS
115. FIGURE 8.1 TCP/IP model
116. FIGURE 8.2 TCP/IP process
117. FIGURE 8.3 A sample subnet
118. FIGURE 8.4 Network vs. host addresses
119. FIGURE 8.5 The network address and its subnet
120. FIGURE 8.6 The subnet mask revealed
121. FIGURE 8.7 Different ways to represent the same mask
122. FIGURE 8.8 Applying the subnet mask
123. FIGURE 8.9 Converting the subnet mask to decimal
124. FIGURE 8.10 An example of a smaller subnet address
125. FIGURE 8.11 TCP/IP v4 subnetting chart
126. FIGURE 8.12 Subnet mask represented by 1s
127. FIGURE 8.13 IPv4/IPv6 comparison
128. FIGURE 8.14 TCP/IPv6 Properties window
129. FIGURE 8.15 IPv6 configuration as seen from the command prompt
130. FIGURE 8.16 IPv6 dual IP layer diagram
131. FIGURE 8.17 IPv6 interface identifier for `ipconfig` display
132. FIGURE 9.1 Hyper-V architecture
133. FIGURE 9.2 Warning window that Hyper-V cannot be installed
134. FIGURE 9.3 Hyper-V in Server Manager
135. FIGURE 9.4 Hyper-V Manager
136. FIGURE 9.5 Hyper-V Settings
137. FIGURE 9.6 Virtual Network Manager
138. FIGURE 9.7 Virtual network card
139. FIGURE 9.8 In Disk Management, you can set disks as Offline.
140. FIGURE 9.9 The Edit Virtual Hard Disk Wizard
141. FIGURE 9.10 Options available when right-clicking a virtual machine
142. FIGURE 9.11 Delete Virtual Machine warning window
143. FIGURE 9.12 Virtual Machine Connection window when the machine is turned off
144. FIGURE 9.13 Virtual Machine Connection window showing a running Windows Server 2012 virtual machine
## List of Tables
1. TABLE 1.1 Roles and Features Updates
2. TABLE 1.2 Supported Windows Server 2012 R2 upgrade path recommendations
3. TABLE 1.3 `WDSUTIL` command-line options
4. TABLE 1.4 Supported RAID-level properties in Windows Server 2012 R2
5. TABLE 2.1 Common top-level DNS domains
6. TABLE 2.2 The SOA record structure
7. TABLE 2.3 The NS record structure
8. TABLE 2.4 The SRV record structure
9. TABLE 2.5 Command-line options available with the `set` command
10. TABLE 2.6 Common `nslookup` error messages
11. TABLE 2.7 `DNSLint` command options
12. TABLE 2.8 Command-line options available for the `ipconfig` command
13. TABLE 2.9 `DNSCmd` command-line options
14. TABLE 3.1 Comparing domain functional levels
15. TABLE 3.2 Active Directory requirements
16. TABLE 3.3 `ntdsutil` domain management commands
17. TABLE 4.1 `Vssadmin.exe` commands
18. TABLE 4.2 NTFS security vs. shared permissions
19. TABLE 4.3 WinRM commands and descriptions
20. TABLE 4.4 Windows PowerShell cmdlets
21. TABLE 5.1 Command prompt commands
22. TABLE 6.1 `Auditpol.exe` switches
23. TABLE 6.2 `gpresult` switches
24. TABLE 7.1 Permissions of Active Directory objects
25. TABLE 7.2 Group Policy settings used for security purposes
26. TABLE 7.3 Auditpol commands
27. TABLE 8.1 Common port numbers
28. TABLE 8.2 Network address classes
29. TABLE 8.3 Special network addresses
30. TABLE 8.4 Default subnet masks
31. TABLE 8.5 Setting up Class C subnets
32. TABLE 8.6 Fourth octet addresses for a Class C network with eight subnets
33. TABLE 8.7 IPv6 address space known prefixes and addresses
34. TABLE 8.8 Powers of 2
35. TABLE 9.1 Hyper-V guest server operating systems
36. TABLE 9.2 Hyper-V guest client operating systems
37. TABLE 9.3 Hardware requirements for Hyper-V
38. TABLE 9.4 Virtual hard disks in Hyper-V
39. TABLE 9.5 Edit Disk overview
## List of Exercises
1. Exercise 1.1 Installing Windows Server 2012 R2 with the GUI
2. Exercise 1.2 Installing Windows Server 2012 R2 Using Server Core
3. Exercise 1.3 Initializing Disk Drives
4. Exercise 1.4 Converting a Basic Disk to a Dynamic Disk
5. Exercise 1.5 Creating a Volume Set
6. Exercise 1.6 Creating Mount Points
7. Exercise 1.7 Installing Microsoft MPIO
8. Exercise 1.8 Configuring iSCSI Storage Connection
9. Exercise 1.9 Installing the iSNS Feature on Windows Server 2012 R2
10. Exercise 2.1 Installing and Configuring the DNS Service
11. Exercise 2.2 Configuring a Zone for Dynamic Updates
12. Exercise 2.3 Creating a Delegated DNS Zone
13. Exercise 2.4 Manually Creating DNS RRs
14. Exercise 2.5 Simple DNS Testing
15. Exercise 2.6 Using the **`nslookup`** Command
16. Exercise 2.7 Installing the DHCP Service
17. Exercise 2.8 Unauthorizing a DHCP Server
18. Exercise 2.9 Authorizing a DHCP Server
19. Exercise 2.10 Creating a New Scope
20. Exercise 2.11 Configuring User Class Options
21. Exercise 2.12 Creating a Superscope
22. Exercise 2.13 Creating a New Multicast Scope
23. Exercise 2.14 Enabling DHCP-DNS Integration
24. Exercise 3.1 Viewing Disk Configuration
25. Exercise 3.2 Promoting a Domain Controller
26. Exercise 3.3 Installing AD DS on Server Core
27. Exercise 3.4 Viewing the Active Directory Event Log
28. Exercise 3.5 Joining a Computer to an Active Directory Domain
29. Exercise 3.6 Configuring DNS Integration with Active Directory
30. Exercise 4.1 Creating and Publishing a Shared Work Folder
31. Exercise 4.2 Configuring Offline Folder Options
32. Exercise 4.3 Configuring a Shared Network Folder for Offline Access
33. Exercise 4.4 Configuring a Shadow Copy on a Volume
34. Exercise 4.5 Configuring Shared and NTFS Settings
35. Exercise 4.6 Configuring Disk Quotas
36. Exercise 4.7 Creating and Publishing a Printer
37. Exercise 4.8 Starting the Windows PowerShell Utility
38. Exercise 5.1 Creating an OU Structure
39. Exercise 5.2 Modifying OU Structure
40. Exercise 5.3 Using the Delegation of Control Wizard
41. Exercise 5.4 Delegating Custom Tasks
42. Exercise 5.5 Creating Active Directory Objects
43. Exercise 5.6 Creating a User Template
44. Exercise 5.7 Managing Object Properties
45. Exercise 5.8 Moving Active Directory Objects
46. Exercise 5.9 Resetting an Existing Computer Account
47. Exercise 5.10 Creating and Publishing a Printer
48. Exercise 5.11 Creating and Publishing a Shared Folder
49. Exercise 5.12 Finding Objects in Active Directory
50. Exercise 6.1 Creating a Group Policy Object Using the GPMC
51. Exercise 6.2 Linking Existing GPOs to Active Directory
52. Exercise 6.3 Filtering Group Policy Using Security Groups
53. Exercise 6.4 Delegating Administrative Control of Group Policy
54. Exercise 6.5 Configuring Automatic Certificate Enrollment in Group Policy
55. Exercise 6.6 Configuring Folder Redirection in Group Policy
56. Exercise 6.7 Creating a Software Deployment Share
57. Exercise 6.8 Publishing and Assigning Applications Using Group Policy
58. Exercise 6.9 Applying Software Updates
59. Exercise 7.1 Delegating Control of Active Directory Objects
60. Exercise 7.2 Enabling Auditing of Active Directory Objects
61. Exercise 7.3 Configuring Windows Firewall
62. Exercise 8.1 Class C, 10 Hosts per Subnet
63. Exercise 8.2 Class C, 20 Hosts per Subnet
64. Exercise 8.3 Class C, Five Subnets
65. Exercise 8.4 Class B, 1,500 Hosts per Subnet
66. Exercise 8.5 Class B, 3,500 Hosts per Subnet
67. Exercise 9.1 Installing Hyper-V in Full Installation Mode
68. Exercise 9.2 Creating an Internal Virtual Network
69. Exercise 9.3 Creating a Differencing Hard Disk
70. Exercise 9.4 Creating a New Virtual Machine
71. Exercise 9.5 Installing Hyper-V Integration Components
## Pages
1. iii
2. iv
3. v
4. vi
5. vii
6. viii
7. ix
8. x
9. xxiii
10. xxiv
11. xxv
12. xxvi
13. xxvii
14. xxviii
15. xxix
16. xxx
17. xxxi
18. xxxii
19. xxxiii
20. xxxiv
21. xxxv
22. xxxvi
23. xxxvii
24. xxxviii
25. xxxix
26. xl
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
459.
460.
461.
462.
463.
464.
465.
466.
467.
468.
469.
470.
471.
472.
473.
474.
475.
476.
477.
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
494.
495.
496.
497.
498.
499.
500.
501.
502.
503.
504.
505.
506.
507.
508.
509.
510.
511.
512.
513.
## Guide
1. Cover
2. Table of Contents
3. Begin Reading
# MCSA: Windows Server® 2012 R2
## Installation and Configuration Study Guide
William Panek
Senior Acquisitions Editor: Jeff Kellum
Development Editor: Gary Schwartz
Technical Editors: Rodney Fournier and Michael Rice
Production Editor: Eric Charbonneau
Copy Editor: Kim Wimpsett
Editorial Manager: Pete Gaughan
Production Manager: Kathleen Wisor
Professional Technology and Strategy Director: Barry Pruett
Associate Publisher: Jim Minatel
Media Project Manager 1: Laura Moss-Hollister
Media Associate Producer: Marilyn Hummel
Media Quality Assurance: Josh Frank
Book Designer: Judy Fung
Proofreader: Josh Chase, Word One New York
Indexer: Ted Laux
Project Coordinator, Cover: Patrick Redmond
Cover Designer: Wiley
Copyright © 2015 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-87020-4
ISBN: 978-1-118-85968-1 (ebk.)
ISBN: 978-1-118-91687-2 (ebk.)
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at <http://booksupport.wiley.com>. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: XXXXXXXXXX
TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Windows Server is a registered trademark of Microsoft Corporation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
_This book is dedicated to the three ladies of my life: Crystal, Alexandria, and Paige._
# Acknowledgments
I would like to thank my wife and best friend, Crystal. She is always the light at the end of my tunnel. I want to thank my two daughters, Alexandria and Paige, for all of their love and support during the writing of all my books. They make it all worthwhile.
I want to thank my family, and especially my brothers, Rick, Gary, and Rob. They have always been there for me. I want to thank my father, Richard, who helped me become the man I am today, and my mother, Maggie, for all of her love and support.
I would like to thank all of my friends and co-workers, especially Vic, Catherine, Jeff, Stephanie, Don, Jason, Doug, Dave, Steve, Pat, Mike (all of them), Tommy, George, Greg, Becca, Deb, Jeri, Lisa, Scotty, and all of the field guys. I want to also thank my team and everyone who works with my group including Moe, Jimmy, Paul, Dana, Dean, Reanna, Todd, and Will F. Because of all your hard work, you make me look good every day and make it a pleasure to go to work. Thanks to all of you for everything you do.
I want to thank everyone on my Sybex team, especially my development editor, Gary Schwartz, who helped me make this the best book possible, and Rodney R. Fournier, who is the technical editor of many of my books. It's always good to have the very best technical guy backing you up.
I want to thank Eric Charbonneau, who was my production editor, and my acquisitions editor, Jeff Kellum, who served as lead for the entire book. He has always been there for me, and it is always great to write for him.
Finally, I want to thank everyone else behind the scenes that helped make this book possible. It's truly an amazing thing to have so many people work on my books to help make them the very best. I can't thank you all enough for your hard work.
# About the Authors
**William Panek** holds the following certifications: MCP, MCP+I, MCSA, MCSA+ Security and Messaging, MCSE-NT (3.51 and 4.0), MCSE 2000 and 2003, MCSE+Security and Messaging, MCDBA, MCT, MCTS, MCITP, CCNA, and CHFI. Will is also a Microsoft MVP.
After many successful years in the computer industry and a degree in computer programming, Will decided that he could better use his talents and his personality as an instructor. He began teaching for schools such as Boston University, Clark University, and the University of Maryland, just to name a few. He has done consulting and training work for some of the biggest government and corporate companies in the world including the U.S. Secret Service, Cisco, the U.S. Air Force, and the U.S. Army.
In January 2015, Will is now teaching for StormWind (www.stormwind.com). He currently lives in New Hampshire with his wife and two daughters. Will was also a representative in the New Hampshire House of Representatives from 2010 to 2012. In his spare time, he likes to golf, ski, shoot, and go snowmobiling. Will is also a commercially rated helicopter pilot.
# Introduction
This book is drawn from more than 20 years of IT experience. I have taken that experience and translated it into a Windows Server 2012 R2 book that will help you not only prepare for the MCSA: Windows Server 2012 R2 exams but also develop a clear understanding of how to install and configure Windows Server 2012 R2 while avoiding all of the possible configuration pitfalls.
Many Microsoft books just explain the Windows operating system, but with _MCSA: Windows Server 2012 R2 Complete Study Guide_ , I go a step further by providing many in-depth, step-by-step procedures to support my explanations of how the operating system performs at its best.
Microsoft Windows Server 2012 R2 is the newest version of Microsoft's server operating system software. Microsoft has taken the best of Windows Server 2003, Windows Server 2008, and Windows Server 2012 and combined them into the latest creation, Windows Server 2012 R2.
Windows Server 2012 R2 eliminates many of the problems that plagued the previous versions of Windows Server, and it includes a much faster boot time and shutdown. It is also easier to install and configure, and it barely stops to ask the user any questions during installation. In this book, I will show you what features are installed during the automated installation and where you can make changes if you need to be more in charge of your operating system and its features.
This book takes you through all the ins and outs of Windows Server 2012 R2, including installation, configuration, Group Policy objects, auditing, backups, and so much more.
Windows Server 2012 R2 has improved on Microsoft's desktop environment, made networking easier, enhanced searching capability, and improved performance—and that's only scratching the surface.
When all is said and done, this is a technical book for IT professionals who want to take Windows Server 2012 R2 to the next step and get certified. With this book, you will not only learn Windows Server 2012 R2 and ideally pass the exams, but you will also become a Windows Server 2012 R2 expert.
## The Microsoft Certification Program
Since the inception of its certification program, Microsoft has certified more than 2 million people. As the computer network industry continues to increase in both size and complexity, this number is sure to grow—and the need for proven ability will also increase. Certifications can help companies verify the skills of prospective employees and contractors.
The Microsoft certification tracks for Windows Server 2012 R2 include the following:
MCSA: Windows Server 2012 R2 The MCSA is now the lowest-level certification you can achieve with Microsoft in relation to Windows Server 2012 R2. It requires passing three exams: 70-410, 70-411, and 70-412. Or, if you qualify, you can take an Upgrading exam: Exam 70-417. This book assists in your preparation for all four exams.
MCSE: Server Infrastructure or MCSE: Desktop Infrastructure The MCSE certifications, in relation to Windows Server 2012 R2, require that you become an MCSA first and then pass two additional exams. The additional exams will vary depending on which of the two MCSE tracks you choose. For more information, visit Microsoft's website at www.microsoft.com/learning.
MCSM: Directory Services The MCSM certification takes things to an entirely new level. It requires passing a knowledge exam (in addition to having the MCSE in Windows Server 2012 R2) and a lab exam. This is now the elite-level certification in Windows Server 2012 R2.
### How Do You Become Certified on Windows Server 2012 R2?
Attaining Microsoft certification has always been a challenge. In the past, students have been able to acquire detailed exam information—even most of the exam questions—from online "brain dumps" and third-party "cram" books or software products. For the new generation of exams, this is simply not the case.
Microsoft has taken strong steps to protect the security and integrity of its new certification tracks. Now prospective candidates must complete a course of study that develops detailed knowledge about a wide range of topics. It supplies them with the true skills needed, derived from working with the technology being tested.
The new generations of Microsoft certification programs are heavily weighted toward hands-on skills and experience. It is recommended that candidates have troubleshooting skills acquired through hands-on experience and working knowledge.
Fortunately, if you are willing to dedicate the time and effort to learn Windows Server 2012 R2, you can prepare yourself well for the exam by using the proper tools. By working through this book, you can successfully meet the requirements to pass the Windows Server 2012 R2 exams.
### MCSA Exam Requirements
Candidates for MCSA certification on Windows Server 2012 R2 must pass at least the following three Windows Server 2012 R2 exams:
* 70-410: Installing and Configuring Windows Server 2012 R2
* 70-411: Administering Windows Server 2012 R2
* 70-412: Configuring Advanced Windows Server 2012 R2 Services
* * *
For those who have a qualifying certification, they can take the Upgrading Your Skills to MCSA Windows Server 2012 R2 exam (Exam 70-417). The objectives for this exam span the three individual exams. This book covers all of the objectives for the Upgrading exam. For details about the exam, visit Microsoft's website at www.microsoft.com/learning.
* * *
Microsoft provides exam objectives to give you a general overview of possible areas of coverage on the Microsoft exams. Keep in mind, however, that exam objectives are subject to change at any time without prior notice and at Microsoft's sole discretion. Visit the Microsoft Learning website (www.microsoft.com/learning) for the most current listing of exam objectives. The published objectives and how they map to this book are listed later in this introduction.
* * *
For a more detailed description of the Microsoft certification programs, including a list of all the exams, visit the Microsoft Learning website at: www.microsoft.com/learning.
* * *
### Tips for Taking the Windows Server 2012 R2 Exams
Here are some general tips for achieving success on your certification exam:
* Arrive early at the exam center so that you can relax and review your study materials. During this final review, you can look over tables and lists of exam-related information.
* Read the questions carefully. Do not be tempted to jump to an early conclusion. Make sure you know exactly what the question is asking.
* Answer all questions. If you are unsure about a question, mark it for review and come back to it at a later time.
* On simulations, do not change settings that are not directly related to the question. Also, assume the default settings if the question does not specify or imply which settings are used.
* For questions about which you're unsure, use a process of elimination to get rid of the obviously incorrect answers first. This improves your odds of selecting the correct answer when you need to make an educated guess.
#### Exam Registration
At the time this book was released, Microsoft exams are given using Prometric testing centers (800-755-EXAM (800-755-3926)). As of December 31, 2014, Microsoft will be ending its relationship with Prometric, and all exams will be delivered through the more than 1,000 Authorized VUE Testing Centers around the world. For the location of a testing center near you, go to VUE's website at www.vue.com. If you are outside of the United States and Canada, contact your local VUE registration center.
Find out the number of the exam that you want to take and then register with the Prometric registration center nearest to you. At this point, you will be asked for advance payment for the exam. The exams are $125 each, and you must take them within one year of payment. You can schedule exams up to six weeks in advance or as late as one working day prior to the date of the exam. You can cancel or reschedule your exam if you contact the center at least two working days prior to the exam. Same-day registration is available in some locations, subject to space availability. Where same-day registration is available, you must register a minimum of two hours before test time.
When you schedule the exam, you will be provided with instructions regarding appointment and cancellation procedures, ID requirements, and information about the testing center location. In addition, you will receive a registration and payment confirmation letter from Prometric.
Microsoft requires certification candidates to accept the terms of a nondisclosure agreement before taking certification exams.
## Who Should Read This Book?
This book is intended for individuals who want to earn their MCSA: Windows Server 2012 R2 certification.
This book will not only help anyone who is looking to pass the Microsoft exams, it will also help anyone who wants to learn the real ins and outs of the Windows Server 2012 R2 operating system.
## What's Inside?
Here is a glance at what's in each chapter:
Chapter 1: Install Windows Server 2012 R2 In the first chapter, I explain the requirements and steps required to install and configure Windows Server 2012 R2.
Chapter 2: Configure Network Services This chapter shows you how to install and configure DNS. I also explain the different types of DNS records and DNS zone types.
Chapter 3: Plan and Install Active Directory I take you through the advantages and benefits of Windows Server 2012 R2 Active Directory.
Chapter 4: Configure Windows Server 2012 R2 I show you how to manage file systems, print servers, and file and share access.
Chapter 5: Administer Active Directory This chapter takes you through the different ways to create and manage your users and groups on the Windows Server 2012 R2 operating system.
Chapter 6: Manage GPOs You will see how to configure different types of Group Policy objects (GPOs) in Active Directory.
Chapter 7: Manage Security I show you how to secure Windows Server 2012 R2.
Chapter 8: Configure TCP/IP This chapter shows you how to configure IPv4 and IPv6. You'll look at IPv4 subnetting and how to manage a TCP/IP network.
Chapter 9: Use Virtualization in Windows Server 2012 This chapter will show you how to implement and configure Windows Server Hyper-V and virtual machines. You will learn about virtual networking, virtual hard disks, migration types, and Integration Services.
## What's Included with the Book
This book includes many helpful items intended to prepare you for the MCSA: Windows Server 2012 R2 certification.
Assessment Test There is an assessment test at the conclusion of the introduction that can be used to evaluate quickly where you are with Windows Server 2012 R2. This test should be taken prior to beginning your work in this book, and it should help you identify areas in which you are either strong or weak. Note that these questions are purposely more simple than the types of questions you may see on the exams.
Objective Map and Opening List of Objectives Later in this introduction, I include a detailed exam objective map showing you where each of the exam objectives are covered. Each chapter also includes a list of the exam objectives that are covered.
Helpful Exercises Throughout the book, I have included step-by-step exercises of some of the more important tasks that you should be able to perform. Some of these exercises have corresponding videos that can be downloaded from the book's website. Also, in the following section I have a recommended home lab setup that will be helpful in completing these tasks.
Exam Essentials The end of each chapter also includes a listing of exam essentials. These are essentially repeats of the objectives, but remember that any objective on the exam blueprint could show up on the exam.
Chapter Review Questions Each chapter includes review questions. These are used to assess your understanding of the chapter and are taken directly from the chapter. These questions are based on the exam objectives, and they are similar in difficulty to items you might actually receive on the MCSA: Windows Server 2012 R2 exams.
* * *
The Sybex Test Engine, flashcards, videos, and glossary can be obtained at www.sybex.com/go/mcsawin2012r2install.
* * *
Sybex Test Engine Readers can access the Sybex Test Engine, which includes the assessment test and chapter review questions in electronic format. In addition, there are a total of three practice exams included with the Sybex test engine: one each for Exams 70-410, 70-411, and 70-412.
Electronic Flashcards Flashcards are included for quick reference. They are a great tool for learning important facts quickly. You may even consider these as additional simple practice questions, which is essentially what they are.
Videos Some of the exercises include corresponding videos. These videos show you how I do the exercises. There is also a video that shows you how to set up virtualization so that you can complete the exercises within a virtualized environment. This same video also shows you how to install Windows Server 2012 Datacenter on that virtualized machine.
PDF of Glossary of Terms There is a glossary included that covers the key terms used in this book.
## Recommended Home Lab Setup
To get the most out of this book, you will want to make sure you complete the exercises throughout the chapters. To complete the exercises, you will need one of two setups. First, you can set up a machine with Windows Server 2012 R2 and complete the labs using a regular Windows Server 2012 R2 machine.
The second way to set up Windows Server 2012 R2 (the way I set up Server 2012 R2) is by using virtualization. I set up Windows Server 2012 R2 as a virtual hard disk (VHD), and I did all the labs this way. The advantages of using virtualization are that you can always just wipe out the system and start over without losing a real server. Plus, you can set up multiple virtual servers and create a full lab environment on one machine.
I created a video for this book showing you how to set up a virtual machine and how to install Windows Server 2012 R2 onto that virtual machine.
## How to Contact Sybex
Sybex strives to keep you supplied with the latest tools and information you need for your work. Please check the website at www.sybex.com/go/mcsawin2012r2install, where I'll post additional content and updates that supplement this book should the need arise.
You can contact me by going to my website at www.willpanek.com.
## Certification Objectives Maps
In addition to the book chapters, you will find coverage of exam objectives in the flashcards, practice exams, and videos on the book's companion website: www.sybex.com/go/mcsawin2012r2install
* * *
Exam objectives are subject to change at any time without prior notice and at Microsoft's sole discretion. Please visit Microsoft's website (www.microsoft.com/learning) for the most current listing of exam objectives.
* * *
## Objectives
### Exam 70-410: Installing and Configuring Windows Server 2014
1. Install servers, Chapter 1
1. Plan for a server installation
2. Plan for server roles
3. Plan for a server upgrade
4. Install Server Core
5. Optimize resource utilization by using Features on Demand
6. Migrate roles from previous versions of Windows Server
2. Configure servers, Chapter 1
1. Configure Server Core
2. Delegate administration
3. Add and remove features in offline images
4. Deploy roles on remote servers
5. Convert Server Core to/from full GUI
6. Configure services
7. Configure NIC teaming
3. Configure local storage, Chapter 1
1. Design storage spaces
2. Configure basic and dynamic disks
3. Configure MBR and GPT disks
4. Manage volumes
5. Create and mount virtual hard disks
6. Configure storage pools and disk pools
4. Deploy and configure DNS service, Chapter 2
1. Configure Active Directory integration of primary zones
2. Configure forwarders
3. Configure Root Hints
4. Manage DNS cache
5. Create A and PTR resource records
5. Deploy and configure Dynamic Host Configuration Protocol (DHCP) service, Chapter 2
1. Create and configure scopes
2. Configure a DHCP reservation
3. Configure DHCP options
4. Configure client and server for PXE boot
5. Configure DHCP relay agent
6. Authorize DHCP server
6. Install domain controllers, Chapter 3
1. Add or remove a domain controller from a domain
2. Upgrade a domain controller
3. Install Active Directory Domain Services (AD DS) on a Server Core installation
4. Install a domain controller from Install from Media (IFM)
5. Resolve DNS SRV record registration issues
6. Configure a global catalog server
7. Deploy Active Directory iaas in Windows Azure
7. Configure file and share access, Chapter 4
1. Create and configure shares
2. Configure share permissions
3. Configure offline files
4. Configure NTFS permissions
5. Configure access-based enumeration (ABE)
6. Configure Volume Shadow Copy Service (VSS)
7. Configure NTFS quotas
8. Create and configure Work Folders
8. Configure print and document services, Chapter 4
1. Configure the Easy Print print driver
2. Configure Enterprise Print Management
3. Configure drivers
4. Configure printer pooling
5. Configure print priorities
6. Configure printer permissions
9. Configure servers for remote management, Chapter 4
1. Configure WinRM
2. Configure down-level server management
3. Configure servers for day-to-day management tasks
4. Configure multi-server management
5. Configure Server Core
6. Configure Windows Firewall
7. Manage non-domain joined servers
10. Create and manage Active Directory users and computers, Chapter 5
1. Automate the creation of Active Directory accounts
2. Create, copy, configure, and delete users and computers
3. Configure templates
4. Perform bulk Active Directory operations
5. Configure user rights
6. Offline domain join
7. Manage inactive and disabled accounts
11. Create and manage Active Directory groups and organizational units (OUs), Chapter 5
1. Configure group nesting
2. Convert groups including security, distribution, universal, domain local, and domain global
3. Manage group membership using Group Policy
4. Enumerate group membership
5. Delegate the creation and management of Active Directory objects
6. Manage default Active Directory containers
7. Create, copy, configure, and delete groups and OUs
12. Create Group Policy Objects (GPOs), Chapter 6
1. Configure a Central Store
2. Manage starter GPOs
3. Configure GPO links
4. Configure multiple local group policies
5. Configure security filtering
13. Configure application restriction policies, Chapter 6
1. Configure rule enforcement
2. Configure applocker rules
3. Configure Software Restriction Policies
14. Configuring security policies, Chapter 7
1. Configure User Rights Assignment
2. Configure Security Options settings
3. Configure Security templates
4. Configure Audit Policy
5. Configure Local Users and Groups
6. Configure User Account Control (UAC)
15. Configuring Windows Firewall, Chapter 7
1. Configure rules for multiple profiles using Group Policy
2. Configure connection security rules
3. Configure Windows Firewall to allow or deny applications, scopes, ports, and users
4. Configure authenticated firewall exceptions
5. Import and export settings
16. Configure IPv4 and IPv6 addressing, Chapter 8
1. Configure IP address options
2. Configure IPv4 or IPv6 subnetting
3. Configure supernetting
4. Configure interoperability between IPv4 and IPv6
5. Configure ISATAP
6. Configure Teredo
17. Create and configure virtual machine settings, Chapter 9
18. Configure dynamic memory, Chapter 9
19. Configure smart paging, Chapter 9
20. Configure Resource Metering, Chapter 9
21. Configure guest integration services, Chapter 9
22. Create and configure Generation 1 and 2 virtual machines, Chapter 9
23. Configure and use extended session mode, Chapter 9
24. Configure remoteFX, Chapter 9
25. Create and configure virtual machine storage, Chapter 9
1. Create VHDs and VHDX
2. Configure differencing drives
3. Modify VHDs
4. Configure pass-through disks
5. Manage checkpoints
6. Implement a virtual Fibre Channel adapter
7. Configure storage Quality of Service
26. Create and configure virtual networks, Chapter 9
1. Configure Hyper-V virtual switches
2. Optimize network performance
3. Configure MAC addresses
4. Configure network isolation
5. Configure synthetic and legacy virtual network adapters
6. Configure NIC teaming in virtual machines
# Assessment Test
1. Which of the following is a valid role for a Windows Server 2012 R2 computer?
1. Stand-alone server
2. Member server
3. Domain controller
4. All of the above
2. Which of the following is a benefit of using Active Directory? (Choose all that apply.)
1. Hierarchical object structure
2. Fault-tolerant architecture
3. Ability to configure centralized and distributed administration
4. Flexible replication
3. Which of the following features of the Domain Name System (DNS) can be used to improve performance? (Choose all that apply.)
1. Caching-only servers
2. DNS forwarding
3. Secondary servers
4. Zone delegation
4. Which of the following pieces of information should you have before you begin the Active Directory Installation Wizard? (Choose all that apply.)
1. Active Directory domain name
2. Administrator password for the local computer
3. NetBIOS name for the server
4. DNS configuration information
5. An Active Directory environment consists of three domains. What is the maximum number of sites that can be created for this environment?
1. Two
2. Three
3. Nine
4. Unlimited
6. Which of the following is _not_ a valid Active Directory object?
1. User
2. Group
3. Organizational unit
4. Computer
5. None of the above
7. Which of the following is _not_ considered a security principal?
1. Users
2. Security groups
3. Distribution groups
4. Computers
8. Which of the following should play the _least_ significant role in planning an OU structure?
1. Network infrastructure
2. Domain organization
3. Delegation of permissions
4. Group Policy settings
9. How can the Windows Server 2012 R2 file and printer resources be made available from within Active Directory?
1. A system administrator can right-click the resource and select Publish.
2. A system administrator can create Printer and Shared Folder objects that point to these resources.
3. The Active Directory Domains and Trusts tool can be used to make resources available.
4. Only resources on a Windows 2000 or newer server can be accessed from within Active Directory.
10. The process by which a higher-level security authority assigns permissions to other administrators is known as which of the following?
1. Inheritance
2. Delegation
3. Assignment
4. Trust
11. What is the minimum amount of information you need to create a Shared Folder Active Directory object?
1. The name of the share
2. The name of the server
3. The name of the server and the name of the share
4. The name of the server, the server's IP address, and the name of the share
12. Which of the following operations is not supported by Active Directory?
1. Assigning applications to users
2. Assigning applications to computers
3. Publishing applications to users
4. Publishing applications to computers
13. Which of the following filename extensions is used primarily for Windows Installer setup programs?
1. `.msi`
2. `.mst`
3. `.zap`
4. `.aas`
14. A system administrator wants to allow a group of users to add computer accounts to a specific organizational unit (OU). What is the easiest way to grant only the required permissions?
1. Delegate control of a user account
2. Delegate control at the domain level
3. Delegate control of an OU
4. Delegate control of a computer account
5. Create a Group Policy object (GPO) at the OU level
15. A Group Policy object (GPO) at the domain level sets a certain option to Disabled, while a GPO at the OU level sets the same option to Enabled. All other settings are left at their default. Which setting will be effective for objects within the OU?
1. Enabled
2. Disabled
3. No effect
4. None of the above
16. Which of the following tools can be used to create Group Policy object (GPO) links to Active Directory?
1. Active Directory Users and Computers
2. Active Directory Domains and Trusts
3. Active Directory Sites and Services
4. Group Policy Management Console
17. To test whether a DNS server is answering queries properly, you can use which of the following tools?
1. The `ping` tool
2. The `nslookup` tool
3. The `tracert` tool
4. The `ipconfig` tool
18. Which of the following is true about the time to live (TTL) attached to a DNS record?
1. A resolver cannot use it; only servers making recursive queries can use it.
2. Only resolvers use it.
3. It is used to determine how long to cache retrieved results.
4. It is refreshed each time the record is modified.
19. Which of the following statements about Windows Server 2012 Dynamic DNS (DDNS) is true?
1. DDNS requires a Microsoft DHCP server to work.
2. The Windows Server 2012 DDNS server can interoperate with recent versions of BIND.
3. DDNS clients may not register their own addresses.
4. DDNS works only with Microsoft clients and servers.
20. You have been given a server that contains three HBAs. Each card can access the storage over a separate path. The application that runs on the server can exceed the usage of a single path. Which of the following MPIO options should be selected to provide the needed bandwidth as well as minimal redundancy?
1. Failover
2. Dynamic Least Queue Depth
3. Weighted path
4. Round robin
## Answers to Assessment Test
1. D. Based on the business needs of an organization, a Windows 2012 R2 Server computer can be configured in any of the roles listed. See Chapter 1 for more information.
2. A, B, C and D. All of the options listed are benefits of using Active Directory. See Chapter 3 for more information.
3. A, B, C and D. One of the major design goals for DNS was support for scalability. All of the features listed can be used to increase the performance of DNS. See Chapter 2 for more information.
4. A, B, C and D. Before beginning the installation of a domain controller, you should have all the information listed. See Chapter 3 for more information.
5. D. The number of sites in an Active Directory environment is independent of the domain organization. An environment that consists of three domains may have one or more sites, based on the physical network setup. See Chapter 3 for more information.
6. E. All of the choices are valid types of Active Directory objects, and all can be created and managed using the Active Directory Users and Computers tool. See Chapter 5 for more information.
7. C. Permissions and security settings cannot be made on distribution groups. Distribution groups are used only for sending email. See Chapter 4 for more information.
8. A. In general, you can accommodate your network infrastructure through the use of Active Directory sites. All of the other options should play a significant role when you design your OU structure. Permissions and Group Policy can both be applied at the domain or OU level. See Chapter 4 for more information.
9. B. Printer and Shared Folder objects within Active Directory can point to Windows Server 2012 R2 file and printer resources. See Chapter 4 for more information.
10. B. Delegation is the process by which administrators can assign permissions on the objects within an OU. This is useful when administrators want to give other users more control over administrative functions in Active Directory. See Chapter 4 for more information.
11. C. The name of the server and the name of the share make up the Universal Naming Convention (UNC) information required to create a Shared Folder object. See Chapter 4 for more information.
12. D. Applications cannot be published to computers, but they can be published to users and assigned to computers. See Chapter 5 for more information.
13. A. MSI files (`.msi`) are native Windows Installer files used with Windows Installer setup programs. The other file types do not apply to this situation. See Chapter 5 for more information.
14. E. To allow this permission at the OU level, the system administrator must create a GPO with the appropriate settings and link it to the OU. See Chapter 5 for more information.
15. A. Assuming that the default settings are left in place, the Group Policy setting at the OU level will take effect. See Chapter 5 for more information.
16. D. In Windows Server 2012 R2, you can create GPOs only by using the Group Policy Management Console. See Chapter 5 for more information.
17. B. The `nslookup` tool allows you to look up name and address information. See Chapter 2 for more information.
18. C. The TTL indicates how long the record may be safely cached; it may or may not be modified when the record is created. See Chapter 2 for more information on TTL.
19. B. DDNS works with BIND 8.2 and newer. See Chapter 2 for more information on DDNS.
20. D. A round-robin configuration uses all of the available active paths and will distribute I/O in a balanced round-robin fashion. Failover uses only the primary and standby paths, allowing for link failure. Weighted path assigns requests to the path with the least weight value. Dynamic Least Queue Depth routes requests to the path with the least number of outstanding requests. See Chapter 2 for more information.
# Chapter 1
Install Windows Server 2012 R2
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Install servers**
* Plan for a server installation
* Plan for server roles
* Plan for a server upgrade
* Install Server Core
* Optimize resource utilization by using Features on Demand
* Migrate roles from previous versions of Windows Server
* Configure Server Core
* Add and remove features in offline images
* Deploy roles on remote servers
* Convert Server Core to/from full GUI
* Configure NIC teaming
2. **Configure local storage**
* Design storage spaces
* Configure basic and dynamic disks
* Configure MBR and GPT disks
* Manage volumes
* Create and mount virtual hard disks
* Configure storage pools and disk pools
This chapter covers the installation of Windows Server 2012 R2. It shows how to install both the full version of Windows Server 2012 R2 and the Server Core version. It also shows you how to use some PowerShell commands in Windows Server 2012 R2 Server Core.
Let's dive right into the server by talking about some of the new features and advantages of Windows Server 2012 R2.
## Features and Advantages of Windows Server 2012 and Server 2012 R2
Before I show how to install and configure Windows Server 2012 R2, let's take a look at some of the new features and the advantages it offers.
* * *
Since many of you will be upgrading from Windows Server 2003 and Windows Server 2008/2008 R2, these are the new features introduced by Microsoft since then. I will specifically identify any new features or advantages that are new to Windows Server 2012 R2 only.
* * *
I will talk about all of these features in greater detail throughout this book. What follows are merely brief descriptions.
Active Directory Certificate Services _Active Directory Certificate Services (AD CS)_ provides a customizable set of services that allow you to issue and manage _public key infrastructure (PKI) certificates_. These certificates can be used in software security systems that employ public key technologies.
Active Directory Domain Services _Active Directory Domain Services (AD DS)_ includes new features that make deploying domain controllers simpler and that let you implement them faster. AD DS also makes the domain controllers more flexible, both to audit and to authorize for access to files. Moreover, AD DS has been designed to make performing administrative tasks easier through consistent graphical and scripted management experiences.
Active Directory Rights Management Services _Active Directory Rights Management Services (AD RMS)_ provides management and development tools that let you work with industry security technologies, including encryption, certificates, and authentication. Using these technologies allows organizations to create reliable information protection solutions.
BitLocker _BitLocker_ is a tool that allows you to encrypt the hard drives of your computer. By encrypting the hard drives, you can provide enhanced protection against data theft or unauthorized exposure of your computers or removable drives that are lost or stolen.
BranchCache _BranchCache_ allows data from files and web servers on a wide area network (WAN) to be cached on computers at a local branch office. By using BranchCache, you can improve application response times while also reducing WAN traffic. Cached data can be either distributed across peer client computers (distributed cache mode) or centrally hosted on a server (hosted cache mode). BranchCache is included with Windows Server 2012 R2 and Windows 8.
* * *
In this book, I will refer to _Windows 8_ , which includes both Windows 8 and Windows 8.1. This is also true for _Windows Server 2008_. It will be used for both Windows Server 2008 and Windows Server 2008 R2. If, for some reason, both versions of Server 2008 did not cover an item, I will actually say 2008 R2.
* * *
DHCP _Dynamic Host Configuration Protocol (DHCP)_ is an Internet standard that allows organizations to reduce the administrative overhead of configuring hosts on a TCP/IP-based network. Some of the new features are DHCP failover, policy-based assignment, and the ability to use Windows PowerShell for DHCP Server.
DNS _Domain Name System (DNS)_ services are used in TCP/IP networks. DNS will convert a computer name or fully qualified domain name (FQDN) to an IP address. DNS also has the ability to do a reverse lookup and convert an IP address to a computer name. DNS allows you to locate computers and services through user-friendly names.
Failover Clustering _Failover Clustering_ gives an organization the ability to provide high availability and scalability to networked servers. Failover clusters can include file share storage for server applications, such as Hyper-V and Microsoft SQL Server, and those that run on physical servers or virtual machines.
File Server Resource Manager _File Server Resource Manager_ is a set of tools that allows administrators to manage and control the amount and type of data stored on the organization's servers. By using File Server Resource Manager, administrators have the ability to set up file management tasks, use quota management, get detailed reports, set up a file classification infrastructure, and configure file-screening management.
Hyper-V _Hyper-V_ is one of the most changed features in Windows Server 2012 R2. Microsoft's new slogan is "Windows Server 2012 R2, built from the cloud up," and this has a lot to do with Hyper-V. It allows an organization to consolidate servers by creating and managing a virtualized computing environment. It does this by using virtualization technology that is built into Windows Server 2012 R2.
Hyper-V allows you to run multiple operating systems simultaneously on one physical computer. Each virtual operating system runs in its own virtual machine environment. I cover Hyper-V in detail in Chapter 9: "Use Virtualization in Windows Server 2012."
IPAM _IP Address Management (IPAM)_ is one of the features introduced with Windows Server 2012 R2. IPAM allows an administrator to customize and monitor the IP address infrastructure on a corporate network.
Kerberos Authentication Windows Server 2012 R2 uses the _Kerberos authentication_ (version 5) protocol and extensions for password-based and public key authentication. The Kerberos client is installed as a _security support provider (SSP)_ , and it can be accessed through the _Security Support Provider Interface (SSPI)_.
Managed Service Accounts (gMSAs) Stand-alone _managed service accounts_ , originally created for Windows Server 2008 R2 and Windows 7, are configured domain accounts that allow automatic password management and _service principal names_ (SPNs) management, including the ability to delegate management to other administrators.
Networking There are many networking technologies and features in Windows Server 2012 R2, including BranchCache, Data Center Bridging (DCB), NIC Teaming, and many more.
Remote Desktop Services Before Windows Server 2008, we used to refer to this as Terminal Services. _Remote Desktop Services_ allows users to connect to virtual desktops, RemoteApp programs, and session-based desktops. Using Remote Desktop Services allows users to access remote connections from within a corporate network or from the Internet.
Security Auditing _Security auditing_ gives an organization the ability to help maintain the security of an enterprise. By using security audits, you can verify authorized or unauthorized access to machines, resources, applications, and services. One of the best advantages of security audits is to verify regulatory compliance.
Smart Cards Using _smart cards_ (referred to as _two-factor authentication_ ) and their associated _personal identification numbers (PINs)_ is a popular, reliable, and cost-effective way to provide authentication. When using smart cards, the user not only must have the physical card but also must know the PIN to be able to gain access to network resources. This is effective because even if the smart card is stolen, thieves can't access the network unless they know the PIN.
TLS/SSL (Schannel SSP) _Schannel_ is a security support provider (SSP) that uses the _Secure Sockets Layer (SSL)_ and _Transport Layer Security (TLS)_ Internet standard authentication protocols together. The Security Support Provider Interface is an API used by Windows systems to allow security-related functionality, including authentication.
Windows Deployment Services _Windows Deployment Services_ allows an administrator to install Windows operating systems remotely. Administrators can use Windows Deployment Services to set up new computers by using a network-based installation.
## Planning the Windows Server 2012 R2 Installation
Before you install Windows Server 2012 R2, you must first ask yourself these important questions: What type of server do I need? Will the server be a domain controller? What roles do I need to install on this server?
Once you have figured out what you need the server to do, you can make a game plan for the installation. So, let's start by looking at some of the server roles and technologies that can be installed on a Windows Server 2012 R2 computer.
### Server Roles in Windows Server 2012 R2
When you install Windows Server 2012 R2, you have to decide which roles and features are going to be installed onto that server. This is an important decision in the computer world. Many administrators not only overuse a server but also underutilize servers in their organization.
For example, many administrators refuse to put any other roles or features on a domain controller. This may not be a good use of a server. Domain controllers help authenticate users onto the network, but after that the domain controllers are really not very busy all day long. Domain controllers have tasks that they must perform all day, but the server on which they reside is not heavily used when compared to a SQL Server machine or an Exchange mail server. This is where monitoring your server can be useful.
Now let's take a look at some of the roles and features you can install onto a Windows Server 2012 R2 machine. Knowing the different roles and features you can install will help you to design, deploy, manage, and troubleshoot technologies in Windows Server 2012 R2. Figure 1.1 shows the Add Roles And Features Wizard in Server Manager. It shows you just some of the roles that can be installed on a Windows Server 2012 R2 machine.
**FIGURE 1.1** Available roles in Windows Server 2012 R2
* * *
## Roles and Features
Many of these features were discussed in the section "Features and Advantages of Windows Server 2012 and Server 2012 R2." I include them here again because they are also roles that can also be installed on Windows Server 2012 R2.
* * *
The following roles are available in Windows Server 2012 R2:
Active Directory Certificate Services The AD CS server role in Windows Server 2012 R2 allows you to build a PKI and provide public key cryptography, digital certificates, and digital signature capabilities for your organization.
1. Feature AD CS provides a customizable set of services that allows you to issue and manage PKI certificates. These certificates can be used in software security systems that employ public key technologies.
2. Role AD CS in Windows Server 2012 R2 is the server role that allows you to build a PKI and provide public key cryptography, digital certificates, and digital signature capabilities for your organization.
Active Directory Domain Services The AD DS server role allows you to create a scalable, secure, and manageable infrastructure for user and resource management and to provide support for directory-enabled applications, such as Microsoft Exchange Server.
Active Directory Federation Services _Active Directory Federation Services (AD FS)_ provides Internet-based clients with a secure identity access solution that works on both Windows and non-Windows operating systems. AD FS gives users the ability to do a _single sign-on (SSO)_ and access applications on other networks without needing a secondary password.
Active Directory Lightweight Directory Services _Active Directory Lightweight Directory Services (AD LDS)_ is a _Lightweight Directory Access Protocol (LDAP)_ directory service that provides flexible support for directory-enabled applications, without the dependencies and domain-related restrictions of AD DS.
Active Directory Rights Management Services Active Directory Rights Management Services (AD RMS) in Windows Server 2012 R2 is the server role that provides you with management and development tools that work with industry security technologies including encryption, certificates, and authentication to help organizations create reliable information protection solutions.
Application Server _Application Server_ provides an integrated environment for deploying and running custom, server-based business applications.
Failover Clustering The Failover Clustering feature provides a way to create, configure, and manage failover clusters for up to 4,000 virtual machines or up to 64 physical nodes.
File and Storage Services _File and Storage Services_ allows an administrator to set up and manage one or more file servers. These servers can provide a central location on your network where you can store files and then share those files with network users. If users require access to the same files and applications or if centralized backup and file management are important issues for your organization, administrators should set up network servers as a file server.
Group Policy _Group policies_ are a set of rules and management configuration options that you can control through the Group Policy settings. These policy settings can be placed on users' computers throughout the organization.
Hyper-V The Hyper-V role allows administrators to create and manage a virtualized environment by taking advantage of the technology built into the Windows Server 2012 R2 operating system. When an administrator installs the Hyper-V role, all required virtualization components are installed.
Some of the required components include the Windows hypervisor, Virtual Machine Management Service, the virtualization WMI provider, the virtual machine bus (VMbus), the virtualization service provider (VSP), and the virtual infrastructure driver (VID).
Networking This feature allows administrators to design, deploy, and maintain a Windows Server 2012 R2 network. The networking features include 802.1X authenticated wired and wireless access, BranchCache, Data Center Bridging, low-latency workload technologies, and many more.
Network Load Balancing The _Network Load Balancing (NLB)_ feature dispenses traffic across multiple servers by using the TCP/IP networking protocol. By combining two or more computers that are running applications in Windows Server 2012 R2 into a single virtual cluster, NLB provides reliability and performance for mission-critical servers.
Network Policy and Access Services Use the _Network Policy and Access Services_ server role to install and configure _Network Access Protection (NAP)_ , secure wired and wireless access points, and RADIUS servers and proxies.
Print and Document Services _Print and Document Services_ allows an administrator to centralize print server and network printer tasks. This role also allows you to receive scanned documents from network scanners and route the documents to a shared network resource, Windows SharePoint Services site, or email addresses. Print and Document Services also provides fax servers with the ability to send and receive faxes while also giving the administrator the ability to manage fax resources such as jobs, settings, reports, and fax devices on the fax server.
Remote Desktop Services Remote Desktop Services allows for faster desktop and application deployments to any device, improving remote user effectiveness while helping to keep critical data secure. Remote Desktop Services allows for both a _virtual desktop infrastructure (VDI)_ and session-based desktops, allowing users to connect from anywhere.
Security and Protection Windows Server 2012 R2 has many new and improved security features for your organization. These security features include Access Control, AppLocker, BitLocker, Credential Locker, Kerberos, NTLM, passwords, security auditing, smart cards, and Windows Biometric Framework (WBF).
Telemetry The _Telemetry_ service allows the Windows Feedback Forwarder to send feedback to Microsoft automatically by deploying a Group Policy setting to one or more organizational units. Windows Feedback Forwarder is available on all editions of Windows Server 2012 R2, including Server Core.
Volume Activation Windows Server 2012 R2 _Volume Activation_ will help your organization benefit from using this service to deploy and manage volume licenses for a medium to large number of computers.
Web Server (IIS) The _Web Server (IIS)_ role in Windows Server 2012 R2 allows an administrator to set up a secure, easy-to-manage, modular, and extensible platform for reliably hosting websites, services, and applications.
Windows Deployment Services Windows Deployment Services allows an administrator to install a Windows operating system over the network. Administrators do not have to install each operating system directly from a CD or DVD.
Windows Server Backup Feature The _Windows Server Backup_ feature gives an organization a way to back up and restore Windows servers. You can use Windows Server Backup to back up the entire server (all volumes), selected volumes, the system state, or specific files or folders.
Windows Server Update Services _Windows Server Update Services (WSUS)_ allows administrators to deploy application and operating system updates. By deploying WSUS, administrators have the ability to manage updates that are released through Microsoft Update to computers in their network. This feature is integrated with the operating system as a server role on a Windows Server 2012 R2 system.
### Migrating Roles and Features to Windows Server 2012 R2
Once you decide on which roles and features you are going to install onto your Windows Server 2012 R2 system, then you either have to install those roles and features from scratch or migrate them from a previous version of Windows server.
Windows Server 2012 R2 includes a set of migration tools that administrators can use to help ease the process of migrating server roles, features, operating system settings, and data. Administrators can migrate this data from an existing server that is running Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, or Windows Server 2012 R2 to a computer that is running Windows Server 2012 R2.
Using Windows Server Migration Tools to migrate roles, role services, and features can simplify the deployment of new servers. You can migrate roles and features on servers running the Server Core installation option of Windows Server 2012 R2 and virtual servers. By using Windows Server Migration Tools, an administrator can reduce migration downtime, increase the accuracy of the migration process, and help eliminate conflicts that could otherwise occur during the migration process.
One advantage of using the migration tools is that most of them support cross-architecture migrations (x86-based to x64-based computing platforms), migrations between physical and virtual environments, and migrations between both the full and Server Core installation options of the Windows Server operating system. In Windows Server 2012 R2, Windows Server Migration Tools also supports cross-subnet migrations.
To use Windows Server Migration Tools, the feature must be installed on both the source and destination computers. Windows Server Migration Tools installation and preparation can be divided into the following stages:
1. Installing Windows Server Migration Tools on destination servers that run Windows Server 2012 R2
2. Creating deployment folders on destination servers that run Windows Server 2012 R2 for copying to source servers
3. Copying deployment folders from destination servers to source servers
4. Registering Windows Server Migration Tools on source servers
If you plan to use Windows Server Migration Tools, you must be a member of the Administrators group on both the source and destination servers to install, remove, or set up the tools.
Administrators can install Windows Server Migration Tools by using either the Add Roles Or Features Wizard in Server Manager or Windows PowerShell deployment cmdlets for Server Manager.
To install Windows Server Migration Tools on a Server Core installation of Windows Server 2012 R2, you would complete the following steps:
1. Open a Windows PowerShell session by typing **`powershell.exe`** in the current command prompt session and then pressing Enter.
2. In the Windows PowerShell session, install Windows Server Migration Tools by using the Windows PowerShell `Install-WindowsFeature` cmdlet for Server Manager. In the Windows PowerShell session, type the following, and then press Enter. (Omit the `ComputerName` parameter if you are installing the Windows Server Migration Tools on the local server.)
Install-WindowsFeature Migration –ComputerName _computer_name_
### Roles and Features That Have Been Reduced in Windows Server 2012 R2
One thing that we want to look at is which Roles and Features are being deprecated or removed from Windows Server 2012 and Windows Server 2012 R2. Table 1.1 was taken directly from Microsoft's website (<http://technet.microsoft.com/en-us/library/dn303411.aspx>), and this table may change at any time. Thus I would recommend that you go out to Microsoft's website to see the current list of Roles and Features.
Table 1.1 lists the features and functionalities in Windows Server 2012 and Windows Server 2012 R2 that either have been removed from the product in the current release or are planned for potential removal in subsequent releases (shown as _deprecated_ ).
**TABLE 1.1** Roles and Features Updates
| Windows Server 2012 | Windows Server 2012 R2
---|---|---
| Removed | Deprecated | Removed | Deprecated
AD FS v1 Web Agent | | | X |
AD FS in-place upgrade from AD FS 1.0 or "out-of-the-box" AD FS 2.0 | X | | |
AD FS support for "Resource Group" | X | | |
AD FS support for NT Token mode | X | | |
AD FS support for using AD LDS as an authentication store | X | | |
AD RMS license revocation | | | | X
AD RMS SDK | | | | X
Application Server role | | | | X
Built-in drivers for tape drives | | | | X
Cluster Automation Server COM API | X (Optional) | | X (Optional) |
Cluster.exe command-line interface | X (Optional) | | X (Optional) |
CertObj COM and InetInfo interfaces of the Web Server role | | | | X
Dcpromo.exe | | X | |
Dfscmd.exe | | | | X
Drivers for Jet Red RDBMS and ODBC | | X | | X
File Replication Service | | | | X
Internet Information Service (IIS) 6.0 Manager | | | | X
Layered Service Providers | | X | | X
LPR/LPD protocol | | X | | X
Namespace for version 1.0 of WMI; WMIC (in WMI) | | X | X |
NDIS version 5.0, 5.1, and 5.2 APIs | | X | X |
Net DMA | X | | |
Network Access Protection (NAP) | | | | X
Network Information Service (NIS) and Tools (in RSAT) | | | | X
Nfsshare.exe | | | | X
NFSv2 support | | | | X
Oclist.exe | X | | |
ODBC support for 16- and 32-bit applications and drivers | | X | | X
ODBC/OLEDB support for Microsoft Oracle | | X | |
ODBC/OLEDB support for SQL beyond SQL Server 7 and SQL 2000 | | X | | X
Providers for SNMP, Win32_ServerFeature API, Active Directory, MSClus WMI1.0 (in WMI) | | X | | X
Recovery disk creation | | | X |
Remote Data Service | | X | |
Role Collector (Ceiprole.exe) and associated API | X | | |
SCSIport host-bus adapter | X | | |
Servermanagercmd.exe | | X | X |
SIS Limited API | | | | X
Slmgr.vbs options | | | X |
SMB 1.0 | | | | X
SMB.sys | X | | |
SMTP and associated management tools | | X | | X
SQLXMLX | | X | | X
Storage Explorer snap-in for MMC | X | | |
Storage Manager for SANs snap-in for MMC | X | | |
Subsystem for UNIX-based applications | | X | X |
Support for 32-bit cluster resource DLLs | X | | |
Support for hardware drivers for XDDM | X | | |
Support for Microsoft SQL Server prior to 7.0 | X | | |
Support for native VGA via the PC/AT BIOS or UEFI CSM | X | | |
Support for Static VMQ | X | | |
Support for Token Rings | X | | |
Support for Visual Studio Analyzer 2003 over ODBC, OLEDB, and ADO | X | | |
System Image Backup ("Windows 7 File Recovery") | | | X |
Telnet server | | | | X
VM Chimney (also called TCP Offload) in Hyper-V | X | | |
Windows Server 2003 domain and functional levels of Active Directory | | | | X
Windows Authorization Manager (AzMan) | | X | X |
Windows Help executable (WinHlp32.exe) | X | | |
Windows Identity Foundation 3.5 | | | | X
Windows Server Resource Manager | | X | X |
Winsock Direct | | X | X |
WMI root/virtualization namespace v1 (in Hyper-V) | | X | X |
XDR schema elements, XSl pattern feature of MSXML3 (in XML) | | X | | X
### Deciding Which Windows Server 2012 R2 Versions to Use
You may be wondering which version of Windows Server 2012 R2 is best for your organization. After all, Microsoft offers the following four versions of Windows Server 2012 R2.
Windows Server 2012 R2 Datacenter This version is designed for organizations that are looking to migrate to a highly virtualized, private cloud environment. Windows Server 2012 R2 Datacenter has full Windows Server functionality with unlimited virtual instances.
Windows Server 2012 R2 Standard This version is designed for organizations with physical or minimally virtualized environments. Windows Server 2012 R2 Standard has full Windows Server functionality with two virtual instances.
Windows Server 2012 R2 Essentials This version is ideal for small businesses that have as many as 25 users and 50 devices. Windows Server 2012 R2 Essentials has a simpler interface and preconfigured connectivity to cloud-based services but no virtualization rights.
Windows Server 2012 R2 Foundation This version is designed for smaller companies that need a Windows Server experience for as few as 15 users. Windows Server 2012 R2 Foundation is a general-purpose server with basic functionality but no virtualization rights.
Once you choose what roles are going on your server, you must then decide how you're going to install Windows Server 2012 R2. There are two ways to install Windows Server 2012 R2. You can upgrade a Windows Server 2008 R2 with SP1 or Windows Server 2012 machine to Windows Server 2012 R2, or you can do a clean install of Windows Server 2012 R2. If you decide that you are going to upgrade, there are specific upgrade paths you must follow.
Your choice of Windows Server 2012 R2 version is dictated by how your current network is designed. If you are building a network from scratch, then it's pretty straightforward. Just choose the Windows Server 2012 R2 version based on your server's tasks. However, if you already have a version of Windows Server 2008 installed, you should follow the recommendations in Table 1.2, which briefly summarize the supported upgrade paths to Windows Server 2012 R2.
* * *
If your version of Microsoft Windows Server is not listed in the left column, upgrading to Windows Server 2012 R2 is not supported. If there is more than one edition listed in the right column, you can then choose either edition.
* * *
**TABLE 1.2** Supported Windows Server 2012 R2 upgrade path recommendations
Current System | | Upgraded System |
---|---|---|---
Windows Server 2008 R2 Datacenter with SP1 | Windows Server 2012 R2 Datacenter
Windows Server 2008 R2 Enterprise with SP1 | Windows Server 2012 R2 Standard or Windows Server 2012 R2 Datacenter
Windows Server 2008 R2 Standard with SP1 | Windows Server 2012 R2 Standard or Windows Server 2012 R2 Datacenter
Windows Web Server 2008 R2 with SP1 | Windows Server 2012 R2 Standard
Windows Server 2012 Datacenter | Windows Server 2012 R2 Datacenter
Windows Server 2012 Standard | Windows Server 2012 R2 Standard or Windows Server 2012 R2 Datacenter
Hyper-V Server 2012 | Hyper-V Server 2012 R2
Windows Storage Server 2012 Standard | Windows Storage Server 2012 R2 Standard
Windows Storage Server 2012 Workgroup | Windows Storage Server 2012 R2 Workgroup
### Deciding on the Type of Installation
One of the final choices you must make before installing Windows Server 2012 R2 is what type of installation you want. There are three ways to install Windows Server 2012 R2.
Windows Server 2012 R2 with the Graphical User Interface (GUI) This is the version with which most administrators are familiar. This is the version that uses _Microsoft Management Console (MMC)_ windows, and it is the version that allows the use of a mouse to navigate through the installation.
Windows Server 2012 R2 Server Core This is a bare-bones installation of Windows Server 2012 R2. You can think of it this way: If Windows Server 2012 R2 is a top-of-the-line luxury car, then Windows Server 2012 R2 Server Core is the stripped-down model with no air-conditioning, manual windows, and cloth seats. It might not be pretty to look at, but it gets the job done.
Windows Server 2012 R2 MinShell This is the best of both installation types mentioned previously. Minimum Shell (MinShell) gives you the advantage of using the GUI management tools, but MinShell does not actually install the GUI. It gives administrators the ability to use tools with which they are familiar but still provides a small attack surface and the advantages of Server Core.
In Windows Server 2012 R2, an administrator has the ability to remove the GUI shell after a GUI shell install has been completed. This removes Internet Explorer 10, Windows Explorer, the desktop, and the Start screen. Microsoft Management Console (MMC), Server Manager, and a subset of Control Panel are still present, giving you a MinShell installation plus PowerShell.
* * *
# Server Core
Here is an explanation of Server Core that I have used ever since it was introduced in Windows Server 2008.
I am a huge sports fan. I love watching sports on TV, and I enjoy going to games. If you have ever been to a hockey game, you know what a hockey goal looks like. Between hockey periods, the stadium workers often bring out a huge piece of Plexiglas onto the ice. There is a tiny square cut out of the bottom of the glass. The square is just a bit bigger than a hockey puck itself.
Now they pick some lucky fan out of the stands, give them a puck at center ice, and then ask them to shoot the puck into the net with the Plexiglas in front of it. If they get it through that tiny little square at the bottom of the Plexiglas, they win a car or some such great prize.
Well, Windows Server 2012 R2 with the GUI is like regular hockey with a net, and Windows Server 2012 R2 Server Core is the Plexiglas version.
Server Core supports a limited number of roles.
* Active Directory Certificate Services (AD CS)
* Active Directory Domain Services (AD DS)
* Active Directory Federation Services (AD FS)
* Active Directory Lightweight Directory Services (AD LDS)
* Active Directory Rights Management Services (AD RMS)
* Application Server
* DHCP Server
* DNS Server
* Fax Server
* File and Storage Services
* BITS Server
* BranchCache
* Hyper-V
* Network Policy and Access Services
* Print and Document Services
* Remote Access
* Remote Desktop Services
* Volume Activation Services
* Web Server (IIS)
* Windows Deployment Services
* Windows Server Update Services
* .NET Framework 3.5 Features
* .NET Framework 4.5 Features
* Streaming Media Services
* Failover Clustering
* iSCSI
* Network Load Balancing
* MPIO
* qWave
* Telnet Server/Client
* Windows Server Migration Tools
* Windows PowerShell 4.0
* * *
Server Core does not have the normal Windows interface or GUI. Almost everything has to be configured via the command line or, in some cases, using the Remote Server Administration Tools from a full version of Windows Server 2012 R2. While this might scare off some administrators, it has the following benefits:
Reduced Management Because Server Core has a minimum number of applications installed, it reduces management effort.
Minimal Maintenance Only basic systems can be installed on Server Core, so it reduces the upkeep you would need to perform in a normal server installation.
Smaller Footprint Server Core requires only 1GB of disk space to install and 2GB of free space for operations.
Tighter Security With only a few applications running on a server, it is less vulnerable to attacks.
The prerequisites for Server Core are basic. It requires the Windows Server 2012 R2 installation media, a product key, and the hardware on which to install it.
After you install the base operating system, you use PowerShell or the remote administrative tools to configure the network settings, add the machine to the domain, create and format disks, and install roles and features. It takes only a few minutes to install Server Core, depending on the hardware.
One of the new things to keep in mind is that you can upgrade or downgrade to Server Core or MinShell. In Windows Server 2008 R2 and Windows Server 2008, if you wanted to switch your Windows Server GUI to Server Core, or vice versa, there was no way to convert to a full Windows Server installation or a Server Core installation without reinstalling the operating system. In Windows Server 2012 R2, the Server Core or GUI installation options are no longer an irreversible selection made during setup. An administrator now has the ability to convert between a Server Core installation and a full installation as needed.
* * *
# Better Security
When I started in this industry more than 20 years ago, I was a programmer. I used to program computer hospital systems. When I switched to the networking world, I continued to work under contract with hospitals and with doctors' offices.
One problem I ran into is that many doctors are affiliated with hospitals, but they don't actually have offices within the hospital. Generally, they have offices either near the hospital or, in some cases, right across the street.
Here is the issue: Do we put servers in the doctors' offices, or do we make the doctor log into the hospital network through a remote connection? Doctors' offices normally don't have computer rooms, and we don't want to place a domain controller or server on someone's desk. It's just unsafe!
This is where Windows Server 2012 R2 Server Core can come into play. Since it is a slimmed-down version of Windows and there is no GUI, it makes it harder for anyone in the office to hack into the system. Also, Microsoft introduced a new domain controller in Windows Server 2008 called a read-only domain controller (RODC). As its name suggests, it is a read-only version of a domain controller (explained in detail later in this book).
With Server Core and an RODC, you can feel safer placing a server on someone's desk or in any office. Server Core systems allow you to place servers in areas that you would never have placed them before. This can be a great advantage to businesses that have small, remote locations without full server rooms.
* * *
If you have a server that is running Server Core, there may be a situation in which you need to use the graphical user interfaces available only in Windows Server 2012 R2 with a GUI mode. Windows Server 2012 and Windows Server 2012 R2 allow you to switch the Server Core system to a Server with a GUI mode, or vice versa.
To convert from a Windows 2012 or Windows Server 2012 R2 Server Core system to Server with a GUI mode, run this code snippet (a restart is required):
Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart
To convert from Server Core mode to Server with a GUI mode, follow these steps when the server is initially installed in Server Core mode:
1. Determine the index number for a server with a GUI image (for example, `SERVERDATACENTER`, not `SERVERDATACENTERCORE`) using this cmdlet:
Get-WindowsImage -ImagePath _path to wim_ \install.wim
2. Run this line of code:
Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart
–Source wim: _path to wim_ \install.wim: _Index # from step 1_
3. Alternatively, if you want to use Windows Update as the source instead of a WIM file, use this Windows PowerShell cmdlet:
Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart
After you have completed the management tasks, you can switch the server back to Server Core mode whenever it is convenient (a restart is required) with this Windows PowerShell cmdlet:
Uninstall-WindowsFeature Server-Gui-Mgmt-Infra -restart
### NIC Teaming
_NIC Teaming_ , also known as _load balancing and failover (LBFO)_ , gives an administrator the ability to allow multiple network adapters on a system to be placed into a team. Independent hardware vendors (IHVs) have required NIC Teaming, but until Windows Server 2012, NIC Teaming was _not_ part of the Windows Server Operating System.
To be able to use NIC Teaming, the computer system must have at least one Ethernet adapter. If you want to provide fault protection, an administrator must have a minimum of two Ethernet adapters. One advantage of Windows Server 2012 R2 is that an administrator can setup 32 network adapters in a NIC Team.
NIC Teaming is a very common practice when setting up virtualization. It is one way that you can have load balancing with Hyper-V.
NIC Teaming gives an administrator the ability to allow a virtual machine to use virtual network adapters in Hyper-V. The advantage of using NIC Teaming in Hyper-V is that the administrator can use it to connect to more than one Hyper-V switch. This allows Hyper-V to maintain connectivity even if the network adapter under the Hyper-V switch gets disconnected.
An administrator can configure NIC Teaming in either Server Manager or PowerShell.
### Installing Windows Server 2012 R2
In the following sections, I am going to walk you through two different types of installs. I will show you how to do a full install of Windows 2012 Server with the GUI, and then I will show you how to install the Server Core version of the same software.
* * *
For these labs, I am using the full release of Windows Server 2012 R2 Datacenter, but you can use Windows Server 2012 R2 Standard.
* * *
#### Installing with the GUI
In Exercise 1.1, I will show you how to install Windows Server 2012 R2 Datacenter with the GUI. The GUI represents the Windows applications on the Desktop and the operating system functions that you can control and navigate with a mouse. The Server Core version is a command-line version only—you cannot use a mouse with Server Core unless you are going to use the mouse wheel for scrolling.
* * *
## Windows Installation
At the time of this writing, I used the first full release of Windows Server 2012 R2 Datacenter. For this reason, there may be screens that have changed somewhat since this book was published.
* * *
* * *
### EXERCISE 1.1: Installing Windows Server 2012 R2 with the GUI
1. Insert the Windows Server 2012 R2 installation DVD, and restart the machine from the installation media.
2. At the first screen, Windows Server 2012 R2 will ask you to configure your language, time and currency, and keyboard. Make your selections, and click Next.
3. At the next screen, click Install Now.
4. Depending on what version of Windows Server 2012 R2 you have (MSDN, TechNet, and so on), you may be asked to enter a product key. If this screen appears, enter your product key and click Next. If this screen does not appear, just go to step 5.
5. The Select The Operating System That You Want To Install screen then appears. Choose the Windows Server 2012 R2 Datacenter (Server With A GUI) selection and click Next.
6. The license terms screen appears. After reading the Windows Server 2012 R2 license agreement, check the I Accept The License Terms check box and click Next.
7. On the Which Type Of Installation Do You Want? screen, choose Custom: Install Windows Only (Advanced).
8. The next screen will ask you where you want to install Windows. If your hard disk is already formatted as NTFS, click the drive and then click Next. If the hard disk is not yet set up or formatted, choose the New link and create a partition. After creating the partition, click the Format link. Once the format is done, make sure you choose the new partition and click Next.
9. The Installing Windows screen will appear next. This is where the files from your media will be installed onto the system. The machine will reboot during this installation.
10. After the machine is finished rebooting, a screen requesting the administrator password will appear. Type in your password. ( **P@ssword** is used in this exercise.) Your password must meet the password complexity requirements (one capitalized letter, one number, and/or one special character). Click Finish.
11. Next, log into the system. Press Ctrl+Alt+Del, and type in the administrator password. The machine will set up the properties of the administrator account.
12. Notice that the Server Manager dashboard automatically appears. Your Windows Server 2012 R2 installation is now complete.
13. Close Server Manager.
* * *
After you have logged into the Windows Server 2012 R2 Datacenter system, you will notice some big changes. The first is that the Start button in the lower-left corner of the screen has changed its look. Also, you can get to a Start button by clicking the Windows key (see Figure 1.2).
**FIGURE 1.2** Windows key on a standard keyboard
#### Installing Windows Server 2012 R2 Server Core
In Exercise 1.2, you will learn how to install Windows Server 2012 R2 Server Core. You'll notice that the steps are similar to the ones in Exercise 1.1, with a couple of exceptions. As mentioned earlier, Server Core is a command-line configuration of Windows Server 2012 R2.
* * *
### EXERCISE 1.2: Installing Windows Server 2012 R2 Using Server Core
1. Insert the Windows Server 2012 R2 installation DVD, and restart the machine from the installation media.
2. At the first screen, Windows Server 2012 R2 will prompt you to configure your language, time and currency, and keyboard. Make your selections, and click Next.
3. At the next screen, click Install Now.
4. Depending on what version of Windows Server 2012 R2 you have (MSDN, TechNet, and so on), you may be asked to enter a product key. If this screen appears, enter your product key and click Next. If this screen does not appear, just go to step 5.
5. The Select The Operating System That You Want To Install screen then appears. Choose the Windows Server 2012 R2 Datacenter (Server Core Installation) selection and click Next.
6. The license terms screen appears. After reading the Windows Server 2012 R2 license agreement, check the I Accept The License Terms check box and click Next.
7. At the Which Type Of Installation Do You Want? screen, choose Custom: Install Windows Only (Advanced).
8. The next screen will ask you where you want to install Windows. If your hard disk is already formatted as NTFS, click the drive and then click Next. If the hard disk is not set up or formatted, choose the New link and create a partition. After creating the partition, click the Format link. Once the format is done, make sure you choose the new partition and click Next.
9. The Installing Windows screen will appear next. This is where the files from your media will be installed onto the system. The machine will reboot during this installation.
10. After the machine is finished rebooting, a screen requesting the administrator password will appear. Type in your password. ( **P@ssword** is used in this exercise.) Your password must meet the password complexity requirements (one capitalized letter, one number, and/or one special character).
11. Log into the system. Press Ctrl+Alt+Del, and type in the administrator password. The machine will set up the properties of the administrator account.
12. You will notice that the command prompt will automatically appear. Your Windows Server 2012 R2 Server Core installation is now complete.
13. To log out or turn off the machine, press Ctrl+Alt+Del and then click Sign Out.
* * *
After Windows Server 2012 R2 server is installed, you need to look at how to manage and configure the server. In the next section, you will learn how to manage a server remotely and with Windows PowerShell.
### Using Windows Deployment Services
Another way that many IT departments deploy operating systems has been through the use of Windows Deployment Services (WDS). WDS allows an IT administrator to install a Windows operating system without using an installation disc. Using WDS allows you to deploy the operating system through a network installation. WDS can deploy Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows 8, Windows Server 2008/2008 R2, Microsoft Windows 2012, and Microsoft Windows Server 2012 R2.
The following are some of the advantages of using WDS for automated installation:
* You can remotely install Windows 7/Windows 8.
* The procedure simplifies management of the server image by allowing you to access Windows 7/8 distribution files from a distribution server.
* You can quickly recover the operating system in the event of a computer failure.
Here are the basic steps of the WDS process from a PXE-enabled WDS client:
1. The WDS client initiates a special boot process through the PXE network adapter (and the computer's BIOS configured for a network boot). On a PXE client, the user presses F12 to start the PXE boot process and to indicate that they want to perform a WDS installation.
2. A list of available Windows PE boot images is displayed. The user should select the appropriate Windows PE boot image from the boot menu.
3. The Windows Welcome screen is displayed. The user should click the Next button.
4. The WDS user is prompted to enter credentials for accessing and installing images from the WDS server.
5. A list of available operating system images is displayed. The user should select the appropriate image file to install.
6. The WDS user is prompted to enter the product key for the selected image.
7. The Partition And Configure The Disk screen is displayed. This screen provides the ability to install a mass storage device driver, if needed, by pressing F6.
8. The image copy process is initiated, and the selected image is copied to the WDS client computer.
The following sections describe how to set up the WDS server and the WDS clients and how to install Windows 7/8 through WDS.
#### Preparing the WDS Server
With the WDS server, you can manage and distribute Windows 7/8 operating system images to WDS client computers. The WDS server contains any files necessary for PXE booting, Windows PE boot images, and the Windows 7/8 images to be deployed.
The following steps for preparing the WDS server are discussed in the upcoming sections:
1. Make sure that the server meets the requirements for running WDS.
2. Install WDS.
3. Configure and start WDS.
4. Configure the WDS server to respond to client computers (if this was not configured when WDS was installed).
For WDS to work, the server on which you will install WDS must meet the requirements for WDS and be able to access the required network services.
#### WDS Server Requirements
The WDS server must meet these requirements:
* The computer must be a domain controller or a member of an Active Directory domain.
* At least one partition on the server must be formatted as NTFS.
* WDS must be installed on the server.
* The operating system must be Windows Server 2003, Windows Server 2008/2008 R2, Windows Server 2012, or Windows Server 2012 R2.
* A network adapter must be installed.
#### Network Services
The following network services must be running on the WDS server or be accessible to the WDS server from another network server:
* TCP/IP installed and configured.
* A DHCP server, which is used to assign DHCP addresses to WDS clients. (Ensure that your DHCP scope has enough addresses to accommodate all of the WDS clients that will need IP addresses.)
* A DNS server, which is used to locate the Active Directory controller.
* Active Directory, which is used to locate WDS servers and WDS clients as well as authorize WDS clients and manage WDS configuration settings and client installation options.
#### Installing the WDS Server Components
You can configure WDS on a Windows Server 2003/2008/2008 R2, Windows Server 2012, or Windows Server 2012 R2 computer by using the Windows Deployment Services Configuration Wizard or by using the WDSUTIL command-line utility. Table 1.3 describes the `WDSUTIL` command-line options.
**TABLE 1.3** `WDSUTIL` command-line options
WDSUTIL Option | Description
---|---
`/initialize-server` | Initializes the configuration of the WDS server
`/uninitialized-server` | Undoes any changes made during the initialization of the WDS server
`/add` | Adds images and devices to the WDS server
`/convert-ripimage` | Converts Remote Installation Preparation (RIPrep) images to WIM images
`/remove` | Removes images from the server
`/set` | Sets information in images, image groups, WDS servers, and WDS devices
`/get` | Gets information from images, image groups, WDS servers, and WDS devices
`/new` | Creates new capture images or discover images
`/copy- image` | Copies images from the image store
`/export-image` | Exports to WIM files images contained within the image store
`/start` | Starts WDS services
`/stop` | Stops WDS services
`/disable` | Disables WDS services
`/enable` | Enables WDS services
`/approve-autoadddevices` | Approves Auto-Add devices
`/reject-autoadddevices` | Rejects Auto-Add devices
`/delete-autoadddevices` | Deletes records from the Auto-Add database
`/update` | Uses a known good resource to update a server resource
The first step in setting up WDS to deploy operating systems to the clients is to install the WDS role. You do this by using Server Manager.
One of the advantages of using the Windows deployment server is that WDS can work with Windows image (`.wim`) files. Windows image files can be created through the use of the Windows Sysprep utility.
One component to which you need to pay attention when using the Windows deployment server is _Preboot Execution Environment (PXE)_ network devices. PXE boot devices are network interface cards (NICs) that can talk to a network without the need for an operating system. PXE boot NIC adapters are network adapters that have a set of preboot commands within the boot firmware.
This is important when using WDS because PXE boot adapters connect to a WDS server and request the data needed to load the operating system remotely. Remember, most of the machines for which you are using WDS do not have an operating system on the computer. You need NIC adapters that can connect to a network without the need for an operating system for WDS to work properly.
For the same reason, you must set up DHCP to accept PXE machines. Those machines need a valid TCP/IP address so that they can connect to the WDS server.
#### Preparing the WDS Client
The WDS client is the computer on which Windows 7/8 will be installed. WDS clients rely on a technology called PXE, which allows the client computer to boot remotely and connect to a WDS server.
To act as a WDS client, the computer must meet all of the hardware requirements for Windows 7/Windows 8 and have a PXE-capable network adapter installed, and a WDS server must be present on the network. Additionally, the user account used to install the image must be a member of the Domain Users group in Active Directory.
After the WDS server has been installed and configured, you can install Windows 7/Windows 8 on a WDS client that uses a PXE-compliant network card.
To install Windows 7/Windows 8 on the WDS client, follow these steps:
1. Start the computer. When prompted, press F12 for a network service boot. The Windows PE appears.
2. The Windows Welcome screen appears. Click the Next button to start the installation process.
3. Enter the username and password of an account that has permissions to access and install images from the WDS server.
4. A list of available operating system images stored on the WDS server appears. Select the image to install and click Next.
5. Enter the product key for the selected Windows 7/8 image and click Next.
6. The Partition And Configure The Disk screen appears. Select the desired disk-partitioning options, or click OK to use the default options.
7. Click Next to initiate the image-copying process. The Windows Setup process will begin after the image is copied to the WDS client computer.
## Understanding Features On Demand
One of the problems in previous versions of Windows Server was how roles and features were stored on the hard disk. Before the introduction of Windows Server 2012, even if a server role or feature was disabled on a server, the binary files for that role or feature were still present on the disk. The problem with this approach is that, even if you disable the role, it still consumes space on your hard drive.
Features On Demand in Windows Server 2012 R2 solves this issue because not only can administrators disable a role or feature, they can also completely remove the role or feature's files.
Once this is done, a state of Removed is shown in Server Manager, or the state of Disabled With Payload Removed is shown in the `Dism.exe` utility. To reinstall a role or feature that has been completely removed, you must have access to the installation files.
If you want to remove a role or feature completely from the system, use `–Remove` with the `Uninstall-WindowsFeature` cmdlet of Windows PowerShell. For example, if you want to remove Windows Explorer, Internet Explorer, and all dependent components completely, run the following Windows PowerShell command:
Uninstall-WindowsFeature Server-Gui-Shell -Remove
If you want to reinstall a role or feature that has been removed completely, use the Windows PowerShell `–Source` option of the `Install-WindowsFeature Server Manager` cmdlet. Using the `–Source` option states the path where the WIM image files and the index number of the image will be located. If an administrator decides not to use the `–Source` option, Windows will use Windows Update by default.
When you're using the Features On Demand configuration, if feature files are not available on the server computer and the installation requires those feature files, Windows Server 2012 R2 can be directed to get those files from a side-by-side feature store, which is a shared folder that contains feature files. It is available to the server on the network, from Windows Update, or from installation media. This can be overwritten using the `-Source` option in the Windows PowerShell utility.
* * *
## Source Files for Roles or Features
Offline virtual hard disks (VHDs) cannot be used as a source for installing roles or features that have been completely removed. Only sources for the same version of Windows Server 2012 R2 are supported.
* * *
To install a removed role or feature using a WIM image, follow these steps:
1. Run the following command:
Get-windowsimage – _imagepath_ \install.wim
In step 1, _`imagepath`_ is the path where the WIM files are located.
2. Run the following command:
Install-WindowsFeature _featurename_ -Source wim: _path:index_
In step 2, _`featurename`_ is the name of the role or feature from `Get-WindowsFeature`. _`path`_ is the path to the WIM mount point, and _`index`_ is the index of the server image from step 1.
To add or remove a role or feature, you must have administrative rights to the Windows Server 2012 R2 machine.
## Storage in Windows Server 2012 R2
As an IT administrator, you'll need to ask many questions before you start setting up a server. What type of disks should be used? What type of RAID sets should be made? What type of hardware platform should be purchased? These are all questions you must ask when planning for storage in a Windows Server 2012 R2 server. In the following sections, I will answer these questions so that you can make the best decisions for storage in your network's environment.
### Initializing Disks
To begin, I must first discuss how to add disk drives to a server. Once a disk drive has been physically installed, it must be initialized by selecting the type of partition. Different types of partition styles are used to initialize disks: _Master Boot Record (MBR)_ and _GUID Partition Table (GPT)_.
MBR has a partition table that indicates where the partitions are located on the disk drive, and with this particular partition style, only volumes up to 2TB (2,048GB) are supported. An MBR drive can have up to four primary partitions or can have three primary partitions and one extended partition that can be divided into unlimited logical drives.
Windows Server 2012 R2 can only boot off an MBR disk unless it is based on the Extensible Firmware Interface (EFI); then it can boot from GPT. An Itanium server is an example of an EFI-based system. GPT is not constrained by the same limitations as MBR. In fact, a GPT disk drive can support volumes of up to 18EB (18,874,368 million terabytes) and 128 partitions. As a result, GPT is recommended for disks larger than 2TB or disks used on Itanium-based computers. Exercise 1.3 demonstrates the process of initializing additional disk drives to an active computer running Windows Server 2012 R2. If you're not adding a new drive, then stop after step 4. I am completing this exercise using Computer Management, but you also can do this exercise using Server Manager.
* * *
### EXERCISE 1.3: Initializing Disk Drives
1. Open Computer Management under Administrative Tools.
2. Select Disk Management.
3. After disk drives have been installed, right-click Disk Management and select Rescan Disks.
4. A pop-up box appears indicating that the server is scanning for new disks. If you did not add a new disk, go to step 9.
5. After the server has completed the scan, the new disk appears as Unknown.
6. Right-click the Unknown disk, and select Initialize Disk.
7. A pop-up box appears asking for the partition style. For this exercise, choose MBR.
8. Click OK.
9. Close Computer Management.
The disk will now appear online as a basic disk with unallocated space.
* * *
### Configuring Basic and Dynamic Disks
Windows Server 2012 R2 supports two types of disk configurations: basic and dynamic. Basic disks are divided into partitions and can be used with previous versions of Windows. Dynamic disks are divided into volumes and can be used with Windows 2000 Server and newer releases.
When a disk is initialized, it is automatically created as a basic disk, but when a new fault-tolerant (RAID) volume set is created, the disks in the set are converted to dynamic disks. Fault-tolerance features and the ability to modify disks without having to reboot the server are what distinguish dynamic disks from basic disks.
* * *
Fault tolerance (RAID) is discussed in detail later in this chapter in the "Redundant Array of Independent Disks" section.
* * *
A basic disk can simply be converted to a dynamic disk without loss of data. When a basic disk is converted, the partitions are automatically changed to the appropriate volumes. However, converting a dynamic disk back to a basic disk is not as simple. First, all the data on the dynamic disk must be backed up or moved. Then, all the volumes on the dynamic disk have to be deleted. The dynamic disk can then be converted to a basic disk. Partitions and logical drives can be created, and the data can be restored.
The following are actions that can be performed on basic disks:
* Formatting partitions
* Marking partitions as active
* Creating and deleting primary and extended partitions
* Creating and deleting logical drives
* Converting from a basic disk to a dynamic disk
The following are actions that can be performed on dynamic disks:
* Creating and deleting simple, striped, spanned, mirrored, or RAID-5 volumes
* Removing or breaking a mirrored volume
* Extending simple or spanned volumes
* Repairing mirrored or RAID-5 volumes
* Converting from a dynamic disk to a basic disk after deleting all volumes
In Exercise 1.4, you'll convert a basic disk to a dynamic disk.
* * *
### EXERCISE 1.4: Converting a Basic Disk to a Dynamic Disk
1. Open Computer Management under Administrative Tools.
2. Select Disk Management.
3. Right-click a basic disk that you want to convert and select Convert To Dynamic Disk.
4. The Convert To Dynamic Disk dialog box appears. From here, select all of the disks that you want to convert to dynamic disks. In this exercise, only one disk will be converted.
5. Click OK.
6. The Convert To Dynamic Disk dialog box changes to the Disks To Convert dialog box and shows the disk/disks that will be converted to dynamic disks.
7. Click Convert.
8. Disk Management will warn that if you convert the disk to dynamic, you will not be able to start the installed operating system from any volume on the disk (except the current boot volume). Click Yes.
9. Close Computer Management.
The converted disk will now show as Dynamic in Disk Management.
* * *
### Managing Volumes
A _volume set_ is created from volumes that span multiple drives by using the free space from those drives to construct what will appear to be a single drive. The following list includes the various types of volume sets and their definitions:
* _Simple volume_ uses only one disk or a portion of a disk.
* _Spanned volume_ is a simple volume that spans multiple disks, with a maximum of 32. Use a spanned volume if the volume needs are too great for a single disk.
* _Striped volume_ stores data in stripes across two or more disks. A striped volume gives you fast access to data but is not fault tolerant, nor can it be extended or mirrored. If one disk in the striped set fails, the entire volume fails.
* _Mirrored volume_ duplicates data across two disks. This type of volume is fault tolerant because if one drive fails, the data on the other disk is unaffected.
* _RAID-5 volume_ stores data in stripes across three or more disks. This type of volume is fault tolerant because if a drive fails, the data can be re-created from the parity off of the remaining disk drives. Operating system files and boot files cannot reside on the RAID-5 disks.
Exercise 1.5 illustrates the procedure for creating a volume set.
* * *
### EXERCISE 1.5: Creating a Volume Set
1. Open Computer Management under Administrative Tools.
2. Select Disk Management.
3. Select and right-click a disk that has unallocated space. If there are no disk drives available for a particular volume set, that volume set will be grayed out as a selectable option. In this exercise, you'll choose a spanned volume set, but the process after the volume set selection is the same regardless of which kind you choose. The only thing that differs is the number of disk drives chosen.
4. The Welcome page of the New Spanned Volume Wizard appears and explains the type of volume set chosen. Click Next.
5. The Select Disks page appears. Select the disk that will be included with the volume set and click Add. Repeat this process until all of the desired disks have been added. Click Next.
6. The Assign Drive Letter Or Path page appears. From here you can select the desired drive letter for the volume, mount the volume in an empty NTFS folder, or choose not to assign a drive letter. The new volume is labeled as E. Click Next.
7. The Format Volume page appears. Choose to format the new volume. Click Next.
8. Click Finish.
9. If the disks have not been converted to dynamic, you will be asked to convert the disks. Click Yes.
The new volume will appear as a healthy spanned dynamic volume with the new available disk space of the new volume set.
* * *
### Storage Spaces in Windows Server 2012 R2
Windows Server 2012 R2 includes a technology called _Storage Spaces_. Windows Server 2012 R2 allows an administrator to virtualize storage by grouping disks into storage pools. These storage pools can then be turned into virtual disks called _storage spaces_.
The Storage Spaces technology allows an administrator to have a highly available, scalable, low-cost, and flexible solution for both physical and virtual installations. Storage Spaces allows you to set up this advantage on either a single server or in scalable multinode mode. So, before going any further, let's look at these two terms that you must understand.
Storage Pools _Storage pools_ are a group of physical disks that allows an administrator to delegate administration, expand disk sizes, and group disks together.
Storage Spaces _Storage spaces_ allow an administrator to take free space from storage pools and create virtual disks called storage spaces. Storage spaces give administrators the ability to have precise control, resiliency, and storage tiers.
Storage spaces and storage pools can be managed by an administrator through the use of the Windows Storage Management API, Server Manager, or Windows PowerShell.
One of the advantages of using the Storage Spaces technology is the ability to set up resiliency. There are three types of Storage Space resiliency: mirror, parity, and simple (no resiliency).
* * *
Fault tolerance (RAID) is discussed in detail in the "Redundant Array of Independent Disks" section.
* * *
Now that you understand what storage spaces and storage pools do, let's take a look at some of the other advantages of using these features in Windows Server 2012 R2.
Availability One advantage to the Storage Spaces technology is the ability to fully integrate the storage space with failover clustering. This advantage allows administrators to achieve service deployments that are continuously available. Administrators have the ability to set up storage pools to be clustered across multiple nodes within a single cluster.
Tiered Storage The Storage Spaces technology allows virtual disks to be created with a two-tier storage setup. For data that is used often, you have an SSD tier; for data that is not used often, you use an HDD tier. The Storage Spaces technology will automatically transfer data at a subfile level between the two different tiers based on how often the data is used. Because of tiered storage, performance is greatly increased for data that is used most often, and data that is not used often still gets the advantage of being stored on a low-cost storage option.
Delegation One advantage of using storage pools is that administrators have the ability to control access by using access control lists (ACLs). What is nice about this advantage is that each storage pool can have its own unique access control lists. Storage pools are fully integrated with Active Directory Domain Services.
### Redundant Array of Independent Disks
The ability to support drive sets and arrays using _Redundant Array of Independent Disks (RAID)_ technology is built into Windows Server 2012 R2. RAID can be used to enhance data performance, or it can be used to provide fault tolerance to maintain data integrity in case of a hard disk failure. Windows Server 2012 R2 supports three types of RAID technologies: RAID-0, RAID-1, and RAID-5.
RAID-0 (Disk Striping) _Disk striping_ is using two or more volumes on independent disks created as a single striped set. There can be a maximum of 32 disks. In a striped set, data is divided into blocks that are distributed sequentially across all of the drives in the set. With RAID-0 disk striping, you get very fast read and write performance because multiple blocks of data can be accessed from multiple drives simultaneously. However, RAID-0 does not offer the ability to maintain data integrity during a single disk failure. In other words, RAID-0 is not fault tolerant; a single disk event will cause the entire striped set to be lost, and it will have to be re-created through some type of recovery process, such as a tape backup.
RAID-1 (Disk Mirroring) _Disk mirroring_ is two logical volumes on two separate identical disks created as a duplicate disk set. Data is written on two disks at the same time; that way, in the event of a disk failure, data integrity is maintained and available. Although this fault tolerance gives administrators data redundancy, it comes with a price because it diminishes the amount of available storage space by half. For example, if an administrator wants to create a 300GB mirrored set, they would have to install two 300GB hard drives into the server, thus doubling the cost for the same available space.
RAID-5 Volume (Disk Striping with Parity) With a RAID-5 volume, you have the ability to use a minimum of three disks and a maximum of 32 disks. RAID-5 volumes allow data to be striped across all of the disks with an additional block of error-correction called parity. _Parity_ is used to reconstruct the data in the event of a disk failure. RAID-5 has slower write performance than the other RAID types because the OS must calculate the parity information for each stripe that is written, but the read performance is equivalent to a stripe set, RAID-0, because the parity information is not read. Like RAID-1, RAID-5 comes with additional cost considerations. For every RAID-5 set, roughly an entire hard disk is consumed for storing the parity information. For example, a minimum RAID-5 set requires three hard disks, and if those disks are 300GB each, approximately 600GB of disk space is available to the OS and 300GB is consumed by parity information, which equates to 33.3 percent of the available space. Similarly, in a five-disk RAID-5 set of 300GB disks, approximately 1,200GB of disk space is available to the OS, which means that 20 percent of the total available space is consumed by the parity information. The words _roughly_ and _approximately_ are used when calculating disk space because a 300GB disk will really be only about 279GB of space. This is because vendors define a gigabyte as 1 billion bytes, but the OS defines it as 230 (1,073,741,824) bytes. Also, remember that file systems and volume managers have overhead as well.
* * *
Software RAID is a nice option for a small company, but hardware RAID is definitely a better option if the money is available.
* * *
Table 1.4 breaks down the various aspects of the supported RAID types in Window Server 2012 R2.
**TABLE 1.4** Supported RAID-level properties in Windows Server 2012 R2
RAID Level | RAID Type | Fault Tolerant | Advantages | Minimum Number of Disks | Maximum Number of Disks
---|---|---|---|---|---
0 | Disk striping | No | Fast reads and writes | 2 | 32
1 | Disk mirroring | Yes | Data redundancy and faster writes than RAID-5 | 2 | 2
5 | Disk striping with parity | Yes | Data redundancy with less overhead and faster reads than RAID-1 | 3 | 32
#### Creating RAID Sets
Now that you understand the concepts of RAID and how to use it, you can look at the creation of RAID sets in Windows Server 2012 R2. The process of creating a RAID set is the same as the process for creating a simple or spanned volume set, except for the minimum disk requirements associated with each RAID type.
Creating a mirrored volume set is basically the same as creating a volume set, as shown in Exercise 1.6, except that you will select New Mirrored Volume. It is after the disk select wizard appears that you'll begin to see the difference. Since a new mirrored volume is being created, the volume requires two disks.
During the disk select process, if only one disk is selected, the Next button will be unavailable because the disk minimum has not been met. Refer to Figure 1.3 to view the Select Disks page of the New Mirrored Volume Wizard during the creation of a new mirrored volume, and notice that the Next button is not available.
**FIGURE 1.3** Select Disks page of the New Mirrored Volume Wizard
To complete the process, you must select a second disk by highlighting the appropriate disk and adding it to the volume set. Once the second disk has been added, the Add button becomes unavailable, and the Next button is available to complete the mirrored volume set creation (see Figure 1.4).
**FIGURE 1.4** Adding the second disk to complete a mirrored volume set
After you click Next, the creation of the mirrored volume set is again just like the rest of the steps in Exercise 1.5. A drive letter will have to be assigned, and the volume will need to be formatted. The new mirrored volume set will appear in Disk Management. In Figure 1.5, notice that the capacity of the volume equals one disk even though two disks have been selected.
**FIGURE 1.5** Newly created mirrored volume set
To create a RAID-5 volume set, you use the same process that you use to create a mirrored volume set. The only difference is that a RAID-5 volume set requires that a minimum of three disks be selected to complete the volume creation. The process is simple: Select New RAID-5 Volume, select the three disks that will be used in the volume set, assign a drive letter, and format the volume. Figure 1.6 shows a newly created RAID-5 volume set in Disk Management.
**FIGURE 1.6** Newly created RAID-5 volume set
### Mount Points
With the ever-increasing demands of storage, mount points are used to surpass the limitation of 26 drive letters and to join two volumes into a folder on a separate physical disk drive. A _mount point_ allows you to configure a volume to be accessed from a folder on another existing disk.
Through Disk Management, a mount point folder can be assigned to a drive instead of using a drive letter, and it can be used on basic or dynamic volumes that are formatted with NTFS. However, mount point folders can be created only on empty folders within a volume. Additionally, mount point folder paths cannot be modified; they can be removed only once they have been created. Exercise 1.6 shows the steps to create a mount point.
* * *
### EXERCISE 1.6: Creating Mount Points
1. Open Server Manager.
2. Click and then expand Storage.
3. Select Disk Management.
4. Right-click the volume where the mount point folder will be assigned, and select Change Drive Letter And Paths.
5. Click Add.
6. Either type the path to an empty folder on an NTFS volume or click Browse to select or make a new folder for the mount point.
When you explore the drive, you'll see the new folder created. Notice that the icon indicates that it is a mount point.
* * *
### Microsoft MPIO
_Multipath I/O (MPIO)_ is associated with high availability because a computer will be able to use a solution with redundant physical paths connected to a storage device. Thus, if one path fails, an application will continue to run because it can access the data across the other path.
The MPIO software provides the functionality needed for the computer to take advantage of the redundant storage paths. MPIO solutions can also load-balance data traffic across both paths to the storage device, virtually eliminating bandwidth bottlenecks to the computer. What allows MPIO to provide this functionality is the new native _Microsoft Device Specific Module (Microsoft DSM)_. The Microsoft DSM is a driver that communicates with storage devices—iSCSI, Fibre Channel, or SAS—and it provides the chosen load-balancing policies. Windows Server 2012 R2 supports the following load-balancing policies:
Failover In a failover configuration, there is no load balancing. There is a primary path that is established for all requests and subsequent standby paths. If the primary path fails, one of the standby paths will be used.
Failback This is similar to failover in that it has primary and standby paths. However, with failback you designate a preferred path that will handle all process requests until it fails, after which the standby path will become active until the primary reestablishes a connection and automatically regains control.
Round Robin In a round-robin configuration, all available paths will be active and will be used to distribute I/O in a balanced round-robin fashion.
Round Robin with a Subset of Paths In this configuration, a specific set of paths will be designated as a primary set and another as standby paths. All I/O will use the primary set of paths in a round-robin fashion until all of the sets fail. Only at this time will the standby paths become active.
Dynamic Least Queue Depth In a dynamic least queue depth configuration, I/O will route to the path with the least number of outstanding requests.
Weighted Path In a weighted path configuration, paths are assigned a numbered weight. I/O requests will use the path with the least weight—the higher the number, the lower the priority.
Exercise 1.7 demonstrates the process of installing the Microsoft MPIO feature for Windows Server 2012 R2.
* * *
### EXERCISE 1.7: Installing Microsoft MPIO
1. Choose Server Manager by clicking the Server Manager icon on the Taskbar.
2. Click number 2, Add Roles And Features.
3. Choose role-based or feature-based installation and click Next.
4. Choose your server and click Next.
5. Click Next on the Roles screen.
6. On the Select Features screen, choose the Multipath I/O check box. Click Next.
7. On the Confirm Installation Selections page, verify that Multipath I/O is the feature that will be installed. Click Install.
8. After the installation completes, the Installation Results page appears stating that the server must be rebooted to finish the installation process.
9. Click Close.
10. Restart the system.
* * *
Typically, most storage arrays work with the Microsoft DSM. However, some hardware vendors require DSM software that is specific to their products. Third-party DSM software is installed through the MPIO utility as follows:
1. Open Administrative Tools MPIO.
2. Select the DSM Install tab (see Figure 1.7).
**FIGURE 1.7** The DSM Install tab in the MPIO Properties dialog box
3. Add the path of the INF file and click Install.
### iSCSI
_Internet Small Computer System Interface (iSCSI)_ is an interconnect protocol used to establish and manage a connection between a computer (initiator) and a storage device (target). It does this by using a connection through TCP port 3260, which allows it to be used over a LAN, a WAN, or the Internet. Each initiator is identified by its iSCSI Qualified Name (iqn), and it is used to establish its connection to an iSCSI target.
iSCSI was developed to allow block-level access to a storage device over a network. This is different from using a network attached storage (NAS) device that connects through the use of Common Internet File System (CIFS) or Network File System (NFS).
Block-level access is important to many applications that require direct access to storage. Microsoft Exchange and Microsoft SQL are examples of applications that require direct access to storage.
By being able to leverage the existing network infrastructure, iSCSI was also developed as an alternative to Fibre Channel storage by alleviating the additional hardware costs associated with a Fibre Channel storage solution.
iSCSI also has another advantage over Fibre Channel in that it can provide security for the storage devices. iSCSI can use Challenge Handshake Authentication Protocol (CHAP or MS-CHAP) for authentication and Internet Protocol Security (IPsec) for encryption. Windows Server 2012 R2 is able to connect an iSCSI storage device out of the box with no additional software needing to be installed. This is because the Microsoft iSCSI initiator is built into the operating system.
Windows Server 2012 R2 supports two different ways to initiate an iSCSI session.
* Through the native Microsoft iSCSI software initiator that resides on Windows Server 2012 R2
* Using a hardware iSCSI host bus adapter (HBA) that is installed in the computer
Both the Microsoft iSCSI software initiator and iSCSI HBA present an iSCSI qualified name that identifies the host initiator. When the Microsoft iSCSI software initiator is used, the CPU utilization may be as much as 30 percent higher than on a computer with a hardware iSCSI HBA. This is because all of the iSCSI process requests are handled within the operating system. Using a hardware iSCSI HBA, process requests can be offloaded to the adapter, thus freeing the CPU overhead associated with the Microsoft iSCSI software initiator. However, iSCSI HBAs can be expensive, whereas the Microsoft iSCSI software initiator is free.
It is worthwhile to install the Microsoft iSCSI software initiator and perform load testing to see how much overhead the computer will have prior to purchasing an iSCSI HBA or HBAs, depending on the redundancy level. Exercise 1.8 explains how to install and configure an iSCSI connection.
* * *
### EXERCISE 1.8: Configuring iSCSI Storage Connection
1. Click the Windows key or Start button in the left-hand corner Administrative Tools iSCSI Initiator.
2. If a dialog box appears, click Yes to start the service.
3. Click the Discovery tab.
4. In the Target Portals portion of the page, click Discover Portal.
5. Enter the IP address of the target portal and click OK.
6. The IP address of the target portal appears in the Target Portals box.
7. Click OK.
To use the storage that has now been presented to the server, you must create a volume on it and format the space. Refer to Exercise 1.3 to review this process.
* * *
### Internet Storage Name Service
_Internet Storage Name Service (iSNS)_ allows for central registration of an iSCSI environment because it automatically discovers available targets on the network. The purpose of iSNS is to help find available targets on a large iSCSI network.
The Microsoft iSCSI initiator includes an iSNS client that is used to register with the iSNS. The iSNS feature maintains a database of clients that it has registered either through DCHP discovery or through manual registration. iSNS DHCP is available after the installation of the service, and it is used to allow iSNS clients to discover the location of the iSNS. However, if iSNS DHCP is not configured, iSNS clients must be registered manually with the `iscsicli` command.
To execute the command, launch a command prompt on a computer hosting the Microsoft iSCSI and type `**iscsicli addisnsserver server_name**`, where `**server_name**` is the name of the computer hosting iSNS. Exercise 1.9 walks you through the steps required to install the iSNS feature on Windows Server 2012 R2, and then it explains the different tabs in iSNS.
* * *
### EXERCISE 1.9: Installing the iSNS Feature on Windows Server 2012 R2
1. Choose Server Manager by clicking the Server Manager icon on the Taskbar.
2. Click number 2 Add Roles And Features.
3. Choose role-based or featured-based installation and click Next.
4. Choose your server and click Next.
5. Click Next on the Roles screen.
6. On the Select Features screen, choose the iSNS Server Service check box. Click Next.
7. On the Confirmation screen, click the Install button.
8. Click the Close button. Close Server Manager and reboot.
9. Log in and open the iSNS server under Administrative Tools.
10. Click the General tab. This tab displays the list of registered initiators and targets. In addition to their iSCSI qualified name, it lists storage node type (Target or Initiator), alias string, and entity identifier (the Fully Qualified Domain Name [FQDN] of the machine hosting the iSNS client).
11. Click the Discovery Domains tab. The purpose of Discovery Domains is to provide a way to separate and group nodes. This is similar to zoning in Fibre Channel. The following options are available on the Discovery Domains tab:
* _Create_ is used to create a new discovery domain.
* _Refresh_ is used to repopulate the Discovery Domain drop-down list.
* _Delete_ is used to delete the currently selected discovery domain.
* _Add_ is used to add nodes that are already registered in iSNS to the currently selected discovery domain.
* _Add New_ is used to add nodes by entering the iSCSI Qualified Name (iQN) of the node. These nodes do not have to be currently registered.
* _Remove Used_ is used to remove selected nodes from the discovery domain.
12. Click the Discovery Domain Sets tab. The purpose of discovery domain sets is to separate further discovery domains. Discovery domains can be enabled or disabled, giving administrators the ability to restrict further the visibility of all initiators and targets. The options on the Discovery Domain Sets tab are as follows:
* The _Enable_ check box is used to indicate the status of the discovery domain sets and to turn them off and on.
* _Create_ is used to create new discovery domain sets.
* _Refresh_ is used to repopulate the Discovery Domain Sets drop-down list.
* _Delete_ is used to delete the currently selected discovery domain set.
* _Add_ is used to add discovery domains to the currently selected discovery domain set.
* _Remove_ is used to remove selected nodes from the discovery domain sets.
13. Close the iSNS server.
* * *
### Fibre Channel
_Fibre Channel_ storage devices are similar to iSCSI storage devices in that they both allow block-level access to their data sets and can provide MPIO policies with the proper hardware configurations. However, Fibre Channel requires a Fibre Channel HBA, fiber-optic cables, and Fibre Channel switches to connect to a storage device.
A _World Wide Name (WWN)_ from the Fibre Channel HBA is used from the host and device so that they can communicate directly with each other, similar to using a NIC's MAC address. In other words, a logical unit number (LUN) is presented from a Fibre Channel storage device to the WWN of the host's HBA. Fibre Channel has been the preferred method of storage because of the available connection bandwidth between the storage and the host.
Fibre Channel devices support 1Gb/s, 2Gb/s, and 4Gb/s connections, and they soon will support 8Gb/s connections, but now that 10Gb/s Ethernet networks are becoming more prevalent in many datacenters, iSCSI can be a suitable alternative. It is important to consider that 10Gb/s network switches can be more expensive than comparable Fibre Channel switches.
_N-Port Identification Virtualization (NPIV)_ is a Fibre Channel facility allowing multiple n-port IDs to share a single physical N-Port. This allows multiple Fibre Channel initiators to occupy a single physical port. By using a single port, this eases hardware requirements in storage area network (SAN) design.
### Network Attached Storage
The concept of a _network attached storage (NAS)_ solution is that it is a low-cost device for storing data and serving files through the use of an Ethernet LAN connection. A NAS device accesses data at the file level via a communication protocol such as NFS, CIFS, or even HTTP, which is different from iSCSI or FC Fibre Channel storage devices that access the data at the block level. NAS devices are best used in file-storing applications, and they do not require a storage expert to install and maintain the device. In most cases, the only setup that is required is an IP address and an Ethernet connection.
### Virtual Disk Service
_Virtual Disk Service (VDS)_ was created to ease the administrative efforts involved in managing all of the various types of storage devices. Many storage hardware providers used their own applications for installation and management, and this made administering all of these various devices very cumbersome.
VDS is a set of application programming interfaces (APIs) that provides a centralized interface for managing all of the various storage devices. The native VDS API enables the management of disks and volumes at an OS level, and hardware vendor-supplied APIs manage the storage devices at a RAID level. These are known as software and hardware providers.
A _software provider_ is host based, and it interacts with Plug and Play Manager because each disk is discovered and operates on volumes, disks, and disk partitions. VDS includes two software providers: basic and dynamic. The basic software provider manages basic disks with no fault tolerance, whereas the dynamic software providers manage dynamic disks with fault management. A hardware provider translates the VDS APIs into instructions specific to the storage hardware. This is how storage management applications are able to communicate with the storage hardware to create LUNs or Fibre Channel HBAs to view the WWN. The following are Windows Server 2012 R2 storage management applications that use VDS:
* The _Disk Management snap-in_ is an application that allows you to configure and manage the disk drives on the host computer. You have already seen this application in use when you initialized disks and created volume sets.
* `DiskPart` is a command-line utility that configures and manages disks, volumes, and partitions on the host computer. It can also be used to script many of the storage management commands. `DiskPart` is a robust tool that you should study on your own because it is beyond the scope of this book. Figure 1.8 shows the various commands and their function in the `DiskPart` utility.
**FIGURE 1.8** `DiskPart` commands
* `DiskRAID` is also a scriptable command-line utility that configures and manages hardware RAID storage systems. However, at least one VDS hardware provider must be installed for `DiskRAID` to be functional. `DiskRAID` is another useful utility that you should study on your own because it's beyond the scope of this book.
#### Booting from a VHD
Once you have installed each operating system, you can choose the operating system that you will boot to during the boot process. You will see a boot selection screen that asks you to choose which operating system you want to boot.
The Boot Configuration Data (BCD) store contains boot information parameters that were previously found in `boot.ini` in older versions of Windows. To edit the boot options in the BCD store, use the `bcdedit` utility, which can be launched only from a command prompt. To open a command prompt window, do the following:
1. Launch `\Windows\system32\cmd.exe`.
2. Open the Run command by pressing the Windows key plus the R key and then entering **`cmd`**.
3. Type **`cmd.exe`** in the Search Programs And Files box and press Enter.
After the command prompt window is open, type **`bcdedit`** to launch the `bcdedit` utility. You can also type **`bcdedit /?`** to see all of the different `bcdedit` commands.
* * *
Virtualization is covered in greater detail in Chapter 9: "Use Virtualization in Windows Server 2012."
* * *
## Summary
In this chapter, you studied the latest advantages of using Windows Server 2012 R2. You also learned about the different roles and features you can install on a Windows Server 2012 R2 machine. You also explored how to migrate those roles and features from a Windows Server 2008, 2008 R2, and Windows Server 2012 machine to a Windows Server 2012 R2 machine.
I discussed the different upgrade paths that are available and which upgrades are best for your current network setup. You learned that another important issue to decide when installing Windows Server 2012 R2 is whether to use Server Core or the GUI installation.
You learned how to install Windows Server 2012 R2 Datacenter with GUI, and you installed the Windows Server 2012 R2 Server Core. Remember, Server Core is a slimmed-down version of Windows Server. With no GUI desktop available, it's a safer alternative to a normal Windows install. As discussed, a nice advantage of Windows Server 2012 R2 is that you can change from Server Core to the GUI version and back again.
I discussed a feature called Features On Demand. This feature allows you to remove roles and features from the operating system and remove the associated files completely from the hard drive, thus saving disk space.
You examined the various aspects of Windows Server 2012 R2 storage services as well as the various types of storage technologies and native Windows Server 2012 R2 storage management tools. I started the chapter by discussing initializing disks and choosing a partition type: MBR or GPT. I then discussed the types of disk configurations, dynamic and basic, that are supported in Windows Server 2012 R2. You learned that various properties are associated with each type of configuration. Then I discussed the different types of RAID and the properties of each.
The next section explored storage technologies, namely, iSCSI, Fibre Channel, and NAS. I primarily focused on iSCSI because of the native support in Window Server 2012 R2. You learned how to configure an iSCSI initiator and a connection to an iSCSI target. After that, you looked at its iSNS server and how to configure it.
The chapter concluded by looking at Storage Manager for SANs and Storage Explorer, which are built-in management tools in Windows Server 2012 R2 for storage devices and firewall settings.
## Exam Essentials
Understand the upgrade paths. It's important to make sure you understand the different upgrade paths from Windows Server 2008 R2 with SP1 and Windows Server 2012 to Windows Server 2012 R2.
Understand Windows Server 2012 R2 server roles. Understand what the Windows Server 2012 R2 server roles do for an organization and its users.
Understand Windows Server 2012 R2 GUI vs. Server Core. Understand the difference between the Windows Server 2012 R2 GUI version and the Windows Server 2012 R2 Server Core version. Know the benefits of using Server Core, and know that you can convert between the two different versions.
Understand Features On Demand. Understand the new feature called Features On Demand. Microsoft loves to ask exam questions about its new features, and this will be no exception. Understand how features and roles stay on the system until you physically remove them from the hard drive.
Know disk types. Know how to initialize disks and the type of partitioning to choose. Also know the difference between dynamic and basic disks and when to use them.
Understand RAID. Know the various RAID types, the requirements for each, and when it is appropriate to use each type.
Know storage technologies. Understand how to use the storage technologies Fibre Channel, iSCSI, and NAS. Know how to configure an iSCSI initiator and how to establish a connection to a target. Know the various MPIO policies.
Understand how to manage storage. Know what type of administrative features are available for Storage Manager for SANs and Storage Explorer.
## Review Questions
1. You are the administrator for the ABC Company. You are looking to install Windows Server 2012 R2, and you need to decide which version to install. You need to install a version of Windows that is just for logon authentication and nothing else. You want the most secure option and cost is not an issue. What should you install?
1. Windows Server 2012 R2 Datacenter with GUI
2. Windows Server 2012 R2 Datacenter Server Core
3. Windows Server 2012 R2 Standard with GUI
4. Windows Server 2012 R2 Web Server Core
2. You are the IT manager for a large organization. One of your co-workers installed a new Windows Server 2012 R2 Datacenter Server Core machine, but now the IT team has decided that it should be a Windows Server 2012 R2 Datacenter with GUI. What should you do?
1. Reinstall Windows Server 2012 R2 Datacenter Server Core on the same machine.
2. Install a new machine with Windows Server 2012 R2 Datacenter Server Core.
3. Convert the current Windows Server 2012 R2 Datacenter Server Core to the Windows Server 2012 R2 Datacenter with GUI version.
4. Dual-boot the machine with both Windows Server 2012 R2 Datacenter Server Core and Windows Server 2012 R2 Datacenter with GUI.
3. You are the administrator for your company, and you are looking at upgrading your Windows Server 2008 web server to Windows Server 2012 R2. Which version of Windows Server 2012 R2 does Microsoft recommend you use?
1. Windows Server 2012 R2 Datacenter
2. Windows Server 2012 R2 Standard
3. Windows Server 2012 R2 Essentials
4. Windows Server 2012 R2 Foundation
4. You are looking at upgrading your Windows Server 2008 R2 Enterprise with SP2 machine to Windows Server 2012 R2. Your organization is considering virtualizing its entire server room, which has 25 servers. To which version of Windows Server 2012 R2 would you upgrade?
1. Windows Server 2012 R2 Datacenter
2. Windows Server 2012 R2 Standard
3. Windows Server 2012 R2 Essentials
4. Windows Server 2012 R2 Foundation
5. You have been hired to help a small company set up its first Windows network. It has had the same 13 users for the entire two years it has been open, and the company has no plans to expand. What version of Windows Server 2012 R2 would you recommend?
1. Windows Server 2012 R2 Datacenter
2. Windows Server 2012 R2 Standard
3. Windows Server 2012 R2 Essentials
4. Windows Server 2012 R2 Foundation
6. You have been hired to help a small company set up its Windows network. It has 20 users, and it has no plans to expand. What version of Windows Server 2012 R2 would you recommend?
1. Windows Server 2012 R2 Datacenter
2. Windows Server 2012 R2 Standard
3. Windows Server 2012 R2 Essentials
4. Windows Server 2012 R2 Foundation
7. Which of the following are benefits of using Windows Server 2012 R2 Server Core? (Choose all that apply.)
1. Reduced management
2. Minimal maintenance
3. Smaller footprint
4. Tighter security
8. You are a server administrator, and you are trying to save hard drive space on your Windows Server 2012 R2 Datacenter machine. Which feature can help you save hard disk space?
1. `HDSaver.exe`
2. Features On Demand
3. ADDS
4. WinRM
9. You have a server named SRV1 that runs Windows Server 2012 R2. You want to remove Windows Explorer, Windows Internet Explorer, and all components and files from this machine. Which command should you run?
1. `msiexec.exe /uninstall iexplore.exe /x`
2. `msiexec.exe /uninstall explorer.exe /x`
3. `Uninstall-WindowsFeature Server-Gui-Mgmt-Infra Remove`
4. `Uninstall-WindowsFeature Server-Gui-Shell Remove`
10. What type of domain controller would you install into an area where physical security is a concern?
1. Primary domain controller
2. Backup domain controller
3. Read-only domain controller
4. Locked-down domain controller
# Chapter 2
Configure Network Services
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Deploy and configure DNS service**
* Configure Active Directory integration of primary zones
* Configure forwarders
* Configure Root Hints
* Manage DNS cache
* Create A and PTR resource records
2. **Deploy and configure Dynamic Host Configuration Protocol (DHCP) service**
* Create and configure scopes
* Configure a DHCP reservation
* Configure DHCP options
* Configure client and server for PXE boot
* Configure DHCP relay agent
* Authorize DHCP server
The Domain Name System (DNS) is one of the key topics that you'll need to understand if you plan to take any of the Microsoft Windows Server 2012 R2 administration exams (70-410, 70-411, 70-412, and so forth).
It's also imperative that you understand DNS to work with Active Directory because it requires DNS to function properly, and many important system functions (including Kerberos authentication and finding domain controllers) are handled through DNS lookups. Windows 2000, Windows XP, Windows Vista, Windows 7, and Windows 8 clients use DNS for name resolution and to find Kerberos key distribution centers (KDCs), global catalog servers, and other services that may be registered in DNS.
By the time you complete this chapter, you will have a deeper understanding of how DNS works and how to set up, configure, manage, and troubleshoot DNS in Microsoft Windows Server 2012 R2.
In this chapter, you'll also learn how to install and manage DHCP, including how to set up plain DHCP scopes, superscopes, and multicast scopes. You'll also learn how to set up integration between Dynamic DNS and DHCP and how to authorize a DHCP server to integrate with Active Directory.
* * *
There are two versions of DHCP: DHCP v4 and DHCP v6. In this chapter, I will just say "DHCP server" when referring to the physical DHCP server. If I am referring to a specific version of DHCP, I will specify the version.
* * *
## Introducing DNS
The _Domain Name System (DNS)_ is a service that allows you to resolve a hostname to an Internet Protocol (IP) address. One of the inherent complexities of operating in networked environments is working with multiple protocols and network addresses. Owing largely to the tremendous rise in the popularity of the Internet, however, most environments have transitioned to use _Transmission Control Protocol/Internet Protocol (TCP/IP)_ as their primary networking protocol. Microsoft is no exception when it comes to supporting TCP/IP in its workstation and server products. All current versions of Microsoft's operating systems support TCP/IP, as do most other modern operating systems.
An easy way to understand DNS is to think about making a telephone call. If you wanted to call Microsoft and did not know the phone number, you could call information, tell them the name (Microsoft), and get the telephone number. You would then make the call. Now think about trying to connect to Server1. You don't know the TCP/IP number (the computer's telephone number), so your computer asks DNS (information) for the number of Server1. DNS returns the number, and your system makes the connection (call). DNS is your network's 411, or information, and it returns the TCP/IP data for your network.
TCP/IP is actually a collection of different technologies (protocols and services) that allow computers to function together on a single, large, and heterogeneous network. Some of the major advantages of this protocol include widespread support for hardware, software, and network devices; reliance on a system of standards; and scalability. TCP handles tasks such as sequenced acknowledgments. IP involves many jobs, such as logical subnet assignment and routing.
### The Form of an IP Address
To understand DNS, you must first understand how TCP/IP addresses are formed. Because DNS is strictly on a network to support TCP/IP, understanding the basics of TCP/IP is extremely important.
* * *
Microsoft exams cover TCP/IP. The TCP/IP material will be covered in Chapter 8, "Configure TCP/IP."
* * *
An _IP address_ is a logical number that uniquely identifies a computer on a TCP/IP network. TCP/IP allows a computer packet to reach the correct host. Windows Server 2012 R2 works with two versions of TCP/IP: IPv4 and IPv6. An IPv4 address takes the form of four octets (eight binary bits), each of which is represented by a decimal number between 0 and 255. The four numbers are separated by decimal points. For example, all of the following are valid IP addresses:
* 128.45.23.17
* 230.212.43.100
* 10.1.1.1
The dotted decimal notation was created to make it easier for users to deal with IP addresses, but this idea did not go far enough. As a result, another abstraction layer was developed, which used names to represent the dotted decimal notation—the domain name. For example, the IP address 11000000 10101000 00000001 00010101 maps to 192.168.1.21, which in turn might map to `server1.company.org`, which is how the computer's address is usually presented to the user or application.
As stated earlier, IPv4 addresses are made up of octets, or the decimal (base 10) representation of 8 bits. It takes four octets to add up to the 32 bits required. IPv6 expands the address space to 128 bits. The address is usually represented in hexadecimal notation as follows:
2001:0DB8:0000:0000:1234:0000:A9FE:133E
You can tell that the implementation of DNS would make life a lot easier for everyone, even those of us who like to use alphanumeric values. (For example, some of us enjoy pinging the address in lieu of the name.) Fortunately, DNS already has the ability to handle IPv6 addresses using an AAAA record. An A record in IPv4's addressing space is 32 bits, and an AAAA record (4 _A_ s) in IPv6's is 128 bits.
Nowadays, most computer users are quite familiar with navigating to DNS-based resources, such as `www.microsoft.com`. To resolve these "friendly" names to TCP/IP addresses that the network stack can use, you need a method for mapping them. Originally, ASCII flat files (often called HOSTS files, as shown in Figure 2.1) were used for this purpose. In some cases, they are still used today in small networks, and they can be useful in helping to troubleshoot name resolution problems.
**FIGURE 2.1** HOSTS file
As the number of machines and network devices grew, it became unwieldy for administrators to manage all of the manual updates required to enter new mappings to a master HOSTS file and distribute it. Clearly, a better system was needed.
As you can see from the sample HOSTS file in Figure 2.1, you can conduct a quick test of the email server's name resolution as follows:
1. Open the HOSTS file: `C:\Windows\Systems32\drivers\etc`.
2. Add the IP-address-to-hostname mapping.
3. Try to ping the server using the hostname to verify that you can reach it using an easy-to-remember name.
Following these steps should drive home the concept of DNS for you because you can see it working to make your life easier. Now you don't have to remember 10.0.0.10; you only need to remember exchange03. However, you can also see how this method can become unwieldy if you have many hosts that want to use easy-to-remember names instead of IP addresses to locate resources on your network.
When dealing with large networks, users and network administrators must be able to locate the resources they require with minimal searching. Users don't care about the actual physical or logical network address of the machine; they just want to be able to connect to it using a simple name that they can remember.
From a network administrator's standpoint, however, each machine must have its own logical address that makes it part of the network on which it resides. Therefore, some scalable and easy-to-manage method for resolving a machine's logical name to an IP address and then to a domain name is required. DNS was created just for this purpose.
DNS is a hierarchically distributed database. In other words, its layers are arranged in a definite order, and its data is distributed across a wide range of machines, each of which can exert control over a portion of the database. DNS is a standard set of protocols that defines the following:
* A mechanism for querying and updating address information in the database
* A mechanism for replicating the information in the database among servers
* A schema of the database
* * *
DNS is defined by a number of requests for comments (RFCs), though primarily by RFC 1034 and RFC 1035.
* * *
DNS was originally developed in the early days of the Internet (called ARPAnet at the time) when it was a small network created by the Department of Defense for research purposes. Before DNS, computer names, or hostnames, were manually entered into a HOSTS file located on a centrally administered server. Each site that needed to resolve hostnames outside of its organization had to download this file. As the number of computers on the Internet grew, so did the size of this HOSTS file—and along with it the problems of its management. The need for a new system that would offer features such as scalability, decentralized administration, and support for various data types became more and more obvious. DNS, introduced in 1984, became this new system.
With DNS, the hostnames reside in a database that can be distributed among multiple servers, decreasing the load on any one server and providing the ability to administer this naming system on a per-partition basis. DNS supports hierarchical names and allows for the registration of various data types in addition to the hostname-to-IP-address mapping used in HOSTS files. Database performance is ensured through its distributed nature as well as through caching.
The DNS distributed database establishes an inverted logical tree structure called the _domain namespace_. Each node, or domain, in that space has a unique name. At the top of the tree is the root. This may not sound quite right, which is why the DNS hierarchical model is described as being an inverted tree, with the root at the top. The root is represented by the null set `""`. When written, the root node is represented by a single dot (`.`).
Each node in the DNS can branch out to any number of nodes below it. For example, below the root node are a number of other nodes, commonly referred to as _top-level domains (TLDs)_. These are the familiar `.com`, `.net`, `.org`, `.gov`, `.edu`, and other such names. Table 2.1 lists some of these TLDs.
**TABLE 2.1** Common top-level DNS domains
Common top-level domain names | Type of organization
---|---
`com` | Commercial (for example, `stellacon.com` for Stellacon Training Corporation).
`edu` | Educational (for example, `gatech.edu` for the Georgia Institute of Technology)
`gov` | Government (for example, `whitehouse.gov` for the White House in Washington, D.C.)
`int` | International organizations (for example, `nato.int` for NATO); this top-level domain is fairly rare
`mil` | Military organizations (for example, `usmc.mil` for the Marine Corps); there is a separate set of root name servers for this domain
`net` | Networking organizations and Internet providers (for example, `hiwaay.net` for HiWAAY Information Systems); many commercial organizations have registered names under this domain too
`org` | Noncommercial organizations (for example, `fidonet.org` for FidoNet)
`au` | Australia
`uk` | United Kingdom
`ca` | Canada
`us` | United States
`jp` | Japan
Each of these nodes then branches out into another set of domains, and they combine to form what we refer to as domain names, such as `microsoft.com`. A _domain name_ identifies the domain's position in the logical DNS hierarchy in relation to its parent domain by separating each branch of the tree with a dot. Figure 2.2 shows a few of the top-level domains, where the Microsoft domain fits, and a host called Tigger within the `microsoft.com` domain. If someone wanted to contact that host, they would use the _fully qualified domain name (FQDN)_ , `tigger.microsoft.com`.
**FIGURE 2.2** The DNS hierarchy
An FQDN includes the trailing dot (`.`) to indicate the root node, but it's commonly left off in practice.
As previously stated, one of the strengths of DNS is the ability to delegate control over portions of the DNS namespace to multiple organizations. For example, the Internet Corporation for Assigned Names and Numbers (ICANN) assigns the control over TLDs to one or more organizations. In turn, those organizations delegate portions of the DNS namespace to other organizations. For example, when you register a domain name, let's call it `example.com`, you control the DNS for the portion of the DNS namespace within `example.com`. The registrar controlling the `.com` TLD has delegated control over the `example.com` node in the DNS tree. No other node can be named `example` directly below the `.com` within the DNS database.
Within the portion of the domain namespace that you control (`example.com`), you could create host and other records (more on these later). You could also further subdivide `example.com` and delegate control over those divisions to other organizations or departments. These divisions are called _subdomains_. For example, you might create subdomains named for the cities in which the company has branch offices and then delegate control over those subdomains to the branch offices. The subdomains might be named `losangeles.example.com`, `chicago.example.com`, `portsmouth.example.com`, and so on.
Each domain (or delegated subdomain) is associated with DNS name servers. In other words, for every node in the DNS, one or more servers can give an authoritative answer to queries about that domain. At the root of the domain namespace are the root servers. More on these later.
* * *
Domain names and hostnames must contain only characters `a` to `z`, `A` to `Z`, `0` to `9`, and `-` (hyphen). Other common and useful characters, such as the `&` (ampersand), `/` (slash), `.` (period), and `_` (underscore), are not allowed. This is in conflict with NetBIOS's naming restrictions. However, you'll find that Windows Server 2012 R2 is smart enough to take a NetBIOS name, like `Server_1`, and turn it into a legal DNS name, like `server1.example.com`.
* * *
DNS servers work together to resolve hierarchical names. If a server already has information about a name, it simply fulfills the query for the client. Otherwise, it queries other DNS servers for the appropriate information. The system works well because it distributes the authority over separate parts of the DNS structure to specific servers. A _DNS zone_ is a portion of the DNS namespace over which a specific DNS server has authority (DNS zone types are discussed in detail later in this chapter).
* * *
There is an important distinction to make between DNS zones and Active Directory (AD) domains. Although both use hierarchical names and require name resolution, DNS zones do not map directly to AD domains.
* * *
Within a given DNS zone, resource records (RRs) contain the hosts and other database information that make up the data for the zone. For example, an RR might contain the host entry for `www.example.com`, pointing it to the IP address 192.168.1.10.
### Understanding Servers, Clients, and Resolvers
You will need to know a few terms and concepts in order to manage a DNS server. Understanding these terms will make it easier to understand how the Windows Server 2012 R2 DNS server works.
DNS Server Any computer providing domain name services is a _DNS name server_. No matter where the server resides in the DNS namespace, it's still a DNS name server. For example, 13 root name servers at the top of the DNS tree are responsible for delegating the TLDs. The _root servers_ provide referrals to name servers for the TLDs, which in turn provide referrals to an authoritative name server for a given domain.
* * *
The Berkeley Internet Name Domain (BIND) was originally the only software available for running the root servers on the Internet. However, a few years ago the organizations responsible for the root servers undertook an effort to diversify the software running on these important machines. Today, root servers run multiple types of name server software. BIND is still primarily on Unix-based machines, and it is also the most popular for Internet providers. No root servers run Windows DNS.
* * *
Any DNS server implementation supporting Service Location Resource Records (see RFC 2782) and Dynamic Updates (RFC 2136) is sufficient to provide the name service for any operating system running Windows 2003 software and newer.
DNS Client A _DNS client_ is any machine that issues queries to a DNS server. The client hostname may or may not be registered in a DNS database. Clients issue DNS requests through processes called _resolvers_. You'll sometimes see the terms _client_ and _resolver_ used synonymously.
Resolver _Resolvers_ are software processes, sometimes implemented in software libraries that handle the actual process of finding the answers to queries for DNS data. The resolver is also built into many larger pieces of software so that external libraries don't have to be called to make and process DNS queries. Resolvers can be what you'd consider client computers or other DNS servers attempting to resolve an answer on behalf of a client (for example, Internet Explorer).
Query A _query_ is a request for information sent to a DNS server. Three types of queries can be made to a DNS server: recursive, inverse, and iterative. I'll discuss the differences between these query types in the section "DNS Queries," a bit later in the chapter.
### Understanding the DNS Process
To help you understand the DNS process, I will start by covering the differences between Dynamic DNS and Non-Dynamic DNS. During this discussion, you will learn how Dynamic DNS populates the DNS database. You'll also see how to implement security for Dynamic DNS. I will then talk about the workings of different types of DNS queries. Finally, I will discuss caching and time to live (TTL). You'll learn how to determine the best setting for your organization.
#### Dynamic DNS and Non-Dynamic DNS
To understand Dynamic DNS and Non-Dynamic DNS, you must go back in time. (Here is where the TV screen always used to get wavy.) Many years ago when many of us worked on Windows NT 3.51 and Windows NT 4.0, almost all Microsoft networks used Windows Internet Name Service (WINS) to do their TCP/IP name resolution. Windows versions 95/98 and NT 4.0 Professional were all built on the idea of using WINS. This worked out well for administrators because WINS was dynamic (which meant that once it was installed, it automatically built its own database). Back then, there was no such thing as Dynamic DNS; administrators had to enter DNS records into the server manually. This is important to know even today. If you have clients still running any of these older operating systems (95/98 or NT 4), these clients cannot use Dynamic DNS.
Now let's move forward in time to the release of Windows Server 2000. Microsoft announced that DNS was going to be the name resolution method of choice. Many administrators (myself included) did not look forward to the switch. Because there was no such thing as Dynamic DNS, most administrators had nightmares about manually entering records. However, luckily for us, when Microsoft released Windows Server 2000, DNS had the ability to operate dynamically. Now when you're setting up Windows Server 2012 R2 DNS, you can choose what type of dynamic update you would like to use, if any. Let's talk about why you would want to choose one over the other.
The _Dynamic DNS (DDNS) standard_ , described in RFC 2136, allows DNS clients to update information in the DNS database files. For example, a Windows Server 2012 R2 DHCP server can automatically tell a DDNS server which IP addresses it has assigned to what machines. Windows 2000, 2003, 2008, XP Pro, Vista, Windows 7, and Windows 8 DHCP clients can do this too. For security reasons, however, it's better to let the DHCP server do it. The result: IP addresses and DNS records stay in sync so that you can use DNS and DHCP together seamlessly. Because DDNS is a proposed Internet standard, you can even use the Windows Server 2012 R2 DDNS-aware parts with Unix/Linux-based DNS servers.
Non-Dynamic DNS (NDDNS) does not automatically populate the DNS database. The client systems do not have the ability to update to DNS. If you decide to use Non-Dynamic DNS, an administrator will need to populate the DNS database manually. Non-Dynamic DNS is a reasonable choice if your organization is small to midsized and you do not want extra network traffic (clients updating to the DNS server) or if you need to enter the computer's TCP/IP information manually because of strict security measures.
* * *
Dynamic DNS has the ability to be secure, and the chances are slim that a rogue system (a computer that does not belong in your DNS database) could update to a secure DNS server. Nevertheless, some organizations have to follow stricter security measures and are not allowed to have dynamic updates.
* * *
The major downside to entering records into DNS manually occurs when the organization is using the _Dynamic Host Configuration Protocol (DHCP)_. When using DHCP, it is possible for users to end up with different TCP/IP addresses every day. This means an administrator has to update DNS manually each day to keep it accurate.
If you choose to allow Dynamic DNS, you need to decide how you want to set it up. When setting up dynamic updates on your DNS server, you have three choices (see Figure 2.3).
**FIGURE 2.3** Setting the Dynamic Updates option
None This means your DNS server is Non-Dynamic.
Nonsecure and Secure This means that any machine (even if it does not have a domain account) can register with DNS. Using this setting could allow rogue systems to enter records into your DNS server.
Secure Only This means that only machines with accounts in Active Directory can register with DNS. Before DNS registers any account in its database, it checks Active Directory to make sure that account is an authorized domain computer.
#### How Dynamic DNS Populates the DNS Database
TCP/IP is the protocol used for network communications on a Microsoft Windows Server 2012 R2 network. Users have two ways to receive a TCP/IP number:
* Static (administrators manually enter the TCP/IP information)
* Dynamic (using DHCP)
When an administrator sets up TCP/IP, DNS can also be configured.
Once a client gets the address of the DNS server, if that client is allowed to update with DNS, the client sends a registration to DNS or requests DHCP to send the registration. DNS then does one of two things, depending on which Dynamic Updates option is specified:
* Check with Active Directory to see whether that computer has an account (Secure Only updates), and if it does, enter the record into the database.
* Enter the record into its database (Nonsecure and Secure updates).
What if you have clients that cannot update DNS? Well, there is a solution—DHCP. In the DNS tab of the IPv4 Properties window, check the option labeled "Dynamically update DNS A and PTR records for DHCP clients that do not request updates (for example, clients running Windows NT 4.0)," which is shown in Figure 2.4.
**FIGURE 2.4** DHCP settings for DNS
DHCP, along with Dynamic DNS clients, allows an organization to update its DNS database dynamically without the time and effort of having an administrator manually enter DNS records.
#### DNS Queries
As stated earlier, a client can make three types of queries to a DNS server: recursive, inverse, and iterative. Remember that the client of a DNS server can be a resolver (what you'd normally call a client) or another DNS server.
##### Iterative Queries
_Iterative queries_ are the easiest to understand: A client asks the DNS server for an answer, and the server returns the best answer. This information likely comes from the server's cache. The server never sends out an additional query in response to an iterative query. If the server doesn't know the answer, it may direct the client to another server through a referral.
##### Recursive Queries
In a _recursive query_ , the client sends a query to a name server, asking it to respond either with the requested answer or with an error message. The error states one of two things:
* The server can't come up with the right answer.
* The domain name doesn't exist.
In a recursive query, the name server isn't allowed just to refer the client to some other name server. Most resolvers use recursive queries. In addition, if your DNS server uses a forwarder, the requests sent by your server to the forwarder will be recursive queries.
Figure 2.5 shows an example of both recursive and iterative queries. In this example, a client within the Microsoft Corporation is querying its DNS server for the IP address for www.whitehouse.gov.
**FIGURE 2.5** A sample DNS query
Here's what happens to resolve the request:
1. The resolver sends a recursive DNS query to its local DNS server asking for the IP address of www.whitehouse.gov. The local name server is responsible for resolving the name, and it cannot refer the resolver to another name server.
2. The local name server checks its zones, and it finds no zones corresponding to the requested domain name.
3. The root name server has authority for the root domain, and it will reply with the IP address of a name server for the `.gov` top-level domain.
4. The local name server sends an iterative query for www.whitehouse.gov to the Gov name server.
5. The Gov name server replies with the IP address of the name server servicing the `whitehouse.gov` domain.
6. The local name server sends an iterative query for www.whitehouse.gov to the `whitehouse.gov` name server.
7. The `whitehouse.gov` name server replies with the IP address corresponding to www.whitehouse.gov.
8. The local name server sends the IP address of www.whitehouse.gov back to the original resolver.
##### Inverse Queries
_Inverse queries_ use pointer (PTR) records. Instead of supplying a name and then asking for an IP address, the client first provides the IP address and then asks for the name. Because there's no direct correlation in the DNS namespace between a domain name and its associated IP address, this search would be fruitless without the use of the `in-addr.arpa` domain. Nodes in the `in-addr.arpa` domain are named after the numbers in the dotted-octet representation of IP addresses. However, because IP addresses get more specific from left to right and domain names get less specific from left to right, the order of IP address octets must be reversed when building the `in-addr.arpa` tree. With this arrangement, administration of the lower limbs of the DNS `in-addr.arpa` tree can be given to companies as they are assigned their Class A, B, or C subnet address or delegated even further down thanks to Variable Length Subnet Masking (VLSM).
Once the domain tree is built into the DNS database, a special PTR record is added to associate the IP addresses with the corresponding hostnames. In other words, to find a hostname for the IP address 206.131.234.1, the resolver would query the DNS server for a PTR record for `1.234.131.206.in-addr.arpa`. If this IP address is outside of the local domain, the DNS server will start at the root and sequentially resolve the domain nodes until arriving at `234.131.206.in-addr.arpa`, which would contain the PTR record for the desired host.
##### Caching and Time to Live
When a name server is processing a recursive query, it may be required to send out several queries to find the definitive answer. Name servers, acting as resolvers, are allowed to cache all of the received information during this process; each record contains information called _time to live (TTL)_. The TTL specifies how long the record will be held in the local cache until it must be resolved again. If a query comes in that can be satisfied by this cached data, the TTL that's returned with it equals the current amount of time left before the data is flushed.
There is also a negative cache TTL. The _negative cache TTL_ is used when an authoritative server responds to a query indicating that the record queried doesn't exist, and it indicates the amount of time that this negative answer may be held. Negative caching is quite helpful in preventing repeated queries for names that don't exist.
The administrator for the DNS zone sets TTL values for the entire zone. The value can be the same across the zone, or the administrator can set a separate TTL for each RR within the zone. Client resolvers also have data caches and honor the TTL value so that they know when to flush.
* * *
## Choosing Appropriate TTL Values
For zones that you administer, you can choose the TTL values for the entire zone, for negative caching, and for individual records. Choosing an appropriate TTL depends on a number of factors, including the following:
* Amount of change you anticipate for the records within the zone
* Amount of time you can withstand an outage that might require changing an IP address
* Amount of traffic you believe the DNS server can handle
Resolvers query the name server every time the TTL expires for a given record. A low TTL, say 60 seconds, can burden the name server, especially for popular DNS records. (DNS queries aren't particularly intensive for a server to handle, but they can add up quickly if you mistakenly use 60 seconds instead of 600 seconds for the TTL on a popular record.) Set a low TTL only when you need to respond quickly to a changing environment.
A high TTL, say 604,800 seconds (that's one week), means that if you need to make a change to the DNS record, clients might not see the change for up to a week. This consideration is especially important when making changes to the network, and it's one that's all too frequently overlooked. I can't count the number of times I've worked with clients who had recently made a DNS change to a new IP for their email or website only to ask why it's not working for some clients. The answer can be found in the TTL value. If the record is being cached, then the only thing that can solve their problem is time.
You should choose a TTL that's appropriate for your environment. Take the following factors into account:
* The amount of time that you can afford to be offline if you need to make a change to a DNS record that's being cached
* The amount of load that a low TTL will cause on the DNS server
In addition, you should plan well ahead of any major infrastructure changes and change the TTL to a lower value to lessen the effect of the downtime by reducing the amount of time that the record(s) can be cached.
* * *
## Introducing DNS Database Zones
As mentioned earlier in this chapter, a DNS zone is a portion of the DNS namespace over which a specific DNS server has authority. Within a given DNS zone, there are resource records (RRs) that define the hosts and other types of information that make up the database for the zone. You can choose from several different zone types. Understanding the characteristics of each will help you choose which is right for your organization.
* * *
The DNS zones discussed in this book are all Microsoft Windows Server 2012 / 2012 R2 zones. Non-Windows (for example, Unix) systems set up their DNS zones differently.
* * *
In the following sections, I will discuss the different zone types and their characteristics.
### Understanding Primary Zones
When you're learning about zone types, things can get a bit confusing. But it's really not difficult to understand how they work and why you would want to choose one type of zone over the other. Zones are databases that store records. By choosing one zone type over another, you are basically just choosing how the database works and how it will be stored on the server.
The primary zone is responsible for maintaining all of the records for the DNS zone. It contains the primary copy of the DNS database. All record updates occur on the primary zone. You will want to create and add primary zones whenever you create a new DNS domain.
There are two types of primary zones:
* Primary zone
* Primary zone with Active Directory Integration (Active Directory DNS)
* * *
From this point forward, I refer to a primary zone with Active Directory Integration as an _Active Directory DNS_. When I use only the term _primary zone_ , Active Directory is not included.
* * *
To install DNS as a primary zone, you must first install DNS using the Server Manager MMC. Once DNS is installed and running, you create a new zone and specify it as a primary zone.
* * *
The process of installing DNS and its zones will be discussed later in this chapter. In addition, there will be step-by-step exercises to walk you through how to install these components.
* * *
Primary zones have advantages and disadvantages. Knowing the characteristics of a primary zone will help you decide when you need the zone and when it fits into your organization.
#### Local Database
Primary DNS zones get stored locally in a file (with the suffix `.dns`) on the server. This allows you to store a primary zone on a domain controller or a member server. In addition, by loading DNS onto a member server, you can help a small organization conserve resources. Such an organization may not have the resources to load DNS on an Active Directory domain controller.
Unfortunately, the local database has many disadvantages:
Lack of Fault Tolerance Think of a primary zone as a contact list on your smartphone. All of the contacts in the list are the records in your database. The problem is that, if you lose your phone or the phone breaks, you lose your contact list. Until your phone gets fixed or you swap out your phone card, the contacts are unavailable.
It works the same way with a primary zone. If the server goes down or you lose the hard drive, DNS records on that machine are unreachable. An administrator can install a secondary zone (explained later in the next section), and that provides temporary fault tolerance. Unfortunately, if the primary zone is down for an extended period of time, the secondary server's information will no longer be valid.
Additional Network Traffic Let's imagine that you are looking for a contact number for John Smith. John Smith is not listed in your smartphone directory, but he is listed in your partner's smartphone. You have to contact your partner to get the listing. You cannot directly access your partner's phone's contacts.
When a resolver sends a request to DNS to get the TCP/IP address for Jsmith (in this case Jsmith is a computer name) and the DNS server does not have an answer, it does not have the ability to check the other server's database directly to get an answer. Thus it forwards the request to another DNS. When DNS servers are replicating zone databases with other DNS servers, this causes additional network traffic.
No Security Staying with the smartphone example, let's say that you call your partner looking for John Smith's phone number. When your partner gives you the phone number over your wireless phone, someone with a scanner can pick up your conversation. Unfortunately, wireless telephone calls are not very secure.
Now a resolver asks a primary zone for the Jsmith TCP/IP address. If someone on the network has a packet sniffer, they can steal the information in the DNS packets being sent over the network. The packets are not secure unless you implement some form of secondary security. Also, the DNS server has the ability to be dynamic. A primary zone accepts all updates from DNS servers. You cannot set it to accept secure updates only.
### Understanding Secondary Zones
In Windows Server 2012 R2 DNS, you have the ability to use secondary DNS zones. Secondary zones are noneditable copies of the DNS database. You use them for _load balancing_ (also referred to as _load sharing_ ), which is a way of managing network overloads on a single server. A secondary zone gets its database from a primary zone.
A _secondary zone_ contains a database with all of the same information as the primary zone, and it can be used to resolve DNS requests. Secondary zones have the following advantages:
* A secondary zone provides fault tolerance, so if the primary zone server becomes unavailable, name resolution can still occur using the secondary zone server.
* Secondary DNS servers can also increase network performance by offloading some of the traffic that would otherwise go to the primary server.
Secondary servers are often placed within the parts of an organization that have high-speed network access. This prevents DNS queries from having to run across slow wide area network (WAN) connections. For example, if there are two remote offices within the `stellacon.com` organization, you may want to place a secondary DNS server in each remote office. This way, when clients require name resolution, they will contact the nearest server for this IP address information, thus preventing unnecessary WAN traffic.
* * *
Having too many secondary zone servers can actually cause an increase in network traffic because of replication (especially if DNS changes are fairly frequent). Therefore, you should always weigh the benefits and drawbacks and properly plan for secondary zone servers.
* * *
### Understanding Active Directory Integrated DNS
Windows Server 2000 introduced _Active Directory Integrated DNS_ to the world. This zone type was unique and was a separate choice during setup. In Windows Server 2003, this zone type became an add-on to a primary zone. In Windows Server 2012 R2, it works the same way. After choosing to set up a primary zone, you check the box labeled Store The Zone In Active Directory (see Figure 2.6).
**FIGURE 2.6** Setting up an Active Directory Integrated zone
#### Disadvantages of Active Directory Integrated DNS
The main disadvantage of Active Directory Integrated DNS is that it has to reside on a domain controller because the DNS database is stored in Active Directory. As a result, you cannot load this zone type on a member server, and small organizations might not have the resources to set up a dedicated domain controller.
#### Advantages of Active Directory Integrated DNS
The advantages of using an Active Directory Integrated DNS zone well outweigh the disadvantage just discussed. The following are some of the major advantages to an Active Directory Integrated zone:
Full Fault Tolerance Think of an Active Directory Integrated zone as a database on your server that stores contact information for all your clients. If you need to retrieve John Smith's phone number, as long as it was entered, you can look it up on the software.
If John Smith's phone number was stored only on your computer and your computer stopped working, no one could access John Smith's phone number. But since John Smith's phone number is stored in a database to which everyone has access, if your computer stops working, other users can still retrieve John Smith's phone number.
An Active Directory Integrated zone works the same way. Since the DNS database is stored in Active Directory, all Active Directory DNS servers can have access to the same data. If one server goes down or you lose a hard drive, all other Active Directory DNS servers can still retrieve DNS records.
No Additional Network Traffic As previously discussed, an Active Directory Integrated zone is stored in Active Directory. Since all records are now stored in Active Directory, when a resolver needs a TCP/IP address for Jsmith, any Active Directory DNS server can access Jsmith's address and respond to the resolver.
When you choose an Active Directory Integrated zone, DNS zone data can be replicated automatically to other DNS servers during the normal Active Directory replication process.
DNS Security An Active Directory Integrated zone has a few security advantages over a primary zone:
* An Active Directory Integrated zone can use secure dynamic updates.
* As explained earlier, the Dynamic DNS standard allows secure-only updates or dynamic updates, not both.
* If you choose secure updates, then only machines with accounts in Active Directory can register with DNS. Before DNS registers any account in its database, it checks Active Directory to make sure that it is an authorized domain computer.
* An Active Directory Integrated zone stores and replicates its database through Active Directory replication. Because of this, the data gets encrypted as it is sent from one DNS server to another.
Background Zone Loading Background zone loading (discussed in more detail later in this chapter) allows an Active Directory Integrated DNS zone to load in the background. As a result, a DNS server can service client requests while the zone is still loading into memory.
### Understanding Stub Zones
_Stub zones_ work a lot like secondary zones—the database is a noneditable copy of a primary zone. The difference is that the stub zone's database contains only the information necessary (three record types) to identify the authoritative DNS servers for a zone (see Figure 2.7). You should not use stub zones to replace secondary zones, nor should you use them for redundancy and load balancing.
**FIGURE 2.7** DNS stub zone type
* * *
Stub zone databases contain only three record types: name server (NS), start of authority (SOA), and glue host (A) records. Understanding these records will help you on the Microsoft certification exams. Microsoft asks many questions about stub zones on all DNS-related exams.
* * *
* * *
## When to Use Stub Zones
Stub zones become particularly useful in a couple of different scenarios. Consider what happens when two large companies merge: `example.com` and `example.net`. In most cases, the DNS zone information from both companies must be available to every employee. You could set up a new zone on each side that acts as a secondary for the other side's primary zone, but administrators tend to be very protective of their DNS databases, and they probably wouldn't agree to this plan.
A better solution is to add to each side a stub zone that points to the primary server on the other side. When a client in `example.com` (which you help administer) makes a request for a name in `example.net`, the stub zone on the `example.com` DNS server would send the client to the primary DNS server for `example.net` without actually resolving the name. At this point, it would be up to `example.net`'s primary server to resolve the name.
An added benefit is that, even if the administrators over at `example.net` change their configuration, you won't have to do anything because the changes will automatically replicate to the stub zone, just as they would for a secondary server.
Stub zones can also be useful when you administer two domains across a slow connection. Let's change the previous example a bit and assume that you have full control over `example.com` and `example.net` but that they connect through a 56Kbps line. In this case, you wouldn't necessarily mind using secondary zones because you personally administer the entire network. However, it could get messy to replicate an entire zone file across that slow line. Instead, stub zones would refer clients to the appropriate primary server at the other site.
* * *
### GlobalName Zones
Earlier in this chapter, I talked about organizations using WINS to resolve NetBIOS names (also referred to as _computer names_ ) to TCP/IP addresses. Even today, many organizations still use WINS along with DNS for name resolution. Unfortunately, WINS is slowly becoming obsolete.
To help organizations move forward with an all-DNS network, Microsoft Windows Server 2012 R2 DNS supports _GlobalName zones_. These use single-label names (DNS names that do not contain a suffix such as `.com`, `.net`, and so on). GlobalName zones are not intended to support peer-to-peer networks and workstation name resolution, and they don't support dynamic DNS updates.
GlobalName zones are designed to be used with servers. Because GlobalName zones are not dynamic, an administrator has to enter the records into the zone database manually. In most organizations, the servers have static TCP/IP addresses, and this works well with the GlobalName zone design. GlobalName zones are usually used to map single-label CNAME (alias) resource records to an FQDN.
### Zone Transfers and Replication
DNS is such an important part of the network that you should not just use a single DNS server. With a single DNS server, you also have a single point of failure, and in fact, many domain registrars encourage the use of more than two name servers for a domain. Secondary servers or multiple primary Active Directory Integrated servers play an integral role in providing DNS information for an entire domain.
As previously stated, secondary DNS servers receive their zone databases through zone transfers. When you configure a secondary server for the first time, you must specify the primary server that is authoritative for the zone and that will send the zone transfer. The primary server must also permit the secondary server to request the zone transfer.
Zone transfers occur in one of two ways: _full zone transfers (AXFR)_ and _incremental zone transfers (IXFR)_.
When a new secondary server is configured for the first time, it receives a full zone transfer from the primary DNS server. The full zone transfer contains all of the information in the DNS database. Some DNS implementations always receive full zone transfers.
After the secondary server receives its first full zone transfer, subsequent zone transfers are incremental. The primary name server compares its zone version number with that of the secondary server, and it sends only the changes that have been made in the interim. This significantly reduces network traffic generated by zone transfers.
The secondary server typically initiates zone transfers when the refresh interval time for the zone expires or when the secondary or stub server boots. Alternatively, you can configure notify lists on the primary server that send a message to the secondary or stub servers whenever any changes to the zone database occur.
When you consider your DNS strategy, you must carefully consider the layout of your network. If you have a single domain with offices in separate cities, you want to reduce the number of zone transfers across the potentially slow or expensive WAN links, although this is becoming less of a concern because of continuous increases in bandwidth.
Active Directory Integrated zones do away with traditional zone transfers altogether. Instead, they replicate across Active Directory with all of the other AD information. This replication is secure and encrypted because it uses the Active Directory security.
#### How DNS Notify Works
Windows Server 2012 R2 supports DNS Notify. _DNS Notify_ is a mechanism that allows the process of initiating notifications to secondary servers when zone changes occur (RFC 1996). DNS Notify uses a push mechanism for communicating to a select set of secondary zone servers when their zone information is updated. (DNS Notify does not allow you to configure a notify list for a stub zone.)
After being notified of the changes, secondary servers can then start a pull zone transfer and update their local copies of the database.
* * *
Many different mechanisms use the push/pull relationship. Normally, one object pushes information to another, and the second object pulls the information from the first. Most applications push replication on a change value and pull it on a time value. For example, a system can push replication after 10 updates, or it can be pulled every 30 minutes.
* * *
To configure the DNS Notify process, you create a list of secondary servers to notify. List the IP address of the server in the primary master's Notify dialog box (see Figure 2.8). The Notify dialog box is located under the Zone Transfers tab, which is located in the zone Properties dialog box (see Figure 2.9).
**FIGURE 2.8** DNS Notify dialog box
**FIGURE 2.9** DNS Zone Transfers tab
#### Configuring Stub Zone Transfers with Zone Replication
In the preceding section, I talked about how to configure secondary server zone transfers. What if you wanted to configure settings for stub zone transfers? This is where zone replication scope comes in.
Only Active Directory–Integrated primary and stub zones can configure their replication scope. Secondary servers do not have this ability.
You can configure zone replication scope configurations in two ways. An administrator can set configuration options through the DNS snap-in or through a command-line tool called `DNSCmd`.
To configure zone replication scope through the DNS snap-in, follow these steps:
1. Click Start Administrative Tools DNS.
2. Right-click the zone you want to set up.
3. Choose Properties.
4. In the Properties dialog box, click the Change button next to Replication (see Figure 2.10).
**FIGURE 2.10** DNS zone replication scope
5. Choose the replication scope that fits your organization.
## Advantages of DNS in Windows Server 2012 R2
DNS in Microsoft Windows Server 2012 R2 has some great advantages over many other versions of Microsoft DNS. Here are some of the improvements of DNS in Windows Server 2012 R2 (some of these became available in Windows Server 2008, but they have been improved upon):
* Background zone loading
* Support for TCP/IP version 6 (IPv6)
* Read-only domain controllers
* GlobalName zone
* DNS Socket Pool
* DNS Cache Locking
* DNS Security Extensions (DNSSEC)
* DNS Devolution
* Zone Level Statistics
* Record Weighting
* Netmask Ordering
* DnsUpdateProxy Group
* Windows PowerShell Support
### Background Zone Loading
If an organization had to restart a DNS server with an extremely large Active Directory Integrated DNS zones database in the past, DNS had a common problem with an Active Directory Integrated DNS zone. After the DNS restart, it could take hours for DNS data to be retrieved from Active Directory. During this time, the DNS server was unable to service any client requests.
Microsoft Windows Server 2008 DNS addressed this problem by implementing background zone loading, and Windows Server 2012 R2 has taken it a step further. As the DNS restarts, the Active Directory zone data populates the database in the background. This allows the DNS server to service client requests for data from other zones almost immediately after a restart.
Background zone loading accomplishes this task by loading the DNS zone using separate threads. This allows a DNS server to service requests while still loading the rest of the zone. If a client sends a request to the DNS server for a computer that has not yet loaded into memory, the DNS server retrieves the data from Active Directory and updates the record.
### Support for IPv6 Addresses
Over the past few years, the Internet has starting running into a problem that was not foreseen when it was first created—it started running out of TCP/IP addresses. As you probably know, when the Internet was created, it was used for government and academic purposes only. Then, seemingly overnight, it grew to be the information superhighway. Nowadays, asking someone for his or her email address is almost as common as asking for their phone number.
Version 4 (IPv4) was the common version of TCP/IP. The release of TCP/IP version 6 (IPv6) has solved the lack-of-IP-addresses problem. IPv4 addresses are 32 bits long, but IPv6 addresses are 128 bits in length. The longer lengths allow for a much greater number of globally unique TCP/IP addresses.
Microsoft Windows Server 2012 R2 DNS has built-in support to accommodate both IPv4 and IPv6 address records. (DNS records are explained later in this chapter.) DHCP can also issue IPv6 addresses, which lets administrators allow DHCP to register the client with DNS, or the IPv6 client can register their address with the DNS server.
### Support for Read-Only Domain Controllers
Windows Server 2008 introduced a new type of domain controller called the _read-only domain controller (RODC)_. This is a full copy of the Active Directory database without the ability to write to Active Directory. The RODC gives an organization the ability to install a domain controller in a location (onsite or offsite) where security is a concern.
Microsoft Windows Server 2012 R2 DNS has implemented a type of zone to help support an RODC. A primary read-only zone allows a DNS server to receive a copy of the application partition (including ForestDNSZones and DomainDNSZones) that DNS uses. This allows DNS to support an RODC because DNS now has a full copy of all DNS zones stored in Active Directory.
A primary, read-only zone is just what it says—a read-only zone; so to make any changes to it, you have to change the primary zones located on the Active Directory Integrated DNS server.
### DNS Socket Pools
If your server is running Windows Server 2012 R2, you will be able to take advantage of DNS socket pools. _DNS socket pools_ allow source port randomization to protect against DNS cache-poisoning attacks.
If you choose to use source port randomization, when the DNS service starts, the DNS server will randomly pick a source port from a pool of available sockets. This is an advantage because, instead of DNS using a well-known source port when issuing queries, the DNS server uses a random port selected from the socket pool. This helps guard against attacks because a hacker must correctly access the source port of the DNS query. The socket pool is automatically enabled in DNS with the default settings.
When using the DNS Socket Pool, the default size of the DNS socket pool is 2,500. When configuring the socket pool, you have the ability to choose a size value from 0 to 10,000. The larger the value, the greater the protection you will have against DNS spoofing attacks. If you decide to configure your socket pool size with a zero value, only a single socket for remote DNS queries will be used.
### DNS Cache Locking
Windows Server 2012 R2 _DNS cache locking_ allows cached DNS records to remain safe for the duration of the record's time to live (TTL) value. This means that the cached DNS records cannot be overwritten or changed. Because of this new DNS feature, it's tougher for hackers to perform cache-poisoning attacks against your DNS server.
DNS administrators can set how long a record will remain safe in cache. The configuration is based on a percent value. For example, if you set your cache locking value to 50 percent, then the cached records cannot be overwritten until half of the TTL has been reached. DNS cache locking is set to 100 percent by default. This means that the cached records never get overwritten.
### DNS Security Extensions
One major issue that you must always look at is keeping your DNS safe. Think about it—DNS is a database of computer names and IP addresses. As a hacker, if I control DNS, I can control your company. In organizations that do not support extra security like IPsec, DNS security is even more important. This is where DNSSEC can help.
Windows Server 2012 R2 can use a suite of extensions that will help add security to DNS, and that suite is called _Domain Name System Security Extensions (DNSSEC)_ , which was introduced in Windows Server 2008 R2. The DNSSEC protocol allows your DNS servers to be secure by validating DNS responses. DNSSEC secures your DNS resource records by accompanying the records with a digital signature.
To allow your DNS resource records to receive digital signatures, DNSSEC is applied to your DNS server by a procedure called _zone signing_. This process begins when a DNS resolver initiates a DNS query for a resource record in a signed DNS zone. When a response is returned, a digital signature (RRSIG) accompanies the response, and this allows the response to be verified. If the verification is successful, then the DNS resolver knows that the data has not been modified or tampered with in any way.
Once you implement a zone with DNSSEC, all of the records that are contained within that zone get individually signed. Since all of the records in the zone get individually signed, this gives administrators the ability to add, modify, or delete records without resigning the entire zone. The only requirement is to resign any updated records.
#### Trust Anchors
Trust anchors are an important part of the DNSSEC process because trust anchors allow the DNS servers to validate the DNSKEY resource records. _Trust anchors_ are preconfigured public keys that are linked to a DNS zone. For a DNS server to perform validation, one or more trust anchors must be configured. If you are running an Active Directory Integrated zone, trust anchors can be stored in the Active Directory Domain Services directory partition of the forest. If you decide to store the trust anchors in the directory partition, then all DNS servers that reside on a domain controller get a copy of this trust anchor. On DNS servers that reside on stand-alone servers, trust anchors are stored in a file called `TrustAnchors.dns`.
If your servers are running Windows Server 2012 R2, then you can view trust anchors in the DNS Manager Console tree in the Trust Points container. You can also use Windows PowerShell or `Dnscmd.exe` to view trust anchors. Windows PowerShell is the recommended command-line method for viewing trust anchors. The following line is a PowerShell command to view the trust anchors for `Contoso.com`:
get-dnsservertrustanchor sec.contoso.com
#### DNSSEC Clients
Windows 7, Windows 8, Windows Server 2008/2008 R2, and Windows Server 2012/2012 R2 are all DNS clients that receive a response to a DNS query, examine the response, and then evaluate whether the response has been validated by a DNS server. The DNS client itself is nonvalidating, and the DNS client relies on the local DNS server to indicate that validation was successful. If the server doesn't perform validation, then the DNS client service can be configured to return no results.
* * *
If you are interested in learning how to set up DNSSEC in a lab environment, Microsoft has a website that explains all about DNSSEC and how to set up the lab environment. Visit `<http://technet.microsoft.com/en-us/library/hh831411.aspx>`.
* * *
### DNS Devolution
Using _DNS devolution_ , if a client computer is a member of a child namespace, the client computer will be able to access resources in the parent namespace without the need to provide explicitly the fully qualified domain name (FQDN) of the resource. DNS devolution removes the leftmost label of the namespace to get to the parent suffix. DNS devolution allows the DNS resolver to create the new FQDNs. DNS devolution works by appending the single-label, unqualified domain name with the parent suffix of the primary DNS suffix name.
### Zone Level Statistics
DNS zone level server statistics are available in Windows Server 2012 R2 by using the Windows PowerShell cmdlet `Get-DnsServerStatistics`. This powerful Windows PowerShell cmdlet retrieves statistics and data for the DNS server. The following is an example of the `Get-DnsServerStatistics` cmdlet:
Get-DnsServerStatistics -ZoneName <String[]> [-AsJob][-CimSession <CimSession[]> ][-Clear][-ComputerName <String> ][-ThrottleLimit <Int32> ][ <CommonParameters>]
The ZoneName parameter allows an administrator to get specific statistics for the DNS zone that you have specified. If the ZoneName parameter is not specified during the PowerShell cmdlet, the server-level statistics are retrieved and shown. If an administrator uses the Clear parameter in the PowerShell cmdlet along with the ZoneName parameter, the statistics for the specified zone will be cleared. So, use this cmdlet carefully.
### Record Weighting
Weighting DNS records will allow an administrator to place a value on DNS SRV records. Clients will then randomly choose SRV records proportional to the weight value assigned.
### Netmask Ordering
If round robin is enabled, when a client requests name resolution, the first address entered in the database is returned to the resolver, and it is then sent to the end of the list. The next time a client attempts to resolve the name, the DNS server returns the second name in the database (which is now the first name) and then sends it to the end of the list, and so on. Round robin is enabled by default.
_Netmask ordering_ is part of the round-robin process. When an administrator configures netmask ordering, the DNS server will detect the subnet of the querying client. The DNS server will then return a host address available for the same subnet. Netmask ordering is enabled through the DNS Manager console on the Advanced tab of the server Properties dialog box.
### DnsUpdateProxy Group
As mentioned previously, the DHCP server can be configured to register host (A) and pointer (PTR) resource records dynamically on behalf of DHCP clients. Because of this, the DNS server can end up with stale resources. To help solve this issue, an administrator can use the built-in security group called _DnsUpdateProxy_.
To use the DnsUpdateProxy group, an administrator must first create a dedicated user account and configure the DHCP servers with its credentials. This will protect against the creation of unsecured records. Also, when you create the dedicated user account, members of the DnsUpdateProxy group will be able to register records in zones that allow only secured dynamic updates. Multiple DHCP servers can use the same credentials of one dedicated user account.
Now that you have looked at some of the new features of Windows Server 2012 R2 DNS, let's take a look at some of the DNS record types.
### Windows PowerShell Support
Microsoft has more than 100 PowerShell cmdlets specifically for DNS. While in Windows PowerShell, you can list all of the DNS cmdlets that are available. To see the entire list, use the following PowerShell command:
Get-Command –Module DnsServer cmdlet.
For an entire list of all of the Windows PowerShell DNS cmdlets, go to `<http://technet.microsoft.com/en-us/library/jj649850.aspx>`.
## Introducing DNS Record Types
No matter where your zone information is stored, you can rest assured that it contains a variety of DNS information. Although the DNS snap-in makes it unlikely that you'll ever need to edit these files by hand, it's good to know exactly what data is contained there.
As stated previously, zone files consist of a number of resource records. You need to know about several types of resource records to manage your DNS servers effectively. They are discussed in the following sections.
Part of the resource record is its class. _Classes_ define the type of network for the resource record. There are three classes: Internet, Chaosnet, and Hesoid. By far, the Internet class is the most popular. In fact, it's doubtful that you'll see either Chaosnet or Hesoid classes in the wild.
* * *
The following are some of the more important resource records in a DNS database. For a listing of records in a Microsoft DNS database, visit Microsoft's website at <http://technet.microsoft.com/en-us/library/cc958958.aspx>.
* * *
### Start of Authority Records
The first record in a database file is the _start of authority (SOA) record_. The SOA defines the general parameters for the DNS zone, including the identity of the authoritative server for the zone.
The SOA appears in the following format:
_@ IN SOA primary_mastercontact_e-mailserial_number_
_refresh_timeretry_timeexpiration_timetime_to_live_
Here is a sample SOA from the domain `example.com`:
@ IN SOA win2k3r2.example.com. hostmaster.example.com. (
5 ; serial number
900 ; refresh
600 ; retry
86400 ; expire
3600 ) ; default TTL
Table 2.2 lists the attributes stored in the SOA record.
**TABLE 2.2** The SOA record structure
Field | Meaning
---|---
Current zone | The current zone for the SOA. This can be represented by an `@` symbol to indicate the current zone or by naming the zone itself. In the example, the current zone is `example.com`. The trailing dot (`.com.`) indicates the zone's place relative to the root of the DNS.
Class | This will almost always be the letters IN for the Internet class.
Type of record | The type of record follows. In this case, it's SOA.
Primary master | The primary master for the zone on which this file is maintained.
Contact email | The Internet email address for the person responsible for this domain's database file. There is no `@` symbol in this contact email address because `@` is a special character in zone files. The contact email address is separated by a single dot (`.`). So the email address of `root@example.com` would be represented by `root.example.com` in a zone file.
Serial number | This is the "version number" of this database file. It increases each time the database file is changed.
Refresh time | The amount of time (in seconds) that a secondary server will wait between checks to its master server to see if the database file has changed and a zone transfer should be requested.
Retry time | The amount of time (in seconds) that a secondary server will wait before retrying a failed zone transfer.
Expiration time | The amount of time (in seconds) that a secondary server will spend trying to download a zone. Once this time limit expires, the old zone information will be discarded.
Time to live | The amount of time (in seconds) that another DNS server is allowed to cache any resource records from this database file. This is the value that is sent out with all query responses from this zone file when the individual resource record doesn't contain an overriding value.
### Name Server Records
_Name server (NS) records_ list the name servers for a domain. This record allows other name servers to look up names in your domain. A zone file may contain more than one name server record. The format of these records is simple:
example.com. IN NS Hostname.example.com
Table 2.3 explains the attributes stored in the NS record.
**TABLE 2.3** The NS record structure
Field | Meaning
---|---
Name | The domain that will be serviced by this name server. In this case, I used `example.com`.
AddressClass | Internet (IN)
RecordType | Name server (NS)
Name Server Name | The FQDN of the server responsible for the domain
* * *
Any domain name in the database file that is not terminated with a period will have the root domain appended to the end. For example, an entry that just has the name _sales_ will be expanded by adding the root domain to the end, whereas the entry `sales.example.com.` won't be expanded.
* * *
### Host Record
A _host record_ (also called an _A record_ for IPv4 and _AAAA record_ for IPv6) is used to associate statically a host's name to its IP addresses. The format is pretty simple:
host_nameoptional_TTL IN A IP_Address
Here's an example from my DNS database:
www IN A 192.168.0.204
SMTP IN A 192.168.3.144
The A or AAAA record ties a hostname (which is part of an FQDN) to a specific IP address. This makes these records suitable for use when you have devices with statically assigned IP addresses. In this case, you create these records manually using the DNS snap-in. As it turns out, if you enable DDNS, your DHCP server can create these for you. This automatic creation is what enables DDNS to work.
Notice that an optional TTL field is available for each resource record in the DNS. This value is used to set a TTL that is different from the default TTL for the domain. For example, if you wanted a 60-second TTL for the www A or AAAA record, it would look like this:
www 60 IN A 192.168.0.204
### Alias Record
Closely related to the host record is the _alias record_ , or _canonical name (CNAME) record_. The syntax of an alias record is as follows:
_aliasoptional_TTL_ IN CNAME _hostname_
Aliases are used to point more than one DNS record toward a host for which an A record already exists. For example, if the hostname of your web server was actually `chaos`, you would likely have an A record such as this:
chaos IN A 192.168.1.10
Then you could make an alias or CNAME for the record so that `www.example.com` would point to `chaos`:
www IN CNAME chaos.example.com.
Note the trailing dot (`.`) on the end of the CNAME record. This means the root domain is not appended to the entry.
### Pointer Record
A or AAAA records are probably the most visible component of the DNS database because Internet users depend on them to turn FQDNs like `www.microsoft.com` into the IP addresses that browsers and other components require to find Internet resources. However, the host record has a lesser-known but still important twin: the _pointer (PTR) record._ The format of a PTR record appears as follows:
_reversed_address.in-addr.arpa. optional_TTL IN PTR targeted_domain_name_
The A or AAAA record maps a hostname to an IP address, and the PTR record does just the opposite—mapping an IP address to a hostname through the use of the `in-addr.arpa` zone.
The PTR record is necessary because IP addresses begin with the least-specific portion first (the network) and end with the most-specific portion (the host), whereas hostnames begin with the most-specific portion at the beginning and the least-specific portion at the end.
Consider the example 192.168.1.10 with a subnet mask 255.255.255.0. The portion 192.168.1 defines the network and the final .10 defines the host, or the most-specific portion of the address. DNS is just the opposite: The hostname `www.example.com.` defines the most-specific portion, `www`, at the beginning and then traverses the DNS tree to the least-specific part, the dot (`.`), at the root of the tree.
Reverse DNS records, therefore, need to be represented in this most-specific-to-least-specific manner. The PTR record for mapping 192.168.1.10 to `www.example.com` would look like this:
10.1.168.192.in-addr.arpa. IN PTR www.example.com.
Now a DNS query for that record can follow the logical DNS hierarchy from the root of the DNS tree all the way to the most-specific portion.
### Mail Exchanger Record
The _mail exchanger (MX) record_ is used to specify which servers accept mail for this domain. Each MX record contains two parameters—a preference and a mail server, as shown in the following example:
_domain_ IN MX _preference mailserver_host_
The MX record uses the preference value to specify which server should be used if more than one MX record is present. The preference value is a number. The lower the number, the more preferred the server. Here's an example:
example.com. IN MX 0 mail.example.com.
example.com. IN MX 10 backupmail.example.com.
In the example, `mail.example.com` is the default mail server for the domain. If that server goes down for any reason, emailers then use the `backupmail.example.com` mail server.
### Service (SRV) Record
Windows Server 2012 R2 depends on some other services, like the Lightweight Directory Access Protocol (LDAP) and Kerberos. Using a service record, which is another type of DNS record, a Windows 2000, XP, Vista, Windows 7, Windows 8, and all Windows Server products can query DNS servers for the location of a domain controller. This makes it much easier (for both the client and the administrator) to manage and distribute logon traffic in large-scale networks. For this approach to work, Microsoft has to have some way to register the presence of a service in DNS. Enter the service (SRV) record.
_Service (SRV) records_ tie together the location of a service (like a domain controller) with information about how to contact the service. SRV records provide seven items of information. Let's review an example to help clarify this powerful concept. (Table 2.4 explains the fields in the following example.)
ldap.tcp.example.com. 86400 IN SRV 10 100 389 hsv.example.com
ldap.tcp.example.com. 86400 IN SRV 20 100 389 msy.example.com
**TABLE 2.4** The SRV record structure
Field | Meaning
---|---
Domain name | Domain for which this record is valid (`ldap.tcp.example.com.`).
TTL | Time to live (86,400 seconds).
Class | This field is always `IN`, which stands for Internet.
Record type | Type of record (`SRV`).
Priority | Specifies a preference, similar to the Preference field in an MX record. The SRV record with the lowest priority is used first (`10`).
Weight | Service records with equal priority are chosen according to their weight (`100`).
Port number | The port where the server is listening for this service (`389`).
Target | The FQDN of the host computer (`hsv.example.com` and `msy.example.com`).
* * *
You can define other types of service records. If your applications support them, they can query DNS to find the services they need.
* * *
## Configuring DNS
In the following sections, you'll begin to learn about the actual DNS server. You will start by installing DNS. Then I will talk about different zone configuration options and what they mean. Finally, you'll complete an exercise that covers configuring Dynamic DNS, delegating zones, and manually entering records.
DNS requires that you use a static IP address on the server. The reason for this is that clients access the DNS server by using its TCP/IP address, and that's why DNS servers need to install a static IP address.
If you are currently using DHCP on your server, change your DNS server to have a static IP address before completing this exercise. I know that most of you already know how to change your IP address, but for anyone new to Microsoft Server 2012 R2, click the Start button and go into Control Panel. Make sure that the VIEW BY in the upper-right corner is set to large icons, and then choose Network and Sharing Center. On the right side of the windows under Access Type, click the access type link you have (Ethernet, Wireless, and so forth). Choose Properties, and then click Internet Protocol Version 4 (TCP/IPv4) and choose Properties. Choose the radio button for Use The Following IP Address and enter your local TCP/IP settings. Click OK to change it from DHCP to a static TCP/IP address.
### Installing DNS
Let's start by installing DNS. Installing DNS is an important part of running a network. Exercise 2.1 walks you through the installation of a DNS server.
* * *
### EXERCISE 2.1: Installing and Configuring the DNS Service
1. Open Server Manager.
2. On the Server Manager dashboard, click the Add Roles And Features link.
3. If a Before You Begin screen appears, click Next.
4. On the Selection type page, choose Role-Based Or Feature-Based Installation and click Next.
5. Click the Select A Server From The Server Pool radio button and choose the server under the Server Pool section. Click Next.
6. Click the DNS Server Item in the Server Role list. If a pop-up window appears telling you that you need to add additional features, click the Add Features button. If you did not give your system a static TCP/IP address, a window appears stating that you need a static TCP/IP address; just click the Continue button to bypass the error. Click Next to continue.
7. On the Add Features page, just click Next.
8. Click Next on the DNS Server information screen.
9. On the Confirm Installation screen, choose the Restart The Destination Server Automatically If Required check box and then click the Install button.
10. At the Installation progress screen, click Close after the DNS server is installed.
11. Close Server Manager.
* * *
### Load Balancing with Round Robin
Like other DNS implementations, the Windows Server 2012 R2 implementation of DNS supports load balancing through the use of round robin. Load balancing distributes the network load among multiple network hosts if they are available. You set up round-robin load balancing by creating multiple resource records with the same hostname but different IP addresses for multiple computers. Depending on the options you select, the DNS server responds with the addresses of one of the host computers.
If round robin is enabled, when a client requests name resolution, the first address entered in the database is returned to the resolver and is then sent to the end of the list. The next time a client attempts to resolve the name, the DNS server returns the second name in the database (which is now the first name) and then sends it to the end of the list, and so on. Round robin is enabled by default.
### Configuring a Caching-Only Server
Although all DNS name servers cache queries that they have resolved, caching-only servers are DNS name servers that only perform queries, cache the answers, and return the results. They are not authoritative for any domains, and the information that they contain is limited to what has been cached while resolving queries. Accordingly, they don't have any zone files, and they don't participate in zone transfers. When a caching-only server is first started, it has no information in its cache; the cache is gradually built over time.
Caching-only servers are easy to configure. After installing the DNS service, simply make sure the root hints are configured properly:
1. Right-click your DNS server and choose the Properties command.
2. When the Properties dialog box appears, switch to the Root Hints tab (see Figure 2.11).
**FIGURE 2.11** The Root Hints tab of the DNS server's Properties dialog box
3. If your server is connected to the Internet, you should see a list of root hints for the root servers maintained by ICANN and the Internet Assigned Numbers Authority (IANA). If not, click the Add button to add root hints as defined in the `cache.dns` file.
You can obtain current `cache.dns` files on the Internet by using a search engine. Just search for _cache.dns_ and download one. (I always try to get `cache.dns` files from a university or a company that manages domain names.)
### Setting Zone Properties
There are six tabs on the Properties dialog box for a forward or reverse lookup zone. You only use the Security tab to control who can change properties and to make dynamic updates to records on that zone. The other tabs are discussed in the following sections.
* * *
Secondary zones don't have a Security tab, and their SOA tab shows you the contents of the master SOA record, which you can't change.
* * *
#### General Tab
The General tab includes the following:
* The Status indicator and the associated Pause button let you see and control whether this zone can be used to answer queries. When the zone is running, the server can use it to answer client queries; when it's paused, the server won't answer any queries it gets for that particular zone.
* The Type indicator and its Change button allow you to select the zone type. The options are Standard Primary, Standard Secondary, and AD-Integrated. (See "Introducing DNS Database Zones" earlier in this chapter.) As you change the type, the controls you see below the horizontal dividing line change too. For primary zones, you'll see a field that lets you select the zone filename; for secondary zones, you'll get controls that allow you to specify the IP addresses of the primary servers. But the most interesting controls are the ones you see for AD Integrated zones. When you change to the AD Integrated zones, you have the ability to make the dynamic zones Secure Only.
* The Replication indicator and its Change button allow you to change the replication scope if the zone is stored in Active Directory. You can choose to replicate the zone data to any of the following:
* All DNS servers in the Active Directory forest
* All DNS servers in a specified domain
* All domain controllers in the Active Directory domain (required if you use Windows 2000 domain controllers in your domain)
* All domain controllers specified in the replication scope of the application directory partition
* The Dynamic Updates field gives you a way to specify whether you want to support Dynamic DNS updates from compatible DHCP servers. As you learned earlier in the section "Dynamic DNS and Non-Dynamic DNS," the DHCP server or DHCP client must know about and support Dynamic DNS in order to use it, but the DNS server has to participate too. You can turn dynamic updates on or off, or you can require that updates be secured.
#### Start Of Authority (SOA) Tab
The options on the Start Of Authority (SOA) tab, shown in Figure 2.12, control the contents of the SOA record for this zone.
**FIGURE 2.12** The Start Of Authority (SOA) tab of the zone Properties dialog box
* The Serial Number field indicates which version of the SOA record the server currently holds. Every time you change another field, you should increment the serial number so that other servers will notice the change and get a copy of the updated record.
* The Primary Server and Responsible Person fields indicate the location of the primary name server (NS) for this zone and the email address of the administrator responsible for the maintenance of this zone, respectively. The standard username for this is hostmaster.
* The Refresh Interval field controls how often any secondary zones of this zone must contact the primary zone server and get any changes that have been posted since the last update.
* The Retry Interval field controls how long secondary servers will wait after a zone transfer fails before they try again. They'll keep trying at the interval you specify (which should be shorter than the refresh interval) until they eventually succeed in transferring zone data.
* The Expires After field tells the secondary servers when to throw away zone data. The default of 1 day (24 hours) means that a secondary server that hasn't gotten an update in 24 hours will delete its local copy of the zone data.
* The Minimum (Default) TTL field sets the default TTL for all RRs created in the zone. You can assign specific TTLs to individual records if you want.
* The TTL For This Record field controls the TTL for the SOA record itself.
#### Name Servers Tab
The _name server (NS) record_ for a zone indicates which name servers are authoritative for the zone. That normally means the zone primary server and any secondary servers you've configured for the zone. (Remember, secondary servers are authoritative read-only copies of the zone.) You edit the NS record for a zone using the Name Servers tab (see Figure 2.13). The tab shows you which servers are currently listed, and you use the Add, Edit, and Remove buttons to specify which name servers you want included in the zone's NS record.
**FIGURE 2.13** The Name Servers tab of the zone Properties dialog box
#### WINS Tab
The WINS tab allows you to control whether this zone uses WINS forward lookups. These lookups pass on queries that DNS can't resolve to WINS for action. This is a useful setup if you're still using WINS on your network. You must explicitly turn this option on with the Use WINS Forward Lookup check box on the WINS tab for a particular zone.
#### Zone Transfers Tab
_Zone transfers_ are necessary and useful because they're the mechanism used to propagate zone data between primary and secondary servers. For primary servers (whether AD Integrated or not), you can specify whether your servers will allow zone transfers and, if so, to whom.
You can use the following controls on the Zone Transfers tab to configure these settings per zone:
* The Allow Zone Transfers check box controls whether the server answers zone transfer requests for this zone at all; when it's not checked, no zone data is transferred. The Allow Zone Transfers selections are as follows:
* To Any Server allows any server anywhere on the Internet to request a copy of your zone data.
* Only To Servers Listed On The Name Servers Tab (the default) limits transfers to servers you specify. This is a more secure setting than To Any Server because it limits transfers to other servers for the same zone.
* Only To The Following Servers allows you to specify exactly which servers are allowed to request zone transfers. This list can be larger or smaller than the list specified on the Name Servers tab.
* The Notify button is for setting up automatic notification triggers that are sent to secondary servers for this zone. Those triggers signal the secondary servers that changes have occurred on the primary server so that the secondary servers can request updates sooner than their normally scheduled interval. The options in the Notify dialog box are similar to those in the Zone Transfers tab. You can enable automatic notification and then choose either Servers Listed On The Name Servers Tab or The Following Servers.
### Configuring Zones for Dynamic Updates
In Exercise 2.2, you will create and then modify the properties of a forward lookup zone. In addition, you'll configure the zone to allow dynamic updates. You are installing this DNS zone as a primary zone _without_ AD integration. Even if you installed this DNS server onto a domain controller, do not choose the check box for AD integration.
* * *
### EXERCISE 2.2: Configuring a Zone for Dynamic Updates
1. Open the DNS management snap-in by selecting Server Manager. Once in Server Manager, click DNS on the left side. In the Servers window (center screen), right-click your server name and choose DNS Manager.
2. Click the DNS server to expand it and then click the Forward Lookup Zones folder. Right-click the Forward Lookup Zones folder and choose New Zone.
3. At the New Zone Welcome screen, click Next.
4. At the Zone Type screen, choose the Primary Zone option. Again, if your DNS server is also a domain controller, do not check the box to store the zone in Active Directory. Click Next when you are ready.
5. Enter a new zone name in the Zone Name field and click Next. (I used my last name—`Panek.com`.)
6. Leave the default zone filename and click Next.
7. Select the Do Not Allow Dynamic Updates radio button and click Next.
8. Click Finish to end the wizard.
9. Right-click the zone you just created and choose the Properties command.
10. Click the down arrow next to Dynamic Updates. Notice that there are only two options (None and Nonsecure And Secure). The Secure Only option is not available because you are not using Active Directory Integrated. Make sure Nonsecure And Secure is chosen.
11. Click OK to close the Properties box.
12. Close the DNS management snap-in.
13. Close the Server Manager snap-in.
* * *
### Delegating Zones for DNS
DNS provides the ability to divide the namespace into one or more zones, which can then be stored, distributed, and replicated to other DNS servers. When deciding whether to divide your DNS namespace to make additional zones, consider the following reasons to use additional zones:
* A need to delegate management of part of your DNS namespace to another location or department within your organization.
* A need to divide one large zone into smaller zones for distributing traffic loads among multiple servers, for improving DNS name-resolution performance, or for creating a more fault-tolerant DNS environment.
* A need to extend the namespace by adding numerous subdomains at once, such as to accommodate the opening of a new branch or site.
Each newly delegated zone requires a primary DNS server just as a regular DNS zone does. When delegating zones within your namespace, be aware that for each new zone you create, you need to place delegation records in other zones that point to the authoritative DNS servers for the new zone. This is necessary both to transfer authority and to provide correct referral to other DNS servers and clients of the new servers being made authoritative for the new zone.
In Exercise 2.3, you'll create a delegated subdomain of the domain you created back in Exercise 2.2. Note that the name of the server to which you want to delegate the subdomain must be stored in an A or CNAME record in the parent domain.
* * *
### EXERCISE 2.3: Creating a Delegated DNS Zone
1. Open the DNS management snap-in by selecting Server Manager. Once in Server Manager, click DNS on the left side. In the Servers window (center screen), right-click your server name and choose DNS Manager.
2. Expand the DNS server and locate the zone you created in Exercise 2.2.
3. Right-click the zone and choose the New Delegation command.
4. The New Delegation Wizard appears. Click Next to dismiss the initial wizard page.
5. Enter **ns1** (or whatever other name you like) in the Delegated Domain field of the Delegated Domain Name page. This is the name of the domain for which you want to delegate authority to another DNS server. It should be a subdomain of the primary domain (for example, to delegate authority for `farmington.example.net`, you'd enter **`farmington`** in the Delegated Domain field). Click Next to complete this step.
6. When the Name Servers page appears, click the Add button to add the name(s) and IP address(es) of the servers that will be hosting the newly delegated zone. For the purpose of this exercise, enter the server name you used in Exercise 2.2. Click the Resolve button to resolve this domain name's IP address automatically into the IP address field. Click OK when you are finished. Click Next to continue with the wizard.
7. Click the Finish button. The New Delegation Wizard disappears, and you'll see the new zone you just created appear beneath the zone you selected in step 3. The newly delegated zone's folder icon is drawn in gray to indicate that control of the zone is delegated.
* * *
### DNS Forwarding
If a DNS server does not have an answer to a DNS request, it may be necessary to send that request to another DNS server. This is called _DNS forwarding_. You need to understand the two main types of forwarding:
External Forwarding When a DNS server forwards an external DNS request to a DNS server outside of your organization, this is considered _external forwarding_. For example, a resolver requests the host www.microsoft.com. Most likely, your internal DNS server is not going to have Microsoft's web address in its DNS database. So, your DNS server is going to send the request to an external DNS (most likely your ISP).
Conditional Forwarding _Conditional forwarding_ is a lot like external forwarding except that you are going to forward requests to specific DNS servers based on a condition. Usually, this is an excellent setup for internal DNS resolution. For example, let's say you have two companies, `stellacon.com` and `stellatest.com`. If a request comes in for `Stellacon.com`, it gets forwarded to the Stellacon DNS server, and any requests for `Stellatest.com` will get forwarded to the Stellatest DNS server. Requests are forwarded to a specific DNS server depending on the condition that an administrator sets up.
### Manually Creating DNS Records
From time to time, you may find it necessary to add resource records manually to your Windows Server 2012 R2 DNS servers. Although Dynamic DNS frees you from the need to fiddle with A and PTR records for clients and other such entries, you still have to create other resource types (including MX records, required for the proper flow of SMTP email) manually. You can manually create A, PTR, MX, SRV, and many other record types.
There are only two important things to remember for manually creating DNS records:
* You must right-click the zone and choose either the New Record command or the Other New Records command.
* You must know how to fill in the fields of whatever record type you're using.
For example, to create an MX record, you need three pieces of information (the domain, the mail server, and the priority). To create an SRV record, however, you need several more pieces of information.
In Exercise 2.4, you will manually create an MX record for a mailtest server in the zone you created in Exercise 2.2.
* * *
### EXERCISE 2.4: Manually Creating DNS RRs
1. Open the DNS management snap-in by selecting Server Manager. Once in Server Manager, click DNS on the left side. In the Servers window (center screen), right-click your server name and choose DNS Manager.
2. Expand your DNS server, right-click its zone and choose New Host (A record).
3. Enter **`mailtest`** in the Name field. Enter a TCP/IP number in the IP Address field. (You can use any number for this exercise, for example, 192.168.1.254.) Click the Add Host button.
4. A dialog box appears stating that the host record was created successfully. Click OK. Click Done.
5. Right-click your zone name and choose New Mail Exchanger (MX).
6. Enter **`mailtest`** in the Host Or Child Domain field and enter **`mailtest.yourDomain.com`** (or whatever domain name you used in Exercise 2.2) in the Fully-Qualified Domain Name (FQDN) Of Mail Server field; then click OK. Notice that the new record is already visible.
7. Next create an alias (or CNAME) record to point to the mail server. (It is assumed that you already have an A record for `mailtest` in your zone.) Right-click your zone, and choose New Alias (CNAME).
8. Type **`mail`** into the Alias Name field.
9. Type **`mailtest.yourDomain.com`** into the Fully-Qualified Domain Name (FQDN) For Target Host field.
10. Click the OK button.
11. Close the DNS management snap-in.
* * *
### DNS Aging and Scavenging
When using dynamic updates, computers (or DHCP) will register a resource record with DNS. These records get removed when a computer is shut down properly. A major problem in the industry is that laptops are frequently removed from the network without a proper shutdown. Therefore, their resource records continue to live in the DNS database.
Windows Server 2012 R2 DNS supports two features called _DNS aging_ and _DNS scavenging_. These features are used to clean up and remove stale resource records of a primary DNS zone. DNS aging and DNS scavenging flags old resource records that have not been updated in a certain amount of time (determined by the scavenging interval). These stale records will be scavenged at the next cleanup interval. DNS uses time stamps on the resource records to determine how long they have been listed in the DNS database.
DNS allows an administrator to set up and configure aging and scavenging through the use of the DNS snap-in. DNS aging and scavenging allows an administrator to perform some of the following related tasks for your DNS servers and any of the Active Directory–Integrated zones that they load:
* Administrators can enable or disable the use of scavenging at a DNS server and/or for selected zones at the DNS server.
* You can modify the no-refresh/refresh interval, either as a server default or by specifying an overriding value at selected zones.
* Administrators can specify when periodic scavenging occurs automatically at the DNS server for any of its eligible zones and how often these operations are repeated.
* Manually initiate a single scavenging operation for all eligible zones at the DNS server.
#### Enabling Scavenging of Stale Records
When you install Windows Server 2012 R2 DNS aging and scavenging features on all DNS servers and any of their zones, administrators should consider the following settings before using these features:
Determine whether you should use aging and scavenging for server-wide settings. When using these settings, you are choosing to affect every one of the zone-level properties for all Active Directory–Integrated zones that are loaded at the server.
Determine whether you should use aging and scavenging for zone settings. When using these settings, you are choosing to use them for zone-specific properties for just the selected zones and not the entire server. These settings apply only to the applicable zone and its resource records, and they do not apply to any other zone on the DNS server. Unless these zone-level properties are otherwise configured, they inherit their defaults from comparable settings that are maintained in server aging and scavenging properties.
* * *
Enabling aging and scavenging for use with standard primary zones modifies the format of zone files. This change does not affect zone replication to secondary servers, but the modified zone files cannot be loaded by other versions of DNS servers.
* * *
## Monitoring and Troubleshooting DNS
Now that you have set up and configured your DNS name server and created some resource records, you will want to confirm that it is resolving and replying to client DNS requests. A couple of tools allow you to do some basic monitoring and managing. Once you are able to monitor DNS, you'll want to start troubleshooting.
The simplest test is to use the `ping` command to make sure that the server is alive. A more thorough test would be to use `nslookup` to verify that you can actually resolve addresses for items on your DNS server.
In the following sections, you'll look at some of these monitoring and management tools and how to troubleshoot DNS.
### Monitoring DNS with the DNS Snap-In
You can use the DNS snap-in to do some basic server testing and monitoring. More important, you use the snap-in to monitor and set logging options. On the Event Logging tab of the server's Properties dialog box (see Figure 2.14), you can pick which events you want logged. The more events you select, the more logging information you'll get. This is useful when you're trying to track what's happening with your servers, but it can result in a very large log file if you're not careful.
**FIGURE 2.14** The Event Logging tab of the server's Properties dialog box
The Monitoring tab (see Figure 2.15) gives you some testing tools. When the check box labeled A Simple Query Against This DNS Server is checked, a test is performed that asks for a single record from the local DNS server. It's useful for verifying that the service is running and listening to queries, but not much else. When the check box labeled A Recursive Query To Other DNS Servers is checked, the test is more sophisticated—a recursive query checks whether forwarding is working okay. The Test Now button and the Perform Automatic Testing At The Following Interval check box allow you to run these tests now or later as you require.
**FIGURE 2.15** The Monitoring tab of the server's Properties dialog box
Another tab in the server's properties that allows you to monitor the activity of the DNS server is the Debug Logging tab. The Debug Logging tab allows you to monitor all outbound and inbound DNS traffic, packet content, packet type, and which transport protocol (TCP or UDP) that you want to monitor on the DNS server.
* * *
If the simple query fails, check that the local server contains the zone `1.0.0.127.in-addr.arpa`. If the recursive query fails, check that your root hints are correct and that your root servers are running.
* * *
In Exercise 2.5, you will enable logging, use the DNS MMC to test the DNS server, and view the contents of the DNS log.
* * *
### EXERCISE 2.5: Simple DNS Testing
1. Open the DNS management snap-in by selecting Server Manager. Once in Server Manager, click DNS on the left side. In the Servers window (center screen), right-click your server name and choose DNS Manager.
2. Right-click the DNS server name on the top left and select Properties.
3. Switch to the Debug Logging tab, check all of the debug logging options except Filter Packets By IP Address, and enter a full path and filename in the File Path And Name field. Click the Apply button.
4. Switch to the Monitoring tab and check both A Simple Query Against This DNS Server and A Recursive Query To Other DNS Servers.
5. Click the Test Now button several times and then click OK.
6. Press the Windows key on the keyboard (left side between the Ctrl and Alt keys) and then choose Computer. Navigate to the folder that you specified in step 3 and use WordPad or Notepad to view the contents of the log file.
* * *
### Troubleshooting DNS
When troubleshooting DNS problems, ask yourself the following basic questions:
* What application is failing? What works? What doesn't work?
* Is the problem basic IP connectivity, or is it name resolution? If the problem is name resolution, does the failing application use NetBIOS names, DNS names, or hostnames?
* How are the things that do and don't work related?
* Have the things that don't work ever worked on this computer or network? If so, what has changed since they last worked?
Windows Server 2012 R2 provides several useful tools, discussed in the following sections, which can help you answer these questions:
* `Nslookup` is used to perform DNS queries and to examine the contents of zone files on local and remote servers.
* `DNSLint` is a command-line utility used for troubleshooting many common DNS issues.
* `Ipconfig` allows you to perform the following tasks:
* View DNS client settings
* Display and flush the resolver cache
* Force a dynamic update client to register its DNS records
* The DNS log file monitors certain DNS server events and logs them for your edification.
#### Using _Nslookup_
`Nslookup` is a standard command-line tool provided in most DNS server implementations, including Windows Server 2012 R2. Windows Server 2012 R2 gives you the ability to launch `nslookup` from the DNS snap-in.
* * *
When `nslookup` is launched from the DNS snap-in, a command prompt window opens automatically. You enter `nslookup` commands in this window.
* * *
`Nslookup` offers you the ability to perform query testing of DNS servers and to obtain detailed responses at the command prompt. This information can be useful for diagnosing and solving name resolution problems, for verifying that resource records are added or updated correctly in a zone, and for debugging other server-related problems. You can do a number of useful things with `nslookup`:
* Use it in noninteractive mode to look up a single piece of data
* Enter interactive mode and use the debug feature
* Perform the following from within interactive mode:
* Set options for your query
* Look up a name
* Look up records in a zone
* Perform zone transfers
* Exit `nslookup`
* * *
When you are entering queries, it is generally a good idea to enter FQDNs so that you can control what name is submitted to the server. However, if you want to know which suffixes are added to unqualified names before they are submitted to the server, you can enter `nslookup` in debug mode and then enter an unqualified name.
* * *
##### Using Nslookup on the Command Line
To use `nslookup` in plain-old command-line mode, enter the following in the command prompt window:
nslookup DNS_name_or_IP_address server_IP_address
This command will look up a DNS name or address using a server at the IP address you specify.
##### Using _Nslookup_ in Interactive Mode
`Nslookup` is a lot more useful in interactive mode because you can enter several commands in sequence. Entering **`nslookup`** by itself (without specifying a query or server) puts it in interactive mode, where it will stay until you type **`exit`** and press Enter. Before that point, you can look up lots of useful stuff. The following are some of the tasks you can perform with `nslookup` in interactive mode:
Setting Options with the `set` Command While in interactive mode, you can use the `set` command to configure how the resolver will carry out queries. Table 2.5 shows a few of the options available with `set`.
**TABLE 2.5** Command-line options available with the `set` command
Option | Purpose
---|---
`set all` | Shows all the options available.
`set d2` | Puts `nslookup` in debug mode so that you can examine the query and response packets between the resolver and the server.
`set domain= _domain name_` | Tells the resolver what domain name to append for unqualified queries.
`set timeout= _timeout_` | Tells the resolver how long to keep trying to contact the server. This option is useful for slow links where queries frequently time out and the wait time must be lengthened.
`set type= _record type_` | Tells the resolver which type of resource records to search for (for example, A, PTR, or SRV). If you want the resolver to query for all types of resource records, type **settype=all**.
Looking Up a Name While in interactive mode, you can look up a name just by typing it: **`stellacon.com`**. In this example, `stellacon` is the owner name for the record for which you are searching, and `.com` is the server you want to query.
You can use the wildcard character (`∗`) in your query. For example, if you want to look for all resource records that have _k_ as the first letter, just type **`k∗`** as your query.
Looking Up a Record Type If you want to query a particular type of record (for instance, an MX record), use the `set type` command. The command `set type=mx` tells `nslookup` you're interested only in seeing MX records that meet your search criteria.
Listing the Contents of a Domain To get a list of the contents of an entire domain, use the `ls` command. To find all of the hosts in your domain, you'd type **`set type=a`** and then type **`ls –t yourdomain.com`**.
Troubleshooting Zone Transfers You can simulate zone transfers by using the `ls` command with the `-d` switch. This can help you determine whether the server you are querying allows zone transfers to your computer. To do this, type **ls –d domain__name**.
##### Nslookup Responses and Error Messages
A successful `nslookup` response looks like this:
Server: _Name_of_DNS_server_
Address: _IP_address_of_DNS_server_
_Response_data_
`Nslookup` might also return an error message. Some common messages are listed in Table 2.6.
**TABLE 2.6** Common `nslookup` error messages
Error message | Meaning
---|---
`DNS request timed out.`
`Timeout was _x_ seconds.`
`∗∗∗ Can't find server name for address _IP_Address_ : Timed out`
∗`∗∗ Default servers are not available`
`Default Server: Unknown`
`Address: _IP_address_of_DNS_server_` | The resolver did not locate a PTR resource record (containing the hostname) for the server IP address you specified. `Nslookup` can still query the DNS server, and the DNS server can still answer queries.
`∗∗∗ Request to Server timed-out` | A request was not fulfilled in the allotted time. This might happen, for example, if the DNS service was not running on the DNS server that is authoritative for the name.
`∗∗∗ Server can't find _Name_or_IP_address_queried_for_ : No response from server` | The server is not receiving requests on User Datagram Protocol (UDP) port 53.
`∗∗∗ Server can't find _Name_or_IP_address_queried_for:_ Non-existent domain` | The DNS server was unable to find the name or IP address in the authoritative domain. The authoritative domain might be on the remote DNS server or on another DNS server that this DNS server is unable to reach.
`∗∗∗ Server can't find _Name_or_IP_address_queried_for_ : Server failed` | The DNS server is running, but it is not working properly. For example, it might include a corrupted packet, or the zone in which you are querying for a record might be paused. However, this message can also be returned if the client queries for a host in a domain for which the DNS server is not authoritative. You will also receive the error if the DNS server cannot contact its root servers, it is not connected to the Internet, or it has no root hints.
In Exercise 2.6, you'll get some hands-on practice with the `nslookup` tool. You can run this exercise from Windows 7, Windows 8, and Windows Server 2012 R2.
* * *
### EXERCISE 2.6: Using the `nslookup` Command
1. Click the Start button and in the Search Programs And Files box (above the Start button), type **CMD**. Then hit Enter.
2. Type **`nslookup`** and press the Enter key. (For the rest of the exercise, use the Enter key to terminate each command.)
3. Try looking up a well-known address: Type **`www.microsoft.com`**.
4. Try looking up a nonexistent host: Type **`www.example.ccccc`**. Notice that your server indicates that it can't find the address and times out. This is normal behavior.
5. Type **`exit`** at the prompt. Type **`exit`** again to leave the command prompt.
* * *
#### Using _DNSLint_
Microsoft Windows Server 2012 R2 DNS can use the `DNSLint` command-line utility to help diagnose some common DNS name-resolution issues and to help diagnose potential problems of incorrect delegation. You need to download `DNSLint` from the Microsoft Download Center.
`DNSLint` uses three main functions to verify DNS records and to generate a report in HTML:
`dnslint/d` This function helps diagnose the reasons for "lame delegation" and other related DNS problems.
`dnslint/ql` This function helps verify a user-defined set of DNS records on multiple DNS servers.
`dnslint/ad` This function helps verify DNS records pertaining to Active Directory replication.
Here is the syntax for `DNSLint`:
dnslint /d _domain_name_ | /ad [ _LDAP_IP_address_ ] | /ql _input_file_
[/c [smtp,pop,imap]] [/no_open] [/r _report_name_ ]
[/t] [/ _test_tcp_ ] [/s _DNS_IP_address_ ] [/v] [/y]
The following are some sample queries:
dnslint /d stellacon.com
dnslint /ad /s 192.168.36.201
dnslint /ql dns_server.txt
dnslint /ql autocreate
dnslint /v /d stellacon.com
dnslint /r newfile /d stellacon.com
dnslint /y /d stellacon.com
dnslint /no_open /d stellacon.com
Table 2.7 explains the command options.
**TABLE 2.7** `DNSLint` command options
Command option | Meaning
---|---
`/d` | Domain name that is being tested.
`/ad` | Resolves DNS records that are used for Active Directory forest replication.
`/s` | TCP/IP address of host.
`/ql` | Requests DNS query tests from a list. This switch sends DNS queries specified in an input file.
`/v` | Turns on verbose mode.
`/r _filename_` | Allows you to create a report file.
`/y` | Overwrites an existing report file without being prompted.
`/no_open` | Prevents a report from opening automatically.
#### Using _Ipconfig_
You can use the command-line tool `ipconfig` to view your DNS client settings, to view and reset cached information used locally for resolving DNS name queries, and to register the resource records for a dynamic update client. If you use the `ipconfig` command with no parameters, it displays DNS information for each adapter, including the domain name and DNS servers used for that adapter. Table 2.8 shows some command-line options available with `ipconfig`.
**TABLE 2.8** Command-line options available for the `ipconfig` command
Command | What It Does
---|---
`ipconfig /all` | Displays additional information about DNS, including the FQDN and the DNS suffix search list.
`ipconfig /flushdns` | Flushes and resets the DNS resolver cache. For more information about this option, see the section "Configuring DNS" earlier in this chapter.
`ipconfig /displaydns` | Displays the contents of the DNS resolver cache. For more information about this option, see the section "Configuring DNS" earlier in this chapter.
`ipconfig /registerdns` | Refreshes all DHCP leases and registers any related DNS names. This option is available only on Windows 2000 and newer computers that run the DHCP client service.
* * *
You should know and be comfortable with the `ipconfig` commands related to DNS for the exam.
* * *
#### Using _DNSCmd_
`DNSCmd` allows you to display and change the properties of DNS servers, zones, and resource records through the use of command-line commands. The `DNSCmd` utility allows you to modify, create, and delete resource records and/or zones manually, and it allows you to force replication between two DNS servers.
Table 2.9 lists some of the `DNSCmd` commands and their explanations.
**TABLE 2.9** `DNSCmd` command-line options
Command | Explanation
---|---
`dnscmd /clearcache` | Clears the DNS server cache
`dnscmd /config` | Resets DNS server or zone configuration
`dnscmd /createdirectorypartition` | Creates a DNS application directory partition
`dnscmd /deletedirectorypartition` | Deletes a DNS application directory partition
`dnscmd /enumrecords` | Shows the resource records in a zone
`dnscmd /exportsettings` | Creates a text file of all server configuration information
`dnscmd /info` | Displays server information
`dnscmd /recordadd` | Adds a resource record to a zone
`dnscmd /recorddelete` | Deletes a resource record from a zone
`dnscmd /zoneadd` | Creates a new DNS zone
`dnscmd /zonedelete` | Deletes a DNS zone
`dnscmd /zoneexport` | Creates a text file of all resource records in the zone
`dnscmd /zoneinfo` | Displays zone information
`dnscmd /zonerefresh` | Forces replication of the master zone to the secondary zone
#### Using the DNS Log File
You can configure the DNS server to create a log file that records the following information:
* Queries
* Notification messages from other servers
* Dynamic updates
* Content of the question section for DNS query messages
* Content of the answer section for DNS query messages
* Number of queries this server sends
* Number of queries this server has received
* Number of DNS requests received over a UDP port
* Number of DNS requests received over a TCP port
* Number of full packets sent by the server
* Number of packets written through by the server and back to the zone
The DNS log appears in `systemroot\System32\dns\Dns.log`. Because the log is in RTF format, you must use WordPad or Word to view it.
Once the log file reaches the maximum size, Windows Server 2012 R2 writes over the beginning of the file. You can change the maximum size of the log. If you increase the size value, data persists for a longer time period, but the log file consumes more disk space. If you decrease the value, the log file uses less disk space, but the data persists for a shorter time period.
* * *
Do not leave DNS logging turned on during normal operation because it sucks up both processing and hard disk resources. Enable it only when diagnosing and solving DNS problems.
* * *
#### Troubleshooting the _.(root)_ Zone
The _DNS root zone_ is the top-level DNS zone in the DNS hierarchy. Windows Server 2012 R2-based DNS servers will build a .(`root`) zone when a connection to the Internet can't be found.
Because of this, the `.`(`root`) zone may prevent access to the Internet. The DNS forwarding option and DNS root hints will not be configurable. If you want your DNS to work as a DNS forwarder or you want to use root hints, you must remove the `.(root)` zone.
#### Issues with Non-Microsoft DNS Servers
Another troubleshooting problem that you may run into is working with both Microsoft DNS servers and non-Microsoft DNS servers. One of the most common non-Microsoft DNS servers is the Unix-based BIND DNS server.
If you need to complete a zone transfer from Microsoft DNS to a BIND DNS server, you need to enable BIND Secondaries on the Microsoft DNS server (see Figure 2.16).
**FIGURE 2.16** Enabling BIND secondaries
If you need to enable Bind Secondaries, complete the following steps:
1. Open DNS management.
2. Right-click the server name and choose Properties.
3. Click the Advanced tab.
4. Check the Enable BIND Secondaries box.
5. Click OK.
## Overview of DHCP
As you will see in Chapter 7, TCP/IP is the priority protocol for Windows Server 2012 R2. There are two ways to have clients and servers get TCP/IP addresses:
* You can manually assign the addresses.
* The addresses can be assigned automatically.
Manually assigning addresses is a fairly simple process. An administrator goes to each of the machines on the network and assigns TCP/IP addresses. The problem with this method arises when the network becomes midsized or larger. Think of an administrator trying to individually assign 4,000 TCP/IP addresses, subnet masks, default gateways, and all other configuration options needed to run the network.
DHCP's job is to centralize the process of IP address and option assignment. You can configure a DHCP server with a range of addresses (called a _pool_ ) and other configuration information and let it assign all of the IP parameters—addresses, default gateways, DNS server addresses, and so on.
* * *
DHCP is defined by a series of request for comments documents, notably 2131 and 2132.
* * *
### Introducing the DORA Process
An easy way to remember how DHCP works is to learn the acronym DORA. _DORA_ stands for Discover, Offer, Request, and Acknowledge. In brief, here is DHCP's DORA process:
1. _Discover_ : When IP networking starts up on a DHCP-enabled client, a special message called a DHCPDISCOVER is broadcast within the local physical subnet.
2. _Offer_ : Any DHCP server that hears the request checks its internal database and replies with a message called a DHCPOFFER, which contains an available IP address.
The contents of this message depend on how the DHCP server is configured—there are numerous options aside from an IP address that you can specify to pass to the client on a Windows Server DHCP server.
3. _Request_ : The client receives one or more DHCPOFFERs (depending on how many DHCP servers exist on the local subnet), chooses an address from one of the offers, and sends a DHCPREQUEST message to the server to signal acceptance of the DHCPOFFER.
This message might also request additional configuration parameters.
Other DHCP servers that sent offers take the request message as an acknowledgment that the client didn't accept their offer.
4. _Acknowledge_ : When the DHCP server receives the DHCPREQUEST, it marks the IP address as being in use (that is, usually, though it's not required). Then it sends a DHCPACK to the client.
The acknowledgment message might contain requested configuration parameters.
If the server is unable to accept the DHCPREQUEST for any reason, it sends a DHCPNAK message. If a client receives a DHCPNAK, it begins the configuration process over again.
5. When the client accepts the IP offer, the address is assigned to the client for a specified period of time, called a _lease_. After receiving the DHCPACK message, the client performs a final check on the parameters (sometimes it sends an ARP request for the offered IP address) and makes note of the duration of the lease. The client is now configured. If the client detects that the address is already in use, it sends a DHCPDECLINE.
If the DHCP server has given out all of the IP addresses in its pool, it won't make an offer. If no other servers make an offer, the client's IP network initialization will fail, and the client will use Automatic Private IP Addressing (APIPA).
#### DHCP Lease Renewal
No matter how long the lease period, the client sends a new lease request message directly to the DHCP server when the lease period is half over (give or take some randomness required by RFC 2131). This period goes by the name _T1_ (not to be confused with the T1 type of network connection). If the server hears the request message and there's no reason to reject it, it sends a DHCPACK to the client. This resets the lease period.
If the DHCP server isn't available, the client realizes that the lease can't be renewed. The client continues to use the address, and once 87.5 percent of the lease period has elapsed (again, give or take some randomness), the client sends out another renewal request. This interval is known as _T2_. At that point, any DHCP server that hears the renewal can respond to this _DHCP request message_ (which is a request for a lease renewal) with a DHCPACK and renew the lease. If at any time during this process the client gets a negative DHCPNACK message, it must stop using its IP address immediately and start the leasing process over from the beginning by requesting a new lease.
When a client initializes its IP networking, it always attempts to renew its old address. If the client has time left on the lease, it continues to use the lease until its end. If the client is unable to get a new lease by that time, all IP functions stop until a new, valid address can be obtained.
#### DHCP Lease Release
Although leases can be renewed repeatedly, at some point they might run out. Furthermore, the lease process is "at will." That is, the client or server can cancel the lease before it ends. In addition, if the client doesn't succeed in renewing the lease before it expires, the client loses its lease and reverts to APIPA. This release process is important for reclaiming extinct IP addresses used by systems that have moved or switched to a non-DHCP address.
### Advantages and Disadvantages of DHCP
DHCP was designed from the start to simplify network management. It has some significant advantages, but it also has some drawbacks.
#### Advantages of DHCP
The following are advantages of DHCP:
* Configuration of large and even midsized networks is much simpler. If a DNS server address or some other change is necessary to the client, the administrator doesn't have to touch each device in the network physically to reconfigure it with the new settings.
* Once you enter the IP configuration information in one place—the server—it's automatically propagated to clients, eliminating the risk that a user will misconfigure some parameters and require you to fix them.
* IP addresses are conserved because DHCP assigns them only when requested.
* IP configuration becomes almost completely automatic. In most cases, you can plug in a new system (or move one) and then watch as it receives a configuration from the server. For example, when you install new network changes, such as a gateway or DNS server, the client configuration is done at only one location—the DHCP server.
* It allows a preboot execution environment (PXE) client to get a TCP/IP address from DHCP. PXE clients (also called Microsoft Windows Deployment Services [WDS] clients) can get an IP address without needing to have an operating system installed. This allows WDS clients to connect to a WDS server through the TCP/IP protocol and download an operating system remotely.
#### Disadvantages of DHCP
Unfortunately, there are a few drawbacks with DHCP:
* DHCP can become a single point of failure for your network. If you have only one DHCP server and it's not available, clients can't request or renew leases.
* If the DHCP server contains incorrect information, the misinformation will automatically be delivered to all of your DHCP clients.
* If you want to use DHCP on a multisegment network, you must put either a DHCP server or a relay agent on each segment, or you must ensure that your router can forward Bootstrap Protocol (BOOTP) broadcasts.
### _Ipconfig_ Lease Options
The `ipconfig` command-line tool is useful for working with network settings. Its /`renew` and /`release` switches make it particularly handy for DHCP clients. These switches allow you to request renewal of, or give up, your machine's existing address lease. You can do the same thing by toggling the Obtain An IP Address Automatically button in the Internet Protocol (TCP/IP) Properties dialog box, but the command-line option is useful especially when you're setting up a new network.
For example, I spend about a third of my time teaching MCSA or MCSE classes, usually in temporary classrooms set up at conferences, hotels, and so on. Laptops are used in these classes, with one brawny one set up as a DNS/DHCP/DC server. Occasionally, a client will lose its DHCP lease (or not get one, perhaps because a cable has come loose). The quickest way to fix it is to pop open a command-line window and type **`ipconfig/renew`**.
You can configure DHCP to assign options only to certain classes. _Classes_ , defined by an administrator, are groups of computers that require identical DHCP options. The /`setclassid _classID_` switch of `ipconfig` is the only way to assign a machine to a class.
More specifically, the switches do the following:
`ipconfig /renew` Instructs the DHCP client to request a lease renewal. If the client already has a lease, it requests a renewal from the server that issued the current lease. This is equivalent to what happens when the client reaches the half-life of its lease. Alternatively, if the client doesn't currently have a lease, it is equivalent to what happens when you boot a DHCP client for the first time. It initiates the DHCP mating dance, listens for lease offers, and chooses one it likes.
`ipconfig /release` Forces the client to give up its lease immediately by sending the server a DHCP release notification. The server updates its status information and marks the client's old IP address as "available," leaving the client with no address bound to its network interface. When you use this command, most of the time it will be immediately followed by `ipconfig/renew`. The combination releases the existing lease and gets a new one, probably with a different address. (It's also a handy way to force your client to get a new set of settings from the server before the lease expiration time.)
`ipconfig /setclassidclassID` Sets a new class ID for the client. You will see how to configure class options later in the section "Setting Scope Options for IPv4." For now, you should know that the only way to add a client machine to a class is to use this command. Note that you need to renew the client lease for the class assignment to take effect.
If you have multiple network adapters in a single machine, you can provide the name of the adapter (or adapters) upon which you want the command to work, including an asterisk (`∗`) as a wildcard. For example, one of my servers has two network cards: an Intel EtherExpress (ELNK1) and a generic 100Mbps card. If you want to renew DHCP settings for both adapters, you can type **`ipconfig /renew ∗`**. If you just want to renew the Intel EtherExpress card, you can type **`ipconfig /renew ELNK1`**.
### Understanding Scope Details
By now you should have a good grasp of what a lease is and how it works. To learn how to configure your servers to hand out those leases, however, you need to have a complete understanding of some additional topics: scopes, superscopes, exclusions, reservations, address pool, and relay agents.
#### Scope
Let's start with the concept of a _scope_ , which is a contiguous range of addresses. There's usually one scope per physical subnet, and a scope can cover a Class A, Class B, or Class C network address or a TCP/IP v6 address. DHCP uses scopes as the basis for managing and assigning IP addressing information.
Each scope has a set of parameters, or scope options, that you can configure. _Scope options_ control what data is delivered to DHCP clients when they're completing the DHCP negotiation process with a particular server. For example, the DNS server name, default gateway, and default network time server are all separate options that can be assigned. These settings are called _option types_. You can use any of the types provided with Windows Server 2012 R2, or you can specify your own.
#### Superscope
A _superscope_ enables the DHCP server to provide addresses from more than one scope to clients on the same physical subnet. This is helpful when clients within the same subnet have more than one IP network and thus need IPs from more than one address pool. Microsoft's DHCP snap-in allows you to manage IP address assignment in the superscope, though you must still configure other scope options individually for each child scope.
#### Exclusions and Reservations
The scope defines what IP addresses could potentially be assigned, but you can influence the assignment process in two additional ways by specifying exclusions and reservations:
Exclusions These are IP addresses within the range that you never want automatically assigned. These excluded addresses are off-limits to DHCP. You'll typically use exclusions to tag any addresses that you never want the DHCP server to assign at all. You might use exclusions to set aside addresses that you want to assign permanently to servers that play a vital role in your organization.
Reservations These are IP addresses within the range for which you want a permanent DHCP lease. They essentially reserve a particular IP address for a particular device. The device still goes through the DHCP process (that is, its lease expires and it asks for a new one), but it always obtains the same addressing information from the DHCP server.
* * *
_Exclusions_ are useful for addresses that you don't want to participate in DHCP at all. _Reservations_ are helpful for situations in which you want a client to get the same settings each time they obtain an address.
* * *
* * *
An address cannot be simultaneously reserved and excluded. Be aware of this fact for the exam, possibly relating to a troubleshooting question.
* * *
* * *
# Using Reservations and Exclusions
Deciding when to assign a reservation or exclusion can sometimes be confusing. In practice, you'll find that certain computers in the network greatly benefit by having static IP network information. Servers such as DNS servers, the DHCP server itself, SMTP servers, and other low-level infrastructure servers are good candidates for static assignment. There are usually so few of these servers that the administrator is not overburdened if a change in network settings requires going out to reconfigure each individually. Chances are that the administrator would still need to reconfigure these servers manually (by using `ipconfig /release` and then `ipconfig /renew`), even if they did not have IP addresses reserved. Even in large installations, I find it preferable to manage these vital servers by hand rather than to rely on DHCP.
Reservations are also appropriate for application servers and other special but nonvital infrastructure servers. With a reservation in DHCP, the client device will still go through the DHCP process but will always obtain the same addressing information from the DHCP server. The premise behind this strategy is that these nonvital servers can withstand a short outage if DHCP settings change or if the DHCP server fails.
* * *
#### Address Pool
The range of IP addresses that the DHCP server can assign is called its _address pool_. For example, let's say you set up a new DHCP scope covering the 192.168.1 subnet. That gives you 255 IP addresses in the pool. After adding an exclusion from 192.168.1.240 to 192.168.1.254, you're left with 241 (255 – 14) IP addresses in the pool. That means (in theory, at least) that you can service 241 unique clients at a time before you run out of IP addresses.
#### DHCP Relay Agent
By design, DHCP is intended to work only with clients and servers on a single IP network to communicate. But RFC 1542 sets out how BOOTP (on which DHCP is based) should work in circumstances in which the client and server are on different IP networks. If no DHCP server is available on the client's network, you can use a DHCP relay agent to forward DHCP broadcasts from the client's network to the DHCP server. The relay agent acts like a radio repeater, listening for DHCP client requests and retransmitting them through the router to the server.
## Installing and Authorizing DHCP
Installing DHCP is easy using the Windows Server 2012/2012 R2 installation mechanism. Unlike some other services discussed in this book, the installation process installs just the service and its associated snap-in, starting it when the installation is complete. At that point, it's not delivering any DHCP service, but you don't have to reboot.
### Installing DHCP
Exercise 2.7 shows you how to install DHCP Server using Server Manager. This exercise was completed on a Windows Server 2012 R2 Member Server since Active Directory is not installed yet.
* * *
### EXERCISE 2.7: Installing the DHCP Service
1. Choose Server Manager by clicking the Server Manager icon on the taskbar.
2. Click Add Roles And Features.
3. Choose role-based or feature-based installation and click Next.
4. Choose your server and click Next.
5. Choose DHCP and click Next.
6. At the Features screen, click Next.
7. Click Next at the DHCP screen.
8. At the DHCP confirmation screen, click the Install button.
9. When the installation is complete, click the Close button.
10. On the left side, click the DHCP link.
11. Click the More link next to Configuration Required For DHCP Server.
12. Under Action, click Complete DHCP Configuration.
13. At the DHCP Description page, click Commit.
14. Click Close at the Summary screen.
15. Close Server Manager.
* * *
### Introducing the DHCP Snap-In
When you install the DHCP server, the DHCP snap-in is also installed. You can open it by selecting Administrative Tools DHCP. Figure 2.17 shows the snap-in.
**FIGURE 2.17** DHCP snap-in
As you can see, the snap-in follows the standard MMC model. The left pane displays IPv4 and IPv6 sections and which servers are available; you can connect to servers other than the one to which you're already connected. A `Server Options` folder contains options that are specific to a particular DHCP server. Each server contains subordinate items grouped into folders. Each scope has a folder named after the scope's IP address range. Within each scope, four subordinate views show you interesting things about the scope, such as the following:
* The Address Pool view shows what the address pool looks like.
* The Address Leases view shows one entry for each current lease. Each lease shows the computer name to which the lease was issued, the corresponding IP address, and the current lease expiration time.
* The Reservations view shows the IP addresses that are reserved and which devices hold them.
* The Scope Options view lists the set of options you've defined for this scope.
### Authorizing DHCP for Active Directory
_Authorization_ creates an Active Directory object representing the new server. It helps keep unauthorized servers off your network. Unauthorized servers can cause two kinds of problems. They may hand out bogus leases, or they may fraudulently deny renewal requests from legitimate clients.
When you install a DHCP server using Windows Server 2012/2012 R2 and Active Directory is present on your network, the server won't be allowed to provide DHCP services to clients until it has been authorized. If you install DHCP on a member server in an Active Directory domain or on a stand-alone server, you'll have to authorize the server manually. When you authorize a server, you're adding its IP address to the Active Directory object that contains the IP addresses of all authorized DHCP servers.
* * *
You also have the ability to authorize a DHCP server during the installation of DHCP if you are installing DHCP onto an Active Directory machine.
* * *
At start time, each DHCP server queries the directory, looking for its IP address on the "authorized" list. If it can't find the list or if it can't find its IP address on the list, the DHCP service fails to start. Instead, it adds a message to the event log, indicating that it couldn't service client requests because the server wasn't authorized.
Exercise 2.8 and Exercise 2.9 show you how to authorize and unauthorize a DHCP server onto a network with Active Directory. If you installed DHCP onto a network with a domain, you can complete the following two exercises, but if you are still on a member server, you _cannot_ do these exercises. These are here to show you how to do it after you have Active Directory on your network.
* * *
### EXERCISE 2.8: Unauthorizing a DHCP Server
1. From Administrative Tools, choose DHCP to open the DHCP snap-in.
2. Right-click the server you want to unauthorize and choose the Unauthorize command.
3. Click Yes on the dialog box asking if you are sure you want to complete this action.
* * *
* * *
### EXERCISE 2.9: Authorizing a DHCP Server
1. From Administrative Tools, choose DHCP to open the DHCP snap-in.
2. Right-click the server you want to authorize and choose the Authorize command.
3. Wait a short time (30 to 45 seconds) to allow the authorization to take place.
4. Right-click the server again. Verify that the Unauthorize command appears in the pop-up menu. This indicates that the server is now authorized.
* * *
## Creating and Managing DHCP Scopes
You can use any number of DHCP servers on a single physical network if you divide the range of addresses that you want assigned into multiple scopes. Each scope contains a number of useful pieces of data, but before you can understand them, you need to know some additional terminology.
You can perform the following management tasks on DHCP scopes:
* Create a scope
* Configure scope properties
* Configure reservations and exclusions
* Set scope options
* Activate and deactivate scopes
* Create a superscope
* Create a multicast scope
* Integrate Dynamic DNS and DHCP
I will cover each task in the following sections.
### Creating a New Scope in IPv4
Like many other things in Windows Server 2012 R2, a wizard drives the process of creating a new scope. You will most likely create a scope while installing DHCP, but you may need to create more than one. The overall process is simple, as long as you know beforehand what the wizard is going to ask. If you think about what defines a scope, you'll be well prepared. You need to know the following:
* The IP address range for the scope you want to create.
* Which IP addresses, if any, you want to exclude from the address pool.
* Which IP addresses, if any, you want to reserve.
* Values for the DHCP options you want to set, if any. This item isn't strictly necessary for creating a scope. However, to create a useful scope, you'll need to have some options to specify for the clients.
To create a scope, under the server name, right-click the IPv4 option in the DHCP snap-in, and use the Action New Scope command. This starts the New Scope Wizard (see Figure 2.18). You will look at each page of the wizard in the following sections.
**FIGURE 2.18** Welcome page of the New Scope Wizard
#### Setting the Screen Name
The Scope Name page allows you to enter a name and description for your scope. These will be displayed by the DHCP snap-in.
* * *
It's a good idea to pick sensible names for your scopes so that other administrators will be able to figure out the purpose of the scope. For example, the name DHCP is likely not very helpful, whereas a name like 1st Floor Subnet is more descriptive and can help in troubleshooting.
* * *
#### Defining the IP Address Range
The IP Address Range page (see Figure 2.19) is where you enter the start and end IP addresses for your range. The wizard does minimal checking on the addresses you enter, and it automatically calculates the appropriate subnet mask for the range. You can modify the subnet mask if you know what you're doing.
**FIGURE 2.19** IP Address Range page of the New Scope Wizard
#### Adding Exclusions and Delay
The Add Exclusions And Delay page (see Figure 2.20) allows you to create exclusion ranges. Exclusions are TCP/IP numbers that are in the pool, but they do not get issued to clients. To exclude one address, put it in the Start IP Address field. To exclude a range, also fill in the End IP Address field. The delay setting is a time duration by which the server will delay the transmission of a DHCPOFFER message.
**FIGURE 2.20** Add Exclusions And Delay page of the New Scope Wizard
* * *
Although you can always add exclusions later, it's best to include them when you create the scope so that no excluded addresses are ever passed out to clients.
* * *
#### Setting a Lease Duration
The Lease Duration page (see Figure 2.21) allows you to set how long a device gets to use an assigned IP address before it has to renew its lease. The default lease duration is eight days. You may find that a shorter or longer duration makes sense for your network. If your network is highly dynamic, with lots of arrivals, departures, and moving computers, set a shorter lease duration; if it's less active, make it longer.
**FIGURE 2.21** Lease Duration page of the New Scope Wizard
* * *
Remember that renewal attempts begin when approximately half of the lease period is over (give or take a random interval), so don't set them too short.
* * *
#### Configuring Basic DHCP Options
The Configure DHCP Options page (see Figure 2.22) allows you to choose whether you want to set up basic DHCP options such as default gateway and DNS settings. The options are described in the following sections. If you choose not to configure options, you can always do so later. However, you should not activate the scope until you've configured the options you want assigned.
**FIGURE 2.22** Configure DHCP Options page of the New Scope Wizard
##### Configuring a Router
The first option configuration page is the Router (Default Gateway) page (see Figure 2.23), in which you enter the IP addresses of one or more routers (more commonly referred to as _default gateways_ ) that you want to use for outbound traffic. After entering the IP addresses of the routers, use the Up and Down buttons to order the addresses. Clients will use the routers in the order specified when attempting to send outgoing packets.
**FIGURE 2.23** Router (Default Gateway) page of the New Scope Wizard
##### Providing DNS Settings
On the Domain Name And DNS Servers page (see Figure 2.24), you specify the set of DNS servers and the parent domain you want passed down to DHCP clients. Normally, you'll want to specify at least one DNS server by filling in its DNS name or IP address. You can also specify the domain suffix that you want clients to use as the base domain for all connections that aren't fully qualified. For example, if your clients are used to navigating based on server name alone rather than the fully qualified domain name (FQDN) of `server.willpanek.com`, then you'll want to place your domain here.
**FIGURE 2.24** Domain Name And DNS Servers page of the New Scope Wizard
##### Providing WINS Settings
If you're still using Windows Internet Name Service (WINS) on your network, you can configure DHCP so that it passes WINS server addresses to your Windows clients. (If you want the Windows clients to honor it, you'll also need to define the WINS/NBT Node Type option for the scope.) As on the DNS server page, on the WINS Servers page (see Figure 2.25) you can enter the addresses of several servers and move them into the order in which you want clients to try them. You can enter the DNS or NetBIOS name of each server, or you can enter an IP address.
**FIGURE 2.25** WINS Servers page of the New Scope Wizard
Here are some of the more common options you can set on a DHCP server:
003 Router Used to provide a list of available routers or default gateways on the same subnet.
006 DNS Servers Used to provide a list of DNS servers.
015 DNS Domain Name Used to provide the DNS suffix.
028 Broadcast Address Used to configure the broadcast address, if different than the default, based on the subnet mask.
44 WINS/NBNS Servers Used to configure the IP addresses of WINS servers.
46 WINS/NBT Node Type Used to configure the preferred NetBIOS name resolution method. There are four settings for node type:
1. B node (0x1) Broadcast for NetBIOS resolution
2. P node (0x2) Peer-to-peer (WINS) server for NetBIOS resolution
3. M node (0x4) Mixed node (does a B node and then a P node)
4. H node (0x8) Hybrid node (does a P node and then a B node)
051 Lease Used to configure a special lease duration.
##### Activating the Scope
The Activate Scope page (see Figure 2.26) gives you the option to activate the scope immediately after creating it. By default, the wizard assumes that you want the scope activated unless you select the No, I Will Activate This Scope Later radio button, in which case the scope will remain dormant until you activate it manually.
**FIGURE 2.26** Activate Scope page of the New Scope Wizard
* * *
Be sure to verify that there are no other DHCP servers assigned to the address range you choose!
* * *
In Exercise 2.10, you will create a new scope for the 192.168.0.xprivate Class C network. First you need to complete Exercise 2.7 before beginning this exercise.
* * *
### EXERCISE 2.10: Creating a New Scope
1. Open the DHCP snap-in by selecting Administrative Tools DHCP.
2. Right-click the IPv4 folder and choose New Scope. The New Scope Wizard appears.
3. Click the Next button on the welcome page.
4. Enter a name and a description for your new scope and click the Next button.
5. On the IP Address Range page, enter 192.168.0.2 as the start IP address for the scope and 192.168.0.250 as the end IP address. Leave the subnet mask controls alone (though when creating a scope on a production network, you might need to change them). Click the Next button.
6. On the Add Exclusions And Delay page, click Next without adding any excluded addresses or delays.
7. On the Lease Duration page, set the lease duration to 3 days and click the Next button.
8. On the Configure DHCP Options page, click the Next button to indicate you want to configure default options for this scope.
9. On the Router (Default Gateway) page, enter 192.168.0.1 for the router IP address and then click the Add button. Once the address is added, click the Next button.
10. On the Domain Name And DNS Servers page, enter the IP address of a DNS server on your network in the IP Address field (for example, you might enter 192.168.0.251) and click the Add button. Click the Next button.
11. On the WINS Servers page, click the Next button to leave the WINS options unset.
12. On the Activate Scope page, if your network is currently using the 192.168.0. _x_ range, select Yes, I Want To Activate This Scope Now. Click the Next button.
13. When the wizard's summary page appears, click the Finish button to create the scope.
* * *
### Creating a New Scope in IPv6
Now that you have seen how to create a new scope in IPv4, I'll go through the steps to create a new scope in IPv6.
To create a scope, right-click the IPv6 option in the DHCP snap-in under the server name and select the Action New Scope command. This starts the New Scope Wizard. Just as with creating a scope in IPv4, the welcome page of the wizard tells you that you've launched the New Scope Wizard. You will look at each page of the wizard in the following sections.
#### Setting the Screen Name
The Scope Name page (see Figure 2.27) allows you to enter a name and description for your scope. These will be displayed by the DHCP snap-in.
**FIGURE 2.27** IPv6 Scope Name page of the New Scope Wizard
* * *
It's a good idea to pick a sensible name for your scopes so that other administrators will be able to figure out what the scope is used for.
* * *
#### Scope Prefix
The Scope Prefix page (see Figure 2.28) gets you started creating the IPv6 scope. IPv6 has three types of addresses, which can be categorized by type and scope.
**FIGURE 2.28** Scope Prefix page of the New Scope Wizard
Unicast Addresses _One-to-one._ A packet from one host is delivered to another host. The following are some examples of IPv6 unicast:
* The unicast prefix for site-local addresses is FEC0::/48.
* The unicast prefix for link-local addresses is FE80::/64.
The 6to4 address allows communication between two hosts running both IPv4 and IPv6. The way to calculate the 6to4 address is by combining the global prefix 2002::/16 with the 32 bits of a public IPv4 address of the host. This gives you a 48-bit prefix. 6to4 is described in RFC 3056.
Multicast addresses _One-to-many._ A packet from one host is delivered to multiple hosts (but not everyone). The prefix for multicast addresses is FF00::/8.
Anycast addresses A packet from one host is delivered to the nearest of multiple hosts (in terms of routing distance).
#### Adding Exclusions
As with the IPv4 New Scope Wizard, the Add Exclusions page (see Figure 2.29) allows you to create exclusion ranges. _Exclusions_ are TCP/IP numbers that are in the pool but do not get issued to clients. To exclude one address, put it in the Start IPv6 Address field. To exclude a range, also fill in the End IPv6 Address field.
**FIGURE 2.29** Add Exclusions page of the New Scope Wizard
#### Setting a Lease Duration
The Scope Lease page (see Figure 2.30) allows you to set how long a device gets to use an assigned IP address before it has to renew its lease. You can set two different lease durations. The section labeled Non Temporary Address (IANA) is the lease time for your more permanent hosts (such as printers and server towers). The one labeled Temporary Address (IATA) is for hosts that might disconnect at any time, such as laptops.
**FIGURE 2.30** Scope Lease page of the New Scope Wizard
#### Activating the Scope
The Completing The New Scope Wizard page (see Figure 2.31) gives you the option to activate the scope immediately after creating it. By default, the wizard will assume you want the scope activated. If you want to wait to activate the scope, choose No in the Activate Scope Now box.
**FIGURE 2.31** Completing The New Scope Wizard page of the New Scope Wizard
### Changing Scope Properties (IPv4 and IPv6)
Each scope has a set of properties associated with it. Except for the set of options assigned by the scope, you can find these properties on the General tab of the scope's Properties dialog box (see Figure 2.32). Some of these properties, such as the scope name and description, are self-explanatory. Others require a little more explanation.
**FIGURE 2.32** General tab of the scope's Properties dialog box for an IPv4 scope
* The Start IP Address and End IP Address fields allow you to set the range of the scope.
* For IPv4 scopes, the settings in the section Lease Duration For DHCP Clients control how long leases in this scope are valid.
The IPv6 scope dialog box includes a Lease tab where you set the lease properties.
* * *
When you make changes to these properties, they have no effect on existing leases. For example, say you create a scope from 172.30.1.1 to 172.30.1.199. You use that scope for a while and then edit its properties to reduce the range from 172.30.1.1 to 172.30.1.150. If a client has been assigned the address 172.30.1.180, which was part of the scope before you changed it, the client will retain that address until the lease expires but will not be able to renew it.
* * *
### Changing Server Properties
Just as each scope has its own set of properties, so too does the server itself. You access the server properties by right-clicking the IPv4 or IPv6 object within the DHCP management console and selecting Properties.
#### IPv4 Server Properties
Figure 2.33 shows the IPv4 Properties dialog box.
**FIGURE 2.33** General tab of the IPv4 Properties dialog box for the server
The IPv4 Properties dialog box has four tabs: General, DNS, Network Access Protection, and Advanced.
The Advanced tab, shown in Figure 2.34, contains the following configuration parameters:
**FIGURE 2.34** The Advanced tab of the IPv4 Properties dialog box for the server
* Audit Log File Path is where you enter the location for log files.
* Conflict Detection Attempts specifies how many ICMP echo requests (pings) the server sends for an address it is about to offer. The default is 0. Conflict detection is a way to verify that the DHCP server is not issuing IP addresses that are already being used on the network.
The Network Access Protection tab (see Figure 2.35) allows you to set up _Network Access Protection (NAP)_. With NAP, which is a Windows Server 2012 R2 service, an administrator can perform the following tasks:
**FIGURE 2.35** The Network Access Protection tab of the IPv4 Properties dialog box for the server
* Carry out computer health policy validation
* Ensure ongoing compliance with health policies
* Optionally restrict the access of computers that do not meet the computer health requirements
#### IPv6 Server Properties
The IPv6 Properties dialog box for the server has two tabs: General and Advanced. On the General tab (see Figure 2.36), you can configure the following settings:
**FIGURE 2.36** Server's IPv6 Properties, General tab
* Frequency with which statistics are updated
* DHCP auditing
The Advanced tab (see Figure 2.37) allows you to configure the following settings:
**FIGURE 2.37** Server's IPv6 Properties, Advanced tab
* Database path for the audit log file path.
* Connection bindings.
* Registration credentials for dynamic DNS. The registration credential is the user account that DHCP will use to register clients with Active Directory.
### Managing Reservations and Exclusions
After defining the address pool for your scope, the next step is to create reservations and exclusions, which reduce the size of the pool. In the following sections, you will learn how to add and remove exclusions and reservations.
#### Adding and Removing Exclusions
When you want to exclude an entire range of IP addresses, you need to add that range as an exclusion. Ordinarily, you'll want to do this before you enable a scope because that prevents any of the IP addresses you want excluded from being leased before you have a chance to exclude them. In fact, you can't create an exclusion that includes a leased address—you have to get rid of the lease first.
##### Adding an Exclusion Range
Here's how to add an exclusion range:
1. Open the DHCP snap-in and find the scope to which you want to add an exclusion (either IPv4 or IPv6).
2. Expand the scope so that you can see its Address Pool item for IPv4 or the Exclusion section for IPv6.
3. Right-click the Address Pool or Exclusion section and choose the New Exclusion Range command.
4. When the Add Exclusion dialog box appears (see Figure 2.38), enter the IP addresses you want to exclude. To exclude a single address, type it in the Start IP Address field. To exclude a range of addresses, also fill in the End IP Address field.
**FIGURE 2.38** Add Exclusion dialog boxes for IPv4 and IPv6
5. Click the Add button to add the exclusion.
When you add exclusions, they appear in the Address Pool node, which is under the Scope section for IPv4 and under the Exclusion section of IPv6.
##### Removing an Exclusion Range
To remove an exclusion, just right-click it and choose the Delete command. After confirming your command, the snap-in removes the excluded range and the addresses become immediately available for issuance.
#### Adding and Removing Reservations
Adding a reservation is simple as long as you have the MAC address of the device for which you want to create a reservation. Because reservations belong to a single scope, you create and remove them within the Reservations node beneath each scope.
##### Adding a Reservation
To add a reservation, perform the following tasks:
1. Right-click the scope and select New Reservation.
This displays the New Reservation dialog box, shown in Figure 2.39.
**FIGURE 2.39** New Reservation dialog boxes for IPv4 and IPv6
2. Enter the IP address and MAC address or ID for the reservation.
* * *
To find the MAC address of the local computer, use the `ipconfig` command. To find the MAC address of a remote machine, use the `nbtstat-a _computername_` command.
* * *
3. If you want, you can also enter a name and description.
4. For IPv4, in the Supported Types section, choose whether the reservation will be made by DHCP only, BOOTP only (useful for remote-access devices), or both.
##### Removing a Reservation
To remove a reservation, right-click it and select Delete. This removes the reservation but does nothing to the client device.
* * *
There's no way to change a reservation once it has been created. If you want to change any of the associated settings, you'll have to delete and re-create the reservation.
* * *
### Setting Scope Options for IPv4
Once you've installed a server, authorized it in Active Directory, and fixed up the address pool, the next step is to set scope options that you want sent out to clients, such as router (that is, default gateway) and DNS server addresses. You must configure the options you want sent out before you activate a scope. If you don't, clients may register in the scope without getting any options, rendering them virtually useless. Thus, configure the scope options, along with the IP address and subnet mask that you configured earlier in this chapter.
In the following sections, you will learn how to configure and assign scope options on the DHCP server.
#### Understanding Option Assignment
You can control which DHCP options are doled out to clients in five (slightly overlapping) ways:
Predefined Options _Predefined options_ are templates that are available in the Server, Scope, or Client Options dialog box.
Server Options _Server options_ are assigned to all scopes and clients of a particular server. That means if there's some setting you want all clients of a DHCP server to have, no matter what scope they're in, this is where you assign it. Specific options (those that are set at the class, scope, or client level) will override server-level options. That gives you an escape valve; it's a better idea, though, to be careful about which options you assign if your server manages multiple scopes.
Scope Options If you want a particular option value assigned only to those clients in a certain subnet, you should assign it as a _scope option_. For example, it's common to specify different routers for different physical subnets; if you have two scopes corresponding to different subnets, each scope would probably have a separate value for the router option.
Class Options You can assign different options to clients of different types, that is, _class options_. For example, Windows 2000, XP, Vista, Windows 7, Windows 8, Server 2003, Server 2003 R2, Server 2008, Server 2008 R2, and Server 2012/2012 R2 machines recognize a number of DHCP options that Windows 98, Windows NT, and Mac OS machines ignore, and vice versa. By defining a Windows 2000 or newer class (using the `ipconfig /setclassid` command you saw earlier), you could assign those options only to machines that report themselves as being in that class.
Client Options If a client is using DHCP reservations, you can assign certain options to that specific client. You attach _client options_ to a particular reservation. Client options override scope, server, and class options. The only way to override a client option is to configure the client manually. The DHCP server manages client options.
* * *
Client options override class options, class options override scope options, and scope options override server options.
* * *
#### Assigning Options
You can use the DHCP snap-in to assign options at the scope, server, reserved address, or class level. The mechanism you use to assign these options is the same for each; the only difference is where you set the options.
When you create an option assignment, remember that it applies to all of the clients in the server or the scope from that point forward. Option assignments aren't retroactive, and they don't migrate from one scope to another.
##### Creating and Assigning a New Option
To create a new option and have it assigned, follow these steps:
1. Select the scope or server where you want the option assigned.
2. Select the corresponding Options node and choose Action Configure Options.
To set options for a reserved client, right-click its entry in the Reservations node and select Configure Options.
Then you'll see the Scope Options dialog box (see Figure 2.40), which lists all of the options that you might want to configure.
**FIGURE 2.40** The Scope Options dialog box
3. To select an individual option, check the box next to it and then use the controls in the Data Entry control group to enter the value you want associated with the option.
4. Continue to add options until you've specified all of the ones you want attached to the server or scope. Then click OK.
##### Configuring the DHCP Server for Classes
You saw how to assign classes to individual machines earlier in the chapter. Now you will learn how to configure the DHCP server to recognize your customized classes and configure options for them. In Exercise 2.11, you will create a new user class and configure options for the new class. Before you begin, make sure that the computers you want to use in the class have been configured with the `ipconfig /setclassid` command, as described in the section "`Ipconfig` Lease Options" earlier in this chapter.
* * *
### EXERCISE 2.11: Configuring User Class Options
1. Open the DHCP snap-in by selecting Administrative Tools DHCP.
2. Right-click the IPv4 item and select Define User Classes.
3. Click the Add button in the DHCP User Classes dialog box.
4. In the New Class dialog box, enter a descriptive name for the class in the Display Name field. Enter a class ID in the ID field. (Typically, you will enter the class ID in the ASCII portion of the ID field.) When you have finished, click OK.
5. The new class appears in the DHCP User Classes dialog box. Click the Close button to return to the DHCP snap-in.
6. Right-click the Scope Options node and select Configure Options.
7. Click the Advanced tab. Select the class you defined in step 4 from the User Class pop-up menu.
8. Configure the options you want to set for the class. Click OK when you have finished. Notice that the options you configured (and the class with which they are associated) appear in the right pane of the DHCP window.
* * *
##### About the Default Routing and Remote Access Predefined User Class
Windows Server 2012/2012 R2 includes a predefined user class called the _Default Routing and Remote Access class_. This class includes options important to clients connecting to Routing and Remote Access, notably the 051 Lease option.
* * *
Be sure to know that the 051 Lease option is included within this class and that it can be used to assign a shorter lease duration for clients connecting to Routing and Remote Access.
* * *
### Activating and Deactivating Scopes
When you've completed the steps in Exercise 2.5 and you're ready to unleash your new scope so that it can be used to make client assignments, the final required step is activating the scope. When you activate a scope, you're just telling the server that it's OK to start handing out addresses from that scope's address pool. As soon as you activate a scope, addresses from its pool may be assigned to clients. Of course, this is a necessary precondition to getting any use out of your scope.
If you later want to stop using a scope, you can, but be aware that it's a permanent change. When you deactivate a scope, DHCP tells all clients registered with the scope that they need to release their leases immediately and renew them someplace else—the equivalent of a landlord who evicts tenants when the building is condemned!
* * *
Don't deactivate a scope unless you want clients to stop using it immediately.
* * *
### Creating a Superscope for IPv4
A _superscope_ allows the DHCP server to provide multiple logical subnet addresses to DHCP clients on a single physical network. You create superscopes with the New Superscope command, which triggers the New Superscope Wizard.
* * *
You can have only one superscope per server.
* * *
The steps in Exercise 2.12 take you through the process of creating a superscope.
* * *
### EXERCISE 2.12: Creating a Superscope
1. Open the DHCP snap-in by selecting Administrative Tools DHCP.
2. Follow the instructions in Exercise 2.10 to create two scopes: one for 192.168.0.2 through 192.168.0.127 and one for 192.168.1.12 through 192.168.1.127.
3. Right-click IPv4 and choose the New Superscope command. The New Superscope Wizard appears. Click the Next button.
4. On the Superscope Name page, name your superscope and click the Next button.
5. The Select Scopes page appears, listing all scopes on the current server. Select the two scopes you created in step 2 and then click the Next button.
6. The wizard's summary page appears. Click the Finish button to create your scope.
7. Verify that your new superscope appears in the DHCP snap-in.
* * *
#### Deleting a Superscope
You can delete a superscope by right-clicking it and choosing the Delete command. A superscope is just an administrative convenience, so you can safely delete one at any time—it doesn't affect the "real" scopes that make up the superscope.
#### Adding a Scope to a Superscope
To add a scope to an existing superscope, find the scope you want to add, right-click it, and choose Action Add To Superscope. A dialog box appears, listing all of the superscopes known to this server. Pick the one to which you want the current scope appended and click the OK button.
#### Removing a Scope from a Superscope
To remove a scope from a superscope, open the superscope and right-click the target scope. The pop-up menu provides a Remove From Superscope command that will do the deed.
#### Activating and Deactivating Superscopes
Just as with regular scopes, you can activate and deactivate superscopes. The same restrictions and guidelines apply. You must activate a superscope before it can be used, and you must not deactivate it until you want all of your clients to lose their existing leases and be forced to request new ones.
To activate or deactivate a superscope, right-click the superscope name, and select Activate or Deactivate, respectively, from the pop-up menu.
### Creating IPv4 Multicast Scopes
_Multicasting_ occurs when one machine communicates to a network of subscribed computers rather than specifically addressing each computer on the destination network. It's much more efficient to multicast a video or audio stream to multiple destinations than it is to unicast it to the same number of clients, and the increased demand for multicast-friendly network hardware has resulted in some head scratching about how to automate the multicast configuration.
In the following sections, you will learn about MADCAP, the protocol that controls multicasting, and about how to build and configure a multicast scope.
#### Understanding the Multicast Address Dynamic Client Allocation Protocol
DHCP is usually used to assign IP configuration information for _unicast_ (or one-to-one) network communications. With multicast, there's a separate type of address space assigned from 224.0.0.0 through 239.255.255.255. Addresses in this space are known as _Class D addresses_ , or simply _multicast addresses_. Clients can participate in a multicast just by knowing (and using) the multicast address for the content they want to receive. However, multicast clients also need to have an ordinary IP address.
How do clients know what address to use? Ordinary DHCP won't help because it's designed to assign IP addresses and option information to one client at a time. Realizing this, the Internet Engineering Task Force (IETF) defined a new protocol: _Multicast Address Dynamic Client Allocation Protocol (MADCAP)_. MADCAP provides an analog to DHCP but for multicast use. A MADCAP server issues leases for multicast addresses only. MADCAP clients can request a multicast lease when they want to participate in a multicast.
DHCP and MADCAP have some important differences. First you have to realize that the two are totally separate. A single server can be a DHCP server, a MADCAP server, or both; no implied or actual relation exists between the two. Likewise, clients can use DHCP and/or MADCAP at the same time—the only requirement is that every MADCAP client has to get a unicast IP address from somewhere.
* * *
Remember that DHCP can assign options as part of the lease process but MADCAP cannot. The only thing MADCAP does is dynamically assign multicast addresses.
* * *
#### Building Multicast Scopes
Most of the steps you go through when creating a multicast scope are identical to those required for an ordinary unicast scope. Exercise 2.13 highlights the differences.
* * *
### EXERCISE 2.13: Creating a New Multicast Scope
1. Open the DHCP snap-in by selecting Administrative Tools DHCP.
2. Right-click IPv4 and choose New Multicast Scope. The New Multicast Scope Wizard appears. Click the Next button on the welcome page.
3. In the Multicast Scope Name page, name your multicast scope (and add a description if you'd like). Click the Next button.
4. The IP Address Range page appears. Enter a start IP address of 224.0.0.0 and an end IP address of 224.255.0.0. Adjust the TTL to 1 to make sure that no multicast packets escape your local network segment. Click the Next button when you're finished.
5. The Add Exclusions page appears; click its Next button.
6. The Lease Duration page appears. Since multicast addresses are used for video and audio, you'd ordinarily leave multicast scope assignments in place somewhat longer than you would with a regular unicast scope, so the default lease length is 30 days (instead of 8 days for a unicast scope). Click the Next button.
7. The wizard asks you if you want to activate the scope now. Click the No radio button and then the Next button.
8. The wizard's summary page appears; click the Finish button to create your scope.
9. Verify that your new multicast scope appears in the DHCP snap-in.
* * *
#### Setting Multicast Scope Properties
Once you create a multicast scope, you can adjust its properties by right-clicking the scope name and selecting Properties.
The Multicast Scope Properties dialog box has two tabs. The General tab (see Figure 2.41) allows you to change the scope's name, its start and end addresses, its Time To Live (TTL) value, its lease duration, and its description—in essence, all of the settings you provided when you created it in the first place.
**FIGURE 2.41** General tab of the Multicast Scope Properties dialog box
The Lifetime tab (see Figure 2.42) allows you to limit how long your multicast scope will be active. By default, a newly created multicast scope will live forever, but if you're creating a scope to provide MADCAP assignments for a single event (or a set of events of limited duration), you can specify an expiration time for the scope. When that time is reached, the scope disappears from the server but not before making all of its clients give up their multicast address leases. This is a nice way to make sure that the lease cleans up after itself when you're finished with it.
**FIGURE 2.42** Lifetime tab of the Multicast Scope Properties dialog box
### Integrating Dynamic DNS and IPv4 DHCP
DHCP integration with Dynamic DNS is a simple concept but powerful in action. By setting up this integration, you can pass addresses to DHCP clients while still maintaining the integrity of your DNS services.
The DNS server can be updated in two ways. One way is for the DHCP client to tell the DNS server its address. Another way is for the DHCP server to tell the DNS server when it registers a new client.
Neither of these updates will take place, however, unless you configure the DNS server to use Dynamic DNS. You can make this change in two ways:
* If you change it at the scope level, it will apply only to the scope.
* If you change it at the server level, it will apply to all scopes and superscopes served by the server.
Which of these options you choose depends on how widely you want to support Dynamic DNS; most of the sites I visit have enabled DNS updates at the server level.
To update the settings at either the server or scope level, you need to open the scope or server properties by right-clicking the appropriate object and choosing Properties. The DNS tab of the Properties dialog box (see Figure 2.43) includes the following options:
**FIGURE 2.43** DNS tab of the scope's IPv4 Properties dialog box
Enable DNS Dynamic Updates According To The Settings Below This check box controls whether this DHCP server will attempt to register lease information with a DNS server. It must be checked to enable Dynamic DNS.
1. Dynamically Update DNS A And PTR Records Only If Requested By The DHCP Clients This radio button (which is on by default) tells the DHCP server to register the update only if the DHCP client asks for DNS registration. When this button is active, DHCP clients that aren't hip to DDNS won't have their DNS records updated. However, Windows 2000, XP, Vista, Windows 7, Windows 8, Server 2003/2003 R2, Server 2008/2008 R2, and Server 2012/2012 R2 DHCP clients are smart enough to ask for the updates.
2. Always Dynamically Update DNS A And PTR Records This radio button forces the DHCP server to register any client to which it issues a lease. This setting may add DNS registrations for DHCP-enabled devices that don't really need them, such as print servers. However, it allows other clients (such as Mac OS, Windows NT, and Linux machines) to have their DNS information automatically updated.
Discard A And PTR Records When Lease Is Deleted This check box has a long name but a simple function. When a DHCP lease expires, what should happen to the DNS registration? Obviously, it would be nice if the DNS record associated with a lease vanished when the lease expired. When this check box is checked (as it is by default), that's exactly what happens. If you uncheck this box, your DNS will contain entries for expired leases that are no longer valid. When a particular IP address is reissued on a new lease, the DNS will be updated, but in between leases you'll have incorrect data in your DNS—something that's always best to avoid.
Dynamically Update DNS A And PTR Records For DHCP Clients That Do Not Request Updates This check box lets you handle these older clients graciously by making the updates using a separate mechanism.
In Exercise 2.14, you will enable a scope to participate in Dynamic DNS updates.
* * *
### EXERCISE 2.14: Enabling DHCP-DNS Integration
1. Open the DHCP snap-in by selecting Administrative Tools DHCP.
2. Right-click the IPv4 item and select Properties.
3. The Server Properties dialog box appears. Click the DNS tab.
4. Verify that the check box labeled Enable DNS Dynamic Updates According To The Settings Below is checked and verify that the radio button labeled Dynamically Update DNS A And PTR Records Only If Requested By The DHCP Clients is selected.
5. Verify that the check box labeled Discard A And PTR Records When Lease Is Deleted is checked. If not, then check it.
6. Click the OK button to apply your changes and close the Server Properties dialog box.
* * *
### Using Multiple DHCP Servers
DHCP can become a single point of failure within a network if there is only one DHCP server. If that server becomes unavailable, clients will not be able to obtain new leases or renew existing leases. For this reason, it is recommended that you have more than one DHCP server in the network. However, more than one DHCP server can create problems if they both are configured to use the same scope or set of addresses. Microsoft recommends the 80/20 rule for redundancy of DHCP services in a network.
Implementing the 80/20 rule calls for one DHCP server to make approximately 80 percent of the addresses for a given subnet available through DHCP while another server makes the remaining 20 percent of the addresses available. For example, with a /24 network of 254 addresses, say 192.168.1.1 to 192.168.1.254, you might have Server 1 offer 192.168.1.10 to 192.168.1.210 while Server 2 offers 192.168.1.211 to 192.168.254.
#### DHCP Load Sharing
Load sharing is the normal default way that you use multiple DHCP servers (as explained earlier). Both servers cover the same subnets (remember that a DHCP server can handle multiple subnets at the same time) simultaneously, and both servers assign IP addresses and options to clients on the assigned subnets. The client requests are load balanced and shared between the two servers.
This is a good option for a company that has multiple DHCP servers in the same physical location. The DHCP servers are set up in a failover relationship at the same site, and both servers respond to all DHCP client requests from the subnets to which they are associated. The DHCP server administrator can set the load distribution ratio between the multiple DHCP servers.
#### DHCP Hot Standby
When thinking of a DHCP hot standby setup, think of the old server failover cluster. You have two servers where one server does all of the work and the other server is a standby server in the event that the first server crashes or goes down.
In a DHCP hot standby situation, the two DHCP servers operate in a failover relationship where one server acts as an active server and is responsible for leasing IP addresses to all clients in a scope or subnet. The secondary DHCP server assumes the standby role, and it is ready to go in the event that the primary DHCP server becomes unavailable. If the primary server becomes unavailable, the secondary DHCP server is given the role of the primary DHCP server and takes over all the responsibilities of the primary DHCP server.
This failover situation is best suited to DHCP deployments where a company has DHCP servers in multiple locations.
* * *
To learn more about DHCP failover situations, please visit Microsoft at `<http://technet.microsoft.com/en-us/library/hh831385.aspx>`. Microsoft has been known for taking questions right off its websites, and this website is the perfect solution for doing this.
* * *
### Working with the DHCP Database Files
DHCP uses a set of database files to maintain its knowledge of scopes, superscopes, and client leases. These files, which live in the `_systemroot_ \System32\DHCP` folder, are always open when the DHCP service is running. DHCP servers use Joint Engine Technology (JET) databases to maintain their records.
* * *
You shouldn't modify or alter the DHCP database files when the service is running.
* * *
The primary database file is `dhcp.mdb`—it has all of the scope data in it.
The following files are also part of the DHCP database:
`Dhcp.tmp` This is a backup copy of the database file created during reindexing of the database. You normally won't see this file, but if the service fails during reindexing, it may not remove the file when it should.
`J50.log` This file (plus a number of files named `J50 _xxxxx_.log`, where `_xxxxx_` stands for 00001, 00002, 00003, and so on) is a log file that stores changes before they're written to the database. The DHCP database engine can recover some changes from these files when it restarts.
`J50.chk` This is a checkpoint file that tells the DHCP engine which log files it still needs to recover.
In the following sections, you will see how to manipulate the DHCP database files.
#### Removing the Database Files
If you're convinced that your database is corrupt because the lease information that you see doesn't match what's on the network, the easiest repair mechanism is to remove the database files and start over with an empty database.
* * *
If you think the database is corrupt because the DHCP service fails at startup, you should check the event log.
* * *
To start over, follow these steps:
1. Stop the DHCP service by typing **net stop dhcpserver** at the command prompt.
2. Remove all of the files from the `_systemroot_ \system32\DHCP` folder.
3. Restart the service (at command prompt type **net start dhcpserver** ).
4. Reconcile the scope.
#### Changing the Database Backup Interval
By default, the DHCP service backs up its databases every 60 minutes. You can adjust this setting by editing the Backup Interval value under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters`. This allows you to make backups either more frequently (if your database changes a lot or if you seem to have ongoing corruption problems) or less often (if everything seems to be on an even keel).
#### Moving the DHCP Database Files
You may find that you need to dismantle or change the role of your DHCP server and offload the DHCP functions to another computer. Rather than spend the time re-creating the DHCP database on the new machine by hand, you can copy the database files and use them directly. This is especially helpful if you have a complicated DHCP database with lots of reservations and option assignments.
By copying the files, you also minimize the amount of human error that could be introduced by reentering the information by hand.
#### Compacting the DHCP Database Files
There may be a time when you need to compact the DHCP database. Microsoft has a utility called `jetpack.exe` that allows you to compact the JET database. Microsoft JET databases are used for WINS and DHCP databases. If you wanted to use the `jetpack` command, the proper syntax is
JETPACK.EXE <database name><temp database name>
After you compact the database, you rename the temp database to `dhcp.mdb`.
## Summary
DNS was designed to be a robust, scalable, and high-performance system for resolving friendly names to TCP/IP host addresses. This chapter presented an overview of the basics of DNS and how DNS names are generated. We then looked at the many new features available in the Microsoft Windows Server 2012 R2 version of DNS, and we focused on how to install, configure, and manage the necessary services. Microsoft's DNS is based on a widely accepted set of industry standards. Because of this, Microsoft's DNS can work with both Windows- and non-Windows-based networks.
This chapter also covered the DHCP lease process as it relates to TCP/IP configuration information for clients. The following stages were covered: IP discovery, IP lease offer, IP lease selection, and IP lease acknowledgment. You learned how to install and configure the DHCP server on Windows Server 2012 R2 and how to create and manage DHCP scopes and scope options. I also discussed the authorization of DHCP servers within Active Directory and scopes for IPv4 and IPv6 and showed how to create them. Finally, I covered superscopes as well as managing client leases with the options therein.
## Exam Essentials
Understand the purpose of DNS. DNS is a standard set of protocols that defines a mechanism for querying and updating address information in the database, a mechanism for replicating the information in the database among servers, and a schema of the database.
Understand the different parts of the DNS database. The SOA record defines the general parameters for the DNS zone, including who is the authoritative server. NS records list the name servers for a domain; they allow other name servers to look up names in your domain. A host record (also called an address record or an A record) statically associates a host's name with its IP addresses. Pointer records (PTRs) map an IP address to a hostname, making it possible to do reverse lookups. Alias records allow you to use more than one name to point to a single host. The MX record tells you which servers can accept mail bound for a domain. SRV records tie together the location of a service (like a domain controller) with information about how to contact the service.
Know how DNS resolves names. With iterative queries, a client asks the DNS server for an answer, and the client, or resolver, returns the best kind of answer it has available. In a recursive query, the client sends a query to one name server, asking it to respond either with the requested answer or with an error. The error states either that the server can't come up with the right answer or that the domain name doesn't exist. With inverse queries, instead of supplying a name and then asking for an IP address, the client first provides the IP address and then asks for the name.
Understand the differences among DNS servers, clients, and resolvers. Any computer providing domain name services is a DNS server. A DNS client is any machine issuing queries to a DNS server. A resolver handles the process of mapping a symbolic name to an actual network address.
Know how to install and configure DNS. DNS can be installed before, during, or after installing the Active Directory service. When you install the DNS server, the DNS snap-in is installed too. Configuring a DNS server ranges from easy to difficult, depending on what you're trying to make it do. In the simplest configuration, for a caching-only server, you don't have to do anything except to make sure the server's root hints are set correctly. You can also configure a root server, a normal forward lookup server, and a reverse lookup server.
Know how to create new forward and reverse lookup zones. You can use the New Zone Wizard to create a new forward or reverse lookup zone. The process is basically the same for both types, but the specific steps and wizard pages differ somewhat. The wizard walks you through the steps, such as specifying a name for the zone (in the case of forward lookup zones) or the network ID portion of the network that the zone covers (in the case of reverse lookup zones).
Know how to configure zones for dynamic updates. The DNS service allows dynamic updates to be enabled or disabled on a per-zone basis at each server. This is easily done in the DNS snap-in.
Know how to delegate zones for DNS. DNS provides the ability to divide the namespace into one or more zones; these can then be stored, distributed, and replicated to other DNS servers. When delegating zones within your namespace, be aware that for each new zone you create, you need delegation records in other zones that point to the authoritative DNS servers for the new zone.
Understand the tools that are available for monitoring and troubleshooting DNS. You can use the DNS snap-in to do some basic server testing and monitoring. More important, you use the snap-in to monitor and set logging options. Windows Server 2012 R2 automatically logs DNS events in the event log under a distinct DNS server heading. `Nslookup` offers the ability to perform query testing of DNS servers and to obtain detailed responses at the command prompt. You can use the command-line tool `ipconfig` to view your DNS client settings, to view and reset cached information used locally for resolving DNS name queries, and to register the resource records for a dynamic update client. Finally, you can configure the DNS server to create a log file that records queries, notification messages, dynamic updates, and various other bits of DNS information.
Know how to install and authorize a DHCP server. You install the DHCP service using the Add/Remove Windows Components Wizard. You authorize the DHCP server using the DHCP snap-in. When you authorize a server, you're actually adding its IP address to the Active Directory object that contains a list of the IP addresses of all authorized DHCP servers.
Know how to create a DHCP scope. You use the New Scope Wizard to create a new scope for both IPv4 and IPv6. Before you start, you'll need to know the IP address range for the scope you want to create; which IP addresses, if any, you want to exclude from the address pool; which IP addresses, if any, you want to reserve; and the values for the DHCP options you want to set, if any.
Understand how relay agents help with multiple physical network segments. A question about relay agents on the exam may appear to be a DHCP-related question. Relay agents assist DHCP message propagation across network or router boundaries where such messages ordinarily wouldn't pass.
Understand the difference between exclusions and reservations. When you want to exclude an entire range of IP addresses, you need to add that range as an exclusion. Any IP addresses within the range for which you want a permanent DHCP lease are known as reservations. Remember that exclusions are TCP/IP numbers in a pool that do not get issued and reservations are numbers in a TCP/IP pool that get issued only to the same client each time.
## Review Questions
1. You are the network administrator for the ABC Company. Your network consists of two DNS servers named _DNS1_ and _DNS2_. The users who are configured to use DNS2 complain because they are unable to connect to Internet websites. The following table shows the configuration of both servers:
DNS1 | DNS2
---|---
`_msdcs.abc.comabc.com` | `.(root)_msdcs.abc.comabc.com`
The users connected to DNS2 need to be able to access the Internet. What needs to be done?
1. Build a new Active Directory Integrated zone on DNS2.
2. Delete the `.(root)` zone from DNS2 and configure conditional forwarding on DNS2.
3. Delete the current `cache.dns` file.
4. Update your `cache.dns` file and root hints.
2. You are the network administrator for a large company that has one main site and one branch office. Your company has a single Active Directory forest, `ABC.com`. You have a single domain controller (ServerA) in the main site that has the DNS role installed. ServerA is configured as a primary DNS zone. You have decided to place a domain controller (ServerB) in the remote site and implement the DNS role on that server. You want to configure DNS so that, if the WAN link fails, users in both sites can still update records and resolve any DNS queries. How should you configure the DNS servers?
1. Configure ServerB as a secondary DNS server. Set replication to occur every five minutes.
2. Configure ServerB as a stub zone.
3. Configure ServerB as an Active Directory Integrated zone and convert ServerA to an Active Directory Integrated zone.
4. Convert ServerA to an Active Directory Integrated zone and configure ServerB as a secondary zone.
3. You are the network administrator for a midsize computer company. You have a single Active Directory forest, and your DNS servers are configured as Active Directory Integrated zones. When you look at the DNS records in Active Directory, you notice that there are many records for computers that do not exist on your domain. You want to make sure that only domain computers register with your DNS servers. What should you do to resolve this issue?
1. Set dynamic updates to None.
2. Set dynamic updates to Nonsecure And Secure.
3. Set dynamic updates to Domain Users Only.
4. Set dynamic updates to Secure Only.
4. Your company consists of a single Active Directory forest. You have a Windows Server 2012 R2 domain controller that also has the DNS role installed. You also have a Unix-based DNS server at the same location. You need to configure your Windows DNS server to allow zone transfers to the Unix-based DNS server. What should you do?
1. Enable BIND secondaries.
2. Configure the Unix machine as a stub zone.
3. Convert the DNS server to Active Directory Integrated.
4. Configure the Microsoft DNS server to forward all requests to the Unix DNS server.
5. You are the network administrator for Stellacon Corporation. Stellacon has two trees in its Active Directory forest, `stellacon.com` and `abc.com`. Company policy does not allow DNS zone transfers between the two trees. You need to make sure that when anyone in `abc.com` tries to access the `stellacon.com` domain, all names are resolved from the `stellacon.com` DNS server. What should you do?
1. Create a new secondary zone in `abc.com` for `stellacon.com`.
2. Configure conditional forwarding on the `abc.com` DNS server for `stellacon.com`.
3. Create a new secondary zone in `stellacon.com` for `abc.com`.
4. Configure conditional forwarding on the `stellacon.com` DNS server for `abc.com`.
6. You are the network administrator for your organization. A new company policy states that all inbound DNS queries need to be recorded. What can you do to verify that the IT department is compliant with this new policy?
1. Enable Server Auditing – Object Access.
2. Enable DNS debug logging.
3. Enable server database query logging.
4. Enable DNS Auditing – Object Access.
7. You are the network administrator for a small company with two DNS servers: DNS1 and DNS2. Both DNS servers reside on domain controllers. DNS1 is set up as a standard primary zone, and DNS2 is set up as a secondary zone. A new security policy was written stating that all DNS zone transfers must be encrypted. How can you implement the new security policy?
1. Enable the Secure Only setting on DNS1.
2. Enable the Secure Only setting on DNS2.
3. Configure Secure Only on the Zone Transfers tab for both servers.
4. Delete the secondary zone on DNS2. Convert both DNS servers to use Active Directory Integrated zones.
8. You are responsible for DNS in your organization. You look at the DNS database and see a large number of older records on the server. These records are no longer valid. What should you do?
1. In the zone properties, enable Zone Aging and Scavenging.
2. In the server properties, enable Zone Aging and Scavenging.
3. Manually delete all of the old records.
4. Set Dynamic Updates to None.
9. Your IT team has been informed by the compliance team that it needs copies of the DNS Active Directory Integrated zones for security reasons. You need to give the Compliance department a copy of the DNS zone. How should you accomplish this goal?
1. Run `dnscmd /zonecopy`.
2. Run `dnscmd /zoneinfo`.
3. Run `dnscmd /zoneexport`.
4. Run `dnscmd /zonefile`.
10. You are the network administrator for a Windows Server 2012 R2 network. You have multiple remote locations connected to your main office by slow satellite links. You want to install DNS into these offices so that clients can locate authoritative DNS servers in the main location. What type of DNS servers should be installed in the remote locations?
1. Primary DNS zones
2. Secondary DNS zones
3. Active Directory Integrated zones
4. Stub zones
# Chapter 3
Plan and Install Active Directory
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Install domain controllers**
* Add or remove a domain controller from a domain
* Upgrade a domain controller
* Install Active Directory Domain Services (AD DS) on a Server Core installation
* Install a domain controller from Install from Media (IFM)
* Resolve DNS SRV record registration issues
* Configure a global catalog server
* Deploy Active Directory iaas in Windows Azure
Now that you are familiar with Domain Name System (DNS), you need to verify that the computer you upgrade to a domain controller (DC) meets the basic file system and network connectivity requirements so that Active Directory runs smoothly and efficiently in your organization.
Next, you'll explore the concept of _domain functional levels_ , which essentially determine what sorts of domain controllers you can use in your environment. For instance, in the Windows Server 2003 domain functional level, you can include Server 2012/2012 R2, Server 2008 R2, Server 2008, and Server 2003 domain controllers, but the functionality of the domain is severely limited.
Once you understand how to plan properly for your domain environment, you will learn how to install Active Directory, which you will accomplish by promoting a Windows Server 2012 R2 computer to a domain controller. I will also discuss a feature in Windows Server 2012 R2 called a _read-only domain controller (RODC)_.
After you become familiar with the initial Active Directory installation, you will learn how to install and configure Application Directory partitions. These partitions provide replicable data repositories using the Active Directory paradigm, but they don't actually store any security principals, such as users or groups. As the name implies, you use Application Directory partitions primarily to store data generated by applications that need to be replicated throughout your network environments independent of the rest of Active Directory.
The final section of this chapter deals with integrating DNS with Active Directory. You learned about DNS in Chapter 2, "Configure Network Services," but in this chapter I will review how DNS implements with Active Directory.
* * *
For these exercises, I assume you are creating a Windows Server 2012 R2 machine in a test environment and not on a live network. If this Windows Server 2012 R2 machine is being added into a Windows Server 2012 or 2008 R2 domain, you will need to prep the domain (explained in the section "Adprep" later in this chapter).
* * *
## Verifying the File system
When you're planning your Active Directory deployment, the file system that the operating system uses is an important concern for two reasons. First, the file system can provide the ultimate level of security for all the information stored on the server itself. Second, it is responsible for managing and tracking all of this data. The Windows Server 2012 R2 platform supports two file systems:
* Windows NT File System (NTFS)
* Resilient File System (ReFS)
Although ReFS was new to Windows Server 2012, NTFS has been around for many years, and NTFS in Windows Server 2012 R2 has been improved for better performance.
If you have been working with servers for many years, you may have noticed a few changes to the server file system choices. For example, in Windows Server 2003, you could choose between FAT, FAT32, and NTFS. In Windows Server 2008 R2, you could choose between FAT32 and NTFS. In Windows Server 2012 R2, you will notice that all versions of FAT have been removed (see Figure 3.1).
**FIGURE 3.1** Format options on Windows Server 2012 R2
### Resilient File System (ReFS)
Windows Server 2012 R2 now includes a new file system called _Resilient File System (ReFS)_. ReFS was created to help Windows Server 2012 R2 maximize the availability of data and online operation. ReFS allows the Windows Server 2012 R2 system to continue to function despite some errors that would normally cause data to be lost or the system to go down. ReFS uses data integrity to protect your data from errors and also to make sure that all of your important data is online when that data is needed.
One of the issues that IT members have had to face over the years is the problem of rapidly growing data sizes. As we continue to rely more and more on computers, our data continues to get larger and larger. This is where ReFS can help an IT department. ReFS was designed specifically with the issues of scalability and performance in mind, which resulted in some of the following ReFS features:
Availability If your hard disk becomes corrupt, ReFS has the ability to implement a salvage strategy that removes the data that has been corrupted. This feature allows the healthy data to continue to be available while the unhealthy data is removed. All of this can be done without taking the hard disk offline.
Scalability One of the main advantages of ReFS is the ability to support volume sizes up to 2^78 bytes using 16KB cluster sizes, while Windows stack addressing allows 2^64 bytes. ReFS also supports file sizes of 2^64-1 bytes, 2^64 files in a directory, and the same number of directories in a volume.
Robust Disk Updating ReFS uses a disk updating system referred to as an _allocate-on-write transactional model_ (also known as _copy on write_ ). This model helps to avoid many hard disk issues while data is written to the disk because ReFS updates data using disk writes to multiple locations in an atomic manner instead of updating data in place.
Data Integrity ReFS uses a check-summed system to verify that all data that is being written and stored is accurate and reliable. ReFS always uses allocate-on-write for updates to the data, and it uses checksums to detect disk corruption.
Application Compatibility ReFS allows for most NTFS features and also supports the Win32 API. Because of this, ReFS is compatible with most Windows applications.
### NTFS
Let's start with some of the features of NTFS. There are many benefits to using NTFS, including support for the following:
Disk Quotas To restrict the amount of disk space used by users on the network, system administrators can establish _disk quotas_. By default, Windows Server 2012 R2 supports disk quota restrictions at the volume level. That is, you can restrict the amount of storage space that a specific user uses on a single disk volume. Third-party solutions that allow more granular quota settings are also available.
File System Encryption One of the fundamental problems with network operating systems (NOSs) is that system administrators are often given full permission to view all files and data stored on hard disks, which can be a security and privacy concern. In some cases, this is necessary. For example, to perform backup, recovery, and disk management functions, at least one user must have all permissions. Windows Server 2012 R2 and NTFS address these issues by allowing for _file system encryption_. Encryption essentially scrambles all of the data stored within files before they are written to the disk. When an authorized user requests the files, they are transparently decrypted and provided. By using encryption, you can prevent the data from being used in case it is stolen or intercepted by an unauthorized user—even a system administrator.
Dynamic Volumes Protecting against disk failures is an important concern for production servers. Although earlier versions of Windows NT supported various levels of Redundant Array of Independent Disks (RAID) technology, software-based solutions had some shortcomings. Perhaps the most significant was that administrators needed to perform server reboots to change RAID configurations. Also, you could not make some configuration changes without completely reinstalling the operating system. With Windows Server 2012 R2 support for _dynamic volumes_ , system administrators can change RAID and other disk configuration settings without needing to reboot or reinstall the server. The result is greater data protection, increased scalability, and increased uptime. Dynamic volumes are also included with ReFS.
Mounted Drives By using _mounted drives_ , system administrators can map a local disk drive to an NTFS directory name. This helps them organize disk space on servers and increase manageability. By using mounted drives, you can mount the `C:\Users` directory to an actual physical disk. If that disk becomes full, you can copy all of the files to another, larger drive without changing the directory path name or reconfiguring applications.
Remote Storage System administrators often notice that as soon as they add more space, they must plan the next upgrade. One way to recover disk space is to move infrequently used files to external hard drives. However, backing up and restoring these files can be quite difficult and time-consuming. System administrators can use the _remote storage_ features supported by NTFS to off-load seldom-used data automatically to a backup system or other devices. The files, however, remain available to users. If a user requests an archived file, Windows Server 2012 R2 can automatically restore the file from a remote storage device and make it available. Using remote storage like this frees up system administrators' time and allows them to focus on tasks other than micromanaging disk space.
Self-healing NTFS In previous versions of the Windows Server operating system, if you had to fix a corrupted NTFS volume, you used a tool called `Chkdsk.exe`. The disadvantage of this tool is that the Windows Server's availability was disrupted. If this server was your domain controller, that could stop domain logon authentication.
To help protect the Windows Server 2012 R2 NTFS file system, Microsoft now uses a feature called self-healing NTFS. _Self-healing NTFS_ attempts to fix corrupted NTFS file systems without taking them offline. Self-healing NTFS allows an NTFS file system to be corrected without running the `Chkdsk.exe` utility. New features added to the NTFS kernel code allow disk inconsistencies to be corrected without system downtime.
Security NTFS allows you to configure not only folder-level security but also file-level security. NTFS security is one of the biggest reasons most companies use NTFS. ReFS also allows folder- and file-level security.
#### Setting Up the NTFS Partition
Although the features mentioned in the previous section likely compel most system administrators to use NTFS, additional reasons make using it mandatory. The most important reason is that the Active Directory data store must reside on an NTFS partition. Therefore, before you begin installing Active Directory, make sure you have at least one NTFS partition available. Also, be sure you have a reasonable amount of disk space available (at least 4GB). Because the size of the Active Directory data store will grow as you add objects to it, also be sure that you have adequate space for the future.
Exercise 3.1 shows you how to use the administrative tools to view and modify disk configuration.
* * *
Before you make any disk configuration changes, be sure you completely understand their potential effects; then perform the test in a lab environment and make sure you have good, verifiable backups handy. Changing partition sizes and adding and removing partitions can result in a total loss of all information on one or more partitions.
* * *
If you want to convert an existing partition from FAT or FAT32 to NTFS, you need to use the `CONVERT` command-line utility. For example, the following command converts the `C:` partition from FAT to NTFS:
CONVERT c: /fs:ntfs
* * *
### EXERCISE 3.1: Viewing Disk Configuration
1. Press the Windows key on the keyboard (left side between the Ctrl and Alt keys) and then choose Administrative Tools.
2. Double-click Computer Management.
3. Under Storage, click Disk Management.
The Disk Management program shows you the logical and physical disks that are currently configured on your system. Note that information about the size of each partition is also displayed (in the Capacity column).
4. Use the View menu to choose various depictions of the physical and logical drives in your system.
5. To see the available options for modifying partition settings, right-click any of the disks or partitions. This step is optional.
6. Close Computer Management.
* * *
## Verifying Network Connectivity
Although a Windows Server 2012 R2 computer can be used by itself without connecting to a network, you will not harness much of the potential of the operating system without network connectivity. Because the fundamental purpose of a network operating system is to provide resources to users, you must verify network connectivity.
### Basic Connectivity Tests
Before you begin to install Active Directory, you should perform several checks of your current configuration to ensure that the server is configured properly on the network. You should test the following:
Network Adapter At least one network adapter should be installed and properly configured on your server. A quick way to verify that a network adapter is properly installed is to use the Computer Management administrative tool. Under Device Manager, Network Adapters branch, you should have at least one network adapter listed. If you do not, use the Add Hardware icon in Control Panel to configure hardware.
TCP/IP Make sure that TCP/IP is installed, configured, and enabled on any necessary network adapters. The server should also be given a valid IP address and subnet mask. Optionally, you may need to configure a default gateway, DNS servers, WINS servers, and other network settings. If you are using DHCP, be sure that the assigned information is correct. It is always a good idea to use a static IP address for servers because IP address changes can cause network connectivity problems if they are not handled properly.
* * *
You must understand TCP/IP to use Windows Server 2012 R2 and Active Directory. TCP/IP will be covered in greater detail in Chapter 8, "Configure TCP/IP."
* * *
Internet Access If the server should have access to the Internet, verify that it is able to connect to external web servers and other machines outside of the local area network (LAN). If the server is unable to connect, you might have a problem with the TCP/IP configuration.
LAN Access The server should be able to view other servers and workstations on the network. If other machines are not visible, make sure that the network and TCP/IP configurations are correct for your environment.
Client Access Network client computers should be able to connect to your server and view any shared resources. A simple way to test connectivity is to create a share and test whether other machines are able to see files and folders within it. If clients cannot access the machine, make sure that both the client and the server are configured properly.
Wide Area Network Access If you're working in a distributed environment, you should ensure that you have access to any remote sites or users who will need to connect to this machine. Usually, this is a simple test that can be performed by a network administrator.
### Tools and Techniques for Testing Network Configuration
In some cases, verifying network access can be quite simple. You might have some internal and external network resources with which to test. In other cases, it might be more complicated. You can use several tools and techniques to verify that your network configuration is correct.
Using the `**Ipconfig**` Utility By typing `**ipconfig/all**` at the command prompt, you can view information about the TCP/IP settings of a computer. Figure 3.2 shows the types of information you'll receive.
**FIGURE 3.2** Viewing TCP/IP information with the `**ipconfig**` utility
Using the `**Ping**` Command The `ping` command was designed to test connectivity to other computers. You can use the command simply by typing `**ping**` and then an IP address or hostname at the command line. The following are some steps for testing connectivity using the `ping` command.
1. Ping Other Computers on the Same Subnet You should start by pinging a known active IP address on the network to check for a response. If you receive one, then you have connectivity to the network.
2. Next check to see whether you can ping another machine using its hostname. If this works, then local name resolution works properly.
3. Ping Computers on Different Subnets To ensure that routing is set up properly, you should attempt to ping computers that are on other subnets (if any exist) on your network. If this test fails, try pinging the default gateway. Any errors may indicate a problem in the network configuration or a problem with a router.
* * *
## When You Don't Receive a Response
Some firewalls, routers, or servers on your network or on the Internet might prevent you from receiving a successful response from a `ping` command. This is usually for security reasons (malicious users might attempt to disrupt network traffic using excessive pings as well as redirects and smurf attacks). If you do not receive a response, do not assume that the service is not available. Instead, try to verify connectivity in other ways. For example, you can use the `TRACERT` command to demonstrate connectivity beyond your subnet, even if other routers ignore Internet Control Message Protocol (ICMP) responses. Because the display of a second router implies connectivity, the path to an ultimate destination shows success even if it does not display the actual names and addresses.
* * *
Browsing the Network To ensure that you have access to other computers on the network, be sure that they can be viewed by clicking Network. This verifies that your name resolution parameters are set up correctly and that other computers are accessible. Also, try connecting to resources (such as file shares or printers) on other machines.
* * *
By default, Network Discovery is turned off. To browse the network, you must first enable Network Discovery from the Control Panel in the Network and Sharing Center Advanced Sharing settings.
* * *
Browsing the Internet You can quickly verify whether your server has access to the Internet by visiting a known website, such as `www.microsoft.com`. Success ensures that you have access outside of your network. If you do not have access to the Web, you might need to verify your proxy server settings (if applicable) and your DNS server settings.
By performing these simple tests, you can ensure that you have a properly configured network connection and that other network resources are available.
## Understanding Domain and Forest Functionality
Windows Server 2012 R2 Active Directory uses a concept called _domain and forest functionality_. The functional level that you choose during the Active Directory installation determines which features your domain can use.
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 include additional forest functionality compared to Windows Server 2003. Forest functionality applies to all of the domains within a forest.
### About the Domain Functional Level
Windows Server 2012 R2 will support the following domain functional levels:
* Windows Server 2003
* Windows Server 2008
* Windows Server 2008 R2
* Windows Server 2012
* Windows Server 2012 R2
Which function level you use depends on the domain controllers you have installed on your network. This is an important fact to remember. You can use Windows Server 2003, Windows Server 2008/2008 R2, and Windows 2012 member servers in the Windows Server 2012 R2 function level as long as all domain controllers are running Windows Server 2012 R2.
When you are deciding which function level you will use in your organization, you must choose the function level of your lowest domain controller. For example, if you have a Windows Server 2003 domain controller, your function levels should be Windows Server 2003. If you choose a higher level, the Windows Server 2003 domain controller will not function. Be careful—once a forest function level is upgraded, it cannot be downgraded lower than Windows Server 2008.
Table 3.1 shows the features available in Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 domain function levels.
**TABLE 3.1** Comparing domain functional levels
Domain functional feature | Windows Server 2003 | Windows Server 2008 | Windows Server 2008 R2 | Windows Server 2012 | Windows Server 2012 R2
---|---|---|---|---|---
Authentication assurance | Disabled | Disabled | Enabled | Enabled | Enabled
Fine-grained password policies | Disabled | Enabled | Enabled | Enabled | Enabled
Last interactive logon information | Disabled | Enabled | Enabled | Enabled | Enabled
Advanced Encryption Services (AES 128 and 256) support for the Kerberos protocol | Disabled | Enabled | Enabled | Enabled | Enabled
Distributed File System replication support for Sysvol | Disabled | Enabled | Enabled | Enabled | Enabled
Read-only domain controller (RODC) | Enabled | Enabled | Enabled | Enabled | Enabled
Ability to redirect the Users and Computers containers | Enabled | Enabled | Enabled | Enabled | Enabled
Ability to rename domain controllers | Enabled | Enabled | Enabled | Enabled | Enabled
Logon time stamp updates | Enabled | Enabled | Enabled | Enabled | Enabled
Kerberos KDC key version numbers | Enabled | Enabled | Enabled | Enabled | Enabled
Passwords for `InetOrgPerson` objects | Enabled | Enabled | Enabled | Enabled | Enabled
Converts NT groups to domain local and global groups | Enabled | Enabled | Enabled | Enabled | Enabled
SID history | Enabled | Enabled | Enabled | Enabled | Enabled
Group nesting | Enabled | Enabled | Enabled | Enabled | Enabled
Universal groups | Enabled | Enabled | Enabled | Enabled | Enabled
### About Forest Functionality
Windows Server 2012 R2 forest functionality applies to all of the domains in a forest. All domains have to be upgraded to Windows Server 2012 R2 before the forest can be upgraded to Windows Server 2012 R2.
There are five levels of forest functionality:
* Windows Server 2003
* Windows Server 2008
* Windows Server 2008 R2
* Windows Server 2012
* Windows Server 2012 R2
Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 have many of the same forest features. Some of these features are described in the following list:
Global Catalog Replication Enhancements When an administrator adds a new attribute to the global catalog, only those changes are replicated to other global catalogs in the forest. This can significantly reduce the amount of network traffic generated by replication.
Defunct Schema Classes and Attributes You can never permanently remove classes and attributes from the Active Directory schema. However, you can mark them as defunct so that they cannot be used. With Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 forest functionality, you can redefine the defunct schema attribute so that it occupies a new role in the schema.
Forest Trusts Previously, system administrators had no easy way of granting permission on resources in different forests. Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 resolve some of these difficulties by allowing trust relationships between separate Active Directory forests. Forest trusts act much like domain trusts, except that they extend to every domain in two forests. Note that all forest trusts are intransitive.
Linked Value Replication Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 use a concept called _linked value replication_. With linked value replication, only the user record that has been changed is replicated (not the entire group). This can significantly reduce network traffic associated with replication.
Renaming Domains Although the Active Directory domain structure was originally designed to be flexible, there were several limitations. Because of mergers, acquisitions, corporate reorganizations, and other business changes, you may need to rename domains. In Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 you can change the DNS and NetBIOS names for any domain. Note that this operation is not as simple as just issuing a `rename` command. Instead, there's a specific process that you must follow to make sure the operation is successful. Fortunately, when you properly follow the procedure, Microsoft supports domain renaming even though not all applications support it.
Other Features Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 also support the following features:
* Improved replication algorithms and dynamic auxiliary classes are designed to increase performance, scalability, and reliability.
* _Active Directory Federation Services (AD FS)_ , also known as _Trustbridge_ , handles federated identity management. _Federated identity management_ is a standards-based information technology process that enables distributed identification, authentication, and authorization across organizational and platform boundaries. The ADFS solution in Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 helps administrators address these challenges by enabling organizations to share a user's identity information securely.
* _Active Directory Lightweight Directory Services (AD LDS)_ was developed for organizations that require flexible support for directory-enabled applications. AD LDS, which uses the Lightweight Directory Access Protocol (LDAP), is a directory service that adds flexibility and helps organizations avoid increased infrastructure costs.
* Active Directory Recycle Bin (Windows Server 2008 R2 Forest level or higher) provides administrators with the ability to restore deleted objects in their entirety while AD DS is running. Before this, if you deleted an Active Directory object, you needed to recover it from a backup. Now you can recover the object from the AD recycle bin.
* * *
Many of the concepts related to domain and forest functional features are covered in greater detail later in this book.
* * *
## Planning the Domain Structure
Once you have verified the technical configuration of your server for Active Directory, it's time to verify the Active Directory configuration for your organization. Since the content of this chapter focuses on installing the first domain in your environment, you really need to know only the following information prior to beginning setup:
* The DNS name of the domain
* The computer name or the NetBIOS name of the server (which will be used by previous versions of Windows to access server resources)
* In which domain function level the domain will operate
* Whether other DNS servers are available on the network
* What type of and how many DNS servers are available on the network
However, if you will be installing additional domain controllers in your environment or will be attaching to an existing Active Directory structure, you should also have the following information:
* If this domain controller will join an existing domain, you should know the name of that domain. You will also either require a password for a member of the Enterprise Administrators group for that domain or have someone with those permissions create a domain account before promotion.
* You should know whether the new domain will join an existing tree and, if so, the name of the tree it will join.
* You should know the name of a forest to which this domain will connect (if applicable).
## Installing Active Directory
Installing Active Directory is an easy and straightforward process as long as you plan adequately and make the necessary decisions beforehand. There are many ways that you can install Active Directory. You can install Active Directory by using the Windows Server 2012 R2 installation disk (Install from Media (IFM)), using Server Manager, or using Windows PowerShell. But before you can do the actual installation, you must first make sure that your network is ready for the install.
In the following sections, you'll look at the required steps to install the first domain controller in a given environment.
### Adprep
When you are adding a new user to Active Directory, you fill in fields such as First Name, Last Name, and so on. These fields are called _attributes_. The problem is that when you go to install Windows Server 2012 R2, its version of Active Directory has newer attributes than the previous versions of Active Directory. Thus, you need to set up your current version of Active Directory so that it can accept the installation of Windows Server 2012 R2 Active Directory. This is why you use Adprep. Adprep is required to run in order to add the first Windows Server 2012 R2 domain controller to an existing domain or forest.
You would need to run `Adprep /forestprep` to add the first Windows Server 2012 R2 domain controller to an existing forest. `Adprep /forestprep` must be run by an administrator who is a member of the Enterprise Admins group, the Schema Admins group, and the Domain Admins group of the domain that hosts the schema master.
You would need to run `Adprep /domainprep` to add the first Windows Server 2012 R2 domain controller to an existing domain. Again, to achieve this command, you must be a member of the Domain Admins group of the domain where you are installing the Windows Server 2012 R2 domain controller.
`Adprep /rodcprep` must be run to add the first Windows Server 2012 R2 RODC to an existing forest. The administrator who runs this command must be a member of the Enterprise Admins group.
One feature that is new to the Windows Server 2012 R2 Active Directory installation process is that, if needed, Adprep will automatically be executed during the normal Active Directory Domain Services installation.
### Active Directory Prerequisites
Before you install Active Directory into your network, you must first make sure that your network and the server meet some minimum requirements. Table 3.2 will show you the requirements needed for Active Directory.
**TABLE 3.2** Active Directory requirements
Requirement | Description
---|---
Adprep | When adding the first Windows Server 20012 R2 domain controller to an existing Active Directory domain, Adprep commands run automatically as needed.
Credentials | When installing a new AD DS forest, the administrator must be set to local Administrator on the first server. To install an additional domain controller in an existing domain, you need to be a member of the Domain Admins group.
DNS | Domain Name System needs to be installed for Active Directory to function properly. You can install DNS during the Active Directory installation.
NTFS | The Windows Server 2012 R2 drives that store the database, log files, and SYSVOL folder must be placed on a volume that is formatted with the NTFS file system.
RODCs | Read Only Domain Controllers can be installed as long as another domain controller (Windows Server 2008 or newer) already exists on the domain. Also the Forest functional level must be at least Windows Server 2003.
TCP/IP | You must configure the appropriate TCP/IP settings on your domain, and you must configure the DNS server addresses.
### The Installation Process
Windows Server 2012 R2 computers are configured as either member servers (if they are joined to a domain) or stand-alone servers (if they are part of a workgroup). The process of converting a server to a domain controller is known as _promotion_. Through the use of a simple and intuitive wizard in Server Manager, system administrators can quickly configure servers to be domain controllers after installation. Administrators also have the ability to promote domain controllers using Windows PowerShell.
The first step in installing Active Directory is promoting a Windows Server 2012 R2 computer to a domain controller. The first domain controller in an environment serves as the starting point for the forest, trees, domains, and the operations master roles.
Exercise 3.2 shows the steps you need to follow to promote an existing Windows Server 2012 R2 computer to a domain controller. To complete the steps in this exercise, you must have already installed and configured a Windows Server 2012 R2 computer. You also need a DNS server that supports SRV records. If you do not have a DNS server available, the Active Directory Installation Wizard automatically configures one for you.
* * *
### EXERCISE 3.2: Promoting a Domain Controller
1. Install the Active Directory Domain Services by clicking the Add Roles And Features link in Server Manager's Dashboard view.
2. At the Before You Begin screen, click Next.
3. The Select installation Type screen will be next. Make sure that the Role-Based radio button is selected and click Next.
4. At the Select Destination Server screen, choose the local machine. Click Next.
5. At the Select Server Roles screen, click the check box for Active Directory Domain Services.
6. After you check the Active Directory Domain Services box, a pop-up menu will appear asking you to install additional features. Click the Add Features button.
7. Click Next.
8. At the Select Features screen, accept the defaults and click Next.
9. Click Next at the information screen.
10. Click the Install button at the Confirmation Installation screen.
11. The Installation Progress screen will show you how the installation is progressing.
12. After the installation is complete, click the Close button.
13. On the left side window, click the AD DS link.
14. Click the More link next to Configuration Required for Active Directory Domain Services.
15. Under the Post-Deployment Configuration section, click the Promote This Server To A Domain Controller link.
16. At this point, you will configure this domain controller. You are going to install a new domain controller in a new domain in a new forest. At the Deployment Configuration screen, choose the Add A New Forest radio button. You then need to add a root domain name. In this exercise, I will use `Sybex.com`. Click Next.
17. At the Domain Controller Options screen, set the following options:
* Function levels: Windows Server 2008 R2 (for both)
* Verify that the DNS and Global Catalog check boxes are checked
* Password: `**P@ssw0rd**`
Then click Next.
18. At the DNS screen, click Next.
19. At the additional options screen, accept the default NetBIOS domain name and click Next.
20. At the Paths screen, accept the default file locations and click Next.
21. At the Review Options screen, verify your settings and click Next.
22. At the Prerequisites Check screen, click the Install button (as long as there are no errors).
23. After the installation completes, the machine will automatically reboot. Log in as the administrator.
24. Close Server Manager.
25. Click the Start button on the keyboard and choose Administrative Tools.
26. You should see new MMC snap-ins for Active Directory.
27. Close the Administrative Tools window.
* * *
In Exercise 3.3, you will learn how to install Active Directory on a Server Core installation. You will use Windows Server 2012 R2 Datacenter Server Core. Before actually installing AD DS, you will learn how to configure the computer name, the time, the administrator password, and a static TCP/IP address, and then you will install DNS.
* * *
### EXERCISE 3.3: Installing AD DS on Server Core
1. At the Server Core command prompt, type `**cd\windows\system32**` and press Enter.
2. Type `**timedate.cpl**` and set your date, local time zone, and time. Click OK.
3. Type `**Netsh**` and press Enter.
4. Type `**Interface**`, and press Enter.
5. Type `**IPv4**`, and press Enter.
6. Type `**Show IP**` and press Enter. This will show you the current TCP/IP address and the interface with which the TCP/IP address is associated.
7. As you can see, interface 12 is my Ethernet interface. To change this interface, type the following command and press Enter:
Set address name="12" source=static address=192.168.15.165 mask=255.255.255.0 gateway=192.168.15.1
I used 192.168.15. _x_ for my address. You can replace the address, mask, and gateway based on your local settings.
8. Type `**Show IP**` and press Enter. You should see that the new address is now manual and set to the IP address you set.
9. Type `**Exit**` and press Enter.
10. Type `**Net User Administrator**` ∗ and press Enter.
11. Type in your password and then confirm the password. I used `P@ssw0rd` for my password.
12. Type the following command and press Enter:
Netdom renamecomputer %computername% /newname:ServerA
13. Type `**Y**` and press Enter.
14. Type `**Shutdown /R /T 0**` and press Enter. This will reboot the machine. After the reboot, log back into the system.
15. Type `**PowerShell**` and press Enter.
16. At the PowerShell prompt, type `**Add-WindowsFeature DNS**` and press Enter. This will add DNS to the server.
17. At the PowerShell prompt, type `**Add-WindowsFeature AD-Domain-Services**` and press Enter.
18. At the PowerShell prompt, type `**Import-Module ADDSDeployment**`.
19. At the PowerShell prompt, type `**Install-ADDSForest**`.
20. Type in your domain name and press Enter. I used `Sybex.com`.
21. Next you will be asked for your Safe mode administrator password. Type in `**P@ssw0rd**` and then confirm it.
22. Type `**Y**` and press Enter.
Active Directory will install, and the machine will automatically reboot.
* * *
### Deploying Active Directory IaaS in Windows Azure
Well before I jump into this topic, I must first explain what I am talking about. Windows Azure is a Microsoft cloud platform that allows you to put your server data into the cloud. Deploying Active Directory with IaaS means you are using virtualization for the deployment.
So, to put this in a nutshell, when doing this type of install, it's actually not too far off from the install you already did. You create a virtual server and then install Active Directory. Then you upload that virtual server to the cloud.
* * *
I understand that I have not explained virtualization, but Hyper-V and virtualization will be covered in detail in Chapter 9, "Use Virtualization in Windows Server 2012 R2."
* * *
Now that you understand what this section is about, let's talk about some of the tasks that are different from the normal way you install Active Directory virtually. There are three main differences when installing Active Directory IaaS on Windows Azure.
Windows Azure virtual machines may need to have connectivity to the corporate network. Microsoft states that you don't have to have connectivity to your on-site corporate network, but you will lose functionality. Thus, Microsoft recommends that you set up connectivity, and to do that, you must use Windows Azure Virtual Network. Windows Azure Virtual Network includes a site-to-site or site-to-point virtual private network (VPN) component capable of seamlessly connecting Windows Azure virtual machines and on-site machines.
Static IP addresses are _not_ supported on Windows Azure virtual machines. Normally, when setting up a server, we all use static IP addresses. This is actually required on a DHCP server, DNS server, and so on. But when you deploy Active Directory IaaS in Windows Azure, you must use Dynamic TCP/IP addressing, and this requires that you set up Windows Azure Virtual Network.
IP addresses for Windows Azure virtual machines are attached to Windows Azure Virtual Network, and that TCP/IP address persists for the lifetime of the virtual machine. Because of this, the Windows Server Active Directory requirements for IP addressing are met, and the requirements for DNS are also met if you want the server to have both roles.
Windows Azure allows for two distinct disk types for virtual machines. As you will learn in Chapter 9, the selection of the virtual machine disk type is important when deploying domain controllers. Windows Azure allows both "operating system disks" and "data disks." Most of the time you will use data disks when installing Active Directory on the virtual machine. Data disks use write-through caching, guaranteeing durability of writes, and this is important to the integrity of any Windows Server active machine. There are some other factors of which you should be aware when choosing your disk type. Please check Microsoft's website for more details when choosing a disk type.
## Verifying Active Directory Installation
Once you have installed and configured Active Directory, you'll want to verify that you have done so properly. In the following sections, you'll look at methods for doing this.
### Using Event Viewer
The first (and perhaps most informative) way to verify the operations of Active Directory is to query information stored in the Windows Server 2012 R2 event log. You can do this using the Windows Server 2012 R2 Event Viewer. Exercise 3.4 walks you through this procedure. Entries seen with the Event Viewer include errors, warnings, and informational messages.
* * *
To complete the steps in Exercise 3.4, you must have configured the local machine as a domain controller.
* * *
* * *
### EXERCISE 3.4: Viewing the Active Directory Event Log
1. Open Administrative tools by pressing the Windows key and choosing Administrative Tools.
2. Open the Event Viewer snap-in from the Administrative Tools program group.
3. In the left pane, under Applications And Services Logs, select Directory Service.
4. In the right pane, you can sort information by clicking column headings. For example, you can click the Source column to sort by the service or process that reported the event.
5. Double-click an event in the list to see the details for that item. Note that you can click the Copy button to copy the event information to the Clipboard. You can then paste the data into a document for later reference. Also, you can move between items using the up and down arrows. Click OK when you have finished viewing an event.
6. Filter an event list by right-clicking the Directory Service item in the left pane and selecting Filter Current Log. Note that filtering does not remove entries from the event logs—it only restricts their display.
7. To verify Active Directory installation, look for events related to the proper startup of Active Directory, such as Event ID 1000 (Active Directory Startup Complete) and 1394 (Attempts To Update The Active Directory Database Are Succeeding). Also, be sure to examine any error or warning messages because they could indicate problems with DNS or other necessary services.
8. When you've finished viewing information in the Event Viewer, close the application.
* * *
* * *
## Gaining Insight Through Event Viewer
Despite its simple user interface and somewhat limited GUI functionality, the Event Viewer tool can be your best ally in isolating and troubleshooting problems with Windows Server 2012 R2. The Event Viewer allows you to view information that is stored in various log files that are maintained by the operating system. This includes information from the following logs:
Application Stores messages generated by programs running on your system. For example, SQL Server 2012 might report the completion of a database backup job within the Application log.
Security Contains security-related information as defined by your auditing settings. For example, you could see when users have logged onto the system or when particularly sensitive files have been accessed.
System Contains operating system-related information and messages. Common messages might include a service startup failure or information about when the operating system was last rebooted.
Directory Service Stores messages and events related to how Active Directory functions. For example, you might find details related to replication here.
DNS Server Contains details about the operations of the DNS service. This log is useful for troubleshooting replication or name-resolution problems.
Other Log Files Contain various features of Windows Server 2012 R2 and the applications that may run on this operating system, which can create additional types of logs. These files allow you to view more information about other applications or services through the familiar Event Viewer tool.
Additionally, developers can easily send custom information from their programs to the Application log. Having all of this information in one place really makes it easy to analyze operating system and application messages. Also, many third-party tools and utilities are available for analyzing log files.
Although the Event Viewer GUI does a reasonably good job of letting you find the information you need, you might want to extract information to analyze other systems or applications. One especially useful feature of the Event Viewer is its ability to save a log file in various formats. You can access this feature by clicking Action Save As. You'll be given the option of saving in various formats, including tab- and comma-delimited text files. You can then open these files in other applications (such as Microsoft Excel) for additional data analysis.
Overall, in the real world, the Event Viewer can be an excellent resource for monitoring and troubleshooting your important servers and workstations.
* * *
In addition to providing information about the status of events related to Active Directory, the Event Viewer shows you useful information about other system services and applications. You should routinely use this tool.
### Using Active Directory Administrative Tools
After a server has been promoted to a domain controller, you will see that various tools are added to the Administrative Tools program group, including the following:
Active Directory Administrative Center This is a _Microsoft Management Console (MMC)_ snap-in that allows you to accomplish many Active Directory tasks from one central location. This MMC snap-in allows you to manage your directory services objects, including doing the following tasks:
* Reset user passwords
* Create or manage user accounts
* Create or manage groups
* Create or manage computer accounts
* Create or manage organizational units (OUs) and containers
* Connect to one or several domains or domain controllers in the same instance of Active Directory Administrative Center
* Filter Active Directory data
Active Directory Domains and Trusts Use this tool to view and change information related to the various domains in an Active Directory environment. This MMC snap-in also allows you to set up shortcut trusts.
Active Directory Sites and Services Use this tool to create and manage Active Directory sites and services to map to an organization's physical network infrastructure. Sites and services are covered in detail in Chapter 5, "Administer Active Directory."
Active Directory Users and Computers User and computer management is fundamental for an Active Directory environment. The Active Directory Users and Computers tool allows you to set machine- and user-specific settings across the domain. This tool is discussed throughout this book.
Active Directory Module for Windows PowerShell _Windows PowerShell_ is a command-line shell and scripting language. The Active Directory Module for Windows PowerShell is a group of cmdlets used to manage your Active Directory domains, Active Directory Lightweight Directory Services (AD LDS) configuration sets, and Active Directory Database Mounting Tool instances in a single, self-contained package.
A good way to make sure that Active Directory is accessible and functioning properly is to run the Active Directory Users and Computers tool. When you open the tool, you should see a configuration similar to that shown in Figure 3.3. Specifically, you should make sure the name of the domain you created appears in the list. You should also click the `Domain Controllers` folder and make sure that the name of your local server appears in the right pane. If your configuration passes these two checks, Active Directory is present and configured.
**FIGURE 3.3** Viewing Active Directory information using the Active Directory Users and Computers tool
### Testing from Clients
The best test of any solution is simply to verify that it works the way you had intended in your environment. When it comes to using Active Directory, a good test is to ensure that clients can view and access the various resources presented by Windows Server 2012 R2 domain controllers. In the following sections, you'll look at several ways to verify that Active Directory is functioning properly.
#### Verifying Client Connectivity
If you are unable to see the recently promoted server on the network, there is likely a network configuration error. If only one or a few clients are unable to see the machine, the problem is probably related to client-side configuration. To fix this, make sure that the client computers have the appropriate TCP/IP configuration (including DNS server settings) and that they can see other computers on the network.
If the new domain controller is unavailable from any of the other client computers, you should verify the proper startup of Active Directory using the methods mentioned earlier in this chapter. If Active Directory has been started, ensure that the DNS settings are correct. Finally, test network connectivity between the server and the clients by accessing the network or by using the `ping` command.
#### Joining a Domain
If Active Directory has been properly configured, clients and other servers should be able to join the domain. Exercise 3.5 outlines the steps you need to take to join a Windows 7 or Windows 8 computer to the domain.
To complete this exercise, you must have already installed and properly configured at least one Active Directory domain controller and a DNS server that supports SRV records in your environment. In addition to the domain controller, you need at least one other computer, not configured as a domain controller, running one of the following operating systems: Windows 2000, Windows XP Professional (Windows XP Home Edition cannot join a domain), Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, or Windows Server 2012 R2.
Once clients are able to join the domain successfully, they should be able to view Active Directory resources using the Network icon. This test validates the proper functioning of Active Directory and ensures that you have connectivity with client computers.
* * *
Exercise 3.5 is being done from a Windows 7 Enterprise computer.
* * *
* * *
### EXERCISE 3.5: Joining a Computer to an Active Directory Domain
1. Right-click the Computer icon on the Start menu, and click Properties.
2. Go to the section called Computer Name. On the right side, click the Change Settings link.
3. Next to the section To Rename This Computer Or Change Its Domain Or Workgroup, click the Change button.
4. In the Member Of section, choose the Domain option. Type the name of the Active Directory domain that this computer should join. Click OK.
5. When prompted for the username and password of an account that has permission to join computers to the domain, enter the information for an administrator of the domain. Click OK to commit the changes. If you successfully joined the domain, you will see a dialog box welcoming you to the new domain.
6. You will be notified that you must reboot the computer before the changes take place. Select Yes when prompted to reboot.
* * *
## Creating and Configuring Application Data Partitions
Organizations store many different kinds of information in various places. For the IT departments that support this information, it can be difficult to ensure that the right information is available when and where it is needed. Windows Server 2012 R2 uses a feature called _application data partitions_ , which allows system administrators and application developers to store custom information within Active Directory. The idea behind application data partitions is that since you already have a directory service that can replicate all kinds of information, you might as well use it to keep track of your own information.
Developing distributed applications that can, for example, synchronize information across an enterprise is not a trivial task. You have to come up with a way to transfer data between remote sites (some of which are located across the world), and you have to ensure that the data is properly replicated. By storing application information in Active Directory, you can take advantage of its storage mechanism and replication topology. Application-related information stored on domain controllers benefits from having fault-tolerance features and availability.
Consider the following simple example to understand how this can work. Suppose your organization has developed a customer Sales Tracking and Inventory application. The company needs to make the information that is stored by this application available to all of its branch offices and users located throughout the world. However, the goal is to do this with the least amount of IT administrative effort. Assuming that Active Directory has already been deployed throughout the organization, developers can build support into the application for storing data within Active Directory. They can then rely on Active Directory to store and synchronize the information among various sites. When users request updated data from the application, the application can obtain this information from the nearest domain controller that hosts a replica of the Sales Tracking and Inventory data.
Other types of applications can also benefit greatly from the use of application data partitions. Now that you have a good understanding of the nature of application data partitions, let's take a look at how you can create and manage them using Windows Server 2012 R2 and Active Directory.
### Creating Application Data Partitions
By default, after you create an Active Directory environment, you will not have any customer application data partitions. Therefore, the first step in making this functionality available is to create a new application data partition. You can use several tools to do this:
Third-Party Applications or Application-Specific Tools Generally, if you are planning to install an application that can store information in the Active Directory database, you'll receive some method of administering and configuring that data along with the application. For example, the setup process for the application might assist you in the steps you need to take to set up a new application data partition and to create the necessary structures for storing data.
* * *
Creating and managing application data partitions are advanced Active Directory–related functions. Be sure that you have a solid understanding of the Active Directory schema, Active Directory replication, LDAP, and your applications' needs before you attempt to create new application data partitions in a live environment.
* * *
Active Directory Service Interfaces ADSI is a set of programmable objects that can be accessed through languages such as Visual Basic Scripting Edition (VBScript), Visual C#, Visual Basic .NET, and many other language technologies that support the Component Object Model (COM) standard. Through the use of ADSI, developers can create, access, and update data stored in Active Directory and in any application data partitions.
The LDP Tool You can view and modify the contents of the Active Directory schema using LDAP-based queries. The LDP tool allows you to view information about application data partitions.
`Ldp.exe` is a graphical user interface (GUI) tool that allows an administrator to configure Lightweight Directory Access Protocol (LDAP) directory service. Administrators have the ability to use the LDP tool to administer an Active Directory Lightweight Directory Services (AD LDS) instance. To use the LDP tool, you must be an administrator or equivalent.
Figure 3.4 shows an example of connecting to a domain controller and browsing Active Directory information.
**FIGURE 3.4** Using the LDP tool to view Active Directory schema information
`Ntdsutil` The `ntdsutil` utility is the main method by which system administrators create and manage application data partitions on their Windows Server 2012 R2 domain controllers. This utility's specific commands are covered later in this chapter.
* * *
Creating and managing application data partitions can be fairly complex. Such a project's success depends on the quality of the architecture design. This is a good example of where IT staff and application developers must cooperate to ensure that data is stored effectively and that it is replicated efficiently.
* * *
You can create an application data partition in one of three different locations within an Active Directory forest:
* As a new tree in an Active Directory forest
* As a child of an Active Directory domain partition
For example, you can create an Accounting application data partition within the `Finance.MyCompany.com` domain.
* As a child of another application data partition
This method allows you to create a hierarchy of application data partitions.
As you might expect, you must be a member of the Enterprise Admins or Domain Admins group to be able to create application data partitions. Alternatively, you can be delegated the appropriate permissions to create new partitions.
Now that you have a good idea of the basic ways in which you can create application data partitions, let's look at how replicas (copies of application data partition information) are handled.
### Managing Replicas
A _replica_ is a copy of any data stored within Active Directory. Unlike the basic information that is stored in Active Directory, application partitions cannot contain security principals. Also, not all domain controllers automatically contain copies of the data stored in an application data partition. System administrators can define which domain controllers host copies of the application data. This is an important feature because, if replicas are used effectively, administrators can find a good balance between replication traffic and data consistency. For example, suppose that three of your organization's 30 locations require up-to-date accounting-related information. You might choose to replicate the data only to domain controllers located in the places that require the data. Limiting replication of this data reduces network traffic.
_Replication_ is the process by which replicas are kept up-to-date. Application data can be stored and updated on designated servers in the same way basic Active Directory information (such as users and groups) is synchronized between domain controllers. Application data partition replicas are managed using the _Knowledge Consistency Checker (KCC)_ , which ensures that the designated domain controllers receive updated replica information. Additionally, the KCC uses all Active Directory sites and connection objects (covered in Chapter 5) that you create to determine the best method to handle replication.
### Removing Replicas
When you perform a _demotion_ on a domain controller, that server can no longer host an application data partition. If a domain controller contains a replica of application data partition information, you must remove the replica from the domain controller before you demote it. If a domain controller is the machine that hosts a replica of the application data partition, then the entire application data partition is removed and will be permanently lost. Generally, you want to do this only after you're absolutely sure that your organization no longer needs access to the data stored in the application data partition.
### Using _ntdsutil_ to Manage Application Data Partitions
The primary method by which system administrators create and manage application data partitions is through the `ntdsutil` command-line tool. You can launch this tool simply by entering `**ntdsutil**` at a command prompt. The `ntdsutil` command is both interactive and context sensitive. That is, once you launch the utility, you'll see an `ntdsutil` command prompt. At this prompt, you can enter various commands that set your context within the application. For example, if you enter the `domain management` command, you'll be able to use domain-related commands. Several operations also require you to connect to a domain, a domain controller, or an Active Directory object before you perform a command.
* * *
For complete details on using `ntdsutil`, see the Windows Server 2012 R2 Help and Support Center.
* * *
Table 3.3 describes the domain management commands supported by the `ntdsutil` tool. You can access this information by typing in the following sequence of commands at a command prompt:
ntdsutil
domain management
Help
**TABLE 3.3** `ntdsutil` domain management commands
`ntdsutil` domain management command | Purpose
---|---
`Help` or `?` | Displays information about the commands that are available within the Domain Management menu of the `ntdsutil` command.
`Connection` or `Connections` | Allows you to connect to a specific domain controller. This will set the context for further operations that are performed on specific domain controllers.
`Create NC` _`PartitionDistinguishedName DNSName`_ | Creates a new application directory partition.
`Delete NC` _`PartitionDistinguishedName`_ | Removes an application data partition.
`List NC Information _Partition DistinguishedName_` | Shows information about the specified application data partition.
`List NC Replicas _PartitionDistinguishedName_` | Returns information about all replicas for the specific application data partition.
`Precreate _PartitionDistinguished NameServerDNSName_` | Pre-creates cross-reference application data partition objects. This allows the specified DNS server to host a copy of the application data partition.
`Remove NC Replica _PartitionDistinguishedName DCDNSName_` | Removes a replica from the specified domain controller.
`Select Operation Target` | Selects the naming context that will be used for other operations.
`Set NC Reference Domain _PartitionDistinguishedName DomainDistinguishedName_` | Specifies the reference domain for an application data partition.
`Set NC Replicate NotificationDelay _PartitionDistinguishedName FirstDCNotificationDelay OtherDCNotificationDelay_` | Defines settings for how often replication will occur for the specified application data partition.
* * *
The `ntdsutil` commands are all case insensitive. Mixed case was used in the table to make them easier to read. `NC` in commands stands for "naming context," referring to the fact that this is a partition of the Active Directory schema.
* * *
Figure 3.5 provides an example of working with `ntdsutil`. The following commands were entered to set the context for further operations:
**FIGURE 3.5** Viewing naming contexts on the local domain controller
ntdsutil
domain management
connections
connect to server localhost
connect to domain ADTest
quit
list
## Configuring DNS Integration with Active Directory
There are many benefits to integrating Active Directory and DNS services:
* You can configure and manage replication along with other Active Directory components.
* You can automate much of the maintenance of DNS resource records through the use of dynamic updates.
* You will be able to set specific security options on the various properties of the DNS service.
Exercise 3.6 shows the steps that you must take to ensure that these integration features are enabled. You'll look at the various DNS functions that are specific to interoperability with Active Directory.
Before you begin this exercise, make sure that the local machine is configured as an Active Directory domain controller and that DNS services have been properly configured. If you instructed the Active Directory Installation Wizard to configure DNS automatically, many of the settings mentioned in this section may already be enabled. However, you should verify the configuration and be familiar with how the options can be set manually.
* * *
### EXERCISE 3.6:Configuring DNS Integration with Active Directory
1. Open Administrative tools by pressing the Windows key and choosing Administrative Tools.
2. Open the DNS snap-in from the Administrative Tools program group.
3. Right-click the icon for the local DNS server and select Properties. Click the Security tab. Notice that you can now specify which users and groups have access to modify the configuration of the DNS server. Make any necessary changes and click OK.
4. Expand the local server branch and the `Forward Lookup Zones` folder.
5. Right-click the name of the Active Directory domain you created and select Properties.
6. On the General tab, verify that the type is Active Directory–Integrated and that the Data Is Stored In Active Directory message is displayed. If this option is not currently selected, you can change it by clicking the Change button next to Type and choosing the Store The Zone In Active Directory check box on the bottom.
7. Verify that the Dynamic Updates option is set to Secure Only. This ensures that all updates to the DNS resource records database are made through authenticated Active Directory accounts and processes.
The other options are Nonsecure And Secure (accepts all updates) and None (to disallow dynamic updates).
8. Finally, notice that you can define the security permissions at the zone level by clicking the Security tab. Make any necessary changes and click OK.
* * *
## Summary
This chapter covered the basics of implementing an Active Directory forest and domain structure, creating and configuring application data partitions, and setting the functional level of your domain and forest.
You are now familiar with how you can implement Active Directory. We carefully examined all of the necessary steps and conditions that you need to follow to install Active Directory on your network. First you need to prepare for the Domain Name System because Active Directory cannot be installed without the support of a DNS server.
You also need to verify that the computer you upgrade to a domain controller meets some basic file system and network connectivity requirements so that Active Directory can run smoothly and efficiently in your organization. These are some of the most common things you will have to do when you deploy Active Directory.
The chapter also covered the concept of domain functional levels, which essentially determine the kinds of domain controllers you can use in your environment. For instance, in the Windows 2003 functional level, you can include Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2, Windows Server 2008, and Windows Server 2003 domain controllers, but the functionality of the domain is severely limited.
In this chapter, you also learned how to install Active Directory, which you accomplish by promoting a Windows Server 2012 computer to a domain controller using Server Manager. You also learned how to verify the installation by testing Active Directory from a client computer.
This chapter was limited in scope to examining the issues related to installing and configuring the first domain in an Active Directory environment. In later chapters, you'll see how to create and manage more complex configurations.
## Exam Essentials
Know the prerequisites for promoting a server to a domain controller. You should understand the tasks that you must complete before you attempt to upgrade a server to a domain controller. Also, you should have a good idea of the information you need in order to complete the domain controller promotion process.
Understand the steps of the Active Directory Installation Wizard. When you run the Active Directory Installation Wizard, you'll be presented with many different choices. You should understand the effects of the various options provided in each step of the wizard.
Be familiar with the tools that you will use to administer Active Directory. Three main administrative tools are installed when you promote a Windows Server 2012 R2 to a domain controller. Be sure that you know which tools to use for which types of tasks.
Understand the purpose of application data partitions. The idea behind application data partitions is that since you already have a directory service that can replicate all kinds of security information, you can also use it to keep track of application data. The main benefit of storing application information in Active Directory is that you can take advantage of its storage mechanism and replication topology. Application-related information stored on domain controllers benefits from having fault-tolerance features and availability.
## Review Questions
1. You are the system administrator of a large organization that has recently implemented Windows Server 2012 R2. You have a few remote sites that do not have very tight security. You have decided to implement read-only domain controllers (RODCs). What forest and function levels does the network need for you to do the install? (Choose all that apply.)
1. Windows 2000 Mixed
2. Windows 2008 R2
3. Windows 2003
4. Windows 2008
2. What is the maximum number of domains that a Windows Server 2012 R2 computer configured as a domain controller may participate in at one time?
1. Zero
2. One
3. Two
4. Any number of domains
3. A system administrator is trying to determine which file system to use for a server that will become a Windows Server 2012 R2 file server and domain controller. The company has the following requirements:
* The file system must allow for file-level security from within Windows 2012 R2 Server.
* The file system must make efficient use of space on large partitions.
* The domain controller Sysvol must be stored on the partition.
Which of the following file systems meets these requirements?
1. FAT
2. FAT32
3. HPFS
4. NTFS
4. For security reasons, you have decided that you must convert the system partition on your removable drive from the FAT32 file system to NTFS. Which of the following steps must you take in order to convert the file system? (Choose two.)
1. Run the command `CONVERT /FS:NTFS` from the command prompt.
2. Rerun Windows Server 2008 R2 Setup and choose to convert the partition to NTFS during the reinstallation.
3. Boot Windows Server 2008 R2 Setup from the installation CD-ROM and choose Rebuild File System.
4. Reboot the computer.
5. Windows Server 2012 R2 requires the use of which of the following protocols or services in order to support Active Directory? (Choose two.)
1. DHCP
2. TCP/IP
3. NetBEUI
4. IPX/SPX
5. DNS
6. You are promoting a Windows Server 2012 R2 computer to an Active Directory domain controller for test purposes. The new domain controller will be added to an existing domain. While you are using the Active Directory Installation Wizard, you receive an error message that prevents the server from being promoted. Which of the following might be the cause of the problem? (Choose all that apply.)
1. The system does not contain an NTFS partition on which the Sysvol directory can be created.
2. You do not have a Windows Server 2012 R2 DNS server on the network.
3. The TCP/IP configuration on the new server is incorrect.
4. The domain has reached its maximum number of domain controllers.
7. Your network contains a single Active Directory domain. The domain contains five Windows Server 2008 R2 domain controllers. You plan to install a new Windows Server 2012 R2 domain controller. Which two actions would you need to perform? (Each correct answer presents part of the solution. Choose two.)
1. Run `adprep.exe /rodcprep` at the command line.
2. Run `adprep.exe /forestprep` at the command line.
3. Run `adprep.exe /domainprep` at the command line.
4. From Active Directory Domains and Trusts, raise the functional level of the domain.
5. From Active Directory Users and Computers, prestage the RODC computer account.
8. You are the network administrator for a large company that creates widgets. Management asks you to implement a new Windows Server 2012 R2 system. You need to implement federated identity management. Which of the following will help you do this?
1. Active Directory Federation Services
2. Active Directory DNS Services
3. Active Directory IIS Services
4. Active Directory IAS Services
9. You are the system administrator responsible for your company's infrastructure. You think you have an issue with name resolution, and you need to verify that you are using the correct hostname. You want to test DNS on the local system and need to see whether the hostname server-1 resolves to the IP address 10.1.1.1. Which of the following actions provides a solution to the problem?
1. Add a DNS server to your local subnet.
2. Add the mapping for the hostname server-1 to the IP address 10.1.1.1 in the local system's HOSTS file.
3. Add an A record to your local WINS server.
4. Add an MX record to your local DNS server.
10. You have one Active Directory forest in your organization that contains one domain named `Stellacon.com`. You have two domain controllers configured with the DNS role installed. There are two Active Directory Integrated zones named `Stellacon.com` and `Stellatest.com`. One of your IT members (who is not an administrator) needs to be able to modify the `Stellacon.com` DNS server, but you need to prevent this user from modifying the `Stellatest.com` SOA record. How do you accomplish this?
1. Modify the permissions of the `Stellacon.com` zone from the DNS Manager snap-in.
2. Modify the permissions of the `Stellatest.com` zone from the DNS Manager snap-in.
3. Run the Delegation Of Control Wizard in Active Directory.
4. Run the Delegation Of Control Wizard in the DNS snap-in.
# Chapter 4
Configure Windows Server 2012 R2
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Configure file and share access**
* Create and configure shares
* Configure share permissions
* Configure offline files
* Configure NTFS permissions
* Configure access-based enumeration (ABE)
* Configure Volume Shadow Copy Service (VSS)
* Configure NTFS quotas
* Create and configure Work Folders
2. **Configure print and document services**
* Configure the Easy Print print driver
* Configure Enterprise Print Management
* Configure drivers
* Configure printer pooling
* Configure print priorities
* Configure printer permissions
3. **Configure servers for remote management**
* Configure WinRM
* Configure down-level server management
* Configure servers for day-to-day management tasks
* Configure multi-server management
* Configure Server Core
* Configure Windows Firewall
* Manage non-domain joined servers
This chapter explains how to set up your servers so that your network users have something to access. Before you can set up a server, you have to determine the purpose of it. Is it going to be a print server, a file storage server, a remote access server, or a domain controller?
After you have decided how the machine is going to help your network, you must implement your decision. In this chapter, I'll show you how to set up a print server and a file server. In addition, I will discuss how to set up permissions and security for these servers and how you can limit the amount of space your users can have on a server.
* * *
Microsoft Windows Server 2012 and Windows Server 2012 R2 are used for all of the server types in this chapter. Although other operating systems can be used, this chapter refers only to Windows Server 2012 and Win dows Server 2012 R2.
* * *
## Understanding File Servers
Before you configure a file server, you must understand what a file server actually does. _File servers_ are machines on your network that store data files to share among network clients. The same machine can be a file server and another type of server. For example, a machine can both host network files and run Exchange Server 2013. Such a machine would have both file server and application server functions. ( _Application servers_ are machines that host applications used by network clients.)
* * *
# Multiple Server Types on One Machine
More than ever, in today's world most IT departments have to worry about budgets. The problem is that the IT department often has the smallest budget in a company. You are typically stuck between a rock and a hard place because if your network is running well, people (including executives) forget about you. This makes it hard when you ask for anything that may impact the budget.
Because of the lack of funds, often you will leverage one machine to perform many server tasks. I have seen several companies where the IT department had to have the same machine running both as an application server and as a file server.
You must consider various factors before allowing a machine to run multiple server types. How many processors do you have? What are the processor speeds? How much RAM does the machine have? What is the hard drive speed? What type of applications will be hosted on the machine?
After you have gathered all of the information about the machine, then you can decide whether the machine can host multiple server types. Keep this one fact in mind, however—because of the requirements and demands on the computer system, it's always a good idea to host SQL Server on a dedicated machine.
* * *
When setting up a file server, one of the most important things you will do is to set up work and personal folders for your users. I have been consulting for many years, and one thing I always stress to all of my clients is to perform regular backups. After all, most organizations would not be able to recover after losing all of their data. Usually, companies back up only their servers, and this is why home folders are so important. _Home folders_ are one of the most common file types on a file server; they are folders set up on the server for users to store information. Users have a location on the server to store their important data, and therefore that data will be backed up when the company does its regular backups.
Home folders are just one example of how to use work folders on a file server. I will be discussing other examples throughout this chapter.
## Configuring File Servers
Now that you have an understanding of what a file server does, it's time to discuss how to configure these servers. Setting up a file server properly encompasses many steps. As always, one major concern is security. In the following sections, I will first describe how to share and publish online and offline files and folders. Then I will discuss the two types of security—shared permissions and NTFS security—that an administrator can set when sharing files or folders.
### Sharing Folders
A file server is for sharing and storing data. To use one, you need to know how to set up a share, or a shared folder, on your server. A _shared folder_ is exactly what it says; it's a folder that is shared on your network so that users can access the data within that folder. As an administrator, you have the ability to determine which users can access which files within a shared folder.
One of the main goals of Active Directory is to make resources easy to find. Active Directory also makes it easy to determine which files are available to users. That being said, I will explain how Active Directory manages to publish shared folders.
### Making Active Directory Objects Available to Users
With Active Directory, a system administrator can control which objects users can see. The act of making an Active Directory object available is known as _publishing_. The two main publishable objects are Printer objects and Shared work folder objects. The reason I list Shared work folders here is because personal folders for users are not normally published in Active Directory. You publish an object in Active Directory because you want an easy way for everyone to find resources. Ordinarily, you don't want everyone accessing someone's home folder, and this is why you don't normally publish home folders.
The general process for creating server shares and shared printers has remained unchanged from previous versions of Windows. You create the various objects (printers or folders) and then enable them for sharing.
To make these resources available via Active Directory, however, there's an additional step: You must publish the resources. Once an object has been published in Active Directory, clients will be able to find it.
When you publish objects in Active Directory, you should know the server name and share name of the resource. This information, however, doesn't matter to your users. A system administrator can change the resource to which an object points without having to reconfigure or even notify clients. For example, if you move a share from one server to another, all you need to do is update the Shared Folder's object's properties to point to the new location. Active Directory clients still refer to the resource with the same path and name as they used before.
Exercise 4.1 will walk you through the steps for sharing and publishing a folder for use on your network.
* * *
### EXERCISE 4.1:Creating and Publishing a Shared Work Folder
1. Create a new folder in the root directory of your `C:` partition, and name it `**Test Share**`.
2. Right-click the `Test Share` folder, and choose Share With Specific People.
3. In the File Sharing dialog box, enter the names of users with whom you want to share this folder. In the upper box, enter **Everyone** and then click Add. Note that Everyone appears in the lower box. Click in the Permission Level column next to Everyone, and choose Read/Write from the drop-down menu. Then click Share.
4. You see a message that your folder has been shared. Click Done.
5. Open the Active Directory Users and Computers tool. Expand the current domain. Select New Shared Folder.
6. In the New Object – Shared Folder dialog box, type **Shared Folder Test** for the name of the folder. Then type the UNC path to the share (for example, `**\\serverA\Test Share**`). Click OK to create the share.
* * *
* * *
One of the main benefits of having all of your resource information in Active Directory is that you can easily find the information that you're seeking using the Find dialog box. When setting up objects in Active Directory, I recommend you always enter as much information as possible for the objects you're creating. The extra effort will pay off when your users start doing searches for these objects. The more information you enter, the more users can search to find the appropriate resource they need.
* * *
### Access-Based Enumeration
_Access-Based Enumeration (ABE)_ is a feature included with Windows Server 2012/2012 R2. ABE allows your domain users to list only the files and folders to which they have access when browsing content on the file server.
ABE helps eliminate domain users' issues that are caused by users connecting to file servers and seeing large numbers of files and folders the user cannot connect. ABE allows users only to see files and folders to which they have access.
Knowing that ABE is working on the Windows Server helps you set up your permissions properly. If you need to give a user the ability to see files and folders that they might not be able to change, you need to allow them at least to read or view the directories. As an administrator, it's important that you understand that Access-Based Enumeration is working on the server and what you need to do to get a user around it when needed.
### Configuring Offline Files
If you have been in this industry long enough, you have seen a major change in end-user computers. Years ago, only a few select users had laptops. They were big and bulky, and they weighed almost as much as today's desktop computers.
The pendulum has swung in the opposite direction. It probably seems like every one of your end users now has a laptop. As an IT administrator, this gives you a whole new set of challenges and problems to address.
One challenge that you have to address is how users can work on files while outside of the office. If you have a user who wants to work at home, how do you give them the files they need to get their work done?
The answer is _offline folders_. These folders contain data that can be worked on by users while outside the office. An IT administrator can set up offline folders through the use of _Group Policy objects (GPOs)_.
When you decide to make folders available for offline use, these folders need to synchronize with the laptops so that all of the data matches between both systems. As an administrator, one decision that you will need to make is when the offline folders will be synchronized. There are three synchronization options that you can set in a GPO (see Figure 4.1).
**FIGURE 4.1** Synchronization options in a GPO
You can set up any combination of these options:
* When you select Synchronize All Offline Files Before Logging Off, offline folders are synchronized when the user logs off the network.
* When you select Synchronize All Offline Files When Logging On, offline folders are synchronized when the user logs on to the network.
* When you select Synchronize Offline Files Before Suspend, offline folders are synchronized before the user does a system suspend.
In Exercise 4.2, I will show you the steps necessary to configure offline folder options by using a GPO. This exercise uses the Group Policy Management Console (GPMC). If your GPMC is not installed, use the Server Manager MMC (under Features) to install it.
* * *
Group Policy objects will be covered in full detail in Chapter 6 "Manage GPOs."
* * *
* * *
### EXERCISE 4.2: Configuring Offline Folder Options
1. Open the Group Policy Management Console.
2. In the left pane, expand your forest and then your domain. Under your domain name, there should be a default domain policy.
3. Right-click the default domain policy and choose Edit.
4. In the User Configuration section, expand Policies Administrative Templates Network and then click Offline Files.
5. Right-click Synchronize All Offline Files Before Logging Off and choose Edit. The GPO setting dialog box appears. Choose the Enabled option and click OK.
6. Right-click Synchronize All Offline Files When Logging On and choose Edit. The GPO setting dialog box appears. Choose the Enabled option and click OK.
7. Right-click Synchronize Offline Files Before Suspend and choose Edit. The GPO setting dialog box appears. Choose the Enabled option. In the Action drop-down box, make sure Quick is selected. Click OK.
8. Close the GPMC.
* * *
Now that you have set up a GPO for synchronization, it's time to share a folder for offline usage. In Exercise 4.3, you will set up a folder for offline access. You must complete Exercise 4.1 before doing this exercise.
* * *
### EXERCISE 4.3: Configuring a Shared Network Folder for Offline Access
1. Right-click the `Test Share` folder that you created in Exercise 4.1 and choose Properties.
2. Click the Sharing tab and then click the Advanced Sharing button.
3. When the Advanced Sharing dialog box appears, click the Caching button.
4. When the Offline Settings dialog box appears, choose the All Files And Programs That Users Open From The Shares Will Be Automatically Available Offline option. Click OK.
5. Click OK twice more to close the Properties dialog box.
* * *
### Volume Shadow Copy Services
Windows includes a feature that allows you to create a point-in-time image of one or more volumes. The _Volume Shadow Copy Service (VSS)_ is the feature within Windows that allows an administrator take an image (shadow copy) of one or more volumes. Shadow copies have the ability to provide both file system and application.
Shadow copies allow an administrator to back up shared folders to a remote location. Shadow copies are designed to help recover files that were accidentally deleted, that were overwritten, or that have become corrupt. One major advantage to shadow copies is that open files can be backed up. This means that even if users are currently working on files in a shared folder that has shadow copies enabled, the shadow copies will continue to function.
Once administrators have configured and enabled shadow copies (using the Computer Management snap-in), network users can restore earlier versions of files. After the initial shadow copy of the shared folder is created, only changes are copied and not the entire file.
You can enable shadow copies of entire volumes.
The following are some of the settings that you can configure when setting up shadow copies:
Schedule You have the ability to set the schedule of the shadow copies. You can set this schedule to run daily, weekly, monthly, once, at system startup, at logon, or when the system is idle. You can also set the time at which the shadow copy will run.
Storage Locations An administrator needs to set the location of the shadow copy backup. If you are on a network, it is a good idea to place the shadow copy on a network drive.
Maximum Size You can set a maximum size on your shadow copies, or you can specify that they have no size limit. One of the predetermined settings is 64 shadow copies per volume.
In Exercise 4.4, you'll set up a volume to make shadow copies every Monday at 7 a.m. To set up the shadow copies, you will use the Computer Management MMC snap-in.
* * *
### EXERCISE 4.4:Configuring a Shadow Copy on a Volume
1. Open Computer Management by pressing the Windows key and selecting Administrative Tools Computer Management.
2. Expand Storage and then right-click Disk Management. Choose All Tasks Configure Shadow Copies.
3. When the Shadow Copies dialog box appears, click the Settings button.
4. When the Settings windows appears, click the Schedule button.
5. In the Schedule window, set the schedule task to weekly and the start time for 7 a.m. Uncheck all of the days-of-the-week boxes except Mon. Click OK.
6. When the Settings window reappears, click OK.
7. If the Enable button is enabled, click it. Then click OK.
8. Exit the Computer Management MMC.
* * *
To recover a previous version of a file from a shadow copy, you use the `\\server_name\share_name` path. The operating system determines how you will gain access to the shared folders and shadow copies. Shadow copies are built into Windows XP (SP1), Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008/2008 R2, and Windows Server 2012/2012 R2. If you are using a different Microsoft operating system, you need to download the Shadow Copy Client Pack from the Microsoft download center.
#### _VssAdmin_ Command
Another way to create, configure, and manage shadow copies is by using the `vssadmin.exe` command-line utility. The `vssadmin.exe` command allows you to create, delete, list, and resize shadow copies and shadow storage.
One area where the VSS is very important is during backups. When you back up open files, the VSS copies the data and helps back up open files. For example, when you are backing up a Microsoft Exchange server using a Unitrends backup server, the VSS Exchange writer is used. To see if the VSS writers are functioning properly, you can open a command prompt (with administrative privileges) and type in the following statement:
VSSAdmin list writers
This command will show you all the different VSS service writers and how those VSS writers are functioning properly.
Table 4.1 describes the `vssadmin.exe` command and the different commands associated with the `vssadmin` utility.
**TABLE 4.1** `Vssadmin.exe` commands
Command | Description
---|---
Add ShadowStorage | Adds a new volume shadow copy storage association
Create Shadow | Creates a new volume shadow copy
Delete Shadows | Deletes volume shadow copies
Delete ShadowStorage | Deletes the volume shadow copy storage associations
List Providers | Lists registered volume shadow copy providers
List Shadows | Lists existing volume shadow copies
List ShadowStorage | Lists volume shadow copy storage associations
List Volumes | Lists volumes eligible for shadow copies
List Writers | Lists subscribed volume shadow copy writers
Resize ShadowStorage | Resizes a volume shadow copy storage association
Revert Shadow | Reverts a volume to a shadow copy
Query Reverts | Queries the progress of in-progress revert operations
### Configuring Permissions
You have gone through the steps necessary to set up a shared folder, publish it to Active Directory, and set it up for offline access. Now you will see how you can protect these files and folders by using permissions.
You can secure folders using permissions in two ways, and you can secure files in one way. You can set up permissions and security through NTFS or through sharing.
#### Understanding NTFS
NTFS is an option that you have when you are formatting a hard drive. You can format a hard drive for a Microsoft operating system in three ways.
* File Allocation Table (FAT) is supported on older operating systems only (Server 2003, Server 2000, XP, and so on).
* FAT32 is supported in Windows Server 2012 R2.
* NTFS is supported in Windows Server 2012 R2.
NTFS has many advantages over FAT and FAT32. They include the following:
Compression Compression helps compact files or folders to allow for more efficient use of hard drive space. For example, a file that usually takes up 20MB of space might use only 13MB after compression. To enable compression, just open the Advanced Attributes dialog box for a folder and check the Compress Contents To Save Disk Space box (see Figure 4.2).
**FIGURE 4.2** Setting up compression on a folder
Quotas _Quotas_ allow you to limit how much hard drive space users can have on a server. Quotas are discussed in greater detail in the section "Configuring Disk Quotas."
Encryption _Encrypting File System (EFS)_ allows a user or administrator to secure files or folders by using encryption. Encryption employs the user's security identification (SID) number to secure the file or folder. To implement encryption, open the Advanced Attributes dialog box for a folder and check the Encrypt Contents To Secure Data box (see Figure 4.3).
**FIGURE 4.3** Setting up encryption on a folder
If files are encrypted using EFS and an administrator has to unencrypt the files, there are two ways to do this. First, you can log in using the user's account (the account that encrypted the files) and unencrypt the files. Second, you can become a recovery agent and manually unencrypt the files.
* * *
If you use EFS, it's best not to delete users immediately when they leave a company. Administrators have the ability to recover encrypted files, but it is much easier to gain access to the user's encrypted files by logging in as the user who left the company and unchecking the encryption box.
* * *
Security One of the biggest advantages of NTFS is security. Security is one of the most important aspects of an IT administrator's job. An advantage of NTFS security is that the security can be placed on individual files and folders. It does not matter whether you are local to the share (in front of the machine where the data is stored) or remote to the share (coming across the network to access the data); the security is always in place with NTFS.
1. The default security permission is `Users = Read` on new folders or shares.
2. NTFS security is _additive_. In other words, if you are a member of three groups (Marketing, Sales, and R&D) and these three groups have different security settings, you get the highest level of permissions. For example, let's say you have a user by the name of wpanek who belongs to all three groups (Marketing, Sales, and R&D). Figure 4.4 shows this user's permissions. The Marketing group has Read and Execute permissions to the `Stellacon Documents` folder. The Sales group has Read and Write, and the R&D group has Full Control. Since wpanek is a member of all three groups, wpanek would get Full Control (the highest level).
**FIGURE 4.4** Security settings on the `Stellacon Documents` folder
The only time this does not apply is with the Deny permission. Deny overrides any other group setting. Taking the same example, if Sales has Deny permission for the `Stellacon Documents` folder, the user wpanek would be denied access to that folder. The only way around this Deny is if you added wpanek directly to the folder and gave him individual permissions (see Figure 4.5). Individual permissions override a group Deny. In this example, the individual right of wpanek would override the Sales group's Deny. The user's security permission for the `Stellacon Documents` folder would be Full Control.
**FIGURE 4.5** Individual permissions
* * *
Give users only the permissions necessary to do their jobs. Do not give them higher levels than they need.
* * *
#### Understanding Shared Permissions
When you set up a folder to be shared, you have the ability to assign that folder's permissions. _Shared permissions_ can be placed only on the folder and not on individual files. Files have the ability to inherit their permissions from the parent folder.
Shared folder permissions are in effect only when users are remote to the shared data. In other words, if computer A shares a folder called `Downloads` and assigns that folder shared permissions, those permissions would apply only if you connected to that share from a machine other than computer A. If you were sitting in front of computer A, the shared permissions would not apply.
Like NTFS permissions (discussed in the previous section), shared permissions are additive, so users receive the highest level of permissions granted by the groups of which they are members.
Also, as with NTFS permissions, the Deny permission (see Figure 4.6) overrides any group permission, and an individual permission overrides a group Deny.
**FIGURE 4.6** Setting up permissions on a shared folder
The default shared permission is `Administrators = Full Control`. The shared permissions going from lowest to highest are Read, Change, Full Control, and Deny. Table 4.2 compares the two different types of permissions and security.
**TABLE 4.2** NTFS security vs. shared permissions
Description | NTFS | Shared
---|---|---
Folder-level security. | Yes | Yes
File-level security. | Yes | No
In effect when local to the data. | Yes | No
In effect when remote to the data. | Yes | Yes
Permissions are additive. | Yes | Yes
Group Deny overrides all other group settings. | Yes | Yes
Individual settings override group settings. | Yes | Yes
#### How NTFS Security and Shared Permissions Work Together
When you set up a shared folder, you need to set up shared permissions on that folder. If you're using NTFS, you will also need to set up NTFS security on the folder. Since both shared permissions and NTFS security are in effect when the user is remote, what happens when the two conflict?
These are the two basic rules of thumb:
* The local permission is the NTFS permission.
* The remote permission is the more restrictive set of permissions between NTFS and shared.
This is easy to do as long as you do it in steps. Let's look at Figure 4.7 and walk through the process of figuring out what wpanek has for rights.
**FIGURE 4.7** NTFS security and shared permissions example
As you can see, wpanek belongs to three groups (Marketing, Sales, and R&D), and all three groups have settings for the `Stellacon Documents` folder. In the figure, you will notice that there are two questions: Remote = ? and Local = ? That's what you need to figure out—what are wpanek's effective permissions when he is sitting at the computer that shares the folder, and what are his effective permissions when he connects to the folder from another computer (remotely)? To figure this out, follow these steps:
1. Add up the permissions on each side separately.
Remember, permissions and security are _additive_. You get the highest permission. So, if you look at each side, the highest shared permission is the Read permission. The NTFS security side should add up to equal Full Control. Thus, now you have Read permission on shared and Full Control on NTFS.
2. Determine the local permissions.
Shared permissions do not apply when you are local to the data. Only NTFS would apply. Thus, the local permission would be Full Control.
3. Determine the remote permissions.
Remember, the remote permission is the most restrictive set of permissions between NTFS and shared. Since Read is more restrictive than Full Control, the remote permission would be Read.
Let's try another. Look at Figure 4.8, and see whether you can come up with wpanek's local and remote permissions.
**FIGURE 4.8** NTFS security and shared permissions
Your answer should match the following:
1. Local = Read
2. Remote = Read
Remember, first you add up each side to get the highest level of rights. NTFS would be Read, and shared would be Full Control. The local permission is always just NTFS (shared does not apply to local permissions), and remote permission is whichever permission (NTFS or shared) is the most restrictive (which would be Read on the NTFS side).
Exercise 4.5 walks you through the process of setting both NTFS and shared permissions. You must complete Exercise 4.1 before doing this exercise.
* * *
### EXERCISE 4.5:Configuring Shared and NTFS Settings
1. Right-click the `Test Share` folder you created in Exercise 4.1 and choose Properties.
2. Click the Sharing tab and then click the Advanced Sharing button. (You will set the shared permissions first.)
3. Click the Permissions button. Click the Add button. When the Select User page appears, choose a group from Active Directory. (I used the Sales group.) Once you find your group, click OK.
4. The Permissions dialog box appears. With your group highlighted, click the Allow check box next to Full Control and click OK. (All of the other Allow check boxes will automatically become checked.)
5. On the Advanced Sharing page, click OK. Now click the Security tab. (This allows you to set the NTFS security settings.)
6. Click the Edit button. That takes you to the Permissions page. Now click the Add button. When the Select User page appears, choose a group from Active Directory. (I used the Everyone group.) Once you find your group, choose OK.
7. The Permissions dialog box appears. With your group highlighted, click the Allow check box next to Modify, and click OK. (All of the check boxes below Modify will automatically become checked.)
8. Click Close.
* * *
## Configuring Disk Quotas
In this chapter so far, you have seen how to set up a share and publish it to Active Directory. You've also learned how to set up permissions and security and how NTFS and shared permissions work with each other. It's time to learn how to limit users' hard drive space on the servers.
_Disk quotas_ give administrators the ability to limit how much storage space a user can have on a hard drive. As mentioned earlier in this chapter, disk quotas are an advantage of using NTFS over FAT32. If you decide to use FAT32 on a volume or partition, quotas will not be available.
You have a few options available to you when you set up disk quotas. You can set up disk quotas based on volume or on users.
* * *
A good rule of thumb is to set up an umbrella quota policy that covers the entire volume and then let individual users exceed the umbrella as needed.
* * *
Setting Quotas by Volume One way to set up disk quotas is by setting the quota by volume, on a per-volume basis. This means that if you have a hard drive with `C:`, `D:`, and `E:` volumes, you would have to set up three individual quotas—one for each volume. This is your umbrella. This is where you set up an entire disk quota based on the volume for all users.
Setting Quotas by User You have the ability to set up quotas on volumes by user. Here is where you would individually let users have independent quotas that exceed your umbrella quota.
Specifying Quota Entries You use quota entries to configure the volume and user quotas. You do this on the Quotas tab of the volume's Properties dialog box. (See Exercise 4.6.)
Creating Quota Templates Quota templates are predefined ways to set up quotas. Templates allow you to set up disk quotas without needing to create a disk quota from scratch. One advantage of using a template is that when you want to set up disk quotas on multiple volumes (`C:`, `D:`, and `E:`) on the same hard drive, you do not need to re-create the quota on each volume.
Exercise 4.6 will show you how to set up an umbrella quota for all users and then have an individual account in your Active Directory exceed this quota.
* * *
### EXERCISE 4.6: Configuring Disk Quotas
1. Open Windows Explorer.
2. Right-click the local disk (`C:`) and choose Properties.
3. Click the Quotas tab.
4. Check the Enable Quota Management check box. Also check the Deny Disk Space To Users Exceeding Quota Limit box.
5. Click the Limit Disk Space To option and enter **1000MB** in the box.
6. Enter **750MB** in the Set Warning Level To boxes.
7. Click the Apply button. If a warning box appears, click OK. This warning is just informing you that the disk may need to be rescanned for the quota.
8. Now that you have set up an umbrella quota to cover everyone, you'll set up a quota that exceeds the umbrella. Click the Quota Entries button.
9. The Quotas Entries for (`C:`) window appears. You will see some users already listed. These are users who are already using space on the volume. Click the Quota menu at the top and choose New Quota Entry.
Notice the N/A entry in the Percent Used column. This belongs to the administrator account, which by default has no limit.
10. On the Select User page, choose a user that you want to allow to exceed the quota (for this example, I used the wpanek account). Click OK.
11. This opens the Add New Quota Entry dialog box. Click the Do Not Limit Disk Usage option and click OK.
12. You will notice that the new user has no limit. Close the disk quota tool.
* * *
## Configuring Print Services
One of the most important components on a network is the printer. Printers today are almost as important as the computers themselves. Think about your network. What would your network be like without a printer? Even small networks or home networks have a printer today.
How many printers do you want on your network? It is not feasible to put a printer on every user's desk. What if some users need black and white while others need color? Do you give each user two printers? What if they need laser printing for reports but ink-jets will work fine for every other type of print job? These are all questions that you must answer before buying any printers for your networks.
This is also where network printers and print servers come into play. _Network printers_ are printers that can be directly connected to the network through some form of network interface card. These printers usually have settings that can be configured for your network needs. For example, if your network uses DHCP, you can set the printer to be a DHCP client.
_Print servers_ are servers that have a connected printer, where the server handles all printing issues. This is an excellent solution for printers that cannot directly connect to the network. Once the printer is connected to the network (through the use of a NIC or a server), the end user just connects to the printer and prints. To the end user, there is no real difference between the two options.
Before an end user can print to a network printer, an administrator must connect, set up, share, and publish the printer for use. An administrator must also set the permissions on the printer to allow users to print to that printer. The following sections will discuss these items in detail.
### Creating and Publishing Printers
Once your printer is installed, you must share the printer and then publish the printer to Active Directory before users can print to it. Printers can be published easily within Active Directory. This makes them available to users in your domain.
Exercise 4.7 walks you through the steps you need to take to share and publish a Printer object by having you create and share a printer. To complete the printer installation, you need access to the Windows Server 2012 installation media (via the hard disk, a network share, or the CD/DVD drive). If you do not have a printer for this exercise, just choose one from the list and continue the exercise.
* * *
### EXERCISE 4.7: Creating and Publishing a Printer
1. Press the Windows key and select Control Panel Devices and Printers Add Printer. This starts the Add Printer Wizard.
2. On the Add Printer page, click the link The Printer That I Want Isn't Listed.
3. Choose Add A Local Printer and click Next.
4. On the Choose A Printer Port page, select Use An Existing Port. From the drop-down list beside that option, make sure LPT1: (Printer Port) is selected. Click Next.
5. On the Install The Printer Driver page, select Generic for the manufacturer, and for the printer, highlight Generic/Text Only. Click Next.
6. If a driver page appears, choose Use The Driver That Is Currently Installed and click Next.
7. On the Type A Printer Name page, enter **Text Printer**. Uncheck the Set As The Default Printer box and then click Next.
8. The Installing Printer page appears. After the system is finished, the Printer Sharing page appears. Make sure the Share This Printer So That Others On Your Network Can Find And Use It box is selected, and accept the default share name of Text Printer.
9. In the Location section, type **Building 203** , and in the Comment section, add the following comment: **This is a text-only printer**. Click Next.
10. On the You've Successfully Added Text Printer page, click Finish.
11. Next you need to verify that the printer will be listed in Active Directory. Right-click the Text Printer icon, and select Text Printer Properties.
12. Next select the Sharing tab and make sure that the List In The Directory box is checked. Click OK to accept the settings.
13. Close the printer Properties box, and close Devices And Printers.
* * *
Note that when you create and share a printer this way, an Active Directory Printer object is not displayed within the Active Directory Users and Computers tool.
### Configuring Printers
The printer has now been installed and published to Active Directory. It's time to set all of the different configuration options. To get to the options, right-click the Printer object and choose Properties.
The following are just some of the tabs you can configure:
The General Tab The General tab (see Figure 4.9) allows you to set some basic printer attributes.
**FIGURE 4.9** The General tab of the printer's Properties dialog box
* The field at the top of the dialog box contains the display name of the Printer object.
* The Location field should contain text that helps users physically locate the printer. This allows users to search for printers based on location (location-aware printing).
* The Comment field allows an administrator to put in any additional information, such as the printer type.
* The Printing Preferences button takes you to controls that allow you to change the layout and paper type of the printer.
The Sharing Tab The Sharing tab (see Figure 4.10) allows you to configure your printer for sharing on your network. This is what allows users to use a network printer (if they have the proper permissions on the printer).
**FIGURE 4.10** The Sharing tab of the printer's Properties dialog box
* The Share This Printer check box allows you to share the printer on the network.
* Share Name is the name your users will see on the network.
* When Render Print Jobs On Client Computers is checked, the client computer caches the print job until the printer is ready to print. If unchecked, the print server will cache the entire job before it prints to the printer.
* When List In The Directory is checked, users can search the directory for the printer.
* The Additional Drivers button allows you to load additional drivers for your clients. It is especially useful for giving access to drivers for older client systems. One advantage of a print server is that the server will automatically download drivers to client computers.
The Ports Tab The Ports tab (see Figure 4.11) allows you to configure the port to which your printer is connected. You can add ports or configure existing ports.
**FIGURE 4.11** The Ports tab of the printer's Properties dialog box
* The Port check boxes allow you to choose to which port your printer is connected. Options are the printer port, serial port, local port, and print to file port.
* The Add Port button allows you to add a custom port (for example, a TCP/IP port).
* The Delete Port button allows you to remove a port from the Port list.
* The Configure Port button gives you settings to configure an existing port. For example, if you use TCP/IP, this button allows you to change the TCP/IP options.
* Enable Bidirectional Support allows your printer and computer to communicate back and forth. If this check box is disabled, your printer cannot support two-way communications.
* A _printer pool_ allows two or more identical printers to share the print load. When a document is sent to the printer pool, the first available printer receives the print job and prints it. Enable Printer Pooling allows a large department or organization to get print jobs done faster. Users do not have to wait for one printer to get their print job. You should follow these rules when setting up a printer pool:
* All printers in the pool need to be the same model and type.
* All printers in the pool should be in the same physical location. Print jobs will be printed to the first available printer. If these printers are located all over the company, it may take a user too long to find their print job.
The Advanced Tab The Advanced tab (see Figure 4.12) is where you can set availability, priority, and many other options.
**FIGURE 4.12** Advanced tab of the printer's Properties dialog box
* The availability controls let you set the hours when this printer can be used. You can set it to be always available or available only between the hours you set.
* If multiple print shares are set up to go to the same printer, you can specify a printer priority with the Priority field for each share. The higher the number, the faster a print job sent to that share will access the printer. The highest priority is 99, and the default (lowest) is 1. If two users send jobs to the same printer at the same time, one with a 99 priority and the other with a 1 priority, the 99 priority would print first.
* Driver is the default printer driver that the printer is using.
* The print spooling controls let you decide how the print job will spool. You can choose to have the entire job spool first before printing (this ensures that the entire job is received by the print queue before printing), to start printing immediately while the job is still spooling, or to print directly to the printer without spooling. (The last option requires a printer with a large amount of RAM on the motherboard.)
* Hold Mismatched Documents allows the spooler to hold any print jobs that don't match the setup for the print device.
* Print Spooled Documents First allows a completely spooled printer job to be printed first even if it has a lower priority number than a job that is still spooling.
* Usually, after a print job has been printed, the print queue deletes the print job. If you check the Keep Printed Documents box, the print queue will not delete the print job after it is printed.
* Enable Advanced Printing Features allows you to set some advanced features such as the Page Order and Pages Per Sheet settings.
The Color Management Tab This tab allows you to adjust the color of your printing jobs.
The Security Tab The Security tab (see Figure 4.13) is where you can set the permissions for your printer. This allows users to print, manage printers, manage documents, and take advantage of special permissions.
**FIGURE 4.13** Security tab of the printer's Properties dialog box
* The Add button allows you to add users and groups to the printer.
* The Remove button allows you to remove users and groups from the printer.
* The following controls, available in the Permissions For Everyone box, apply to everyone on your network:
* Print gives everyone the right to print to this printer.
* Manage Printers gives everyone the right to manage this printer, including deleting print jobs, setting priorities, setting availability, and so on.
* Manage Documents gives everyone the right to manage print jobs.
* Special Permissions allows you to set unique permissions such as Print, Manage Printers, Read permissions, Change permissions, and Take Ownership.
### Migrating Print Servers
In a network environment, an administrator may find it necessary to replace older print servers or to consolidate multiple print servers into one. To do this print server migration or replacement, you can use the Printer Migration Wizard or the `Printbrm`.`exe` command-line tool. These two utilities allow you to export print queues, printer settings, printer ports, and language monitors. These utilities then allow you to import these settings on another print server running Windows Server 2012 R2.
### Printer Pooling
In a large organization, one issue that you may run into when you print a document to a print device is that you may have to wait a while for that document to print. If you have hundreds of print jobs being sent to a print device, it could take time until your print job appears on the print device. This is where printer pools can help.
A _printer pool_ allows an administrator to associates multiple printers (identical print devices) with a single set of printer software. When you send a print job to a device, the print job will print to the first available device in the printer pool. This allows print jobs to print faster to multiple devices. For this to work, you must make sure that all devices are in the same physical area. You do not want a user traveling all over the company looking for their print job because they don't know which device printed the job.
To set up a printer to print to multiple devices, follow these steps:
1. Open Devices and Printers.
2. Right-click the printer you are using and then click Printer Properties.
3. On the Ports tab, select the Enable Printer Pooling check box.
4. Click each port where the printers you want to pool are connected.
### Easy Print Driver
One printer configuration that is a little different from normal is when you are setting up a printer for a Remote Desktop server. However, Microsoft has included a feature to help. That feature is called the _Easy Print Driver_.
Remote Desktop Services gives you the ability to do printer redirection. What this means is Remote Desktop can route printing jobs from a server to a printer that is attached to a client computer. On an RD Session Host server, an administrator has the ability to use the Remote Desktop Easy Print printer driver to help simplify printer configuration.
The RD Session Host server first tries to use the Remote Desktop Easy Print driver, and if the RD client computer does not support this driver, the server looks for a matching printer driver on the server.
## Configuring Remote Management
As an administrator, sometimes you might need to manage a server remotely. There are a few different tools you can use to do this task. You can use remote administration to help configure services on a Windows Server 2012 R2 system. The following sections cover Windows Remote Management and Windows PowerShell.
* * *
Windows PowerShell does not always have to be used remotely. For example, you can use Windows PowerShell when configuring a Windows Server 2012 R2 Server Core installation locally.
* * *
### Windows Remote Management
The _Windows Remote Management (WinRM) utility_ is Microsoft's version of the WS-Management protocol, an industry-standard protocol that allows different vendors' operating systems and hardware to work together. There are three main ways to access the WinRM utility:
* WinRM command-line tool
* WinRM scripting objects
* Windows Remote Shell command-line tool
The WinRM utility allows you to execute commands remotely and obtain management data from local and remote computers. You can use the WinRM utility on both Windows-based operating systems and non-Windows-based operating systems.
When using the WinRM utility, you can use the `-machine` switch to indicate the remote machine to which you are connecting. When connecting to a machine, you can connect using the localhost name, the NetBIOS name, the fully qualified domain name (FQDN), or the IP address of the remote machine. The following is an example of a WinRM command using a FQDN name on the secure port 443:
winrm get -machine:server.stellacon.local -port:443
Table 4.3 shows the command-line WinRM commands and descriptions of what each command does.
**TABLE 4.3** WinRM commands and descriptions
Command | Description
---|---
`WinRM g` or `WinRM get` | Retrieves management information
`WinRM s` or `WinRM set` | Modifies management information
`WinRM c` or `WinRM create` | Creates a new instance on the managed resources
`WinRM d` or `WinRM delete` | Removes an instance from a managed resource
`WinRM e` or `WinRM enumerate` | Lists all instances of a managed resource
`WinRM i` or `WinRM invoke` | Executes a method on a managed resource
`WinRM id` or `WinRM identity` | Determines whether a WS-Management implementation is running on a remote machine
`WinRM quickconfig` | Configures a machine to accept WS-Management commands from a remote machine
`WinRM configSDDL` | Modifies an existing security descriptor for a Uniform Resource Identifier (URI)
`WinRM helpmsg` | Displays error messages for an error code
Now that you have looked at WinRM, let's take a look at how to use the Windows PowerShell utility.
### Windows PowerShell
_Windows PowerShell_ is a task-based, command-line scripting utility that allows you to execute commands locally or remotely on a Windows Server 2012 R2 machine. It was specifically designed for system administrators to allow for local or remote administration.
* * *
Microsoft asks a lot of questions on the exam about Windows PowerShell. Therefore, I will be discussing PowerShell throughout this book because of its importance on all of the Windows Server 2012 R2 exams.
* * *
Most operating system shells, including `Cmd.exe` and the SH, KSH, CSH, and BASH Unix shells, work by running a command or utility in a new process and then presenting the results to the user as text. These system shells also have commands that are built into the shell and execute in the shell process. In most system shells, because there are only a few built-in commands, many utilities have been created over the years to complete tasks.
Windows PowerShell contains an interactive prompt and a scripting environment that can be used independently or in combination. Unlike the previously mentioned system shells, which accept and return text, Windows PowerShell is built using the _.NET Framework common language runtime (CLR)_ and the .NET Framework. Because of this, Windows PowerShell accepts and returns .NET Framework objects. This important change in the shell allows you to use entirely new tools and methods to manage and configure Windows.
Windows PowerShell introduced the concept of using cmdlets (pronounced "command-lets"). Cmdlets are simple, single-function command-line tools built into the shell. Administrators can use the cmdlets independently, or they can combine these tools to execute complex tasks and harness the true power of PowerShell. Windows PowerShell includes more than a hundred core cmdlets, but the true advantage of PowerShell is that anyone can write their own cmdlets and share them with other users.
Administrators often automate the management of their multicomputer environments by running sequences of long-running tasks, or _workflows_ , which can affect multiple managed computers or devices at the same time. Windows PowerShell can help administrators accomplish workflows in a more effective way. Windows PowerShell includes some of the following advantages:
Windows PowerShell Scripting Syntax Administrators can use Windows PowerShell scripting expertise to create script-based tasks by using the extensible Windows PowerShell language. Windows PowerShell script-based tasks are easy to create, and IT members can share them easily by entering them into an email or publishing them on a web page.
Day-to-Day Management tasks Windows PowerShell allows administrators to configure and maintain servers. PowerShell allows you to pre-create scripts or use ready-to-use scripts to handle day-to-day tasks. This way, an administrator can just run a script to complete server configurations or management.
Multiserver Management Administrators can concurrently apply workflow tasks to hundreds of managed servers and computers. Windows PowerShell includes common parameters to set workflows automatically, such as `PSComputerName`, to enable multicomputer administrative scenarios.
Single Task to Manage Complex, End-to-End Processes Administrators can combine related scripts or commands that act upon an entire scenario into a single workflow. The status of activities within the workflow can be viewed at any time.
Automated Failure Recovery Using Windows PowerShell allows workflows to survive both planned and unplanned interruptions, such as computer restarts. Administrators have the ability to suspend workflow operations and then restart or resume the workflow from the exact point at which it was suspended. Administrators can then create checkpoints as part of their workflow process so that they can resume the workflow from the last persisted task (or checkpoint) instead of restarting the workflow from the beginning.
Activity Retries Administrators can create workflows that also specify activities that must rerun if the activity does not get completed on one or more managed computers (for example, if a target node was not online at the time the activity was running).
Connect and Disconnect Administrators can connect and disconnect from the node that is executing the workflow, but the workflow will continue to run.
Configuring Non-Domain Servers Another advantage of PowerShell is the ability to configure non-domain servers from a Windows Server 2012 R2 server (domain member). When you are running commands on the non-domain machine, you must have access to the non-domain machine's system administrator account. Another way to configure a non-domain server is to connect through remote desktop into the non-domain server and then configure the machine or run PowerShell commands while connected through remote desktop.
Task Scheduling Workflow tasks have the ability to be scheduled and started when specific conditions are met. This is also true for any other Windows PowerShell cmdlet or script.
Table 4.4 defines a few of the cmdlets available in Windows PowerShell. Again, there are hundreds of cmdlets, and the ones listed in the table are just some of the more common ones. You can retrieve a list of all the cmdlets starting here:
http://technet.microsoft.com/en-us/scriptcenter/dd772285.aspx
**TABLE 4.4** Windows PowerShell cmdlets
Cmdlet | Definition
---|---
`Clear-History` | Deletes entries from the command history
`Invoke-command` | Runs commands on local or remote computers
`Start-job` | Starts a Windows PowerShell background job
`Stop-job` | Stops a Windows PowerShell background job
`Remove-job` | Deletes a Windows PowerShell background job
`Import-Module` | Adds modules to the current session
`Receive-job` | Gets the results of a Windows PowerShell background job
`Format-table` | Shows the results in a table format
`Out-file` | Sends the job results to a file
`Get-Date` | Gets the date and time
`Set-Date` | Sets the system time and date on a computer
`Get-event` | Gets an event in the event queue
`New-event` | Creates a new event
`Trace-command` | Configures and starts a trace of a command on a machine
`Get-WindowsFeature` | Gets a list of available and installed roles and features on the local server
`Get-WindowsFeature -ServerName` | Gets a list of available and installed roles and features on a remote server
`Get-Help Install-WindowsFeature` | Gets the syntax and accepted parameters for the `Install-WindowsFeature` cmdlet
`Uninstall-WindowsFeature` | Removes a role or feature
`Get-NetIPAddress` | Gets information about IP address configuration
`Set-NetIPAddress` | Modifies IP address configuration properties of an existing IP address
`Set-NetIPv4Protocol` | Modifies information about the IPv4 protocol configuration
* * *
## Windows PowerShell Commands
I will show you Windows PowerShell commands throughout this book. If I show you how to install a role or feature in Server Manager, I will also include the Windows PowerShell equivalent.
* * *
Another advantage of Windows PowerShell is that it allows you to gain access to a file system on a computer and to access the registry, digital certificate stores, and other data stores.
Complete Exercise 4.8 to start the Windows PowerShell utility in the Windows Server 2012 R2 Server Core machine installed in the previous exercise.
* * *
### EXERCISE 4.8: Starting the Windows PowerShell Utility
1. Type `**Start PowerShell**` at the Windows Server 2012 R2 Server Core command prompt.
2. When the Windows PowerShell utility starts, type `**Help**` and press Enter. This will show you the Windows PowerShell syntax and some of the commands included in Windows PowerShell.
3. At the Windows PowerShell command prompt, type `**Get-Date**`. This will show you the system's date and time.
4. At the Windows command prompt, type `**Help ∗**`. This will show you all of the cmdlets you can use.
5. Close the Windows PowerShell utility by typing `**Exit**`.
* * *
### Configuring Down-Level Servers
As an administrator, sometimes you might have to configure a Windows Server 2008 R2 server from a Windows Server 2012 R2 machine. This is referred to as configuring a _down-level server_.
When you install Windows Server 2012 R2, Server Manager can be used to configure and manage a down-level server as long as that down-level server is running one of the following operating systems:
* Windows Server 2008 R2 SP1 (either full server or a Server Core installation)
* Windows Server 2008 SP2 (full server only)
To be able to configure the Windows Server 2008/2008 R2 servers remotely, you must first install Windows Management Framework 3.0 (WMF 3.0) and all of its prerequisites on the Windows Server 2008/2008 R2 servers. No special configuration is required on the Windows Server 2012 R2 server.
If you need to install WMF 3.0 on a Windows Server 2008 R2 Server Core installation, you can do this by using the Deployment Image Servicing and Management (DISM) commands. The command names that you would use for these features are as follows:
* MicrosoftWindowsPowerShell
* MicrosoftWindowsPowerShell-WOW64
* NetFx2-ServerCore
* NetFx2-ServerCore-WOW64
To run these commands, you would run the following in Server Core:
Dism /online /enable-feature: <Feature Name>
* * *
It is important to remember that Dism is case-sensitive in the command shown here.
* * *
### Configuring Server Core
When configuring servers remotely, an administrator may have to configure a Server Core system. Let's take a look at some of the Server Core commands that can be used to do some basic server configurations.
When configuring Server Core, you may need to set the system for a static TCP/IP address. Use the following Windows PowerShell commands:
* `Get-NetIPConfiguration` allows you to view your current network configuration.
* `Get-NetIPAddress` allows you to view the IP addresses you are currently using.
If you want to set your static TCP/IP address, do the following:
1. In Windows PowerShell, run `Get-NetIPInterface`.
2. Write down the number shown in the `IfIndex` column of the output for the IP interface or the `InterfaceDescription` string for the network adapter you want to change.
3. In Windows PowerShell, run `New-NetIPAddress –InterfaceIndex 10 –IPAddress -192.168.15.2 –PrefixLength 24 –DefaultGateway -192.168.15.1`.
* `InterfaceIndex` is the value of `IfIndex` from step 2 (in this example, `10`).
* `IPAddress` is the static IP address you intend to set (in this example, `192.168.15.2`).
* `PrefixLength` is the prefix length (another form of subnet mask) for the IP address you intend to set (in this example, `24`).
* `DefaultGateway` is the default gateway (in this example, `192.168.15.1`).
4. In Windows PowerShell, run `Set-DNSClientServerAddress –InterfaceIndex 10 -ServerAddresses 192.168.15.4`.
* `InterfaceIndex` is the value of `IfIndex` from step 2.
* `ServerAddresses` is the IP address of your DNS server.
5. To add multiple DNS servers, run `Set-DNSClientServerAddress –InterfaceIndex 10 -ServerAddresses 192.168.15.4,192.168.15.5`.
* In this example, `192.168.15.4` and `192.168.15.5` are both IP addresses of DNS servers.
Another Server Core task that you may need to configure is setting the server name. In PowerShell, run the following command to rename the server: `Rename-Computer`.
As an administrator, you may also want to run PowerShell commands on one system to run on another system. You can enable Windows PowerShell Remoting by using the `Enable-PSRemoting` command.
#### Configuring the Windows Firewall
The final item to examine is configuring Windows Firewall remotely. Microsoft Server 2012 R2 Windows Firewall will be discussed in full detail in Chapter 6, but since I am discussing remote administration, let's look at the commands needed to configure Windows Firewall remotely.
`Netsh advfirewall` is a command-line (with Administrator privileges) tool for Windows Firewall with Advanced Security that helps with the creation, administration, and monitoring of Windows Firewall and IPsec settings and provides an alternative to console-based management.
To enter into the `netsh advfirewall` prompt, you must first type `**netsh**`. After you enter the `netsh` prompt, you then type `**advfirewall**`, which will bring you to the `netsh advfirewall` prompt. When you enter `netsh advfirewall`, it enters you into a `netsh advfirewall` prompt that looks like the following:
**netsh advfirewall >** prompt
Once you are at the `netsh firewall` prompt, you can use the question mark to get a list of all available options (`netsh advfirewall>?`). Figure 4.14 shows you the list of available options.
**FIGURE 4.14** `Netsh` `advfirewall` options
## Summary
In this chapter, I discussed file servers and how they can be effective on your network. I also discussed sharing folders for users to access, and then I discussed how to publish those shared folders to Active Directory.
You learned about NTFS security versus shared folder permissions and how to limit users' hard drive space by setting up disk quotas. The chapter also covered the Encrypting File System (EFS) and how users can encrypt and compress files.
I talked about print servers and configuring printers. I talked about how to share and publish printers within Active Directory as well as print permissions, printer priorities, and print pooling.
You then took a look at remote configuration and a few tools that allow you to configure servers.
* Windows Remote Management lets you configure a server remotely from another machine.
* PowerShell is an important tool in the Windows Server 2012 R2 arsenal. Microsoft has been moving the industry toward PowerShell, and there will be many questions on the exam about PowerShell.
* `Netsh` allows you to configure Windows Firewall remotely.
## Exam Essentials
Learn How Resources Can Be Published A design goal for Active Directory was to make network resources easier for users to find. With that in mind, you should understand how using published printers and shared folders can simplify network resource management.
Know How to Configure Offline Folders Offline folders give you the opportunity to set up folders so that users can work on the data while outside the office and later synchronize it with a master copy. You can set up GPOs to help with offline folder synchronization.
Know How to Configure NTFS Security One of the major advantages of using NTFS over FAT32 is access to additional security features. NTFS allows you to put security at the file and folder layers. NTFS security is in effect whether the user is remote or local to the computer with the data.
Know How to Configure Shared Permissions Shared permissions allow you to determine the access a user will receive when connecting to a shared folder. Shared permissions are allowed only at the folder layer and are in effect only when the user is remote to the computer with the shared data.
Understand How NTFS and Shared Permissions Work Together NTFS and shared permissions are individually additive—you get the highest level of security and permissions within each type. NTFS is always in effect, and it is the only security available locally. Shared permissions are in effect only when connecting remotely to access the shared data. When the two types of permissions meet, the most restrictive set of permissions applies.
Know How to Configure Disk Quotas Disk quotas allow an organization to determine the amount of disk space that users can have on a volume of a server. An administrator can set up disk quotas based on volumes or by users. Each volume must have its own separate set of disk quotas.
Know How to Configure Printing I discussed network printers versus print servers. Understand that when you create a printer, you want to publish the printer within Active Directory so that your users can find it throughout the domain. Understand the different printer permissions and how to install print drivers.
Understand Windows PowerShell Understanding Windows PowerShell is not only important for the exam; it will also allow you to configure Server Core more efficiently. Windows PowerShell is a command-line utility that allows you run single cmdlets as well as run complex tasks to exploit the full power from PowerShell.
## Review Questions
1. The company for which you work has a multilevel administrative team that is segmented by departments and locations. There are four major locations, and you are in the Northeast group. You have been assigned to the administrative group that is responsible for creating and maintaining network shares for files and printers in your region. The last place you worked had a large Windows Server 2003 network, where you had a much wider range of responsibilities. You are excited about the chance to learn more about Windows Server 2012 R2.
For your first task, you have been given a list of file and printer shares that need to be created for the users in your region. You ask how to create them in Windows Server 2012 R2, and you are told that the process of creating a share is the same as with Windows Server 2003. You create the shares and use `NETUSE` to test them. Everything appears to work fine, so you send out a message that the shares are available. The next day, you start receiving calls from users who say they cannot see any of the resources you created. What is the most likely reason for the calls from the users?
1. You forgot to enable NetBIOS for the shares.
2. You need to force replication for the shares to appear in the directory.
3. You need to publish the shares in the directory.
4. The shares will appear within the normal replication period.
2. You want to publish a printer to Active Directory. Where would you click in order to accomplish this task?
1. The Sharing tab
2. The Advanced tab
3. The Device Settings tab
4. The Printing Preferences button
3. A system administrator creates a local Printer object, but it doesn't show up in Active Directory when a user executes a search for all printers. Which of the following are possible reasons for this? (Choose all that apply.)
1. The printer was not shared.
2. The printer is offline.
3. The client does not have permission to view the printer.
4. The printer is malfunctioning.
4. You are the network administrator for a midsize coffee bean distributor. Your company's network has four Windows 2012 R2 servers, and all of the clients are running either Windows 8 or Windows 7. Most of your end users use laptops to do their work, and many of them work away from the office. What should you configure to help them work on documents when away from the office?
1. Online file access
2. Offline file access
3. Share permissions
4. NTFS permissions
5. Your company has decided to implement a Windows 2012 R2 server. The company IT manager who came before you always used FAT32 as the system partition. Your company wants to know whether it should move to NTFS. Which of the following are some advantages of NTFS? (Choose all that apply.)
1. Security
2. Quotas
3. Compression
4. Encryption
6. Will, the IT manager for your company, has been asked to give Moe the rights to read and change documents in the `Stellacon Documents` folder. The following table shows the current permissions on the shared folder:
Group/User | NTFS | Shared
---|---|---
Sales | Read | Change
Marketing | Modify | Change
R&D | Deny | Full Control
Finance | Read | Read
Tylor | Read | Change
Moe is a member of the Sales and Finance groups. When Moe accesses the `Stellacon Documents` folder, he can read all of the files, but the system won't let him change or delete files. What do you need to do to give Moe the minimum amount of rights to do his job?
1. Give Sales Full Control to shared permissions.
2. Give Moe Full Control to NTFS security.
3. Give Finance Change to shared permissions.
4. Give Finance Modify to NTFS security.
5. Give Moe Modify to NTFS security.
7. You are the administrator of your network, which consists of two Windows Server 2012 R2 systems. One of the servers is a domain controller, and the other server is a file server for data storage. The hard drive of the file server is starting to fill up. You do not have the ability to install another hard drive, so you decide to limit the amount of space everyone gets on the hard drive. What do you need to implement to solve your problem?
1. Disk spacing
2. Disk quotas
3. Disk hardening
4. Disk limitations
8. You are the IT manager for your company. You have been asked to give the Admin group the rights to read, change, and assign permissions to documents in the `Stellacon Documents` folder. The following table shows the current permissions on the `Stellacon Documents` shared folder:
Group/User | NTFS | Shared
---|---|---
Sales | Read | Change
Marketing | Modify | Change
R&D | Deny | Full Control
Finance | Read | Read
Admin | Change | Change
What do you need to do to give the Admin group the rights to do their job? (Choose all that apply.)
1. Give Sales Full Control to shared permissions.
2. Give Full Control to NTFS security.
3. Give Admin Full Control to shared permissions.
4. Give Finance Modify to NTFS security.
5. Give Admin Full Control to NTFS security.
9. You have been asked to configure a Windows Server 2012 R2 Datacenter Server Core machine. Which remote configuration applications can you use to configure this server from your machine? (Choose all that apply.)
1. Windows Remote Management
2. Command prompt
3. Windows PowerShell
4. Microsoft Remote Admin (MRA)
10. You have been hired by a small company to implement new Windows Server 2012 R2 systems. The company wants you to set up a server for users' home folder locations. What type of server would you be setting up?
1. PDC server
2. Web server
3. Exchange server
4. File server
# Chapter 5
Administer Active Directory
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Create and manage Active Directory users and computers**
* Automate the creation of Active Directory accounts
* Create, copy, configure, and delete users and computers
* Configure templates
* Perform bulk Active Directory operations
* Configure user rights
* Offline domain join
* Manage inactive and disabled accounts
2. **Create and manage Active Directory groups and organizational units (OUs)**
* Configure group nesting
* Convert groups including security, distribution, universal, domain local, and domain global
* Manage group membership using Group Policy
* Enumerate group membership
* Delegate the creation and management of Active Directory objects
* Manage default Active Directory containers
* Create, copy, configure, and delete groups and OUs
In previous chapters, you learned how to install Domain Name System (DNS) and Active Directory, but you still haven't been introduced to the lower-level objects that exist in Active Directory.
In this chapter, you will look at the structure of the various components within a domain. You'll see how an organization's business structure can be mirrored within Active Directory through the use of organizational units for ease of use and to create a seamless look and feel. Because the concepts related to organizational units are quite simple, some system administrators may underestimate their importance and not plan to use them accordingly. Make no mistake: one of the fundamental components of a successful Active Directory installation is the proper design and deployment of organizational units.
You'll also see in this chapter the actual steps you need to take to create common Active Directory objects and then learn how to configure and manage them. Finally, you'll look at ways to publish resources and methods for creating user accounts automatically.
## An Overview of OUs
An _organizational unit (OU)_ is a logical group of Active Directory objects, just as the name implies. OUs serve as containers within which Active Directory objects can be created, but they do not form part of the DNS namespace. They are used solely to create organization within a domain.
OUs can contain the following types of Active Directory objects:
* Users
* Groups
* Computers
* Shared Folder objects
* Contacts
* Printers
* InetOrgPerson objects
* Microsoft Message Queuing (MSMQ) Queue aliases
* Other OUs
Perhaps the most useful feature of OUs is that they can contain other OU objects. As a result, system administrators can hierarchically group resources and objects according to business practices. The OU structure is extremely flexible and, as you will see later in this chapter, can easily be rearranged to reflect business reorganizations.
Another advantage of OUs is that each can have its own set of policies. Administrators can create individual and unique Group Policy objects (GPOs) for each OU. GPOs are rules or policies that can apply to all of the objects within the OU. GPOs are discussed in detail in Chapter 6 "Manage GPOs."
Each type of object has its own purpose within the organization of Active Directory domains. Later in this chapter, you'll look at the specifics of User, Computer, Group, and Shared Folder objects. For now, let's focus on the purpose and benefits of using OUs.
### The Purpose of OUs
OUs are mainly used to organize the objects within Active Directory. Before you dive into the details of OUs, however, you must understand how OUs, users, and groups interact. Most important, you should understand that OUs are simply containers that you can use to group various objects logically. They are not, however, groups in the classical sense. That is, they are not used for assigning security permissions. Another way of stating this is that the user accounts, computer accounts, and group accounts that are contained in OUs are considered security principals while the OUs themselves are not.
OUs do not take the place of standard user and group permissions. A good general practice is to assign users to groups and then place the groups within OUs. This enhances the benefits of setting security permissions and of using the OU hierarchy for making settings. Figure 5.1 illustrates this concept.
**FIGURE 5.1** Relationships of users, groups, and OUs
An OU contains objects only from within the domain in which it resides. As you'll see in the section "Delegating Administrative Control" later in this chapter, the OU is the finest level of granularity used for group policies and other administrative settings.
### Benefits of OUs
There are many benefits to using OUs throughout your network environment.
* OUs are the smallest unit to which you can assign directory permissions.
* You can easily change the OU structure, and it is more flexible than the domain structure.
* The OU structure can support many different levels of hierarchy.
* Child objects can inherit OU settings.
* You can set Group Policy settings on OUs.
* You can easily delegate the administration of OUs and the objects within them to the appropriate users and groups.
Now that you have a good idea of why you should use OUs, take a look at some general practices you can use to plan the OU structure.
## Planning the OU Structure
One of the key benefits of Active Directory is the way in which it can bring organization to complex network environments. Before you can begin to implement OUs in various configurations, you must plan a structure that is compatible with business and technical needs. In this section, you'll learn about several factors that you should consider when planning for the structure of OUs.
### Logical Grouping of Resources
The fundamental purpose of using OUs is to group resources (which exist within Active Directory) hierarchically. Fortunately, hierarchical groups are quite intuitive and widely used in most businesses. For example, a typical manufacturing business might divide its various operations into different departments as follows:
* Sales
* Marketing
* Engineering
* Research and Development
* Support
* Information Technology (IT)
Each of these departments usually has its own goals and mission. To make the business competitive, individuals within each of the departments are assigned to various roles. The following role types might be used:
* Managers
* Clerical staff
* Technical staff
* Planners
Each of these roles usually entails specific job responsibilities. For example, managers should provide direction to general staff members. Note that the very nature of these roles suggests that employees may fill many different positions. That is, one employee might be a manager in one department and a member of the technical staff in another. In the modern workplace, such situations are quite common.
All of this information helps you plan how to use OUs. First the structure of OUs within a given network environment should map well to the business's needs, including the political and logical structure of the organization as well as its technical needs. Figure 5.2 shows how a business organization might be mapped to the OU structure within an Active Directory domain.
**FIGURE 5.2** Mapping a business organization to an OU structure
When naming OUs for your organization, you should keep several considerations and limitations in mind:
Keep the Names and Descriptions Simple The purpose of OUs is to make administering and using resources simple. Therefore, it's always a good idea to keep the names of your objects simple and descriptive. Sometimes, finding a balance between these two goals can be a challenge. For example, although a printer name like "The LaserJet located near Bob's cube" might seem descriptive, it is certainly difficult to type. Also, imagine the naming changes that you might have to make if Bob moves (or leaves the company)!
Pay Attention to Limitations The maximum length for the name of an OU is 64 characters. In most cases, this should adequately describe the OU. Remember, the name of an OU does not have to describe the object uniquely because the OU is generally referenced only as part of the overall hierarchy. For example, you can choose to create an OU named "IT" within two different parent OUs. Even though the OUs have the same name, users and administrators are able to distinguish between them based on their complete pathname.
Pay Attention to the Hierarchical Consistency The fundamental basis of an OU structure is its position in a hierarchy. From a design standpoint, this means you cannot have two OUs with the same name at the same level. However, you can have OUs with the same name at different levels. For example, you could create an OU named "Corporate" within the North America OU and another one within the South America OU. This is because the fully qualified domain name includes information about the hierarchy. When an administrator tries to access resources in a Corporate OU, they must specify which Corporate OU they mean.
For example, if you create a North America OU, the Canada OU should logically fit under it. If you decide that you want to separate the North America and Canada OUs into completely different containers, then you might want to use other, more appropriate names. For example, you could change North America to "U.S." Users and administrators depend on the hierarchy of OUs within the domain, so make sure that it remains logically consistent.
Based on these considerations, you should have a good idea of how best to organize the OU structure for your domain.
### Understanding OU Inheritance
When you rearrange OUs within the structure of Active Directory, you can change several settings. When they are moving and reorganizing OUs, system administrators must pay careful attention to automatic and unforeseen changes in security permissions and other configuration options. By default, OUs inherit the permissions of their new parent container when they are moved.
By using the built-in tools provided with Windows Server 2012 R2 and Active Directory, you can move or copy OUs only within the same domain. You cannot use the Active Directory Users and Computers tool to move OUs between domains. To do this, use the _Active Directory Migration Tool (ADMT)_. This is one of the many Active Directory support tools.
### Delegating Administrative Control
I already mentioned that OUs are the smallest component within a domain to which administrative permissions and group policies can be assigned by administrators. Now you'll take a look specifically at how administrative control is set on OUs.
* * *
Delegation occurs when a higher security authority assigns permissions to a lesser security authority. As a real-world example, assume that you are the director of IT for a large organization. Instead of doing all of the work yourself, you would probably assign roles and responsibilities to other individuals. For example, if you worked within a multidomain environment, you might make one system administrator responsible for all operations within the Sales domain and another responsible for the Engineering domain. Similarly, you could assign the permissions for managing all printers and print queue objects within your organization to one individual user while allowing another individual user to manage all security permissions for users and groups. In this way, you can distribute the various roles and responsibilities of the IT staff throughout the organization.
* * *
Businesses generally have a division of labor that handles all of the tasks involved in keeping the company's networks humming. Network operating systems (NOSs), however, often make it difficult to assign just the right permissions; in other words, they do not support very granular permission assignments. Sometimes, fine granularity is necessary to ensure that only the right permissions are assigned. A good general rule of thumb is to provide users and administrators with the minimum permissions they require to do their jobs. This way, you can ensure that accidental, malicious, and otherwise unwanted changes do not occur.
* * *
You can use auditing to log events to the Security log in the Event Viewer. This is a way to ensure that if accidental, malicious, and otherwise unwanted changes do occur, they are logged and traceable.
* * *
In the world of Active Directory, you delegate to define responsibilities for OU administrators. As a system administrator, you will occasionally be tasked with having to delegate responsibility to others—you can't do it all, although sometimes administrators believe that they can. You understand the old IT logic of doing all of the tasks yourself for job security, but this can actually make you look worse.
* * *
You can delegate control only at the OU level and not at the object level within the OU.
* * *
If you do find yourself in a role where you need to delegate, remember that Windows Server 2012 R2 was designed to offer you the ability to do so. In its simplest definition, _delegation_ allows a higher administrative authority to grant specific administrative rights for containers and subtrees to individuals and groups. What this essentially does is to eliminate the need for domain administrators with sweeping authority over large segments of the user population. You can break up this control over branches within your tree, within each OU you create.
* * *
To understand delegation and rights, you should first understand the concept of _access control entries (ACEs)_. ACEs grant specific administrative rights on objects in a container to a user or group. A container's access control list (ACL) is used to store ACEs.
* * *
When you are considering implementing delegation, keep these two concerns in mind:
Parent-Child Relationships The OU hierarchy you create will be important when you consider the maintainability of security permissions. OUs can exist in a parent-child relationship, which means that permissions and group policies set on OUs higher up in the hierarchy (parents) can interact with objects in lower-level OUs (children). When it comes to delegating permissions, this is extremely important. You can allow child containers to inherit the permissions set on parent containers automatically. For example, if the North America division of your organization contains 12 other OUs, you could delegate permissions to all of them at once (saving time and reducing the likelihood of human error) by placing security permissions on the North America division. This feature can greatly ease administration, especially in larger organizations, but it is also a reminder of the importance of properly planning the OU structure within a domain.
Inheritance Settings Now that you've seen how you can use parent-child relationships for administration, you should consider _inheritance_ , the process in which child objects take on the permissions of a parent container. When you set permissions on a parent container, all of the child objects are configured to inherit the same permissions. You can override this behavior, however, if business rules do not lend themselves well to inheritance.
### Applying Group Policies
One of the strengths of the Windows operating system is that it offers users a great deal of power and flexibility. From installing new software to adding device drivers, users can make many changes to their workstation configurations. However, this level of flexibility is also a potential problem. For instance, inexperienced users might inadvertently change settings, causing problems that can require many hours to fix.
In many cases (and especially in business environments), users require only a subset of the complete functionality the operating system provides. In the past, however, the difficulty associated with implementing and managing security and policy settings has led to lax security policies. Some of the reasons for this are technical—it can be tedious and difficult to implement and manage security restrictions. Other problems have been political—users and management might feel that they should have full permissions on their local machines, despite the potential problems this might cause.
That's where the idea of group policies comes in. Simply defined, _group policies_ are collections of rules that you can apply to objects within Active Directory. Specifically, Group Policy settings are assigned at the site, domain, and OU levels, and they can apply to user accounts and computer accounts. For example, a system administrator can use group policies to configure the following settings:
* Restricting users from installing new programs
* Disallowing the use of the Control Panel
* Limiting choices for display and Desktop settings
## Creating OUs
Now that you have looked at several different ways in which OUs can be used to bring organization to the objects within Active Directory, it's time to look at how you can create and manage them.
Through the use of the _Active Directory Users and Computers administrative tool_ , also called the _MMC (Microsoft Management Console)_ , you can quickly and easily add, move, and change OUs. This graphical tool makes it easy to visualize and create the various levels of hierarchy an organization requires.
Figure 5.3 shows a geographically based OU structure that a multinational company might use. Note that the organization is based in North America and that it has a corporate office located there. In general, the other offices are much smaller than the corporate office located in North America.
**FIGURE 5.3** A geographically based OU structure
It's important to note that this OU structure could have been designed in several different ways. For example, I could have chosen to group all of the offices located in the United States within an OU named "U.S." However, because of the large size of these offices, I chose to place these objects at the same level as the Canada and Mexico OUs. This prevents an unnecessarily deep OU hierarchy while still logically grouping the offices.
One nice feature when creating an OU is the ability to protect the OU from being accidentally deleted. When you create an OU, you can check the Protect Container From Accidental Deletion check box. This check box protects against an administrator deleting the OU. To delete the OU, you must go into the advanced view of the OU and uncheck the box.
Exercise 5.1 walks you through the process of creating several OUs for a multinational business. You'll be using this OU structure in later exercises within this chapter.
* * *
To perform the exercises included in this chapter, you must have administrative access to a Windows Server 2012 R2 domain controller.
* * *
* * *
### EXERCISE 5.1: Creating an OU Structure
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers administrative tool.
3. Right-click the name of the local domain and choose New Organizational Unit. You will see the dialog box shown here. Notice that this box shows you the current context within which the OU will be created. In this case, you're creating a top-level OU, so the full path is simply the name of the domain.
4. Type **North America** for the name of the first OU. Uncheck the box Protect Container From Accidental Deletion and click OK to create this object.
5. Create the following top-level OUs by right-clicking the name of the domain and choosing New Organizational Unit. Also make sure to uncheck Protect Container From Accidental Deletion for all OUs in these exercises because you'll be deleting some of these OUs in later ones.
1. Africa
2. Asia
3. Europe
4. South America
Note that the order in which you create the OUs is not important. In this exercise, you are simply using a method that emphasizes the hierarchical relationship.
6. Create the following second-level OUs within the North America OU by right-clicking the North America OU and selecting New Organizational Unit:
1. Austin
2. Boston
3. Canada
4. Chicago
5. Corporate
6. Los Angeles
7. Mexico
8. New York
9. San Francisco
7. Create the following OUs under the Asia OU:
1. China
2. India
3. Malaysia
4. Vietnam
8. Create the following OUs under the Europe OU:
1. France
2. Germany
3. Spain
4. UK
9. Create the following OUs under the South America OU:
1. Argentina
2. Brazil
3. Chile
4. Peru
10. Create the following third-level OUs under the India OU by right-clicking India within the Asia OU and selecting New Organizational Unit:
1. Bombay
2. New Delhi
11. Within the North America Corporate OU, create the following OUs:
1. Engineering
2. HR
3. Marketing
4. Research
5. Sales
12. When you have completed creating the OUs, you should have a structure that looks similar to the one in the left pane shown here.
* * *
## Managing OUs
Managing network environments would still be challenging, even if things rarely changed. However, in the real world, business units, departments, and employee roles change frequently. As business and technical needs change, so should the structure of Active Directory.
Fortunately, changing the structure of OUs within a domain is a relatively simple process. In the following sections, you'll look at ways to delegate control of OUs and make other changes.
### Moving, Deleting, and Renaming OUs
The process of moving, deleting, and renaming OUs is a simple one. Exercise 5.2 shows how you can easily modify and reorganize OUs to reflect changes in the business organization. The specific scenario covered in this exercise includes the following changes:
* The Research and Engineering departments have been combined to form a department known as Research and Development (RD).
* The Sales department has been moved from the Corporate headquarters office to the New York office.
* The Marketing department has been moved from the Corporate headquarters office to the Chicago office.
This exercise assumes you have already completed the steps in Exercise 5.1.
* * *
### EXERCISE 5.2: Modifying OU Structure
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers administrative tool.
3. Right-click the Engineering OU (located within North America Corporate) and click Delete. When you are prompted for confirmation, click Yes. Note that if this OU contained objects, they would have all been automatically deleted as well.
4. Right-click the Research OU and select Rename. Type **RD** to change the name of the OU and press Enter.
5. Right-click the Sales OU and select Move. In the Move dialog box, expand the North America branch and click the New York OU. Click OK to move the OU.
6. You will use an alternate method to move the Marketing OU. Drag the Marketing OU and drop it onto the Chicago OU.
7. When you have finished, you should see an OU structure similar to the one shown here. Close the Active Directory Users and Computers administrative tool.
* * *
### Administering Properties of OUs
Although OUs are primarily created for organizational purposes within the Active Directory environment, they have several settings that you can modify. To modify the properties of an OU using the Active Directory Users and Computers administrative tool, right-click the name of any OU and select Properties. When you do, the OU Properties dialog box appears. In the example shown in Figure 5.4, you'll see the options on the General tab.
**FIGURE 5.4** The General tab of the OU's Properties dialog box
In any organization, it helps to know who is responsible for managing an OU. You can set this information on the Managed By tab (see Figure 5.5). The information specified on this tab is convenient because it is automatically pulled from the contact information on a user record. You should consider always having a contact for each OU within your organization so that other system administrators know whom to contact if they need to make any changes.
**FIGURE 5.5** The Managed By tab of the OU's Properties dialog box
### Delegating Control of OUs
In simple environments, one or a few system administrators may be responsible for managing all of the settings within Active Directory. For example, a single system administrator could manage all users within all OUs in the environment. In larger organizations, however, roles and responsibilities may be divided among many different individuals. A typical situation is one in which a system administrator is responsible for objects within only a few OUs in an Active Directory domain. Alternatively, one system administrator might manage User and Group objects while another is responsible for managing file and print services.
Fortunately, using the Active Directory Users and Computers tool, you can quickly and easily ensure that specific users receive only the permissions they need. In Exercise 5.3, you will use the Delegation of Control Wizard to assign permissions to individuals. To complete these steps successfully, first you must have created the objects in the previous exercises of this chapter.
* * *
### EXERCISE 5.3: Using the Delegation of Control Wizard
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers administrative tool.
3. Right-click the Corporate OU within the North America OU and select Delegate Control. This starts the Delegation of Control Wizard. Click Next to begin configuring security settings.
4. In the Users Or Groups page, click the Add button. In the Enter The Object Names To Select field, enter **Account Operators** and click the Check Names button. Click OK. Click Next to continue.
5. In the Tasks To Delegate page, select Delegate The Following Common Tasks and place a check mark next to the following items:
1. Create, Delete, And Manage User Accounts
2. Reset User Passwords And Force Password Change At Next Logon
3. Read All User Information
4. Create, Delete, And Manage Groups
5. Modify The Membership Of A Group
6. Click Next to continue.
7. The Completing The Delegation Of Control Wizard page then provides a summary of the operations you have selected. To implement the changes, click Finish.
* * *
Although the common tasks available through the wizard are sufficient for many delegation operations, you may have cases in which you want more control. For example, you might want to give a particular system administrator permissions to modify only Computer objects. Exercise 5.4 uses the Delegation of Control Wizard to assign more granular permissions. To complete these steps successfully, you must have completed the previous exercises in this chapter.
* * *
### EXERCISE 5.4: Delegating Custom Tasks
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers administrative tool.
3. Right-click the Corporate OU within the North America OU and select Delegate Control. This starts the Delegation of Control Wizard. Click Next to begin making security settings.
4. In the Users Or Groups page, click the Add button. In the Enter The Object Names To Select field, enter **Server Operators** and click the Check Names button. Click OK and then click Next to continue.
5. In the Tasks To Delegate page, select the Create A Custom Task To Delegate radio button and click Next to continue.
6. In the Active Directory Object Type page, choose Only The Following Objects In The Folder and place a check mark next to the following items. (You will have to scroll down to see them all.)
1. User Objects
2. Computer Objects
3. Contact Objects
4. Group Objects
5. Organizational Unit Objects
6. Printer Objects
7. Click Next to continue.
8. In the Permissions page, place a check mark next to the General option and make sure the other options are not checked. Note that if the various objects within your Active Directory schema had property-specific settings, you would see those options here. Place a check mark next to the following items:
1. Create All Child Objects
2. Read All Properties
3. Write All Properties
This gives the members of the Server Operators group the ability to create new objects within the Corporate OU and the permissions to read and write all properties for these objects.
9. Click Next to continue.
10. The Completing The Delegation Of Control Wizard page provides a summary of the operations you have selected. To implement the changes, click Finish.
* * *
* * *
# Delegation: Who's Responsible for What?
You're the IT director for a large, multinational organization. You've been with the company for quite a while, that is, since the environment had only a handful of offices and a few network and system administrators. Times have changed, however. Now system administrators must coordinate the efforts of hundreds of IT staffers in 14 countries.
For years now, a debate has been raging among IT administrators on the question of when to create a new child domain and when to make it just an OU. For example, let's say you have a remote office in Concord, New Hampshire. Do you give the remote office its own domain (as a child domain), or do you just make the Concord office an OU? Well, it really depends on who you want to manage the resources in Concord. Do you want to create domains or OUs based on location?
Fortunately, through the proper use of OUs and delegation, you are given a lot of flexibility in determining how to handle the administration. You can structure the administration in several ways. First, if you choose to create OUs based on a geographic business structure, you could delegate control of these OUs based on the job functions of various system administrators. For example, you could use one user account to administer the Concord OU. Within the Concord OU, this system administrator could delegate control of resources represented by the Printers and Scanners OUs.
Alternatively, the OU structure may create a functional representation of the business. For example, the Engineering OU might contain other OUs that are based on office locations such as New York and Paris. A system administrator of the Engineering domain could delegate permissions based on geography or job functions to the lower OUs. Regardless of whether you build a departmental, functional, or geographical OU model, keep in mind that each model excludes other models. This is one of the most important decisions you need to make. When you are making this decision or modifying previous decisions, your overriding concern is how it will affect the management and administration of the network. The good news is that, because Active Directory has so many features, the model you choose can be based on specific business requirements rather than imposed by architectural constraints.
* * *
## Troubleshooting OUs
In general, you will find using OUs to be a relatively straightforward and painless process. With adequate planning, you'll be able to implement an intuitive and useful structure for OU objects.
The most common problems with OU configuration are related to the OU structure. When troubleshooting OUs, pay careful attention to the following factors:
Inheritance By default, Group Policy and other settings are transferred automatically from parent OUs to child OUs and objects. Even if a specific OU is not given a set of permissions, objects within that OU might still get them from parent objects.
Delegation of Administration If you allow the wrong user accounts or groups to perform specific tasks on OUs, you might be violating your company's security policy. Be sure to verify the delegations you have made at each OU level.
Organizational Issues Sometimes, business practices do not easily map to the structure of Active Directory. A few misplaced OUs, user accounts, computer accounts, or groups can make administration difficult or inaccurate. In many cases, it might be beneficial to rearrange the OU structure to accommodate any changes in the business organization. In others, it might make more sense to change business processes.
If you regularly consider each of these issues when troubleshooting problems with OUs, you will be much less likely to make errors in the Active Directory configuration.
## Creating and Managing Active Directory Objects
Now that you are familiar with the task of creating OUs, you should find creating and managing other Active Directory objects quite simple. The following sections will examine the details.
### Overview of Active Directory Objects
When you install and configure a domain controller, Active Directory sets up an organizational structure for you, and you can create and manage several types of objects.
#### Active Directory Organization
When you are looking at your Active Directory structure, you will see objects that look like folders in Windows Explorer. These objects are containers, or _organizational units (OUs)_. The difference is that an OU is a container to which you can link a GPO. Normal containers cannot have a GPO linked to them. That's what makes an OU a special container.
By default, after you install and configure a domain controller, you will see the following organizational sections within the Active Directory Users and Computers tool (they look like folders):
Built-In The _Built-In container_ includes all of the standard groups that are installed by default when you promote a domain controller. You can use these groups to administer the servers in your environment. Examples include the Administrators group, Backup Operators group, and Print Operators group.
Computers By default, the _Computers container_ contains a list of the workstations in your domain. From here, you can manage all of the computers in your domain.
Domain Controllers The _Domain Controllers OU_ includes a list of all the domain controllers for the domain.
Foreign Security Principals _Foreign security principals_ containers are any objects to which security can be assigned and that are not part of the current domain. _Security principals_ are Active Directory objects to which permissions can be applied, and they can be used to manage permissions in Active Directory.
Managed Service Accounts The _Managed Service Accounts container_ is a new Windows Server 2012 R2 container. Service accounts are accounts created to run specific services such as Exchange and SQL Server. Having a Managed Service Accounts container allows you to control the service accounts better and thus allows for better service account security.
Users The _Users container_ includes all the security accounts that are part of the domain. When you first install the domain controller, there will be several groups in this container. For example, the Domain Admins group and the administrator account are created in this container.
You want to be sure to protect the administrator account. You should rename the admin account and make sure the password is complex. Protected admin accounts can make your network safer. Every hacker knows that there is an administrator account on the server by default. Be sure to make your network safer by protecting the admin account.
#### Active Directory Objects
You can create and manage several different types of Active Directory objects. The following are specific object types:
Computer _Computer objects_ represent workstations that are part of the Active Directory domain. All computers within a domain share the same security database, including user and group information. Computer objects are useful for managing security permissions and enforcing Group Policy restrictions.
Contact _Contact objects_ are usually used in OUs to specify the main administrative contact. Contacts are not security principals like users. They are used to specify information about individuals outside the organization.
Group _Group objects_ are logical collections of users primarily for assigning security permissions to resources. When managing users, you should place them into groups and then assign permissions to the group. This allows for flexible management without the need to set permissions for individual users.
InetOrgPerson The _InetOrgPerson object_ is an Active Directory object that defines attributes of users in Lightweight Directory Access Protocol (LDAP) and X.500 directories.
MSIMaging-PSPs _MSIMaging-PSPs_ is a container for all Enterprise Scan Post Scan Process objects.
MSMQ Queue Alias An _MSMQ Queue Alias object_ is an Active Directory object for the MSMQ-Custom-Recipient class type. The Microsoft Message Queuing (MSMQ) Queue Alias object associates an Active Directory path and a user-defined alias with a public, private, or direct single-element format name. This allows a queue alias to be used to reference a queue that might not be listed in Active Directory Domain Services (AD DS).
Organizational Unit An _OU object_ is created to build a hierarchy within the Active Directory domain. It is the smallest unit that can be used to create administrative groupings, and it can be used to assign group policies. Generally, the OU structure within a domain reflects a company's business organization.
Printer _Printer objects_ map to printers.
Shared Folder _Shared Folder objects_ map to server shares. They are used to organize the various file resources that may be available on file/print servers. Often, Shared Folder objects are used to give logical names to specific file collections. For example, system administrators might create separate shared folders for common applications, user data, and shared public files.
User A _User object_ is the fundamental security principal on which Active Directory is based. User accounts contain information about individuals as well as password and other permission information.
##### Creating Objects Using the Active Directory Users and Computers Tool
Exercise 5.5 walks you through the steps necessary to create various objects within an Active Directory domain. In this exercise, you create some basic Active Directory objects. To complete this exercise, you must have access to at least one Active Directory domain controller, and you should have also completed the previous exercises in this chapter.
* * *
### EXERCISE 5.5: Creating Active Directory Objects
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers tool.
3. Expand the current domain to list the objects currently contained within it. For this exercise, you will use the second- and third-level OUs contained within the North America top-level OU, as shown here.
4. Right-click the Corporate OU and select New User. Fill in the following information:
1. First Name: **Maria**
2. Initial: **D**
3. Last Name: **President**
4. Full Name: (leave as default)
5. User Logon Name: **mdpresident** (leave default domain)
6. Click Next to continue.
5. Enter **P@ssw0rd** for the password for this user and then confirm it. Note that you can also make changes to password settings here. Click Next.
6. You will see a summary of the user information. Click Finish to create the new user.
7. Click the RD container and create another user in that container with the following information:
1. First Name: **John**
2. Initial: **Q**
3. Last Name: **Adams**
4. Full Name: (leave as default)
5. User Logon Name: **jqadams** (leave default domain)
Click Next to continue.
8. Assign the password **P@ssw0rd**. Click Next and then click Finish to create the user.
9. Right-click the RD OU and select New Contact. Use the following information to fill in the properties of the Contact object:
1. First Name: **Jane**
2. Initials: **R**
3. Last Name: **Admin**
4. Display Name: **jradmin**
Click OK to create the new Contact object.
10. Right-click the RD OU and select New Shared Folder. Enter **Software** for the name and **\\\server1\applications** for the network path (also known as the Universal Naming Convention [UNC] path). Note that you can create the object even though this resource (the physical server) does not exist. Click OK to create the Shared Folder object.
11. Right-click the HR OU and select New Group. Type **All Users** for the group name. Do not change the value in the Group Name (Pre–Windows 2000) field. For Group Scope, select Global, and for Group Type, select Security. To create the group, click OK.
12. Right-click the Sales OU and select New Computer. Type **Workstation1** for the name of the computer. Notice that the pre–Windows 2000 name is automatically populated and that, by default, the members of the Domain Admins group are the only ones who can add this computer to the domain. Place a check mark in the Assign This Computer Account As A Pre-Windows 2000 Computer box and then click OK to create the Computer object.
13. Close the Active Directory Users and Computers tool.
* * *
##### Configuring the User Principal Name
When you log into a domain, your logon name looks like an email address (for example, `wpanek@willpanek.com`). This is called your _user principal name (UPN)_. A UPN is the username followed by the @ sign and the domain name. At the time that the user account is created, the UPN suffix is generated by default. The UPN is created as `_userName@DomainName_`, but an administrator can alter or change the default UPN. If your forest has multiple domains and you need to change the UPN to a different domain, you have that ability. To change the UPN suffix, in Active Directory Users and Computers, choose a user and go into their properties. Choose the Attribute Editor tab. Scroll down to the `userPrincipalName` attribute and make your changes. These changes then get replicated to the global catalog.
* * *
If your organization has multiple forests set up by a trust, you can't change the UPN to a domain in the other forest. Global catalogs are used to log on users. Because UPNs get replicated to the local forest global catalog servers, you cannot log onto other forests using the UPN.
* * *
##### Using Templates
Now you are going to dive into user templates. _User templates_ allow an Active Directory administrator to create a default account (for example, template_sales) and use that account to create all of the other users who match it (all the salespeople).
If you are creating multiple accounts, this can save you a lot of time and resources. For example, if you need to add 35 new salespeople to your company, you'll create one template for sales and use a copy of that template for all of the other new accounts. This saves you the trouble of filling out many of the same fields over and over again. When you copy a template, some of the information does _not_ get copied over. This is because it is user-specific information. Here are some of the fields that do not get copied over from a template:
* Name
* Logon Name
* Password
* Email
* Phone Numbers
* Description
* Office
* Web Page
Many of the important fields such as Member Of (groups to which the user belongs), Profile Path, Department, and Company all get copied over. There is one important item that needs to be done when creating a template: the template account needs to be disabled after creation. You do not want anyone using this account to access your network. In Exercise 5.6, you will create a Sales template to use for your Sales department.
* * *
### EXERCISE 5.6: Creating a User Template
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers snap-in.
3. Expand the current domain to list the objects contained within it. For this exercise, you will use the Sales OU. Right-click the Sales OU and choose New User.
4. Use the following properties:
1. First Name: **Sales**
2. Last Name: **Template**
3. Username: **sales_template**
4. Password: **P@ssw0rd**
5. Click Next and then click Finish.
6. In the right window, double-click the Sales Template user to open the properties.
7. On the General tab, complete the following items:
1. Description: **Template Account**
2. Office: **Corporate**
3. Telephone: **999-999-9999**
4. Email: **Salet@abc.com**
5. Web: **www.abc.com**
8. Click the Profile tab. In the Profile Path field, type **\\\ServerA\%username%**.
9. On the Members Of tab, click the Add button. At the Enter The Object Name To Select box, type **Administrator** and click the Check Names button. (Normally you would not add salespeople to the Administrators group, but you are doing so just for this exercise.) Click OK.
10. Click the Account tab. Scroll down in the Account Options box and check the Account Is Disabled check box.
11. Click OK in the user's Properties window to go back to the Sales OU.
12. Right-click the Sales Template account and choose Copy.
13. Enter the following information:
1. First Name: **Jenny**
2. Last Name: **Sales**
3. Username: **jsales**
4. Password: **P@ssw0rd**
Uncheck the Account Is disabled check box.
14. In the right window, double-click the Jenny Sales user to open the properties.
15. Take a look at the Members Of tab, the General tab, and the Profile tab, and you will see that some of the fields are prefilled (including the Administrators group).
16. Close Jenny Sales Properties and exit Active Directory Users and Computers.
* * *
##### Importing Objects from a File
In Exercise 5.5, you created an account using the Active Directory Users and Computers tool. But what if you need to bulk import accounts? There are two main applications for doing bulk imports of accounts: the `ldifde.exe` utility and the `csvde.exe` utility. Both utilities import accounts from files.
The `ldifde` utility imports from line-delimited files. This utility allows an administrator to export and import data, thus allowing batch operations such as Add, Modify, and Delete to be performed in Active Directory. Windows Server 2012 R2 includes `ldifde.exe` to help support batch operations.
The `csvde.exe` utility performs the same export functions as `ldifde.exe`, but `csvde.exe` uses a comma-separated value file format. The `csvde.exe` utility does not allow administrators to modify or delete objects. It only supports adding objects to Active Directory.
##### Active Directory Migration Tool
Another tool that administrators have used in the past is _Active Directory Migration Tool (ADMT)_. ADMT allows an administrator to migrate users, groups, and computers from a previous version of the server to a current version of the server.
Administrators also used the ADMT to migrate users, groups, and computers between Active Directory domains in different forests (interforest migration) and between Active Directory domains in the same forest (intraforest migration).
At the time this book was written, Microsoft had not yet released a new version of ADMT that is supported by Windows Server 2012 R2. The reason I even mention it in this book is because Microsoft may be releasing a version of it soon, and I wanted you to understand what it can do. Continue to check the Microsoft website to see whether a new version has been released.
##### Offline Domain Join of a Computer
_Offline domain join_ gives administrators the ability to preprovision computer accounts in the domain to prepare operating systems for deployments. At startup, computers can then join the domain without the need to contact a domain controller. This helps reduce the time it takes to deploy computers in a datacenter.
Let's say your datacenter needs to have multiple virtual machines deployed. This is where offline domain join can be useful. Upon initial startup after the operating system is installed, offline domain join allows the virtual machines to join the domain automatically. No additional steps or restart are needed.
The following are some of the benefits of using offline domain join:
* There is no additional network traffic for Active Directory state changes.
* There is no additional network traffic for computer state changes to the domain controller.
* Changes for both the Active Directory state and the computer state can be completed at a different times.
### Managing Object Properties
Once you've created the necessary Active Directory objects, you'll probably need to make changes to their default properties. In addition to the settings you made when you were creating Active Directory objects, you can configure several more properties. You can also access object properties by right-clicking any object and selecting Properties from the pop-up menu.
Each object type contains a unique set of properties.
User Object Properties The following list describes some of the properties of a User object:
General General account information about this user
Address Physical location information about this user
Account User logon name and other account restrictions, such as workstation restrictions and logon hours
Profile Information about the user's roaming profile settings
Telephones Telephone contact information for the user
Organization The user's title, department, and company information
Member Of Group membership information for the user
Dial-In Remote Access Service (RAS) permissions for the user
Environment Logon and other network settings for the user
Sessions Session limits, including maximum session time and idle session settings
Remote Control Remote control options for this user's session
Remote Desktop Services Profile Information about the user's profile for use with Remote Desktop Services
Personal Virtual Desktop Allows you to assign a user a specific virtual machine to use as a personal virtual desktop
COM+ Specifies a COM+ partition set for the user
#### Computer Object Properties
Computer objects have different properties than User objects. Computer objects refer to the systems that clients are operating to be part of a domain. The following list describes some Computer object properties:
General Information about the name of the computer, the role of the computer, and its description
(You can enable an option to allow the Local System account of this machine to request services from other servers. This is useful if the machine is a trusted and secure computer.)
Operating System The name, version, and service pack information for the operating system running on the computer
Member Of Active Directory groups of which this Computer object is a member
Delegation Allows you to set services that work on behalf of another user
Location A description of the computer's physical location
Managed By Information about the User or Contact object that is responsible for managing this computer
Dial-In Sets dial-in options for the computer
#### Setting Properties for Active Directory Objects
Now that you have seen the various properties that can be set for the Active Directory objects, let's complete an exercise on how to configure some of these properties. Exercise 5.7 walks you through how to set various properties for Active Directory objects. To complete the steps in this exercise, first you must have completed Exercise 5.5.
* * *
Although it may seem a bit tedious, it's always a good idea to enter as much information as you know about Active Directory objects when you create them. Although the name Printer1 may be meaningful to you, users will appreciate the additional information, such as location, when they are searching for objects.
* * *
* * *
### EXERCISE 5.7: Managing Object Properties
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers tool.
3. Expand the name of the domain and select the RD container. Right-click the John Q. Adams user account and select Properties.
4. Here you will see the various Properties tabs for the User account. Make some configuration changes based on your personal preferences. Click OK to continue.
5. Select the HR OU. Right-click the All Users group and click Properties. In the All Users Properties dialog box, you will be able to modify the membership of the group.
Click the Members tab and then click Add. Add the Maria D. President and John Q. Admin user accounts to the group. Click OK to save the settings and then OK to accept the group modifications.
6. Select the Sales OU. Right-click the Workstation1 Computer object. Notice that you can choose to disable the account or reset it (to allow another computer to join the domain under that same name). From the context menu, choose Properties. You'll see the properties for the Computer object.
Examine the various options and make changes based on your personal preference. After you have examined the available options, click OK to continue.
7. Select the Corporate OU. Right-click the Maria D. President user account and choose Reset Password. You will be prompted to enter a new password, and then you'll be asked to confirm it. Note that you can also force the user to change this password upon the next logon, and you can also unlock the user's account from here. For this exercise, do not enter a new password; just click Cancel.
8. Close the Active Directory Users and Computers tool.
* * *
By now, you have probably noticed that Active Directory objects have a lot of common options. For example, Group and Computer objects both have a Managed By tab.
Windows Server 2012 R2 allows you to manage many User objects at once. For instance, you can select several User objects by holding down the Shift or Ctrl key while selecting. You can then right-click any one of the selected objects and select Properties to display the properties that are available for multiple users. Notice that not every user property is available because some properties are unique to each user. You can configure the Description field for multiple object selections that include both users and nonusers, such as computers and groups.
* * *
An important thing to think about when it comes to accounts is the difference between disabling an account and deleting an account. When you delete an account, the security ID (SID) gets deleted. Even if you later create an account with the same username, it will have a different SID number, and therefore it will be a different account. It is sometimes better to disable an account and place it into a nonactive OU called _Disabled._ This way, if you ever need to reaccess the account, you can do so.
* * *
Another object management task is the process of deprovisioning. _Deprovisioning_ is the management of Active Directory objects in the container. When you remove an object from an Active Directory container, the deprovisioning process removes the object and synchronizes the container to stay current.
### Understanding Groups
Now that you know how to create user accounts, it's time to learn how to create group accounts. As an instructor, I am always amazed when students (who work in the IT field) have no idea why they should use groups. This is something every organization should be using.
To illustrate their usefulness, let's say you have a Sales department user by the name of wpanek. Your organization has 100 resources shared on the network for users to access. Because wpanek is part of the Sales department, he has access to 50 of the resources. The Marketing department uses the other 50. If the organization is not using groups and wpanek moves from Sales to Marketing, how many changes do you have to make? The answer is 100. You have to move him out of the 50 resources he currently can use and place his account into the 50 new resources that he now needs.
Now let's say that you use groups. The Sales group has access to 50 resources, and the Marketing group has access to the other 50. If wpanek moves from Sales to Marketing, you need to make only two changes. You just have to take wpanek out of the Sales group and place him in the Marketing group. Once this is done, wpanek can access everything he needs to do his job.
#### Group Properties
Now that you understand why you should use groups, let's go over setting up groups and their properties. When you are creating groups, it helps to understand some of the options that you need to use.
Group Type You can choose from two group types: security groups and distribution groups.
1. Security Groups These groups can have rights and permissions placed on them. For example, if you want to give a certain group of users access to a particular printer, but you want to control what they are allowed to do with this printer, you'd create a security group and then apply certain rights and permissions to this group.
2. Security groups can also receive emails. If someone sent an email to the group, all users within that group would receive it (as long as they have a mail system that allows for mail-enabled groups, like Exchange).
3. Distribution Groups These groups are used for email _only_ (as long as they have a mail system that allows for mail-enabled groups, like Exchange). You cannot place permissions and rights for objects on this group type.
Group Scope When it comes to group scopes, you have three choices.
1. Domain Local Groups Domain local groups are groups that remain in the domain in which they were created. You use these groups to grant permissions within a single domain. For example, if you create a domain local group named HPLaser, you cannot use that group in any other domain, and it has to reside in the domain in which you created it.
2. Global Group Global groups can contain other groups and accounts from the domain in which the group is created. In addition, you can give them permissions in any domain in the forest.
3. Universal Groups Universal groups can include other groups and accounts from any domain in the domain tree or forest. You can give universal groups permissions in any domain in the domain tree or forest.
#### Creating Group Strategies
When you are creating a group strategy, think of this acronym that Microsoft likes to use in the exam: AGDLP (or AGLP). This acronym stands for a series of actions you should perform. Here is how it expands:
A Accounts (Create your user accounts.)
G Global groups (Put user accounts into global groups.)
DL Domain local groups (Put global groups into domain local groups.)
P Permissions (Assign permissions such as Deny or Apply on the domain local group.)
Another acronym that stands for a strategy you can use is AGUDLP (or AULP). Here is how it expands:
A Accounts (Create your user accounts.)
G Global groups (Put user accounts into global groups.)
U Universal groups (Put the global groups into universal groups.)
DL Domain local groups (Put universal groups into domain local groups.)
P Permissions (Place permissions on the local group.)
#### Creating a Group
To create a new group, open the Active Directory Users and Computers snap-in. Click the OU where the group is going to reside. Right-click and choose New and then Group. After you create the group, just click the Members tab and choose Add. Add the users you want to reside in that group, and that's all there is to it.
### Filtering and Advanced Active Directory Features
The Active Directory Users and Computers tool has a couple of other features that come in quite handy when you are managing many objects. You can access the Filter Options dialog box by clicking the View menu in the MMC and choosing Filter Options. You'll see a dialog box similar to the one shown in Figure 5.6. Here you can choose to filter objects by their specific types within the display. For example, if you are an administrator who works primarily with user accounts and groups, you can select those specific items by placing check marks in the list. In addition, you can create more complex filters by choosing Create Custom. Doing so provides you with an interface that looks similar to that of the Find command.
**FIGURE 5.6** The Filter Options dialog box
Another option in the Active Directory Users and Computers tool is to view advanced options. You can enable the advanced options by choosing Advanced Features in the View menu. This adds some top-level folders to the list under the name of the domain. Let's take a look at a couple of the new top-level folders.
The `System` folder (shown in Figure 5.7) provides additional features that you can configure to work with Active Directory. You can configure settings for the Distributed File System (DFS), IP Security (IPSec) policies, the File Replication Service (FRS), and more. In addition to the `System` folder, you'll see the `LostAndFound` folder. This folder contains any files that may not have been replicated properly between domain controllers. You should check this folder periodically for any files so that you can decide whether you need to move them or copy them to other locations.
**FIGURE 5.7** Advanced Features in the `System` folder of the Active Directory Users and Computers tool
As you can see, managing Active Directory objects is generally a simple task. The Active Directory Users and Computers tool allows you to configure several objects. Let's move on to look at one more common administration function: moving objects.
### Moving, Renaming, and Deleting Active Directory Objects
One of the extremely useful features of the Active Directory Users and Computers tool is its ability to move users and resources easily.
Exercise 5.8 walks you through the process of moving Active Directory objects. In this exercise, you will make several changes to the organization of Active Directory objects. To complete this exercise, first you must have completed Exercise 5.5.
* * *
### EXERCISE 5.8: Moving Active Directory Objects
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers tool and expand the name of the domain.
3. Select the Sales OU (under the New York OU), right-click Workstation1, and select Move. A dialog box appears. Select the RD OU and click OK to move the Computer object to that container.
4. Click the RD OU and verify that Workstation1 was moved.
5. Close the Active Directory Users and Computers tool.
* * *
In addition to moving objects within Active Directory, you can easily rename them by right-clicking an object and selecting Rename. Note that this option does not apply to all objects. You can remove objects from Active Directory by right-clicking them and choosing Delete.
* * *
Deleting an Active Directory object is an irreversible action. When an object is destroyed, any security permissions or other settings made for that object are removed as well. Because each object within Active Directory contains its own security identifier (SID), simply re-creating an object with the same name does not place any permissions on it. Before you delete an Active Directory object, be sure that you will never need it again. Windows Server 2012 R2 has an Active Directory Recycle Bin to allow an administrator to retrieve a deleted object, but in case the Recycle Bin gets cleared, it's better to be safe than sorry. Also, the AD Recycle Bin is disabled by default, so it will be unavailable unless you turn that feature on. So, what is the moral of this story? Don't delete AD objects unless you are absolutely sure you want them gone.
* * *
* * *
Windows Server 2012 R2 has a check box called Protect Container From Accidental Deletion for all OUs. If this check box is checked, to delete or move an OU, you must go into the Active Directory Users and Computers advanced options. Once you are in the advanced options, you can uncheck the box to move or delete the OU.
* * *
### Resetting an Existing Computer Account
Every computer on the domain establishes a discrete channel of communication with the domain controller at logon time. The domain controller stores a randomly selected password (different from the user password) for authentication across the channel. The password is updated every 30 days.
Sometimes the computer's password and the domain controller's password don't match, and communication between the two machines fails. Without the ability to reset the computer account, you wouldn't be able to connect the machine to the domain. Fortunately, you can use the Active Directory Users and Computers tool to reestablish the connection.
Exercise 5.9 shows you how to reset an existing computer account. You should have completed the previous exercises in this chapter before you begin this exercise.
* * *
### EXERCISE 5.9: Resetting an Existing Computer Account
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers tool and expand the name of the domain.
3. Click the RD OU and then right-click the Workstation1 computer account.
4. Select Reset Account from the context menu. Click Yes to confirm your selection. Click OK at the success prompt.
5. When you reset the account, you break the connection between the computer and the domain. So, after performing this exercise, reconnect the computer to the domain if you want it to continue working on the network.
* * *
Throughout this book, I have tried to show you the PowerShell way of doing a task shown previously using an MMC snap-in. Well, this is going to be no different.
This example shows you how to reset the secure connection between the local computer and the domain to which it is joined using a PowerShell command. In this example, the domain controller that performs the operation is specified as `StellaDC1.Stellacon.com`. To execute this PowerShell command, you must run this command on the local computer:
Test-ComputerSecureChannel -Repair -Server StellaDC1.Stellacon.com
## Publishing Active Directory Objects
One of the main goals of Active Directory is to make resources easy to find. Two of the most commonly used resources in a networked environment are server file shares and printers. These are so common, in fact, that most organizations have dedicated file and print servers. When it comes to managing these types of resources, Active Directory makes it easy to determine which files and printers are available to users.
With that being said, take a look at how Active Directory manages to publish shared folders and printers.
### Making Active Directory Objects Available to Users
An important aspect of managing Active Directory objects is that a system administrator can control which objects users can see. The act of making an Active Directory object available is known as _publishing_. The two main types of publishable objects are Printer objects and Shared Folder objects.
The general process for creating server shares and shared printers has remained unchanged from previous versions of Windows: you create the various objects (a printer or a file system folder) and then enable them for sharing. To make these resources available via Active Directory, however, there's an additional step: you must publish the resources. Once an object has been published in Active Directory, clients will be able to use it.
When you publish objects in Active Directory, you should know the server name and share name of the resource. When system administrators use Active Directory objects, they can change the resource to which the object points, without having to reconfigure or even notify clients. For example, if you move a share from one server to another, all you need to do is to update the Shared Folder object's properties to point to the new location. Active Directory clients still refer to the resource with the same path and name that they used before.
### Publishing Printers
Printers can be published easily within Active Directory. This makes them available to users in your domain.
Exercise 5.10 walks you through the steps you need to take to share and publish a Printer object by having you create and share a printer. To complete the printer installation, you need access to the Windows Server 2012 R2 installation media (via the hard disk, a network share, or the CD-ROM drive).
* * *
### EXERCISE 5.10: Creating and Publishing a Printer
1. Click the Windows key on the keyboard and choose Control Panel.
2. Click Devices And Printers Add A Printer. This starts the Add Printer Wizard. Then click the Next button.
3. In the Choose A Local Or Network Printer page, select Add A Local Printer. This should automatically take you to the next page. If it does not, click Next.
4. On the Choose A Printer Port page, select Use An Existing Port. From the drop-down list beside that option, make sure LPT1: (Printer Port) is selected. Click Next.
5. On the Install The Printer Driver page, select Generic for the manufacturer. For the printer, highlight Generic/Text Only. Click Next.
6. On the Type A Printer Name page, type **Text Printer**. Uncheck the Set As The Default Printer box and then click Next.
7. The Installing Printer screen appears. After the system is finished, the Printer Sharing page appears. Make sure the box labeled "Share this printer so that others on your network can find and use it" is selected, and accept the default share name of Text Printer.
8. In the Location section, type **Building 203** , and in the Comment section, add the following comment: **This is a text-only Printer**. Click Next.
9. On the You've Successfully Added Text Printer page, click Finish.
10. Next you need to verify that the printer will be listed in Active Directory. Right-click the Text Printer icon and select Printer Properties.
11. Select the Sharing tab and make sure that the List In The Directory box is checked. Note that you can also add additional printer drivers for other operating systems using this tab. Click OK to accept the settings.
* * *
Note that when you create and share a printer this way, an Active Directory Printer object is not displayed within the Active Directory Users and Computers tool. The printer is actually associated with the Computer object to which it is connected.
### Publishing Shared Folders
Now that you've created and published a printer, you'll see how the same thing can be done to shared folders.
Exercise 5.11 walks through the steps required to create a folder, share it, and then publish it in Active Directory. This exercise assumes you are using the `C:` partition; however, you may want to change this based on your server configuration. This exercise assumes you have completed Exercise 5.5.
* * *
### EXERCISE 5.11: Creating and Publishing a Shared Folder
1. Create a new folder in the root directory of your `C:` partition and name it `Test Share`. To do this, click the File Explorer link on the toolbar.
2. Right-click the `Test Share` folder. Choose Share With Specific People.
3. In the File Sharing dialog box, enter the names of users with whom you want to share this folder. In the upper box, enter **Everyone** and then click Add. Note that Everyone appears in the lower box. Click in the Permission Level column next to Everyone and choose Read/Write from the pop-up menu. Then click Share.
4. You'll see a message that your folder has been shared. Click Done.
5. Click the Windows key on the keyboard and choose Administrative Tools.
6. Open the Active Directory Users and Computers tool. Expand the current domain and right-click the RD OU. Select New Shared Folder.
7. In the New Object - Shared Folder dialog box, type **Shared Folder Test** for the name of the folder. Then type the UNC path to the share (for example, **\\\server1\Test Share** ). Click OK to create the share.
* * *
Once you have created and published the Shared Folder object, clients can use the My Network Places icon to find it. The Shared Folder object will be organized based on the OU in which you created it. When you use publication, you can see how this makes it easy to manage shared folders.
### Querying Active Directory
So far you've created several Active Directory resources. One of the main benefits of having all of your resource information in Active Directory is that you can easily find what you're looking for using the Find dialog box. Recall that I recommended that you always enter as much information as possible when creating Active Directory objects. This is where that extra effort begins to pay off.
Exercise 5.12 walks you through the steps to find specific objects in Active Directory. To complete this exercise, you must have completed Exercise 5.5.
* * *
### EXERCISE 5.12: Finding Objects in Active Directory
1. Click the Windows key on the keyboard and choose Administrative Tools.
2. Open the Active Directory Users and Computers tool.
3. Right-click the name of the domain and select Find.
4. In the Find Users, Contacts, And Groups dialog box, select Users, Contacts, And Groups from the Find drop-down list. For the In setting, choose Entire Directory. This searches the entire Active Directory environment for the criteria you enter.
Note that if this is a production domain and there are many objects, searching the whole directory may be a time-consuming and network-intensive operation.
5. In the Name field, type **admin** and then click Find Now to obtain the results of the search.
6. Now that you have found several results, you can narrow down the list. Click the Advanced tab of the Find Users, Contacts, And Groups dialog box.
In the Field drop-down list, select User Last Name. For Condition, select Starts With, and for Value, type **admin**. Click Add to add this condition to the search criteria. Click Find Now. Now only the users that have the last name Admin are shown.
7. When you have finished searching, close the Find Users, Contacts, And Groups dialog box and exit the Active Directory Users and Computers tool.
* * *
Using the many options available in the Find dialog box, you can usually narrow down the objects for which you are searching quickly and efficiently. Users and system administrators alike find this tool useful in environments of any size. Now that you have seen how to create objects in Active Directory, let's take a look at a new Windows Server 2012 R2 feature called Active Directory Administrative Center.
### Using the Active Directory Administrative Center
Windows Server 2012 R2 has a feature called the _Active Directory Administrative Center_ (see Figure 5.8). This feature allows you to manage many Active Directory tasks from one central location (see Figure 5.9).
**FIGURE 5.8** Active Directory Administrative Center
**FIGURE 5.9** Administrative Center Overview screen
Using the Active Directory Administrative Center, here are some of the tasks that an administrator can perform:
* Reset passwords
* Create new objects
* Delete objects
* Move objects
* Perform global searches
* Configure properties for Active Directory objects
In Windows Server 2012 R2, the Active Directory Administrative Center is just another tool in your Active Directory tool belt. It does not matter which way you create your Active Directory objects as long as you have a good understanding of how to create them.
## Using the Command Prompt for Active Directory Configuration
Many IT administrators like to use command-line commands to configure and maintain their Active Directory environment. One advantage of using command-line commands is the ability to do multiple changes at once using batch files.
Another advantage of knowing how to manipulate Active Directory using the command prompt is working with Windows Server 2012 R2 Server Core. Server Core is an installation of Windows Server 2012 R2 that has no GUI windows. One of the ways to configure Server Core is to use commands in the command prompt window.
Table 5.1 shows you many of the command prompt commands and explains how each command affects Active Directory.
**TABLE 5.1** Command prompt commands
Command | Explanation
---|---
`Csvde` | This command allows you to import and export data from Active Directory. The data gets stored in a comma-separated value (CSV) format.
`Dcdiag` | This troubleshooting command checks the state of your domain controllers in your forest and sends back a report of any problems.
`Djoin` | This command allows a computer account to join a domain, and it runs an offline domain join when a computer restarts.
`Dsacls` | This command allows you to see and change permissions in the access control list for objects in Active Directory Domain Services (AD DS).
`Dsadd` | This command allows you to add an object to the AD DS directory.
`Dsamain` | This command shows the Active Directory data stored in either a snapshot or a backup as if it were in a Lightweight Directory Access Protocol (LDAP) server.
`Dsdbutil` | This command provides database utilities for Active Directory Lightweight Directory Services (AD LDS).
`Dsget` | This command shows the properties of an object in the AD DS directory.
`Dsmgmt` | This command gives an administrator management utilities for AD LDS.
`Dsmod` | This command allows you to modify an AD DS object.
`Dsmove` | This command allows you to move an object in an Active Directory domain from its current OU to a new OU within the same forest.
`Dsquery` | This command allows you to query AD DS.
`Dsrm` | This command removes an object from the AD DS directory.
`Ldifde` | This command allows you to import and export data from Active Directory. The data is stored as LDAP Data Interchange Format (LDIF).
`Ntdsutil` | This is one of the most important commands for Active Directory. It allows you to do maintenance on the Active Directory database.
`Repadmin` | This command allows administrators to diagnose Active Directory replication problems between domain controllers.
## Summary
This chapter covered the fundamentals of administering Active Directory. The most important part of administering Active Directory is learning about how to work with OUs. Therefore, you should be aware of the purpose of OUs; that is, they help you to organize and manage the directory. For instance, think of administrative control. If you wanted to delegate rights to another administrator (such as a sales manager), you could delegate that authority to that user within the Sales OU. As the system administrator, you would retain the rights to the castle.
You also looked at how to design an OU structure from an example. The example showed you how to design a proper OU layout. You can also create, organize, and reorganize OUs if need be.
In addition, you took a look at groups and group strategies. There are different types of groups (domain local, global, and universal groups), and you should know when each group is available and when to use each group.
Finally, this chapter covered how to use the Active Directory Users and Computers tool to manage Active Directory objects. If you're responsible for day-to-day system administration, there's a good chance that you are already familiar with this tool; if not, you should be after reading this chapter. Using this tool, you learned how to work with Active Directory objects such as User, Computer, and Group objects. You also learned how to import users by doing a bulk import, and you studied the two different file types that work for bulk imports. Bulk imports allow you to import multiple users without the need to add one user at a time.
## Exam Essentials
Understand the purpose of OUs. OUs are used to create a hierarchical, logical organization for objects within an Active Directory domain.
Know the types of objects that can reside within OUs. OUs can contain Active Directory User, Computer, Shared Folder, and other objects.
Understand how to use the Delegation of Control Wizard. The Delegation of Control Wizard is used to assign specific permissions at the level of OUs.
Understand the concept of inheritance. By default, child OUs inherit permissions and Group Policy assignments set for parent OUs. However, these settings can be overridden for more granular control of security.
Know groups and group strategies. You can use three groups in Native mode: domain local, global, and universal. Understand the group strategies and when they apply.
Understand how Active Directory objects work. Active Directory objects represent some piece of information about components within a domain. The objects themselves have attributes that describe details about them.
Understand how Active Directory objects can be organized. By using the Active Directory Users and Computers tool, you can create, move, rename, and delete various objects.
Understand how to import bulk users. You can import multiple accounts by doing a bulk import. Bulk imports use files to import the data into Active Directory. Know the two utilities (`ldifde.exe` and `csvde.exe`) you need to perform the bulk imports and how to use them.
Learn how resources can be published. A design goal for Active Directory was to make network resources easier for users to find. With that in mind, you should understand how using published printers and shared folders can simplify network resource management.
## Review Questions
1. You are the administrator of an organization with a single Active Directory domain. A user who left the company returns after 16 weeks. The user tries to log onto their old computer and receives an error stating that authentication has failed. The user's account has been enabled. You need to ensure that the user is able to log onto the domain using that computer. What do you do?
1. Reset the computer account in Active Directory. Disjoin the computer from the domain and then rejoin the computer to the domain.
2. Run the `ADadd` command to rejoin the computer account.
3. Run the MMC utility on the user's computer, and add the Domain Computers snap-in.
4. Re-create the user account and reconnect the user account to the computer account.
2. You are the administrator of an organization with a single Active Directory domain. One of your senior executives tries to log onto a machine and receives the error "This user account has expired. Ask your administrator to reactivate your account." You need to make sure that this doesn't happen again to this user. What do you do?
1. Configure the domain policy to disable account lockouts.
2. Configure the password policy to extend the maximum password age to 0.
3. Modify the user's properties to set the Account Never Expires setting.
4. Modify the user's properties to extend the maximum password age to 0.
3. You need to create a new user account using the command prompt. Which command would you use?
1. `dsmodify`
2. `dscreate`
3. `dsnew`
4. `dsadd`
4. Maria is a user who belongs to the Sales distribution global group. She is not able to access the laser printer that is shared on the network. The Sales global group has full access to the laser printer. How do you fix the problem?
1. Change the group type to a security group.
2. Add the Sales global group to the Administrators group.
3. Add the Sales global group to the Printer Operators group.
4. Change the Sales group to a local group.
5. You are a domain administrator for a large domain. Recently, you have been asked to make changes to some of the permissions related to OUs within the domain. To restrict security for the Texas OU further, you remove some permissions at that level. Later, a junior system administrator mentions that she is no longer able to make changes to objects within the Austin OU (which is located within the Texas OU). Assuming that no other changes have been made to Active Directory permissions, which of the following characteristics of OUs might have caused the change in permissions?
1. Inheritance
2. Group Policy
3. Delegation
4. Object properties
6. Isabel, a system administrator, created a new Active Directory domain in an environment that already contains two trees. During the promotion of the domain controller, she chose to create a new Active Directory forest. Isabel is a member of the Enterprise Administrators group and has full permissions over all domains. During the organization's migration to Active Directory, many updates were made to the information stored within the domains. Recently, users and other system administrators have complained about not being able to find specific Active Directory objects in one or more domains (although the objects exist in others). To investigate the problem, Isabel wants to check for any objects that have not been properly replicated among domain controllers. If possible, she would like to restore these objects to their proper place within the relevant Active Directory domains.
Which two of the following actions should she perform to be able to view the relevant information? (Choose two.)
1. Change Active Directory permissions to allow object information to be viewed in all domains.
2. Select the Advanced Features item in the View menu.
3. Promote a member server in each domain to a domain controller.
4. Rebuild all domain controllers from the latest backups.
5. Examine the contents of the `LostAndFound` folder using the Active Directory Users and Computers tool.
7. You are a consultant hired to evaluate an organization's Active Directory domain. The domain contains more than 200,000 objects and hundreds of OUs. You begin examining the objects within the domain, but you find that the loading of the contents of specific OUs takes a long time. Furthermore, the list of objects can be large. You want to do the following:
* Use the built-in Active Directory administrative tools and avoid the use of third-party tools or utilities.
* Limit the list of objects within an OU to only the type of objects that you're examining (for example, only Computer objects).
* Prevent any changes to the Active Directory domain or any of the objects within it.
Which one of the following actions meets these requirements?
1. Use the Filter option in the Active Directory Users and Computers tool to restrict the display of objects.
2. Use the Delegation of Control Wizard to give yourself permissions over only a certain type of object.
3. Implement a new naming convention for objects within an OU and then sort the results using this new naming convention.
4. Use the Active Directory Domains and Trusts tool to view information from only selected domain controllers.
5. Edit the domain Group Policy settings to allow yourself to view only the objects of interest.
8. You are the administrator for a small organization with four servers. You have one file server named Paniva that runs Windows Server 2012 R2. You have a junior administrator who needs to do backups on this server. You need to ensure that the junior admin can use Windows Server Backup to create a complete backup of Paniva. What should you configure to allow the junior admin to do the backups?
1. The local groups by using Computer Management
2. A task by using Authorization Manager
3. The User Rights Assignment by using the Local Group Policy Editor
4. The Role Assignment by using Authorization Manager
9. Miguel is a junior-level system administrator, and he has basic knowledge about working with Active Directory. As his supervisor, you have asked Miguel to make several security-related changes to OUs within the company's Active Directory domain. You instruct Miguel to use the basic functionality provided in the Delegation of Control Wizard. Which of the following operations are represented as common tasks within the Delegation of Control Wizard? (Choose all that apply.)
1. Reset passwords on user accounts.
2. Manage Group Policy links.
3. Modify the membership of a group.
4. Create, delete, and manage groups.
10. You are the primary system administrator for a large Active Directory domain. Recently, you have hired another system administrator upon whom you intend to offload some of your responsibilities. This system administrator will be responsible for handling help desk calls and for basic user account management. You want to allow the new employee to have permissions to reset passwords for all users within a specific OU. However, for security reasons, it's important that the user not be able to make permissions changes for objects within other OUs in the domain. Which of the following is the best way to do this?
1. Create a special administration account within the OU and grant it full permissions for all objects within Active Directory.
2. Move the user's login account into the OU that the new employee is to administer.
3. Move the user's login account to an OU that contains the OU (that is, the parent OU of the one that the new employee is to administer).
4. Use the Delegation of Control Wizard to assign the necessary permissions on the OU that the new employee is to administer.
# Chapter 6
Manage GPOs
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Create Group Policy Objects (GPOs)**
* Configure a Central Store
* Manage starter GPOs
* Configure GPO links
* Configure multiple local group policies
* Configure security filtering
2. **Configure application restriction policies**
* Configure rule enforcement
* Configure applocker rules
* Configure Software Restriction Policies
For many years, making changes to computer or user environments was a time-consuming process. If you wanted to install a service pack or a piece of software, unless you had a third-party utility, you had to use the _sneakernet_ (that is, you had to walk from one computer to another with a disk containing the software).
Installing any type of software or companywide security change was one of the biggest challenges faced by system administrators. It was difficult enough just to deploy and manage workstations throughout the environment. Combine this with the fact that users were generally able to make system configuration changes to their own machines, it quickly became a management nightmare!
For example, imagine that a user noticed that they did not have enough disk space to copy a large file. Instead of seeking assistance from the IT help desk, they may have decided to do a little cleanup on their own. Unfortunately, this cleanup operation may have resulted in deleting critical system files! Or, consider the case of users who changed system settings "just to see what they did." Relatively minor changes, such as modifying TCP/IP bindings or Desktop settings, could cause hours of support headaches. Now multiply these (or other common) problems by hundreds (or even thousands) of end users. Clearly, system administrators needed to have a secure way to limit the options available to users of client operating systems.
How do you prevent problems such as these from occurring in a Windows Server 2012 R2 environment? Fortunately, there's a readily available solution delivered with the base operating system that's easy to implement. Two of the most important system administration features in Windows Server 2012 R2 and Active Directory are _Group Policy_ and _Security Policy_. By using _Group Policy objects (GPOs)_ , administrators can quickly and easily define restrictions on common actions and then apply them at the site, domain, or organizational unit (OU) level. In this chapter, you will see how group and security policies work, and then you will look at how to implement them within an Active Directory environment.
## Introducing Group Policy
One of the strengths of Windows-based operating systems is their flexibility. End users and system administrators can configure many different options to suit the network environment and their personal tastes. However, this flexibility comes at a price—generally, end users on a network should not change many of these options. For example, TCP/IP configuration and security policies should remain consistent for all client computers. In fact, end users really don't need to be able to change these types of settings in the first place because many of them do not understand the purpose of these settings.
Windows Server 2012 R2 _group policies_ are designed to provide system administrators with the ability to customize end-user settings and to place restrictions on the types of actions that users can perform. Group policies can be easily created by system administrators and then later applied to one or more users or computers within the environment. Although they ultimately do affect registry settings, it is much easier to configure and apply settings through the use of Group Policy than it is to make changes to the registry manually. To make management easy, Microsoft has set up Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 so that Group Policy settings are all managed from within the Microsoft Management Console (MMC) in the Group Policy Management Console (GPMC).
Group policies have several potential uses. I'll cover the use of group policies for software deployment, and I'll also focus on the technical background of group policies and how they apply to general configuration management.
Let's begin by looking at how group policies function.
### Understanding Group Policy Settings
Group Policy settings are based on _Group Policy administrative templates_. These templates provide a list of user-friendly configuration options and specify the system settings to which they apply. For example, an option for a user or computer that reads Require A Specific Desktop Wallpaper Setting would map to a key in the registry that maintains this value. When the option is set, the appropriate change is made in the registry of the affected users and computers.
By default, Windows Server 2012 R2 comes with several administrative template files that you can use to manage common settings. Additionally, system administrators and application developers can create their own administrative template files to set options for specific functionality.
Most Group Policy items have three different settings options:
Enabled Specifies that a setting for this GPO has been configured. Some settings require values or options to be set.
Disabled Specifies that this option is disabled for client computers. Note that disabling an option _is_ a setting. That is, it specifies that the system administrator wants to disallow certain functionality.
Not Configured Specifies that these settings have been neither enabled nor disabled. Not Configured is the default option for most settings. It simply states that this group policy will not specify an option and that other policy settings may take precedence.
The specific options available (and their effects) will depend on the setting. Often, you will need additional information. For example, when setting the Account Lockout policy, you must specify how many bad login attempts may be made before the account is locked out. With this in mind, let's look at the types of user and computer settings that can be managed.
Group Policy settings can apply to two types of Active Directory objects: User objects and Computer objects. Because both users and computers can be placed into groups and organized within OUs, this type of configuration simplifies the management of hundreds, or even thousands, of computers.
The main options you can configure within user and computer group policies are as follows:
Software Settings The _Software Settings_ options apply to specific applications and software that might be installed on the computer. System administrators can use these settings to make new applications available to end users and to control the default configuration for these applications.
Windows Settings The _Windows Settings_ options allow system administrators to customize the behavior of the Windows operating system. The specific options that are available here are divided into two types: user and computer. User-specific settings let you configure Internet Explorer (including the default home page and other settings). Computer settings include security options, such as Account Policy and Event Log options.
Administrative Templates _Administrative templates_ are used to configure user and computer settings further. In addition to the default options available, system administrators can create their own administrative templates with custom options.
Group Policy Preferences The Windows Server 2012 R2 operating system includes _Group Policy preferences (GPPs)_ , which give you more than 20 new Group Policy extensions. These extensions, in turn, give you a vast range of configurable settings within a Group Policy object. Included in the new Group Policy preference extensions are settings for folder options, mapped drives, printers, the registry, local users and groups, scheduled tasks, services, and the Start menu.
Besides providing easier management, Group Policy preferences give an administrator the ability to deploy settings for client computers without restricting the users from changing the settings. This gives an administrator the flexibility needed to decide which settings to enforce and which not to enforce.
Figure 6.1 shows some of the options you can configure with Group Policy.
**FIGURE 6.1** Group Policy configuration options
ADMX Central Store Another consideration in GPO settings is whether to set up an _ADMX Central Store_. GPO administrative template files are saved as ADMX (`.admx`) files and AMXL (`.amxl`) for the supported languages. To get the most benefit out of using administrative templates, you should create an ADMX Central Store.
You create the Central Store in the `SYSVOL` folder on a domain controller. The Central Store is a repository for all of your administrative templates, and the Group Policy tools check it. The Group Policy tools then use any ADMX files that they find in the Central Store. These files then replicate to all domain controllers in the domain.
If you want your clients to be able to edit domain-based GPOs by using the ADMX files that are stored in the ADMX Central Store, you must be using Windows Vista, Windows 7, Windows 8, Server 2008, Server 2008 R2, Server 2012, or Server 2012 R2.
Security Template _Security templates_ are used to configure security settings through a GPO. Some of the security settings that can be configured are settings for account policies, local policies, event logs, restricted groups, system services, and the registry.
Starter GPOs _Starter Group Policy objects_ give administrators the ability to store a collection of administrative template policy settings in a single object. Administrators then have the ability to import and export starter GPOs to distribute the GPOs easily to other environments. When a GPO is created from a starter GPO, as with any template, the new GPO receives the settings and values that were defined from the administrative template policy in the starter GPO.
* * *
Group Policy settings do not take effect immediately. You must run the `gpupdate` command at the command prompt or wait for the regular update cycle in order for the policy changes to take effect.
* * *
### The Security Settings Section of the GPO
One of the most important sections of a GPO is the Security Settings section. The Security Settings section, under the Windows Settings section, allows an administrator to secure many aspects of the computer and user policies. The following are some of the configurable options for the Security Settings section:
**Computer Section Only of the GPO**
* Account Policies
* Local Policies
* Event Policies
* Restricted Groups
* System Services
* Registry
* File System
* Wired Network
* Windows Firewall with Advanced Security
* Network List Manager Policies
* Wireless Networks
* Network Access Protection
* Application Control Policies
* IP Security Policies
* Advanced Audit Policy Configuration
**Computer and User Sections of the GPO**
* Public Key Policies
* Software Restriction Policy
#### Restricted Groups
The _Restricted Groups_ settings allow you to control group membership by using a GPO. The group membership I am referring to is the normal Active Directory groups (domain local, global, and universal). The settings offer two configurable properties: Members and Members Of.
The users on the Members list do not belong to the restricted group. The users on the Members Of list do belong to the restricted group. When you configure a Restricted Group policy, members of the restricted group that are not on the Members list are removed. Users who are on the Members list who are not currently a member of the restricted group are added.
#### Software Restriction Policy
_Software restriction policies_ allow administrators to identify software and to control its ability to run on the user's local computer, organizational unit, domain, or site. This prevents users from installing unauthorized software. Software Restriction Policy is discussed in greater detail in this chapter in the "Implementing Software Deployment" section.
### Group Policy Objects
So far, I have discussed what group policies are designed to do. Now it's time to drill down to determine exactly how you can set up and configure them.
To make them easier to manage, group policies may be placed in items called _Group Policy objects (GPOs)_. GPOs act as containers for the settings made within Group Policy files, which simplifies the management of settings. For example, as a system administrator, you might have different policies for users and computers in different departments. Based on these requirements, you could create a GPO for members of the Sales department and another for members of the Engineering department. Then you could apply the GPOs to the OU for each department. Another important concept you need to understand is that Group Policy settings are hierarchical; that is, system administrators can apply Group Policy settings at four different levels. These levels determine the GPO processing priority.
Local Every Windows operating system computer has one Group Policy object that is stored locally. This GPO functions for both the computer and user Group Policy processing.
Sites At the highest level, system administrators can configure GPOs to apply to entire sites within an Active Directory environment. These settings apply to all of the domains and servers that are part of a site. Group Policy settings managed at the site level may apply to more than one domain within the same forest. Therefore, they are useful when you want to make settings that apply to all of the domains within an Active Directory tree or forest.
Domains Domains are the third level to which system administrators can assign GPOs. GPO settings placed at the domain level will apply to all of the User and Computer objects within the domain. Usually, system administrators make master settings at the domain level.
Organizational Units The most granular level of settings for GPOs is the OU level. By configuring Group Policy options for OUs, system administrators can take advantage of the hierarchical structure of Active Directory. If the OU structure is planned well, you will find it easy to make logical GPO assignments for various business units at the OU level.
Based on the business need and the organization of the Active Directory environment, system administrators might decide to set up Group Policy settings at any of these four levels. Because the settings are cumulative by default, a User object might receive policy settings from the site level, from the domain level, and from the OUs in which it is contained.
* * *
You can also apply Group Policy settings to the local computer (in which case Active Directory is not used at all), but this limits the manageability of the Group Policy settings.
* * *
### Group Policy Inheritance
In most cases, Group Policy settings are cumulative. For example, a GPO at the domain level might specify that all users within the domain must change their password every 60 days, and a GPO at the OU level might specify the default desktop background for all users and computers within that OU. In this case, both settings apply, so users within the OU are forced to change their password every 60 days and have the default Desktop setting.
What happens if there's a conflict in the settings? For example, suppose you create a scenario where a GPO at the site level specifies that users are to use red wallpaper and another GPO at the OU level specifies that they must use green wallpaper. The users at the OU layer would have green wallpaper by default. Although hypothetical, this raises an important point about _inheritance_. By default, the settings at the most specific level (in this case, the OU that contains the User object) override those at more general levels. As a friend of mine from Microsoft always says, "Last one to apply wins."
Although the default behavior is for settings to be cumulative and inherited, system administrators can modify this behavior. They can set two main options at the various levels to which GPOs might apply.
Block Policy Inheritance The _Block Policy Inheritance_ option specifies that Group Policy settings for an object are not inherited from its parents. You might use this, for example, when a child OU requires completely different settings from a parent OU. Note, however, that you should manage blocking policy inheritance carefully because this option allows other system administrators to override the settings made at higher levels.
Force Policy Inheritance The _Enforced option_ (sometimes referred as _No Override_ ) can be placed on a parent object, and it ensures that all lower-level objects inherit these settings. In some cases, system administrators want to ensure that Group Policy inheritance is not blocked at other levels. For example, suppose it is corporate policy that all network accounts are locked out after five incorrect password attempts. In this case, you would not want lower-level system administrators to override the option with other settings.
System administrators generally use this option when they want to enforce a specific setting globally. For example, if a password expiration policy should apply to all users and computers within a domain, a GPO with the _Force Policy Inheritance_ option enabled could be created at the domain level.
You must consider one final case: If a conflict exists between the computer and user settings, the user settings take effect. If, for instance, a system administrator applies a default desktop setting for the Computer policy and a different default desktop setting for the User policy, the one they specify in the User policy takes effect. This is because the user settings are more specific, and they allow system administrators to make changes for individual users regardless of the computer they're using.
## Planning a Group Policy Strategy
Through the use of Group Policy settings, system administrators can control many different aspects of their network environment. As you'll see throughout this chapter, system administrators can use GPOs to configure user settings and computer configurations. Windows Server 2012 R2 includes many different administrative tools for performing these tasks. However, it's important to keep in mind that, as with many aspects of using Active Directory, a successful Group Policy strategy involves planning.
Because there are thousands of possible Group Policy settings and many different ways to implement them, you should start by determining the business and technical needs of your organization. For example, you should first group your users based on their work functions. You might find, for example, that users in remote branch offices require particular network configuration options. In that case, you might implement Group Policy settings best at the site level. In another instance, you might find that certain departments have varying requirements for disk quota settings. In this case, it would probably make the most sense to apply GPOs to the appropriate department OUs within the domain.
The overall goal should be to reduce complexity (for example, by reducing the overall number of GPOs and GPO links) while still meeting the needs of your users. By taking into account the various needs of your users and the parts of your organization, you can often determine a logical and efficient method of creating and applying GPOs. Although it's rare that you'll come across a right or wrong method of implementing Group Policy settings, you will usually encounter some that are either better or worse than others.
By implementing a logical and consistent set of policies, you'll also be well prepared to troubleshoot any problems that might come up or to adapt to your organization's changing requirements. Later in this chapter, you'll learn about some specific methods for determining effective Group Policy settings before you apply them.
## Implementing Group Policy
Now that I've covered the basic layout and structure of group policies and how they work, let's look at how you can implement them in an Active Directory environment. In the following sections, you'll start by creating GPOs. Then you'll apply these GPOs to specific Active Directory objects, and you'll take a look at how to use administrative templates.
### Creating GPOs
In Windows Server 2000 and Windows Server 2003, you could create GPOs from many different locations. For example, you could use Active Directory Users and Computers to create GPOs on your OUs along with other GPO tools. In Windows Server 2012 R2, things are simpler. You can create GPOs for OUs in only one location: the Group Policy Management Console (GPMC). You have your choice of three applications for setting up policies on your Windows Server 2012 R2 computers.
Local Computer Policy Tool This administrative tool allows you to quickly access the Group Policy settings that are available for the local computer. These options apply to the local machine and to users who access it. You must be a member of the local Administrators group to access and make changes to these settings.
Administrators may need the ability to work on multiple local group policy objects (MLGPOs) at the same time. To do this, you would complete the following steps. (You can't configure MLGPOs on domain controllers.)
1. Open the MMC by typing **MMC** in the Run command box.
2. Click File and then click Add/Remove Snap-in.
3. From the available snap-ins list, choose Group Policy Object Editor and click Add.
4. In the Select Group Policy Object dialog box, click the Browse button.
5. Click the Users tab in the Browse For The Group Policy Object dialog box.
6. Click the user or group for which you want to create or edit a local Group Policy and click OK.
7. Click Finish and then click OK.
8. Configure the multiple policy settings.
Group Policy Management Console You must use the GPMC to manage Group Policy deployment. The GPMC provides a single solution for managing all Group Policy–related tasks, and it is also best suited to handle enterprise-level tasks, such as forest-related work.
The GPMC allows administrators to manage Group Policy and GPOs all from one easy-to-use console whether their enterprise solution spans multiple domains and sites within one or more forests or is local to one site. The GPMC adds flexibility, manageability, and functionality. Using this console, you can also perform other functions, such as backup and restore, importing, and copying.
`Auditpol.exe` `Auditpol.exe` is a command-line utility that works with Windows Vista, Windows 7, Windows 8, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2. An administrator has the ability to display information about policies and also to perform some functions to manipulate audit policies. Table 6.1 shows some of the switches available for `auditpol.exe`.
**TABLE 6.1** `Auditpol.exe` switches
Switch | Description
---|---
`/?` | This is the `Auditpol.exe` help command.
`/get` | This allows you to display the current audit policy.
`/set` | This allows you to set a policy.
`/list` | This displays selectable policy elements.
`/backup` | This allows you to save the audit policy to a file.
`/restore` | This restores a policy from previous backup.
`/clear` | This clears the audit policy.
`/remove` | This removes all per-user audit policy settings and disables all system audit policy settings.
`/ResourceSACL` | This configures the Global Resource SACL.
* * *
You should be careful when making Group Policy settings because certain options might prevent the proper use of systems on your network. Always test Group Policy settings on a small group of users before you deploy them throughout your organization. You'll probably find that some settings need to be changed to be effective.
* * *
Exercise 6.1 walks you through the process of installing the Group Policy Management MMC snap-in for editing Group Policy settings and creating a GPO.
* * *
### EXERCISE 6.1:Creating a Group Policy Object Using the GPMC
1. Click the Windows button and choose Administrative Tools Group Policy Management. The Group Policy Management tool opens.
2. Expand the Forest, Domains, your domain name, and North America containers. Right-click the Corporate OU and then choose Create A GPO In This Domain, And Link It Here.
3. When the New GPO dialog box appears, type **Warning Box** in the Name field. Click OK.
4. The New GPO will be listed on the right side of the Group Policy Management window. Right-click the GPO and choose Edit.
5. In the Group Policy Management Editor, expand the following: Computer Configuration Policies Windows Settings Security Settings Local Policies Security Options. On the right side, scroll down and double-click Interactive Logon: Message Text For Users Attempting To Log On.
6. Click the box Define This Policy Setting In The Template. In the text box, type **Unauthorized use of this machine is prohibited** and then click OK. Close the GPO and return to the GPMC main screen.
7. Under the domain name (in the GPMC), right-click Group Policy Objects and choose New.
8. When the New GPO dialog box appears, type **Unlinked Test GPO** in the Name field. Click OK.
9. On the right side, the new GPO will appear. Right-click Unlinked Test GPO and choose Edit.
10. Under the User Configuration section, click Policies Administrative Templates Desktop. On the right side, double-click Hide And Disable All Items On The Desktop and then click Enabled. Click OK and then close the GPMC.
* * *
* * *
Note that Group Policy changes may not take effect until the next user logs in (some settings may even require that the machine be rebooted). That is, users who are currently working on the system will not see the effects of the changes until they log off and log in again. GPOs are reapplied every 90 minutes with a 30-minute offset. In other words, users who are logged in will have their policies reapplied every 60 to 120 minutes. Not all settings are reapplied (for example, software settings and password policies).
* * *
### Linking Existing GPOs to Active Directory
Creating a GPO is the first step in assigning group policies. The second step is to link the GPO to a specific Active Directory object. As mentioned earlier in this chapter, GPOs can be linked to sites, domains, and OUs.
Exercise 6.2 walks you through the steps that you must take to assign an existing GPO to an OU within the local domain. In this exercise, you will link the Test Domain Policy GPO to an OU. To complete the steps in this exercise, you must have completed Exercise 6.1.
* * *
### EXERCISE 6.2: Linking Existing GPOs to Active Directory
1. Open the Group Policy Management Console.
2. Expand the Forest and Domain containers and right-click the Africa OU.
3. Choose Link An Existing GPO.
4. The Select GPO dialog box appears. Click Unlinked Test GPO and click OK.
5. Close the Group Policy Management Console.
* * *
Note that the GPMC tool offers a lot of flexibility in assigning GPOs. You can create new GPOs, add multiple GPOs, edit them directly, change priority settings, remove links, and delete GPOs all from within this interface. In general, creating new GPOs using the GPMC tool is the quickest and easiest way to create the settings you need.
To test the Group Policy settings, you can simply create a user account within the Africa OU that you used in Exercise 6.2. Then, using another computer that is a member of the same domain, you can log on as the newly created user.
## Managing Group Policy
Now that you have implemented GPOs and applied them to sites, domains, and OUs within Active Directory, it's time to look at some ways to manage them. In the following sections, you'll look at how multiple GPOs can interact with one another and ways that you can provide security for GPO management. Using these features is an important part of working with Active Directory, and if you properly plan Group Policy, you can greatly reduce the time the help desk spends troubleshooting common problems.
### Managing GPOs
One of the benefits of GPOs is that they're modular and can apply to many different objects and levels within Active Directory. This can also be one of the drawbacks of GPOs if they're not managed properly. A common administrative function related to using GPOs is finding all of the Active Directory links for each of these objects. You can do this when you are viewing the Linked Group Policy Objects tab of the site, domain, or OU in the GPMC (shown in Figure 6.2).
**FIGURE 6.2** Viewing GPO links to an Active Directory OU
In addition to the common action of delegating permissions on OUs, you can set permissions regarding the modification of GPOs. The best way to accomplish this is to add users to the Group Policy Creator/Owners built-in security group. The members of this group are able to modify security policy. You saw how to add users to groups back in Chapter 5, "Administer Active Directory."
#### Windows Management Instrumentation
_Windows Management Instrumentation (WMI)_ scripts are used to gather information or to help GPOs deploy better. The best way to explain this is to give an example. Let's say you wanted to deploy Microsoft Office 2013 to everyone in the company. You would first set up a GPO to deploy the Office package (explained later in the section "Deploying Software Through a GPO").
You can then place a WMI script on the GPO stating that only computers with 10GB of hard disk space actually deploy Office. Now if a computer has 10GB of free space, the Office GPO would get installed. If the computer does not have the 10GB of hard disk space, the GPO will not deploy. You can use WMI scripts to check for computer information such as MAC addresses. WMI is a powerful tool because if you know how to write scripts, the possibilities are endless. The following script is a sample of a WMI that is checking for at least 10GB of free space on the `C:` partition/volume:
Select ∗ from Win32_LogicalDisk where FreeSpace > 10737418240 AND Caption = "C:"
### Security Filtering of a Group Policy
Another method of securing access to GPOs is to set permissions on the GPOs themselves. You can do this by opening the GPMC, selecting the GPO, and clicking the Advanced button in the Delegation tab. The Unlinked Test GPO Security Settings dialog box appears (see Figure 6.3).
**FIGURE 6.3** A GPO's Security Settings dialog box
The following permissions options are available:
* Full Control
* Read
* Write
* Create All Child Objects
* Delete All Child Objects
* Apply Group Policy
You might have to scroll the Permissions window to see the Apply Group Policy item. Of these, the Apply Group Policy setting is particularly important because you use it to filter the scope of the GPO. _Filtering_ is the process by which selected security groups are included or excluded from the effects of the GPOs. To specify that the settings should apply to a GPO, you should select the Allow check box for both the Apply Group Policy setting and the Read setting. These settings will be applied only if the security group is also contained within a site, domain, or OU to which the GPO is linked. To disable GPO access for a group, choose Deny for both of these settings. Finally, if you do not want to specify either Allow or Deny, leave both boxes blank. This is effectively the same as having no setting.
In Exercise 6.3, you will filter Group Policy using security groups. To complete the steps in this exercise, you must have completed Exercises 6.1 and 6.2.
* * *
### EXERCISE 6.3: Filtering Group Policy Using Security Groups
1. Open the Active Directory Users and Computers administrative tool.
2. Create a new OU called **Group Policy Test**.
3. Create two new global security groups within the Group Policy Test OU and name them **PolicyEnabled** and PolicyDisabled.
4. Exit Active Directory Users and Computers and open the GPMC.
5. Right-click the Group Policy Test OU and select Link An Existing GPO.
6. Choose Unlinked Test GPO and click OK.
7. Expand the Group Policy Test OU so that you can see the GPO (Unlinked Test GPO) underneath the OU.
8. Click the Delegation tab and then click the Advanced button in the lower-right corner of the window.
9. Click the Add button and type PolicyEnabled in the Enter The Object Names To Select field. Click the Check Names button. Then click OK.
10. Add a group named PolicyDisabled in the same way.
11. Highlight the PolicyEnabled group and select Allow for the Read and Apply Group Policy permissions. This ensures that users in the PolicyEnabled group will be affected by this policy.
12. Highlight the PolicyDisabled group and select Deny for the Read and Apply Group Policy permissions. This ensures that users in the PolicyDisabled group will not be affected by this policy.
13. Click OK. You will see a message stating that you are choosing to use the Deny permission and that the Deny permission takes precedence over the Allow entries. Click the Yes button to continue.
14. When you have finished, close the GPMC tool.
* * *
### Delegating Administrative Control of GPOs
So far, you have learned about how to use Group Policy to manage user and computer settings. What you haven't done yet is to determine who can modify GPOs. It's important to establish the appropriate security on GPOs themselves for two reasons.
* If the security settings aren't set properly, users and system administrators can easily override them. This defeats the purpose of having the GPOs in the first place.
* Having many different system administrators creating and modifying GPOs can become extremely difficult to manage. When problems arise, the hierarchical nature of GPO inheritance can make it difficult to pinpoint the problem.
Fortunately, through the use of delegation, determining security permissions for GPOs is a simple task. Exercise 6.4 walks you through the steps that you must take to grant the appropriate permissions to a user account. Specifically, the process involves delegating the ability to manage Group Policy links on an Active Directory object (such as an OU). To complete this exercise, you must have completed Exercises 6.1 and 6.2.
* * *
### EXERCISE 6.4: Delegating Administrative Control of Group Policy
1. Open the Active Directory Users and Computers tool.
2. Expand the local domain and create a user named Policy Admin within the Group Policy Test OU.
3. Exit Active Directory Users and Computers and open the GPMC.
4. Click the Group Policy Test OU and select the Delegation tab.
5. Click the Add button. In the field Enter The Object Name To Select, type Policy Admin and click the Check Names button.
6. The Add Group Or User dialog box appears. In the Permissions drop-down list, make sure that the item labeled Edit Settings, Delete, Modify Security is chosen. Click OK.
7. At this point you should be looking at the Group Policy Test Delegation window. Click the Advanced button in the lower-right corner.
8. Highlight the Policy Admin account and check the Allow Full Control box. This user now has full control of these OUs and all child OUs and GPOs for these OUs. Click OK.
If you just want to give this user individual rights, then, in the Properties window (step 8), click the Advanced button and then the Effective Permissions tab. This is where you can also choose a user and give them only the rights that you want them to have.
9. When you have finished, close the GPMC tool.
* * *
* * *
## Understanding Delegation
Although I have talked about delegation throughout the book, it's important to discuss it again in the context of OUs, Group Policy, and Active Directory.
Once configured, Active Directory administrative delegation allows an administrator to delegate tasks (usually administration related) to specific user accounts or groups. What this means is that if you don't manage it all, the user accounts (or groups) you choose will be able to manage their portions of the tree.
It's important to be aware of the benefits of Active Directory Delegation (AD Delegation). _AD Delegation_ will help you manage the assigning of administrative control over objects in Active Directory, such as users, groups, computers, printers, domains, and sites. AD Delegation is used to create more administrators, which essentially saves time.
For example, let's say you have a company whose IT department is small and situated in a central location. The central location connects three other smaller remote sites. These sites do not each warrant a full-time IT person, but the manager on staff (for example) at each remote site can become an administrator for their portion of the tree. If that manager administers the user accounts for the staff at the remote site, this reduces the burden on the system administrator of doing trivial administrative work, such as unlocking user accounts or changing passwords, and thus it reduces costs.
* * *
### Controlling Inheritance and Filtering Group Policy
Controlling inheritance is an important function when you are managing GPOs. Earlier in this chapter, you learned that, by default, GPO settings flow from higher-level Active Directory objects to lower-level ones. For example, the effective set of Group Policy settings for a user might be based on GPOs assigned at the site level, at the domain level, and in the OU hierarchy. In general, this is probably the behavior you would want.
In some cases, however, you might want to block Group Policy inheritance. You can accomplish this easily by selecting the object to which a GPO has been linked. Right-click the object and choose Block Inheritance (see Figure 6.4). By enabling this option, you are effectively specifying that this object starts with a clean slate; that is, no other Group Policy settings will apply to the contents of this Active Directory site, domain, or OU.
**FIGURE 6.4** Blocking GPO inheritance
System administrators can also force inheritance. By setting the Enforced option, they can prevent other system administrators from making changes to default policies. You can set the Enforced option by right-clicking the GPO and choosing the Enforced item (see Figure 6.5).
**FIGURE 6.5** Setting the Enforced GPO option
### Assigning Script Policies
System administrators might want to make several changes and implement certain settings that would apply while the computer is starting up or the user is logging on. Perhaps the most common operation that logon scripts perform is mapping network drives. Although users can manually map network drives, providing this functionality within login scripts ensures that mappings stay consistent and that users only need to remember the drive letters for their resources.
_Script policies_ are specific options that are part of Group Policy settings for users and computers. These settings direct the operating system to the specific files that should be processed during the startup/shutdown or logon/logoff processes. You can create the scripts by using the _Windows Script Host (WSH)_ or with standard batch file commands. WSH allows developers and system administrators to create scripts quickly and easily using Visual Basic Scripting Edition (VBScript) or JScript (Microsoft's implementation of JavaScript). Additionally, WSH can be expanded to accommodate other common scripting languages.
To set script policy options, you simply edit the Group Policy settings. As shown in Figure 6.6, there are two main areas for setting script policy settings.
**FIGURE 6.6** Viewing Startup/Shutdown script policy settings
Startup/Shutdown Scripts These settings are located within the Computer Configuration Windows Settings Scripts (Startup/Shutdown) object.
Logon/Logoff Scripts These settings are located within the User Configuration Windows Settings Scripts (Logon/Logoff) object.
To assign scripts, simply double-click the setting, and its Properties dialog box appears. For instance, if you double-click the Startup setting, the Startup Properties dialog box appears (see Figure 6.7). To add a script filename, click the Add button. When you do, you will be asked to provide the name of the script file (such as `MapNetworkDrives.vbs` or `ResetEnvironment.bat`).
**FIGURE 6.7** Setting scripting options
Note that you can change the order in which the scripts are run by using the Up and Down buttons. The Show Files button opens the directory folder in which you should store the Logon script files. To ensure that the files are replicated to all domain controllers, you should be sure you place the files within the SYSVOL share.
### Understanding the Loopback Policy
There may be times when the user settings of a Group Policy object should be applied to a computer based on its location instead of the user object. Usually, the user Group Policy processing dictates that the GPOs be applied in order during computer startup based on the computers located in their organizational unit. User GPOs, on the other hand, are applied in order during logon, regardless of the computer to which they log on.
In some situations, this processing order may not be appropriate. A good example is a kiosk machine. You would not want applications that have been assigned or published to a user to be installed when the user is logged on to the kiosk machine. _Loopback Policy_ allows two ways to retrieve the list of GPOs for any user when they are using a specific computer in an OU.
Merge Mode The GPOs for the computer are added to the end of the GPOs for the user. Because of this, the computer's GPOs have higher precedence than the user's GPOs.
Replace Mode In Replace mode, the user's GPOs are not used. Only the GPOs of the Computer object are used.
### Managing Network Configuration
Group policies are also useful in network configuration. Although administrators can handle network settings at the protocol level using many different methods, such as Dynamic Host Configuration Protocol (DHCP), Group Policy allows them to set which functions and operations are available to users and computers.
Figure 6.8 shows some of the features that are available for managing Group Policy settings. The paths to these settings are as follows:
**FIGURE 6.8** Viewing Group Policy User network configuration options
Computer Network Options These settings are located within the Computer Configuration Administrative Templates Network Network Connections folder.
User Network Options These settings are located within User Configuration Administrative Templates Network.
Here are some examples of the types of settings available:
* The ability to allow or disallow the modification of network settings.
In many environments, the improper changing of network configurations and protocol settings is a common cause of help desk calls.
* The ability to allow or disallow the creation of Remote Access Service (RAS) connections.
This option is useful, especially in larger networked environments, because the use of modems and other WAN devices can pose a security threat to the network.
* The ability to set offline files and folders options.
This is especially useful for keeping files synchronized for traveling users, and it is commonly configured for laptops.
Each setting includes detailed instructions in the description area of the GPO Editor window. By using these configuration options, system administrators can maintain consistency for users and computers and avoid many of the most common troubleshooting calls.
### Automatically Enrolling User and Computer Certificates in Group Policy
You can also use Group Policy to enroll user and computer certificates automatically, making the entire certificate process transparent to your end users. Before proceeding, you should understand what certificates are and why they are an important part of network security.
Think of a digital certificate as a carrying case for a public key. A certificate contains the public key and a set of attributes, including the key holder's name and email address. These attributes specify something about the holder: their identity, what they're allowed to do with the certificate, and so on. The attributes and the public key are bound together because the certificate is digitally signed by the entity that issued it. Anyone who wants to verify the certificate's contents can verify the issuer's signature.
Certificates are one part of what security experts call a _public-key infrastructure (PKI)_. A PKI has several different components that you can mix and match to achieve the desired results. Microsoft's PKI implementation offers the following functions:
Certificate Authorities CAs issue certificates, revoke certificates they've issued, and publish certificates for their clients. Big CAs like Thawte and VeriSign do this for millions of users. If you want, you can also set up your own CA for each department or workgroup in your organization. Each CA is responsible for choosing which attributes it will include in a certificate and what mechanism it will use to verify those attributes before it issues the certificate.
Certificate Publishers They make certificates publicly available, inside or outside an organization. This allows widespread availability of the critical material needed to support the entire PKI.
PKI-Savvy Applications These allow you and your users to do useful things with certificates, such as encrypt email or network connections. Ideally, the user shouldn't have to know (or even be aware of) what the application is doing—everything should work seamlessly and automatically. The best-known examples of PKI-savvy applications are web browsers such as Internet Explorer and Firefox and email applications such as Outlook.
Certificate Templates These act like rubber stamps. By specifying a particular template as the model you want to use for a newly issued certificate, you're actually telling the CA which optional attributes to add to the certificate as well as implicitly telling it how to fill some of the mandatory attributes. Templates greatly simplify the process of issuing certificates because they keep you from having to memorize the names of all of the attributes you may potentially want to put in a certificate.
* * *
## Learn More About PKI
When discussing certificates, it's also important to mention PKI and its definition. The exam doesn't go deeply into PKI, but I recommend you do some extra research on your own because it is an important technology and shouldn't be overlooked. PKI is actually a simple concept with a lot of moving parts. When broken down to its bare essentials, PKI is nothing more than a server and workstations utilizing a software service to add security to your infrastructure. When you use PKI, you are adding a layer of protection. The auto-enrollment Settings policy determines whether users and/or computers are automatically enrolled for the appropriate certificates when necessary. By default, this policy is enabled if a certificate server is installed, but you can make changes to the settings, as shown in Exercise 6.5.
* * *
In Exercise 6.5, you will learn how to configure automatic certificate enrollment in Group Policy. You must have first completed the other exercises in this chapter in order to proceed with Exercise 6.5.
* * *
### EXERCISE 6.5: Configuring Automatic Certificate Enrollment in Group Policy
1. Open the Group Policy Management Console tool.
2. Right-click the North America OU that you created in the previous exercises in this book.
3. Choose Create A GPO In This Domain And Link It Here and name it Test CA. Click OK.
4. Right-click the Test CA GPO and choose Edit.
5. Open Computer Configuration Policies Windows Settings Security Settings Public Key Policies.
6. Double-click Certificate Services Client – Auto-Enrollment in the right pane.
7. The Certificate Services Client – Auto-Enrollment Properties dialog box will appear.
8. For now, don't change anything. Just become familiar with the settings in this dialog box. Click OK to close it.
* * *
### Redirecting Folders
Another set of Group Policy settings that you will learn about are the _folder redirection settings_. Group Policy provides a means for redirecting the `Documents`, `Desktop`, and `Start Menu` folders, as well as cached application data, to network locations. Folder redirection is particularly useful for the following reasons:
* When they are using roaming user profiles, a user's `Documents` folder is copied to the local machine each time they log on. This requires high bandwidth consumption and time if the `Documents` folder is large. If you redirect the `Documents` folder, it stays in the redirected location, and the user opens and saves files directly to that location.
* Documents are always available no matter where the user logs on.
* Data in the shared location can be backed up during the normal backup cycle without user intervention.
* Data can be redirected to a more robust server-side administered disk that is less prone to physical and user errors.
When you decide to redirect folders, you have two options: basic and advanced.
* Basic redirection redirects everyone's folders to the same location (but each user gets their own folder within that location).
* Advanced redirection redirects folders to different locations based on group membership. For instance, you could configure the Engineers group to redirect their folders to `//Engineering1/Documents/` and the Marketing group to `//Marketing1/Documents/`. Again, individual users still get their own folder within the redirected location.
To configure folder redirection, follow the steps in Exercise 6.6. You must have completed the other exercises in this chapter to proceed with this exercise.
* * *
### EXERCISE 6.6: Configuring Folder Redirection in Group Policy
1. Open the GPMC tool.
2. Open the North America OU and then edit the Test CA GPO.
3. Open User Configuration Policies Windows Settings Folder Redirection Documents.
4. Right-click Documents, and select Properties.
5. On the Target tab of the Documents Properties dialog box, choose the Basic – Redirect Everyone's Folder To The Same Location selection from the Settings drop-down list.
6. Leave the default option for the Target Folder Location drop-down list and specify a network path in the Root Path field.
7. Click the Settings tab. All of the default settings are self-explanatory and should typically be left at the default setting. Click OK when you have finished.
* * *
* * *
## Folder Redirection Facts
Try not to mix up the concepts of _folder redirection_ and _offline folders_ , especially in a world with ever-increasing numbers of mobile users. Folder redirection and offline folders are different features.
Windows Server 2012 R2 folder redirection works as follows: The system uses a pointer that moves the folders you want to a location you specify. Users do not see any of this—it is transparent to them. One problem with folder redirection is that it does not work for mobile users (users who will be offline and who will not have access to files they may need).
Offline folders, however, are copies of folders that were local to you. Files are now available locally to you on the system you have with you. They are also located back on the server where they are stored. The next time you log in, the folders are synchronized so that both folders contain the latest data. This is a perfect feature for mobile users, whereas folder redirection provides no benefit for the mobile user.
* * *
### Managing GPOs with Windows PowerShell Group Policy Cmdlets
As stated earlier in this book, _Windows PowerShell_ is a Windows command-line shell and scripting language. Windows PowerShell can also help an administrator automate many of the same tasks that you perform using the Group Policy Management Console.
Windows Server 2012 R2 helps you perform many of the Group Policy tasks by providing more than 25 cmdlets. Each of these cmdlets is a simple, single-function command-line tool.
The Windows PowerShell Group Policy cmdlets can help you perform some of the following tasks for domain-based Group Policy objects:
* Maintain, create, remove, back up, and import GPOs
* Create, update, and remove GPO links to Active Directory containers
* Set Active Directory OUs and domain permissions and inheritance flags
* Configure Group Policy registry settings
* Create and edit Starter GPOs
The requirement for Windows PowerShell Group Policy cmdlets is Windows Server 2012 R2 on either a domain controller or a member server that has the GPMC installed. Windows 7 and Windows 8 also have the ability to use Windows PowerShell Group Policy cmdlets if they have Remote Server Administration Tools (RSAT) installed. RSAT includes the GPMC and its cmdlets. PowerShell is also a requirement.
## Deploying Software Through a GPO
It's difficult enough to manage applications on a stand-alone computer. It seems that the process of installing, configuring, and uninstalling applications is never finished. Add in the hassle of computer reboots and reinstalling corrupted applications, and the reduction in productivity can be substantial.
Software administrators who manage software in network environments have even more concerns.
* First, they must determine which applications specific users require.
* Then, IT departments must purchase the appropriate licenses for the software and acquire any necessary media.
* Next, the system administrators need to install the applications on users' machines. This process generally involves help desk staff visiting computers, or it requires end users to install the software themselves. Both processes entail several potential problems, including installation inconsistency and lost productivity from downtime experienced when applications were installed.
* Finally, software administrators still need to manage software updates and remove unused software.
One of the key design goals for Active Directory was to reduce some of the headaches involved in managing software and configurations in a networked environment. To that end, Windows Server 2012 R2 offers several features that can make the task of deploying software easier and less error prone. Before you dive into the technical details, however, you need to examine the issues related to software deployment.
### The Software Management Life Cycle
Although it may seem that the use of a new application requires only the installation of the necessary software, the overall process of managing applications involves many more steps. When managing software applications, there are three main phases to their life cycle, as follows:
Phase 1: Deploying Software The first step in using applications is to install them on the appropriate client computers. Generally, some applications are deployed during the initial configuration of a PC, and others are deployed when they are requested. In the latter case, this often used to mean that system administrators and help desk staffs have to visit client computers and manually walk through the installation process. With Windows Server 2012 R2 and GPOs, the entire process can be automated.
* * *
## Before You Install, Stop
It is important to understand that just because you can easily deploy software, it does not necessarily mean you have the right to do so. Before you install software on client computers, you must make sure you have the appropriate licenses for the software. Furthermore, it's important to take the time to track application installations. As many system administrators have discovered, it's much more difficult to inventory software installations after they've been performed. Another issue you may encounter is that you lack available resources (for instance, your system does not meet the minimum hardware requirements) and that you face problems such as limited hard disk space or memory that may not be able to handle the applications that you want to load and use. You may also find that your user account does not have the permission to install software. It's important to consider not only how you will install software but also whether you can.
* * *
Phase 2: Maintaining Software Once an application is installed and in use on client computers, you need to ensure that the software is maintained. You must keep programs up-to-date by applying changes due to bug fixes, enhancements, and other types of updates. This is normally done with service packs, hot fixes, and updates. As with the initial software deployment, software maintenance can be tedious. Some programs require older versions to be uninstalled before updates are added. Others allow for automatically upgrading over existing installations. Managing and deploying software updates can consume a significant amount of the IT staff's time.
* * *
## Using Windows Update
Make sure that you learn about Windows Update, a service that allows you to connect to Microsoft's website and download what your system may need to bring it up to compliance. This tool is helpful if you are running a stand-alone system, but if you want to deploy software across the enterprise, the best way to accomplish this is first to test the updates you are downloading and make sure you can use them and that they are not bug ridden. Then you can use a tool such as the Windows Server Update Service (WSUS), which was formerly called the Software Update Services (SUS).
You can check for updates at Microsoft's website (`<http://update.microsoft.com>`). Microsoft likes to ask many types of questions about WSUS on its certification exams. WSUS is described in detail in other Sybex certification books.
* * *
Phase 3: Removing Software The end of the life cycle for many software products involves the actual removal of unused programs. Removing software is necessary when applications become outdated or when users no longer require their functionality. One of the traditional problems with uninstalling applications is that many of the installed files may not be removed. Furthermore, the removal of shared components can sometimes cause other programs to stop functioning properly. Also, users often forget to uninstall applications that they no longer need, and these programs continue to occupy disk space and consume valuable system resources.
The Microsoft Windows Installer (MSI) manages each of these three phases of the software maintenance life cycle. Now that you have an overview of the process, let's move forward to look at the steps involved in deploying software using Group Policy.
* * *
The _Microsoft Windows Installer_ (sometimes referred to as Microsoft Installer or Windows Installer) is an application installation and configuration service. An instruction file (the Microsoft Installer package) contains information about what needs to be done to install a product. It's common to confuse the two.
* * *
### The Windows Installer
If you've installed newer application programs (such as Microsoft Office 2013), you've probably noticed the updated setup and installation routines. Applications that comply with the updated standard use the _Windows Installer specification_ and MSI software packages for deployment. Each package contains information about various setup options and the files required for installation. Although the benefits may not seem dramatic on the surface, there's a lot of new functionality under the hood.
The Windows Installer was created to solve many of the problems associated with traditional application development. It has several components, including the Installer service (which runs on Windows 2000, XP, Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 computers), the Installer program (`msiexec.exe`) that is responsible for executing the instructions in a _Windows Installer package_ , and the specifications third-party developers use to create their own packages. Within each installation package file is a relational structure (similar to the structure of tables in databases) that records information about the programs contained within the package.
To appreciate the true value of the Windows Installer, you'll need to look at some of the problems with traditional software deployment mechanisms and then at how the Windows Installer addresses many of them.
#### Application Installation Issues
Before the Windows Installer, applications were installed using a setup program that managed the various operations required for a program to operate. These operations included copying files, changing registry settings, and managing any other operating system changes that might be required (such as starting or stopping services). However, this method had several problems:
* The setup process was not robust, and aborting the operation often left many unnecessary files in the file system.
* The process included uninstalling an application (this also often left many unnecessary files in the file system) and remnants in the Windows registry and operating system folders. Over time, these remnants would result in reduced overall system performance and wasted disk space.
* There was no standard method for applying upgrades to applications, and installing a new version often required users to uninstall the old application, reboot, and then install the new program.
* Conflicts between different versions of _dynamic link libraries (DLLs)_ —shared program code used across different applications—could cause the installation or removal of one application to break the functionality of another.
#### Benefits of the Windows Installer
Because of the many problems associated with traditional software installation, Microsoft created the _Windows Installer_. This system provides for better manageability of the software installation process and allows system administrators more control over the deployment process. Specifically, the Windows Installer provides the following benefits:
Improved Software Removal The process of removing software is an important one because remnants left behind during the uninstall process can eventually clutter up the registry and file system. During the installation process, the Windows Installer keeps track of all of the changes made by a setup package. When it comes time to remove an application, all of these changes can then be rolled back.
More Robust Installation Routines If a typical setup program is aborted during the software installation process, the results are unpredictable. If the actual installation hasn't yet begun, then the installer generally removes any temporary files that may have been created. However, if the file copy routine starts before the system encounters an error, it is likely that the files will not be automatically removed from the operating system. In contrast, the Windows Installer allows you to roll back any changes when the application setup process is aborted.
Ability to Use Elevated Privileges Installing applications usually requires the user to have Administrator permissions on the local computer because file system and registry changes are required. When installing software for network users, system administrators have two options. First, they can log off of the computer before installing the software and then log back on as a user who has Administrator permissions on the local computer. This method is tedious and time-consuming. The second option is to give users Administrator permissions temporarily on their own machines. This method could cause security problems and requires the attention of a system administrator.
Through the use of the Installer service, the Windows Installer is able to use temporarily elevated privileges to install applications. This allows users, regardless of their security settings, to execute the installation of authorized applications. This saves time and preserves security.
Support for Repairing Corrupted Applications Regardless of how well a network environment is managed, critical files are sometimes lost or corrupted. Such problems can prevent applications from running properly and can cause crashes. Windows Installer packages provide you with the ability to verify the installation of an application and, if necessary, replace any missing or corrupted files. This support saves time and lessens end-user headaches associated with removing and reinstalling an entire application to replace just a few files.
Prevention of File Conflicts Generally, different versions of the same files should be compatible with each other. In the real world, however, this isn't always the case. A classic problem in the Windows world is the case of one program replacing DLLs that are used by several other programs. Windows Installer accurately tracks which files are used by certain programs and ensures that any shared files are not improperly deleted or overwritten.
Automated Installations A typical application setup process requires end users or system administrators to respond to several prompts. For example, a user may be able to choose the program group in which icons will be created and the file system location to which the program will be installed. Additionally, they may be required to choose which options are installed. Although this type of flexibility is useful, it can be tedious when you are rolling out multiple applications. By using features of the Windows Installer, however, users are able to specify setup options before the process begins. This allows system administrators to ensure consistency in installations, and it saves users time.
Advertising and On-Demand Installations One of the most powerful features of the Windows Installer is its ability to perform on-demand software installations. Prior to the Windows Installer, application installation options were quite basic—either a program was installed or it was not. When setting up a computer, system administrators would be required to guess which applications the user might need and install all of them.
The Windows Installer supports a function known as advertising. _Advertising_ makes applications appear to be available via the Start menu. However, the programs themselves may not actually be installed on the system. When a user attempts to access an advertised application, the Windows Installer automatically downloads the necessary files from a server and installs the program. The result is that applications are installed only when they are needed, and the process requires no intervention from the end user. We'll cover the details of this process later in this chapter.
To anyone who has managed many software applications in a network environment, all of these features of the Windows Installer are likely welcome ones. They also make life easier for end users and application developers; they can focus on the "real work" that their jobs demand.
#### Windows Installer File Types
When performing software deployment with the Windows Installer in Windows Server 2012 R2, you may encounter several different file types.
Microsoft Windows Installer Packages To take full advantage of Windows Installer functionality, applications must include Microsoft Windows Installer packages. Third-party application vendors and software developers normally create these packages, and they include the information required to install and configure the application and any supporting files.
Microsoft Transformation Files _Microsoft Transformation (MST) files_ are useful when you are customizing the details of how applications are installed. When a system administrator chooses to assign or publish an application, they may want to specify additional options for the package. For example, if a system administrator wants to allow users to install only the Microsoft Word and Microsoft PowerPoint components of Office 2013, they could specify these options within a transformation file. Then, when users install the application, they will be provided only with the options related to these components.
Microsoft Patches To maintain software, patches are often required. Patches may make registry and/or file system changes. _Patch files (MSP)_ are used for minor system changes and are subject to certain limitations. Specifically, a patch file cannot remove any installed program components and cannot delete or modify any shortcuts created by the user.
Initialization Files To provide support for publishing non-Windows Installer applications, _initialization files_ can be used. These files provide links to a standard executable file that is used to install an application. An example might be `\\server1\software\program1\setup.exe`. These files can then be published and advertised, and users can access the _Add Or Remove Programs_ icon to install them over the network.
Application Assignment Scripts _Application assignment scripts (AAS)_ store information regarding assigning programs and any settings that the system administrator makes. These files are created when Group Policy is used to create software package assignments for users and computers.
Each of these types of files provides functionality that allows the system administrator to customize software deployment. Windows Installer packages have special properties that you can view by right-clicking the file in Windows Explorer and choosing Properties (see Figure 6.9).
**FIGURE 6.9** Viewing the properties of an MSI package file
### Deploying Applications
The functionality provided by Windows Installer offers many advantages to end users who install their own software. However, that is just the beginning in a networked environment. As you'll see later in this chapter, the various features of Windows Installer and compatible packages allow system administrators to determine centrally applications that users will be able to install.
There are two main methods of making programs available to end users using Active Directory: assigning and publishing. Both assigning and publishing applications greatly ease the process of deploying and managing applications in a network environment.
In the following sections, you'll look at how the processes of assigning and publishing applications can make life easier for IT staff and users alike. The various settings for assigned and published applications are managed through the use of GPOs.
#### Assigning Applications
Software applications can be assigned to users and computers. _Assigning_ a software package makes the program available for automatic installation. The applications advertise their availability to the affected users or computers by placing icons within the `Programs` folder of the Start menu for Windows 8 (and before) and Windows Server 2012, and within the Apps area on Windows 8.1 and Windows Server 2012 R2.
When applications are assigned to a user, programs will be advertised to the user regardless of which computer they are using. That is, icons for the advertised program will appear regardless of whether the program is installed on that computer. If the user clicks an icon for a program that has not yet been installed on the local computer, the application will automatically be accessed from a server and it will be installed.
When an application is assigned to a computer, the program is made available to any users of the computer. For example, all users who log on to a computer that has been assigned Microsoft Office 2013 will have access to the components of the application. If the user did not previously install Microsoft Office 2013, they will be prompted for any required setup information when the program first runs.
Generally, applications that are required by the vast majority of users should be assigned to computers. This reduces the amount of network bandwidth required to install applications on demand and improves the end-user experience by preventing the delay involved when installing an application the first time it is accessed. Any applications that may be used by only a few users (or those with specific job tasks) should be assigned to users.
#### Publishing Applications
When applications are _published_ , they are advertised, but no icons are automatically created. Instead, the applications are made available for installation using the Add Or Remove Programs icon in Control Panel.
* * *
Windows Vista, Windows 7, and Windows 8 do not have the Add Or Remove Programs feature. They use the Programs icon in Control Panel to install the software.
* * *
## Implementing Software Deployment
So far, you have become familiar with the issues related to software deployment and management from a theoretical level. Now it's time to drill down into the actual steps required to deploy software using the features of Active Directory and the GPMC. In the following sections, you will walk through the steps required to create an application distribution share point, to publish and assign applications, to update previously installed applications, to verify the installation of applications, and to update Windows operating systems.
### Preparing for Software Deployment
Before you can install applications on client computers, you must make sure that the necessary files are available to end users. In many network environments, system administrators create shares on file servers that include the installation files for many applications. Based on security permissions, either end users or system administrators can then connect to these shares from a client computer and install the needed software. The efficient organization of these shares can save the help desk from having to carry around a library of DVDs, and it allows you to install applications easily on many computers at once.
* * *
One of the problems in network environments is that users frequently install applications whether or not they really need them. They may stumble upon applications that are stored on common file servers and install them out of curiosity. These actions can often decrease productivity and may violate software licensing agreements. You can help avoid this by placing all of your application installation files in hidden shares (for example, `software$`).
* * *
Exercise 6.7 walks you through the process of creating a software distribution share point. In this exercise, you will prepare for software deployment by creating a directory share and placing certain types of files in this directory. To complete the steps in this exercise, you must have access to the Microsoft Office 2010 or Microsoft Office 2013 installation files (via DVD or through a network share) and have 2,000MB of free disk space. For this exercise, I used Microsoft Office 2013.
* * *
### EXERCISE 6.7: Creating a Software Deployment Share
1. Using Windows Explorer, create a folder called `Software` that you can use with application sharing. Be sure that the volume on which you create this folder has at least 2,000MB of available disk space.
2. Create a folder called `Office 2013` within the `Software` folder.
3. Copy all of the installation files for Microsoft Office 2013 from the DVD or network share containing the files to the `Office 2013` folder you created in step 2. If you prefer, you can use switches to install all of the Office 2013 installation files. You can find these switches at `<http://technet.microsoft.com/en-us/library/ee624360.aspx>`.
4. Right-click the `Software` folder (created in step 1) and select Share. In the Choose People On Your Network To Share With dialog box, type Everyone, and click the Add button. Next click the Share button. When you see a message that the sharing process is complete, click Done.
* * *
Once you have created an application distribution share, it's time to publish and assign the applications. This topic is covered next.
### Software Restriction Policies
One of the biggest problems that we face as IT managers is users downloading and installing software. Many software packages don't cause any issues and are completely safe. Unfortunately, many software packages do have viruses and can cause problems. This is where software restriction policies can help. Software restriction policies help to identify software and to control its ability to run on a local computer, organizational unit, domain, or site.
Software restriction policies give administrators the ability to regulate unknown or untrusted software. Software restriction policies allow you to protect your computers from unwanted software by identifying and also specifying what software packages are allowed to be installed.
When configuring software restriction policies, an administrator is able to define a default security level of Unrestricted (software is allowed) or Disallowed (software is not allowed to run) for a GPO. Administrators can make exceptions to this default security level. They can create software restriction policy rules for specific software.
To create a software policy using the Group Policy Management Console, create a new GPO. In the GPO, expand the Windows Settings for either the user or computer configuration section, expand Security, right-click Software Restriction Policy, and choose New Software Restriction Policy. Set the policy for the level of security that you need.
### Using AppLocker
AppLocker is a feature in Windows 7, Windows 8, Windows Server 2012, and Windows Server 2012 R2. It is the replacement for software restriction policies. _AppLocker_ allows you to configure a Denied list and an Accepted list for applications. Applications that are configured on the Denied list will not run on the system, whereas applications on the Accepted list will operate properly.
The new capabilities and extensions of the AppLocker feature help reduce administrative overhead and help administrators control how users can access and use files, such as EXE files, scripts, Windows Installer files (MSI and MSP files), and DLLs.
### Group Policy Slow Link Detection
When setting up GPOs, most of us assume that the connection speeds between servers and clients are going to be fast. In today's world, it is unlikely to see slow connections between locations, but they are still out there. Sometimes connection speeds can cause issues with the deployment of GPOs, specifically ones that are deploying software.
A setting in the Computer and User section of the GPO called _Group Policy Slow Link Detection_ defines a slow connection for the purposes of applying and updating GPOs. If the data transfer rate from the domain controller providing the GPO to the computer is slower than what you have specified in this setting, the connection is considered to be a slow connection. If a connection is considered slow, the system response will vary depending on the policy. For example, if a GPO is going to deploy software and the connection is considered slow, the software may not be installed on the client computer. If you configure this option as 0, all connections are considered fast connections.
### Publishing and Assigning Applications
As mentioned earlier in this section, system administrators can make software packages available to users by using publishing and assigning operations. Both of these operations allow system administrators to leverage the power of Active Directory and, specifically, GPOs to determine which applications are available to users. Additionally, OUs can provide the organization that can help group users based on their job functions and software requirements.
The general process involves creating a GPO that includes software deployment settings for users and computers and then linking this GPO to Active Directory objects.
Exercise 6.8 walks you through the steps required to publish and assign applications. In this exercise, you will create applications and assign them to specific Active Directory objects using GPOs. To complete the steps in this exercise, you must have completed Exercise 6.7.
* * *
### EXERCISE 6.8: Publishing and Assigning Applications Using Group Policy
1. Open the Active Directory Users and Computers tool from the Administrative Tools program group (using the Windows key).
2. Expand the domain and create a new top-level OU called Software.
3. Within the Software OU, create a user named Jane User with a login name of juser (choose the defaults for all other options).
4. Exit Active Directory Users and Computers and open the Group Policy Management Console.
5. Right-click the Software OU and choose Create A GPO In This Domain And Link It Here.
6. For the name of the new GPO, type Software Deployment.
7. To edit the Software Deployment GPO, right-click it and choose Edit. Expand the Computer Configuration Policies Software Settings object.
8. Right-click the Software Installation item and select New Package.
9. Navigate to the Software share you created in Exercise 6.7.
10. Within the Software share, double-click the `Office 2013` folder and select the appropriate MSI file depending on the version of Office 2013 you have. Office 2013 Professional is being used in this example, so you'll see that the `OFFICEMUI.MSI` file is chosen. Click Open.
11. In the Deploy Software dialog box, choose Advanced. (Note that the Published option is unavailable because applications cannot be published to computers.) Click OK to return to the Deploy Software dialog box.
12. To examine the deployment options of this package, click the Deployment tab. Accept the default settings by clicking OK.
13. Within the Group Policy Object Editor, expand the User Configuration Software Settings object.
14. Right-click the Software Installation item and select New Package.
15. Navigate to the Software share you created in Exercise 6.7.
16. Within the Software share, double-click the `Office 2013` folder and select the appropriate MSI file. Click Open.
17. For the Software Deployment option, select Published in the Deploy Software dialog box and click OK.
18. Close the GPMC.
* * *
The overall process involved with deploying software using Active Directory is quite simple. However, you shouldn't let the intuitive graphical interface fool you—there's a lot of power under the hood of these software deployment features! Once you've properly assigned and published applications, it's time to see the effects of your work.
### Applying Software Updates
The steps described in the previous section work only when you are installing a new application. However, software companies often release updates that you need to install on top of existing applications. These updates usually consist of bug fixes or other changes that are required to keep the software up-to-date. You can apply software updates in Active Directory by using the Upgrades tab of the software package Properties dialog box found in the Group Policy Object Editor.
In Exercise 6.9, you will apply a software update to an existing application. You should add the upgrade package to the GPO in the same way you added the original application in steps 8 through 12 of Exercise 6.8. You should also have completed Exercise 6.8 before attempting this exercise.
* * *
### EXERCISE 6.9: Applying Software Updates
1. Open the Group Policy Management Console from the Administrative Tools program group.
2. Click the Software OU, right-click the Software Deployment GPO, and choose Edit.
3. Expand the Computer Configuration Policies Software Settings Software Installation object.
4. Right-click the software package and select Properties from the context menu to bring up the Properties dialog box.
5. Select the Upgrades tab and click the Add button.
6. Click the Current Group Policy Object (GPO) radio button in the Choose A Package From section of the dialog box or click the Browse button to select the GPO to which you want to apply the upgrade. Consult your application's documentation to see whether you should choose the Uninstall The Existing Package, Then Install The Upgrade Package radio button or the Package Can Upgrade Over The Existing Package radio button.
7. Click Cancel to close the Add Upgrade Package dialog box.
8. Click Cancel and exit the GPMC.
* * *
You should understand that not all upgrades make sense in all situations. For instance, if the Paniva 2010 files are incompatible with the Paniva 2013 application, then your Paniva 2010 users might not want you to perform the upgrade without taking additional steps to ensure that they can continue to use their files. In addition, users might have some choice about which version they use when it doesn't affect the support of the network.
Regardless of the underlying reason for allowing this flexibility, you should be aware that there are two basic types of upgrades that are available for administrators to provide to the users:
Mandatory Upgrade Forces everyone who currently has an existing version of the program to upgrade according to the GPO. Users who have never installed the program for whatever reason will be able to install only the new, upgraded version.
Nonmandatory Upgrade Allows users to choose whether they would like to upgrade. This upgrade type also allows users who do not have their application installed to choose which version they would like to use.
### Verifying Software Installation
To ensure that the software installation settings you make in a GPO have taken place, you can log into the domain from a Windows 8, Windows 7, or Windows Vista computer that is within the OU to which the software settings apply. When you log in, you will notice two changes. First the application is installed on the computer (if it was not installed already). To access the application, a user needs to click one of the icons within the Program group of the Start menu. Note also that applications are available to any of the users who log on to this machine. Second, the settings apply to any computers that are contained within the OU and to any users who log on to these computers.
If you publish an application to users, the change may not be as evident, but it is equally useful. When you log on to a Windows 8, Windows 7, or Windows Vista computer that is a member of the domain, and when you use a user account from the OU where you published the application, you will be able to install any of the published applications automatically. On a Windows 8 or Windows 7 computer, you can do this by accessing the Programs icon in Control Panel. By clicking Add New Programs, you access a display of the applications available for installation. By clicking the Add button in the Add New Programs section of the Programs dialog box, you will automatically begin the installation of the published application.
### Configuring Automatic Updates in Group Policy
So far you've seen the advantages of deploying application software in a group policy. Group policies also provide a way to install operating system updates across the network for Windows 2000, XP, Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 machines using Windows Update in conjunction with Windows Server Update Service. WSUS is the newer version of SUS, and it is used on a Windows Server 2012 R2 system to update systems. As you may remember, WSUS and SUS are patch-management tools that help you deploy updates to your systems in a controlled manner.
Windows Update is available through the Microsoft website, and it is used to provide the most current files for Windows operating systems. Examples of updates include security fixes, critical updates, updated help files, and updated drivers. You can access Windows Update by clicking the Windows Update icon in the system tray.
WSUS is used to leverage the features of Windows Update within a corporate environment by downloading Windows updates to a corporate server, which in turn provides the updates to the internal corporate clients. This allows administrators to test and have full control over what updates are deployed within the corporate environment.
Within an enterprise network that is using Active Directory, you would typically see automatic updates configured through Group Policy. Group policies are used to manage configuration and security settings via Active Directory. Group Policy is also used to specify what server a client will use for automatic updates.
If the WSUS client were part of an enterprise network that is using Active Directory, you would configure the client via a group policy.
## Configuring Software Deployment Settings
In addition to the basic operations of assigning and publishing applications, you can use several other options to specify the details of how software is deployed. In the following sections, you will examine the various options that are available and their effects on the software installation process.
### The Software Installation Properties Dialog Box
The most important software deployment settings are contained in the Software Installation Properties dialog box, which you can access by right-clicking the Software Installation item and selecting Properties from the context menu. The following sections describe the features contained on the various tabs of the dialog box.
#### Managing Package Defaults
On the Deployment tab of the Software Installation Properties dialog box, you'll be able to specify some defaults for any packages that you create within this GPO. Figure 6.10 shows the Deployment options for managing software installation settings.
**FIGURE 6.10** Deployment tab of the Software Installation Properties dialog box
The following options are used for managing software installation settings:
Default Package Location This setting specifies the default file system or network location for software installation packages. This is useful if you are already using a specific share on a file server for hosting the necessary installation files.
New Packages These settings specify the default type of package assignment that will be used when you add a new package to either the user or computer settings. If you'll be assigning or publishing multiple packages, you may find it useful to set a default here. Selecting the Advanced option (see Figure 6.11) enables Group Policy to display the package's Properties dialog box each time a new package is added.
**FIGURE 6.11** Advanced Deployment dialog box
Installation User Interface Options When installing an application, system administrators may or may not want end users to see all of the advanced installation options. If Basic is chosen, the user will be able to configure only the minimal settings (such as the installation location). If Maximum is chosen, all of the available installation options will be displayed. The specific installation options available will depend on the package itself.
Uninstall Applications When They Fall Out Of The Scope of Management So far, you have seen how applications can be assigned and published to users or computers. But what happens when effective GPOs change? For example, suppose User A is currently located within the Sales OU. A GPO that assigns the Microsoft Office 2013 suite of applications is linked to the Sales OU. You decide to move User A to the Engineering OU, which has no software deployment settings. Should the application be uninstalled or should it remain?
If the Uninstall Applications When They Fall Out Of The Scope of Management option is checked, applications will be removed if they are not specifically assigned or published within GPOs. In this example, this means Office 2013 would be uninstalled for User A. If this box is left unchecked, however, the application will remain installed.
#### Managing File Extension Mappings
One of the potential problems associated with using many different file types is that it's difficult to keep track of which applications work with which files. For example, if you received a file with the filename extension `.abc`, you would have no idea which application you would need to view it.
Fortunately, through software deployment settings, system administrators can specify mappings for specific _filename extensions_. For example, you could specify that whenever users attempt to access a file with the extension `.vsd`, the operating system should attempt to open the file using Visio diagramming software. If Visio is not installed on the user's machine, the computer can automatically download and install it (assuming that the application has been properly advertised).
This method allows users to have applications automatically installed when they are needed. The following is an example of a sequence of events that might occur:
1. A user receives an email message that contains a PDF (`.pdf`) file attachment.
2. The computer realizes that the PDF file does not have the appropriate viewing application for this type of file installed. However, it also realizes that a filename extension mapping is available within the Active Directory software deployment settings.
3. The client computer automatically requests the PDF software package from the server, and it uses the Microsoft Windows Installer to install the application automatically.
4. The computer opens the attachment for the user.
Notice that all of these steps were carried out without any further interaction with the user.
You can manage filename extension mappings by right-clicking the Software Installation item, selecting Properties, and then clicking the File Extensions tab.
#### Creating Application Categories
In many network environments, the list of supported applications can include hundreds of items. For users who are looking for only one specific program, searching through a list of all of these programs can be difficult and time-consuming.
Fortunately, methods for categorizing the applications are available on your network. You can easily manage the application categories for users and computers by right-clicking the Software Installation item, selecting Properties, and then clicking the Categories tab.
Figure 6.12 shows you the categories tab of the Software Installation package. When creating categories, it is a good idea to use category names that are meaningful to users because it will make it easier for them to find the programs they're seeking.
**FIGURE 6.12** The Categories tab of the Software Installation Properties dialog box
Once the software installation categories have been created, you can view them by clicking the Programs or Programs And Features icon in Control Panel. When you click Add New Programs, you'll see that several options appear in the Category drop-down list. Now when you select the properties for a package, you will be able to assign the application to one or more of the categories.
### Removing Programs
As discussed in the beginning of the chapter, an important phase in the software management life cycle is the removal of applications. Fortunately, if you use the GPMC and the Windows Installer packages, the process is simple. To remove an application, you can right-click the package within the Group Policy settings and select All Tasks Remove (see Figure 6.13).
**FIGURE 6.13** Removing a software package
When choosing to remove a software package from a GPO, you have two options, shown here:
Immediately Uninstall The Software From Users And Computers System administrators can choose this option to ensure that an application is no longer available to users who are affected by the GPO. When this option is selected, the program will be uninstalled automatically from users and/or computers that have the package. This option might be useful, for example, if the license for a certain application has expired or if a program is no longer on the approved applications list.
Allow Users To Continue To Use The Software, But Prevent New Installations This option prevents users from making new installations of a package, but it does not remove the software if it has already been installed for users. This is a good option if the company has run out of additional licenses for the software but the existing licenses are still valid.
Figure 6.14 shows these two removal options.
**FIGURE 6.14** Software removal options
If you no longer require the ability to install or repair an application, you can delete it from your software distribution share point by deleting the appropriate Windows Installer package files. This will free up additional disk space for newer applications.
### Microsoft Windows Installer Settings
Several options influence the behavior of the Windows Installer; you can set them within a GPO. You can access these options by navigating to User Configuration Administrative Templates Windows Components Windows Installer (see Figure 6.15).
**FIGURE 6.15** GPO settings for Windows Installer
The options are as follows:
Always Install With Elevated Privileges This policy allows users to install applications that require elevated privileges. For example, if a user does not have the permissions necessary to modify the registry but the installation program must make registry changes, this policy will allow the process to succeed.
Prevent Removable Media Source For Any Install This option disallows the installation of software using removable media (such as a CD-ROM or DVD-ROM). It is useful for ensuring that users install only approved applications.
Prohibit Rollback When this option is enabled, the Windows Installer does not store the system state information that is required to roll back the installation of an application. System administrators may choose this option to reduce the amount of temporary disk space required during installation and to increase the performance of the installation operation. However, the drawback is that the system cannot roll back to its original state if the installation fails and the application needs to be removed.
Specify The Order In Which Windows Installer Searches This setting specifies the order in which the Windows Installer will search for installation files. The options include _n_ (for network shares), _m_ (for searching removal media), and _u_ (for searching the Internet for installation files).
With these options, system administrators can control how the Windows Installer operates for specific users who are affected by the GPO.
## Troubleshooting Group Policies
Because of the wide variety of configurations that are possible when you are establishing GPOs, you should be aware of some common troubleshooting methods. These methods will help isolate problems in policy settings or GPO links.
One possible problem with GPO configuration is that logons and system startups may take a long time. This occurs especially in large environments when the Group Policy settings must be transmitted over the network and, in many cases, slow WAN links. In general, the number of GPOs should be limited because of the processing overhead and network requirements during logon. By default, GPOs are processed in a synchronous manner. This means that the processing of one GPO must be completed before another one is applied (as opposed to asynchronous processing, where they can all execute at the same time).
When a group policy gets processed on a Windows-based operating system, client-side extensions are the mechanisms that interpret the stored policy and then make the appropriate changes to the operating system environment. When an administrator is troubleshooting a given extension's application of policy, the administrator can view the configuration parameters for that extension in the operating system's registry. To view the extension in the registry, you would view the following key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows \CurrentVersion\Group Policy
The most common issue associated with Group Policy is the unexpected setting of Group Policy options. In Windows Server 2000, administrators spent countless hours analyzing inheritance hierarchy and individual settings to determine why a particular user or computer was having policy problems. For instance, say a user named wpanek complains that the Run option is missing from his Start menu. The wpanek user account is stored in the New Hampshire OU, and you've applied group policies at the OU, domain, and site levels. To determine the source of the problem, you would have to sift through each GPO manually to find the Start menu policy as well as to figure out the applicable inheritance settings.
Windows Server 2012 R2 has a handy feature called _Resultant Set of Policy (RSoP)_ that displays the exact settings that actually apply to individual users, computers, OUs, domains, and sites after inheritance and filtering have taken effect. In the example just described, you could run RSoP on the wpanek account and view a single set of Group Policy settings that represent the settings that apply to that account. In addition, each setting's Properties dialog box displays the GPO from which the setting is derived as well as the order of priority, the filter status, and other useful information, as you will see a bit later.
**RSoP** actually runs in two modes.
Logging Mode _Logging mode_ displays the actual settings that apply to users and computers, as shown in the example in the preceding paragraph.
Planning Mode _Planning mode_ can be applied to users, computers, OUs, domains, and sites, and you use it before you apply any settings. As its name implies, planning mode is used to plan GPOs.
Additionally, you can run the command-line utility `gpresult.exe` to get a quick snapshot of the Group Policy settings that apply to a user and/or computer. Let's take a closer look at the two modes and the `gpresult.exe` command.
### RSoP in Logging Mode
RSoP in logging mode can query policy settings only for users and computers. The easiest way to access RSoP in logging mode is through the Active Directory Users and Computers tool, although you can run it as a stand-alone MMC snap-in if you want.
To analyze the policy settings for wpanek from the earlier example, you would right-click the user icon in Active Directory Users and Computers and select All Tasks Resultant Set of Policy (Logging). The Group Policy Results Wizard appears. The wizard walks you through the steps necessary to view the RSoP for wpanek.
The Computer Selection page, shown in Figure 6.16, requires you to select a computer for which to display settings. Remember that a GPO contains both user and computer settings, so you must choose a computer to which the user is logged on in order to continue with the wizard. If the user has never logged on to a computer, then you must run RSoP in planning mode because there is no logged policy information yet for that user.
**FIGURE 6.16** The Computer Selection page of the Group Policy Results Wizard
The User Selection page, shown in Figure 6.17, requires you to select a user account to analyze. Because I selected a user from the Active Directory Users and Computers tool, the username is filled in automatically. This page is most useful if you are running RSoP in MMC mode and don't have the luxury of selecting a user contextually.
**FIGURE 6.17** The User Selection page of the Group Policy Results Wizard
The Summary Of Selections page, shown in Figure 6.18, summarizes your choices and provides an option for gathering extended error information. If you need to make any changes before you begin to analyze the policy settings, you should click the Back button on the Summary screen. Otherwise, click Next.
**FIGURE 6.18** The Summary Of Selections page of the Group Policy Results Wizard
After the wizard is complete, you will see the window shown in Figure 6.19. This window displays only the policy settings that apply to the user and computer that you selected in the wizard. You can see these users and computers at the topmost level of the tree.
**FIGURE 6.19** The User Selection page for the administrator on computer SERVER1
Any warnings or errors appear as a yellow triangle or red _X_ over the applicable icon at the level where the warning or error occurred. To view more information about the warning or error, right-click the icon and select Properties, as shown in Figure 6.20.
**FIGURE 6.20** Details of event pertaining to the administrator account on computer SERVER1
You cannot make changes to any of the individual settings because RSoP is a diagnostic tool and not an editor, but you can get more information about settings by clicking a setting and selecting Properties from the context menu.
The Details tab of the user's Properties window, shown in Figure 6.21, displays the actual setting that applies to the user in question based on GPO inheritance.
**FIGURE 6.21** The Details tab of the object's Properties window
### RSoP in Planning Mode
Running RSoP in planning mode isn't much different from running RSoP in logging mode, but the RSoP Wizard asks for a bit more information than you saw earlier.
In the former example, wpanek couldn't see the Run option in the Start menu because his user account is affected by the New Hampshire GPO in the San Jose OU. As an administrator, you could plan to move his user account to the North America OU. Before doing so, you could verify his new policy settings by running RSoP in planning mode. Run the RSoP on the user wpanek under the scenario that you've already moved him from the San Jose OU to the North America OU. At this point, you haven't actually moved the user, but you can see what his settings would be if you did.
### Using the _gpresult.exe_ Command
The command-line utility `gpresult.exe` is included as part of the RSoP tool. Running the command by itself without any switches returns the following Group Policy information about the local user and computer:
* The name of the domain controller from which the local machine retrieved the policy information
* The date and time at which the policies were applied
* Which policies were applied
* Which policies were filtered out
* Group membership
You can use the switches shown in Table 6.2 to get information for remote users and computers and to enable other options.
**TABLE 6.2** `gpresult` switches
Switch | Description
---|---
`/S` _`systemname`_ | Generates RSoP information for a remote computer name.
`/USER` _`username`_ | Generates RSoP information for a remote username.
`/x /h filename` | Generates a report in either XML (`/x`) or HTML (`/h`) format. The filename and location is specified by the _`filename`_ parameter.
`/V` | Specifies verbose mode, which displays more verbose information such as user rights information.
`/Z` | Specifies an even greater level of verbose information.
`/SCOPE MACHINE` | Displays maximum information about the computer policies applied to this system.
`/SCOPE USER` | Displays maximum information about the user policies applied to this system.
`>` _`textfile.txt`_ | Writes the output to a text file.
* * *
Table 6.2 is not a complete list. To see a complete list of the `gpresult.exe` command, visit Microsoft at `www.microsoft.com`.
* * *
For example, to obtain information about user wpanek in a system called STELLACON, you would use the command `gpresult/S STELLACON/USERwpanek`.
Through the use of these techniques, you should be able to track down even the most elusive Group Policy problems. Remember, however, that good troubleshooting skills do not replace planning adequately and maintaining GPO settings!
## Summary
In this chapter, you examined Active Directory's solution to a common headache for many systems administrators: policy settings. Specifically, I discussed topics that covered Group Policy.
I covered the fundamentals of Group Policy including its fundamental purpose. You can use Group Policy to enforce granular permissions for users in an Active Directory environment. Group policies can restrict and modify the actions allowed for users and computers within the Active Directory environment.
Certain Group Policy settings may apply to users, computers, or both. Computer settings affect all users who access the machines to which the policy applies. User settings affect users regardless of the machines to which they log on.
You learned that you can link Group Policy objects to Active Directory sites, domains, or OUs. This link determines to which objects the policies apply. GPO links can interact through inheritance and filtering to result in an effective set of policies.
The chapter covered inheritance and how GPOs filter down. I showed you how to use the Enforced option on a GPO issued from a parent and how to block a GPO from a child.
You can also use administrative templates to simplify the creation of GPOs. There are some basic default templates that come with Windows Server 2012 R2.
In addition, administrators can delegate control over GPOs in order to distribute administrative responsibilities. Delegation is an important concept because it allows for distributed administration.
You can also deploy software using GPOs. This feature can save time and increase productivity throughout the entire software management life cycle by automating software installation and removal on client computers. The Windows Installer offers a more robust method for managing installation and removal, and applications that support it can take advantage of new Active Directory features. Make sure you are comfortable using the Windows Installer.
You learned about publishing applications via Active Directory and the difference between publishing and assigning applications. You can assign some applications to users and computers so that they are always available. You can also publish them to users so that the user can install them with minimal effort when required.
You also learned how to prepare for software deployment. Before your users can take advantage of automated software installation, you must set up an installation share and provide the appropriate permissions.
The final portion of the chapter covered the Resultant Set of Policy (RSoP) tool, which you can use in logging mode or planning mode to determine exactly which set of policies applies to users, computers, OUs, domains, and sites.
## Exam Essentials
Understand the purpose of Group Policy. System administrators use Group Policy to enforce granular permissions for users in an Active Directory environment.
Understand user and computer settings. Certain Group Policy settings may apply to users, computers, or both. Computer settings affect all users that access the machines to which the policy applies. User settings affect users, regardless of which machines they log on to.
Know the interactions between Group Policy objects and Active Directory. GPOs can be linked to Active Directory objects. This link determines to which objects the policies apply.
Understand filtering and inheritance interactions between GPOs. For ease of administration, GPOs can interact via inheritance and filtering. It is important to understand these interactions when you are implementing and troubleshooting Group Policy.
Know how Group Policy settings can affect script policies and network settings. You can use special sets of GPOs to manage network configuration settings.
Understand how delegation of administration can be used in an Active Directory environment. Delegation is an important concept because it allows for distributed administration.
Know how to use the Resultant Set of Policy (RSoP) tool to troubleshoot and plan Group Policy. Windows Server 2012 R2 includes the RSoP feature, which you can run in logging mode or planning mode to determine exactly which set of policies applies to users, computers, OUs, domains, and sites.
Identify common problems with the software life cycle. IT professionals face many challenges with client applications, including development, deployment, maintenance, and troubleshooting.
Understand the benefits of the Windows Installer. Using the Windows Installer is an updated way to install applications on Windows-based machines. It offers a more robust method for making the system changes required by applications, and it allows for a cleaner uninstall. Windows Installer–based applications can also take advantage of new Active Directory features.
Understand the difference between publishing and assigning applications. Some applications can be assigned to users and computers so that they are always available. Applications can be published to users so that the user may install the application with a minimal amount of effort when it is required.
Know how to prepare for software deployment. Before your users can take advantage of automated software installation, you must set up an installation share and provide the appropriate permissions.
Know how to configure application settings using Active Directory and Group Policy. Using standard Windows Server 2012 R2 administrative tools, you can create an application policy that meets your requirements. You can use automatic, on-demand installation of applications as well as many other features.
Create application categories to simplify the list of published applications. It's important to group applications by functionality or the users to whom they apply, especially in organizations that support a large number of programs.
## Review Questions
1. You are the network administrator for a large organization that uses Windows Server 2012 R2 domain controllers and DNS servers. All of your client machines currently have the Windows XP operating system. You want to be able to have client computers edit the domain-based GPOs by using the ADMX files that are located in the ADMX Central Store. How do you accomplish this task? (Choose all that apply.)
1. Upgrade your clients to Windows 8.
2. Upgrade your clients to Windows 7.
3. Add the client machines to the ADMX edit utility.
4. In the ADMX store, choose the box Allow All Client Privileges.
2. You work for an organization with a single Windows Server 2012 R2 Active Directory domain. The domain has OUs for Sales, Marketing, Admin, R&D, and Finance. You need only the users in the Finance OU to get Windows Office 2013 installed automatically onto their computers. You create a GPO named OfficeApp. What is the next step in getting all of the Finance users Office 2013?
1. Edit the GPO, and assign the Office application to the user's account. Link the GPO to the Finance OU.
2. Edit the GPO, and assign the Office application to the user's account. Link the GPO to the domain.
3. Edit the GPO, and assign the Office application to the computer account. Link the GPO to the domain.
4. Edit the GPO, and assign the Office application to the computer account. Link the GPO to the Finance OU.
3. You are hired as a consultant to the ABC Company. The owner of the company complains that she continues to have desktop wallpaper that she did not choose. When you speak with the IT team, you find out that a former employee created 20 GPOs and they have not been able to figure out which GPO is changing the owner's desktop wallpaper. How can you resolve this issue?
1. Run the RSoP utility against all forest computer accounts.
2. Run the RSoP utility against the owner's computer account.
3. Run the RSoP utility against the owner's user account.
4. Run the RSoP utility against all domain computer accounts.
4. You are the network administrator for a large organization that has multiple sites and multiple OUs. You have a site named SalesSite that is for the sales building across the street. In the domain, there is an OU for all salespeople called Sales. You set up a GPO for the SalesSite, and you need to be sure that it applies to the Sales OU. The Sales OU GPOs cannot override the SalesSite GPO. What do you do?
1. On the GPO, disable the Block Child Inheritance setting.
2. On the GPO, set the Enforce setting.
3. On the GPO, set the priorities to 1.
4. On the Sales OU, set the Inherit Parent Policy settings.
5. You are the administrator for an organization that has multiple locations. You are running Windows Server 2012 R2, and you have only one domain with multiple OUs set up for each location. One of your locations, Boston, is connected to the main location by a 256Kbps ISDN line. You configure a GPO to assign a sales application to all computers in the entire domain. You have to be sure that Boston users receive the GPO properly. What should you do?
1. Disable the Slow Link Detection setting in the GPO.
2. Link the GPO to the Boston OU.
3. Change the properties of the GPO to publish the application to the Boston OU.
4. Have the users in Boston run the `GPResult/force` command.
6. To disable GPO settings for a specific security group, which of the following permissions should you apply?
1. Deny Write
2. Allow Write
3. Enable Apply Group Policy
4. Deny Apply Group Policy
7. GPOs assigned at which of the following level(s) will override GPO settings at the domain level?
1. OU
2. Site
3. Domain
4. Both OU and site
8. A system administrator wants to ensure that only the GPOs set at the OU level affect the Group Policy settings for objects within the OU. Which option can they use to do this (assuming that all other GPO settings are the defaults)?
1. The Enforced option
2. The Block Policy Inheritance option
3. The Disable option
4. The Deny permission
9. A system administrator is planning to implement Group Policy objects in a new Windows Server 2012 R2 Active Directory environment. In order to meet the needs of the organization, he decides to implement a hierarchical system of Group Policy settings. At which of the following levels is he able to assign Group Policy settings? (Choose all that apply.)
1. Sites
2. Domains
3. Organizational units
4. Local system
10. Ann is a system administrator for a medium-sized Active Directory environment. She has determined that several new applications that will be deployed throughout the organization use registry-based settings. She would like to do the following:
* Control these registry settings using Group Policy
* Create a standard set of options for these applications and allow other system administrators to modify them using the standard Active Directory tools
Which of the following options can she use to meet these requirements? (Choose all that apply.)
1. Implement the inheritance functionality of GPOs.
2. Implement delegation of specific objects within Active Directory.
3. Implement the No Override functionality of GPOs.
4. Create administrative templates.
5. Provide administrative templates to the system administrators who are responsible for creating Group Policy for the applications.
# Chapter 7
Manage Security
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Configuring security policies**
* Configure User Rights Assignment
* Configure Security Options settings
* Configure Security templates
* Configure Audit Policy
* Configure Local Users and Groups
* Configure User Account Control (UAC)
2. **Configuring Windows Firewall**
* Configure rules for multiple profiles using Group Policy
* Configure connection security rules
* Configure Windows Firewall to allow or deny applications, scopes, ports, and users
* Configure authenticated firewall exceptions
* Import and export settings
As an IT Director and Microsoft Trainer, I can explain the importance of every chapter in this book, but some chapters are more important for real-world use. This is one of them.
Setting up security so that only people who need access to resources are the ones who get access to those resources is one of the most important jobs an IT member can have. This helps protect your data from hackers and, believe it or not, your own users.
In this chapter, you will learn how to protect data on your network. I will also discuss how to protect your individual system by using Windows Firewall.
## Managing Security
One of the fundamental design goals for Active Directory is to define a single, centralized repository of users and information resources. Active Directory records information about all of the users, computers, and resources on your network. Each domain acts as a logical boundary, and members of the domain (including workstations, servers, and domain controllers) share information about the objects within them.
The information stored within Active Directory determines which resources are accessible to which users. Through the use of _permissions_ that are assigned to Active Directory objects, you can control all aspects of network security.
You should be sure that you have implemented appropriate access control settings for the file system, network devices, and other resources. Let's look at the various components of network security, which include working with security principals and managing security and permissions, access control lists (ACLs), User Account Control (UAC), and access control entries (ACEs).
* * *
When you are setting up a network, you should always keep in mind that 90 percent of all hacks on a network are internal. This means internal permissions and security (as well as external security) need to be as strong as possible while still allowing users to do their jobs.
* * *
### Understanding Security Principals
_Security principals_ are Active Directory objects that are assigned _security identifiers (SIDs)_. An SID is a unique identifier that is used to manage any object to which permissions can be assigned. Security principals are assigned permissions to perform certain actions and access certain network resources.
The following basic types of Active Directory objects serve as security principals:
User Accounts User accounts identify individual users on your network by including information such as the user's name and their password. User accounts are the fundamental unit of security administration.
Groups There are two main types of groups: _security groups_ and _distribution groups_. Both types can contain user accounts. System administrators use security groups to ease the management of security permissions. They use distribution groups, on the other hand, solely to send email. Distribution groups are not security principals. You'll see the details of groups in the next section.
Computer Accounts _Computer accounts_ identify which client computers are members of particular domains. Because these computers participate in the Active Directory database, system administrators can manage security settings that affect the computer. They use computer accounts to determine whether a computer can join a domain and for authentication purposes. As you'll see later in this chapter, system administrators can also place restrictions on certain computer settings to increase security. These settings apply to the computer and, therefore, also apply to any user who is using it (regardless of the permissions granted to the user account).
Note that other objects, such as organizational units (OUs), do not function as security principals. What this means is that you can apply certain settings (such as Group Policy) on all of the objects within an OU; however, you cannot specifically set permissions with respect to the OU. The purpose of OUs is to organize other Active Directory objects logically based on business needs, add a needed level of control for security, and create an easier way to delegate.
You can manage security by performing the following actions with security principals:
* You can assign them permissions to access various network resources.
* You can give them user rights.
* You can track their actions through auditing (covered later in this chapter).
The major types of security principals—user accounts, groups, and computer accounts—form the basis of the Active Directory security architecture. As a system administrator, you will likely spend a portion of your time managing permissions for these objects.
* * *
It is important to understand that since a unique SID defines each security principal, deleting a security principal is an irreversible process. For example, if you delete a user account and then later re-create one with the same name, you'll need to reassign permissions and group membership settings for the new account. Once a user account is deleted, its SID is deleted.
* * *
Users and groups are two types of fundamental security principals employed for security administration. In the following sections, you'll learn how users and groups interact. You'll also learn about the different types of groups you can create.
#### Types of Groups
When dealing with groups, you should make the distinction between local security principals and domain security principals, as follows:
Local Users and Groups You use _local users and groups_ to assign the permissions necessary to access the local machine. For example, you may assign the permissions you need to reboot a domain controller to a specific domain local group.
Domain Users and Groups _Domain users and groups_ , on the other hand, are used throughout the domain. These objects are available on any of the computers within the Active Directory domain and between domains that have a trust relationship.
Here are the two main types of groups used in Active Directory:
1. Security Groups _Security groups_ are considered security principals. They can contain user accounts, computers, or groups. To make administration simpler, system administrators usually grant permissions to groups. This allows you to change permissions easily at the Active Directory level (instead of at the level of the resource on which the permissions are assigned).
2. You can also place Active Directory Contact objects within security groups, but security permissions will not apply to them.
3. Distribution Groups Distribution groups are not considered security principals because they do not have SIDs. As mentioned earlier, they are used only for the purpose of sending email messages. You can add users to distribution groups just as you would add them to security groups. You can also place distribution groups within OUs so that they are easier to manage. You will find them useful, for example, if you need to send email messages to an entire department or business unit within Active Directory.
Understanding the differences between security and distribution groups is important in an Active Directory environment. For the most part, system administrators use security groups for the daily administration of permissions. On the other hand, system administrators who are responsible for maintaining email distribution lists generally use distribution groups to group members of departments and business units logically. (A system administrator can also email all of the users within a security group, but to do so, they would have to specify the email addresses for the accounts.)
When you are working in Windows Server 2003, Server 2008, Server 2008 R2, Windows Server 2012, or Windows Server 2012 R2 functional-level domains, you can convert security groups to or from distribution groups.
* * *
It is vital that you understand group types when you are getting ready to take the Microsoft exams. Microsoft likes to include trick questions about putting permissions on distribution groups. Remember, only security groups can have permissions assigned to them.
* * *
#### Group Scope
In addition to being classified by type, each group is given a specific scope. The scope of a group defines two characteristics. First, it determines the level of security that applies to a group. Second, it determines which users can be added to the group. _Group scope_ is an important concept in network environments because it ultimately defines which resources users are able to access.
The three types of group scope are as follows:
Domain Local The scope of _domain local groups_ extends as far as the local domain. When you're using the Active Directory Users and Computers tool, domain local accounts apply to the computer for which you are viewing information. Domain local groups are used to assign permissions to local resources, such as files and printers. They can contain domain locals, global groups, universal groups, and user accounts.
Global The scope of _global groups_ is limited to a single domain. Global groups may contain any of the users who are a part of the Active Directory domain in which the global groups reside or other global groups. Global groups are often used for managing domain security permissions based on job functions. For example, if you need to specify permissions for the Engineering department, you could create one or more global groups (such as EngineeringManagers and EngineeringDevelopers). You could then assign security permissions to each group.
Universal _Universal groups_ can contain accounts or other universal groups from any domains within an Active Directory forest. Therefore, system administrators use them to manage security across domains. When you are managing multiple domains, it often helps to group global groups within universal groups. For instance, if you have an Engineering global group in the `research.stellacon.com` domain and an Engineering global group in the `asia.stellacon.com` domain, you can create a universal AllEngineers group that contains both of the global groups. Now whenever you must assign security permissions to all engineers within the organization, you need only assign permissions to the AllEngineers universal group.
For domain controllers to process authentication between domains, information about the membership of universal groups is stored in the global catalog (GC). Keep this in mind if you ever plan to place users directly into universal groups and bypass global groups because all of the users will be enumerated in the GC, which will impact size and performance.
Fortunately, universal group credentials are cached on domain controllers that universal group members use to log on. This process is called universal group membership caching. The domain controller obtains the cached data whenever universal group members log on, and then it is retained on the domain controller for eight hours by default. This is especially useful for smaller locations, such as branch offices, that run less expensive domain controllers. Most domain controllers at these locations cannot store a copy of the entire GC, and frequent calls to the nearest GC would require an inordinate amount of network traffic.
When you create a new group using the Active Directory Users and Computers tool, you must specify the scope of the group. Figure 7.1 shows the New Object – Group dialog box and the available options for the group scope.
**FIGURE 7.1** The New Object – Group dialog box
Changing group scope, however, can be helpful when your security administration or business needs change. You can change group scope easily using the Active Directory Users and Computers tool. To do so, access the properties of the group. As shown in Figure 7.2, you can make a group scope change by clicking one of the options.
**FIGURE 7.2** The Sales Security Group's Properties dialog box
#### Built-in Domain Local Groups
System administrators use built-in domain local groups to perform administrative functions on the local server. Because these have pre-assigned permissions and privileges, they allow system administrators to assign common management functions easily. Figure 7.3 shows the default built-in groups that are available on a Windows Server 2012 R2 domain controller.
**FIGURE 7.3** Default built-in local groups
The list of built-in local groups includes some of the following:
Account Operators These users can create and modify domain user and group accounts. Members of this group are generally responsible for the daily administration of Active Directory.
Administrators By default, members of the Administrators group are given full permissions to perform any functions within the Active Directory domain and on the local computer. This means they can access all files and resources that reside on any server within the domain. As you can see, this is a powerful account.
In general, you should restrict the number of users who are included in this group because most common administration functions do not require this level of access.
Backup Operators One of the problems associated with backing up data in a secure network environment is that you need to provide a way to bypass standard file system security so that you can copy files. Although you could place users in the Administrators group, doing so usually provides more permissions than necessary. Members of the Backup Operators group can bypass standard file system security for the purpose of backup and recovery only. They cannot, however, directly access or open files within the file system.
Generally, backup software applications and data use the permissions assigned to the Backup Operators group.
Certificate Service DCOM Access Members of the Certificate Service DCOM Access group can connect to certificate authority servers in the enterprise.
Cryptographic Operators Members of the Cryptographic Operators group are authorized to perform cryptographic operations. _Cryptography_ allows the use of codes to convert data, which then allows a specific recipient to read it using a key.
Guests Typically, you use the Guests group to provide access to resources that generally do not require security. For example, if you have a network share that provides files that should be made available to all network users, you can assign permissions to allow members of the Guests group to access those files.
Print Operators By default, members of the Print Operators group are given permissions to administer all of the printers within a domain. This includes common functions such as changing the priority of print jobs and deleting items from the print queue.
Replicator The Replicator group allows files to be replicated among the computers in a domain. You can add accounts used for replication-related tasks to this group to provide those accounts with the permissions they need to keep files synchronized across multiple computers.
Server Operators A common administrative task is managing server configuration. Members of the Server Operators group are granted the permissions they need to manage services, shares, and other system settings.
Users The Users built-in domain local group is used to administer security for most network accounts. Usually, you don't give this group many permissions, and you use it to apply security settings for most employees within an organization.
Windows Server 2012 R2 also includes many different default groups, which you can find in the `Users` folder. As shown in Figure 7.4, these groups are of varying scopes, including domain local, global, and universal groups. You'll see the details of these groups in the next section.
**FIGURE 7.4** Contents of the default `Users` folder
Three important user accounts are created during the promotion of a domain controller, described here:
Administrator Account The Administrator account is assigned the password a system administrator provides during the promotion process, and it has full permissions to perform all actions within the domain.
Guest Account The Guest account is disabled by default. The purpose of the _Guest account_ is to provide anonymous access to users who do not have an individual logon and password to use within the domain. Although the Guest account might be useful in some situations, it is generally recommended that this account be disabled to increase security.
Krbtgt, or Key Distribution Center Service, Account Only the operating system uses the _krbtgt_ , or _Key Distribution Center Service_ , _account_ for Kerberos authentication while it is using `DCPromo.exe`. This account is disabled by default. Unlike other user accounts, the krbtgt account cannot be used to log on to the domain, and therefore it does not need to be enabled. Since only the operating system uses this account, you do not need to worry about hackers gaining access by using this account.
#### Predefined Global Groups
As mentioned earlier in this chapter, you use global groups to manage permissions at the domain level. Members of each of these groups can perform specific tasks related to managing Active Directory.
The following predefined global groups are installed in the `Users` folder:
Cert Publishers Certificates are used to increase security by allowing for strong authentication methods. User accounts are placed within the _Cert Publishers group_ if they must publish security certificates. Generally, Active Directory security services use these accounts.
Domain Computers All of the computers that are members of the domain are generally members of the _Domain Computers group_. This includes any workstations or servers that have joined the domain, but it does not include the domain controllers.
Domain Admins Members of the _Domain Admins group_ have full permissions to manage all of the Active Directory objects for this domain. This is a powerful account; therefore, you should restrict its membership only to those users who require full permissions.
Domain Controllers All of the domain controllers for a given domain are generally included within the _Domain Controllers group_.
Domain Guests Generally, by default, members of the _Domain Guests group_ are given minimal permissions with respect to resources. System administrators may place user accounts in this group if they require only basic access or temporary permissions within the domain.
Domain Users The _Domain Users group_ usually contains all of the user accounts for the given domain. This group is generally given basic permissions to resources that do not require higher levels of security. A common example is a public file share.
Enterprise Admins Members of the _Enterprise Admins group_ are given full permissions to perform actions within the entire forest. This includes functions such as managing trust relationships and adding new domains to trees and forests.
Group Policy Creator Owners Members of the _Group Policy Creator Owners group_ are able to create and modify Group Policy settings for objects within the domain. This allows them to enable security settings on OUs (and the objects they contain).
Schema Admins Members of the _Schema Admins group_ are given permissions to modify the Active Directory schema. As a member of Schema Admins, you can create additional fields of information for user accounts. This is a powerful function because any changes to the schema will be propagated to all the domains and domain controllers within an Active Directory forest. Furthermore, you cannot undo changes to the schema (although you can disable some).
In addition to these groups, you can create new ones for specific services and applications that are installed on the server. Specifically, services that run on domain controllers and servers will be created as security groups with domain local scope. For example, if a domain controller is running the DNS service, the DnsAdmins and DnsUpdateProxy groups become available. In addition, there are two read-only domain controller (RODC) local groups: the Allowed RODC Password Replication and the Denied RODC Password Replication groups. Similarly, if you install the DHCP service, it automatically creates the DHCP Users and DHCP Administrators groups. The purpose of these groups depends on the functionality of the applications being installed.
#### Foreign Security Principals
In environments that have more than one domain, you may need to grant permissions to users who reside in multiple domains. Generally, you manage this using Active Directory trees and forests. However, in some cases, you may want to provide resources to users who belong to domains that are not part of the forest.
Active Directory uses the concept of _foreign security principals_ to allow permissions to be assigned to users who are not part of an Active Directory forest. This process is automatic and does not require the intervention of system administrators. You can then add the foreign security principals to domain local groups for which, in turn, you can grant permissions for resources within the domain. You can view a list of foreign security principals by using the Active Directory Users and Computers tool. Figure 7.5 shows the contents of the `ForeignSecurityPrincipals` folder.
**FIGURE 7.5** The `ForeignSecurityPrincipals` folder
### Managing Security and Permissions
Now that you understand the basic issues, terms, and Active Directory objects that pertain to security, it's time to look at how you can apply this information to secure your network resources. The general practice for managing security is to assign users to groups and then grant permissions and logon parameters to the groups so that they can access certain resources.
For management ease and to implement a hierarchical structure, you can place groups within OUs. You can also assign Group Policy settings to all of the objects contained within an OU. By using this method, you can combine the benefits of a hierarchical structure (through OUs) with the use of security principals. Figure 7.6 provides a diagram of this process.
**FIGURE 7.6** An overview of security management
The primary tool you use to manage security permissions for users, groups, and computers is the Active Directory Users and Computers tool. Using this tool, you can create and manage Active Directory objects and organize them based on your business needs. Common tasks for many system administrators might include the following:
* Resetting a user's password (for example, in cases where they forget their password)
* Creating new user accounts (when, for instance, a new employee joins the company)
* Modifying group memberships based on changes in job requirements and functions
* Disabling user accounts (when, for example, users will be out of the office for long periods of time and will not require network resource access)
Once you've properly grouped your users, you need to set the actual permissions that affect the objects within Active Directory. The actual permissions available vary based on the type of object. Table 7.1 provides an example of some of the permissions that you can apply to various Active Directory objects and an explanation of what each permission does.
**TABLE 7.1** Permissions of Active Directory objects
Permission | Explanation
---|---
Control Access | Changes security permissions on the object
Create Child | Creates objects within an OU (such as other OUs)
Delete Child | Deletes child objects within an OU
Delete Tree | Deletes an OU and the objects within it
List Contents | Views objects within an OU
List Object | Views a list of the objects within an OU
Read | Views properties of an object (such as a username)
Write | Modifies properties of an object
### Using ACLs and ACEs
Each object in Active Directory has an _access control list (ACL)_. The ACL is a list of user accounts and groups that are allowed to access the resource. For each ACL, there is an access control entry (ACE) that defines what a user or a group can actually do with the resource. Deny permissions are always listed first. This means that if users have Deny permissions through user or group membership, they will not be allowed to access the object, even if they have explicit Allow permissions through other user or group permissions. Figure 7.7 shows an ACL for the Sales OU.
**FIGURE 7.7** The ACL for an OU named Sales
* * *
The Security tab is enabled only if you selected the Advanced Features option from the View menu in the Active Directory Users and Computers tool.
* * *
### Configuring User Account Control
One issue that many users have run into is as follows: When they log into their standard Windows user account and they need to make a change on their local machines or run a program that requires a higher level of security, they can't complete the task. This is where User Account Controls can help.
_User Account Control (UAC)_ allows your domain users to log into their machines using their standard Windows user account and then execute processes that may require additional user group access.
Some applications may require additional security permissions to run successfully. These types of programs are normally referred to as _legacy applications_. Some applications, however, such as installing new software or making configuration changes, require more permissions than what is available to a standard user account. This is where UAC can help.
When an executable or program needs to function properly with more than just standard user rights, UAC can give that user's token additional user groups. This token allows the executable or program to function properly by giving the standard user account the rights to complete the task.
To configure the UAC, an administrator can go into the system's Control Panel and then User Accounts. Inside the User Accounts snap-in, choose Change User Account Control Settings.
### Delegating Control of Users and Groups
A common administrative function related to the use of Active Directory involves managing users and groups. You can use OUs to group objects logically so that you can easily manage them. Once you have placed the appropriate Active Directory objects within OUs, you are ready to delegate control of these objects.
_Delegation_ is the process by which a higher-level security administrator assigns permissions to other users. For example, if Admin A is a member of the Domain Admins group, they are able to delegate control of any OU within the domain to Admin B. You can access the Delegation Of Control Wizard through the Active Directory Users and Computers tool. You can use it to perform common delegation tasks quickly and easily. The wizard walks you through the steps of selecting the objects for which you want to perform delegation, what permission you want to allow, and which users will have those permissions.
Exercise 7.1 walks through the steps required to delegate control of OUs.
* * *
### EXERCISE 7.1: Delegating Control of Active Directory Objects
1. Open the Active Directory Users and Computers tool.
2. Create a new user within the Engineering OU using the following information (use the default settings for any fields not specified):
First Name: Robert
Last Name: **Admin**
User Logon Name: radmin
Password: P@ssw0rd
3. Right-click the Sales OU and select Delegate Control. This starts the Delegation Of Control Wizard. Click Next.
4. To add users and groups to which you want to delegate control, click the Add button. In the Add dialog box, enter Robert Admin for the name of the user to add. Note that you can specify multiple users or groups using this option.
5. Click OK to add the account to the delegation list, which is shown in the Users Or Groups page. Click Next to continue.
6. On the Tasks To Delegate page, you must specify which actions you want to allow the selected user to perform within this OU. Select the Delegate The Following Common Tasks option and place a check mark next to the following options:
Create, Delete, And Manage User Accounts
Reset User Passwords And Force Password Change At Next Logon
Read All User Information
Create, Delete And Manage Groups
Modify The Membership Of A Group
7. Click Next to continue. The wizard provides you with a summary of the selections that you have made on the Completing The Delegation Of Control Wizard page. To complete the process, click Finish to have the wizard commit the changes.
Now when the user Robert Admin logs on (using radmin as his logon name), he will be able to perform common administrative functions for all the objects contained within the Sales OU.
8. When you have finished, close the Active Directory Users and Computers tool.
* * *
### Understanding Dynamic Access Control
One of the advantages of Windows Server 2012 R2 is the ability to apply data governance to your file server. This will help control who has access to information and auditing. You get these advantages through the use of Dynamic Access Control (DAC). DAC allows you to identify data by using data classifications (both automatic and manual) and then to control access to these files based on these classifications.
DAC also gives administrators the ability to control file access by using a central access policy. This central access policy will also allow an administrator to set up audit access to files for reporting and forensic investigation.
DAC allows an administrator to set up Active Directory Rights Management Service (AD RMS) encryption for Microsoft Office documents. For example, you can set up encryption for any documents that contain financial information.
DAC gives an administrator the flexibility to configure file access and auditing to domain-based file servers. To do this, DAC controls claims in the authentication token, resource properties, and conditional expressions within permission and auditing entries.
Administrators have the ability to give users access to files and folders based on Active Directory attributes. For example, a user named Dana is given access to the file server share because in the user's Active Directory (department attribute) properties, the value contains the value Sales.
* * *
For DAC to function properly, an administrator must enable Windows 8 computers and Windows Server 2012/2012 R2 file servers to support claims and compound authentication.
* * *
### Using Group Policy for Security
Through the use of Group Policy settings, system administrators can assign thousands of different settings and options for users, groups, and OUs. Specifically, in relation to security, you can use many different options to control how important features, such as password policies, user rights, and account lockout settings, can be configured.
The general process for making these settings is to create a Group Policy object (GPO) with the settings that you want and then link it to an OU or other Active Directory object.
Table 7.2 lists many Group Policy settings, which are relevant to creating a secure Active Directory environment. Note that this list is not comprehensive—many other options are available through Windows Server 2012 R2 administrative tools.
**TABLE 7.2** Group Policy settings used for security purposes
Setting section | Setting name | Purpose
---|---|---
Account Policies Password Policy | Enforce Password History | Specifies how many passwords will be remembered. This option prevents users from reusing the same passwords whenever they're changed.
Account Policies Password Policy | Minimum Password Length | Prevents users from using short, weak passwords by specifying the minimum number of characters that the password must include.
Account Policies Account Lockout Policy | Account Lockout Threshold | Specifies how many bad password attempts can be entered before the account gets locked out.
Account Policies Account Lockout Policy | Account Lockout Duration | Specifies how long an account will remain locked out after too many bad password attempts have been entered. By setting this option to a reasonable value (such as 30 minutes), you can reduce administrative overhead while still maintaining fairly strong security.
Account Policies Account Lockout Policy | Reset Account Lockout Counter After | Specifies how long the Account Lockout Threshold counter will hold failed logon attempts before resetting to 0.
Local Policies Security Options | Accounts: Rename Administrator Account | Often, when trying to gain unauthorized access to a computer, individuals attempt to guess the administrator password. One method for increasing security is to rename this account so that no password allows entry using this logon.
Local Policies Security Options | Domain Controller: Allow Server Operators To Schedule Tasks | This option specifies whether members of the built-in Server Operators group are allowed to schedule tasks on the server.
Local Policies Security Options | Interactive Logon: Do Not Display Last User Name | Increases security by not displaying the name of the last user who logged onto the system.
Local Policies Security Options | Shutdown: Allow System To Be Shut Down Without Having To Log On | Allows system administrators to perform remote shutdown operations without logging on to the server.
## Implementing an Audit Policy
One of the most important aspects of controlling security in networked environments is ensuring that only authorized users are able to access specific resources. Although system administrators often spend much time managing security permissions, it is almost always possible for a security problem to occur.
Sometimes, the best way to find possible security breaches is actually to record the actions that specific users take. Then, in the case of a security breach (the unauthorized shutdown of a server, for example), system administrators can examine the log to find the cause of the problem.
The Windows Server 2012 R2 operating system and Active Directory offer you the ability to audit a wide range of actions. In the following sections, you'll see how to implement auditing for Active Directory.
### Overview of Auditing
The act of _auditing_ relates to recording specific actions. From a security standpoint, auditing is used to detect any possible misuse of network resources. Although auditing does not necessarily prevent resources from being misused, it does help determine when security violations have occurred (or were attempted). Furthermore, just the fact that others know that you have implemented auditing may prevent them from attempting to circumvent security.
You need to complete several steps in order to implement auditing using Windows Server 2012 R2:
1. Configure the size and storage settings for the audit logs.
2. Enable categories of events to audit.
3. Specify which objects and actions should be recorded in the audit log.
Note that there are trade-offs to implementing auditing. First, recording auditing information can consume system resources. This can decrease overall system performance and use up valuable disk space. Second, auditing many events can make the audit log impractical to view. If too much detail is provided, system administrators are unlikely to scrutinize all of the recorded events. For these reasons, you should always be sure to find a balance between the level of auditing details provided and the performance-management implications of these settings.
### Implementing Auditing
Auditing is not an all-or-none type of process. As is the case with security in general, system administrators must choose specifically which objects and actions they want to audit.
The main categories for auditing include the following:
* Audit account logon events
* Audit account management
* Audit directory service access
* Audit logon events
* Audit object access
* Audit policy change
* Audit privilege use
* Audit process tracking
* Audit system events
In this list of categories, four of the categories are related to Active Directory. Let's discuss these auditing categories in a bit more detail.
Audit Account Logon Events You enable this auditing event if you want to audit when a user authenticates with a domain controller and logs onto the domain. This event is logged in the security log on the domain controller.
Audit Account Management This auditing event is used when you want to watch what changes are being made to Active Directory accounts. For example, when another administrator creates or deletes a user account, it would be an audited event.
Audit Directory Service Access This auditing event occurs whenever a user or administrator accesses Active Directory objects. Let's say that an administrator opens Active Directory and clicks a user account; even if nothing is changed on that account, an event is logged.
Audit Logon Events Account logon events are created for domain account activity. For example, you have a user who logs on to a server so that they can access files; the act of logging onto the server creates this audit event.
Audit Object Access Audit object access allows you to audit objects within your network such as folders, files, and printers. If you suspect someone is trying to hack into an object (for example, the `finance` folder), this is the type of auditing that you would use. You still would need to enable auditing on the actual object (for example, the `finance` folder).
Audit Policy Change Audit policy change allows you to audit changes to user rights assignment policies, audit policies, or trust policies. This auditing allows you to see whether anyone changes any of the other audit policies.
Audit Privilege Use Setting the audit privilege use allows an administrator to audit each instance of a user exercising a user right. For example, if a user changes the system time on a machine, this is a user right. Logging on locally is another common user right.
To audit access to objects stored within Active Directory, you must enable the Audit Directory Service Access option. Then you must specify which objects and actions should be tracked.
Exercise 7.2 walks through the steps you must take to implement auditing of Active Directory objects on domain controllers.
* * *
### EXERCISE 7.2: Enabling Auditing of Active Directory Objects
1. Open the Local Security Policy tool (located in the Administrative Tools program group).
2. Expand Local Policies Audit Policy.
3. Double-click the setting for Audit Directory Service Access.
4. In the Audit Directory Service Access Properties dialog box, place check marks next to Success and Failure. Click OK to save the settings.
5. Close the Local Security Policy tool.
* * *
### Using the _Auditpol.exe_ Command
There may be a time when you need to look at your actual auditing policies set on a user or a system. This is where an administrator can use the `Auditpol.exe` command. _Auditpol_ allows administrators the ability not only to view an audit policy but also to set, configure, modify, restore, and even remove an audit policy. Auditpol is a command-line utility, and there are multiple switches that can be used with Auditpol. The following is the syntax used with Auditpol; Table 7.3 describes some of the switches:
**TABLE 7.3** Auditpol commands
Command | Description
---|---
`/backup` | Allows an administrator to save the audit policy to a file
`/clear` | Allows an administrator to clear an audit policy
`/get` | Gives administrators the ability to view the current audit policy
`/list` | Allows you to view selectable policy elements
`/remove` | Removes all per-user audit policy settings and disables all system audit policy settings
`/restore` | Allows an administrator to restore an audit policy from a file that was previously created by using `auditpol /backup`
`/set` | Gives an administrator the ability to set an audit policy
`/?` | Displays help
Auditpol command [<sub-command><options>]
Here's an example:
Auditpol /get /user:wpanek /category:"Detailed Tracking" /r
### Features of Windows Server 2012 R2 Auditing
Microsoft continues to increase the level of detail in the security auditing logs. Microsoft has also simplified the deployment and management of auditing policies. The following list includes some of the features:
Global Object Access Auditing Administrators using Windows Server 2012 R2 and Windows 8 now have the ability to define computer-wide system access control lists (SACLs). Administrators can define SACLs for either the file system or the registry. After the specified SACL is defined, the SACL is then applied automatically to every object of that type. This can be helpful to administrators for verifying that all critical files, folders, and registry settings on a computer are protected. This is also helpful for identifying when an issue occurs with a system resource.
"Reason For Access" Reporting When an administrator is performing auditing in Windows Server 2012 R2 and Windows 8, they can now see the reason why an operation was successful or unsuccessful. Previously, they lacked the ability to see the reason why an operation succeeded or failed.
Advanced Audit Policy Settings In Windows Server 2012 R2, there are many new Advanced Audit Policy settings that can be used in place of the nine basic auditing settings. These advanced audit settings also help eliminate the unnecessary auditing activities that can make audit logs difficult to manage and decipher.
Expression-Based Audit Policies Administrators have the ability, because of Dynamic Access Control, to create targeted audit policies by using expressions based on user, computer, and resource claims. For example, an administrator has the ability to create an audit policy that tracks all Read and Write operations for files that are considered high-business impact. Expression-based audit policies can be directly created on a file or folder or created through the use of a Group Policy.
Removable Storage Device Auditing Administrators have the ability to monitor attempts to use a removable storage device on your network. If an administrator decides to implement this policy, an audit event is created every time one of your users attempts to copy, move, or save a network resource onto a removable storage device.
## Configuring Windows Firewall Options
Another security aspect to look into is Windows Firewall. Before I can start talking about firewall options, you must first understand what a firewall does. A _firewall_ is a software or hardware device that checks the information that is received from an outside (Internet) or external network and uses that information to determine whether the packet should be accepted or declined.
Depending on the firewall, you have the ability to check all potential remote users against Active Directory to verify that the remote user has an authorized domain account. This process is called _Active Directory account integration_.
Microsoft Windows Server 2012 R2 has a built-in firewall. The following are some of the configuration options included in the Windows Firewall Settings dialog box:
Domain Profile Tab On the Domain Profile tab, you have the ability to turn the firewall on or off by using the Firewall State drop-down menu. When setting the Firewall State option on this tab, it's for turning the firewall on or off for the domain only. When turning the firewall on, you also have the ability to block inbound and outbound connections (see Figure 7.8). Administrators also have the ability to control the Windows Firewall behavior along with setting up logging.
**FIGURE 7.8** Domain Profile tab of Windows Firewall Settings
Private Profile Tab On the Private Profile tab, you have the ability to turn the firewall on or off by using the Firewall State drop-down menu. When setting the Firewall State in this tab, it's for turning the firewall on or off for the Private Profile only. When turning the firewall on, you also have the ability to block inbound and outbound connections (see Figure 7.9). Administrators also have the ability to control the Windows Firewall Private Profile behavior along with setting up logging.
**FIGURE 7.9** Private Profile tab of Windows Firewall Settings
Public Profile On the Public Profile tab, you have the ability to turn the firewall on or off by using the Firewall State drop-down menu. When setting the Firewall State in this tab, it's for turning the firewall on or off for the Public Profile only. When turning the firewall on, you also have the ability to block inbound and outbound connections (see Figure 7.10). Administrators also have the ability to control the Windows Firewall Public Profile behavior along with setting up logging.
**FIGURE 7.10** Public Profile tab of Windows Firewall
IPsec Settings Tab The IPsec Setting tab allows you to set up the IPsec defaults, IPsec exemptions, and IPsec tunnel authorization. The IPsec defaults button allows you to specify settings used by IPsec to establish secured connections. The IPsec exemptions allow you to set up ICMP exemptions from IPsec. Finally, you can set up IPsec tunnel authorization, which allows you to specify the users and computers that are authorized to establish an IPsec tunnel (see Figure 7.11).
**FIGURE 7.11** IPsec Settings tab of Windows Firewall Settings
Windows Server 2012 R2 takes firewalls a step further than just the normal firewall settings in Control Panel. An MMC snap-in called _Windows Firewall with Advanced Security_ (see Figure 7.12) can block all incoming and outgoing connections based on its configuration.
**FIGURE 7.12** Windows Firewall with Advanced Security snap-in
One of the major advantages to using the Windows Firewall with Advanced Security snap-in is the ability to set firewall configurations on remote computers using group policies. Another advantage to using this MMC is the ability to set up firewalls using IPsec security. Windows Firewall with Advanced Security snap-in allows an administrator to set more in-depth rules for Microsoft Active Directory users and groups, source and destination Internet Protocol (IP) addresses, IP port numbers, ICMP settings, IPsec settings, specific types of interfaces, and services.
You can configure more advanced settings by configuring Windows Firewall with Advanced Security. To access Windows Firewall with Advanced Security, press the Windows key and choose Control Panel Large Icons View Windows Firewall, and click the Advanced Settings link.
The scope pane to the left shows that you can set up specific inbound and outbound rules, connection security rules, and monitoring rules. The central area shows an overview of the firewall's status as well as the current profile settings. Let's take a look at these in more detail.
###
#### Inbound and Outbound Rules
Inbound and outbound rules consist of many preconfigured rules that can be enabled or disabled. Obviously, inbound rules (see Figure 7.13) monitor inbound traffic, and outbound rules monitor outbound traffic. By default, many are disabled. Double-clicking a rule will bring up its Properties dialog box, as shown in Figure 7.14.
**FIGURE 7.13** Inbound rules
**FIGURE 7.14** An inbound rule's Properties dialog box for WSUS
You can filter the rules to make them easier to view. Filtering can be performed based on the profile the rule affects or whether the rule is enabled or disabled or based on the rule group.
If you can't find a rule that is appropriate to your needs, you can create a new rule by right-clicking Inbound Rules or Outbound Rules in the scope pane and then selecting New Rule. The New Inbound (or Outbound) Rule Wizard will launch, and you will be asked whether you want to create a rule based on a particular program, protocol or port, predefined category, or custom settings.
When setting up rules, you can also set up firewall exceptions. These exceptions allow you to work around a particular rule that you may be setting up. Firewall exceptions can be handy when an authenticated user or service needs to get around a firewall setting. These exceptions can be also set under the advanced firewall settings under the Connection Security Rules link.
Exercise 7.3 will walk you through the steps needed to create a new inbound rule that will allow only encrypted TCP traffic. In this exercise, you will have the ability to create a custom rule and then specify which authorized users and computers can connect using this rule.
* * *
### EXERCISE 7.3: Configuring Windows Firewall
1. Press the Windows key and select Control Panel Large Icon View Windows Firewall.
2. Click Advanced Settings on the left side.
3. Right-click Inbound Rules and select New Rule.
4. Choose a rule type. For this exercise, choose Custom so that you can see all of the options available to you; then click Next.
5. Choose the programs or services that are affected by this rule. For this exercise, choose All Programs; then click Next.
6. Choose the protocol type as well as the local and remote port numbers that are affected by this rule. For this exercise, choose TCP and make sure All Ports is selected for both Local Port and Remote Port. Click Next to continue.
7. Choose the local and remote IP addresses that are affected by this rule. Choose Any IP Address for both local and remote; then click Next.
8. Specify whether this rule will allow the connection, allow the connection only if it is secure, or block the connection. Select the option Allow The Connection If It Is Secure; then click Next.
9. Specify whether connections should be allowed only from certain users. You can experiment with these options if you want. Then click Next to continue.
10. Specify whether connections should be allowed only from certain computers. Again, you can experiment with these options if you want. Then click Next to continue.
11. Choose those profiles that will be affected by this rule. Select one or more profiles; then click Next to continue.
12. Give your profile a name and description; then click Finish. Your custom rule will appear in the list of Inbound Rules, and the rule will be enabled.
13. Double-click your newly created rule. Notice that you can change the options you previously configured.
14. Disable the rule by right-clicking the rule and choosing Disable Rule.
15. Close Windows Firewall.
* * *
Now let's take a look at setting up Connection Security Rules through Windows Firewall with Advanced Security.
#### Configuring Windows Firewall with a GPO
If you wanted to configure Windows Firewall on all of your client machines, you have two options. You can either configure each machine manually or set up a GPO to configure the Windows Firewall. To set up the Windows Firewall using a GPO, configure the Computer section Windows Settings Security Windows Firewall With Advanced Security.
One of the advantages of using a GPO when configuring the Windows firewall is that you can configure multiple profiles and multiple firewall settings using the Group Policy.
Another even bigger advantage is being able to configure thousands of computers by setting just one GPO. It saves an IT administrator from going around the company from machine to machine to set up the firewall.
#### Import/Export Policies
One advantage of configuring Windows Firewall is the ability to export and import policy settings. For example, I set up a policy for 35 machines; I created the policy on one of the 35 machines and then exported the policy. I then imported the policy to the other 34 machines so that I did not have to re-create the policy over and over again. To export a policy, right-click Windows Firewall With Advanced Security and choose Export Policy. Choose Import Policy on the other machines to import the policy.
#### IPsec Policy Settings in Windows Firewall
When configuring options for Windows Firewall with Advanced Security, you have the ability to configure some IPsec policies. The three options are as follows:
IPsec Defaults Specify settings used by IPsec to establish secure connections.
IPsec Exemptions Exempting ICMP from all IPsec requirements can simplify troubleshooting of network connectivity issues.
IPsec Tunnel Authorization Specify the computers or users authorized to establish IPsec tunnel connections to this computer.
#### Monitoring
The Monitoring section shows detailed information about the firewall configurations for the Domain Profile, Private Profile, and Public Profile settings. These network location profiles determine which settings are enforced for private networks, public networks, and networks connected to a domain.
* * *
# Firewalls
When I'm consulting, it always makes me laugh when I see small to midsize companies using Microsoft Windows Firewall and no other protection.
Microsoft Windows Firewall should be your _last_ line of defense, not your only one. You need to make sure that you have good hardware firewalls that separate your network from the world.
Also watch Windows Firewall when it comes to printing. I have run into many situations where a printer that needs to talk to the operating system has issues when Windows Firewall is enabled. If this happens, make sure that the printer is allowed in the Allowed Programs section.
* * *
## Summary
In this chapter, you examined server security and saw why it's one of the most important aspects of Windows Server 2012 R2. As a system administrator, Windows security is something that every administrator should be using but many don't know how it works properly.
I explained how to set up groups and group security as well as how to set up the permissions for those groups. I also covered auditing. I showed you how to set up and monitor auditing to see who has successfully, or unsuccessfully, accessed resources, machines, Active Directory, and all aspects of network security.
I finished the chapter by looking into Windows Firewall. I showed you how to configure the firewall and add exclusions and rules. I also showed you how to view and monitor the firewall results.
## Exam Essentials
Understand group types and group scope. The two major types of groups are security and distribution groups, and they have different purposes. Groups can be local, global, or universal. Domain local groups are used to assign permissions to local resources, such as files and printers. The scope of global groups is limited to a single domain. Universal groups can contain users from any domains within an Active Directory forest.
Understand the purpose and permissions of built-in groups. The Active Directory environment includes several built-in local and global groups that are designed to simplify common system administration tasks. For instance, members of the Administrators group are given full permissions to perform any functions within the Active Directory domain and on the local computer.
Understand how to use Group Policy to manage security-related policies. Through the use of Group Policy settings, you can configure password and account-related options. You can also specify to which users, groups, and OUs many of the settings apply.
Understand how to use auditing. Through the use of auditing, an administrator can see who has been successfully and unsuccessfully accessing resources and Active Directory.
Understand Windows Firewall. Windows Server 2012 R2 includes Windows Firewall. Windows Firewall gives you secure access to a machine by allowing or denying which applications or users can access a system.
## Review Questions
1. You are the network administrator for your organization. A new company policy has been released wherein if a user enters their password incorrectly three times within five minutes, they are locked out for 30 minutes. What three actions do you need to set to comply with this policy? (Choose all that apply.)
1. Set Account Lockout Duration to five minutes.
2. Set Account Lockout Duration to 30 minutes.
3. Set the Account Lockout Threshold setting to three invalid logon attempts.
4. Set the Account Lockout Threshold setting to 30 minutes.
5. Set the Reset Account Lockout Counter setting to five minutes.
6. Set the Reset Account Lockout Counter setting to three times.
2. You create a GPO and link it to the Sales OU. You want to monitor users in the Sales OU who connect to the file server. What type of auditing do you enable?
1. Audit Object Access
2. Audit Logon Events
3. Audit System Events
4. Audit Process Tracking
3. Alexis is a system administrator for an Active Directory environment that contains four domains. Recently, several managers have reported suspicions about user activities and have asked her to increase security in the environment. Specifically, the requirements are as follows:
* Audit changes to User objects that are contained within a specific OU.
* Allow a special user account called Audit to view and modify all security-related information about objects in that OU.
Which of the following steps should Alexis take to meet these requirements? (Choose all that apply.)
1. Convert all volumes on which Active Directory information resides to NTFS.
2. Enable auditing with the Active Directory Users and Computers tool.
3. Create a new Active Directory domain and create restrictive permissions for the suspected users within this domain.
4. Reconfigure trust settings using the Active Directory Domains and Trusts tool.
5. Specify auditing options for the OU using the Active Directory Users and Computers tool.
6. Use the Delegation of Control Wizard to grant appropriate permissions to view and modify objects within the OU to the Audit user account.
4. Crystal is a system administrator for an Active Directory environment that is running in Native mode. Recently, several managers have reported suspicions about user activities and have asked her to increase security in the environment. Specifically, the requirements are as follows:
* The accessing of certain sensitive files must be logged.
* Modifications to certain sensitive files must be logged.
* System administrators must be able to provide information about which users accessed sensitive files and when they were accessed.
* All logon attempts for specific shared machines must be recorded.
Which of the following steps should Crystal take to meet these requirements? (Choose all that apply.)
1. Enable auditing with the Computer Management tool.
2. Enable auditing with the Active Directory Users and Computers tool.
3. Enable auditing with the Active Directory Domains and Trusts tool.
4. Enable auditing with the Event Viewer tool.
5. View the audit log using the Event Viewer tool.
6. View auditing information using the Computer Management tool.
7. Enable failure and success auditing settings for specific files stored on NTFS volumes.
8. Enable failure and success auditing settings for logon events on specific computer accounts.
5. You create a GPO and link it to the Sales OU. You want to monitor users in the Sales OU who connect to the file server. What type of auditing do you enable?
1. Audit Object Access
2. Audit Logon Events
3. Audit System Events
4. Audit Process Tracking
# Chapter 8
Configure TCP/IP
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Configure IPv4 and IPv6 addressing**
* Configure IP address options
* Configure IPv4 or IPv6 subnetting
* Configure supernetting
* Configure interoperability between IPv4 and IPv6
* Configure ISATAP
* Configure Teredo
In this chapter, I will discuss the most important protocol used in a Microsoft Windows Server 2012 R2 network: _Transmission Control Protocol/Internet Protocol (TCP/IP)_.
TCP/IP is actually two sets of protocols bundled together: the Transmission Control Protocol (TCP) and the Internet Protocol (IP). TCP/IP is a suite of protocols developed by the U.S. Department of Defense's Advanced Research Projects Agency in 1969.
This chapter is divided into two main topics: First I'll talk about TCP/IP version 4, and then I'll discuss TCP/IP version 6. TCP/IP version 4 is still used in Windows Server 2012 R2, and it was the primary version of TCP/IP in all previous versions of Windows. However, TCP/IP version 6 is the new release of TCP/IP, and it has been incorporated into Windows Server 2012 R2.
## Understanding TCP/IP
I mentioned that TCP/IP is actually two sets of protocols bundled together: TCP and IP. These protocols sit on a four-layer TCP/IP model.
### Details of the TCP/IP Model
The four layers of the TCP/IP model are as follows (see Figure 8.1):
**FIGURE 8.1** TCP/IP model
Application Layer The _Application layer_ is where the applications that use the protocol stack reside. These applications include File Transfer Protocol (FTP), Trivial File Transfer Protocol (TFTP), Simple Mail Transfer Protocol (SMTP), and Hypertext Transfer Protocol (HTTP).
Transport Layer The _Transport layer_ is where the two Transport layer protocols reside. These are TCP and the User Datagram Protocol (UDP). TCP is a connection-oriented protocol, and delivery is guaranteed. UDP is a connectionless protocol. This means that UDP does its best job to deliver the message, but there is no guarantee.
Internet Layer The _Internet layer_ is where IP resides. _IP_ is a connectionless protocol that relies on the upper layer (Transport layer) for guaranteeing delivery. _Address Resolution Protocol (ARP)_ also resides on this layer. ARP turns an IP address into a Media Access Control (MAC) address. All upper and lower layers travel through the IP protocol.
Link Layer The data link protocols like Ethernet and Token Ring reside in the _Link layer_. This layer is also referred to as the _Network Access layer_.
### How TCP/IP Layers Communicate
When an application like FTP is called upon, the application moves down the layers and TCP is retrieved. TCP then connects itself to the IP protocol and gets released onto the network through the Link layer (see Figure 8.2). This is a connection-oriented protocol because TCP is the protocol that guarantees delivery.
**FIGURE 8.2** TCP/IP process
When an application like TFTP gets called, the application moves down the layers and UDP is retrieved. UDP then connects itself to the IP protocol and gets released onto the network through the Link layer. This is a connectionless protocol because UDP does not have guaranteed delivery.
### Understanding Port Numbers
TCP and UDP rely on port numbers assigned by the _Internet Assigned Numbers Authority (IANA)_ to forward packets to the appropriate application process. Port numbers are 16-bit integers that are part of a message header. They identify the application software process with which the packet should be associated. For example, let's say that a client has a copy of Internet Explorer and a copy of Mail open at the same time. Both applications are sending TCP requests across the Internet to retrieve web pages and email, respectively. How does the computer know which return packets to forward to Internet Explorer and which packets to forward to Mail?
When making a connection, the client chooses a source port for the communication that is usually in the range 1024–65535 (or sometimes in the range 1–65535). This source port then communicates with a destination port of 80 or 110 on the server side. Every packet destined for Internet Explorer has a source port number of 80 in the header, and every packet destined for Mail has a source port number of 110 in the header.
Table 8.1 describes the most common port numbers (you might need to know these for the exam). You can visit www.iana.org to get the most current and complete list of port numbers. It's good to become familiar with specific port numbers because it's a benefit to be able to determine from memory the ports that, for example, allow or block specific protocols in a firewall. Allowing only port 80, for instance, does not ensure that all web traffic will be allowed. You must also allow port 443 for certain secure web traffic.
**TABLE 8.1** Common port numbers
Port number | Description
---|---
20 | FTP data
21 | FTP control
23 | Telnet
25 | Simple Mail Transfer Protocol (SMTP)
53 | Domain Name System (DNS)
80 | Hypertext Transfer Protocol (HTTP), Web
88 | Kerberos
110 | Post Office Protocol v3 (POP3)
443 | Secure HTTP (HTTPS)
* * *
Simply because a port is "well known" doesn't mean that a given service must run on it. It's technically valid to run any service on any port, but doing so is usually a bad idea. For example, if you chose to run your web server on TCP port 25, clients would need to type `www.example.com:25` to reach your website from most browsers.
* * *
## Understanding IP Addressing
Understanding IP addressing is critical to understanding how IP works. An IP address is a numeric identifier assigned to each device on an IP network. This type of address is a logical software address that designates the device's location on the network. It isn't the physical hardware address hard-coded in the device's network interface card.
In the following sections, you will see how IP addresses are used to identify uniquely every machine on the network (MAC address).
### The Hierarchical IP Addressing Scheme
An IP address consists of 32 bits of information. These bits are divided into four sections (sometimes called _octets_ or _quads_ ) containing 1 byte (8 bits) each. There are three common methods for specifying an IP address:
* Dotted-decimal, as in 130.57.30.56
* Binary, as in 10000010.00111001.00011110.00111000
* Hexadecimal, as in 82 39 1E 38
All of these examples represent the same IP address.
The 32-bit IP address is a structured, or hierarchical, address as opposed to a flat, or nonhierarchical, address. Although IP could have used either _flat addressing_ or _hierarchical addressing_ , its designers elected to use the latter for a very good reason, as you will now see.
* * *
# Why Hierarchical Addressing Is Used
What's the difference between flat and hierarchical addressing? A good example of a flat addressing scheme is a U.S. state driver's license number. There's no partitioning to it; the range of legal numbers isn't broken up in any meaningful way (say, by county of residence or date of issue). If this method had been used for IP addressing, every machine on the Internet would have needed a totally unique address, just as each driver's license number in a particular state is unique.
The good news about flat addressing is that it can handle a large number of addresses in 32 bits of data, namely, 4.3 billion. A 32-bit address space with two possible values for each position—either 0 (zero) or 1 (one)—gives you 232 values, which equals approximately 4.3 billion.
The bad news—and the reason flat addressing isn't used in IP—relates to routing. If every address were totally unique, every router on the Internet would need to store the address of every other machine on the Internet. It would be fair to say that this would make efficient routing impossible, even if only a fraction of the possible addresses were used.
The solution to this dilemma is to use a hierarchical addressing scheme that breaks the address space into ordered chunks. Telephone numbers are a great example of this type of addressing. The first section of a U.S. telephone number, the area code, designates a very large area. The area code is followed by the prefix, which narrows the scope to a local calling area. The final segment, the customer number, zooms in on the specific connection. By looking at a number such as 603-766-xxxx, you can quickly determine that the number is located in the southern part of New Hampshire (area code 603) in the Portsmouth area (the 766 exchange).
* * *
#### IP Address Structure
IP addressing works the same way. Instead of the entire 32 bits being treated as a unique identifier, one part of the IP address is designated as the network address (or network ID) and the other part as a node address (or host ID), giving it a layered, hierarchical structure. Together, the IP address, the network address, and the node address uniquely identify a device within an IP network.
The network address—the first two sets of numbers in an IP address—uniquely identifies each network. Every machine on the same network shares that network address as part of its IP address, just as the address of every house on a street shares the same street name. In the IP address 130.57.30.56, for example, 130.57 is the network address.
The node address—the second two sets of numbers—is assigned to, and uniquely identifies, each machine in a network, just as each house on the same street has a different house number. This part of the address must be unique because it identifies a particular machine—an individual, as opposed to a network. This number can also be referred to as a _host address_. In the sample IP address 130.57.30.56, the node address is .30.56.
### Understanding Network Classes
The designers of the Internet decided to create classes of networks based on network size. For the small number of networks possessing a very large number of nodes, they created the Class A network. At the other extreme is the Class C network, reserved for the numerous networks with small numbers of nodes. The class of networks in between the very large and very small ones is predictably called the Class B network.
The default subdivision of an IP address into a network and node address is determined by the class designation of your network. Table 8.2 summarizes the three classes of networks, which will be described in more detail in the following sections.
**TABLE 8.2** Network address classes
Class | Mask bits | Leading bit pattern | Decimal range of first octet of IP address | Assignable networks | Maximum nodes per network
---|---|---|---|---|---
A | 8 | 0 | 1–126 | 126 | 16,777,214
B | 16 | 10 | 128–191 | 16,384 | 65,534
C | 24 | 110 | 192–223 | 2,097,152 | 254
* * *
Classless Inter-Domain Routing (CIDR), explained in detail later in this chapter, has effectively done away with these class designations. You will still hear and should still know the meaning behind the class designations of addresses because they are important to understanding IP addressing. However, when you're working with IP addressing in practice, CIDR is more important to know.
* * *
To ensure efficient routing, Internet designers defined a mandate for the leading bits section of the address for each different network class. For example, because a router knows that a Class A network address always starts with a 0, it can quickly apply the default mask, if necessary, after reading only the first bit of the address. Table 8.2 illustrates how the leading bits of a network address are defined. When considering the subnet masking between network and host addresses, the number of bits to mask is important. For example, in a Class A network, 8 bits are masked, making the default subnet mask 255.0.0.0; in a Class C, 24 bits are masked, making the default subnet mask 255.255.255.0.
Some IP addresses are reserved for special purposes and shouldn't be assigned to nodes. Table 8.3 describes some of the reserved IP addresses. See RFC 3330 for others.
**TABLE 8.3** Special network addresses
Address | Function
---|---
Entire IP address set to all 0s | Depending on the mask, this network (that is, the network or subnet of which you are currently a part) or this host on this network.
A routing table entry of all 0s with a mask of all 0s | Used as the default gateway entry. Any destination address masked by all 0s produces a match for the all 0s reference address. Because the mask has no 1s, this is the least desirable entry, but it will be used when no other match exists.
Network address 127 | Reserved for loopback tests. Designates the local node, and it allows that node to send a test packet to itself without generating network traffic.
Node address of all 0s | Used when referencing a network without referring to any specific nodes on that network. Usually used in routing tables.
Node address of all 1s | Broadcast address for all nodes on the specified network, also known as a _directed broadcast_. For example, 128.2.255.255 means all nodes on the Class B network 128.2. Routing this broadcast is configurable on certain routers.
169.254.0.0 with a mask of 255.255.0.0 | The "link-local" block used for autoconfiguration and communication between devices on a single link. Communication cannot occur across routers. Microsoft uses this block for Automatic Private IP Addressing (APIPA).
Entire IP address set to all 1s (same as 255.255.255.255)
10.0.0.0/8
172.16.0.0 to 172.31.255.255 | Broadcast to all nodes on the current network; sometimes called a _limited broadcast_ or an _all-1s broadcast_. This broadcast is not routable.
192.168.0.0/16 | The private-use blocks for Classes A, B, and C. As noted in RFC 1918, the addresses in these blocks must never be allowed into the Internet, making them acceptable for simultaneous use behind NAT servers and non-Internet-connected IP networks.
In the following sections, you will look at the three network types.
#### Class A Networks
In a Class A network, the first byte is the network address, and the three remaining bytes are used for the node addresses. The Class A format is Network.Node.Node.Node.
For example, in the IP address 49.22.102.70, 49 is the network address, and 22.102.70 is the node address. Every machine on this particular network would have the distinctive network address of 49. Within that network, however, you could have a large number of machines.
There are 126 possible Class A network addresses. Why? The length of a Class A network address is 1 byte, and the first bit of that byte is reserved, so 7 bits in the first byte remain available for manipulation. This means that the maximum number of Class A networks is 128. (Each of the 7 bit positions that can be manipulated can be either a 0 or a 1, and this gives you a total of 27 positions, or 128.) But to complicate things further, it was also decided that the network address of all 0s (0000 0000) would be reserved. This means that the actual number of usable Class A network addresses is 128 minus 1, or 127. Also, 127 is a reserved number (a network address of 0 followed by all 1s [0111 1111], so you actually start with 128 addresses minus the 2 reserved, and you're left with 126 possible Class A network addresses.
Each Class A network has 3 bytes (24 bit positions) for the node address of a machine, which means that there are 224, or 16,777,216, unique combinations. Because addresses with the two patterns of all 0s and all 1s in the node bits are reserved, the actual maximum usable number of nodes for a Class A network is 224 minus 2, which equals 16,777,214.
#### Class B Networks
In a Class B network, the first 2 bytes are assigned to the network address, and the remaining 2 bytes are used for node addresses. The format is Network.Network.Node.Node.
For example, in the IP address 130.57.30.56, the network address is 130.57, and the node address is 30.56.
The network address is 2 bytes, so there would be 216 unique combinations. But the Internet designers decided that all Class B networks should start with the binary digits 10. This leaves 14 bit positions to manipulate; therefore, there are 16,384 (or 214) unique Class B networks.
This gives you an easy way to recognize Class B addresses. If the first 2 bits of the first byte can be only 10, that gives you a decimal range from 128 up to 191 in the first octet of the IP address. Remember that you can always easily recognize a Class B network by looking at its first byte, even though there are 16,384 different Class B networks. If the first octet in the address falls between 128 and 191, it is a Class B network, regardless of the value of the second octet.
A Class B network has 2 bytes to use for node addresses. This is 216 minus the two patterns in the reserved-exclusive club (all 0s and all 1s in the node bits) for a total of 65,534 possible node addresses for each Class B network.
#### Class C Networks
The first 3 bytes of a Class C network are dedicated to the network portion of the address, with only 1 byte remaining for the node address. The format is Network.Network.Network.Node.
In the example IP address 198.21.74.102, the network address is 198.21.74, and the node address is 102.
In a Class C network, the first three bit positions are always binary 110. Three bytes, or 24 bits, minus 3 reserved positions leaves 21 positions. There are therefore 221 (or 2,097,152) possible Class C networks.
The lead bit pattern of 110 equates to decimal 192 and runs through 223. Remembering our handy easy-recognition method, this means you can always spot a Class C address if the first byte is in the range 192–223, regardless of the values of the second and third bytes of the IP address.
Each unique Class C network has 1 byte to use for node addresses. This leads to 28, or 256, minus the two special patterns of all 0s and all 1s, for a total of 254 node addresses for each Class C network.
* * *
Class D networks, used for multicasting only, use the address range 224.0.0.0 to 239.255.255.255 and are used, as in broadcasting, as destination addresses only. Class E networks (reserved for future use at this point) cover 240.0.0.0 to 255.255.255.255. Addresses in the Class E range are considered within the experimental range.
* * *
## Subnetting a Network
If an organization is large and has lots of computers or if its computers are geographically dispersed, it makes good sense to divide its colossal network into smaller ones connected by routers. These smaller networks are called _subnets_. The benefits of using subnets are as follows:
Reduced Network Traffic We all appreciate less traffic of any kind, and so do networks. Without routers, packet traffic could choke the entire network. Most traffic will stay on the local network—only packets destined for other networks will pass through the router and to another subnet. This traffic reduction also improves overall performance.
Simplified Management It's easier to identify and isolate network problems in a group of smaller networks connected together than within one gigantic one.
* * *
## Understanding the Benefits of Subnetting
To understand one benefit of subnetting, consider a hotel or office building. Say that a hotel has 1,000 rooms with 75 rooms to a floor. You could start at the first room on the first floor and number it 1; then when you get to the first room on the second floor, you could number it 76 and keep going until you reach room 1,000. But someone looking for room 521 would have to guess on which floor that room is located. If you were to "subnet" the hotel, you would identify the first room on the first floor with the number 101 (1 = Floor 1 and 01 = Room 1), the first room on the second floor with 201, and so on. The guest looking for room 521 would go to the fifth floor and look for room 21.
* * *
An organization with a single network address (comparable to the hotel building mentioned in the sidebar "Understanding the Benefits of Subnetting") can have a subnet address for each individual physical network (comparable to a floor in the hotel building). Each subnet is still part of the shared network address, but it also has an additional identifier denoting its individual subnetwork number. This identifier is called a _subnet address_.
Subnetting solves several addressing problems:
* If an organization has several physical networks but only one IP network address, it can handle the situation by creating subnets.
* Because subnetting allows many physical networks to be grouped together, fewer entries in a routing table are required, notably reducing network overhead.
* These things combine collectively to yield greatly enhanced network efficiency.
The original designers of the Internet Protocol envisioned a small Internet with only tens of networks and hundreds of hosts. Their addressing scheme used a network address for each physical network. As you can imagine, this scheme and the unforeseen growth of the Internet created a few problems. The following are two examples:
Not Enough Addresses A single network address can be used to refer to multiple physical networks, but an organization can request individual network addresses for each one of its physical networks. If all of these requests were granted, there wouldn't be enough addresses to go around.
Gigantic Routing Tables If each router on the Internet needed to know about every physical network, routing tables would be impossibly huge. There would be an overwhelming amount of administrative overhead to maintain those tables, and the resulting physical overhead on the routers would be massive (CPU cycles, memory, disk space, and so on). Because routers exchange routing information with each other, an additional, related consequence is that a terrific overabundance of network traffic would result.
Although there's more than one way to approach these problems, the principal solution is the one that I'll cover in this book—subnetting. As you might guess, _subnetting_ is the process of carving a single IP network into smaller logical subnetworks. This trick is achieved by subdividing the host portion of an IP address to create a subnet address. The actual subdivision is accomplished through the use of a subnet mask (covered later in the chapter).
In the following sections, you will see exactly how to calculate and apply subnetting.
### Implementing Subnetting
Before you can implement subnetting, you need to determine your current requirements and plan on how best to implement your subnet scheme.
#### How to Determine Your Subnetting Requirements
Follow these guidelines to calculate the requirements of your subnet:
1. Determine the number of required network IDs: one for each subnet and one for each wide area network (WAN) connection.
2. Determine the number of required host IDs per subnet: one for each TCP/IP device, including, for example, computers, network printers, and router interfaces.
3. Based on these two data points, create the following:
* One subnet mask for your entire network
* A unique subnet ID for each physical segment
* A range of host IDs for each unique subnet
#### How to Implement Subnetting
Subnetting is implemented by assigning a subnet address to each machine on a given physical network. For example, in Figure 8.3, each machine on subnet 1 has a subnet address of 1.
**FIGURE 8.3** A sample subnet
The default network portion of an IP address can't be altered without encroaching on another administrative domain's address space, unless you are assigned multiple consecutive classful addresses. To maximize the efficient use of the assigned address space, machines on a particular network share the same network address. In Figure 8.3, you can see that all of the Widget Inc. machines have a network address of 130.57. That principle is constant. In subnetting, it's the host address that's manipulated—the network address doesn't change. The subnet address scheme takes a part of the host address and recycles it as a subnet address. Bit positions are stolen from the host address to be used for the subnet identifier. Figure 8.4 shows how an IP address can be given a subnet address.
**FIGURE 8.4** Network vs. host addresses
Because the Widget Inc. network is a Class B network, the first two bytes specify the network address and are shared by all machines on the network, regardless of their particular subnet. Here every machine's address on the subnet must have its third byte read 0000 0001. The fourth byte, the host address, is the unique number that identifies the actual host within that subnet. Figure 8.5 illustrates how a network address and a subnet address can be used together.
**FIGURE 8.5** The network address and its subnet
When implementing subnetting, you need some type of hardware installed onto the network. Most of us will just use a router. But if you do not want to purchase an expensive router, there is another way.
One way that you can implement subnetting is by using a Windows Server 2012 R2 machine with multiple NIC adapters configured with routing enabled on the server. This type of router is called a _multihomed router_. This is an inexpensive way to set up a router using a Microsoft server, but it may not be the best way. Many companies specialize in routers, and these routers offer many more features and more flexibility than a multihomed router.
#### How to Use Subnet Masks
For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the network address. This is accomplished by assigning each machine a subnet mask.
The network administrator creates a 32-bit subnet mask comprising 1s and 0s. The 1s in the subnet mask represent the positions in the IP address that refer to the network and subnet addresses. The 0s represent the positions that refer to the host part of the address. Figure 8.6 illustrates this combination.
**FIGURE 8.6** The subnet mask revealed
In the Widget Inc. example, the first two bytes of the subnet mask are 1s because Widget's network address is a Class B address, formatted as Network.Network.Node.Node. The third byte, normally assigned as part of the host address, is now used to represent the subnet address. Hence, those bit positions are represented with 1s in the subnet mask. The fourth byte is the only part of the example that represents the host address.
The subnet mask can also be expressed using the decimal equivalents of the binary patterns. The binary pattern of 1111 1111 is the same as decimal 255. Consequently, the subnet mask in the example can be denoted in two ways, as shown in Figure 8.7.
**FIGURE 8.7** Different ways to represent the same mask
Not all networks need to have subnets, and therefore they don't need to use custom subnet masks. In this case, they are said to have a _default_ subnet mask. This is basically the same as saying that they don't have any subnets except for the one main subnet on which the network is running. Table 8.4 shows the default subnet masks for the different classes of networks.
**TABLE 8.4** Default subnet masks
Class | Format | Default Subnet Mask
---|---|---
A | Network.Node.Node.Node | 255.0.0.0
B | Network.Network.Node.Node | 255.255.0.0
C | Network.Network.Network.Node | 255.255.255.0
Once the network administrator has created the subnet mask and has assigned it to each machine, the IP software applies the subnet mask to the IP address to determine its subnet address. The word _mask_ carries the implied meaning of "lens" in this case; that is, the IP software looks at its IP address through the lens of its subnet mask to see its subnet address. Figure 8.8 illustrates an IP address being viewed through a subnet mask.
**FIGURE 8.8** Applying the subnet mask
In this example, the IP software learns through the subnet mask that, instead of being part of the host address, the third byte of its IP address is now going to be used as a subnet address. The IP software then looks in its IP address at the bit positions that correspond to the mask, which are 0000 0001.
The final step is for the subnet bit values to be matched up with the binary numbering convention and converted to decimal. In the Widget Inc. example, the binary-to-decimal conversion is simple, as illustrated in Figure 8.9.
**FIGURE 8.9** Converting the subnet mask to decimal
By using the entire third byte of a Class B address as the subnet address, it is easy to set and determine the subnet address. For example, if Widget Inc. wants to have a subnet 6, the third byte of all machines on that subnet will be 0000 0110 (decimal 6 in binary).
Using the entire third byte of a Class B network address for the subnet allows for a fair number of available subnet addresses. One byte dedicated to the subnet provides eight bit positions. Each position can be either a 1 or a 0, so the calculation is 28, or 256. Thus, Widget Inc. can have up to 256 total subnetworks, each with up to 254 hosts.
Although RFC 950 prohibits the use of binary all 0s and all 1s as subnet addresses, today almost all products actually permit this usage. Microsoft's TCP/IP stack allows it, as does the software in most routers (provided you enable this feature, which sometimes is not the case by default). This gives you two additional subnets. However, you should not use a subnet of 0 (all 0s) unless all the software on your network recognizes this convention.
#### How to Calculate the Number of Subnets
The formulas for calculating the maximum number of subnets and the maximum number of hosts per subnet are as follows:
> 2 × number of masked bits in subnet mask = maximum number of subnets
>
> 2 × number of unmasked bits in subnet mask – 2 = maximum number of hosts per subnet
In the formulas, _masked_ refers to bit positions of 1, and _unmasked_ refers to bit positions of 0. The downside to using an entire byte of a node address as your subnet address is that you reduce the possible number of node addresses on each subnet. As explained earlier, without a subnet, a Class B address has 65,534 unique combinations of 1s and 0s that can be used for node addresses. The question then is why would you ever want 65,534 hosts on a single physical network?
The trade-off is acceptable to most who ask themselves this question. If you use an entire byte of the node address for a subnet, you then have only 1 byte for the host addresses, leaving only 254 possible host addresses. If any of your subnets are populated with more than 254 machines, you'll have a problem. To solve it, you would then need to shorten the subnet mask, thereby lengthening the number of host bits and increasing the number of host addresses. This gives you more available host addresses on each subnet. A side effect of this solution is that it shrinks the number of possible subnets.
Figure 8.10 shows an example of using a smaller subnet address. A company called Acme Inc. expects to need a maximum of 14 subnets. In this case, Acme does not need to take an entire byte from the host address for the subnet address. To get its 14 different subnet addresses, it needs to snatch only 4 bits from the host address (24 = 16). The host portion of the address has 12 usable bits remaining (212 – 2 = 4094). Each of Acme's 16 subnets could then potentially have a total of 4,094 host addresses, and 4,094 machines on each subnet should be plenty.
**FIGURE 8.10** An example of a smaller subnet address
### An Easier Way to Apply Subnetting
Now that you have the basics of how to subnet down, you'll learn an easier way. If you have learned a different way and it works for you, stick with it. It does not matter how you get to the finish line, just as long as you get there. But if you are new to subnetting, Figure 8.11 will make it easier for you.
**FIGURE 8.11** TCP/IP v4 subnetting chart
This chart may look intimidating, but it's really simple to use once you have done it a few times.
* * *
Remember that, on this chart, 1s equal subnets, and 0s equal hosts. If you get this confused, you will get wrong answers in the following exercises.
* * *
Watch the Y column on the lower end of the chart. This represents the number of addresses available to you after the two reserved addresses have been removed. The following exercises provide some examples.
* * *
### SUBNET MASK EXERCISE 8.1: Class C, 10 Hosts per Subnet
You have a Class C address, and you require 10 hosts per subnet.
1. Write down the following:
**255.255.255.____**
The blank is the number you need to fill in.
2. Look under the Y column and choose the first number that is larger than 10 (the number of hosts per subnet you need). You should have come up with 14.
3. Move across the page and look at number in the X (Power) column. The power number is 4.
4. Go to the top of the chart and look for the row with exactly four 0s (hosts). Find the number at the beginning of the row.
The number at the beginning of the row is 240. That's your answer. The subnet mask should be 255.255.255.240.
* * *
* * *
### SUBNET MASK EXERCISE 8.2: Class C, 20 Hosts per Subnet
You have a Class C address, and you need 20 hosts per subnet.
1. Write down the following:
**255.255.255.___**
2. Look under the Y column and find the first number that covers 20. (This should be 30.)
3. Go across to the power number (5).
4. Go to the top part of the chart and find the row with exactly five 0s from right to left.
The number at the beginning of the row is 224. Your answer should be 255.255.255.224.
* * *
* * *
### SUBNET MASK EXERCISE 8.3: Class C, Five Subnets
Now you have a Class C address, and you need five subnets. Remember that subnets are represented by 1s in the chart.
1. Write down the following:
**255.255.255.___**
2. Look under the Y column and find the first number that covers 5. (This should be 6.)
3. Go across to the power number. (This should be 3.)
4. Go to the top part of the chart and find out which row has exactly three 1s (remember, 1s are for subnets) from left to right.
Your answer should be 255.255.255.224.
* * *
* * *
### SUBNET MASK EXERCISE 8.4: Class B, 1,500 Hosts per Subnet
This one is a bit harder. You have a Class B address, and you need 1,500 hosts per subnet. Because you have a Class B address, you need to fill in the third octet of numbers. The fourth octet contains eight 0s.
1. Write down the following:
**255.255.___.0**
2. Look at the Y column and find the first number that covers 1,500. (This should be 2,046.)
3. Go across and find the power number. (This should be 11.)
4. Remember, you already have eight 0s in the last octet. So, you need only three more. Find the row with three 0s.
You should come up with an answer of 255.255.248.0. This actually breaks down to 11111111.11111111.11111000.00000000, and that's how you got the 11 zeros.
* * *
* * *
### SUBNET MASK EXERCISE 8.5: Class B, 3,500 Hosts per Subnet
You have a Class B address, and you need 3,500 hosts per subnet.
1. Write down the following:
**255.255.___.0**
2. Look at the Y column and find the first number that covers 3,500. (This should be 4,094.)
3. Go across and find the power number. (This should be 12.)
4. Remember, you already have eight 0s in the last octet, so you need only four more. Count for four zeros from right to left.
You should come up with an answer of 255.255.240.0. Again, this actually breaks down to 11111111.11111111.11110000.00000000, and that's how you got the 12 zeros.
* * *
* * *
If you get a question that gives you both the hosts and the subnets, always figure out the larger number first. Then, depending on the mask you have decided to use, make sure that the lower number is also correct with that mask.
* * *
Now try some more subnet mask exercises using the data that follows:
Class B address | Class B address
---|---
1,000 hosts per subnet | 25 subnets
**Class C address** | **Class B address**
45 hosts per subnet | 4,000 hosts per subnet
192.168.0.0 | **Class B address**
10 subnets | 2,000 hosts per subnet
| 25 subnets
Here are the answers. If any of your answers are wrong, follow the previous examples and try to work through them again.
Class B address | Class B address
---|---
1,000 hosts per subnet 255.255.252.0 | 25 subnets 255.255.248.0
**Class C address** | **Class B address**
45 hosts per subnet 255.255.255.192 | 4,000 hosts per subnet 255.255.240.0
192.168.0.0 | **Class B address**
10 subnets 255.255.255.240 | 2,000 hosts per subnet
| 25 subnets 255.255.248.0
### Applying Subnetting the Traditional Way
Sometimes subnetting can be confusing. After all, it can be quite difficult to remember all of those numbers. You can step back a minute and take a look at the primary classes of networks and how to subnet each one. Let's start with Class C because it uses only 8 bits for the node address, so it's the easiest to calculate. In the following sections, I will explain how to subnet the various types of networks.
#### Subnetting Class C
If you recall, a Class C network uses the first 3 bytes (24 bits) to define the network address. This leaves you 1 byte (8 bits) with which to address hosts. So if you want to create subnets, your options are limited because of the small number of bits available.
If you break down your subnets into chunks smaller than the default Class C, then figuring out the subnet mask, network number, broadcast address, and router address can be confusing. To build a sturdy base for subnetting, study the following techniques for determining these special values for each subnet, but also learn and use the more efficient technique presented in the later section "Quickly Identifying Subnet Characteristics Using CIDR" and the earlier section "An Easier Way to Apply Subnetting." Table 8.5 summarizes how you can break down a Class C network into one, two, four, or eight smaller subnets, and it gives you the subnet masks, network numbers, broadcast addresses, and router addresses. The first three bytes have simply been designated x.y.z. (Note that the table assumes you can use the all-0s and all-1s subnets too.)
**TABLE 8.5** Setting up Class C subnets
Number of desired subnets | Subnet mask | Network number | Router address | Broadcast address | Remaining number of IP addresses
---|---|---|---|---|---
1 | 255.255.255.0 | x.y.z.0 | x.y.z.1 | x.y.z.255 | 253
2 | 255.255.255.128 | x.y.z.0 | x.y.z.1 | x.y.z.127 | 125
| 255.255.255.128 | x.y.z.128 | x.y.z.129 | x.y.z.255 | 125
4 | 255.255.255.192 | x.y.z.0 | x.y.z.1 | x.y.z.63 | 61
| 255.255.255.192 | x.y.z.64 | x.y.z.65 | x.y.z.127 | 61
| 255.255.255.192 | x.y.z.128 | x.y.z.129 | x.y.z.191 | 61
| 255.255.255.192 | x.y.z.192 | x.y.z.193 | x.y.z.255 | 61
8 | 255.255.255.224 | x.y.z.0 | x.y.z.1 | x.y.z.31 | 29
| 255.255.255.224 | x.y.z.32 | x.y.z.33 | x.y.z.63 | 29
| 255.255.255.224 | x.y.z.64 | x.y.z.65 | x.y.z.95 | 29
| 255.255.255.224 | x.y.z.96 | x.y.z.97 | x.y.z.127 | 29
| 255.255.255.224 | x.y.z.128 | x.y.z.129 | x.y.z.159 | 29
| 255.255.255.224 | x.y.z.160 | x.y.z.161 | x.y.z.191 | 29
| 255.255.255.224 | x.y.z.192 | x.y.z.193 | x.y.z.223 | 29
| 255.255.255.224 | x.y.z.224 | x.y.z.225 | x.y.z.255 | 29
For example, suppose you want to chop up a Class C network, 200.211.192. _x_ , into two subnets. As you can see in the table, you'd use a subnet mask of 255.255.255.128 for each subnet. The first subnet would have the network number 200.211.192.0, router address 200.211.192.1, and broadcast address 200.211.192.127. You could assign IP addresses 200.211.192.2 through 200.211.192.126—that's 125 additional different IP addresses.
* * *
Heavily subnetting a network results in the loss of a progressively greater percentage of addresses to the network number, broadcast address, and router address.
* * *
The second subnet would have the network number 200.211.192.128, router address 200.211.192.129, and broadcast address 200.211.192.255.
* * *
## Why It's Best to Use Routers That Support Subnet 0
When subnetting a Class C network using the method in Table 8.5, if you use the 2x – 2 calculation, the subnet 128 in the table doesn't make sense. It turns out that there's a legitimate and popular reason to do it this way, however.
* Remember that using subnet 0 is not allowed according to the RFC standards, but by using it you can subnet your Class C network with a subnet mask of 128. This uses only 1 bit, and according to your calculator 21 – 2 = 0, giving you zero subnets.
* By using routers that support subnet 0, you can assign 1–126 for hosts and 129–254 for hosts, as stated in the table. This saves a bunch of addresses! If you were to stick to the method defined by the RFC standards, the best you could gain is a subnet mask of 192 (2 bits), which allows you only two subnets (22 – 2 = 2).
* * *
##### Determining the Subnet Numbers for a Class C Subnet
The first subnet always has a 0 in the interesting octet. In the example, it would be 200.211.192.0, the same as the original nonsubnetted network address. To determine the subnet numbers for the additional subnets, first you have to determine the incremental value:
1. Begin with the octet that has an interesting value (other than 0 or 255) in the subnet mask. Then subtract the interesting value from 256. The result is the incremental value.
If again you use the network 200.211.192. _x_ and a mask of 255.255.255.192, the example yields the following equation: 256 – 192 = 64. Thus, 64 is your incremental value in the interesting octet—the fourth octet in this case. Why the fourth octet? That's the octet with the interesting value, 192, in the mask.
2. To determine the second subnet number, add the incremental value to the 0 in the fourth octet of the first subnet.
In the example, it would be 200.211.192.64.
3. To determine the third subnet number, add the incremental value to the interesting octet of the second subnet number.
In the example, it would be 200.211.192.128.
4. Keep adding the incremental value in this fashion until you reach the actual subnet mask number.
For example, 0 + 64 = 64, so your second subnet is 64. And 64 + 64 is 128, so your third subnet is 128. And 128 + 64 is 192, so your fourth subnet is 192. Because 192 is the subnet mask, this is your last subnet. If you tried to add 64 again, you'd come up with 256, an unusable octet value, which is always where you end up when you've gone too far. This means your valid subnets are 0, 64, 128, and 192.
The numbers between the subnets are your valid host and broadcast addresses. For example, the following are valid hosts for two of the subnets in a Class C network with a subnet mask of 192:
* The valid hosts for subnet 64 are in the range 65–126, which gives you 62 hosts per subnet.
(You can't use 127 as a host because that would mean your host bits would be all 1s. The all-1s format is reserved as the broadcast address for that subnet.)
* The valid hosts for subnet 128 are in the range 129–190, with a broadcast address of 191.
As you can see, this solution wastes a few addresses—six more than not subnetting at all, to be exact. In a Class C network, this should not be hard to justify. The 255.255.255.128 subnet mask is an even better solution if you need only two subnets and expect to need close to 126 host addresses per subnet.
##### Calculating Values for an Eight-Subnet Class C Network
What happens if you need eight subnets in your Class C network?
By using the calculation of 2x, where _x_ is the number of subnet bits, you would need 3 subnet bits to get eight subnets (23 = 8). What are the valid subnets, and what are the valid hosts of each subnet? Let's figure it out.
11100000 is 224 in binary, and it would be the interesting value in the fourth octet of the subnet mask. This must be the same on all workstations.
* * *
You're likely to see test questions that ask you to identify the problem with a given configuration. If a workstation has the wrong subnet mask, the router could "think" that the workstation is on a different subnet than it actually is. When that happens, the misguided router won't forward packets to the workstation in question. Similarly, if the mask is incorrectly specified in the workstation's configuration, that workstation will observe the mask and send packets to the default gateway when it shouldn't.
* * *
To figure out the valid subnets, subtract the interesting octet value from 256 (256 – 224 = 32), so 32 is your incremental value for the fourth octet. Of course, the 0 subnet is your first subnet, as always. The other subnets would be 32, 64, 96, 128, 160, 192, and 224. The valid hosts are the numbers between the subnet numbers, except the numbers that equal all 1s in the host bits. These numbers would be 31, 63, 95, 127, 159, 191, 223, and 255. Remember that using all 1s in the host bits is reserved for the broadcast address of each subnet.
The valid subnets, hosts, and broadcasts are as follows:
Subnet | Hosts | Broadcast
---|---|---
0 | 1–30 | 31
32 | 33–62 | 63
64 | 65–94 | 95
96 | 97–126 | 127
128 | 129–158 | 159
160 | 161–190 | 191
192 | 193–222 | 223
224 | 225–254 | 255
You can add one more bit to the subnet mask just for fun. You were using 3 bits, which gave you 224. By adding the next bit, the mask now becomes 240 (11110000).
By using 4 bits for the subnet mask, you get 14 subnets because 24 = 16. This subnet mask also gives you only 4 bits for the host addresses, or 24 – 2 = 14 hosts per subnet. As you can see, the number of hosts per subnet gets reduced rather quickly for each host bit that gets reallocated for subnet use.
The first valid subnet for subnet 240 is 0, as always. Because 256 – 240 = 16, your remaining subnets are then 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, and 240. Remember that the actual interesting octet value also represents the last valid subnet, so 240 is the last valid subnet number. The valid hosts are the numbers between the subnets, except for the numbers that are all 1s—the broadcast address for the subnet.
Table 8.6 shows the numbers in the interesting (fourth) octet for a Class C network with eight subnets.
**TABLE 8.6** Fourth octet addresses for a Class C network with eight subnets
Subnet | Hosts | Broadcast
---|---|---
0 | 1–14 | 15
16 | 17–30 | 31
32 | 33–46 | 47
48 | 49–62 | 63
64 | 65–78 | 79
80 | 81–94 | 95
96 | 97–110 | 111
112 | 113–126 | 127
128 | 129–142 | 143
144 | 145–158 | 159
160 | 161–174 | 175
176 | 177–190 | 191
192 | 193–206 | 207
208 | 209–222 | 223
224 | 225–238 | 239
240 | 241–254 | 255
#### Subnetting Class B
Because a Class B network has 16 bits for host addresses, you have plenty of available bits to play with when figuring out a subnet mask. Remember that you have to start with the leftmost bit and work toward the right. For example, a Class B network would look like x.y.0.0, with the default mask of 255.255.0.0. Using the default mask would give you one network with 65,534 hosts.
The default mask in binary is 11111111.11111111.00000000.00000000. The 1s represent the corresponding network bits in the IP address, and the 0s represent the host bits. When you're creating a subnet mask, the leftmost bit(s) will be borrowed from the host bits (0s will be turned into 1s) to become the subnet mask. You then use the remaining bits that are still set to 0 for host addresses.
If you use only 1 bit to create a subnet mask, you have a mask of 255.255.128.0. If you use 2 bits, you have a mask of 255.255.192.0, or 11111111.11111111.11000000.00000000.
As with subnetting a Class C address, you now have three parts of the IP address: the network address, the subnet address, and the host address. You figure out the subnet mask numbers the same way as you did with a Class C network (see the previous section, "Calculating Values for an Eight-Subnet Class C Network"), but you'll end up with a lot more hosts per subnet.
There are four subnets, because 22 = 4. The valid third-octet values for the subnets are 0, 64, 128, and 192 (256 – 192 = 64, so the incremental value of the third octet is 64). However, there are 14 bits (0s) left over for host addressing. This gives you 16,382 hosts per subnet (214 – 2 = 16,382).
The valid subnets and hosts are as follows:
Subnet | Hosts | Broadcast
---|---|---
x.y.0.0 | x.y.0.1 through x.y. 63.254 | x.y.63.255
x.y.64.0 | x.y.64.1 through x.y.127.254 | x.y.127.255
x.y.128.0 | x.y.128.1 through x.y.191.254 | x.y.191.255
x.y.192.0 | x.y.192.1 through x.y.255.254 | x.y.255.255
You can add another bit to the subnet mask, making it 11111111.11111111.11100000.00000000, or 255.255.224.0. This gives you eight subnets (23 = 8) and 8,190 hosts. The valid subnets are 0, 32, 64, 96, 128, 160, 192, and 224 (256 – 224 = 32). The subnets, valid hosts, and broadcasts are listed here:
Subnet | Hosts | Broadcast
---|---|---
x.y.0.0 | x.y.0.1 through x.y.31.254 | x.y.31.255
x.y.32.0 | x.y.32.1 through x.y.63.254 | x.y.63.255
x.y.64.0 | x.y.64.1 through x.y.95.254 | x.y.95.255
x.y.96.0 | x.y.96.1 through x.y.127.254 | x.y.127.255
x.y.128.0 | x.y.128.1 through x.y.159.254 | x.y.159.255
x.y.160.0 | x.y.160.1 through x.y.191.254 | x.y.191.255
x.y.192.0 | x.y.192.1 through x.y.223.254 | x.y.223.255
x.y.224.0 | x.y.224.1 through x.y.255.254 | x.y.255.255
The following are the breakdowns for a 9-bit mask and a 14-bit mask:
* If you use 9 bits for the mask, it gives you 512 subnets (29). With only 7 bits for hosts, you still have 126 hosts per subnet (27 – 2 = 126). The mask looks like this:
11111111.11111111.11111111.10000000, or 255.255.255.128
* If you use 14 bits for the subnet mask, you get 16,384 subnets (214) but only two hosts per subnet (22 – 2 = 2). The subnet mask would look like this:
11111111.11111111.11111111.11111100, or 255.255.255.252
* * *
# Subnet Mask Use in an ISP
You may be wondering why you would use a 14-bit subnet mask with a Class B address. This approach is actually very common. Let's say you have a Class B network and use a subnet mask of 255.255.255.0. You'd have 256 subnets and 254 hosts per subnet. Imagine also that you are an Internet service provider (ISP) and have a network with many WAN links, a different one between you and each customer. Typically, you'd have a direct connection between each site. Each of these links must be on its own subnet or network. There will be two hosts on these subnets—one address for each router port. If you used the mask described earlier (255.255.255.0), you would waste 252 host addresses per subnet. But by using the 255.255.255.252 subnet mask, you have more subnets available, which means more customers—each subnet with only two hosts, which is the maximum allowed on a point-to-point circuit.
You can use the 255.255.255.252 subnet mask only if you are running a routing algorithm such as Enhanced Interior Gateway Routing Protocol (EIGRP) or Open Shortest Path First (OSPF). These routing protocols allow what is called _variable-length subnet masking (VLSM)_. VLSM allows you to run the 255.255.255.252 subnet mask on your interfaces to the WANs and run 255.255.255.0 on your router interfaces in your local area network (LAN) using the same classful network address for all subnets. It works because these routing protocols transmit the subnet mask information in the update packets that they send to the other routers. Classful routing protocols, such as RIP version 1, don't transmit the subnet mask and therefore cannot employ VLSM.
* * *
#### Subnetting Class A
Class A networks have even more bits available than Class B and Class C networks. A default Class A network subnet mask is only 8 bits, or 255.0.0.0, giving you a whopping 24 bits for hosts to play with. Knowing which hosts and subnets are valid is a lot more complicated than it was for either Class B or Class C networks.
If you use a mask of 11111111.1111111.00000000.00000000, or 255.255.0.0, you'll have 8 bits for subnets, or 256 subnets (28). This leaves 16 bits for hosts, or 65,534 hosts per subnet (216 – 2 = 65534).
If you split the 24 bits evenly between subnets and hosts, you would give each one 12 bits. The mask would look like this: 11111111.11111111.11110000.00000000, or 255.255.240.0. How many valid subnets and hosts would you have? The answer is 4,096 subnets each with 4,094 hosts (212 – 2 = 4094).
The second octet will be somewhere between 0 and 255. However, you will need to figure out the third octet. Because the third octet has a 240 mask, you get 16 (256 – 240 = 16) as your incremental value in the third octet. The third octet must start with 0 for the first subnet, the second subnet will have 16 in the third octet, and so on. This means that some of your valid subnets are as follows (not in order):
Subnet | Hosts | Broadcast
---|---|---
x.0-255.0.0 | x.0-255.0.1 through x.0-255.15.254 | x.0-255.15.255
x.0-255.16.0 | x.0-255.16.1 through x.0-255.31.254 | x.0-255.31.255
x.0-255.32.0 | x.0-255.32.1 through x.0-255.47.254 | x.0-255.47.255
x.0-255.48.0 | x.0-255.48.1 through x.0-255.63.254 | x.0-255.63.255
They go on in this way for the remaining third-octet values through 224 in the subnet column.
### Working with Classless Inter-Domain Routing
Microsoft uses an alternate way to write address ranges, called _Classless Inter-Domain Routing_ ( _CIDR_ ; pronounced "cider"). CIDR is a shorthand version of the subnet mask. For example, an address of 131.107.2.0 with a subnet mask of 255.255.255.0 is listed in CIDR as 131.107.2.0/24 because the subnet mask contains 24 1s. An address listed as 141.10.32.0/19 would have a subnet mask of 255.255.224.0, or 19 1s (the default subnet mask for Class B plus 3 bits). This is the nomenclature used in all Microsoft exams (see Figure 8.12).
**FIGURE 8.12** Subnet mask represented by 1s
Let's say an Internet company has assigned you the following Class C address and CIDR number: 192.168.10.0/24. This represents the Class C address of 192.168.10.0 and a subnet mask of 255.255.255.0.
Again, CIDR represents the number of 1s turned on in a subnet mask. For example, a CIDR number of /16 stands for 255.255.0.0 (11111111.11111111.00000000.00000000).
The following is a list of all of the CIDR numbers (starting with a Class A default subnet mask) and their corresponding subnet masks:
CIDR | Mask | CIDR | Mask | CIDR | Mask
---|---|---|---|---|---
/8 | 255.0.0.0 | /17 | 255.255.128.0 | /25 | 255.255.255.128
/9 | 255.128.0.0 | /18 | 255.255.192.0 | /26 | 255.255.255.192
/10 | 255.192.0.0 | /19 | 255.255.224.0 | /27 | 255.255.255.224
/11 | 255.224.0.0 | /20 | 255.255.240.0 | /28 | 255.255.255.240
/12 | 255.240.0.0 | /21 | 255.255.248.0 | /29 | 255.255.255.248
/13 | 255.248.0.0 | /22 | 255.255.252.0 | /30 | 255.255.255.252
/14 | 255.252.0.0 | /23 | 255.255.254.0 | /31 | 255.255.255.254
/15 | 255.254.0.0 | /24 | 255.255.255.0 | /32 | 255.255.255.255
/16 | 255.255.0.0 | | | |
#### Quickly Identifying Subnet Characteristics Using CIDR
Given the limited time you have to dispatch questions in the structured environment of a Microsoft certification exam, every shortcut to coming up with the correct answer is a plus. The following method, using CIDR notation, can shave minutes off the time it takes you to complete a single question. Since you already understand the underlying binary technology at the heart of subnetting, you can use the following shortcuts, one for each address class, to come up with the correct answer without working in binary.
##### Identifying Class C Subnet Characteristics
Consider the host address 192.168.10.50/27. The following steps flesh out the details of the subnet of which this address is a member:
1. Obtain the CIDR-notation prefix length for the address by converting the dotted-decimal mask to CIDR notation.
In this case, /27 corresponds to a mask of 255.255.255.224. Practice converting between these notations until it becomes second nature.
2. Using the closest multiple of 8 that is greater than or equal to the prefix length, compute the interesting octet (the octet that increases from one subnet to the next in increments other than 1 or 0). Divide this multiple by 8. The result is a number corresponding to the octet that is interesting.
In this case, the next multiple of 8 greater than 27 is 32. Dividing 32 by 8 produces the number 4, pointing to the fourth octet as the interesting one.
3. To compute the incremental value in the interesting octet, subtract the prefix length from the next higher multiple of 8, which in this case is 32. The result (32 – 27) is 5. Raise 2 to the computed value (25 = 32). The result is the incremental value of the interesting octet.
4. Recall the value of the interesting octet from the original address (50 in this case). Starting with 0, increment by the incremental value until the value is exceeded. The values then are 0, 32, 64, and so on.
5. The subnet in question extends from the increment that is immediately less than or equal to the address's interesting octet value to the address immediately before the next increment. In this example, 192.168.10.50/27 belongs to the subnet 192.168.10.32, and this subnet extends to the address immediately preceding 192.168.10.64, which is its broadcast address, 192.168.10.63.
Note that if the interesting octet is not the fourth octet, all octets after the interesting octet must be set to 0 for the subnet address.
6. The usable range of addresses for the subnet in question extends from one higher than the subnet address to one less than the broadcast address, making the range for the subnet in question 192.168.10.33 through 192.168.10.62. As you can see, 192.168.10.50/27 definitely falls within the subnet 192.168.10.32/27.
##### Identifying Class B Subnet Characteristics
Using the steps in the previous section, find the subnet in which the address 172.16.76.12 with a mask of 255.255.240.0 belongs.
1. The corresponding CIDR notation prefix length is /20.
2. The next multiple of 8 that is greater than 20 is 24. 24 × 8 = 3. Octet 3 is interesting.
3. 24 – 20 = 4, so the incremental value is 24 = 16.
4. The increments in the third octet are 0, 16, 32, 48, 64, 80, and so on.
5. The increments of 64 and 80 bracket the address's third-octet value of 76, making the subnet in question 172.16.64.0, after setting all octets after the interesting octet to 0. This subnet's broadcast address is 172.16.79.255, which comes right before the next subnet address of 172.16.80.0.
6. The usable address range then extends from 172.16.64.1 through 172.16.79.254.
##### Identifying Class A Subnet Characteristics
Try it one more time with 10.6.127.255/14. Combine some of the related steps if possible:
1. The prefix length is 14. The next multiple of 8 that is greater than or equal to 14 is 16. 16 × 8 = 2, so the second octet is interesting.
2. 16 – 14 = 2, so the incremental value in the second octet is 22 = 4.
3. The corresponding second-octet value of 6 in the address falls between the 4 and 8 increments. This means that the subnet in question is 10.4.0.0 (setting octets after the second one to 0) and its broadcast address is 10.7.255.255.
4. The usable address range is from 10.4.0.1 through 10.7.255.254.
#### Determining Quantities of Subnets and Hosts
The general technique described in the previous section is also useful when trying to determine the total number of subnets and hosts produced by a given mask with respect to the default mask of the class of address in question.
For example, consider the Class B address 172.16.0.0 with a subnet mask of 255.255.254.0.
This is a prefix length of 23 bits. When you subtract the default prefix length for a Class B address of 16 from 23, you get the value 7. Raising 2 to the 7th power results in the value 128, which is the number of subnets you get when you subnet a Class B address with the 255.255.254.0 mask.
Determining the number of hosts available in each of these 128 subnets is simple because you always subtract the prefix length that the subnet mask produces, 23 in this example, from the value 32, which represents the total number of bits in any IP address. The difference, 9, represents the remaining number of 0s, or host bits, in the subnet mask. Raising 2 to this value produces the total possible number of host IDs per subnet that this subnet mask allows. Remember to subtract 2 from this result to account for the subnet and broadcast addresses for each subnet. This gives you the actual number of usable host IDs per subnet. In this case, this value is 29 – 2 = 510.
Repeated practice with this technique will reduce your time to obtain the desired answer to mere seconds, leaving time for the more challenging tasks in each question. You have a wealth of examples and scenarios in this chapter, as well as in the review questions, on which to try your technique and build your trust in this faster method.
### Supernetting
Let's take a look at a different type of subnetting. Class B addresses give you 65,534 addresses, but let's say that you have 1,000 users. Would you really need a Class B address? Not if you use supernetting.
Supernetting allows you to have two or more blocks of contiguous subnetwork addresses. So what does that actually mean? Class C addresses give you 254 useable addresses. So if you needed 1,000 users, you could set up supernetting of 4 Class C addresses that are contiguous.
Example:
192.168.16.0
192.168.17.0
192.168.18.0
192.168.19.0
When you set up supernetting for a Class C, you would use a Class B subnet mask. When you set up supernetting for a Class B, you would use a Class A subnet mask. This allows you to use multiple classes to get a larger number of hosts without taking up an entire class.
So the subnet mask for the above example would be 255.255.252.0 or /22. The reason we used this subnet mask is because a 252 subnet mask allows for 4 subnets. Each of the above Class C numbers would equal one subnet on this network.
## Understanding IPv6
Internet Protocol version 6 (IPv6) is the first major revamping of IP since RFC 791 was accepted in 1981. Yes, the operation of IP has improved, and there have been a few bells and whistles added (such as NAT, for example), but the basic structure is still being used as it was originally intended. IPv6 has actually been available to use in Microsoft operating systems since NT 4.0, but it always had to be manually enabled. Windows Vista was the first Microsoft operating system to have it enabled by default. It is also enabled by default in Windows 7, Windows 8, Windows Server 2008, Windows Server 2008 R2, and Windows Server 2012 R2, and it probably will be in all Microsoft operating systems from this point on.
TCP and UDP—as well as the IP applications, such as HTTP, FTP, SNMP, and the rest—are still being used in IPv4. So, you might ask, why change to the new version? What does IPv6 bring to your networking infrastructure? What is the structure of an IPv6 address? How is it implemented and used within Windows Server 2012 R2? I'll answer all of those questions and more in the following sections.
### IPv6 History and Need
In the late 1970s, as the IP specifications were being put together, the vision of the interconnected devices was limited compared to what we actually have today. To get an idea of the growth of the Internet, take a look at Hobbes' Internet Timeline in RFC 2235 (www.faqs.org/rfcs/rfc2235.html). As you can see, in 1984, the number of hosts finally surpassed 1,000—two years after TCP and IP were introduced. With 32 bits of addressing available in IPv4, it handled the 1,000+ hosts just fine. And even with the number of hosts breaking the 10,000 mark in 1987 and then 100,000 in 1989, there were still plenty of IP addresses to go around. But when the number of hosts exceeded 2 million in 1992 and 3 million in 1994, concern in the industry started to build. So in 1994, a working group was formed to come up with a solution to the quickly dwindling usable address availability in the IPv4 space. Internet Protocol next generation (IPng) was started.
Have you heard of IP address depletion being a problem today? Probably not as much. When the working group realized that it could not have IPv6 standardized before the available addresses might run out, they developed and standardized _Network Address Translation (NAT)_ as an interim solution. NAT, or more specifically an implementation of NAT called _Port Address Translation (PAT)_ , took care of a big portion of the problem.
NAT works very well, but it does have some limitations, including issues of peer-to-peer applications with their IPv4 addresses embedded in the data, issues of end-to-end traceability, and issues of overlapping addresses when two networks merge. Because all devices in an IPv6 network will have a unique address and no network address translation will take place, the global addressing concept of IPv4 will be brought back (the address put on by the source device will stay all the way to the destination). Thus, with the new-and-improved functionality of IPv6, the drawbacks of NAT and the limitations of IPv4 will be eliminated.
### New and Improved IPv6 Concepts
Several elements of the IPv4 protocol could use some enhancements. Fortunately, IPv6 incorporates those enhancements as well as new features directly into the protocol specification to provide better and additional functionality.
The following list includes new concepts and new implementations of old concepts in IPv6:
* Larger address space (128-bit vs. 32-bit).
* Autoconfiguration of Internet-accessible addresses with or without DHCP. (Without DHCP, it's called _stateless autoconfiguration_.)
* More efficient IP header (fewer fields and no checksum).
* Fixed-length IP header (the IPv4 header is variable length) with extension headers beyond the standard fixed length to provide enhancements.
* Built-in IP mobility and security. (Although available in IPv4, the IPv6 implementation is a much better implementation.)
* Built-in transition schemes to allow integration of the IPv4 and IPv6 spaces.
* ARP broadcast messages replaced with multicast request.
Here are more details about these features:
128-Bit Address Space The new 128-bit address space will provide unique addresses for the foreseeable future. Although I would like to say that we will never use up all of the addresses, history may prove me wrong. The number of unique addresses in the IPv6 space is 2128, or 3.4 × 1038, addresses. How big is that number? It's enough for toasters and refrigerators (and maybe even cars) to all have their own addresses.
As a point of reference, the nearest black hole to Earth is 1,600 light years away. If you were to stack 4mm BB pellets from here to the nearest black hole and back, you would need 1.51 × 1022 BBs. This means you could uniquely address each BB from Earth to the black hole and back and still have quite a few addresses left over.
Another way to look at it is that the IPv6 address space is big enough to provide more than 1 million addresses per square inch of the surface area of the earth (oceans included).
Autoconfiguration and Stateless Autoconfiguration Autoconfiguration is another added/improved feature of IPv6. We've used DHCP for a while to assign IP addresses to client machines. You should even remember that APIPA can be used to assign addresses automatically to Microsoft DHCP client machines in the absence of a DHCP server. The problem with APIPA is that it confines communication between machines to a local LAN (no default gateway). What if a client machine could ask whether there was a router on the LAN and what network it was on? If the client machine knew that, it could not only assign itself an address, it could also choose the appropriate network and default gateway. The stateless autoconfiguration functionality of IPv6 allows the clients to do this.
Improved IPv6 Header The IPv6 header is more efficient than the IPv4 header because it is fixed length (with extensions possible) and has only a few fields. The IPv6 header consists of a total of 40 bytes:
1. 32 bytes Source and destination IPv6 addresses
2. 8 bytes Version field, traffic class field, flow label field, payload length field, next header field, and hop limit field
You don't have to waste your time with a checksum validation anymore, and you don't have to include the length of the IP header (it's fixed in IPv6; the IP header is variable length in IPv4, so the length must be included as a field).
IPv6 Mobility IPv6 is only a replacement of the OSI layer 3 component, so you'll continue to use the TCP (and UDP) components as they currently exist. IPv6 addresses a TCP issue, though. Specifically, TCP is connection oriented, meaning that you establish an end-to-end communication path with sequencing and acknowledgments before you ever send any data, and then you have to acknowledge all of the pieces of data sent. You do this through a combination of an IP address, port number, and port type (socket).
If the source IP address changes, the TCP connection may be disrupted. But then how often does this happen? Well, it happens more and more often because more people are walking around with a wireless laptop or a wireless Voice over IP (VoIP) telephone. IPv6 mobility establishes a TCP connection with a home address and, when changing networks, it continues to communicate with the original endpoint from a care-of address as it changes LANs, which sends all traffic back through the home address. The handing off of network addresses does not disrupt the TCP connection state (the original TCP port number and address remain intact).
Improved Security Unlike IPv4, IPv6 has security built in. _Internet Protocol Security (IPsec)_ is a component used today to authenticate and encrypt secure tunnels from a source to a destination. This can be from the client to the server or between gateways. IPv4 lets you do this by enhancing IP header functionality (basically adding a second IP header while encrypting everything behind it). In IPv6, you add this as standard functionality by using extension headers. Extension headers are inserted into the packet only if they are needed. Each header has a "next header" field, which identifies the next piece of information. The extension headers currently identified for IPv6 are Hop-By-Hop Options, Routing, Fragment, Destination Options, Authentication, and Encapsulating Security Payload. The Authentication header and the Encapsulating Security Payload header are the IPsec-specific control headers.
IPv4 to IPv6 Interoperability Several mechanisms in IPv6 make the IPv4-to-IPv6 transition easy.
* A simple dual-stack implementation where both IPv4 and IPv6 are installed and used is certainly an option. In most situations (so far), this doesn't work so well because most of us aren't connected to an IPv6 network and our Internet connection is not IPv6 even if we're using IPv6 internally. Therefore, Microsoft includes other mechanisms that can be used in several different circumstances.
* _Intra-Site Automatic Tunnel Addressing Protocol (ISATAP)_ is an automatic tunneling mechanism used to connect an IPv6 network to an IPv4 address space (not using NAT). ISATAP treats the IPv4 space as one big logical link connection space.
* _6to4_ is a mechanism used to transition to IPv4. This method, like ISATAP, treats the IPv4 address space as a logical link layer with each IPv6 space in transition using a 6to4 router to create endpoints using the IPv4 space as a point-to-point connection (kind of like a WAN, eh?). 6to4 implementations still do not work well through a NAT, although a 6to4 implementation using an Application layer gateway (ALG) is certainly doable.
* _Teredo_ is a mechanism that allows users behind a NAT to access the IPv6 space by tunneling IPv6 packets in UDP.
Pseudo-interfaces are used in these mechanisms to create a usable interface for the operating system. Another interesting feature of IPv6 is that addresses are assigned to interfaces (or pseudo-interfaces), not simply to the end node. Your Windows Server 2012 R2 will have several unique IPv6 addresses assigned.
New Broadcast Methods IPv6 has moved away from using broadcasting. The three types of packets used in IPv6 are unicast, multicast, and anycast. IPv6 clients then must use one of these types to get the MAC address of the next Ethernet hop (default gateway). IPv6 makes use of multicasting for this along with the new functionality called _neighbor discovery._ Not only does ARP utilize new functionality, but ICMP (also a layer 3 protocol) has been redone and is now known as ICMP6. _ICMP6_ is used for messaging (packet too large, time exceeded, and so on) as it was in IPv4, but now it's also used for the messaging of IPv6 mobility. ICMP6 echo request and ICMP6 echo reply are still used for ping.
### IPv6 Addressing Concepts
You need to consider several concepts when using IPv6 addressing. For starters, the format of the address has changed. Three types of addresses are used in IPv6 with some predefined values within the address space. You need to get used to seeing these addresses and be able to identify their uses.
#### IPv6 Address Format
For the design of IPv4 addresses, you present addresses as octets or the decimal (base 10) representation of 8 bits. Four octets add up to the 32 bits required. IPv6 expands the address space to 128 bits, and the representation is for the most part shown in hexadecimal (a notation used to represent 8 bits using the values 0–9 and A–F). Figure 8.13 compares IPv4 to IPv6.
**FIGURE 8.13** IPv4/IPv6 comparison
A full IPv6 address looks like this example:
1. 2001:0DB8:0000:0000:1234:0000:A9FE:133E
You can tell the implementation of DNS will make life a lot easier even for those who like to ping the address in lieu of the name. Fortunately, DNS already has the ability to handle IPv6 addresses with the use of an AAAA record. ( _A_ is short for _alias_.) An A record in IPv4's addressing space is 32 bits, so an AAAA record, or four _A_ s, is 128 bits. The Windows Server 2012 R2 DNS server handles the AAAA and the reverse pointer (PTR) records for IPv6.
##### IPv6 Address Shortcuts
There are several shortcuts for writing an IPv6 address. These are described in the following list:
* :0: stands for :0000:.
* You can omit preceding 0s in any 16-bit word. For example, :DB8: and :0DB8: are equivalent.
* :: is a variable standing for enough zeros to round out the address to 128 bits. :: can be used only once in an address.
You can use these shortcuts to represent the example address 2001:0DB8:0000:0000:1234:0000:A9FE:133E, as shown here:
* Compress :0000: into :0::
2001:0DB8:0000:0000:1234:0:A9FE:133E
* Eliminate preceding zeros:
2001:DB8:0000:0000:1234:0:A9FE:133E
* Use the special variable shortcut for multiple 0s:
2001:DB8::1234:0:A9FE:133E
You now also use prefix notation or slash notation when discussing IPv6 networks. For example, the network of the previous address can be represented as 2001:DB8:0000:0000:0000:0000:0000:0000. This can also be expressed as 2001:DB8:: /32. The /32 indicates 32 bits of network, and 2001:DB8: is 32 bits of network.
##### IPv6 Address Assignment
So, do you subnet IPv6? The answer depends on your definition of subnetting. If you are given 32 bits of network from your ISP, you have 96 bits with which to work. If you use some of the 96 bits to route within your network infrastructure, then you are subnetting. In this context, you do subnet IPv6. However, given the huge number of bits you have available, you will no longer need to implement VLSM. For example, Microsoft has a network space of 2001:4898:: /32. That gives the administrators a space of 96 bits (296 = 79,228,162,514,264,337,593,543,950,336 unique addresses using all 96 bits) with which to work.
You can let Windows Server 2012 R2 dynamically/automatically assign its IPv6 address, or you can still assign it manually (see Figure 8.14). With dynamic/automatic assignment, the IPv6 address is assigned either by a DHCPv6 server or by the Windows Server 2012 R2 machine. If no DHCPv6 server is configured, the Windows Server 2012 R2 machine can query the local LAN segment to find a router with a configured IPv6 interface. If so, the server will assign itself an address on the same IPv6 network as the router interface and set its default gateway to the router interface's IPv6 address. Figure 8.14 shows that you have the same dynamic and manual choices as you do in IPv4; however, the input values for IPv6 must conform to the new format.
**FIGURE 8.14** TCP/IPv6 Properties window
To see your configured IP addresses (IPv4 and IPv6), you can still use the `ipconfig` command. For example, I have configured a static IPv4 address and an IPv6 address on my server. The IPv6 address is the same as the one used in the earlier IPv6 example address. Figure 8.15 shows the result of this command on Windows Server 2012 R2 for my server.
**FIGURE 8.15** IPv6 configuration as seen from the command prompt
#### IPv6 Address Types
As stated earlier, there are three types of addresses in IPv6: anycast, unicast, and multicast. A description of each of these types of IPv6 addresses follows.
* * *
Note the absence of the broadcast type, which is included in IPv4. You can't use broadcasts in IPv6; they've been replaced with multicasts.
* * *
Anycast Addresses Anycast addresses are not really new. The concept of anycast existed in IPv4 but was not widely used. An _anycast address_ is an IPv6 address assigned to multiple devices (usually different devices). When an anycast packet is sent, it is delivered to one of the devices, usually the closest one.
Unicast Addresses A _unicast packet_ uniquely identifies an interface of an IPv6 device. The interface can be a virtual or pseudo-interface or a real (physical) interface.
Unicast addresses come in several types, as described in the following list:
1. Global Unicast Address As of this writing, the global unicast address space is defined as 2000:: /3. The 2001::/32 networks are the IPv6 addresses currently being issued to business entities. As mentioned, Microsoft has been allocated 2001:4898:: /32. A Microsoft DHCPv6 server would be set up with scopes (ranges of addresses to be assigned) within this address space. There are some special addresses and address formats that you will see in use as well. You'll find most example addresses listed as 2001:DB8:: /32; this space has been reserved for documentation. Do you remember the loopback address in IPv4, 127.0.0.1? In IPv6 the loopback address is ::1 (or 0:0:0:0:0:0:0:0001). You may also see an address with dotted-decimal used. A dual-stack Windows Server 2012 machine may also show you FE80::5EFE:192.168.1.200. This address form is used in an integration/migration model of IPv6 (or if you just can't leave the dotted-decimal era, I suppose).
2. Link-Local Address Link-local addresses are defined as FE80:: /10. If you refer to Figure 8.15 showing the `ipconfig` command, you will see the link-local IPv6 address as fe80::a425:ab9d:7da4:ccba. The last 8 bytes (64 bits) are random to ensure a high probability of randomness for the link-local address. The link-local address is to be used on a single link (network segment) and should never be routed.
3. There is another form of the local-link IPv6 address called the Extended User Interface 64-bit (EUI-64) format. This is derived by using the MAC address of the physical interface and inserting an FFFE between the third and fourth bytes of the MAC. The first byte is also made 02 (this sets the universal/local or U/L bit to 1 as defined in IEEE 802 frame specification). Again looking at Figure 8.15, the EUI-64 address would take the physical (MAC) address 00-03-FF-11-02-CD and make the link-local IPv6 address FE80::0203:FFFF:FE11:02CD. (I've left the preceding zeros in the link-local IPv6 address to make it easier for you to pick out the MAC address with the FFFE inserted.)
4. AnonymousAddress Microsoft Server 2012 R2 uses the random address by default instead of EUI-64. The random value is called the _AnonymousAddress_ in Microsoft Server 2012 R2. It can be modified to allow the use of EUI-64.
5. Unique Local Address The _unique local address_ can be Fc00 or FD00, and it is used like the private address space of IPv4. RFC 4193 describes unique local addresses. They are not expected to be routable on the global Internet. They are used for private routing within an organization.
Multicast Address _Multicast addresses_ are one-to-many communication packets. Multicast packets are identifiable by their first byte (most significant byte, leftmost byte, leftmost 2 nibbles, leftmost 8 bits, and so on). A multicast address is defined as FF00::/8.
In the second byte shown (the 00 of FF00), the second 0 is what's called the _scope_. Interface-local is 01, and link-local is 02. FF01:: is an interface-local multicast.
There are several well-known (already defined) multicast addresses. For example, if you want to send a packet to all nodes in the link-local scope, you send the packet to FF02::1 (also shown as FF02:0:0:0:0:0:0:1). The all-routers multicast address is FF02::2.
You can also use multicasting to get the logical link layer address (MAC address) of a device with which you are trying to communicate. Instead of using the ARP mechanism of IPv4, IPv6 uses the ICMPv6 neighbor solicitation (NS) and neighbor advertisement (NA) messages. The NS and NA ICMPv6 messages are all part of the new _Neighbor Discovery Protocol (NDP)_. This new ICMPv6 functionality also includes router solicitation and router advertisements as well as redirect messages (similar to the IPv4 redirect functionality).
Table 8.7 outlines the IPv6 address space known prefixes and some well-known addresses.
**TABLE 8.7** IPv6 address space known prefixes and addresses
Address Prefix | Scope of Use
---|---
2000:: /3 | Global unicast space prefix
FE80:: /10 | Link-local address prefix
FC00:: /7 | Unique local unicast prefix
FD00:: /8 | Unique local unicast prefix
FF00:: /8 | Multicast prefix
2001:DB8:: /32 | Global unicast prefix used for documentation
::1 | Reserved local loopback address
2001:0000: /32 | Teredo prefix (discussed later in this chapter)
2002:: /16 | 6to4 prefix
* * *
## Unicast vs. Anycast
Unicast and anycast addresses look the same and may be indistinguishable from each other; it just depends on how many devices have the same address. If only one device has a globally unique IPv6 address, it's a unicast address. If more than one device has the same address, it's an anycast address. Both unicast and anycast are considered one-to-one communication, although you could say that anycast is one-to-"one of many."
* * *
### IPv6 Integration/Migration
It's time to get into the mind-set of integrating IPv6 into your existing infrastructure with the longer goal of migrating to IPv6. In other words, this is not going to be an "OK, Friday the Internet is changing over" rollout. You have to bring about the change as a controlled implementation. It could easily take three to five years before a solid migration occurs and probably longer. I think the migration will take slightly less time than getting the world to migrate to the metric system on the overall timeline. The process of integration/migration consists of several mechanisms.
Dual Stack Simply running both IPv4 and IPv6 on the same network, utilizing the IPv4 address space for devices using only IPv4 addresses and utilizing the IPv6 address space for devices using IPv6 addresses
Tunneling Using an encapsulation scheme for transporting one address space inside another
Address Translation Using a higher-level application to change one address type (IPv4 or IPv6) to the other transparently so that end devices are unaware one address space is talking to another
I elaborate on these three mechanisms in the following sections.
#### IPv6 Dual Stack
The default implementation in Windows Server 2012 R2 is an enabled IPv6 configuration along with IPv4; this is dual stack. The implementation can be dual IP layer or dual TCP/IP stack. Windows Server 2012 R2 uses the dual IP layer implementation (see Figure 8.16). When an application queries a DNS server to resolve a hostname to an IP address, the DNS server may respond with an IPv4 address or an IPv6 address. If the DNS server responds with both, Windows Server 2012 R2 will prefer the IPv6 address. Windows Server 2012 R2 can use both IPv4 and IPv6 addresses as necessary for network communication. When looking at the output of the `ipconfig` command, you will see both address spaces displayed.
**FIGURE 8.16** IPv6 dual IP layer diagram
#### IPv6 Tunneling
Windows Server 2012 R2 includes several tunneling mechanisms for tunneling IPv6 through the IPv4 address space. They include the following:
* Intra-Site Automatic Tunnel Addressing Protocol (ISATAP), which is used for unicast IPv6 communication across an IPv4 infrastructure. ISATAP is enabled by default in Windows Server 2012 R2.
* 6to4, which is used for unicast IPv6 communication across an IPv4 infrastructure.
* Teredo, which is used for unicast IPv6 communication with an IPv4 NAT implementation across an IPv4 infrastructure.
With multiple tunneling protocols available and enabled by default, you might ask, what's the difference, and why is one used over the others? They all allow you to tunnel IPv6 packets through the IPv4 address space (a really cool thing if you're trying to integrate/migrate). Here are the details of these tunneling mechanisms:
ISATAP _Intra-Site Automatic Tunnel Addressing Protocol (ISATAP)_ is the automatic tunnel addressing protocol providing IPv6 addresses based on the IPv4 address of the end interface (node). The IPv6 address is automatically configured on the local device, and the dual stack machine can use either its IPv4 or IPv6 address to communicate on the local network (within the local network infrastructure). ISATAP can use the neighbor discovery mechanism to determine the router ID and network prefix where the device is located, thus making intrasite communication possible even in a routed infrastructure.
The format of an ISATAP address is as follows:
1. [64bits of prefix] [32bits indicating ISATAP] [32bits IPv4 Address]
The center 32 bits indicating ISATAP are actually 0000:5EFE (when using private IPv4 addresses). The ISATAP address of the example Windows Server 2012 R2 machine using the link-local IPv6 address is FE80::5EFE:192.168.1.200. Each node participating in the ISATAP infrastructure must support ISATAP. If you're routing through an IPv4 cloud, a border router (a router transitioning from an IPv6 to IPv4 space) must support ISATAP. Windows Server 2012 R2 can be configured as a border router, and it will forward ISATAP packets. ISATAP is experimental and is defined in RFC 4214.
6to4 _6to4_ specifies a procedure for IPv6 networks to communicate with each other through an IPv4 space without the IPv6 nodes having to know what's happening. The IPv6 nodes do not need to be dual stacked to make this happen. The border router is the device responsible for knowing about the IPv6-to-IPv4 transition. The IPv6 packets are encapsulated at the border router (and decapsulated at the other end or on the way back). There is an assigned prefix for the 6to4 implementation: 2002:: /16. 6to4 is defined in RFC 3056.
Teredo _Teredo_ (named after a kind of shipworm that drills holes in the wood of ships) is a protocol designed to allow IPv6 addresses to be available to hosts through one or more layers of NAT. Teredo uses a process of tunneling packets through the IPv4 space using UDP. The Teredo service encapsulates the IPv6 data within a UDP segment (packet) and uses IPv4 addressing to get through the IPv4 cloud. Having a layer 4 (Transport layer) available to use as translation functionality is what gives you the ability to be behind a NAT. Teredo provides host-to-host communication and dynamic addressing for IPv6 nodes (dual stack), allowing the nodes to have access to resources in an IPv6 network and the IPv6 devices to have access to the IPv6 devices that have only connectivity to the IPv4 space (like home users who have an IPv6-enabled operating system connecting to IPv6 resources while their home ISP has only IPv4 capabilities). Teredo is defined in RFC 4380.
In Windows Server 2012 R2, an IPv4 Teredo server is identified and configured (using the `netsh` command interface). The Teredo server provides connectivity resources (address) to the Teredo client (the node that has access to the IPv4 Internet and needs access to an IPv6 network/Internet). A Teredo relay is a component used by the IPv6 router to receive traffic destined for Teredo clients and forward the traffic appropriately. The defined prefix for Teredo address is 2001:0000:: /32. Teredo does add overhead like all the other implementations discussed. It is generally accepted that you should use the simplest model available. However, in the process of integration/migration for most of us behind a NAT, Teredo will be the process to choose.
From Windows Server 2012 R2, use the `ipconfig /all` command to view the default configurations including IPv4 and IPv6. You may notice a notation that I didn't discuss, the percent sign at the end of the IPv6 address (see Figure 8.17). The number after the percent sign is the virtual interface identifier used by Windows Server 2012 R2.
**FIGURE 8.17** IPv6 interface identifier for `ipconfig` display
#### Useful IPv6 Information Commands
You can use numerous commands to view, verify, and configure the network parameters of Windows Server 2012 R2. Specifically, you can use the `netsh` command set and the `route` command set as well as the standard `ping` and `tracert` functions.
Use the `netsh` command interface (as well as the provided dialog boxes, if you want) to examine and configure IPv6 functionality. The `netsh` command issued from the command interpreter changes into a network shell (`netsh`) where you can configure and view both IPv4 and IPv6 components.
Don't forget to use the ever-popular `route print` command to see the Windows Server 2012 R2 routing tables (IPv4 and IPv6). The other diagnostic commands are still available for IPv4 as well as IPv6. In previous versions of Microsoft operating systems, `ping` was the IPv4 command, and `ping6` was the IPv6 command. This has changed in Windows Server 2012 R2; `ping` works for both IPv4 and IPv6 to test layer 3 connectivity to remote devices. The IPv4 `tracert` command was `tracert6` for IPv6. The command is now `tracert` for both IPv4 and IPv6, and it will show you every layer 3 (IP) hop from source to destination. (This assumes that all of the administrators from here to there want you to see the hops and are not blocking ICMP. It also assumes that there are no IP tunnels, which your packets are traversing; you won't see the router hops in the tunnel either.)
Overall, the consortium of people developing the Internet and the Internet Protocol have tried to make all of the changes to communication infrastructures easy to implement. (This is a daunting task with the many vendors and various infrastructures currently in place.) The goal is not to daze and confuse administrators; it's designed to provide maximum flexibility with the greatest functionality. IPv6 is going to provide the needed layer 3 (Network layer, global addressing layer, logical addressing layer...call it what you like) functionality for the foreseeable future.
#### Subnetting with IPv6
Subnetting with IPv6 is a lot like subnetting with IPv4. You need to know how many bits you are going to use for the network mask to subnet it correctly.
For example, let's say you have an IPv6 prefix of 2001:DB8:BBCC:0000::/53 and you need to set up your network so that your IPv6 addressing scheme can handle 1,500 more subnets. How would you figure this out?
When determining any number of hosts or subnets, the calculation is 2 to the power (2x). The first power number that is greater than or equal to the number you need is the power number that you add to the current network mask. Thus, in the previous question, to get to 1,500 subnets, you would need to determine which 2x is the first one that is greater than or equal to 1,500. If you calculate your powers correctly, 211 (211 = 2,048) is the first one that is greater than or equal to 1,500. So, you would add the power of 11 to the /53 in the previous address, and you would now use /64 as your network mask. Table 8.8 shows you some of the power numbers for the power of 2.
**TABLE 8.8** Powers of 2
Power | Equals
---|---
22 | 4
23 | 8
24 | 16
25 | 32
26 | 64
27 | 128
28 | 256
29 | 512
210 | 1024
211 | 2048
212 | 4096
## Summary
Why TCP/IP is the primary protocol in use today is one of the important topics covered in this chapter. You also learned that the 32-bit IPv4 address is a structured and hierarchical one that is used to identify uniquely every machine on a network. You learned how to determine available IP addresses and implement subnetting. In addition, you learned how the new layer 3 IPv6 protocol is implemented, including the structure of the IPv6 address. Finally, I discussed the new functionality included in IPv6 addressing as well as several Windows Server 2012 R2 integration/migration implementations.
## Exam Essentials
Understand what subnetting is and when to use it. If an organization is large and has many computers or if its computers are geographically dispersed, it's sensible to divide its large network into smaller ones connected by routers. These smaller networks are called _subnets_. Subnetting is the process of carving a single IP network into smaller, logical subnetworks.
Understand subnet masks. For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the subnet address. The network administrator creates a 32-bit subnet mask consisting of 1s and 0s. The 1s in the subnet mask represent the positions that refer to the network or subnet addresses. The 0s represent the positions that refer to the host portion of the address.
Understand IPv6. Understand the structure of an IPv6 address and how it's displayed. Know the shortcuts and rules (such as for displaying 0s) for writing IPv6 addresses. Know the integration/migration components for IPv6 included in Windows Server 2012 R2, including tunneling and dual stack.
## Review Questions
1. You are the network administrator for ABC Company. You have an IPv6 prefix of 2001:DB8:BBCC:0000::/53, and you need to set up your network so that your IPv6 addressing scheme can handle 1,000 more subnets. Which network mask would you use?
1. /60
2. /61
3. /62
4. /63
5. /64
2. You are the network administrator for Stellacon Corporation. Stellacon has a Windows Server 2012 R2 machine that needs to be able to communicate with all of the computers on the internal network. Stellacon has decided to add 15 new segments to its IPv6 network. How would you configure the IPv6 address so that the server can communicate with all the segments?
1. Configure the IPv6 address as fd00::2b0:e0ff:dee9:4143/8.
2. Configure the IPv6 address as fe80::2b0:e0ff:dee9:4143/32.
3. Configure the IPv6 address as ff80::2b0:e0ff:dee9:4143/64.
4. Configure the IPv6 address as fe80::2b0:e0ff:dee9:4143/64.
3. You are the network administrator for a midsize organization that has installed Windows Server 2012 R2 onto the network. You are thinking of moving all machines to Windows 8 and IPv6. You decide to set up a test environment with four subnets. What type of IPv6 addresses do you need set up?
1. Global addresses
2. Link-local addresses
3. Unique local addresses
4. Site-local addresses
4. You have a large IP-routed network using the address 137.25.0.0; it is composed of 20 subnets, with a maximum of 300 hosts on each subnet. Your company continues on a merger-and-acquisitions spree, and your manager has told you to prepare for an increase to 50 subnets with some containing more than 600 hosts. Using the existing network address, which of the following subnet masks would work for the requirement set by your manager?
1. 255.255.252.0
2. 255.255.254.0
3. 255.255.248.0
4. 255.255.240.0
5. Your company is growing dramatically via acquisitions of other companies. As the network administrator, you need to keep up with the changes because they affect the workstations, and you need to support them. When you started, there were 15 locations connected via routers, and now there are 25. As new companies are acquired, they are migrated to Windows Server 2012 R2 and brought into the same domain as another site. Management says that they are going to acquire at least 10 more companies in the next two years. The engineers have also told you that they are redesigning the company's Class B address into an IP addressing scheme that will support these requirements and that there will never be more than 1,000 network devices on any subnet. What is the appropriate subnet mask to support this network when the changes are completed?
1. 255.255.252.0
2. 255.255.248.0
3. 255.255.255.0
4. 255.255.255.128
6. You work for a small printing company that has 75 workstations. Most of them run standard office applications such as word processing, spreadsheet, and accounting programs. Fifteen of the workstations are constantly processing huge graphics files and then sending print jobs to industrial-sized laser printers. The performance of the network has always been an issue, but you have never addressed it. You have now migrated your network to Windows 8 and Windows Server 2012 R2 and have decided to take advantage of the routing capability built into Windows Server 2012 R2. You choose the appropriate server and place two NICs in the machine, but you realize that you have only one network address, 201.102.34.0, which you obtained years ago. How should you subnet this address to segment the bandwidth hogs from the rest of the network while giving everyone access to the entire network?
1. 255.255.255.192
2. 255.255.255.224
3. 255.255.255.252
4. 255.255.255.240
7. You work for Carpathian Worldwide Enterprises, which has more than 50 administrative and manufacturing locations around the world. The size of these organizations varies greatly, with the number of computers per location ranging from 15 to slightly fewer than 1,000. The sales operations use more than 1,000 facilities, each of which contains 2 to 5 computers. Carpathian is also in merger talks with another large organization. If the merger materializes as planned, you will have to accommodate another 100 manufacturing and administrative locations, each with a maximum of 600 computers, as well as 2,000 additional sales facilities. You don't have any numbers for the future growth of the company, but you are told to keep growth in mind. You decide to implement a private addressing plan for the entire organization. More than half of your routers don't support variable-length subnet masking. Which subnet masks would work for this situation? (Choose all that apply.)
1. 255.255.224.0
2. 255.255.240.0
3. 255.255.248.0
4. 255.255.252.0
5. 255.255.254.0
8. Which of the following subnet masks are represented with the CIDR of /27?
1. 255.255.255.254
2. 255.255.255.248
3. 255.255.255.224
4. 255.255.255.240
9. You are the administrator for a Windows Server 2012 R2 network that uses DHCP. You notice that your DHCP database is getting too large, and you want to reduce the size of the database. What should you do?
1. From the folder containing the DHCP database, run `jetpack.exe dhcp.mdb temp.mdb`.
2. From the folder containing the DHCP database, run `shrinkpack.exe dhcp.mdb temp.mdb`.
3. From the folder containing the DHCP database, run `jetshrink.exe dhcp.mdb temp.mdb`.
4. From the folder containing the DHCP database, run `shrinkjet.exe dhcp.mdb temp.mdb`.
10. You ask one of your technicians to get the IPv6 address of a new Windows Server 2012 R2 machine, and she hands you a note with FE80::0203:FFFF:FE11:2CD on it. What can you tell from this address? (Choose two.)
1. This is a globally unique IPv6 address.
2. This is a link-local IPv6 address.
3. This is a multicast IPv6 address.
4. In EUI-64 format, you can see the MAC address of the node.
5. In EUI-64 format, you can see the IPv4 address of the node.
# Chapter 9
Use Virtualization in Windows Server 2012
**THE FOLLOWING 70-410 EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:**
1. **Create and configure virtual machine settings**
* Configure dynamic memory
* Configure smart paging
* Configure Resource Metering
* Configure guest integration services
* Create and configure Generation 1 and 2 virtual machines
* Configure and use extended session mode
* Configure remoteFX
2. **Create and configure virtual machine storage**
* Create VHDs and VHDX
* Configure differencing drives
* Modify VHDs
* Configure pass-through disks
* Manage checkpoints
* Implement a virtual Fibre Channel adapter
* Configure storage Quality of Service
3. **Create and configure virtual networks**
* Configure Hyper-V virtual switches
* Optimize network performance
* Configure MAC addresses
* Configure network isolation
* Configure synthetic and legacy virtual network adapters
* Configure NIC teaming in virtual machines
_Hyper-V_ is a server role in Windows Server 2012 R2 that allows you to virtualize your environment and therefore run multiple virtual operating system instances simultaneously on a physical server. This not only helps you to improve server utilization but also helps you to create a more cost-effective and dynamic system.
In this chapter, you will learn the basic concepts and features of Hyper-V that a Windows Server 2012 R2 technical specialist must know. You will also get a solid understanding of what is important in virtualization and in what areas of your work life you can use it.
## Hyper-V Overview
In the following sections, I'll introduce you to Hyper-V. To begin, you'll take a look at virtualization and what types of virtualization exist. I will then discuss Hyper-V features and the Hyper-V architecture before finishing up with the Hyper-V requirements for software and hardware.
### What Is Virtualization?
_Virtualization_ is a method for abstracting physical resources from the way that they interact with other resources. For example, if you abstract the physical hardware from the operating system, you get the benefit of being able to move the operating system between different physical systems.
This is called _server virtualization_. But there are also other forms of virtualization available, such as presentation virtualization, desktop virtualization, and application virtualization. I will now briefly explain the differences between these forms of virtualization:
Server Virtualization This basically enables multiple servers to run on the same physical server. Hyper-V is a server virtualization tool that allows you to move physical machines to virtual machines and manage them on a few physical servers. Thus, you will be able to consolidate physical servers.
Presentation Virtualization When you use _presentation virtualization_ , your applications run on a different computer, and only the screen information is transferred to your computer. An example of presentation virtualization is Microsoft Remote Desktop Services in Windows Server 2012 R2.
Desktop Virtualization _Desktop virtualization_ provides you with a virtual machine on your desktop, comparable to server virtualization. You run your complete operating system and applications in a virtual machine so that your local physical machine just needs to run a very basic operating system. An example of this form of virtualization is Microsoft Virtual PC.
Application Virtualization _Application virtualization_ helps prevent conflicts between applications on the same PC. Thus, it helps you to isolate the application running environment from the operating system installation requirements by creating application-specific copies of all shared resources. It also helps reduce application-to-application incompatibility and testing needs. An example of an application virtualization tool is Microsoft Application Virtualization (App-V).
### Hyper-V Features
As a lead-in to the virtualization topic and Hyper-V, I will start with a list of key features, followed by a list of supported guest operating systems. This should provide you with a quick, high-level view of this feature before you dig deeper into the technology.
#### Key Features of Hyper-V
The following are the key features of Hyper-V:
New Architecture The hypervisor-based architecture, which has a 64-bit micro-kernel, provides a new array of device support as well as performance and security improvements.
Operating System Support Both 32-bit and 64-bit operating systems can run simultaneously in Hyper-V. Also, different platforms like Windows, Linux, and others are supported.
Support for Symmetric Multiprocessors Support for up to 64 processors in a virtual machine environment provides you with the ability to run applications as well as multiple virtual machines faster.
Network Load Balancing Hyper-V provides support for _Windows Network Load Balancing (NLB)_ to balance the network load across virtual machines on different servers.
New Hardware Architecture Hyper-V's new architecture provides improved utilization of resources such as networking and disks.
Quick Migration Hyper-V's _quick migration_ feature provides you with the functionality to run virtual machines in a clustered environment with switchover capabilities when there is a failure. Thus, you can reduce downtime and achieve higher availability of your virtual machines.
Virtual Machine Snapshot You can take snapshots of running virtual machines, which provides you with the capability to recover to any previous virtual machine snapshot state quickly and easily.
Resource Metering Hyper-V _resource metering_ allows an organization to track usage within the businesses departments. It allows an organization to create a usage-based billing solution that adjusts to the provider's business model and strategy.
Scripting Using the Windows Management Instrumentation (WMI) interfaces and APIs, you can easily build custom scripts to automate processes in your virtual machines.
RemoteFX Windows Server 2012 R2 Hyper-V RemoteFX allows for an enhanced user experience for RemoteFX desktops by providing a 3D virtual adapter, intelligent codecs, and the ability to redirect USB devices in virtual machines.
Fibre Channel The virtual Fibre Channel feature allows you to connect to the Fibre Channel storage unit from within the virtual machine. _Virtual Fibre Channel_ allows an administrator to use their existing Fibre Channel to support virtualized workloads. Hyper-V users have the ability to use Fibre Channel storage area networks (SANs) to virtualize the workloads that require direct access to SAN logical unit numbers (LUNs).
Enhanced Session Mode _Enhanced Session Mode_ enhances the interactive session of the Virtual Machine Connection for Hyper-V administrators who want to connect to their virtual machines. It gives administrators the same functionality as a remote desktop connection when the administrator is interacting with a virtual machine.
In previous versions of Hyper-V, the virtual machine connection gave you limited functionality while you connected to the virtual machine screen, keyboard, and mouse. An administrator could use an RDP connection to get full redirection abilities, but that would require a network connection to the virtual machine host.
Enhanced Session Mode gives administrators the following benefits for local resource redirection:
* Display configuration
* Audio
* Printers
* Clipboard
* Smart cards
* Drives
* USB devices
* Supported Plug and Play devices
Shared Virtual Hard Disk Windows Server 2012 R2 Hyper-V has a new feature called Shared Virtual Hard Disk. _Shared Virtual Hard Disk_ allows an administrator to cluster virtual machines by using shared virtual hard disk (VHDX) files.
Shared virtual hard disks allow an administrator to build a high availability infrastructure, which is important if you are setting up either a private cloud deployment or a cloud-hosted environment for managing large workloads. Shared virtual hard disks allow two or more virtual machines to access the same virtual hard disk (VHDX) file.
Automatic Virtual Machine Activation (AVMA) _Automatic Virtual Machine Activation (AVMA)_ is a new feature that allows administrators to install virtual machines on a properly activated Windows Server 2012 R2 system without the need to manage individual product keys for each virtual machine. When using AVMA, virtual machines get bound to the licensed Hyper-V server as soon as the virtual machine starts.
Network Isolation One nice feature of using Microsoft Hyper-V network virtualization is the ability of Hyper-V to keep virtual networks isolated from the physical network infrastructure of the hosted system. Because administrators can set up Hyper-V software–defined virtualization policies, you are no longer limited by the IP address assignment or VLAN isolation requirements of the physical network. Hyper-V allows for built-in network isolation to keep the virtual network separated from the virtual network.
Dynamic Memory _Dynamic Memory_ is a feature of Hyper-V that allows it to balance memory automatically among running virtual machines. Dynamic Memory allows Hyper-V to adjust the amount of memory available to the virtual machines in response to the needs of the virtual machines. It is currently available for Hyper-V in Windows Server 2012 R2.
#### Supported Guest Operating Systems
The following guest operating systems have been successfully tested on Hyper-V and are hypervisor-aware. Table 9.1 shows all of the guest server operating systems and the maximum number of virtual processors. Table 9.2 shows all of the guest client operating systems and the maximum number of virtual processors.
**TABLE 9.1** Hyper-V guest server operating systems
Guest Operating System (Server) | Maximum Number of Virtual Processors
---|---
Windows Server 2012 and Server 2012 R2 | 64
Windows Server 2008 R2 with Service Pack 1 (SP1) | 64
Windows Server 2008 R2 | 64
Windows Server 2008 with Service Pack 2 (SP2) | 8
Windows Home Server 2011 | 4
Windows Small Business Server 2011 | Essentials edition: 2
Standard edition: 4
Windows Server 2003 R2 with Service Pack 2 (SP2) | 2
Windows Server 2003 with Service Pack 2 (SP2) | 2
Red Hat Enterprise Linux 5.7 and 5.8 | 64
Red Hat Enterprise Linux 6.0–6.3 | 64
SUSE Linux Enterprise Server 11 SP2 | 64
Open SUSE 12.1 | 64
Ubuntu 12.04 | 64
**TABLE 9.2** Hyper-V guest client operating systems
Guest Operating System (Client) | Maximum Number of Virtual Processors
---|---
Windows 8 | 32
Windows 7 with Service Pack 1 (SP1) | 4
Windows 7 | 4
Windows Vista with Service Pack 2 (SP2) | 2
Windows XP with Service Pack 3 (SP3) | 2
Windows XP x64 Edition with Service Pack 2 (SP2) | 2
CentOS 5.7 and 5.8 | 64
CentOS 6.0–6.3 | 64
Red Hat Enterprise Linux 5.7 and 5.8 | 64
Red Hat Enterprise Linux 6.0–6.3 | 64
SUSE Linux Enterprise Server 11 SP2 | 64
Open SUSE 12.1 | 64
Ubuntu 12.04 | 64
* * *
The list of supported guest operating systems may always be extended. Please check the official Microsoft Hyper-V site to obtain a current list of supported operating systems: www.microsoft.com/virtualization.
* * *
### Hyper-V Architecture
This section will provide you with an overview of the Hyper-V architecture (see Figure 9.1). I'll explain the differences between a hypervisor-aware and a non-hypervisor-aware child partition.
**FIGURE 9.1** Hyper-V architecture
As you can see, Hyper-V is based on the new microkernel architecture. Hyper-V provides a virtualization layer called a _hypervisor_ that runs directly on the system hardware. You can see that the hypervisor is similar to what the kernel is to Windows. It is a software layer responsible for the interaction with the core hardware and works in conjunction with an optimized instance of Windows Server 2012 R2 that allows running multiple operating systems on a physical server simultaneously. The Hyper-V architecture consists of the hypervisor and parent and child partitions.
The Windows Server 2012 R2 operating system runs in the parent partition, and it delivers the WMI provider for scripting as well as the VM service.
Virtual machines each run in their own child partitions. Child partitions do not have direct access to hardware resources; instead, they have a virtual view of the resources, which are called _virtual devices._
If you're running a hypervisor-aware operating system like Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, or Windows Server 2012 R2 in your virtual machine, any request to the virtual devices is redirected via the high-speed bus to the devices in the parent partition, which will manage the requests.
By default, only Windows Server 2008 R2, Server 2012, and Server 2012 R2 are hypervisor-aware operating systems. Once you install Hyper-V Integration Components on an operating system other than Windows Server 2008 R2 and newer, it will be hypervisor-aware. Microsoft provides a hypervisor adapter to make Linux hypervisor aware.
Non-hypervisor-aware operating systems (for example, Windows NT 4.0) use an emulator to communicate with the Windows hypervisor, which is slower than molasses in the winter.
### Hyper-V Requirements
The following sections will describe the hardware and software requirements for installing the Hyper-V server role. It is important to understand these requirements for obtaining your software license as well as for planning for server hardware. When you understand the requirements, you can design and configure a Hyper-V solution that will meet the needs of your applications.
#### Hardware Requirements
In addition to the basic hardware requirements for Windows Server 2012 R2, there are requirements for running the Hyper-V server role on your Windows server. They are listed in Table 9.3.
**TABLE 9.3** Hardware requirements for Hyper-V
Requirement Area | Definition
---|---
CPU | x64-compatible processor with Intel VT or AMD-V technology enabled. Hardware Data Execution Prevention (DEP), specifically Intel XD bit (execute disable bit) or AMD NX bit (no execute bit), must be available and enabled. Minimum: 1.4GHz. Recommended: 2GHz or faster.
Memory | Minimum: 1GB RAM. Recommended: 2GB RAM or greater. (Additional RAM is required for each running guest operating system.) Maximum: 1TB.
Hard disk | Minimum: 8GB. Recommended: 20GB or greater. (Additional disk space needed for each guest operating system.)
The Add Roles Wizard in Server Manager additionally verifies the hardware requirements. A good starting point is to check your hardware against the Microsoft hardware list to make sure that Windows Server 2012 R2 supports your hardware. If you try to install the Hyper-V server role on a computer that does not meet the CPU requirements, you'll get a warning window that looks like Figure 9.2.
**FIGURE 9.2** Warning window that Hyper-V cannot be installed
#### Software Requirements
To use virtualization in Windows Server 2012 R2, you need to consider the basic software requirements for Hyper-V. Hyper-V runs only on the following editions of the Windows Server 2012 R2 operating system:
* Windows Server 2012 R2 Standard edition
* Windows Server 2012 R2 Datacenter edition
* Microsoft Hyper-V Server 2012 R2 edition
## Hyper-V Installation and Configuration
The following sections explain how to install the Hyper-V role using Server Manager in Windows Server 2012 R2 Full installation mode or the command line mode in Windows Server 2012 R2 Server Core. We will then take a look at Hyper-V as part of Server Manager before discussing how to use the Hyper-V Manager. Finally, we will look at the Hyper-V server settings and then cover two important areas for Hyper-V: virtual networks and virtual hard disks.
### Install the Hyper-V Role
Now it's time to see how to install the Hyper-V server role on the two installation options of Windows Server 2012 R2, namely, a Full installation and a Server Core installation.
#### Installing Hyper-V in Full Installation Mode
You can install the Hyper-V server role on any Windows Server 2012 R2 installation for which the Full option was chosen. In addition, the server must meet both the hardware and software requirements. The installation process is simple, as Exercise 9.1 demonstrates.
* * *
### EXERCISE 9.1: Installing Hyper-V in Full Installation Mode
1. Open Server Manager.
2. In Server Manager, choose option 2, Add Roles And Features.
3. At the Select Installation Type page, choose the role-based or feature-based installation. Click Next.
4. On the Select Destination Server screen, choose Select A Server From The Server Pool and choose the server to which you want to add this role. Click Next.
5. On the Select Server Roles screen, click the check box next to Hyper-V. When the Add Features dialog box appears, click the Add Features button. Then click Next.
6. At the Select Features screen, click Next.
7. At the Hyper-V introduction screen, click Next.
8. At the Create Virtual Switches screen, choose your adapter and click Next.
9. At the Virtual Machine Migration screen, click Next. You want to use migration only if you have multiple Hyper-V servers. Since we will have only one for this exercise, just skip this screen.
10. At the Default Stores screen, accept the defaults and click Next.
11. At the Confirmation screen, click the Install button.
12. After the installation is complete, click the Close button.
13. Restart your server.
* * *
#### Installing Hyper-V in Server Core
The Server Core installation option is introduced in Windows Server 2012 R2. It creates an operating system installation without a GUI shell. You can either manage the server remotely from another system or use the Server Core's command-line interface.
This installation option provides the following benefits:
* Reduces attack surface (because fewer applications are running on the server)
* Reduces maintenance and management (because only the required options are installed)
* Requires less disk space and produces less processor utilization
* Provides a minimal parent partition
* Reduces system resources required by the operating system as well as the attack surface
By using Hyper-V on a Server Core installation, you can fundamentally improve availability because the attack surface is reduced and the downtime required for installing patches is optimized. It will thus be more secure and reliable with less management.
To install Hyper-V for a Windows Server 2012 R2 installation, you must execute the following command in the command-line interface:
Dism /online /enable-feature /featurename:Microsoft-Hyper-V
### Hyper-V in Server Manager
As with all of the other Windows Server 2012 R2 roles, the Hyper-V role neatly integrates into Server Manager. Server Manager filters the information just for the specific role and thus displays only the required information. As you can see in Figure 9.3, the Hyper-V Summary page shows related event log entries, the state of the system services for Hyper-V, and useful resources and support.
**FIGURE 9.3** Hyper-V in Server Manager
### Using Hyper-V Manager
_Hyper-V Manager_ is the central management console to configure your server and create and manage your virtual machines, virtual networks, and virtual hard disks. Unlike Virtual Server 2005, where you managed all virtual machines through a web interface, Hyper-V Manager is managed through a Microsoft Management Console (MMC) snap-in. You can access it either in Server Manager or by using Administrative Tools Hyper-V Manager. Figure 9.4 shows how Hyper-V Manager looks once you start it.
**FIGURE 9.4** Hyper-V Manager
Hyper-V Manager is available for the following operating systems:
* Windows Server 2012 R2
* Windows Server 2008 R2
* Windows Server 2008
* Windows 8
* Windows 7
* Windows Vista with Service Pack 1 (SP1)
Hyper-V Manager is installed on a Windows Server 2012 R2 machine only when you install Hyper-V on it. On Windows Server 2008/2008 R2, Server 2003, Windows Vista, Windows 7, or Windows 8, you will need to install the Hyper-V Manager MMC.
You can use Hyper-V Manager to connect to any Full or Server Core installation remotely. Besides Hyper-V Manager, you can use the WMI interface for scripting Hyper-V.
### Configure Hyper-V Settings
In this section, you will get an overview of the available Hyper-V settings for the server. You configure all server-side default configuration settings like default locations of your configuration files or the release key. You can open the Hyper-V Settings page (see Figure 9.5) in Hyper-V Manager by clicking Hyper-V Settings in the Actions pane.
**FIGURE 9.5** Hyper-V Settings
The Hyper-V Settings page includes the following settings:
Virtual Hard Disks Specifies the default location of your virtual hard disk files (`.vhd and .vdhx`).
Virtual Machines Specifies the default location of your virtual machine configuration files. It includes the Virtual Machine XML configuration files (part of the `Virtual Machines` folder) as well as related snapshots (part of the `Snapshot` folder).
Physical GPUs This feature allows for graphical processing unit (GPU) accelerated video within a virtual machine. The GPU will allow you to support 3D GPU accelerated graphics.
NUMA Spanning An administrator can configure Hyper-V to allow virtual machines to span nonuniform memory architecture (NUMA) nodes. When the physical computer has NUMA nodes, this setting provides virtual machines with additional computing resources. Spanning NUMA nodes can help you run more virtual machines at the same time. However, using NUMA can decrease overall performance.
Live Migrations _Live migration_ allows a Hyper-V administrator to relocate running virtual machines easily from one node of the failover cluster to another node in the same cluster. Live Migration is explained in more detail later in this chapter.
Storage Migrations _Storage Migration_ allows an administrator to move their virtual machine storage from one location to another. This setting allows you to specify how many storage migrations can be performed at the same time on this system.
Replication Configuration This setting allows you to configure this computer as a Replica Server to another Hyper-V server. Hyper-V Replica allows administrators to replicate their Hyper-V virtual machines from one Hyper-V host at a primary site to another Hyper-V host at the Replica site.
Each node of the failover cluster that is involved in Replica must have the Hyper-V server role installed. One of the servers in the Hyper-V replication needs to be set up as a Replica Broker to allow the replication to work properly.
Keyboard Defines how to use Windows key combinations. Options are Physical Computer, Virtual Machine, and Virtual Machine Only When Running Full Screen.
Mouse Release Key Specifies the key combination to release the mouse in your virtual machine. Options are Ctrl+Alt+left arrow, Ctrl+Alt+right arrow, Ctrl+Alt+space, and Ctrl+Alt+Shift.
Reset Check Boxes Resets any check boxes that hide pages and messages when checked. This will bring any window up again on which you checked the Do Not Show This Window Again check box.
### Manage Virtual Switches
A _virtual network_ provides the virtual links between nodes in either a virtual or physical network. Virtual networking in Hyper-V is provided in a secure and dynamic way because you can granularly define virtual network switches for their required usage. For example, you can define a private or internal virtual network if you don't want to allow your virtual machines to send packages to the physical network.
To allow your virtual machines to communicate with each other, you need virtual networks. Just like normal networks, virtual networks exist only on the host computer and allow you to configure how virtual machines communicate with each other, with the host, and with the network or the Internet. You manage virtual networks in Hyper-V using Virtual Switch Manager, as shown in Figure 9.6.
**FIGURE 9.6** Virtual Network Manager
Using _Virtual Switch Manager_ , you can create, manage, and delete virtual switches. You can define the network type as external, internal only, or private.
External Any virtual machine connected to this virtual switch can access the physical network. You would use this option if you want to allow your virtual machines to access, for example, other servers on the network or the Internet. This option is used in production environments where your clients connect directly to the virtual machines.
Internal This option allows virtual machines to communicate with each other as well as the host system but not with the physical network. When you create an internal network, it also creates a local area connection in Network Connections that allows the host machine to communicate with the virtual machines. You can use this if you want to separate your host's network from your virtual networks.
Private When you use this option, virtual machines can communicate with each other but not with the host system or the physical network; thus, no network packets are hitting the wire. You can use this to define internal virtual networks for test environments or labs, for example.
On the external and internal-only virtual networks, you also can enable virtual LAN (VLAN) identification. You can use VLANs to partition your network into multiple subnets using a VLAN ID. When you enable virtual LAN identification, the NIC that is connected to the switch will never see packets tagged with VLAN IDs. Instead, all packets traveling from the NIC to the switch will be tagged with the access mode VLAN ID as they leave the switch port. All packets traveling from the switch port to the NIC will have their VLAN tags removed. You can use this if you are already logically segmenting your physical machines and also use it for your virtual ones.
Exercise 9.2 explains how to create an internal-only virtual switch.
* * *
### EXERCISE 9.2: Creating an Internal Virtual Network
1. Click the Windows Key Administrative Tools Hyper-V Manager.
2. In Hyper-V Manager, in the Actions pane, choose Virtual Switch Manager.
3. On the Virtual Switch page, select Private and click the Create Virtual Switch button.
4. On the New Virtual Switch page, enter **Private Virtual Network** in the Name field.
5. Click OK.
* * *
When you create the internal virtual switch, a network device is created in Network Connections, as shown in Figure 9.7.
**FIGURE 9.7** Virtual network card
This is also the case when you create an external virtual network because it will replace the physical network card of the host machine to give the parent partition a virtual network card that is also used in the child partitions.
Unlike with Virtual Server 2005, Hyper-V binds the virtual network service to a physical network adapter only when an external virtual network is created. The benefit of this is that the performance is better if you do not use the external virtual network option. The downside, however, is that there will be a network disruption when you create or delete an external virtual network.
* * *
Communication between the virtual machine and the local host computer is not configured automatically. Once you install a virtual machine, you need to make sure that the TCP/IP settings are in agreement with the settings you define in the virtual network card. Start with a ping from your host machine to the virtual machines to verify that communication is working.
* * *
### Managing Virtual Hard Disks
In addition to virtual networks, you need to manage virtual hard disks that you attach to your virtual machines. A virtual hard disk in Hyper-V, apart from a pass-through disk, is a VHD or VHDX file that basically simulates a hard drive on your virtual machine.
The following sections will first show you what types of virtual hard disks are available and then show you how to create them. You will also learn about what options are available to manage virtual hard disks.
#### Types of Hard Disks
Depending on how you want to use the disk, Hyper-V offers various types, as described in Table 9.4.
**TABLE 9.4** Virtual hard disks in Hyper-V
Type of disk | Description | When to use it
---|---|---
Dynamically expanding | This disk starts with a small VHD file and expands it on demand once an installation takes place. It can grow to the maximum size you defined during creation. You can use this type of disk to clone a local hard drive during creation. | This option is effective when you don't know the exact space needed on the disk and when you want to preserve hard disk space on the host machine. Unfortunately, it is the slowest disk type.
Fixed size | The size of the VHD file is fixed to the size specified when the disk is created. This option is faster than a dynamically expanding disk. However, a fixed-size disk uses up the maximum defined space immediately. This type is ideal for cloning a local hard drive. | A fixed-size disk provides faster access than dynamically expanding or differencing disks, but it is slower than a physical disk.
Differencing | This type of disk is associated in a parent-child relationship with another disk. The differencing disk is the child, and the associated virtual disk is the parent. Differencing disks include only the differences to the parent disk. By using this type, you can save a lot of disk space in similar virtual machines. This option is suitable if you have multiple virtual machines with similar operating systems. | Differencing disks are most commonly found in test environments and should not be used in production environments.
Physical (or pass-through disk) | The virtual machine receives direct pass-through access to the physical disk for exclusive use. This type provides the highest performance of all disk types and thus should be used for production servers where performance is the top priority. The drive is not available for other guest systems. | This type is used in high-end datacenters to provide optimum performance for VMs. It's also used in failover cluster environments.
#### Creating Virtual Hard Disks
To help you gain practice in creating virtual hard disks, the following three exercises will teach you how to create a differencing hard disk, how to clone an existing disk by creating a new disk, and how to configure a physical or pass-through disk to your virtual machine. First, in Exercise 9.3, you will learn how to create a differencing virtual hard disk.
* * *
### EXERCISE 9.3: Creating a Differencing Hard Disk
1. Open Hyper-V Manager.
2. In Hyper-V Manager, on the Actions pane, choose New Hard Disk.
3. In the New Virtual Hard Disk Wizard, click Next on the Before You Begin page.
4. At the Choose Disk Format screen, choose VHDX and click Next. The size of your VHDs depends on which format you choose. If you're going to have a VHD larger than 2,040GB, use VHDX. If your VHD is less than 2,040GB, then you should use VHD.
5. On the Choose Disk Type page, select Fixed Size and click Next.
6. On the Specify Name And Location page, enter the new name of the child disk (for example, **`newvirtualharddisk.vhd`** ). You can also modify the default location of the new VHD file if you want. Click Next to continue.
7. Next, on the Configure Disk page, you need to specify the size of the VHD file. Choose a size based on your hard disk and then click Next to continue. I used 60GB as our test size.
8. On the Completing The New Virtual Hard Disk Wizard page, verify that all settings are correct and click Finish to create the hard disk.
* * *
The process to add a physical or pass-through disk to a virtual machine is quite different. For this, first you need to create the virtual machine, and then you open the virtual machine settings to configure the physical disk. If you want to add a physical disk to a virtual machine, the physical disk must be set as Offline in Disk Management, as shown in Figure 9.8.
**FIGURE 9.8** In Disk Management, you can set disks as Offline.
To access Disk Management, click the Windows key, choose Administrative Tools Computer Management, expand Storage in the left pane, and click Disk Management.
* * *
You cannot share a physical disk among multiple virtual machines or with the host system.
* * *
Physical or pass-through disks might not be that important if your use of virtualization is based on test environments, but they become crucial when you need to plan for highly available virtual datacenters. This is especially true if you consider using failover clusters to provide the Quick Migration feature, which is when you should consider matching one logical unit number (LUN) from your enterprise storage system or storage area network (SAN) as one physical disk. This provides you with the optimum performance you need in such an environment.
#### Managing Virtual Hard Disks
Hyper-V also provides two tools to manage virtual hard disks: Inspect Disk and Edit Disk. These tools are available on the Actions pane in Hyper-V Manager.
Inspect Disk This provides you with information about the virtual hard disk. It shows you not only the type of the disk but also information such as the maximum size for dynamically expanding disks and the parent VHD for differencing disks.
Edit Disk This provides you with the Edit Virtual Hard Disk Wizard, which you can use to compact, convert, expand, merge, or reconnect hard disks. Figure 9.9 shows you the wizard's options when you select a dynamically expanding disk.
**FIGURE 9.9** The Edit Virtual Hard Disk Wizard
Table 9.5 provides you with an overview of what you can do with the wizard.
**TABLE 9.5** Edit Disk overview
Action | Description
---|---
Compact | Reduces the size of a dynamically expanding or differencing disk by removing blank space from deleted files.
Convert | Converts a dynamically expanding disk to a fixed disk or vice versa.
Expand | Increases the storage capacity of a dynamically expanding disk or a fixed virtual hard disk.
Merge | Merges the changes from a differencing disk into either the parent disk or another disk (applies to differencing disks only!).
Reconnect | If a differencing disk no longer finds its referring parent disk, this option can reconnect the parent to the disk.
#### Generation 1 vs. Generation 2 VHDs
Previous versions of Hyper-V had some pretty major drawbacks. One big drawback was that Hyper-V could not boot a virtual machine from a virtual hard drive that was SCSI. Believe it or not, SCSI controllers were not even recognized by Hyper-V unless you installed the Integration Services component.
Another issue that the previous versions of Hyper-V had was the inability to copy files from the Hyper-V host to the virtual machines without the use of a network connection in the virtual machine. The older versions of Hyper-V, prior to Windows Server 2012 R2, are now considered generation 1 versions. Why is it so important to know which generations of Hyper-V you should use or need to use?
Hyper-V generations help determine what functionality and what virtual hardware you can use in your virtual machine. Windows Server 2012 R2 Hyper-V now supports two different virtual machine generations: generation 1 and generation 2.
As already explained, previous versions of Hyper-V are considered generation 1, and this provides the same virtual hardware to the virtual machine as in previous versions of Hyper-V.
Generation 2 is now included with Windows Server 2012 R2, and it provides new functionality on the virtual machines including secure boot (which is enabled by default), the ability to boot from a SCSI virtual hard disk or boot from a SCSI virtual DVD, the ability to use a standard network adapter to PXE boot, and Unified Extensible Firmware Interface (UEFI) firmware support. Generation 2 now gives you the ability to support UEFI firmware instead of BIOS-based firmware.
So when you create VHDs in Windows Server 2012 R2, one of your choices will be the ability to create the VHDs as a generation 1 or generation 2 VHD. If you need the ability to have your VHDs run on older versions of Hyper-V, make them a generation 1 VHD. If they are going to run only on Windows Server 2012 R2, make your VHDs generation 2 and take advantage of all the new features and functionality.
## Configuring Virtual Machines
The following sections cover the topics of creating and managing virtual machines as well as how to back up and restore virtual machines using features such as Import and Export and Snapshot. You'll also briefly look at Hyper-V's Live Migration feature.
### Creating and Managing Virtual Machines
It is important to learn how to create a virtual machine, how to change its configuration, and how to delete it. You will take a look at the Virtual Machine Connection tool and install the Hyper-V Integration Components onto a virtual machine.
#### Virtual Machines
Virtual machines define the child partitions in which you run operating system instances. Each virtual machine is separate and can communicate with the others only by using a virtual network. You can assign hard drives, virtual networks, DVD drives, and other system components to it. A virtual machine is similar to an existing physical server, but it no longer runs on dedicated hardware—it shares the hardware of the host system with the other virtual machines that run on the host.
Exercise 9.4 shows you how to create a new virtual machine.
* * *
### EXERCISE 9.4: Creating a New Virtual Machine
1. Open Hyper-V Manager.
2. In Hyper-V Manager, on the Actions pane, choose New Virtual Machine.
3. In the New Virtual Machine Wizard, click Next on the Before You Begin page.
4. On the Specify Name And Location page, give your virtual machine a name and change the default location of the virtual machine configuration files. Click Next to continue.
5. On the Assign Memory page, define how much of your host computer's memory you want to assign to this virtual machine. Remember that once your virtual machine uses up all of your physical memory, it will start swapping to disk, thus reducing the performance of all virtual machines. Click Next to continue.
6. On the Configure Networking page, select the virtual network that you previously configured using Virtual Network Manager. Click Next to continue.
7. On the next page, you configure your virtual hard disk. You can create a new virtual hard disk, select an existing disk, or choose to attach the hard disk later. Be aware that you can create only a dynamically expanding virtual disk on this page; you cannot create a differencing, physical, or fixed virtual hard disk there. However, if you created the virtual hard disk already, you can, of course, select it. Click Next to continue.
8. On the Installation Options page, you can select how you want to install your operating system. You have the option to install an operating system later, install the operating system from a boot CD/DVD-ROM where you can select a physical device or an image file (ISO file), install an operating system from a floppy disk image (VFD file, or a virtual boot floppy disk), or install an operating system from a network-based installation server. The last option will install a legacy network adapter to your virtual machine so that you can boot from the network adapter. Select Install An Operating System Later and then click Next.
9. On the Completing The New Virtual Machine Wizard summary page, verify that all settings are correct. You also have the option to start the virtual machine immediately after creation. Click Next to create the virtual machine.
10. Repeat this process and create a few more virtual machines.
11. If you want to install an operating system on one of the VMs, start the VM, load a Windows Server 2012 R2 installation disk into the DVD drive, and then, under the Media menu, choose DVD and Capture. Then just do a normal install.
* * *
After completing Exercise 9.4, you will have a virtual machine available in Hyper-V Manager. Initially, the state of the virtual machine will be Off. Virtual machines can have the following states: Off, Starting, Running, Paused, and Saved. You can change the state of a virtual machine in the Virtual Machines pane by right-clicking the virtual machine's name, as shown in Figure 9.10, or by using the Virtual Machine Connection window.
**FIGURE 9.10** Options available when right-clicking a virtual machine
Here is a list of some of the state options (when the VM is running) available for a virtual machine:
Start Turn on the virtual machine. This is similar to pressing the power button when the machine is turned off. This option is available when your virtual machine is Off or in Saved state.
Turn Off Turn off the virtual machine. This is similar to pressing the power-off button on the computer. This option is available when your virtual machine is in Running, Saved, or Paused state.
Shut Down This option shuts down your operating system. You need to have the Hyper-V Integration Components installed on the operating system; otherwise, Hyper-V will not be able to shut down the system.
Save The virtual machine is saved to disk in its current state. This option is available when your virtual machine is in Running or Paused state.
Pause Pause the current virtual machine, but do not save the state to disk. You can use this option to release processor utilization quickly from this virtual machine to the host system.
Reset Reset the virtual machine. This is like pressing the reset button on your computer. You will lose the current state and any unsaved data in the virtual machine. This option is available when your virtual machine is in Running or Paused state.
Resume When your virtual machine is paused, you can resume it and bring it online again.
#### Changing Configuration on an Existing Virtual Machine
To change the configuration settings on an existing virtual machine, you right-click your virtual machine's name in the Virtual Machines pane in Hyper-V Manager and choose Settings. You can change settings such as memory allocation and hard drive configuration. All items that you can configure are described in the following list:
Add Hardware Add devices to your virtual machine, namely, a SCSI controller, a network adapter, or a legacy network adapter. A legacy network adapter is required if you want to perform a network-based installation of an operating system.
BIOS This is the replacement of the virtual machine's BIOS. Because you can no longer enter the BIOS during startup, you need to configure it with this setting. You can turn Num Lock on or off and change the basic startup order of the devices.
Memory Change the amount of random access memory (RAM) allocated to the virtual machine.
Processor Change the number of logical processors this virtual machine can use and define resource control to balance resources among virtual machines by using a relative weight.
IDE Controller Add/change and remove devices from the IDE controller. You can have hard drives or DVD drives as devices. Every IDE controller can have up to two devices attached, and by default, you have two IDE controllers available.
Hard Drive Select a controller to attach to this device as well as to specify the media to use with your virtual hard disk. The available options are Virtual Hard Disk File (with additional buttons labeled New, Edit, Inspect, and Browse that are explained in the virtual hard disk section) and Physical Hard Disk. You can also remove the device here.
DVD Drive Select a controller to attach to this device and specify the media to use with your virtual CD/DVD drive. The available options are None, Image File (ISO Image), and Physical CD/DVD Drive Connected To The Host Computer. You also can remove the device here.
SCSI Controller Configure all hard drives that are connected to the SCSI controller. You can add up to 63 hard drives to each SCSI controller, and you can have multiple SCSI controllers available.
Network Adapter Specify the configuration of the network adapter or remove it. You can also configure the virtual network and MAC address for each adapter and enable virtual LAN identification.
COM1 and COM2 Configure the virtual COM port to communicate with the physical computer through a named pipe. You have COM1 and COM2 available.
Diskette Specify a virtual floppy disk file to use.
Name Edit the name of the virtual machine and provide some notes about it.
Integration Services Define what integration services are available to your virtual machine. Options are Operating System Shutdown, Time Synchronization, Data Exchange, Heartbeat, and Backup (Volume Snapshot).
Snapshot File Location Define the default file location of your snapshot files.
Smart Paging File Location This area allows you to set up a paging file for your virtual machine.
Windows Server 2012 R2 has a Hyper-V feature called _Smart Paging_. If you have a virtual machine that has a smaller amount of memory than what it needs for startup memory, when the virtual machine gets restarted, Hyper-V then needs additional memory to restart the virtual machine. Smart Paging is used to bridge the memory gap between minimum memory and startup memory. This allows your virtual machines to restart properly.
Automatic Start Define what this virtual machine will do when the physical computer starts. Options are Nothing, Automatically Start If The Service Was Running, and Always Start This Virtual Machine. You also can define a start delay here.
Automatic Stop Define what this virtual machine will do when the physical computer shuts down. Options are Save State, Turn Off, and Shut Down.
* * *
Please be aware that only some settings can be changed when the virtual machine's state is Running. It is best practice to shut down the virtual machine before you modify any setting.
* * *
#### Deleting Virtual Machines
You can also delete virtual machines using Hyper-V Manager. This deletes all of the configuration files, as shown in Figure 9.11.
**FIGURE 9.11** Delete Virtual Machine warning window
Make sure you manually delete any virtual disks that were part of the virtual machines to free up disk space. Virtual disks are _not_ deleted when you delete a virtual machine.
#### Virtual Machine Connection
Similar to the Virtual Machine Remote Control (VMRC) client that was available with Virtual Server 2005 R2 and previous versions, Hyper-V comes with Virtual Machine Connection to connect to virtual machines that run on a local or remote server.
You can use it to log onto the virtual machine and use your computer's mouse and keyboard to interact with the virtual machine. You can open Virtual Machine Connection in Hyper-V Manager by double-clicking a virtual machine or by right-clicking a virtual machine and selecting Connect. If your virtual machine is turned off, you might see a window similar to the one in Figure 9.12.
**FIGURE 9.12** Virtual Machine Connection window when the machine is turned off
Virtual Machine Connection not only provides you with functionality similar to that of Hyper-V Manager, such as being able to change the state of a virtual machine, but it also provides you with additional features that are especially useful when you want to work with a virtual machine.
File Access Settings or Exit Virtual Machine Connection Change the state of a virtual machine and create or revert a snapshot. Additionally, you have the options to send Ctrl+Alt+Delete to your virtual machine and Insert Integration Services Setup Disk.
Context-Sensitive Buttons Provide Quick Access to Key Features These buttons are available under the menu bar to provide you with fast access to the most important features, as you can see in Figure 9.13. It shows the connection of a running VM, but the VM has not had an operating system installed yet, so the figure shows the Windows Setup screen.
**FIGURE 9.13** Virtual Machine Connection window showing a running Windows Server 2012 virtual machine
#### NIC Teaming
NIC Teaming, also known as load balancing and failover (LBFO), gives an administrator the ability to allow multiple network adapters on a system to be placed into a team. Independent hardware vendors (IHVs) have required NIC Teaming, but until Windows Server 2012, NIC Teaming was _not_ part of the Windows Server operating system.
To be able to use NIC Teaming, the computer system must have at least one Ethernet adapter. If you want to provide fault protection, an administrator must have a minimum of two Ethernet adapters. One advantage of Windows Server 2012 R2 is that an administrator can set up 32 network adapters in a NIC team.
NIC Teaming is a common practice when setting up virtualization. This is one way that you can have load balancing with Hyper-V.
NIC Teaming gives an administrator the ability to allow a virtual machine to use virtual network adapters in Hyper-V. The advantage of using NIC Teaming in Hyper-V is that the administrator can use NIC Teaming to connect to more than one Hyper-V switch. This allows Hyper-V still to have connectivity even if the network adapter under the Hyper-V switch gets disconnected.
An administrator can configure NIC Teaming in either Server Manager or PowerShell.
#### Storage Quality of Service
Windows Server 2012 R2 Hyper-V includes a new feature called _Storage Quality of Service (QoS)_. Storage QoS allows a Hyper-V administrator to manage how virtual machines access storage throughput for virtual hard disks.
Storage QoS gives an administrator the ability to guarantee that the storage throughput of a single VHD cannot adversely affect the performance of another VHD on the same host. It does this by giving administrators the ability to specify the maximum and minimum I/O loads based on I/O operations per second (IOPS) for each virtual disk in your virtual machines.
To configure Storage QoS, you would set the maximum IOPS values (or limits) and set the minimum values (or reserves) on virtual hard disks for virtual machines.
* * *
If you are using shared virtual hard disks, Storage QoS will not be available.
* * *
#### Installing Hyper-V Integration Components
Hyper-V _Integration Components_ , also called _Integration Services_ , are required to make your guest operating system hypervisor-aware. Similar to the VM Additions that were part of Microsoft Virtual Server 2005, these components improve the performance of the guest operating system once they are installed. From an architectural perspective, virtual devices are redirected directly via the VMBus; thus, quicker access to resources and devices is provided.
If you do not install the Hyper-V Integration Components, the guest operating system uses emulation to communicate with the host's devices, which of course makes the guest operating system slower.
Exercise 9.5 shows you how to install Hyper-V Integration Components on one of your virtual machines running Windows Server 2012.
* * *
### EXERCISE 9.5: Installing Hyper-V Integration Components
1. Open Hyper-V Manager.
2. In Hyper-V Manager, in the Virtual Machines pane, right-click the virtual machine on which you want to install Hyper-V Integration Components and click Start.
3. Right-click the virtual machine again and click Connect. Meanwhile, your virtual machine should already be booting.
4. If you need to log into the operating system of your virtual machine, you should do so.
5. Once the Windows Desktop appears, you need to select Insert Integration Services Setup Disk from the Actions menu of your Virtual Machine Connection window.
6. Once the Hyper-V Integration Components are installed, you are asked to perform a reboot.
After the reboot, Hyper-V Integration Components are installed on your operating system, and you will be able to use them.
* * *
## Summary
Virtualization is quickly becoming a hot topic in information technology. The potential for consolidation is tremendous, and thus it will become more and more important.
After reading this chapter, you should have a good understanding of the Hyper-V architecture and what is required to install Hyper-V.
The section about installation and configuration covered various basic aspects of configuring the virtualization environment. You learned about the different types of virtual networks that are available, the options for installing the Hyper-V role, and the various types of virtual hard disks that you can use to optimize virtualization for your specific scenario.
You also learned how to configure virtual machines using the Hyper-V environment and how to create your own virtual datacenter on top of your Hyper-V machines. I showed you how to create and manage virtual machines, how to use Virtual Machine Connection to control a virtual machine remotely, and how to install Hyper-V Integration Components. You also learned how to export and import virtual machines as well as how to do snapshots of your virtual machine.
If you have never worked with virtualization software before, the information in this chapter may have been completely new to you. You should now be well prepared to try Hyper-V in your own environment.
## Exam Essentials
Understand Hyper-V's architecture. When you have a good understanding of Hyper-V's architecture, especially when an operating system in a virtual machine is hypervisor aware versus non-hypervisor aware, you have a solid understanding of what is important from an architectural perspective.
You should know about the Hyper-V Integration Components and how they change the behavior of a virtual machine. Also know for which operating systems the integration components are available.
Know Hyper-V's requirements and how to install it. Know the hardware and software requirements as well as how to install Hyper-V. Hyper-V requires an x64-based processor and Data Execution Protection (DEP). Hardware-assisted virtualization must be enabled—don't forget this! Also remember that you can install Hyper-V two ways: using Server Manager or using the command line in Server Core.
Understand virtual networks and virtual hard disks. Virtual networks and hard disks are the two most tested topics. You definitely should know the types of virtual networks available (that is, external, internal only, and private virtual network) as well as all types of virtual hard disks (namely, dynamically expanding, fixed size, differential, and physical or pass-through). You should be able to apply the correct one when needed. Don't forget the Edit Virtual Hard Disk Wizard, which is also a good source for questions in the exam.
Know how to create and manage virtual machines. You should be able to explain how to create a virtual machine, what options are available to install an operating system in a virtual machine, and how to install the Hyper-V Integration Components on a virtual machine. Don't forget about the virtual machine states and the virtual machine settings!
Understand how to back up and restore virtual machines. Have a good understanding of the concept of exporting and importing virtual machines, how snapshots work, and what lies behind a quick migration. Understand how you can export a virtual machine, what you should consider when moving it to a new host machine, and what happens after importing it to the import folder. The same applies to snapshots: You need to know what options you have available and what each option will do. Especially recognize the difference between applying and reverting a snapshot.
## Review Questions
1. On which of the following x64 editions of Windows Server 2012 R2 does Hyper-V run? (Choose all that apply.)
1. Windows Server 2012 R2 Web Edition
2. Windows Server 2012 R2 Standard Edition
3. Windows Server 2012 R2 Itanium Edition
4. Windows Server 2012 R2 Datacenter Edition
2. You want to build a test environment based on virtual machines on a single Windows Server 2012 R2 machine, but you also want to make sure that the virtual machines communicate only with each other. What type of virtual network do you need to configure?
1. External
2. Internal only
3. Private virtual machine network
4. Public virtual machine network
3. Andy wants to change the memory of a virtual machine that is currently powered up. What does he need to do?
1. Shut down the virtual machine, use the virtual machine's settings to change the memory, and start it again.
2. Use the virtual machine's settings to change the memory.
3. Pause the virtual machine, use the virtual machine's settings to change the memory, and resume it.
4. Save the virtual machine, use the virtual machine's settings to change the memory, and resume it.
4. You want to make sure that the hard disk space for your virtual machines is occupied only when needed. What type of virtual hard disk would you recommend?
1. Dynamically expanding disk
2. Fixed-size disk
3. Differencing disk
4. Physical or pass-through disk
5. How do you add a physical disk to a virtual machine?
1. Use the Virtual Hard Disk Wizard.
2. Use the Edit Virtual Hard Disk Wizard.
3. Use the virtual machine's settings.
4. Use the New Virtual Machine Wizard.
6. Rich bought a new server with an Itanium IA-64 processor, 4GB RAM, and a SAN that provides 1TB hard disk space. After installing Windows Server 2012 R2 for Itanium-based systems, he wants to install Hyper-V on this server. Can Hyper-V be installed on this system?
1. Yes
2. No
7. What are the minimum CPU requirements for running Hyper-V on a machine? (Choose all that apply.)
1. An x64-based processor (Intel or AMD).
2. Hardware Data Execution Protection (DEP) must be enabled.
3. Hardware-assisted virtualization must be enabled.
4. The processor must at least have a dual core.
8. What is the command to install Hyper-V on a Windows Server 2008 machine that was installed in Server Core?
1. `start /w ocsetup Hyper-V`
2. `start /w ocsetup microsoft-hyper-v`
3. `start /w ocsetup Microsoft-Hyper-V`
4. `start /w ocsetup hyper-v`
9. On what operating systems can you install the Hyper-V Manager MMC? (Choose all that apply.)
1. Windows Server 2008 R2
2. Windows Server 2003
3. Windows XP SP3
4. Windows 7, Windows 8
10. What statement is correct for an external virtual network?
1. The virtual machines can communicate with each other and with the host machine.
2. The virtual machines can communicate with each other only.
3. The virtual machines can communicate with each other, with the host machine, and with an external network.
4. The virtual machines cannot communicate with each other.
# Appendix A
Answers to Review Questions
## Chapter 1: Install Windows Server 2012 R2
1. B. Windows Server 2012 R2 Server Core is a more secure, slimmed-down version of Windows Server. Web versions of Windows Server 2012 R2 are not available. You would use Windows Server 2012 R2 Standard as a web server.
2. C. One of the new advantages of Windows Server 2012 R2 is that you can convert Server Core and GUI versions without the need to reinstall the operating system files completely.
3. B. Microsoft recommends that you upgrade your Windows Server 2008 or Windows Server 2008 R2 web server to Windows Server 2012 R2 Standard.
4. A. Windows Server 2012 R2 Datacenter was designed for organizations that are seeking to migrate to a highly virtualized, private cloud environment. Windows Server 2012 R2 Datacenter has full Windows Server functionality with unlimited virtual instances.
5. D. Windows Server 2012 R2 Foundation was designed for smaller companies that need a Windows Server experience for as few as 15 users. Windows Server 2012 R2 Foundation is general-purpose server with basic server functionality and no virtualization rights.
6. C. Windows Server 2012 R2 Essentials is ideal for small businesses that have as many as 25 users and 50 devices. It has a simple interface, preconfigured connectivity to cloud-based services, and no virtualization rights.
7. A, B, C and D. All four answers are advantages of using Windows Server 2012 R2 Server Core. Server Core is a smaller installation of Windows Server, and therefore all four answers apply.
8. B. Windows Server 2012 R2 Features On Demand allows an administrator not only to disable a role or feature but also to remove the role or feature's files completely from the hard disk.
9. D. New to Windows Server 2012 R2, an administrator has the ability to turn a Windows GUI installation into a Server Core installation.
10. C. Windows Server 2012 R2 has a type of domain controller called a read-only domain controller (RODC). This gives an organization the ability to install a domain controller in an area or location (onsite or offsite) where security is a concern.
## Chapter 2: Configure Network Services
1. B. Because of the `.(root)` zone, users will not be able to access the Internet. The DNS forwarding option and DNS root hints will not be configurable. If you want your users to access the Internet, you must remove the `.(root)` zone.
2. C. Active Directory Integrated zones store their records in Active Directory. Because this company has only one Active Directory forest, it's the same Active Directory that both DNS servers are using. This allows ServerA to see all of the records of ServerB and ServerB to see all the records of ServerA.
3. D. The Secure Only option is for DNS servers that have an Active Directory Integrated zone. When a computer tries to register with DNS dynamically, the DNS server checks Active Directory to verify that the computer has an Active Directory account. If the computer that is trying to register has an account, DNS adds the host record. If the computer trying to register does not have an account, the record gets tossed away, and the database is not updated.
4. A. If you need to complete a zone transfer from Microsoft DNS to a BIND (Unix) DNS server, you need to enable BIND secondaries on the Microsoft DNS server.
5. B. Conditional forwarding allows you to send a DNS query to different DNS servers based on the request. Conditional forwarding lets a DNS server on a network forward DNS queries according to the DNS domain name in the query.
6. B. On a Windows Server 2012 R2 DNS machine, debug logging is disabled by default. When it is enabled, you have the ability to log DNS server activity, including inbound and outbound queries, packet type, packet content, and transport protocols.
7. D. Active Directory Integrated zones give you many benefits over using primary and secondary zones including less network traffic, secure dynamic updates, encryption, and reliability in the event of a DNS server going down. The Secure Only option is for dynamic updates to a DNS database.
8. A. Windows Server 2012 R2 DNS supports two features called DNS Aging and DNS Scavenging. These features are used to clean up and remove stale resource records. DNS zone or DNS server aging and scavenging flags old resource records that have not been updated in a certain amount of time (determined by the scavenging interval). These stale records will be scavenged at the next cleanup interval.
9. C. The `dnscmd /zoneexport` command creates a file using the zone resource records. This file can then be given to the Compliance department as a copy.
10. D. Stub zones are useful for slow WAN connections. These zones store only three types of resource records: NS records, glue host (A) records, and SOA records. These three records are used to locate authoritative DNS servers.
## Chapter 3: Plan and Install Active Directory
1. B, C and D. The forest and function levels have to be Windows 2003 or newer to install an RODC.
2. B. A domain controller can contain Active Directory information for only one domain. If you want to use a multidomain environment, you must use multiple domain controllers configured in either a tree or a forest setting.
3. D. NTFS has file-level security, and it makes efficient usage of disk space. Since this machine is to be configured as a domain controller, the configuration requires at least one NTFS partition to store the Sysvol information.
4. A and D. To convert the system partition to NTFS, you must first use the `CONVERT` command-line utility and then reboot the server. During the next boot, the file system will be converted.
5. B and E. The use of LDAP and TCP/IP is required to support Active Directory. TCP/IP is the network protocol favored by Microsoft, which determined that all Active Directory communication would occur on TCP/IP. DNS is required because Active Directory is inherently dependent on the domain model. DHCP is used for automatic address assignment and is not required. Similarly, NetBEUI and IPX/SPX are not available network protocols in Windows Server 2012 R2.
6. A and C. The Sysvol directory must be created on an NTFS partition. If such a partition is not available, you will not be able to promote the server to a domain controller. An error in the network configuration might prevent the server from connecting to another domain controller in the environment.
7. B and C. You need to run the `Adprep` command when installing your first Windows Server 2012 R2 domain controller onto a Windows Server 2008 R2 domain. `Adprep /rodcprep` actually gets the network ready to install a read-only domain controller and not a GUI version.
8. A. You'll need to use Active Directory Federation Services (AD FS) in order to implement federated identity management. Federated identity management is a standards-based and information technology process that will enable distributed identification, authentication, and authorization across organizational and platform boundaries. The AD FS solution in Windows Server 2012 R2 helps administrators address these challenges by enabling organizations to share a user's identity information securely.
9. B. The HOSTS file is a text-file-based database of mappings between hostnames and IP addresses. It works like a file-based version of DNS. DNS resolves a hostname to an IP address.
10. A. You only need to give them rights to the `Stellacon.com` zone using the DNS snap-in. If they do not have any rights to the `Stellatest.com` zone, they will not be able to configure this zone in any way.
## Chapter 4: Configure Windows Server 2012 R2
1. C. You need to publish shares in the directory before they are available to the users of the directory. If NetBIOS is still enabled on the network, the shares will be visible to the NetBIOS tools and clients, but you do not have to enable NetBIOS on shares. Although replication must occur before the shares are available in the directory, it is unlikely that the replication will not have occurred by the next day. If this is the case, then you have other problems with the directory as well.
2. A. The Sharing tab contains a check box that you can use to list the printer in Active Directory.
3. A and C. A printer may not show up within Active Directory if the printer has not been shared or if the client does not have permission to view the printer. The printer will appear as an object in Active Directory even if it is offline or malfunctioning.
4. B. Offline files give you the opportunity to set up files and folders so that users can work on the data while outside the office.
5. A, B, C and D. Improved security, quotas, compression, and encryption are all advantages of using NTFS over FAT32. These features are not available in FAT32. The only security you have in FAT32 is shared folder permissions.
6. E. By giving Moe Modify on the NTFS security setting, you're giving him just enough to do his job. You could also give Sales or Finance the Modify permission, but then everyone in those groups would be able to delete, change, and do more than they all need to do. Also, Moe does not need Full Control to change or delete files.
7. B. Disk quotas allow you to limit the amount of space on a volume or partition. You can set an umbrella quota for all users and then implement individual users' quotas to bypass the umbrella quota.
8. C and E. The Admin group needs Full Control on the NTFS security and shared permission settings in order to do their job. To be able to give other users permissions, you must have the Full Control permission.
9. A and C. Windows Remote Management and Windows PowerShell allow an administrator to configure a Windows Server 2012 R2 machine remotely. The command prompt is used locally on a Windows Server 2012 R2 Server Core system, and there is no application called Microsoft Remote Admin (MRA).
10. D. File servers are used for storage of data, especially for users' home folders. Home folders are folder locations for your users to store data that is important and that needs to be backed up.
## Chapter 5: Administer Active Directory
1. A. A computer account and the domain authenticate each other by using a password. The password resets every 30 days. Since the machine has not connected to the domain for 16 weeks, the computer needs to be rejoined to the domain.
2. C. Checking the box Account Never Expires will prevent this user's account from expiring again.
3. D. The `dsadd` command allows you to add an object (user's account) to the Active Directory database.
4. A. Distribution groups are for emails only, and distribution groups cannot be assigned rights and permissions to objects.
5. A. Inheritance is the process by which permissions placed on parent OUs affect child OUs. In this example, the permissions change for the higher-level OU (Texas) automatically caused a change in permissions for the lower-level OU (Austin).
6. B and E. Enabling the Advanced Features item in the View menu will allow Isabel to see the `LostAndFound` and `System` folders. The `LostAndFound` folder contains information about objects that could not be replicated among domain controllers.
7. A. Through the use of filtering, you can choose which types of objects you want to see using the Active Directory Users and Computers tool. Several of the other choices may work, but they require changes to Active Directory settings or objects.
8. A. To allow the junior admin to do backups, their account needs to be part of the Backup Operators local group. To add their account to the local group, you need to use Computer Management.
9. A, B, C and D. All of the options listed are common tasks presented in the Delegation of Control Wizard.
10. D. The Delegation of Control Wizard is designed to allow administrators to set up permissions on specific Active Directory objects.
## Chapter 6: Manage GPOs
1. A and B. If you want your clients to be able to edit domain-based GPOs by using the ADMX files that are stored in the ADMX Central Store, you must be using Windows Vista, Windows 7, Windows 8, or Windows Server 2003/2008/2008 R2/2012/2012 R2.
2. D. If you assign an application to a user, the application does not get automatically installed. To have an application installed automatically, you must assign the application to the computer account. Since Finance is the only OU that should receive this application, you would link the GPO to Finance only.
3. C. The Resultant Set of Policy (RSoP) utility displays the exact settings that apply to individual users, computers, OUs, domains, and sites after inheritance and filtering have taken effect. Desktop wallpaper settings are under the User section of the GPO, so you would run the RSoP against the user account.
4. B. The Enforced option can be placed on a parent GPO, and this option ensures that all lower-level objects inherit these settings. Using this option ensures that Group Policy inheritance is not blocked at other levels.
5. A. If the data transfer rate from the domain controller providing the GPO to the computer is slower than what you have specified in the slow link detection setting, the connection is considered to be a slow connection and the application will not install properly.
6. D. To disable the application of Group Policy on a security group, you should deny the Apply Group Policy option. This is particularly useful when you don't want GPO settings to apply to a specific group, even though that group may be in an OU that includes the GPO settings.
7. A. GPOs at the OU level take precedence over GPOs at the domain level. GPOs at the domain level, in turn, take precedence over GPOs at the site level.
8. B. The Block Policy Inheritance option prevents group policies of higher-level Active Directory objects from applying to lower-level objects as long as the Enforced option is not set.
9. A, B, C and D. GPOs can be set at all of the levels listed. You cannot set GPOs on security principals such as users or groups.
10. D and E. Administrative templates are used to specify the options available for setting Group Policy. By creating new administrative templates, Ann can specify which options are available for the new applications. She can then distribute these templates to other system administrators in the environment.
## Chapter 7: Manage Security
1. B, C and E. The Account Lockout Duration setting states how long an account will be locked out if the password is entered incorrectly. Account Lockout Threshold is the number of bad password attempts, and Account Lockout Counter is the time in which the bad password attempts are made. Once the Account Lockout Counter value reaches 0, the number of bad password attempts returns to 0.
2. B. Account logon events are created for domain account activity. For example, you have a user who logs onto a server so that they can access files; the act of logging onto the server creates this audit event.
3. B, E and F. The first step is to enable auditing. With auditing enabled, Alexis can specify which actions are recorded. To give permissions to the Audit user account, she can use the Delegation of Control Wizard.
4. B, E, G and H. The Active Directory Users and Computers tool allows system administrators to change auditing options and to choose which actions are audited. At the file system level, Crystal can specify exactly which actions are recorded in the audit log. She can then use Event Viewer to view the recorded information and provide it to the appropriate managers.
5. B. Account logon events are created for domain account activity. For example, you have a user who logs on to a server so that they can access files; the act of logging on to the server creates this audit event.
## Chapter 8: Configure TCP/IP
1. D. To calculate the network mask, you need to figure out which power number (2x) is greater than or equal to the number you need. Since you are looking for 1000, 210 = 1024. You then add the power (10) to the current network mask (53 + 10 = 63).
2. A. When you look at an IPv6 address, the first sections tell you the IPv6 address space prefix. Fd00:: /8 is the unique local unicast prefix, and this allows the server to communicate with all local machines within your intranet.
3. C. The unique local address can be FC00 or FD00, and it is used like the private address space of IPv4. Unique local addresses are not expected to be routable on the global Internet, but they are used for private routing within an organization.
4. A. A Class B address with a default subnet mask of 255.255.0.0 will support up to 65,534 hosts. To increase the number of networks that this network will support, you need to subnet the network by borrowing bits from the host portion of the address. The subnet mask 255.255.252.0 uses 6 bits from the host's area, and it will support 64 subnets while leaving enough bits to support 1,022 hosts per subnet. The subnet mask 255.255.248.0 uses 5 bits from the hosts and will support 32 subnetworks while leaving enough bits to support 2,046 hosts per subnet. 255.255.252.0 is the better answer because it leaves quite a bit of room for further growth in the number of networks while still leaving room for more than 1,000 hosts per subnet, which is a fairly large number of devices on one subnet. The subnet mask 255.255.254.0 uses 7 bits from the host's area and will support more than 120 networks, but it will leave only enough bits to support 500 hosts per subnet. The subnet mask 255.255.240.0 uses 4 bits from the hosts and will support only 16 subnetworks, even though it will leave enough bits to support more than 4,000 hosts per subnet.
5. A. The network mask applied to an address determines which portion of that address reflects the number of hosts available to that network. The balance with subnetting is always between the number of hosts and individual subnetworks that can be uniquely represented within one encompassing address. The number of hosts and networks that are made available depends on the number of bits that can be used to represent them. This scenario requires more than 35 networks and fewer than 1,000 workstations on each network. If you convert the subnet masks as described in the chapter, you will see that the mask in option A allows for more than 60 networks and more than 1,000 hosts. All of the other options are deficient in either the number of networks or the number of hosts that they represent.
6. A. The subnet mask 255.255.255.192 borrows 2 bits from the hosts, which allows you to build four separate networks that you can route through the Windows server. This will allow you to have 62 hosts on each segment. A mask of 255.255.255.128 would have been even better, with two subnets of 126 hosts each, but that wasn't an option, and this solution gives you room for growth in the number of subnets. The subnet mask 255.255.255.224 borrows 3 bits from the hosts. This allows you to create 8 networks, which you don't need, and it leaves only enough bits for 30 hosts. The subnet mask 255.255.255.252 borrows 6 bits from the hosts. This allows you to create more than 60 networks, which you don't need, and it leaves only enough bits for 2 hosts. The subnet mask 255.255.255.240 borrows 4 bits from the hosts. This allows you to create 16 networks, which you don't need, and it leaves only enough bits for 14 hosts per subnet.
7. B, C and D. When you add up the locations that currently need to be given a network address, the total is 3,150, and the maximum number of hosts at any one of these locations is fewer than 1,000. The subnet masks need to support those requirements. Assuming that you choose the Class A private address space 10.0.0.0/8, the subnet masks given in options B, C, and D will provide the address space to support the outlined requirements. The subnet mask 255.255.240.0 supports more than 4,000 subnets and more than 4,000 hosts. The subnet mask 255.255.248.0 supports more than 8,000 subnets and more than 2,000 hosts. The subnet mask 255.255.252.0 supports more than 16,000 subnets and more than 1,000 hosts. Although each of these subnet masks will work, at the rate that this company is growing, 255.255.252.0 is probably the best mask to prepare for the future. It's unlikely that there will ever be more than 1,000 hosts on any given network. In fact, that number would probably cause performance problems on that subnet. Therefore, it's better to have more subnets available to deploy as the company grows. The subnet mask 255.255.224.0 supports more than 2,000 subnets—an insufficient number to cover the locations. The subnet mask 255.255.254.0 supports more than 32,000 subnets, but only 500 hosts per subnet, which are not enough hosts to cover all of the locations.
8. C. The CIDR /27 tells you that 27 1s are turned on in the subnet mask. Twenty-seven 1s equals 11111111.11111111.11111111.11100000. This would then equal 255.255.255.224.
The network address 192.168.11.192 with a subnet mask of 255.255.255.224 is perfect for Subnet A because it supports up to 30 hosts. The network address 192.168.11.128 with a subnet mask of 255.255.255.192 is perfect for Subnet B because it supports up to 62 hosts. The network address 192.168.11.0 with a subnet mask of 255.255.255.128 is perfect for Subnet C because it supports up to 126 hosts.
9. A. Microsoft's `jetpack.exe` utility allows you to compact a JET database. Microsoft JET databases are used for WINS and DHCP databases.
10. B and D. If the first word of an IPv6 address is FE80 (actually the first 10 bits of the first word yields `1111 1110 10` or FE80`:: /10`), then the address is a link-local IPv6 address. If it's in EUI-64 format, then the MAC address is also available (unless it's randomly generated). The middle FF:FE is the filler and indicator of the EUI-64 space, with the MAC address being 00:03:FF:11:02:CD. Remember also the 00 of the MAC becomes 02 in the link-local IPv6 address, flipping a bit to call it local.
## Chapter 9: Use Virtualization in Windows Server 2012
1. B and D. Hyper-V can be installed on the Standard or Datacenter Editions of Windows Server 2012 R2. Itanium, x86, and Web Editions are not supported.
2. C. The external virtual network type will allow the virtual machine to communicate with the external network as it would with the Internet, so A is wrong. The internal-only network type allows communication between the virtual machines and the host machine. Because the question says that only communication between the virtual machines should be allowed, the only valid answer is private virtual machine network. The last option, public virtual machine network, does not exist in Hyper-V.
3. A. This question focuses on the fact that you cannot change the memory if the virtual machine is running, paused, or saved. The only valid answer is to shut it down and then change the memory.
4. A. The only virtual hard disk that increases in size is the dynamically expanding disk. Thus, this is the only valid answer to this question. The fixed-size disk creates a disk of the size you specify, the differencing disk is a special disk that stores only the differences between it and a parent disk, and the physical disk uses a physical drive and makes it available to the virtual machine.
5. C. Physical hard disks cannot be configured using the Virtual Hard Disk Wizard, the Edit Virtual Hard Disk Wizard, or the New Virtual Machine Wizard. You can configure and attach a physical disk only by using the virtual machine's settings.
6. B. Hyper-V is not supported on Itanium-based systems; thus, he cannot install it.
7. A, B and C. The minimum CPU requirement for running Hyper-V is a x64-based processor (Itanium is not supported), hardware Data Execution Protection must be enabled, and hardware-assisted virtualization must be enabled. There is no minimum requirement for a dual-core processor.
8. C. This question relates to the setup command used to install the Hyper-V server role on a Windows Server 2008 Server Core machine. It's important to remember that these commands are case sensitive and that the correct command is `start /wocsetup Microsoft-Hyper-V`, which is option C. All of the other commands will fail to install Hyper-V on a Server Core machine. If you were using a Windows Server 2012 R2 machine, you would use the `DISM` command.
9. A and D. The Hyper-V Manager is available only for Windows Server 2008, Windows 7, and Windows 8. There is no version available that runs on Windows Server 2003 or on Windows XP SP3.
10. C. The virtual network type in which the machines communicate with each other and with the host machine is called _internal only_. In a private virtual network, the virtual machines can communicate only with each other, not with the network or the host machine. The external network type defines a network where the virtual machines can communicate with each other, with the host machine, and with an external network like the Internet.
# Appendix B
About the Additional Study Tools
**IN THIS APPENDIX:**
* Additional Study Tools
* System requirements
* Using the Study Tools
* Troubleshooting
## Additional Study Tools
The following sections are arranged by category and summarize the software and other goodies you'll find from the companion website. If you need help with installing the items, refer to the installation instructions in the "Using the Study Tools" section of this appendix.
* * *
The additional study tools can be found at www.sybex.com/go/mcsawin2012r2install. Here, you will get instructions on how to download the files to your hard drive.
* * *
### Sybex Test Engine
The files contain the Sybex test engine, which includes two bonus practice exams, as well as the Assessment Test and the Chapter Review Questions, which are also included in the book itself.
### Electronic Flashcards
These handy electronic flashcards are just what they sound like. One side contains a question, and the other side shows the answer.
### PDF of Glossary of Terms
We have included an electronic version of the Glossary in `.pdf` format. You can view the electronic version of the Glossary with Adobe Reader.
### Adobe Reader
We've also included a copy of Adobe Reader so you can view PDF files that accompany the book's content. For more information on Adobe Reader or to check for a newer version, visit Adobe's website at www.adobe.com/products/reader/
## System Requirements
Make sure your computer meets the minimum system requirements shown in the following list. If your computer doesn't match up to most of these requirements, you may have problems using the software and files. For the latest and greatest information, please refer to the ReadMe file located in the downloads.
* A PC running Microsoft Windows 98, Windows 2000, Windows NT4 (with SP4 or later), Windows Me, Windows XP, Windows Vista, or Windows 7
* An Internet connection
## Using the Study Tools
To install the items, follow these steps:
1. Download the `.ZIP` file to your hard drive, and unzip to an appropriate location. Instructions on where to download this file can be found here: www.sybex.com/go/mcsawin2012r2install
2. Click the `Start.EXE` file to open up the study tools file.
3. Read the license agreement, and then click the Accept button if you want to use the study tools.
The main interface appears. The interface allows you to access the content with just one or two clicks.
## Troubleshooting
Wiley has attempted to provide programs that work on most computers with the minimum system requirements. Alas, your computer may differ, and some programs may not work properly for some reason.
The two likeliest problems are that you don't have enough memory (RAM) for the programs you want to use or you have other programs running that are affecting installation or running of a program. If you get an error message such as "Not enough memory" or "Setup cannot continue," try one or more of the following suggestions and then try using the software again:
1. **Turn off any antivirus software running on your computer**. Installation programs sometimes mimic virus activity and may make your computer incorrectly believe that it's being infected by a virus.
2. **Close all running programs**. The more programs you have running, the less memory is available to other programs. Installation programs typically update files and programs; so if you keep other programs running, installation may not work properly.
3. **Have your local computer store add more RAM to your computer**. This is, admittedly, a drastic and somewhat expensive step. However, adding more memory can really help the speed of your computer and allow more programs to run at the same time.
### Customer Care
If you have trouble with the book's companion study tools, please call the Wiley Product Technical Support phone number at (800) 762-2974. 74, or email them at <http://sybex.custhelp.com/>
# Free Interactive Online Study Environment
* * *
**_Register on_** **_Sybex.com_** **_to gain access to our interactive learning environment and study tools to help you study for your MCSA Windows Server 2012 R2 Installation and Configuration certification._**
* * *
Our Superior Study Tools include:
* Assessment Test to help you focus your study to specific objectives
* Chapter Tests to reinforce what you learned
* Three Practice Exams to test your knowledge of the material
* Electronic Flashcards to reinforce your learning and give you that last-minute test prep before the exam
* Searchable Glossary gives you instant access to the key terms you'll need to know for the exam
Visit www.sybex.com/go/mcsawin2012r2, install type in your PIN and instantly gain access to our interactive learning environment.
# WILEY END USER LICENSE AGREEMENT
Go to www.wiley.com/go/eula to access Wiley's ebook EULA.
| {
"redpajama_set_name": "RedPajamaBook"
} | 2,807 |
Le terme cacocratie ou kakistocratie incarne, à l'inverse de l'aristocratie, le pouvoir des plus mauvais ou tout simplement un mauvais gouvernement. Il est souvent employé comme image plutôt que comme titre officiel, étant donné sa connotation péjorative ; son utilisation semble donc très subjective.
Il peut également signifier le pouvoir du mal.
Il provient du grec ancien kakos (), mauvais et mal (comme dans cacophonie), et kratos (), pouvoir.
Le soutien à la cacocratie peut être une forme de « politique du pire ». Porter au pouvoir les candidats les plus mauvais peut être un moyen de provoquer un contrecoup révolutionnaire qui permettra de renverser le système. Par exemple, en France, pendant la période révolutionnaire, on a soupçonné et même accusé certains muscadins, hébertistes et autres « exagérés » comme Berthold Proly d'avoir souhaité le plus mauvais gouvernement possible de façon à favoriser la restauration de la monarchie.
Stupidocratie
.
L'hypothèse de Coluche
Il est possible qu'il y ait eu des partisans de la cacocratie parmi les 16 % d'électeurs prêts à soutenir la candidature de Coluche lors de la campagne pour l'élection présidentielle française de 1981, Coluche s'étant entre autres présenté comme « candidat nul » soutenu par Hara-Kiri, journal « bête et méchant ». Mais, pour la plupart, les motivations étaient toutes autres.
Voir l'article concernant le film Coluche, l'histoire d'un mec.
Régime politique | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,264 |
\section{Introduction}\label{intro}
The weak order on a finite Coxeter group $W$ is a partial order (in fact, lattice~\cite{orderings}) structure on $W$ that encodes both the geometric structure of the reflection representation of $W$ and the combinatorial group theory of the defining presentation of~$W$.
Recent papers have elucidated the structure of lattice congruences on the weak order \cite{congruence} and applied this understanding to construct fans coarsening the normal fan of the $W$-permutohedron~\cite{con_app},
combinatorial models of cluster algebras of finite type \cite{cambrian,sort_camb,camb_fan}, polytopal realizations of generalized associahedra \cite{HL,HLT}, and sub Hopf algebras of the Malvenuto-Reutenauer Hopf algebra of permutations \cite{sash,rectangle,Meehan,con_app}.
A~thorough discussion of lattice congruences of the weak order (and more generally of certain posets of regions) is available in \cite{regions9,regions10}.
The purpose of this paper is to classify surjective lattice homomorphisms between the weak orders on two finite Coxeter groups $W$ and $W'$.
Equivalently, we classify the lattice congruences $\Theta$ on a finite Coxeter group $W$ such that the quotient lattice $W/\Theta$ is isomorphic to the weak order on a finite Coxeter group~$W'$.
From the point of view of combinatorial lattice theory, the classification results are quite surprising \textit{a priori}.
As an illustration of the almost miraculous nature of the situation, we begin this introduction with a representative example (Example~\ref{miraculous}), after giving just enough lattice-theoretic details to make the example understandable.
(More lattice-theoretic details are in Section~\ref{shard sec}.)
A \newword{homomorphism} from a lattice $L$ to a lattice $L'$ is a map $\eta:L\to L'$ such that $\eta(x\wedge y)=\eta(x)\wedge\eta(y)$ and $\eta(x\vee y)=\eta(x)\vee\eta(y)$.
A \newword{congruence} on a lattice $L$ is an equivalence relation such that
\[(x_1\equiv y_1\text{ and }x_2\equiv y_2)\text{ implies }\left[(x_1\wedge x_2)\equiv (y_1\wedge y_2)\text{ and }(x_1\vee x_2)\equiv (y_1\vee y_2)\right].\]
Given a congruence $\Theta$ on $L$, the \newword{quotient lattice} $L/\Theta$ is a lattice structure on the set of equivalence classes where the meet $C_1\wedge C_2$ of two classes is the equivalence class containing $x\wedge y$ for any $x\in C_1$ and $y\in C_2$ and the join is described similarly.
When $L$ is a finite lattice, the congruence classes of any congruence $\Theta$ on $L$ are intervals.
The quotient $L/\Theta$ is isomorphic to the subposet of $L$ induced by the set of elements $x$ such that $x$ is the bottom element of its congruence class.
We use the symbol $\lessdot$ for cover relations in $L$ and often call a pair $x\lessdot y$ an \newword{edge} (because it forms an edge in the Hasse diagram of $L$).
If $x\lessdot y$ and $x\equiv y$, then we say that the congruence \newword{contracts} the edge $x\lessdot y$.
Since congruence classes on a finite lattice are intervals, to specify a congruence it is enough to specify which edges the congruence contracts.
Edges cannot be contracted independently; rather, contracting some edge typically forces the contraction of other edges to ensure that the result is a congruence.
Forcing among edge contractions on the weak order is governed entirely\footnote{In a general lattice, forcing might be less local. (See \cite{GratzerPolygon}.)
The weak order is special because it is a \newword{polygonal lattice}.
See \cite[~Definition~9-6.1]{regions9}, \cite[~Theorem~9-6.5]{regions9}, and \cite[~Theorem~10-3.7]{regions10}.} by a local forcing rule in \newword{polygons}.
A polygon is an interval such that the underlying graph of the Hasse diagram of the interval is a cycle.
There are two \newword{top edges} in a polygon, the two that are incident to the maximum, and two \newword{bottom edges}, incident to the minimum.
The remaining edges in the interval, if there are any, are \newword{side edges}.
The forcing rule for polygons is the following: if a top (respectively bottom) edge is contracted, then the opposite bottom (respectively top) edge must also be contracted, and all side edges (if there are any) must be contracted.
One case of the rule is illustrated in Figure~\ref{poly force}, where shading indicates contracted edges.
(The other case of the rule is dual to the illustration.)
\begin{figure}
\figpage{ps: 1}\scalebox{.9}{\includegraphics{poly.ps}}\raisebox{21 pt}{\,\,\,\,$\implies$\,\,\,\,}\figpage{ps: 2}\scalebox{.9}{\includegraphics{poly.ps}}
\caption{The forcing rule for edge contractions in the weak order}
\label{poly force}
\end{figure}
\begin{example}\label{miraculous}
Consider a Coxeter group $W$ of type $B_3$.
Figure~\ref{weakB3diagram}.a is a close-up of a certain order ideal in the weak order on $W$.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 1}\scalebox{.85}{\includegraphics{weakB3diagram.ps}}&&\figpage{ps: 2}\scalebox{.85}{\includegraphics{weakB3diagram.ps}}\\
(a)&&(b)
\end{tabular}
\caption{a: The defining presentation of $W$, encoded in an order ideal in the weak order. b: Contracting two edges in the order ideal.}
\label{weakB3diagram}
\end{figure}
This ideal contains all of the information about the Coxeter diagram of $W$.
Namely, the presence of an octagon indicates an edge with label 4, the hexagon indicates an edge with label 3, and the square indicates a pair of vertices not connected by an edge.
The Coxeter diagram of a Coxeter group of type $A_3$ has the same diagram, except that the label 4 is replaced by 3.
Informally, we can turn the picture in Figure~\ref{weakB3diagram}.a into the analogous picture for $A_3$, by contracting two side edges of the octagon to form a hexagon, as indicated by shading in Figure~\ref{weakB3diagram}.b.
If we take the same two edges in the whole weak order on $W$, we can use the polygonal forcing rules to find the finest lattice congruence that contracts the two edges.
This congruence is illustrated in Figure~\ref{B3toA3}.a.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 1}\scalebox{.85}{\includegraphics{B3toA3.ps}}&&\figpage{ps: 2}\scalebox{.85}{\includegraphics{B3toA3.ps}}\\
(a)&&(b)
\end{tabular}
\caption{a: The smallest congruence on $W$ contracting the edges shaded in Figure~\ref{weakB3diagram}.b. b: The quotient modulo this congruence.}
\label{B3toA3}
\end{figure}
\textit{A priori}, we shouldn't expect this congruence to have any significance, but, surprisingly, the quotient, shown in Figure~\ref{B3toA3}.b, of the weak order modulo this congruence is isomorphic to the weak order on a Coxeter group of type $A_3$.
(Recall from above that the lattice quotient is isomorphic to the subposet consisting of elements that are at the bottom of their congruence class.)
To recap:
We start with the weak order on $B_3$, look at some polygons at the bottom of the weak order that encode the Coxeter diagram for $B_3$, and na\"{i}vely contract edges of these polygons to make one of the polygons smaller so that the polygons instead encode the Coxeter diagram for $A_3$.
Miraculously, the contracted edges generate a congruence such that the quotient is the weak order on $A_3$.
\end{example}
In general, a \newword{diagram homomorphism} starts with the Coxeter diagram of a Coxeter system $(W,S)$, deletes vertices, decreases labels on edges, and/or erases edges, and relabels the vertices to obtain the Coxeter diagram of some Coxeter system $(W',S')$.
(When no vertices are deleted, no labels are decreased, and no edges are erased, this is a \newword{diagram isomorphism} and when $(W',S')=(W,S)$ it is a \newword{diagram automorphism}.)
For brevity in what follows, we will say ``a diagram homomorphism from $(W,S)$ to $(W',S')$'' to mean ``a diagram homomorphism from the Coxeter diagram of $(W,S)$ to the Coxeter diagram of $(W',S')$.''
The first main results of the paper are the following theorem and several more detailed versions of it.
\begin{theorem}\label{main}
Given finite Coxeter systems $(W,S)$ and $(W',S')$, there exists a surjective lattice homomorphism from the weak order on $W$ to the weak order on $W'$ if and only if there exists a diagram homomorphism from $(W,S)$ to $(W',S')$
\end{theorem}
\begin{remark}\label{auto}
A restriction of Theorem~\ref{main} to \emph{isomorphisms} is well-known and extends to a characterization of meet-semilattice isomorphisms of the weak order on many infinite Coxeter groups.
See \cite[Corollary~3.2.6]{Bj-Br}.
\end{remark}
\begin{remark}\label{what's hard}
The existence of surjective homomorphisms between weak orders is not difficult to prove, \textit{a posteriori}:
We give explicit maps.
However, the other results in the classification need more machinery, specifically the machinery of shards, as explained in Section~\ref{shard sec}.
Furthermore, without the machinery of shards, we would not be able to find the explicit homomorphisms that prove existence.
\end{remark}
In order to make more detailed classification statements, we first give a factorization result for any surjective lattice homomorphism between weak orders.
Given a finite Coxeter group $W$ and a standard parabolic subgroup $W_J$, the \newword{parabolic homomorphism} $\eta_J$ is the map taking $w\in W$ to $w_J\in W_J$, where $w_J$ is the parabolic factor in the usual factorization of $w$ as an element of the parabolic subgroup times an element of the quotient.
A parabolic homomorphism corresponds to a diagram homomorphism that only deletes vertices from the diagram of~$W$.
An \newword{atom} in a finite lattice is an element that covers the minimal element $\hat0$.
We will call a homomorphism of finite lattices \newword{compressive} if it is surjective and restricts to a bijection between the sets of atoms of the two lattices.
(The term is an analogy to the physical process of compression where atoms are not created or destroyed but are brought closer together.
If $\eta:L\to L'$ is compressive, then $\eta$ moves two atoms $a_1,a_2$ of $L$ weakly closer in the sense that the interval below $\eta(a_1)\vee\eta(a_2)$ has weakly fewer elements than the interval below $a_1\vee a_2$.)
In particular, a compressive homomorphism between weak orders on Coxeter systems $(W,S)$ and $(W',S')$ is a surjective homomorphism $W\to W'$ that restricts to a bijection between $S$ and $S'$.
In Section~\ref{delete vert sec}, we prove the following theorem.
\begin{theorem}\label{para factor}
Let $\eta:W\to W'$ be a surjective lattice homomorphism and let $J=\set{s\in S:\eta(s)\neq 1'}$.
Then $\eta$ factors as $\eta|_{W_J}\circ\eta_J$.
The map $\eta|_{W_J}$ (the restriction of $\eta$ to $W_J$) is a compressive homomorphism.
\end{theorem}
Parabolic homomorphisms and their associated congruences are well understood.
(See \cite[Section~6]{congruence}.)
The task, therefore, becomes to understand compressive homomorphisms between Coxeter groups.
To study compressive homomorphisms from $(W,S)$ to $(W',S')$, we may as well take $S'=S$ and require $\eta$ to restrict to the identity on $S$.
For each $r,s\in S$, let $m(r,s)$ be the order of $rs$ in $W$, and let $m'(r,s)$ be the order of $rs$ in $W'$.
Elementary considerations show that if $\eta:W\to W'$ is compressive, then $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
(See Proposition~\ref{diagram facts}.)
Thus a compressive homomorphism corresponds to a diagram homomorphism that only erases edges from and/or reduces edge labels on the diagram of $W$.
More surprising, this property is sufficient to guarantee the existence of a compressive homomorphism.
The following theorem shows that Example~\ref{miraculous} is typical, rather than unusual.
Together with Theorem~\ref{para factor}, it implies Theorem~\ref{main} and adds additional detail.
\begin{theorem}\label{existence}
Suppose $(W,S)$ and $(W',S)$ are finite Coxeter systems.
Then there exists a compressive homomorphism from $W$ to $W'$, fixing $S$, if and only if $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
If so, then the homomorphism can be chosen so that the associated congruence on $W$ is homogeneous of degree~$2$.
\end{theorem}
We will review the definition of homogeneous congruences in Section~\ref{shard sec}.
Informally, a homogeneous congruence of degree~$2$ is a congruence that is determined by contracting edges located in the order ideal of the weak order that describes the diagram of $W$, as in Figure~\ref{weakB3diagram}.
The situation is perhaps best appreciated by analogy:
Showing that $W'$ is isomorphic to the quotient of $W$ modulo a homogeneous congruence of degree~$2$ is analogous to finding that a graded ring $R$ is isomorphic to another graded ring $R'$ modulo an ideal generated by homogeneous elements of degree~$2$.
It should be noted, however, that lattice congruences are in general more complicated than ring congruences because the classes of a lattice congruence are not in general defined by an ideal.
See \cite[Sections~II.3--4]{Birkhoff}.
Given $(W,S)$ and $(W',S)$ with $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$, there may be several homomorphisms from $W$ to $W'$ whose associated congruence is homogeneous of degree $2$.
There may also be several homomorphisms whose congruence is not homogeneous.
(In these non-homogeneous cases, the degree of the congruence is always $3$.)
These several possibilities are well-characterized, as we now explain.
Elementary considerations show that the restriction of a compressive homomorphism to any standard parabolic subgroup is still compressive.
(See Proposition~\ref{diagram facts}.)
It turns out that compressive homomorphisms of Coxeter groups are determined by their restrictions to rank-two standard parabolic subgroups.
\begin{theorem}\label{diagram uniqueness}
Let $(W,S)$ and $(W',S)$ be finite Coxeter systems with $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
For each $\set{r,s}\subseteq S$, fix a surjective homomorphism $\eta_\set{r,s}$ from $W_{\set{r,s}}$ to $W'_{\set{r,s}}$ with $\eta_\set{r,s}(r)=r$ and $\eta_\set{r,s}(s)=s$.
Then
there is at most one homomorphism $\eta:W\to W'$ such that the restriction of $\eta$ to $W_{\set{r,s}}$ equals $\eta_\set{r,s}$ for each pair $r,s\in S$.
\end{theorem}
As will be apparent in Section~\ref{dihedral sec}, for each pair $\set{r,s}\subseteq S$ with $r\neq s$, there are exactly $\binom{a}{b}^2$ choices of $\eta_\set{r,s}$, where $a=m(r,s)-2$ and $b=m(r,s)-m'(r,s)$.
In Example~\ref{miraculous}, there are four ways to choose all of the maps $\eta_\set{r,s}$:
For both pairs $r,s$ with $m(r,s)\le 3$, we must choose the identity map.
For the pair $r,s$ with $m(r,s)=4$ and $m'(r,s)=3$, there are four choices, corresponding to the four ways to contract one ``left'' side edge and one ``right'' side edge in the octagonal interval of Figure~\ref{weakB3diagram}.a.
Theorem~\ref{diagram uniqueness} says, in particular, that in the example there are at most four homomorphisms that fix $S$ pointwise.
Combining Theorem~\ref{diagram uniqueness} with Theorem~\ref{para factor} leads immediately to the following more general statement.
\begin{cor}\label{surjective uniqueness}
Let $W$ and $W'$ be finite Coxeter groups.
A surjective homomorphism from the weak order on $W$ to the weak order on $W'$ is determined by its restrictions to rank-two standard parabolic subgroups.
\end{cor}
The statement of Theorem~\ref{diagram uniqueness} on the uniqueness of compressive homomorphisms, given their restrictions to rank-two standard parabolic subgroups, is remarkably close to being an existence and uniqueness theorem, in the sense that the phrase ``at most one'' can almost be replaced with ``exactly one.''
The only exceptions arise when $W$ has a standard parabolic subgroup of type $H_3$ such that the corresponding standard parabolic subgroup of $W'$ is of type $B_3$.
In particular, adding the hypothesis that $W$ and $W'$ are crystallographic turns Theorem~\ref{diagram uniqueness} into an existence and uniqueness theorem (stated as Theorem~\ref{existence uniqueness crys}).
Less generally, when $W$ and $W'$ are simply laced meaning that all edges in their diagrams are unlabeled), the existence and uniqueness theorem holds, and in fact this simply laced version of the theorem (Corollary~\ref {existence uniqueness simply}) has a uniform proof, given in Sections~\ref{erase edge sec}--\ref{shard sec}.
The remainder of the classification is proved, type-by-type in the classification of finite Coxeter groups, in Sections~\ref{dihedral sec}, \ref{Bn Sn+1 sec}, and \ref{exceptional sec}.
\begin{remark}\label{type-by-type}
It is disappointing that some of these proofs are not uniform.
However, as described above, the classification of surjective homomorphisms between weak orders on finite Coxeter groups is itself not uniform.
While nice things happen quite generally, the exceptions in some types suggest that uniform arguments probably don't exist outside of the simply-laced case (Corollary~\ref {existence uniqueness simply}).
In particular, although Theorem~\ref{existence uniqueness crys} is a uniform statement about the crystallographic case, there is no indication that the combinatorial lattice theory of the weak order detects the crystallographic case, so a uniform proof would be surprising indeed.
\end{remark}
In Section~\ref{camb sec}, we use the classification of surjective lattice homomorphisms between weak orders to classify surjective lattice homomorphisms between Cambrian lattices.
Cambrian lattices are quotients of the weak order modulo certain congruences called Cambrian congruences.
A Cambrian lattice can also be realized as a sublattice of the weak order consisting of sortable elements \cite{sortable,sort_camb,camb_fan}.
The significance of the Cambrian lattices begins with a collection of results, conjectured in~\cite{cambrian} and proved in~\cite{HLT,sortable,sort_camb,camb_fan}, which say that the Cambrian lattices and the related Cambrian fans encode the combinatorics and geometry of generalized associahedra of~\cite{ga}, which in turn provide a combinatorial model \cite{ga,ca2,camb_fan,framework} for cluster algebras of finite type.
The classification of surjective lattice homomorphisms between Cambrian lattices, given in Theorems~\ref{camb para factor}, \ref{camb exist unique}, and~\ref{camb diagram}, parallels the classification of surjective lattice homomorphisms between weak orders.
The main difference is that the Cambrian lattice results have uniform statements in terms of \newword{oriented diagram homomorphisms}.
(However, our proofs rely on the non-uniform proofs given earlier for the weak order.)
An example of a compressive homomorphism between Cambrian lattices appears as Example~\ref{camb hom ex}, which continues Example~\ref{miraculous}.
Interesting geometric consequences are obtained by combining the results of this paper with \cite[Theorem~1.1]{con_app}.
The latter theorem states that every lattice congruence $\Theta$ on the weak order on $W$ defines a polyhedral fan $\mathcal{F}_\Theta$ that coarsens the fan $\mathcal{F}(W)$ defined by the reflecting hyperplanes of $W$.
The theorem also describes the interaction between the combinatorics/geometry of the fan $\mathcal{F}_\Theta$ and the combinatorics of the quotient lattice.
(In type A, the fan $\mathcal{F}_\Theta$ is known to be polytopal~\cite{PS} for any $\Theta$, but no general polytopality result is known in other types.)
The fact that a surjective lattice homomorphism $\eta:W\to W'$ exists whenever $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$ leads to explicit constructions of a fan $\mathcal{F}_\Theta$ coarsening $\mathcal{F}(W)$ such that $\mathcal{F}_\Theta$ is combinatorially isomorphic to the fan $\mathcal{F}(W')$ defined by the reflecting hyperplanes of $W'$.
An example of this geometric point of view (corresponding to Example~\ref{miraculous}) appears as Example~\ref{B3 to A3 shard}.
Working along the same lines for surjective congruences between Cambrian lattices, we obtain refinement relationships between Cambrian fans (fans associated to Cambrian congruences).
We conclude the introduction by describing these refinement relationships in terms of dominance relationships between Cartan matrices.
A Cartan matrix $A=[a_{ij}]$ \newword{dominates} a Cartan matrix $\mathcal{A}'=[a'_{ij}]$ if ${|a_{ij}|\ge |a'_{ij}|}$ for all $i$ and $j$.
The dominance relation on Cartan matrices implies that $m(r,s)\ge m'(r,s)$ for all $r,s\in S$ in the corresponding Weyl groups.
In the following proposition, $\Phi(A)$ is the full root system for $A$, including any imaginary roots.
In this paper, we only use the proposition in finite type, where there are no imaginary roots.
The proposition follows from known facts about Kac-Moody Lie algebras (see Section~\ref{crys case}), and has also been pointed out as \cite[Lemma~3.5]{Marquis}.
\begin{prop}\label{dom subroot}
Suppose $A$ and $A'$ are symmetrizable Cartan matrices such that $A$ dominates~$A'$.
If $\Phi(A)$ and $\Phi(A')$ are both defined with respect to the same simple roots $\alpha_i$, then $\Phi(A)\supseteq\Phi(A')$ and $\Phi_+(A)\supseteq\Phi_+(A')$.
\end{prop}
Proposition~\ref{dom subroot} may appear to be obviously false to someone who is familiar with root systems.
To clarify, we emphasize that defining both $\Phi(A)$ and $\Phi(A')$ with respect to the same simple roots means identifying the root space of $\Phi(A)$ with the root space of $\Phi(A')$ \emph{by identifying the bases $\set{\alpha_i}$}.
Thus we may restate the proposition as follows: The set of simple root coordinate vectors of roots in $\Phi(A')$ is a subset of the set of simple root coordinate vectors of roots in $\Phi(A)$.
The refinement result on Cambrian lattices is best expressed in terms of co-roots, so we rephrase Proposition~\ref{dom subroot} as Proposition~\ref{dom subcoroot}, which asserts a containment relation among dual root systems $\Phi\spcheck(A)$ and $\Phi\spcheck(A')$ when we identify the simple co-roots instead of the simple roots.
The following result is proved by constructing (in Theorem~\ref{weak hom subroot}) the appropriate homomorphism from $W$ to $W'$ and using it to construct a homomorphism of Cambrian lattices.
\begin{theorem}\label{camb fan coarsen}
Suppose $A$ and $A'$ are Cartan matrices such that $A$ dominates $A'$ and suppose $W$ and $W'$ are the associated groups, both generated by the same set $S$.
Suppose $c$ and $c'$ are Coxeter elements of $W$ and $W'$ respectively that can be written as a product of the elements of $S$ in the same order.
Choose a root system $\Phi(A)$ and a root system $\Phi(A')$ so that the simple \emph{co}-roots are the same for the two root systems.
Construct the Cambrian fan for $(A,c)$ by coarsening the fan determined by the Coxeter arrangement for $\Phi(A)$ and construct the Cambrian fan for $(A',c')$ by coarsening the fan determined by the Coxeter arrangement for $\Phi(A')$.
Then the Cambrian fan for $(A,c)$ refines the Cambrian fan for $(A',c')$.
Whereas the codimension-$1$ faces of the Cambrian fan for $(A,c)$ are orthogonal to co-roots (i.e.\ elements of $\Phi\spcheck(A)$), the Cambrian fan for $(A',c')$ is obtained by removing all codimension-$1$ faces orthogonal to elements of $\Phi\spcheck(A)\setminus\Phi\spcheck(A')$.
\end{theorem}
As mentioned above and as explained in \cite[Section~5]{framework}, Cambrian fans provide a combinatorial model for cluster algebras of finite type.
The cluster-algebraic consequences of Theorem~\ref{camb fan coarsen} are considered in \cite{dominance}.
Indeed, inspired by Theorem~\ref{camb fan coarsen}, the paper \cite{dominance} studies much more general cluster-algebraic phenomena related to dominance relations among matrices.
\begin{remark}\label{simion rem}
To the author's knowledge, the first appearance in the literature of a nontrivial surjective lattice homomorphism between finite Coxeter groups is a map found in Rodica Simion's paper \cite{Simion}.
(See Section~\ref{simion sec}.)
Simion's motivations were not lattice-theoretic, so she did not show that the map is a surjective lattice homomorphism.
However, she did prove several results that hint at lattice theory, including the fact that fibers of the map are intervals and that the \emph{order-theoretic} quotient of $B_n$ modulo the fibers of the map is isomorphic to $S_{n+1}$.
It was Simion's map that first alerted the author to the fact that interesting homomorphisms exist.
\end{remark}
\section{Deleting vertices}\label{delete vert sec}
In this section, we develop the most basic theory of surjective lattice homomorphisms between weak orders, leading to the proof of Theorem~\ref{para factor}, which factors a surjective homomorphism into a parabolic homomorphism and a compressive homomorphism.
We assume the standard background about Coxeter groups and the weak order, which is found, for example, in~\cite{Bj-Br}.
(For an exposition tailored to the point of view of this paper, see~\cite{regions10}.)
As we go, we introduce background on the combinatorics of homomorphisms and congruences of finite lattices.
Proofs of assertions not proved here are found in \cite[Section~9-5]{regions9}.
Let $(W,S)$ be a Coxeter system with identity element $1$.
The usual length function on $W$ is written $\ell$.
The pairwise orders of elements $r,s\in S$ are written $m(r,s)$.
The symbol $W$ will denote not only the group $W$ but also a partial order, the (right) weak order on the Coxeter group $W$.
This is the partial order on $W$ whose cover relations are of the form $w\lessdot ws$ for all $w\in W$ and $s\in S$ with $\ell(w)<\ell(ws)$.
The set $T$ of reflections of $W$ is $\set{wsw^{-1}:w\in W,s\in S}$.
The inversion set of and element $w\in W$ is $\operatorname{inv}(w)=\set{t\in T:\ell(tw)<\ell(w)}$.
An element is uniquely determined by its inversion set.
The weak order on $W$ corresponds to containment order on inversion sets.
The minimal element of $W$ is $1$ and the maximal element is $w_0$.
We have $w_0=\Join S$.
Given $J\subseteq S$, the standard parabolic subgroup generated by $J$ is written $W_J$.
This is, in particular, a lower interval in $W$.
The maximal element of $W_J$ is $w_0(J)$, which equals $\Join J$.
We need a second Coxeter system $(W',S')$, and we use the same notation for $W'$ as for $W$, with primes added to distinguish the groups.
As a first step, we prove the following basic facts:
\begin{prop}\label{basic facts}
Let $\eta:W\to W'$ be a surjective lattice homomorphism.
Then
\begin{enumerate}
\item $\eta(1)=1'$ and $\eta(w_0)=w'_0$.
\item $S'\subseteq\eta(S)\subseteq (S'\cup\set{1'})$.
\item If $r$ and $s$ are distinct elements of $S$ with $\eta(r)=\eta(s)$, then $\eta(r)=\eta(s)=1'$.
\item If $J\subseteq S$, then $\eta$ restricts to a surjective homomorphism $W_J\to W'_{\eta(J)\setminus\set{1'}}$.
\item $m'(\eta(r),\eta(s))\le m(r,s)$ for each pair $r,s\in S$ with $\eta(r)\neq1'$ and $\eta(s)\neq1'$.
\end{enumerate}
\end{prop}
\begin{proof}
A surjective homomorphism of finite lattices takes the minimal element to the minimal element and the maximal element to the maximal element, so (1) holds.
Suppose $s\in S$ has $\eta(s)\not\in S'\cup\set{1'}$.
Then there exists $s'\in S'$ such that $\eta(s)>s'$.
Since $\eta$ is surjective, there exists $w\in W$ such that $\eta(w)=s'$.
But $\eta$ is order-preserving and $s\le (s\vee w)$, so $\eta(s)\le\eta(s\vee w)=\eta(s)\vee s'=s'$, and this contradiction shows that $\eta(S)\subseteq S'\cup\set{1'}$.
We have $\Join\eta(S)=\eta(w_0)=w'_0$.
But $\Join J'<w'_0$ for any proper subset $J'$ of $S'$, so $S'\subseteq\eta(S)$, and we have proved (2).
To prove (3), let $r$ and $s$ be distinct elements of $S$ with $\eta(r)=\eta(s)$.
Then $1'=\eta(1)=\eta(r\wedge s)=\eta(r)\wedge\eta(s)=\eta(r)$.
Applying $\eta$ to $w_0(J)$ yields $\eta(\Join J)$, which equals $\Join_{s\in J}\eta(s)=w'_0(\eta(J)\setminus\set{1'})$.
Since $W_J$ is the interval $[1,w_0(J)]$ and $\eta$ is order-preserving, $\eta(W_J)$ is contained in $[1,w'_0(\eta(J)\setminus\set{1'})]=W'_{\eta(J)\setminus\set{1'}}$.
If $w'\in W'_{\eta(J)\setminus\set{1'}}$, then since $\eta$ is surjective, there exists $w\in W$ such that $\eta(w)=w'$.
Then $w_0(J)\wedge w$ is in $W_J$, and $\eta(w_0(J)\wedge w)=w'_0(\eta(J)\setminus\set{1'})\wedge w'=w'$.
We have proved (4).
If $\eta(r)\neq1'$ and $\eta(s)\neq1'$, then (3) says that $\eta(r)\neq\eta(s)$ and (4) says that $\eta$ restricts to a surjective homomorphism from the rank-two standard parabolic subgroup $W_{\set{r,s}}$ to the rank-two standard parabolic subgroup $W'_{\set{\eta(r),\eta(s)}}$.
Thus $|W_{\set{r,s}}|\ge|W'_{\set{\eta(r),\eta(s)}}|$.
This is equivalent to (5).
\end{proof}
Given $J\subseteq S$, for any $w\in W$, there is a unique factorization $w=w_J\,\cdot \!\phantom{.}^J\! w$ that maximizes
$\ell(w_J)$ subject to the constraints $\ell(w_J)+\ell(\!\!\phantom{.}^J\! w)=\ell(w)$ and $w_J\in W_J$.
The element $w_J$ is also the unique element of $W$ (and the unique element of $W_J$) whose inversion set is $\operatorname{inv}(w)\cap W_J$.
Let $\eta_J:W\to W_J$ be the map sending $w$ to $w_J$.
We call $\eta_J$ a \newword{parabolic homomorphism}.
We now illustrate parabolic homomorphisms in terms of the usual combinatorial representations for types $A_n$ and $B_n$ and in terms of the usual geometric representation for type $H_3$.
\begin{example}\label{An para}
We realize a Coxeter group of type $A_n$ in the usual way as the symmetric group $S_{n+1}$ of permutations of $\set{1,\ldots,n+1}$, with simple generators $S=\set{s_i:i=1,\ldots n}$, where each $s_i$ is the adjacent transposition $(i\,\,\,\,i\!+\!1)$.
We write permutations $\pi$ in one-line notation $\pi=\pi_1\pi_2\cdots\pi_{n+1}$ with each $\pi_i$ standing for $\pi(i)$.
Choose some $k\in\set{1,\ldots,n}$ and let $J=\set{s_1,\ldots,s_{k-1}}\cup\set{s_{k+1},\ldots,s_n}$.
The map $\eta_J$ corresponds to deleting the vertex $s_k$ from the Coxeter diagram for $A_n$, thus splitting it into components, one of type $A_{k-1}$ and one of type $A_{n-k}$.
The map $\eta_J$ takes $\pi$ to $(\sigma,\tau)\in S_k\times S_{n+1-k}$, where $\sigma$ is the permutation of $\set{1,2,\ldots,k}$ given by deleting from the sequence $\pi_1\pi_2\cdots\pi_{n+1}$ all values greater than $k$ and $\tau$ is the permutation of $\set{1,2,\ldots,n+1-k}$ given by deleting from $\pi_1\pi_2\cdots\pi_{n+1}$ all values less than $k+1$ and subtracting $k$ from each value.
For example, if $n=7$ and $k=3$, then $\eta_J(58371426)=(312,25413)$.
The map $\eta_J$ is similarly described for more general~$J$.
\end{example}
\begin{example}\label{Bn para}
As usual, we realize a Coxeter group of type $B_n$ as the group of \newword{signed permutations}.
These are permutations $\pi$ of $\set{\pm1,\pm2,\ldots,\pm n}$ with $\pi(-i)=-\pi(i)$ for all $i$.
The simple generators are the permutations $s_0=(1\,\,\,-\!1)$ and $s_i=(-i\!-\!1\,\,\,\,-i)(i\,\,\,\,i\!+\!1)$ for $i=1,\ldots,n-1$.
A signed permutation $\pi$ is determined by its one-line notation $\pi=\pi_1\pi_2\cdots\pi_n$, where each $\pi_i$ again stands for $\pi(i)$.
For $J=\set{s_0,\ldots,s_{k-1}}\cup\set{s_{k+1},\ldots,s_{n-1}}$, the map $\eta_J$ corresponds to deleting the vertex $s_k$, splitting the diagram of $B_n$ into components, of types $B_k$ and $A_{n-k-1}$.
The map $\eta_J$ takes $\pi$ to $(\sigma,\tau)$, where $\sigma$ is the signed permutation whose one-line notation is the restriction of the sequence $\pi_1\pi_2\cdots\pi_n$ to values with absolute value less than $k+1$ and $\tau$ is the permutation given by restricting the sequence $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\pi_1\cdots\pi_{n-1}\pi_n$ to positive values greater than $k$, and then subtracting $k$ from each value.
For example, if $n=8$, $k=4$, and $\pi=(-4)(-2)71(-8)(-6)5(-3)$, then $\eta_J(\pi)=((-4)(-2)1(-3),2431)$.
\end{example}
\begin{example}\label{H3 para}
For $W$ of type $H_3$, we give a geometric, rather than combinatorial, description of parabolic homomorphisms.
Figure~\ref{H3 para fig}.a shows the reflecting planes of a reflection representation of $W$.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 1}\includegraphics{h3.ps}&&\figpage{ps: 2}\includegraphics{h3.ps}\\
(a)&&(b)\\[8pt]
\figpage{ps: 3}\includegraphics{h3.ps}&&\figpage{ps: 4}\includegraphics{h3.ps}\\
(c)&&(d)
\end{tabular}
\caption{
a: Reflecting planes for $W$ of type $H_3$.
b: Reflecting planes for $W_{\set{s,t}}$.
c: Reflecting planes for $W_{\set{r,t}}$.
d: Reflecting planes for $W_{\set{r,s}}$.
}
\label{H3 para fig}
\end{figure}
Each plane is represented by its intersection with a unit sphere about the origin.
The sphere is considered to be opaque, so that we only see the side of the sphere that is closest to us.
The spherical triangles traced out on the sphere (including those on the back of the sphere that we can't see) are in bijection with the elements of $W$.
Specifically, the triangle corresponding to $1$ is marked, and each $w\in W$ corresponds to the image of the triangle marked $1$ under the action of $w$.
Taking $S=\set{r,s,t}$ with $m(r,s)=5$, $m(s,t)=3$ and $m(r,t)=2$, the reflecting planes of the reflections $S$ are the three planes that bound the triangle marked $1$.
The plane corresponding to $s$ is nearly horizontal in the picture and the plane for $r$ intersects the plane for $s$ at the left of the triangle marked $1$.
The parabolic congruence that deletes the vertex $r$ can be seen geometrically in Figure~\ref{H3 para fig}.b, which shows the reflecting planes for the standard parabolic subgroup $W_{\set{s,t}}$.
The sectors cut out by these planes correspond to the elements of $W_{\set{s,t}}$, as shown in the picture.
The parabolic congruence maps an element $w\in W$, corresponding to a triangle $\mathcal{T}$, to the element of $W_{\set{s,t}}$ labeling the sector containing $\mathcal{T}$.
Similar pictures, Figures~\ref{H3 para fig}.c--d, describe the parabolic congruences deleting the vertices $s$ and $t$ respectively.
(Some labels are left out of the representation of $W_{\set{r,s}}$ in Figure~\ref{H3 para fig}.d.)
\end{example}
The following theorem is a concatenation of \cite[Proposition~6.3]{congruence} and \cite[Corollary~6.10]{congruence}.
The fact that $\eta_J$ is a lattice homomorphism was also established in~\cite{Jed}.
\begin{theorem}\label{para cong}
If $J\subseteq S$, then $\eta_J$ is a surjective homomorphism.
Its fibers constitute the finest lattice congruence on $W$ with $1\equiv s$ for all $s\in S\setminus J$.
\end{theorem}
Proposition~\ref{basic facts} and Theorem~\ref{para cong} lead to the proof of Theorem~\ref{para factor}.
To give the proof, we need the following basic observation about a congruence $\Theta$ on a finite lattice $L$:
Congruence classes are intervals, and the quotient $L/\Theta$ is isomorphic to the subposet of $L$ induced by the elements of $L$ that are the bottom elements of congruence classes.
Let $\Theta_J$ be the congruence whose classes are the fibers of $\eta_J$.
An element $w\in W$ is at the bottom of its $\Theta_J$-class if and only if $w\in W_J$.
Thus $W/\Theta_J$ is isomorphic to $W_J$.
\begin{proof}[Proof of Theorem~\ref{para factor}]
If $\Theta$ is the lattice congruence on $W$ whose congruence classes are the fibers of $\eta$, then Proposition~\ref{basic facts}(1) says that $1\equiv s$ for all $s\in S\setminus J$.
Theorem~\ref{para cong} says that the congruence $\Theta_J$, determined by the fibers of the homomorphism $\eta_J$, is a refinement of the congruence $\Theta$.
Thus $\eta$ factors as $\eta=\eta'\circ\nu$, where $\nu:W\to W/\Theta_J$ is the natural map.
The map $\eta'$ maps a $\Theta_J$-class to $\eta(w)$ where $w$ is any element of the $\Theta_J$-class.
However, each $\Theta_J$-class contains a unique element of $W_J$, so we can replace $\nu$ with the map $\eta_J$ and replace $\eta'$ with the restriction of $\eta$ to $W_J$.
By Proposition~\ref{basic facts}(2--3), $\eta|_{W_J}$ restricts to a bijection from $J$ to~$S'$.
\end{proof}
Theorem~\ref{para factor} reduces the problem of classifying surjective homomorphisms $\eta$ between weak orders to the special case of classifying compressive homomorphisms between weak orders.
As in the introduction, we may as well restrict to the case where $S=S'$ and $\eta$ restricts to the identity on $S$.
For convenience, we rewrite some of the assertions of Proposition~\ref{basic facts} in the case where $\eta$ is compressive:
\begin{prop}\label{diagram facts}
Let $(W,S)$ and $(W',S)$ be finite Coxeter systems.
If $\eta:W\to W'$ is a compressive homomorphism fixing $S$ pointwise, then
\begin{enumerate}
\item If $J\subseteq S$, then $\eta$ restricts to a surjective homomorphism $W_J\to W'_J$.
\item $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
\end{enumerate}
\end{prop}
Theorem~\ref{para factor} shows that surjective homomorphisms correspond to deleting vertices of the diagram and then applying a compressive homomorphism, and the second assertion of Proposition~\ref{diagram facts} is an additional step towards Theorem~\ref{main}:
It shows that the compressive homomorphism decreases edge labels and/or erases edges.
The remainder of the paper is devoted to classifying compressive homomorphisms between finite Coxeter groups.
\section{Erasing edges}\label{erase edge sec}
In this section, we begin the classification of compressive homomorphisms by considering the simplest case, the case of compressive homomorphisms that erase edges but otherwise do not decrease edge labels.
That is, we consider the case where, for each $r,s\in S$, either $m'(r,s)=m(r,s)$ or $m'(r,s)=2$.
Recall that the diagram of a finite Coxeter group is a forest (a graph without cycles), so removing any edge breaks a connected component of the diagram into two pieces.
Given a set $E$ of edges of the diagram for $W$, write $S$ as a disjoint union of sets $J_1,J_2,\ldots,J_k$ such that each set $J_i$ is the vertex set of a connected component of the graph obtained by deleting the edges $E$ from the diagram.
Define $\eta_E$ to be the map from $W$ to $W_{J_1}\times W_{J_2}\times\cdots\times W_{J_k}$ that sends $w\in W$ to $(w_{J_1},w_{J_2},\ldots,w_{J_k})$.
We call $\eta_E$ an \newword{edge-erasing homomorphism}.
Beginning in this section and finishing in Section~\ref{shard sec}, we prove the following theorem.
\begin{theorem}\label{edge factor}
Let $\eta:W\to W'$ be a compressive homomorphism fixing $S$ pointwise.
Let $E$ be any set of edges in the diagram of $W$ such that each edge $r$---$s$ in $E$ has $m'(r,s)=2$.
Let $J_1,J_2,\ldots,J_k$ be the vertex sets of the connected components of the graph obtained by deleting the edges $E$ from the diagram for $W$.
In particular, $W'\cong W'_{J_1}\times W'_{J_2}\times\cdots\times W'_{J_k}$.
Then $\eta$ factors as $\eta'\circ\eta_E$, where ${\eta':W_{J_1}\times W_{J_2}\times\cdots\times W_{J_k}}\to W'$ is the compressive homomorphism with $\eta'(w_1,\ldots, w_k)=(\eta(w_1),\ldots,\eta(w_k))$.
\end{theorem}
The proof of Theorem~\ref{edge factor} is similar to the proof of Theorem~\ref{para factor}.
We characterize the congruence associated to $\eta_E$ as the finest congruence containing certain equivalences and conclude that any homomorphism that erases the edges $E$ factors through~$\eta_E$.
Let $r$ and $s$ be distinct elements of $S$ and let $m=m(r,s)$.
Suppose $r$ and $s$ form an edge in $E$, or in other words suppose $m\ge 3$.
Then the standard parabolic subgroup $W_{\set{r,s}}$ is the lower interval $[1,w_0(\set{r,s})]$, consisting of two chains: $1\lessdot r\lessdot rs\lessdot rsr\lessdot\cdots\lessdot w_0(\set{r,s})$ and $1\lessdot s\lessdot sr\lessdot srs\lessdot\cdots\lessdot w_0(\set{r,s})$.
We define $\operatorname{alt}_k(r,s)$ to be the word with $k$ letters, starting with $r$ and then alternating $s$, $r$, $s$, etc.
Thus the two elements covered by $w_0(\set{r,s})$ are $\operatorname{alt}_{m-1}(r,s)$ and $\operatorname{alt}_{m-1}(s,r)$.
The key to the proof of Theorem~\ref{edge factor} is the following theorem.
\begin{theorem}\label{edge cong}
If $E$ is a set of edges of the diagram of $W$, then $\eta_E$ is a compressive homomorphism.
Its fibers constitute the finest congruence with $r\equiv\operatorname{alt}_{m(r,s)-1}(r,s)$ and $s\equiv\operatorname{alt}_{m(r,s)-1}(s,r)$ for all edges $r$---$s$ in $E$.
\end{theorem}
Each map $\eta_{J_i}$ is a lattice homomorphism by Theorem~\ref{para cong}, and we easily conclude that $\eta_E$ is a homomorphism as well.
To see that $\eta_E$ is surjective, consider $(w_1,\ldots,w_k)\in W_{J_1}\times W_{J_2}\times\cdots\times W_{J_k}$.
Then each $w_i$ is also an element of $W$.
Furthermore, $\eta_{J_i}(w_j)=1$ if $j\neq i$.
Thus the fact that $\eta_E$ is a lattice homomorphism implies that $\eta_E(\Join_{i=1}^kw_i)=(w_1,\ldots,w_k)$.
We have established the first assertion of Theorem~\ref{edge cong}.
The second assertion requires more background on lattice congruences of the weak order.
This background and the proof of the second assertion is given in Section~\ref{shard sec}.
For now, we show how Theorem~\ref{edge cong} is used to prove Theorem~\ref{edge factor}.
\begin{proof}[Proof of Theorem~\ref{edge factor}, given Theorem~\ref{edge cong}]
Let $r$---$s$ be an edge in $E$.
In the Coxeter group $W'$, $r\vee s=rs$.
By Proposition~\ref{diagram facts}, the restriction of $\eta$ to the interval $[1,w_0(\set{r,s})]$ in $W$ is a surjective lattice homomorphism to the interval $[1',rs]$ in~$W'$.
By hypothesis, $\eta$ fixes $r$ and $s$.
Since $\eta$ is order-preserving, $\eta(\operatorname{alt}_{m(r,s)-1}(r,s))$ is either $r$ or $rs$.
But if $\eta(\operatorname{alt}_{m(r,s)-1}(r))=rs$, then $\eta(s\wedge\operatorname{alt}_{m(r,s)-1}(r))=rs\wedge s=s$.
But $s\wedge\operatorname{alt}_{m(r,s)-1}(r)=1$, and $\eta(1)=1'$, so we conclude that $\eta(\operatorname{alt}_{m(r,s)-1}(r))=r$.
Similarly, $\eta(\operatorname{alt}_{m(r,s)-1}(s))=s$.
Thus if $\Theta$ is the lattice congruence on $W$ whose congruence classes are the fibers of $\eta$, then $r\equiv\operatorname{alt}_{m(r,s)-1}(r,s)$ and $s\equiv\operatorname{alt}_{m(r,s)-1}(s,r)$ modulo $\Theta$.
Let $\Theta_E$ be the lattice congruence whose classes are the fibers of $\eta_E$.
Theorem~\ref{edge cong} says that the congruence $\Theta_E$ is a refinement of the congruence $\Theta$.
Thus $\eta$ factors through the natural map $\nu:W\to W/\Theta_E$.
Equivalently, we can factor $\eta$ as $\eta'\circ\eta_E$, where $\eta'$ maps $(w_1,\ldots,w_k)\in W_{J_1}\times\cdots\times W_{J_k}$ to $\eta(w)$, where $w$ is any element in the $\eta$-fiber of $(w_1,\ldots,w_k)$.
Specifically, we can take $\eta'(w_1,\ldots,w_k)=\eta(\Join_{i=1}^kw_i)$.
Since $\eta$ is a homomorphism, the latter is $\Join_{i=1}^k\eta(w_i)$, which equals $(\eta(w_1),\ldots,\eta(w_k))$ because $W'\cong W'_{J_1}\times W'_{J_2}\times\cdots\times W'_{J_k}$.
It now follows from Proposition~\ref{diagram facts} that $\eta'$ is a surjective homomorphism.
\end{proof}
Theorem~\ref{edge factor} has the following immediate corollary.
\begin{cor}\label{existence uniqueness simply}
Let $(W,S)$ and $(W',S)$ be finite, simply laced finite Coxeter systems such that the diagram of $W'$ is obtained from the diagram of $W$ by erasing a set $E$ of edges.
Then $\eta_E$ is the unique compressive homomorphism from $W$ to $W'$ fixing $S$ pointwise.
\end{cor}
We conclude this section with some examples of edge-erasing homomorphisms.
\begin{example}\label{An erase edge}
We describe edge-erasing homomorphisms from $W$ of type $A_n$ in terms of the combinatorial realization described in Example~\ref{An para}.
If $E=\set{s_{k}\text{---}s_{k+1}}$, the edge-erasing homomorphism $\eta_E$ maps $\pi\in S_{n+1}$ to $(\sigma,\tau)\in S_{k+1}\times S_{n-k+1}$, where $\sigma$ is the restriction of the sequence $\pi_1\pi_2\cdots\pi_{n+1}$ to values $\le k+1$ and $\tau$ is obtained by restricting $\pi_1\pi_2\cdots\pi_{n+1}$ to values $\ge k+1$ and then subtracting $k$ from each value.
For example, if $n=7$ and $k=3$, then $\eta_E(58371426)=(3142,25413)$.
\end{example}
\begin{example}\label{Bn erase edge}
The description for type $B_n$ is similar.
If $E=\set{s_{k-1}\text{---}s_{k}}$, the edge-erasing homomorphism $\eta_E$ maps a signed permutation $\pi$ to $(\sigma,\tau)\in B_k\times S_{n-k+1}$, where $\sigma$ is the restriction of the sequence $\pi_1\pi_2\cdots\pi_{n+1}$ to entries $\pi_i$ with ${|\pi_i|\le k}$ and $\tau$ is obtained by restricting $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\pi_1\cdots\pi_{n-1}\pi_n$ to values $\ge k$ and then subtracting $k-1$ from each value.
For example, if $n=8$, $k=4$, and $\pi=(-4)(-2)71(-8)(-6)5(-3)$, then $\eta(\pi)=((-4)(-2)1(-3),35142)$.
\end{example}
\begin{example}\label{H3 erase edge}
We describe edge-erasing homomorphisms from $W$ of type $H_3$ in the geometric context introduced in Example~\ref{H3 para}.
Figure~\ref{H3 edge fig}.a--b represent the two edge-erasing homomorphisms.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 5}\includegraphics{h3.ps}&&\figpage{ps: 6}\includegraphics{h3.ps}\\
(a)&&(b)\\
\end{tabular}
\caption{
a: The homomorphism that erases the edge $r$---$s$ in type $H_3$.
b: The homomorphism that erases the edge $s$---$t$ in type~$H_3$.
}
\label{H3 edge fig}
\end{figure}
Thus the homomorphism erasing $r$---$s$ maps each element $w\in W$, corresponding to a triangle $\mathcal{T}$, to the element of $W_{\set{r}}\times W_{\set{s,t}}$ labeling the region in Figure~\ref{H3 edge fig}.a containing $\mathcal{T}$.
Figure~\ref{H3 edge fig}.b represents the homomorphism erasing $s$---$t$ similarly.
In each picture, some labels are omitted or belong on the invisible side of the sphere.
\end{example}
\section{Lattice congruences of the weak order}\label{shard sec}
In this section, we quote results that give us the tools to prove Theorem~\ref{edge cong} and to complete the classification of compressive homomorphisms between finite Coxeter groups.
We prove Theorem~\ref{edge cong} at the end of this section and complete the classification in later sections.
For any results that are stated here without proof or citation, proofs can be found in \cite{congruence} and/or \cite[Section~9-5]{regions9}.
We begin with more details on congruences on a finite lattice $L$.
Recall from Section~\ref{intro} that a congruence $\Theta$ on $L$ is uniquely determined by the set of edges \newword{contracted} by $\Theta$ (the set of edges $x\lessdot y$ such that $x\equiv y$ modulo $\Theta$).
In fact, $\Theta$ is uniquely determined by a smaller amount of information.
An element $j$ of $L$ is \newword{join-irreducible} if it covers exactly one element $j_*$.
We say that $\Theta$ \newword{contracts} the join-irreducible element $j$ if $j\equiv j_*$ modulo $\Theta$.
The congruence $\Theta$ is determined by the set of join-irreducible elements that $\Theta$ contracts.
The set $\operatorname{Con}(L)$ of all congruences on $L$ is a sublattice of the lattice of set partitions of $L$.
In fact, $\operatorname{Con}(L)$ is a distributive lattice.
We write $\operatorname{Irr}(\operatorname{Con}(L))$ for the set of join-irreducible congruences on $\operatorname{Con}(L)$.
By the Fundamental Theorem of Finite Distributive Lattices (see e.g.\ \cite[Theorem~3.4.1]{EC1}), $\operatorname{Con}(L)$ is isomorphic to inclusion order on the set of order ideals in $\operatorname{Irr}(\operatorname{Con}(L))$.
The weak order on a finite Coxeter group $W$ has a special property called \newword{congruence uniformity}, or sometimes called \newword{boundedness}.
(This was first proved in \cite[Theorem~6]{bounded}. See also \cite[Theorem~27]{hyperplane}.)
The definition of congruence uniformity is not necessary here, but congruence uniformity means in particular that the join-irreducible congruences on $W$ (i.e.\ the join-irreducible elements of $\operatorname{Con}(L)$) are in bijection with the join-irreducible elements of $W$ itself.
The join-irreducible elements of $W$ are the elements $j$ such that there exists a unique $s\in S$ with $\ell(js)<\ell(j)$.
For each join-irreducible element $j$ of $W$, the corresponding join-irreducible element $\operatorname{Cg}(j)$ of $\operatorname{Con}(W)$ is the unique finest congruence that contracts~$j$.
Thus $\operatorname{Irr}(\operatorname{Con}(W))$ can be thought of as a partial order on the join-irreducible elements of~$W$.
Congruences on $W$ correspond to order ideals in $\operatorname{Irr}(\operatorname{Con}(W))$.
Given a congruence $\Theta$ with corresponding order ideal $I$, the poset $\operatorname{Irr}(\operatorname{Con}(W/\Theta))$ is isomorphic to the induced subposet of $\operatorname{Irr}(\operatorname{Con}(W))$ obtained by deleting the elements of $I$.
The \newword{support} of an element $w$ of $W$ is the unique smallest subset $J$ of $S$ such that $w$ is in the standard parabolic subgroup $W_J$.
Given a join-irreducible element $j\in W$, the \newword{degree} of $j$ is the size of the support of $j$.
Given a set $\set{j_1,\ldots,j_k}$ of join-irreducible elements of $W$, there exists a unique finest congruence contracting all join-irreducible elements in the set.
This congruence is the join $\operatorname{Cg}(j_1)\vee\cdots\vee\operatorname{Cg}(j_k)$ in the congruence lattice $\operatorname{Con}(W)$, or equivalently, the congruence that contracts a join-irreducible element $j$ if and only if $j$ is in the ideal in $\operatorname{Irr}(\operatorname{Con}(W))$ generated by $\set{j_1,\ldots,j_k}$.
We call this the \newword{congruence generated by} $\set{j_1,\ldots,j_k}$.
A congruence on $W$ is \newword{homogeneous of degree $d$} if it is generated by a set of join-irreducible elements of degree $d$.
Abusing terminology slightly, we call a surjective homomorphism \newword{homogeneous of degree $d$} if its corresponding congruence is.
We restate Theorems~\ref{para cong} and~\ref{edge cong} with this new terminology.
(Recall that Theorem~\ref{para cong} was proven in \cite{congruence}.
We will prove Theorem~\ref{edge cong} below.)
\begin{theorem}\label{para cong ji}
If $J\subseteq S$, then $\eta_J$ is a surjective homogeneous homomorphism of degree $1$.
Its fibers constitute the congruence generated by $\set{s:s\in S\setminus J}$.
\end{theorem}
\begin{theorem}\label{edge cong ji}
If $E$ is a set of edges of the diagram of $W$, then $\eta_E$ is a compressive homogeneous homomorphism of degree $2$.
Its fibers constitute the congruence generated by $\set{\operatorname{alt}_k(r,s):\set{r,s}\in E\text{ and }k=2,\ldots,m(r,s)-1}$.
\end{theorem}
We emphasize that for each set $\set{r,s}$ in $E$ and each $k\in\set{2,\ldots,m(r,s)-1}$, both $\operatorname{alt}_k(r,s)$ and $\operatorname{alt}_k(s,r)$ are in the generating set described in Theorem~\ref{edge cong ji}.
Lattice congruences on the weak order on a finite Coxeter group $W$ are closely tied to the geometry of the reflection representation of $W$.
Let $\Phi$ be a root system associated to $W$ with simple reflections $\Pi$.
For each simple reflection $s\in S$, let $\alpha_s$ be the associated simple root.
For each reflection $t\in T$, let $\beta_t$ be the positive root associated to $t$ and let $H_t$ be the reflecting hyperplane for $t$.
A point $x$ is \newword{below} $H_t$ if the inner product of $x$ with $\beta_t$ is nonnegative.
A set of points is below $H_t$ if each of the points is.
Points and sets are \newword{above} $H_t$ if the inner products are nonpositive.
The set $\mathcal{A}=\set{H_t:t\in T}$ is the Coxeter arrangement associated to $W$.
The arrangement $\mathcal{A}$ cuts space into \newword{regions}, which are in bijection with the elements of~$W$.
Specifically, the identity element of $W$ corresponds to the region $D$ that is below every hyperplane of $\mathcal{A}$, and an element $w$ corresponds to the region $wD$.
A subset $\mathcal{A}'$ of $\mathcal{A}$ is called a \newword{rank-two subarrangement} if $|\mathcal{A}'|>1$ and if there is some codimension-2 subspace $U$ such that $\mathcal{A}'=\set{H\in\mathcal{A}:H\supset U}$.
The subarrangement $\mathcal{A}'$ cuts space into $2|\mathcal{A}'|$ regions.
Exactly one of these regions, $D'$ is below all of the hyperplanes in $\mathcal{A}'$, and two hyperplanes in $\mathcal{A}'$ are facet-defining hyperplanes of $D'$.
These two hyperplanes are called the \newword{basic hyperplanes} of~$\mathcal{A}'$.
We define a \newword{cutting relation} on the hyperplanes of $\mathcal{A}$ as follows:
Given distinct hyperplanes $H, H'\in\mathcal{A}$, let $\mathcal{A}'$ be the rank-two subarrangement containing $H$ and~$H'$.
Then $H$ \newword{cuts} $H'$ if~$H$ \textbf{is} a basic hyperplane of $\mathcal{A}'$ and $H'$ is \textbf{not} a basic hyperplane of $\mathcal{A}'$.
For each $H\in\mathcal{A}$, remove from~$H$ all points contained in hyperplanes of~$\mathcal{A}$ that cut~$H$.
The remaining set of points may be disconnected; the closures of the connected components are called the \newword{shards} in~$H$.
The set of shards of $\mathcal{A}$ is the union, over hyperplanes $H\in\mathcal{A}$, of the set of shards in $H$.
For each shard $\Sigma$, we write $H(\Sigma)$ for the hyperplane containing $\Sigma$.
\begin{example}\label{i25 shards}
When $W$ is a dihedral Coxeter group, the only rank-two subarrangement of $\mathcal{A}$ is $\mathcal{A}$ itself.
Figure~\ref{i25}.a shows the reflection representation of a Coxeter group of type $I_2(5)$ with $S=\set{r,s}$.
Figure~\ref{i25}.b shows the associated shards.
\begin{figure}
\begin{tabular}{ccc}
\scalebox{1}{\includegraphics{i25.ps}}&&\scalebox{1}{\includegraphics{i25shards.ps}}\\
(a)&&(b)
\end{tabular}
\caption{(a): A Coxeter group of type $I_2(5)$.
(b): The associated shards}
\label{i25}
\end{figure}
Each of the shards contains the origin, but to make the picture legible, those shards that don't continue through the origin are drawn with an offset from the origin.
\end{example}
\begin{example}\label{B3 shard ex}
Figure~\ref{B3shards} depicts the shards in the Coxeter arrangement of type $B_3$.
\begin{figure}
\centerline{\scalebox{0.98}{\includegraphics{B3shards.ps}}}
\caption{The shards in a Coxeter group of type $B_3$}
\label{B3shards}
\end{figure}
Here, the arrangement $\mathcal{A}$ is a collection of nine planes in $\mathbb R^3$.
The shards are two-dimensional cones contained in these planes.
To capture the picture in the plane, we consider the intersection of $\mathcal{A}$ with a sphere at the origin.
This intersection is an arrangement on nine great circles of the sphere.
Each shard, intersected with the sphere, is either an entire great circle or an arc of a great circle.
The figure shows these intersections under a stereographic projection from the sphere to the plane.
The region $D$ is the small triangle that is inside all of the circles.
As in Figure~\ref{i25}, where shards intersect, those shards that do not continue through the intersection are shown with an offset from the intersection.
Two of the shards are distinguished by arrows.
The significance of these two shards will be explained in Example~\ref{B3 to A3 shard}.
\end{example}
The shards of $\mathcal{A}$ are in one-to-one correspondence with the join-irreducible elements of $W$.
For each shard $\Sigma$, an \newword{upper element} of $\Sigma$ is an element $w\in W$ such that the region $wD$ is above $H(\Sigma)$ and intersects $\Sigma$ in codimension 1.
The set $U(\Sigma)$ of upper elements of $\Sigma$ contains exactly one element $j(\Sigma)$ that is join-irreducible in~$W$.
The element $j(\Sigma)$ is the unique minimal element of $U(\Sigma)$ in the weak order.
This is a bijection from shards to join-irreducible elements.
The inverse map sends a join-irreducible element $j$ to $\Sigma(j)$, the shard that contains $jD\cap(j_*D)$.
Shards in $\mathcal{A}$ correspond to certain collections of edges in the Hasse diagram of the weak order on $W$.
Specifically, a shard $\Sigma$ corresponds to the set of all edges $x\lessdot y$ such that $(xD\cap yD)\subseteq\Sigma$.
For each shard $\Sigma$, a congruence $\Theta$ either contracts none of the edges associated to $\Sigma$ or contracts all of the edges associated to $\Sigma$.
(See \cite[Proposition~6.6]{shardint}.)
If $\Theta$ contracts all of the edges associated to $\Sigma$, then we say that $\Theta$ \newword{removes} $\Sigma$.
In particular, $\Theta$ removes a shard $\Sigma$ if and only if it contracts the join-irreducible element $j(\Sigma)$.
For any congruence $\Theta$, the set of shards not removed by $\Theta$ decomposes space into a fan \cite[Theorem~5.1]{con_app} that is a coarsening of the fan defined by the hyperplanes $\mathcal{A}$.
We now define a directed graph on shards, called the \newword{shard digraph}.
Given two shards~$\Sigma$ and $\Sigma'$, say $\Sigma\to\Sigma'$ if $H(\Sigma)$ cuts $H(\Sigma')$ and $\Sigma\cap\Sigma'$ has codimension~2.
The digraph thus defined on shards is called the \newword{shard digraph}.
This digraph is acyclic\footnote{Shards are often considered in a more general context of simplicial hyperplane arrangements. In this broader setting, the shard digraph need not be acyclic. See \cite[Figure~5]{hyperplane}.}
and we call its transitive closure the \newword{shard poset}.
The bijection $\Sigma\mapsto j(\Sigma)$ from shards to join-irreducible elements is an isomorphism from the shard poset to the poset $\operatorname{Irr}(\operatorname{Con}(W))$, thought of as a partial order on join-irreducible elements of $W$.
Thus, given any congruence $\Theta$, the set of shards removed by $\Theta$ is an order ideal in the shard poset.
Conversely, for any set of shards forming an order ideal in the shard poset, there is a congruence removing exactly that set of shards.
We use this correspondence to reuse shard terminology for join-irreducible elements and vice versa.
So, for example, we talk about the degree of a shard (meaning the degree of the corresponding join-irreducible element), etc.
\begin{example}\label{B3 to A3 shard}
\begin{figure}
\centerline{\scalebox{0.98}{\includegraphics{B3shardsA3.ps}}}
\caption{Removing shards from a Coxeter group of type $B_3$}
\label{B3shardsA3}
\end{figure}
Recall that Example~\ref{miraculous} started by choosing a pair of edges in the weak order on a Coxeter group of type $B_3$.
The finest congruence contracting the two edges was calculated, and the quotient modulo this congruence was found to be isomorphic to the weak order on a Coxeter group of type $A_3$.
The characterization of congruences in terms of shards allows us to revisit this example from a geometric point of view.
Contracting the two chosen edges corresponds to removing the two shards indicated with arrows in Figure~\ref{B3shards}.
Removing these two shards forces the removal of all shards below them in the shard poset.
Figure~\ref{B3shardsA3} depicts the shards whose removal is \emph{not} forced.
(Gaps between intersecting shards have been closed in this illustration.)
The resulting fan is piecewise-linearly (but not linearly) equivalent to the fan defined by a Coxeter arrangement of type $A_3$.
\end{example}
Let $\alpha$ denote the involution $w\mapsto ww_0$ on $W.$
This is an anti-automorphism of the weak order.
For each congruence $\Theta$ on $W,$ let $\alpha(\Theta)$ be the \newword{antipodal congruence} to $\Theta$, defined by
$x\equiv y\mod\alpha(\Theta)$ if and only if $\alpha(x)\equiv \alpha(y)\mod\Theta$.
The involution $\alpha$ induces an anti-isomorphism from $W/\Theta$ to $W/(\alpha(\Theta))$.
The following is a restatement of part of ~\cite[Proposition 6.13]{congruence}.
\begin{proposition}
\label{dual cong}
Let $\Theta$ be a lattice congruence on $W$, let $r,s\in S$, and let ${k\in\set{2,3,\ldots,m(r,s)-1}}$.
Then $\operatorname{alt}_k(r,s)$ is contracted by $\Theta$ if and only if $\operatorname{alt}_{k'}(s,r)$ is contracted by $\alpha(\Theta)$, where $k'=m(r,s)-k+1$.
\end{proposition}
The following lemma is part of \cite[Lemma~3.11]{shardint}, rephrased in the special case of the weak order.
(Cf. \cite[Lemma~3.9]{congruence}.)
\begin{lemma} \label{whole}
A shard $\Sigma$ is an entire hyperplane if and only if it is $H_s$ for some $s\in S$.
\end{lemma}
The following lemma is a rephrasing of \cite[Lemma~3.12]{shardint} in the special case of the weak order.
(Cf.\ \cite[Lemma~4.6]{sort_camb}.)
It implies in particular that a shard of degree 2 is only arrowed by shards of degree~1.
\begin{lemma}\label{half}
Let $\Sigma$ be a shard contained in a reflecting hyperplane $H_t$.
The $\Sigma$ has exactly one facet if and only if $t\not\in S$ but $t\in W_{\set{r,s}}$ for some distinct $r,s\in S$.
In that case, the unique facet of $\Sigma$ is $H_r\cap H_s$.
\end{lemma}
We now use the machinery of shards to prove Theorem~\ref{edge cong}.
\begin{proof}[Proof of Theorem~\ref{edge cong}]
Recall that the first assertion of the theorem has already been established.
As before, let $\Theta_E$ be the lattice congruence whose classes are the fibers of $\eta_E$.
It remains only to prove that $\Theta_E$ is generated by the join-irreducible elements $\operatorname{alt}_k(r,s)$ and $\operatorname{alt}_k(s,r)$ for all $\set{r,s}\in E$ and $k=2,3,\ldots,m(r,s)-1$.
Let $s\in S$ and $w\in W$ have $ws\lessdot w$ and let $t\in T$ be the reflection $wsw^{-1}$, so that $ws=tw$.
The inversion set of $w_{J_i}$ is $\operatorname{inv}(w)\cap W_{J_i}$ and the inversion set of an element determines the element, so $(ws)_{J_i}=w_{J_i}$ if and only if $t\not\in W_{J_i}$.
Thus the edge $ws\lessdot w$ is contracted by $\Theta_E$ if and only if $wsw^{-1}\not\in W_{J_i}$ for all $i\in\set{1,\ldots,k}$.
Equivalently, a shard is removed by $\Theta_E$ if and only if the reflecting hyperplane containing it is $H_t$ for some reflection $t$ with $t\not\in W_{J_i}$ for all $i\in\set{1,\ldots,k}$.
Let $\Sigma_k(r,s)$ be the shard associated to the join-irreducible element $\operatorname{alt}_k(r,s)$ for each $k\in\set{2,\ldots,m(r,s)-1}$.
To prove the theorem, we will show that every shard removed by $\Theta_E$ is forced by the removal of all shards of the form $\Sigma_k(r,s)$ and $\Sigma_k(s,r)$ for each edge $r$---$s$ in $E$.
Specifically, let $\Sigma$ be a shard removed by $\Theta_E$.
We complete the proof by establishing the following claim:
If $\Sigma$ is not $\Sigma_k(r,s)$ or $\Sigma_k(s,r)$ for some edge $r$---$s$ in $E$ and some $k\in\set{2,\ldots,m(r,s)-1}$, then there exists another shard $\Sigma'$, also removed by $\Theta_E$, such that $\Sigma'\to\Sigma$ in the shard digraph.
Since the shard digraph is acyclic, the claim will imply that, for every shard $\Sigma$ removed by $\Theta_E$, there is a directed path from a shard $\Sigma_k(r,s)$ or $\Sigma_k(s,r)$ to $\Sigma$.
We now prove the claim.
Since $\Sigma$ is removed by $\Theta_E$, it is contained in a reflecting hyperplane $H_t$ with $t\not\in W_{J_i}$ for all $i\in\set{1,\ldots,k}$.
Consider a reflecting hyperplane $H_{t'}$ that cuts $H_t$ to define a facet of $\Sigma$.
Then $H_{t'}$ is basic in the rank-two subarrangement $\mathcal{A}'$ containing $H_{t'}$ and $H_t$, while $H_t$ is not basic in $\mathcal{A}'$.
The other basic hyperplane, $H_{t''}$, of $\mathcal{A}'$ also cuts $H_t$ to define the same facet of $\Sigma$.
Thus there exists a shard $\Sigma'$ contained in $H_{t'}$ such that $\Sigma'\to\Sigma$, and there exists a shard $\Sigma''$ contained in $H_{t''}$ such that $\Sigma''\to\Sigma$.
If $t'\not\in W_{J_i}$ for all $i\in\set{1,\ldots,k}$ then $\Sigma'$ is removed by $\Theta$.
Similarly, if $t''\not\in W_{J_i}$ for all $i\in\set{1,\ldots,k}$ then $\Sigma''$ is removed by $\Theta$.
Otherwise, there exists $i\in\set{1,\ldots,k}$ with $t'\in W_{J_i}$ and $j\in\set{1,\ldots,k}$ with $t''\in W_{J_j}$.
A reflection is in a standard parabolic subgroup $W_J$ if and only if its reflecting hyperplane contains the intersection $\bigcap_{s\in J}H_s$.
In particular, $t$ is in $W_{J_i\cup J_j}$.
Furthermore $i\neq j$, because if $i=j$, then $t$ is in $W_{J_i}$, contradicting the fact that $\Sigma$ is removed by $\Theta_E$.
The positive root $\beta_t$ is in the positive linear span of $\beta_{t'}$ and $\beta_{t''}$.
But the simple root coordinates (coordinates with respect to the basis $\Pi$) of $\beta_{t'}$ and $\beta_{t''}$ are supported on the disjoint subsets $\set{\alpha_s:s\in J_i}$ and $\set{\alpha_s:s\in J_j}$.
Thus the simple root coordinates of $\beta_{t'}$ are determined, up to scaling, by the simple root coordinates of $\beta_t$, by restricting the coordinates of $\beta_t$ to simple roots in $\set{\alpha_s:s\in J_i}$.
The simple root coordinates of $\beta_{t''}$ are determined similarly, up to scaling, by the simple root coordinates of $\beta_t$.
We conclude that there is at most one facet of $\Sigma$ defined by hyperplanes $H_{t'}$ and $H_{t''}$ such that there exists $i\in\set{1,\ldots,k}$ with $t'\in W_{J_i}$ and $j\in\set{1,\ldots,k}$ with $t''\in W_{J_j}$.
Thus if $\Sigma$ has more than one facet, then we can use one of these facets to find, as above, a shard $\Sigma'$, removed by $\Theta_E$, with $\Sigma'\to\Sigma$.
If $\Sigma$ has only one facet, then Lemma~\ref{half} says that the facet of $\Sigma$ is defined by $H_r$ and $H_s$ for some $r,s\in S$.
In this case, the join-irreducible element $j(\Sigma)$ associated to $\Sigma$ is in $W_{\set{r,s}}$ but not in $\set{r,s}$.
Thus $j(\Sigma)$ is $\operatorname{alt}_k(r,s)$ and $\operatorname{alt}_k(s,r)$ for some $k\in\set{2,3,\ldots,m(r,s)-1}$.
Equivalently $\Sigma=\Sigma_k(r,s)$ or $\Sigma=\Sigma_k(s,r)$ for some $k\in\set{2,3,\ldots,m(r,s)-1}$.
Since $\Sigma$ is removed by $\Theta_E$, the edge $r$---$s$ is in $E$.
Since $j(\Sigma)\not\in\set{r,s}$, in particular $t\not\in S$, so Lemma~\ref{whole} rules out the possibility that $\Sigma$ has no facets.
We have proved the claim, and thus completed the proof of the theorem.
\end{proof}
We conclude the section by describing the shard digraph for types $A_n$ and $B_n$, quoting results of \cite[Sections~7--8]{congruence}.
The descriptions use the combinatorial realizations explained in Examples~\ref{An para} and~\ref{Bn para}.
For any subset $A$ of $\set{1,\ldots,n+1}$, let $A^c=[n+1]\setminus A$, let $m$ be the minimum element of $A$ and let $M$ be the maximum element of $A^c$.
Join-irreducible elements of $S_{n+1}$ correspond to nonempty subsets of $[n+1]$ such that $M>m$.
Given such a subset, the corresponding join-irreducible permutation $\gamma$ is constructed by listing the elements of $A^c$ in ascending order followed by the elements of $A$ in ascending order.
The poset $\operatorname{Irr}(\operatorname{Con}(S_{n+1}))$ can be described combinatorially, as a partial order on join-irreducible elements, in terms of these subsets.
(See \cite[Theorem~8.1]{congruence}.)
In this paper, we do not need the details, except for the case $n=3$, which is shown in Figure~\ref{IrrConA3 fig}.
\begin{figure}
\centerline{\scalebox{0.9}{\includegraphics{IrrConA3.ps}}}
\caption{$\operatorname{Irr}(\operatorname{Con}(S_4))$.}
\label{IrrConA3 fig}
\end{figure}
We do, however, need details of the description of $\operatorname{Irr}(\operatorname{Con}(B_n))$.
A \newword{signed subset} $A$ is a subset of $\set{\pm1,\pm2,\ldots,\pm n}$ such that $A$ contains no pairs $\set{-i,i}$.
Given a nonempty signed subset $A$, let $m$ be the minimum element of $A$.
If $|A|=n$, let $M$ be $-m$ and otherwise, let $M$ be the maximum element of $\set{1,\ldots,n}\setminus \set{|a|:a\in A}$.
The join-irreducible elements of a Coxeter group of type $B_n$ are in bijection with the nonempty signed subsets of $\set{1,\ldots,n}$ with $M>m$.
Given such a signed subset $A$, the corresponding join-irreducible permutation $\gamma$ has one-line notation given by the elements of $\set{1,\ldots,n}\setminus \set{|a|:a\in A}$ in ascending order, followed by the elements of $A$ in ascending order.
The reflection $t$ associated to the unique cover relation down from $\gamma$ is $(M\,\,\,m)(-m\,\,\,-M)$ if $m\neq-M$ or $(m\,\,\,M)$ if $m=-M$.
The associated shard is in the hyperplane $H_t$.
Figure~\ref{IrrConB3 fig} shows the poset $\operatorname{Irr}(\operatorname{Con}(B_3))$.
To describe this poset for general $n$, we quote the combinatorial description of the shard digraph in type $B_n$.
Arrows between shards depend on certain combinations of conditions.
The meaning of the letters q, f and r in the labels for the conditions is explained in \cite[Section~7]{congruence}.
We begin with conditions (q1) through~(q6).
\begin{figure}
\centerline{\scalebox{0.9}{\includegraphics{IrrConB3.ps}}}
\caption{$\operatorname{Irr}(\operatorname{Con}(B_3))$.}
\label{IrrConB3 fig}
\end{figure}
\begin{tabular}{ll}
(q1)&$-m_1=M_1<M_2=-m_2$.\\
(q2)&$-m_2=M_2=M_1>m_1>0$.\\
(q3)&$M_2=M_1>m_1>m_2\neq -M_2$.\\
(q4)&$M_2>M_1>m_1=m_2\neq -M_2$.\\
(q5)&$-m_2=M_1>m_1>-M_2\neq m_2$.\\
(q6)&$-m_2>M_1>m_1=-M_2\neq m_2$.
\end{tabular}
Next we define condition (f), which depends on a parameter in $\set{\pm1,\ldots,\pm n}$.
In the following conditions, the superscript ``$c$'' mean complementation in the set $\set{\pm1,\pm2,\ldots,\pm n}$ and the notation $(x,y)$ means the open interval between $x$ and $y$.
For $a\in\set{\pm1,\ldots,\pm n}$, say $A_2$ satisfies condition (f\,:\,$a$) if one of the following holds:
\begin{tabular}{ll}
(f1\,:\,$a$)&$a\in A_2$.\\
(f2\,:\,$a$)&$a\in A_2^c\setminus\set{-M_2,-m_2}$ and $-a\not\in A_2\cap(m_2,M_2)$.\\
(f3\,:\,$a$)&$a\in\set{-M_2,-m_2}$ and $(A_2\cup-A_2)^c\cap(m_2,M_2)\cap(-M_2,-m_2)=\emptyset$.
\end{tabular}
Every $a\in\set{\pm1,\ldots,\pm n}$ satisfies exactly one of the conditions $a\in A_2$, $a\in A_2^c\setminus\set{-M_2,-m_2}$ and $a\in\set{-M_2,-m_2}$ appearing in condition (f).
Finally, conditions (r1) and (r2):
\begin{tabular}{ll}
(r1)&$A_1\cap(m_1,M_1)=A_2\cap(m_1,M_1)$.\\
(r2)&$A_1\cap(m_1,M_1)=-A_2^c\cap(m_1,M_1)$.
\end{tabular}
\begin{theorem}
\label{B shard}
$\Sigma_1\to\Sigma_2$ if and only if one of the following combinations of conditions holds:
\begin{enumerate}
\item[1. ] \textup{(q1)} and \textup{(r1)}.
\item[2. ] \textup{(q2)} and \textup{(r1)}.
\item[3. ] \textup{(q3)}, \textup{(f\,:\,$m_1$)} and \textup{(r1)}.
\item[4. ] \textup{(q4)}, \textup{(f\,:\,$M_1$)} and \textup{(r1)}.
\item[5. ] \textup{(q5)}, \textup{(f\,:\,$-m_1$)} and \textup{(r2)}.
\item[6. ] \textup{(q6)}, \textup{(f\,:\,$-M_1$)} and \textup{(r2)}.
\end{enumerate}
\end{theorem}
\section{Decreasing edge labels}\label{dihedral sec}
Theorem~\ref{edge factor} reduces the problem of classifying compressive homomorphisms $\eta$ between weak orders to the special case of compressive homomorphisms that do not erase any edges.
Equivalently, these are the compressive homomorphisms between finite Coxeter groups that restrict to (unlabeled) graph isomorphisms of diagrams.
As a byproduct, Theorem~\ref{edge factor} allows us to further reduce the problem to the case where the diagrams are connected (or equivalently, where the Coxeter groups are irreducible).
We continue to take $S$ to be the set of simple generators of $W$ and of $W'$ and assume that $\eta:W\to W'$ is such a homomorphism that fixes $S$ pointwise, so that the diagrams of $W$ and $W'$ are identical as unlabeled graphs.
Recall that Proposition~\ref{diagram facts} says that for each edge in the diagram of $W$, the corresponding edge in the diagram of $W'$ has weakly smaller label.
Up to now, the classification of surjective lattice homomorphisms between weak orders has proceeded by uniform arguments, rather than arguments that are specific to particular families in the classification of finite Coxeter groups.
To complete the classification of homomorphisms, we now turn to the classification of finite Coxeter groups, which tells us in particular that there are very few cases remaining to consider.
We need to study the cases where $(W,W')$ are $(I_2(m),I_2(m'))$ for $m'<m$ or $(B_n,A_n)$, $(F_4,A_4)$, $(H_3,A_3)$, $(H_3,B_3)$, $(H_4,A_4)$, or $(H_4,B_4)$.
The cases where $(W,W')$ are $(I_2(m),I_2(m'))$ for $m'<m$ are easily understood by considering Example~\ref{i25 shards}, where $W$ is $I_2(5)$.
It is apparent from Figure~\ref{i25} that a congruence $\Theta$ has the property that $W/\Theta$ is isomorphic to the weak order on $I_2(4)$ if and only if $\Theta$ contracts exactly one of the join-irreducible elements $rs$, $rsr$, and $rsrs$ and exactly one of the join-irreducible elements $sr$, $srs$, $srsr$.
More generally, let $W$ be a Coxeter group of type $I_2(m)$ with $S=\set{r,s}$.
A congruence $\Theta$ on $W$ has the property that $W/\Theta$ is isomorphic to the weak order on $I_2(m')$ if and only if $\Theta$ contracts exactly $m-m'$ join-irreducible elements of the form $\operatorname{alt}_k(r,s)$ for $k\in\set{2,\ldots,m-1}$ and exactly $m-m'$ join-irreducible elements of the form $\operatorname{alt}_k(s,r)$ for $k\in\set{2,\ldots,m-1}$.
This result for dihedral groups is simple, but its importance for the general case is underscored by Theorem~\ref{diagram uniqueness}.
In Sections~\ref{Bn Sn+1 sec} and~\ref{exceptional sec}, we consider the remaining possibilities for the pair $(W,W')$ and, in particular, complete the proofs of Theorems~\ref{existence} and~\ref{diagram uniqueness}.
As mentioned earlier, Theorem~\ref{main} follows from Theorems~\ref{para factor} and~\ref{existence}.
\section{Homomorphisms from $B_n$ to $S_{n+1}$}\label{Bn Sn+1 sec}
We realize the groups $S_{n+1}$ and $B_n$ as in Examples~\ref{An para} and~\ref{Bn para}.
A surjective homomorphism $\eta$ from $B_n$ to $S_{n+1}$ restricts, by Proposition~\ref{diagram facts}, to a surjective homomorphism from $(B_n)_{\set{s_0,s_1}}\cong B_2$ to $(S_{n+1})_{\set{s_1,s_2}}\cong S_3$.
Thus, as discussed in Section~\ref{dihedral sec}, the congruence associated to $\eta$ contracts exactly one of the join-irreducible elements $s_0s_1,s_0s_1s_0$, and exactly one of the join-irreducible elements $s_1s_0,s_1s_0s_1$.
We will see that each of the four choices leads to a unique surjective homomorphism and that three of the four choices are associated to homogeneous congruences of degree $2$.
\subsection{Simion's homomorphism}\label{simion sec}
We consider first the case where $s_0s_1$ and $s_1s_0s_1$ are contracted, but we start not by contracting join-irreducibles, but by giving a map from $B_n$ to $S_{n+1}$.
This map was first defined by Simion~\cite{Simion} in connection with a construction of the type-B associahedron (also known as the cyclohedron).
Let $\eta_\sigma:B_n\to S_{n+1}$ map $\pi\in B_n$ to the permutation constructed as follows:
Construct the sequence $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\,0\,\pi_1\cdots\pi_{n-1}\pi_n$, extract the subsequence consisting of nonnegative entries and add $1$ to each entry.
Thus for example, for $\pi=3(-4)65(-7)(-1)2\in B_7$, we construct the sequence
\[(-2)17(-5)(-6)4(-3)03(-4)65(-7)(-1)2\]
and extract the subsequence $17403652$, so that $\eta_\sigma(\pi)$ is $28514763\in S_8$.
We will prove the following theorem:
\begin{theorem}\label{simion thm}
The map $\eta_\sigma$ is a surjective lattice homomorphism from $B_n$ to $S_{n+1}$.
Its fibers constitute the congruence generated by $s_0s_1$ and $s_1s_0s_1$.
Furthermore, $\eta_\sigma$ is the unique surjective lattice homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1}}$ agrees with $\eta_\sigma$.
\end{theorem}
Suppose $\pi\lessdot \tau$ in the weak order on $B_n$.
Then the one-line notations for $\pi$ and $\tau$ differ in one of two ways:
Either they agree except in the sign of the first entry or they agree except that two adjacent entries of $\pi$ are transposed in $\tau$.
If they agree except in the sign of the first entry, then $\eta_\sigma(\pi)\neq\eta_\sigma(\tau)$.
If they agree except that two adjacent entries of $\pi$ are transposed in $\tau$, then $\eta_\sigma(\pi)=\eta_\sigma(\tau)$ if and only if the two adjacent entries have opposite signs.
We have proved the following:
\begin{prop}\label{simion cover}
If $\pi\lessdot \tau$ in the weak order on $B_n$, then $\eta_\sigma(\pi)=\eta_\sigma(\tau)$ if and only if the reflection $t$ associated to the cover $\pi\lessdot\tau$ is $(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $1\le i<j\le n$.
\end{prop}
We give a similar characterization of the congruence generated by $s_0s_1$ and~$s_1s_0s_1$:
\begin{prop}\label{simion finest}
The congruence generated by $s_0s_1$ and $s_1s_0s_1$ removes a shard $\Sigma$ if and only if $\Sigma$ is contained in a hyperplane $H_t$ such that $t=(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $1\le i<j\le n$.
\end{prop}
\begin{proof}
Let $C$ be the set of signed subsets corresponding to shards contained in hyperplanes $H_t$ such that $t=(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $1\le i<j\le n$.
Thus $C$ is the set of all nonempty signed subsets $A$ with $m<0$ and $m\neq-M$.
(Equivalently, $A\not\subseteq \set{1,\ldots,n}$ and $|A|<n$.)
The assertion of the proposition is that $C$ is the set of signed subsets representing shards removed by the congruence generated by $s_0s_1$ and $s_1s_0s_1$.
The join-irreducible element $s_0s_1$ has one-line notation $2(-1)34\cdots n$, and the join-irreducible element $s_1s_0s_1$ is $1(-2)34\cdots n$.
The corresponding signed subsets are $\set{-1,3,4,\ldots, n}$ and $\set{-2,3,4,\ldots, n}$, both of which are in $C$.
To establish the ``only if'' assertion of the proposition, we show that no set $A_1\in C$ arrows a set $A_2\not\in C$.
Indeed, if $A_1\in C$ and $A_2\not\in C$, then $m_1<0$ and $m_1\neq-M_1$ and either $m_2>0$ or $m_2=-M_2$.
The fact that $m_1<0$ and $m_1\neq-M_1$ rules out conditions (q1) and (q2).
Whether $m_2>0$ or $m_2=-M_2$, conditions (q3)--(q6) are easily ruled out as well.
To establish the ``if'' assertion, we show that every set $A_2\in C$, except the sets $\set{-1,3,4,\ldots, n}$ and $\set{-2,3,4,\ldots, n}$, is arrowed to by another set ${A_1\in C}$.
Since the shard digraph is acyclic, this implies that $\set{-1,3,4,\ldots, n}$ and $\set{-2,3,4,\ldots, n}$ are the unique sources in the restriction of the digraph to $C$.
Let $A_2\in C$, so that $m_2<0$ and $m_2\neq-M_2$, with $A_2$ not equal to $\set{-1,3,4,\ldots, n}$ or $\set{-2,3,4,\ldots, n}$.
We will produce a signed subset $A_1\in C$ with $A_1\to A_2$ by considering several cases.
\noindent
\textbf{Case 1:} $|A_2|<n-1$.
Then let $A_1=A_2\cup\set{M_2}$.
Then $M_2>M_1>0>m_1=m_2\neq-M_2$, so (q4) holds.
Furthermore, $|A_1|<n$, so $m_1\neq M_1$, and thus $A_1\in C$.
We have $M_1\in A_2^c\setminus\set{-M_2,-m_2}$.
By definition of $M_1$, the element $-M_1$ is not in $A_1$, and since $A_2\subset A_1$, we conclude that $-M_1\not\in A_2$.
Thus (f2\,:\,$M_1$) holds.
Also, (r1) holds, so $A_1\to A_2$ in the shard digraph.
\noindent
\textbf{Case 2:} $|A_2|=n-1$.
Since $A_2\in C$, this is the only alternative to Case 1.
By hypothesis, we have ruled out the possibilities $(m,M)=(-1,2)$ and $(m,M)=(-2,1)$.
\noindent
\textbf{Subcase 2a:} $A_2\cap[1,M_2-1]\neq\emptyset$.
(The notation $[a,b]$ stands for the closed interval between $a$ and $b$.)
Define $M_1$ to be the maximum element of $A_2\cap[1,M_2-1]$ and define $A_1$ to be $(A_2\cup\set{M_2})\setminus\set{M_1}$.
Thus $M_1$ is indeed the maximum element of $\set{1,\ldots,n}\setminus \set{|a|:a\in A_1}$.
Conditions (q4), (f1\,:\,$M_1$), and (r1) hold.
We have $m_1=m_2<0$ and $|A_1|=|A_2|<n$, to $A_1$ is in $C$.
\noindent
\textbf{Subcase 2b:} $A_2\cap[1,M_2-1]=\emptyset$ and $m_2>-M_2$.
By definition of $M_2$, neither $M_2$ nor $-M_2$ is in $A_2$.
Thus since $|A_2|=n-1$, every other element $i$ of $\set{1,\ldots,n}$ has either $i$ or $-i$ in $A_2$.
Since $A_2\cap[1,M_2-1]=\emptyset$, we conclude that the interval $[-M_2+1,-1]$ is contained in $A_2$.
Now the fact that $m_2>-M_2$ implies that $m_2=-M_2+1$.
If $m_2=-1$ then $A_2=\set{-1,3,4,\ldots, n}$, a possibility that is ruled out by hypothesis.
Define $A_1$ to be $A_2\setminus\set{m_2}$.
Then $m_1=m_2+1<0$ and $M_1=M_2$.
Also $|A_1|=n-2$, so $A_1$ is in $C$.
Conditions (q3), (f1\,:\,$m_1$) and (r1) hold.
\noindent
\textbf{Subcase 2c:} $A_2\cap[1,M_2-1]=\emptyset$, $m_2<-M_2$, and $A_2\cap[m_2+1,-1]\neq\emptyset$.
Let $A_1=(A_2\cup\set{-m_2})\setminus\set{m_2}$.
Since $A_2\cap[m_2+1,-1]\neq\emptyset$, the minimum element $m_1$ of $A_1$ is negative, and since in addition $|A_1|=|A_2|<n$, the set $A_1$ is in $C$.
Conditions (q3), (f1\,:\,$m_1$), and (r1) hold, with condition (r1) using the fact that $-m_2>M_1$.
\noindent
\textbf{Subcase 2d:} $A_2\cap[1,M_2-1]=\emptyset$, $m_2<-M_2$, and $A_2\cap[m_2+1,-1]=\emptyset$.
As in Subcase 2b, besides $M_2$, every element $i$ of $\set{1,\ldots,n}$ has either $i$ or $-i$ in $A_2$.
Thus the fact that $A_2\cap[1,M_2-1]=\emptyset$ and $A_2\cap[m_2+1,-1]=\emptyset$ implies that $[1,-m_2-1]\cap[1,M_2-1]=\emptyset$.
In other words, either $m_2=-1$ or $M_2=1$, but the fact that $m_2<-M_2$ rules out the possibility that $m_2=-1$.
Thus $M_2=1$.
Since $A_2\cap[m_2+1,-1]=\emptyset$, the set $A_2$ equals $\set{m_2}\cup(\set{1,\ldots,n}\setminus\set{1,-m_2})$.
If $m_2=-2$, then $A_2=\set{-2,3,4,\ldots, n}$, which was also ruled out by hypothesis.
The set $A_1=(A_2\setminus\set{m_2,-m_2-1})\cup\set{-m_2,m_2+1}$ is in $C$.
We have $m_1=m_2+1<-1$ and $M_1=M_2=1$, so conditions (q3), (f2\,:\,$m_1$), and (r1) hold.
\end{proof}
So far, we know nothing about how $\eta_\sigma$ relates to the weak order on $S_{n+1}$.
But Propositions~\ref{simion cover} and~\ref{simion finest} constitute a proof of the second assertion of Theorem~\ref{simion thm}: that the congruence $\Theta_\sigma$ defined by the fibers of $\eta_\sigma$ is generated by $s_0s_1$ and $s_1s_0s_1$.
Proposition~\ref{simion cover} implies that the bottom elements of $\Theta_\sigma$ are exactly those signed permutations whose one-line notation consists of a (possibly empty) sequence of negative entries followed by a (possibly empty) sequence of positive entries.
The restriction of $\eta_\sigma$ to bottom elements is a bijection to $S_{n+1}$, with inverse map described as follows:
If $\tau\in S_{n+1}$ and $\tau_i=1$, then the inverse map takes $\tau$ to the signed permutation whose one-line notation is
\[(-\tau_{i-1}+1)(-\tau_{i-2}+1)\cdots(-\tau_1+1)(\tau_{i+1}-1)(\tau_{i+2}-1)\cdots(\tau_{n+1}-1).\]
This inverse map is easily seen to be order-preserving.
The map $\eta_\sigma$ is also easily seen to be order-preserving, so its restriction is as well.
We have shown that the restriction of $\eta_\sigma$ to bottom elements of $\Theta_\sigma$ is an isomorphism to the weak order on~$S_{n+1}$.
The natural map from $B_n$ to $B_n/\Theta_\sigma$ is a surjective homomorphism, and $B_n/\Theta_\sigma$ is isomorphic to the subposet of $B_n$ induced by bottom elements of $\Theta_\sigma$.
Since $\eta_\sigma$ equals the composition of the natural map, followed by the isomorphism to the poset of bottom elements, followed by the isomorphism to $S_{n+1}$, it is a surjective homomorphism.
Now, if $\eta$ is any surjective homomorphism agreeing with $\eta_\sigma$ on $(B_n)_{\set{s_0,s_1}}$, the associated congruence $\Theta$ contracts $s_0s_1$ and $s_1s_0s_1$.
Thus $\Theta$ is a coarsening of the congruence $\Theta_\sigma$ associated to $\eta_\sigma$.
But then since both $B_n/\Theta$ and $B_n/(\Theta_\sigma)$ are isomorphic to $S_{n+1}$, they must coincide.
We have completed the proof of Theorem~\ref{simion thm}.
\subsection{A non-homogeneous homomorphism}\label{nonhom sec}
In this section, we consider surjective homomorphisms whose congruence contracts $s_0s_1s_0$ and $s_1s_0$.
We begin by defining a homomorphism $\eta_\nu$ that is combinatorially similar to Simion's homomorphism.
We will see that, whereas $\eta_\sigma$ is homogeneous of degree $2$, $\eta_\nu$ is non-homogeneous.
However, $\eta_\nu$ is still of low degree: it is generated by contracting join-irreducible elements of degrees $2$ and $3$.
Let $\eta_\nu:B_n\to S_{n+1}$ map $\pi\in B_n$ to the permutation by extracting the subsequence of $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\pi_1\cdots\pi_{n-1}\pi_n$ consisting of values greater than or equal to $-1$, changing $-1$ to $0$, then adding $1$ to each entry.
Thus for example, for $\pi=3(-4)65(-7)(-1)2\in B_7$, we extract the subsequence $174365(-1)2$, so that $\eta_\nu(\pi)$ is $28547612$.
We will prove the following theorem:
\begin{theorem}\label{nonhom thm}
The map $\eta_\nu$ is a surjective lattice homomorphism from $B_n$ to $S_{n+1}$.
Its fibers constitute the congruence generated by $s_0s_1s_0$, $s_1s_0$, $s_1s_0s_1s_2$, and $s_2s_1s_0s_1s_2$.
Furthermore, $\eta_\nu$ is the unique surjective lattice homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1}}$ agrees with $\eta_\nu$.
\end{theorem}
The outline of the proof of Theorem~\ref{nonhom thm} is the same as the proof of Theorem~\ref{simion thm}.
We first determine when signed permutations $\pi\lessdot \tau$ in $B_n$ map to the same element of $S_{n+1}$.
If $\pi$ and $\tau$ agree except in the sign of the first entry (with $\pi_1$ necessarily positive), then $\eta_\nu(\pi)=\eta_\nu(\tau)$ if and only if $\pi_1>1$.
If they agree except that two adjacent entries of $\pi$ are transposed in $\tau$, then $\eta_\nu(\pi)=\eta_\nu(\tau)$ if and only if the two transposed entries have opposite signs and neither is $\pm1$.
Thus:
\begin{prop}\label{nonhom cover}
If $\pi\lessdot \tau$ in the weak order on $B_n$, then $\eta_\nu(\pi)=\eta_\nu(\tau)$ if and only if the reflection $t$ associated to the cover $\pi\lessdot\tau$ is either $(i\,\,-i)$ for some $i>1$ or $(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $2\le i<j\le n$.
\end{prop}
We now show that the congruence generated by $s_0s_1s_0$, $s_1s_0$, $s_1s_0s_1s_2$, and $s_2s_1s_0s_1s_2$ agrees with the fibers of $\eta_\nu$, as described in Proposition~\ref{nonhom cover}.
\begin{prop}\label{nonhom finest}
In the congruence generated by $s_0s_1s_0$, $s_1s_0$, $s_1s_0s_1s_2$, and $s_2s_1s_0s_1s_2$ a shard is removed if and only if it is contained in a hyperplane $H_t$ with $t=(i\,\,-i)$ and $i>1$ or $t=(i\,\,-j)(j\,\,-i)$ and $2\le i<j\le n$.
\end{prop}
\begin{proof}
Let $C$ be the set of signed subsets corresponding to shards contained in hyperplanes $H_t$ such that $t$ is either $(i\,\,-i)$ for some $i>1$ or $(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $2\le i<j\le n$.
Thus $C$ is the set of all nonempty signed subsets $A$ with $m<-1$ and $M>1$.
The elements $s_0s_1s_0$, $s_1s_0$, $s_1s_0s_1s_2$, and $s_2s_1s_0s_1s_2$ correspond respectively to the signed sets $\set{-2,-1,3,4,\ldots,n}$, $\set{-2,1,3,4,\ldots,n}$, $\set{-2,4,5,\ldots,n}$, and $\set{-3,4,5,\ldots,n}$.
We first show that no set $A_1\in C$ arrows a set $A_2\not\in C$.
Let $A_1\in C$ and $A_2\not\in C$.
Then $m_1<-1$ and $M_1>1$, while either $m_2\ge-1$ or $M_2=1$.
The fact that $m_1<-1$ rules out condition (q2).
If $M_2=1$, then the fact that $M_1>1$ rules out conditions (q1), (q3) and (q4), and the fact that $m_1<-1$ rules out (q5) and (q6).
Suppose $m_2\ge -1$.
Then the equality $M_2=-m_2$ in (q1) fails unless $m_2=-1$, but in that case $M_2=1$, so (q1) is ruled out.
The fact that $m_1<-1$ rules out (q3) and (q4).
Since $-m_2\le 1$ and $M_1>1$, conditions (q5) and (q6) fail as well.
Next, let $A_2\in C$, so that $m_2<-1$ and $M_2>1$, with $A_2$ not equal to $\set{-2,-1,3,4,\ldots,n}$, $\set{-2,1,3,4,\ldots,n}$, $\set{-2,4,5,\ldots,n}$, or $\set{-3,4,5,\ldots,n}$.
We will produce a signed subset $A_1\in C$ with $A_1\to A_2$.
\noindent
\textbf{Case 1:} $m_2=-M_2$.
Then $|A_2|=n$.
If $m_2=-2$, then $A_2=\set{-2,-1,3,4,\ldots,n}$ or $A_2=\set{-2,1,3,4,\ldots,n}$, but these are ruled out, so $m_2<-2$.
Let $A_1=(A_2\cup\set{-m_2,m_2+1})\setminus\set{m_2,-m_2-1}$.
Then $m_1=m_2+1$ and $M_1=M_2-1=-m_1$.
Conditions (q1) and (r1) hold, so $A_1\to A_2$.
Also $-m_1=M_1>1$, so $A_1\in C$.
\noindent
\textbf{Case 2:} $m_2\neq-M_2$.
Then $|A_2|<n$.
\noindent
\textbf{Subcase 2a:} $(A_2\cup -A_2)^c\cap[2,M_2-1]\neq\emptyset$.
Let $A_1=A_2\cup\set{M_2}$.
Then $m_1=m_2$ and $M_1$ is the maximal element of $(A_2\cup -A_2)^c\cap[2,M_2-1]$, so $A_2\in C$.
Furthermore, $M_2>M_1>m_1=m_2\neq-M_2$, so (q4) holds.
Also (f2\,:\,$M_1$) and (r1) hold.
\noindent
\textbf{Subcase 2b:} $(A_2\cup -A_2)^c\cap[2,M_2-1]=\emptyset$ and $A_2\cap[2,M_2-1]\neq\emptyset$.
Let $b$ be the largest element of $A_2\cap[2,M_2-1]\neq\emptyset$ and define $A_1=(A_2\cup\set{M_2})\setminus\set{b}$.
Then $m_1=m_2$ and $M_1=b$, so $A_1\in C$.
Also (q4), (f1\,:\,$M_1$) and (r1) hold.
\noindent
\textbf{Subcase 2c:} $(A_2\cup -A_2)^c\cap[2,M_2-1]=\emptyset$ and $A_2\cap[2,M_2-1]=\emptyset$.
In this case, $A_2$ contains $\set{-M_2+1,-M_2+2,\ldots,-2}$.
If $m_2<-2$ and $M_2>2$ then let $A_1=A_2\setminus\set{m_2}$.
This is in $C$, since $M_1=M_2>1$ and $m_1\le-2$.
Also, (q3), (f1\,:\,$m_1$) and (r1) hold.
If $M_2=2$ then $m_2<-2$.
If also $m_2=-3$ then there are two possibilities, because $A_2=\set{-3,4,5,\ldots,n}$ is ruled out.
If $A_2=\set{-3,1,4,5,\ldots,n}$ then let $A_1=\set{-2,1,3,4,\ldots,n}\in C$.
If $A_2=\set{-3,-1,4,5,\ldots,n}$ then let $A_1=\set{-2,-1,3,4,\ldots,n}\in C$.
In either case, (q6), (f3\,:\,$-M_1$) and (r2) hold.
If $m_2<-3$ then let $A_1=(A_2\cup\set{m_2+1,-m_2})\setminus\set{-m_2-1,m_2}$.
Then $m_1=m_2+1<-2$ and $M_1=2$, so $A_1\in C$.
Conditions (q3) and (r1) hold, along with either (f1\,:\,$m_1$) or (f2\,:\,$m_1$).
If $m_2=-2$ then $M_2>2$.
Since $A_2$ contains $\set{-M_2+1,-M_2+2,\ldots,-2}$, we conclude that $M_2=3$.
Since $A_2=\set{-2,4,5,\ldots,n}$ is ruled out, there are two possibilities.
If $A_2=\set{-2,1,4,5,\ldots,n}$ then let $A_1={-2,1,3,4,5,\ldots,n}$.
If $A_2=\set{-2,-1,4,5,\ldots,n}$ then let $A_1={-2,-1,3,4,5,\ldots,n}$.
In either case, (q4), (f3\,:\,$M_1$), and (r1) hold.
\end{proof}
We have showed that the fibers of $\eta_\nu$ are a lattice congruence on $B_n$ satisfying the second assertion of Theorem~\ref{nonhom thm}.
Let $\Theta_\nu$ be this congruence.
The map $\eta_\nu$ is obviously order-preserving, so just as in the proof of Theorem~\ref{simion thm}, we will show that $\eta_\nu$ restricts to a bijection from bottom elements of $\Theta_\nu$-classes to permutations in $S_{n+1}$ and that the inverse of the restriction is order-preserving.
Proposition~\ref{nonhom cover} implies that the bottom elements of $\Theta_\nu$ are exactly those signed permutations whose one-line notation consists of a sequence of positive elements, followed by $\pm1$, then a sequence of negative elements, and finally a sequence of positive elements.
(Any of these three sequences may be empty.)
Such a signed permutation $\pi_1\cdots\pi_n$ with $\pi_i=1$ and negative entries $\pi_{i+1}\cdots\pi_j$, maps to the permutation
\[(-\pi_j)(-\pi_{j-1})\cdots(-\pi_{i+1})\,1\,\pi_1\pi_2\cdots\pi_{i-1}\,2\,\pi_{j+1}\pi_{j+2}\cdots\pi_n.\]
If $\pi_i=-1$ instead, then the bottom element maps to the same permutation, except with the entries $1$ and $2$ swapped.
This restriction of $\eta_\nu$ is a bijection whose inverse takes a permutation $\tau_1\cdots\tau_{n+1}$ with $\tau_i=1$ and $\tau_j=2$, with $i<j$, to the signed permutation
\[(\tau_{i+1}-1)\cdots(\tau_{j-1}-1)\,1\,(-\tau_{i-1}+1)\cdots(-\tau_1+1)(\tau_{j+1}-1)\cdots(\tau_{n+1}-1).\]
If $\tau_i=2$ and $\tau_j=1$, with $i<j$, then the inverse map takes $\tau$ to the same signed permutation, except with $-1$ in place of $1$.
This inverse in order-preserving, and we have proved the first two assertions of Theorem~\ref{nonhom thm}.
To prove the third assertion, we temporarily introduce the bulky notation $\eta_\nu^{(n)}:B_n\to S_{n+1}$.
(Until now, we had suppressed the explicit dependence of the map $\eta_\nu$ on $n$, and we will continue to do so after this explanation.)
Arguing as in the proof of Theorem~\ref{simion thm}, we easily see that, for each $n\ge 3$, the map $\eta_\nu^{(n)}$ is the unique surjective homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1,s_2}}$ is $\eta_\nu^{(3)}$.
Now let $\eta$ be any surjective homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1}}$ is $\eta_\nu^{(2)}$.
Let $\Theta$ be the associated congruence on $B_n$.
Then in particular, the congruence defined by the restriction of $\eta$ to $(B_n)_{\set{s_0,s_1,s_2}}\cong B_3$ contracts $s_0s_1s_0$ and $s_1s_0$, corresponding to signed subsets $\set{-2,-1,3}$ and $\set{-2,1,3}$.
Figure~\ref{IrrConB3 squashed fig} shows the poset of signed subsets corresponding to join-irreducible elements in $(B_n)_{\set{s_0,s_1,s_2}}\cong B_3$ not forced to be contracted by the contraction of $s_0s_1s_0$ and $s_1s_0$.
\begin{figure}
\centerline{\scalebox{.9}{\includegraphics{IrrConB3squash.ps}}}
\caption{The complement of an order ideal in $\operatorname{Irr}(\operatorname{Con}(W))$ for $W$ of type $B_3$.}
\label{IrrConB3 squashed fig}
\end{figure}
(This is the complement of an order ideal in the poset of Figure~\ref{IrrConB3 fig}.)
By Proposition~\ref{diagram facts}, the restriction of $\eta$ to $(B_n)_{\set{s_0,s_1,s_2}}$ is a surjective homomorphism to $S_4$.
In particular, the restriction of $\operatorname{Irr}(\operatorname{Con}((B_n)_{\set{s_0,s_1,s_2}}))$ to join-irreducibles not contracted by $\Theta$ is isomorphic to $\operatorname{Irr}(\operatorname{Con}(S_4))$.
Comparing Figure~\ref{IrrConB3 squashed fig} to Figure~\ref{IrrConA3 fig}, we see that $\Theta$ must contract two additional join-irreducible elements, beyond those forced by $s_0s_1s_0$ and $s_1s_0$.
We see, furthermore, that the only two join-irreducible elements that can be contracted, to leave a poset isomorphic to $\operatorname{Irr}(\operatorname{Con}(S_4))$, are those whose signed subsets are $-2$ and $-3$.
We conclude that $\Theta$ contracts $s_1s_0s_1s_2$ and $s_2s_1s_0s_1s_2$.
Theorem~\ref{nonhom thm} says that $\Theta$ is weakly coarser than $\Theta_\nu$.
But since $\eta$ and $\eta_\nu$ are both surjective lattice homomorphisms to $S_{n+1}$, the congruences $\Theta$ and $\Theta_\nu$ have the same number of congruence classes, so $\Theta=\Theta_\nu$.
Thus $\eta$ and $\eta_\nu$ agree up to automorphisms of $S_{n+1}$, but the only nontrivial automorphism of $S_{n+1}$ is the diagram automorphism.
Since both maps take $(B_n)_{\set{s_0,s_1}}$ to $(S_{n+1})_{\set{s_1,s_2}}$, we rule out the diagram automorphism and conclude that $\eta=\eta_\nu$.
Thus completes the proof of Theorem~\ref{nonhom thm}.
\subsection{Two more homogeneous homomorphisms}\label{two more sec}
In this section, we consider the case where $s_0s_1$ and $s_1s_0$ are contracted and the case where $s_0s_1s_0$ and $s_1s_0s_1$ are contracted.
The congruences associated to these cases are dual to each other by Proposition~\ref{dual cong}.
Let $\eta_\delta:B_n\to S_{n+1}$ send $\pi\in B_n$ to the permutation obtained as follows:
If the one-line notation for $\pi$ contains the entry $1$, then construct a sequence
\[(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\,0\,\pi_1\cdots\pi_{n-1}\pi_n,\]
extract the subsequence consisting of nonnegative entries, and add $1$ to each entry.
If the one-line notation for $\pi$ contains the entry $-1$, then extract the subsequence of $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\pi_1\cdots\pi_{n-1}\pi_n$ consisting of values greater than or equal to $-1$, change $-1$ to $0$, then add $1$ to each entry.
Notice that $\eta_\delta$ is a hybrid of $\eta_\sigma$ and $\eta_\nu$, in the sense that $\eta_\delta(\pi)=\eta_\sigma(\pi)$ if the one-line notation of $\pi$ contains $1$ and $\eta_\delta(\pi)=\eta_\nu(\pi)$ if the one-line notation of $\pi$ contains $-1$.
We will prove the following theorem:
\begin{theorem}\label{delta thm}
The map $\eta_\delta$ is a surjective lattice homomorphism from $B_n$ to $S_{n+1}$.
Its fibers constitute the congruence generated by $s_0s_1s_0$ and $s_1s_0s_1$.
Furthermore, $\eta_\delta$ is the unique surjective lattice homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1}}$ agrees with $\eta_\delta$.
\end{theorem}
Theorem~\ref{delta thm} implies in particular that the lattice homomorphism associated to the congruence of Example~\ref{miraculous} is the $n=3$ case of $\eta_\delta$.
Suppose $\pi\lessdot \tau$ in $B_n$.
First, suppose that $1$ is an entry in the one-line notation of both $\pi$ and $\tau$.
If $\pi$ and $\tau$ agree except in the sign of the first entry, then $\eta_\delta(\pi)\neq\eta_\delta(\tau)$.
If they agree except that two adjacent entries of $\pi$ are transposed in $\tau$, then $\eta_\delta(\pi)=\eta_\delta(\tau)$ if and only if the two adjacent entries have opposite signs.
Next, suppose that $-1$ is an entry in the one-line notation of both $\pi$ and $\tau$.
If $\pi$ and $\tau$ agree except in the sign of the first entry, then since $-1$ is an entry in the one-line notation of both $\pi$ and $\tau$, we must have $\pi_1>1$, and therefore $\eta_\delta(\pi)=\eta_\delta(\tau)$.
If they agree except that two adjacent entries of $\pi$ are transposed in $\tau$, then $\eta_\nu(\pi)=\eta_\nu(\tau)$ if and only if the two transposed entries have opposite signs and neither is $-1$.
Finally, suppose $\pi$ has the entry $1$ in its one-line notation, but $\tau$ has $-1$.
Then $\pi_1=1$ and $\tau_1=-1$, and $\eta_\delta(\pi)\neq\eta_\delta(\tau)$.
Thus:
\begin{prop}\label{delta cover}
Suppose $\pi\lessdot \tau$ in the weak order on $B_n$, and let $t$ be the reflection associated to the cover $\pi\lessdot\tau$.
Then $\eta_\delta(\pi)=\eta_\delta(\tau)$ if and only if one of the following conditions holds:
\begin{enumerate}
\item[(i)] $t$ is $(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $2\le i<j\le n$.
\item[(ii)] $\pi$ has the entry $1$ in its one-line notation and $t$ is $(1\,\,-j)(j\,\,-1)$ for some $j$ with $1<j\le n$.
\item[(iii)] $\pi$ has the entry $-1$ in its one-line notation and $t$ is $(i\,\,-i)$ for some $i>1$.
\end{enumerate}
\end{prop}
As in the previous cases, we now show that the congruence generated by $s_0s_1s_0$ and $s_1s_0s_1$ has a description compatible with Proposition~\ref{delta cover}.
\begin{prop}\label{delta finest}
The congruence generated by $s_0s_1s_0$ and $s_1s_0s_1$ removes a shard $\Sigma$ if and only if one of the following conditions holds:
\begin{enumerate}
\item[(i)] $\Sigma$ is contained in a hyperplane $H_t$ such that $t$ is $(i\,\,-j)(j\,\,-i)$ for some $i$ and $j$ with $2\le i<j\le n$.
\item[(ii)] $\Sigma$ is below the hyperplane $H_{(1\,\,-1)}$ and $\Sigma$ is contained in a hyperplane $H_t$ such that $t$ is $(1\,\,-j)(j\,\,-1)$ for some $j$ with $1<j\le n$.
\item[(iii)] $\Sigma$ is above the hyperplane $H_{(1\,\,-1)}$ and $\Sigma$ is contained in a hyperplane $H_{(i\,\,-i)}$ for some $i>1$.
\end{enumerate}
\end{prop}
Before proving Proposition~\ref{delta finest}, we verify that conditions (ii) and (iii) make sense.
Specifically, in both conditions, we rule out the possibility that $\Sigma$ is neither above nor below $H_{(1\,\,-1)}$.
Note that if $1<j\le n$ and $t=(1\,\,-j)(j\,\,-1)$, then the rank-two subarrangement containing $H_{(1\,\,-1)}$ and $H_t$ has basic hyperplanes $H_{(1\,\,-1)}$ and $H_{t'}$, where $t'=(1\,\,j)(-j\,\,-1)$.
Thus every hyperplane $H_t$, for $t$ as in condition (ii), is cut at $H_{(1\,\,-1)}$, and thus every shard in $H_t$ is either above or below $H_{(1\,\,-1)}$.
Similarly, every shard in $H_t$, for $t$ as in condition (iii), is either above or below $H_{(1\,\,-1)}$.
\begin{proof}
Suppose $\Sigma$ is a shard in a hyperplane that is cut by $H_{(1\,\,-1)}$, so that $\Sigma$ is either above or below $H_{(1\,\,-1)}$.
Then $\Sigma$ is above $H_{(1\,\,-1)}$ if and only if its associated join-irreducible element $\gamma$ has $-1$ in its one-line notation.
This occurs if and only if $-1$ is contained in the signed subset representing $\gamma$.
The shards specified by conditions (i)--(iii) in Proposition~\ref{delta finest} correspond, via join-irreducible elements, to signed subsets $A$ described respectively by the following conditions:
\begin{enumerate}
\item[(i)] $A$ has $m<-1$, $M>1$ and $m\neq-M$.
\item[(ii)] $M=1$ and $m<-1$.
\item[(iii)] $-1\in A$ and $-M=m<-1$.
\end{enumerate}
For condition (ii), the condition is $(m,M)\in\set{(-1,j),(-j,1)}$ for some $1<j\le n$, and $-1\not\in A$.
However, the requirement that $-1\not\in A$ implies that $m\neq -1$, so $(m,M)=(-j,1)$, as indicated above.
Let $C$ be the set of signed subsets satisfying (i), (ii) or (iii).
We can describe $C$ more succinctly as the set of signed subsets satisfying both of the following conditions:
\begin{enumerate}
\item[(a)] $m<-1$, and
\item[(b)] If $m=-M$ then $-1\in A$.
\end{enumerate}
We now show that no set $A_1\in C$ arrows a set $A_2\not\in C$.
Let $A_1\in C$ and $A_2\not\in C$.
Suppose $m_2\ge-1$.
Then (q1) and (q6) fail, because each would include the impossible assertion that $M_1<-m_2$.
Also, (q2)--(q4) fail because $m_1<-1$.
Since $M_1>0$, if (q5) holds, then $m_2=-1$ and $M_1=1$.
If in addition (r2) holds, then the fact that $m_2=-1\in A_2\cap(m_1,M_1)$ implies that $-1\in -A_2^c\cap(m_1,M_1)=A_1\cap(m_1,M_1)$.
But having $-1\in A_1$ contradicts the fact that $M_1=1$, and this contradiction rules out the possibility that (q5) and (r2) both hold.
We have ruled out all six possibilities in Theorem~\ref{B shard} in the case where $m_2\ge-1$.
If $m_2<-1$, then since $A_2\not\in C$, we must have $m_2=-M_2$ and $-1\not\in A_2$.
In particular, (q3)--(q6) fail.
As above, (q2) fails because $m_1<-1$.
If (q1) holds, then $m_1=-M_1$, so since $A_1\in C$, we have $-1\in A_1$.
In particular, $M_1>1$, so (r1) fails because $-1\in A_1$ but $-1\not\in A_2$.
Next, we show that any set in $C$, except the sets $\set{-2,-1,3,4,\ldots,n}$ and $\set{-2,3,4,\ldots,n}$, is arrowed to by another set in $C$.
Let $A_2\in C$.
\noindent
\textbf{Case 1:} $m_2=-M_2$.
Then $-1\in A_2$ because $A_2\in C$.
We can rule out the possibility that $m_2=-2$, because in this case, $A_2=\set{-2,-1,3,4,\ldots,n}$.
Let $A_1$ be $\set{-2,-1,3,4,\ldots,n}$, which is in $C$.
Then (q1) and (r1) hold, so $A_1\to A_2$.
\noindent
\textbf{Case 2:} $m_2<-M_2$.
Since $A_2\in C$, $m_2<-1$.
If $m_2=-2$, then $M_2=-1$ and $A_2=\set{-2,3,4,\ldots,n}$, which is ruled out by hypothesis.
Thus $m_2<-2$.
\noindent
\textbf{Subcase 2a:} $[m_2+1,-2]\cap A_2\neq\emptyset$.
Let $A_1=(A_2\cup\set{-m_2})\setminus\set{m_2}$.
Then $A_1\in C$ and (q3), (f1\,:\,$m_1$), and (r1) hold, so $A_1\to A_2$.
\noindent
\textbf{Subcase 2b:} $[m_2+1,-2]\cap A_2=\emptyset$ and $m_2<-M_2-1$.
Let $A_1=(A_2\cup\set{m_2+1,-m_2})\setminus\set{m_2,-m_2-1}$.
Then $A_1\in C$ and (q3), (f2\,:\,$m_1$), and (r1) hold.
\noindent
\textbf{Subcase 2c:} $[m_2+1,-2]\cap A_2=\emptyset$ and $m_2=-M_2-1$.
Since $m_2<-2$, $M_2>1$.
If $|A_2|<n-1$, then let $A_1=A_2\cup\set{M_2}$.
Then $A_1\in C$ and (q4), (f2\,:\,$M_1$), and (r1) hold.
If $|A_2|=n-1$ and $-1\in A_2$, then let $A_1=(A_2\cup\set{-M_2,-m_2})\setminus\set{m_2}$.
Then $m_1=-M_2<-1$, and $M_1=M_2$.
Since $-1\in A_1$, $A_1\in C$.
Also, (q3), (f3\,:\,$m_1$), and (r1) hold, so $A_1\to A_2$.
If $|A_2|=n-1$ and $-1\not\in A_2$, then $A_2=(\set{1,2,\ldots,n}\cup\set{m_2})\setminus\set{-m_2-1,-m_2}$, recalling that $M_2=-m_2-1$.
Let $A_1=(A_2\cup\set{M_2})\setminus\set{M_2-1}$.
Then $A_1\in C$ and (q4), (f1\,:\,$M_1$), and (r1) hold.
\noindent
\textbf{Case 3:} $m_2>-M_2$.
\noindent
\textbf{Subcase 3a:} $m_2>-M_2+1$.
Let $A_1=(A_2\cup\set{M_2})\setminus\set{M_2-1}$.
The element $M_2-1$ may or may not be an element of $A_2$, but since $-M_2+1<m_2$, we know that $-M_2+1\not\in A_2$.
Thus $M_1=M_2-1$, and $m_1=m_2$.
In particular, $A_1\in C$ and, furthermore, (q4) and (r1) hold.
Also, either (f1\,:\,$M_1$) or (f2\,:\,$M_1$) holds.
\noindent
\textbf{Subcase 3b:} $m_2=-M_2+1$.
If either $|A_2|<n-1$ or $-1\in A_2$, then let $A_2=A_1\cup\set{M_2}$.
Then $A_2\in C$ and (q4) and (r1) hold.
If $|A_2|<n-1$, then (f2\,:\,$M_1$) holds, and otherwise (f3\,:\,$M_1$) holds.
Finally, if $|A_2|=n-1$ and $-1\not\in A_2$, then let $A_1=(-A_2^c\cap(m_2,-m_2))\cup\set{m_2}\cup\set{M_2,M_2+1,\ldots,n}$.
Then $|A_1|=n$, $m_1=m_2$, and $M_1=-m_2$.
Conditions (q5), (f3\,:\,$-m_1$) and (r2) hold and $A_1\in C$.
\end{proof}
Combining Propositions~\ref{delta cover} and~\ref{delta finest}, the fibers of $\eta_\delta$ are a lattice congruence $\Theta_\delta$ on $B_n$ satisfying the second assertion of Theorem~\ref{delta thm}.
We now show that $\eta_\delta$ is order-preserving, that $\eta_\delta$ restricts to a bijection from bottom elements of $\Theta_\delta$-classes to permutations in $S_{n+1}$ and that the inverse of the restriction is order-preserving.
To see that $\eta_\delta$ is order-preserving, suppose $\pi\lessdot\tau$ in $B_n$.
If $1$ is an entry in the one-line notation of both $\pi$ and $\tau$, then $\eta_\delta$ coincides with $\eta_\sigma$ on $\pi$ and $\tau$, so $\eta_\delta$ preserves the order relation $\pi\le\tau$.
Similarly, if $-1$ is an entry in the one-line notation of both $\pi$ and $\tau$, then $\eta_\delta$ preserves the order relation $\pi\le\tau$ because $\eta_\nu$ is order-preserving.
Finally, if $1$ is an entry in the one-line notation of $\pi$ and $-1$ is an entry in the one-line notation of $\tau$, then $\eta_\delta(\pi)$ and $\eta_\delta(\tau)$ both have $1$ and $2$ adjacent but in different orders.
Otherwise, the two permutations agree, and we see that $\eta_\delta(\pi)\lessdot\eta_\delta(\tau)$.
We have verified that $\eta_\delta$ is order-preserving.
Proposition~\ref{delta cover} leads to a characterization of the bottom elements of $\Theta_\delta$-classes.
A signed permutation $\pi$ whose one-line notation contains $1$ is a bottom element if and only if its one-line notation consists of a (possibly empty) sequence of negative entries followed by a sequence of positive entries (including $1$).
A signed permutation with $-1$ in its one-line notation is a bottom element if and only if it consists of a (possibly empty) sequence of positive entries, followed by a sequence of negative elements beginning with $-1$, and finally a (possibly empty) sequence of positive elements.
Notice that the bottom elements of $\Theta_\delta$ that have $1$ in their one-line notation map to permutations with $1$ preceding $2$, and the bottom elements of $\Theta_\delta$ that have $-1$ in their one-line notation map to permutations with $2$ preceding~$1$.
The inverse of the restriction of $\eta_\delta$ to bottom elements sends a permutation $\tau$ with $\tau_i=1$ and $\tau_j=2$, for $i<j$, to the signed permutation
\[(-\tau_{i-1}+1)(-\tau_{i-2}+1)\cdots(-\tau_1+1)(\tau_{i+1}-1)(\tau_{i+2}-1)\cdots(\tau_{n+1}-1).\]
The inverse of the restriction sends a permutation $\tau_1\cdots\tau_{n+1}$ with $\tau_i=2$ and $\tau_j=1$, for $i<j$, to the signed permutation
\[(\tau_{i+1}-1)\cdots(\tau_{j-1}-1)\,(-1)\,(-\tau_{i-1}+1)\cdots(-\tau_1+1)(\tau_{j+1}-1)\cdots(\tau_{n+1}-1).\]
It is now easily verified that the inverse is order-preserving.
The third assertion of Theorem~\ref{delta thm} follows as in the case of Theorem~\ref{simion thm}, and we have completed the proof of Theorem~\ref{delta thm}.
Now let $\eta_\epsilon:B_n\to S_{n+1}$ send $\pi\in B_n$ to the permutation obtained as follows:
If the one-line notation for $\pi$ contains the entry $1$, then extract the subsequence of $(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\pi_1\cdots\pi_{n-1}\pi_n$ consisting of values greater than or equal to $-1$, change $-1$ to $0$, then add $1$ to each entry.
If the one-line notation for $\pi$ contains the entry $-1$, then construct a sequence
\[(-\pi_n)(-\pi_{n-1})\cdots(-\pi_1)\,0\,\pi_1\cdots\pi_{n-1}\pi_n,\]
extract the subsequence consisting of nonnegative entries, and add $1$ to each entry.
Thus $\eta_\epsilon$ is a hybrid of $\eta_\sigma$ and $\eta_\nu$ in exactly the opposite way that $\eta_\delta$ is a hybrid: $\eta_\epsilon(\pi)=\eta_\nu(\pi)$ if the one-line notation of $\pi$ contains $1$ and $\eta_\epsilon(\pi)=\eta_\sigma(\pi)$ if the one-line notation of $\pi$ contains $-1$.
\begin{theorem}\label{ep thm}
The map $\eta_\epsilon$ is a surjective lattice homomorphism from $B_n$ to $S_{n+1}$.
Its fibers constitute the congruence generated by $s_0s_1$ and $s_1s_0$.
Furthermore, $\eta_\epsilon$ is the unique surjective lattice homomorphism from $B_n$ to $S_{n+1}$ whose restriction to $(B_n)_{\set{s_0,s_1}}$ agrees with $\eta_\epsilon$.
\end{theorem}
Fortunately, to prove Theorem~\ref{ep thm}, we can appeal to Theorem~\ref{delta thm} and Proposition~\ref{dual cong}, to avoid any more tedious arguments about shard arrows for type~$B_n$.
Let $\neg:B_n\to B_n$ be the map that sends a signed permutation $\pi_1\cdots\pi_n$ to $(-\pi_1)\cdots(-\pi_n)$.
Let $\operatorname{rev}:S_{n+1}\to S_{n+1}$ be the map sending a permutation $\tau_1\cdots\tau_{n+1}$ to $\tau_{n+1}\cdots\tau_1$.
The following proposition is easily verified.
\begin{prop}\label{delta ep dual}
The map $\eta_\epsilon$ sends a signed permutation $\pi$ to $\operatorname{rev}(\eta_\delta(\neg(\pi)))$.
\end{prop}
The maps $\operatorname{rev}$ and $\neg$ both send a group element $w$ to $ww_0$, where $w_0$ is the longest element of the corresponding Coxeter group (the element $(n+1)n\cdots1$ in $S_{n+1}$ or the element $(-1)\cdots(-n)$ in $B_n$).
The map $w\mapsto ww_0$ is an anti-automorphism of the weak order on any finite Coxeter group.
Thus the first assertion of Theorem~\ref{ep thm} follows from the first assertion of Theorem~\ref{delta thm}.
Furthermore, by Proposition~\ref{dual cong}, the second assertion of Theorem~\ref{ep thm} follows from the second assertion of Theorem~\ref{delta thm}, and the third assertion follows as usual.
\section{Homomorphisms from exceptional types}\label{exceptional sec}
In this section, we treat the remaining cases, where $(W,W')$ is $(F_4,A_4)$, $(H_3,A_3)$, $(H_3,B_3)$, $(H_4,A_4)$, or $(H_4,B_4)$.
In each case, the stated theorem proves
the first assertion of Theorem~\ref{existence}, while inspection of the proof establishes the second assertion of Theorem~\ref{existence} and completes the proof of Theorem~\ref{diagram uniqueness}.
\subsection*{Homomorphisms from type $F_4$}
Let $W$ be a Coxeter group of type $F_4$ and with $S=\set{p,q,r,s}$, $m(p,q)=3$, $m(q,r)=4$ and $m(r,s)=3$.
Figure~\ref{weakF4diagram} shows the order ideal in the weak order on $W$ that encodes these values of $m$.
This is comparable to Figure~\ref{weakB3diagram}.a, except that the square intervals that indicate where $m$ is $2$ (e.g. $m(p,r)=2$) are omitted.
\begin{figure}
\includegraphics{weakF4diagram.ps}
\caption{The Coxeter diagram of $F_4$ encoded as an order ideal}
\label{weakF4diagram}
\end{figure}
For $W'$ of type $A_4$ (i.e. $W'=S_5$), we identify $p,q,r,s$ with $s_1,s_2,s_3,s_4$ (in that order) to discuss homomorphisms fixing $S$ pointwise.
\begin{theorem}\label{F4 thm}
There are exactly four surjective lattice homomorphisms from $F_4$ to $A_4$ that fix $S$ pointwise:
For each choice of $\gamma_1\in\set{qr,qrq}$ and $\gamma_2\in\set{rq,rqr}$, there exists a unique such homomorphism whose associated congruence contracts $\gamma_1$ and $\gamma_2$.
\end{theorem}
\begin{proof}
Suppose $\eta:F_4\to A_4$ be a surjective homomorphism fixing $S$ pointwise.
By Proposition~\ref{diagram facts} and the discussion in Section~\ref{dihedral sec}, the congruence $\Theta$ on $F_4$ defined by the fibers of $\eta$ contracts exactly one of $qr$ and $qrq$ and exactly one of $rq$ and $rqr$.
In each of the four cases, we verify that there is a unique choice of $\eta$.
\noindent
\textbf{Case 1:}
\textit{$\Theta$ contracts $qr$ and $rq$.}
Computer calculations show that the quotient of $W$ modulo the congruence generated by $qr$ and $rq$ is isomorphic to the weak order on $A_4$.
Thus a unique $\eta$ exists in this case.
\noindent
\textbf{Case 2:}
\textit{$\Theta$ contracts $qrq$ and $rqr$.}
Computer calculations as in Case 1 (or combining Case 1 with Proposition~\ref{dual cong}) show that a unique $\eta$ exists.
\noindent
\textbf{Case 3:}
\textit{$\Theta$ contracts $qrq$ and $rq$.}
Proposition~\ref{diagram facts} implies that the restriction to $W_{\set{q,r,s}}$ is a surjective lattice homomorphism.
Thus Theorem~\ref{nonhom thm} implies that the restriction of $\eta$ to $W_{\set{q,r,s}}$ agrees with $\eta_\nu$.
In particular, in addition to the join-irreducible elements of $W_{\set{q,r,s}}$ contracted by the congruence generated by $qrq$ and $rq$, the congruence $\Theta$ contracts $rqrs$ and $srqrs$.
Computer calculations show that the quotient of $W$ modulo the congruence generated by $qrq$, $rq$, $rqrs$, and $srqrs$ is isomorphic to the weak order on $A_4$.
Thus a unique $\eta$ exists.
\noindent
\textbf{Case 4:}
\textit{$\Theta$ contracts $qr$ and $rqr$.}
By an argument/calculation analogous to Case~3 (or by Case 3 and the diagram automorphism of $F_4$), a unique $\eta$ exists.
The congruence $\Theta$ is generated by $qr$, $rqr$, $qrqp$, and $pqrqp$.
\end{proof}
We have dealt with the final crystallographic case, and thus proved the following existence and uniqueness theorem.
\begin{theorem}\label{existence uniqueness crys}
Let $(W,S)$ and $(W',S)$ be finite crystallographic Coxeter systems with $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
For each $r,s\in S$, fix a surjective homomorphism $\eta_\set{r,s}$ from $W_{\set{r,s}}$ to $W'_{\set{r,s}}$ with $\eta_\set{r,s}(r)=r$ and $\eta_\set{r,s}(s)=s$.
Then there is exactly one compressive homomorphism $\eta:W\to W'$ such that the restriction of $\eta$ to $W_{\set{r,s}}$ equals $\eta_\set{r,s}$ for each pair $r,s\in S$.
\end{theorem}
\subsection*{Homomorphisms from type $H_3$}
Now, let $W$ be a Coxeter group of type $H_3$ and with $S=\set{q,r,s}$, $m(q,r)=5$ and $m(r,s)=3$.
Identify $q,r,s$ with the generators $s_1,s_2,s_3$ of $A_3=S_4$.
\begin{theorem}\label{H3 A3 thm}
There are exactly nine surjective lattice homomorphisms from $H_3$ to $A_3$ that fix $S$ pointwise:
For each choice of distinct $\gamma_1,\gamma_2\in\set{qr,qrq,qrqr}$ and distinct $\gamma_3,\gamma_4\in\set{rq,rqr,rqrq}$, there exists a unique such homomorphism whose associated congruence contracts $\gamma_1$, $\gamma_2$, $\gamma_3$ and $\gamma_4$.
\end{theorem}
\begin{proof}
Suppose $\eta:H_3\to A_3$ is a surjective homomorphism, fixing $S$ pointwise, whose fibers define a congruence $\Theta$.
As in the proof of Theorem~\ref{F4 thm}, we consider the nine cases separately.
In each of Cases 1--6 below, computer calculations show that the quotient of $H_3$ modulo the congruence generated by the given join-irreducible elements is isomorphic to the weak order on $A_3$.
Thus in each of these cases, a unique $\eta$ exists.
\noindent
\textbf{Case 1:}
\textit{$\Theta$ contracts $qr$, $qrq$, $rq$, and $rqr$.}
\noindent
\textbf{Case 2:}
\textit{$\Theta$ contracts $qr$, $qrq$, $rq$, and $rqrq$.}
\noindent
\textbf{Case 3:}
\textit{$\Theta$ contracts $qr$, $qrq$, $rqr$, and $rqrq$.}
\noindent
\textbf{Case 4:}
\textit{$\Theta$ contracts $qr$, $qrqr$, $rq$, and $rqrq$.}
\noindent
\textbf{Case 5:}
\textit{$\Theta$ contracts $qr$, $qrqr$, $rqr$, and $rqrq$.}
\noindent
\textbf{Case 6:}
\textit{$\Theta$ contracts $qrq$, $qrqr$, $rqr$, and $rqrq$.}
\noindent
\textbf{Case 7:}
\textit{$\Theta$ contracts $qrq$, $qrqr$, $rq$, and $rqr$.}
In this case, the quotient of $H_3$ modulo the congruence $\Theta'$ generated by the given join-irreducible elements is a poset with 28 elements.
Inspection of $\operatorname{Irr}(\operatorname{Con}(H_3/\Theta'))$ reveals a unique way to contract additional join-irreducible elements so as to obtain $\operatorname{Irr}(\operatorname{Con}(A_3))$.
(Cf. Figure~\ref{IrrConB3 squashed fig} and the surrounding discussion in Section~\ref{nonhom sec}.)
The additional join-irreducible elements to be contracted are $rqrqsrq$ and $srqrqsrq$.
Computer calculations confirm that the quotient of $H_3$ modulo the congruence generated by $qrq$, $qrqr$, $rq$, $rqr$, $rqrqsrq$, and $srqrqsrq$ is indeed isomorphic to $A_3$, so there exists a unique $\eta$ in this case.
\noindent
\textbf{Case 8:}
\textit{$\Theta$ contracts $qr$, $qrqr$, $rq$, and $rqr$.}
Computer calculations show that the quotient of $H_3$ modulo the congruence generated by $qr$, $qrqr$, $rq$, $rqr$,
$rqrqsrqr$, and $srqrqsrqr$ is isomorphic to $A_3$.
As in Case 7, inspection of the poset of irreducibles of the congruence lattice of the quotient reveals that no other possibilities exist.
Thus $\eta$ exists and is unique in this case.
\noindent
\textbf{Case 9:}
\textit{$\Theta$ contracts $qrq$, $qrqr$, $rq$, and $rqrq$.}
The existence and uniqueness of $\eta$ follows from Case 7 and Proposition~\ref{dual cong}.
Alternately, the calculation can be made directly as in Cases 7--8, realizing $\Theta$ as the congruence generated by $qrq$, $qrqr$, $rq$, $rqrq$, $rqrs$, and $srqrs$.
\end{proof}
\begin{theorem}\label{H3 B3 thm}
There are exactly eight surjective lattice homomorphisms from $H_3$ to $B_3$:
There is no surjective lattice homomorphism $\eta:H_3\to B_3$ whose associated congruence contracts $qr$ and $rqrq$.
For every other choice of $\gamma_1\in\set{qr,qrq,qrqr}$ and $\gamma_2\in\set{rq,rqr,rqrq}$, there exists a unique such homomorphism whose associated congruence contracts $\gamma_1$ and $\gamma_2$.
\end{theorem}
\begin{proof}
Suppose $\eta:H_3\to B_3$ is a surjective homomorphism whose fibers define a congruence $\Theta$.
We again proceed by cases.
\noindent
\textbf{Case 1:}
\textit{$\Theta$ contracts $qrq$ and $rqr$.}
Computer calculations show that the quotient of $H_3$ modulo the congruence generated by $qrq$ and $rqr$ is isomorphic to the weak order on $B_3$.
Thus a unique $\eta$ exists.
\noindent
Case 1 is the only case in which $\Theta$ is homogeneous of degree $2$.
Cases 2--8 proceed just like Cases 7--9 in the proof of Theorem~\ref{H3 A3 thm}, except that ``inspection of the poset of irreducibles of the congruence lattice of the quotient'' is automated.
In each case, there exists a unique set of additional join-irreducibles required to generate $\Theta$, and these generators are given in parentheses.
Some of these cases can also be obtained from each other by Proposition~\ref{dual cong}.
\noindent
\textbf{Case 2:}
\textit{$\Theta$ contracts $qr$ and $rq$}
($qr$, $rq$, and $qrqsrqrs$).
\noindent
\textbf{Case 3:}
\textit{$\Theta$ contracts $qr$ and $rqr$}
($qr$, $rqr$, $qrqsrqrs$, $rqrqsrqrs$, and $srqrqsrqrs$).
\noindent
\textbf{Case 4:}
\textit{$\Theta$ contracts $qrq$ and $rq$}
($qrq$, $rq$, $qsrqrs$, $rqrqsr$, $srqrqsr$, $rqrs$, $qrqrs$, and $srqrs$).
\noindent
\textbf{Case 5:}
\textit{$\Theta$ contracts $qrq$ and $rqrq$}
($qrq$, $rqrq$, $qsrqrs$, $qrqrs$ and $rqsrqrs$).
\noindent
\textbf{Case 6:}
\textit{$\Theta$ contracts $qrqr$ and $rq$}
($qrqr$, $rq$, $qsrqrqsrqr$, $rqrqsrqr$, $qrqrqsrqr$, $srqrqsrqr$, $rqrqsr$, $srqrqsr$, $rqrs$, and $srqrs$).
\noindent
\textbf{Case 7:}
\textit{$\Theta$ contracts $qrqr$ and $rqr$}
($qrqr$, $rqr$, $srqrqsrqrs$, $qsrqrqsrqr$, $rqrqsrqr$, $qrqrqsrqr$, $srqrqsrqr$, and $rqrqsrqrs$).
\noindent
\textbf{Case 8:}
\textit{$\Theta$ contracts $qrqr$ and $rqrq$}
($qrqr$, $rqrq$, and $rqsrqrs$).
\noindent
\textbf{Case 9:}
\textit{$\Theta$ contracts $qr$ and $rqrq$.}
A computation shows that the quotient of $H_3$ modulo the congruence generated by $qr$ and $rqrq$ is not isomorphic to $B_3$.
Furthermore, this quotient has 48 elements, the same number as $B_3$.
Thus it is impossible to obtain $B_3$ by contracting additional join-irreducible elements.
\end{proof}
\subsection*{Homomorphisms from type $H_4$}
Finally, let $W$ be a Coxeter group of type $H_4$ and with $S=\set{q,r,s,t}$, $m(q,r)=5$, $m(r,s)=3$ and $m(s,t)=3$.
The classification of surjective homomorphisms from $H_4$ to $A_4$ and from $H_4$ to $B_4$ exactly follows the classification of surjective homomorphisms from $H_3$ to $A_3$ and from $H_3$ to $B_3$, as we now explain.
Let $\eta$ be any surjective homomorphism $\eta$ from $H_4$ to $A_4$ or $B_4$ with associated congruence $\Theta$.
By Proposition~\ref{diagram facts}, the restriction $\eta'$ of $\eta$ to the standard parabolic subgroup $W_{\set{q,r,s}}$ (of type $H_3$) is a homomorphism from $H_3$ to $A_3$ or $B_3$.
Thus $\eta'$ is described by Theorem~\ref{H3 A3 thm} or~\ref{H3 B3 thm}.
The congruence $\Theta'$ associated to $\eta'$ is the restriction of $\Theta$ to $W_{\set{q,r,s}}$.
The proofs of Theorems~\ref{H3 A3 thm} and~\ref{H3 B3 thm}, determine, for each surjective homomorphism, a set $\Gamma$ of join-irreducibles that generate the associated congruence.
Since $\Theta'$ agrees with $\Theta$ on $W_{\set{q,r,s}}$, the congruence associated to $\eta$ must also contract the join-irreducibles in $\Gamma$.
In each case, computer calculations show that the quotient of $H_4$ modulo the congruence generated by $\Gamma$ is isomorphic to $A_4$ or $B_4$.
This shows that for each surjective homomorphisms from $H_3$, there is a unique surjective homomorphisms from $H_4$.
Furthermore, Theorem~\ref{H3 B3 thm} and Proposition~\ref{diagram facts} imply that there is no surjective lattice homomorphism from $H_4$ to $B_4$ whose associated congruence contracts $qr$ and $rqrq$.
Thus we have the following theorems:
\begin{theorem}\label{H4 A4 thm}
There are exactly nine surjective lattice homomorphisms from $H_4$ to $A_4$ that fix $S$ pointwise:
For each choice of distinct $\gamma_1,\gamma_2\in\set{qr,qrq,qrqr}$ and distinct $\gamma_3,\gamma_4\in\set{rq,rqr,rqrq}$, there exists a unique such homomorphism whose associated congruence contracts $\gamma_1$, $\gamma_2$, $\gamma_3$ and $\gamma_4$.
\end{theorem}
\begin{theorem}\label{H4 B4 thm}
There are exactly eight surjective lattice homomorphisms from $H_4$ to $B_4$:
There is no surjective lattice homomorphism $\eta:H_4\to B_4$ whose associated congruence contracts $qr$ and $rqrq$.
For every other choice of $\gamma_1\in\set{qr,qrq,qrqr}$ and $\gamma_2\in\set{rq,rqr,rqrq}$, there exists a unique such homomorphism whose associated congruence contracts $\gamma_1$ and $\gamma_2$.
\end{theorem}
\section{Lattice homomorphisms between Cambrian lattices}\label{camb sec}
In this section, we show how the results of this paper on lattice homomorphisms between weak orders imply similar results on lattice homomorphisms between Cambrian lattices.
A \newword{Coxeter element} of a Coxeter group $W$ is an element $c$ that can be written in the form $s_1s_2\cdots s_n$, where $s_1,s_2,\ldots,s_n$ are the elements of $S$.
There may be several total orders $s_1,s_2,\ldots,s_n$ on $S$ whose product is $c$.
These differ only by commutations of commuting elements of $S$.
In particular, for every edge $r$---$s$ in the Coxeter diagram for $W$ (i.e.\ for every pair $r,s$ with $m(r,s)>2$), either $r$ precedes $s$ in every reduced word for $c$ or $s$ precedes $r$ in every reduced word for $c$.
We use the shorthand ``$r$ precedes $s$ in $c$'' or ``$s$ precedes $r$ in $c$'' for these possibilities.
The initial data defining a Cambrian lattice are a finite Coxeter group $W$ and a Coxeter element $c$.
The \newword{Cambrian congruence} is the homogeneous degree-$2$ congruence $\Theta_c$ on $W$ generated by the join-irreducible elements $\operatorname{alt}_k(s,r)$ for every pair $r,s\in S$ such that $r$ precedes $s$ in $c$ and every $k$ from $2$ to $m(r,s)-1$.
Here, as in Section~\ref{erase edge sec}, the notation $\operatorname{alt}_k(s,r)$ stands for the word with $k$ letters, starting with~$s$ and then alternating $r$, $s$, $r$, etc.
Equivalently, $\Theta_c$ is the finest congruence with $s\equiv\operatorname{alt}_{m(r,s)-1}(s,r)$ for every pair $r,s\in S$ such that $r$ precedes $s$ in $c$.
The quotient $W/\Theta_c$ is the \newword{Cambrian lattice}.
The Cambrian lattice is isomorphic to the subposet of $W$ induced by the bottom elements of $\Theta_c$-classes.
To distinguish between the two objects, we write $W/\Theta_c$ for the Cambrian lattice constructed as a quotient of $W$ and write $\operatorname{Camb}(W,c)$ for the Cambrian lattice constructed as the subposet of $c$ induced by bottom elements of $\Theta_c$-classes.
The key result of this section is the following theorem, which will allow us to completely classify surjective homomorphisms between Cambrian lattices, using the classification results on surjective homomorphisms between weak orders.
(These classification results are Theorems~\ref{camb para factor}, \ref{camb exist unique}, and~\ref{camb diagram}.)
\begin{theorem}\label{key camb}
Let $\eta:W\to W'$ be a surjective lattice homomorphism whose associated congruence $\Psi$ is generated by a set $\Gamma$ of join-irreducible elements.
Let $c=s_1s_2\cdots s_n$ be a Coxeter element of $W$ and let $c'=\eta(s_1)\eta(s_2)\cdots\eta(s_n)\in W'$.
Then the restriction of $\eta$ is a surjective lattice homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$.
The associated congruence is generated by $\Gamma\cap\operatorname{Camb}(W,c)$.
\end{theorem}
To understand Theorem~\ref{key camb} correctly, one should keep in mind that $\eta$ is a lattice homomorphism, not a group homomorphism, so that $c'$ need not be equal to $\eta(c)$.
(For example, in the case $n=2$ of Theorem~\ref{simion thm}, the lattice homomorphism $\eta_\sigma$ sends the Coxeter element $s_0s_1$ to $s_1$.)
The element $c'$ is a Coxeter element of $W'$ in light of Proposition~\ref{basic facts} and Theorem~\ref{para factor}.
Before assembling the tools necessary to prove Theorem~\ref{key camb}, we illustrate the theorem by extending Example~\ref{miraculous}.
\begin{example}\label{camb hom ex}
Recall that Figure~\ref{B3toA3} indicates a congruence $\Psi$ on $B_3$ such that the quotient $B_3/\Psi$ is isomorphic to $S_4$.
As mentioned just after Theorem~\ref{delta thm}, the corresponding surjective homomorphism is $\eta_\delta:B_3\to S_4$.
The congruence $\Psi$ is generated by $\Gamma=\set{s_0s_1s_0,s_1s_0s_1}$.
Let $c$ be the Coxeter element $s_0s_1s_2$ of $B_3$.
The congruence $\Theta_c$ on $B_3$ is generated by $\set{s_1s_0,s_1s_0s_1,s_2s_1}$, as illustrated in Figure~\ref{cambriandiagram}.a.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 3}\scalebox{.875}{\includegraphics{weakB3diagram.ps}}&&
\figpage{ps: 4}\scalebox{.875}{\includegraphics{weakB3diagram.ps}}\\
(a)&&(b)
\end{tabular}
\caption{a: Edge contractions that generate the $s_0s_1s_2$-Cambrian congruence on $B_3$.
b: Edge contractions that generate the $s_1s_2s_3$-Cambrian congruence on $S_4$.}
\label{cambriandiagram}
\end{figure}
Let $c'$ be the Coxeter element $s_1s_2s_3$ of $S_4$.
The Cambrian congruence $\Theta_{c'}$ on $S_4$ is generated by the set $\set{s_2s_1,s_3s_2}$, as illustrated in Figure~\ref{cambriandiagram}.b.
The set $\set{s_2s_1,s_3s_2}$ is obtained by applying $\eta_\delta$ to each element of $\set{s_1s_0,s_1s_0s_1,s_2s_1}$ that is not contracted by $\Psi$.
Figure~\ref{camb B3toA3 cong} shows the Cambrian congruence $\Theta_c$ on $B_3$ and the Cambrian congruence $\Theta_{c'}$ on $S_n$.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 3}\scalebox{.875}{\includegraphics{B3toA3.ps}}&&\figpage{ps: 4}\scalebox{.875}{\includegraphics{B3toA3.ps}}\\
(a)&&(b)
\end{tabular}
\caption{a: The Cambrian congruence $\Theta_c$ on $B_3$. b: The Cambrian congruence $\Theta_{c'}$ on $S_n$.}
\label{camb B3toA3 cong}
\end{figure}
Here, $S_4$ is represented, as in Figure~\ref{B3toA3}.b, as the subposet of $B_3$ induced by bottom elements of the congruence $\Psi$.
Figure~\ref{camb B3toA3} shows the Cambrian lattice $\operatorname{Camb}(B_3,c)$ and the Cambrian lattice $\operatorname{Camb}(S_4,c')$.
\begin{figure}
\begin{tabular}{ccc}
\figpage{ps: 5}\scalebox{.875}{\includegraphics{B3toA3.ps}}&&\figpage{ps: 6}\scalebox{.875}{\includegraphics{B3toA3.ps}}\\
(a)&&(b)
\end{tabular}
\caption{a: The Cambrian lattice $\operatorname{Camb}(B_3,c)\cong B_3/\Theta_c$. \qquad b: The Cambrian lattice $\operatorname{Camb}(S_4,c')\cong S_4/\Theta_{c'}$.}
\label{camb B3toA3}
\end{figure}
The shaded edges of $\operatorname{Camb}(B_3,c)$ indicate the congruence on $\operatorname{Camb}(B_3,c)$ whose quotient is $\operatorname{Camb}(S_4,c')$.
This congruence is generated by the join-irreducible element $s_1s_0s_1$, because $\Gamma\cap\operatorname{Camb}(W,c)=\set{s_0s_1s_0}$.
\end{example}
The proof of Theorem~\ref{key camb} depends on general lattice-theoretic results, but also on special properties of the subposet $\operatorname{Camb}(W,c)$ of $W$.
To explain these properties, we recall from ~\cite{sort_camb} the characterization of bottom elements of $\Theta_c$-classes as the $c$-sortable elements of $W$.
To define $c$-sortable elements, we fix a reduced word $s_1\cdots s_n$ for $c$ and construct, for any element $w\in W$, a canonical reduced word for $w$.
Write a half-infinite word $c^\infty=s_1\cdots s_n|s_1\cdots s_n|s_1\cdots s_n|\ldots$,
where the symbols ``$\,|\,$'' are dividers that mark the locations where the sequence $s_1\cdots s_n$ begins again.
Out of all subwords of $c^\infty$ that are reduced words for $w$, the \newword{$(s_1\cdots s_n)$-sorting word} for $w$ is the one that is lexicographically leftmost, as a sequence of positions in $c^\infty$.
For convenience, when we write $(s_1\cdots s_n)$-sorting words, we include the dividers that occur between letters in the lexicographically leftmost reduced subword.
Thus for example, if $W=S_4$, the $(s_1s_2s_3)$-sorting word for the longest element is $s_1s_2s_3|s_1s_2|s_1$, and the $(s_2s_1s_3)$-sorting word for the longest element is $s_2s_1s_3|s_2s_1s_3$.
Each $(s_1\cdots s_n)$-sorting word defines a sequence of subsets of $S$, by taking the elements between successive dividers, and this sequence depends only on $c$, not on $s_1\cdots s_n$.
An element $w$ is \newword{$c$-sortable} if this sequence of subsets is weakly decreasing.
The following is a combination of \cite[Theorems~1.1, 1.2, 1.4]{sort_camb}.
\begin{theorem}\label{sort_camb thm}
An element of $W$ is the bottom element of its $\Theta_c$-class if and only if it is $c$-sortable.
The $c$-sortable elements constitute a sublattice of the weak order.
\end{theorem}
In general, the set of bottom elements of a congruence is a join-sublattice but need not be a sublattice.
As a special case of a general lattice-theoretic result (found, for example, in \cite[Proposition~9-5.11]{regions9}), a $c$-sortable element $v$ represents a join-irreducible element of the Cambrian lattice $W/\Theta_c$ if and only if $v$ is join-irreducible as an element of $W$. The following simple lemma will be used in the proof of Theorem~\ref{key camb}.
\begin{lemma}\label{sort j*}
If $j$ is a $c$-sortable join-irreducible element and $j_*$ is the unique element covered by $j$, then $j_*$ is $c$-sortable.
\end{lemma}
\begin{proof}
If $c=s_1\cdots s_n$ and $a_1a_2\cdots a_k$ is the $(s_1\cdots s_n)$-sorting word for $j$, then $a_1a_2\cdots a_{k-1}$ is the $(s_1\cdots s_n)$-sorting word for a $c$-sortable element $x$ covered by~$j$.
But $j_*$ is the unique element covered by $j$, so $j_*=x$, which is $c$-sortable.
\end{proof}
We need one of the standard Isomorphism Theorems for lattices.
(See, for example, \cite[Theorem~9-5.22]{regions9}.)
This is easily proved directly, or follows as a special case of the same Isomorphism Theorem in universal algebra.
The notation $[x]_\Theta$ stands for the $\Theta$-class of $x$.
\begin{theorem}\label{3 isom}
Let $L$ be a finite lattice and let $\Theta$ and $\Psi$ be congruences on $L$ such that $\Psi$ refines $\Theta$.
Define a relation $\Theta/\Psi$ on $L/\Psi$ by setting $[x]_\Psi\equiv[y]_\Psi$ modulo $\Theta/\Psi$ if and only if $x\equiv y$ modulo $\Theta$.
Then $\Theta/\Psi$ is a congruence and the map $\beta:L/\Theta\to(L/\Psi)/(\Theta/\Psi)$ sending $[x]_\Theta$ to the set of $\Psi$-classes contained in $[x]_\Theta$ is an isomorphism.
The inverse isomorphism sends a $\Theta/\Psi$-class $C$ in $(L/\Psi)/(\Theta/\Psi)$ to the union of the $\Psi$-classes in $C$.
\end{theorem}
The following lemma will also be useful.
\begin{lemma}\label{Psi and tilde gen}
Let $L$ be a finite lattice and let $\Gamma$ and $\tilde\Gamma$ be sets of join-irreducible elements in $L$.
Let $\Psi$ be the congruence on $L$ generated by $\Gamma$ and let $I$ be the set of join-irreducible elements contracted by $\Psi$.
Define $\tilde\Psi$ and $\tilde{I}$ similarly.
Then the congruence $(\Psi\vee\tilde\Psi)/\Psi$ on $L/\Psi$ is generated by the set $\set{[j]_{\Psi}:j\in \tilde\Gamma\setminus I}$ of join-irreducible elements of $L/\Psi$.
\end{lemma}
\begin{proof}
Identifying join-irreducible elements of $L$ with join-irreducible congruences as before, the sets $I$ and $\tilde{I}$ are the ideals that $\Gamma$ and $\tilde\Gamma$ generate in $\operatorname{Irr}(\operatorname{Con}(L))$.
The join-irreducible elements in the quotient $L/\Psi$ are exactly the elements $[j]_{\Psi}$ where $j\in(\operatorname{Irr}(L)\setminus I)$.
Since the set of join-irreducible elements contracted by $\Psi\vee\tilde\Psi$ is $I\cup \tilde{I}$, each $[j]_{\Psi}$ is contracted by the congruence $(\Psi\vee\tilde\Psi)/\Psi$ if and only if $j$ is in~$\tilde{I}$.
Furthermore, a join-irreducible element $j\in(\operatorname{Irr}(L)\setminus I)$ is in $\tilde{I}$ if and only if it is below some element of $\tilde\Gamma\setminus I$.
We see that $(\Psi\vee\tilde\Psi)/\Psi$ is the congruence on $L/\Psi$ generated by the set $\set{[j]_{\Psi}:j\in \tilde\Gamma\setminus I}$.
\end{proof}
We now prove our key theorem.
\begin{proof}[Proof of Theorem~\ref{key camb}]
The quotient $W/\Psi$ is isomorphic to $W'$.
Let $I$ be the set of join-irreducible elements contracted by $\Psi$.
Let $\tilde\Gamma$ be the generating set that was used to define the Cambrian congruence $\Theta_c$.
By Lemma~\ref{Psi and tilde gen}, the set $\set{[j]_{\Psi}:j\in \tilde\Gamma\setminus I}$ generates the congruence $(\Psi\vee\Theta_c)/\Psi$ on $W/\Psi\cong W'$.
This congruence corresponds to the Cambrian congruence $\Theta_{c'}$ on $W'$, so $\operatorname{Camb}(W',c')$ is isomorphic to $(W/\Psi)/[(\Psi\vee\Theta_c)/\Psi]$, which, by Theorem~\ref{3 isom}, is isomorphic to $W/(\Phi\vee\Theta_c)$.
Also by Theorem~\ref{3 isom}, $W/(\Phi\vee\Theta_c)$ is isomorphic to $(W/\Theta_c)/[(\Phi\vee\Theta_c)/\Theta_c]$, and Lemma~\ref{Psi and tilde gen} says that $(\Phi\vee\Theta_c)/\Theta_c$ is generated by $\set{[j]_{\Theta_c}:j\in(\Gamma\cap\operatorname{Camb}(W,c))}$.
In particular, there is a surjective homomorphism from $W/\Theta_c$ to $W/(\Psi\vee\Theta_c)$ whose associated congruence is generated by $\set{[j]_{\Theta_c}:j\in(\Gamma\cap\operatorname{Camb}(W,c))}$.
Since $x\mapsto[x]_{\Theta_c}$ is an isomorphism from $\operatorname{Camb}(W,c)$ to $W/\Theta_c$, and since $W/(\Psi\vee\Theta_c)$ is isomorphic to $\operatorname{Camb}(W',c')$, we conclude that there is a surjective homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ whose associated congruence is generated by $\Gamma\cap\operatorname{Camb}(W,c)$.
We will show that this homomorphism is the restriction of $\eta$.
If $x\in\operatorname{Camb}(W',c')$, then $x$ is the bottom element of $[x]_{\Theta_{c'}}$.
Thus $\eta^{-1}(x)$ is a $\Psi$-class in $W$ containing the bottom element $y$ of a $(\Psi\vee\Theta_c)$-class.
In particular, $y$ is the bottom element of $[y]_{\Theta_c}$, or in other words $y\in\operatorname{Camb}(W,c)$.
Since $\eta(y)=x$, we have shown that $\operatorname{Camb}(W',c')\subseteq\eta(\operatorname{Camb}(W,c))$.
Since $\operatorname{Camb}(W,c)$ is a sublattice of $W$ and $\eta$ is a homomorphism, $\eta(\operatorname{Camb}(W,c))$ is a sublattice of $W'$, and the restriction of $\eta$ to $\operatorname{Camb}(W,c)$ is a lattice homomorphism from $\operatorname{Camb}(W,c)$ to $\eta(\operatorname{Camb}(W,c))$.
Let $j\in\Gamma\cap\operatorname{Camb}(W,c)$.
Then because $j\in\Gamma$, $\eta$ contracts $j$, or in other words $\eta(j)=\eta(j_*)$, where $j_*$ is the unique element of $W$ covered by $j$.
By Lemma~\ref{sort j*}, the element $j_*$ is also in $\operatorname{Camb}(W,c)$, so $j_*$ is also the unique element of $\operatorname{Camb}(W,c)$ covered by $j$.
Thus the restriction of $\eta$ to $\operatorname{Camb}(W,c)$ also contracts $j$ in $\operatorname{Camb}(W,c)$.
Since there exists a surjective lattice homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ whose associated congruence is generated by $\Gamma\cap\operatorname{Camb}(W,c)$, the image of the restriction of $\eta$ can be no larger than $\operatorname{Camb}(W',c')$, and we conclude that $\eta(\operatorname{Camb}(W,c))=\operatorname{Camb}(W,c)$.
We have shown that the restriction of $\eta$ is a surjective homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ whose associated congruence is generated by $\Gamma\cap\operatorname{Camb}(W,c)$.
\end{proof}
With Theorem~\ref{key camb} in hand, we prove several facts that together constitute a detailed classification of surjective homomorphisms between Cambrian lattices.
An \newword{oriented Coxeter diagram} is a directed graph (with labels on some edges) defined by choosing an orientation of each edge in a Coxeter diagram.
Orientations of the Coxeter diagram of a finite Coxeter group $W$ are in bijection with Coxeter elements of $W$.
There is disagreement in the literature about the convention for this bijection.
The definition of Cambrian lattices given here agrees with the definition in~\cite{cambrian} if we take the following convention, which also agrees with the convention of \cite{sortable,sort_camb}:
To obtain a Coxeter element from an oriented diagram, we require, for each directed edge $s\to t$, that $s$ precedes $t$ in every expression for $c$.
However, the opposite convention is also common.
An \newword{oriented diagram homomorphism} starts with the oriented Coxeter diagram encoding a Coxeter system $(W,S)$ and a choice of Coxeter element $c$, then deletes vertices, decreases labels on directed edges, and/or erases directed edges, and relabels the vertices to obtain the oriented Coxeter diagram of some Coxeter system $(W',S')$ and choice $c'$ of Coxeter element.
We prove the following result and several more detailed results.
\begin{theorem}\label{main camb}
Given a finite Coxeter system $(W,S)$ with a choice $c$ of Coxeter element and another Coxeter system $(W',S')$ with a choice $c'$ of Coxeter element, there exists a surjective lattice homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ if and only if there exists an oriented diagram homomorphism from the oriented diagram for $(W,S)$ and $c$ to the oriented diagram for $(W',S')$ and $c'$.
\end{theorem}
The proof of Theorem~\ref{main camb} begins with a factorization result analogous to Theorem~\ref{para factor}.
Given $J\subseteq S$ and a Coxeter element $c$ of $W$, the \newword{restriction of $c$ to $W_J$} is the Coxeter element $\tilde c$ of $W_J$ obtained by deleting the letters in $S\setminus J$ from a reduced word for $c$.
(Typically, the restriction is not equal to $c_J$.)
Recall from Section~\ref{delete vert sec} the definition of the parabolic homomorphism $\eta_J$.
Recall from Section~\ref{intro} that a compressive homomorphism is a surjective homomorphism that restricts to a bijection between sets of atoms.
For Cambrian lattices, this is a surjective lattice homomorphism $\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ that restricts to a bijection between $S$ and $S'$.
\begin{theorem}\label{camb para factor}
Suppose $(W,S)$ and $(W',S')$ are finite Coxeter systems and $c$ and $c'$ are Coxeter elements of $W$ and $W'$.
Suppose $\eta:\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ is a surjective lattice homomorphism and let $J\subseteq S$ be $\set{s\in S:\eta(s)\neq 1'}$.
Then $\eta$ factors as $\eta|_{\operatorname{Camb}(W_J,\tilde{c})}\circ(\eta_J)|_{\operatorname{Camb}(W,c)}$, where $\tilde{c}$ is the restriction of $c$ to $W_J$.
The map $\eta|_{\operatorname{Camb}(W_J,\tilde{c})}$ is a compressive homomorphism.
\end{theorem}
As was the case for the weak order, the task is to understand compressive homomorphisms between Cambrian lattices.
The following proposition is proved below as a special case of part of Proposition~\ref{camb basic facts}.
Together with Theorem~\ref{camb para factor}, it implies that every surjective lattice homomorphism between Cambrian lattices determines an oriented diagram homomorphism.
\begin{prop}\label{oriented}
Suppose $\eta:\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ is a compressive homomorphism.
Then $m'(\eta(r),\eta(s))\le m(r,s)$ for each pair $r,s\in S$.
Also, if $s_1\cdots s_n$ is a reduced word for $c$, then $c'=\eta(s_1)\cdots\eta(s_n)$.
\end{prop}
As we did for the weak order, in studying compressive homomorphisms between Cambrian lattices, we may as well take $S'=S$ and let $\eta$ fix each element of $S$.
We will prove the following characterization of compressive homomorphisms.
\begin{theorem}\label{camb exist unique}
Suppose $(W,S)$ and $(W',S)$ are finite Coxeter systems and suppose that $m'(r,s)\le m(r,s)$ for each pair $r,s\in S$.
Given a Coxeter element $c$ of $W$ with reduced word $s_1\cdots s_n$, let $c'$ be the element of $W'$ with reduced word $s_1\cdots s_n$.
Let $\tilde\Gamma$ be a set of join-irreducible elements obtained by choosing, for each $r,s\in S$ with $m'(r,s)<m(r,s)$ such that $r$ precedes $s$ in $c$, exactly $m(r,s)-m(r,s)$ join-irreducible elements in $\set{\operatorname{alt}_k(r,s):k=2,3,\ldots,m(r,s)-1}$.
\begin{enumerate}
\item \label{exist unique tildeGamma}
There exists a unique homomorphism $\eta:\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ that is compressive and fixes $S$ pointwise and whose associated congruence $\Theta$ contracts all of elements of~$\tilde\Gamma$.
\item \label{generated}
$\Theta$ is generated by $\tilde\Gamma$.
\item \label{every arises}
Every compressive homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ that fixes $S$ pointwise arises in this manner, for some choice of $\tilde\Gamma$.
\end{enumerate}
\end{theorem}
Theorem~\ref{key camb} implies that, given any compressive homomorphism $\tilde\eta:W\to W'$, there is a choice of $\tilde\Gamma$ in Theorem~\ref{camb exist unique} such that every element of $\tilde\Gamma$ is contracted by the congruence associated to $\tilde\eta$.
The homomorphism $\eta$ thus arising from Theorem~\ref{camb exist unique} is the restriction of $\tilde\eta$.
The following theorem is a form of converse to these statements.
\begin{theorem}\label{camb diagram}
Suppose $(W,S)$ and $(W',S)$ are finite Coxeter systems and suppose that $\eta:\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ is an compressive homomorphism.
\begin{enumerate}
\item \label{exists diagram}
There exists a compressive homomorphism from $W$ to $W'$ whose restriction to $\operatorname{Camb}(W,c)$ is $\eta$.
\item \label{any diagram}
Let $\tilde\Gamma$ be the set of join-irreducible elements that generates the congruence associated to $\eta$.
Given a compressive homomorphism $\tilde\eta:W\to W'$ such that all elements of $\tilde\Gamma$ are contracted by the congruence associated to $\tilde\eta$, the restriction of $\tilde\eta$ to $\operatorname{Camb}(W,c)$ is $\eta$.
\end{enumerate}
\end{theorem}
We begin our proof of these classification results by pointing out some basic facts on surjective homomorphisms between Cambrian lattices, in analogy with Proposition~\ref{basic facts}.
Proposition~\ref{oriented} is a special case of (5) and (6) in the following proposition.
\begin{prop}\label{camb basic facts}
Let $\eta:\operatorname{Camb}(W,c)\to \operatorname{Camb}(W',c')$ be a surjective lattice homomorphism.
Then
\begin{enumerate}
\item $\eta(1)=1'$.
\item $S'\subseteq\eta(S)\subseteq (S'\cup\set{1'})$.
\item If $r$ and $s$ are distinct elements of $S$ with $\eta(r)=\eta(s)$, then $\eta(r)=\eta(s)=1'$.
\item \label{restrict camb}
If $J\subseteq S$, then $\eta$ restricts to a surjective homomorphism $\operatorname{Camb}(W_J,\tilde{c})\to\operatorname{Camb}(W'_{\eta(J)\setminus\set{1'}},\tilde{c}')$, where $\tilde{c}$ is the restriction of $c$ to $W_J$ and $\tilde{c}'$ is the restriction of $c'$ to $W'_{\eta(J)\setminus\set{1'}}$.
\item $m'(\eta(r),\eta(s))\le m(r,s)$ for each pair $r,s\in S$ with $\eta(r)\neq1'$ and $\eta(s)\neq1'$.
\item \label{c' eta}
If $s_1s_2\cdots s_n$ is a reduced word for $c$, then $c'=\eta(s_1)\eta(s_2)\cdots\eta(s_n)$.
\end{enumerate}
\end{prop}
\begin{proof}
The proof of Proposition~\ref{basic facts} can be repeated verbatim to prove all of the assertions except~\eqref{c' eta}.
The latter is equivalent to the statement that $\eta(r)$ precedes $\eta(s)$ if and only if $r$ precedes $s$, whenever $r,s\in S$ have $\eta(r)\neq1'$ and $\eta(s)\neq1'$.
This statement follows immediately from~\eqref{restrict camb} with $J=\set{r,s}$.
\end{proof}
Taking $\eta=\eta_J$ and $\Gamma=S\setminus J$ in Theorem~\ref{key camb}, we have the following analog of Theorem~\ref{para cong} for Cambrian lattices:
\begin{theorem}\label{camb para cong}
Let~$c$ be a Coxeter element of~$W,$ let $J\subseteq S$ and let~$\tilde c$ be the Coxeter element of~$W_J$ obtained by restriction.
Then $\eta_J$ restricts to a surjective lattice homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W_J,\tilde c)$.
The associated lattice congruence on $\operatorname{Camb}(W,c)$ is generated by the set $S\setminus J$ of join-irreducible elements.
\end{theorem}
To prove Theorem~\ref{camb para factor}, the proof of Theorem~\ref{para factor} can be repeated verbatim, with Proposition~\ref{camb basic facts} replacing Proposition~\ref{basic facts} and Theorem~\ref{camb para cong} replacing Theorem~\ref{para cong}.
We prove Theorems~\ref{camb exist unique} and~\ref{camb diagram} together.
\begin{proof}[Proof of Theorems~\ref{camb exist unique} and~\ref{camb diagram}]
We first claim that there is a compressive homomorphism $\tilde\eta:W\to W'$ fixing $S$ and a generating set $\Gamma$ for the associated congruence such that $\tilde\Gamma=\Gamma\cap\operatorname{Camb}(W,c)$.
Arguing as in previous sections, Theorems~\ref{edge factor} and~\ref{edge cong ji} reduce the proof of the claim to the case where $W$ and $W'$ are irreducible and their diagrams coincide except for edge labels.
Looking through the type-by-type results of Sections~\ref{dihedral sec}--\ref{exceptional sec}, we see that in almost every case, the claim is true for a simple reason:
For each choice of $\tilde\Gamma$, there is a surjective homomorphism from $W$ to $W'$ whose associated congruence is homogeneous of degree $2$, with a generating set that includes $\tilde\Gamma$.
The only exceptions come when $(W,W')$ is $(H_3,B_3)$ or $(H_4,B_4)$ and one of the following cases applies:
\noindent
\textbf{Case 1:} $q$ precedes $r$ and $\tilde\Gamma=\set{qr}$.
In this case, in light of Case 2 of the proof of Theorem~\ref{H3 B3 thm}, we need to verify that $qrqsrqrs\in H_3$ is not $qrs$-sortable and not $qsr$-sortable.
But $qrqsrqrs$ has only one other reduced word, $qrsqrqrs$, so its $qrs$-sorting word is $qrs|qr|qrs$, and thus it is not $qrs$-sortable.
Similarly, the $qsr$-sorting word for $qrqsrqrs$ is $qr|qsr|qr|s$, so it is not $qsr$-sortable.
The claim is proved in this case for $(W,W')=(H_3,B_3)$.
We easily conclude that $qrqsrqrs$ is not $qrst$-sortable, $qrts$-sortable, $qstr$-sortable or $qtsr$-sortable as an element of $H_4$ (cf. \cite[Lemma~2.3]{sort_camb}), so the claim is proved in this case for $(W,W')=(H_4,B_4)$ as well.
\noindent
\textbf{Case 2:} $r$ precedes $q$ and $\tilde\Gamma=\set{rq}$.
Arguing similarly to Case 1, it is enough to show that $qrqsrqrs$ is not $rqs$-sortable and not $srq$-sortable as an element of $H_3$.
This is true because its $rqs$-sorting word is $q|rqs|rq|rs$ and its $srq$-sorting word is $q|rq|srq|r|s$.
\noindent
\textbf{Case 3:} $q$ precedes $r$ and $\tilde\Gamma=\set{qrqr}$.
In light of Case 8 of the proof of Theorem~\ref{H3 B3 thm}, we need to verify that $rqsrqrs\in H_3$ is not $qrs$-sortable and not $qsr$-sortable.
This is true because its $qrs$-sorting word is $rs|qr|qrs$ and its $sqr$-sorting word is $r|sqr|qr|s$.
\noindent
\textbf{Case 4:} $r$ precedes $q$ and $\tilde\Gamma=\set{rqrq}$.
The $sqr$-sorting word for $rqsrqrs$ is $r|sqr|qr|s$, and the $srq$-sorting word for $rqsrqrs$ is $rq|srq|r|s$, so $rqsrqrs$ is neither $rqs$-sortable nor $srq$-sortable.
As in Case 3, this is enough.
This completes the proof of the claim.
Now Theorem~\ref{key camb} says that the restriction $\eta$ of $\tilde\eta$ is a compressive homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$, whose associated congruence $\Theta$ is generated by $\tilde\Gamma$.
But then $\eta$ is the unique homomorphism from $\operatorname{Camb}(W,c)$ to $\operatorname{Camb}(W',c')$ whose congruence contracts $\tilde\Gamma$:
Any other congruence contracting $\tilde\Gamma$ is associated to a strictly coarser congruence, and thus the number of congruence classes is strictly less than $|\operatorname{Camb}(W',c')|$.
We have proved Theorem~\ref{camb exist unique}\eqref{exist unique tildeGamma}, Theorem~\ref{camb exist unique}\eqref{generated}, and Theorem~\ref{camb diagram}\eqref{exists diagram}.
Now let $\eta:\operatorname{Camb}(W,c)\to\operatorname{Camb}(W',c')$ be any surjective lattice homomorphism.
Theorem~\ref{camb basic facts}\eqref{restrict camb} and Theorem~\ref{camb basic facts}\eqref{c' eta} imply that, for each $r,s\in S$ with $m'(r,s)<m(r,s)$ such that $r$ precedes $s$ in $c$, the congruence associated to $\eta$ contracts exactly $m(r,s)-m'(r,s)$ join-irreducible elements of the form $\operatorname{alt}_k(r,s)$ with $k=2,\ldots,m(r,s)-1$.
Theorem~\ref{camb exist unique}\eqref{every arises} follows by the uniqueness in Theorem~\ref{camb exist unique}\eqref{exist unique tildeGamma}.
Finally, we prove Theorem~\ref{camb diagram}\eqref{any diagram}.
Given any $\tilde\eta$, let $\Gamma$ be a minimal generating set for the associated congruence.
Theorem~\ref{key camb} says that the restriction of $\eta$ to $\operatorname{Camb}(W,c)$ is a surjective homomorphism to $\operatorname{Camb}(W',c')$, and the associated congruence is generated by the $\Gamma\cap\operatorname{Camb}(W,c)$.
But by the uniqueness in Theorem~\ref{camb exist unique}\eqref{exist unique tildeGamma} and by Theorem~\ref{camb exist unique}\eqref{generated}, the restriction of $\tilde\eta$ to $\operatorname{Camb}(W,c)$ is~$\eta$.
\end{proof}
\section{Refinement relations among Cambrian fans}\label{crys case}
Given a finite crystallographic Coxeter group $W$ with Coxeter arrangement $\mathcal{A}$, an associated Cartan matrix $A$, and a Coxeter element $c$ of $W$, the \newword{Cambrian fan} for $(A,c)$ is the fan defined by the shards of $\mathcal{A}$ not removed by the Cambrian congruence $\Theta_c$.
In this section, we prove Theorem~\ref{camb fan coarsen}, which gives explicit refinement relations among Cambrian fans.
We assume the most basic background about Cartan matrices of finite type and the associated finite root systems.
Recall from the introduction that a Cartan matrix $A=[a_{ij}]$ \newword{dominates} a Cartan matrix $\mathcal{A}'=[a'_{ij}]$ if $|a_{ij}|\ge |a'_{ij}|$ for all $i$ and~$j$.
Recall also that Proposition~\ref{dom subroot} says that when $A$ dominates $A'$, $\Phi(A)\supseteq\Phi(A')$ and $\Phi_+(A)\supseteq\Phi_+(A')$, assuming that $\Phi(A)$ and $\Phi(A')$ are both defined with respect to the same simple roots $\alpha_i$.
We again emphasize that $\Phi(A)$ includes any imaginary roots.
The proposition appears as \cite[Lemma~3.5]{Marquis}, but for completeness, we give a proof here.
\begin{proof}[Proof of Proposition~\ref{dom subroot}]
To construct a Kac-Moody Lie algebra from a symmetrizable Cartan matrix $A$, as explained in \cite[Chapter~1]{Kac}, one first defines an auxiliary Lie algebra $\tilde{\mathfrak{g}}(A)$ using generators and relations.
The Lie algebra $\tilde{\mathfrak{g}}(A)$ decomposes as a direct sum $\mathfrak{n}_-\oplus\mathfrak{h}\oplus\mathfrak{n}_+$ \emph{of complex vector spaces}.
We won't need details on $\mathfrak{h}$ here, but its dual contains linearly independent vectors $\alpha_1,\ldots,\alpha_n$ called the \newword{simple roots}.
The summand $\mathfrak{n}_+$ decomposes further as a (\emph{vector space}) direct sum with infinitely many summands $\tilde{\mathfrak{g}}_\alpha$, indexed by nonzero vectors $\alpha$ in the nonnegative integer span $Q_+$ of the simple roots.
Similarly, $\mathfrak{n}_-$ decomposes into summands indexed by nonzero vectors in the nonpositive integer span of the simple roots.
Furthermore, $\mathfrak{n}_+$ is freely generated by elements $e_1,\ldots,e_n$ and thus is independent of the choice of $A$ (as long as $A$ is $n\times n$).
Similarly, $\mathfrak{n}_-$ is freely generated by elements $f_1,\ldots,f_n$ and is independent of the choice of $A$.
There is a unique largest ideal $\mathfrak{r}$ of $\tilde{\mathfrak{g}}(A)$ whose intersection with $\mathfrak{h}$ is trivial, and this is a direct sum $\mathfrak{r}_-\oplus\mathfrak{r}_+$ \emph{of ideals} with $\mathfrak{r}_\pm=\mathfrak{r}\cap\mathfrak{n}_\pm$.
The \newword{Kac-Moody Lie algebra} $\mathfrak{g}(A)$ is defined to by $\tilde{\mathfrak{g}}(A)/\mathfrak{r}$.
The Lie algebra $\mathfrak{g}(A)$ inherits a direct sum decomposition $\mathfrak{n}_-\oplus\mathfrak{h}\oplus\mathfrak{n}_+$, and the summands $\mathfrak{n}_\pm$ decompose further as
\[\mathfrak{n}_-=\bigoplus_{0\neq\alpha\in Q_+}\mathfrak{g}_{-\alpha}\qquad\text{and}\qquad \mathfrak{n}_+=\bigoplus_{0\neq\alpha\in Q_+}\mathfrak{g}_\alpha.\]
A \newword{root} is a nonzero vector $\alpha$ in $Q_+\cup(-Q_+)$ such that $\mathfrak{g}_\alpha\neq0$.
The \newword{(Kac-Moody) root system} associated to $A$ is the set of all roots.
While $\mathfrak{n}_-$ and $\mathfrak{n}_+$ are independent of the choice of $A$, the ideal $\mathfrak{r}$ depends on $A$ (in a way that is not apparent here because we have not given the presentation of $\tilde{\mathfrak{g}}(A)$).
Thus, writing $\mathfrak{r}(A)$ for the ideal associated to $A$, Proposition~\ref{dom subroot} follows immediately from this claim:
If $A$ and $A'$ are Cartan matrices such that $A$ dominates~$A'$, then $\mathfrak{r}(A)\subseteq\mathfrak{r}(A')$.
This claim follows immediately from a description of the ideal $\mathfrak{r}$ in terms of the \newword{Serre relations}.
Recall that for $x$ in a Lie algebra $\mathfrak{g}$, the linear map $\operatorname{ad}_x:\mathfrak{g}\to\mathfrak{g}$ is $y\mapsto[x,y]$.
In \cite[Theorem~9.11]{Kac}, it is proved that the ideal $\mathfrak{r}_+$ is generated by $\set{(\operatorname{ad}_{e_i})^{1-a_{ij}}(e_j):i\neq j}$ and that $\mathfrak{r}_+$ is generated by $\set{(\operatorname{ad}_{f_i})^{1-a_{ij}}(f_j):i\neq j}$.
\end{proof}
Although we have proved Proposition~\ref{dom subroot} in full generality, we pause to record the following proof due to Hugh Thomas (personal communication, 2018) in the case where $A$ is symmetric.
\begin{proof}[Quiver-theoretic proof of Proposition~\ref{dom subroot} for $A$ symmetric]
Suppose $Q$ is a quiver $Q$ without loops (i.e.\ $1$-cycles) with $n$ vertices, suppose $v\in\mathbb Z^n$, and fix an algebraically closed field.
We associate a symmetric Cartan matrix $A$ to $Q$ by ignoring the direction of edges and taking $a_{ij}$ to be the total number of edges connecting vertex $i$ to vertex $j$.
Kac \cite[Theorem~3]{Kac1980} (generalizing Gabriel's Theorem) proved that $v$ is the dimension vector of an indecomposable representation of $Q$ if and only if $v$ is the simple-root coordinate of a positive root in the root system $\Phi(A)$.
Given symmetric Cartan matrices $A$ and $A'$ with $A$ dominating $A'$, we can construct a quiver $Q'$ associated to $A'$ and add arrows to it to obtain a quiver $Q$ associated to $A$.
If $v$ is the simple root coordinates of a root in $\Phi(A')$, then if we start with an indecomposable representation of $Q'$ with dimension vector $v$ and assign arbitrary maps to the arrows in $Q$ that are not in $Q'$, the result is still indecomposable, so $v$ is the simple root coordinates of a root in $\Phi(A)$.
\end{proof}
The dual root system $\Phi\spcheck(A)$ consists of all co-roots associated to the roots in $\Phi(A)$.
This is a root system in its own right, associated to $A^T$.
Since $A$ dominates $A'$ if and only if $A^T$ dominates $(A')^T$, the following proposition is immediate from Proposition~\ref{dom subroot}.
\begin{prop}\label{dom subcoroot}
Suppose $A$ and $A'$ are symmetrizable Cartan matrices such that $A$ dominates $A'$.
If $\Phi\spcheck(A)$ and $\Phi\spcheck(A')$ are both defined with respect to the same simple co-roots $\alpha\spcheck_i$, then $\Phi\spcheck(A)\supseteq\Phi\spcheck(A')$ and $\Phi\spcheck_+(A)\supseteq\Phi\spcheck_+(A')$.
\end{prop}
Suppose $A$ dominates $A'$ and suppose $(W,S)$ and $(W',S)$ are the associated Coxeter systems.
Let $\mathcal{A}$ and $\mathcal{A}'$ be the associated Coxeter arrangements, realized so that the simple \emph{co}-roots are the same for the two arrangements.
(This requires that two different Euclidean inner products be imposed on $\mathbb R^n$.)
Proposition~\ref{dom subcoroot} implies that $\mathcal{A}'\subseteq\mathcal{A}$, so that in particular, each region of $\mathcal{A}$ is contained in some region of $\mathcal{A}'$.
Since the regions of $\mathcal{A}$ are in bijection with the elements of $W$ and the regions of $\mathcal{A}'$ are in bijection with the elements of $W'$, this containment relation defines a surjective map $\eta:W\to W'$.
\begin{theorem}\label{weak hom subroot}
The map $\eta$, defined above, is a surjective lattice homomorphism from the weak order on $W$ to the weak order on $W'$.
\end{theorem}
\begin{proof}
As in the proof of Proposition~\ref{dom subroot}, we may restrict our attention to the case where $A$ is irreducible and barely dominates $A'$.
We first consider the case where $A'$ is obtained by erasing a single edge $e$ in the Dynkin diagram of $A$.
Let $E=\set{e}$.
Recall from Section~\ref{erase edge sec} that the map $\eta_E$ maps $w\in W$ to $(w_I,w_J)\in W_I\times W_J=W'$, where $I$ and $J$ are the vertex sets of the two components of the diagram of $A'$.
The set of reflections in $W'$ equals the set of reflections in $W_I$ union the set of reflections in $W_J$.
Since $\operatorname{inv}(w_I)=\operatorname{inv}(w)\cap W_I$ and $\operatorname{inv}(w_J)=\operatorname{inv}(w)\cap W_J$, two elements of $W$ map to the same element of $W'$ if and only if the symmetric difference of their inversion sets does not intersect $W_I\cup W_J$.
Comparing with the edge-erasing case in the proof of Proposition~\ref{dom subroot}, and noting that both maps fix $W'$, we see that $\eta=\eta_E$.
Theorem~\ref{edge cong} now says that $\eta$ is a surjective homomorphism.
The case where $A$ is of type $G_2$ is easy and we omit the details.
Now suppose $A$ is of type $C_n$, so that the dual root system $\Phi\spcheck(A)$ is of type $B_n$.
Using a standard realization of the type-B root system, reflections in $W$ correspond to positive co-roots as follows:
A co-root $e_i$ corresponds to $(-i\,\,\,i)$, a co-root $e_j-e_i$ corresponds to $(-j\,\,\,-i)(i\,\,\,j)$, and a co-root $e_j+e_i$ corresponds to $(i\,\,\,-j)(j\,\,\,-i)$.
The positive co-roots for $A'$ are the roots $\alpha_1+\alpha_2+\cdots+\alpha_j=e_j$ for $1\le j\le n$ and $\alpha_i+\alpha_{i+1}+\cdots+\alpha_j=e_j-e_{i-1}$ for $2\le i\le j\le n$.
Two adjacent $\mathcal{A}$-regions are contained in the same $\mathcal{A}'$-region if and only if the hyperplane separating them is in $\mathcal{A}\setminus\mathcal{A}'$.
Thus, in light of Proposition~\ref{simion cover}, we see that $\eta$ has the same fibers as the map $\eta_\sigma$ of Section~\ref{simion sec}, which is a surjective lattice homomorphism by Theorem~\ref{simion thm}.
Writing, as before, $\tau$ for the inverse map $\tau$ to $\eta_\sigma$, the inversions of a permutation $\pi$ correspond to the inversions $t$ of $\tau(\pi)$ such that $H_t\in\mathcal{A}'$.
It follows that $\eta=\eta_\sigma$.
When $A$ is of type $B_n$, so that $\Phi\spcheck(A)$ is of type $C_n$, the argument is the same, using Proposition~\ref{nonhom cover} instead of Proposition~\ref{simion cover}.
When $A$ is of type $F_4$, the dual root system $\Phi\spcheck(A)$ is also of type $F_4$, and we choose an explicit realization of $\Phi\spcheck(A)$ with
\[\alpha\spcheck_p=\frac12(-e_1-e_2-e_3+e_4)\,,\quad\alpha\spcheck_q=e_1\,,\quad\alpha\spcheck_r=e_2-e_1\,,\quad\alpha\spcheck_s=e_3-e_2.\]
Here $p$, $q$, $r$, and $s$ are as defined in connection with Theorem~\ref{F4 thm}.
The positive co-roots are $\set{\frac12(\pm e_1\pm e_2\pm e_3+e_4)}\cup\set{e_i:i=1,2,3,4}\cup\set{e_j\pm e_i:1\le i<j\le 4}$.
The positive co-roots for the $A'$, as a subset of these co-roots, are
\[\set{e_1,e_2,e_3}\cup\set{e_2-e_1,e_3-e_2,e_3-e_1}\cup\SEt{\sum_{i=1}^4b_ie_i:b_i\in\Set{\pm\frac12},b_4=\frac12\sum b_i\le0}\]
Computer calculations show that the surjective homomorphism $\eta$ found in Case~4 of the proof of Theorem~\ref{F4 thm} has the property that two elements of $W$, related by a cover in the weak order, map to the same element of $W'$ if and only if the reflection that relates them corresponds to a co-root not contained in the subset $\Phi\spcheck(A')$.
The two maps coincide by the same argument given in previous cases.
\end{proof}
Theorems~\ref{camb exist unique} and~\ref{weak hom subroot} immediately imply Theorem~\ref{camb fan coarsen}.
\begin{remark}\label{alt proof}
We mention two alternative proofs of Theorem~\ref{weak hom subroot} that are almost uniform, but not quite.
Both use the following fact:
For $A$ and $A'$ as in Proposition~\ref{dom subroot}, if $\Phi(A)$ is finite, then $\Phi(A')$ is not only a subset of $\Phi(A)$, but also an order ideal in the root poset of $\Phi(A)$ (the positive roots ordered with $\alpha\le\beta$ if and only if $\beta-\alpha$ is in the nonnegative span of the simple roots).
This fact is easily proved type-by-type, but we are unaware of a uniform proof.
Indeed, the fact fails for infinite root systems, so perhaps a uniform proof shouldn't be expected.
Using the fact, it is easy to prove Theorem~\ref{weak hom subroot} using the polygonality of the weak order (\cite[Theorem~10-3.7]{regions10} and \cite[Theorem~9-6.5]{regions9}) or using the characterization of inversion sets as rank-two biconvex (AKA biclosed) sets of positive roots (\cite[Lemma~4.1]{Dyer} or \cite[Theorem~10-3.24]{regions10}).
\end{remark}
\section*{Acknowledgments}
Thanks are due to Vic Reiner, Hugh Thomas, and John Stembridge for helpful conversations.
Thanks in particular to Hugh Thomas for providing the quiver-theoretic proof of the symmetric case of Proposition~\ref{dom subroot} (see Section~\ref{crys case}) and encouraging the author to improve upon an earlier non-uniform finite-type proof.
Thanks to Nicolas Perrin for bibliographic help concerning Kac-Moody Lie algebras and for his helpful notes~\cite{Perrin}.
The computations described in this paper were carried out in \texttt{maple} using Stembridge's \texttt{coxeter/weyl} and \texttt{posets} packages~\cite{StembridgePackages}.
An anonymous referee gave many helpful suggestions and pointed out most of what appears in Remark~\ref{alt proof}.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 735 |
Download Stiletto Nail Designs 2013 Wallpaper from the 1024x768 resolutions. This wallpaper comes from Nail Design directory and we focuse it on stiletto nail designs with rhinestones, stiletto nail sets. You may download it directly with 163 KB size via download button or preview it on a bigger image for spesification sample. | {
"redpajama_set_name": "RedPajamaC4"
} | 6,922 |
{"url":"https:\/\/jp.maplesoft.com\/support\/help\/Maple\/view.aspx?path=MathApps\/NumberOfGroupsOfOrderN","text":"Number of Groups of Order N - Maple Help\n\n# Online Help\n\n###### All Products\u00a0\u00a0\u00a0 Maple\u00a0\u00a0\u00a0 MapleSim\n\nHome : Support : Online Help : Math Apps : Discrete Mathematics : Number of Groups of Order N\n\nThe Number of Groups of Order n\n\nMain Concept\n\nA group\u00a0is a set endowed with a group operation, a function mapping pairs of group elements back to the group. That is, if x\u00a0and y\u00a0are elements of a group G\u00a0and f\u00a0is the group operation, then $f\\left(x\\mathit{,}y\\right)$\u00a0is also a group element, usually denoted $x\\circ y$. The group operation must satisfy the following properties:\n\n (Associativity) For all , . (Identity) s.t. for all \u00a0 , . (Inverse) For all , \u00a0\u00a0s.t. .\n\nThe number of elements of a group is called its order.\n\nTwo groups are called isomorphic\u00a0if there is a bijective mapping between the groups that preserves the group operation. The \"number of groups of order n\" refers to the number of isomorphism classes of groups of order n.\n\nThe graph below displays the number of groups of order n for various different orders. Check \"Logarithmic Scale\" to choose a logarithmic scale on the vertical axis, otherwise a linear scale is used on the vertical axis. Select an item from the \"Highlight Orders\" list to highlight group orders of special interest. Use the sliders or type in the boxes (and then click outside them) to change the minimum and maximum group orders.\n\nNote: As you change the slider for the maximum or minimum order, the other value may change as well to accommodate the new value.\n\n NothingPrimesPrime PowerPrimes SquaredPrimes CubedSquare FreeCube FreeDivisible by Exactly Two PrimesDivisible by at Most Two PrimesDivisible by Exactly Three PrimesDivisible by at Most Three Primes\n\n Minimum order: Maximum order:\n\n\n\n More MathApps","date":"2022-01-20 17:46:57","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 5, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.8487426042556763, \"perplexity\": 928.437022176524}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.3, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": false}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2022-05\/segments\/1642320302355.97\/warc\/CC-MAIN-20220120160411-20220120190411-00295.warc.gz\"}"} | null | null |
Margot Robbie to Play Tonya Harding in "I, Tonya"
Home, News, News Articles, nicole caico
By Nicole Caico
Margot Robbie is gearing up to star in the upcoming film, "I, Tonya" as Tonya Harding, the disgraced figure skater. Robbie is also co-producing the film with Brian Unkeless from Clubhouse Pictures. There is currently no director signed onto the project, and the picture is currently looking for financiers.
Tonya Harding grew up in Portland, Oregon and had a difficult childhood. However this helped her harness a determination that would lead her to become the first American woman to land a triple axel jump in competition. In 1991 she finished first place in the U.S. Figure Skating Championship, then second in the World Championships, and she was expected to battle fierce competitor Nancy Kerrigan for the gold medal in the 1994 Olympics.
In an attempt to tip the scales in her direction, Harding's then-husband, Jeff Gillooly, and men hired by him attacked Kerrigan and broke her leg. She recovered in time to compete and earned a silver medal, while Harding finished 8th. Harding later admitted to having knowledge of the attack, was stripped of her U.S. Championship gold, and was permanently ban from competition. Her husband was put in jail.
Robbie's breakout role in "The Wolf of Wall Street" has shown her talent, and expectations for her upcoming films "Suicide Squad" and "The Legend of Tarzan" are high.
There is no projected release date for "I, Tonya."
Margot RobbieTonya Harding
Michael Ealy to Star in Remake of "Jacob's Ladder"
"The Nice Guys" Release a 2nd Trailer
News, News Articles, Travis Martin
David Ayer to Direct All-Female DC Villains Movie "Gotham City Sirens"
Marc Forster to Direct Winnie the Pooh Film "Christopher Robin" | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 8,710 |
\section{Introduction}
Let $(\O,\cF,\dbF,\dbP)$ be a given complete filtered probability
space along with a one-dimensional standard Brownian motion
$W=\{W(t),\cF_t; 0\les t < \infty \}$, where $\dbF=\{\cF_t\}_{t\ges0}$
is the natural filtration of $W$ augmented by all the $\dbP$-null
sets in $\cF$ \cite{Karatzas-Shreve 1991,Yong-Zhou 1999}. Consider
the following controlled linear stochastic differential equation on
$[t,T]$:
\bel{state}\left\{\2n\ba{ll}
\ns\ds dX(s)=\big[A(s)X(s)+B_1(s)u_1(s)+B_2(s)u_2(s)+b(s)\big]ds\\
\ns\ds\qq\qq+\big[C(s)X(s)+D_1(s)u_1(s)+D_2(s)u_2(s)+\si(s)\big]dW(s),\q s\in[t,T], \\
\ns\ds X(t)= x.\ea\right.\ee
In the above, $X(\cd)$ is called the {\it state process} taking
values in the $n$-dimensional Euclidean space $\dbR^n$ with the {\it
initial state} $x$ at the initial time $t$; for $i=1,2$, $u_i(\cd)$
is called the {\it control process} of Player $i$ taking values in
$\dbR^{m_i}$. We assume that $A(\cd), B_1(\cd), B_2(\cd), C(\cd),
D_1(\cd)$, $D_2(\cd)$ are deterministic matrix-valued functions of proper
dimensions, and $b(\cd)$, $\si(\cd)$ are vector-valued $\dbF$-adapted processes.
For any $t\in[0,T)$, we define
$$\cU_i[t,T]=\Big\{u_i:[t,T]\times\O\to\dbR^{m_i}\bigm|u_i(\cd)\hb{ is $\dbF$-adapted, }
\dbE\int_t^T|u_i(s)|^2ds<\infty\Big\},\qq i=1,2.$$
Any element $u_i(\cd)\in\cU_i[t,T]$ is called an {\it admissible
control} of Player $i$ on $[t,T]$. Under some mild conditions on the
coefficients, for any {\it initial pair} $(t,x)\in[0,T)\times\dbR^n$
and control pair $(u_1(\cd),u_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$,
state equation (\ref{state}) admits a unique solution $X(\cd)\equiv
X(\cd\,;t,x,u_1(\cd),u_2(\cd))$. To measure the performance of the
controls $u_1(\cd)$ and $u_2(\cd)$, we introduce the following
functional:
\bel{cost}\ba{ll}
\ns\ds J(t,x;u_1(\cd),u_2(\cd))\deq{1\over2}\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\qq+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S_1(s)^T&S_2(s)^T\\
S_1(s)&R_{11}(s)&R_{12}(s)\\
S_2(s)&R_{21}(s)&R_{22}(s)\end{pmatrix}
\begin{pmatrix}X(s)\\ u_1(s)\\ u_2(s)
\end{pmatrix},\begin{pmatrix}X(s)\\ u_1(s)\\ u_2(s)
\end{pmatrix}\ran
+2\lan\begin{pmatrix}q(s)\\ \rho_1(s)\\ \rho_2(s)\end{pmatrix},
\begin{pmatrix}X(s)\\ u_1(s)\\ u_2(s)
\end{pmatrix}\ran\Big]ds\Big\},\ea\ee
where $Q(\cd)$, $S_1(\cd)$, $S_2(\cd)$, $R_{11}(\cd)$,
$R_{12}(\cd)$, $R_{21}(\cd)$, $R_{22}(\cd)$ are deterministic
matrix-valued functions of proper dimensions with $Q(\cd)^T=Q(\cd)$,
$R_{ii}(\cd)^T=R_{ii}(\cd)$ ($i=1,2$), $R_{12}(\cd)^T=R_{21}(\cd)$,
and $G$ is a symmetric matrix; $q(\cd)$, $\rho_1(\cd)$,
$\rho_2(\cd)$ are allowed to be vector-valued $\dbF$-adapted
processes, and $g$ is allowed to be an $\cF_T$-measurable random
variable. We assume that (\ref{cost}) is a cost functional for
Player 1, and a payoff functional for Player 2. Therefore, Player 1
wishes to minimize (\ref{cost}) by selecting a control process
$u_1(\cd)\in\cU_1[t,T]$, while Player 2 wishes to maximize
(\ref{cost}) by selecting a control process $u_2(\cd)\in\cU_2[t,T]$.
The above described problem is referred to as a linear quadratic
(LQ, for short) stochastic {\it two-person zero-sum differential
game}, denoted by Problem (SG). The study of LQ deterministic
two-person zero-sum differential games, denoted by Problem (DG),
which is a special case of Problem (SG) where the stochastic part is
absent, can be traced back to the work of Ho--Bryson--Baron
\cite{Ho-Bryson-Baron 1965} in 1965. In 1970, Schmitendorf studied
both open-loop and closed-loop strategies for Problem (DG)
(\cite{Schmitendorf 1970}). Among other things, it was shown that
the existence of a closed-loop saddle point may not imply that of an
open-loop saddle point. In 1979, Bernhard carefully investigated
Problem (DG) from closed-loop point of view (\cite{Bernhard 1979});
see also the book by Basar and Bernhard \cite{Basar-Bernhard 1991}
in this aspect. In 2005, Zhang \cite{Zhang 2004} proved that for a
Problem (DG), the existence of the open-loop value is equivalent to
the finiteness of the corresponding open-loop lower and upper
values, which is also equivalent to the existence of an open-loop
saddle point. Along this line, there were a couple of follow-up
works \cite{Delfour 2007,Delfour-Sbarba 2009} appeared afterwards.
In 2006, Mou--Yong studied a Problem (SG) from an open-loop point of
view by means of Hilbert space method (\cite{Mou-Yong 2006}). The
main purpose of this paper is to study Problem (SG) from both
open-loop and closed-loop point of view.
\ms
We know that when $m_2=0$, Problem (SG) is reduced to a linear
quadratic stochastic optimal control problem, denoted by Problem
(SLQ). Thus, Problem (SLQ) can be regarded as a special case of
Problem (SG). See \cite{Chen-Yong 2000,Ait Rami-Moore-Zhou 2001,
Chen-Yong 2001,Hu-Zhou 2003,Tang 2003,McAsey-Mou 2006,Qian-Zhou
2013} for some relevant results on Problem (SLQ). Further, linear
quadratic deterministic optimal control problem, denoted by Problem
(DLQ), can be regarded as a special case of Problem (SLQ) and
Problem (DG). The history of Problem (DLQ) can further be traced
back to the work of Bellman--Glicksberg--Gross
(\cite{Belman-Gicksberg-Gross 1958}) in 1958, Kalman (\cite{Kalman
1960}), and Letov (\cite{Letov 1960}) in 1960. See \cite{Yong-Zhou
1999} for some historic remarks on Problems (DLQ) and (SLQ).
\ms
The rest of the paper is organized as follows. Section 2 will
collect some preliminary results. Among other things, we will state
some results for Problem (SLQ), which is a special case of our main
results presented in later sections. In Section 3, we pose our
differential game problem, carefully explaining the open-loop and
closed-loop saddle points. Section 4 is devoted to the study of
open-loop saddle points by variational method. In Section 5, we
characterize closed-loop saddle points by means of Riccati equation.
Some examples are presented in Section 6, and several concluding
remarks are collected in Section 7.
\section{Preliminaries}
We recall that $\dbR^n$ is the $n$-dimensional Euclidean space,
$\dbR^{n\times m}$ is the space of all $(n\times m)$ matrices,
endowed with the inner product $(M,N)\mapsto\tr[M^TN]$, and
$\dbS^n\subseteq \dbR^{n\times n}$ is the set of all $(n\times n)$
symmetric matrices. We recall that for any $M\in\dbR^{m\times n}$,
there exists a unique matrix $M^\dag\in\dbR^{n\times m}$, called the
(Moore-Penrose) {\it pseudo-inverse} of $M$, satisfying the
following (\cite{Penrose 1955}):
$$MM^\dag M=M,\q M^\dag MM^\dag=M^\dag,\q(MM^\dag)^T=MM^\dag,\q
(M^\dag M)^T=M^\dag M.$$
In addition, if $M=M^T\in\dbS^n$, then
$$\ba{ll}
\ns\ds M^\dag=(M^\dag)^T,\q MM^\dag=M^\dag M;\qq\hb{and}\qq
M\ges0\iff M^\dag\ges0.\ea$$
Next, let $T>0$ be a fixed time horizon. For any $t\in[0,T)$ and
Euclidean space $\dbH$, let
$$\ba{ll}
\ns\ds C([t,T];\dbH)=\Big\{\f:[t,T]\to\dbH\bigm|\f(\cd)\hb{ is
continuous }\Big\},\\
\ns\ds
L^p(t,T;\dbH)=\Big\{\f:[t,T]\to\dbH\bigm|\int_t^T|\f(s)|^pds<\infty\Big\},\q1\les p<\infty,\\
\ns\ds
L^\infty(t,T;\dbH)=\Big\{\f:[t,T]\to\dbH\bigm|\esssup_{s\in[t,T]}|\f(s)|<\infty\Big\}.\ea$$
Next, we recall that $(\O,\cF,\dbF,\dbP)$ is a complete filtered
probability space and $W(\cd)$ is a one-dimensional standard
Brownian motion with $\dbF=\{\cF_t\}_{t\ges0}$ being its natural
filtration augmented by all the $\dbP$-null sets in $\cF$. We denote
$$\ba{ll}
\ns\ds L^2_{\cF_T}(\O;\dbH)=\Big\{\xi:\O\to\dbH\bigm|\f(\cd)\hb{ is
$\cF_T$-measurable, }\dbE|\xi|^2<\infty\Big\},\\
\ns\ds
L_\dbF^2(t,T;\dbH)=\Big\{\f:[t,T]\times\O\to\dbH\bigm|\f(\cd)\hb{ is
$\dbF$-adapted, }\dbE\int^T_t|\f(s)|^2ds<\infty\Big\},\\
\ns\ds
L_\dbF^2(\Omega;C([t,T];\dbH))=\Big\{\f:[t,T]\times\O\to\dbH\bigm|\f(\cd)\hb{
is $\dbF$-adapted, continuous, }\dbE\big(\sup_{t\les s\les
T}|\f(s)|^2\big)<\infty\Big\},\\
\ns\ds L^2_\dbF(\O;L^1(0,T;\dbR^n))=\Big\{\f:[0,T]\times
\O\to\dbR^n\ \bigm|\ \f(\cd)\ \hb{is $\dbF$-adapted,
}\dbE\Big(\int_0^T|\f(t)|dt\Big)^2<\infty\Big\}.\ea$$
\ms
In the rest of this section, we look at Problem (SLQ). We write the
corresponding state equation as follows:
\bel{SDE}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\big[A(s)X(s)+B(s)u(s)+b(s)\big]ds+\big[C(s)X(s)+D(s)u(s)+\si(s)\big]dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\in[t,T],\\
\ns\ds X(t)=x.\ea\right.\ee
The cost functional takes the following form:
\bel{cost2}\ba{ll}
\ns\ds J(t,x;u(\cd))\deq{1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran\\
\ns\ds\qq\qq\qq\q+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S(s)^T\\
S(s)&R(s)\end{pmatrix}
\begin{pmatrix}X(s)\\
u(s)\end{pmatrix},
\begin{pmatrix}X(s)\\
u(s)\end{pmatrix}\ran
+2\lan\begin{pmatrix}q(s)\\
\rho(s)\end{pmatrix},
\begin{pmatrix}X(s)\\
u(s)\end{pmatrix}\ran\Big]ds\Big\}.\ea\ee
We adopt the following assumptions.
\ms
{\bf(S1)} The coefficients of the state equation satisfy the
following:
$$\left\{\2n\ba{ll}
\ns\ds A(\cd)\in L^1(0,T;\dbR^{n\times n}),\q B(\cd)\in
L^2(0,T;\dbR^{n\times m}),\q b(\cd)\in L^2_\dbF(\O;L^1(0,T;\dbR^n)),\\
\ns\ds C(\cd)\in L^2(0,T;\dbR^{n\times n}),\q D(\cd)\in
L^\infty(0,T;\dbR^{n\times m}),\q\si(\cd)\in
L_\dbF^2(0,T;\dbR^n).\ea\right.$$
{\bf(S2)} The weighting coefficients in the cost functional satisfy
the following:
$$\left\{\2n\ba{ll}
\ns\ds Q(\cd)\in L^1(0,T;\dbS^n),\q S(\cd)\in L^2(0,T;\dbR^{m\times
n}),\q R(\cd)\in L^\infty(0,T;\dbS^m),\\
\ns\ds q(\cd)\in L^2_\dbF(\O;L^1(0,T;\dbR^n)),\q\rho(\cd)\in
L_\dbF^2(0,T;\dbR^m),\q G\in\dbS^n,\q g\in
L^2_{\cF_T}(\O;\dbR^n).\ea\right.$$
We note that under (S1), for any $(t,x)\in[0,T)\times\dbR^n$ and
$u(\cd)\in\cU[t,T]\equiv L^2_\dbF(t,T;\dbR^m)$, the state equation
(\ref{SDE}) admits a unique solution $X(\cd)\equiv
X(\cd\,;t,x,u(\cd))$. Further, under (S2), the cost functional
(\ref{cost2}) is well-defined for every $(t,x)\in[0,T)\times\dbR^n$
and $u(\cd)\in\cU[t,T]$. Therefore, the following problem is
meaningful.
\ms
\bf Problem (SLQ). \rm For any given initial pair
$(t,x)\in[0,T)\times\dbR^n$, find a $\bar u(\cd)\in\cU[t,T]$ such
that
\bel{2.43}V(t,x)\deq J(t,x;\bar
u(\cd))=\inf_{u(\cd)\in\cU[t,T]}J(t,x;u(\cd))\les
J(t,x;u(\cd)),\qq\forall u(\cd)\in\cU[t,T].\ee
\ms
Any $\bar u(\cd)\in\cU[t,T]$ satisfying (\ref{2.43}) is called an
{\it open-loop optimal control} of Problem (SLQ) for $(t,x)$, the
corresponding $\bar X(\cd)\equiv X(\cd\,;t,x,\bar u(\cd))$ is called
an {\it open-loop optimal state process} and $(\bar X(\cd),\bar
u(\cd))$ is called an {\it open-loop optimal pair}. The function
$V(\cd\,,\cd)$ is called the {\it value function} of Problem (SLQ).
\ms
The following result is concerned with open-loop optimal control of
Problem (SLQ) for a given initial pair.
\ms
\bf Theorem 2.1. \sl Let {\rm(S1)--(S2)} hold. For a given initial
pair $(t,x)\in[0,T)\times\dbR^n$, a state-control pair $(\bar
X(\cd),\bar u(\cd))$ is an open-loop optimal pair of Problem
{\rm(SLQ)} if and only if the following {\it stationarity condition}
holds:
\bel{2.8}B(s)^T\bar Y(s)+D(s)^T\bar Z(s)+S(s)\bar X(s)+R(s)\bar
u(s)+\rho(s)=0,\qq \ae s\in[t,T],~\as\ee
where $(\bar Y(\cd),\bar Z(\cd))$ is the {\it adapted solution} to
the following {\it backward stochastic differential equation} (BSDE,
for short):
\bel{BSDE0}\left\{\2n\ba{ll}
\ns\ds d\bar Y(s)=-\big[A(s)^T\bar Y(s)+C(s)^T\bar Z(s)+Q(s)\bar
X(s)+S(s)^T\bar
u(s)+q(s)\big]+\bar Z(s)dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\in[t,T],\\
\ns\ds\bar Y(T)=G\bar X(T)+g,\ea\right.\ee
and the following {\it convexity
condition} holds: For any $u(\cd)\in\cU[t,T]$,
\bel{>00}\dbE\Big\{\1n\lan
GX_0(T),X_0(T)\ran\1n+\2n\int_t^T\1n\2n\big[\lan
Q(s)X_0(s),X_0(s)\ran\1n+2\lan S(s)X_0(s),u(s)\ran\1n+\1n\lan
R(s)u(s),u(s)\ran\big]ds\Big\}\ges0,\ee
where $X_0(\cd)$ is the solution to the following:
\bel{X0s}\left\{\2n\ba{ll}
\ns\ds dX_0(s)=\big[A(s)X_0(s)+B(s)u(s)\big]ds+\big[C(s)X_0(s)+D(s)u(s)\big]dW(s),\qq s\in[t,T],\\
\ns\ds X_0(t)=0.\ea\right.\ee
\it Proof. \rm Suppose $(\bar X(\cd),\bar u(\cd))$ is a
state-control pair corresponding to the given initial pair
$(t,x)\in[0,T)\times\dbR^n$. For any $u(\cd)\in\cU[t,T]$ and $\e\in\dbR$,
let $X^\e(\cd)=X(\cd\,;t,x,\bar u(\cd)+\e u(\cd))$. Then
$$\left\{\2n\ba{ll}
\ns\ds dX^\e(s)=\big\{A(s)X^\e(s)+B(s)\big[\bar u(s)+\e
u(s)\big]+b(s)\big\}ds\\
\ns\ds\qq\qq\q+\big\{C(s)X^\e(s)+D(s)\big[\bar u(s)+\e u(s)\big]+\si(s)\big\}dW(s),\qq s\in[t,T],\\
\ns\ds X^\e(t)=x.\ea\right.$$
Thus, $X_0(\cd)\equiv{X^\e(\cd)-\bar X(\cd)\over\e}$ is independent
of $\e$ and satisfies (\ref{X0s}). Then
$$\ba{ll}
\ns\ds J(t,x;\bar u(\cd)+\e u(\cd))-J(t,x;\bar u(\cd))\\
\ns\ds={\e\over2}\dbE\Big\{\lan G\big[2\bar X(T)+\e
X_0(T)\big],X_0(T)\ran
+2\lan g,X_0(T)\ran\\
\ns\ds\qq+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S(s)^T\\
S(s)&R(s)\end{pmatrix}
\begin{pmatrix}2\bar X(s)+\e X_0(s)\\
2\bar u(s)+\e u(s)\end{pmatrix},
\begin{pmatrix}X_0(s)\\
u(s)\end{pmatrix}\ran
+2\lan\begin{pmatrix}q(s)\\
\rho(s)\end{pmatrix},
\begin{pmatrix}X_0(s)\\
u(s)\end{pmatrix}\ran\Big]ds\Big\}\\
\ns\ds=\e\dbE\Big\{\lan G\bar X(T),X_0(T)\ran+\lan g,X_0(T)\ran\\
\ns\ds\qq+\int_t^T\Big[\lan Q\bar X,X_0\ran+\lan S\bar X,u\ran+\lan
SX_0,\bar u\ran+\lan R\bar u,u\ran+\lan
q,X_0\ran+\lan\rho,u\ran\Big]ds\Big\}\\
\ns\ds\qq+{\e^2\over2}\dbE\Big\{\lan
GX_0(T),X_0(T)\ran+\int_t^T\Big[\lan
Q(s)X_0(s),X_0(s)\ran+2\lan S(s)X_0(s),u(s)\ran\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq+\lan
R(s)u(s),u(s)\ran\Big]ds\Big\}.\ea$$
Now, let $(\bar Y(\cd),\bar Z(\cd))$ be the adapted solution to the
BSDE (\ref{BSDE0}). Then
$$\ba{ll}
\ns\ds\dbE\Big\{\lan G\bar X(T)+g,X_0(T)\ran+\int_t^T\Big[\lan
Q\bar X+S^T\bar u+q,X_0\ran+\lan S\bar X+R\bar
u+\rho,u\ran\Big]ds\Big\}\\
\ns\ds\q=\dbE\Big\{\int_t^T\Big[\lan-(A^T\bar Y+C^T\bar Z+Q\bar
X+S^T\bar u+q),X_0\ran+\lan\bar Y,AX_0+Bu\ran+\lan
\bar Z,CX_0+Du\ran\\
\ns\ds\qq\qq\qq+\lan Q\bar X+S^T\bar u+q,X_0\ran+\lan S\bar X+R\bar
u+\rho,u\ran\Big]ds\Big\}\\
\ns\ds\q=\dbE\int_t^T\lan B^T\bar Y+D^T\bar Z+S\bar X+R\bar
u+\rho,u\ran ds.\ea$$
Hence,
$$\ba{ll}
\ns\ds J(t,x;\bar u(\cd)+\e u(\cd))=J(t,x;\bar
u(\cd))+\e\dbE\Big\{\int_t^T\lan B^T\bar Y+D^T\bar Z+S\bar X+R\bar
u+\rho,u\ran ds\Big\}\\
\ns\ds\qq+{\e^2\over2}\dbE\Big\{\lan
GX_0(T),X_0(T)\ran+\int_t^T\Big[\lan
Q(s)X_0(s),X_0(s)\ran+2\lan S(s)X_0(s),u(s)\ran\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq+\lan
R(s)u(s),u(s)\ran\Big]ds\Big\}.\ea$$
Therefore, $(\bar X(\cd),\bar u(\cd))$ is an open-loop optimal
control of Problem (SLQ) for $(t,x)$ if and only if (\ref{2.8}) and
(\ref{>00}) hold. \endpf
\ms
Next, for any $t\in[0,T)$, take $\Th(\cd)\in L^2(t,T;\dbR^{m\times
n})\equiv\sQ[t,T]$, and $v(\cd)\in\cU[t,T]$. For any $x\in\dbR^n$,
we consider the following equation:
\bel{closed-loop1}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\big\{\big[A(s)+B(s)\Th(s)\big]X(s)+B(s)v(s)+b(s)\big\}ds\\
\ns\ds\qq\qq+\big\{\big[C(s)+D(s)\Th(s)\big]X(s)+D(s)v(s)+\si(s)\big\}dW(s),\q
s\in[t,T],\\
\ns\ds X(t)=x,\ea\right.\ee
which admits a unique solution $X(\cd)\equiv
X(\cd\,;t,x,\Th(\cd),v(\cd))$, depending on $\Th(\cd)$ and $v(\cd)$.
The above is called a {\it closed-loop system} of the original state
equation (\ref{SDE}) under {\it closed-loop strategy}
$(\Th(\cd),v(\cd))$. We point out that $(\Th(\cd),v(\cd))$ is
independent of the initial state $x$. With the above solution
$X(\cd)$, we define
$$\ba{ll}
\ns\ds J(t,x;\Th(\cd)X(\cd)+v(\cd))={1\over2}\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\qq\qq\qq\qq\qq\qq+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S(s)^T\\
S(s)&R(s)\end{pmatrix}
\begin{pmatrix}X(s)\\
\Th(s)X(s)+v(s)\end{pmatrix},
\begin{pmatrix}X(s)\\
\Th(s)+v(s)\end{pmatrix}\ran\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq+2\lan\begin{pmatrix}q(s)\\
\rho(s)\end{pmatrix},
\begin{pmatrix}X(s)\\
\Th(s)+v(s)\end{pmatrix}\ran\Big]ds\Big\}.\ea$$
We now introduce the following definition.
\ms
\bf Definition 2.2. \rm A pair $(\bar\Th(\cd),\bar
v(\cd))\in\sQ[t,T]\times\cU[t,T]$ is called a {\it closed-loop
optimal strategy} of Problem (SLQ) on $[t,T]$ if
\bel{2.45}J(t,x;\bar\Th(\cd)\bar X(\cd)+\bar v(\cd))\les
J(t,x;u(\cd)),\qq\forall x\in\dbR^n,\q u(\cd)\in\cU[t,T],\ee
where $\bar X(\cd)=X(\cd\,;t,x,\bar\Th(\cd),\bar v(\cd))$.
\ms
\bf Remark 2.3. \rm In the above, both $\bar\Th(\cd)$ and $\bar
v(\cd)$ are required to be independent of the initial state
$x\in\dbR^n$. Also, for fixed initial pair
$(t,x)\in[0,T)\times\dbR^n$, (\ref{2.45}) implies that the outcome
$$\bar u(\cd)\equiv\bar\Th(\cd)\bar X(\cd)+\bar v(\cd)\in\cU[t,T]$$
of the closed-loop optimal strategy $(\bar\Th(\cd),\bar v(\cd))$ is
an open-loop optimal control of Problem (SLQ) for $(t,x)$.
Therefore, for Problem (SLQ), the existence of closed-loop optimal
strategy on $[t,T]$ implies the existence of open-loop optimal
control for initial pair $(t,x)$ for any $x\in\dbR^n$.
\ms
For closed-loop optimal strategies, we have the following
characterization.
\ms
\bf Theorem 2.4. \sl Let {\rm(S1)--(S2)} hold. Then Problem
{\rm(SLQ)} admits a closed-loop optimal strategy if and only if the
following Riccati equation admits a solution $P(\cd)\in C([t,T];\dbS^n)$:
\bel{Riccati2.52}\left\{\2n\ba{ll}
\ns\ds\dot P+PA+A^TP+C^TPC+Q\\
\ns\ds\qq-(PB+C^TPD+S^T)(R+D^TPD)^\dag(B^TP+D^TPC+S)=0,\qq\ae s\in[t,T],\\
\ns\ds\cR\big(B^TP+D^TPC+S\big)\subseteq\cR\big(R+D^TPD\big),\qq\ae s\in[t,T],\\
\ns\ds R+D^TPD\ges0,\qq\ae s\in[t,T],\\
\ns\ds P(T)=G,\ea\right.\ee
such that
\bel{2.53}\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag
\big[B(\cd)^TP(\cd)+D(\cd)^TP(\cd)C(\cd)+S(\cd)\big]\in
L^2(t,T;\dbR^{m\times n}),\ee
and the adapted solution $(\eta(\cd),\z(\cd))$ of the following BSDE:
\bel{BODE1}\left\{\2n\ba{ll}
\ns\ds d\eta=-\Big\{\big[A^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
B^T\big]\eta\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag D^T\big]\z\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T\big]P\si\\
\ns\ds\qq\qq-(PB+C^TPD+S^T)(R+D^TPD)^\dag
\rho+Pb+q\Big\}ds+\z dW(s),\\
\ns\ds B^T\eta+D^T\z+D^TP\si+\rho\in\cR(R+D^TPD),\q \ae s\in[t,T],~\as\\
\ns\ds\eta(T)=g,\ea\right.\ee
satisfies
\bel{}\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag\big[B(\cd)^T\eta(\cd)+D(\cd)^T\z(\cd)
+D(\cd)^TP(\cd)\si(\cd)+\rho(\cd)\big]\in L_\dbF^2(t,T;\dbR^m).\ee
In this case, any closed-loop optimal strategy $(\bar\Th(\cd),\bar
v(\cd))$ of Problem {\rm(SLQ)} admits the following representation:
\bel{Th-v2.54}\left\{\2n\ba{ll}
\ns\ds\bar\Th\1n=\1n-(R+\1n D^T\1n PD)^\dag(B^T\1n P\1n+\1n D^T\1n PC\1n+\1n S)\1n
+\1n\big[I\1n-(R\1n+\1n D^T\1n PD)^\dag(R\1n+\1n D^T\1n PD)\big]\th,\\
\ns\ds\bar v=-(R+D^T\1n PD)^\dag(B^T\1n\eta+\1nD^T\1n\z+\1n D^T\1n
P\si\1n+\1n\rho)+\big[I-(R\1n+\1n D^T\1n PD)^\dag(R+\1n D^T\1n PD)
\big]\n,\ea\right.\ee
for some $\th(\cd)\in L^2(t,T;\dbR^{m\times n})$ and $\n(\cd)\in
L_\dbF^2(t,T;\dbR^m)$. Further, the value function admits the
following representation:
\bel{Value2.18}\ba{ll}
\ns\ds V(t,x)\equiv\inf_{u(\cd)\in\cU[t,T]}J(t,x;u(\cd))\\
\ns\ds\qq\q={1\over2}\,\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\1n\int_t^T\3n\big[\lan
P\si,\si\ran\1n+\1n2\lan\eta,b\ran+\1n2\lan\z,\si\ran\\
\ns\ds\qq\qq\qq\q-\1n \lan(R\1n+\1n D^T\1n
PD)^\dag(B^T\1n\eta\1n+D^T\1n\z\1n+\1n D^T\1n P\si\1n+\1n\rho),B^T\1n\eta\1n+D^T\1n\z\1n+\1n
D^T\1n P\si\1n+\1n\rho\ran\big]ds\Big\}.\ea\ee
\ms
\rm
We prefer not to give a proof of the above result here since it will
be a special case of a similar result for Problem (SG), which will be
presented below.
\section{Stochastic Differential Games}
We now return to our Problem (SG). Recall the sets
$\cU_i[t,T]=L^2_\dbF(t,T;\dbR^{m_i})$ of all open-loop controls of
Player $i$ ($i=1,2$). For notational simplicity, we let $m=m_1+m_2$
and denote
$$\ba{ll}
\ns\ds B(\cd)=(B_1(\cd),B_2(\cd)),\q D(\cd)=(D_1(\cd),D_2(\cd)),\\
\ns\ds S(\cd)=\begin{pmatrix}S_1(\cd)\\ S_2(\cd)\end{pmatrix},\q R(\cd)=\begin{pmatrix}R_{11}(\cd)&R_{12}(\cd)\\
R_{21}(\cd)&R_{22}(\cd)\end{pmatrix}\equiv\begin{pmatrix}R_1(\cd)\\ R_2(\cd)\end{pmatrix},\q\rho(\cd)=\begin{pmatrix}\rho_1(\cd)\\
\rho_2(\cd)\end{pmatrix},\q u(\cd)=\begin{pmatrix}u_1(\cd)\\
u_2(\cd)\end{pmatrix}.\ea$$
Naturally, we identify $\cU[t,T]=\cU_1[t,T]\times\cU_2[t,T]$. With
such notations, the state equation becomes
\bel{state3.1}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\big[A(s)X(s)+B(s)u(s)+b(s)\big]ds+\big[C(s)X(s)+D(s)u(s)+\si(s)\big]dW(s),
\q s\in[t,T],\\
\ns\ds X(t)=x,\ea\right.\ee
and the performance functional becomes
\bel{cost3.2}\ba{ll}
\ns\ds
J(t,x;u_1(\cd),u_2(\cd))=J(t,x;u(\cd))={1\over2}\,\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\qq\qq\qq+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S(s)^T\\
S(s)&R(s)\end{pmatrix}\begin{pmatrix}
X(s)\\ u(s)\end{pmatrix},
\begin{pmatrix}
X(s)\\
u(s)\end{pmatrix}\ran+
2\lan\begin{pmatrix}q(s)\\ \rho(s)
\end{pmatrix},\begin{pmatrix}X(s)\\
u(s)\
\end{pmatrix}\ran\Big] ds\Big\}.\ea\ee
When $b(\cd),\si(\cd),q(\cd),\rho(\cd),g(\cd)=0$, we denote the
problem by Problem $\hb{(SG)}^0$, which is a special case of Problem
(SG). With the above notation, we introduce the following standard
assumptions:
\ms
{\bf(SG1)} The coefficients of the state equation satisfy the
following:
$$\left\{\2n\ba{ll}
\ns\ds A(\cd)\in L^1(0,T;\dbR^{n\times n}),\q B(\cd)\in
L^2(0,T;\dbR^{n\times m}),\q b(\cd)\in L^2_\dbF(\O;L^1(0,T;\dbR^n)),\\
\ns\ds C(\cd)\in L^2(0,T;\dbR^{n\times n}),\q D(\cd)\in
L^\infty(0,T;\dbR^{n\times m}),\q\si(\cd)\in
L_\dbF^2(0,T;\dbR^n).\ea\right.$$
{\bf(SG2)} The weighting coefficients in the cost functional satisfy
the following:
$$\left\{\2n\ba{ll}
\ns\ds Q(\cd)\in L^1(0,T;\dbS^n),\q S(\cd)\in L^2(0,T;\dbR^{m\times
n}),\q R(\cd)\in L^\infty(0,T;\dbS^m),\\
\ns\ds q(\cd)\in L^2_\dbF(\O;L^1(0,T;\dbR^n)),\q\rho(\cd)\in
L_\dbF^2(0,T;\dbR^m),\q G\in\dbS^n,\q g\in
L^2_{\cF_T}(\O;\dbR^n).\ea\right.$$
Under (SG1), for any $(t,x)\in[0,T)\times\dbR^n$, and
$u(\cd)\equiv(u_1(\cd)^T,u_2(\cd)^T)^T\in\cU_1[t,T]\times\cU_2[t,T]
\equiv\cU[t,T]$, equation (\ref{state3.1}) admits a unique solution
(\cite{Yong-Zhou 1999})
$$X(\cd)\deq X(\cd\,;t,x,u_1(\cd),u_2(\cd))\equiv X(\cd\,;t,x,u(\cd))\in L^2_\dbF\big(\O;C([0,T];\dbR^n)\big).$$
Moreover, the following estimate holds:
$$\dbE\(\sup_{t \les s\les T}|X(s)|^2\)\les
K\dbE\Big\{|x|^2+\(\int_t^T|b(s)|ds\)^2+\int_t^T|\si(s)|^2ds
+\int^T_t|u(s)|^2ds\Big\},$$
hereafter, $K>0$ represents a generic constant which can be
different from line to line. Therefore, under (SG1)--(SG2), the
quadratic performance functional $J(t,x;u(\cd))\equiv
J(t,x;u_1(\cd),u_2(\cd))$ is well defined for all
$(t,x)\in[0,T)\times\dbR^n$ and
$(u_1(\cd),u_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$. Having the
above, we now introduce the following definition.
\ms
\bf Definition 3.1. \rm (i) A pair
$(u^*_1(\cd),u^*_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$ is called an
{\it open-loop saddle point} of Problem (SG) for the initial pair
$(t,x)\in[0,T)\times\dbR^n$ if for any
$(u_1(\cd),u_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$,
\bel{saddle-open}J(t,x;u^*_1(\cd),u_2(\cd))\les
J(t,x;u^*_1(\cd),u^*_2(\cd))\les J(x;u_1(\cd),u^*_2(\cd)).\ee
(ii) The {\it open-loop upper value} $V^+(t,x)$ of Problem (SG) at
$(t,x)\in[0,T)\times\dbR^n$ and the {\it open-loop lower value}
$V^-(t,x)$ of Problem (SG) at $(t,x)\in[0,T)\times\dbR^n$ are
defined by the following:
\bel{}\left\{\ba{ll}
\ns\ds
V^+(t,x)=\inf_{u_1(\cd)\in\cU_1[t,T]}\sup_{u_2(\cd)\in\cU_2[t,T]}
J(t,x;u_1(\cd),u_2(\cd)),\\
\ns\ds
V^-(t,x)=\sup_{u_2(\cd)\in\cU_2[t,T]}\inf_{u_1(\cd)\in\cU_1[t,T]}
J(t,x;u_1(\cd),u_2(\cd)),\ea\right.\ee
which automatically satisfy the following:
$$V^-(t,x)\les V^+(t,x),\qq(t,x)\in[0,T)\times\dbR^n.$$
In the case that
\bel{}V^-(t,x)=V^+(t,x)\equiv V(t,x),\ee
we say that Problem (SG) admits an {\it open-loop value} $V(t,x)$ at
$(t,x)$. The maps $(t,x)\mapsto V^\pm(t,x)$ and $(t,x)\mapsto
V(t,x)$ are called {\it open-loop upper value function}, {\it
open-loop lower value function}, and {\it open-loop value function},
respectively.
\ms
Next, we let
$$\sQ_i[t,T]=L^2(t,T;\dbR^{m_i\times n}),\qq i=1,2.$$
For any initial pair $(t,x)\in[0,T)\times\dbR^n$,
$\Th(\cd)\equiv(\Th_1(\cd)^T,\Th_2(\cd)^T)^T\in\sQ_1[t,T]\times\sQ_2[t,T]$
and
$v(\cd)\equiv(v_1(\cd)^T,v_2(\cd)^T)^T\in\cU_1[t,T]\times\cU_2[t,T]$,
consider the following system:
\bel{state-closed}\left\{\2n\ba{ll}
\ns\ds dX(s)=\Big\{\big[A(s)+B(s)\Th(s)\big]X(s)+B(s)v(s)+b(s)\Big\}ds\\
\ns\ds\qq\qq\q+\Big\{\big[C(s)+D(s)\Th(s)\big]X(s)+D(s)v(s)+\si(s)\Big\}dW(s),
\qq s\in[t,T], \\
\ns\ds X(t)= x.\ea\right.\ee
Clearly, under (SG1), the above admits a unique solution
$X(\cd)\equiv X(\cd\,;t,x,\Th_1(\cd),v_1(\cd);\Th_2(\cd),v_2(\cd))$.
If we denote
$$u_i(\cd)=\Th_i(\cd)X(\cd)+v_i(\cd),\qq i=1,2,$$
then the above (\ref{state-closed}) coincides with the original
state equation (\ref{state}). We refer to (\ref{state-closed}) as
a {\it closed-loop system} of the original system. With the solution
$X(\cd)$ to (\ref{state-closed}), we denote
$$\ba{ll}
\ns\ds J\big(t,x;\Th_1(\cd)X(\cd)+v_1(\cd),\Th_2(\cd)X(\cd)+v_2(\cd)\big)
\equiv J(t,x;\Th(\cd)X(\cd)+v(\cd))\\
\ns\ds={1\over2}\,\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\q+\int_t^T\Big[\lan\begin{pmatrix}Q(s)&S(s)^T\\
S(s)&R(s)\end{pmatrix}\begin{pmatrix}
X(s)\\ \Th(s)X(s)+v(s)\end{pmatrix},
\begin{pmatrix}
X(s)\\ \Th(s)X(s)+v(s)\end{pmatrix}
\ran\\
\ns\ds\qq\qq+2\lan\begin{pmatrix}q(s)\\ \rho(s)
\end{pmatrix},\begin{pmatrix}X(s)\\ \Th(s)X(s)+v(s)\end{pmatrix}
\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\,\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\qq+\1n\int_t^T\2n\Big[\lan\begin{pmatrix}Q\1n+\1n\Th^T\1n
S\1n+\1n S^T\1n\Th\1n+\1n\Th^T\1n R\Th&
S^T\2n+\1n\Th^T\1n R\\
S+R\Th&R\end{pmatrix}\begin{pmatrix}
X\\ v\end{pmatrix},\begin{pmatrix}X\\ v
\end{pmatrix}\ran\1n
+2\lan\begin{pmatrix}q\1n+\1n\Th^T\1n\rho\\
\rho\end{pmatrix},\begin{pmatrix}X\\
v\end{pmatrix}\ran\Big]ds\Big\}.\ea$$
Similarly, one can define
$J(t,x;\Th_1(\cd)X(\cd)+v_1(\cd),u_2(\cd))$,
$J(t,x;u_1(\cd),\Th_2(\cd)X(\cd)+v_2(\cd))$. We now introduce the
following definition.
\ms
\bf Definition 3.2. \rm A 4-tuple
$(\Th_1^*(\cd),v_1^*(\cd);\Th_2^*(\cd),v_2^*(\cd))\in
\sQ_1[t,T]\times\cU_1[t,T]\times\sQ_2[t,T]\times\cU_2[t,T]$ is
called a {\it closed-loop saddle point} of Problem (SG) on $[t,T]$
if for any $x\in\dbR^n$ and
$(u_1(\cd),u_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$,
\bel{saddle-closed}\ba{ll}
\ns\ds J(t,x;\Th_1^*(\cd)X(\cd)+v_1^*(\cd),u_2(\cd))\les
J(t,x;\Th_1^*(\cd)X^*(\cd)+v_1^*(\cd),\Th_2^*(\cd)X^*(\cd)+v_2^*(\cd))\\
\ns\ds\qq\qq\qq\qq\qq\qq\q~\les
J(t,x;u_1(\cd),\Th_2^*(\cd)X(\cd)+v_2^*(\cd)).\ea\ee
\ms
There are some remarks in order.
\ms
(i) An open-loop saddle point $(u_1^*(\cd),u_2^*(\cd))$ usually
depends on the initial state $x$, whereas, a closed-loop saddle
point $(\Th_1^*(\cd),v_1^*(\cd);\Th_2^*(\cd),v_2^*(\cd))$ is
required to be independent of the initial state $x$.
\ms
(ii) In (\ref{saddle-closed}), the state process $X(\cd)$ appearing
in $J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),u_2(\cd))$ is different from
that in $J(t,x;u_1(\cd),\Th^*_2(\cd)X(\cd)+v_2^*(\cd))$; and both
are different from $X^*(\cd)\equiv
X(\cd\,;t,x,\Th_1^*(\cd),v_1^*(\cd);\Th_2^*(\cd),v_2^*(\cd))$ which
is the solution of (\ref{state-closed}) corresponding to
$$(\Th_1(\cd),v_1(\cd);\Th_2(\cd),v_2(\cd))=(\Th_1^*(\cd),v_1^*(\cd);
\Th_2^*(\cd),v_2^*(\cd)).$$
Therefore, comparing with (\ref{saddle-open}), we see that
(\ref{saddle-closed}) does not imply that
$(\Th_1^*(\cd)X^*(\cd)+v_1^*(\cd),\Th_2^*(\cd)X^*(\cd)+v_2^*(\cd))$
is an open-loop saddle point of Problem (SG), for the initial pair
$(t,X^*(t))$. This is different from Problem (SLQ) (for which the
outcome $\bar\Th(\cd)\bar X(\cd)+\bar v(\cd)$ of a closed-loop
optimal strategy $(\bar\Th(\cd),\bar v(\cd))$ is an open-loop
optimal control for the initial pair $(t,\bar X(t))$).
\ms
More precisely, let us comparing the following two inequalities:
\bel{open3.10}J(t,x;u_1^*(\cd),u_2^*(\cd))\les
J(t,x;u_1(\cd),u_2^*(\cd)),\ee
and
\bel{closed3.11}J(t,x;\Th_1^*(\cd)X^*(\cd)+v_1^*(\cd),\Th_2^*(\cd)X^*(\cd)+v_2^*(\cd))\les
J(t,x;u_1(\cd),\Th_2^*(\cd)X(\cd)+v_2^*(\cd)).\ee
For (\ref{open3.10}), we look at the following state equation:
$$\left\{\2n\ba{ll}
\ns\ds dX(s)=\big[A(s)X(s)+B_1(s)u_1(s)+B_2(s)u_2^*(s)+b(s)\big]ds\\
\ns\ds\qq\qq\q+\big[C(s)X(s)+D_1(s)u_1(s)+D_2(s)u_2^*(s)+\si(s)\big]dW(s),\q
s\in[t,T],\\
\ns\ds X(t)=x,\ea\right.$$
and the following cost functional
$$\ba{ll}
\ns\ds J_1(t,x;u_1(\cd))\equiv
J(t,x;u_1(\cd),u_2^*(\cd))={1\over2}\dbE\Big\{\lan
GX(T),X(T)\ran+2\lan g,X(T)\ran\\
\ns\ds\qq\qq+\int_t^T\Big[\lan QX,X\ran+2\lan S_1X,u_1\ran+\lan
R_{11}u_1,u_1\ran+\lan R_{22}u_2^*,u_2^*\ran+2\lan R_{12}u_2^*,u_1\ran\\
\ns\ds\qq\qq\qq\qq+2\lan S_2X,u_2^*\ran+2\lan
q,X\ran+2\lan\rho_1,u_1\ran+2\lan\rho_2,u_2^*\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran+\int_t^T\Big[\lan QX,X\ran+2\lan S_1X,u_1\ran+\lan
R_{11}u_1,u_1\ran\\
\ns\ds\qq\qq+2\lan
q+S_2^Tu_2^*,X\ran+2\lan\rho_1+R_{12}u_2^*,u_1\ran+\lan
R_{22}u_2^*,u_2^*\ran+2\lan\rho_2,u_2^*\ran\Big]ds\Big\}.\ea$$
Therefore, (\ref{open3.10}) holds if and only if $u_1^*(\cd)$ is an
open-loop optimal control of Problem (SLQ) with
\bel{3.12}\left\{\2n\ba{ll}
\ns\ds\wt A=A,\q\wt B=B_1,\q\wt b=b+B_2u_2^*,\q\wt C=C,\q\wt D=D_1,\q\wt\si=\si+D_2u_2^*,\\
\ns\ds\wt G=G,\q\wt g=g,\q\wt Q=Q,\q\wt S=S_1,\q\wt R=R_{11},\q\wt
q=q+S_2^Tu_2^*,\q\wt\rho=\rho_1+R_{12}u_2^*.\ea\right.\ee
However, for (\ref{closed3.11}), we look at the following state
equation:
$$\left\{\2n\ba{ll}
\ns\ds
dX_1(s)=\Big\{\big[A(s)+B_2(s)\Th_2^*(s)\big]X_1(s)+B_1(s)u_1(s)+B_2(s)v_2^*(s)+b(s)
\Big\}ds\\
\ns\ds\qq\qq\q+\Big\{\big[C(s)\1n+\1n
D_2(s)\Th_2^*(s)\big]X_1(s)\1n+\1n D_1(s)u_1(s)\1n+\1n
D_2(s)v_2^*(s)\1n
+\1n\si(s)\Big\}dW(s),\q s\in[t,T],\\
\ns\ds X_1(t)=x,\ea\right.$$
and the following cost functional
$$\ba{ll}
\ns\ds
\bar J_1(t,x;u_1(\cd))=J(t,x;u_1(\cd),\Th_2^*(\cd)X_1(\cd)+v_2^*(\cd))\\
\ns\ds={1\over2}\dbE\Big\{\lan GX_1(T),X_1(T)\ran+2\lan
g,X_1(T)\ran+\int_t^T\Big[\lan QX_1,X_1\ran+\lan
R_{11}u_1,u_1\ran\\
\ns\ds\qq\qq+\lan
R_{22}(\Th_2^*X_1+v_2^*),\Th_2^*X_1+v_2^*\ran+2\lan
S_1X_1,u_1\ran+2\lan S_2X_1,\Th_2^*X_1+v_2^*\ran\\
\ns\ds\qq\qq+2\lan R_{21}u_1,\Th_2^*X_1+v_2^*\ran+2\lan
q,X_1\ran+2\lan\rho_1,u_1\ran
+2\lan\rho_2,\Th_2^*X_1+v_2^*\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan GX_1(T),X_1(T)\ran+2\lan
g,X_1(T)\ran+\int_t^T\Big[\lan QX_1,X_1\ran+\lan
R_{11}u_1,u_1\ran\\
\ns\ds\qq\qq+\lan(\Th_2^*)^TR_{22}\Th_2^*X_1,X_1\ran+2\lan
(\Th_2^*)^TR_{22}v_2^*,X_1\ran+\lan R_{22}v_2^*,v_2^*\ran+2\lan
S_1X_1,u_1\ran\\
\ns\ds\qq\qq+\lan[S_2^T\Th_2^*+(\Th_2^*)^TS_2]X_1,X_1\ran +2\lan
S_2^Tv_2^*,X_1\ran+2\lan R_{12}\Th_2^*X_1,u_1\ran+2\lan
R_{12}v_2^*,u_1\ran\\
\ns\ds\qq\qq+2\lan
q,X_1\ran+2\lan\rho_1,u_1\ran+2\lan(\Th_2^*)^T\rho_2,X_1\ran+2\lan\rho_2,
v_2^*\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan GX_1(T),X_1(T)\ran+2\lan
g,X_1(T)\ran\\
\ns\ds\qq\qq+\int_t^T\Big[\lan[Q+(\Th_2^*)^TR_{22}\Th_2^*+(\Th_2^*)^TS_2
+S_2^T\Th_2^*]X_1,X_1\ran+\lan
R_{11}u_1,u_1\ran\\
\ns\ds\qq\qq+2\lan(S_1+R_{12}\Th_2^*)X_1,u_1\ran
+2\lan q+[S_2^T+(\Th_2^*)^TR_{22}]v_2^*+(\Th_2^*)^T\rho_2,X_1\ran\\
\ns\ds\qq\qq+2\lan\rho_1+R_{12}v_2^*,u_1\ran+\lan
R_{22}v_2^*,v_2^*\ran+2\lan\rho_2,v_2^*\ran\Big]ds\Big\}.\ea$$
Then, $(\Th_1^*(\cd),v_1^*(\cd))$ is a closed-loop optimal strategy
for a Problem (SLQ), with
\bel{3.13}\left\{\2n\ba{ll}
\ns\ds\wt A=A+B_2\Th_2^*,\q\wt B=B_1,\q\wt b=b+B_2v_2^*,\\
\ns\ds\wt C=C+D_2\Th_2^*,\q\wt D=D_1,\q\wt\si=\si+D_2v_2^*,\\
\ns\ds\wt
Q=Q+(\Th_2^*)^TR_{22}\Th_2^*+(\Th_2^*)^TS_2+S_2^T\Th_2^*,\q\wt
S=S_1+R_{12}\Th_2^*,\q\wt R=R_{11},\\
\ns\ds\wt q=q+[S_2^T+(\Th_2^*)^TR_{22}]v_2^*+(\Th_2^*)^T\rho_2,\q
\wt\rho=\rho_1+R_{12}v_2^*,\\
\ns\ds\wt G=G,\q\wt g=g.\ea\right.\ee
Comparing (\ref{3.12}) and (\ref{3.13}), we see that one cannot say
anything whether the outcome $\Th_1^*(\cd)X^*(\cd)+v_1^*(\cd)$ of
$(\Th_1^*(\cd),v_1^*(\cd))$ for the initial pair $(t,x)$ has
anything to do with $u_1^*(\cd)$.
\ms
On the other hand, the following result, which is similar to
Berkovitz's equivalence lemma for Problem (DG) found in
\cite{Berkovitz 1971}, will tells something a little differently and
will be useful below.
\ms
\bf Proposition 3.3. \sl Let {\rm(SG1)--(SG2)} hold. For
$(\Th_i^*(\cd),v_i^*(\cd))\in\sQ_i[t,T]\times\cU_i[t,T]$, the
following statements are equivalent:
\ms
{\rm(i)} $(\Th_1^*(\cd),v_1^*(\cd);\Th_2^*(\cd),v_2^*(\cd))$ is a
closed-loop saddle point of Problem {\rm(SG)} on $[t,T]$.
\ms
{\rm(ii)} For any $x\in\dbR^n$,
$(\Th_1(\cd),\Th_2(\cd))\in\sQ_1[t,T]\times\sQ_2[t,T]$ and
$(v_1(\cd),v_2(\cd))\in\cU_1[t,T]\times\cU_2[t,T]$, the following
holds:
\bel{}\ba{ll}
\ns\ds
J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),\Th_2(\cd)X(\cd)+v_2(\cd))\les
J(t,x;\Th^*_1(\cd)X^*(\cd)+v_1^*(\cd),\Th^*_2(\cd)X^*(\cd)+v_2^*(\cd))\\
\ns\ds\q\qq\qq\qq\qq\qq\qq\qq\qq\qq\les
J(t,x;\Th_1(\cd)X(\cd)+v_1(\cd),\Th^*_2(\cd)X(\cd)+v_2^*(\cd)).\ea\ee
{\rm(iii)} For any $x\in\dbR^n$ and $(v_1(\cd),v_2(\cd))\in
\cU_1[t,T]\times\cU_2[t,T]$, the following holds:
\bel{}\ba{ll}
\ns\ds
J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),\Th^*_2(\cd)X(\cd)+v_2(\cd))\les
J(t,x;\Th^*_1(\cd)X^*(\cd)+v_1^*(\cd),\Th^*_2(\cd)X^*(\cd)+v_2^*(\cd))\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\q\les
J(t,x;\Th^*_1(\cd)X(\cd)+v_1(\cd),\Th^*_2(\cd)X(\cd)+v_2^*(\cd)).\ea\ee
\ms
\it Proof. \rm (i) $\Ra$ (ii). For any $\Th_i(\cd)\in\sQ_i[t,T]$ and
$v_i(\cd)\in\cU_i[t,T]$, $i=1,2$, let $X(\cd)$ be the solution to
the following SDE:
\bel{}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\Big\{\big[A(s)+B_1(s)\Th_1(s)+B_2(s)\Th_2^*(s)\big]X(s)+B_1(s)v_1(s)
+B_2(s)v^*_2(s)+b(s)\Big\}ds \\
\ns\ds\qq\qq+\Big\{\big[C(s)\1n+\1n D_1(s)\Th_1(s)\1n+\1n
D_2(s)\Th^*_2(s)\big]X(s)\1n+\1n D_1(s)v_1(s)\1n+\1n
D_2(s)v^*_2(s)\1n+\1n\si(s)
\Big\}dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\1n\in\1n[t,T],\\
\ns\ds X(t)=x.\ea\right.\ee
Set
$$u_1(\cd)\deq\Th_1(\cd)X(\cd)+v_1(\cd)\in\cU_1[t,T].$$
By uniqueness, $X(\cd)$ also solves the following SDE:
\bel{}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\Big\{\big[A(s)+B_2(s)\Th^*_2(s)\big]X(s)+B_1(s)u_1(s)+B_2(s)v^*_2(s)+b(s)
\Big\}dt\\
\ns\ds\qq\qq+\Big\{\big[C(s)\1n+\1n D_2(s)\Th^*_2(s)\big]X(s)\1n+\1n
D_1(s)u_1(s)\1n+\1n D_2(s)v^*_2(s)\1n+\1n\si(s)\Big\}dW(s),
\q s\in[t,T],\\
\ns\ds X(t)=x.\ea\right.\ee
Therefore,
$$\ba{ll}
\ns\ds
J(t,x;\Th^*_1(\cd)X^*(\cd)+v_1^*(\cd),\Th^*_2(\cd)X^*(\cd)+v^*_2(\cd))
\les J(t,x;u_1(\cd),\Th^*_2(\cd)X(\cd)+v_2^*(\cd))\\
\ns\ds=J(t,x;\Th_1(\cd)X(\cd)+v_1(\cd),\Th^*_2(\cd)X(\cd)+v_2^*(\cd)).\ea$$
Similarly, we have
$$J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),\Th_2(\cd)X(\cd)+v_2(\cd))\les
J(t,x;\Th^*_1(\cd)X^*(\cd)+v^*_1(\cd),\Th^*_2(\cd)X^*(\cd)+v_2^*(\cd)).$$
\ms
(ii) $\Ra$ (iii) is trivial, by taking $\Th_i(\cd)=\Th^*_i(\cd)$,
$i=1,2$.
\ms
(iii) $\Ra$ (i). For any $x\in\dbR^n$, and any
$u_1(\cd)\in\cU_1[t,T]$, let $X(\cd)$ be the solution of the
following SDE:
\bel{}\left\{\2n\ba{ll}
\ns\ds dX(s)=\Big\{\big[A(s)+B_2(s)\Th^*_2(s)\big]X(s)+B_1(s)u_1(s)+B_2(s)v^*_2(s)+b(s)\Big\}ds\\
\ns\ds\qq\qq\q+\Big\{\big[C(s)+D_2(s)\Th^*_2(s)\big]X(s)+D_1(s)u_1(s)
+D_2(s)v^*_2(s)+\si(s)\Big\}dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\in[t,T],\\
\ns\ds X(t)=x.\ea\right.\ee
Set
$$v_1(\cd)=u_1(\cd)-\Th^*_1(\cd)X(\cd)\in\cU_1[t,T],$$
then $X(\cd)$ is also the solution to the following SDE:
\bel{}\left\{\2n\ba{ll}
\ns\ds
dX(s)=\Big\{\big[A(s)+B_1(s)\Th^*_1(s)+B_2(s)\Th^*_2(s)\big]X(s)
+B_1(s)v_1(s)+B_2(s)v^*_2(s)+b(s)\Big\}ds \\
\ns\ds\qq\qq+\Big\{\big[C(s)\1n+\1n D_1(s)\Th^*_1(s)\1n+\1n
D_2(s)\Th^*_2(s)\big]X(s)\1n+\1n D_1(s)v_1(s)\1n+\1n D_2(s)v^*_2(s)
\1n+\1n\si(s)\Big\}dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\in[t,T], \\
\ns\ds X(t)=x.\ea\right.\ee
Therefore,
$$\ba{ll}
\ns\ds
J(t,x;\Th^*_1(\cd)X^*(\cd)+v_1^*(\cd),\Th_2^*(\cd)X^*(\cd)+v^*_2(\cd))
\les
J(t,x;\Th^*_1(\cd)X(\cd)+v_1(\cd),\Th^*_2(\cd)X^*(\cd)+v^*_2(\cd))\\
\ns\ds=J(t,x;u_1(\cd),\Th^*_2(\cd)X^*(\cd)+v_2^*(\cd)).\ea$$
Similarly, for any $x\in\dbR^n$, and any $u_2(\cd)\in\cU_2[t,T]$, we can show that
$$J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),u_2(\cd))\les
J(t,x;\Th_1^*(\cd)X^*(\cd)+v^*_1(\cd),\Th^*_2(\cd)X^*(\cd)+v_2^*(\cd)).$$
Thus, (i) holds.\endpf
\ms
We note that (iii) of Proposition 3.3 tells us that if we consider
the following state equation (denoting $\Th^*(\cd)=(\Th_1^*(\cd)^T,\Th_2^*(\cd)^T)^T$)
\bel{3.20}\left\{\2n\ba{ll}
\ns\ds dX=\Big\{(A+B\Th^*)X+B_1v_1+B_2v_2^*+b\Big\}ds\\
\ns\ds\qq\qq+\Big\{(C+D\Th^*)X+D_1v_1+D_2v^*_2+\si\Big\}dW(s),\\
\ns\ds X(t)=x,\ea\right.\ee
with the cost functional
\bel{3.21}J_1(t,x;v_1(\cd))=J(t,x;\Th^*_1(\cd)X(\cd)+v_1(\cd),
\Th^*_2(\cd)X(\cd)+v_2^*(\cd)),\ee
then $v_1^*(\cd)$ is an open-loop optimal control of the
corresponding Problem (SLQ). Likewise, if we consider the following
state equation
\bel{3.22}\left\{\2n\ba{ll}
\ns\ds dX=\Big\{(A+B\Th^*)X+B_2v_2+B_1v_1^*+b\Big\}ds\\
\ns\ds\qq\qq+\Big\{(C+D\Th^*)X+D_2v_2+D_1v^*_1+\si\Big\}dW(s),\\
\ns\ds X(t)=x,\ea\right.\ee
with the cost functional
\bel{3.23}J_2(t,x;v_2(\cd))=-J(t,x;\Th^*_1(\cd)X(\cd)+v_1^*(\cd),
\Th^*_2(\cd)X(\cd)+v_2(\cd)),\ee
then $v_2^*(\cd)$ is an open-loop optimal control of the
corresponding Problem (SLQ). The above observation will be useful
below.
\section{Open-Loop Saddle Points and FBSDEs}
In this section, we present a characterization of open-loop saddle
points of Problem (SG) in terms of forward-backward stochastic
differential equations (FBSDE, for short). See \cite{Ma-Yong 1999}
for some relevant results on FBSDEs. The main result of this section
can be stated as follows.
\ms
\bf Theorem 4.1. \sl Let {\rm(SG1)--(SG2)} hold and let
$(t,x)\in[t,T)\times\dbR^n$ be given. Let
$u^*(\cd)\equiv(u_1^*(\cd)^T\2n,u_2^*(\cd)^T\1n)^T\2n\in\cU_1[t,T]\times\cU_2[t,T]$
and $X^*(\cd)\equiv X(\cd\,;t,x,u^*(\cd))$ be the corresponding
state process. Then $u^*(\cd)$ is an open-loop saddle point of
Problem {\rm(SG)} if and only if the following stationarity
conditions hold:
\bel{4.2}B(s)^TY^*(s)+D(s)^TZ^*(s)+S(s)X^*(s)+R(s)u^*(s)+\rho(s)=0,\q
\ae s\in[t,T],~\as\ee
where $(Y^*(\cd),Z^*(\cd))$ is the adapted solution to the following
BSDE:
\bel{BSDE4.1}\left\{\2n\ba{ll}
dY^*(s)=-\big[A(s)^TY^*(s)+C(s)^TZ^*(s)+Q(s)X^*(s)+S(s)^Tu^*(s)+q(s)\big]ds
+Z^*(s)dW(s),\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq\qq s\in[t,T],\\
\ns\ds Y^*(T)=GX^*(T)+g,\ea\right.\ee
and the following convexity-concavity conditions hold: For $i=1,2$,
\bel{convex-concave4.3}\ba{ll}
\ns\ds(-1)^{i-1}\dbE\Big\{\lan GX_i(T),X_i(T)\ran+\int_t^T\Big[\lan
Q(s)X_i(s),X_i(s)\ran+2\lan S_i(s)X_i(s),u_i(s)\ran\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq+\lan
R_{ii}(s)u_i(s),u_i(s)\ran\Big]ds\Big\}\ges0,\qq\forall
u_i(\cd)\in\cU_i[t,T],\ea\ee
where $X_i(\cd)$ solves the following:
\bel{Xi}\left\{\2n\ba{ll}
\ns\ds dX_i(s)=\big[A(s)X_i(s)+B_i(s)u_i(s)\big]ds
+\big[C(s)X_i(s)+D_i(s)u_i(s)\big]dW(s),\q s\in[t,T],\\
\ns\ds X_i(t)=0.\ea\right.\ee
\it Proof. \rm Let
$u^*(\cd)\equiv(u_1^*(\cd)^T,u_2^*(\cd)^T)^T\in\cU_1[t,T]\times\cU_2[t,T]$
and $X^*(\cd)$ be the corresponding state process. Further, let
$(Y^*(\cd),Z^*(\cd))$ be the adapted solution to the BSDE
(\ref{BSDE4.1}). For any $u_1(\cd)\in\cU_1[t,T]$ and $\e\in\dbR$,
let $X^\e(\cd)$ be the solution to the following perturbed state
equation:
$$\left\{\2n\ba{ll}
\ns\ds dX^\e(s)=\big\{A(s)X^\e(s)+B_1(s)[u_1^*(s)+\e
u_1(s)]+B_2(s)u_2^*(s)+b(s)\big\}ds\\
\ns\ds\qq\qq\q+\big\{C(s)X^\e(s)+D_1(s)[u_1^*(s)+\e
u_1(s)]+D_2(s)u_2^*(s)+\si(s)\big\}dW(s),\q s\in[t,T],\\
\ns\ds X^\e(t)=x.\ea\right.$$
Then $X_1(\cd)={X^\e(\cd)-X^*(\cd)\over\e}$ is independent of $\e$
satisfying (\ref{Xi}) (with $i=1$), and
$$\ba{ll}
\ns\ds J(t,x;u^*_1(\cd)+\e u_1(\cd),u_2^*(\cd))
-J(t,x;u_1^*(\cd),u_2^*(\cd))\\
\ns\ds={\e\over2}\dbE\Big\{\lan G\big[2X^*(T)+\e
X_1(T)\big],X_1(T)\ran
+2\lan g,X_1(T)\ran\\
\ns\ds\qq+\int_t^T\Big[\lan\begin{pmatrix}Q&S_1^T&S_2^T\\
S_1&R_{11}&R_{12}\\
S_2&R_{21}&R_{22}\end{pmatrix}
\begin{pmatrix}2X^*+\e X_1\\
2u_1^*+\e u_1\\
2u_2^*\end{pmatrix},
\begin{pmatrix}X_1\\
u_1\\
0\end{pmatrix}\ran
+2\lan\begin{pmatrix}q\\
\rho_1\end{pmatrix},
\begin{pmatrix}X_1\\
u_1\end{pmatrix}\ran\Big]ds\Big\}\\
\ns\ds=\e\dbE\Big\{\lan GX^*(T)+g,X_1(T)\ran\\
\ns\ds\qq+\int_t^T\Big[\lan QX^*+S^Tu^*+q,X_1\ran+\lan
S_1X^*+R_{11}u_1^*+R_{12}u_2^*+\rho_1,u_1\ran\Big]ds\Big\}\\
\ns\ds\qq+{\e^2\over2}\dbE\Big\{\lan
GX_1(T),X_1(T)\ran+\int_t^T\Big[\lan QX_1,X_1\ran+2\lan
S_1X_1,u_1\ran+\lan R_{11}u_1,u_1\ran\Big]ds\Big\}.\ea$$
On the other hand, we have
$$\ba{ll}
\ns\ds\dbE\Big\{\lan GX^*(T)+g,X_1(T)\ran+\int_t^T\Big[\lan Q
X^*+S^Tu^*+q,X_1\ran+\lan S_1X^*+R_{11}u_1^*+R_{12}u_2^*+\rho_1,u_1\ran\Big]ds\Big\}\\
\ns\ds\q=\dbE\Big\{\int_t^T\Big[\lan-(A^TY^*+C^TZ^*+QX^*+S^Tu^*+q),
X_1\ran+\lan Y^*,AX_1+B_1u_1\ran+\lan Z^*,CX_1+D_1u_1\ran\\
\ns\ds\qq\qq\qq+\lan QX^*+S^Tu^*+q,X_1\ran+\lan
S_1X^*+R_{11}u^*_1+R_{12}u_2^*+\rho_1,u_1\ran\Big]ds\Big\}\\
\ns\ds\q=\dbE\int_t^T\lan
B_1^TY^*+D_1^TZ^*+S_1X^*+R_{11}u_1^*+R_{12}u_2^*+\rho_1,u_1\ran
ds.\ea$$
Hence,
$$\ba{ll}
\ns\ds J(t,x;u^*_1(\cd)+\e u_1(\cd),u_2^*(\cd))
-J(t,x;u_1^*(\cd),u_2^*(\cd))\\
\ns\ds=\e\dbE\Big\{\int_t^T\lan
B_1^TY^*+D_1^TZ^*+S_1X^*+R_{11}u_1^*+R_{12}u_2^*+\rho_1,u_1\ran
ds\Big\}\\
\ns\ds\q+{\e^2\over2}\dbE\Big\{\lan
GX_1(T),X_1(T)\ran+\int_t^T\Big[\lan QX_1,X_1\ran+2\lan
S_1X_1,u_1\ran+\lan R_{11}u_1,u_1\ran\Big]ds\Big\}.\ea$$
Therefore,
$$J(t,x;u_1^*(\cd),u_2^*(\cd))\les J(t,x;u_1^*(\cd)+\e u_1(\cd),u_2^*(\cd)),\qq\forall
u_1(\cd)\in\cU_1[t,T],\q\e\in\dbR,$$
if and only if (\ref{convex-concave4.3}) holds for $i=1$, and
\bel{4.5}B_1^TY^*+D_1^TZ^*+S_1X^*+R_{11}u_1^*+R_{12}u_2^*+\rho_1=0,\q
\ae s\in[t,T],~\as\ee
Similarly,
$$J(t,x;u_1^*(\cd),u_2^*(\cd))\ges J(t,x;u_1^*(\cd),u_2^*(\cd)+\e u_2(\cd)),\qq\forall
u_2(\cd)\in\cU_2[t,T],\q\e\in\dbR,$$
if and only if (\ref{convex-concave4.3}) holds for $i=2$, and
\bel{4.6}B_2^TY^*+D_2^TZ^*+S_2X^*+R_{21}u_1^*+R_{22}u_2^*+\rho_2=0,\q
\ae s\in[t,T],~\as\ee
Combining (\ref{4.5})--(\ref{4.6}), we obtain (\ref{4.2}).\endpf
\ms
From the above result, we see that if Problem (SG) admits an
open-loop saddle point
$u^*(\cd)\equiv(u_1^*(\cd)^T,u_2^*(\cd)^T)^T$, then the following
FBSDE admits an adapted solution
$(X^*(\cd),Y^*(\cd),Z^*(\cd),u^*(\cd))$:
\bel{FBSDE}\left\{\2n\ba{ll}
\ns\ds dX^*(s)\1n=\1n\big[A(s)X^*(s)\1n+\1n B(s)u^*(s)\1n+\1n
b(s)\big]ds\1n+\1n\big[C(s)X^*(s)\1n+\1n
D(s)u^*(s)\1n+\1n\si(s)\big]dW(s),
~s\in[t,T],\\
\ns\ds
dY^*(s)=-\big[A(s)^TY^*(s)+C(s)^TZ^*(s)+Q(s)X^*(s)+S(s)^Tu^*(s)+q(s)\big]ds\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq+Z^*(s)dW(s),\q s\in[t,T],\\
\ns\ds X^*(t)=x,\qq Y^*(T)=GX^*(T)+g,\\
\ns\ds B(s)^TY^*(s)+D(s)^TZ^*(s)+S(s)X^*(s)+R(s)u^*(s)+\rho(s)=0,\q
\ae s\in[t,T],~\as\ea\right.\ee
The following result is concerned with the uniqueness of open-loop
saddle points.
\ms
\bf Theorem 4.2. \sl Let {\rm(SG1)--(SG2)} hold, and let
$(t,x)\in[0,T)\times\dbR^n$ be given. Suppose Problem {\rm(SG)}
admits a unique open-loop saddle point $u^*(\cd)$ at $(t,x)$. Then
FBSDE $(\ref{FBSDE})$ admits a unique adapted solution
$(X^*(\cd),Y^*(\cd),Z^*(\cd),u^*(\cd))$. Conversely, if the
convexity-concavity conditions stated in Theorem 4.1 holds and BFSDE
$(\ref{FBSDE})$ admits a unique adapted solution
$(X^*(\cd),Y^*(\cd),Z^*(\cd),u^*(\cd))$, then $u^*(\cd)$ is the
unique saddle point of Problem {\rm(SG)}.
\ms
\it Proof. \rm Suppose $u^*(\cd)\in\cU[t,T]$ is a unique open-loop
saddle point of Problem (SG). Then by Theorem 4.1, FBSDE
(\ref{FBSDE}) admits an adapted solution
$(X^*(\cd),Y^*(\cd),Z^*(\cd),u^*(\cd))$, and the convex-concave
conditions (\ref{convex-concave4.3}) hold. Now, if FBSDE
(\ref{FBSDE}) admits another different adapted solution $(\bar
X(\cd),\bar Y(\cd),\bar Z(\cd),\bar u(\cd))$. Since the
convexity-concavity conditions are satisfied, by the sufficiency
part of Theorem 4.1, $\bar u(\cd)$ is a different open-loop saddle
point, a contradiction.
\ms
Conversely, if Problem (SG) has two different open-loop saddle
points, then FBSDE (\ref{FBSDE}) will have two different adapted
solutions. \endpf
\section{Closed-Loop Saddle Points and Riccati Equations}
We now look at closed-loop saddle points for Problem (SG). First, we
present the following result which is a consequence of Theorem 4.1.
\ms
\bf Proposition 5.1. \sl Let {\rm(SG1)--(SG2)} hold. Let
$(\Th^*(\cd),v^*(\cd))\in\sQ[t,T]\times\cU[t,T]$ be a closed-loop
saddle point of Problem {\rm(SG)}. Then the following FBSDE admits
an adapted solution $(X^*(\cd),Y^*(\cd),Z^*(\cd))$:
\bel{FBSDE5.1}\left\{\2n\ba{ll}
\ns\ds
dX^*=\big\{(A+B\Th^*)X^*+Bv^*+b\big\}ds+\big\{(C+D\Th^*)X^*+Dv^*+\si\big\}dW(s),
\q s\in[t,T],\\
\ns\ds
dY^*(s)=-\big\{A^TY^*+C^TZ^*+(Q+S^T\Th^*)X^*+S^Tv^*+q\big\}ds+Z^*dW(s),\\
\ns\ds X^*(t)=x,\qq Y^*(T)=GX^*(T)+g,\ea\right.\ee
and the following stationarity condition holds:
\bel{}Rv^*+B^TY^*+D^TZ^*+(S+R\Th^*)X^*+\rho=0,\q \ae~\as\ee
\it Proof. \rm Let $(\Th^*(\cd),v^*(\cd))\in\sQ[t,T]\times\cU[t,T]$
be a closed-loop saddle point of Problem (SG) with
$\Th^*(\cd)=(\Th_1^*(\cd)^T,\Th_2^*(\cd)^T)^T$ and
$v^*(\cd)=(v_1^*(\cd)^T,v_2^*(\cd)^T)^T$. We consider state equation
(\ref{3.20}) with the cost functional (\ref{3.21}) for which we
carry out some computation: (denoting $\wt v=(v_1^T,(v_2^*)^T)^T$)
$$\ba{ll}
\ns\ds J_1(t,x;v_1(\cd))\equiv
J(t,x;\Th^*X(\cd)+\wt v(\cd))\\
\ns\ds={1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran+\int_t^T\Big[\lan QX,X\ran+2\lan
SX,\Th^*X+\wt v\ran\\
\ns\ds\qq\q+\lan R(\Th^*X+\wt v),\Th^*X+\wt v\ran+2\lan
q,X\ran+2\lan\rho,\Th^*X+\wt v\ran\Big]
ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran+\int_t^T\Big[\lan[Q+(\Th^*)^TS+S^T\Th^*+(\Th^*)^TR\Th^*]X,X\ran\\
\ns\ds\qq\q+2\lan\begin{pmatrix}(S_1+R_1\Th^*)X\\ (S_2+R_2\Th^*)X\end{pmatrix},\begin{pmatrix}v_1\\
v_2^*\end{pmatrix}\ran+\lan\begin{pmatrix}R_{11}&R_{12}\\
R_{21}&R_{22}\end{pmatrix}\begin{pmatrix}v_1\\
v_2^*\end{pmatrix},\begin{pmatrix}v_1\\
v_2^*\end{pmatrix}\ran\\
\ns\ds\qq\q+2\lan
q+(\Th^*)^T\rho,X\ran+2\lan\begin{pmatrix}\rho_1\\ \rho_2\end{pmatrix},\begin{pmatrix}v_1\\
v_2^*\end{pmatrix}\ran\Big] ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran+\int_t^T\Big[\lan[Q+(\Th^*)^TS+S^T\Th^*+(\Th^*)^TR\Th^*]X,X\ran\\
\ns\ds\qq\q+2\lan(S_1+R_1\Th^*)X,v_1\ran+2\lan
q+(\Th^*)^T\rho+(S_2+R_2\Th^*)^Tv_2^*,X\ran\\
\ns\ds\qq\q+\lan R_{11}v_1,v_1\ran+2\lan\rho_1+R_{12}v_2^*,v_1\ran
+\lan R_{22}v_2^*,v_2^*\ran+2\lan\rho_2,v_2^*\ran\Big]
ds\Big\}.\ea$$
We know that $v_1^*(\cd)$ is an open-loop optimal control for the
problem with state equation (\ref{3.20}) and the above cost
functional. Thus, according to Theorem 4.1, we have
$$\ba{ll}
\ns\ds0=B^T_1Y^*+D_1^TZ^*+(S_1+R_1\Th^*)X^*+R_{11}v_1^*+\rho_1+R_{12}v_2^*,\q \ae~\as\ea$$
with $(Y^*(\cd),Z^*(\cd))$ being the adapted solution to the
following BSDE:
$$\ba{ll}
\ns\ds
dY^*=-\big\{(A+B\Th^*)^TY^*+(C+D\Th^*)^TZ^*+[Q+(\Th^*)^TS+S^T\Th^*+(\Th^*)^TR\Th^*]
X^*\\
\ns\ds\qq\qq+(S_1+R_1\Th^*)^Tv_1^*+q+(\Th^*)^T\rho+(S_2+R_2\Th^*)^Tv_2^*\big\}ds+Z^*dW\\
\ns\ds\qq=-\big\{A^TY^*+C^TZ^*+QX^*+S^T(\Th^*X^*+v^*)+q\\
\ns\ds\qq\qq+(\Th^*)^T[B^TY^*+D^TZ^*+SX^*+R(\Th^*X^*+v^*)+\rho]\big\}ds+Z^*dW\\
\ns\ds Y^*(T)=GX^*(T)+g.\ea$$
Likewise, by considering state equation (\ref{3.22}) and payoff
functional (\ref{3.23}), we can obtain
$$\ba{ll}
\ns\ds0=B^T_2Y^*+D_2^TZ^*+(S_2+R_2\Th^*)X^*+R_{21}v_1^*+\rho_2+R_{22}v_2^*,\q \ae~\as\ea$$
with $(Y^*(\cd),Z^*(\cd))$ being the adapted solution to the same
BSDE as above. Thus,
$$\ba{ll}
\ns\ds0=B^TY^*+D^TZ^*+(S+R\Th^*)X^*+Rv^*+\rho,\q \ae~\as\ea$$
Then the above BSDE is reduced to that in (\ref{FBSDE5.1}). \endpf
\ms
The following result gives a characterization for closed-loop saddle
points of Problem (SG).
\ms
\bf Theorem 5.2. \sl Let {\rm(SG1)--(SG2)} hold. Then Problem
{\rm(SG)} admits a closed-loop saddle point
$(\Th^*(\cd),v^*(\cd))\in\sQ[t,T]\times\cU[t,T]$ with
$\Th^*(\cd)\equiv(\Th_1^*(\cd)^T,\Th_2^*(\cd)^T)^T$ and
$v^*(\cd)\equiv(v_1^*(\cd)^T,v_2^*(\cd)^T)^T$ if and only if the
following Riccati equation:
\bel{Riccati}\left\{\2n\ba{ll}
\ns\ds\dot P(s)+P(s)A(s)+A(s)^TP(s)+C(s)^TP(s)C(s)+Q(s)\\
\ns\ds\q-\big[P(s)B(s)+C(s)^TP(s)D(s)+S(s)^T\big]\big[R(s)+D(s)^T
P(s)D(s)\big]^\dag\\
\ns\ds\qq\cd\big[B(s)^TP(s)
+D(s)^TP(s)C(s)+S(s)\big]=0,\qq \ae s\in[t,T],\\
\ns\ds P(T)=G,\ea\right.\ee
admits a solution $P(\cd)\in C([t,T];\dbS^n)$ such that
\bel{5.2}\cR\big(B(s)^TP(s)+D(s)^TP(s)C(s)+S(s)\big)\subseteq\cR\big(R(s)+D(s)^TP(s)D(s)\big),\q
\ae s\in[t,T],\ee
\bel{th
L2}\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag\big[B(\cd)^TP(\cd)
+D(\cd)^TP(\cd)C(\cd)+S(\cd)\big] \in L^2(t,T;\dbR^{m\times n}),\ee
\bel{5.6}R_{11}(s)+D_1(s)^TP(s)D_1(s)\ges0,\q
R_{22}(s)+D_2(s)^TP(s)D_2(s)\les0,\q\ae s\in[t,T],\ee
and the adapted solution $(\eta(\cd),\z(\cd))$ of the
following BSDE:
\bel{5.8}\left\{\2n\ba{ll}
\ns\ds d\eta=-\Big\{\big[A^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
B^T\big]\eta\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag D^T\big]\z\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T\big]P\si\\
\ns\ds\qq\qq-(PB+C^TPD+S^T)(R+D^TPD)^\dag
\rho+Pb+q\Big\}ds+\z dW(s),\\
\ns\ds\eta(T)=g,\ea\right.\ee
satisfies
\bel{}B(s)^T\eta(s)+D(s)^T\z(s)+D(s)^TP(s)\si(s)+\rho(s)\in\cR\big(R(s)+D(s)^TP(s)D(s)\big),
\q \ae s\in[t,T],~\as\ee
and
\bel{v
L2}\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag\big[B(\cd)^T\eta(\cd)+D(\cd)^T\z(\cd)
+D(\cd)^TP(\cd)\si(\cd)+\rho(\cd)\big]\in L_\dbF^2(t,T;\dbR^m).\ee
In this case, the closed-loop saddle point $(\Th^*(\cd),v^*(\cd))$
admits the following representation:
\bel{5.10}\left\{\2n\ba{ll}
\ns\ds\Th^*(\cd)=-[R(\cd)+D(\cd)^TP(\cd)D(\cd)]^\dag[B(\cd)^TP(\cd)
+D(\cd)^TP(\cd)C(\cd)+S(\cd)]\\
\ns\ds\qq\qq+\big\{I-\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag
\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]\big\}\th(\cd),\\
\ns\ds
v^*(\cd)=-\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag\big[B(\cd)^T\eta(\cd)
+D(\cd)^T\z(\cd)+D(\cd)^TP(\cd)\si(\cd)+\rho(\cd)\big]\\
\ns\ds\qq\qq+\big\{I-\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)\big]^\dag
\big[R(\cd)+D(\cd)^TP(\cd)D(\cd)]\big\}\n(\cd),\ea\right.\ee
for some $\th(\cd)\in L^2(t,T;\dbR^{m\times n})$ and $\n(\cd)\in L_\dbF^2(t,T;\dbR^m)$.
\ms
Further, the value function admits the following representation:
\bel{Value}\ba{ll}
\ns\ds V(t,x)={1\over2}\,\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\1n\int_t^T\3n\big[\lan
P\si,\si\ran\1n+\1n2\lan\eta,b\ran+\1n2\lan\z,\si\ran\\
\ns\ds\qq\qq\qq\q-\1n \lan(R\1n+\1n D^T\1n
PD)^\dag(B^T\1n\eta\1n+D^T\1n\z\1n+\1n D^T\1n P\si\1n+\1n\rho),B^T\1n\eta\1n+D^T\1n\z\1n+\1n
D^T\1n P\si\1n+\1n\rho\ran\big]ds\Big\}.\ea\ee
\ms
\it Proof. \rm {\it Necessity.} Let $(\Th^*(\cd),v^*(\cd))$ be a
closed-loop saddle point of Problem (SG) over $[t,T]$, where
$\Th^*(\cd)\equiv(\Th^*_1(\cd)^T,\Th^*_2(\cd)^T)^T\in\sQ_1[t,T]\times\sQ_2[t,T]$
and
$v^*(\cd)\equiv(v_1^*(\cd)^T,v_2^*(\cd)^T)^T\in\cU_1[t,T]\times\cU_2[t,T]$.
Then, by Proposition 5.1, for any $x\in\dbR^n$, the following FBSDE
admits an adapted solution $(X^*(\cd),Y^*(\cd),Z^*(\cd))$:
\bel{}\left\{\2n\ba{ll}
\ns\ds
dX^*=\big\{(A+B\Th^*)X^*+Bv^*+b\big\}ds+\big\{(C+D\Th^*)X^*+Dv^*+\si\big\}dW(s),
\q s\in[t,T],\\
\ns\ds
dY^*(s)=-\big\{A^TY^*+C^TZ^*+(Q+S^T\Th^*)X^*+S^Tv^*+q\big\}ds+Z^*dW(s),\\
\ns\ds X^*(t)=x,\qq Y^*(T)=GX^*(T)+g,\ea\right.\ee
and the following stationarity condition holds:
\bel{5.9}B^TY^*+D^TZ^*+(S+R\Th^*)X^*+Rv^*+\rho=0,\q\ae~\as\ee
Since the above admits a solution for each $x\in\dbR^n$, and
$(\Th^*(\cd),v^*(\cd))$ is independent of $x$, by subtracting
solutions corresponding $x$ and $0$, the later from the former, we
see that for any $x\in\dbR^n$, as long as $(X(\cd),Y(\cd),Z(\cd))$
is the adapted solution to the following FBSDE:
\bel{FBSDE-closed}\left\{\2n\ba{ll}
\ns\ds dX=(A+B\Th^*)Xds+(C+D\Th^*)XdW(s),\q s\in[t,T],\\
\ns\ds
dY=-\big[A^TY+C^TZ+(Q+S^T\Th^*)X\big]ds+ZdW(s),\q s\in[t,T],\\
\ns\ds X(t)=x,\qq Y(T)=GX(T),\ea\right.\ee
one must have the following stationarity condition:
\bel{5.11}B^TY+C^TZ+(S+R\Th^*)X=0,\q \ae s\in[t,T],~\as\ee
Now, we let
\bel{}\left\{\2n\ba{ll}
\ns\ds d\dbX(s)=\big[A(s)+B(s)\Th^*(s)\big]\dbX(s)ds
+\big[C(s)+D(s)\Th^*(s)\big]\dbX(s)dW(s),\q s\in[t,T],\\
\ns\ds\dbX(t)=I,\ea\right.\ee
and let
\bel{}\left\{\2n\ba{ll}
\ns\ds
d\dbY(s)=\big\{-A(s)^T\dbY(s)-C(s)^T\dbZ(s)-\big[Q(s)+S(s)^T\Th^*(s)\big]
\dbX(s)\big\}ds\\
\ns\ds\qq\qq\qq\qq\qq\qq\qq\qq\qq+\dbZ(s)dW(s),\qq s\in[t,T],\\
\ns\ds\dbY(T)=G\dbX(T).\ea\right.\ee
Clearly, $\dbX(\cd)$, $\dbY(\cd)$, and $\dbZ(\cd)$ are all
well-defined square matrix valued processes. Further, (\ref{5.11})
implies
\bel{5.14}B(s)^T\dbY(s)+D(s)^T\dbZ(s)+\big[S(s)+R(s)\Th^*(s)\big]\dbX(s)=0,
\q \ae s\in[t,T],~\as\ee
Clearly, $\dbX(\cd)^{-1}$ exists and satisfies the following:
\bel{}\left\{\2n\ba{ll}
\ns\ds
d\big[\dbX(s)^{-1}]=\dbX(s)^{-1}\big\{\big[C(s)+D(s)\Th^*(s)\big]^2
-A(s)-B(s)\Th^*(s)\big\}ds\\
\ns\ds\qq\qq\qq-\dbX(s)^{-1}\big[C(s)+D(s)\Th^*(s)\big]dW(s),\qq s\in[t,T],\\
\ns\ds\dbX(t)^{-1}=I.\ea\right.\ee
We define
$$P(\cd)=\dbY(\cd)\dbX(\cd)^{-1},\qq\Pi(\cd)=\dbZ(\cd)\dbX(\cd)^{-1}.$$
Then (\ref{5.14}) implies
\bel{5.16}B^TP+D^T\Pi+(S+R\Th^*)=0,\q\ae\ee
Also, by It\^o's formula,
$$\ba{ll}
\ns\ds
dP\1n=\1n\Big\{\1n-\1n\big[A^T\dbY+C^T\dbZ+(Q+S^T\Th^*)\dbX\big]\dbX^{-1}\2n
+\1n\dbY\dbX^{-1}\big[(C\1n+D\Th^*)^2-A-B\Th^*\big]
-\dbZ\dbX^{-1}(C\1n+D\Th^*)\Big\}ds\\
\ns\ds\qq\qq+\Big\{\dbZ\dbX^{-1}-\dbY\dbX^{-1}(C+D\Th^*)\Big\}dW(s)\\
\ns\ds\qq=\Big\{-A^TP-C^T\Pi-Q-S^T\Th^*
+P\big[(C\1n+D\Th^*)^2-A-B\Th^*\big]
-\Pi(C\1n+D\Th^*)\Big\}ds\\
\ns\ds\qq\qq+\Big\{\Pi-P(C+D\Th^*)\Big\}dW(s).\ea$$
Let
$$\L=\Pi-P(C+D\Th^*).$$
Then
$$\ba{ll}
\ns\ds dP=\Big\{-A^TP-C^T[\L+P(C+D\Th^*)]-Q-S^T\Th^*
+P\big[(C\1n+D\Th^*)^2-A-B\Th^*\big]\\
\ns\ds\qq\qq-[\L+P(C+D\Th^*)](C\1n+D\Th^*)\Big\}ds+\L
dW(s)\\
\ns\ds\q~=\1n\Big\{\1n-\1n PA\1n-\1n A^T\1n P\1n-\1n\L C\1n-\1n
C^T\1n\L\1n-\1n C^T\1n PC\1n-\1n(PB\1n+\1n C^T\1n PD\1n+\1n
S^T\2n+\1n\L D)\Th^*\1n-\1n Q\Big\}ds\1n+\1n\L dW(s),\ea$$
and $P(T)=G$. Thus, $(P(\cd),\L(\cd))$ is the adapted solution of a
BSDE with deterministic coefficients. Hence, $P(\cd)$ is
deterministic and $\L(\cd)=0$ which means
\bel{}\Pi=\dbZ\dbX^{-1}=P(C+D\Th^*).\ee
Therefore,
\bel{2.65}\dot P+PA+A^TP+C^TPC+(PB+C^TPD+S^T)\Th^*+Q=0,\q\ae\ee
and (\ref{5.16}) becomes
\bel{5.20}0=B^TP+D^TP(C+D\Th^*)+S+R\Th^*
=B^TP+D^TPC+S+(R+D^TPD)\Th^*,\q\ae\ee
This implies
$$\cR\big(B^TP+D^TPC+S\big)\subseteq\cR\big(R+D^TPD\big),\q\ae$$
Using (\ref{5.20}), (\ref{2.65}) can be written as
$$\ba{ll}
\ns\ds0=\dot P+P(A+B\Th^*)+(A+B\Th^*)^TP+(C+D\Th^*)^TP(C+D\Th^*)\\
\ns\ds\qq\q+(\Th^*)^TR\Th^*+S^T\Th^*+(\Th^*)^TS+Q,\q\ae\ea$$
Since $P(T)=G\in\dbS^n$ and $Q(\cd),R(\cd)$ are symmetric, by uniqueness,
we must have $P(\cd)\in C([t,T];\dbS^n)$.
Denoting $\h R=R+D^TPD$, since
$$\h R^\dag(B^TP+D^TPC+S)=-\h R^\dag\h R\Th^*,$$
and $\h R^\dag\h R$ is an orthogonal projection,
we see that (\ref{th L2}) holds and
$$\Th^*=-\h R^\dag(B^TP+D^TPC+S)+\big(I-\h R^\dag\h R\,\big)\th$$
for some $\th(\cd)\in L^2(t,T;\dbR^{m\times n})$. Consequently,
\bel{5.21}\ba{ll}
\ns\ds(PB+C^TPD+S^T)\Th^*=(\Th^*)^T\h R\h
R^\dag(B^TP+D^TPC+S)\\
\ns\ds=-(PB+C^TPD+S^T)\h R^\dag(B^TP+D^TPC+S).\ea\ee
Plug the above into (\ref{2.65}), we obtain Riccati equation
(\ref{Riccati}). To determine $v^*(\cd)$, we define
$$\left\{\2n\ba{ll}
\ns\ds\eta=Y^*-PX^*,\\
\ns\ds\z=Z^*-P(C+D\Th^*)X^*-PDv^*-P\si.\ea\right.\qq s\in[t,T].$$
Then
$$\ba{ll}
\ns\ds d\eta=dY^*-\dot PX^*ds-PdX^*\\
\ns\ds\qq=-\big[A^TY^*+C^TZ^*+(Q+S^T\Th^*)X^*+S^Tv^*+q\big]ds+Z^*dW\\
\ns\ds\qq\q+\Big\{\big[PA\1n+\1n A^T\1n P\1n+\1n C^T\1n PC\1n+\1n
Q\1n-\1n(PB\1n+C^T\1n PD\1n+\1n S^T)(R\1n+\1n D^T\1n PD)^\dag(B^T\1n
P\1n+\1n D^T\1n PC\1n+\1n S)\big]X^*\\
\ns\ds\qq\q-P[(A+B\Th^*)X^*+Bv^*+b]\Big\}ds-P\big[(C+D\Th^*)X^*+Dv^*+\si]dW\\
\ns\ds\qq=-\Big\{A^T(\eta+PX^*)+C^T\big[\z+P(C+D\Th^*)X^*+PDv^*+P\si\big]
+(Q+S^T\Th^*)X^*+S^Tv^*+q\\
\ns\ds\qq\q-\big[PA\1n+\1n A^T\1n P\1n+\1n C^T\1n PC\1n+\1n
Q\1n-\1n(PB\1n+\1n C^T\1n PD\1n+\1n S^T)(R\1n+\1n D^T\1n
PD)^\dag(B^T\1n P\1n+\1n D^T\1n PC\1n+\1n S)\big]X^*\\
\ns\ds\qq\q+P[(A+B\Th^*)X^*+Bv^*+b]\Big\}ds+\z dW\\
\ns\ds\qq=\Big\{\1n-\1n A^T\1n\eta-C^T\1n\z\1n-\1n(PB\1n+\1n C^T\1n
PD\1n+\1n S^T)\Th^*X^*\1n-\1n(PB\1n+\1n C^T\1n PD\1n+\1n
S^T)v^*\1n-\1n C^T\1n P\si\1n
-\1n Pb\1n-\1n q\\
\ns\ds\qq\q-\big[(PB+C^TPD+S^T)(R+D^TPD)^\dag(B^TP+D^TPC+S)\big]X^*\Big\}ds+\z dW\\
\ns\ds\qq=-\big[A^T\eta+C^T\z+(PB+C^TPD+S^T)v^*+C^TP\si+Pb+q\big]ds+\z
dW.\ea$$
According to (\ref{5.9}), we have
$$\ba{ll}
\ns\ds0=B^TY^*+D^TZ^*+(S+R\Th^*)X^*+Rv^*+\rho\\
\ns\ds\q=B^T(\eta+PX^*)+D^T[\z+P(C+D\Th^*)X^*+PDv^*+P\si]+(S+R\Th^*)X^*
+Rv^*+\rho\\
\ns\ds\q=[B^TP+D^TPC+S+(R+D^TPD)\Th^*]X^*+B^T\eta+D^T\z+D^TP\si+\rho
+(R+D^TPD)v^*\\
\ns\ds\q=B^T\eta+D^T\z+D^TP\si+\rho+(R+D^TPD)v^*.\ea$$
Hence,
$$B^T\eta+D^T\z+D^TP\si+\rho\in\cR(R+D^TPD),\q\ae~\as$$
Since
$\h R^\dag(B^T\eta+D^T\z+D^TP\si+\rho)=-\h R^\dag\h Rv^*,$
and $\h R^\dag\h R$ is an orthogonal projection,
we see that (\ref{v L2}) holds and
$$v^*=-\h R^\dag(B^T\eta+D^T\z+D^TP\si+\rho)+\big[I-\h R^\dag\h R\big]
\n$$
for some $\n(\cd)\in L_\dbF^2(t,T;\dbR^m)$. Consequently,
$$\ba{ll}
\ns\ds(PB+C^TPD+S^T)v^*=-(PB+C^TPD+S^T)(R+D^TPD)^\dag(B^T\eta+D^T\z+D^TP\si+\rho)\\
\ns\ds\qq\qq\qq\qq\qq\qq+(PB+C^TPD+S^T)\big[I-(R+D^TPD)^\dag(R+D^TPD)\big]\n\\
\ns\ds\qq\qq\qq\qq\qq=-(PB+C^TPD+S^T)(R+D^TPD)^\dag(B^T\eta+D^T\z+D^TP\si+\rho).\ea$$
Then
$$\ba{ll}
\ns\ds A^T\eta+C^T\z+(PB+C^TPD+S^T)v^*+C^TP\si+Pb+q\\
\ns\ds=A^T\1n\eta\1n+\1n C^T\1n\z\1n-\1n(PB\1n+\1n C^T\1n PD\1n+\1n
S^T) (R\1n+\1n D^T\1n PD)^\dag(B^T\1n\eta\1n+\1n D^T\1n\z\1n+\1n
D^T\1n P\si
\1n+\1n\rho)\1n+\1n C^T\1n P\si\1n+\1n Pb\1n+\1n q\\
\ns\ds=\1n\big[A^T\2n-\1n(PB\1n+\1n C^T\1n PD+\1n S^T)(R\1n+\1n
D^TPD)^\dag B^T\big]\eta\1n+\1n\big[C^T\2n-(PB\1n+C^T\1n
PD\1n+\1n S^T\1n)(R\1n+\1n D^T\1n PD)^\dag D^T\big]\z\\
\ns\ds\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T\big]P\si\\
\ns\ds\qq-(PB+C^TPD+S^T)(R+D^TPD)^\dag\rho+Pb+q.\ea$$
Therefore, $(\eta,\z)$ is the adapted solution to the following BSDE:
$$\left\{\2n\ba{ll}
\ns\ds d\eta=-\Big\{\big[A^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
B^T\big]\eta\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag D^T\big]\z\\
\ns\ds\qq\qq+\big[C^T-(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T\big]P\si\\
\ns\ds\qq\qq-(PB+C^TPD+S^T)(R+D^TPD)^\dag
\rho+Pb+q\Big\}ds+\z dW(s),\\
\ns\ds\eta(T)=g.\ea\right.$$
To prove (\ref{5.6}) as well as the sufficiency, we take any
$u(\cd)=(u_1(\cd)^T,u_2(\cd)^T)^T\in\cU_1[t,T]\times\cU_2[t,T]$, let
$X(\cd)\equiv X(\cd\,;t,x,u(\cd))$ be the corresponding state
process. Then
$$\ba{ll}
\ns\ds J(t,x;u(\cd))={1\over2}\dbE\Big\{\lan GX(T),X(T)\ran+2\lan
g,X(T)\ran\\
\ns\ds\qq\qq\qq\qq+\int_t^T\big[\lan QX,X\ran+2\lan SX,u\ran+\lan
Ru,u\ran+2\lan q,X\ran+2\lan\rho,u\ran\big]ds\Big\}\ea$$
$$\ba{ll}
\ns\ds={1\over2}\dbE\Big\{\lan P(t)x,x\ran+2\lan\eta(t),x\ran\\
\ns\ds\qq+\2n\int_t^T\3n\big\{\1n\lan\big[-\1n PA\1n-\1n A^T\1n
P\1n-\1n C^T\1n PC\1n-\1n Q\1n+\1n(PB\1n+\1n C^T\1n PD\1n+\1n
S^T)(R\1n+\1n D^T\1n PD)^\dag(B^T\1n P\1n
+\1n D^T\1n PC\1n+\1n S)\big]X,X\ran\\
\ns\ds\qq+\lan P(AX\1n+\1n Bu\1n+\1n b),X\ran\1n+\1n\lan
PX,AX\1n+\1n Bu\1n+\1n b\ran\1n+\1n\lan P(CX\1n+\1n
Du\1n+\1n\si),CX\1n+\1n Du
\1n+\1n\si\ran\\
\ns\ds\qq+2\lan\big[-A^T+(PB+C^TPD+S^T)(R+D^TPD)^\dag
B^T]\eta,X\ran\\
\ns\ds\qq+2\lan\big[-C^T+(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T]P\si,X\ran\\
\ns\ds\qq+2\lan\big[-C^T+(PB+C^TPD+S^T)(R+D^TPD)^\dag
D^T]\z,X\ran\\
\ns\ds\qq+2\lan\big(PB+C^TPD+S^T)(R+D^TPD)^\dag
\rho-Pb-q,X\ran+2\lan\z,CX+Du+\si\ran\\
\ns\ds\qq+2\lan\eta,AX+Bu+b\ran+\lan QX,X\ran+2\lan SX,u\ran+\lan
Ru,u\ran+2\lan q,X\ran+2\lan\rho,u\ran\big\}ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\int_t^T\Big[
\lan P\si,\si\ran+2\lan\eta,b\ran+2\lan\z,\si\ran\\
\ns\ds\qq+\lan(PB\1n+\1n C^T\1n PD\1n+\1n S^T)(R\1n+\1n D^T\1n
PD)^\dag(B^T\1n P\1n
+\1n D^T\1n PC\1n+\1n S)X,X\ran\\
\ns\ds\qq+2\lan(B^TP+D^TPC+S)X+B^T\eta+D^T\z+D^TP\si+\rho,u\ran\1n
+\1n\lan(R+D^TPD)u,u\ran\\
\ns\ds\qq+2\lan(PB+C^TPD+S^T)(R+D^TPD)^\dag
(B^T\eta+D^T\z+D^TP\si+\rho),X\ran\Big]ds\Big\}.\ea$$
Note that
$$\left\{\2n\ba{ll}
\ns\ds B^TP+D^TPC+S=-(R+D^TPD)\Th^*\equiv-\h R\Th^*,\\
\ns\ds B^T\eta+D^T\z+D^TP\si+\rho=-(R+D^TPD)v^*\equiv-\h Rv^*.\ea\right.$$
Also, one has
$$\ba{ll}
\ns\ds\lan(R+D^TPD)v^*,v^*\ran=\lan\h R\h
R^\dag(B^T\eta+D^T\z+D^TP\si+\rho),\h
R^\dag(B^T\eta+D^T\z+D^TP\si+\rho)\ran\\
\ns\ds\qq\qq\qq\qq\q~=\lan(R+D^TPD)^\dag(B^T\eta+D^T\z+D^TP\si+\rho),B^T\eta+D^T\z+D^TP\si+\rho\ran.\ea$$
Thus,
$$\ba{ll}
\ns\ds J(t,x;u(\cd))={1\over2}\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\int_t^T\Big[
\lan P\si,\si\ran+2\lan\eta,b\ran+2\lan\z,\si\ran\\
\ns\ds\qq+\lan(PB\1n+\1n C^T\1n PD\1n+\1n S^T)(R\1n+\1n D^T\1n
PD)^\dag(B^T\1n P\1n
+\1n D^T\1n PC\1n+\1n S)X,X\ran\\
\ns\ds\qq+2\lan(B^TP+D^TPC+S)X+B^T\eta+D^T\z+D^TP\si+\rho,u\ran\1n
+\1n\lan(R+D^TPD)u,u\ran\\
\ns\ds\qq+2\lan(PB+C^TPD+S^T)(R+D^TPD)^\dag
(B^T\eta+D^T\z+D^TP\si+\rho),X\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\int_t^T\Big[
\lan P\si,\si\ran+2\lan\eta,b\ran+2\lan\z,\si\ran\\
\ns\ds\qq+\lan(\Th^*)^T\h R\h R^\dag\h R\Th^* X,X\ran-2\lan\h
R(\Th^* X+v^*),u\ran\1n +\1n\lan\h Ru,u\ran+2\lan(\Th^*)^T\h
R\h R^\dag\h
Rv^*,X\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\int_t^T\Big[
\lan P\si,\si\ran+2\lan\eta,b\ran+2\lan\z,\si\ran\\
\ns\ds\qq+\lan\h R\Th^*X,\Th^*X\ran-2\lan\h
R(\Th^*X+v^*),u\ran\1n+\1n\lan\h Ru,u\ran+2\lan\h R\Th^*
X,v^*\ran\Big]ds\Big\}\\
\ns\ds={1\over2}\dbE\Big\{\lan
P(t)x,x\ran+2\lan\eta(t),x\ran+\int_t^T\Big[\lan P\si,\si\ran+2\lan\eta,b\ran+2\lan\z,\si\ran\\
\ns\ds\qq\qq-
\lan(R+D^TPD)^\dag(B^T\eta+D^T\z+D^TP\si+\rho),B^T\eta+D^T\z+D^TP\si+\rho\ran\\
\ns\ds\qq\qq+\lan(R+D^TPD)(u-\Th^*X-v^*),u-\Th^*X-v^*\ran\Big]ds\Big\}\\
\ns\ds=J\big(t,x;\Th^*(\cd)X^*(\cd)+v^*(\cd)\big)
+{1\over2}\dbE\int_t^T\lan(R+D^TPD)(u-\Th^*X-v^*),u-\Th^*X-v^*\ran
ds.\ea$$
Consequently,
$$\ba{ll}
\ns\ds
J(t,x;\Th_1^*(\cd)X(\cd)+v_1(\cd),\Th_2^*(\cd)X(\cd)+v_2^*(\cd))\\
\ns\ds=J(t,x;\Th^*(\cd)X^*(\cd)+v^*(\cd))
+{1\over2}\dbE\int_t^T\lan(R_{11}+D_1^TPD_1)(v_1-v_1^*),v_1-v_1^*\ran
ds.\ea$$
Hence,
$$J(t,x;\Th^*(\cd)X^*(\cd)+v^*(\cd))\les J(t,x;\Th_1^*(\cd)X(\cd)+v_1(\cd),
\Th^*_2(\cd)X(\cd)+v_2^*(\cd)),\q\forall v_1(\cd)\in\cU_1[t,T],$$
if and only if
$$R_{11}+D_1^TPD_1\ges0,\q\ae s\in[t,T].$$
Similarly,
$$\ba{ll}
\ns\ds
J(t,x;\Th_1^*(\cd)X(\cd)+v_1^*(\cd),\Th_2^*(\cd)X(\cd)+v_2(\cd))\\
\ns\ds=J(t,x;\Th^*(\cd)X^*(\cd)+v^*(\cd))
+{1\over2}\dbE\int_t^T\lan(R_{22}+D_2^TPD_2)(v_2-v_2^*),v_2-v_2^*\ran
ds.\ea$$
Hence,
$$J(t,x;\Th^*(\cd)X^*(\cd)+v^*(\cd))\ges J(t,x;\Th_1^*(\cd)X(\cd)+v^*_1(\cd),
\Th^*_2(\cd)X(\cd)+v_2(\cd)),\q\forall v_2(\cd)\in\cU_2[t,T],$$
if and only if
$$R_{22}+D_2^TPD_2\les0,\q\ae s\in[t,T].$$
That is, $(\Th^*(\cd),v^*(\cd))$ is a closed-loop saddle point of
Problem (SG). \endpf
\ms
Note that by letting $m_2=0$, we obtain a proof for Theorem 2.4.
\ms
We point out here that the solution of the Riccati equation
(\ref{Riccati}) may be non-unique. We will present an example in
Section 6. A solution $P(\cd)$ of (\ref{Riccati}) satisfying
(\ref{5.2})--(\ref{5.6}) is called a {\it regular} solution of
(\ref{Riccati}). The following result shows that the regular
solution of (\ref{Riccati}) is unique.
\ms
\bf Corollary 5.3. \sl Let {\rm(SG1)--(SG2)} hold. Then the Riccati
equation (\ref{Riccati}) admits at most one solution $P(\cd)\in
C([t,T];\dbS^n)$ such that (\ref{5.2})--(\ref{5.6}) hold.
\ms
\it Proof. \rm Consider Problem $\hb{(SG)}^0$. Then the adapted solution
$(\eta(\cd),\z(\cd))$ of (\ref{5.8}) is $(\eta(\cd),\z(\cd))\equiv(0,0)$.
Suppose that $P(\cd)$ and $\bar{P}(\cd)$ are two solutions of Riccati equation
(\ref{Riccati}) satisfying (\ref{5.2})--(\ref{5.6}). By Theorem 5.2, we have
$$\lan P(t)x,x\ran=2V(t,x)=\lan \bar{P}(t)x,x\ran,\q\forall x\in \dbR,$$
which implies $P(t)=\bar{P}(t)$. By considering Problem
$\hb{(SG)}^0$ on $[s,T],t<s<T$, we obtain
$$P(s)=\bar{P}(s),\qq\forall s\in [t,T].$$
This proves our claim. \endpf
\section{Some Examples}
We give some examples in this section. Example 6.1 shows that the
solvability of the Riccati differential equation is not sufficient
enough for the existence of a closed-loop saddle point. So the
$L^2$-regularity is necessary; From Example 6.2 we can see that the
solution of the Riccati equation may be non-unique; To illustrate
that the existence of a closed-loop saddle point does not imply the
existence of an open-loop saddle point, we present Example 6.3.
\ms
\bf Example 6.1. \rm Consider the following optimal control (one-player game) problem:
$$\left\{\2n\ba{ll}
\ns\ds dX(s)=u(s)ds+u(s)dW(s),\q s\in[0,1],\\
\ns\ds X(0)=x,\ea\right.$$
with the cost functional
$$J(x;u(\cd))={1\over2}\dbE X^2(1)+{1\over2}\dbE\int^1_0\big({1\over2}s^3-s^2\big)u^2(s)ds.$$
In this example,
$$\left\{\2n\ba{ll}
\ns\ds A=0,\q B=1,\q b=0,\q C=0,\q D=1,\q \si=0,\\
\ns\ds G=1,\q g=0,\q Q=0,\q\ S=0,\q R(s)={1\over2}s^3-s^2,\q q=0,\q\
\rho=0.\ea\right.$$
The corresponding Riccati equation reads
\bel{6.1}\left\{\2n\ba{ll}
\ns\ds\dot P(s)={2P^2(s)\over {s^3-2s^2+2P(s)}},\q\ae s\in[0,1],\\
\ns\ds P(1)=1.\ea\right.\ee
It is easy to see that $P(s)=s^2$ is the unique solution of
(\ref{6.1}), and
$$\ba{ll}
\ns\ds B(s)^TP(s)+D(s)^TP(s)C(s)+S(s)=s^2,\\
\ns\ds R(s)+D(s)^TP(s)D(s)={1\over2}s^3\ges0,\ea\qq s\in[0,1].$$
Thus, (\ref{5.2}) holds. Now, if the problem has a closed-loop
optimal control, then we should have
$$\Th^*(s)=-\big[R(s)+P(s)\big]^{-1}P(s)=-{2\over s},\qq s\in(0,1],$$
which is not in $L^2(0,1;\dbR)$. This means that the problem does not
have a closed-loop optimal control.
\ms
\bf Example 6.2. \rm Consider the following one-dimensional
controlled system
$$\left\{\2n\ba{ll}
\ns\ds dX(s)=\big[A(s)X(s)+B(s)u(s)\big]ds
+u(s)dW(s),\q s\in[0,1],\\
\ns\ds X(0)=x,\ea\right.$$
with cost functional
$$J(x;u(\cd))={1\over2}\dbE\Big[-X(1)^2+\int_0^1\(Q(s)X(s)^2+R(s)u(s)^2\)ds\Big],$$
where
$$A={1\over2}\Big[{(R-1)^2\over R^2}-1\Big],\q B={R-1\over R},
\q Q=-{1\over R},\q R(s)=\(s-{3\over2}\)^2+{3\over4}>0.$$
The corresponding Riccati equation reads:
\bel{6.3}\left\{\2n\ba{ll}
\ns\ds\dot P+2AP+Q-{B^2P^2\over R+P}=0,\q \ae s\in[0,1],\\
\ns\ds P(1)=-1.\ea\right.\ee
Note that
$$B^2-2A=1,\qq Q+2AR=-2,\qq QR=-1.$$
Then,
$$\ba{ll}
\ns\ds{B^2P^2\over R+P}-2AP-Q={(B^2-2A)P^2-(Q+2AR)P-QR\over
R+P}={P^2+2P+1\over R+P},\ea$$
and (\ref{6.3}) becomes
\bel{6.4}\left\{\2n\ba{ll}
\ns\ds\dot P(s)={P(s)^2+2P(s)+1\over R(s)+P(s)},\q\ae s\in[0,1],\\
\ns\ds P(1)=-1,\ea\right.\ee
which has two solutions:
$$P_1(s)=-1,\qq s\in[0,1],$$
and
$$P_2(s)=s-2,\qq s\in[0,1].$$
We have
$$R(s)+P_1(s)=s^2-3s+2=(s-1)(s-2)\ges0,\qq s\in[0,1],$$
and
$$R(s)+P_2(s)=s^2-2s+1=(s-1)^2\ges0,\qq s\in[0,1].$$
Now, we have
$$\ba{ll}
\ns\ds 2J(x;u(\cd))=\dbE\Big[-X(1)^2+\int_0^1
\(Q(s)X(s)^2+R(s)u(s)^2\)ds\Big]\\
\ns\ds\qq\qq=P(0)x^2+\dbE\int_0^1\Big[\(\dot
P(s)+2A(s)P(s)+Q(s)\)X(s)^2\\
\ns\ds\qq\qq\qq\qq\qq+2P(s)B(s)X(s)u(s)+[R(s)+P(s)]u(s)^2\Big]ds\\
\ns\ds\qq\qq=P(0)x^2+\dbE\int_0^1[R(s)+P(s)]\Big|u(s)+{B(s)P(s)\over
R(s)+P(s)}X(s)\Big|^2ds\\
\ns\ds\qq\qq=P(0)x^2+\dbE\int_0^1[R(s)+P(s)]\Big|u(s)+{[R(s)-1]P(s)\over
R(s)[R(s)+P(s)]}X(s)\Big|^2ds.\ea$$
Note that
$${(R-1)P_1\over R(R+P_1)}={(R-1)(-1)\over R(R-1)}=-{1\over R},$$
and
$${(R-1)P_2\over R(R+P_2)}={(s^2-3s+2)(s-2)\over(s^2-3s+3)(s^2-2s+1)}
={(s-2)^2\over(s^2-3s+3)(s-1)}.$$
Thus,
$$\ba{ll}
\ns\ds
2J(x;u(\cd))=-x^2+\dbE\int_0^1(s-1)(s-2)\Big|u(s)-{X(s)\over(s-1)(s-2)+1}\Big|^2ds\\
\ns\ds\qq\qq\q\ges-x^2=2J(x;u^*(\cd)),\ea$$
with
$$u^*(s)={X(s)\over(s-1)(s-2)+1}\equiv{X(s)\over R(s)}=-{B(s)P_1(s)\over R(s)+P_1(s)}X(s),\q s\in[0,1],$$
which is an optimal control. The closed-loop system reads
$$\left\{\2n\ba{ll}
\ns\ds dX=\Big[{1\over2}\({(R-1)^2\over R^2}-1\)
+\({R-1\over R^2}\)\Big]Xds+{1\over R}XdW(s),\q s\in [0,1],\\
\ns\ds X(0)=x,\ea\right.$$
which is well-posed. Thus, optimal control exists, but Riccati
equation (\ref{6.4}) has more than one solution.
\ms
On the other hand, by taking $P(s)=P_2(s)=s-2$, we have
$$J(x;u(\cd))=-x^2+{1\over2}\dbE\int_0^1(s-1)^2
\Big|u(s)+{(s-2)^2\over(s^2-3s+3)(s-1)}X(s)\Big|^2ds.$$
If
$$\bar u(s)=-{(s-2)^2\over(s^2-3s+3)(s-1)}X(s),$$
is an optimal control, the closed-loop system reads
$$\left\{\2n\ba{ll}
\ns\ds dX=\Big[{1\over2}\({(R-1)^2\over R^2}-1\)
-\({R-1\over R}\){(s-2)^2\over(s^2-3s+3)(s-1)}\Big]Xds\\
\ns\ds\qq\qq\qq\qq\q-\Big[{(s-2)^2\over(s^2-3s+3)(s-1)}\Big]XdW(s),\q s\in [0,1],\\
\ns\ds X(0)=x,\ea\right.$$
which is {\it not} well-posed, since
$$\bar\Th(s)\equiv-{(s-2)^2\over(s^2-3s+3)(s-1)}\not\in L^2(0,1;\dbR).$$
Thus, $\bar u(\cd)$ is not an optimal control.
\ms
\bf Example 6.3. \rm Consider the following state equation
\bel{6.5}\left\{\2n\ba{ll}
\ns\ds dX(s)=\big[u_1(s)-u_2(s)\big]ds+\big[u_1(s)-u_2(s)\big]dW(s),\q s\in[0,1],\\
\ns\ds X(0)=x,\ea\right.\ee
and performance functional
$$J(x;u_1(\cd),u_2(\cd))={1\over2}\dbE\Big[|X(1)|^2+\int_0^1\big(|u_1(s)|^2-|u_2(s)|^2\big)ds\Big].$$
The corresponding Riccati equation reads
$$\left\{\2n\ba{ll}
\ns\ds\dot P=P(1,-1)\begin{pmatrix}1+P&-P\\
-P & -1+P\end{pmatrix}^{-1}\begin{pmatrix}1\\-1\end{pmatrix}P=0,\q 0\les s\les1,\\
\ns\ds P(1)=1.\ea\right.$$
Clearly, $P(s)\equiv 1$. By Theorem 5.2, $(-1,-1)$ is the unique closed-loop saddle point.
\ms
On the other hand, for any $u_1(\cd)\in L_\dbF^2(0,1; \dbR)$,
taking $u_2(\cd)=u_1(\cd)-\l,\ \l\in \dbR$,
the corresponding solution of (\ref{6.5}) is
$$X(s)=x+\lambda s+\lambda W(s),$$
and
$$\dbE|X(1)|^2=x^2+2\l^2+2\l x,$$
$$\dbE\int_0^1\big(|u_1(s)|^2-|u_2(s)|^2\big)ds=-\l^2+2\l\dbE\int_0^1u_1(s)ds.$$
Letting $\l\rightarrow\infty$, we see that
$$\sup_{u_2(\cd)\in L_\dbF^2(0,1;\dbR)} J(x;u_1(\cd),u_2(\cd))
=\infty,\ \forall\ u_1(\cd)\in L_\dbF^2(0,1;\dbR),$$
and hence
$$V^+(0,x)=\inf_{u_1(\cd)\in L_\dbF^2(0,1;\dbR)}\sup_{u_2(\cd)\in L_\dbF^2(0,1;\dbR)}
J(x;u_1(\cd),u_2(\cd))=\infty.$$
So the open-loop saddle point does not exist.
\ms
\section{Concluding Remarks}
In this paper, we present a characterization of the existence of
closed-loop saddle point of linear-quadratic two-person zero-sum
stochastic differential game in terms of the existence of a solution
to differential Riccati equation, with certain regularity. There are
at least two major problems left untouched: (i) The solvability of
the Riccati equation. We mention here that some relevant results can
be found in \cite{Ait Rami-Moore-Zhou 2001} and \cite{McAsey-Mou
2006}. But more complete results are desirable. (ii) The random
coefficients case. This will lead to more involved issues, for
example, the corresponding Riccati equation should be a BSDE, as
indicated in \cite{Chen-Yong 2000,Chen-Yong 2001} for LQ stochastic
optimal control problems with random coefficients. We hope to report
some results relevant to the above-mentioned problems in our future
publications.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 9,588 |
/*
* This is not the original file distributed by the Apache Software Foundation
* It has been modified by the Hipparchus project
*/
package org.hipparchus.stat.descriptive.vector;
import java.io.Serializable;
import java.util.Arrays;
import org.hipparchus.exception.MathIllegalArgumentException;
import org.hipparchus.linear.MatrixUtils;
import org.hipparchus.linear.RealMatrix;
import org.hipparchus.util.MathArrays;
/**
* Returns the covariance matrix of the available vectors.
*/
public class VectorialCovariance implements Serializable {
/** Serializable version identifier */
private static final long serialVersionUID = 4118372414238930270L;
/** Sums for each component. */
private final double[] sums;
/** Sums of products for each component. */
private final double[] productsSums;
/** Indicator for bias correction. */
private final boolean isBiasCorrected;
/** Number of vectors in the sample. */
private long n;
/** Constructs a VectorialCovariance.
* @param dimension vectors dimension
* @param isBiasCorrected if true, computed the unbiased sample covariance,
* otherwise computes the biased population covariance
*/
public VectorialCovariance(int dimension, boolean isBiasCorrected) {
sums = new double[dimension];
productsSums = new double[dimension * (dimension + 1) / 2];
n = 0;
this.isBiasCorrected = isBiasCorrected;
}
/**
* Add a new vector to the sample.
* @param v vector to add
* @throws MathIllegalArgumentException if the vector does not have the right dimension
*/
public void increment(double[] v) throws MathIllegalArgumentException {
MathArrays.checkEqualLength(v, sums);
int k = 0;
for (int i = 0; i < v.length; ++i) {
sums[i] += v[i];
for (int j = 0; j <= i; ++j) {
productsSums[k++] += v[i] * v[j];
}
}
n++;
}
/**
* Get the covariance matrix.
* @return covariance matrix
*/
public RealMatrix getResult() {
int dimension = sums.length;
RealMatrix result = MatrixUtils.createRealMatrix(dimension, dimension);
if (n > 1) {
double c = 1.0 / (n * (isBiasCorrected ? (n - 1) : n));
int k = 0;
for (int i = 0; i < dimension; ++i) {
for (int j = 0; j <= i; ++j) {
double e = c * (n * productsSums[k++] - sums[i] * sums[j]);
result.setEntry(i, j, e);
result.setEntry(j, i, e);
}
}
}
return result;
}
/**
* Get the number of vectors in the sample.
* @return number of vectors in the sample
*/
public long getN() {
return n;
}
/**
* Clears the internal state of the Statistic
*/
public void clear() {
n = 0;
Arrays.fill(sums, 0.0);
Arrays.fill(productsSums, 0.0);
}
/** {@inheritDoc} */
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (isBiasCorrected ? 1231 : 1237);
result = prime * result + (int) (n ^ (n >>> 32));
result = prime * result + Arrays.hashCode(productsSums);
result = prime * result + Arrays.hashCode(sums);
return result;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof VectorialCovariance)) {
return false;
}
VectorialCovariance other = (VectorialCovariance) obj;
if (isBiasCorrected != other.isBiasCorrected) {
return false;
}
if (n != other.n) {
return false;
}
if (!Arrays.equals(productsSums, other.productsSums)) {
return false;
}
if (!Arrays.equals(sums, other.sums)) {
return false;
}
return true;
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 7,652 |
\section{Introduction}
Kontsevich and Soibelman's groundbreaking work
\cite{Kontsevich2008,Kontsevich2010} introduced some completely new
ideas and techniques into the BPS state counting problems in
physics. Their work as well as Nagao \cite{Nagao2011,Nagao2013} and
Reineke \cite{Reineke2010,Reineke2011} motivated Keller
\cite{Keller2011,Keller2012,Keller2013a} to study the product of quantum
dilogarithms along a quiver mutation sequence. He showed that it is
independent of the choice of a reddening mutation sequence and is an
important invariant of a quiver which he called the combinatorial
Donaldson-Thomas (DT) invariant.
In our previous work \cite{KT2014}, we introduced the partition
$q$-series for a mutation loop. A mutation loop is a mutation sequence
supplemented by a boundary condition which specifies how the vertices of
the initial and the final quiver are identified. One of our motivation
is to provide a solid mathematical foundation to extract an essential
information of the partition function of a 3-dimensional gauge
theory. In particular, we showed for a special sequence of a Dynkin
quiver or square product thereof, the partition $q$-series reproduce
so-called fermionic character formulas of certain modules associated
with affine Lie algebras.
In this paper, we analyze the relationship between partition $q$-series
and the combinatorial DT-invariants. For that purpose, we refined the
definition of our partition $q$-series by introducing a (noncommutative)
grading and making it sensitive to ``orientation'' (green or red) of
each mutation.
The main result of this paper is summarized as follows (see Theorem
\ref{thm:main} for more precise statement): for any reddening
sequence (= a mutation sequence for which the combinatorial DT invariant
is defined), the refined version of the partition $q$-series
coincides with the combinatorial DT invariant (up to involution
$q\leftrightarrow q^{-1}$). Therefore, the partition $q$-series provide
``state-sum'' description of combinatorial DT-invariants that are given
in ``operator formalism''.
The paper is organized as follows. In Section \ref{sec:museq},
we recall some basic concepts of quiver mutation sequences and
$c$-vectors. In Section \ref{sec:Zdef}, we introduce the (refined
version of) the partition $q$-series $\ZZ(\gamma)$ for the mutation loop
$\gamma$. In Section \ref{sec:backtracking} we show that the partition
$q$-series are invariant under insertion/deletion of
backtracking. Section \ref{comb-DT} summarizes the basic facts about
reddening sequences and combinatorial DT-invariants. Section
\ref{sec:Z-and-DT} is the main part of this paper; we prove that for any
reddening mutation sequence, the partition $q$-series essentially
coincides with the combinatorial DT invariant. The final section is
devoted to some explicit computation of partition $q$-series for various
type of quivers.
\begin{acknowledgment}
We would like to thank H. Fuji, K. Hikami, A. Kuniba, R. Inoue,
J. Suzuki, S. Terashima, O. Warnaar and M. Yamazaki for for helpful
discussion.
We would also like to thank the anonymous referee for
their valuable comments and suggestions to improve the
quality of the paper.
This work was partially supported by Japan Society for the
Promotion of Science (JSPS), Grants-in-Aid for Scientific Research
Grant (KAKENHI) Number 23654079 and 25400083. This paper is dedicated
to the memory of Kentaro Nagao.
\end{acknowledgment}
\section{Quiver mutation sequences}
\label{sec:museq}
\subsection{Quivers and mutation sequences}
\label{sec:notation}
A \emph{quiver} $Q=(Q_{0},Q_{1})$ is an oriented graph with the set
$Q_{0}$ of arrows and the set $Q_{1}$ of vertices. In this paper all
quivers are assumed to be finite connected oriented graphs without loops
or 2-cycles:
\begin{equation*}
\text{loop} \quad \vcenter{
\xymatrix @R=8mm @C=8mm
@M=2pt{\bullet \ar@(ur,dr)[]}} \qquad \qquad
\text{2-cycle}\quad \vcenter{ \xymatrix @R=8mm @C=8mm @M=2pt{\bullet
\ar@/^/[r] & \bullet \ar@/^/[l]} }.
\end{equation*}
Throughout the paper, we identify the set of vertices $Q_{0}$
with $\{1,2,\dots,n\}$. By a slight abuse of notation, we denote by
\begin{equation}
\label{eq:Qij-def}
Q_{ij}:=\#\{ (i\to j)\in Q_{1}\}
\end{equation}
the multiplicity of the arrow, and consider them as entries of an
$n\times n$ matrix. There is a bijection
\begin{equation*}
\left\{
\text{
\parbox[c]{.35\textwidth}{the quivers without loops or $2$-cycles,
$Q_{0}\stackrel{\sim}{\rightarrow} \{1, \ldots, n\}$}
}
\right\}
\longleftrightarrow
\left\{
\text{
\parbox[c]{.35\textwidth}{the skew-symmetric integer $n\times
n$-matrices $B$}
}
\right\}
\end{equation*}
via
\begin{equation}
B_{ij}=Q_{ij}-Q_{ji},\qquad Q_{ij}=\max(B_{ij},0).
\end{equation}
For a quiver $Q$ and its vertex $k$, the \emph{mutated quiver}
$\mu_k(Q)$ is defined \cite{Fomin2002}: it has the same set of vertices
as $Q$; its set of arrows is obtained from that of $Q$ as follows:
\begin{itemize}
\item[1)] for each path $i\to k\to j$ of length two, add a new arrow
$i\to j$;
\item[2)] reverse all arrows with source or target $k$;
\item[3)] remove the arrows in a maximal set of pairwise
disjoint $2$-cycles.
\end{itemize}
It is well known that $\mu_{k}(\mu_{k}(Q))=Q$ for any $1\leq k\leq n$.
A finite sequence of vertices of $Q$,
$\seq{m}=(m_{1},m_{2},\dots,m_{T})$ is called \emph{mutation
sequence}. By putting $Q(t) := \mu_{m_{t}}(Q(t-1))$, $\seq{m}$ induces a
(discrete) time evolution of quivers:
\begin{equation}
\label{eq:Q-seq}
\xygraph{!{<0cm,0cm>;<18mm,0cm>:<0cm,20pt>::}
!{(0,0)}*+{Q(0)}="q0"
!{(1,0)}*+{Q(1)}="q1"
!{(2,0)}*+{~\cdots~}="q2"
!{(2.9,0)}*+{Q(t{-}1)}="q3"
!{(4.1,0) }*+{Q(t)}="q4"
!{(5,0)}*+{~\cdots~}="q5"
!{(6,0) }*+{Q(T)}="q6"
"q0":^{\textstyle \mu_{m_{1}}}"q1"
"q1":^{\textstyle \mu_{m_{2}}}"q2"
"q2":"q3"
"q3":^(.56){\textstyle \mu_{m_{t}}}"q4"
"q4":"q5"
"q5":^{\textstyle \mu_{m_{T}}}"q6"
}
\end{equation}
$Q(0)$ and $Q(T)$ are called the \emph{initial} and the \emph{final}
quiver, respectively. We will often use the notation
$\mu_{\seq{m}}(Q)=\mu_{m_{T}}(\cdots \mu_{m_{2}}(\mu_{m_{1}}(Q))\cdots)
$.
The quiver mutation corresponds to matrix mutation defined by
Fomin-Zelevinsky \cite{Fomin2002}. The matrix $B(t)$ corresponding to
$Q(t)$ is given by \cite{Fomin2007}
\begin{equation}
\label{eq:matrix-mutation} B(t)_{ij} =
\begin{cases}
-B(t{-}1)_{ij} &
\text{if $i=k$ or $j=k$} \\
B(t{-}1)_{ij}+\sgn(B(t{-}1)_{ik}) \max(B(t{-}1)_{ik}B(t{-}1)_{kj},0)
& \text{otherwise.}
\end{cases}
\end{equation}
Suppose that $Q(0)$ and $Q(T)$ are isomorphic as oriented graphs. An
isomorphism $\varphi : Q(T)\to Q(0)$ regarded as a bijection on the set
of vertices, is called \emph{boundary condition} of the mutation
sequence $\seq{m}$. We represent $\varphi$ by a permutation of
$\{1,\dots,n\}$, i.e. $\varphi\in S_{n}$. The triple
$\gamma=(Q;\seq{m},\varphi)$ is called a \emph{mutation loop}.
\subsection{Ice quivers and $c$-vectors}
\label{sec:c-vectors}
We will follow the terminology in \cite{Bruestle2013}. An \emph{ice
quiver} is a pair $(\widetilde{Q},F)$ where $\widetilde{Q}$ is a quiver
and $F\subset \widetilde{Q}_{0}$ is a (possibly empty) subset of
vertices called \emph{frozen vertices} such that there are no arrows
between them. Two ice quivers $(\widetilde{Q},F)$ and
$(\widetilde{Q}',F')$ are called \emph{frozen isomorphic} if $F=F'$ and
there is an isomorphism of quivers $\phi : \widetilde{Q}\to
\widetilde{Q}'$ such that $\phi|F=\id_{F}$.
For any quiver $Q$, there is a standard way of constructing an ice
quiver $Q^{\wedge}$ called \emph{framed quiver}. $Q^{\wedge}$ is an
ice quiver obtained from $Q$ by adding, for each vertex $i$, a new
frozen vertex $i'$ and a new arrow $i\to i'$:
\begin{equation}
F=\{i'|i\in Q_{0}\},\qquad (Q^{\wedge})_{0}=Q_{0}\sqcup F,\qquad
(Q^{\wedge})_{1}=Q_{1}\sqcup \{i\to i'|i\in Q_{0}\}.
\end{equation}
Let $\seq{m}=(m_{1},m_{2},\dots,m_{T})$ be a mutation sequence for
$Q$. By putting
\begin{equation}
\widetilde{Q}(0)=Q^{\wedge}, \qquad
\widetilde{Q}(t)=\mu_{m_{t}}(\widetilde{Q}(t-1))\qquad (t=1,2,\dots,T)
\end{equation}
we can construct a sequence of ice quivers
\begin{equation}
\label{eq:Q-tilde-seq}
\xygraph{!{<0cm,0cm>;<18mm,0cm>:<0cm,20pt>::}
!{(0,0)}*+{\widetilde{Q}(0)}="q0"
!{(1,0)}*+{\widetilde{Q}(1)}="q1"
!{(2,0)}*+{~\cdots~}="q2"
!{(2.9,0)}*+{\widetilde{Q}(t{-}1)}="q3"
!{(4.1,0) }*+{\widetilde{Q}(t)}="q4"
!{(5,0)}*+{~\cdots~}="q5"
!{(6,0) }*+{\widetilde{Q}(T)}="q6"
"q0":^{\textstyle \mu_{m_{1}}}"q1"
"q1":^{\textstyle \mu_{m_{2}}}"q2"
"q2":"q3"
"q3":^{\textstyle \mu_{m_{t}}}"q4"
"q4":"q5"
"q5":^{\textstyle \mu_{m_{T}}}"q6"
}.
\end{equation}
Note that we never mutate at frozen vertices $F=\{1',\dots,n'\}$. The
quiver $\widetilde{Q}(t)$ will be called the \emph{ice quiver
corresponding to} $Q(t)$. Let $\widetilde{B}(t)$ be the antisymmetric
matrix corresponding to $\widetilde{Q}(t)$. The $c$-vectors are defined
by counting the number of arrows to/from frozen vertices:
\begin{definition}
\label{def:c-vector} A \emph{$c$-vector of vertex $v$ in $Q(t)$} is a
vector in $\Z^{n}$ defined by
\begin{equation}
c_{v}(t):=\bigl(\widetilde{B}(t)_{vi'}\bigr)_{i=1}^{n}.
\end{equation}
\end{definition}
If the vertices of $\widetilde{Q}(t)$ are ordered as $(1,\dots,n,
1',\dots,n')$, the antisymmetric matrix $\widetilde{B}(t)$ has the
block form
\begin{equation}
\label{eq:B-tilde-block}
\def\h{\rule[-2.2ex]{0pt}{5.8ex}}
\widetilde{B}(t) =
\begin{array}{|c|c|}
\hline
\h B(t) & ~C(t)~ \\
\hline
\h {-}C(t)^{\top} & 0 \\ \hline
\end{array}\,,\qquad C(t)=\begin{array}{|@{\qquad}c@{\qquad}|}
\hline c_{1}(t) \\
\hline c_{2}(t) \\
\hline \cdots \\
\hline c_{n}(t) \\
\hline
\end{array}\;,
\end{equation}
where $X^{\top}$ denotes the transpose of $X$. The $n\times n$ block
$C(t)$ is called \emph{$c$-matrix}, which consists of row of
$c$-vectors. By construction, $c_{i}(0)=e_{i}$, where $e_{i}$ is the
standard unit vector in $\Z^{n}$.
\begin{theorem}[Sign coherence]
Each $c$-vector is nonzero and lies in $\N^{n}$ or $(-\N)^{n}$.
\end{theorem}
This is conjectured in \cite{Fomin2007} and was proved in
\cite{Derksen2010}, \cite{Plamondon2011}. Nagao \cite{Nagao2013} gave an
alternative proof by using Donaldson-Thomas theory.
\subsection{Green and red mutations}
\label{sec:green sequences}
Following Keller \cite{Keller2011}, we call the vertex $v$ of $Q(t)$ is
\emph{green} (resp. \emph{red}) if $c_{v}(t)\in \N^{n}$
(resp. $-c_{v}(t)\in \N^{n}$). By definition, every vertex of the
initial quiver $Q(0)$ is green. The mutation $ \mu_{m_{t}}:Q(t-1)\to
Q(t)$ is \emph{green} (resp. \emph{red}) if the mutating vertex $m_{t}$
is green (resp. red) on $Q(t-1)$, i.e. on the quiver before
mutation,\footnote{The sign of the mutating vertex changes after the
mutation. If the vertex $m_{t}$ is green on $Q(t-1)$, then it is red on
$Q(t)$.} and the \emph{sign} $\varepsilon_{t}$ of the mutation
$\mu_{m_{t}}$ is defined as
\begin{equation}
\label{eq:eps-def}
\varepsilon_{t} =
\begin{cases}
+1 & \text{if $\mu_{m_{t}}$ is green}, \\
-1 & \text{if $\mu_{m_{t}}$ is red}. \\
\end{cases}
\end{equation}
\begin{figure}[tb]
\begin{equation*}
\xygraph{!{<0cm,0cm>;<16mm,0cm>:<0cm,23mm>::}
!{(1,2)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<6.0pt>[Fo]{1}="v1"
!{(1,0)}*+<6.0pt>[Fo]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v1":"v2"
"v1":"w1"
"v2":"w2"
}}}}="Q1"
!{(-0.3,1)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<3pt>[F]{1}="v1"
!{(1,0)}*+<6.0pt>[Fo]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v2":"v1"
"w1":"v1"
"v2":"w2"
}}}}="Q2"
!{(1,0)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<3pt>[F]{1}="v1"
!{(1,0)}*+<3pt>[F]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v1":"v2"
"w1":"v1"
"w2":"v2"
}}}}="Q3"
!{(3,2)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<6.0pt>[Fo]{1}="v1"
!{(1,0)}*+<3pt>[F]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v2":"v1"
"v1":"w1"
"v1":"w2"
"w2":"v2"
}}}}="Q4"
!{(4.3,1)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<3pt>[F]{1}="v1"
!{(1,0)}*+<6.0pt>[Fo]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v1":"v2"
"v2":"w1"
"w2":"v1"
"w1":"v1"
}}}}="Q5"
!{(3,0)}*+{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<9mm,0cm>:<0cm,-9mm>::}
!{(0,0)}*+<3pt>[F]{1}="v1"
!{(1,0)}*+<3pt>[F]{2}="v2"
!{(0,1)}*+<3pt>{1'}="w1"
!{(1,1)}*+<3pt>{2'}="w2"
"v2":"v1"
"w2":"v1"
"w1":"v2"
}}}}="Q6"
"Q1":@{=>}_{\textstyle \mu_{1}}"Q2"
"Q2":@{=>}_{\textstyle \mu_{2}}"Q3"
"Q1":@{=>}^{\textstyle \mu_{2}}"Q4"
"Q4":@{=>}^{\textstyle \mu_{1}}"Q5"
"Q5":@{=>}^{\textstyle \mu_{2}}"Q6"
"Q3":@{<-}^{\textstyle (12)}_{\text{frozen isom.}}"Q6"
}
\end{equation*}
\caption{Pentagon and the $A_{2}$ quiver. The green and red vertices are
marked with circles and boxes, respectively. Both
$\seq{m}=(1,2)$ and $\seq{m}'=(2,1,2)$ are maximal green sequences.}
\label{fig:pentagon}
\end{figure}
A mutation sequence $\seq{m}=(m_{1},m_{2},\dots,m_{T})$
is called \emph{green sequence} if $m_{t}$
is green for all $t$, and is \emph{maximal green sequence} if all of the
vertex of the final quiver $Q(T)$ are red.
In Figure \ref{fig:pentagon}, the two maximal green
sequences $(12)$ and $(212)$ are shown for $A_{2}$ quiver.
By inspecting the matrix mutation rules \eqref{eq:matrix-mutation} for
the ice quivers $\widetilde{Q}(t)$, it is easy to see how the
$c$-vector changes via mutations:
\begin{lemma}
\label{prop:c-vec-change}
Under the mutation $ \mu_{v}:Q(t)\to
Q(t+1)$, $c$-vector changes as
\begin{equation}
\label{eq:c-vec-change}
c_{i}(t+1)=
\begin{cases}
-c_{i}(t)
& \text{if~} i=v
\\
c_{i}(t)+ Q(t)_{i,v} \cdot c_{v}(t)
&
\text{if~$i\neq v$ and $\mu_{v}$ is green}
\\
c_{i}(t)+Q(t)_{v,i} \cdot c_{v}(t)
& \text{if~$i\neq v$ and $\mu_{v}$ is red}
\end{cases}
\end{equation}
\end{lemma}
\begin{cor}
\label{prop:C(t)-as-basis}
$\det C(t)=(-1)^t$. In particular, $C(t)\in GL_{n}(\Z)$ and, $c$-vectors
$\{c_{i}(t)\}_{i=1}^{n}$ constitutes a $\Z$-basis of $\Z^{n}$ for each $t$.
\end{cor}
\subsection{Noncommutative algebra $\Ah_{Q}$}
We introduce a noncommutative associative algebra in which quantum
dilogarithms and combinatorial Donaldson-Thomas invariants take their
values.
Let $Q$ be a quiver with vertices $\{1,2,\dots,n\}$. We define a skew
symmetric bilinear form $\vev{~,~}:\Z^{n}\times \Z^{n}\to \Z$ by
\begin{equation}
\label{def:vev}
\vev{e_{i},e_{j}}=B_{ij}=-B_{ji}=Q_{ij}-Q_{ji},
\end{equation}
where $e_{1},\dots,e_{n}$ are the standard basis vectors in $\Z^{n}$.
Let $R$ be a commutative ring\footnote{The coefficient ring $R$ should
be chosen in such a way that the factors $q^{\pm \frac{1}{2}kk^{\vee}}$
of mutation weight \eqref{eq:W-def} belong to $R$. The exponent of $q$
can have nontrivial denominator through the process of expressing
$k^{\vee}$-variables in terms of $k$-variables. As discussed in
\cite{KT2014}, there is a positive integer $\Delta$, depending only on
the mutation loop, such that $\frac{1}{2}kk^{\vee}\in
\frac{1}{\Delta}\Z$. Then we can choose $R=\Q(q^{1/\Delta})$.}
containing $\Q(q^{1/2})$. Let
$\A_{Q}$ be a noncommutative associative algebra over $R$ presented as
\begin{equation}
\label{eq:quantum-affine-space}
\A_{Q}=R
\langle\,
y^{\alpha},~\alpha\in \N^{n} ~|~
y^{\alpha}y^{\beta}
= q^{\frac{1}{2}\vev{\alpha,\beta}}y^{\alpha+\beta}\,
\rangle.
\end{equation}
Its completion with respect to the $\N^{n}$-grading is denoted by
$\widehat{\A}_{Q}$. We may regard $\A_{Q}$ as the ring of
noncommutative polynomials in $y_{i}:=y^{e_{i}}$ $(i=1,\dots,n)$. Later
we will frequently use the following relations
($\alpha=(\alpha_{1},\dots,\alpha_{n})\in \Z^{n}$):
\begin{equation}
\label{eq:y-monom}
\begin{split}
& y_{1}^{\alpha_{1}}
y_{2}^{\alpha_{2}}
\dots
y_{n}^{\alpha_{n}}
=q^{+\frac{1}{2}\sum_{i<j} B_{ij}\alpha_{i}\alpha_{j}}
y^{\alpha},
\\
& y^{\alpha}=q^{-\frac{1}{2}\sum_{i<j} B_{ij}\alpha_{i}\alpha_{j}}
y_{1}^{\alpha_{1}}
y_{2}^{\alpha_{2}}
\dots
y_{n}^{\alpha_{n}}.
\end{split}
\end{equation}
Later we will use a $\Q$-algebra anti-automorphism
$\overline{\phantom{x}}:\A_{Q}\to \A_{Q}$ defined by
\begin{equation}
\label{eq:anti-autom} y^{\alpha}\mapsto y^{\alpha}\quad (\alpha\in
\N^{n}),\qquad q\mapsto q^{-1}
\end{equation}
Note that this is an involutive anti-automorphism of $\Q$-algebra, not
of $R$-algebra.
\section{Partition $q$-series}
\label{sec:Zdef}
In this section, we recapitulate the notion of partition $q$-series
introduced in \cite{KT2014}. As mentioned in Introduction, we refine
and extend the definition, so that we can state the relationship between
our partition $q$-series and the products of quantum dilogarithm
(combinatorial DT-invariants) in full generality.
\begin{enumerate}[(i)]
\itemsep=1ex
\item We introduce noncommutative variables $y_{1},\dots,y_{n}$ to keep
track of the $\N^{n}$-grading. This is in conformity to the custom
of quantum dilogarithms and DT-invariants. They are naturally
associated with the $c$-vectors as well as $s$-variables. This
graded version of partition $q$-series now take their values in
$\Ah_{Q}$ --- the (completed) ring of noncommutative polynomials
in $y_{1},\dots,y_{n}$, rather than $\N[[q^{1/\Delta}]]$.
\item We make a distinction between green and red mutations, and we add
a new rule for red mutations.\footnote{Except the grading, all the
results in \cite{KT2014} remains the same in our new setting; all
the mutation sequence considered there are green sequences.}
Although this refinement requires additional data --- $c$-vectors,
or equivalently ice quivers, we obtain perfect match (Theorem
\ref{thm:main}) between the partition $q$-series and the
combinatorial Donaldson-Thomas invariant wherever the latter
invariant are defined.
\end{enumerate}
As a bonus of these refinements, we can handle arbitrary non-degenerate
mutation sequences\footnote{In \cite{KT2014}, the partition $q$-series
were well-defined only for ``positive'' mutation loops.}. Moreover, the
refined version acquire the invariance under the insertion or deletion
of backtracking in mutation sequence (Theorem
\ref{prop:Z-backtrack-inv}).
In the case of green mutation sequences, this new definition coincides
with the original one \cite{KT2014} just by forgetting $\N^{n}$
gradings.
\subsection{The partition $q$-series}
Let $Q$ be a quiver with vertices $\{1,2,\dots,n\}$. We consider the
mutation sequence $\seq{m}=(m_{1},m_{2},\dots,m_{T})$ of $Q$:
\begin{equation}
\label{eq:Q-seq-2}
\xygraph{!{<0cm,0cm>;<18mm,0cm>:<0cm,20pt>::}
!{(0,0)}*+{Q(0)}="q0"
!{(1,0)}*+{Q(1)}="q1"
!{(2,0)}*+{~\cdots~}="q2"
!{(2.9,0)}*+{Q(t{-}1)}="q3"
!{(4.1,0) }*+{Q(t)}="q4"
!{(5,0)}*+{~\cdots~}="q5"
!{(6,0) }*+{Q(T)}="q6"
"q0":^{\textstyle \mu_{m_{1}}}"q1"
"q1":^{\textstyle \mu_{m_{2}}}"q2"
"q2":"q3"
"q3":^{\textstyle \mu_{m_{t}}}"q4"
"q4":"q5"
"q5":^{\textstyle \mu_{m_{T}}}"q6"
}.
\end{equation}
The partition $q$-series is defined as follows \cite{KT2014}.
We first introduce a family of \emph{$s$-variables} $\{s_{i}\}$,
\emph{$k$-variables} $\{k_{t}\}$, and
\emph{$k^{\vee}$-variables} $\{k^{\vee}_{t}\}$ by the following rule:
\begin{itemize}
\item[(i)] An ``initial'' $s$-variable $s_{v}$ is attached to each
vertex $v$ of the initial quiver $Q$.
\item[(ii)] Every time we mutate at vertex $v$, we add a ``new''
$s$-variable associated with $v$. We often write
$s_{v}$, $s_{v}'$, $s_{v}''$, $\dots$ to distinguish
$s$-variables attached to the same vertex.
\item[(iii)] We associate $k_{t}$ and $k^{\vee}_{t}$ with each mutation
at $m_{t}$.
\item[(iv)] If two vertices are identified by a boundary condition, then
the corresponding $s$-variables are also identified.
\end{itemize}
The $s$-, $k$-, and $k^{\vee}$-variables are not considered
independent; we impose a linear relation for each mutation step.
Suppose that the quiver $Q(t-1)$ equipped with $s$-variables $\{s_{i}\}$
is mutated at vertex $v=m_{t}$ to give $Q(t)$. Then $k$- and
$s$-variables are required to satisfy
\begin{equation}
\label{eq:k-s-rel}
k_{t}=\begin{cases}
\displaystyle
s_{v}+s_{v}'-\sum_{a\to v} s_{a} & \text{if $\mu_{v}$ is
green} ~(\varepsilon_{t}=1)\\
\displaystyle \rule{0pt}{15pt}
\sum_{v\to b} s_{b} - (s_{v}+s_{v}') & \text{if $\mu_{v}$ is
red} ~(\varepsilon_{t}=-1)\\
\end{cases}
\end{equation}
Here, $s'_{v}$ is the ``new'' $s$-variable attached to mutated vertex
$v$, and the sum is over all the arrows of $Q(t-1)$.
Similarly, $k^{\vee}$- and $s$-variables are related as
\begin{equation}
\label{eq:kv-s-rel}
k^{\vee}_{t}
=\begin{cases}
\displaystyle
s_{v}+s_{v}'-\sum_{v\to b} s_{b} & \text{if $\mu_{v}$ is
green} ~(\varepsilon_{t}=1)\\
\displaystyle \rule{0pt}{15pt}
\sum_{a\to v} s_{a} - (s_{v}+s_{v}')
& \text{if $\mu_{v}$ is
red} ~(\varepsilon_{t}=-1)\\
\end{cases}
\end{equation}
Therefore,
\begin{equation}
\label{eq:kv-k}
k^{\vee}_{t}-k_{t}= \sum_{a\to v} s_{a} - \sum_{v\to b} s_{b}
\end{equation}
holds at each mutation.
The \emph{weight of the mutation} $\mu_{m_{t}}:Q(t-1)\to Q(t)$ at
$v=m_{t}$ is defined as
\begin{equation}
\label{eq:W-def}
W(m_{t}):=\frac{q^{\frac{\varepsilon_{t}}{2}k_{t}k^{\vee}_{t}}}
{(q^{\varepsilon_{t}})_{k_{t}}}
=
\begin{cases}
\displaystyle
\frac{q^{\frac{1}{2}k_{t}k^{\vee}_{t}}}
{(q)_{k_{t}}}
& \text{if $\mu_{v}$ is green},
\\
\displaystyle \rule{0pt}{22pt}
\frac{q^{-\frac{1}{2}k_{t}k^{\vee}_{t}}}
{(q^{-1})_{k_{t}}}
& \text{if $\mu_{v}$ is red}.
\end{cases}
\end{equation}
Here, $\varepsilon_{t}$ is the sign of $\mu_{m_{t}}$ and
\begin{equation}
(q)_{k} := \prod_{i=1}^{k}(1-q^{i})
\end{equation}
is the $q$-Pochhammer symbol.
The \emph{$\N^{n}$-grading} of the mutation $\mu_{m_{t}}$ is
$k_{t} \alpha_{t}$ by definition, where
\begin{equation}
\label{eq:alpha-def}
\alpha_{t}:=\varepsilon_{t}c_{m_{t}}(t{-}1)\quad \in \N^{n}\setminus\{0\}
\end{equation}
is the (sign-corrected) $c$-vector of the vertex on which mutation is applied.
It is occasionally useful to regard the relation \eqref{eq:k-s-rel} as
the time evolution of $s$-variables with the control parameters
$\{k_{t}\}$. Let $s_{i}(t)$ denote the value of the $s$-variable
associated with vertex $i$ at $Q(t)$. Then \eqref{eq:k-s-rel} can be
written as
\begin{equation}
\label{eq:s-evolution}
s_{i}(t)=
\begin{cases}
\rule{0pt}{14pt} s_{i}(t{-}1) & \text{if $i\neq v$},
\\
\displaystyle \rule{0pt}{19pt}
k_{t}-s_{v}(t{-}1)+\sum_{a}Q(t)_{a,v} s_{a}(t{-}1)
& \text{if $i=v$ and $\mu_{v}$ is green},
\\
\displaystyle \rule{0pt}{13pt}
-k_{t}-s_{v}(t{-}1)+\sum_{b}Q(t)_{v,b} s_{b}(t{-}1)
& \text{if $i=v$ and $\mu_{v}$ is red}.
\end{cases}
\end{equation}
With this notation, \eqref{eq:kv-k} reads as
\begin{equation}
\label{eq:k-kv-rel}
k_{t}^{\vee}= k_{t}-\sum_{i} B(t{-}1)_{v,i} \,s_{i}(t{-}1)
= k_{t}+\sum_{i} B(t{-}1)_{i,v}\, s_{i}(t{-}1).
\end{equation}
One can usually solve the linear relations \eqref{eq:k-s-rel} for
$s$-variables in terms of $k$-variables. If this is the case, the
mutation loop is called \emph{non-degenerate} (see \cite{KT2014}). Then
using \eqref{eq:kv-s-rel} and \eqref{eq:W-def}, we can express all the
mutation weights $\{W(m_{t})\}$ as functions of
$\seq{k}=(k_{1},\dots,k_{T})$.
Hereafter we assume that the mutation loop $\gamma$ is
non-degenerate. Then the ($\N^{n}$-graded) \emph{partition $q$-series}
associated with $\gamma$ is defined as
\begin{equation}
\label{eq:zz-def}
\ZZ(\gamma):=\sum_{\seq{k}\in \N^{T}} \biggl(
\prod_{t=1}^{T}W(m_{t})\biggr)
y^{\sum_{t=1}^{T}k_{t}\alpha_{t}}.
\end{equation}
\begin{rem}
For a fixed $\beta\in \N^{n}$, there is only a finite number of
$\seq{k}=(k_{1},\dots,k_{T})\in \N^{T}$ satisfying
$\beta=\sum_{t=1}^{T}k_{t} \alpha_{t}$. Therefore $\ZZ(\gamma)$ is
well-defined as an element of $\Ah_{Q}$. In our previous paper
\cite{KT2014}, we had no $\N^{n}$-grading and thus needed the
additional ``positive'' assumption on the quadratic form in the
mutation weight to guarantee this finiteness.
\end{rem}
\section{Backtracking invariance of the partition $q$-series}
\label{sec:backtracking}
Two successive mutations at the same vertex is called
\emph{backtracking}. It is well known that under backtracking a quiver
comes back to its original form: $\mu_{v}(\mu_{v}(Q))=Q$. All the
$c$-vectors recover their original values since
$\mu_{v}(\mu_{v}(\widetilde{Q}))=\widetilde{Q}$.
In this section, we prove that the partition series are invariant under
insertion or deletion of backtracking. The original version
\cite{KT2014} of partition $q$-series lacks this property; this is one
reason why we adopt different rules (e.g. \eqref{eq:s-evolution}) for
different signs (red/green).
\begin{theorem}
\label{prop:Z-backtrack-inv} The partition $q$-series is invariant
under insertion or deletion of backtracking:
\begin{equation}
\label{eq:Z-backtrack-inv}
\ZZ((Q;\seq{m}_{1}v\,v\,\seq{m}_{2},\varphi))=
\ZZ((Q;\seq{m}_{1}\seq{m}_{2},\varphi)).
\end{equation}
\end{theorem}
\begin{figure}[tbh]
\begin{equation*}
\vcenter{ \xygraph{!{<0cm,0cm>;<23pt,0cm>:<0cm,13pt>::}
!{(0,0)}*+{Q}="Q0"
!{(4,1) }*+{Q'}="Q1"
!{(6,0)}*+{Q''}="Q2"
!{(4,-1) }*+{Q'''}="Q3"
"Q0":@/^1cm/"Q1"^{\textstyle {\seq{m}_{1}}}
"Q3":@/^1cm/"Q0"^{\textstyle {\seq{m}_{2}}}
"Q1":"Q2"^{\textstyle \mu_{v}}
"Q2":"Q3"^{\textstyle \mu_{v}}
"Q1":@{=}"Q3"}}
\end{equation*}
\caption{Mutation loop with backtracking.}
\label{fig:backtracking}
\end{figure}
\begin{figure}[tbh]
\begin{equation*}
\xygraph{
!{<0cm,0cm>;<40mm,0cm>:<0cm,18mm>::}
!{(0,0)}*++{Q'=\vcenter{
\xybox{\xygraph{!{<0cm,0cm>;<15pt,0cm>:<0cm,25pt>::}
!{(1,1) }*+<3pt>{x'}="x"
!{(0,0) }*+<3pt>{a_{i}}="a"
!{(2,0) }*+<3pt>{b_{j}}="b"
"a":"x" "x":"b" }}}}="Q0"
!{(1,0)}*++{Q''=\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<15pt,0cm>:<0cm,25pt>::}
!{(1,1) }*+<3pt>{x''}="x"
!{(0,0) }*+<3pt>{a_{i}}="a"
!{(2,0) }*+<3pt>{b_{j}}="b"
"x":"a" "b":"x" }}}}="Q1"
!{(2,0)}*++{Q'''=\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<15pt,0cm>:<0cm,25pt>::}
!{(1,1) }*+<3pt>{x'''}="x"
!{(0,0) }*+<3pt>{a_{i}}="a"
!{(2,0) }*+<3pt>{b_{j}}="b"
"a":"x" "x":"b" }}}}="Q2"
"Q0":@{=>}^{\textstyle \mu_{v}}"Q1"
"Q1":@{=>}^{\textstyle \mu_{v}}"Q2"
}\qquad ~
\end{equation*}
\caption{Backtracking. Only the arrows incident on $v$ are
shown. }\label{fig:mux^2}
\end{figure}
\begin{proof}
The mutation loop $(Q;\seq{m}_{1}v\,v\,\seq{m}_{2},\varphi)$ is shown
in Figure \ref{fig:backtracking}. We concentrate on two successive
mutations constituting the backtracking:
\begin{equation}
\cdots \to Q'
\stackrel{\displaystyle\mu_{v}}{\longrightarrow} Q''
\stackrel{\displaystyle\mu_{v}}{\longrightarrow} Q''' \to \cdots
\end{equation}
The proof is given only for the case when the signs of these two
mutations are $(+,-) =$ (green, red); the other case $(-,+)$ is left to
the reader. By assumption, the $c$-vector $\alpha$ of the vertex $v$
changes as
\begin{equation*}
\alpha \mapsto -\alpha \mapsto \alpha
\end{equation*}
for some $\alpha\in\N^{n}\setminus \{0\}$.
Let $x'$, $x''$, $x'''$ be the $s$-variables associated with the vertex
$v$ of $Q'$, $Q''$, $Q'''$ respectively, and $k_{1}$, $k_{2}$ be the
$k$-variables corresponding to the two mutations at $v$. As in Figure
\ref{fig:mux^2}, we collectively denote by $i\to v$, $v\to j$ the
arrows of $Q'$ touching $v$, and $a_{i}$, $b_{j}$ be the corresponding
$s$-variables; some of the vertices $i$, $j$ may be missing, duplicated
or identified. By \eqref{eq:k-s-rel}, \eqref{eq:kv-s-rel}, these
$s$-variables are related with $k$- and $k^{\vee}$-variables as
\begin{align*}
k_{1}&=x'+x''-\sum a_{i},&\qquad& k^{\vee}_{1}=x'+x''-\sum b_{j}, \\
k_{2}&=\sum a_{i}-(x''+x'''),&\qquad& k^{\vee}_{2}=\sum b_{j}
-(x''+x'''). \\
\end{align*}
The weight corresponding to the backtracking $(v\,v)$ is given by
\begin{align*}
W((v\,v))=& \left( \frac{q^{\frac{1}{2}(x'+x''-\sum a_{i})(x'+x''-\sum
b_{j})}}{(q)_{x'+x''-\sum a_{i}}} \right) \times \left(
\frac{q^{-\frac{1}{2}(\sum a_{i} -(x''+x'''))(\sum b_{j}
-(x''+x'''))}}{(q^{-1})_{\sum a_{i} -(x''+x''')}} \right)
\\
& =
\frac{q^{\frac{1}{2}k_{1}(k_{1}+\sum a_{i}-\sum
b_{j})}}{(q)_{k_{1}}} \frac{q^{-\frac{1}{2}k_{2}(k_{2}+\sum
b_{j}-\sum a_{i})}}{(q^{-1})_{k_{2}}} \\ & =
\frac{q^{\frac{1}{2}(k_{1}^{2}-k_{2}^{2})}}{(q)_{k_{1}}(q^{-1})_{k_{2}}}
\left( q^{\frac{1}{2}(\sum a_{i}-\sum b_{j})} \right)^{k_{1}+k_{2}}.
\end{align*}
By summing over $k_{1},k_{2}$ with appropriate $\N^{n}$-grading (see
\eqref{eq:zz-def}), we have
\begin{align*}
& \sum_{k_{1},k_{2}=0}^{\infty}
\frac{q^{\frac{1}{2}(k_{1}^{2}-k_{2}^{2})}}{(q)_{k_{1}}(q^{-1})_{k_{2}}}
\left(q^{\frac{1}{2}(\sum a_{i}-\sum b_{j})}\right)^{k_{1}+k_{2}}
y^{(k_{1}+k_{2})\alpha} \\ & =\sum_{n=0}^{\infty}
\underbrace{\biggl( \sum_{\substack{k_{1},k_{2}\geq
0\\k_{1}+k_{2}=n}} \frac{q^{\frac{1}{2}k_{1}^{2}}}{(q)_{k_{1}}}
\frac{q^{-\frac{1}{2}k_{2}^{2}}}
{(q^{-1})_{k_{2}}}\biggr)}_{\displaystyle=\delta_{n,0}}
\left(q^{\frac{1}{2}(\sum a_{i}-\sum b_{j})}\right)^{n} y^{n\alpha}
\\ & =1,
\end{align*}
where the identity \eqref{eq:EEinv-cor} of Corollary
\ref{prop:EEinv-cor} is used. The nontrivial contribution survives
only when $k_{1}=k_{2}=0$, or equivalently $x'''=x'$ holds: all the
$s$-variables on $Q'$ and $Q'''$ are vertex-wise equal. Consequently,
to evaluate $\ZZ((Q;\seq{m}_{1}v\,v\,\seq{m}_{2},\varphi))$, we can
safely ignore the backtracking without changing its value; thus we have
proved \eqref{eq:Z-backtrack-inv}.
\end{proof}
\section{Quantum dilogarithms and the combinatorial DT invariants}
\label{comb-DT}
Kontsevich and Soibelman \cite{Kontsevich2008,Kontsevich2010} developed
a general theory including motivic Donaldson-Thomas invariants,
wall-crossings, and cluster algebras. As a combinatorial analogue of
this, Keller \cite{Keller2011,Keller2012,Keller2013a} introduced and
studied reddening sequences and combinatorial Donaldson-Thomas
invariants.
In this section, we briefly summarize these notions and some known
facts. The relationship with partition $q$-series is the main subject
of this paper and will be discussed in Section \ref{sec:Z-and-DT}.
\subsection{Quantum dilogarithms}
A quantum dilogarithm series is defined by
\begin{equation}
\EE(y;q) :=1+\frac{q^{1/2}}{q-1}y+\cdots
+\frac{q^{n^{2}/2}}{(q^{n}-1)(q^{n}-q^{2})
\cdots (q^{n}-q^{n-1})}y^{n}+\cdots.
\end{equation}
It is also expressed as
\begin{align}
\EE(y;q)
& = \sum_{n=0}^{\infty} \frac{(-1)^{n}q^{n/2}}{(q)_{n}}y^{n}
= \sum_{n=0}^{\infty} \frac{q^{-\frac{1}{2}n^{2}}}{(q^{-1})_{n}}y^{n}
=\prod_{n=0}^{\infty} \frac{1}{1+q^{n+\frac{1}{2}}y}
\\ &
=\exp\left(
\sum_{k=1}^{\infty} \frac{(-y)^k }{k (q^{-k/2} - q^{k/2})}
\right).
\label{eq:E=exp()}
\end{align}
We will mostly use the following form
\begin{equation}
\EE(y;q^{-1})
= \sum_{n=0}^{\infty} \frac{q^{\frac{1}{2}n^{2}}}{(q)_{n}}y^{n},\qquad
\EE(y;q)
= \sum_{n=0}^{\infty} \frac{q^{-\frac{1}{2}n^{2}}}{(q^{-1})_{n}}y^{n}
\end{equation}
It is well-known that if $u$ and $v$ satisfies the relation $uv=qvu$,
then the pentagon identity holds
\cite{Schuetzenberger1953,Faddeev1993,Faddeev1994}:
\begin{equation}
\label{eq:EE=EEE}
\EE(u;q)\EE(v;q)=
\EE(v;q)\EE(q^{-1/2}uv;q)\EE(u;q).
\end{equation}
\subsection{Reddening sequences}
\label{sec:reddening-DT}
Consider a mutation sequence $\seq{m}=(m_{1},m_{2},\dots,m_{T})$ on a quiver $Q$:
\begin{equation}
\label{eq:Q-seq-3}
\xygraph{!{<0cm,0cm>;<18mm,0cm>:<0cm,20pt>::}
!{(0,0)}*+{Q(0)}="q0"
!{(1,0)}*+{Q(1)}="q1"
!{(2,0)}*+{~\cdots~}="q2"
!{(2.9,0)}*+{Q(t{-}1)}="q3"
!{(4.1,0) }*+{Q(t)}="q4"
!{(5,0)}*+{~\cdots~}="q5"
!{(6,0) }*+{Q(T)}="q6"
"q0":^{\textstyle \mu_{m_{1}}}"q1"
"q1":^{\textstyle \mu_{m_{2}}}"q2"
"q2":"q3"
"q3":^{\textstyle \mu_{m_{t}}}"q4"
"q4":"q5"
"q5":^{\textstyle \mu_{m_{T}}}"q6"
}.
\end{equation}
The mutation sequence $\seq{m}$ is called \emph{reddening} if all
vertices of the final quiver $Q(T)$ are red. Clearly, all maximal green
sequences are reddening, but the latter class is much wider. Not all
quivers admit reddening sequences.
The following facts are known:
\begin{theorem}[Keller\cite{Keller2012}]
\label{thm:EEm-reddening}
If $\seq{m}$ and $\seq{m}'$ are reddening
sequences on the quiver $Q$, then there is a frozen isomorphism between
the final ice quivers $\mu_{\seq{m}}(Q^{\wedge})\simeq
\mu_{\seq{m}'}(Q^{\wedge})$.
\end{theorem}
\begin{theorem}[Br{\"u}stle--Dupont--P{\'e}rotin \cite{Bruestle2013}]
\label{thm:reddening=rev-end} Let $\seq{m}=(m_{1},\cdots,m_{T})$ be a
reddening sequence. Then the associated final ice quiver
$\widetilde{Q}(T)=\mu_{\seq{m}} (Q^{\wedge})$ is frozen isomorphic to a
co-framed quiver $Q^{\vee}$, that is, there is a permutation $\varphi$
of $Q_{0}=\{1,2,\dots,n\}$ such that
\begin{enumerate}[(i)]
\item $\varphi$ represents an isomorphism of quivers $Q(T)\simeq
Q(0)$, and
\item in the final ice quiver $\widetilde{Q}(T)$, $i'\to \varphi(i)$
is the only arrow starting from $i'$ and there is no arrow
pointing to $i'$. In terms of $c$-vectors, we have
$c_{i}(T)=-e_{\varphi(i)}$.
\end{enumerate}
\end{theorem}
Thanks to Theorem \ref{thm:reddening=rev-end}, every reddening sequence
$\seq{m}$ is naturally associated with a mutation loop: we can use
$\varphi$ as a boundary condition to make up a mutation loop $\gamma
=(Q;\seq{m},\varphi)$, which will be called \emph{reddening mutation
loop} corresponding to $\seq{m}$.
\subsection{Combinatorial DT invariants}
Following Keller, let us associate a quantum dilogarithm $
\EE(y^{\alpha_{t}};q^{\varepsilon_{t}})$ for each mutation
$\mu_{m_{t}}:Q(t-1)\to Q(t)$. Here $\varepsilon_{t}$ is the sign of
$\mu_{m_{t}}$ (see \eqref{eq:eps-def}) and
$\alpha_{t}=\varepsilon_{t}c_{m_{t}}(t-1)\in \N^{n}$ is the
(sign-corrected) $c$-vector (see \eqref{eq:alpha-def}). For a mutation
sequence \eqref{eq:Q-seq-3}, we consider the following ordered product
of these:
\begin{equation}
\EE(Q;\seq{m}):=
\EE(y^{\alpha_{1}};q^{\varepsilon_{1}})
\EE(y^{\alpha_{2}};q^{\varepsilon_{2}})
\cdots
\EE(y^{\alpha_{T}};q^{\varepsilon_{T}})\quad \in \Ah_{Q}.
\end{equation}
Here, the algebra $\Ah_{Q}$ and the skew-symmetric form $\vev{~,~}$ are
always defined in terms of the initial quiver $Q=Q(0)$. The product of
quantum dilogarithms enjoy the following remarkable property.
\begin{theorem}[Keller\cite{Keller2012}, Nagao\cite{Nagao2011}]
\label{thm:EEm=EEm'} If $\seq{m}$ and $\seq{m}'$ are two mutation
sequences such that there is a frozen isomorphism between
$\mu_{\seq{m}}(Q^{\wedge})$ and $\mu_{\seq{m}'}(Q^{\wedge})$, then we
have $\EE(Q;\seq{m})=\EE(Q;\seq{m}')$.
\end{theorem}
Theorems \ref{thm:EEm-reddening} and \ref{thm:EEm=EEm'} imply that if
$Q$ admits a reddening sequence $\seq{m}$, the power series
\begin{equation}
\EE_{Q}:= \EE(Q;\seq{m})\in \Ah_{Q}.
\end{equation}
is independent of the choice of the reddening sequence $\seq{m}$ and is
canonically associated with $Q$. Keller \cite{Keller2013a} named this
invariant as \emph{combinatorial Donaldson-Thomas (DT) invariant}.
The pentagon identity \eqref{eq:EE=EEE} is nothing but the combinatorial
DT invariant of $A_{2}$ quiver $Q=(1{\to}2)$ corresponding to the two
reddening sequences $\seq{m}=(1,2)$ and $\seq{m}'=(2,1,2)$ depicted in
Figure \ref{fig:pentagon}. $\gamma=(Q;(1,2), \id)$ and
$\gamma'=(Q;(2,1,2), (12))$ are the reddening mutation loops
corresponding to $\seq{m}$ and $\seq{m}'$, respectively.
\begin{rem}
The statements of Theorems \ref{thm:EEm-reddening} and
\ref{thm:reddening=rev-end} are combinatorial, but the known proofs are
based on categorification in terms of Ginzburg dg-algebra
\cite{Ginzburg2006}.
\end{rem}
\section{Partition $q$-series and the combinatorial DT invariant}
\label{sec:Z-and-DT}
We have seen that every reddening sequence $\seq{m}$ is canonically
associated with a mutation loop $\gamma=(Q;\seq{m},\varphi)$. It is
thus natural to compare the combinatorial $DT$ invariant
$\EE_{Q}=\EE(Q;\seq{m})$ with the partition $q$-series $\ZZ(\gamma)$.
In this section, we show that there is a precise match between the
partition $q$-series and the product of quantum dilogarithms for any
reddening mutation sequence. Therefore, the partition $q$-series
provide a state-sum interpretation (fermionic sum formula) for the
combinatorial Donaldson-Thomas invariants.
The following theorem is the main result of this paper.
\begin{theorem}
\label{thm:main} Let $\gamma=(Q;\seq{m},\varphi)$ be a reddening
mutation loop. Then, the partition $q$-series and the
combinatorial Donaldson-Thomas invariant are related as
\begin{equation}
\label{eq:ee=zz-rev-end}
\boxed{\quad
\rule[-7pt]{0pt}{20pt}
\ZZ(\gamma)=\overline{\EE(Q;\seq{m})}.
\quad
}
\end{equation}
Here $\overline{\phantom{x}}:\Ah_{Q}\to \Ah_{Q}$ is a $\Q$-algebra
anti-automorphism defined in \eqref{eq:anti-autom}.
\end{theorem}
Section \ref{sec:Examples} contains various examples of partition
$q$-series covered by Theorem \ref{thm:main}. The rest of this section
is devoted to the proof of Theorem \ref{thm:main}.
\begin{rem}
In the paper \cite{Cecotti2010}, Cecotti-Neitzke-Vafa propose
a relation between four-dimensional gauge theories and parafermionic
conformal field theories. In particular, they found a wonderful
observation that the canonical trace of a special product of quantum
dilogarithms associated with a Dynkin diagram is written in terms of
characters. It would be interesting to find a precise relation with
their work.
\end{rem}
\subsection{Evolution along mutation sequence}
In this subsection, we collect some results how the $s$-variables
$\{s_{i}(t)\}$ and $c$-vectors $\{c_{i}(t)\}$ evolve along the mutation
sequence \eqref{eq:Q-seq-3}. These are needed to keep track of $\N^{n}$
grading of partition $q$-series.
Proposition \ref{prop:CBC=B} is due to Nakanishi-Zelevinsky
\cite{Nakanishi2012a}. A proof is given here to make this paper
self-contained.
\begin{prop}
\label{prop:CBC=B} For the mutation sequence \eqref{eq:Q-seq-3}, we have
\begin{equation}
\label{eq:Bcc-t}
B(t)_{ij}=\vev{c_{i}(t),c_{j}(t)},\qquad (0\leq t\leq T)
\end{equation}
or equivalently,
\begin{equation}
\label{eq:CBC=B}
C(t)B(0)C(t)^{\top} =B(t).\qquad (0\leq t\leq T)
\end{equation}
\end{prop}
\begin{proof}
We prove \eqref{eq:Bcc-t} by induction on $t$. The case $t=0$ is clear
from \eqref{def:vev} and $c_{i}(0)=e_{i}$. Assuming \eqref{eq:Bcc-t} to
hold for $t$, we consider the mutation $\mu_{v}:Q(t)\to Q(t+1)$ where
$v=m_{t+1}$. By skewness of $\vev{~,~}$, it suffices to consider
the following four cases:
\begin{itemize}
\itemsep=2ex
\item (case A-1) $i=v$, $j\neq v$.
\begin{align*}
& \vev{c_{v}(t+1),c_{j}(t+1)}
= \vev{
-c_{v}(t),c_{j}(t)+ Q(t)_{j,v} c_{v}(t)}
& \quad\text{(using \eqref{eq:c-vec-change})}
\\
& = - \vev{c_{v}(t),c_{j}(t)}
& \llap{(\text{skew-symmetry of $\vev{~,~}$})}
\\ &
= -B(t)_{v,j}
& \llap{(\text{by induction hypothesis})}
\\
& = B(t+1)_{v,j}.
& \llap{(\text{using \eqref{eq:matrix-mutation}})}
\end{align*}
\item (case A-2) $i\neq v$, $j=v$. The proof closely parallels that of
(case A-1).
\item (case B-1) $i\neq v$, $j\neq v$, $\mu_{v}$ is green mutation
\begin{align*}
& \vev{c_{i}(t+1),c_{j}(t+1)}
\\ &
= \vev{
c_{i}(t)+Q(t)_{i,v}c_{v}(t),
c_{j}(t)+Q(t)_{j,v}c_{v}(t)
}
&
\llap{\text{(using \eqref{eq:c-vec-change})}}
\\[.5ex]
& = \vev{c_{i}(t),c_{j}(t)} +
Q(t)_{i,v} \vev{c_{v}(t), c_{j}(t)}
+
Q(t)_{j,v} \vev{ c_{i}(t), c_{v}(t) }
\\
&
& \llap{(\text{skew-symmetry of $\vev{~,~}$})}
\\[.5ex]
& = B(t)_{i,j} +
Q(t)_{i,v} B(t)_{v,j}
+
Q(t)_{j,v} B(t)_{i,v}
& \quad \llap{(\text{by induction hypothesis})}
\\[.5ex]
& = B(t)_{i,j} +
Q(t)_{i,v} (Q(t)_{v,j}-Q(t)_{j,v})
+
Q(t)_{j,v} (Q(t)_{i,v}-Q(t)_{v,i})
\\[.5ex]
& = B(t)_{i,j} +
Q(t)_{i,v} Q(t)_{v,j}
- Q(t)_{j,v}Q(t)_{v,i}
\\[.5ex]
& = B(t+1)_{i,j}.
& \llap{(\text{using \eqref{eq:matrix-mutation}})}
\end{align*}
\item (case B-2) $i\neq v$, $j\neq v$, $\mu_{v}$ is red
mutation. The proof is similar to that of (case B-1).
\end{itemize}
In conclusion, \eqref{eq:Bcc-t} is also true for $t+1$.
\end{proof}
Since $c$-vectors $\{c_{i}(t)\}$ form a basis of $\Z^{n}$ for each $t$,
it is natural to introduce the \emph{state vector} of $Q(t)$ defined by
\begin{equation}
\label{eq:psi-def} \psi(t):=\sum_{i=1}^{n} s_{i}(t) c_{i}(t) ~\in
\Z^{n}\qquad (0\leq t\leq T).
\end{equation}
\begin{prop}
\label{prop:psi-change}
Along the mutation sequence \eqref{eq:Q-seq-3},
the state vector changes as
\begin{equation}
\label{eq:psi-change}
\psi(t)=
\psi(t{-}1) -k_{t} \alpha_{t},\qquad (t=1,\dots,T).
\end{equation}
\end{prop}
\begin{proof}
There are two cases to be considered.
Case 1) $\mu_{m_{t}}:Q(t-1)\to Q(t)$ is green ($\varepsilon_{t}=+1$):
\begin{align*}
\psi(t)&=\sum_{i} s_{i}(t)c_{i}(t)
\\[-1ex]
& =s_{m_{t}}(t)c_{m_{t}}(t)
+\sum_{i\neq m_{t}} s_{i}(t)c_{i}(t)
\\[-1ex]
& = \Bigl(k_{t}-s_{m_{t}}(t{-}1)+\sum_{a} Q(t{-}1)_{a,m_{t}}
s_{a}(t{-}1)\Bigr)(-c_{m_{t}}(t{-}1))
&&\qquad& (\text{by \eqref{eq:s-evolution}})
\\[-1ex]
& \qquad +\sum_{i\neq m_{t}} s_{i}(t{-}1)
\bigl(c_{i}(t{-}1)+Q(t{-}1)_{i,m_{t}}c_{m_{t}}(t{-}1)\bigr)
&&& (\text{by \eqref{eq:c-vec-change}})
\\[-1ex]
& = \bigl(k_{t}-s_{m_{t}}(t{-}1)\bigr)(-c_{m_{t}}(t{-}1))
+\sum_{i\neq m_{t}} s_{i}(t{-}1)
\bigl(c_{i}(t{-}1)\bigr)
\\[-1ex]
& = -k_{t} c_{m_{t}}(t{-}1)+\sum_{i} s_{i}(t{-}1)c_{i}(t{-}1)
\\[-.5ex]
& =\psi(t{-}1) -k_{t} \varepsilon_{t}c_{m_{t}}(t{-}1)
\\[.5ex]
& = \psi(t{-}1)-k_{t} \alpha_{t}.
\end{align*}
Case 2) $\mu_{m_{t}}:Q(t-1)\to Q(t)$ is red ($\varepsilon_{t}=-1$):
\begin{align*}
\psi(t)&=\sum_{i} s_{i}(t)c_{i}(t)
\\[-1ex]
& =s_{m_{t}}(t)c_{m_{t}}(t)
+\sum_{i\neq m_{t}} s_{i}(t)c_{i}(t)
\\[-1ex]
& = \Bigl(-k_{t}-s_{m_{t}}(t{-}1)+\sum_{b} Q(t{-}1)_{m_{t},b}
s_{b}(t{-}1)\Bigr)(-c_{m_{t}}(t{-}1))
&&\quad& (\text{by \eqref{eq:s-evolution}})
\\[-1ex]
& \qquad
+\sum_{i\neq m_{t}} s_{i}(t{-}1)
\bigl(c_{i}(t{-}1)+Q(t{-}1)_{m_{t},i}c_{m_{t}}(t{-}1)\bigr)
&&& (\text{by \eqref{eq:c-vec-change}})
\\[-1ex]
& = \bigl(-k_{t}-s_{m_{t}}(t{-}1)\bigr)(-c_{m_{t}}(t{-}1))
+\sum_{i\neq m_{t}} s_{i}(t{-}1)
\bigl(c_{i}(t{-}1)\bigr)
\\[-1ex]
& = +k_{t} c_{m_{t}}(t{-}1)+\sum_{i} s_{i}(t{-}1)c_{i}(t{-}1)
\\[-.5ex]
& =\psi(t{-}1) -k_{t} \varepsilon_{t}c_{m_{t}}(t{-}1)
\\[.5ex]
& = \psi(t{-}1)-k_{t} \alpha_{t}.
\end{align*}
\end{proof}
Therefore $\N^{n}$-grading of the partition $q$-series expresses the
total change of the state vector around the mutation loop:
\begin{cor}
\label{prop:psi-in-out} The state vectors of the initial and the final
quivers are related as
\begin{equation*}
\label{eq:psi-in-out}
\psi(0)-\psi(T)=\sum_{t=1}^{T}k_{t}\alpha_{t}.
\end{equation*}
\end{cor}
\begin{lemma}
\label{prop:rev-end} Let $\gamma=(Q;\seq{m},\varphi)$ be a reddening
mutation loop. Then,
\begin{enumerate}[(i)]
\item The state vectors $\{\psi(t)\}_{t=0}^{T}$ are anti-periodic
along the loop, that is,
\begin{equation*}
\label{eq:psi-anti-periodic}
\psi(T)=-\psi(0).
\end{equation*}
\item The mutation loop $\gamma$ is non-degenerate. In particular, the
initial $s$-variables are
expressed as
\begin{equation*}
\seq{s}(0):=(s_{1}(0),\dots,s_{n}(0))
=\frac{1}{2}\sum_{t=1}^{T}k_{t}\alpha_{t}.
\end{equation*}
\end{enumerate}
\end{lemma}
\begin{proof}
By the boundary condition $\varphi$, the initial and the final
$s$-variables are identified as $s_{i}(T)=s_{\varphi(i)}(0)$. By (ii)
of Theorem \ref{thm:reddening=rev-end}, we have also
$c_{i}(T)=-c_{\varphi(i)}(0)$. Therefore
\begin{equation*}
\psi(T)=\sum_{i=1}^{n} s_{i}(T)c_{i}(T) =- \sum_{i=1}^{n}
s_{\varphi(i)}(0)c_{\varphi(i)}(0) =- \sum_{j=1}^{n}
s_{j}(0)c_{j}(0)= -\psi(0).
\end{equation*}
This proves (i). We have then
\begin{align*}
\seq{s}(0)&=\sum_{i=1}^{n} s_{i}(0)e_{i}
=\sum_{i=1}^{n} s_{i}(0)c_{i}(0) =\psi(0)
=\frac{1}{2}(\psi(0)-\psi(T))
=\frac{1}{2}\sum_{t=1}^{T}k_{t}\alpha_{t},
\end{align*}
where the last equality is by Corollary \ref{prop:psi-in-out}. Thus the
initial $s$-variables are expressed in terms of $k$-variables
alone. We can obtain similar formulas for the remaining
$s$-variables by recursive use of the relation \eqref{eq:s-evolution}. This
proves (ii).
\end{proof}
The following relation will play a key role in the proof of Theorem
\ref{thm:main}.
\begin{prop}
\label{prop:kkv-k2-rel} For any mutation sequence, we have
\begin{equation}
\label{eq:kkv-k2-rel}
\rule[-6pt]{0pt}{20pt}
\sum_{t=1}^{T}\varepsilon_{t}k_{t}k_{t}^{\vee}
+\vev{\psi(0), \psi(T)}
= \sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}
- \sum_{1\leq i< j\leq
T}k_{i}k_{j}\vev{\alpha_{i},\alpha_{j}}.
\end{equation}
\end{prop}
\begin{proof}
\begin{align*}
& \sum_{t=1}^{T}\varepsilon_{t}k_{t}k_{t}^{\vee}-
\sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}
= \sum_{t=1}^{T}\varepsilon_{t}k_{t}
(k_{t}^{\vee}-k_{t})
\\
&= \sum_{t=1}^{T}\varepsilon_{t}k_{t}
\sum_{i=1}^{n} B(t{-}1)_{i,m_{t}} s_{i}(t{-}1)
& (\text{by \eqref{eq:k-kv-rel}})
\\
&= \sum_{t=1}^{T}\varepsilon_{t}k_{t}
\sum_{i=1}^{n} \vev{c_{i}(t{-}1),c_{m_{t}}(t{-}1)} s_{i}(t{-}1)
& (\text{by \eqref{eq:Bcc-t}})
\\
&= \sum_{t=1}^{T}k_{t}
\sum_{i=1}^{n} \vev{c_{i}(t{-}1),\alpha_{t}} s_{i}(t{-}1)
& (\text{by \eqref{eq:alpha-def}})
\\
&= \sum_{t=1}^{T}k_{t}
\vev{ \psi(t{-}1),\alpha_{t}}
& (\text{by \eqref{eq:psi-def}})
\\
&= \sum_{t=1}^{T}k_{t}
\vev{ \psi(0)-\sum_{i=1}^{t-1}k_{i}\alpha_{i},\alpha_{t}}
& (\text{by \eqref{eq:psi-change}})
\\
&= \sum_{t=1}^{T}k_{t}
\vev{ \psi(0),\alpha_{t}}
- \sum_{t=1}^{T}\sum_{i=1}^{t-1} k_{i} k_{t}
\vev{ \alpha_{i},\alpha_{t}}
\\
&=
\bvev{ \psi(0),\sum_{t=1}^{T}k_{t}\alpha_{t}}
- \sum_{j=1}^{T}\sum_{i=1}^{j-1} k_{i} k_{j}
\vev{ \alpha_{i},\alpha_{j}}
\\
&=
\vev{ \psi(0),\psi(0)-\psi(T)}
- \sum_{1\leq i< j\leq T}k_{i} k_{j}
\vev{ \alpha_{i},\alpha_{j}}
& (\text{by Corollary \ref{prop:psi-in-out}})
\\
&=
- \vev{ \psi(0),\psi(T)}
- \sum_{1\leq i< j\leq T}k_{i} k_{j}
\vev{ \alpha_{i},\alpha_{j}}.
& (\text{by skewness of $\vev{~,~}$})
\end{align*}
By arranging the terms, we obtain \eqref{eq:kkv-k2-rel}.
\end{proof}
\subsection{Proof of Theorem \ref{thm:main}}
We are now ready to prove Theorem \ref{thm:main}.
The partition $q$-series associated with the loop $\gamma$ is defined to be
\begin{equation}
\label{eq:zz-reverse}
\begin{split}
\ZZ(\gamma) &= \sum_{\seq{k}\in \N^{T}} \prod_{t=1}^{T}W(m_{t}) \;
y^{\sum_{t=1}^{T}k_{t}\alpha_{t}}
=
\sum_{\seq{k}\in \N^{T}}
\frac{q^{\frac{1}{2}\sum_{t=1}^{T}\varepsilon_{t}k_{t}k_{t}^{\vee}}}
{\prod_{t=1}^{T} (q^{\varepsilon_{t}})_{k_{t}}}\,
y^{\sum_{t=1}^{T}k_{t}\alpha_{t}}.
\end{split}
\end{equation}
On the other hand, the quantum dilogarithm product along $\seq{m}$ is
given by
\begin{equation*}
\begin{split}
\EE(Q;\seq{m}) &=
\EE(m_{1};q^{\varepsilon_{1}})\EE(m_{2};q^{\varepsilon_{2}})
\cdots \EE(m_{T};q^{\varepsilon_{T}})
\\
&=
\biggl(
\sum_{k_{1}=0}^{\infty}
\frac{q^{-\frac{\varepsilon_{1}}{2}k_{1}^{2}}}
{(q^{-\varepsilon_{1}})_{k_{1}}}
y^{k_{1}\alpha_{1}}\biggr)
\cdots
\biggl(
\sum_{k_{T}=0}^{\infty}
\frac{q^{-\frac{\varepsilon_{T}}{2}k_{T}^{2}}}
{(q^{-\varepsilon_{T}})_{k_{T}}}
y^{k_{T}\alpha_{T}}\biggr)
\\
&
=
\sum_{\seq{k}\in \N^{T}}
\frac{q^{-\frac{1}{2}\sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}}}
{\prod_{t=1}^{T} (q^{-\varepsilon_{t}})_{k_{t}}}\,
y^{k_{1}\alpha_{1}}
\cdots
y^{k_{T}\alpha_{T}}
\\
&
=
\sum_{\seq{k}\in \N^{T}}
\frac{q^{-\frac{1}{2}\sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}}}
{\prod_{t=1}^{T} (q^{-\varepsilon_{t}})_{k_{t}}}
q^{\frac{1}{2}\sum_{1\leq i< j\leq T}k_{i}k_{j}
\vev{\alpha_{i},\alpha_{j}}}\,
y^{\sum_{t=1}^{T}k_{t}\alpha_{t}}.
\end{split}
\end{equation*}
Therefore,
\begin{equation}
\label{eq:E-bar-rev} \overline{\strut \EE(Q;\seq{m})} =
\sum_{\seq{k}\in \N^{T}}
\frac{q^{\frac{1}{2}\sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}}}{\prod_{t=1}^{T}
(q^{\varepsilon_{t}})_{k_{t}}} q^{-\frac{1}{2} \sum_{1\leq i< j\leq
T}k_{i}k_{j}\vev{\alpha_{i},\alpha_{j}}}\,
y^{\sum_{t=1}^{T}k_{t}\alpha_{t}}.
\end{equation}
Thus, all we have to show is that the exponents of $q$ in the summands
of \eqref{eq:zz-reverse} and \eqref{eq:E-bar-rev} are equal for every
$\seq{k}$:
\begin{equation}
\label{eq:zz-ee}
\sum_{t=1}^{T}\varepsilon_{t}k_{t}k_{t}^{\vee}
= \sum_{t=1}^{T}\varepsilon_{t}k_{t}^{2}
- \sum_{1\leq i< j\leq T}k_{i}k_{j}\vev{\alpha_{i},\alpha_{j}}.
\end{equation}
Indeed, by Lemma \ref{prop:rev-end} (i), we have $\psi(T)=-\psi(0)$,
which implies $ \vev{\psi(0),\psi(T)}=-\vev{\psi(0),\psi(0)}=0$ by the
skewness of $\vev{~,~}$. Then \eqref{eq:zz-ee} follows from Proposition
\ref{prop:kkv-k2-rel}. This completes the proof of Theorem
\ref{thm:main}.
\section{Examples}
\label{sec:Examples}
In this section, we collect various examples of the reddening mutation
loops and the associated partition $q$-series to illustrate Theorem
\ref{thm:main}.
\subsection{$A_{2}^{(1)}$-quiver}
As a simplest example of quiver with an oriented cycle, let us take the
$A_{2}^{(1)}$ quiver
\begin{equation*}
Q=\quad\vcenter{\xybox{ \xygraph{!{<0cm,0cm>;<7mm,0cm>:<0cm,7mm>::}
!{a(90)}*+{1}="1" !{a(210) }*+{2}="2" !{a(330) }*+{3}="3" "1":"2"
"2":"3" "3":"1" }}}.
\end{equation*}
By performing successive mutations on $\widetilde{Q}(0):=Q^{\vee}$
(Figure \ref{fig:A2(1)-loop}), it is easy to see that the mutation
sequence
\begin{equation*}
\seq{m}=(1,2,3,1)
\end{equation*}
is maximal green, reddening sequence with the boundary condition
\begin{equation}
\label{eq:A2(1)-bc}
(13)=(1\mapsto 3, ~2\mapsto 2, ~3\mapsto 1)\in S_{3}.
\end{equation}
From Figure \ref{fig:A2(1)-loop} we can read off the $c$-vectors of the
mutating vertices:
\begin{align*}
\alpha _1 = c_{1}(0)= (1,0,0), &&&
\alpha _2 = c_{2}(1)= (0,1,0), \\
\alpha _3 = c_{3}(2)= (1,0,1), &&&
\alpha _4 = c_{1}(3)= (0,0,1).
\end{align*}
The $s$-variables change as follows (cf. \eqref{eq:s-evolution}):
\begin{equation*}
\renewcommand{\arraystretch}{1.1}
\begin{array}{c|c|c|c}
& 1 & 2 & 3 \\
\hline
Q(0) & s_1 & s_2 & s_3 \\
Q(1) & s_{1}'=k_{1}-s_1+s_3 & s_2 & s_3 \\
Q(2) & s_{1}'=k_1-s_1+s_3 & s_{2}'=k_2-s_2 & s_3 \\
Q(3) & s_{1}'=k_1-s_1+s_3 & s_{2}'=k_2-s_2 & s_{3}'=k_3-s_{3}+s_{1}' \\
Q(4) & s_{1}''=k_4-s_{1}'+s_{3}' & s_{2}'=k_2-s_2
& s_{3}'=k_3-s_{3}+s_{1}'
\end{array}
\end{equation*}
The boundary condition \eqref{eq:A2(1)-bc} imposes
\begin{equation*}
s_{1}''=s_3,\qquad s_{2}'=s_2,\qquad
s_{3}'=s_1.
\end{equation*}
From these relations, we can express $s$-variables in terms of
$k$-variables:
\begin{equation*}
s_1 = s_{3}'= \frac{1}{2} \left(k_1+k_3\right),\quad
s_{1}'=\frac{1}{2}(k_{1}+k_{4}),\quad
s_2 = s_{2}'= \frac{k_2}{2},\quad
s_3 = s_{1}''= \frac{1}{2} \left(k_3+k_4\right).
\end{equation*}
The $k^{\vee}$-variables are then
\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\arraycolsep=2pt
\begin{array}{rclcl}
k_{1}^{\vee} &=& s_{1}+s_{1}'-s_{2} &=&
k_1-\frac{k_2}{2}+\frac{k_3}{2}+\frac{k_4}{2},
\\
k_{2}^{\vee} &=& s_{2}+s_{2}'-s_{1}' &=&
-\frac{k_1}{2}+k_2-\frac{k_4}{2},
\\
k_{3}^{\vee} &=& s_{3}+s_{3}' &=&
\frac{k_1}{2}+k_3+\frac{k_4}{2},
\\
k_{4}^{\vee} &=& s_{1}'+s_{1}''-s_{2}' &=&
\frac{k_1}{2}-\frac{k_2}{2}+\frac{k_3}{2}+k_4.
\end{array}
\end{equation*}
Plugging these into the definition of mutation weights \eqref{eq:W-def}
and summing over $k$-variables, we obtain
\begin{equation}
\label{eq:Z-A2(1)}
\ZZ(\gamma)=\sum_{\seq{k}\in \N^{4}}
\frac{q^{\frac{1}{2}(k_1^2+k_2^2+k_3^2+k_4^2-k_1 k_2 + k_1 k_3
+ k_1 k_4 -k_2 k_4+k_3 k_4)}}
{(q)_{k_{1}}(q)_{k_{2}}(q)_{k_{3}}(q)_{k_{4}}} y^{(k_1+k_3,k_2,k_3+k_4)}.
\end{equation}
\begin{figure}[t]
\begin{equation*}
\xygraph{!{<0cm,0cm>;<43mm,0cm>:<0cm,40mm>::}
!{(0,1)-(0.24,-0.2)}*+{\widetilde{Q}(0)}
!{(0,1)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{1}="1"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{3}="3"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"2"
"2":"3"
"3":"1"
"1":"1'"
"2":"2'"
"3":"3'"
}}}}="q0"
!{(0,0)-(0.24,-0.2)}*+{\widetilde{Q}(1)}
!{(0,0)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{1}="1"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{3}="3"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"3"
"2":"1"
"2":"2'"
"3":"1'"
"3":"3'"
"1'":"1"
}}}}="q1"
!{(1,0)-(0.24,-0.2)}*+{\widetilde{Q}(2)}
!{(1,0)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{1}="1"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{3}="3"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"2"
"1":"3"
"3":"3'"
"3":"1'"
"1":"1'"
"2'":"2"
}}}}="q2"
!{(2,0)-(0.24,-0.2)}*+{\widetilde{Q}(3)}
!{(2,0)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{1}="1"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{3}="3"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"2"
"1":"3'"
"3":"1"
"1'":"3"
"2'":"2"
"3'":"3"
}}}
}="q3"
!{(2,1)-(0.24,-0.2)}*+{\widetilde{Q}(4)}
!{(2,1)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{1}="1"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{3}="3"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"3"
"2":"1"
"3":"2"
"1'":"3"
"2'":"2"
"3'":"1"
}}}
}="q4"
!{(1,1)}*+{
\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<6mm,0cm>:<0cm,6mm>::}
!{a(90)}*+<2.8pt>{3}="3"
!{a(210) }*+<2.8pt>{2}="2"
!{a(330) }*+<2.8pt>{1}="1"
!{(0,0);a(90)**{}?(2.4)}*+<2.8pt>{1'}="1'"
!{(0,0);a(210)**{}?(2.4)}*+<2.8pt>{2'}="2'"
!{(0,0);a(330)**{}?(2.4)}*+<2.8pt>{3'}="3'"
"1":"3"
"2":"1"
"3":"2"
"1'":"3"
"2'":"2"
"3'":"1"
}}}}="q4a"
"q0":@{=>}_{\textstyle \mu_{1}}"q1"
"q1":@{=>}^{\textstyle \mu_{2}}"q2"
"q2":@{=>}^{\textstyle \mu_{3}}"q3"
"q3":@{=>}_{\textstyle \mu_{1}}"q4"
"q4":@{=}"q4a"
"q4a":@{=>}_{\textstyle \varphi=(13)}"q0"
}
\end{equation*}
\caption{Reddening mutation loop for $A_{2}^{(1)}$-quiver.}
\label{fig:A2(1)-loop}
\end{figure}
\subsection{Square product $A_{3} \square A_{2}$}
As an example of the quivers of square product type (see \cite{KT2014}
for definition), consider
\begin{equation}
\label{eq:A3xA2-quiver}
Q=A_{3} \square A_{2}=\vcenter{
\xymatrix @R=6mm @C=6mm @M=4pt{
1 \ar[r] & 3 \ar[d] & 5\ar[l]\\
2 \ar[u]& 4 \ar[l] \ar[r]& 6 \ar[u]}
}.
\end{equation}
One can check that
\begin{equation}
\label{eq:A3xA2-revend}
\seq{m}=(1, 4, 5, 2, 3, 6, 1, 4, 5)
\end{equation}
is a reddening sequence with the boundary condition
\begin{equation}
\varphi= (12)(34)(56)=
\setlength\arraycolsep{3pt}
\left(
\begin{array}{cccccc}
1 & 2 & 3 & 4 & 5 & 6 \\
2 & 1 & 4 & 3 & 6 & 5 \\
\end{array}
\right)\in S_{6}.
\end{equation}
Let $\seq{k}=(k_{1},\dots,k_{9})$ be the $k$-variables corresponding to
mutation sequence \eqref{eq:A3xA2-revend}. The evolution of
$s$-variables along the mutation loop is summarized as follows:
\begin{equation*}
\begin{array}{rclclccc}
s_1 & \mapsto & s'_1 = k_1-s_1+s_2 & \mapsto & s''_1 =k_7-s'_1+s'_2 &
= & s_{2}\\
s_2 & \mapsto & s'_2 = k_4-s_2+s'_1 & && = & s_{1}\\
s_3 & \mapsto & s'_3 = k_5-s_3+s'_4 & && = & s_{4}\\
s_4 & \mapsto & s'_4 = k_2-s_4+ s_3 & \mapsto & s''_4 = k_8-s'_4+s'_3 &
= & s_{3} \\
s_5 & \mapsto & s'_5 = k_3-s_5+s_6 & \mapsto & s''_5 = k_9-s'_5+s'_6
& = & s_{6}\\
s_6 & \mapsto & s'_6 = k_6-s_6+s'_5 & && = & s_{5}\\\\
\end{array}
\end{equation*}
One can express all $s$-variables in terms of $k$-variables:
\begin{equation*}
\setlength\arraycolsep{1pt}
\begin{array}{rlrlrl}
s_1 = s'_2 & = \left(k_1+k_4\right)/2,&\qquad
s_{2} = s''_1 & = \left(k_4+k_7\right)/2,&\qquad
s_3 = s''_{4} & = \left(k_5+k_8\right)/2,\\
s_{4}= s'_3 & = \left(k_2+k_5\right)/2,&
s_5 =s'_6& = \left(k_3+k_6\right)/2,&
s_6 = s''_5& = \left(k_6+k_9\right)/2,\\
s'_1 & = \left(k_1+k_7\right)/2,&
s'_4 & = \left(k_2+k_8\right)/2,&
s'_5 & = \left(k_3+k_9\right)/2,
\end{array}
\end{equation*}
The $c$-vectors of mutating vertices are
\begin{equation*}
\begin{split}
&
\alpha_{1}=(100000),\quad\alpha_{2}=(000100),\quad\alpha_{3}=(000010),
\\
&
\alpha_{4}=(110000),\quad\alpha_{5}=(001100),\quad\alpha_{6}=(000011),
\\
&
\alpha_{7}=(010000),\quad\alpha_{8}=(001000),\quad\alpha_{9}=(000001).
\end{split}
\end{equation*}
We obtain the partition $q$-series
\begin{equation*}
\ZZ(\gamma)=\sum_{\seq{k}\in \N^{9}}
\frac{q^{\frac{1}{4}\seq{k}^{\top}A\,\seq{k}}}{\prod_{t=1}^{9}(q)_{k_{t}}}
y^{\beta(\seq{k})}
\end{equation*}
where
\begin{equation*}
\beta(\seq{k})=(k_1+k_4,k_4+k_7,k_5+k_8,k_2+k_5,k_3+k_6,k_6+k_9)
\end{equation*}
and $A$ is a symmetric $9\times 9$ matrix given by
\begin{equation*}
A=\left(
\begin{array}{c|c|c}
A' & A'' & A'' \\
\hline
\rule{0pt}{2.5ex} A''& A' &A'' \\
\hline
\rule{0pt}{2.5ex} A'' & A''& A' \\
\end{array}
\right),
\qquad
A'=
{ \setlength\arraycolsep{4pt}
\left(\begin{array}{rrr}
2 & 0 & 0 \\
0 & 2 & 0 \\
0 & 0 & 2 \\
\end{array}\right),}
\qquad
A''=
{ \setlength\arraycolsep{2pt}
\left(\begin{array}{rrr}
1 & -1 & -1 \\
-1 & 1 & -1 \\
-1 & -1 & 1 \\
\end{array}\right).}
\end{equation*}
\begin{rem}
The mutation loop \eqref{eq:A3xA2-revend} is different from the one
considered in our previous work:
\begin{equation*}
\gamma' =(Q,\seq{m}',\id)\qquad \seq{m}'=(1, 4, 5, 2, 3, 6).
\end{equation*}
(See Theorem 6.1 of \cite{KT2014} and the example therein.) Although
$\mu_{\seq{m}'}(Q)$ is isomorphic to $Q$, $\seq{m}'$ is not a reddening
sequence. The sequence $\seq{m}$ contains $\seq{m}'$ as a proper
subsequence.
\end{rem}
\subsection{Octahedral quiver}
Here is another example of non-alternating quiver --- the octahedral
quiver:
\begin{equation*}
Q=\quad\vcenter{\xybox{
\xygraph{!{<0cm,0cm>;<15mm,0cm>:<0cm,15mm>::}
!{a(0)}*+{1}="1"
!{a(60) }*+{2}="2"
!{a(120) }*+{3}="3"
!{a(180) }*+{4}="4"
!{a(240) }*+{5}="5"
!{a(300) }*+{6}="6"
"1":"2"
"2":"3"
"3":"4"
"4":"5"
"5":"6"
"6":"1"
"3":"1"
"4":"2"
"5":"3"
"6":"4"
"1":"5"
"2":"6"
}}}\quad.
\end{equation*}
The mutation sequence
\begin{equation*}
\seq{m}=(1, 2, 5, 6, 3, 4, 1, 2, 5, 6, 3, 4)
\end{equation*}
together with the boundary condition
\begin{equation*}
\setlength\arraycolsep{3pt}
\varphi=
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 5 & 6 & 4 & 2 & 3 \\
\end{pmatrix}
\in S_{6}.
\end{equation*}
form a reddening, maximal green mutation loop
$\gamma=(Q;\seq{m},\varphi)$ of length $T=12$.
Indeed, the $c$-matrix of the final quiver $Q(T)$ is given by
\begin{equation*}
\setlength\arraycolsep{2.8pt}
\left(
\begin{array}{rrrrrr}
-1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & -1 & 0 \\
0 & 0 & 0 & 0 & 0 & -1 \\
0 & 0 & 0 & -1 & 0 & 0 \\
0 & -1 & 0 & 0 & 0 & 0 \\
0 & 0 & -1 & 0 & 0 & 0 \\
\end{array}
\right)
\end{equation*}
which is a (negative of) permutation matrix corresponding to $\varphi$.
Let $\seq{k}=(k_{1},\dots,k_{12})$ be the $k$-variables corresponding to
mutation sequence $\seq{m}$. In this example, every vertex is mutated
twice. The evolution of $s$-variables along the mutation loop is
summarized as follows:
\begin{equation*}
\renewcommand{\arraystretch}{1.16}
\begin{array}{lllllll}
s_{1} & \mapsto & s'_1=k_1-s_1+s_3+s_6 & \mapsto &
s''_1=k_7-s'_1+s'_3+s'_6 &=& s_{1}
\\
s_{2} & \mapsto & s'_2=k_2-s_2+s_4 & \mapsto & s''_2=k_8-s'_2+s'_4
&=& s_{5}
\\
s_{3} & \mapsto & s'_3=k_5-s_3+s'_1 & \mapsto & s''_3=k_{11}-s'_3+s''_1
&=& s_{6} \\
s_{4} & \mapsto & s'_4=k_6-s_4+s'_2+s'_5 & \mapsto &
s''_4=k_{12}-s'_4 +s''_2+s''_5
&=& s_{4}
\\
s_{5} & \mapsto & s'_5=k_3-s_5+s_4 & \mapsto & s''_5=k_9-s'_5 +s'_4
&=& s_{2}
\\
s_{6} & \mapsto & s'_6=k_4-s_6+s'_1 & \mapsto & s''_6=k_{10}-s'_6+s''_1
&=& s_{3}
\end{array}
\end{equation*}
Solving these, we can express all $s$-variables in terms of $k$-variables:
\begin{align*}
s_1 & =s''_{1} = \left(k_1+k_4+k_5+k_7\right)/2, &
s_2 & =s''_{5} = \left(k_2+k_6+k_9\right)/2, \\
s_3 & =s''_{6} = \left(k_5+k_7+k_{10}\right)/2, &
s_4 & =s''_{4} = \left(k_6+k_8+k_9+k_{12}\right)/2, \\
s_5 & =s''_{2} = \left(k_3+k_6+k_8\right)/2, &
s_6 & =s''_{3} = \left(k_4+k_7+k_{11}\right)/2,\\
s'_1 & = \left(k_1+k_7+k_{10}+k_{11}\right)/2, &
s'_2 & = \left(k_2+k_8+k_{12}\right)/2\\
s'_3 & = \left(k_1+k_5+k_{11}\right)/2, &
s'_4 & = \left(k_2+k_3+k_6+k_{12}\right)/2\\
s'_5 & = \left(k_3+k_9+k_{12}\right)/2, &
s'_6 & = \left(k_1+k_4+k_{10}\right)/2.\\
\end{align*}
The partition $q$-series is now given by
\begin{equation}
\label{eq:Z-octahedron}
\ZZ(\gamma)=\sum_{\seq{k}\in \N^{12}}
\frac{q^{\frac{1}{4}\seq{k}^{\top}A\,\seq{k}}}{\prod_{i} (q)_{k_{i}}}
y^{\beta(\seq{k})},
\end{equation}
where
\begin{equation*}
\begin{split}
\beta(\seq{k})=&
\bigl(
k_1+k_4+k_5+k_7,k_2+k_6+k_9,k_5+k_7+k_{10},\\
& \qquad k_6+k_8+k_9+k_{12},k_3+k_6+k_8,k_4+k_7+k_{11}\bigr)
\in \N^{6}
\end{split}
\end{equation*}
and $A$ is the
$12\times 12$ symmetric matrix of the following form:
\begin{equation*}
A=\left(
\begin{array}{c|c}
A'& A'' \\
\hline
\rule{0pt}{2.5ex} A''& A' \\
\end{array}
\right),
\end{equation*}
\begin{equation*}
\setlength\arraycolsep{2pt}
A'=
\left(\begin{array}{rrrrrr}
2 & -1 & -1 & 1 & 1 & -2 \\
-1 & 2 & 0 & 0 & 0 & 1 \\
-1 & 0 & 2 & 0 & 0 & 1 \\
1 & 0 & 0 & 2 & 0 & -1 \\
1 & 0 & 0 & 0 & 2 & -1 \\
-2 & 1 & 1 & -1 & -1 & 2 \\
\end{array}\right),\quad
A''=
\left(\begin{array}{rrrrrr}
2 & -1 & -1 & 1 & 1 & 0 \\
-1 & 1 & 1 & -1 & -1 & 1 \\
-1 & 1 & 1 & -1 & -1 & 1 \\
1 & -1 & -1 & 1 & 1 & -1 \\
1 & -1 & -1 & 1 & 1 & -1 \\
0 & 1 & 1 & -1 & -1 & 2 \\
\end{array}\right).
\end{equation*}
By Theorem \ref{thm:main}, the partition $q$-series
\eqref{eq:Z-octahedron} is equal
to $\overline{\EE(Q;\seq{m})}$, where
\begin{equation*}
\begin{split}
\EE(Q;\seq{m})&=
\EE(y^{(1 0 0 0 0 0)})
\EE(y^{(0 1 0 0 0 0)})
\EE(y^{(0 0 0 0 1 0)})
\EE(y^{(1 0 0 0 0 1)})
\EE(y^{(1 0 1 0 0 0)})
\EE(y^{(0 1 0 1 1 0)})
\\
&\times
\EE(y^{(1 0 1 0 0 1)})
\EE(y^{(0 0 0 1 1 0)})
\EE(y^{(0 1 0 1 0 0)})
\EE(y^{(0 0 1 0 0 0)})
\EE(y^{(0 0 0 0 0 1)})
\EE(y^{(0 0 0 1 0 0)}).
\end{split}
\end{equation*}
is the product of quantum dilogarithms,
$\EE(y^\alpha)=\EE(y^{\alpha};q)$.
\subsection{Alternating quivers}
A vertex $i$ of a quiver is a \emph{source} (respectively, a
\emph{sink}) if there are no arrows $\alpha$ with target $i$
(respectively, with source $i$). A quiver is \emph{alternating} if each
of its vertices is a source or a sink. Denote by $Q_{0}^{+}$
($Q_{0}^{-}$) the set of all sources (sinks) of the alternating quiver
$Q$, respectively. Since $Q_{0}=Q_{0}^{+}\sqcup Q_{0}^{-}$, the
underlying graph $\underline{Q}$, a graph obtained by forgetting the
orientation of arrows, is bipartite.
For an alternating quiver $Q$, there is a simple recipe for constructing
a reddening sequence/loop.
\begin{prop}
\label{prop:alter-max-green} Suppose $Q$ is an alternating quiver, and
$\seq{m}_{\pm}$ be arbitrary permutations of $Q_{0}^{\pm}$,
respectively. Let $\seq{m}=\seq{m}_{+}\seq{m}_{-}$ be their
concatenation, considered as a mutation sequence
of length $n=|Q_{0}|$. Then, the
$c$-vectors of $Q(t)$ are given by
\begin{equation}
\label{eq:alt-quiv-c-evol}
c_{i}(t)=
\begin{cases}
e_{i}& \text{if~} i\not\in \{m_{1},\dots,m_{t}\},
\\
-e_{i}& \text{if~} i\in \{m_{1},\dots,m_{t}\},
\end{cases}
\qquad (0\leq t\leq n).
\end{equation}
In particular, the sequence $\seq{m}$ is maximal green and
$\gamma=(Q;\seq{m}_{+}\seq{m}_{-},\id)$ is a reddening mutation
loop.
\end{prop}
\begin{proof}
First note that $\seq{m}$ is a \emph{source sequence}, that is, each
mutating vertex $m_{t}$ is a source of $Q(t-1)$ for all $1\leq t\leq
n$. To see this, it is helpful to consider $\seq{m}_{+}$ and
$\seq{m}_{-}$ separately. The claim is clear for the mutation sequence
$\seq{m}_{+}$ applied on $Q$. When the mutation sequence $\seq{m}_{+}$
is over, we have $\mu_{\seq{m}_{+}}(Q)=Q^{op}$; here $Q^{op}$ is the
quiver obtained by reversing all the arrows in $Q$. Now all the
vertices in $\seq{m}_{-}$ are sources of $\mu_{+}(Q)=Q^{op}$, so
$\seq{m}_{-}$ is also a source sequence.
Since only source vertices are mutated, mutation rules 1) and 3) are
never used; mutations change only the orientations of arrows. The
underlying graph $\underline{Q}$ remains the same.
Let $M(t):=\{m_{1},\dots,m_{t}\}\subset Q_{0}$ be the set of mutated
vertices during the first $t$ mutations. We prove
\eqref{eq:alt-quiv-c-evol} by induction on $t$. The claim holds for
$t=0$, since $M(0)=\emptyset$ and $c_{i}(0)=e_{i}$ for all $i$. Suppose
the claim is true for $0,1,\dots,t-1$. Then the mutation
$\mu_{m_{t}}:Q(t{-}1)\to Q(t)$ is green because $m_{t}\not\in
\{m_{1},\dots,m_{t-1}\}$ and thus $c_{m_{t}}(t{-}1)=e_{m_{t}}\in \N^{n}$
by induction hypothesis. Moreover, $Q(t{-}1)_{i,m_{t}}=0$ since $m_{t}$
is a source of $Q(t{-}1)$, as we have seen above. Thus by
\eqref{eq:c-vec-change}, the $c$-vectors change as
\begin{equation*}
c_{i}(t)=\begin{cases}
-c_{i}(t{-}1) & \text{if~} i=m_{t}, \\
c_{i}(t{-}1) & \text{if~} i\neq m_{t}.
\end{cases}
\end{equation*}
With $M(t)=M(t{-}1)\sqcup \{m_{t}\}$, this shows that the claim is also
true for $t$. The rest of the proposition follows immediately from
\eqref{eq:alt-quiv-c-evol}.
\end{proof}
Let us compute $\ZZ(\gamma)$ for the reddening loop
$\gamma=(Q;\seq{m}_{+}\seq{m}_{-},\id)$. Note that the sequence
$\seq{m}=(m_{1},\dots,m_{n})$ is a permutation of $(1,\dots,n)$. Every
vertex $i$ is mutated exactly once, and the initial and final
$s$-variables $s_{i}$, $s'_{i}$ are identified by the boundary condition
$\varphi=\id$. As we will soon see, it is convenient to label
$k$-variables not by the mutation time but by the vertex label. From now
on, $k_{i}$ will denote the $k$-variable associated with the mutation at
vertex $i$, rather than $i$-th mutation.
To compute the weight for $\gamma$, it suffices to know the underlying
graph $\underline{Q}$, because we can recover arrow orientations from
the fact that ``every mutation occurs at a source''. All the information
of $\underline{Q}$ is encoded in the \emph{generalized Cartan matrix}
\begin{equation}
\label{eq:gen-Cartan}
(C)_{ij}=
\begin{cases}
2 & \text{if~} i=j, \\
-(Q_{ij}+Q_{ji}) & \text{if~} i\neq j.
\end{cases}
\end{equation}
Before stating the general result for $\ZZ(\gamma)$ (Theorem
\ref{thm:qdilog-char}), let us take an example --- an alternating quiver
of affine $D_{5}$ type:
\begin{equation}
\label{eq:affineA5}
Q
\vcenter{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
"1":"3"
"2":"3"
"4":"3"
"4":"5"
"4":"6"
}
\;.
\end{equation}
The generalized Cartan matrix of $Q$ is given by
\begin{equation}
\label{eq:GCM-D5(1)}
\arraycolsep=2.8pt
C=\begin{pmatrix}
2 & 0 & -1 & 0 & 0 & 0 \\
0 & 2 & -1 & 0 & 0 & 0 \\
-1 & -1 & 2 & -1 & 0 & 0 \\
0 & 0 & -1 & 2 & -1 & -1 \\
0 & 0 & 0 & -1 & 2 & 0 \\
0 & 0 & 0 & -1 & 0 & 2 \\
\end{pmatrix}.
\end{equation}
Put $\seq{m}_{+}=(1,2,4)$ and $\seq{m}_{-}=(3,5,6)$. By Proposition
\ref{prop:alter-max-green}, the mutation sequence
\begin{equation*}
\seq{m}=\seq{m}_{+}\seq{m}_{-}=(1,2,4, 3,5,6)
\end{equation*}
is maximal green, reddening sequence with the boundary condition
$\varphi=\id$ (see Figure \ref{fig:affineD5}).
\begin{figure}[t]
\begin{equation*}
\xygraph{!{<0cm,0cm>;<12mm,0cm>:<0cm,12mm>::}
!{(0,0);a(116)**{}?(2.0)}*+<5pt>{\widetilde{Q}(0)}="0"
!{(0,0);a(120)**{}?(4)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+[o][F-]{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"1":"3"
"2":"3"
"4":"3"
"4":"5"
"4":"6"
"1":"1'"
"2":"2'"
"3":"3'"
"4":"4'"
"5":"5'"
"6":"6'"
}}}}
!{(0,0);a(167)**{}?(2.0)}*+<5pt>{\widetilde{Q}(1)}="1"
!{(0,0);a(167)**{}?(4)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+[o][F-]{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"3":"1"
"2":"3"
"4":"3"
"4":"5"
"4":"6"
"1'":"1"
"2":"2'"
"3":"3'"
"4":"4'"
"5":"5'"
"6":"6'"
}}}}
!{(0,0);a(219)**{}?(2.0)}*+<5pt>{\widetilde{Q}(2)}="2"
!{(0,0);a(208)**{}?(4.2)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+[o][F-]{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"3":"1"
"3":"2"
"4":"3"
"4":"5"
"4":"6"
"1'":"1"
"2'":"2"
"3":"3'"
"4":"4'"
"5":"5'"
"6":"6'"
}}}}
!{(0,0);a(270)**{}?(2.0)}*+<5pt>{\widetilde{Q}(3)}="3"
!{(0,0);a(270)**{}?(3.5)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+[o][F-]{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"3":"1"
"3":"2"
"3" :"4"
"5" :"4"
"6" :"4"
"1'":"1"
"2'":"2"
"3":"3'"
"4'":"4"
"5":"5'"
"6":"6'"
}}}}
!{(0,0);a(321)**{}?(2.0)}*+<5pt>{\widetilde{Q}(4)}="4"
!{(0,0);a(332)**{}?(4.2)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+[o][F-]{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"1":"3"
"2":"3"
"4" :"3"
"5" :"4"
"6" :"4"
"1'":"1"
"2'":"2"
"3'":"3"
"4'":"4"
"5":"5'"
"6":"6'"
}}}}
!{(0,0);a(13)**{}?(2.0)}*+<5pt>{\widetilde{Q}(5)}="5"
!{(0,0);a(13)**{}?(4)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+[o][F-]{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"1":"3"
"2":"3"
"4" :"3"
"4" :"5"
"6" :"4"
"1'":"1"
"2'":"2"
"3'":"3"
"4'":"4"
"5'":"5"
"6":"6'"
}}}}
!{(0,0);a(65)**{}?(2.0)}*+<5pt>{\widetilde{Q}(6)}="6"
!{(0,0);a(61)**{}?(4)}*+<2pt>{
\vcenter{\xybox{\xygraph{!{<0cm,0cm>;<16pt,0mm>:<0cm,16pt>::}
!{(0,2)}*+<2pt>{1}="1"
!{(0,0)}*+<2pt>{2}="2"
!{(0.9,1)}*+<2pt>{3}="3"
!{(2.1,1)}*+<2pt>{4}="4"
!{(3,2)}*+<2pt>{5}="5"
!{(3,0)}*+<2pt>{6}="6"
!{(-1,2)}*+<2pt>{1'}="1'"
!{(-1,0)}*+<2pt>{2'}="2'"
!{(-0.1,1)}*+<2pt>{3'}="3'"
!{(3.1,1)}*+<2pt>{4'}="4'"
!{(4,2)}*+<2pt>{5'}="5'"
!{(4,0)}*+<2pt>{6'}="6'"
"1":"3"
"2":"3"
"4" :"3"
"4" :"5"
"4" :"6"
"1'":"1"
"2'":"2"
"3'":"3"
"4'":"4"
"5'":"5"
"6'":"6"
}}}}
"0":@{=>}_{\textstyle \mu_{1}}"1"
"1":@{=>}_{\textstyle \mu_{2}}"2"
"2":@{=>}_{\textstyle \mu_{4}}"3"
"3":@{=>}_{\textstyle \mu_{3}}"4"
"4":@{=>}_{\textstyle \mu_{5}}"5"
"5":@{=>}_{\textstyle \mu_{6}}"6"
"6":@{-}"0"
}
\end{equation*}
\caption{Reddening mutation loop for affine $D_{5}$ alternating
quiver. Mutating vertices are marked with circles.} \label{fig:affineD5}
\end{figure}
The $s$-variables change as follows:
\begin{equation*}
\renewcommand{\arraystretch}{1.1}
\begin{array}{c|c|c|c|c|c|c}
& 1 & 2 & 3 & 4 & 5 & 6 \\
\hline
Q(0) & s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
Q(1) & s'_1{=}k_1{-}s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
Q(2) & s'_1{=}k_1{-}s_1 & s'_2{=}k_2{-}s_2 & s_3 & s_4 & s_5 & s_6 \\
Q(3) & s'_1{=}k_1{-}s_1 & s'_2{=}k_2{-}s_2 & s_3
& s'_4{=}k_4{-}s_4 & s_5 & s_6 \\
Q(4) & s'_1{=}k_1{-}s_1 & s'_2{=}k_2{-}s_2 & s'_3{=}k_3{-}s_3
& s'_4{=}k_4{-}s_4 & s_5 & s_6 \\
Q(5) & s'_1{=}k_1{-}s_1 & s'_2{=}k_2{-}s_2 & s'_3{=}k_3{-}s_3
& s'_4{=}k_4{-}s_4 & s'_5{=}k_5{-}s_5 & s_6 \\
Q(6) & s'_1{=}k_1{-}s_1 & s'_2{=}k_2{-}s_2 & s'_3{=}k_3{-}s_3
& s'_4{=}k_4{-}s_4 & s'_5{=}k_5{-}s_5 & s'_6{=}k_6{-}s_6 \\
\end{array}
\end{equation*}
The boundary condition
$\varphi=\id$ imposes $s_{i}= s_{i}'=k_i-s_i$ for all $i$, so we have
\begin{equation*}
s_i = s_{i}'= \frac{1}{2} k_{i} \qquad (i=1,\dots,6).
\end{equation*}
The $k^{\vee}$-variables (also labeled by mutated vertices) are then
given by
\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\arraycolsep=2pt
\begin{array}{rclcl}
k^{\vee}_1 &=& s_{1}+s'_{1}-s_3 &=& k_1-\frac{k_3}{2}, \\
k^{\vee}_2 &=& s_{2}+s'_{2}-s_3 &=& k_2-\frac{k_3}{2}, \\
k^{\vee}_4 &=& s_{4}+s'_{4}-(s_3+s_5+s_6)
&=& -\frac{k_3}{2}+k_4-\frac{k_5}{2}-\frac{k_6}{2}, \\
k^{\vee}_3 &=& s_{3}+s'_{3}-(s'_1+s'_2+s'_4) &=&
-\frac{k_1}{2}-\frac{k_2}{2}+k_3-\frac{k_4}{2}, \\
k^{\vee}_5 &=& s_{5}+s'_{5}-s'_4 &=& -\frac{k_4}{2}+k_5, \\
k^{\vee}_6 &=& s_{6}+s'_{6}-s'_4 &=& -\frac{k_4}{2}+k_6. \\
\end{array}
\end{equation*}
Thus the the weight of the mutation now reads
\begin{equation*}
W(\seq{m})=\frac{q^{\frac{1}{2}\sum_{i}k_{i}k^{\vee}_{i}}}
{\prod_{i=1}^{6}(q)_{k_{i}}}
=
\frac{q^{\frac{1}{2}\left(k_1^2+k_2^2+k_3^2+k_4^2+k_5^2+k_6^2- k_1 k_3-k_2 k_3-k_3
k_4-k_4 k_5-k_4 k_6\right)}}{
\prod_{i=1}^{6}(q)_{k_{i}}}.
\end{equation*}
Every mutating vertex $m_{t}$ is green with $c$-vector
$\alpha_{t}=e_{m_{t}}$. The $\N^{n}$-grading of the mutation sequence
$\seq{m}$ is then
\begin{equation*}
\sum_{t=1}^{6} k_{m_{t}} e_{m_{t}} =
\sum_{i=1}^{6} k_{i} e_{i} =
\left(k_1,k_2,k_3,k_4,k_5,k_6\right) =\seq{k}\in \N^{6}.
\end{equation*}
Combining all these, we obtain a neat expression for the partition
$q$-series:
\begin{equation}
\label{eq:Z-D5(1)}
\ZZ(\gamma)=\sum_{\seq{k}\in \N^{6}}
\frac{q^{\frac{1}{4}\seq{k}^{\top}C\seq{k}}}{\prod_{i=1}^{6} (q)_{k_i}}
y^{\seq{k}},
\end{equation}
where $C$ is nothing but the generalized Cartan matrix \eqref{eq:GCM-D5(1)}.
In fact, this generalize to all alternating quivers:
\begin{theorem}
\label{thm:qdilog-char} Suppose $Q$ is an alternating quiver, and
$\gamma=(Q;\seq{m},\id)$ be the reddening mutation loop
constructed as in Proposition \ref{prop:alter-max-green}. Let
$\seq{k}=(k_{1},\dots,k_{n})$ be the vector of $k$-variables indexed by
the vertices. Then the partition $q$-series is given by
\begin{equation}
\label{eq:qdilog-char}
\ZZ(\gamma)= \overline{ \EE(\seq{m};q)}
=\sum_{\seq{k}\in \N^{n}}
\frac{q^{\frac{1}{4} \seq{k}^{\top}C\,\seq{k}}}{\prod_i (q)_{k_{i}}}
y^{\seq{k}},
\end{equation}
where $C$ is the generalized Cartan matrix of $Q$ given in
\eqref{eq:gen-Cartan}.
\end{theorem}
\begin{proof}
From Proposition \ref{prop:alter-max-green}, $\varepsilon_{t}=1$ and
$c_{m_{t}}(t-1)=e_{m_{t}}$ for all mutation time $1\leq t\leq n$. Thus
we have $\alpha_{t}=e_{m_{t}}$ in \eqref{eq:alpha-def}. The
$\N^{n}$-grading is therefore given by $\sum_{t=1}^{n} k_{m_{t}}
e_{m_{t}}=\sum_{i=1}^{n} k_{i} e_{i} =\seq{k}$.
Consider a mutation at vertex $i$. As we have seen, $i$ is a
source and there is no arrow ending on $i$. The initial (= final)
$s$-variable and the $k$-variable are thus related as $2s_{i}=k_{i}$, so we
have
\begin{equation}
s_{i}=\frac{k_{i}}{2}\qquad (1\leq i\leq n).
\end{equation}
The $k^{\vee}$-variables are then expressed as
\begin{align}
\label{eq:alt-kv}
k^{\vee}_{i}
&= 2 s_{i} - \sum_{i\to j} s_{j}
= 2 s_{i} - \sum_{i\sim j} s_{j} = k_{i} - \frac{1}{2} \sum_{i\sim
j} k_{j}.
\end{align}
Here $i\sim j$ means the vertices $i$ and $j$ are adjacent in the
underlying graph $\underline{Q}$. Using the generalized Cartan matrix
\eqref{eq:gen-Cartan}, the relation \eqref{eq:alt-kv} is concisely
written as
\begin{equation}
\seq{k}^{\vee} = \frac{1}{2} C\seq{k}.
\end{equation}
Thus the partition $q$-series is given by
\begin{equation}
\label{eq:alt-zz}
\ZZ(\gamma) =
\sum_{k_1,\dots,k_{n} \geq 0}\biggl(
\prod_{i=1}^{n}
\frac{q^{\frac{1}{2}k_{i}k^{\vee}_{i}}}{ (q)_{k_{i}}}
\biggr)
y^{\seq{k}}
=
\sum_{\seq{k}\in \N^{n}}
\frac{q^{\frac{1}{4} \seq{k}^{\top}C\,\seq{k}}}{\prod_i (q)_{k_{i}}}
y^{\seq{k}}.
\end{equation}
The equality $ \ZZ(\gamma)=\overline{\EE(\seq{m};q)}$ follows from
Theorem \ref{thm:main}.
\end{proof}
\begin{rem}
In our previous work, we computed the partition $q$-series for the
product of Dynkin quivers and observed that they are fermionic
character formulas of certain conformal field theories (Theorem 6.1 of
\cite{KT2014}). The case considered here are different from those
because (i) $Q\square Q'$ is not alternating in general, and (ii) the
sequences given in \cite{KT2014} are not reddening. However,
$Q\square Q'=X \square A_{1}$ with $C_{Q'}=(2)$ are exceptional cases
to which Theorem \ref{thm:main} is applicable.
\end{rem}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 4,633 |
Photo Credit: (ICC)
A Crushing Defeat for The Windies Women
The West Indies Women's cricket team was defeated by the English women's cricket team by eight wickets on Sunday in their first Twenty20 International (T20I) match that took place in Antigua.
Following England's demoralizing 3-0 ODI victory, West Indies were expected to put up a more determined fight in the T20I series, however, this did not transpire as the team displayed a rather lacklustre performance.
Windies Women, when asked to take the first strike, were stranded on 106 for seven in their allocated 20 overs of play, as the Jamaican duo of Rashada Williams and Chinelle Henry, respectively, picked up 23 runs and 21 runs, both contributions were crucial in getting the Windies Woman over the 100 mark on the scorecard.
Before she was run out by Danni Wyatt in the 13th over, Williams faced 26 balls and hit two fours, and seemed set to carry the Windies to a respectable total. Batting at No 7, Henry struck three fours in 34 balls in an unbeatable knock.
For England, seamer Lauren Bell took three wickets: Aaliyah Alleyne for two, Shemaine Campbelle for ten, and Shabika Gajnabi for 13. She was the main menace for the English ladies.
In reply, England Women were able to post 106 for two in 12.4 overs, which was enough to comfortably win the match and secure a 1-0 lead.
Opener Wyatt was sparkling in scoring an unbeaten 59 off 34 balls, including seven fours and two sixes. Sophie Dunkley chipped in with 25 from 21 balls while Lauren Winfield-Hill made 15 before becoming Guyanese Campbell's second runout of the night.
News West Indies | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 2,673 |
Михајло Петровић (Влакча, Крагујевац, 14. јун 1884 — Барбалуши, Скадар, 7. март 1913) био је српски пилот са пилотском дозволом број 1. Први српски пилот који је изгубио живот на борбеном задатку. Припадао је првој групи од шест српских пилота школованих у Француској 1912. године.
Биографија
Основну школу је завршио у свом селу. 1897. је уписао Војну занатску школу у Крагујевцу. 1902. је покушао да се упише у неку од војних академија у Санкт Петербургу у Русији. У томе није успео, па се 1903. вратио у Србију и пријавио се за подофицирску артиљеријску школу. После двогодишњег школовања 21-годишњи водник је 1905. распоређен у Гардијски артиљеријски пук у Нишу. Наредник је постао 1910. године у гарнизону Београд.
Када је српска војска 1912. године позвала добровољце да се пријаве за обуку за пилоте, међу њима је био наредник Михајло Петровић. После успешно положених испита као и медицинских прегледа послат је у једној од првих група у Француску на обуку за пилота.
У Француској је крајем маја пошао у Фарманову (-{Farman}-) пилотску школу у Етампу (-{Etamps}-). После двадесет дана обуке као први у групи извршио је свој први самостални лет. После успешног завршетка обуке 22 и 23. јуна 1912. успешно полаже завршне испите (месец дана пре осталих из групе) и тако постаје први српски пилот авиона са дипломом. Имао је међународну пилотску лиценцу ФАИ број 979 а српску број 1.'Први балкански рат је започео 8. октобра 1912. По повратку у земљу наредник пилот Михајло Петровић је распоређен на први војни аеродром у Нишу, на Трупалском пољу. 12 авиона - мешавина Блериоових моноплана и двокрилаца Хенри Фармана F-20 су састављени до краја децембра. Јануар 1913. је искоришћен за тренажне летове. Након краћег навикавања на свој авион Фарман ХФ-20, који је имао другачије летне караткеристике од авиона истог типа на којем је прошао обуку, наредник Михајло Петровић распоређен је у састав новооснованог Приморског аеропланског одреда чији је први борбени задатак био да пружа ваздушну подршку трупама које су опседале Скадар.
По доласку у рејон дејстава одред је био стациониран на привременом аеродрому у близини села Барбалуши. Након што су авиони склопљени, 7. марта су обављени и први летови који су прошли без проблема. После поручника Станковића, на ред је дошао и наредни Петровић који је узлетео у свом авиону типа Фарман. Петровић је направио круг изнад села Меглуши и Бушати, на висини од око 1.500 -{m}-. На прилазу аеродрому, угасио је мотор и почео са припремама за слетање. Међутим, у том тренутку његов авион је погодила снажна ваздушна струја због чега је авион нагло успорио, а затим се преврнуо. Наредник Петровић избачен је из авиона на висини од око 1.000 -{m}- и није преживео пад. У то време падобран није био стандардни део опреме пилота. Његов авион је тешко оштећен приликом удара у земљу.
Наредник Михајло Петровић сахрањен је 8. марта 1913. године у селу Барбалуши. По завршетку Балканских ратова, његови посмртни остаци пренети су на Цетиње и сахрањени уз највише војне почасти. На захтев породице, посмртни остаци наредника Петровића пренети су 1. октобра 1931. године у Београд на Ново гробље, где и данас почива.
Дана 20. марта 2013. обележено је 100 година од његове смрти одавањем поште и полагањем венаца.
"Јасеница" Боривоја М. Дробњаковића о његовом пореклу каже: "Борићи (Раденковићи, Томићи, Петровићи, Јовановићи, Костићи, Алексијевићи, Симићи) 53 к. Слава: св. Врачеви. Доселио се прадед Радоје Грудоња са три сина: Јованом, Бором и Раденком од "Студенице - Сјенице". Један од браће отишао у Божурњу од кога су Бранковићи (в. Божурњу)." Брат Раденков, Боров и Јованов, Бранко, одселио се у место Божурња, а исти писац о потомцима истог је записао: "Бранковићи 4 к. Слава: св. Врачеви. Преселили се из Влакче од фамилије Борића." Његов млађи брат био je Живан Петровић (1887—1969).
Референце
Литература
Српска авијатика 1912—1918, Београд 1993.
Микић, Сава Ј. (1933), Историја југословенског ваздухопловства. Београд: Штампарија Драг. Грегорић.
Јанић, Чедомир. Век авијације - [илустрована хронологија]. Беочин: Ефект.
Модли Зоран.Пилотска књига - водич кроз основну школу летења'', Београд, Младинска књига.
Спољашње везе
Детаљније о Михајло Петровић (пилот) на страници Ваздухопловне традиције Србије
Михаило Петровић
115 година од рођења првог школованог српског пилота
Знамените личности Влакче - Михајло Петровић
Кратка биографија са фотографијама (www.beogradskagroblja.rs)
Пионир српске авијације добио свој дом ("Вечерње новости", 17. септембар 2018)
Меморијал "Пилот Михаило Петровић" ("Политика", 19. април 2019)
Прва сломљена крила српског ваздухопловства (Политика, Бранко Богдановић, 8. јун 2019)
Рођени 1884.
Умрли 1913.
Страгарци
Српски пилоти
Личности Балканских ратова
Сахрањени на Новом гробљу у Београду | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 8,143 |
#include "InstitutionTypes.h"
#include "dao/InstitutionTypeDAO.h"
#include "dao/functions.h"
#include "model/InstitutionType.h"
#include <QtCore/QDebug>
#include <QtCore/QJsonArray>
namespace crrc
{
namespace util
{
static auto instTypeComparator = []( const QVariant& instType1, const QVariant& instType2 ) -> bool
{
const auto ptr1 = model::InstitutionType::from( instType1 );
const auto ptr2 = model::InstitutionType::from( instType2 );
return *ptr1 < *ptr2;
};
}
}
using crrc::InstitutionTypes;
void InstitutionTypes::index( Cutelyst::Context* c ) const
{
auto list = dao::InstitutionTypeDAO().retrieveAll();
qSort( list.begin(), list.end(), util::instTypeComparator );
QJsonArray arr;
for ( const auto& instType : list ) arr << toJson( *model::InstitutionType::from( instType ) );
dao::sendJson( c, arr );
}
void InstitutionTypes::base( Cutelyst::Context* c ) const
{
c->response()->setHeader( "Cache-Control", "no-cache, no-store, must-revalidate" );
}
void InstitutionTypes::object( Cutelyst::Context* c, const QString& id ) const
{
c->setStash( "object", dao::InstitutionTypeDAO().retrieve( id.toUInt() ) );
}
void InstitutionTypes::data( Cutelyst::Context* c ) const
{
const auto& var = c->stash( "object" );
const auto ptr = model::InstitutionType::from( var );
dao::sendJson( c, ptr ? toJson( *ptr ) : QJsonObject() );
} | {
"redpajama_set_name": "RedPajamaGithub"
} | 9,927 |
package com.forgerock.wisdom.oauth2.info.internal;
import static java.lang.String.format;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Property;
import org.apache.felix.ipojo.annotations.Provides;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.forgerock.wisdom.oauth2.info.TokenInfo;
import com.forgerock.wisdom.oauth2.info.TokenIntrospectionService;
/**
* Created by guillaume on 03/06/15.
*/
@Component(name = "openam")
@Provides
public class OpenAmIntrospectionService implements TokenIntrospectionService {
private ObjectMapper mapper = new ObjectMapper();
private final String baseUrl;
private final String realm;
public OpenAmIntrospectionService(@Property(name = "baseUrl") final String baseUrl,
@Property(name = "realm", value = "/") final String realm) {
this.baseUrl = baseUrl;
this.realm = realm;
}
@Override
public TokenInfo introspect(final String token) {
String tokenInfoRequest = format("%s/oauth2/tokeninfo?access_token=%s&realm=%s",
baseUrl,
token,
realm);
try {
HttpURLConnection connection = (HttpURLConnection) new URL(tokenInfoRequest).openConnection();
int code = connection.getResponseCode();
if (code != 200) {
return TokenInfo.INVALID;
}
try (InputStream stream = connection.getInputStream()) {
JsonNode node = mapper.readTree(stream);
List<String> scopes = new ArrayList<>();
for (JsonNode scope : node.get("scope")) {
scopes.add(scope.asText());
}
long expiresIn = node.get("expires_in").asLong();
return new TokenInfo(true, expiresIn, scopes);
}
} catch (IOException e) {
return TokenInfo.INVALID;
}
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 7,600 |
Halit Gungen
Gungen, Diyarbakir bureau chief of the newsweekly 2000'e Dogru, died soon after being shot in his office with a single bullet. Before his death, he had written an article alleging that members of the Islamic organization Hezbollah were being trained in the Diyarbakir headquarters of the Special Forces. Although the identity of his killers remains unknown, the circumstances implicate the state. A colleague of Gungen's, Ahmet Sumbuk, was briefly detained after the assassination. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 9,701 |
package com.app.nfsclient.protocol.rpc;
import java.io.*;
/**
* This handler is implemented by the RPC application
* if it wishes to be notifed of retransmissions.
* A good example is an NFS client that displays
* "NFS Server not responding" and "NFS server OK"
*/
public class RpcHandler {
/**
* Called when the RPC times out.
*
* @param server The name of the server
* @param retries Number of retries (initially 0)
* @param waittime Total time waiting for response
* @return bool True to abort, false to continue retrying
*/
public boolean timeout(String server, int retries, int waittime) {
return false;
}
/**
* Called when the server responds after a timeout
*
* @param server The name of the server
*/
public void ok(String server) {
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 8,448 |
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
namespace Entitas.VisualDebugging.Unity {
public enum AvgResetInterval {
Always = 1,
VeryFast = 30,
Fast = 60,
Normal = 120,
Slow = 300,
Never = int.MaxValue
}
public class DebugSystems : Systems {
public static AvgResetInterval avgResetInterval = AvgResetInterval.Never;
public int totalInitializeSystemsCount {
get {
var total = 0;
foreach (var system in _initializeSystems) {
var debugSystems = system as DebugSystems;
total += debugSystems != null ? debugSystems.totalInitializeSystemsCount : 1;
}
return total;
}
}
public int totalExecuteSystemsCount {
get {
var total = 0;
foreach (var system in _executeSystems) {
var debugSystems = system as DebugSystems;
total += debugSystems != null ? debugSystems.totalExecuteSystemsCount : 1;
}
return total;
}
}
public int totalCleanupSystemsCount {
get {
var total = 0;
foreach (var system in _cleanupSystems) {
var debugSystems = system as DebugSystems;
total += debugSystems != null ? debugSystems.totalCleanupSystemsCount : 1;
}
return total;
}
}
public int totalTearDownSystemsCount {
get {
var total = 0;
foreach (var system in _tearDownSystems) {
var debugSystems = system as DebugSystems;
total += debugSystems != null ? debugSystems.totalTearDownSystemsCount : 1;
}
return total;
}
}
public int totalSystemsCount {
get {
var total = 0;
foreach (var system in _systems) {
var debugSystems = system as DebugSystems;
total += debugSystems != null ? debugSystems.totalSystemsCount : 1;
}
return total;
}
}
public int initializeSystemsCount { get { return _initializeSystems.Count; } }
public int executeSystemsCount { get { return _executeSystems.Count; } }
public int cleanupSystemsCount { get { return _cleanupSystems.Count; } }
public int tearDownSystemsCount { get { return _tearDownSystems.Count; } }
public string name { get { return _name; } }
public GameObject gameObject { get { return _gameObject; } }
public SystemInfo systemInfo { get { return _systemInfo; } }
public double executeDuration { get { return _executeDuration; } }
public double cleanupDuration { get { return _cleanupDuration; } }
public SystemInfo[] initializeSystemInfos { get { return _initializeSystemInfos.ToArray(); } }
public SystemInfo[] executeSystemInfos { get { return _executeSystemInfos.ToArray(); } }
public SystemInfo[] cleanupSystemInfos { get { return _cleanupSystemInfos.ToArray(); } }
public SystemInfo[] tearDownSystemInfos { get { return _tearDownSystemInfos.ToArray(); } }
public bool paused;
string _name;
List<ISystem> _systems;
GameObject _gameObject;
SystemInfo _systemInfo;
List<SystemInfo> _initializeSystemInfos;
List<SystemInfo> _executeSystemInfos;
List<SystemInfo> _cleanupSystemInfos;
List<SystemInfo> _tearDownSystemInfos;
Stopwatch _stopwatch;
double _executeDuration;
double _cleanupDuration;
public DebugSystems(string name) {
initialize(name);
}
protected DebugSystems(bool noInit) {
}
protected void initialize(string name) {
_name = name;
_gameObject = new GameObject(name);
_gameObject.AddComponent<DebugSystemsBehaviour>().Init(this);
_systemInfo = new SystemInfo(this);
_systems = new List<ISystem>();
_initializeSystemInfos = new List<SystemInfo>();
_executeSystemInfos = new List<SystemInfo>();
_cleanupSystemInfos = new List<SystemInfo>();
_tearDownSystemInfos = new List<SystemInfo>();
_stopwatch = new Stopwatch();
}
public override Systems Add(ISystem system) {
_systems.Add(system);
SystemInfo childSystemInfo;
var debugSystems = system as DebugSystems;
if (debugSystems != null) {
childSystemInfo = debugSystems.systemInfo;
debugSystems.gameObject.transform.SetParent(_gameObject.transform, false);
} else {
childSystemInfo = new SystemInfo(system);
}
childSystemInfo.parentSystemInfo = _systemInfo;
if (childSystemInfo.isInitializeSystems) {
_initializeSystemInfos.Add(childSystemInfo);
}
if (childSystemInfo.isExecuteSystems || childSystemInfo.isReactiveSystems) {
_executeSystemInfos.Add(childSystemInfo);
}
if (childSystemInfo.isCleanupSystems) {
_cleanupSystemInfos.Add(childSystemInfo);
}
if (childSystemInfo.isTearDownSystems) {
_tearDownSystemInfos.Add(childSystemInfo);
}
return base.Add(system);
}
public void ResetDurations() {
foreach (var systemInfo in _executeSystemInfos) {
systemInfo.ResetDurations();
}
foreach (var system in _systems) {
var debugSystems = system as DebugSystems;
if (debugSystems != null) {
debugSystems.ResetDurations();
}
}
}
public override void Initialize() {
for (int i = 0; i < _initializeSystems.Count; i++) {
var systemInfo = _initializeSystemInfos[i];
if (systemInfo.isActive) {
_stopwatch.Reset();
_stopwatch.Start();
_initializeSystems[i].Initialize();
_stopwatch.Stop();
systemInfo.initializationDuration = _stopwatch.Elapsed.TotalMilliseconds;
}
}
}
public override void Execute() {
if (!paused) {
StepExecute();
}
}
public override void Cleanup() {
if (!paused) {
StepCleanup();
}
}
public void StepExecute() {
_executeDuration = 0;
if (Time.frameCount % (int)avgResetInterval == 0) {
ResetDurations();
}
for (int i = 0; i < _executeSystems.Count; i++) {
var systemInfo = _executeSystemInfos[i];
if (systemInfo.isActive) {
_stopwatch.Reset();
_stopwatch.Start();
_executeSystems[i].Execute();
_stopwatch.Stop();
var duration = _stopwatch.Elapsed.TotalMilliseconds;
_executeDuration += duration;
systemInfo.AddExecutionDuration(duration);
}
}
}
public void StepCleanup() {
_cleanupDuration = 0;
for (int i = 0; i < _cleanupSystems.Count; i++) {
var systemInfo = _cleanupSystemInfos[i];
if (systemInfo.isActive) {
_stopwatch.Reset();
_stopwatch.Start();
_cleanupSystems[i].Cleanup();
_stopwatch.Stop();
var duration = _stopwatch.Elapsed.TotalMilliseconds;
_cleanupDuration += duration;
systemInfo.AddCleanupDuration(duration);
}
}
}
public override void TearDown() {
for (int i = 0; i < _tearDownSystems.Count; i++) {
var systemInfo = _tearDownSystemInfos[i];
if (systemInfo.isActive) {
_stopwatch.Reset();
_stopwatch.Start();
_tearDownSystems[i].TearDown();
_stopwatch.Stop();
systemInfo.teardownDuration = _stopwatch.Elapsed.TotalMilliseconds;
}
}
}
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 9,452 |
Home / General / How To Watch Satellite TV On Your Computer Today?
How To Watch Satellite TV On Your Computer Today?
If you are like any individual else that desire to enjoy satellite TV on your computer system today, you would certainly be glad that you are below reviewing this article as I share some valuable details that can obtain you started on your TV viewing within the following hour. Exactly how does that sound to you . To be able to view satellite TV on your computer has come across to several people as a fantastic exploration. Area interactions has acquired a lot energy that it has made it possible for you as well as me to watch TV on our computers without a dish in all.
Truthfully, that needs a dish when there are better alternatives to watch satellite TV on your computer system? Installing the satellite dish TELEVISION system is an unrecognized as well as tough experience. The antenna, receiver box, place, and cords all makes it rather pricey to establish a dish antenna. As well as not failing to remember that you need to set up the satellite dish on your rooftop as well as pointing it to the best direction which by the way can be affected by negative weather conditions. That is not all, you still have to fit the Low-Noise Block LNB converter on the recipe and obtain the decoder fitted properly. Now, you need to understand that getting the dish antenna system up as well as running is such a pain and laborious effort for most people, specifically those that are bad with devices.
There are two choices when it pertains to seeing satellite octa air 評價 on your computers. One is the equipment option as well as the other the software program variation. bDid you recognize that PCTV cards can be utilized to receive, decipher and also analyze the satellite TV signals. With this card, it transforms your monitor into a TV screen powered by your CPU. The card can be installed internally onto your COMPUTER's motherboard. You might additionally want to keep in mind that there are likewise exterior PCTV cards in the marketplace which enables you to attach them to the PC's USB port. In both situations, you will require an internet link. aA broadband link with a minimum of 512KB transfer rates is extremely advised for smooth as well as uninterrupted transmission of the TELEVISION feeds. You likewise get better as well as sharper resolution images with a broadband when you enjoy satellite TV on your computer system. Though dial-up suffices, I would certainly discourage utilizing that for optimum TV watching experience. | {
"redpajama_set_name": "RedPajamaC4"
} | 92 |
Q: How to draw "stacked blocks" with tikz? I want to draw using tikz a figure which looks like the following:
I started writing it using nodes and positioning them using right of =, above of = but I don't know how to avoid using hard coded shifts, minimum width and positioning.
I am looking for the cleanest way to draw these kind of diagrams using tikz in order to be able to:
*
*scale the graph
*easily resize for example the hardware box and have the kernel and msr module boxes resized automatically (they can be specified as a percentage of the hardware box)
I am not necessarily looking for the exact tikz code for this diagram, but for tricks that may help me in order to better understand how one can cleverly locates nodes in a tikz graph.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 6,779 |
BOOST_FIXTURE_TEST_SUITE(sapling_key_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(ps_address_test)
{
SelectParams(CBaseChainParams::REGTEST);
std::vector<unsigned char, secure_allocator<unsigned char>> rawSeed(32);
HDSeed seed(rawSeed);
auto m = libzcash::SaplingExtendedSpendingKey::Master(seed);
for (uint32_t i = 0; i < 1000; i++) {
auto sk = m.Derive(i);
{
std::string sk_string = KeyIO::EncodeSpendingKey(sk);
BOOST_CHECK(sk_string.compare(0, 26, Params().Bech32HRP(CChainParams::SAPLING_EXTENDED_SPEND_KEY)) == 0);
libzcash::SpendingKey spendingkey2 = KeyIO::DecodeSpendingKey(sk_string);
BOOST_CHECK(IsValidSpendingKey(spendingkey2));
BOOST_ASSERT(boost::get<libzcash::SaplingExtendedSpendingKey>(&spendingkey2) != nullptr);
auto sk2 = boost::get<libzcash::SaplingExtendedSpendingKey>(spendingkey2);
BOOST_CHECK(sk == sk2);
}
{
libzcash::SaplingPaymentAddress addr = sk.DefaultAddress();
std::string addr_string = KeyIO::EncodePaymentAddress(addr);
BOOST_CHECK(addr_string.compare(0, 12, Params().Bech32HRP(CChainParams::SAPLING_PAYMENT_ADDRESS)) == 0);
auto paymentaddr2 = KeyIO::DecodePaymentAddress(addr_string);
BOOST_CHECK(IsValidPaymentAddress(paymentaddr2));
BOOST_ASSERT(boost::get<libzcash::SaplingPaymentAddress>(&paymentaddr2) != nullptr);
auto addr2 = boost::get<libzcash::SaplingPaymentAddress>(paymentaddr2);
BOOST_CHECK(addr == addr2);
}
}
}
BOOST_AUTO_TEST_CASE(EncodeAndDecodeSapling)
{
SelectParams(CBaseChainParams::MAIN);
std::vector<unsigned char, secure_allocator<unsigned char>> rawSeed(32);
HDSeed seed(rawSeed);
libzcash::SaplingExtendedSpendingKey m = libzcash::SaplingExtendedSpendingKey::Master(seed);
for (uint32_t i = 0; i < 1000; i++) {
auto sk = m.Derive(i);
{
std::string sk_string = KeyIO::EncodeSpendingKey(sk);
BOOST_CHECK(
sk_string.substr(0, 26) ==
Params().Bech32HRP(CChainParams::SAPLING_EXTENDED_SPEND_KEY));
auto spendingkey2 = KeyIO::DecodeSpendingKey(sk_string);
BOOST_CHECK(IsValidSpendingKey(spendingkey2));
BOOST_CHECK(boost::get<libzcash::SaplingExtendedSpendingKey>(&spendingkey2) != nullptr);
auto sk2 = boost::get<libzcash::SaplingExtendedSpendingKey>(spendingkey2);
BOOST_CHECK(sk == sk2);
}
{
auto extfvk = sk.ToXFVK();
std::string vk_string = KeyIO::EncodeViewingKey(extfvk);
BOOST_CHECK(
vk_string.substr(0, 7) ==
Params().Bech32HRP(CChainParams::SAPLING_EXTENDED_FVK));
auto viewingkey2 = KeyIO::DecodeViewingKey(vk_string);
BOOST_CHECK(IsValidViewingKey(viewingkey2));
BOOST_CHECK(boost::get<libzcash::SaplingExtendedFullViewingKey>(&viewingkey2) != nullptr);
auto extfvk2 = boost::get<libzcash::SaplingExtendedFullViewingKey>(viewingkey2);
BOOST_CHECK(extfvk == extfvk2);
}
{
auto addr = sk.DefaultAddress();
std::string addr_string = KeyIO::EncodePaymentAddress(addr);
BOOST_CHECK(
addr_string.substr(0, 2) ==
Params().Bech32HRP(CChainParams::SAPLING_PAYMENT_ADDRESS));
auto paymentaddr2 = KeyIO::DecodePaymentAddress(addr_string);
BOOST_CHECK(IsValidPaymentAddress(paymentaddr2));
BOOST_CHECK(boost::get<libzcash::SaplingPaymentAddress>(&paymentaddr2) != nullptr);
auto addr2 = boost::get<libzcash::SaplingPaymentAddress>(paymentaddr2);
BOOST_CHECK(addr == addr2);
}
}
}
BOOST_AUTO_TEST_SUITE_END()
| {
"redpajama_set_name": "RedPajamaGithub"
} | 286 |
Q: Issues rendering React state object I am using React Hooks and am having issues rendering my state. So, my state looks like below;
const [task, setTask] = useState({ id: 0, taskName: "", timeField: 0 });
In my reducer, I have
const initialState = {
tasks: []
};
const tasksR = (state = initialState, action) => {
switch (action.type) {
case "SAVE_TASK": {
//return [...state, action.payload];
return {
...state,
tasks: [...state.tasks, action.payload]
};
}
default:
return state;
}
};
However, I am unable to render the state on the UI.
Also, other question, I have is, for the initial state, is it fine if we just set in the reducer ?
I have seen it also passed/set in createStore() as below;
const defaultState = { tasks: [] };
const store = createStore(
rootReducer,
defaultState,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
window.store = store;
Not sute why is the default state also set in this place apart from the reducer ?
My full code example is located at
https://codesandbox.io/s/crisil-tp7pv
A: Actually your store looks like this :
{
tasks: {
tasks: []
}
}
That's why the code inside if (Array.isArray(props.tasks)) { is never executed because props.tasks (which is the same as state.tasks) is an object.
You can get the array of tasks using props.tasks.tasks or you can update your store like this :
const initialState = [];
const tasksR = (state = initialState, action) => {
switch (action.type) {
case "SAVE_TASK": {
return [...state, action.payload];
}
default:
return state;
}
};
export default combineReducers({tasks: tasksR});
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 3,128 |
# Bello:
## hidden talent rediscovered
Bello is a digital only imprint of Pan Macmillan, established to breathe life into previously published classic books.
At Bello we believe in the timeless power of the imagination, of good story, narrative and entertainment and we want to use digital technology to ensure that many more readers can enjoy these books into the future.
We publish in ebook and Print on Demand formats to bring these wonderful books to new audiences.
www.panmacmillan.co.uk/bello
# Contents
* One
* Two
* Three
* Four
* Five
* Six
* Seven
* Eight
* Nine
* Ten
* Eleven
* Twelve
* Thirteen
* Fourteen
* Fifteen
* Sixteen
* Seventeen
* Eighteen
* Nineteen
* Twenty
* Twenty-one
* Twenty-two
* Twenty-three
* Twenty-four
## Barbara Pym
# Quartet in Autumn
# One
That day the four of them went to the library, though at different times. The library assistant, if he had noticed them at all, would have seen them as people who belonged together in some way. They each in turn noticed him; with his shoulder-length golden hair. Their disparaging comments on its length, its luxuriance, its general unsuitability – given the job and the circumstances – were no doubt reflections on the shortcomings of their own hair. Edwin wore his, which was thin, greying and bald on top, in a sort of bob – 'even older gentlemen are wearing it longer now', his barber had told him – and the style was an easy one which Edwin considered not unbecoming to a man in his early sixties. Norman, on the other hand, had always had 'difficult' hair, coarse, bristly and now iron-grey, which in his younger days had refused to lie down flat at the crown and round the parting. Now he did not have to part it and had adopted a medieval or pudding-basin style, rather like the American crew-cut of the forties and fifties. The two women – Letty and Marcia – had hair as different from each other as it was possible to imagine in the nineteen seventies, when most women in their sixties had a regular appointment at the hairdresser for the arrangement of their short white, grey or dyed red curls. Letty had faded light brown hair, worn rather too long and in quality as soft and wispy as Edwin's was. People sometimes said – though less often now – how lucky she was not to have gone grey, but Letty knew that there were white hairs interspersed with the brown and that most people would have had a brightening 'rinse' anyway. Marcia's short, stiff, lifeless hair was uncompromisingly dyed a harsh dark brown from a bottle in the bathroom cupboard, which she had used ever since she had noticed the first white hairs some thirty years earlier. If there were now softer and more becoming ways of colouring one's hair, Marcia was unaware of them.
Now, at lunchtime, each went about his or her separate business in the library. Edwin made use of _Crockford's Clerical Directory_ and also had occasion to consult _Who's Who_ and even _Who Was Who_ , for he was engaged in serious research into the antecedents and qualifications of a certain clergyman who had recently been appointed to a living in a parish he sometimes frequented. Norman had not come to the library for any literary purpose, for he was not much of a reader, but it was a good place to sit and a bit nearer than the British Museum which was another of his lunchtime stamping grounds. Marcia too regarded the library as a good, free, warm place not too far from the office, where you could sit for a change of scene in winter. It was also possible to collect leaflets and pamphlets setting out various services available for the elderly in the Borough of Camden. Now that she was in her sixties Marcia took every opportunity to find out what was due to her in the way of free bus travel, reduced and cheap meals, hairdressing and chiropody, although she never made use of the information. The library was also a good place to dispose of unwanted objects which could not in her opinion be classified as rubbish suitable for the dustbin. These included bottles of a certain kind, but not milk bottles which she kept in a shed in her garden, certain boxes and paper bags and various other unclassified articles which could be left in a corner of the library when nobody was looking. One of the library assistants (a woman) had her eye on Marcia, but she was unconscious of this as she deposited a small, battered tartan-patterned cardboard box, which had contained 'Killikrankie oatcakes', at the back of a convenient space on one of the fiction shelves.
Of the four only Letty used the library for her own pleasure and possible edification. She had always been an unashamed reader of novels, but if she hoped to find one which reflected her own sort of life she had come to realize that the position of an unmarried, unattached, ageing woman is of no interest whatever to the writer of modern fiction. Gone were the days when she had hopefully filled in her Boots Book Lovers' library list from novels reviewed in the Sunday papers, and there had now been a change in her reading habits. Unable to find what she needed in 'romantic' novels, Letty had turned to biographies of which there was no dearth. And because these were ' true' they were really better than fiction. Not perhaps better than Jane Austen or Tolstoy, which she had not read anyway, but certainly more 'worth while' than the works of any modern novelist.
In the same way, Letty, perhaps because she was the only one of the four who really liked reading, was also the only one who regularly had lunch out of the office. The restaurant she usually patronized was called the Rendezvous but it was not much of a place for romantic meetings. People who worked in the nearby offices crowded in between twelve and two, ate their meal as quickly as possible, and then hurried away. The man at Letty's table had been there when she sat down. With a brief hostile glance he handed her the menu, then his coffee had come, he had drunk it, left 5p for the waitress and gone. His place was taken by a woman who began to study the menu carefully. She looked up, perhaps about to venture a comment on price increases, pale, bluish eyes troubled about vat. Then, discouraged by Letty's lack of response, she lowered her glance, decided on macaroni au gratin with chips and a glass of water. The moment had passed.
Letty picked up her bill and got up from the table. For all her apparent indifference she was not unaware of the situation. Somebody had reached out towards her. They could have spoken and a link might have been forged between two solitary people. But the other woman, satisfying her first pangs of hunger, was now bent rather low over her macaroni au gratin. It was too late for any kind of gesture. Once again Letty had failed to make contact.
Back in the office Edwin, who had a sweet tooth, bit the head off a black jelly baby. There was nothing racist about his action or his choice, it was simply that he preferred the pungent liquorice flavour of the black babies to the more insipid orange, lemon or raspberry of the others. The devouring of the jelly baby formed the last course of his midday meal which he usually ate at his desk among papers and index cards.
When Letty came into the room he offered her the bag of jelly babies but this was only a ritual gesture and he knew that she would refuse. Eating sweets was self-indulgent, and even though she was now in her sixties there was no reason why she should not keep her spare, trim figure.
The other occupants of the room, Norman and Marcia, were also eating their lunch. Norman had a chicken leg and Marcia an untidy sandwich, bulging with lettuce leaves and slippery slices of tomato. On a mat on the floor the electric kettle was pouring out steam. Somebody had put it on for a hot drink and forgotten to switch it off.
Norman wrapped up his bone and placed it neatly in the wastepaper basket. Edwin lowered an Earl Grey tea bag carefully into a mug and filled it with boiling water from the kettle. Then he added a slice of lemon from a small round plastic container. Marcia opened a tin of instant coffee and made two mugs of the drink for herself and Norman. There was nothing particularly significant about her action – it was just a convenient arrangement they had. They both liked coffee and it was cheaper to buy a large tin and share it between them. Letty, having had her meal out, did not make herself a drink, but went into the cloakroom and fetched a glass of water which she placed on a coloured hand-worked raffia mat on her table. Her place was by the window and she had covered the window sill with pots of trailing plants, the kind that proliferated themselves by throwing out miniature replicas which could be rooted to make new plants. 'Nature she loved, and next to Nature, Art,' Edwin had once quoted, even going on to finish the lines about her having warmed both hands before the fire of life – but not _too_ close, mind you. Now the fire was sinking, as it was for all of them, but was she, or were any of them, ready to depart?
Something of this may have been in Norman's subconscious as he turned the pages of his newspaper.
'Hypothermia,' he read the word slowly. 'Another old person found dead. We want to be careful we don't get hypothermia.'
'It isn't a thing you _get_ ,' said Marcia bossily. 'Not like catching an infectious disease.'
'Well, if you were found dead of it, like this old woman here, you could say you'd _got_ it, couldn't you?' said Norman, defending his usage.
Letty's hand moved over to the radiator and lingered there. 'It's a state or condition, isn't it,' she said, 'when the body gets cold, loses heat or something like that.'
'That's one thing we've got in common then,' said Norman, his snappy little voice matching his small spare body. 'The chance of being found dead of hypothermia.'
Marcia smiled and fingered a leaflet in her handbag, one she had picked up at the library that morning – something about extra heating allowances for the elderly – but she kept the information to herself.
'Cheerful, aren't you,' said Edwin, ' but perhaps there's something in it. Four people on the verge of retirement, each one of us living alone, and without any close relative near – that's us.'
Letty made a murmuring sound, as if unwilling to accept this classification. And yet it was undeniably true – each one lived alone. Strangely enough they had been talking about it earlier that morning when something – again in Norman's paper – had reminded them that Mother's Day was upon them, with the shops full of suitable gifts and the price of flowers suddenly going up. Not that they ever bought flowers, but the increase was noted and commented on. Yet it could hardly affect people too old to have a mother still alive. Indeed, it was sometimes strange to reflect that each of them had once had a mother. Edwin's mother had lived to a respectable age – seventy-five – and had died after a brief illness without giving any trouble to her son. Marcia's mother had died in the suburban house where Marcia now lived alone, in the upstairs front bedroom with the old cat Snowy beside her. She had been eighty-nine, what some might think of as a great age but nothing wonderful or to be remarked on. Letty's mother had died at the end of the war, then her father had married again. Shortly after this her father had died and the stepmother had in due course found another husband, so that Letty now had no connection with the West Country town where she had been born and brought up. She had sentimental and not entirely accurate memories of her mother, wandering round the garden snipping off dead heads, wearing a dress of some floating material. Only Norman had never known his mother – 'Never had a mum,' he used to say in his bitter sardonic way. He and his sister had been brought up by an aunt, and yet it was he who inveighed most fiercely against the commercializing of what had originally been the old country custom of Mothering Sunday.
'Of course you've got your church,' said Norman, addressing Edwin.
'And there's Father Gellibrand,' said Marcia, for they had all heard so much about Father G., as Edwin called him, and they envied Edwin the stable background of the church near Clapham Common where he was Master of Ceremonies (whatever that might be) and on the parochial church council (the pcc). Edwin would be all right, because although he was a widower and lived alone he had a married daughter living in Beckenham, and no doubt she would see to it that her old father wasn't found dead of hypothermia.
'Oh, yes, Father G.' s a real tower of strength,' Edwin agreed, but after all the church was open to everybody. He couldn't understand why neither Letty nor Marcia seemed to go to church. It was easier to see why Norman didn't.
The door opened and a young black girl, provocative, cheeky and bursting with health, entered the room.
'Anything for the post?' she asked.
The four were conscious of the way she looked at them, perhaps seeing Edwin, large and bald with a pinkish face, Norman, small and wiry with his bristly grey hair, Marcia with her general look of oddness, Letty, fluffy and faded, a Home Counties type, still making an effort with her clothes.
'Post?' Edwin was the first to speak, echoing her question. 'Hardly yet, Eulalia. The post does not have to be collected until half past three, and it is now' – he consulted his watch – 'two forty-two precisely. Just trying it on,' he said, when the girl retired, defeated.
'Hoping to get off early, lazy little so-and-so,' said Norman.
Marcia closed her eyes wearily as Norman began to go on about 'the blacks'. Letty tried to change the subject, for it made her uneasy to criticize Eulalia or to be guilty of any unkindness towards coloured people. Yet the girl was irritating and needed to be disciplined, even though there was no doubt that her exuberant vitality was disturbing, especially to an elderly woman who felt herself in contrast to be greyer than ever, crushed and dried up by the weak British sun.
Tea came at last and just before five o'clock the two men packed up what they were doing and went out of the room together, though they would separate on leaving the building, Edwin to the Northern Line for Clapham Common and Norman to the Bakerloo for Kilburn Park.
Letty and Marcia began a more leisurely tidying up. They did not speak of or break into gossip about the two men, who were accepted as part of the office furniture and not considered worthy of comment unless they did something surprisingly out of character. Outside, the pigeons on the roof were picking at each other, presumably removing insects. Perhaps this is all that we as human beings can do for each other, Letty thought. It was common knowledge that Marcia had recently had a serious operation. She was not a whole woman; some vital part of her had been taken away, though whether womb or breast was not generally known, Marcia herself revealing only that she had undergone 'major surgery'. But Letty did know that Marcia had had a breast removed, though even she did not know which one. Edwin and Norman had speculated on the matter and discussed it in the way men did; they felt that Marcia ought to have told them about it, seeing that they all worked together so closely. They could only conclude that the operation had made her even more peculiar than she had been already.
In the past both Letty and Marcia might have loved and been loved, but now the feeling that should have been directed towards husband, lover, child or even grandchild, had no natural outlet; no cat, dog, no bird, even, shared their lives and neither Edwin nor Norman had inspired love. Marcia had once had a cat but old Snowy had long since died, 'passed on' or 'been taken', however one liked to put it. In such circumstances women may feel a certain unsentimental tenderness towards each other, expressed in small gestures of solicitude, not unlike the pigeons picking insects off each other. Marcia, if she felt the need for such an outlet, was incapable of putting it into words. It was Letty who said, 'You look tired – shall I make you a cup of tea?' And when Marcia refused the offer, she went on, 'I hope your train won't be too crowded, that you'll get a seat – it should be better now, getting on for six o'clock.' She tried to smile at her, but when she looked at Marcia she saw that her dark eyes were alarmingly magnified behind her glasses, like the eyes of some nocturnal tree-climbing animal. A lemur or a potto, was it? Marcia, glancing sharply at Letty, thought, she's like an old sheep, but she means well even if she seems a bit interfering at times.
Norman, speeding northwards on the Stanmore branch of the Bakerloo line, was going to visit his brother-in-law in hospital. Now that his sister was dead there was no direct link between him and Ken, and Norman felt pleasantly virtuous at going to see him. He has no one, he thought, for the only child of the marriage had emigrated to New Zealand. In fact Ken did have somebody, a woman friend whom he expected to marry, but she did not visit on the same day as Norman. ' Let him come on his own,' they had said to each other, ' for after all he has no one and the visit will be a bit of company for him.'
Norman had never been in hospital himself but Marcia had dropped many hints about her experiences and especially about Mr Strong, the surgeon who had cut her up. Not that Ken's experience could be compared with hers but it gave one an idea. Norman was ready to surge through the swing doors with the crowd into the ward when the signal was given. He had not brought flowers or fruit, it being understood between them that the visit was all that was expected or required. Ken was not much of a one for reading either, though he was quite glad to glance at Norman's _Evening Standard_. By profession he was a driving examiner and his present stay in hospital was the result, not of an accident with a middleaged woman driver on test, as was jokingly assumed in the ward, but of a duodenal ulcer brought about by the worrying nature of life in general, to which the anxieties of his job must surely have contributed.
Norman sat down by the side of the bed, averting his eyes from the other patients. Ken seemed a bit low, he thought, but men did not look their best in bed. There was something very unattractive about the average man's pyjamas. The ladies made more of an effort with their pastel-coloured nighties and frilly bed jackets which Norman had caught glimpses of when he passed the women's medical ward on his way up. Ken's bedside table held only a box of paper handkerchiefs and a bottle of Lucozade beside the regulation plastic water jug and glass, but in the recess underneath Norman could see a metal bowl for vomiting and a curiously shaped 'vase' of a grey, cardboard-like material which he suspected was something to do with passing urine – waterworks, as he put it. The sight of these half-concealed objects made him feel uneasy and resentful, so that he didn't quite know what to say to his brother-in-law.
'Seems quiet tonight,' he remarked.
'The telly's broken down.'
'Oh, so that's it. I thought there was something different.' Norman glanced towards the centre table where the great box stood, its face now grey and silent as its viewers in their beds. It should have been covered with a cloth, if only for the sake of decency. 'When did this happen?'
'Yesterday, and they haven't done anything about it. You'd think it was the least they could do, wouldn't you?'
'Well, it'll give you more time for your thoughts,' said Norman, meaning to be sarcastic, even a little cruel, for what thoughts could Ken have better than telly? He could not have known that Ken did indeed have thoughts, dreams really, of the driving school he and his woman friend planned to set up together; how he lay thinking of names – something like 'Reliant' or 'Excelsior' was obviously suitable, then his fancy was suddenly arrested by the name ' Dolphin' and he had a vision of a fleet of cars, turquoise blue or buttercup yellow, swooping and gliding over the North Circular, never stalling at the traffic lights as learners so often did in real life. He thought too about the make of car they would have – nothing foreign or with the engine at the back – that seemed to be against nature, like a watch with a square face. He could not reveal any of this to Norman, who disliked the motor car and couldn't even drive one. Ken had always felt a sort of pitying contempt for him, being so unmanly and working as a clerk in an office with middle-aged women.
They sat almost in silence and it was a relief to both of them when the bell went and the visit was at an end.
'Everything all right?' Norman asked, now eagerly on his feet.
'The tea's too strong.'
'Oh,' Norman was nonplussed. As if he could do anything about a thing like that! What did Ken expect? 'Couldn't you ask Sister or one of the nurses to make it weaker or put more milk in it?'
'You'd still taste the strength, even so. It's strong to begin with, you see. Anyway I couldn't ask Sister or one of the nurses – it's not their job.'
'Well, the lady that makes the tea, then.'
'Catch me doing that,' said Ken obscurely. 'But strong tea's the last thing I should have with my complaint.' Norman shook himself like a tetchy little dog. He hadn't come here to be involved in this sort of thing, and he allowed himself to be hustled away by a bossy Irish nurse, with never a backward glance at the patient in the bed.
Outside, his irritable mood was intensified by the cars that rushed past, preventing him from crossing the road to the bus stop. Then he had to wait a long time for a bus and when he reached the square where he lived there were more cars, parked side by side, overlapping on to the pavement. Some of them were so large that their hindquarters – rumps, buttocks and bums – jutted over the kerb and he had to step aside to avoid them. 'Bugger,' he muttered, kicking one of them with a small ineffectual foot. 'Bugger, bugger, bugger.'
Nobody heard him. The almond trees were in flower but he did not see them and was unconscious of their blossom shining in the lamplight. He entered his front door and went into his bedsitting room. The evening had exhausted him and he did not even feel that he had done Ken much good.
Edwin had spent a much more satisfactory evening. The attendance at the sung Mass had been pretty much as usual for a weekday – only seven in the congregation but the full complement in the sanctuary. Afterwards he and Father G. had gone to the pub for a drink. They had talked church shop – whether to order a stronger brand of incense now that the Rosa Mystica was nearly finished – should they let the young people organize the occasional Sunday evening service with guitars and that – what would be the reaction of the congregation if Father G. tried to introduce Series Three?
'All that standing up to pray,' Edwin said. ' People wouldn't like that.'
'But the Kiss of Peace – turning to the person next to you with a friendly gesture, rather a...' Father G. had been going to say 'beautiful idea', but perhaps, given his particular congregation, it wasn't quite the word.
Remembering the emptiness of the church at the service they had just attended, Edwin was also doubtful – not more than half a dozen dotted among the echoing pews and nobody standing next to anybody to make any kind of gesture – but he was too kind to spoil Father G.'s vision of a multitude of worshippers. He often thought regretfully of those days of the Anglo-Catholic revival in the last century and even the more sympathetic climate of twenty years ago, where Father G., tall and cadaverous in cloak and biretta, would have been rather more in place than in the church of the nineteen seventies where so many of the younger priests went in for jeans and long hair. One such had been in the pub that evening. Edwin's heart sank as he visualized the kind of services at _his_ church. 'I think perhaps we'd better keep the evening service as it is,' he said, thinking dramatically, over my dead body, seeing himself trampled down by a horde of boys and girls brandishing guitars...
They parted outside Edwin's neat semi-detached house in a street not far from the common. Standing by the hatstand in the hall, Edwin was reminded of his dead wife, Phyllis. It was the moment of waiting outside the sitting room door before going in that brought her into his mind. He could almost hear her voice, a little querulous, asking, 'Is that you, Edwin?' As if it could be anybody else! Now he had all the freedom that loneliness brings – he could go to church as often as he liked, attend meetings that went on all evening, store stuff for jumble sales in the back room and leave it there for months. He could go to the pub or the vicarage and stay there till all hours.
Edwin went upstairs to bed humming a favourite Office Hymn, 'O Blest Creator of the Light'. It was tricky, the plainsong tune, and his efforts to get it right diverted his attention from the words. In any case it would be going a bit far to regard tonight's congregation as 'sunk in sin and whelmed with strife', as one line of the hymn put it. People nowadays wouldn't stand for that kind of talk. Perhaps that was one reason why so few went to church.
# Two
So often now Letty came upon reminders of her own mortality or, regarded less poetically, the different stages towards death. Less obvious than the obituaries in _The Times_ and the _Telegraph_ were what she thought of as 'upsetting' sights. This morning, for instance, a woman, slumped on a seat on the Underground platform while the rush hour crowds hurried past her, reminded her so much of a school contemporary that she forced herself to look back, to make quite sure that it was _not_ Janet Belling. It appeared not to be, yet it could have been, and even if it wasn't it was still somebody, some woman driven to the point where she could find herself in this situation. Ought one to _do_ anything? While Letty hesitated, a young woman, wearing a long dusty black skirt and shabby boots, bent over the slumped figure with a softly spoken enquiry. At once the figure reared itself up and shouted in a loud, dangerously uncontrolled voice, ' Fuck off!' Then it couldn't be Janet Belling, Letty thought, her first feeling one of relief; Janet would never have used such an expression. But fifty years ago nobody did – things were different now, so that was nothing to go by. In the meantime, the girl moved away with dignity. She had been braver than Letty.
That morning was a flag day. Marcia peered at the young woman standing with her tray and rattling tin outside the station. Something to do with cancer. Marcia advanced, quietly triumphant, a 10p coin in her hand.
The smiling girl was ready, the flag in the form of a little shield poised to stab into the lapel of Marcia's coat.
'Thank you,' she said, as the coin clattered down into the tin.
'A _very_ good cause,' Marcia murmured, 'and one very dear to _me_. You see, I too have had...'
The girl waited nervously, her smile fading, but like Letty she was hypnotized by the marmoset eyes behind the thick glasses. And now promising young men who might have been induced to buy flags were slinking by into the station, pretending to be in a hurry.
'I, too,' Marcia repeated, 'have had _something removed_.'
At that moment an older man, attracted by the sight of the pretty flag-seller, approached and cut short Marcia's attempt at conversation, but the memory of her stay in hospital lasted her all the way to the office.
Marcia had been one of those women, encouraged by her mother, who had sworn that she would never let the surgeon's knife touch her body, a woman's body being such a private thing. But of course when it came to the point there was no question of resistance. She smiled as she remembered Mr Strong, the consultant surgeon who had performed the operation – mastectomy, hysterectomy, appendectomy, tonsillectomy – you name it, it was all one to him, his cool competent manner seemed to imply. She recalled his procession down the ward, surrounded by satellites, her eager observation and anticipation until the great moment when he arrived at her bed and she heard him ask, 'And how's Miss Ivory this morning?' in that almost teasing way. Then she would tell him how she was and he would listen, occasionally asking a question or turning to Sister for her opinion, the rather flippant manner replaced by professional concern.
If the surgeon was God, the chaplains were his ministers, a little lower than the housemen. The good-looking young Roman Catholic had come first, saying how we all needed a rest at times, though he did not look as if he could possibly need such a thing, and how being in hospital, unpleasant though it was in many ways, could sometimes prove to be a blessing in disguise, for there was no situation that couldn't be turned to good, and truly you could say that every cloud had a silver lining... He went on in this vein with such a flow of Irish charm that it was some time before Marcia could get in a word to tell him that she was not a Roman Catholic.
'Ah, then you'll be a Protestant.' The violence of the word had a stunning effect, as it must to anyone used to the vaguer and gentler 'Anglican' or 'Church of England'. 'Well, it's nice to have had this chat,' he conceded. 'The Protestant chaplain will be along to see you.'
The Anglican chaplain offered her Holy Communion and although she was not a practising churchwoman Marcia accepted, partly out of superstition but also because it gave her a kind of distinction in the ward. Only one other woman received the ministrations of the chaplain. The other patients criticized his crumpled surplice and wondered why he didn't get a nylon or terylene one, and recalled their own vicars refusing to marry people in their churches or to christen kiddies because their parents didn't go to church, and other such instances of unreasonable and unChristian behaviour.
Of course in hospital, and particularly when the chaplain visited her, the question of death did come into one's mind, and Marcia had asked herself the brutal question, if she were to die, having no close relatives, would it matter? She could be buried in a pauper's grave, if such a thing still existed, though she would leave money enough for a funeral; but her body could be shovelled into a furnace, she would never know. Might as well be realistic. Of course she could donate certain organs to assist in research or spare-part surgery. This last idea had an irresistible appeal, linked as it was with the thought of Mr Strong, and she meant to fill in the form at the back of the booklet they had given her when she entered the hospital. But in the end she never got round to it and anyway her operation had been a success and she had _not_ died. 'I shall not die but live' – there had been a poem that came into her mind at the time. She didn't read poetry now, or anything else for that matter, but sometimes she remembered the odd tag.
As she waited on the platform that morning Marcia noticed that somebody had scrawled in crude capital letters, kill asian shit. She stared at the inscription and mouthed the words to herself as if considering their implication. They brought back another hospital memory, of a man who had wheeled her on the trolley to the operating theatre, bearded and with a remote, dignified beauty, his head and body swathed in bluish gauze. He had called her 'dear'.
The three others looked up as Marcia entered the room.
'Late, aren't you?' Norman snapped.
As if it had anything to do with him, Letty thought. 'There's been some delay on the Underground this morning,' she said.
'Oh, yes,' Norman agreed. 'Did you see that on the blackboard at Holborn station? Trains were delayed "due to a person under the train at Hammersmith", it said. A "person" – is that what you have to say now?'
'Poor soul,' said Edwin. 'One does wonder sometimes how these tragedies occur.'
Letty was silent, remembering her own upsetting experience. That woman might find herself under a train one day. She had not mentioned it before but now she did.
'Dear me,' said Norman, 'that looks like a good example of somebody who's fallen through the net of the welfare state.'
'It could happen to anyone,' said Letty, 'but there's really no need for anyone nowadays to get into that sort of state.' She glanced down at her tweed skirt, old but newly cleaned and pressed; at least one could keep up reasonable standards.
Marcia said nothing, but stared in her disconcerting way.
Norman said almost chirpily, 'Oh, well, that's another thing we've all got coming to us, or at least the possibility – falling through the net of the welfare state.'
'Don't keep on about it,' said Edwin. 'What with being found dead of hypothermia, you seem to've got it on the brain.'
'Dead of starvation's more likely,' said Norman. He had been to the supermarket on his way to work and now proceeded to check the items in his shopping bag – a ' psychedelic' plastic carrier, patterned in vivid colours, hinting at some unexpected aspect of his character – against the printed slip he had received at the check-out. ' Crispbread 16, tea 18, cheese 34, butter beans, the small tin, 12,' he recited. 'Bacon 46, but that was the smallest pack I could find, smoked oyster back, they called it, not really the best. You'd think they'd do it up smaller for people living alone, wouldn't you. The woman in front of me spent over twelve pounds – just my luck to get behind somebody like that at the check-out,' he droned on.
'I should put the bacon in a cooler place if I were you,' said Letty.
'Yes, I'll pop it in one of the filing cabinets,' said Norman. 'Don't let me forget it. You read of elderly people being found dead in the house with no food – dreadful, isn't it?'
'There's no need for that,' said Edwin.
'It is possible to store tins,' said Marcia, in a remote sort of way.
'But then you might not have the strength to open them,' said Norman with relish. ' Anyway, I don't have much storage space.'
Marcia glanced at him thoughtfully. She wondered sometimes about Norman's domestic arrangements but of course nobody had ever seen his bed-sitting room. The four who worked together did not visit each other or meet after office hours. When she had first come here, Marcia had experienced a faint stirring of interest in Norman, a feeling that was a good many degrees cooler than tenderness but which nevertheless occupied her thoughts briefly. Once at lunchtime she had followed him. At a safe distance behind, she had watched him as he picked his way through the fallen leaves and called out angrily after a car which had failed to stop at a zebra crossing. She found herself entering the British Museum, ascending wide stone steps and walking through echoing galleries filled with alarming images and objects in glass cases, until they came to rest in the Egyptian section by a display of mummified animals and small crocodiles. Here Norman had mingled with a crowd of school children and Marcia slipped away. If she had thought of making herself known to him, the time and such questions as ' Do you come here often?' were obviously inappropriate. Norman had not revealed to any of them that he visited the British Museum, and even if he had would never have admitted to the contemplation of mummified crocodiles. No doubt it was a secret thing. As time went on Marcia's feeling for Norman waned. Then she went into hospital and Mr Strong entered her life and filled her thoughts. Now she hardly considered Norman at all, except as a rather silly little man, so his fussing with his shopping and his reading out the things he had bought only irritated her. She did not want to know what he was going to eat – it was of no interest whatsoever.
'That reminds me, I must get a loaf at lunchtime,' said Edwin. 'Father G.'s coming in for a bite before the pcc meeting and I'll do one of my specials – baked beans on toast with a poached egg on top.'
The women smiled, as they were meant to, but Edwin was known to be a competent cook and it was not as if they had anything much grander for their own evening meals, he thought, as he came out of a teashop that sold bread, carrying a large white loaf wrapped in a paper bag. He had had a light lunch, snack really, in the teashop whose decor had changed distressingly, though the food was the same. Edwin and the other regular patrons felt themselves out of place among so much trendy orange and olive green and imitation stripped pine. There were hanging lights and shades patterned with butterflies and over it all soft 'muzak', difficult to hear but insidious. Edwin didn't like change, and now that Gamage's had been pulled down it was a relief to do his lunchtime church crawl, though even the Church, the dear old C of E, was not immune to change. Sometimes he would slip in for a prayer or a look round and a read of the parish magazine if there was one, but mostly he studied the noticeboards to see what was offered in the way of services and other activities. Today he was attracted by the announcement of an austerity luncheon in aid of a well-known charity, but rather surprisingly 'with wine' – that might be worth a visit.
Letty did her shopping on the way home, at a small self-service store run by Uganda Asians that stayed open till eight o'clock in the evening. She bought only tinned or packaged foods, feeling a doubt about anything exposed to the air. In her comfortable bedsitting room, which had a washbasin behind a screen and a small electric cooker, she prepared a meal of rice with the remains of a chicken, then settled herself to listen to the wireless and continue working on a tapestry chair-seat she was making.
The house belonged to an elderly woman who took in, as the most refined type of lodgers, two others like herself and a Hungarian refugee, who had more or less adapted herself to the ways of the house – one's radio considerately turned down and the bathroom left as one would wish to find it. It was a comfortable enough life, if a little sterile, perhaps even deprived. But deprivation implied once having had something to be deprived of, like Marcia's breast, to give a practical example, and Letty had never really had anything much. Yet, she sometimes wondered, might not the experience of 'not having' be regarded as something with its own validity?
There was a play on the radio that evening, going backwards into the life of an old woman. It reminded Letty of the woman she had seen slumped on the seat on the Underground platform that morning, as if one might visualize her this time last year, say, then five years ago, ten years, twenty, thirty, even forty. But this kind of going back was hardly for Letty herself, who lived very much in the present, holding neatly and firmly on to life, coping as best she could with whatever it had to offer, little though that might be. Her curriculum vitae presented the kind of reading of so many like herself born before 1914, the only child of middle-class parents. She had arrived in London in the late twenties to take a secretarial course, staying in a working-girls' hostel where she had met her friend Marjorie, the only person she still kept up with from those far-off days. Like most girls of her generation and upbringing she had expected to marry, and when the war came there were great opportunities for girls to get a man or form an attachment, even with a married man, but Marjorie had been the one to marry, leaving Letty in her usual position of trailing behind her friend. By the end of the war Letty was over thirty and Marjorie had given up hope for her. Letty had never had much hope anyway. The immediate post-war years were fixed in her memory by the clothes she had worn on particular dates – the New Look brought in by Dior in 1947, the comfortable elegance of the fifties, and in the early sixties the horror of the mini-skirt, such a cruel fashion for those no longer young. And only the other day Letty had walked past the building in Bloomsbury where she and Marjorie had worked in the thirties – it had been on the first floor of a Georgian house – and found herself facing a concrete structure. Rather like the building where she now worked with the other three, but of course she never noticed that.
That night, as if inspired by the radio play, Letty had a dream. She was back at the time of the Silver Jubilee, staying with Marjorie and her fiancé Brian in the country cottage they had bought for £300. There was a friend of Brian's there too, intended for Letty, a handsome but dull young man called Stephen. On the Saturday evening they went to the pub and sat in the quiet musty saloon bar with its mahogany furniture and stuffed fish. It felt damp as if nobody ever used it, as indeed nobody did except timid visitors like themselves. They all had beer, though the girls didn't like it much and it seemed to have no noticeable 'effect' on them, except to make them wonder whether there was a ladies' cloakroom in such a primitive place. On the other side, in the public bar, there was light and colour and noise, but they, the four young people, were outside it all. On Sunday they went to Matins at the village church. There were bird-droppings on the altar and the vicar appealed for donations towards the repair of the roof. In 1970 the church was closed as redundant and the building was eventually pulled down as being of no architectural or historical interest. In Letty's dream she was lying in the long grass with Stephen, or somebody vaguely like him, in that hot summer of 1935. He was very near to her, but nothing happened. She did not know what had become of Stephen but Marjorie was a widow now, as alone as Letty in her bedsitter. All gone, that time, those people... Letty woke up and lay for some time meditating on the strangeness of life, slipping away like this.
# Three
Marcia entered her house, that house which, in the estate agents' language, was on its way to becoming a 'twentythousand semi'. Houses in that road were already reaching nearly that figure but Marcia's house was not quite like the others. From the outside it looked ordinary enough, with stained-glass panels in the front door, two large bow windows and a smaller window over the porch. The outside paint was a conventional dark green and cream, now in need of re-doing, and the net curtains at the windows could have done with a wash, some thought. But Miss Ivory went out to work and she was not the sort of person you could offer to help. Her neighbours in the more fashionably doneup houses on either side were newcomers. They sometimes passed the time of day with her but Marcia had not been into their houses nor they into hers.
Inside, the house was dark with brown-painted doors kept mysteriously closed. Dust lay everywhere. Marcia went straight through to the kitchen where she deposited her shopping bag on the newspaper-covered table. She knew that she ought to start getting a meal. The almoner, or medical social worker as they called it now, at the hospital had said how important it was for the working woman to have a good meal when she came home in the evening, but all Marcia did was to fill the kettle for a cup of tea. Her energies had already been spent that morning preparing her lunch to eat in the office. She could not think of any other kind of food now though she might have a biscuit with her tea. 'Biscuits keep you going,' they used to say in the war, but she had never had a big appetite. She had always been thin and since being in hospital she had become even thinner. Her clothes hung loosely on her but she didn't really care how she looked, not like Letty who was always buying new things and worried if she couldn't get a cardigan in the exact shade to match something.
Suddenly a bell rang, shrill and peremptory. Marcia was as if frozen into her chair. She never had visitors and nobody ever called. Who could it be, and in the evening? The bell rang again and she got up and went into the front room where from a side window she could see who was standing on the doorstep.
It was a young woman, swinging a bunch of car keys in her hand. Marcia could see a small blue car parked on the opposite side of the road. Reluctantly she opened the door.
'Ah, Miss Ivory, isn't it? I'm Janice Brabner.'
She had a rather pink, open face. Young women nowadays didn't seem to bother much with make-up and even Marcia could see that some would have been improved by it.
'Some of us at the Centre have been worrying about the lonely ones.'
Could she really have prepared that sentence, for this was what came out. Marcia gave her no encouragement.
'I mean, the people who live alone.'
'Did you think I might be found dead? Was that the idea?'
'Oh, Miss Ivory, of course we had nothing like that in mind!'
It seemed to be almost an occasion for laughter but Janice Brabner was sure this couldn't be right. Doing voluntary work at the Centre wasn't exactly funny even if one smiled sometimes at the people one visited, for some of them were rather sweet. But they could be tragic. Miss Ivory, for instance, in what category should she be placed? It was known that her mother had died some years ago, that she now lived alone and that she had recently left hospital after a major operation. The medical social worker, whom Janice knew, had dropped a hint, suggested that it might be as well to keep an eye on her. It was true that she went out to work but nobody seemed to know much about her – she didn't speak to neighbours and nobody had ever been into her house. She did not invite Janice to come in now and they continued their conversation on the doorstep. Of course one couldn't force one's way into people's houses, but surely a lonely person like Miss Ivory would welcome a friendly advance and a chat?
'We just wondered,' Janice went on, realizing the need for tact and caution, as she had been instructed, 'if you'd like to come along to a get-together at the Centre one evening. It's next to the town hall, you know.'
'I don't think so,' said Marcia firmly. 'I go out to work and my evenings are fully occupied.'
But there was no television aerial on the house, so what did she do in the evenings? Janice wondered. Still, she had done all she could, sown a seed, perhaps; that was the main thing.
No sooner was the door closed than Marcia went up to the front bedroom to watch Janice Brabner go. She saw her unlock her car and then sit in it with a list in her hand which she appeared to be consulting. Then she drove away.
Marcia turned back into the room where her mother had died. It had been left almost untouched since then. Of course the body had been removed and buried, all that was necessary in that way had been done and the proper obsequies performed, but after that Marcia had lacked the energy to rearrange the furniture and Mrs Williams, the woman who came in to clean at that time, had not encouraged her. ' You want to remember things as they were, not go changing them,' she had said. She did not care for moving furniture, anyway. The bed had become the place where the cat Snowy slept until his death, when the black part of his fur had taken on a brownish tinge and his body had become light, until one day, in the fullness of time, he had ceased to breathe, a peaceful end. He was twenty years old, one hundred and forty in human terms. 'You wouldn't want to be that old,' Mrs Williams had said, as if one had the choice or could do anything about it. After Snowy's death and burial in the garden, Mrs Williams had left, the work having become too much for her, and Marcia made no pretence of doing anything to the room. On the bed cover there was still an old fur ball, brought up by Snowy in his last days, now dried up like some ancient mummified relic of long ago.
'Miss Ivory has funny staring eyes. And she obviously didn't want to ask me in,' said Janice, back at the Centre, basking now in the relief of an awkward duty done.
'Oh, you mustn't let that put you off,' said an older and more experienced colleague. 'A lot of them seem like that at first, but the contact has been made, that's the chief thing. And that's what we have to do – _make contact_ , by force, if necessary. Believe me, it can be _most_ rewarding.'
Janice wondered about this, but said nothing.
Over the other side of the common Edwin, on an evening walk, was studying a church noticeboard. It offered nothing but the barest essentials – Holy Communion at eight on Sundays, Matins at eleven, no weekday services – and when he turned the handle of the door he found that it was locked. A pity, but that was the way things were now – it wasn't safe to leave a church open, what with thefts and vandalism. With a slight feeling of frustration he turned away and began walking along the road until he reached a side turning which seemed to go in the direction he wanted. Then he read the name of the road and realized that it was where Marcia lived and he walked on quickly. It would be embarrassing to meet her, even to walk past her house, he felt. They were both, in a sense, lonely people but neither would have expected to meet the other outside office hours. Any kind of encounter would fill her with a dismay equal to his. In any case, Edwin always felt that Norman was more Marcia's friend than he was, more her cup of tea if anyone was. Was he, Edwin, then Letty's friend? Well, hardly that. Something in the idea made him smile and he walked away along the common, a tall, smiling figure carrying a raincoat, although it was a warm evening and the sky was cloudless.
# Four
With the coming of spring, merging into the sunshine of early May, there was a subtle change in the lunchtime occupations of the four in the office. Edwin went on his usual church crawl, for that season of the year was stiff with festivals and the churches in the area had a rich and varied programme to offer, but he also frequented gardening shops and called at travel agents and collected brochures with the possibility of arranging a late holiday, everyone else having booked theirs in January. Norman plucked up his courage to visit the dentist and arrived at the office feeling very sorry for himself, and with a Thermos of soup which was all he could manage for his lunch.
Marcia forsook the public library and wandered into a shop full of loud music, merchandise from foreign parts and badly finished eastern-style garments for both sexes. She fingered the crude pottery and the garish flimsy blouses and skirts but did not buy anything. The almost deafening pop music confused her and she felt that people were staring at her. She went out into the sunshine, dazed and bewildered. Then she was roused into alertness by the clang of an ambulance bell and she found herself joining a knot of people gathered round a slumped figure on the pavement. Somebody had collapsed with a coronary, a window cleaner had slipped and fallen – the air was full of excited, confused murmurings, but nobody quite knew what had happened. Marcia attached herself to two women and tried to find out, but all they could say was, 'Poor soul, doesn't he look terrible – what a shock for his wife.' Her thoughts went back to her own stay in hospital and the excitement when an ambulance came in, for she had been in a ground-floor ward very near Casualty. It was rather disappointing now to see the man on the pavement attempting to get up, but the ambulance men restrained him and bundled him in and Marcia, a smile on her lips, went back to the office.
Norman and Letty both felt the pull of the open air, Norman to take his mind off his teeth, and Letty because she had the slightly obsessive or cranky idea that one ought to get a walk of some kind every day. So they both made their way, separately and unaware of each other, to Lincoln's Inn Fields, the nearest open space to the office.
Norman gravitated towards the girls playing netball and sat down uneasily. He could not analyse the impulse that had brought him there, an angry little man whose teeth hurt – angry at the older men who, like himself, formed the majority of the spectators round the netball pitch, angry at the semi-nudity of the long-haired boys and girls lying on the grass, angry at the people sitting on seats eating sandwiches or sucking ice lollies and cornets and throwing the remains on the ground. As he watched the netball girls, leaping and cavorting in their play, the word 'lechery' came into his head and something about 'grinning like a dog', a phrase in the psalms, was it; then he thought of the way some dogs did appear to grin, their tongues lolling out. After a few minutes' watching he got up and made his way back to the office, dissatisfied with life. Only the sight of a wrecked motor car, with one side all bashed in, being towed up Kingsway by a breakdown van, gave him the kind of lift Marcia had experienced on hearing the bell of the ambulance, but then he remembered that an abandoned car had been parked outside the house where he lived for some days, and the police or the council ought to do something about it, and that made him angry again.
Letty, with her feelings on the subject of exercise and fresh air, was prepared to enjoy these amenities.
# One impulse from a vernal wood
May teach you more of man,
Of moral evil and of good,
Than all the sages can.
She knew all about that, even if she was not prepared to go too deeply into the implications of those lines. She walked briskly and did not think of sitting down, for most of the seats were occupied and those that had space contained obvious eccentrics, muttering to themselves and eating strange things. It was better to go on walking, though it was hot and she would have liked a rest. Letty was not angry when she saw the young people kissing and cuddling on the grass, even if such behaviour was different from that of forty years ago when she was a girl. But was it so different? Or could it be that she had not noticed such things in those days? She passed a building concerned with Cancer Research and she thought of Marcia. Even Marcia had once hinted at something in her own life, long ago. No doubt everybody had once had something in their lives? Certainly it was the kind of thing people liked to imply, making one suspect that a good deal was being made out of almost nothing.
Back in the office the talk was about holidays. Edwin's brochures advertising impossible delights had been spread out on his table for some weeks now, but it was known that he never did more than leaf through their pages, for his annual holiday was invariably spent with his daughter and her family.
'Greece,' said Norman, taking up a booklet with a picture of the Acropolis on the cover. 'I've always had a fancy to go there.'
Marcia looked up, startled. The others were surprised too but did not show it. What was this? What new aspect of Norman's life, what never before expressed longing was to be revealed? His holidays, always taken in England, were usually characterized by disaster.
'They say it's the wonderful light, a special quality it has,' said Letty, repeating something she had once heard or read. 'And the wine-dark sea – isn't that how it's described?'
'Oh, I don't care what colour the sea is,' said Norman. ' It's the swimming that would attract me.'
'You mean skin diving and that sort of thing?' said Edwin in astonishment.
'Why not?' Norman was defiant. 'Lots of people do it, you know. They find buried treasure and that.'
Edwin began to laugh. 'It would be a bit different from that holiday of yours last year,' he joked. Norman had been on a coach trip to the West Country when, for some unspecified reason, his only comment had been 'Never again.' 'I shouldn't think you found much buried treasure _there_.'
'I can never understand why people have to leave their homes the way they do,' said Marcia. 'When you're older you don't really need holidays.' If Norman really had these secret longings it ought to be enough for him to go and sit in the British Museum at lunchtime, contemplating the riches of vanished civilizations, she felt. Marcia herself never went away; her absences from the office were spent in mysterious ploys of her own.
'Oh, well, looking at the pictures is probably as far as I'll get,' said Norman. 'Not like Letty here.'
'I've never been to Greece,' said Letty, but she was by far the most adventurous of the four of them. She had been on several package tours abroad with Marjorie, and her postcards of Spain, Italy and Yugoslavia still brightened the office walls. But this year Marjorie seemed to want to stay at home and as Letty was going to share her cottage with her when she retired it seemed quite a good idea for her to get used to living in the country. During her fortnight Letty would be getting a taste of village life, with excursions to the surrounding country and picnic lunches when the weather permitted. 'Roses round the door and all that,' as Norman used to say when Letty's retirement plans were mentioned. 'But of course the weather can spoil things,' he couldn't resist adding. 'Don't I know!'
# Five
Apheasant sat in the middle of a field, unconcerned as the train drew into the platform. Letty could see Marjorie's dusty blue Morris 1000 standing among the larger and sleeker cars parked at the station. Even now, forty years later, she was reminded of 'Beelzebub', Marjorie's first car bought for £25 in the nineteen thirties. Did young people still give their old cars facetious names, Letty wondered. Motoring was a much more serious business now, hardly fun at all, when the car was an important status symbol and large sums of money could be paid for particularly desirable registration numbers.
Marjorie seized Letty's bag and stuffed it into the boot. As a comfortable widow living in the country, she seemed far removed from the dashing young woman that Letty remembered from their earlier days, even if she still retained some romantic extravagances. Now she seemed rather excessively interested in the new vicar who had recently been appointed and Letty saw him for the first time when – surprisingly for Marjorie – she insisted on taking her to church on Sunday morning. The Reverend David Lydell (he liked to be called 'Father') was a tall dark man in his middle forties who certainly looked good in his vestments. Nice for Marjorie to have an interesting new vicar, Letty thought, generously indulgent. Most of the inhabitants of the village were retired married couples with the ritual grandchildren. There was a certain amount of formal social life, mostly consisting of the drinking of sherry at certain times, and one evening Marjorie invited an elegant retired colonel, who had no conversation, and his wife, who had a good deal more, and Father Lydell, in for a drink. Seen at closer quarters and in 'civilian' clothes, Father Lydell was disappointing. He looked sadly ordinary in a ginger-coloured tweed jacket and grey flannel trousers with something not quite right about the cut of them – too wide or too narrow, or at least not what one saw people wearing now.
After a decent interval and a couple of glasses each, the colonel and his wife left, but Father Lydell, obviously with no evening meal of his own in view, lingered on, so that Marjorie had to ask him to stay to supper.
'One is at a slight disadvantage,' he said elliptically, when Marjorie left the room to prepare the meal and he and Letty were left alone.
'Oh? In what way?' Letty was not sure whether he meant the disadvantage to apply to himself or to the human race in general.
'In being unable to return hospitality,' he explained. 'Marjorie has been so kind.'
So he called her by her Christian name, and there had been other meals.
'I think people in a village usually are hospitable,' said Letty, diminishing him a little. 'More so than in London.'
'Ah, _London_...' Was the sigh too extravagant?
'Of course David is here for his health,' said Marjorie, coming back into the room and entering eagerly into the conversation.
'Do you find the country is doing you good?' Letty asked.
'I've had diarrhoea all this week,' came the disconcerting reply.
There was a momentary – perhaps no more than a split second's – pause, but if the women had been temporarily taken aback, they were by no means at a loss.
'Diarrhoea,' Letty repeated, in a clear, thoughtful tone. She was never certain how to spell the word, but felt that such a trivial admission was lacking in proper seriousness so she said no more.
'Strong drink would do you more good than the eternal parish cups of tea,' Marjorie suggested boldly. 'Brandy, perhaps.'
'Enterovioform,' said Letty.
He smiled pityingly. 'All those English on package tours on the Costa Brava may find it helpful, but my case is rather different...'
The sentence trailed off, leaving the difference to be imagined.
'Well, when one _is_ abroad... When we were in Naples, _Napoli_ ,' said Marjorie, almost roguishly. 'Do you remember that time in Sorrento, Letty?'
'I only remember the lemon groves,' said Letty, determined to change the subject.
David Lydell closed his eyes and lay back in his chair, thinking how agreeable it was to be in the company of gentlewomen. Far more what he was accustomed to. The rough voices of the village people grated on his nerves and sometimes they said cruel things. Any attempts he had made to 'improve' the church services had met with scorn and hostility and when he tried to visit the cottages he was forced to look at television programmes which they hadn't even the good manners to turn off. He found it shocking that such people should have no running water or indoor sanitation and yet be slaves to the box. Even the old women, who might have been the backbone of the congregation in earlier times, seemed disinclined to attend church, even if conveyed there and back by car. The only services that drew congregations of any size were Harvest Festival, Remembrance Sunday and the Carol Service at Christmas. By contrast, Marjorie and her friend, Miss Something, a not very interesting person whose name he hadn't caught, were highly civilized and he enjoyed eating _poulet niçoise_ and talking about holidays in France and Italy.
'Orvieto,' he murmured. ' Of course one wants to drink it _there_ ,' and naturally they agreed with him.
Letty thought him rather tiresome but she did not say as much to Marjorie. The weather was good and she did not want to raise controversial subjects over tea in the garden or during leisurely country walks. Besides, if she was going to share Marjorie's cottage in her retirement it would be as well not to be too critical of the vicar, especially as it seemed that he might often be dropping in. That was one of the country things she would have to get used to. There were other things too. On their walks she was always the one to find the dead bird and the dried-up hedgehog's body or to notice the mangled rabbit in the middle of the road when they were driving. She supposed that Marjorie had seen them so often that she no longer found them upsetting.
On the last day of Letty's holiday they were to go for a picnic to a nearby beauty spot. As it was a weekday the place would be less crowded and, best of all, as Marjorie revealed just before they started out, David Lydell would be able to accompany them.
'But won't he have things to do during the week?' Letty protested. 'Even if there aren't any services, doesn't he have to visit the sick and the old people?'
'There's only one sick person at the moment and he's in hospital, and the old people don't want visits from the clergy,' said Marjorie, making Letty realize that it was no good thinking that such old-fashioned notions could be applied in these days of the welfare state or in a village where the health of every person was known and commented on. 'I try to get David out into the countryside as much as I can,' Marjorie added. 'He needs to get right away and relax.'
Letty noted the use of the term 'countryside', which seemed to have a special significance, and bearing David Lydell's need in mind, she was not surprised to find herself squashed into the back of the car with the picnic things and Marjorie's old sealyham which left stiff white hairs all over Letty's neat navy-blue trousers. David and Marjorie in the front made conversation about village matters which Letty could not join in.
When they arrived at the picnic spot, Marjorie produced two folding canvas chairs from the boot of the car and these were solemnly put up for herself and David, Letty having quickly assured them that she would just as soon sit on the rug – indeed, she preferred it. All the same, she could not help feeling in some way belittled or diminished, sitting on a lower level than the others.
After they had eaten cold ham and hard-boiled eggs and drunk white wine – an unusual touch, this, which Letty could only attribute to the presence of David Lydell – the three of them fell silent; perhaps, because of drinking wine in the middle of the day, a natural desire for sleep overcame them. An awkward arrangement for sleeping – three people, two in the chairs and Letty down below – but she closed her eyes against her will and for a short time was unaware of her surroundings.
When she opened her eyes she found herself looking straight up at Marjorie and David, their canvas chairs pushed close together, apparently locked in an embrace.
Letty immediately looked away and closed her eyes again, wondering if she had been dreaming.
'More coffee anyone?' Marjorie asked in a bright tone. 'There's some in the other thermos. Letty, I think you've been asleep.'
Letty sat up, 'Yes, I think I must have dropped off,' she admitted. Had she imagined the whole scene, or was this another of the things she was going to have to get used to when she lived in the country?
No sooner had Letty come back from her holiday than Edwin went on his. There had been a good deal of discussion in the office as to whether he should go by coach or by train and the advantages and snags of each method were endlessly weighed up. In the end the train won. It was more expensive but it was quicker, and Edwin would get enough motoring with his son-in-law and daughter and the two children. They would be in easy reach of Eastbourne, where there were some splendid churches, and he was looking forward to that. In addition there would be visits to a safari park and to the stately homes that offered the best attractions; perhaps they would even go as far afield as the Lions of Longleat, driving on as many motorways as possible, the men in the front of the car, Edwin's daughter and the children in the back. It would be a break for all of them, but soon, with the children growing up, they might want to go to Spain, and then what was to be done about Edwin? He wouldn't like Spain, they decided. Perhaps he could go on holiday with one of the people from his office; that might be a solution to the problem.
Edwin hardly gave a thought to his working companions when he was away from them. It was only Marcia who came into his mind and that was in a rather curious way, when he was standing at the station bookstall before his train went, wondering whether he should buy something to read. He had already slipped down to Portugal Street to get that week's _Church Times_ but that might not last him the whole journey. There was a colourful range of magazines on the counter, some of which displayed the full naked breasts of young women, enticingly posed. Edwin looked at them dispassionately. He supposed that his wife Phyllis had once had breasts but he could not remember that they had been at all like this, so very round and balloon-like. Then he recalled Marcia and her operation – mastectomy, he believed it was called, Norman had told him at the time. That meant that she had had a breast removed, a deprivation for any woman, though he could not imagine that Marcia had ever been endowed quite so abundantly as the girls on the magazine covers. Still, one must feel compassion for her even though she was not at all a lovable person. Perhaps he should have dropped in that evening he found himself over the other side of the common, passing the road where she lived. He wondered if she ever went to the church with the locked door, if the vicar ever called to see her. She had never mentioned it but no doubt somebody from that church was keeping an eye on her and knew that she was the kind of person who liked to keep herself to herself and must not be organized in any way. Although Edwin was not of the school that regarded the church as an extension of the social services, he knew very well that it was the attitude of a number of very good people nowadays, conscientious and wellmeaning. It was very likely that Marcia would not be neglected, so there was no need to worry about her. There was certainly nothing he could do at this moment, standing on Victoria Station. So, turning away from the magazines that had reminded him of Marcia, he bought a copy of _Reader's Digest_ and dismissed her from his thoughts.
The church people did make a mild effort with Marcia and suggested that she might like to join a coach trip to Westcliff-on- Sea (' Much nicer than Southend, dear'), but she didn't seem to want to go and of course they couldn't force her. Janice Brabner also was concerned that she didn't seem to be getting a holiday and made various suggestions, none of which met with Marcia's approval. 'She's so _difficult_ ,' Janice complained to her friend, who was a medical social worker. 'People like that don't seem to want to be helped. And yet some of them are so grateful, it's lovely, really, makes it all worth while...' she sighed. Marcia certainly wasn't like that.
Yet Marcia did have two holiday treats in store, though she had no intention of revealing to anybody what these were. The first was a visit to out-patients at the hospital, where she was due for a check-up at Mr Strong's clinic. The time indicated on her card was 11.35, a funny sort of time, giving the impression that the appointments were calculated so exactly to the nearest five minutes that there would be none of the usual hanging about. She arrived at the hospital punctually, checked in at the appointments desk and sat down to wait. If you were too early you could read a magazine or get a cup of tea or coffee out of the machine and of course there was always a visit to the toilet. Marcia did none of these things but sat staring in front of her. She had chosen a seat away from the other people and she was annoyed when a woman moved up next to her and appeared to want to get into conversation. The people waiting did not talk to each other; it was like the waiting room in a doctor's surgery except that there was something more sacred about the vigil here, each person having 'something wrong'. Marcia did not respond when a remark was made about the weather, but continued to stare straight in front of her, fixing her eyes on a door that had a notice over it saying 'Mr D.G. Strong'. Next to it was another door where the notice said 'Dr H. Wintergreen'. It was impossible to tell which of the people sitting in the chairs were waiting for the surgeon and which for the physician; there did not appear to be any distinguishing marks, for even though they all seemed to be rather cowed, some even broken, they were of both sexes and all ages.
'You waiting to see Dr Wintergreen?' Marcia's neighbour persisted.
'No,' said Marcia.
'Oh, then you must be for Mr Strong. Nobody's gone into _that_ room for the last half hour, ever since I've been here. I'm waiting for Dr Wintergreen. He's a lovely doctor, foreign. I think he might be Polish. He's got ever such kind eyes, lovely. He always wore a carnation in his buttonhole when he came round the ward. He grows them himself, he's got a big house in Hendon. Digestive disorders, stomach, you know, that's his speciality and of course he's in Harley Street, too. Is Mr Strong in Harley Street?'
'Yes,' said Marcia coldly. She did not want to talk about Mr Strong, to discuss sacred matters with this person.
'Sometimes they get the Registrar to do the operation,' the woman went on. 'Still, they've got to learn haven't they, how to do it... ?'
At that moment the nurse called out Marcia's name and she knew that her turn had come. She was not so naive as to imagine that Mr Strong's name on the door was a guarantee of his presence in the room, so she was not unduly cast down when, having half undressed and lain down on a couch, she was examined by a golden-haired boy, a houseman doing his training in surgery. He prodded her in a highly professional manner, took her blood pressure and listened with his stethoscope. Of course he did not notice her new pink underwear but did comment admiringly on the neatness of her operation scar – Mr Strong's work, of course – and told her that she was too thin and ought to eat more. Yet he, just coming up to his twenty-fifth birthday, hardly knew what to expect of a woman in her sixties. Were they always as thin as this? Certainly his great aunt, the nearest equivalent he could think of, was not at all like Miss Ivory, though he had never seen her without clothes.
'I think perhaps somebody should keep an eye on you,' he said kindly, and Marcia was not at all offended or irritated as she was when the social workers and the church people implied the same thing, for hospital was different. She was quietly triumphant when she handed her card in at the appointments desk to arrange for a further check-up at some future date.
Marcia's second holiday treat was a visit to Mr Strong's house, or rather to view at a safe distance the house where he lived. She knew from the telephone directory that he functioned not only in Harley Street but also at an address in Dulwich, a district easily reached by her on a 37 bus.
She let a week elapse after her visit to the hospital – spacing out the treats – before setting out on a fine afternoon to see Mr Strong's house. The bus was nearly empty and the conductress kind and helpful. She knew the best stop for the road Marcia asked for, but when she had punched the ticket she seemed, like the woman at the hospital, to want to chat. They were lovely houses in that road – did Marcia know somebody who lived there or – for this seemed unlikely – was she perhaps going after a job there? It was dreadful, Marcia felt, the way so many people wanted to know one's business and, when she did not respond, to tell one about their own. She had to listen to quite a long story about husband and kiddies, categories she knew nothing about, but at last the stop was reached and she got out and walked along the road in the sunshine.
The house was imposing, as were its neighbours, just the kind of house that looked worthy of Mr Strong. There were shrubs in the front garden. Marcia imagined the laburnum trees and the lilacs in May, but now in early August there wasn't much to admire. Perhaps there were roses at the back, for the garden behind the house seemed extensive, but all she could see was a swing hanging from a massive old tree. Of course Mr Strong was a family man; he had children, and now they were all away at the seaside. The house seemed completely deserted which meant that Marcia could stand in the road gazing, noticing discreetly drawn curtains in a William Morris design. It went through her mind that there were no net curtains here, they did not seem to go with Mr Strong. Her thoughts were unformulated, it was enough just to stand. Afterwards she waited for over half an hour at the bus stop, unconscious of the delay, time passing and no bus. Eventually she reached home and made a cup of tea and boiled an egg. The young doctor at the hospital had told her she ought to eat more and she was sure Mr Strong would agree with that.
Next day she returned to the office, but when they asked her how she had spent her leave she was evasive, only saying that the weather had been good and she'd had a nice break, which was what people always said.
The first day of Norman's leave was brilliantly sunny, the kind of day for going to the country or the seaside or for walking hand in hand with a lover in Kew Gardens.
None of these ideas occurred to Norman when he woke up and realized that he did not have to go to the office that day. As there was plenty of time, he decided to have a cooked breakfast – bacon and eggs with all the trimmings, which for him meant tomatoes and fried bread – far more than his usual plate of cornflakes or All-Bran. And he would have it in his pyjamas and dressing gown, just like somebody in a Noel Coward play. If they could see me now! he thought, meaning Edwin, Letty and Marcia.
The dressing gown was a jazzy rayon satin, patterned with a design of maroon and 'old gold' geometrical shapes. Norman had bought it at a sale, thinking he might look good in it, that it might in some unspecified way 'do' something for him. He was willing to bet that Edwin had nothing like this, probably just an old plaid woollen thing that he'd had since school days. He was pretty sure that Letty would have something smart, frilly and all the rest of it, like the ladies he had seen when he'd visited Ken in hospital, but on Marcia's dressing gown he did not like to speculate. In a curious way he found himself sheering away from her and turning his thoughts to something else. In any case a shout from his landlady – some complaint about the smell of frying – soon brought him back to earth again.
Most of Norman's holiday was spent in this idle and profitless way. The truth was that he didn't really know what to do with himself when he wasn't working. In the last week he had to visit the dentist, to adjust his new plate and to practise eating with it. The dentist was a Yorkshireman and rather too jolly for Norman's liking, and although he was National Health Norman had to fork out quite a lot of money for a considerable amount of discomfort. Thank you for nothing! he thought bitterly. When he was reasonably confident of being able to attempt something more than soup or macaroni cheese, Norman went back to work. He had a few days leave still in hand. 'You never know when they might come in useful,' he said, but he felt that those extra days would never be needed, but would accumulate like a pile of dead leaves drifting on to the pavement in autumn.
# Six
Letty was not altogether surprised to get the letter from Marjorie saying that she was going to marry David Lydell. So much can change in such a short time especially, it would appear, if one is living in a village, though Letty didn't quite see why this should be so.
'David and I found that we were just two lonely people with so much to give each other,' Marjorie wrote.
Letty had not realized that her friend might have been lonely. Her life as a widow living in the country had always seemed so enviable, so full of trivial but absorbing doings.
'The vicarage is so uncomfortable,' the letter went on. 'There is a _great_ deal to be done there. And would you believe it, the estate agent tells me that I can ask (and get!) £20,000 for the cottage! Of course you will realize that there is only one slight worry and that is you, dear old Letty. It will hardly be possible (and I don't for a moment suppose you would wish it) for you to come and live with us at the vicarage when you retire. So it's occurred to me that you might like to take a room at Holmhurst where I _think_ there may well be a vacancy shortly (due to _death_ , of course!), only you must let me know soon because...' Here the letter went into further tedious detail, the upshot of it being that Marjorie could 'get Letty in' because she knew the woman who ran it. It was not by any means an old people's home because of course only selected applicants would be accepted, on a _personal_ recommendation...
Letty did not bother to read the last part of the letter very carefully. Marjorie went on with what seemed like girlish enthusiasm, but no doubt a woman in love, even if she is over sixty, feels no less rapturous than a girl of nineteen. Skimming over the final page, Letty learned that David was such a fine person; he had been so lonely and misunderstood in his last parish and some people in the village hadn't been too kind. Finally, they were so much in love that the difference in their ages ('I am of course some ten years older than he is') didn't make the slightest difference. Letty reflected that the difference must be nearer twenty years than ten but she was prepared to accept the fact of their love even if she could not understand it. Love was a mystery she had never experienced. As a young woman she had wanted to love, had felt that she ought to, but it had not come about. This lack in her was something she had grown used to and no longer thought about, but it was disconcerting, even a little shocking, to find that Marjorie was by no means beyond it.
Of course there was no question of her living at Holmhurst, a large red-brick mansion standing in wide lawns which she had often passed when she went to see Marjorie. She had once noticed an old woman with a lost expression peering through one of the surrounding hedges and that impression had remained with her. When her retirement day came, and it was not far off now, she would no doubt stay in her bed-sitting room for the time being. One could lead a very pleasant life in London – museums and art galleries, concerts and theatres – all those things that cultured people in the country were said to miss and crave for would be at Letty's disposal. Of course she would have to answer Marjorie's letter, to offer her congratulations (for surely that was the word) and to ease her conscience about the upsetting of the retirement plans, but not necessarily by return of post.
On her way home Letty noticed a barrow selling flowers near the Underground station. It occurred to her that she might buy a bunch for her landlady who had invited all the tenants to coffee that evening – not all-the-year-round chrysanthemums, but something small and unobtrusive like anemones or violets; but nothing of that sort was available and one could not buy the daisy-like flowers, dyed turquoise blue or red-ink pink, which were being offered as a bargain, so Letty walked on without buying anything. As she approached the house she was overtaken by Marya, the Hungarian who also lived there, carrying a bunch of the turquoisedyed flowers that Letty had rejected.
'So pretty,' she said enthusiastically, ' and only 10p. You remember, Miss Embrey has asked us to coffee, so I thought, one takes flowers.'
Letty now realized that Marya had got the better of her, as she often did, filling the bathroom with her dripping clothes and taking Letty's _Daily Telegraph_ in pretended mistake for her own lesser paper.
Miss Embrey lived on the ground floor and her three tenants – Letty, Marya and Miss Alice Spurgeon – came out of their rooms like animals emerging from burrows and descended the stairs at half past eight.
How aggressively nice and good her 'things' were, Letty thought, as she accepted a cup of coffee in Miss Embrey's Crown Derby. And now, it appeared, she was taking herself and these nice things to a home for gentlewomen in the country, perhaps the very home that Letty had decided to reject.
'My brother has arranged it all for me.' Miss Embrey smiled as she gave them this information, perhaps because she realized that none of her tenants had a man to arrange things for her. They were all unmarried women and no man had ever been known to visit them, not even a relative.
'Arthur has dealt with _everything_ ,' Miss Embrey stressed, and this included the house which was to be – indeed had already been – sold, with the tenants in it, quite a usual practice.
'And who is to be our new landlord?' Miss Spurgeon was the first to put their thoughts into words.
'A very nice gentleman,' said Miss Embrey in her mildest manner. 'He and his family will occupy the ground floor and basement.'
'It is a large family?' Marya asked.
'I understand a near relative may be sharing the accommodation with him. It is good to know that the ties of blood and kinship are still respected in some parts of the world.'
This led Letty to ask tentatively whether their new landlord was perhaps not English – a foreigner, if one could put it like that, and Miss Embrey was equally circumspect in her answer, implying that, in a manner of speaking, he was.
'What is his name?' Marya asked.
'Mr Jacob Olatunde.' Miss Embrey pronounced the syllables carefully, as if she had been practising them.
'He is black, then?' Again it was Marya, the Hungarian, who dared to ask the blunt question.
'Certainly his skin is not what is usually regarded as white, but which of us, for example, could say that we were white?' Miss Embrey looked round at her three tenants – Letty, with a pinkish skin, Marya, a sallow olive, Miss Spurgeon, parchment – all quite different. 'As you know, I have lived in China, so these distinctions of skin colour mean very little to me. Mr Olatunde comes from Nigeria,' she declared.
Miss Embrey sat back and folded her hands one over the other, those pale, useless hands exceptionally spotted with brown, and offered more coffee.
Only Marya, toadyish with her murmurs of 'such delicious coffee', accepted the offer. Miss Embrey smiled and poured her another cup. It was not the expensive blend of freshly ground beans that she would have offered to guests of her own choosing. Nor were the peculiar dyed flowers that Marya had pressed upon her the sort of decoration she would choose for her drawing room, so in a sense it was tit for tat.
'That is clear, then?' she declared, the chairman closing the meeting. ' Mr Olatunde will be your landlord from the Michaelmas quarter day.'
Afterwards there was talk on the stairs as the tenants went back to their rooms.
'We must remember that until very recently Nigeria was British,' said Miss Spurgeon. 'It was pink on the map. In some old atlases it still is.'
Letty felt that with the way things were going nothing was pink on the map any more. That night, as she lay in bed finding it difficult to sleep, the whole of her life seemed to unroll before her like that of a drowning man... is said to do, she thought, for of course her experience did not extend to drowning and it was unlikely that it ever would. Death, when it came, would present itself in another guise, something more 'suitable' for a person like herself, for where would she ever be likely to be in danger of death by drowning?
'It never rains but it pours,' said Norman the next morning when Letty had told them in the office about the new development in her retirement plans. 'First your friend getting married and now this – whatever next? There'll be a third thing, just you wait.'
'Yes, troubles do tend to come in threes, or so people say,' Edwin remarked. There was of course an undeniable interest and even unadmitted pleasure in the contemplation of other people's misfortunes, and for a moment Edwin basked in this, shaking his head and speculating on what the third disaster might be.
'Don't tell us you're getting married too,' said Norman jauntily. 'That might be the third thing.'
Letty had to smile, as she was meant to, at such a fantastic suggestion. 'No chance of that,' she said. ' But I can still go and live in the country if I want to. There's a nice house in the village where I could get a room.'
'An old people's home?' Norman asked, quick as a flash.
'Not exactly – you can have your own furniture there.'
'An old people's home where you can have your own furniture – your bits and pieces and treasures,' Norman went on.
'Of course you won't necessarily have to leave your room in London,' said Edwin. 'The new landlord may be a very good man. A lot of splendid West Africans come to our church and they do very well in the sanctuary. They have a great love of ritual and pageantry.'
This was cold comfort to Letty, for it was these very qualities that she feared, the noise and exuberance, all those characteristics exemplified by the black girl in the office which were so different from her own.
'Oh, she'll find their way of life so different,' said Norman, 'the cooking smell and that. I know about bedsitters, believe me.'
Marcia had so far contributed nothing to the discussion for there was a fear in her mind, even if it was not a very strong one, that she might have to offer Letty a room in her house. After all, Letty had always been kind to her; she had once offered to make her a cup of tea before going home, and even though the offer had not been accepted it had not been forgotten. But this did not mean that Marcia was under any obligation to provide accommodation for Letty in her retirement. For of course it would be impossible – she couldn't have anybody else living in her house. Two women could never share the same kitchen, she told herself, forgetting for the moment that she never really used the kitchen except to boil a kettle or make a piece of toast. Then there would be the difficulty of the store cupboard where Marcia kept her collection of tinned foods, and the special and rather unusual arrangement she had about milk bottles, not to mention the use of the bathroom and the arrangement of personal washing – the difficulties were insuperable. Women alone had to make their own way in the world and no doubt Letty already knew this. And if she couldn't cope there would be somebody like Janice Brabner coming round, asking personal questions, making stupid suggestions and inviting her to do things she didn't want to do. It certainly wasn't Marcia's duty to offer a home to Letty, just because she had a house of her own and lived by herself. Indignation welled up inside her, and she asked herself, why should I? But there was no answer to this question because nobody asked it. Nobody had even thought of it, let alone Letty herself.
'I'll wait and see what happens,' she said sensibly. 'After all, one doesn't want to go looking for new accommodation in August. It's not a very good time.'
'August is a wicked month,' said Norman, who had seen the phrase somewhere.
Not wicked so much as awkward, Edwin thought. August 15th – Feast of the Assumption, Solemn Mass 8 p.m. There might not be the full complement of servers, even with the splendid West Africans, and people were disinclined to attend an evening Mass at the end of a hot summer day. You'd have thought Rome would have chosen a more convenient time. But the Doctrine of the Assumption had been proclaimed about 1950, he believed, and church life in the Italy of twenty years ago was no doubt rather different from present-day practice in England in the seventies, even in a High Anglican church, where most of the population didn't go to church anyway and those that did might well be away on holiday. Some people thought Father G. went rather too far – 'way out' – in observing some of these so-called obligations, but of course Edwin would be there this evening, among the two or three gathered together, and that was the main thing.
'I may get on very well with Mr Olatunde,' Letty was saying, in a bright, brave tone. 'I certainly shan't do anything in a hurry.'
# Seven
Janice always had to nerve herself before going to see Marcia again. She wasn't like the other old ladies she visited, in fact the term ' old lady' didn't seem to describe her, yet she wasn't eccentric in a quaint or lovable way either. But there were always people like this – one had to regard it as a challenge, to try to get through to Marcia, to understand what went on in her mind.
Janice decided to choose Saturday morning rather than an evening for her next visit. People who worked were usually in on Saturday morning and with some, though not with Marcia, there might be the chance of a cup of coffee if one chose a suitable time. Still, she did open the door and that was something.
'How have things been with you?' Janice asked, stepping into the hall uninvited, but one must 'gain access', that was very important. 'Have you been managing your housework all right?' The dust on the hall table told its own story and the floor looked grey and gritty. Real nitty-gritty, Janice smiled at the fancy. But of course one mustn't smile – how _had_ she been coping? She wished Marcia would make some remark, however trite, instead of staring at her in that unnerving way. There was a shopping basket on a chair in the hall. This could be a talking point and Janice seized on it with relief.
'I see you've been shopping.'
'Yes. Saturday is my shopping day.'
This at least was encouraging, that she had a shopping day, just like any other woman. But what had she bought? Nothing but tinned food, it seemed. A word of tactful criticism and friendly advice was needed here. Fresh vegetables, even if only a cabbage, would be better than processed peas, and apples or oranges than tinned peaches. She ought to be able to afford suitable food, but perhaps she didn't want to eat sensibly, that was the annoying and irritating thing about the people one went to see. But of course she had been in hospital; she was still ' under the doctor', as the expression was. Didn't he ever enquire into her diet?
'I always like to have plenty of tinned foods in the house,' Marcia said in a rather grand manner when Janice tried to suggest that fresh food would be better for her.
'Oh, yes, of course. Tins are very useful, especially when you can't get out or don't want to go to the shops.' No point in going on to somebody like Marcia who obviously wouldn't be led or advised by anyone. Janice was getting to know that she was the kind of person one mustn't interfere with but just keep an eye on. It would be better not to make any comment on the housework or lack of it. Some people didn't like doing housework, anyway.
'Goodbye, then,' she said. 'I'll pop in again some time.'
When she had gone Marcia took her shopping bag to unpack it in the kitchen. Every week she bought some tins for her store cupboard and now she spent some time arranging them. There was a good deal of classifying and sorting to be done here; the tins could be arranged according to size or by types of food – meat, fish, fruit, vegetables, soup or miscellaneous. This last category included such unclassifiable items as tomato puree, stuffed vine leaves (this was an impulse buy) and tapioca pudding. There was work to be done here and Marcia enjoyed doing it.
Then, as the day was fine, she went into the garden and picked her way over the long uncut grass to the shed where she kept milk bottles. These needed to be checked from time to time and occasionally she even went as far as dusting them. Sometimes she would put out one for the milkman but she mustn't let the hoard get too low because if there was a national emergency of the kind that seemed so frequent nowadays or even another war, there could well be a shortage of milk bottles and we might find ourselves back in the situation of 'No bottle, no milk', as in the last war. As she moved among the bottles Marcia was irritated to discover one of an alien brand among the United Dairy bottles – 'County Dairies', it said. Wherever had that come from? She didn't remember noticing it before and of course the milkman wouldn't take it back – they only collected their own bottles. She stood with it in her hand, frowning at the effort of trying to remember where it could possibly have come from. Then it dawned on her. Letty had given her some milk one day at the office. She had been staying with that friend of hers in the country and had brought back a pint of milk, had drunk some of it for her lunch, then given the rest to Marcia. So that was it. Marcia felt suddenly annoyed with Letty for having foisted this alien bottle on her. She must be made to take it back.
Seeing her coming out of the shed with a milk bottle in her hand, Nigel, the young man next door, told himself that here was a chance to show neighbourly friendliness, as his wife Priscilla was always urging him to.
'Would you like me to cut your grass, Miss Ivory?' he asked, going to the fence. 'I've got the mower out.' Though really, seeing its length, a scythe would be more appropriate.
'No, thank you,' said Marcia politely, 'I prefer the grass as it is,' and went into the house. She was still feeling annoyed with Letty about the milk bottle. There was certainly no question of her offering Letty a room in her house now; that was not at all the sort of person one wanted under the same roof.
That evening Letty crouched in her room, listening. It wasn't even a rowdy party, these bursts of hymn-singing and joyful shouts, for Mr Olatunde, her new landlord, was a priest of a religious sect. 'Aladura,' Miss Embrey had murmured, but the name meant nothing, only the coming and going in the house and the noise. Now perhaps Letty really did feel like a drowning man, with the events of her past life unrolling before her, those particular events which had led her to this. How had it come about that she, an Englishwoman born in Malvern in 1914 of middle-class English parents, should find herself in this room in London surrounded by enthusiastic, shouting, hymn-singing Nigerians? It must surely be because she had not married. No man had taken her away and immured her in some comfortable suburb where hymn-singing was confined to Sundays and nobody was fired with enthusiasm. Why had this not happened? Because she had thought that love was a necessary ingredient for marriage? Now, having looked around her for forty years, she was not so sure. All those years wasted, looking for love! The thought of it was enough to bring about silence in the house and during the lull she plucked up the courage to go downstairs and tap – too timidly, she felt – at Mr Olatunde's door.
'I wonder if you could make a little less noise?' she asked. 'Some of us find it rather disturbing.'
'Christianity _is_ disturbing,' said Mr Olatunde.
It was difficult to know how to answer this. Indeed Letty found it impossible so Mr Olatunde continued, smiling, 'You are a Christian lady?'
Letty hesitated. Her first instinct had been to say 'yes', for of course one was a Christian lady, even if one would not have put it quite like that. How was she to explain to this vital, ebullient black man her own blend of Christianity – a grey, formal, respectable thing of measured observances and mild general undemanding kindness to all? 'I'm sorry,' she said, drawing back, 'I didn't mean...' What had she meant? Confronted by these smiling people she felt she could hardly repeat her complaint about the noise.
A handsome woman in a long brightly coloured dress and head tie stepped forward. 'We are having supper now,' she said. 'You will join us?'
Letty was reminded of Norman as a rich spicy smell was wafted towards her. She thanked the woman politely, saying that she had already eaten.
'I'm afraid you would not like our Nigerian cooking,' said Mr Olatunde, with a touch of complacency.
'No, perhaps not.' Letty withdrew, embarrassed by the crowd of smiling faces that seemed to be pressing in on her. We are not the same, she thought hopelessly. She wondered what Edwin and Norman and Marcia would have done in the circumstances, but came to no conclusions. Other people's reactions were unpredictable and while she could imagine Edwin entering into the religious aspect of the evening and even taking part in the service, it might well be that Norman and Marcia, usually so set in their isolation, would in some surprising way have been drawn into the friendly group. Only Letty remained outside.
# Eight
There had already been a good deal of talk in the office about Letty's situation and what she ought to do about it, and as time went on the question became more urgent, especially when Marya found a living-in job as housekeeper to a family in Hampstead, and Miss Spurgeon made arrangements to go into an old people's home.
'You'll be alone in the house now,' said Norman gleefully. 'It'll seem strange, won't it?' Perhaps this was the third misfortune he had prophesied, proving that disasters always went in threes.
'Your new landlord is a clergyman, isn't he?' said Marcia.
'Yes, in a manner of speaking.' Letty had a vision of Father Lydell leaning back in Marjorie's armchair, eyes closed, sipping Orvieto, so very different from Mr Olatunde. Obviously there were clergymen and clergymen, she thought. 'I wouldn't want to hurt his feelings,' she said, ' by anything I said about the people living in the house. He seems to be a very nice man.'
'Isn't there some friend you could live with?' Edwin suggested. 'Apart from the one who's getting married?' A woman like Letty must have many friends, a whole army of nice women like the wrvs or some – though not all – of the female congregation of his church. Surely there were plenty of such women? One saw them everywhere.
'The best thing is to have a relative,' said Norman. 'Then they're bound to do something for you. After all, blood is thicker than water, however distant the connection – you can bank on that.'
Letty considered some of her cousins, not seen since childhood, now living somewhere in the west of England. She could hardly expect any of them to offer her a home.
'Have you ever thought of taking a lodger?' Edwin asked, turning to Marcia.
'The money might be useful,' Norman chipped in, 'when you're retired.'
'Oh, I shan't need money,' said Marcia impatiently. 'There won't be any need for me to take in lodgers.' 'Unthinkable' was the word that came to her at Edwin's suggestion, the idea of offering a home to Letty, especially when she remembered that milk bottle. But Letty wouldn't like it either. Even now she was protesting, obviously embarrassed for Marcia as well as for herself.
'There are organizations and people wanting to help ladies,' said Edwin quaintly.
'There's a young woman who comes round to see me sometimes– seems to think I need help.' Marcia laughed in a mirthless way. ' It's the other way round, if you ask me.'
'But you have been in hospital,' Edwin reminded her. 'I expect that's why they like to keep an eye on you.'
'Oh, yes, but I go to Mr Strong's clinic for that.' Marcia smiled. 'I don't need young people telling me not to buy tinned peas.'
'Well, it's good to know that people do care,' said Letty vaguely, feeling that it might go rather beyond tinned peas. 'I expect something will turn up when I retire – after all, I haven't retired yet.'
'But you soon will,' said Norman, ' and you won't get much of a pension from here to add to what the state gives you. And then there's inflation to be considered,' he added unhelpfully.
'Inflation isn't exactly the kind of thing you can consider,' said Letty. 'It just comes on you unawares.'
'You're telling me,' said Norman, and delving in his pocket he produced the checkout payslip from his latest visit to the supermarket. 'Just listen to this,' and he proceeded to read it out. It was the increase in the prices of tinned soup and butter beans that seemed to anger him most, giving a strange insight into his daily diet.
Nobody commented or even listened. Marcia thought complacently of her well-stocked store cupboard and Letty decided she would have an early lunch and then take a bus to the Oxford Street shops. Only Edwin, perhaps seeing himself as a person wanting to help ladies, went on thinking about Letty and her problem.
All Saints' Day, the first of November, fell on a weekday. There was an evening Mass, quite well attended, and on the next Sunday Edwin was present at the ceremony of coffee and biscuits after the morning service of Parish Communion at a church he sometimes went to because he had once lived in the neighbourhood. It was not his regular church but he had chosen it especially with Letty in mind.
The making of coffee was in itself a ritual entrusted to various women members of the congregation, all of whom knew Edwin from his occasional visits to the church, and as he entered the hall, a bleak room garishly decorated by members of the youth club, he heard the voice of an old woman raised in a protest about biscuits.
'It is quite unnecessary to have biscuits with the coffee,' she said. 'A hot drink is all that anyone needs.'
'I like to have something to nibble with my coffee,' protested a little furry woman in a grey coat. ' We all know that Mrs Pope is wonderful for her age but the elderly don't _need_ much to eat. If it had been known beforehand that the biscuit tin was empty something could have been done about it – it could have been replenished – biscuits could have been bought.'
Into the middle of this controversy Edwin inserted himself with what seemed like a brutal attack. 'I believe one of you ladies has a spare room,' he declared.
There was silence, an awkward silence, Edwin felt, and both the women began to make excuses like the guests bidden to the marriage feast – the room was hardly more than a cupboard, it had all the things for the church bazaar in it, it might be needed for a relative. This last was the trump card but Edwin persevered. He had not thought out what he would do next, and he now realized that it might have been better if he had begun by describing Letty and outlining the nature of her problem, emphasizing her need for a room, so that consciences might be played upon and hearts touched. But how should he describe Letty? As a friend? She was hardly that and being a single woman might arouse gossip. A lady I know? That sounded too arch and coy. A woman who works in my office? Surely that would be best. The words woman, work, office, presented a reassuring picture of somebody of the preferred sex, who would be out all day and might even be a congenial companion on the occasions when she was in the house.
So Edwin went on, adopting a confidential tone, 'You see, it's like this. A woman who works in my office is in a difficulty. The house where she lives has been sold with the tenants in it and the new landlord and his family aren't quite what she's been used to, rather noisy, in fact.'
'Blacks?' asked Mrs Pope sharply.
'That's about the size of it,' Edwin admitted in a genial way. 'Mind you, Mr Olatunde is a very good man – a priest, in a manner of speaking.'
'How can he be a priest in a manner of speaking?' asked Mrs Pope. 'He must be either a priest or not a priest. There can be no qualification.'
'He is a priest of an African religious sect,' Edwin explained. 'And of course the services are not quite like ours – there's a lot of noisy singing and shouting.'
'And this woman – lady – she is that, I assume?'
'Oh, certainly. There would be no difficulty on that score,' said Edwin casually, feeling that Letty was in every way superior, if that was the criterion to be applied.
'She finds the noise too much where she is living?'
'Yes, she does, being a very quiet person herself.' That was something to be emphasized.
'Of course there _is_ my large back room, and it might be useful to have another person in the house.'
Edwin recalled that Mrs Pope lived alone.
'If one fell downstairs or tripped over a rug and was unable to get up...'
'You might lie for hours before anyone came,' said the little furry woman eagerly.
'One's bones are so brittle,' said Mrs Pope. 'A fracture could lead to serious complications.'
Edwin felt that they were getting off the point. He wanted the business to be settled, with Letty in the room. Of course Mrs Pope was old, but she was active and independent and he was sure that Letty, being a woman, would be very helpful in case of illness or accident. Now he could see the whole pattern emerging, with Letty's life governed by the soothing rhythm of the Church's year. All Saints' today, then All Souls'; everybody could share in the commemoration of the saints and the departed. Then would come Advent followed closely – too closely, it often seemed – by Christmas. After Christmas came Boxing Day, the Feast of St Stephen, hardly observed as such unless it happened to be one's patronal festival; then the Innocents, St John the Evangelist and Epiphany. The Conversion of St Paul and Candlemas (where one usually sang one of Keble's less felicitous hymns) were followed all too soon by the Sundays before Lent, but the evenings were drawing out. Ash Wednesday was an important landmark – evening Mass and the Imposition of Ashes, the black smudge on the forehead, 'dust thou art and to dust shalt thou return' – some people didn't like that, thought it 'morbid' or 'not very nice'.
'There _is_ a basin with hot and cold water in the room and she could use the bathroom occasionally. She wouldn't need a bath every night, would she?' Too much washing was bad for the skin, the constant immersion in hot water dried out the natural oils... Mrs Pope was coming round to the idea of Letty while Edwin was taking her through the Church's year, but he would hardly be able to answer questions about how often she would want a bath.
Everybody knew about Lent, of course, even if they didn't do anything about it, with Palm Sunday ushering in the services of Holy Week – not what they used to be, certainly, but there was still something left of Maundy Thursday, Good Friday and Holy Saturday with the ceremonies, the prelude to Easter Day. Low Sunday always seemed a bit of an anticlimax after all that had gone before but it wasn't long before Ascension Day and then Whit Sunday or Pentecost as it was properly called. After that you had Corpus Christi, with a procession out of doors if fine, and then Trinity Sunday, followed by all those long hot summer Sundays, with the green vestments and the occasional saint's day... That was how it had always been and how it would go on in spite of trendy clergy trying to introduce so-called up-to-date forms of worship, rock and roll and guitars and discussions about the Third World instead of Evensong. The only difficulty was that Edwin wasn't at all sure that Letty ever went to church. She had never mentioned it when he talked about such things in the office. Still, when she was settled in Mrs Pope's back room and when she had retired, there was no knowing how her life would change.
# Nine
' So you are Miss Crowe.' It was not the most friendly greeting, Letty felt, but there was nothing for it but to repeat that she was indeed Miss Crowe and to assume that the woman peering through the barely opened door must be Mrs Pope. And why should she have expected friendliness when the relationship between them was to be that of landlady and tenant? Friendliness was by no means to be taken for granted. Obviously she should have expected little in the way of warmth, with the taxi taking her what seemed so very far north, though the postal address was only NW6.
It was not long before Christmas – St Lucy's Day, Edwin had reminded her, though the saint seemed to have no particular significance for the move. Norman, of course, made much of it being the shortest day. 'Get there in good time,' he advised. 'You don't want to be wandering about in a strange district after dark.'
'One has to be careful,' Mrs Pope went on, opening the door a little wider. 'There are so many impostors these days.'
Letty had to agree, though she felt that Mrs Pope was not the sort of person to be taken in by an impostor. While Edwin's impression and description of her had been merely that of a woman in her eightieth year who was 'wonderful for her age', Letty now saw that she was an imposing figure with noble almost Roman features and a mass of thick white hair, of the kind that is sometimes described as 'abundant', arranged in an elaborate oldfashioned style.
After the vitality and warmth of Mr Olatunde's house Mrs Pope's seemed bleak and silent, with its heavy dark furniture and ticking grandfather clock, the kind of tick that would keep one awake until one got used to it. Letty was shown the kitchen where she could prepare her meals and a cupboard where she could keep her food. The bathroom and lavatory were indicated with gestures, being not the kind of rooms into which one would show people. The lavatory window, Letty saw when she went in, looked out on to back gardens, with blackened stumps on the frosty earth, and beyond them the railway, where trains rattled by in a kind of hinterland which marked their first emergence from the Underground. Not really the kind of district where one would choose to live, but of course it was only temporary and 'beggars can't be choosers', as Norman lost no time in reminding her.
The room itself was quite pleasant, sparsely furnished, which was a good thing, and there was a basin with hot and cold water, as Edwin had said. Letty felt like a governess in a Victorian novel arriving at a new post, but there would be no children here and no prospect of a romantic attachment to the widower master of the house or a handsome son of the family. Her own particular situation had hardly existed in the past, for now it was the unattached working woman, the single 'business lady' of the advertisements, who was most likely to arrive in the house of strangers. Letty had often found herself doing this, arranging her clothes in the drawers and wardrobe provided and putting out her personal possessions, the things that might give some clue as to what sort of person she was. There were her books – anthologies of poetry, though nothing later than _Poems of Today. Second Series_ – her current library book; her transistor radio, a bowl of hyacinths nearly in flower, her knitting in a flowered cretonne bag. There were no photographs, not even of her friend Marjorie or of her old home, her parents, a cat or a dog.
At least Mrs Pope was leaving her to herself this first evening, Letty thought, as she prepared a poached egg on toast in the silent kitchen. Later, as she lay in bed, unable to sleep on her first night in a strange bed that would soon become as familiar as her own body, she realized that she had taken action, she had made the move, she had coped. In the sleepless hours she heard footsteps on the landing and a sudden thump. Supposing Mrs Pope had a fall? She was an elderly person and heavy – lifting her would be difficult. Letty hoped she wasn't going to have to do that kind of coping, but eventually she fell asleep and heard nothing more.
Next morning in the office there was an air of expectancy, almost of excitement. They all wanted to know how Letty had got on in her new room. Edwin had a proprietary attitude towards the move – after all, he was entitled to it as he had found the room for her, and the others felt that he had done something pretty good in, as it were, delivering her from Mr Olatunde. 'I only hope it won't be a case of frying pan into fire,' Norman observed. 'You must watch out that you don't get landed with an elderly person and all _that_ entails.'
'Oh, Mrs Pope is very independent,' Edwin said quickly. 'She's a member of the parochial church council and a very active one.'
'That's as may be,' said Norman, ' but it doesn't necessarily follow that she's got perfect control over her legs – she might fall, you know.'
'Yes, that thought came to me in the night,' said Letty, 'but it might happen to anyone. We could all fall.'
Nobody seemed inclined to go into the deeper implications of what Letty had just said, but Edwin repeated now what he had thought when he first broached the subject to Mrs Pope. 'Oh, a woman can deal with these things easily enough,' he reminded Norman in a rather sharp tone. 'There's no need to make the kind of fuss you or I would make if we were faced with such a situation.'
'Equal opportunities!' said Norman. ' That's one of the things we men prefer to leave to the ladies. Anyway, what is one's responsibility in that kind of thing – answer me that?'
'Just the ordinary responsibility of one human being towards another,' said Letty. 'I hope I should do whatever was best.'
'But sometimes it's unwise to move a person who has fallen,' Norman persisted. 'You could do more harm than good.'
'You should ring for the ambulance,' said Marcia, making her first contribution to the discussion. 'The ambulance men know what to do. Are you able to use the kitchen when you want to?' she went on, still feeling the very smallest tinge of guilt at not having offered to take in Letty herself, but of course, as she repeatedly told herself, it would _not_ have done. And once again she had forgotten to bring that milk bottle to the office.
'Yes, that seems to work all right. I cooked supper and breakfast– there's an electric cooker and I'm used to that, and plenty of room for me to keep my own things.'
'It's so important to have plenty of room for tins,' said Marcia. 'You should insist on that. You wouldn't want to keep everything in the room where you sleep.'
'I have to keep everything in the one room,' said Norman.
'Well, beggars can't be choosers, as you're so fond of reminding us,' said Edwin. 'I only hope this move will turn out to be a good thing,' he added. 'I shall feel responsible for it if anything goes wrong.'
'You mustn't feel that,' Letty reassured him. 'It's up to oneself, to adapt to circumstances.'
'Up to you to make a go of it,' said Norman chirpily. 'That's the ticket.'
Mrs Pope waited until Letty had left the house before she went upstairs from her ground-floor sitting room. She will walk down to the bus stop or take the Underground, she thought, as she entered Letty's room, knowing that she would not be back before half past six.
Letty had not asked for a key to the room and Mrs Pope felt that she had a duty to see that everything was in order. It would also be just as well to judge from her possessions what kind of a person her new lodger was.
The first thing that struck Mrs Pope was tidiness and order. This was a slight disappointment for she had hoped to find interesting things lying about in the room. Naturally she would expect somebody recommended by Mr Braithwaite – she did not think of him as ' Edwin' – to be respectable, even a churchwoman, but she was surprised to find that there was no devotional book on the bedside table, not even a Bible, just a novel from the Camden library. Mrs Pope would have respected a biography but she was not interested in novels and did not give the book a second glance. Turning her attention to the washbasin she noted talcum powder and deodorant, a jar of skinfood and a tube of Steradent tablets besides toothbrushes and paste and a new flowerpatterned face flannel. The little cupboard over the basin held only aspirins and vegetable laxative tablets, no exotic drugs of any kind, though she might well carry tablets in her handbag. The dressing table had a selection of cosmetics on it, all neatly ranged. Glancing over her shoulder towards the door, Mrs Pope opened the top drawer. It contained several neatly folded pairs of stockings or tights, gloves, scarves and a small leather jewel box. In the jewel box were a small string of pearls, obviously not real, two or three strings of beads, a few pairs of earrings and two rings, one gold with a half-hoop of small diamonds (her mother's engagement ring?), and the other a cheap butterfly-wing in a silver setting. Nothing of value or interest there, Mrs Pope decided. The chest of drawers held underwear, immaculately clean and folded, and jumpers and blouses, equally neat and clean. The contents of the wardrobe were more or less what might have been expected from the rest of the room and Mrs Pope did no more than glance at the hanging dresses, suits and skirts. There was a trouser suit, too, the kind of thing women of Letty's age had taken to wearing, and that too was as respectable and appropriate as the rest of the garments. Only one item caught Mrs Pope's eye, a rather gaily patterned cotton kimono, which seemed not to be in character with the rest of Miss Crowe's things. Had it perhaps been a gift from somebody in the mission field, a relative out there? There were some things one could hardly ask but no doubt she would see Miss Crowe coming out of the bathroom wearing it one day. Dissatisfied, Mrs Pope went downstairs again. The most one could say, and it seemed hardly enough, was that Miss Crowe seemed to be the ideal lodger or at least nothing could be gleaned to the contrary.
# Ten
# 'Christmas comes but once a year,
And when it comes it brings good cheer. . .'
Norman recited the tag with a touch of sarcasm in his voice. Nobody disputed the fact or took exception to his tone, for Christmas is a difficult time for those who are no longer young and are without close relatives or dependents, and each one in the office was thinking of the particular trials and difficulties the so-called festive season would bring with it. Only Edwin would be spending Christmas in the traditional and accepted way in his role as father and grandfather. 'Christmas is a time for the children,' people were apt to say, and he was prepared to accept this and go along with it, though he would much have preferred to spend the festival alone at home, with no more than a quick drink with Father G. between services to mark the secular aspect of the occasion.
Norman himself had been invited to eat his Christmas dinner with his brother-in-law Ken and his lady friend, the woman who was presumably to replace his dead wife, Norman's sister. 'After all, he has nobody,' they said, as they had when they allowed Norman to visit Ken in hospital. 'Might as well help them get through their turkey,' was the way Norman regarded the invitation, and as there was no public transport on that day Ken would call for him and bring him back by car so there would be no difficulty there. The hated motor car did occasionally have its uses.
It was the women – Letty and Marcia – who were the real worry, or 'posed something of a problem', as Janice Brabner put it. They had no relatives they could spend Christmas with and the season had for many years now been an occasion to be got through as quickly as possible. Letty had often spent the holiday with her friend in the country but this year Marjorie had Father Lydell, for ever fixed in Letty's memory as leaning back in a comfortable chair sipping an appropriate wine, no doubt a burgundy or even a mulled claret to suit the season, but whatever it was she felt she would be an intruder this year and in any case no invitation had been forthcoming. In this lack Letty was conscious of Marjorie's embarrassment at having to withhold it, so the season would not be one of unmixed happiness and relaxation for Marjorie either. In war there are no victors, as the saying went, and inappropriate though the idea might be there was still something applicable in it.
Marcia worried less about Christmas as the years went on. When her mother had been alive it had been a quiet time, marked only by the cooking of a larger than usual bird – their butcher usually recommended 'a nice capon' as being suitable for two ladies spending Christmas alone – and the provision of special food as well as titbits from the bird for Snowy, the old cat. After her mother's death Snowy had been enough company for Marcia, and when he had gone there was no special point about Christmas Day and it tended to merge into the rest of the holiday until it was no different from any other part of it.
'We must do something about Miss Ivory.' Nigel and Priscilla were agreed on that. Christmas was the time for 'doing' something about old people or 'the aged', as the nobler phrase described them, though that, in Priscilla's mind, conjured up pictures of tiny frail oriental ladies rather than people like Miss Ivory.
'It's the loneliness that's the worst part – or so one hears,' Priscilla said. 'The poor souls just long for somebody to talk to.' One evening she had met Janice Brabner trying to call on Marcia but getting no answer to her ringing and knocking. 'No joy whatsoever,' as she put it, though 'joy' was hardly the word. Janice was going away for Christmas and was worried about Marcia, so Priscilla had promised to keep an eye on her, even to ask her in for a meal, and what more suitable occasion than the turkey on Christmas Day?
Nigel had been a bit doubtful about this. ' She isn't all that old,' he had objected. 'She's independent enough to go out to work even though she's so odd. I suppose it would be kind to ask her but I can't quite see her fitting in with your grandparents.'
'Perhaps she'll refuse the invitation,' said Priscilla, 'but I feel I must ask her.'
'She didn't want me to cut her lawn that time when I offered,' said Nigel hopefully.
'But Christmas is a bit different,' Priscilla said, and evidently this was what Marcia felt too for she even managed to smile when she was asked.
Of course the grandparents were terribly nice to her, so thankful were they not to be the kind of old people who needed to have something 'done' about them. Priscilla's grandmother was so elegantly pink and white, with her beautifully coiffed hair and neat, pastel-coloured clothes, such a contrast to Marcia, with that crudely dyed hair and a peculiarly awful dress in a most unbecoming shade of bright blue. The grandparents led such useful and busy lives in their retirement in Buckinghamshire – every day for them was so full and interesting and their stay with Priscilla in London would be filled with worthwhile activities, visits to theatres and art galleries. What did Marcia _do_ , or rather what would she do when she retired next year? One hardly liked to speculate and the question, politely and kindly put, brought forth the sort of answer that got one nowhere. Nor did Marcia really do justice to the traditional Christmas fare. The discovery that she didn't drink had cast the first slight gloom on the proceedings and the hope that she would eat well was disappointed by the way she left most of her small helping on the side of her plate. She murmured something about being a very small eater but Priscilla thought she might at least have had the manners to make a show of eating when so much trouble had been taken. But then that was what Janice had warned her about – these people weren't necessarily rewarding, one just had to plod on. Perhaps it would have been easier if Marcia had been that much older, really _ancient_.
After lunch they sat round the fire for coffee and chocolates were handed round. Everyone felt comfortably sleepy and would have liked to flop down and close their eyes, but the presence of Marcia was inhibiting. It seemed impossible to drop off with that beady glance fixed on them. They were all relieved when she suddenly got up and said she must go.
'How will you spend the rest of the holiday?' Priscilla asked, as if she were determined to punish herself further. 'Have you something arranged for Boxing Day?'
'Boxing Day?' Marcia did not seem to understand what was meant by Boxing Day, but after a pause she declared rather grandly, 'We who work in offices do value our leisure time, so we don't need to make elaborate plans,' and of course everyone had to respect this, while thankful that they need not do anything more about her Christmas.
Next day Marcia rose late and spent the morning tidying out a drawer full of old newspapers and paper bags, something she had been meaning to do for a long time. Then she checked the contents of her store cupboard but did not eat anything until the evening when she opened a small tin of pilchards. It was one left over from Snowy's store, so it was not really breaking into her reserves. She had heard or read somewhere that pilchards contained valuable protein, though this was not the reason why she had opened that particular tin. She did not even remember that the young doctor at the hospital had told her that she ought to eat more.
Letty had made up her mind to face Christmas with courage and a kind of deliberate boldness, a determination to hold the prospect of loneliness at bay. It wasn't really as if she minded being alone for she was used to it; it was rather the idea that people might find out that she had no invitation for the day and that they would pity her. She endured the newspaper articles and radio programmes pandering to the collective guilt-feeling of those who were neither old nor lonely nor fortunate enough to have an odd relative or neighbour they could invite into their homes at Christmas, telling herself that at least she needn't feel guilty at this festive season. Marjorie seemed to have none of these feelings either, Letty reflected, for she had made no mention of Letty joining her for Christmas, and had sent her card and present (bath foam and hand cream done up in a fancy package) particularly early, so that there could be no misunderstanding on that score. I wouldn't have wanted to go there anyway, Letty told herself stoutly, not with David Lydell there. Even with the heavy load of Christmas services he would no doubt find plenty of time to be with his fiancée and, remembering the picnic, Letty did not fancy herself in the role of gooseberry.
Letty therefore prepared to spend Christmas alone, for she understood that Mrs Pope would be going to stay with her sister who lived in a village in Berkshire. But at the last minute there was a change of plan, various telephone calls were made, and in the end Mrs Pope announced that she was not going away after all. The change of plan was the result of an argument about heating, Mrs Pope's sister apparently being too mean to switch on the storage heaters before January, and the cottage being not only cold but damp and poky as well.
'I shall _not_ go, neither now or _ever_ ,' Mrs Pope declared, standing militant by the telephone in the full dignity of her eighty-odd years.
'Warmth is so important,' Letty said, remembering the office conversations about hypothermia.
'Have you anything special for your Christmas dinner?' Mrs Pope then asked.
It had not occurred to Letty that Mrs Pope might suggest any kind of festive sharing or pooling of resources, for they had not so far eaten together, though they had met in the kitchen preparing their individual breakfasts and suppers. She did not at first like to admit that she had bought a chicken, for it seemed almost brutish to contemplate eating even the smallest bird all by herself, but when she realized what was in Mrs Pope's mind she had to confess.
'I have some ham and a Christmas pudding, one I made last year, so it will be best if we have our meal together,' Mrs Pope said. 'It is ridiculous to think of two women in the same house eating separate Christmas dinners. Not that I really make any difference in what I eat at Christmas – it's most unwise for old people to gorge themselves at any time.'
So Letty had no alternative but to listen to Mrs Pope discoursing on her favourite topic of the excessive amount of food most people ate. It was not conducive to an enjoyable meal and Letty could not help feeling that on this occasion she might have done better if she had stayed in her room in Mr Olatunde's house. A jolly Nigerian Christmas would surely have included her, and not for the first time she began to wonder if she had done the right thing by moving. Still, Christmas Day had been lived through and was now nearly over, that was the main thing.
The radio offered a choice of comedy, with a braying studio audience, which she did not feel in the mood for, or carols, with their sad memories of childhood and the days that can never come back. So she took up her library book and sat reading, wondering what sort of a Christmas the others in the office had spent. Then she remembered that the Kensington sales started the day after Boxing Day and her spirits suddenly lifted.
'Pushing the boat out, aren't you?' said Norman, with unusual jollity, as Ken topped up his glass.
'Well, I always think a really good meal like the one we've just eaten deserves all the trimmings,' Ken said.
'I only hope you're not going to suffer for it.' Norman could hardly resist casting this small gloom on the festivities. After all, the last time he'd seen Ken he'd been lying prone in the men's surgical ward, feeling pretty sorry for himself. But now he seemed to have fallen on his feet all right with this girlfriend – Joyce her name was, shortened to Joy – who was not only quite goodlooking and an excellent cook but had a bit of money of her own and had even passed the test of the Institute of Advanced Motorists, whatever that might mean. So Ken had good reason to push the boat out.
Still, let them get on with it, all lovey-dovey at the kitchen sink doing the washing-up, Norman thought, sitting by the fire, as they had insisted when he made a half-hearted offer of help.
'You put your feet up,' Joy said. 'Have a bit of a rest – after all, you're one of the world's workers.'
Norman supposed they all were, come to that, though he and Ken spent most of their working life sitting down anyway, Ken stuck in the passenger seat of a car on test and he, Norman, at his desk doing damn all. Still, he wasn't averse to a bit of a rest, especially after a good meal, and it was always nice to see a coal fire and not to have to worry about having the right coins for the meter.
'Where exactly does he live?' Joy was saying, her pink rubbergloved hands plunged in the washing-up water.
'Norman? Oh, he's got a bedsitter – Kilburn Park way.'
'On his own all the time, is he? It must be a bit lonely.'
'Lots of people live on their own,' Ken pointed out.
'Still, at Christmas... it does seem sort of sad.'
'Well, we're having him here today, aren't we? I don't see what more we can do.'
'You've never thought of sharing?'
' _Sharing?_ You have to be joking!'
'Oh, I don't mean _now_. But when your wife, when Marigold...' Joy brought out the name tentatively for she could never get used to it or believe that Ken's wife had really been christened so, 'when she passed on and you were left on your own...'
Ken waited in grim silence. Let her put into words what she was thinking, that he might have asked Norman – the brother-inlaw with whom he hadn't a thing in common apart from having been married to his sister – to come and live in his house, was that it? Imagine sharing a house with Norman! The very idea of it was enough to give him the creeps, and thinking about how it might be made him smile, even want to laugh, so that the grim silence was relaxed and he playfully flicked a tea towel at his intended second wife.
Larking about in the kitchen, Norman thought, hearing the sound of laughter, but he wasn't really envious, his attitude being 'sooner him than me'. When Ken had deposited him on his doorstep from his brand new buttercup-yellow motor car, Norman returned to his bed-sitting room – quite well satisfied with his lot. This Christmas had certainly brought a bit of good cheer, but today's jollifications had been enough for him and he quite looked forward to getting back to the office and hearing how the others had got on.
In the train coming back from staying with his daughter and her family, Edwin felt drained and exhausted, but relieved. They'd wanted him to stay longer, of course, but he'd pleaded various pressing engagements, for after Christmas Day, with a somewhat inadequate 'Family Communion' as the main service (no High Mass), and Boxing Day with a surfeit of cold turkey and fractious children, he felt he'd had enough. His son-in-law dropped him at the station while the family went on to a pantomime where they were to be joined by the other grandparents and another lot of children. All a very jolly family party but not exactly his 'scene', as Norman might put it.
Taking out his diary, Edwin considered the days after Christmas. Today, December 27th, was St John the Evangelist and there should be a good High Mass this evening at St John's over the other side of the common – it was their patronal festival, of course, and the priest there was a friend of Father G.'s. Then there was the day after, December 28th, Holy Innocents – he'd try to get over to Hammersmith for that. People didn't seem to realize what a lot there was going on after Christmas, quite apart from the day itself.
# Eleven
The first day they were back in the office was the second of January. None of them had really needed New Year's Day to recover from the celebrations of the night before because none of them had been to a party, but there had always been grumblings when in the past they had been obliged to work on the day. Now, of course, the extended holiday had seemed a little too long and they were all glad to be back to work.
'Or what passes for work,' as Norman remarked, tilting back in his chair and drumming his fingers on his empty table.
'It's always a bit slack at this time,' Letty said. 'One tries to get things done before Christmas.'
'To clear one's desk,' said Marcia importantly, using a phrase from long ago that had little or no reality in their present situation.
'And when you get back there's nothing on it,' said Norman peevishly. He was bored now that the first interest of hearing about other people's Christmases had evaporated.
'Well, this has come in,' said Edwin, holding up a cyclostyled notice. He passed it to Norman who read it out.
'A Memorial Service for a man who retired before we came,' he said. 'What's that got to do with us?'
'I didn't know he'd died,' said Letty. 'Wasn't he once chairman?'
'It was in _The Times_ ,' Edwin pointed out. 'One feels that perhaps this department ought to be represented.'
'They couldn't expect that if nobody knew him,' said Marcia.
'I suppose they'd send round a notice in case anybody wanted to go,' said Letty in her usual tolerant manner. 'After all, there might be some who'd worked with him.'
'But it's today,' said Norman indignantly. 'How could we go today, at such short notice? What's going to happen to the work?'
Nobody answered him.
'Twelve noon,' Norman read out scornfully. 'I like that! What do they think we are?'
'I think I shall go,' said Edwin, looking at his watch. 'I see it's at the church used by the university – rather a suitable setting for a Memorial Service for an agnostic.'
'I suppose you know the church, you've been there before?' Letty asked.
'Oh, yes, I know it all right,' said Edwin casually. 'Pretty undenominational, you might say. They have to cater for all sorts there, but I suppose there'll be somebody who knows what to do.'
'Let's hope so! Unless you feel like taking the service yourself,' said Norman sarcastically. He was irritated at Edwin taking what seemed to him like an unfair advantage, though where the advantage lay he could hardly have said.
The church was still decorated for Christmas, with stiff-looking poinsettias and sprigs of holly on the window ledges, but an expensive florist's arrangement of white chrysanthemums had been placed at the side of the altar, as if to emphasize the dual purpose of the church's present function.
Memorial services were not much in Edwin's line, particularly not when they commemorated persons with whom he had little or nothing in common. It wasn't as if they were like funerals, of which he had experienced his fair share – father, mother, wife and various in-law relatives. And it wasn't as if this was a proper Requiem Mass, more like a social gathering, with the smartly dressed women in hats and fur coats and the dark-suited men in good, heavy overcoats. They seemed very far removed from the little huddle of mourners Edwin associated with funerals he had attended. Of course the time of mourning had passed and this service was being held to celebrate the deceased's life and achievements, so there was a difference. Another noticeable difference was the warmth of the church on this January day. Reassuring wafts of hot air circulated round Edwin's feet and he noticed the woman in front of him loosening the collar of her fur coat.
The hymns chosen were 'He who would valiant be', and another with modern words that might seem to have been specially written so as not to offend the most militant agnostic or atheist, set to a tune that nobody seemed to know. There was a reading from Ecclesiastes and a short eulogy, delivered by a younger colleague of the deceased, quietly triumphant in the prime of life. Edwin had seen this person once or twice at the office, so he felt that his presence at the service was justified. After all, he was representing Norman, Letty and Marcia, and that was entirely fitting.
As he filed out with the congregation, Edwin noticed that some of them, instead of going out through the church door, seemed to be slipping into a half open side door into a kind of vestry. Not everyone was doing this, so it looked as if those who did were in some way favoured and Edwin soon saw why this was. Inside the vestry he glimpsed a table on which were ranged glasses of a drink that looked like sherry (it would hardly have been whisky, he felt). It was easy for Edwin to insinuate himself among the slippers-in and nobody questioned him; he looked very much the kind of person who had the right to be there, tall, grey and sombre.
Taking a glass of sherry – there was a choice of medium or dry, sweet evidently not having been considered appropriate to the occasion – Edwin looked around him, storing up impressions to tell them back in the office. His own observations took in the usual paraphernalia of the Anglican church that made this vestry much like any other of his experience – flower vases and candlesticks, an untidy pile of hymn books with the covers torn and no doubt pages missing inside, and a discarded crucifix of elaborate design, probably condemned by the brass ladies as impossible to clean. A crisp-looking terylene surplice was suspended from a hook on a cleaner's wire hanger and there were red cassocks and a few dusty old black ones hanging on a rail. But these details would probably not interest Norman, Letty and Marcia. They would want to know who was at the service and how they were behaving, what they were saying and doing.
'Well, at least we've given him some kind of a send-off,' said an elderly man at Edwin's side, 'and I think he'd like to think of us here drinking sherry.' He put down his empty glass and took another.
'People always say that,' said a woman who had joined them. 'And it's certainly convenient to suppose that anything we do is what _they_ would have liked. But Matthew never entered a church in his life, so perhaps the drinking would be all he'd approve of.'
'I expect he was baptized and attended church when he was young,' Edwin observed, but the others moved away from him, making him feel that he had gone too far, not only by this observation but by attending the service at all. Yet he was undeniably a member of the staff, even if only a humble one, and had as much right as anyone to be paying his tribute to a man he had never known personally.
Edwin drained his glass and put it down carefully on the table. He noticed that it had been covered with a white cloth and wondered idly if it was of ecclesiastical significance. He decided not to help himself to another glass although he could easily have done so. It might not be fitting. Also a thing like that 'might get back' – you never knew.
Now the problem of lunch presented itself. Edwin had a sandwich in the office but he was not quite ready to face the others, so decided to go to a coffee house in Southampton Row, where he sat brooding in a curtained alcove, drinking strong Brazilian coffee.
A pair of lovers sat opposite him but he did not notice them. He was thinking about his own funeral – he would hardly rate a 'Memorial Service' – a proper Requiem, of course, with orange candles and incense and all the proper ceremonial details. He wondered if Father G. would outlive him and what hymns he would choose... A clock struck two and he realized that he ought to be getting back.
Norman looked up sourly as Edwin entered the room. Something had apparently 'come up' and Norman was having to deal with it.
'Nice work if you can get it – going to a Memorial Service at twelve and staying out three hours,' Norman commented.
'Two hours, twelve minutes,' said Edwin, consulting his watch. 'You could have come too if you'd wanted to.'
'Was it a beautiful service?' Letty asked. As an infrequent churchgoer she had the impression that services of this type were always beautiful.
'I wouldn't say that exactly,' said Edwin, hanging up his overcoat on a peg.
Marcia caught a mingled whiff of coffee and alcohol as he passed her to go to his table. 'What've you been up to?' she asked, but did not expect an answer.
# Twelve
The organization where Letty and Marcia worked regarded it as a duty to provide some kind of a retirement party for them, when the time came for them to give up working. Their status as ageing unskilled women did not entitle them to an evening party, but it was felt that a lunchtime gathering, leading only to more than usual drowsiness in the afternoon, would be entirely appropriate. The other advantage of a lunchtime party was that only medium Cyprus sherry need be provided, whereas the evening called for more exotic and expensive drinks, wines and even the occasional carefully concealed bottle of whisky or gin – 'the hard stuff', as Norman called it, in his bitterness at being denied access to it. Also at lunchtime sandwiches could be eaten, so that there was no need to have lunch and it was felt by some that at a time like this it was 'better' to be eating – it gave one something to do.
Retirement was a serious business, to be regarded with respect, though the idea of it was incomprehensible to most of the staff. It was a condition that must be studied and prepared for, certainly – 'researched' they would have said – indeed it had already been the subject of a seminar, though the conclusions reached and the recommendations drawn up had no real bearing on the retirement of Letty and Marcia, which seemed as inevitable as the falling of the leaves in autumn, for which no kind of preparation needed to be made. If the two women feared that the coming of this date might give some clue to their ages, it was not an occasion for embarrassment because nobody else had been in the least interested, both of them having long ago reached ages beyond any kind of speculation. Each would be given a small golden handshake, but the state would provide for their basic needs which could not be all that great. Elderly women did not need much to eat, warmth was more necessary than food, and people like Letty and Marcia probably had either private means or savings, a nest-egg in the post office or a building society. It was comforting to think on these lines, and even if they had nothing extra, the social services were so much better now, there was no need for anyone to starve or freeze. And if governments failed in their duty there were always the media – continual goadings on television programmes, upsetting articles in the Sunday papers and disturbing pictures in the colour supplements. There was no need to worry about Miss Crowe and Miss Ivory.
The (acting) deputy assistant director, who had been commanded to make the presentation speech, wasn't quite sure what it was that Miss Crowe and Miss Ivory did or had done during their working lives. The activities of their department seemed to be shrouded in mystery – something to do with records or filing, it was thought, nobody knew for certain, but it was evidently 'women's work', the kind of thing that could easily be replaced by a computer. The most significant thing about it was that nobody was replacing them, indeed the whole department was being phased out and only being kept on until the men working in it reached retirement age. Yet under the influence of a quick swig of sherry, even this unpromising material could be used to good effect.
The deputy assistant director stepped into the middle of the room and began to speak.
'The point about Miss Crowe and Miss Ivory, whom we are met together to honour today, is that nobody knows exactly, or has ever known exactly, what it is that they do,' he declared boldly. 'They have been – they are – the kind of people who work quietly and secretly, doing good by stealth, as it were. Good, do I hear you ask? Yes, good, I repeat, and good I mean. In these days of industrial unrest it is people like Miss Ivory and Miss Crowe' – the names seemed to have got reversed, but presumably it didn't matter – 'who are an example to us all. We shall miss them very much, so much so that nobody has been found to replace them, but we would be the last to deny them the rewards of a wellearned retirement. It gives me much pleasure on behalf of the company and staff to present each of these ladies with a small token of our appreciation of their long and devoted service, which carries with it our best wishes for their future.'
Letty and Marcia then came forward, each to receive an envelope containing a cheque and a suitably inscribed card, the presenter remembered a luncheon engagement and slipped away, glasses were refilled and a buzz of talk broke out. Conversation had to be made and it did not come very easily once the obvious topics had been exhausted. As the party went on, people divided most easily into everyday working groups. It was the most natural thing then for Letty and Marcia to find themselves with Edwin and Norman, and for the latter to make some comment on the speech and to suggest that from what had been said he supposed they would spend their retirement setting the motor industry to rights.
Marcia was glad to be with people she knew. When she met other members of the staff she was conscious of her breastlessness, feeling that they must sense her imperfection, her incompleteness. Yet on the other hand she liked to talk about herself, to bring the conversation round to hospitals and surgeons, to pronounce in a lowered, reverent tone the name of Mr Strong. She could even, if it came to that, take some pleasure in saying 'my mastectomy' – it was the word 'breast' and the idea of it that upset her. None of the speeches and conversations dealing with her retirement had contained any references to breast (hope springing eternal in the human) or bosom (sentiments to which every b. returns an echo), as they might well have done had the deputy assistant director's speech been more literary.
It was of course generally known that Miss Ivory had undergone a serious operation, but the dress she was wearing today – a rather bright hyacinth blue courtelle – was several sizes too big for her skinny figure, so that very little of her shape was visible. People at the party who did not know her were fascinated by her strange appearance, that dyed hair and the peering beady eyes, and she might have provided unusual entertainment if one had had the courage to attempt a conversation with her. But one never did have quite that sort of courage when it came to the point. Ageing, slightly mad and on the threshold of retirement, it was an uneasy combination and it was no wonder that people shied away from her or made only the most perfunctory remarks. It was difficult to imagine what her retirement would be like – impossible and rather gruesome to speculate on it.
Letty, by contrast, was boringly straightforward. Even her rather nice green-patterned jersey suit and her newly set mousy hair were perfectly in character. She had already been classified as a typical English spinster about to retire to a cottage in the country, where she would be joining with others like her to engage in church activities, attending meetings of the Women's Institute, and doing gardening and needlework. People at the party therefore talked to her about all these things and Letty's natural modesty and politeness prevented her from telling them that she was no longer going to share a country cottage with a friend but would probably be spending the rest of her life in London. She knew that she was not a very interesting person, so she did not go into too much boring detail with the young people who enquired graciously about her future plans. Even Eulalia, the black junior, gave her an unexpectedly radiant smile. Another, whose thick, smooth straight neck rose up like a column of alabaster, the kind of girl it was impossible to imagine engaging in any of the mundane office jobs like typing or filing, suggested brightly that she'd be able to watch the telly in the afternoons, and Letty began to realize that things like this were, after all, one of the chief joys of retirement. She could not admit to this kind girl that she hadn't even got a television set.
Inevitably everyone had to get back to work and eventually Letty and Marcia found themselves in their own office with Edwin and Norman.
The two men seemed pleased with themselves. In their time they had attended a good many retirement parties and this one apparently came up to the standard which was measured by the number of times the sherry bottle went round.
'Of course sherry's a bit livery midday,' said Norman, 'but it's better than nothing. It does have its effect.' He swayed slightly in a comic manner.
'I find two glasses quite enough,' said Letty, 'and I think my glass must have been refilled when I wasn't looking because I feel quite...' She didn't really know how she felt or how to describe it; she was certainly not drunk but neither tiddly nor tipsy seemed suitably dignified.
Marcia, who had taken nothing but a small glass of orange juice, gave a tight-lipped smile.
'At least you won't have a drinking problem when you retire,' Norman teased.
'I hate the stuff,' she declared.
Letty found herself thinking about the lonely evenings ahead of her in Mrs Pope's silent house. Perhaps it would be as well not to have a bottle of sherry in her room... She had got on quite well with Mrs Pope so far, when she was out all day, but would it be the same when she retired? Obviously the arrangement could only be temporary. One did not relish the idea of spending the rest of one's life in a north-west London suburb. There was no reason why she shouldn't find a room in a village somewhere near where Marjorie and her husband would be living – Marjorie had hinted in her last letter that she would welcome something of the kind, she didn't want to lose touch after all these years... Or she might go back to the west of England where she was born. She told herself, dutifully assuming the suggested attitude towards retirement, that life was still full of possibilities.
Letty began clearing out her office drawer, neatly arranging its contents in her shopping bag. There was not much to be taken away – a pair of light slippers for the days when she needed to change her shoes, a box of paper handkerchiefs, writing paper and envelopes, a packet of indigestion tablets. Following Letty's example, Marcia began to do the same, muttering as she did so and stuffing the contents into a large carrier bag. Letty knew that Marcia's drawer was very full although she had never seen inside it properly, only caught glimpses of things bulging out when Marcia opened it. She knew that there was a pair of exercise sandals in which Marcia used to clump around in the days when she had first bought them, but she was surprised to see her take out several tins of food – meat, beans and soups.
'Quite a gourmet feast you've got there,' Norman remarked. 'If only we'd known.'
Marcia smiled but said nothing. Norman seemed to be able to get away with these teasing comments, Letty thought. She had turned aside, not wanting to see what Marcia was taking out of the drawer. It seemed an intrusion into Marcia's private life, something it was better not to know about.
'It will seem funny without you both,' said Edwin awkwardly. He did not really know what to say now that it had come to the point. None of them knew, for it was the kind of occasion that seemed to demand something more than the usual goodbye or goodnight of the end of an ordinary working day. Perhaps they should have given the women a present of some kind – but _what_? He and Norman had discussed it, but decided in the end that it was altogether too difficult. 'They wouldn't expect it – it would only embarrass them,' they had concluded, 'and it's not as if we were never going to see them again.' In the circumstances it was much easier to assume this but without going into too much detail about it. For of course they would all meet again – Letty and Marcia would revisit the office, ' pop in' some time. There might even be meetings outside the office – a kind of get-together for lunch or 'something'... even if it was beyond imagining what that something might be, at least it made it easier for them all to go on their separate ways assuming a vague future together.
# Thirteen
' You'll be retiring,' Janice Brabner had said. 'Have you thought at all what you're going to do?' 'Do?' Marcia stared at her blankly. 'What do you mean?'
'Well...' Janice faltered but, as she afterwards recounted, pressed on regardless. ' You'll have a good deal of time on your hands, won't you – time that you gave to your job?' Marcia had never revealed what exactly her job was but Janice guessed that it hadn't been particularly exciting. After all, what kind of job could somebody like Marcia do? She wished she wouldn't keep staring at her in that unnerving way, as if she had no idea what was meant by Janice asking what she was going to do when she retired.
'A woman can always find plenty to occupy her time,' Marcia said at last. 'It isn't like a man retiring, you know. I have my house to see to.'
'Yes, of course.' And it could do with seeing to, Janice thought. But was Marcia capable of doing what was necessary? Physically she seemed able to do housework so that there was no question of getting a home help for her, even if one could be found, but keeping a house in order needed a certain attitude of mind and it was here that Marcia seemed to be lacking. Did she not notice the dust or care about it? Perhaps she needed new spectacles – a word here might be in order... Janice sighed, as she so often did when considering Marcia. There seemed to be nothing she could do at the moment beyond keeping an eye on her and calling in occasionally to see how she was coping.
The first Monday morning Marcia woke at the usual time and began getting up and preparing to leave the house before she remembered that it was the first day of her retirement. ' Roll on,' people used to say in those days when it had seemed an impossibly remote event, as unlikely as winning the pools or having your number come up on Ernie. Well, now it had rolled on, it was here. A woman can always find plenty to occupy her time.
Marcia took down the tray she had used for her early morning tea, but she left the cup behind on the dressing table where it would remain for some days, the dregs of milky tea eventually separating into sourness. As she was not going to the office, she changed the dress she had put on for her old Saturday morning skirt and a crumpled blouse which needed ironing, but there was nobody to notice it or to criticize and no doubt the warmth of her body would soon press out the creases. Downstairs at the sink she was about to wash up yesterday's dishes when she was diverted by the sight of a plastic bag lying on the kitchen table. How had that got there and what had been in it? So many things seemed to come in plastic bags now that it was difficult to keep track of them. The main thing was not to throw it away carelessly, better still to put it away in a safe place, because there was a note printed on it which read 'To avoid danger of suffocation keep this wrapper away from babies and children'. They could have said from middleaged and elderly persons too, who might well have an irresistible urge to suffocate themselves. So Marcia took the bag upstairs into what had been the spare bedroom where she kept things like cardboard boxes, brown paper and string, and stuffed it into a drawer already bulging with other plastic bags, conscientiously kept away from babies and children. It was a very long time since any such had entered the house, children not for many years, babies perhaps never.
Marcia spent a long time in the room, tidying and rearranging its contents. All the plastic bags needed to be taken out of the drawer and sorted into their different shapes and sizes, classified as it were. It was something she had been meaning to do for such a long time but somehow she had never seemed to have a moment. Now, the first day of her retirement, she had eternity stretching before her. It amused her to remember Janice Brabner asking in that rather mincing, refined voice of hers, 'Have you thought at all what you're going to do?'
The task took until what would in the office have been lunchtime and Marcia did wonder for a moment what Edwin and Norman would be doing, but of course it would be just what they always did, eating whatever lunch they had brought with them, Edwin with his finicky things and Norman making himself coffee from the big shared tin she had left behind. Then Edwin visiting some church to see what was going on there and Norman perhaps strolling as far as the British Museum to sit in front of the mummified animals. Or perhaps he wouldn't get any further than the library and a look at the papers, and thinking of the library reminded her that she still hadn't done anything about that milk bottle which Letty had foisted on her. If the worst came to the worst she could always leave it at the library, or any library, as she wouldn't be going to that particular one any more...
Marcia gave no thought to her own lunch and it was evening before she had anything to eat and then only a cup of tea and the remains of one of the bits of bread she found in the bread bin. She did not notice the greenish mould fringing the crust, but she wasn't hungry anyway and only ate half the slice, putting the remainder back for future consumption. Of course she would go out shopping some time, perhaps tomorrow, but not today even though the Indian shop would still be open. There were plenty of bits and pieces to finish up and she had never been a big eater.
Letty had imagined herself sleeping late on that first morning, but she woke up at the usual time, in fact earlier because Mrs Pope was up at six o'clock and clattering out of the house, no doubt to observe some obscure saint's day with a service at the church. Letty would probably have woken up anyway, so strong was the habit of forty years. And older people are said to wake up earlier, she thought, so perhaps the habit would never be broken.
'What are you going to _do_ when you retire?' people had asked her, some in a genuine spirit of enquiry, others with ghoulish curiosity. And naturally she had made the usual answers – how nice it would be not to have to go to the office – how she would now have time to do all those things she had always wanted to do (these 'things' were unspecified) – and read all the books she had never had time to read before – _Middlemarch_ and _War and Peace_, perhaps even _Dr Zhivago_. And really, when it came to retiring, she could have said, as Marcia had, 'A woman can always find plenty to occupy her time' – that was the great thing, being a woman. It was men one felt sorry for in retirement. Of course in one respect she was different from Marcia, she had no house to see to, only this room in another woman's house, and there was a limit to what one could do in it or to it. All the more opportunity to devote herself to some serious reading, and that would mean a visit to the library. It would be good to get out on this first morning, to have an object for a walk.
By the time Letty had decided to go down to the kitchen to get her breakfast, Mrs Pope had come back from church. She was very brisk and virtuous. It was a chilly morning but the walk had done her good. There had been three people at the early service, five if one counted the priest and his server. Letty did not know what comment to make, for she had always understood from Edwin that these very early services were rather old-fashioned now and that an evening Mass was the thing. Still, the thought of Edwin gave her a conversational opening and she was able to ask Mrs Pope about his connection with her church.
'Oh, he's not a regular member of our congregation – he only comes if there's something special going on,' Mrs Pope said, fiercely scraping a piece of burnt toast.
'We're not nearly high enough for him – no incense, you see.'
'No incense?' Again Letty was at a loss.
'It doesn't agree with everyone, you know. If you're at all bronchial... Do you not get dressed for breakfast, Miss Crowe?'
Letty, who had come down to the kitchen in her respectable blue woollen housecoat, felt that she was being criticized. 'It's the first day of my retirement,' she explained, feebly, she felt, as if that was enough justification.
'But I think you will find it better not to allow yourself to get slack. So many people go to pieces in retirement – I've seen it so often. A man may be in a responsible position, then he retires...'
'But I am a woman and I was not at all in a responsible position,' Letty reminded her. 'And this morning I'm going to the library – I shall at last have time to do some serious reading.'
'Oh, reading...' Mrs Pope did not seem to have much use for reading, and the conversation, if it had been that, languished. Mrs Pope had gone to church fasting and now prepared to enjoy her bacon and scraped toast, while Letty went back to her room with a boiled egg and two slices of crispbread.
Later she dressed, more carefully than Marcia had done on her first day of retirement. It was an opportunity to wear a new tweed suit which had been considered too good for the office, and to spend more time than usual in choosing the jumper and scarf to go with it. So far her day was being different, but when it came to the next part of it she realized that she would be going to the library near the office where she had a reader's ticket, and that the journey to it would be the one she had taken every day. But now, two hours later, the train was less crowded and when she got out at her station people let themselves be carried up on the escalator rather than walking up.
To reach the library she had to pass the office, and naturally she glanced up at the grey monolithic building and wondered what Edwin and Norman were doing up there on the third floor. It was not too difficult to picture them at coffee time, and at least there would be nobody installed in her and Marcia's places, doing their work, since nobody was to replace them. It seemed to Letty that what cannot now be justified has perhaps never existed, and it gave her the feeling that she and Marcia had been swept away as if they had never been. With this sensation of nothingness she entered the library. The young male assistant with the shoulderlength golden hair was still in his place, so that at least was reassuring. Confidently she went over to the sociology shelves, determined to begin on her serious reading. The idea and the name 'social studies' had attracted her and she was eager to find out what it was all about.
'I wonder what the girls are doing now,' said Norman.
'The girls?' Of course Edwin knew perfectly well whom he meant but he was not used to talking or thinking of Letty and Marcia in this way.
'A nice lie-in, then breakfast in bed, elevenses in town and a wander round the shops – lunch in Dickins & Jones, perhaps, or D. H. Evans. Then back home well before the rush hour, then 1...' Norman's imagination failed at this point and Edwin was not capable of filling in the gaps.
'That's quite likely for Letty,' he said, 'but I can't see Marcia spending her day like that.'
'No, she wouldn't want to go round the shops,' said Norman thoughtfully. 'Letty was the one who used to go to Oxford Street in the lunch hour – didn't even mind waiting for a bus.'
'No – we sometimes used to meet in the queue when I was going to All Saints, Margaret Street.'
'You never persuaded her to join you,' said Norman sardonically.
Edwin seemed embarrassed, almost as if he had tried and failed, but Norman did not press the point. 'It seems funny without them,' he said.
'Perhaps they'll pop in some time,' Edwin suggested.
'Yes, they did say they'd pop in.'
'Not that I can really imagine them doing that – they'd have to come up in the lift, wouldn't they, and that's not quite the same.'
'Not as if we were on the ground floor and could be seen from the street,' said Norman, almost wistfully.
'At least we've got a bit more room now.' Edwin began to arrange his lunch on what had been Letty's table, spreading out slices of bread, a tub of polyunsaturated margarine, cheese and tomatoes. Taking out a packet of jelly babies he had a sudden and vivid picture of Letty, but why this should have materialized at this particular moment and with such intensity he could not have said. Surely nothing to do with the jelly babies?
It had been a long day and in a curious way a tiring one, as tiring as a working day, Letty felt. Perhaps it had been the early waking and the longer than usual evening, beginning with a period between tea and supper which she did not remember as having existed before. She had made a determined effort to read one of the books she had brought from the library, but it had been heavy going. Obviously it would take some time to acquire the knack of serious reading and perhaps it would be better to go on with it in the morning when she was feeling fresher.
Marcia's day seemed to have gone in a flash, though speed was not a concept in her life. She had no sense of time passing and was surprised when darkness came. Her most conscious thought was irritation at the idea that the do-gooding social worker might call, so she did not put the light on but sat in darkness, listening to the mindless chatter and atavistic noise of Radio 1 turned down low. She had no memory of having experienced the first day of her retirement.
# Fourteen
Letty had been retired for a week and had drawn the first payment of her pension before she found herself coming to the conclusion that sociology was not quite all that she had hoped for. Perhaps she had chosen the wrong books, for surely 'social studies' must be more interesting than this? She had imagined herself revelling and wallowing – perhaps these words were too violent to describe what she had imagined – in her chosen subject, not frozen with boredom, baffled and bogged down by incomprehensible jargon, continually looking at her watch to see if it could be time to make a cup of coffee. It must be that she was too old to learn anything new and that her brain had become atrophied. Had she indeed ever had a brain? Going back over her past life, she found it difficult to remember anything she had ever done that required brain work, certainly not the job from which she had just retired. She seemed to be totally unfitted for academic work, yet people older than she was were taking courses at the Open University. Mrs Pope knew a woman in her seventies who was in her second year. But Mrs Pope, it seemed, always knew somebody who was doing something wholly admirable, and as time went on Letty found herself avoiding her and choosing to cook her meals when she knew that Mrs Pope would not be using the kitchen. She would crouch in her room listening for sounds, trying to detect the smell of cooking, though this was often difficult as Mrs Pope seldom had anything fried except bacon. Letty would find herself pouring a second glass of sherry while she waited for Mrs Pope to leave the kitchen. But she still kept to her rules – one did not drink sherry before the evening, just as one did not read a novel in the morning, this last being a left-over dictum of a headmistress of forty years ago.
When the sociology books were due to be returned to the library, Letty took them back, feeling guilty and dissatisfied. But you were supposed to enjoy retirement, at least the first weeks of it. Have a good rest, do all those things you've always wanted to do, people had said. Why shouldn't she just read novels and listen to the radio and knit and think about her clothes? She wondered what Marcia was doing, how she was getting on. It was a pity she wasn't on the telephone for it would have been so much easier to have a chat or arrange a meeting that way.
'You could travel,' people had said and Letty had to agree with them, though it was not easy to imagine the kind of travelling she would do, alone on a package tour now that Marjorie was so much occupied with David Lydell. Listening to a phone-in programme on the radio she had heard a question about holidays for people on their own, and the answer conjuring up a picture of a crowd of congenial middle-aged and elderly people of both sexes with interests in common – botany and archaeology or even 'wine' (as opposed to solitary drinking). In the end her courage failed her and she got no further than studying the brochure, like Norman diving for buried treasure in Greece. Her attempts at 'travel' ended in a weekend visit to a distant cousin living in the West Country town where she had been born.
The cousin, a woman of about Letty's age, was friendly and welcoming and they sat cosily knitting together in the evenings. Letty had long since accustomed herself to being without a man in her life and, as a result of this lack, to having no children. The cousin was a widow and did not make Letty feel in any way inadequate. All the same, it was when she was staying here that Letty began to realize another way in which she had failed. It was not something that had previously occurred to her, but looking through the cousin's photograph album she saw clearly what it was – she had no grandchildren! That was it. How could she ever have imagined such a thing, all those years ago?
Returning from her weekend, she thought again of getting in touch with Marcia. She decided to write her a note, suggesting that they might meet for lunch or tea in town. It was perhaps a little early to compare notes about their retirement but at least they could talk about old times at the office.
Janice's next visit to Marcia was some weeks after her retirement – time for her to have settled down and to have worked out some kind of a pattern for her days, Janice thought. No doubt she missed the companionship of the office – 'they', the retired ones, often mentioned that – and the routine that even a boring occupation provides. Still, as Marcia herself had said, a woman can always find plenty to occupy her time and she had her house to see to. She had a garden, too, and that could have done with a bit of attention, Janice considered, as she waited on the doorstep and contemplated the dusty laurels whose overgrown foliage almost concealed the downstairs front window.
When Marcia reluctantly opened the door to admit her, Janice was startled by the change in her appearance. It was some seconds before she realized what the difference was. Since her retirement, Marcia had not bothered to touch up the roots of her hair which now stood out snowy white against the stiff, dark brown of the rest. Perhaps she was deliberately letting the dye grow out so that she might achieve the soft white curls of the majority of the pensioners visited by Janice, though, knowing Marcia, this seemed doubtful. She really ought to have the dyed part cut out, creating a short neat style of the white part, as many elderly people did. Janice wondered if she could tactfully convey the information about reduced charges for pensioners at some of the local hairdressers. But why bother to be all that tactful? You had to be a bit forthright with people like Marcia, and there was no time like the present.
'I suppose you do know that you can get your hair done at a reduced price at Marietta's if you go between nine and twelve on Mondays and Tuesdays?' Janice said, in her sweetest manner. So many of them don't _know_ what they're entitled to, how people are _falling over backwards_ to help them, was the social workers' wail.
'I got a leaflet from the library telling me all that sort of thing,' said Marcia impatiently, and Janice felt that she was being dismissed.
'Don't forget that you can always come along to the Centre,' she said, going out of the front door. 'We get quite a lot of retired people there and they seem to like to have a chat with others in the same boat.' Perhaps that hadn't been the happiest way of putting it, and really it was rather comic, the picture of all these retired people in some kind of boat. Sometimes you almost felt it wouldn't be a bad idea to shove them off all together somewhere. Tony, Janice's husband, used to joke about it but of course old people were no joking matter, as she kept reminding herself. And Marcia hadn't smiled at the idea of the boat, hadn't even replied to the suggestion that she might go along to the Centre. Janice sighed.
Marcia watched her getting into her car and driving away. Young people couldn't walk a step these days, she thought. And what was all that about hairdressers? Janice's own hair was streaked all different colours, so she couldn't talk. Marcia didn't like going to the hairdresser, anyway, she hadn't been for years. Not like Letty, who went every week. No doubt _she_ would be taking advantage of the reduced charges for pensioners... Marcia stood in the hall, a feeling of dissatisfaction creeping over her at the idea of Letty. It was that business of the milk bottle, chiefly, but there was something else too. Letty had sent her a postcard, suggesting that they might meet some time – as if she would want to do that! There was no knowing what Letty might foist on her, given the chance. She was certainly going to ignore the card.
Letty had expected some kind of an answer from Marcia to her suggestion of a meeting, but she was not altogether surprised when none came. One could very quickly grow away from people and that life at the office, where they had never been close friends, now seemed utterly remote. Instead, though it was in no way comparable, she received a letter from Marjorie, announcing that she was coming to London to do some shopping and asking Letty to have lunch with her.
They met in the restaurant of an Oxford Street store, rather as Norman had pictured Letty lunching on her first day of retirement. It appeared that Marjorie had come to London to buy clothes for her trousseau, which seemed to Letty not only an oldfashioned idea but an inappropriate one for a woman in her sixties. Yet Marjorie had always been of a romantic nature, getting the most out of unpromising circumstances. Even Marcia, Letty recalled, had an 'interest' in the surgeon who had performed her operation, so that a visit to hospital was something to be looked forward to. Only Letty, it seemed, was without romance in her life, and the prospect of Marjorie's marriage was something beyond her imagining. If she had now got over any disappointment she may have felt at the cancellation of her retirement plans, she was still not able to enter fully into Marjorie's rapture. But she could offer suggestions about clothes and perhaps that was something.
'I shall be wearing a blue crêpe dress,' Marjorie was saying, 'and I thought of getting a small, matching hat.'
'You could wear a wide-brimmed hat,' Letty said. A woman of their age could do with a few becoming shadows cast on the face, she thought.
'Oh, do you think so? Yes, I suppose it's not like Royalty – people don't necessarily expect to see one's face – or want to,' Marjorie laughed. ' And of course there won't be crowds of people – it's going to be very quiet.'
'Yes, I suppose so.' The weddings of older people usually were.
'You don't mind, do you, Letty?'
'Mind?' Letty was surprised at the question.
'At not being asked to be a bridesmaid, I mean.'
'Of course not! I never thought of it.' Older women attending each other in this way seemed highly unsuitable and she was surprised that Marjorie had suggested it. In any case, Letty had been a bridesmaid at Marjorie's first wedding. She wondered if Marjorie had forgotten this but was too tactful to remind her of it.
'And we shan't even be having any guests – just my brother to give me away and a friend of David's, a fellow priest, as best man.'
'Has he any relations?'
'Just his mother – he's an only child.'
'But his mother won't be at the wedding?'
Marjorie smiled. 'Well, she's in her ninetieth year, so I would hardly expect it. She is living in a religious community – the nuns have taken her in.'
'To end her days? It seems a good arrangement.' Letty saw that churchgoing might have some unexpected advantages and wondered if Mrs Pope had arranged to be taken in by nuns one day.
'And how are things with you, Letty?' said Marjorie, when there was a pause in the conversation. 'You like your new arrangement – the room in NW6. Hampstead, is it?'
'Well, more West Hampstead,' Letty admitted. If it had been genuine Hampstead she would have said so.
'I still think you might have been happier at Holmhurst in the village, as I suggested. I could still put your name down, you know. There's sure to be a vacancy in the near future.'
'Yes, you said that before – somebody might die – but I suppose that vacancy has been filled now.'
'Oh, yes – but somebody else is sure to die – it's happening all the time,' said Marjorie brightly.
They had some coffee and Letty said that she thought she would stay where she was for the time being.
'Yes, it does seem very satisfactory,' said Marjorie, who obviously wanted to find it so. 'Mrs Pope seems a splendid sort of woman.'
'Yes, she is wonderful for her age,' said Letty, repeating what people always said about her. 'She's very active in the parish. I suppose you'll have to be that when you're married.'
'Oh, I shall enjoy it. To be able to _help_ somebody, don't you think that's the main purpose of life, what everybody...' Marjorie hesitated and Letty realized that she did not like to go further, to emphasize the contrast between her own enviable position, that of being a helpmate to a man, and Letty's state of useless retirement.
'I sometimes think I ought to get another job,' Letty said, 'part time, perhaps.'
'Oh, don't be in too much of a hurry to do that,' said Marjorie quickly, unwilling to give up the luxury of having a friend less useful than herself. 'Enjoy your leisure and all the things you can do now. If only I had time to do some serious reading, I often think.'
Letty remembered the books on social studies which she had returned to the library, but Marjorie was already on to another subject – a pair of warm bedroom slippers for her future husband. Should they go to Austin Reed's? As they walked out of the restaurant together, Letty contemplated the ample shape of her friend and wondered where in all these years she, Letty, had failed.
# Fifteen
' It's not the money,' Norman was saying. 'Goodness knows, I don't grudge the old dears a lunch.' Edwin noted that Letty and Marcia, previously 'the girls', were now 'the old dears'. Neither description seemed entirely suitable, but as he had nothing better to add he made no comment. 'We did say we'd keep in touch,' he reminded Norman, 'and they've been gone some time now.'
'Yes, time to've settled down – it was best to leave it for a bit. Of course we could use luncheon vouchers, if we went to the Rendezvous, that is.'
'Luncheon vouchers? Do you think so? It doesn't seem very...' Edwin hesitated.
'Gracious, you mean? You don't imagine it's going to be a _gracious_ occasion, do you?' Norman was at his most sarcastic. 'That was what I meant – just the whole idea of it, not the money. I'm quite willing to fork out 50p for their lunches.'
'I think you'll have to fork out a good deal more than 50p,' said Edwin, 'though we could use some luncheon vouchers. I've got quite a few saved up and after all they'd never know. You pay at the cash desk at the Rendezvous, so one of us could do the necessary without them seeing.'
'It's the awkwardness,' Norman went on. 'We've never had a restaurant meal with them before. Can you see the four of us sitting at a table?'
'You're not suggesting we should have sandwiches in the office? They'd hardly thank us for that.'
'But what are we going to talk about, once we've asked them how they are and all that?'
'Oh, we'll manage,' said Edwin, with a confidence he did not altogether feel, though he was so used to sticky church occasions that a lunch with two former colleagues should have been well within his powers. And after all, it had been his idea to invite Letty and Marcia to lunch. His conscience had been nagging at him and in the end he had written to them – in office time, of course, as it really counted as ' work' – extending the invitation. Letty had replied promptly, saying that she would very much like to see them again. Marcia's answer had taken longer to come and her acceptance gave the impression of conveying a favour, for she was so very busy. Edwin and Norman wondered what she could be doing that kept her so occupied. Perhaps she had taken another job, unlikely though this seemed.
'Anyway, we shall soon know,' said Edwin, as the time drew near. He had heard from Mrs Pope at the church (he had gone over for their dedication festival) that Letty seemed to have settled down well but that she was inclined to 'keep herself to herself', as if this was a bad thing. Nobody had heard any news of Marcia since her retirement, though Edwin occasionally passed the end of the road where she lived and had more than once thought of calling on her unexpectedly. But something, he wasn't sure what, had always held him back. The parable of the good Samaritan kept coming into his mind and making him feel uncomfortable, though it wasn't in the least appropriate. There was no question of him 'passing by on the other side' when he didn't even go anywhere near the house, and for all they knew, Marcia was perfectly happy. Of course Edwin did not know that she was, but for some obscure reason he felt that if anyone was to blame for not having kept in touch it was Norman.
It had been arranged that Letty and Marcia should come to the office and that they should all go on to lunch from there. Letty was the first to arrive, wearing her best tweed suit and carrying a new pair of gloves. 'So nice not to have to bother with a shopping bag,' she said, her eyes taking in not only Edwin and Norman, who appeared very much the same, but the changes that had taken place in the room.
'I see you've spread yourselves out a bit,' she said, noticing that the men now seemed to occupy all the space that had once accommodated the four of them. Again she experienced the feeling of nothingness, when it was borne in on her so forcibly that she and Marcia had been phased out in this way, as if they had never existed. Looking round the room, her eyes lighted on a spider plant which she had brought one day and not bothered to take away when she left. It had proliferated; many little offshoots were now hanging down until they dangled over the radiator. Was there some significance in this, a proof that she had once existed, that the memory of her lingered on? At least nature went on, whatever happened to us; she knew that.
'Yes, it's grown, that plant,' Edwin said. ' I've watered it every week.'
'You left a bit of yourself behind,' said Norman, in his chatty way, but then, as if by mutual consent, they left the subject, each perhaps fearing a deeper significance. 'Marcia knows the time we arranged?' Norman asked sharply. 'It's best to go early to get a table.'
'Yes, I said 12.30, and it must be nearly that now,' said Edwin. 'Is that someone at the door now?'
It was Marcia, making something of an entrance because of her strange appearance.
When she had received the invitation from Edwin she had at first told herself that it was 'out of the question' – she could not possibly spare the time to come up to town for lunch. Then it occurred to her that it would be a golden opportunity to return the alien milk bottle to Letty, so she wrapped it in plastic and put it in her shopping bag. Unlike Letty she had brought one with her, as she intended to go to Sainsbury's to replenish her supply of tinned foods.
It took the others a moment or two to recover from the apparition standing before them. Marcia was thinner than ever and her light-coloured summer coat hung on her emaciated body. On her feet she wore old fur-lined sheepskin boots and a pair of much darned stockings, and on her head an unsuitably jaunty straw hat from which her strangely piebald hair straggled in elflocks.
Edwin, who was not particularly observant, did realize that she was wearing an odd assortment of garments but did not think she looked much different from usual. Norman thought, poor old girl, obviously going round the bend. Letty, as a clothes-conscious woman, was appalled – that anyone could get to the stage of caring so little about her appearance, of not even noticing how she looked, made her profoundly uneasy and almost consciencestricken, as if she ought to have done something more about Marcia in her retirement. But then of course she _had_ suggested a meeting and Marcia hadn't answered her letter... And now she was made to feel ashamed because she felt embarrassed at the idea of sitting in a restaurant with Marcia.
Luckily the Rendezvous was fairly empty and they found a table in a secluded corner.
'This place lives up to its name for once,' said Norman, making bright conversation as they studied the menu. 'It really is a rendezvous for...' He did not say 'friends', for they were not exactly that, and 'colleagues' sounded too formal and slightly ridiculous.
'A meeting place for people who haven't seen each other for some time,' Letty suggested, and the men were grateful to her; but she had not seen it like this in the days when she used to lunch alone here. It had always seemed full of solitary people eating lonely meals.
'Now, what are we going to eat?' said Edwin, turning especially to Marcia who looked most in need of food, or sustenance, one could almost say.
'You look as if you could do with a square meal,' said Norman bluntly. 'What about some soup to start off with and then the roast or chicken?'
'Oh, just a salad for me,' said Marcia. 'I never eat a heavy meal in the middle of the day.'
'Well, I think the rest of us will want more than that,' said Edwin heartily.
'Yes, it doesn't seem quite the weather for salads,' Letty agreed.
'I should've thought you'd be a salad enthusiast,' said Norman. 'You've put on a bit of weight, haven't you.' His tone was teasing but Letty detected the hint of malice in it. She knew that he was right, for since her retirement eating had been one of her main interests and enjoyments. 'Some elderly people do enjoy their food,' Norman went on, hardly improving matters, for even now Letty did not think of herself as elderly. 'Others couldn't care less.'
'Now come on, all of you,' said Edwin, who was conscious of the hovering waitress. ' What's it to be?'
In the end, Letty had the chicken ' forestière', Norman the roast pork and Edwin, whose vegetarianism did not exclude fish, the plaice and chips. Marcia was not to be 'tempted', as Norman put it, and insisted on a small cheese salad. When it came to drink, the men had lager while Letty was persuaded to take a glass of white wine. Marcia, of course, had nothing and made rather a feature of her abstinence, much to the amusement of two young men at the next table.
'Well now...' Edwin's relief at the safe arrival of the food was evident in his more relaxed manner, for as he had suggested it he regarded himself as responsible for the success of the enterprise. 'Everything to your satisfaction? Wouldn't you like a roll and butter with your salad?' he suggested to Marcia.
'I never eat bread with my meals,' she declared.
'You'll get so that you can't eat if you're not careful,' Norman pronounced. 'Anorexia nervosa, they call it – there was a talk about it on the radio.'
'It's young girls who get anorexia nervosa,' said Marcia, correcting him from her superior medical knowledge. ' I've never been a big eater.'
'I hope your chicken is all right?' said Edwin to Letty. As if _he_ should care about Letty's food, he thought, amused at himself, but one had to play the host on this occasion.
'Thank you, it's quite delicious,' said Letty politely.
'Vegetables and that,' said Norman, ' I suppose that's what "forestière" means – things from the forest. Though you wouldn't really get vegetables in a forest, would you?'
'This has mushrooms in it,' said Letty, 'and you might certainly find those in a wood or forest.'
'But you wouldn't fancy them,' said Norman, 'not out of the forest.'
'Of course now most mushrooms are cultivated,' Edwin suggested. ' I believe it's quite a lucrative thing to take up in one's retirement.'
'Hardly in a bedsitter,' said Norman. ' You and Marcia could go in for it, though, in your houses, if you've got a basement or a shed in the garden.'
Marcia looked up at him suspiciously. 'My shed is used for quite another purpose,' she said.
'Dark secrets,' said Norman, but Marcia did not seem to be amused.
'I don't think Edwin was suggesting that any of us should go in for mushroom cultivation,' said Letty, 'though I believe people make quite a success of it.'
'Do you know of anyone who has gone in for it?' Edwin asked.
'Oh no,' said Letty hastily.
That seemed to kill off that particular topic of conversation and there was a short silence which was broken by Edwin asking what they would like to eat next, 'sweet, pudding or dessert, as the Americans say'.
'Nothing more for me, thank you,' said Marcia firmly. Having messed her salad about in an unattractive way, she had left most of it on the side of her plate.
Letty, remembering Norman's remark about her weight, decided that she might as well be hung for a sheep as a lamb and make the most of the meal. She could have a low-calorie supper tonight. 'I'd like apple pie and ice cream,' she said.
'Aunt Betsy's apple pie,' Norman pointed out. 'I think I'll have that too.'
Edwin decided to have caramel pudding and tried to persuade Marcia to change her mind, but he was unsuccessful.
'We haven't really asked what you two are doing with yourselves in your retirement,' Norman said, 'what you're getting up to.'
That way of putting it added a lighter touch and Letty told them about her efforts to take up social studies and her ignominious failure to get through the books.
'I don't wonder,' said Norman. 'You don't want to bother with that kind of thing. You want to get a good rest. After all the work you did here you deserve it.'
Letty wondered again what that work had been that it had left so little mark on anybody, and added, 'I seem to fill my time quite pleasantly.' She must never give the slightest hint of loneliness or boredom, the sense of time hanging heavy.
'What about that friend of yours – the one who was going to marry the vicar?' Edwin asked.
'Oh, she hasn't married him yet. I had lunch with her the other day.'
'I suppose there wouldn't be any hurry,' said Edwin, unconscious of any possibility of misunderstanding, which Norman seized on.
'I should hope not!' Norman said. 'And anyway, marry in haste and repent at leisure.'
'There surely wouldn't be any question of that,' said Edwin.
'Well, no,' Letty agreed. 'The saying doesn't really apply to people in their sixties.'
'It could apply,' said Norman, 'why not, indeed? And I think you told us that the lady is some years older than her intended.'
'Did I tell you? I don't remember that.' Letty hoped she had not been uncharitable about her friend.
'And what have you been doing with yourself?' Edwin turned to Marcia with an air of kindly enquiry which hardly deserved the fierceness of her reply.
'That's my business,' she snapped.
'Been to the hospital again?' Norman asked, humouring her. 'Still under the doctor, aren't you?'
Marcia mumbled the name of Mr Strong then, raising her voice, began to complain about the interfering visits of the social worker.
Letty drained the last drops of her wine with a feeling of regret. It had not been a very large glass. 'No social worker has ever visited me,' she said.
'You haven't had a major operation, have you,' said Marcia, rather too loudly. The same young men at the next table were again amused.
'Well, that does say something for the National Health Service and the after-care,' said Edwin, 'that they should keep an eye on the people who've been in hospital. I find that very encouraging.'
'Don't tell us you're planning to have a major operation – the same one as Marcia had,' Norman joked.
There was a feeling that he had gone a little too far and Edwin hastily asked if he should order coffee for all of them.
'Not for me,' said Marcia, 'I really must be going. I have a lot of shopping to do.'
'Oh, stay till we've had ours,' said Norman, coaxing her. 'It isn't often we get the chance of a chat.'
A curious expression, which only Letty appeared to notice, came over Marcia's face. It could almost have been said that she softened. Had she some feeling for Norman, then? But it was only a momentary change, and while the others were drinking their coffee she was again impatient to go.
'I suppose you two ought to be getting back to the grindstone,' said Letty, when it seemed that the lunch hour could not be prolonged.
'If you can call it that,' said Edwin.
'It certainly seems like that sometimes,' said Norman. 'Roll on retirement.'
Letty wondered what he would do in his bed-sitting room when he retired, and had an impulse to talk to him about it, but of course there was no time for that kind of thing – work, or what passed for work, had to be done and the two men had already been out of the office longer than usual. Still, it was a special occasion, not the kind of thing that happened every day, and if they had been challenged Edwin and Norman would have been prepared to defend themselves. But nobody questioned them and they slipped back to their room unnoticed.
Marcia hurried into a side street where there was a small branch of Sainsbury's. As she delved into her shopping bag, preparing it to receive the various tins she intended to buy, her hand came upon the wrapped milk bottle she had forgotten to return to Letty. What a nuisance! For a moment she wondered if she could catch the others up but although she hurried back along the street they had gone too far and there was no sign of them. She turned away, frustrated.
When she reached Sainsbury's there was a curiously empty look about the building and nobody was coming out or going in. Had she forgotten that it might be early closing? But surely that was Saturday? She went nearer and peered in at the door. A shocking sight met her eyes – the place was swept and garnished, almost razed to the ground. It was indeed closed, and for ever, as from a date some weeks ago, and nobody had told her. That branch of Sainsbury's was abandoned, it was no more, and she could not buy the tins to take back for her store cupboard. Unreasonably, she blamed Edwin and Norman for not having informed her of the fact. There was nothing for it but to go to the library.
Letty, after leaving the two men, had gone in there too, and Marcia crept up behind her as she browsed among the biographies.
'This is yours, I think,' said Marcia in an accusing tone, thrusting the wrapped milk bottle towards her.
'A milk bottle?' Of course Letty did not remember the occasion and Marcia had to explain it which she did, loudly, so that other people turned round and the young blonde-haired library assistant seemed about to make some kind of protest.
Letty, conscious of tension in the air, accepted the bottle without further question, and Marcia walked away quickly, feeling that although coming up to town for lunch had been a waste of time, at least it had had a satisfactory outcome. Letty, encumbered with the bottle and having no shopping bag with her, left the library without choosing a book and deposited the bottle in a crate outside the grocer's shop near the office. Marcia could perfectly well have done this herself, she reflected, but obviously her mind did not work that way. She preferred not to dwell on how it might work, not to speculate. Although the encounter had been an upsetting one, almost as disturbing as seeing that woman slumped on the Underground platform, on that morning which seemed so long ago now.
When she got home, Letty found Mrs Pope standing in the hall with a leaflet in her hand.
'Help the Aged,' she declared. 'Good, serviceable clothing is needed for the aged overseas.'
Letty could think of nothing to say.
After they had parted from the women, Norman turned to Edwin. 'You must let me know the damage and I'll settle with you.'
'Oh, that's all right. I used mostly luncheon vouchers – the extra hardly amounted to anything – you must let me do this,' said Edwin quickly, for he was sometimes haunted by a picture of Norman in his bedsitter while he himself occupied a whole house.
'Well, thanks, chum,' said Norman awkwardly. 'It wasn't so bad, really, was it.'
'No, it passed off quite well – better than I expected in some ways, but I don't like the look of Marcia.'
'You're telling me! I should say she was going right round the bend. Still, she is under the doctor, that's something. And that social worker goes to see her.'
'Yes, rather too often, she said. People do seem to be keeping an eye on her.'
With this they left the subject, but Edwin did say something to the effect that they must do it again some time, repeat the lunch invitation to Letty and Marcia. But it was a comfort to feel that this need not be for some time to come and that for the moment they had done their duty.
# Sixteen
Although he had been dead for some years, Marcia still missed the old cat, Snowy, and one evening she found herself particularly reminded of him when she came across one of his dishes in the cupboard under the sink. She was surprised and a little upset to notice that it still had some dried-up fragments of Kit-e-Kat adhering to it. Had she then not washed it up after his death? It would seem not. This might not have surprised an observer, but Marcia regarded herself as a meticulous housekeeper and she had always been especially careful with Snowy's dishes, keeping them, in her own words, 'spotlessly clean'.
The finding of the dish gave her a desire to visit the cat's grave which was somewhere at the bottom of the garden. When Snowy had died, Mr Smith, who had lived next door before Nigel and Priscilla came, had dug a grave and Marcia had laid Snowy in it, his body wrapped in a piece of her old blue ripple-cloth dressing gown which he used to sleep on. In the midst of life we are in death, she had thought, feeling the significance of the cloth and its associations. She had not marked the grave in any way, but she remembered where it was, for when she walked down the path she would think, Snowy's grave; but as time went on she forgot the exact spot and now, in the season of high summer with the weeds flourishing, she could not find it at all. That part of the garden was so overgrown that she could hardly tell where the path and flowerbed met. There was a sprawling bush of catmint, so the grave must be somewhere near there because Snowy had loved to roll in the plant, but it was quite indiscernible now, though Marcia parted the covering of leaves and weeds with her hands. Then it occurred to her that if she were to dig in that bit of the garden, she would surely come upon the grave, perhaps uncover a fragment of the blue ripple-cloth and then even find the bones.
She went to the shed and fetched a spade, but it was very heavy and if she had ever wielded it in the past, she was certainly unable to now. After my operation of course, she thought, trying once more to move the earth and the thick clotting of weeds – dandelions, thistles and bindweed, plants with strong matted roots.
It was thus that Priscilla saw her, crouched at the bottom of the garden. What was she _doing_ , trying to dig with that heavy spade? It was worrying and upsetting, for the old – especially Miss Ivory – were perpetually nagging at her conscience. Not only was she a neighbour but also what Janice Brabner called 'disadvantaged' and that, whatever it might mean – Priscilla wasn't absolutely sure – was certainly something to worry about. Of course, Nigel had asked Miss Ivory if she wanted her lawn cut but she had preferred it the way it was and one couldn't bully the elderly, their independence was their last remaining treasure and must be respected. All the same, one could perhaps offer a little gardening assistance, digging, for example... but not _now_ , when Priscilla had people coming to dinner, the avocados to prepare and mayonnaise to make. Perhaps it was a fine enough evening to have drinks outside on the little patio they had made, but the view of the neglected garden next door would detract from the elegance of the occasion, and if Miss Ivory was going to go on digging in this disturbing way something would have to be done about it. But now, to Priscilla's relief, she was going back towards the house, dragging the heavy spade behind her. One had to cling to the hope that she knew what she was doing.
Back in the kitchen, Marcia couldn't remember what she had gone out for, then the sight of the cat's dish soaking in the sink reminded her. There had been no trace of the grave and she was not strong enough to go on digging for it. She supposed she should have something to eat, but it was a bother to cook anything and she didn't want to disturb her supply of tins. So she just made a cup of tea and put plenty of sugar in it, like the tea at the hospital. 'Cup of tea, Miss Ivory? Sugar, dear?' It gave Marcia a warm feeling to remember those days and that nice woman – Nancy, they called her – coming round with the tea.
On that same summer evening Letty was helping Mrs Pope and little furry Mrs Musson to sort out clothes that had been sent in response to the appeal for aged refugees.
'What would you think if somebody gave you this?' said Mrs Pope, holding up a bright red mini-skirt. ' People have no idea of what is needed.'
'Some oriental women are very small,' said Letty doubtfully. 'So I suppose they could wear it. Of course one doesn't really know what they need – it's so difficult to visualize...' The horror of the pictures on Mrs Pope's television screen seemed so totally unconnected with the heaps of unsuitable garments piled on the floor of Mrs Musson's dining room. Mrs Pope had refused to receive the clothes in her own house. 'Nobody would expect a woman in her eighties...' she maintained, and of course she had a point there, even if it was not absolutely clear what it was. Letty suspected that it might be an old deep-rooted fear of 'fevers and diseases' that made her avoid too close contact with other people's cast-off clothes. As for nobody expecting a woman in her eighties to house this jumble of old garments, that really had nothing to do with it, for Mrs Pope did exactly those things that she wanted to do which made Letty realize that perhaps getting older had some advantages, few though these might be.
During the months since her retirement, Letty had tried conscientiously to enter into the life around her in the north-west London suburb where she now found herself. This meant, as Edwin had imagined her, taking part in the activities of the church, sitting rather far back, trying to discover what church-going held for people, apart from habit and convention, wondering if it would hold anything for her and if so what form this would take. On a bitter cold evening in March she joined a little group, hardly more than the two or three gathered together, shuffling round the Stations of the Cross. It was the third Wednesday in Lent and there had been snow, now hard and frozen on the ground. The church was icy. The knees of elderly women bent creakily at each Station, hands had to grasp the edge of a pew to pull the body up again. ' From pain to pain, from woe to woe...' they recited, but Letty's thoughts had been on herself and how she should arrange the rest of her life. Easter was of course better, with daffodils in the church and people making an effort with their clothes, but Whitsun was bitterly cold, with a leaden grey sky and the church heating turned off. Did people then only go for the light and warmth, the coffee after the Sunday morning service and a friendly word from the vicar?
Once Edwin had come to the service and Letty had greeted him so warmly that he must have taken fright, for he had not appeared again. ' Oh, he goes round to a lot of churches, as it takes his fancy,' somebody had pointed out and of course Letty knew that this was true. Not even Father G. had his undivided allegiance. 'He's a widower,' Mrs Pope had said, ' but of course you know that, working with him. And he took a lot of trouble finding a room for you when that black man bought the house you were living in. He must think a lot of you – he spoke very warmly.' For Mrs Pope this was going far, but the doubtful prospect of Edwin's 'warmth' did nothing to warm Letty's cold heart.
Now at least she felt that she was doing something useful, helping to sort out and pack clothes for aged refugees. She would have preferred something a little nearer home, people she could have pictured actually wearing the clothes, even the scarlet miniskirt, but it was not to be. Everything at all suitable was just bundled into black plastic bags, while the less suitable was cast aside for jumble.
'You'll be giving the room a good clean out after this, of course,' said Mrs Pope and Mrs Musson had to agree, feeling bound to point out that she cleaned the room every day anyway.
'I suppose the clothes could have been sent to the church hall?' Letty suggested.
'Oh, that wouldn't have done at all,' said Mrs Pope, but Letty, even with her newly acquired experience of parish affairs, did not yet possess the particular item of esoteric knowledge that would enable her to solve this problem. All was never as it might seem to be.
'What a lovely evening,' Letty said, looking out of the window. 'All that laburnum!'
Norman, coming back from work, did not notice the laburnums in full flower in the square garden, but his heart lifted when he saw that an old car, which had been dumped there for over a week, appeared to have been removed. He had got on to the police and the council about that, and the fine summer evening gave him a sense of achievement, an unusual and agreeable sensation for him. This gave way to a feeling of restlessness, so that after he had fried bacon and tomatoes and opened a small tin of his favourite butter beans, it did not seem quite enough to settle down in his bedsitter with the _Evening Standard_ and the radio. He felt he wanted to go out, take a bus somewhere to another part of London, any bus, the first one that came, if one ever _did_ come, he added sardonically.
A bus did come and he got on it and took a ticket to Clapham Common, realizing after he had done so that Edwin lived in that direction, but of course it was most unlikely that he would run into him. He was probably at some fancy service at one of his many churches.
On top of the bus, Norman settled down for the long ride – it cost enough anyway, he thought. He sat on the front seat, like a visitor to London, observing the scene around him, sights passing before his eyes – well-known landmarks, buildings, the river; then gardens and people in them doing things to lawns and hedges, and in the roads men engaged in the rituals concerned with the motor car. When he got to a suitable stopping place he climbed down from the bus and began to walk aimlessly. Now he was not at all sure why he had come or what he was going to do when he got there, wherever 'there' might be. Turning off the common he came to a side road, and just as Edwin had done some time ago he realized that he was looking at the name of the road where Marcia lived. But unlike Edwin he did not turn away but began to walk down it, though with no clear plan in his mind. He certainly did not intend to call on her, he didn't even remember the number of her house. But wouldn't it be easy to pick it out, he asked himself, wouldn't it stand out as being different from the smartly tarted-up suburban semi-detached Victorian villas with their pastel-coloured front doors, carriage lamps, paved patios and car-ports?
Of course he was right. Marcia's house, with its flaking green and cream paint, dusty laurels and dingy curtains, was unmistakable. He stood on the opposite side of the road and gazed in stunned fascination, very much as he had gazed at the mummified animals in the British Museum. The house looked deserted, the curtains half drawn, and although it was a warm evening there was no crack of window open. The garden, as far as Norman could see, was totally neglected, but a magnificent old laburnum tree was in full flower. Its branches drooped over a ramshackle little garden shed, and as he stood there he saw Marcia coming out of the shed with her arms full of milk bottles. Her hair was quite white and she was wearing an old cotton dress patterned with large pink flowers. It was such a strange sight that he was as if rooted to the spot. He had a feeling that she had seen him and for an instant they seemed to stand staring at each other – again it was like the British Museum encounter with the mummified animals – giving no sign of mutual recognition. Then Marcia disappeared from view, presumably going into the back of her house, he thought.
Norman crossed the road with no clear idea of what he should do. Ought he to go up to the door and ring the bell, make himself known? His instinct was to run away, but before he could make up his mind he saw that a young woman was approaching the house from the opposite direction. She walked purposefully and when she saw Norman, loitering in front of Marcia's house, she said sharply, ' Going to see somebody here, are you?'
'Oh no, just taking a walk,' said Norman quickly.
'I've been watching you,' Janice went on. 'Do you know somebody in this house?'
'What's that got to do with you?' Norman snapped.
'We have to be on the lookout – everybody has to. There've been some break-ins round here lately.'
'Charming, I must say!' Norman burst out. 'I shouldn't think Marcia Ivory's got much worth stealing.'
'You know her then? I'm sorry, but you know how it is – one gets so suspicious.' Janice smiled. ' As a matter of fact I was just going to call on Miss Ivory – I'm a volunteer social worker.'
'Keeping an eye on her, are you?'
'That's it. I pop in every now and then.'
'That's good. Well, cheerio, I must be on my way.' Norman began to move off.
'Aren't you going in to see her now you're here?' Janice asked.
'Oh, I have seen her,' said Norman, some distance away by now. And of course, in a sense, that was true. That sight of her with the milk bottles surely counted as seeing and it had been enough. Once seen never forgotten, he thought. But at least he would be able to tell Edwin that although Marcia's house looked a bit grotty, as the modern expression had it, a brisk young social worker was keeping an eye on her. It didn't necessarily follow, though, that he would tell Edwin about this evening – he didn't want to have to explain what he had been doing in that part of London, what sudden impulse had sent him there. It had been just one of those things and Edwin probably wouldn't understand that.
In the house Janice was saying in her brightest tone, 'I see you had a visitor just now.'
Marcia stared in the disconcerting way she always met any comment or question.
'The gentleman I saw in the road.'
'Oh, _him_!' Marcia was scornful. 'That was just somebody I used to work with. I don't want anybody like _that_ coming to see me.'
Janice sighed. Better leave the subject of the gentleman visitor, that funny little man. 'And how have you been getting on?' she asked. 'Been shopping today, have you?'
# Seventeen
Walking in the wood Letty came upon a sheet of wild garlic. 'Oh, how lovely!' she exclaimed. 'You should have seen the bluebells,' Marjorie said, with the enthusiastically proprietary air of the country dweller. 'They were wonderful this year, but they're nearly over now. You should have come a fortnight ago when they were at their best.'
You didn't ask me then, Letty thought, for it was only now, when David was away on a visit to his mother (in her ninetieth year, Letty recalled), that Marjorie had suggested that she might like a few days in the country.
'This is almost like old times, isn't it?' Marjorie went on.
'Yes, in a way,' Letty agreed, taking note of the 'almost', ' but so much has happened.'
'Yes, hasn't it! Who would ever have thought... that first time I met David, I really had no idea...' Marjorie proceeded to recall that first meeting and the subsequent development of her relationship with the man she was about to marry. Letty allowed her to ramble on while she looked around the wood, remembering its autumn carpet of beech leaves and wondering if it could be the kind of place to lie down in and prepare for death when life became too much to be endured. Had an old person – a pensioner, of course – ever been found in such a situation? No doubt it would be difficult to lie undiscovered for long, for this wood was a favourite walking place for bustling women with dogs. It was not the kind of fancy she could indulge with Marjorie or even dwell on too much herself. Danger lay in that direction.
Marjorie still had the idea that Letty might find a room at Holmhurst and that evening they were to have supper with Miss Doughty, the resident warden.
Beth Doughty was a smartly dressed woman in her middle forties, with a rigidly controlled hairstyle, sharp eyes, and heavy make-up which gave her a curiously old-fashioned look. She poured generous tots of gin, explaining that in her job you really needed what she rather oddly described as 'moral support'. Letty found herself wondering if she really liked old people, but perhaps efficiency was more important than liking and she certainly gave the impression of being highly capable.
'Do you think Letty could find a place at Holmhurst?' Marjorie asked. ' You thought there might be another vacancy soon.'
'You wouldn't like living here, not after living in London,' Beth declared. 'Just look at them now – come to the window.'
Letty stood looking out, glass in hand. Three old ladies – an uncomfortable number, hinting at awkwardness – were walking slowly round the garden. There was nothing particularly remarkable about them except their remoteness from any kind of life. Suddenly Letty felt indignant with Marjorie for supposing that she would be content with this sort of existence when she herself was going to marry a handsome clergyman. It was all of a piece with that life of forty years ago, when Letty had always trailed behind her friend, but there was no need to follow the same pattern now. As Beth Doughty topped up her glass, she resolved that a room in Holmhurst was the last thing she'd come to – better to lie down in the wood under the beech leaves and bracken and wait quietly for death.
'This is one of Father Lydell's favourite dishes,' said Beth, bringing a covered casserole to the table. ' _Poulet niçoise_ – I hope you like it.'
'Oh, yes,' Letty murmured, remembering the times she had eaten _poulet niçoise_ at Marjorie's house. Had David Lydell gone all round the village sampling the cooking of the unattached women before deciding which one to settle with? Certainly the dish they were eating this evening was well up to standard.
Afterwards Marjorie said, 'It was rather funny about the _poulet niçoise_ and the way Beth had to let us know that she had asked David in to meals – she made a dead set at him, you know.'
'And that wine we had – Orvieto, wasn't it?'
'Yes – another of David's favourites. It's really quite amusing, isn't it?'
Letty was doubtful about this, for the ridiculous little episode had given her a glimpse of something deeper that she did not particularly want to probe.
'I do wonder how Beth Doughty manages to rise to all that gin,' Marjorie went on, 'so expensive now. Luckily David doesn't care for spirits.'
'Well, that's a blessing, isn't it,' Letty agreed, feeling that there was something obscurely wrong about this juxtaposition of spirits with blessing, but unable to supply an appropriate modification.
That evening Marcia paid a visit to the doctor. She had not made an appointment and was not even sure which of the three doctors she would be seeing, but it did not really matter since none of them was Mr Strong. She was content to sit for anything up to two hours, not even glancing through the tattered magazines but just observing the other people waiting. Most of these, in her opinion, need not have been there at all. She wondered how many of them, if any, had undergone 'major surgery', as she had. The majority were young, as if they had just come from work, and appeared to have nothing whatever the matter with them. All they wanted was a certificate. Wasting the doctor's time, she thought – no wonder the National Health Service was in such financial trouble.
When her name was called she was still indignant, and had it been the young woman doctor or the honey-voiced Middle-Eastern one behind the desk she would have gone on seething. It was neither of these but the one she called her 'own' doctor, a middleaged man with a kindly, anxious expression. This was the doctor who had sent her into hospital in the first place, who had seen that lump on her breast.
'Well, Miss Ivory...' his hands moved among a sheaf of papers. 'And how's the world treating you?' Mastectomy, he thought. Odd, difficult; a glib but accurate diagnosis of this particular patient. 'How have you been?'
Marcia needed no more encouragement but proceeded to tell him. What she said was not altogether coherent or even relevant, but the doctor was given a decided impression that all was not quite as it should be. She grumbled about the social worker, her neighbours who wanted to mow her lawn, her inability to locate the grave of her dead cat and the suspicion that 'somebody' might have moved it, the difficulty of keeping a check on her collection of milk bottles, a man she used to work with who had come spying on her, the closing of a branch of Sainsbury's near her old office – it was all jumbled up in a great flood of complaint. The doctor was used to patients going on in this way, so he only half listened while examining her and taking her blood pressure and wondering what on earth to do with her. She told him that she was due for another check-up at the hospital soon, so that rather took things out of his hands. No doubt Strong's boys would suggest something. In the meantime he urged her to look after herself and to get more to eat – she was much too thin.
'Oh, I've never been a big eater,' Marcia declared with her usual pride. ' But nobody can say that I don't keep a good table. You should just see my store cupboard.'
'I'm sure you're an admirable housekeeper,' said the doctor diplomatically, 'but you must promise me that you'll go home and cook yourself a really good meal. Not just a cup of tea and a bit of bread and butter, Miss Ivory. I don't know what Mr Strong is going to say when he sees you looking so thin.'
The mention of Mr Strong's name had the desired effect and Marcia assured the doctor that she would go back at once and cook something. All the way home she thought of Mr Strong and the kind of meal the surgeon would most likely be having this evening – steak, perhaps, or a nice bit of fish, salmon or halibut, with fresh vegetables from his garden. She was sure there were vegetables in that garden although she had not been able to see the back of it when she had gone to look at his house last year. It might be possible to catch a glimpse of beans and lettuces or cabbages and broccoli – Marcia's gardening days were so long past that she had no clear recollection of what vegetables would be in season. Should she go there now on a bus and make sure? Perhaps there was a side entrance to the house which would give her a view of the back garden...
It was beginning to get dark and while she hesitated a bus drew up at the stop, illuminated like some noble galleon waiting to take her on a voyage of discovery. Inside the brilliantly lit interior, women who had come from late-night Thursday shopping in the West End chatted and compared the things they had bought – wasting their money, Marcia thought, choosing an empty seat in the front and holding herself aloof from the chattering women.
When she got to the stop for Mr Strong's house, she realized that even if she could see the vegetable garden it was now too dark to discern what was growing there, and anyway she had forgetten why she had wanted to see them in the first place. And perhaps there wasn't a vegetable garden, just a lawn with a herbaceous border or even a tennis court. But it didn't matter, she thought, as she approached the house, for now she saw that it, like the bus, was brilliantly lit up – resembling a great liner in mid-ocean rather than a galleon, what she imagined the _Queen Mary_ might have been – and that elegantly dressed people were alighting from cars and walking up the drive. The Strongs were obviously giving a party.
Marcia stationed herself on the pavement opposite, instinctively choosing a dark corner under a tree, away from the street lamp. Was it a dinner party or an evening party? She did not feel capable of guessing what kind of an evening party, for she could only think of 'wine and cheese', which seemed altogether unworthy of Mr Strong.
When she had been in hospital, there had naturally been talk in the ward about the various consultants when they came on their rounds, and speculation as to their wives and families. Some of them, of course, had married other doctors or nurses, women they had met in the course of their work, but it was always said that Mr Strong had done rather better than that. It was rumoured that he had married the daughter of a 'diplomat' who had a house in Belgrave Square. Marcia had never quite believed this, not wishing to speculate overmuch on Mr Strong's wife anyway, but now, watching the guests arrive, she was prepared to believe that there might be something in it. In a kind of dream, she stood watching until there was a gap in the cars arriving and it seemed that no more would come.
Then suddenly she found herself thinking about Norman and the way she had seen him standing on the pavement opposite her house when she was putting milk bottles into her shed. She had resented his being there, resented what seemed his prying curiosity into her affairs. Could it be that her standing outside Mr Strong's house would be seen in the same way?
She looked up at the house and then crossed the road, so that she could hear voices and laughter coming from a room on the ground floor. Then she moved slowly on, making her way back to the bus stop. As luck would have it, the right number bus was just coming up to the stop and she had to run to catch it.
The exertion was almost too much for her and she collapsed on to the nearest seat, unable to collect her wits for a moment to ask for her ticket. But after a while she recovered, partly out of self-defence and resentment at the loud patronizing voice of the conductress's 'All right, dear?'
'Of course I'm all right,' she said stiffly.
But when she got home she realized that going to the doctor and then on to Mr Strong's house had made her more tired than usual. Well, it would stand to reason... she found herself thinking of the kind of thing Norman said. And 'it takes it out of you' – that was another of his expressions.
Sitting down at the kitchen table, she remembered that she had promised the doctor that she would go home and get herself a good meal but the thought of having to cook was too much for her. Elderly people didn't need much food, anyway – surely the doctor must realize that? A cup of tea, of course; that was a stimulant, and now that she had discovered tea bags it was so much less trouble. At the supermarket she had bought a packet of 144 tea bags which she reckoned ought to last her about seven weeks all but one day. But long before that she would be at the hospital; the card indicating the date of her appointment at Mr Strong's out-patients' clinic was on the mantelpiece. Not that she needed reminding, especially not after what she had just seen.
The thought of it impelled her to go to the store cupboard to fetch a suitable tin of something. There was still a tin of pilchards left over from Snowy's larder, but perhaps luncheon meat would be better? It had a little key to open it, but before she had gone very far the metal tab broke off and she lacked the strength to manoeuvre it any further. So she abandoned the half-opened tin on the draining board and contented herself with a couple of digestive biscuits, which was really all she wanted.
'You didn't go in then, or make yourself known?' Edwin asked Norman.
'What do you take me for! Can you imagine the sort of reception I'd have got! She was standing by the shed with a pile of milk bottles in her arms and she must have seen me.'
'Yes, and knowing what she's like I can imagine you wouldn't want to intrude,' Edwin agreed.
'Intrude!' Norman gave his bitter little laugh. 'That's a nice way of putting it. I met that social worker and she thought I was casing the joint.'
'Well, she's right to be careful – there's always a risk of that these days,' Edwin said. 'I'll stroll past there one evening and see if there's anything I can do.'
But of course Edwin was not at all sure what there would be, if anything. The idea of being able to 'do' something for Marcia was so improbable that he had only said it to ease his conscience a little. After all, he and Norman had worked with her and it would no doubt seem to an outsider that they might be just the people to be in a position to help her or at least to offer help, to show willing, as Norman might say. This particular evening, being Corpus Christi, Edwin had a service at his own church, with an open-air procession, which started at eight o'clock and would probably last for at least an hour. After that he would go to the pub with Father G. so there wouldn't really be time to visit Marcia. Perhaps the weekend would be better, Saturday afternoon or Sunday before Evensong. Then he wouldn't have to stay too long.
'Of course, I'm not often down that way,' Norman pointed out. 'Not exactly my stamping ground, Clapham.'
'You're really nearer to Letty,' Edwin said.
'So what? You're surely not suggesting I should drop in on her?'
For some reason the idea of this caused the two men to break into laughter, so that what had started out as a serious attempt to deal with a social problem turned into a kind of joke. But there was no reason why, as Norman put it, they should fall about laughing at the prospect. It wasn't all that funny. Nervous reaction, perhaps, but why nervous, Norman wondered. Something in the subconscious, Edwin suggested, but that set them off into more laughter, the idea of Letty and Marcia being somehow mixed up in their subconsciousnesses. It was not an area they were in the habit of discussing or even thinking about.
# Eighteen
'Miss Ivory, aren't you going to let me in?' As she stood on the doorstep, Janice wondered whether anyone else had been to see Marcia during her fortnight in Greece. This seemed unlikely because it wasn't as if Marcia was an invalid or unable to cope, even if she was a bit eccentric. And anyway she was Janice's special pigeon, if you could put it like that.
There was a fine display of late summer flowers in the gardens along the road – dahlias and asters, early chrysanthemums and a second flowering of roses, and even Marcia's garden had some tall yellow daisies clustering round what Nigel and Priscilla called the milk-bottle shed. They had never been inside it but had often seen Marcia going in and out with the bottles. It seemed a curiously dotty occupation, but harmless enough – just the kind of thing Marcia would spend her time doing, but no more to be condemned than other people's preoccupation with collecting matchboxes or cigarette cards. One _must_ respect people as individuals – her acquaintance with Marcia had taught Janice that, if nothing else. All the same, she felt that she really must try to persuade Marcia to take a holiday. Not Greece, of course, or indeed anywhere 'abroad' – one could hardly imagine Marcia in a taverna, eating octopus or anything that wasn't meat and two veg – but a few days in Bournemouth or a coach tour of the Cotswolds would be just the thing to set her up for the winter.
'Miss Ivory!' Janice rang the bell again and banged on the door. It was most unlikely that she was out, though perhaps it was just possible. Should she try the door to see if it was open? Janice did try it and it was locked. Perhaps if she went round to the back she would be able to get into the house, though if Marcia had gone out she would surely have locked the back door as well. If only Nigel and Priscilla were here she could ask them, but Janice knew that they were in Sardinia, lying on some beach, not even thinking of their fashionable little house in that up-and-coming district by the common and their peculiar next-door neighbour. One certainly got completely away from that kind of thing on holiday, Janice thought, not without bitterness.
It was then that she noticed several bottles of milk, not on the front step but in a little wooden container round the side, no doubt an arrangement made for milk to be left when Marcia went out to work, to keep it out of the sun or safe from thieves. This sight alarmed her, and she hurried round to the back door – perhaps Marcia was lying ill in bed, unable even to get downstairs to take in her milk. If she could get into the back of the house she could call to her, and if she was in bed Marcia would answer. Or she might have had a fall and be unable to move or get to the telephone. Did Marcia have a telephone? Probably not. With neighbours away she could lie for hours, helpless... Janice knew in theory every kind of situation that could arise, but when she peered through the glass panel of the back door she was not prepared for the sight of Marcia sitting at the table, slumped into unconsciousness, possibly even death.
Janice noticed the cup of tea and the tin of biscuits ('Family Assorted') on the table, as she knocked feebly on the door, calling 'Miss Ivory' in a half-fearful tone, hardly expecting or wishing for an answer. Then she tried the handle of the door. It opened and she realized that it was perfectly possible for her to go in.
'Of course she's not in my parish,' said Father G., with a hint of impatience. 'You know what these parish boundaries are – one road's in, the next one isn't.'
'I know that,' said Edwin. 'I was just going to stroll along that way and I thought you might like to come too – after all, it's a nice evening for a walk. She's a funny sort of woman, as I told you, we may not even be invited in.'
'Who is my neighbour?' Father G. mused, as he and Edwin came to the road where Marcia lived. 'Surely one has preached often enough on that text? Perhaps that's where we go wrong – obviously it _is_ – when my reaction to your suggestion is that the person in question isn't in my parish.'
'Well, she must be in somebody's parish,' Edwin pointed out.
'She certainly is,' said Father G. promptly, and he named a well-known local vicar, 'but I don't think he goes in much for parochial visiting. Trendy Tony,' he added, unable to resist the uncharitable comment. 'Rock-and-roll and extempore prayers.'
'Of course there's a social worker who goes to see her regularly, keeps an eye on her, as the saying is, but when I saw her earlier in the year – we all had lunch together, you see – I thought perhaps I ought to do something about her, make more of an effort.'
'What about this other woman you were telling me about, there was another who worked with you, wasn't there? I should have thought...' Father G. suggested, with the comfortable assumption of so much that could be left to the women.
'Yes, in a way you would have thought...' Edwin smiled. 'But then you don't know Marcia – Miss Ivory. Come to that, who does know her?'
'Who does know anyone?' said Father G., hardly contributing to the solution of the problem of Marcia.
'Well, this is it, I believe – the house where she lives. You can see how different it looks from the others and that tells its own story.'
Father G. was used to visiting shabby houses, but he had to admit the contrast between Marcia's and the other houses in the road. 'You'd better go up to the door,' he said. 'You know her, and if she's a difficult woman the sight of me might put her off. She might refuse to open the door.'
Janice, coming round the side of the house, was encouraged rather than put off by the sight of Father G., in his priestly cloak, standing behind Edwin. Although she had little use for the Church of England, or indeed for any organized religion apart from a mild, superstitious veneration for what she thought of as 'Catholics', she could not deny that it sometimes had its uses. The fact that this respectable-looking stranger – for so Edwin appeared to her – was accompanied by a clergyman was reassuring. They would certainly know what was the best thing to do.
'If you've come to see Miss Ivory,' she said, 'I'm afraid something's happened. She seems to be ill, or...' She did not like to say ' dead'. 'She's sitting at the table in her kitchen, not moving – I saw through the window. I was just going to find help...'
As it happened, Janice could not have met at this moment with two persons better able to assist her. Edwin had come home one evening some years ago to find his wife Phyllis unconscious in the kitchen, about to put a shepherd's pie in the oven; Father G. was often obliged to enter houses where people were on the point of death or had already died; indeed he preferred this type of situation to normal parish visiting, with its awkward conversation and the inevitable cups of tea and sweet biscuits. Both the men were prepared to take control.
The main thing was that Marcia was not _dead_. She even smiled faintly at Janice who was fussing about packing a case of suitable things for hospital while they waited for the ambulance.
'It was amazing,' Janice said afterwards. 'When I came to look out her things, there was a drawer full of new Marks and Sparks nighties – not at all what you'd imagine Miss Ivory wearing, judging by the rest of her clothes. All brand new and never worn – she must have been saving them up for something.'
After the ambulance had gone, with Marcia and Janice in it, the two men were left alone in the house. They had all been sitting in the kitchen where Janice had made tea. Edwin felt awkward, now that Marcia had been removed, as if he had no right to be sitting in her house when he had never been in it before.
'It's a strange relationship, working with women like that,' he said. 'The curious intimacy of the office is very definitely _not_ repeated outside it – one would not presume...' He remembered how he and Norman had been overcome with laughter at the idea of Norman visiting Letty or of any kind of social contact between the four of them. Visiting Marcia had always seemed an awesome prospect, hardly even to be contemplated.
'You never thought of coming to see her, living as near as you do, just a few steps across the common?' Father G.'s tone was enquiring rather than reproachful.
'I thought of it – once or twice I came near to it – but I never did.'
Father G. finished his tea and stood up, holding the cup in his hand. 'Do you think we should...?'
'Wash up? Oh, I think Mrs Brabner, the social worker, will probably see to that. I don't think we should get involved.'
So the men left the house, remembering to lock up behind them. Neither had commented on the state of the kitchen and hall, the dust and other evidences of long neglect. Father G. genuinely did not notice such things and Edwin, with a general impression that all was not quite as it should be, still preserved the same detachment towards this as towards other aspects of Marcia's life. What he did carry away with him was an irrelevant detail, the sight of a half-opened tin of luncheon meat still on the draining board. It had always surprised him how ineffectual women were when it came to opening a perfectly simple tin.
It was natural for them both to feel the need of a strengthening and reviving drink when they found themselves some distance away from Marcia's house. They had undergone an unexpectedly upsetting experience. Little had Edwin imagined that a casual stroll across the common in the direction of Marcia's house could have such an outcome. Yet what had the outcome been? Marcia had been found in a distressed condition, but she had been taken away in an ambulance to hospital where she would receive the best possible care. There was nothing further that anyone could do. All the same, the need for a drink was uppermost in his mind, and then supper – the events of the last hour had delayed the evening meal and it was well known that an upsetting experience had unexpected results, not necessarily the most suitable or desirable ones. There was a hollow feeling in his stomach and he remembered that he had not eaten since lunch.
'You'll stay and take pot luck with me?' he said to Father G., knowing that there would be little cheer at the vicarage. He at least had the remains of a casserole in the larder.
'That's good of you – I'm quite hungry.'
Edwin poured sherry. Had it been the kind of upsetting experience that called for brandy? he wondered. On the whole he thought not, for it did not touch him personally. All the same, he ought to get in touch with Letty, who would no doubt want to visit Marcia in hospital. Come to that, he supposed they all ought to; the three of them should cluster round her bed. Again he found himself wanting to smile, almost to laugh, and if Norman had been with him at that moment instead of Father G. he felt that the smile might have turned most regrettably into laughter. It was disconcerting the way this happened – any idea of the women now seemed to be a subject for comedy. But with Father G. it was different. In the midst of life he was so continually in death...
'Do you think I should visit her in hospital?' Father G. was asking. ' I easily could – the chaplain there is an old friend. She might feel that as I saw her, found her, as it were...'
'I don't know what Marcia would feel. But I'm sure she would like to have a visit,' said Edwin uncertainly, for he was not at all sure. How could anyone be sure about Marcia?
The next morning Edwin had to break the news to Norman.
'I should've thought a loony bin would have been more to the point than hospital,' said Norman, in a rough way that might have concealed an obscure emotion. 'What are we expected to do – send flowers by Interflora – have a whip round in the office?' He was standing by the window and shook himself like an angry little dog coming out of the water.
'I'll get some flowers and take them round – the hospital's not far from where I live,' said Edwin soothingly. 'And I'll get in touch with Letty.'
Norman fumbled in his trousers pocket and produced a fiftypence piece. 'You'd better say they're from all of us, the flowers. Here's something towards it.'
'Thank you. I won't ask to see her, just leave the flowers,' Edwin said. It was a relief that the general embarrassment of the situation had not made them burst out laughing, as he had feared. Perhaps there were some things, hospitals especially, that were still sacred.
'I wouldn't want to go and see her,' Norman said. 'I did go when my brother-in-law, Ken, was in hospital, but then he had nobody and being the blood-tie and that I felt I had to.'
Edwin was about to point out that a brother-in-law wasn't exactly a blood relation but he thought it best to leave the subject, and if they got to talking about people having nobody it might well be remembered that Marcia also came into that category.
In Mrs Pope's house the telephone rang just as she and Letty were settling down to watch television. They quite often did this now, and although it had started by Mrs Pope suggesting that Letty might like to watch the news or some improving programme of cultural or scientific interest, there was now hardly an evening when Letty did not come down to watch whatever happened to be on the box, whether it was worthy of attention or not.
'Oh, bother, who can that be?' said Mrs Pope, going out into the hall. 'It's for you,' she said accusingly to Letty. 'People ought not to ring up at such a time.'
Letty went apologetically to the telephone. Of course there was really no suitable time to ring people in the evening now that television had been invented, for with the choice of three programmes one of them was certain to be the one somebody was watching. Even the worst had their adherents and who was to judge what was 'worst', the kind of thing that nobody could possibly want to see?
When Letty came back into the room, Mrs Pope looked up expectantly. Letty did not have many telephone calls and never seemed to make any. 'It was a man's voice,' she said encouragingly, 'so I knew it couldn't be your friend in the country.'
'No, it was Edwin Braithwaite.'
'Oh, Mr Braithwaite.' Mrs Pope waited for Letty to go on.
'He was ringing to tell me that Marcia Ivory who used to work in the office had been taken into hospital.'
'Taken into hospital!' Mrs Pope's interest was immediately aroused and Letty had to repeat what Edwin had told her about Marcia's collapse and the summoning of the ambulance. This led on to further probing from Mrs Pope so that in the end Letty found herself having to recount the history of Marcia's operation and to supply as many details as she knew.
'But how did Mr Braithwaite know about it?' Mrs Pope asked.
'Apparently he found her, discovered her in a state of collapse in her kitchen.'
'That doesn't sound like him,' Mrs Pope objected.
'I think he had a clergyman with him – would it be the vicar, perhaps, paying a call?'
'Yes, I suppose it could be that. But don't you think it more likely that he and the lady were friends, after all, working together and living so near...'
Letty found herself unable to comment on this supposition. A relationship between Edwin and Marcia was really going too far. You ought to see her, she thought of saying, but a charitable impulse held her back. One did not make remarks of that kind about a person lying dangerously ill in hospital. And life was in many ways so fantastic that for all Letty knew there might indeed be something between Edwin and Marcia. A married woman – and she must not forget that Mrs Pope was that – might very well be able to detect subtle shades of meaning in a relationship which would be lost on the inexperienced Letty. For of course there had been Mr Pope, no more to Letty than a photograph in Mrs Pope's sitting room, and it was not for her to probe beyond that patientlooking face in the silver frame. And now the television screen was beginning to claim their full attention.
By a coincidence they were taken into a hospital setting, not in a popular romantic way but as the background for surgical investigation. An operation was in progress, with commentary and informative pictures.
'Amazing what they can do now,' said Mrs Pope, in a satisfied tone. 'But of course your friend won't be having anything like this.'
'Oh, no...' Letty was apologetic. 'I expect she'll just be lying there.'
'If we had colour,' Mrs Pope went on, 'we should be able to see _exactly_ what the surgeon was doing. There would be _real_ blood, not tomato ketchup, as I've heard they use in these violent films.'
'I don't think I should want to see exactly,' said Letty, turning away from the black and white close-up of a pulsating heart and concentrating on her tapestry.
'We have to see these things, whether we like it or not,' Mrs Pope declared, for she had noticed Letty turning away from the screen. ' No point in shutting your eyes to them.'
Letty wanted to protest – they could just as easily have been watching a Western on the other channel, but they didn't _have_ to watch that either.
'Has Mr Braithwaite got colour?' Mrs Pope asked.
Letty had to admit that she didn't know, or even whether Edwin had television at all. He had never mentioned it, in the same way that he had never given any indication of having any special feeling for Marcia. If anyone had that, it was Norman, she felt, thoroughly confused.
# Nineteen
Marcia had always appreciated the drama of an ambulance and even wanted to ride in one, but when the time came she was hardly in a position to realize that she was at last achieving this unusual ambition.
'Unreachable inside a room' she may have been, yet there was no sense of that little room becoming an everywhere, in the fantasy of an earlier poet. No fragment of poetry from long ago lingered in Marcia's mind as she lay under a red blanket. She had been aware of people coming into the house as she sat at the kitchen table, thinking she heard Edwin's voice and imagining herself back in the office, but where was Norman? She was also half conscious of Janice Brabner fussing around her, seeming to panic a bit. Marcia tried to tell her that she had half a dozen new nighties, never worn, tucked away in a drawer upstairs, and also to explain about the card on the mantelpiece giving her next appointment at out-patients, but she found herself unable to speak. She tried, but no words came. Then she heard Janice going on in her silly way about the nighties, ' all brand new and never worn', and that was when she smiled. Of course they were new, specially chosen for this occasion. Already she had moved away from Janice, and soon she would be out of the reach of all social workers trying to make her do things she didn't want to do, like going down to ' the Centre', buying fresh vegetables and taking a holiday.
The only disappointment was that there was no bell ringing on the ambulance, as she had sometimes heard that exciting clamour at lunchtime, when there had been an accident somewhere near the office. It was all very quiet and efficient, the way the ambulance men lifted her up and laid her down and called her 'dear', and said she wasn't much of a weight. But when she found herself at the hospital there seemed to be a crowd of young doctors round her bed, so they must have thought she was important. Marcia didn't recognize any of them from the time before – housemen, she supposed, doing their six months on the wards, and perhaps one of them was the Registrar. Two of them examined her, but another couple, who presumably ought to have been attending, seemed to be talking about some dance they were going to or had been to, and that seemed wrong. She was certain that Mr Strong wouldn't approve of that.
Later, it must have been much later for she was now in a different place altogether and the young doctors had gone, she found herself wondering when she was going to see Mr Strong, and then worrying in case she might not be seeing him at all but some other surgeon or just an ordinary doctor. She must have spoken his name aloud, for the young round-faced nurse who was settling her pillows said, ' Don't you worry, Miss Ivory, Mr Strong'll be round in the morning.'
'Flowers for you, Miss Ivory! Well, somebody loves you, don't they?' It was a loud, bright voice that reminded Marcia rather of Janice, but of course it couldn't be Janice. 'Lovely, aren't they – chrysanths, and such an unusual shade. Shall I read the card for you, dear? You'll want to know who they're from. It says, "Letty, Norman and Edwin, with all good wishes and hopes for a speedy recovery". Isn't that nice!' In the nurse's mind Letty and Norman were a married couple with a little boy called Edwin, rather an unusual name, that, as uncommon as the pinky-mauve chrysanthemums.
Marcia smiled but did not comment, and the nurse did not expect her to. Poor soul, she was hardly up to that. Some hopes for a 'speedy recovery'!
The woman in the next bed looked at Marcia with interest. It livened things up a bit when a new patient came in, but Marcia just lay with her eyes closed so it wouldn't be much use trying to have a chat with her. Funny that she should have had those flowers when she looked the kind of person who wouldn't get any, and now two more lots had arrived. The nurse read out the cards again – one from 'Janice' (a posy of anemones), and the other (mixed garden flowers) from 'Priscilla and Nigel – so sorry to hear you're ill – get well soon'. Well, it didn't look as if _that_ was likely to happen, judging by her appearance. And when they weighed her she was only six stone.
There was a stir at the end of the ward – Mr Strong was approaching with an entourage of young doctors, and Sister wheeling a filing cabinet of case notes. ' He's coming, dear,' Marcia's neighbour whispered, but Marcia still lay with closed eyes, apparently unconscious. All the same, she knew that he was taller than the young doctors accompanying him and that he was wearing a green tie.
'Well, Miss Ivory, we didn't expect to see you again so soon.' Mr Strong's tone was kindly rather than reproachful, but she couldn't help wondering if she had displeased him in some way, for when she opened her eyes she saw that he was looking down at her, frowning a little. Then he turned to Sister and said something in a low voice.
'You've lost a lot of weight. Haven't you been looking after yourself properly?' This time there was a hint of sternness in his voice.
Marcia wanted to tell him that she had never been a big eater but she found it impossible to get out the words.
'Never mind – don't try to talk.' Mr Strong then turned to one of the young doctors. 'Well, Brian, you've got her notes – let's have your diagnosis.'
Brian, a youth with blond bobbed hair, said something in medical jargon but apparently Mr Strong was not satisfied because he turned to one of the other doctors for his opinion. This young man was even more at a loss than Brian. He mumbled something to the effect that the patient was in 'a terminal situation', a euphemism which fortunately meant nothing to Marcia who was conscious only of a flood of words. They were having quite a discussion about her.
'You're talking about me,' she said, almost in a whisper.
'Yes – you're certainly the centre of attraction today.' But Mr Strong said it so nicely, not in a nasty, sarcastic way, as Norman might have done.
'If they said "No visitors" then we can't very well barge in,' Norman pointed out, as he and Edwin sat in the office finishing their lunch. Jelly babies being in short supply, Edwin offered a packet of liquorice allsorts and Norman selected a brown and black one.
'I always think of her at coffee time,' Norman went on, ' the way she used to make coffee for me.'
'She used to make it for herself as well, not just for you,' Edwin corrected him.
'That's right – spoil my romantic memories,' said Norman flippantly. 'Poor old girl – not even allowed visitors. What did the nurse say when you rang?'
'She said Miss Ivory was quite comfortable, what they always say.' His wife Phyllis, on the point of death, had been 'comfortable' and perhaps that was one way of putting it. 'They want her to be kept very quiet, no excitement.'
'Yes, I suppose seeing us might be that – excitement,' Norman remarked.
'Oh, and Sister said how pleased she was with the flowers – such an unusual shade.'
'Did Marcia say that?'
'No, I don't think she did – that's what Sister thought. I gathered Marcia wasn't talking much herself. She certainly wasn't when we found her like that.'
'She wasn't much of a talker when she was here,' Norman mused. 'I wonder what they'll do with her now.'
'Sister didn't say whether she was to have an operation or anything like that,' said Edwin. ' I suppose we'll just have to wait and see. I'll keep in touch. By the way, it was a bit awkward. When I called round with the flowers they asked me if I knew whether she had any relatives, who would be her next of kin.'
'She must have given some name when she had her operation. I think she's got a distant cousin somewhere, she once said.'
'Oh, has she?' Edwin seemed a little embarrassed. 'I think they wanted somebody on the spot, as it were, so I had to give myself,' he admitted. 'I said I was her next of kin.' Saying the words like that seemed to open up endless possibilities.
'Sooner you than me!' said Norman roughly. 'Goodness knows what you may have let yourself in for.'
'Oh, I think it will just be a question of keeping in touch and that sort of thing. I felt it was the least I could do.'
'Let's hope it won't turn out to be the most,' said Norman in a dark tone.
'No visitors? Has she just had an operation, then?' Mrs Pope wanted to know.
'I don't think so. Just what Sister said, I gather,' said Letty.
'Well, we know what _that_ means. You mark my words.'
Letty had realized by now that Mrs Pope's words invariably did have to be marked. 'I should like to go and see her,' she said, but uncertainly, for she did not really want to visit Marcia in hospital, only felt that she ought to want to.
'You won't be able to do that,' said Mrs Pope.
'I suppose not, as things are at present. I must think of something to send her, apart from flowers.' But what? she wondered, remembering Marcia as she had last seen her. Toilet water, talcum powder, some really nice soap – these were the things Letty herself would have liked if she had been in hospital, but would Marcia? 'Perhaps a book,' she said doubtfully.
'A book?' Mrs Pope's tone rang out scornfully. 'What would she want with a book if she's not allowed visitors?'
'No, perhaps she wouldn't be able to read,' Letty admitted. And had Marcia ever read anyway, ever been seen with a book? Her visits to the library had been for quite other purposes. She was the kind of person who would say that she didn't have time to read – yet hadn't she once, surprisingly, quoted a tag of poetry, some left-over fragment of her school days that had stuck in her memory? Perhaps a book of poetry, then, a paperback with a pretty cover, nothing modern, of course... Letty toyed with this idea but in the end she decided on a bottle of lavender water, the kind of thing that could be dabbed on the brow of a patient not allowed visitors.
'If she's as bad as I think she is,' Mrs Pope went on, 'she won't notice whether you send her anything or not. And you are a pensioner – don't forget that.'
'All the same, I do feel I'd like to send her something,' Letty said, irritated by Mrs Pope's attitude. 'After all, we did work together all those years.' Two women working together in an office, she thought, even if they didn't become close friends, would have a special kind of tie linking them – all the dull routine, the petty grumbles and the shared irritation of the men.
'I thought it was only two or three years,' said Mrs Pope. 'Not a long time.'
'Yes, but it was an important stage in our lives,' said Letty, deciding definitely on lavender water.
Lavender. Mr Strong detected the scent of it above the hospital smells. It reminded him of his grandmother, not at all the kind of thing one associated with Miss Ivory, but on the other hand why should he have been surprised that Miss Ivory should smell of lavender? The really surprising thing was that he should have noticed anything at all like that about a patient, but the scent, that powerful evocator of memory, had caught him unaware, and for a brief moment he – consultant surgeon at this eminent London teaching hospital and with a lucrative private practice in Harley Street – was a boy of seven again.
Somebody had been fussing over her, tidying her up because Mr Strong was coming round, and we wanted to look tidy for Mr Strong, didn't we? There was a cool, wet feeling on her forehead. Somebody – Betty or Letty, was it, on the card? – had sent her this nice lavender water, such a lovely fresh smell, like a country garden. Miss Ivory had a garden, hadn't she, and did she have lavender in her garden? Marcia hadn't been able to remember whether she had or not; she only remembered the catmint at the bottom of the garden and how she hadn't been able to find Snowy's grave. All that time she had watched him growing cold until the fleas left his body, and now she couldn't find his grave. It would have been much more to the point if Nigel from next door had helped her to find that rather than fuss about cutting her grass which didn't really need cutting because she preferred it that way; it kept people out. One afternoon, she couldn't exactly remember when, she had caught Norman spying on her, hanging about in the road. She regretted now that she hadn't gone up to him and challenged him, asked him what he thought he was doing, loitering with intent, outside her house. Another time, when she had first gone to work in the office, she had followed him one lunchtime all the way to the British Museum, up the steps and along to that place where they had the mummies, and seen him sitting looking at the mummified animals with a crowd of school children. She had gone away, not knowing what to think... After that she had taken to making him coffee because it seemed silly for them each to get a tin when the big economy size was so much cheaper... But after that? She was confused – nothing seemed to have happened after that. She moved her head restlessly from side to side. She thought she could see the chaplain coming towards her, the hospital chaplain, or was it the trendy vicar from the church at the end of the road? They were both young, with that long hair. No, it was neither; it was Mr Strong's houseman; his name was Brian. It was nice the way Mr Strong called all the young doctors by their Christian names – Brian and Geoffrey and Tom and Martin, and Jennifer, the only girl among them.
The young doctor bent over Marcia. He didn't like the look of her at all – indeed she was the kind of patient one didn't like the look of at the best of times. Luckily Mr Strong was still around and it took only a minute to get him back again. He had been very concerned about Miss Ivory and would want to be around if anything happened.
Mr Strong was still wearing that green tie – was it the same tie or did he just like the colour green? It had a small, close design on it. His rather bushy eyebrows were drawn together over his grey eyes in a frown. He always seemed to be frowning – had she done something wrong? Not eaten enough, perhaps? His eyes seemed to bore into her – the piercing eyes of the surgeon, did people say that? No, it was rather the surgeon's hands that people noticed and commented on, like the hands of a pianist when, at a concert, people tried to sit where they could see the pianist's hands. But in a sense the surgeon was just as much of an artist, that beautiful neat scar... Marcia remembered what her mother used to say, how she would never let the surgeon's knife touch her body. How ridiculous that seemed when one considered Mr Strong!... Marcia smiled and the frown left his face and he seemed to be smiling back at her.
The chaplain, on his way to visit Miss Ivory, was told that he was too late. 'Miss Ivory's gone, passed on...' The words rang in his head like a television advertisement jingle, but he prayed for the repose of her soul and nerved himself for the meeting with her next of kin and other relatives. But the man he eventually saw didn't seem to be any relation at all, just a 'friend' who was stepping into the breach, as it were. Somebody who had worked in the same office. Rather surprisingly, he held the view that there was nothing to reproach oneself with for not having been able to prevent death when, for the Christian, it was so much to be desired. Everything concerning Miss Ivory was settled with calm efficiency, without recriminations and certainly without tears, and that was a great relief.
# Twenty
' Chapels of Repose or Rest, is that what they call them?' said Norman. 'The place where the deceased is put,' he added awkwardly, not quite accustomed to thinking of Marcia dead.
'It's rather nice,' Letty murmured, 'to put it like that, the idea of resting.' When her mother had died the body had remained in the house before the funeral. Letty could only remember feeling drained of emotion and worried about practical details, distant relatives suddenly appearing, and the arrangements for their lunch.
'Well, here we are all together today, just like we used to be,' said Edwin, but the others made no comment, for it was not quite like they used to be.
The three of them were having a cup of coffee in Edwin's house before the funeral service at the crematorium, for which he had made all the arrangements. Marcia's death had of course brought them closer together, for they were remembering their past association and perhaps wondering whether one of them would be the next to go, but not too seriously because they were all in good health and they had known about Marcia's operation and what it could lead to. The most important thing was that they were seeing Edwin's house for the first time, never having been invited into it before. Death has done this, Letty thought, looking around her with a woman's critical eye at the old-fashioned embroidered cushion covers and chair backs – Phyllis's work on those long evenings when Edwin was at meetings of the parochial church council? Norman's reflections were more of a practical and financial nature – that Edwin could take a lodger or even two and get quite a nice bit coming in per week for a business gentleman, perhaps sharing the kitchen. Not that he would fancy sharing with Edwin if it came to that, which it obviously wouldn't. The fact that Edwin lived in this house alone meant that he had no need of extra cash, that he wouldn't be dependent on his pension when the time came.
It was a long car ride to the crematorium in the south-east corner of London, and as time went on conversation between the three of them began to flow more easily.
'After all,' Edwin pointed out, 'we're taking Marcia with us, we must think of it like that, and she wouldn't be saying much anyway, so we can talk between ourselves in the ordinary way.'
This invitation to ordinary talk seemed to stun them into silence, then Letty made a remark about the roses, still beautiful in a garden they happened to be passing.
'Little did we think, that time we all had lunch together,' said Edwin.
'Poor old girl – she seemed a bit round the bend then, didn't she?' said Norman.
'I suppose that must have been the beginning of the end,' said Letty. 'She hardly ate anything, just a bit of salad.'
'Oh, well, she was never a big eater,' said Norman, as if he was the only one to be let into this secret. 'She often used to say.'
'Living alone sometimes makes people not bother about meals,' said Edwin, almost as if solitude was a state that none of them had experience of.
'I always see to it that I get one good meal a day,' said Letty.
'Mrs Pope lets you use her kitchen, of course,' said Edwin. 'Do you use your own cooking utensils?'
'I have a couple of non-stick saucepans and my own omelette pan,' said Letty, hurrying over the words, for she felt that the conversation was getting rather too ordinary now and she did not want to hear about Norman's frying pan.
'Oh, I just shove everything into the frying pan,' Norman said, as she knew he would. 'Omelettes and all. Not that you can really call it an omelette, the kind of egg thing I make.'
The hearse was gathering speed now, so the car following could step on it a bit, Norman thought. It was quite clever the way they did it, gradually increasing the speed. It would be a skilled form of driving, that, and no doubt the cars were automatic. Ken would know and it might be something to talk to him about next time they met; conversation was not his strong point except where it concerned the motor car.
'Are we nearly there?' Letty asked. 'I don't know this part of London.'
'I brought Phyllis here,' said Edwin, in a matter-of-fact way. 'It's the nearest crematorium for where I live.'
'Oh, yes, of course.' Letty was momentarily embarrassed but Edwin did not seem to be affected by the memory of his dead wife, only going on to say that they had had a service at the church first which had been very well attended.
Edwin consulted his watch. ' Eleven thirty is our time,' he said, 'and I think they work to a pretty tight schedule. Oh, there's Father G.'s car just in front – he must have nipped past us at the traffic lights.'
'Crossed on the amber, I shouldn't wonder,' said Norman.
'This must be it,' said Letty, relieved that the end of the drive seemed to be in sight. 'Those gates ahead of us?'
'Yes, that's it,' Edwin confirmed.
'What we all come to,' Norman said.
' _Poor_ Miss Ivory,' Priscilla whispered to Janice. ' I'm glad I was able to come, neighbours, and all that – and to give you moral support.'
Janice was not sure that she liked the way Priscilla had put it, as if she _needed_ moral support, but probably she had just meant for the service at the crematorium which wasn't an everyday thing. For there was no question of Janice needing moral support in any other way. The discovery of Miss Ivory's slumped body in the kitchen and her subsequent death in hospital, although unusual, not to say unfortunate, in no way reflected on the social services and there could be no implication of neglect on Janice's part. Death was the end of all things, the culmination of life, and so it was for Marcia Ivory, a fitting conclusion to her story – something that could be quoted in years to come as an example of the kind of difficulties encountered by the voluntary social worker. It was impossible to help some people, to guide them in the way they should go for their own good, and Miss Ivory had certainly been one of those. Janice's thoughts clothed themselves in the language of a report, for it did appear from what one of the doctors at the hospital had said that Miss Ivory had quite definitely been in a terminal situation, even before her last collapse. The only trouble was that there might possibly have been a lack of liaison, that Miss Ivory might be said to have fallen through the net, that dreaded phrase...
Letty, noticing Janice and Priscilla in their rather too bright everyday clothes, realized that she need not have worried about not having anything suitable for a funeral – obviously younger people didn't take any notice of that kind of thing nowadays. Her dark-blue dress and jacket was sober, but hardly mourning; the saleswoman where she bought it had called the colour ' French navy', which seemed to add an old-fashioned touch of frivolity. The men were of course wearing black ties, for presumably a black tie was the kind of thing a man always had or could easily obtain.
_Requiescat in pace_ , and may light perpetual shine upon her, Edwin thought. It had been a good idea to get Father G. to officiate at the brief service. He could ensure that things were done decently and in order, which one rather suspected some of these clergy officiating at crematoria, having to do one funeral after another, didn't always achieve. He was glad to see that that social worker and the neighbour had put in an appearance, it was the least they could do, but undoubtedly it was just as well it had been him and Father G., rather than them or poor old Norman, who had discovered Marcia lying like that.
Norman, strangely disturbed by the idea of Marcia lying in her coffin about to be consigned to the flames, was visited by a frivolous couplet he had read somewhere:
# Dust to dust, ashes to ashes.
Into the grave the great Queen dashes.
He didn't know whether to laugh, which you could hardly do here, or cry, which you couldn't do either and it was a long time since he had shed tears. He bent his head, as the curtains closed and the coffin slid away, not wanting to see that last bit.
Afterwards they all gathered outside in an awkward little group in the bright sunshine.
'What lovely flowers,' Letty murmured, turning to Janice and Priscilla. The eternal usefulness of flowers again eased a strained situation. Two sheaves of flame gladioli and pink and white carnations and two wreaths of hot-house roses, mauve everlastings and white chrysanthemums were lying in a space bearing a notice which proclaimed 'Marcia Joan Ivory'.
'Priscilla and I thought she'd rather have cut flowers,' said Janice a little defiantly, her eyes on the wreaths. ' Some people do specify that.'
'Poor old Marcia, she was hardly in a state to specify anything,' Norman said. 'We clubbed together for a wreath – the mauve and white – Letty, Edwin and I, seeing as how...'
'Of course, you worked together, didn't you?' said Priscilla, in her best finishing-school manner. She didn't quite know how to cope with this odd little man and the other hardly less odd tall one, and hoped that it would be possible to get away quickly now that she had done her social duty.
'The other wreath is from Marcia's cousin,' said Edwin. ' She did have this distant cousin but she was too upset to attend the funeral.'
'Not having seen her for forty years,' Norman chipped in.
'The son came, though,' said Edwin, 'so that was something. Apparently he works in London.'
'That young person sitting at the back?' said Letty. She had noticed somebody of indeterminate sex, with straggling, towcoloured hair, wearing a kaftan.
'Yes, wearing a bead necklace, that's him.'
The group dispersed. Edwin, Letty and Norman found their way to Father G., who was waiting rather impatiently by his car. Edwin sat in the front by Father G. and Letty and Norman squashed into the back with the suitcase containing his vestments. The two in front kept up an animated conversation, mostly church shop, but the two in the back were silent. Norman did not know what to say or even what he felt, except that funerals were sad occasions anyway, but Letty was overcome by a sense of desolation, as if by Marcia's death she was now completely alone. And it wasn't even as if they had been close friends.
# Twenty-one
' Little did we think...' It was inevitable that Norman should say something of the kind, Letty felt, remembering the last time they had eaten a meal together in a restaurant. Little, indeed, had they thought on that occasion at the Rendezvous that the next time would be like this. Now of course they had Father G. with them, so that added something different.
'Well, now...' Father G. took up the menu and began to study it. He presumed that he and Edwin would be sharing the cost of the meal between them, Letty being a woman, and Norman something a little less than the kind of man one might expect to treat one to a lunch. He had wondered when the funeral arrangements were being made what the aftermath was going to be, seeing that the deceased appeared to have no relative capable of laying on funeral baked meats. At first he had wondered if Edwin himself would invite them all back to his house, but he was relieved that he had evidently decided against it but had chosen a nearby restaurant with a licence. It was an agreeable change not to be crowded into a suburban sitting room or 'lounge', invariably furnished in appalling taste, forced to drink sweet sherry or the inevitable cups of tea. Would it be in the least appropriate, he wondered, to suggest what he really felt like at this moment – a dry Martini?
'Something to drink, I feel,' said Edwin, echoing Father G.'s thought.
'Yes, one does feel...' Letty murmured.
'It takes it out of you, a day like this,' Norman said awkwardly. He had been going to say that what takes it out of you is a funeral but somehow the word did not come, as if he did not like to think of it, let alone say the word out loud.
Father G., thus encouraged, felt justified in being brisk and taking action. He summoned a waiter and ordered drinks – medium sherry for Edwin and Norman, a dry Martini for himself, and for the lady... Letty's hesitation, her slight feeling that perhaps they ought not to be drinking when poor Marcia had never touched a drop, was taken by Father G. to be womanly modesty or ignorance of what was available. 'Why not try a dry Martini?' he suggested. 'That will pull you together.'
'Yes, I do feel as if I needed something like that,' she agreed, and when the drink came it did seem to achieve a kind of pulling together. There is something in it, she thought, the comfort of drink at a time like this. It also had the effect of making her realize that while poor Marcia was no longer with them she and the others were very much alive – Edwin, his usual grey solemn self, Norman, obviously in a state of some emotion, and Father G., the efficient bossy clergyman. Looking round the restaurant, she noticed an arrangement of artificial sweet peas in unnaturally bright colours, a party of businessmen at a long table, and two smartly dressed women comparing patterns of curtain material. Conscious of her own aliveness, she allowed Father G. to persuade her to choose oeufs Florentine, because it sounded attractive, while he himself had a steak, Edwin grilled plaice, and Norman cauliflower au gratin. 'I don't feel like much,' Norman added, subtly making the others feel that they ought not to have felt like much either.
'You've retired now?' Father G. asked, making conversation with Letty. 'That must be...' he cast about for a word to describe what Letty's retirement must be... 'a great opportunity,' he brought out, all life being nothing so much as a great opportunity.
'Yes, it certainly is!' The dry Martini had encouraged Letty to a greater appreciation of her present state. 'I find I can do all sorts of things now.'
'We could take that in more ways than one,' said Norman, with a return of his usual jaunty manner. 'It makes us wonder what you get up to.'
'Nothing, really,' said Letty, inhibited by the presence of Father G. 'I just have more time to do things – reading and other kind of work.'
'Ah, yes, social work.' Father G. nodded approvingly.
'I think Letty is more likely to be on the receiving end of the social worker's ministrations,' said Edwin. ' After all, she _is_ a retired person, a senior citizen, you might say.'
Letty felt it a little unfair of Edwin to lump her into this category, when she had hardly any grey hairs in spite of her age, and Father G. seemed to draw away from her at this unattractive classification. He did not much care for the aged, the elderly, or just 'old people', whatever you liked to call them.
'What about the next course?' Edwin asked.
'Do you remember the last time?' Norman asked suddenly. 'What we had then?'
'I think you and I had apple pie and ice cream,' Letty said.
'That's right – Aunt somebody's apple pie. Edwin had the cream caramel and he tried to get Marcia to have some but she wouldn't.'
There was silence and for a moment nobody could think of anything else to say. They may all have been aware that at a time of bereavement it is best not to bottle things up. Marcia's name had not been mentioned up to now and perhaps it was fitting that Norman should be the one to bring it out.
'She always had such a small appetite,' Letty said at last.
'Never a big eater.' Norman's voice seemed as if it might break on these words but he controlled himself.
I must ask him round to a meal one evening, Edwin thought, give him a chance to talk about her if he wants to. He did not much look forward to the prospect but things like this had to be done and one couldn't expect always to enjoy doing one's Christian duty.
'What is going to happen to Miss Ivory's house?' asked Father G., as if the mention of property might bring the conversation up to a higher level. 'I suppose it will be left to that – er – relative?'
'The young man in the bead necklace or his mother, I suppose,' said Edwin. 'I believe those were her only relatives.'
'If it were smartened up a bit it would be quite a desirable property,' Father G. said, in a condescending estate-agent's tone.
'What do you mean, if it was smartened a bit?' Norman asked aggressively.
Father G. smiled. 'Well, you know, it could have done with a lick of paint – that was my impression. Now, what about some ice cream?' he asked in a soothing tone, feeling that ice cream might act like oil on troubled waters and pacify the angry Norman more effectively than any words of his.
'We finished off with ice cream,' Letty said. 'There were so many different kinds, it was like being a child again. Even Norman said he'd always liked strawberry ice. I think it cheered him up in a sort of way.'
'I couldn't decide whether you'd be hungry or not,' Mrs Pope said. 'One never knows after a funeral.'
Letty was surprised and obscurely comforted to realize that Mrs Pope had been thinking of her to the extent of wondering whether she would need a meal. The time – just after five o'clock– was an unpromising one for anything except a 'high tea' and that seemed inappropriate.
'Edwin seemed to know this restaurant quite near, so that was very convenient,' Letty explained.
Mrs Pope had been waiting expectantly, so Letty had to tell her what they had eaten. Steak for Father G. had seemed suitable, for after all he had taken the service and in some way, Mrs Pope commented, the clergy appeared to relish meat and even to need it. Oeufs Florentine, Letty's choice, sounded frivolous and unfeeling, on a par with wearing something in 'French navy' to the funeral. What was it about the French, or the idea of the French? Surely now that we were a part of the EEC things would be different, attitudes would change? Or would we be infected by their supposed frivolity? So Letty just said that she had had 'an egg dish'.
'Well, eggs are as nourishing as meat in their way,' Mrs Pope pronounced, 'so you probably won't feel like another egg now.'
'I think just a cup of tea...' There was something to be said for tea and a comfortable chat about crematoria.
# Twenty-two
Norman went into Marcia's house, using the front door key which had been handed over to him by the solicitor. He entered 'the dwelling of Miss Marcia Joan Ivory, deceased'. That was how he put it to himself and how, shocked into his usual flippancy, he had discussed with Edwin the astonishing news that Marcia had left her house to him. The will had evidently been made just after her operation, at a time when she had been forced to face up to the future. Her money, such as it was, had been left to her cousin, with a legacy for the son. 'He'll be able to buy himself another string of beads,' was Norman's comment.
'Norman, the Man of Property,' Edwin teased, and it seemed to redress the balance between them, now that Norman also had a house and need no longer be an object of pity, alone in his bedsitter. Yet it would really have been more suitable if Marcia had left her house to Letty, also alone in a bedsitter though she did have the company of Mrs Pope. 'Are you going to live in it?' Edwin asked, remembering the state the house had been in when he and Father G. had gone in that time. ' It'll need a bit doing to it,' he couldn't resist adding. 'I shouldn't be surprised if the roof leaked.'
'Oh, so what!' said Norman. 'Who cares about the roof?'
'Well, water might come in – rain and snow.'
'We don't get much snow in London, not south of the river, anyway.'
'Did you know about this – had you any idea?'
'What do you think? Of course I hadn't.'
'She used to make coffee for you, remember,' Edwin persisted.
'That was only because she thought it cheaper to share the large economy tin, as you've already pointed out more than once,' Norman retorted angrily.
They had parted slightly annoyed with each other, and the next day Norman had taken a day off to go and look at the house. He had a few extra bits of leave still owing to him, so there was no difficulty about that. Who would ever have thought that one of those extra days would have come in useful on this sort of occasion? God moves in a mysterious way, his wonders to perform, and you could certainly call this a wonder.
The key fitted easily in the Yale lock and there was a mortise lock too. Marcia had been careful about burglars, especially when she was out all day. Standing in the hall, Norman noticed the solid Edwardian furniture – hatstand, table and chairs – rather than the dust over everything, for of course it would be dusty after all this time, stands to reason, he said to himself. He wandered from room to room, seeing not himself in possession but Marcia as she must have been in the time he had known her but never been invited here. If she had invited him, would things have been any different? But she never would have invited him – that was the essence of their relationship. So it had been a relationship, had it? He remembered that time she had followed him into the BM, and he had been trapped in front of those animals, gaping at them with a crowd of school kids, stuck there until it was safe to go. She thought he hadn't seen her, but he had, and after that he hadn't gone to the museum again, just trotted off to the library. Then there had been the making of the coffee, that Edwin was always going on about – there hadn't really been much in that...
Norman ascended the stairs. He came into a room that might have been her bedroom. It had shabby, rose-flowered wallpaper and a faded patterned carpet. There was a table by the bed, and on it some books, an anthology of poetry, which surprised him, and a collection of pamphlets, the sort of thing you got in the library, giving details of services available for the retired and elderly. There was an old, rather dirty white candlewick cover over the bed and the sheets and pillows were still on it, just as they had been. This was the bed where she had slept, where she had dreamed, and where she had reached the point of death, though she hadn't actually died in it. Edwin and Father G. had found her downstairs, sitting at the kitchen table.
Norman advanced to the dressing table, with its swinging mirror, which stood in the window. So she had wanted a good light to see her face in, a cruelly revealing light, showing every line? Yet Marcia hadn't been one to look much at herself in the glass, he suspected. She hadn't seemed to care much about her appearance at the best of times, even with the dyed hair. At the end, Sister had said something about her lovely _white_ hair, so perhaps the dye had grown out by then and somebody had cut off the dark ends. She had looked quite beautiful, Sister said, so calm and peaceful, but no doubt they always said that to the relatives, they must have to do quite a lot of what he thought of as soft-soaping in hospitals – Marcia looking beautiful – that would be the day! Yet, now that he knew that she had left him the house, he was prepared to believe that she might have been almost beautiful.
There was a chest of drawers, presumably containing her clothes and her bits and pieces. He didn't particularly want to see those but he was drawn by curiosity. Tentatively, as if he were violating the sanctity of her secret office drawer, he opened one of the drawers. To his surprise, it was full of plastic bags of various sizes, all neatly folded and classified by size and type. There was something almost admirable about the arrangement, unexpected and yet just the sort of thing he could imagine Marcia doing.
He closed the drawer and stood in the middle of the room, wondering what to do. Surely he couldn't be expected to cope with all her mess, it was a woman's job. Letty ought to be here, sorting out the things, deciding what to do with the clothes. Perhaps he should get in touch with her, that was the obvious thing, unless the distant cousin could be approached; perhaps as a relative she had a prior claim. She had been too upset to attend the funeral but a few perks, like clothes and the odd stick of furniture, might work wonders on her sensibility.
Thinking about this, Norman moved into another room and stood looking out of a side window. From here he had a view of well-maintained and painted houses and neat gardens, the residences of his future neighbours, should he decide to live in the house himself.
'There's a man looking out of the window,' said Priscilla. ' He's in Miss Ivory's house. Do you suppose it's all right?'
'Perhaps we ought to investigate,' said Janice. She and Priscilla were sitting on the patio, drinking coffee. It was a marvellously sunny October day, a real Indian summer. Janice had been going to visit one of her cases in a nearby street, but the old person had been taken off for a drive by one of the enthusiastic amateur dogooders from the church – annoying, the way social-services wires sometimes got crossed, though it meant that she had an unexpectedly free morning. So she had dropped in on Priscilla for a welcome cup of coffee and a gossip. Not exactly gossip, more to speculate on what might happen to Miss Ivory's house, what sort of neighbours Nigel and Priscilla might be getting.
'It looks like one of those men who were at the funeral,' Priscilla said. 'You know, the men who worked in that office place.'
'What would he be doing in the house?' Janice asked. 'He never came to see Miss Ivory when she was alive.' Her tone reflected some of the indignation she felt at the idea that Miss Ivory might have had friends who were perfectly capable of visiting her but never did. Yet wasn't it her job, her justification, her _raison d'être_ , the loneliness of people like Miss Ivory? You couldn't have it all ways, as her husband sometimes reminded her. If the friends and relatives did their stuff, Janice might well be out of a job.
'Why don't we go over and see,' said Priscilla boldly. 'We can always say we noticed somebody in the house and wondered if it was all right. After all, we don't know him from Adam, do we?'
That social worker and her friend, the woman who lives next door, Norman thought, as he saw them coming to the house. What do _they_ want?
'Yes?' he barked in a brusque, unpromising way, as he opened the front door an unfriendly crack.
_Such_ an odd little man, thought Priscilla, preparing to assume her coolest social manner, but Janice got in first.
'I'm Janice Brabner,' she said, 'and I used to look after Miss Ivory.' Rather a pointless thing to say, she realized, as it might appear that she hadn't been all that successful. 'We saw somebody at an upstairs window,' she went on quickly.
'Yes, me,' said Norman. 'It's my house now. Miss Ivory left it to me in her will.'
Norman was prepared for the gasp of unflattering astonishment that met his announcement. It seemed as if they hardly believed him. The one called 'Priscilla' was a tall blonde, wearing velvet trousers, and the other (I'm Janice Brabner, he mimicked to himself) was shorter and squatter, a real bossy social-worker type. She was the first one to speak, after he had dropped his bombshell.
'Are you sure?' she said.
'Sure? Of course I'm sure!' Norman retorted indignantly.
'Oh, that is nice,' said Priscilla. She was not so stupid as to imagine that gushing social insincerity would get her anywhere with Norman, but it had occurred to her that if this person was going to be their new neighbour it would be just as well to get on to good terms with him. All the same she very much hoped that he wasn't going to be. What she really wanted was a young couple of about the same age as herself and Nigel, perhaps with children, so that they could do mutual baby-sitting when she and Nigel decided to start a family. The sort of people one could ask to dinner, which this odd little man, and whatever friends he might have, hardly seemed to be.
But Janice, with no stake in the future, could afford to be blunter. 'Are you going to live here?' she asked, straight out.
'I haven't made up my mind,' Norman said. ' I might decide to live here, and again I might not.'
At this stage the two women moved away, leaving Norman feeling that he had got the better of them. He did not go into the house again but began to explore that garden – 'explore' was the word, he decided, when you almost had to hack your way through the undergrowth. There was a garden shed, the kind of thing that might come in useful, and he saw himself arranging his tools and his 'gear' there. Perhaps Marcia had a lawn mower, a fork, a spade and a hoe, though it didn't look as if she had made much use of them lately. He pushed open the door of the shed. There were certainly some tools in one corner, but most of the space was taken up with rows of milk bottles stacked on shelves; there must have been over a hundred of them.
At this point Norman felt he couldn't cope any more. The small-scale stuffiness of his bedsitter seemed suddenly very cosy and attractively safe, so he decided to go back to it, 'home' as it still was. All the same, he was now a house owner and it was up to him to decide what to do with the property, whether to live in it himself or to sell it, and houses in that street were fetching a tidy sum judging by the others he had seen there. The fact that the decision rested with him, that he had the power to influence the lives of people like Priscilla and her husband, gave him a quite new, hitherto unexperienced sensation – a good feeling, like a dog with two tails, as people sometimes put it – and he walked to the bus stop with his head held high.
That same evening, on the other side of the common, Edwin returned from the office, wondering what sort of a day Norman had spent in what he still thought of as 'Marcia's house'. In other circumstances he might have strolled over there but tonight, being the 18th of October and St Luke's day, he was hoping to find an evening Mass somewhere. The lunchtime churches had yielded nothing, a sad contrast to the days when Father Thames, and later Father Bode, had attracted a crowd of office workers. Edwin also thought regretfully of another church where he had often gone in the past, which would have provided a splendid service, but that church was no more. A scandal in the early fifties – Edwin remembered it well – had put an end to the splendid services, the congregation had fallen away and in the end the church had been closed as redundant. An office block now stood on the spot where the air had once been filled with incense. It was a sad story, but the upshot of it was that there would be no St Luke's day evening Mass _there_. Luke, the beloved physician. You would have thought that the church opposite the hospital where Marcia had died would be filled with devout consultants – surgeons and physicians – housemen and nurses, on this day, but not a bit of it. The St Luke's there was the kind of church that had only the bare mimimum of Sunday services and nothing on weekdays. Now that he came to think of it, Edwin had grave suspicions that Mr Strong, Marcia's surgeon, was not any kind of churchgoer. Something he had said, some disparaging remark he had made about the chaplain... Still, that didn't solve the problem of the St Luke's day service and eventually the idea had to be given up.
Then it occurred to Edwin that he might give Letty a ring. At the funeral he had got the impression that she was a bit lonely, even living with Mrs Pope. After all, though it had been a good idea for her to go there as a lodger, was the company of a woman in her eighties quite enough for Letty? With this idea in his mind, he went to the telephone and dialled the number, but it was engaged. He decided to leave it for today and try again tomorrow or whenever he happened to remember it. After all, there was no hurry.
# Twenty-three
Letty had an old-fashioned respect for the clergy which seemed outmoded in the seventies, when it was continually being brought home to her that in many ways they were just like other men, or even more so. The emphasis on humanity, in which we all share, had been the burden of a sermon she had recently heard at Mrs Pope's church, as if the preacher were preparing his congregation for some particularly outrageous piece of behaviour. In his case it had been no more than the removal of some of the pews at the back of the church to provide a space where the younger children could be accommodated during the service, but of course it had been greeted with indignant opposition by some.
'He is determined to ride roughshod over us,' Mrs Pope declared.
Letty, shocked by the violence of Mrs Pope's concept, had been about to say a word in the vicar's favour, when the telephone rang. Had it been a moment earlier (or later) it would have been Edwin, prompted by a friendly gesture towards Letty's supposed loneliness, but as it happened it was Marjorie, 'that friend of yours who's going to marry that clergyman', as Mrs Pope sometimes put it. But now, it appeared, Marjorie was not going to marry him. What Letty gathered from the incoherent outburst was that for some reason – it was a bad line, and she could not gather exactly what the reason was – the engagement had been broken off.
'Beth Doughty,' Marjorie wailed. ' And I had no idea...'
For a moment Letty couldn't remember who Beth Doughty was, then it came back to her. The warden of Holmhurst, the home for retired gentlefolk, that was Beth Doughty – the efficient woman with the rigid hairstyle, who poured such generous gins, who knew the kind of food David Lydell liked and remembered his passion for Orvieto. There was something shocking in the idea of two women competing for the love of a clergyman with the lure of food and wine, but the whole pattern slotted into place. Humanity in which we all share...
When the telephone was at last laid down, the main point that emerged was that Letty must go to Marjorie as soon as possible. Not, of course, this evening – there was no suitable train – but first thing tomorrow morning.
'Well...' Letty turned to the expectant Mrs Pope. 'That was my friend. He has broken off the engagement,' she said. 'It seems there's another woman – the warden of an old people's home.'
It sounded very bad, put like that, and the involvement, however indirectly, of 'old people' seemed particularly distressing.
' _Really_...' Mrs Pope could think of nothing to say that would adequately express her feelings. Compared with this, the removal of a few pews from the back of her own church was as nothing. 'You will want to go to her, of course,' she added, not without a touch of envy.
'Yes, first thing in the morning,' said Letty. She felt curiously elated, a feeling she tried to suppress but it would not go away. She began to plan what sort of clothes she would take for this unexpected visit to Marjorie. The weather had been very warm for October, but she must remember that it was always colder in the country.
'His gastric trouble, and then there was his mother being over ninety, and in a way...' Marjorie hesitated, ' the age difference. He was some years younger than I am, of course.'
Letty murmured sympathetically, for she had known all these things and now that Marjorie was explaining what had happened, how he had seemed reluctant to fix the date of the wedding – it had already been put off once because of his mother's health – it seemed remarkable to consider that he had ever agreed to get married at all. And how had Beth Doughty managed it, for surely that needed to be explained? The other factors would still apply, and it wasn't as if she was much younger than Marjorie.
Marjorie didn't seem to know the answer to this or she was too upset to discuss the matter further. Letty began to wonder whether Beth Doughty might not also be rejected in her turn, whether no woman would succeed in bringing David Lydell to the point of marriage, but she did not say anything of this.
'You can't know what a woman is up to,' Marjorie said. ' It's something that can never be expected or explained.'
Letty agreed that this was very true and found herself thinking of Marcia leaving her house to Norman, a perfect example of the unpredictability of women. And now, with Marcia dead, her action could never be explained.
'Where will David Lydell go?' Letty asked.
'Go? That's almost the worst part of it – he won't be going anywhere. He'll be staying here.'
'He's decided to stay _here_?'
'I don't know about decided – I don't think he's considered moving.'
'Well, I suppose he hasn't been in the village very long, but in the circumstances...' Letty was uncertain of her ground here and felt unable to go any further. And yet, when one came to think of it, why should David Lydell leave the district? He had done nothing worse than change his mind and, as people were always saying, it was better to discover this kind of mistake sooner rather than later. 'Where will he live?' she went on. 'Surely not at the old people's home – at Holmhurst?'
'I don't think so – I suppose they'll move into the vicarage.'
That uncomfortable vicarage, that needed so much doing to it, Letty remembered. Perhaps it was just what he deserved. 'But won't it distress him to think of you alone here?' she said.
'Oh, Letty...' Marjorie's smile was indulgent, as if making allowances for her friend's unworldliness. 'Anyway, I have a feeling that I may not be alone for long.'
'Really?' This coy admission made Letty wonder what Marjorie could possibly mean. Surely it was much too soon for another likely husband to have appeared in the village?
'Why, don't you see...' Marjorie began to explain and then of course Letty did see. Now that there was to be no marriage the plans for Letty's retirement could be carried out as before, just as if nothing had happened to change them. She would (naturally) be moving into the country to join Marjorie as soon as arrangements could be made.
And then what? Letty wondered. Supposing after a few months or years Marjorie met somebody else to marry, what would happen to Letty then? In the past she had always trailed behind Marjorie, when the two of them were together, but there was no reason why this should always be the pattern. She decided that she would think the matter over, not make up her mind immediately.
'I suppose you've sent back his ring,' she said, deliberately returning to the matter of the broken engagement.
'Oh, goodness no – David wanted me to keep it. I suppose he could hardly have asked for it back, under the circumstances.'
'No, he couldn't have asked, but you might have felt you didn't want to keep it,' said Letty.
'But it's such a pretty ring, a moonstone in an antique setting. You know I've always wanted an antique ring,' Marjorie babbled on, saying how much more interesting such a ring was than the conventional small diamond of her first marriage. 'And when one's older, one's hands seem to thicken and the fingers get fatter, so a larger ring looks better.' She spread out her left hand, still wearing the moonstone, appraisingly for Letty to see.
# Twenty-four
' Wonders will never cease – that's all I have to say.' Norman took a corned-beef sandwich out of a plastic bag. 'We've certainly had abundant proof of that,' said Edwin, busy with a tea bag. 'I had Mrs Pope on the telephone last night and she told me the whole story. Letty's friend rang up to say that the whole thing was off – she wasn't going to get married after all. Of course she was very upset – that's why Letty went down there.'
'What could _she_ do? Listen to her friend going on about her loss, I suppose. Old Letty never strikes me as being much use in a crisis.'
'Perhaps she can't do all that much – but the presence of a woman friend...' Edwin hesitated, not knowing how to classify the type of comfort Letty might be capable of providing.
'Oh, yes, I agree – women certainly have their uses.'
'Especially if they leave you houses in their wills,' Edwin said, in a jocular tone. 'You must be getting quite used to being a property owner.'
'I'm going to sell it,' Norman said. 'I wouldn't fancy living in it.'
'Yes, that's the best thing – it would be much too big for you,' Edwin pointed out, reasonably enough.
'Oh, I don't know so much about that,' said Norman huffily. 'It's only an ordinary semi, you know, just like yours, and you don't find yours too big. I don't necessarily want to end my days in a bedsitter.'
'No, of course not.' Edwin's tone was the soothing one he generally used to pacify the angry little man.
'I suppose I'm more likely to end my days in an old people's home,' said Norman, taking up the large economy size of instant coffee. 'It says "Family Size" here – funny, really, when it's mostly used by people in offices.' He spooned coffee powder into a mug. 'Of course you do save a bit – that's what Marcia and I thought.'
Edwin made no comment. In his silence he agitated his tea bag with a spoon; a stream of amber-coloured liquid was released into the boiling water. Then he added the usual slice of lemon, stirred it and prepared to drink. Norman's words, the way he had said 'Marcia and I', had made him wonder whether the two of them could ever have married. Yet it was impossible to imagine how such an event could have been brought about. If they had met many years ago, when they were both younger? Apart from the difficulty of picturing them being younger, they probably wouldn't have been attracted to each other at that time, and even now the idea of 'attraction' seemed ridiculous when you applied it to Norman and Marcia. And yet what was it that brought people together, even the most unlikely people? Edwin had only the haziest memories of his own courtship and marriage, in the days when he had been a server at the spikiest Anglo-Catholic church where Phyllis was a member of the congregation. In the thirties people did get married in a way that they seemed not to now, or at least not to the same extent, he qualified. Supposing Marcia had not died, could she and Norman have married and lived in her house? It was something he felt he could not ask Norman...
But now Norman was breaking into Edwin's unspoken thoughts and asking his advice about a matter that seemed to be troubling him.
'All those clothes and things, what am I to do about them?'
'How do you mean?'
'Marcia's clothes and the things in the house. Of course the nephew – the one in the kaftan and beads – was taking some odds and ends, but he said his mum didn't want to be bothered, said I was to do what I liked. _I_ – I ask you!' Norman kicked the wastepaper basket with an angry gesture.
'What about that neighbour and the social worker – the ones who were at the funeral?'
'The sexy blonde and the bossy do-gooding bitch?' Irritation seemed to add violent colour to Norman's way of expressing himself. 'Catch me asking _them_!'
'Well, there must be somebody at the local church... somebody who could make use of them.'
'You _would_ suggest that. No doubt your friend Father G. would come to the rescue.'
'I'm sure he would,' said Edwin, on the defensive. 'Old clothes are always welcome for jumble sales.'
'Jumble sales! Thank you very much! So that's what you think Marcia's clothes would be.'
'Well, you must admit the last time we saw her she did look a bit odd,' Edwin began, but then he stopped himself. This pointless bickering was getting them nowhere. Perhaps Norman was remembering Marcia differently now – a gracious white-haired woman with a sweet expression, as Sister had described her at the end. 'Have you thought of asking Letty?' he asked. 'I'm sure she would help.'
'Yes, that's an idea.' Norman seemed grateful. 'It would be
better than having a stranger.'
'What are we going to do with all these milk bottles?' Edwin asked.
'I don't know,' said Norman. ' What would you do – just leave them?'
'I suppose I'd get rid of them gradually – put out a few for the milkman every day.'
'We could start by putting some out now,' Letty suggested.
'Yes, they're always telling us to rinse and return,' said Norman.
'And these are spotlessly clean,' Edwin pointed out.
'I wonder if Marcia would be angry to think of us doing this,' said Letty. ' She must have had some plan in mind, keeping them all in the shed, so beautifully washed and arranged.'
The three of them had spent an interesting afternoon in Marcia's house, going through her things. Letty had been most surprised at the clothes, stowed away in wardrobes and drawers, dresses of the thirties and earlier, now coming back into fashion, some of them obviously belonging to Marcia's mother. Things Marcia herself must have worn when she was young before any of them had known her. And there had also been clothes she must have bought comparatively recently, most of which seemed inexplicably unworn. Had she been keeping them for some special occasion which had never arisen? It was impossible to know now.
They had started their work upstairs, but when they came down to the kitchen it had been even more surprising to open the store cupboard and come upon such an array of tinned foods.
'Whatever can she have bought all this stuff for?' Edwin exclaimed.
'Well, you buy tinned stuff, don't you?' Norman was immediately on the defensive. 'What's so surprising about it?'
'But she never seemed to eat anything,' Letty said.
'Never a big eater, she used to say,' Norman reminded them.
'I suppose she was prudent, like Mrs Thatcher,' said Edwin. 'What with prices going up the way they have been...'
'And will continue to go up, whatever government is in power,' Norman snapped.
'So beautifully arranged and classified,' said Letty, with wonder in her tone. 'Meat and fish and fruit, and here soups and macaroni cheese and ravioli...'
'Light supper dishes,' said Norman. 'I'm very partial to macaroni cheese – it was a godsend when I had that time with my teeth.'
'Yes, it would be,' said Letty, her tone now warm with sympathy.
'I think Norman had better have this stuff,' said Edwin. 'After all, if the cousin and her son have given you the go-ahead...'
'Well, I suppose the son might have some – a young man living in a hippy pad would probably be glad of a few tins. Luckily he doesn't seem to know quite how many there are. Why don't we all take a few for ourselves now,' said Norman.
Hesitantly, for it seemed very wrong to be helping themselves to Marcia's store cupboard like this, the three of them began making their selection. In some subtle way this reflected their different characters. Edwin chose spam and stewing steak, Letty prawns and peach halves, Norman sardines, soup, butter beans and the macaroni cheese.
Then, in the bottom corner of the cupboard, they came upon a bottle of sherry, unopened. It was a Cyprus cream sherry, reputedly made from grapes growing in vineyards which had once belonged to the Queen of Sheba.
'Shall we open it?' Norman asked. 'Don't you think she must have meant it for us, perhaps for this very occasion?'
'She could hardly have imagined us all here like this,' Letty said. 'I mean, without her.'
'Perhaps we should do as Norman suggests,' said Edwin. 'After all, it may well have been what Marcia would have wished, given the exceptional circumstances.' That was perhaps the best way of putting it, for it wasn't quite like every day. And surely, he felt, if anyone could claim to know what Marcia might have meant or wished, could attempt to probe such a mystery, it might be Norman?
'Queen of Sheba,' said Norman, who had found glasses and was pouring out generous measures of the golden liquid, ' I like that! Here's to us, then.'
'I suppose you'll be moving down to the country, Letty, now that your friend's not getting married after all,' Edwin said, the glow of the drink adding to the pleasure he felt at the improvement in Letty's prospects. It seemed to round things off in a most satisfactory way.
'I haven't decided,' she said. 'I'm not at all sure that I want to live in the country now.'
'That's right,' said Norman, 'don't you do anything you don't want to do, or let anybody tell you what you ought to do. Make up your own mind. It's your life, after all.'
'But I thought you loved the country,' said Edwin, dismay in his tone, for surely all middle-aged or elderly women loved, or ought to love, the country?
'I don't think I _love_ it exactly,' said Letty, thinking of the dead birds and mangled rabbits and the cruel-tongued village people. 'It was just that it seemed a suitable arrangement when we made it. Now I feel that I have a choice.' She took a long draught of the sweet sherry and experienced a most agreeable sensation, almost a feeling of power. She felt as Norman had felt when he discovered that he could influence the lives of other people by deciding whether to live in Marcia's house or not. Letty now realized that both Marjorie and Mrs Pope would be waiting to know what _she_ had decided to do.
'But surely you don't want to stay in London?' Edwin persisted.
'I don't know. I shall have to think about it,' Letty said. 'Oh, and that reminds me,' she added, 'Marjorie wondered if you two would like a day in the country. We could all go down there for lunch.'
She could not help smiling, for from a practical point of view there was something slightly ludicrous in the picture of them all – Marjorie and Letty and the two men – squashed up together in the Morris.
'Those two friends of yours, the men you worked with in that office, Edwin and Norman,' Marjorie had said, lingering over the names, 'wouldn't it be rather nice to invite them down for a day?'
Any new interest that might take Marjorie's mind off her disappointment was to be encouraged, Letty felt, though it was difficult to think of Edwin and Norman as objects of romantic speculation, and two less country-loving people could hardly be imagined. But at least it made one realize that life still held infinite possibilities for change.
# Copyright
This edition published 2013 by Bello
an imprint of Pan Macmillan, a division of Macmillan Publishers Limited
Pan Macmillan, 20 New Wharf Road, London N1 9RR
Basingstoke and Oxford
Associated companies throughout the world
www.panmacmillan.co.uk/bello
ISBN 978-1-4472-3841-6 EPUB
ISBN 978-1-4472-3837-9 POD
Copyright © Barbara Pym, 1977
The right of Barbara Pym to be identified as the
author of this work has been asserted in accordance
with the Copyright, Designs and Patents Act 1988.
Every effort has been made to contact the copyright holders of the material
reproduced in this book. If any have been inadvertently overlooked, the publisher
will be pleased to make restitution at the earliest opportunity.
You may not copy, store, distribute, transmit, reproduce or otherwise
make available this publication ( or any part of it) in any form, or by any means
(electronic, digital, optical, mechanical, photocopying, recording or otherwise),
without the prior written permission of the publisher. Any person who does
any unauthorized act in relation to this publication may be liable to
criminal prosecution and civil claims for damages.
The Macmillan Group has no responsibility for the information provided by
any author websites whose address you obtain from this book ('author websites').
The inclusion of author website addresses in this book does not constitute
an endorsement by or association with us of such sites or the content,
products, advertising or other materials presented on such sites.
This book remains true to the original in every way. Some aspects may appear
out-of-date to modern-day readers. Bello makes no apology for this, as to retrospectively
change any content would be anachronistic and undermine the authenticity of the original
Bello has no responsibility for the content of the material in this book. The opinions
expressed are those of the author and do not constitute an endorsement by,
or association with, us of the characterization and content.
A CIP catalogue record for this book is available from the British Library.
Visit **www.panmacmillan.com** to read more about all our books
| {
"redpajama_set_name": "RedPajamaBook"
} | 259 |
Q: Saving Multiple Select in input I have model for
*
*user(id,name)
*section(id,name)
*section_users(id,user_id,section_id)
The admin adds all the users and sections separately. Once theses are added I want the admin to selects the section and add all the users in it in section_users
I have a select input with multiple set to true. How do i save this data the cakephp way along with validation.
<?php echo $this->Form->input("section_id"); ?>
<?php echo $this->Form->input("user_id", array('multiple'=>'checkbox')); ?>
This generates
Array
(
[section_id] => 1
[user_id] => Array
(
[0] => 3
[1] => 4
)
)
I know i can loop and convert to this and use saveAll or saveMany but what is the cakephp way/right way to do it.
Array
(
[0] => Array
(
[section_id] => 1
[user_id] => 3
)
[1] => Array
(
[section_id] => 1
[user_id] => 4
)
)
A: As already mentioned, this is exaplained in the docs, please read them, and in case you don't understand them (which would be understandable as the HABTM section is a little confusing and requires some trial & error), tell us what exactly you are having problems with.
http://book.cakephp.org/2.0/en/models/saving-your-data.html#saving-related-model-data-habtm
Based on the examples shown, the format for saving multiple X to Y should be
Array
(
[Section] => Array
(
[id] => 1
)
[User] => Array
(
[User] => Array(3, 4)
)
)
The corresponding form could look like this:
<?php echo $this->Form->create('User'); ?>
<?php echo $this->Form->input('Section.id'); ?>
<?php echo $this->Form->input('User', array('multiple' => 'checkbox')); ?>
<?php echo $this->Form->end('Add Users'); ?>
And the data would be saved via the Section model, that way its modified column is being updated properly.
public function addUsersToSection($id) {
// ...
if($this->request->is('post')) {
if($this->Section->save($this->request->data)) {
// ...
} else {
// ...
}
} else {
$options = array(
'conditions' => array(
'Section.' . $this->Section->primaryKey => $id
)
);
$this->request->data = $this->Section->find('first', $options);
}
$users = $this->Section->User->find('list');
$this->set(compact('users'));
}
Another way would be to restructure the array as shown by Vinay Aggarwal, that works fine, the only difference is that it requires saving through the join model, and consequently it doesn't update the Section models modified column.
A: CakePHP has the saveMany function, as mentioned in the documentation:
Model::saveMany(array $data = null, array $options = array())¶
A: This is HABTM relation, first of all you need have relation setup in SectionUser model. Then you can use saveAll() method to save all records at once.
Array
(
[0] => Array
(
[user_id] => 33
[section_id] => 9
)
[1] => Array
(
[user_id] => 33
[section_id] => 10
)
)
Make sure your data array is in above given format.
$this->SectionUser->saveAll($data);
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 3,529 |
\section{Introduction}\label{section:intro}
\setcounter{page}{1}
\pagestyle{plain}
Over the past two decades, \emph{fair resource allocation} problems have received considerable attention in many application areas, including Internet congestion control \cite{low2002internet}, rate control in software defined networks \cite{mccormick2014real}, scheduling in wireless networks \cite{yi2008stochastic}, {multi-resource allocation and scheduling in datacenters} \cite{bonald2015multi, ghodsi2011dominant, joe2013multiresource, Im2014competitive}, and a variety of applications in operations research, economics, and game theory
\cite{bertsimas2012efficiency, jain2007eisenberg}. In most of these applications, positive linear (packing) constraints arise as a natural model of the allowable allocations.
In this paper, we focus on the problem of finding an {\em $\alpha$-fair} vector on the set determined by packing constraints $Ax\leq \mathds{1}, x\geq 0$ where all $A_{ij} \geq 0$.\footnote{Although in the network congestion control literature the constraint matrix $A$ is commonly assumed to be a 0-1 matrix \cite{kelly1998rate, kelly2014stochastic, yi2008stochastic, paganini2005congestion, MoWalrand2000, low2002internet}, important applications (such as, e.g., multi-resource allocation in datacenters) are modeled by a more general constraint matrix $A$ with arbitrary non-negative elements \cite{bonald2015multi, ghodsi2011dominant, joe2013multiresource, Im2014competitive}.} We refer to this problem as $\alpha-$fair packing.
For a vector of positive weights $w$ and $\alpha\geq 0$, an allocation vector $x^*$ of size $n$ is weighted $\alpha$-fai
, if for any alternative feasible vector $x$: $\sum_j w_j \frac{x_j-x_j^*}{(x_j^*)^\alpha}\leq 0$ \cite{MoWalrand2000}. For a compact and convex feasible region, $x^*$ can be equivalently defined as a vector that solves the problem of maximizing $p_{\alpha}(x) = \sum_j w_j f_{\alpha}(x_j)$ \cite{MoWalrand2000}, where:
\begin{equation}
f_{\alpha}(x_j) =
\begin{cases} \ln(x_j), & \mbox{if } \alpha=1 \\ \frac{x_j^{1-\alpha}}{1-\alpha}, & \mbox{if } \alpha\neq 1 \end{cases} \label{eq:f-alpha}.
\end{equation}
$\alpha$-fairness provides a trade-off between efficiency (sum of allocated resources) and fairness (minimum allocated resource) as a function of $\alpha$: the higher the $\alpha$, the better the fairness guarantees and the lower the efficiency \cite{atkinson1970measurement,bertsimas2012efficiency,lan2010axiomatic}. Important special cases are
proportional fairness ($\alpha = 1$) and max-min fairness ($\alpha \rightarrow \infty$). When $\alpha = 0$, we have the ``unfair" case of linear optimization.
Distributed algorithms for $\alpha-$fair packing are of particular interest, as many applications are inherently distributed (such as, e.g., network congestion control), while in others parallelization is highly desirable due to the large problem size (as in, e.g., resource allocation in datacenters). We adopt the model of distributed computation commonly used in the design of
packing linear programming (LP) algorithms \cite{AwerbuchKhandekar2009, d-allen2014using, d-bartal1997global, d-kuhn2006price, d-luby1993parallel, d-papadimitriou1993linear} and which generalizes the model from network congestion control \cite{kelly2014stochastic}. In this model, an agent $j$ controls the variable $x_j$ and has information about: (i) the $j^\text{th}$ column of the $m\times n$ constraint matrix $A$, (ii) the weight $w_j$, (iii) upper bounds on the global problem parameters $m, n, w_{\max}$, and $A_{\max}$, where $w_{\max} = \max_j w_j$, and $A_{\max} = \max_{ij} A_{ij}$, and (iv) in each round, the relative slack of each constraint $i$ in which $x_j$ takes part.
Distributed algorithms for $\alpha-$fair resource allocations have been most widely studied in the network congestion control literature, using a control-theoretic approach \cite{kelly1998rate, kelly2014stochastic, yi2008stochastic, paganini2005congestion, MoWalrand2000, low2002internet}. Such an approach yields continuous-time algorithms that converge after ``finite'' time; however, the convergence time of these algorithms as a function of the input size is poorly understood.
Some other distributed pseudo-polynomial-time approximation algorithms that can address $\alpha$-fair packing are described in Table~\ref{table:prev}. These algorithms all have convergence times that are at least linear in the parameters describing the problem.
No previous work has given truly fast (poly-log iterations) distributed algorithms for the general case of $\alpha$-fair packing. Only for the unfair $\alpha=0$ case (packing LPs), are such algorithms known \cite{AwerbuchKhandekar2009, d-luby1993parallel, d-bartal1997global, dc-young2001sequential, d-kuhn2006price, d-allen2014using}.
\paragraph{Our Results.}
\emph{We provide the first efficient, distributed, {and stateless} algorithm for
weighted $\alpha$-fair packing}, namely, for the problem
$\max\{p_\alpha(x): Ax\leq \mathds{1}, x\geq 0\}$,
{where distributed agents update the values of $x_j$'s asynchronously and react only to the current state of the constraints}. We assume that all non-zero entries $A_{ij}$ of matrix $A$ satisfy $A_{ij}\geq 1$. Considering such a normalized form of the problem is without loss of generality (see Appendix \iffullpaper \ref{appendix:scaling}\else {A} in the full version of the paper\fi).
The approximation provided by the algorithm, to which we refer as the $\varepsilon$-approximation, is (i) $(1+\varepsilon)$-multiplicative for $\alpha \neq 1$, and (ii) $W\varepsilon$-additive\footnote{Note that $W$ cannot be avoided here, as additive approximation is not invariant to the scaling of the objective.} for $\alpha = 1$, where $W = \sum_j w_j$. The main results are summarized in the following theorem, where, to unify the statement of the results, we treat $\alpha$ as a constant that is either equal to 1 or bounded away from 0 and 1, and we also loosen the bound in terms of $\varepsilon^{-1}, n, m, R_w = \max_{j, k} {w_j}/{w_k},$ and $A_{\max}$.
For a more detailed statement, see Theorems \ref{thm:convergence-alpha<1} -- \ref{thm:convergence-alpha>1}.
\begin{theorem}
(Main Resul
) For a given weighted $\alpha$-fair packing problem $\max\{\sum_j w_j f_\alpha(x_j): Ax\leq \mathds{1}, x\geq 0\}$, where $f_{\alpha}(x_j)$ is given by (\ref{eq:f-alpha}), there exists a stateless and distributed algorithm (\textsc{$\alpha$-FairPSolver}) that computes an $\varepsilon$-approximate solution in ${O}(\varepsilon^{-5}\ln^4(R_w nmA_{\max}\varepsilon^{-1}))$ rounds.
\end{theorem}
\emph{To the best of our knowledge, for any constant approximation parameter $\varepsilon$, our algorithm is the first distributed algorithm for weighted $\alpha$-fair packing problems with a poly-logarithmic convergence time.}
The algorithm is \emph{stateless} according to the definition given by Awerbuch and Khandekar \cite{AwerbuchKhandekar2009, awerbuch2007greedy}: it starts from any initial state, the agents update the variables $x_j$ in a cooperative but uncoordinated manner, reacting only to the current state of the constraints that they observe, and without access to a global clock. Statelessness implies various desirable properties of a distributed algorithm, such as: asynchronous updates, self-stabilization, and incremental and local adjustments \cite{AwerbuchKhandekar2009, awerbuch2007greedy}.
We also obtain the following structural results that characterize $\alpha-$fair packing allocations as a function of the value of
$\alpha$:
\begin{itemize}[topsep=5pt, leftmargin=10pt]
\itemsep0em
\item We derive a lower bound on the minimum coordinate of the $\alpha-$fair packing allocation as a function of $\alpha$ and the problem parameters (Lemma \ref{lemma:lower-bound}). This bound deepens our understanding of how the fairness (a minimum allocated value) changes with $\alpha$.
\item We prove that for $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$, $\alpha-$fair packing can be $O(\varepsilon)-$approximated by any $\varepsilon-$approximation packing LP solver (Lemma \ref{lemma:LP-close-to-small-alpha-fair}). This result allows us to focus on the $\alpha > \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$ cases.
\item We show that for $|\alpha-1| = O({\varepsilon^2}/{\ln^2(\varepsilon^{-1}R_w mnA_{\max})})$, $\alpha-$fair allocation is $\varepsilon-$approximated by a $1-$fair allocation returned by our algorithm (Lemmas \ref{lemma:alpha-close-to-1-below} and \ref{lemma:alpha-close-to-1-above}).
\item We show that for $\alpha \geq \ln(R_w n A_{\max})/\varepsilon$, the $\alpha-$fair packing allocation $x^*$ and the max-min fair allocation $z^*$ are $\varepsilon$-close to each other: $(1-\varepsilon)z^*\leq x^* \leq (1+\varepsilon)z^*$ element-wise. This result is especially interesting as {(i)} max-min fair packing is not a convex problem, but rather a multi-objective problem
(see, e.g., \cite{kleinberg1999fairness, radunovic2007unified}) {and (ii) the result yields the first convex relaxation of max-min fair allocation problems with a $1\pm \varepsilon$ gap}.
\end{itemize}
We now
overview some of the main technical details of \textsc{$\alpha$-FairPSolver}. In doing so, we
point out connections to the two main bodies of previous work, from packing LPs\cite{AwerbuchKhandekar2009} and network congestion control \cite{kelly1998rate}. We also outline the new algorithmic ideas and proofs that were needed to obtain the results.
\paragraph{The algorithm and KKT conditions.}
The algorithm maintains primal and dual feasible solutions and updates each primal variable $x_j$ whenever a Karush-Kuhn-Tucker (KKT) condition ${x_j}^\alpha \sum_{i} y_iA_{ij} = w_j$ is not \emph{approximately} satisfied. {In previous work, relevant update rules include}: \cite{kelly1998rate} (for $\alpha=1$), where the update of each variable $x_j$ is proportional to the difference $w_j - {x_j}^{\alpha}\sum_i y_i A_{ij}$, and \cite{AwerbuchKhandekar2009} (for $\alpha=0$), where each $x_j$ is updated by a multiplicative factor $1\pm \beta$, whenever ${x_j}^\alpha \sum_{i} y_iA_{ij} = w_j$ is not {approximately} satisfied. {For our techniques (addressing a general $\alpha$) such rules do not suffice and we introduce the following modifications}: (i) in the $\alpha<1$ case we use multiplicative updates by factors $(1+\beta_1)$ and $(1-\beta_2)$, where $\beta_1 \neq \beta_2$ and (ii) we use additional threshold values $\delta_j$ to make sure that $x_j$'s do not become too small. These thresholds guarantee that we maintain a feasible solution, but they significantly complicate (compared to the linear case) the argument that each step makes a significant progress.
\paragraph{Dual Variables.}
In \textsc{$\alpha$-FairPSolver}, a dual variable $y_i$
is an exponential function of the $i^\text{th}$ constraint's relative slack: $y_i(x) = C\cdot e^{\kappa(\sum_jA_{ij}x_j - 1)}$, where $C$ and $\kappa$ are functions of global input parameters $\alpha, w_{\max}, n, m,$ and $A_{\max}$. Packing LP algorithms \cite{AwerbuchKhandekar2009, d-allen2014using, c-plotkin1995fast, d-bartal1997global, c-garg2007faster, c-fleischer2000approximating, c-koufogiannakis2007beating} use similar dual variables {with $C=1$}. Our work requires choosing $C$ to be a function of $\alpha, w_{\max}, n, m,A_{\max}$ rather than a constant.
\paragraph{Convergence Argument.}
The convergence analysis of \textsc{$\alpha$-FairPSolver} relies on the appropriately chosen concave potential function that is bounded below and above for $x_j\in[\delta_j, 1]$, $\forall j$, and that increases with every primal update. The algorithm can also be interpreted as a gradient ascent on a regularized objective function (the potential function), using a generalized entropy regularizer (see \cite{d-allen2014using, c-allen2015nearly}). A similar potential function was used in many works on packing and covering linear programs, such as, e.g., in \cite{AwerbuchKhandekar2009} and (implicitly) in \cite{dc-young2001sequential}. The Lyapunov function from \cite{kelly1998rate} is also equivalent to this potential function when $y_i(x) = C\cdot e^{\kappa(\sum_jA_{ij}x_j - 1)}$, $\forall i$. As in these works, the
main idea in the analysis is to show that whenever a solution $x$ is not ``close" to the optimal one, the potential function increases substantially.
However, our work requires several new ideas in the convergence proofs, the most notable being
{\em stationary rounds}. A stationary round is roughly a time when the variables $x_j$ do not change much and are close to the optimum. Poly-logarithmic convergence time is then obtained by showing that: (i) there is at most a poly-logarithmic number of non-stationary rounds where the potential function increases additively and the increase is ``large enough'', and (ii) in all the remaining non-stationary rounds, the potential function increases multiplicatively.
Our use of stationary rounds is new, as is the use of Lagrangian duality and all the arguments that follow.
\begin{table}[t]
\begin{center}
\small
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{| c | c | c | c |}
\hline
\textbf{Paper} & \textbf{Number of Distributed Iterations}\footnote{The convergence times in \cite{cheung2013tatonnement, Beck2014Gradient, mosk2010fully} are not stated only in terms of the input parameters, but also in terms of intermediary parameters that depend on the problem structure. Stated here are our lowest estimates of the worst-case convergence times
} & \textbf{Statelessness} & \textbf{Notes} \\ \hline
\cite{cheung2013tatonnement} & $\Omega({\varepsilon}^{-1}{nA_{\max}})$ & Semi-stateless\footnote{A distributed algorithm is semi-stateless, if all the updates depend only on the current state of the constraints, the updates are performed in a cooperative but non-coordinated manner, and \emph{the updates need to be synchronous} \cite{d-allen2014using}.} & Only for $\alpha = 1$\\ \hline
\cite{Beck2014Gradient} & $\Omega({\varepsilon}^{-1}{mn{A_{\max}}^2})$ & Not stateless &\\
\hline
\cite{mosk2010fully} & poly($\varepsilon^{-1}, m, n, A_{\max}$) & Semi-stateless & \\
\hline
\red{[this work]} & \mathcolor{red}{$O({\varepsilon^{-5}}{\ln^4(R_w mn A_{\max}/\varepsilon)})$} & \red{Stateless} &\\
\hline
\end{tabular}
\end{center}
\caption{Comparison among distributed algorithms for $\alpha-$fair packing.}\vspace{-15pt}
\label{table:prev}
\end{table}
\paragraph{Relationship to Previous Work.}
Very little progress has been made in the design of efficient distributed algorithms for the general class of $\alpha$-fair objectives.
Classical work on distributed rate control algorithms in the networking literature uses a control-theoretic approach to optimize $\alpha$-fair objectives. While such an approach has been extensively studied and applied to various network settings \cite{kelly1998rate, kelly2014stochastic, yi2008stochastic, paganini2005congestion, MoWalrand2000, low2002internet}, it {has never been proven to have polynomial} convergence time {(and it is unclear whether such a result can be established)}
Since $\alpha$-fair objectives are concave, their optimization over a region determined by linear constraints is solvable in polynomial time in a centralized setting through convex programming (see, e.g., \cite{boyd2009convex, nesterov2004introductory}). Distributed gradient methods for network utility maximization problems, such as e.g., \cite{Beck2014Gradient, mosk2010fully} summarized in Table \ref{table:prev}, can be employed to address the problem of $\alpha$-fair packing. However, the convergence times of these algorithms depend on the dual gradient's Lipschitz constant to produce good approximations. While \cite{Beck2014Gradient, mosk2010fully} provide a better dependence on the accuracy $\varepsilon$ than our work, the dependence on the dual gradient's Lipschitz constant, in general, leads to at least linear convergence time as a function of $n$, $m$, and $A_{\max}$.
As mentioned before, some special cases have been addressed, particularly for max-min fairness ($\alpha \rightarrow \infty$) and for packing LPs ($\alpha = 0$). Relevant work on max-min fairness includes \cite{Bertsekas:1987:DN:12517, jaffe1981bottleneck, kumar2000fairness, kleinberg1999fairness, megiddo1974optimal, marasevic2014max,charny1995congestion}, but none of these works have poly-logarithmic convergence time.
There is a long history of interesting work on packing LPs in both centralized and distributed settings, e.g., \cite{c-allen2015nearly, c-plotkin1995fast, c-koufogiannakis2007beating, c-garg2007faster, AwerbuchKhandekar2009, d-luby1993parallel, d-bartal1997global, dc-young2001sequential, d-kuhn2006price, d-allen2014using, garg2002line}. Only a few of these works are stateless, including
the packing LP algorithm of Awerbuch and Khandekar \cite{AwerbuchKhandekar2009}, flow control algorithm of Garg and Young \cite{garg2002line}, and the algorithm of Awerbuch, Azar, and Khandekar \cite{awerbuch2008fast} for the special case of load balancing in bipartite graphs. Additionally, the packing LP algorithm of Allen-Zhu and Orecchia \cite{d-allen2014using} is ``semi-stateless''; the lacking property to make it stateless is that it requires synchronous updates.
The $\alpha=1$ case of $\alpha$-fair packing problems is equivalent to the problem of finding an equilibrium allocation in Eisenberg-Gale markets with Leontief utilities (see \cite{cheung2013tatonnement}). Similar to the aforementioned algorithms, the algorithm from \cite{cheung2013tatonnement} converges in time linear in $\varepsilon^{-1}$ but also (at least) linear in the input size (see Table 1).
{In terms of the techniques, closest to our work is the work by Awerbuch and Khandekar \cite{AwerbuchKhandekar2009} and we now highlight the differences compared to this work. \emph{Some preliminaries} of the convergence proof follow closely those from \cite{AwerbuchKhandekar2009}: mainly, Lemmas \ref{lemma:feasibility}, \ref{lemma:approx-comp-slack}, and \ref{lemma:potential-increase} use similar arguments as corresponding lemmas in \cite{AwerbuchKhandekar2009}. Some parts of the lemmas lower-bounding the potential increase in $\alpha<1$, $\alpha = 1$, and $\alpha>1$ cases (Lemmas \ref{lemma:potential-increase-alpha<1}, \ref{lemma:potential-increase-proportional}, and \ref{lemma:potential-increase-alpha>1}) use similar arguments as \cite{AwerbuchKhandekar2009}, however, even those parts require additional results due to the existence of lower thresholds $\delta_j$.}
{The similarity ends here, as the main convergence arguments are different than those used in \cite{AwerbuchKhandekar2009}. In particular, the convergence argument from \cite{AwerbuchKhandekar2009} relying on stationary intervals cannot be applied in the setting of $\alpha-$fair objectives. More details about why this argument cannot be applied and where it fails are provided in Section \ref{section:convergence}. As already mentioned, we rely on the appropriately chosen definition of a stationary round. To show that in a stationary round a solution $x$ is $\varepsilon-$approximate, we use Lagrangian duality and bound the duality gap through an intricate case analysis. We remark that such an argument could not have been used in \cite{AwerbuchKhandekar2009}, since in the packing LP case there is no guarantee that the solution $y$ is dual-feasible.
}
\paragraph{Organization of the Paper.} The rest of the paper is organized as follows. Section \ref{section:prelims} provides the background. Section \ref{section:algorithm} describes the algorithm, and Section \ref{section:convergence} \iffullpaper provides \else illustrates \fi the convergence analysis and structural results. \iffullpaper Section \ref{section:conclusion} concludes the paper. \else We conclude in Section \ref{section:conclusion}. {The omitted technical details can be found in the full version of the paper.}\fi
\section{Preliminaries}\label{section:prelims}
\paragraph{Weighted $\alpha$-Fair Packing.}
Consider the following optimization problem with positive linear (packing) constraints:
$
{(Q_\alpha)}=\max \{p_\alpha(x)\equiv\sum_{j=1}^n w_jf_{\alpha}(x_j): Ax \leq b, x\geq 0\},
$
where $f_{\alpha}(x_j)$ is given by (\ref{eq:f-alpha}), $x=(x_1,...,x_n)$ is the vector of variables, $A$ is an $m\times n$ matrix with non-negative elements, and $b=(b_1,...,b_m)$ is a vector with strictly positive\footnote{If, for some $i$, $b_i=0$, then trivially $x_j = 0$, for all $j$ such that $A_{ij}\neq 0$.} elements. We refer to
$(Q_\alpha)$ as the weighted $\alpha$-fair packing.
The following definition and lemma introduced by Mo and Walrand \cite{MoWalrand2000} characterize weighted $\alpha$-fair allocations. In the rest of the paper, we will use the terms weighted $\alpha$-fair and $\alpha$-fair interchangeably.
\begin{definition}
\emph{\cite{MoWalrand2000}} Let $w=(w_1, ..., w_n)$ be a vector with positive entries and $\alpha>0$. A vector $x^*=(x_1^*,...,x_n^*)$ is weighted $\alpha$-fair, if it is feasible and for any other feasible vector $x$:
$
\sum_{j=1}^n w_j\frac{x_j-x_j^*}{{x_j^*}^\alpha}\leq 0.
$
\end{definition}
\begin{lemma}
\emph{\cite{MoWalrand2000}} A vector $x^*$ solves $(Q_\alpha)$ for functions $f_{\alpha}(x_j^*)$ if and only if it is weighted $\alpha$-fair.
\end{lemma}
Notice in $(Q_\alpha)$ that since $b_i > 0$, $\forall i$, and the partial derivative of the objective with respect to any of the variables $x_j$ goes to $\infty$ as $x_j\rightarrow 0$, the optimal solution must lie in the positive orthant. Moreover, since the objective is strictly concave and maximized over a convex region, the optimal solution is unique and $(Q_\alpha)$ satisfies strong duality (see, e.g., \cite{boyd2009convex}). The same observations are true for the scaled version of the problem denoted by $(P_\alpha)$ and introduced in the following subsection.
\paragraph{Normalized Form.
We consider the weighted $\alpha$-fair packing problem in the normalized form:
\begin{align*}
(P_\alpha) = {\max} \big\{p_\alpha(x): Ax \leq \mathds{1}, x\geq 0\big\},
\end{align*}
where
$p_\alpha(x) = \sum_{j=1}^n w_jf_{\alpha}(x_j)$, $f_\alpha$ is defined by (\ref{eq:f-alpha}), $w=(w_1,...,w_n)$ is a vector of positive weights, $x=(x_1,...,x_n)$ is the vector of variables, $A$ is an $m\times n$ matrix with non-negative entries, and $\mathds{1}$ is a size-$m$ vector of 1's. We let $A_{\max}$ denote the maximum element of the constraint matrix $A$, and assume that every entry $A_{ij}$ of $A$ is non-negative, and moreover, that $A_{ij}\geq 1$ whenever $A_{ij}\neq 0$. The maximum weight is denoted by $w_{\max}$ and the minimum weight is denoted by $w_{\min}$. The sum of the weights is denoted by $W$ and the ratio $\frac{w_{\max}}{w_{\min}}$ by $R_w$.
We remark that considering problem $(Q_\alpha)$ in the normalized form $(P_\alpha)$ is without loss of generality: any problem $(Q_\alpha)$ can be scaled to this form by (i) dividing both sides of each inequality $i$ by $b_i$ and (ii) working with scaled variables $c\cdot x_j$, where $c = \min\{1,\, \min_{\{i, j: A_{ij\neq 0}\}}\frac{A_{ij}}{b_i}\}$.
Moreover, such scaling preserves the approximation (\iffullpaper \ref{appendix:scaling} \else {see Appendix A in the full version of the paper}\fi).
\paragraph{KKT Conditions and Duality Gap}\label{section:lower-bound-duality-gap}
We will denote the Lagrange multipliers for $(P_\alpha)$ as $y = (y_1,...,y_m)$ and refer to them as ``dual variables''. The KKT conditions for $(P_\alpha)$ are \iffullpaper (see Appendix \ref{appendix:primal-dual-duality-gap})\else {(see Appendix B in the full version)}\fi:
\begin{align}
\smallskip
\mathop{\textstyle\sum}_{j=1}^n A_{ij}x_j\leq 1, \quad\forall i\in\{1,...,m\};\quad x_j\geq 0, \quad\forall j\in \{1,...,n\} \quad &\text{(primal feasibility)}\tag{K1}\label{eq:K1}\\[-3pt]
y_i \geq 0, \quad\forall i\in\{1,...,m\} \quad &\text{(dual feasibility)}\tag{K2}\label{eq:K2}\\[-3pt]
y_i\cdot\Big(\mathop{\textstyle\sum}_{j=1}^m A_{ij} x_j - 1\Big) = 0, \quad\forall i\in\{1,...,m\}\quad &\text{(complementary slackness)}\tag{K3}\label{eq:K3}\\[-4pt]
{x_j}^\alpha\mathop{\textstyle\sum}_{i=1}^m y_i A_{ij} = w_j, \quad \forall j\in \{1,...,m\}\quad &\text{(gradient conditions)}\tag{K4}\label{eq:K4}
\end{align}
The duality gap for $\alpha \neq 1$ is \iffullpaper (see Appendix \ref{appendix:primal-dual-duality-gap})\else {(see Appendix B in the full version of the paper)}\fi:
\begin{align}G_{\alpha}(x, y) =
\mathop{\textstyle\sum}_{j=1}^n w_j\frac{{x_j}^{1-\alpha}}{1-\alpha}\big({\xi_j}^{\frac{\alpha-1}{\alpha}}-1\big) +\mathop{\textstyle\sum}_{i=1}^m y_i - \mathop{\textstyle\sum}_{j=1}^n w_j x_j^{1-\alpha}\cdot {\xi_j}^{\frac{\alpha-1}{\alpha}},\label{eq:duality-gap-alpha}
\end{align}
where $\xi_j = \frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}$, while for $\alpha = 1$:
\begin{align}
G_1(x, y) = - \mathop{\textstyle\sum}_{j=1}^n w_j \ln\Big(\frac{x_j\small{\sum_{i=1}^m} y_i A_{ij}}{w_j}\Big)+\mathop{\textstyle\sum}_{i=1}^m y_i -W.\label{eq:duality-gap-proportional}
\end{align}
\paragraph{Model of Distributed Computation}
We adopt the same model of distributed computation as \cite{AwerbuchKhandekar2009, d-allen2014using, d-bartal1997global, d-kuhn2006price, d-luby1993parallel, d-papadimitriou1993linear}, described as follows. We assume that for each $j\in\{1,...,n\}$, there is an agent controlling the variable $x_j$. Agent $j$ is assumed to have information about the following problem parameters: (i) the $j^\text{th}$ column of $A$, (ii) the weight $w_j$, and (iii) (an upper bound on) $m, n, w_{\max}$, and $A_{\max}$. In each round, agent $j$ collects the relative slack\footnote{The slack is ``relative'' because in a non-scaled version of the problem where one could have $b_i\neq 1$, agent $j$ would need to have information about $\frac{b_i - \sum_{j=1}^n A_{ij}x_j}{b_i}$.} $1 - \sum_{j=1}^n A_{ij}x_j$ of all constraints $i$ for which $A_{ij} \neq 0$.
We remark that this model of distributed computation is a generalization of the model considered in network congestion control problems \cite{kelly2014stochastic} where a variable $x_j$ corresponds to the rate of node $j$, $A$ is a 0-1 routing matrix, such that $A_{ij} = 1$ if and only if a node $j$ sends flow over link $i$, and $b$ is the vector of link capacities. Under this model, the knowledge about the relative slack of each constraint corresponds to each node collecting (a function of) congestion on each link that it utilizes. Such a model was used in network utility maximization problems with $\alpha$-fair objectives \cite{kelly1998rate} and general strongly-concave objectives \cite{Beck2014Gradient}.
\section{Algorithm}\label{section:algorithm}
The pseudocode for the \textsc{$\alpha$-FairPSolver} algorithm that is run at each node $j$ is provided in Fig~1.
The basic intuition is that the algorithm keeps KKT conditions (\ref{eq:K1}) and (\ref{eq:K2}) satisfied and works towards (approximately) satisfying the remaining two KKT conditions (\ref{eq:K3}) and (\ref{eq:K4}) to minimize the duality gap.
The algorithm can run in the distributed setting described in Section \ref{section:prelims}. In each round, an agent $j$ updates the value of $x_j$ based on the relative slack of all the constraints in which $j$ takes part, as long as the KKT condition (\ref{eq:K4}) of agent $j$ is not approximately satisfied.
The updates need not be synchronous: we will require that all agents make updates at the same speed, but without access to a global clock.
\begin{figure}[!ht]
\small{
\hrulefill\\
\textsc{$\alpha$-FairPSolver}($\varepsilon$)\\[-8pt]
\hrule
\begin{algorithmic}[1]
\vspace{2pt}\Statex (Parameters $\delta_j, C, \kappa, \gamma, \beta_1,$ and $\beta_2$ are set as described in the text below the algorithm.)
\Statex In each round of the algorithm:
\State $x_j \leftarrow \max\{x_j, \delta_j\}$, $x_j = \min\{x_j, 1\}$
\State Update the dual variables: $y_i = C\cdot e^{\kappa \left(\sum_{j=1}^n A_{ij}x_j - 1 \right)}$ $\forall i\in\{1,...,m\}$
\If {$\frac{{x_j}^{\alpha}\cdot\sum_{i=1}^m y_i A_{ij}}{w_j}\leq (1-\gamma)$}
\State $x_j \leftarrow x_j \cdot(1+\beta_1)$
\Else\If {$\frac{{x_j}^{\alpha}\cdot\sum_{i=1}^m y_i A_{ij}}{w_j}\geq (1+\gamma)$}
\State $x_j \leftarrow \max\{x_j\cdot(1-\beta_2), \delta_j\}$
\EndIf\EndIf
\end{algorithmic}}\vspace{-10pt}
\hrulefill
\caption{Pseudocode of \textsc{$\alpha$-FairPSolver} algorithm.}\vspace{-10pt}
\end{figure}
To allow for self-stabilization and dynamic changes, the algorithm runs forever at all the agents, which is a standard requirement for self-stabilizing algorithms (see, e.g., \cite{dolev2000self}). The convergence of the algorithm is measured as the number of rounds between the round in which the algorithm starts from some initial solution and the round in which it reaches an $\varepsilon-$approximate solution, assuming that there are no hard reset events or node/constraint insertions/deletions in between.
Without loss of generality, we assume that the input parameter $\varepsilon$ that determines the approximation quality satisfies $\varepsilon\leq \min\{\frac{1}{6}, \frac{9}{10\alpha}\}$ for any $\alpha$, and $\varepsilon\leq \frac{1-\alpha}{\alpha}$ for $\alpha<1$.
The parameters $\delta_j, C, \kappa, \gamma$, $\beta_1$, and $\beta_2$ are set as follows. For technical reasons (mainly due to reinforcing dominant multiplicative updates of the variables $x_j$), we set the values of the lower thresholds $\delta_j$ below the actual lower bound of the optimal solution that we derive in Lemma \ref{lemma:lower-bound}:
\begin{equation*}
\delta_j = \left(\frac{1}{2}\cdot \frac{w_j}{w_{\max}}\right)^{1/\alpha}\cdot\begin{cases} \big(\frac{1}{m\cdot n^2\cdot A_{\max}}\big)^{1/\alpha}, & \mbox{if } 0<\alpha\leq 1\\
\frac{1}{m\cdot n^2 {A_{\max}}^{2-1/\alpha}}, & \mbox{if } \alpha> 1 \end{cases}.
\end{equation*}
We denote $\delta_{\max}\equiv \max_j \delta_j$, $\delta_{\min}\equiv \min_j \delta_j$.
The constant $C$ that multiplies the exponent in the dual variables $y_i$ is chosen as $C = \frac{W}{\sum_{j=1}^n {\delta_j}^\alpha}$. Because $\delta_j$ only depends on $w_j$ and on global parameters, we also have $C = \frac{w_j}{{\delta_j}^\alpha}$, $\forall j$. The parameter $\kappa$ that appears in the exponent of the $y_i$'s is chosen as $\kappa = \frac{1}{\varepsilon}\ln\big(\frac{C m A_{\max}}{\varepsilon w_{\min}}\big)$. The ``absolute error'' of (\ref{eq:K4}) $\gamma$ is set to $\varepsilon/4$. For $\alpha \geq 1$, we set $\beta_1 = \beta_2 = \beta$, where the choice of $\beta$ is described below. For $\alpha < 1$, we set $\beta_1 = \beta$, $\beta_2 = \beta^2 (\ln(\frac{1}{\delta_{\min}}))^{-1}$.
Similar to \cite{AwerbuchKhandekar2009}, we choose the value of $\beta$ so that if we set $\beta_1=\beta_2 = \beta$, in any round the value of each $\frac{{x_j}^\alpha \sum_{i=1}^m y_i(x)A_{ij}}{w_j}$ changes by a multiplicative factor of at most $(1\pm \gamma/4)$. Since the maximum increase over any $x_j$ in each iteration is by a factor $1+\beta$, and $x$ is feasible in each round (see Lemma \ref{lemma:feasibility}), we have that $\sum_{j=1}^n A_{ij}x_j\leq 1$, and therefore, the maximum increase in each $y_i$ is by a factor of $e^{\kappa\beta}$. A similar argument holds for the maximum decrease. Hence, we choose $\beta$ so that:
\begin{align*}
(1+\beta)^{\alpha}e^{\kappa\beta}\leq 1+\gamma/4 \quad\text{ and }\quad
(1-\beta)^{\alpha}e^{-\kappa\beta}\geq 1-\gamma/4,
\end{align*}
and it suffices to set:
\begin{equation*}
\beta = \begin{cases} \frac{\gamma}{5(\kappa+1)}, & \mbox{if } \alpha\leq 1 \\
\frac{\gamma}{5(\kappa+\alpha)}, & \mbox{if } \alpha> 1 \end{cases}.
\end{equation*}
\noindent\textbf{Remark:} In the $\alpha<1$ cases, since $\beta_2 = {\beta^2}({\ln({1}/{\delta_{\min}})})^{-1}$, the maximum decrease in $\frac{{x_j}^\alpha\sum_i y_i(x)A_{ij}}{w_j}$ is by a factor $(1-({\gamma}/{4})\cdot {\beta}({\ln(1/\delta_{\min})})^{-1})$, $\forall j$.
\section{Convergence Analysis}\label{section:convergence}
In this section, we analyze the convergence time of \textsc{$\alpha$-FairPSolver}. We first state our main theorems and provide some general results that hold for all $\alpha > 0$. We show that starting from an arbitrary solution, the algorithm reaches a feasible solution within poly-logarithmic (in the input size) number of rounds, and maintains a feasible solution forever after. Similar to \cite{AwerbuchKhandekar2009, dc-young2001sequential, kelly1998rate}, we use a concave potential function that, for feasible $x$, is bounded below and above and increases with any algorithm update.
\iffullpaper Then, we analyze the convergence time separately for three cases: $\alpha<1$, $\alpha = 1$, and $\alpha>1$.
With an appropriate definition of a \emph{stationary round} for each of the three cases, we show that in every stationary round, $x$ approximates ``well'' the optimal solution by bounding the duality gap. On the other hand, for any non-stationary round, we show that the potential increases substantially. This large increase in the potential then leads to the conclusion that there cannot be too many non-stationary rounds, thus bounding the overall convergence time. \else Then, we sketch the proof of Theorem \ref{thm:convergence-alpha>1} ($\alpha>1$), while we defer the full proofs of the three theorems to the full version of this paper. The main proof idea in all the cases is as follows. With an appropriate definition of a \emph{stationary round} for each of the three cases $\alpha<1$, $\alpha = 1$, and $\alpha>1$, we show that in every stationary round, $x$ approximates ``well'' the optimal solution by bounding the duality gap. On the other hand, for any non-stationary round, we show that the potential increases substantially. This large increase in the potential leads to the conclusion that there cannot be too many non-stationary rounds, thus bounding the overall convergence time. \fi
We make a few remarks here. First, we require that $\alpha$ be bounded away from zero. This requirement is without loss of generality because we show that when $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$, any $\varepsilon-$approximation LP provides a $3\varepsilon-$approximate solution to $(P_\alpha)$ (Lemma \ref{lemma:LP-close-to-small-alpha-fair}). Thus, when $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$ we can switch to the algorithm of \cite{AwerbuchKhandekar2009}, and when $\alpha > \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$, the convergence time remains poly-logarithmic in the input size and polynomial in $\varepsilon^{-1}$.
Second, the assumption that $\varepsilon\leq \frac{1-\alpha}{\alpha}$ in the $\alpha<1$ case is also without loss of generality, because we show that when $\alpha$ is close to 1 (roughly, $1 - O(\varepsilon^2/\ln^2(R_w mnA_{\max}/\varepsilon))$), we can approximate $(P_\alpha)$ by switching to the $\alpha=1$ case of the algorithm (Lemma \ref{lemma:alpha-close-to-1-below}).
Finally, when $\alpha > 1$, the algorithm achieves an $\varepsilon-$approximation in time ${O}(\alpha^4\varepsilon^{-4} \ln^2(R_w nmA_{\max}\varepsilon^{-1}))$.
We believe that a polynomial dependence on $\alpha$ is difficult to avoid in this setting, because by increasing $\alpha$, the gradient of the $\alpha$-fair utilities $f_{\alpha}$ blows up on the interval $(0, 1)$: as $\alpha$ increases, $f_{\alpha}(x)$ quickly starts approaching a step function that is equal to $-\infty$ on the interval $(0, 1]$ and equal to 0 on the interval $(1, \infty]$. To characterize the behavior of $\alpha-$fair allocations as $\alpha$ becomes large, we show that when $\alpha \geq {\varepsilon}^{-1}{\ln(R_w n A_{\max})}$, all the coordinates of the $\alpha-$fair vector are within a $1\pm \varepsilon$ multiplicative factor of the corresponding coordinates of the max-min fair vector (Lemma \ref{lemma:mmf-alpha-fair}).
{Finally, we note that the main convergence argument from \cite{AwerbuchKhandekar2009} that uses an appropriate definition of \emph{stationary intervals} does not extend to our setting. The proof from \cite{AwerbuchKhandekar2009} ``breaks'' in the part that shows that the solution is $\varepsilon-$approximate throughout any stationary interval, stated as Lemma 3.7 in \cite{AwerbuchKhandekar2009}. The proof of Lemma 3.7 in \cite{AwerbuchKhandekar2009} is by contradiction: assuming that the solution is not $\varepsilon-$approximate, the proof proceeds by showing that at least one of the variables would increase in each round of the stationary interval, thus eventually making the solution infeasible and contradicting one of the preliminary lemmas. For $\alpha\geq 1$, unlike the linear objective in \cite{AwerbuchKhandekar2009}, $\alpha$-fair objectives are negative, and the assumption that the solution is not $\varepsilon-$approximate does not lead to any conclusive information. For $\alpha<1$, adapting the proof of Lemma 3.7 from \cite{AwerbuchKhandekar2009} leads to the conclusion that for at least one $j$, in each round $t$ of the stationary interval $\frac{{(x_j^*)}^{\alpha}\sum_i y_i(x^t)A_{ij}}{w_j}\leq 1-\gamma$, where $x^*$ is the optimal solution, and $x^t$ is the solution at round $t$. In \cite{AwerbuchKhandekar2009}, where $\alpha=0$, this implies that $x_j$ increases in each round of the stationary interval, while in our setting ($\alpha>0$) it is not possible to draw such a conclusion. }
\paragraph{Main Results.
Our main results are summarized in the following three theorems.
The objective
is denoted by $p_\alpha(x)$, $x^t$ denotes the solution at the beginning of round $t$, and $x^*$ denotes the optimal solution.
\begin{theorem}\label{thm:convergence-alpha<1}
(Convergence for $\alpha < 1$) \textsc{$\alpha$-FairPSolver} solves $(P_\alpha)$ approximately for $\alpha < 1$ in time that is polynomial in $\frac{\ln(nmA_{\max})}{\alpha\varepsilon}$. In particular, after at most
\begin{equation}
O\left(\alpha^{-2}\varepsilon^{-5}\ln^2\left(R_w mnA_{\max}\right)\ln^2\left(\varepsilon^{-1} R_w mnA_{\max}\right)\right)
\label{eq:thm-alpha<1-convergence-time}
\end{equation}
rounds, there exists at least one round $t$ such that $p_\alpha(x^*) - p_\alpha(x^t)\leq \varepsilon p_\alpha(x^t)$. Moreover, the total number of rounds $s$ in which $p_\alpha(x^*) - p_\alpha(x^s)> \varepsilon p_\alpha(x^s)$ is also bounded by (\ref{eq:thm-alpha<1-convergence-time}).
\end{theorem}
\begin{theorem}\label{thm:convergence-alpha=1} (Convergence for $\alpha = 1$) \textsc{$\alpha$-FairPSolver} solves $(P_1)$ approximately in time that is polynomial in $\varepsilon^{-1}\ln(R_w nmA_{\max})$.
In particular, after at most
\begin{equation}
O\left(\varepsilon^{-5} \ln^2\left(R_w nmA_{\max} \right)\ln^2\left( \varepsilon^{-1} R_w nmA_{\max} \right)\right) \label{eq:alpha=1-conv-time-bound}
\end{equation}
rounds, there exists at least one round $t$ such that $p(x^*) - p(x^t)\leq \varepsilon W$. Moreover, the total number of rounds $s$ in which $p(x^*) - p(x^s)> \varepsilon W$ is also bounded by (\ref{eq:alpha=1-conv-time-bound}).
\end{theorem}
\begin{theorem}\label{thm:convergence-alpha>1}
(Convergence for $\alpha>1$) \textsc{$\alpha$-FairPSolver} solves $(P_\alpha)$ approximately for $\alpha > 1$ in time that is polynomial in ${\varepsilon}^{-1} \ln(nmA_{\max})$.
In particular, after at most:
\begin{equation}
O\left(\alpha^4\varepsilon^{-4} \ln\left( R_w nmA_{\max}\right) \ln\left(\varepsilon^{-1} R_w nmA_{\max}\right)\right) \label{eq:thm-alpha>1-convergence-time}
\end{equation}
rounds, there exists at least one round $t$ such that $p_\alpha(x^*) - p_\alpha(x^t) \leq \varepsilon(-p_{\alpha}(x^t))$. Moreover, the total number of rounds $s$ in which $p_\alpha(x^*) - p_\alpha(x^s) > \varepsilon(-p_{\alpha}(x^s))$ is also bounded by (\ref{eq:thm-alpha>1-convergence-time}).
\end{theorem}
\iffullpaper \else Proofs of Theorem \ref{thm:convergence-alpha<1} and Theorem \ref{thm:convergence-alpha=1} are provided in {the full version of the paper}. We sketch the proof of Theorem \ref{thm:convergence-alpha>1} in Section \ref{section:alpha>1}.\fi
\paragraph{Feasibility and Approximate Complementary Slackness.}
The following three lemmas are preliminaries for the convergence time analysis. Lemma \ref{lemma:feasibility} shows that starting from a feasible solution, the algorithm always maintains a feasible solution. Lemma \ref{lemma:self-stabilization} shows that any violated constraint becomes feasible within poly-logarithmic number of rounds, and remains feasible forever after. Combined with Lemma \ref{lemma:feasibility}, Lemma \ref{lemma:self-stabilization} allows us to focus only on the rounds with feasible solutions $x$. Lemma \ref{lemma:approx-comp-slack} shows that after a poly-logarithmic number of rounds, approximate complementary slackness (KKT condition (\ref{eq:K3})) holds in an aggregate sense: $\sum_{i=1}^m y_i (x)\big(\sum_{j=1}^n A_{ij}x_j - 1\big)\approx 0$.
\begin{lemma}\label{lemma:feasibility}
If the algorithm starts from a feasible solution, then the algorithm maintains a feasible solution $x$: $x_j\geq 0$, $\forall j$ and $\sum_{j=1}^n A_{ij}x_j\leq 1$, $\forall i$, in each round.
\end{lemma}
\iffullpaper
\begin{proof}
By the statement of the lemma, the solution is feasible initially. From the way that the algorithm makes updates to the variables $x_j$, it is always true that $x_j \geq 0$, $\forall j$.
Now assume that $x$ becomes infeasible in some round, and let $x^0$ denote the (feasible) solution before that round, $x^1$ denote the (infeasible) solution after the round. We have:
\begin{align*}
\sum_{\ell=1}^n A_{i\ell}x_{\ell}^0 \leq 1, \quad\forall i\in\{1,...,m\}, \quad\text{ and }\quad
\sum_{\ell=1}^n A_{k\ell}x_{\ell}^1 >1, \quad\text{for some } k\in\{1,...,m\}.
\end{align*}
For this to be true, $x$ must have increased over at least one coordinate $j$ such that $A_{kj}\neq 0$. For such a change to be triggered by the algorithm, it must also be true that:
\begin{equation*}
(x_j^0)^{\alpha}\sum_{i=1}^m y_i(x^0) A_{ij}\leq w_j\left(1-\gamma\right).
\end{equation*}
Since, by the choice of $\beta_1 = \beta$, this term can increase by a factor of at most $1+\gamma/4$, it follows that:
\begin{equation*}
(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1) A_{ij}\leq w_j(1-\gamma)\left(1+\frac{\gamma}{4}\right)<w_j.
\end{equation*}
This further implies:
\begin{equation*}
(x_j^1)^{\alpha}y_k(x^1)A_{kj}<w_j,
\end{equation*}
and since whenever $A_{kj}\neq 0$ we also have $A_{kj}\geq 1$, we get:
\begin{equation}
(x_j^1)^{\alpha}y_k(x^1)<w_j. \label{eq:feasibility-less-that-wj}
\end{equation}
On the other hand, since $x_j^1\geq \delta_j$, ${\delta_j}^{\alpha}=\frac{w_j}{C}$, and $\sum_{j=1}^n A_{kj}x_j^1 >1$:
\begin{equation*}
(x_j^1)^{\alpha} y_k(x^1) \geq \frac{w_j}{C}\cdot C\cdot e^{\kappa(\sum_{j=1}^n A_{kj}x_j^1 -1)}>w_j,
\end{equation*}
which contradicts (\ref{eq:feasibility-less-that-wj}).
\end{proof}
\fi
\begin{lemma}\label{lemma:self-stabilization}
If for any $i$: $\sum_{j=1}^n A_{ij}x_j > 1$, then after at most $\tau_1 = O(\frac{1}{\beta_2}\ln(nA_{\max}))$ rounds, it is always true that $\sum_{j=1}^n A_{ij}x_j \leq 1$.
\end{lemma}
\begin{proof}
Suppose that $\sum_{j=1}^n A_{ij}x_j > 1$ for some $i$. Then $y_i > C$, and for every $x_j$ with $A_{ij}\neq 0$:
\begin{align*}
{x_j}^{\alpha}\sum_{l=1}^m y_l(x)A_{lj} \geq {x_j}^{\alpha}y_i(x)A_{ij}\geq {\delta_j}^{\alpha}C \geq w_j>w_j(1-\gamma),
\end{align*}
and therefore, none of the variables that appear in $i$ increases.
Since $\sum_{j=1}^n A_{ij}x_j > 1$, there exists at least one $x_k$ with $A_{ik}\neq 0$ such that $x_k \geq \frac{\sum_{j=1}^n A_{ij}x_j}{A_{ik}n}>\frac{1}{nA_{\max}}$. For each such $x_k$, since $C\geq 2w_{\max}nA_{\max}$:
\begin{equation*}
{x_k}^{\alpha}\sum_{l=1}^m y_l(x)A_{lj}\geq C\frac{1}{nA_{\max}}\geq 2 w_{\max} > w_k(1+\gamma),
\end{equation*}
and therefore, $x_k$ decreases (by a factor $(1-\beta_2)$). As $x_k\leq 1$, after at most $O(\frac{1}{\beta_2}\ln(nA_{\max}))$ rounds in which $\sum_{j=1}^n A_{ij}x_j > 1$, we must have $x_k \leq \frac{1}{nA_{\max}}$, and therefore, $\sum_{j=1}^n A_{ij}x_j \leq 1$.
Using the same arguments as in the proof of Lemma \ref{lemma:feasibility}, the constraint $i$ never gets violated again.
\end{proof}
\begin{lemma}\label{lemma:approx-comp-slack}
If the algorithm starts from a feasible solution, then after at most $\tau_0 = \frac{1}{\beta}\ln\left(\frac{1}{\delta_{\min}}\right)$ rounds, it is always true that:
\begin{enumerate}[noitemsep,topsep=3pt]
\item There exists at least one approximately tight constraint: $\max_i\big\{\sum_{j=1}^n A_{ij}x_j\big\}\geq 1-(1+1/\kappa)\varepsilon$,
\item $\sum_{i=1}^m y_i\leq (1+3\varepsilon)\sum_{j=1}^nx_j\sum_{i=1}^m y_i A_{ij}$, and
\item $(1-3\varepsilon)\sum_{i=1}^m y_i\leq \sum_{j=1}^n x_j\sum_{i=1}^m y_i A_{ij}\leq \sum_{i=1}^m y_i$.
\end{enumerate}
\end{lemma}
\iffullpaper
\begin{proof}
Suppose that $\max_i \sum_{j=1}^n A_{ij}x_j < 1- \varepsilon$. Then for each $y_i$ we have:
\begin{equation*}
y_i\leq C\cdot e^{-\kappa\varepsilon}=C\cdot\frac{\varepsilon w_{\min}}{CmA_{\max}}=\frac{\varepsilon w_{\min}}{m{A_{\max}}}.
\end{equation*}
Due to Lemma \ref{lemma:feasibility}, we have that $x$ is feasible in every round, which implies that $x_j\leq 1$ $\forall j$. This further gives:
\begin{equation*}
{x_j}^{\alpha}\sum_{i=1}^m y_iA_{ij}\leq w_j\varepsilon \leq w_j(1-\gamma),
\end{equation*}
and, therefore, all variables $x_j$ increase by a factor $1+\beta$. From Lemma \ref{lemma:feasibility}, since the solution always remains feasible, none of the variables can increase to a value larger than 1. Therefore, after at most $\tau_0=\log_{1+\beta}\left(\frac{1}{\delta_{\max}}\right) \leq \frac{1}{\beta}\ln\left(\frac{1}{\delta_{\max}}\right)$ rounds, there must exist at least one $i$ such that $\sum_{j=1}^n A_{ij}x_j\geq 1-\varepsilon$. If in any round $\max_{i}\sum_{j=1}^n A_{ij}x_j$ decreases, it can decrease by at most $\beta_2\sum_{j=1}^n A_{ij}x_j\leq\beta\sum_{j=1}^n A_{ij}x_j\leq\beta<\frac{\varepsilon}{5\kappa}$. Therefore, in every subsequent round
\begin{equation*}\max_{i}\sum_{j=1}^n A_{ij}x_j>1-\Big(1+\frac{1}{5\kappa}\Big)\varepsilon.
\end{equation*}
For the second part of the lemma, let $S = \{i: \sum_{j=1}^nA_{ij}x_j < \max_{k\in \{1,...,m\}}\sum_{j=1}^n A_{kj}x_j - \frac{\kappa-1}{5\kappa}\varepsilon\}$ be the set of constraints that are at least ``$\frac{\kappa-1}{5\kappa}\varepsilon$-looser" than the tightest constraint. Then for $i\in S$ we have
\begin{equation*}
y_i \leq e^{-\frac{\kappa-1}{5}\varepsilon}\max_{k\in \{1,...,m\}}y_k < \frac{\varepsilon}{m}e^{\varepsilon/5}\max_{k\in \{1,...,m\}}y_k < 1.2\frac{\varepsilon}{m}\max_{k\in \{1,...,m\}}y_k.
\end{equation*}
This further gives:
\begin{equation*}
\sum_{i=1}^m y_i = \sum_{i\in S}y_i + \sum_{k\notin S}y_k<(1+1.2\varepsilon)\sum_{i\notin S}y_i.
\end{equation*}
Moreover, for each $i\notin S$ we have $y_i\sum_{j=1}^nA_{ij}x_j \geq (1-1.2\varepsilon)y_i$, since for $i\notin S$:
\begin{align*}
\sum_{j=1}^nA_{ij}x_j \geq \max_{k\in \{1,...,m\}}A_{kj}x_j - \frac{\kappa-1}{5\kappa}\varepsilon\geq 1- \left(1+\frac{1}{5\kappa} + \frac{\kappa-1}{5\kappa}\right)\varepsilon = 1 - 1.2\varepsilon.
\end{align*}
Therefore:
\begin{align*}
\sum_{i=1}^m y_i &<\frac{1+1.2\varepsilon}{1-1.2\varepsilon}\sum_{i\notin S}y_i\sum_{j=1}^n A_{ij}x_j\\
&\leq (1+3\varepsilon)\sum_{i\notin S}y_i\sum_{j=1}^n A_{ij}x_j \quad(\text{from }\varepsilon\leq 1/6)\\
&\leq (1+3\varepsilon)\sum_{i=1}^m y_i\sum_{j=1}^n A_{ij}x_j.
\end{align*}
Interchanging the order of summation in the last line, we reach the desired inequality.
The proof of the last part of the lemma follows from feasibility: $\sum_{j}A_{ij}x_j \leq 1$, $\forall i$ (Lemma \ref{lemma:feasibility}), and from $\frac{1}{1+3\varepsilon} \geq 1 - 3\varepsilon$
\end{proof}
\fi
Lemmas analogous to \ref{lemma:feasibility} and \ref{lemma:approx-comp-slack} also appear in \cite{AwerbuchKhandekar2009}. {However, the proofs of Lemmas \ref{lemma:feasibility} and \ref{lemma:approx-comp-slack} require new ideas compared to the proofs of the corresponding lemmas in \cite{AwerbuchKhandekar2009}. We need to be much more careful in our choice of lower thresholds $\delta_j$ and constant $C$ in the dual variables, particularly by choosing $C$ as a function of several variables, rather than as a constant. The choice of $\delta_j$'s is also sensitive as smaller $\delta_j$'s would make the potential function range too large, while larger $\delta_j$'s would cause more frequent decrease of ``small'' variables. In either case, the convergence time would increase.
\paragraph{Decrease of Small Variables.}
The following lemma is also needed for the convergence analysis. It shows that if some variable $x_j$ decreases by less than a multiplicative factor $(1-\beta_2)$, i.e., $x_j<\frac{\delta_j}{1-\beta_2}$ and $x_j$ decreases, then $x_j$ must be part of at least one approximately tight constraint. This lemma will be used later to show that in any round the increase in the potential due to the decrease of ``small'' variables is dominated by the decrease of ``large'' variables (i.e., the variables that decrease by a multiplicative factor $(1-\beta_2)$).
\begin{lemma}\label{lemma:small-x-tight-yi}
Consider the rounds that happen after the initial $\tau_1 = O(\frac{1}{\beta_2}\ln(nA_{\max}))$ rounds. If in some round there is a variable $x_j<\frac{\delta_j}{1-\beta_2}$ that decreases, then in the same round for some $i$ with $A_{ij} \neq 0$ it holds that: $y_i(x) \geq \frac{\sum_{l=1}^m A_{lj}y_l(x)}{mA_{\max}}$ and $\sum_{k=1}^n A_{ik}x_k > 1 - \frac{\varepsilon}{2}$.
\end{lemma}
\iffullpaper
\begin{proof}
Suppose that some $x_j<\frac{\delta_j}{1-\beta_2}$ triggers a decrease over the $j^\text{th}$ coordinate.
The first part of the Lemma is easy to show, simply by using the argument that at least one term of a summation must be higher than the average, i.e., there exists at least one $i$ with $A_{ij}\neq 0$ such that:
\begin{align*}
y_i(x) A_{ij} \geq \frac{\sum_{l=1}^m A_{lj}y_l(x)}{m}
\quad\Rightarrow\quad y_i \geq \frac{\sum_{l=1}^m A_{lj}y_l(x)}{mA_{\max}}.
\end{align*}
For the second part, as $x_j < \frac{\delta_j}{1-\beta_2}$, we have that:
\begin{align*}
{x_j}^\alpha y_i(x) \geq \frac{{x_j}^\alpha\sum_{l=1}^m A_{lj}y_l(x)}{mA_{\max}}
\quad\Rightarrow\quad y_i(x) > \frac{(1-\beta_2)^\alpha}{{\delta_j}^\alpha}\frac{{x_j}^\alpha\sum_{l=1}^m A_{lj}y_l(x)}{mA_{\max}}.
\end{align*}
Since $x_j$ decreases, we have that ${x_j}^{\alpha}\sum_{l=1}^m y_i(x)A_{lj}\geq w_j(1+\gamma)$, and therefore
$
y_i(x)>\frac{w_j}{{\delta_j}^{\alpha}}\frac{(1+\gamma)(1-\beta_2)^\alpha}{m{A_{\max}}}.
$
Moreover, as $y_i(x)=C\cdot e^{\kappa(\sum_{k=1}^nA_{ik}x_k - 1)}$, and $C = \frac{w_j}{{\delta_j}^{\alpha}}$, it follows that:
\begin{equation}
e^{\kappa(\sum_{k=1}^nA_{ik}x_k - 1)} > \frac{(1+\gamma)(1-\beta_2)^\alpha}{m{A_{\max}}}.\label{eq:y-bound-1}
\end{equation}
Observe that for $\alpha \leq 1$:
\begin{equation}\label{eq:eps-8-1}
(1+\gamma)(1-\beta_2)^\alpha\geq(1+\gamma)(1-\beta_2)>\left(1+\frac{\varepsilon}{4}\right)\left(1-\frac{\varepsilon}{20(\kappa+1)}\right)>1>\sqrt{\varepsilon},
\end{equation}
while for $\alpha > 1$, since $\varepsilon\alpha \leq \frac{9}{10}$:
\begin{align}
(1+\gamma)(1-\beta_2)^\alpha \geq (1+\gamma)(1-\alpha\beta_2) \geq \left(1+\gamma\right)\left(1 - \frac{\gamma\varepsilon\alpha}{5}\right)\geq 1>\sqrt{\varepsilon} \label{eq:eps-8-1-2},
\end{align}
where we have used the generalized Bernoulli's inequality for $(1-\beta_2)^\alpha \geq (1-\alpha\beta_2)$ \cite{mitrinovic1970analytic}, and then $\beta_2 = \beta = \frac{\gamma}{5(\kappa+\alpha)}<\frac{\gamma\varepsilon}{5}$.
Recalling that $\kappa = \dfrac{1}{\varepsilon}\ln\left(\dfrac{CmA_{\max}}{\varepsilon w_{\min}}\right)$, and combining (\ref{eq:y-bound-1}) with (\ref{eq:eps-8-1}) and (\ref{eq:eps-8-1-2}):
\begin{equation*}
\left(\frac{\varepsilon w_{\min}}{CmA_{\max}}\right)^{\frac{1-\sum_{k=1}^nA_{ik}x_k}{\varepsilon}}>\frac{\sqrt{\varepsilon}}{m{A_{\max}}}.
\end{equation*}
Finally, as $C \geq 2 w_{\max}nmA_{\max}$, it follows that
$
\frac{ w_{\min}\varepsilon}{CmA_{\max}}\leq\frac{\varepsilon w_{\min}}{2w_{\max}nm^2{A_{\max}}^2}< \left(\frac{\sqrt{\varepsilon}}{m{A_{\max}}}\right)^2<1,
$
which gives:
\begin{equation*}
\frac{1-\sum_{k=1}^nA_{ik}x_k}{\varepsilon} < \frac{1}{2} \Leftrightarrow \sum_{k=1}^nA_{ik}x_k > 1- \frac{\varepsilon}{2}.
\end{equation*}
\end{proof}
\fi
\paragraph{Potential.}
We use the following potential function to analyze the convergence time:
\begin{align*}
\Phi(x) = p_\alpha(x) - \frac{1}{\kappa}\sum_{i=1}^m y_i(x),
\end{align*}
where $p_\alpha(x) = \sum_{j=1}^n w_jf_{\alpha}({x_j})$ and $f_\alpha$ is defined by (\ref{eq:f-alpha}).
The potential function is strictly concave and its partial derivative with respect to any variable $x_j$ is:
\begin{align}
\frac{\partial \Phi(x)}{\partial x_j} = \frac{w_j}{{x_j}^{\alpha}}-\sum_{i=1}^m y_i(x)A_{ij}
= \frac{w_j}{{x_j}^{\alpha}}\left(1 - \frac{{x_j}^{\alpha}\sum_{i=1}^my_i(x)A_{ij}}{w_j}\right).\label{eq:potential-derivatives}
\end{align}
The following fact (given in a similar form in \cite{AwerbuchKhandekar2009}), which follows directly from the Taylor series representation of concave functions, will be useful for the potential increase analysis:
\begin{fact}\label{fact:taylor}
For a differentiable concave function $f:\mathbb{R}^n\rightarrow\mathbb{R}$ and any two points $x^0, x^1 \in \mathbb{R}^n$:
\begin{align*}
\sum_{j=1}^n \frac{\partial f(x^0)}{\partial x_j}(x_j^1-x_j^0)\geq f(x^1)-f(x^0)\geq \sum_{j=1}^n \frac{\partial f(x^1)}{\partial x_j}(x_j^1-x_j^0).
\end{align*}
\end{fact}
Using Fact \ref{fact:taylor} and (\ref{eq:potential-derivatives}), we show the following lemma:
\begin{lemma}\label{lemma:potential-increase}
Starting with a feasible solution and throughout the course of the algorithm, the potential function $\Phi(x)$ never decreases. Letting $x^0$ and $x^1$ denote the values of $x$ before and after a round update, respectively, the potential function increase is lower-bounded as:
\begin{equation*}
\Phi(x^1) -\Phi(x^0) \geq \sum_{j=1}^n w_j \frac{\big|x_j^1 - x_j^0\big|}{(x_j^1)^{\alpha}}\Big|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \Big|. \label{eq:general-potential-increase}
\end{equation*}
\end{lemma}
\iffullpaper
\begin{proof}
Since $\Phi$ is concave, using Fact \ref{fact:taylor} and (\ref{eq:potential-derivatives}) it follows that:
\begin{align}
\Phi(x^1) - \Phi(x^0) \geq \sum_{j=1}^n w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right).\label{eq:potential-increase-before-bounds}
\end{align}
If $x_j^1 = x_j^0$, then the term in the summation (\ref{eq:potential-increase-before-bounds}) corresponding to the change in $x_j$ is equal to zero, and $x_j$ has no contribution to the sum in (\ref{eq:potential-increase-before-bounds}).
If $x_j^1 - x_j^0 > 0$, then, as $x_j$ increases over the observed round, it must be $\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\leq 1-\gamma$. By the choice of the parameters, $\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}\leq \left(1+\frac{\gamma}{4}\right)\Big(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\Big)$, and therefore
\begin{align}
\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}\leq \left(1+\frac{\gamma}{4}\right)(1-\gamma) = 1 - \frac{3}{4}\gamma - \frac{\gamma^2}{4}
<1 - \frac{3}{4}\gamma. \label{eq:alpha<1-zj-increase}
\end{align}
It follows that $1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}>\frac{3}{4}\gamma>0$, and therefore
\begin{equation*}
w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right) = w_j \frac{\big|x_j^1 - x_j^0\big|}{(x_j^1)^{\alpha}}\Bigg|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \Bigg|.
\end{equation*}
Finally, if $x_j^1-x_j^0<0$, then it must be $\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\geq 1+\gamma$. By the choice of the parameters, $\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}\geq \left(1-\frac{\gamma}{4}\right)\Big(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\Big)$, implying
\begin{align}
\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}\geq \left(1-\frac{\gamma}{4}\right)(1+\gamma) = 1 + \frac{3}{4}\gamma - \frac{\gamma^2}{4}
>1 + \frac{1}{2}\gamma. \label{eq:alpha<1-zj-decrease}
\end{align}
We get that $1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j}<-\frac{1}{2}\gamma<0$, and therefore
\begin{equation*}
w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right) = w_j \frac{\big|x_j^1 - x_j^0\big|}{(x_j^1)^{\alpha}}\left|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right|,
\end{equation*}
completing the proof.
\end{proof}
\fi
\iffullpaper
\subsection{Proof of Theorem \ref{thm:convergence-alpha<1}}\label{section:alpha<1}
The outline of the proof is as follows. We first derive a lower bound on the potential increase (Lemma \ref{lemma:potential-increase-alpha<1}), which will motivate the definition of a stationary round. Then, for the appropriate definition of a stationary round we will first show that in any stationary round, solution is $O(\varepsilon)-$approximate. Then, to complete the proof, we will show in any non-stationary round there is a sufficiently large increase in the potential function, which, combined with the bounds on the potential value will yield the result.
The following lemma lower-bounds the increase in the potential function in any round of the algorithm.
\begin{lemma}\label{lemma:potential-increase-alpha<1}
If $\alpha<1$ and $\Phi(x^0)$, $x^0$, $y(x^0)$ and $\Phi(x^1)$, $x^1$, $y(x^1)$ denote the values of $\Phi$, $x$, and $y$ before and after a round, respectively, and $S^- = \{j: x_j \text{ decreases}\}$, then if $x^0$ is feasible:
\begin{enumerate}
\item $\Phi(x^1) - \Phi(x^0)\geq \Omega(\beta^2\gamma/\ln(1/\delta_{\min}))\sum_{j\in S^-}w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha}$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta)\left((1-\gamma)\sum_{j=1}^n w_j{(x_j^0)^{1-\alpha}} - \sum_{i=1}^m y_i(x^0) \sum_{j=1}^n A_{ij}x_j^0\right)$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega\Big(\frac{\beta^2}{\ln(1/\delta_{\min})}\Big)\left(\sum_{i=1}^m y_i(x^0) \sum_{j=1}^n A_{ij}x_j^0 - (1+\gamma)\sum_{j=1}^n w_j{(x_j^0)^{1-\alpha}}\right)$.
\end{enumerate}
\end{lemma}
\begin{proof}
$\quad$\\
\noindent\textbf{Proof of 1.} Observe that for $j\in S^-$, $x_j^1 = \max\{\delta_j, (1-\beta_2)x_j^0\}$. From the proof of Lemma \ref{lemma:potential-increase}, we have that:
\begin{equation*}\Phi(x^1)-\Phi(x^0)\geq \sum_{j\in S^-} w_j \frac{x_j^0 - x_j^1}{(x_j^1)^{\alpha}}\left( \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} - 1\right).
\end{equation*}
The proof that
\begin{equation*}
\sum_{j\in S^-} w_j {(x_j^0)}^{1-\alpha}\left( \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} - 1\right) = \Theta\Bigg( \sum_{\{j\in S^-:x_j^0 \geq \frac{\delta_j}{1-\beta_2} \}} w_j {(x_j^0)}^{1-\alpha}\left( \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} - 1\right)\Bigg)
\end{equation*}
is implied by the proof of part 3 of this lemma (see below).
For each $j\in S^-$, we have that:
\begin{equation*}
\left(\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} - 1\right) \geq (1+\gamma)(1-\gamma/4)-1 > \gamma/2,
\end{equation*}
Therefore:
\begin{align*}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\gamma) \sum_{j\in S^-} w_j \frac{\beta_2 x_j^0}{(1-\beta_2)(x_j^0)^{\alpha}}\\
&= \Omega\left(\frac{\beta_2\gamma}{1-\beta_2}\right)\sum_{j\in S^-} w_j {(x_j^0)}^{1-\alpha}.
\end{align*}
\noindent\textbf{Proof of 2.} Let $S^+$ denote the set of $j$'s such that $x_j$ increases in the current round. Then, recalling that for $j\in S^+$ $\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\leq 1- \gamma$ and that from the choice of parameters $\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \leq (1+\gamma/4)\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}$:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \sum_{j=1}^n w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right)\notag\\
&\geq \sum_{j\in S^+} w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \right)\notag\\
&\geq \sum_{j\in S^+} w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left(1 - (1+\gamma/4)\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j} \right)\notag\\
&\geq \sum_{j\in S^+} w_j \frac{x_j^1 - x_j^0}{(x_j^1)^{\alpha}}\left((1 - \gamma) - \frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j} \right). \nota
\end{align}
Since $j\in S^+$, $x_j^1 = (1+\beta)x_j^0$, it follows that
\begin{equation*}\Phi(x^1) - \Phi(x^0) \geq \frac{\beta}{(1+\beta)^{\alpha}}\sum_{j\in S^+} w_j (x_j^0)^{-\alpha}\left((1 - \gamma) - \frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j} \right).
\end{equation*}
Observing that for any $x_j\notin S^+$ we have that $(1 - \gamma) - \frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}<0$, we get:
\begin{align*}
\Phi(x^1) - \Phi(x^0) &\geq \frac{\beta}{(1+\beta)^{\alpha}}\sum_{j=1}^n w_j (x_j^0)^{1-\alpha}\left((1 - \gamma) - \frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j} \right)\\
&= \Omega(\beta)\left((1-\gamma)\sum_{j=1}^n w_j {(x_j^0)^{1-\alpha}} - \sum_{j=1}^nx_j^0\sum_{i=1}^m y_i(x^0) A_{ij} \right).
\end{align*}
\noindent\textbf{Proof of 3.} Let $S^-$ denote the set of $j$'s such that $x_j$ decreases in the current round. In this case not all the $x_j$'s with $j\in S^-$ decrease by a multiplicative factor $(1-\beta_2)$, since for $j\in S^-$: $x_j^1 = \max\{(1-\beta_2)x_j^0, \delta_j\}$. We will first lower-bound the potential increase over $x_j$'s that decrease multiplicatively: $\{j: j\in S^- \wedge x_j^0(1-\beta_2)\geq \delta_j\}$, so that $x_j^1 = x_j^0(1-\beta_2)$. Recall that for $j\in S^-$: $\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\geq 1+ \gamma$ and $\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} \geq (1-\gamma/4\frac{\beta}{\ln(1/\delta_{\min})})\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}\geq(1-\gamma/4)\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}$. It follows that:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \frac{\beta_2}{(1-\beta_2)^{\alpha}}\sum_{\{j: j\in S^- \wedge x_j^0(1-\beta)\geq \delta_j\}} w_j (x_j^0)^{1-\alpha}\left(\frac{(x_j^1)^{\alpha}\sum_{i=1}^my_i(x^1)A_{ij}}{w_j} - 1\right)\notag\\
&\geq {\beta_2}\sum_{\{j: j\in S^- \wedge x_j^0(1-\beta_2)\geq \delta_j\}} w_j (x_j^0)^{1-\alpha}\left((1-\gamma/4)\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}- 1\right)\notag\\
&=\Omega\Big(\frac{\beta^2}{\ln(1/\delta_{\min})}\Big)\sum_{\{j: j\in S^- \wedge x_j^0(1-\beta_2)\geq \delta_j\}} w_j (x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}- (1+\gamma)\right).\label{eq:pot-increase-bound-multiplicative}
\end{align}
Next, we prove that the potential increase due to decrease of $x_j$ such that $\{j: j\in S^- \wedge x_j^0(1-\beta_2)< \delta_j\}$ is dominated by the potential increase due to $x_k$'s that decrease multiplicatively by the factor $(1-\beta_2)$.
Choose any $x_j$ such that $\{j: j\in S^- \wedge x_j^0(1-\beta_2)< \delta_j\}$, and let $\xi_j(x^0) = \frac{(x_j^0)^{\alpha}\sum_{l=1}^mA_{lj}y_i(x^0)}{w_j}$. From Lemma \ref{lemma:small-x-tight-yi}, there exists at least one $i$ with $A_{ij}\neq 0$, such that:
\begin{equation}
y_i \geq \frac{w_j (x_j^0)^\alpha}{w_j (x_j^0)^\alpha}\cdot \frac{\sum_{i=1}^m y_i(x^0) A_{ij}}{mA_{\max}} > \frac{1}{mA_{\max}}\frac{w_j(1-\beta_2)^\alpha}{{\delta_j}^{\alpha}}\xi_j(x^0)\geq \frac{1-\beta_2}{mA_{\max}}\frac{w_j}{{\delta_j}^{\alpha}}\xi_j(x^0), \label{eq:yi-lower-bound-zj} \quad\text{ and},
\end{equation}
\begin{equation}
\sum_{k=1}^n A_{ik}x_k^0 > 1-\frac{\varepsilon}{2} \label{eq:x-tight-constraint}.
\end{equation}
From (\ref{eq:x-tight-constraint}), there exists at least one $p$ such that $A_{ip}\neq 0$ and \begin{equation}
A_{ip}x_p^0>\frac{1-\frac{\varepsilon}{2}}{n}. \label{eq:large-xp}
\end{equation}
Since $x_p^0 \in (0, 1]$ and $\alpha \in (0, 1)$, using (\ref{eq:large-xp}), we have that $A_{ip} (x_p^0)^{\alpha}\geq A_{ip}x_p^0 > \frac{1-\frac{\varepsilon}{2}}{n}$. Recalling (\ref{eq:yi-lower-bound-zj}):
\begin{align}
(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) &\geq (x_p^0)^{\alpha}A_{ip}y_i(x^0)\notag\\
&\geq \frac{1-\frac{\varepsilon}{2}}{n}\cdot \frac{1-\beta_2}{mA_{\max}}\frac{w_j}{{\delta_j}^{\alpha}}\xi_j(x^0)\notag.
\end{align}
Recalling that $\frac{w_j}{{\delta_j}^{\alpha}} = C \geq 2w_{\max}n^2 m A_{\max}$, it further follows that:
\begin{align}
(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) &\geq 2\left(1-\frac{\varepsilon}{2}\right)(1-\beta_2)\cdot n \cdot w_{\max}\cdot\xi_j(x^0).\label{eq:alpha<1--main-cond-for-small-var-inc}
\end{align}
Because $\varepsilon\leq \frac{1}{6}$ and $\beta_2 < \beta = \frac{\gamma}{5(\kappa+1)} = \frac{\varepsilon}{20(\kappa+1)}<\frac{\varepsilon}{20}$, it follows that $ 2\left(1-\frac{\varepsilon}{2}\right)(1-\beta_2)>1$. Therefore:
\begin{equation}
\frac{(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) }{w_p}\geq \frac{(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) }{w_{\max}} >n\cdot \xi_j(x^0) = n\cdot \frac{(x_j^0)^{\alpha}\sum_{l=1}^mA_{lj}y_i(x^0)}{w_j}. \label{eq:alpha<1--small-var-inc-cond1}
\end{equation}
As $\alpha<1$, we have that ${\delta_j}^{\alpha}>\delta_j$, and $\frac{w_j}{\delta_j}>\frac{w_j}{{\delta_j}^\alpha}=C$. Similar to (\ref{eq:yi-lower-bound-zj}), we can lower-bound $y_i$ as:
\begin{equation}
y_i(x) \geq \frac{1-\beta_2}{mA_{\max}}\cdot\frac{w_j}{\delta_j}\cdot\frac{x_j^0\sum_i y_i(x)A_{ij}}{w_j} > \frac{1-\beta_2}{mA_{\max}}\cdot\frac{w_j}{{\delta_j}^{\alpha}}\cdot\frac{x_j^0\sum_i y_i(x)A_{ij}}{w_j}.\label{eq:yi-lower-bound-zj-2}
\end{equation}
Then, recalling $A_{ip}x_p^0 > \frac{1-\frac{\varepsilon}{2}}{n}$, and using (\ref{eq:yi-lower-bound-zj-2}), it is simple to show that:
\begin{equation}
x_p^0\sum_l y_l(x^0)A_{lp} > n\cdot x_j^0\sum_{l=1}^mA_{lj}y_l(x^0). \label{eq:alpha<1--small-var-inc-cond2}
\end{equation}
As $\xi_j(x^0) \geq (1+\gamma)$ and $x_p^0 > \frac{\delta_p}{1-\beta_2}$, it immediately follows from (\ref{eq:alpha<1--small-var-inc-cond1}) that $x_p$ decreases by a factor $(1-\beta_2)$.
In the rest of the proof we show that (\ref{eq:alpha<1--small-var-inc-cond1}) and (\ref{eq:alpha<1--small-var-inc-cond2}) imply that the increase in the potential due to the decrease of variable $x_p$ dominates the increase in the potential due to the decrease of variable $x_j$ by at least a factor $n$. This result then further implies that the increase in the potential due to the decrease of variable $x_p$ dominates the increase in the potential due to the decrease of \emph{all} small $x_k$'s that appear in the constraint $i$ ($x_k$'s are such that $A_{ik}\neq 0$, $x_k^0 < \frac{\delta_k}{1-\beta_2}$, and $\frac{(x_k^0)^{\alpha}\sum_l y_l(x)A_{lk}}{w_k}\geq 1+\gamma$).
Consider the following two cases: $w_p (x_p^0)^{1-\alpha} \geq (w_j x_j^0)^{1-\alpha}$ and $w_p (x_p^0)^{1-\alpha} < (w_j x_j^0)^{1-\alpha}$.
\noindent\textbf{Case 1: $w_p (x_p^0)^{1-\alpha} \geq (w_j x_j^0)^{1-\alpha}$}. Then, using (\ref{eq:alpha<1--small-var-inc-cond1}):
\begin{align}
w_p (x_p^0)^{1-\alpha}\left(\frac{(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) }{w_p} -(1+\gamma)\right)&\geq (w_j x_j^0)^{1-\alpha}\left(\frac{(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) }{w_p} -(1+\gamma)\right)\notag\\
& \geq (w_j x_j^0)^{1-\alpha}\left(n\cdot\frac{(x_j^0)^{\alpha}\sum_{l=1}^m A_{lj}y_l(x^0) }{w_j} -(1+\gamma)\right)\notag\\
&\geq n\cdot (w_j x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{l=1}^m A_{lj}y_l(x^0) }{w_j} -(1+\gamma)\right). \label{eq:alpha<1-dominant-inc-1}
\end{align}
\noindent\textbf{Case 2: $w_p (x_p^0)^{1-\alpha} < (w_j x_j^0)^{1-\alpha}$}. Then, using (\ref{eq:alpha<1--small-var-inc-cond2}):
\begin{align}
w_p (x_p^0)^{1-\alpha}\left(\frac{(x_p^0)^{\alpha}\sum_{l=1}^m A_{lp}y_l(x^0) }{w_p} -(1+\gamma)\right)&= x_p^0\sum_{l=1}^m A_{lp}y_l(x^0) - (1+\gamma)w_p (x_p^0)^{1-\alpha}\notag\\
&\geq x_p^0\sum_{l=1}^m A_{lp}y_l(x^0) - (1+\gamma)w_j (x_j^0)^{1-\alpha}\notag\\
&\geq n\cdot x_j^0\sum_{l=1}^m A_{lj}y_l(x^0) - (1+\gamma)w_j (x_j^0)^{1-\alpha}\notag\\
&\geq n\cdot (w_j x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{l=1}^m A_{lj}y_l(x^0) }{w_j} -(1+\gamma)\right). \label{eq:alpha<1-dominant-inc-2}
\end{align}
Combining (\ref{eq:alpha<1-dominant-inc-1}) and (\ref{eq:alpha<1-dominant-inc-2}) with (\ref{eq:pot-increase-bound-multiplicative}), it follows that:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta_2)\sum_{j\in S^-} w_j (x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}- (1+\gamma)\right).
\end{equation*}
Finally, since for $j\notin S^-$: $\left(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}- (1+\gamma)\right) < 0$:
\begin{align*}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\beta_2)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{i=1}^my_i(x^0)A_{ij}}{w_j}- (1+\gamma)\right)\\
&= \Omega\Big(\frac{\beta^2}{\ln(1/\delta_{\min})}\Big)\left(\sum_{j=1}^nx_j^0\sum_{i=1}^my_i(x^0)A_{ij} - (1+\gamma)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha}\right),
\end{align*}
completing the proof.
\end{proof}
Parts 2 and 3 of Lemma \cite{AwerbuchKhandekar2009} appear in a somewhat similar form in \cite{AwerbuchKhandekar2009}. However, part 3 requires significant additional results for bounding the potential change due to decrease of small $x_j$'s (i.e., $x_j$'s that are smaller than $\frac{\delta_j}{1-\beta}$) that were not needed in \cite{AwerbuchKhandekar2009}. The rest of the results in this paper are new.
Consider the following definition of a stationary round:
\begin{definition}\label{def:alpha<1-stationary-round}
(Stationary round.) Let $S^- = \{j: x_j \text{ decreases}\}$. A round is stationary if it happens after the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(\frac{1}{\delta_{\min}})$ and $\tau_1 = \frac{1}{\beta_2}\ln(nA_{\max})$, and both of the following two conditions hold:
\begin{enumerate}
\item $\sum_{j\in S^-} w_j {x_j}^{1-\alpha}\leq \gamma \sum_{j=1}^n w_j {x_j}^{1-\alpha}$, and
\item $\sum_{j=1}^n x_j \sum_{i=1}^m y_i(x)A_{ij} \leq (1+5\gamma/4)\sum_{j=1}^n w_j {x_j}^{1-\alpha}$.
\end{enumerate}
\end{definition}
In the rest of the proof, we first show that in any stationary round, we have an $O(\varepsilon)-$approximate solution, while in any non-stationary round, the potential function increases substantially.
We first prove the following lemma, which we will then be used in bounding the duality gap.
\begin{lemma}\label{lemma:alpha<1-lower-bound-xi-j}
After the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(\frac{1}{\delta_{\min}})$ and $\tau_1 = \frac{1}{\beta_2}\ln(nA_{\max})$, in each round of the algorithm: $\xi_j(x)\equiv \frac{{x_j}^{\alpha}\sum_iy_i(x)A_{ij}}{w_j} > 1-\frac{5\gamma}{4}$, $\forall j$.
\end{lemma}
\begin{proof}
Suppose without loss of generality that the algorithm starts with a feasible solution. This assumption is w.l.o.g. because, from Lemma \ref{lemma:self-stabilization}, after at most $\tau_1$ rounds the algorithm reaches a feasible solution, and from Lemma \ref{lemma:feasibility}, once the algorithm reaches a feasible solution, it always maintains a feasible solution.
Choose any $j$. Using the same argument as in the proof of Lemma \ref{lemma:feasibility}, after at most $\frac{1}{\beta}\ln(\frac{1}{\delta_j})\leq \tau_0$ rounds, there exists at least one round in which $\xi_j(x) > 1- \gamma$ (otherwise $x_j>1$, which is a contradiction).
Observe that in any round for which $\xi_j(x) \leq 1- \gamma$, $x_j$ increases by a factor $1+\beta_1 = 1+\beta$. Therefore, the maximum number of consecutive rounds in which $\xi_j(x) \leq 1-\gamma$ is at most $\frac{1}{\beta}\ln(\frac{1}{\delta_j})\leq \tau_0$, otherwise $x_j$ would increase to a value larger than 1, making $x$ infeasible, which is a contradiction due to Lemma \ref{lemma:feasibility}. The maximum amount by which $\xi_j(x)$ can decrease in any round is bounded by a factor $1-\frac{\gamma}{4}\cdot \frac{\beta}{\ln(1/\delta_{\min})} = 1-\frac{\gamma}{4}\cdot \frac{1}{\tau_0}$. Therefore, using the generalized Bernoulli's inequality, it follows that in any round:
\begin{equation*}
\xi_j(x) \geq (1-\gamma)\cdot \Big(1-\frac{\gamma}{4}\cdot \frac{1}{\tau_0}\Big)^{\tau_0}\geq (1-\gamma)\cdot \Big(1-\frac{\gamma}{4}\Big)>1 - \frac{5\gamma}{4}.
\end{equation*}
\end{proof}
A simple corollary of Lemma \ref{lemma:alpha<1-lower-bound-xi-j} is that:
\begin{corollary}\label{cor:alpha<1-lower-comp}
After the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(\frac{1}{\delta_{\min}})$ and $\tau_1 = \frac{1}{\beta_2}\ln(nA_{\max})$, in each round of the algorithm: $\sum_j x_j \sum_i y_i(x)A_{ij} > \big(1 - \frac{5\gamma}{4}\big)\sum_j w_j {x_j}^{1-\alpha}$.
\end{corollary}
\begin{proof}
From Lemma \ref{lemma:alpha<1-lower-bound-xi-j}, after the initial $\tau_0 + \tau_1$ rounds, it always holds $\xi_j(x) \equiv \frac{{x_j}^{\alpha}\sum_i y_i(x)A_{ij}}{w_j}\geq 1-\frac{5\gamma}{4}$, $\forall j$. Multiplying both sides of the inequality by $w_j {x_j}^{1-\alpha}$, $\forall j$ and summing over $j$, the result follows.
\end{proof}
Recall that $p_{\alpha}(x)\equiv\sum_j w_j f_{\alpha}(x_j)$ denotes the primal objective. The following lemma states that any stationary round holds an $(1+6\varepsilon)$-approximate solution.
\begin{lemma}\label{lemma:alpha<1-stationary-round}
In any stationary round: $p(x^*)\leq (1+6\varepsilon)p(x)$, where $x^*$ is the optimal solution to $(P_{\alpha})$.
\end{lemma}
\begin{proof}
Since, by definition, a stationary round can only happen after the initial $\tau_0 + \tau_1$ rounds, we have that $x$ in that round is feasible, and also from Lemma \ref{lemma:approx-comp-slack}: $\sum_i y_i \leq (1+3\varepsilon)\sum_j x_j \sum_i y_i(x)A_{ij}$. Therefore, recalling Eq. (\ref{eq:duality-gap-alpha}) for the duality gap and denoting $\xi_j(x) = \frac{{x_j}^{\alpha}\sum_i y_i(x)A_{ij}}{w_j}$, we have that:
\begin{align}
p(x^*)-p(x)\leq G(x, y(x)) &= \sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\xi_j^{-\frac{1-\alpha}{\alpha}}-1\right)+\sum_i y_i(x) - \sum_j w_j {x_j}^{1-\alpha}\xi_j^{-\frac{1-\alpha}{\alpha}}\notag\\
&=\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}}-1\right) + \sum_i y_i(x)\notag\\
&\leq \sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}}-1\right) + (1+3\varepsilon)\sum_j x_j \sum_i y_i(x)A_{ij}. \label{eq:alpha<1-duality-gap-bound}
\end{align}
From Lemma \ref{lemma:alpha<1-lower-bound-xi-j}, $\xi_j > 1-\frac{5\gamma}{4}$, $\forall j$. Partition the indices of all the variables as follows:
\begin{equation*}
S_1 = \left\{j: \xi_j \in \left(1-\frac{5\gamma}{4}, 1+\frac{5\gamma}{4}\right)\right\}, \quad S_2 = \left\{j: \xi_j \geq 1+\frac{5\gamma}{4}\right\}.
\end{equation*}
Then, using (\ref{eq:alpha<1-duality-gap-bound}):
\begin{equation*}
p(x^*)-p(x)\leq G_1(x) + G_2(x),
\end{equation*}
where:
\begin{equation*}
G_1(x) = \sum_{j\in S_1} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}}-1\right) + (1+3\varepsilon)\sum_{j\in S_1} x_j \sum_i y_i(x)A_{ij}
\end{equation*}
and
\begin{equation*}
G_2(x) = \sum_{j\in S_2} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}}-1\right) + (1+3\varepsilon)\sum_{j\in S_2} x_j \sum_i y_i(x)A_{ij}.
\end{equation*}
The rest of the proof follows by upper-bounding $G_1(x)$ and $G_2(x)$.
\noindent\textbf{Bounding $G_1(x)$.} Observing that $\forall j$: $x_j\sum_i y_i(x)A_{ij} = w_j {x_j}^{1-\alpha}\xi_j$, we can write $G_1(x)$ as:
\begin{align}
G_1(x) = \sum_{j\in S_1} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}} + (1+3\varepsilon)(1-\alpha)\xi_j-1\right).\label{eq:alpha<1-G-1}
\end{align}
Denote $r(\xi_j) = \alpha \xi_j^{-\frac{1-\alpha}{\alpha}} + (1+3\varepsilon)(1-\alpha)\xi_j-1$. It is simple to verify that $r(\xi_j)$ is a convex function. Since $\xi_j \in \left(1-\frac{5\gamma}{4}, 1+\frac{5\gamma}{4}\right)$, $\forall j\in S_1$, it follows that $r(\xi_j) < \max \{r(1-5\gamma/4), r(1+5\gamma/4)\}$. Now:
\begin{align}
r(1-5\gamma/4) &= \alpha \Big(1-\frac{5\gamma}{4}\Big)^{-\frac{1-\alpha}{\alpha}} + (1-\alpha)(1+3\varepsilon)\Big(1-\frac{5\gamma}{4}\Big)-1\notag\\
&< \alpha \Big(1-\frac{5\gamma}{4}\Big)^{-\frac{1-\alpha}{\alpha}} + (1-\alpha)(1+3\varepsilon) - 1.\notag
\end{align}
If $\frac{1-\alpha}{\alpha}\leq 1$, then as $(1-5\gamma/4)^{-1}\leq (1+2\gamma)$, it follows that $(1-5\gamma/4)^{-\frac{1-\alpha}{\alpha}}\leq 1+2\gamma$. Therefore:
\begin{align}
r(1-5\gamma/4)&< \alpha(1+2\gamma) + (1-\alpha)(1+3\varepsilon) - 1\notag\\
&= 2\gamma \alpha + 3\cdot(1-\alpha)\varepsilon = \alpha \frac{\varepsilon}{2} + 3\cdot(1-\alpha)\varepsilon\notag\\
&= 3\varepsilon\left(1-\frac{5}{6}\alpha\right).\label{eq:alpha<1-r-1}
\end{align}
If $\frac{1-\alpha}{\alpha}>1$, then (using generalized Bernoulli's inequality and $\varepsilon \leq \frac{\alpha}{1-\alpha}$):
\begin{align}
r(1-5\gamma/4) &< \alpha \frac{1}{(1-5\gamma/4)^{\frac{1-\alpha}{\alpha}}} + (1-\alpha)(1+3\varepsilon) - 1\notag\\
&\leq \alpha \frac{1}{1-\frac{5\gamma}{4}\cdot\frac{1-\alpha}{\alpha}} + (1-\alpha)(1+3\varepsilon) - 1\notag\\
&\leq \alpha \Big(1+\frac{5\gamma}{4}\cdot \frac{1-\alpha}{\alpha}\Big) + (1-\alpha)(1+3\varepsilon) - 1\notag\\
&\leq (1-\alpha)\Big(\frac{5\gamma}{4} + 3\varepsilon\Big)\notag\\
&< 4\varepsilon(1-\alpha).\label{eq:alpha<1-r-2}
\end{align}
On the other hand:
\begin{align}
r(1+5\gamma) &= \alpha \Big(1+\frac{5\gamma}{4}\Big)^{-\frac{1-\alpha}{\alpha}} + (1-\alpha)(1+3\varepsilon)\Big(1+\frac{5\gamma}{4}\Big)-1\notag\\
&< \alpha + (1-\alpha)(1+4\varepsilon) - 1\notag\\
&=4\varepsilon(1-\alpha). \label{eq:alpha<1-r-3}
\end{align}
Combining (\ref{eq:alpha<1-r-1})--(\ref{eq:alpha<1-r-3}) with (\ref{eq:alpha<1-G-1}):
\begin{equation}
G_1(x) < 4\varepsilon\cdot \sum_{j\in S_1} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}. \label{eq:alpha<1-G-1-1}
\end{equation}
\noindent\textbf{Bounding $G_2(x)$.} Because the round is stationary and $S_2 \subseteq S^-$, we have that: $\sum_{j\in S_2}w_j {x_j}^{1-\alpha} \leq \gamma \sum_{j=1}^n w_j {x_j}^{1-\alpha}$. Using the second part of the stationary round definition and that $\sum_{j\in S_2}x_j\sum_{i=1}^m y_i(x)A_{ij}>(1-5\gamma/4)\sum_{j\in S_2}w_j {x_j}^{1-\alpha}$ (follows from Lemma \ref{lemma:alpha<1-lower-bound-xi-j}):
\begin{align}
\sum_{j\in S_2} x_j \sum_{i=1}^m y_i(x)A_{ij} &= \sum_{k=1}^m x_k\sum_{i=1}^m y_i(x)A_{ik} - \sum_{l\notin S_2} x_l \sum_{l=1}^m y_l(x)A_{lk}\notag\\
&\leq (1+5\gamma/4)\sum_{k=1}^n w_k {x_k}^{1-\alpha} - (1-5\gamma/4) \sum_{l\notin S_2} w_l {x_l}^{1-\alpha}\notag\\
&\leq (1+5\gamma/4)\sum_{j\in S_2} w_j {x_j}^{1-\alpha} + \frac{5\gamma}{2}\sum_{l\notin S_2} w_l {x_l}^{1-\alpha}\notag\\
&\leq \gamma(1+5\gamma/4)\sum_{k=1}^n w_k {x_k}^{1-\alpha} + \frac{5\gamma}{2}\sum_{k=1}^n w_k {x_k}^{1-\alpha}\notag\\
&< 4\gamma \sum_{k=1}^n w_k {x_k}^{1-\alpha} = \varepsilon \sum_{k=1}^n w_k {x_k}^{1-\alpha}. \label{eq:alpha<1-xjy-bound}
\end{align}
Above, first inequality follows from $\sum_{k=1}^m x_k\sum_{i=1}^m y_i(x)A_{ik} \leq (1+5\gamma/4)\sum_{k=1}^n w_k {x_k}^{1-\alpha}$ (part 2 of the stationary round definition) and Corollary \ref{cor:alpha<1-lower-comp}. Second inequality follows by breaking the left summation into two summations: those with $j\in S_2$ and those with $l\notin S_2$. The third inequality follows from $S_2 \subseteq S$ and part 1 of the stationary round definition.
Observe that as $\xi_j \geq 1+5\gamma/4>1$, we have that $\xi_j^{-\frac{1-\alpha}{\alpha}}<1$. Using (\ref{eq:alpha<1-xjy-bound}), it follows that:
\begin{align}
G_2(x) & = \sum_{j\in S_2} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\left(\alpha \xi_j^{-\frac{1-\alpha}{\alpha}}-1\right) + (1+3\varepsilon)\sum_{j\in S_2} x_j \sum_i y_i(x)A_{ij}\notag\\
&< (\alpha-1) \sum_{j\in S_2} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} + (1+3\varepsilon)\sum_{j\in S_2}x_j\sum_i y_i(x)A_{ij}\notag\\
&\leq (\alpha-1) \sum_{j\in S_2} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} + \varepsilon (1+3\varepsilon)\sum_{k=1}^n w_k {x_k}^{1-\alpha}\notag\\
&\leq -(1-\alpha)\sum_{j\in S_2} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} + \frac{3}{2}\varepsilon (1-\alpha) \sum_{k=1}^n w_k \frac{{x_k}^{1-\alpha}}{1-\alpha}\notag\\
&< \frac{3}{2}\varepsilon (1-\alpha) \sum_{k=1}^n w_k \frac{{x_k}^{1-\alpha}}{1-\alpha}\notag\\
&< 2{\varepsilon}\sum_{k=1}^n w_k \frac{{x_k}^{1-\alpha}}{1-\alpha}. \label{eq:alpha<1-G-2}
\end{align}
Finally, combining (\ref{eq:alpha<1-G-1-1}) and (\ref{eq:alpha<1-G-2}):
\begin{align*}
p(x^*) - p(x) &< \Big(4\varepsilon + 2\varepsilon\Big) \sum_{j\in S_1} w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\\
&= 6\varepsilon p(x).
\end{align*}
\end{proof}
\begin{proofof}{Theorem \ref{thm:convergence-alpha<1}}
From Lemma \ref{lemma:alpha<1-stationary-round}, in any stationary round: $p(x^*) \leq p(x) (1 + 6\varepsilon)$. Therefore, to prove the theorem, it suffices to show that there are at most $O\left(\frac{1}{\alpha^2\varepsilon^5}\ln^2\left(R_w{mnA_{\max}}\right)\ln^2\left(R_w\frac{mnA_{\max}}{\varepsilon}\right)\right)$ non-stationary rounds in total, where $R_w = {w_{\max}}/{ w_{\min}}$, because we can always run the algorithm for $\varepsilon' = \varepsilon/6$ to get an $\varepsilon-$approximation, and this would only affect the constant in the convergence time.
To bound the number of non-stationary rounds, we will show that the potential increases by a ``large enough'' multiplicative value in all the non-stationary rounds in which the potential is not too ``small''. For the non-stationary rounds in which the value of the potential is ``small'', we show that the potential increases by a large enough value so that there can be only few such rounds.
In the rest of the proof, we assume that the initial $\tau_0 + \tau_1 $ rounds have passed, so that $x$ is feasible, and the statement of Lemma \ref{lemma:approx-comp-slack} holds. This does not affect the overall bound on the convergence time, as
\begin{align}
\tau_0 + \tau_1 &= \frac{1}{\beta}\ln\Big(\frac{1}{\delta_{\min}}\Big) + \frac{1}{\beta_2}\ln(nA_{max}) = O\left( \frac{1}{\beta^2}\ln(nA_{\max})\ln\Big(\frac{1}{\delta_{\min}}\Big)\right)\notag\\
&= O\left(\frac{1}{\alpha\varepsilon^4}\ln(nA_{\max})\ln^2\left(R_w\frac{mnA_{\max}}{\varepsilon}\right)\ln\left(R_w mnA_{\max}\right)\right).\label{eq:tau1+tau0-bound}
\end{align}
To bound the minimum and the maximum values of the potential $\Phi$, we will bound $\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}$ and $\frac{1}{\kappa}\sum_i y_i(x)$. Recall that $\Phi(x) = \sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} - \frac{1}{\kappa}\sum_i y_i(x)$.
Since $\delta_j = \left(\frac{w_{j}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1}{\alpha}}\geq \left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1}{\alpha}}$, $x$ is always feasible, and $x_j\leq 1$, $\forall j$, we have that:
\begin{equation}
\frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\leq\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\leq \frac{W}{1-\alpha}, \label{eq:alpha<1-p-alpha-bound}
\end{equation}
and
\begin{equation}
0<\frac{1}{\kappa}\sum_i y_i(x)\leq \frac{Cm}{\kappa}. \label{eq:alpha<1-sum-yi-bound}
\end{equation}
Thus, we have:
\begin{align}
\Phi_{\min} &\geq -\frac{1}{\kappa}\sum_i y_i(x)\notag\\
&\geq -\frac{1}{\kappa}\cdot m\cdot C\notag\\
&\geq - O(m^2n^2 A_{\max}w_{\max}), \label{eq:alpha<1-phi-min}
\end{align}
and
\begin{equation}
\Phi_{\max} \leq \sum_{j=1}^n w_j \frac{1}{1-\alpha} = \frac{W}{1-\alpha}. \label{eq:alpha<1-phi-max}
\end{equation}
Recall from Lemma \ref{lemma:potential-increase} that the potential never decreases. We consider the following three cases for the value of the potential:
\noindent \textbf{Case 1: $\Phi_{\min}\leq \Phi \leq -\Theta(\frac{ w_{\min}}{A_{\max}})$}. Since in this case $\Phi < 0$, we have that $\sum_i y_i(x) > \kappa \sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}$. From Lemma \ref{lemma:approx-comp-slack}, $\sum_j x_j \sum_i y_i(x)A_{ij}\geq (1-3\varepsilon)\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}$, thus implying:
\begin{equation}\sum_j x_j \sum_i y_i(x)A_{ij}\geq \frac{1-3\varepsilon}{\kappa}\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\geq 2\cdot\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}, \label{eq:alpha<1-neg-phi-inc}
\end{equation}
as $\kappa \geq \frac{1}{\varepsilon}$ and $\varepsilon\leq \frac{1}{6}$. Combining Part 3 of Lemma \ref{lemma:potential-increase-alpha<1} and (\ref{eq:alpha<1-neg-phi-inc}), the potential increases by at least:
\begin{align*}
\Omega\left(\frac{\beta^2}{\ln(1/\delta_{\min})}\right)\sum_jx_j \sum_i y_i(x) A_{ij} = \left(\frac{\beta^2}{\ln(1/\delta_{\min})}\right)\sum_i y_i(x) &= \left(\frac{\beta^2}{\ln(1/\delta_{\min})}\cdot\kappa\right)(-\Phi(x)) \\
&= \Omega\left(\frac{\gamma^2}{\kappa \ln(1/\delta_{\min})}\right)(-\Phi(x)).
\end{align*}
Since the potential never decreases, there can be at most
\begin{align*}
O\left(\frac{\kappa\ln(1/\delta_{\min})}{\gamma^2}\ln\left(\frac{-\Phi_{\min}}{ w_{\min}/A_{\max}}\right)\right) = O\left(\frac{1}{\alpha}\frac{1}{\varepsilon^3}\ln^2\left(R_w nmA_{\max}\right)\ln\left(R_w\frac{nmA_{\max}}{\varepsilon}\right)\right)
\end{align*}
Case 1 rounds.
\noindent\textbf{Case 2: $-O\big(\frac{ w_{\min}}{A_{\max}}\big) < \Phi \leq O\Big(\frac{W}{1-\alpha}\cdot\big(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\big)^{\frac{1-\alpha}{\alpha}}\Big)$.} From Lemma \ref{lemma:approx-comp-slack}, there exists at least one $i$ such that $\sum_j A_{ij}x_j \geq 1-(1+1/\kappa)\varepsilon$. Since $A_{ij}\leq A_{\max}$ $\forall i, j$, it is also true that $\sum_{j}x_j \geq \frac{1-(1+1/\kappa)\varepsilon}{A_{\max}}$, and as ${x_j}^{1-\alpha}\geq x_j$ and $\kappa \geq \frac{1}{\varepsilon}$, it follows that $\sum_{j}w_j{x_j}^{1-\alpha}\geq (1-\varepsilon(1+\varepsilon))\left(\frac{ w_{\min}}{A_{\max}}\right)$. From (\ref{eq:alpha<1-p-alpha-bound}), we also have $\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\geq \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}$. Therefore:
\begin{equation}
\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \geq \max\left\{(1-\varepsilon(1+\varepsilon))\frac{1}{1-\alpha}\cdot \frac{ w_{\min}}{A_{\max}},\; \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\right\}. \label{eq:alpha<1-p-alpha-case2-bound}
\end{equation}
If $\Phi \leq \frac{1}{10}\cdot\max\left\{(1-\varepsilon(1+\varepsilon))\frac{1}{1-\alpha}\cdot \frac{ w_{\min}}{A_{\max}},\; \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\right\}$, then
\begin{align*}
\sum_i y_i(x) &\geq \frac{9}{10}\kappa\cdot\frac{1}{1-\alpha}\sum_{j}w_j{x_j}^{\alpha}\\
&\geq \frac{9}{10}\kappa\cdot \max\left\{(1-\varepsilon(1+\varepsilon))\frac{1}{1-\alpha}\frac{ w_{\min}}{A_{\max}},\; \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\right\}.
\end{align*}
From Lemma \ref{lemma:approx-comp-slack},
\begin{align*}
\sum_i y_i(x) \sum_j A_{ij}x_j&\geq (1-3\varepsilon)\sum_i y_i(x) \\
&\geq (1-3\varepsilon)\frac{9}{10}\kappa\cdot \max\left\{(1-\varepsilon(1+\varepsilon))\frac{1}{1-\alpha}\cdot \frac{ w_{\min}}{A_{\max}},\; \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\right\}.
\end{align*}
From the third part of Lemma \ref{lemma:potential-increase-alpha<1}, the potential increases additively by at least
\begin{equation*}
\Omega\left(\frac{\beta^2\kappa}{\ln(1/\delta_{\min})}\right)\cdot \max\left\{\frac{1}{1-\alpha}\cdot \frac{ w_{\min}}{A_{\max}},\; \frac{W}{1-\alpha}\cdot\left(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\right)^{\frac{1-\alpha}{\alpha}}\right\},
\end{equation*}
and, therefore, $\Phi = \Omega\left(\frac{W}{1-\alpha}\cdot\big(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\big)^{\frac{1-\alpha}{\alpha}}\right)$ after at most
\begin{align*}
O\left(\frac{\ln(1/\delta_{\min})\kappa}{\gamma^2}\right) = O\left(\frac{1}{\alpha}\frac{1}{\varepsilon^3}\ln\left(R_w nmA_{\max}\right)\ln\left(R_w\frac{nmA_{\max}}{\varepsilon}\right) \right)
\end{align*}
rounds.
\noindent\textbf{Case 3: $\Omega\Big(\frac{W}{1-\alpha}\cdot\big(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\big)^{\frac{1-\alpha}{\alpha}}\Big)\leq \Phi \leq \frac{W}{1-\alpha}$.} In this case, $\Phi = O\left(\sum_j w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}\right)$. If the round is stationary, then from Lemma \ref{lemma:alpha<1-stationary-round}, $p(x^*)\leq (1+6\varepsilon)p(x)$. If the round is not stationary, then from Definition \ref{def:alpha<1-stationary-round}, either:
\begin{enumerate}
\item $\sum_{k\in S^-}w_k{x_k}^{1-\alpha} > \gamma \sum_{j=1}^n w_j {x_j}^{1-\alpha}$, or
\item $\sum_{j=1}^n x_j \sum_{i=1}^m y_i(x)A_{ij} > (1+\frac{5\gamma}{4}) \sum_{j=1}^n w_j {x_j}^{1-\alpha}$.
\end{enumerate}
If the former is true, then using the first part of Lemma \ref{lemma:potential-increase-alpha<1}, the potential increases by at least $\Omega\left(\frac{\beta^2\gamma}{\ln(1/\delta_{\min})}\right)\cdot \sum_j w_j {x_j}^{1-\alpha} = \Omega\left(\frac{\beta^2\gamma}{\ln(1/\delta_{\min})}\right)\cdot (1-\alpha)\Phi$. If the latter is true, from the third part of Lemma \ref{lemma:potential-increase-alpha<1}, the potential increases by at least $\Omega\left(\frac{\beta^2\gamma}{\ln(1/\delta_{\min})}\right)\cdot \sum_j w_j {x_j}^{1-\alpha} = \Omega\left(\frac{\beta^2\gamma}{\ln(1/\delta_{\min})}\right)\cdot (1-\alpha)\Phi$.
It follows that there are at most
\begin{align*}
O&\left(\frac{1}{1-\alpha}\cdot\frac{\ln(1/\delta_{\min})}{\beta^2 \gamma}\ln\left(\frac{\frac{W}{1-\alpha}}{\frac{W}{1-\alpha}\cdot\big(\frac{w_{\min}}{2w_{\max}n^2mA_{\max}}\big)^{\frac{1-\alpha}{\alpha}}}\right)\right)\\
&= O\left(\frac{1}{\alpha^2}\frac{1}{\varepsilon^5}\ln^2\left(R_w\cdot{mnA_{\max}}\right)\ln^2\left(R_w\cdot\frac{mnA_{\max}}{\varepsilon}\right)\right)
\end{align*}
non-stationary Case 3 rounds.
Combining the three cases with the bound on $\tau_0+ \tau_1$ (\ref{eq:tau1+tau0-bound}), the total convergence time is at most:
\begin{align*}
O\left(\frac{1}{\alpha^2\varepsilon^5}\ln^2\left(R_w{mnA_{\max}}\right)\ln^2\left(R_w\cdot\frac{mnA_{\max}}{\varepsilon}\right)\right)
\end{align*}
rounds, as claimed.
\end{proofof}
\subsection{Proof of Theorem \ref{thm:convergence-alpha=1}}\label{section:alpha=1}
The proof outline for the convergence of \textsc{$\alpha$-FairPSolver} in the $\alpha = 1$ case is as follows. First, we show that in any round it cannot be the case that only ``small'' $x_j$'s (i.e., $x_j$'s that are smaller than $\frac{\delta_j}{1-\beta}$) decrease. In fact, we show that the increase in the potential due to updates of ``small'' variables is dominated by the increase in the potential due to those variables that decrease multiplicatively by a factor $(1-\beta_2) = (1-\beta)$ (Lemmas \ref{lemma:mul-increase-prop} and \ref{lemma:potential-increase-proportional}). We then define a stationary round and show that: (i) in any non-stationary round the potential increases significantly, and (ii) in any stationary round, the solution $x$ at the beginning of the round provides an additive $5W\varepsilon$--approximation to the optimum objective value.
\begin{lemma}\label{lemma:mul-increase-prop}
Starting with a feasible solution, in any round of the algorithm:
\begin{enumerate}
\item $\sum_{\{k\in S^- : x_k\geq \frac{\delta_k}{1-\beta}\}} x_k \sum_{i=1}^m y_i(x)A_{ik}\geq \frac{1}{2}\sum_{j\in S^-} x_j \sum_{i=1}^m y_i(x)A_{ij}$.
\item $\sum_{\{k\in S^- : x_k\geq \frac{\delta_k}{1-\beta}\}} \frac{x_k \sum_{i=1}^m y_i(x)A_{ik}}{w_k}\geq \frac{1}{2}\sum_{j\in S^-} \frac{x_j \sum_{i=1}^m y_i(x)A_{ij}}{w_j}$.
\end{enumerate}
\end{lemma}
\begin{proof}
Fix any round, and let $x^0, y(x^0)$ and $x^1, y(x^1)$ denote the values of $x, y$ at the beginning and at the end of the round, respectively. If for all $j\in S^-$ $x_j^0 \geq \frac{\delta_j}{1-\beta}$, there is nothing to prove.
Suppose that there exists some $x_j^0<\frac{\delta_j}{1-\beta}$ that decreases. Then from Lemma \ref{lemma:small-x-tight-yi} there exists at least one $i\in\{1,...,m\}$ such that $A_{ij}\neq 0$, and:
\begin{itemize}
\item $\sum_{k=1}^nA_{ik}x_k^0 > 1- \frac{\varepsilon}{2}$, and
\item $y_i(x) \geq \frac{\sum_{l=1}^my_l(x^0)A_{lj}}{mA_{\max}} > (1-\beta)\frac{w_j}{\delta_j}\frac{1}{mA_{\max}}\frac{x_j^0\sum_{l=1}^my_l(x^0)A_{lj}}{w_j}$.
\end{itemize}
Since $\sum_{k=1}^nA_{ik}x_k^0 > 1- \frac{\varepsilon}{2}$, there exists at least one $p$ such that $A_{ip}x_p^0 > \frac{1-\frac{\varepsilon}{2}}{n}$.
Recalling that $C = \frac{w_j}{\delta_j}\geq 2w_{\max}n^2mA_{\max}$:
\begin{align}
(x_p^0)A_{ip}y_i(x^0)&>C\cdot \frac{(1-\beta)}{m {A_{\max}}}\cdot\frac{1-\frac{\varepsilon}{2}}{n}\cdot\frac{x_j^0\sum_{l=1}^my_l(x^0)A_{lj}}{w_j} \notag\\
&>2w_{\max}n^2m{A_{\max}}\cdot \frac{(1-\beta)}{m {A_{\max}}}\cdot\frac{1-\frac{\varepsilon}{2}}{n}\cdot \frac{x_j^0\sum_{l=1}^my_l(x^0)A_{lj}}{w_j}\notag\\
&\geq 2nw_{\max}(1-\beta)\left(1-\frac{\varepsilon}{2}\right)\cdot \frac{x_j^0\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\notag\\
&\geq nw_{\max}\frac{x_j^0\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}. \label{eq:alpha=1-n-times-inc}
\end{align}
Since $x_j$ decreases, it must be $\frac{x_j^0\sum_{l=1}^my_l(x^0)A_{lj}}{w_j}\geq 1+\gamma$. Using (\ref{eq:alpha=1-n-times-inc}):
\begin{equation*}
\frac{x_p^0\sum_{l=1}^m y_l(x^0)A_{lp}}{w_p}\geq \frac{(x_p^0)A_{ip}y_i(x^0)}{w_{\max}}\geq n \frac{x_j^0\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j} \geq 1+\gamma,
\end{equation*}
and, therefore, $x_p$ decreases as well.
Moreover, since (\ref{eq:alpha=1-n-times-inc}) implies
\begin{equation*}
x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} \geq \sum_{\{j\in S^-: x_j<\frac{\delta_j}{1-\beta}\wedge A_{ij}\neq 0\}} \frac{w_{\max}}{w_j}x_j^0\sum_{l=1}^m y_l(x^0)A_{lj} \geq \sum_{\{j\in S^-: x_j<\frac{\delta_j}{1-\beta}\wedge A_{ij}\neq 0\}} x_j^0\sum_{l=1}^m y_l(x^0)A_{lj},
\end{equation*}
the proof of the first part of the lemma follows. The second part follows from (\ref{eq:alpha=1-n-times-inc}) as well, since:
\begin{align*}
\frac{x_p^0\sum_{l=1}^my_l(x^0)A_{lp}}{w_p} &\geq \frac{(x_p^0)A_{ip}y_i(x^0)}{w_{\max}}\\
&\geq n \frac{x_j^0\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j},
\end{align*}
which, given that $x_j$ was chosen arbitrarily, implies:
\begin{align*}
\frac{x_p^0\sum_{l=1}^my_l(x^0)A_{lp}}{w_p} &\geq \sum_{\{j\in S^-: x_k<\frac{\delta_k}{1-\beta}\wedge A_{ik}\neq 0\}} \frac{x_k^0\sum_{l=1}^m y_l(x^0)A_{lj}}{w_k}.
\end{align*}
\end{proof}
\begin{lemma}\label{lemma:potential-increase-proportional}
Let $x^0, y(x^0)$ and $x^1, y(x^1)$ denote the values of $x, y$ at the beginning and at the end of any fixed round, respectively. If $x^0$ is feasible, then the potential increase in the round is at least:
\begin{enumerate}
\item \label{item:prop-1} $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta\gamma)\sum_{j\in S^+} w_j$;
\item \label{item:prop-2} $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta)\left((1-\gamma)W - \sum_{j=1}^nx_j^0\sum_{i=1}^m y_i(x^0) A_{ij}\right)$.
\item \label{item:prop-3} $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta)\left(\sum_{j=1}^nx_j^0\sum_{i=1}^m y_i(x^0) A_{ij} - (1+\gamma)W\right)$.
\end{enumerate}
\end{lemma}
\begin{proof}
$\quad$\\
\noindent\textbf{Proof of \ref{item:prop-1}:}
Recall that:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \sum_{j=1}^n w_j \frac{x_j^1 - x_j^0}{x_j^1}\Big( 1- \frac{x_j^1\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\Big) \geq \sum_{j\in S^+} w_j \frac{x_j^1 - x_j^0}{x_j^1}\Big( 1- \frac{x_j^1\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\Big).
\end{equation*}
Let $\xi_j(x^1) = \frac{x_j^1\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}$, $\xi_j(x^0) = \frac{x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}}{w_j}$.
If $j\in S^+$, then $x_j^1 = (1+\beta)x_j^0$ and $\xi_j(x^0) \leq 1-\gamma$. Since from the choice of parameters $\xi_j$ increases by at most a factor of $1+\gamma/4$, it follows that: $\xi_j(x^1) \leq (1-\gamma)(1+\gamma/4)\leq 1 -\frac{3}{4}\gamma$, which gives $1 - \xi_j(x^1) \geq \frac{3}{4}\gamma$. Therefore:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \frac{\beta}{1+\beta}\cdot \frac{3}{4}\gamma \cdot \sum_{j\in S^+} w_j.
\end{equation*}
\noindent\textbf{Proof of \ref{item:prop-2}:} The proof is equivalent to the proof of the second part of Lemma \ref{lemma:potential-increase-alpha<1} and is omitted.
\noindent\textbf{Proof of \ref{item:prop-3}:} Using that for $j\in S^-$ we have that $\frac{x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}}{w_j}\geq 1 + \gamma$ and $x_j^1 = \max\{(1-\beta)x_j^0, \delta_j\}$, we can lower bound the increase in the potential as:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \sum_{\{j\in S^-:x_j^0\geq \frac{\delta_j}{1-\beta}\}} w_j \frac{x_j^1 - x_j^0}{x_j^1}\Big(1 - \frac{x_j^1 \sum_{i=1}^m y_{i}(x^1)A_{ij}}{w_j}\Big)\notag\\
& = \frac{\beta}{1-\beta} \sum_{\{j\in S^-:x_j^0\geq \frac{\delta_j}{1-\beta}\}} w_j \Big(\frac{x_j^1 \sum_{i=1}^m y_i (x^1)A_{ij}}{w_j} - 1\Big)\notag\\
&\geq \frac{\beta}{1-\beta} \sum_{\{j\in S^-:x_j^0\geq \frac{\delta_j}{1-\beta}\}} w_j \Big((1-\gamma/4)\frac{x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - 1\Big)\notag\\
&\geq \frac{\beta}{1-\beta}(1-\gamma/4) \sum_{\{j\in S^-:x_j^0\geq \frac{\delta_j}{1-\beta}\}} w_j\Big(\frac{x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - (1+\gamma)\Big). \label{eq:delta-phi-j-in-S-}
\end{align}
Now consider $k\in S^-$ such that $x_k^0 < \frac{\delta_k}{1-\beta}$. From the proof of Lemma \ref{lemma:mul-increase-prop}, for each such $x_k$ there exists a constraint $i$ and a variable $x_p \geq \frac{\delta_p}{1-\beta}$ with $p\in S^-$ such that $A_{ik}\neq 0$, $A_{ip\neq 0}$, $x_p^0 \sum_l y_l(x^0)A_{lp}\geq n\cdot x_k^0 \sum_l y_l(x^0)A_{lk}$, and $\frac{x_p^0 \sum_l y_l(x^0)A_{lp}}{w_p}\geq n\cdot \frac{x_k^0 \sum_l y_l(x^0)A_{kp}}{w_k}$. If $w_k \leq w_p$ then
\begin{align}
w_p \Big( \frac{x_p^0 \sum_l y_l(x^0)A_{lp}}{w_p} - (1+\gamma) \Big)&\geq w_k \Big(n\cdot \frac{x_k^0 \sum_l y_l(x^0)A_{kp}}{w_k} - (1+\gamma) \Big)\notag\\
&\geq n \cdot w_k \Big( \frac{x_k^0 \sum_l y_l(x^0)A_{kp}}{w_k} - (1+\gamma) \Big)\notag.
\end{align}
On the other hand, if $w_k>w_p$, then:
\begin{align*}
w_p \Big( \frac{x_p^0 \sum_l y_l(x^0)A_{lp}}{w_p} - (1+\gamma) \Big)&= ( x_p^0 \sum_l y_l(x^0)A_{lp} - (1+\gamma)w_p )\\
&> n\cdot x_k^0 \sum_l y_l(x^0)A_{kp} - (1+\gamma)w_k\\
&\geq n\cdot w_k \Big( \frac{x_k^0 \sum_l y_l(x^0)A_{kp}}{w_k} - (1+\gamma) \Big).
\end{align*}
It follows from (\ref{eq:delta-phi-j-in-S-}) that:
\begin{align*}
\Phi(x^1) - \Phi(x^0) & \geq \frac{\beta}{1-\beta}\frac{1-\gamma/4}{2} \sum_{j\in S^-} w_j \Big(\frac{x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - (1+\gamma)\Big).
\end{align*}
Finally, since for $j\notin S^-$ we have that $\frac{x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}}{w_j}< 1 + \gamma$:
\begin{align*}
\Phi(x^1) - \Phi(x^0) & \geq \frac{\beta}{1-\beta}\frac{1-\gamma/4}{2} \sum_{j=1}^n w_j \Big(\frac{x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - (1+\gamma)\Big)\\
&= \Omega(\beta) \Big( \sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij} - (1+\gamma)\sum_{j=1}^n w_j \Big).
\end{align*}
\end{proof}
Consider the following definition of a stationary round:
\begin{definition}\label{def:alpha=1-stat-round}
A round is stationary if it happens after the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$ and if both of the following conditions hold:
\begin{itemize}
\item $\sum_{j\in S^+}w_j \leq W /\tau_0$;
\item $(1-2\gamma)W\leq \sum_{j=1}^n x_j \sum_{i=1}^m y_(x)A_{ij}\leq (1+2\gamma)W$.
\end{itemize}
\end{definition}
We first show that in any non-stationary round there is a sufficient progress towards the $\varepsilon-$approximate solution.
\begin{lemma}\label{lemma:non-stat-round-alpha=1}
In any non-stationary round the potential function increases by at least $\Omega(\beta\gamma\cdot W/\tau_0)$.
\end{lemma}
\begin{proof}
A round is non-stationary if either of the two conditions from Definition \ref{def:alpha=1-stat-round} does not hold. If the first condition does not hold, then from the first part of Lemma \ref{lemma:potential-increase-proportional}, the potential increases by $\Omega(\beta\gamma\cdot W/\tau_0)$. If the second condition does not hold, then from either the second or the third part of Lemma \ref{lemma:potential-increase-proportional} the potential increases by at least $\Omega(\beta\gamma W) \geq \Omega(\beta\gamma\cdot W/\tau_0)$.
\end{proof}
Before proving that in every non-stationary round, the solution is $O(\varepsilon)-$approximate, we will need the following intermediary lemma.
\begin{lemma}\label{lemma:cond-lower-bound}
Starting with a feasible solution and after at most $\tau_0 = \frac{1}{\beta}\ln\left(\frac{1}{\delta_{\min}}\right)$ rounds, in any round of the algorithm:
\begin{equation*}
\min_j \frac{x_j \sum_{i=1}^m y_i(x)A_{ij}}{w_j} \geq (1-\gamma)^{\tau_0}.
\end{equation*}
\end{lemma}
\begin{proof}
First, we claim that after the algorithm reaches a feasible solution it takes at most $\tau_0 + 1$ additional rounds for each agent $j$ to reach a round in which $\frac{x_j \sum_{i=1}^m y_i(x)A_{ij}}{w_j} > 1-\gamma$. Suppose not, and pick any agent $k$ for which in each of the $\tau_0 + 1$ rounds following the first round that holds a feasible solution: $
\frac{x_k\sum_{i=1}^m y_i(x)A_{ik}}{w_k}\leq 1-\gamma$. Then $x_k$ increases in each of the rounds and after $\frac{1}{\beta}\ln(\frac{1}{\delta_k})\leq \tau_0$ rounds we have $x_k \geq 1$. Therefore, after at most $\tau_0+1$ rounds the solution becomes infeasible, which is a contradiction (due to Lemma \ref{lemma:feasibility}).
Now choose any $x_j$ and observe $\xi_j = \frac{x_j \sum_{i=1}^m y_i(x)A_{ij}}{w_j}$ over the rounds that happen after the first $\tau_0 + 1$ rounds. The maximum number of consecutive rounds for which $\xi_j\leq 1 -\gamma$ is $\tau_j = \frac{1}{\beta}\ln(\frac{1}{\delta_j})\leq \tau_0$, otherwise we would have $x_j>1$, a contradiction. Since in any round, due to the choice of the algorithm parameters, $\xi_j$ decreases by at most a factor of $1-\gamma/4$, the minimum value that $\xi_j$ can take is at least $(1-\gamma)(1-\gamma/4)^{\tau_j/2}>(1-\gamma)^{\tau_0}$, thus completing the proof.
\end{proof}
Now we are ready to prove that a solution in a stationary round is $O(\varepsilon)-$approximate.
\begin{lemma}\label{lemma:alpha=1-stat-round}
In any stationary round: $p_1(x^*) - p_1(x)\leq 5\varepsilon W$, where $x^*$ is the optimal solution.
\end{lemma}
\begin{proof}
Since, due to Definition \ref{def:alpha=1-stat-round}, a stationary round can only happen after the initial $\tau_0 + \tau_1$ rounds, we have that in any stationary round the solution is feasible (Lemmas \ref{lemma:feasibility} and \ref{lemma:self-stabilization}) and approximate complementary slackness (Lemma \ref{lemma:approx-comp-slack}) holds.
Recall the expression \iffalse(\ref{eq:duality-gap-proportional})\fi for the duality gap:
\begin{equation*}
G_1(x, y) = - \sum_{j=1}^n w_j \ln\left(\frac{x_j\sum_{i=1}^m y_i A_{ij}}{w_j}\right)+\sum_{i=1}^m y_i -W.
\end{equation*}
From the second part of Lemma \ref{lemma:approx-comp-slack}:
\begin{equation*}
\sum_{i=1}^m y_i\leq (1+3\varepsilon)\sum_{j=1}^nx_j\sum_{i=1}^m y_i A_{ij}.
\end{equation*}
Therefore:
\begin{equation*}
G_1(x, y) \leq - \sum_{j=1}^n w_j \ln\left(\frac{x_j\sum_{i=1}^m y_i A_{ij}}{w_j}\right)+(1+3\varepsilon)\sum_{j=1}^nx_j\sum_{i=1}^m y_i A_{ij} -W.
\end{equation*}
Since the round is stationary, we have that $\sum_{j=1}^nx_j\sum_{i=1}^m y_i A_{ij}\leq (1+2\gamma)W$, which gives:
\begin{equation}
G_1(x, y) \leq - \sum_{j=1}^n w_j \ln\left(\frac{x_j\sum_{i=1}^m y_i A_{ij}}{w_j}\right)+4\varepsilon W. \label{eq:alpha=1-duality-gap-bound}
\end{equation}
Let $\xi_j = \frac{x_j\sum_{i=1}^m y_i A_{ij}}{w_j}$. The remaining part of the proof is to bound $-\sum_{j=1}^n w_j\ln(\xi_j)\leq -\sum_{j:\xi_j < 1} w_j \ln(\xi_j)$.
For $\xi_j \in(1-\gamma, 1)$, we have that $-w_j\ln(\xi_j)\leq \gamma w_j$. To bound the remaining terms, we will use Lemma \ref{lemma:cond-lower-bound} and the bound of the sum of the weights $w_j$ for which $\xi_j \in S^+$ (that is, $\xi_j \leq 1-\gamma$). It follows that:
\begin{align}
-\sum_{j=1}^n w_j\ln(\xi_j)&\leq -\sum_{k:\xi_k\in(1-\gamma, 1)}w_k \ln(\xi_k) - \sum_{l\in S^+}w_l\ln(\xi_l)\notag\\
&\leq \gamma \sum_{k:\xi_k\in(1-\gamma, 1)}w_k -\ln\Big((1-\gamma)^{\tau_0}\Big)\cdot \sum_{l\in S^+}w_l \quad(\text{from Lemma \ref{lemma:cond-lower-bound}})\notag\\
&\leq \gamma W + \tau_0 {\gamma} \cdot\frac{W}{\tau_0}\notag\\
&= 2\gamma W \notag\\
&= \frac{\varepsilon}{2}W. \label{eq:bound-on-ln-terms}
\end{align}
Combining (\ref{eq:alpha=1-duality-gap-bound}) and (\ref{eq:bound-on-ln-terms}), and recalling that $p_1(x^*)-p_1(x)\leq G_1(x, y(x))$, the result follows.
\end{proof}
\begin{proofof}{Theorem \ref{thm:convergence-alpha=1}}
Consider the values of the potential in the rounds following the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$ (so that the solution $x$ is feasible in each round and the approximate complementary slackness holds). Observe that $\tau_0+\tau_1 = o\Big(\frac{\ln^2\left(nmA_{\max}R_w\right)\ln^2\left(\frac{nmA_{\max}}{\varepsilon}R_w\right)}{\varepsilon^5}\Big)$.
We start by bounding the minimum and the maximum values that the potential can take. Recall (from Lemma \ref{lemma:potential-increase}) that the potential never decreases.
Due to Lemma \ref{lemma:feasibility}, $x_j\in [\delta_j, 1]$, $\forall j$, and therefore we can bound the two summations in the potential as:
\begin{equation}
\sum_j w_j \ln(x_j)\geq \sum_j w_j \ln(\delta_j) = - O\Big(W\cdot\ln\Big(\frac{w_{\max}}{ w_{\min}}nmA_{\max}\Big)\Big), \label{eq:alpha=1-pot-lbound-1}
\end{equation}
\begin{equation}
\sum_j w_j \ln(x_j)\leq \sum_j w_j \ln(1) \leq 0, \label{eq:alpha=1-pot-ubound-1}
\end{equation}
\begin{equation}
-\frac{1}{\kappa} \sum_i y_i(x) \geq -\frac{mC}{\kappa}\cdot e^{0} > -mC = -O(w_{\max}n^2m^2A_{\max}), \label{eq:alpha=1-pot-lbound-2}
\end{equation}
and
\begin{equation}
-\frac{1}{\kappa} \sum_i y_i(x) < -\frac{mC}{\kappa}\cdot e^{-\kappa} < 0. \label{eq:alpha=1-pot-ubound-2}
\end{equation}
From (\ref{eq:alpha=1-pot-lbound-1}) and (\ref{eq:alpha=1-pot-lbound-2}):
\begin{equation}
\Phi_{\min} \geq -O(w_{\max}n^2m^2A_{\max}). \label{eq:alpha=1-phi-min}
\end{equation}
On the other hand, from (\ref{eq:alpha=1-pot-ubound-1}) and (\ref{eq:alpha=1-pot-ubound-2}):
\begin{equation}
\Phi_{\max} <0. \label{eq:alpha=1-phi-max}
\end{equation}
Consider the following two cases:
\noindent\textbf{Case 1: $\frac{1}{\kappa}\sum_i y_i(x)\geq W\cdot \ln\Big(e\cdot\frac{w_{\max}}{ w_{\min}}nmA_{\max}\Big)$.} Then $\frac{1}{\kappa}\sum_i y_i(x)\leq -\Phi(x)\leq \frac{2}{\kappa}\sum_i y_i(x)$ and $\frac{1}{\kappa}\sum_i y_i(x)\geq W$. From the third part of Lemma \ref{lemma:approx-comp-slack}, we have that $\sum_j x_j \sum_iy_i(x)A_{ij}\geq (1-3\varepsilon)\sum_i y_i(x) \geq 2W$. Thus using the Part \ref{item:prop-2} of Lemma \ref{lemma:potential-increase-proportional}, we get that the potential increases by
\begin{equation*}
\Omega(\beta)\cdot \sum_j x_j \sum_i y_i(x)A_{ij} = \Omega\left(\beta\cdot \sum_i y_i(x)\right)= \Omega(\beta\kappa)\cdot (-\Phi(x)).
\end{equation*}
Finally, since $\beta\kappa = \Theta(\gamma)$, there can be at most $O\left(\frac{1}{\gamma}\ln\left(\frac{R_w nmA_{\max}}{W\ln(R_w nmA_{\max})}\right)\right)$ Case 1 rounds.
\noindent\textbf{Case 2: $\frac{1}{\kappa}\sum_i y_i(x) < W\cdot \ln\Big(e\cdot\frac{w_{\max}}{ w_{\min}}nmA_{\max}\Big)$.} Then $-2W\cdot \ln\Big(e\cdot\frac{w_{\max}}{ w_{\min}}nmA_{\max}\Big) < \Phi(x) < 0$. From Lemma \ref{lemma:alpha=1-stat-round}, if a round is stationary, then $p(x^*) - p(x)\leq 5\varepsilon W$. If a round is non-stationary, from Lemma \ref{lemma:non-stat-round-alpha=1}, the potential increases (additively) by at least $\Omega(\beta\gamma\cdot W/\tau_0)$. Therefore, the maximum number of non-stationary rounds is at most:
\begin{align*}
O\left(\frac{W\ln(nm{A_{\max}}w_{\max}/ w_{\min})}{\beta\gamma W/\tau_0}\right) & = O\left(\frac{1}{\beta^2\gamma}\cdot \ln^2\left(R_w nmA_{\max}\right)\right)\\
&= O\left(\frac{\ln^2\left(R_w nmA_{\max}\right)\ln^2\left(R_w\frac{nmA_{\max}}{\varepsilon}\right)}{\varepsilon^5}\right).
\end{align*}
Combining the results for the Case 1 and Case 2, the theorem follows by invoking \textsc{$\alpha$-FairPSolver} for the approximation parameter $\varepsilon' = \varepsilon/5$.
\end{proofof}
\subsection{Proof of Theorem \ref{thm:convergence-alpha>1}}\label{section:alpha>1}
The outline of the proof of Theorem \ref{thm:convergence-alpha>1} is as follows. First, we show that in any round of the algorithm the variables that decrease by a multiplicative factor $(1-\beta_2)$ dominate the potential increase due to \emph{all the variables} that decrease (Lemma \ref{lemma:alpha>1-mul-increase-over-S-}).
This result is then used in Lemma \ref{lemma:potential-increase-alpha>1} to show the appropriate lower bound on the potential increase. Observe that for $\alpha > 1$ the objective function $p_\alpha(x)$, and, consequently, the potential function $\Phi(x)$ is negative for any feasible $x$. To yield a poly-logarithmic convergence time in $R_w, m, n$, and $A_{\max}$, the idea is to show that the negative potential $-\Phi(x)$ decreases by some multiplicative factor whenever $x$ is not a ``good'' approximation to $x^*$ -- the optimal solution to $(P_\alpha)$. This idea, combined with the fact that the potential never decreases (and therefore $-\Phi(x)$ never increases) and with upper and lower bounds on the potential then leads to the desired convergence time.
\begin{lemma}\label{lemma:alpha>1-mul-increase-over-S-}
In any round of the algorithm in which the solution $x^0$ at the beginning of the round is feasible:
\begin{equation*}\sum_{\left\{j:j\in S^- \wedge x_j^0 \geq \frac{\delta_j}{1-\beta}\right\}} x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}\geq \frac{1}{2} \sum_{j\in S^-}x_j^0\sum_{i=1}^m y_i(x^0)A_{ij};
\end{equation*}
and
\begin{align*}\sum_{\left\{j:j\in S^- \wedge x_j^0 \geq \frac{\delta_j}{1-\beta}\right\}} \left(x_j^0\sum_{i=1}^m y_i(x^0)A_{ij} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\right)\geq \frac{1}{2} \sum_{j\in S^-}\left(x_j^0\sum_{i=1}^m y_i(x^0)A_{ij} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\right).
\end{align*}
\end{lemma}
\begin{proof}
If $x_j^0 \geq \frac{\delta_j}{1-\beta}$, $\forall j$, there is nothing to prove, so assume that there exists at least one $j$ with $x_j^0 < \frac{\delta_j}{1-\beta}$.
The proof proceeds as follows. First, we show that for each $j$ for which $x_j$ decreases by a factor less than $(1-\beta)$ there exists at least one $x_p$ that appears in at least one constraint $i$ in which $x_j$ appears and decreases by a factor $(1-\beta)$. We then proceed to show that $x_p$ is in fact such that
\begin{align*}x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} = \Omega(n)x_j^0\sum_{l=1}^m y_l(x^0)A_{lj}
\end{align*}
and
\begin{align*}x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} - (1+\gamma)w_p(x_p^0)^{1-\alpha}= \Omega(n) \left(x_j^0\sum_{l=1}^m y_l(x^0)A_{lj} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\right).
\end{align*}
This will then imply that the terms $x_p^0\sum_{l=1}^m y_l(x^0)A_{lp}$ and $x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} - (1+\gamma)w_p(x_p^0)^{1-\alpha}$ dominate \emph{the sum} of all the terms corresponding to $x_j$'s with $A_{ij}\neq 0$ and $x_j<\frac{\delta_j}{1-\beta}$, thus completing the proof.
From Lemma \ref{lemma:small-x-tight-yi}, for each $j\in S^-$ with $x_j < \frac{\delta_j}{1-\beta}$ there exists at least one constraint $i$ such that:
\begin{itemize}
\item $\sum_{k=1}^n A_{ik}x_k^0 > 1 - \frac{\varepsilon}{2}$, and
\item $y_i(x^0) \geq \frac{\sum_{l=1}^m y_l(x^0)A_{lj}}{mA_{\max}} \Rightarrow y_i(x^0) > (1-\beta)^\alpha\frac{1}{mA_{\max}}\frac{w_j}{{\delta_j}^{\alpha}}\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_i(x^0)A_{lj}}{w_j}$.
\end{itemize}
Therefore, there exists at least one $x_p$ with $A_{ip}\neq 0$ such that $A_{ip}x_p^0>\frac{1-\frac{\varepsilon}{2}}{n}$, which further gives $A_{ip}(x_p^0)^{\alpha}>\frac{(1-\frac{\varepsilon}{2})^{\alpha}}{n^\alpha}\cdot {A_{ip}}^{1-\alpha}\geq\frac{(1-\frac{\varepsilon}{2})^{\alpha}}{n^\alpha}\cdot {A_{\max}}^{1-\alpha}$, where the last inequality follows from $1\leq A_{ip}\leq A_{\max}$ and $\alpha>1$. Combining the inequality for $A_{ip}(x_p^0)^{\alpha}$ with the inequality for $y_i(x^0)$ above:
\begin{align}
(x_p^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lp} &\geq (x_p^0)^{\alpha}A_{ip}y_i(x^0)\notag\\
&\geq \frac{(1-\frac{\varepsilon}{2})^{\alpha}}{n^\alpha}\cdot {A_{\max}}^{1-\alpha} (1-\beta)^\alpha\frac{1}{mA_{\max}}\frac{w_j}{{\delta_j}^{\alpha}}\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\notag\\
&= C\cdot \frac{(1-\frac{\varepsilon}{2})^{\alpha}}{n^\alpha m {A_{\max}}^{\alpha}}(1-\beta)^\alpha\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\quad (\text{from } C= \frac{w_j}{\delta_j^{\alpha}})\notag\\
&\geq 2n w_{\max} (1-\beta)^\alpha\left(1-\frac{\varepsilon}{2}\right)^{\alpha}\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\quad (\text{from } C\geq 2w_{\max} n^{\alpha+1}m {A_{\max}}^{2\alpha-1})\notag.
\end{align}
Using the generalized Bernoulli's inequality: $\left(1-\frac{\varepsilon}{2}\right)^{\alpha}>1-\frac{\varepsilon\alpha}{2}$ and $(1-\beta)^\alpha>(1-\beta\alpha)$ \cite{mitrinovic1970analytic}, and recalling that $\varepsilon\alpha\leq \frac{9}{10}$, $\beta \leq \frac{\gamma\varepsilon}{5} = \frac{\varepsilon^2}{20}\leq \frac{\varepsilon}{120}$, we further get:
\begin{align}
(x_p^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lp} &\geq 2nw_{\max}\left(1 - \frac{9}{10\cdot120}\right)\left(1 - \frac{9}{20}\right)\cdot \frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\notag\\
&\geq n w_{\max}\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\notag,
\end{align}
which further implies:
\begin{equation}
\frac{(x_p^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lp}}{w_p} \geq n\cdot \frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j},\label{eq:condition-n-dominance}
\end{equation}
as $w_p\leq w_{\max}$. Since $x_j$ decreases, $\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j}\geq 1 + \gamma$, and therefore $x_p$ decreases as well.
Using similar arguments, as $A_{ip}x_p^0>\frac{1-\frac{\varepsilon}{2}}{n}$ and recalling that $y_i(x^0)\geq \frac{1}{m A_{\max}}\sum_{l=1}^mA_{lj}y_l(x^0) >\frac{1}{m A_{\max}}\frac{1-\beta}{\delta_j}\cdot x_j^0\sum_{l=1}^mA_{lj}y_l(x^0)$:
\begin{align}
x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} &\geq x_p^0 A_{ip}y_i(x^0)\geq \frac{1-\frac{\varepsilon}{2}}{n}\frac{1}{m A_{\max}}\frac{1-\beta}{\delta_j}\cdot x_j^0\sum_{l=1}^mA_{lj}y_l(x^0)\notag\\
&\geq n x_j^0\sum_{l=1}^mA_{lj}y_l(x^0), \label{eq:slackness-n-dominance}
\end{align}
as $\delta_j \leq \frac{1}{2^{1/\alpha}n^2mA_{\max}}$ and $2^{1/\alpha}(1-\frac{\varepsilon}{2})(1-\beta)\geq 2^{\frac{10}{9}\varepsilon}(1-\frac{\varepsilon}{2})(1-\frac{\varepsilon^2}{20})\geq 1$ (since $\varepsilon \in (0, 1/6]$).
From (\ref{eq:slackness-n-dominance}), it follows that
\begin{equation*}x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} \geq \sum_{\{k \in S^-: x_k <\frac{\delta_k}{1-\beta}\wedge A_{ik}\neq 0\}}x_k^0\sum_{l=1}^m y_l(x^0)A_{lk},
\end{equation*}
which further implies the first part of the lemma.
For the second part, consider the following two cases:
\noindent\textbf{Case 1:} $w_p(x_p^0)^{1-\alpha} \geq w_j(x_j^0)^{1-\alpha}$. Then:
\begin{align*}
x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} - (1+\gamma)w_p(x_p^0)^{1-\alpha} &= w_p(x_p^0)^{1-\alpha}\left(\frac{(x_p^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lp}}{w_p} - (1+\gamma)\right)\\
&\geq w_j(x_j^0)^{1-\alpha}\left(\frac{(x_p^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lp}}{w_p} - (1+\gamma)\right)\\
&\geq w_j(x_j^0)^{1-\alpha}\left(n\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j} - (1+\gamma)\right)\quad (\text{from (\ref{eq:condition-n-dominance})}) \\
&\geq n w_j(x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{l=1}^m y_l(x^0)A_{lj}}{w_j} - (1+\gamma)\right)\\
&= n\left(x_j^0\sum_{l=1}^m y_l(x^0)A_{lj} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\right),
\end{align*}
implying the second part of the lemma.
\noindent\textbf{Case 2:} $w_p(x_p^0)^{1-\alpha} < w_j(x_j^0)^{1-\alpha}$. Then:
\begin{align*}
x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} - (1+\gamma)w_p(x_p^0)^{1-\alpha} &> x_p^0\sum_{l=1}^m y_l(x^0)A_{lp} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\\
&\geq n x_j^0\sum_{l=1}^m y_l(x^0)A_{lj} - (1+\gamma)w_j(x_j^0)^{1-\alpha}\quad (\text{from (\ref{eq:slackness-n-dominance})}) \\
&\geq n \left( x_j^0\sum_{l=1}^m y_l(x^0)A_{lj} - (1+\gamma)w_j(x_j^0)^{1-\alpha} \right),
\end{align*}
thus implying the second part of the lemma and completing the proof.
\end{proof}
The following lemma lower-bounds the increase in the potential, in each round.
\begin{lemma}\label{lemma:potential-increase-alpha>1}
Let $x^0$ and $x^1$ denote the values of $x$ before and after any fixed round, respectively, and let $S^+ = \{j: x_j^1 > x_j^0\}$, $S^- = \{j: x_j^1 < x_j^0\}$. The potential increase in the round is lower bounded as:
\begin{enumerate}[noitemsep, topsep=5pt]
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta\gamma)\sum_{j\in\{S^+\cup S^-\}} x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\frac{\beta}{(1-\beta)^{\alpha}}\right) \left(\sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0) - (1+\gamma) \sum_{j=1}^nw_j (x_j^0)^{1-\alpha}\right)$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\frac{\beta}{(1+\beta)^{\alpha}}\right) \left( (1-\gamma)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha} - \sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)\right)$.
\end{enumerate}
\end{lemma}
\begin{proof}
$\quad$\\
\noindent\textbf{Proof of 1.} From Lemma \ref{lemma:potential-increase}:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \sum_{j=1}^n w_j \frac{|x_j^1 - x_j^0|}{(x_j^1)^{\alpha}}\left|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\right|.
\end{equation*}
Let $\xi_j(x^1) = \frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1) A_{ij}}{w_j}$.
From the proof of Lemma \ref{lemma:potential-increase}, if $x_j^1 - x_j^0 > 0$, then $1 - \xi_j(x^1)\geq \frac{3}{4}\gamma \geq \frac{3}{4}\gamma \xi_j(x^1)$, as $0 < \xi_j(x^1) \leq 1 - \frac{3}{4}\gamma$. If $x_j^ 1 - x_j^0 < 0$, then $1 - \xi_j(x^1) \leq - \frac{\gamma}{2}$, which implies $1\leq \xi_j(x^1)(1 +\frac{\gamma}{2})^{-1}$, and thus $1 - \xi_j(x^1) \leq \xi_j(x^1)((1 + \gamma/2)^{-1} - 1) = \xi_j(x^1) \frac{-\gamma/2}{1 + \gamma/2} <-\xi_j(x^1)\frac{\gamma/2}{3/2}= -\frac{\gamma}{3}\xi_j(x^1)$.
Therefore: $|1-\xi_j(x^1)|\geq \frac{\gamma}{3}\xi_j(x^1) \Leftrightarrow\left|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\right|\geq \frac{\gamma}{3}\frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}$, which further gives:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \sum_{j=1}^n w_j \frac{|x_j^1 - x_j^0|}{(x_j^1)^{\alpha}} \frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j} \geq \frac{\gamma}{3}\sum_{j=1}^n |x_j^1 - x_j^0|\cdot \sum_{i=1}^m y_i(x^1)A_{ij}.
\end{equation*}
If $j\in S^+$, then $x_j^1 = (1+\beta)x_j^0$, and therefore $|x_j^1 - x_j^0|\cdot \sum_{i=1}^m y_i(x^1)A_{ij} = \left(1 - \frac{1}{1+\beta}\right)x_j^1\sum_{i=1}^m y_i(x^1)A_{ij}\geq \left(1 - \frac{\gamma}{4}\right)\frac{\beta}{1+\beta}x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$.
Similarly, if $j\in S^-$ and $x_j^0 \geq \frac{\delta_j}{1-\beta}$, then $x_j^1 = (1-\beta)x_j^0$, and therefore $|x_j^1 - x_j^0|\cdot \sum_{i=1}^m y_i(x^1)A_{ij} = \left(\frac{1}{1-\beta}-1\right)x_j^1\sum_{i=1}^m y_i(x^1)A_{ij}\geq \left(1 - \frac{\gamma}{4}\right)\frac{\beta}{1-\beta}x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$. Using part 1 of Lemma \ref{lemma:alpha>1-mul-increase-over-S-}:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \frac{\gamma}{6}\frac{\beta}{1+\beta}\sum_{j\in \{S^+\cup S^-\}} x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}.
\end{equation*}
\noindent\textbf{Proof of 2:} Consider $j\in S^-$ such that $x_j^0 \geq \frac{\delta_j}{1-\beta}$. Then $x_j^1 = (1-\beta)x_j^0$, $\frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\geq (1+\gamma)$, and using Lemma \ref{lemma:potential-increase}:
\begin{align*}
\Phi(x^1) - \Phi(x^0) &\geq \sum_{\{j\in S^-: x_j^0 \geq \frac{\delta_j}{1-\beta}\}} w_j \frac{|x_j^1 - x_j^0|}{(x_j^1)^{\alpha}}\left|1 - \frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j}\right|\\
&\geq \sum_{\{j\in S^-: x_j^0 \geq \frac{\delta_j}{1-\beta}\}} w_j \frac{\beta}{(1-\beta)^{\alpha}}(x_j^0)^{1-\alpha} \left(\frac{(x_j^1)^{\alpha}\sum_{i=1}^m y_i(x^1)A_{ij}}{w_j} - 1 \right)\\
&\geq \frac{\beta}{(1-\beta)^{\alpha}}\sum_{\{j\in S^-: x_j^0 \geq \frac{\delta_j}{1-\beta}\}}w_j(x_j^0)^{1-\alpha}\left((1-\gamma/4)\frac{(x_j^0)^{\alpha}\sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - 1 \right)\\
&\geq(1-\gamma/4) \frac{\beta}{(1-\beta)^{\alpha}} \sum_{\{j\in S^-: x_j^0 \geq \frac{\delta_j}{1-\beta}\}}w_j(x_j^0)^{1-\alpha}\left(\frac{(x_j^0)^{\alpha}\sum_{i=1}^m y_i(x^0)A_{ij}}{w_j} - (1+\gamma) \right)\\
&=(1-\gamma/4) \frac{\beta}{(1-\beta)^{\alpha}} \sum_{\{j\in S^-: x_j^0 \geq \frac{\delta_j}{1-\beta}\}}\left( x_j^0 \sum_{i=1}^m y_i(x^0) - (1+\gamma) w_j (x_j^0)^{1-\alpha}\right).
\end{align*}
Using the second part of Lemma \ref{lemma:alpha>1-mul-increase-over-S-} and the fact that for $k\notin S^-$: $\frac{(x_k^0)^{\alpha}\sum_{i=1}^m y_i(x^0)A_{ik}}{w_k}<(1+\gamma)$, we get the desired result:
\begin{equation*}
\Phi(x^1) - \Phi(x^0) \geq \frac{1}{2}(1-\gamma/4) \frac{\beta}{(1-\beta)^{\alpha}}\left(\sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0) - (1+\gamma) \sum_{j=1}^nw_j (x_j^0)^{1-\alpha}\right).
\end{equation*}
\noindent\textbf{Proof of 3:} The proof is equivalent to the proof of Lemma \ref{lemma:potential-increase-alpha<1}, part 2, and is omitted for brevity.
\end{proof}
Consider the following definition of a stationary round:
\begin{definition}\label{def:stationary-round}
(Stationary round.) A round is stationary, if both:
\begin{enumerate}[topsep = 5pt]
\item $\sum_{j\in\{S^+\cup S^-\}} x_j^0\sum_{i=1}^m y_i(x)A_{ij} \leq \gamma \sum_{j=1}^n w_j {(x_j^0)}^{1-\alpha}$, and
\item $(1-2\gamma)\sum_{j=1}^n w_j {(x_j^0)}^{1-\alpha}\leq \sum_{j=1}^n x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$
\end{enumerate}
hold, where $S^+ = \{j: x_j^1 > x_j^0\}$, $S^- = \{j: x_j^1 < x_j^0\}$. Otherwise, the round is non-stationary.
\end{definition}
The following two technical propositions are used in Lemma \ref{lemma:alpha>1-stationary-near-opt} for bounding the duality gap in stationary rounds.
\begin{proposition}\label{prop:alpha>1-duality-gap}
After the initial the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$, it is always true that $G_\alpha(x, y(x))\leq \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{\alpha-1}\Big(1 + (1+3\varepsilon)(\alpha-1)\xi_j - \alpha\xi_j^{\frac{\alpha-1}{\alpha}} \Big)$, where $\xi_j = \frac{x_j^\alpha \sum_i y_i(x)A_{ij}}{w_j}$.
\end{proposition}
\begin{proof}
Recall from (\ref{eq:duality-gap-alpha}) that the duality gap for $x, y$ in $(P_\alpha)$ is given as:
\begin{equation*}
G_{\alpha}(x, y)=\sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{1-\alpha}\left(\left(\frac{w_j}{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}\right)^{\frac{1-\alpha}{\alpha}}-1\right) +\sum_{i=1}^m y_i - \sum_{j=1}^n w_j x_j^{1-\alpha}\cdot \left(\frac{{x_j}^{\alpha}\sum_{j=1}^n A_{ij}y_i}{w_j}\right)^{\frac{\alpha-1}{\alpha}}.
\end{equation*}
From Lemma \ref{lemma:approx-comp-slack}, after at most initial $\tau_0+\tau_1$ rounds:
\begin{align*}
\sum_{i=1}^m y_i&\leq (1+3\varepsilon)\sum_{j=1}^nx_j\sum_{i=1}^m y_i A_{ij}\\
&=(1+3\varepsilon)\sum_{j=1}^n w_j{x_j}^{1-\alpha}\cdot\left(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\right),
\end{align*}
and letting $\xi_j = \frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}$, we get:
\begin{align*}
G_{\alpha}(x, y)&\leq \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{1-\alpha}\left(\xi_j^{\frac{\alpha-1}{\alpha}}-1 + (1+3\varepsilon)(1-\alpha)\xi_j -(1-\alpha)\xi_j^{\frac{\alpha-1}{\alpha}}\right)\\
&= \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{1-\alpha}\left(\alpha\xi_j^{\frac{\alpha-1}{\alpha}}+ (1+3\varepsilon)(1-\alpha)\xi_j -1 \right)\\
&= \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_j - \alpha\xi_j^{\frac{\alpha-1}{\alpha}} \right).
\end{align*}
\end{proof}
\begin{proposition}\label{prop:alpha>1-r-bound}
Let $r_\alpha(\xi_j) =\left(1 + (1+3\varepsilon)(\alpha-1)\xi_j - \alpha\xi_j^{\frac{\alpha-1}{\alpha}} \right)$, where $\xi_j = \frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}$. If $\alpha > 1$ and
$ \xi_j\in (1-\gamma, 1+\gamma)$ $\forall j\in \{1,...,n\}$,
then $r_\alpha(\xi_j)\leq \varepsilon(3\alpha-2)$.
\end{proposition}
\begin{proof}
Observe the first and the second derivative of $r_\alpha(\xi_j)$:
\begin{align*}
\frac{d r_\alpha(\xi_j)}{d \xi_j}
&= (\alpha-1)(1+ 3\varepsilon - \xi_j^{-1/\alpha});\\
\frac{d^2 r_\alpha(\xi_j)}{d{\xi_j}^2}&= \frac{1}{\alpha}(\alpha-1){\xi_j}^{-1/\alpha-1}.
\end{align*}
As $\xi_j>0$, $r(\xi_j)$ is convex for $\alpha>1$, and therefore:
$
r(\xi_j)\leq \max\{r(1-\gamma), r(1+\gamma)\}.
$
We have that:
\begin{align*}
r(1-\gamma) = r(1-\varepsilon/4) &= 1- \left(1-\frac{\varepsilon}{4}\right)((1-\alpha)(1+3\varepsilon)+\alpha(1-\varepsilon/4)^{-1/\alpha})\\
&\leq 1 - \left(1-\frac{\varepsilon}{4}\right)(1-\alpha + 3\varepsilon(1 - \alpha) + \alpha(1+\varepsilon/4)^{1/\alpha})\\
&\leq 1 - \left(1-\frac{\varepsilon}{4}\right)(1+ \varepsilon/4+ 3\varepsilon(1-\alpha)) \quad (\text{from }(1+\varepsilon/4)^{1/\alpha}\geq 1+ {\varepsilon}/({4\alpha}))\\
&= 1 - 1 - \frac{\varepsilon}{4} + 3\varepsilon(\alpha-1)+\frac{\varepsilon}{4}(1+\varepsilon/4-3\varepsilon(\alpha-1))\\
&= \frac{\varepsilon^2}{16} + 3\varepsilon(\alpha-1)\left(1-\frac{\varepsilon}{4}\right)\\
&\leq \varepsilon(3\alpha-2).
\end{align*}
On the other hand:
\begin{align*}
r(1+\gamma) = r(1+\varepsilon/4) &= 1- \left(1+\frac{\varepsilon}{4}\right)((1-\alpha)(1+3\varepsilon)+\alpha(1+\varepsilon/4)^{-1/\alpha})\\
&\leq 1- \left(1+\frac{\varepsilon}{4}\right)(1-\alpha + 3\varepsilon - 3\varepsilon \alpha + \alpha(1-\varepsilon/4)^{1/\alpha})\\
&\leq 1- \left(1+\frac{\varepsilon}{4}\right)\left(1+\frac{11}{4}\varepsilon-3\varepsilon\alpha\right)\\
&\leq 1 - \left(1+\frac{11}{4}\varepsilon - 3\varepsilon\alpha\right)\\
&\leq \varepsilon(3\alpha-2),
\end{align*}
completing the proof.
\end{proof}
The following lemma states that in any stationary round current solution is an $(1+\varepsilon(4\alpha-1))$-approximate solution.
\begin{lemma}\label{lemma:alpha>1-stationary-near-opt}
In any stationary round that happens after the initial the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$, we have that $p_\alpha(x^*) - p_\alpha(x)\leq \varepsilon(4\alpha-1)(-p_\alpha(x))$, where $x^*$ is the optimal solution to $(P_\alpha)$ and $x$ is the solution at the beginning of the round.
\end{lemma}
\begin{proof}
Observe that for any $k\notin \{S^+ \cup S^-\}$ (by the definition of $S^+$ and $S^-$) we have that $1-\gamma<\frac{x_k^{\alpha}\sum_{i=1}^m y_i(x)A_{ik}}{w_k}<1+\gamma$, which is equivalent to:
\begin{equation}
(1-\gamma)w_k x_k^{1-\alpha}< x_k\sum_{i=1}^m y_i(x)A_{ik} < (1+\gamma)w_k x_k^{1-\alpha} \quad \forall k\notin \{S^+\cup S^-\}.\label{eq:tight-stationary-xk}
\end{equation}
Using stationarity and (\ref{eq:tight-stationary-xk}):
\begin{align}
(1-2\gamma)\sum_{j=1}^nw_jx_j^{1-\alpha} &\leq \sum_{j=1}^n x_j\sum_{i=1}^n y_i(x)A_{ij}\notag\\
&= \sum_{l\in\{S^+\cup S^-\}} x_l\sum_{i=1}^n y_i(x)A_{il} + \sum_{k\notin\{S^+\cup S^-\}} x_k\sum_{i=1}^n y_i(x)A_{ik}\notag\\
&< \gamma \sum_{j=1}^n w_j x_j^{1-\alpha} + (1+\gamma)\sum_{k\notin\{S^+\cup S^-\}} w_k x_k^{1-\alpha}.\label{eq:bound-on-all-wj-xj}
\end{align}
Since $\sum_{l\in\{S^+\cup S^-\}}w_{l}x_l^{1-\alpha} = \sum_{j=1}^n w_j x_j^{1-\alpha} - \sum_{k\notin\{S^+\cup S^-\}} w_k x_k^{1-\alpha}$, using (\ref{eq:bound-on-all-wj-xj}):
\begin{align*}
(1-2\gamma)\sum_{l\in\{S^+\cup S^-\}}w_{l}x_l^{1-\alpha} &< \gamma \sum_{j=1}^n w_j x_j^{1-\alpha} + (1+\gamma)\sum_{k\notin\{S^+\cup S^-\}} w_k x_k^{1-\alpha} - (1-2\gamma)\sum_{k\notin\{S^+\cup S^-\}} w_k x_k^{1-\alpha}\\
&= \gamma \sum_{j=1}^n w_j x_j^{1-\alpha} + 3\gamma \sum_{k\notin\{S^+\cup S^-\}} w_k x_k^{1-\alpha}\\
&\leq 4\gamma \sum_{j=1}^n w_j x_j^{1-\alpha},
\end{align*}
and therefore:
\begin{equation}
\sum_{l\in\{S^+\cup S^-\}}w_{l}x_l^{1-\alpha}<\frac{4\gamma}{1-2\gamma} \sum_{j=1}^n w_j x_j^{1-\alpha} < 5\gamma \sum_{j=1}^n w_j x_j^{1-\alpha}, \label{eq:tight-active-objective-part}
\end{equation}
as $\gamma = \frac{\varepsilon}{4}$ and $\varepsilon\leq \frac{1}{6}$.
As $p_\alpha(x^*)-p_\alpha(x)\leq G(x, y(x))$, from Proposition \ref{prop:alpha>1-duality-gap}:
\begin{align*}
p_\alpha(x^*) - p_\alpha(x) \leq& \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_j -\alpha\xi_j^{\frac{\alpha-1}{\alpha}} \right)\\
=& \sum_{k\notin\{S^+\cup S^-\}} w_k\frac{x_k^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_k -\alpha\xi_k^{\frac{\alpha-1}{\alpha}} \right)\\
&+ \sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_l -\alpha\xi_l^{\frac{\alpha-1}{\alpha}} \right).
\end{align*}
From Proposition \ref{prop:alpha>1-r-bound}:
\begin{align}
\sum_{k\notin\{S^+\cup S^-\}} w_k\frac{x_k^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_k -\alpha\xi_k^{\frac{\alpha-1}{\alpha}} \right) &\leq \varepsilon(3\alpha - 2)\sum_{k\notin\{S^+\cup S^-\}} w_k\frac{x_k^{1-\alpha}}{\alpha-1}\notag\\
&\leq \varepsilon(3\alpha - 2) \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{\alpha-1}\notag\\
&= \varepsilon(3\alpha - 2)(-p_{\alpha}(x)). \label{eq:approx-for-passive-x}
\end{align}
Observe $\sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_l -\alpha\xi_l^{\frac{\alpha-1}{\alpha}} \right)$. Since $\alpha>1$, each $w_l\frac{x_l^{1-\alpha}}{\alpha-1}>0$, and therefore:
\begin{align*}
\sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1} & \left(1 + (1+3\varepsilon)(\alpha-1)\xi_l -\alpha\xi_l^{\frac{\alpha-1}{\alpha}} \right)\\
&\leq \sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}\left((1+3\varepsilon)(\alpha-1)\xi_l + 1 \right)\\
&= \sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}\left((1+3\varepsilon)(\alpha-1)\frac{x_l^{\alpha}\sum_{i=1}^m y_i(x)A_{il}}{w_l} + 1 \right)\\
&= (1+3\varepsilon)\sum_{l\in\{S^+\cup S^-\}} x_l\sum_{i=1}^m y_i(x)A_{il} + \sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}.
\end{align*}
Now, from stationarity $\sum_{l\in\{S^+\cup S^-\}} x_l\sum_{i=1}^m y_i(x)A_{il}<\gamma \sum_{j=1}^n w_j x_j^{1-\alpha}$ and using (\ref{eq:tight-active-objective-part}) we get:
\begin{align}
\sum_{l\in\{S^+\cup S^-\}} w_l\frac{x_l^{1-\alpha}}{\alpha-1}\left(1 + (1+3\varepsilon)(\alpha-1)\xi_j -\alpha\xi_j^{\frac{\alpha-1}{\alpha}} \right)&< \sum_{j=1}^n w_j \frac{x_j^{1-\alpha}}{\alpha-1}(\gamma(1+3\varepsilon)(\alpha-1) + 5\gamma)\notag\\
&\leq -p_{\alpha}(x)\left(\frac{3\varepsilon}{8}\alpha +\varepsilon \right). \label{eq:approx-for-active-x}
\end{align}
Finally, combining (\ref{eq:approx-for-passive-x}) and (\ref{eq:approx-for-active-x}):
$
p_\alpha(x^*) - p_\alpha(x) < \varepsilon(4\alpha - 1)(-p_{\alpha}(x)).
$
\end{proof}
The following two lemmas are used for lower-bounding the potential increase in non-stationary rounds.
\begin{lemma}\label{lemma:alpha>1-large-sum-yi}
Consider any non-stationary round that happens after the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$. Let $x^0$ and $x^1$ denote the values of $x$ before and after the round update. If $\frac{1}{\kappa}\sum_i y_(x^0) \geq -\sum_j w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha}$, then $\Phi(x^1) - \Phi(x^0)\geq \Omega(\gamma^3)(-\Phi(x^0))$.
\end{lemma}
\begin{proof}
Observe that as $\frac{1}{\kappa}\sum_i y_(x^0) \geq -\sum_j w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha}$,
\begin{equation*}
-\Phi(x_0)\leq 2\cdot\frac{1}{\kappa}\sum_i y_(x^0)\leq \frac{2(1-3\varepsilon)}{\kappa} \sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij},
\end{equation*}
where the last inequality follows from Lemma \ref{lemma:approx-comp-slack}.
Since the round is not stationary, we have that either:
\begin{enumerate}
\item $\sum_{j\in S^-\cup S^+}x_j^0\sum_i y_i(x)A_{ij} > \gamma \sum_{j=1}^n w_j (x_j^0)^{1-\alpha}$, or
\item $(1-2\gamma)\sum_{j=1}^n w_j(x_j^0)^{1-\alpha} > \sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}$.
\end{enumerate}
\noindent\textbf{Case 1: $\sum_{j\in S^-\cup S^+}x_j^0\sum_i y_i(x)A_{ij} > \gamma \sum_{j=1}^n w_j (x_j^0)^{1-\alpha}$.} If:
\begin{equation*}\sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)\leq (1+2\gamma)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha},
\end{equation*}
then
\begin{equation*}
\sum_{j\in S^-\cup S^+}x_j^0\sum_i y_i(x)A_{ij} > \frac{\gamma}{1+2\gamma}\sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij} = \Omega(\gamma)\sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij},
\end{equation*}
and, from the first part of Lemma \ref{lemma:potential-increase-alpha>1}, the potential increase is lower bounded as:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\beta\gamma^2) \sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}\notag\\
&= \Omega(\beta\kappa\gamma^2) (-\Phi(x^0))\notag\\
&= \Omega(\gamma^3)(-\Phi(x^0)). \nota
\end{align}
On the other hand, if:
\begin{equation*}
\sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)>(1+2\gamma)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha},
\end{equation*}
then, from the second part of Lemma \ref{lemma:potential-increase-alpha>1}:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\beta\gamma)\sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}\notag\\
&= \Omega(\beta\gamma\kappa)(-\Phi(x^0))\notag\\
&= \Omega(\gamma^2)(-\Phi(x^0)). \nota
\end{align}
\noindent\textbf{Case 2: $(1-2\gamma)\sum_{j=1}^n w_j(x_j^0)^{1-\alpha} > \sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}$.} Then, using the third part of Lemma \ref{lemma:potential-increase-alpha>1}:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \Omega\left(\frac{\beta}{(1+\beta)^{\alpha}}\gamma\right)\sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}\notag\\
&= \Omega\left({\beta}\gamma\right)\sum_{j=1}x_j^0 \sum_{i=1}^m y_i(x^0)A_{ij}\notag\\
&= \Omega(\beta\gamma\kappa)(-\Phi(x^0))\notag\\
&= \Omega(\gamma^2)(-\Phi(x^0)), \nota
\end{align}
where in the second line we have used that $\frac{\beta}{(1+\beta)^{\alpha}} = \Theta(\beta)$. This can be shown using the generalized Bernoulli's inequality and $\varepsilon\alpha\leq\frac{9}{10}$ as follows:
\begin{equation*}
\frac{1}{(1+\beta)^{\alpha}}\geq (1-2\beta)^{\alpha}\geq 1-2\alpha\beta = 1 - \frac{\alpha}{k+\alpha}\cdot\frac{\varepsilon}{10}\geq 1 - \frac{9}{100} = \Theta(1).
\end{equation*}
\end{proof}
\begin{lemma}\label{lemma:alpha>1-mul-inc-non-stat}
Consider any non-stationary round that happens after the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$. Let $x^0$ and $x^1$ denote the values of $x$ before and after the round update. If $\frac{1}{\kappa}\sum_i y_(x^0) < -\sum_j w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha}$, then $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\beta\gamma^2\right)(\alpha-1)(-\Phi(x^0))$.
\end{lemma}
\begin{proof}
Observe that as $\frac{1}{\kappa}\sum_i y_(x^0) < -\sum_j w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha}$,
\begin{equation*}
-\Phi(x_0)\leq -2\sum_j w_j \frac{{(x_j^0)}^{1-\alpha}}{1-\alpha} = \frac{2}{\alpha-1} \sum_j w_j {{(x_j^0)}^{1-\alpha}}.
\end{equation*}
From the definition of a stationary round, we have either of the following two cases:
\noindent\textbf{Case 1:} $\sum_{j\in\{S^+\cup S^-\}}x_j\sum_{i=1}^m y_i(x)A_{ij}> \gamma \sum_{j=1}^n w_j x_j^{1-\alpha}$.
From the first part of Lemma \ref{lemma:potential-increase-alpha>1}, the increase in the potential is: $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\beta\gamma^2\right)\sum_{j=1}^n w_j x_j^{1-\alpha}$. As $-\Phi(x^0)\leq \frac{2}{\alpha-1} \sum_j w_j {{(x_j^0)}^{1-\alpha}}$, the increase in the potential is at least:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\beta\gamma^2)(\alpha-1)(-\Phi(x^0)).\nota
\end{align}
\noindent\textbf{Case 2:} $(1-2\gamma)\sum_{j=1}^n w_j x_j^{1-\alpha} > \sum_{j=1}^n x_j\sum_{i=1}^m y_i(x)A_{ij}$. Using part 3 of Lemma \ref{lemma:potential-increase-alpha>1}, the increase in the potential is then $\Phi(x^1) - \Phi(x^0)\geq \Omega\left(\frac{\beta}{(1+\beta)^{\alpha}}\gamma\right)\sum_{j=1}^n w_j x_j^{1-\alpha}$. Therefore, using that $\frac{\beta}{(1+\beta)^{\alpha}} = \Theta(\beta)$ as in the proof of Lemma \ref{lemma:alpha>1-large-sum-yi}:
\begin{align}
\Phi(x^1) - \Phi(x^0) &\geq \Omega(\beta\gamma)(\alpha-1)(-\Phi(x^0)).\notag
\end{align}
\end{proof}
\begin{proofof}{Theorem \ref{thm:convergence-alpha>1}}
We will bound the total number of non-stationary rounds that happen after the initial $\tau_0 + \tau_1$ rounds, where $\tau_0 = \frac{1}{\beta}\ln(1/\delta_{\min})$, $\tau_1 = \frac{1}{\beta}\ln(nA_{\max})$. The total convergence time is then at most the sum of $\tau_0+\tau_1$ rounds and the number of non-stationary rounds that happen after the initial $\tau_0 + \tau_1$ rounds, since, from Lemma \ref{lemma:alpha>1-stationary-near-opt}, in any stationary round: $p(x^*) - p(x)\leq \varepsilon(4\alpha-1)(-p(x))$.
Consider the non-stationary rounds that happen after the initial $\tau_0 + \tau_1$ rounds.
As $x_j\in[\delta_j, 1]$, $\forall j$, it is simple to show that:
\begin{equation}
\frac{W}{\alpha-1}\leq \sum_j w_j \frac{{x_j}^{1-\alpha}}{\alpha-1}\leq \frac{W}{\alpha-1}\cdot 2{R_w}^{\frac{\alpha-1}{\alpha}}n^{2(\alpha-1)}m^{\alpha-1}{A_{\max}}^{2\alpha -1}, \label{eq:alpha>1-palpha-bounds}
\end{equation}
and
\begin{equation}
0< \frac{1}{\kappa}\sum_{i} y_i(x)\leq \frac{mC}{\kappa}\leq \varepsilon m C. \label{eq:alpha>1-sum-yi-bounds}
\end{equation}
Recall that $\Phi(x) = - \sum_j w_j \frac{{x_j}^{1-\alpha}}{\alpha-1} - \frac{1}{\kappa}\sum_{i} y_i(x)$ and that the potential $\Phi(x)$ never decreases.
There can be two cases of non-stationary rounds: those in which $\sum_j w_j \frac{{x_j}^{1-\alpha}}{\alpha-1}$ dominates in the absolute value of the potential, and those in which $\frac{1}{\kappa}\sum_{i} y_i(x)$ dominates in the absolute value of the potential. We bound the total number of the non-stationary rounds in such cases as follows.
\noindent\textbf{Case 1: $\frac{1}{\kappa}\sum_{i} y_i(x) \geq \sum_j w_j \frac{{x_j}^{1-\alpha}}{\alpha-1}$.}
From (\ref{eq:alpha>1-palpha-bounds}) and (\ref{eq:alpha>1-sum-yi-bounds}), in any such round, the negative potential is bounded as:
\begin{equation*}
\Omega\left( \frac{W}{\alpha-1}\right)\leq -\Phi(x)\leq O\left(\varepsilon{mC}\right).
\end{equation*}
Moreover, from Lemma \ref{lemma:alpha>1-large-sum-yi}, in each Case 1 non-stationary round, the potential increases by at least $\Omega(\gamma^3)(-\Phi(x))$. It immediately follows that there can be at most:
\begin{align}
O\left(\frac{1}{\gamma^3}\ln\left(\frac{\varepsilon{mC}}{\frac{W}{\alpha-1}}\right)\right)&= O\left(\frac{1}{\gamma^3}\ln\left((\alpha-1)\varepsilonR_w nmA_{\max}\right)\right)\notag\\
&= O\left(\frac{1}{\varepsilon^3}\ln\left(R_w nmA_{\max}\right)\right) \label{eq:alpha>1-conv-bound-1}
\end{align}
Case 1 non-stationary rounds, as $(\alpha-1)\varepsilon<\alpha\varepsilon\leq \frac{9}{10}$.
\noindent\textbf{Case 2: $\frac{1}{\kappa}\sum_{i} y_i(x) < \sum_j w_j \frac{{x_j}^{1-\alpha}}{\alpha-1}$.} From (\ref{eq:alpha>1-palpha-bounds}) and (\ref{eq:alpha>1-sum-yi-bounds}), in any such round, the negative potential is bounded as:
\begin{equation*}
\Omega\left(\frac{W}{\alpha-1}\right)\leq-\Phi(x)\leq O\left(\frac{W}{\alpha-1}\cdot{{R_w}^{\frac{\alpha-1}{\alpha}}n^{2(\alpha-1)}m^{\alpha-1}{A_{\max}}^{2\alpha -1}}\right).
\end{equation*}
Moreover, from Lemma \ref{lemma:alpha>1-mul-increase-over-S-}, in each such non-stationary round the potential increases by at least $\Omega\left(\beta\gamma^2\right)(\alpha-1)(-\Phi(x^0))$. Therefore, there can be at most:
\begin{align}
O\left(\frac{1}{\beta\gamma^2(\alpha-1)}\ln\left(\frac{\frac{W}{\alpha-1}\cdot{{R_w}^{\frac{\alpha-1}{\alpha}}n^{2(\alpha-1)}m^{\alpha-1}{A_{\max}}^{2\alpha -1}}}{\frac{W}{\alpha-1}}\right)\right) &= O\left(\frac{1}{\beta\gamma^2}\ln({R_w}^{\frac{1}{\alpha}} nmA_{\max})\right)\notag\\
&= O\left(\frac{1}{\varepsilon^4}\ln(R_w nmA_{\max})\ln\left(R_w\cdot\frac{nmA_{\max}}{\varepsilon}\right)\right)\label{eq:alpha>1-conv-bound-2}
\end{align}
Case 2 non-stationary rounds.
The total number of initial $\tau_0+\tau_1$ rounds can be bounded as:
\begin{align}
\tau_0+\tau_1 &= \frac{1}{\beta}\ln(1/\delta_{\min}) + \frac{1}{\beta}\ln(nA_{\max})\notag\\
&= O\left(\frac{1}{\varepsilon^2}\ln\left(R_w nmA_{\max}\right)\ln\left(R_w \cdot\frac{nmA_{\max}}{\varepsilon}\right)\right). \label{eq:alpha>1-conv-bound-3}
\end{align}
Combining (\ref{eq:alpha>1-conv-bound-1}), (\ref{eq:alpha>1-conv-bound-2}), and (\ref{eq:alpha>1-conv-bound-3}), the total convergence time is at most:
\begin{align*}
O\left(\frac{1}{\varepsilon^4}\ln\left(R_w\cdot{nmA_{\max}}\right)\ln\left(R_w\cdot\frac{nmA_{\max}}{\varepsilon}\right)\right).
\end{align*}
Finally, running \textsc{$\alpha$-FairPSolver} for the approximation parameter $\varepsilon' = \varepsilon/(4\alpha-1)$, we get that in any stationary round $p_\alpha(x^*)-p_{\alpha}(x)\leq -\varepsilon p_{\alpha}(x)$, while the total number of non-stationary rounds is at most:
\begin{align*}
O\left(\frac{\alpha^4}{\varepsilon^4}\ln\left(R_w\cdot{nmA_{\max}}\right)\ln\left(R_w\cdot\frac{nmA_{\max}}{\varepsilon}\right)\right).
\end{align*}
\end{proofof}
\else
\subsection{Proof Sketch of Theorem \ref{thm:convergence-alpha>1}}\label{section:alpha>1}
In this section, we outline the main ideas of the proof of Theorem \ref{thm:convergence-alpha>1}, while the technical details are omitted and are instead provided in the {full version of the paper}.
First, we show that in any round of the algorithm the variables that decrease by a multiplicative factor $(1-\beta_2)$ dominate the potential increase due to \emph{all the variables} that decrease (see Lemma {4.21} in the full paper).
This result is then used in Lemma \ref{lemma:potential-increase-alpha>1} to show the following lower bound on the potential increase:
\begin{lemma}\label{lemma:potential-increase-alpha>1}
Let $x^0$ and $x^1$ denote the values of $x$ before and after any fixed round, respectively, and let $S^+ = \{j: x_j^1 > x_j^0\}$, $S^- = \{j: x_j^1 < x_j^0\}$. The potential increase in the round is lower bounded as:
\begin{enumerate}[noitemsep, topsep=5pt]
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega(\beta\gamma)\sum_{j\in\{S^+\cup S^-\}} x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\frac{\beta}{(1-\beta)^{\alpha}}\right) \left(\sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0) - (1+\gamma) \sum_{j=1}^nw_j (x_j^0)^{1-\alpha}\right)$;
\item $\Phi(x^1) - \Phi(x^0) \geq \Omega\left(\frac{\beta}{(1+\beta)^{\alpha}}\right) \left( (1-\gamma)\sum_{j=1}^n w_j (x_j^0)^{1-\alpha} - \sum_{j=1}^n x_j^0 \sum_{i=1}^m y_i(x^0)\right)$.
\end{enumerate}
\end{lemma}
Observe that for $\alpha > 1$ the objective function $p_\alpha(x)$, and, consequently, the potential function $\Phi(x)$ is negative for any feasible $x$. To yield a poly-logarithmic convergence time in $R_w, m, n$, and $A_{\max}$, the idea is to show that the negative potential $-\Phi(x)$ decreases by some multiplicative factor whenever $x$ is not a ``good'' approximation to $x^*$ -- the optimal solution to $(P_\alpha)$. This idea, combined with the fact that the potential never decreases (and therefore $-\Phi(x)$ never increases) and with upper and lower bounds on the potential then leads to the desired convergence time.
Consider the following definition of a stationary round:
\begin{definition}\label{def:stationary-round}
(Stationary round.) A round is stationary, if both:
\begin{enumerate}[topsep = 5pt]
\item $\sum_{j\in\{S^+\cup S^-\}} x_j^0\sum_{i=1}^m y_i(x)A_{ij} < \gamma \sum_{j=1}^n w_j {(x_j^0)}^{1-\alpha}$, and
\item $(1-2\gamma)\sum_{j=1}^n w_j {(x_j^0)}^{1-\alpha}\leq \sum_{j=1}^n x_j^0\sum_{i=1}^m y_i(x^0)A_{ij}$
\end{enumerate}
hold, where $S^+ = \{j: x_j^1 > x_j^0\}$, $S^- = \{j: x_j^1 < x_j^0\}$. Otherwise, the round is non-stationary.
\end{definition}
Recall the expression for the negative potential: $-\Phi(x) = \frac{1}{\alpha - 1}\sum_jw_j{x_j}^{1-\alpha} + \frac{1}{\kappa}\sum_i y_i(x)$. Then, using Lemma \ref{lemma:potential-increase-alpha>1}, it suffices to show that in a non-stationary round the decrease in the negative potential $-\Phi(x)$ is a multiplicative factor of the larger of the two terms $\frac{1}{\alpha - 1}\sum_jw_j{x_j}^{1-\alpha}$ and $\frac{1}{\kappa}\sum_i y_i(x)$.
The last part of the proof is to show that the solution $x$ that corresponds to any stationary round is close to the optimal solution. This part is done by appropriately upper-bounding the duality gap. Denoting by $S^+\cup S^-$ the set of coordinates $j$ for which $x_j$ either increases or decreases in the observed stationary round and using Definition \ref{def:stationary-round}, we show that the terms $j\in \{S^+ \cup S^-\}$ contribute to the duality gap by no more than $O(\varepsilon\alpha)\cdot (-p_\alpha(x))$. The terms corresponding to $j\notin \{S^+\cup S^-\}$ are bounded recalling (from \textsc{$\alpha$-FairPSolver}) that for such terms $\frac{x_j^\alpha \sum_{i=1}^m y_i(x)A_{ij}}{w_j}\in (1-\gamma, 1 + \gamma)\equiv(1-\varepsilon/4, 1+\varepsilon/4)$.
\fi
\subsection{Structural Properties of $\alpha-$Fair Allocations}
\paragraph{Lower Bound on the Minimum Allocated Value.}
Recall (from Section \ref{section:prelims})
that the optimal solution $x^*$ to $(P_\alpha)$ must lie in the positive orthant. We show in Lemma \ref{lemma:lower-bound} that not only does $x^*$ lie in the positive orthant, but the minimum element of $x^*$ can be bounded below as a function of the problem parameters. This lemma motivates the choice of parameters $\delta_j$ in \textsc{$\alpha$-FairPSolver} (Section \ref{section:algorithm}).
\begin{lemma}\label{lemma:lower-bound}
Let $x^* = (x_1^*,...,x_n^*)$ be the optimal solution to $(P_\alpha)$. Then $\forall j\in \{1,...,n\}$:
\begin{itemize}
\itemsep0pt
\item $x_j^*\geq \big(\frac{w_j}{w_{\max}M}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\big)^{1/\alpha}$, if $0<\alpha\leq1$,
\item $x_j^* \geq {{A_{\max}}}^{(1-\alpha)/\alpha}\big(\frac{w_j}{w_{\max}M}\big)^{1/\alpha}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}$, if $\alpha>1$,
\end{itemize}
where $n_i = \sum_{j=1}^n \mathds{1}_{\{A_{ij}\neq 0\}}$\footnote{With the abuse of notation, $\mathds{1}_{\{e\}}$ is the indicator function of the expression $e$, i.e., 1 if $e$ holds, and 0 otherwise.} is the number of non-zero elements in the $i^{\text{th}}$ row of the constraint matrix $A$, and $M=\min\{m, n\}$.
\end{lemma}
\iffullpaper
\begin{proof}
Fix $\alpha$. Let:
\begin{equation*}\mu_j({\alpha}) =
\begin{cases} \left(\frac{w_j}{w_{\max}M}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\right)^{1/\alpha}, & \mbox{if } \alpha\leq 1 \\
{{A_{\max}}}^{(1-\alpha)/\alpha}\left(\frac{w_j}{w_{\max}M}\right)^{1/\alpha}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}, & \mbox{if } \alpha> 1 \end{cases}.
\end{equation*}
For the purpose of contradiction, suppose that $x^* = (x_1^*,...,x_n^*)$ is the optimal solution to $(P_\alpha)$, and $x_j^* < \mu_j(\alpha)$ for some fixed $j\in\{1,...,n\}$.
To establish the desired result, we will need to introduce additional notation. We first break the set of (the indices of) constraints of the form $Ax\leq 1$ in which variable $x_j$ appears with a non-zero coefficient into two sets, $U$ and $T$:
\begin{itemize}
\item Let $U$ denote the set of the constraints from $(P_\alpha)$ that are not tight at the given optimal solution $x^*$, and are such that $A_{u, j}\neq 0$ for $u\in U$. Let $s_u = {1-\sum_{k=1}^n A_{uk}x_k}$ denote the slack of the constraint $u\in U$.
\item Let $T$ denote the set of tight constraints from $(P_\alpha)$ that are such that $A_{tj}\neq 0$ for $t\in T$. Observe that since $x^*$ is assumed to be optimal, $T\neq \emptyset$.
\end{itemize}
Let $\varepsilon_j = \min\left\{\mu_j(\alpha)-x_j^*, \min_{u\in U}s_u/A_{uj}\right\}$. Notice that by increasing $x_j$ to $x_j^* + \varepsilon_j$ none of the constraints from $U$ can be violated (although all the constraints in $T$ will; we deal with these violations in what follows).
In each constraint $t\in T$, there must exist at least one variable $x_k$ such that $x_k^*>\dfrac{1}{n_tA_{tk}}$, because $\sum_{l=1}^n A_{tl} x_{l}^*=1$, as each $t\in T$ is tight, and $
x_j^*<\mu_j(\alpha)\leq\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\leq \frac{1}{n_t A_{tj}}.
$
Select one such $x_k$ in each constraint $t\in T$, and denote by $K$ the set of indices of selected variables. Observe that $|K|\leq |T|$ ($\leq M$), since an $x_k$ can appear in more than one constraint.
For each $k\in K$, let $T_k$ denote the constraints in which $x_k$ is selected, and let
\begin{equation}
\varepsilon_k = \max_{t\in T_k: A_{tk}\neq 0} \dfrac{A_{tj}\varepsilon_j}{A_{tk}}.\label{eq:epsilon-choice}
\end{equation}
If we increase $x_j$ by $\varepsilon_j$ and decrease $x_k$ by $\varepsilon_k$ $\forall k\in K$, each of the constraints $t\in T$ will be satisfied since, from (\ref{eq:epsilon-choice}) and from the fact that only one $x_k$ gets selected per constraint $t\in T$, $\varepsilon_j A_{tj}-\sum_{k\in K}\varepsilon_k A_{tk}\leq 0$. Therefore, to construct an alternative feasible solution $x'$, we set $x'_{j}=x_j^*+\varepsilon_j$, $x'_k = x_k^*-\varepsilon_k$ for $k\in K$, and $x'_l = x_l^*$ for all the remaining coordinates $l\in\{1,...,n\}\backslash (K \cup\{j\})$.
Since $j$ is the only coordinate over which $x$ gets increased in $x'$, all the constraints $Ax'\leq 1$ are satisfied. For $x'$ to be feasible, we must have in addition that $x_k'\geq 0$ for $k\in K$.
We show that $x_k' = x^*_k - \varepsilon_k \geq 0$ as follows:
\begin{align*}
\varepsilon_k &= \varepsilon_j \cdot \max_{t\in T_k: A_{tk}\neq 0}\frac{A_{tj}}{A_{tk}}\\
&\leq \mu_j(\alpha)\cdot \max_{t\in T_k: A_{tk}\neq 0}\frac{A_{tj}}{A_{tk}}\\
& \leq \min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\cdot \max_{t\in T_k: A_{tk}\neq 0}\frac{A_{tj}}{A_{tk}}\\
& \leq \max_{t\in T_k: A_{tk}\neq 0}\frac{1}{n_t A_{tj}}\frac{A_{tj}}{A_{tk}}\\
&\leq \max_{t\in T_k: A_{tk}\neq 0}\frac{1}{n_t A_{tk}}\\
&< x_k^*,
\end{align*}
where the second line follows from $\varepsilon_j \leq \mu_j(\alpha)-x_j^*\leq \mu_j(\alpha)$, and the last line follows from the choice of $x_k$.
The last part of the proof is to show that $\sum_{l=1}^n w_l\frac{x_{l}'-x_l^*}{{x_l^*}^{\alpha}}>0$, which contradicts the initial assumption that $x^*$ is optimal, by the definition of $\alpha$-fairness from Section \ref{section:prelims}. We have that:
\begin{align}
\sum_{l=1}^n w_l\frac{x_{l}'-x_l^*}{{x_l^*}^{\alpha}} &= w_j\frac{\varepsilon_j}{{x_j^*}^{\alpha}} - \sum_{k\in K}w_k \frac{\varepsilon_k}{{x_k^*}^{\alpha}}\notag\\
&= \sum_{k\in K} \left(w_j\frac{\varepsilon_j}{{x_j^*}^{\alpha}|K|} - w_k \frac{\varepsilon_k}{{x_k^*}^{\alpha}}\right)\notag\\
&= \sum_{k\in K} \left(\frac{w_j\varepsilon_j{x_k^*}^{\alpha} - w_k\varepsilon_k{x_j^*}^{\alpha}|K|}{{x_j^*}^{\alpha}{x_k^*}^{\alpha}|K|}\right) . \label{eq:sum-ind-terms}
\end{align}
Consider one term from the summation (\ref{eq:sum-ind-terms}). From the choice of $\varepsilon_k$'s, we know that for each $\varepsilon_k$ there exist $t\in T$ such that $\varepsilon_k = \dfrac{\varepsilon_jA_{tj}}{A_{tk}}$, and at the same time (by the choice of $x_k$) we have $x_k^* > \dfrac{1}{n_t A_{tk}}$, so that
\begin{equation}
w_j\varepsilon_j{x_k^*}^{\alpha}> w_j\dfrac{\varepsilon_k A_{tk}}{A_{tj}}\left(\frac{1}{A_{tk}n_t}\right)^{\alpha}> \frac{w_kw_j\varepsilon_k }{w_{\max}}\dfrac{A_{tk}}{A_{tj}}\left(\frac{1}{A_{tk}n_t}\right)^{\alpha}.\label{eq:xk-general}
\end{equation}
\noindent\textbf{Case 1.} Suppose first that $\alpha\leq 1$. Then ${x_k^*}^{\alpha} > \left(\frac{1}{A_{tk}n_t}\right)^{\alpha}\geq \frac{1}{A_{tk}n_t}$, as $A_{tk}\neq 0\Rightarrow A_{tk}\geq 1$. Plugging into (\ref{eq:xk-general}), we have:
\begin{equation}
w_j\varepsilon_j{x_k^*}^{\alpha}> \frac{w_kw_j\varepsilon_k}{w_{\max}}\dfrac{ 1}{n_tA_{tj}}\label{eq:xk}.
\end{equation}
By the initial assumption, $x_j^* < \mu_j(\alpha) = \left(\frac{w_j}{w_{\max}M}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\right)^{1/\alpha}$, and therefore
\begin{equation}
w_k\varepsilon_k{x_j^*}^{\alpha}|K|< \frac{w_k w_j \varepsilon_k }{w_{\max}}\frac{|K|}{M}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}}\leq \frac{w_k w_j \varepsilon_k }{w_{\max}}\frac{1}{n_t A_{tj}}, \label{eq:xj}
\end{equation}
since it must be $|K|\leq M$ ($=\min\{m, n\}$). From (\ref{eq:xk}) and (\ref{eq:xj}), we get that every term in the summation (\ref{eq:sum-ind-terms}) is strictly positive, which implies:
\begin{equation*}
\sum_{l=1}^n w_l\frac{x_{l}'-x_l^*}{{x_l^*}^{\alpha}}>0,
\end{equation*}
and therefore $x^*$ is not optimal.
\noindent\textbf{Case 2.} Now suppose that $\alpha>1$. Then
\begin{equation*}
x_j^*<\mu_j(\alpha) = {{A_{\max}}}^{(1-\alpha)/\alpha}\left(\frac{w_j}{w_{\max}M}\right)^{1/\alpha}\min_{i: A_{ij}\neq 0}\frac{1}{n_i A_{ij}} \leq {{A_{\max}}}^{(1-\alpha)/\alpha}\left(\frac{w_j}{w_{\max}M}\right)^{1/\alpha}\frac{1}{n_t A_{tj}}.
\end{equation*}
Therefore:
\begin{align}
w_k\varepsilon_k{x_j^*}^{\alpha}|K|&< w_k\varepsilon_k \frac{w_j}{w_{\max}M} {A_{\max}}^{1-\alpha}\left(\frac{1}{n_tA_{tj}}\right)^{\alpha}|K|\notag\\
&\leq {w_k}\frac{w_j}{w_{\max}}{A_{\max}}^{1-\alpha}\varepsilon_k\left(\frac{1}{A_{tk}n_t}\right)^{\alpha}\dfrac{ {A_{tk}}^{\alpha}}{{A_{tj}}^{\alpha}}\notag\\
&={w_k}\frac{w_j}{w_{\max}}\frac{\varepsilon_k A_{tk}}{A_{tj}}\cdot\frac{(A_{tk}/A_{tj})^{\alpha-1}}{{A_{\max}}^{\alpha-1}}\left(\frac{1}{A_{tk}n_t}\right)^{\alpha}\notag\\
&\leq {w_k}\frac{w_j}{w_{\max}}\dfrac{\varepsilon_k A_{tk}}{A_{tj}}\left(\frac{1}{A_{tk}n_t}\right)^{\alpha},\label{eq:xj-alpha1}
\end{align}
as $|K|\leq M$, and $\frac{A_{tk}}{A_{tj}}\leq A_{\max}$ (since for any $i, j$: $1\leq A_{ij}\leq {A_{\max}}$).
Finally, from (\ref{eq:xk-general}) and (\ref{eq:xj-alpha1}) we get that every term in the summation (\ref{eq:sum-ind-terms}) is positive, which yields a contradiction.
\end{proof}
\fi
\paragraph{Asymptotics of $\alpha-$Fair Allocations}
The following lemma states that for sufficiently small (but not too small) $\alpha$, the values of the linear and the $\alpha-$fair objectives at their respective optimal solutions are approximately the same. This statement will then lead to a conclusion that to $\varepsilon-$approximately solve an $\alpha-$fair packing problem for a very small $\alpha$, one can always use an $\varepsilon-$approximation packing LP algorithm.
\begin{lemma}\label{lemma:LP-close-to-small-alpha-fair}
Let $(P_{\alpha})$ be an $\alpha-$fair packing problem with optimal solution $x^*$, and $(P_0)$ be the LP with the same constraints and the same weights $w$ as $(P_{\alpha})$ and an optimal solution $z^*$. Then if $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$, we have that $\sum_j w_j z_j^* \geq (1-3\varepsilon)\sum_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha}$, where $\varepsilon\in(0, 1/6]$.
\end{lemma}
\iffullpaper
\begin{proof}
The proof outline is as follows. First, we show that the $\alpha-$fair objective $p_\alpha(x^*)$ can be upper-bounded by a linear objective as $p_\alpha(x^*)\equiv \sum_j w_j \frac{{x_j^*}^{1-\alpha}}{1-\alpha}\leq (1+O(\varepsilon))\sum_j w_j x_j^*$. Then, to complete the proof, we use the optimality of $z^*$ for the LP: $\sum_j w_j z_j^*\geq \sum_j w_j x_j^*$ ($\geq (1-O(\varepsilon)) \sum_j w_j \frac{{x_j^*}^{1-\alpha}}{1-\alpha}$ from the first part of the proof).
Let $g(x_j) = \frac{{x_j}^{1-\alpha}}{1-\alpha} - (1+\varepsilon)x_j$. Consider the case when $g(x_j)\leq 0$. Solving $g(x_j)\leq 0$ for $x_j$, we get that it should be
\begin{equation}
x_j \geq \Big(\frac{1}{1-\alpha}\Big)^{1/\alpha}\cdot \Big(\frac{1}{1+\varepsilon}\Big)^{1/\alpha}.\label{eq:x-j-alpha-c}
\end{equation}
Choose $\alpha$ so that $\frac{1}{(1+\varepsilon)^{1/\alpha}} \leq \big(\frac{\varepsilon/4}{nA_{\max}}\big)$, which is equivalent to $\alpha \leq \frac{\ln(1+\varepsilon)}{\ln(4nA_{\max}/\varepsilon)}$. Then to have $g(x_j)\leq 0$, it suffices to have $x_j \geq \frac{\varepsilon}{nA_{\max}}$, because (i) $\big(\frac{1}{1-\alpha}\big)^{1/\alpha} \in [e, 4]$ for $\alpha \in [0, 1/2]$, where $e$ is the base of the natural logarithm, and (ii) $\frac{1}{(1+\varepsilon)^{1/\alpha}} \leq \big(\frac{\varepsilon/4}{nA_{\max}}\big)$ by the choice of $\alpha$.
Now, as $\alpha \leq \frac{\ln(1+\varepsilon)}{\ln(4nA_{\max}/\varepsilon)}$, summing over $j$ such that $x_j^*\geq \frac{\varepsilon}{nA_{\max}}$ we have:
\begin{align}
\sum_{j: x_j^*\geq \frac{\varepsilon}{nA_{\max}}}w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha} - (1+\varepsilon)\sum_{j: x_j^*\geq \frac{\varepsilon}{nA_{\max}}}w_j x_j^* = \sum_{j: x_j^*\geq \frac{\varepsilon}{nA_{\max}}}w_j g(x_j^*)
\leq 0 \label{eq:large-coord-approx}
\end{align}
Now we bound the rest of the terms in $p_\alpha(x^*)$, i.e., we consider $j: x_j^* < \frac{\varepsilon}{nA_{\max}}$. Observe that since $x_j = \frac{1}{nA_{\max}}$ for $j=\{1,...,n\}$ is a feasible solution to $(P_{\alpha})$ and $x^*$ is the optimal solution to $(P_{\alpha})$, we have that $\sum_j w_j \frac{(1/nA_{\max})^{1-\alpha}}{1-\alpha}\leq \sum_j w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha}$, which gives:
\begin{align}
\sum_{j: x_j^*< \frac{\varepsilon}{nA_{\max}}}w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha} &< \varepsilon^{1-\alpha}\sum_{j: x_j^*< \frac{\varepsilon}{nA_{\max}}}w_j\frac{(1/nA_{\max})^{1-\alpha}}{1-\alpha }\notag\\
& < \varepsilon^{1-\alpha} \sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha}\notag\\
&\leq 2\varepsilon \sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha} \notag.
\end{align}
Therefore:
\begin{align}
\sum_{j: x_j^*\geq \frac{\varepsilon}{nA_{\max}}}w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha} > (1-2\varepsilon) \sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha}.\label{eq:small-coord-approx}
\end{align}
Combining (\ref{eq:large-coord-approx}) and (\ref{eq:small-coord-approx}), we now get:
\begin{align}
\sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha} &< \frac{1+\varepsilon}{1-2\varepsilon}\cdot \sum_{j: x_j^*\geq \frac{\varepsilon}{nA_{\max}}}w_j x_j^*. \label{eq:alpha-LP}
\end{align}
Finally, since $z^*$ optimally solves $(P_0)$ (which has the same constraints and weights as $(P_{\alpha})$), we have that $x^*$ is feasible for $(P_0)$, and using (\ref{eq:alpha-LP}) and optimality of $z^*$, it follows that:
\begin{align}
\sum_{j=1}^n w_j z_j^* &\geq \sum_{j=1}^n w_j x_j^* \notag\\
&\geq \frac{1-2\varepsilon}{1+\varepsilon} \sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha}\notag\\
&\geq (1-3\varepsilon) \sum_{j=1}^n w_j \frac{(x_j^*)^{1-\alpha}}{1-\alpha},\notag
\end{align}
as claimed.
\end{proof}
\fi
Observing that for any $\alpha\in(0, 1)$, $\frac{(z_j^*)^{1-\alpha}}{1-\alpha}\geq z_j^*$ (since, due to the scaling, $z_j^*\in[0, 1]$), a simple corollary of Lemma \ref{lemma:LP-close-to-small-alpha-fair} is that an $\varepsilon-$approximation $z$ to $(P_0)$ ($\sum_j w_j z_j \geq (1-\varepsilon)\sum_j w_j z_j^*$) is also an $O(\varepsilon)-$approximation to $(P_{\alpha})$, for $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$. Thus, to find an $\varepsilon-$approximate solution for $\alpha \leq \frac{\varepsilon/4}{\ln(nA_{\max}/\varepsilon)}$, the packing LP algorithm of \cite{AwerbuchKhandekar2009} can be run, which means that there is a stateless distributed algorithm that converges in poly($\ln(\varepsilon^{-1}R_w mnA_{\max})/\varepsilon$) time for $\alpha$ arbitrarily close to zero.
The following two lemmas show that when $\alpha$ is sufficiently close to 1, $(P_{\alpha})$ can be $\varepsilon-$approximated by $\varepsilon-$approximately solving $(P_1)$ with the same constraints and weights.
\begin{lemma}\label{lemma:alpha-close-to-1-below}
Let $x$ be an $\varepsilon-$approximate solution to a 1-fair packing problem $(P_1)$ returned by \textsc{$\alpha$-FairPSolver}. Then, for any $\alpha \in \left[1- 1/{\tau_0}, 1\right)$, where $\tau_0 = \frac{1}{\beta}\ln(\frac{1}{\delta_{\min}})$, $x$ is also a $2\varepsilon-$approximate solution to $(P_\alpha)$, where the only difference between $(P_1)$ and $(P_\alpha)$ is in the value of $\alpha$ in the objective.
\end{lemma}
\iffullpaper
\begin{proof}
Suppose that $x$ is a solution in some stationary round, provided by \textsc{$\alpha$-FairPSolver} run for $\alpha = 1$. Fix that round. It is clear that if $x$ is feasible in $(P_1)$, it is also feasible in $(P_\alpha)$, since all the constraints in $(P_1)$ and $(P_\alpha)$ are the same by the initial assumption. All that is required for a dual solution $y$ to be feasible is that $y_i \geq 0$, for all $i$, and therefore $y(x)$ is a feasible dual solution for $(P_\alpha)$. The rest of the proof follows by bounding the duality gap $G_\alpha(x, y(x))$. Recall from (\ref{eq:duality-gap-alpha}) that:
\begin{align}\label{eq:duality-gap-alpha-recap}
G_{\alpha}(x, y(x)) = \sum_{j=1}^n w_j\frac{x_j^{1-\alpha}}{1-\alpha}\bigg(\Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\Big)^{\frac{\alpha-1}{\alpha}}-1\bigg) +\sum_{i=1}^m y_i - \sum_{j=1}^n w_j x_j^{1-\alpha}\cdot \Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m A_{ij}y_i}{w_j}\Big)^{\frac{\alpha-1}{\alpha}}.
\end{align}
Since $x$ is a solution from a stationary round, from the second part of the definition of a stationary round (Definition \ref{def:alpha=1-stat-round}), we have that:
\begin{align*}
\sum_{j=1}^n x_j \sum_{i=1}^n y_i(x)A_{ij} \leq (1+2\gamma)\sum_{k=1}^n w_k.
\end{align*}
Further, from Lemma \ref{lemma:approx-comp-slack}:
\begin{align}
\sum_{i=1}^m y_i(x) \leq (1+3\varepsilon)\sum_{j=1}^n x_j \sum_{i=1}^n y_i(x)A_{ij} \leq (1+3\varepsilon)(1+2\gamma)\sum_{k=1}^n w_k. \label{eq:alpha-below-1-acs}
\end{align}
Next, we show that:
\begin{align}
{x_j}^{1-\alpha} \geq 1- \gamma,\quad \forall j. \label{eq:alpha-below=1-all-x-large}
\end{align}
Rearranging the terms and taking logarithms of both sides in (\ref{eq:alpha-below=1-all-x-large}), we obtain the equivalent inequality $1-\alpha \leq \frac{\ln(1/(1-\gamma))}{\ln(1/x_j)}$. Recall from \textsc{$\alpha$-FairPSolver} that in every (except for, maybe, the first) round $x_j \geq \delta_j \geq \delta_{\min}$. As $\ln(1/(1-\gamma))\geq \gamma$, it therefore suffices to show that $1-\alpha \leq \frac{\gamma}{\ln(1/\delta_{\min})}$. But from the statement of the lemma, $1-\alpha\leq 1/\tau_0 < \frac{\gamma}{\ln(1/\delta_{\min})}$, completing the proof of (\ref{eq:alpha-below=1-all-x-large}).
Combining (\ref{eq:alpha-below-1-acs}) and (\ref{eq:alpha-below=1-all-x-large}), we get that:
\begin{align}\label{eq:alpha-below-1-bnd-1}
\sum_{i=1}^m y_i(x) \leq \frac{(1+3\varepsilon)(1+2\gamma)}{1-\gamma}\sum_{j=1}^n w_j {x_j}^{1-\alpha} \leq (1+5\varepsilon) \sum_{j=1}^n w_j {x_j}^{1-\alpha},
\end{align}
where the second inequality follows from $\varepsilon\leq 1/6$, $\gamma = \varepsilon/4$.
Using (\ref{eq:alpha-below-1-bnd-1}), we can bound the duality gap (Eq. (\ref{eq:duality-gap-alpha-recap})) as:
\begin{align}\label{eq:duality-gap-alpha-betterbound}
G_{\alpha}(x, y(x)) \leq \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(\alpha\Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\Big)^{\frac{\alpha-1}{\alpha}}-1 + (1-\alpha)(1+5\varepsilon)\right).
\end{align}
To complete the proof, recall from Lemma \ref{lemma:cond-lower-bound} that in any round of the algorithm, for all $j$: $ \frac{x_j \sum_{i=1}^m y_i(x)A_{ij}}{w_j} \geq (1-\gamma)^{\tau_0}$. As $\alpha < 1$ and $x_j \in [0, 1]$, $\forall j$, it holds that ${x_j}^{\alpha} \geq x_j$, $\forall j$, and therefore:
\begin{align}\label{eq:alpha-below-1-bnd-2}
\frac{{x_j}^{\alpha} \sum_{i=1}^m y_i(x)A_{ij}}{w_j} \geq (1-\gamma)^{\tau_0}, \quad \forall j.
\end{align}
Finally, recalling that $1-\alpha \leq 1/\tau_0$, and combining (\ref{eq:alpha-below-1-bnd-2}) with (\ref{eq:duality-gap-alpha-betterbound}), we get:
\begin{align}
G_{\alpha}(x, y(x))&\leq \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(\alpha\Big(\frac{1}{1-\gamma}\Big)^{1/\alpha} -1 + (1-\alpha)(1+5\varepsilon) \right)\notag\\
&\leq \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}((1 + {2\gamma})^{1/\alpha} - 1 + (1-\alpha)(1+5\varepsilon))\notag\\
&\leq \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} (1 + \varepsilon - 1 + (1-\alpha)(1+5\varepsilon)) \notag\\
&\leq 2\varepsilon \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha},\notag
\end{align}
where the third inequality follows from $\alpha \geq 1 - 1/\tau_0 \geq 1 - \frac{\gamma \varepsilon}{5}\geq 1 - \frac{\varepsilon^2}{20}$, and the fourth inequality follows from $1-\alpha < \varepsilon/2$ and $\varepsilon \leq 1/6$.
\end{proof}
\fi
\begin{lemma}\label{lemma:alpha-close-to-1-above}
Let $x$ be an $\varepsilon-$approximate solution to a 1-fair packing problem $(P_1)$ returned by \textsc{$\alpha$-FairPSolver}. Then, for any $\alpha \in (1, 1 + 1/{\tau_0}]$, where $\tau_0 = \frac{1}{\beta}\ln(\frac{1}{\delta_{\min}})$, $x$ is also a $2\varepsilon-$approximate solution to $(P_\alpha)$, where the only difference between $(P_1)$ and $(P_\alpha)$ is in the value of $\alpha$ in the objective.
\end{lemma}
\iffullpaper
\begin{proof}
Similar to the proof of Lemma \ref{lemma:alpha-close-to-1-below}, we will fix an $x$ from some stationary round of \textsc{$\alpha$-FairPSolver} run on $(P_1)$, and argue that the same $x$ $2\varepsilon-$approximates $(P_\alpha)$ by bounding the duality gap $G_{\alpha}(x, y(x))$, although we will need to use a different set of inequalities since now $\alpha > 1$. Similar to the proof of Lemma \ref{lemma:alpha-close-to-1-below}, as $x$ is (primal-)feasible for $(P_1)$, $x$ and $y(x)$ are primal- and dual-feasible for $(P_\alpha)$.
By the same token as in the proof of Lemma \ref{lemma:alpha-close-to-1-below}:
\begin{align*}
\sum_{i=1}^m y_i (x) \leq (1+3\varepsilon)(1+2\gamma)\sum_{j=1}^n w_j.
\end{align*}
As $\alpha > 1$ and $x_j \in (0, 1]$, $\forall j$, we have that ${x_j}^{1-\alpha}\geq 1$, $\forall j$, and therefore:
\begin{align}\label{eq:alpha-above-1-bnd-1}
\sum_{i=1}^m y_i (x) \leq (1+3\varepsilon)(1+2\gamma)\sum_{j=1}^n w_j {x_j}^{1-\alpha} \leq (1+4\varepsilon)\sum_{j=1}^n w_j {x_j}^{1-\alpha}.
\end{align}
Therefore, we can write for the duality gap:
\begin{align}
G_{\alpha}(x, y(x))&\leq \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(\alpha\Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\Big)^{\frac{\alpha-1}{\alpha}}-1 + (1-\alpha)(1+4\varepsilon)\right)\\
&= -\sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(-\alpha\Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\Big)^{\frac{\alpha-1}{\alpha}} + 1 + (\alpha-1)(1+4\varepsilon)\right)
\label{eq:alpha-above-1-duality-gap}.
\end{align}
Notice that, as $\alpha >1$, the objective for $(P_\alpha)$, $\sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha}$, is now negative.
Using the same arguments as in the proof of Lemma \ref{lemma:alpha-close-to-1-below}, it is straightforward to show that ${x_j}^{\alpha-1}\geq 1-\gamma$, $\forall j$. From Lemma \ref{lemma:cond-lower-bound}, we have that $\frac{x_j\sum_{i}y_i(x)A_{ij}}{w_j}\geq (1-\gamma)^{\tau_0}$, $\forall j$, and therefore:
\begin{align}
\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i(x)A_{ij}}{w_j} &= \frac{{x_j}^{1-\alpha}\cdot x_j\sum_{i=1}^my_i(x)A_{ij}}{w_j}\notag\\
&\geq (1-\gamma)^{\tau_0 + 1}. \label{eq:alpha-above-1-bnd-2}
\end{align}
Recalling that $\alpha - 1 \leq 1/\tau_0$ (by the statement of the lemma) and using (\ref{eq:alpha-above-1-bnd-2}), we have:
\begin{align}
\Big(\frac{{x_j}^{\alpha}\sum_{i=1}^m y_i A_{ij}}{w_j}\Big)^{\frac{\alpha-1}{\alpha}} &\geq (1-\gamma)^{(\tau_0+1)/(\tau_0(1+1/\tau_0))}\notag\\
&=(1-\gamma). \label{eq:alpha-above-1-bnd-3}
\end{align}
Finally, plugging (\ref{eq:alpha-above-1-bnd-3}) into (\ref{eq:alpha-above-1-duality-gap}), we have:
\begin{align}
G_{\alpha}(x, y(x))&\leq -\sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(-\alpha(1-\gamma) + 1 + (\alpha-1)(1+4\varepsilon)\right)\notag \\
&= -\sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha} \left(\alpha\cdot\frac{1}{4}\varepsilon + 4\varepsilon(\alpha - 1)\right)\notag \\
&\leq -\varepsilon \sum_{j=1}^n w_j \frac{{x_j}^{1-\alpha}}{1-\alpha},
\end{align}
where the equality follows from $\gamma = \frac{\varepsilon}{4}$, and the last inequality follows from $\alpha - 1 \leq \frac{1}{\tau_0} < \frac{\varepsilon}{20}$.
\end{proof}
\fi
Finally, we consider the asymptotics of $\alpha-$fair allocations, as $\alpha$ becomes large. This result complements the result from \cite{MoWalrand2000} that states that $\alpha-$fair allocations approach the max-min fair one as $\alpha\rightarrow \infty$ by showing how fast the max-min fair allocation is reached as a function of $\alpha, R_w, n$, and $A_{\max}$. First, for completeness, we provide the definition of max-min fairness.
\begin{definition}(Max-min fairness \cite{Bertsekas:1987:DN:12517}.) \label{def:max-min-fairness}
Let $\mathcal{R}\subset \mathbb{R}_+^n$ be a compact and convex set. A vector $x\in \mathcal{R}$ is max-min fair on $\mathcal{R}$ if for any vector $z\in \mathcal{R}$ it holds that: if for some $j\in\{1,...,n\}$ $z_j > x_j$, then there exists $k\in\{1,...,n\}$ such that $z_k < x_k$ and $x_k \leq x_j$.
\end{definition}
On a compact and convex set $\mathcal{R}\subset \mathbb{R}^n$, the max-min fair vector is unique (see, e.g., \cite{Sarkar-Tassiulas, radunovic2007unified}). The following lemma shows that for $\alpha \geq \varepsilon^{-1}\ln(R_w n A_{\max})$, the $\alpha-$fair vector and the max-min fair vector are $\varepsilon-$close to each other. Notice that because of a very large gradient of $p_\alpha(x)$ as $\alpha$ becomes large, the max-min fair solution provides only an $O(\varepsilon\alpha)-$approximation to $(P_\alpha)$.
\begin{lemma}\label{lemma:mmf-alpha-fair}
Let $x^*$ be the optimal solution to $(P_\alpha) = \max\{p_\alpha(x): Ax\leq 1, x\geq 0\}$, $z^*$ be the max-min fair solution for the convex and compact set determined by the constraints from $(P_\alpha)$. Then if $\alpha \geq {\varepsilon}^{-1} \ln\left(R_w n A_{\max}\right)$, we have that:
\begin{enumerate}
\item $p_\alpha(x^*) \leq (1-{\varepsilon}(\alpha - 1))p_\alpha(z^*)$, i.e., $z^*$ is an ${\varepsilon}(\alpha-1)-$approximate solution to $(P_\alpha)$, and
\item $(1-\varepsilon)z_j^* \leq x_j^* \leq (1+\varepsilon)z_j^*$, for all $j \in \{1,...,n\}$.
\end{enumerate}
\end{lemma}
\iffullpaper
\begin{proof}
Suppose that, starting with $z^*$, we want to construct a solution $z$ that is feasible in $(P_\alpha)$ and is such that $p_\alpha(z) > p_\alpha(z^*)$. Then we need to increase at least one coordinate $j$ of $z^*$. Suppose that we increase a coordinate $j$ by a factor $1+\varepsilon$, so that $z_j = (1+\varepsilon)z_j^*$. Since $z^*$ is the max-min fair vector, to keep $z$ feasible, the increase over the $j^{\text{th}}$ coordinate must be at the expense of decreasing some other coordinates $k$ that satisfy $z_k^* \leq z_j^*$. We will assume that whenever we decrease the coordinates to keep the solution feasible, we keep the solution Pareto optimal (i.e., we decrease the selected coordinates by a minimum amount).
Using Fact \ref{fact:taylor}, we have:
\begin{align}
p_\alpha(z) - p_\alpha(z^*) &\leq \sum_{l=1}^n w_l\frac{z_l - z_l^*}{(z_l^*)^{\alpha}}< w_j\frac{z_j - z_j^*}{(z_j^*)^{\alpha}} = {\varepsilon}\cdot w_j(z_j^*)^{1-\alpha}. \label{eq:mmf-part-1}
\end{align}
Now, suppose that we want to further increase the $j^{\text{th}}$ coordinate by some small $\delta$. Call that new solution $z^1$. Then, the total amount by which other coordinates must decrease to keep the solution feasible is at least $\frac{\delta}{A_{\max}}$, since the feasible region is determined by packing constraints and it must be $Az\leq 1$, where $1\leq A_{ij}\leq A_{\max}$, $\forall i, j$. Moreover, since $z^*$ is max-min fair, each coordinate $k$ that gets decreased must satisfy $z_k^* \leq z_j^*$. It follows that:
\begin{align}
p(z^1) - p(z)&\leq \sum_{l=1}^n w_l\frac{z_l^1 - z_l}{(z_l)^{\alpha}}\notag\\
&= w_j \frac{\delta}{(1+\varepsilon)^{\alpha}(z_j^*)^{\alpha}} + \sum_{k: z_k^1 < z_k} w_k\frac{z_k^1 - z_k}{(z_k)^{\alpha}}\notag\\
&\leq w_{\max} \frac{\delta}{(1+\varepsilon)^{\alpha}(z_j^*)^{\alpha}} - w_{\min} \frac{\delta/A_{\max}}{(z_j^*)^{\alpha}}\notag\\
&= \frac{\delta(w_{\max} - (1+\varepsilon)^{\alpha}w_{\min}/A_{\max})}{(1+\varepsilon)^{\alpha}(z_j^*)^{\alpha}}\notag\\
&\leq 0. \label{eq:mmf-part-2}
\end{align}
The last inequality can be verified by solving the inequality $w_{\max} - (1+\varepsilon)^{\alpha}w_{\min}/A_{\max}\leq 0$ for $\alpha$, and verifying that it is implied by the initial assumption that $\alpha \geq \varepsilon^{-1}\ln(R_w n A_{\max})$.
Therefore, the maximum amount by which any coordinate of $z^*$ can be increased to improve the value of the objective $p_\alpha(.)$ is by a multiplicative factor of at most $(1+\varepsilon)$. Since we can construct $x^*$, the optimal solution to $(P_\alpha)$, starting with $z^*$ and by choosing a set of coordinates $j$ that we want to increase and by only decreasing coordinates $k$ such that $z_k^* \leq z_j^*$ whenever coordinate $j$ is increased, it follows that $x_j^* \leq (1+\varepsilon)z_j^*$, $\forall j$.
Moreover, from (\ref{eq:mmf-part-1}) and (\ref{eq:mmf-part-2}):
\begin{align*}
p_\alpha(z^1) - p_\alpha(z^*) = p(z^1) - p(z) + p(z) - p(z^*) < {\varepsilon}\cdot w_j(z_j^*)^{1-\alpha},
\end{align*}
and we can conclude that:
\begin{align*}
p_\alpha(x^*) - p_\alpha(z^*) < \sum_{j=1}^n {\varepsilon}\cdot w_j(z_j^*)^{1-\alpha} = {\varepsilon}(1-\alpha)\cdot p_\alpha(z^*),
\end{align*}
which means that $z^*$ is an ${\varepsilon}(\alpha-1)-$approximate solution to $(P_\alpha)$.
Now consider the coordinates we need to decrease when we construct a solution $z$ from $z^*$, such that $p_\alpha(z) > p_\alpha(z^*)$. Suppose that to increase some other coordinates, a coordinate $k$ is decreased by a factor $(1-\varepsilon)$: $z_k = (1-\varepsilon)z_k^*$. As $z^*$ is max-min fair, only coordinates larger than $z_k^*$ can increase at the expense of decreasing $z_k^*$. Suppose now that we decrease the $k^{\text{th}}$ coordinate further by some small $\delta$. Call that solution $z^1$. Then the maximum number of other coordinates $j$ that can further increase is $\min\{n-1, m\}< n$. Moreover, each coordinate $j$ that gets increased satisfies $z_j^*\geq z_k^*$, and can be increased by at most $A_{\max} \delta$. Using Fact \ref{fact:taylor}, it follows that:
\begin{align}
p_\alpha(z^1) - p_\alpha(z) &\leq \sum_{l=1}^n w_l\frac{z_l^1 - z_l}{(z_l)^{\alpha}}\notag\\
&= -w_k \frac{\delta}{(1-\varepsilon)(z_k^*)^{\alpha}} + \sum_{j: z_j^1 > z_j} w_j \frac{z_j^1-z_j}{(z_j^*)^{\alpha}}\notag\\
&< -w_{\min} \frac{\delta}{(1-\varepsilon)(z_k^*)^{\alpha}} + n w_{\max} \frac{A_{\max}\delta}{(z_k^*)^{\alpha}}\notag\\
&= \frac{\delta(n w_{\max} A_{\max} (1-\varepsilon)^{\alpha} - w_{\min})}{(z_k^*)^{\alpha}}\notag\\
&\leq 0, \label{eq:mmf-part-5}
\end{align}
where the last inequality follows from $(1-\varepsilon)^{\alpha} \leq (R_w n A_{\max})^{-1}$, which is implied by the initial assumption that $\alpha \geq {\varepsilon}^{-1}{\ln(R_w n A_{\max})}$.
Therefore, using (\ref{eq:mmf-part-5}), the $k^{\text{th}}$ coordinate can decrease by at most a multiplicative factor $(1-\varepsilon)$. Using similar arguments as for increasing the coordinates, it follows that $x_j^* \geq (1-\varepsilon)z_j^*$, $\forall j$.
\end{proof}
\fi
\section{Conclusion}\label{section:conclusion}
We presented an efficient stateless distributed algorithm for the class of $\alpha$-fair packing problems. To the best of our knowledge, this is the
first algorithm with poly-logarithmic convergence time in the input size.~{Additionally, we obtained results that characterize the fairness and asymptotic behavior of allocations in weighted $\alpha-$fair packing problems that may be of independent interest.}~{An interesting} open problem is to determine the class of objective functions for which the presented techniques yield fast and stateless distributed algorithms, together with a unified convergence analysis. This problem is especially important in light of the fact that $\alpha$-fair objectives are not Lipschitz continuous, do not have a Lipschitz gradient, and their dual gradient's Lipschitz constant scales at least linearly with $n$ and $A_{\max}$. Therefore, the properties typically used in fast first-order methods are lacking \cite{nesterov2004introductory, zhuOrecchia2014novel}. {Finally, for applications of $\alpha$-fair packing that do not require uncoordinated updates, it seems plausible that the dependence on $\varepsilon^{-1}$ in the convergence bound can be improved from $\varepsilon^{-5}$ to $\varepsilon^{-3}$ by relaxing the requirement for asynchronous updates, similarly as was done in \cite{d-allen2014using} over \cite{AwerbuchKhandekar2009}.}
\iffullpaper
\section*{Acknowledgements}
We thank Nikhil Devanur for pointing out the equivalence of the $\alpha$-fair packing for $\alpha = 1$ and the problem of finding an equilibrium allocation in Eisenberg-Gale markets with Leontief utilities.
\fi
\newpage
\bibliographystyle{abbrv}
{\small
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 4,472 |
Kvadrivium (lat. quadrivium, čtyřcestí) na středověkých univerzitách byla druhá, vyšší, část sedmi svobodných umění. Skládalo se ze čtyř předmětů nebo umění: aritmetiky, geometrie, hudby a astronomie.
Následovalo po předchozím zvládnutí oborů trivia, totiž gramatiky, dialektiky (či logiky, význam těchto slov byl v té době stejný) a rétoriky. Kvadrivium bylo naopak považováno za předstupeň vlastního odborného studia filozofie – pokládané za svobodné umění ve vlastním smyslu – nebo teologie, práv či lékařství. Na některých středověkých univerzitách kvadrivium vedlo k získání titulu bakaláře, na fakultách vyšší úrovně pak mohl student získat titul magister (celým názvem mistr svobodných umění, Magister artium).
Předmět hudba v kvadriviu znamenal klasický předmět harmonie, bylo to vlastně studium proporcí mezi hudebními intervaly. Vztah k hudbě v dnešním smyslu nebyl součástí studia.
Složení kvadrivia je naznačeno už u Platóna, v sedmé knize Ústavy; Proklos napsal, že tyto předměty lze pokládat za studium čísel a jejich vztahu k fyzickému rozměru času: aritmetika je čisté číslo, geometrie je číslo v prostoru, hudba číslo v čase a astronomie číslo v časoprostoru. Pojem kvadrivia však poprvé použil Boëthius.
Odkazy
Literatura
Ottův slovník naučný, heslo Artes liberales. Sv. 2, str. 809
Filosofický slovník. Olomouc: FIN 1998. Heslo Quadrivium, str. 340..
Související články
Trivium
Sedm svobodných umění
Magistr
Externí odkazy
Quadrivium na New International Encyclopaedia
Vzdělávání
Středověk
Vysoké školy
Kulturní seznamy
Sedm svobodných umění | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,977 |
Thomas Sackville, 1. Earl of Dorset (* 1536 in Worthing, Sussex; † 19. April 1608 in London) war ein englischer Staatsmann, Dramatiker und Dichter in der Renaissance.
Leben
Sackville war der Sohn des Unterhausabgeordneten Sir Richard Sackville († 1566) aus dessen Ehe mit Winifred Brydges († 1586), die 1568 in zweiter Ehe John Paulet, 2. Marquess of Winchester, heiratete. Väterlicherseits war er ein Enkel des Unterhausabgeordneten John Sackville und ein Neffe zweiten Grades der in seinem Geburtsjahr hingerichteten Queen Consort Anne Boleyn.
Er wurde an den Universitäten von Oxford und Cambridge ausgebildet, ließ sich 1553 in London nieder und wurde 1555 am Inner Temple als Barrister zugelassen. 1558 wurde er als Abgeordneter für das County Westmorland, 1559 für das Borough East Grinstead und 1563 für das Borough Aylesbury ins Unterhaus des Parlaments gewählt. 1567 wurde er zum Knight Bachelor geschlagen. Unter Königin Elisabeth I. reiste er als englischer Botschafter von 1571 bis 1572 sowie erneut 1591 nach Frankreich und 1586 in die Niederlande. Neben anderen Ämtern besetzte er auch den Posten eines Bevollmächtigten für Staatsprozesse, und er war es, der der schottischen Königin Maria I. Stuart das Todesurteil verkündete. 1599 wurde er Lord High Treasurer. Seine bedeutendsten Werke schrieb er in den 50er Jahren des 16. Jahrhunderts. Die wichtigsten sind davon die Sammlung "A mirror for magistrates" und die Tragödie "Gorboduc". Die Tragödie, das früheste englische Drama in Blankversen, wurde zusammen mit Thomas Norton verfasst und 1562 vor der englischen Königin, Elisabeth I., uraufgeführt. Seine Herrenhäuser, Knole House in Kent und Michelham Priory, sind in England sehr bekannt.
Am 8. Juni 1567 war er als Baron Buckhurst, of Buckhurst in the County of Sussex, zum erblichen Peer erhoben und ins Oberhaus des Parlamentes aufgenommen worden. 1589 wurde er als Knight Companion in den Hosenbandorden aufgenommen. Am 13. März 1604 wurde ihm zudem der erbliche Titel Earl of Dorset verliehen.
Seit 1555 war er mit Cecily Baker, Tochter des Sir John Baker, verheiratet. Mit ihr hatte er sechs Kinder. Bei seinem Tod erbte sein ältester überlebender Sohn Robert Sackville seine Adelstitel.
Einzelnachweise
Literatur
Alan Davidson: Sackville, Thomas (1535/36–1608), of London. In: Stanley Thomas Bindoff (Hrsg.): The History of Parliament. The House of Commons 1509–1558. Secker & Warburg, London 1982 (Online).
P. W. Hasler: Sackville, Thomas (1535/6–1608), of Buckhurst, nr. East Grinstead, Suss. and Sackville House (later Dorset House), Fleet Street, London. In: P.W. Hasler (Hrsg.): The History of Parliament. The House of Commons 1558–1603. HMSO, London 1981, ISBN 0-11-887501-9 (Online).
Ilan Rachum: Enzyklopädie der Renaissance. Atlantis-Verlag 1991, ISBN 978-3-7611-0725-6.
Weblinks
Earl of Dorset
Baron Buckhurst
Lord High Treasurer (England)
Abgeordneter des House of Commons (England)
Mitglied des House of Lords
Politiker (16. Jahrhundert)
Englischer Diplomat
Autor
Dramatiker der englischen Renaissance
Ritter des Hosenbandordens
Knight Bachelor
Engländer
Geboren 1536
Gestorben 1608
Mann | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 9,764 |
\section{Introduction}
The deformed differential calculus \cite{wes/zum3,wor} plays an important
role in physical applications \cite{are/vol1,mue-hoi}. In this connection
the light-cone approach attracts the special interest, because it is
employed for the description of massless particles, null-strings and
null-membranes \cite{gre/sch/wit}.The usual formalism of the bicovariant
differential calculi \cite{fad/pya,are/aru/med} and right (left) invariant
differential calculi \cite{aku/ger} are not applicable on the light-cone due
to vanishing of the corresponding quantum determinant. That is the reason
why the Maurer-Cartan forms cannot be defined here at all, and therefore it
is not possible to build the deformed differential calculus on the
light-cone in the standard way.
From general mathematical viewpoint some objects under consideration
belong to the class of
quantum semigroups \cite{dem} which consist of the standard quantum groups
and ideals (for abstract semigroup theory see \cite{cli/pre1} and for
application to supersymmetry see \cite{dup6,dup14}).
Here we construct a version of $q$-deformed differential calculus on the
light-cone which is mostly close to the standard one \cite{zup1,vak/kor}. We
therefore hope that the obtained calculus can be directly used in physical
applications.
\section{``Short'' differential calculus}
Let us remind the deformed differential calculi on the quantum plane $%
E_q\left( 2\right) $ \cite{wes/zum3}
\begin{equation}
xy=qyx. \label{q}
\end{equation}
In the standard case we have two solutions for $E_q\left( 2\right) $
a)
\begin{equation}
\left\{
\begin{array}{lll}
\delta xx & = & q^2x\delta x, \\
\delta xy & = & qy\delta x+\left( q^2-1\right) x\delta y, \\
\delta yx & = & qx\delta y, \\
\delta yy & = & q^{-2}y\delta y;
\end{array}
\right. \label{a}
\end{equation}
b)
\begin{equation}
\left\{
\begin{array}{lll}
\delta xx & = & q^2x\delta x, \\
\delta xy & = & q^{-1}y\delta x, \\
\delta yx & = & q^{-1}x\delta y+\left( q^{-2}-1\right) y\delta x, \\
\delta yy & = & q^{-2}y\delta y.
\end{array}
\right. \label{b}
\end{equation}
It is well-known \cite{fad/res/tak} that there exists the automorphism of
the quantum plane (\ref{q})
\begin{equation}
\left(
\begin{array}{c}
x\rightarrow y \\
y\rightarrow x \\
q\rightarrow q^{-1}
\end{array}
\right) \label{auto}
\end{equation}
which is stipulated by the following property of the $R$-matrix
\begin{equation}
R_q\rightarrow R_{q^{-1}}^{-1}. \label{r}
\end{equation}
If we introduce the evolution parameter \cite{are/vol1} and consider the
dynamics on $E_{q}\left( 2\right) $ where (\ref{a}) are commutation
relations between momentum and coordinate, then we come to very complicated
and inappropriate conditions for the phase space. The reason lays in the
second term of the second formula in (\ref{a}). Such undesirable terms (so
called ``long'' solutions) result in difficulties while deriving and
exploiting of self-consistent Poisson bracket.
In search of ``short'' solutions we found the following ones on $E_q\left(
2\right) $ additionally to (\ref{a}) and (\ref{b})
\begin{equation}
\left\{
\begin{array}{lll}
\delta xx & = & x\delta x, \\
\delta xy & = & qy\delta x, \\
\delta yx & = & q^{-1}x\delta y, \\
\delta yy & = & y\delta y.
\end{array}
\right. \label{c}
\end{equation}
In formulas (\ref{a}), (\ref{b}) and (\ref{c}) $\delta $ is the standard
exterior differential satisfying the classical Leibniz rule, lemma Poincare
and having the properties $\delta x\delta y=-q\delta y\delta x,\;\left(
\delta x\right) ^{2}=0,\;\left( \delta y\right) ^{2}=0$.
In contrast to the ``long'' solutions (\ref{a}) and (\ref{b}) which are
transformed one to another by the automorphism (\ref{auto}), the ``short''
solution (\ref{c}) is its fixed point.
\section{The $q$-deformed light-cone}
Let us consider $q$-deformed null-vector in 4-dimensional Minkowski space
which is described by the following $\left( 2\times 2\right) $ $q$-matrix
\begin{equation}
X=\left(
\begin{array}{cc}
x^{1\stackrel{.}{1}} & x^{1\stackrel{.}{2}} \\
x^{2\stackrel{.}{1}} & x^{2\stackrel{.}{2}}
\end{array}
\right) . \label{x}
\end{equation}
We define the $q$-deformed light-cone as
\begin{equation}
{\rm det}_{q^2}X=x^{1\stackrel{.}{1}}x^{2\stackrel{.}{2}}-q^2x^{1\stackrel{.%
}{2}}x^{2\stackrel{.}{1}}=0. \label{det}
\end{equation}
Due to multiplicativity of the quantum determinant the Lorentz
transformations (represented by $SL_q\left( 2,C\right) $ matrices) do not
change the light-cone condition (\ref{det}).
The $q$-deformed components have the following commutation relations
\begin{equation}
\left\{
\begin{array}{lll}
x^{1\stackrel{.}{1}}x^{1\stackrel{.}{2}} & = & q^2x^{1\stackrel{.}{2}}x^{1%
\stackrel{.}{1}}, \\
x^{1\stackrel{.}{1}}x^{2\stackrel{.}{1}} & = & q^2x^{2\stackrel{.}{1}}x^{1%
\stackrel{.}{1}}, \\
x^{1\stackrel{.}{2}}x^{2\stackrel{.}{1}} & = & x^{2\stackrel{.}{1}}x^{1%
\stackrel{.}{2}}, \\
x^{1\stackrel{.}{2}}x^{2\stackrel{.}{2}} & = & q^2x^{2\stackrel{.}{2}}x^{1%
\stackrel{.}{2}}, \\
x^{2\stackrel{.}{1}}x^{2\stackrel{.}{2}} & = & q^2x^{2\stackrel{.}{2}}x^{2%
\stackrel{.}{1}}, \\
x^{1\stackrel{.}{1}}x^{2\stackrel{.}{2}}-x^{2\stackrel{.}{2}}x^{1\stackrel{.%
}{1}} & = & \left( q^2-q^{-2}\right) x^{1\stackrel{.}{2}}x^{2\stackrel{.}{1}%
}.
\end{array}
\right. \label{xx}
\end{equation}
As usual \cite{cartan,pen2} a null vector has a twistor representation. In $q
$-deformed case we introduce the twistors having $q$-deformed components
\begin{equation}
\varphi _{q}=\left( \varphi _{q}^{A}\right) =\left(
\begin{array}{c}
x \\
y
\end{array}
\right) ,\;A=1,2 \label{f}
\end{equation}
where $x$ and $y$ satisfy (\ref{q}).
The $q$-deformed Levi-Chivita tensor is
\begin{equation}
\epsilon _q=\left( \epsilon _q^{AB}\right) =\left(
\begin{array}{cc}
0 & q^{1/2} \\
-q^{-1/2} & 0
\end{array}
\right) \label{e}
\end{equation}
and has the property
\begin{equation}
\epsilon _q^{AB}\epsilon _{q,BA}=q+q^{-1}. \label{eq}
\end{equation}
The $q$-antisymmetry of $\epsilon _q$ leads to
\[
\varphi _q^A\varphi _q^B\epsilon _{q,AB}=\varphi _q^A\varphi _{q,A}=0.
\]
The complex conjugated $q$-deformed twistor is
\[
\overline{\varphi }_q=\left( \overline{\varphi }_q^{\stackrel{.}{A}}\right)
=\left( \overline{x},\overline{y}\right) .
\]
We define here the involution $x\rightarrow \bar{x}$ as the standard
Hermitian conjugation.
The $q$-null-vector in terms of $q$-twistor components has the standard form
\begin{equation}
X^{A\stackrel{.}{A}}=\varphi _q^A\overline{\varphi }_q^{\stackrel{.}{A}%
}=\left(
\begin{array}{cc}
x\overline{x} & x\overline{y} \\
y\overline{x} & y\overline{y}
\end{array}
\right) . \label{xxy}
\end{equation}
The light-cone condition (\ref{det}) in terms of $q$-twistor components is
\begin{equation}
{\rm det}_{q^2}X=x\overline{x}y\overline{y}-q^2x\overline{y}y\overline{x}=0.
\label{xxyy}
\end{equation}
So we have two copies of the quantum plane $\left( x,y\right) $ and $\left(
\bar{x},\bar{y}\right) $. Now we need such commutation relations between
components of the $q$-twistor and its conjugate which satisfy (\ref{xx}) and
the standard involution.
From (\ref{q}) and its conjugate we easily obtain the condition
\begin{equation}
\bar{q}=q^{-1}=\exp \left( -ih\right) \label{qe}
\end{equation}
or $\left| q\right| =1$.
Let other commutation relations have the general form
\begin{equation}
\left\{
\begin{array}{ccc}
x\overline{x} & = & q^n\bar{x}x, \\
x\bar{y} & = & q^m\bar{y}x, \\
y\bar{x} & = & q^k\bar{x}y, \\
y\bar{y} & = & q^l\bar{y}y,
\end{array}
\right. \label{xxqxx}
\end{equation}
where $n,m,k,l$ are arbitrary constants which should be determined from (\ref
{xx}) and involution. So we have the following independent equations
\[
\left\{
\begin{array}{ccc}
m-n & = & 1, \\
n-k & = & 1, \\
l-k & = & 1.
\end{array}
\right.
\]
Then
\begin{equation}
\left\{
\begin{array}{ccc}
x\overline{x} & = & q^n\bar{x}x, \\
x\bar{y} & = & q^{n+1}\bar{y}x, \\
y\bar{x} & = & q^{n-1}\bar{x}y, \\
y\bar{y} & = & q^n\bar{y}y.
\end{array}
\right. \label{xyqn}
\end{equation}
Now we consider the reality condition, as the consequence of the possibility
to reduce the dimension of $q$-deformed null-vector up to three where it is
real. So we derive $n=0$, and the commutation relations between twistor
components become
\begin{equation}
\left\{
\begin{array}{lll}
xy & = & qyx, \\
x\overline{y} & = & q\overline{y}x, \\
\overline{x}y & = & qy\overline{x}, \\
\overline{x}\overline{y} & = & q\overline{y}\overline{x}, \\
\overline{x}x & = & x\overline{x}, \\
\overline{y}y & = & y\overline{y}.
\end{array}
\right. \label{xy}
\end{equation}
Then we can find the ``short'' version of $q$-deformed differential calculus
on twistor components
\begin{equation}
\left\{
\begin{array}{lll}
\delta xx & = & x\delta x, \\
\delta x\bar{x} & = & \bar{x}\delta x, \\
\delta xy & = & qy\delta x, \\
\delta x\bar{y} & = & q\bar{y}\delta x,
\end{array}
\right. \;\left\{
\begin{array}{lll}
\delta \bar{x}x & = & x\delta \bar{x}, \\
\delta \bar{x}\bar{x} & = & \bar{x}\delta \bar{x}, \\
\delta \bar{x}y & = & qy\delta \bar{x}, \\
\delta \bar{x}\bar{y} & = & q\bar{y}\delta \bar{x},
\end{array}
\right. \label{dxy1}
\end{equation}
\begin{equation}
\left\{
\begin{array}{lll}
\delta yx & = & q^{-1}x\delta y, \\
\delta y\bar{x} & = & q^{-1}\bar{x}\delta y, \\
\delta yy & = & y\delta y, \\
\delta y\bar{y} & = & \bar{y}\delta y,
\end{array}
\right. \;\left\{
\begin{array}{lll}
\delta \bar{y}x & = & q^{-1}x\delta \bar{y}, \\
\delta \bar{y}\bar{x} & = & q^{-1}\bar{x}\delta \bar{y}, \\
\delta \bar{y}y & = & y\delta \bar{y}, \\
\delta \bar{y}\bar{y} & = & \bar{y}\delta \bar{y},
\end{array}
\right. \label{dxy2}
\end{equation}
where $\left( \delta x\right) ^2=\left( \delta \bar{x}\right) ^2=\left(
\delta y\right) ^2=\left( \delta \bar{y}\right) ^2=0$.
The commutation relations between the differentials themselves take the form
\begin{equation}
\left\{
\begin{array}{lll}
\delta x\delta \bar{x} & = & -\delta \bar{x}\delta x, \\
\delta x\delta y & = & -q\delta y\delta x, \\
\delta x\delta \bar{y} & = & -q\delta \bar{y}\delta x, \\
\delta y\delta x & = & -q^{-1}\delta x\delta y, \\
\delta y\delta \bar{x} & = & -q^{-1}\delta \bar{x}\delta y, \\
\delta y\delta \bar{y} & = & -\delta \bar{y}\delta y.
\end{array}
\right. \label{dxdy}
\end{equation}
Using the obtained $q$-deformed differential calculus on $q$-twistors we can
build $q$-deformed differential calculus on any composite objects, as $q$%
-deformed null-vectors and tensors.
So for $q$-deformed null-vector we obtain
\begin{equation}
\left\{
\begin{array}{lll}
\delta x^{1\stackrel{.}{1}}x^{1\stackrel{.}{1}} & = & x^{1\stackrel{.}{1}%
}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{1}}x^{1\stackrel{.}{2}} & = & q^2x^{1\stackrel{.}{2}%
}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{1}}x^{2\stackrel{.}{1}} & = & q^2x^{2\stackrel{.}{1}%
}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{1}}x^{2\stackrel{.}{2}} & = & q^4x^{2\stackrel{.}{2}%
}\delta x^{1\stackrel{.}{1}},
\end{array}
\right. \;\left\{
\begin{array}{lll}
\delta x^{1\stackrel{.}{2}}x^{1\stackrel{.}{2}} & = & x^{1\stackrel{.}{2}%
}\delta x^{1\stackrel{.}{2}}, \\
\delta x^{1\stackrel{.}{2}}x^{2\stackrel{.}{1}} & = & x^{2\stackrel{.}{1}%
}\delta x^{1\stackrel{.}{2}}, \\
\delta x^{1\stackrel{.}{2}}x^{1\stackrel{.}{1}} & = & q^{-2}x^{1\stackrel{.}{%
1}}\delta x^{1\stackrel{.}{2}}, \\
\delta x^{1\stackrel{.}{2}}x^{2\stackrel{.}{2}} & = & q^2x^{2\stackrel{.}{2}%
}\delta x^{1\stackrel{.}{2}},
\end{array}
\right. \label{dxx1}
\end{equation}
\begin{equation}
\left\{
\begin{array}{lll}
\delta x^{2\stackrel{.}{1}}x^{2\stackrel{.}{1}} & = & x^{2\stackrel{.}{1}%
}\delta x^{2\stackrel{.}{1}}, \\
\delta x^{2\stackrel{.}{1}}x^{1\stackrel{.}{1}} & = & q^{-2}x^{1\stackrel{.}{%
1}}\delta x^{2\stackrel{.}{1}}, \\
\delta x^{2\stackrel{.}{1}}x^{1\stackrel{.}{2}} & = & x^{1\stackrel{.}{2}%
}\delta x^{2\stackrel{.}{1}}, \\
\delta x^{2\stackrel{.}{1}}x^{2\stackrel{.}{2}} & = & q^2x^{2\stackrel{.}{2}%
}\delta x^{2\stackrel{.}{1}},
\end{array}
\right. \;\left\{
\begin{array}{lll}
\delta x^{2\stackrel{.}{2}}x^{2\stackrel{.}{2}} & = & x^{2\stackrel{.}{2}%
}\delta x^{2\stackrel{.}{2}}, \\
\delta x^{2\stackrel{.}{2}}x^{1\stackrel{.}{1}} & = & q^{-4}x^{1\stackrel{.}{%
1}}\delta x^{2\stackrel{.}{2}}, \\
\delta x^{2\stackrel{.}{2}}x^{1\stackrel{.}{2}} & = & q^{-2}x^{1\stackrel{.}{%
2}}\delta x^{2\stackrel{.}{2}}, \\
\delta x^{2\stackrel{.}{2}}x^{2\stackrel{.}{1}} & = & q^{-2}x^{2\stackrel{.}{%
1}}\delta x^{2\stackrel{.}{2}},
\end{array}
\right. \label{dxx2}
\end{equation}
and
\begin{equation}
\begin{array}{ccc}
\delta x^{1\stackrel{.}{1}}\delta x^{1\stackrel{.}{2}} & = & -q^2\delta x^{1%
\stackrel{.}{2}}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{1}}\delta x^{2\stackrel{.}{1}} & = & -q^2\delta x^{2%
\stackrel{.}{1}}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{1}}\delta x^{2\stackrel{.}{2}} & = & -q^4\delta x^{2%
\stackrel{.}{2}}\delta x^{1\stackrel{.}{1}}, \\
\delta x^{1\stackrel{.}{2}}\delta x^{2\stackrel{.}{1}} & = & -\delta x^{2%
\stackrel{.}{1}}\delta x^{1\stackrel{.}{2}}, \\
\delta x^{1\stackrel{.}{2}}\delta x^{2\stackrel{.}{2}} & = & -q^2\delta x^{2%
\stackrel{.}{2}}\delta x^{1\stackrel{.}{2}}, \\
\delta x^{2\stackrel{.}{1}}\delta x^{2\stackrel{.}{2}} & = & -q^2\delta x^{2%
\stackrel{.}{2}}\delta x^{2\stackrel{.}{1}}.
\end{array}
\label{qdxdy}
\end{equation}
From the above formulas we can find the commutation relations for
coordinates and derivatives
\begin{equation}
\left\{
\begin{array}{ccc}
\frac \partial {\partial x^{1\stackrel{.}{1}}}x^{1\stackrel{.}{1}} & = &
1+x^{1\stackrel{.}{1}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{1}}}x^{1\stackrel{.}{2}} & = &
q^{-2}x^{1\stackrel{.}{2}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{1}}}x^{2\stackrel{.}{1}} & = &
q^{-2}x^{2\stackrel{.}{1}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{1}}}x^{2\stackrel{.}{2}} & = &
q^{-4}x^{2\stackrel{.}{2}}\frac \partial {\partial x^{1\stackrel{.}{1}}},
\end{array}
\right. \;\left\{
\begin{array}{ccc}
\frac \partial {\partial x^{1\stackrel{.}{2}}}x^{1\stackrel{.}{1}} & = &
q^2x^{1\stackrel{.}{1}}\frac \partial {\partial x^{1\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{2}}}x^{1\stackrel{.}{2}} & = &
1+x^{1\stackrel{.}{2}}\frac \partial {\partial x^{1\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{2}}}x^{2\stackrel{.}{1}} & = & x^{2%
\stackrel{.}{1}}\frac \partial {\partial x^{1\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{1\stackrel{.}{2}}}x^{2\stackrel{.}{1}} & = &
q^{-2}x^{2\stackrel{.}{1}}\frac \partial {\partial x^{1\stackrel{.}{2}}},
\end{array}
\right. \label{ddx1}
\end{equation}
\begin{equation}
\left\{
\begin{array}{ccc}
\frac \partial {\partial x^{2\stackrel{.}{1}}}x^{1\stackrel{.}{1}} & = &
q^2x^{1\stackrel{.}{1}}\frac \partial {\partial x^{2\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{1}}}x^{2\stackrel{.}{1}} & = &
1+x^{2\stackrel{.}{1}}\frac \partial {\partial x^{2\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{1}}}x^{1\stackrel{.}{2}} & = & x^{1%
\stackrel{.}{2}}\frac \partial {\partial x^{2\stackrel{.}{1}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{1}}}x^{2\stackrel{.}{2}} & = &
q^{-2}x^{2\stackrel{.}{2}}\frac \partial {\partial x^{2\stackrel{.}{1}}},
\end{array}
\right. \;\left\{
\begin{array}{ccc}
\frac \partial {\partial x^{2\stackrel{.}{2}}}x^{1\stackrel{.}{1}} & = &
q^4x^{1\stackrel{.}{1}}\frac \partial {\partial x^{2\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{2}}}x^{1\stackrel{.}{2}} & = &
q^2x^{1\stackrel{.}{2}}\frac \partial {\partial x^{2\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{2}}}x^{2\stackrel{.}{1}} & = &
q^2x^{2\stackrel{.}{1}}\frac \partial {\partial x^{2\stackrel{.}{2}}}, \\
\frac \partial {\partial x^{2\stackrel{.}{2}}}x^{2\stackrel{.}{2}} & = &
1+x^{2\stackrel{.}{2}}\frac \partial {\partial x^{2\stackrel{.}{2}}}
\end{array}
\right. \label{ddx2}
\end{equation}
and between the derivatives
\begin{equation}
\begin{array}{ccc}
\frac \partial {\partial x^{1\stackrel{.}{1}}}\frac \partial {\partial x^{1%
\stackrel{.}{2}}} & = & q^2\frac \partial {\partial x^{1\stackrel{.}{2}%
}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
& & \\
\frac \partial {\partial x^{1\stackrel{.}{1}}}\frac \partial {\partial x^{2%
\stackrel{.}{1}}} & = & q^2\frac \partial {\partial x^{2\stackrel{.}{1}%
}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
& & \\
\frac \partial {\partial x^{1\stackrel{.}{1}}}\frac \partial {\partial x^{2%
\stackrel{.}{2}}} & = & q^4\frac \partial {\partial x^{2\stackrel{.}{2}%
}}\frac \partial {\partial x^{1\stackrel{.}{1}}}, \\
& & \\
\frac \partial {\partial x^{1\stackrel{.}{2}}}\frac \partial {\partial x^{2%
\stackrel{.}{1}}} & = & \frac \partial {\partial x^{2\stackrel{.}{1}}}\frac
\partial {\partial x^{1\stackrel{.}{2}}}, \\
& & \\
\frac \partial {\partial x^{1\stackrel{.}{2}}}\frac \partial {\partial x^{2%
\stackrel{.}{2}}} & = & q^2\frac \partial {\partial x^{2\stackrel{.}{2}%
}}\frac \partial {\partial x^{1\stackrel{.}{2}}}, \\
& & \\
\frac \partial {\partial x^{2\stackrel{.}{1}}}\frac \partial {\partial x^{2%
\stackrel{.}{2}}} & = & q^2\frac \partial {\partial x^{2\stackrel{.}{2}%
}}\frac \partial {\partial x^{2\stackrel{.}{1}}}.
\end{array}
\label{qqdxdx}
\end{equation}
By analogy we can write the commutation relation between $q$-deformed
differentials and derivatives.
The above relations are consistent with the following condition
\begin{equation}
\delta \left( {\rm det}_{q^2}X\right) =0. \label{ddet}
\end{equation}
\section{Momenta and $q$-D'Alembertian}
Let us introduce $q$-matrix for momenta
\begin{equation}
P_q=\left(
\begin{array}{cc}
P_{1\stackrel{.}{1}} & P_{1\stackrel{.}{2}} \\
P_{2\stackrel{.}{1}} & P_{2\stackrel{.}{2}}
\end{array}
\right) =\left(
\begin{array}{cc}
-i\frac \partial {\partial x^{1\stackrel{.}{1}}} & -i\frac \partial
{\partial x^{1\stackrel{.}{2}}} \\
& \\
-i\frac \partial {\partial x^{2\stackrel{.}{1}}} & -i\frac \partial
{\partial x^{2\stackrel{.}{2}}}
\end{array}
\right) \label{pq}
\end{equation}
with commutation relations determined by (\ref{qqdxdx}).
The $q$-D'Alembertian is defined by
\begin{equation}
\Box _{q^2}=-{\rm det}_{q^2}P_q=\frac \partial {\partial x^{1\stackrel{.}{1}%
}}\frac \partial {\partial x^{2\stackrel{.}{2}}}-q^2\frac \partial {\partial
x^{1\stackrel{.}{2}}}\frac \partial {\partial x^{2\stackrel{.}{1}}}.
\label{pdet}
\end{equation}
The light-cone condition (\ref{det}) leads to the similar condition for
momenta
\begin{equation}
\Box _{q^2}=0. \label{dal0}
\end{equation}
In the classical limit $q=\exp \left( ih\right) \rightarrow 1$ we decompose
the $q$-D'Alembertian as follows
\begin{eqnarray}
\Box _{q^{2}} &=&\Box -\left( q^{2}-1\right) \frac{\partial }{\partial x^{1%
\stackrel{.}{2}}}\frac{\partial }{\partial x^{2\stackrel{.}{1}}} \nonumber
\\
&=&\Box -2ihP_{1\stackrel{.}{2}}P_{2\stackrel{.}{1}}=0, \label{dalclas}
\end{eqnarray}
where $\Box $ is the ordinary D'Alembertian.
The second term in (\ref{dalclas}) gives us a new way of the off-shell
approximation and is responsible for its exact shape. In contrast to the
standard picture \cite{azc/kul/rod} the momenta entering into the additional
off-shell term in (\ref{dalclas}) commute.
\section{Conclusion}
We have proposed a version of the differential calculus on $q$-deformed
light-cone which can be applied to description of the dynamics of the
massless quantum particles, $q$-deformed null-strings and null-membranes.
Using the obtained $q$-deformed differential calculus on $q$-twistors we
have the possibility to construct the corresponding calculi on $q$-tensors
of any rank.
\section*{Acknowledgments}
V. P. Akulov is grateful to A. P. Isaev, P. N. Pyatov and B. M. Zupnik for
discussions.
\newpage
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,844 |
\section*{\bf Introduction}
Let $G$ be a group acting on a probability space $(E, \cal B, \mu)$ by a measure preserving action $(g, x) \in G \times E \to T^g x \in E$.
A random walk $(Z_n)$ defined on a probability space $(\Omega, \PP)$ with values in the group $G$ induces a random walk on $E$.
For $f \in L^2(E, \cal B, \mu)$, we can consider the sums along the random walk: $\sum_{k= 0}^{n-1} f( T^{Z_k} x)$.
This general framework leads in practice to different situations and methods in the proof of a central limit theorem (CLT) and a functional central limit theorem (FCLT)
along the paths of the random walk. In particular the proof of the tightness for the FCLT requires specific tools which it seems interesting to present in examples.
A first situation is that of a random walk in random sceneries (cf. \cite{KeSp79}, \cite{Bo89}).
For $d \geq 1$, let $X = (X_\el)_{\el \in \Z^d}$ be a strictly $\Z^d$-stationary real random field (r.f.).
One can assume that the r.v.s $X_\el$ are defined on a probability space $(E, \cal B, \mu)$ on which commuting measure preserving maps $T_1, ..., T_d$ act in such a way
\footnote{Underlined letters represent elements of $\Z^d$ or $\T^d$. We write $\el$ for $(\ell_1, ..., \ell_d)$ and $T^\el$ for $T_1^{\ell_1}... T_d^{\ell_d}$.
The euclidean norm of $\el \in \Z^d$ is denoted by $|\el|$ or $\|\el\|$.}
that $X_\el = T^\el X_\0$.
Conversely, given commuting measure preserving invertible maps $T_1, ..., T_d$ and a measurable $f$ on a probability space $(E, \cal B, \mu)$,
$(T^\el f)_{\el \in \Z^d}$ is a strictly $\Z^d$-stationary random field.
If $(Z_n)$ is a random walk in the group $\Z^d$, then the sums along $Z_n$ read $\sum_{k= 0}^{n-1} X_{Z_k} = \sum_{k= 0}^{n-1} T^{Z_k}X_\0$,
or $\sum_{k= 0}^{n-1} T^{Z_k} f$.
When $(X_\el)$ is a $d$-dimensional random field of i.i.d. random variables, we obtain the classical random walk in random sceneries.
Another types of examples in the algebraic case can be obtained as follows.
Suppose that $G = \rm{SL}(\rho, \Z)$ and that $(E, \cal B, \mu)$ is the torus $\T^\rho$, $\rho \geq 2$, endowed with the Borel $\sigma$-algebra and the Lebesgue measure.
The map $x \to Ax$, where $A$ is a matrix in $\rm{SL}(\rho, \Z)$, defines an automorphism of $\T^\rho$ which preserves $\mu$.
When a spectral gap property is available for the transition operator associated to the random walk on $G$,
the previous sums for $f$ in a convenient class of observables satisfy a CLT (cf.\cite{AyLiSt09}, \cite{CoLe9}) for $\PP$-a.e. $\omega \in \Omega$.
The commutative case, which we will consider here, is different from the spectral point of view.
For the action of commuting matrices in $\rm{SL}(\rho, \Z)$ acting on $\T^\rho$, we prove for $\PP$-a.e. $\omega$ a functional CLT,
extending previous results in \cite{CohCo17}.
A second algebraic example comes from commuting flows on homogeneous spaces.
Based on the exponential mixing of all orders proved in \cite{BjEiGo17}, a CLT has been shown in \cite{BjGo20} for ergodic sums on {F\o{}lner sets
when the observables are smooth. Likewise we prove here a CLT and its functional version for the sums along a random walk.
The result, a functional CLT for the different models described above, is presented for a general aperiodic random walk in dimension $d > 1$
with a moment of order 2, but the detailed proofs are given in the case of a centered 2-dimensional r.w.
The proofs can be adapted easily to the case of transient random walks.
We say also some words in the i.i.d. case, when the usual random walk is replaced by a plane Lorentz process
generated by a periodic billiard with dispersive obstacles (cf. \cite{Pen09}, \cite{Pen14}).
Beyond the CLT, tightness is a main step in the proof of a FCLT.
To show it we use the method based on the maximal inequality for associated r.v.s due to Newman and Wright \cite{NeWr81}
or, in the algebraic case, the method based on norm estimates for the maximum of partial sums (cf. Billingsley \cite{Bi99}, M\'oricz \cite{Mo76}).
A difficulty which occurs is that the estimates available for the random walk involve constants depending on the trajectory.
The content of the paper is the following.
Section \ref{varGene1} contains results on the variance of sums along a random walk. The independent case is presented in Section \ref{indepSec}.
Some facts on cumulants are recalled in Section \ref{Sectcumulant}, then applied to moving averages in Section \ref{movAverag} and to the algebraic models
in Sections \ref{algMod1} and \ref{expMixSect}. For the tightness in the latter cases, we use the method of maximum of partial sums
in an adapted version presented in Section \ref{SectMoricz}.
The paper is an extension of a previous version. We have added the FCLT along a random walk for flows on homogeneous spaces,
using the recent results in \cite{BjEiGo17} and \cite {BjGo20} on the multiple mixing and on the CLT for group actions which are exponentially mixing of all orders.
We have also added some remarks about the non nullity of the variance, in particular, the observation that there is no degeneracy for the sums along a transient random walk.
\vskip 3mm
{\bf Acknowledgements.} This research started during visits of the first author to the IRMAR at the University of Rennes 1
and of the second author to the Center for Advanced Studies in Mathematics at Ben Gurion University.
The authors are grateful to their hosts for their support.
They thank Y. Guivarc'h and B. Bekka for helpful discussions.
\section{\bf Summation along a r.w. and variance} \label{varGene1}
\subsection{\bf Random walks and sums along random walks} \label{randWalk}
\
First we recall some definitions and results about the random walks on $\Z^d$ (see \cite{Sp64}, details on the results recalled here can also be found in \cite{CohCo17}).
Let $(\zeta_i)_{i \geq 0}$ be a sequence of i.i.d. random vectors on a probability space $(\Omega, \, \PP)$ with values in $\Z^d$ and common probability distribution $\nu$.
The associated {\it random walk} (r.w.) $Z = (Z_n)$ in $\Z^d$ starting from $\0$ is defined by $Z_0 := \0$, $Z_n := \zeta_0 +... + \zeta_{n-1}$, $n \geq 1$.
The r.v.s $\zeta_i$ can be viewed as the coordinate maps on $(\Omega, \, \PP)$ obtained as $(\Z^d)^\Z$ equipped with the product measure $\nu^{\otimes \Z}$
and with the shift $\theta$ acting on the coordinates.
We have $\zeta_i = \zeta_0 \circ \theta^i$ and the cocycle relation $Z_{n +n'} = Z_n + Z_{n'} \circ \theta^n, \forall n, n' \geq 0$.
Let denote by $\cal S := \{\el \in \Z^d: \PP(\zeta_0 = \el) > 0\}$ the support of $\nu$ and by $L$ the sub-lattice of $\Z^d$ generated by $\Cal S$.
Without loss of generality, we can assume that $Z$ is reduced which means that $L$ is cofinite in $\Z^d$.
Therefore the vector space generated by $L$ is $\R^d$ and $d$ is the `genuine' dimension of the random walk $Z$.
For simplicity, we will assume that $L = \Z^d$ (the random walk $Z$ is said to be {\it aperiodic}).
Observe that one can replace a reduced r.w. $Z$ by an aperiodic one, again without loss of generality.
Let $D$ be the sub-lattice of $\Z^d$ generated by $\{\el - \el', \el, \el' \in \cal S\}$.
We denote by $\Gamma_1$ the annulator in $\T^d$ of $D$, that is the closed subgroup of $ \T^d$ defined by
$\{\t \in \T^d: e^{2\pi i \langle \r, \t \rangle} = 1, \forall \r\ \in D \}$ and by $d\gamma_1$ the Haar probability measure of the group $\Gamma_1$.
The r.w. is said to be {\it strictly (or strongly) aperiodic}, if $D = \Z^d$.
\vskip 3mm
\goodbreak
{\bf Sums along random walks} \label{sumsAlong}
Given a strictly $\Z^d$-stationary random field $X = (X_\el)_ {\el \in \Z^d}$, where the real random variables $X_\el$ are defined on a probability space $(E, \cal B, \mu)$,
the process of `ergodic sums' along the random walk $(Z_n)$ is
\begin{eqnarray}
&&S_n^{\omega, X}(x) = S_n^{\omega}(x) :=\sum_{k=0}^{n-1} X_{Z_k(\omega)}(x), \, n \geq 1, \, \omega \in \Omega. \label{defsumRW}
\end{eqnarray}
If the random field is represented as $X_\el = T^\el f$, where $T_1, ..., T_d$ are commuting measure preserving maps and $f \in L^2(E, \cal B, \mu)$, the sums read:
\begin{eqnarray}
S_n^\omega f = \sum_{k=0}^{n-1} T^{Z_k(\omega)} \, f = \sum_{\el \in \Z^d} w_n(\omega, \el) \, T^{\el} \, f, \label{defwn0}
\end{eqnarray}
where $w_n(\omega, \el)$ (denoted also by $w_n^\omega(\el)$) is the local time of the random walk at time $n \geq 1$:
\begin{eqnarray}
w_n(\omega, \el) &=& \#\{k < n: Z_k(\omega) = \el\} = \sum_{k=0}^{n-1} 1_{Z_k(\omega) =\el}. \label{loctim}
\end{eqnarray}
Summing along the random walk amounts to take the ergodic sums for the skew product
$(\omega, x) \to T_{\zeta_0}(\omega, x) = (\theta \omega, T^{\zeta_0(\omega)} x)$ on $\Omega \times E$. Putting
$F_f(\omega, x) = F(\omega, x) = f(x)$ for an observable $f$ on $E$, we get that the ergodic sums of $F$ for $T_{\zeta_0}$ read:
\begin{eqnarray}
S_n F (\omega, x) = \sum_{k=0}^{n-1} F(T_{\zeta_0}^k \, (\omega, x)) = \sum_{k=0}^{n-1} f(T^{Z_k(\omega)} x) = (S_n^\omega f)(x). \label{ergSum1}
\end{eqnarray}
A limit theorem in distribution for the sums $S_n^\omega f$ (with respect to the measure $\mu$ on $E$) obtained for $\PP$-a.e. $\omega$
is sometimes called {\it quenched}. We will use this terminology
\footnote{We follow here the terminology of \cite{AyLiSt09} used in several papers.
The term `quenched' is also used in the random scenery when a limit theorem is shown for the distribution with respect to $\omega$, conditionally to the scenery $X$.}.
If the random variables $S_n F (\omega, x)$ are viewed as defined on $\Omega \times E$ endowed with the probability $\PP \times \mu$,
a limit theorem under $\PP \times \mu$ for theses sums is called {\it annealed}.
\vskip 2mm
\subsection{\bf Variance for quenched processes} \label{varRWSect1}
\
Let $f$ be a function in $L^2(E, \cal B, \mu)$ with real values. Everywhere we assume (or prove) the absolute summability of the series of decorrelations
\begin{eqnarray}
\sum_{\el \in \Z^d} | \int_X T^\el f \, \overline f \, d\mu| < \infty, \label{sumcorr1}
\end{eqnarray}
which implies existence and continuity of the spectral density, the even function given by
\begin{eqnarray}
\varphi_f(\t) = \sum_{\el \in \Z^d} \langle T^\el f \, f \rangle \, e^{2\pi i \langle \el, \t \rangle}. \label{specdens1}
\end{eqnarray}
The computation of the variance $\int_E |\sum_{k=0}^{n-1} \, T^{Z_k(\omega)} f|^2 \, d\mu$, is related to the
number of self-intersections of the random walk at time $n \geq 1$:
\begin{eqnarray}
&&V_n(\omega) := \#\{0 \leq u, v < n: \ Z_u(\omega) = Z_v(\omega)\} = \sum_{\el \in \Z^2} w_n(\omega, \el)^2
=\int_{\T^d} |\sum_{\el \in \Z^d} w_n(\el) \, e^{2\pi i \langle \el, \t \rangle}|^2 \, d\t. \label{selfinter}
\end{eqnarray}
Let us consider the kernels (which are even functions)
\begin{eqnarray}
&&K(w_n^\omega)(\t) = |\sum_{k=0}^{n-1} e^{2\pi i \langle Z_k(\omega), \t \rangle} |^2 = |\sum_{\el \in \Z^d} w_n(\omega, \el)
e^{2\pi i \langle \el, t \rangle}|^2, \, \tilde K(w_n^\omega)(\t) = V_n(\omega)^{-1} K(w_n^\omega)(\t). \label{kernOmNorm}
\end{eqnarray}
We say that the summation along the r.w. $Z$ is $\xi$-{\it regular}, where $\xi$ is a probability measure on $\T^d$, if (for $\PP$-a.e. $\omega$)
the normalised kernel $(\tilde K(w_n^\omega))_{n \geq 1}$ converges weakly to $\xi$,
i.e., $\lim_{n \to \infty}\int_{\T^d} \tilde K(w_n^\omega) \,\varphi \, d\t = \xi(\varphi)$ for every continuous function $\varphi$ on $\T^d$.
This property is equivalent to (for $\PP$-a.e. $\omega$):
\begin{eqnarray}
\lim_{n \to \infty} \int \tilde K(w_n^\omega)(\t) \, e^{-2\pi i \langle \p, \t \rangle} \ d\t
= \lim_{n \to \infty} \int \tilde K(w_n^\omega)(\t) \, \cos (2\pi \langle \p, \t \rangle) \ d\t = \hat \xi (\p), \, \forall \p \in \Z^d. \label{coefF}
\end{eqnarray}
Another equivalent formulation is
\begin{eqnarray}
\lim_{n \to \infty} {V_{n}(\omega, \p) \over V_{n}(\omega)} &=& \hat \xi(\p), \, \forall \p \in \Z^d, \text{ for a.e. } \omega, \nonumber\\
\text{ with } V_{n}(\omega, \p) &:=& \#\{0 \leq u, v < n: \ Z_u(\omega) - Z_v(\omega) = \p\}, \, \p \in \Z^d. \label{vnp}
\end{eqnarray}
For $f$ satisfying (\ref{sumcorr1}), it implies that the (asymptotic) normalised variance is, for a.e. $\omega$,
\begin{eqnarray}
\sigma^2(f) := \lim_n {\|\sum_{\el \in \Z^d} w_n(\el, \omega) \, T^\el f\|_2^2 \over \sum_{\el \in \Z^d} |w_n(\el, \omega)|^2}
= \lim_n \int_{\T^d} \tilde K(w_n^\omega)(\t) \, \varphi_f(\t) \, d\t = \xi(\varphi_f). \label{asymptVar0}
\end{eqnarray}
It can be shown that every summation associated to a random walk in $\Z^d$ is $\xi$-regular for some measure $\xi$ (cf. \cite{CohCo17}).
We summarize below the results on the asymptotic variance (see \cite{CohCo17} for the proofs).
\subsubsection{\bf Recurrence/transience}
\
Recall that a r.w. $Z = (Z_n)$ is recurrent if and only if $\sum_{n=1}^\infty \PP(Z_n = \0) = + \infty$.
Let $m_1(Z):=\sum_{\el \in \Z^d} \, \PP(\zeta_0 = \el) \, \|\el\|$, $m_2(Z):=\sum_{\el \in \Z^d} \, \PP(\zeta_0 = \el) \, \|\el\|^2$.
For $d=1$, if $m_1(Z)<\infty$, then $Z$ is recurrent if and only if it is centered;
\hfill \break for $d=2$, if $m_2(Z)<\infty$, then $Z$ is recurrent if and only if it is centered;
\hfill \break for $d\ge3$, if $m_2(Z)<\infty$, then it is always transient.
We denote by $\Psi(\t) = \E [e^{2\pi i \langle \zeta_0, \t\rangle}], \ \t \in \T^d$, the characteristic function of the r.w. and put
\begin{eqnarray}
\Phi(\t) := {1 - |\Psi(\t)|^2 \over |1 - \Psi(\t)|^2}. \label{defWt}
\end{eqnarray}
\begin{rem} \label{nonnull} For $\t \not = \0$ in $\T^d$, $\Phi$ is well defined (since $Z$ is aperiodic), nonnegative and $\Phi(\t) = 0$ only on $\Gamma_1 \setminus \{\0\}$.
Hence it is positive for a.e. $\t$, except when the r.w. is `deterministic'
(i.e., if $\PP(\zeta_0 = \el) = 1$ for some $\el \in \Z^d$, so that $|\Psi(\t)| \equiv 1$ in this case).
\end{rem}
A r.w. of genuine dimension $d$ which is aperiodic is transient or recurrent depending on whether $\Re e ({1 \over 1- \Psi})$ is integrable or not
on the $d$-dimensional unit cube (\cite{Sp64}).
\goodbreak
{\bf Transient case}
In the transient case, one can show:
\begin{thm} \label{transrecSpec} (\cite{Sp64}) Let $Z =(Z_n)$ be a transient aperiodic random walk in $\Z^d$.
a) The function $\Phi$ is integrable on $\T^d$ and, with a nonnegative constant $K$, we have
\begin{eqnarray*}
&&I(\el) := 1_{\el= \0} + \sum_{k = 1}^{\infty} \, [\PP(Z_k = \el) + \PP(Z_k = - \el)] = \int_{\T^d} \cos (2\pi \langle \el, \t \rangle) \, \Phi(\t) \, d\t + K,
\forall \el \in \Z^d.
\end{eqnarray*}
$b_1$) Suppose $d = 1$. If $m_1(Z) = +\infty$, then $K =0$.
If $m_1(Z) < \infty$, then $Z$ is non centered (because it is transient) and $K = |\sum_{\ell \in \Z} \, \PP(X_0 = \ell) \, \ell|^{-1}$.
$b_2$) If $d > 1$, then $K = 0$.
c) Denoting by $d\xi(\t)$ the measure $\Phi(\t) d\t + K \delta_\0(\t)$, we have, for a.e. $\omega$,
\begin{eqnarray}
&&\int \frac1n K_n^\omega(\t) \cos (2\pi \langle \el, \t\rangle) \, d\t = 1_{\el= \0} +
\frac1n \, \sum_{k = 1}^{n-1} \, \sum_{j = 0}^{n-k-1} [1_{Z_k (\theta^j \omega) = \el} + 1_{Z_k (\theta^j \omega) = - \el}] \nonumber \\
&& \underset{n \to \infty} \to I(\el) = \int \cos (2\pi \langle \el, \t\rangle) \, d\xi(\t). \label{convFour}
\end{eqnarray}
\end{thm}
It follows that the summation along a transient r.w. behaves for the normalisation like the iteration of a single transformation, is $\xi$-regular (up to a constant factor) and that
\begin{eqnarray}
\lim_n \frac1n \, \|\sum_{k=0}^{n-1} T^{Z_k(\omega)} f\|_2^2 = \int \Phi(\t) \, \varphi_f(\t) \, d\t + K \varphi_f(\0). \label{VarTrans1}
\end{eqnarray}
From (\ref{convFour}) , (\ref{VarTrans1}) and the expression of $\varphi_f$, $\varphi_f(\t) = \sum_{\el \in \Z^d} \langle T^\el f, f\rangle \cos (2\pi \langle \el, \t\rangle)$,
we deduce:
\begin{eqnarray*}
&&\int \Phi(\t) \, \varphi_f(\t) \, d\t + K \varphi_f(\0) = \int \varphi_f(t) \, d\xi(\t) =
\sum_{\el \in \Z^d} \langle T^\el f, f\rangle \int \cos (2\pi \langle \el, \t\rangle) d\xi(\t)= \\
&&\sum_{\el \in \Z^d} I(\el) \, \langle T^\el f, f\rangle =
\|f\|_2^2 + 2 \sum_{k \geq 1} \bigl(\sum_{\el \in \Z^d} \PP(Z_k = \el) \, \langle T^\el f, f\rangle \bigr).
\end{eqnarray*}
\begin{rem} (about the variance in the non deterministic transient case)
Let $f$ be in $L^2(E, \mu)$ with real values and satisfying (\ref{sumcorr1}). By Remark \ref{nonnull}, the (quenched) asymptotic variance is $\not = 0$, if $f$ is not a.e. equal to 0.
Let $F_f(\omega, x) = F(\omega, x) = f(x)$.
For the map $T_{\zeta_0}$ acting on the product space $\Omega \times E$ endowed with the product measure $\PP \times \mu$, we have
$$\int T_{\zeta_0}^n F \, F d\mu \,d\PP = \sum_\el (\E 1_{Z_n = \el}) \, \langle T^\el f \, f \rangle = \sum_{\el \in \Z^d} \PP(Z_n = \el) \, \langle T^\el f, f\rangle, \, n \geq 0.$$
In the transient case it holds, for every $\el$, $\sum_{k \geq 1} \PP(Z_k = \el) \leq \sum_{k \geq 1} \PP(Z_k = \underline 0) < +\infty$.
Therefore the density of the spectral measure for $F_f$ and the map $T_{\zeta_0}$ is
$$\|f\|_2^2 + 2 \sum_{k \geq 1} \bigl(\sum_{\el \in \Z^d} \PP(Z_k = \el) \, \langle T^\el f, f\rangle \bigr) \, \cos 2\pi k t.$$
The asymptotic variance $\lim_n \frac1n \, \|\sum_{k=0}^{n-1} T_{\zeta_0}^k F_f\|_2^2$ for the annealed model is the same as for the quenched model and is equal to
$\displaystyle \|f\|_2^2 + 2 \sum_{k \geq 1} \bigl(\sum_{\el \in \Z^d} \PP(Z_k = \el) \, \langle T^\el f, f\rangle \bigr)$.
It follows that the function $F_f$ on $\Omega \times E$ (which depends only on the second coordinate),
with $f$ as above and non a.e. null, is never a coboundary in $L^2(\PP \times \mu)$ for $T_{\zeta_0}$,
because the asymptotic variance is non null. Observe also that $F_f$ even is not a measurable coboundary, at least when the CLT holds,
which is the case of the situations that we are going to considered here. This follows from the fact that, for a single measure preserving transformation,
if an observable is a coboundary in the space of measurable functions, then the limiting distribution of the ergodic sums after normalisation
by any sequence tending to infinity is the Dirac mass at 0, which is excluded here.
\end{rem}
\vskip 3mm
{\bf Recurrent case}
Let us consider now the case $d=2$ and a centered random walk $Z$ with a moment of order 2.
By the local limit theorem (LLT), $Z$ is recurrent.
A non standard normalization occurs in the CLT for sums along $Z_n$ as recalled below.
There are $C_0, C$ finite positive constants
\footnote{If the r.w. is strongly aperiodic, $C_0 = (\pi \sqrt{\det \Sigma})^{-1}$.}
such that (cf. \cite{Bo89} Lemma 2.6, \cite{Lew93} Proposition 1.4 for (\ref{BoundVar}) and (\ref{equivAn20}), \cite{CohCo17} Theorem 4.13 for (\ref{equivAn2})):
\begin{eqnarray}
&&\E(V_n) \sim C_0 n \ln n, \ \Var(V_n) \leq C n^2, \label{BoundVar}\\
&&\varphi_n(\omega) := {V_n(\omega) \over C_0 n \ln n} \to 1, \text{ for a.e. } \omega, \label{equivAn20} \\
&&\varphi_n(\omega, \p) := {V_n(\omega, \p) \over C_0 n \ln n} \to 1, \forall \p \in\Z^d, \text{ for a.e. } \omega. \label{equivAn2}
\end{eqnarray}
Therefore the summation along the r.w. $Z$ is $\delta_\0$-regular: the normalised kernel satisfies
$\lim_n \int \tilde K(w_n^\omega)(\t) \, e^{-2\pi i \langle \p, \t \rangle} \ d\t = 1, \, \forall \p \in \Z^d$ and the asymptotic variance is
\begin{eqnarray}
\sigma^2(f) = && \lim_n \, (C_0 n \ln n)^{-1} \|\sum_{k=0}^{n} T^{Z_k(\omega)} f\|_2^2 = \sum_{\k \in \Z^d} \langle T^\k f \, f \rangle = \varphi_f(\0). \label{omegaReg1}
\end{eqnarray}
The results presented below are valid for the cases covered above, hence excludes only the one-dimensional recurrent case.
We stress that, in the recurrent 2-dimensional case, the variance can be degenerate, while this does not occur in the transient case unless $f = 0$.
\subsubsection{\bf Number of self-intersections of a 2-dimensional centered r.w.} \label{selfInter}
\
In this subsection, we study more precisely the case $d=2$ and a centered random walk $(Z_n)$ with a moment of order 2.
If $I, J$ are intervals, the quantity $V(\omega, I, J, \p) :=$
\begin{eqnarray}
&&\int \bigl(\sum_{u \in I} e^{2\pi i \langle Z_u(\omega), \t\rangle}\bigr)
\, \bigl(\sum_{v \in J} \, e^{- 2\pi i \langle Z_v(\omega), \t \rangle}\bigr) \, e^{-2\pi i \langle \p, \t\rangle} \, d\t
\ = \#\{(u, v) \in I \times J: \, Z_u(\omega) - Z_v(\omega) = \p\} \label{cross1}
\end{eqnarray}
is non negative and increases when $I$ or $J$ increases for the inclusion order.
We write simply $V(\omega, I, \p)$ if $I=J$, $V(\omega, I)$ for $V(\omega, I, \0)$, $ V_n(\omega)$ and $V_n(\omega, \p)$ as above for $V(\omega, [0, n[)$
and $V(\omega, [0, n[, \p)$.
Observe that $V(\omega, J) = \sum_{\el \in \Z^2} w(\omega, J, \el)^2$, where $w(\omega, J, \el) = \sum_{i \in J} 1_{Z_i(\omega) = \el}$.
Notice also that $V(\omega, [b, b+k[) = V(\theta^b\omega, [0, k[) = V_k(\theta^b\omega)$, for $b \geq 0, k \geq 1$.
Let $A, B$ be in $[0, 1]$. For simplicity, in the formulas above and below, we write $nA$, $nB$ instead of $\lfloor nA \rfloor$ or $\lfloor nA \rfloor +1$,
$\lfloor nB \rfloor$, $\theta^t$ instead of $\theta^{\lfloor t \rfloor}$. The equalities are satisfied up to the addition of quantities which are bounded independently from $A, B, n$.
We have:
\begin{flalign*}
&V(\omega, [nA, nB], \p) = \int (\sum_{u \in [nA, nB]} e^{2\pi i \langle Z_u(\omega), \t\rangle})
\, (\sum_{v\in [nA, nB]} \, e^{- 2\pi i \langle Z_v(\omega), \t \rangle}) \, e^{-2\pi i \langle \p, \t\rangle} \, d\t& \\
&= \#\{u, v \in [0, n(B-A)]:\, \sum_{i=0}^{u-1} \zeta_0(\theta^{i+nA} \omega) - \sum_{i=0}^{v-1} \zeta_0(\theta^{i+nA} \omega) = \p\}
= V(\theta^{nA}\omega, [0, n(B-A)], \p).&
\end{flalign*}
By (\ref{equivAn20}) and (\ref{equivAn2}) there a set $\Omega_0$ of full probability such that
\begin{eqnarray}
&&V_n(\omega) \leq K(\omega) \, n \ln n, \, \forall n \geq 2, \text{ where the function } K \geq 0 \text{ is finite on } \Omega_0, \label{Komega}\\
&& \text{ for any fixed } A \in ]0, 1], \ V(\omega, [1, nA], \p) \sim C_0 n A \ln n, \text{ for } \omega \in \Omega_0. \label{equivAn}
\end{eqnarray}
By \cite[Lemma 2.5]{Bo89} we have
\begin{eqnarray}
\sup_{\el\in \Z^2} \, w_n(\omega, \el)=o(n^\varepsilon), \text{ for a.e. } \omega , \text{ for every } \varepsilon>0. \label{nVarep1}
\end{eqnarray}
For a simple r.w. on $\Z^2$, Erd\"os and Taylor (\cite{ErTa60}) have shown:
$\displaystyle \limsup_n \, \sup_{\el\in \Z^2} \, {w_n(\omega, \el) \over (\log n) ^2} \leq \frac1\pi$.
The result has been extended by Dembo, Peres, Rosen and Zeitouni who proved for an aperiodic centered random walk on $\Z^2$ with moments of all orders \cite{DPRZ01}:
\begin{eqnarray}
\lim_n \sup_{\el\in \Z^2} {w_n(\omega, \el) \over (\log n) ^2} = \frac1\pi. \label{DPRZbound}
\end{eqnarray}
We will need also to bound, for $\el_1, \el_2, \el_3 \in \Z^d$, $W_n(\omega, \el_1, \el_2, \el_3) :=$
\begin{equation}
\#\{1 \leq i_0, \, i_1, \, i_2, \, i_3 < n: \, Z_{i_1}(\omega) - Z_{i_0}(\omega) = \el_1,
Z_{i_2}(\omega) - Z_{i_0}(\omega)= \el_2, Z_{i_3}(\omega) - Z_{i_0}(\omega) = \el_3\}. \label{wn123}
\end{equation}
\begin{lem} \label{majwnm}
There exists a positive integrable function $C_3$ such that
\begin{eqnarray}
W_n(\omega, \el_1, \el_2, \el_3) \leq C_3(\omega) \, n \, (\ln n)^5, \, \forall n \geq 1. \label{majnumb3}
\end{eqnarray}
\end{lem}
\proof It suffices to bound the sum with strict inequality between indices
$$W_n'(\omega) = \sum_{1 \leq i_0 < i_1 < i_2 < i_3 \leq n} 1_{Z_{i_1} - Z_{i_0} = \, \el_1} . 1_{Z_{i_2} - Z_{i_1}= \, \el_2 - \el_1}.
1_{Z_{i_3} - Z_{i_2} = \, \el_3 - \el_2}.$$
Using independence and the local limit theorem for the random walk, we find the bound
\begin{eqnarray*}
\int W_n'(\omega) \, d\PP(\omega) \leq C_1 \sum_{i_0, i_1, i_2, i_3 \in [1, n]} (i_1 \, i_2 \, i_3)^{-1} \leq C_2 \, n \, (\ln n)^3.
\end{eqnarray*}
Therefore $\displaystyle \sum_{p=1}^\infty \int 2^{-p}(\ln(2^p))^{-5} \, W_{2^p}' \, d\PP < \infty$.
The function $C(\omega) := \sum_{p=1}^\infty 2^{-p}(\ln(2^p))^{-5} \, W_{2^p}'$ is integrable and we have:
$W_{2^p}'(\omega) \leq C(\omega) \, 2^p \, (\ln(2^p))^5, \, \forall p \geq 1$.
Let $p_n$ be such that: $2^{p_n-1} \leq n < 2^{p_n}$. Since $W_n'$ is increasing with $n$, we obtain:
$$W_{n}'(\omega) \leq W_{2^{p_n}}'(\omega) \leq C(\omega) \, 2^{p_n} \, (\ln (2^{p_n}))^5 \leq C(\omega) \, 2n \, (\ln (2n))^{5}
\leq C'(\omega) \, n (\ln n)^{5}. \eop$$
{\bf Variance for the finite dimensional distributions}
The following lemma will be applied to the successive return times of a point $\omega$ into a set under the iteration of the shift $\theta$.
\begin{lem} \label{mean0} Let $(y(j), j \geq 1)$ be a sequence with values in $\{0, 1\}$ such that $\lim_n \frac1n \sum_{j=1}^n y(j) = a > 0$.
If $(k_r)$ is the sequence of successive times such that $y(k_r) = 1$, then, for every $\delta >0$, there is $n(\delta)$ such that,
for $n \geq n(\delta)$, $k_{r+1} - k_r \leq \delta n$, for all $r \in [1, n]$.
\end{lem}
\Proof Since $r = \sum_{j=1}^{k_r} \, y(j)$, we have: $k_r / r = k_r / \sum_{j=1}^{k_r} \, y(j) \to a^{-1}$.
Hence, for every $\delta > 0$, there is $n_1(\delta)$ such that $0 < k_{r+1} - k_r \leq \delta r$, for $r \geq n_1(\delta)$.
Therefore, if $n \geq n_1(\delta)$, then $0 < k_{r+1} - k_r \leq \delta r \leq \delta n$, for $r \in [n_1(\delta), n]$.
If $n(\delta) \geq n_1(\delta)$ is such that $k_{r+1} - k_r \leq \delta n(\delta)$ for $r \leq n_1(\delta)$, we get the result of the lemma. \eop
\begin{lem} \label{mean1} Let $\Lambda$ be a measurable set in $\Omega$ of positive measure.
Let $k_r= k_r(\omega)$ be the successive times such that $\theta^{k_r} \omega \in \Lambda$.
For a.e. $\omega$, for every positive small enough $\delta$, there is $n(\delta)$ such that for $n \geq n(\delta)$
\hfill \break
1) $k_{r+1} - k_r \leq \delta n$, for all $r \in [1, n]$; moreover, $k_n \sim c n$, with $c= \PP(\Lambda)^{-1}$, when $n \to \infty$;
\hfill \break
2) there are integers $v < 2/\delta$ and $0 = \rho_1^{(n)} < \rho_2^{(n)} < ... < \rho_v^{(n)} \leq n < \rho_{v+1}^{(n)}$,
such that $\theta^{\rho_i^{(n)}} \omega \in \Lambda$ and $\frac12 \delta n \leq \rho_{i+1}^{(n)} - \rho_i^{(n)} \leq \frac32 \delta n$, for $i = 1, ..., v$.
\end{lem}
\Proof Since $\theta$ is ergodic on $(\Omega, \PP)$, Birkhoff ergodic theorem implies
$\lim_n \frac1n \sum_0^{n-1} 1_\Lambda (\theta^k \omega) = \PP(\Lambda) > 0$, for a.e. $\omega$ and $k_n / n \to \PP(\Lambda)^{-1}$.
Hence Lemma \ref{mean0} implies 1). For 2), we select in the sequence $(k_r)$ an increasing sequence of visit times to the set $\Lambda$ satisfying the prescribed conditions
by eliminating successive times which are at a distance $< \frac12 \delta n$. \eop
\vskip 2mm
{\it Asymptotic orthogonality of the cross terms}
\begin{proposition} \label{asympOrth} For $0 < A < B < C < D < 1$, $\p \in \Z$,
\begin{eqnarray}
&&\int \bigl[(\sum_{v = nA}^{nB} e^{2\pi i \langle Z_v(\omega), \u \rangle})
\, (\sum_{w = nC}^{nD} \, e^{- 2\pi i \langle Z_w(\omega), \u \rangle}) \, e^{-2\pi i \langle \p, \u \rangle} \bigr] \, d\u
=\varepsilon_n(\omega) \, n \log n, \text{ with } \varepsilon_n(\omega) \to 0. \label{orth1}
\end{eqnarray}
\end{proposition}
The above integral is the non negative self-intersection quantity: $V(\omega, [nA, nB], [nC, nD], \p)$. By (\ref{cross1}), $V(\omega, I, J, \p)$ increases when $I$ or $J$ increases.
Hence, it suffices to show (\ref{orth1}) for the intervals $[1, nA], [nA, n]$, for $0 < A < 1$. The proof below is based on (\ref{equivAn2}) and (\ref{equivAn}).
\begin{lem} \label{asympOrtho1} There is a set $\hat \Omega \subset \Omega$ such that $\PP(\hat \Omega) = 1$ and for all $\omega \in \hat \Omega$,
the following holds:
\begin{eqnarray}
&&\lim_n \varphi_{n B}(\theta^{n A}\omega, \, \p) = \lim_n {V(\omega, [nA, n], \p) \over C_0 \, n B \ln n} = 1, \text{ for } A\in ]0,1[, B = 1 - A; \label{lowup0} \\
&&V(\omega, [1, nA], [nA, n], \p) + V(\omega,[nA, n], [1, nA], \p) =\varepsilon_n(\omega) \, n \log n, \text{ with } \varepsilon_n(\omega) \to 0. \label{orth2}
\end{eqnarray}
\end{lem}
\proof {\it 1) The set $\hat \Omega$.}
For every $L \geq 1$ and $\delta > 0$, let $\Lambda(L, \delta):= \{\omega: \varphi_n(\omega, \, \p) - 1 \in [-\delta, \delta], \forall n \geq L\}$.
We have $\lim_{L \uparrow \infty} \PP(\Lambda(L, \delta)) = 1$. There is $L(\delta)$ such that $\PP(\Lambda(L(\delta), \delta)) \geq \frac12$.
Let $(\delta_j)$ be a sequence tending to 0. We apply Lemma \ref{mean1} to $\Lambda(L(\delta_j), \delta_j)$ for each $j$.
By taking the intersection of the corresponding sets, we get a set of $\omega$'s of full $\PP$-measure. The set $\hat \Omega$ is the intersection of this set
with the set $\Omega_0$ (of full measure) for which the law of large numbers holds for $(V_n(\omega))$. Let $\omega \in \hat \Omega$.
{\it 2) Proof of (\ref{lowup0})}.
We have $V(\omega, [nA, n[, \p) = V(\theta^{nA} \omega, [0, n(1-A)[, \p)$ and
\begin{eqnarray}
&&V(\omega, [1, n], \p) - V(\omega, [1, nA[, \p) - V(\omega, [nA, n], \p) \nonumber \\
&& = V(\omega, [1, nA[, [nA, n[, \p) + V(\omega,[nA, n], [1, nA[, \p) \geq 0. \label{differ1}
\end{eqnarray}
Claim: for an absolute constant $C_1$ depending on $A$ and $\p$, for every $\delta$, for $n$ big enough,
\begin{eqnarray}
\varphi_{n B}(\theta^{n A}\omega, \, \p) = {V(\omega, [nA, n], \p) \over C_0 \, n (1 - A) \ln n} \in [1 - C_1 \delta, 1 + C_1 \delta]. \label{lowup1}
\end{eqnarray}
{\it Upper bound:} The law of large numbers for $V_n(\omega, \p)$ implies, with $|\varepsilon_n|, |\varepsilon_n'| \leq \delta$ for $n$ big enough,
$$C_0^{-1} \, V(\omega, [1, n], \p) = (1 + \varepsilon_n) \, n \ln n, \ C_0^{-1} \, V(\omega, [1, nA], \p) = (1 + \varepsilon_n') \, nA \ln n.$$
With $B= 1 - A$, this implies by (\ref{differ1})
\begin{eqnarray*}
{V(\omega, [nA, n], \p) \over C_0 \, nB \ln n} \leq {(1+ \varepsilon_n) \, n \ln n - (1+ \varepsilon_n') \, n A \ln n \over nB \ln n}
\leq 1 + {|\varepsilon_n| \over B} + {|\varepsilon_n'| A \over B} \leq 1+ {1 + A \over B} \delta.
\end{eqnarray*}
{\it Lower bound:} We apply Lemma \ref{mean1} to $\Lambda(L(\delta), \delta)$.
Let $n_A, n_A'$ be two consecutive visit times $\leq n$ such that $n_A \leq n A < n_A'$.
For $n$ big enough, we have $0 < n_A' - n_A \leq \delta n$ and
$$n_A = n A \, (1 - \rho_n), \ n_A' = n A \, (1 + \rho_n'), \text { with } 0 \leq A \rho_n, A \rho_n' \leq \delta.$$
Since $\omega \in \hat \Omega$, we have for $n$ big enough, with $|\delta_n'| \leq \delta$,
\begin{eqnarray*}
&C_0^{-1} \, V(\omega, [n'_{A}, n], \p) \geq (1-\delta_n') (n - n_A') \,\ln(n- n_A') = (1-\delta_n') (nB -nA \rho_n') \,\ln(nB -nA \rho_n') .
\end{eqnarray*}
It follows, for $\delta$ (hence $\rho_n'$) small:
\begin{flalign*}
&{V(\omega, [n_A', n], \p) \over C_0\, (1-\delta_n') \, n B \ln (n B)} \geq {(nB -nA \rho_n') \,\ln(nB -nA \rho_n') \over n B \ln (n B)}
= {(B -A \rho_n') \, [\ln(nB) + \ln (1 - \frac AB \rho_n')] \over B \ln (n B)}& \\
&\geq (1- \frac AB \rho_n') - 2 (1- \frac AB \rho_n')\frac{\frac AB \rho_n'}{\ln(nB)}
\geq 1- \frac AB \rho_n'- 2 \frac{\frac AB \rho_n'}{\ln(nB)} \geq 1-B^{-1}\delta (1 + \frac{2}{\ln(nB)}).&
\end{flalign*}
As $V(\omega, J, \, \p)$ increases when the set $J$ increases, we have by the choice of $n_A$ and $n_A'$:
$$V(\omega, [n_A', n], \p) \leq V(\omega, [nA, n], \p).$$
Therefore, for $n$ such that $\ln (nB) \geq 2$, we have
$${V(\omega, [nA, n], \p) \over C_0 \, n B \ln (n B)} \geq (1-\delta) \, (1- {2 \over B}\delta) \geq 1 - \delta (1 + {2 \over B}).$$
This shows the lower bound. Altogether with the upper bound, this proves the claim (\ref{lowup1}).
{\it 3) Proof of (\ref{orth2}).} Let $\delta > 0$. According to (\ref{differ1}) and (\ref{lowup1}), for $n$ big enough, we have with $|\varepsilon_n''| \leq C_1 \delta$:
\begin{flalign*}
&V(\omega, [1, nA], [nA, n], \p) + V(\omega,[nA, n], [1, nA], \p) = V(\omega, [1, n], \p) - V(\omega, [1, nA], \p) - V(\omega, [nA, n], \p) &\\
&= C_0[ (1 + \varepsilon_n) \, n \ln n - (1 + \varepsilon_n') \, n A \ln n - (1 + \varepsilon_n'') \, n(1-A) \ln n \leq (2 + C_1) \, C_0 \, \delta \, n \ln n. \eop&
\end{flalign*}
Let $a_1, ..., a_s$ be real numbers and $0 = t_0 < t_1 < ... < t_{s-1} < t_s = 1$ a subdivision of $[0, 1]$.
For the asymptotic variance of $\sum_{j= 0}^s \, a_j \sum_{k=nt_{j-1} }^{nt_j} T^{Z_k(\omega)} f$, which is used later, we need the following lemma.
Recall that $f$ has a continuous spectral density $\varphi_f$.
\begin{lem} \label{VarrwLem1} For a.e. $\omega$ and for every partition $(t_j)$, we have
\begin{eqnarray}
(C_0 n \ln n)^{-1} \|\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} T^{Z_k(\omega)} f\|_2^2
\to \varphi_f(\underline 0)\sum_{j=1}^s a_j^2(t_j-t_{j-1}). \label{VarMulti1}
\end{eqnarray}
\end{lem}
\proof 1) Recall that proving (\ref{VarMulti1}) amounts to prove
$$(C_0 n \ln n)^{-1} \int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, \varphi_f(\u) \, d\u
\to \varphi_f(\underline 0)\sum_{j=1}^s a_j^2(t_j-t_{j-1}).$$
1) First suppose that $\varphi_f$ is a trigonometric polynomial $\rho$, which allows to use (\ref{orth1}) for a finite set of characters $e^{-2\pi i \langle \p, \u \rangle}$.
Using (\ref{omegaReg1}) for the asymptotic variance starting from 0, we have
$(C_0 n \ln n)^{-1} \|\sum_{k=0}^{\lfloor tn \rfloor} T^{Z_k(\omega)} f\|_2^2 \to t \rho(\0)$, for $t \in ]0, 1[$.
By Lemma \ref{asympOrtho1},
\begin{eqnarray*}
&&(C_0 n \ln n)^{-1} \|\sum_{k=\lfloor s n \rfloor}^{\lfloor t n \rfloor} T^{Z_k(\omega)} f\|_2^2 \to (t-s) \, \rho(\0), \text{ for } 0 < s < t < 1.
\end{eqnarray*}
Expanding the square and using that the cross terms are asymptotically negligible, we have
\begin{eqnarray*}
&&(C_0 n \ln n)^{-1} \int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, \rho(\u) \, d\u \\
&& \sim \ (C_0 n \ln n)^{-1} \bigl(\sum_{j=1}^s a_j^2 \, \int |\sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, \rho(\u) \, d\u \bigr)
\to \rho(\0) \sum_{j=1}^s a_j^2(t_j-t_{j-1}).
\end{eqnarray*}
This shows (\ref{VarMulti1}) for trigonometric polynomials.
2) For a general continuous spectral density $\varphi_f$, for $\varepsilon >0$,
let $\rho$ be a trigonometric polynomial, such that $\|\varphi_f - \rho\|_\infty < \varepsilon$. Remark that
$$\int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, d\u
\leq \sum_{j, j'= 1}^s \,a_j a_{j'} \, V(\omega, [nt_{j-1}, nt_j], [nt_{j'-1}, nt_{j'}], \0) \leq (\sum_{j= 1}^s \,|a_j|)^2 \, V_n(\omega).$$
Therefore we have:
\begin{eqnarray*}
&&\bigl|(C_0 n \ln n)^{-1} \int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, \varphi_f(\u) \, d\u
- \varphi_f(\0) \sum_{j=1}^s a_j^2(t_j-t_{j-1})\bigr|\\
&&\leq \bigl|(C_0 n \ln n)^{-1} \int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, \rho(\u) \, d\u
- \rho(\0) \sum_{j=1}^s a_j^2(t_j-t_{j-1})\bigr| \\
&&+ \varepsilon \, [(C_0 n \ln n)^{-1} \int |\sum_{j= 1}^s \, a_j \sum_{k=nt_{j-1}}^{nt_j} e^{2\pi i \langle Z_k(\omega) , \u \rangle}|^2 \, d\u
+ \sum_{j=1}^s a_j^2(t_j-t_{j-1})].
\end{eqnarray*}
By the remark, the above quantity inside $[\ ]$ is less than $(\sum_{j= 1}^s \,|a_j|)^2 \, (C_0 n \ln n)^{-1} V_n(\omega) + \sum_{j=1}^s a_j^2(t_j-t_{j-1})$,
which is bounded uniformly with respect to $n$. Therefore we can conclude for a general continuous spectral density by step 1).\eop
\begin{rems} \label{general_0} 1) In Lemma \ref{mean1}, the dynamical system $(\Omega, \theta, \PP)$ can be replaced by any ergodic dynamical system.
2) If the spectral density is constant (i.e., when the $X_\k$'s are pairwise orthogonal), (\ref{orth1}) and (\ref{VarMulti1}) are a consequence of
the law of large numbers for the number of self-intersections, that is ${V_n(\omega) \over C_0 n \ln n} \to 1$.
The law of large numbers for $V_n(\omega, \p)$, $\p \not = \0$, is not needed.
\end{rems}
3) A result analogous to Proposition \ref{asympOrth} is valid if the r.w. $Z$ is transient: for $0 < A < B < C < D < 1$, $\p \in \Z$,
\begin{eqnarray}
&&\int \bigl[(\sum_{v = nA}^{nB} e^{2\pi i \langle Z_v(\omega), \u \rangle})
\, (\sum_{w = nC}^{nD} \, e^{- 2\pi i \langle Z_w(\omega), \u \rangle}) \, e^{-2\pi i \langle \p, \u \rangle} \bigr] \, d\u
=\varepsilon_n(\omega) \, n, \text{ with } \varepsilon_n(\omega) \to 0. \label{orthtrans}
\end{eqnarray}
4) The quenched FCLT shown in the different examples below is valid for a set of $\omega$'s of $\PP$-measure 1 given by the results of
this Section \ref{varGene1}. This set does not depend on the $\Z^d$-dynamical systems considered in the further sections.
The joint distribution on $\Omega \times E$ is used only when the annealed model is mentionned, like for Bolthausen's result recalled in Section \ref{indepSec}.
\subsubsection{\bf Formulation of the quenched FCLT}
\
Let $(Y_n(t), t \in [0, 1])$ be a process on $(E, \mu)$ with values in the space $C[0, 1)$ of real valued continuous functions on $[0,1]$ or in the space $D[0, 1]$
of right continuous real valued functions on $[0,1]$ with left limits, endowed with the uniform norm.
Let $(W(t), t \in [0, 1])$ be the Wiener process on $[0, 1]$. To show a functional limit theorem (FCLT) for $(Y_n(t), t \in [0, 1])$,
i.e., weak convergence to the Wiener process, it suffices to prove the two following properties (where ``$\Longrightarrow$'' denotes the convergence in distribution):
{\it 1) Convergence of the finite dimensional distributions:}
$$\forall \, 0=t_0 < t_1 <... < t_r =1, \ (Y_{n}(t_1), ..., Y_{n}(t_r)) \underset {n \to \infty} \Longrightarrow (W_{t_1}, ..., W_{t_r}),$$
a property which follows (by the Cram\'er-Wold device) from
\begin{eqnarray}
&\sum_{j=1}^r a_j (Y_n(t_j) - Y_n(t_{j-1})) \Longrightarrow {\Cal N}(0, \sum_{j = 1}^r a_j^2 (t_j - t_{j-1})), \, \forall (a_j)_ {1 \leq j \leq r} \in \R. \label{Cramer0}
\end{eqnarray}
{\it 2) Tightness of the process.} The condition of tightness reads:
\begin{eqnarray}
&&\forall \varepsilon > 0, \ \lim_{ \delta \to 0^+} \limsup_n \mu(x \in E: \, \sup_{|t'-t| \leq \delta}|Y_n(\omega, x, t') - Y_n(\omega, x, t)| \geq \varepsilon) = 0. \label{tight0}
\end{eqnarray}
Let $(Z_n)$ be a random walk on $(\Omega, \PP)$ with values in $\Z^d$, $d \geq 1$, and let $X = (X_\el(x))_{\el \in \Z^d} = (T^\el f(x))_{\el \in \Z^d}$
be a $d$-dimensional random field defined on a probability space $(E, \cal B, \mu)$.
A quenched FCLT is satisfied by the sums along $Z_n$ if, for $\PP$-a.e. $\omega$, the functional central limit theorem holds for the process (cf. Notation (\ref{defsumRW}))
\begin{eqnarray}
(Y_n(\omega, x, t))_{t \in [0, 1]} := \bigl({S_{[n t]}^{\omega, X}(x) \over \sqrt{C_0 n \log n}}\bigr)_{t \in [0, 1]}. \label{defYn0}
\end{eqnarray}
\section{\bf Random walk in random scenery} \label{indepSec}
We consider in this section $d= 2$ and the random walk in random scenery $S_{n}^{\omega, X}(x)$,
that is the process $(Y_n)$ defined by (\ref{defYn0}) when $X$ is a 2-dimensional random field of i.i.d. real variables with $\E(X_0^2) = 1$
and mean 0 on a probability space $(E, \cal B, \mu)$.
It was shown by E. Bolthausen \cite{Bo89} that this process satisfies an annealed FCLT:
with respect to the probability $\PP \times \mu$, the law of $Y_n$ converges weakly to the Wiener measure.
We show a quenched FCLT for the r.f. $X$ (and when $X$ is a r.f. of moving averages of i.i.d. random variables in Section \ref{movAverag}).
As for the annealed FCLT in \cite{Bo89} and for Theorem 2.2 in \cite{DeUt11} for a 1-dimensional stable r.w., the proof of Theorem \ref{FCLTind1}
below is based on the maximal inequality shown by Newman and Wright \cite{NeWr81} for associated r.v.s.
\begin{definition} {\rm (\cf \cite{EPW})
Recall that real random variables $X_1,\ldots, X_n$ are {\it associated} if, for every $n \geq 1$, for all non-decreasing (in each coordinate) functions $f,g: \R^n\mapsto \R$,
we have ${\rm Cov}(f(X_1,\ldots,X_n), \, g(X_1,\ldots, X_n))\ge 0$ (if the covariance exists).
Non-decreasing functions of a family of associated random variables are associated \cite{EPW}.
Independent variables are associated.
It follows that, if ($X_\el, \el \in \Z^2$), are associated r.v.s, in particular independent, then the r.v.s ($X_{Z_k(\omega)}, k \geq 0$),
are associated for every $\omega \in \Omega$.}
\end{definition}
\begin{thm} \label{FCLTind1} If $\E(X_\0^2) = 1$, for $\PP$-a.e. $\omega$, the process
$\displaystyle \bigl (Y_n(\omega, x, t\bigr)_{t \in [0,1]} = \bigl({S_{\lfloor nt \rfloor}^{\omega, X} (x) \over\sqrt{ n \log n}}\bigr)_{t \in [0,1]}$
satisfies a FCLT with asymptotic variance $\sigma^2 = (\pi \sqrt{\det \Sigma})^{-1}.$
\end{thm}
\proof 1) For the convergence of the finite dimensional distributions, the proof, relying on Cram\'er-Wold's theorem and Lindeberg's CLT, is as in \cite{Bo89}.
Another proof, based on truncation and cumulants, can be given, like for the more general case of moving averages in Section \ref{movAverag}.
2) {\it Tightness of the process $(Y_n)$.} The following is shown in \cite{NeWr81}, p. 673:
Let $U_1, U_2, \ldots$ be centered associated random variables with finite second order moment.
Put $S_k=\sum_{j=1}^k U_j,$ for $k\geq1$. Then, for every $\lambda>0$ and $n \geq 1$, we have
\begin{eqnarray}
\mu(\max_{1\le k \le n}|S_k| \geq \lambda \, \|S_n\|_2) \leq 2\mu \bigl(|S_n|\ge (\lambda-\sqrt{2}) \, \|S_n\|_2 \bigr). \label{NWinequal1}
\end{eqnarray}
Inequality (\ref{NWinequal1}) can be applied for every fixed $\omega$ to $U_j = X_{Z_j(\omega)}$ and to the sums $S_J=\sum_{j=b}^{b+k} X_{Z_j(\omega)}$
for any interval $J = [b , b+k] \subset [0, n]$. We also note that $\E(S_J^2) = \|X_0\|_2^2 \, V(\omega, J)$.
a) First, let us assume that $\E(X_\0^4) < \infty$. With $K$ given by (\ref{Komega}), we have
\begin{eqnarray}
&&\|\sum_{i \in J} X_{Z_i(\omega)}\|_{4, \mu}^4
= 3 \E(X_{\0}^2)^2 \, \sum_{\el_1 \not = \el_2} w(\omega, J, \el_1)^2 \, w(\omega, J, \el_2)^2 + \, \E(X_\0^4) \, \sum_{\el} w(\omega, J, \el)^4 \nonumber \\
&&\ \leq 4 \, \E(X_\0^4) \, V(\omega, J)^2 \leq 4 \, \E(X_\0^4) \, (K(\theta^b \omega))^2 \, (k \ln k)^2. \label{mom4iid1}
\end{eqnarray}
Let $C_1$ be a constant $> 0$ such that $\PP\{\omega: \, K(\omega) \leq C_1\} > 0$.
Using Lemma \ref{mean1}, for $n$ big enough and $\delta \in ]0, 1[$, there are times
$0 = \rho_1 < \rho_2< ... < \rho_v \leq n < \rho_{v+1}$, with $v < 2/\delta$, such that $K(\theta^{\rho_i} \omega) \leq C_1$
and $\frac12 \delta n \leq \rho_{i+1} - \rho_i \leq \frac32 \delta n$, for $i = 1, \ldots, v$.
Let $t_i=\frac{\rho_i}{n}$, $\lambda=\frac{\varepsilon}{\sqrt{\delta}}$, $J_i=[\rho_{i-1}, \ldots, \rho_i[$, $m_i =\frac23 (\rho_{i+1} - \rho_i) \leq \delta n$.
There is $C$ such that, by (\ref{Komega}) and (\ref{mom4iid1}),
\begin{eqnarray}
&&\|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}\|_2 \leq C \, \|X_0\|_2 \, (n \, \delta \, \log (n \delta))^\frac12,
\|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}\|_4 \leq C \, \|X_0\|_4 \, (n \, \delta \, \log (n \delta))^\frac12, \forall i.
\end{eqnarray}
Using (\ref{NWinequal1}), we get, with $\sigma^{(i)} := \|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}\|_2$, $\lambda_i := \varepsilon \sqrt{n\log n} / \sigma^{(i)}$,
by Chebyshev's inequality (for a moment of order 4):
\begin{eqnarray}
&&\mu(\sup_{t_{i-1}\le s\le t_i} | \sum_{j=[t_{i-1}n\rfloor}^{\lfloor sn\rfloor} X_{Z_j (\omega)} |\geq \varepsilon \sqrt{n\log n})
=\mu(\max_{\rho_{i-1} \leq k \leq \rho_i} |\sum_{j=\rho_{i-1}}^{k} X_{Z_j(\omega)}|\geq \lambda_i \, \sigma^{(i)}) \nonumber \\
&&\leq 2 \mu(|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}| \geq (\lambda_i -\sqrt{2}) \, \sigma^{(i)})
\leq 2 \mu(|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}| \geq \frac12 \lambda_i \, \sigma^{(i)}) \nonumber \\
&&\leq 2 \mu(|\sum_{j=\rho_{i-1}}^{\rho_i} X_{Z_j(\omega)}| \geq \frac12 \varepsilon \sqrt{n\log n})
\leq 2 \, C^4 \, \|X_0\|_4^4 \, {(n \, \delta \, \log (n \delta))^2 \over \frac1{16} \varepsilon^4 (n\log n)^2}
\leq 32 \, C^4 \, \|X_0\|_4^4 \, {\delta^2 \over \varepsilon^4}. \label{majC4}
\end{eqnarray}
We have used that $\lambda_i$ is big if $\delta$ is small. Observe now that (cf. \cite{Bi99})
\begin{eqnarray*}
&&\mu(\sup_{|t'-t|\le\delta} |Y_n(t)-Y_n(s)| \geq 3 \varepsilon) \leq
\sum_{i=1}^v \mu(\sup_{t_{i-1}\le s\le t_i} | \sum_{j=[t_{i-1}n\rfloor}^{\lfloor sn\rfloor} X_{Z_j (\omega)} |\geq \varepsilon \sqrt{n\log n}).
\end{eqnarray*}
Hence, by (\ref{majC4}) we get
$\displaystyle \mu(\sup_{|t'-t|\le\delta} |Y_n(t)-Y_n(s)| \geq 3 \varepsilon)
\leq 32 \, C^4 \, \|X_0\|_4^4 \, \frac{2}{\delta}\frac{\delta^2}{\varepsilon^4} = 64 \, C^4 \, \|X_0\|_4^4 \, \frac{\delta}{\varepsilon^4}$.
b) Now we use a truncation. For $L>0$, let
\begin{eqnarray*}
&&\hat X_\k^L:=X_\k \, {\bf 1}_{\{X_\k \leq L\}}- \E(X_\k \, {\bf 1}_{\{X_\k \leq L\}}),
\ \tilde X_\k^L:=X_\k -\hat X_\k^L = X_\k \, {\bf 1}_{\{X_\k > L\}}- \E(X_\k \, {\bf 1}_{\{X_\k > L\}}), \\
&&\hat Y_n^L(t) = \frac{1}{\sqrt{C_0n\log n}}\sum_{j=0}^{\lfloor tn \rfloor} \hat X^L_{Z_j(\omega)} \text { and }
\tilde Y^L_n(t) := Y_n(t) - \hat Y_n^L(t)= \frac{1}{\sqrt{C_0 n \log n}} \sum_{j=0}^{\lfloor tn \rfloor} \tilde X^L_{Z_j(\omega)}.
\end{eqnarray*}
Since we have still sums of associated random variables, all what we have done above (including (\ref{NWinequal1}) holds for both sums,
except that for the unbounded part of the truncation we only have a moment of order 2.
We use Chebyshev's inequality (for a moment of order 2) to control the unbounded truncated part:
\begin{eqnarray*}
\mu(|\sum_{j=\rho_{i-1}}^{\rho_i} \tilde X^L_{Z_j(\omega)}| \geq \frac12 \varepsilon \sqrt{n\log n})
\leq C^2 \, \|\tilde X^L_0\|_2^2 \, {n \, \delta \, \log (n \delta) \over \frac14 \varepsilon^2 \, n\log n}
\leq 4 C^2 \, \|\tilde X^L_0\|_2^2 \, {\delta \over \varepsilon^2}.
\end{eqnarray*}
Hence, for $n$ and $\lambda$ big enough, the sum over $i$ is comparable for some constant $C'$ with
$$C\sum_{i=1}^v \frac{ \|\tilde X^L_0\|_2^2}{\lambda^2}\leq \frac{C'}\delta \frac{\delta \|\tilde X^L_0\|_2^2 }{\varepsilon^2}
= C' \, \varepsilon^{-2} \, \|\tilde X^L_0\|_2^2.$$
Applying the inequality $\mu(|f+g|\ge\varepsilon) \leq \mu(|f|\geq \frac\varepsilon2)+\mu(|g| \geq \frac\varepsilon2)$
to $Y_n(t) = \hat Y_n^L(t) + \tilde Y^L_n(t)$, we obtain the bound:
\begin{eqnarray*}
&&\mu (\sup_{|t'-t| \leq \delta}|Y_n(t') - Y_n(t)| \geq 3\varepsilon) \leq 2^{10} C^4 \,\frac{L^4 \delta}{\varepsilon^4} + 4 C' \, \frac{\|\tilde X^L_0\|_2^2}{\varepsilon^2}.
\end{eqnarray*}
We need, for fixed $\varepsilon > 0$, $\lim_{\delta \to 0^+} \limsup_n \mu (\sup_{|t'-t| \leq \delta}|Y_n(t') - Y_n(t)| \geq 3\varepsilon) = 0$.
Let $\eta > 0$. First we take $L$ such that $4 C' \, \frac{\|\tilde X^L_0\|_2^2}{\varepsilon^2} < \frac12 \eta$, then $\delta$ such that
$2^{10} C^4 \,\frac{L^4 \delta}{\varepsilon^4} \leq \frac12 \eta$. \eop
\vskip 3mm
\goodbreak
{\bf A model based on the Lorentz process} \label{LorentzFCLT}
We sketch briefly how to obtain a version of a FCLT when the random walk is replaced by the movement of a particle in a dispersing periodic billiard.
We refer to \cite{Pen09} and \cite{Pen14} for more details on this model.
Let be given a ``billiard table'' in the plane, union of $\Z^2$-periodically distributed obstacles with pairwise disjoint closures.
We consider a point particle moving in the complementary $Q$ of the billiard table in $\R^2$ with unit speed and elastic reflection off the obstacles.
By sampling the flow at the successive times of impact with the obstacles, we obtain a Poincar\'e's section of the billiard flow, the billiard transformation.
We assume that the obstacles are strictly convex with pairwise disjoint closures and boundaries of class $C^{r+1}$ with curvature $>0$
(Sinai's billiard or Lorentz's process). Moreover we make the hypothesis of finite horizon (the time between two subsequent reflections is uniformly bounded).
Suppose that to each obstacle is associated a real random variable with zero expectation, positive and finite variance,
independent of the motion of the particle and that the family of these r.v.s is i.i.d.
Like in an infinite ``pinball'' with random gain, at each collision with an obstacle, the particle wins the amount given by the random variable associated with the obstacle
which is met. Let $W_n$ be the total amount won by the particle after $n$ reflections. An annealed FCLT for $W_n$ has been shown by F. P\`ene (\cite{Pen09}):
there exists $\beta_0 > 0$ such that $\displaystyle {W_{[nt]} \over \beta_0 \, n \lg n}$ converges weakly to the standard Wiener process.
In order to prove a quenched version, we use \cite[Proposition 7]{Pen09}, in place of (\ref{nVarep1}) for the r.w., and \cite[Corollary 4]{Pen14}
(the main and most difficult step), which gives for the self-intersections of the billiard transformation a law of large numbers replacing (\ref{equivAn20}).
Then, by 1) in Remarks \ref{general_0} and by the preceding method for the r.w. in random sceneries, we obtain the quenched version of the FCLT for this model.
\section{\bf Cumulants and CLT} \label{Sectcumulant}
For the models of random fields in Sections \ref{movAverag}, \ref{algMod1}, \ref{expMixSect}, we need to recall some tools,
in particular the method of cumulants which can be used to prove a CLT for dynamical systems satisfying a mixing property of all orders.
In 1960, Leonov (\cite{Leo60a}, \cite{Leo60b}) applied it to a single algebraic endomorphism of a compact abelian group.
In \cite{CohCo13}, \cite{CohCo17}, \cite{CohCo16}, it was applied to multidimensional actions given by algebraic endomorphisms
in the connected case and in some non connected cases.
Recently the method of cumulants has been used in \cite{BjGo20} to prove a CLT for multiple mixing actions with exponential rate.
Using the tightness criterium given in Section \ref{SectMoricz}, we will obtain a functional version in these examples.
\subsection{\bf Moments and cumulants}
\
For $r \geq 1$, let $X_1, ...,X_r$ be $r$ real centered bounded random variables. We denote by $J_r$ the set $ \{1, ..., r\}$.
For any subset $I = \{i_1, ..., i_p\} \subset J_r$, we put $m(I) := \E(X_{i_1} ... X_{i_p})$. The {\it cumulant} of order $r$ is
\begin{eqnarray}
C(X_1, ... , X_r) &=& \sum_{Q = \{I_1, ..., I_p\} \in \Cal Q} (-1)^{p-1} (p - 1)! \ m(I_1) \cdots m(I_p). \label{formCumul0}
\end{eqnarray}
Putting $s(I) := C(X_{i_1}, ... , X_{i_p})$ for $I = \{i_1, ..., i_p\}$, we have
\begin{eqnarray}
\E(X_{1} \cdots X_{r}) &=& m(J_r) = \sum_{Q = \{I_1, ..., I_p\} \in \Cal Q} s(I_1) \cdots s(I_p), \label{cumFormu1}
\end{eqnarray}
where in both formulas, $\Cal Q$ is the set of partitions $Q = \{I_1, I_2, ..., I_p\}$ of $J_r$ into $p \leq r$ nonempty subsets, with $p$ varying from 1 to $r$.
For a single random variable $Y$, the cumulant of order $r$ is defined by $C^{(r)}(Y) := C((Y, ..., Y)_r)$, where $(Y, ..., Y)_r$ is the vector with $r$ components
equal to $Y$. If $Y$ is centered, we have $\|Y\|_2^2 = C^{(2)}(Y)$ and
\begin{eqnarray}
\E(Y^4) = 3 \E(Y^2)^2 + C^{(4)}(Y). \label{moment4}
\end{eqnarray}
In the next sections, we are going to consider random fields obtained by a measure preserving action $(T^h, h \in \cal H)$ of a group $\cal H$
on a probability space $(E, \cal B, \mu)$. Let $f$ be a measurable bounded centered function on $(E, \mu)$.
For $\underline H =(h_1,..., h_r)$ in $\cal H^r$, we can apply the definition of moments and cumulants to $(T^{h_1}f,..., T^{h_r}f)$.}
\begin{nota} {\rm For the purpose of Section \ref{expMixSect}, we introduce some notations as in \cite{BjGo20}. Let $\underline H$ be in $\cal H^r$ and $I, J $ non empty subsets of $J_r$. We set
$$d^r(\underline H) := \max_{i,j} d(h_i, h_j), \ d^I(\underline H) := \max_{i, j \in I} d(h_i, h_j), \ d_{I, J}(\underline H) := \min_{i \in I, \, j \in J} d(h_i, h_j)$$
Let $Q$ be a partition of $J_r$, with $|Q| \geq 2$. We set
\begin{eqnarray*}
&&d^Q(\underline H):= \max_{I \in Q} d^I(\underline H), \ d_Q(\underline H):= \min_{I \not = J, \, I,J \in Q} d_{I, J}(\underline H),
\end{eqnarray*}
and, for $0 \leq \alpha < \beta$,
\begin{eqnarray*}
&&\Delta(\beta) :=\{\underline H \in \cal H^r : d^r(\underline H) \leq \beta\},
\ \Delta_Q(\alpha, \beta) :=\{\underline H \in \cal H^r : d^Q(\underline H) \leq \alpha \text{ and } d_Q(\underline H) > \beta\}.
\end{eqnarray*}
}\end{nota}
The elements of a configuration $\underline H = (h_1, h_2, ..., h_r)$ in $\Delta(\beta)$ can be viewed as `clustered', since
$ (h_1, h_2, ..., h_r) \in \Delta(\beta)$ implies $(h_2, ..., h_r) \subset B_d(h_1, \beta)^{r-1}$
The configurations in $\Delta_Q(\alpha, \beta)$ for some partition $Q$ and $0 < \alpha < \beta$ are made of `well-separated' clusters.
\vskip 3mm
{\bf Moment of order 4}
The moment of order 4 plays a special role in the proof of tightness.
Let $J = [b, b+k]$ be an interval.
We will bound the moment of order 4 of $Y =\sum_{j \in J} T^{Z_j(\omega)} f$, by using (\ref{moment4}) and by bounding the cumulant of order 4:
$C^{(4)}(\sum_{j \in J} T^{Z_j(\omega)} f)$. We have:
$$|C^{(4)}(\sum_{j \in J} T^{Z_j(\omega)} f)|
\leq H(\omega, b , k) := \sum_{s, t, v, w \in J} |C(T^{Z_s(\omega)} f, T^{Z_t(\omega)} f, T^{Z_v(\omega)} f, T^{Z_w(\omega)} f)|.$$
Observe that $H$ is super-additive in the sense of the definition given later in Section \ref{SectMoricz}.
\vskip 3mm
\goodbreak
{\it Partitions of $\{1, 2, 3, 4\}$}
In Formula (\ref{formCumul0}) of cumulants, the contribution of a partition such that one of its atoms is a singleton is 0, and so does not appear.
The partitions of $\{1, 2, 3, 4\}$ without atoms reduced to a singleton are $\{\{1, 2, 3, 4\}\}$, $\{\{1, 2\}, \{3, 4\}\}$, $\{\{1, 3\}, \{2, 4\}\}$,
$\{\{1, 4\}, \{2, 3\}\}$.
The cumulant of order 4 of $(T^{h_i} f, T^{h_k} f, T^{h_\ell} f, T^{h_r} f)$ reads:
\begin{eqnarray}
&&C(T^{h_i} f, \,T^{h_k} f, \,T^{h_\ell} f, \, T^{h_r} f) = \E(T^{h_i} f \, T^{h_k} f \, T^{h_\ell} f \, T^{h_r} f) \label{cum4} \\
- &&[\E(T^{h_i} f \, T^{h_k} f) \, \E(T^{h_\ell} f \, T^{h_r} f) + \E(T^{h_i} f \, T^{h_\ell} f) \, \E(T^{h_k} f \, T^{h_r} f)
+\E(T^{h_i} f \, T^{h_r} f) \, \E(T^{h_k} f \, T^{h_\ell} f)]. \nonumber
\end{eqnarray}
{\it Well separated configurations}
The following proposition is a key step in the proof of the CLT shown in \cite{BjGo20}.
\begin{prop} \label{SepClust} (cf. Proposition 6.2 in \cite{BjGo20}) For every sequence $(\beta_j)_{j=0, ..., r}$ such that
\begin{eqnarray*}
\beta_0 = 0 < \beta_1 < 3 \beta_1 < \beta_2 < ... < \beta_{r-1} < 3 \beta_{r-1} < \beta_r,
\end{eqnarray*}
we have
\begin{eqnarray}
\cal H^r = \Delta(\beta_r) \cup \bigl(\bigcup_{j=0}^{r-1} \bigcup_{|Q|\geq 2} \, \Delta_Q(3 \beta_j, \beta_{j+1}) \bigr). \label{unionDelta}
\end{eqnarray}
\end{prop}
Below, as an illustration, we give a proof for $r =4$.
\vskip 3mm
\proof ($r= 4$) Let us consider in general a metric space $\Cal E$ with a distance $d$. By applying the result to $\Cal E =\cal H$, (\ref{unionDelta}) will follows.
We represent an element of $\Cal E$ by $\bullet$ and, given two elements $a, b \in \Cal E$,
draw $\bullet \bullet$ or $\bullet \ \bullet$ depending on whether they are close or far from each other.
Given a set with 4 elements in $\Cal E$, $\underline H = \{t, u, v, w\}$, we will show that (up to a permutation) $\underline H$ belongs to one of the configuration types
$S_0 = \bullet \bullet \bullet \bullet$, $S_1 = \bullet \bullet \bullet \ \ \ \bullet$, $S_2 = \bullet \bullet \ \ \ \bullet \bullet$,
$S_3 = \bullet \bullet \ \ \ \bullet \ \ \ \bullet$, or $S_4 = \bullet \ \ \ \bullet \ \ \ \bullet \ \ \ \bullet$.
The configurations of type $S_0$ are the `clustered' configurations. This is quantified by saying that these configurations are in $\Delta(\beta)$ for some $\beta > 0$.
The configurations of type $S_4$ are the configurations with pairwise distant elements. They correspond to $\Delta_Q(0, \beta)$ for some $\beta$.
We show that $\underline H$ is either of
\hfill \break of type $S_0 = \bullet \bullet \bullet \bullet$, with $d(x,y) < \beta_4$, for every $x, y$ in $\underline H$,
\hfill \break or of type $S_4 = \bullet \ \ \ \bullet \ \ \ \bullet \ \ \ \bullet$, with $d(x,y) \geq \beta_1$, for every $x \not = y$ in $\underline H$,
\hfill \break or of one of the types $S_1$, $S_2$, $S_3$.
If $\underline H$ is not of type $S_0$ or $S_4$, there are distinct elements, let call them $t, u, w$, such that $d(t, u) < \beta_1$ and $d(t, w) > \beta_4$, which implies
\begin{eqnarray}
d(t, u) < \beta_1, \, d(t, w) > \beta_4 \geq \beta_3, \, d(u, w) > \beta_4 - \beta_1 \geq \beta_3. \label{ineq0}
\end{eqnarray}
\goodbreak
One of the following cases occurs:
1) (type $S_1 = \bullet \bullet \bullet \ \ \ \bullet$) $d(v, t) < 2 \beta_2$, which implies:
\hfill \break $d(v, u) < 2 \beta_2 + \beta_1 < 3 \beta_2$, $d(v, w) > \beta_4 - 2 \beta_2 > 3 \beta_3 - 2 \beta_2 > \beta_3$.
In this case, for the partition $Q = \{\{t, u, v\}, \{w\}\}$, we get $d^Q(\underline H) < 3 \beta_2$ and $d_Q(\underline H) > \beta_3$.
2) $d(v, t) > 2 \beta_2$, which implies: $d(v, u) > 2 \beta_2 - \beta_1 > \beta_2$,
2a) (type $S_2 = \bullet \bullet \ \ \ \bullet \bullet$) $d(v, w) < \beta_2$, which implies:
\hfill \break $d(v, t) > d(t, w) - d(v, w) > \beta_4 - \beta_2 > 3 \beta_3 - \beta_2 > \beta_3$,
\hfill \break $d(v, t) > d(t, w) - d(v, w) > \beta_4 - \beta_1 - \beta_2 > 3 \beta_3 - \beta_1 - \beta_2 > \beta_3$.
\hfill \break For $Q = \{\{t, u\}, \{v, w\}\}$, we get $d^Q(\underline H) < 3 \beta_2$ and $d_Q(\underline H) > \beta_3$.
2b) (type $S_3 = \bullet \bullet \ \ \ \bullet \ \ \ \bullet$) $d(v,w) > \beta_2$ :
\hfill \break For $Q = \{\{t, u\},\{v\}, \{w\}\}$, we get $d^Q(\underline H) < 3 \beta_1$ and $d_Q(\underline H) > \beta_2$. \eop
\vskip 3mm
\subsection{\bf A sufficient condition for the CLT}
\
Let us recall a criterium in terms of cumulants for the CLT (cf. \cite[Th. 7]{Leo60b}, \cite[Th. 6.2]{CohCo17}).
It is convenient to formulate the criterium by using a summation sequence, $w= (w_n)_{n \geq 1}$,
i.e., for each $n$ a function $\el \in \Z^d \to w_n(\el) \in \R$, with $0 < \sum_{\el \in \Z^d} |w_n(\el)| < +\infty$.
The associated normalized non-negative kernel is
$\displaystyle \tilde K(w_n)(\t) = {|\sum_{\el \in \Z^d} w_n(\el) \, e^{2\pi i \langle \el, \t \rangle}|^2 \over \sum_{\el \in \Z^d} |w_n(\el)|^2}, \ \t \in \T^d$.
As for the summation along a random walk which is a special case, we say that the summation is $\xi$-{\it regular} for a probability measure $\xi$ on $\T^d$,
if the normalised kernel $(\tilde K(w_n)_{n \geq 1})$ converges weakly to $\xi$, i.e.,
\begin{eqnarray}
\lim_{n \to \infty}\int_{\T^d} \tilde K(w_n) \,\varphi \, d\t = \xi(\varphi), \text{ for every continuous function } \varphi \text{ on } \T^d. \label{regWn}
\end{eqnarray}
This implies that for $f$, under Condition (\ref{sumcorr1}), the asymptotic variance for the sums is
\begin{eqnarray*}
\sigma_w^2(f) := \lim_n {\|\sum_{\el \in \Z^d} w_n(\el) \, T^\el f\|_2^2 \over \sum_{\el \in \Z^d} |w_n(\el)|^2} = \xi(\varphi_f). \label{asymptVar0}
\end{eqnarray*}
\begin{thm} \label{Leonv0} If $(w_n)_{n \geq 1}$ is a summation sequence on $\Z^d$ such that (\ref{regWn}) holds for a measure $\xi$ on $\T^d$, the condition
\begin{eqnarray}
\sum_{(\el_1, ..., \el_r) \, \in (\Z^d)^r} \, w_n(\el_1) ... w_n(\el_r) \, C(T^{\el_1} f, ... , T^{\el_r} f) = o \bigl((\sum_{\el \in \Z^d} \, w_n^2(\el))^{\frac{r}2}\bigr),
\ \forall r \geq 3, \label{smallCumul0}\\
\text{ implies } \ \ \bigl(\sum_{\el \in \Z^d} \, w_n^2(\el)\bigr)^{-\frac12} \, \sum_{\el \in \Z^d} w_n(\el) f(T^\el .) {\underset{n \to \infty}
\Longrightarrow } \Cal N(0,\xi(\varphi_f)). \label{cvgce1}
\end{eqnarray}
\end{thm}
The following result (cf. \cite[Lemma 6.6]{CohCo17}) shows that mixing of all orders implies the asymptotic nullity of the cumulants.
\begin{proposition} \label{skTozeroLem} Let $(T^\el, \el \in \Z^d)$ be a $\Z^d$-measure preserving action on a probability space $(E, \mu)$.
If it is mixing of order $r \geq 2$, then, for any $f \in L_0^\infty(X)$,
\begin{eqnarray}
\underset{\max_{i \not = j} \|\el_i - \el_j\| \to \infty} \lim C(T^{\el_1} f, ... , T^{\el_r} f) = 0. \label{lem66}
\end{eqnarray}
\end{proposition}
Remark that (\ref{lem66}) does not give the quantitative estimate needed in (\ref{smallCumul0}).
Nevertheless, in Section \ref{algMod1}, (\ref{lem66}) will be sufficient for an action
by automorphisms of a connected compact abelian group (in particular of a torus) which is mixing, when $f$ is a trigonometric polynomial.
For general exponentially mixing actions, a quantitative formulation is needed as in \cite{BjGo20}, using Proposition \ref{SepClust}.
\vskip 2mm
{\it Array of sequences and finite dimensional distributions}
For $s \geq 1$ and $j =1, ..., s$, let $(w_{n, j}, n \geq 1)$ be $s$ summation sequences, satisfying (\ref{regWn}) with respectively $\xi = \xi_j$,
where the $\xi_j$'s are probability measures on $\T^ d$.
Using Theorem \ref{Leonv0}, we are going to deduce from the following two conditions the asymptotic normality (after normalization) of the vectorial process
$\bigl(\sum_{\el \in \Z^d} \, w_{n,1}(\el) \, T^\el f, ..., \sum_{\el \in \Z^d} \, w_{n,s}(\el) \, T^\el f \bigr)$:
- asymptotic orthogonality:
\begin{eqnarray}
\int_{\T^d} (\sum_{\el \in \Z^d} w_{n,j}(\el) \, e^{2\pi i \langle \el, \t\rangle}) \, (\sum_{\el \in \Z^d} w_{n,j'}(\el) \, e^{-2\pi i \langle \el, \t\rangle})
\, e^{-2\pi i \langle \p, \t\rangle} \, d\t \nonumber \\
\ \ = o\bigl(\sum_{\el \in \Z^d} (w_{n, j}(\el))^2 + \sum_{\el \in \Z^d} (w_{n, j'}(\el))^2\bigr), \forall j \not = j', \forall \p \in \Z^d. \label{ortho1}
\end{eqnarray}
\hfill \break - convergence to 0 of the normalized cumulants of order $\geq 3$:
\begin{eqnarray}
&&\sum_{(\el_1, ..., \el_r) \, \in (\Z^d)^r} \, w_{n, i_1}(\el_1) ... w_{n, i_r}(\el_r) \, C(T^{\el_1} f, ... , T^{\el_r} f) \nonumber \\
&&\ \ \ = o(\sum_{\el \in \Z^d} \, [\sum_{j=1}^s \, (w_{n, j}(\el))^2])^{r/2}, \, \forall (i_1, ..., i_r) \in \{1, ..., s\}^r, \, \forall r \geq 3. \label{negligCum3}
\end{eqnarray}
\begin{proposition} \label{CltSum1} Under Conditions (\ref{ortho1}) and (\ref{negligCum3}), the vectorial process
$$\bigl({\sum_{\el \in \Z^d} \, w_{n, 1}(\el) \, T^\el f \over (\sum_{\el \in \Z^d} w_{n, 1}(\el)^2)^{\frac12}}, ...,
{\sum_{\el \in \Z^d} \, w_{n, s}(\el) \, T^\el f \over (\sum_{\el \in \Z^d} w_{n, s}(\el)^2)^{\frac12}}\bigr)_{n \geq 1}$$
is asymptotically distributed as ${\cal N}(0, J_s)$, where $J_s$ is the $s$-dimensional diagonal matrix with diagonal $(\xi_j(\varphi_f), j= 1, ..., s)$.
\end{proposition}
\proof The hypothesis (\ref{ortho1}) implies, for $s$ non zero real parameters $a_1, ..., a_s$:
\begin{eqnarray}
(\sum_j a_j^2 \sum_{\el \in \Z^d} (w_{n, j}(\el))^2)^{-1} |\sum_{\el \in \Z^d} \sum_j a_j w_{n, j}(\el) \, e^{2\pi i \langle \el, \t\rangle}|^2
\, \overset {\text{weakly}} {\underset {n \to\infty} \longrightarrow} \, (\sum_j a_j^2)^{-1} \, \sum_j a_j^2 \, \xi_j. \label{sumVar1}
\end{eqnarray}
Putting $w_n^{a_1, ..., a_s}(\el) = a_1 w_{n, 1}(\el) + ... + a_s w_{n, s}(\el)$,
by the Cram\'er-Wold theorem, to conclude it suffices to show
\begin{eqnarray}
{\sum_{\el \in \Z^d} \, w_n^{a_1, ..., a_s}(\el) T^\el f \over (a_1^2 \sum_{\el \in \Z^d} (w_{n, 1}(\el))^2 + ... + a_s^2 \sum_{\el \in \Z^d} \, (w_{n, s}(\el))^2)^{\frac12}}
\Longrightarrow \Cal N(0, \sum_{j=1}^s a_j^2 \,\xi_j(\varphi_f) / \sum_{j=1}^s a_i^2). \label{TCLFd1}
\end{eqnarray}
By (\ref{negligCum3}), the sum $\displaystyle \sum_{i_1, ..., i_r \in \{1, ..., s\}^r} \, \sum_{(\el_1, ..., \el_r) \, \in (\Z^d)^r} \, w_{n, i_1}(\el_1) ... w_{n, i_r}(\el_r)
\, C(T^{\el_1} f, ... , T^{\el_r} f)$ satisfies (\ref{smallCumul0}) and the result follows from Theorem \ref{Leonv0}. \eop
\vskip 3mm
We will use also the following lemma. Let $(w_n)_{n \geq 1}$ be a summation sequence on $\Z^d$ such that (\ref{regWn}) holds
for a measure $\xi$ on $\T^d$. For $f \in L^2(\mu)$, we put $\sigma_n(f) := \|\sum_\el w_n(\el) \, T^\el f \|_2$.
We can suppose $\xi(\varphi_f) > 0$, since otherwise the limiting distribution is $\delta_0$.
\begin{lem} \label{tclRegKer} Let $f, f_k, k \geq 1$ be in $ L^2(\mu)$ and satisfying (\ref{sumcorr1}) such that $\|\varphi_{f - f_k}\|_\infty \to 0$. Then
\begin{eqnarray*}
&&{\sum_{\el \in \Z^d} w_n(\el) \, T^\el f_k \over \sigma_n(f_k)} \ {\underset{n \to \infty} \Longrightarrow} \ \Cal N(0,1), \, \forall k \geq 1,
\text{ implies } \, {\sum_{\el \in \Z^d} w_n(\el) \, T^\el f \over \sigma_n(f)} \ {\underset{n \to \infty} \Longrightarrow} \ \Cal N(0,1).
\end{eqnarray*}
\end{lem}
\proof Let $(\varepsilon_k)$ be a sequence of positive numbers tending to 0, such that $\|\varphi_{f - f_k}\|_\infty \leq \varepsilon_k$.
Let us consider the processes defined respectively by
\begin{eqnarray*}
U_n^{k} := (\sum_{\el \in \Z^d} \, w_n^2(\el))^{-\frac12} \, \sum_{\el \in \Z^d} w_n(\el) \, T^\el f_k,
\ U_n := (\sum_{\el \in \Z^d} \, w_n^2(\el))^{-\frac12} \, \sum_{\el \in \Z^d} w_n(\el) \, T^\el f.
\end{eqnarray*}
By (\ref{asymptVar0}) we have:
$$(\sum_{\el \in \Z^d} \, w_n^2(\el))^{-1} \, \|\sum_{\el \in \Z^d} w_n(\el) \, T^\el f \|_2^2
= \int_{\T^d} \, \tilde w_n \, \varphi_f \, dt \underset{n \to \infty} \to \xi(\varphi_f).$$
Since $\xi(\varphi_{f - f_k}) \to 0$, we have $\xi(\varphi_{f_k}) \not = 0$ for $k$ big enough.
Indeed, if $\xi$ is a probability measure on $\T^d$, $f \to (\xi(\varphi_f))^\frac12$ satisfies the triangular inequality.
The hypotheses imply ``${U_n^{k} \ {\underset{n \to \infty} \Longrightarrow} \Cal N(0,\xi(\varphi_{f_k}))}$'' for every $k$. Moreover, since
\begin{eqnarray*}
\lim_n \int |U_n^k - U_n|_2^2 \ d\mu &=& \lim_n \int_{\T^d} \, \tilde w_n \,\varphi_{f-f_k} \, d \t = \xi(\varphi_{f - f_k}) \leq \varepsilon_k,
\end{eqnarray*}
we have $\limsup_n \mu[|U_n^k - U_n| > \delta] \leq \delta^{-2} \limsup_n \int |U_n^k - U_n|_2^2 \ d\mu \underset{k \to \infty} \to 0$, for every $\delta > 0$.
Therefore, using \cite[Theorem 3.2]{Bi99}, the conclusion ``$U_n \ {\underset{n \to \infty} \Longrightarrow } \Cal N(0, \xi(\varphi_{f}))$'' follows. \eop
\section{\bf Moving averages of i.i.d. random variables} \label{movAverag}
Let $(X_\el)_{\el \in \Z^2}$ be a r.f. of centered i.i.d. real random variables such that $\|X_\0\|_2 = 1$. Let $(a_\q)_{\q\in \Z^2}$ be an array of real numbers
such that $\sum_{\q \in \Z^2} |a_\q| < \infty$ and let $\Xi = (\Xi_\el)_{\el \in \Z^2}$ be the random field defined by $\Xi_\el(x) = \sum_{\q \in \Z^2} a_\q X_{\el - \q}(x)$.
The correlation is
$\displaystyle \widehat \varphi_\Xi(\el) =
\langle \sum_{\q \in \Z^2} a_\q X_{\el - \q}, \sum_{\q' \in \Z^2} a_{\q'} X_{- \q'} \rangle = \sum_{\q \in \Z^2} a_\q \, a_{\q - \el}$.
We have
$$\sum_\el |\widehat \varphi_\Xi(\el)| \leq \sum_\el \sum_{\q \in \Z^2} |a_\q| \, |a_{\q - \el}| = (\sum_{\q \in \Z^2} |a_\q|)^2< +\infty.$$
The continuous spectral density of the process is $\varphi_\Xi(\t) = |\sum_\q a_\q e^{2\pi i \langle\q, \t\rangle}|^2$.
The asymptotic variance for the summation along the r.w. (with the normalisation by $C_0 n \ln n$) is $(\sum_{\q \in \Z^2} a_\q)^2$
that we suppose $\not = 0$.
Using the method of associated r.v.s we obtain a quenched FCLT for $S_{\lfloor nt \rfloor}^{\omega, \Xi}$ (cf. Notation (\ref{defsumRW})):
\begin{thm} \label{FCLTindFil} The process $\displaystyle \bigl({S_{\lfloor nt \rfloor}^{\omega, \Xi}(x) \over\sqrt{ n \log n}}\bigr)_{t \geq 0}$
satisfies a quenched FCLT with asymptotic variance $\sigma^2 = |\sum_{\q \in \Z^2} a_\q |^{2} (\pi \sqrt{\det \Sigma})^{-1}.$
\end{thm}
\proof 1) {\it Convergence of the finite dimensional distributions}
a) First we assume that the random variables are bounded.
Moreover let us consider first a finite sum $F = \sum_{\s \in S} a_\s X_\s$, where $S$ is a finite subset of $\Z^2$.
The case of the series, $\Xi_\0 = \sum_{\s \in \Z^2} a_\s X_\s$, will follow by an approximation argument.
As we have seen, for $Y_n(\omega, x, t) = {S_{[n t]}^{\omega, X}(x) \over \sqrt{C_0 n \log n}}$, we have to show:
$$\forall \, 0=t_0 < t_1 <... < t_r =1, \ (Y_{n}(t_1), ..., Y_{n}(t_r)) \underset {n \to \infty} \Longrightarrow (W_{t_1}, ..., W_{t_r}).$$
For it, we use Proposition \ref{CltSum1}. Condition (\ref{ortho1}) follows from Lemma \ref{VarrwLem1}. Let us check (\ref{negligCum3}).
There is $M$ such that the cumulant $C(T^{\el_1} F,..., T^{\el_r} F) = 0$, if $\max_{i,j} \|\el_i - \el_j\| > M$, because if $M$ is big enough, there is a random variable
$T^{\el_{i}} F$ which is independent from $\sigma$-algebra generated by the others in the collection $T^{\el_1} F, ..., T^{\el_r} F$ (by finiteness of $S$).
Let $\displaystyle w_n^{u}(\omega, \el) := \sum_{j=n t_u}^{nt_{u+1}} 1_{Z_j=\el}$, for $u= 0, ..., r-1$. Then we have $w_n^{u}(\omega, \el) \leq w_n(\omega, \el)$
and, since $\displaystyle \sup_{\el_1, ..., \el_r} |C(T^{\el_1} F, T^{\el_2} F, ..., T^{\el_r} F)| < \infty$,
\begin{eqnarray*}
&& |\sum_{\max_{i,j} \|\el_i - \el_j\| \leq M} C(T^{\el_1} F, T^{\el_2} F, ..., T^{\el_r} F)| \,
w_n^{i_1}(\omega, \el_1) \, w_n^{i_2}(\omega, \el_2) ... w_n^{i_r}(\omega, \el_r) \\
&&\ \ \leq \sum_{\el} \sum_{\|\j_2\|, ..., \|\j_r\| \leq M, \, \j_1 =\0} |C(T^{\el} F, T^{\el + \j_2} F, ..., T^{\el + \j_r} F)| \, \prod_{k=1}^r w_n^{i_k}(\omega, \el+\j_k)\\
&&\ \leq C \sum_\el \sum_{\|\j _2\|, ..., \|\j_r\| \leq M, \, \j_1 =\0} \ \prod_{k=1}^r w_n^{i_k}(\omega, \el+j_k)
\ \leq C \sum_\el \sum_{\|\j _2\|, ..., \|\j_r\| \leq M, \, \j_1 =\0} \ \prod_{k=1}^r w_n(\omega, \el+j_k).
\end{eqnarray*}
The right hand side is less than a finite sum of sums of the form $\sum_{\el \in \Z^d} \prod_{k= 1}^r w_n(\omega, \el + {\j}_k)$ with $\{\j_1, ..., \j_r\} \in \Z^2$.
By (\ref{nVarep1}), for every $\varepsilon > 0$, there is $C_\varepsilon(\omega)$ a.e. finite such that
$\sup_\el w_n(\omega, \el) \leq C_\varepsilon(\omega) \, n^\varepsilon$. For $r \geq 3$, take $\varepsilon < {r-2 \over 2(r-1)}$. We have then
$\sum_{\el \in \Z^d} \prod_{k= 1}^r w_n(\omega, \el + {\j}_k) \leq C_\varepsilon(\omega)^{r-1} \, n^{\varepsilon(r-1)}\, n = o(n^{r/2})$
and (\ref{negligCum3}) is satisfied.
Using Lemma \ref{tclRegKer}, the result can be extended to a general sum $\sum_{\s \in S} a_\s X_\s$, such that $\sum_{\s \in S} |a_\s| < \infty$.
b) Now if we assume only the condition $\|X_\0\|_2 < \infty$, we use a truncation argument and apply again Lemma \ref{tclRegKer}.
2) {\it Tightness} Let $a_\q^+= \max (a_\q, 0)$, $a_\q^-= \max (-a_\q, 0)$.
Observe that the random variables $\sum_{\q \in \Z^2} a_\q^+ X_{\el - \q}(x) = \sum_{\q \in \Z^2} a_{\q+\el}^+ X_{- \q}(x)$, for $\el \in \Z^2$, are associated,
as well as $\sum_{\q \in \Z^2} a_\q^- X_{\el - \q}(x)$, for $\el \in \Z^2$.
Therefore tightness can be proved separately for both processes. The proof is like the proof of tightness in Theorem \ref{FCLTind1}. \eop
\section{\bf Tightness and 4th-moment} \label{SectMoricz}
In this section, we show a criterium of tightness based on the 4th-moment.
Let $n \geq 1$. We say that a nonnegative function $G_0= (G_0(b, k))$, defined for $b, k$ such that $0 \leq b \leq b+k \leq n$, is super-additive if $G_0(b, 0) = 0$ and
\begin{eqnarray}
G_0(b,k) + G_0(b+k, \ell) \leq G_0(b,k+\ell) , \, \forall b \geq 0, \forall k, \ell \geq 1 \text{ such that } b+k+\ell \leq n. \label{supadd1}
\end{eqnarray}
Let $(W_k)$ be a sequence of real or complex random variables on a probability space $(E, \mu)$. We set
$$S_{b,k} = \sum_{r=b+1}^{b+k} W_r, \, M_{b,n} = \max_{1 \leq k \leq n} |S_{b,k}|.$$
The following result is adapted from \cite{Mo76}:
\begin{thm} (F. M\'oricz) \label{thmMoricz1} Let $n \geq 1$. Suppose that there exists $G_0$ a super-additive function such that
\begin{eqnarray}
\E_\mu(|S_{b, k}|^4) \leq G_0^2(b, k), \, \forall \, b, k \text{ such that } 0 \leq b \leq b+k \leq n. \label{hypoG1}
\end{eqnarray}
Then, with the constant $C_{max} = (1 - 2^{-\frac14})^{-4}$,
\begin{eqnarray}
\E_\mu(|M_{b,n}|^4) \leq C_{max} \, G_0^2(b,n), \, \forall b \leq n. \label{toprove1}
\end{eqnarray}
\end{thm}
Let $X = (X_\el)_{\el \in \Z^2}$ be a strictly stationary real r. f. on a probability space $(E, \mu)$, where the $X_\el$'s have zero mean and finite second moment.
Setting $S_J^{\omega}(x) =\sum_{i \in J} X_{Z_i(\omega)}(x)$ if $J$ is an interval, we deduce from (\ref{toprove1}) a criterium for tightness
adapted to the sums along a random walk.
\begin{proposition} \label{rwFCLTB} Let $G(\omega, ., .)$, $H(\omega, ., .)$ be super-additive functions such that for a parameter $\gamma$
and $K_1(\omega), K_2(\omega)$ a.e. finite functions on $(\Omega, \PP)$,
\begin{eqnarray}
G(\omega, b, k) \leq K_1(\theta^b \omega) \, k \ln k, \ H(\omega, b, k) \leq K_2(\theta^b \omega) \, k \, (\ln k)^{\gamma}, \ G(\omega, b, k) \geq k. \label{majGH1}
\end{eqnarray}
Suppose that the r.v.s $X_\el$ are bounded and satisfy
\begin{eqnarray}
&&\E_\mu(|S_{J}^{\omega, X}|^4) \leq G(\omega, b, k)^2 + n^\frac12 \, (\ln n)^{-(\gamma + 1)}\, H(\omega, b, k), \forall J= [b, b+k] \subset [1, n],
\text{ for a.e. } \omega. \label{hypoG1b}
\end{eqnarray}
Then, for every $\varepsilon > 0$, $Y_n(\omega, x, t) = {1 \over \sqrt {n \ln n}} \sum_{j=1}^{[nt]} \, X_{Z_j(\omega)}$ satisfies
\begin{eqnarray}
&& \lim_{ \delta \to 0^+} \limsup_n \mu(x \in E: \, \sup_{|t'-t| \leq \delta}|Y_n(\omega, x, t') - Y_n(\omega, x, t)| \geq \varepsilon) = 0. \label{tight1}
\end{eqnarray}
\end{proposition}
\proof 1) Let $c \geq 0$, $\Delta_n = n^\frac12 (\ln n)^{-2}$, $\nu= \nu_n \geq \Delta_n$,
$L_n = [{\nu_n \over \Delta_n}]$, $\nu' = \nu_n' = [{\nu_n \over \Delta_n}] \Delta_n + \Delta_n + 1$.
The integer $\nu_n$ will be chosen of order $\delta n$. We can write, with the convention that $\sum_{r=0}^{-1} =0$:
\begin{flalign*}
&\max_{0\leq k \leq \nu}|\sum_{j=0}^{k} X_{Z_{j + c}(\omega)}| \leq \max_{0\leq k \leq \nu'}|\sum_{j=0}^{k} X_{Z_{j + c}(\omega)}|
=\max_{0 \leq u \leq[{\nu\over \Delta_n}], 1 \leq k \leq \Delta_n -1}|\sum_{r=0}^{u-1}
\sum_{j=r\Delta_n}^{(r+1)\Delta_n -1} X_{Z_{j + c}(\omega)}+ \sum_{j = u \Delta_n}^{u \Delta_n + k - 1} X_{Z_{j + c}(\omega)}|&\\
&\leq\max_{0 < u \leq L_n, \, 1 \leq k \leq \Delta_n -1}|\sum_{r=0}^{u-1} \, \sum_{j=r\Delta_n}^{(r+1)\Delta_n -1} \, X_{Z_{j + c}(\omega)}|
+ \max_{0 \leq u \leq L_n, \, 1 \leq k \leq \Delta_n -1}\, |\sum_{j = u \Delta_n}^{u \Delta_n + k - 1} \, X_{Z_{j + c}(\omega)}|&\\
&= \max_{0 < u \leq L_n} \, |\sum_{j=0}^{u\Delta_n -1} \, X_{Z_{j + c}(\omega)}|
+ \max_{0 \leq u \leq L_n, \, 1 \leq k \leq \Delta_n -1}\, |\sum_{j = u \Delta_n}^{u \Delta_n + k - 1} \, X_{Z_{j + c}(\omega)}| = \hat A_n + \tilde A_n.&
\end{flalign*}
With $\hat A_n$ and $\tilde A_n$ respectively the first and the second term above, this implies
\begin{eqnarray}
&&\mu(\max_{0\leq k \leq \nu}|\sum_{j=0}^{k} \, X_{Z_{j + c}(\omega)}| \geq \varepsilon \sqrt {n \ln n})
\leq \mu(\hat A_n \geq \frac12\varepsilon \sqrt {n \ln n}) + \mu(\tilde A_n \geq \frac12\varepsilon \sqrt {n \ln n}). \label{discr1}
\end{eqnarray}
For $\tilde A_n$, since the $X_\el$'s are bounded (uniformly in $\el$ by stationarity), by the choice of $\Delta_n$
there is $N_1(\varepsilon, \delta)$ such that $\mu(\tilde A_n \geq \frac12\varepsilon \sqrt {n \ln n}) = 0$, for $n \geq N_1(\varepsilon, \delta)$.
For $\hat A_n$ we will apply Theorem \ref{thmMoricz1} to $W_r = \sum_{j=r\Delta_n}^{(r+1)\Delta_n -1} \, X_{Z_{c+j}(\omega)}$, with
\begin{eqnarray}
G_0(b, k) := G(\omega, c+b \Delta_n, k \Delta_n) + (\ln n)^{- \gamma + 1} \, H(\omega, c + b \Delta_n, k \Delta_n), \label{defG0}
\end{eqnarray}
which is super-additive as $G$ and $H$.
Since $G(\omega, c+b \Delta_n, k\Delta_n) \geq G(\omega, c+b \Delta_n, \Delta_n) \geq \Delta_n = n^\frac12 (\ln n)^{-2}$, we have for $k \geq 1$:
\begin{eqnarray*}
&&G^2(\omega, c+b \Delta_n, k\Delta_n) + n^\frac12 \, (\ln n)^{-\gamma - 1}\, H(\omega, c+b \Delta_n, k\Delta_n)
\leq G_0(b, k)^2,
\end{eqnarray*}
Therefore, by (\ref{hypoG1b}),
\begin{eqnarray*}
&&\E_\mu(|\sum_{r=b+1}^{b+k} \, W_r|^4)
= \E_\mu(|\sum_{j=(b+1)\Delta_n}^{(b+k+1)\Delta_n -1} \, X_{Z_{c+j}(\omega)}|^4) \leq G_0(b, k)^2, \, \forall b \geq 0, \forall k \geq 1,
\end{eqnarray*}
which implies by (\ref{toprove1}) of Theorem \ref{thmMoricz1}:
\begin{eqnarray*}
&&\E_\mu(\max_{1 \leq k \leq p} |\sum_{j=(b+1)\Delta_n}^{(b+k+1)\Delta_n -1} \, X_{Z_{c+j}(\omega)}|^4)
\leq C_{\max} \, G_0(b, p)^2, \, \forall b \geq 0, \forall p \geq 1.
\end{eqnarray*}
Putting $K(\omega) := \max(K_1(\omega), K_2(\omega))$ and using (\ref{majGH1}), we get the bound
\begin{eqnarray}
&&\|\max_{u = 1}^{L_n} |\sum_{j=0}^{u\Delta_n} \, X_{Z_{c+j}(\omega)}| \|_4^4
\leq C_{max} \, [G(\omega, c, L_n \Delta_n) + (\ln n)^{-\gamma + 1} \, H(\omega, c, L_n \Delta_n)]^2 \nonumber \\
&&\leq C_{max} \, K(\theta^c \omega)^2 \, [L_n \Delta_n \ln (L_n \Delta_n) + (\ln n)^{-\gamma + 1} \, (L_n \Delta_n) (\ln (L_n \Delta_n))^{\gamma}]^2. \label{upBound1}
\end{eqnarray}
2) For $M > 0$ big enough, the set $\Omega_M := \{\omega: \, K(\omega) \leq M\}$ has a probability $\PP(\Omega_M) \geq \frac12$.
We apply Lemma \ref{mean1} to $\Omega_M$. Given $\delta > 0$, there is $N_2(\delta)$ such that for $n \geq N_2(\delta)$,
we can find a sequence $0 = \rho_{1, n} < \rho_{2, n} < ... < \rho_{v, n} \leq n < \rho_{v+1, n}$ of visit times of $\theta^k \omega$ in $\Omega_M$
under the iteration of the shift $\theta$, such that $\frac12 \delta n \leq \rho_{i+1, n} - \rho_{i, n} \leq \frac32 \delta n$ and $v < 2/\delta$.
By construction, $K(\theta^{\rho_{i, n}}\omega) \leq M, \forall i$.
With $c= \rho_{i, n}$, $\nu_n=\nu_{i, n} = \rho_{i+1, n} - \rho_{i, n} \leq \frac32 \delta n$, $L_{i, n} = [{\nu_{i, n} \over \Delta_n}]$
(so that $L_{i, n} \Delta_n \leq \frac32 \delta n$), we deduce from the upper bound (\ref{upBound1})
(for $n$ big enough and using $0 \leq \ln (\delta n) \leq \ln n$, if $n \geq \delta^{-1}$):
\begin{eqnarray*}
&&\|\max_{u = 1}^{L_{i, n}} |\sum_{j=0}^{u\Delta_n} \, X_{Z_{\rho_{i, n}+j}(\omega)}| \|_4^4 \leq C_{max} M \, [\nu_{i, n} \, \ln \nu_{i, n}
+ (\ln n)^{-\gamma + 1} \, \nu_{i, n} \, (\ln \nu_{i, n})^{\gamma}]^2\\
&&\leq C_{max} M \, [\frac32\delta n \ln (\delta n) + (\ln n)^{-\gamma + 1} \, \frac32 \delta n (\ln (\delta n))^{\gamma}]^2 \leq C_{max} M \, [3\delta n \ln n]^2.
\end{eqnarray*}
This implies for $\hat A_n$ (cf. (\ref{discr1})), for $i= 1, ..., v$, for a constant $C$:
\begin{flalign*}
&\mu(\max_{0 \leq u \leq L_{i, n}}|\sum_{j=0}^{u\Delta_n -1} \, X_{Z_{j + \rho_i}(\omega)}| \geq \frac12 \varepsilon \sqrt {n \ln n})
\leq {C_{max} M \, (3 \delta n \ln n)^2 \over (\frac12 \varepsilon \sqrt {n \ln n})^4} \leq C \, \varepsilon^{-4} \, \delta^2.&
\end{flalign*}
Putting $t_i = \rho_{i, n} /n$, we obtain, for $n \geq N(\varepsilon, \delta)$ with $N(\varepsilon, \delta) \geq N_1(\varepsilon, \delta)$ and big enough,
\begin{flalign*}
&\mu (\sup_{|t'-t| \leq \delta}|Y_n(t') - Y_n(t)| \geq 3\varepsilon) \leq \sum_{i=1}^v \mu(\sup_{t_{i-1}\leq s \le t_i}| Y_n(s) - Y_n(t_{i-1})| \geq \varepsilon)
\leq 2 C \, \varepsilon^{-4} \, \delta^2 \, v \leq 2 C \, {\delta \over \varepsilon^4}. \eop&
\end{flalign*}
\begin{rem} \label{remSum1} Let be given for each $s$ in a set of indices $S$ a process $X^s = (X_{s, \el})_{\el \in \Z^2}$ satisfying the hypotheses of the proposition,
with the same uniform bound and the same $G, H, \gamma$. Then, if $X_\el = \sum_s a_s X_{s, \el}^s$ with $\sum_s |a_s| \leq 1$,
the r.f. $X = (X_\el)$ satisfies the conditions of the proposition and therefore the conclusion (\ref{tight1}).
This follows from Minkowski inequality:
\begin{eqnarray*}
\|S_{J}^{\omega, X}\|_4^4 &\leq& (\sum_s |a_s| \|S_{J}^{\omega, {X^s}}\|_4)^4 \leq (\sum_s |a_s| [G(\omega, b, k)^2
+ n^\frac12 \, (\ln n)^{-(\gamma + 1)} \ H(\omega, b, k)]^\frac14)^4\\
&=& (\sum_s |a_s|)^4 [G(\omega, b, k)^2 + n^\frac12 \, (\ln n)^{-(\gamma + 1)} \, H(\omega, b, k)].
\end{eqnarray*}
\end{rem}
\section{\bf Random walks and FCLT for automorphisms of a torus \label{algMod1}}
We consider now a random field generated by the action of commuting automorphisms on a torus. Let us first present the model.
We will give the details of the proof for $d=2$.
{\it Actions by endomorphisms on a compact abelian group:}
Let $G$ be a compact abelian group with Haar measure $\mu$. The group of characters of $G$ is denoted by $\hat G$ and the set of non trivial characters by $\hat G^*$.
The Fourier coefficients of a function $f$ in $L^1(G, \mu)$ (denoted also $\hat f(\k)$ when $G$ is a torus) are $c_f(\chi) := \int_G \, \overline \chi \, f \, d\mu$, $\chi \in \hat G$.
Every surjective endomorphism of $G$ defines a measure preserving transformation on $(G, \mu)$ and a dual injective endomorphism on $\hat G$.
Let $(T_1, ..., T_d)$ be a finite family of $d$ commuting surjective endomorphisms of $G$ and $T^\el = T_1^{\ell_1}... T_1^{\ell_1}$,
for $\el = (\ell_1, ..., \ell_d) \in \Z^d$. We obtain a $\Z^d$-action $(T^\el, \el \in \Z^d)$ on $G$, which is totally ergodic if and only if the dual action is free.
Let $AC_0(G)$ denote the space of real functions on $G$ with {\it absolutely convergent Fourier series} and $\mu(f) =0$, endowed with
the norm: $\|f \|_c := \sum_{\chi \in \hat G} |c_f(\chi)| < +\infty$.
Recall that the action on $G$ is mixing of all orders if it is totally ergodic and $G$ is connected.
\begin{prop} \label{resum} If $f$ is in $AC_0(G)$, the spectral density $\varphi_f$ is continuous on $\T^\rho$ and $\|\varphi_{f}\|_\infty \leq \|f\|_c^2$.
For every $\varepsilon > 0$ there is a trigonometric polynomial $P$ such that $\|\varphi_{f - P}\|_\infty \leq \varepsilon$.
\end{prop}
\proof \ Since by total ergodicity the characters $T^\el \chi$ for $\el \in \Z^d$ are pairwise distinct, we have
$$\sum_{\el \in \Z^d} |\langle T^{\el}f, f\rangle| \leq \sum_{\el \in \Z^d} \sum_{\chi \in \hat G^*} |c_f(T^\el \chi)| \, |c_f(\chi)|
\leq \sum_{\chi \in \hat G^*} (\sum_{\el \in \Z^d} |c_f(T^\el \chi)|) \, |c_f(\chi)| \leq (\sum_{\chi \in \hat G^*} |c_f(\chi)|)^2.$$
Therefore, if $f$ is in $AC_0(G)$, then $\sum_{\el \in \Z^d} |\langle T^{\el}f, f\rangle| < \infty$, the spectral density is continuous and
$\|\varphi_f\|_\infty \leq \varepsilon$. By this inequality, we can take for $P$ the restriction of the Fourier series
of $f$ to a finite set $\Cal E$ in $\hat G$, where $\cal E$ is such that
$\|\varphi_{f - P}\|_\infty \leq (\sum_{\chi \in \hat G \setminus {{\Cal E}}} |c_f(\chi)|)^2 \leq \varepsilon$. \eop
For compact abelian groups which are connected (cf. \cite{CohCo17}) or which belong to a special family of non connected groups (cf. \cite{CohCo16}),
a CLT has been shown for summation either over sets or along a random walk.
Our aim is to extend this latter result to a functional CLT at least in the case of automorphisms of a torus.
{\it Matrices and automorphisms of a torus:}
Now we will restrict to the special case of matrices and automorphisms of $G = \T^\rho$, $\rho > 1$.
Every $A$ in the semigroup ${\Cal M}^*(\rho, \Z)$ of non singular $\rho \times \rho$ matrices with coefficients in $\Z$ defines a
surjective endomorphism of $\T^\rho$ and a measure preserving transformation on $(\T^\rho, \mu)$. It defines also a dual
endomorphism of the group of characters $\widehat {\T^\rho}$ identified with $\Z^\rho$ (this is the action by the transposed matrix, but since
we compose commuting matrices, for simplicity we do not write the transposition). The linear operator on $\C^\rho$ defined by $A$ is denoted by $\tilde A$.
When $A$ is in the group $GL(\rho, \Z)$ of matrices
with coefficients in $\Z$ and determinant $\pm 1$, it defines an automorphism of $\T^\rho$.
Recall that the action of $A \in {\Cal M}^*(\rho, \Z)$ on $(\T^\rho, \mu)$ is ergodic if and only if $A$ has no eigenvalue root of unity.
Here we present the proof for the case of automorphisms and for $d= 2$ (in the recurrent case for the random walk).
Let $(A_1, A_2)$ be two commuting matrices in $GL(\rho, \Z)$
and $A^\el = A_1^{\ell_1} \, A_2^{\ell_2}$, for $\el = (\ell_1, \ell_2) \in \Z^2$. It defines a $\Z^2$-action $(A^\el, \el \in \Z^2)$ on $(\T^\rho, \mu)$,
which is totally ergodic if and only if $A^\el$ has no eigenvalue root of unity for $\el \not = \0$.
Explicit totally ergodic $\Z^2$-actions can be computed (cf. \cite{CohCo17}) like the example below
(see the book of H. Cohen on computational algebraic number theory \cite{Co93}):
$A_1 = \left(
\begin{matrix} -3 & -3 & 1 \cr 10 & 9 & -3 \cr -30 & -26 & 9 \cr
\end{matrix} \right), \ \ A_2 = \left(
\begin{matrix} 11 & 1 & -1 \cr -10 & -1 & 1 \cr 10 & 2 & -1 \cr
\end{matrix}
\right).$
\vskip 3mm
We will need an algebraic result based on the following theorem on S-unit equations (\cite{Schl90}):
\begin{thm} \label{EvScSc} (\cite[Th. 1.1]{EvScSc02}) \ Let $K$ be an algebraically closed field of characteristic 0 and
for $r \geq 2$, let $\Gamma_r$ be a subgroup of the multiplicative group $(K^*)^r$ of finite rank.
For any $(a_1,..., a_r) \in (K^*)^r$, the number of solutions $x = (x_1,... , x_r) \in \Gamma_r$ of the equation
$a_1 x_1 + ... + a_r x_r = 1$ such that no proper subsum of $a_1 x_1 + ... + a_r x_r$ vanishes, is finite.
\end{thm}
\begin{cor} \label{nbsolu1} Suppose that the $\Z^2$-action $(A^\el, \el \in \Z^2)$ is totally ergodic.
The set $F$ of triples $(\el_1, \el_2, \el_3) \in (\Z^2)^3$ for which there is $\gamma \in \Z^2 \setminus \{\0\}$ such that
\begin{eqnarray}
&&A^{\el_1} \gamma - A^{\el_2} \gamma + A^{\el_3} \gamma - \gamma = 0, \label{unitEq1}
\end{eqnarray}
without vanishing proper sub-sum, is finite.
\end{cor}
\proof There exists a decomposition of $E = \C^\rho$ into vectorial subspaces $\C^\rho = \oplus_k E_k$ which are simultaneously invariant by $\tilde A_i$, $i=1, 2$,
and such that there is a basis $B_k$ in which $\tilde A_i$ restricted to $E_k$ is represented in a triangular form with an eigenvalue
of $\tilde A_i$ on the diagonal.
This follows from the fact that the commuting matrices $A_i$ have a common non trivial space $W$ of eigenvectors,
and then by an induction on the dimension of the vector space, applying the induction hypothesis to the action of the quotient map of $\tilde A_i$ on $E/W$.
For $\gamma \in \Z^\rho \setminus \{0\}$, there is $k_0$ such that the component $\gamma_0$ of $\gamma$ in $E_{k_0}$ is $\not = 0$.
Let $\delta_0$ be the dimension of $E_{k_0}$. In the basis $B_{k_0} = \{e_{k_0, 1}, ..., e_{k_0, \delta_0}\}$ of $E_{k_0}$, we denote the coordinates
of $\gamma_0$ by $(\gamma_0^1, ..., \gamma_0^{\delta_0})$. There is $\delta_0' \in \{1, ..., \delta_0\}$ such that
$\gamma_0^i = 0, \, \forall i < \delta_0', \text{ and } \v_0 := \gamma_0^{\delta_0'} \not = 0$.
Due to the triangular form, for $j = 1, 2$, we have $A_j^\ell \gamma_0 = \alpha_{k_0, j}^\ell \, \gamma_0^{\delta_0'} \, e_{k_0, \delta_0'} + \zeta(j, \ell)$, $\forall \ell \in \Z$,
where $\alpha_{k_0, j}$ is an eigenvalue of $A_j$ and where $\zeta(j, \ell)$ belongs to the subspace generated by $\{e_{k_0, \delta_0' +1}, ..., e_{k_0, \delta_0}\}$.
Using the notation $\al_u^\el = \alpha_{u, 1}^{\ell^1} \, \alpha_{u, 2}^{\ell^2}$, if $\alpha_{u, 1}$ (resp. $\alpha_{u, 2}$) is an eigenvalue of $A_1$ (resp. $A_2$),
if (\ref{unitEq1}) holds, then $(\al_{k_0}^{\el_1} - \al_{k_0}^{\el_2} + \al_{k_0}^{\el_3}) \v_0 = \v_0$. This equation is still without vanishing proper sub-sum,
because of the assumption of total ergodicity. By Theorem \ref{EvScSc} applied to the multiplicative group (of finite rank) generated by $\alpha_{k_0, j}$, $j=1, 2$,
the number of solutions of the previous equation is finite. Hence the result, since $k_0$ takes a finite number of values.
\eop
\vskip 3mm
{\bf Random walks and quenched CLT} \label{rwSect}
Our aim is to replace the r.f. of i.i.d. variables $(X_\el, \el \in \Z^2)$ discussed in Section \ref{indepSec} by
the random field generated by an observable $f$ on a torus $\T^\rho$ under the action of commuting automorphisms.
More precisely, we consider $\el\mapsto A^{\underline \ell}$ a totally ergodic $\mathbb Z^2$-action by algebraic automorphisms of $\mathbb T^\rho$, $\rho>1$,
defined by commuting $\rho\times \rho$ matrices $A_1, A_2$ with integer entries, determinant $\pm 1$
such that the eigenvalues of $A^{\el} = A_1^{\ell_1} A_2^{\ell_2}$ are $\not = 1$, if $\el = (\ell_1, \ell_2) \not = (0, 0$).
The composition with a function $f$ defined on $\T^\rho$ is denoted by $A^\el f$ as well as $T^\el f$. We consider the random field
$(X_\el = A^{\el} f, \, \el \in \Z^2)$, with $f \in AC_0(\T^\rho)$.
A sufficient condition for $f$ with 0 integral to be in $AC_0(\T^\rho)$ is $|\hat f(\k)| = O(\|k\|^{-\beta}), \text{ with } \beta > \rho$.
For a.e. $\omega$ the following asymptotic variance exists:
$$\lim_n \frac1{n\log n}\|\sum_{k=1}^{n}A^{Z_k(\omega)} f\|_2^2 = C_0 \, \sum_{\k \in \Z^d} \langle T^\k f \, f \rangle,$$
where the constant $C_0$ is defined in Subsection \ref{varRWSect1}.
The following quenched FCLT extends for the torus the CLT proved in \cite{CohCo17}.
Remark that the CLT is proved therein for a general compact abelian group.
The extension to a functional version of the CLT holds in this general case when $f$ is trigonometric polynomial.
\begin{thm} \label{rwFCLTB2} Let $(Z_n)$ be a 2-dimensional reduced centered random walk with a finite moment of order 2
and let $f$ be a real function in $AC_0(\T^\rho)$ with spectral density $\varphi_f$ and $\varphi_f(\0) \not = 0$.
Denoting by $S_{n}^\omega (f) :=\sum_{k=1}^{n}A^{Z_k(\omega)} f$ the sums along the r.w., the process
$\Big(\frac1{\sqrt{n\log n}}S_{\lfloor nt\rfloor}^\omega(f)\Big)_{t\in[0,1]}$ satisfies a FCLT for a.e. $\omega$.
\end{thm}
\proof {\it 1) Convergence of the finite dimensional distributions}
1a) First suppose that $f$ is a trigonometric polynomial: $f = \sum_{\k \in \Lambda} c_\k(f) \, \chi_\k$, where $(\chi_\k, \k \in \Lambda)$
is a finite set of characters on $\T^\rho$ and $\chi_{0}$ the trivial character.
We use Proposition \ref{CltSum1}: (\ref{ortho1}) follows from (\ref{orth1}) and Lemma \ref{VarrwLem1}. For (\ref{negligCum3}), we have to show
\begin{eqnarray}
&C^{(r)}(\sum_{\el \in \Z^2} \, w_n(\omega, \el) \, T^\el f) = o((n \ln n)^{r/2}), \, \forall r \geq 3, \text{ for a.e. } \omega. \label{cumulBdr0}
\end{eqnarray}
We apply Theorem \ref{Leonv0}. Let us check (\ref{smallCumul0}). For $r$ fixed, the function
$(\n_1, ..., \n_r) \to m_f(\n_1, ..., \n_r) := \int_X \, T^{\n_1} f \cdots T^{\n_r} f \, d\mu$ takes a finite number of values,
since $m_f$ is a sum with coefficients 0 or 1 of the products $c_{k_1} ... c_{k_r}$ with $k_j$ in a finite set.
The cumulants of a given order take also a finite number of values according to (\ref{cumFormu1}).
Therefore, since mixing of all orders implies $\underset{\max_{i,j} \|\el_i - \el_j\| \to \infty} \lim \, C(T^{\el_1} f,..., T^{\el_r} f) = 0$
by Proposition \ref{skTozeroLem}, there is $M_r$ such that $C(T^{\el_1} f,..., T^{\el_r} f) = 0$ if $\max_{i,j} \|\el_i - \el_j\| > M_r$.
The end of the proof is then like in Theorem \ref{FCLTindFil}.
1b) For $f \in AC_0(\T^\rho)$, using Proposition \ref{resum} and Lemma \ref{tclRegKer}, the convergence follows by approximation
of $f$ by a squence of trigonometric polynomials $f_L$ in such a way that $\lim_L \varphi_{f - f_L} (0)= 0$.
{\it 2) Moment of order 4 and tightness}
We use Proposition \ref{rwFCLTB}.
Taking into account Remark \ref{remSum1}, it suffices for the tightness to take for $f$ a character and show that the bounds are independent of the character.
Let $\chi_v$ be a character on the torus $\T^\rho$, $\chi_v: x \to \exp(2 \pi i \langle v, x\rangle)$, where $v \in \Z^\rho \setminus \{0\}$.
For an interval $J =[b, b+k] \subset [1, n]$, we have:
\begin{eqnarray*}
&\|\sum_{i= b }^{b+k} A^{Z_i} \chi_v \|_4^4 =
\#\{(i_1, i_2, i_3, i_4) \in J^4: \ (A^{Z_{i_1}} -A^{Z_{i_2}}+A^{Z_{i_3}}-A^{Z_{i_4}}) \, v =0 \}.
\end{eqnarray*}
This number is less than $2G^2(\omega, b , k) + H(\omega, b , k)$, with
\begin{eqnarray*}
G(\omega, b , k) &&:= \#\{(i_1, i_2) \in J^2: \, (A^{Z_{i_1}} - A^{Z_{i_2}}) \v = 0 \},\\
H(\omega, b , k) &&:= \#\{(i_1, i_2, i_3, i_4) \in J^4: \, (A^{Z_{i_1}} - A^{Z_{i_2}} + A^{Z_{i_3}} - A^{Z_{i_4}}) \v= 0 \},
\end{eqnarray*}
where above in $H$ we count the number of solutions without vanishing proper sub-sums.
By assumption of total ergodicity, if $(A^{Z_{i_1}} - A^{Z_{i_2}}) \v = 0$, then $Z_{i_1} = Z_{i_2}$, so that $G$ is the number of self-intersections
of the r.w. on $[b, b+k]$: $G(\omega, b , k) = V(\omega, [b, b+k[) = V_k(\theta^b\omega)$.
For $H$, by Corollary \ref{nbsolu1}, there is a finite set $F$ (independent of $\v$) such that
$$H(\omega, b , k) \leq \#\{(i_1, i_2, i_3, i_4) \in J^4:
\ \bigl(Z_{i_1}(\omega) - Z_{i_4}(\omega), Z_{i_2}(\omega) - Z_{i_4}(\omega), Z_{i_3}(\omega) - Z_{i_4}(\omega)\bigr) \in F\}.$$
Therefore, with the notation (\ref{wn123}), $H(\omega, b , k) \leq \sum_{(\el_1, \el_2, \el_3) \in F} W_k(\theta^b \omega, \el_1, \el_2, \el_3)$.
By (\ref{majnumb3}) in Lemma \ref{majwnm}, there exists a positive integrable function $C_3$ such that
$W_n(\omega, \el_1, \el_2, \el_3) \leq C_3(\omega) \, n \, (\ln n)^5, \, \forall n \geq 1$, which implies
$H(\omega, b , k) \leq (\Card \, F) \ C_3(\theta^b \omega) \, k \, (\ln k)^5$.
Remark that the bounds do not depend on the character, but only on the matrices $A_1, A_2$.
Since $G$ and $H$ are super-additive (Condition (\ref{supadd1})), the tightness property follows now from Proposition \ref{rwFCLTB} with $\gamma = 5$. \eop
\begin{rems}
1) An analogous result is valid for any transient random walk in dimension $d \geq 1$, with the standrad normalisation by $\sqrt n$.
In this case, if the observable is non null a.e., the asymptotic variance for the sums along the r.w. is different from 0 (cf. Subsection \ref{varRWSect1}).
2) For automorphisms of a torus $\T^\rho$, in the recurrent 2-dimensional model studied above, if $f$ satisfies the regularity condition
$|c_f(\k)| = O(\|k\|^{-\beta})$, with $\beta > \rho$ , then the asymptotic variance is given by $\varphi_f(0)$ and it is null,
if and only if $f$ is a mixed coboundary: there are continuous functions $u_1, u_2$ such that $f= (I- A_1) u_1 + (I- A_2) u_2$
(\cf \cite{CohCo17}).
\end{rems}
\vskip 3mm
\section{\bf Exponential mixing of all orders} \label{expMixSect}
\subsection{\bf FCLT and exponential mixing of all orders} \label{expMix}
\
Our last example is given by commuting translations on homogeneous spaces. It relies on recent results on the exponential mixing of all orders for flows
on homogeneous spaces shown in \cite{BjEiGo17} and their application to the CLT in \cite{BjGo20}.
Closely following the latter reference, we recall first the notion of exponential mixing of all orders
{\bf Exponential mixing of all orders}
Let $\cal H$ be a group with a left invariant distance $d$. Let $h \to T^h$ be a homomorphism of $\cal H$ in the group of a measure preserving invertible transformations of
a probability space $(E, \cal B, \mu)$.
We denote by ${\cal A}$ a sub-algebra in $L^\infty(E, \mu)$ which is $\cal H$-invariant.
Let ${\cal N} = (N_s)$ be a family of semi-norms on ${\cal A}$, indexed by positive integers $s$.
The following conditions are assumed to hold (with constant factors depending only on $s$, all denoted by $C_s$) for all $s > 1$ and all $f, g \in {\cal A}$:
\hfill \break 1) $N_s(f) \leq C_s N_{s+1}(f)$; 2) $\|f\|_{L^\infty} \leq C_s \, N_s(f)$; 3) $N_s(f g) \leq C_s \, N_{s+1}(f) \, N_{s+1}(g)$;
\hfill \break 4) there exists $\zeta_s > 0$ such that $N_s(T^h f) \leq C_s \, e^{\zeta_s d(h,e)} N_s(f), \, \forall h \in \cal H$.
Let $r > 2$ be an integer. For $\underline H = (h_1, ... , h_r) \in \cal H^r$, we set $d_r( \underline H) := \min_{i \not =j} d(h_i, h_j)$.
\begin{defi} \label{rexpMixDef} We say that the $\cal H$-action on $(E, \mu)$ is exponentially mixing of order $r$, with respect to $d$ and $({\cal A}, {\cal N})$,
if there exist $\delta_r > 0$ and an integer $s_r > 0$ such that for all $s > s_r$ and $f_1, ... , f_r \in {\cal A}$,
\begin{eqnarray}
|\mu(\prod_{i=1}^r T^{h_i} f_i) - \prod_{i=1}^r \mu(f_i)| \leq C \, e^{-\delta_r d_r(\underline H)} \prod_{i=1}^r N_s(f_i), \label{rexpMix}
\end{eqnarray}
for all $\underline H = (h_1, ... , h_r) \in \cal H^r$. The constant $C$ depends only on $r$ and $s$.
\end{defi}
We may assume that $\zeta_s$ is increasing with $s$, $\delta_r$ decreasing with $r$ and $\delta_r < r \zeta_s, \, \forall r, s$.
In what follows, we will consider, for $d \geq 2$, a measure preserving $\Z^d$-action on a probability space $(E, \cal B, \mu)$
generated by $d$ commuting invertible maps $T_1, ..., T_d$. Therefore the group $\cal H$ in Definition \ref{rexpMixDef} is going to be the group $\Z^d$
still denoted also by $\cal H$.
If $(Z_n)$ is a random walk on $\Z^d$, then we get a random walk $(T^{Z_n(\omega)})$ on the group of measure preserving invertible transformations on $(E, \cal B, \mu)$.
With a distance on $\Z^d$ associated to a norm equivalent to the Euclidean norm, the volume of a big ball is of order the number of integral points in the ball.
It is important to relate this distance to the distance $d$ of Definition \ref{rexpMixDef}. We will assume that the action satisfies:
\begin{hyp} \label{ZdMix} For an $\cal H$-invariant sub-algebra ${\cal A}$ in $L^\infty(E, \mu)$ and a family ${\cal N} = (N_s)$ of semi-norms on ${\cal A}$,
we assume that the $\Z^d$-action on $(E, \cal B, \mu)$ is exponentially mixing of order $r$ for every $r \geq 2$ in the sense of Definition \ref{rexpMixDef}
with a distance $d$ equivalent to the Euclidean distance.
\end{hyp}
With this assumption, for simplicity of notation we can assume that the distance $d$ in Definition \ref{rexpMixDef} applied to $\Z^d$ is the Euclidean distance on $\Z^d$.
{\bf Spectral density and cumulants}
Let $f$ be a centered function in $\cal A$. Its spectral density is $\varphi_f = \sum_{\el \in \Z^2} a_\el e^{2\pi i \langle\el, \, \t\rangle}$,
with $a_\el = \langle T^\el f, f\rangle$. The absolute summability $\sum_\el |a_\el| < \infty$ is a consequence of (\ref{rexpMix}) for $r=2$.
Let $J = [b, b+k] \subset [1, n]$. With the notation of \ref{selfInter}, we have
\begin{eqnarray*}
\int |\sum_{j \in J} T^{Z_j(\omega)} f|^2 \, d\mu &=& \int_{\T^d} |\sum_{j \in J} e^{2\pi i \langle Z_j(\omega), \,\t\rangle}|^2 \, \varphi_f(\t) \, d\t
\leq \sum_{\el \in \Z^2} |a_\el| \, V(\omega, J, \el) =: G(\omega, b, k).
\end{eqnarray*}
For a fixed $\omega$, the bound $ G(\omega, b, k)$ is super-additive. By (\ref{moment4}), we have
\begin{eqnarray*}
&&\E_\mu(|\sum_{j \in J} T^{Z_j(\omega)} f|^4) = 3 \bigl(\int (\sum_{j \in J} T^{Z_j(\omega)} f)^2\, d\mu \bigr)^2 + C^{(4)}(\sum_{j \in J} T^{Z_j(\omega)} f).
\end{eqnarray*}
The next proposition shows that the cumulants $C(T^{h_1} f,..., T^{h_r} f)$ are small for all well-separated $r$-tuples $\underline H = (h_1, . . . , h_r)$.
The constants $\delta_r$ and $\zeta_r$ are those of the beginning of the subsection.
\begin{prop} \label{majDeltaQ} (cf. Proposition 6.1 in \cite{BjGo20}) For $r \geq 2$, let $Q$ be a partition of $\{1, 2, ..., r\}$ with $|Q| \geq 2$ and
let $s$ be an integer $> s_r + r$. Then, if $\underline H \in \Delta_Q(\alpha, \beta)$ with $0 < \alpha < \beta$, for $f$ centered in $\Cal A$ we have
\begin{eqnarray}
|C(T^{h_1} f,..., T^{h_r} f)| \leq C e^{- (\delta_r \, \beta - r \, \alpha \, \zeta_s)} \, N_{s}(f)^r.
\end{eqnarray}
where the constant $C$ depends only on $r$ and $s$.
\end{prop}
\proof Let us give the proof for $r=4$ and in the case of the configurations $\underline H$ of type
$S_3 = \bullet \bullet \ \ \ \bullet \ \ \ \bullet$, that is (up to a permutation): $\{\{h_i, h_k\}, \{ h_\ell\}, \{ h_r\}\}$
with, for some $j$, $d(h_i, h_k) < 3\beta_j$ and $d(h_\ell, \{h_i, h_k\}) > \beta_{j+1}$, $d(h_r, \{h_i, h_k\}) > \beta_{j+1}$, $d(h_\ell, h_r) > \beta_{j+1}$.
We may write the formula for the cumulants in the following way:
\begin{eqnarray*}
&& C(T^{h_i} f, \,T^{h_k} f, \,T^{h_\ell}f, \, T^{h_r} f) = (A) - (B) - (C) - (D), \text{ with }\\
&&(A) = \E \bigl(T^{h_i} f \, T^{h_k} f \, T^{h_\ell} f \, T^{h_r} f\bigr), \, (B) = \E (T^{h_i} f \, T^{h_k} f) \, \E(T^{h_\ell} f \, T^{h_r} f),\\
&&(C) = \E(T^{h_i} f \, T^{h_\ell} f) \, \E(T^{h_k} f \, T^{h_r} f), \, (D) = \E(T^{h_i} f \, T^{h_r} f) \, \E(T^{h_k} f \, T^{h_\ell} f).
\end{eqnarray*}
We use the exponential mixing of order 2 for $(B), (C), (D)$ and of order 3 for $(A)$. More precisely, we have
$(A) = \E \bigl((f \, T^{h_k - h_i} f) \, T^{h_\ell - h_i} f \, T^{h_r - h_i} f\bigr)$ and
$$N_s(f \, T^{h_k - h_i} f) \leq C N_{s+1}(f) \, N_{s+1}(T^{h_k - h_i} f) \leq C e^{3 \zeta_s \, \beta_j} N_{s+1}(f) \, N_{s+1}(f).$$
Therefore, by the 3-mixing applied to $f \, T^{h_k - h_i} f, \, T^{h_\ell - h_i} f, \, T^{h_r - h_i} f$, we have
$$(A) \leq C \, e^{3\zeta_s \, \beta_j} \, e^{-\delta_r \,\beta_{j+1}} \, N_{s+1}(f)^2 \, N_{s}(f)^2. \eop$$
Let us now fix $\gamma > 0$. We define $\beta_{j}$ by $\beta_0 = 0$ and
$\beta_{j+1} = 3 r \beta_{j} \zeta_s / \delta_r + \gamma$, for $j > 0$.
As $\delta_r < r \zeta_s$, we have $\beta_{j+1} > 3 \beta_{j}$. Moreover $\beta_{r} = \gamma \sum_{j=0}^{r-1} (3 r \, \zeta_s/ \delta_r)^j =: \gamma c_{r,s}$.
Let $\nu = \sum_\el \nu(\el) \delta_\el$ be a positive finite measure on $\cal H= \Z^d$.
The following bound, where the first term comes from the clustered configurations and the second term from the well separated configurations,
results from Proposition \ref{majDeltaQ} and from (\ref{unionDelta}):
\begin{prop} (\cf Proposition 5.2 in \cite{BjGo20}) For every $r \geq 2$, there exist $C$ and $c= c_{r,s} > 0$ such that,
for all $\gamma > 0$ and $f \in \Cal A$,
\begin{eqnarray}
|C^{(r)}(\nu*f)| \leq C \bigl(\int_{\cal H} \nu(B(h, c \gamma))^{r-1} \, d\nu(h) + e^{-\delta_r \gamma} \, \|\nu\|^r \bigr) \, N_s(f)^r. \label{majcumr}
\end{eqnarray}
\end{prop}
Under the assumption of exponential mixing of all orders, it is shown in \cite{BjGo20} that the CLT holds for $\nu_n*f$, when $f \in \Cal A$
and $(\nu_n)$ a sequence of measures satisfying a certain condition.
In our framework, $\nu$ is the measure $\nu_n^\omega = \sum_{j=0 }^{n-1} \delta_{Z_j(\omega)}$, where $(Z_j)_{j \geq 0}$ is a r.w. on $\Z^2$.
Its mass is $\|\nu_n^\omega\| = n$.
The convolution ``$\nu*f$'' in (\ref{majcumr}) for $\nu_n^\omega$ means ``$\sum_{j = 0}^{n-1} f(T^{Z_j(\omega)} .)$''.
Let us assume that the r.w. $Z$ is a centered random walk on $\Z^2$ with moments of all orders.
By (\ref{DPRZbound}) (\cf \ref{selfInter}), it holds with a constant $K(\omega)$ finite for a.e. $\omega$, uniformly in $h \in \Cal H$:
\begin{eqnarray*}
&\nu_n^\omega(B(h,c\gamma))=\#\{j\le n: Z_j(\omega)\in B(h, c\gamma)\} \leq \sup_\el w_n(\omega, \el) \, \Card(B(h, c\gamma)) \leq K(\omega) (c\gamma)^2\log^2 n.
\end{eqnarray*}
Due to Hypothesis \ref{ZdMix} and by (\ref{majcumr}), this gives with a constant $C_1$ depending only on $r$ and $s$,
\begin{eqnarray*}
|C^{(r)}(\nu_n^\omega*f)| \leq C_1 \bigl( K(\omega)^{r-1} \, (\ln n)^{2(r-1)} (c\gamma)^{2(r-1)} n+ e^{-\delta_r \gamma} \, n^r \bigr) \, N_s(f)^r.
\end{eqnarray*}
Taking $\gamma ={r-1 \over \delta_r} \, \ln n$, the first term above gives the bound $(c {r-1 \over \delta_r})^{2(r-1)} \, (\ln n)^{4(r-1)} n$ and the second term is $n$.
It follows, for a constant $C_2$ depending on $r$ and $s$:
\begin{eqnarray*}
|C^{(r)}(\nu_n^\omega*f)| \leq C_2 \, N_s(f)^r \, K(\omega)^{r-1} \, (\ln n)^{4(r-1)} \, n.
\end{eqnarray*}
Likewise for an interval $J = [b, b+k]$ and $\nu_J^\omega = \sum_{j \in J } \delta_{Z_j(\omega)}$, we get
\begin{eqnarray*}
|C^{(r)}(\nu_J^\omega*f)| \leq C_2 \, N_s(f)^r \, K(\theta^b \omega)^{r-1} \, (\ln k)^{4(r-1)} \, k.
\end{eqnarray*}
So we get the same type of upper bound for the cumulants as for the automorphisms of the torus.
Therefore we have convergence of the finite dimensional distributions and tightness.
For a $\Z^2$-action satisfying the exponential mixing condition on an algebra of functions as presented at the beginning of this section,
we can state now a functional version of a CLT result for the summation along a random walk.
The result is formulated for $\Z^2$, but an analogous result can be proved with the same method for a transient random walk in dimension $\geq 1$.
Let $(Z_n)$ be a 2-dimensional aperiodic centered random walk with moments of all orders. Then we have:
\begin{thm} \label{rwFCLTExp} Let $f$ be a real centered function in $\cal A$ with spectral density $\varphi_f$ such that $\varphi_f(\0) \not = 0$.
Under Hypothesis \ref{ZdMix}, denoting by $S_{n}^\omega (f) :=\sum_{k=1}^{n}T^{Z_k(\omega)} f$ the sums along the r.w.,
the process$\Big(\frac1{\sqrt{n\log n}}S_{\lfloor nt\rfloor}^\omega(f)\Big)_{t\in[0,1]}$ satisfies a FCLT for a.e. $\omega$.
\end{thm}
\vskip 3mm
\subsection{\bf Translations on homogeneous spaces} \label{homog}
\
The following example is an action which is exponentially mixing of all orders on an algebra $\cal A$ of functions according to \cite{BjEiGo17}.
We take the group $G = \rm{SL}(n, \R)$ and a lattice $\Gamma$ in $G$, i.e., a discrete subgroup such that $G /\Gamma$ has a finite volume
for the measure $\mu$ induced by the Haar measure of $G$, for example $\rm{SL}(n, \Z)$. The space $E$ is the quotient $G /\Gamma$.
The action on $E$ will be given by left multiplication $g \Gamma \to hg\Gamma$ where $h$ is in the diagonal subgroup $D$ of $G$.
The algebra $\cal A$ in the example is the algebra of $C^\infty$-functions with compact support on $G /\Gamma$, and $\Cal N$ is a family of Sobolev norms as in \cite{BjEiGo17}.
Observe that it is not true that in general for an invariant distance on an abelian or a nilpotent group, the growth of the balls is sub-exponential.
(Notice that Theorem 6.8.1 in \cite{CeCo10} as referred in \cite{BjGo20} is shown for the growth corresponding to the length associated to a set of generators,
and not for the growth of the balls associated to any invariant distance).
Therefore in the example, we need to explicit the distance .
{\it Left invariant pseudo-metric on $G = \rm{SL}(n, \R)$}
Recall that there is a distance on $D$, induced by a canonical left invariant distance on $G$.
The left invariant distance $d_G$ defined on $G$ is comparable on $D$ to the `pseudo-metric' $\delta(., .)$ defined as follows:
For $A \in G$, let $|||A|||= \max_{x \not = 0} { \|A x\| \over \|x\|}$ be the norm of the $n \times n$ matrix $A$ as operator on $\R^n$ endowed with the euclidian norm.
Since the determinant is 1, $A$ has an eigenvalue of modulus $\geq 1$, which implies $|||A||| \geq 1$. For $A, B \in G$, we put $\delta (A, B) = \log (|||A^{-1} \, B|||)$.
Clearly, $\delta (A, B) \geq 0$, the triangular inequality is satisfied by sub-multiplicativity of the operator norm, and $\delta$ is left invariant on $G$.
If $|||A|||= 1$, the iterates of $A$ are bounded, so all eigenvalues must have a modulus $\leq 1$. As the determinant is 1, the modulus of the eigenvalues is 1.
Now considering the Jordan form of $A$ over $\C$, it must be diagonal. Finally we conclude that $\{A: |||A||| =1\}$ is the orthogonal group in $G$.
We take two elements $A_1 = \exp(U_1)$, $A_2= \exp(U_2)$, where $U_1, U_2$, in the sub-algebra $\mathfrak D$
corresponding to $D$ in the Lie algebra $\mathfrak G$ of $G$, are such that $U_1, U_2$ generate a 2-dimensional vectorial space of $\mathfrak D$.
The group $(A_1^{\ell_1} A_2^{\ell_2}, \, (\ell_1,\ell_2) \in \Z^2)$ yields a totally ergodic action on $G / \Gamma$.
For instance in $\rm{SL}(3, \R)$, we can take with $a_1, a_2 > 1$:
$A_1 = \left(
\begin{matrix} a_1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & a_1^{-1} \cr
\end{matrix} \right), \ \ A_2 = \left(
\begin{matrix} 1 & 0 & 0 \cr 0 & a_2 & 0 \cr 0 & 0 & a_2^{-1}\cr
\end{matrix}
\right)$.
The distance $d_G(A_1^{\ell_1} A_2^{\ell_2}, Id)$ is equivalent to $\|\el\| = (\ell_1^2 + \ell_2^2)^\frac12$.
The measure $\nu_n(B(Id, R))$ is the counting measure with some weight applied to the ball,
therefore up to the weight it is the number of elements of the form $h_1^{\ell_1} h_2^{\ell_2}$ in the ball,
and finally the (weighted) number of integers $\el = (\ell_1, \ell_2)$ of norm $\leq R$.
By what precedes, Hypothesis \ref{ZdMix} is satisfied and Theorem \ref{rwFCLTExp} yields a functional CLT in the class of centered
compactly supported $C^\infty$-functions for the action of a 2-dimensional random walk on the diagonal subgroup on $G/ \Gamma$.
An result analogous to Theorem \ref{rwFCLTExp} holds for the sums along a transient random walk: the only change is the estimate of the number of self-intersection,
(normalisation by $\sqrt n$).
In Theorem \ref{rwFCLTExp}, in particular in the example provided by homogeneous spaces, as in the CLT in \cite{BjGo20},
the statement says nothing about the non-nullity of the variance, for a 2-dimensional recurrent r.w.
The question of degeneracy of the asymptotic variance (for a recurrent r.w.) is the same as for the sums over squares: it depends of the nullity of $\varphi(\0)$.
This contrasts with the action of commuting automorphisms of a torus, for which we have seen that there is a description of the degenerate case in terms of mixed coboundaries.
In the case of a transient random walk on $\Z^d$, as noticed in Subsection \ref{varRWSect1}, if the observable is non null a.e.,
the asymptotic variance for the sums along a transient r.w. is different from 0.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 9,197 |
Pensioner Convicted Of Firearm Possession
A pensioner has pleaded guilty after illegal weapons were discovered hidden within his car scrap yard.
James ('Jimmy') Allen, 78, of Fitzwilliam Road, in Clapham, south west London appeared at Inner London Crown Court where he admitted to offences including: possession of a prohibited firearm (single shot revolver); possession of ammunition whilst a prohibited person; possession of a firearm whilst a prohibited person (air rifle); and possession of a prohibited weapon (stun gun).
Allen is due for pre-sentence reports on 8 March.
He was arrested on 27 May 2010 when, acting on intelligence received, officers from the Central Task Force executed a firearms warrant at the scrap yard in Clapham. Within a locked office at the venue officers discovered a 'Titan Protector' stun gun and a box containing a European American Armoury Corp single action revolver, as well as an amount of ammunition. Allen claimed the revolver was "...a cowboy gun. I bought it to hang on the wall."
A further search also revealed an air rifle.
Allen said he was unaware of the firearms illegality, claiming to have purchased them with the sole intention of protecting himself and his business.
Detective Inspector Steve Ellen, of the Central Task Force, said: "Allen was found in possession of dangerous weapons, which included a live firing revolver with ammunition. His guilty plea today was in the face of overwhelming evidence. The MPS is committed to removing these weapons from the streets of London."
(BMcN/GK)
Man Jailed For Attempted Murder Of Pc
A south London man has been jailed for 25 years for tying to shoot a policeman. Michael Mitchell, 32, of Babington Road, Streatham, was convicted of attempting to murder Pc Shaun Callow, possession of a firearm and possession of drugs with intent to supply.
London Men Jailed For Drugs Offences
Three men from east and south-east London have been jailed for over 30 years, and two remain to be sentenced, for the possession and supply of heroin and cocaine. The group was convicted yesterday after a trial at Snaresbrook Crown Court.
Man Charged With Attempting To Murder Police Officers
A man has been charged with attempting to murder two police officers. James Leslie, 37, of Cardigan Road, Leeds, is accused of shooting a female officer earlier this week. Around 4am on Wednesday (4 December), two officers were called to a disturbance in Cardigan Road when they were confronted by a man at a property.
26-Year-Old Charged With Party Murder
A 26-year-old man has been charged with the murder Jerome Edwards. Edwards, 23, from Catford, south London, was shot in the head at a party in the early hours of Sunday morning. He died in hospital hours after the shooting in Southwell Road, Camberwell.
Libya adopts Chemical Weapons Convention
Weapons inspectors have met with the Libyan government today as the Chemical Weapons Convention, which the country adopted last month, comes into force. A team from the Organisation for the Prohibition of Chemical Weapons (OPCW) were in Tripoli today after Libya became the 159th State to join the convention. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 6,888 |
As the 11th year anniversary of the September 11th 2001 murderous terrorist attack arrives, certainly many people feel that the events of that day must never be forgotten.
I personally hope in some way that in our 21st century where everything is expected yesterday, and it seems that many of our attention spans are often less than the length of a 30 minute sitcom or the length of a 140 character tweet. We will never… NEVERforget the cowardly and demonic acts that were perpetrated against our country, our freedoms and thousands of truly innocent lives. The fight for our freedoms and the safety of ourselves, our loved ones and for our nations future is unfortunately far from over.
I am not seeking revenge, merely justice for those thousands of innocent lives taken by willful men, in pursuit of their own selfish agendas. Their cause was, and is not just, nor is their cause and actions true to the word of ANY God or legitimate prophet. We must remember every innocent victim, every brave rescuer and every brave hero, who died in honor. We must always remember every family that still lives in grief. We must remember the fire and ash, the last phone calls from the hero's on our airplanes and the thousands of funerals of innocent children, loving parents, brothers, sisters, and brave rescuers. | {
"redpajama_set_name": "RedPajamaC4"
} | 4,350 |
var Service = require('node-windows').Service;
var svc = new Service({
name: 'SoS Display Webserver',
description: 'Sanctuary of Self Display Webserver.',
script: 'C:\\Users\\kinectdev\\Desktop\\sos-display\\startup\\http-server'
});
svc.on('install',function(){
svc.start();
});
svc.install();
| {
"redpajama_set_name": "RedPajamaGithub"
} | 7,684 |
Central European countries are a cradle of history and tradition. There's much to discover in every destination from the outstanding palaces of Hungary and the historical and musical vibe of Austria to the beauty and architecture of the Czech Republic and the multisided cities of Poland.
Enjoy the best attractions of Poland's capital, Warsaw, as well as the best sights of charming Krakow and its old town atmosphere in 8 days.
Set off on an exploration of Poland's main treasures from historic Krakow and charming Wroclaw to capital city Warsaw and Gdansk!
Set off to one of Europe's richest countries in terms of unique historical castles and culture, Romania. Explore the region of Transylvania and Dracula attractions as well as the top highlights with best local guide-drivers. Stay at central hotels, and tailor your customizable Romania itinerary around your preferences.
Immerse yourself in the outstanding beauty, culture and architecture as you make your way from the Czech Republic to Austria in 7 days.
Enjoy the beauty of Germany and Austria! Visit outstanding cities like Munich and Vienna, see the Alps in Innsbruck and discover Salzburg.
Discover the highlights of central European towns, boasting authentic historic treasures and luxurious palaces. Enjoy exceptional tours of Vienna, Prague and Krakow, stay in remarkable hotels, leave with beautiful memories! | {
"redpajama_set_name": "RedPajamaC4"
} | 1,825 |
FederalCharges.com
National Federal Defense Lawyer Group
CALL NOW FOR A CASE REVIEW: 1.877.472.5775
International Calls +1-617-472-5775
Criminal Practice Areas
Bitcoin Cryptocurrency
Grand Larceny
Racketeering & RICO
All Charges
Criminal Help Topics
State vs Federal Charges
Federal Target Letter
Arraignment Process
Pre Trial Motions
Grand Jury Investigation
Pre vs Post Indictment
Pre-Sentence Report
Stages of a Criminal Case
Video Arraignment
Non-Prosecution Agreement
Criminal Arraignment FAQ
Sentencing Guidelines
How to Lookup Charges
You must have a pending criminal case, charge or indictment. Inquiries not related will be ignored.
We respect your privacy and we keep all your information private
Home / Federal Crime News / Drug Conspiracy Charges, Laws and Statute of Limitations
Drug Conspiracy Charges, Laws and Statute of Limitations
By Geoffrey Nathan, Esq.
Drug conspiracies are highly complex cases because many people unwittingly end up getting involved in these. Technically, it means two parties agree to break narcotics laws. The burden of proof lies with the prosecution, who have to show that at least two people agreed to the distribution of an illegal substance, and that the accused was aware of the fact that this action was illegal, yet still chose to participate.
Uniquely, drug conspiracy charges can be argued based on circumstantial evidence. A participant's conduct, for instance, can be classed as evidence. Additionally, it is very common for people to be charged with both drug conspiracy and with trafficking, because conspiracy is so much easier to prove and because trafficking inevitably means more than one person was involved.
People can also be found guilty simply because they have knowledge of the plan. Even if they weren't part of the plan from the start or they never held the illegal substances, guilt can still be proven. Essentially, any involvement can be seen as conspiracy, and the only thing that needs to be proven beyond reasonable doubt is that a person was involved. In fact, the prosecution doesn't even have to demonstrate that drugs existed. Intent to distribute is enough to prove guilt. Hence, people could be set up in a sting operation with fake cocaine, and still be found guilty of the offense.
Drug Conspiracy Laws
Each state has its own drug conspiracy laws. However, the federal crime is determined under 21 USC Section 846 Attempt and Conspiracy. Whether a crime is classed as federal depends on the substance, its quantity, and whether people crossed state borders.
Drug Conspiracy Crimes & Charges
As explained, the exact crimes and charges depend on the state. In Illinois, for instance, a drug conspiracy is a Class X felony. This means that those found guilty could face from six to 30 years of imprisonment and they may also have to pay a fine of up to $500,000.
Drug Conspiracy Punishment
Punishment for drug conspiracy depends on the type of drug, the quantity of the drug, the state, and the elements of the conspiracy. Under felony charges, people can face a sentence of ten to life for:
1,000kg or more of marijuana
50gr or more of methamphetamine
1kg or more of heroin
10gr or more of LSD
5kg or more of cocaine
If the amounts are lower, the sentences will also be less severe. Five to 40 years can be imposed for:
100kg or more of marijuana
5gr or more of methamphetamine
100gr or more of heroin
1gr or more of LSD
500gr or more of cocaine
If the drug conspiracy charge is a federal charge, other punishments may also be imposed, including forfeiture or seizure of property. Indeed, this can happen when people are charged, regardless of whether they are found guilty or not. If property is purchased or otherwise obtained through drugs, or used to enable the conspiracy, it will be forfeited. Fines can also be imposed, and these can reach millions of dollars.
Drug Conspiracy Sentencing Guidelines
The sentencing guidelines for drug conspiracy are the same as those for the underlying offense, which means it depends on the drug and the quantity.
Drug Conspiracy Statute of Limitations
The statute of limitations for drug conspiracy charges also varies depending on the state. However, under 21 USC Section 846, which means the drug conspiracy is a federal crime, the statute is five years. However, when the clock starts ticking can be very difficult to determine. Often, it starts on the date of the last time that the accused had any involvement in the conspiracy.
Drug Conspiracy Elements
When looking at a drug conspiracy charge, defense attorneys will look at various elements, particularly the type of drug that was involved and its quantity. They will try to create a timeline of events to indicate what happened and when. They will also try to search for the origins of the drug, trying to show that there was never an involvement by the defendant. Although drug conspiracy is far easier to prove than any other drug crime, the prosecution still has to prove involvement beyond reasonable doubt, so the defense will focus mainly on raising that doubt.
Drug Conspiracy Techniques
Numerous techniques are used to get people involved in drug conspiracies. So much so, in fact, that many people are currently incarcerated when they have had little to no involvement with a conspiracy. For example, they could have shared a house with another person who was a drug dealer and genuinely have been unaware of this. However, by literally being in the wrong place at the wrong time, they could face lengthy sentences in jail. Due to the relentless war on drugs, many people have had to face this very situation.
Additionally, it is quite common for drug dealers and cartels to use innocent people as part of their operations. It is for this very reason that security personnel at airports ask whether people have packed their bags themselves and whether they have been left unattended. Even to this day, dealers and mules at airports still ask strangers to take a bag on their behalf and surprisingly, they are often successful.
Drug Conspiracy Defenses
In order to properly defend a drug conspiracy charge, it is vital that the lawyers involved have a full understanding of the evidence the prosecution has against the alleged offender. The burden of proof beyond a reasonable doubt lies with them, after all. More often than not, attorneys will try to prove that the way in which evidence, including drugs and currency, was obtained, was illegal. For instance, they may suggest that a police officer did not have enough reason to stop a vehicle, or that no consent was given to search a vehicle. Essentially, they will suggest the defendant's rights were violated, which means the evidence that was seized must be suppressed. Other defenses include duress and entrapment, although they are much more difficult to prove.
Drug Conspiracy Cases
Prisoner pleads guilty for role in federal drug conspiracy – Velarian S. Carter, 38, entered a guilty plea to conspiracy to distribute and to possess with intent to distribute more than five kilograms of cocaine, more than 280 grams of crack, and more than 100 grams of heroin. Carter is one of 23 defendants indicted in June 2017 after a comprehensive investigation of drug trafficking in Southern West Virginia.
Fifth Member of Drug Conspiracy Sentenced to 20 Years – Marcus Davis, 37, was an associate of Marvin O'Neal Carter, the former leader of a large-scale cocaine trafficking conspiracy who was sentenced to 27 years in prison on Nov. 2, 2017.
Former IRS Attorney Pleads Guilty to Drug Conspiracy – Jack Vitayanon was arrested in February in Washington, D.C., on charges that he conspired with people in Arizona and Long Island to distribute meth over a number of years.
1995 Report to the Congress: Cocaine and Federal Sentencing Policy. (1995, February). Retrieved from https://www.ussc.gov/research/congressional-reports/1995-report-congress-cocaine-and-federal-sentencing-policy
21 U.S. Code Section 846 – Attempt and conspiracy. (n.d.). Retrieved from https://www.law.cornell.edu/uscode/text/21/846.
Mandatory Minimum Penalties for Drug Offenses in the Federal Criminal Justice System. (2017, October). Retrieved from https://www.ussc.gov/sites/default/files/pdf/research-and-publications/research-publications/2017/20171025_Drug-Mand-Min.pdf
Drug Offenses: Maximum Fines and Terms of Imprisonment for Violation of the Federal Controlled Substances Act and Related Laws. (2015, January 20). Retrieved from https://fas.org/sgp/crs/misc/RL30722.pdf
About Geoffrey Nathan, Esq.
Geoffrey G Nathan is a top federal crimes lawyer and Chief Editor of FederalCharges.com. He is a licensed attorney in the Commonwealth of Massachusetts since 1988, admitted to practice in both Federal and State courts. If you have questions about your federal case he can help by calling 877.472.5775.
View all posts by Geoffrey Nathan, Esq. →
Federal Crime News
What Is A Class B Felony?
Differences Between Class A Misdemeanor Vs Felony
Federal Crime Laws
Breakdown of the Federal Indictment Process
About Geoffrey Nathan Law Offices
Federal cases are serious. You need a highly experienced federal criminal defense lawyer such as attorney Geoffrey Nathan who produces results due to his national profile and representation in the nation's most significant federal indictments: operation iron triangle, crossfire hurricane, operation varsity blues. Due to his reputation for excellence, Attorney Nathan is available to consult with you and can explain how the is able to work within your budget. Get a legal consultation by calling 877.472.5775 now.
Request a Criminal Case Review
Breaking Federal News
Alleged New York City Mobsters Arrested on Federal Charges
Pittsburgh Pirate Pitcher Charged With Child Pornography and Sexual Assault
Florida College Professor Facing Federal Money Laundering Charges
3 Arrested in $7 Million Mortgage Fraud in California
Ex-UAW Offical Pleads Guilty to Federal Charges
Creator of 'My Big Coin,' Randall Crater, Indicted in New York
Pharma Execs Face Drug Trafficking Charges Over Opioid Crisis
Physicians Indicted for Overprescribing Opioids, Trading Drugs for Sex
Hollywood Celebs Charged in Massive College Cheating Scam
Floyd Mayweather and Rapper Charged By SEC For Pumping Cryptocurrencies
SEC Corporate Information
Federal Laws at USA.gov
Criminal Cases UsCourts.gov
All Criminal Laws
International Legal Assistance
Disclaimer: The information contained in this web site is provided as a service to the Internet community but does not constitute legal advice. We try to provide quality information, but we make no claims, promises or guarantees about the accuracy, completeness, or adequacy of the information contained in or linked to this web site and its associated sites. As legal advice must be tailored to the specific circumstances of each case, and laws are constantly changing, nothing provided herein should be used as a substitute for the advice of competent counsel.
Copyright 2019, FederalCharges.com. All Rights Reserved. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 5,884 |
{"url":"https:\/\/math.stackexchange.com\/questions\/3746584\/if-l-lim-n-to-infty-sum-i-1n-1-left-fracin-right2n-what","text":"# If $L=\\lim_{n \\to \\infty} \\sum_{i=1}^{n-1} {\\left(\\frac{i}{n}\\right)}^{2n}$ what is $\\lfloor \\frac{1}{L} \\rfloor$\n\nIf $$L=\\lim_{n \\to \\infty} \\sum_{i=1}^{n-1} {\\left(\\frac{i}{n}\\right)}^{2n}$$What is $$\\lfloor \\frac{1}{L} \\rfloor$$\n\nI really am confuse. Can this be converted into riemman sum? If not what do I do. Answer is $$7$$.\n\n\u2022 Hint: Substitute $i=n-k$ and use the fact that $(1-\\frac{k}{n})^{2n} \\uparrow e^{-2x}$ as $n\\to\\infty$ for $k \\geq 0$. This, this, this, this, and this might help. Jul 5, 2020 at 23:43\n\u2022 These brackets denote the \"floor function\". Jul 5, 2020 at 23:59\n\u2022 @WolfgangKais Of course I know that, I meant the question asks \"What is $\\lfloor \\frac{1}{L} \\rfloor$\"\n\u2013\u00a0user801111\nJul 6, 2020 at 0:45\n\nThe limit is $$L = \\frac{1}{e^2-1}$$ and so $$1\/L = e^2 - 1 \\approx 6.4$$, so the result should be 6.\n\nTo see this, note that the last element of the sum gives $$\\left ( \\frac{n-1}{n} \\right )^{2n} \\to e^{-2},$$ the two last ones give $$\\left ( \\frac{n-2}{n} \\right )^{2n} + \\left ( \\frac{n-1}{n} \\right )^{2n} \\to e^{-4} + e^{-2}$$ and so on. Then $$e^{-2} + e^{-4} + \\cdots = \\frac{1}{e^2-1} = L.$$\n\nOf course, this is not a proof, because there is a whole bunch of inversion of limits that occur. But the argument definitely shows that you have $$\\liminf S_n \\geq L,$$ where I denote the sum by $$S_n$$. But what about the limsup? To see this, you can indeed use a Riemann sum, or rather compare directly with an integral. Draw a picture to see that, for any fixed $$1 \\leq k \\leq n$$ $$\\frac1n \\sum_{i=0}^{n-k} \\left (\\frac{i}{n} \\right)^{2n} \\leq \\int_0^{1-(k-1)\/n} x^{2n} \\: \\mathrm{d}x = \\frac{1}{2n+1} \\left ( 1- \\frac{k-1}{n} \\right )^{2n} ,$$ so $$\\limsup \\sum_{i=0}^{n-k} \\left (\\frac{i}{n} \\right)^{2n} \\leq \\frac12 e^{-2(k-1)}.$$ You therefore get that, by splitting the sum in the $$k - 1$$ last elements and the rest, $$\\limsup S_n \\leq e^{-2} + e^{-4} + \\cdots + e^{-2k+2} + \\frac12 e^{-2k+2},$$ so taking $$k \\to + \\infty$$ gives $$\\limsup S_n \\leq e^{-2} + e^{-4} + \\cdots = \\frac{1}{e^2 - 1} = L,$$ and we are done.","date":"2022-07-01 17:33:06","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 17, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.9766771793365479, \"perplexity\": 122.87460583020514}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 5, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2022-27\/segments\/1656103943339.53\/warc\/CC-MAIN-20220701155803-20220701185803-00282.warc.gz\"}"} | null | null |
Q: How do I insert a \in cross reference across components? I am using ConTeXts project format, with each chapter using its own .tex file.
In chapter 6, I want to refer to [fig05] in chapter 9.
Looking at the wiki for \in there's no discussion of this. But looking at the logs interacting with references, they have two arguments (which show up as [component][reference])
Is there a way to address other components via cross-reference?
A: Looking at the general manual I found mention of a syntax on page 207.
In my environment, I added:
\setuphead[chapter][prefix=+]
Then, in chapter heads, I titled them uniquely:
\chapter[chapter06]{this is a chapter title}
\chapter[chapter09]{this is a different chapter title}
Then, in chapter 6, I can reference figure five b of chapter 9 by
\in[chapter09:fig05b]
so long as I've turned on prefixes and have declared a chapter reference.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 7,532 |
Q: react native possible uhandled promise rejection im getting the following errors
Possible Unhandled Promise Rejection (id: 0):
TypeError: user.slice is not a function. (In 'user.slice()', 'user.slice' is undefined)
I need the code to be able to pass the data too return the list of users in order of most matching elements to least. I was able to get the function working in replit with a made up data base once I try to put it in my project I am getting trouble, please help.
auth().onAuthStateChanged(user => {
if (user) {
// User is signed in, see docs for a list of available properties
// https://firebase.google.com/docs/reference/js/firebase.User
const profile = getUserProfile(user.uid);
profile.then(pro => {
const addy = pro.Address;
setAddress(pro.Address);
const filterdUsers = FBusers.filter(user => {
if(user.Address === addy && user.uid !== p pro.uid){
const items = new Set(pro)
const rank = arr => arr.filter(user => items.has(user)).length
return (a, b) => rank(b.items) - rank(a.items)
}
const sorted = user.slice().sort(filterdUsers(pro))
console.log(sorted.map(user => user.items.join(', ')))
}
)}};
// sort users
//setUsers(sortByMatch);
//vvv delete me vvv
setUsers(filterdUsers);
A: user is an object here and you can't slice an object. You can only slice an array or string
JavaScript Array Slice()
JavaScript String slice()
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 4,337 |
After computers, printers are the most common machine widely used in homes and offices to complete printing tasks. Canon is the largest manufacturer of printers and is liked by the people, because of their excellent quality prints and high-speed printing.
People are aware of canon printers and are satisfied with the products of canon, but when any user get the technical problem with their printer, for them the Canon customer service is always ready.
As the Canon printers well equipped with latest and innovative features, and the brand promises to provide the best quality prints if any customer face problem with their printer, it is not easy to ignore them as the issue will hamper the work. However, the things get easily resolved, dial the Canon printer helpline number and tell the executives of canon printer support to provide an immediate solution for all printer glitches.
Canon printers are user-friendly and are beneficial to use for home and business purpose, as the prints produce by the canon printer cost-effective and along with this if any buyer encounters any printer hitches, then they can quickly get the issue resolved by taking assistance from the experts of Canon technical support.
The experts of Canon Printer Support are talented and are hardworking, and they provide the solution for every major and minor error. Hence the company has offered toll-free Canon printer support number, clients can easily reach the technical team through this number, and this number is active throughout the day and night, so feel free to call and avail Canon printer support to get your issue fixed as early as possible. Here we have penned some of the glitches which are very common and are faced by the users of canon printer.
So if you are also getting irritated by the problems mentioned above, then pick your phone and dial Canon printer support number, as the phone lines are open round the clock to provide the solution for all printer problems.
Through the Canon printer support number, the users can direly commune with the experts of Canon customer service and can get the right direction to solve the printer issues.
The Canon technical support offers authentic and trustworthy customer service to all clients, sometimes there might be a mechanical fault and are not resolved quickly, therefore for all those problems the Canon technical support is ready to guide and provide simple and easy steps so that the users can quickly get back to work.
Through Canon printer support number, the users can get the essential solution for their printer problems, and the professionals of Canon customer service are well trained and have years of experience, therefore for all victims of canon printer, the Canon printer support number is the best solution to get instant relief from their printer issues.
We hope that the information provided in this post on Canon printer Support Number was helpful for all of you, and if you are also using a canon printer and your printer is not working as per your need, then avail Canon printer help from the experts of Canon customer service. Therefore being a customer of canon you have the rights to ask for assistance, hence dial Canon printer support number and get rid of your printer glitches. | {
"redpajama_set_name": "RedPajamaC4"
} | 1,684 |
José Francisco Soares (Conselheiro Lafaiete) é professor brasileiro.. É professor titular aposentado da UFMG, tendo sido presidente do Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira (INEP) entre 2014 e 2016.
Graduado em Matemática pela Universidade Federal de Minas Gerais (UFMG), em 1973. Mestre e doutor em Estatística, respectivamente, pelo Instituto Nacional de Matemática Pura e Aplicada (IMPA), em 1977, e pela Universidade do Wisconsin-Madison, em 1981. Pós-doutor em Educação pela Universidade de Michigan, em 2002.
Biografia
Infância e Juventure
Chico Soares nasceu e passou sua adolescência em Conselheiro Lafaiete, em família de classe média. Soares estudou no Colégio Universitário da Universidade Federal de Minas Gerais, onde manifestou interesse extraordinário sobre as disciplinas vinculadas a números e cálculos. Morou em Conselheiro Lafaiete, Belo Horizonte e depois em Wisconsin, onde fez cursou seu doutorado e pós-doutorado.
Carreira
Professor do Ensino Superior
Logo após concluir sua graduação, 1974, Soares se tornou professor da Universidade Federal de Minas Gerais, e, a medida em que se capacitava, tornava-se uma referência como professor de matemática em todo o Brasil.
A atuação acadêmica de Chico Soares está dirigida na área Avaliação de Sistemas, Instituições, Planos e Programas Didáticos, e Políticas Educacionais, com destaque em ações da valor ediferença dos resultados pedagógicos e cálculo e explicação do efeito das escolas de ensino básico brasileiras. Nestas áreas tem grande produção acadêmica e técnica.
Conselheiro
Chico Soares foi o primeiro presidente da Associação Brasileira de Avaliação Educacional, tendo atuado também, desde os anos 90, como conselheiro de instituições brasileiras como o IBGE, a Capes, o INEP e a FAPEMIG, chegando a atuar como Conselheiro Técnico de instituições de outros países, como o Instituto Nacional para la Evaluación de la Educación do México.
Ministério da Educação
Em 12 de fevereiro de 2014, assumiu a presidência do Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira (INEP) na vaga deixada por Luiz Cláudio Costa que assumiu a secretaria-executiva do Ministério da Educação. Atualmente, Soares compõe o Conselho Nacional de Educação do Brasil e, embora aposentado da UFMG, continua como voluntário nasatividades de pesquisa no Grupo de Avaliação e Medidas Educacionais (Game).
Prêmios
Recebeu o "Prêmio Fundação Bunge" de avaliação educacional de 2012 na categoria "Vida e Obra".
Professores da Universidade Federal de Minas Gerais
Naturais de Conselheiro Lafaiete | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 8,264 |
////////////////////////////////////////////////////////////////////////////////
// internal header
////////////////////////////////////////////////////////////////////////////////
//Windows
//------------------------------------------------------------------------------
//guid
typedef GUID guid;
inline void guid_create(guid& id) throw()
{
HRESULT hr = ::CoCreateGuid(&id);
assert( SUCCEEDED(hr) );
}
inline bool guid_equal(const guid& id1, const guid& id2) throw()
{
return ::IsEqualGUID(id1, id2) ? true : false;
}
//constant
// in header file
#define DECLARE_GUID(name) \
extern "C" const GUID FAR name;
// in cpp file
#define IMPLEMENT_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern "C" const GUID FAR name = { (l), (w1), (w2), { (b1), (b2), (b3), (b4), (b5), (b6), (b7), (b8) } };
// use
#define USE_GUID(name) (name)
//------------------------------------------------------------------------------
//character
typedef CHAR char_a; //ANSI or UTF8
typedef WCHAR char_h; //word or UTF16
typedef unsigned long char_l; //long or UTF32
typedef char_h char_s; //system type, UTF16
//for const string
#define _OS_WIDEN2(x) L##x
#define _OS_WIDEN(x) _OS_WIDEN2(x)
#define _S(x) _OS_WIDEN(x)
typedef char_h char_w; //for wide type, L"..."
//------------------------------------------------------------------------------
//atomic
inline int atomic_increment(int& v) throw()
{
return (int)::InterlockedIncrement((LONG volatile *)(&v));
}
inline int atomic_decrement(int& v) throw()
{
return (int)::InterlockedDecrement((LONG volatile *)(&v));
}
inline int atomic_compare_exchange(int& v, int oldval, int newval) throw()
{
return (int)::InterlockedCompareExchange((LONG volatile *)(&v), newval, oldval);
}
//------------------------------------------------------------------------------
//memory operators
inline void* mem_zero(void* dest, uintptr count) throw()
{
::ZeroMemory(dest, count);
return dest;
}
inline void* mem_fill(byte ch, void* dest, uintptr count) throw()
{
::FillMemory(dest, count, ch);
return dest;
}
inline void* mem_copy(const void* src, uintptr count, void* dest) throw()
{
::CopyMemory(dest, src, count);
return dest;
}
inline void* mem_move(const void* src, uintptr count, void* dest) throw()
{
::MoveMemory(dest, src, count);
return dest;
}
//------------------------------------------------------------------------------
//error code
#define CR_FROM_ERROR(err) ((HRESULT)(((err) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))
//------------------------------------------------------------------------------
//call result
#pragma pack(push, 1)
class call_result
{
public:
call_result() throw() : m_result(S_OK)
{
}
explicit call_result(int res) throw() : m_result((HRESULT)res)
{
}
call_result(const call_result& src) throw() : m_result(src.m_result)
{
}
~call_result() throw()
{
}
//operators
call_result& operator=(const call_result& src) throw()
{
if( this != &src ) {
m_result = src.m_result;
}
return *this;
}
bool operator==(const call_result& right) const throw()
{
return m_result == right.m_result;
}
bool operator!=(const call_result& right) const throw()
{
return !operator==(right);
}
//methods
int GetResult() const throw()
{
return (int)m_result;
}
void SetResult(int res) throw()
{
m_result = (HRESULT)res;
}
//check
bool IsSucceeded() const throw()
{
return SUCCEEDED(m_result);
}
bool IsFailed() const throw()
{
return FAILED(m_result);
}
bool IsOK() const throw()
{
return m_result == S_OK;
}
private:
HRESULT m_result;
};
#pragma pack(pop)
//------------------------------------------------------------------------------
// call result constants
#define CR_S_EOF (ERROR_HANDLE_EOF)
#define CR_S_FALSE (1)
#define CR_OK (0)
#define CR_FAIL E_FAIL
#define CR_OUTOFMEMORY E_OUTOFMEMORY
#define CR_OVERFLOW CR_FROM_ERROR(ERROR_ARITHMETIC_OVERFLOW)
#define CR_SABAD CR_FROM_ERROR(ERROR_DLL_INIT_FAILED)
#define CR_INVALID E_INVALIDARG
#define CR_NOTIMPL E_NOTIMPL
#define CR_NAMETOOLONG CO_E_PATHTOOLONG
#define CR_DISKFULL CR_FROM_ERROR(ERROR_DISK_FULL)
#define CR_FDBAD E_HANDLE
#define CR_CORRUPT STG_E_DOCFILECORRUPT
//------------------------------------------------------------------------------
// Service
// log types
#define SERVICE_LOG_SUCCESS EVENTLOG_SUCCESS
#define SERVICE_LOG_ERROR EVENTLOG_ERROR_TYPE
#define SERVICE_LOG_INFORMATION EVENTLOG_INFORMATION_TYPE
#define SERVICE_LOG_WARNING EVENTLOG_WARNING_TYPE
// report_service_log
// type: SERVICE_LOG_*
inline void report_service_log(const char_s* szService, uint type, const char_s* szMsg) throw()
{
HANDLE hEventSource = ::RegisterEventSourceW(NULL, szService);
if( hEventSource != NULL ) {
::ReportEvent(hEventSource, type, (WORD)0, 0, NULL, (WORD)1, 0, &szMsg, NULL); //no check
::DeregisterEventSource(hEventSource); //no check
}
}
////////////////////////////////////////////////////////////////////////////////
| {
"redpajama_set_name": "RedPajamaGithub"
} | 9,097 |
UPDATED: 9. JAN 2018, AT 9:55
Lawyers: FAQ from Slovak clients
Experts from law firms in Slovakia answer the most frequent questions of their clients concerning business in Slovakia.
Illustrative stock photo (Source: SME)
This set of most frequently asked questions regarding inquiries by clients of law firms is regularly updated. Last update: February 3, 2017.
Q: When does a company have to be registered with the so-called Public Partners Registry and what are its most important duties under the Slovak Anti-Letterbox Companies Act?
Q: Why is it important to gain access to the e-box of the company and to check it regularly?
Q: What are the pros and cons of having a business licence and founding a company? What form of company should I choose?
Q: What does the criminal liability of companies mean?
Q: What does a company in crisis mean in practice?
Q: Is there a chance to recover a debt claim? How long will the process take?
Q: How do I terminate employment?
A: Only those who publicly disclose their beneficial owners (being natural persons) can do business with the public sector. Local or foreign companies are entitled to receive substantial rights, goods or services or financial payments (value of a contract higher than €100,000) from the public sector only in cases where they register their beneficial owners with the respective public online register. The mandatory verification of the beneficial owners shall be exercised prior to the registration and regularly at defined "verification occasions" throughout the year by so-called "professionals".
The main duty of the management of the private company interested in doing business with the public sector is to contract a "professional" – attorney, notary, bank, auditor, etc. and to provide him/her with the cooperation necessary for the identification or verification of the beneficial owners of the company.
Sanctions for infringement include the withdrawal of the public entity from the contract, suspension of consideration, fines, liability of "professionals", removal of the economic profit, cancellation of the registration in the respective register, and "blacklisting" into the register of disqualified persons.
Andrej Leontiev, partner at Taylor Wessing
A: As of July 1, the use of government e-boxes is mandatory for any company registered with the Slovak Commercial Register. For such entities, an e-box was automatically activated and the state authorities are obliged and will communicate with such entities electronically. Therefore it is necessary that the e-box is checked regularly as the state authorities may deliver into it crucial decisions. These will be deemed as delivered by their delivery into the e-box after the lapse of the stated period irrespective of the fact of whether the company has access to the e-box or not. In case the e-box is ignored, a decision may be final, without any possibility to file appeal, and imposing a duty to pay, deliver or perform something, and the company may not even know about it. Ignoring the e-box may cause irreversible damage to the company.
Michal Šimunič, attorney at ČECHOVÁ & PARTNERS
A: The decision concerning the right type of vehicle for a particular project or business depends on various aspects related to that particular business. For example, for an individual running a local business, like a craftsperson, who is directly performing the work and does not have any intentions of expanding the business, it could make sense to keep on running the business in the form of a one-man business. In certain cases, the tax advantages or family status of the entrepreneur might be relevant as well.
In case there are more persons involved in the business and there is potential for further growth, then it would be more suitable for such a business to be carried out through a stand-alone vehicle. In most of the cases the preferred type of vehicle would be either a private limited liability company or a joint stock company. The advantages of establishing the separate vehicle include limitation of liability of the members (shareholders), ability to transfer or to increase/expand the membership (shares) in the vehicle and thus to provide the business with additional funds. The establishment of the vehicle could also be more advantageous from the tax law and accounting point of view. As it is considerably more expensive and administratively burdensome to establish and maintain a joint stock company and since there are practically no differences in the operation possibilities, most investors and entrepreneurs prefer a private limited liability company, unless the law stipulates a particular type of business.
As of January 2017, the simplified joint stock company (new legal form) enables the accommodation of the different interests of different shareholder groups and offers effective ways to agree on special option rights, including employee option schemes.
Radovan Pala, partner at Taylor Wessing
A: Could companies end up behind bars in Slovakia? No, they can't – even if the new Corporate Criminal Liability Act in effect since July 2016 introduced a different approach to corporate crime. A company may be punished with one of nine possible sentences, including dissolution, ban on participation in public tenders, or a monetary penalty up to €1.6 mil. A company may be accused of over 50 possible offences, such as corruption, aggrieving the customer, unfair business practices, offences against the environment or tax and insurance evasion. All of which were chosen to be considered as corporate offences. It may be convicted directly, without the need to prove the fault of, or identify the offending individual. Even acts of ordinary employees may result in criminal liability of a company. Of additional importance is that a company may be held liable for the "sins" of another company it has acquired or merged with, since the liability for criminal offences is assumed by legal successors.
Dominika Bajzathová, lawyer at Kinstellar
(Source: )
A: A company in crisis is defined in the Commercial Code as a company which is bankrupt (i.e. if it is indebted or insolvent) or which is facing impending bankruptcy (if the ratio of its equity to its liabilities is lower than 8:100 / the ratio for 2016 is set to be 4:100 and the ratio for 2017 is set to be 6:100/). In effect, this means that the company in crisis will be prohibited, during the period of crisis, from paying out the so-called external funding, which replaces the company's own resources, from providing company funds to its associates without appropriate consideration, etc. The statutory body of the company in crisis is obliged to take all necessary measures in order for the company to overcome the crisis. The aim is the protection of creditors as well as the prevention against "exploitation" of companies. Nevertheless, only a limited liability company, joint-stock company or limited partnership (if its general partner is not an individual) may become a company in crisis.
Galina Vlčková, junior associate at SOUKENÍK – ŠTRPKA
A: The chance to recover a debt claim depends not only on the court's decision, but particularly on the existence of the debtor's assets. Yet the effective court proceeding does not guarantee the recovery of debt claims. The chance is created by choosing contractual partners in foresight, learning about their solvency from public registers, preparing quality contractual materials or securing claims in an adequate way. The average length of a civil court proceeding was 14-16 months last year, according to the Justice Ministry's statistics, but the time involved is actually longer. The more difficult the dispute is, the higher the risk of court procrastination, ineffective court actions and obstructions of the litigation parties. The new procedural rules offer some space to accelerate the proceedings as they move the duty to submit evidence to the litigants and limit the possibilities of courts to substitute this duty.
Katarína Kováčová, partner at Ružička Csekes
A: The safest way to terminate employment is by a properly drafted mutual agreement, covering all outstanding rights and duties, in particular financial entitlements. This limits the threat of potential claim of the employee for invalidity of termination. If the employment is to be terminated unilaterally by the employer, a favoured option is to terminate the employment based on a decision on so-called organisational changes causing redundancy. If the employee becomes redundant due to the cancellation of their job position, such position cannot be reopened by the employer for two months following the termination of the previous employment. Of course business and life also bring situations where unilateral termination for breach of discipline or bad performance is also needed. As this is a much more challenging exercise, the golden rule in such a case should be to act diligently, have proper grounds and evidence available and to have the stamina for a potential court challenge.
9. Jan 2018 at 8:00
Theme: Frequently asked questions
FAQ: EU Citizens - dealing with immigration authorities
FAQ: Non-EU citizens - dealing with immigration authorities
FAQ: What foreigners ask before relocating to Slovakia?
FAQ: Trade licences and doing business in Slovakia
Frequently asked questions: Working in Slovakia | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 6,443 |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/oto_top_bar_background">
<ImageView android:layout_width="40dp"
android:visibility="gone"
android:id="@+id/oto_conv_room_left_top_img"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:padding="5dp"
android:src="@drawable/oto_unlock"/>
<TextView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="40dp"
android:paddingLeft="40dp"
android:textSize="13dp"
android:textStyle="bold"
android:textColor="#FF0000"
android:singleLine="true"
android:gravity="center"
android:id="@+id/oto_base_tab_title"
android:text="@string/oto_lib_name"/>
</FrameLayout>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:layout_width="fill_parent"
android:layout_height="25dp"
android:id="@+id/oto_conv_detail_admin_only_title"
android:text="@string/oto_conv_detail_admin_only"
android:textSize="12dp"
android:textColor="@android:color/white"
android:gravity="center"
android:background="@android:color/black"/>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:id="@+id/oto_conv_detail_body_list_layout">
<ListView android:id="@+id/oto_conv_detail_body_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/oto_conv_pattern_background"
android:cacheColorHint="#00000000"
android:transcriptMode="disabled"
android:fadingEdge="none"
android:divider="@android:color/black"
android:dividerHeight="0px"/>
<GridView android:id="@+id/oto_conv_detail_body_grid"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="auto_fit"
android:columnWidth="100dp"
android:fadingEdge="none"
android:verticalSpacing="1px"
android:background="#f0f0f0"
android:horizontalSpacing="1px"
android:stretchMode="columnWidth"
android:listSelector="@android:color/transparent"/>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:padding="10dp"
android:layout_margin="5dp"
android:visibility="gone"
android:orientation="horizontal"
android:background="#DFFFFFFF"
android:gravity="center_vertical"
android:id="@+id/oto_conv_detail_body_list_append_layout">
<ImageView android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/oto_friend_img_01"
android:id="@+id/oto_conv_detail_body_list_append_layout_img"/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:paddingLeft="10dp"
android:textSize="15dp"
android:ellipsize="end"
android:singleLine="true"
android:id="@+id/oto_conv_detail_body_list_append_layout_text"
android:text="가나가나가나가나가나가나가나가나가나가나가나가나가간"/>
</LinearLayout>
</FrameLayout>
<ListView android:id="@+id/oto_conv_detail_body_list2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:layout_weight="1.0"
android:background="@drawable/oto_conv_background"
android:cacheColorHint="#00000000"
android:transcriptMode="disabled"
android:divider="@android:color/black"
android:dividerHeight="0px"/>
<RelativeLayout android:layout_width = "fill_parent"
android:layout_height= "fill_parent"
android:layout_weight="1.0"
android:visibility="gone"
android:background="@drawable/oto_conv_background"
android:id="@+id/oto_conv_detail_progress">
<LinearLayout android:layout_width = "wrap_content"
android:layout_height= "wrap_content"
android:orientation="horizontal"
android:layout_centerInParent="true">
<ProgressBar android:layout_width = "17dip"
android:layout_height= "17dip"
android:layout_gravity="center_vertical"/>
<TextView android:layout_width = "wrap_content"
android:layout_height= "wrap_content"
android:textColor="@android:color/black"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dip"
android:textSize="16sp"
android:text="@string/oto_networking"/>
</LinearLayout>
</RelativeLayout>
<TextView android:layout_width = "fill_parent"
android:layout_height= "fill_parent"
android:gravity="center"
android:visibility="gone"
android:background="@drawable/oto_conv_background"
android:textColor="@android:color/black"
android:textSize="16sp"
android:text="@string/oto_com_conv_search_empty"
android:id="@+id/oto_conv_detail_empty"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="gone"
android:background="@android:color/transparent"
android:id="@+id/oto_conv_detail_context_menu">
<View android:layout_width="match_parent" android:layout_height="1px" android:background="#9b9c9d"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="75dp" android:orientation="horizontal"
android:id="@+id/oto_conv_detail_context_menu_top"/>
<View android:layout_width="match_parent" android:layout_height="1px" android:background="#9b9c9d"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="75dp" android:orientation="horizontal"
android:id="@+id/oto_conv_detail_context_menu_bottom"/>
<!-- <View android:layout_width="1px" android:layout_height="fill_parent" android:background="#9b9c9d"/> -->
</LinearLayout>
</FrameLayout>
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="100dp"
android:id="@+id/oto_conv_detail_image_bar_layout"
android:visibility="gone"
android:scrollbars="none"
android:fillViewport="true">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/oto_main_tab_background"
android:id="@+id/oto_conv_detail_image_bar">
</LinearLayout>
</HorizontalScrollView>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:clickable="false"
android:padding="5dp"
android:visibility="gone"
android:id="@+id/oto_conv_detail_best_layout"
android:background="#f0f0f0">
<ImageView android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/oto_close_dark"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_best_close"/>
<Button android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_weight="1.0"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_week_best_btn"
android:text="@string/oto_week_best_like"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
<Button android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_weight="1.0"
android:id="@+id/oto_conv_detail_month_best_btn"
android:text="@string/oto_month_best_like"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:clickable="false"
android:padding="5dp"
android:visibility="gone"
android:id="@+id/oto_conv_detail_my_search_layout"
android:background="#f0f0f0">
<ImageView android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/oto_close_dark"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_my_search_close"/>
<Button android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_weight="1.0"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_my_word_btn"
android:text="@string/oto_tab_my_word"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
<Button android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_weight="1.0"
android:id="@+id/oto_conv_detail_my_reply_btn"
android:text="@string/oto_tab_my_reply"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
android:clickable="false"
android:padding="5dp"
android:id="@+id/oto_conv_detail_search_layout"
android:background="#f0f0f0">
<ImageView android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/oto_close_dark"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_search_close"/>
<Button android:layout_width="wrap_content"
android:minWidth="60dp"
android:layout_height="35dp"
android:layout_marginRight="3dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:id="@+id/oto_conv_detail_search_condition"
android:text="@string/oto_nick_name"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="120dip"
android:background="@drawable/oto_bar_text_box"
android:layout_weight="1.0"
android:textSize="16dip"
android:layout_marginRight="3dp"
android:id="@+id/oto_conv_detail_search_body"
android:scrollbars="vertical"/>
<FrameLayout android:layout_height="35dp"
android:layout_width="40dp"
android:clickable="true"
android:id="@+id/oto_conv_detail_search_button"
android:background="@drawable/oto_yellow_btn_selector">
<ImageView android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/oto_conv_search"/>
</FrameLayout>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:clickable="false"
android:visibility="gone"
android:id="@+id/oto_conv_detail_send_layout_notice"
android:padding="5dp"
android:background="#f0f0f0">
<Button android:layout_width="32dp"
android:layout_height="35dp"
android:layout_marginRight="2dp"
android:id="@+id/oto_conv_detail_option_btn_notice"
android:text="+"
android:textStyle="bold"
android:textSize="25sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
<Button android:layout_width="fill_parent"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_height="35dp"
android:background="@drawable/oto_yellow_btn_selector"
android:text="@string/oto_write_post"
android:id="@+id/oto_conv_detail_send_btn_notice"
android:textStyle="bold"
android:textSize="15dip"
android:textColor="@drawable/oto_base_btn_text_selector"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:clickable="false"
android:id="@+id/oto_conv_detail_send_layout"
android:padding="5dp"
android:background="#f0f0f0">
<Button android:layout_width="32dp"
android:layout_height="35dp"
android:layout_marginRight="2dp"
android:id="@+id/oto_conv_detail_option_btn"
android:text="+"
android:textStyle="bold"
android:textSize="25sp"
android:textColor="@drawable/oto_base_btn_text_selector"
android:background="@drawable/oto_gray_btn_selector"/>
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="120dip"
android:background="@drawable/oto_bar_text_box"
android:layout_weight="1.0"
android:textSize="16dip"
android:layout_marginRight="3dip"
android:id="@+id/oto_conv_detail_body_edit"
android:scrollbars="vertical"/>
<Button android:layout_width="wrap_content"
android:minWidth="60dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_height="35dp"
android:background="@drawable/oto_yellow_btn_selector"
android:text="@string/oto_send"
android:id="@+id/oto_conv_detail_send_btn"
android:textStyle="bold"
android:textSize="15dip"
android:textColor="@drawable/oto_base_btn_text_selector"/>
</LinearLayout>
</LinearLayout>
| {
"redpajama_set_name": "RedPajamaGithub"
} | 8 |
\section{Introduction}
There is currently a rapidly growing literature on the construction of
wavelets systems on the sphere, see for instance \cite{freeden}, \cite{jfaa1}%
, \cite{dahlke}, \cite{poisson}, \cite{rosca}, \cite{jfaa3} and the
references therein. Some of these attempts have been explicitly motivated by
extremely interesting applications, for instance in the framework of
Astronomy and/or Cosmology; concerning the latter, special emphasis has been
devoted to wavelet techniques for the statistical study of the Cosmic
Microwave Background (CMB) radiation (\cite{jfaa2}). CMB can be viewed as
providing observations on the Universe in the immediate adjacency of the Big
Bang, and as such it has been the object of immense theoretical and applied
interest over the last decade \cite{dode2004}.
Among spherical wavelets, particular attention has been devoted to so-called
needlets, which were introduced into the Functional Analysis literature by %
\cite{npw1,npw2}; their statistical properties were first considered by \cite%
{bkmpb}, \cite{bkmp}, \cite{fay08} and \cite{ejslan}. In particular, it has
been shown in \cite{bkmpb} that \ random needlet coefficients enjoy a
capital uncorrelation property: namely, for any fixed angular distance,
random needlets coefficients are asymptotically uncorrelated as the
frequency parameter grows larger and larger. The meaning of this
uncorrelation property must be carefully understood, given the specific
setting of statistical inference in Cosmology. Indeed, CMB can be viewed as
a single realization of an isotropic random field on a sphere of a finite
radius (\cite{dode2004}). The asymptotic theory is then entertained in the
high frequency sense, i.e. it is considered that observations at higher and
higher frequencies (smaller and smaller scales) become available with the
growing sophistication of CMB satellite experiments. Of course,
uncorrelation entails independence in the Gaussian case: as a consequence,
from the above-mentioned property it follows that an increasing array of
asymptotically $i.i.d.$ coefficients can be derived out of a single
realization of a spherical random field, making thus possible the
introduction of a variety of statistical procedures for testing
non-Gaussianity, estimating the angular power spectrum, testing for
asymmetries, implementing bootstrap techniques, testing for
cross-correlation among CMB\ and Large Scale Structure data, and many
others, see for instance \cite{bkmpb}, \cite{bkmp}, \cite{guilloux}, \cite%
{ejslan}, \cite{fay08}, \cite{pietrobon}, \cite{mpb08}, \cite{dela08}, \cite%
{betoule08}, \cite{lan2008}, \cite{rudjord}. We note that the relevance of
high frequency asymptotics is not specific to Cosmology (cf. e.g. financial
data).
Given such a widespread array of techniques which are made feasible by means
of the uncorrelation property, it is natural to investigate to what extent
this property should be considered unique for the construction in \cite%
{npw1,npw2}, or else whether it is actually shared by other proposals. In
particular, we shall focus here on the approach which has been very recently
advocated by \cite{gm}, see also \cite{freeden} for a related setting. This
approach (which we shall discuss in Section 2) can be labelled Mexican
needlets, for reasons to be made clear later. Its analysis is made
particularly interesting by the fact that, as we shall discuss below, the
Mexican needlets can be considered asymptotically equivalent to the
Spherical Mexican Hat Wavelet (SMHW), which is currently the most popular
wavelet procedure in the Cosmological literature (see again \cite{jfaa2}).
As such, the investigation of their properties will fill a theoretical gap
which is certainly of interest for CMB data analysis.
Our aim in this paper is then to investigate the correlation properties of
the Mexican needlets coefficients. The stochastic properties of wavelets
have been very extensively studied in the mathematical statistics
literature, starting from the seminal papers \cite{doukhan, doukhan2}. We
must stress, however, that our framework here is very different: indeed, as
explained earlier we shall be concerned with circumstances where
observations are made at higher and higher frequencies on a single
realization of a spherical random field. As such, no form of mixing or
related properties can be assumed on the data and the proofs will rely more
directly on harmonic methods, rather than on standard probabilistic
arguments.
We shall provide both a positive and a negative result: namely, we will
provide necessary and sufficient conditions for the Mexican needlets
coefficients to be uncorrelated, depending on the behaviour of the angular
power spectrum of the underlying (mean square continuous and isotropic)
random fields. In particular, on the contrary of what happens for the
needlets in \cite{npw1,npw2}, we shall show that there is indeed correlation
of the random coefficients when the angular power spectrum is decaying
faster than a certain limit. However, higher order versions (already
considered in \cite{gm}) of the Mexican needlets can indeed provide
uncorrelated coefficients, depending on a parameter which is related to the
decay of the angular power spectrum. In some sense, a heuristic rationale
under these results can be explained as follows: the correlation among
coefficients is introduced basically by the presence in each of these terms
of random elements which are fixed (with respect to growing frequencies) in
a given realization of the random field, because they depend only on very
large scale behaviour (this is known in the Physical literature as a Cosmic
Variance effect). Because of the compact support in frequency in the
needlets as developed by \cite{npw1, npw2}, these low-frequency components
are always dropped and uncorrelation is ensured. On the other hand, the same
components can be dominant for Mexican needlets, in which cases it becomes
necessary to introduce suitably modified versions which are better localized
in the frequency domain (i.e., they allow less weight on very low frequency
components).
As well-known, there is usually a trade-off between localization properties
in the frequency and real domains, as a consequence of the Uncertainty
Principle (``It is impossible for a non-zero function and its Fourier
transform to be simultaneosuly very small'', see for instance \cite{havin}).
In view of this, an interesting consequence of our results can be loosely
suggested as follows: the better the localization in real domain, the worst
the correlation properties. This is clearly a paradox, and we do not try to
formulate it more rigorously from the mathematical point of view - some
numerical evidence will be collected in an ongoing, more applied work.
However, we hope that the previous discussion will help to shed some light
within the class of needlets; in particular, it should clarify that the
uncorrelation property of wavelets coefficients does not follow at all by
their localization properties in real domain. Indeed, given the fixed-domain
asymptotics we are considering, perfect localization in real space does not
ensure any form of uncorrelation (all random values at different locations
on the sphere have in general a non-zero correlation).
The plan of the paper is as follows: in Section 2 we shall \ review some
basic results on isotropic random fields on the sphere and the (Mexican and
standard) needlets constructions. In Section 3 and 4 we establish our main
results, providing necessary and sufficient conditions for the uncorrelation
properties to hold; in Section 5 we review some statistical applications.
\section{Isotropic Random Fields and Spherical Needlets}
\subsection{Spherical Random Fields}
In this paper, we shall always be concerned with zero-mean, finite variance
and isotropic random fields on the sphere, for which the following spectral
representation holds, in the mean square sense:
\begin{equation}
T(x)=\sum_{lm}a_{lm}Y_{lm}(x)\text{ , }x\in S^{2}, \label{specrap}
\end{equation}%
where $\left\{ a_{lm}\right\} _{l,m},$ $m=-l,...,l$ is a triangular array of
zero-mean, orthogonal, complex-valued (for $m\neq 0$) random variables with
variance $\mathbb{E}|a_{lm}|^{2}=C_{l},$ the angular power spectrum of the
random field. The functions $\left\{ Y_{lm}(x)\right\} $ are the so-called
spherical harmonics, i.e. the eigenvectors of the Laplacian operator on the
sphere \cite{faraut}, \cite{vmk}, \cite{stein}
\begin{eqnarray*}
\Delta _{S^{2}}Y_{lm}(\vartheta ,\varphi ) &=&\left[ \frac{1}{\sin \vartheta
}\frac{\partial }{\partial \vartheta }\left\{ \sin \vartheta \frac{\partial
}{\partial \vartheta }\right\} +\frac{1}{\sin ^{2}\vartheta }\frac{\partial
^{2}}{\partial \varphi ^{2}}\right] Y_{lm}(\vartheta ,\varphi ) \\
&=&-l(l+1)Y_{lm}(\vartheta ,\varphi )
\end{eqnarray*}%
where we have moved to spherical coordinates $x=(\vartheta ,\varphi )$, $%
0\leq \vartheta \leq \pi $ and $0\leq \varphi <2\pi $ . It is a well-known
result that the spherical harmonics provide a complete orthonormal systems
for $L^{2}(S^{2}).$ There are many routes for establishing (\ref{specrap}),
usually by means of Karhunen-Lo\'{e}ve arguments, the Spectral
Representation Theorem, or the Stochastic Peter-Weyl theorem, see for
instance \cite{adler}. The spherical harmonic coefficients $a_{lm}$ can be
recovered by means of the Fourier inversion formula%
\begin{equation}
a_{lm}=\int_{S^{2}}T(x)\overline{Y_{lm}(x)}dx\text{ .} \label{invfor}
\end{equation}%
If the random field is mean-square continuous, the angular power spectrum $%
\left\{ C_{l}\right\} $ must satisfy the summability condition
\begin{equation*}
\sum_{l}(2l+1)C_{l}<\infty \text{ .}
\end{equation*}%
We shall introduce a slightly stronger condition, as follows (see \cite%
{bkmpb, bkmp,fay08,ejslan}).
\begin{condition}
\label{cdA} For all $B>1,$ there exist $\alpha >2,$ and $\left\{
g_{j}(.)\right\} _{j=1,2,...}$ a sequence of functions such that%
\begin{equation}
C_{l}=l^{-\alpha }g_{j}(\frac{l}{B^{j}})>0\text{ , for }B^{j-1}<l<B^{j+1}%
\text{ , }j=1,2,... \label{Specon1}
\end{equation}%
where
\begin{equation*}
c_{0}^{-1}\leq g_{j}\leq c_{0}\text{ for all }j\in \mathbb{N}\text{ , and }%
\sup_{j}\sup_{B^{-1}\leq u\leq B}|\frac{d^{r}}{du^{r}}g_{j}(u)|\leq c_{r}%
\text{ ,}
\end{equation*}%
\begin{equation*}
\text{some }c_{0},c_{1},...c_{M}>0\text{ },\text{ }M\in \mathbb{N}\text{ .}
\end{equation*}
\end{condition}
In practice, random fields such as CMB are not fully observed, i.e. there
are some missing observations in some regions of $S^{2};$ (\ref{invfor}) is
thus unfeasible in its exact form, and this motivates the introduction of
spherical wavelets such as needlets.
\subsection{NPW Needlets}
The construction of the standard needlet system is detailed in \cite%
{npw1,npw2}; we can label this system \emph{NPW needlets} and we sketch here
a few details for completeness. Let $\phi $ be a $C^{\infty }$ function
supported in $|\xi |\leq 1$, such that $0\leq \phi (\xi )\leq 1$ and $\phi
(\xi )=1$ if $|\xi |\leq 1/B$, $B>1$. Define
\begin{equation}
b^{2}(\xi )=\phi (\frac{\xi }{B})-\phi (\xi )\geq 0\text{ so that }\forall
|\xi |\geq 1\text{ },\text{ }\sum_{j=0}^{\infty }b^{2}(\frac{\xi }{B^{j}})=1%
\text{ .} \label{bdef}
\end{equation}%
It is immediate to verify that $b(\xi )\neq 0$ only if $\frac{1}{B}\leq |\xi
|\leq B$. The needlets frame $\left\{ \varphi _{jk}(x)\right\} $ is then
constructed as
\begin{equation}
\varphi _{jk}(x):=\sqrt{\lambda _{jk}}\sum_{l}b(\frac{l}{B^{j}}%
)\sum_{m=-l}^{l}Y_{lm}(\xi _{jk})\overline{Y_{lm}}(x)\text{ .} \label{3}
\end{equation}%
Here, $\left\{ \lambda _{jk}\right\} $ is a set of \emph{cubature weights}
corresponding to \emph{the cubature points} $\left\{ \xi _{jk}\right\} ;$
they are such to ensure that, for all polynomials $Q_{l}(x)$ of degree
smaller than $B^{j+1}$
\begin{equation*}
\sum_{k}Q_{l}(\xi _{jk})\lambda _{jk}=\int_{S^{2}}Q_{l}(x)dx\text{ .}
\end{equation*}%
The main localization property of $\left\{ \varphi _{jk}(x)\right\} $ is
established in \cite{npw1}, where it is shown that for any $M\in \mathbb{N}$
there exists a constant $c_{M}>0$ s.t., for every $\xi \in \mathbb{S}^{2}$:
\begin{equation*}
\left| \varphi _{jk}(\xi )\right| \leq \frac{c_{M}B^{j}}{(1+B^{j}\arccos
\langle \xi _{jk},\xi \rangle )^{M}}\text{ uniformly in }(j,k)\text{ }.
\end{equation*}%
More explicitly, needlets are almost exponentially localized around any
cubature point, which motivates their name. In the stochastic case, the
(random) spherical needlet coefficients are then defined as
\begin{equation}
\beta _{jk}=\int_{\mathbb{S}^{2}}T(x)\varphi _{jk}(x)dx=\sqrt{\lambda _{jk}}%
\sum_{l}b(\frac{l}{B^{j}})\sum_{m=-l}^{l}a_{lm}Y_{lm}(\xi _{jk})\text{ }.
\label{bjk}
\end{equation}%
It is then immediate to derive the correlation coefficient
\begin{eqnarray*}
Corr\left( \beta _{jk},\beta _{jk^{\prime }}\right) &=&\frac{E\beta
_{jk}\beta _{jk^{\prime }}}{\sqrt{E\beta _{jk}^{2}E\beta _{jk^{\prime }}^{2}}%
} \\
&=&\frac{\sqrt{\lambda _{jk}\lambda _{jk^{\prime }}}\underset{l\geq 1}{\sum }%
b^{2}(\frac{l}{B^{j}})\frac{2l+1}{4\pi }C_{l}P_{l}\left( \left\langle \xi
_{jk},\xi _{jk^{\prime }}\right\rangle \right) }{\sqrt{\lambda _{j,k}\lambda
_{j,k^{\prime }}}\underset{l\geq 1}{\sum }b^{2}(\frac{l}{B^{j}})\frac{2l+1}{%
4\pi }C_{l}}\text{ .}
\end{eqnarray*}%
where $P_{l}$ is the ultraspherical (or Legendre) polynomial of order $\frac{%
1}{2}$ and degree $l$; the last step follows from the well-known identity %
\cite{vmk}
\begin{equation*}
L_{l}\left( \left\langle \xi ,\eta \right\rangle \right) :=\overset{l}{%
\underset{m=-l}{\sum }}Y_{lm}\left( \xi \right) \overline{Y_{lm}\left( \eta
\right) }=\frac{2l+1}{4\pi }P_{l}\left( \left\langle \xi ,\eta \right\rangle
\right) \text{ }.
\end{equation*}%
The capital stochastic property for random needlet coefficients is provided
by \cite{bkmpb}, where it is shown that under Condition \ref{cdA} the
following inequality holds%
\begin{equation}
\left| Corr\left( \beta _{jk},\beta _{jk^{\prime }}\right) \right| \leq
\frac{C_{M}}{\left( 1+B^{j}d\left( \xi _{jk},\xi _{jk^{\prime }}\right)
\right) ^{M}},\text{ some }C_{M}>0\text{ , } \label{corr1}
\end{equation}%
where $d\left( \xi _{jk},\xi _{jk^{\prime }}\right) =\arccos \left(
\left\langle \xi _{jk},\xi _{jk^{\prime }}\right\rangle \right) $ is the
standard distance on the sphere.
\subsection{Mexican Needlets}
The construction in \cite{gm} is in a sense similar to NPW needlets in \cite%
{npw1,npw2} (see also \cite{freeden}), insofar as a combination of Legendre
polynomials with a smooth function is proposed; the main difference is that
for NPW\ needlets the kernel is taken to be compactly supported, which
allows on one hand for an exact reconstruction function (needlets make up a
tight frame), at the same time granting exact localization in the
frequency-domain. It should be added, however, that the approach by \cite{gm}
enjoys some undeniable strong points: firstly, it covers general oriented
manifolds and not simply the sphere; moreover it yields Gaussian
localization properties in the real domain. A further nice benefit is that
it can be formulated in terms of an explicit recipe in real space, a feature
which is certainly valuable for practitioners. In particular, as we report
below in the high-frequency limit the Mexican needlets are asymptotically
close to the Spherical Mexican Hat Wavelets, which have been exploited in
several Cosmological papers but still lack a sound stochastic investigation.
More precisely, \cite{gm} propose to replace $b(l/B^{j})$ in (\ref{3}) by $%
f(l(l+1)/B^{2j}),$ where $f(.)$ is some Schwartz function vanishing at zero
(not necessarily of bounded support) and the sequence $\left\{
-l(l+1)\right\} _{l=1,2,...}$ represents the eigenvalues of the Laplacian
operator $\Delta _{S^{2}}.$ In particular, Mexican needlets can be obtained
by taking $f(s)=s\exp (-s),$ so to obtain%
\begin{equation*}
\psi _{jk;1}\left( x\right) =\sqrt{\lambda _{jk}}\underset{l\geq 1}{\sum }%
\frac{l\left( l+1\right) }{B^{2j}}e^{-\frac{l\left( l+1\right) }{B^{2j}}%
}L_{l}\left( \left\langle x,\xi _{jk}\right\rangle \right) \text{ .}
\end{equation*}%
The resulting functions make up a frame which is not tight, but very close
to, in a sense which is made rigorous in \cite{gm}. Exact cubature formulae
cannot hold (in particular, $\left\{ \lambda _{jk}\right\} $ are not exactly
cubature weights in this case), because polynomials of infinitely large
order are involved in the construction, but again this entails very minor
approximations in practical terms. More generally, it is possible to
consider higher order Mexican needlets by focussing on $f(s)=s^{p}\exp (-s),$
so to obtain%
\begin{equation*}
\psi _{jk;p}\left( x\right) :=\sqrt{\lambda _{jk}}\underset{l\geq 1}{\sum }(%
\frac{l(l+1)}{B^{2j}})^{p}e^{-l(l+1)/B^{2j}}L_{l}\left( \left\langle x,\xi
_{jk}\right\rangle \right) \text{ .}
\end{equation*}%
The random spherical Mexican needlet coefficients are immediately seen to be
given by%
\begin{eqnarray*}
\beta _{jk;p} &=&\int_{S^{2}}T\left( x\right) \psi _{jk}\left( x\right)
dx=\int_{S^{2}}\underset{l\geq 0}{\sum }\overset{l}{\underset{m=-l}{\sum }}%
a_{lm}Y_{lm}\left( x\right) \psi _{jk;p}\left( x\right) dx \\
&=&\sqrt{\lambda _{jk}}\underset{l\geq 1}{\sum }(\frac{l(l+1)}{B^{2j}}%
)^{p}e^{-l(l+1)/B^{2j}}\overset{l}{\underset{m=-l}{\sum }}a_{lm}Y_{lm}\left(
\xi _{jk}\right) \text{ },
\end{eqnarray*}%
whence their covariance is%
\begin{equation*}
E\beta _{jk;p}\beta _{jk^{\prime };p}=\sqrt{\lambda _{jk}\lambda
_{jk^{\prime }}}\underset{l\geq 1}{\sum }(\frac{l(l+1)}{B^{2j}}%
)^{p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}P_{l}\left( \left\langle \xi
_{jk},\xi _{jk^{\prime }}\right\rangle \right) .
\end{equation*}%
Throughout this paper, we shall only consider weight functions of the form $%
f(s)=s^{p}\exp (-s).$ It is certainly possible to consider more general
constructions; however this specific shape lends itself to very neat
results, allowing us to produce both upper and lower bounds for the
coefficients' correlation. Also, it makes possible a clear interpretation of
the final results, i.e. the effect of varying $p$ on the structure of
dependence is immediately understood; this is, we believe, a valuable asset
for practitioners. In the sequel, we shall drop the subscript $p$, whenever
possible without risk of confusion.
\ \newline
\begin{remark}
As mentioned earlier, it is suggested from results in (\cite{gm}) that
Mexican needlets provide asymptotically a very good approximation to the
widely popular Spherical Mexican Hat Wavelets (SMHW), which have been used
in many physical papers; the asymptotic analysis of the stochastic
properties of SMHW coefficients is still completely open for research. The
discretized form of the SMHW\ can be written as
\begin{equation*}
\Psi _{jk}(\theta ;B^{-j})=\frac{1}{(2\pi )^{\frac{1}{2}}\sqrt{2}%
B^{-j}(1+B^{-2j}+B^{-4j})^{\frac{1}{2}}}[1+(\frac{y}{2})^{2}]^{2}[2-\frac{%
y^{2}}{2t^{2}}]e^{-y^{2}/4B^{-j2}},
\end{equation*}%
where the coordinates $y=2\tan \frac{\theta }{2}$ follows from the
stereographic projection on the tangent plane in each point of the sphere;
here we take $\theta =\theta _{jk}\left( x\right) :=d(x,\xi _{jk})$. Now
write%
\begin{equation*}
\psi _{jk;p}\left( \theta _{jk}\left( x\right) \right) =\psi _{jk;p}\left(
\theta \right) \text{ ;}
\end{equation*}%
by following the arguments in \cite{gm} and developing their bounds further,
it can be argued that%
\begin{equation}
\left| \Psi _{jk}(\theta ;B^{-j})-K_{jk}\psi _{jk;p}\left( \theta \right)
\right| =B^{-j}O\left( \min \left\{ \theta ^{4}B^{4j},1\right\} \right)
\text{ ,} \label{lan}
\end{equation}%
for some suitable normalization constant $K_{jk}>0.$ Equation (\ref{lan})
suggests that our results below can be used as a guidance for the asymptotic
theory of random SMHW\ coefficients. The validity of this approximation over
relevant cosmological models and its implications for statistical procedures
of CMB\ data analysis are currently being investigated.
\end{remark}
\section{Stochastic properties of Mexican needlet coefficients, I: upper
bounds}
As mentioned in the Introduction, having established ($\ref{corr1}$) opened
the way to several developments for the statistical analysis of spherical
random fields. It is therefore a very important question to establish under
what circumstances these results can be extended to other constructions,
such as Mexican needlets. In this and the following Section, we provide a
full characterization with positive and negative results. We start by
writing the expression for the correlation coefficients, which is given by%
\begin{equation*}
Corr\left( \beta _{j_{1}k_{1}},\beta _{j_{2}k_{2}}\right)
\end{equation*}%
\begin{equation*}
=\frac{\underset{l\geq 1}{\sum }(\frac{l(l+1)}{B^{j_{1}}})^{p}(\frac{l(l+1)}{%
B^{j_{2}}})^{p}e^{-l(l+1)(B^{-2j_{1}}+B^{-2j_{2}})}(2l+1)C_{l}P_{l}\left(
\left\langle \xi _{j_{1}k_{1}},\xi _{j_{2}k_{2}}\right\rangle \right) }{%
\left\{ \underset{l\geq 1}{\sum }(\frac{l(l+1)}{B^{j_{1}}}%
)^{4p}e^{-2l(l+1)/B^{2j_{1}}}(2l+1)C_{l}\right\} ^{1/2}\left\{ \underset{%
l\geq 1}{\sum }(\frac{l(l+1)}{B^{j_{2}}}%
)^{4p}e^{-2l(l+1)/B^{2j_{2}}}(2l+1)C_{l}\right\} ^{1/2}}\text{ .}
\end{equation*}%
We now provide upper bounds on the correlation of random coefficients, as
follows\footnote{%
While finishing this paper, we learned by personal communication that
working independently and at the same time as us, A.Mayeli has obtained a
result similar to Theorem \ref{uno} for the case $j_{1}=j_{2}$, see \cite%
{mayeli}. The statements and the assumptions in the two approaches are not
equivalent and the methods of proofs are entirely different; we believe both
are of independent interest.}.
\begin{theorem}
$\label{uno}$Assume Condition \ref{cdA} holds with $\alpha <4p+2$ and $M\geq
4p+2-\alpha ;$ then there exist some constant $C_{M}>0$
\begin{equation}
\left\vert Corr\left( \beta _{j_{1}k_{1};p},\beta _{j_{2}k_{2};p}\right)
\right\vert \leq \frac{C_{M}}{\left( 1+B^{(j_{1}+j_{2})/2-\log
_{B}(j_{1}+j_{2})/2}d\left( \xi _{jk},\xi _{jk^{\prime }}\right) \right)
^{\left( 4p+2-\alpha \right) }}. \label{3.1}
\end{equation}
\end{theorem}
\begin{proof}
We prove (\ref{3.1}) following some ideas in \cite{npw1}. For notational
simplicity, we focus first on the case where $j_{1}=j_{2};$ we have%
\begin{equation}
Corr\left( \beta _{jk;p},\beta _{jk^{\prime };p}\right) =\frac{\underset{%
l\geq 1}{\sum }(\frac{l\left( l+1\right) }{B^{2j}})^{2p}e^{-2l(l+1)/B^{2j}}%
\frac{2l+1}{4\pi }C_{l}P_{l}\left( \left\langle \xi _{jk},\xi _{jk^{\prime
}}\right\rangle \right) }{\underset{l\geq 1}{\sum }(\frac{l\left( l+1\right)
}{B^{2j}})^{2p}e^{-2l^{2}/B^{2j}}\frac{2l+1}{4\pi }C_{l}}. \label{cor2}
\end{equation}%
Now replace $C_{l}=l^{-\alpha }g_{j}\left( \frac{l}{B^{j}}\right) $ in the
denominator of the above representation, for which we get%
\begin{equation*}
c_{0}^{-1}\frac{B^{-\left( 4p+2-\alpha \right) j}}{4p+2-\alpha }\leq
\sum_{l\geq 1}(\frac{l\left( l+1\right) }{B^{2j}})^{2p}e^{-2l(l+1)/B^{2j}}%
\frac{2l+1}{4\pi }C_{l}\leq c_{0}\frac{B^{-\left( 4p+2-\alpha \right) j}}{%
4p+2-\alpha }\text{ }.
\end{equation*}%
Denoting $\theta =\arccos \left\langle \xi _{j,k},\xi _{j,k^{\prime
}}\right\rangle $, the numerator can be written as%
\begin{equation}
\underset{l\geq 1}{\sum }(\frac{l\left( l+1\right) }{B^{2j}}%
)^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}\frac{1}{\pi }\int_{\theta
}^{\pi }\frac{\sin \left( l+\frac{1}{2}\right) \varphi }{\left( \cos \theta
-\cos \varphi \right) ^{1/2}}d\varphi \label{num}
\end{equation}%
where we have used the Dirichlet-Mehler integral representation for the
Legendre polynomials \cite{gra}.
The following steps and notations are very close to \cite{npw1}. We write%
\begin{eqnarray}
C_{B,g_{j}} &=&\underset{l\geq 1}{\sum }(\frac{l\left( l+1\right) }{B^{2j}}%
)^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }l^{-\alpha }g_{j}\left( \frac{l}{%
B^{j}}\right) \sin \left( l+\frac{1}{2}\right) \varphi \label{cbj} \\
&:&=\frac{1}{2i}\underset{l\geq 1}{\sum }\left( h_{j+}(l)-h_{j-}\left(
l\right) \right) \notag
\end{eqnarray}%
where%
\begin{equation*}
h_{j\pm }(u)=(\frac{u\left( u+1\right) }{B^{2j}})^{2p}\frac{2u+1}{4\pi }%
u^{-\alpha }g_{j}\left( \frac{u}{B^{j}}\right) e^{-2u(u+1)/B^{2j}\pm i(u+%
\frac{1}{2})\varphi }.
\end{equation*}%
By Poisson summation formula, we have%
\begin{equation*}
\underset{l\geq 1}{\sum }h_{j\pm }(l)=\frac{1}{2}\underset{l\in
\mathbb{Z}
}{\sum }h_{j\pm }(l)=\frac{1}{2}\underset{\mu \in
\mathbb{Z}
}{\sum }\widehat{h}_{j\pm }\left( 2\pi \mu \right) \text{ .}
\end{equation*}%
Denote%
\begin{equation}
G_{\alpha ,j}\left( t\right) :=t^{2p-\alpha }g_{j}\left( t\right)
e^{-2t(t+B^{-j})}I_{\left( B^{-j},\infty \right) }\text{ .} \label{gbj}
\end{equation}%
Let us now recall the following standard property of Fourier transforms:%
\begin{equation*}
\left( i\omega \right) ^{k}\frac{d^{m}}{d\omega ^{m}}\widehat{f}\left(
\omega \right) =(\frac{d^{k}}{dx^{k}}\left\{ x^{m}f\left( x\right) \right\}
\widehat{)(}\omega )\text{ }.
\end{equation*}%
Some simple computations yield%
\begin{eqnarray*}
\widehat{h}_{\pm }\left( 2\pi \mu \right) &=&\frac{B^{\left( 1-\alpha
\right) j}}{4\pi }\left\{ \sum_{m=1}^{2p}[2\binom{2p}{m-1}+\binom{2p}{m}%
]B^{-\left( 2p+1-m\right) j}\frac{d^{m}}{d\omega ^{m}}+B^{-\left(
2p+1\right) j}+2\frac{d^{2p+1}}{d\omega ^{2p+1}}\right\} \\
&&\times \int_{-\infty }^{\infty }G_{\alpha ,j}\left( t/B^{j}\right) e^{\pm
i(t+\frac{1}{2})\varphi -it\omega }dt\left| _{\omega =2\pi \mu }\right.
\end{eqnarray*}%
\begin{eqnarray*}
&=&\frac{B^{\left( 2-\alpha \right) j}e^{\pm i\varphi }}{4\pi }\left\{
\sum_{m=1}^{2p}[2\binom{2p}{m-1}+\binom{2p}{m}]B^{-\left( 2p+1-m\right) j}%
\frac{d^{m}}{d\omega ^{m}}\right\} \widehat{G}_{\alpha ,j}\left( \omega
\right) \left| _{\omega =B^{j}\left( 2\pi \mu \mp \varphi \right) }\right. \\
&&+\frac{B^{\left( 2-\alpha \right) j}e^{\pm i\varphi }}{4\pi }\left\{
B^{-\left( 2p+1\right) j}+2\frac{d^{2p+1}}{d\omega ^{2p+1}}\right\} \widehat{%
G}_{\alpha ,j}\left( \omega \right) \left| _{\omega =B^{j}\left( 2\pi \mu
\mp \varphi \right) }\right. ,
\end{eqnarray*}%
where%
\begin{equation*}
\widehat{G}_{\alpha ,j}\left( \omega \right) =\int_{%
\mathbb{R}
}G_{\alpha ,j}\left( t\right) e^{-it\omega }dt\text{ }.
\end{equation*}%
For all positive integers $k\leq M,$ we can obtain%
\begin{equation}
\left| \int_{B^{-j}}^{\infty }\frac{d^{k}}{dt^{k}}\left\{ t^{m}G_{\alpha
,j}\left( t\right) \right\} dt\right| \leq \left\{
\begin{array}{c}
\frac{k\Gamma \left( m+2p-\alpha \right) C_{g}}{L(p,m,\alpha ,k)}B^{-j\left(
2p+1+m-\alpha -k\right) },\text{ for }2p+1-\alpha +m\neq k \\
k\Gamma \left( m+2p-\alpha \right) C_{g}(j\log B)\text{ },\text{ for }%
2p+1-\alpha +m=k%
\end{array}%
\right. \label{intlog}
\end{equation}%
where $C_{g}=\max \left\{ c_{0},...,c_{M}\right\} $ and
\begin{equation*}
L(p,m,\alpha ,k):=\left\{
\begin{array}{c}
\Gamma \left( 2p+1+m-\alpha -k\right) \text{ when }\left( 2p+1+m-\alpha
-k\right) >0\text{ ,} \\
\left( \Gamma \left( k-2p-1-m+\alpha \right) \right) ^{-1}\text{ when }%
\left( 2p+1+m-\alpha -k\right) <0\text{ .}%
\end{array}%
\right.
\end{equation*}%
It should be noticed that our argument here differs from the one in \cite%
{npw1}, because we cannot assume the integrand function on the left-hand
side to be in $L^{1}$ for all $k\leq M.$ Let us now focus on the case where $%
k=4p+2-\alpha ,$ with $m=2p+1;$ we obtain%
\begin{eqnarray*}
&&\left| \frac{d^{2p+1}}{d\omega ^{2p+1}}\widehat{G}_{\alpha ,j}\left(
\omega \right) \right| \left| B^{j}\left( 2\pi \mu -\varphi \right) \right|
^{4p+2-\alpha } \\
&\leq &\left| \int_{B^{-j}}^{\infty }\frac{d^{k}}{dt^{k}}\left\{
t^{2p+1}G_{j}\left( t\right) \right\} dt\right| \leq \left( 4p+2-\alpha
\right) \Gamma \left( 4p+1-\alpha \right) C_{g}(j\log B);
\end{eqnarray*}%
therefore%
\begin{equation*}
\left| \frac{d^{2p+1}}{d\omega ^{2p+1}}\widehat{G}_{\alpha ,j}\left( \omega
\right) \right| \leq \frac{C_{2p+1,\alpha ,g}B^{-j\left( 4p+2-\alpha \right)
+\log _{B}j}}{\left( 2\pi \mu -\varphi \right) ^{4p+2-\alpha }},
\end{equation*}%
where%
\begin{equation*}
C_{2p+1,\alpha ,g}=\left( 4p+2-\alpha \right) \Gamma \left( 4p+1-\alpha
\right) C_{g}\log B\text{ }.
\end{equation*}%
The modifications needed for other cases are obvious and we obtain%
\begin{equation*}
B^{-\left( 2p+1-m\right) j}\left| \frac{d^{m}}{d\omega ^{m}}\widehat{G}%
_{\alpha ,j}\left( \omega \right) \right| \leq \frac{C_{m,\alpha
,g}B^{-j\left( 4p+2-\alpha \right) }}{\left( 2\pi \mu -\varphi \right)
^{4p+2-\alpha }},
\end{equation*}%
where%
\begin{equation*}
C_{m,\alpha ,g}=\frac{\left( 4p+2-\alpha \right) \Gamma \left( m+2p-\alpha
\right) C_{g}}{L(p,m,\alpha ,k)}\text{ }.
\end{equation*}%
Now let $C_{\alpha ,g}=\max \left\{ C_{m,\alpha ,g},\text{ }%
m=0,...,2p+1\right\} ;$ we have%
\begin{eqnarray}
&&\left| \widehat{h}_{\pm }\left( 2\pi \mu \right) \right| \notag \\
&\leq &\frac{B^{\left( 2-\alpha \right) j}}{4\pi }C_{\alpha ,g}\left\{
\sum_{m=0}^{2p}\binom{2p}{m}\frac{B^{-j\left( 4p+2-\alpha \right) }}{\left(
2\pi \mu -\varphi \right) ^{4p+2-\alpha }}+\frac{B^{-j\left( 4p+2-\alpha
\right) +\log _{B}j}}{\left( 2\pi \mu -\varphi \right) ^{4p+2-\alpha }}%
\right\} \notag \\
&\leq &\frac{2^{2p}C_{\alpha ,g}B^{-4pj+\log _{B}j}}{\left( 2\pi \mu \mp
\varphi \right) ^{4p+2-\alpha }},\text{ }\mu =1,2,... \label{newproof}
\end{eqnarray}%
Therefore
\begin{eqnarray*}
\left| C_{B,g_{j}}\right| &\leq &2^{2p}C_{\alpha ,g}\left( \frac{1}{2\varphi
^{4p+2-\alpha }}+\underset{\mu \in N}{\sum }\frac{1}{\left| 2\pi \mu \pm
\varphi \right| ^{4p+2-\alpha }}\right) B^{-4pj+\log _{B}j} \\
&\leq &2^{2p}\left( \frac{1}{2\varphi ^{4p+2-\alpha }}+\left| 4p+1-\alpha
\right| \pi ^{\alpha -4p-1}\right) C_{\alpha ,g}B^{-4pj+\log _{B}j}.
\end{eqnarray*}%
Hence, for the numerator of the correlation we have the bound%
\begin{equation*}
(\ref{num})\leq CB^{-4pj+\log _{B}j}\int_{\theta }^{\pi }\frac{\left( \frac{1%
}{2\varphi ^{4p+2-\alpha }}+\left| 4p+1-\alpha \right| \pi ^{\alpha
-4p-1}\right) }{\left( \cos \theta -\cos \varphi \right) ^{1/2}}d\varphi
\text{ }.
\end{equation*}%
As in \cite{npw1}, when $0\leq \theta \leq \pi /2,$ we can get the following
inequality%
\begin{equation*}
(\ref{num})\leq C_{\alpha ,k,g}B^{-4pj+\log _{B}j}\int_{\theta }^{\pi }\frac{%
\pi ^{\alpha -4p-1}}{0.27\varphi ^{4p+2-\alpha }\left( \varphi ^{2}-\theta
^{2}\right) ^{1/2}}d\varphi \leq C_{1}B^{-4pj+\log _{B}j}\theta ^{\alpha
-4p-2}\text{ }.
\end{equation*}%
If $\pi /2\leq \theta \leq \pi ,$ letting $\widetilde{\theta }=\pi -\theta ,%
\widetilde{\varphi }=\pi -\varphi ,$ we can obtain the same bound. Going
back to (\ref{cor2}), we obtain%
\begin{eqnarray*}
Corr\left( \beta _{j,k},\beta _{j,k^{\prime }}\right) &\leq &C\frac{\theta
^{\alpha -4p-2}B^{-4pj+\log _{B}j}}{B^{\left( 2-\alpha \right) j}} \\
&\leq &C\theta ^{\alpha -4p-2}B^{-\left( j-\log _{B}j\right) \left(
4p+2-\alpha \right) }\rightarrow 0,\text{ }as\text{ }j\rightarrow \infty
\text{ ,}
\end{eqnarray*}
We thus get inequality (\ref{3.1}) for $j_{1}=j_{2}$.
Now let us consider $j_{1}\neq j_{2}.$ As the proof is very similar to the
arguments above, we omit many details.\ In the sequel, for any two sequences
$a_{l},b_{l},$ we write $a_{l}\approx b_{l}$ if and only if $a_{l}=O(b_{l})$
and $b_{l}=O(a_{l}).$
First, we consider the variance of the random coefficients, which can be
represented by:%
\begin{equation*}
\sum (\frac{l(l+1)}{B^{j_{1}}})^{4p}e^{-2l(l+1)/B^{2j_{1}}}(2l+1)C_{l}%
\approx B^{\left( 2-\alpha \right) j_{1}}\left\{ \left(
\int_{B^{-j_{1}}}^{1}+\int_{1}^{\infty }\right) t^{4p+1-\alpha
}e^{-2t(t+B^{-j_{1}})}g_{j_{1}}\left( t\right) dt\right\}
\end{equation*}%
\begin{equation*}
=B^{\left( 2-\alpha \right) j_{1}}\left\{ \frac{c_{0}}{4p+2-\alpha }%
B^{-j_{1}\left( 4p+2-\alpha \right) }+O\left( 1\right) \right\} \text{ };
\end{equation*}%
therefore%
\begin{eqnarray*}
&&\left\{ \underset{l\geq 1}{\sum }(\frac{l(l+1)}{B^{j_{1}}}%
)^{4p}e^{-2l(l+1)/B^{2j_{1}}}(2l+1)C_{l}\right\} ^{1/2}\left\{ \underset{%
l\geq 1}{\sum }(\frac{l(l+1)}{B^{j_{2}}}%
)^{4p}e^{-2l(l+1)/B^{2j_{2}}}(2l+1)C_{l}\right\} ^{1/2} \\
&=&B^{\left( 1-\alpha /2\right) \left( j_{1}+j_{2}\right) }\left\{ \frac{%
c_{0}}{4p+2-\alpha }B^{-j_{1}\left( 4p+2-\alpha \right) }+O\left( 1\right)
\right\} ^{1/2}\left\{ \frac{c_{0}}{4p+2-\alpha }B^{j_{2}\left( 4p+2-\alpha
\right) }+O\left( 1\right) \right\} ^{1/2} \\
&=&O\left( 1\right) B^{\left( 1-\alpha /2\right) \left( j_{1}+j_{2}\right) }%
\text{ .}
\end{eqnarray*}%
Without loss of generality, we can always assume $j_{1}<j_{2}.$ We can
implement the same argument as before, provided we replace $C_{B,g_{j}}$ in (%
\ref{cbj}) by
\begin{eqnarray*}
C_{B,g,j_{1},j_{2}} &=&\underset{l\geq 1}{\sum }(\frac{l\left( l+1\right) }{%
B^{j_{1}+j_{2}}})^{2p}e^{-l(l+1)(B^{-2j_{1}}+B^{-2j_{2}})}\frac{2l+1}{4\pi }%
l^{-\alpha }g_{j_{1}}\left( \frac{l}{B^{j_{1}}}\right) \sin \left( l+\frac{1%
}{2}\right) \varphi \\
&=&:\frac{1}{2i}\underset{l\geq 1}{\sum }\left(
h_{j_{1}j_{2}+}(l)-h_{j_{1}j_{2}-}\left( l\right) \right)
\end{eqnarray*}%
where%
\begin{equation*}
h_{j_{1}j_{2}\pm }(u)=(\frac{u\left( u+1\right) }{B^{j_{1}+j_{2}}})^{2p}%
\frac{2u+1}{4\pi }u^{-\alpha }g_{j_{1}}\left( \frac{u}{B^{j_{1}}}\right)
e^{-u(u+1)(B^{-2j_{1}}+B^{-2j_{2}})\pm i(u+\frac{1}{2})\varphi }.
\end{equation*}%
Again, by Poisson summation formula, we have%
\begin{equation*}
\underset{l\geq 1}{\sum }h_{j_{1}j_{2}\pm }(l)=\frac{1}{2}\underset{l\in
\mathbb{Z}
}{\sum }h_{j_{1}j_{2}\pm }(l)=\frac{1}{2}\underset{\mu \in
\mathbb{Z}
}{\sum }\widehat{h}_{j_{1}j_{2}\pm }\left( 2\pi \mu \right) \text{ .}
\end{equation*}%
Denote%
\begin{equation*}
G_{\alpha ,j_{1}j_{2}}\left( t\right) :=t^{2p-\alpha }g_{j_{1}}\left(
t\right) e^{-t\left( t+B^{-j_{1}}\right) \left( 1+B^{2\left(
j_{1}-j_{2}\right) }\right) }I_{\left( B^{-j_{2}},\infty \right) }\text{ ;}
\end{equation*}%
by the same argument and notation as in (\ref{newproof}), we have%
\begin{eqnarray*}
&&\left| \widehat{h}_{j_{1}j_{2}\pm }\left( 2\pi \mu \right) \right| \\
&=&\!\frac{B^{2p\left( j_{1}-j_{2}\right) +\left( 2-\alpha \right) j_{1}}}{%
4\pi }\left\{ \sum_{m=1}^{2p}[2\binom{2p}{m-1}+\binom{2p}{m}]B^{-\left(
2p+1-m\right) j_{1}}\frac{d^{m}}{d\omega ^{m}}\right\} \widehat{G}_{\alpha
,j_{1}j_{2}}\left( \omega \right) \left| _{\omega =B^{j_{1}}\left( 2\pi \mu
\mp \varphi \right) }\right. \\
&&+\frac{B^{2p\left( j_{1}-j_{2}\right) +\left( 2-\alpha \right)
j_{1}}e^{\pm i\varphi }}{4\pi }\left\{ B^{-\left( 2p+1\right) j_{1}}+2\frac{%
d^{2p+1}}{d\omega ^{2p+1}}\right\} \widehat{G}_{\alpha ,j_{1}j_{2}}\left(
\omega \right) \left| _{\omega =B^{j_{1}}\left( 2\pi \mu \mp \varphi \right)
}\right. \! \\
&\leq &\frac{2^{2p}C_{\alpha ,g}B^{-2p\left( j_{1}+j_{2}\right) +\log
_{B}j_{1}}}{\left( 2\pi \mu \mp \varphi \right) ^{4p+2-\alpha }},\text{ }\mu
=1,2,...
\end{eqnarray*}%
Therefore
\begin{equation*}
\left| C_{B,g_{j_{1}},j_{2}}\right| \leq 2^{2p}C_{\alpha ,g}\left( \frac{1}{%
2\varphi ^{4p+2-\alpha }}+\left| 4p+1-\alpha \right| \pi ^{\alpha
-4p-1}\right) B^{-2p\left( j_{1}+j_{2}\right) +\log _{B}j_{1}}.
\end{equation*}%
It is then straightforward to conclude as in the case where $j_{1}=j_{2},$
to obtain%
\begin{eqnarray*}
Corr\left( \beta _{j_{1},k},\beta _{j_{2},k^{\prime }}\right) &\leq &C\frac{%
\theta ^{\alpha -4p-2}B^{-2p\left( j_{1}+j_{2}\right) +\log _{B}j_{1}}}{%
B^{\left( 1-\alpha /2\right) \left( j_{1}+j_{2}\right) }} \\
&\leq &C\theta ^{\alpha -4p-2}B^{-\left[ \left( j_{1}+j_{2}\right) /2-\log
_{B}\left( j_{1}+j_{2}\right) /2\right] \left( 4p+2-\alpha \right)
}\rightarrow 0,\text{ as }j_{2}\rightarrow \infty \text{ }.
\end{eqnarray*}%
Thus (\ref{3.1}) is established.
\end{proof}
\begin{remark}
By careful manipulation, we can obtain an explicit expression for the
constant $C_{M}$ in (\ref{3.1}), i.e.
\begin{equation*}
C_{M}=2^{2p}\pi ^{M+1}\left( 4p+2-\alpha \right) ^{2}\Gamma \left(
4p+1-\alpha \right) c_{0}C_{g}\log B.\text{ }
\end{equation*}
\end{remark}
The previous result shows that Mexican needlets can enjoy the same
uncorrelation properties as standard needlets, in the circumstances where
the angular power spectrum is decaying ``slowly enough''. The extra log term
in (\ref{3.1}) is a consequence of a standard technical difficulty when
dealing with a boundary case in the integral in (\ref{intlog}).
\ \newline
\begin{remark}
To obtain central limit results for finite-dimensional statistics based on
nonlinear transformations of the Mexican needlets coefficients, it would be
sufficient to consider the case where $j=j^{\prime }.$ The asymptotic
uncorrelation we established in Theorem $\ref{uno}$ is stronger; indeed, for
many applications it is useful to consider different scales $\left\{
j\right\} $ at the same time. Because of this, it is also important to focus
on the correlation of Mexican needlet coefficients at different $j,j^{\prime
}.$ We stress that the need for such analysis was much more limited for
standard needlets; indeed in the latter case, given the compactly supported
kernel $b(.),$ the frequency support of the various coefficients is
automatically disjoint when $\left| j-j^{\prime }\right| \geq 2$, whence
(for completely observed random fields) standard needlet coefficients can be
correlated only for $\left| j-j^{\prime }\right| =1$.
\end{remark}
\section{Stochastic properties of Mexican needlet coefficients, II: lower
bounds}
In this Section, we complete the previous analysis, establishing indeed that
the random Mexican needlets coefficients are necessarily correlated at some
angular distance in the presence of faster memory decay. This is clearly
different from needlets, which are always uncorrelated. As mentioned in the
Introduction, the heuristic rationale behind this duality can be explained
as follows: it should be stressed that we are focussing on high-resolution
asymptotics, i.e. the asymptotic behaviour of random coefficients at smaller
and smaller scales in the same random realization. For such asymptotics, a
crucial role can be played by terms which remain constant across different
scales. In the case of usual needlets, which have bounded support over the
multipoles, terms like these are simply dropped by construction. This is not
so for Mexican needlets, which in any case include components at the lowest
scales. These components are dominant when the angular power spectrum decays
fast, and as such they prevent the possibility of asymptotic uncorrelation.
In particular, we have correlation when the angular power spectrum is such
that $\alpha >4p+2.$
\begin{theorem}
\label{due}Under condition \ref{cdA}, for $\alpha >4p+2$, $\forall $ $%
\varepsilon \in (0,1),$ there exists a positive $\delta \leq \varepsilon
\left( 1+c_{0}^{2}\right) ^{-1/\left( \alpha -4p-2\right) }$ such that
\begin{equation}
\lim_{j\rightarrow \infty }\inf Corr\left( \beta _{jk;p},\beta _{jk^{\prime
};p}\right) >1-\varepsilon \text{ ,} \label{3.2}
\end{equation}%
for all $\left\{ \xi _{jk},\xi _{jk^{\prime }}\right\} $ such that $d(\xi
_{jk},\xi _{jk^{\prime }})\leq \delta $ .
\end{theorem}
\begin{proof}
We first divide the variance of the coefficients into three parts, as follows%
\begin{eqnarray*}
&&\left( \underset{1\leq l<\epsilon _{1}B^{j}}{\sum }+\underset{\epsilon
_{1}B^{j}\leq l<\epsilon _{2}B^{j}}{\sum }+\underset{l\geq \epsilon _{2}B^{j}%
}{\sum }\right) \left( \frac{l\left( l+1\right) }{B^{2j}}\right)
^{2p}e^{-2l\left( l+1\right) /B^{2j}}\frac{2l+1}{4\pi }C_{l} \\
&=&:A_{1j}+A_{2j}+A_{3j}\text{ }.
\end{eqnarray*}%
Intuitively, our idea is to show that the first sum is of exact order $%
O(B^{\left( 2-\alpha \right) j}\times B^{\left( \alpha -4p-2\right)
j})=O(B^{-4pj}),$ while the second two are smaller ($O(B^{\left( 2-\alpha
\right) j})$ and $o(B^{\left( 2-\alpha \right) j})$, respectively). Indeed,
for the first part we obtain easily%
\begin{eqnarray*}
A_{1j} &=&\underset{1\leq l<\epsilon _{1}B^{j}}{\sum }\left( \frac{l\left(
l+1\right) }{B^{2j}}\right) ^{2p}e^{-2l\left( l-1\right) /B^{2j}}\frac{2l+1}{%
4\pi }C_{l}\leq \underset{1\leq l<\epsilon _{1}B^{j}}{2\sum }\frac{l^{4p}}{%
B^{4pj}}\frac{l}{\pi }l^{-\alpha }g_{j}(\frac{l}{B^{j}}) \\
&\leq &2\frac{c_{0}}{\pi }B^{\left( 2-\alpha \right)
j}\int_{B^{-j}}^{\epsilon _{1}}x^{4p+1-\alpha }dx=2\frac{c_{0}\left(
B^{\left( \alpha -4p-2\right) j}-\epsilon _{1}^{4p+2-\alpha }\right) }{\pi
\left( \alpha -4p-2\right) }B^{\left( 2-\alpha \right) j},
\end{eqnarray*}%
and%
\begin{equation*}
\underset{1\leq l<\epsilon _{1}B^{j}}{\sum }\left( \frac{l\left( l+1\right)
}{B^{2j}}\right) ^{2p}e^{-2l\left( l+1\right) /B^{2j}}\frac{2l+1}{4\pi }%
C_{l}\geq \frac{\left( B^{\left( \alpha -4p-2\right) j}-\epsilon
_{1}^{4p+2-\alpha }\right) }{2\pi c_{0}\left( \alpha -4p-2\right) }%
e^{-2\epsilon _{1}^{2}}B^{\left( 2-\alpha \right) j}.
\end{equation*}%
Similarly, for the second part%
\begin{eqnarray*}
\frac{\left( \epsilon _{2}^{4p+2-\alpha }-\epsilon _{1}^{4p+2-\alpha
}\right) }{2\pi \left( \alpha -4p-2\right) c_{0}}e^{-2\epsilon
_{2}^{2}}B^{\left( 2-\alpha \right) j} &\leq &\underset{\epsilon
_{1}B^{j}\leq l<\epsilon _{2}B^{j}}{\sum }\left( \frac{l\left( l+1\right) }{%
B^{2j}}\right) ^{2p}e^{-2l\left( l+1\right) /B^{2j}}\frac{2l+1}{4\pi }C_{l}
\\
&\leq &2\frac{\left( \epsilon _{1}^{4p+2-\alpha }-\epsilon _{2}^{4p+2-\alpha
}\right) }{\pi \left( \alpha -4p-2\right) }c_{0}e^{-2\epsilon
_{1}^{2}}B^{\left( 2-\alpha \right) j}\text{ ,}
\end{eqnarray*}%
and for the third part%
\begin{eqnarray*}
&&\underset{l\geq \epsilon _{2}B^{j}}{\sum }\left( \frac{l\left( l+1\right)
}{B^{2j}}\right) ^{2p}e^{-2l\left( l+1\right) /B^{2j}}\frac{2l+1}{4\pi }%
C_{l}\leq \frac{3c_{0}}{4\pi }B^{\left( 2-\alpha \right) j}\int_{\epsilon
_{2}}^{\infty }x^{4p+1-\alpha }e^{-x^{2}}dx \\
&\leq &\frac{3c_{0}}{4\pi }B^{\left( 2-\alpha \right) j}\epsilon
_{2}^{4p+1-\alpha }\int_{\epsilon _{2}}^{\infty }e^{-x^{2}}dx\leq \frac{%
3c_{0}}{4\pi }\epsilon _{2}^{4p-\alpha }e^{-\epsilon _{2}^{2}}B^{\left(
2-\alpha \right) j},\text{ }\left( \epsilon _{2}>1\right) \text{ }.
\end{eqnarray*}%
The last inequality follows from the asymptotic formula%
\begin{equation*}
\int_{y}^{\infty }e^{-x^{2}/2}dx\thicksim \frac{1}{y}e^{-y^{2}/2},\text{ \ }%
y\rightarrow \infty \text{ }.
\end{equation*}%
We have then that%
\begin{eqnarray*}
\frac{A_{3j}}{A_{1j}} &=&\left\{ \underset{1\leq l<\epsilon _{1}B^{j}}{\sum }%
\left( \frac{l\left( l+1\right) }{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}%
\frac{2l+1}{4\pi }C_{l}\right\} ^{-1} \\
&&\times \left\{ \underset{l\geq \epsilon _{2}B^{j}}{\sum }\left( \frac{%
l\left( l+1\right) }{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi
}C_{l}\right\}
\end{eqnarray*}%
\begin{equation*}
=O(B^{j(4p+2-\alpha )})=o(1)\text{ },\text{ }as\text{ }j\rightarrow \infty
\text{ .}
\end{equation*}%
On the other hand, for any positive $\varepsilon <1,$ if we choose $\epsilon
_{1}=NB^{-j},$ where $N$ is sufficiently large that $N^{4p+2-\alpha }\left(
1+\frac{2}{\varepsilon }c_{0}^{2}\right) <1,$ we obtain that
\begin{equation*}
\frac{\left( B^{\left( \alpha -4p-2\right) j}-\epsilon _{1}^{4p+2-\alpha
}\right) }{c_{0}}>\frac{2}{\varepsilon }\left( \epsilon _{1}^{4p+2-\alpha
}-\epsilon _{2}^{4p+2-\alpha }\right) c_{0}\text{ },\text{ }
\end{equation*}%
whence
\begin{equation*}
\frac{A_{2j}}{A_{1j}}<\frac{\varepsilon }{2}\text{ as }j\rightarrow \infty
\text{ }.
\end{equation*}%
Thus we obtain that%
\begin{eqnarray*}
\left\{ \underset{l\geq 1}{\sum }\left( \frac{l\left( l+1\right) }{B^{2j}}%
\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}\right\} ^{-1} &=&%
\frac{1}{A_{1j}}\left\{ 1+\frac{A_{2j}}{A_{1j}}+\frac{A_{3j}}{A_{1j}}%
\right\} ^{-1} \\
&\geq &\frac{1}{A_{1j}}\left\{ 1+\frac{\varepsilon }{2}+o(1)\right\} ^{-1} \\
&\geq &cB^{-4pj},\text{ some }c>0\text{ .}
\end{eqnarray*}%
More explicitly, the variance at the denominator has the same order as for
the summation restricted to the elements in the range $1\leq l<\epsilon
_{1}B^{j}.$
To analyze the numerator, we start by recalling that%
\begin{equation*}
\sup_{\theta \in \lbrack 0,\pi ]}P_{l}(\cos \theta )=P_{l}(\cos 0)=1\text{ },%
\text{ and }\sup_{\theta \in \lbrack 0,\pi ]}|\frac{d}{d\theta }P_{l}(\cos
\theta )|\leq 3l\text{ }.
\end{equation*}%
As a consequence, for any $\varepsilon >0$ there exists a $\delta >0,$ s.t.
if $0<\theta \leq \delta \leq \varepsilon /6N,$ then,%
\begin{equation*}
\left| P_{l}(\cos \theta )-P_{l}(\cos 0)\right| \leq 3l\theta \leq
\varepsilon \text{ ,}
\end{equation*}%
for all $l>N,$ where the above inequalities follow from
\begin{equation*}
0\leq \cos \left( \theta _{0}+\theta \right) -\cos \theta _{0}=2\sin ^{2}%
\frac{\theta }{2}\leq \theta \text{ , }\forall \text{ }\theta _{0}\in
\lbrack 0,2\pi )\text{ .}
\end{equation*}%
Therefore, for any $\xi _{jk},\xi _{jk^{\prime }}\in S^{2}$ s.t. $\arccos
\left\langle \xi _{jk},\xi _{jk^{\prime }}\right\rangle \leq \delta ,$ we
have
\begin{equation*}
Corr\left( \beta _{jk},\beta _{jk^{\prime }}\right) =\frac{\underset{l\geq 1}%
{\sum }\left( \frac{l\left( l+1\right) }{B^{2j}}\right)
^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}P_{l}\left( \left\langle \xi
_{jk},\xi _{jk^{\prime }}\right\rangle \right) }{\underset{l\geq 1}{\sum }%
\left( \frac{l\left( l+1\right) }{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}%
\frac{2l+1}{4\pi }C_{l}}
\end{equation*}%
\begin{eqnarray*}
&\geq &\frac{\underset{1\leq l\leq N}{\sum }\left( \frac{l\left( l+1\right)
}{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}C_{l}P_{l}(\cos 0)}{\underset{l\geq
1}{\sum }\left( \frac{l\left( l+1\right) }{B^{2j}}\right)
^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}} \\
&&-\frac{\underset{1\leq l\leq N}{\sum }\left( \frac{l\left( l+1\right) }{%
B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}\left|
P_{l}\left( \left\langle \xi _{jk},\xi _{jk^{\prime }}\right\rangle \right)
-P_{l}(\cos 0)\right| }{\underset{l\geq 1}{\sum }\left( \frac{l\left(
l+1\right) }{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}}
\\
&&+\frac{\underset{l>N}{\sum }\left( \frac{l\left( l+1\right) }{B^{2j}}%
\right) ^{2p}e^{-2l(l+1)/B^{2j}}C_{l}\left| P_{l}\left( \left\langle \xi
_{jk},\xi _{jk^{\prime }}\right\rangle \right) \right| }{\underset{l\geq 1}{%
\sum }\left( \frac{l\left( l+1\right) }{B^{2j}}\right)
^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}}
\end{eqnarray*}%
\begin{eqnarray*}
&\geq &\frac{\underset{1\leq l\leq N}{\sum }\left( \frac{l\left( l+1\right)
}{B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}\times
(1-\varepsilon )}{\underset{l\geq 1}{\sum }\left( \frac{l\left( l+1\right) }{%
B^{2j}}\right) ^{2p}e^{-2l(l+1)/B^{2j}}\frac{2l+1}{4\pi }C_{l}}%
+O(B^{j(4p+2-\alpha )}) \\
&=&\frac{(1-\varepsilon )}{1+\varepsilon /2}+o\left( 1\right)
=(1-\varepsilon ^{\prime })+o\left( 1\right) \text{ },\text{ as }%
j\rightarrow \infty \text{ },\text{ }\varepsilon ^{\prime }=\frac{%
3\varepsilon }{2+\varepsilon }\text{ .}
\end{eqnarray*}%
Thus the proof is completed.
\end{proof}
\
As mentioned earlier, the results in the previous two Theorems illustrate an
interesting trade-off between the localization and correlation properties of
spherical needlets. In particular, we can always achieve uncorrelation by
choosing $p>(\alpha -2)/4$; of course $\alpha $ is generally unknown and
must be estimated from the data (in this sense standard needlets have better
robustness properties). Introducing higher order terms implies lowering the
weight of the lowest multipoles, i.e. improving the localization properties
in frequency space. On the other hand, it may be expected that such an
improvement of the localization properties in the frequency domain will lead
to a worsening of the localization in pixel space, as a consequence of the
Uncertainty Principle we mentioned in the Introduction (see for instance %
\cite{havin}). We do not investigate this issue here, but we shall provide
some numerical evidence on this phenomenon in an ongoing work.
\ \newline
\begin{remark}
In Theorem $\ref{due}$, we decided to keep the assumptions as close as
possible to Theorem \ref{uno}, in order to ease comparisons and highlight
the symmetry between the two results. However, it is simple to show that the
correlation result holds in much greater generality, for angular power
spectra that have a decay which is faster than polynomial. In particular,
assume that%
\begin{equation*}
C_{l}=H(l)\exp (-l^{p})\text{ , }l=1,2,...
\end{equation*}%
where $H(l)$ is any kind of polynomial such that $H(l)>c>0$ and $p>0.$ Then
it is simple to establish the same result as in Theorem \ref{due}, by means
of a simplified version of the same argument. The underlying rationale
should be easy to get: for exponentially decaying power spectra the
dominating components are at the lowest frequencies, and they introduce
correlations among all random coefficients which cannot be neglected.
\end{remark}
\section{Statistical Applications}
The previous results lend themselves to several applications for the
statistical analysis of spherical random fields, in particular with a view
to CMB\ data analysis. Similarly to \cite{bkmpb}, let us consider
polynomials functions of the normalized Mexican needlets coefficients, as
follows%
\begin{equation*}
h_{u,N_{j}}:=\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}%
\sum_{q=1}^{Q}w_{uq}H_{q}(\widehat{\beta }_{jk;p})\text{ , }\widehat{\beta }%
_{jk;p}:=\frac{\beta _{jk;p}}{\sqrt{E\beta _{jk;p}^{2}}}\text{ , }u=1,...,U%
\text{ ,}
\end{equation*}%
where $H_{q}(.)$ denotes the $q$-th order Hermite polynomials (see \cite{s}%
), $N_{j}$ is the cardinality of coefficients corresponding to frequency $j$
(where we take $\left\{ \xi _{jk}\right\} $ to form a $B^{-j}$-mesh, see %
\cite{bkmp}, so that $N_{j}\approx B^{2j})$, and $\left\{ w_{uq}\right\} $
is a set of deterministic weights that must ensure these statistics are
asymptotically nondegenerate, i.e.
\negthinspace\ \newline
\begin{condition}
\label{invert} There exist $j_{0}$ such that for all $j>j_{0}$%
\begin{equation*}
rank(\Omega _{j})=U\text{ , }\Omega _{j}:=Eh_{N_{j}}h_{N_{j}}^{\prime }\text{
, }h_{N_{j}}:=(h_{1,N_{j}},...,h_{U,N_{j}})^{\prime }\text{ .}
\end{equation*}
\end{condition}
\
Condition ($\ref{invert})$ is a standard invertibility assumption which will
ensure our statistics are asymptotically nondegenerate (for instance, it
rules out multicollinearity). Several examples of relevant polynomials are
given in \cite{bkmpb}; for instance, given a theoretical model for the
angular power spectrum $\left\{ C_{l}\right\} ,$ it is suggested in that
reference that a goodness-of-fit statistic might be based upon%
\begin{eqnarray*}
\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}H_{2}(\widehat{\beta }_{jk;p}) &=&%
\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}(\widehat{\beta }_{jk;p}^{2}-1) \\
&=&\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}(\frac{\beta _{jk;p}^{2}}{\lambda
_{jk}\underset{l\geq 1}{\sum }b^{2}(\frac{l}{B^{j}})\frac{2l+1}{4\pi }C_{l}}%
-1)\text{ .}
\end{eqnarray*}%
The statistic%
\begin{equation*}
\widehat{\Gamma }_{j}=\frac{1}{N_{j}}\sum_{k=1}^{N_{j}}\frac{\beta
_{jk;p}^{2}}{\lambda _{jk}}
\end{equation*}%
can then be viewed as an unbiased estimator for
\begin{equation*}
\Gamma _{j}=E\widehat{\Gamma }_{j}=\underset{l\geq 1}{\sum }b^{2}(\frac{l}{%
B^{j}})\frac{2l+1}{4\pi }C_{l}\text{ .}
\end{equation*}%
We refer to \cite{fay08}, \cite{dela08} for the analysis of this estimator
in the presence of missing observations and noise, and for its application
to CMB data in the standard needlets case. Our results below can be viewed
as providing consistency and asymptotic Gaussianity (for fully observed maps
and without noise) in the Mexican needlets approach. As always in this
framework, consistency has a non-standard meaning, as we do not have
convergence to a fixed parameter, but rather convergence to unity of the
ratio $\widehat{\Gamma }_{j}/\Gamma _{j}$.
Likewise, tests of Gaussianity could be implemented by focussing on the
skewness and kurtosis of the wavelets coefficients (see for instance \cite%
{jfaa2}), i.e. by focussing on%
\begin{eqnarray*}
\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}\left\{ H_{3}(\widehat{\beta }%
_{jk;p})+H_{1}(\widehat{\beta }_{jk;p})\right\} &=&\frac{1}{\sqrt{N_{j}}}%
\sum_{k=1}^{N_{j}}\widehat{\beta }_{jk;p}^{3}\text{ and } \\
\frac{1}{\sqrt{N_{j}}}\sum_{k=1}^{N_{j}}\left\{ H_{4}(\widehat{\beta }%
_{jk;p})+6H_{2}(\widehat{\beta }_{jk;p})\right\} &=&\frac{1}{\sqrt{N_{j}}}%
\sum_{k=1}^{N_{j}}\left\{ \widehat{\beta }_{jk;p}^{4}-3\right\} \text{ .}
\end{eqnarray*}%
The joint distribution for these statistics is provided by the following
results:
\ \newline
\begin{theorem}
\label{statapp} Assume $T$ is a Gaussian mean square continuous and
isotropic random field; assume also that Conditions \ref{cdA}, \ref{invert}
are satisfied and choose $p>(\alpha +\delta )/4,$ some $\delta >0.$ Then as $%
N_{j}\rightarrow \infty $%
\begin{equation*}
\Omega _{j}^{-1/2}h_{N_{j}}\rightarrow _{d}N(0,I_{U})\text{ .}
\end{equation*}
\end{theorem}
\begin{proof}
The asymptotic behaviour of our polynomial statistics can be established by
means of the method of moments. In particular, it is possible to exploit the
diagram formula for higher order moments of Hermite polynomial, as explained
for instance in \cite{np},\cite{s}. The details are the same as in \cite%
{bkmpb}, and thus they are omitted for brevity's sake. We only note that, in
order to be able to use Lemma 6 in that reference, we need to ensure that%
\begin{equation*}
\left\vert Corr\left( \beta _{jk;p},\beta _{jk^{\prime };p}\right)
\right\vert \leq \frac{C}{\left( 1+B^{j}d\left( \xi _{jk},\xi _{jk^{\prime
}}\right) \right) ^{2+\delta }}\text{ , some }C>0\text{ .}
\end{equation*}%
In view of (\ref{3.1}), this motivates the tighter limit we need to impose
on the value of $p.$
\end{proof}
\negthinspace
It may be noted that the covariance matrix $\Omega _{j}$ can itself be
consistently estimated from the data at any level $j,$ for instance by means
of the bootstrap/subsampling techniques that are detailed in \cite{bkmp}.
Again, the arguments of that paper lend themselves to straightforward
extensions to the present circumstances, as they rely uniquely upon the
covariance inequalities for the random wavelet coefficients. Likewise, the
previous results may be extended to cover statistical functionals over
different frequencies, for instance the bispectrum (\cite{ejslan,m2007}). A
much more challenging issue relates to the relaxation of the Gaussianity
assumptions, which is still under investigation.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 5,856 |
Q: Connection between Fisher information and variance of score function The fisher information's connection with the negative expected hessian at $\theta_{MLE}$, provides insight in the following way: at the MLE, high curvature implies that an estimate of $\theta$ even slightly different from the true MLE would have resulted in a very different likelihood.
$$
\mathbf{I}(\theta)=-\frac{\partial^{2}}{\partial\theta_{i}\partial\theta_{j}}l(\theta),~~~~ 1\leq i, j\leq p
$$
This is good, as that means that we can be relatively sure about our estimate.
The other connection of Fisher information to variance of the score, when evaluated at the MLE is less clear to me.
$$ I(\theta) = E[(\frac{\partial}{\partial\theta}l(\theta))^2]$$
The implication is; high Fisher information -> high variance of score function at the MLE.
Intuitively, this means that the score function is highly sensitive to the sampling of the data. i.e - we are likely to get a non-zero gradient of the likelihood, had we sampled a different data distribution. This seems to have a negative implication to me. Don't we want the score function = 0 to be highly robust to different sampling of the data?
A lower fisher information on the other hand, would indicate the score function has low variance at the MLE, and has mean zero. This implies that regardless of the sampling distribution, we will get a gradient of log likelihood to be zero (which is good!).
What am I missing?
A: Depending on which definition of the Fischer information you use, your intuition can mislead you. I will argue that one can make equally valid nonrigorous intuitive arguments that large Fischer information is bad or good. But, in the end, it is really mathematics that gives the correct answer.
Let $l(\theta|X) := \frac{d}{d\theta} \log p_{\theta}(X)$ denote the score function of some parametric density $p_{\theta}$. For simplicity, we assume $\theta$ is real-valued.
Definition 1 and its Intuition (High Fischer information is "bad"!)
One definition of Fischer information is
$$I(\theta_0) = Var_{\theta_0} \Big[l(\theta_0|X) \Big].$$
Noting that $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) \approx_d N(0, I(\theta_0)/n)$, this would mean that the empirical score equation at $\theta = \theta_0$ has larger variance as the Fischer information increases. Since the MLE $\theta_n$ is obtained by solving $\frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i) = 0$, a smaller Fischer information, and therefore having the score $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i)$ being less variable, would seem like a good thing. A small variance would mean that $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) \approx 0$ with high probability and thus $\theta_0$ is an approximate MLE, right? This intuition is incorrect and it is based upon the flawed assumption that if $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i)$ is close to $0=\frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i)$ then $\theta_n$ is close to $\theta_0$. Note to argue that the two scores being close implies that $\theta_n$ and $\theta_0$ are close requires performing a taylor expansion where the derivative $\frac{1}{n}\sum_{i=1}^n \frac{dl}{d\theta}(\theta_0|X_i) \approx E_{\theta_0}\Big[\frac{dl}{d\theta}(\theta_0|X_i)\Big]$ will appear. The larger this derivative is the better a bound we can obtain on $|\theta_n - \theta_0|$. However, by the next definition, the variance of the score is equal to the expectation of its derivative, and therefore decreasing the Fischer information leads to a smaller variance of the score (which is a "good" thing) but at the same time must lead to a decrease of the derivative of the score (which is a "bad" thing). We will revisit this argument later in more detail.
Definition 2 and its Intuition (High Fischer information is "good"!)
The next equivalent definition of Fischer information is
$$I(\theta_0) = -E_{\theta_0}\Big[\frac{dl}{d\theta}(\theta_0|X)\Big] = E_{\theta_0}\Big[\frac{d^2 \log p_{\theta}}{d\theta^2}(X)\big|_{\theta = \theta_0}\Big].$$
This definition intuitively suggests that when the Fischer information is large that the score $\theta \mapsto \frac{1}{n}\sum_{i=1}^n\frac{dl}{d\theta}(\theta|X_i)$ is highly sensitive to the value of $\theta$. In particular, it suggests that if $\theta$ has a score close to $0$ then it must be fairly close to $\theta_0$. Since the MLE attempts to solve $\frac{1}{n}\sum_{i=1}^n\frac{dl}{d\theta}(\theta_n|X_i) = 0$, this suggests the MLE will have a smaller variance as the Fischer information increases. However, this intuition implicitly assumes that $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i)$ remains close to $0$ with high probability as the derivative of the score increases. However, as we will see, this is also not true. So this intuition is also flawed (although, this intuition by happenstance does give the correct answer).
Which intuition is correct?
So the above two intuitions for the different definitions of the Fischer information seem to be odds with one another. The truth is both these intuitions are not taking into account the full picture. This is the danger of nonrigorous intuitive arguments. The best way to solve this is to make the arguments in both intuitions rigorous.
I will derive that the asymptotic variance of the (scaled and centered) MLE $\sqrt{n}(\theta_n - \theta_0)$ is given by the following. See the proof afterward for why this formula of the variance of the MLE is quite natural/canonical (in comparison to $1/I(\theta_0)$). For the sake of the argument, pretend you did not know that $Var_{\theta_0}\big( l(\theta_0|X_i)\big) = E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X_i) \big]$, which my proof does not assume (nor did the intuitive arguments make use of).
The asymptotic variance of $\sqrt{n}\Big( \theta_0 - \theta_n\Big)$ is
$$\sigma^2 = \frac{Var_{\theta_0}\big( l(\theta_0|X)\big)}{E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]^2}.$$
We can now explain what went wrong/right with the two "intuitive" arguments. From the above, it is clear that $Var_{\theta_0}\big( l(\theta_0|X)\big)$ increasing (with all else held fixed) leads to a higher variance of the MLE ("BAD"). On the other hand, if we increase $E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]$ (with all else held fixed), we will get a smaller variance of the MLE ("GOOD"). Thus, our intuitive arguments, which implicitly assume all else is held fixed, are not flawed perse. However, they are made in a world that doesn't exist: the imaginary world where $-E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]$ and $Var_{\theta_0}\big( l(\theta_0|X)\big)$ are not connected (i.e. variation independent). But, the fact of the matter is, that these two objects are equal to one another and are equal to the Fischer information $I(\theta_0)$. So in fact, we have
$$\sigma^2 = \frac{Var_{\theta_0}\big( l(\theta_0|X)\big)}{E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]^2} = \frac{1}{I(\theta_0)},$$
which implies that larger Fischer information is indeed good and leads to a smaller variance of the MLE. But, none of the intuitive arguments made this the obvious result to me.
A quick semi-rigorous intuitive argument
Let $\theta_n$ be the MLE. We know $\frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i) = 0$. We also know $\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) \approx_d N\Big(0, Var_{\theta_0}(l(\theta_0|X)/n) \Big).$
Thus, the two scores are usually around
$$\frac{1}{n}\sum_{i=1}^n \big[l(\theta_0|X_i) - l(\theta_n|X_i)\big] \approx \sqrt{Var_{\theta_0}(l(\theta_0|X)) /n}$$
apart. We also know that
$$ l(\theta_0|X) - l(\theta_n|X) \approx \frac{dl}{d\theta}(\theta_0|X)(\theta_0 - \theta_n).$$
So $\theta_n - \theta_0$ is usually around
$$\theta_n - \theta_0 \approx \frac{\frac{1}{n}\sum_{i=1}^n \big[l(\theta_0|X_i) - l(\theta_n|X_i)\big]}{E_{\theta_0}\frac{dl}{d\theta}(\theta_0|X)}$$
apart.
So, we get
$$\theta_n - \theta_0 \approx \frac{\sqrt{Var_{\theta_0}(l(\theta_0|X))/n }\big]}{E_{\theta_0}\frac{dl}{d\theta}(\theta_0|X)},$$
where the RHS happens to equal $\frac{1}{\sqrt{I(\theta_0)}}$.
A mostly rigorous proof
I will be slightly nonrigorous here. Let $\theta_n$ be the MLE. We then have
$$\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) = \frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) - \frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i) ,$$
since $\frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i) = 0$. By performing a taylor expansion of the RHS, we find
$$ \frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) - \frac{1}{n}\sum_{i=1}^n l(\theta_n|X_i) = \frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) - l(\theta_n|X_i) = \frac{1}{n}\sum_{i=1}^n \frac{dl}{d\theta}(\theta_0|X_i)\Big( \theta_0 - \theta_n\Big) + R_n, $$
where the remainder $R_n = o_P(\theta_0 - \theta_n)$ satisfies $\frac{R_n}{|\theta_0 - \theta_n|} \rightarrow_n 0. $
Putting it together, we have so far shown
$$\frac{1}{n}\sum_{i=1}^n l(\theta_0|X_i) = \Big( \theta_0 - \theta_n\Big) \frac{1}{n}\sum_{i=1}^n \frac{dl}{d\theta}(\theta_0|X_i)+ R_n,$$
which implies
$$\frac{1}{\sqrt{n}}\sum_{i=1}^n l(\theta_0|X_i) = \sqrt{n}\Big( \theta_0 - \theta_n\Big) \frac{1}{n}\sum_{i=1}^n \frac{dl}{d\theta}(\theta_0|X_i)+ \sqrt{n}R_n.$$
Applying the law of large numbers to $\frac{1}{n}\sum_{i=1}^n \frac{dl}{d\theta}(\theta_0|X_i)$, we find
$$\frac{1}{\sqrt{n}}\sum_{i=1}^n l(\theta_0|X_i) = \sqrt{n}\Big( \theta_0 - \theta_n\Big) E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X_i) \big] + \sqrt{n}\tilde{R}_n,$$
where $\sqrt{n}\tilde{R}_n = o_P(\sqrt{n}|\theta_n - \theta_0|) = o_P(1)$ if we assume $\theta_n$ is $\sqrt{n}$-consistent (as is usually the case). Now, since $ l(\theta_0|X)$ is mean-zero, we can apply the CLT to find
$$N\Big(0, Var_{\theta_0}\big( l(\theta_0|X_i)\big) \Big) \approx_d \sqrt{n}\Big( \theta_0 - \theta_n\Big) E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X_i) \big]$$
which implies
$$\sqrt{n}\Big( \theta_0 - \theta_n\Big) \approx_d N\Bigg(0, \frac{Var_{\theta_0}\big( l(\theta_0|X_i)\big)}{E_{\theta_0}\big[\frac{dl}{d\theta}(\theta_0|X_i) \big]^2} \Bigg).$$
We have just derivated the limiting distribution of $\sqrt{n}\Big( \theta_0 - \theta_n\Big)$ but notice the form of the RHS.
Model Mispecification
In a mispecified model, where the true data-generating distribution $p_0$ is not equal to $p_{\theta}$ for any $\theta$, the identity $E_{p_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big] = Var_{p_0}\big( l(\theta_0|X)\big)$ is no longer true
where $\theta_0$ is such that $p_{\theta_0}$ is the best model approximation of the true density $p_0$. The MLE is still well-defined and is a consistent estimator for $\theta_0$ with asymptotic variance given by
$$\sigma^2 = \frac{Var_{p_0}\big( l(\theta_0|X)\big)}{E_{p_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]^2}.$$
In this case, we are free to change the true density $p_0$ as we see fit. So in principle, we may actually be able to choose $\theta_0$ and $p_0$ in a way such that $Var_{p_0}\big( l(\theta_0|X)\big)$ decreases while $E_{p_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]$ increases. In this case, both intuitive arguments are then correct. We want a smaller (true) variance of the score $ l(\theta_0|X)$ and we want a larger expectation of the derivative $\frac{dl}{d\theta}(\theta_0|X)$. Note in this case, the Fischer information is defined to be $I(\theta_0) := -E_{p_0}\big[\frac{dl}{d\theta}(\theta_0|X) \big]$, in which case, a larger magnitude Fischer information is still good!
This example especially highlights how subtle the interpretation of the Fischer information really can be in the correctly specified case depending on the definition you use.
Here is a nonrigorous "intuitive" argument for the MLE has smaller variance when the variance of the score is larger
The following argument is super nonrigorous as to make it rigorous would require some heavy-duty smooth functional analysis.
Let $\theta$ be extended to a functional as $\theta(\log p_{\theta'}) := \theta'$. Assuming $\theta$ is a one-to-one parameterization of the statistical model. Then, $\theta$ is a well-defined invertible mapping.
Suppose that
$$\frac{d}{d\theta} \log p_{\theta}(X) \Big |_{\theta = \theta_0}$$
is large in magnitude (e.g. high variance, which is a type of norm). This suggests (by the inverse function theorem) that
$$\frac{d\theta(\log p_{\theta})}{d \log p_{\theta}}(X) \Big |_{\log p_{\theta} = \log p_{\theta_0}} = \frac{1}{\frac{d}{d\theta} \log p_{\theta}(X) \Big |_{\theta = \theta_0}}$$
is small in magnitude. In particular, $\theta$, viewed as a function of $\log p \in \left\{ \log p_{\theta}: \theta \in \Theta\right\}$, is a smooth/flat mapping at $\log p_{\theta_0}$. In particular, this suggests if $\log p_{\theta_0}$ is close to $\log p_{\theta_n}$ in some sense (e.g expectation) then $\theta_0$ is close to $\theta_n$. Noting that $\theta_n$, being an MLE, attempts to make $\frac{1}{n}\sum_{i=1}^n \log p_{\theta_n}(X_i) \approx E_{\theta_0} \log p_{\theta_n}(X) $ close to $\frac{1}{n}\sum_{i=1}^n \log p_{\theta_0}(X_i) \approx E_{\theta_0} \log p_{\theta_0}(X)$, this would suggest the MLE $\theta_n$ is close to $\theta_0$ when the variance/magnitude of the score is large. In other words, higher
Fischer information makes the MLE be "closer" to $\theta_0$.
A similar argument works for the other definition (and is essentially already mentioned in the other answers).
A: I think it helps to consider a situation where the two quantities are different
Suppose $U(\theta)$ is an unbiased estimating function, so that
$$E_{P_{\theta_0}}[U(\theta_0)]=0$$
and you solve
$$U(\theta)=0$$
to estimate $\theta$.
The variance of $\hat\theta$ (assuming enough smoothness) is $H^{-1}JH^{-1}$, where the sensitivity matrix $H$ is
$$H=\frac{\partial U}{\partial \theta}$$
and the variability matrix $J$ is
$$J=\mathrm{var}[U].$$
We clearly want to have $H$ as large as possible and $J$ as small as possible, but we are limited by the ways they are connected. For example, if we multiply $U$ by a scalar $c$, we multiple $H$ by the same $c$ and $J$ by $c^2$, and there is no net effect.
For maximum likelihood estimators we have $H=J$ and they are both the Fisher information. This isn't telling us that we want $J$ to be large. We want $H$ to be large and $J$ to be small, but the best we can do in that direction is to have them be equal. If you have some other unbiased estimating function, you can scale it so that $H$ equals the Fisher information, and $J$ will then be larger than the Fisher information, giving a larger total variance for $\hat\theta$
A:
Intuitively, this means that the score function is highly sensitive to the sampling of the data. i.e - we are likely to get a non-zero gradient of the likelihood, had we sampled a different data distribution. This seems to have a negative implication to me. Don't we want the score function = 0 to be highly robust to different sampling of the data?
That is not the correct intuition for the score function. Remember that the score function is a derivative with respect to the parameter, not the data. The Fisher information is defined as the variance of the score, but under simple regularity conditions it is also the negative of the expected value of the second derivative of the log-likelihood. So, if we write the log-likelihood as $\ell(\theta | \mathbf{X})$ and the score function as $s(\theta | \mathbf{X})$ (i.e., with explicit conditioning on data $\mathbf{X}$) then the Fisher information is:
$$\mathcal{I}(\theta) = -\mathbb{E} \Bigg( \frac{\partial^2 \ell}{\partial \theta^2} (\theta | \mathbf{X}) \Bigg) = -\mathbb{E} \Bigg( \frac{\partial s}{\partial \theta} (\theta | \mathbf{X}) \Bigg).$$
The thing to note here is that the derivatives are taken with respect to the parameter, not the data. So, we can see that a high (magnitude) value for the Fisher information means that the score function is, on average, highly sensitive to the parameter value, not the data. If the score function is highly sensitive to the parameter value, this means that the root of the equation (which is the MLE) is relatively insensitive to the parameter, and so the MLE has lower variance.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 29 |
{"url":"http:\/\/www.fairfieldfootlighters.org\/nowplaying","text":"Written by Tommy Lee Johnston\nDirected by John Vanderplough\nProduced by Dan Schindler\n\nABOUT THE SHOW: Geezers introduces us to some beautiful and wonderful old people who are enjoying their golden years in a retirement home. Jack, a pathologically shy, 27-year-old man, begins a job there helping the seniors with their daily needs. But it's the \"geezers\" who wind up helping Jack with his needs. A funny, heartwarming drama about growth and wisdom, learning and loving, life and death.\n\n____________________________________________\n\nThe Cast:\n\n\u2022 JACK . . . . . . . . . . . . . . . . . . Jacob Spicer\n\n\u2022 GINA . . . . . . . . . . . . . . . . . . Marijo Farley\n\n\u2022 RAY . . . . . . . . . . . . . . . . . . . Dan Schindler\n\n\u2022 YOUNG RAY. . . . . . . . . . . . Matthew Wick\n\n\u2022 KATE . . . . . . . . . . . . . . . . . . Peggy Allen\n\n\u2022 YOUNG KATE . . . . . . . . . . Ali Lander\n\n\u2022 NEIL . . . . . . . . . . . . . . . . . . DIck Bell\n\n\u2022 YOUNG NEIL . . . . . . . . . . . Clayton Eschenbrenner\n\n\u2022 EMILY . . . . . . . . . . . . . . . . . Diane Minnich Weber\n\n\u2022 JENNY . . . . . . . . . . . . . . . . Missy Frazier\n\nPerformances:\nSeptember 20-21, 27-28 at 8PM and September 22 & 29 at 2PM\n\nFairfield Footlighters is proud to be a former Grant Recipient of the Fairfield Community Foundation.","date":"2019-07-23 11:29:03","metadata":"{\"extraction_info\": {\"found_math\": false, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.8544420003890991, \"perplexity\": 372.8179661178229}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 20, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2019-30\/segments\/1563195529276.65\/warc\/CC-MAIN-20190723105707-20190723131707-00437.warc.gz\"}"} | null | null |
Cargo is a 2006 thriller film. It was directed by Clive Gordon, produced by Andrea Calderwood and Juan Gordon, and written by Paul Laverty. The film features the actors Peter Mullan, Daniel Brühl, Luis Tosar, Samuli Edelmann and Gary Lewis.
Plot
Cargo tells the tale of a young man who has gotten into trouble in Africa and because of this he decides to stow away on a cargo ship leaving for Europe. During this voyage, sailors on the ship began to disappear with no apparent reason and the ship's depraved captain seems to have the answers.
References
External links
2006 films
2006 crime thriller films
2006 psychological thriller films
Seafaring films
Films scored by Stephen Warbeck | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,657 |
module.exports = (function (_) {
"use strict";
/*jslint unparam: true*/
function hasMethod(name) {
return {
onParam: function (param) {
return function () {
var args = _.toList(arguments),
which = args[param],
prop = which[name];
return prop ? typeof prop === "function" : false;
};
}
};
}
return {
fmap: _.multi(2)
.method(hasMethod("map").onParam(1), function (f, m) {
return m.map(f);
}),
join: function (m) { return m.mbind(_.id); },
destructure: function (adt) { return adt.destructure(); }
};
}(require("./core"))); | {
"redpajama_set_name": "RedPajamaGithub"
} | 4,704 |
Q: paginator django Возможно уже кто-то подобное делал, нужно средствами обычного django paginator сделать подобное (жирным выделена активная страница, остальные ссылки на страницы):
1 2 3 ... 7 8 9 10 11 ... 41 42 43
или
1 2 3 ... 41 42 43
или
1 2 3 4 5 ... 41 42 43
A: Посоветую вам вместо django'вского использовать django-pagination.
Легко подключить, и гибко настравается
в settings.py
INSTALLED_APPS = (
# ...
'pagination',
)
...
MIDDLEWARE_CLASSES = (
# ...
'pagination.middleware.PaginationMiddleware',
)
в шаблоне
#подключить тег
{% load pagination_tags %}
...
#разбить массив на страницы
{% autopaginate object_list 10 %}
...
#вывести пагинатор
{% paginate %}
Для кастомизации пагинатора вам надо перегрузить шаблон templates/pagination/pagination.html
{% if is_paginated %}
{% load i18n %}
<div class="pagination">
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}" class="prev">‹‹ {% trans "previous" %}</a>
{% else %}
<span class="disabled prev">‹‹ {% trans "previous" %}</span>
{% endif %}
{% for page in pages %}
{% if page %}
{% ifequal page page_obj.number %}
<!-- Вот здесь в вашем случае выводится текущая страница -->
<!-- можно добавить <b> или <strong> или попросту ничего не -->
<!-- перегружать, а описать класс current -->
<span class="current page">{{ page }}</span>
{% else %}
<a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page">
{{ page }}</a>
{% endifequal %}
{% else %}
...
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}{{ getvars }}{{ hashtag }}"
class="next">{% trans "next" %} ››</a>
{% else %}
<span class="disabled next">{% trans "next" %} ››</span>
{% endif %}
</div>
{% endif %}
A: вот что вам нужно, с использованием foundation 5:
<div class="row">
<div class="large-3 large-offset-5 columns">
<ul class="pagination">
{% if articles.has_previous %}
<li class="arrow"><a href="/page/{{ articles.previous_page_number }}/">«</a></li>
{% else %}
<li class="arrow unavailable"><a href="">«</a></li>
{% endif %}
{% for page in articles.paginator.page_range %}
{% if page == articles.number %}
<li class="current"><a href="/page/{{ page }}/">{{ page }}</a></li>
{% else %}
<li><a href="/page/{{ page }}/">{{ page }}</a> </li>
{% endif %}
{% endfor %}
{% if articles.has_next %}
<li class="arrow"><a href="/page/{{ articles.next_page_number }}/">»</a></li>
{% else %}
<li class="arrow unavailable"><a href="">»</a></li>
{% endif %}
</ul>
</div>
</div>
A: У меня было подобное:
{% for page in p.page_range|p_filter %}
{% if page == '...' %}
{# ... #}
{% elif page == request.GET.page %}
{# current #}
{% else %}
{# other_page #}
{% endfor %}
templatetags.py
@register.filter()
def p_filter(page_page)
Ваша логика обработки page_range :)
return [1, 2, 3 , '...', 33, 34, 35]
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 8,500 |
So you need a ton of storage space for your high-resolution videos from Blackmagic, RED or other cinema cameras? The Lacie 6big RAID Array has you covered. It supports 60TB of storage space. It delivers up to 1400MB/s speeds for 4K video.
The unit has a dual Thunderbolt 3 ports for daisy chaining dual 4K displays. It has redundant fans and an aluminum enclosure. | {
"redpajama_set_name": "RedPajamaC4"
} | 2,614 |
Q: Router wifi password encryption types and why do they matter? up until now i've just been blindly following articles etc. to set my router's wifi password encryption type to WPA2-PSK/AES, but what does it really mean for me? does this just make it harder for people to hack my password with whatever algorithms they're using? say for example, if my password is Blink281, what does changing the encryption type to say WPA-PSK really do?
not a really tech savvy guy:(
thanks
A: What does it really mean for me?
for example, if my password is Blink281, what does changing the encryption type to say WPA-PSK really do?
Using WPA-PSK would make your password very easy to crack:
*
*WPA-PSK is not secure (compared to WPA2 + AES)
*Your password is also too short and not complex enough. More about this later.
WPA2 + AES is the most secure encryption. It makes it harder (but not impossible) for hackers to crack your WiFi password.
This is a basic list ranking the current Wi-Fi security methods
available on any modern (post-2006) router, ordered from best to
worst:
*
*WPA2 + AES
*WPA + AES
*WPA + TKIP/AES (TKIP is there as a fallback method)
*WPA + TKIP
*WEP
*Open Network (no security at all)
The difference between the different encryption methods is explained below.
What else can I do to maximise WiFi security?
To maximise security you should also:
*
*Disable Wi-Fi Protected Setup (WPS) on your router, as this provides an attack vector for both WPA and WPA2.
*Choose a stronger password:
*
*Blink281 is too short.
*It uses a restricted set of characters (no special characters like !@#$%^&*()_+ etc).
*See below for more detailed information.
The Difference Between WEP, WPA, and WPA2 Wireless Encryption (and Why It Matters)
Wired Equivalent Privacy (WEP)
Wired Equivalent Privacy (WEP) is the most widely used Wi-Fi security
algorithm in the world. This is a function of age, backwards
compatibility, and the fact that it appears first in the encryption
type selection menus in many router control panels.
WEP was ratified as a Wi-Fi security standard in September of 1999.
The first versions of WEP weren't particularly strong, even for the
time they were released, because U.S. restrictions on the export of
various cryptographic technology led to manufacturers restricting
their devices to only 64-bit encryption. When the restrictions were
lifted, it was increased to 128-bit. Despite the introduction of
256-bit WEP encryption, 128-bit remains one of the most common
implementations.
Despite revisions to the algorithm and an increased key size, over
time numerous security flaws were discovered in the WEP standard and,
as computing power increased, it became easier and easier to exploit
them. As early as 2001 proof-of-concept exploits were floating around
and by 2005 the FBI gave a public demonstration (in an effort to
increase awareness of WEP's weaknesses) where they cracked WEP
passwords in minutes using freely available software.
Despite various improvements, work-arounds, and other attempts to
shore up the WEP system, it remains highly vulnerable and systems that
rely on WEP should be upgraded or, if security upgrades are not an
option, replaced. The Wi-Fi Alliance officially retired WEP in 2004.
Wi-Fi Protected Access (WPA)
Wi-Fi Protected Access was the Wi-Fi Alliance's direct response and
replacement to the increasingly apparent vulnerabilities of the WEP
standard. It was formally adopted in 2003, a year before WEP was
officially retired. The most common WPA configuration is WPA-PSK
(Pre-Shared Key). The keys used by WPA are 256-bit, a significant
increase over the 64-bit and 128-bit keys used in the WEP system.
Some of the significant changes implemented with WPA included message
integrity checks (to determine if an attacker had captured or altered
packets passed between the access point and client) and the Temporal
Key Integrity Protocol (TKIP). TKIP employs a per-packet key system
that was radically more secure than fixed key used in the WEP system.
TKIP was later superseded by Advanced Encryption Standard (AES).
Despite what a significant improvement WPA was over WEP, the ghost of
WEP haunted WPA. TKIP, a core component of WPA, was designed to be
easily rolled out via firmware upgrades onto existing WEP-enabled
devices. As such it had to recycle certain elements used in the WEP
system which, ultimately, were also exploited.
WPA, like its predecessor WEP, has been shown via both
proof-of-concept and applied public demonstrations to be vulnerable to
intrusion. Interestingly the process by which WPA is usually breached
is not a direct attack on the WPA algorithm (although such attacks
have been successfully demonstrated) but by attacks on a supplementary
system that was rolled out with WPA, Wi-Fi Protected Setup (WPS),
designed to make it easy to link devices to modern access points.
Wi-Fi Protected Access II (WPA2)
WPA has, as of 2006, been officially superseded by WPA2. One of the
most significant changes between WPA and WPA2 was the mandatory use of
AES algorithms and the introduction of CCMP (Counter Cipher Mode with
Block Chaining Message Authentication Code Protocol) as a replacement
for TKIP (still preserved in WPA2 as a fallback system and for
interoperability with WPA).
Currently, the primary security vulnerability to the actual WPA2
system is an obscure one (and requires the attacker to already have
access to the secured Wi-Fi network in order to gain access to certain
keys and then perpetuate an attack against other devices on the
network). As such, the security implications of the known WPA2
vulnerabilities are limited almost entirely to enterprise level
networks and deserve little to no practical consideration in regard to
home network security.
Unfortunately, the same vulnerability that is the biggest hole in the
WPA armor, the attack vector through the Wi-Fi Protected Setup (WPS),
remains in modern WPA2-capable access points. Although breaking into a
WPA/WPA2 secured network using this vulnerability requires anywhere
from 2-14 hours of sustained effort with a modern computer, it is
still a legitimate security concern and WPS should be disabled (and,
if possible, the firmware of the access point should be flashed to a
distribution that doesn't even support WPS so the attack vector is
entirely removed).
Source HTG Explains: The Difference Between WEP, WPA, and WPA2 Wireless Encryption (and Why It Matters)
Wireless Security – Choosing the best Wi-Fi Password
Currently, the best security setting for your home or office WiFi is
WPA2. WPA2 Enterprise is the best if your organization supports it,
but WPA2 Personal is great for home and small offices. Do not use WEP.
It has been cracked a long time ago, and an attacker does not even
have to crack it, the WEP key can be passed just like NTLM passwords.
The most common technique used for WPA/WPA2 hacking is a dictionary
attack. The attacker captures a WPA password handshake and passes this
through a program that will try numerous passwords from a word list.
Here is the key, if the password is not in the word list, they hacker
does not get into your system.
Using a lengthy complex password goes a long way in keeping your WPA2
network secure. A combination of upper/lower case letters, numbers and
special characters is the best bet. Some prefer using a short sentence
that means something to them, while replacing some of the letters with
numbers and adding in a few extra characters.
For example: M0untainD3wI$G00d4u!
The nice thing about passwords like this is that it actually means
something to you, so it will be much easier to remember.
I just ran one common word list attack against my WPA2 password. It
tried over 1 million word combinations from the list with no dice. My
network is still secure!
The more un-dictionary looking your password is, the better!
Source Wireless Security – Choosing the best Wi-Fi Password
Further Reading
*
*Is a longer WiFi password more secure?
*How To Create the Most Secure Wireless Passwords Ever
A: Wireless security standards are not about encrypting your password, they're about using a password to generate keys and then to use those keys to encrypt your traffic and authenticate your clients
An encryption password is like a key to a lock. The lock doesn't secure its key, the lock secures your house or car or safe deposit box.
Wireless security schemes such as WPA2-PSK are not encryption for your password, they're encryption for your traffic; they scramble the contents of your packets before they're transmitted by the radio, so that anyone listening in can't see what you're doing on the network.
They are also methods of authentication/authorization: Clients that can prove they know the password are considered the true and authorized clients of that network.
But they do have an effect on the crackability of your password or key
Just like a good lock shouldn't reveal any details of what its key looks like, a good encryption scheme shouldn't leak any information about your password, or make your password easy to brute-force.
There are ways in which password-based wireless encryption schemes can have an effect on how easy it is for someone to use brute force (lots of guesses as quickly as possible) to find your password.
In short, WPA2-PSK takes your password and scrambles it together with your network name to generate a long, hard-to-predict key in a very large key space. It does this using a computationally intensive algorithm designed to slow down how many brute-force guesses an attacker can compute per second.
It also makes sure that your password (or key it generates from your password), encrypted or not, is not transmitted across the air. No information about your key is leaked by the authentication or encryption processes, so attackers aren't given any information they can use to speed up brute-force password-guessing. So for attackers to try to brute-force your key, they have to actually try to authenticate against your AP again and again, and your AP can blacklist them or at least throttle the rate of authentication attempts, making it take ridiculously long to try to guess every possible password.
In the bad old days of WEP, WEP didn't have any of these protections. It usually used your password as your key, keys were short, and its authentication method leaked a simply-encrypted copy of your key each time a client joined the network. An attacker could grab that simply-encrypted key and load it on a fast computer (or cloud computing system) and make brute-force key guesses at extremely high rates.
A note on WPA-PSK
You asked what downgrading from WPA2-PSK (AES-CCMP) to WPA-PSK (TKIP) would really do. It would just make you less secure by using less-well-designed protocols for authentication and encryption.
WEP had been based on an encryption algorithm called RC4, but it used RC4 extremely poorly. But the 802.11 chipsets of those days only had hardware to do RC4, so any solution for WEP's flaws needed to make use of RC4, just use it in a much better way. That's what TKIP and WPA did.
But at the same time as WPA/TKIP was being rushed out to patch up WEP, weaknesses in RC4 were being discovered and the new, more secure AES algorithm was arriving on the crypto scene, so it was clear that the way forward would be to build AES hardware into 802.11a-era (2002+) and 802.11g-era (2003+) chipsets. So WPA2 with AES came out right on the heels of WPA, making original WPA obsolete by the end of 2003.
There were vanishingly few Wi-Fi devices that could do WPA/TKIP but not WPA2/AES, and those few devices were 802.11b-only and couldn't even handle joining a mixed 802.11b/g network very well when WPA/TKIP was enabled, and they were probably all off of the market before 2004. It also turns out that leaving WPA/TKIP compatibility mode enabled in a WPA2/AES network increases complexity and exposes bugs, especially bugs that break multicast and service discovery. So unless you have a 1999-2002 Mac with an 802.11b AirPort card, or a similar era 802.11b Lucent WaveLAN, Agere ORiNOCO, or Sony VAIO 802.11b card, you should use pure WPA2-only mode.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 4,004 |
\section{Introduction}
Increasing the inter-class distance is at the heart of the majority of loss functions and projection algorithms designed in the machine learning community. However, as the Newton's Third Law of Motion states that for every action, there is an equal and opposite reaction; increasing the inter-class distance often affects the intra-class distance as well. In both the cases, maintaining equilibrium between the two forces or the two criterion functions is an important challenge.
\begin{figure}[t]
\centering
\includegraphics[scale = 0.85]{Images/Intro_Image_CIFAR_10.pdf}
\caption{Illustration of class equilibrium on the CIFAR-10 dataset. t-SNE visualization of training data points in (a) input space and (b) equilibrium space. In input space, the classes are overlapped while in equilibrium space, the separation among the classes is optimal}
\label{fig:Intro_CIFAR_Image}
\end{figure}
In machine learning, the projection of data into feature space plays an important role in improving the performance of the classifier. Several algorithms such as manifold learning, metric learning, and deep neural networks have been proposed to transform the data from the input space to a different feature space where the classes are separable \cite{wold1987principal,martinez2001pca,schroff2015facenet,shi2003shrinking, singhPAMI}. However, existing data projection techniques depend on the training data distribution and may get stuck in local optima. Essentially, the projected space is dependent on the choice of projection algorithm. In this research, we propose an alternative perspective to it by asking the question: ``\textit{What will be the optimal projection space for this data distribution}"? The question can be answered by computing a space where the competing influences of all the classes are balanced.
The study of data driven projection algorithms suggest that a more fundamental approach which balances the forces exerted by samples of multiple classes could provide generalizable results. Inspired by different laws of Physics, researchers have proposed different techniques for data projection, classification, and clustering \cite{qian2017hybrid, kushwaha2019electromagnetic, li2019improved, zhang2020novel, li2020hibog, fister2020potential, sureka2020nature, unterthiner2017coulomb}. Inspired by Newton's universal law of gravitation, Shi \textit{et al.} \cite{shi2003shrinking} presented a data preprocessing technique to optimize the inner structure of the data to create condensed and widely separated clusters. Hochreiter \textit{et al.} \cite{hochreiter2003coulomb} introduced a family of classifiers called Coulomb classifiers, that include v-SVM and C-SVM. Coulomb classifier is based on physical analogy to an electrostatic system of charged conductors. It is shown that Coulomb classifier can outperform a standard SVM. Schiegg \textit{et al.} \cite{schiegg2016learning} proposed Coulomb Structured SVM (CSSVM) to get an ensemble of models at training time that can run in parallel and independently to make a diverse prediction during testing time. Another application of Law of Physics in classification algorithm is shown in the work by Shafigh \textit{et al.} \cite{shafigh2013gravitation}. In this work, the gravitational potential energy between particles is used to develop a new classification method. The aim of this algorithm is to find the equilibrium condition of the classifier. Inspired by electric network theory, \textit{Hirai et al.} \cite{hirai2007electric} proposed a new classifier for semi-supervised learning on graphs. The classifier classifies the dataset using the sign of electric potential. This classifier can handle complex real word problems and give better performance than diffusion kernel methods. Peng and Liu \cite{peng2017gravitation} proposed a multi-label classification algorithm termed as ITDGM. The proposed algorithm models the given problem using gravitational theory and uses the interaction-based gravitation coefficient to compute the gravitational force for classification. A universal gravity rule based clustering algorithm is proposed by Alswaitti et al. \cite{alswaitti2018optimized}. In this work authors proposed different solutions to impose a balance between exploitation and exploration. Vashishtha et al. \cite{vashishtha2018novel} proposed a novel framework that discovers the classification rules which can be used with the combination of any nature inspired algorithms. Recently, Wang et al. \cite{wang2020entropy} proposed a meta heuristic Nearest Neighbor (NN) algorithm to overcome the drawbacks in NN-based classifiers for imbalanced data problems. The proposed algorithm termed as Gravitational Fixed Radius Nearest Neighbor classifier (GFRNN), solves imbalanced problems by drawing on Newton's law of universal gravitation.
From the existing literature, it is observed that Laws of Physics used for data projection and classification lead to good result and can be applied to real-world problems. However, the two important challenges in computing an optimal projection space for a data distribution are be formulated as:
\begin{enumerate}
\item Computation of the projection space should be independent of the complexity of data distribution.
\item The separation among the classes should be optimal in the projection space.
\end{enumerate}
In this research, we propose a novel algorithm that uses Coulomb's Law of repulsion in Electrostatics to transform the data from input space to an equilibrium space where the separation among the classes is optimal. The intra-class distance between the data points of each class in equilibrium space remains the same and the position of each class with respect to another class is optimal. Transformation function between input space and equilibrium space is learned to perform classification in equilibrium space.
\begin{figure*}[t]
\centering
\includegraphics[scale = 0.35]{Images/Pipeline_Coulomb.pdf}
\caption{Block diagram of the proposed algorithm for computation of the equilibrium space (a) representation of class distribution in input space, (b) shows the charge representation of the classes, (c) illustrates the force applied by the charges using Coulomb's law on each other to move in equilibrium space, (d) shows the charges in equilibrium space, and (e) represents the classes in equilibrium space.}
\label{fig:Block_Diagram}
\end{figure*}
\section{Coulomb's Law and Class Equilibrium}
Coulomb's law \cite{jackson1999classical} describes the force interacting between electric charges. Electric charge causes an object to experience a force when placed in an electromagnetic field. It is of two types: 1) positive charge carried by proton and 2) negative charge carried by electron. From the theory of electrostatics, it is known that opposite charge attracts and same charge repels. So if there are two point charges with charge $Q_1$ and $Q_2$ respectively in space, then Coulomb's law states that ``The magnitude of the electrostatic force of attraction or repulsion between two point charges is directly proportional to the product of the magnitudes of charges and inversely proportional to the square of the distance between them''. Mathematically, it is written as:
\begin{equation}
F = k\frac{|Q_1| |Q_2|}{|R|^2}
\end{equation}
where, $k$ is a constant, $F$ is the magnitude of electrostatic force between charges $Q_1$ and $Q_2$, $R$ is the distance between the point charges. If $\mathbf{R_1}$, $\mathbf{R_2}$ are the position vectors of charge $Q_1$ and $Q_2$ respectively then the vector form of Coulomb's law can be written as:
\begin{equation}
\mathbf{F_{12}} = k \frac{Q_1 Q_2}{|\mathbf{R_{21}}|^2} \hat{\mathbf{R_{21}}}, \hspace{15pt}
\label{eq:Vector_Form}
\mathbf{F_{12}} = k \frac{Q_1 Q_2}{|\mathbf{R_2} - \mathbf{R_1}|^3} (\mathbf{R_2} - \mathbf{R_1})
\end{equation}
where, $\mathbf{F_{12}}$ represents the force on charge $Q_1$ due to charge $Q_2$. In case if multiple charges are present at the same time in space, the total force on a particular charge $Q_0$ is the vector sum of the individual forces. Mathematically, it is written as:
\begin{equation}
\label{eq:Force_vector}
\mathbf{F_0} = \sum_{i} \mathbf{F_{0i}} \quad \forall i, \; i \neq 0
\end{equation}
where, $\mathbf{F_0}$ represents the vector sum of the forces acting on charge $Q_0$ and $\mathbf{F_{0i}}$ represent the force by charge $Q_i$ on charge $Q_0$.
Equilibrium of a system is defined as the state of the system where the overall force on each class with respect to other classes is balanced. In the proposed algorithm, Coulomb's law is applied to the data points in input space to achieve class equilibrium. Following are the properties of class equilibrium:
\begin{enumerate}
\item the separation among the classes in equilibrium space is optimal,
\item the overall force on the classes in equilibrium is close to zero.
\end{enumerate}
Sample t-SNE visualization of the input and equilibrium space is demonstrated on the CIFAR-10 training images in Fig. \ref{fig:Intro_CIFAR_Image}. It is our assertion that data projection into this space will significantly improve the classification performance.
\section{Proposed Approach}
The problem statement can be formally defined as ``If there are $n$ number of classes in input space $\chi$ then project the data points from input space $\chi$ to an equilibrium space $E$ where the separation among the classes is optimal. After computing the equilibrium space, learn the transformation between input space and equilibrium space to project the data points to equilibrium space and perform classification". Inspired by Coulomb's Law, this research propose a new algorithm to compute an equilibrium space where the classes are optimally separated so that the classification can be performed in equilibrium space. Fig. \ref{fig:Block_Diagram} shows the block diagram of the proposed algorithm for computing equilibrium space using training data.
Let us assume that there are three classes in the input space and we want to compute the equilibrium space as shown in Fig. \ref{fig:Block_Diagram}. In the \textbf{first step}, each class is represented with a positive charge of magnitude $Q_1$, $Q_2$, and $Q_3$ at positions $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$, respectively in the input space. In the \textbf{second step}, Coulomb's law of repulsion is applied on the system of charges such that the charges move and settle at positions $(x_1', y_1')$, $(x_2', y_2')$, and $(x_3', y_3')$, respectively in the equilibrium space; where the net force of the system is close to zero. In the \textbf{final step}, the data points of each class are shifted with respect to the position of the charges in equilibrium space. This results in the optimal projection of the classes in equilibrium space. Once the input data is projected in the equilibrium space, the next task is to learn the transformation between input space and equilibrium space and perform classification. For this purpose, convolutional neural network (CNN) is used to learn the transformation function using the training data. The learned transformation may result in some error and thus an error removal technique (ERC) (discussed in subsection \ref{classification_eq}) is used. For classification, a negative charge of unit magnitude is assigned to each test data point. After that, a test point is projected in the equilibrium space using the learned transformation. Each class in equilibrium space will attract the test point towards itself. Finally, the test data point will be assigned to the class that exerts maximum force. The problem is divided into two phases: 1) computation of equilibrium space and 2) classification in equilibrium space. The detailed description of the two phases is discussed next.
\subsection{Computation of Equilibrium Space}
\label{Eq_Space}
\begin{comment}
Let $\mathbf{C}$ be the class set with $n$ number of classes and $\mathbf{C}_{i,j}^X$ represents the $i^{th}$ class having $j$ number of data points in input space $X$. The first task is to represent each class $\mathbf{C}_{i,j}^X$ with charge $Q_i$ at position $\mathbf{R}_{Q_i, X}$ as shown in Fig. \ref{fig:Block_Diagram}(b). Mathematically it is represented as:
\begin{equation}
\label{Charge_Equation}
Q_i = f_1(\mathbf{C_{i,j}^X})
\end{equation}
\begin{equation}
\label{Position_Equation}
\mathbf{R}_{Q_i, X} = f_2(\mathbf{C}_{i,j}^X)
\end{equation}
where, function $f_1(\mathbf{C}_{i,j}^X)$ outputs the charge $Q_i$ corresponding to class $\mathbf{C}_{i,j}^X$ and function $f_2(\mathbf{C}_{i,j}^X)$ outputs the position vector $\mathbf{R}_{Q_i, X}$ of the charge $Q_i$ in input space $X$. Let $\mathbf{Q}$ represents the set with $n$ charges obtained corresponding to $n$ classes and $\mathbf{R}_{\mathbf{Q}, X}$ represent the position vector of $Q$ in the input space.
The next task is to map the charge set $\mathbf{Q}$ with position vector $\mathbf{R}_{\mathbf{Q}, X}$ from input space $X$ to the equilibrium space $E$ as shown in Fig. \ref{fig:Block_Diagram}(b), \ref{fig:Block_Diagram}(d).
\begin{equation}
\label{Train_Eq_Equation}
\mathbf{R}_{\mathbf{Q}, E} = z(\mathbf{Q}, \mathbf{R}_{\mathbf{Q}, X})
\end{equation}
where, $\mathbf{R}_{\mathbf{Q}, E}$ represents the position vector of $\mathbf{Q}$ in the equilibrium space $\mathbf{E}$. $z(\mathbf{Q}, \mathbf{R}_{\mathbf{Q}, X})$ is the function that maps set $\mathbf{Q}$ with position vector $\mathbf{R}_{\mathbf{Q}, X}$ in the input space to the equilibrium space $E$.
After obtaining the position vector of $n$ charges in equilibrium space, the next task is to project the data points of each class $\mathbf{C}_{i,j}$ in equilibrium space as shown in Fig. \ref{fig:Block_Diagram}(e). Data points of each class $\mathbf{C}_{i,j}$ are therefore shifted by adding a vector $\mathbf{\delta_i}$ corresponding to each class. The vector $\mathbf{\delta_i}$ is computed as:
\begin{equation}
\label{eq:Shift_Equation}
\mathbf{\delta}_i = \mathbf{R}_{Q_i, E} - \mathbf{R}_{Q_i, X}
\end{equation}
In order to solve equations \ref{Charge_Equation}-\ref{Train_Eq_Equation}, the problem is divided into two stages.
\end{comment}
Let $\mathbf{C}^{\chi}$ be the class set with $n$ number of classes where each class $\mathbf{C}_i^{\chi}$ has $m_i$ number of data points in the input space $\mathbf{\chi}$. Mathematically, it is represented as:
\begin{equation}
\label{OrigTrainSet}
\mathbf{C}^{\chi} = \{\mathbf{C}_1^{\chi}(m_1), \mathbf{C}_2^{\chi}(m_2),...\mathbf{C}_n^{\chi}(m_n)\}
\end{equation}
The first task is to represent each class $\mathbf{C}_i^{\chi}$ with charge $Q_i$ at position $\mathbf{R}_{Q_i, \chi}$ as shown in Fig. \ref{fig:Block_Diagram}(b). Mathematically, it is represented as:
\begin{equation}
\label{Charge_position_Equation}
Q_i = f_1(\mathbf{C}_i^{\chi}) \quad \text{and} \quad \mathbf{R}_{Q_i, \chi} = f_2(\mathbf{C}_i^{\chi})
\end{equation}
where, function $f_1(\mathbf{C}_i^{\chi})$ outputs the charge $Q_i$ corresponding to class $\mathbf{C}_i^{\chi}$ and function $f_2(\mathbf{C}_i^{\chi})$ outputs the position vector $\mathbf{R}_{Q_i, \chi}$ of the charge $Q_i$ in input space $\chi$. Let $\mathbf{Q}$ represents the set with $n$ charges obtained corresponding to $n$ classes and $\mathbf{R}_{\mathbf{Q}, \chi}$ represent the position vector of $\mathbf{Q}$ in the input space.
The next task is to map the charge set $\mathbf{Q}$ with position vector $\mathbf{R}_{\mathbf{Q}, \chi}$ from input space $\chi$ to the equilibrium space $E$ as shown in Fig. \ref{fig:Block_Diagram}(b), \ref{fig:Block_Diagram}(d).
\begin{equation}
\label{Train_Eq_Equation}
\mathbf{R}_{\mathbf{Q}, E} = z(\mathbf{Q}, \mathbf{R}_{\mathbf{Q}, \chi})
\end{equation}
where, $\mathbf{R}_{\mathbf{Q}, E}$ represents the position vector of $\mathbf{Q}$ in the equilibrium space $E$. $z(\mathbf{Q}, \mathbf{R}_{\mathbf{Q}, \chi})$ is the function that maps set $\mathbf{Q}$ with position vector $\mathbf{R}_{\mathbf{Q}, \chi}$ in the input space to the equilibrium space $E$.
After obtaining the position vector of $n$ charges in equilibrium space, the next task is to project the data points of each class $\mathbf{C}_i^{\chi}$ in input space to equilibrium space as shown in Fig. \ref{fig:Block_Diagram}(e). Data points of each class $\mathbf{C}_i^{\chi}$ are therefore shifted by adding a vector $\mathbf{\delta}_i$ corresponding to each class. The vector $\mathbf{\delta}_i$ is computed as:
\begin{equation}
\label{eq:Shift_Equation}
\mathbf{\delta}_i = \mathbf{R}_{Q_i, E} - \mathbf{R}_{Q_i, \chi}
\end{equation}
In order to solve Equations \ref{Charge_position_Equation} and \ref{Train_Eq_Equation}, the problem is divided into two stages.
\noindent \textbf{Stage 1 - Charge and Position Representation}: To compute the position vector $\mathbf{R}_{Q_i, \chi}$ corresponding to each class $\mathbf{C}_i^\chi$ in input space $\chi$, mean of each class is computed.
\begin{equation}
\mathbf{R}_{Q_i, \chi} = \frac{1}{m_i}\sum \mathbf{C}_i^\chi(m_i)
\end{equation}
The charge $Q_i$ is computed by taking the spread of each class $\mathbf{C}_i^\chi$.
\begin{equation}
Q_i = var(\mathbf{C}_i^{\chi})
\end{equation}
\begin{figure}[t]
\centering
\includegraphics[scale = 0.32]{Images/Case_11.pdf}
\caption{Example to illustrate the purpose for taking variance as a metric for computing charge of each class. }
\label{fig:stage-1}
\end{figure}
The reason for taking "variance" as the metric for computing charge $Q_i$ is discussed below :
\textbf{Analogy:} As shown in Fig. \ref{fig:stage-1}, the test data point is close to the mean of class $C_2$ as compared to class $C_1$. However, intuitively the test data point should belong to class $C_1$. On comparing this with the electrostatic theory, if we have two positive charges with magnitude $Q_1$ and $Q_2$ at the mean location of class $C_1$ and $C_2$ respectively, and another negative charge of unit magnitude at the location of the test data point, then the charge with greater magnitude will attract the test data point more towards itself as compared to the charge with smaller magnitude. From Fig. \ref{fig:stage-1}, it can be observed that the spread of class $C_1$ is more than class $C_2$ and thus has more influence on the test data point. Therefore, representing charge with the class variance is necessary and serves as a good metric.
\noindent \textbf{Stage 2 - Equilibrium Space Computation}: At this stage, the task is to compute the equilibrium space where the projection of the classes is optimal. Here, optimality is achieved when the overall force of the system in equilibrium space is close to zero.
Once the charge $Q_i$ with position vector $\mathbf{R}_{Q_i, \chi}$ corresponding to each class $\mathbf{C}_i^\chi$ is obtained, the next task is to project the charges from input space $\chi$ to equilibrium space $E$ to obtain the position vector $\mathbf{R}_{\mathbf{Q}, E}$. For this purpose, Coulomb's law is applied such that the overall force of the system in equilibrium space is close to zero. The optimization function is given by:
\begin{equation}
\mathbf{R}_{\mathbf{Q}, E} = \underset{\mathbf{R}_{\mathbf{Q}, \chi}}{\arg\min} \sum_{i = 1}^{n} |\mathbf{F}_i|
\end{equation}
$$ \text{subject to} \sum |\mathbf{F}_i| \approx 0$$
where, $|\mathbf{F}_i|$ represents the magnitude of the force.
Using Coulomb's Force Equation \ref{eq:Vector_Form}, the above equation can be written as:
\begin{multline}
\label{eq:optimization_1}
\mathbf{R}_{\mathbf{Q}, E} = \underset{\mathbf{R}_{\mathbf{Q}, \chi}}{\arg\min} \\ \sum_{i = 1}^{n} \left|\sum_{j = 1}^{n} k\frac{Q_i Q_j}{|\mathbf{R}_{Q_j, \chi} - \mathbf{R}_{Q_i, \chi}|^3 } (\mathbf{R}_{Q_j, \chi} - \mathbf{R}_{Q_i, \chi})\right| \quad i \neq j
\end{multline}
such that $\sum |\mathbf{F}_i| \approx 0$. It is possible that the spread of each class $\mathbf{C}_i^\chi$ is not uniform in each dimension as shown in Fig. \ref{fig:Case-2}. So the force applied by a charge should be different in each dimension depending upon the spread of the data. Therefore, the force applied by a charge $Q_i$ is a function of the spread $\mathbf{S}_i$ of the data, where, $\mathbf{S}_i$ is a $d$ dimensional vector representing the variance in each dimension. Thus the force is weighted with the spread $\mathbf{S}_i$. Therefore, the Equation \ref{eq:optimization_1} is updated as:
\begin{multline}
\mathbf{R}_{\mathbf{Q}, E} = \underset{\mathbf{R}_{\mathbf{Q}, \chi}}{\arg\min} \\ \sum_{i = 1}^{n} \left|\sum_{j = 1}^{n} k\frac{Q_i Q_j}{|\mathbf{R}_{Q_j, \chi} - \mathbf{R}_{Q_i, \chi}|^3 } (\mathbf{R}_{Q_j, \chi} - \mathbf{R}_{Q_i, \chi}) \mathbf{S}_j\right| \quad i \neq j
\end{multline}
\begin{figure}[t]
\centering
\includegraphics[scale = 0.35]{Images/Case_2.pdf}
\caption{Example to illustrate the purpose of providing variance in each direction as a weight while computing force. In this example, the variance in dimension $x$ and $y$ is different for both the classes. Class $C_1$ has greater variance in $x$ direction while class $C_2$ has in $y$ direction. Therefore, the charge representing class $C_1$ should have greater force in $x$ direction and the charge representing class $C_2$ should have greater force in $y$ direction. In order to provide weight to the force direction, variance corresponding to each dimension is multiplied with the force vector.}
\label{fig:Case-2}
\end{figure}
\begin{comment}
\begin{equation}
\mathbf{S_i} = \frac{1}{j-1}\sum_{} (\mathbf{C}_{i,j}^X - \mathbf{R}_{Q_i, X})^2
\end{equation}
\end{comment}
The above equation is optimized over position vector $\mathbf{R}_{Q_i, \chi}$. After optimization, the position vector of each charge $Q_i$ in equilibrium space is obtained.
Once the position vector in equilibrium space is obtained, the shift in position vector of each charge corresponding to each class from input space to equilibrium space is computed using Equation \ref{eq:Shift_Equation}. After that each class $\mathbf{C}_i^\chi$ is projected to the equilibrium space by adding the shift vector $\mathbf{\delta}_i$ with the data points of each class. Mathematically, it is written as:
\begin{equation}
\mathbf{C}_i^E = \mathbf{C}_i^\chi + \mathbf{\delta}_i
\end{equation}
\subsection{Classification in Equilibrium Space}
\label{classification_eq}
The classification in equilibrium space is divided into stages: 1) Transformation learning using convolutional neural network (CNN) 2) Coulomb classification. The description of the stages is given below:
\noindent \textbf{Stage 1: Transformation Learning using CNN}
Once the points in input and equilibrium space are obtained, the next task is to learn the transformation function between the points $\mathbf{C}_i^\chi$ in input space $\chi$ and points $\mathbf{C}_i^E$ in equilibrium space $E$. For this purpose, a convolutional neural network (CNN) is learned. Mathematically, it is represented as:
\begin{equation}
\mathbf{C}_i^E = \phi (\mathbf{C}_i^\chi,\mathbf{W},b)
\end{equation}
where, $\phi$ is the CNN, $\mathbf{W}$ and $b$ represents the weight and bias, respectively. Mean square error loss function is used to minimize the error between the data points $\mathbf{C}_i^\chi$ in input space $\chi$ and the data points $\mathbf{C}_i^E$ in equilibrium space $E$.
\textbf{ERC - Error Removal using Correlation:}
Using the learned transformation, data points are transformed from input space $\chi$ to equilibrium space $E$. However, it is important to note that the mapping from input space to equilibrium space can be non-linear. Due to the complexity of the data, there is a chance of error in the learned transformation. In order to remove the error in transformation, Error Removal using Correlation (ERC) technique is used. The description of the ERC technique is as follows:
Let the position of the test sample $\mathbf{t}^\chi$ in input space be $\mathbf{R}_{t, \chi}$ and after transformation, the position in equilibrium space $E$ be $\mathbf{R}_{t, E}$. In the first step, vector $\delta_i$ is added to $\mathbf{R}_{t, \chi}$ $\forall i$. In the next step, Spearman's rank correlation is computed between the transformed test point $\mathbf{R}_{t, E}$ in equilibrium space $E$ and the points obtained by adding vector $\delta_i$. The vector $\delta_i$ with maximum correlation value is used for final transformation of the test point $\mathbf{t}^\chi$.
\noindent \textbf{Stage 2: Coulomb Classification}\\
In order to classify a test sample, it is first transformed from input space to equilibrium space using the learned transformation from CNN as follows:
\begin{equation}
\mathbf{t}^E = \phi( \mathbf{t}^\chi,\mathbf{W},b)
\end{equation}
where, $\mathbf{t}^\chi$, $\mathbf{t}^E$ represents the test point in input and equilibrium space, respectively. During classification, a negative charge of unit magnitude $Q_t$ is assigned to the test sample $\mathbf{t}^E$. Each class in equilibrium space will attract the test sample towards itself. The test sample is assigned to the class that attracts the sample with maximum force. The value of constant $k$ in Coulomb's force equation is dependent on the medium. Similarly, in our case, the value of $k$ is dependent on the database and resolution which is obtained experimentally.
\begin{figure}[t]
\centering
\includegraphics[scale = 1.75]{Images/Database_Collage_Coulomb.pdf}
\caption{Sample images of the MNIST, FMNIST, CIFAR-10, and NORB datasets.}
\label{fig:DB_Collage}
\end{figure}
\begin{figure*}[!h]
\centering
\includegraphics[scale = 1.8]{Images/Equilibrium_Space_Visualization_Disc.pdf}
\caption{Visualization of images in input and equilibrium space (a) samples from the MNIST and FMNIST datasets. First row of each block correspond to the images in input space and the second row in the equilibrium space. (b) highlights the class distinguishing region in the images of the equilibrium space. For instance, the highlighted region of one class is not present in other classes.}
\label{fig:Equilibrium_visual}
\end{figure*}
\begin{table}[!b]
\centering
\caption{Value of $k$ used in the force equation for four datasets at three different resolutions.}
\label{k-value}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|c|c|c|c|}
\hline
& \textbf{8x8} & \textbf{16x16} & \textbf{Original Resolution} \\ \hline
\textbf{CIFAR-10} & 1 & 128 & 2048 \\ \hline
\textbf{MNIST} & 1 & 1 & 1 \\ \hline
\textbf{FMNIST} & 1 & 1 & 1 \\ \hline
\textbf{NORB} & 1 & 1 & 512 \\ \hline
\end{tabular}
\end{table}
\begin{table*}[h]
\centering
\caption{Computation time (in secs) taken by the proposed algorithm in computing and performing classification in equilibrium space.}
\label{ComputationTime}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|l|c|c|c|c|c|c|}
\hline
\multirow{3}{*}{\textbf{Database}} & \multicolumn{3}{c|}{\textbf{Computation of equilibrium space}} & \multicolumn{3}{c|}{\textbf{Classification}} \\ \cline{2-7}
& \textbf{8x8} & \textbf{16x16} & \textbf{\begin{tabular}[c]{@{}c@{}}Original Resolution\end{tabular}} & \multicolumn{1}{c|}{\textbf{8x8}} & \multicolumn{1}{c|}{\textbf{16x16}} & \textbf{\begin{tabular}[c]{@{}c@{}}Original Resolution\end{tabular}} \\ \hline
\textbf{CIFAR-10} & 2.87 & 15.29 & 101.34 & 0.0015 & 0.0021 & 0.0047 \\ \hline
\textbf{MNIST} & 2.63 & 19.81 & 76.87 & 0.0016 & 0.0018 & 0.0061 \\ \hline
\textbf{FMNIST} & 2.98 & 18.67 & 126.76 & 0.0018 & 0.0019 & 0.0059 \\ \hline
\textbf{NORB} & 3.12 & 19.24 & 367.23 & 0.0014 & 0.0023 & 0.0127 \\ \hline
\end{tabular}
\end{table*}
\begin{figure*}[t]
\centering
\includegraphics[scale = 0.48]{Images/MNIST_FMNIST_CIFAR_TSNE.pdf}
\caption{t-SNE visualization of (a) MNIST, (b) FMNIST and (c) CIFAR-10 testing set at 8x8 resolution. The first row represents the visualization in input space and the second row in equilibrium space after classification.}
\label{fig:MNIST_FMNIST_CIFAR_TSNE}
\end{figure*}
\section{Experiments and Results}
In order to evaluate the performance of the proposed algorithm, experiments are performed on CIFAR-10 \cite{krizhevsky2009learning}, MNIST \cite{lecun1998mnist}, Fashion MNIST (FMNIST) \cite{xiao2017online}, and NORB \cite{lecun2004learning} datasets. Sample images of the datasets are shown in Fig. \ref{fig:DB_Collage}. Pre-defined protocols are used which ensure disjoint training and testing partitions. Following discuss the datasets detail.
\begin{itemize}
\item \textbf{CIFAR-10} dataset contains 60,000, 32x32 color images of 10 different classes with 50,000 images in training set and 10,000 images in testing set.
\item \textbf{MNIST} dataset consists of 60,000 training images and 10,000 testing images, of handwritten digits from 10 different classes (0-9). Each image is a grayscale image of 28x28 resolution.
\item \textbf{Fashion-MNIST} is a dataset of clothing and accessories with 60,000 images in training set and 10,000 images in testing set. Each image is a 28x28 grayscale image corresponding to one of the 10 class labels.
\item \textbf{NORB} dataset contains 96x96 grayscale images of toys in five different categories. The training set consists of 5 instances of each category while the testing set contains remaining 5 instances of each category. The dataset contains 24,300 images with each image being captured using two different cameras in training and testing sets.
\end{itemize}
For each dataset, experiments are performed on 8x8, 16x16, and original resolution of images. In each experiment, equilibrium space is first computed followed by the classification in that space using Coulomb's law. Results and analysis of the experiments are discussed in sections \ref{Eq_Space_Compute} and \ref{Coulomb_Class}. Implementation details are given below.
\noindent \textbf{Implementation Details:} Experiments for computing equilibrium space are performed on MATLAB R2017a. The value of $k$ used in the force equation for each dataset and resolution is shown in Table \ref{k-value}. The deep learning model for learning the transformation between input space and equilibrium space comprises of an encoder-decoder architecture. The encoder architecture contains 3 blocks, each having (Conv$\rightarrow$ReLU$\rightarrow$Conv$\rightarrow$ReLU$\rightarrow$AvgPool) layers. Similarly, the decoder architecture has three blocks in the reverse order of encoder architecture. The model is trained for 30 epochs with a learning rate of 0.0001 for the first 20 epochs and reduced to 0.00001 for the next 10 epochs. A batch size of 64 is used with RMSprop optimizer. The code is implemented in tensorflow with 1080 Ti GPU.
\subsection{Computation of Equilibrium Space}
\label{Eq_Space_Compute}
Training set of each dataset is used for the computation of equilibrium space. Fig. \ref{fig:Intro_CIFAR_Image}(a) and \ref{fig:Intro_CIFAR_Image}(b) show the t-SNE visualization of CIFAR-10 training dataset in input and equilibrium space, respectively. Fig. \ref{fig:Intro_CIFAR_Image}(a) shows significant overlap between the classes in the input space. As mentioned in section \ref{Eq_Space}, Coulomb's force law is applied to the charges in input space so that the charges get settled in the equilibrium space by minimizing the overall force of the system. Data points of each class are then projected with respect to the position of each charge in the equilibrium space. The intra-class distance of each class in equilibrium space remains same as the input space. This results in the optimal separation of each class in the equilibrium space as illustrated in Fig. \ref{fig:Intro_CIFAR_Image}(b).
\begin{comment}
\begin{table*}[t]
\centering
\caption{Classification accuracy (in \%) of the proposed algorithm on four different datasets at three different resolutions. Last column of the table contains state-of-the-art (SOTA) results.}
\label{Accuracy_Table}
\begin{tabular}{|l|c|c||c|c|c||c|c|c|}
\hline
\multirow{3}{*}{\textbf{Database}} & \multicolumn{2}{c||}{\textbf{8x8}} & \multicolumn{3}{c||}{\textbf{16x16}} & \multicolumn{3}{c|}{\textbf{Original Resolution}} \\ \cline{2-9}
& \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}} & \multirow{2}{*}{\textbf{SOTA}} & \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}} &\multirow{2}{*}{\textbf{SOTA}} \\ \hline
CIFAR-10 & 85.70 & 96.26 & 86.71 & 87.08 & 72.53 \cite{wang2016studying} & 90.13 & 91.06 & 97.14 \cite{gastaldi2017shake} \\ \hline
MNIST & 96.29 & 96.21 & 98.44 & 98.37 & - & 99.23 & 99.23 & 99.79 \cite{sabour2017dynamic} \\ \hline
Fashion MNIST & 77.25 & 87.30 & 84.39 & 84.79 & - & 91.33 & 91.44 & 96.35 \cite{zhong2017random} \\ \hline
NORB & 82.30 & 84.30 & 83.18 & 84.45 & - & 93.41 & 93.27 & 97.47 \cite{cirecsan2011high} \\ \hline
\end{tabular}
\end{table*}
\end{comment}
Fig. \ref{fig:Equilibrium_visual}(a) presents samples of MNIST and FMNIST dataset and the corresponding equilibrium representation. It is observed that the images in the equilibrium space contain regions of high intensity which correspond to the distinct features of the same class. For instance, in Fig. \ref{fig:Equilibrium_visual}(b), the lower left stroke of the number `8' is of high intensity, which is a distinguishing characteristic of the said class. Similarly, in the second example, the image corresponding to the full sleeves top contains high intensity regions at the sleeves. This demonstrates that the proposed algorithm is able to preserve discriminative features of a given class, which help in increasing the inter-class separability.
Table \ref{ComputationTime} shows that the proposed algorithm is computationally efficient in computing the equilibrium space. The computation time decreases as we decrease the resolution of the images.
\begin{table}[]
\centering
\caption{Classification accuracy (\%) of different algorithms on the CIFAR-10 dataset.}
\label{SOTA_Comp}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|l|c|c|}
\hline
\textbf{Algorithms} & \textbf{8x8} & \textbf{16x16} \\ \hline
Partially Coupled Nets \cite{wang2016studying} & 81.23 & - \\ \hline
DenseNet \cite{huang2017densely} & 77.64 & - \\ \hline
MobileNetV2 \cite{sandler2018mobilenetv2} & 77.72 & - \\ \hline
EfficientNet \cite{tan2019efficientnet} & 73.88 & - \\ \hline
RL-GAN \cite{xi2020see} & 88.11 & - \\ \hline
DFD \cite{zhu2019low} & 81.26 & \textbf{90.41} \\ \hline
\textbf{Proposed (Before ERC)} & 85.70 & 86.71 \\ \hline
\textbf{Proposed (After ERC)} & \textbf{96.26} & 87.08 \\ \hline
\end{tabular}
\end{table}
\subsection{Coulomb Classification}
\label{Coulomb_Class}
After computation of the equilibrium space, transformation between the input and equilibrium space is learned as discussed in section \ref{classification_eq}. Fig. \ref{fig:MNIST_FMNIST_CIFAR_TSNE} shows the t-SNE visualizations of the MNIST, FMNIST, and CIFAR-10 testing set at 8x8 resolution. It is observed that the classes are well separated in equilibrium space. The comparison of the proposed algorithm with existing methods on the CIFAR-10 dataset for low resolution images is shown in Table \ref{SOTA_Comp}. It is observed that the proposed algorithm achieves state-of-the-art performance at 8x8 resolution and comparable performance at 16x16 resolution. This shows the applicability of the proposed algorithm in real-world scenario for low resolution image classification.
Table \ref{Accuracy_Table} shows the classification performance of the proposed algorithm on 8x8, 16x16 and original resolution for all the datasets. It is observed that the ERC technique enhances the performance in most of the cases. For instance, the accuracy on the FMNIST dataset at 8x8 resolution after ERC is 87.30\% which is approximately 10\% better than before applying ERC. It is interesting to observe that, in some cases, the performance at 8x8 resolution is better than 16x16 and original resolution. For instance, the classification accuracy of the CIFAR-10 dataset at 8x8, 16x16, and original resolution is 96.26\%, 87.08, and 91.06, respectively. It is our assertion that, at low resolution, the deep model is able to learn the transformation better than at higher resolution.
\begin{table}[t]
\centering
\caption{Classification accuracy (\%) of the proposed algorithm on four different datasets at three different resolutions.}
\label{Accuracy_Table}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|l|c|c|c|c|c|c|}
\hline
\multirow{3}{*}{\textbf{Database}} & \multicolumn{2}{c|}{\textbf{8x8}} & \multicolumn{2}{c|}{\textbf{16x16}} & \multicolumn{2}{c|}{\textbf{Original Resolution}} \\ \cline{2-7}
& \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}}& \textbf{\begin{tabular}[c]{@{}c@{}}Before \\ ERC\end{tabular}}& \textbf{\begin{tabular}[c]{@{}c@{}}After \\ ERC\end{tabular}} \\ \hline
CIFAR-10 & 85.70 & 96.26 & 86.71 & 87.08 & 90.13 & 91.06 \\ \hline
MNIST & 96.29 & 96.21 & 98.44 & 98.37 & 99.23 & 99.23 \\ \hline
FMNIST & 77.25 & 87.30 & 84.39 & 84.79 & 91.33 & 91.44 \\ \hline
NORB & 82.30 & 84.30 & 83.18 & 84.45 & 93.41 & 93.27 \\ \hline
\end{tabular}
\end{table}
The computation time to transform data points from input space to equilibrium space is dependent on the model used for learning the transformation. The time taken by the proposed algorithm for classification in equilibrium space is shown in Table \ref{ComputationTime}. It is observed that the time taken for classification is significantly low.
\section{Conclusion}
In machine learning, the aim of the majority of projection algorithms and loss functions is to increase the inter-class distance. However, increasing the inter-class distance can affect the intra-class distance. Maintaining a balance between the two is a challenging task. This paper proposes a new algorithm to compute the equilibrium space where the inter-class separation among the classes is optimal without affecting the intra-class distance of the data distribution. The algorithm further learns the transformation from input space to equilibrium space to perform classification in equilibrium space. Also, an Error Removal using Correlation (ERC) technique is used to enhance the performance. Experiments are performed on four different datasets. For each dataset, experiments are performed on three different resolutions of images. It is found that the proposed algorithm achieves state-of-the-art result on the CIFAR-10 dataset at 8x8 resolution. In the future, we plan to extend the application of the proposed algorithm in cross-domain matching scenarios such as matching low resolution faces with high resolution images \cite{bhattTIP} or sketch to photo matching \cite{nagpal2021discriminative}.
\section*{Acknowledgements}
Puspita Majumdar is partly supported by DST INSPIRE Ph.D. Fellowship. Mayank Vatsa is partially supported through Swarnajayanti Fellowship by the Government of India.
\bibliographystyle{abbrv}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 3,540 |
<html>
<head>
<link href="./index.lol" type="intl/l20n" />
<script type="text/javascript;version=1.8" src="../../../../min/l20n.js"></script>
<link rel="stylesheet" type="text/css" href="../_lib/jasmine/jasmine.css">
<link rel="stylesheet" type="text/css" href="../_lib/test.css">
<script type="text/javascript" src="../_lib/jasmine/jasmine.js"></script>
<script type="text/javascript" src="../_lib/jasmine/jasmine-html.js"></script>
<script type="text/javascript" src="../_lib/runtests.js"></script>
<script type="text/javascript" src="spec.js"></script>
</head>
<body>
<p class="intro">
In this example there are three <code><span></code> elements and
assign data-l10n-id attribute which binds them with their respective L20n
entities. The value of the entity becomes a text content of the span
element.
</p>
<span data-l10n-id="name"></span>
<span data-l10n-id="phone"></span>
<span data-l10n-id="address"></span>
</body>
</html>
| {
"redpajama_set_name": "RedPajamaGithub"
} | 5,157 |
Q: Run a function on two input lists with purrr I have a list L1 and a data.frame D2. L1 contains two data.frames of students on different programmes of study [[1]] and [[2]]
So L1 is a list of students split by their programme of study (architecture vs engineering). D2 is a data.frame of projects they can choose.
I have a function that takes two inputs (L1[[1]] and D2) and returns a single data.frame but how can I pass the whole list L1 and the data.frame D2 to the function and have it work on L1[[1]] + D2 then L1[[2]] + D2.
D2<-data.frame(programme=c("Architecture","Architecture","Engineering", "Engineering"), project=c(14,15,19,20))
L1<-data.frame(studentID=c(203,204,205), programme=c("Architecture","Engineering", "Engineering")) %>% group_by(programme) %>% group_split()
F=function(L1,D2){ L1 %>% left_join(D2)}
I could do a for-loop or F(L1[[1]],D2) and F(L2[[2]],D2) but Map(L1,as.list(D2),F) doesn't seem to handle it the way I might have expected.
I'm looking at purrr::lmap but this only takes a single list. Has anyone seen something that takes mixed inputs into a function and iterates over each list not over a vector?
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 5,703 |
I definitely agree that the Alabama/Florida ranking comparison is an interesting one. The question here appears to persist across a broad range of rankings (see, e.g., those on Kenneth Massey's College Football Ranking Comparison). Additionally, check out the plot versus p posted here: depending on the selected bias value p, either Alabama, Florida, or even VT end up number 1 (the last rewarding VT for a strong schedule so far, even though they lost to Alabama!). | {
"redpajama_set_name": "RedPajamaC4"
} | 7,044 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.