arya-pandemic 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,3 +1,8 @@
1
+ examples/client/client.rb
2
+ examples/client/constitution.txt
3
+ examples/client/pandemic_client.yml
4
+ examples/server/pandemic_server.yml
5
+ examples/server/word_count_server.rb
1
6
  lib/pandemic/client_side/cluster_connection.rb
2
7
  lib/pandemic/client_side/config.rb
3
8
  lib/pandemic/client_side/connection.rb
@@ -9,12 +14,12 @@ lib/pandemic/server_side/client.rb
9
14
  lib/pandemic/server_side/config.rb
10
15
  lib/pandemic/server_side/handler.rb
11
16
  lib/pandemic/server_side/peer.rb
17
+ lib/pandemic/server_side/processor.rb
12
18
  lib/pandemic/server_side/request.rb
13
19
  lib/pandemic/server_side/server.rb
14
20
  lib/pandemic/util.rb
15
21
  lib/pandemic.rb
16
22
  Manifest
17
23
  MIT-LICENSE
18
- pandemic.gemspec
19
24
  Rakefile
20
25
  README.markdown
data/README.markdown CHANGED
@@ -18,7 +18,7 @@ The framework is designed to be as flexible as possible, there is no rigid reque
18
18
  end
19
19
 
20
20
  pandemic_server = epidemic!
21
- pandemic_server.handler = Handler.new
21
+ pandemic_server.handler = Handler # Pandemic will call the initializer once per process
22
22
  pandemic_server.start.join
23
23
 
24
24
  In this example, the handler doesn't define the map or reduce methods, and the defaults are used. The default for each is as follows:
@@ -104,3 +104,20 @@ And you can access these additional options using _config.get(keys)_ in your han
104
104
  end
105
105
  end
106
106
 
107
+ ## Examples
108
+ To run the example in the _examples_ folder, fire up two to three terminal windows. And run one of these in each:
109
+
110
+ * cd examples/server; ruby word\_count_server.rb -i 0
111
+ * cd examples/server; ruby word\_count_server.rb -i 1
112
+ * cd examples/client; ruby client.rb
113
+
114
+ The servers are going to try to bind to localhost:4000 and localhost:4001 so make sure those are available.
115
+
116
+ ## Enabling Forking
117
+ By default, the handler runs in the same Ruby process as Pandemic. By setting the fork\_for\_processor to true in pandemic\_server.yml, you can have Pandemic fork to new processes to run the process method. This is particularly useful when your process method goes to MySQL which locks the entire process until MySQL returns.
118
+
119
+ ## Change History
120
+ Version 0.3.0
121
+
122
+ * Pandemic can now fork to call the process method
123
+ * Pandemic server now expects a class instead of a instance of the handler when booting the server, it will call the initializer method once per process.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('pandemic', '0.2.3') do |p|
5
+ Echoe.new('pandemic', '0.3.0') do |p|
6
6
  p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
7
7
  p.url = "https://github.com/arya/pandemic/"
8
8
  p.author = "Arya Asemanfar"
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'pandemic'
3
+ require 'json'
4
+ require 'pp'
5
+
6
+ class WordCounter
7
+ include Pandemize
8
+
9
+ def count(str)
10
+ JSON.parse(pandemic.request(str))
11
+ end
12
+ end
13
+
14
+
15
+ wc = WordCounter.new
16
+ counts = wc.count(File.read("constitution.txt"))
17
+ pp counts.to_a.sort{|lhs, rhs| lhs[1] <=> rhs[1]}.reverse[0, 10]
@@ -0,0 +1,865 @@
1
+ We the People of the United States, in Order to form a more perfect Union,
2
+ establish Justice, insure domestic Tranquility, provide for the common
3
+ defence, promote the general Welfare, and secure the Blessings of Liberty to
4
+ ourselves and our Posterity, do ordain and establish this Constitution for the
5
+ United States of America.
6
+
7
+ Article 1.
8
+
9
+ Section 1
10
+ All legislative Powers herein granted shall be vested in a Congress of the
11
+ United States, which shall consist of a Senate and House of Representatives.
12
+
13
+ Section 2
14
+ The House of Representatives shall be composed of Members chosen every second
15
+ Year by the People of the several States, and the Electors in each State shall
16
+ have the Qualifications requisite for Electors of the most numerous Branch of
17
+ the State Legislature.
18
+
19
+ No Person shall be a Representative who shall not have attained to the Age of
20
+ twenty five Years, and been seven Years a Citizen of the United States, and who
21
+ shall not, when elected, be an Inhabitant of that State in which he shall be
22
+ chosen.
23
+
24
+ Representatives and direct Taxes shall be apportioned among the several States
25
+ which may be included within this Union, according to their respective Numbers,
26
+ which shall be determined by adding to the whole Number of free Persons,
27
+ including those bound to Service for a Term of Years, and excluding Indians not
28
+ taxed, three fifths of all other Persons.
29
+
30
+ The actual Enumeration shall be made within three Years after the first Meeting
31
+ of the Congress of the United States, and within every subsequent Term of ten
32
+ Years, in such Manner as they shall by Law direct. The Number of
33
+ Representatives shall not exceed one for every thirty Thousand, but each State
34
+ shall have at Least one Representative; and until such enumeration shall be
35
+ made, the State of New Hampshire shall be entitled to choose three,
36
+ Massachusetts eight, Rhode Island and Providence Plantations one, Connecticut
37
+ five, New York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland
38
+ six, Virginia ten, North Carolina five, South Carolina five and Georgia three.
39
+
40
+ When vacancies happen in the Representation from any State, the Executive
41
+ Authority thereof shall issue Writs of Election to fill such Vacancies.
42
+
43
+ The House of Representatives shall choose their Speaker and other Officers; and
44
+ shall have the sole Power of Impeachment.
45
+
46
+ Section 3
47
+ The Senate of the United States shall be composed of two Senators from each
48
+ State, chosen by the Legislature thereof, for six Years; and each Senator shall
49
+ have one Vote.
50
+
51
+ Immediately after they shall be assembled in Consequence of the first Election,
52
+ they shall be divided as equally as may be into three Classes. The Seats of the
53
+ Senators of the first Class shall be vacated at the Expiration of the second
54
+ Year, of the second Class at the Expiration of the fourth Year, and of the
55
+ third Class at the Expiration of the sixth Year, so that one third may be
56
+ chosen every second Year; and if Vacancies happen by Resignation, or otherwise,
57
+ during the Recess of the Legislature of any State, the Executive thereof may
58
+ make temporary Appointments until the next Meeting of the Legislature, which
59
+ shall then fill such Vacancies.
60
+
61
+ No person shall be a Senator who shall not have attained to the Age of thirty
62
+ Years, and been nine Years a Citizen of the United States, and who shall not,
63
+ when elected, be an Inhabitant of that State for which he shall be chosen.
64
+
65
+ The Vice President of the United States shall be President of the Senate, but
66
+ shall have no Vote, unless they be equally divided.
67
+
68
+ The Senate shall choose their other Officers, and also a President pro tempore,
69
+ in the absence of the Vice President, or when he shall exercise the Office of
70
+ President of the United States.
71
+
72
+ The Senate shall have the sole Power to try all Impeachments. When sitting for
73
+ that Purpose, they shall be on Oath or Affirmation. When the President of the
74
+ United States is tried, the Chief Justice shall preside: And no Person shall be
75
+ convicted without the Concurrence of two thirds of the Members present.
76
+
77
+ Judgment in Cases of Impeachment shall not extend further than to removal from
78
+ Office, and disqualification to hold and enjoy any Office of honor, Trust or
79
+ Profit under the United States: but the Party convicted shall nevertheless be
80
+ liable and subject to Indictment, Trial, Judgment and Punishment, according to
81
+ Law.
82
+
83
+ Section 4
84
+ The Times, Places and Manner of holding Elections for Senators and
85
+ Representatives, shall be prescribed in each State by the Legislature thereof;
86
+ but the Congress may at any time by Law make or alter such Regulations, except
87
+ as to the Place of Choosing Senators.
88
+
89
+ The Congress shall assemble at least once in every Year, and such Meeting shall
90
+ be on the first Monday in December, unless they shall by Law appoint a
91
+ different Day.
92
+
93
+ Section 5
94
+ Each House shall be the Judge of the Elections, Returns and Qualifications of
95
+ its own Members, and a Majority of each shall constitute a Quorum to do
96
+ Business; but a smaller number may adjourn from day to day, and may be
97
+ authorized to compel the Attendance of absent Members, in such Manner, and
98
+ under such Penalties as each House may provide.
99
+
100
+ Each House may determine the Rules of its Proceedings, punish its Members for
101
+ disorderly Behavior, and, with the Concurrence of two-thirds, expel a Member.
102
+
103
+ Each House shall keep a Journal of its Proceedings, and from time to time
104
+ publish the same, excepting such Parts as may in their Judgment require
105
+ Secrecy; and the Yeas and Nays of the Members of either House on any question
106
+ shall, at the Desire of one fifth of those Present, be entered on the Journal.
107
+
108
+ Neither House, during the Session of Congress, shall, without the Consent of
109
+ the other, adjourn for more than three days, nor to any other Place than that
110
+ in which the two Houses shall be sitting.
111
+
112
+ Section 6
113
+ The Senators and Representatives shall receive a Compensation for their
114
+ Services, to be ascertained by Law, and paid out of the Treasury of the United
115
+ States. They shall in all Cases, except Treason, Felony and Breach of the
116
+ Peace, be privileged from Arrest during their Attendance at the Session of
117
+ their respective Houses, and in going to and returning from the same; and for
118
+ any Speech or Debate in either House, they shall not be questioned in any other
119
+ Place.
120
+
121
+ No Senator or Representative shall, during the Time for which he was elected,
122
+ be appointed to any civil Office under the Authority of the United States which
123
+ shall have been created, or the Emoluments whereof shall have been increased
124
+ during such time; and no Person holding any Office under the United States,
125
+ shall be a Member of either House during his Continuance in Office.
126
+
127
+
128
+ Section 7
129
+ All bills for raising Revenue shall originate in the House of Representatives;
130
+ but the Senate may propose or concur with Amendments as on other Bills.
131
+
132
+ Every Bill which shall have passed the House of Representatives and the Senate,
133
+ shall, before it become a Law, be presented to the President of the United
134
+ States; If he approve he shall sign it, but if not he shall return it, with his
135
+ Objections to that House in which it shall have originated, who shall enter the
136
+ Objections at large on their Journal, and proceed to reconsider it. If after
137
+ such Reconsideration two thirds of that House shall agree to pass the Bill, it
138
+ shall be sent, together with the Objections, to the other House, by which it
139
+ shall likewise be reconsidered, and if approved by two thirds of that House, it
140
+ shall become a Law. But in all such Cases the Votes of both Houses shall be
141
+ determined by Yeas and Nays, and the Names of the Persons voting for and
142
+ against the Bill shall be entered on the Journal of each House respectively. If
143
+ any Bill shall not be returned by the President within ten Days (Sundays
144
+ excepted) after it shall have been presented to him, the Same shall be a Law,
145
+ in like Manner as if he had signed it, unless the Congress by their Adjournment
146
+ prevent its Return, in which Case it shall not be a Law.
147
+
148
+ Every Order, Resolution, or Vote to which the Concurrence of the Senate and
149
+ House of Representatives may be necessary (except on a question of Adjournment)
150
+ shall be presented to the President of the United States; and before the Same
151
+ shall take Effect, shall be approved by him, or being disapproved by him, shall
152
+ be repassed by two thirds of the Senate and House of Representatives, according
153
+ to the Rules and Limitations prescribed in the Case of a Bill.
154
+
155
+
156
+ Section 8
157
+ The Congress shall have Power To lay and collect Taxes, Duties, Imposts and
158
+ Excises, to pay the Debts and provide for the common Defence and general
159
+ Welfare of the United States; but all Duties, Imposts and Excises shall be
160
+ uniform throughout the United States;
161
+
162
+ To borrow money on the credit of the United States;
163
+
164
+ To regulate Commerce with foreign Nations, and among the several States, and
165
+ with the Indian Tribes;
166
+
167
+ To establish an uniform Rule of Naturalization, and uniform Laws on the subject
168
+ of Bankruptcies throughout the United States;
169
+
170
+ To coin Money, regulate the Value thereof, and of foreign Coin, and fix the
171
+ Standard of Weights and Measures;
172
+
173
+ To provide for the Punishment of counterfeiting the Securities and current Coin
174
+ of the United States;
175
+
176
+ To establish Post Offices and Post Roads;
177
+
178
+ To promote the Progress of Science and useful Arts, by securing for limited
179
+ Times to Authors and Inventors the exclusive Right to their respective Writings
180
+ and Discoveries;
181
+
182
+ To constitute Tribunals inferior to the supreme Court;
183
+
184
+ To define and punish Piracies and Felonies committed on the high Seas, and
185
+ Offenses against the Law of Nations;
186
+
187
+ To declare War, grant Letters of Marque and Reprisal, and make Rules concerning
188
+ Captures on Land and Water;
189
+
190
+ To raise and support Armies, but no Appropriation of Money to that Use shall be
191
+ for a longer Term than two Years;
192
+
193
+ To provide and maintain a Navy;
194
+
195
+ To make Rules for the Government and Regulation of the land and naval Forces;
196
+
197
+ To provide for calling forth the Militia to execute the Laws of the Union,
198
+ suppress Insurrections and repel Invasions;
199
+
200
+ To provide for organizing, arming, and disciplining the Militia, and for
201
+ governing such Part of them as may be employed in the Service of the United
202
+ States, reserving to the States respectively, the Appointment of the Officers,
203
+ and the Authority of training the Militia according to the discipline
204
+ prescribed by Congress;
205
+
206
+ To exercise exclusive Legislation in all Cases whatsoever, over such District
207
+ (not exceeding ten Miles square) as may, by Cession of particular States, and
208
+ the acceptance of Congress, become the Seat of the Government of the United
209
+ States, and to exercise like Authority over all Places purchased by the Consent
210
+ of the Legislature of the State in which the Same shall be, for the Erection of
211
+ Forts, Magazines, Arsenals, dock-Yards, and other needful Buildings; And
212
+
213
+ To make all Laws which shall be necessary and proper for carrying into
214
+ Execution the foregoing Powers, and all other Powers vested by this
215
+ Constitution in the Government of the United States, or in any Department or
216
+ Officer thereof.
217
+
218
+ Section 9
219
+ The Migration or Importation of such Persons as any of the States now existing
220
+ shall think proper to admit, shall not be prohibited by the Congress prior to
221
+ the Year one thousand eight hundred and eight, but a tax or duty may be imposed
222
+ on such Importation, not exceeding ten dollars for each Person.
223
+
224
+ The privilege of the Writ of Habeas Corpus shall not be suspended, unless when
225
+ in Cases of Rebellion or Invasion the public Safety may require it.
226
+
227
+ No Bill of Attainder or ex post facto Law shall be passed.
228
+
229
+ No capitation, or other direct, Tax shall be laid, unless in Proportion to the
230
+ Census or Enumeration herein before directed to be taken.
231
+
232
+ No Tax or Duty shall be laid on Articles exported from any State.
233
+
234
+ No Preference shall be given by any Regulation of Commerce or Revenue to the
235
+ Ports of one State over those of another: nor shall Vessels bound to, or from,
236
+ one State, be obliged to enter, clear, or pay Duties in another.
237
+
238
+ No Money shall be drawn from the Treasury, but in Consequence of Appropriations
239
+ made by Law; and a regular Statement and Account of the Receipts and
240
+ Expenditures of all public Money shall be published from time to time.
241
+
242
+ No Title of Nobility shall be granted by the United States: And no Person
243
+ holding any Office of Profit or Trust under them, shall, without the Consent of
244
+ the Congress, accept of any present, Emolument, Office, or Title, of any kind
245
+ whatever, from any King, Prince or foreign State.
246
+
247
+ Section 10
248
+ No State shall enter into any Treaty, Alliance, or Confederation; grant Letters
249
+ of Marque and Reprisal; coin Money; emit Bills of Credit; make any Thing but
250
+ gold and silver Coin a Tender in Payment of Debts; pass any Bill of Attainder,
251
+ ex post facto Law, or Law impairing the Obligation of Contracts, or grant any
252
+ Title of Nobility.
253
+
254
+ No State shall, without the Consent of the Congress, lay any Imposts or Duties
255
+ on Imports or Exports, except what may be absolutely necessary for executing
256
+ its inspection Laws: and the net Produce of all Duties and Imposts, laid by
257
+ any State on Imports or Exports, shall be for the Use of the Treasury of the
258
+ United States; and all such Laws shall be subject to the Revision and Control
259
+ of the Congress.
260
+
261
+ No State shall, without the Consent of Congress, lay any duty of Tonnage, keep
262
+ Troops, or Ships of War in time of Peace, enter into any Agreement or Compact
263
+ with another State, or with a foreign Power, or engage in War, unless actually
264
+ invaded, or in such imminent Danger as will not admit of delay.
265
+
266
+ Article 2.
267
+
268
+ Section 1
269
+ The executive Power shall be vested in a President of the United States of
270
+ America. He shall hold his Office during the Term of four Years, and, together
271
+ with the Vice-President chosen for the same Term, be elected, as follows:
272
+
273
+ Each State shall appoint, in such Manner as the Legislature thereof may direct,
274
+ a Number of Electors, equal to the whole Number of Senators and Representatives
275
+ to which the State may be entitled in the Congress: but no Senator or
276
+ Representative, or Person holding an Office of Trust or Profit under the United
277
+ States, shall be appointed an Elector.
278
+
279
+ The Electors shall meet in their respective States, and vote by Ballot for two
280
+ persons, of whom one at least shall not lie an Inhabitant of the same State
281
+ with themselves. And they shall make a List of all the Persons voted for, and
282
+ of the Number of Votes for each; which List they shall sign and certify, and
283
+ transmit sealed to the Seat of the Government of the United States, directed to
284
+ the President of the Senate. The President of the Senate shall, in the Presence
285
+ of the Senate and House of Representatives, open all the Certificates, and the
286
+ Votes shall then be counted. The Person having the greatest Number of Votes
287
+ shall be the President, if such Number be a Majority of the whole Number of
288
+ Electors appointed; and if there be more than one who have such Majority, and
289
+ have an equal Number of Votes, then the House of Representatives shall
290
+ immediately choose by Ballot one of them for President; and if no Person have a
291
+ Majority, then from the five highest on the List the said House shall in like
292
+ Manner choose the President. But in choosing the President, the Votes shall be
293
+ taken by States, the Representation from each State having one Vote; a quorum
294
+ for this Purpose shall consist of a Member or Members from two-thirds of the
295
+ States, and a Majority of all the States shall be necessary to a Choice. In
296
+ every Case, after the Choice of the President, the Person having the greatest
297
+ Number of Votes of the Electors shall be the Vice President. But if there
298
+ should remain two or more who have equal Votes, the Senate shall choose from
299
+ them by Ballot the Vice-President.
300
+
301
+ The Congress may determine the Time of choosing the Electors, and the Day on
302
+ which they shall give their Votes; which Day shall be the same throughout the
303
+ United States.
304
+
305
+ No person except a natural born Citizen, or a Citizen of the United States, at
306
+ the time of the Adoption of this Constitution, shall be eligible to the Office
307
+ of President; neither shall any Person be eligible to that Office who shall not
308
+ have attained to the Age of thirty-five Years, and been fourteen Years a
309
+ Resident within the United States.
310
+
311
+ In Case of the Removal of the President from Office, or of his Death,
312
+ Resignation, or Inability to discharge the Powers and Duties of the said
313
+ Office, the same shall devolve on the Vice President, and the Congress may by
314
+ Law provide for the Case of Removal, Death, Resignation or Inability, both of
315
+ the President and Vice President, declaring what Officer shall then act as
316
+ President, and such Officer shall act accordingly, until the Disability be
317
+ removed, or a President shall be elected.
318
+
319
+ The President shall, at stated Times, receive for his Services, a Compensation,
320
+ which shall neither be increased nor diminished during the Period for which he
321
+ shall have been elected, and he shall not receive within that Period any other
322
+ Emolument from the United States, or any of them.
323
+
324
+ Before he enter on the Execution of his Office, he shall take the following
325
+ Oath or Affirmation:
326
+
327
+ "I do solemnly swear (or affirm) that I will faithfully execute the Office of
328
+ President of the United States, and will to the best of my Ability, preserve,
329
+ protect and defend the Constitution of the United States."
330
+
331
+ Section 2
332
+ The President shall be Commander in Chief of the Army and Navy of the United
333
+ States, and of the Militia of the several States, when called into the actual
334
+ Service of the United States; he may require the Opinion, in writing, of the
335
+ principal Officer in each of the executive Departments, upon any subject
336
+ relating to the Duties of their respective Offices, and he shall have Power to
337
+ Grant Reprieves and Pardons for Offenses against the United States, except in
338
+ Cases of Impeachment.
339
+
340
+ He shall have Power, by and with the Advice and Consent of the Senate, to make
341
+ Treaties, provided two thirds of the Senators present concur; and he shall
342
+ nominate, and by and with the Advice and Consent of the Senate, shall appoint
343
+ Ambassadors, other public Ministers and Consuls, Judges of the supreme Court,
344
+ and all other Officers of the United States, whose Appointments are not herein
345
+ otherwise provided for, and which shall be established by Law: but the Congress
346
+ may by Law vest the Appointment of such inferior Officers, as they think
347
+ proper, in the President alone, in the Courts of Law, or in the Heads of
348
+ Departments.
349
+
350
+ The President shall have Power to fill up all Vacancies that may happen during
351
+ the Recess of the Senate, by granting Commissions which shall expire at the End
352
+ of their next Session.
353
+
354
+ Section 3
355
+ He shall from time to time give to the Congress Information of the State of the
356
+ Union, and recommend to their Consideration such Measures as he shall judge
357
+ necessary and expedient; he may, on extraordinary Occasions, convene both
358
+ Houses, or either of them, and in Case of Disagreement between them, with
359
+ Respect to the Time of Adjournment, he may adjourn them to such Time as he
360
+ shall think proper; he shall receive Ambassadors and other public Ministers; he
361
+ shall take Care that the Laws be faithfully executed, and shall Commission all
362
+ the Officers of the United States.
363
+
364
+ Section 4
365
+ The President, Vice President and all civil Officers of the United States,
366
+ shall be removed from Office on Impeachment for, and Conviction of, Treason,
367
+ Bribery, or other high Crimes and Misdemeanors.
368
+
369
+ Article 3.
370
+
371
+ Section 1
372
+ The judicial Power of the United States, shall be vested in one supreme Court,
373
+ and in such inferior Courts as the Congress may from time to time ordain and
374
+ establish. The Judges, both of the supreme and inferior Courts, shall hold
375
+ their Offices during good Behavior, and shall, at stated Times, receive for
376
+ their Services a Compensation which shall not be diminished during their
377
+ Continuance in Office.
378
+
379
+ Section 2
380
+ The judicial Power shall extend to all Cases, in Law and Equity, arising under
381
+ this Constitution, the Laws of the United States, and Treaties made, or which
382
+ shall be made, under their Authority; to all Cases affecting Ambassadors, other
383
+ public Ministers and Consuls; to all Cases of admiralty and maritime
384
+ Jurisdiction; to Controversies to which the United States shall be a Party; to
385
+ Controversies between two or more States; between a State and Citizens of
386
+ another State; between Citizens of different States; between Citizens of the
387
+ same State claiming Lands under Grants of different States, and between a
388
+ State, or the Citizens thereof, and foreign States, Citizens or Subjects.
389
+
390
+ In all Cases affecting Ambassadors, other public Ministers and Consuls, and
391
+ those in which a State shall be Party, the supreme Court shall have original
392
+ Jurisdiction. In all the other Cases before mentioned, the supreme Court shall
393
+ have appellate Jurisdiction, both as to Law and Fact, with such Exceptions, and
394
+ under such Regulations as the Congress shall make.
395
+
396
+ The Trial of all Crimes, except in Cases of Impeachment, shall be by Jury; and
397
+ such Trial shall be held in the State where the said Crimes shall have been
398
+ committed; but when not committed within any State, the Trial shall be at such
399
+ Place or Places as the Congress may by Law have directed.
400
+
401
+ Section 3
402
+ Treason against the United States, shall consist only in levying War against
403
+ them, or in adhering to their Enemies, giving them Aid and Comfort. No Person
404
+ shall be convicted of Treason unless on the Testimony of two Witnesses to the
405
+ same overt Act, or on Confession in open Court.
406
+
407
+ The Congress shall have power to declare the Punishment of Treason, but no
408
+ Attainder of Treason shall work Corruption of Blood, or Forfeiture except
409
+ during the Life of the Person attainted.
410
+
411
+ Article 4.
412
+
413
+ Section 1
414
+ Full Faith and Credit shall be given in each State to the public Acts, Records,
415
+ and judicial Proceedings of every other State. And the Congress may by general
416
+ Laws prescribe the Manner in which such Acts, Records and Proceedings shall be
417
+ proved, and the Effect thereof.
418
+
419
+ Section 2
420
+ The Citizens of each State shall be entitled to all Privileges and Immunities
421
+ of Citizens in the several States.
422
+
423
+ A Person charged in any State with Treason, Felony, or other Crime, who shall
424
+ flee from Justice, and be found in another State, shall on demand of the
425
+ executive Authority of the State from which he fled, be delivered up, to be
426
+ removed to the State having Jurisdiction of the Crime.
427
+
428
+ No Person held to Service or Labour in one State, under the Laws thereof,
429
+ escaping into another, shall, in Consequence of any Law or Regulation therein,
430
+ be discharged from such Service or Labour, But shall be delivered up on Claim
431
+ of the Party to whom such Service or Labour may be due.
432
+
433
+ Section 3
434
+ New States may be admitted by the Congress into this Union; but no new States
435
+ shall be formed or erected within the Jurisdiction of any other State; nor any
436
+ State be formed by the Junction of two or more States, or parts of States,
437
+ without the Consent of the Legislatures of the States concerned as well as of
438
+ the Congress.
439
+
440
+ The Congress shall have Power to dispose of and make all needful Rules and
441
+ Regulations respecting the Territory or other Property belonging to the United
442
+ States; and nothing in this Constitution shall be so construed as to Prejudice
443
+ any Claims of the United States, or of any particular State.
444
+
445
+ Section 4
446
+ The United States shall guarantee to every State in this Union a Republican
447
+ Form of Government, and shall protect each of them against Invasion; and on
448
+ Application of the Legislature, or of the Executive (when the Legislature
449
+ cannot be convened) against domestic Violence.
450
+
451
+ Article 5.
452
+
453
+ The Congress, whenever two thirds of both Houses shall deem it necessary, shall
454
+ propose Amendments to this Constitution, or, on the Application of the
455
+ Legislatures of two thirds of the several States, shall call a Convention for
456
+ proposing Amendments, which, in either Case, shall be valid to all Intents and
457
+ Purposes, as part of this Constitution, when ratified by the Legislatures of
458
+ three fourths of the several States, or by Conventions in three fourths
459
+ thereof, as the one or the other Mode of Ratification may be proposed by the
460
+ Congress; Provided that no Amendment which may be made prior to the Year One
461
+ thousand eight hundred and eight shall in any Manner affect the first and
462
+ fourth Clauses in the Ninth Section of the first Article; and that no State,
463
+ without its Consent, shall be deprived of its equal Suffrage in the Senate.
464
+
465
+ Article 6.
466
+
467
+ All Debts contracted and Engagements entered into, before the Adoption of this
468
+ Constitution, shall be as valid against the United States under this
469
+ Constitution, as under the Confederation.
470
+
471
+ This Constitution, and the Laws of the United States which shall be made in
472
+ Pursuance thereof; and all Treaties made, or which shall be made, under the
473
+ Authority of the United States, shall be the supreme Law of the Land; and the
474
+ Judges in every State shall be bound thereby, any Thing in the Constitution or
475
+ Laws of any State to the Contrary notwithstanding.
476
+
477
+ The Senators and Representatives before mentioned, and the Members of the
478
+ several State Legislatures, and all executive and judicial Officers, both of
479
+ the United States and of the several States, shall be bound by Oath or
480
+ Affirmation, to support this Constitution; but no religious Test shall ever be
481
+ required as a Qualification to any Office or public Trust under the United
482
+ States.
483
+
484
+ Article 7.
485
+
486
+ The Ratification of the Conventions of nine States, shall be sufficient for the
487
+ Establishment of this Constitution between the States so ratifying the Same.
488
+
489
+ Done in Convention by the Unanimous Consent of the States present the
490
+ Seventeenth Day of September in the Year of our Lord one thousand seven hundred
491
+ and Eighty seven and of the Independence of the United States of America the
492
+ Twelfth. In Witness whereof We have hereunto subscribed our Names.
493
+
494
+ George Washington - President and deputy from Virginia
495
+
496
+ New Hampshire - John Langdon, Nicholas Gilman
497
+
498
+ Massachusetts - Nathaniel Gorham, Rufus King
499
+
500
+ Connecticut - William Samuel Johnson, Roger Sherman
501
+
502
+ New York - Alexander Hamilton
503
+
504
+ New Jersey - William Livingston, David Brearley, William Paterson, Jonathan
505
+ Dayton
506
+
507
+ Pennsylvania - Benjamin Franklin, Thomas Mifflin, Robert Morris, George Clymer,
508
+ Thomas Fitzsimons, Jared Ingersoll, James Wilson, Gouvernour Morris
509
+
510
+ Delaware - George Read, Gunning Bedford Jr., John Dickinson, Richard Bassett,
511
+ Jacob Broom
512
+
513
+ Maryland - James McHenry, Daniel of St Thomas Jenifer, Daniel Carroll
514
+
515
+ Virginia - John Blair, James Madison Jr.
516
+
517
+ North Carolina - William Blount, Richard Dobbs Spaight, Hugh Williamson
518
+
519
+ South Carolina - John Rutledge, Charles Cotesworth Pinckney, Charles Pinckney,
520
+ Pierce Butler
521
+
522
+ Georgia - William Few, Abraham Baldwin
523
+
524
+ Attest: William Jackson, Secretary
525
+
526
+
527
+ Amendment 1
528
+ Congress shall make no law respecting an establishment of religion, or
529
+ prohibiting the free exercise thereof; or abridging the freedom of speech, or
530
+ of the press; or the right of the people peaceably to assemble, and to petition
531
+ the Government for a redress of grievances.
532
+
533
+ Amendment 2
534
+ A well regulated Militia, being necessary to the security of a free State, the
535
+ right of the people to keep and bear Arms, shall not be infringed.
536
+
537
+ Amendment 3
538
+ No Soldier shall, in time of peace be quartered in any house, without the
539
+ consent of the Owner, nor in time of war, but in a manner to be prescribed by
540
+ law.
541
+
542
+ Amendment 4
543
+ The right of the people to be secure in their persons, houses, papers, and
544
+ effects, against unreasonable searches and seizures, shall not be violated, and
545
+ no Warrants shall issue, but upon probable cause, supported by Oath or
546
+ affirmation, and particularly describing the place to be searched, and the
547
+ persons or things to be seized.
548
+
549
+ Amendment 5
550
+ No person shall be held to answer for a capital, or otherwise infamous crime,
551
+ unless on a presentment or indictment of a Grand Jury, except in cases arising
552
+ in the land or naval forces, or in the Militia, when in actual service in time
553
+ of War or public danger; nor shall any person be subject for the same offense
554
+ to be twice put in jeopardy of life or limb; nor shall be compelled in any
555
+ criminal case to be a witness against himself, nor be deprived of life,
556
+ liberty, or property, without due process of law; nor shall private property be
557
+ taken for public use, without just compensation.
558
+
559
+ Amendment 6
560
+ In all criminal prosecutions, the accused shall enjoy the right to a speedy and
561
+ public trial, by an impartial jury of the State and district wherein the crime
562
+ shall have been committed, which district shall have been previously
563
+ ascertained by law, and to be informed of the nature and cause of the
564
+ accusation; to be confronted with the witnesses against him; to have compulsory
565
+ process for obtaining witnesses in his favor, and to have the Assistance of
566
+ Counsel for his defence.
567
+
568
+ Amendment 7
569
+ In Suits at common law, where the value in controversy shall exceed twenty
570
+ dollars, the right of trial by jury shall be preserved, and no fact tried by a
571
+ jury, shall be otherwise re-examined in any Court of the United States, than
572
+ according to the rules of the common law.
573
+
574
+ Amendment 8
575
+ Excessive bail shall not be required, nor excessive fines imposed, nor cruel
576
+ and unusual punishments inflicted.
577
+
578
+ Amendment 9
579
+ The enumeration in the Constitution, of certain rights, shall not be construed
580
+ to deny or disparage others retained by the people.
581
+
582
+ Amendment 10
583
+ The powers not delegated to the United States by the Constitution, nor
584
+ prohibited by it to the States, are reserved to the States respectively, or to
585
+ the people.
586
+
587
+ Amendment 11
588
+ The Judicial power of the United States shall not be construed to extend to any
589
+ suit in law or equity, commenced or prosecuted against one of the United States
590
+ by Citizens of another State, or by Citizens or Subjects of any Foreign State.
591
+
592
+ Amendment 12
593
+ The Electors shall meet in their respective states, and vote by ballot for
594
+ President and Vice-President, one of whom, at least, shall not be an inhabitant
595
+ of the same state with themselves; they shall name in their ballots the person
596
+ voted for as President, and in distinct ballots the person voted for as
597
+ Vice-President, and they shall make distinct lists of all persons voted for as
598
+ President, and of all persons voted for as Vice-President and of the number of
599
+ votes for each, which lists they shall sign and certify, and transmit sealed to
600
+ the seat of the government of the United States, directed to the President of
601
+ the Senate;
602
+
603
+ The President of the Senate shall, in the presence of the Senate and House of
604
+ Representatives, open all the certificates and the votes shall then be counted;
605
+
606
+ The person having the greatest Number of votes for President, shall be the
607
+ President, if such number be a majority of the whole number of Electors
608
+ appointed; and if no person have such majority, then from the persons having
609
+ the highest numbers not exceeding three on the list of those voted for as
610
+ President, the House of Representatives shall choose immediately, by ballot,
611
+ the President. But in choosing the President, the votes shall be taken by
612
+ states, the representation from each state having one vote; a quorum for this
613
+ purpose shall consist of a member or members from two-thirds of the states, and
614
+ a majority of all the states shall be necessary to a choice. And if the House
615
+ of Representatives shall not choose a President whenever the right of choice
616
+ shall devolve upon them, before the fourth day of March next following, then
617
+ the Vice-President shall act as President, as in the case of the death or other
618
+ constitutional disability of the President.
619
+
620
+ The person having the greatest number of votes as Vice-President, shall be the
621
+ Vice-President, if such number be a majority of the whole number of Electors
622
+ appointed, and if no person have a majority, then from the two highest numbers
623
+ on the list, the Senate shall choose the Vice-President; a quorum for the
624
+ purpose shall consist of two-thirds of the whole number of Senators, and a
625
+ majority of the whole number shall be necessary to a choice. But no person
626
+ constitutionally ineligible to the office of President shall be eligible to
627
+ that of Vice-President of the United States.
628
+
629
+ Amendment 13
630
+ 1. Neither slavery nor involuntary servitude, except as a punishment for crime
631
+ whereof the party shall have been duly convicted, shall exist within the United
632
+ States, or any place subject to their jurisdiction.
633
+
634
+ 2. Congress shall have power to enforce this article by appropriate
635
+ legislation.
636
+
637
+ Amendment 14
638
+ 1. All persons born or naturalized in the United States, and subject to the
639
+ jurisdiction thereof, are citizens of the United States and of the State
640
+ wherein they reside. No State shall make or enforce any law which shall abridge
641
+ the privileges or immunities of citizens of the United States; nor shall any
642
+ State deprive any person of life, liberty, or property, without due process of
643
+ law; nor deny to any person within its jurisdiction the equal protection of the
644
+ laws.
645
+
646
+ 2. Representatives shall be apportioned among the several States according to
647
+ their respective numbers, counting the whole number of persons in each State,
648
+ excluding Indians not taxed. But when the right to vote at any election for the
649
+ choice of electors for President and Vice-President of the United States,
650
+ Representatives in Congress, the Executive and Judicial officers of a State, or
651
+ the members of the Legislature thereof, is denied to any of the male
652
+ inhabitants of such State, being twenty-one years of age, and citizens of the
653
+ United States, or in any way abridged, except for participation in rebellion,
654
+ or other crime, the basis of representation therein shall be reduced in the
655
+ proportion which the number of such male citizens shall bear to the whole
656
+ number of male citizens twenty-one years of age in such State.
657
+
658
+ 3. No person shall be a Senator or Representative in Congress, or elector of
659
+ President and Vice-President, or hold any office, civil or military, under the
660
+ United States, or under any State, who, having previously taken an oath, as a
661
+ member of Congress, or as an officer of the United States, or as a member of
662
+ any State legislature, or as an executive or judicial officer of any State, to
663
+ support the Constitution of the United States, shall have engaged in
664
+ insurrection or rebellion against the same, or given aid or comfort to the
665
+ enemies thereof. But Congress may by a vote of two-thirds of each House, remove
666
+ such disability.
667
+
668
+ 4. The validity of the public debt of the United States, authorized by law,
669
+ including debts incurred for payment of pensions and bounties for services in
670
+ suppressing insurrection or rebellion, shall not be questioned. But neither the
671
+ United States nor any State shall assume or pay any debt or obligation incurred
672
+ in aid of insurrection or rebellion against the United States, or any claim for
673
+ the loss or emancipation of any slave; but all such debts, obligations and
674
+ claims shall be held illegal and void.
675
+
676
+ 5. The Congress shall have power to enforce, by appropriate legislation, the
677
+ provisions of this article.
678
+
679
+ Amendment 15
680
+ 1. The right of citizens of the United States to vote shall not be denied or
681
+ abridged by the United States or by any State on account of race, color, or
682
+ previous condition of servitude.
683
+
684
+ 2. The Congress shall have power to enforce this article by appropriate
685
+ legislation.
686
+
687
+ Amendment 16
688
+ The Congress shall have power to lay and collect taxes on incomes, from
689
+ whatever source derived, without apportionment among the several States, and
690
+ without regard to any census or enumeration.
691
+
692
+ Amendment 17
693
+ The Senate of the United States shall be composed of two Senators from each
694
+ State, elected by the people thereof, for six years; and each Senator shall
695
+ have one vote. The electors in each State shall have the qualifications
696
+ requisite for electors of the most numerous branch of the State legislatures.
697
+
698
+ When vacancies happen in the representation of any State in the Senate, the
699
+ executive authority of such State shall issue writs of election to fill such
700
+ vacancies: Provided, That the legislature of any State may empower the
701
+ executive thereof to make temporary appointments until the people fill the
702
+ vacancies by election as the legislature may direct.
703
+
704
+ This amendment shall not be so construed as to affect the election or term of
705
+ any Senator chosen before it becomes valid as part of the Constitution.
706
+
707
+ Amendment 18
708
+ 1. After one year from the ratification of this article the manufacture, sale,
709
+ or transportation of intoxicating liquors within, the importation thereof into,
710
+ or the exportation thereof from the United States and all territory subject to
711
+ the jurisdiction thereof for beverage purposes is hereby prohibited.
712
+
713
+ 2. The Congress and the several States shall have concurrent power to enforce
714
+ this article by appropriate legislation.
715
+
716
+ 3. This article shall be inoperative unless it shall have been ratified as an
717
+ amendment to the Constitution by the legislatures of the several States, as
718
+ provided in the Constitution, within seven years from the date of the
719
+ submission hereof to the States by the Congress.
720
+
721
+ Amendment 19
722
+ The right of citizens of the United States to vote shall not be denied or
723
+ abridged by the United States or by any State on account of sex.
724
+
725
+ Congress shall have power to enforce this article by appropriate legislation.
726
+
727
+ Amendment 20
728
+ 1. The terms of the President and Vice President shall end at noon on the 20th
729
+ day of January, and the terms of Senators and Representatives at noon on the 3d
730
+ day of January, of the years in which such terms would have ended if this
731
+ article had not been ratified; and the terms of their successors shall then
732
+ begin.
733
+
734
+ 2. The Congress shall assemble at least once in every year, and such meeting
735
+ shall begin at noon on the 3d day of January, unless they shall by law appoint
736
+ a different day.
737
+
738
+ 3. If, at the time fixed for the beginning of the term of the President, the
739
+ President elect shall have died, the Vice President elect shall become
740
+ President. If a President shall not have been chosen before the time fixed for
741
+ the beginning of his term, or if the President elect shall have failed to
742
+ qualify, then the Vice President elect shall act as President until a President
743
+ shall have qualified; and the Congress may by law provide for the case wherein
744
+ neither a President elect nor a Vice President elect shall have qualified,
745
+ declaring who shall then act as President, or the manner in which one who is to
746
+ act shall be selected, and such person shall act accordingly until a President
747
+ or Vice President shall have qualified.
748
+
749
+ 4. The Congress may by law provide for the case of the death of any of the
750
+ persons from whom the House of Representatives may choose a President whenever
751
+ the right of choice shall have devolved upon them, and for the case of the
752
+ death of any of the persons from whom the Senate may choose a Vice President
753
+ whenever the right of choice shall have devolved upon them.
754
+
755
+ 5. Sections 1 and 2 shall take effect on the 15th day of October following the
756
+ ratification of this article.
757
+
758
+ 6. This article shall be inoperative unless it shall have been ratified as an
759
+ amendment to the Constitution by the legislatures of three-fourths of the
760
+ several States within seven years from the date of its submission.
761
+
762
+ Amendment 21
763
+ 1. The eighteenth article of amendment to the Constitution of the United States
764
+ is hereby repealed.
765
+
766
+ 2. The transportation or importation into any State, Territory, or possession
767
+ of the United States for delivery or use therein of intoxicating liquors, in
768
+ violation of the laws thereof, is hereby prohibited.
769
+
770
+ 3. The article shall be inoperative unless it shall have been ratified as an
771
+ amendment to the Constitution by conventions in the several States, as provided
772
+ in the Constitution, within seven years from the date of the submission hereof
773
+ to the States by the Congress.
774
+
775
+ Amendment 22
776
+ 1. No person shall be elected to the office of the President more than twice,
777
+ and no person who has held the office of President, or acted as President, for
778
+ more than two years of a term to which some other person was elected President
779
+ shall be elected to the office of the President more than once. But this
780
+ Article shall not apply to any person holding the office of President, when this
781
+ Article was proposed by the Congress, and shall not prevent any person who may
782
+ be holding the office of President, or acting as President, during the term
783
+ within which this Article becomes operative from holding the office of
784
+ President or acting as President during the remainder of such term.
785
+
786
+ 2. This article shall be inoperative unless it shall have been ratified as an
787
+ amendment to the Constitution by the legislatures of three-fourths of the
788
+ several States within seven years from the date of its submission to the States
789
+ by the Congress.
790
+
791
+ Amendment 23
792
+ 1. The District constituting the seat of Government of the United States shall
793
+ appoint in such manner as the Congress may direct: A number of electors of
794
+ President and Vice President equal to the whole number of Senators and
795
+ Representatives in Congress to which the District would be entitled if it were
796
+ a State, but in no event more than the least populous State; they shall be in
797
+ addition to those appointed by the States, but they shall be considered, for
798
+ the purposes of the election of President and Vice President, to be electors
799
+ appointed by a State; and they shall meet in the District and perform such
800
+ duties as provided by the twelfth article of amendment.
801
+
802
+ 2. The Congress shall have power to enforce this article by appropriate
803
+ legislation.
804
+
805
+ Amendment 24
806
+ 1. The right of citizens of the United States to vote in any primary or other
807
+ election for President or Vice President, for electors for President or
808
+ Vice President, or for Senator or Representative in Congress, shall not be
809
+ denied or abridged by the United States or any State by reason of failure to
810
+ pay any poll tax or other tax.
811
+
812
+ 2. The Congress shall have power to enforce this article by appropriate
813
+ legislation.
814
+
815
+ Amendment 25
816
+ 1. In case of the removal of the President from office or of his death or
817
+ resignation, the Vice President shall become President.
818
+
819
+ 2. Whenever there is a vacancy in the office of the Vice President, the
820
+ President shall nominate a Vice President who shall take office upon
821
+ confirmation by a majority vote of both Houses of Congress.
822
+
823
+ 3. Whenever the President transmits to the President pro tempore of the Senate
824
+ and the Speaker of the House of Representatives his written declaration that he
825
+ is unable to discharge the powers and duties of his office, and until he
826
+ transmits to them a written declaration to the contrary, such powers and duties
827
+ shall be discharged by the Vice President as Acting President.
828
+
829
+ 4. Whenever the Vice President and a majority of either the principal officers
830
+ of the executive departments or of such other body as Congress may by law
831
+ provide, transmit to the President pro tempore of the Senate and the Speaker of
832
+ the House of Representatives their written declaration that the President is
833
+ unable to discharge the powers and duties of his office, the Vice President
834
+ shall immediately assume the powers and duties of the office as Acting
835
+ President.
836
+
837
+ Thereafter, when the President transmits to the President pro tempore of the
838
+ Senate and the Speaker of the House of Representatives his written declaration
839
+ that no inability exists, he shall resume the powers and duties of his office
840
+ unless the Vice President and a majority of either the principal officers of
841
+ the executive department or of such other body as Congress may by law provide,
842
+ transmit within four days to the President pro tempore of the Senate and the
843
+ Speaker of the House of Representatives their written declaration that the
844
+ President is unable to discharge the powers and duties of his office. Thereupon
845
+ Congress shall decide the issue, assembling within forty eight hours for that
846
+ purpose if not in session. If the Congress, within twenty one days after
847
+ receipt of the latter written declaration, or, if Congress is not in session,
848
+ within twenty one days after Congress is required to assemble, determines by
849
+ two thirds vote of both Houses that the President is unable to discharge the
850
+ powers and duties of his office, the Vice President shall continue to discharge
851
+ the same as Acting President; otherwise, the President shall resume the powers
852
+ and duties of his office.
853
+
854
+ Amendment 26
855
+ 1. The right of citizens of the United States, who are eighteen years of age or
856
+ older, to vote shall not be denied or abridged by the United States or by any
857
+ State on account of age.
858
+
859
+ 2. The Congress shall have power to enforce this article by appropriate
860
+ legislation.
861
+
862
+ Amendment 27
863
+ No law, varying the compensation for the services of the Senators and
864
+ Representatives, shall take effect, until an election of Representatives shall
865
+ have intervened.