To enable the system, the function zsh-mime-setup should be autoloaded and run. This allows files with extensions to be treated as executable; such files be completed by the function completion system. The function zsh-mime-handler should not need to be called by the user.
The system works by setting up suffix aliases with ‘alias -s’. Suffix aliases already installed by the user will not be overwritten.
For suffixes defined in lower case, upper case variants will also automatically be handled (e.g. PDF is automatically handled if handling for the suffix pdf is defined), but not vice versa.
Repeated calls to zsh-mime-setup do not override the existing mapping between suffixes and executable files unless the option -f is given. Note, however, that this does not override existing suffix aliases assigned to handlers other than zsh-mime-handler.
Calling zsh-mime-setup with the option -l lists the existing mappings without altering them. Suffixes to list (which may contain pattern characters that should be quoted from immediate interpretation on the command line) may be given as additional arguments, otherwise all suffixes are listed.
Calling zsh-mime-setup with the option -v causes verbose output to be shown during the setup operation.
The system respects the mailcap flags needsterminal and copiousoutput, see man page mailcap(4).
The functions use the following styles, which are defined with the zstyle builtin command (The zsh/zutil Module). They should be defined before zsh-mime-setup is run. The contexts used all start with :mime:, with additional components in some cases. It is recommended that a trailing * (suitably quoted) be appended to style patterns in case the system is extended in future. Some examples are given below.
For files that have multiple suffixes, e.g. .pdf.gz, where the context includes the suffix it will be looked up starting with the longest possible suffix until a match for the style is found. For example, if .pdf.gz produces a match for the handler, that will be used; otherwise the handler for .gz will be used. Note that, owing to the way suffix aliases work, it is always required that there be a handler for the shortest possible suffix, so in this example .pdf.gz can only be handled if .gz is also handled (though not necessarily in the same way). Alternatively, if no handling for .gz on its own is needed, simply adding the command
alias -s gz=zsh-mime-handler
to the initialisation code is sufficient; .gz will not be handled on its own, but may be in combination with other suffixes.
If this boolean style is true, the mailcap handler for the context in question is run using the eval builtin instead of by starting a new sh process. This is more efficient, but may not work in the occasional cases where the mailcap handler uses strict POSIX syntax.
If this boolean style is true, mailcap handlers started in the background will be disowned, i.e. not subject to job control within the parent shell. Such handlers nearly always produce their own windows, so the only likely harmful side effect of setting the style is that it becomes harder to kill jobs from within the shell.
This style gives a list of patterns to be matched against files passed for execution with a handler program. If the file matches the pattern, the entire command line is executed in its current form, with no handler. This is useful for files which might have suffixes but nonetheless be executable in their own right. If the style is not set, the pattern *(*) *(/) is used; hence executable files are executed directly and not passed to a handler, and the option AUTO_CD may be used to change to directories that happen to have MIME suffixes.
This style is useful in combination with execute-as-is. It is set to an array of patterns corresponding to full paths to files that should never be treated as executable, even if the file passed to the MIME handler matches execute-as-is. This is useful for file systems that don’t handle execute permission or that contain executables from another operating system. For example, if /mnt/windows is a Windows mount, then
zstyle ':mime:*' execute-never '/mnt/windows/*'
will ensure that any files found in that area will be executed as MIME types even if they are executable. As this example shows, the complete file name is matched against the pattern, regardless of how the file was passed to the handler. The file is resolved to a full path using the :P modifier described in Modifiers; this means that symbolic links are resolved where possible, so that links into other file systems behave in the correct fashion.
Used if the style find-file-in-path is true for the same context. Set to an array of directories that are used for searching for the file to be handled; the default is the command path given by the special parameter path. The shell option PATH_DIRS is respected; if that is set, the appropriate path will be searched even if the name of the file to be handled as it appears on the command line contains a ‘/’. The full context is :mime:.suffix:, as described for the style handler.
If set, allows files whose names do not contain absolute paths to be searched for in the command path or the path specified by the file-path style. If the file is not found in the path, it is looked for locally (whether or not the current directory is in the path); if it is not found locally, the handler will abort unless the handle-nonexistent style is set. Files found in the path are tested as described for the style execute-as-is. The full context is :mime:.suffix:, as described for the style handler.
Defines flags to go with a handler; the context is as for the handler style, and the format is as for the flags in mailcap.
By default, arguments that don’t correspond to files are not passed to the MIME handler in order to prevent it from intercepting commands found in the path that happen to have suffixes. This style may be set to an array of extended glob patterns for arguments that will be passed to the handler even if they don’t exist. If it is not explicitly set it defaults to [[:alpha:]]#:/* which allows URLs to be passed to the MIME handler even though they don’t exist in that format in the file system. The full context is :mime:.suffix:, as described for the style handler.
Specifies a handler for a suffix; the suffix is given by the context as :mime:.suffix:, and the format of the handler is exactly that in mailcap. Note in particular the ‘.’ and trailing colon to distinguish this use of the context. This overrides any handler specified by the mailcap files. If the handler requires a terminal, the flags style should be set to include the word needsterminal, or if the output is to be displayed through a pager (but not if the handler is itself a pager), it should include copiousoutput.
A list of files in the format of ~/.mailcap and /etc/mailcap to be read during setup, replacing the default list which consists of those two files. The context is :mime:. A + in the list will be replaced by the default files.
This style is used to resolve multiple mailcap entries for the same MIME type. It consists of an array of the following elements, in descending order of priority; later entries will be used if earlier entries are unable to resolve the entries being compared. If none of the tests resolve the entries, the first entry encountered is retained.
The order of files (entries in the mailcap style) read. Earlier files are preferred. (Note this does not resolve entries in the same file.)
The priority flag from the mailcap entry. The priority is an integer from 0 to 9 with the default value being 5.
The test given by the mailcap-prio-flags option is used to resolve entries.
Later entries are preferred; as the entries are strictly ordered, this test always succeeds.
Note that as this style is handled during initialisation, the context is always :mime:, with no discrimination by suffix.
This style is used when the keyword flags is encountered in the list of tests specified by the mailcap-priorities style. It should be set to a list of patterns, each of which is tested against the flags specified in the mailcap entry (in other words, the sets of assignments found with some entries in the mailcap file). Earlier patterns in the list are preferred to later ones, and matched patterns are preferred to unmatched ones.
A list of files in the format of ~/.mime.types and /etc/mime.types to be read during setup, replacing the default list which consists of those two files. The context is :mime:. A + in the list will be replaced by the default files.
If this boolean style is set, the handler for the given context is always run in the foreground, even if the flags provided in the mailcap entry suggest it need not be (for example, it doesn’t require a terminal).
If set, will be used instead of $PAGER or more to handle suffixes where the copiousoutput flag is set. The context is as for handler, i.e. :mime:.suffix: for handling a file with the given suffix.
Examples:
zstyle ':mime:*' mailcap ~/.mailcap /usr/local/etc/mailcap zstyle ':mime:.txt:' handler less %s zstyle ':mime:.txt:' flags needsterminal
When zsh-mime-setup is subsequently run, it will look for mailcap entries in the two files given. Files of suffix .txt will be handled by running ‘less file.txt’. The flag needsterminal is set to show that this program must run attached to a terminal.
As there are several steps to dispatching a command, the following should be checked if attempting to execute a file by extension .ext does not have the expected effect.
The command ‘alias -s ext’ should show ‘ps=zsh-mime-handler’. If it shows something else, another suffix alias was already installed and was not overwritten. If it shows nothing, no handler was installed: this is most likely because no handler was found in the .mime.types and mailcap combination for .ext files. In that case, appropriate handling should be added to ~/.mime.types and mailcap.
If the extension is handled by zsh-mime-handler but the file is not opened correctly, either the handler defined for the type is incorrect, or the flags associated with it are in appropriate. Running zsh-mime-setup -l will show the handler and, if there are any, the flags. A %s in the handler is replaced by the file (suitably quoted if necessary). Check that the handler program listed lists and can be run in the way shown. Also check that the flags needsterminal or copiousoutput are set if the handler needs to be run under a terminal; the second flag is used if the output should be sent to a pager. An example of a suitable mailcap entry for such a program is:
text/html; /usr/bin/lynx '%s'; needsterminal
Running ‘zsh-mime-handler -l command line’ prints the command line that would be executed, simplified to remove the effect of any flags, and quoted so that the output can be run as a complete zsh command line. This is used by the completion system to decide how to complete after a file handled by zsh-mime-setup.
This function is separate from the two MIME functions described above and can be assigned directly to a suffix:
autoload -U pick-web-browser alias -s html=pick-web-browser
It is provided as an intelligent front end to dispatch a web browser. It may be run as either a function or a shell script. The status 255 is returned if no browser could be started.
Various styles are available to customize the choice of browsers:
The value of the style is an array giving preferences in decreasing order for the type of browser to use. The values of elements may be
Use a GUI browser that is already running when an X Window display is available. The browsers listed in the x-browsers style are tried in order until one is found; if it is, the file will be displayed in that browser, so the user may need to check whether it has appeared. If no running browser is found, one is not started. Browsers other than Firefox, Opera and Konqueror are assumed to understand the Mozilla syntax for opening a URL remotely.
Start a new GUI browser when an X Window display is available. Search for the availability of one of the browsers listed in the x-browsers style and start the first one that is found. No check is made for an already running browser.
Start a terminal-based browser. Search for the availability of one of the browsers listed in the tty-browsers style and start the first one that is found.
If the style is not set the default running x tty is used.
An array in decreasing order of preference of browsers to use when running under the X Window System. The array consists of the command name under which to start the browser. They are looked up in the context :mime: (which may be extended in future, so appending ‘*’ is recommended). For example,
zstyle ':mime:*' x-browsers opera konqueror firefox
specifies that pick-web-browser should first look for a running instance of Opera, Konqueror or Firefox, in that order, and if it fails to find any should attempt to start Opera. The default is firefox mozilla netscape opera konqueror.
An array similar to x-browsers, except that it gives browsers to use when no X Window display is available. The default is elinks links lynx.
If it is set this style is used to pick the command used to open a page for a browser. The context is :mime:browser:new:$browser: to start a new browser or :mime:browser:running:$browser: to open a URL in a browser already running on the current X display, where $browser is the value matched in the x-browsers or tty-browsers style. The escape sequence %b in the style’s value will be replaced by the browser, while %u will be replaced by the URL. If the style is not set, the default for all new instances is equivalent to %b %u and the defaults for using running browsers are equivalent to the values kfmclient openURL %u for Konqueror, firefox -new-tab %u for Firefox, opera -newpage %u for Opera, and %b -remote "openUrl(%u)" for all others.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A reasonably powerful calculator based on zsh’s arithmetic evaluation facility. The syntax is similar to that of formulae in most programming languages; see Arithmetic Evaluation for details.
Non-programmers should note that, as in many other programming languages, expressions involving only integers (whether constants without a ‘.’, variables containing such constants as strings, or variables declared to be integers) are by default evaluated using integer arithmetic, which is not how an ordinary desk calculator operates. To force floating point operation, pass the option -f; see further notes below.
If the file ~/.zcalcrc exists it will be sourced inside the function once it is set up and about to process the command line. This can be used, for example, to set shell options; emulate -L zsh and setopt extendedglob are in effect at this point. Any failure to source the file if it exists is treated as fatal. As with other initialisation files, the directory $ZDOTDIR is used instead of $HOME if it is set.
The mathematical library zsh/mathfunc will be loaded if it is available; see The zsh/mathfunc Module. The mathematical functions correspond to the raw system libraries, so trigonometric functions are evaluated using radians, and so on.
Each line typed is evaluated as an expression. The prompt shows a number, which corresponds to a positional parameter where the result of that calculation is stored. For example, the result of the calculation on the line preceded by ‘4> ’ is available as $4. The last value calculated is available as ans. Full command line editing, including the history of previous calculations, is available; the history is saved in the file ~/.zcalc_history. To exit, enter a blank line or type ‘:q’ on its own (‘q’ is allowed for historical compatibility).
A line ending with a single backslash is treated in the same fashion as it is in command line editing: the backslash is removed, the function prompts for more input (the prompt is preceded by ‘...’ to indicate this), and the lines are combined into one to get the final result. In addition, if the input so far contains more open than close parentheses zcalc will prompt for more input.
If arguments are given to zcalc on start up, they are used to prime the first few positional parameters. A visual indication of this is given when the calculator starts.
The constants PI (3.14159...) and E (2.71828...) are provided. Parameter assignment is possible, but note that all parameters will be put into the global namespace unless the :local special command is used. The function creates local variables whose names start with _, so users should avoid doing so. The variables ans (the last answer) and stack (the stack in RPN mode) may be referred to directly; stack is an array but elements of it are numeric. Various other special variables are used locally with their standard meaning, for example compcontext, match, mbegin, mend, psvar.
The output base can be initialised by passing the option ‘-#base’, for example ‘zcalc -#16’ (the ‘#’ may have to be quoted, depending on the globbing options set).
If the option ‘-e’ is set, the function runs non-interactively: the arguments are treated as expressions to be evaluated as if entered interactively line by line.
If the option ‘-f’ is set, all numbers are treated as floating point, hence for example the expression ‘3/4’ evaluates to 0.75 rather than 0. Options must appear in separate words.
If the option ‘-r’ is set, RPN (Reverse Polish Notation) mode is entered. This has various additional properties:
Evaluated values are maintained in a stack; this is contained in an array named stack with the most recent value in ${stack[1]}.
If the line entered matches an operator (+, -, *, /, **, ^, | or &) or a function supplied by the zsh/mathfunc library, the bottom element or elements of the stack are popped to use as the argument or arguments. The higher elements of stack (least recent) are used as earlier arguments. The result is then pushed into ${stack[1]}.
Other expressions are evaluated normally, printed, and added to the stack as numeric values. The syntax within expressions on a single line is normal shell arithmetic (not RPN).
If an integer follows the option -r with no space, then on every evaluation that many elements of the stack, where available, are printed instead of just the most recent result. Hence, for example, zcalc -r4 shows $stack[4] to $stack[1] each time results are printed.
The pseudo-operator = causes the most recent element of the stack to be duplicated onto the stack.
The pseudo-function pop causes the most recent element of the stack to be popped. A ‘>’ on its own has the same effect.
The expression > followed (with no space) by a shell identifier causes the most recent element of the stack to be popped and assigned to the variable with that name. The variable is local to the zcalc function.
The expression < followed (with no space) by a shell identifier causes the value of the variable with that name to be pushed onto the stack. ident may be an integer, in which case the previous result with that number (as shown before the > in the standard zcalc prompt) is put on the stack.
The pseudo-function xy causes the most recent two elements of the stack to be exchanged. ‘<>’ has the same effect.
The prompt is configurable via the parameter ZCALCPROMPT, which undergoes standard prompt expansion. The index of the current entry is stored locally in the first element of the array psvar, which can be referred to in ZCALCPROMPT as ‘%1v’. The default prompt is ‘%1v> ’.
The variable ZCALC_ACTIVE is set within the function and can be tested by nested functions; it has the value rpn if RPN mode is active, else 1.
A few special commands are available; these are introduced by a colon. For backward compatibility, the colon may be omitted for certain commands. Completion is available if compinit has been run.
The output precision may be specified within zcalc by special commands familiar from many calculators.
The default output format. It corresponds to the printf %g specification. Typically this shows six decimal digits.
Scientific notation, corresponding to the printf %g output format with the precision given by digits. This produces either fixed point or exponential notation depending on the value output.
Fixed point notation, corresponding to the printf %f output format with the precision given by digits.
Exponential notation, corresponding to the printf %E output format with the precision given by digits.
Raw output: this is the default form of the output from a math evaluation. This may show more precision than the number actually possesses.
Other special commands:
Execute line... as a normal shell command line. Note that it is executed in the context of the function, i.e. with local variables. Space is optional after :!.
Declare variables local to the function. Other variables may be used, too, but they will be taken from or put into the global scope.
Define a mathematical function or (with no body) delete it. :function may be abbreviated to :func or simply :f. The name may contain the same characters as a shell function name. The function is defined using zmathfuncdef, see below.
Note that zcalc takes care of all quoting. Hence for example:
:f cube $1 * $1 * $1
defines a function to cube the sole argument. Functions so defined, or indeed any functions defined directly or indirectly using functions -M, are available to execute by typing only the name on the line in RPN mode; this pops the appropriate number of arguments off the stack to pass to the function, i.e. 1 in the case of the example cube function. If there are optional arguments only the mandatory arguments are supplied by this means.
This is not a special command, rather part of normal arithmetic syntax; however, when this form appears on a line by itself the default output radix is set to base. Use, for example, ‘[#16]’ to display hexadecimal output preceded by an indication of the base, or ‘[##16]’ just to display the raw number in the given base. Bases themselves are always specified in decimal. ‘[#]’ restores the normal output format. Note that setting an output base suppresses floating point output; use ‘[#]’ to return to normal operation.
Print out the value of var literally; does not affect the calculation. To use the value of var, omit the leading ‘$’.
See the comments in the function for a few extra tips.
The function zmathfunc defines the three mathematical functions min, max, and sum. The functions min and max take one or more arguments. The function sum takes zero or more arguments. Arguments can be of different types (ints and floats).
Not to be confused with the zsh/mathfunc module, described in The zsh/mathfunc Module.
A convenient front end to functions -M.
With two arguments, define a mathematical function named mathfunc which can be used in any form of arithmetic evaluation. body is a mathematical expression to implement the function. It may contain references to position parameters $1, $2, ... to refer to mandatory parameters and ${1:-defvalue} ... to refer to optional parameters. Note that the forms must be strictly adhered to for the function to calculate the correct number of arguments. The implementation is held in a shell function named zsh_math_func_mathfunc; usually the user will not need to refer to the shell function directly. Any existing function of the same name is silently replaced.
With one argument, remove the mathematical function mathfunc as well as the shell function implementation.
With no arguments, list all mathfunc functions in a form suitable for restoring the definition. The functions have not necessarily been defined by zmathfuncdef.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The zsh/newuser module comes with a function to aid in configuring shell options for new users. If the module is installed, this function can also be run by hand. It is available even if the module’s default behaviour, namely running the function for a new user logging in without startup files, is inhibited.
The function presents the user with various options for customizing their initialization scripts. Currently only ~/.zshrc is handled. $ZDOTDIR/.zshrc is used instead if the parameter ZDOTDIR is set; this provides a way for the user to configure a file without altering an existing .zshrc.
By default the function exits immediately if it finds any of the files .zshenv, .zprofile, .zshrc, or .zlogin in the appropriate directory. The option -f is required in order to force the function to continue. Note this may happen even if .zshrc itself does not exist.
As currently configured, the function will exit immediately if the user has root privileges; this behaviour cannot be overridden.
Once activated, the function’s behaviour is supposed to be self-explanatory. Menus are present allowing the user to alter the value of options and parameters. Suggestions for improvements are always welcome.
When the script exits, the user is given the opportunity to save the new file or not; changes are not irreversible until this point. However, the script is careful to restrict changes to the file only to a group marked by the lines ‘# Lines configured by zsh-newuser-install’ and ‘# End of lines configured by zsh-newuser-install’. In addition, the old version of .zshrc is saved to a file with the suffix .zni appended.
If the function edits an existing .zshrc, it is up to the user to ensure that the changes made will take effect. For example, if control usually returns early from the existing .zshrc the lines will not be executed; or a later initialization file may override options or parameters, and so on. The function itself does not attempt to detect any such conflicts.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are a large number of helpful functions in the Functions/Misc directory of the zsh distribution. Most are very simple and do not require documentation here, but a few are worthy of special mention.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function initializes several associative arrays to map color names to (and from) the ANSI standard eight-color terminal codes. These are used by the prompt theme system (Prompt Themes). You seldom should need to run colors more than once.
The eight base colors are: black, red, green, yellow, blue, magenta, cyan, and white. Each of these has codes for foreground and background. In addition there are seven intensity attributes: bold, faint, standout, underline, blink, reverse, and conceal. Finally, there are seven codes used to negate attributes: none (reset all attributes to the defaults), normal (neither bold nor faint), no-standout, no-underline, no-blink, no-reverse, and no-conceal.
Some terminals do not support all combinations of colors and intensities.
The associative arrays are:
Map all the color names to their integer codes, and integer codes to the color names. The eight base names map to the foreground color codes, as do names prefixed with ‘fg-’, such as ‘fg-red’. Names prefixed with ‘bg-’, such as ‘bg-blue’, refer to the background codes. The reverse mapping from code to color yields base name for foreground codes and the bg- form for backgrounds.
Although it is a misnomer to call them ‘colors’, these arrays also map the other fourteen attributes from names to codes and codes to names.
Map the eight basic color names to ANSI terminal escape sequences that set the corresponding foreground text properties. The fg sequences change the color without changing the eight intensity attributes.
Map the eight basic color names to ANSI terminal escape sequences that set the corresponding background properties. The bg sequences change the color without changing the eight intensity attributes.
In addition, the scalar parameters reset_color and bold_color are set to the ANSI terminal escapes that turn off all attributes and turn on bold intensity, respectively.
Same as zed -f. This function does not appear in the zsh distribution, but can be created by linking zed to the name fned in some directory in your fpath.
Perform a greater-than-or-equal-to comparison of two strings having the format of a zsh version number; that is, a string of numbers and text with segments separated by dots or dashes. If the present string is not provided, $ZSH_VERSION is used. Segments are paired left-to-right in the two strings with leading non-number parts ignored. If one string has fewer segments than the other, the missing segments are considered zero.
This is useful in startup files to set options and other state that are not available in all versions of zsh.
is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS is-at-least 2.6-17 || print "You can't use is-at-least here."
This wrapper function for the nslookup command requires the zsh/zpty module (see The zsh/zpty Module). It behaves exactly like the standard nslookup except that it provides customizable prompts (including a right-side prompt) and completion of nslookup commands, host names, etc. (if you use the function-based completion system). Completion styles may be set with the context prefix ‘:completion:nslookup’.
See also the pager, prompt and rprompt styles below.
 If the option RE_MATCH_PCRE is not set, POSIX extended regular expressions are used, else Perl-compatible regular expressions (this requires the shell to be linked against the pcre library).
var is the name of the variable containing the string to be matched. The variable will be modified directly by the function. The variables MATCH, MBEGIN, MEND, match, mbegin, mend should be avoided as these are used by the regular expression code.
regexp is the regular expression to match against the string.
replace is the replacement text. This can contain parameter, command and arithmetic expressions which will be replaced: in particular, a reference to $MATCH will be replaced by the text matched by the pattern.
The return status is 0 if at least one match was performed, else 1.
This function is designed to be invoked by the run-help ZLE widget, in place of the default alias. See ‘Accessing On-Line Help’ (Utilities) for setup instructions.
In the discussion which follows, if cmd is a file system path, it is first reduced to its rightmost component (the file name).
Help is first sought by looking for a file named cmd in the directory named by the HELPDIR parameter. If no file is found, an assistant function, alias, or command named run-help-cmd is sought. If found, the assistant is executed with the rest of the current command line (everything after the command name cmd) as its arguments. When neither file nor assistant is found, the external command ‘man cmd’ is run.
An example assistant for the "ssh" command:
run-help-ssh() { emulate -LR zsh local -a args # Delete the "-l username" option zparseopts -D -E -a args l: # Delete other options, leaving: host command args=(${@:#-*}) if [[ ${#args} -lt 2 ]]; then man ssh else run-help $args[2] fi }
Several of these assistants are provided in the Functions/Misc directory. These must be autoloaded, or placed as executable scripts in your search path, in order to be found and used by run-help.
Assistant functions for the git, ip, openssl, p4, sudo, svk, and svn, commands.
Zsh was once accused of not being as complete as Emacs, because it lacked a Tetris game. This function was written to refute this vicious slander.
This function must be used as a ZLE widget:
autoload -U tetris zle -N tetris bindkey keys tetris
To start a game, execute the widget by typing the keys. Whatever command line you were editing disappears temporarily, and your keymap is also temporarily replaced by the Tetris control keys. The previous editor state is restored when you quit the game (by pressing ‘q’) or when you lose.
If you quit in the middle of a game, the next invocation of the tetris widget will continue where you left off. If you lost, it will start a new game.
This is a port of the above to zcurses. The input handling is improved a bit so that moving a block sideways doesn’t automatically advance a timestep, and the graphics use unicode block graphics.
This version does not save the game state between invocations, and is not invoked as a widget, but rather as:
autoload -U tetriscurses tetriscurses
This function has a similar purpose to GNU xargs. Instead of reading lines of arguments from the standard input, it takes them from the command line. This is useful because zsh, especially with recursive glob operators, often can construct a command line for a shell function that is longer than can be accepted by an external command.
The option list represents options of the zargs command itself, which are the same as those of xargs. The input list is the collection of strings (often file names) that become the arguments of the command, analogous to the standard input of xargs. Finally, the arg list consists of those arguments (usually options) that are passed to the command each time it runs. The arg list precedes the elements from the input list in each run. If no command is provided, then no arg list may be provided, and in that event the default command is ‘print’ with arguments ‘-r --’.
For example, to get a long ls listing of all plain files in the current directory or its subdirectories:
autoload -U zargs zargs -- **/*(.) -- ls -l
Note that ‘--’ is used both to mark the end of the option list and to mark the end of the input list, so it must appear twice whenever the input list may be empty. If there is guaranteed to be at least one input and the first input does not begin with a ‘-’, then the first ‘--’ may be omitted.
In the event that the string ‘--’ is or may be an input, the -e option may be used to change the end-of-inputs marker. Note that this does not change the end-of-options marker. For example, to use ‘..’ as the marker:
zargs -e.. -- **/*(.) .. ls -l
This is a good choice in that example because no plain file can be named ‘..’, but the best end-marker depends on the circumstances.
The options -i, -I, -l, -L, and -n differ slightly from their usage in xargs. There are no input lines for zargs to count, so -l and -L count through the input list, and -n counts the number of arguments passed to each execution of command, including any arg list. Also, any time -i or -I is used, each input is processed separately as if by ‘-L 1’.
For details of the other zargs options, see man page xargs(1) (but note the difference in function between zargs and xargs) or run zargs with the --help option.
This function uses the ZLE editor to edit a file or function.
Only one name argument is allowed. If the -f option is given, the name is taken to be that of a function; if the function is marked for autoloading, zed searches for it in the fpath and loads it. Note that functions edited this way are installed into the current shell, but not written back to the autoload file. In this case the -x option specifies that leading tabs indenting the function according to syntax should be converted into the given number of spaces; ‘-x 2’ is consistent with the layout of functions distributed with the shell.
Without -f, name is the path name of the file to edit, which need not exist; it is created on write, if necessary.
While editing, the function sets the main keymap to zed and the vi command keymap to zed-vicmd. These will be copied from the existing main and vicmd keymaps if they do not exist the first time zed is run. They can be used to provide special key bindings used only in zed.
If it creates the keymap, zed rebinds the return key to insert a line break and ‘^X^W’ to accept the edit in the zed keymap, and binds ‘ZZ’ to accept the edit in the zed-vicmd keymap.
The bindings alone can be installed by running ‘zed -b’. This is suitable for putting into a startup file. Note that, if rerun, this will overwrite the existing zed and zed-vicmd keymaps.
Completion is available, and styles may be set with the context prefix ‘:completion:zed’.
A zle widget zed-set-file-name is available. This can be called by name from within zed using ‘\ex zed-set-file-name’ (note, however, that because of zed’s rebindings you will have to type ^j at the end instead of the return key), or can be bound to a key in either of the zed or zed-vicmd keymaps after ‘zed -b’ has been run. When the widget is called, it prompts for a new name for the file being edited. When zed exits the file will be written under that name and the original file will be left alone. The widget has no effect with ‘zed -f’.
While zed-set-file-name is running, zed uses the keymap zed-normal-keymap, which is linked from the main keymap in effect at the time zed initialised its bindings. (This is to make the return key operate normally.) The result is that if the main keymap has been changed, the widget won’t notice. This is not a concern for most users.
Same as zmv -C and zmv -L, respectively. These functions do not appear in the zsh distribution, but can be created by linking zmv to the names zcp and zln in some directory in your fpath.
See ‘Keyboard Definition’ (Utilities).
Move (usually, rename) files matching the pattern srcpat to corresponding files having names of the form given by dest, where srcpat contains parentheses surrounding patterns which will be replaced in turn by $1, $2, ... in dest. For example,
zmv '(*).lis' '$1.txt'
renames ‘foo.lis’ to ‘foo.txt’, ‘my.old.stuff.lis’ to ‘my.old.stuff.txt’, and so on.
The pattern is always treated as an EXTENDED_GLOB pattern. Any file whose name is not changed by the substitution is simply ignored. Any error (a substitution resulted in an empty string, two substitutions gave the same result, the destination was an existing regular file and -f was not given) causes the entire function to abort without doing anything.
In addition to pattern replacement, the variable $f can be referrred to in the second (replacement) argument. This makes it possible to use variable substitution to alter the argument; see examples below.
Options:
Force overwriting of destination files. Not currently passed down to the mv/cp/ln command due to vagaries of implementations (but you can use -o-f to do that).
Interactive: show each line to be executed and ask the user whether to execute it. ‘Y’ or ‘y’ will execute it, anything else will skip it. Note that you just need to type one character.
No execution: print what would happen, but don’t do it.
Turn bare glob qualifiers off: now assumed by default, so this has no effect.
Force bare glob qualifiers on. Don’t turn this on unless you are actually using glob qualifiers in a pattern.
Symbolic, passed down to ln; only works with -L.
Verbose: print each command as it’s being executed.
Pick out wildcard parts of the pattern, as described above, and implicitly add parentheses for referring to them.
Just like -w, with the addition of turning wildcards in the replacement pattern into sequential ${1} .. ${N} references.
Force cp, ln or mv, respectively, regardless of the name of the function.
Call program instead of cp, ln or mv. Whatever it does, it should at least understand the form
program -- oldname newname
where oldname and newname are filenames generated by zmv. program will be split into words, so might be e.g. the name of an archive tool plus a copy or rename subcommand.
As -p program, except that program does not accept a following -- to indicate the end of options. In this case filenames must already be in a sane form for the program in question.
The optstring is split into words and passed down verbatim to the cp, ln or mv command called to perform the work. It should probably begin with a ‘-’.
Further examples:
zmv -v '(* *)' '${1// /_}'
For any file in the current directory with at least one space in the name, replace every space by an underscore and display the commands executed.
zmv -v '* *' '${f// /_}'
This does exactly the same by referring to the file name stored in $f.
For more complete examples and other implementation details, see the zmv source file, usually located in one of the directories named in your fpath, or in Functions/Misc/zmv in the zsh distribution.
See ‘Recompiling Functions’ (Utilities).
This makes defining styles a bit simpler by using a single ‘+’ as a special token that allows you to append a context name to the previously used context name. Like this:
zstyle+ ':foo:bar' style1 value1 \ +':baz' style2 value2 \ +':frob' style3 value3
This defines style1 with value1 for the context :foo:bar as usual, but it also defines style2 with value2 for the context :foo:bar:baz and style3 with value3 for :foo:bar:frob. Any subcontext may be the empty string to re-use the first context unchanged.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The zed function sets this style in context ‘:completion:zed:*’ to turn off completion when TAB is typed at the beginning of a line. You may override this by setting your own value for this context and style.
The nslookup function looks up this style in the context ‘:nslookup’ to determine the program used to display output that does not fit on a single screen.
The nslookup function looks up this style in the context ‘:nslookup’ to set the prompt and the right-side prompt, respectively. The usual expansions for the PS1 and RPS1 parameters may be used (see Prompt Expansion).
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 26, 2019 using texi2html 5.0.
Zsh version 5.7.1, released on February 3, 2019.


Introduction
Reddit is a huge, global forum where any kind of topic can be discussed, and so is Open Access. It seems like the perfect source for debate for many reasons, and not only because of its daily activity. For example the average user is aged 25 to 34, a perfect profile as it is possible this hypothetical user already has a major degree but is still young enough to have widely explored the field and the innovations in it; also, Reddit has no censorship at all: despite many redditors are certified users, they are not supposed to maintain a certain etiquette and discussion is never too formal. Last but not least, Reddit is deeply involved into internet openness, being an open-source website and founded by huge Open Access activist Aaron Swartz.


Here is one of those occasional Hooting Yard music playlists. All these pieces come recommended by the bloated janitor. He may be an unapologetic Blunkettite, but he knows his musical onions, apparently.
Hammond Song, The Roches
Two-Headed Boy, Neutral Milk Hotel
Manolete, Weather Report
Plastic Factory, Captain Beefheart & The Magic Band
The Old Man's Back Again, Scott Walker
Misumo Bo Tamo She, King Bruce & Black Beats
O'er The Hills, Martin Carthy
Jackie And Edna, Kevin Coyne
Born Secular, Jenny Lewis & The Watson Twins
In Love, The Raincoats


10 things to know about new FIRS chairman, Muhammad Nami
by Sodiq OyelekeSodiq Oyeleke
President Muhammadu Buhari on Monday nominated Muhammad Nami as the new chairman of the Federal Inland Revenue Service.
Subject to Senate confirmation, Nami is expected to replace Mr. Babatunde Fowler, whose tenure expired on Monday, December 9, 2019.
Meanwhile, here are 10 things to know about Nami:
1. Nami attended Bayero University Kano and Ahmadu Bello University, Zaria, where he obtained a Bachelor’s Degree in Sociology (1991) and a Master of Business (2004) respectively.
2. He started his career with PKF Nigeria Professional Services in 1993 and rose to the position of a senior consultant in charge of tax management and advisory services.
3. He is currently the managing consultant of Manam Professional Services (Chartered Tax Practitioners and Business Advisers) based in Kaduna and Niger states, as well as Abuja.
4. He is a fellow of Chartered Institute of Taxation of Nigeria, Institute of Debt Recovery Practitioners of Nigeria and Associate Member of Nigerian Institute of Management (Chartered) and Association of National Accountants of Nigeria.
5. Nami is trained in tax, accounting and management, with highly rated qualifications and professional practice and licenses from relevant professional bodies.
6. He has almost three decades of practical working experience in auditing, tax management and advisory, and management services to clients in the banking, manufacturing, services and public sectors as well as non- profit organisations.
7. He is an expert in rendering advisory support services to investors in respect of new business start-ups and management of existing businesses. He has also continuously rendered outsourced services to clients in trade, service and manufacturing sectors of the nation’s economy.
8. Nami has served, and is still serving, on many companies’ boards, including the Statutory Board Audit Committees.
9. He was appointed as member, Presidential Committee on Audit of Recovered Stolen Assets in November 2017 by President Buhari.
10. He is married with children.
Source: Twitter @GarShehu


Comment: Cherry tomatoes can also be grown in pots or tubs. Select the variety based on the size of your container. The pot needs to be at least 30 centimeters wide and 30 centimeters deep. To keep the soil evenly moist, check it daily.


To begin, we retrieve historical data for researching.
QuantBook
.qb = QuantBook()
assets = ["EURUSD", "GBPUSD", "USDCAD", "USDHKD", "USDJPY"]
AddForex
method with the tickers, and their corresponding resolution. Then store their Symbol
s.for i in range(len(assets)): qb.AddForex(assets[i],Resolution.Minute)
If you do not pass a resolution argument, Resolution.Minute
is used by default.
History
method with qb.Securities.Keys
for all tickers, time argument(s), and resolution to request historical data for the symbol.history = qb.History(qb.Securities.Keys, datetime(2021, 1, 1), datetime(2021, 12, 31), Resolution.Daily)


Toggle navigation
Brand
Electronics
Mobiles
Laptops
PC's
Fashion
Apparel
Jewellery
FootWear
Household
Files
Storage
Equipments
Submit
Sign Up
Sign in
Email address
Password
Remember me
Sign in


Home
(current)
Request a Quote
About Us
Tony Tamalunas, Gen. Mgr. :<PHONE_NUMBER><EMAIL_ADDRESS>Licensed California Contractor # 976962


Candidate Information
Name:
*
Password:
*
Phone Number:
*
Gender:
*
Male
Female
Date of Birth
*
Email:
*
Highest Qualification:
*
Select highest qualification
B.Tech
M.Tech
MBA
MCA
MSC
MA
BSC
Course interested in:
*
JAVA
HTML5
CSS3
AngularJS
JQuery
Comments(Mention External Certification if any):
Upload Degree/ External Certificates:
*
All fields marked(*) are mandatory


Every other month, we give students an argumentative writing prompt which is then scored against a standard rubric. One of our school goals is to improve the quality of writing from our students, so we teach them not only the content, but how to make a good argument. Using things like facts along with application and persuasive writing techniques all blend into one piece.
With each prompt, students see the scoring rubric beforehand and then receive that back with their writing so they can see what needs to improve. I have a few (mostly organizational) problems with this:
I have wanted to try some of the New Visions CloudLabs add-ons for Google Docs for a long time, but didn’t have a real need to. So, I dove into autoCrat because I knew it could take form data and push it over to a sharable and printable Google doc. It worked great, but it generates a separate doc for each student, which isn’t something I want to manage (I know I could use Doctopus in conjunction to make it easier, but I’m not at that point yet). What I really wanted was something to add new entries as a table to a class-level document. I could print those out, cut them into slips, and distribute.
Karl Lindgren-Streicher to the rescue.
@bennettscience Check out docappender. That might do what you want to do.
— Karl LS (@LS_Karl) February 5, 2015
docappender was definitely what I needed.
In my Drive, I created a folder with six empty documents simply labeled with the class hour. Then, I created a Form I could use to add the student’s name, their class hour, their score, and some comments.
docappender works by looking at your form for an identifying field (for me, class hour) and then finds the matching document in your folder.
Each time I submit a new score, the script runs and pops out a formatted rubric for the student. It’s great.
Now, I can have a class set of rubrics for students to use while writing, they can write on the back of the prompt (cut my paper use by 2/3), and they get a typed scoresheet back. I also have a digital record, so no keeping track of these papers.
We’re not one to one or GAFE right now, so I don’t worry about sharing with students. If we head that direction, you could easily go paperless using some of the other New Visions add-ons in conjunction with one another.
Written on February 5th, 2015 by Brian Bennett Categorized in: All Teaching Technology
Leave a comment


Toggle navigation
PEG
Source
/* * Classic example grammar, which recognizes simple arithmetic expressions like * "2*(3+4)". The parser generated from this grammar then computes their value. */ start = additive additive = left:multiplicative "+" right:additive { return left + right; } / multiplicative multiplicative = left:primary "*" right:multiplicative { return left * right; } / primary primary = integer / "(" additive:additive ")" { return additive; } integer "integer" = digits:[0-9]+ { return parseInt(digits.join(""), 10); } letter = [a-z]+
Tokenize Basic
Tokens
l
value
id


Several packages have been used to add vector gis support to Repast. These are most notably Geotools and Java Topology Suite These provide the back and middle end support for the types of operations needed for gis. JTS implements the Simple Features Specification from the OpenGis Consortium, and Geotools provides data handling (the full geotools package includes much more). Repast's gis tools are basically adapters between these toolkits and the Repast toolkit.
Gis Philosophy These adapters take the philosophy that gis features can be represented as pieces of a network. A Point can be represented as a node, a polygon can be represented as a node and a linestring can be represented as an edge. So each of these feature types (as well as its "multi" counterpart) have the methods from those types in Repast as well as the basic geographic functions.
Use In order to create a gis space in Repast, you need to create a Geotools datasource. There are several including shapefile, postgis, and gml. More are being added daily. For an updated view on what's available check out the Geotools website . The simplest one is the ShapefileDataSource. To create one, you just need a shape file. It can either be a set of individual files or a zip file.
So:
ShapefileDataSource = new ShapefileDataSource(new
URL("file:///home/thowe/data/tomszips");
This would create a DataSource from the directory:
/home /thowe /data tomszips.shp tomszips.dbf tomszips.shx or /home /thowe /data tomszips.zip
Once you have the datasource, use the DataSourceHandler to extract the features.
Feature[] f = ShapeFileHandler.getFeatures(datasource);
You then create RepastGisFeatures from these. Each of the features has a constructor for Feature, so it's quite easy:
DrawablePolygon p = new DrawablePolygon(f[0]);
The next step is to add these features to a GisLayer. This is very similar to a layer in other gis contexts. It is a set of features which are connected (semantically, not necessarily physically).
GisLayer layer = new GisLayer(LayerType.POLYGON); layer.add(p);
At this point you have a complete layer of features. At this point, you could either just work with the data as it is, or add things such as neighborhooders. This allows you to easily solve the nearest neighbor problem. At the moment, the only neighborhooder we have for gis is Delaunay Triangulation, but others will follow. Of course, you could also use distance between features to solve the nearest neighbor problem.
Display
To display vector gis, you need to create a GisDisplay and add
Displayable features to it.
GisDisplay display = new GisDisplay(300); display.addLayer(layer);
At this point, your display works just like any other Repast Display. Note that the constructor for GisDisplay only takes one Argument. This is because the y value for the size is scaled based on the x value.


New risk factor of Diabetes 2 revealed
Globally, around 463 million adults lived with diabetes in 2019, according to the International Diabetes Federation (IDF). In 2015, approximately 9% of all adults had the condition.
Diabetes is a condition where sugar or glucose builds up in the bloodstream instead of being absorbed into cells. This occurs when cells either lose their ability to produce the hormone insulin or, in type 2 diabetes, they develop insulin resistance and are unable to use it productively.
Over the years, researchers discovered certain factors increase the risk of developing type 2 diabetes. These potential risk factors include alcohol consumption, skipping breakfast, daytime napping, anxiety disorders, urinary sodium, certain amino acids and inflammatory factors, and lack of sleep.
A new study that appears in the journal Diabetologia identifies 19 risk factors for type 2 diabetes. The Sweden-based researchers further evaluated 21 risk factors that have scarce evidence, and another 15 that reduce the risk of the condition.


This will be visible only in the dark theme.
This, on the other hand, will only be visible in the light theme.


Assisting in developing statements and communicating with a Learning Record Store (LRS)
LRS Basic Auth Setup
Endpoint:
Username:
Password:
Query Options
Who
Actor
Did
Verb
What
Activity
relatedActivities
When
untilDate
sinceDate
Where
relatedAgents
statementId
ABOUT
This tools help generate valid statement and demonstrates various interactions with an LRS. Feel free to contact me for help, Email<EMAIL_ADDRESS>.


Coastal Inundation Forecast Demostration Project (CIFDP)
High Resolution
Inundation
Forecast
Cuvu
Korotogo
Maui Bay
Komave
Cuvu:
Water Length
Site 1
Site 2
Site 3
Komave:
Water Length
Site 1
Site 2
Site 3
Korotogo:
Water Length
Site 1
Site 2
Site 3
Maui Bay:
Water Length
Site 1
© 2021 Geoscience, Energy and Maritime Division, Pacific Community (SPC)


Views over Fragments - Fragments are good in theory, but not in practice. As explained here Fragment transition state errors are notoriously difficult to debug. Views are simpler with fewer lifecycle methods; anything you want to use a Fragment for can be done with Views instead, because Views have been around since the beginning (Fragments were added later). A few components are easier with Fragments, like DialogFragments and ViewPager, only because the default implementations take care of UI interactions smoothly.
Crash fast: Square’s approach to Android crashes
Singletons - The Singleton pattern is everywhere in the Android framework. Any libraries you use will likely keep around a Singleton instance. They’re super useful. Here’s an implementation example.
Careful using Async Tasks - Sometimes you need long-running operations to be done in the background, so as not to block the UI thread. Just make sure that you gracefully handle the cases when the task returns and the calling Activity doesn’t exist anymore, or the app has backgrounded, or when the task just fails (perhaps because it lost internet connection). Finally blocks are useful in these cases.
Memory Leaks -Try not to pass around Contexts. When you have to, make sure references to the Context aren’t kept around; otherwise, it can’t be garbage collected. Here’s a talk on common memory leak pitfalls, and using memory analyzer tools to debug memory leaks.
Edit July 4th - LeakCanary is amazing.


Console output should be:
starting aVendor starting bVendor starting script 1 called a vendor method called b vendor method starting script 2 called a vendor method called b vendor method


Many applications have a mix of plain HTML and dynamic pages (be it JSP, Facelets, etc.) While in dynamic pages you use a tag library to import your bundles, that is not feasible with plain HTML pages for obvious reasons. While you could link to the resources with regular links, this would be bad for two reasons: first, you lose all the compression and bundling abilities of Jawr, and second, you will load scripts that are probably part of a bundle, so when a user goes visits a dynamic page he will not have any script in cache, losing efficiency.
To solve this problem Jawr provides a way to still use all of its features in plain HTML pages. The mechanism is very simple: you add a link to a special script named /jawr_loader.js and use it to add bundles just like you would with the tag library. This script contains the mappings of all the bundles and also several methods you invoke to add links to the page.
For example, imagine you have a JSP with the following tags:
<jwr:style src="/bundles/all.css" /> <jwr:script src="/bundles/global.js"/>
To add the same bundles to a plain HTML page, you would include the following code in the document HEAD section:
<script type="text/javascript" src="./jawr_loader.js" ></script> <script> JAWR.loader.style('/bundles/all.css'); JAWR.loader.script('/bundles/global.js'); </script>
As you can see, first we include the link to the jawr_loader.js script. Note that the link needs to change according to the relative location of the page within the application. Also, if the Jawr servlet is mapped to something like ‘/jawr/*’ instead of directly attending all .js requests, you will have to modify the URL accordingly (i.e. ‘./jawr/jawr_loader.js’ for instance).
After including the script, there is an inline script where the actual bundles are included using to methods provided by Jawr. These act exactly like the JSP tag libraries. This means that the links they will generate are consistent to the ones a user will find in your JSP pages, so the browser cache will come into play as it should.
If you only plan to use global bundles in a page, you can skip the inline script and just go with the link to jawr_loader .js, since said script will already add all the global bundles.
JAWR.loader.script receives a single parameter, which is either the name of a bundle or the name of a script belonging to a bundle. In either case, the resulting link will be the same.
JAWR.loader.script('/bundles/global.js'); JAWR.loader.script('/js/aMemberOfSomeBundle.js');
JAWR.loader.style has a first parameter with the same effect as in the script function, plus an optional ‘media’ parameter which will set the media attribute in the style link. If not provided, the media attribute is set to screen.
JAWR.loader.style('/bundles/all.css'); JAWR.loader.style('/bundles/all_print.css' 'print');
Note that these functions are meant to be invoked while the page is loading (document.write is used). In the future an on-demand includer version will be available, but for now dont’ try to invoke these functions after the page has loaded.
There is a penalty in using this technique: an additional script is included in every page. The loader script is itself small in size (although this will vary according to the number of scripts in your app). A worst case scenario yielded a 14Kb size, with 4-6Kb being a more normal size. Of course the script is minified and gzipped according to configuration, so the final size the client receives will be notably smaller (3-5Kb at worst). Even so, this should still reduce the total number of imported scripts and its size. Also, all the imported resources remain in cache so when the user visits a JSP that uses the same ones, the page will load really fast.


screen -S kmdtest
gdb --args ~/source/LABS/src/komodod -ac_name=LABS -ac_supply=350689 -ac_reward=0,0,800000000 -ac_decay=0,100000000,100000000 -ac_halving=129,1 -ac_end=128,10080,0 -ac_notarypay=64,100000000,1000000000 -ac_eras=3 -ac_staked=51 -ac_sapling=1 -ac_cc=101 -ac_ccenable=226,236 -ac_cclib=labs -addnode=<IP_ADDRESS> -addnode=<IP_ADDRESS> -daemon
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/wallets/source/LABS/src/komodod...done.


{{table.name}}
{{table.subject}}
Choose what media you would like to share:
{{the_user}}
{{peer.username}}


--- layout: default --- Resources Here you can find resources that our members have found useful. Unless otherwise stated, they're all free and available online. If you've found something great that you think should be on this list, either tweet us, send us an email or make a pull request and add it in. General Resources HTML/CSS JavaScript Python Ruby/Ruby on Rails
Here you can find resources that our members have found useful. Unless otherwise stated, they're all free and available online.
If you've found something great that you think should be on this list, either tweet us, send us an email or make a pull request and add it in.


| MPI_WIN_LOCK(lock_type, rank, assert, win) | |
| IN lock_type | either MPI_LOCK_EXCLUSIVE or MPI_LOCK_SHARED (state) |
| IN rank | rank of locked window (non-negative integer) |
| IN assert | program assertion (integer) |
| IN win | window object (handle) |
int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win)
MPI_Win_lock(lock_type, rank, assert, win, ierror)
INTEGER, INTENT(IN) :: lock_type, rank, assert
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_LOCK(LOCK_TYPE, RANK, ASSERT, WIN, IERROR)
INTEGER LOCK_TYPE, RANK, ASSERT, WIN, IERROR
Starts an RMA access epoch. The window at the process with rank rank can be accessed by RMA operations on win during that epoch. Multiple RMA access epochs (with calls to MPI_WIN_LOCK) can occur simultaneously; however, each access epoch must target a different process.
| MPI_WIN_LOCK_ALL(assert, win) | |
| IN assert | program assertion (integer) |
| IN win | window object (handle) |
int MPI_Win_lock_all(int assert, MPI_Win win)
MPI_Win_lock_all(assert, win, ierror)
INTEGER, INTENT(IN) :: assert
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_LOCK_ALL(ASSERT, WIN, IERROR)
INTEGER ASSERT, WIN, IERROR
Starts an RMA access epoch to all processes in win, with a lock type of MPI_LOCK_SHARED. During the epoch, the calling process can access the window memory on all processes in win by using RMA operations. A window locked with MPI_WIN_LOCK_ALL must be unlocked with MPI_WIN_UNLOCK_ALL. This routine is not collective --- the ALL refers to a lock on all members of the group of the window.
Advice to users.
There may be additional overheads associated with using
MPI_WIN_LOCK and MPI_WIN_LOCK_ALL concurrently
on the same window. These overheads could be avoided by specifying the
assertion MPI_MODE_NOCHECK when possible (see
Section Assertions
).
( End of advice to users.)
| MPI_WIN_UNLOCK(rank, win) | |
| IN rank | rank of window (non-negative integer) |
| IN win | window object (handle) |
int MPI_Win_unlock(int rank, MPI_Win win)
MPI_Win_unlock(rank, win, ierror)
INTEGER, INTENT(IN) :: rank
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_UNLOCK(RANK, WIN, IERROR)
INTEGER RANK, WIN, IERROR
Completes an RMA access epoch started by a call to MPI_WIN_LOCK on window win. RMA operations issued during this period will have completed both at the origin and at the target when the call returns.
| MPI_WIN_UNLOCK_ALL(win) | |
| IN win | window object (handle) |
int MPI_Win_unlock_all(MPI_Win win)
MPI_Win_unlock_all(win, ierror)
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_UNLOCK_ALL(WIN, IERROR)
INTEGER WIN, IERROR
Completes a shared RMA access epoch started by a call to MPI_WIN_LOCK_ALL on window win. RMA operations issued during this epoch will have completed both at the origin and at the target when the call returns.
Locks are used to protect accesses to the locked target window effected by RMA calls issued between the lock and unlock calls, and to protect load/store accesses to a locked local or shared memory window executed between the lock and unlock calls. Accesses that are protected by an exclusive lock will not be concurrent at the window site with other accesses to the same window that are lock protected. Accesses that are protected by a shared lock will not be concurrent at the window site with accesses protected by an exclusive lock to the same window.
It is erroneous to have a window locked and exposed (in an exposure epoch) concurrently. For example, a process may not call MPI_WIN_LOCK to lock a target window if the target process has called MPI_WIN_POST and has not yet called MPI_WIN_WAIT; it is erroneous to call MPI_WIN_POST while the local window is locked.
Rationale.
An alternative is to require MPI to enforce mutual exclusion between exposure epochs and locking periods. But this would entail additional
overheads when locks or active target synchronization do not interact
in support of those rare interactions between the two mechanisms. The
programming style that we encourage here is that a set of windows is
used with only one synchronization mechanism at a time, with shifts
from one mechanism to another being rare and involving global synchronization.
( End of rationale.)
Advice to users.
Users need to use explicit synchronization code in order to enforce
mutual exclusion between locking periods and exposure epochs on a
window.
( End of advice to users.)
Implementors may restrict the use of RMA communication that is
synchronized by lock calls to windows in memory allocated by
MPI_ALLOC_MEM
(Section Memory Allocation
),
MPI_WIN_ALLOCATE (Section Window That Allocates Memory
), or attached with
MPI_WIN_ATTACH (Section Window of Dynamically Attached Memory
).
Locks can be used portably only in such memory.
Rationale.
The implementation of passive target communication when memory is not shared may require an asynchronous software agent. Such an agent can be implemented more easily, and can achieve better performance, if restricted to specially allocated memory. It can be avoided altogether if shared memory is used. It seems natural to impose restrictions that allows one to use shared memory for third party communication in shared memory machines.
( End of rationale.)
Consider the sequence of calls in the example below.
Example
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, assert, win); MPI_Put(..., rank, ..., win); MPI_Win_unlock(rank, win);
The call to MPI_WIN_UNLOCK will not return until the put transfer has completed at the origin and at the target. This still leaves much freedom to implementors. The call to MPI_WIN_LOCK may block until an exclusive lock on the window is acquired; or, the first two calls may not block, while MPI_WIN_UNLOCK blocks until a lock is acquired --- the update of the target window is then postponed until the call to MPI_WIN_UNLOCK occurs. However, if the call to MPI_WIN_LOCK is used to lock a local window, then the call must block until the lock is acquired, since the lock may protect local load/store accesses to the window issued after the lock call returns.


Hello,
this is a test email sent to {{EMAIL_ADDRESS}}.
This email was sent with
WP Mail Helper
package.


Below, please think of the populations you serve (e.g. mothers, infants, homeless etc.) You will be asked several questions regarding each population you serve.


{{ self.title }}
-
{% for gallery_image in images %}
{% image gallery_image width-1200 as gallery_imagedata %}
- {% endfor %}
No images are tagged with your {{ self.title }} gallery or no {{ self.title }} tags defined.
{% endif %}


Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits.
Dramatically visualize customer directed convergence without revolutionary ROI.
Dramatically visualize customer directed convergence without revolutionary ROI.
Completely synergize resource taxing relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas.
Dynamically innovate resource-leveling customer service for state of the art customer service.
Dynamically innovate resource-leveling customer service for state of the art customer service.


Welcome to 101Exercises.com
Solving these exercises will help make you a better programmer.
101 Exercises in JavaScript
101 Exercises in Python


This span should be have a width of 200px. This
should follow up in one line & should not use any width, but we are not allowed to remove it either...


| Package | org.computus.star.time.core |
| Class | public class Instant |
| Inheritance | Instant flash.events.EventDispatcher |
| Property | Defined by | ||
|---|---|---|---|
| time : Number
The total number of millieconds before or after the standard epoch (1.1.1970).
| Instant |
| Method | Defined by | ||
|---|---|---|---|
|
Instant(... args)
Creates a new instance of the Instant() class.
| Instant | ||
|
destroy():void
Removes all listeners and prepares the class for disposal.
| Instant | ||
|
now():Number
[static]
Static function to retreive the current time.
| Instant | ||
|
parse(dateString:String):Number
[static]
Static function to parse a date string into a number.
| Instant | ||
|
toString():String
Function to obtain a string representation of the Instant.
| Instant | ||
|
valueOf():Number
Function to obtain the core value of the Instant.
| Instant |
| time | property |
time:Number
[read-write]
The total number of millieconds before or after the standard epoch (1.1.1970).
This property is polymorphic with the AS3 Date class.
Changing the value of time will broadcast a Event.CHANGE
event.
public function get time():Number
public function set time(value:Number):void
See also
| Instant | () | constructor |
public function Instant(... args)
Creates a new instance of the Instant() class.
The follow parameters are accepted by the constructor:
| Instant() | sets time to the current date and time. |
|---|---|
| Instant( ms:Number ) | sets time to the value passed in the constructor. |
| Instant( d:Date ) | sets time to the value of the AS3 Date passed in the constructor. |
| Instant( d:Instant ) | sets time to the value of the Instant passed in the constructor. |
... args |
| destroy | () | method |
public function destroy():void
Removes all listeners and prepares the class for disposal.
| now | () | method |
public static function now():Number
Static function to retreive the current time.
ReturnsNumber — the current time in millieconds.
|
| parse | () | method |
public static function parse(dateString:String):Number
Static function to parse a date string into a number.
ParametersdateString:String — a validly formatted date string.
|
Number — the value as a number in millieconds.
|
| toString | () | method |
public override function toString():String
Function to obtain a string representation of the Instant. This function is polymorphic with the AS3 Date class.
ReturnsString — the value as a string.
|
| valueOf | () | method |
public function valueOf():Number
Function to obtain the core value of the Instant. This function is polymorphic with the AS3 Date class.
ReturnsNumber — the value in millieconds.
|


Donald Trump
Résumé
— I'm the most successful person ever to run for the presidency, by far. Nobody's ever been more successful than me. I'm the most successful person ever to run. Ross Perot isn't successful like me. Romney — I have a Gucci store that's worth more than Romney. Sorry losers and haters, but my IQ is one of the highest ― and you all know it!
*I feel like the right bottom corner of The Political Compass a.k.a libertarian right.
Experience
-
Recent⌚
-
2017
Became 45th president of the United States 💪
-
2016
Won election race with 77 votes more than Clinton, yippe-kee-yay! 🎉
-
2015
Became the most important Republican nominating for presidential election run 🤩
-
2009
Changed my mind and became Republican again😇
-
2005
Started Trump University with Michael Sexton and Jonathan Spitalny: no grades, certificates and other bureaucracy, but program offered courses in real estate, asset management entrepreneurship, and wealth creation. 98% students gave positive reviews while studying, however some of these ungrateful gringos filed lawsuits against Trump University after the course. I had to pay $25 million to settle that... 😢
-
-
2002
Acquired the former Hotel Delmonico, which was renovated and reopened in 2004 as the Trump Park Avenue. I sure do like my surname! 🏨
-
2001
Completed Trump World Tower and joined the Democratic Party 💪
-
1999
Started buying golf courses 🏌♂. They are very cheap, I have 18 of them now in USA and abroad! Also switched to the Reform Party that year
-
1997
Began a multi-building development along the Hudson River, which was named Trump Place. Me and the other investors sold our shares for $1.8 billion 🤑 and that was then the biggest residential sale in the history of New York City
-
1996
Acquired the Bank of Manhattan Trust Building 🏦 , which was a vacant seventy-one story skyscraper on Wall Street. After an extensive renovation, the high-rise was renamed the Trump Building
-
1994
Refurbished the Gulf and Western Building on Columbus Circle, turned it into a 44-story luxury property known as Trump International Hotel and Tower 🏨
-
1989 ― 1992
Ran a second hand airline ✈ called Trump Shuttle. What a waste of money, I had to sell it, now it is American Airlines Shuttle, btw
-
1989, 1990
Learned about Tour de France and decided to hold my very own Tour de Trump 🚲. Is America not great enough for that cycling competition?
-
1988
Acquired the Plaza Hotel in Manhattan for $407 million, invested $50 million to restore the building and boosted it from three-star to four-star hotel (I called it "the Mona Lisa" and sold it for a lot of cash in 1995)🏨
-
1987
Registered as a Republican 🤓
-
1985
I bought the Mar-a-Lago estate in Palm Beach and turned it into a private club. You can join if you pay $200K initiation fee (and there is another annual fee for members, it is very expensive to be rich). That year I also opened a casino called Trump Castle. My wife Ivana became a manager, because she is another Trump! 🤩
-
1983
I purchased New Jersey Generals, an American football 🏈 team. I changed team's play schedule and filed an antitrust lawsuit against United States Football League, so NJG are not doing so good now, but back then they were great!
-
1980
Started developing the Trump Tower skyscraper 🏨 in Manhattan, I payed a crew of undocumented Polish workers to demolish the historic Bonwit Teller store, including art deco features. All this to make architectural critic Paul Goldberger say in 1983 that the tower's atrium is "the most pleasant interior public space to be completed in New York in some years". At the same time I also started a repair job on the Wollman Rink in Central Park and completed the work in three months for $1.95 million, which was $775,000 less than the initial budget!
-
1978
Purchased a 50 percent stake in the derelict Commodore Hotel and turned it into the Grand Hyatt Hotel in 2 years of remodeling 🏨
-
1971
Was promoted to president of the company and renamed it The Trump Organization 💪
-
1968
Began my career at my father's real estate 🏨 development company, Elizabeth Trump & Son
-
Personal Life
-
Recent⌚
-
2006
Melania gained United States citizenship and gave birth to our son, Barron👶
-
2005
Married her💍
-
1998
Met my future third wife, Melania Knauss 💘
-
1999
Divorced Marla 😃
-
-
1993
Married Marla and had a daughter, we named her Tiffany👶, because I like Tiffany & Company jewellery as well
-
1992
Started affair with Marla Maples, so I had to divorce. God knows I love nice women, I love them all!💖
-
1984
Birth of Eric Trump👶
-
1982
Birth of Ivanka Trump👶
-
1977
My first son is born👶. I called him Donald, of course!
-
1977
Married Czech model Ivana Zelníčková ❤
-
MEDIA CAREER
-
Recent⌚
-
2019
Was awarded Worst Actor and Worst Screen Combo at Golden Raspberry Awards ⭐ for parts in "Death of a Nation" and "Fahrenheit 11/9"
-
2015
Published a book 📕 "Crippled America: How to Make America Great Again"
-
2011
Published a book 📕 "Time to Get Tough: Making America #1 Again" in coauthorship with Wynton Hall, Peter Schweizer and Meredith McIver
-
2011
Published a book 📕"Trump Tower" in coauthorship with Jeffrey Robinson
-
2011
Published a book 📕"Midas Touch: Why Some Entrepreneurs Get Rich – And Why Most Don't" in coauthorship with Robert Kiyosaki
-
-
2009
Published a book 📕 "Think Like a Champion: An Informal Education in Business and Life" in coauthorship with Meredith McIver
-
2008
Published a book 📕 "Never Give Up: How I Turned My Biggest Challenges into Success" in coauthorship with Meredith McIver
-
2007
Published a book 📕 "Think Big and Kick Ass" in coauthorship with Bill Zanker
-
2007
Received a star ⭐ on the Hollywood Walk of Fame for being producer of Miss Universe pageant
-
2006
Published a book 📕 "Why We Want You to Be Rich" in coauthorship with Meredith McIver and Robert Kiyosaki
-
2006
Published a book 📕 "How to Build a Fortune: Your Plan for Success From the World's Most Famous Businessman"
-
2006
Published a book 📕 "The Best Real Estate Advice I Ever Received: 100 Top Experts Share Their Strategies"
-
2006
Published a book 📕 "Trump 101: The Way to Success" in coauthorship with Meredith McIver
-
2005
Published a book 📕 "The Best Golf Advice I Ever Received"
-
2005
Performed a song 🎤with Megan Mullally at the 57th Primetime Emmy Awards
-
2004 ― 2008
Ran short-form talk radio program 📺"Trumped!" (one to two minutes on weekdays)
-
2004
Published a book 📕 "Trump: How to Get Rich" in coauthorship with Meredith McIver
-
2004
Published a book 📕 "The Way to the Top: The Best Business Advice I Ever Received"
-
2004
Published a book 📕 "Think Like a Billionaire: Everything You Need to Know About Success, Real Estate, and Life" in coauthorship with Meredith McIver
-
2003 ― 2015
Produced NBC reality shows 📺"The Apprentice" and "The Celebrity Apprentice"
-
2000
Published a book 📕 "Trump: The America We Deserve" in coauthorship with Dave Shiflett
-
1997
Published a book 📕 "Trump: The Art of the Comeback" in coauthorship with Kate Bohner
-
1991
Was awarded Worst Supporting Actor at Golden Raspberry Awards⭐ for a part in "Ghosts Can't Do It"
-
1990
Published a book 📕 "Trump: Surviving at the Top" in coauthorship with Charles Leerhsen
-
1987
Published a book 📕 "Trump: The Art of the Deal" in coauthorship with Tony Shwartz
-
Languages
Skills
Character
Likes😃
Dislikes😞
Wants🥺
Education
-
2011Asked friends who are prominent and wealthy alumni of the New York Military Academy to secure my academic records so they could not be seen by anyone, never!
-
1966Transferred to the Wharton School of the University of Pennsylvania and graduated in May 1968 with a B.S. in economics
-
1964Started studying in Fordham University
-
1959Enrolled in the New York Military Academy, a private boarding school, after my parents discovered I made frequent trips into Manhattan without their permission
Articles
None published yet


Responsive Sites
A responsive site is one that changes size and/or layout relative to the size of the screen being used to view it. So Ideally the users would have a good experience on any sized device, even though it may not be the same experience.
Frameworks: Pros and Cons
Frameworks provide prebuilt functionality that can save you a lot of time and effort. This means that you can make sites quicker and more efficiently. This is very useful because it can cut the time needed to code a page significantly, saving you time and your client money ;D I guess one the negative aspects of this is it’ll make you lazier when it comes to coding. Considering theres a lot of handy prebuilt tools at your disposal, you wont be learning as much as you would be if you weren’t using a framework. Another thing is when you use a framework you have to work within its limitations and play by its rules. This could possibly limit you and your design.
Wireframes
A wireframe is like a rough sketch or image that represents the placement and size of elements on your website. It’s basically like a blueprint that’s either sketched on paper or drawn on a computer using a programme to roughly block in a site design. My wireframes were very simple, because my design is also very simple. So it didn’t give me too much trouble when I came to translating my wireframe into an actual design. Below is a 'boxified' wireframe drawing of my blog template and index page.
Mobile First Desgin
Mobile first design is when you first and foremost consider how your design will behave on a smaller screen, and making sure that your design is easily able to transform to accommodate becoming smaller. The two images below are the blog template and index images from above transformed to fit a smaller screen.
Process over Product
Process over product is my ideal way to design a page. I think there is a lot of beauty in simplicity, and think that not overburdening the user with too many things to look at can really make a very streamlined and enjoyable experience.
Thoughts on Meditation
I didn’t think much about meditation before I watched the second part of Search Inside Yourself. I always thought that there might be some merit to it, but not anything particularly practical or something that could apply to me. But I was wrong. It was fascinating to think of meditation as cultivating skills that lead to a better quality of life. From increased happiness to better auto-immune responses, there are a lot of different things that you can gain from doing meditation; a lot of which is backed up by scientific experiments and data. I thought it was very interesting and is something that I will definitely try. I’m not sure I can sit in the lotus position though haha. I’ll have to practice that one.


Gale Shapley Algorithm
The entities (light blue nodes) are:
Rover1
Rover2
Rover3
And they have to be match with resources (green nodes):
Downlink
Picture
Drill


Simple Chat System
Sign in to start your session
Register a new membershipRegister a new membership
I already have a membershipSign in to start your session
Register a new membershipRegister a new membership
I already have a membership


{%block extrahead%}{%endblock%}
United States PostgreSQL Association (PgUS)
PgUS
about us
sponsors
financial support
diversity
corporate
become a member
contact us
your membership
{%block layoutblock%}{%endblock%}


ImageUploadController
class ImageUploadController
Class ImageUploadController
Methods
__construct(
RequestStack $requestStack,
ImageUploader $imageUploader,
RouterInterface $router,
string $uploadFieldName,
string $viewImageRouteName,
string $resizeImageRouteName)
Image uploader
JsonResponse
uploadAction()
Dynamic upload action
Details
at line 85
__construct(
RequestStack $requestStack,
ImageUploader $imageUploader,
RouterInterface $router,
string $uploadFieldName,
string $viewImageRouteName,
string $resizeImageRouteName)
Image uploader
at line 106
JsonResponse
uploadAction()
Dynamic upload action


Documentation for LAC Members¶
- Welcome to IITM Library Portal
- Production Server URL at https://books.iitm.ac.in/
Visit the IITM Library URL. Since you are not yet signed in, you will be redirected to the Login URL which is https://books.iitm.ac.in/login
Step 2 : Home Page¶
After Logging in, you will be taken to the Home page. You can enter the ISBN number on this page and it will automatically fetch the book details and take you to the Book Requisition Form. The Home page looks like this.
You can see in the top navigation bar a button which says LAC Home. Clicking it will take you to the LAC Dashboard.
Step 3 : LAC Dashboard¶
It has currently one active module:
- LAC Request Status
This is how the LAC Dashboard looks like.
To accept book requests, click on LAC Request Status. This will load the following request status page.
Step 4 : Approve/Deny Requests¶
After reaching the LAC Request Status page as explained above, you can view all the book requests made by the faculty, and which have already been approved by LAC Members. To appove/deny these requests click on the View button in the last column.
If you click Approve, the book request gets approved and will be forwarded to the Library Staff/Admin for further approval.
If you click Deny, a dialog box will be displayed, requesting you to explain the reason for for denying the book request.
When you enter the reason and submit it, an Email is sent to the Faculty as well as the respective LAC member informing them about the rejection of request, along with the reason that you entered.
Note
An email is not sent to the faculty when you click Approve button here. Approval email is only sent to the respective faculty when their book request gets approved by the Library Staff/Admin.
Once you are done Approving/Denying the book requests, there is no further action required on your behalf. If the request gets denied by the Library Staff/Admin, an email notification is sent to the factuly and the corresponding LAC Member.


Welcome to Dr. Kelvey’s Research! I am Minhwa Lee, and I’m a junior and double-majoring in Math and CS (and potentially minoring in Data Science, too.) I was Dr. Kelvey’s research assistant for the last semester. This document is mainly written for introducing and explaining what I have previously done for the research project. I hope this document helps you so that you will lead Dr. Kelvey’s research to a success!
The entire codes that I have written down mainly underly one of Python’s main characteristics so that we can utilize benefits of objected-oriented programming. The class GraphGame has 7 functions in itself, which enables the user to construct and simulate any kind of graph in Python. Now, I am going to explain what each of all those functions in the class work for.
This function is for constructing any kind of graph and creating an initial adjacency matrix for the graph. It also contains a list of vertices that the constructed graph has, as you see in the last sentence of the definition below.
// Definition of initial condition function
class GraphGame(object):
def __init__(self,size):
self.adjMatrix = []
for i in range(size):
self.adjMatrix.append([0 for i in range(size)])
self.size = size
self.nodeList = [] # Initialization
// Create a list for containing nodes in a given graph
// Update an adjacency matrix of the graph
def addEdge(self,v1,v2):
if v1 == v2:
print("Same vertex %d and %d" %(v1, v2))
else:
if (str(v1) not in self.nodeList)
and (str(v2) not in self.nodeList):
self.nodeList.append(str(v1))
self.nodeList.append(str(v2))
self.adjMatrix[v1-1][v2-1] = 1
self.adjMatrix[v2-1][v1-1] = 1
The first if-statement checks a condition of drawing an edge between any two vertices - if the two vertices in a constructed graph ‘self’, v1 and v2, are same, then no edge can be drawn between these two. Now, we move on to the second if-statement, which also shows another base condition in that the graph contains two vertices v1 and v2 in the list of vertices (self. nodeList). We can also update an adjacency matrix of the graph to have a value of 1 if there is an edge drawn between v1 and v2.
def removeEdge(self,v1,v2):
if self.adjMatrix[v1-1][v2-1] == 0:
print("No edge between %d and %d" %(v1, v2))
return
self.adjMatrix[v1-1][v2-1] = 0
self.adjMatrix[v2-1][v1-1] = 0
This function first checks a base condition that the vertices v1 and v2 should have an edge between themselves - if so, then we update the adjacency matrix of the graph to having a value of 0.
def isEdge(self,v1,v2):
if self.adjMatrix[v1-1][v2-1] > 0:
return True
else:
return False
One purpose of creating an adjacency matrix of a certain graph is to check whether any two vertices in the graph has an edge between themselves. This can be identified by looking at the value of the corresponding adjacency matrix of the graph. If the value is greater than 0, this means there is an edge between v1 and v2.
def toString(self):
i = 1
for row in self.adjMatrix:
print(i, row)
i = i+1
Those several codes in the definition above print out the adjacency matrix of the newly constructed graph in the command window.
p = []
p1 = []
p2 = []
comp = []
user = []
p1_adj = []
p2_adj = []
comp_adj = []
user_adj = []
loop = []
p.append("1")
p1.append("1")
choice_p2 = "1"
count = 0
And, we use a labeled cube like below to play this game.
We also assume that player 1 always starts first, and he/she begins the game on the vertex “1.” So, we append the vertex 1 to both the list p and p1. Also, player 2 should step on all vertices that player 1 have been already on before making a choice for their turn. That’s why we also append 1 to the list choice_p2.
All codes that I have created so far is to only play the Relation-Making Game. So, I set two different modes for this kind of game: one is ‘User vs. User’ and the other is ‘User vs. Computer.’
mode = input("Mode 1: 2 players \n
Game 2: User vs Computer \nChoose Game mode: ")
if mode == "1":
print("Mode 1: 2 players")
else if mode == "2":
print("Mode 2: User vs Computer")
We first look at codes for the first game mode - User vs. User.
Since player 1 starts a game on the vertex 1, now it is player 2’s turn to choose which vertex to move on to. First, we make a for-loop to get information of which vertices are adjacent to the last vertex that player 1 have already chosen to step onto. This loop will create a list p2_adj. (*see the explanation of this list in the above section.)
To help you understand better, let me present some examples to think about some conditions to create p2_adj. If player 1 has been in more than 1 vertex on any graph, the list p has at least 2 elements. Under this situation, we can easily figure out that the possible vertices that player 2 can move on to should be adjacent to the last element of the list p. Along with this condition, those possible vertices should be also not identical to the second from the last of the list p. This is because of the rule that players are not allowed to move backward. With only these conditions can player 2 choose vertices on any graph to move forward.
for node in self.nodeList:
if self.isEdge(int(p[-1],int(node))and(p[-2]!=node):
p2_adj.append(node)
What if player 1 just starts the game so that the list p only has one element? Under this special scenario, we then need to think about another condition to add to the list p2_adj every possible vertices that player 2 may move forward to.
Since p has only one element, we cannot apply the if-statement above to this situation. So, we now need to use an adjacency matrix of a graph to sort out those vertices for player 2. If a node is adjacent to the vertex 1, then a value of an adjacency matrix regarding these two vertices should be 1. We then use this property to code a if-statement in the loop, as follows. Also, to separate this special condition from the general situations described above, we set a variable named ‘count’ to be 0. If this initial condition ends, the value of ‘count’ is no longer 0. I will also mention it below.
for node in self.nodeList:
if count == 0:
# this only applies to the initial condition
if self.adjMatrix[int(p[-1]-1][int(mode)-1] == 1:
p2_adj.append(node)
Putting all together, we now present a completed loop to select the possible vertices that player 2 can move on to, as follows.
for node in self.nodeList:
if count == 0:
if self.adjMatrix[int(p[-1]-1][int(mode)-1] == 1:
p2_adj.append(node)
else:
if self.isEdge(int(p[-1]), int(node)) and p[-2] != node:
p2_adj.append(node)
There is another point to think about regarding any loop that each player can make while playing the game. This process can be also completed by constructing a for-loop. One main condition in creating a loop is that, any vertex that can be included as an element of the list loop should already exist in the list p. For example, if p = [1,2,3,4], we can notice that a player for the next turn can only choose a vertex between 1 and 8. Then, this player will absolutely choose 1 to win this game. Therefore, p2_adj contains 1 and 8 as its element, and also 1 should be present in p to make a loop, and below is what I have written for this condition.
for node in p2_adj:
if node in p:
loop.append(node)
As far as we create two lists p2_adj and loop which provide player 2 all information that help them choose a vertex for each turn, we then know the choice of player 2 (as it is named choice_p2.) Likewise, if the choice of player 2 already exist in the list p, this means player 2 make a loop and win the game, and the game ends. If not, we just append this choice to both p2 and p, thus updating the paths that each player have move on to for each turn.
if (choice_p2 in p):
print("RESULT\n Player 2 wins the game!\n")
break
else:
p2.append(self.nodeList[int(choice_p2)-1])
p.append(self.nodeList[int(choice_p2)-1])
We can also apply the same idea that has been described above so far to the situation for player 1. To do this, we only need to just rename some variables in loops or if-statements.
Consider player 1 and 2 in the first game mode now becomes user and computer. Then, we only need to rename player 1 and 2 with user and computer in this new game mode with the same codes that the first game mode have already used.
- Replace p2_adj with comp_adj.
- Replace p1_adj with user_adj.
- Replace choice_p2 with choice_comp.
- Replace choice_p1 with choice_user.
Here is one more condition that we need to think about only for this game mode. Computer automatically chooses a vertex within a setting as we have already done by making several lists for further information. To apply this characteristic of computer to python codes, therefore, we use a built-in function called ‘random.choice’ for the computer to choose which vertex to move forward for its turn. Then if a list loop has at least one element for the computer to choose, then computer chooses their vertex for the next turn in the list loop. If not, the computer are allowed to do so only in the list comp.
if len(loop) > 0:
choice_comp = random.choice(loop)
else:
choice_comp = random.choice(comp)
Now it’s time to apply what we just created on our codes to a real-world mathematics. To test our program, we will first create a cube by using several functions in the class GraphGame. The codes below is based on the picture of a cube in the earlier section, and they are also defined in the main function.
def main():
c = GraphGame(8)
c.addEdge(1,2)
c.addEdge(1,4)
c.addEdge(1,5)
c.addEdge(2,3)
c.addEdge(2,6)
c.addEdge(3,7)
c.addEdge(4,8)
c.addEdge(5,6)
c.addEdge(5,8)
c.addEdge(6,7)
c.addEdge(7,8)
c.toString()
c.gameOnGraph()
Finally, we execute our program by this main function described below.
if __name__ == '__main__':
main()
You can execute this program in terminal if you are Mac user, or in command prompt if you are Window person.
cd desktop
python3 Research.py
You just finished reading my long readme file for this research project! Thank you so much for your spending time on my writings, and I hope this article really helps you a lot to understand the project. If you have any question about this document or whatever stuffs related to python codes, please email me by<EMAIL_ADDRESS>Good luck on your research!


Ohio police department receives reports of razor blades, metal objects found in Halloween candy
by WCPO StaffCOLERAIN TOWNSHIP, Ohio — A police department in suburban Cincinnati says they have received startling reports of metal objects "similar to razor blades" hidden inside trick-or-treat candy.
In a tweet, the Colerain Police Department announced that "objects reported to be metal and similar to razor blades" were found in candy from the Pleasant Run area.
Colerain Township police confirmed two separate families reported finding blades in the candy. One blade was found in a Reese's peanut butter cup, the other in a Kit-Kat bar.
Authorities are currently investigating the reports.
"We want to stress the importance of parents checking their child's candy for any signs of tampering," police said.
Anyone who discovers objects in candy or who has information on the incident is asked to call (513) 321-COPS.
This story was originally published by WCPO in Cincinnati.


--- layout: post title: HTML5 Improvements with the ASP.NET MVC 3 Tools Update date: '2011-05-15T14:53:00.001+01:00' author: solrevdev tags: modified_time: '2011-05-15T14:53:49.693+01:00' blogger_id: tag:blogger.com,1999:blog-31446756.post-1236520178100297155 blogger_orig_url: http://www.solrevdev.com/2011/05/html5-improvements-with-aspnet-mvc-3.html ---
html5 and the razor syntax. very nice indeed.


M&S shoppers delighted by Snow Globe Clementine Gin for Christmas
And it contains edible gold leaf!
by Nancy BrownThis is not just any gin, this is Marks & Spencer's Clementine Gin Liqueur Snow Globe – and it's here to make your Christmas festivities merry and bright.
For just £15, you can add some sparkle to your Christmas parties as this zesty clementine gin liqueur contains edible golf leaf.
It creates a magical winter scene when you shake the bottle.
"We need some of this for Christmas!" squealed one delighted shopper.
Read more: The Crown star claims the Queen "has to die" for Charles' life to have "meaning"
Can you think of anything more decadent? No? Neither could we, until we discovered the cocktails you can make with the gin.
"Whether served over ice or mixed with prosecco or tonic water, this is a delicious tipple with seasonal sparkle," said Jenny Rea, M&S product developer.
M&S recommends serving your gin liqueur with a splash of prosecco in a champagne flute to make The Bubbly One.
Read more: M&S launches bright pink Percy Pig muffins and they're only £1!
For The Fruity One, add a dash of clementine gin liqueur to a glass tumbler. Pour over a generous splash of tonic and serve with fruity pomegranate ice cubes, made by adding a few pomegranate seeds to your ice cube tray before freezing.
The Neat One does what it says on the tin – simply pour a shot of clementine gin liqueur into a cold martini glass and garnish with a twist of orange peel.
In other gin news, the store is also stocking gin baubles that look perfect when hung from your Christmas tree.
While the gin in a tin range has also got an update with the store's Christmas Dry Gin, blended with festive botanicals, now available in a can.
Will you be trying the range? Let us know on our Facebook page @EntertainmentDailyFix.