| PERLDATA(1) | Perl Programmers Reference Guide | PERLDATA(1) |
Values are usually referred to by name, or through a named reference. The first character of the name tells you to what sort of data structure it refers. The rest of the name tells you the particular value to which it refers. Usually this name is a single identifier, that is, a string beginning with a letter or underscore, and containing letters, underscores, and digits. In some cases, it may be a chain of identifiers, separated by "::" (or by the slightly archaic "'"); all but the last are interpreted as names of packages, to locate the namespace in which to look up the final identifier (see "Packages" in perlmod for details). For a more in-depth discussion on identifiers, see "Identifier parsing". It's possible to substitute for a simple identifier, an expression that produces a reference to the value at runtime. This is described in more detail below and in perlref.
Perl also has its own built-in variables whose names don't follow these rules. They have strange names so they don't accidentally collide with one of your normal variables. Strings that match parenthesized parts of a regular expression are saved under names containing only digits after the "$" (see perlop and perlre). In addition, several special variables that provide windows into the inner working of Perl have names containing punctuation characters. These are documented in perlvar.
Scalar values are always named with '$', even when referring to a scalar that is part of an array or a hash. The '$' symbol works semantically like the English word "the" in that it indicates a single value is expected.
$days # the simple scalar value "days" $days[28] # the 29th element of array @days $days{'Feb'} # the 'Feb' value from hash %days $#days # the last index of array @days
Entire arrays (and slices of arrays and hashes) are denoted by '@', which works much as the word "these" or "those" does in English, in that it indicates multiple values are expected.
@days # ($days[0], $days[1],... $days[n]) @days[3,4,5] # same as ($days[3],$days[4],$days[5]) @days{'a','c'} # same as ($days{'a'},$days{'c'})
Entire hashes are denoted by '%':
%days # (key1, val1, key2, val2 ...)
In addition, subroutines are named with an initial '&', though this is optional when unambiguous, just as the word "do" is often redundant in English. Symbol table entries can be named with an initial '*', but you don't really care about that yet (if ever :-).
Every variable type has its own namespace, as do several non-variable identifiers. This means that you can, without fear of conflict, use the same name for a scalar variable, an array, or a hash--or, for that matter, for a filehandle, a directory handle, a subroutine name, a format name, or a label. This means that $foo and @foo are two different variables. It also means that $foo[1] is a part of @foo, not a part of $foo. This may seem a bit weird, but that's okay, because it is weird.
Because variable references always start with '$', '@', or '%', the "reserved" words aren't in fact reserved with respect to variable names. They are reserved with respect to labels and filehandles, however, which don't have an initial special character. You can't have a filehandle named "log", for instance. Hint: you could say "open(LOG,'logfile')" rather than "open(log,'logfile')". Using uppercase filehandles also improves readability and protects you from conflict with future reserved words. Case is significant--"FOO", "Foo", and "foo" are all different names. Names that start with a letter or underscore may also contain digits and underscores.
It is possible to replace such an alphanumeric name with an expression that returns a reference to the appropriate type. For a description of this, see perlref.
Names that start with a digit may contain only more digits. Names that do not start with a letter, underscore, digit or a caret are limited to one character, e.g., $% or $$. (Most of these one character names have a predefined significance to Perl. For instance, $$ is the current process id. And all such names are reserved for Perl's possible use.)
/ (?[ ( \p{Word} & \p{XID_Start} ) + [_] ]) (?[ ( \p{Word} & \p{XID_Continue} ) ]) * /x
That is, a "start" character followed by any number of "continue" characters. Perl requires every character in an identifier to also match "\w" (this prevents some problematic cases); and Perl additionally accepts identfier names beginning with an underscore.
If not under "use utf8", the source is treated as ASCII + 128 extra generic characters, and identifiers should match
/ (?aa) (?!\d) \w+ /x
That is, any word character in the ASCII range, as long as the first character is not a digit.
There are two package separators in Perl: A double colon ("::") and a single quote ("'"). Normal identifiers can start or end with a double colon, and can contain several parts delimited by double colons. Single quotes have similar rules, but with the exception that they are not legal at the end of an identifier: That is, "$'foo" and "$foo'bar" are legal, but "$foo'bar'" is not.
Additionally, if the identifier is preceded by a sigil -- that is, if the identifier is part of a variable name -- it may optionally be enclosed in braces.
While you can mix double colons with singles quotes, the quotes must come after the colons: "$::::'foo" and "$foo::'bar" are legal, but "$::'::foo" and "$foo'::bar" are not.
Put together, a grammar to match a basic identifier becomes
/ (?(DEFINE) (?<variable> (?&sigil) (?: (?&normal_identifier) | \{ \s* (?&normal_identifier) \s* \} ) ) (?<normal_identifier> (?: :: )* '? (?&basic_identifier) (?: (?= (?: :: )+ '? | (?: :: )* ' ) (?&normal_identifier) )? (?: :: )* ) (?<basic_identifier> # is use utf8 on? (?(?{ (caller(0))[8] & $utf8::hint_bits }) (?&Perl_XIDS) (?&Perl_XIDC)* | (?aa) (?!\d) \w+ ) ) (?<sigil> [&*\$\@\%]) (?<Perl_XIDS> (?[ ( \p{Word} & \p{XID_Start} ) + [_] ]) ) (?<Perl_XIDC> (?[ \p{Word} & \p{XID_Continue} ]) ) ) /x
Meanwhile, special identifiers don't follow the above rules; For the most part, all of the identifiers in this category have a special meaning given by Perl. Because they have special parsing rules, these generally can't be fully-qualified. They come in six forms (but don't use forms 5 and 6):
Note that an implication of this form is that there are identifiers only legal under "use utf8", and vice-versa, for example the identifier "$etat" is legal under "use utf8", but is otherwise considered to be the single character variable "$e" followed by the bareword "tat", the combination of which is a syntax error.
The same caveats as the previous form apply: The non-graphic characters are no longer allowed with "use utf8", it is unwise to use this form at all, and utf8ness makes a big difference.
Prior to Perl v5.24, non-graphical ASCII control characters were also allowed in some situations; this had been deprecated since v5.20.
In a reciprocal fashion, an operation provides either a scalar or a list context to each of its arguments. For example, if you say
int( <STDIN> )
the integer operation provides scalar context for the <> operator, which responds by reading one line from STDIN and passing it back to the integer operation, which will then find the integer value of that line and return that. If, on the other hand, you say
sort( <STDIN> )
then the sort operation provides list context for <>, which will proceed to read every line available up to the end of file, and pass that list of lines back to the sort routine, which will then sort those lines and return them as a list to whatever the context of the sort was.
Assignment is a little bit special in that it uses its left argument to determine the context for the right argument. Assignment to a scalar evaluates the right-hand side in scalar context, while assignment to an array or hash evaluates the righthand side in list context. Assignment to a list (or slice, which is just a list anyway) also evaluates the right-hand side in list context.
When you use the "use warnings" pragma or Perl's -w command-line option, you may see warnings about useless uses of constants or functions in "void context". Void context just means the value has been discarded, such as a statement containing only ""fred";" or "getpwuid(0);". It still counts as scalar context for functions that care whether or not they're being called in list context.
User-defined subroutines may choose to care whether they are being called in a void, scalar, or list context. Most subroutines do not need to bother, though. That's because both scalars and lists are automatically interpolated into lists. See "wantarray" in perlfunc for how you would dynamically discern your function's calling context.
Scalars aren't necessarily one thing or another. There's no place to declare a scalar variable to be of type "string", type "number", type "reference", or anything else. Because of the automatic conversion of scalars, operations that return scalars don't need to care (and in fact, cannot care) whether their caller is looking for a string, a number, or a reference. Perl is a contextually polymorphic language whose scalars can be strings, numbers, or references (which includes objects). Although strings and numbers are considered pretty much the same thing for nearly all purposes, references are strongly-typed, uncastable pointers with builtin reference-counting and destructor invocation.
A scalar value is interpreted as FALSE in the Boolean sense if it is undefined, the null string or the number 0 (or its string equivalent, "0"), and TRUE if it is anything else. The Boolean context is just a special kind of scalar context where no conversion to a string or a number is ever performed. Negation of a true value by "!" or "not" returns a special false value. When evaluated as a string it is treated as "", but as a number, it is treated as 0. Most Perl operators that return true or false behave this way.
There are actually two varieties of null strings (sometimes referred to as "empty" strings), a defined one and an undefined one. The defined version is just a string of length zero, such as "". The undefined version is the value that indicates that there is no real value for something, such as when there was an error, or at end of file, or when you refer to an uninitialized variable or element of an array or hash. Although in early versions of Perl, an undefined scalar could become defined when first used in a place expecting a defined value, this no longer happens except for rare cases of autovivification as explained in perlref. You can use the defined() operator to determine whether a scalar value is defined (this has no meaning on arrays or hashes), and the undef() operator to produce an undefined value.
To find out whether a given string is a valid non-zero number, it's sometimes enough to test it against both numeric 0 and also lexical "0" (although this will cause noises if warnings are on). That's because strings that aren't numbers count as 0, just as they do in awk:
if ($str == 0 && $str ne "0") { warn "That doesn't look like a number"; }
That method may be best because otherwise you won't treat IEEE notations like "NaN" or "Infinity" properly. At other times, you might prefer to determine whether string data can be used numerically by calling the POSIX::strtod() function or by inspecting your string with a regular expression (as documented in perlre).
warn "has nondigits" if /\D/; warn "not a natural number" unless /^\d+$/; # rejects -3 warn "not an integer" unless /^-?\d+$/; # rejects +3 warn "not an integer" unless /^[+-]?\d+$/; warn "not a decimal number" unless /^-?\d+\.?\d*$/; # rejects .2 warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/; warn "not a C float" unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
The length of an array is a scalar value. You may find the length of array @days by evaluating $#days, as in csh. However, this isn't the length of the array; it's the subscript of the last element, which is a different value since there is ordinarily a 0th element. Assigning to $#days actually changes the length of the array. Shortening an array this way destroys intervening values. Lengthening an array that was previously shortened does not recover values that were in those elements.
You can also gain some minuscule measure of efficiency by pre-extending an array that is going to get big. You can also extend an array by assigning to an element that is off the end of the array. You can truncate an array down to nothing by assigning the null list () to it. The following are equivalent:
@whatever = (); $#whatever = -1;
If you evaluate an array in scalar context, it returns the length of the array. (Note that this is not true of lists, which return the last value, like the C comma operator, nor of built-in functions, which return whatever they feel like returning.) The following is always true:
scalar(@whatever) == $#whatever + 1;
Some programmers choose to use an explicit conversion so as to leave nothing to doubt:
$element_count = scalar(@whatever);
If you evaluate a hash in scalar context, it returns a false value if the hash is empty. If there are any key/value pairs, it returns a true value. A more precise definition is version dependent.
Prior to Perl 5.25 the value returned was a string consisting of the number of used buckets and the number of allocated buckets, separated by a slash. This is pretty much useful only to find out whether Perl's internal hashing algorithm is performing poorly on your data set. For example, you stick 10,000 things in a hash, but evaluating %HASH in scalar context reveals "1/16", which means only one out of sixteen buckets has been touched, and presumably contains all 10,000 of your items. This isn't supposed to happen.
As of Perl 5.25 the return was changed to be the count of keys in the hash. If you need access to the old behavior you can use "Hash::Util::bucket_ratio()" instead.
If a tied hash is evaluated in scalar context, the "SCALAR" method is called (with a fallback to "FIRSTKEY").
You can preallocate space for a hash by assigning to the keys() function. This rounds up the allocated buckets to the next power of two:
keys(%users) = 1000; # allocate 1024 buckets
12345 12345.67 .23E-10 # a very small number 3.14_15_92 # a very important number 4_294_967_296 # underscore for legibility 0xff # hex 0xdead_beef # more hex 0377 # octal (only numbers, begins with 0) 0b011011 # binary 0x1.999ap-4 # hexadecimal floating point (the 'p' is required)
You are allowed to use underscores (underbars) in numeric literals between digits for legibility (but not multiple underscores in a row: "23__500" is not legal; "23_500" is). You could, for example, group binary digits by threes (as for a Unix-style mode argument such as 0b110_100_100) or by fours (to represent nibbles, as in 0b1010_0110) or in other groups.
String literals are usually delimited by either single or double quotes. They work much like quotes in the standard Unix shells: double-quoted string literals are subject to backslash and variable substitution; single-quoted strings are not (except for "\'" and "\\"). The usual C-style backslash rules apply for making characters such as newline, tab, etc., as well as some more exotic forms. See "Quote and Quote-like Operators" in perlop for a list.
Hexadecimal, octal, or binary, representations in string literals (e.g. '0xff') are not automatically converted to their integer representation. The hex() and oct() functions make these conversions for you. See "hex" in perlfunc and "oct" in perlfunc for more details.
Hexadecimal floating point can start just like a hexadecimal literal, and it can be followed by an optional fractional hexadecimal part, but it must be followed by "p", an optional sign, and a power of two. The format is useful for accurately presenting floating point values, avoiding conversions to or from decimal floating point, and therefore avoiding possible loss in precision. Notice that while most current platforms use the 64-bit IEEE 754 floating point, not all do. Another potential source of (low-order) differences are the floating point rounding modes, which can differ between CPUs, operating systems, and compilers, and which Perl doesn't control.
You can also embed newlines directly in your strings, i.e., they can end on a different line than they begin. This is nice, but if you forget your trailing quote, the error will not be reported until Perl finds another line containing the quote character, which may be much further on in the script. Variable substitution inside strings is limited to scalar variables, arrays, and array or hash slices. (In other words, names beginning with $ or @, followed by an optional bracketed expression as a subscript.) The following code segment prints out "The price is $100."
$Price = '$100'; # not interpolated print "The price is $Price.\n"; # interpolated
There is no double interpolation in Perl, so the $100 is left as is.
By default floating point numbers substituted inside strings use the dot (".") as the decimal separator. If "use locale" is in effect, and POSIX::setlocale() has been called, the character used for the decimal separator is affected by the LC_NUMERIC locale. See perllocale and POSIX.
As in some shells, you can enclose the variable name in braces to disambiguate it from following alphanumerics (and underscores). You must also do this when interpolating a variable into a string to separate the variable name from a following double-colon or an apostrophe, since these would be otherwise treated as a package separator:
$who = "Larry"; print PASSWD "${who}::0:0:Superuser:/:/bin/perl\n"; print "We use ${who}speak when ${who}'s here.\n";
Without the braces, Perl would have looked for a $whospeak, a $who::0, and a "$who's" variable. The last two would be the $0 and the $s variables in the (presumably) non-existent package "who".
In fact, a simple identifier within such curlies is forced to be a string, and likewise within a hash subscript. Neither need quoting. Our earlier example, $days{'Feb'} can be written as $days{Feb} and the quotes will be assumed automatically. But anything more complicated in the subscript will be interpreted as an expression. This means for example that "$version{2.0}++" is equivalent to "$version{2}++", not to "$version{'2.0'}++".
Special floating point: infinity (Inf) and not-a-number (NaN)
Floating point values include the special values "Inf" and "NaN", for infinity and not-a-number. The infinity can be also negative.
The infinity is the result of certain math operations that overflow the floating point range, like 9**9**9. The not-a-number is the result when the result is undefined or unrepresentable. Though note that you cannot get "NaN" from some common "undefined" or "out-of-range" operations like dividing by zero, or square root of a negative number, since Perl generates fatal errors for those.
The infinity and not-a-number have their own special arithmetic rules. The general rule is that they are "contagious": "Inf" plus one is "Inf", and "NaN" plus one is "NaN". Where things get interesting is when you combine infinities and not-a-numbers: "Inf" minus "Inf" and "Inf" divided by "Inf" are "NaN" (while "Inf" plus "Inf" is "Inf" and "Inf" times "Inf" is "Inf"). "NaN" is also curious in that it does not equal any number, including itself: "NaN" != "NaN".
Perl doesn't understand "Inf" and "NaN" as numeric literals, but you can have them as strings, and Perl will convert them as needed: "Inf" + 1. (You can, however, import them from the POSIX extension; "use POSIX qw(Inf NaN);" and then use them as literals.)
Note that on input (string to number) Perl accepts "Inf" and "NaN" in many forms. Case is ignored, and the Win32-specific forms like "1.#INF" are understood, but on output the values are normalized to "Inf" and "NaN".
Version Strings
A literal of the form "v1.20.300.4000" is parsed as a string composed of characters with the specified ordinals. This form, known as v-strings, provides an alternative, more readable way to construct strings, rather than use the somewhat less readable interpolation form "\x{1}\x{14}\x{12c}\x{fa0}". This is useful for representing Unicode strings, and for comparing version "numbers" using the string comparison operators, "cmp", "gt", "lt" etc. If there are two or more dots in the literal, the leading "v" may be omitted.
print v9786; # prints SMILEY, "\x{263a}" print v102.111.111; # prints "foo" print 102.111.111; # same
Such literals are accepted by both "require" and "use" for doing a version check. Note that using the v-strings for IPv4 addresses is not portable unless you also use the inet_aton()/inet_ntoa() routines of the Socket package.
Note that since Perl 5.8.1 the single-number v-strings (like "v65") are not v-strings before the "=>" operator (which is usually used to separate a hash key from a hash value); instead they are interpreted as literal strings ('v65'). They were v-strings from Perl 5.6.0 to Perl 5.8.0, but that caused more confusion and breakage than good. Multi-number v-strings like "v65.66" and 65.66.67 continue to be v-strings always.
Special Literals
The special literals __FILE__, __LINE__, and __PACKAGE__ represent the current filename, line number, and package name at that point in your program. __SUB__ gives a reference to the current subroutine. They may be used only as separate tokens; they will not be interpolated into strings. If there is no current package (due to an empty "package;" directive), __PACKAGE__ is the undefined value. (But the empty "package;" is no longer supported, as of version 5.10.) Outside of a subroutine, __SUB__ is the undefined value. __SUB__ is only available in 5.16 or higher, and only with a "use v5.16" or "use feature "current_sub"" declaration.
The two control characters ^D and ^Z, and the tokens __END__ and __DATA__ may be used to indicate the logical end of the script before the actual end of file. Any following text is ignored.
Text after __DATA__ may be read via the filehandle "PACKNAME::DATA", where "PACKNAME" is the package that was current when the __DATA__ token was encountered. The filehandle is left open pointing to the line after __DATA__. The program should "close DATA" when it is done reading from it. (Leaving it open leaks filehandles if the module is reloaded for any reason, so it's a safer practice to close it.) For compatibility with older scripts written before __DATA__ was introduced, __END__ behaves like __DATA__ in the top level script (but not in files loaded with "require" or "do") and leaves the remaining contents of the file accessible via "main::DATA".
The "DATA" file handle by default has whatever PerlIO layers were in place when Perl read the file to parse the source. Normally that means that the file is being read bytewise, as if it were encoded in Latin-1, but there are two major ways for it to be otherwise. Firstly, if the "__END__"/"__DATA__" token is in the scope of a "use utf8" pragma then the "DATA" handle will be in UTF-8 mode. And secondly, if the source is being read from perl's standard input then the "DATA" file handle is actually aliased to the "STDIN" file handle, and may be in UTF-8 mode because of the "PERL_UNICODE" environment variable or perl's command-line switches.
See SelfLoader for more description of __DATA__, and an example of its use. Note that you cannot read from the DATA filehandle in a BEGIN block: the BEGIN block is executed as soon as it is seen (during compilation), at which point the corresponding __DATA__ (or __END__) token has not yet been seen.
Barewords
A word that has no other interpretation in the grammar will be treated as if it were a quoted string. These are known as "barewords". As with filehandles and labels, a bareword that consists entirely of lowercase letters risks conflict with future reserved words, and if you use the "use warnings" pragma or the -w switch, Perl will warn you about any such words. Perl limits barewords (like identifiers) to about 250 characters. Future versions of Perl are likely to eliminate these arbitrary limitations.
Some people may wish to outlaw barewords entirely. If you say
use strict 'subs';
then any bareword that would NOT be interpreted as a subroutine call produces a compile-time error instead. The restriction lasts to the end of the enclosing block. An inner block may countermand this by saying "no strict 'subs'".
Array Interpolation
Arrays and slices are interpolated into double-quoted strings by joining the elements with the delimiter specified in the $" variable ($LIST_SEPARATOR if "use English;" is specified), space by default. The following are equivalent:
$temp = join($", @ARGV); system "echo $temp"; system "echo @ARGV";
Within search patterns (which also undergo double-quotish substitution) there is an unfortunate ambiguity: Is "/$foo[bar]/" to be interpreted as "/${foo}[bar]/" (where "[bar]" is a character class for the regular expression) or as "/${foo[bar]}/" (where "[bar]" is the subscript to array @foo)? If @foo doesn't otherwise exist, then it's obviously a character class. If @foo exists, Perl takes a good guess about "[bar]", and is almost always right. If it does guess wrong, or if you're just plain paranoid, you can force the correct interpretation with curly braces as above.
If you're looking for the information on how to use here-documents, which used to be here, that's been moved to "Quote and Quote-like Operators" in perlop.
(LIST)
In a context not requiring a list value, the value of what appears to be a list literal is simply the value of the final element, as with the C comma operator. For example,
@foo = ('cc', '-E', $bar);
assigns the entire list value to array @foo, but
$foo = ('cc', '-E', $bar);
assigns the value of variable $bar to the scalar variable $foo. Note that the value of an actual array in scalar context is the length of the array; the following assigns the value 3 to $foo:
@foo = ('cc', '-E', $bar); $foo = @foo; # $foo gets 3
You may have an optional comma before the closing parenthesis of a list literal, so that you can say:
@foo = ( 1, 2, 3, );
To use a here-document to assign an array, one line per element, you might use an approach like this:
@sauces = <<End_Lines =~ m/(\S.*\S)/g; normal tomato spicy tomato green chile pesto white wine End_Lines
LISTs do automatic interpolation of sublists. That is, when a LIST is evaluated, each element of the list is evaluated in list context, and the resulting list value is interpolated into LIST just as if each individual element were a member of LIST. Thus arrays and hashes lose their identity in a LIST--the list
(@foo,@bar,&SomeSub,%glarch)
contains all the elements of @foo followed by all the elements of @bar, followed by all the elements returned by the subroutine named SomeSub called in list context, followed by the key/value pairs of %glarch. To make a list reference that does NOT interpolate, see perlref.
The null list is represented by (). Interpolating it in a list has no effect. Thus ((),(),()) is equivalent to (). Similarly, interpolating an array with no elements is the same as if no array had been interpolated at that point.
This interpolation combines with the facts that the opening and closing parentheses are optional (except when necessary for precedence) and lists may end with an optional comma to mean that multiple commas within lists are legal syntax. The list "1,,3" is a concatenation of two lists, "1," and 3, the first of which ends with that optional comma. "1,,3" is "(1,),(3)" is "1,3" (And similarly for "1,,,3" is "(1,),(,),3" is "1,3" and so on.) Not that we'd advise you to use this obfuscation.
A list value may also be subscripted like a normal array. You must put the list in parentheses to avoid ambiguity. For example:
# Stat returns list value. $time = (stat($file))[8]; # SYNTAX ERROR HERE. $time = stat($file)[8]; # OOPS, FORGOT PARENTHESES # Find a hex digit. $hexdigit = ('a','b','c','d','e','f')[$digit-10]; # A "reverse comma operator". return (pop(@foo),pop(@foo))[0];
Lists may be assigned to only when each element of the list is itself legal to assign to:
($x, $y, $z) = (1, 2, 3); ($map{'red'}, $map{'blue'}, $map{'green'}) = (0x00f, 0x0f0, 0xf00);
An exception to this is that you may assign to "undef" in a list. This is useful for throwing away some of the return values of a function:
($dev, $ino, undef, undef, $uid, $gid) = stat($file);
As of Perl 5.22, you can also use "(undef)x2" instead of "undef, undef". (You can also do "($x) x 2", which is less useful, because it assigns to the same variable twice, clobbering the first value assigned.)
When you assign a list of scalars to an array, all previous values in that array are wiped out and the number of elements in the array will now be equal to the number of elements in the right-hand list -- the list from which assignment was made. The array will automatically resize itself to precisely accommodate each element in the right-hand list.
use warnings; my (@xyz, $x, $y, $z); @xyz = (1, 2, 3); print "@xyz\n"; # 1 2 3 @xyz = ('al', 'be', 'ga', 'de'); print "@xyz\n"; # al be ga de @xyz = (101, 102); print "@xyz\n"; # 101 102
When, however, you assign a list of scalars to another list of scalars, the results differ according to whether the left-hand list -- the list being assigned to -- has the same, more or fewer elements than the right-hand list.
($x, $y, $z) = (1, 2, 3); print "$x $y $z\n"; # 1 2 3 ($x, $y, $z) = ('al', 'be', 'ga', 'de'); print "$x $y $z\n"; # al be ga ($x, $y, $z) = (101, 102); print "$x $y $z\n"; # 101 102 # Use of uninitialized value $z in concatenation (.) # or string at [program] line [line number].
If the number of scalars in the left-hand list is less than that in the right-hand list, the "extra" scalars in the right-hand list will simply not be assigned.
If the number of scalars in the left-hand list is greater than that in the left-hand list, the "missing" scalars will become undefined.
($x, $y, $z) = (101, 102); for my $el ($x, $y, $z) { (defined $el) ? print "$el " : print "<undef>"; } print "\n"; # 101 102 <undef>
List assignment in scalar context returns the number of elements produced by the expression on the right side of the assignment:
$x = (($foo,$bar) = (3,2,1)); # set $x to 3, not 2 $x = (($foo,$bar) = f()); # set $x to f()'s return count
This is handy when you want to do a list assignment in a Boolean context, because most list functions return a null list when finished, which when assigned produces a 0, which is interpreted as FALSE.
It's also the source of a useful idiom for executing a function or performing an operation in list context and then counting the number of return values, by assigning to an empty list and then using that assignment in scalar context. For example, this code:
$count = () = $string =~ /\d+/g;
will place into $count the number of digit groups found in $string. This happens because the pattern match is in list context (since it is being assigned to the empty list), and will therefore return a list of all matching parts of the string. The list assignment in scalar context will translate that into the number of elements (here, the number of times the pattern matched) and assign that to $count. Note that simply using
$count = $string =~ /\d+/g;
would not have worked, since a pattern match in scalar context will only return true or false, rather than a count of matches.
The final element of a list assignment may be an array or a hash:
($x, $y, @rest) = split; my($x, $y, %rest) = @_;
You can actually put an array or hash anywhere in the list, but the first one in the list will soak up all the values, and anything after it will become undefined. This may be useful in a my() or local().
A hash can be initialized using a literal list holding pairs of items to be interpreted as a key and a value:
# same as map assignment above %map = ('red',0x00f,'blue',0x0f0,'green',0xf00);
While literal lists and named arrays are often interchangeable, that's not the case for hashes. Just because you can subscript a list value like a normal array does not mean that you can subscript a list value as a hash. Likewise, hashes included as parts of other lists (including parameters lists and return lists from functions) always flatten out into key/value pairs. That's why it's good to use references sometimes.
It is often more readable to use the "=>" operator between key/value pairs. The "=>" operator is mostly just a more visually distinctive synonym for a comma, but it also arranges for its left-hand operand to be interpreted as a string if it's a bareword that would be a legal simple identifier. "=>" doesn't quote compound identifiers, that contain double colons. This makes it nice for initializing hashes:
%map = ( red => 0x00f, blue => 0x0f0, green => 0xf00, );
or for initializing hash references to be used as records:
$rec = { witch => 'Mable the Merciless', cat => 'Fluffy the Ferocious', date => '10/31/1776', };
or for using call-by-named-parameter to complicated functions:
$field = $query->radio_group( name => 'group_name', values => ['eenie','meenie','minie'], default => 'meenie', linebreak => 'true', labels => \%labels );
Note that just because a hash is initialized in that order doesn't mean that it comes out in that order. See "sort" in perlfunc for examples of how to arrange for an output ordering.
If a key appears more than once in the initializer list of a hash, the last occurrence wins:
%circle = ( center => [5, 10], center => [27, 9], radius => 100, color => [0xDF, 0xFF, 0x00], radius => 54, ); # same as %circle = ( center => [27, 9], color => [0xDF, 0xFF, 0x00], radius => 54, );
This can be used to provide overridable configuration defaults:
# values in %args take priority over %config_defaults %config = (%config_defaults, %args);
@myarray = (5, 50, 500, 5000); print "The Third Element is", $myarray[2], "\n";
The array indices start with 0. A negative subscript retrieves its value from the end. In our example, $myarray[-1] would have been 5000, and $myarray[-2] would have been 500.
Hash subscripts are similar, only instead of square brackets curly brackets are used. For example:
%scientists = ( "Newton" => "Isaac", "Einstein" => "Albert", "Darwin" => "Charles", "Feynman" => "Richard", ); print "Darwin's First Name is ", $scientists{"Darwin"}, "\n";
You can also subscript a list to get a single element from it:
$dir = (getpwnam("daemon"))[7];
$foo{$x,$y,$z}
is equivalent to
$foo{join($;, $x, $y, $z)}
The default subscript separator is "\034", the same as SUBSEP in awk.
($him, $her) = @folks[0,-1]; # array slice @them = @folks[0 .. 3]; # array slice ($who, $home) = @ENV{"USER", "HOME"}; # hash slice ($uid, $dir) = (getpwnam("daemon"))[2,7]; # list slice
Since you can assign to a list of variables, you can also assign to an array or hash slice.
@days[3..5] = qw/Wed Thu Fri/; @colors{'red','blue','green'} = (0xff0000, 0x0000ff, 0x00ff00); @folks[0, -1] = @folks[-1, 0];
The previous assignments are exactly equivalent to
($days[3], $days[4], $days[5]) = qw/Wed Thu Fri/; ($colors{'red'}, $colors{'blue'}, $colors{'green'}) = (0xff0000, 0x0000ff, 0x00ff00); ($folks[0], $folks[-1]) = ($folks[-1], $folks[0]);
Since changing a slice changes the original array or hash that it's slicing, a "foreach" construct will alter some--or even all--of the values of the array or hash.
foreach (@array[ 4 .. 10 ]) { s/peter/paul/ } foreach (@hash{qw[key1 key2]}) { s/^\s+//; # trim leading whitespace s/\s+$//; # trim trailing whitespace s/(\w+)/\u\L$1/g; # "titlecase" words }
As a special exception, when you slice a list (but not an array or a hash), if the list evaluates to empty, then taking a slice of that empty list will always yield the empty list in turn. Thus:
@a = ()[0,1]; # @a has no elements @b = (@a)[0,1]; # @b has no elements @c = (sub{}->())[0,1]; # @c has no elements @d = ('a','b')[0,1]; # @d has two elements @e = (@d)[0,1,8,9]; # @e has four elements @f = (@d)[8,9]; # @f has two elements
This makes it easy to write loops that terminate when a null list is returned:
while ( ($home, $user) = (getpwent)[7,0] ) { printf "%-8s %s\n", $user, $home; }
As noted earlier in this document, the scalar sense of list assignment is the number of elements on the right-hand side of the assignment. The null list contains no elements, so when the password file is exhausted, the result is 0, not 2.
Slices in scalar context return the last item of the slice.
@a = qw/first second third/; %h = (first => 'A', second => 'B'); $t = @a[0, 1]; # $t is now 'second' $u = @h{'first', 'second'}; # $u is now 'B'
If you're confused about why you use an '@' there on a hash slice instead of a '%', think of it like this. The type of bracket (square or curly) governs whether it's an array or a hash being looked at. On the other hand, the leading symbol ('$' or '@') on the array or hash indicates whether you are getting back a singular value (a scalar) or a plural one (a list).
Key/Value Hash Slices
Starting in Perl 5.20, a hash slice operation with the % symbol is a variant of slice operation returning a list of key/value pairs rather than just values:
%h = (blonk => 2, foo => 3, squink => 5, bar => 8); %subset = %h{'foo', 'bar'}; # key/value hash slice # %subset is now (foo => 3, bar => 8) %removed = delete %h{'foo', 'bar'}; # %removed is now (foo => 3, bar => 8) # %h is now (blonk => 2, squink => 5)
However, the result of such a slice cannot be localized or used in assignment. These are otherwise very much consistent with hash slices using the @ symbol.
Index/Value Array Slices
Similar to key/value hash slices (and also introduced in Perl 5.20), the % array slice syntax returns a list of index/value pairs:
@a = "a".."z"; @list = %a[3,4,6]; # @list is now (3, "d", 4, "e", 6, "g") @removed = delete %a[3,4,6] # @removed is now (3, "d", 4, "e", 6, "g") # @list[3,4,6] are now undef
Note that calling "delete" on array values is strongly discouraged.
The main use of typeglobs in modern Perl is create symbol table aliases. This assignment:
*this = *that;
makes $this an alias for $that, @this an alias for @that, %this an alias for %that, &this an alias for &that, etc. Much safer is to use a reference. This:
local *Here::blue = \$There::green;
temporarily makes $Here::blue an alias for $There::green, but doesn't make @Here::blue an alias for @There::green, or %Here::blue an alias for %There::green, etc. See "Symbol Tables" in perlmod for more examples of this. Strange though this may seem, this is the basis for the whole module import/export system.
Another use for typeglobs is to pass filehandles into a function or to create new filehandles. If you need to use a typeglob to save away a filehandle, do it this way:
$fh = *STDOUT;
or perhaps as a real reference, like this:
$fh = \*STDOUT;
See perlsub for examples of using these as indirect filehandles in functions.
Typeglobs are also a way to create a local filehandle using the local() operator. These last until their block is exited, but may be passed back. For example:
sub newopen { my $path = shift; local *FH; # not my! open (FH, $path) or return undef; return *FH; } $fh = newopen('/etc/passwd');
Now that we have the *foo{THING} notation, typeglobs aren't used as much for filehandle manipulations, although they're still needed to pass brand new file and directory handles into or out of functions. That's because *HANDLE{IO} only works if HANDLE has already been used as a handle. In other words, *FH must be used to create new symbol table entries; *foo{THING} cannot. When in doubt, use *FH.
All functions that are capable of creating filehandles (open(), opendir(), pipe(), socketpair(), sysopen(), socket(), and accept()) automatically create an anonymous filehandle if the handle passed to them is an uninitialized scalar variable. This allows the constructs such as "open(my $fh, ...)" and "open(local $fh,...)" to be used to create filehandles that will conveniently be closed automatically when the scope ends, provided there are no other references to them. This largely eliminates the need for typeglobs when opening filehandles that must be passed around, as in the following example:
sub myopen { open my $fh, "@_" or die "Can't open '@_': $!"; return $fh; } { my $f = myopen("</etc/motd"); print <$f>; # $f implicitly closed here }
Note that if an initialized scalar variable is used instead the result is different: "my $fh='zzz'; open($fh, ...)" is equivalent to "open( *{'zzz'}, ...)". "use strict 'refs'" forbids such practice.
Another way to create anonymous filehandles is with the Symbol module or with the IO::Handle module and its ilk. These modules have the advantage of not hiding different types of the same name during the local(). See the bottom of "open" in perlfunc for an example.
| 2019-10-21 | perl v5.30.3 |


Username
Password
Forget password?
LOG IN
Welcome to
Ouroboros
Login to access your account
Version 0.21.8


Contact
Include my personal information
For security reasons this does not send your tax ID
.
Contact Manufacturer
Congratulations!
You sent message!
Done


My name is Mayu and I am originally from Los Angeles, California. I moved to Miami five years ago to study Criminology at the University of Miami. I currently live in Brickell with my best friend, Martha, and our two pets. We have a pomeranian named Logan and a cat named Lucy. I am currently working as a Genius at Apple in the technical support department where I offer customers technical support for their devices. I am also certified to fix iPhones and Macs. I am learning how to code in order to further my career with the company and eventually land a corporate position as a software developer. I am excited to take this class and learn a new language.
An app that easily lets you find jobs in the language of your choice after taking coding classes


| Sr | Fieldname | Type | Label | Options |
|---|---|---|---|---|
| 1 | use_jasper_server |
Select |
Use JasperServer / Local jrxml
Choose where the reports are stored. Choose JasperServer only if you only want reports from Jasper Server. Choose Local jrxml only if you only want reports from python local module and don't want reports from Jasper Server. |
JasperServer only Local jrxml only Both None |
| 2 | jasper_server_url |
Data |
JasperServer URL
Enter the url where is located the Jasper Server, port included. |
|
| 3 | jasper_report_root_path |
Data |
Jasper Report Root Path
Enter the root path to where are the reports located in Jasper Server. |
|
| 4 | jasper_username |
Data |
Jasper User Name
Enter the username of the user with permissions to run reports on the Jasper Server. |
|
| 5 | jasper_server_password |
Data |
Password
Enter the Jasper Server Password. |
|
| 6 | jasper_connect_update_btn |
Button |
Connect/Update
Connect to Jasper Server and/or update data. |
|
| 7 | jasper_ignore_perm_roles |
Check |
Ignore Jasper Permission Roles
Check if you want to set permission at document level. Uncheck if you don't want to set permission at doctype level. |
|
| 8 | report_options |
Column Break | Report Options | |
| 9 | import_all_reports |
Check |
Import All Reports
Import all reports from root path given above. |
|
| 10 | import_only_new |
Check |
Import Only New Reports
Import only the new reports in server repository. |
|
| 11 | report_default_number_copies |
Select |
Report Default Number of Copies
The default number of copies when print a report. This can be changed by report. |
Original Duplicated Triplicate |
| 12 | jasper_print_all |
Check | All | |
| 13 | jasper_print_pdf |
Check | ||
| 14 | jasper_print_docx |
Check | DOCX | |
| 15 | jasper_print_xls |
Check | XLS | |
| 16 | jasper_print_ods |
Check | ODS | |
| 17 | jasper_print_odt |
Check | ODT | |
| 18 | jasper_print_rtf |
Check |
RTF
General print type. Choose the default print type for all documents. |
|
| 19 | jasper_virtualizer_pages |
Int |
Virtualizer Maximum Pages In RAM
The maximum number of report pages that will be stored in primary memory (RAM) before the sections of the report are store in virtual memory (DISK). |
|
| 20 | report_message: |
Section Break | Report Message: | |
| 21 | jasper_param_message |
Small Text |
Message
Put here the message that will be used in the dialog that appears when the report has parameters of action 'Ask'. |
|
| 22 | jasper_session_timeout |
Section Break | Jasper Session Timeout Value | |
| 23 | jasper_server_timeout_html |
HTML | ||
| 24 | server |
Section Break | Server | |
| 25 | jasper_polling_time |
Int |
Jasper Polling Time:
Polling time in milliseconds. |
|
| 26 | jasper_server_name |
Small Text | Name | |
| 27 | server_info_html |
HTML |
Inherits from frappe.model.document.Document


#include <interface_object_configure.h>
|
|
| static void | CalculateBoundingBox (const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint) |
| |
| static void | CalculateBoundingBox (const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint, const double &Radius) |
| |
| static void | CalculateCenter (const PointerType &rObject, PointType &rCentralPoint) |
| |
| static bool | Intersection (const PointerType &rObj_1, const PointerType &rObj_2) |
| |
| static bool | Intersection (const PointerType &rObj_1, const PointerType &rObj_2, double Radius) |
| |
| static bool | IntersectionBox (const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint) |
| |
| static bool | IntersectionBox (const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint, const double &Radius) |
| |
| static void | Distance (const PointerType &rObj_1, const PointerType &rObj_2, double &distance) |
| |
| static double | GetObjectRadius (const PointerType &rObject, const double &Radius) |
| |
Configuration file for InterfaceObject. This class provides a configuration file to calculate a 'Bins' using InterfaceObject. It is an adapted copy of "kratos/spatial_containers/configures/point_configure.h"
◆ ContainerType
◆ CoordinateArray
◆ CoordinateType
◆ DistanceIteratorType
◆ IteratorType
◆ ObjectContainerType
◆ ObjectType
Additional types needed by the bins.
- Parameters
-
| PointContainerType | Point Container. |
| ContainerType | Base container Type. |
| ResultContainerType | Result Container. For this configure should be the same as ContainerType. |
| ContactPairType | Contact pair for points. |
| IteratorType | Iterator of points. |
| ResultIteratorType | Iterator of results. For this configure should be the same as PointIteratorType. |
| DistanceIteratorType | Iterato of distances (doubles) |
◆ PointerType
◆ PointType
Point and Pointer Types
- Parameters
-
| PointType | Point of doubles with 3 coordinates (Dimension = 3) |
| PointerType | Pointer to Point of doubles with 3 coordinates (Dimension = 3) |
◆ ResultContainerType
◆ ResultIteratorType
◆ InterfaceObjectConfigure()
| Kratos::InterfaceObjectConfigure::InterfaceObjectConfigure |
( |
| ) |
|
|
inline |
◆ ~InterfaceObjectConfigure()
| virtual Kratos::InterfaceObjectConfigure::~InterfaceObjectConfigure |
( |
| ) |
|
|
inlinevirtual |
◆ CalculateBoundingBox() [1/2]
| static void Kratos::InterfaceObjectConfigure::CalculateBoundingBox |
( |
const PointerType & |
rObject, |
|
|
PointType & |
rLowPoint, |
|
|
PointType & |
rHighPoint |
|
) |
| |
|
inlinestatic |
Calculates the bounding box for the given object. For this configuation file, the bounding box is the equal to the point given in 'rObject'.
- Parameters
-
| rObject | Point for which the bounding box will be calculated. |
| rLowPoint | Lower point of the boundingbox. |
| rHighPoint | Higher point of the boundingbox. |
◆ CalculateBoundingBox() [2/2]
Calculates the bounding box for the given object extended with a Radius. For this configuation file, the bounding box is the equal to the point given in 'rObject' + - a radius.
- Parameters
-
| rObject | Point for which the bounding box will be calculated. |
| rLowPoint | Lower point of the boundingbox. |
| rHighPoint | Higher point of the boundingbox. |
| Radius | The extension radius to be applied to the boundingbox. |
◆ CalculateCenter()
| static void Kratos::InterfaceObjectConfigure::CalculateCenter |
( |
const PointerType & |
rObject, |
|
|
PointType & |
rCentralPoint |
|
) |
| |
|
inlinestatic |
Calculates the Center of the object.
- Parameters
-
| rObject | Point for which the bounding box will be calculated. |
| rCentralPoint | The center point of the object. |
◆ Data()
| virtual std::string Kratos::InterfaceObjectConfigure::Data |
( |
| ) |
const |
|
inlinevirtual |
Turns back data as a string.
◆ Distance()
Calculates the distance betwen two objects. For this configuation file, calculates the euclidean distance between 'rObj_1' and 'rObj_2'.
Performance
In C++11 'std::pow(T, int)' provides the optimal solution in terms of speed.
References
(http://en.cppreference.com/w/cpp/numeric/math/pow) (http://stackoverflow.com/questions/2940367)
- Parameters
-
| rObj_1 | First point. |
| rLowPoint | Lower point. |
| rHighPoint | Higher point of the boundingbox. |
| distance | The euclidean distance between 'rObj_1' and 'rObj_2'. |
◆ GetObjectRadius()
| static double Kratos::InterfaceObjectConfigure::GetObjectRadius |
( |
const PointerType & |
rObject, |
|
|
const double & |
Radius |
|
) |
| |
|
inlinestatic |
Returns a radius associated to the object Returns a radius associated to the object
- Parameters
-
| rObject | the object |
| Radius | an extension factor. |
- Returns
- 0.0f always.
◆ Info()
| virtual std::string Kratos::InterfaceObjectConfigure::Info |
( |
| ) |
const |
|
inlinevirtual |
Turns back information as a string.
◆ Intersection() [1/2]
Tests the intersection of two objects For this configuation file, tests if the two points are the same within a Epsilon tolerance range.
- Parameters
-
| rObj_1 | First point of the tests |
| rObj_2 | Second point of the tests |
- Returns
- Boolean indicating the result of the intersection test described.
◆ Intersection() [2/2]
Tests the intersection of two objects extended with a given radius. For this configuation file, tests if the two points extended with a radius are the same within a Epsilon tolerance range.
- Parameters
-
| rObj_1 | First point of the tests |
| rObj_2 | Second point of the tests |
| Radius | The extension radius to be applied in the intersection. |
- Returns
- Boolean indicating the result of the intersection test described.
◆ IntersectionBox() [1/2]
Tests the intersection of one object with a boundingbox descrived by 'rLowPoint' and 'rHighPoint'. For this configuation file, tests if one point is inside the boundingbox described by 'rLowPoint' and 'rHighPoint' within a Epsilon tolerance range.
- Parameters
-
| rObject | Point of the tests. |
| rLowPoint | Lower point of the boundingbox. |
| rHighPoint | Higher point of the boundingbox. |
- Returns
- Boolean indicating the result of the intersection test described.
◆ IntersectionBox() [2/2]
Tests the intersection of one object with a boundingbox descrived by 'rLowPoint' and 'rHighPoint'. For this configuation file, tests if one point extended by radius is inside the boundingbox described by 'rLowPoint' and 'rHighPoint' within a Epsilon tolerance range.
- Parameters
-
| rObject | Point of the tests. |
| rLowPoint | Lower point of the boundingbox. |
| rHighPoint | Higher point of the boundingbox. |
| Radius | The extension radius to be applied in the intersection. |
- Returns
- Boolean indicating the result of the intersection test described.
◆ KRATOS_CLASS_POINTER_DEFINITION()
◆ PrintData()
| virtual void Kratos::InterfaceObjectConfigure::PrintData |
( |
std::ostream & |
rOStream | ) |
const |
|
inlinevirtual |
◆ PrintInfo()
| virtual void Kratos::InterfaceObjectConfigure::PrintInfo |
( |
std::ostream & |
rOStream | ) |
const |
|
inlinevirtual |
Prints object's information.
◆ Dimension
| constexpr auto Kratos::InterfaceObjectConfigure::Dimension = 3 |
|
staticconstexpr |
◆ Epsilon
| constexpr auto Kratos::InterfaceObjectConfigure::Epsilon = std::numeric_limits<double>::epsilon() |
|
staticconstexpr |
Compile time definitions
- Parameters
-
| Epsilon | Error tolerance for cmparison operations with doubles |
| Dimension | Dimension of the problem. Fixed to 3. |
The documentation for this class was generated from the following file:
- /home/runner/work/Documentation/Documentation/master/applications/MappingApplication/custom_searching/custom_configures/interface_object_configure.h


Preparation time
30 mins to 1 hour
Cooking time
30 mins to 1 hour
Serves
Makes 4 pies
Also known as mutton pies, these have a very long history. In the middle ages, they were frowned upon by the Scottish church, viewed as luxurious, decadent English-style food. In later centuries, they proved to be convenient and sustaining snacks for working people, who would buy them hot from pie-men or pie-wives in the city streets. The space on top of the pie, created by the raised crust, would sometimes be filled with gravy, beans or mashed potato.
Preheat the oven to 200C/400F/Gas 6 and line a baking tray with baking parchment. Cut four strips of greaseproof paper, about 5cm/2in deep and 25cm/10in long, to wrap around the pies. You’ll also need four pieces of cook’s string to secure the paper.
For the filling, mix all the ingredients together in a bowl and season generously with salt and white pepper. Work the liquid into the meat, divide into four portions and mould into balls. Refrigerate while you make the pastry.
To make the pastry, heat 160ml/5½fl oz of water, salt and lard in a saucepan until just boiling. Meanwhile, put the flour in a mixing bowl. Pour the hot liquid onto the flour and mix together with a spoon. Once cool enough to handle, tip onto a floured surface and knead until you have a smooth dough.
Working as quickly as you can, cut off a quarter of the pastry and set aside. Divide the remaining dough into four equally sized balls. Roll out each ball to an 18cm/7in circle, about 5mm/¼in thick. Roll out the remaining pastry and cut out four circular lids, 10cm/4in in diameter.
Place a ball of filling on each large circle of pastry. Gather the pastry around the meat and bring up the sides to form the shape of a pork pie. Keep stretching the pastry so it comes above the meat by around 2cm/1¾in. Dampen the edges of the pies with water and press the lids on top of the filling. Seal the edges together using your fingers. Wrap a strip of greaseproof paper around each pie and secure with string (to make sure the pie holds its shape when cooking). This is much easier if you have someone to help you.
Put the pies on the baking tray and cut a steam hole in the centre of each. Brush with beaten egg yolk and transfer to the fridge to rest for 30 minutes. Bake for 35-40 minutes, or until golden-brown. Serve hot.


Sample problem
The ascii notebook format
Cell delimiter lines
Include lines
Mako processing
Example on syntax
The compiled file
The generator code
Summary. This note explains how to write your own notebook generator in Python such that you can write a notebook in plain ascii in your favorite editor and also use handy tools such as preprocessors to introduce variables and other programming constructs into the text as well as to run computations.
Ascii input is particularly useful if you have LaTeX code that you want to make use of in notebooks. Then you must translate the LaTeX code to the syntax described here and run the compiler to be described.
The notebook generator will be demonstrated through a specific example. on writing a little report where we 1) present a differential equation, 2) solve it by SymPy, and 3) show Python code for the solution and some computations. We show how the SymPy calculations can be done on the fly while compiling the document: results in Python variables from the SymPy calculations are magically propagated into the text. (This functionality is quite similar to PythonTeX, but just based on a standard template language, Mako, instead of quite comprehensive LaTeX code.)
We go for a very simple format: -----
is delimiter lines between cells.
Cells are written in either plain Markdown or as a set of statements in
a programming language, depending on whether the cell is a text or
code cell.
Deliminter lines with an extension text x
, as in -----x
,
indicates code cell in language x
, where x
is a short name for
the language, typically the file extension: py
for Python,
f
for Fortran, c
for C, cpp
for C++, js
for JavaScript,
sh
for Bash or another Unix shell, sys
for the console (terminal
window),
java
for Java, tex
for LaTeX or TeX, html
for HTML, etc.
If x
is proceeded by -t
it means that the cell is not a code cell,
but a standard static Markdown code cell typeset within triple backticks
as usual in Markdown. (Sometimes one wants to show code, but it is not
intended to be executable.)
It is handy to include other files in a document so we invent the
syntax #include "filename"
at the beginning of a line to include a file
with name filename
.
#include "myprog.py" fromto: from_regex@to_regex
However, this extension is not incorporated in the first version of the notebook generator. We just mention the possibility.
It is also very handy to run the text through a preprocessor that is
a full-fledged template programming language of the type that is
popular in the web world. Here we have chosen
Mako. Running the text through Mako
enables the use of variables, if-tests, and loops, to menition the
most usual constructs. Pure Python functions can be defined inside
<%
and %>
and called
in the code. Mako applies the syntax ${var}
for variables and
${myfunc(arg1, arg2=None)}
for function calls.
<%
and %>
Mako tags is not
recommended as debugging can be a nightmare. Instead, put the code
in a file, say myprog.py
, and just include it:
<%
#include "myprog.py"
%>
Then you can debug myprog.py
as standard Python code, but call up
its functions and use its global variables in the document's text (!).
Let us show a very simple document with some code, some math, and
use of include and Mako. The task is to solve a differential equation
by SymPy on the fly in the code and use SymPy output directly
in the text. For this goal, we write the SymPy code in a separate
file where a dump
function can be used for heavily printing
of intermediate results, but a global variable allow_printing
determines whether printing is turned on and off: we want it on
when debugging, but off when compiling our document.
The document starts with an author, his address, and the date, where
author and address are Mako variables we can specify on the command line
when compiling the document. This text is a Markdown cell and therefore
starts with -----
:
-----
## Test of Jupyter Notebook generator
**${NAME}**, ${ADDRESS}
**May 14, 2015**
Note that a double ##
is a Mako comment line and it will not be a
part of the final output from Mako. IC
is another variable that must
be specified on the command line (and fed to Mako) for the initial
condition of the differential equation.
Next follows the math part where we have an included SymPy code
to solve the math problem. The SymPy is in the file .solve_dyeqy.py
:
# Solve y'=y, y(0)=2 by sympy
# This file is intended for being included via mako
# in a document, but it is much easier to debug the
# python code in a separate standard .py file.
# Then we just include this file in the document inside
# <% ... %> mako directives and set allow_printing=False.
def dump(var):
if allow_printing:
print var
def solve():
"""Solve y'=y, y(0)=2."""
import sympy as sym
t = sym.symbols('t', real=True, positive=True)
y = sym.symbols('y', cls=sym.Function)
# Solve differential equation using dsolve
eq = sym.diff(y(t), t) - y(t)
dump(eq)
sol = sym.dsolve(eq)
dump(sol)
y = sol.rhs # grab right-hand side of equation
# Determine integration constant C1 from initial condition
C1 = sym.symbols('C1')
y0 = 2
eq = y.subs(t, 0) - y0 # equation for initial condition
dump(eq)
sol = sym.solve(eq, C1) # solve wrt C1
dump(sol)
y = y.subs(C1, sol[0]) # insert C1=2 in solution
dump(y)
y_func = sym.lambdify([t], y, modules='numpy')
return sym.latex(y), sym.latex(sol[0]), y_func
if __name__ == '__main__':
allow_printing = True
solve()
This is just standard Python code. The __name__
variable equals
__builtin__
when we run this code inside Mako so then the test block
is inactive. Instead, we can define allow_printing = False
,
call `solve(), and store its output in variables such that we can access
them in the running text. Here is the syntax:
## Math
This is a test notebook where we solve the following math
problem:
$$
y' = y,\quad y(0)=${IC}
$$
## Solve the problem by SymPy
<%
## Make sure to test the Python file first!
#include ".solve_dyeqy.py"
allow_printing = False
y_expr, C_expr, y_func = solve()
%>
The equation is separable, and we find by standard methods
that
$$
y(t) = ${y_expr}.
$$
The integration constant is found from the initial condition
$y(0)=${IC}$ and equals in this case $${C_expr}$.
Note how we in the middle of math expressions use Mako variables taken
from both the command line, such as ${IC}
, and from the
Python code, such as ${y_expr}
and ${C_expr}
!
We can now define some code cells for execution. We want to
create a Python code for the solution, using the SymPy variable
y_expr
and SymPy's ability to write the expression for
a numerical Python function, here called y(t)
. Note that the
delimiter for a Python code cell is -----py
.
## Code
We implement the evaulation of $y(t)$ in Python:
<%
## We use sympy to convert y_expr to a string to
## be returned as Python code
import sympy
## Note that we have y_func which is a real Python
## function, but here we make a similar one: y(t)
## so the user can see it.
%>
-----py
from numpy import exp
def y(t):
return ${sympy.printing.lambdarepr.lambdarpr(${y_expr})}
## Try values
y(0)
-----py
y(1), 2*exp(1)
-----py
y(2), 2*exp(2)
-----py-t
instead of -----py
.
Finally, we show how to compile the ascii file into a Jupyter Notebook, using a console cell that is to be shown as plain Markdown Bash code.
## Compilation
-----
This is how we run the notebook generator on files with
extension `.aipynb`:
## console cell, but typeset as pure code (-t extension)
-----sys-t
Terminal> ipynb_generator.py myfile.aipynb MYVAR=4 GRADE='excellent'
What we have not shown here, is the ability to call Python function
in the text. We could, if it was sensible, call the solve
function
in the text, e.g., as in
...and the solution becomes ${solve()[0]}
.
We compile our example file by the following command:
Terminal> python ipynb_generator.py .test1.aipynb NAME="Core Dump" \
ADDRESS="ADDRESS=Seg. Fault Ltd and Univ. of C. Space" \
IC=2
Note that some Mako variables are supposed to be given on the command line,
here three, while others are defined in Python code within <%
and %>
tags in the document.
The output of the ipynb_generator.py
command above
is a notebook file .test1.ipynb
. The file looks like this:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"# Test of Jupyter Notebook generator\n",
"\n",
"**Core Dump**, Seg. Fault Ltd and Univ. of C. Space\n",
"\n",
"**May 14, 2015**\n",
"\n",
"\n",
"This is a test notebook where we solve the following math\n",
"problem:\n",
"\n",
"$$\n",
"y' = y,\\quad y(0)=2\n",
"$$\n",
"\n",
"\n",
"\n",
"The equation is separable, and we find by standard methods\n",
"that\n",
"\n",
"$$\n",
"y(t) = 2 e^{t}.\n",
"$$\n",
"The integration constant is found from the initial condition\n",
"$y(0)=2$ and equals in this case $2$.\n",
"\n",
"\n",
"We implement the evaulation of $y(t)$ in Python:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from numpy import exp\n",
"\n",
"def y(t):\n",
" return 2*exp(t)\n",
"\n",
"# Try values\n",
"y(0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"y(1), 2*exp(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"y(2), 2*exp(2)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"This is how we run the notebook generator on files with\n",
"extension `.aipynb`:\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"```Python\n",
"\n",
"Terminal> ipynb_generator.py myfile.aipynb\n",
"```\n"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}
The notebook file resides in GitHub and can be automatically rendered there.
We shall now list the code that translates the ascii input, with the special syntax explained, into a notebook. The algorithmic steps are
cells
list of all cells., i.e., detect
the beginning of a new cell by the delimiter line -----
.
The cells
list consists of elements of 3-lists, where each
3-list has the cell type, a description, and all the lines of
the cell as its three elements.cells
, see if the delimiter
line has a language specification and therefore is a code cell,
or if it is a plain Markdown code cell.cells
and join separate lines in each cell into a string.IPython.nbformat.v4
for translating
the information in the cells
list into a cell list nb_cells
suitable
for the nootebook.nb_cells
list to JSON format.read
function looks as follows.
def read(text, argv=sys.argv[2:]):
lines = text.splitlines()
# First read all include statements
for i in range(len(lines)):
if lines[i].startswith('#include "'):
filename = lines[i].split('"')[1]
with open(filename, 'r') as f:
include_text = f.read()
lines[i] = include_text
text = '\n'.join(lines)
# Run Mako
mako_kwargs = {}
for arg in argv:
key, value = arg.split('=')
mako_kwargs[key] = value
encoding = 'utf-8'
try:
import mako
has_mako = True
except ImportError:
print 'Cannot import mako - mako is not run'
has_mako = False
if has_mako:
from mako.template import Template
from mako.lookup import TemplateLookup
lookup = TemplateLookup(directories=[os.curdir])
text = unicode(text, encoding)
temp = Template(text=text, lookup=lookup,
strict_undefined=True)
text = temp.render(**mako_kwargs)
# Parse the cells
lines = text.splitlines()
cells = []
inside = None # indicates which type of cell we are inside
fullname = None # full language name in code cells
for line in lines:
if line.startswith('-----'):
# New cell, what type?
m = re.search(r'-----([a-z0-9-]+)?', line)
if m:
shortname = m.group(1)
if shortname:
# Check if code is to be typeset as static
# Markdown code (e.g., shortname=py-t)
astext = shortname[-2:] == '-t'
if astext:
# Markdown
shortname = shortname[:-2]
inside = 'markdown'
cells.append(['markdown', 'code', ['\n']])
cells[-1][2].append('```%s\n' % fullname)
else:
# Code cell
if shortname in shortname2language:
fullname = shortname2language[shortname]
inside = 'codecell'
cells.append(['codecell', fullname, []])
else:
# Markdown cell
inside = 'markdown'
cells.append(['markdown', 'text', ['\n']])
else:
raise SyntaxError(
'Wrong syntax of cell delimiter:\n%s'
% repr(line))
else:
# Ordinary line in a cell
if inside in ('markdown', 'codecell'):
cells[-1][2].append(line)
else:
raise SyntaxError(
'line\n %s\nhas not beginning cell delimiter'
% line)
# Merge the lines in each cell to a string
for i in range(len(cells)):
if cells[i][0] == 'markdown' and cells[i][1] == 'code':
# Add an ending ``` of code
cells[i][2].append('```\n')
cells[i][2] = '\n'.join(cells[i][2])
import pprint
return cells
The line fullname = shortname2language[shortname]
is not easy
to understand unless we have the definition of the dictionary
# Mapping of shortnames like py to full language
# name like python used by markdown/pandoc
shortname2language = dict(
py='Python', ipy='Python', pyshell='Python', cy='Python',
c='C', cpp='Cpp', f='Fortran', f95='Fortran95',
rb='Ruby', pl='Perl', sh='Shell', js='JavaScript', html='HTML',
tex='Tex', sys='Bash',
)
The translation from a cells
list to the similar list needed
by the IPython notebook writing functions is taken care of
in the following function:
def write(cells):
"""Turn cells list into valid IPython notebook code."""
# Use IPython.nbformat functionality for writing the notebook
from IPython.nbformat.v4 import (
new_code_cell, new_markdown_cell, new_notebook)
nb_cells = []
for cell_tp, language, block in cells:
if cell_tp == 'markdown':
nb_cells.append(new_markdown_cell(source=block))
elif cell_tp == 'codecell':
nb_cells.append(new_code_cell(source=block))
nb = new_notebook(cells=nb_cells)
from IPython.nbformat import writes
filestr = writes(nb, version=4)
return filestr
A driver or main program is needed:
def driver():
"""Compile a document and its variables."""
try:
filename = sys.argv[1]
with open(filename, 'r') as f:
text = f.read()
except (IndexError, IOError) as e:
print 'Usage: %s filename' % (sys.argv[0])
print e
sys.exit(1)
cells = read(text, argv=sys.argv[2:])
filestr = write(cells, 3)
filename = filename[-5:] + '.ipynb'
with open(filename, 'w') as f:
f.write(filestr)
The true file has support for notebook format version 3 and 4
and contains also a lot of logging
statements to aid
debugging.
IPython.nbformat
functions can be used for writing notebooks.


Computer Engineer and Programmer
| Age | : | 21 |
| Website | : | www.matthewdwyerportfolio.netlify.com |
| : |<EMAIL_ADDRESS>| |
| School Email | : |<EMAIL_ADDRESS>|
I am a self-motivated, team-oriented, soon to be graduate of Syracuse University. I specialize in software specification and development, cyber-security, and front-end development. My natural programming language is C++ in the context of embedded systems but I have expanded my programming knowledge to a wide variety of different languages for different platforms. I am currently looking for an opportunity to further my advancement as a professional and make an impact in my field.
I've been writing programs in C and C++ for over 3 years now. C was the first real programming language I learned when I started to work with microcontrollers and embedded systems. C++ was a natural follow up to expand my understanding and make it so I could do more with embedded systems as well as write more complex applications.
After already working with C and C++ for a few years, learning C# seemed like a must to order to continue to grow as a programmer. Almost all of the work I did with C# was in the .NET framework. I made games in C# like a remote tic-tac-toe game and a brick breaker game using observable collections.
Currently, I am taking a graduate level class that focuses on SQL and its practical uses to create and manage databases. By the end of the class I expect to have a sample database that I created and manage using SQL server.
Knowledgeable on the fundamentals of cyber-security including understanding major exploits. Exploits such as, buffer-overflow based attacks, meltdown/spectre and SQL injection attacks.
Web design and development has always been a passion of mine. Once I learned how to make basic webpages and style them, the sky was the limit. I decided to make my own website to showcase my abilities both in web design and computer engineering.
Used JavaScript to write basic front-end webpage effects. Currently working on a song suggestion web application written completely in JavaScript.
Java was the second programming language I learned and the first language I started undertaking personal projects in. One of those projects was a virtual vending machine which had hidden features including games, a secret message, and could “dispersive” virtual drinks to the user. This was a first year project.
Our Home Security System consisted of a camera connected to a Raspberry Pi that runs a facial recognition program. This program streams the camera’s live feed to a private webpage and sends the user an email notification anytime the camera saw a face. The camera’s base could also be rotated remotely so no angle would go uncovered. This project was written mainly in C++.
I created my own personal website to test my skills with HTML5, CSS3 using the bootstrap framework. The website is fully responsive and looks good no matter the user’s screen size. The website also has a contact form powered by a simple PHP program. However, on the live versoin of this site, I am unable to host and run the PHP code due to my webhost's restrictions on non-static code.
Currently working on a JavaScript web app that gives the user song suggestions based on what the user likes to listen to. This data is taken from the Spotify API and then processed by our app algorithm. Our app then outputs song suggestions to the user.
Made a brick breaker game using C# in the .NET framework. I did this by using observable collections for the bricks, events for when the ball hit either a paddle or a brick, and timers to control the movement of the ball. This was on done in the context of a WPA application.


x' = *x + *y y' = *x + *y submit
x(x,y)' = y(x,y)' = nonlinear field random field
x = y = submit
x: to y: to submit


Changelog¶
master¶
New Features¶
Fixes¶
Fix definition lists looking different with Sphinx 2.0+
Other Changes¶
Add the
navigation
template block around the navigation area.Added Spanish translation
Added i18n support using Babel
Moved build system from Grunt and friends to Webpack
Remove Modernizr, but keep html5shiv (#724, #525)
0.4.3¶
- Date
Feb 12, 2019
New Features¶
Fixes¶
Fix scrolling to active item in sidebar on load (#214)
Style caption link for code and literal blocks
Fix inconsistent font size and line height for autodoc “raises” and “returns” (#267)
Fix last_updated notice appearing in same line as copyright notice (#704)
Other Changes¶
v0.4.2¶
- Date
Oct 5, 2018
New Features¶
Fixes¶
Set base font size on <html> (#668)
Fix HTML search not working with Sphinx-1.8 (#672)
Other Changes¶
Upload signed packages to PyPI with twine (#651)
Do not enforce period at the end of copyright statement (666)
v0.4.1¶
- Date
July 27, 2018
New Features¶
Fixes¶
Line height adjustments for Liberation Mono (#656)
Other Changes¶
Add Sphinx as a dependency
v0.4.0¶
This version made some changes to how JS and CSS were included when the theme is used on Read the Docs.
New Features¶
Fixes¶
Do not rely on readthedocs.org for CSS/JS (#614)
Color accessibility improvements on the left navigation
Other Changes¶
Write theme version and build date at top of JavaScript and CSS
Changed code and literals to use a native font stack (#612)
Fix small styling issues
v0.3.1¶
Fixes¶
Revert part of #576 causing display issues with version selector menu
Backwards compatibility fixes for pre-0.3.0 releases (#623)
Fix mkdocs version selector (#622)
Add open list spacing (#591)
Fix table centering (#599)
v0.3.0¶
Note: this version resulted in some JavaScript incompatibilities when used on readthedocs.org
New Features¶
Add html language attribute
Allow setting ‘rel’ and ‘title’ attributes for stylesheets (#551)
Add option to style external links
Add github, gitlab, bitbucket page arguments option
Add pygments support
Add setuptools entry point allowing to use
sphinx_rtd_theme
as Sphinxhtml_theme
directly.Add language to the JS output variable
Fixes¶
Fix some HTML warnings and errors
Fix many styling issues
Fix many sidebar glitches
Fix line number spacing to align with the code lines
Hide Edit links on auto created pages
Include missing font files with the theme
Other Changes¶
Significant improvement of our documentation
Compress our Javascript files
Updated dependencies
v0.2.4¶
Yet another patch to deal with extra builders outside Spinx, such as the singlehtml builders from the Read the Docs Sphinx extension
v0.2.3¶
Temporarily patch Sphinx issue with
singlehtml
builder by inspecting the builder in template.
v0.2.2¶
Roll back toctree fix in 0.2.1 (#367). This didn’t fix the issue and introduced another bug with toctrees display.
v0.2.1¶
Add the
rel
HTML attribute to the footer links which point to the previous and next pages.Fix toctree issue caused by Sphinx singlehtml builder (#367)
v0.2.0¶
Adds the
comments
block after thebody
block in the templateAdded “Edit on GitLab” support
Many bug fixes
v0.1.10-alpha¶
Note
This is a pre-release version
Removes Sphinx dependency
Fixes hamburger on mobile display
Adds a
body_begin
block to the templateAdded
prev_next_buttons_location
v0.1.9¶
Intermittent scrollbar visibility bug fixed. This change introduces a backwards incompatible change to the theme’s layout HTML. This should only be a problem for derivative themes that have overridden styling of nav elements using direct descendant selectors. See #215 for more information.
Safari overscroll bug fixed
Version added to the nav header
Revision id was added to the documentation footer if you are using RTD
An extra block,
extrafooter
was added to allow extra content in the document footer blockFixed modernizr URL
Small display style changes on code blocks, figure captions, and nav elements
v0.1.8¶
Start keeping changelog :)
Support for third and fourth level headers in the sidebar
Add support for Sphinx 1.3
Add sidebar headers for :caption: in Sphinx toctree
Clean up sidebar scrolling behavior so it never scrolls out of view


Pedestrian dies from injuries after being hit by vehicle in Lakeland
by WFTS Digital StaffLAKELAND, Fla. — A pedestrian is dead after he was hit by a vehicle in Lakeland on Friday.
Lakeland police said at approximately 8:34 p.m., a white Ford E250 was traveling on Kathleen Road in the outside lane. As the Ford van approached the 1200 block of Kathleen Road, a pedestrian darted out into the road.
POLK NEWS | The latest headlines from Polk County
The pedestrian was later identified as Collis Holley.
Holley was attempting to cross the roadway in an area not marked for pedestrian traffic with little lighting. The driver of the van, Eric Trisch, attempted to turn left to avoid Holley but was unsuccessful.
Trisch hit Holley and pulled over to come to a stop.
Emergency medical professionals arrived on the scene and began assisting other officers in providing life-saving measures. Holley was transported to a local hospital but later died from his injuries.
Due to the incident, the roadway was shut down for about three and a half hours while the scene was being investigated.


Enter a name for your score to be added to the scoreboard. Letters and numbers only please, all other
characters will be removed. No spaces either. For the time being the name that you choose is permanent, but
can be changed in a future update.
submit


Skip to the content.
The Widow
Ford Escort MKII Project
Rebuild of the Ford Type-9 5 spd gearbox:
many oil leaks
noisy on load
Gearbox was lose-ish in tunnel
Quickshift kit is sex


This was the capstone project I completed for my Intro to Tech class at Lafayette Boynton
This was the individual capstone project I completed for my Advanced Web Development with Python and Django class at The Knowledge House. This project was created with HTML5, CSS, JQuery and Bootstrap on the front-end and the Django framework on the back-end.

This was a project that I completed in 48 hours with the assistance of a development team during the 48in48 NYC hackathon. The client was in need of a new digital prescence for her organization. My team and I used Wordpress and additional third party API's in order to bring the clients vision to fruition
This was a project that I completed in 48 hours with the assistance of a development team during the 48in48 NYC hackathon. The client was in need of a platform that was easy for potential sponsors to donate to. With the help of an amazing UX designer, we were able to increase the amount of donations recieved through the Ivy League C.H.I.C.S. platform by 20%
This is the current client project I am working on. The client did not have a previous digital prescence and was looking to for a basic landing page to get more traffic to the business.


Email Updates
Special Discounts
Exclusive Content
Email Updates
All Web Dev Simplified course, YouTube, and Patreon updates will be sent via email to members so you can stay up to date with everything Web Dev Simplified.
Special Discounts
All members of the Web Dev Simplified mallign list will receive exclusive discounts on all future Web Dev Simplified courses.
Extra Content
Email members will receive extra content such as course updates, discounts and behin the scenes informartion on everything Web Dev Simplified.


Eala’s brod wins in Cyprus
by Manila Standard SportsUnseeded Michael Francis ‘Miko’ Eala stopped Ilya Snitari of Moldova, 6-4, 5-7, 6-2, to top the Grade 3 International Tennis Federation Hellenic Bank Masters in Cyprus.
In fending off the 238th-ranked Snitari, the 349th ranked Miko, who is older brother of 14-year old Alexandra, has won his second tournament since taking the runner-up honors in the J3 Neuchâtel event in Switzerland back in June.
“I won the tournament! Dedicating this win to my Lolo Papa! I am headed to Israel for my next tournament,” said Eala in a statement.
Miko is on a tennis scholarship with his sister at the Rafa Nadal Academy in Mallorca Spain.
In a message, Miko said he will now compete in Israel in the coming days.
To reach the finals, the 17-year-old Eala turned back Lukas Pokorny of Slovakia, 7-6, 6-2, in the first round.
Then, he eased out Mili Poljicak of Poland, 6-7, 6-2, 6-3 in the second round before prevailing against Thibault Virdier of France, 4-6, 6-2, 6-3, in the quarterfinals.
After that, Eala outplayed Marc Ktiri of Spain, 6-1, 6-1, in the semifinals.
In June last year, Eala claimed his first crown in a Grade 4 event. Peter Atencio


No
Yes
resting electrocardiographic results
normal
having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV)
showing probable or definite left ventricular hypertrophy by Estes' criteria 20 ekgmo (month of exercise ECG reading)
maximum heart rate achieved
exercise_induced_angina
No
Yes
ST_depression
slope of the peak exercise ST segment
upsloping
flat
downsloping
no._major_vessels
0
1
2
3
4
label for="Thalassemia">Thalassemia
0
1
2
3


EMAIL
I check my email several times daily, and it is my preferrend method of communication.
<EMAIL_ADDRESS><EMAIL_ADDRESS>LINKEDIN
Follow me on my LinkedIn for more information on my achievements, resume, or education!
linkedin.com/in/joseph-hilber
linkedin.com/in/joseph-hilber
GITHUB
My favorite "social platform," of course! Follow my Github or just check out projects I have done (including this one).
github.com/jah01
github.com/jah01


--- title: Case Studies description: Stories about how Redash is being used layout: default permalink: /case-studies/ --- Case Studies See how various organizations use Redash to build a data-driven business BubbleIQ BubbleIQ uses Redash to support sales, save engineering time and report towards investors Learn more → {% include get_started.html %}
See how various organizations use Redash to build a data-driven business
BubbleIQ uses Redash to support sales, save engineering time and report towards investors
Learn more →


| Class | Description |
|---|---|
| CommandSetSequence |
A sequence of
RobotCommandSet that will be executed one
after another. |
| CommandSetSequenceFrame |
The `CommandSetSequenceFrame` object is a container for a single `RobotCommandSet` object and its execution time (in seconds).
|
| CommandSetSequenceFrameFixed |
The `CommandSetSequenceFrameFixed` object is a container for a single `CommandSetSequenceFrame` object
and its associated 'CommandSetSequence' object.
|
| RobotCommandSet |
`RobotCommandSet` is a collection of 'RobotCommand's to be sent to a robot.
|
| RobotSensorHistory |
The `RobotSensorHistory` object contains a set of `RobotSensorSet` objects in reverse chronological order.
|
| RobotSensorSet |
'RobotSensorSet' contains the 'RobotSensor' objects and convenience methods to access these objects.
|


API tokens offer a way to make authenticated CLI or REST API calls. See
our wiki
for more details.
The username associated with each token is your Jenkins username.
Some good practices for keeping your API tokens secure are:
-
Use a different token for each application so that if an application is
compromised you can revoke its token individually.
-
Regenerate the tokens every 6 months (depending on your context). We
display an indicator concerning the age of the token.
-
Protect it like your password, as it allows other people to access Jenkins
as you.
Every time Jenkins is restarted the creation dates for unused legacy tokens
are reset which means that the dates may be inaccurate.


Click on the blank and then click on the correct Action Verb from the help box to complete the sentences.
1)
Sarah
washes
the dishes after dinner.
2)
You can
tell
your story to the class.
3)
Mrs. Wilson
bakes
delicious cakes.
4)
Please
open
the door.
5)
Alia
knows
her spellings very well.
6)
Children
make
sandcastles at the beach.
7)
It
rains
every evening in Thailand.
8)
Babies
cry
loudly when they are hungry.
tell
washes
knows
open
bakes
cry
make
rains
Submit


#
INFO 610 Fall 2019
Week 5
More on the SQL
chrisfauerbach.github.io/info610_fall_2019/
--- # SQL Review * Serial and Identity Columns * Materialized Views * Query / Distinct * Join types * Grouping --- # Sequence In PostgreSQL, a sequence is a special kind of database object that generates a sequence of integers. A sequence is often used as a primary key column. Similar to the AUTO_INCREMENT concept in MySQL. When creating a new table, the sequence is created through the SERIAL pseudo-type as follows: ```sql CREATE TABLE table_name( id SERIAL ); ``` By assigning the SERIAL pseudo-type to the id column, PostgreSQL will perform the following: * Creates a sequence object and set the next value generated by the sequence as the default value for the column. * Adds the NOT NULL constraint to the column because a sequence always generates an integer, which is a non-null value. --- # Serial Types * smallserial /
serial
/ bigserial * 2 / 4/ 8 byte integers * Auto-incrementing integer values --- |Name|Storage Size|Description|Range| |--|--|--|--| |smallint|2 bytes|small-range integer|-32768 to +32767| |integer|4 bytes|typical choice for integer|-2147483648 to +2147483647| |bigint|8 bytes|large-range integer|-9223372036854775808 to +9223372036854775807| |decimal|variable|user-specified precision, exact|up to 131072 digits before the decimal point; up to 16383 digits after the decimal point| |numeric|variable|user-specified precision, exact|up to 131072 digits before the decimal point; up to 16383 digits after the decimal point| |real|4 bytes|variable-precision, inexact|6 decimal digits precision| |double precision|8 bytes|variable-precision, inexact|15 decimal digits precision| |smallserial|2 bytes|small autoincrementing integer|1 to 32767| |serial|4 bytes|autoincrementing integer|1 to<PHONE_NUMBER>| |bigserial|8 bytes|large autoincrementing integer|1 to<PHONE_NUMBER>854775807| --- # How to create and use a serial field It is important to note that the SERIAL does not implicitly create an index on the column or make the column as the primary key column. However, this can be done easily by specifying the PRIMARY KEY constraint for the SERIAL column. ```sql CREATE TABLE fruits( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL ); INSERT INTO fruits (name) values ('apple'), ('pear'), ('pawpaw'),('orange'); SELECT * FROM fruits; ``` |ID|Name| |--|--| |1|apple| |2|pear| |3|pawpaw| |4|orange| --- # Identity Column PostgreSQL version 10 introduced a new feature called GENERATED AS IDENTITY constraint that allows you to automatically assign a unique value to a column. The GENERATED AS IDENTITY constraint is the SQL standard-conforming variant of the PostgreSQL’s SERIAL column. ```sql CREATE TABLE color ( color_id INT GENERATED ALWAYS AS IDENTITY, color_name VARCHAR NOT NULL ); INSERT INTO color (color_name) VALUES ('Red'); SELECT * FROM colors; ``` |ID|color| |--|--| |1|Red| --- # Materialized Views Materialized views in PostgreSQL use the rule system like views do, but persist the results in a table-like form. The main differences between: ```sql CREATE MATERIALIZED VIEW mymatview AS SELECT * FROM mytab; ``` and: ```sql CREATE TABLE mymatview AS SELECT * FROM mytab; ``` are that the materialized view cannot subsequently be directly updated and that the query used to create the materialized view is stored in exactly the same way that a view's query is stored, so that fresh data can be generated for the materialized view with: ```sql REFRESH MATERIALIZED VIEW mymatview; ``` --- While access to the data stored in a materialized view is often much faster than accessing the underlying tables directly or through a view, the data is not always current; yet sometimes current data is not needed. Consider a table which records sales: ```sql CREATE TABLE invoice ( invoice_no integer PRIMARY KEY, seller_no integer, -- ID of salesperson invoice_date date, -- date of sale invoice_amt numeric(13,2) -- amount of sale ); ``` If people want to be able to quickly graph historical sales data, they might want to summarize, and they may not care about the incomplete data for the current date: ```sql CREATE MATERIALIZED VIEW sales_summary AS SELECT seller_no, invoice_date, sum(invoice_amt)::numeric(13,2) as sales_amt FROM invoice WHERE invoice_date < CURRENT_DATE GROUP BY seller_no, invoice_date ORDER BY seller_no, invoice_date; ``` --- # Update Materialized View This materialized view might be useful for displaying a graph in the dashboard created for salespeople. A job could be scheduled to update the statistics each night using this SQL statement: ```sql REFRESH MATERIALIZED VIEW sales_summary; ``` --- # Distinct
SELECT DISTINCT
eliminates duplicate rows from the result. If SELECT DISTINCT is specified, all duplicate rows are removed from the result set (one row is kept from each group of duplicates) --- # In practice ```sql CREATE TABLE t1 ( id serial NOT NULL PRIMARY KEY, bcolor VARCHAR, fcolor VARCHAR ); INSERT INTO t1 (bcolor, fcolor) VALUES ('red', 'red'), ('red', 'red'), ('red', NULL), (NULL, 'red'), ('red', 'green'), ('red', 'blue'), ('green', 'red'), ('green', 'blue'), ('green', 'green'), ('blue', 'red'), ('blue', 'green'), ('blue', 'blue'); ``` --- ```sql SELECT * FROM t1; ``` |ID|bcolor|fcolor| |--|--|--| |1|red|red| |2|red|red| |3|red|| |4||red| |5|red|green| |6|red|blue| |7|green|red| |8|green|blue| |9|green|green| |10|blue|red| |11|blue|green| |12|blue|blue| --- ```sql SELECT * FROM t1; ``` |ID|bcolor|fcolor| |--|--|--| |1|red|red| |2|red|red| |3|red|| |4||red| |5|red|green| |6|red|blue| |7|green|red| |8|green|blue| |9|green|green| |10|blue|red| |11|blue|green| |12|blue|blue| --- ```sql select distinct bcolor from t1 ``` |bcolor| |--| |(null)| |green| |blue| |red| --- # Joins * Left Outer * Inner * Right Outer * Full Outer ---
--- # Aggregations next week --- # Homework We need a project to build on. What type of database should we design? Employees? Sales? Inventory? Social Network? --- --- --- --- --- --- --- --- ---


AKAN NAME GENERATOR
Please fill in the form below to know your Akan Name:
Your name:
Year Born:
Month Born:
Date your Born:
Your Gender:
Male
Female

ENTER

Refresh


Module ctfile
Creator Tools LUA File Utilities File
Author: Native Instruments Written by: Yaron Eshkar
This file includes useful functions for usage in Creator Tools Lua scripts.
Simply include this line in any script (if running a script from another location that users this file, make sure to point to the correct path): local ctFile = require("CtFile") Then you can simply call any function like: ctFile.test_function() It is also possible of course to copy entire specific functions from this list directly into your script. In that case remove the CtFile part from the function name, and then simply call it normally like: test_function()
Functions
| CtFile.test_function () | Test Function. |
| CtFile.check_duplicate_file_names (path, file_extention, verbose_mode) | Check duplicate file names in path. |
| CtFile.copy_file (source, destination) | Copy a file. |
| CtFile.create_directory (directory, verbose_mode) | Create a directory. |
| CtFile.delete_file (file) | Delete a file. |
| CtFile.get_os () | Get the Operating System type. |
| CtFile.run_shell_command (command, verbose_mode) | Run an OS shell command. |
| CtFile.capture_shell_command (command, raw) | Run shell command and return a string. |
| CtFile.run_file_process (command, file, temp_file) | Run a shell command on a file, overwriting the original file. |
| CtFile.read_file_to_string (file, mode) | Reads a file and returns the contents as a string. |
| CtFile.replace_line_in_file (input_file, replace_line, replace_content) | Replace a line in a file. |
Functions
- CtFile.test_function ()
- Test Function. Takes no arguments, prints to console when called.
- CtFile.check_duplicate_file_names (path, file_extention, verbose_mode)
-
Check duplicate file names in path.
Checks a path and subfolders and returns a table listing paths of duplicate file names.
Parameters:
- path string the directory path to start checking from.
- file_extention string the file extention to look for.
- verbose_mode bool when true prints information to console.
Returns:
-
table
returns a table with the paths of all duplicate file names.
- CtFile.copy_file (source, destination)
-
Copy a file.
Copies a file from source to destination path.
Parameters:
Returns:
-
bool
- CtFile.create_directory (directory, verbose_mode)
-
Create a directory.
Creates a directory with the specified path name.
Parameters:
- directory string the directory path to create.
- verbose_mode bool when true prints information to console.
Returns:
-
bool
- CtFile.delete_file (file)
-
Delete a file.
Deletes the specified file.
Parameters:
- file string the file to delete.
Returns:
-
bool
- CtFile.get_os ()
-
Get the Operating System type.
Determine if the script is running on Windows or Mac.
Returns:
-
bool
true if windows, otherwise false.
- CtFile.run_shell_command (command, verbose_mode)
-
Run an OS shell command.
Executes a command on the operating system console.
Parameters:
- command string the shell command to execute.
- verbose_mode bool when true prints information to console.
Returns:
-
bool
- CtFile.capture_shell_command (command, raw)
-
Run shell command and return a string.
Executes a command on the operating system console, optionally returing anything printed by the command to the console as a string.
Parameters:
- command string the shell command to execute.
- raw bool when true the function will return the result formated.
Returns:
-
string
returns the console print result.
- CtFile.run_file_process (command, file, temp_file)
-
Run a shell command on a file, overwriting the original file.
Executes a shell command on a file, overwriting the original file with the result. A temporary file location must be specified for the processing.
Parameters:
- command string the shell command to execute.
- file string the original file.
- temp_file string a temporary file path for the intermediate operation.
Returns:
-
bool
- CtFile.read_file_to_string (file, mode)
-
Reads a file and returns the contents as a string.
Reads a file in the specified mode and returns the contents as a string.
Parameters:
Returns:
-
string
returns a string with the file contents.
- CtFile.replace_line_in_file (input_file, replace_line, replace_content)
-
Replace a line in a file.
Overwrites a given line in a file with the specfied string.
Parameters:
- input_file string the file to read and wtie to.
- replace_line int the line in the file to be replaced.
- replace_content string the content that should replace the line.
Returns:
-
bool


My Team
Zion
Manager
ID: 1
Email:
<EMAIL_ADDRESS>Office: 123
grady
Engineer
ID: 25
Email:
<EMAIL_ADDRESS>GitHub:
zi-on
trey
Engineer
ID: 87
Email:
<EMAIL_ADDRESS>GitHub:
trey
goku
Intern
ID: 24
Email:
<EMAIL_ADDRESS>School: utsa
artie
Intern
ID: 23
Email:
<EMAIL_ADDRESS>School: utsa


- An Interesting Place For You
- More than entertainment
-<PHONE_NUMBER>
-
// load any GitHub release, commit, or branch
// note: we recommend using npm for projects that support it
https://cdn.jsdelivr.net/gh/user/repo@version/file -
// load jQuery v3.2.1
<EMAIL_ADDRESS>-
// use a version range instead of a specific version
<EMAIL_ADDRESS><EMAIL_ADDRESS>-
// omit the version completely to get the latest one
// you should NOT use this in production
https://cdn.jsdelivr.net/gh/jquery/jquery/dist/jquery.min.js -
// add ".min" to any JS/CSS file to get a minified version
// if one doesn't exist, we'll generate it for you
<EMAIL_ADDRESS>-
// add / at the end to get a directory listing
https://cdn.jsdelivr.net/gh/jquery/jquery/


--- layout: post title: Ajja date: 2011-03-24 08:43:59.000000000 +05:30 categories: - kiranoncemore - Nikon D3000 tags: - B&W - Black and white - grandpa - portrait - rural status: publish type: post published: true meta: _edit_last: '2' author: login: kiranoncemore email<EMAIL_ADDRESS>display_name: kiranoncemore first_name: Kiran last_name: '' ---
Av: F/5; Tv: 1/100s; f:36mm (35mm-equiv: 54mm); Flash used
Post processing using Raw Therapee.
This is my maternal grandfather. Closing in on 80, he's still enthusiastic about anything and everything: politics, cricket, folk art, literature - you name it. I had carried my camera to the remote village where he lives; and had spent most of the time on landscape and nature photography. Ajja demanded that I click his portrait :)
The only thing I like about this photo is the expression. Ajja was initially looking directly into the camera - and I had to force him to look away. Had he been looking into the camera, I do not think I would have got such a pronounced expression.
What I dislike about this snap is the extreme sharpness. In fact this is a problem with most of my recent snaps. I do not know whether this is a side-effect of over-saturation. In fact, while processing this particular snap using Raw Therapee, I even disabled the sharpening altogether.
Any idea how to avoid this kind of sharpness-and-over-saturation problem while using Raw Therapee? I'd be grateful for any pointers. Maybe its time for me to understand what "Unsharp Mask" really means and how to use it to control the sharpness of one's photos!


Home
System Status
Document Status
Start your comfortable document life
Document Status
some explain here
Public Document Status
some explain here
Attached File Size
some explain here
{% include '../partials/footer.html' %}