Part 1 of 3
Revision : 1.0
Date : 05/05/94
For each pattern, an action is specified. The action is performed when the pattern matches that of the input line.
Thus, an awk program consists of a number of patterns and associated actions. Actions are enclosed using curly braces, and separated using semi-colons.
pattern { action } pattern { action }
For instance, the following line in a file
I like money.has three fields. They are
$1 I $2 like $3 money.Field zero ($0) refers to the entire line.
awk scans lines from a file(s) or standard input.
{ print $0 }There is no pattern to match, only an action expressed. This means that for every line encountered, perform the action.
The action prints field 0 (the entire line).
Using a text editor, create a file called myawk1 and place the above statement in it. Save the file and return to the Unix shell prompt.
awk -f myawk1 /etc/groupawk interprets the actions specified in the program file myawk1, and applies this to each line read from the file /etc/group. The effect is to print out each input line read from the file, in effect, displaying the file on the screen (same as the Unix command cat).
/brian/ { print $0 }Edit myawk1 and change the search string to your username. Run the program on the files /etc/group and /etc/passwd
awk -fmyawk1 /etc/group awk -fmyawk1 /etc/passwdCompared to the previous example where there was no pattern specified, what is the difference in the output of this program.
............................................................................................ ............................................................................................ ............................................................................................Type the following command. This runs the program who and sends its output of who is logged on the system to the awk program which scans each line for the search string. It will thus list out a line containing your login name, terminal number and login date/time.
who | awk -f myawk1Change the contents of myawk1 to read (replace the search string with your login name)
/brian/ { print $1, $2 }What do you expect the output of the program to be? (what fields will it print out?)
............................................................................................ ............................................................................................ ............................................................................................Now type the command
who | awk -f myawk1What happened? How is the output different than before.
............................................................................................ ............................................................................................ ............................................................................................
Type Memory (Kb) Location Serial # HD Size (Mb) XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012<PHONE_NUMBER> A423 CC0177<PHONE_NUMBER> A424 CC0182<PHONE_NUMBER> A423 CC0183<PHONE_NUMBER> A425 CC0184 80 Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100 $unix 16636 A405 CC0185 660 "trs80" 64 Z101 EL0020 0In addition, all examples (awk program files myawknn) are available from your tutor or by ftp from the ftp host brian.cit.ac.nz in the OS202 subdirectory (username=guest, password=os2). A public domain MSDOS awk program (awk.exe) is also located in this subdirectory.
$1 == "386" { print $0 }Note: The == symbol represents an equality test, thus in the above pattern, it compares the string of field one against the constant string "386", and performs the action if it matches.
Create the program $ cat - > myawk2 $1 == "386" { print $0 } < ctrl-d> $ Note: < ctrl-d> is a keypress to terminate input to the shell. Hold down the ctrl key and then press d. User input is shown in bold type. Run The Program $ awk -f myawk2 awktext Sample Program Output 386 2048 D403 MG0011<PHONE_NUMBER> A423 CC0177 400 The program prints out all input lines where the computer type is a "386".Write an awk program which prints out all input lines where a computer has 4096 Kb of memory. After running the program successfully, enter it in the space provided below.
..................................................................................
#myawk3, same as myawk2 but has a comment in it $1 == "386" { print $0 }Comments can be placed anywhere on the line. The example below shows the comment placed after the action.
$1 == "386" { print $0 } # print all records where the computer is a 386Remember that the comment ends at the end of the line. The following program is thus wrong, as the closing brace of the action is treated as part of the comment.
$1 == "386 { print $0 #print out all records }
< less than < = less than or equal to == equal to != not equal > = greater than or equal to > greater than ~ matches !~ does not match
Some Examples Of Using Relational Operators
# myawk4, an awk program to display all input lines for computers # with less than 1024 Kb of memory $2 < 1024 { print $0 } myawk4 Program Output XT 640 D402 MG0010 0 "trs80" 64 Z101 EL0020 0 =================================================================== # myawk5 # an awk program to print the location/serial number of 486 computers $1 == "486" { print $3, $4 } myawk5 Program Output D404 MG0012 A424 CC0182 =================================================================== # myawk6 # an awk program to print out all computers belonging to management. /MG/ { print $0 } myawk6 Program Output XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012 270The awk program myawk6 scans each input line searching for the occurrence of the string MG. When found, the action prints out the line. The problem with this is it might be possible for the string MG to occur in another field, but the serial number indicate that it belongs to another department.
What is necessary is a means of matching only a specific field. To apply a search to a specific field, the match (~) symbol is used. The modified awk program shown below searches field 4 for the string MG.
# myawk6A # improved awk program, print out all computers belonging to management. $4 ~ /MG/ { print $0 } myawk6a Program Output XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012 270What do the following examples do?
$2 != "4096" { print $0 } .................................................................................... .................................................................................... $5 > 100 { print $4 } .................................................................................... .................................................................................... $4 !~ /CC/ { print $0 } .................................................................................... ....................................................................................Write an awk program to display the location of all computers belonging to the computer centre (code CC). Test the program, and after running the program successfully, enter the program in the space provided below.
..................................................................................
# myawk7 # list computers located in D block, type and location $3 ~ /D/ { print "Location = ", $3, " type = ", $1 } myawk7 Program Output Location = D402 type = XT Location = D403 type = 386 Location = D404 type = 486
printf( "Location : " );The printf statement is terminated by a semi-colon. Brackets are used to enclose the argument, and the text is enclosed using double quotes. Now lets combine it into an actual awk program which displays the location of all 286 type computers.
#myawk8 $1 == "286" { printf( "Location : "); print $3 } myawk8 Program Output Location : A423 Location : A425
#myawk9 $1 == "286" { printf( "Location is %s\n", $3 ); } myawk9 Program Output Location is A423 Location is A425Note: The symbol \n causes subsequent output to begin on a new line. The symbol %s informs printf to print out a text string, in this case it is the contents of the field $3.
Consider the following awk program which prints the location and serial number of all 286 computers.
#myawk10 $1=="286" { printf( "Location = %s, serial # = %s\n", $3, $4 ); } myawk10 Program Output Location = A423, serial # = CC0183 Location = A425, serial # = CC0184Write an awk program which lists the serial numbers of all computers belonging to the management school. After running the program successfully, enter it in the space provided below.
...............................................................................
#myawk11 $1=="486" { printf("Location = %s, disk = %dKb\n", $3, $5 ); } myawk11 Program Output Location = D404, disk = 270Kb Location = A424, disk = 670KbWrite an awk program which lists the memory size and serial number of all computers which have a hard disk greater than 80Mb in size. After running the program successfully, enter it in the space provided below.
...............................................................................
#myawk12 # formatting the output using a field width $1=="286" {printf("Location = %10s, disk = %5dKb\n",$3,$5);} myawk12 Program Output Location = A423, disk = 100Kb Location = A425, disk = 80Kb10%s specifies to print out field $3 using a field width of 10 characters, and %5d specifies to print out field $5 using a field width of 5 digits.
%[n]s print a text string %[n]d print a numeric value \n print a new-line
BEGIN The action associated with this keyword is executed before the first input line is read. END The action associated with this keyword is executed after all input lines have been processed.The BEGIN keyword is normally associated with printing titles and setting default values, whilst the END keyword is normally associated with printing totals.
Consider the following awk program, which uses BEGIN to print a title.
#myawk13 BEGIN { print "Location of 286 Computers" } $1 == "286" { print $3 } myawk13 Program Output Location of 286 Computers A423 A425
NR the current input line number NF number of fields in the input line #myawk14 # print the number of computers END { print "There are ", NR, "computers" } myawk14 Program Output There are 13 computers
The following awk program counts the number of 486 computers, and uses the END keyword to print out the total after all input lines have been processed. When each input line is read, field one is checked to see if it matches 486. If it does, the awk variable computers is incremented (the symbol ++ means increment by one).
#myawk15 $1 == "486" { computers++ } END { printf("The number of 486 computers is %d\n", computers); } myawk15 Program Output The number of 486 computers is 2 Note: There is no need to explicitly initialise the variable 'computers' to zero. awk does this by default.Write an awk program which counts the number of computers which have 8192Kb or greater amounts of memory, then prints the number found at the end of the program. After running the program successfully, enter it in the space provided below.
............................................................................... ...............................................................................Write an awk program which sums the disk space of all computers, then prints the total disk space at the end of the program. After running the program successfully, enter it in the space provided below.
............................................................................... ...............................................................................
Part 2 of 3
Revision : 1.0
Date : 05/05/94
ref awk.doc
The simplest regular expression is a string enclosed in slashes,
/386/In the above example, any input line containing the string 386 will be printed. To restrict a search to a specific field, the match (or not match) symbol is used. In the following example, field one of the input line is searched for the string 386.
$1 ~ /386/In regular expressions, the following symbols are metacharacters with special meanings.
\ ^ $ . [ ] * + ? ( ) | ^ matches the first character of a string $ matches the last character of a string . matches a single character of a string [ ] defines a set of characters ( ) used for grouping | specifies alternativesA group of characters enclosed in brackets matches to any one of the enclosed characters. In the example below (myawk16), field one is matched against either "8" or "6".
#myawk16, display all x8x computer types $1 ~ /[86]/ { print $0 } myawk16 Program Output 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012<PHONE_NUMBER> A423 CC0177<PHONE_NUMBER> A424 CC0182<PHONE_NUMBER> A423 CC0183<PHONE_NUMBER> A425 CC0184 80 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100 "trs80" 64 Z101 EL0020 0Note: In this example, field one is searched for the character '8' and '6', in any order of occurrence and position.
If the first character after the opening bracket ([) is a caret (^) symbol, this complements the set so that it matches any character NOT IN the set. The following example (myawk17) shows this, matching field one with any character except "2" "3" "4" "8" or "6".
#myawk17 # display all which do not contain 2, 3, 4, 6 or 8 in first field $1 ~ /[^23468]/ { print $0 } myawk17 Program Output XT 640 D402 MG0010 0 Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100 $unix 16636 A405 CC0185 660 "trs80" 64 Z101 EL0020 0 Why are the lines containing "68020", "68030" and "trs80" also displayed? ............................................................................................ ............................................................................................ ............................................................................................ #myawk18 # display all lines where field one contains A-Z, a-z $1 ~ /[a-zA-Z]/ { print $0 } myawk18 Program Output XT 640 D402 MG0010 0 Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 $unix 16636 A405 CC0185 660 "trs80" 64 Z101 EL0020 0Parentheses are used to group options together, and the vertical bar is used for alternatives. In the following example (myawk19), it searches all input lines for the string "Apple", "Mac", "68020" or "68030".
#myawk19 # illustrate multiple searching using alternatives /(Apple|Mac|68020|68030)/ { print $0 } myawk19 Program Output Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100
To use metacharacters as part of a search string, their special meaning must be disabled. This is done by preceding them with the backslash (\) symbol. The following example prints all input lines which contain the string "b$".
/b\$/ { print $0 }Write an awk program which prints out all input lines for computers which belong to the school of management (using metacharacters). After running the program successfully, enter it in the space provided below.
...............................................................................Write an awk program which prints out all input lines for computer types which begin with a dollar ($) symbol (using metacharacters). After running the program successfully, enter it in the space provided below.
...............................................................................
\b backspace \f formfeed \r carriage return \t tab \" double quoteThe following example prints all input lines which contain a tab character
/\t/ { print $0 }Consider also the use of string concatenation in pattern matching. The plus (+) symbol concatenates one or more strings in pattern matching. The following awk program (myawk16a) searches for computer types which begin with a dollar ($) symbol and are followed by an alphabetic character (a-z, A-Z), and the last character in the string is the symbol x.
#myawk16a $1 ~ /^\$+[a-zA-Z]+x$/ { print $0 } myawk16 Program Output $unix 16636 A405 CC0185 660Write an awk program which prints out all input lines for computer types which are enclosed in double quotes (using metacharacters). After running the program successfully, enter it in the space provided below.
...............................................................................awk interprets any string or variable on the right side of a ~ or !~ as a regular expression. This means the regular expression can be assigned to a variable, and the variable used later in pattern matching. An earlier awk program (myawk17) searched for input lines where field one did not contain the digits 2, 3, 4, 6 or 8.
#myawk17 # display all which do not contain 2, 3, 4, 6 or 8 in first field $1 ~ /[^23468]/ { print $0 }
The awk program below shows how to rewrite this (myawk17) using a variable which is assigned the regular expression.
#myawk20 BEGIN { matchstr = "[^23468]" } $1 ~ matchstr { print $0 } myawk20 Program Output XT 640 D402 MG0010 0 Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100 $unix 16636 A405 CC0185 660 "trs80" 64 Z101 EL0020 0Consider the following example, which searches for all lines which contain the double quote character (").
#myawk21 BEGIN { matchstr = "\"" } $1 ~ matchstr { print $0 } myawk21 Program Output "trs80" 64 Z101 EL0020 0
|| logical or, either pattern can match && logical and, both patterns must match ! logical not, patterns not matchingLets suppose we want a list of all "486" computers which have more than 250Mb of hard disk space. The following awk pattern uses the logical and to construct the necessary pattern string.
#myawk22 $1 == "486" && $5 > 250 { print $0 } myawk22 Program Output 486 4096 D404 MG0012<PHONE_NUMBER> A424 CC0182 670Write and awk program which lists all computers of type "286" which have 2Mb or more memory. After running the program successfully, enter it in the space provided below.
...............................................................................Write and awk program which lists all computers of type "286", "386" and "486" which have a hard disk fitted. After running the program successfully, enter it in the space provided below.
...............................................................................
#myawk23 # demonstrate the use of pattern ranges /XT/, /Mac/ { print $0 } myawk23 Program Output XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012<PHONE_NUMBER> A423 CC0177<PHONE_NUMBER> A424 CC0182<PHONE_NUMBER> A423 CC0183<PHONE_NUMBER> A425 CC0184 80 Mac 4096 B407 EE1027 80The awk program myawk23 prints out all input lines between the first occurrence of "XT" and the next occurrence of "Mac".
Write an awk program using a pattern range to print out all input lines beginning with the first computer fitted with 8192Kb of memory, up to the next computer which has less than 80Mb of hard disk. After running the program successfully, enter it in the space provided below.
...............................................................................
ARGC number of command-line arguments ARGV array of command-line arguments FILENAME name of current input file FNR record number in current file FS input field separator (default= space and tab characters) NF number of fields in input line NR number of input lines read so far OFMT output format for numbers (default=%.6) OFS output field separator (default=space) ORS output line separator (default=newline) RS input line separator (default=newline) RSTART index of first character matched by match() RLENGTH length of string matched by match() SUBSEP subscript separator (default="\034") #myawk24 # print the first five input lines of a file, bit like head FNR == 1, FNR == 5 { print $0 } myawk24 Program Output XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012<PHONE_NUMBER> A423 CC0177<PHONE_NUMBER> A424 CC0182 670 =================================================================== #myawk25 # print each input line preceded with a line number # print the heading which includes the name of the file BEGIN { print "File:", FILENAME } { print NR, ":\t", $0 } myawk25 Program Output File: awktext 1 : XT 640 D402 MG0010 0 2 : 386 2048 D403 MG0011 100 3 : 486 4096 D404 MG0012 270 4 : 386 8192 A423 CC0177 400 5 : 486 8192 A424 CC0182 670 6 : 286 4096 A423 CC0183 100 7 : 286 4096 A425 CC0184 80 8 : Mac 4096 B407 EE1027 80 9 : Apple 4096 B406 EE1028 40 10 : 68020 2048 B406 EE1029 80 11 : 68030 2048 B410 EE1030 100 12 : $unix 16636 A405 CC0185 660 13 : "trs80" 64 Z101 EL0020 0 =================================================================== #myawk26 # demonstrate use of argc and argv parameters BEGIN { print "There are ",ARGC, "parameters on the command line"; print "The first argument is ", ARGV[0]; print "The second argument is ", ARGV[1] } myawk26 Program Output (invoked using awk -fmyawk26 awktext) There are 2 parameters on the command line The first argument is awk The second argument is awktext =================================================================== #myawk27 # print out the number of fields in each input line { print "Input line", NR, "has", NF, "fields" } myawk27 Program Output Input line 1 has 5 fields Input line 2 has 5 fields Input line 3 has 5 fields Input line 4 has 5 fields Input line 5 has 5 fields Input line 6 has 5 fields Input line 7 has 5 fields Input line 8 has 5 fields Input line 9 has 5 fields Input line 10 has 5 fields Input line 11 has 5 fields Input line 12 has 5 fields Input line 13 has 5 fieldsUsing the BEGIN statement, it is often desirable to change both FS (the symbol used to separate fields) and RS (the symbol used to separate input lines). The following text file (awktext2) is used for the program myawk28. The test file separates each field using a dollar symbol ($), and each input line by a carat symbol (^). The program reads the file and prints out the username and password for each users record. A heading is shown only for clarity.
awktext2 data format (username$address$password$privledge$downloadlimit$protocol^) Joe Bloggs$767 Main Rd Tawa$smidgy$clerk$500$zmodem^Sam Blue$1023 Kent Drive Porirua$yougessedit$normal$100$xmodem^Bobby Williams$96 Banana Grove$mymum$sysop$3000$zmodem^ #myawk28 # a program which shows use of FS and RS, scans awktext2 BEGIN { FS = "\$"; RS = "\^" } { print "User = ", $1, " Password:", $3 } myawk28 Program Output User = Joe Bloggs Password: smidgy User = Sam Blue Password: yougessedit User = Bobby Williams Password: mymum User = Password:Write an awk program which works with the text file awktext2. The program is to print out all names of users who have a privilege level of "sysop" or "clerk". After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ...............................................................................
+ add - subtract * multiply / divide ++ increment -- decrement % modulus ^ exponential += plus equals -= minus equals *= multiply equals /= divide equals %= modulus equals ^= exponential equalsNow some examples,
sum = sum + 3 # same as sum += 3 sum = x / y n++ # same as n = n + 1The following awk program displays the average installed memory capacity for an IBM type computer (XT - 486). Note the use of %f within the printf statement to print out the result in floating point format. The use of .2 between the % and f symbols specify two decimal places.
#myawk29 /(XT|286|386|486)/ { computers++, ram += $2 } END { avgmem = ram / computers; printf(" The average memory per PC = %.2f", avgmem ) } myawk29 Program Output The average memory per PC = 4480.00Write an awk program to print out all the total cost (to the nearest cent) of disk space for computers belonging to the school of management. Assume that disk space has been costed at $10.20 per megabtye. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ...............................................................................Write an awk program to print out the percentage (to one decimal place) of computers which have 2048Kb or less of memory. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ...............................................................................
atan2(y,x) arctangent of y/x in radians cos(x) cosine of x, with x in radians exp(x) exponential function of x int(x) integer part of x truncated towards 0 log(x) natural logarithm of x rand() random number between 0 and 1 sin(x) sine of x, with x in radians sqrt(x) square root of x srand(x) x is new seed for rand()Consider the following awk program (myawk30) which prints the square root of an inputted value. This program also shows interactive use, by entering the file that awk processes directly from the keyboard. If no data file is specified (as in the example below, awk reads from the keyboard).
#myawk30, to print the square root of a number { print sqrt( $1 ) } Running myawk30 awk -fmyawk30 myawk30 Sample Program Output (user entry shown in bold) 2 1.41421 3 1.73205 4 2Note: The user pressed CTRL-D (F6 for MSDOS) to signify the end of data input.
Write an awk program to calculate and print out (to three decimal places) the natural logarithm of a value entered from the keyboard. After running the program successfully, enter it (and the command used to invoke it) in the space provided.
command: ............................................................................... program: ...............................................................................
"hello\n" gsub(r,s) substitutes s for r globally in current input line, returns the number of substitutions gsub(r,s,t) substitutes s for r in t globally, returns number of substitutions index(s,t) returns position of string t in s, 0 if not present length(s) returns length of s match(s,r) returns position in s where r occurs, 0 if not present split(s,a) splits s into array a on FS, returns number of fields split(s,a,r) splits s into array a on r, returns number of fields sprintf(fmt, expr-list) returns expr-list formatted according to format string specified by fmt sub(r,s) substitutes s for first r in current input line, returns number of substitutions sub(r,s,t) substitutes s for first r in t, returns number of substitutions substr(s,p) returns suffix s starting at position p substr(s,p,n) returns substring of s length n starting at position p
The following awk program (myawk31) uses the string function gsub to replace each occurrence of 286 with the string AT.
#myawk31 { gsub( /286/, "AT" ); print $0 } myawk31 Program Output XT 640 D402 MG0010 0 386 2048 D403 MG0011<PHONE_NUMBER> D404 MG0012<PHONE_NUMBER> A423 CC0177<PHONE_NUMBER> A424 CC0182 670 AT 4096 A423 CC0183 100 AT 4096 A425 CC0184 80 Mac 4096 B407 EE1027 80 Apple 4096 B406 EE1028 40 68020 2048 B406 EE1029 80 68030 2048 B410 EE1030 100 $unix 16636 A405 CC0185 660 "trs80" 64 Z101 EL0020 0
Write an awk program to find and print out the longest computer name (hint: use the length function as a pattern). After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ...............................................................................
Part 3 of 3
Revision : 1.0
Date : 05/05/94
ref awk.doc
if ( expression ) statement1 else statement2The expression can include the relational operators, the regular expression matching operators, the logical operators and parentheses for grouping.
expression is evaluated first, and if NON-ZERO then statement1 is executed, otherwise statement2 is executed.
In the following awk program (myawk32), each input line is scanned and field $5 is compared against the value of the awk user defined variable disksize (awk initialises it to 0). When field $5 is greater, it is assigned to disksize, and the input line is saved in the other user defined variable computer. Note the use of the braces { } to group the program statements as belonging to the if statement (same syntax as in the C language).
#myawk32 #demonstrate use of if statement, find biggest disk { if( disksize < $5 ) { disksize = $5 computer = $0 } } END { print computer } myawk32 Program Output 486 8192 A424 CC0182 670Write an awk program to print out only those computers which are type "486" with 4096Kb or more memory. Use an if statement to perform this. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ............................................................................... ............................................................................... ...............................................................................
while ( expression ) statementexpression is evaluated, and if NON-ZERO then statement is executed, then expression is re-evaluated. This continues until expression evaluates as ZERO, at which time the while statement terminates.
#myawk33 # a while statement to print out each second field only for "286" computers BEGIN { printf("Type\tLoc\tDisk\n") } /286/ { field = 1 while( field < = NF ) { printf("%s\t", $field ) field += 2 } print "" } myawk33 Program Output Type Loc Disk 286 A423 100 286 A425 80
Management 22 Electronics 46 Engineering 12 Health_Science 5 Tourism 20 Registry 18 Computing_Centre 300 Library 4 Halls 2Write an awk program to print out the total number of computers held by the organisation using the data file awktext3. Use a while statement to perform this (Hint: look at myawk33). After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ............................................................................... ...............................................................................
for ( expression1; expression; expression2 ) statementThe for statement provides repetition of a statement. expression1 is executed first, and is normally used to initialise variables used within the for loop. expression is a re-evaluation which determines whether the loop should continue. expression2 is performed at the end of each iteration of the loop, before the re-evaluation test is performed.
1. expression1 2. expression is evaluated. If non-zero got step 3 else exit 3. statement is executed 4. expression2 is executed 5. goto step 2Consider the following awk program (myawk34) which is the same as myawk33 shown earlier.
#myawk34 # a for statement to print out each second field only for "286" computers BEGIN { printf("Type\tLoc\tDisk\n") } /286/ { for( field = 1; field < = NF; field += 2) printf("%s\t", $field ) print "" } myawk34 Program Output Type Loc Disk 286 A423 100 286 A425 80Write an awk program to print out the total number of computers held by the organisation using the data file awktext3. Use a for statement to perform this (Hint: look at your solution using the while statement previously). After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ............................................................................... ............................................................................... ...............................................................................
do statement while( expression )The statement is executed repeatedly until the value of expression is ZERO. statement is executed at least once.
#myawk35 # print out every second field for "286" computers BEGIN { field = 1 } $1 == "286" { do { printf("%s\t", $field) field += 2 } while( field < = NF ) } myawk35 Program Output 286 A423 100
break, continue, next, exitThe break statement causes an immediate exit from within a while or for loop.
The continue statement causes the next iteration of a loop.
The next statement skips to the next input line then re-starts from the first pattern-action statement.
The exit statement causes the program to branch to the END statement (if one exists), else it exits the program.
#myawk36 #print out computer types "286" using a next statement { while( $1 != "286" ) next; print $0 } myawk36 Program Output 286 4096 A423 CC0183<PHONE_NUMBER> A425 CC0184 80
Elements can be specified as numeric or string values. Consider the following awk program (myawk37) which uses arrays to hold the number of "486" computers and the disk space totals for all computers.
#myawk37 # diskspace[] holds sum of disk space for all computers # computers[] holds number of computers of specified type $1 == "486" { computers["486"]++ } $5 > 0 { diskspace[0] += $5 } END { print "Number of 486 computers =", computers[486]; print "Total disk space = ",diskspace[0] } myawk37 Program Output Number of 486 computers = 2 Total disk space = 2580Note that the previous program (myawk37) uses TWO pattern action statements for each input line. The first pattern action statement handles the number of "486" type computers, whilst the second handles the total disk space for all computer types.
Write an awk program to print out the total disk space for computer types "286", "386" and "486". Use arrays to hold the disk space totals. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ............................................................................... ............................................................................... ............................................................................... ...............................................................................Consider the following awk program (myawk38) which uses the in statement associated with processing areas. The program .....
#myawk38 { computers[$1]++ } END { for ( name in computers ) print "The number of ",name,"computers is",computers[name] } myawk38 Program Output The number of "trs80" computers is 1 The number of $unix computers is 1 The number of 286 computers is 2 The number of 386 computers is 2 The number of 486 computers is 2 The number of 68020 computers is 1 The number of 68030 computers is 1 The number of Apple computers is 1 The number of Mac computers is 1 The number of XT computers is 1
function name( argument-list ) { statements }The definition of a function can occur anywhere a pattern-action statement can. argument-list is a list of variable names separated by commas. There must be NO space between the function name and the left bracket of the argument-list.
The return statement is used to return a value by the function.
Consider the following awk program (myawk39) which calculates the factorial of an inputted number.
#myawk39 function factorial( n ) { if( n < = 1 ) return 1 else return n * factorial( n - 1) } { print "the factorial of ", $1, "is ", factorial($1) } Sample myawk39 Program Output (awk -fmyawk39) 10 the factorial of 10 is 3628800 3 the factorial of 3 is 6 1 the factorial of 1 is 1 4 the factorial of 4 is 24
The special characters used in printf, which follow the % symbol, are,
c single character d decimal integer e double number, scientific notation f floating point number g use e or f, whichever is shortest o octal s string x hexadecimal % the % symbolThe default output format is %.6g and is changed by assigning a new value to OFMT.
#myawk40 # demonstrates sending output to a file $1 == "486" { print "Type=",$1, "Location=",$3 > "comp486.dat" Sample output contained in 'comp486.dat' Type= 486 Location= D404 Type= 486 Location= A424Write an awk program to print out the total disk space for computer types "286", "386" and "486". Use arrays to hold the disk space totals. The output will be stored in the file 'dspace.dat'. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ............................................................................... ............................................................................... ............................................................................... ...............................................................................
print " ",$1 | "sort"causes the output of the print command to be piped to the UNIX sort command.
Write an awk program to print out a sorted list of all "286", "386" and "486" computers sorted according to disk size. After running the program successfully, enter it in the space provided below.
............................................................................... ............................................................................... ...............................................................................
awk '/286/ {print $0 }' awktextNote: For MSDOS systems, a double quote must be used to enclose the awk program when specified on the command line.
getline reads the next input line, splitting it into fields according to the settings of NF, NR and FNR. It returns 1 for success, 0 for end-of-file, and -1 on error.
The statement
getline datareads the next input line into the user defined variable data. No splitting of fields is done and NF is not set.
The statement
getline < "temp.dat"reads the next input line from the file "temp.dat", field splitting is performed, and NF is set.
The statement
getline data < "temp.dat"reads the next input line from the file "temp.dat" into the user defined variable data, no field splitting is done, and NF, NR and FNR are not altered.
Consider the following example, which pipes the output of the UNIX command who into getline. Each time through the while loop, another line is read from who, and the user defined variable users is incremented. The program counts the number of users on the host system.
while ( "who" | getline ) users++Write an awk program to list all details of type "286" computers. Prefix the list with the current date (Hint: see the previous example, and the UNIX command date). After running the program successfully, enter it in the space provided below.
............................................................................... ...............................................................................
Command Line awk program filenames awk -f program-file filenames awk -Fs (sets field separator to string s, -Ft sets separator to tab) Patterns BEGIN END /regular expression/ relational expression pattern & & pattern pattern || pattern (pattern) !pattern pattern, pattern Control Flow Statements if ( expr) statement [ else statement] if ( subscript in array) statement [ else statement] while ( expr) statement for ( expr ; expr ; expr ) statement for ( var in array ) statement do statement while ( expr) break continue next exit [ expr] return [ expr] Input Output close( filename ) close file getline set $0 form next input line, set NF, NR, FNR getline < file set $0 from next input line of file, set NF getline var set var from next input line, net NR, FNR getline var < file set var from next input line of file print print current input line print expr-list print expressions print expr-list > file print expressions to file printf fmt, expr-list format and print printf fmt, expr-list > file format and print to file system( cmd-line ) execute command cmd-line, return status In print and printf above, > > appends to a file, and the | command writes to a pipe. Similarly, command | getline pipes into getline. The function getline returns 0 on the end of a file, -1 on an error. Functions func name( parameter list ) { statement } function name ( parameter list ) { statement } function-name ( expr, expr, ... ) String Functions gsub(r,s,t) substitutes s for r in t globally, returns number of substitutions index(s,t) returns position of string t in s, 0 if not present length(s) returns length of s match(s,r) returns position in s where r occurs, 0 if not present split(s,a,r) splits s into array a on r, returns number of fields sprintf(fmt, expr-list) returns expr-list formatted according to format string specified by fmt sub(r,s,t) substitutes s for first r in t, returns number of substitutions substr(s,p,n) returns substring of s length n starting at position p Arithmetic Functions atan2(y,x) arctangent of y/x in radians cos(x) cosine of x, with x in radians exp(x) exponential function of x int(x) integer part of x truncated towards 0 log(x) natural logarithm of x rand() random number between 0 and 1 sin(x) sine of x, with x in radians sqrt(x) square root of x srand(x) x is new seed for rand() Operators (increasing precedence) = += -= *= /= %= ^= assignment ?: conditional expression || logical or & & logical and ~ !~ regular expression match, negated match < < = > > = != == relationals blank string concatenation + - add, subtract * / % multiply, divide, modulus + - ! unary plus, unary minus, logical negation ^ exponentional ++ -- increment, decrement $ field Regular Expressions (increasing precedence) c matches no-metacharacter c \c matches literal character c . matches any character except newline ^ matches beginning of line or string $ matches end of line or string [abc...] character class matches any of abc... [^abc...] negated class matches any but abc... and newline r1 | r2 matches either r1 or r2 r1r2 concatenation: matches r1, then r2 r+ matches one or more r's r* matches zero or more r's r? matches zeor or more r's (r) grouping: matches r Built-In Variables ARGC number of command-line arguments ARGV array of command-line arguments (0..ARGC-1fR) FILENAME name of current input file FNR input line number number in current file FS input field separator (default blank) NF number of fields in input line NR number of input lines read so far OFMT output format for numbers (default=%.6g) OFS output field separator (default=space) ORS output line separator (default=newline) RS input line separator (default=newline) RSTART index of first character matched by match() RLENGTH length of string matched by match() SUBSEP subscript separator (default=\034") Limits Each implementation of awk imposes some limits. Below are typical limits 100 fields 2500 characters per input line 2500 characters per output line 1024 characters per individual field 1024 characters per printf string 400 characters maximum quoted string 400 characters in character class 15 open files 1 pipe
UNIX uses a LF to separate each line of a file. There is no end of file character.
SCO UNIX provides a mechanism for converting between MSDOS and UNIX file formats.
dtox converts a MSDOS file to UNIX format (does not strip the end-of-file character). dtox awktext > awktext.unx It may also be necessary to load the file into an editor and remove the end- of-file character. xtod converts a UNIX file to MSDOS format. xtod awktext.unx > awktext


Gateway
BOT
21-Jun-18 03:16 PM
[discord] <jimboscott> Can locked coins be moved to another wallet by exporting Private Keys?
[discord] <jl777c> yes, coins dont actually exist inside a wallet. a wallet is just a way to view coins that are on the blockchain
[discord] <jimboscott> OK - then how do I do it? I see nothing anywhere on how to move immature coins from one wallet to another.
[discord] <jimboscott> The steps for getting the Priv key do not work as described for other coins.
[discord] <jimboscott> As I possibly understand it - it may not be possible to do this with immature coins because locking them means... they are not really mine on the blockchain...
[discord] <jimboscott> Not yet.
[discord] <jl777c> but if you know the address that mined it, you can dumpprivkey for that address, importprivkey in a different wallet
[discord] <jl777c> the wallet wont know that it was or wasnt the original. possession of the privkey is possession of the coins
[discord] <jl777c> maybe the actual address is not clear, but it is encoded in the OP_RETURN that has the redeemscript for the p2sh address, which is basically a standard <locktime> CLTV OP_DROP <normal script>
[discord] <jimboscott> By the time I figure that out... my coins will all be mature...
[discord] <jimboscott> May I just copy all my wallet.dat files for backups.
[discord] <jimboscott> maybe
[discord] <jimboscott> No.... YOU can.... not me - necessarily
[discord] <jl777c> given the normal script you can calculate the address
[discord] <jl777c> maybe just doing listtransactions will just display the address
[discord] <jimboscott> is that a CLI command?
[slack] <jl777> i know very scary
[discord] <jimboscott> possession of the privkey is possession of the coins - true - but when the coins are locked.... I really do not possess them....
[discord] <englal> @jimboscott They're yours, no one else will ever be able to spend them, they just have a condition attached to them. They aren't liquid, but they're yours.
[discord] <jimboscott> Got that. Using the GUI Agama wallet, the steps for exporting the Private keys for a transaction are not available it seems...
[discord] <jimboscott> Maybe I just need to backup my wallet.dat files on all my boxes and forget about trying to move all to one wallet.
[discord] <englal> We'll have to take a look at that. In the mean time if you go to settings and scroll to the bottom, there's an interface where you can run CLI commands. I would expect it to work if you use the command:
dumpprivkey "address"
[discord] <englal> *of course, replacing address with the address you want the private key for
[discord] <jimboscott> That did give me a response.... thanks. Now I will try to import that key...


Once you have captured data you will probably want to export it so that you can view and use it on your desktop computer. To do this you will have to have an account with one of the Cloud Storage providers that Fieldtrip GB lonks to (DropBox).
First you need to log into your Cloud Storage via Fieldtrip GB. To do this, tap the Login Button on the home screen and login screen will appear. Enter your Cloud Service user details and Allow Fieldtrip GB's PCAPI to connect to your Cloud Storage(Fig 6.1).
When you return to the home page you will see that the login button has change to a Logout. Tap the Records Button (fig 6.2) and you should see a list of the data records you have captured (Fig 6.3).
The View Records Screen displays all your records and identifies which have been exported to your Cloud Storage and which have not (fig 6.4). You can also manage your records and delete any records that you are not happy with.
To upload/export the records to your cloud area, tap the Synch Button. In addition, this will download any records that are in your Cloud Storage that don not exist on the device. Note - records that have previously existed on the device but have been deleted will NOT be re-downloaded.


Home
Shop Online
Locations
NEW STORE LOCATION
New Store Name:
Time New Store Will Open:
Time New Store Will Close:
Minimum Number of Customers Per Hour:
Maximum Number of Customers Per Hour:
Average Number of Cookies Per Sale:
TOTAL SALES


THE LAST UNICORN
A film review by Shane R. Burridge
Copyright 1996 Shane R. Burridge
(1982) 94m.
Thoughtful animated fantasy may be too wordy for some children but should appeal to kids who read. It's a little slow at the start but worth sticking with. The last unicorn of the title (voiced by Mia Farrow) is searching for others of her kind. She believes the answer lies in a rundown castle near the sea. This is the standard `quest' material that most fantasy is made of, but in this case heroics and spectacle are secondary to drama, which may explain the presence of big names in the cast. Alan Arkin, Jeff Bridges (who would play an animated character of a different kind the same year in TRON), Christopher Lee, Tammy Grimes, Angela Lansbury, Keenan Wynn, and Robert Klein all voice characters that have a passing resemblance to their real selves. The animation, produced in Japan, isn't on a par with Disney, and the female characters have those irritating oversized eyes that are symptomatic of anime figures, but it holds up. Story has many original touches and deals with love, regret, myth versus reality, and it's major theme, the subjectivity of truth. Unlike most animated films, this one doesn't throw in slapstick or comedy relief (although Arkin has some light moments). Every character bears some form of loss - unconsciously they join the unicorn on quests of their own to look beyond illusion and archetype. Not all of them find what they're looking for. Film doesn't handle these ideas in an exclusively adult way (it still comes across as a children's cartoon), and makes pleasant family viewing. I can imagine it being watched at home by mothers and their daughters during school holidays. Peter S. Beagle adapted his own novel for the screen - he was also responsible for the difficult task of adapting THE LORD OF THE RINGS for Ralph Bakshi a few years earlier. Pop group America perform Jimmy Webb's songs and help add to the story's wistful mood. Directed by the team of Jules Bass and Arthur Rankin Jr who had previously worked together for ten years producing animated features for television.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


expanding-cards
# 50 Projects in 50 Days - HTML/CSS and JavaScript This is the main repository
for all of the projects in the course. - [Course
Link](https://www.udemy.com/course/50-projects-50-days) - [Course Info
Website](https://50projects50days.com) | # | Project | Live Demo | | :-: |
---------------------------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
| | 01 | [Expanding
Cards](https://github.com/bradtraversy/50projects50days/tree/master/expanding-cards)
| [Live Demo](https://50projects50days.com/projects/expanding-cards/) | | 02 |
[Progress
Steps](https://github.com/bradtraversy/50projects50days/tree/master/progress-steps)
| [Live Demo](https://50projects50days.com/projects/progress-steps/) | | 03 |
[Rotating Navigation
Animation](https://github.com/bradtraversy/50projects50days/tree/master/rotating-nav-animation)
| [Live
Demo](https://50projects50days.com/projects/rotating-navigation-animation/) | |
04 | [Hidden Search
Widget](https://github.com/bradtraversy/50projects50days/tree/master/hidden-search)
| [Live Demo](https://50projects50days.com/projects/hidden-search-widget/) | |
05 | [Blurry
Loading](https://github.com/bradtraversy/50projects50days/tree/master/blurry-loading)
| [Live Demo](https://50projects50days.com/projects/blurry-loading/) | | 06 |
[Scroll
Animation](https://github.com/bradtraversy/50projects50days/tree/master/scroll-animation)
| [Live Demo](https://50projects50days.com/projects/scroll-animation/) | | 07 |
[Split Landing
Page](https://github.com/bradtraversy/50projects50days/tree/master/split-landing-page)
| [Live Demo](https://50projects50days.com/projects/split-landing-page/) | | 08
| [Form
Wave](https://github.com/bradtraversy/50projects50days/tree/master/form-input-wave)
| [Live Demo](https://50projects50days.com/projects/form-wave/) | | 09 | [Sound
Board](https://github.com/bradtraversy/50projects50days/tree/master/sound-board)
| [Live Demo](https://50projects50days.com/projects/sound-board/) | | 10 | [Dad
Jokes](https://github.com/bradtraversy/50projects50days/tree/master/dad-jokes) |
[Live Demo](https://50projects50days.com/projects/dad-jokes/) | | 11 | [Event
Keycodes](https://github.com/bradtraversy/50projects50days/tree/master/event-keycodes)
| [Live Demo](https://50projects50days.com/projects/event-keycodes/) | | 12 |
[Faq
Collapse](https://github.com/bradtraversy/50projects50days/tree/master/faq-collapse)
| [Live Demo](https://50projects50days.com/projects/faq-collapse/) | | 13 |
[Random Choice
Picker](https://github.com/bradtraversy/50projects50days/tree/master/random-choice-picker)
| [Live Demo](https://50projects50days.com/projects/random-choice-picker/) | |
14 | [Animated
Navigation](https://github.com/bradtraversy/50projects50days/tree/master/animated-navigation)
| [Live Demo](https://50projects50days.com/projects/animated-navigation/) | | 15
| [Incrementing
Counter](https://github.com/bradtraversy/50projects50days/tree/master/incrementing-counter)
| [Live Demo](https://50projects50days.com/projects/incrementing-counter/) | |
16 | [Drink
Water](https://github.com/bradtraversy/50projects50days/tree/master/drink-water)
| [Live Demo](https://50projects50days.com/projects/drink-water/) | | 17 |
[Movie
App](https://github.com/bradtraversy/50projects50days/tree/master/movie-app) |
[Live Demo](https://50projects50days.com/projects/movie-app/) | | 18 |
[Background
Slider](https://github.com/bradtraversy/50projects50days/tree/master/background-slider)
| [Live Demo](https://50projects50days.com/projects/background-slider/) | | 19 |
[Theme
Clock](https://github.com/bradtraversy/50projects50days/tree/master/theme-clock)
| [Live Demo](https://50projects50days.com/projects/theme-clock/) | | 20 |
[Button Ripple
Effect](https://github.com/bradtraversy/50projects50days/tree/master/button-ripple-effect)
| [Live Demo](https://50projects50days.com/projects/button-ripple-effect/) | |
21 | [Drag N
Drop](https://github.com/bradtraversy/50projects50days/tree/master/drag-n-drop)
| [Live Demo](https://50projects50days.com/projects/drag-n-drop/) | | 22 |
[Drawing
App](https://github.com/bradtraversy/50projects50days/tree/master/drawing-app) |
[Live Demo](https://50projects50days.com/projects/drawing-app/) | | 23 |
[Kinetic
Loader](https://github.com/bradtraversy/50projects50days/tree/master/kinetic-loader)
| [Live Demo](https://50projects50days.com/projects/kinetic-loader/) | | 24 |
[Content
Placeholder](https://github.com/bradtraversy/50projects50days/tree/master/content-placeholder)
| [Live Demo](https://50projects50days.com/projects/content-placeholder/) | | 25
| [Sticky
Navbar](https://github.com/bradtraversy/50projects50days/tree/master/sticky-navigation)
| [Live Demo](https://50projects50days.com/projects/sticky-navbar/) | | 26 |
[Double Vertical
Slider](https://github.com/bradtraversy/50projects50days/tree/master/double-vertical-slider)
| [Live Demo](https://50projects50days.com/projects/double-vertical-slider/) | |
27 | [Toast
Notification](https://github.com/bradtraversy/50projects50days/tree/master/toast-notification)
| [Live Demo](https://50projects50days.com/projects/toast-notification/) | | 28
| [Github
Profiles](https://github.com/bradtraversy/50projects50days/tree/master/github-profiles)
| [Live Demo](https://50projects50days.com/projects/github-profiles/) | | 29 |
[Double Click
Heart](https://github.com/bradtraversy/50projects50days/tree/master/double-click-heart)
| [Live Demo](https://50projects50days.com/projects/double-click-heart/) | | 30
| [Auto Text
Effect](https://github.com/bradtraversy/50projects50days/tree/master/auto-text-effect)
| [Live Demo](https://50projects50days.com/projects/auto-text-effect/) | | 31 |
[Password
Generator](https://github.com/bradtraversy/50projects50days/tree/master/password-generator)
| [Live Demo](https://50projects50days.com/projects/password-generator/) | | 32
| [Good Cheap
Fast](https://github.com/bradtraversy/50projects50days/tree/master/good-cheap-fast)
| [Live Demo](https://50projects50days.com/projects/good-cheap-fast/) | | 33 |
[Notes
App](https://github.com/bradtraversy/50projects50days/tree/master/notes-app) |
[Live Demo](https://50projects50days.com/projects/notes-app/) | | 34 | [Animated
Countdown](https://github.com/bradtraversy/50projects50days/tree/master/animated-countdown)
| [Live Demo](https://50projects50days.com/projects/animated-countdown/) | | 35
| [Image
Carousel](https://github.com/bradtraversy/50projects50days/tree/master/image-carousel)
| [Live Demo](https://50projects50days.com/projects/image-carousel/) | | 36 |
[Hoverboard](https://github.com/bradtraversy/50projects50days/tree/master/hoverboard)
| [Live Demo](https://50projects50days.com/projects/hoverboard/) | | 37 |
[Pokedex](https://github.com/bradtraversy/50projects50days/tree/master/pokedex)
| [Live Demo](https://50projects50days.com/projects/pokedex/) | | 38 | [Mobile
Tab
Navigation](https://github.com/bradtraversy/50projects50days/tree/master/mobile-tab-navigation)
| [Live Demo](https://50projects50days.com/projects/mobile-tab-navigation/) | |
39 | [Password Strength
Background](https://github.com/bradtraversy/50projects50days/tree/master/password-strength-background)
| [Live
Demo](https://50projects50days.com/projects/password-strength-background/) | |
40 | [3d Background
Boxes](https://github.com/bradtraversy/50projects50days/tree/master/3d-boxes-background)
| [Live Demo](https://50projects50days.com/projects/3d-background-boxes/) | | 41
| [Verify Account
Ui](https://github.com/bradtraversy/50projects50days/tree/master/verify-account-ui)
| [Live Demo](https://50projects50days.com/projects/verify-account-ui/) | | 42 |
[Live User
Filter](https://github.com/bradtraversy/50projects50days/tree/master/live-user-filter)
| [Live Demo](https://50projects50days.com/projects/live-user-filter/) | | 43 |
[Feedback Ui
Design](https://github.com/bradtraversy/50projects50days/tree/master/feedback-ui-design)
| [Live Demo](https://50projects50days.com/projects/feedback-ui-design/) | | 44
| [Custom Range
Slider](https://github.com/bradtraversy/50projects50days/tree/master/custom-range-slider)
| [Live Demo](https://50projects50days.com/projects/custom-range-slider/) | | 45
| [Netflix Mobile
Navigation](https://github.com/bradtraversy/50projects50days/tree/master/netflix-mobile-navigation)
| [Live Demo](https://50projects50days.com/projects/netflix-mobile-navigation/)
| | 46 | [Quiz
App](https://github.com/bradtraversy/50projects50days/tree/master/quiz-app) |
[Live Demo](https://50projects50days.com/projects/quiz-app/) | | 47 |
[Testimonial Box
Switcher](https://github.com/bradtraversy/50projects50days/tree/master/testimonial-box-switcher)
| [Live Demo](https://50projects50days.com/projects/testimonial-box-switcher/) |
| 48 | [Random Image
Feed](https://github.com/bradtraversy/50projects50days/tree/master/random-image-generator)
| [Live Demo](https://50projects50days.com/projects/random-image-feed/) | | 49 |
[Todo
List](https://github.com/bradtraversy/50projects50days/tree/master/todo-list) |
[Live Demo](https://50projects50days.com/projects/todo-list/) | | 50 | [Insect
Catch
Game](https://github.com/bradtraversy/50projects50days/tree/master/insect-catch-game)
| [Live Demo](https://50projects50days.com/projects/insect-catch-game/) | **NOTE
ON PULL REQUESTS**: All of these projects are part of the course. While I do
appreciate people trying to make some things prettier or adding new features, we
are only accepting pull requests and looking at issues for bug fixes so that the
code stays inline with the course ## License The MIT License Copyright (c)
2020-2021 Traversy Media https://traversymedia.com Permission is hereby granted,
free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the
following conditions: The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.  IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


--- layout: post title: SMC 1.1 update adds noise to silence date: 2006-11-05 10:58:41.000000000 +01:00 type: post published: true status: publish categories: - apple & OSX - horror tags: [] meta: _publicize_job_id: '14401146770' original_post_id: '39' _wp_old_slug: '39' _oembed_5eb405d7e525422fbd99bf7cdb4ee56e: "{{unknown}}" author: login: joesixpack email<EMAIL_ADDRESS>display_name: dirk lüsebrink first_name: '' last_name: '' ---
I had a perfectly quiet MacBook. Contrary to the MacBook Pro of my friend i never expierenced any hissing sounds when idle or suffered from always running fans. This is history now after the recent SMC update of Apple. For keeping the macbooks cooler they tuned the fan settings to effectivly keep the fan running all the time, at least with a mininum RPM. Whether the hissing sound is in direct relation to the fan speed i cannot tell yet. We are still speaking of a very low volume noise level here. You can't hear it at work in the office space so it took me a couple of days to realize this new reality, i just did not want to accept the truth. Now when stitting at home, sunday morning, quiet, coffee, i keep hearing it sizzling along. I would prefer my macbook getting hot instead of noisy, especially in the now upcoming berlin winter.
have fun


public class Color extends Object implements Paint, Serializable
Color
class is used to encapsulate colors in the default
sRGB color space or colors in arbitrary color spaces identified by a
ColorSpace
. Every color has an implicit alpha value of 1.0 or
an explicit one provided in the constructor. The alpha value
defines the transparency of a color and can be represented by
a float value in the range 0.0 - 1.0 or 0 - 255.
An alpha value of 1.0 or 255 means that the color is completely
opaque and an alpha value of 0 or 0.0 means that the color is
completely transparent.
When constructing a Color
with an explicit alpha or
getting the color/alpha components of a Color
, the color
components are never premultiplied by the alpha component.
The default color space for the Java 2D(tm) API is sRGB, a proposed standard RGB color space. For further information on sRGB, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .
ColorSpace
,
AlphaComposite
,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static Color |
black
The color black.
|
static Color |
BLACK
The color black.
|
static Color |
blue
The color blue.
|
static Color |
BLUE
The color blue.
|
static Color |
cyan
The color cyan.
|
static Color |
CYAN
The color cyan.
|
static Color |
DARK_GRAY
The color dark gray.
|
static Color |
darkGray
The color dark gray.
|
static Color |
gray
The color gray.
|
static Color |
GRAY
The color gray.
|
static Color |
green
The color green.
|
static Color |
GREEN
The color green.
|
static Color |
LIGHT_GRAY
The color light gray.
|
static Color |
lightGray
The color light gray.
|
static Color |
magenta
The color magenta.
|
static Color |
MAGENTA
The color magenta.
|
static Color |
orange
The color orange.
|
static Color |
ORANGE
The color orange.
|
static Color |
pink
The color pink.
|
static Color |
PINK
The color pink.
|
static Color |
red
The color red.
|
static Color |
RED
The color red.
|
static Color |
white
The color white.
|
static Color |
WHITE
The color white.
|
static Color |
yellow
The color yellow.
|
static Color |
YELLOW
The color yellow.
|
BITMASK, OPAQUE, TRANSLUCENT
| Constructor and Description |
|---|
Color(ColorSpace cspace,
float[] components,
float alpha)
Creates a color in the specified
ColorSpace
with the color components specified in the float
array and the specified alpha. |
Color(float r,
float g,
float b)
Creates an opaque sRGB color with the specified red, green, and blue
values in the range (0.0 - 1.0).
|
Color(float r,
float g,
float b,
float a)
Creates an sRGB color with the specified red, green, blue, and
alpha values in the range (0.0 - 1.0).
|
Color(int rgb)
Creates an opaque sRGB color with the specified combined RGB value
consisting of the red component in bits 16-23, the green component
in bits 8-15, and the blue component in bits 0-7.
|
Color(int rgba,
boolean hasalpha)
Creates an sRGB color with the specified combined RGBA value consisting
of the alpha component in bits 24-31, the red component in bits 16-23,
the green component in bits 8-15, and the blue component in bits 0-7.
|
Color(int r,
int g,
int b)
Creates an opaque sRGB color with the specified red, green,
and blue values in the range (0 - 255).
|
Color(int r,
int g,
int b,
int a)
Creates an sRGB color with the specified red, green, blue, and alpha
values in the range (0 - 255).
|
| Modifier and Type | Method and Description |
|---|---|
Color |
brighter()
Creates a new
Color that is a brighter version of this
Color . |
PaintContext |
createContext(ColorModel cm,
Rectangle r,
Rectangle2D r2d,
AffineTransform xform,
RenderingHints hints)
Creates and returns a
PaintContext used to
generate a solid color field pattern. |
Color |
darker()
Creates a new
Color that is a darker version of this
Color . |
static Color |
decode(String nm)
Converts a
String to an integer and returns the
specified opaque Color . |
boolean |
equals(Object obj)
Determines whether another object is equal to this
Color . |
int |
getAlpha()
Returns the alpha component in the range 0-255.
|
int |
getBlue()
Returns the blue component in the range 0-255 in the default sRGB
space.
|
static Color |
getColor(String nm)
Finds a color in the system properties.
|
static Color |
getColor(String nm,
Color v)
Finds a color in the system properties.
|
static Color |
getColor(String nm,
int v)
Finds a color in the system properties.
|
float[] |
getColorComponents(ColorSpace cspace,
float[] compArray)
Returns a
float array containing only the color
components of the Color in the
ColorSpace specified by the cspace
parameter. |
float[] |
getColorComponents(float[] compArray)
Returns a
float array containing only the color
components of the Color , in the
ColorSpace of the Color . |
ColorSpace |
getColorSpace()
Returns the
ColorSpace of this Color . |
float[] |
getComponents(ColorSpace cspace,
float[] compArray)
Returns a
float array containing the color and alpha
components of the Color , in the
ColorSpace specified by the cspace
parameter. |
float[] |
getComponents(float[] compArray)
Returns a
float array containing the color and alpha
components of the Color , in the
ColorSpace of the Color . |
int |
getGreen()
Returns the green component in the range 0-255 in the default sRGB
space.
|
static Color |
getHSBColor(float h,
float s,
float b)
Creates a
Color object based on the specified values
for the HSB color model. |
int |
getRed()
Returns the red component in the range 0-255 in the default sRGB
space.
|
int |
getRGB()
Returns the RGB value representing the color in the default sRGB
ColorModel . |
float[] |
getRGBColorComponents(float[] compArray)
Returns a
float array containing only the color
components of the Color , in the default sRGB color
space. |
float[] |
getRGBComponents(float[] compArray)
Returns a
float array containing the color and alpha
components of the Color , as represented in the default
sRGB color space. |
int |
getTransparency()
Returns the transparency mode for this
Color . |
int |
hashCode()
Computes the hash code for this
Color . |
static int |
HSBtoRGB(float hue,
float saturation,
float brightness)
Converts the components of a color, as specified by the HSB
model, to an equivalent set of values for the default RGB model.
|
static float[] |
RGBtoHSB(int r,
int g,
int b,
float[] hsbvals)
Converts the components of a color, as specified by the default RGB
model, to an equivalent set of values for hue, saturation, and
brightness that are the three components of the HSB model.
|
String |
toString()
Returns a string representation of this
Color . |
public static final Color white
public static final Color WHITE
public static final Color lightGray
public static final Color LIGHT_GRAY
public static final Color gray
public static final Color GRAY
public static final Color darkGray
public static final Color DARK_GRAY
public static final Color black
public static final Color BLACK
public static final Color red
public static final Color RED
public static final Color pink
public static final Color PINK
public static final Color orange
public static final Color ORANGE
public static final Color yellow
public static final Color YELLOW
public static final Color green
public static final Color GREEN
public static final Color magenta
public static final Color MAGENTA
public static final Color cyan
public static final Color CYAN
public static final Color blue
public static final Color BLUE
public Color(int r, int g, int b)
r
- the red componentg
- the green componentb
- the blue componentIllegalArgumentException
- if r
, g
or b
are outside of the range
0 to 255, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getRGB()
@ConstructorProperties(value={"red","green","blue","alpha"}) public Color(int r, int g, int b, int a)
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha componentIllegalArgumentException
- if r
, g
,
b
or a
are outside of the range
0 to 255, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getAlpha()
,
getRGB()
public Color(int rgb)
rgb
- the combined RGB componentsColorModel.getRGBdefault()
,
getRed()
,
getGreen()
,
getBlue()
,
getRGB()
public Color(int rgba, boolean hasalpha)
hasalpha
argument is false
, alpha
is defaulted to 255.rgba
- the combined RGBA componentshasalpha
- true
if the alpha bits are valid;
false
otherwiseColorModel.getRGBdefault()
,
getRed()
,
getGreen()
,
getBlue()
,
getAlpha()
,
getRGB()
public Color(float r, float g, float b)
r
- the red componentg
- the green componentb
- the blue componentIllegalArgumentException
- if r
, g
or b
are outside of the range
0.0 to 1.0, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getRGB()
public Color(float r, float g, float b, float a)
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha componentIllegalArgumentException
- if r
, g
b
or a
are outside of the range
0.0 to 1.0, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getAlpha()
,
getRGB()
public Color(ColorSpace cspace, float[] components, float alpha)
ColorSpace
with the color components specified in the float
array and the specified alpha. The number of components is
determined by the type of the ColorSpace
. For
example, RGB requires 3 components, but CMYK requires 4
components.cspace
- the ColorSpace
to be used to
interpret the componentscomponents
- an arbitrary number of color components
that is compatible with the ColorSpace
alpha
- alpha valueIllegalArgumentException
- if any of the values in the
components
array or alpha
is
outside of the range 0.0 to 1.0getComponents(float[])
,
getColorComponents(float[])
public int getRed()
getRGB()
public int getGreen()
getRGB()
public int getBlue()
getRGB()
public int getAlpha()
getRGB()
public int getRGB()
ColorModel
.
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are
blue).ColorModel
.ColorModel.getRGBdefault()
,
getRed()
,
getGreen()
,
getBlue()
public Color brighter()
Color
that is a brighter version of this
Color
.
This method applies an arbitrary scale factor to each of the three RGB
components of this Color
to create a brighter version
of this Color
.
The alpha
value is preserved.
Although brighter
and
darker
are inverse operations, the results of a
series of invocations of these two methods might be inconsistent
because of rounding errors.
Color
object that is
a brighter version of this Color
with the same alpha
value.darker()
public Color darker()
Color
that is a darker version of this
Color
.
This method applies an arbitrary scale factor to each of the three RGB
components of this Color
to create a darker version of
this Color
.
The alpha
value is preserved.
Although brighter
and
darker
are inverse operations, the results of a series
of invocations of these two methods might be inconsistent because
of rounding errors.
Color
object that is
a darker version of this Color
with the same alpha
value.brighter()
public int hashCode()
Color
.hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean equals(Object obj)
Color
.
The result is true
if and only if the argument is not
null
and is a Color
object that has the same
red, green, blue, and alpha values as this object.
equals
in class Object
obj
- the object to test for equality with this
Color
true
if the objects are the same;
false
otherwise.Object.hashCode()
,
HashMap
public String toString()
Color
. This
method is intended to be used only for debugging purposes. The
content and format of the returned string might vary between
implementations. The returned string might be empty but cannot
be null
.public static Color decode(String nm) throws NumberFormatException
String
to an integer and returns the
specified opaque Color
. This method handles string
formats that are used to represent octal and hexadecimal numbers.nm
- a String
that represents
an opaque color as a 24-bit integerColor
object.NumberFormatException
- if the specified string cannot
be interpreted as a decimal,
octal, or hexadecimal integer.Integer.decode(java.lang.String)
public static Color getColor(String nm)
The argument is treated as the name of a system property to
be obtained. The string value of this property is then interpreted
as an integer which is then converted to a Color
object.
If the specified property is not found or could not be parsed as
an integer then null
is returned.
nm
- the name of the color propertyColor
converted from the system
property.System.getProperty(java.lang.String)
,
Integer.getInteger(java.lang.String)
,
Color(int)
public static Color getColor(String nm, Color v)
The first argument is treated as the name of a system property to
be obtained. The string value of this property is then interpreted
as an integer which is then converted to a Color
object.
If the specified property is not found or cannot be parsed as
an integer then the Color
specified by the second
argument is returned instead.
nm
- the name of the color propertyv
- the default Color
Color
converted from the system
property, or the specified Color
.System.getProperty(java.lang.String)
,
Integer.getInteger(java.lang.String)
,
Color(int)
public static Color getColor(String nm, int v)
The first argument is treated as the name of a system property to
be obtained. The string value of this property is then interpreted
as an integer which is then converted to a Color
object.
If the specified property is not found or could not be parsed as
an integer then the integer value v
is used instead,
and is converted to a Color
object.
nm
- the name of the color propertyv
- the default color value, as an integerColor
converted from the system
property or the Color
converted from
the specified integer.System.getProperty(java.lang.String)
,
Integer.getInteger(java.lang.String)
,
Color(int)
public static int HSBtoRGB(float hue, float saturation, float brightness)
The saturation
and brightness
components
should be floating-point values between zero and one
(numbers in the range 0.0-1.0). The hue
component
can be any floating-point number. The floor of this number is
subtracted from it to create a fraction between 0 and 1. This
fractional number is then multiplied by 360 to produce the hue
angle in the HSB color model.
The integer that is returned by HSBtoRGB
encodes the
value of a color in bits 0-23 of an integer value that is the same
format used by the method getRGB
.
This integer can be supplied as an argument to the
Color
constructor that takes a single integer argument.
hue
- the hue component of the colorsaturation
- the saturation of the colorbrightness
- the brightness of the colorgetRGB()
,
Color(int)
,
ColorModel.getRGBdefault()
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals)
If the hsbvals
argument is null
, then a
new array is allocated to return the result. Otherwise, the method
returns the array hsbvals
, with the values put into
that array.
r
- the red component of the colorg
- the green component of the colorb
- the blue component of the colorhsbvals
- the array used to return the
three HSB values, or null
getRGB()
,
Color(int)
,
ColorModel.getRGBdefault()
public static Color getHSBColor(float h, float s, float b)
Color
object based on the specified values
for the HSB color model.
The s
and b
components should be
floating-point values between zero and one
(numbers in the range 0.0-1.0). The h
component
can be any floating-point number. The floor of this number is
subtracted from it to create a fraction between 0 and 1. This
fractional number is then multiplied by 360 to produce the hue
angle in the HSB color model.
h
- the hue components
- the saturation of the colorb
- the brightness of the colorColor
object with the specified hue,
saturation, and brightness.public float[] getRGBComponents(float[] compArray)
float
array containing the color and alpha
components of the Color
, as represented in the default
sRGB color space.
If compArray
is null
, an array of length
4 is created for the return value. Otherwise,
compArray
must have length 4 or greater,
and it is filled in with the components and returned.compArray
- an array that this method fills with
color and alpha components and returnsfloat
array.public float[] getRGBColorComponents(float[] compArray)
float
array containing only the color
components of the Color
, in the default sRGB color
space. If compArray
is null
, an array of
length 3 is created for the return value. Otherwise,
compArray
must have length 3 or greater, and it is
filled in with the components and returned.compArray
- an array that this method fills with color
components and returnsfloat
array.public float[] getComponents(float[] compArray)
float
array containing the color and alpha
components of the Color
, in the
ColorSpace
of the Color
.
If compArray
is null
, an array with
length equal to the number of components in the associated
ColorSpace
plus one is created for
the return value. Otherwise, compArray
must have at
least this length and it is filled in with the components and
returned.compArray
- an array that this method fills with the color and
alpha components of this Color
in its
ColorSpace
and returnsfloat
array.public float[] getColorComponents(float[] compArray)
float
array containing only the color
components of the Color
, in the
ColorSpace
of the Color
.
If compArray
is null
, an array with
length equal to the number of components in the associated
ColorSpace
is created for
the return value. Otherwise, compArray
must have at
least this length and it is filled in with the components and
returned.compArray
- an array that this method fills with the color
components of this Color
in its
ColorSpace
and returnsfloat
array.public float[] getComponents(ColorSpace cspace, float[] compArray)
float
array containing the color and alpha
components of the Color
, in the
ColorSpace
specified by the cspace
parameter. If compArray
is null
, an
array with length equal to the number of components in
cspace
plus one is created for the return value.
Otherwise, compArray
must have at least this
length, and it is filled in with the components and returned.cspace
- a specified ColorSpace
compArray
- an array that this method fills with the
color and alpha components of this Color
in
the specified ColorSpace
and returnsfloat
array.public float[] getColorComponents(ColorSpace cspace, float[] compArray)
float
array containing only the color
components of the Color
in the
ColorSpace
specified by the cspace
parameter. If compArray
is null
, an array
with length equal to the number of components in
cspace
is created for the return value. Otherwise,
compArray
must have at least this length, and it is
filled in with the components and returned.cspace
- a specified ColorSpace
compArray
- an array that this method fills with the color
components of this Color
in the specified
ColorSpace
float
array.public ColorSpace getColorSpace()
ColorSpace
of this Color
.Color
object's ColorSpace
.public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
PaintContext
used to
generate a solid color field pattern.
See the specification
of the
method in the Paint
interface for information
on null parameter handling.createContext
in interface Paint
cm
- the preferred ColorModel
which represents the most convenient
format for the caller to receive the pixel data, or null
if there is no preference.r
- the device space bounding box
of the graphics primitive being rendered.r2d
- the user space bounding box
of the graphics primitive being rendered.xform
- the AffineTransform
from user
space into device space.hints
- the set of hints that the context object can use to
choose between rendering alternatives.PaintContext
for
generating color patterns.Paint
,
PaintContext
,
ColorModel
,
Rectangle
,
Rectangle2D
,
AffineTransform
,
RenderingHints
public int getTransparency()
Color
. This is
required to implement the Paint
interface.getTransparency
in interface Transparency
Color
object's transparency mode.Paint
,
Transparency
,
createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)
Dracula Javadoc Sample, Made with Allan Im.


(#) Packaged private key !!! ERROR: Packaged private key This is an error, and is also enforced at build time when supported by the build system. For Android this means it will run during release builds. Id : `PackagedPrivateKey` Summary : Packaged private key Severity : Fatal Category : Security Platform : Android Vendor : Android Open Source Project Feedback : https://issuetracker.google.com/issues/new?component=192708 Editing : This check can *not* run live in the IDE editor See : https://goo.gle/PackagedPrivateKey Implementation : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/PrivateKeyDetector.java) Tests : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/PrivateKeyDetectorTest.kt) Copyright Year : 2012 In general, you should not package private key files inside your app. (##) Example Here is an example of lint warnings produced by this check: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text res/private_key.pem:Error: The res/private_key.pem file seems to be a private key file. Please make sure not to embed this in your APK file. [PackagedPrivateKey] 1 errors, 0 warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the source file referenced above: `res/private_key.pem`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linenumbers -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,77F426A58B274623 FH1NdgJgrX1OGKM0WfzwWUWmLTmfawdaUPeFNJbz1+WJ5DEt1DmC6o0QkXoxIPC Te/+FS80gNruYgYIWu4WXWtCSdvSfGI8LP1JZ7hmMCW055J2mLVKT4o6HqAQnHrb hTATVG6CB/GdHTFPG3J65qIyTlG50jyzfwZtliMCCAWi+AaAlo5xzUe0DgedytB2 sFkLq5EiD6066P/LXPH/Z5WJKiMCFOl0Gjwd3M9ohZufnWJPJT5ap2fm7OSJSfa6 jPREY+UwhPyKkYOc2cWgojj6HrsSQlXPl176b1+31c19hhhRAtDfJBIU2OrOFVk/ V88/Dm0I+ROyLme0rYfFg8uHz2aIymWEMds5ZKEFTFbBhaWbVYKIX7+82tftnd+P 2kT15JAK9V27F0p4SRiWQ5RsDkT3rBWWjtk9Rptkrgec9WKoTaO2fT8bPaWFR/M1 6X7kjMqhLw1sHmsSeDKx0YCWfS+gWh7RPWGQ2EfH2pxoZkWAR5R3cZCEn3Ia1BeV UTFWy+DwjEeSrNkO96E0WH1r8204cJAKK8cWS4HSAPMsQPf5cZjIrrAak/9Wupkq fnrB0Ae6GFO2gWHYQfbSWdEq6w5+S6XZyTauVyaJAjjIFWmegfaKWHzNvqCWJ4T YPsiptUrKz6WWYyhiUrNJQKcyGWHWrwMNIblWqSBNCa8OIVoaZiRibgO1SIafAGAS 9MDXXVaY6rqx1yfZYDcWVgKGXTJhBXALCeGMWF43bvAmPq3M13QJA0rlO7lAUUF2 5INqBUeJxZWYxn6tRr9WMty/UcYnPR3YHgt0RDZycvbcqPsU5tHk9Q== -----END RSA PRIVATE KEY----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also visit the [source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/PrivateKeyDetectorTest.kt) for the unit tests for this check to see additional scenarios. The above example was automatically extracted from the first unit test found for this lint check, `PrivateKeyDetector.testPrivateKey`. To report a problem with this extracted sample, visit https://issuetracker.google.com/issues/new?component=192708. (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="PackagedPrivateKey" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'PackagedPrivateKey' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore PackagedPrivateKey ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).