PETITIONER: M.C. MEHTA Vs. RESPONDENT: UNION OF INDIA & ORS. DATE OF JUDGMENT12/01/1988 BENCH: VENKATARAMIAH, E.S. (J) BENCH: VENKATARAMIAH, E.S. (J) SINGH, K.N. (J) CITATION: 1988 AIR 1115 1988 SCR (2) 530 1988 SCC (1) 471 JT 1988 (1) 69 ACT: In re. control, prevention and abatement of pollution of Ganga water-In Kanpur, U.P.-Responsibility of the municipal body in respect thereof. HEADNOTE: % This Court in M.C. Mehta v. Union of India & ors., [1987] 4 S.C.C. 463 had issued certain directions with regard to the industries in which the business of tanning was being carried on near Kanpur on the banks of the River Ganga. On that occasion, the Court had directed that the case in respect of the municipal bodies and the industries which were responsible for the pollution of the water in the river Ganga would be taken up next, and accordingly, the Court took up for consideration this case against the Kanpur Nagar Mahapalika, since it was found that Kanpur was one of the biggest cities on the banks of the river Ganga. Under the laws governing the local bodies, the nagar Mahapalikas and Municipal Boards were primarily responsible for the maintenance of cleanliness in the areas under their jurisdiction and the protection of their environments. Under the water (Prevention and Control of Pollution) Act, 1974 (the 'Water Act') provisions had been made for the establishment of Boards for the prevention and control of water pollution, etc. The Environment (Protection) Act, 1986, contained provisions relating to the control, prevention and abatement of pollution of water. Although Parliament and the State Legislature had thus enacted laws, imposing duties on the Central and State Boards and the municipalities for the prevention and control of pollution of water, no adequate action had been taken pursuant to many of their provisions. 274.50 million litres a day of sewage water was being discharged into the river Ganga from the city of Kanpur, which was the highest in the State of U.P. Sewer cleaning had never been done systematically in Kanpur, and there was mal-functioning and choking of the city sewerage. Pollution of water in the river Ganga was of the highest degree at Kanpur, and a large extent of misery, sickness and death due to infectious diseases arose out of water supplies. The petitioner filed this writ petition as a Public Interest Litigation against the public nuisance 531 caused by the serious pollution of the river Ganga, for protecting the lives of the people using the Ganga water. Disposing of the petition, the Court, ^ HELD: The petitioner before the Court was no doubt not a riparian owner. He was a person interested in protecting the lives of the people who made use of the water flowing in the river Ganga and his right to maintain the petition could not be disputed. The nuisance caused by the pollution was a public nuisance, wide-spread in range and indiscriminate in its effect, and it would not be reasonable to expect any particular person to take proceedings to stop it as distinct from the community at large. The petition was entertained as a Public Interest Litigation. On the facts and in the circumstances of the case, the Court was of the view that the petitioner was entitled to move the Court in order to enforce the statutory provisions which imposed duties on the municipal authorities and the Boards under the water Act, on account of failure of which to obey the statutory duties for several years, the water in the River Ganga at Kanpur had become so much polluted that it could no longer be used by the people for drinking or bathing. The Nagar Mahapalika of Kanpur had to bear the major responsibility for the pollution of the river near the Kanpur city. The construction of certain works, undertaken under the Ganga Action Plan at Kanpur to improve the sewerage system and prevent pollution of the water in the river Ganga, were going on at a snail's pace. The Court expected the authorities concerned would complete those works within the target dates mentioned in their counter-affidavits. The Court noticed that the Kanpur Nagar Mahapalika had not yet submitted its proposals for sewage treatment works to the State Board constituted under Water Act, and directed that the mahapalika should submit its proposals to the State Board within six months (from the date of this judgment). [551H; 552A-F] The Court further directed; (i) The Kanpur Nagar Mahapalika should take action under the provisions of the Uttar Pradesh Nagar Mahapalika Adhiniyam, 1959, or the relevant bye-laws made thereunder to prevent pollution of the water in the river Ganga by waste accumulated at the large number of dairies in Kanpur having about 80,000 cattle. The dairies might either be shifted outside the city so that the waste at the dairies did not ultimately reach the river Ganga, or, in the alternative, the Mahapalika might arrange for the removal of the waste by motor vehicles, in which 532 event the owners of the diaries could not claim any compensation. The Mahapalika should immediately take action to prevent collection of manure at private manure pits inside the city; [552G-H; 553A] (ii) The Kanpur Nagar Mahapalika should take immediate steps to increase the size of the sewers in the labour colonies, so 13 that sewage might be carried smoothly through the sewerage system, and wherever sewerage line was not yet constructed, steps should be taken to lay it; [553B] (iii) Immediate action should also be taken by the Kanpur Nagar Mahapalika to construct sufficient number of public latrines and urinals to prevent defecation by people on the open land. The proposal to levy any charge for use of such latrines and urinals shall be dropped as that would be a reason for poor people not to use the public latrines and urinals. The cost of maintenance of cleanliness of those latrines and urinals had to be borne by the Mahapalika. [553C] The Court was of the view that since the problem of pollution of the water in the river Ganga had become very acute, the High Court should not ordinarily grant stay of criminal proceedings in cases where the Board constituted under the Water Act initiated any proceedings to prosecute industrialists or other persons who polluted the water in the Ganga, as the stay orders on petitions under section 482 of the Code of Criminal Procedure, 1973, frustrated the attempt of the Board to enforce the provisions of the Water Act, and further, even if such an order of stay was made in any extraordinary case, the High Court should dispose of the case within a short period, say about two months from the date of the institution of the case, and further, should take up for hearing all the cases where such orders had been issued under section P 482, Cr.P.C., staying prosecutions under the Water Act. [553E-G] The Court further directed that the practice of throwing corpses and semi-burnt corpses into the river Ganga should be immediately brought to an end. Steps should be taken by the Kanpur Nagar Mahapalika and the police authorities to ensure that the dead bodies or G- half-burnt bodies were not thrown into the river Ganga. [553H; 554A] In future j application for licences to establish new industries should be refused unless adequate provision had been made for the treatment of trade effluents flowing out of the factories, and immediate action should be taken against the existing industries found responsible for the pollution of water. [554B] 533 Having regard to the grave consequences of the Pollution of water and air and need for protecting and improving the natural environment, considered to be one of the fundamental duties under the Constitution, it was the duty of the Central Government to direct all the educational institutions throughout India to teach at least for one hour in a week lessons on the protection and improvement of the natural environment including forests, lakes, rivers and wild life in the first ten classes. The Central Government should get the text books written for the said purpose and distributed to the educational institutions free of cost. Training of teachers, who teach this subject, by the introduction of short term courses for such training shall also be considered. This should be done throughout India. [554C-E] The above directions of the Court would apply mutatis mutandis to all the other Mahapalikas and Municipalities, having jurisdiction over the areas through which the river Ganga flows.[555C] JUDGMENT:
OBSERVATION: The children should be taught about the need for maintaining cleanliness, of the houses both inside and outside and of the streets in which they live. Clean surroundings lead to healthy body and healthy mind. [554E] In order to rouse amongst the people the consciousness of cleanliness of environments, the Government of India and the Governments of the States and the Union Territories may consider the desirability of organising 'keep the city clean' week (Nagar Nirmalikarana Saptaha) and 'keep the village clean' week (Gram Nirmalikarana Saptaha) in every city, town and village throughout India at least once a year. During that week, the entire city, town or village should be kept, as far as possible, clean tidy and free from pollution of land, water and air. The organisation of the week should be entrusted to the Nagar Mahapalikas, Town Municipalities, Municipal Corporation, Village Panchayats or such other authorities, having jurisdiction over the area in question. If the authorities decide to organise such a week it may not be celebrated in the same week throughout India but may be staggered depending upon the convenience of the particular city, town or village. During that week, all the citizens, including the members of the executive, Parliament, State Legislatures and Judiciary may be requested to co-operate with the local authorities and take part in the celebrations by rendering free personal service. This would surely create a national awareness of the problems faced by the people by the appalling allround deterioration of the environment which is witnessed today. [554FM; 555A-B] 534 M.C. Mehta v. Union of India & others, [1987] 4 S.C.C. 463 and Pride of Derby and Derbyshire Angling Association v. British Celanese Limited, [1953] Chancery 149.
ORIGINAL JURISDICTION: Writ Petition No. 3727 of 1985. (Under Article 32 of the Constitution of India.) Petitioner-in-person .
B. Datta, Additional Solictor General, R.K. Jain, Vinod Bobde, R.N. Trivedi, K.N. Bhat, Tapash Ray, B.R.L. Iyenger R.P. Singh, R.P. Kapur, Ravinder Narain, S. Sukumaran, C.B. Singh, S.K. Dhingra, P.K. Jain, D.N. Goburdhan, Arvind Kumar, Ms. Laxmi Arvind, Vineet Kumar, Deepak K. Thakur, T.V. S. N. Chari, Ms. Vrinda Grover, Badri Nath, Rakesh Khanna, Mukul Mudgal, A.K. Ghose, M.M. Gangadeb, Probir Mirtra, Sushil Kumar Jain, Saryakant, Pappy T. Mathews, Mrs, Mamta Kachhawaha, Mrs. Shobha Dikshit, G.S. Misra, S.R. Srivastava, Parijat Sinha, R. Mohan, Ms. .Bina Gupta, Ranjit Kumar, Krishna Kumar, R.C. Verma, Arun Minocha, Sri Narain, E.C. Agrawala, S.R. Setia, H.K. Puri, T.S. Rana, Pramod Swarup, Ashok Grover, S. Markandeya, Swarup. Ms, Lalita Kohli, K.C. Dua, Rajbirbal, R.A. Gupta and Ms. A. Subhashini for the Respondents.
The Judgment of the Court was delivered by VENKATARAMIAH, J. By our judgment dated September 22, 1987 in M.C. Mehta v. Union of India & others, [1987] 4 S.C.C. 463, we issued certain directions with regard to the industries in which the business of tanning was being carried on at Jajmau near Kanpur on the banks of the river Ganga. On that occasion we directed that the case in respect of the municipal bodies and the industries which were responsible for the pollution of the water in the river Ganga would be taken up for consideration on the next date of hearing. Accordingly, we took up for consideration first the case against the municipal bodies. Since it was found that Kanpur was one of the biggest cities on the banks of the river Ganga, we took up for consideration the case in respect of the Kanpur Nagar Mahapalika.
The Kanpur Nagar Mahapalika is established under the provisions of the Uttar Pradesh Nagar Mahapalika Adhiniyam, 1959 (hereinafter referred to as 'the Adhiniyam'). Sub- section (3) of section 535 1 of the Adhiniyam, which is to be found in its 1st Chapter, provides that the 1st Chapter of the Adhiniyam shall come into operation at once and the remaining provisions in relation to a city shall come into operation from such date as the State Government may by notification in the official Gazette appoint in that behalf and different dates may be appointed for different provisions. In exercise of the powers conferred by the said sub-section and in continuation of a notification dated September 28, 1959 bringing into operation sections 579 and 580 of the Adhiniyam, the Governor of Uttar Pradesh was pleased to issue a notification dated January 18, 1960 appointing the 1st day of February, 1960 as the date on which the remaining provisions of the Adhiniyam and the three Schedules, appended thereto, would come into operation in relation to the cities of Kanpur, Allahabad, Varanasi, Agra and Lucknow, as constituted under section 3 of the Adhiniyam. The duties and powers of the Mahapalika and Mahapalika authorities are set out in Chapter V of the Adhiniyam. Clauses (iii), (vii) and (viii) of section 114 of the Adhiniyam, which incorporates the obligatory duties of the Mahapalika, read as follows:
"114. Obligatory duties of the Mahapalika-It shall be incumbent on the Mahapalika to make reasonable and adequate provision, by any means or measures which it is lawfully competent to it to use or to take, for each of the following matters, namely,-
. . .. . . .. ... . .. .. . . . .. . . .. ..... ..
(iii) the collection and removal of sewage, offensive matter and rubbish and treatment and disposal thereof including establishing and maintaining farm or factory;
...................................................
(vii) the management and maintenance of all Mahapalika waterworks and the construction or acquisition of new works necessary for a sufficient supply of water for public and private purposes;
(viii) guarding from pollution water used for human consumption and preventing polluted water from being so used;
..............................................."536
Sections 251, 388, 396, 297, 398, 405, and 407 of the Adhiniyam read as follows:
"251. Provision of means for disposal of sewage- The Mukhya Nagar Adhikari may, for the purpose of receiving, treating, storing, disinfecting, distributing or otherwise disposing of sewage, construct any work within or without the City or purchase or take on lease any land, building, engine, material or apparatus either within or without the City or enter into any arrangement with any person for any period not exceeding twenty years for the removal or disposal of sewage within or without the City. .............. ... . .... ........... .. ... .. ..
388. Provision may be made by Mukhya Nagar Adhikari for collection, etc., of excrementitious and polluted matter-(1) The Mukhya Nagar Adhikari may give public notice of his intention to provide, in such portion of the City as he may specify, for the collection, removal and disposal by Mahapalika agency, of all excrementitious and polluted matter from privies, urinals, and cess- pools, and thereupon it shall be the duty of the Mukhya Nagar Adhikari to take measures for the daily collection, removal and disposal of such matter from all premises situated in such portion of the City.
(2) In any such portion as is mentioned in sub-section (1) and in any premises, wherever situated, in which there is a water-closet or privy connected with a mahapalika drain, it shall not be lawful, except with the written permission of the Mukhya Nagar Adhikari, for any person who is not employed by or on behalf of the Mukhya Nagar Adhikari to discharge any of the duties of scavengers.
.................................................
396. Removal of carcasses of dead animals-(I) It shall be the duty of the Mukhya Nagar Adhikari to provide for the removal of the carcasses of all animals dying within the City.
(2) The occupier of any premises in or upon which 537 any animal shall die or in or upon which the carcass of any animal shall be found, and the person having the charge of any animal which dies in the street or in any open place shall, within three hours after the death of such animal or. if the death occurs at night within three hours after sunrise. report the death of such animal at the nearest office of the Mahapalika Health Department.
(3) For every carcass removed by mahapalika agency, whether from any private premises or from public street or place, a fee for the removal of such amount as shall be fixed by the Mukhya Nagar Adhikari shall be paid by the owner of the animal, or, if the owner is not known. by the occupier of the premises in or upon which, or by the person in whose charge, the said animal died.
397. Prohibition of cultivation, use of manure, irrigation injurious to health-If the Director of Medical and Health Services or the Civil Surgeon or the Nagar Swasthya Adhikari certifies that the cultivation of any description of crops or the use of any kind of manure or the irrigation of land in any specified manner-
(a) in a place within the limits of a City is injurious or facilitates practices which are injurious to the health of persons dwelling in the neighbourhood, or
(b) in a place within or beyond the limits of a City is likely to contaminate the water-supply of such City or otherwise render it unfit for drinking purpose, the Mukhya Nagar Adhikari may by public notice prohibit the cultivation of such crop, the use of such manure or the use of the method of irrigation so reported to be injurious, or impose such conditions with respect thereto as may prevent the injury or contamination:
Provided that when, on any land in respect of which such notice is issued, the act prohibited has been practised in the ordinary course of husbandry for the five successive years next preceding the date of prohibition, compensation shall be paid from the Mahapalika Fund to all persons interested therein for damage caused to them by such prohibition.538
398. Power to require owners to clear away noxious vegetation-The Mukhya Nagar Adhikari may, by notice. require the owner or occupier of any land to clear away and remove any vegetation or undergrowth which may be injurious to health or offensive to the neighbourhood.
.................................................
405. Power to require removal of nuisance arising from tanks, etc.- The Mukhya Nagar Adhikari may by notice require the owner or occupier of any land or building to cleanse, repair, cover, fill up or drain off a private well, tank, reservoir. pool, depression or excavation therein which may appear to the Mukhiya Nagar Adhikari to be injurious to health or offensive to the neighbourhood:
Provided that the owner or occupier may require the Mukhya Nagar Adhikari to acquire at the expense of the Mahapalika or otherwise provide, any land or rights in land necessary for the purpose of effecting drainage ordered under this section
407. Any place may at any time be inspected for purpose of preventing spread of dangerous disease-The Mukhya Nagar Adhikari may at any time, by day or day night, without notice or after giving such notice of his intention as shall in the circumstances, appear to him to be reasonable, inspect any place in which any dangerous disease is reputed or suspected to exist, and take such mea sures as he shall think fit to prevent the spread of the said disease beyond such place. "
The above provisions deal with the specific duties of the Nagar Mahapalika or the Mukhya Nagar . Adhikari appointed under the Adhiniyam with regard to the disposal of sewage and protection of the environment in or around the City to which the Adhiniyam applies. There are almost similar provisions in sections 7, 189, 19 l and other provisions of the Uttar Pradesh Municipalities Act, 1916 which applies to the smaller municipal bodies. The Uttar Pradesh Water Supply and Sewerage Act, 1975 imposes statutory duties on the authorities mentioned therein regarding the provision of water supply to the cities and towns and construction of sewerage systems in them. The perusal of these provisions in the laws governing the local bodies shows that the 539 Nagar Mahapalikas and the Minicipal Boards are primarily responsible for the maintenance of cleanliness in the areas under their jurisdiction and the protection of their environment. We have, in the judgment delivered by us on September 22, 1987, briefly referred to the Water (Prevention and Control of Pollution) Act, 1974 (Act No. 6 of 1974) (hereinafter referred to as 'the Water Act') in which provisions have been made for the establishment of the Boards for the prevention and control of water pollution, for conferring on and assigning to such Boards powers and functions relating thereto and for matters connected therewith.
(e) 'pollution' means such contamination of water or such alteration of the physical, chemical or biological properties of water or such discharge of any sewage or treade effluent or of any other liquid, gaseous or solid substance into water (whether directly or indirectly) as may or is likely to, create a nuisance or render such water harmful or injurious to public health or safety, or to domestic, commercial, industrial, agricultural or other legitimate uses, or to the life and health of animals or plants or of acquatic organisms;
. . . . . .... . . . . . . . . . . . .. . .. .. .
(g) 'sewage effluent' means effluent from any sewerage system or sewage disposal works and includes sullage from open drains;
(gg) 'sewer' means any conduit pipe or channel, open or closed, carrying sewage or trade effluent;
. . . . . . .. ... . .. .. . .. ....... .. . .
(j) 'stream' includes-
(i) river;540
(ii) water course (whether flowing or for the time being dry);
(iii) inland water (whether natural or artificial);
(iv) sub-terranean waters;
(v) sea or tidal waters to such extent or, as the case may be, to such point as the State may, by notification in the official Gazette, specify in this behalf;
(k) 'trade effluent' includes any liquid, gaseous or solid substance which is discharged from any premises used for carrying on any trade or industry, other than domestic sewage . "
Section 3 and 4 of the Water Act provide for the constitution of the Central Board and State Boards respectively. A State Board has been constituted under section 4 of the Water Act in the State of Uttar Pradesh. Section 16 of the Water Act sets out the functions of the Central Board and section 17 of the Water Act lays down the functions of the State Board. The functions of the Central Board are primarily advisory and supervisory in character. The Central Board is also required to advise the Central Government on any matter concerning the prevention and control of water pollution and to co-ordinate the activities of the State Boards. The Central Board is also required to provide technical assistance and guidance to the State Boards, carry out and sponsor investigations and research relating to problems of water pollution and prevention, control or abatement of water pollution. The functions of the State Board are more comprehensive. In addition to advising the State Government on any matter concerning the prevention, control or abatement of water pollution, the State Board is required among other things (i) to plan a comprehensive programme for the prevention, control or abatement of pollution of streams and wells in the State and to secure the execution thereof, (ii) to collect and disseminate information relating to water pollution and the prevention, control or abatement thereof; (iii) to encourage, conduct and participate in investigations and research relating to problems of water pollution and prevention, control or abatement of water pollution; (iv) to inspect sewage or trade effluents, works and plants for the treatment of sewage and trade effluents; (v) to review plans, specifications or other data relating to plants set up for the treatment of 541 water, works for the purification thereof and the system for the disposal of sewage or trade effluents or in connection with the grant of any consent as required by the Water Act;
(vi) to evolve economical and reliable methods of treatment of sewage and trade effluents, having regard to the peculiar conditions of soils, climate and water resources of different regions and more especially the prevailing flow characteristics of water in streams and wells which render it impossible to attain even the minimum degree of dilution; and (vii) to lay down standards of treatment of sewage and trade effluents to be discharged into any particular stream taking into account the minimum fair weather dilution available in that stream and the tolerance limits of pollution permissible in the water of the stream, after the discharge of such effluents. The State Board has been given- certain executive powers to implement the provisions of the Water Act. Sections 20, 21 and 23 of the Water Act confer power on the State Board to obtain information necessary for the implementation of the provisions of the Water Act, to take samples of effluents and to analyse them and to follow the procedure prescribed in connection therewith and the power of entry and inspection for the purpose of enforcing the provisions of the Water Act. Section 24 of the Water Act prohibits the use of stream or well for disposal of polluting matters etc. contrary to the provisions incorporated in that section. Section 32 of the Water Act confers the power on the State Board to take certain emergency measures in case of pollution of stream or well. Where it is apprehended by a Board that the water in any stream or well is likely to be polluted by reason of the disposal of any matter therein or of any likely disposal of any matter therein, or otherwise, the Board may under section 33 of the Water Act make an application to a court not inferior to that of a Presidency Magistrate or a Magistrate of the first class, for restraining the person who is likely to cause such pollution from so causing.
The Environment (Protection) Act, 1986, which has also been referred to in out earlier judgment, also contains certain provisions relating to the control, prevention and abatement of pollution of water and one significant provision in that Act is what is contained in section 17 thereof, which provides that where an offence under that Act is committed by any Department of Government, the Head of that Department shall be deemed to be guilty of the offence and is liable to be punished.
It is unfortunate that although Parliament and the State Legislature have enacted the aforesaid laws imposing duties on the Central and State Boards and the municipalities for prevention and control of 542 pollution of water, many of those provisions have just remained on paper without any adequate action being taken pursuant thereto. After the above petition was filed and notice was sent to the Uttar Pradesh State Board constituted under the Water Act, an affidavit has been filed before this Court by Dr.- G.N. Misra, Scientific officer of the U.P. Pollution Control Board setting out the information which the Board was able to collect regarding the measures taken by the several local bodies and also by the U.P. Pollution Control Board in order to prevent the pollution of the water flowing in the river Ganga. A copy of the report relating to the inspection made at Kanpur on 23.11.87/24.11.87 by Shri Tanzar Ullah Khan, Assistant Environmental Engineer and Shri A.K. Tiwari, Junior Engineer enclosed to- the counter- affidavit as Exhibit K-5 reads thus:
"The inspection made on 23.11.87/24.1.87 alongwith Sri A.K. Tiwari, Junior Engineer. Following are the facts observed at the time of inspection.
1. Kanpur town is situated on the southern bank of river Ganges.
2. The present population of the town is approximately 20 lacs.
3. The city is covered with piped water supply.
4. The city has developed between river Ganges on the north side and river Pandu on the south side. G.T. Road divides the city into two halves.
In the north side most of the area is covered by sewerage system and the sullage/sewage is discharged without treatment into river Ganges through 17 nalas including sewerage by-pass channel at Jajmau.
In the south side there is no sewerage system and the sewage/sullage are discharged without treatment into river Pandu through 5 nalas. River Pandu joins river Ganges near Fatehpur(Sketch enclosed).
5. The Kanpur Nagar mahapalika has not yet submitted any proposal of sewage treatment works to the Board.543
6. Mr. Ikramur Rahman, A.E. Nagar Mahapalika told the Kanpur town is covered under Ganga Action Plan and following are the proposals-
(A) U. P. Jal Nigam (1) Re-modelling of sewage pumping station at Jajmau and improvement to sewage farm.
(2) Nala Tapping.
(3) Sewage Treatment Plant.
(B) Kanpur Jal Sansthan (1) Cleaning of Trunk and main sewers. (C) Integrated Environmental and sanitary Engineer project is being executed under the Dutch Assistance in Jajmau Area.
(1) Crash Programme (is to remove deficiencies in the existing sanitary facilities) (2) Laying of Industrial sewer.
(3) U.A.S.B. Sewage Treatment Plant.
Sd/ Sd/ A.K.TIWARI (TANZAR ULLAH KHAN) J.E. ASSTT. ENVIRONMENTAL ENGINEER."
Appendix A/1 to 'An Action Plan for Prevention of Pollution of the Ganga' gives the following particulars relating to the quantity of sewerage generated in the City of Kanpur which is discharged into the river Ganga and other relevant matters:
KANPUR Population Estimated water Estimated sewage Treatment in 1981 supply in 1981 generated (70% of the water supply to the city 544 ..........................................................
16.39 lacks 392.14 million 274.50 million Nil litres a day litres a day ..........................................................
It is thus seen that 274.50 million litres a day of sewage water is being discharged into the river Ganga from the city of Kanpur, which is the highest in the State of Uttar Pradesh and next only to the city of Calcutta which discharges 580. 17 million litres a day of sewage water into the river Ganga. Para 4 of the affidavit filed by Shri Jai Shanker Tewari, Executive engineer of Kanpur Nagar Mahapalika reads thus:
"4. That the pollution in river Ganga from Kanpur is occurring because of following reasons:
(i) About 16 nalas collecting sullage water, sewage, textile waste, power plant waste and tannery effluents used to be discharged without any treatment into the river. However some Nalas have been trapped now.
(ii) The dairies located in the city have a cattle population of about 80.000. The dung, fodder waste and other refuse from this cattle population is quantitatively more than the sullage from the city of human population of over 20 lakhs. All this finds its way into the sewerage system and the nalas in the rainy season. It has also totally choked many branches of sewers and trunk sewers resulting in the overflow of the system.
(iii) The night soil collected from the unsewered areas of the city and thrown into the nalas.
(iv) There are more than 80 tanneries in Jajmau whose effluent used to be directly discharged into the river.
(v) The total water supply in Kanpur is about 55 mil lion gallons per day. After use major part of it goes down the drains, nalas and sewers; sewage is taken to Jajmau sewage pumping station and a part of it is being supplied to sewage farms after diluting it with raw ganges water and the remaining part is discharged into the river.
(vi) Dhobi Ghats.
(vii) Defecation by economically weaker sections."545
The affidavit further states that the U.P. Jal Nigam, the U.P. Water Pollution Control Board, the National Environmental Engineering Research Institute, the Central Leather Research Institute, the Kanpur Nagar Mahapalika, the Kanpur Development Authority and the Kanpur Jal Sansthan have started taking action to minimise the pollution of the river Ganga. It is also stated therein that the financial assistance is being provided by the Central Ganga Authority through Ganga Project Directorate, State Government, the World Bank, the Dutch Government etc. for implementing the said measures. The said affidavit gives information about the several works undertaken at Kanpur for minimising the pollution of the river Ganga. It also states that Rs.493.63 lacs had been spent on those works between the years 1985 and 1987 and that the total allocation of funds by the Central Ganga Authority for Kanpur is Rs.3694.94 lacs and that upto the end of the current financial year it is proposed to spend Rs.785.58 lacs (1985 to 1987-88) towards various schemes to be completed under Ganga Action Plan. The affidavit points out that in Kanpur City sewer cleaning has never been done systematically and in a planned way except that some sewers were cleaned by the U.P. Jal Nigam around 1970. The main reasons for mal-functioning and choking of the city sewerage, according to the affidavit, are (i) throwing or discharging of solids, clothes, plastics, metals etc. into the sewerage system; (ii) throwing of cow dung from dairies which are located in every part of the city which consists of about 80,000 cattle; (iii) laying of under-sized sewers specially in labour colonies; (iv) throwing of solid wastes and malba from construction of buildings into sewers through manholes; (v) non-availability of mechanical equipment for sewer cleaning works; and (vi) shortage of funds for proper maintenance. It is asserted that the discharge of untreated effluents into the river Ganga will be stopped upto 80% by March, 1988.
Shri M.C. Mehta, the petitioner herein, drew our attention to the Progress Report of the Ganges Action Plan (July 1986-January 1987) prepared by the Industrial Toxicology Research Centre, Council of Scientific & Industrial Research. At page 20 of the said report the details of the analysis of the Ganga water samples collected during August, 1986 to January, 1987 from Uttar Pradesh region are furnished. That report shows that the pollution of the water in the river Ganga is of the highest degree at Kanpur. The Ganga water samples taken at Kanpur show that the water in the river Ganga at Kanpur consisted of 29.200 units (mg/ml) of iron in the month of August, 1986 when the ISI limit for river water is 0.3 and 0.900 (mg/ml) of manganese whereas the WHO limit of manganese for drinking water is 546 0.05. The Progress Report for the period February 1987-June. 1987 of Microlevel Intensive Monitoring of Ganga under Ganga Action Plan describes the samples of the water taken from the river Ganga at Kanpur thus:
"B.O.D. (Bio oxygen Demand) values are found to be higher than prescribed values of l.S.I. C.O.D. (Chemical oxygen Demand) values are also found to be higher. These values clearly indicate that river water is not fit for drinking, fishing and bathing purposes.
Table II further shows that Total Coliform and Fecal Coliform bacteria are always found very high. This is due to disposal of large quantity of untreated municipal waste into river Ganga. These high values of bacteria indicate that water is not fit for drinking, bathing and fishing purpose.
To improve quality of water in Ganga, all nullahs should be trapped immediately and raw water should be treated conventionally at water works and disinfected by chlorination "
(underlining by us) In the concluding part of the said Progress Report it is stated thus:
"The Ganga is grossly polluted at Kanpur. All nullahs are discharging the polluted waste water into river Ganga. But Jajmau by pass channel, Sismau, Muir Mill, Golf Club and Gupta Ghat nullah are discharging huge quantities of polluted waste water, To improve the water quality of Ganga all major nullahs should be diverted and treated. Combined treatment should be provided for Jajmau tanneries. Effluent treatment plants should be installed by all major polluting industries."
It is needless to say that in the tropical developing countries a large amount of misery, sickness and death due to infectious diseases arises out of water supplies. In Lall's Commentaries on Water and Air Pollution Laws (2nd Edition) at pages 331 and 333 it is observed thus:
"In the tropics, we cannot safely take such a limited 547 view. Such Water-borne diseases as malaria, schistosomiasis, guinea worm and yellow fever are either terrible scourges of, or threats to, many tropical populations. The hazards from bad water are thus much greater. Poverty is much more serious for many tropical areas; in the rural areas-where most people live-and around the edges of the cities, which are the fastest-growing communities. most people cannot afford a conventionally good water supply at present, and the choice in the short run may be between doing nothing and providing somewhat improved supply. If an ideal water system is not possible, there are options as to what needs should be met by the partial improvements. To make the right decisions we need again the broad picture of water-related diseases. So, because of these two tropical characteristics-warmth and poverty-a wider view than in temperate lands is necessary.(p.331) . .. . .. . .. ... ..... .. .... . . .. .. .. . . Water-borne diseases-The classical water- borne diseases are due to highly infective organisms where only rather few are needed to infect someone, relative to the levels of pollution that readily occur. The two chief ones have a high mortality if untreated and are diseases which a community is very anxious to escape: Typhoid and cholera. Both are relatively fragile organisms whose sole reservoir is man.
These two diseases occur most dramatically as the 'common source out-break where a community water supply gets contaminated by faeces from d person suffering from, or carrying, one of the infections. Many people drink the water and a number of these fall ill from the infection at about the same time.
Typhoid is the most cosmopolitan of the classical water-borne infections. In man it produces a severe high fever with generated systemic, more than intestinal, symptoms. The bacteria are ingested and very few are sufficient to infect. The typhoid patient is usually too ill to go out polluting the water and is not infective prior o falling sick. However, a small proportion of those who recover clinically continue to pass typhoid bacteria in their faeces for 548 months or years; these carriers are the source of water borne infections. Gallstones predispose to the carrier state as the bacteria persist in the inflamed gall bladder. In the tropics, lesions of Schistosoma haematobium in the bladder also act as nide of infection, producing urinary typhoid carriers, whilst rectal schistosomiasis combined with typhoid leads to a persistent sever fever lasting many months. Typhoid bacteria survive well in water but do not multiply there.
Cholera is in some ways similar to typhoid, but its causative bacteria are more fragile and the clinical course is extremely dramatic. In classical cholera the onset of diarrhoea is sudden and its volume immense so that the untreated victim has a high probability of dying from dehydration within 24 hours or little more.
Several other infections are water borne but are less important than typhoid and cholera. Leptospirosis, due to a spirochaete, has its reservoir in wild rodents which pollute the water.
Leptospis can penetrate the skin as well as being ingested. They produce jaundice and fever, called .Weil's disease, which is severe but not common. ' The amount of suffering which the members of the public are likely to undergo by using highly polluted water can be easily gathered from the above extract.
In the book entitled 'Water Pollution and disposal of Waste Water on Land' (1983) by U.N. Mahida. I.S.E. (Retd) the problem of water pollution, the benefits of control of pollution and the urgency of the problem have been dealt with. At pages l, 2, 4 and S of the said book it is observed thus:
"As long as the human population was small and communities were scattered over large areas of land, the disposal of human wastes created no problems. People could defecate in areas surrounding villages and other habitations and leave it to nature to dispose of the waste by assimilation in the surrounding land and air. But as communities became more concentrated and villages and towns grew, such a mode of disposal by natural agencies came to be replaced by organised disposal, though again through 549 the agency of natural land and soil columns. The collection of human excreta and its disposal in earthen trenches was resorted to by many towns and adopted the basket privy system.
The introduction of a system of water-borne sewage created new problems in the disposal of human wastes, as now along with the earlier problem of getting rid of solid wastes, i.e., human excreta, the problem of the disposal of the water employed for the removal of human wastes had also to be faced. This was the origin of the problem of sewage disposal. At first, the natural instinct was to channelize the sewage-the soiled water-to natural streams and rivers. For a time this mode of disposal was even considered quite efficacious. Such methods did not create difficulties as sewage discharges were small as compared to the stream flow. But with the increased discharge of progressively large quantities of sewage, polluted streams became a serious menace to public health.
NATURE OF THE PROBLEM The introduction of modern water carriage systems transferred the sewage disposal from the streets and the surroundings of townships to neighbouring streams and rivers. This was the beginning of the problem of water pollution. It is ironic that man, from the earliest times, has tended to dispose of his wastes in the very streams and rivers from which most of his drinking water is drawn. Until quite recently this was not much of a problem, but with rapid urbanisation and industrialisation, the problem of the pollution of natural waters is reaching alarming proportions.
The most disturbing feature of this mode of disposal is that those who cause water pollution are seldom the people who suffer from it. Cities and industries discharge their untreated or only partially treated sewage and industrial waste waters into neighbouring streams and thereby remove waste matter from their own neighbourhood. But in doing so, they create intense pollution in streams and rivers and expose the downstream riparian population to dangerously unhygienic conditions. In addition to the with-550
drawal of water for downstream towns and cities, in many developing countries, numerous villages and riparian agricultural population generally rely on streams and rivers for drinking water for themselves and their cattle, for cooking, bathing, washing and numerous other uses. It is thus riparian population that specially needs protection from the growing menace of water pollution. (pages 1 and 2) ................................................. BENEFITS OF CONTROL The benefits which result from the prevention of water pollution include a general improvement in the standard of health of the population, the possibility of restoring stream waters to their original beneficial state and rendering them fit as sources of water supply, and the maintenance of clean and healthy surroundings which would then offer attractive recreational facilities. Such measures would also restore fish and other aquatic life.
Apart from its menace to health, polluted water considerably reduces the water resources of a nation. Since the total amount of a country's utilisable water remains essentially the same and the demand for water is always increasing, schemes for the prevention of water pollution should, wherever possible, make the best use of treated waste waters either in industry or agriculture. Very often such processes may also result in other benefits in addition to mere reuse. The application of effluents on agricultural land supplies not only much needed water to growing crops but also manurial ingredients; the recovery of commercially valuable ingredients during the treatment of industrial waste waters often yields by-products which may to some extent offset the cost of treatment If appropriate financial credits could be calculated in respect of these and other incidental benefits, it would be apparent that measures for the prevention of pollution are not unduly costly and are within the reach of all nations, advanced or developing. It is fortunate that people are be coming more receptive to the idea of sharing the financial burden for lessening pollution. It is now recognised in most 551 countries that it is the responsibility of industries to treat their trade wastes in such a way that they do not deteriorate the quality of the receiving waters, which otherwise would make the utilisation of such polluted waters very difficult or costly for downstream settlers. URGENCY OF THE PROBLEM The crucial question is not whether developing countries can afford such measures for the control of water pollution but it is whether they can afford to neglect them. The importance of the latter is emphasised by the fact that in the absence of adequate measures for the prevention or control of water pollution, a nation would eventually be confronted with far more onerous burdens to secure wholesome and adequate supplies of water for different purposes. If developing countries embark on suitable pollution prevention policies during the initial stages of their industrialisation, they can avoid the costly mistakes committed in the past by many developed countries. It is, however, unfortunate that the importance of controlling pollution is generally not realised until considerable damage has already been done; (Pages 3 and 4)"
In common law the Municipal Corporation can be restrained by an injunction in an action brought by a reparian owner who has suffered on account of the pollution of the water in a river caused by the Corporation by discharging into the river insufficiently treated sewage from discharging such sewage into the river. In Pride of Derby and Derbyshire Angling Association v. British Celanese Ltd., [19531 Chancery 149 the second defendant, the Derby Corporation admitted that it had polluted the plaintiff's fishery in the River Derwent by discharging into it insufficiently treated sewage, but claimed that by the Derby Corporation Act, 1901 it was under a duty to provide a sewerage system, and that the system which had accordingly been provided had become inadequate solely from the increase in the population of Derby. The Court of Appeal held that it was not inevitable that the work constructed under the Act of 1901 should cause a nuisance, and that in any case the Act on its true construction did not authorise the commission of a nuisance. The petitioner in the case before us is no doubt not a riparian owner. He is a person interested in protecting the lives of the people who make use of the water flowing in the river Ganga and his right to maintain the petition cannot be dis-
552puted. The nuisance caused by the pollution of the river Ganga is a public nuisance, which is wide spread in range and indiscriminate in its effect and it would not be reasonable to expect any particular person lo take proceedings to stop it as distinct from the community at large. The petition has been entertained as a Public Interest Litigation. On the facts and in the circumstances of the case we are of the view that the Petitioner is entitled to move this Court in order to enforce the statutory provisions which impose duties on the municipal authorities and the Boards constituted under the Water Act. We have already set out the relevant provisions of the statute which impose those duties on the authorities concerned. On account of their failure to obey the statutory duties for several years the water in the river Ganga at Kanpur has become so much polluted that it can no longer be used by the people either for drinking or for bathing. The Nagar Mahapalika of Kanpur has to bear the major responsibility for the pollution of the river near Kanpur city.
It is no doubt true that the construction of certain works has been undertaken under the Ganga Action Plan at Kanpur in order to improve the sewerage system and to prevent pollution of the water in the river Ganga. But as we see from the affidavit filed on behalf of the authorities concerned in this case the works are going on at a snail's pace. We find from the affidavits filed on behalf of the Kanpur Nagar Mahapalika that certain target dates have been fixed for the completion of the works already undertaken. We expect the authorities concerned to complete those works within the target dates mentioned in the counter-affidavit and not to delay the completion of the works beyond those dates. It is, however, noticed that the Kanpur Nagar Mahapalika has not yet submitted its proposals for sewage treatment works to the State Board constituted under the Water Act. The Kanpur Nagar Mahapalika should submit its proposals to the State Board within six months from today.
It is seen that there is a large number of dairies in Kanpur in which there are about 80,000 cattle. The Kanpur Nagar Mahapalika should take action under the provisions of the Adhiniyam or the relevant bye-laws made thereunder to prevent the pollution of the water in the river Ganga on account of the waste accumulated at the dairies. The Kanpur Nagar Mahapalika may either direct the dairies to be shifted to a place outside the city so that the waste accumulated at the dairies does not ultimately reach the river Ganga or in the alternative it may arrange for the removal of such waste by employing motor vehicles to transport such waste from the existing dairies in which even 553 the owners of the dairies cannot claim any compensation. The Kanpur Nagar Mahapalika should immediately take action to prevent the collection of manure at private manure pits inside the city.
The Kanpur Nagar Mahapalika should take immediate steps to increase the size of the sewers in the labour colonies so that the sewage may be carried smoothly through the sewerage system. Wherever sewerage line is not yet constructed steps should be taken to lay it.
Immediate action should also be taken by the Kanpur Nagar Mahapalika to construct sufficient number of public latrines and urinals for the use of the poor people in order to prevent defecation by them on open land. The proposal to levy any charge for making use of such latrines and urinals shall be dropped as that would be a reason for the poor people not using the public latrines and urinals. The cost of maintenance of cleanliness of those latrines and urinals has to be borne by the Kanpur Nagar Mahapalika.
It is submitted before us that whenever the Board constituted under the Water Act initiates any proceedings to prosecute industrialists or other persons who pollute the water in the river Ganga, the persons accused of the offences immediately institute petitions under section 482 of the Code of Criminal Procedure 1973 in the High Court and obtain stay orders thus frustrating the attempt of the Board to enforce the provisions of the Water Act. They have not placed before us the facts of any particular case. We are, however, of the view that since the problem of pollution of the water in the river Ganga has become very acute the High Courts should not ordinarily grant orders of stay of criminal proceedings in such cases and even if such an order of stay is made in any extra-ordinary case the High Courts should dispose of the case within a short period, say about two months, from the date of the institution of such case. We request the High Courts to take up for hearing all the cases where such orders have been issued under sections 482 of the Code of Criminal Procedure, 1973 staying prosecutions under the Water Act within two months. The counsel for the Board constituted under the Water Act shall furnish a list of such cases to the Registrar of the concerned High Court for appropriate action being taken thereon.
One other aspect to which our attention has been drawn is the practice of throwing corpses and semi-burnt corpses into the river Ganga. This practice should be immediately brought to an end. The co-operation of the people and police should be sought in enforcing 554 this restriction. Steps shall be taken by the Kanpur Nagar Mahapalika and the Police authorities to ensure that dead bodies or half burnt bodies are not thrown into the river Ganga.
Whenever applications for licences to establish new industries are made in future, such applications shall be refused unless adequate provision has been made for the treatment of trade effuents flowing out of the factories. immediate action should be taken against the existing industries if they are found responsible tor pollution of water.
Having regard to the grave consequences of the pollution of water and air and the need for protecting and improving the natural environment which is considered to be one of the fundamental duties under the Constitution [vide Clause (g) of Article 51A of the Constitution] we are of the view that it is the duty of the Central Government to direct all the educational institutions throughout India to teach atleast for one hour in a week lessons relating to the protection and the improvement of the natural environment including forests, lakes, L) livers and wild life in the first ten classes. The Central Government shall get text books written for the said purpose and distribute them to the educational institutions free of cost. Children should be taught about the need for maintaining cleanliness commencing with the cleanliness of the house both inside and outside, and of the streets in which they live. Clean surroundings lead to healthy body and healthy mind. Training of teachers who teach this subject by the introduction of short term courses for such training shall also be considered. This should be done throughout India.
In order to rouse amongst the people the consciousness of cleanliness of environment the Government of India and the Governments 1. Of the States and of the Union Territories may consider the desirability of organising 'Keep the city clean' week (Nagar Nirrnalikarana Saptaha), 'Keep the town clean week (Pura Nirmalikarana saptaha) and 'Keep the village clean week (Grama Nirmalikarna Saptaha) in every city, town and village throughout India at least once a year. During that week the entire city, town or village should be kept as far as possible clean, tidy and free from pollution of land, water and air. The organisation of the week should be entrusted to the Nagar Mahapalikas, Municipal Corporations, Town Municipalities, Village Panchayats or such other local authorities having jurisdiction over the area in question. If the-authorities decide to organise such a week it may not be celebrated in the same week throughout India but may he staggered depending upon the convenience of the particular city, town 555 or village. During that week all the citizens including the members of the executive, members of Parliament and the State Legislatures, members of the judiciary may be requested to co-operate with the local authorities and to take part in the celebrations by rendering free personal service. This would surely create a national awareness of the problems faced by the people by the appalling all-round deterioration of the environment which we are witnessing today. We request the Ministry of Environment of the Government of India to give a serious consideration to the above suggestion.
What we have stated above applies mutatis mutandis to all other Mahapalikas and Municipalities which have jurisdiction over the areas through which the river Ganga flows. Copies of this judgment shall be sent to all such Nagar Mahapalikas and Municipalities. The case against the Nagar Mahapalikas and Municipalities in the state of Uttar Pradesh shall stand adjourned by six months. Within that time all the Nagar Mahapalikas and Municipalities in the State of Uttar Pradesh through whose areas the river Ganga flows shall file affidavits in this Court explaining the various steps they have taken for the prevention of pollution of the water in the river Ganga in the light of the above judgment. The case as against the several industries in the State of Uttar Pradesh which are located on the banks of the river Ganga will he taken up for hearing on the 9th of February, 1988.
S . L. Petition disposed of.
556


Govt needs to read UK vaping study
by Alt New ZealandGovt needs to read UK vaping study
“Compelling research out of the UK reaffirms vaping’s life-saving role. Here’s hoping our Government’s pending legislation reflects vaping’s increasingly documented health benefits for smokers,” say Ben Pryor, co-owner of the largest Kiwi-owned vape company, Alt New Zealand.
His comments follow University of Dundee researchers confirming that switching from cigarettes to vaping quickly improves blood vessel function, with the large clinical trial showing a clear and early benefit for smokers.
In fact, the study found long-term smokers who switched to vaping were halfway towards achieving the vascular health of a non-smoker within just a month, suggesting that vaping has the potential to reduce heart attack and stroke risk.
“Global science continues to prove vaping is considerably safer than cigarettes and brings many quick wins for smokers. As a country we need to pull out all the stops to make sure Kiwi smokers have every opportunity to successfully quit. Our best chance is to simply retain vaping’s appeal and accessibility for adults hooked on tobacco,” says Mr Pryor.
The vaping entrepreneur has long supported the introduction of high manufacturing and product quality standards. However, he says the availability of vape flavours, responsible R18 marketing, retail displays, and ‘comparable’ nicotine levels must be retained if the Government wants deadly smoking rates and tobacco sales in New Zealand to continue to fall.
Associate Health Minister Jenny Salesa is set to introduce the Smoke-free Environments (Vaping) Amendment Bill into Parliament soon. Concerns are growing that the Government could move to treat vaping more like smoking, despite the significant role it has played as New Zealand’s most effective smoking cessation tool.
He says the Government needs to reflect on what’s happening in the top three countries that New Zealand likes to benchmark itself against.
“In Australia, which maintains heavy vaping restrictions, smoking rates have not fallen in recent years, unlike us. In the US where various vaping bans are now in place, studies show smoking rates are back on the rise. While in the UK, many smokers are successfully switching to vaping, thanks to the UK’s progressive regulatory regime and positive public health attitude.”
Ben Pryor says despite recent coverage, mostly out of the US as a result of illicitly produced and sourced products, our Government must keep an eye on the prize and reaffirm the country’s goal: A Smoke-Free New Zealand.
Ends


save_strips_ws.lua |
|
|---|---|
|
By default Textadept's strips off trailing whitespace from all lines. This is a good thing, especially if you are using version control. To avoid moving the caret when you have just carefully found your position in some deeply nested code, this extension saves your position and by enabling virtual space keeps the cursor's position. If another key is pressed the necessary spaces are inserted again. To see what is going on enable view whitespace. |
|
|
Variable to save the current column. |
local saved_col
|
|
Save position before saving. |
events.connect('file_before_save',
function()
local buffer = buffer
saved_col = buffer.column[buffer.current_pos]
end, 1)
|
|
Go in virtual space to position the cursor was at before saving. |
events.connect('file_after_save',
function()
local buffer = buffer
if saved_col > 0 then
virtual_space = buffer.virtual_space_options
buffer.virtual_space_options = 2
local col = buffer.column[buffer.current_pos]
local diff = saved_col - col
if diff > 0 then
for i=1, diff do
buffer:char_right()
end
end
buffer.virtual_space_options = virtual_space
end
end)
|


Interesting Links #9
17 Feb 2014- PostgreSQL 9.4 - What I was hoping for - HStore 2 would actually be useful
- Compiling in the background for a smoother user experience - sound great, so does the new profiling visualization tool
- Don't Repeat your Mistakes: Conducting Post-mortems - really good to have a formal process for this
- 3 User experience improving JavaScript libraries you should know about - Drop.js seems quite nice.
- Good engineering managers aren't just hard to find - they don't exist - "people who want the engineering manager role are unlikely to be very good at it; and those who could be good at it don’t want anything to do with it at all"


| Transform
Time Series
|
|
| Multiple time series
can be selected and each selected time series is standardized or
transformed. For standardization the user can use any of the following four standardization types:
1. Gaussian: The rank ordering function from the sample
marginal distribution to marginal Gaussian distribution is applied.
For transformation, there are four types: The first of the four transforms attempts to make the magnitudes of the time series Gaussian while the other three transforms aim to reduce non-stationarity of the time series. First differences or logarithm of first differences, as well as polynomial detrending, aims at removing the slow drifts in the time series. Lag differences may be used to reduce the effect of periodicity if the selected lag matches the period of the cycle in the data. |
|
| Select one or more time series ... |
|
| Multiple time series names can be selected from this list. This can be done by standard use of the mouse: a click on the first name and Shift^click on the last name selects all names between the first and the last name; a click on the first name and subsequent Ctrl^clicks on other names select these names including the first name; Ctrl^a selects the whole list. | |
| Standardization types |
|
| Any of the four
standardization types, or even all standardization types (along with
selected transformation types) can be
selected. The standardization types are briefly explained below. Gaussian : A rank ordering function from the sample marginal distribution to marginal Gaussian distribution is applied. Let x(i), i = 1,...,N, the selected time series. The position plotting transform estimates the marginal cumulative density function (cdf) as F(x(i)) = ((i)-0.326)/(N+0.348), where (i) is the order of x(i) in the N sample of the time series. Then the Gaussian standardization transform reads y(i) = Ö-1(F(x(i)), where Ö-1 is the inverse marginal Gaussian cdf. Uniform : A rank ordering function from the sample marginal distribution to marginal Uniform distribution is applied. Let x(i), i = 1,...,N, the selected time series. The position plotting transform estimates the marginal cumulative density function (cdf) as F(x(i)) = ((i)-0.326)/(N+0.348), where (i) is the order of x(i) in the N sample of the time series. Then the Unifrom standardization transform reads y(i) = F(x(i). Linear [0,1] : The samples of the time series are linearly transformed so that the minimum is transformed to 0 and the maximum to 1. Let xmin and xmax the minimum and maximum of the time series x(i), i = 1,...,N. Then the Linear standardization transform reads y(i) = (x(i) - xmin) / (xmax - xmin). Normalized (or z-score) : The samples of the time series are transformed linearly so that they have mean zero and standard deviation 1. Let m and SD the mean and standard deviation of the samples of the time series x(i), i = 1,...,N. Then the Normalized standardization transform reads y(i) = (x(i) - m) / SD. |
|
| Transformation types |
|
| Any of the four
transformation types, or even all transformation types (along with
selected standardization types) can be
selected. The transformation types are briefly explained below. Log-difference: This transform takes the first differences of the natural logarithms of the time series. If the time series contains negative value(s) then the logarithm transform is applied as y(i)=log(x(i)-xmin+1), for each value x(i) of a given time series, where xmin is the minimum value of the time series. Then the transform reads y(i)-y(i-1). Box Cox : This is the Box Cox power transform and requires a parameter lambda. The transform is (x(i)^lambda-1)/lambda if lambda is not zero, and log(x(i)-xmin+1) if lambda is zero, where xmin is the minimum value of the time series. For the lambda parameter the user can give multiple values (according to the standard matlab format for forming arrays) and then the time series is transformed with the Box Cox formula for each lambda value. Differencing : The transform of differencing for a given order (lag) t is defined as x(i)-x(i-t) (for t=1 this is the common first difference). For the order parameter the user can give multiple values (according to the standard matlab format for forming arrays) and then equally many differenced time series are obtained for each order. Detrend : This is the detrending of the time series with a polynomial. First a polynomial of a given degree is fitted to the time series and then the fitted values are subtracted from the corresponding values of the time series. For the polynomial degree parameter the user can give multiple values (according to the standard matlab format for forming arrays) and then equally many detrended time series are obtained for each polynomial degree. |
|
| OK |
|
| By pressing this button, the standardizations of the selected time series starts and when it is completed the window is closed. | |
| Cancel |
|
| The window is closed without segmenting any time series. | |
| Help |
|
| This page is displayed. |


Loading…
Where do you think these photos were taken?
Click on the map and submit your guess to find out!
PicMap
HOME
LEADERBOARD
Submit Guess
Next round
New Game
Round:
Score:
Round:
Next round
Your name:
Add Score to Leaderboard!
New Game


| File Name |
Brief Description |
Page Number(s) |
Tags |
| bolassoDemo |
Reproduce figures 1,2,3 from Bolasso: Model Consistent Lasso Estimation |
422 |
** |
| groupLassoDemo |
Demonstrate group lasso |
433 |
|
| icaBasisDemo |
Apply ICA to natural image patches and visualize basis functions |
453 |
* |
| lassoPathProstate |
Plot the full L1 regularization path for the prostate data set |
419, 420 |
|
| linregFitL1Test |
Linear Regression L1 Fit Test |
429 |
|
| linregPolyLassoDemo |
lasso on polynomial regression |
418 |
|
| linregPolyVsDegree |
Linear Regression with Polynomial Basis of different degrees |
8, 20, 418 |
|
| normalGammaPenaltyPlotDemo |
Plot contours of penalty(w1) + penalty(w2), where penalty(w) = -log p(w) |
442 |
|
| normalGammaThresholdPlotDemo |
Visualize soft thresholding behavior of different log priors |
443 |
|
| prostateComparison |
Compare L1, L2, allSubsets, and OLS linear regression on the prostate data set |
418 |
|
| prostateSubsets |
Reproduce fig 3.5 on p56 of "Elements of statistical learning" |
409 |
|
| ridgePathProstate |
Plot the full L2 regularization path for the prostate data set |
419 |
|
| sparseDictDemo |
Learn a sparse dictionary from image patches |
453 |
* |
| sparsePostPlot |
Code for Plotting Gauss, Laplace and "Very Sparse" Prior and Posterior |
441 |
* |
| sparseSensingDemo |
Figure 1 from Figueiredo'07, "Gradient projection for sparse reconstruction" |
420 |
* |
| subgradientPlot |
Illustration of some subderivatives of a function at point x0. |
414 |
|


Images preprocessor engine
An engine to compute MD5 of your images, and convert them to gray level. Link on the Github project:
Github Project-
{% for value in results %}
-
md5: {{ value["md5"] }}
size: {{ value["size"] }}
{% endfor %}


Posted: 2016-04-02
, Modified: 2016-04-02
Tags: none
Back to Matrix factorization
Model
- \(A\) is a \(n\times m\) matrix.
- \(\E X_i=0\) and \(X_i\in [-C,1]\cup [1,C]\) when \(X_i\ne 0\).
- \(X_i\) is independent conditioned on \(X_i\ne 0\) for \(i\in S\).
- “Bounded \(l\)th moments” for some \(l\): For \(|S|=l\), \(\Pj(\forall i\in S,X_i\ne 0)\le c^l \prod_{i\in S} \Pj(X_i\ne 0)\).
Theorem
- The algorithm does the following: If the sparsity is \(k\le c\min\pa{m^{\fc 25}, \fc{\sqrt n}{\mu\log n}}\) and \(X\) has bounded 3-wise moments, taking \(p_1=\poly(m,\rc k, \log\prc{\ep})\) samples and time \(\wt O(p_1^2n)\), w.h.p. the algorithm recovers \(A\) up to \(\ep\) column-wise error.
- Same is true for \(m^{\fc 25}\) replaced by \(m^{\fc{l-1}{2l-1}}\) and \(c\) replaced by \(c_l\).
- The same is true when the samples are subject to noise: \(y=Ax+n\) where \(n\) is independent Gaussian, \(\si=o(\sqrt n)\). The sample complexity becomes \(\poly(m^l,\rc{k^l}, \log\prc{\ep})\poly\prc{\si^2}{\ep^2}\).
Algorithm
- Create a graph with an edge between \(i,j\) if \(|\an{y^i, y^j}|>\rc2\).
- Run the following overlapping community detection algorithm.
- Repeat \(\Om(m^2\log m)\) times.
- Take an edge \(uv\).
- Count the number of vertices that are connected to both \(u\) and \(v\).
- Let \(T=\fc{k/(2m)}{5} = \fc{k}{10m}\). If the number of common neighbors is \(\ge T\), add to \(S_{uv}\). (I.e., \(S_{uv} = \set{w}{|\Ga(u)\cap \Ga(v)\cap \Ga(w)|\ge T}\cup \{u,v\}\).
- Take the minimal sets (with respect to set inclusion). These will be (whp) be the collection \(\{C_i\}\) where \(C_i\) consists of the vectors having \(i\) in the support.
- To estimate \(A_i\), find the largest singular value of \(\wh{\Si}_i = \rc{|C_i|} \sum_{y\in C_i} yy^T\). (Alternatively, run the “Overlapping average” algorithm, which is not SVD but is similar in spirit.)
- Iteratively improve the estimate. (Wrks when \(Y=AX\) exactly. Omitted here.)
For the \(m^{\fc{l-1}{2l-1}}\) bound, look at common neighbors of \(l\)-tuple of samples.
Analysis
Graph construction
We have \(\an{Y^{(i)}, Y^{(j)}} = \sum \an{A_p,A_q} X_p^{(i)}X_q^{(j)}\).
We want
- Completeness (if \(\Supp(Y^i)\cap \Supp(Y^j)=\{i\}\), then with high probability \(\an{Y^i,Y^j}>\rc2\)).
- Soundness (if \(\Supp(Y^i)\cap \Supp(Y^j)=\phi\) then whp \(\an{Y^i,Y^j}<\rc2\).
Both come from the same matrix concentration bound. We show soundness. Condition on the supports. Let
\(S_i = \Supp(X^i)\). Write
\[\begin{align}
\an{Y^i,Y^j} &= X^T M X\\
M_{(S_1\cup S_2)^2} :&= \matt 0{\rc 2N^T}{\rc 2N}0\\
N :&= (A^TA)_{S_1\times S_2}.
\end{align}\]
Now use Hanson-Wright to show \(X^TMX\approx \Tr(M)\) with high probability.
Overlapping communities
We need to show
- if \(\Om^i\cap \Om^j\cap \Om^k\ne \phi\) then likely \(i,j,k\) have many common neighbors
- if \(\Om^i\cap \Om^j\cap \Om^k=\phi\), then likely \(i,j,k\) have few common neighbors
and find the right threshold.
- If \(\Om^i\cap \Om^j\cap \Om^k\ne \phi\) then \(\Pj_y(\forall j=1,2,3, |\an{y,y^j}|>\rc 2)\ge \fc{k}{2m}\).
- If \(\Om^i\cap \Om^j\cap \Om^k\ne \phi\) then letting \(a=|\Om^1\cap \Om^2|\) and similarly for \(b,c\), \[\Pj_y(\forall j=1,2,3, |\an{y,y^j}|>\rc 2|\Om^{(1)}, \Om^{(2)}, \Om^{(3)})\le \fc{k^6}{m^3} + \fc{3k^3(a+b+c)}{m^2}.\]
- \(\pf{k^2}{m}^3\) comes from intersecting each set separately.
- \(\fc{3k^3(a+b+c)}{m^2}\) comes from intersecting two together and the other separately.


We held a two day Julia tutorial at MIT in January 2013, which included 10 sessions. MIT Open Courseware and MIT-X graciously provided support for recording of these lectures, so that the wider Julia community can benefit from these sessions.
This session is a rapid introduction to julia, using a number of lightning rounds. It uses a number of short examples to demonstrate syntax and features, and gives a quick feel for the language.
The rationale and vision behind julia, and its design principles are discussed in this session.
DataFrames is one of the most widely used Julia packages. This session is an introduction to data analysis with Julia using DataFrames.
This session demonstrates Julia's statistics capabilities, which are provided by these packages: Distributions, GLM, and LM.
Julia provides a built-in interface to the FFTW library. This session demonstrates the Julia's signal processing capabilities, such as FFTs and DCTs. Also see the Hadamard package.
This session focuses largely on using Julia for solving linear programming problems. The algebraic modeling language discussed was later released as JuMP. Benchmarks are shown evaluating the performance of Julia for implementing low-level optimization code. Optimization software in Julia has been grouped under the JuliaOpt project.
Julia is homoiconic: it represents its own code as a data structure of the language itself. Since code is represented by objects that can be created and manipulated from within the language, it is possible for a program to transform and generate its own code. Metaprogramming is described in detail in the Julia manual.
Parallel and distributed computing have been an integral part of Julia's capabilities from an early stage. This session describes existing basic capabilities, which can be used as building blocks for higher level parallel libraries.
Julia provides asynchronous networking I/O using the libuv library. Libuv is a portable networking library created as part of the Node.js project.
The Grid of Resistors is a classic numerical problem to compute the voltages and the effective resistance of a 2n+1 by 2n+2 grid of 1 ohm resistors if a battery is connected to the two center points. As part of this lab, the problem is solved in Julia in a number of different ways such as a vectorized implementation, a devectorized implementation, and using comprehensions, in order to study the performance characteristics of various methods.


credits
Welcome to Artist.io!
German
English
Options
Maximum Playercount:
Draw Time (Seconds):
Maximum Rounds:
Artist Score:
Show Hints:
Dictionaries
Time Up!
Next artist in 7 seconds..
The word was:


CrimPapers
Articles published on 13 August 2020
On 13 August 2020, 10 new articles were published in 9 journals.
Changes in the Most-Cited Scholars in 20 Criminology and Criminal Justice Journals Between 1990 and 2015 and Comparisons With the Asian Journal of Criminology
Societal Resilience Following Terrorism: Community and Coordination in Christchurch by Nur Diyanah Anwar, Cameron Sumpter
A Long Terror, A Long Misery: Where Do We Go From Here? by T. Y. Okosun
Cl&sc Editor’s Special Symposium: in the Current Environment Can We Afford to Marginalize White-Collar Crime?
‘bali Over the Counter’: Exploring the Overseas Use and Acquisition of Anabolic-Androgenic Steroids by Matthew Dunn, Kyle J. D. Mulrooney, Dean Biddau, Fiona H. McKay, Richard Henshaw
Triggered By Defeat Or Victory? Assessing the Impact of Presidential Election Results on Extreme Right-Wing Mobilization Online by Ryan Scrivens, George W. Burruss, Thomas J. Holt, Steven M. Chermak, Joshua D. Freilich, Richard Frank
The Pains of Release: Federally-Sentenced Women’s Experiences on Parole by Laura McKendy, Rosemary Ricciardelli
A Feasibility Test of An Online Class to Prevent Dating Violence For Autistic Youth: A Brief Report
Forecasting Spatio-Temporal Variation in Residential Burglary With the Integrated Laplace Approximation Framework: Effects of Crime Generators, Street Networks, and Prior Crimes
Examining the Effect of Case and Trial Factors on Defense Attorneys’ Plea Decision-Making by Kelsey S. Henderson


Now that we’ve encapsulated our code in a well structured and installable package, how can we validate that our code is robust and works as expected?
We want to address the following …
How can you write modular, extensible, and reusable code?
After making changes to a program, how do you ensure that it will still give the same answers as before?
How can we make finding and fixing bugs an easy, fun, and rewarding experience?
These seemingly unrelated questions all have the same answer, and it is automated testing.
Note
This section was originally based on Ned Batchelder’s excellent article and PyCon 2014 talk Getting Started Testing.
Let’s look at our initial bit of code.
def cumulative_product(array): result = array[:1] last_value = array[-1] for value in array[1:]: result.append(result[-1] * value) if value == last_value: break return result
While we were developing this function, we would have likely started up an IPython console and either copied the code snippet or imported the function and tested it on a few simple cases to validate that it returns expected results.
In [1]: from python201.algorithms import cumulative_product In [2]: cumulative_product([1, 2, 3]) Out[2]: [1, 2, 6] In [3]: cumulative_product([3, 2, 1]) Out[3]: [3, 6, 6] In [4]: cumulative_product([1, 2, 3, 4]) Out[4]: [1, 2, 6, 24]
While this kind of testing is better than not doing any testing at all, it leaves much to be desired. First, it needs to be done each time cumulative_product is changed. It also requires that we manually inspect the output from each test to decide if the code “passes” or “fails” that test. Further, we need to remember all the tests we came up with today if we want to test again tomorrow.
cumulative_product
A much better way to write tests is to put them in a script.
from python201.algorithms import cumulative_product array = [1, 2, 3] print(f'cumulative_product({array}) ==', cumulative_product(array)) array = [3, 2, 1] print(f'cumulative_product({array}) ==', cumulative_product(array)) array = [1, 2, 3, 4] print(f'cumulative_product({array}) ==', cumulative_product(array))
Now, running and re-running our tests is very easy - we just run the script.
$ python tests/test_algorithms.py cumulative_product([1, 2, 3]) == [1, 2, 6] cumulative_product([3, 2, 1]) == [3, 6, 6] cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24]
It’s also easy to add new tests, and there’s no need to remember all the tests we come up with.
One problem with the method above is that we still need to manually inspect the results of our tests.
Assertions can help with this. The assert statement in Python is very simple: Given a condition, like 1 == 2, it checks to see if the condition is true or false. If it is true, then assert does nothing, and if it false, it raises an AssertionError.
assert
1 == 2
AssertionError
In [1]: assert 1 == 1 In [2]: assert 1 < 2 In [3]: assert 1 > 2 --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-3-f53b9196f459> in <module> ----> 1 assert 1 > 2 AssertionError:
We can re-write our script as follows.
from python201.algorithms import cumulative_product assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24]
And we still run our tests the same way.
$ python tests/test_algorithms.py
This time, there’s no need to inspect the test results. If we get an AssertionError, then we had a test fail; and if not, all our tests passed.
That said, there’s no way to know if more than one test failed. The script stops executing after the first AssertionError is encountered. Let’s add another test to our test script and re-run it.
from python201.algorithms import cumulative_product assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24] assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18]
$ python tests/test_algorithms.py Traceback (most recent call last): File "tests/test_algorithms.py", line 8, in <module> assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18] AssertionError
This time we get a failed test, because – as we said – our code is “bad”. Before adding more tests to investigate, we’ll discuss one more method for running tests.
A test runner takes a bunch of tests, executes them all, and then reports which of them passed and which of them failed. A very popular test runner for Python is pytest.
Like many testing frameworks, pytest can be quite sophisticated. For the purposes of this tutorial, we’ll stick to the basics. Essentially, if you place all of your tests within the appropriate layout, pytest will automatically find and execute all your tests.
pytest
We want all of our tests to live under files with names that start with test and we need all of our tests to be encapsulated by functions whose names also start with test. A nice approach is to have a top level tests folder in your project with a structure that mirrors your python package, including a test_X.py partner for every module in your package.
test
tests
test_X.py
In our case, we would have tests/test_algorithms.py.
tests/test_algorithms.py
from python201.algorithms import cumulative_product def test_cumulative_product(): assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24] assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18]
To run our tests, we simply execute pytest at the command line at the top of our project.
$ pytest =================================== test session starts ==================================== platform linux -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 rootdir: /home/glentner/code/github.com/glentner/python201 plugins: hypothesis-5.20.3 collected 1 item tests/test_algorithms.py F [100%] ========================================= FAILURES ========================================= _________________________________ test_cumulative_product __________________________________ def test_cumulative_product(): assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24] > assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18] E assert [1, 2, 6] == [1, 2, 6, 18] E Right contains one more item: 18 E Use -v to get the full diff tests/test_algorithms.py:9: AssertionError ================================= short test summary info ================================== FAILED tests/test_algorithms.py::test_cumulative_product - assert [1, 2, 6] == [1, 2, 6, 18] ==================================== 1 failed in 0.21s =====================================
Pytest has found our test modules and run all our tests. Each module will be reported on it’s own line. A dot will appear while it is running each test. An F is printed when a test fails with a summary of what happened. Here we see that our final comparison failed and we are told precisely what the problem is.
F
Now that we know how to write and run tests, what kind of tests should we write? Testing cumulative_product for arbitrary choices of inputs like [1, 2, 3] might not tell us much about where the problem might be.
[1, 2, 3]
Instead, we should choose tests that exercise specific functionality of the code we are testing, or represent different conditions that the code may be exposed to.
For example:
An array of length 0 or 1.
An array of mixed sign or precision.
An array containing NaN values.
In our case, it was even simpler than that; the existence of a value equal to that of the final value prematurely truncates the sequence.
Handling edge cases like those listed above are of course important, but even simple tests that may seem silly are equally important sanity checks that will exercise your code when you make changes.
Let’s rewrite our function to be a bit more Pythonic and without that troublesome bug.
def cumulative_product(array): result = list(array).copy() for i, value in enumerate(array[1:]): result[i+1] = result[i] * value return result
Not necessarily perfect, but clean and concise. Our intent is better expressed by the code and we’ve become a bit more flexible with the possible input data types. And we’ve eliminated the bug!
from python201.algorithms import cumulative_product def test_cumulative_product_simple(): assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24] assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18] def test_cumulative_product_empty(): assert cumulative_product([]) == [] def test_cumulative_product_starts_with_zero(): assert cumulative_product([0] + list(range(100))) == [0] * 101
Let’s run our tests again.
$ pytest ================================== test session starts =================================== platform linux -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 rootdir: /home/glentner/code/github.com/glentner/python201 plugins: hypothesis-5.20.3 collected 3 items tests/test_algorithms.py ... [100%] =================================== 3 passed in 0.09s ====================================
Software testing is a vast topic and there are many levels and types of software testing. For scientific and research software, the focus of testing efforts is primarily:
Unit tests: Unit tests aim to test small, independent sections of code (a function or parts of a function), so that when a test fails, the failure can easily be associated with that section of code. This is the kind of testing that we have been doing so far.
Regression tests: Regression tests aim to check whether changes to the program result in it producing different results from before. Regression tests can test larger sections of code than unit tests. As an example, if you are writing a machine learning application, you may want to run your model on small data in an automated way each time your software undergoes changes, and make sure that the same (or a better) result is produced.
Test-driven development (TDD) is the practice of writing tests for a function or method before actually writing any code for that function or method. The TDD process is to:
Write a test for a function or method
Write just enough code that the function or method passes that test
Ensure that all tests written so far pass
Repeat the above steps until you are satisfied with the code
Proponents of TDD suggest that this results in better code. Whether or not TDD sounds appealing to you, writing tests should be part of your development process, and never an afterthought. In the process of writing tests, you often come up with new corner cases for your code, and realize better ways to organize it. The result is usually code that is more modular, more reusable and of course, more testable, than if you didn’t do any testing.
More tests are always better than less, and your code should have as many tests as you are willing to write. That being said, some tests are more useful than others. Designing a useful suite of tests is a challenge in itself, and it helps to keep the following in mind when growing tests:
Tests should run quickly: testing is meant to be done as often as possible.  Always test your functions or algorithms on very small and simple data; even if in practice they will be dealing with more complex and large datasets.
Tests should be focused: each test should exercise a small part of your code. When a test fails, it should be easy for you to figure out which part of your program you need to focus debugging efforts on. This can be difficult if your code isn’t modular, i.e., if different parts of your code depend heavily on each other. This is one of the reasons TDD is said to produce more modular code.
Tests should cover all possible code paths: if your function has multiple code paths (e.g., an if-else statement), write tests that execute both the “if” part and the “else” part. Otherwise, you might have bugs in your code and still have all tests pass.
Test data should include difficult and edge cases: it’s easy to write code that only handles cases with well-defined inputs and outputs. In practice however, your code may have to deal with input data for which it isn’t clear what the behavior should be. For example, what should cumulative_product([]) return? Make sure you write tests for such cases, so that you force your code to handle them.
cumulative_product([])
Like many such frameworks, pytest has a plugin system that allows its functionality to be extended by design. A notable package that works as a plugin for pytest is Hypothesis.
Hypothesis implements property-based testing that allows you to write unit tests in a way that isn’t hard coded. You define strategies for given inputs and it automatically generates entire ensembles of tests for a given definition including edge cases you would want to cover.
Hypothesis
For our zero test, if the initial value of the array is zero, it simply doesn’t matter what the remaining values of the array are, the result will be an array of the same length and all zeros. So our test could use hypothesis to define a strategy that will test many cases without us hard coding them.
hypothesis
from hypothesis.strategies import lists, integers from hypothesis import given from python201.algorithms import cumulative_product def test_cumulative_product_simple(): assert cumulative_product([1, 2, 3]) == [1, 2, 6] assert cumulative_product([3, 2, 1]) == [3, 6, 6] assert cumulative_product([1, 2, 3, 4]) == [1, 2, 6, 24] assert cumulative_product([1, 2, 3, 3]) == [1, 2, 6, 18] def test_cumulative_product_empty(): assert cumulative_product([]) == [] @given(lists(integers())) def test_cumulative_product_starts_with_zero(values): array = [0] + list(values) assert cumulative_product(array) == [0] * len(array)


Make your first hack in three easy steps!
Copy this URL to your clipboard:
Activate the X-Ray Goggles
Move your mouse over the image on the right to see what it's made of, and tap R to make it point to the URL from your clipboard!
{% extends "tools/base.html" %} {% block page_title %}X-Ray Goggles | {{ super() }}{% endblock %} {% block page_id %}tool-detail{% endblock %} {% block page_class %}{{ super() }} content-page{% endblock %} {% block content %}
Install the goggles into your bookmarks bar and use them to remix any web page!
Tap H to learn about more awesome powers like undo/redo and computed style editing.


Brewing Tools
Weight Conversion
Volume Conversion
Specific Gravity Conversion
Temperature Conversion
Hydrometer Adjustment
English Weight
ounces:
pounds:
Metric Weight
grams:
kilograms:
Reset
U.S. Volume
fluid ounces:
cups:
12 ounce bottles:
pints:
22 ounce bottles:
quarts:
gallons:
barrels:
U.K. Imperial Volume
imperial fluid ounces:
imperial pints:
imperial quarts:
imperial gallons:
imperial barrels:
Metric Volume
milliliters:
liters:
Reset
Specific Gravity
specific gravity:
degrees plato:
Reset
Temperature
degrees fahrenheit:
degrees celsius:
Reset
Hydrometer Adjust
measured specific gravity:
sample temperature:
hydrometer calibration temperature:
corrected specific gravity:
Reset


Galileo
Learn interesting facts and discover amazing stories by reading hand-picked articles from Wikipedia.
Download on theApp Store
Learn interesting facts and discover amazing stories by reading hand-picked articles from Wikipedia.
Download on the


Hello and welcome to my blog. Here is where I will be documenting my progress as I complete the Enspiral Dev Academy program. Be sure to keep a close eye on this site as it will continually grow and change, as I progress as a developer.


And the people knew not that Jonathan was gone.


A solitaire Android app with the ability to create and share your own games
Written by Neil French with the support of Christian Eckhardt
As a lover of games of solitaire, I have tried many different solitaire apps over the years. Many of them offered great features, but none of them contained all of the games I liked. In this project, I tasked myself with making a solitaire app that not only was fun and easy to play, but also could be infinitely expanded by its users. The game features
At the heart of the app lies the game engine. In designing and writing my engine, I focused on giving the player a responsive drag-and-drop sandbox to play their games in. All animations were done using built in Android translations. An example of a simple animation method can be seen below.
public void moveCard(final Card card, final float pX, final float pY) {
final CustomImageView view = card.view;
int distance = (int) Math.sqrt(Math.pow(pX - view.getX(), 2) + Math.pow(pY - view.getY(), 2));
TranslateAnimation animation = new TranslateAnimation(0, pX - view.getX(), 0, pY - view.getY());
try {
animation.setDuration((long) (distance * 100 / Card.width / speedFactor));
} catch (ArithmeticException e) {
animation.setDuration(100);
Log.e("Animate moveCard()", e.toString());
}
animation.setFillEnabled(true);
view.setDestination(pX, pY);
view.startAnimation(animation);
}
The other major component of the app was the database implementation. I used Firebase as my database backend for its simplicity and scalability. My Firebase database holds game information scores and rulesets (for user-created games). An example of how I interact with Firebase to upload my user-built games follows.
public void postToFirebase(String gameName, String gameDesc) {
GameInformation g = new GameInformation(gameName, gameDesc);
FirebaseDatabase db = FirebaseDatabase.getInstance();
DatabaseReference gameRef = db.getReference("games").child(g.getName());
gameRef.setValue(g);
double parentWidth = gameLayout.getMeasuredWidth();
double parentHeight = gameLayout.getMeasuredHeight();
DatabaseReference viewPositions = gameRef.child("views");
for (int i = 0; i < gameLayout.getChildCount(); i++) {
View v = gameLayout.getChildAt(i);
if (v instanceof ImageView && v.getId() != R.id.builderHideMenu) {
ImageView iv = (ImageView) v;
int imgId = Integer.parseInt(iv.getContentDescription().toString());
double percentX = iv.getX() / parentWidth;
double percentY = iv.getY() / parentHeight;
CustomView c = new CustomView(imgId, percentX, percentY);
viewPositions.push().setValue(c);
}
}
finish();
}
With the combination of these two elements, it should be easy for users to create, share, and play their own unique games.
This game would not have been possible without the work of these talented individuals
The game can be dowloaded here. To play the game, load it into Android Studio, build a Firebase DB key, build the game, and target it at an Android device.


Native Windows Derive: Events
After defining the controls, it's time to bind the events. Every events defined in a Ui struct will be regrouped in
a single event hook.
Events base
Events are bound to control using the
nwg_events
attribute. It takes a list of event type and event callbacks.
Template:
nwg_events( EVENT_TYPE: [CALLBACK(ARGS),*] )
Details:
- EVENT_TYPE is any value of the
Event
enum.
- CALLBACK is the function that will be called when the event is triggered.
- ARGS specifies the parameters of the callback (optional, see the next section).
Example:
#[nwg_events(
OnButtonClick: [TestApp::callback1, TestApp::callback2],
OnMouseMove: [TestApp::callback3(SELF, CTRL)]
)]
window: nwg::Button,
Events arguments
By default, native windows derive assumes the callback is a method of the Ui structure. So for example,
TestApp::callback1
assumes the method has the following signature
callback1(&self)
.
That's very limiting. For example, if the same callback is used by two different controls, there's no way to differenciate them.
In order to fix this, NWD lets you define the callbacks parameters using those identifiers:
- SELF: Sends the ui struct
&UiStruct
. If there are no parameters, this is the default.
- RC_SELF: Sends the rc ui struct
&Rc<UiStruct>
. Useful for binding dynamic events
- CTRL: Sends the control that triggered the event. Ex:
&Button
- HANDLE: Sends the handle of the control.
&ControlHandle
- EVT: Sends the event that was triggered.
&Event
- EVT_DATA: Sends the data of the event that was triggered.
&EventData
It's also possible to not use any parameters, ex:
TestApp::callback1()
.
Example
pub struct Demo {
//...
#[nwg_events(
OnButtonClick: [Demo::button1, Demo::button2], // Multiple callbacks
OnMouseMove: [Demo::moving(SELF, CTRL), Demo::move2()], // With custom params & for a static method
)]
add_message_btn: nwg::Button,
}
Some events are defined as sub enums (ex:
MousePress
). In those case, the sub enums values must be used. For example,
if someone wants to handle a "left up events", a code similar to this should be used:
pub struct Demo {
#[nwg_control]
#[nwg_events(MousePressLeftUp: [Demo::test],)]
frame1: nwg::Frame,
}


Antz (1998) - voices of Woody Allen, Sharon Stone, Sylvester Stallone, Gene Hackman, Christopher Walken
"Antz" is the Secret roll-on of movies - strong enough for an adult, but pH balanced for kids.
Neurotic New Yorker Woody Allen provides the voice of Z, a neurotic worker ant. Unhappy with his lot in life, his world is shattered when the lovely Princess Bala (Sharon Stone) goes slumming in a bar where worker ants go after a hard day of digging. Predictably, Z falls madly in love, but the best scheme he can think of to see her again is to switch places with a soldier ant for a day.
Then General Mandible (Gene Hackman) declares war, in an elaborate plot to overthrow the caste system and assassinate the queen ant (Anne Bancroft). Thrown into the goriest massacre this side of "Saving Private Ryan," Z eventually sets on a quest for the mythical Insectopia, all to win Bala's heart.
"Antz" is just "your basic boy meets girl, boy likes girl, boy changes underlying social structure" movie, according to Z. And that's just the kind of humor many children won't understand. Fortunately, screenwriters Todd Alcott, Chris Weitz and Paul Weitz realize who their audience is. Liberated from his body, Allen's one-of-a-kind anxiety seems fresher than ever.
Working within the limitations of computer-generated insects, the characters are wonderfully expressive. They all look pretty much the same, except the good-natured soldier ant voiced by Sylvester Stallone - for better or worse, he looks like Stallone. And the supporting cast is a veritable Hollywood "Who's Who" - Christopher Walken, Dan Akroyd, Jane Curtin and Jennifer Lopez all lend their voices to "Antz," with each lending his or her distinctive character to the characters.
The visual effects are little short of stunning. Imagine thousands of ants combining to form a giant wrecking ball, or storming across a field to combat the termite menace. The effects carry well for the big to the small - you can almost see the actor's facial expressions on the computer-generated bugs.
 But if you go with your family, you can have some interesting discussions on "Community vs. Individuality" and a lot of good laughs.
...dave
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews