text:
Fire and emergency management/Rescue victims of a building collapse/Moving in an unknown environment

Safety Where Fire Is A Potential
When in strange surroundings and unable to see, the safest course of action is to work by touch. The need for caution is obvious and accidents can be avoided by remembering a few simple points:

Shuffle, don’t walk. The weight of the body should be kept poised on the rear foot until the advancing foot has tested that it is safe to move forward; do not lift the feet from the ground – they should slide forward as this will help detect obstructions and dangers.

Vehicle Safety
Emergency vehicles must be driven by an authorised driver in accordance with the Road Transport Act (for New Zealand, check local legislation), particularly with regard to the use of warning lights and sirens. Vehicles and trailers must be maintained in first class condition, and regular checks and inspections should be routine.

Upon arrival at an accident scene, the rescue vehicle must be positioned with due regard to the site hazards, and warning devices must be used to protect the team and the vehicle.

The aim of a rescue team is to assist the public in time of need, and this should always be kept in mind when the team is travelling to an emergency. Little can be done for original casualties if the rescue team is involved in an accident en-route.

Equipment Safety
All equipment should be used in close compliance with the manufacturers’ operating instructions, and the following basic safety rules for rescue tools and equipment should be followed:

 * Safety goggles and gloves must be worn when using power tools or hammering pickets.
 * Many items of equipment have been specifically designed for particular tasks. Careful safety consideration must be given before any modification of equipment, or method of use, is attempted.
 * Only blades, fuel, oil, hydraulic fluid, and parts that are recommended by the manufacturer should be used.
 * Petrol driven motors must never be refuelled while they are hot, and they must be kept apart from fuel supplies and casualties.
 * All specific safety procedures for rescue equipment must be adhered to, and regular and careful safety checks must be carried out both before and after use.

Public Utility Hazards
General Any emergency, from a vehicle accident to a disaster, can result in the rupture of gas and water services, or the bringing down of electrical power  lines.

All utility services must be treated with the utmost care, and where possible, either the casualty removed from the source of danger, or the danger removed from the proximity of the casualty.

In a disaster, rescuers must consider their own safety as more important than any single casualty. The loss of a single rescuer could well affect the capability of the team to conduct an effective rescue and save a large number of lives. This must be weighed against the dangers involved in tackling a hazardous situation.

Gas (CNG and LPG) Escaping gas creates the danger of explosion and the following safety precautions must be observed:
 * When entering a building, if you smell gas, turn off the supply and allow time for the area to clear. Ventilation will greatly assist this.
 * Never look for a leak with a match. Use soapy water, and if you find a leak, turn off the supply immediately.
 * Be extremely careful of leaking liquid propane or butane. Serious frostbite burns will occur on contact with the liquid.
 * If a cylinder is leaking liquid while lying on it’s side, stand the cylinder upright before turning the cylinder off.
 * If a line is broken and the supply cannot be turned off, the line can be crimped with a pair of pliers.
 * A leak that cannot be turned off can often be stopped by binding the area with a wet cloth. This will freeze over and temporarily prevent any further leak. Use thick gloves when attempting this.
 * If it is not possible to stop the cylinder leaking, remove it to a safe place outdoors, keeping people and ignition sources at least 20 metres away.
 * If fire is present around a cylinder, keep the cylinder cool by hosing it with a water spray.
 * If a cylinder valve cannot be closed and the gas is burning, keep the cylinder cool by hosing, but do not attempt to extinguish the flame as the build-up of burned gases may explode if re-ignited.
 * Never attempt to ignite a gas leak.
 * Only intrinsically safe equipment should be used where gas is suspected.
 * Never use power tools or oxy-acetylene torches in a confined area where gas is suspected.

Water Water from broken mains and other sources (e.g. rain, fire fighting water, etc.) may enter areas where casualties could be trapped, especially in basement or other underground areas. The appropriate precautions must be observed.

Sewers Broken sewers may create problems of flooding and escaping gas. Sewer gases can be explosive as well as toxic. The following basic precautions must be observed:
 * Gas monitoring is essential for the safe handling of sewer gases.
 * Take appropriate action prior to entering any area containing sewage.
 * Never use an open flame.
 * Endeavour to divert the flow away from the rescue area by building a dam or other obstruction, or by pumping.
 * Personal hygiene and public health issues must be addressed in the appropriate manner.

Electricity Live wires present a serious hazard to trapped casualties and rescue personnel, therefore the following safety precautions should be observed at all times:
 * Assume all electric wires are ‘live’. The fact that wires do not sputter or spark is no indication that they are dead.
 * Avoid pools of water close to live wires as they may be just as dangerous as live wires.
 * DO NOT attempt to cut any electrical wires.
 * The supply to a damaged building should be switched off at the main switch, normally located in the meter box. The fuses should be removed and secured. Be aware; in some cases there may be more than one supply line to an individual building.

 * Keep vehicles and personnel well clear of areas where wires are torn.
 * Be particularly cautious at night when it is difficult to see wires. The technique of holding the back of the hand out in front of your face is advised.

Correct Lifting Techniques
At all levels of rescue and training operations, rescuers will be required to lift, haul or push loads, and must be trained to handle these tasks properly and safely where mechanical aids are not available or useable.

Team Lifting
Team lifting is carried out using the same individual techniques already described, but with team discipline and control. LOWER.
 * When the team is in position with respect to the load, the leader gives the preparatory order: PREPARE TO LIFT.
 * Any rescuer not ready to lift must quickly call: STOP, and the Team Leader must wait until all is in order. In the absence of any such dissent, the Team Leader will give the executive order: LIFT.
 * On this command, all rescuers lift their portion of the load by the technique already described, slowly, and in unison.
 * As with the individual technique, lowering a load is the reversal of the procedure with the Team Leader using the commands: PREPARE TO LOWER and


text:
Transwiki:Wikiversity-School of Fire and Emergency Management/Rescue Victims of a Building Collapse:Reconnaissance

The Rescue Plan
The success of rescue operations depends principally on the Team Leader organising a quick and thorough reconnaissance of the situation, and then through the appreciation process, developing a workable plan.

Reconnaissance & Rescue By Stages
No set of rules can be devised to give leaders specific guidance on how to tackle every job, but by proceeding in stages in accordance with a regular plan they are less liable to overlook important points and more likely to appreciate, and organise, appropriate action.

R.E.P.E.A.T.
This method of Rescue by Stages is consistent with the International Search And Rescue Advisory Group (INSARAG) rescue response guidelines.

Reconnaissance & Survey This is the initial activity undertaken upon arrival at a scene. It includes the resources available to the Team, including personnel, equipment, local expertise, level of training, size and complexity of task, etc. It also takes into account external factors including the weather conditions, external and subsequent threats, structure, or building, in or near the area, surface conditions, etc.

The assessment of the area, or site, that is searched for possible victims (surface and/or buried) and the identification and evaluation of resources and hazards. Information gained from this activity should be used to compile a “master” rescue plan of the area or site, where victims, hazards, access, egress, etc. are shown.

Reconnaissance is an ongoing activity, and is not completed until the operation is finished. Reconnaissance is:

It is essential that every member of a rescue team be trained in reconnaissance. In many instances the Team Leader will be responsible for a number of tasks, and personnel deployed must be capable of conducting reconnaissance and of reporting observations.

All sources should be exploited to obtain information regarding casualties, damage, and likely hazards. The reconnaissance summary should be aimed at an accurate assessment of:
 * The number and location of casualties
 * Dangerous situations such as gas, electricity, overhanging walls, unsafe structural components, or anything else which may endanger rescue personnel or survivors
 * Access to the casualties or task and alternate exits
 * The extent and type of damage
 * Appropriate services and support agencies
 * Available resources, both personnel and equipment
 * The time the task would take with available resources.

Elimination of Utilities All utilities must be evaluated and controlled for the safety of all those involved. It does not involve any treatment to, or rescue of, victims, as the main need is for information at this stage. (It is expected that some rescue activities will be taking place simultaneously.)

Primary Surface Search & Rescue Surface, and lightly trapped, victims should be removed as quickly, and safely, as possible. Extreme care must be taken during this phase to ensure that rescuers do not become victims. It is at this stage that many of the techniques in this manual will be put to use.

Where a number of structures have to be searched, it is vital to adopt a disciplined Priority Structure Assessment (PSA). Also the hazard marking system, and the search marking system must be applied at this stage.

Exploration Of All Voids And Spaces All voids and accessible spaces created as a result of the event must be explored for live victims.

Access By Selected Debris Removal The use of special tools and/or techniques may be necessary after locating a victim. It may be necessary to remove only certain obstructions to gain access to the victim.

Information gained from the reconnaissance can be helpful during this phase. Local knowledge and/or expertise will assist in the identification of possible victim location, and also areas where structural safety is a concern. Experts might include building wardens, survivors, engineers, etc.

Areas that have been identified by search dogs, or the use of electronic search equipment will be given priority at this stage.

It would be unusual for heavy equipment to be used during this phase.

Termination by General Debris Removal This is usually conducted after all known victims have been recovered and accounted for.

An exception would be when information indicates the possibility of other victims located where a large amount of debris is obstructing operations. The decision to use heavy equipment during this phase must be given serious consideration, especially when there is a possibility that live victims are still in the debris.

The Appreciation Process
The appreciation process is a simple method of problem solving which is effective in rescue situations. It involves the logical assessment of the situation, and the reconnaissance, and results in the formation of the workable plan.

The appreciation process consists of six steps: Step One – Define The Problem The problem to be solved, or task to be accomplished must be clearly defined. The problem may be too large or complex to be easily tackled, and may be divided into a number of manageable elements, each with a set aim.

Step Two – State The Aim The aim is a clear statement of what the team has to achieve in order to solve the problem. The aim must be clear, concise, achievable, and expressed in positive terms. The aim will form the mission statement in an operational briefing and should be as simple as: “To rescue the casualty from the bottom of the lift shaft”.

Step Three – Consider The Factors Factors are points relevant to the problem that has to be solved. Some factors that may have to be considered in an operational situation are: Each factor will lead to one or more logical deductions, so that the leader should be in a position to say: “If this is the case – then…” Factors in an appreciation may be set out as in the following example:
 * Number and location of casualties
 * Time and space
 * Topography
 * Weather
 * Available resources, both personnel and equipment
 * Support requirements and availability
 * Communications
 * Logistics
 * Priority of tasks.

Each factor should be thoroughly examined and care should be taken not to introduce irrelevant facts into the examination.

Step Four – Determine Courses Open All possible courses that will attain the aim and that are practical must be considered in the ‘Courses Open’ segment. Only facts dealt with in the ‘Factors’ should be considered and no new material should be introduced at this stage.

Step Five – Decide On Best Course At this stage, a choice must be made from one of the possible solutions developed by the appreciation process. If more than one workable solution is produced and the best course is not obvious, the following criteria should be applied to each:
 * Risk — Which solution carries the least risk factor in its execution, or the consequence of failure?
 * Simplicity — Which is the simplest course?
 * Time — If urgency is a factor, which course can be completed in the shortest time?
 * Economy — In the terms of resources, which solution imposes the least demand?

Step Six – Plan The plan will result from the choice of the best course open. That is, it will be the best solution to the problem with the most advantages and the least disadvantages. The plan must be simple, and it must relate directly to the aim. When completed, the plan should be checked against the following test questions:
 * Is the reasoning sound?
 * Is it set out in a logical order?
 * Is everything relevant to the problem?
 * Has anything relevant been left out?
 * Is it free of uncertainties or ambiguities?
 * Is it accurate (positions, timings and so on)?
 * Has the aim been kept in mind throughout?
 * Can the plan achieve the aim?

Continuing Action
Having made decisions and deployed personnel, Team Leaders must ensure reconnaissance is continued with a view to allocating priorities for the further deployment of resources.

Rescuers deployed on a particular building, damaged by blast or natural causes, should make careful observation of how that building has collapsed. The art of rescue lies in being able to identify and exploit to the maximum, all debris formations such as voids etc, which can be used to facilitate access to casualties once their whereabouts have been fixed by firm information or inference.

Attempt to locate and identify the parts of the building and especially those parts in which casualties are reported to be. This will provide a rough idea where casualties might be found in relation to the various parts of the damaged structure.

At times such as this, a leader will need to call upon all accumulated experience and training and combine them with effective decision-making.

Calling And Listening Techniques
When it is known that people are still missing, and rescuers are confronted with a major structural collapse, the casualties may be trapped within voids or survival spaces formed by the collapsing building. A ‘Calling and Listening’ period should be introduced — this has, in the past, saved many lives.

The leader places available team members at suitable vantage points around the area where people may be trapped, and then calls: SILENCE, SILENCE FOR RESCUE. Each member, as directed by the leader calls: RESCUE TEAM HERE, CAN YOU HEAR ME? while the other members listen intently for any reply. If none is heard it is a good plan to tap on a wall, or on any gas or water pipe, beam etc. running into the debris, all of which are good conductors of sound, and again listen for an answer.

On hearing a reply, each listener points to the place from which a sound came, thus ‘pin pointing’ the position. Once contact has been established with a trapped person, it must be maintained. At night this procedure is best done by pointing in the direction of sounds with torches. Rescuers must not be affected by peer pressure and must point to where they think the sound comes from.

Specialist resources such as trained dogs, heat sensors, fibre optic probes, acoustic locators and the like should be utilised where available. If casualties are located, their recovery will entail removing debris according to: Where it is not possible to account for all missing people, it may be ecessary to strip the site methodically. When debris has been relocated, the pile should be suitably marked.
 * The location of the casualty
 * The nature of their injuries (if known)
 * The layout of the building
 * The way in which the building has collapsed.

Damage To Buildings
The type of construction of a building gives some indication of how it may collapse, as a result of a blast, cyclonic wind, or earthquake. Most structures will contain voids or spaces in which trapped people could remain alive for relatively long periods. To know where these safe places may be, it is necessary to know the broad characteristics of construction types.

Types Of Buildings
This section is quite New Zealand specific, but helpful nonetheless. Buildings can be grouped into categories by the methods and materials used in their construction:
 * Light timber framed
 * Unreinforced masonry
 * Reinforced concrete masonry (blockwork)
 * Concrete tilt-up
 * Reinforced concrete/structural steel.

Light Timber Framed
 * Low rise
 * Typically residential or school buildings
 * Includes brick veneers.

Unreinforced Masonry
 * Brick or stone construction prior to mid-1930’s
 * Could have concrete or timber floors
 * May or may not be strengthened with steel or concrete elements.

Reinforced Concrete Masonry (Blockwork)
 * Typically low-rise (up to 3 storeys)
 * 1960’s onwards.

Concrete Tilt-Up
 * Typically industrial buildings, but also newer medium-rise residential buildings.

Reinforced Concrete/Structural Steel
 * Ranges of different structural bracing systems (wall panels, moment resisting frames)
 * Concrete floors
 * All eras/ all sizes.

Types Of Collapse
All buildings, when subjected to sufficient pressure will collapse in a manner that is largely dependent upon the type of construction. In most instances the floors, ceilings, and roof will collapse in large sections and not disintegrate into a large number of small sections. Cyclonic pressure is the exception to this rule.

These large sections, when they fall, will create voids. The most common types are:
 * The ‘V’ type
 * The ‘lean-to’
 * The ‘horizontal/pancake’.

Precautions In Operations
In the interest of safety to both the trapped and the rescuers, a thorough appreciation must be made before any rescue operation is commenced. The main safety considerations are as follows: types of collapse.
 * Do not move any debris in contact with the collapse without assessing its importance to the stability of the site.
 * Always stabilise a collapse with shoring before entering a void.
 * Entry and rescue procedures for confined spaces must comply with the provisions of AS2865 or local standards outside of Australia or New Zealand.
 * Always appreciate the forces and their possible direction of movement in all
 * Pack and support vertically, horizontally, and laterally whenever and wherever possible.
 * In all materials used, consider their strength in relation to the loads to which they will be subjected.
 * Any disaster will invariably result in ruptured electrical water, gas, and sewer lines and, although these will be primarily the responsibility of the public utility, it is essential that rescue personnel be trained to deal with such problems in the initial stages.

Crush Injuries
It should be remembered that casualties may be found who have suffered severe crush injuries. These people will be suffering from shock and their breathing passages may be clogged by the dust contained in the debris. Rescuers must take immediate steps to provide a clear airway for such casualties.

People trapped in debris and suffering from crush injuries need rapid and expert medical attention. These victims should be treated, if possible, before release from entrapment.

Debris Clearance
Two methods by which people trapped under a pile of debris can be extracted are: casualties are uncovered and freed. If anyone survives at all, inside or under a large pile of debris after a building has collapsed, it is because some heavy timber (a floor, or other portion of the structure) has fallen or remained fixed, in such a way as to protect this person from the main impact and weight of the debris. Furniture can sometimes protect a casualty. Unless something of this kind has happened, it is unlikely that the casualty will survive. This protection may be of a very unstable nature, and, unless great care is exercised, it may collapse.
 * By clearance of debris, ie: by removing the debris piece by piece until the
 * By the construction of tunnels and linking of voids.

Internal collapse can be avoided only by disturbing the debris as little as possible during rescue operations, and by making sure that, as one portion of the debris is removed, the remainder is not dislodged and allowed to slide or fall.

Careful observance of these principles reduces the risk of further injury to trapped people, resulting in greater speed in the rescue operation. The ideal is “speed with safety”.

When Debris Clearance Is Necessary If no information is available regarding the approximate position of people trapped in debris, rescue can usually be effected only by total debris clearance. The essential difference between debris clearance as a rescue operation and debris clearance to clear a site is that, so long as there is a reasonable chance of recovering casualties by debris clearance, it must be proceeded with by rescue teams with unremitting effort. Rescue services must continue at work until it is certain that nobody is still alive, and that the responsible officer, according to local arrangements, decides that operations can be discontinued.

Methods Of Debris Clearance
 * When debris clearance is undertaken for rescue purposes, the debris should be moved clear of the demolished building, and not merely from one part of the site to another.
 * Debris can be removed by hand or by using other receptacles found on the site. In a confined space or over obstacles, it is best to form a human chain.
 * It may sometimes be necessary when clearing debris, to cut a lane through it to reach a casualty. Great care must be taken in so doing, to ensure that the sides of the lane do not collapse. These can be made safe, where necessary, by a simple form of timbering or strutting.

Precautions In Operations
 * Exercise care in the use of edged tools in debris clearance.
 * Debris close to casualties should always be removed by hand.
 * Rescuers must wear gloves.
 * Rescuers must not climb over debris during the clearing operation unless absolutely necessary.
 * Debris should be withdrawn only when it is certain that no further collapse will be caused.
 * Heavy equipment should be operated only at the direction of the officer in charge.
 * Movement of major debris elements must be carefully coordinated.

Building Marking
General Area Marking

In any major event, international support may be required in the form of Urban Search And Rescue (USAR) teams. It is important that information related to structure identification, conditions, hazards, and victim status, is displayed in a standardised fashion to ensure uniformity and clarity.

This system standardises team functions, worksite hazards, mapping, sketch and landmark labelling with common symbols, ensures the accuracy of search assessment markings, and documents team accomplishments.

 * Common Identification System:
 * Marking
 * Signalling

 * Structure Assessment:
 * Search
 * Rescue
 * Special hazards of that structure
 * Victim Location.

 * Results:
 * Warning
 * Tracking
 * Continuity
 * Commonality.

Victim Marking
An easy way to understand the USAR marking system is to place it in a scenario context.

Other Markings
General cordon markings (marking tape, cordon, banners, flagging etc)—to be used for small, defined area. They can be enlarged to include other non-bildings (i.e. bridge, dangerous zones, security, etc). Large areas may require barricades/fences/patrol/etc.

Facility Iconic flags, banners, balloons etc. (must identify team identity, team medical facility, team CP).

Vehicle Vehicles must be marked with team name and function (flag, magnetic sign etc).

Team and function
 * Response team identified by uniform, patch, etc.
 * Personnel – the following positions should preferably be colour-coded, with plain text, on armbands, helmets, etc.
 * Management position(s) – white
 * Medical position(s) – red cross / red crescent
 * Safety / Security position(s) – orange.

The Dead
'''Note: This is current acceptable practice in New Zealand. Be sure to check the legal position in your own country.'''

Identification And Removal Although identification of the dead is a Police responsibility, routine procedures may not be feasible in a major disaster. Police Disaster Victim identification (DVI) teams, located at various points around the country will be deployed to a disaster area and may require Civil Defence Emergency Management assistance.
 * In general, do not remove bodies from the position in which they were found without the agreement of the Police.
 * Nevertheless, a rescuer may be justified in moving a body:
 * When rescuers would be put at risk if they had to re-enter the damaged building or structure where the body is located.
 * Where it is necessary in order to reach an injured person.
 * Where the body itself might be affected by flooding, fire, or imminent collapse of a building or structure.
 * The exact position in which a body is found may be critical to the identification of that person, particularly if there is extensive mutilation.
 * Where bodies do not have to be removed from the building or structure for reasons of safety, make a notebook entry of the location of the body and advise the Police as soon as possible. If possible, do not leave the site until the Police have arrived.
 * Where, in the interests of safety, it is considered that bodies should be removed from the exact location of where the body was found, then the person finding the body must collect all necessary information (including any identity obtained from survivors, and personal belongings found with the body). This should be recorded and attached to the body.

Suspicious Circumstances
 * If you are in any way suspicious as to the cause of death (suspecting either murder or suicide), do not disturb the body and surrounding area, but record, secure, and then notify the nearest Police.
 * Where there is danger of further damage to the body, (by fire, flood, or collapse of the building or structure, or danger to rescue workers and Police), then the body may be removed to a safe place which can be secured.
 * Give the Police all vital information (covering the location and position of the body, cause of death, suspicions, circumstances, personal belongings, etc.) included in a full report as soon as possible.
 * Photographic records of the original position and surrounding area would be most beneficial, where available.

Conduct At The Scene
 * In the presence of death, everyone should be respectful, subdued, and orderly.
 * There should be no attempt at humour.
 * Although survivors may be shocked when seeing their relative or friend covered, indicating death, DO cover a severely mutilated body.
 * Otherwise, treat a body as you would a low priority casualty.

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


text:
Fire and emergency management/Rescue victims of a building collapse/Ropes, tapes, knots and lashings/General information

Introduction
During a rescue operation, a variety of techniques involving ropes, tapes, knots and lashings may be required.

Identification
A system of marking each end of a rope for identification of length, and with a reference number to the rope history card, is recommended. Colour Coding can be used to quickly identify ropes, and should be located at each end of the rope. The suggested colour coding is:

 * GREEN—OK to use for all activities.
 * RED—not suitable for ‘life’ work.

Discard damaged rope immediately.

If faults are found during any rope inspection, immediate steps must be taken to rectify the problem(s) in accordance with Standard—AS4142.3 (or EN1891 or other local equivalent).

Record Systems
All ropes should be clearly and permanently identified and a record kept of individual items, their usage, inspection, and maintenance. Suggested headings for a record system are as follows:
 * Identity Number
 * Item Description
 * Purchase Date
 * Usage Dates
 * Description of Usage
 * Inspection Date
 * Inspected By: (name)
 * Maintenance Carried Out
 * Signature.

Rope
Rope is one of the most important tools of the rescue team. Rescuers will use a range of rope types for specific applications. All types have their advantages and disadvantages, but provided the rescuer has thorough knowledge of the characteristics and capabilities of each type, all will give valuable service provided they are appropriately cared for and maintained.

Whilst it is accepted that the Standard has not yet been adopted by all rescue services, it is strongly recommended that only synthetic fibre, Kernmantel, and static ropes which comply with AS4142.3, be used for life rescue purposes.

Types of Rope
The ropes in common use with rescue teams are:
 * Synthetic fibre rope
 * Climbing tape
 * Natural fibre rope
 * Flexible steel wire rope (SWR).

Terminology
For the purpose of this manual, the following terms are used in reference to open and rope management. Other terms may be used in specific organisations.


text:
Fire and emergency management/Rescue victims of a building collapse/Safety in training and operations

Introduction
The task of rescue involves the training of individuals and teams in a variety of skills, some of which, unless properly carried out, may well prove dangerous to the individual rescuer, the team, casualties, or bystanders. In all cases, the safety of rescuers is of prime importance. It is therefore necessary, particularly in the early stages of training and exercises, to pay a great deal of attention to safety measures, and to emphasise the need to strictly observe and enforce these measures.

Many of the safety precautions to be observed are merely common sense. Unfortunately, they are so basic and simple they are often overlooked.

The Responsibility for Safety
Safety is the principal consideration in any rescue activity and it is the responsibility of each rescuer to ensure that safety procedures and Occupational Health and Safety requirements are followed, instructions observed, and operations carried out with a minimum of risk. There are a number of guidelines, codes of practice, regulations, and procedures that relate to safety, and to operational aspects such as critical incident stress, and risk management. These are constantly being amended and updated – it is the responsibility of organisations to keep current.

Additionally, individual services have procedures for the management of these factors, and for laying out individual and organisational responsibilities. ll of these factors must be taken into account in the management of rescue activities. This section covers the key points of safety in training and operations as they affect the rescuer, the casualty, or the bystander. Specific safety points will be covered with each rescue technique, as they affect the conduct of that rescue technique.

Basic Precautions
Safety Officers should be appointed for any rescue activity. Team Leaders and Safety Officers are responsible for safety at all times. The orders given by these officers are to be obeyed without question or delay, as they are vital to safety.

Equipment must be regularly and carefully checked both before and after use. Ropes can wear and rot, batteries can corrode equipment, and machinery can break down. Faulty equipment can cost lives.

Any faulty or suspect equipment must be labelled immediately and removed for repair or replacement (e.g. the rope that a rescuer used, but did not check, and was damaged; may kill someone next time it is used).

Personnel ‘at risk’ by working at heights or depths must be protected by properly established and monitored safety lines and systems. Wherever possible, rescuers should adhere to standard techniques and practices. In any rescue technique, safety limits and margins have been built in for casualty and rescuer protection. These must never be ignored or exceeded.

Protective clothing and helmets are issued to each rescuer. Each has an obvious safety application, and they must be properly used. Helmets, in particular, must be worn at all times of risk, whether great or small. They are designed to protect the wearer from a single impact, then be replaced. They must never be mistreated by dropping, throwing, or being sat on. They should never be exposed to the effects of UV for prolonged periods (e.g. by being left on the back window-ledge of cars, or any other place).

All safety equipment must be maintained and replaced in accordance with the manufacturer’s recommendations.

For training and operations, other items such as protective clothing, foul weather gear, debris gloves, safety goggles, ear protection, and safety harnesses may be issued. These are all for specific purposes, and must be treated and issued with utmost care.

Rescue / Safety Harnesses
Personnel working at heights or in similar dangerous environments may require the protection and safety of a harness. A properly fitted climbing, rescue, or safety harness is recommended, and waist belts or safety lines are a minimum requirement if harnesses are not available. A certified Karabiner should be used for harness attachment with the rope or strop secured to the harness by this device at an approved point.

Some industrial safety harnesses are not suitable for rescue, as the location of the attachment points may be not suitable for rescue techniques. They are however, acceptable for low risk static situations. Competent advice should be obtained before their purchase and use is required.

Casualty Safety
It must be obvious that the safety of casualties is important. Every effort including the use of protective equipment must be made to ensure that casualties come to no further harm once a rescue team arrives at the scene.

For the sake of realism in training it is an advantage to use live casualties in exercises and drills. Teams should bear in mind the added safety required when dealing with heights, water, and contaminated areas, where dummy casualties may be substituted. In most cases, it is only by handling live casualties in training and exercises that rescuers will appreciate the problems they will encounter on operations.

Safe Working In A Confined Space
Rescue operations may fall within the definition of confined spaces as laid down in Standard AS/2865:1995 (Safe Work in Confined Spaces). This is the standard for Australia and New Zealand, check your local guideliines for your local standard.

A confined space is defined as an enclosed or partially enclosed space which:
 * Is at atmospheric pressure during occupancy
 * Is not intended or designed primarily as a place of work
 * May have restricted means for entry and exit
 * May have an atmosphere which contains potentially harmful levels of contaminant
 * Does not have a safe oxygen level
 * May cause you to be buried.

Rescue activities in such environments must be carried out with particular regard to the problems of breathing in dangerous atmospheres.


text:
Transwiki:Wikiversity-School of Fire and Emergency Management/Teenager Fire Safety Project Initiative

Identification:

The Fire Prevention Bureau has completed an analysis of all structure fires that have occurred within the Any Town Fire Department’s jurisdiction over the past two years. This analysis has identified thirty three structure fires involving single-family dwellings during that time period. Of these thirty-three structure fires, seventeen (51%) were caused by food on the stove. Twelve of these seventeen fires involved teenagers who were at home without parental supervision. The Prevention Bureau proposes an aggressive home fire-safety education program aimed at teenagers with emphasis on the dangers of leaving cooking items unattended. With your approval we would like to implement the following program.

Selection:

Any Town Fire Prevention Bureau would like to propose a fire prevention program that will focus on safe cooking practices in the home. The prevention bureau would like to present an instructional video, titled “Cooking Safety in the Home” that will focus on the primary target audience. We believe a high percentage of teens can be reached by conducting the program at public & private schools. Our secondary target group is parents with adolescent children. We intend to reach this group by presenting similar material at parent teacher conferences. The cost would be minimal if we use the public and private school system facilities to promote this program.

Design:

The program will consist of an introduction and information hand out by the Any Town Fire Prevention Bureau, a lecture using Power Point presentation on cooking safety, followed by short video on the dangers of leaving cooking items unattended. The program length should not exceed 30 minutes and be presented two times per year at the start of each semester. The adult program will be presented once per school semester at the parent teacher conference. Included will be the importance of having a working smoke detector in every home, having at least one fire extinguisher in the kitchen, and steps to take in case of a fire. The presentation will end with a question and answer session.

Implementation:

We propose initially offering the program at Anytown High School at the start of the next school year. A member from the fire prevention bureau, assisted by an engine company will be on hand to deliver the program. Interaction between the audience and team members will be strongly encouraged. Any Town Printing Company has agreed to produce informational handouts that team members will distribute to the participants at no cost as a public service. The instructional video can be purchased at a cost of $39.99. Video equipment from the school can be utilized in the presentation. Company officers on hand should be instructed to evaluate and make recommendations on ways to improve delivery and content.

Evaluation:

Immediate feedback will be obtained by members of audience filling out an evaluation form at the end of the program. Long-term results will be obtained from the incident reporting system in the area at one year intervals from the start of the program. It is our estimate that we can reach at least 90% of adolescents and 70% of parents in our target groups. Projected goals involving incidents of this nature should approach a 50% decrease in unattended cooking fires involving our target groups.


text:
Transwiki:Wikiversity-School of Fire and Emergency Management/Terrorism

Terrorism Training

While the eventual goal of this department will be to develop training materials and courses in the area of terrorism response, initially our focus is to develop "credible" resources on terrorist groups and begin building response materials from the international community.

 * Federation of American Scientists Terrorism site
 * Israeli EMS Resource
 * Lessons Learned from Cross-border Medical Response to the Terrorist Bombings in Tabba and Ras-el-Satan, Egypt, on 07 October 2004
 * Naval Graduate College's Terrorist Group Profiles
 * South Asia Terrorism Portal
 * Terrorism Research Center
 * United Nations Security Council Counter-Terrorism Committee
 * Wikipedia Resource on Terrorism


text:
Transwiki:Wikiversity-School of Fire and Emergency Management/Unattended Cooking and Teenagers Project Initiative

Unattended Cooking and Teenagers Project Initiative
Based on the summation given the target behavior is Unattended Cooking and the group would be teenagers. These Unattended Cooking fires are happening between the hours of 1500 and 1800 involving teenagers in the home.

The unchangeable condition is teenagers being unsupervised between 1500 and 1880 hours, while many parents are still at work or commuting. The commuting is usually by choice as families move out of the cities to escape crime or find more affordable housing. The changeable behavior is Unattended Cooking by teenagers. With an Informational Safety Program directed towards teenagers, hopefully the will modify or decrease the unwanted behavior. Another behavior change goal is to introduce teenagers, and all cooks, to a solution to the Unattended Cooking Fire problem. A patented automatic shut-off device, TimeOff, could prevent more than 90% of unattended cooking fires, if installed on all cooking ranges. Details, including contact information to order TimeOff from range manufacturers, can be found at: www.unattendedcooking.com

(I)	According to NFPA publications, Cooking fires are the # 1 cause of home fires and injuries, Most Cooking equipment fires start with the common ignition of household items (e.g., food or grease, cabinets, wall covering, paper or plastic bags, etc.). Also according Fact and Figures maintained by NFPA, the “trends” have been increasing as follows:

·In 2001, there were 117,100 reported home structure fires caused by Cooking equipment, thus resulting in 370 deaths, 4,290 injuries and caused $453.000 million dollars in property damage.

·The leading cause in Unattended Cooking in the home.

·Three out of ten reported home fires are in the kitchen. This is the most common place more than any other place.

·Two of three kitchen fires start with the range or oven.

·Electric ranges or stoves have a higher risk of fires, injuries and property damage, relative to usage, than gas oven or ranges.

·Gas ranges or stove have higher risk of death vs. electric stoves.

(II)According to research by the National Safety Council the following “trends” have occurred:

·Unattended Cooking remains the leading cause of home fires in the United States.

·There were 50,000 fires occurring each year in kitchen ovens and ranges.

·Nearly 75 % percent of reported homes fires, originated in the kitchen, and the person responsible was not in the immediate area.

·Nearly 30 % percent of al reported home fires started in the kitchen, and of those, the most frequent was the range-top.

(III)According to research of local and surrounding Fire District (Fort Lewis) of AnyTown Fire District there were 46 fires in the home. This varied from malfunction/misuse of electrical devices, building fires, structure fires other than building (candles etc.,) Cooking fires confined to original container (pot/pan), Coking fires with fire extension to cabinets and/or overhead hood systems, and general trash/ rubbish in the homes.

·16 fires were contributed to malfunction/misuse of electrical devices.

·2 fires were contributed to fires other in a structure or outside.

·15 fires were Unattended Cooking, confined to original container.

·5 fires were Unattended Cooking fire with fire extension to kitchen, cabinets and overhead hood systems.

·2 fires were contributed to general trash or rubbish confined to container.

Teenager Awareness Program
The Informational Awareness program related to Unattended Cooking fires involving Teenagers shall be given to all 6th – 8th graders during the month of October after Fire Prevention Week programs. This will be scheduled as a general School assembly in the gymnasium or auditorium during school hours. The students will be scheduled for a period of approximately 30 minutes of lecture and demonstration related to Safe Cooking practices by classroom. The Informational Awareness program will be scheduled daily with intervals through out the day until all 6th and 8th graders have attended the program.

(I)The movie will show how fast a fire can spread:

·Underwriter Laboratory – Fire safety Video named “The Living Room Fire”. Purchase price $105.00

·The video shows the ferocity of a single match that spread throughout a common lining room setting. The setting has common videotapes, CD’s and children’s’ toys which the fire is shown in real time with a running caption describing the events taking place.

(II)The demonstration will show safe practices for covering fires and show good cooking practices:

·Always keep a potholder, oven mitt and lid or larger pan/cookie sheet handy. In case a small fire start in a pan on the stove, put on an oven mitt and smother the flames by carefully sliding the lid over the pot/pan. Then turn off the burner. Call the Fire Dept to make sure the fire has not spread beyond the stovetop.

·Antidote: A person was cooking dinner and turned away for a few moments. He/she looked back, the pan was in flames. She put the fire out. The family dinner was ruined so they went out to dinner. When they returned home the street was filled with Fire trucks in front of their house.

About 20 minutes after leaving a neighbor had spotted their roof on fire.

It was determined the flames from the pan had extended into exhaust vent and subsequently ignited the roof.

 * Demand that your applliance store carry ranges equipped with the proper automatic TimeOff devices to prevent unattended cooking fires. Contact manufacturers to demand this also.  Contact details at:  www.unattendedcooking.com

·Never pour water onto a grease fire or spray fire extinguisher agent directly onto a pan, thus can cause overspray and spread the fire.

·Never leave cooking food on the stovetop unattended, and stay in the area while cooking. (Move phone, stereo’s, and may place small TV in kitchen).

·If you must answer the door etc., turn off the range and take a timer or oven mitt to remind you that something is still cooking.

·Keep the cooking area clean of debris (rags, food packaging, towels, etc.).

·Do not wear loose fitting clothing while cooking, roll up sleeves and/or wear tight fitting clothing.

·Never use a WET oven mitt, thus can cause scalding to hand and fingers.

·If there is an OVEN fire keep the oven door closed and shut of the heat to prevent flames spread. Call the Fire Dept to make sure the fire has not spread beyond the oven.

·If there is a microwave fires, keep the microwave door closed and unplug the microwave. Call the Fire Dept to make sure the fire has not spread beyond the microwave.

·Food cooked in the microwave can be extremely hot, use pot holder or place items on larger plate.

References: National Fire Protection Association National Safety Council Underwriter’s Laboratory – Fire Safety programs Local Fire District, Firehouse query of Home fires (Fort Lewis)


text:
Transwiki:Wikiversity-School of Fire and Emergency Management/Water Rescue Awareness

About the Open Source Learning Project

Awareness Level Water Search and Rescue

Cognitive Applications

Psychomotor Applications


text:
Fire and emergency management/Wildland fire fighter I

About the Open Source Learning Project

General

Human Resource Management

Preparedness

Mobilization

Suppression

Cognitive Applications

Psychomotor Applications


text:
Fire and emergency management/Wildland fire fighter I/General

Terminal Objectives
Identify the job performance requirements to become a Wildland Firefighter I Level (NFPA 1051 - 5.1.1)

Enabling Objectives
a) Identify the activities involved to ensure safe & effective fire suppression actions (NFPA 1051 - 5.3.1)

b) Identify the proper Personal Protective Equipment for the Wildland Firefighter (NFPA 1051 - 5.3.2)

c) Identify the proper use of the Personal Protective Equipment for Wildland Firefighting (NFPA 1051 - 5.3.2)

d) Identify the activities in control and extinguished a Wildland fire. (NFPA 1051 - 5.5.1)

e) Recognize the need for assembling & preparing for responses according to agency guidelines (NFPA 1051 - 5.5.2)

f) Demonstrate the methods of constructing firelines, tools, the needs of water or other suppression agents (NFPA 1051 - 5.5.4)

g) Demonstrate the methods of Securing firelines, equipment, suppression tools, water or other suppression agents (NFPA 1051 - 5.5.5)

h) Describe the methods of reducing fire exposure threats

i) Describe “Mopping up a fire Area” using suppression tools, and water or suppression agents and equipment.

j) Describe the method of “Patrolling the fire area” using suppression tools, and water or suppression agents and equipment.


text:
Basics of chemistry

Look around the room you’re in right now. In it you'll find solid objects like chairs, tables, lamps and an assortment of other solid objects. As you're reading this article and examining the room, you're dealing with gaseous materials, breathing them, smelling them or perhaps seeing clouds of gaseous materials. Finally, beside you, sitting in a cup or glass you probably have some kind of liquid to keep you refreshed as you review this material. All of the things we just examined, the solids, the gases and the liquids, all fall under the general category called, "Matter". The science of chemistry is the science of matter.

Matter is quite simple as you have hopefully seen. Matter is anything that is Solid (like your hand), Liquid (like your coffee, tea or water), or gas (the air you breath, steam from your tea pot, etc). If something can be classified as one of these three things, it is Matter. A more technically correct definition of matter is anything that has mass or takes up space.

The fact that matter can exist as a Solid, Liquid or Gas is referred to as its state. In other words, my hand exists in a solid state of matter while the air that I breath exists in a gaseous state of matter. This is a vital distinction because most matter (not all) can exist in all three states. Let’s take water for example. Water, at a standard room temperature of 20 degrees Celsius, is a liquid. This means it takes the shape of whatever container it's placed in and unlike a solid, presents very little resistance to objects being placed inside of it, so if I throw coins into a wishing well full of water, the coins will easily pass through the surface of the water and sink within it. These are the properties of water at 20 degrees Celsius. If we lower the temperature to -1 degree Celsius, the water reaches a point called the freezing point and freezes into a solid mass called ice. It has now become a solid. As a solid, it will no longer change its shape to whatever container it is placed in nor will it allow objects to enter it with very little resistance as before. Many of its physical properties have changed. If we now heat that ice to 101 degrees Celsius, the solid ice will melt into liquid water when the temperature rises above the melting point of water which is 0 degrees Celsius. When the temperature hits 100 degrees Celsius, the boiling point of water, the water will begin turning into a gaseous state called steam and will begin to float in the air as a cloud. Once again, some of its physical properties will have changed.

What we can draw from this is that most forms of matter share all three states of matter and change their state based on their freezing point, their melting point or their boiling point. In fact, although quite simplified, this is fairly accurate. All forms of matter have common properties among which, freezing point, melting point and boiling point exist. These properties usually vary considerably from other forms of matter. For example, the boiling point of Oxygen is -183 degrees Celsius and its melting point is at -210 degrees Celsius. Calcium on the other hand has a boiling point of 1484 degrees Celsius and its melting point is 839 degrees Celsius. The main thing to remember here is that most forms of matter can exist in any of the three states and that all forms of matter have properties in common that affect how the element of matter behaves.

So far we've been speaking in pretty familier terms, water, hands, tables and chairs, all of which are things we know well, but to understand chemistry, we have to start looking at things in extraordinarily smaller and simpler terms. Yes, surprisingly, chemistry deals in far simpler terms. To describe something as complicated as a hand or a wooden table in chemical terms, could take days just to break down the chemical composition. Chemistry deals with matter at the atom level. For a chemist, knowing that 64 grams of copper consists of 602 200 000 000 000 000 000 000 atoms is common knowledge. For a chemist, water is a chemical compound made up of 2 atoms of Hydrogen and one atom of Oxygen (H2O). Chemistry deals with the individual atoms that make up a substance or compound and the rules that govern the attraction, bonding and breakdown of the individual atoms that make up those same substances and compounds. Chemistry is at the core of how everything is made, where things come from and where they go.

化学とは

Asas-asas Kimia

title: Basics of chemistry


text:
Transwiki:Wikiversity-Matter and Measurements

Matter is everything. Matter constructs every object in the known universe, from individual atoms to the largest galaxies. Matter can be defined as anything that takes up space and has mass. Mass is very similar to a property of matter called Inertia (resistance to a change in motion), but for our purposes, it is a measurement of matter.

The vast majority of known matter comes in the form of atoms. Atoms are thus called the building block of the universe. An atom is the smallest unit of an element that still maintains the properties of that element. An element is pure substance made of only one type of atom. For example, the air around you is largely nitrogen gas. Nitrogen is an atom, and no two nitrogen atoms are distinguishable from one another. They have identical properties. They are thus the same element.


text:
Data structures/Transwiki Data Structures

Introduction
Computer scientists have created many ways to store data. For example, they have designed several ways to store a list. A computer might be able to look at the data in one kind of list very quickly. Another type of list might trade off retrieval speed for quick searches for a specific piece of data. These data structures, with their various tradeoffs, are the subject of this course.

It is important not to confuse data structures with object classes. Data structures are designed by computer scientists to tell the computer exactly how to physically organize and work with the data. Classes are combinations of data structures with algorithms working with these structures, designed by programmers to solve actual problems.

Pseudocode that is close to the Pascal programming language appears here. There are some examples of the code in other languages also.

Arrays
An array, in general, is a constant-sized sequential set of blocks, each block containing a value of the elected datatype. The use of arrays is integral in most high-level languages today. Versions of dynamic arrays exist, but this approach is usually costly, because arrays expanded into sizes larger than is available at the specific location where the array is stored, would require the copying of the entire array into an area large enough to hold the expanded array. For example, consider an array of 5 1-byte-long blocks, which sits at address 1000, and assume there is a variable X, 1 byte long, sitting at address 1007. Should you wish to extend your array to hold 10 blocks, you would need to copy the first 5 blocks to another location in order to accommodate the rest of the array. Another disadvantage of the sequential storage method is that there has to be a free sequential block large enough to hold the array. If you have an array of 500,000,000 blocks, each 1 byte long, you need to have roughly 500 megabytes of sequential space to be free; Sometimes this will require a defragmentation of the memory, which takes a long time.

Advantages of arrays include:
 * Random access in O(1) (See Big O notation (Wikipedia))
 * Ease of use: Integrated into most modern languages

Disadvantages include:
 * Constant size
 * Constant data-type
 * Large free sequential block to accommodate large arrays

Linked lists
One way to make a list of data in a certain order is to treat it like a chain. Each link in the chain tells you where its piece of data is and where the next link in the chain is.

Singly-linked lists
Let's make a linked list version of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] : class Node var int data var Node* next class List var Node* head := None function insert(data) head := new Node(data, head.next) function remove(data) var Node* current := head var Node* previous := None var boolean found := false while (current != None) and (found == False) if data == current.data found := True else previous := current current := current.next if found == True previous := current.next

This is called a singly-linked list, because each node has only a single link to the next node. You can only go along the list in one direction.

Special features:
 * You are required to keep a reference to the head node.
 * It is simple to think about and implement.
 * It is hard to make errors.
 * It is easy to figure out when you've gone through all the elements.

Efficiency features:
 * It needs little memory (two references per item).
 * It will quickly get to the items near the head of the list and the next item in the list.
 * It will slowly get to the items near the tail of the list and the previous item in the list.
 * It is slow at searching for a specific item.

A common optimization is to also keep a reference to the tail node. This allows new nodes to be quickly inserted at the end of the list.

Doubly-linked lists
Let's do the same thing with a small change:

class ListNode attr_accessor :prev_node, :item, :next_node # Add the next item in the list def insert(new_item) @next_node = ListNode.new @next_node.prev_node = self @next_node.item = new_item end def inspect "#{@item.inspect}, #{@next_node.inspect}" end end node = ListNode.new node.item = 0 (1..10).each do |item_to_add| node.insert item_to_add node = node.next_node end node = node.prev_node until node.prev_node.nil? puts "The list: #{node.inspect}." puts "The third item: #{node.next_node.next_node.item}."
 * 1) Move from the tail of the list to the head of the list.

This is called a doubly-linked list, because each node has links to both the previous and next nodes. You can go along the list in either direction.

Special features:
 * You are no longer required to keep a reference to the head node.
 * It is simple to think about and implement
 * Errors can easily be made when the next node doesn't believe that this is its previous node or the previous node disagrees that this is its next node.
 * It is easy to figure out when you've gone through all the elements.

Efficiency features:
 * It needs little memory (three references per item).
 * It will quickly get to the previous or next item in the list.
 * It will slowly get to items near the head or tail of the list.
 * It is slow at searching for a specific item.

Some common optimizations are to keep references to the head and tail nodes. This allows quick moves to either end of the list and quick insertions of new nodes at the end of the list.

Stacks
Stacks, as well as queues, are variations on the linked list. Stacks are also known as Last In First Out (LIFO) data structures, and this is indicative of their behavior. Simply put, when you put an item into a stack, generally called a 'push' operation, you are putting that element at the 'top' of the stack. When you remove an item from the stack, commonly known as a 'pop' operation, you're removing an element from the 'top' of the stack.

One common metaphor for a stack data structure is a vertical stack of dishes. The only feasible way to add a dish to the pile is to place it on top, and likewise, the only reasonable way to remove a dish is to remove it from the top.

An Example
Stack of numbers: (bottom) 2, 4, 9, 1, 3, 8 (top) When you remove the first item, you'll get an 8. Making the stack as follows: 2, 4, 9, 1, 3 Then when you "pop" the stack again, you'll get a 3, leaving the stack in this state: 2, 4, 9, 1 If you were then to add a 7 to the stack, 'pushing' it on, the stack would become: 2, 4, 9, 1, 7 and so on.

Real world use
Stacks are generally implemented such that pushing and popping operations can be performed very quickly, in constant time.

Binary Trees
Are quickly searched, but may become unbalanced as nodes are added and deleted.

B+ Trees
Are similar to Binary trees, but overcome the short-comings with the addition of self-balancing insert and delete functions.

Oct-trees
A number of other Tree data structures exist, in a variety of flavors.

Heaps
A heap is a data structure which implements the priority queue abstract data type. The most important operation a priority queue defines is the retrieval of an element with minimum (or maximum) value. This versatility of the heap stems from the fact that which of the maximum or minimum is at the root depends on the comparison function we provide the heap. The heap invariant is as follows: all children must have a greater (or lesser) value than their parents. This implies that the smallest (or largest) value must be located at the root. The heap facilitates this operation by moving the node of least (or most) value to the root of the heap after each insertion operation. This transformation is known as re-heapification.

Since a heap is equivalent to a balanced full binary tree, we can economize and represent it as a flat array. This has the advantage of allowing us to compute the child or parent of an arbitrary node given its index with a simple arithmetic expression, rendering explicit parent or child pointers unnecessary.

The re-heapify operation is bounded by the height of the tree, and movement through the tree is only in one direction. The worst case is when swaps have to be performed all the way from leaf to root, hence it is O(log n).

A heap can be used to implement heapsort, an optimal sorting algorithm, simply by inserting keys into the heap, then removing them one by one. Due to the heap invariant, as they are extracted they will be in sorted order.

class Heap attr_reader :heap def to_s @heap.to_s end def initialize @heap = Array.new @size = 0 end def <<(item) @heap << item @size += 1 reheapify_up end def pop ret = @heap[0] @heap[0] = @heap.pop reheapify_down @size -= 1 return ret end def size @size end def empty? @size == 0 end private def reheapify_up ptr = @heap.length - 1 while ptr > 0 if (@heap[parent_of(ptr)] <=> @heap[ptr]) > 0 swap(parent_of(ptr), ptr) end ptr = parent_of(ptr) end end def reheapify_down ptr = 0 while (2*ptr+1) < @heap.size kid = 2*ptr + 1 if kid < @heap.size-1 and @heap[kid] > @heap[kid+1] kid += 1 end if @heap[ptr] < @heap[kid] then break else swap(kid, ptr) ptr = kid end end end def parent_of(ind) (ind-1) / 2 end def swap(a, b)     @heap[a], @heap[b] = @heap[b], @heap[a] end end

Hash tables
In computer science, a hash table, or a hash map, is a data structure that associates keys with values. The primary operation it supports efficiently is a lookup: given a key (e.g. a person's name), find the corresponding value (e.g. that person's telephone number). It works by transforming the key using a hash function into a hash, a number that the hash table uses to locate the desired value.


text:
Operating system

The operating system (OS) is specialized computer software that allocates memory and manages system resources. When a computer is turned on, the OS is loaded into memory and works as an abstraction layer between the physical hardware and the software. While the Operating system doesn't perform a specific function it helps other programs run smoothly and efficiently. In this course you will learn about the structure and functionality of operating systems.

Due to the open nature of Wikiversity you are free to browse through these courses at whatever pace you desire. However, before you begin this course you should consider reviewing the material covered in the prerequisite courses (listed below) to ensure that you are prepared to learn this content.

In each lesson there is an objective at the top of the page, review these points and keep them in mind as you go through the lesson. At the end there is an assignment to test your understanding and further explain the material. Once you have finished the entire course you may move on to another course in the unofficial degree.

(Note: Many of these lessons are stubs, and they need a lot of help. Please excuse the mess - and help out if you can!).

Prerequisites
''Prerequisites are courses it is suggested you understand before you attempt this course. If you're having a hard time understanding the material in this course, make sure you understand these prerequisites first.''
 * Computer architecture

Lessons

 * 1) /Principles/
 * 2) /History/
 * 3) /Kernel models/
 * 4) /Operating Systems Structure/
 * 5) /Reality vs. Abstraction/
 * 6) /Boot Loader/
 * 7) /Virtual Memory/
 * 8) /Traps and Interrupts/
 * 9) /Multiprogramming/
 * 10) /File Systems/
 * 11) /Software Management/
 * 12) /Security Principles/

title: Operating system


text:
Compiler

Definition
A compiler is a program that reads source language and translates it into another language. Typically, a compiler reads source code, translates it into machine language, and writes the machine language to binary (object) code that can be directly loaded and executed. Common compiled languages include C and C++.

An interpreter is similar in that it is a program that reads source code one statement at a time, translates that statement to machine language, executes the machine language statement, then continues with the next statement. Common interpreted languages include Java and PHP.

BASIC is sometimes interpreted and sometimes compiled. Although less convenient for programming, compilers are much faster than interpreters.

Compiler Structure
A compiler consists of many phases, each phase consisting of some of steps. Each phase take input from previous phase (except the first phase, which takes its input from the source code created by a programmer).

The input for this phase is a source code file, the output is set of tokens. The input for this phase are set of tokens, the output is syntax tree. The input for this phase is syntax tree, the output is annotated tree. The input for this phase is annotated tree, the output is intermediate code. The input for this phase is intermediate code, the output is target code. The input for this phase is target code, the output is optimizing target code.
 * Scanner Phase (Lexical Analyzer)
 * Parser Phase (Syntax Analyzer)
 * Semantic Analyzer Phase
 * Source Code Optimizer Phase (Optional phase).
 * Code Generator Phase.
 * Target Code Optimizer Phase.

List of Compilers

 * List of Free Compilers and Interpreters...
 * Borland C++ BuilderX
 * Borland Delphi
 * Free Pascal
 * GCC the GNU Compiler Collection
 * Microsoft Visual C++ Compiler
 * Sun Java Developer Kit & Runtime Environment

title: Compiler


text: Discrete mathematics/Computability

title: Discrete mathematics/Computability


text:
Computer science projects

Research Projects
The purpose of this area is to have different pre-made research projects that computer science teachers may use. for studying in MSc computer science. project made in Asp.Net or java. please details of related language topic available to me.

Project 1 - Beginner Level
This project helps the student and the rest of the class learn the basics of various computer science related topics.

Requirements
The student must provide the following:
 * A history of the topic.
 * The future of the topic.
 * The present scenario of the topic
 * Examples of uses or the importance of the topic.
 * The presentation should be 5-15 minutes long.

Topics
ASP.NET or JAVA

title: Computer science projects


text:
Databases/Introduction/Transwiki Database

Databases are a way of storing data in order that it may be information within a context of both itself and external sources.

Types of Databases
There are several types of databases available :

 * Flat Databases
 * Relational Databases
 * Object Oriented Databases
 * Hierarchical Databases
 * Post-Relational Databases

Examples of Databases

 * 1) Flat Databases
 * 2) * Unix passwd/shadow and group/gshadow files
 * 3) Relational Databases
 * 4) * Firebird (http://www.firebirdsql.com/)
 * 5) * MySQL (http://www.mysql.com/products/)
 * 6) * PostgreSQL (http://www.postgresql.org/)
 * 7) * Oracle Database (http://www.oracle.com/database/)
 * 8) * Microsoft SQL Server (http://www.microsoft.com/sql/)
 * 9) Post-relational Databases
 * 10) * InterSystems Caché (http://www.InterSystems.com)

Database Programming Languages
Many people think that the programming languages used to access a database define what kind of database is used. This is not true.

For example,

SQL can be used to access information in both Relational Databases and in Post Relational Databases.

Caché ObjectScript can be used to access information in Object Oriented Databases, Hierarchical Databases, and Post-Relational Databases.

OQL can be used to access information in Object Oriented Databases.

OCL is part of the UML specification and allows the querying of objects that can be persisted in any form (for example, XML files and relational databases)

MUMPS can be used to access information in Hierarchical Databases, and Flat Databases.

Dbase can be used to access information in Flat Databases.

Database theory is hard to learn and needs an understanding of some mathematical theories to understand certain concepts.

External References

 * Borland Presentation on OCL


text:
School:Computer science/Course list

< Wikiversity

Welcome to Wikiversity's School of Computer Science! This school focuses on teaching computer science theory and programming, from basics to the advanced. Courses are laid out so that they build upon each other. Practical courses always build upon theory courses in the hierarchy.

If you're looking for reference materials, you may want to go straight to the Computer Science bookshelf, which contains the textbooks for the courses in the catalog, as well as additional reference materials.

New course organization
This is not a complete course list, new courses welcome. But if you don't have a course you really want to teach, please consider filling in an existing course.

Sort by:

Course

Category

Module

Programming Language

 * Web Programming
 * Prereqs: None
 * Languages needed: None, teaches a language
 * Goal: To teach Javascript, Perl, PHP, and other web-related programming languages and techniques.
 * Topics: Javascript, Perl, PHP, Subversion, Web Crawlers, etc
 * Level: Second

 * Intro to programming in C
 * Prereqs: None
 * Languages needed: None, teaches a language
 * Goal: To teach the basics of programming, C syntax, and basic guidelines for writing clear code.
 * Topics: C syntax, variables, boolean logic, arrays, loops, pointers, etc
 * Level: First

 * Intro to programming in C++
 * Prereqs: C programming
 * Languages needed: C at intermediate level
 * Goal: To teach the basics of programming, C++ syntax, and basic guidelines for writing clear code.
 * Topics: C++ syntax, variables, boolean logic, arrays, loops, pointers, etc
 * Level: First

 * Beginning Java
 * Prereqs: None
 * Languages needed: None, teaches a language
 * Goal: To teach the basics of programming, Java syntax, and basic guidelines for writing clear code.
 * Topics: Java syntax, variables, boolean logic, arrays, loops, references, etc
 * Level: First

 * Computer Architecture and Assembly
 * Prereqs: Computer Design and Operation
 * Languages Needed: Any high level language (C or C++ seem best)
 * Goal: To teach how to programs run on the hardware using assembly
 * Topics: RISC assembly, tradeoffs in processor design, optimization, caching, virtual-memory, I/O
 * Level: Third

Web-oriented

 * HTML and Website Creation
 * Prereqs: None
 * Languages needed: None, teaches a language
 * Goal: To teach the basics of HTML and CSS, methods to build and maintain websites, and the common tools used by websites to create Blogs, Forums, etc.
 * Topics: HTML, CSS, FTP, Blogs, Message Boards, Wikis, etc
 * Level: First

 * Web Programming
 * Prereqs: None
 * Languages needed: None, teaches a language
 * Goal: To teach Javascript, Perl, PHP, and other web-related programming languages and techniques.
 * Topics: Javascript, Perl, PHP, Subversion, Web Crawlers, etc
 * Level: Second

Computer Science-related Math

 * Introduction to Discrete Math
 * Prereqs: None
 * Languages needed: None
 * Goal: To teach some of the basic mathematic concepts behind programming and computer science
 * Topics: boolean logic, predicate calculus, sets, functions, induction, trees, graph theory
 * Category: Computer Science-related Math

 * Note: exact cutoff between Intro to DM and DM 2 needs to be determined

 * Discrete Math II
 * prereqs: Intro to Discrete Math
 * Languages needed: None
 * Goal: To teach more advanced topics in discrete math
 * Topics: combinatorics, infinite sets, Big-O theory, program verification
 * Level: Second

Algorithms

 * Data Structures and Algorithms
 * Prereqs: Intro to Programming (any language), Intro to Discrete Math
 * Languages needed: None, algorithms are in pseudocode, practical materials in multiple languages
 * Goal: To teach important algorithms and data structures, their use, and the tradeoffs in choosing them
 * Topics: Big-O notation, arrays, lists, trees, heaps, hash tables, sorting, search
 * Level: Second

Networking

 * Networks
 * prereqs: Data structures, Discrete Math II
 * Languages Needed: None
 * Goal: To teach a basic understanding of how networks work and developing network-related applications
 * Topics: network encapsulation, OSI model, TCP, UDP, IP, Ethernet, network configurations, bandwidth, roung trip times, efficiency, routing
 * Level: Third

 * Neural Networks
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: None
 * Goal: To teach the basics of neural networks and their applications
 * Topics: biological models, backpropogation, self-organizing maps, boltzmann machines, memory modeling
 * Level: Fourth

 * Network Programming
 * Prereqs: Networking, Data Structures
 * Languages needed: C,C++, or Java
 * Goal: To teach how to do network programming
 * Topics: BSD sockets, Winsock, Java sockets, IO efficiency, timing and other networking issues
 * Level: Fourth

 * Network Security
 * Prereqs: Network Programming
 * Languages needed: C,C++, or Java
 * Goal: To teach the various method to secure both a network, and information transfer across the network.
 * Topics:
 * Level: Fifth

Security

 * Network Security
 * Prereqs: Network Programming
 * Languages needed: C,C++, or Java
 * Goal: To teach the various method to secure both a network, and information transfer across the network.
 * Topics:
 * Level: Fifth

 * Security and Cryptography
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: None
 * Goal:
 * Topics:
 * Level: Fourth

Hardware and Machine Languages

 * Computer design and operation
 * Prereqs: Intro to Discrete Math
 * Languages Needed: None
 * Goal: To teach how computers and microchips work at a hardware level
 * Topics: boolean algebra, K-maps, AND, OR, NOT gates, flip flops, registers, muxes, demuxes, ALUs, cahces, ISAs, binary math
 * Level: Second

 * Computer Architecture and Assembly
 * Prereqs: Computer Design and Operation
 * Languages Needed: Any high level language (C or C++ seem best)
 * Goal: To teach how to programs run on the hardware using assembly
 * Topics: RISC assembly, tradeoffs in processor design, optimization, caching, virtual-memory, I/O
 * Level: Third

 * Advanced Computer Architecture
 * Prereqs: Computer Architecture and Assembly
 * Languages Needed: Any high level language (C or C++ seem best)
 * Goal: To teach computer architecture, the design process, and how it relates to both performance and price
 * Topics: Instruction set design (both CISC and RISC), instruction level parallelism, implementation, pipelining, interrupts, memory system design
 * Level: Fourth

Database

 * Databases
 * Prereqs: Data stuctures, Discrete Math II
 * Languages Needed: None
 * Goal: To teach how databases work
 * Topics:TO be fileld in, by someone who knows more than I.
 * Level: Third

Graphics

 * Graphics
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: ??
 * Goal: To teach basic 3D graphics
 * Topics: Vectors, angles, collision
 * Level: Third

Advanced Computer Science Courses

 * Programming Languages
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: None
 * Goal:
 * Topics:
 * Level: Third

 * Compilers
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: None
 * Goal: To teach how compilers and linkers work.
 * Topics: lexers, parsers, optimization
 * Level: Third

 * Operating Systems
 * Prereqs: Data structures, Discrete Math II
 * Languages Needed: C or C++ language (since you need direct hardware access) Taught on hardware simulator
 * Goal: To teach a basic understanding of OS internals
 * Topics: processes, scheduling, concurrency, resource allocation, deadlock, virtual memory, disk scheduling, security, transactions
 * Level: Fourth

 * Artificial Intelligence
 * Prereqs: Data stuctures, Discrete Math 2
 * Languages Needed: None
 * Goal:
 * Topics:
 * Level: Fourth

 * Advanced Operating Systems
 * Prereqs: Operating Systems
 * Languages needed: None
 * Goal: to teach how modern operaqting systems (Mac OS 9, Mac OS X, Windows, BSD, Linux, Plan9, Athena, Inferno) work and differ
 * Topics: microkernel vs macrokernel, ACLs vs group permissions, kernel +user mode apps vs Windows monolithic, Everything is a file vs not a file, API differences
 * Level: Fifth

 * Distributed Systems
 * Prereqs: Networking, Data Structures
 * Languages needed: C,C++, or Java
 * Goal: theories and principles of designing distributed applications
 * Topics: logical and vector clocks, atomic commits, rollback recovery, fault-tolerance
 * Level: Fifth

 * Automata Theory
 * prereqs: Discrete Math II
 * Languages Needed: None
 * Goal: To teach principles of modern computational theory
 * Topics: deterministic finite automata, non-deterministic finite automata, context-free grammars, push-down automata, Turing-machines, computability, space complexity
 * Level: Third

Old course organization links
This section is a series of links to the old course organization. Anyone writing a class based on the new organization should mine these for usable material first.

 * Basic Introduction to Ruby
 * Theory
 * Operating Systems
 * Databases
 * Networking
 * Compilers
 * Pervasive Computing
 * Computer Science Research Projects

title: School:Computer science/Course list


text:
Computer Forensics

A basic synopsis of the field of computer forensics, its importance, and the knowledge involved.

Goals
This course is designed to introduce the student to and familiarize the student with the basic concepts surrounding computer forensics. Topics that may (or may not) be covered include:

 * The scientific method
 * Investigating systems to determine whether anything illegal has been done
 * Investigation of storage devices
 * Hard disks
 * Compact disks
 * Solid state devices
 * Identify sources of evidence
 * Preserve evidence
 * Analyze evidence
 * Present the findings
 * Federal Rules of Evidence
 * Defeating countermeasures against forensic experts
 * Determining the level of expertise of a supposed criminal
 * Knowledge of how to shut down which machines
 * Encryption keys stored in RAM
 * Rules of evidence handling
 * Determining legal authority to seize, image, and examine each device
 * Sequence of examination

Prerequisites
Requirements might include basic computer knowledge and use. Programming knowledge is a plus but not, so far, a requirement.

Development Timeline
This course is under active development. I expect to (with all luck) have it completed by January of 2007, earlier if possible.

Enrollment
This course is still undergoing the early stages of development - if you would like to put your name down as "interested" you can do it here.

Feedback
Feedback is greatly appreciated and can be submitted via the talk page for the course or on my talk page.

Organization
Lectures will reference the Computer Forensics WikiBook (which I will create one of these days if nobody else gets to it first) and the wikibooks for the other topics at hand (cryptography, criminal justice, etc.)

title: Computer Forensics


text:
Introduction to C programming

Variable and Math

 * Variable
 * Simple math

Boolean logic and flow control
Reading: /Flow control/ Read all of section 1 (on ifs) except the part on bitwise operators. Section 2 will be covered later.

Lecture: Boolean Logic and If

Quiz: /Quizes/Boolean Logic/

Comments and readability
Reading: C Structure and Style

Lecture: Comments and Readability

Basic IO
Reading: Simple IO

Lecture: /BasicIO/

Loops
Reading: Understanding and Implementing Loops

Arrays
Let's look at the syntax for declaring an array. int examplearray[100]; /* This declares an array */ This would make an integer array with 100 slots (the places in which values of an array are stored). To access a specific part element of the array, you merely put the array name and, in brackets, an index number. This corresponds to a specific element of the array. The one trick is that the first index number, and thus the first element, is zero, and the last is the number of elements minus one. The indices for a 100 element array range from 0 to 99. Be careful not to "walk off the end" of the array by trying to access element 100!

What can you do with this simple knowledge? Let's say you want to store a string, because C has no built-in datatype for strings, you can make an array of characters.

For example: char astring[100];

will allow you to declare a char array of 100 elements, or slots. Then you can receive input into it from the user, and when the user types in a string, it will go in the array, the first character of the string will be at position 0, the second character at position 1, and so forth. It is relatively easy to work with strings in this way because it allows support for any size string you can imagine all stored in a single variable with each element in the string stored in an adjacent location--think about how hard it would be to store nearly arbitrary sized strings using simple variables that only store one value. Since we can write loops that increment integers, it's very easy to scan through a string:

Variable scope in function
A variable's scope limits where in the program you can access it. That's right, you can't always access every variable. There are 4 types of scope in the C language:

 * Global scope. These variables can be accessed anywhere in the program.  You should use these sparingly, if your program needs a lot of globals you are probably doing something wrong.  You can declare a global variable just by defining it in any file outside of any functions.  In any other file you want to use it, you need to use export type variable;
 * File scope. These variables can be accessed anywhere in the file its declared.  These are a bit better than global variables, but you should still try and minimize them.  You can declare one by declaring a variable at global scope with the static keyword.
 * Local scope. These variables can be accessed only within the nearest set of {}.  Any variable inside a set of {} (also know as inside of a block) are automaticly local scope.  Every time you go inside the block you create a new version of the variable.  The old value of the variable no longer exists.  These are the vast, vast majority of variables.
 * Static local scope. These variables are just like local scope, except they keep their value between times you enter a block.  You can declare one by creating a local variable with the static keyword.  These should be used sparingly, its extremely rare to see one of these.

Sometimes you may end up with two variables in different scopes with the same name (usually 1 file or global and 1 local). In that case, you end up getting the local variable, not the global one.

So, why does scope exist? Well, in a program you frequently want to call several things by the same name in different places. For example, a variable newBalance may exist in a checking program in the code where you withdraw money and where you deposit money. If all variables were global, you'd need two names. With local variables, you can use the same name for two different variables in two different blocks. Allowing you to reuse names like that makes it much easier to use good names. It also stops you from accidentaly accessing variables that other parts of the program may be using, because you unknowingly chose the same name.

void type
void type has 0 size and cannot be used as a type. The only time it's used is when doing pointer-type conversions. Note that, confusingly, when a void-pointer is accessed (ie. the value which should be void), a single byte is accessed (if possible). The main reason for not causing an error is probably that a void pointer is used for functions to move data, and constant conversions being written in the code, while not slowing it down, can obfuscate it, plus the void-pointer already stores an actual memory address to access.

title: Introduction to C programming


text:
Introduction to C programming/EnrollmentPage

This is a list of teachers, students, and (optionally) how to contact them. If you want to volunteer to teach the course, sign up under teachers. If you want to take it, sign up under students. If you are willing to be contacted via email, feel free to leave that as well.

Teachers

 * Anonymous Agent -- Anonymous Agent May 8th, 2024
 * gsechan@hotmail.com --Gabe Sechan 08:39, August 18, 2005 (UTC)
 * xerol@lggaming.com Xerol Oplan 16:23, 26 October 2005 (UTC)

Students

 * [mailto:babatundemuse@yahoo.co.uk Godhands]
 * Lazyquasar 06:12, 1 December 2005 (UTC) To contact Use Wikimedia Email Relay or drop a question on user talk page or at the School of Engineering Help Deskm:Wikiversity:School_of_Engineering:Help_Desk.
 * Ragpicker14
 * [mailto:c.ricketts@insightbb.com camyden]
 * Mathdude314
 * whizzer - just beginning this course
 * echalmers
 * Achin Jain - Do know C but need to refresh the whole stuff
 * Tekki -Just beginning.
 * [mailto:themacbryan@gmail.com Bryan]
 * [mailto:Jenniferpoole@earthlink.net Jenniferpoole]
 * Afir
 * NATnatic
 * [mailto:flockhound777@yahoo.com flockhound]


text:
Introduction to C programming/Forum

This is the wikiforums for Introduction to Progeramming in C. If you want to ask a question, please add it as a new section down below. If you want to reply either with an answer or a follow up question, please indent your reply by using :. Please sign your questions. Feel free to ask any question dealing with C programming, how to write programs, or the course lectures or book.

Sample Question
This is a sample question?

 * Yes, and this is a reply.

 * And this is a reply to the reply.

Calculator
When will you, please, write section on how to write a calculator? --193.77.234.116 17:49, 14 August 2006 (UTC)

For anything and everything about C Programming Tutorials, drive out here http://c-programming-tutorials.blogspot.com/

 * 1) I want Information in C program for LEX & YACC?

title: Introduction to C programming/Forum


text:
Introduction to C programming/Lectures/BooleanLogic

What is Boolean logic?
Boolean logic is a method for telling if an expression is true or false. Computers can use boolean logic to make decisions- it can do one thing if an expression is true, and another if its false. This is the only way that a computer can make a decision- any time the computer makes a choice, it does so off complex boolean logic expressions. Along with variables, boolean logic is the basis of programming.

A world of black and white
As I said, a program can do one thing if an expression is true, and another if its false. What happens if an expression is neither? Nothing- its not possible. The world of Boolean logic is black and white- something is either true or false. There is no maybe. This is the biggest transition a programmer needs to make when thinking in boolean logic. Erase the words "maybe" and "not sure" from your vocabulary now, they no longer exist.

Comparisons
If boolean logic can tell if a statement is true, what exactly is an "expression"? The only type of expression a computer can understand is a comparison. A computer can compare two numbers, and see if the first number is equal to, less than, or greater than the second number. The comparisons that are usable in C are as follows:

 * x==y is true if x and y are equal*
 * x!=y is true if x and y are not equal
 * xy is true if x is greater than y
 * x>=y is true if x is greater than or equal to y

* Note the difference between this and the single equals sign ( = ). The single equals is used for assignment and will not give you the desired results.

Combining expressions
Frequently, you won't want to just know if two values are equal- you want to know if these two values are equal and if another two are equal. Or if another two are not equal. Or some other combination. Well what do you know- you can do that! There are 3 operators you can use to combine expressions. Any combination of truth values you want to test for can be made by a combination of these operators.

AND
The AND operator works just like you'd think it does- it takes two expressions and checks if both of them are true. If they are, the AND of the two is true. If not, the AND is false. In C, an AND can be written as two ampersands (&&) and looks like this:

expression1 && expression2

OR
The OR operator is a little bit trickier. It becomes true if either of the expressions is true, or if both of them are true. Its only false if both of the expressions are false. This is a bit different from english, where or usually means one of the two, not both. In C, an OR is represented by two pipe symbols (||) and looks like this:

expression1 || expression2

NOT
NOT is the only operator that works on one expression instead of two. Its an inverse operator- it returns the opposite of the expression. If the expression is true it returns false, if its false it returns true. In C, a NOT can be written like this:

!expression1

Notice that the ! is also in the not equal comparison (!=). Thats an easy way to remember it.

Order of Operations
Its perfectly legal to chain as many ANDs, ORs, and NOTs as you want. For example, !(expression1 && (expression2 || expression3)) is perfectly legal. When you do this, the different parts of the chain are evaluated according to an order of operations, just like in math. The order of operation is NOT, AND, OR. Ties are done left to right. Also just like in math, you can use parenthesis to change the default order. For example,

a && b || c

This is true if a and b are true, or if c is true. If we change it to

a && (b || c)

This one is true if a and b are true, or if a and c are true. Notice the difference- in the first one, if a was false and c was true, the total value was true. Now it would be false. Be very careful of bugs like this. When in doubt, throw parenthesis everywhere.

Variables and comparisons
You don't have to compare only numbers. You can also compare either a variable and a number (for example- x<7), or two variables (for example, x>y). When you compare a variable to something, what you really do is compare the value of the variable to either a number or another variable's value.

If statements
Well thats fun, but how does C allow you to make a decision? You use an if statement. An if statement allows a program to run a series of lines if and only if a condition is true. An if statement looks like this:

if(condition){ statement 1; statement 2; }

where condition is a boolean expression of some sort.

Anything inside the {} block will only happen if condition is true. If its false, they aren't executed. You can have as many statements in the block as you want.

Else clauses
Sometimes you don't want to just do soemthing if a condition is true. Sometimes you want to do one thing if its true, and another if its false. An else statement looks like this:

if(condition){ statement 1; } else{ statement 2; }

Anything inside the first {} happens if the condition is true, and the code inside the second block happens if it is false.

Else if statements
Occasionally, you need something a little more complex than 2 options. In that case, you need an else if.

if(condition 1){ statement 1; } else if(condition 2){ statement 2; } else if(condition 3){ statement 3; } else{ statment 4; }

If condition 1 is true, statement 1 is executed and none of the other statements are. If condition 1 is false and condition 2 is true, statement 2 is run. If conditions 1 and 2 are both false and condition 3 is true, statement 3 is run. If all 3 conditions are false, statement 4 is run. You can have as many else if parts as you want. And you don't need to have an else at the very end if you don't want to.

Switch statements
Switch statements are a quick way of writing large else if statements where you're checking the value of a single variable. For example, if you want to do different things depending if a variable is 1, 2, 3, 4, or 5, a switch statement can be used. A switch statement works like this:

switch(variable){ case value1: statement1; break; case value2: statement2; break; case value3: statement3; break; }

If the value of variable is value1, statement 1 is executed. If its value 2, statement 2 is. And so on.

Notice the word break; at the end of each case. This is actually important- if you don't put it in, you'll execute the next case as well. This can actually be useful- if you want to do the same thing for 2 values, you can go:

case value1: case value2: statement1; break;

Here, if the variable is value1 or value 2, you'll execute statment 1. Be careful of your breaks, leaving one out by mistake is an easy bug to make. Even experienced pros make this one every once in a while.

Boolean type
There's actually a boolean type in C. You can declare a variable of type bool, who's only legal values are TRUE and FALSE. You can use this to store true/false info in a program.

The value of true and false
So, since everything in computers is a number, what values do true and false have? False is always 0, true is anything else. You can actually use an integer as a condition in an if statement. If the value is not zero, the if would be true, if its 0 the if is false. You'll see a lot of code, especially older code, using this feature.