text:
Consciousness Studies/Geometrical phenomenalism

Contents

''"If consciousness is in fact defined (and different) at every moment of time, it should also be related to points in space: the truly subjective observer system should be related to space-time points." from "Quantum Theory and Time Asymmetry", Zeh (1979).''

It has been shown that conscious experience is a view of the output of the brain, it has no apparent function, it is seen from a point that is, itself, empty and it operates no processes. This bizarre description of consciousness should have been expected because if consciousness were simple it would have been explained centuries ago. In this chapter the description will be phrased in simple mathematical language and related to the inferred physical world so that it can be understood in terms of the neurophysiology of the brain.

The theory will describe experience as a virtual reality within the brain that spans both time and space. This virtual reality exists in the form of a set of vectors directed at an observation point which create a geometric form that we know as a 'view'. It will be proposed that our brains, like the rest of the universe (see Chapter 3), are arranged in at least 4 dimensions and it is the peculiar geometry of this four dimensional space-time that is responsible for the 'view'. It will be shown that nothing need move into the observation point within this 'view'. It will be proposed that most of the brain is dedicated to populating this small, conscious, volume of brain activity with a model of the world and self.

Part 1: Explaining the View

The first step in developing a hypothesis that incorporates consciousness is to describe the geometry of the 'view' described in chapter 1. The 'view' that is our experience consists of things arranged vertically and horizontally with an uncertain separation of things from the observation point. The observation point is a geometrical phenomenon that contains nothing and the things in the view occur simultaneously. The things in the view must be things in themselves, there cannot be a need for any other observer or further observation, this implies that a 4D coordinate system is required to describe them (see Chapter 3). The things in the view cannot have any separation from the point but also cannot be at the point in 3D. These constraints of simultaneity, four coordinate axes and zero separation from a point suggest that the position of any object in the view relative to the observation point might be described, using Pythagoras' theorem for intervals, as:

(1) 0 = x2 + y2 + z2 – b2

The equation describes a succession of three dimensional spherical surfaces that are separated from the observation point (origin) along the x,y,z and b axes but any point on the inside of any of these spheres is no distance at all from the origin. Things are 'out there' in the x,y,z directions but also no distance from the origin when the b direction is taken into account. The separation between things in the view depends upon the angular separation of the things at the observation point. There is both nothing and the whole view at the observation point in the same way as we observe the view at a point but can find nothing inside this point. This description is not a 'theory', it is simply a description of an aspect of conscious experience that uses mathematics.

Is it possible to go a step further and use the constraint of simultaneity to identify 'b' with a length of physical time, 'ct'? So that:

0 = x2 + y2 + z2 – ct2

This equation describes both binding and simultaneity. It has an identical form to the Minkowski Light Cone Equation (see Physics for Consciousness Studies) and either the equation is describing some non-physical space or it's use in this context is a reinterpretation of Relativity Theory (specifically, time might have imaginary coordinates, see below). This equation is a theory because there is no way to determine that b=ct, the identity is assumed from the similarity of the two equations and their field of application. If equation (1) were correct the 'view' would be a small volume or shell of brain activity, probably in the thalamus. The 'view' would be sensitive to mechanical distortion because x,y,z refer to actual positions within a volume of brain. The equation can be tested by cyclically deforming potential sites in the thalamus and observing the response of subjects. Bilateral deformation would be required and the expected response, if the deformation were severe, would probably be one of the following: absence seizure, akinetic mutism or delirium (see Note 1).

It has already been shown that bilateral electrical stimulation of the centromedian nuclei of the thalamus causes absence seizures (Velasco et al. (2000). It might also be expected that Transcranial Magnetic Stimulation could also be used to block ILN activity and so cause absence seizures. Administration of general anaesthetic by micropipette could be used to selectively deactivate areas of any nuclei that mediate consciousness and allow topographical analysis.

This hypothesis about the 'view' does not explain consciousness but it seems to account for the geometry of experience (perception, dreams, bodily sensation etc.).

Part 2: A Description of the Extended Present

The second step required for a theory of consciousness is to describe the "specious" or extended present.

The experience of a stable world involves not just a view but a view extended in time. This extension in time is not a trivial set of instantaneous, frozen models of the world but is a continuous set of events. We hear whole words and experience movements; we are not confined to an impossible instant. The important features of this time extension are that things are experienced extended in time at their location in mental space and that they are observed at a point. This was discussed in full in the section on "Time" in chapter 1. The empirical equation (1) can be extended by adding a displacement in another coordinate axis:

(2) 0 = x2 + y2 + z2 - Δb  2  + Δe  2

Where Δ e is a small displacement of an object in mental time; small displacements have been specified because the extended present is fairly short and may not be linearly related to the other variables. This equation applies to particular objects, once a sequence of events involving a given object has ended the events are no longer available i.e.: when a word is finished it is no longer in the extended present. This description is not a 'theory'. For a given spherical shell ( x2 + y2 + z2 ) is the radius, r, of the sphere relative to the observation point so:

0 = r2 - Δb  2  + Δe  2

If r is small compared with Δ b and Δ e and constant:

Δb  2  ≈ Δe  2

These are empirical equations describing experience but they can be tentatively extended to describe physical space and time. If 'b' is substituted by physical time:

(cΔt)  2  = Δe  2

So Δt = Δe/c

And ΔT = Δt

Where T is mental time in seconds rather than metres and t is physical time in seconds. Our experience of time would be due to displacements in mental time, not physical time. In contrast, the physical time axis would be responsible for creating the geometric form of the view where things seem to be observed at a point because it has an opposite sign to the other axes. Equation (2) is a highly simplified description of the geometric form of the view; even a brief consideration of the possible configurations of a five dimensional space-time leads to endless possibilities such as Lorentz Transformations of axes and the disappearance of separation along the path taken by the observation point. Again, the identification of 'b' with 'ct' means that this is a theory.

The arrangements of objects in time seem 'timelike' because they are independent arrangements of things at a given place that do not obscure each other, a thing arranged in space in the immediate past does not overlie its arrangement in space now. Furthermore the observation point seems to be moving perpetually along the time axis so that the extended present attached to a past event is always lost to observation at the end of the event, or event sequence. This time extended configuration of data might provide the stability required for a reference model of the world and mind, or Reference State, in a small set of neurons.

This idea of experience as a form rather than a process is well known (cf: Bateson's (1979) "zigzag ladder of dialectic between form and process") and it is usually argued that experience can be neither a form nor a process. However, if experience is a form that includes the succession of events then it is a form that includes processes. At any instant there is a structured set of events stretching into the past and spread out in space that are part of the geometric form. The events are separated by angles through both space and time at the observation point. The future has not yet been selected so there are no defined events leading into the future. This provides an experience of moving forward into the future at any instant.

An important feature of this theory is that experience is not the observation point at an instant. Experience is both the successions of events extended in time and the observation point. In the equation

0 = x2 + y2 + z2 - Δb  2  + Δe  2

experience is all those events that have coordinates (x,y,z,b,e), not those events that have coordinates (0,0,0,0,0). This means that experience is a set of events laid out in a framework that has remarkable properties. It has a 'negative' dimension (b) that allows places where separations in both time and space are zero. The framework has a geometrical duality where the same events are at a point at an instant and 'out there', spread out in the time and space of the brain.

Part 3: Control of Brain Activity by a Geometrical Form

If this description is correct the past state of a system at a point exists and might provide a preferred basis for the present instant. This is not too dissimilar to Zeh's (1979) suggestion that the conscious observer is a configuration of quantum states at a point (see Note 2). The problem confronting the theorist is how to connect the empirical equation for the positions of the objects in experience:

0 = x2 + y2 + z2 - Δb  2  + Δe  2

With Zeh's equation for the superposition at a point observer:

|β>  0  =  ∫  d(  ф  1  (x0))... d(  ф  ν  (x0)) f({  ф  ν  (x0)}) |{  ф  ν  (x0)}>

and how to integrate a five dimensional geometry into the physical universe. It should be stressed that equation (2) is an empirical equation. It is the task of mathematicians and theoretical physicists to discover how such an equation could be compatible with modern science or to suggest an equation that is more appropriate.

The Reference State would provide an alternative preferred basis to that supplied by the aqueous medium of the brain. If the Reference State selected configurations of brain activity that generated actions it would change the world in general via these actions in the normal way. In quantum mechanical terms, the state vector of the world in general would be most influenced by the ambient environment but would contain contributions from the preferred basis of each conscious observer. It should be stressed that this idea is purely theoretical.

The existence of a Reference State in the brain could be investigated by examining brain activity in comatose subjects. If the brain activity in comatose subjects shows patterns that can be ascribed to quantum fluctuations in individual neurons or small groups of neurons but does not show these in conscious subjects the hypothesis would be supported. Bershadskii et al. (2003) may have recently observed such an effect in the "genetically depressive limbic brain" of the Flinders Sensitive Line of rats.

A New Empiricism: Geometrical Phenomenalism

The theory that conscious experience is a phenomenon, a geometric form that allows knowledge of a phenomenal world, will be called 'geometrical phenomenalism'. Geometrical Phenomenalism maintains that consciousness is a complex phenomenon that consists of a geometric form of the output of neural processing. It is largely an empirical theory.

The empirical part of the theory is fairly straightforward, it proposes that the paradox of consciousness is due to a mind that is brain activity spread out in space and time but also not separated from a point that is at the present instant. This is how the mind seems as our physical body looks around the world: our experience is brain activity but it seems to be viewed from a point eye within this activity. The theory explicitly describes as 'non-conscious' all activity that is not in the space and time of the mind. It differs from information systems theories because it describes conscious experience, not the non-conscious processes that load things into this experience.

Part 3 of the theory is not empirical. As such it is most open to criticism. Each part of the theory is independent of the other parts so Part 1 may be true even if Part 2 or Part3 are found to be false.

The Interpretation of Relativity and Quantum Theory

Geometrical Phenomenalism introduces a negative dimension (Weyl, 1918) which may correspond to physical time. Historians of Relativity Theory will immediately recognise this as the 'imaginary time' used in early, simplistic models of the theory (see chapter 2) and modern Relativity Theorists will, quite rightly, chuckle at such an archaic concept. There can be little doubt that 'real time' is needed to describe the motion of matter and energy. Energy flows into an observation point along one path in space-time and flows out from it along another, different path. These two paths are not distinguished by 'imaginary time' but are clearly different in real time. However, there is a major difference between our conscious experience and this conventional description of the universe: nothing flows into the observation point in conscious experience.

Is it possible that space and time have one geometry that applies to observation points in conscious experience and another geometry that applies to actual movements of energy from place to place? The answer to this is not only 'yes' but there is ample evidence that this occurs. Quantum physicists have long persisted in using the archaic form of Relativity in a disguise known as the Wick Rotation in Feynman Path Integrals. They use this embarrassing formalism because it works; it describes how all the possible positions of a particle that never actually occur affect the position of the particle that is observed. The problem confronting quantum physicists is quite similar to the problem confronting the empirical science of consciousness: what is the geometry of space-time where nothing actually moves?

Cosmologists have also incorporated imaginary time into descriptions of the universe as a whole and the current, empirical description of the geometry of the universe might be summarised as:

".. we see that, today, the qualitative behavior of our universe is that of a de Sitter universe except that the presence of matter has caused the universe to expand less than in the de Sitter case." Reid et al. (2002). A "de Sitter" universe is described by the metric: ds 2  = dx2 + dy2 + dz2 – dt2 + de2 where t is conventionally imaginary (i.e.: square root of minus one multiplied by t). This is very similar to equation (2) above.

The use of 'imaginary time' may not be the only way to explain conscious observation. It is possible that real time might apply, perhaps by some 'virtual movement of photons back and forwards towards the centre of a volume of neural tissue.

The Physical Nature of the Site of Conscious Experience

Any site for conscious experience would be a small, nearly spherical, shell or volume of neurons that is highly interconnected with the cortex and the rest of the brain. It would be physically and functionally close to sensory input paths to obtain reference data from the senses. It would be large enough to represent all the content of experience. The optic nerve contains about a million fibres so a total of about one million data points might be needed. Data could be held at the level of individual synapses. There might be over 100000 synapses per mm3 (over 1000 per neuron) in a nucleus which means that a nucleus of 2 mmin radius (about 3 million synapses) might support a sufficient density of data points to be a consciousness centre.

It is probable that there would be at least four such centres with two archaic centres below the cerebellum and two below the cerebrum. Only one would be dominant. The requirement that only one nucleus is dominant means that it would need to be well connected to both hemispheres of the cerebrum.

The best candidate for such a centre for conscious experience is one of the centromedian nuclei of the thalamus although this is not the only possibility.

Qualia

Objects in experience consist of qualia such as colours, sounds etc. The field of qualia that is experience could be any field of neural activity in the ILN although it could be limited, for example, to an electromagnetic field (McFadden 2002) or a 'spin' field (Hu 2002).

The Problem of Knowledge

Imagine something for no time at all. It cannot be done. Say a word like 'at'. Could you know the 'a' if it lasted for no time? Knowing involves two factors, classification and continuity. It was pointed out in chapter 1 that knowledge of sorts remains even when there is nothing to classify, such as when meditating so that there is only dark or light. There seems to be no difference between the experience called 'knowledge' and the experience called 'continuity' in these circumstances. Continuity is experiencing your experience of experiencing without the need for recursion (i.e.: without the need for cycling things around from one moment to the next).

An experience of an experience suggests that each instant of observation is available to succeeding instants. This is quite possible if five coordinate axes are permitted along with zero length vectors because things can be arranged in an enormous number of different ways. This flexibility makes it possible for an extended experience in the past to be a subset of present extended experience.

Having read this section many readers may be thinking 'Ah, but how do I know what things mean? If I see a tree why do I know its a tree?'. The answer to this is that your non-conscious brain has most of the details of 'tree' classified and logged. You do not know these details consciously, you just know that such details exist, a state called 'familiarity'. The continuity of the sensation of familiarity attached to the tree and the body ('gut feeling') is 'knowing you know' the tree.

Depth Perception

Geometrical Phenomenalism does not include any direct experience of depth. The separation of the observation point from the things in experience is indeterminate which is why we see the stars on the ceiling of a planetarium or on the screens of virtual reality goggles as incredibly distant from us. Although depth is indeterminate we still feel as if our chests are below our heads and our feet are below our chests, how is this done?

If you shut your eyes and swing an arm the path of the hand is experienced in a shadowy way. This shadowy progress of the hand does not have a common English term to describe it but we can all experience it. (Technically it might be called kinaesthesia or motion somaesthesis). If uniform swings are used it can seem as if the moving hand has two components, the actual moving hand and copy that follows it a split second later. If the hand is moved from the head to the knee the path of the hand occurs as a shadowy arc stretching through the extended present. This raises the possibility that our experience of depth within and around our bodies is actually an experience of time. For instance, when we experience our feet being below our chest we are actually experiencing an imaginary movement of the hand or a movement of the focussing muscles in the eyes or a succession of sensations first from the chest then from the feet etc. The space occupied by the body then becomes an 'action space' with separations defined by the timing of movements and sensations.

Binocular depth perception is different from the sense of bodily extension. When we look at the medium and far distance through either one or both eyes the view is almost identical. If we focus on objects that are close to us the more distant object become blurred; the act of focussing separates the world into a shell of things that are in focus and other things that are blurred. If we focus past a nearby object the nearby object splits into two images, one blurred and solid and the other blurred and transparent. All of these effects combined with the change in the relative size of objects with distance provide cues for judging distance. At no time do we have a clear view of things arranged in depth in the same way as we have a clear view of things arranged vertically and horizontally. We do, however have a sense of where we could reach out and touch things, which suggests that imaginary motion somaesthesis may create an experience of depth. If the non-conscious brain is providing models of motion to augment the experience of depth then this may be one of many possible explanations for how the accuracy of depth judgement decreases with distance (see for instance Cutting & Vishton 1995).

Philosophical Implications of the Theory and Free Will

The most important philosophical implication is that time exists. The mind should be considered as a trans-temporal entity occupying a length of time with an extended present that is accessible now. Another feature of the model is that the brain itself might, occasionally, become the source of a branch-point in the quantum multiverse. The theory is also compatible with philosophical systems that deny the physical world and science because it considers science to be a consistent system of things that are compatible with observation. The physical world can be accepted or rejected without invalidating the theory. It is, of course, also compatible with ordinary natural philosophy.

The theory may also have implications for the philosophical problem of "free will". A vast amount has been written about "free will" and the current state of the arguments is summarised in Timothy O'Connor's entry in the Stanford Encyclopedia of Philosophy. The aspect of "free will" that is of most interest when discussing consciousness is whether there can be "conscious free will". We are certainly conscious of the decisions made by the non-conscious brain but are there any types of decision that are due to consciousness itself?

If the theory of consciousness proposed above is correct our 'reference state of mind' will have a marked effect on decision taking. This state will select processes that are consistent with it from a myriad of possible processes. The 'reference state of mind' itself will depend on the history of the individual's previous selections and exposure to the world at large. It will also depend upon the type of state of mind that the individual is seeking. It is unique to the individual (cf: the "no cloning" objection of quantum physics) and consists of a combination of all the things in conscious experience from emotions through pains in the back to attitudes. In the sense that our 'reference state of mind' may be unique, impossible to measure and equally difficult to predict it may be said to be a basis for "free will". But can we navigate to a new 'reference state of mind', can we choose the basis of our choices?

The Self

The space and time of the mind contains sense data from the world, sense data from the body and output from neural processes such as those that generate imaginary speech, daydreams, dreams etc.. 'I' am the body nearest to the observation point and this has a speech processor that calls this body and itself 'me'. My body has an array of sensory processes, especially splanchnic sensations, motor controls, and modelling activities, including imaginary speech that are not found in the part of the mind that is not correlated with the body. This collection in the mind of body, thoughts, feelings and actions I call my 'self'. Most parts of 'self', such as the body, skills etc. are not themselves conscious. Only the mind is conscious and this contains things correlated with both the world and the 'self'.

Notes

Note 1: Schiff and Plum (2003) categorise the following states that can occur after destruction of the Intra Laminar nuclei as aroused but not aware or possibly not aware: persistent vegetative states, absence seizures, akinetic mutism, and severe delirium. In the absence of consciousness there is a profound lack of purposeful activity.

Note 2: Zeh's derivation of the quantum point observer.

Zeh postulates that the universe contains an observer that is a local system that can be specified as an orthonormal basis of states  ф i, the rest of the universe is a basis of states  ψ k, the global state of the universe is given by: Σ ik  ф i ψ k. If a result, l is observed the new state would be a product state:  ф l ψ l where  ф  and  ψ  in this case refer only to the ensemble of probabilities of the new state. If space-time at a given moment, t, is divided into two regions, I1 being the observer and I2 the rest then any state vector | ф  ν (x)> is given by the direct product | ф  ν (x)1>| ф  ν (x)2>. It is possible to use this to derive the state vector of a given state (l) in terms of the space-time of the observer:

|β> 1 = ∫1 D  ф  ν (x) ψ l[  ф  ν  (x), t]|  ф  ν  (x)>1

This specifies a set of product states that can be distinguished by the index, l. The integration only occurs over the space-time region of the observer and consciousness could branch into any of the product states. This means that at each point there is a different state. What is the state at a single point? This is derived from the previous equation with x set to x0:

|β> 0 = ∫ d(  ф  1  (x0))... d(  ф  ν  (x0)) f({  ф  ν  (x0)}) |{  ф  ν  (x0)}>

So each point has a superposition of vectors.

References

Bershadskii, A., Dremencov, E., Bershadskii, J., Yadid, G. Int. Brain neurons as quantum computers: in vivo support of background physics J. Mod. Phys., C, 14, #7, (2003) 1 http://arxiv.org/PS_cache/q-bio/pdf/0311/0311026.pdf

Bateson, G. (1979). Mind and Nature: A Necessary Unity. Toronto: Bantam Books.

Cutting, J.E., Vishton, P.M. (1995) Perceiving layout and knowing distances: The integration, relative potency, and contextual use of different information about depth. In W. Epstein & S. Rogers (eds.) Handbook of perception and cognition, Vol 5; Perception of space and motion. (pp. 69–117). San Diego, CA: Academic Press http://www.psych.nwu.edu/~vishton/cutting&vishton1995.pdf

Linde, A. (2002) Inflation, Quantum Cosmology and the Anthropic Principle. http://arxiv.org/PS_cache/hep-th/pdf/0211/0211048.pdf

McFadden, J. (2002). Synchronous firing and its influence on the brain's electromagnetic field: evidence for an electromagnetic theory of consciousness. Journal of Consciousness Studies 9 (4):23-50, 2002. http://www.surrey.ac.uk/qe/PDFs/cemi_theory_paper.pdf">http://www.surrey.ac.uk/qe/PDFs/cemi_theory_paper.pdf

McFadden, J. (2002). The conscious electromagnetic field theory: the hard problem made easy. Journal of Consciousness Studies 9:45-60, 2002. http://www.surrey.ac.uk/qe/PDFs/mcfadden_JCS2002b.pdf

Reid, D.D, Kittell, D.W, Arsznov, E.E, Thompson, G.B. (2002) The Picture of our universe: a view from modern cosmology. http://nedwww.ipac.caltech.edu/level5/Sept02/Reid/Reid6.html

Schiff ND, Plum F. (2000) The Role of Arousal and "Gating" Systems in the Neurology of Impaired Consciousness. Journal of Neurophysiology. 17(5):438-452. http://www.uni-tuebingen.de/cog/lehre/ss2003/seminar_bewusstsein/epapers/SchiffPlum00.pdf

Velasco, M., Velasco, F., Velasco, A.L., Jimenez, F., Brito, F., & Marquez, I. (2000). Review Article: Acute and Chronic Electrical Stimulation of the Centromedian Thalamic Nucleus. Archives of Medical Research, 31(3): 304-315.

Zeh, H. D. (1979). Quantum Theory and Time Asymmetry. Foundations of Physics, Vol 9, pp 803–818 (1979).


text:
Computer Programming/Error handling

function √ (X : in Float) : Float begin if (X < 0) : return -1 else calculate root from x fi end

C := √ (A2 + B2) if C < 0 then error handling else normal processing fi

function √ (   X       : in Float;     Success : out Boolean ) : Float begin if (X < 0) : Success := False else calculate root from x Success := True fi end

C := √ (A2 + B2, Success) if not Success then error handling else normal processing fi

function √ (X : in Float) : Float begin if (X < 0) : Float_Error := true else calculate root from x fi end

Float_Error := false C := √ (A2 + B2) if Float_Error then error handling else normal processing fi

function √ (X : in Float) : Float begin if (X < 0) : raise Float_Error else calculate root from x fi end

try: C := √ (A2 + B2) normal processing when Float_Error: error handling yrt

function √ (X : in Float) : Float pre-condition (X >= 0) post-condition (return >= 0) begin calculate root from x end

C := √ (A2 + B2)

Language overview
This list gives an overview of the standard or primary behavior and error handling techniques used in various programming languages. This does not mean that other techniques or behavior are not possible in the programming languages named.

1 : Ada supports a very limited form of DbC through its strong typing system. 2 : In C and C++ the behavior is defined and sometimes intentionally used however in this comparison we consider unintentional use.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Computer Programming/Error handling


text:
Movie Making Manual/Contributors

=MMM Contributors=

This is a list of the Movie Making Manual's contributors in alphabetical order. Add your name here!

A
 * Abdessamad IDRISSI
 * |Film Academy
 * Alex Elliott

B
 * Ben Ford
 * Bryan See

C
 * cauri jaye
 * Chris Smith-Naill - created DV volume
 * Chris Van Patten
 * Christopher Ferris Zabaneh

D
 * Dave Herman
 * David Wigram
 * Dorian Gray

I
 * Illusional

J
 * Jack Kelly AKA Daniel
 * |cauri jaye

K
 * K. Paschke
 * Kushboy

M
 * Marshall Lewis
 * |Paul May
 * Michael Scott

N
 * Norman Cho

O
 * Orethrius van Degaurde

P
 * Paul Schuh

R
 * regre7 (of Wikipedia)
 * |Robert Elliott (Purser), Tech Support, Star Movie Shop
 * Rob Kohr

S
 * Simon Tzu

T
 * |Owen Tooth

title: Movie Making Manual/Contributors


text:
Managing Groups and Teams

Groups are everywhere; whether in our social lives, our work, or even our families, individuals decide to work collectively to achieve particular goals. In this book, we take a challenge-based approach, one that focuses on the "how" of managing a group or a team.

Contents

 * 1) About this Book
 * 2)  /Introduction/
 * 3) Internal Group Processes
 * 4) Cohesion
 * 5) How can teams create and maintain cohesion?
 * 6) /Which attributes are fundamental to team cohesion?/
 * 7) /Communication//
 * 8) What leads to effective team communication?
 * 9) /Conflict/
 * 10) How can teams deal with conflicts?
 * 11) /Feedback in Teams/
 * 12) /Motivation/
 * 13)  What is motivation?
 * 14)  What are the drawbacks of non-motivated teams?
 * 15)  How does motivation affect teams' dynamics?
 * 16)  Does the experience or position of a team member changes the motivational tools needed to motivate that person?
 * 17) /Motivation In Teams/
 * 18) Motivation in a Group and Team Environment
 * 19) Motivation in Challenging Group and Team Environments
 * 20) Inclusion
 * 21) How can teams ensure their participation?
 * 22) /Groupthink/
 * 23) /Stereotyping/
 * 24) Composition Issues in Teams
 * 25) Diversity (General)
 * 26) What does diversity bring to team?
 * 27) Diversity in Personality
 * 28) Achieving High Performance Through Diverse Personalities
 * 29) Similarities (General)
 * 30) Filling Necessary Team Roles with a Highly Homogenous Team
 * 31) /Working in International Teams/
 * 32) /Social Loafing/
 * 33) What is social loafing, and how can it be addressed?
 * 34) /Process Losses/
 * 35) How our unconscious biases affect the way we manage and interact with teams.
 * 36) Leadership in Teams
 * 37) Establishing Leadership
 * 38) Credibility
 * 39) How can leaders establish credibility?
 * 40) Leadership Transitions
 * 41) What is the best way to manage leadership transitions?
 * 42) /New Leaders/
 * 43) What are the basic roles that a new team leader needs to know?
 * 44) What are some of the key roles a manager needs to take on to be effective?
 * 45) What are the best options for arranging a team and assigning team role?
 * 46) What relationship aspects can be defined in advance to assure success?
 * 47) /What should a New Leader do when entering into an existing team?/
 * 48) Enacting Leadership
 * 49) Leadership Roles and Concerns
 * 50)  How can leaders establish a balance between management and leadership?
 * 51)  What are characteristics of effective team leadership?
 * 52)  What are the differences between dictatorship and leadership?
 * 53)  What is the relationship between leadership and discipline?
 * 54) /Poor Leadership/
 * 55) How can members deal with poor leadership?
 * 56) Virtual Teams
 * 57) Managing Global Virtual Teams
 * 58) How should global virtual teams be managed?
 * 59) Building Virtual Teams
 * 60) How can members build high-performing virtual teams?
 * 61) Team Building: Techniques, Principles, and Methods
 * 62) Stages of Group Development
 * 63) How does group development foster effective team building?
 * 64) /Group Dynamics/
 * 65) What is a team?
 * 66) How can teams create positive group dynamics?
 * 67) Problems that hinder good group dynamics.
 * 68) /Psychological Profiling/
 * 69) What place does psychological profiling have in team building?
 * 70) /Team Building Activities/
 * 71) What are the different kinds of effective team building activities available?
 * 72) Additional Resources
 * 73)  /Glossary/
 * 74)  /Resources/
 * 75)  /Noted Contributors/
 * 76)  /Question Page/

title: Managing Groups and Teams


text:
Managing Groups and Teams/Introduction

Foreword
It is often remarked that groups are everywhere, whether in our social lives, our work lives, or even our families. In each of these situations, sets of individuals decide to work collectively to achieve particular goals.

However, although groups are everywhere and we participate in them constantly, we do not understand them very well. Many of us can tell stories of groups that seemed perfect for a given task, but which failed. And we all have reasons (or excuses) that explain such failures.

But our experiences in groups suffer precisely because we are with them.

The study of groups as a phenomenon that is unique and different from other social phenomena is very active, reflecting both the importance it has and how much we still don't know about groups. S M Rizwsan Clinical Psychologist ANF

About this Book
In this book, we take a challenge-based approach to dealing with groups. Many other books provide conceptual and descriptive treatments of groups and teams. Here we will take a prescriptive perspective, one that focuses on the "how to" of managing a group or a team. This prescriptive perspective, however, will be rooted in social science.

About Wikibooks and Wikimedia

 * Wikibooks, a Wikipedia article about Wikibooks and its history.
 * Wikimedia Foundation, a Wikipedia article about the non-profit parent organization of Wikibooks.
 * Frequently asked questions about Wikibooks.

title: Managing Groups and Teams/Introduction


text:
Dialectical Behavioral Therapy/Distress Tolerance Skills/Acceptance

Acceptance does not equal approval. Acceptance is the first step toward making a change for the better.

Dialectical Behavioral Therapy/Distress Tolerance Skills/Radical Acceptance


text:
Ada Programming/Lexical elements

Character set
The character set used in Ada programs is composed of:

 * Upper-case letters: A, ..., Z and lower-case letters: a, ..., z.
 * Digits: 0, ..., 9.
 * Special characters.

Take into account that in Ada 95 the letter range includes accented characters and other letters used in Western Europe languages, those belonging to the ISO Latin-1 character set, as ç, ñ, ð, etc.

In Ada 2005 the character set has been extended to the full Unicode set, so the identifiers and comments can be written in almost any language in the world.

Ada is a case-insensitive language, i. e. the upper-case set is equivalent to the lower-case set except in character string literals and character literals.

Lexical elements
In Ada we can find the following lexical elements:

 * Identifiers
 * Numeric Literals
 * Character Literals
 * String Literals
 * Delimiters
 * Comments
 * Reserved Words

Example:

Temperature_In_Room := 25;

This line contains 5 lexical elements:

 * The identifier.
 * The compound delimiter.
 * The number.
 * The single delimiter.
 * The comment.

Identifiers
Definition in BNF:

identifier ::= letter { [ underscore ] letter | digit } letter ::= A | ... | Z | a | ... | z digit ::= 0 | ... | 9 underscore ::= _

From this definition we must exclude the keywords that are reserved words in the language and cannot be used as identifiers.

Examples:

The following words are legal Ada identifiers: Time_Of_Day TimeOfDay  El_Niño_Forecast  Façade  counter ALARM

The following ones are NOT legal Ada identifiers: _Time_Of_Day 2nd_turn  Start_  Access  Price_In_$  General__Alarm

Exercise: could you give the reason for not being legal for each one of them?

Numbers
The numeric literals are composed of the following characters:
 * digits
 * the decimal separator ,
 * the exponentiation sign  or  ,
 * the negative sign  (in exponents only) and
 * the underscore.

The underscore is used as separator for improving legibility for humans, but it is ignored by the compiler. You can separate numbers following any rationale, e.g. decimal integers in groups of three digits, or binary integers in groups of eight digits.

For example, the real number such as 98.4 can be represented as: , ,  or , but not as.

For integer numbers, for example 1900, it could be written as,  ,   or.

A numeric literal could also be expressed in a base different to 10, by enclosing the number between  characters, and preceding it by the base, which can be a number between 2 and 16. For example, is 1012, that is 510; a hexadecimal number with exponent is, that is 11 × 16² = 2,816.

Note that there are no negative literals; e.g. -1 is not a literal, rather it is the literal 1 preceded by the unary minus operator.

Character literals
Their type is .Character, Wide_Character or Wide_Wide_Character. They are delimited by an apostrophe (').

Examples:

'A' 'n' '%'

String literals
String literals are of type .String, Wide_String or Wide_Wide_String. They are delimited by the quotation mark (").

Example:

"This is a string literal"

Delimiters
Single delimiters are one of the following special characters:

&   '        *    +   ,    -    .    /    :    ;    <    =    >

Compound delimiters are composed of two special characters, and they are the following ones: =>   ..    **    :=    /=    >=    <=    <<    >>    <>

You can see a full reference of the delimiters in Ada Programming/Delimiters.

Comments
Comments in Ada start with two consecutive hyphens and end in the end of line.

My_Savings := My_Savings * 10.0; My_Savings := My_Savings * 1_000_000.0;

A comment can appear where an end of line can be inserted.

Reserved words
Reserved words are equivalent in upper-case and lower-case letters, although the typical style is the one from the Reference Manual, that is to write them in all lower-case letters.

In Ada some keywords have a different meaning depending on context. You can refer to Ada Programming/Keywords and the following pages for each keyword.

Wikibook

 * Ada Programming
 * Ada Programming/Delimiters
 * Ada Programming/Keywords

Ada Reference Manual

|Lexical elements

Programación en Ada/Elementos del lenguaje

title: Ada Programming/Lexical elements


text:
Dialectical Behavioral Therapy/Borderline Personality Disorder/Biosocial Model

 * Biosocial Model of Borderline Personality Disorder

Borderline Personality Disorder (BPD) is primarily a disorder of the emotion regulation system. BPD results from a biological predisposition to emotional dysregulation combined with certain dysfunctional (invalidating) environments which interact over time. The characteristics of BPD begin developing during childhood because the fundamental inability to regulate emotions is exacerbated by an invalidating environment. The vulnerable child fails to learn how to identify feelings or regulate emotional stimulation. She does not learn to trust her private experience as valid and real. BPD individuals fail to learn how to tolerate emotional distress.

As adults, BPD individuals adopt the characteristics of the invalidating environment in which they grow up. Looking to others for accurate reflections of reality and oversimplifying the ease of solving life’s problems characterize this self-invalidation.

Oversimplification of life’s difficulties leads to unrealistic goals. Those with BPD tend to have an inability to use reward instead of punishment for small steps toward final goals. When they fail to achieve these goals they are filled with self-hate.

Those with BPD are generally unable to self-regulate. Those with BPD have difficulty regulating arousal, for example going to bed (sleep) and getting out of bed (awakening). The usually have short attention spans and difficulty concentrating. They often feel overwhelmed when depressed and out of control when anxious. Self-esteem is especially vulnerable as they often feel that their self-esteem is on the line in every situation. Normally, those with healthy self-esteem are able to maintain positive feelings about themselves despite setbacks.

 * Emotional Vulnerability

Individuals with BPD have difficulties regulating several, if not all, emotions. They have a very high sensitivity to stimuli – even small things set them off. They respond to even low levels of stress. And when emotionally aroused, they take longer to return to a baseline level of emotion. Thus, they are emotionally vulnerable. The more emotionally vulnerable a person is the more they need to be able to regulate emotion effectively. BPD individuals tend to regulate emotions by either shutting down (avoiding emotions) or escape (intense overreaction). Under the influence of intense (positive or negative) emotions, they are impulsive (unable to inhibit inappropriate behaviors). In other words, they are unable to inhibit mood-dependent actions.

Family members of BPD individuals often feel that they are “walking on eggs” because BPD individuals are so emotionally sensitive and tend to over-react.

Emotional intensity means that emotions are extreme and difficult to regulate. On the negative side, partings may precipitate intense feelings of loss, annoyance may turn into rage, and apprehension may escalate to a panic attack or out of control feelings of terror. On the positive side, they may fall in love at the drop of a hat, experience joy more easily, and be more susceptible to spiritual experiences.

Emotions affect thinking. Emotional arousal narrows the attention. The more emotionally aroused you become, the more pertinent and compelling emotion-relevant material becomes. Therefore, when emotionally aroused, emotions dominate perception, judgment, and behavior. For example, when angered, those with BPD find it hard to let go of thoughts and feelings that reinforce their anger.

“Slow return to emotional baseline” means that emotional reactions are long lasting. Basic normal emotions are fleeting and generally adaptive, lasting only seconds to minutes. For the borderline, emotions are long-lasting because they are amplified with sustained attention and reactivated with memories.

 * Emotional Regulation Instead of Dysregulation

Emotional regulation and control includes these activities or abilities:

• Decrease (or increase) physiological arousal associated with emotion. Calming down with relaxation and breathing exercises when angry or anxious. Revving up with depression and sadness.

• Re-orient attention in the presence of strong emotion. To regulate emotions, you must be able to direct the focus of your attention (concentrate) and shift your attention from one thing to another.

• You must be able to inhibit mood dependent behavior. In other words, feel one way and act another. To keep life progressing forward, you must be able to coordinate action in the service of an external, non-mood dependent goal.

• Experience emotions without escalating or blunting. Inhibition of negative emotions serves to increase emotional avoidance. Emotions must be experienced to learn about them. Self-soothing is critical to tolerating intense emotions.

 * Invalidating Environments

An invalidating environment is one in which communication of private experiences is met by erratic, inappropriate, and extreme responses. In other words, private experiences are invalidated. Personal expression is punished or trivialized. The environment disregards the experience of painful emotions. Neither are the factors related to expressed emotion appreciated. Also, factors that seem related to the expressed emotion (the person’s experience) are not appreciated. Likewise, the individual’s interpretations of the emotional distress are dismissed. Finally, the intentions and motivations of the emotional person’s behavior are not considered.

Descriptions of one’s self are not accepted by the environment as an accurate self-description. The invalidating environment does not appreciate one’s behavior as a valid response to events and often criticizes or punishes the individual. Behavior is attributed to socially unacceptable characteristics (e.g. over-reactivity, paranoia, lack of motivation, manipulation, lack of discipline, and failure to adopt a positive attitude).

Apparent calm and competence are valued. Emotionally invalidating environments are generally intolerant of negative displays of affect. Great value is attached to being (or appearing) happy! The message is to never “give in” to hopelessness. Most of all, the power of a “positive mental attitude” will overcome any problem.

Chaotic families may be oriented in this way due to limited resources (money, education, time, emotional or mental stability, etc.). Perfectionistic families overvalue intellectual or rational thinking and undervalue immediate experiencing. “Normal” families are sometimes inadequate for biologically vulnerable individuals.

 * The consequences of invalidating environments include:

• The child raised in an invalidating environment does not learn to label private experiences, including emotions, consistent with the larger social community for similar experiences.

• The child is not taught to modulate emotional arousal.

• Emotional problems are not recognized and the child is told to control her emotions without being taught how to do so.

• The solutions to life’s problems are oversimplified so the child does not learn to tolerate distress. Nor does she form realistic goals and expectations.

• Extreme emotional displays are often necessary to provoke a helpful response.

• By punishing communication of negative emotions and intermittently reinforcing displays of extreme emotions, the environment teaches the child to oscillate between emotional inhibition and extreme emotional states.

• An invalidating environment fails to teach the child when to trust her own emotional responses as valid interpretation of events. Rather, the invalidating environment teaches the child to invalidate her own experiences and to search her social environment for cues how to think, feel and act. Emotion Dysregulation tends to lead to Invalidation and vice versa.

A family which consisted of a slightly vulnerable child with slightly invalidating parents can over time evolve into a highly sensitive vulnerable child and an invalidating family.

A temperamental child, a distractible child, and the persistent child can overwhelm, threaten and disorganize otherwise nurturing parents. Over time, children and caregivers shape and reinforce extreme and coercive behavior in each other. In turn, coercive behaviors further exacerbate the invalidating and coercive system, leading to more, not fewer, dysfunctional behaviors within the entire system.

Understanding BPD reveals how other psychiatric disorders (depression, manic-depression, anxiety, post traumatic stress disorder, and attention deficit disorder) affect the development of one’s personality.


text:
User talk:217.124.24.23

Kellen T 17:56, 18 September 2005 (UTC)
 * Please also check out the Cookbook policy page and the Cookbook talk pages.
 * You created Cookbook:Pad Krapao, which says it has permission from Appon's Thai Recipes, please document this with a copy of an email (with headers) on your user page, or the recipe discussion page. E.g. create User:217.124.24.23/ApponPermission, copy the email there, and link to that to prove permission of some sort.

title: User talk:217.124.24.23


text:
Cookbook:Slinger

| Breakfast

The "Slinger" is a breakfast item originating from St. Louis Missouri.

Ingredients

 * 2 eggs
 * 1 hamburger patty
 * Hash browns
 * Cheese (grated works best)
 * Chili
 * Onion

Procedure

 * 1) Cook the eggs in any manner you wish.
 * 2) Cook the hamburger patty.
 * 3) Cook the chili.
 * 4) Dice the onion.
 * 5) Place the hashbrowns and patty on a plate then put the eggs upon the patty and top it all with the chili, cheese, and onion

title: Cookbook:Slinger


text:
Muggles' Guide to Harry Potter/Characters/Marge Dursley

Overview
Marge Dursley is sister to Harry Potter's Uncle Vernon. Harry is instructed to refer to her as Aunt Marge. She is most disparaging towards Harry, feeling the imposition on Vernon perhaps more even that Vernon himself does.

Philosopher's Stone
It is mentioned in passing that the house at Privet Drive has four bedrooms; one is for visitors (usually Uncle Vernon's sister, Marge).

It is mentioned that there is a present from "Auntie Marge" in amongst the presents waiting on Dudley's birthday. At first, he doesn't see it, but his mother points it out.

When it transpires that Mrs. Figg has broken her leg and cannot take Harry while Dudley goes to do something on his birthday, Marge is one of the alternates Mr. Dursley suggests, but Mrs. Dursley points out that "she hates the boy."

In the same post as the first of Harry's letters is a picture postcard from Marge, who is holidaying on the Isle of Wight and fell ill after she "ate a funny whelk".

Prisoner of Azkaban
Harry, appalled at the prospect of a week with his abusive Aunt Marge in the house, makes a deal with his Uncle Vernon: if he carefully remembers that he is a student at St. Brutus' Home for Incurably Criminal Boys, at the end of the week Uncle Vernon will sign his permission form allowing him to visit the town of Hogsmeade on selected weekends.

Aunt Marge arrives at Privet Drive with her bulldog in tow, throws her heavy suitcase at Harry to stow in her room, expansively hugs Dudley, and gives him £20. When Harry returns from upstairs, he hopes that Aunt Marge will allow him to stay out of range, but she says that she doesn't trust him out of her sight and insists on details about the school he is attending.

At one point during the week, when she is being particularly insulting to wards Harry, a wine glass Aunt Marge is holding shatters in her hands. She passes it off as just that she has strong hands; Uncle Vernon seems to suspect that Harry is doing magic. Harry is unsure himself as to whether he caused it.

On the last day that Aunt Marge is there, possibly fueled by brandy, she starts insulting Harry's parents. This is too much for Harry to bear, and without his having willed it, Aunt Marge starts inflating like a balloon. Not being entirely certain how he had done this, Harry cannot undo it; instead, he unlocks the closet under the stairs, and escapes with his school things.

Reaching the Leaky Cauldron, in fear that he will be recognized and have his wand broken for underage use of magic, Harry is amazed to meet the Minister for Magic there. Fudge tells him that Aunt Marge has been deflated, and her memory modified (so that she would not remember the incident); there will be no charges laid, it could have happened to anyone.

Order of the Phoenix
While being trained in Occlumency by Professor Snape, one of the memories that Snape retrieves from Harry's mind is an episode where Aunt Marge had allowed her bulldog to chase Harry up a tree, and had left him there for hours, laughing at him.

Strengths
We can guess that Marge is a very strong-willed woman. It appears she is unmarried, and is able to support herself, though we don't learn how.

Weaknesses
Marge is clearly unable to perceive when she is being insulting. She is basically oblivious to the effects her words have on others.

Relationships with Other Characters
Marge quite clearly prides herself on being "frank", speaking her opinion no matter how hurtful it is. She does not recognize that she is bigoted, or that she is needlessly causing pain to others by what she says. Because of this, it seems that the only people with whom she can stay on more or less friendly terms are those, like the off-stage Colonel Fubster, who share her opinions, and those like Vernon Dursley, who are forced to keep up a relationship through being family.

Analysis
In the short time we see her, we learn that Marge is loud, bigoted, prejudiced against Harry and his parents for no good reason, and at the very least, well on the road to becoming alcoholic. We also learn that she has no qualms about airing her opinions, no matter how those around her might take them, and is apparently insensitive to atmosphere, not noticing when she is being warned about straying into dangerous or hurtful areas of speech. It is perhaps appropriate that when Harry loses control, he ends up inflating her; she is, it seems, full of hot air already.

It can be seen that while meeting Aunt Marge is openly painful to Harry, it is also not particularly welcome to the Dursleys. Uncle Vernon is clearly aware at one point that she is testing Harry's peacefulness to breaking point, but being unable to throw her out of the house, instead tries to distract her with liquor. Dudley tolerates her embraces, but only because he is paid to do so, leaving her embrace with a visible monetary reward.

We note that Colonel Fubster only merits about half a sentence. We can guess from his name alone that he is one of the very few sorts of people who are likely to be able to stand Marge: equally bigoted, and seeing expression of these parochial and bigoted ideas as being "bold" or "frank". We wonder how long it took to come up with such an appropriate name, one that would condense his probable character into such small compass.

Greater Picture
It seems fairly common for addiction of any sort to have, as a side effect, the numbing of perception of others' feelings. When the most important thing in life becomes the next drink, the opinions of people around you, and their feelings, will become unimportant in relation. If Marge is an incipient or active alcoholic, as her portrayal would indicate, it is possible that this unfeeling attitude towards Harry is a part of that alcoholism. One wonders if the author is writing Marge's characteristics from personal experience.

Some may be aware that some mental ailments, notably autism spectrum disorders, also show a lack of perception, or understanding, of other people's feelings. Experience suggests that these disorders tend to result in disregard for others, rather than the actual verbal attacks we see repeatedly from Marge. We believe that Marge Dursley was written to simply be as hateful a person as possible.


text:
Cookbook:Semolina

Semolina refers to the gritty coarse particles of wheat left after the finer flour has passed through a bolting machine. Semolina is often used to make pasta.

Recipes using semolina

 * Asida bil Zibda
 * Basbousa
 * Bint as-Saḥn
 * breads
 * Baghrir
 * Kesra
 * Lahoh/Lahoh
 * M’semen
 * Puri
 * Semolina Bread
 * Marillenknödel
 * Galaktoboureko
 * hamburgers
 * Bean-Semolina Burger
 * Rice-Oat-Semolina Burger
 * Semolina Burger
 * Kibbeh
 * Khaman
 * Khaman Dhokla
 * Malpua
 * Minestrone of Semolina
 * Mhadjeb
 * Modak
 * Nigerian Minced Meat Semolina Pancakes
 * puddings
 * Kesari
 * Semolina pudding
 * Semo
 * Tamina
 * Tigernut Fufu
 * Upma-Uppitu

title: Cookbook:Semolina


text:
Rueda de Casino/Abajo

This move is normally from the initial position (when the men are facing anti-clockwise).

Usually, the leader walks backwards, and the follower walks forwards, in normal salsa timing, but keeping within the circle.

It can also be used from the Guapea position to revert to the initial position, and carry on doing Abajo as normal.

 * Note that abajo can be added on to a number of other moves to reverse their direction.

title: Rueda de Casino/Abajo


text:
C++ Programming/Programming Languages/C++/Code/Statements/Scope/Namespaces

using namespaces

 * using

This using-directive indicates that any names used but not declared within the program should be sought in the ‘standard (std)'.

To make a single name from a available, the following using-declaration exists:

After this declaration, the name bar can be used inside the current instead of the more verbose version foo::bar. Note that programmers often use the terms declaration and directive interchangeably, despite their technically different meanings.

It is good practice to use the narrow second form (using declaration), because the broad first form (using directive) might make more names available than desired. Example:

In that case the declaration using foo::bar; would have made only foo::bar available, avoiding the clash of pi and foo::pi. This problem (the collision of identically-named variables or functions) is called "namespace pollution" and as a rule should be avoided wherever possible.

<tt>using</tt>-declarations can appear in a lot of different places. Among them are:

 * namespaces (including the default namespace)
 * functions

A <tt>using</tt>-declaration makes the name (or ) available in the scope of the declaration. Example:

Namespaces are hierarchical. Within the hypothetical <tt>food::fruit</tt>, the identifier <tt>orange</tt> refers to <tt>food::fruit::orange</tt> if it exists, or if not, then <tt>food::orange</tt> if that exists. If neither exist, <tt>orange</tt> refers to an identifier in the default.

Code that is not explicitly declared within a is considered to be in the default namespace.

Another property of namespaces is that they are open. Once a is declared, it can be redeclared (reopened) and  members can be added. Example:

Namespaces are most often used to avoid naming collisions. Although namespaces are used extensively in recent C++ code, most older code does not use this facility. For example, the entire standard library is defined within <tt>std</tt>, and in earlier standards of the language, in the default namespace.

For a long namespace name, a shorter alias can be defined (a alias declaration). Example:

There exists a special : the unnamed namespace. This is used for names which are private to a particular source file or other :

In the surrounding scope, members of an unnamed namespace can be accessed without qualifying, i.e. without prefixing with the namespace name and <tt>::</tt> (since the namespace doesn't have a name). If the surrounding scope is a, members can be treated and accessed as a member of it. However, if the surrounding scope is a file, members cannot be accessed from any other source file, as there is no way to name the file as a scope. An unnamed namespace declaration is semantically equivalent to the following construct

where <tt>$$$</tt> is a unique identifier manufactured by the compiler.

As you can nest an unnamed namespace in an ordinary, and vice versa, you can also nest two unnamed namespaces.

Because of space considerations, we cannot actually show the command being used properly: it would require a very large program to show it working usefully. However, we can illustrate the concept itself easily.

We will examine the code moving from the start down to the end of the program, examining fragments of it in turn.

This just includes the iostream library so that we can use <tt>std::cout</tt> to print stuff to the screen.

We create a namespace called first and add to it two variables, first1 and x. Then we close it. Then we create a new namespace called second and put two variables in it: second1 and x. Then we re-open the first and add another variable called first2 to it. A can be re-opened in this manner as often as desired to add in extra names.

The first line of the main program is commented out because it would cause an error. In order to get at a name from the first, we must qualify the variable's name with the name of its before it and two colons; hence the second line of the main program is not a syntax error. The name of the variable is in scope: it just has to be referred to in that particular way before it can be used at this point. This therefore cuts up the list of global names into groups, each group with its own prefixing name.

The third line of the main program introduces the using namespace command. This commands pulls all the names in the first into scope. They can then be used in the usual way from there on. Hence the fourth and fifth lines of the program compile without error. In particular, the variable x is available now: in order to address the other variable x in the second, we would call it second::x as shown in line six. Thus the two variables called x can be separately referred to, as they are on the fifth and sixth lines.

We then pull the declarations in the called second in, again with the using namespace command. The line following is commented out because it is now an error (whereas before it was correct). Since both namespaces have been brought into the global list of names, the variable x is now ambiguous, and needs to be talked about only in the qualified manner illustrated in the ninth and tenth lines.

The eleventh line of the main program shows that even though first2 was declared in a separate section of the called first, it has the same status as the other variables in  first. A can be re-opened as many times as you wish. The usual rules of scoping apply, of course: it is not legal to try to declare the same name twice in the same.

There is a defined in the computer in special group of files. Its name is std and all the system-supplied names, such as cout, are declared in that in a number of different files: it is a very large namespace. Note that the #include statement at the very top of the program does not fully bring the in: the names are there but must still be referred to in qualified form. Line twelve has to be commented out because currently the system-supplied names like cout are not available, except in the qualified form std::cout as can be seen in line thirteen. Thus we need a line like the fourteenth line: after that line is written, all the system-supplied names are available, as illustrated in the last line of the program. At this point we have the names of three incorporated into the program.

As the example program illustrates, the declarations that are needed are brought in as desired, and the unwanted ones are left out, and can be brought in in a controlled manner using the qualified form with the double colons. This gives the greater control of names needed for large programs. In the example above, we used only the names of variables. However, namespaces also control, equally, the names of procedures and classes, as desired.


text:
C++ Programming/Structures

Structures
A structure is a compound data type that contains different members of different types. The members are accessed by their names. A value of a structure-object is a tuple of values of each member of the object. A structure can also be seen as a simple implementation of the object paradigm from (OOP). A struct is like a class except for the default access (class has default access of private, struct has default access of public). C++ also guarantees that a struct that only contains C types is equivalent to the same C struct thus allowing access to legacy C functions, it can (but may not) also have constructors (and must have them, if a templated class is used inside a struct), as with Classes the compiler implicitly-declares a destructor if the struct doesn’t have a user-declared destructor. Structures will also allow Operator Overloading.

A struct is defined by:

The optional keywords public:, protected:, private: declare the protection status of the following members. They can be put in any order, and more than one of each may occur. If no protection status is given, then the members are public. (Private or protected members can be accessed only by methods or friends of the structure; explained in a later chapter).

Because it is not supported in C, it is uncommon to have structs in C++ using inheritances even though they are supported just like in classes. The more distinctive aspect is that structs can have two identities one is in reference to the type and another to the specific object. The public access label can sometimes be ignored since the default state of struct for member functions and fields is public.

Objects of type myStructType are declared using:

Repeating the keyword struct  at the beginning is optional.

It is possible to define objects directly in the struct definition instead of using a name for the struct-type:

Older programmer languages used a similar type called Record (i.e.: COBOL, FORTRAN) this was implemented in C as the struct keyword. And so C++ uses structs to comply with this C's heritage (the code and the programmers). Structs are simpler to be managed by the programmer and the compiler. One should use a struct for POD (PlainOldData) types that have no methods and whose data members are all public. struct may be used more efficiently in situations that default to public inheritance (which is the most common kind) and where public access (which is what you want if you list the public interface first) is the intended effect. Using a class, you typically have to insert the keyword public in two places, for no real advantage. In the end it's just a matter of convention, which programmers should be able to get used to.
 * Why should you Use Structs, Not Classes?

As a simple example of a compound structure, consider the concept of a mathematical point. At one level, a point is two numbers (coordinates) that we treat collectively as a single object. In mathematical notation, points are often written in parentheses, with a comma separating the coordinates. For example, (0, 0) indicates the origin, and (x, y) indicates the point x units to the right and y units up from the origin.
 * Point objects :

The natural way to represent a point is using two doubles. The structure or <tt>struct</tt> is one of the solutions to group these two values into a compound object.

This definition indicates that this structure contains two members, named <tt>x</tt> and <tt>y</tt>. These members are also called instance variables, for reasons I will explain a little later.

It is a common error to leave off the semi-colon at the end of a structure definition. It might seem odd to put a semi-colon after a squiggly-brace, but you'll get used to it. This syntax is in place to allow the programmer the facility to create an instance[s] of the struct when it is defined.

Once you have defined the new structure, you can create variables with that type:

The first line is a conventional variable declaration: blank has type Point. The next two lines initialize the instance variables of the structure. The "dot notation" used here is similar to the syntax for invoking a function on an object, as in <tt>fruit.length</tt>. Of course, one difference is that function names are always followed by an argument list, even if it is empty.

As usual, the name of the variable blank appears outside the box and its value appears inside the box. In this case, that value is a compound object with two named instance variables.

You can read the values of an instance variable using the same syntax we used to write them:
 * Accessing instance variables :

The expression <tt>blank.x</tt> means "go to the object named blank and get the value of the member named x." In this case we assign that value to a local variable named <tt>x</tt>. Notice that there is no conflict between the local variable named <tt>x</tt> and the instance variable named <tt>x</tt>. The purpose of dot notation is to identify which variable you are referring to unambiguously.

You can use dot notation as part of any expression, so the following are legal.

The first line outputs 3, 4; the second line calculates the value 5.

Most of the operators we have been using on other types, like mathematical operators ( <tt>+</tt>, <tt>%</tt>, etc.) and comparison operators (<tt>==</tt>, <tt>></tt>, etc.), do not work on structures. Actually, it is possible to define the meaning of these operators for the new type, but we won't do that in this book.
 * Operations on structures :

On the other hand, the assignment operator does work for structures. It can be used in two ways: to initialize the instance variables of a structure or to copy the instance variables from one structure to another. An initialization looks like this:

The values in curly brackets get assigned to the instance variables of the structure one by one, in order. So in this case, <tt>x</tt> gets the first value and y gets the second.

Unfortunately, this syntax can be used only in an initialization, not in an assignment statement. Therefore, the following is illegal.

You might wonder why this perfectly reasonable statement should be illegal, and there is no good answer. (Note, however, that a similar syntax is legal in C since 1999, and is under consideration for possible inclusion in C++ in the future.)

On the other hand, it is legal to assign one structure to another. For example:

The output of this program is.

You can write functions that take or return structures. For example, findCenter takes a Rectangle as an argument and returns a Point that contains the coordinates of the center of the Rectangle:
 * Structures as function arguments and return types :

To call this function, we have to pass a Rectangle as an argument, and assign the return value to a Point variable:

The output of this program is (60, 100).

Notice that the Rectangle is being passed to function findCenter by a reference (explained in chapter Functions), because this is more efficient than copying the whole structure what would be done on passing by value. The reference is declared constant, meaning that function findCenter will not modify the argument box, especially that mybox of the caller will remain unchanged.

Structures can also be pointed by pointers and store pointers. The rules are the same as for any fundamental data type. The pointer must be declared as a pointer to the structure.
 * Pointers and structures:

Nesting structures
Structures can also be nested so that a valid element of a structure can also be another structure.

this
The this keyword is an implicitly created pointer that is only accessible within nonstatic member functions of a struct (or a union or class) and points to the object for which the member function is called. This pointer is not available in static member functions. This will be restated again on when introducing unions a more in depth analysis is provided in the Section about classes.

title: C++ Programming/Structures


text:
C++ Programming/Unions

Writing to Different Bytes
Unions are very useful for low-level programming tasks that involve writing to the same memory area but at different portions of the allocated memory space, for instance:

Using this union we can modify the low-order or high-order bytes of theItem without disturbing any other bytes.

Example in Practice: SDL Events
One real-life example of unions is the event system of SDL, a graphics library in C. In graphical programming, an event is an action triggered by the user, such as a mouse move or keyboard press. One of the SDL's responsibilities is to handle events and provide a mechanism for the programmer to listen for and react to them.

Each of the types other than Uint8 (an 8-bit integer) is a struct with details for that particular event.

When the programmer receives an event from SDL, he first checks the type value. This tells him what kind of an event it is. Based on this value, he either ignores the event or gets more information by getting the appropriate part of the union.

For example, if the programmer received an event in SDL_Event ev, he could react to mouse clicks with the following code.

While identical functionality can be provided with a struct rather than a union, the union is far more space efficient; the struct would use memory for each of the different event types, whereas the union only uses memory for one. As only one entry has meaning per instance, it is reasonable to use a union in this case.

This scheme could also be constructed with polymorphism and inheritance features of object-oriented C++, however the setup would be involved and less efficient than this one. Use of unions loses type safety, however it gains in performance.

this
The this keyword is a implicitly created pointer that is only accessible within nonstatic member functions of a union (or a struct or class ) and points to the object for which the member function is called. The this pointer is not available in static member functions. This will be restated again on when introducing unions a more in depth analysis is provided in the Section about classes.

title: C++ Programming/Unions


text: Template:High School Mathematics Extensions/Supplementary/TOC


text:
C++ Programming/Exception Handling

Exception Handling
Exception handling is a construct designed to handle the occurrence of exceptions, that is special conditions that changes the normal flow of program execution. Since when designing a programming task (a class or even a function), one cannot always assume that application/task will run or be completed correctly (exit with the result it was intended to). It may be the case that it will be just inappropriate for that given task to report an error message (return an error code) or just exit. To handle these types of cases, C++ supports the use of language constructs to separate error handling and reporting code from ordinary code, that is, constructs that can deal with these exceptions (errors and abnormalities) and so we call this global approach that adds uniformity to program design the exception handling.

An exception is said to be thrown at the place where some error or abnormal condition is detected. The throwing will cause the normal program flow to be aborted, in a raised exception. An exception is thrown programmatic, the programmer specifies the conditions of a throw.

In handled exceptions, execution of the program will resume at a designated block of code, called a catch block, which encloses the point of throwing in terms of program execution. The catch block can be, and usually is, located in a different function/method than the point of throwing. In this way, C++ supports non-local error handling. Along with altering the program flow, throwing of an exception passes an object to the catch block. This object can provide data that is necessary for the handling code to decide in which way it should react on the exception.

Consider this next code example of a try and catch block combination for clarification:

Unhandled exceptions on the other hand will result in a function termination and the stack will be unwound (stack allocated objects will have destructors called) as it looks for an exception handler. If none is found it will ultimately result in the termination of the program.

From the point of view of a programmer, raising an exception is a useful way to signal that a routine could not execute normally. For example, when an input argument is invalid (e.g. a zero denominator in division) or when a resource it relies on is unavailable (like a missing file, or a hard disk error). In systems without exceptions, routines would need to return some special error code. However, this is sometimes complicated by the semi-predicate problem, in which users of the routine need to write extra code to distinguish normal return values from erroneous ones.

Because it is hard to write exception safe code, you should only use an exception when you have to—when an error has occurred that you can not handle. Do not use exceptions for the normal flow of the program.

This example is wrong, it is a demonstration on what to avoid:

Stack unwinding
Consider the following code

The flow of the program:
 * calls
 * creates a local variable named
 * constructor allocates a memory chunk to hold the string
 * calls
 * throws an exception
 * does not catch the exception.
 * Because the exception was not caught, we now need to exit  in a clean fashion.
 * At this point, all the destructors of local variables previous to the throw
 * are called—This is called 'stack unwinding'.

 * The destructor of  is called, which releases the memory occupied by it.
 * As you can see, the mechanism of 'stack unwinding' is essential to prevent resource leaks—without it,  would never be destroyed, and the memory it used would be lost until the end of the program (even until the next loss of power, or cold boot depending on the Operative System memory management).

 * catches the exception
 * The program continues.

The 'stack unwinding' guarantees destructors of local variables (stack variables) will be called when we leave its scope.

Throwing objects
There are several ways to throw an exception object.

Throw a pointer to the object:

But now, who is responsible to delete the exception? The handler? This makes code uglier. There must be a better way!

How about this:

Looks better! But now, the catch handler that catches the exception, does it by value, meaning that a copy constructor is called. This can cause the program to crash if the exception caught was a  caused by insufficient memory. In such a situation, seemingly safe code that is assumed to handle memory allocation problems results in the program crashing with a failure of the exception handler. Moreover, catching by value may cause the copy to have different behavior because of object slicing.

The correct approach is:

This method has all the advantages—the compiler is responsible for destroying the object, and no copying is done at catch time!

The conclusion is that exceptions should be thrown by value, and caught by (usually const) reference.

The keyword
Consider the code snippet: When this code is executed, the program will look for a block for the exception, but it does not exist. Hence it will crash and not proceed. The keyword allows some final code to execute before crashing. Note that if the exception is caught, the lines after the try-catch block will execute anyway. Hence the block will be of effect only when there is no matching catch block.

Constructors and destructors
When an exception is thrown from a constructor, the object is not considered instantiated, and therefore its destructor will not be called. But all destructors of already successfully constructed base and member objects of the same master object will be called. Destructors of not yet constructed base or member objects of the same master object will not be executed. Example:

Let's assume the constructor of base class C throws. Then the order of execution is:
 * (throws)
 * (throws)

Let's assume the constructor of member object sE throws. Then the order of execution is: Thus if some constructor is executed, one can rely on that all other constructors of the same master object executed before, were successful. This enables one, to use an already constructed member or base object as an argument for the constructor of one of the following member or base objects of the same master object.
 * (throws)
 * (throws)
 * (throws)
 * (throws)

What happens when we allocate this object with  ?
 * Memory for the object is allocated
 * The object's constructor throws an exception
 * The object was not instantiated due to the exception
 * The memory occupied by the object is deleted
 * The exception is propagated, until it is caught

The main purpose of throwing an exception from a constructor is to inform the program/user that the creation and initialization of the object did not finish correctly. This is a very clean way of providing this important information, as constructors do not return a separate value containing some error code (as an initialization function might).

In contrast, it is strongly recommended not to throw exceptions inside a destructor. It is important to note when a destructor is called:
 * as part of a normal deallocation (exit from a scope, delete)
 * as part of a stack unwinding that handles a previously thrown exception.

In the former case, throwing an exception inside a destructor can simply cause memory leaks due to incorrectly deallocated object. In the latter, the code must be more clever. If an exception was thrown as part of the stack unwinding caused by another exception, there is no way to choose which exception to handle first. This is interpreted as a failure of the exception handling mechanism and that causes the program to call the function terminate.

To address this problem, it is possible to test if the destructor was called as part of an exception handling process. To this end, one should use the standard library function uncaught_exception, which returns true if an exception has been thrown, but hasn't been caught yet. All code executed in such a situation must not throw another exception.

Situations where such careful coding is necessary are extremely rare. It is far safer and easier to debug if the code was written in such a way that destructors did not throw exceptions at all.

Writing exception safe code
A piece of code is said to be exception-safe, if run-time failures within the code will not produce ill effects, such as memory leaks, garbled stored data, or invalid output. Exception-safe code must satisfy invariants placed on the code even if exceptions occur. There are several levels of exception safety:
 * Exception safety
 * 1) Failure transparency, also known as the no throw guarantee: Operations are guaranteed to succeed and satisfy all requirements even in presence of exceptional situations. If an exception occurs, it will not throw the exception further up. (Best level of exception safety.)
 * 2) Commit or rollback semantics, also known as strong exception safety or no-change guarantee: Operations can fail, but failed operations are guaranteed to have no side effects so all data retain original values.
 * 3) Basic exception safety: Partial execution of failed operations can cause side effects, but invariants on the state are preserved. Any stored data will contain valid values even if data has different values now from before the exception.
 * 4) Minimal exception safety also known as no-leak guarantee: Partial execution of failed operations may store invalid data but will not cause a crash, and no resources get leaked.
 * 5) No exception safety: No guarantees are made. (Worst level of exception safety)

Partial handling
Consider the following case:

Can you see the problem in this code? If  throws an exception, the variable   is never deleted and we have a memory leak.

To prevent the memory leak,  must catch the exception, and delete. But  can't handle the exception, it doesn't know how!

What is the solution then? shall catch the exception, and then re-throw it:

There's a better way though; using RAII classes to avoid the need to use exception handling.

Guards
If you plan to use exceptions in your code, you must always try to write your code in an exception safe manner. Let's see some of the problems that can occur:

Consider the following code:

Can you see the problem in this code? When an exception is thrown, we will never run the line that deletes !

What's the solution to this? Earlier we saw a solution based on  ability to catch and re-throw. But there is a neater solution using the 'stack unwinding' mechanism. But 'stack unwinding' only applies to destructors for objects, so how can we use it?

We can write a simple wrapper class:

The new version of : The pattern presented here is called a guard. A guard is very useful in other cases, and it can also help us make our code more exception safe. The guard pattern is similar to a finally block in other languages.

Note that the C++ Standard Library provides a templated guard by the name of unique_ptr.

Exception hierarchy
You may throw as exception an object (like a class or string), a pointer (like ), or a primitive (like  ). So, which should you choose? You should throw objects, as they ease the handling of exceptions for the programmer. It is common to create a class hierarchy of exception classes:
 * class MyApplicationException {};
 * class MathematicalException : public MyApplicationException {};
 * class DivisionByZeroException : public MathematicalException {};
 * class InvalidArgumentException : public MyApplicationException {};

An example:

Exception specifications
The range of exceptions that can be thrown by a function are an important part of that function's public interface. Without this information, you would have to assume that any exception could occur when calling any function, and consequently write code that was extremely defensive. Knowing the list of exceptions that can be thrown, you can simplify your code since it doesn't need to handle every case.

This exception information is specifically part of the public interface. Users of a class don't need to know anything about the way it is implemented, but they do need to know about the exceptions that can be thrown, just as they need to know the number and type of parameters to a member function. One way of providing this information to clients of a library is via code documentation, but this needs to be manually updated very carefully. Incorrect exception information is worse than none at all, since you may end up writing code that is less exception-safe than you intended to.

C++ provides another way of recording the exception interface, by means of exception specifications. An exception specification is parsed by the compiler, which provides a measure of automated checking. An exception specification can be applied to any function, and looks like this:

You can specify that a function cannot throw any exceptions by using an empty exception specification:

Shortcomings of exception specifications
C++ does not programmatically enforce exception specifications at compile time. For example, the following code is legal:

Rather than checking exception specifications at compile time, C++ checks them at run time, which means that you might not realize that you have an inaccurate exception specification until testing or, if you are unlucky, when the code is already in production.

If an exception is thrown at run time that propagates out of a function that doesn't allow the exception in its exception specification, the exception will not propagate any further and instead, the function  will be called. The  function doesn't return, but can throw a different type of exception that may (or may not) satisfy the exception specification and allow exception handling to carry on normally. If this still doesn't recover the situation, the program will be terminated.

Many people regard the behavior of attempting to translate exceptions at run time to be worse than simply allowing the exception to propagate up the stack to a caller who may be able to handle it. The fact that the exception specification has been violated does not mean that the caller can't handle the situation, only that the author of the code didn't expect it. Often there will be a  block somewhere on the stack that can deal with any exception.

title: C++ Programming/Exception Handling


text:
C++ Programming/RTTI

Run-Time Type Information (RTTI)
RTTI refers to the ability of the system to report on the dynamic type of an object and to provide information about that type at runtime (as opposed to at compile time), and when utilized consistently can be a powerful tool to ease the work of the programmer in managing resources.

Consider what you have already learned about the keyword, and let's say that we have the following class hierarchy:

Let's say that we also have a pointer of type, like so:

Supposing that a situation emerges that we are forced to presume but have no guarantee that the pointer points to an object of type  and we would like to call the member   of that class. To dynamically convert to a derived type we can use, like so:

With, the program converts the base class pointer to a derived class pointer and allows the derived class members to be called. Be very careful, however: if the pointer that you are trying to cast is not of the correct type, then will return a null pointer.

We can also use with references.

This works almost in the same way as pointers. However, if the real type of the object being cast is not correct then will not return null (there's no such thing as a null reference). Instead, it will throw a  exception.

In RTTI it is used in this setup:

Sometimes we need to know the exact type of an object. The  operator returns a reference to a standard class   that contains information about the type. This class provides some useful members including the  and   operators. The most interesting method is probably:

This member function returns a pointer to a C-style string with the name of the object type. For example, using the classes from our earlier example:

This program would print something like because that is the dynamic type of the pointer.

is actually an operator rather than a function, as it can also act on types:

for example (and somewhat circularly)

will give a  object which describes   objects. This latter use is not RTTI, but rather CTTI (compile-time type identification).

Limitations
There are some limitations to RTTI. First, RTTI can only be used with polymorphic types. That means that your classes must have at least one virtual function, either directly or through inheritance. Second, because of the additional information required to store types some compilers require a special switch to enable RTTI.

Note that references to pointers will not work under RTTI:

Will report, as   does not support reference types.

Misuses of RTTI
RTTI should only be used sparingly in C++ programs. There are several reasons for this. Most importantly, other language mechanisms such as polymorphism and templates are almost always superior to RTTI. As with everything, there are exceptions, but the usual rule concerning RTTI is more or less the same as with  statements. Do not use it as a shortcut around proper, more robust design. Only use RTTI if you have a very good reason to do so and only use it if you know what you are doing.

title: C++ Programming/RTTI


text:
JavaScript/Optimization

Optimization Techniques

 * High Level Optimization
 * Algorithmic Optimization (Mathematical Analysis)
 * Simplification

 * Low Level Optimization
 * Loop Unrolling
 * Strength Reduction
 * Duff's Device
 * Clean Loops

 * External Tools & Libraries for speeding/optimizing/compressing JavaScript code

String concatenation
Strings in JavaScript are immutable objects. This means that once you create a string object, to modify it, another string object must theoretically be created.

Now, suppose you want to perform a ROT-13 on all the characters in a long string. Supposing you have a rot13 function, the obvious way to do this might be:

Especially in older browsers like Internet Explorer 6, this will be very slow. This is because, at each iteration, the entire string must be copied before the new letter is appended.

One way to make this script faster might be to create an array of characters, then join it:

Internet Explorer 6 will run this code faster. However, since the original code is so obvious and easy to write, most modern browsers have improved the handling of such concatenations. On some browsers the original code may be faster than this code.

A second way to improve the speed of this code is to break up the string being written to. For instance, if this is normal text, a space might make a good separator:

This way the bulk of the new string is copied much less often, because individual characters are added to a smaller temporary string.

A third way to really improve the speed in a for loop, is to move the [array].length statement outside the condition statement. In face, every occurrence, the [array].length will be re-calculate For a two occurrences loop, the result will not be visible, but (for example) in a five thousand occurrence loop, you'll see the difference. It can be explained with a simple calculation : "x = 0" is evaluated only one time, so it's only one operation.

"x < myArray.length" is evaluated 5000 times, so it is 10,000 operations (myArray.length is an operation and compare myArray.length with x, is another operation).

"x++" is evaluated 5000 times, so it's 5000 operations.

There is a total of 15 001 operation.

"x = 0" is evaluated only one time, so it's only one operation.

"l = myArray.length" is evaluated only one time, so it's only one operation.

"x < l" is evaluated 5000 times, so it is 5000 operations (l with x, is one operation).

"x++" is evaluated 5000 times, so it's 5000 operations.

There is a total of 10002 operation.

So, in order to optimize your for loop, you need to make code like this :

title: JavaScript/Optimization