Mayor worries of ‘mob violence’ in Surrey, B.C., as police investigate video
The mayor of Surrey, B.C., says he’s deeply concerned about “mob violence” happening in his city after a video circulated online that shows a group of young men fighting and damaging a vehicle.
A statement from Doug McCallum says it’s the second such video that has been circulated online since August capturing people brawling and it’s imperative that RCMP take immediate action.
Mounties also issued a statement Friday confirming they have been investigating the video since Monday when police received two reports related to an assault with a weapon and vandalism to property in a city parking lot.
Police say their investigation expanded since police received a copy of a video on Thursday.
Cpl. Elenore Sturko says while the incident and video are disturbing, the video’s wide distribution could potentially help police further their investigation and identify those involved.
The dark video shows many people carrying wooden or metal weapons and using them to smash a vehicle and assault the driver who stepped out to confront the crowd.
Our Morning Update and Evening Update newsletters are written by Globe editors, giving you a concise summary of the day’s most important headlines. Sign up today .


MIT License
Copyright (c) 2019 Farhan Hanif, Fadil Ardiansyah
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Retrofit2 (com.squareup.retrofit2:retrofit:2.1.0)
gson (com.google.code.gson:gson:2.8.5)
Retrofit2 (com.squareup.okhttp3:okhttp:3.4.1)
Betterpickers (com.code-troopers.betterpickers:library:3.1.0)
Multistateview (com.github.Kennyc1012:MultiStateView:1.3.2)
AppIntro (com.github.AppIntro:AppIntro:v4.2.3)
Toasty (com.github.GrenderG:Toasty:1.4.0)
Lottie (com.airbnb.android:lottie:2.5.6)


How Do I Remember All This Gosh Darn Stuff?
Git
(dangitgit.com)
Objective-C Block Syntax
(goshdarnblocksyntax.com)
C++ Member Pointer Syntax
(goshdarnmemberfunctionpointers.com)
C Function Pointer Syntax
(goshdarnfunctionpointers.com)
Swift Closure Syntax
(goshdarnclosuresyntax.com.com)
Swift Multiple Trailing Closures Syntax
(goshdarnmultipletrailingclosuresyntax.com)
Swift If Let Case Syntax
(goshdarnifcaseletsyntax.com)
SwiftUI Reference
(goshdarnswiftui.com)
Like the site, but wish it had a racier URL?
This
might be more your speed.


{% extends "base.html" %} {% block title %}Welcome{% endblock %} {% block content %}
You've reached my experimental git hosting site. Feel free to take a look around. With this site you can create, manage, and collaborate on git repositories. Happy hacking!
Go to your settings page and fill in your name so others know who you are. Or if you're the pseudonymous type, make one up!


Cardinals reach agreement to stay on KMOX Radio
ST. LOUIS (AP) - The St. Louis Cardinals will remain on their longtime radio flagship station through at least 2024, and with the same team of announcers.
The Cardinals on Friday announced a five-year extension of their radio rights agreement with the media company Entercom Communications, the owner of KMOX. Financial terms were not disclosed.
A news release from the Cardinals says that announcers Mike Shannon, John Rooney, Ricky Horton and Mike Claiborne will continue.
TOP STORIES
DHS confirms no new border wall yet
Skeptics chuckle as climate activist Greta Thunberg sets sail for Europe on 'plastic yacht'
White House releases transcript of Trump's first phone call with Ukraine's president
Most of the Cardinals Radio Network will also remain under the new agreement. The network consists of 147 stations in eight states - Arkansas, Illinois, Indiana, Iowa, Oklahoma, Kentucky and Tennessee in addition to Missouri.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


I was born and raised in the Bay Area in in California. I am a student at the University of Michigan
where I am studying Computer Science. I love to go to the gym, play chess, and watch the Lakers win.
I love trying new cuisines and exploring new places, and I hope to one day be fortunate enough to visit
Antartica.
I am interested in web/app development, and creating technologies and interfaces that can enrich people's lives.
I have interned for Motive, an app which helps friends motivate each other to accomplish their goals. I have also
worked with the Michigan School of Public Health to help develop 1Cademy, a platform which allows COVID-19 researchers
at the nation's premier institutions to colloborate on epidemiological research.


Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
1/34 00 Cri. APL-369.19(J).odt IN THE HIGH COURT OF JUDICATURE AT BOMBAY CRIMINAL APPELLATE JURISDICTION CRIMINAL APPLICATION NO.369 OF 2019 Pratap Lal Teli, ] R/o. Chawl No.10, Room No.203, Punjabi ] Colony, GTB Nagar, Sion Koliwada, ] Mumbai - 400 037. ] ... Applicant Versus 1. The State of Maharashtra, ] through the Public Prosecutor, Home ] Department, Government of ] Maharashtra, Mantralaya, Mumbai - ] 400 032. ] 2. Senior Inspector of Police, ] Worli Police Station, Mumbai. ] 3. Kumar Mangalam Birla, ] Chairman, Grasim Industries, 9th ] Floor, Sahkar Bhavan, 230 Nariman ] Point, Mumbai - 400 021. ] AND Chairman, ] Hindalco Industries, ] Century Bhavan, 3rd Floor, Dr. Annie ] Besant Road, Worli, Mumbai - 400 ] 030. ] 4. D. Bhattacharya, Managing Director, ] Hindalco Industries Ltd., Century ] Bhavan, 3rd Floor, Dr. Annie Besant ] Road, Worli, Mumbai - 400 030. ] AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 2/34 00 Cri. APL-369.19(J).odt 5. K.K. Maheshwari, Grasim Industries, ] 9th Floor, Sahkar Bhavan, 230, ] Nariman Point, Mumbai - 400 021. ] ... Respondents Mr. Aditya Pratap for the Applicant. Mr. Amit Desai, senior counsel with Mr. Faisal Sayyed with Mr. Hassan F. i/b Manilal Kher Ambalal & Co. for Respondent Nos.3 to 5. Mr. H.J. Dedhia, A.P.P. for the State. CORAM : SMT. BHARATI DANGRE, J.
RESERVED ON : 25th SEPTEMBER, 2019 PRONOUNCED ON: 22nd OCTOBER, 2019. JUDGMENT:-
1. The present Criminal Application raises a significant issue as regards the embargo created in Section 19 of the Environment (Protection) Act, 1986 and the Applicant seeks a direction to quash and set aside the impugned order passed by the Sessions Court and seek a direction to the Worli Police Station to register the First Information Report and to investigate the case in accordance with Chapter XII of the Criminal Procedure Code.
AJN
::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::
3/34 00 Cri. APL-369.19(J).odt
2. The bare minimum facts essential for determination of the legal question are culled out as follows:
The Applicant asserts that he is a social conscious person and has been taking up various social issues relating to environment and in particular the harm caused to the environment on account of illegal construction. He proceeds on the premise that several accused persons have commenced construction of a Commercial and I.T. building without adhering to the norms contained in the Environment (Protection) Act, 1986 i.e. without obtaining the Environmental Clearance from the State Environment Impact Assessment Authority ("SEIAA") under the EIA Notification of 2006 and thereby they have cheated the Government. He, therefore, filed a complaint under Section 156(3) of the Criminal Procedure Code seeking police investigation for the alleged offences under Sections 420, 120-B and Section 187 of the Indian Penal Code read with Section 15 of the Environment (Protection) Act. The said complaint came to be rejected by the learned Metropolitan Magistrate in view of the barrier contained in Section 19 of the Environment (Protection) AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 4/34 00 Cri. APL-369.19(J).odt Act. Being aggrieved, he preferred an appeal to the Sessions Judge, which also resulted in dismissal by order dated 12th December, 2018.
3. Mr. Aditya Pratap, learned counsel appearing for the Applicant rests his case on certain important questions of law and he would submit that the offence contained under Section 15 of the Environment (Protection) Act, 1986 is non-cognizable whereas it would be liable to be classified as a cognizable offence in view of the provisions of Part-II of Schedule-I of the Criminal Procedure Code. He would submit that this special enactment prescribes a penalty extending with imprisonment for a term of five years or with fine which may extend to Rs.5 lakhs, or both. According to him, this would fall within the ambit of a 'cognizable offence' to be triable by the Magistrate of First Class but the Act has classified the offence to be 'non-cognizable'. The second point urged by Mr. Pratap is to the effect that the learned Sessions Judge has erroneously treated the Application under Section 156(3) of the Code of Criminal Procedure to be AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 5/34 00 Cri. APL-369.19(J).odt amounting to taking cognizance of the offence and the interpretation arrived at by him for rejecting the relief on the basis that such an application is not sustainable in absence of sixty days' statutory notice being given under the Act, is erroneous. According to him, any order under Section 156(3) of the Criminal Procedure Code is at pre-cognizance stage and this is not the initiation of trial and at this stage no cognizance is taken within the meaning of the provisions of Section 190 of the Criminal Procedure Code. Further, he would also canvas a submission that the Sessions Judge has erred in prescribing the criteria of locus standi in filing criminal case under the Environment (Protection) Act and he would rely on the judgment of the Apex Court in the case of A.R. Antulay v. Ramdas Sriniwas Nayak & Anr. reported in AIR 1984 SC 718 to advance a submission that the legal principle emerging from the said judgment is to the effect that anyone can put the criminal law into motion unless contradicted by a statutory provision. According to him, the impugned order by implication, rules that an order under Section 156(3) of the Code of Criminal Procedure AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 6/34 00 Cri. APL-369.19(J).odt would be 'post-cognizance stage' against settled position in law that the order under this section is 'pre-cognizance stage'. He would further place reliance on the 15 members Expert Body Report of the State Level Expert Appraisal Committee, which in its Meeting held on 29th & 30th November, 2012 and 01st December, 2012 has noted that the project proponent has initiated the construction work without obtaining the Environmental Clearance and, hence, the SEIAA after due verification may initiate action for violation under the Environment (Protection) Act, 1986.
4. Per contra, learned senior counsel Mr. Amit Desai, appearing for Respondent Nos.3, 4 and 5 would question the locus of the Applicant and alleges that the Applicant is an uninterested party in property in question, who has filed a complaint with a sole motive to harass the Respondents. He would charge the Applicant with making false and misleading statements and he would support the impugned orders passed by the Metropolitan Magistrate as well as the order passed in the AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 7/34 00 Cri. APL-369.19(J).odt Revision Application. Coming to the facts, Mr. Desai would submit that the MCGM was the owner of Plot bearing No.216 and 216A situated at Dr. Annie Basant Road, Lower Parel Division, Worli, Mumbai and the Company has acquired the property No.216 vide Deed of Assignment from one Rhone Poluc (India) Limited which subsequently merged into Nicholas Piramal India Limited. He further submits that the original lessees of Plot No.216-A assigned the leasehold rights in favour of one M/s. Manish Estates Private Limited ("MEPL"), which constructed a building consisting of basement, ground and six upper floors known as Manish Commercial Centre which included three theaters. It is this MEPL which sold the commercial offices in the Manish Commercial Centre to various purchasers and the office purchasers formed a Co-operative Society and registered the same under the relevant statutes. It is asserted by Mr. Desai that MEPL mortgaged Plot No.216-A in favour of Canara Bank and this premises including the three theaters were put up for sale by an auction by the Debt Recovery Tribunal and this was purchased jointly by the Companies.
AJN
::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::
8/34 00 Cri. APL-369.19(J).odt
Subsequent thereto, the lease of Plot No.216-A was also transferred in the name of the Companies. It is then stated that the existing theaters came to be demolished and construction commenced in Plot No.216-A on sanction of Intimation of Disapproval granted by MCGM, which was followed by a Commencement Certificate. It is stated that since the total built up area to be constructed is less than 20000 sq. mtrs. as per the approved plan, no environmental clearance was required as per the Environment Impact Assessment Notification 2006. The submission of Mr. Desai is to the effect that the relevant authorities like the SEIAA, SEAC, Environment Department and the Police Authority were well updated about the construction taking place on the site and it is thus emphasized that the Respondents are not guilty of any violation of law and the Applicant with an object of harassing the Respondents approached the police authorities and on refusal to register an FIR, which alleges commission of offences under the IPC, filed a complaint to the Magistrate under Section 156(3), which came to be rejected. Mr. Desai submits that the Environment (Protection) AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 9/34 00 Cri. APL-369.19(J).odt Act, 1986 is a special enactment and the provisions contained in the same would override the provisions of the Code of Criminal Procedure and in case of any inconsistency between the two, the provisions of the special law would prevail in accordance with Section 4(2) of the Code of Criminal Procedure. His submission is that there is an embargo created in taking cognizance of the offence under the Environment (Protection) Act, 1986, besides the eligibility of the complaint and the complainant, on the basis of which the Court is competent to take cognizance of the offence under the Act. He would place reliance on the judgment of the Apex Court in the case of A.R. Antulay (supra). Mr. Desai has also placed reliance on the judgment of this court in case of Dilip Mishrilal Bang & Anr. v. State of Maharashtra reported in 2015 SCC OnLine Bom 4083 where the learned Public Prosecutor has fairly conceded that in the light of the provisions of Section 19 of the Environment (Protection) Act, cognizance of the offence under Section 15 cannot be taken on the basis of the police report. He would also rely on the judgment in the case of Mahesh Shivram Puthran v. Commissioner of Police reported in AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 10/34 00 Cri. APL-369.19(J).odt 2011 SCC Online Bom. 389 in relation to an offence punishable under Sections 43 and 52 of the Maharashtra Regional and Town Planning Act, 1966 in the form of a special statute. Reliance is also placed on the judgment of the Patna High Court in Imamullah v. State of Bihar & Ors. reported in 2016 (6) FLT 876 dealing with Section 19 of the Environment (Protection) Act and according to the learned senior counsel, the single judge of the Patna High Court has quashed and set aside an order taking cognizance of offence under Section 15 of the Environment (Protection) Act without following mandate of Section 19.
5. With the assistance of the learned counsel for the parties, I have perused the Petition and the compilation of documents placed on record by the Respondents which contain relevant documents as regards the construction activities undertaken by the Respondents and these documents are in sync with the Affidavit in Reply filed to the Revision Application and also to the stand adopted by the learned senior counsel who submits that there was no infraction of any statutory enactment. Without AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 11/34 00 Cri. APL-369.19(J).odt going into the merits of the actual contention, I deem it appropriate to consider the specific issue raised by learned counsel Mr. Pratap on entertainment of his complaint under Section 156(3) which, according to him, is a per-cognizance stage and issuing direction to the police to register an FIR for the offence under Section 15 of the enactment, being a cognizable offence.
6. The Environment (Protection) Act, 1986 is an Act for the protection and improvement of the environment and the same has been enacted to give effect to the decision taken at the United Nations Conference on the Human Environment held at Stockholm in which India had participated. Concerns over the state of environment which were expressed worldwide resulted into the said enactment being brought on the statute book and it is a special enactment for environmental protection since the existing laws dealing with environmental matters were found to be inadequate. The special enactment ensures coordination of activities of various regulatory agencies and creates the authority who is conferred with special powers for environmental AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 12/34 00 Cri. APL-369.19(J).odt protection, regulation and discharge of environmental pollutants, handling of hazardous substance and also prescribes deterrent punishment for those who endanger human environment, safety and health. The said enactment empowers the Central Government to take such measures as it deems necessary or expedient for the purpose of protecting and improving the quality of environment and preventing and abetting environmental pollution. Chapter III of the said enactment is in the nature of prevention, control and abetment of environmental pollution. Power of entry, inspection, search and seizure to be exercised by the officers empowered by the Central Government is governed by the Code of Criminal Procedure. Section 15 of the enactment prescribes the penalty for failure to comply with or contravention of the provisions of the Act, rules or orders or directions issued thereunder. Section 15 of the said enactment reads thus:
"15. Penalty for contravention of the provisions of the act and the rules, orders and directions - (1) Whoever fails to comply with or contravenes any of the provisions of this Act, or the rules made or orders or directions issued thereunder, shall, in respect of each such failure AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 13/34 00 Cri. APL-369.19(J).odt or contravention, be punishable with imprisonment for a term which may extend to five years with fine which may extend to one lakh rupees, or with both, and in case the failure or contravention continues, with additional fine which may extend to five thousand rupees for every day during which such failure or contravention continues after the conviction for the first such failure or contravention.
(2) If the failure or contravention referred to in sub-section (1) continues beyond a period of one year after the date of conviction, the offender shall be punishable with imprisonment for a term which may extend to seven years."
Another relevant Section which is the nerve of the present challenge needs a reproduction is Section 19 which provides for cognizance of offences.
"19. Cognizance of offences - No court shall take cognizance of any offence under this Act except on a complaint made by-
(a) the Central Government or any authority or officer authorised in this behalf by that Government, or
(b) any person who has given notice of not less than sixty days, in the manner prescribed, of the alleged offence and of his intention to make a complaint, to the Central Government or the authority or officer authorised as AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 14/34 00 Cri. APL-369.19(J).odt aforesaid."
Section 24 of the Act provides an overriding effect and reads thus:
"24. Effect of other laws - (1) Subject to the provisions of sub-section (2), the provisions of this Act and the rules or orders made therein shall have effect notwithstanding anything inconsistent therewith contained in any enactment other than this Act.
(2) Where any act or omission constitutes an offence punishable under this Act and also under any other Act then the offender found guilty of such offence shall be liable to be punished under the other Act and not under this Act."
7. In the backdrop of the aforesaid scheme of the statute, the contention of the learned counsel for the Applicant needs to be examined. The Applicant approached the Worli Police Station with a complaint disclosing according to him, "a cognizable offence" committed by the Accused persons on 29th October, 2013. It is alleged that the said complaint, though discloses a cognizable offence, no FIR was registered by the Worli Police AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 15/34 00 Cri. APL-369.19(J).odt Station, which constrained the Applicant to send notice under Section 154(3) of the Code of Criminal Procedure to the Commissioner of Police on 18th November, 2013. Inspite of such notice, the Commissioner of Police did not issue a direction to the concerned police station to register an FIR. Consequentially, the Applicant filed an Application under Section 156(3) of the Code of Criminal Procedure in the Court of Metropolitan Magistrate, Boiwada. This complaint came to be rejected by the Magistrate on the ground that the provisions of Section 156(3) can be availed only in cases where the offence is cognizable. However, Section 19 puts a restriction on the Court to take cognizance of the offence except in the manner prescribed in Section 19(a) and
(b) of the Act. Since the complainant was not an officer covered under clause (a) of Section 19 nor did he complied with the stipulation contained in clause (b) of Section 19 of the Act, it came to be rejected. As far as his allegation under Sections 420, 120B and 187 of the IPC is concerned, the Magistrate recorded that the concerned complaint do not disclose commission of any such offence as alleged.
AJN
::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::
16/34 00 Cri. APL-369.19(J).odt
8. Learned counsel for the Applicant has posed a question whether the offence under Section 15 of the Environment (Protection) Act is a cognizable offence. The said proposition is not in dispute as one looks at Section 15, it would disclose that failure to comply or acting in contravention to the provisions of the rules, orders and direction is punishable with imprisonment for a term which may extend to five years and if the failure or contravention continues beyond a period of one year from the date of conviction, the punishment to be imposed may extend to imprisonment for a term upto seven years. Offence in terms of Part-II of Schedule-I appended to the Code of Criminal Procedure makes it cognizable and non-bailable. The manner in which the cognizance of the offence under the Act can be taken is set out in Section 19 and the cognizance can only be taken on a complaint by the Central Government or any authority or officer authorized in this behalf by the Government. Other mode of taking cognizance is on a complaint made by a person who has given notice of not less than sixty days, in the manner prescribed, AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 17/34 00 Cri. APL-369.19(J).odt of the alleged offence and of his intention to make a complaint, to the Central Government or the authority or officer authorized as aforesaid. It is this provision contained in the special enactment which is besieged by learned counsel Mr. Pratap.
It is not deviant for a special enactment to prescribe a special procedure to the exclusion of the procedure prescribed by the Code of Criminal Procedure. Section 4 of the Code of Criminal Procedure 1973 provides for trial of offences under the IPC and other laws. Sub-section (1) of Section 4 provides that all the offences under the IPC will be dealt with by adopting the procedure prescribed in the Criminal Procedure Code. Sub- section (2) of Section 4 prescribes that all the offences under any other laws other than offences under the IPC shall be investigated, inquired into and tried and otherwise dealt with according to the same provisions but subject to any enactment for the time being in force regulating the manner or place of investigating, inquiring into, trying or otherwise dealing with such offences.
AJN
::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::
18/34 00 Cri. APL-369.19(J).odt
9. Chapter XII of the Code of Criminal Procedure sets out the manner in which the information in relation to cognizable cases / non cognizable cases is received and its investigation should be carried out. Chapter XIV of the Code of Criminal Procedure sets out the condition requisite for initiation of proceedings. Section 190 of the Code stipulates the cognizance of offences by the Magistrate and it states that any Magistrate may take cognizance of any offence (a) upon receiving a complaint of facts which constitute such an offence; (b) upon a police report of such facts and (c) upon information received from any person other than a police officer or upon his knowledge that such offence has been committed. Section 190 is the repository of the power of the Magistrate to take cognizance of offences. Cognizance of offence has now been well settled and understood to mean a stage where the Magistrate applies his mind to the facts of the case and on application of mind, takes judicial notice of an offence. It is entirely different thing from initiation of proceeding; it is rather a condition precedent to the initiation of proceeding by the Magistrate. Cognizance is taken of cases and not persons. This AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 19/34 00 Cri. APL-369.19(J).odt power of a Magistrate as contained in Section 190 do not impose any particular qualification of the complainant.
10. On a comparison of Section 190 with Section 19 of the Environment (Protection) Act, 1986, it becomes obvious that under the special statute the restriction imposed is on the Court taking cognizance of any offence under the Act of 1986 except in the manner prescribed in the said Section and on ensuring compliance therein. The said special provision contained in the Environment (Protection) Act continues to govern the field in the wake of sub-Section (2) of Section 4 of the Criminal Procedure Code which specifically indicates that all offences other than the one under the IPC shall be investigated, inquired into, tried and otherwise dealt with according to the provisions of the Criminal Procedure Code, subject to any enactment for the time being in force regulating the manner or place of investigation, inquiry into or otherwise dealing with such offences.
11. In A.R. Antulay (supra), the principle contained in Section AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 20/34 00 Cri. APL-369.19(J).odt 4(2) of the Code of Criminal Procedure came up for consideration before the Constitution Bench in the wake of Criminal Law (Amendment) Act, 1952. Section 6(1)(a) of the Act imposed a restriction on taking cognizance of any of the offence upon a private complaint. In the backdrop of the factual scenario, the Apex Court observed thus:
"6. It is a well recognised principle of criminal jurisprudence that anyone can set or put the criminal law into motion except where the statute enacting or creating an offence indicates to the contrary. The scheme of the Code of Criminal Procedure envisages two parallel and independent agencies for taking criminal offences to court. Even for the most serious offence of murder, it was not disputed that a private complaint can, not only be filed but can be entertained and proceeded with according to law. Locus standi of the complainant is a concept foreign to criminal jurisprudence save and except that where the statue creating an offence provides for the eligibility of the complainant, by necessary implication the general principle gets excluded by such statutory provision Numerous statutory provisions, can be referred to in support of this legal position such as
(i) Sec. 187 A of Sea Customs Act, 1878 (ii) Sec. 97 of Gold Control Act, 1968 (iii) Sec. 6 of AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 21/34 00 Cri. APL-369.19(J).odt Import and Export Control Act, 1947 (iv) Sec. 271 and Sec. 279 of the Income Tax Act, 1961
(v) Sec. 61 of the Foreign Exchange Regulation Act, 1973,(vi) Sec. 621 of the Companies Act, 1956 and (vii) Sec. 77 of the Electricity Supply Act. This list is only illustrative and not exhaustive. While Sec. 190 of the Code of Criminal Procedure permits anyone to approach the Magistrate with a complaint, it does not prescribe any qualification the complainant is required to fulfil to be eligible to file a complaint. But where an eligibility criterion for a complainant is contemplated specific provisions have been made such as to be found in Secs. 195 to 199 of the Cr. P. C. These specific provisions clearly indicate that in the absence of any such statutory provision, a locus standi of a complainant is a concept foreign to criminal jurisprudence. In other words, the principle that anyone can set or put the criminal law in motion remains intact unless contra- indicated by a statutory provision."
The Constitution Bench also considered the import of Section 4(2) against a special statute in the following words:
"Sec. 4 (1) provides for investigation, inquiry or trial for every offence under the Indian Penal Code according to the provisions of the Code. Sec. 4 (2) provides for offences under other law which may be investigated, inquired into, tried and otherwise dealt with according to the provisions of the Code of Criminal AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 22/34 00 Cri. APL-369.19(J).odt Procedure but subject to any enactment for the time being in force regulating the manner or place of investigation, inquiring into, trying or otherwise dealing with such offences. In the absence of a specific provision made in the statute indicating that offences will have to be investigated, inquired into, tried and otherwise dealt with according to that statute, the same will have to be investigated, inquired into, tried and otherwise dealt with according to the Code of Criminal Procedure. In other words, Code of Criminal Procedure is the parent statute which provides for investigation, inquiring into and trial of cases by criminal courts of various designations."
12. The general principle of universal application that an act or omission is not merely an offence in relation to a person who suffers a harm but is an offence against society, came to be recognized by the Constitution Bench but at the same time a way was carved out for a special statute specifying the eligibility of a complainant and it was held that the punishment of the offender in the interest of the society being the object behind penal statutes, their right to initiate proceedings cannot be whittled down, circumscribed or fettered by putting it into a straight jacket formula of locus standi unknown to criminal AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 23/34 00 Cri. APL-369.19(J).odt jurisprudence, save and except a specific statutory exception. The said statutory exception is what is precisely contained in Section 19 of the Environment (Protection) Act, 1986. Such an eligibility criteria being prescribed by a statute would therefore constrict the operation of Section 190 of the Code of Criminal Procedure which empowers the Magistrate to take cognizance of any offence upon receiving a complaint of facts which constitutes such an offence. Section 190 of the Code of Criminal Procedure which otherwise do not perceive any qualification or eligibility of the complainant to file a complaint is circumscribed by a provision contained in the special statute to the contrary which may indicate the qualification or eligibility of the complainant to file complaint, the Magistrate before taking cognizance is then entitled to enquire as to whether the complainant satisfies the eligibility criteria.
13. It is worth to be noted that Section 195(1) of the Code of Criminal Procedure itself provides that no Court shall take cognizance of an offence set out therein except on a complaint in AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 24/34 00 Cri. APL-369.19(J).odt writing of the public servant concerned or some other public servant to whom he is administratively subordinate. Section 195 further prescribes that no Court shall take cognizance of an offence specified therein except on a complaint in writing of that Court or by such officer of the Court as that Court may authorise in writing in this behalf or of some other Court to which that Court is subordinate. Section 198 and Section 199 of the Code of Criminal Procedure also impose restriction on the Magistrate taking cognizance and which requires compliance of stipulation contained therein before taking cognizance. Several statutes contain such restrictions and in the light of such restrictions contemplated under the statutes, Section 190 of the Code of Criminal Procedure will have to make way for the special provision containing special stipulation in the statute. The legal scenario which thus emerges is to the effect that anyone can set the criminal law in motion by filing a complaint of facts of offence constituting an offence before a Magistrate entitled to take cognizance under Section 190 and unless any statutory provision prescribes any special qualification or criteria for AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 25/34 00 Cri. APL-369.19(J).odt putting the criminal law in motion, no court can decline to take cognizance on the ground that the complainant is not competent to file the complaint.
The said position of law is by this point of time very well accepted and recognized. In Vishwa Mitter of M/s. Vijay Bharat Cigarette Stores, Delhousie Road, Pathankot v. O.P. Poddar & Ors. reported in (1983) 4 SCC 701, the Hon'ble Apex Court while dealing with Sections 89, 78, 79 of the Trade and Merchandise Marks Act, 1958 observed thus:
"Section 89 of the Act provides that no Court shall take cognizance of an offence under Section 81, Section 82 or Section 83 except on a complaint in writing made by the Registrar or any officer authorised by him in writing. This provision manifests the legislative intention that in respect of the three specified offences punishable under Sections 81, 82 and 83, the Registrar alone is competent to file the complaint. This would simultaneously show that in respect of other offences under the Act, the provision contained in Sec. 190 of the Code of Criminal Procedure read with sub-sec.
(2) of Sec. 4 would permit anyone to file the complaint. The indication to the contrary as envisaged by sub-sec. 2 of Sec. 4 of the Code of Criminal Procedure is to be found in Sec. 89 and that section does not prescribe any AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 26/34 00 Cri. APL-369.19(J).odt particular eligibility criterion or qualification for filing a complaint for contravention of Sections 78 and 79 of the Act. Therefore, the learned Magistrate was in error in rejecting the complaint on the sole ground that the complainant was not entitled to file the complaint."
14. The Division Bench of this Court in the case of Mahesh Shivram Puthran (supra), while dealing with a provision contained in the Maharashtra Regional and Town Planning Act, 1966 where an embargo is created in the form of Section 142 of the Act, observed thus:
"9. From the scheme of the provisions of the Act, it is obvious that the prosecution for offences punishable under the Act of 1966 is instituted and pursued by the Planning Authority. This position is reinforced by Section 142 of the Act, which reads thus:-
"Sanction of prosecution.- No prosecution for any offence punishable under this Act or rules made thereunder shall be instituted or no prosecution instituted shall be withdrawn, except with the previous sanction of the Regional Board, Planning Authority, or as the case may be, a Development Authority or any officer authorised by such Board or Authority in this behalf." (emphasis supplied) AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 27/34 00 Cri. APL-369.19(J).odt The language of this provision leaves no manner of doubt that the pre-condition for even "institution of prosecution", is with the previous sanction of the specified Authority. As aforesaid, on noticing unauthorised development or use, it is the Planning Authority who has to first issue notice under Section 53(1) of the Act to enable the noticee (owner) to remedy the objectionable unauthorised development or use; and it is only upon failure to do so within the specified time, and, in absence of permission granted under Section 44 for retention on the land of any building or works or for the continuance of any use of the land, to which the notice relates, the Planning Authority may proceed to prosecute the noticee/owner by virtue of Section 53 (6) of the Act. The prosecution, however, can be instituted only after previous sanction of the Regional Board or Planning Authority or, as the case may be, a Development Authority or any officer authorised by such Board or authority in that behalf.
10. A priori, the Act, being a special enactment, provides mechanism for institution of prosecution against the noticee/owner. In the scheme of things, registration of F.I.R. by the police officer under Section 154 of the Code in relation to offence punishable under the provisions of the said Act cannot be countenanced. More so, the police officer, on his own, even if he notices any unauthorised AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 28/34 00 Cri. APL-369.19(J).odt development or use, cannot proceed to register the F.I.R. under Section 154 of the Code. He has no authority to do so, especially in the face of mandate of Section 142 of the Code that no prosecution for any offence punishable under the said Act or Rules made thereunder shall be instituted, except with the previous sanction of the specified authority."
15. In view of Section 19 of the Environment (Protection) Act which imposes a restriction on the court taking cognizance of offence except on a complaint prescribed in sub-sections (a) and
(b) of Section 19, I do not think the order passed by the learned Magistrate suffers from any legal infirmity. Mr. Desai has rightly placed reliance on the judgment of Patna High Court in Imamullah (supra), where the Court observed as under:
"There was, admittedly, no such complaint made by the public servant concerned, as is warranted by Section 19 of the Environment (Protection) Act, 1986, and, hence, in the case at hand, learned Magistrate could not have taken cognizance of the offence under Section 15 of the Environment (Protection) Act, 1986, read with Noise Pollution (Regulation and Control) Rules, 2000. The impugned order taking cognizance of offence under Section 15 of the Environment (Protection) Act, 1986, is, therefore, set aside.
AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 29/34 00 Cri. APL-369.19(J).odt What emerges from the above discussion is that it would be an exercise in futility if the case is remitted to the learned Magistrate to take cognizance of the offence under Section 188 of the Indian Penal Code, when the learned Magistrate, for the reasons indicated above, lacks jurisdiction to take cognizance of the offence under Section 188 of the Indian Penal Code."
16. Another judgment on which reliance is placed is the judgment of the Jharkhand High Court in the case of Vivek Kumar v. State of Jharkhand reported in 2015 SCC OnLine Jhar 5011, where the aforesaid position is reiterated in the following words:
"7. In view of the ratio decided in the above case, no court shall take cognizance of any offence under this Act except on a complaint made by a competent authority or an officer authorized in this behalf by that Government. In the instant case, the FIR has been lodged by the informant, the Sanitary Inspector of Lohardaga Municipality and the learned counsel for the State has not produced any notification to show that the said informant was authorized to lodge the complaint. Apparently, FIR has been lodged in place of filing the complaint in writing. Thus, the very initiation of the criminal proceeding in the light of the above judgment is not sustainable."
AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 30/34 00 Cri. APL-369.19(J).odt
17. In an another decision the Jharkhand High Court in case of Man Mohan Singh & Ors. v. State of Jharkhand reported in 2008 (2) East Cr. C 532 (Jhr), in reference to Section 19 also took a view to the effect that the FIR lodged by the Regional Officer, Jamshedpur do not stand the eligibility criteria prescribed in Section 19 (a)/(b) and, therefore, by recording that the initiation of proceeding cannot be sustained, the writ petition came to be allowed.
18. Mr. Pratap, learned counsel for the Applicant has relied on the judgment of the Jharkhand High Court dated 02 nd September, 2009 in Writ Petition (Cri.) No.277 of 2006 (Girdhari Agarwal v. State of Jharkhand & Ors.), which revolved around institution of proceedings under Section 37 of the Air (Prevention & Control of Pollution) Act, 1981. The Regional Officer of Jharkhand State Pollution Control Board lodged a FIR, on his visit to the Industrial Unit belonging to the Petitioner and found iron ore being stored, without consent of the Board. The AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 31/34 00 Cri. APL-369.19(J).odt Petitioner is alleged to have contravened the provisions of Section 21 of the Act which was punishable under Section 37 and the institution of the case by the police was challenged on the ground that in terms of Section 43 of the Act one can be prosecuted only on a complaint made by the Board or an officer authorized on its behalf. In the backdrop, a similar worded Section 43 imposing restriction on the court to take cognizance of an offence except on a complaint made by either of the Board or any authorized person or by a person who has given notice not less than 60 days of the alleged offence and of his intention to make a complaint to the Board or the authorized officer, the learned Single Judge took a view that the word "complaint" has not been defined in the Act nor did the Act stipulated the manner in which the case could be instituted or investigated and, in that event, sub-section (2) of Section 4 of the Code of Criminal Procedure would come into play. The learned Judge noted that the offence alleged under the Act is punishable for six years and as per Part-II of Schedule I of the Code of Criminal Procedure, it becomes cognizable and held that once the offence is cognizable, then the FIR is permissible AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 32/34 00 Cri. APL-369.19(J).odt and the procedure contemplated in Section 154 of the Code of Criminal Procedure must follow. With this reasoning, the learned Single Judge concluded that in absence of any provision in the Act relating to institution, investigation, inquiry or trial, the Code of Criminal Procedure would apply and, therefore, the FIR was a permissible mode and as far as taking cognizance is concerned, the Magistrate can take cognizance on the basis of a complaint of an authorized officer which may be filed along with the police report. On this reasoning, the applications filed by the Petitioner were dismissed. I am unable to accede to the reasoning adopted by the learned Judge in Girdhari Agarwal (supra) since once the learned Single Judge has accepted that Section 4(2) of the Code of Criminal Procedure comes into picture in absence of any provision in the special enactment, then the provisions contained in the Code of Criminal Procedure gets displaced by the provisions of the special enactment, which includes the manner in which the cognizance of offences to be taken is contemplated. With due respect to the learned Judge, in my opinion, the said judgment do not lay down the correct position of law.
AJN
::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::
33/34 00 Cri. APL-369.19(J).odt
19. In the light of the settled position of law and the provisions contained in the Environment (Protection) Act, 1986 which is a special enactment, I do not wish to delve into the contention of the learned counsel for the Applicant that Section 154 comprised a pre-cognizance stage and when the police proceed to investigate under Section 154 of the Code of Criminal Procedure, the cognizance stage would come at the stage of Section 173 since there is a fetter created in taking cognizance of an offence without the modality set out in Section 19 of the Environment (Protection) Act. The contention of the Applicant that he is a private person and is at liberty to file FIR with the police disclosing cognizable offence by the accused under Section 15 of the Environment (Protection) Act is without any merit and substance. The present Criminal Application is without any merit and the inherent deficiency noted by the Metropolitan Magistrate in the first instance and the Sessions Court in revision, in not entertaining the complaint by the Applicant cannot be faulted with and both the impugned orders do not call for any AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 ::: 34/34 00 Cri. APL-369.19(J).odt interference. The Criminal Application is dismissed with no order as to costs.
[SMT. BHARATI DANGRE, J.] AJN ::: Uploaded on - 08/11/2019 ::: Downloaded on - 22/04/2020 01:55:43 :::


{% extends "base.html" %} {% block main %}
{{ title }}
Add Device
List Device
Admin Device
About Device


Delete
Logout
Save
Delete
Dashboard
Graphics
Shapes
Background
Text
×
{{model.error}}
×
{{model.message}}
{{model.infographic.name}}
Edit


Are you a woman interested in learning how to build web applications with the latest technologies? We have good news for you: We are holding a one-day workshop for beginners! It will take place on {{ site.data.india-2020.date }} {{ site.data.india-2020.location }}.
During the workshop, you will build and deploy your very first Angular Web Application! Angular is an open-source platform for building a web application, developed by Google and the community. It gives various tools to easily create a dynamic, interactive app that can run on desktop browsers, mobile, and even robots!
Prerequisites:
You would need to have a basic understanding of HTML, CSS, and JavaScript.
That said additional small tasks will be given to you to help you revise basic web technologies
knowledge before the event.
The workshop is free of charge. Just fill out the application form. Don’t wait too long - The seats are limited. So the registration is open till {{ site.data.india-2020.deadline }} or till the seats last. Hurry up! For more information check out the FAQ


Class DonationInfo
Holds information about a donation
Located at iGivefirst/Common.php
public
|
#
__construct( mixed $properties = array() )
Construct a DonationInfo object with a given set of properties Required properties are amount, nonProfitCampaignGuid, publisherCampaignGuid, donorAccountGuid, donorGuid |
public
|
#
setDonation( mixed $amount, mixed $nonProfitCampaignGuid, mixed $publisherCampaignGuid, mixed $donorAccountGuid, mixed $donorGuid )
Set donation information from amount and guids |
public
|
|
public
|
public
mixed
|
$dateCreated |
|
|
public
mixed
|
$amount |
|
|
public
mixed
|
$sponsorMatchingPercentage |
|
|
public
mixed
|
$nonProfitCampaignGuid |
|
|
public
mixed
|
$publisherCampaignGuid |
|
|
public
mixed
|
$sponsorCampaignGuid |
|
|
public
mixed
|
$publisherGuid |
|
|
public
mixed
|
$donorAccountGuid |
|
|
public
mixed
|
$donorGuid |
|
|
public
mixed
|
$publisherTransactionId |
|


Ice Shelf:
To work, then. Which tool should I use to begin?
Trim with a chisel.
Trim with a scraper.


Usage
To start building forms with this plugin simply call formBuilder()
on the textarea you would like to make your editor. FormBuilder takes a number of options and is translatable through these options.
jQuery(document).ready(function($) {
'use strict';
var template = document.getElementById('form-builder-template');
$(template).formBuilder();
});
Build The Form
Render The Form
Once you've created a form you'll need a way to render it. formRender is the companion plugin to formBuilder that renders the form data. To use you''ll call formRender on the textarea
containing your saved data like so:
var template = document.getElementById('form-builder-template');
$(template).formRender();
By default formRender()
will replace the textarea with the rendered form but passing a container
option to the plugin will render the form to the specified jQuery object. Example:
var template = document.getElementById('form-builder-template'),
formContainer = document.getElementById('rendered-form'),
formRenderOpts = { container: $(formContainer) };
$(template).formRender(formRenderOpts);
Try it out
Thank you
If you found this plugin useful or even mildly interesting why not tweet about it? Tweet


Terms of Service
Use of this service is governed by the following terms and conditions. Please read these terms and conditions carefully, as by using this website you will be deemed to have agreed to them. If you do not agree with these terms and conditions, do not use this service.
The personal information you provide (Name, Email) will be used for the sole purpose of issuing the BC DevOps Verified Credential.
Limitation of Liabilities
Under no circumstances will the Government of British Columbia be liable to any person or business entity for any direct, indirect, special, incidental, consequential, or other damages based on any use of this website or any other website to which this site is linked, including, without limitation, any lost profits, business interruption, or loss of programs or information, even if the Government of British Columbia has been specifically advised of the possibility of such damages.


[§431:3A-504] Rules. The commissioner may adopt rules pursuant to chapter 91 to further the purposes of this article. [L 2001, c 220, pt of §1]


The dialog element
This is some text.
This is some text.
This is an open dialog window
This is some text.
This is some text.
Note:
The dialog tag is not supported in Safari and Edge (prior version 79).


Open existing PhoneGap Application
Choose the directory to your existing phonegap project.
Your directory path:
Select project path
Open project


http://action.vday.org/site/R?i=v7tUE4i45pUvpR1O0HfeIg
http://action.vday.org/site/R?i=rOLv3FCHm0AOOUrdd03woA
http://action.vday.org/site/R?i=XsH5wq-vGn2OT5VSJ7Ijug
http://action.vday.org/site/R?i=m0Y-DSE9qR3VA67XfSPhjA
We Are Rising at Sundance! ONE BILLION RISING Short Film Accepted!
V-Day is excited to announce that our newest short film,
http://action.vday.org/site/R?i=JCe1PTVjE5CcxxzsVsb89Q
ONE BILLION RISING, will world premiere at the 2014 Sundance Film
Festival beginning January 19th!
ONE BILLION RISING features footage from activists in over 207
countries and showcases the radical awakening of body and
consciousness that took place in 2013.
To mark the premiere Sundance screening, V-Day will release the film
online to the world. We invite all of our activists to screen it on
that day, and in the days leading up to 14 February to inspire your
communities to RISE for JUSTICE!
So gather your friends and family in houses, dorms, movie theaters,
stadiums, auditoriums, parks, malls, everywhere, and get ready to
RISE!
Going to Sundance? Here’s where it’s playing:
* Sunday, 19 January, 11:30am - Prospector, Park City
* Tuesday, 21 January, 3:00pm - Yarrow, Park City
* Wednesday, 22 January, 6:00pm - Broadway 6, Salt Lake City
* Thursday, 23 January, 9:00pm - Temple Theatre, Park City
* Friday, 24 January, Noon - Sundance Resort, Provo
* Saturday, 25 January, 10:00am - Holiday 4, Park City
Tickets required in advance >
http://action.vday.org/site/R?i=46kYMkoo-t4QshEcs8nWWg
The 2014 Short Film program at Sundance is comprised of 66
films selected from a record 8,161 submissions. ONE BILLION RISING is
directed by Eve Ensler and Tony Stroebel, with activists in 207
countries, and is produced by Eve and V-Day.
WATCH the trailer, “Rising” >
http://action.vday.org/site/R?i=oZ-gaehPT89AmBEiZFlbXg
READ the full announcement & line up >
http://action.vday.org/site/R?i=FGk9fbsfpOsi2GSKPQ9GyQ
Eve’s New Piece In The Guardian: One Billion Rising: the 2014 Campaign
to End Violence Against Women
Want to know why we’re RISING for Justice in 2014? Check out the
latest piece by Eve in The Guardian, and join us on 14 February to
RISE, RELEASE, and DANCE
http://action.vday.org/site/R?i=RRaRWmFeELaEY3cCVet2gA
“This year we are escalating and deepening the campaign with One
Billion Rising for Justice. Justice is about restoring the primacy of
connection so that we understand that violence against women is not a
personal problem, but connected to other systemic injustices whether
they be patriarchal, economic, racial, gender, or environmental…this
year we will go further, releasing, dancing, putting our bodies on the
line with specific demands and visions that through our numbers,
solidarity and energy cannot be denied. Come rise with us.”
http://action.vday.org/site/R?i=wNgyE33HrzNoCxAruwMIKA
READ full piece >
http://action.vday.org/site/R?i=pDQtORbwZu9s8NQd4OCzWA
WANT MORE? Check Out These Recent Articles on Eve and One Billion
Rising for Justice:
Agence France-Presse: “Ensler Hails India’s ‘Upheaval’ A Year After
Fatal Gang-Rape” >
http://action.vday.org/site/R?i=UJFqIObJnFg0co6adq3jsQ
Guernica: “Eve Ensler: Our Work Now Is Embodiment” >
http://action.vday.org/site/R?i=5lqI6W6vWnOpXDbqPOdmhg
http://action.vday.org/site/R?i=rczGBddVDGHWnEJkZ-tHQw
http://action.vday.org/site/R?i=lL8sOgj8xaUeeeXyQw0fWw
http://action.vday.org/site/R?i=nZ-FczRJheq7x_HhmVHo8A
http://action.vday.org/site/R?i=-GP81LB8TRdKZmdJ-oi5IA
http://action.vday.org/site/R?i=1Z3PQqkIIut5RtyGTxNIsQ
unsubscribe
http://action.vday.org/site/CO?i=BZrOtHEf0GzJqvUPWGeSAjYvbJpSV7FA&cid=1062
Powered By Blackbaud


zip.js
A JavaScript library to zip and unzip files
Read a zip file demo
choose a zip file
choose temporary storage
RAM
HDD
download zip content


The spring programme of the MIPTL research events is taking shape. We are very excited to present a series of work, ranging from modified pianos through networked performances and biological symphonies to procedural generation in computer games. In designing the events we have tried to include three elements: musical performance, a talk, and a workshop, where the visiting researcher engages with Sussex students and researchers.
Chris Kiefer (Wednesday, February 11th)
Research seminar (Recital Room, 1-1.50pm) – Experiments with Mutiparametric Musical Instruments
We start the programme with our very own Chris Kiefer (Informatics) who will present his diverse work in the design of musical instruments, ranging from studies in adaptive interfaces using neural networks to physical live coding interfaces.
Kelly Snook (Wednesday, February 25th)
Research talk (Recital Room, 1-1.50pm) – Interactive Data Sonification Using mi.mu Gloves
Dr Kelly Snook is a former NASA planetary scientist now researching data sonification. She is a founding member of the research team working on the mi.mu Gloves with Imogen Heap and other music technologists from the UK and Europe
Leafcutter John (Thursday, March 5th)
Performance (Meeting House 1.20pm)
Talk and a workshop (in RR 2-7pm) – Musical Automata and Sound Sculptures
Leafcutter John will give a performance and then lead a workshop in musical automata sound sculptures, using the popular Arduino technology, and resulting in a robotic big-band.
Halldor Ulfarsson (Wednesday, March 18th)
Research talk (Recital Room at 1pm) – Results of open ended acoustic investigations at the IAA
Seminar (Recital Room 2-7pm)
Halldor Ulfarsson will present his research around the highly impressive Halldorophone musical instrument (here performed by Hildur Gudnadottir). After the talk, he will give a seminar and a masterclass in acoustic research and instrument making.
Tom Betts (Friday, March 20th)
Research talk (location TBC) – The Sublime in Computer Games: Procedurally Generated Audiovisual Worlds
Tom Betts has a background in music, programming, digital design and computer games. His latest work is “Sir, You are Being Hunted“, but Tom’s talk will also cover generative art and algorithmic thinking.
Andrew McPherson (Thursday, March 26th)
Performance (1.20 pm in the Recital Room) – Electromagnetic Piano
Talk and a Workshop (2pm in Recital Room) – On composing for the electromagnetic piano.
Andrew McPherson is an innovator in new musical instruments. Although known in the world of musical instruments for a successful Kickstarter campaign, he will bring his electromagnetic piano to our research event here at Sussex.
Tim Shaw and Sébastien Piquemal (Thursday, April 9th)
Performance (Meeting House at 1.20pm) – Fields
Talk and workshop (Recital Room, 2-6pm) – Networked, collaborative music
Tim Shaw and Sébastien Piquemal will perform their networked, distributed, multi-device, multi-channel piece “Fields” in the Meeting House. Bring a networked device (phone, tablet, laptop). The workshop will focus on similar topics.
Daniel Jones (Wednesday, April 15th)
Artist talk (Recital Room at 2-4pm) – Living Symphonies and Phantom Terrains.
Daniel Jones is a multi-talented artist and researcher know for his sound art work. He will present resent work, for example the Living Symphonies and Phantom Terrains projects.


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.apache.spark.Partitioner org.apache.spark.RangePartitioner<K,V>
public class RangePartitioner<K,V>
A Partitioner
that partitions sortable records by range into roughly
equal ranges. The ranges are determined by sampling the content of the RDD passed in.
Note that the actual number of partitions created by the RangePartitioner might not be the same
as the partitions
parameter, in the case where the number of sampled records is less than
the value of partitions
.
| Constructor Summary | |
|---|---|
RangePartitioner(int partitions,
RDD<? extends scala.Product2<K,V>> rdd,
boolean ascending,
scala.math.Ordering<K> evidence$1,
scala.reflect.ClassTag<K> evidence$2)
|
| Method Summary | ||
|---|---|---|
static
|
determineBounds(scala.collection.mutable.ArrayBuffer<scala.Tuple2<K,Object>> candidates,
int partitions,
scala.math.Ordering<K> evidence$4,
scala.reflect.ClassTag<K> evidence$5)
Determines the bounds for range partitioning from candidates with weights indicating how many items each represents. |
|
boolean |
equals(Object other)
|
|
int |
getPartition(Object key)
|
|
int |
hashCode()
|
|
int |
numPartitions()
|
|
static
|
sketch(RDD<K> rdd,
int sampleSizePerPartition,
scala.reflect.ClassTag<K> evidence$3)
Sketches the input RDD via reservoir sampling on each partition. |
| Methods inherited from class org.apache.spark.Partitioner |
|---|
defaultPartitioner |
| Methods inherited from class Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RangePartitioner(int partitions, RDD<? extends scala.Product2<K,V>> rdd, boolean ascending, scala.math.Ordering<K> evidence$1, scala.reflect.ClassTag<K> evidence$2)
| Method Detail |
|---|
public static <K> scala.Tuple2<Object,scala.Tuple3<Object,Object,Object>[]> sketch(RDD<K> rdd, int sampleSizePerPartition, scala.reflect.ClassTag<K> evidence$3)
rdd
- the input RDD to sketchsampleSizePerPartition
- max sample size per partitionevidence$3
- (undocumented)
public static <K> Object determineBounds(scala.collection.mutable.ArrayBuffer<scala.Tuple2<K,Object>> candidates, int partitions, scala.math.Ordering<K> evidence$4, scala.reflect.ClassTag<K> evidence$5)
candidates
- unordered candidates with weightspartitions
- number of partitionsevidence$4
- (undocumented)evidence$5
- (undocumented)
public int numPartitions()
numPartitions
in class Partitioner
public int getPartition(Object key)
getPartition
in class Partitioner
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


The New Survivalist
|
|
|
Chapter 1:
|
|
|
A Lesson from KatrinaOn August 29, 2005, the Gulf Coast states were struck by the worst hurricane in U.S. history. Hurricane Katrina, a category 5 storm, devastated Southern Mississippi and Louisiana leaving over 1,800 people dead. Another 1,800 were reported missing. Storm surges breached the levees of New Orleans resulting in massive flooding. Thousands of people were driven from their homes and many were stranded by rising waters. The impact of the disaster was enormous in both human and economic terms. The Bush Administration initially asked Congress for $105 billion for reparations, but the full economic impact of the disaster would eventually prove to be even greater, due to its effects on the region's industries and to massive environmental damage. To the residents who were caught in the aftermath of the storm, Katrina was a lesson in the inadequacy of local, state and federal governments, who failed to respond in a timely manner during their time of desperate need. While thousands of residents were stranded without food or water, overwhelmed law enforcement officials were forced to turn their attention from rescue efforts to mob control. Looting was widespread throughout New Orleans and gunfire was reported in many parts of the city. Eye witnesses reported incidents of murder, rape and robbery occurring in the streets, even during daylight hours. There were also reports of abuse and looting on the part of some law enforcement officials. Hurricane victims in Mississippi did not experience crime and violence to the extent of that felt in New Orleans, but they did experience the same frustrations as far as rescue and relief efforts were concerned. In the weeks and months that followed the disaster, government officials and agencies would be harshly criticized for the inadequacies that came to light during this emergency. "Trust Yourself, Not the Government" Ron Paul Farewell address to Congress, Nov. 14, 2012 (Read) For those of us interested in disaster preparedness, a lot can be learned from Katrina. Perhaps the most important lesson is: Don't rely on the government! Each individual must take responsibility for his or her own emergency preparedness! For days after Katrina, people were stranded on their rooftops with no food or drinking water, as toxic flood waters surrounded and engulfed their homes. How much better off would those individuals have been if they had made a few simple preparations in advance? What if, as they had been forced to leave their homes, they had grabbed their "bug out" bags stashed with food, water and other emergency supplies, such as signaling devices or flashlights? How many lives would have been saved if each individual had simply made adequate provisions for emergency drinking water? As devastating as the storm was, Katrina was a disaster that affected only one area of the nation. Over 95% of the country was not directly touched by the storm, and many people would eventually be able to lend a helping hand to its victims. But what would we do in the event of a nationwide disaster? In such a catastrophe we might not be able to rely on help from our friends in neighboring states, for they might be as bad off as we are. Instead of taking days to respond, we might not see emergency relief for weeks or even months! In such an emergency there could be a complete breakdown in law enforcement and governmental infrastructure. The reader may think that such a nationwide emergency is unlikely in a modern society such as ours. But as you will see in the chapters that follow, not only is it possible, but some experts believe that such a disaster could be imminent, perhaps even within the next decade. Furthermore, in the current economic environment in which nations are dependent upon trade with other nations, a far-reaching disaster will probably not be limited by national borders. A national emergency could easily become a global one! After a disaster the local police are usually overwhelmed, so the National Guard is often dispatched to help. But during a national emergency even the National Guard may be overwhelmed. (All photographs are by the author unless otherwise acknowledged.) |
|
Emergency Preparedness and Disaster ManagementThe premise of this web site is that every able individual should take responsibility for his or her disaster preparedness, rather than rely on others, such as the local, state or federal government, to do it for them. No one will ever have more interest in your welfare than you. If you are prepared when a disaster strikes, you will not only be better able to help yourself, you will also be able to lend a helping hand to others, and the authorities will be better able to concentrate their efforts where it is needed most, on search and rescue efforts for example. The steps you will take to meet your preparedness goals will depend on the types of emergencies or disasters that you think are possible for your area. You might perceive an earthquake to be one of your greatest threats, while my fears might include a dirty nuclear bomb set off by terrorists. Although much of our preparedness efforts will be samewe will both need to stash food and water for exampleI might also want to build a fallout shelter in my basement and stow away a Geiger counter. You will probably perceive these as unnecessary steps, preferring instead to earthquake-proof your home. In addition to the types of emergency items that we will choose to store, the quantity that we will want to stash will depend on how long we think our emergencies could last. It will therefore be beneficial at this time to explore the various kinds of emergencies or disasters that we might see as threats to our survival. |
|
Types of DisastersWe can divide disasters into two broad categories:
We can further divide these into the following:
|
|
Disasters Resulting from Human ActivitiesThese can include:
|
|
Natural DisastersIncluding:
Of course combinations from the above lists can occur. For example, after Hurricane Katrina (a natural disaster), there were incidents of civil disturbance and looting (human activities) as well as accidents involving toxic substances, water pollution and even misallocation of resources and failure of governments to provid needed services. |
|
Action Step 1: Your Action PlannerBefore proceeding further, I suggest that you acquire a notebook and begin taking notes. You will be using this notebook for the remainder of this web site and it will be an essential part of organizing and completing your preparedness plans. We will call this notebook your Action Planner. On the first page of your Action Planner write "Disasters or Emergencies that Concern Me:" Under the heading, make a list of both the human-caused and natural disasters that you would like to be prepared for, leaving two or three blank lines below each one for the next exercise. You can use the lists above to help you, but don't hesitate to add others that are not included on my lists. Write down all of the disasters or emergencies that you perceive as possible threats to your survival. This will help you at a later stage, when you will be compiling your preparedness checklists. |
|
Magnitude of DisastersWhether a result of human activities or natural, disasters can be further divided into the following categories depending on the scope or area affected: Local Disasters are limited to your property and/or local community. Examples would include tornados, which could level or otherwise severely damage your home and/or the homes of your neighbors. Another example would be the derailment of a freight train resulting in the release of toxic gases from a tanker car into your neighborhood and surrounding area. Other examples would include floods and forest fires. Regional Disasters effect a larger area but are limited to one region of the country. Hurricane Katrina was an example of a regional disaster. Other examples would include earthquakes, droughts and crop failures. National Disasters as the name implies would affect the entire nation. A war would be an example. Other examples would include an economic depression, severe stock market crash or collapse of the currency. Global Disasters affect the entire planet. In today's global economy it would be easy for a national disaster to quickly escalate to a global one. An economic depression in the US, for example, would affect our trading partners as well. With the US dollar acting as the major reserve currency for most of the world, a collapse of the currency would be disastrous for nearly every nation, including those as far off as China and Japan. In fact, never before in history has the potential for a human-caused disaster of global proportions been more possible. In our highly-mobile society it is also very possible for a natural disaster, such as an epidemic, to quickly spread around the globe becoming a pandemic. Furthermore, according to many scientists, human activities, such as pollution, radioactive contamination, chemtrails, and genetically-modified organisms (GMO) to name just a few, are threatening the delicate ecological balance that has existed on the Earth for millions of years. As we have seen, the amount of provisions that you will want to store will depend on how long you anticipate an emergency could last, which in turn will depend on the magnitude or scope of the disasters that you consider possible for your area. If a hurricane hits your community, a one-week supply of food and water will probably be sufficient, for certainly help will arrive within a week. But a collapse of the currency, resulting in a global disaster, might require that you store enough supplies to last for months. |
|
Action Step 2: Scope and Duration
A. In your Action Planner, under the heading "Disasters or Emergencies that Concern Me:" you should have a list, which you made in Action Step 1, of both the human-caused and natural disasters that you would like to be prepared for with a few lines of space between each one. Now consider each item on your list and write in the space below it what you would anticipate the magnitude or scope of the emergency would be, whether local, regional, national or global. If you find the item in a gray area between two categories, move up to the category involving the larger scope. For example, if you have "earthquake" on your list and are not sure whether it will be a local disaster or a regional one, go ahead and put it down as a regional disaster. If you are prepared for a major earthquake which might knock out local services, such as water and electricity, for one month, then you should find a smaller earthquake that would result in a loss of services for two or three days to be easy to handle. But if you are only prepared for two or three days, then you are going to be very uncomfortable if your services are not restored until a full month after the event! It is far better to be over-prepared than under. In fact, you could probably never be over-prepared for any emergency.
B. In your Action Planner, for each item that you wrote in step A, write down what you would anticipate the most likely duration would be for that disaster or emergency. Keep in mind that the duration will depend on the scope or magnitude of the emergency. A local disaster, such as a tornado, might result in the loss of services for a few days. A regional disaster, such as an earthquake (or a hurricane like Katrina) might result in the loss of services for a few weeks or even a month or two. A national or global disaster might result in a loss of services for many months. You now have a list of the disasters or emergencies that you perceive to be your greatest threats, and an idea of the magnitude and duration that those disasters are likely to involve. You will use this information to help you decide on how long a siege you will want to be prepared for and how many provisions you will want to store. Congratulations! You have accomplished an important first step toward your preparedness goals. You are already far ahead of the crowd! You are now ready to continue to the next chapter, where we will explore the importance of having a plan, and help you accomplish the next important step toward your preparedness goals. |
|
Recommended Reading: |
|
|
Hard-hitting Biblically Based Rock & Roll! |


--- layout: post title: "Changing your organisation" description: "Or: How do I convince X to adopt Y in software development?" date: 2021-12-20 6:41 UTC tags: [Miscellaneous] --- {% include JB/setup %}
{{ page.description }}
In January 2012 a customer asked for my help with software architecture. The CTO needed to formulate a strategy to deal with increasing demand for bring-your-own-device (BYOD) access to internal systems. Executives brought their iPhones and iPads to work and expected to be able to access and interact with custom-developed and bespoke internal line-of-business applications.
Quite a few of these were running on the Microsoft stack, which was the reason Microsoft Denmark had recommended me.
I had several meetings with the developers responsible for enabling BYOD. One guy, in particular, kept suggesting a Silverlight solution. I pointed out that Silverlight wouldn't run on Apple devices, but he wouldn't be dissuaded. He was certain that this was the correct solution, and I could tell that he became increasingly frustrated with me because he couldn't convince me.
We'll return to this story later in this essay.
Sometimes people ask me questions like these:
Sometimes I receive such questions via email. Sometimes people ask me at conferences or user groups.
To quote Eric Lippert: Why are you even asking me?
To be fair, I do understand why people ask me, but I have few good answers.
I suppose people ask me because I've been writing about software improvement for decades. This blog dates back to January 2009, and my previous MSDN blog goes back to January 2006. These two resources alone contain more than 700 posts, the majority of which are about some kind of suggested improvement. Granted, there's also the occasional rant, by I think it's fair to say that my main motivation for writing is to share with readers what I think is right and good.
I do write a lot about potential improvements to software development.
As most readers have discovered, my book about Dependency Injection (with Steven van Deursen) is more than just a manual to a few Dependency Injection Containers, and my new book Code That Fits in Your Head is full of suggested improvements.
Add to that my Pluralsight courses, my Clean Coders videos, and my conference talks, and there's a clear pattern to most of my content.
In The Tipping Point Malcolm Gladwell presents a model for information dissemination, containing three types of people required for an idea to take hold: Connectors, mavens, and salesmen.
In that model, a maven is an 'information specialist' - someone who accumulates knowledge and shares it with others. If I resemble any of these three types of people, I'm a maven. I like learning and discovering new ways of doing things, and obviously I like sharing that information. I wouldn't have blogged consistently for sixteen years if I didn't feel compelled to do so.
My role, as I see it, is to find and discover better ways of writing software. Much of what I write about is something that I've picked up somewhere else, but I try to present it in my own way, and I'm diligent about citing sources.
When people ask me concrete questions, like how do I refactor this piece of code? or how do write this in a more functional style?, I present an answer (if I can).
The suggestions I make are just that: It's a buffet of possible solutions to certain problems. If you encounter one of my articles and find the proposed technique useful, then that makes me happy and proud.
Notice the order of events: Someone has a problem, finds my content, and decides that it looks like a solution. Perhaps (s)he remembers my name. Perhaps (s)he feels that I helped solve a problem.
Audience members that come to my conference talks, or readers who buy my books, may not have a concrete problem to solve, but they still voluntarily seeks me out - perhaps because of previous exposure to my content.
To reiterate:
Perhaps you think that I convinced you that 'my way' is best. I didn't. You were already looking for a solution. You were ready for a change. You were open.
When you ask me about how to convince your manager, or your team mates, you're no longer asking me a technical question. Now you're asking about how to win friends and influence people. You don't need a maven for that; you need a salesman. That's not me.
I've had some success applying changes to software organisations, but in all cases, the reason I was there in the first place was because the organisation itself (or members thereof) had asked me to come and help them. When people want your help changing things, convincing them to try something new isn't a hard sell.
When I consult development teams, I'm not there to sell them new processes; I'm there to help them use appropriate solutions at opportune moments.
I'm not a salesman. Just because I convinced you that, say, property-based testing is a good idea doesn't mean I can convince anyone else. Keep in mind that I probably convinced you because you were ready for a change.
Your manager or your team mates may not be.
While I'm no salesman, I've managed to turn people around from time to time. The best strategy, I've found, is to wait for an opportunity.
As long as everything is going well, people aren't ready to change.
"Only a crisis - actual or perceived - produces real change. When that crisis occurs, the actions that are taken depend on the ideas that are lying around. That, I believe, is our basic function: to develop alternatives to existing policies, to keep them alive and available until the politically impossible becomes the politically inevitable"
If you have solutions at the ready, you may be able to convince your manager or your colleagues to try something new if a crisis occurs. Don't gloat - just present your suggestion: What if we did this instead?
Indeed, I'm not a salesman, and while I can't tell you how to sell an idea to an unwilling audience, I can tell you how you can weaken your position: Make it all about you.
Notice how questions like the above are often phrased: my manager will not let me... or how do I convince my colleagues?
I actually didn't much like How to Win Friends and Influence People, but it does present the insight that in order to sway people, you have to consider what's in it for them.
I had to be explicitly told this before I learned that lesson.
In the second half of the 2000s I was attached to a software development project at a large Danish company. After a code review, I realised that the architecture of the code was all wrong!
In order to make the project manager aware of the issue, I wrote an eight-page internal 'white paper' and emailed it to the project manager (let's call him Henk).
Nothing happened. No one addressed the problem.
A few weeks later, I had a scheduled one-on-one meeting with my own manager in Microsoft, and when asked if I had any issues, I started to complain about this problem I'd identified.
My manager looked at me for a moment and asked me: How do you think receiving that email made Henk feel?
It had never crossed my mind to think about that. It was my problem! I discovered it! I viewed myself as a great programmer and architect because I had perceived such a complex issue and was able to describe it clearly. It was all about me, me, me.
When we programmers ask how to convince our managers to 'let us' use TDD, or FP, or some other 'cool' practice, we're still focused on us. What's in it for the manager?
When we talk about code quality and lack thereof, 'ugly code', refactoring, and other such language, a non-coding manager is likely to see us as primadonnas out of touch with reality: We have features to ship, but the programmers only care about making the code 'pretty'.
I offer no silver bullet to convince other people that certain techniques are superior, but do consider introducing suggestions by describing the benefits they bring: Wouldn't it be cool if we could decrease our testing phase from three weeks to three days?, Wouldn't it be nice if we could deploy every week?, Wouldn't it be nice if we could decrease the number of errors our users encounter?
Have you ever felt frustrated that you couldn't convince other people to do it your way, despite knowing that you were right?
Recall the developer from the introduction, the one who kept insisting that Silverlight was the right solution to the organisation's BYOD problem. He was clearly convinced that he had the solution, and he was frustrated that I kept rejecting it.
We may scoff at such obvious ignorance of facts, but he had clearly drunk the Microsoft Kool-Aid. I could tell, because I'd been there myself. When you're a young programmer, you may easily buy into a compelling narrative. Microsoft evangelists were quite good at their game back then, as I suppose their Apple and Linux counterparts were and are. As an inexperienced developer, you can easily be convinced that a particular technology will solve all problems.
When you're young and inexperienced, you can easily feel that you're absolutely right and still be unequivocally wrong.
Consider this the next time you push your agenda. Perhaps your manager and colleagues reject your ideas because they're actually bad. A bit of metacognition is often appropriate.
How do you convince your manager or team mates to do things better?
I don't know; I'm not a salesman, but in this essay, I've nonetheless tried to reflect on the question. I think it helps to consider what the other party gains from accepting a change, but I also think it's a waiting game. You have to be patient.
As an economist, I could also say much about incentives, but this essay is already long enough as it is. Still, when you consider how your counterparts react to your suggestions, reflect on how they are incentivised.
Even if you do everything right, make the best suggestions at the most opportune times, you may find yourself in a situation systemically rigged against doing the right thing. Ultimately, as Martin Fowler quipped, either change your organisation, or change your organisation.


#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import sys
import warnings
from pyspark import since
from pyspark.rdd import PythonEvalType
from pyspark.sql.column import Column
from pyspark.sql.dataframe import DataFrame
class PandasGroupedOpsMixin(object):
"""
Min-in for pandas grouped operations. Currently, only :class:`GroupedData`
can use this class.
"""
@since(2.3)
def apply(self, udf):
"""
It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes a
:meth:`pyspark.sql.functions.pandas_udf` whereas
:meth:`pyspark.sql.GroupedData.applyInPandas` takes a Python native function.
.. note:: It is preferred to use :meth:`pyspark.sql.GroupedData.applyInPandas` over this
API. This API will be deprecated in the future releases.
:param udf: a grouped map user-defined function returned by
:func:`pyspark.sql.functions.pandas_udf`.
>>> from pyspark.sql.functions import pandas_udf, PandasUDFType
>>> df = spark.createDataFrame(
... [(1, 1.0), (1, 2.0), (2, 3.0), (2, 5.0), (2, 10.0)],
... ("id", "v"))
>>> @pandas_udf("id long, v double", PandasUDFType.GROUPED_MAP) # doctest: +SKIP
... def normalize(pdf):
... v = pdf.v
... return pdf.assign(v=(v - v.mean()) / v.std())
>>> df.groupby("id").apply(normalize).show() # doctest: +SKIP
+---+-------------------+
| id| v|
+---+-------------------+
| 1|-0.7071067811865475|
| 1| 0.7071067811865475|
| 2|-0.8320502943378437|
| 2|-0.2773500981126146|
| 2| 1.1094003924504583|
+---+-------------------+
.. seealso:: :meth:`pyspark.sql.functions.pandas_udf`
"""
# Columns are special because hasattr always return True
if isinstance(udf, Column) or not hasattr(udf, 'func') \
or udf.evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:
raise ValueError("Invalid udf: the udf argument must be a pandas_udf of type "
"GROUPED_MAP.")
warnings.warn(
"It is preferred to use 'applyInPandas' over this "
"API. This API will be deprecated in the future releases. See SPARK-28264 for "
"more details.", UserWarning)
return self.applyInPandas(udf.func, schema=udf.returnType)
@since(3.0)
def applyInPandas(self, func, schema):
"""
Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result
as a `DataFrame`.
The function should take a `pandas.DataFrame` and return another
`pandas.DataFrame`. For each group, all columns are passed together as a `pandas.DataFrame`
to the user-function and the returned `pandas.DataFrame` are combined as a
:class:`DataFrame`.
The `schema` should be a :class:`StructType` describing the schema of the returned
`pandas.DataFrame`. The column labels of the returned `pandas.DataFrame` must either match
the field names in the defined schema if specified as strings, or match the
field data types by position if not strings, e.g. integer indices.
The length of the returned `pandas.DataFrame` can be arbitrary.
:param func: a Python native function that takes a `pandas.DataFrame`, and outputs a
`pandas.DataFrame`.
:param schema: the return type of the `func` in PySpark. The value can be either a
:class:`pyspark.sql.types.DataType` object or a DDL-formatted type string.
>>> import pandas as pd # doctest: +SKIP
>>> from pyspark.sql.functions import pandas_udf, ceil
>>> df = spark.createDataFrame(
... [(1, 1.0), (1, 2.0), (2, 3.0), (2, 5.0), (2, 10.0)],
... ("id", "v")) # doctest: +SKIP
>>> def normalize(pdf):
... v = pdf.v
... return pdf.assign(v=(v - v.mean()) / v.std())
>>> df.groupby("id").applyInPandas(
... normalize, schema="id long, v double").show() # doctest: +SKIP
+---+-------------------+
| id| v|
+---+-------------------+
| 1|-0.7071067811865475|
| 1| 0.7071067811865475|
| 2|-0.8320502943378437|
| 2|-0.2773500981126146|
| 2| 1.1094003924504583|
+---+-------------------+
Alternatively, the user can pass a function that takes two arguments.
In this case, the grouping key(s) will be passed as the first argument and the data will
be passed as the second argument. The grouping key(s) will be passed as a tuple of numpy
data types, e.g., `numpy.int32` and `numpy.float64`. The data will still be passed in
as a `pandas.DataFrame` containing all columns from the original Spark DataFrame.
This is useful when the user does not want to hardcode grouping key(s) in the function.
>>> df = spark.createDataFrame(
... [(1, 1.0), (1, 2.0), (2, 3.0), (2, 5.0), (2, 10.0)],
... ("id", "v")) # doctest: +SKIP
>>> def mean_func(key, pdf):
... # key is a tuple of one numpy.int64, which is the value
... # of 'id' for the current group
... return pd.DataFrame([key + (pdf.v.mean(),)])
>>> df.groupby('id').applyInPandas(
... mean_func, schema="id long, v double").show() # doctest: +SKIP
+---+---+
| id| v|
+---+---+
| 1|1.5|
| 2|6.0|
+---+---+
>>> def sum_func(key, pdf):
... # key is a tuple of two numpy.int64s, which is the values
... # of 'id' and 'ceil(df.v / 2)' for the current group
... return pd.DataFrame([key + (pdf.v.sum(),)])
>>> df.groupby(df.id, ceil(df.v / 2)).applyInPandas(
... sum_func, schema="id long, `ceil(v / 2)` long, v double").show() # doctest: +SKIP
+---+-----------+----+
| id|ceil(v / 2)| v|
+---+-----------+----+
| 2| 5|10.0|
| 1| 1| 3.0|
| 2| 3| 5.0|
| 2| 2| 3.0|
+---+-----------+----+
.. note:: This function requires a full shuffle. All the data of a group will be loaded
into memory, so the user should be aware of the potential OOM risk if data is skewed
and certain groups are too large to fit in memory.
.. note:: If returning a new `pandas.DataFrame` constructed with a dictionary, it is
recommended to explicitly index the columns by name to ensure the positions are correct,
or alternatively use an `OrderedDict`.
For example, `pd.DataFrame({'id': ids, 'a': data}, columns=['id', 'a'])` or
`pd.DataFrame(OrderedDict([('id', ids), ('a', data)]))`.
.. note:: Experimental
.. seealso:: :meth:`pyspark.sql.functions.pandas_udf`
"""
from pyspark.sql import GroupedData
from pyspark.sql.functions import pandas_udf, PandasUDFType
assert isinstance(self, GroupedData)
udf = pandas_udf(
func, returnType=schema, functionType=PandasUDFType.GROUPED_MAP)
df = self._df
udf_column = udf(*[df[col] for col in df.columns])
jdf = self._jgd.flatMapGroupsInPandas(udf_column._jc.expr())
return DataFrame(jdf, self.sql_ctx)
@since(3.0)
def cogroup(self, other):
"""
Cogroups this group with another group so that we can run cogrouped operations.
See :class:`CoGroupedData` for the operations that can be run.
"""
from pyspark.sql import GroupedData
assert isinstance(self, GroupedData)
return PandasCogroupedOps(self, other)
[docs]class PandasCogroupedOps(object):
"""
A logical grouping of two :class:`GroupedData`,
created by :func:`GroupedData.cogroup`.
.. note:: Experimental
.. versionadded:: 3.0
"""
def __init__(self, gd1, gd2):
self._gd1 = gd1
self._gd2 = gd2
self.sql_ctx = gd1.sql_ctx
[docs] @since(3.0)
def applyInPandas(self, func, schema):
"""
Applies a function to each cogroup using pandas and returns the result
as a `DataFrame`.
The function should take two `pandas.DataFrame`\\s and return another
`pandas.DataFrame`. For each side of the cogroup, all columns are passed together as a
`pandas.DataFrame` to the user-function and the returned `pandas.DataFrame` are combined as
a :class:`DataFrame`.
The `schema` should be a :class:`StructType` describing the schema of the returned
`pandas.DataFrame`. The column labels of the returned `pandas.DataFrame` must either match
the field names in the defined schema if specified as strings, or match the
field data types by position if not strings, e.g. integer indices.
The length of the returned `pandas.DataFrame` can be arbitrary.
:param func: a Python native function that takes two `pandas.DataFrame`\\s, and
outputs a `pandas.DataFrame`, or that takes one tuple (grouping keys) and two
pandas ``DataFrame``s, and outputs a pandas ``DataFrame``.
:param schema: the return type of the `func` in PySpark. The value can be either a
:class:`pyspark.sql.types.DataType` object or a DDL-formatted type string.
>>> from pyspark.sql.functions import pandas_udf
>>> df1 = spark.createDataFrame(
... [(20000101, 1, 1.0), (20000101, 2, 2.0), (20000102, 1, 3.0), (20000102, 2, 4.0)],
... ("time", "id", "v1"))
>>> df2 = spark.createDataFrame(
... [(20000101, 1, "x"), (20000101, 2, "y")],
... ("time", "id", "v2"))
>>> def asof_join(l, r):
... return pd.merge_asof(l, r, on="time", by="id")
>>> df1.groupby("id").cogroup(df2.groupby("id")).applyInPandas(
... asof_join, schema="time int, id int, v1 double, v2 string"
... ).show() # doctest: +SKIP
+--------+---+---+---+
| time| id| v1| v2|
+--------+---+---+---+
|20000101| 1|1.0| x|
|20000102| 1|3.0| x|
|20000101| 2|2.0| y|
|20000102| 2|4.0| y|
+--------+---+---+---+
Alternatively, the user can define a function that takes three arguments. In this case,
the grouping key(s) will be passed as the first argument and the data will be passed as the
second and third arguments. The grouping key(s) will be passed as a tuple of numpy data
types, e.g., `numpy.int32` and `numpy.float64`. The data will still be passed in as two
`pandas.DataFrame` containing all columns from the original Spark DataFrames.
>>> def asof_join(k, l, r):
... if k == (1,):
... return pd.merge_asof(l, r, on="time", by="id")
... else:
... return pd.DataFrame(columns=['time', 'id', 'v1', 'v2'])
>>> df1.groupby("id").cogroup(df2.groupby("id")).applyInPandas(
... asof_join, "time int, id int, v1 double, v2 string").show() # doctest: +SKIP
+--------+---+---+---+
| time| id| v1| v2|
+--------+---+---+---+
|20000101| 1|1.0| x|
|20000102| 1|3.0| x|
+--------+---+---+---+
.. note:: This function requires a full shuffle. All the data of a cogroup will be loaded
into memory, so the user should be aware of the potential OOM risk if data is skewed
and certain groups are too large to fit in memory.
.. note:: If returning a new `pandas.DataFrame` constructed with a dictionary, it is
recommended to explicitly index the columns by name to ensure the positions are correct,
or alternatively use an `OrderedDict`.
For example, `pd.DataFrame({'id': ids, 'a': data}, columns=['id', 'a'])` or
`pd.DataFrame(OrderedDict([('id', ids), ('a', data)]))`.
.. note:: Experimental
.. seealso:: :meth:`pyspark.sql.functions.pandas_udf`
"""
from pyspark.sql.pandas.functions import pandas_udf
udf = pandas_udf(
func, returnType=schema, functionType=PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF)
all_cols = self._extract_cols(self._gd1) + self._extract_cols(self._gd2)
udf_column = udf(*all_cols)
jdf = self._gd1._jgd.flatMapCoGroupsInPandas(self._gd2._jgd, udf_column._jc.expr())
return DataFrame(jdf, self.sql_ctx)
@staticmethod
def _extract_cols(gd):
df = gd._df
return [df[col] for col in df.columns]
def _test():
import doctest
from pyspark.sql import SparkSession
import pyspark.sql.pandas.group_ops
globs = pyspark.sql.pandas.group_ops.__dict__.copy()
spark = SparkSession.builder\
.master("local[4]")\
.appName("sql.pandas.group tests")\
.getOrCreate()
globs['spark'] = spark
(failure_count, test_count) = doctest.testmod(
pyspark.sql.pandas.group_ops, globs=globs,
optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF)
spark.stop()
if failure_count:
sys.exit(-1)
if __name__ == "__main__":
_test()