There's a couple of ways to do this, and we will normally use the first: The method to limit this to two lines is to use the "s" command to keep one new line, and deleting extra lines. The value of meals isn't taxable income and isn't subject to income tax withholding and social security, Medicare, and FUTA taxes if the meals are furnished for the employer's convenience and on the employer's premises. Here we have what is, in the State, the basis of government, often wrongly confused with the Sovereign, whose minister it is. A successful saving throw against an illusion reveals it to be false, but a figment or phantasm remains as a translucent outline. Your ability scores are not modified by this change unless noted by the spell.
5.2 Tagged Corpora
You'll often work with the Request object, which gives you information like the values of form fields on the page text boxes, etc. This example shows how to access properties of the Request object and how to call the MapPath method of the Request object, which gives you the absolute path of the page on the server:.
A key feature of dynamic web pages is that you can determine what to do based on conditions. The most common way to do this is with the If statement and optional Else statement. Along with If statements, there are a variety of ways to test conditions, repeat blocks of code, and so on, which are described later in this article.
The protocol used for web pages HTTP supports a very limited number of methods "verbs" that are used to make requests to the server. In general, the first time a user requests a page, the page is requested using GET.
In web programming, it's often useful to know whether a page is being requested as a GET or as a POST so that you know how to process the page. If the request is a POST, the IsPost property will return true, and you can do things like read the values of text boxes on a form. Many examples you'll see show you how to process the page differently depending on the value of IsPost. This procedure shows you how to create a page that illustrates basic programming techniques.
In the example, you create a page that lets users enter two numbers, then it adds them and displays the result. Save the page and run it in a browser. Make sure the page is selected in the Files workspace before you run it. Enter two whole numbers and then click the Add button. Earlier you saw a basic example of how to create an ASP. NET server code using the Razor syntax — that is, the programming language rules. You'll probably need to familiarize yourself only with how WebMatrix code is added to markup in.
In server code blocks, you'll often want to output text and markup to the page. If a server code block contains text that's not code and that instead should be rendered as is, ASP. NET needs to be able to distinguish that text from code. There are several ways to do this. These options are useful when you don't want to render an HTML element as part of the output. Again, you could also precede each line individually with the: When you output text as shown in this section — using an HTML element, the: As noted earlier, ASP.
NET does encode the output of server code expressions and server code blocks that are preceded by , except in the special cases noted in this section. To break a statement onto the next line, at the end of the line add a space and then the continuation character. Continue the statement on the next line. You can wrap statements onto as many lines as you need to improve readability. The following statements are the same:. However, you can't wrap a line in the middle of a string literal.
The following example doesn't work:. Comments let you leave notes for yourself or others. Within code blocks you can use the Razor syntax comments, or you can use ordinary Visual Basic comment character, which is a single quote ' prefixed to each line.
A variable is a named object that you use to store data. You can name variables anything, but the name must begin with an alphabetic character and it cannot contain whitespace or reserved characters. In Visual Basic, as you saw earlier, the case of the letters in a variable name doesn't matter. A variable can have a specific data type, which indicates what kind of data is stored in the variable.
And there are many other data types you can use. However, you don't have to specify a type for a variable. In most cases ASP. NET can figure out the type based on how the data in the variable is being used. Occasionally you must specify a type; you'll see examples where this is true. To declare a variable without specifying a type, use Dim plus the variable name for instance, Dim myVar.
To declare a variable with a type, use Dim plus the variable name, followed by As and then the type name for instance, Dim myVar As String. NET can usually determine a data type automatically, sometimes it can't.
Therefore, you might need to help ASP. NET out by performing an explicit conversion. Even if you don't have to convert types, sometimes it's helpful to test to see what type of data you might be working with. The most common case is that you have to convert a string to another type, such as to an integer or date.
The following example shows a typical case where you must convert a string to a number. As a rule, user input comes to you as strings. Even if you've prompted the user to enter a number, and even if they've entered a digit, when user input is submitted and you read it in code, the data is in string format. Therefore, you must convert the string to a number. In the example, if you try to perform arithmetic on the values without converting them, the following error results, because ASP.
NET cannot add two strings:. To convert the values to integers, you call the AsInt method. If the conversion is successful, you can then add the numbers. Converts a string that has a decimal value like "1.
NET, a decimal number is more precise than a floating-point number. Converts a string that represents a date and time value to the ASP. An operator is a keyword or character that tells ASP. NET what kind of command to perform in an expression.
Visual Basic supports many operators, but you only need to recognize a few to get started developing ASP. The following table summarizes the most common operators. Depending on context, either assigns the value on the right side of a statement to the object on the left side, or checks the values for equality. Used to group expressions, to pass parameters to methods, and to access members of arrays and collections. Reverses a true value to false and vice versa.
Typically used as a shorthand way to test for False that is, for not True. You'll often work with file and folder paths in your code. Here is an example of physical folder structure for a website as it might appear on your development computer:. Virtual folder paths always use forward slashes. The virtual path of a folder doesn't have to have the same name as the physical folder; it can be an alias. On production servers, the virtual path rarely matches an exact physical path.
When you work with files and folders in code, sometimes you need to reference the physical path and sometimes a virtual path, depending on what objects you're working with. NET gives you these tools for working with file and folder paths in code: You use this method any time you need a complete physical path.
The next group of sed commands is executed, unless the pattern space is emptied. If this happens, the cycle is started from the top and a new line is read.
The "p" command prints the entire pattern space. Neither the "p" nor the "P" command changes the patterns space. Some examples might demonstrate "N" by itself isn't very useful. Instead, it combines the first and second line, then prints them, combines the third and fourth line, and prints them, etc. It does allow you to use a new "anchor" character: If you wanted to search for a line that ended with the character " ," and append the next line to it, you could use!
Here is a way to look for the string "skip3", and if found, delete that line and the next two lines. If you wanted to match 3 particular lines, it's a little more work.
The next example will look for two words which are either on the same line or one is on the end of a line and the second is on the beginning of the next line. If found, the first word is deleted: The typical order is "N," "P" and lastly "D. You can use two invocations of sed to do this although it is possible to do it with one, but that must wait until next section. The first sed command will output a line number on one line, and then print the line on the next line.
The second invocation of sed will merge the two lines together: As an example, if you had a file that had a hexadecimal number followed by a word, and you wanted to convert the first word to all upper case, you can use the "y" command, but you must first split the line into two lines, change one of the two, and merge them together. That is, a line containing 0x1fff table2 will be changed into two lines: I will use tr to convert the space into a new line, and then use sed to do the rest.
The command would be. You can embed a new line in a substitute command, but you must escape it with a backslash.
Here is the example: When found, it indicates the place a blank used to be. A backslash is a good character, except it must be escaped with a backslash, and makes the sed script obscure. Save it for that guy who keeps asking dumb questions. Or use the C shell and really confuse him!
I think I'm getting carried away. I'll summarize with a chart that covers the features we've talked about: Well, this has some subtle issues here. There is one more "location" to be covered: Think of it as a spare pattern buffer. It can be used to "copy" or "remember" the data in the pattern space for later.
There are five commands that use the hold buffer. Exchange with x The "x" command eXchanges the pattern space with the hold buffer. By itself, the command isn't useful.
Executing the sed command sed 'x' as a filter adds a blank line in the front, and deletes the last line. It looks like it didn't change the input stream significantly, but the sed command is modifying every line.
The hold buffer starts out containing a blank line. When the "x" command modifies the first line, line 1 is saved in the hold buffer, and the blank line takes the place of the first line.
The second "x" command exchanges the second line with the hold buffer, which contains the first line. Each subsequent line is exchanged with the preceding line. The last line is placed in the hold buffer, and is not exchanged a second time, so it remains in the hold buffer when the program terminates, and never gets printed. This illustrates that care must be taken when storing data in the hold buffer, because it won't be output unless you explicitly request it.
Example of Context Grep One use of the hold buffer is to remember previous lines. An example of this is a utility that acts like grep as it shows you the lines that match a pattern.
In addition, it shows you the line before and after the pattern. That is, if line 8 contains the pattern, this utility would print lines 7, 8 and 9. One way to do this is to see if the line has the pattern. If it does not have the pattern, put the current line in the hold buffer. If it does, print the line in the hold buffer, then the current line, and then the next line. After each set, three dashes are printed. The script checks for the existence of an argument, and if missing, prints an error.
The "h" command copies the pattern buffer into the hold buffer. The pattern buffer is unchanged. An identical script to the above uses the hold commands: You can save several lines in the hold buffer, and print them only if a particular pattern is found later.
As an example, take a file that uses spaces as the first character of a line as a continuation character. If you wanted to print the entry before a word, you could use this script. In this example, the program prints out the two lines before the pattern, instead of a single line.
The method to limit this to two lines is to use the "s" command to keep one new line, and deleting extra lines.
I call it grep4: As you can see, you must remember what is in the hold space, and what is in the pattern space. There are other ways to write the same routine.
Get with g or G Instead of exchanging the hold space with the pattern space, you can copy the hold space to the pattern space with the "g" command. This deletes the pattern space. If you want to append to the pattern space, use the "G" command.
This adds a new line to the pattern space, and copies the hold space after the new line. Here is another version of the "grep3" command. It works just like the previous one, but is implemented differently. This illustrates that sed has more than one way to solve many problems.
What is important is you understand your problem, and document your solution: Suppose you wanted to the convert the first hexadecimal number to uppercase, and don't want to use the script I described in an earlier column! I was working too hard. This was chosen to make the script easier to print in these narrow columns. You can easily modify the script to convert all letters to uppercase, or to change the first letter, second word, etc. Flow Control As you learn about sed you realize that it has its own programming language.
It is true that it's a very specialized and simple language. What language would be complete without a method of changing the flow control? There are three commands sed uses for this. You can specify a label with an text string preceded by a colon. The "b" command branches to the label. The label follows the command. If no label is there, branch to the end of the script.
The "t" command is used to test conditions. Before I discuss the "t" command, I will show you an example using the "b" command. This example remembers paragraphs, and if it contains the pattern specified by an argument , the script prints out the entire paragraph. You may want to execute a branch only if a substitution is made. The command "t label" will branch to the label if the last substitute command modified the pattern space.
One use for this is recursive patterns. Suppose you wanted to remove white space inside parenthesis. These parentheses might be nested. That is, you would want to delete a string that looked like ". You would have to pipe the data through the script four times to remove each set or parenthesis. The "t" command would solve this: This is not needed. Non-printing characters are printed in a C-style escaped format.
This can be useful when debugging a complex multi-line sed script. An alternate way of adding comments There is one way to add comments in a sed script if you don't have a version that supports it. Use the "a" command with the line number of zero: It is the ";" command. This can be used to combined several sed commands on one line. Here is the grep4 script I described earlier, but without the comments or error checking and with semicolons between commands: I think I have made my point.
As far as I am concerned, the only time the semicolon is useful is when you want to type the sed script on the command line. If you are going to place it in a script, format it so it is readable. I have mentioned earlier that many versions of sed do not support comments except on the first line. You may want to write your scripts with comments in them, and install them in "binary" form without comments. This should not be difficult. After all, you have become a sed guru by now.
I won't even tell you how to write a script to strip out comments. That would be insulting your intelligence. Also - some operating systems do NOT let you use semicolons. So if you see a script with semicolons, and it does not work on a non-Linux system, replace the semicolon with a new line character.
Passing regular expressions as arguments In the earlier scripts, I mentioned that you would have problems if you passed an argument to the script that had a slash in it. In fact, regular expression might cause you problems. A script like the following is asking to be broken some day: You will also get syntax errors if you provide a "]" without a "]". One solution is to have the user put a backslash before any of these characters when they pass it as an argument. However, the user has to know which characters are special.
Another solution is to add a backslash before each of those characters in the script! Inserting binary characters Dealing with binary characters can be trick, expecially when writing scripts for people to read. I can insert a binary character using an editor like EMACS but if I show the binary character, the terminal may change it to show it to you. The easiest way I have found to do this in a script in a portable fashion is to use the tr 1 command.
It understands octal notations, and it can be output into a variable which can be used. Since special characters are interpreted, you have to be careful when you use this mechanism.
This makes typing faster, and shorted, which is an advantage if you are in a contest. Normal people often find sed's terseness cryptic. You can improve the readability of sed scripts by using the long word equivalent options. That is, instead of typing sed -n 20p You can type the long word version of the -n argument sed --quiet 20p Or sed --silent 20p The long form of sed's command line arguments always have 2 hyphens before their names.
GNU sed has the following long-form command line arguments: Let's define each of these. The -posix argument The GNU version of sed has many features that are not available in other versions. When portability is important, test your script with the -posix option. If you had an example that used a feature of GNU sed, such as the 'v' command to test the version number, such as this is a sed command file v 4. This is what it outputs on my computer sed --version GNU sed version 4.
This is free software; see the source for copying conditions. GNU sed home page: General help using GNU software: E-mail bug reports to: The -h Help argument The -h option will print a summary of the sed commands.
The long argument of the command is sed --help It provides a nice summary of the command line arguments. The -l Line Length Argument I've already described the 'l' command. The default line width for the 'l' command is 70 characters.
This default value can be changed by adding the '-l N' option and specifying the maximum line length as the number after the '-l'.
If you had three files, each with lines, then the command sed -n '1,10 p' file1 file2 file3 would only print the first 10 lines of file file1. The '-s' command tells GNU sed to treat the files are independent files, and to print out the first 10 lines of each file, which is similar to the head command. If you wanted to print the number of lines of each file, you could use 'wc -l' which prints the number of lines, and the filename, for each file, and at the end print the total number of lines.
Here is a simple shell script that does something similar, just using sed: The 'wc -l' command does print out the filenames, unlike the above script. A better emulation of the 'wc -l' command would execute the command in a loop, and print the filenames.
Here is a more advanced script that does this, but it doesn't use the '-s' command: For those who want a simpler method, GNU Sed allows you to do this with a command line option - "-i". Let's assume that we are going to make the same simple change - adding a tab before each line. This is a way to do this for all files in a directory with the ".
If you are as cautious as I am, you may prefer to specify an extension, which is used to keep a copy of the original: You can then delete the original files after you make sure all worked as you expected. Please consider the backup option, and heed my warning. You can easily delete the backed-up original file, as long as the extension is unique. The GNU version of sed allows you to use "-i" without an argument.
But what happens if the file you are editing is a symbolic link to another file? Let's assume you have a file named "b" in a directory called "tmp", with a symbolic link to this file: Now you have two versions of the file, one is changed in the current directory , and one is not in the "tmp" directory.
And where you had a symbolic link, it has been replaced with a modified version of the original file. If you want to edit the real file, and keep the symbolic link in place, use the "--follow-symlinks" command line option: Without the --follow-symlinks command line option, the "backup" file "b.
Otherwise the carriage return is treated as an unprintable character immediately before the end-of-line. Note to self - verify this. There are two common classes of regular expressions, the original "basic" expressions, and the "extended" regular expressions. For more on the differences see My tutorial on regular expressions and the the section on extended regular expressions.
Because the meaning of certain characters are different between the regular and extended expressions, you need a command line argument to enable sed to use the extension. The -u Unbuffered argument Normally - Unix and Linux systems apply some intelligence to handling standard output. It's assumed that if you are sending results to a terminal, you want the output as soon as it becomes available. However, if you are sending the output to a file, then it's assumed you want better performance, so it buffers the output until the buffer is full, and then the contents of the buffer is written to the file.
Let me elaborate on this. Let's assume for this example you have a very large file, and you are using sed to search for a string, and to print it when it is found: However, if sed pipes its output to another program, it will buffer the results. But there are times when you want immediate results. This is especially true when you are dealing with large files, or files that occasionally generate data.
To summarize, you have lots of input data, and you want sed to process it, and then send this to another program that processes the results, but you want the results when it happens, and not delayed. Let me make up a simple example. It's contrived, but it does explain how this works. Here's a program called SlowText that prints numbers from 1 to 60, once a second: This would be the admittedly contrived script: You can eliminate the buffering, and see the results as soon as SlowText outputs them, by using the "-u" option.
With this option, you will see the squares printed as soon as possible: The -z Null Data argument Normally, sed reads a line by reading a string of characters up to the end-of-line character new line or carriage return.
This can be useful if you have files that use the NULL as a record separator. This feature is useful if you are operating on filenames that might contain spaces or binary characters. For instance, if you wanted to use "find" to search for files and you used the "-print0" option to print a NULL at the end of each filename, you could use sed to delete the directory pathname: But is does show how to use the sed "-z" command.
And with the -l command, grep will print the filename that contains the string, retaining non-printing and binary characters: However, the FreeBSD version has a couple of additions. The -a or delayed open Argument Normally, as soon as sed starts up, it opens all files that are refered to by the "w" command.
The FreeBSD version of sed has an option to delay this action until the "w" command is executed. The "-i" option treats the editing each file as a separate instance of sed. If the "-I" option is used, then line numbers do not get reset at the beginning of each line, and ranges of addresses continue from one file to the next.
If a paralytic wills to run and an active man wills not to, they will both stay where they are. The body politic has the same motive powers; here too force and will are distinguished, will under the name of legislative power and force under that of executive power.
Without their concurrence, nothing is, or should be, done. We have seen that the legislative power belongs to the people, and can belong to it alone. It may, on the other hand, readily be seen, from the principles laid down above, that the executive power cannot belong to the generality as legislature or Sovereign, because it consists wholly of particular acts which fall outside the competency of the law, and consequently of the Sovereign, whose acts must always be laws.
The public force therefore needs an agent of its own to bind it together and set it to work under the direction of the general will, to serve as a means of communication between the State and the Sovereign, and to do for the collective person more or less what the union of soul and body does for man.
Here we have what is, in the State, the basis of government, often wrongly confused with the Sovereign, whose minister it is. What then is government? An intermediate body set up between the subjects and the Sovereign, to secure their mutual correspondence, charged with the execution of the laws and the maintenance of liberty, both civil and political.
The members of this body are called magistrates or kings , that is to say governors , and the whole body bears the name prince. It is simply and solely a commission, an employment, in which the rulers, mere officials of the Sovereign, exercise in their own name the power of which it makes them depositaries.
This power it can limit, modify or recover at pleasure; for the alienation of such a right is incompatible with the nature of the social body, and contrary to the end of association. I call then government , or supreme administration, the legitimate exercise of the executive power, and prince or magistrate the man or the body entrusted with that administration.
In government reside the intermediate forces whose relations make up that of the whole to the whole, or of the Sovereign to the State. This last relation may be represented as that between the extreme terms of a continuous proportion, which has government as its mean proportional.
The government gets from the Sovereign the orders it gives the people, and, for the State to be properly balanced, there must, when everything is reckoned in, be equality between the product or power of the government taken in itself, and the product or power of the citizens, who are on the one hand sovereign and on the other subject.
Furthermore, none of these three terms can be altered without the equality being instantly destroyed. If the Sovereign desires to govern, or the magistrate to give laws, or if the subjects refuse to obey, disorder takes the place of regularity, force and will no longer act together, and the State is dissolved and falls into despotism or anarchy.
Lastly, as there is only one mean proportional between each relation, there is also only one good government possible for a State. But, as countless events may change the relations of a people, not only may different governments be good for different peoples, but also for the same people at different times.
In attempting to give some idea of the various relations that may hold between these two extreme terms, I shall take as an example the number of a people, which is the most easily expressible. Suppose the State is composed of ten thousand citizens. The Sovereign can only be considered collectively and as a body; but each member, as being a subject, is regarded as an individual: If the people numbers a hundred thousand, the condition of the subject undergoes no change, and each equally is under the whole authority of the laws, while his vote, being reduced to a hundred-thousandth part, has ten times less influence in drawing them up.
The subject therefore remaining always a unit, the relation between him and the Sovereign increases with the number of the citizens. From this it follows that, the larger the State, the less the liberty. When I say the relation increases, I mean that it grows more unequal. Thus the greater it is in the geometrical sense, the less relation there is in the ordinary sense of the word. In the former sense, the relation, considered according to quantity, is expressed by the quotient; in the latter, considered according to identity, it is reckoned by similarity.
Now, the less relation the particular wills have to the general will, that is, morals and manners to laws, the more should the repressive force be increased. The government, then, to be good, should be proportionately stronger as the people is more numerous. On the other hand, as the growth of the State gives the depositaries of the public authority more temptations and chances of abusing their power, the greater the force with which the government ought to be endowed for keeping the people in hand, the greater too should be the force at the disposal of the Sovereign for keeping the government in hand.
I am speaking, not of absolute force, but of the relative force of the different parts of the State. It follows from this double relation that the continuous proportion between the Sovereign, the prince and the people, is by no means an arbitrary idea, but a necessary consequence of the nature of the body politic. It follows further that, one of the extreme terms, viz.
From this we see that there is not a single unique and absolute form of government, but as many governments differing in nature as there are States differing in size.
If, ridiculing this system, any one were to say that, in order to find the mean proportional and give form to the body of the government, it is only necessary, according to me, to find the square root of the number of the people, I should answer that I am here taking this number only as an instance; that the relations of which I am speaking are not measured by the number of men alone, but generally by the amount of action, which is a combination of a multitude of causes; and that, further, if, to save words, I borrow for a moment the terms of geometry, I am none the less well aware that moral quantities do not allow of geometrical accuracy.
The government is on a small scale what the body politic which includes it is on a great one. It is a moral person endowed with certain faculties, active like the Sovereign and passive like the State, and capable of being resolved into other similar relations.
This accordingly gives rise to a new proportion, within which there is yet another, according to the arrangement of the magistracies, till an indivisible middle term is reached, i. Without encumbering ourselves with this multiplication of terms, let us rest content with regarding government as a new body within the State, distinct from the people and the Sovereign, and intermediate between them.
There is between these two bodies this essential difference, that the State exists by itself, and the government only through the Sovereign. Thus the dominant will of the prince is, or should be, nothing but the general will or the law; his force is only the public force concentrated in his hands, and, as soon as he tries to base any absolute and independent act on his own authority, the tie that binds the whole together begins to be loosened. If finally the prince should come to have a particular will more active than the will of the Sovereign, and should employ the public force in his hands in obedience to this particular will, there would be, so to speak, two Sovereigns, one rightful and the other actual, the social union would evaporate instantly, and the body politic would be dissolved.
However, in order that the government may have a true existence and a real life distinguishing it from the body of the State, and in order that all its members may be able to act in concert and fulfil the end for which it was set up, it must have a particular personality, a sensibility common to its members, and a force and will of its own making for its preservation. This particular existence implies assemblies, councils, power and deliberation and decision, rights, titles, and privileges belonging exclusively to the prince and making the office of magistrate more honourable in proportion as it is more troublesome.
The difficulties lie in the manner of so ordering this subordinate whole within the whole, that it in no way alters the general constitution by affirmation of its own, and always distinguishes the particular force it possesses, which is destined to aid in its preservation, from the public force, which is destined to the preservation of the State; and, in a word, is always ready to sacrifice the government to the people, and never to sacrifice the people to the government.
Furthermore, although the artificial body of the government is the work of another artificial body, and has, we may say, only a borrowed and subordinate life, this does not prevent it from being able to act with more or less vigour or promptitude, or from being, so to speak, in more or less robust health.
Finally, without departing directly from the end for which it was instituted, it may deviate more or less from it, according to the manner of its constitution. From all these differences arise the various relations which the government ought to bear to the body of the State, according to the accidental and particular relations by which the State itself is modified, for often the government that is best in itself will become the most pernicious, if the relations in which it stands have altered according to the defects of the body politic to which it belongs.
T O set forth the general cause of the above differences, we must here distinguish between government and its principle, as we did before between the State and the Sovereign. The body of the magistrate may be composed of a greater or a less number of members. We said that the relation of the Sovereign to the subjects was greater in proportion as the people was more numerous, and, by a clear analogy, we may say the same of the relation of the government to the magistrates.
But the total force of the government, being always that of the State, is invariable; so that, the more of this force it expends on its own members, the less it has left to employ on the whole people.
The more numerous the magistrates, therefore, the weaker the government. This principle being fundamental, we must do our best to make it clear. In the person of the magistrate we can distinguish three essentially different wills: In a perfect act of legislation, the individual or particular will should be at zero; the corporate will belonging to the government should occupy a very subordinate position; and, consequently, the general or sovereign will should always predominate and should be the sole guide of all the rest.
According to the natural order, on the other hand, these different wills become more active in proportion as they are concentrated. Thus, the general will is always the weakest, the corporate will second, and the individual will strongest of all: This granted, if the whole government is in the hands of one man, the particular and the corporate will are wholly united, and consequently the latter is at its highest possible degree of intensity.
But, as the use to which the force is put depends on the degree reached by the will, and as the absolute force of the government is invariable, it follows that the most active government is that of one man. Suppose, on the other hand, we unite the government with the legislative authority, and make the Sovereign prince also, and all the citizens so many magistrates: Thus, the government, having always the same absolute force, will be at the lowest point of its relative force or activity.
These relations are incontestable, and there are other considerations which still further confirm them. We can see, for instance, that each magistrate is more active in the body to which he belongs than each citizen in that to which he belongs, and that consequently the particular will has much more influence on the acts of the government than on those of the Sovereign; for each magistrate is almost always charged with some governmental function, while each citizen, taken singly, exercises no function of Sovereignty.
Furthermore, the bigger the State grows, the more its real force increases, though not in direct proportion to its growth; but, the State remaining the same, the number of magistrates may increase to any extent, without the government gaining any greater real force; for its force is that of the State, the dimension of which remains equal. Thus the relative force or activity of the government decreases, while its absolute or real force cannot increase.
Moreover, it is a certainty that promptitude in execution diminishes as more people are put in charge of it: I have just proved that the government grows remiss in proportion as the number of the magistrates increases; and I previously proved that, the more numerous the people, the greater should be the repressive force. From this it follows that the relation of the magistrates to the government should vary inversely to the relation of the subjects to the Sovereign; that is to say, the larger the State, the more should the government be tightened, so that the number of the rulers diminish in proportion to the increase of that of the people.
It should be added that I am here speaking of the relative strength of the government, and not of its rectitude: Thus, what may be gained on one side is lost on the other, and the art of the legislator is to know how to fix the point at which the force and the will of the government, which are always in inverse proportion, meet in the relation that is most to the advantage of the State.
W E saw in the last chapter what causes the various kinds or forms of government to be distinguished according to the number of the members composing them: In the first place, the Sovereign may commit the charge of the government to the whole people or to the majority of the people, so that more citizens are magistrates than are mere private individuals. This form of government is called democracy. Or it may restrict the government to a small number, so that there are more private citizens than magistrates; and this is named aristocracy.
Lastly, it may concentrate the whole government in the hands of a single magistrate from whom all others hold their power. This third form is the most usual, and is called monarchy , or royal government. It should be remarked that all these forms, or at least the first two, admit of degree, and even of very wide differences; for democracy may include the whole people, or may be restricted to half. Aristocracy, in its turn, may be restricted indefinitely from half the people down to the smallest possible number.
Even royalty is susceptible of a measure of distribution. Sparta always had two kings, as its constitution provided; and the Roman Empire saw as many as eight emperors at once, without it being possible to say that the Empire was split up. Thus there is a point at which each form of government passes into the next, and it becomes clear that, under three comprehensive denominations, government is really susceptible of as many diverse forms as the State has citizens.
There are even more: There has been at all times much dispute concerning the best form of government, without consideration of the fact that each is in some cases the best, and in others the worst. If, in the different States, the number of supreme magistrates should be in inverse ratio to the number of citizens, it follows that, generally, democratic government suits small States, aristocratic government those of middle size, and monarchy great ones.
This rule is immediately deducible from the principle laid down. But it is impossible to count the innumerable circumstances which may furnish exceptions. H E who makes the law knows better than any one else how it should be executed and interpreted. It seems then impossible to have a better constitution than that in which the executive and legislative powers are united; but this very fact renders the government in certain respects inadequate, because things which should be distinguished are confounded, and the prince and the Sovereign, being the same person, form, so to speak, no more than a government without government.
It is not good for him who makes the laws to execute them, or for the body of the people to turn its attention away from a general standpoint and devote it to particular objects. Nothing is more dangerous than the influence of private interests in public affairs, and the abuse of the laws by the government is a less evil than the corruption of the legislator, which is the inevitable sequel to a particular standpoint.
In such a case, the State being altered in substance, all reformation becomes impossible, A people that would never misuse governmental powers would never misuse independence; a people that would always govern well would not need to be governed. If we take the term in the strict sense, there never has been a real democracy, and there never will be. It is against the natural order for the many to govern and the few to be governed.
It is unimaginable that the people should remain continually assembled to devote their time to public affairs, and it is clear that they cannot set up commissions for that purpose without the form of administration being changed. In fact, I can confidently lay down as a principle that, when the functions of government are shared by several tribunals, the less numerous sooner or later acquire the greatest authority, if only because they are in a position to expedite affairs, and power thus naturally comes into their hands.
Besides, how many conditions that are difficult to unite does such a government presuppose! First, a very small State, where the people can readily be got together and where each citizen can with ease know all the rest; secondly, great simplicity of manners, to prevent business from multiplying and raising thorny problems; next, a large measure of equality in rank and fortune, without which equality of rights and authority cannot long subsist; lastly, little or no luxury — for luxury either comes of riches or makes them necessary; it corrupts at once rich and poor, the rich by possession and the poor by covetousness; it sells the country to softness and vanity, and takes away from the State all its citizens, to make them slaves one to another, and one and all to public opinion.
This is why a famous writer has made virtue the fundamental principle of Republics; E1 for all these conditions could not exist without virtue. But, for want of the necessary distinctions, that great thinker was often inexact, and sometimes obscure, and did not see that, the sovereign authority being everywhere the same, the same principle should be found in every well-constituted State, in a greater or less degree, it is true, according to the form of the government.
It may be added that there is no government so subject to civil wars and intestine agitations as democratic or popular government, because there is none which has so strong and continual a tendency to change to another form, or which demands more vigilance and courage for its maintenance as it is. Under such a constitution above all, the citizen should arm himself with strength and constancy, and say, every day of his life, what a virtuous Count Palatine 19 said in the Diet of Poland: Malo periculosam libertatem quam quietum servitium.
Were there a people of gods, their government would be democratic. So perfect a government is not for men. W E have here two quite distinct moral persons, the government and the Sovereign, and in consequence two general wills, one general in relation to all the citizens, the other only for the members of the administration.
Thus, although the government may regulate its internal policy as it pleases, it can never speak to the people save in the name of the Sovereign, that is, of the people itself, a fact which must not be forgotten. The first societies governed themselves aristocratically. The heads of families took counsel together on public affairs. The young bowed without question to the authority of experience. Hence such names as priests, elders, senate , and gerontes.
The savages of North America govern themselves in this way even now, and their government is admirable. But, in proportion as artificial inequality produced by institutions became predominant over natural inequality, riches or power 21 were put before age, and aristocracy became elective.
Finally, the transmission of the father's power along with his goods to his children, by creating patrician families, made government hereditary, and there came to be senators of twenty. There are then three sorts of aristocracy — natural, elective and hereditary. The first is only for simple peoples; the third is the worst of all governments; the second is the best, and is aristocracy properly so called. Besides the advantage that lies in the distinction between the two powers, it presents that of its members being chosen; for, in popular government, all the citizens are born magistrates; but here magistracy is confined to a few, who become such only by election.
Moreover, assemblies are more easily held, affairs better discussed and carried out with more order and diligence, and the credit of the State is better sustained abroad by venerable senators than by a multitude that is unknown or despised. In a word, it is the best and most natural arrangement that the wisest should govern the many, when it is assured that they will govern for its profit, and not for their own. There is no need to multiply instruments, or get twenty thousand men to do what a hundred picked men can do even better.
But it must not be forgotten that corporate interest here begins to direct the public power less under the regulation of the general will, and that a further inevitable propensity takes away from the laws part of the executive power. If we are to speak of what is individually desirable, neither should the State be so small, nor a people so simple and upright, that the execution of the laws follows immediately from the public will, as it does in a good democracy.
Nor should the nation be so great that the rulers have to scatter in order to govern it and are able to play the Sovereign each in his own department, and, beginning by making themselves independent, end by becoming masters. But if aristocracy does not demand all the virtues needed by popular government, it demands others which are peculiar to itself; for instance, moderation on the side of the rich and contentment on that of the poor; for it seems that thorough-going equality would be out of place, as it was not found even at Sparta.
Furthermore, if this form of government carries with it a certain inequality of fortune, this is justifiable in order that as a rule the administration of public affairs may be entrusted to those who are most able to give them their whole time, but not, as Aristotle maintains, in order that the rich may always be put first. On the contrary, it is of importance that an opposite choice should occasionally teach the people that the deserts of men offer claims to pre-eminence more important than those of riches.
So far, we have considered the prince as a moral and collective person, unified by the force of the laws, and the depositary in the State of the executive power. We have now to consider this power when it is gathered together into the hands of a natural person, a real man, who alone has the right to dispose of it in accordance with the laws. Such a person is called a monarch or king.
In contrast with other forms of administration, in which a collective being stands for an individual, in this form an individual stands for a collective being; so that the moral unity that constitutes the prince is at the same time a physical unity, and all the qualities, which in the other case are only with difficulty brought together by the law, are found naturally united.
Thus the will of the people, the will of the prince, the public force of the State, and the particular force of the government, all answer to a single motive power; all the springs of the machine are in the same hands, the whole moves towards the same end; there are no conflicting movements to cancel one another, and no kind of constitution can be imagined in which a less amount of effort produces a more considerable amount of action.
Archimedes, seated quietly on the bank and easily drawing a great vessel afloat, stands to my mind for a skilful monarch, governing vast states from his study, and moving everything while he seems himself unmoved. But if no government is more vigorous than this, there is also none in which the particular will holds more sway and rules the rest more easily. Everything moves towards the same end indeed, but this end is by no means that of the public happiness, and even the force of the administration constantly shows itself prejudicial to the State.
Kings desire to be absolute, and men are always crying out to them from afar that the best means of being so is to get themselves loved by their people. This precept is all very well, and even in some respects very true. Unfortunately, it will always be derided at court.
The power which comes of a people's love is no doubt the greatest; but it is precarious and conditional, and princes will never rest content with it. The best kings desire to be in a position to be wicked, if they please, without forfeiting their mastery: Their first personal interest is that the people should be weak, wretched, and unable to resist them. I admit that, provided the subjects remained always in submission, the prince's interest would indeed be that it should be powerful, in order that its power, being his own, might make him formidable to his neighbours; but, this interest being merely secondary and subordinate, and strength being incompatible with submission, princes naturally give the preference always to the principle that is more to their immediate advantage.
This is what Samuel put strongly before the Hebrews, and what Machiavelli has clearly shown. He professed to teach kings; but it was the people he really taught. His Prince is the book of Republicans. We found, on general grounds, that monarchy is suitable only for great States, and this is confirmed when we examine it in itself. The more numerous the public administration, the smaller becomes the relation between the prince and the subjects, and the nearer it comes to equality, so that in democracy the ratio is unity, or absolute equality.
Again, as the government is restricted in numbers the ratio increases and reaches its maximum when the government is in the hands of a single person. There is then too great a distance between prince and people, and the State lacks a bond of union. To form such a bond, there must be intermediate orders, and princes, personages and nobility to compose them.
But no such things suit a small State, to which all class differences mean ruin. If, however, it is hard for a great State to be well governed, it is much harder for it to be so by a single man; and every one knows what happens when kings substitute others for themselves. An essential and inevitable defect, which will always rank monarchical below the republican government, is that in a republic the public voice hardly ever raises to the highest positions men who are not enlightened and capable, and such as to fill them with honour; while in monarchies those who rise to the top are most often merely petty blunderers, petty swindlers, and petty intriguers, whose petty talents cause them to get into the highest positions at Court, but, as soon as they have got there, serve only to make their ineptitude clear to the public.
The people is far less often mistaken in its choice than the prince; and a man of real worth among the king's ministers is almost as rare as a fool at the head of a republican government. Thus, when, by some fortunate chance, one of these born governors takes the helm of State in some monarchy that has been nearly overwhelmed by swarms of "gentlemanly" administrators, there is nothing but amazement at the resources he discovers, and his coming marks an era in his country's history.
For a monarchical State to have a chance of being well governed, its population and extent must be proportionate to the abilities of its governor. It is easier to conquer than to rule. With a long enough lever, the world could be moved with a single finger; to sustain it needs the shoulders of Hercules.
However small a State may be, the prince is hardly ever big enough for it. When, on the other hand, it happens that the State is too small for its ruler, in these rare cases too it is ill governed, because the ruler, constantly pursuing his great designs, forgets the interests of the people, and makes it no less wretched by misusing the talents he has, than a ruler of less capacity would make it for want of those he had not.
A kingdom should, so to speak, expand or contract with each reign, according to the prince's capabilities; but, the abilities of a senate being more constant in quantity, the State can then have permanent frontiers without the administration suffering. The disadvantage that is most felt in monarchical government is the want of the continuous succession which, in both the other forms, provides an unbroken bond of union.
When one king dies, another is needed; elections leave dangerous intervals and are full of storms; and unless the citizens are disinterested and upright to a degree which very seldom goes with this kind of government, intrigue and corruption abound. He to whom the State has sold itself can hardly help selling it in his turn and repaying himself, at the expense of the weak, the money the powerful have wrung from him.
Under such an administration, venality sooner or later spreads through every part, and peace so enjoyed under a king is worse than the disorders of an interregnum. What has been done to prevent these evils? Crowns have been made hereditary in certain families, and an order of succession has been set up, to prevent disputes from arising on the death of kings.
That is to say, the disadvantages of regency have been put in place of those of election, apparent tranquillity has been preferred to wise administration, and men have chosen rather to risk having children, monstrosities, or imbeciles as rulers to having disputes over the choice of good kings. It has not been taken into account that, in so exposing ourselves to the risks this possibility entails, we are setting almost all the chances against us.
There was sound sense in what the younger Dionysius said to his father, who reproached him for doing some shameful deed by asking, "Did I set you the example?