text:
Irim Salik
Raman Marwaha
Zina Clark
Barbara Simmons
In a patient under intravenous sedation or general anesthesia, electroconvulsive therapy (ECT) uses an electric current to create a generalized cerebral seizure. Although it is primarily utilized to treat patients with severe depression, patients with schizophrenia, schizoaffective disorder, catatonia, neuroleptic malignant syndrome, and bipolar disorder may also benefit. However, the practice has a stigma attached to it due to misinformation regarding procedural methodology.
There are various pathophysiologic changes in brain regions found in patients with severe depression. These include reduced activity and volumetric reductions in the dorsal areas of the frontal lobes. Areas of the ventral and orbital frontal cortex have altered processing of emotional stimuli.[1] In addition to the frontal lobe, functional alterations and volumetric reductions are apparent in the hippocampus, parahippocampal gyri, and amygdala.[2] The hypothalamic-pituitary-adrenal (HPA) axis becomes hypersensitive to stressors, exhibits chronically elevated levels of stress hormones and impaired feedback regulation. [3] The mesocorticolimbic dopamine system, as well as the HPA axis, are activated in patients with stress. Dopamine function is thought to be impaired in patients with depression, causing impairment in essential functions including concentration, motivation, and pleasure.[4] The antidepressive effects of ECT reflect changes in the systems mentioned above.
ECT is indicated in patients with treatment-resistant depression or severe major depression that impairs activities of daily living. The definition of treatment-resistant depression is depression that is unresponsive to multiple antidepressant medication trials.[5] There are also suggestions for ECT as a treatment for suicidality, severe psychosis, food refusal secondary to depression, and catatonia.[6][7] Bipolar depressive and manic patients can also receive treatment with ECT.[8] ECT may have a safer profile than antidepressants or antipsychotics in debilitated, elderly, pregnant and breastfeeding patients. Suicidal ideation is rapidly relieved by ECT, and complete resolution was seen in 38% of patients after one week, 61% of patients after two weeks and in 81% of patients with completion of ECT.[9] ECT is also recommended for patients that have exhibited a favorable response to ECT previously.
The resultant seizure from ECT can cause transient increases in blood pressure, myocardial oxygen consumption, heart rate, and intracranial pressure. Care is necessary for patients with cardiovascular, pulmonary, or central nervous system compromise. A pheochromocytoma and elevated intracranial pressure with mass effect are absolute contraindications to ECT. Relative contraindications include elevated intracranial pressure without mass effect, cardiovascular conduction defects, high-risk pregnancies, aortic and cerebral aneurysms.[10]
ECT treatment and recovery areas should include the standard American Society of Anesthesiologists (ASA) monitors. A stethoscope, blood pressure monitor, electrocardiography (EKG) monitor, pulse oximeter, suction apparatus, and an oxygen delivery system should be present. Anesthetic induction supplies and medication should be available along with ventilatory and resuscitation equipment. A nasal cannula or face mask to provide supplemental oxygen, bag valve mask, nerve stimulator to assess neuromuscular blockade, electromyograph (EMG), electroencephalography (EEG) leads, and multiple blood pressure cuffs should be available.
ECT is administered by a team that typically includes an anesthesiologist, a psychiatrist and a nurse.
A complete history and physical examination may expose significant risk factors including cardiac ischemia or arrhythmia, heart failure, or intracranial pathology.[11] History should also include the use of herbal medications such as Ginkgo biloba, ginseng, St. John's wort, valerian, and kava, all of which may interfere with ECT. There is a risk of status epilepticus in patients on theophylline.[12] Short-acting intravenous beta blockers may reduce ECT related hypertension and tachycardia, but may also shorten seizure duration and reduce ECT efficacy. Cardiac medications including aspirin, statins, antihypertensive agents, antianginal medications, and clopidogrel should be continued the day of the procedure. Serum glucose levels require checking both preoperatively and in the recovery room, as ECT treatments can raise blood glucose levels. Although ECT appears to be safe in a patient with a defibrillator, detection mode should be turned off during the procedure and equipment for external defibrillation should be available at the patient's bedside. In pregnant patients, noninvasive fetal monitoring is the recommendation after 14 to 16 weeks and a nonstress test with a tocometer after 24 weeks.
ECT utilizes general anesthesia. Anesthetic induction medications used include barbiturates such as thiopental and methohexital and nonbarbiturate agents such as propofol and etomidate. Seizure-induced by ECT should last longer than 30 seconds. Methohexital is the most commonly used induction agent due to its quick onset, effectiveness, low cost, and minimal effect on seizure duration. Propofol and thiopental have been shown to reduce seizure duration. Etomidate has correlations with myoclonus and increased seizure duration.
ECT is commonly performed in a dedicated suite, a post-anesthesia care unit, or an ambulatory surgery site, most frequently on an outpatient basis. Patients with severe debilitation including substantial medical or psychiatric illness may start on an inpatient basis and transition to an outpatient basis as needed. Patients should be appropriately nil per os (NPO) for the procedure, which includes no light meal for six hours, no full-fat meal for eight hours, and no clear liquids for two hours before anesthesia.
Vital signs, including blood oxygen saturation, ECG and EEG activity are recorded continuously. EMG is recorded on the right foot to measure the motor component of seizure activity. A nerve stimulator is utilized to monitor succinylcholine, a depolarizing muscle relaxant used to reduce tonic-clonic contractions during the procedure. As an alternative to EMG, a blood pressure cuff is inflated on the patient's ankle to prevent succinylcholine from entering the foot, allowing a visual monitor of seizure activity with measurement of tonic-clonic contractions. Following intravenous induction, a bite block is placed to protect the patient's tongue and teeth. The beginning and termination of a cerebral seizure is monitored via EEG, recorded from right and left frontal and mastoid positions. Seizure induction is via two electrodes placed bitemporally or a right unilateral electrode; both of which allow electrical current to pass into the scalp.[13] A 2017 meta-analysis of numerous randomized trials of 792 patients specifically compared moderate dose bilateral ECT with high dose right unilateral ECT, and remission was comparable.[14] Right unilateral ECT is utilized preferentially to minimize retrograde amnesia.
The ECT stimulus is either a brief pulse (0.5 to 2.0 milliseconds) or ultra-brief pulse (less than 0.5 milliseconds) waveform. While the brief pulse is considered standard, the ultra-brief is considered more tolerable.[15] Electricity dose affects efficacy, the speed of response, and adverse cognitive effects. Seizure threshold is established via trial and error via incrementally higher doses of current during the primary treatment session.[16][17] Following initial dose calculation, the dose at subsequent ECT sessions for bilateral ECT is 1.5 to 2 times seizure threshold, and for right unilateral is six times the seizure threshold. During a course of ECT treatment, the seizure threshold commonly increases as the patient develops tolerance.
As with any other procedure, the goal of the anesthesiologist during ECT is to facilitate a safe and pain-free experience for the patient.[18] Preoxygenation of the patient via nasal cannula or face mask is followed by anesthetic induction and paralysis. Administration of an anticholinergic medication before ECT may prevent arrhythmias such as bradycardia or asystole and excessive oral secretions. To induce cerebral vasoconstriction via hypocarbia, the patient is often hyperventilated via bag valve mask before delivery of the electrical stimulus to increase seizure intensity.[19]The gold standard for induction of anesthesia is methohexital, given at 0.75 to 1 mg/kg.[18] Methohexital is preferred to propofol because a meta-analysis of two randomized trials revealed that seizure duration was shorter with propofol.[20] Skeletal muscle relaxation during ECT is integral to minimize a motor seizure and avoid musculoskeletal injury. The depolarizing neuromuscular relaxant succinylcholine is used at 0.75 to 1 mg/kg with an elimination half-life of 41 seconds.[21][22] In cases where succinylcholine is contraindicated including neuromuscular disease or injury, burn injury, pseudocholinesterase deficiency or hyperkalemia, nondepolarizing neuromuscular relaxants are the preferred option.[5]
Once the patient is rendered unconscious, administration of a muscle relaxant follows, along with bag valve mask ventilation with 100 percent oxygen. A nerve stimulator is utilized to determine the adequacy of muscle relaxation along with the clinical assessment of plantar reflexes and fasciculations in the calves and left foot. An inflated blood pressure cuff prevents muscle relaxant from entering the right foot. Muscle relaxants do not prevent masseter muscle contraction from the electrical pulse, requiring placement of a bite block for lingual and tooth protection.
Although most therapeutic ECT seizures last from 15 to 70 seconds, EEG recording lasts about 25 percent longer than the motor seizure.[23] Seizures lasting less than 15 seconds may not be clinically effective, while prolonged seizures may cause cognitive impairment. A missed or short seizure should have a follow-up with a short period of hyperventilation and restimulation with a higher electrical current. If a patient is experiencing a prolonged seizure greater than two minutes, an induction agent such as propofol or methohexital is either given at a half dose or a benzodiazepine, to suppress seizure activity and avoid neurologic injury. In a patient with numerous missed seizures,[24][12] anesthetic induction agents such as etomidate or ketamine may be useful as they exhibit less anticonvulsant effects as compared to methohexital. While caffeine had been previously administered to prolong seizures, it is no longer the recommendation due to its uncertain safety profile for this purpose.
In pregnant patients receiving ECT,[25][26] hyperventilation should be avoided as it can reduce placental blood flow causing fetal hypoxia. Minimization of NPO time and adequate intravenous fluid hydration is essential to avoid dehydration and premature uterine contractions. In a female with a gestational age greater than 20 weeks, left lateral uterine displacement is essential to optimize maternal venous return and maintain optimal uterine blood flow. In pregnancies greater than 24 weeks gestation considered viable, fetal heart rate and uterine activity should undergo continuous monitoring 30 minutes before and after each treatment by an obstetrician that can manage obstetric and neonatal emergencies. Because pregnant patients are at higher risk for aspiration pneumonitis due to their full stomach status, anticholinergic drugs that reduce lower esophageal sphincter tone should be avoided, as they can increase reflux.[27][25][28] In this case, a nonparticulate antacid such as sodium citrate is safer for aspiration prophylaxis.
Bilateral or bitemporal ECT causes more cognitive impairment than unilateral ECT, although this effect is transient. A meta-analysis of 1415 depressed patients treated with ECT revealed that global cognition, verbal memory, and autobiographical memory were worse with bilateral treatment three days after treatment.[29]
According to the American Psychiatric Association, patients receiving ECT are at higher risk if they show evidence of unstable or severe cardiovascular disease, a space-occupying intracranial lesion with evidence of elevated intracranial pressure, history of an acute cerebral hemorrhage or stroke, an unstable vascular aneurysm, severe pulmonary disease, or qualify as American Society of Anesthesiologists (ASA) Class 4 or 5.
Physiologically, during the tonic phase of the seizure, a 15- to 20-second parasympathetic discharge occurs, which can lead to bradyarrhythmias including premature atrial and ventricular contractions, atrioventricular block, and asystole. Patients with subconvulsive seizures are at higher risk for asystole.[30] Paradoxically, patients with heart block or underlying arrhythmias are less likely to develop asystole. The clonic phase of the seizure correlates with a catecholamine surge that causes tachycardia and hypertension, which lasts temporally with seizure duration.[31] Hypertension and tachycardia resolve within 10 to 20 minutes of the seizure, although some patients exhibit persistent hypertension that requires medical intervention.
Although patients with cardiac disease at baseline are at higher risk following treatment, ejection fraction can decrease following ECT in healthy patients as well.[32] In a study of 53 adults undergoing ECT, seven developed new global left ventricular (LV) systolic dysfunction and eight developed regional wall motion abnormalities. [33] Of these patients, there were no adverse outcomes in patients with LV dysfunction. In a prospective cohort study of 100 subjects undergoing ECT, increased cardiac troponin levels were present in eight patients, with only two having other evidence of myocardial ischemia or infarction. [34] Cerebral blood flow and intracranial pressure both increase with ECT therapy. Clinically, patients may exhibit confusion, delirium, disorientation and memory loss. ECT is classified as a low-risk procedure by the AHA-ACC guidelines because it is well tolerated, and demonstrates only transient hemodynamic lability and low mortality rate. [35][36][37]
Clinical Significance
ECT is a relatively safe and low-risk procedure that is helpful in the treatment of depression, suicidality, severe psychosis, food refusal secondary to depression, and catatonia. It requires interprofessional care coordination among anesthesiologists, psychiatrists, and nurses. Most patients require several sessions to see a durable effect. The stigma associated with ECT is largely due to the lack of anesthesia with early treatments resulting in significant injury and severe memory loss. The antidepressant effect is seen relatively quickly and may last up to a few years. Overall, the mortality rate is very low with ECT administered in a controlled setting, but it continues to cause mild memory loss in the long term. ECT is commonly utilized in pregnant patients and the elderly due to the avoidance of psychotropic medication side effects. Although its mechanism of action is multifactorial, ECT causes changes in cerebral blood flow and regional metabolism.
Today ECT is now frequently used to treat a variety of mental health disorders besides depression. The procedure is relatively safe, and does work. However, the delivery of ECT requires a multidisciplinary team that includes a nurse, anesthesiologist, psychiatrist and a neurologist. The benefits of ECT are seen after several sessions and the results are durable. The key is to educate the patient and family about ECT because the procedure has been associated with many false and illogical beliefs. The antidepressant effect is seen relatively quickly and may last up to a few years. Overall, the mortality rate is very low with ECT administered in a controlled setting, but it continues to cause mild memory loss in the long term. ECT is commonly utilized in pregnant patients and the elderly due to the avoidance of psychotropic medication side effects. Although its mechanism of action is multifactorial, ECT causes changes in cerebral blood flow and regional metabolism. Most patients who undergo ECT have a beneficial response without any adverse sequelae. [38](Level V)
Electroconvulsive Therapy - Questions
A 67-year-old male with benign prostatic hyperplasia, well-controlled hypertension, and erectile dysfunction presents with acute-onset depression. His medications are tamsulosin, lisinopril, and sildenafil. Upon questioning, he has suicidal ideation, a plan, and means to carry out the plan. Following a full, in-hospital psychiatric evaluation, and a home risk evaluation, it is decided that treatment is warranted. What is the best next step in treating this patient?
Tricyclic antidepressant
SSRI
Electroconvulsive therapy (ECT) is absolutely contraindicated in the presence of which condition?
Space-occupying intracranial lesion
History of seizures
Which is NOT associated with electroconvulsive therapy?
Increased cerebral activity
Cerebral herniation
Increase cerebral compliance
A 41-year-old patient undergoes unilateral electroconvulsive therapy for depression. After the procedure, post anesthesia what is recommended for providers to do?
Provide frequent orientation to the patient's surroundings
Encourage fluids and good nutrition
Encourage active participation in the unit milieu
Maintain strict bed rest
Which of the following is least likely after electroconvulsive therapy?
Which of the following conditions is least responsive to electroconvulsive therapy (ECT)?
Chronic schizophrenia
Electroconvulsive therapy is not recommended for which psychiatric disorder?
Acute schizophrenia
A female with long-standing depression is now scheduled for electroconvulsive therapy after failing to respond to medications. She would like to know the leading cause of mortality following this therapy. What should she be told?
Pulmonary embolus
A 67-year-old woman who has been suffering from chronic major depression that has become resistant to pharmacotherapy has agreed to explore electroconvulsive therapy (ECT) to help decrease her symptoms. While obtaining informed consent from this patient, which condition should be mentioned as a commonly reported serious adverse effect of ECT?
Aspiration pneumonia
Patients with which of the following conditions might benefit from electroconvulsive therapy? Select all that apply.
Dementia with aggression or agitation
Drug-resistant depression
Depression with suicidal ideation
A patient is undergoing electroconvulsive therapy for major depressive disorder. What are fundamental principles that will guide care for this patient? Select all that apply.
Nothing by mouth before the procedure
Reorient and reassure the patient frequently after the procedure
Informed consent is not necessary for this therapy
Check gag reflex before fluids or food after the therapy
A patient is scheduled to undergo electroconvulsive therapy for major depressive disorder. The patient would like to know the adverse effects of the treatment. The nurse will explain to the patient that they may develop impairment in which of the following? Select all that apply.
Heart function
You are in the behavioral health unit where the physician frequently uses electroconvulsive therapy (ECT) as treatment. Which of the following conditions can be treated with this therapy? Select all that apply.
Electroconvulsive Therapy - References
Mayberg HS,Lewis PJ,Regenold W,Wagner HN Jr, Paralimbic hypoperfusion in unipolar depression. Journal of nuclear medicine : official publication, Society of Nuclear Medicine. 1994 Jun; [PubMed]
Botteron KN,Raichle ME,Drevets WC,Heath AC,Todd RD, Volumetric reduction in left subgenual prefrontal cortex in early onset depression. Biological psychiatry. 2002 Feb 15; [PubMed]
de Kwaasteniet B,Ruhe E,Caan M,Rive M,Olabarriaga S,Groefsema M,Heesink L,van Wingen G,Denys D, Relation between structural and functional connectivity in major depressive disorder. Biological psychiatry. 2013 Jul 1; [PubMed]
Rigucci S,Serafini G,Pompili M,Kotzalidis GD,Tatarelli R, Anatomical and functional correlates in major depressive disorder: the contribution of neuroimaging studies. The world journal of biological psychiatry : the official journal of the World Federation of Societies of Biological Psychiatry. 2010 Mar; [PubMed]
The Practice of ECT: Recommendations for Treatment, Training and Privileging. Convulsive therapy. 1990 Jun; [PubMed]
Husain MM,Rush AJ,Fink M,Knapp R,Petrides G,Rummans T,Biggs MM,O'Connor K,Rasmussen K,Litle M,Zhao W,Bernstein HJ,Smith G,Mueller M,McClintock SM,Bailine SH,Kellner CH, Speed of response and remission in major depressive disorder with acute electroconvulsive therapy (ECT): a Consortium for Research in ECT (CORE) report. The Journal of clinical psychiatry. 2004 Apr; [PubMed]
Kellner CH,Knapp R,Husain MM,Rasmussen K,Sampson S,Cullum M,McClintock SM,Tobias KG,Martino C,Mueller M,Bailine SH,Fink M,Petrides G, Bifrontal, bitemporal and right unilateral electrode placement in ECT: randomised trial. The British journal of psychiatry : the journal of mental science. 2010 Mar; [PubMed]
Fink M, Indications for the use of ECT. Psychopharmacology bulletin. 1994; [PubMed]
Kellner CH,Fink M,Knapp R,Petrides G,Husain M,Rummans T,Mueller M,Bernstein H,Rasmussen K,O'connor K,Smith G,Rush AJ,Biggs M,McClintock S,Bailine S,Malur C, Relief of expressed suicidal intent by ECT: a consortium for research in ECT study. The American journal of psychiatry. 2005 May; [PubMed]
Taylor S, Electroconvulsive therapy: a review of history, patient selection, technique, and medication management. Southern medical journal. 2007 May; [PubMed]
Tess AV,Smetana GW, Medical evaluation of patients undergoing electroconvulsive therapy. The New England journal of medicine. 2009 Apr 2; [PubMed]
Devanand DP,Decina P,Sackeim HA,Prudic J, Status epilepticus following ECT in a patient receiving theophylline. Journal of clinical psychopharmacology. 1988 Apr; [PubMed]
Bjølseth TM,Engedal K,Benth JŠ,Dybedal GS,Gaarden TL,Tanum L, Clinical efficacy of formula-based bifrontal versus right unilateral electroconvulsive therapy (ECT) in the treatment of major depression among elderly patients: a pragmatic, randomized, assessor-blinded, controlled trial. Journal of affective disorders. 2015 Apr 1; [PubMed]
Kolshus E,Jelovac A,McLoughlin DM, Bitemporal v. high-dose right unilateral electroconvulsive therapy for depression: a systematic review and meta-analysis of randomized controlled trials. Psychological medicine. 2017 Feb; [PubMed]
Sienaert P,Spaans HP,Kellner CH, Pulse Width in Electroconvulsive Therapy: How Brief Is Brief? The journal of ECT. 2018 Jun; [PubMed]
Petrides G,Fink M, The [PubMed]
Petrides G,Braga RJ,Fink M,Mueller M,Knapp R,Husain M,Rummans T,Bailine S,Malur C,O'Connor K,Kellner C, Seizure threshold in a large sample: implications for stimulus dosing strategies in bilateral electroconvulsive therapy: a report from CORE. The journal of ECT. 2009 Dec; [PubMed]
Bryson EO,Aloysi AS,Farber KG,Kellner CH, Individualized Anesthetic Management for Patients Undergoing Electroconvulsive Therapy: A Review of Current Practice. Anesthesia and analgesia. 2017 Jun; [PubMed]
Bergsholm P,Gran L,Bleie H, Seizure duration in unilateral electroconvulsive therapy. The effect of hypocapnia induced by hyperventilation and the effect of ventilation with oxygen. Acta psychiatrica Scandinavica. 1984 Feb; [PubMed]
Lihua P,Su M,Ke W,Ziemann-Gimmel P, Different regimens of intravenous sedatives or hypnotics for electroconvulsive therapy (ECT) in adult patients with depression. The Cochrane database of systematic reviews. 2014 Apr 11; [PubMed]
Bryson EO,Kellner CH,Li EH,Aloysi AS,Majeske M, Extreme variability in succinylcholine dose for muscle relaxation in electroconvulsive therapy. Australasian psychiatry : bulletin of Royal Australian and New Zealand College of Psychiatrists. 2018 Aug; [PubMed]
Torda TA,Graham GG,Warwick NR,Donohue P, Pharmacokinetics and pharmacodynamics of suxamethonium. Anaesthesia and intensive care. 1997 Jun; [PubMed]
Mayur PM,Gangadhar BN,Janakiramaiah N,Subbakrishna DK, Motor seizure monitoring during electroconvulsive therapy. The British journal of psychiatry : the journal of mental science. 1999 Mar; [PubMed]
Datto C,Rai AK,Ilivicky HJ,Caroff SN, Augmentation of seizure induction in electroconvulsive therapy: a clinical reappraisal. The journal of ECT. 2002 Sep; [PubMed]
Miller LJ, Use of electroconvulsive therapy during pregnancy. Hospital [PubMed]
Rabheru K, The use of electroconvulsive therapy in special patient populations. Canadian journal of psychiatry. Revue canadienne de psychiatrie. 2001 Oct; [PubMed]
Yonkers KA,Wisner KL,Stowe Z,Leibenluft E,Cohen L,Miller L,Manber R,Viguera A,Suppes T,Altshuler L, Management of bipolar disorder during pregnancy and the postpartum period. The American journal of psychiatry. 2004 Apr; [PubMed]
Anderson EL,Reti IM, ECT in pregnancy: a review of the literature from 1941 to 2007. Psychosomatic medicine. 2009 Feb; [PubMed]
Semkovska M,Keane D,Babalola O,McLoughlin DM, Unilateral brief-pulse electroconvulsive therapy and cognition: effects of electrode placement, stimulus dosage and time. Journal of psychiatric research. 2011 Jun; [PubMed]
Kaufman KR, Asystole with electroconvulsive therapy. Journal of internal medicine. 1994 Mar; [PubMed]
Larson G,Swartz C,Abrams R, Duration of ECT-induced tachycardia as a measure of seizure length. The American journal of psychiatry. 1984 Oct; [PubMed]
Fuenmayor AJ,el Fakih Y,Moreno J,Fuenmayor AM, Effects of electroconvulsive therapy on cardiac function in patients without heart disease. Cardiology. 1997 May-Jun; [PubMed]
McCully RB,Karon BL,Rummans TA,Black JL,Andreen KM,Oh JK,Seward JB,Tajik AJ, Frequency of left ventricular dysfunction after electroconvulsive therapy. The American journal of cardiology. 2003 May 1; [PubMed]
Duma A,Pal S,Johnston J,Helwani MA,Bhat A,Gill B,Rosenkvist J,Cartmill C,Brown F,Miller JP,Scott MG,Sanchez-Conde F,Jarvis M,Farber NB,Zorumski CF,Conway C,Nagele P, High-sensitivity Cardiac Troponin Elevation after Electroconvulsive Therapy: A Prospective, Observational Cohort Study. Anesthesiology. 2017 Apr; [PubMed]
Zielinski RJ,Roose SP,Devanand DP,Woodring S,Sackeim HA, Cardiovascular complications of ECT in depressed patients with cardiac disease. The American journal of psychiatry. 1993 Jun; [PubMed]
Rice EH,Sombrotto LB,Markowitz JC,Leon AC, Cardiovascular morbidity in high-risk patients during ECT. The American journal of psychiatry. 1994 Nov; [PubMed]
Abrams R, The mortality rate with ECT. Convulsive therapy. 1997 Sep; [PubMed]
Benson NM,Seiner SJ,Bolton P,Fitzmaurice G,Meisner RC,Pierce C,Busch AB, Acute Phase Treatment Outcomes of Electroconvulsive Therapy in Adolescents and Young Adults. The journal of ECT. 2018 Dec 18 [PubMed]
The intent of StatPearls is to provide practice questions and explanations to assist you in identifying and resolving knowledge deficits. These questions and explanations are not intended to be a source of the knowledge base of all of medicine, nor is it intended to be a board or certification review of Nurse-Mental Health PN. The authors or editors do not warrant the information is complete or accurate. The reader is encouraged to verify each answer and explanation in several references. All drug indications and dosages should be verified before administration.
StatPearls offers the most comprehensive database of free multiple-choice questions with explanations and short review chapters ever developed. This system helps physicians, medical students, dentists, nurses, pharmacists, and allied health professionals identify education deficits and learn new concepts. StatPearls is not a board or certification review system for Nurse-Mental Health PN, it is a learning system that you can use to help improve your knowledge base of medicine for life-long learning. StatPearls will help you identify your weaknesses so that when you are ready to study for a board or certification exam in Nurse-Mental Health PN, you will already be prepared.
Our content is updated continuously through a multi-step peer review process that will help you be prepared and review for a thorough knowledge of Nurse-Mental Health PN. When it is time for the Nurse-Mental Health PN board and certification exam, you will already be ready. Besides online study quizzes, we also publish our peer-reviewed content in eBooks and mobile Apps. We also offer inexpensive CME/CE, so our content can be used to attain education credits while you study Nurse-Mental Health PN.


text:
package Logic::Loop;
=head2

	PACKAGE		Logic::Loop

	PURPOSE

		1. REPEATEDLY EXECUTE AN APPLICATION, CHANGING THE VALUE OF

			THE SPECIFIED PARAMETER EVERY TIME AND FOR A SPECIFIED NUMBER

			OF REPLICATES

		2. DO THE SAME FOR AN ARRAY OF WORKFLOW APPLICATIONS, CHANGING

			THE VALUES FOR DOWNSTREAM APPLICATIONS EACH TIME

	VERSION

		0.02	Added '--loop' option with args 'serial', 'parallel' and 'distributed'

		O.01	Basic loop with serial or 'concurrent'

=cut

use strict;
use warnings;
use Carp;

#### INHERITANCE
require Exporter;
our @ISA = qw(Exporter Agua::Common::Cluster);
#our @EXPORT_OK = qw();
our $AUTOLOAD;

#### INTERNAL MODULES
use Agua::Common::Cluster;
use Sampler;
use Timer;

#### EXTERNAL MODULES
use Data::Dumper;
use File::Path;
use threads qw(yield);

#### SET SLOTS
our @DATA = qw(
ARGUMENTS
EXECUTABLE
PARAMETER
VALUES
REPLICATES
CONCURRENT
LOOPOUT
LABEL
CLUSTER
QUEUE
WALLTIME
CPUS
QSTAT
QSUB
MAXJOBS
SLEEP
CLEANUP
DOT

BATCHSTATS
COMMAND

);
our $DATAHASH;
foreach my $key ( @DATA )	{	$DATAHASH->{lc($key)} = 1;	}

=head2

	SUBROUTINE		run

	PURPOSE

		RUN THE APPLICATION FOR THE DESIGNATED PERMUTATION OF LOOPS

=cut

sub run {
	my $self		=	shift;

	#### GET ARGUMENT VALUES
	my $executable 	=	$self->loop_value("executable");
	my $parameter 	= 	$self->loop_value("parameter");
	my $values 		= 	$self->loop_value("values");
	my $replicates 	= 	$self->loop_value("replicates");
	my $loop 		= 	$self->loop_value("loop");
	my $loopout 	= 	$self->loop_value("loopout");
	my $label 		=	$self->loop_value("looplabel");

	#### EXTRACT CLUSTER-RELATED ARGUMENTS IF loop IS distributed
	my ($cluster, $outdir, $maxjobs, $queue);
	if ( $loop eq "distributed" )
	{
		$cluster=	$self->loop_value("cluster");
		$outdir =	$self->loop_value("outdir");
		$maxjobs=	$self->loop_value("maxjobs");
		$queue	=	$self->loop_value("queue");

		$self->loop_value("walltime");
		$self->loop_value("cpus");
		$self->loop_value("qstat");
		$self->loop_value("qsub");
		$self->loop_value("sleep");
		$self->loop_value("cleanup");
		$self->loop_value("dot");
	}

	my $oldout;
	if ( defined $loopout )
	{
		$self->logDebug("Printing STDOUT to loopout:\n\n$loopout\n");

		open $oldout, ">&STDOUT" or die "Can't open old STDOUT\n";
		#open $olderr, ">&STDERR" or die "Can't open old STDERR\n";

		my ($loopout_path) = $loopout =~ /^(.+)\/[^\/]+$/;
		File::Path::mkpath($loopout_path) if not -d $loopout_path;
		open(STDOUT, ">$loopout") or die "Can't open STDOUT file: $loopout\n" if defined $loopout;
	}

	#### GET THE REMAINING ARGUMENTS FOR THE EXECUTABLE
	my $arguments	=	$self->get_arguments();

	#### PRINT TO STDOUT IF DEFINED stdout
	$self->logDebug("executable", $executable);
	$self->logDebug("parameter", $parameter) if defined $parameter;
	$self->logDebug("values", $values) if defined $values;
	$self->logDebug("replicates", $replicates) if defined $replicates;
	$self->logDebug("loop", $loop) if defined $loop;
	$self->logDebug("cluster", $cluster) if defined $cluster;
	$self->logDebug("outdir", $outdir) if defined $outdir;
	$self->logDebug("label", $label) if defined $label;

	#### CHECK loop IS DEFINED AND CORRECT VALUE
	$self->logError("Logic::Loop::run    loop not defined. Exiting") if not defined $loop;
	if ( $loop eq "distributed" )
	{
		$self->logError("Logic::Loop::run    cluster not defined. Exiting") if not defined $cluster;
		$self->logError("Logic::Loop::run    label not defined. Exiting") if not defined $label;
		$self->logError("Logic::Loop::run    outdir not defined. Exiting") if not defined $outdir;
		$self->logError("Logic::Loop::run    maxjobs not defined. Exiting") if not defined $maxjobs;
		$self->logError("Logic::Loop::run    queue not defined. Exiting") if not defined $queue;
	}

	print "Logic::Loop::run    loop value not supported: $loop\n" and exit
		if $loop !~ /^(serial|parallel|distributed)$/;

	$self->logDebug("Neither parameter nor replicates is defined. Exiting.") if not defined $parameter and not defined $replicates;
	$self->logDebug("values not defined for parameter. Exiting.") if defined $parameter and not defined $values;

	#### GET VALUES AND REPLICATES ARRAYS
	my $values_array = [];
	@$values_array = split ",", $values if defined $values;

	my $replicates_array = $self->stringToArray($replicates);

	#### GET LOOPED COMMANDS
	my $commands = $self->loop($executable, $arguments, $parameter, $values_array, $replicates_array);

	#### COLLECT OVERALL STATUS AND FAILED OR DUBIOUS JOB LABELS
	my $status = 'unknown';
	my $sublabels = '';

	#### RUN COMMANDS ON CLUSTER
	if ( $loop eq "distributed" )
	{
		$self->logDebug("Running loop in $loop mode");

		my $jobs = [];
		for ( my $i = 0; $i < @$commands; $i++ )
		{
			my $replicate_number = $$replicates_array[$i];
			my $command = $$commands[$i];
			my $joblabel = "$label-$replicate_number";
			my $scriptfile = "$outdir/$label-$replicate_number.sh";
			my $usagefile = "$outdir/$label-$replicate_number-usage.txt";
			my $stdoutfile = "$outdir/$label-$replicate_number-stdout.txt";
			my $stderrfile = "$outdir/$label-$replicate_number-stderr.txt";

			my $job = $self->setJob([$command], $joblabel, $outdir, $scriptfile, $usagefile, $stdoutfile, $stderrfile);
			push @$jobs, $job;
		}

		#### USE LIB FOR CLUSTER MONITOR
		$self->logDebug("cluster: **$cluster**");

		if ( $cluster =~ /^PBS$/ )
		{
			$self->logDebug("DOING require Monitor::PBS");
			eval "require Monitor::PBS";
		}
		elsif ( $cluster =~ /^LSF$/ )
		{
			$self->logDebug("DOING require Monitor::LSF");
			eval "require Monitor::LSF";
		}
		elsif ( $cluster =~ /^SGE$/ )
		{
			$self->logDebug("DOING require Monitor::LSF");
			eval "require Monitor::SGE";
		}
		else
		{
			$self->logDebug("cluster $cluster did not match LSF or PBS");
		}

		#### WILL AUTOMATICALLY CHECK OUTPUTS FOR COMPLETION
		#### AND PRINT STATUS SIGNAL TO STDOUT
		($status, $sublabels) = $self->runJobs($jobs, $label);

		#### PRINT JOB STATUS SIGNAL
		print "\n------------------------------------------------------------\n";
		print "---[status $label: $status $sublabels]---";
		print "\n------------------------------------------------------------\n";

		$self->logDebug("Finished doing distributed jobs");
	}

	#### RUN COMMANDS IN PARALLEL LOCALLY
	elsif ( $loop eq "parallel" )
	{
		$self->logDebug("DOING CONCURRENT JOBS");
		my $threads = [];
		for my $command ( @$commands )
		{
			$self->logDebug("CONCURRENT", $command);
			my $thread = threads->new(
				sub {
					return `$command`;
				}
			);
			sleep(1);
			push @$threads, $thread;
		}

		my $outputs = [];
		foreach my $thread ( @$threads )
		{
			my $output = $thread->join;
			$self->logDebug("OUTPUT", $output);
			push @$outputs, $output;
		}

		#### CHECK OUTPUTS FOR COMPLETION
		($status, $sublabels) = $self->completionStatus($outputs);

		#### PRINT JOB STATUS SIGNAL
		print "\n------------------------------------------------------------\n";
		print "---[status $label: $status $sublabels]---";
		print "\n------------------------------------------------------------\n";

		$self->logDebug("Finished doing parallel jobs");
	}

	#### RUN COMMANDS IN SERIES
	elsif ( $loop eq "serial" )
	{
		$self->logDebug("Running loop in 'serial' mode");

		#### RUN THE COMMANDS
		my $outputs = [];
		foreach my $command ( @$commands )
		{
			$self->logDebug("$command");
			my $output = `$command`;
			push @$outputs, $output;
		}

		#### CHECK OUTPUTS FOR COMPLETION
		($status, $sublabels) = $self->completionStatus($outputs);

		($label) = $executable =~ /([^\/]+)$/ if not defined $label;

		#### PRINT JOB STATUS SIGNAL
		print "\n------------------------------------------------------------\n";
		print "---[status $label: $status $sublabels]---";
		print "\n------------------------------------------------------------\n";

		$self->logDebug("Finished doing distributed jobs");
	}
	else
	{
		$self->logDebug("Exiting. Missing handler for loop mode", $loop);
		exit;
	}

	##### RESTORE OLD STDOUT
	if ( defined $oldout )
	{
		$self->logDebug("Redirecting STDOUT back to standard output");
		open STDOUT, ">&", $oldout;
	}

	#### PRINT JOB STATUS SIGNAL
	print "\n------------------------------------------------------------\n";
	print "---[status $label: $status $sublabels]---";
	print "\n------------------------------------------------------------\n";
}

sub completionStatus {
	my $self		=	shift;
	my $outputs		=	shift;

	$outputs = [$outputs] if ref($outputs) ne "ARRAY";

	#### COLLECT JOB COMPLETION SIGNAL (AND SUBLABELS OF INCOMPLETE
	#### JOBS, MISSING FILES OR BOTH - I.E., FAILED JOBS)
	#### STATUS REPORTING HIERARCHY: completed < incomplete < missing < failed
	my $overall_status = "completed";
	my $overall_sublabels = '';
	my ($label, $status, $sublabels);
	foreach my $output (@$outputs)
	{
		if ( $output =~ /---\[status\s+(\S+):\s+(\S+)\s*(\S*)\]/ms )
		{
			$label = $1;
			$status = $2;
			$sublabels = $3;
			$self->logDebug("Job label '$label' completion signal", $status);
			$overall_status = "complete" if $status eq "complete"
				and $overall_status ne "incomplete"
				and $overall_status ne "missing"
				and $overall_status ne "failed";
			$overall_status = "incomplete" if $status eq "incomplete"
				and $overall_status ne "missing"
				and $overall_status ne "failed";
			$overall_status = "missing" if $overall_status eq "missing"
				and $overall_status ne "failed";
			$overall_status = "failed" if $status eq "failed";
			$overall_sublabels .= $sublabels . "," if $sublabels
				and $status ne "complete";
		}
	}

	return ($overall_status, $overall_sublabels);
}

=head2

	SUBROUTINE		loop

	PURPOSE

        CONVERT AN ARGUMENT OF THE FORM "1-3,five,six" INTO

		AN ARRAY OF THE FORM [1,2,3,"five","six"]

=cut
sub stringToArray {
	my $self	=	shift;
	my $string	=	shift;

	my $array;
	if ( $string =~ /^(\d+)\-(\d+)$/ )
	{
		my $start = $1;
		my $end = $2;
		for my $time ( $start .. $end )
		{
			push @$array, $time;
		}
	}
	else
	{
		@$array = split ",", $string;

		for ( my $i = 0; $i < @$array; $i++ )
		{
			my $replicate = $$array[$i];
			if ( $replicate =~ /^(\d+)\-(\d+)$/ )
			{
				splice @$array, $i, 1;
				$i--;
				my $start = $1;
				my $end = $2;
				for my $time ( $start .. $end )
				{
					push @$array, $time;
					$i++;
				}
			}
		}
	}

	return $array;
}

=head2

	SUBROUTINE		loop

	PURPOSE

        1. REPEATEDLY EXECUTE AN APPLICATION, CHANGING THE VALUE OF

			THE SPECIFIED PARAMETER EVERY TIME

		2. REPEAT FOR A SPECIFIED NUMBER OF REPLICATES

    INPUT

        1. EXECUTABLE AND ITS ARGUMENTS (WITH STRING '%VALUE%'

			IN THE PLACE OF THE ACTUAL PARAMETER VALUE)

		2. PARAMETER TO BE CHANGED

		3. COMMA-SEPARATED LIST OF VALUES FOR THE PARAMETER

		4. COMMA-SEPARATED LIST OF REPLICATES

    OUTPUT

        1. OUTPUTS OF EACH RUN OF THE EXECUTABLE USING A

			DIFFERENT VALUE FOR THE PARAMETER EACH TIME

=cut

sub loop {

	my $self		=	shift;
	my $executable	=	shift;
	my $arguments	=	shift;
	my $parameter	=	shift;
	my $values		=	shift;
	my $replicates	=	shift;
	$self->logDebug("Logic::Loop::loop(executable, arguments, parameter, values, replicates)");
	$self->logDebug("executable", $executable);
	$self->logDebug("arguments:  @$arguments");
	$self->logDebug("parameter", $parameter) if defined $parameter;
	$self->logDebug("values:     @$values") if defined $values;
	$self->logDebug("replicates: @$replicates") if defined $replicates;

	my $commands;

	#### RUN replicates TIMES WITH values VALUES
	for ( my $counter = 0; $counter < @$replicates; $counter++ )
	{
		my $replicate = $$replicates[$counter];
		#$self->logDebug("replicate", $replicate);

		if ( defined $parameter )
		{
			for ( my $i = 0; $i < @$values; $i++ )
			{
				my $instance_args;
				@$instance_args = @$arguments;

				my $value = $$values[$i];

				#### SUBSTITUTE replicate FOR ONE OR MORE '%REPLICATE%' STRINGS IN ALL ARGUMENTS
				$instance_args = $self->fill_in($instance_args, "%REPLICATE%", $replicate);

				#### SUBSTITUTE value FOR ONE OR MORE '%VALUE%' STRINGS IN ALL ARGUMENTS
				$instance_args = $self->fill_in($instance_args, "%VALUE%", $value);

				#### SUBSTITUTE parameter FOR ONE OR MORE '%PARAMETER%' STRINGS IN ALL ARGUMENTS
				$instance_args = $self->fill_in($instance_args, "%PARAMETER%", $parameter);

				#### ADD parameter ARGUMENT TO FRONT OF ARGS
				unshift @$instance_args, "$parameter $value";

				my $command = "$executable @$instance_args";
				#$self->logDebug("command", $command);

				push @$commands, $command;
			}
		}
		else
		{
			my $instance_args;
			@$instance_args = @$arguments;

			#### SUBSTITUTE replicate FOR ONE OR MORE '%REPLICATE%' STRINGS IN ALL ARGUMENTS
			$instance_args = $self->fill_in($instance_args, "%REPLICATE%", $replicate);

			foreach my $arg ( @$instance_args )
			{
				$arg = qq{"$arg"};
			}

			my $command = "$executable @$instance_args";

#exit;

			$self->logDebug("command", $command);
			push @$commands, $command;
		}
	}

	return $commands;
}

=head2

	SUBROUTINE		set_parameter

	PURPOSE

		SET THE VALUE OF A PARAMETER IN arguments

=cut
sub set_parameter {
	my $self		=	shift;
	my $arguments		=	shift;
	my $parameter			=	shift;
	my $value			=	shift;
	$self->logDebug("Logic::Loop::set_parameter(arguments, parameter, value)");
	$self->logDebug("parameter", $parameter);
	$self->logDebug("value", $value);

	for ( my $i = 0; $i < @$arguments; $i++ )
	{
		if ( "--$parameter" eq $$arguments[$i] )
		{
			$$arguments[$i + 1] = $value;
			return $arguments;
		}
	}

	return $arguments;
}

=head2

	SUBROUTINE		fill_in

	PURPOSE

		SUBSTITUTE counter FOR ONE OR MORE '%REPLICATE%' STRINGS IN ALL ARGUMENTS

=cut
sub fill_in {
	my $self		=	shift;
	my $arguments		=	shift;
	my $pattern			=	shift;
	my $value			=	shift;

	foreach my $argument ( @$arguments )
	{
		$argument =~ s/$pattern/$value/ig;
	}

	return $arguments;
}

=head2

	SUBROUTINE		loop_value

	PURPOSE

		1. EXTRACT THE VALUE FOR THE NAMED ARGUMENT FROM THE arguments

			ARRAY AND RETURN IT

		2. REPLACE THE EXITING arguments ARRAY WITH THE NEWLY TRUNCATED ONE

=cut

sub loop_value {
	my $self			=	shift;
	my $name			=	shift;

	my $arguments		=	$self->get_arguments();

	my $value;
	for ( my $i = 0; $i < @$arguments; $i++ )
	{
		if ( "--$name" eq $$arguments[$i] )
		{
			$value = $$arguments[$i + 1];

			splice @$arguments, $i, 2;
			$self->{"_$name"} = $value;
		}
	}

	$self->set_arguments($arguments);
	#$self->{_arguments} = $arguments;

	return $value;
}

################################################################################
##################			HOUSEKEEPING SUBROUTINES			################
################################################################################

=head2

	SUBROUTINE		new

	PURPOSE

		CREATE THE NEW self OBJECT AND INITIALISE IT, FIRST WITH DEFAULT

		ARGUMENTS, THEN WITH PROVIDED ARGUMENTS

=cut

sub new {
 	my $class 		=	shift;
	my $arguments 	=	shift;

	my $self = {};
    bless $self, $class;

	#### INITIALISE THE OBJECT'S ELEMENTS
	$self->initialise($arguments);

    return $self;
}

=head2

	SUBROUTINE		initialise

	PURPOSE

		INITIALISE THE self OBJECT:

			1. LOAD THE DATABASE, USER AND PASSWORD FROM THE ARGUMENTS

			2. FILL OUT %VARIABLES% IN XML AND LOAD XML

			3. LOAD THE ARGUMENTS

=cut

sub initialise {
    my $self		=	shift;
	my $arguments	=	shift;

    #### VALIDATE USER-PROVIDED ARGUMENTS
	($arguments) = $self->validate_arguments($arguments, $DATAHASH);

	#### LOAD THE USER-PROVIDED ARGUMENTS
	foreach my $key ( keys %$arguments )
	{
		#### LOAD THE KEY-VALUE PAIR
		$self->value($key, $arguments->{$key});
	}

	##### REQUIRED: CALL THE PARENT FOR ADDITIONAL INITIALISATION
	#$self->SUPER::initialise();
}

=head2

	SUBROUTINE		value

	PURPOSE

		SET A PARAMETER OF THE self OBJECT TO A GIVEN value

    INPUT

        1. parameter TO BE SET

		2. value TO BE SET TO

    OUTPUT

        1. THE SET parameter INSIDE THE BioSVG OBJECT

=cut
sub value {
    my $self		=	shift;
	my $parameter	=	shift;
	my $value		=	shift;

	$parameter = lc($parameter);

    if ( defined $value)
	{
		$self->{"_$parameter"} = $value;
	}
}

=head2

	SUBROUTINE		validate_arguments

	PURPOSE

		VALIDATE USER-INPUT ARGUMENTS BASED ON

		THE HARD-CODED LIST OF VALID ARGUMENTS

		IN THE data ARRAY
=cut

sub validate_arguments {
	my $self		=	shift;
	my $arguments	=	shift;
	my $DATAHASH	=	shift;

	my $hash;
	foreach my $argument ( keys %$arguments )
	{
		if ( $self->is_valid($argument, $DATAHASH) )
		{
			$hash->{$argument} = $arguments->{$argument};
		}
		else
		{
			warn "'$argument' is not a known parameter\n";
		}
	}

	return $hash;
}

=head2

	SUBROUTINE		is_valid

	PURPOSE

		VERIFY THAT AN ARGUMENT IS AMONGST THE LIST OF

		ELEMENTS IN THE GLOBAL '$DATAHASH' HASH REF

=cut

sub is_valid {
	my $self		=	shift;
	my $argument	=	shift;
	my $DATAHASH	=	shift;

	#### REMOVE LEADING UNDERLINE, IF PRESENT
	$argument =~ s/^_//;

	#### CHECK IF ARGUMENT FOUND IN '$DATAHASH'
	if ( exists $DATAHASH->{lc($argument)} )
	{
		return 1;
	}

	return 0;
}

=head2

	SUBROUTINE		AUTOLOAD

	PURPOSE

		AUTOMATICALLY DO 'set_' OR 'get_' FUNCTIONS IF THE

		SUBROUTINES ARE NOT DEFINED.

=cut

sub AUTOLOAD {
    my ($self, $newvalue) = @_;

    my ($operation, $attribute) = ($AUTOLOAD =~ /(get|set)(_\w+)$/);

    # Is this a legal method name?
    unless($operation && $attribute) {
        croak "Method name $AUTOLOAD is not in the recognized form (get|set)_attribute\n";
    }
    unless( exists $self->{$attribute} )
	{
#        croak "No such attribute '$attribute' exists in the class ", ref($self);
#		return undef;
    }

    # Turn off strict references to enable "magic" AUTOLOAD speedup
    no strict 'refs';

    # AUTOLOAD accessors
    if($operation eq 'get') {

		return $self->{$attribute};

        # define subroutine
        *{$AUTOLOAD} = sub { shift->{$attribute} };

    # AUTOLOAD mutators
    }elsif($operation eq 'set') {

        # define subroutine
        *{$AUTOLOAD} = sub {

			#shift->{$attribute} = shift;

			my $object = shift;
			my $value = shift;

			$object->{$attribute} = $value;

		};

        # set the new attribute value
        $self->{$attribute} = $newvalue;
    }

    # Turn strict references back on
    use strict 'refs';

    # return the attribute value
    return $self->{$attribute};
}

# When an object is no longer being used, this will be automatically called
# and will adjust the count of existing objects
sub DESTROY {
    my($self) = @_;

	#if ( defined $self->{_databasehandle} )
	#{
	#	my $dbh =  $self->{_databasehandle};
	#	$dbh->disconnect();
	#}

#    my($self) = @_;
}

1;

redpajama_set_name: RedPajamaGithub


text:
Q: Convert SQL query to LINQ to SQL How do you convert a SQL query with nested SELECT statements to a LINQ statement?
I have the following SQL statement which outputs the results I need but I'm not sure how to replicate this in LINQ .
SELECT X.ITMGEDSC, (SUM(X.[ENDQTY_I]) - SUM(X.[ORDERLINES])) AS AVAIL
FROM SELECT T1.[MANUFACTUREORDER_I],T2.[ITMGEDSC],T1.[ENDQTY_I],
(SELECT (COUNT(VW.[MANUFACTUREORDER_I]) - 1)
FROM [PLCD].dbo.[vw_WIP_Srl] VW
WHERE VW.[MANUFACTUREORDER_I] = T1.[MANUFACTUREORDER_I]
GROUP BY VW.[MANUFACTUREORDER_I]) AS ORDERLINES
FROM [PLCD].dbo.[vw_WIP_Srl] T1
INNER JOIN [PLCD].dbo.IV00101 T2 ON T2.ITEMNMBR = T1.ITEMNMBR
GROUP BY T1 [MANUFACTUREORDER_I],T2.[ITMGEDSC],T1.[ENDQTY_I]) AS X
GROUP BY X.ITMGEDSC

ITEMNMBR is the ID of an item including a revision number, for example A1008001. The last 3 numbers denote the revision. So A1008002 are the same item, just differing revisions. In my query I need to treat these as the same item and output only the quantity for the parent item number (A1008). This parent item number is the column IV00101.ITMGEDSC.
The above code would take the following data
MANUFACTUREORDER_I        ITEMNMBR      ENDQTY_I
MAN00003140               A1048008      15
MAN00003507               A1048008      1
MAN00004880               A10048001     15
MAN00004880               A10048001     15
MAN00004880               A10048001     15

and output the following results
ITEMNMBR      QTY
A1048008      16
A10048001     13*

*

*The reason that this value is 13 and NOT 45 is because they are all part of the same MANUFACTUREORDER_I. In the system this therefore means that there were 15 in stock but two of these have then been transacted out of stock to be used. Hence the 3 rows, one for the goods coming into stock, the other two for two items going out of stock (ignore the quantity in these rows)

As I mentioned at the start, the SQL above gives me the output I'm after but I'm unsure how to replicate this in Linq.
UPDATE - JEFF'S ORIGINAL SOLUTION
var query = from item in db.vw_WIP_Srls
group new { item.MANUFACTUREORDER_I, item.ENDQTY_I } by item.ITEMNMBR into items
select new
{
    ItemNumber = items.Key,
    QtyAvailable = (from item in items
           //assumes quantities equal per order number
           group 1 by item into orders
           select orders.Key.ENDQTY_I - (orders.Count() - 1))
          .Sum()
};

A: Here you go.  Unfortunately I couldn't see the comment you left me anymore but I believe this should be equivalent.  I changed the names to match closely with your query.
var query = from a in db.vw_WIP_Srl
            join b in db.IV00101 on a.ITEMNMBR equals b.ITEMNMBR
            group new { a.MANUFACTUREORDER_I, a.ENDQTY_I } by b.ITMGEDSC into g
            select new
            {
                ITMGEDSC = g.Key,
                AVAIL = (from item in g
                         group 1 by item into orders
                         select orders.Key.ENDQTY_I - (orders.Count() - 1))
                        .Sum()
            };

redpajama_set_name: RedPajamaStackExchange


I've done a lot of editing on the blog over the past week, updating postings with inline images. I've now done this back to early June, 2012 – and plan to eventually update the whole thing.
Is it worth going back? I think so. For starters, I like the look of the blog a lot better. But equally important for me, it's a chance to review what I've done – and written about. I'm finding things I forgot about, that really pleased me at the time. And I'm finding things I said I would have to tackle, but have forgotten about. Time to make a list of those – or, at a minimum, re-read my blog periodically.
At the bench, I'm currently working on Pierre Oliver's tobacco kilns – and, since spring is around the corner, I've also brushed off a project related to my interest in live steam garden railways. I'll continue to blog on these – and of course, the S scale adventure – as I make progress.
By the way, I've now updated almost a full year's worth of blog entries. I'm back to April, 2012. It's interesting to review the layout in its Plywood Pacific stage, and realize how far it has come. It's also neat to see some of the changes I've made to my plans and ideas as I made progress on the layout. No compromises – just different ways to do things as I discovered new techniques, or new prototype information.


text:
Blake Adams is a fortunate, if unfamiliar, name upon the Players leaderboard
By Derek Evers
(Photo by Sam Greenwood/Getty Images Sport)
PONTE VEDRA BEACH, Fla. -- The PGA Tour media guide lists Swainsboro, Ga., as the residence of Blake Adams. But technically, the native of nearby Eatonton makes his home in a place that makes those two rural places seem like metropolises.
"We live in a little town called Nunez, which is 130 people and no red lights," he said.
If Adams keeps playing this way, he could have that many people just from the media asking him questions come Sunday evening. A Thursday 66 at TPC Sawgrass made the 36-year old an unlikely first-round contender at the Players.
"Obviously, any time you finish a nine with five-straight birdies, it's a good day," said Adams, who missed the cut in his only other Players appearance last year. "I was fortunate to get out early. Had perfect greens; I was the first group out."
Fortunate is a word Adams seems to use a lot. The journeyman pro doesn't hold back on how lucky he feels to play golf for a living and the experiences his job brings.
"The whole mindset is just crazy, that you can play a game for a living, and get paid doing it, and go to these wonderful places," he said. "You know, basically have family vacations every week all over the country. That's just insane. But that's what we do, just very, very blessed."
Related: Points' withdrawal causes unusual situation
Of course, Adams loves being at home too, where he's built a driving range and practice green on his 350 acres. He says his location helps him get away from the game. In his spare time he loves fishing and hunting.
"All of these guys out here live amongst these gated, fancy golf courses," he said. "And we live among deer and turkeys and dirt roads."
"I'm kind of hard to find, where I live, so it's just me and my family and we just hang out and you know, enjoy life."
After attending the University of Georgia for three years, Adams transferred and graduated from Georgia Southern, the same school attended by 1990 Players champion Jodie Mudd. But Adams, whose best finish on tour this year was a T-9 at the Puerto Rico Open and who has just seven top 10s in his PGA Tour career, would be an even more surprising winner.
A Players champion who lives in a place with no traffic lights? Well, we've already seen a Masters champ, Bubba Watson, who hails from Bagdad, a Florida town more than 10 times the size of Nunez.
"We are just simple folks and we just, you know, like the quietness and it's just -- it's us," Adams said of his family. "We don't need the glitz and glamour and all this."
Of course, he'd make an exception for a certain crystal trophy.
-- Alex Myers
Follow @AlexMyers3

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: Can C++ be used as a server-side web development language? I'd like to get into web development using C++ as the "scripting language" on the server-side.  My server infrastructure is *nix based, so doing web development in C++ on Azure is not applicable and C++/CLI ASP.NET is also not applicable.
Separate from legacy CGI applications, can web development be done using C++ ?

A: The short answer is, ANYTHING can be used to write a webpage provide it can read the input, write interpretable output, and is executable by the webserver.
Technically, any language can be used as a CGI script provided it:

*

*Interprets all the inputs and environment as presented by the server

*Outputs in a known markup language (generally html)

*Can be ran by the server

There are also other ways too. Perl has the ability to be built as a wrapper around c/c++ code, acting as an interpreting layer between the two (and this is not including perl modules that are flat out compiled as C).

A: in the beginning, it was quite common - the first web sites I worked on in the late 1990s were ISAPI extensions written in C++, and they worked quite well.

A: Absolutely.
There are even several frameworks for developing them, including Wt, cppcms, CSP, and others. FastCGI's mainline implementation is in C, and directly supports several languages, including C++.
Any programming language that can parse strings can be used in CGI or a servlet. Any language that can implement bindings with C libraries can also be used to develop modules for ISAPI- or Apache-compatible servers.
It's not particularly easy in C++, and good templating engines are few and far between, but it can be done.
Of course, the question of whether this is a good idea is another matter entirely. :)
Do note: Major websites like Amazon.com, eBay, and Google do use C++ for parts of their infrastructure. Realize, however, that Google only uses C++ for speed-critical systems, and Amazon.com only relatively recently switched away from Lisp (which angered some of their senior staff :).
Facebook formerly compiled PHP to C++, but their HipHop compiler (written partly in C++) has since been retooled as a bytecode virtual machine.

A: It appears Microsoft thinks it can too. Check out Casablanca which is a new set of tooling for (it appears) Azure using C++.

Casablanca is a project to start exploring how to best support C++
  developers who want to take advantage of the radical shift in software
  architecture that cloud computing represents.
Here's what you get with Casablanca:

*

*Support for accessing REST services from native code on Windows Vista, Windows 7, and Windows 8 Consumer Preview by providing asynchronous C++ bindings to HTTP, JSON, and URIs

*A Visual Studio extension SDK to help you write C++ HTTP client side code in your Windows 8 Metro style app

*Support for writing native-code REST for Azure, including Visual Studio integration

*Convenient libraries for accessing Azure blob and queue storage from native clients as a first class Platform-as-a-Service (PaaS)
  feature

*A consistent and powerful model for composing asynchronous operations based on C++ 11 features

*A C++ implementation of the Erlang actor-based programming model

*A set of samples and documentation

A: For PHP you can write your own C/C++ extensions and get good performance benefits that way. If I had a really CPU intensive part of my web application I would probably make a small C++ library that offloaded that processing to the extension and then returned the result back to the PHP and then the PHP outputs it to the browser.
The other thing people don't often consider is offloading certain CPU processing to the client side e.g. JavaScript/jQuery. If I've got a web server, I might need a a 3Ghz CPU to do CPU intensive processing for a particular function (maybe some data processing). My company is paying money for that server each month to keep it running. If I want to scale up operations for a 100 concurrent users running that CPU intensive task at the same time then maybe I need multiple CPUs and servers, increasing the cost to my business. If I offload that CPU intensive task to the client side, then each user that visits the website can do their own processing on the data and I don't have to increase my server capability therefore saving me money.
After all with all with the collective power of 100+ desktops/tablets/mobiles doing the processing for you that's a lot more power than your server sitting in a datacenter somewhere costing your business money each month to keep running. Potentially then all your server would be doing would be retrieving data from the database, serving content and a bit of pre/post processing and validation of the data before storing back in the database. Obviously you wouldn't make the client side code too CPU intensive which might block/freeze the web browser UI, you might fire off an AJAX request to the server, retrieve the data and then process the data asynchronously client-side, leaving the web-browser UI completely usable.

A: Yes, it can be used. The others have mentioned various approaches. Here is my own approach. The advantage is that it is totally portable and self-contained, all the picked libraries only depend on ANSI C. Setting it up only requires the Linux Kernel and a C compiler (And the obvious stuff like Busybox, bash, etc) (or Windows and a compiler), no extra libraries are needed, no fancy huge installations.
The result is a single program which is both a web server and a dynamic page generator (Substitutes both "apache" and "php"), it will also have database access via sqlite.
Libraries used:

*

*Mongoose - Http server

*Sqlite - SQL Database

*MiniXML - Makes dynamic page generation easier. sort of like Javascript's createElement
The rest of this answer is a complete set-up guide for Linux. Both SQlite and MiniXML are optional, but the guide covers the full installation. It is up to you to comment out the non needed parts if you're interested in disabling either sqlite or MiniXML.
1. Download the 3 libraries

*

*Mongoose from Github (Hit the "download ZIP")

*Sqlite from sqlite.org (You will need Source code > sqlite-amalgamation-< version >.zip)

*MiniXML from msweet.org (mxml-< verison >.tar.gz)

2. Prepare your folder

*

*Create an empty folder (We'll call it the main folder)

*Put the following files in it:

*

*From the sqlite tar.gz: sqlite3.c , sqlite3.h

*From the Mongoose zip: mongoose.c , mongoose.h

*From the mxml tar.gz: mxml.h
3. Compile mxml
You may have noticed mxml.c is missing, this is because we need to create  a static mxml library. Go to the folder where the mxml tar.gz was downloaded and perform:
tar -xvf mxml-<version>.tar.gz #Extract the tar
cd mxml-<version> #Go to the newly extracted directory
./configure #prepare the compiler
make #compile, you may need to install "make" first.

Once the compilation is finished, many files will be generated, the only file of interest to us is libmxml.a, copy that file into the main folder.
3.1 Doublecheck
Check that the main folder has the following:

*

*For mongoose: mongoose.c, mongoose.h

*For mxml: libmxml.a, mxml.h

*for sqlite: sqlite.c, sqlite.h
4. main.c
Let's create the actual program, create a main.c file in the main folder, here is a skeleton for you to get started.
#include <string.h>
#include <stdio.h>

#include "mongoose.h"
#include "mxml.h"
#include "sqlite3.h"

/***Sqlite initialization stuff***/
//comment out everything sqlite related if you don't want sqlite, including the callback function and the include "sqlite3.h"
static int callback(void * custom, int argc, char **argv, char **azColName);
char *zErrMsg = 0;
sqlite3 *db;
int rc;

/***Just some laziness shortcut functions I made***/
typedef mxml_node_t * dom; //type "dom" instead of "mxml_node_t *"
#define c mxmlNewElement   //type "c" instead of "mxmlNewElement"
inline void t(dom parent,const char *string) //etc
{
    mxmlNewText(parent, 0, string);
}

//type "sa" instead of "mxmlElementSetAttr"
inline void sa(dom element,const char * attribute,const char * value)
{
    mxmlElementSetAttr(element,attribute,value);
}

//The only non boilerplate code around in this program is this function
void serve_hello_page(struct mg_connection *conn)
{
    char output[1000];
    mg_send_header(conn,"Content-Type","text/html; charset=utf-8");
    mg_printf_data(conn, "%s", "<!DOCTYPE html>");
    //This literally prints into the html document

    /*Let's generate some html, we could have avoided the
     * xml parser and just spat out pure html with mg_printf_data
     * e.g. mg_printF_data(conn,"%s", "<html>hello</html>") */

    //...But xml is cleaner, here we go:
            dom html=mxmlNewElement(MXML_NO_PARENT,"html");
                dom head=c(html,"head");
                    dom meta=c(head,"meta");
                    sa(meta,"charset","utf-8");
                dom body=c(html,"body");
                    t(body,"Hello, world<<"); //The < is auto escaped, neat!
                    c(body,"br");
                    t(body,"Fred ate bred");
                dom table=c(body,"table");
                sa(table,"border","1");

                //populate the table via sqlite
                rc = sqlite3_exec(db, "SELECT * from myCoolTable", callback, table, &zErrMsg);
                if( rc!=SQLITE_OK )
                {
                    fprintf(stderr, "SQL error: %s\n", zErrMsg);
                    sqlite3_free(zErrMsg);
                }

            mxmlSaveString (html,output,1000,  MXML_NO_CALLBACK);
            mg_printf_data(conn, "%s", output);
            mxmlDelete(html);
}

//sqlite callback
static int callback(void * custom, int argc, char **argv, char **azColName)
{
    //this function is executed for each row
    dom table=(dom)custom;

    dom tr=c(table,"tr");
    dom td;
    int i;
    for(i=0; i<argc; i++)
    {
        td=c(tr,"td");
        if (argv[i])
            t(td, argv[i]);
        else
            t(td, "NULL");

        printf("%s == %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }
     printf("\n");
     return 0;
}

static int event_handler(struct mg_connection *conn, enum mg_event ev)
{
    if (ev == MG_AUTH)
    {
        return MG_TRUE;   // Authorize all requests
    }
    else if (ev == MG_REQUEST)
    {
        if (!strcmp(conn->uri, "/hello"))
        {
            serve_hello_page(conn);
            return MG_TRUE;   // Mark as processed
        }
    }
    return MG_FALSE;  // Rest of the events are not processed

}

int main(void)
{
    struct mg_server *server = mg_create_server(NULL, event_handler);
    //mg_set_option(server, "document_root", "."); //prevent dir listing and auto file serving
    //TODO can I allow file listing without dir listing in a specified directory?
    mg_set_option(server, "listening_port", "8080");

    rc = sqlite3_open("db.sqlite3", &db);

    if( rc )
    {
        fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);
        return(1);
    }

    printf("Server is running on port 8080!\n");
    for (;;)
    {
        mg_poll_server(server, 1000);  // Infinite loop, Ctrl-C to stop
    }
    mg_destroy_server(&server);
    sqlite3_close(db);

    return 0;
}

/*
 * useful stuff:
 * mg_send_file(struct mg_connection *, const char *path); - serve the file at *path*/

Finally, compiling!
Let's compile. cd to your main folder and execute these:
gcc -c main.c
gcc -c mongoose.c
gcc -c sqlite3.c
gcc -o server.out main.o mongoose.o sqlite3.o -ldl -lpthread -lmxml -L .

Now, execute server.out with /server.out, and navigate to localhost:8080/hello
Done :)

A: Why not?
The OkCupid dating site is created with C++. There are probably other examples.
There's also a Qt-inspired toolkit for developing web applications with C++ called Wt.

A: If you're planning to write your web application in C++, it would be total waste to then interface it as CGI.
My suggestion would be to build it asynchronous using ASIO (Asynchronous I/O). With that you can build blazing fast web service (combine with nginx as a reverse-proxy and statics server for best effects); Combine that with template library like Wt and you're ready to serve tens of thousands request per second from a single server.
Whether this is practical alternative to dynamic language web framework is another issue.

A: I guess that several embedded systems (e.g. routers, printers, ...) have some C++ driven web server.
In particular, you could use some HTTP server library like libonion to add some web capabilities to some C or C++ program, or to develop a light server with some web interface.
Some people are coding their Web server or their HTTP interface in Ocaml using Ocsigen. Not every web thing is PHP. And with FastCGI you could some dynamic web processing in/to your application.


"Leh Lehizdayen!" (Hebrew for f**k you).
This is a typical interaction between Khalil* and one of the neighboring settlers. Owning a shop in the Old City of Hebron within the Israeli controlled H2 precinct has its peculiar challenges. With 500 settlers living in four settlements next to at least 30,000 Palestinians, H2 remains a focal point for Israeli-Palestinian tensions. Home to a magnificent Herodian structure called the Haram Al-Ibrahimi (also known as the Tomb of the Patriarchs), the area holds immense religious value to Muslims and Jews alike. It is no surprise that Hebron has a reputation for being a troubled city.
Determined to enhance my understanding of the perpetual Israeli-Palestinian conflict as well as to satisfy my zealous infatuation with Middle Eastern affairs, I embarked on my first trip to the region, destination: Hebron. Entering the Palestinian Authority-controlled H1 area of Hebron was an experience in itself. Driving along Central Hebron's Ein-Sarah Street one sees a lively city: Frantic drivers trying to navigate amidst busy traffic, bustling stores and markets with merchants screaming prices to entice passers-by and young students who've just finished class at the Al-Hussein bin Ali Secondary School littered along the main street playing all sorts of games.
Walking through the famed Bab Al-Zawiya market, I crossed into the H2's Old City. Welcoming me was the imposing and heavily fortified Beit Romano building guarded by Israeli soldiers. Manoeuvring through the paths of the archaic Old City passageways, the atmosphere was a disturbing contrast to Hebron's center, pervaded by a mysterious quietness. Melancholic shopkeepers disheartened by the lack of business; young children sitting amongst the stray cats; and looking up, one sees a net cast over the open segments of the passageway to prevent potential damage from rock-throwing settlers. At the end of the pass was a checkpoint with metal detectors staffed by IDF soldiers. Exit through and on your right in all its glory stands the Tomb of the Patriarchs. Straight ahead is Al-Shuhada Street. Welcome to Khalil's reality.
Al-Shuhada Street is a pertinent illustration of the occupation's devastating impact on local businesses. It was once the prominent economic and cultural point of the Old City, existing as a vibrant commercial center with large crowds congregating in its busy markets. Today, it is eerily quiet and void of any dynamic life with soldiers stationed at various points, protecting settlers who use the street for passage. Despite agreements negotiated in the Hebron Protocol, from the Second Intifada onwards, economic activity has been extinguished on the once-lively street. Perhaps recently it has only been associated with stabbings, shootings and of course settlers.
Attacked by five men armed with stones near his store on the infamous street, Khalil has firsthand experience of settler aggression. Protected by thousands of Israeli soldiers, the radical settlers make rough neighbors for the local Palestinians in H2. In particular, this area has a decorated history of settler violence against Palestinian residents. Khalil's story is echoed by similar accounts of Palestinian residents living in H2 who have complained of the lack of protection afforded to victims of settler attacks. Khalil's attackers escaped with impunity – a recurring theme in many Hebronite narratives. This concerning trend of settler impunity was noted at a UN Security Council briefing in November last year.
Khalil is all too familiar with Hebron's bloodshed. Recently, the situation has worsened – especially with the latest rounds of violence, which have aroused discussions pertaining to a 'Third Intifada'. At least 23 Palestinians have been the subjects of arbitrary extrajudicials killings by Israeli forces in H2's Old City since September 2015 in response to alleged stabbing attacks. Only recently an IDF soldier shot a subdued Palestinian stabbing assailant at point-blank range prompting even Israeli Prime Minister Benyamin Netanyahu to condemn the killing. Two of Khalil's teenage cousins were shot dead at a military checkpoint near H2's Al-Rajabi house after being fired upon by an Israeli soldier. Israeli authorities claim they thwarted a stabbing attack but a witness account suggested otherwise. Lamenting the loss of his cousins, Khalil acknowledges that Palestinian stabbing attacks do occur but remains highly skeptical of the idea that his two cousins would uncharacteristically risk their lives by carrying out a knifing attack. Interestingly, Khalil strongly expressed his disapproval of the recent wave of Palestinian stabbings.
Economically, the Old City in H2 has been crippled under the occupation. "I've sold nothing today," sighs Khalil while his friend standing nearby proclaims, "I hate these soldiers," referring to 3 IDF soldiers stationed outside the Jewish entrance of the Tomb of the Patriarchs. Shops in the Old City are at the mercy of Israeli authorities and can be closed at any time. In general, severe restrictions have been placed on residents of H2 and the Old City in particular. Since November last year these restrictions have included limitations on movement, increased checkpoints and the establishment of closed military zones. For a young man like Khalil who supports his family by operating the store, the financial consequences of these restrictions have been disastrous.
Like many other Hebronites, Khalil sees these punitive measures as Israeli attempts to purge Palestinians from the Old City. Although organizations exist like the Hebron Rehabilitation Committee, which works to restore the Old City, the situation remains intolerable for most. Only last month Khalil took part in a protest demanding the opening of Al-Shuhada Street and an end to the severe restrictions imposed on residents of H2 by the IDF, which have made life unbearable.
Predictably so and to the distaste of Khalil and H2's Palestinian population, Netanyahu has reiterated his continued support for settlements notwithstanding their illegality under international law according to the Fourth Geneva Convention. Even with Netanyahu's allies criticizing illegal settlements, the current Israeli administration remains undeterred from continuing to pursue these controversial policies. Unfortunately, the negative multidimensional effect of these settlements on people like Khalil is often overlooked by the mainstream media.
Yet, in the face of all his tragedies and hardships, Khalil remains optimistic in contrast to his friends and most other residents from H2's largely demoralized and traumatized population. "I hope we have peace in the future. Jews and Muslims living together," he says, envisioning a binational state for Palestinians and Israelis. Dissimilar to the settlers of Hebron who refuse to befriend him, Khalil speaks positively of his Jewish friends in Tel Aviv. "Any Jewish person is welcome to come to my house. But peace cannot be made with a gun," he says, referring to the ongoing occupation.
The truth, he believes, is being distorted by both Israeli and Palestinian media for political purposes as Khalil emphasizes his distrust for online news reports, distaste for incitement on local television and disapproval of dubious government agendas. Remaining hopeful for an improvement in the situation, Khalil calls on ordinary Israelis to awaken and challenge their government's occupation of Hebron. Hebron is a quintessential example of Israel's occupation and settlement policies creating a sense of hopelessness for young Palestinians and feeding extremist ideologies in the West Bank. UN Secretary General Ban Ki-moon in a statement this January cited the occupation, expansion of settlements and Israel's lack of commitment to a two-state solution as factors contributing to Palestinian violence in the West Bank.
* The name and any other revealing details have been altered for security reasons.


We place a high emphasis on exploring alternative means of dispute resolution before any litigation process is considered.
Our litigation team offers a wide range of legal services and represents both corporate and individual clients.
We place a high emphasis on exploring alternative means of dispute resolution before any litigation process is considered. However, our clients are assured that disputes which cannot be resolved in this way will be pursued by our passionate and professional team of attorneys who have extensive experience both in the High and Magistrates' courts, and before tribunals.
As well as general civil litigation, our litigation department acts in, and advises on, all aspects of commercial and contractual disputes and litigation related to the other services provided by our firm.


The site Ogilvy.com is online !
Ogilvy.com is the No. 26757 ranked in most visited website in the world (ranked 12067 in its main country : INDE). The site can be estimated to be worth € 109 445 with a potential monthly income of € 1 505 generated by advertising. The site has a Pagerank™ of 6 /10, is hosted on the IP : 83.221.37.100 (Düsseldorf, ALLEMAGNE look at the map) and is registered in the DMOZ directory : Agencies/Full Service. This site has been online for 23 years, 10 months and 29 days and has accumulated at least 3 286 links. Our data have been updated at 02:20:14, 22 February 2013 and we found a number of unique visitors of 11 055 per day for 16 720 page views. The loading time of the site is fast : 0.03036 seconds (page weight : 0,25 Mo).
* Number of visits or page views of this site per million internet user. For example, a schedule set like this: In 3 months, for one million visitors, 67 of them visited Ogilvy.com, this figure is down by -5.73% from the previous week.
The IP address of the server (83.221.37.100) is located near: Düsseldorf (ALLEMAGNE).
The following graph shows the evolution of searches done on Google ™ for the query: Ogilvy.com over time.
The following HTTP header is the last encountered for the domain Ogilvy.com (after any 301, 302...).


Texas Department of Public Safety have released the names in the head-on collision that occurred about 9 p.m. Tuesday at the intersection of Farm Road 1442 and Cajun Way, in Orangefield.
According to the DPS, the driver of at 2006 GMC Sierra was Kelly Marie Dutta, 33 of Beaumont.
In the passenger seat was Margaret Jane Cottom, 61, of Jasper. Also in the truck was three year old Emily Dutta Knoddin. She was rushed to Texas Children's Hospital in Houston by helicopter and is listed in critical condition.
Earlier reports of a second child in the truck have not been confirmed.
The driver of the SUV was identified as Kathy Harrison Viator, 47, of Orange.
Troopers said Dutta, travelling south on Farm Road 1442 was attempting to turn on Cajun Way, when they struck Viator who was north bound.


text:
Biographical entry Lush, Dora Mary (1910 - 1943)
Hawthorn, Victoria, Australia
Bacteriologist
Dora Lush was a bacteriological research fellow at the Walter and Eliza Hall Institute of Medical Research, where she worked closely with Macfarlane Burnet. After a period of time in England Lush returned to the Institute in 1942. On 27 April 1943, while working on a vaccine for scrub typhus, Lush accidentally pricked her finger while inoculating a mouse. She died of the disease three weeks later.
Education - Bachelor of Science (BSc) completed at the University of Melbourne
Education - Master of Science (MSc) completed at the University of Melbourne
Career position - Bacteriological Research Fellow at the Walter and Eliza Hall Institute of Medical Research
Career position - Researcher at the National Institute for Medical Research, London
Rasmussen, Carolyn, 'Lush, Dora Mary (1910-1943), Bacteriologist', in John Ritchie (ed.), Australian Dictionary of Biography, vol. 15, Melbourne University Press, Melbourne, 2000, pp. 137-138. Also available at http://www.adb.online.anu.edu.au/biogs/A150169b.htm. Details
'Obituary: Miss Dora Lush, MSc', Australian Journal of Science, vol. 5, no. 6, 1943, pp. 193-194. Details
Sankaran, N., 'Mutant Bacteriophages, Frank Macfarlane Burnet and the Changing Nature of 'Genespeak' in the 1930s', Journal of the History of Biology, vol. 43, 2010, pp. 571-599. Details
'Lush, Dora Mary (19100731-19430520)', Trove, National Library of Australia, 2009, http://nla.gov.au/nla.party-1469950. Details
Burnet, Macfarlane, Sir, Walter and Eliza Hall Institute, 1915-1965, Melbourne University Press, Carlton, Victoria, 1971, 193 pp. Details
Fenner, F., 'Frank Macfarlane Burnet, 1899-1985', Historical Records of Australian Science, vol. 7, no. 1, 1987, pp. 39-77. Also available at http://www.publish.csiro.au/paper/HR9870710039.htm. Details
Created: 25 March 2003, Last modified: 1 August 2007


Kim Smith does the most lovely needlepoint. While many of us swoon at her lovely painted canvases (distributed by Ruth Schmuff), before she designed hand-painted canvases she did lovely charted canvas pieces. One of her specialties was pins.
Included with every piece were instructions for finishing the pins yourself. That's when she came up with this lovely beaded edge that she describes in this tutorial. It's easy do because you stitch it before you remover the canvas from the stretcher bars. And it makes a gorgeous finished edge as you see in the picture above.
I love that it's elegant and neat. It's also great that conceit's finished you could even put the needlepoint into a floating frame. It's also a very budget-friendly way of finishing.
I had forgotten about it and I can't wait to try it again. I think I'm going to use it on a baby ornament I need to finish.


text:
NBA Star Dwyane Wade Surprises Students at Marjory Stoneman Douglas High School Graduation
Seventeen-year-old Joaquin Oliver, who was killed in the Parkland shooting last year, was a particularly big fan of Wade.
Miami Heat guard Dwayne Wade stands on the court before a game against the Memphis Grizzlies in December 2018Brandon Dill/AP
NBA legend Dwyane Wade surprised the students at Marjory Stoneman Douglas High School on Sunday by appearing at their graduation ceremony to give a speech and honor the lives of their classmates who were gunned down in a school shooting last year, including a 17-year-old who was buried in a replica of Wade's jersey.
Dwyane Wade made a surprose visit to Stoneman Douglas shortly after tragedy last year. He made another surprise visit at graduation. pic.twitter.com/1a2JzZRGcp
— Scott Travis (@smtravis) June 2, 2019
Wade, who retired from the Miami Heat in April, also visited the Parkland, Florida, high school on the first full day of classes after the massacre in February 2018, which left 17 people dead, and has tried to show his support to the students since then.
"I remember us walking to the school, and I remember hearing absolutely nothing," he said Sunday, recalling that first visit. "I remember thinking to myself, 'I've never felt, I've never heard this kind of silence before in my life'…I immediately started getting butterflies in my stomach.
"I remember being so nervous to see and meet everyone," he added. "What would I say? I mean I grew up in inner city Chicago, and I've experienced a lot of awful things, but I've never experienced anything to the magnitude that you guys have just experienced."
One of the slain boys, 17-year-old Joaquin Oliver, was a particularly big fan of Wade. He moved to the United States with his family at age three and became a citizen in 2017, shortly after Wade left the Heat to sign with the Chicago Bulls. In 2018, Wade returned to the Heat again less than a week before Oliver was gunned down in the attack. Oliver's parents later revealed that they buried him in a Wade No. 3 Heat jersey. "You're about to make me cry this afternoon," Wade tweeted in response.
"You really can't put that in words," he later said. "You hurt for the family, and if you're able to get an opportunity to speak to them, you just try to hope that the time where he was alive, that you were able to bring some form of joy to his life and something memorable, a story that you guys can talk about."
Wade dedicated the rest of that season to Oliver.
Watch more of Wade's speech here:
@DouglasHigh truly MSD is #MSDSTRONG because Dwayne Wade came to their commencement pic.twitter.com/VW0IUvXIhy
— Safeer Bhatti, Ph.D. (@drsafeerbhatti) June 2, 2019
The Student Journalists of Stoneman Douglas High Earned a Rare Honor at This Year's Pulitzers
Six Months Later, Parkland Teens Are Still Fighting Like Hell
Kara Voght, James West, and Mark Helenowski
The January 6 Committee Just Revealed Alarming Text Messages From Sean Hannity
Dan Friedman
Hero: Chris James, the Canadian Comedian Triggering Right-Wing Talk Radio Hosts


If you're an author, traditionally or self-published, do you need more exposure for your book?
Probably, and a Recommended Recovery Book post can offer that to you.
It's my way of getting valuable information out to people who are still struggling with their addictions. It also allows you another platform to promote your book.
Send me a link to your book.
I would also like a detailed summary of your book. I'll decide about its posting to the site from this summary, along with the reviews.
You must be one of these, or all three: owner/author/publisher of the book.
The book will go through a vetting/review process, and you will be notified as to whether it will be posted on the site.
Please include a short summary of your book for readers. It must be 150 words or less. Make it count. This is your time to shine and catch the reader's attention.
Include a high-res book cover (300 dpi) and a link to the book, your website, blog, or any pertinent marketing information. Etc. This is not a part of your 150-word summary; however, please keep this section as concise as possible.
Please provide a recent headshot (JPEG); professional, not a family vacation photo, and 200-word bio.
From Addict 2 Advocate is not responsible for any disparaging comments, poor reviews, or trollish behavior toward your book from exposure to the public on our site. However, I do monitor comments, and I will delete derogatory remarks.
The guidelines for 'Recommended Recovery Books' may change at any time.
From Addict 2 Advocate reserves the right to remove books from the site at any time for various reasons.
Showcased books will rotate out every few months.
Questions about the Recovery Book Shelf?
Please put 'Recommended Recovery Books' in the subject line.
Click on the cover or link to buy the book, or read reviews.
Read about how Catherine lost the gamble and gained her life.
Love an addict? Are you one yourself? This touched me and my family in so many ways.
Read about how looking good on the outside is never an indication of what's going on within.
Read about how when his father lay dying, he was getting arrested.


We have seen the new Vanquish pre E3 trailer, but how about some straight up gameplay? After the jump, you can find some lovely gameplay for the title. The video seems to detail some of the more basic aspects of gameplay, so it doesn't look too exciting until the second half when he starts jetting in and punching a robot to death…er, to explosion.


text:
Q: Struggling as to what I need to add into my code so that when the user enters a specific password they get a role (discord.js) Hello here is my code currently, I can type any word or number phrase and it brings up a button which says enter password I click it and it brings up a modal, My issue is I can enter anything into the modal and it accepts it. I want it to only accept a specific password or number phrase and if the password is correct it gives a specific role.
I am unsure what I need to add into my code to make this happen.
const {
    Client,
    Intents,
    MessageActionRow,
    MessageButton,
    Modal,
    TextInputComponent,
} = require('discord.js');

const TOKEN = 'My Token';
const client = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});

client.on('messageCreate', (message) => {
    if (message.author.bot) return;

    let button = new MessageActionRow();
    button.addComponents(
        new MessageButton()
            .setCustomId('verification-button')
            .setStyle('PRIMARY')
            .setLabel('Enter Password...'),
    );
    message.reply({
        components: [button],
    });
});

client.on('interactionCreate', async (interaction) => {
    if (interaction.isButton()) {
        if (interaction.customId === 'verification-button') {
            const modal = new Modal()
                .setCustomId('verification-modal')
                .setTitle('Verify yourself')
                .addComponents([
                    new MessageActionRow().addComponents(
                        new TextInputComponent()
                            .setCustomId('verification-input')
                            .setLabel('Answer')
                            .setStyle('SHORT')
                            .setMinLength(4)
                            .setMaxLength(12)
                            .setPlaceholder('111111')
                            .setRequired(true),
                    ),
                ]);

            await interaction.showModal(modal);
        }
    }

    if (interaction.isModalSubmit()) {
        if (interaction.customId === 'verification-modal') {
            const response =
                interaction.fields.getTextInputValue('verification-input');
            interaction.reply(`Yay, your answer is submitted: "${response}"`);
        }
    }
});

client.once('ready', () => {
    console.log('Bot v13 is connected...');
});

client.login(TOKEN);

A:    if (interaction.isModalSubmit()) {
        if (interaction.customId === 'verification-modal') {
            const response =
                interaction.fields.getTextInputValue('verification-input');
            if (response === "Correct answer") {
                interaction.reply(`Yay, your answer is correct: "${response}"`);
                interaction.member.roles.add(...)
            } else {
                interaction.reply(`Oh no, your answer is incorrect: "${response}"`);
            }
        }
    }


text:
Home Tags Sport Exercise and Performance Psychology
Tag: Sport Exercise and Performance Psychology
Sport, Exercise, and Performance Psychology, Volume 11, 2022, Issue 4
Journals December 13, 2022
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Understanding exercise class attendees' in-class behaviors, experiences, and future class attendance: The role of class leaders' identity entrepreneurship by Mark Stevens, Sophie White, Alysia M. Robertson, Tegan Cruwys.
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Examining how Canadian Hockey League general managers build and sustain cultures of excellence. by Aaron Armstrong, Gordon A. Bloom Jordan S. Lefebvre, Lee Schaefer.
Journals June 28, 2022
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Emotion dysregulation mediates the relationship between psychological distress, symptoms of exercise addiction and eating disorders: A large-scale survey among fitness center users by Bernadette Kun, Róbert Urbán, Attila Szabo, Anna Magi, Andrea Eisinger & Zsolt Demetrovics.
Journals March 4, 2022
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Testing interventions for music performance under pressure: A randomized controlled study by Veronika J. Lubert & Peter Gröpel.
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: How team socialization processes relate to youth ice hockey players' social identity strength and cohesion by Jeffrey J. Chamberlain, Craig Hall & Alex J. Benson.
Journals August 19, 2021
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: The effectiveness of team reflexivity interventions: A systematic review and meta-analysis of randomized controlled trials. by Robin L. J. Lines, Simon Pietsch, Monique Crane, Nikos Ntoumanis, Philip Temby, Sally Graham & Daniel F .Gucciardi.
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Think, see, do: Executive function, visual attention, and soccer penalty performance. by Jack Brimmell, Elizabeth J. Edwards, Martin Smith, Robert S. Vaughan.
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: Do challenge and threat evaluations predict netball performance and selection at trials in youth netball players? by Martin J. Turner; Rachel Massie; Matthew J. Slater; Elizabeth Braithwaite.
Sport, Exercise, and Performance Psychology, Volume 9, 2020, Issue 4
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: THE EFFECTS OF MINDFULNESS AND MUSIC ON AFFECTIVE RESPONSES TO SELF-PACED TREADMILL WALKING by Anne E. Cox; Sarah Ullrich-French; Elaine A. Hargreaves; Amanda K. McMahon.
Journals August 9, 2020
SEPP publishes papers in all areas of sport, exercise, and performance psychology for applied scientists and practitioners that supports the application of psychological principles. The Forum Editor's pick from the current issue: APPLICATION OF ANALOGY LEARNING IN SOFTBALL BATTING: COMPARING NOVICE AND INTERMEDIATE PLAYERS by Catherine M. Capio, Liis Uiga, Man Hong Lee, Rich S. W. Masters.