1970 GMT and – as long as integers were stored in 32 bit (signed), could count from (aproximately) the year 1902 to the year 2038. ] --- template: plain name: file_handling header: ### Working with Files Working with files basically falls into three main categories: * [Working with Directories](#directory_handling) * [Operations with Files in Whole](#files_in_whole) * [Accessing the Content of Files](#accessing_files) --- template: plain name: directory_handling header: #### Working with Directories [`pwd`]: https://www.tcl.tk/man/tcl/TclCmd/clock.htm#M23 [`cd`]: https://www.tcl.tk/man/tcl/TclCmd/clock.htm#M23 [`glob`]: https://www.tcl.tk/man/tcl/TclCmd/clock.htm#M23 The commands dealing with directories and directory content are: * [`pwd`] – return the absolute path name of the current working directory;._[] * [`cd`] – change the current working directory according to the path name specified as argument or to the user's home directory, if no argument is given; * [`glob`] – return list of path names in given or current directory (see examples following). .W[ As it is a **per-process** resource, be careful when changing the current working directory: it determines how relative file path names are interpreted for **all** parts of the running program. ] .F[: This is implemented as built-in command with the same name as the command a traditional U*ix system provided for that purpose. Therefore `pwd` in Tcl not only works at the interactive interpreter level (where any unknown command is tried as operating system command anyway). ] --- template: plain name: directory_handling header: ##### Example for `pwd` and `cd` The commands `pwd` and `cd` may be used in concert to remember and restore the current working directory. The base technique is: ``` set old [pwd] ;# save current working directory cd … ;# change to other directory … … ;# (work in other directory) … cd $old ;# restore old working directory ``` .N.center[ Note that the above is not very secure against failures. ] Especially it will create problems if one of the command running while the directory is changed causes an error which is caught without restoring the working directory, the change will unexpectedly persist.._[] .F[: The wrapping required to make saving and restoring secure against intermediate failure is not hard to write but also not trivial, so it is not shown here. If the feature to run a portion of a Tcl program with a different working directory is required more often, it will probably be best to implement a new control structure for that purpose with the help of [`uplevel`](#cmd_uplevel). ] --- template: plain name: directory_handling header: ##### Example for `glob` The basic use of `glob` is trivial and easy, as it returns a list of path names for the current or a given directory. .pull-left[ All files matching `*`: ``` … [glob *] … ``` ] .pull-right[ All files in directory `/tmp`: ``` … [glob /tmp/*] … ``` ] There are many useful options, some are shown in the examples below:._[] ``` … [glob -hidden *] … ;# include hidden file … [glob .* *] … ;# as before on Unix or Linux … [glob -- -*] ;# files with names starting with '-' … [glob -types d *] ;# only (sub-) directories ``` .N[ Another important option is `-nocomplain`: when it is **not** specified an empty result (list) will be considered as error. ] .F[: With respect to the example on "hidden" files it probably need to be understood that for U*ix traditionally these are all files that have a name beginning with dot. ] --- template: plain name: files_in_whole header: #### Operations with Files in Whole [`file`]: https://www.tcl.tk/man/tcl/TclCmd/file.htm The command [`file`] has a large number of sub-commands for all the operations that are possible with a file in whole: * `file exists …` – (should be obvious) * `file stat …` – query file properties in single operation._[] * `file copy …` – copy content of a file * `file rename …` – rename a file * `file delete …` – remove a file * `file mkdir …` - create (sub-) directory * `file separator` – return file name separator (i.e. `/` or `\`) * `file join …` – combine path name components to file name * `file split …` – split file name into path name components * `file extension …` – file name suffix * `file rootname …` – all but file name suffix * `file tail …` – last file name component * `file dirname …` – all but last file name component * … (and more) … .F[: There are also sub-commands to query properties individually, like `file size …`, `file mtime` …, etc. and some of these may also be used for setting that property. ] --- template: plain name: accessing_files header: #### Accessing the Content of Files Accessing the content of files from Tcl is modelled after C: * `open` returns a file handle which usually is saved in a variable, * as it is the entrance ticket for other operations with the file, * like reading or writing (`read`, `gets` and `puts`), * finding or setting the current position (`tell` and `seek`), and * miscellaneous operations like testing for EOF (`eof`) * and finally handed over to `close` to release the resources associated with the file handle. --- template: plain header: ##### Opening Files [`open`]: https://www.tcl.tk/man/tcl/TclCmd/open.htm The command [`open`] has two arguments: * the file name and * the open mode. As usual, if the file name is a relative path name it is interpreted from the current working directory. .N[ An unusual feature is that a path name beginning with a vertical ar (`|`) is considered to be external command. Depending on the open mode its input or output is then available via the file handle returned.._[] ] Open modes are specified * either as for `fopen` in C (`r`, `w`, `rw`, `a`, …) * or in Posix style (`RDONLY`, `WRONLY`, `RWDR`, `APPEND`, …) Note that there are also some options effecting serial ports, but usually these are configure by [`fconfigure`](#cmd_fconfigure), which has still more options. .F[: This can be seen as a way of starting a process asynchronously and will be covered later ] --- template: plain name: handling_open_errors header: ##### Handling Errors when Opening Files Errors on opening files with `open` are usually caught (to be adequately handled) in an idiomatic style. The following example opens a file specified by variable `pathname` for reading: ``` if {[catch { open $pathname r } result]} { … ;# handle error (reason is in result) } else { … ;# work with file (handle is in result) close $result ;# <--- essential to avoid resource leaks } ``` .N[ Note that closing a file – even if opened read-only – is usually necessary to avoid resource leaks.._[] ] .F[: The problem may not show if only some few files are left in an opened state. But if a fragment like the above is run over and over again and does **not** close the file it opened, at some point the process max reach its limit of open files, and from that on **all** attempts to open a file will cause an error On operating systems as used in the 1980s, this limit was about 20 or 50; recent OS may have raised to to several hundred, but on most any OS there still is such a limit. ] --- template: plain name: get_file_lines header: ##### Deferred Handling of Errors when Opening Files If an error from `open` cannot be sensibly handled **locally**, it is often easier to leave error handling to the caller of a function. Return content of text file as Tcl list, each line one element:._[] ``` proc get_file_lines {name} { set handle [open $name r] set content [read -nonewline $handle] close $handle return [split $content \n] } … if {[catch { get_file_lines $pathname } file_lines]} { … ;# problem opening (or reading?) the file } … ``` .W[ If the above will not fail on `open` but might fail on `read` there will be a resource leak, as the opened file will not be closed. ] .F[: A counterpart subroutine [`put_file_lines`](#put_file_lines) is shown later. ] --- template: plain header: ##### Intermezzo: What Exactly Does `catch`? [`catch`]: https://www.tcl.tk/man/tcl/TclCmd/catch.htm [`error`]: https://www.tcl.tk/man/tcl/TclCmd/error.htm The last example may serve as reminder of an some unusual aspect in the use of the command [`catch`], that regains control after an [`error`]: * The **return value** of `catch` holds the information, whether the command sequence given as *first* argument * lead to an error – then `catch` returns "true" as condition for `if`; * everything went ok – then `catch` returns "false" (and the `else` part of an `if` stament would get control). * Depending on the former, the **second argument** of `catch` will * *either* hold the message returned from `error`, * *or* the result of the command executed last. Not that `catch` as argument to `if` may be used with or without quoting:._[] .pull-left[ The usual style … ``` if {[catch { … } …]} … ``` ] .pull-right[ … and for the lazy natures: ``` if [catch { … } …] … ``` ] .F[: Why is that so? (Find out with or [good ol' helper used to demonstrate quoting](#defining_subroutines).) ] --- template: plain name: cmd_fconfigure header: ##### Special File Handling Options [`fconfigure`]: https://www.tcl.tk/man/tcl/TclCmd/fconfigure.htm [`fileevent`]: https://www.tcl.tk/man/tcl/TclCmd/fileevent.htm The command [`fconfigure`] provides various sub-commands to control many aspects of files. The following list is by no means exhaustive: * how buffering is handled (none, by line, larger block, …), * translation modes (e.g. newline → carriage return + newline or vice versa), * if a `read` will block as long as no data is available,._[] .W[ Using the non-blocking modes for reading might lead to a design with busy waiting and/or sub-optimal latency times. ] Asynchronous designs with read operations in call-backs (registered with the command [`fileevent`]) are usually superior to non-blocking read mode (though not easily doable in Vivado, but also not typically required there). .F[: This is mainly used for "device files" representing to a serial line interface, TCP/IP-sockets, or U*ix pipelines. In some cases it may also make sense for console input. ] --- template: plain name: cmd_fconfigure header: ##### Configuring Serial Devices The command `fconfigure` also provides sub-commands to control the operation of serial hardware interfaces. Again, the following is by no means exhaustive: * set baud rate, bit-frame, parity … * … behaviour of control lines … * … flow control … .N[ In the standard Tcl manual pages the details are not documented with `fconfigure` but in section [Serial Communications] of `open`. ] [Serial Communications]: https://www.tcl.tk/man/tcl/TclCmd/open.htm#M22 --- template: plain name: tcl_cmd_read header: ##### Reading Whole Files or Fixed Size Portions [`read`]: https://www.tcl.tk/man/tcl/TclCmd/read.htm The command [`read`] either reads a number of given characters from a file, or a [whole file](#get_file_lines). The following fragment reads single characters with waiting (assuming a valid file-handle `fh`): ``` proc readchar {channel _b} { upvar $_b b set b [read $channel 1] ;# <-- will until data is available return [expr {![eof $channel]}] } … while {[readchar $fh byte]} { … ;# process byte } ``` .W[ Only translation mode `binary` (set on `open` or with `fconfigure`) ensures single physical bytes are extracted.._[] ] .F[: Depending on the encoding otherwise multiple code units (i.e. physical multibyte sequences) may be extracted to determine the code point of the character read. ] --- template: plain header: ##### Reading Characters Without Waiting [`after`]: https://www.tcl.tk/man/tcl/TclCmd/after.htm As already mentioned, a file handle may be configure not to wait for data being available on read: ``` … fconfigure $fh -blocking 0 while {![eof $fh]} set ch [read $fh 1] ;# <-- will not block if no data, so ... if {[string length ch] == 0} { ;# ... we need to check ... … ;# ... and can do something useful here (REALLY useful) } else { … ;# process ch } } ``` .W[ Really useful means exactly that: **REALLY USEFUL**. Simply doing nothing when no data is available will lead to busy waiting and eats-up precious CPU time while waiting.._[] ] .F[: The very least were to sleep a small amount of time without causing CPU load. This can be achieved with the command [`after`], followed by a numeric argument that specifies the time to sleep in milliseconds, but this always requires trade-off between lowering the CPU load and sub-optimal latency. ] --- template: plain header: ##### Reading Line By Line [`gets`]: https://www.tcl.tk/man/tcl/TclCmd/gets.htm The command [`gets`] reads single lines from a file. In detail its behaviour depends on the arguments used in the call: * With **only** a file-handle as argument it returns the next line read, * With a file-handle **and** a variable name as argument it * returns the number of characters read, and * leaves the line content in the named variable. Depending on the translation mode configured for the file end-of-line conventions will be handled transparently. .N[ In the line read (and in the count returned by the second form) there is no end-of-line character contained. ] --- template: plain header: ##### Examples Reading Line By Line The following two examples append each line read from a file as new element to a list (assuming a valid file-handle `fh`): .pull-left[ ``` set result [list] while {[gets $fh line] >= 0} { lappend result $line } ``` ] .pull-right[ ``` set result [list] while {![eof $fh]} { lappend result [gets $fh] } ``` ] Though both ways may look equivalent, they do actually are different for files in which the last line is terminated with end-of-line characters (as is usually the case). .pull-left[ .N[ The loop is exited after the last line (as it is probably intended). ] ] .pull-right[ .N[ The loop is **not** exited after the last line, as reading it has not (yet) set the end-of-file state – this will only happen with the **next** call to `gets`.._[] ] ] .F[: But that call then returns an empty string, hence the `result` list has another (empty) entry at its end. ] --- template: plain header: ##### Writing to Files [`puts`]: https://www.tcl.tk/man/tcl/TclCmd/puts.htm The command [`puts`] has been used often in this presentation, but always with only one argument (and sometimes the option `-nonewline` too). If used with two arguments, the first must be a file handle, typically obtained from a call to open. The following is the counterpart to the example subroutine [`get_file_lines`](#get_file_lines):._[] ``` proc put_file_lines {name content} { set handle [open $name w] puts -nonewline $handle [join $content \n] close $handle } ``` .F[: Why does the call to `puts` require the use of the `-nonewline` option? ] --- template: plain header: ##### More Operations with Open Files [`eof`]: https://www.tcl.tk/man/tcl/TclCmd/eof.htm [`seek`]: https://www.tcl.tk/man/tcl/TclCmd/seek.htm [`tell`]: https://www.tcl.tk/man/tcl/TclCmd/tell.htm The commands [`eof`], [`seek`], [`tell`], support more operations with files (via file handles typically obtained from `open`). .N[ The speaker will show live examples if this topic is of special interest. ] --- template: plain header: ##### Flushing and (finally) Closing Files [`flush`]: https://www.tcl.tk/man/tcl/TclCmd/close.htm [`close`]: https://www.tcl.tk/man/tcl/TclCmd/close.htm The command [`close`] is required to release any resources connected to a file handle. .N[ When a file is `close`-d, also the last buffered output is flushed. ] Hence closing a file open for writing may return an error! * Note that [`flush`]-ing the buffer only happens from the perspective of the Tcl application. * On modern operating systems and also in the hardware of the storage system there are usually additional levels of buffering. .W[ Data may not have arrived on a reliable persistent storage media, only because the file to which is written has been `flush`-ed or `close`-d via its file handle. ] --- template: plain name: cmd_line_and_env header: ### Command Line / Environment Variables [Tcl Global Variables]: https://www.tcl.tk/man/tcl/TclCmd/tclvars.htm The calling context of a script may be accessed via [Tcl Global Variables].._[] * `argv` are the command line arguments (without the name of the command itself) as list; * `argc` is the same as `llength $argv`; * `argv0` holds the path name of the script executed (not the interpreter, i.e. **not** `tclsh` or `wish`); * `env` is an array holding the environment variables (as can usually expected plus what has been individually set via `export` in the shell). .N[ By using global variables with to leading semicolons, e.g. `::env` instead of `env`, the above also works as part of a subroutine, without introducing the variable name via the command [`global`](#global_variables). ] .F[: There are global variables for many more purposes, like checking for the version of Tcl (`tcl_version`) or Tk (`tk_version`), platform specific properties like the file path name separator (`/` on U*ix and `\` on Windows) or byte order etc., and much, much more. ] --- template: plain header: ##### Example for Accessing Command Line Arguments [`exit`]: https://www.tcl.tk/man/tcl/TclCmd/exit.htm The following prints a message on standard error stream that includes the program name and terminates the Tcl interpreter with a given return status: ``` proc die {message {exitstatus 127}} { global argv0 puts stderr "$::argv0 \[FATAL]: $message" exit $exitstatus } ``` .W[ A call to `exit` will usually terminate a Tcl script at any point, hence **resources not cleaned up automatically** at the end of the process may leak … ] … but an application may chose to redefine the command `exit` and do something different.._[] .F[: Especially applications that may run arbitrary, user supplied Tcl scripts – like Vivado – will typically chose to ignore `exit` or at least do all necessary cleanup and may also save any data important for to be available for recovery on a restart. ] --- template: plain header: ##### Example for Accessing Environment Variables The following lists all the environment variables an their value in sort order: ``` foreach v [lsort [array names ::env]] { puts "$v=$::env($v) } ``` Or only those with a `XILINX_`-prefix: ``` foreach v [lsort [array names ::env XILINX_*]] { puts "$v=$::env($v) } ``` After modifying or adding to the global array `env`, the result is visible as (new) environment for a child processes, easily demonstrated as follows: ``` set env(MINE) whatever exec env | grep MINE ``` --- template: plain name: cmd_exec header: ### Running External Programs [`exec`]: https://www.tcl.tk/man/tcl/TclCmd/exec.htm [`fileevent`]: https://www.tcl.tk/man/tcl/TclCmd/fileevent.htm The command [`exec`] is the general interface to run separate processes. Via a mix of Tcl and (U*ix) Shell syntax it provides many variations as exemplified below (including a meaningful mix thereof): * [run the process synchronously](#external_programs); * [run the process asynchronously](#external_demon_programs); * run several processes pipelined; * return standard output after completion … * … optionally including standard error output * … and/or turn abnormal termination into a Tcl error; * connect to the Tcl interpreter via file handles or sockets.._[] Besides its main purpose to open classic files, also the command `open` provides easy ways to run a separate process while either * [supplying its standard input](#external_program_input) or * [receiving its standard output](#external_program_output). .F[: This makes more sense for asynchronously run processes and will often necessitate to receive data sent *from* the external program *to* the interpreter in callbacks registered via [`fileevent`]. ] --- template: plain name: external_programs header: #### Running Programs Synchronously The `exec` command may wait on the external program to end, i.e. run it synchronously. A typical fragment may look like this: ``` set xprog … ;# program to execute (with arguments) set result [exec $xprog] ;# execute and receive stdout and stderr ``` .N[ The command `exec` may also be used to start a pipeline of more than one program. ] --- template: plain name: external_demon_programs header: #### Running Programs in Background The `exec` command may start the external program in the background, i.e. run it asynchronously (aka. as demon). A typical fragment may look like this: ``` set xprog … ;# program to execute (with arguments) exec $xprog & ;# execute (ignoring the result) ``` .N[ The above is used if it does not matter when and how the background process ended. ] The return value of an `exec` command like above, which is the [PID] of the process, may also be saved for later use: ``` set pid [exec $xprog &] ``` If the command `exec` is used to start a pipeline of more than one program in the background, the return value is a list of all process ids. [PID]: http://en.wikipedia.org/wiki/Process_identifier --- template: plain name: external_demon_programs header: #### Controlling Programs in Background A saved PID will typically be used to control the program running in the background in some way, most often to … .pull-left[ … test whether it is still running … ``` if {[catch { exec kill -0 $pid }]} { … ;# process terminated } else { … ;# process still running } ``` ] .pull-right[ … or to forcefully terminate it. ``` # first ask politely ... exec kill -TERM $pid # ... then wait ... after 5000 # ... and no more mercy now: exec kill -KILL $pif ``` ] Linux and many other modern U*ix systems allow for finer grained interventions via the `/proc` file system.._[] .F[: At any time the entries within it represent a live snapshot of all currently running processes as PID-named sub-directories. Their entries turn allow to obtain information on and get control over these processes. For details see: https://www.kernel.org/doc/Documentation/filesystems/proc.txt ] --- template: plain name: external_program_input header: #### Sending Input to a Program [`open`]: https://www.tcl.tk/man/tcl/TclCmd/open.htm The [`open`] command may also be used to start a program as an external process while asynchronously supplying its standard input via a file handle. A typical fragment may look like this: ``` set xprog … ;# program to execute (with arguments) set handle [open |$xprog w] while { … produce more data for xprog to process … } { puts $handle … ;# whatever } close $handle ;# will wait for xprog to terminate ``` --- template: plain name: external_program_output header: #### Receiving Output from a Program [`open`]: https://www.tcl.tk/man/tcl/TclCmd/open.htm The [`open`] command may also be used to start a program as an external process while asynchronously reading its standard output via the file handle returned. A typical fragment may look like one of the following two fragments … .pull-left[ … either lines of text … ``` set xprog … set fh [open |$xprog r] while {[gets $fh line] >= 0} { … ;# process another line } close $fh ``` ] .pull-right[ … or arbitrary (binary) data. ``` set xprog … fconfigure\ [set fh [open |$xprog r]]\ -translation binary set data [read $fh] close $fh … ;# process all binary data ``` ] --- template: plain name: introspection header: ### Introspection (and Debugging) The main interfaces required for introspection and debugging are available via the Tcl commands * [`info`](#cmd_info), * [`trace`](#cmd_trace), and * [`rename`](#cmd_rename) --- template: plain name: cmd_info header: #### Obtaining Information (on Most Everything) [`info`]: https://www.tcl.tk/man/tcl/TclCmd/info.htm By various sub-commands the command [`info`] provides information many internals of the Tcl interpreter. The following is an overview only and by no means exhaustive: * `info vars` – returns a list of all variables (by default of the current scope, but as an optional pattern may follow, by using `info vars ::*` all global variables may be obtained too); * `info exists` *`varname`* – returns true if a variable *`varname`* exists. * `info commands` – returns a list of all commands currently known to the interpreter (includes but is usually much more than the next); * `info procs` – returns a list of all currently known Tcl subroutines * `info args` *`procname`* – returns a list of arguments (including defaults) as expected from subroutine *`procname`*; * `info body` *`procname`* – returns the body (implementation) of subroutine *`procname`*; * `info functions` – returns a list of all mathematical functions currently supported by `expr`.._[] .F[: It is easily possible to extend the support for mathematical functions, for details see section [Math Functions] in the manual page of `expr`. ] [Math Functions]: https://www.tcl.tk/man/tcl/TclCmd/expr.htm#M22 --- template: plain name: cmd_trace header: #### Tracing Variable Access and Subroutine Execution [`trace`]: https://www.tcl.tk/man/tcl/TclCmd/trace.htm The various sub-commands of the command [`trace`] provide options to get call-backs when * variables are accessed (read, written, or unset), or * subroutines executed (entry, exit, or line-by-line trace). .N[ The speaker will show live examples if this topic is of special interest. ] --- template: plain name: cmd_rename header: #### Renaming and Removing Commands [`rename`]: https://www.tcl.tk/man/tcl/TclCmd/rename.htm The command [`rename`] allows to * change the name of an existing subroutine, or * completely remove it, by renaming it to the empty string (`""` or `{}`). .N[ The speaker will show live examples if this topic is of special interest. ] --- template: plain name: tcl_in_vivado_and_beyond header: ### Part 4: Using Tcl in Vivado and Beyond ------------------------------------------------------------------------ .pull-left[ [**Tcl in Vivado** ](#tcl_vivado_summary) * [Understanding Design Objects ](#design_objects) * [Quoting Correctly Applied ](#correct_quoting) * [Special Square-Bracket Rules ](#special_sq_brackets) * [Design Object Name Matching ](#matching_object_names) * [More Uses of Tcl ](#more_uses_of_tcl) * [Problematic Areas ](#problematic_areas) ] .pull-right[ [**Tcl beyond Vivado** ](#tcl_beyond_vivado) * [Calling C/C++-Modules ](#c_cpp_modules) * [TCP/IP-Communication ](#tcp_ip_networking) * [GUI-Programming ](#tk_gui_programming) * [(and more - if time allows) ](#you_name_it) ] ------------------------------------------------------------------------ The (relative) weight of the major sections is controlled by attendees and may vary between "50:50" or "80:20", with the 80% on either side. .N[ There will be a short poll now so that time can be appropriately allotted. ] --- template: plain name: tcl_vivado_summary header: ### Tcl in Vivado (Summarising) Tcl is integrated in Vivado as its Tool Command Language. In general Vivado's Tcl interpreter is full-featured._[] but in some few special-purpose areas it has restrictions. During start-up Vivado looks at various standard places to find and eventually read and execute (= `source`) files with Tcl commands. * These files are a good place for a collection of private subroutines needed frequently in a Tcl-based design flow. * If the collection grows, consider to split it into logical groups, put each group into a file of its own and `source` these from inside the files Vivado which is automatically reads at start-up. * If your subroutine library grows even more, consider to make use of [Autoloading](#reusable_parts). .F[: Currently the `tcl_version` used in Vivado is 8.5, i.e. just one minor release step from the current mainstream version of Tcl, which is 8.6. ] --- template: plain name: design_objects header: ### Understanding Design Objects At its core Vivado holds a Design Model in a set of interconnected Objects._[] These objects are grouped into classes with a set of properties, which can be queried and modified in various ways with commands added to Tcl by Vivado for that purpose. .center[ **Design Objects are a new type from the viewpoint of Tcl.** ] This type is the Vivado specific addition to Tcl's (internal) standard types like integral and floating numbers or character strings. .N[ References to design objects are handled transparently by Tcl and need no special consideration when held in a Tcl variable or list. ] .F[: This is mainly derived from the documentation and should be rather taken as conceptual description, not as internal details of the actual implementation. ] --- template: plain name: design_objects_in_lists header: #### Design Objects in Lists There are many commands in Vivado that return design objects, often as list of design objects.._[] A design object (reference) can be * added *to* a list *from* a variable or another list in which was held, and * taken *from* a list in which it is held and assigned *to* variable. Handing around a design object reference that way will keep the object itself fully intact, with all its properties. .N[ The only thing that is made sure is that lists of design object (references) always hold objects of the same class. ] .F[: This is called an "object container" in the Vivado documentation and actually a new Tcl type too. But most of the commands a Tcl developer expects to use for lists are available for object containers and hence it can be said they have the "look & feel" of a Tcl list. ] --- template: plain name: converting_design_objects header: #### Converting to and from Design Objects If on occasion a Tcl (built-in) command actually needs a character string, the design objects * will **not** be completely encoded into pure text form._[] (somehow), * instead **only** the `NAME` property of the design object will be used. .N[ Vice versa the conversion *from* a name *to* a design object (reference) requires the use of a one of Vivado's `get_` commands. ] Of course, design objects may be transformed into a textual description by means of `report_property -all …`, though the output then is primarily targeted to a human reader, not for direct further processing. .F[: This is what makes design objects different from the built-in types: the latter are always serializable to a pure text form, hence may be stored externally and retrieved with their original content. For design objects that would make little sense due to the many interconnections they may have with other objects, which in turn would then have to be serialised, or the originally serialises object were not of much use anymore. ] --- template: plain name: correct_quoting header: ### Quoting Correctly Applied In VHDL identifiers may be contain and surrounded with back-slashes, e.g.: * `\abc\def uvw\xyz\` This, of course, needs some quoting in Tcl, but full quoting * `{\abc\def uvw\xyz\}` will fail in that particular case, due to the trailing back-slash.._[] .N[ Therefore the recommended solution is this: * **`"\\abc\\def uvw\\xyz\\"`** .N[ **Use double quotes and write all contained back-slashes twice.** ] .F[ Though the trailing backslash will not be touched, the closing square bracket is not recognized as it is now exempt from brace counting. ] --- template: plain name: special_sq_brackets header: ### Special Square-Bracket Rules Via the `unknown` procedure the Tcl syntax analysis determines what should happen in case of unknown command. This allows a nifty trick in Vivado, to allow the use of VHDL signal vectors in their typical forms like `[1:16]`, [5], or `[*]` without quoting the square brackets: * The syntax analysis does nothing special here, it simply identifies the command to be executed as being spelled `1:16`, `5`, or `*`. * If the `unknown` procedure detects that there is no built-in command with such a name, it simply returns it (as a string) `[1:16]`, `[5]`, or `[*]`.._[] .N.center[ Problem Solved! ] .F[: Though, really, really interesting and "unexpected" things may happen in a Vivado design flow based on Tcl if you have the boldness to defined a procedure with a funny name that happens to look like a signal vector you use, e.g.: `proc 1:16 {} { return {[16:1]} } ] --- template: plain name: matching_object_names header: ### Matching Design Objects Names When design objects are returned as lists from the various `get_`-commands, it is often the case that their elements are selected via match-patterns for their names. There are two matching styles: * The default is pattern matching as with Tcl's command [`string match`](https://www.tcl.tk/man/tcl/TclCmd/string.htm#M35) is used on the individual parts of an object's hierarchical name. * If requested via the `-regex` option comparisons will be based on Tcl's [regular expressions](#https://www.tcl.tk/man/tcl/TclCmd/re_syntax.htm). The former is further controlled by the `-hierarchical` option together with `current_instance`, and is often more convenient. The latter is much more powerful but careful attention must be paid to correct quoting. --- template: plain name: glob_matching_object_names header: #### Default (Glob-Style) Matching of Design Objects Names This is further controlled by * the `current_instance` setting and * the `-hierarchical` option. The model is similar to navigating in a hierarchical file system, but not as close as it may seem at first glance: * The (Vivado) commando `current_instance` is somewhat similar to setting the working directory in that it sets the *working instance*. * Glob-style patterns **not** containing the hierarchical separator `/` (i.e. a slash, just as in Unix file systems) search from that instance. * Glob-style patterns containing the hierarchical separator will search deeper down from the current instance. .N[ Note that there is no way to refer to the top-level directly when the current instance is set elsewhere (i.e. like using absolute path names in file systems). ] --- template: plain name: glob_matching_object_names header: #### Recursive (Glob-Style) Matching With the `-hierarchical` option the search pattern must **not** contain the hierarchical separator and is applied in a recursive search down from the current instance to each element of the composed name. The Vivado documentation ([UG835, pg. 16](#vivado_tcl_documentation)) explains the `-hierarchical` option … ``` set pattern … ;# pattern to match names current_instance "" ;# set scope to top-level set result [get_cells -hierarchical $pattern] ``` … with the manual approach that had to be used alternatively:._[] ``` set result {} foreach hcell [list "" A B A/a1 A/a2 B/b1 B/b2] { current_instance $hcell ;# move scope to $hcell set result [concat $result [get_cells $pattern]] current_instance ;# return scope to design top-level } ``` .F[: `A B A/a1 A/a2 B/b1 B/b2` is the whole set of cell names used in their miniature example, and `""` needs to be added so that the top-level itself is included. ] --- template: plain name: regex_matching_object_names header: #### Regular Expressions Matching of Design Objects Names This kind of matching is much more powerful but careful attention must be paid to correct quoting. .W[ *Trial and Error* with regular expressions in combination with quoting will more often lead to frustration than to success.._[] ] This does not mean you should avoid it – it rather means you should feel familiar with both, regular expressions and quoting, when using both in concert. .N[ The speaker will show live examples if this topic is of special interest. ] .F[: This is especially true if (part of) the selection pattern comes from a variable. Though the Tcl syntax can be generally considered as very "regular" and hence easy to grasp (as there are few rules only that apply strictly with little or no exceptions) be sure to develop a good understanding for its intricacies. ] --- template: plain name: more_uses_of_tcl header: ### More Uses of Tcl in Vivado Actually the Tcl language is used in some specialised areas of Vivado too. * Custom Design Rule Checks (DRC): * In this some boiler-plate code is necessary. * For the general recipe to be followed see the Vivado documentation ([UG894, pg. 28](#vivado_tcl_documentation)). * Design Constraints (XDC) * While many Vivado specific commands is available … * … substantial built-in Tcl commands are deliberately blocked.._[] * For details see the Vivado documentation ([UG903, Appendix A](#vivado_tcl_documentation)), .N[ The restrictions to Tcl commands only apply if constraints are specified in `*.xdc` files. In `*.tcl` files all the usual Tcl built-ins are available. ] .F[: The reason for not supporting the full set of Tcl built-in commands is that Vivado provides a way to interactively modify constraints specified in `*.xdc` files. ] --- template: plain name: problematic_areas header: ### Problematic Areas All commands that register call-backs are often pointless (though these commands are available) * as there is no event loop running by default, and * if one is started explicitly, it would block the return to GUI mode. What *will* work is to establish a TCP/IP-socket connection between the Tcl interpreter running on behalf of Vivado and some external program. .N[ An external program connected to the Tcl interpreter inside Vivado via TCP/IP **may or may not** itself be written in Tcl. ] Nevertheless, by giving up event-driven style at least on the side of Vivado, some communication options are lost! For one-way communication also a classic pipeline may be used and is easily established for [reading](#external_program_output) or [writing](#external_program_input) via the command `open`. .F[: Though it might even be possible to arrive at an integrated solution if sufficient work is invested, also with respect to future Vivado versions that may change the internal working, it seems wise to separate event-driven architectures from each other. ] --- template: plain name: tcl_beyond_vivado header: ### Tcl beyond Vivado Using Tcl beyond Vivado can have several faces: * Extend Vivado with Tcl (and possibly Tk) in areas which are not properly prepared for it.._[] * Use Tcl for local scripting purposes, from small to medium to large to mission critical applications, possibly touching the core competences of a software development department or a whole company (has been done … successfully). * Use Tcl combined with Tk to provide Graphical User Interfaces. .F[: This is not meant as criticism with respect to Vivado, it only means that there are use possible case not foreseen, especially when the necessity arises to merge event loops. ] --- template: plain name: c_cpp_modules header: ### Calling C/C++-Modules Extending Tcl with modules written in C offers big chances for rapid prototyping, * doing the first sketches in a Tcl-only implementation, * either as "proof of concept", or * to determine what actually is required * then identifying the parts that need substantial performance improvements, and * finally rewriting these in C or C++. .N[ This should work with Vivado too,._[] but the author has not yet tried it. ] .F[: Of course, this makes sense only if Tcl is used heavily to script the Vivado work flow and there are – and provably – parts which substantially profit from a re-implementation in C or C++. ] --- template: plain name: tcp_ip_networking header: ### TCP/IP-Communication TCP/IP-Communication usually has two sides:._[] * The *Server Side* which usually needs some concurrency – or at least a "user experience" that "feels" like, as can be achieved in a event driven design with compact and efficient call-backs. * The *Client Side* which may or may not need concurrency. As with Vivado the event driven programming model – though thoroughly supported by Tcl – is difficult to exploit, Vivado can only be extended with Tcl to work as a simple form of TCP/IP-client. A possible idea what that could be was sketched in Part 1. .N[ The speaker will show live examples if the remaining time allows and this topic is of special interest. ] .F[: Though note, that the data stream as such is symmetrical, once a socket connection has been established. ] --- template: plain name: tk_gui_programming header: ### GUI-Programming GUI-Programming – contributed to Tcl via Tk._[] – is the major extension added to Tcl very early and partially as "Proof of Concept" to demonstrate the extensibility of Tcl. Here is your very first TK application: ``` #!/usr/bin/wish wm title . "Hello, World of Tk" pack [button .b\ -text "Do NOT klick here!\n(please)"\ -background red\ -foreground white\ -command exit ] ``` .F[: Actually *Tk* is the abbreviation for *Toolkit* – so, strangely, a very general name was chosen for a Tcl extension with a very specific purpose. ] --- template: plain name: tk_gui_pros header: ### Tk Pro's * Easy to learn, once you know Tcl including is peculiarities. * Relatively "lightweight", i.e. small memory footprint compared to later GUI libraries. * Excellent reputation for its portability across operating systems, its robustness and long-term stability / backward compatibility. * Encourages to use layout management via strategies, not fixed placements. * Enough widgets for all basic tasks, including a (very powerful!) text area and a (rather basic) canvas. --- template: plain name: tk_gui_cons header: ### Tk Con's * If someone does not like Tcl for any reason, probably hard(er) to learn. * Not so may "nifty" widgets as more recent GUI libraries. * Some pre-manufactured standard-dialogues are no shining example for usability. * Can not cope with Qt (also for other reasons) … but does Tk strive to? .N[ Despite of all the above, **Tk is very well suited** for adding a GUI to an embedded device with a touch screen, especially if the device software is based on Linux. ] .F[: This becomes especially visible in the standard file selection dialogue Tk shows under Linux, which is, well, "in need to getting used to". Though, Linux also has so many different file managers that a "standard look & feel", how to present files from which a user can select, is hard to derive. ] --- template: plain name: you_name_it header: ### And More – If Time Allows So you name it … .center[ … otherwise: .N[ ** *Thanks for Listening!* ** ] ] --- template: plain name: emb_tcl_code_walk header: ### Code-Walk through the `emb_tcl` Example To demonstrate the advanced options of Tcl/Tk there is an example in the [sub-directory `emb_tcl`](emb_tcl). It constists of five related examples, demonstrating the communication * between a (hypothetical) application running on a Linux-based embedded board, and * a control application with a Tk-GUI running anywhere on a PC in the network. .N[ The latter needs **not** run Linux, any system for which Tcl/Tk is available will do, i.e. MS-Windows, Apply Macs, etc. but of course most any Linux variant too. ] --- template: plain name: emb_tcl_emb1 header: #### First Mini Server: [`emb1.tcl`](emb_tcl/emb1.tcl) A small **Tcl-only** program written mostly as a "Proof of Concept" how the content of a file._[] can be transferred back and forth between this program and a client ([`emb1_cl.tcl` – see next page](#emb_tcl_emb1_client)). * Excluding comments it has less than 90 lines of code. * Control clients can "come and go" at their will. * Any number of control clients may connect simultaneously … * … and are synchronised with each other. .W[ The communication protocol is deliberately kept trivial and not designed to protect against malicious clients. ] .F[: Many Embedded Linux Systems have device drivers exposing (parts of) their hardware via pseudo-files (like in the `/dev`-directory), so that any application which is able to open files is sufficient may use these. ] --- template: plain name: emb_tcl_emb1_client header: #### First Client Application: [`emb1_cl.tcl`](emb_tcl/emb1_cl.tcl) A Tcl program **with a Tk-based GUI** visualising as check-boxes the values of four `0` or `1` characters, as exchanged with the serving application ([`emb1.tcl` – see previous page](#emb_tcl_emb1)). * Excluding comments it has less than 50 lines of code. * On start-up the current state is read from the serving application. * Changes of the state and of the checkboxes are immediately transmitted (i.e. in both directions). .N[ Any number of such clients may be started and stopped at any time, without affecting the serving application. ] --- template: plain name: emb_tcl_emb2 header: #### Second Mini Server: [`emb2.tcl`](emb_tcl/emb2.tcl) A small **Tcl-only** program written mostly as a "Proof of Concept" how two pipelines,._[] a source and a sink, can be attached and their content transfered between this program and a client ([`emb2_cl.tcl` – see next page](#emb_tcl_emb2_client)). * Excluding comments it has about 100 lines of code. * Control clients can "come and go" at their will. * Any number of control clients may connect simultaneously … * … and are synchronised with each other. .W[ The communication protocol is deliberately kept trivial and not designed to protect against malicious clients. ] .F[: It is a usual style for U*ix device drivers to modell sources that make data available "spontaneously" with blocking read operations, and sinks as pseudo files, not storing the written data but acting on it in some way. ] --- template: plain name: emb_tcl_emb2_client header: #### Second Client Application: [`emb2_cl.tcl`](emb_tcl/emb2_cl.tcl) A Tcl program **with a Tk-based GUI** visualising the data received from the the serving application ([`emb2.tcl` – see previous page](#emb_tcl_emb2)), while allowing to send data back with any move of the slider._[] * Excluding comments it has less than 50 lines of code. * On start-up the current state is read from the serving application. * Changes of the values read and of the slider position are immediately transfered back and forth. .N[ Any number of such clients may be started and stopped at any time, without affecting the serving application. ] .F[: As the serving application suggests, the value displayed may be from an ADC and the slinder might control a DAC. (If you physically build that system you might even connect the output pin of the DAC with the input pin of the ADC via an RC-cirucuit and watch it slowly following the other. ] --- template: plain name: emb_tcl_debugging header: #### Debugging Support For tracing the demo application a number of message issued, categorized as `INFO`, `WARNING`, `ERROR` etc. .N[ These are not only useful for debugging but also to get an initial understanding of the inner workings. ] * The two serving applications make use of it by `source`-ing a Tcl-file … * … but keep silence if that file does not exist. For the more serious Tcl developers various Tcl debuggers are available, both freely and as part of commercial packages. .I[ For a more information on the topic of debugging see: http://wiki.tcl.tk/9715 ] --- template: plain name: emb_tcl_dbg_tcl header: ##### Basic Debugging Support: [`dbg.tcl`] [`dbg.tcl`]: emb_tcl/dbg.tcl This is the basic form, simply printing the trace messages to *standard output* or *standard error*. * Excluding comments it has less than 25 lines of code. * To which channel messages are sent can be configured in a set-up section. * Messages from categories **not mentioned** in the set-up section will not be printed. * Also it can be configured whether some kind of message will be considered "fatal" and end the application.._[] .N[ Simply inlcude the file `dbg.tcl` in an application and send trace or debug output with the command `dbg` followed by a category and the message. ] .F[ The default configuration will terminate the application on any message of the `FATAL` category and continue on every other. ] --- template: plain name: emb_tcl_rdbg_tcl header: ##### Remote Debugging Support: [`rdbg.tcl`] [`rdbg.tcl`]: emb_tcl/rdbg.tcl In this form trace messages are sent over a socket connection to a simple viewer with a Tk-based GUI. * Excluding comments it has less than 100 lines of code. * Whether messages are sent or silently discarded depends on whether the viewer is running._[] * Message colours can be configured in its set-up section. .N[ Includes the file `rdbg.tcl` in an application and start-up the remote viewer by running the same program via the symbolic link `rdbg-gui.tcl`. ] .F[: Detecting the viewer is automatically, but is done with an adaptive algorithm, so that the application is not slowed down too much by frequent failed attempts to establish the connection. ] --- template: plain name: emb_tcl_xdbg_tcl header: ##### Extended Debugging Support: [`xdbg.tcl`] [`xdbg.tcl`]: emb_tcl/xdbg.tcl [`dict`]: https://www.tcl.tk/man/tcl/TclCmd/dict.htm This is an advanced viewer with an inspection feature, therefore crossing the border to a (primitive) debugger: * Excluding comments it has only a little more than 250 lines of code for the GUI part … * … and another about 100 lines that qneed to be added to the application. * It provides various ways to select interactively which messages to view and to hide. * The set-up allows very flexible configuration in [`dict`] (dictionary) style.._[] .N[ To start-up the remote viewer run `xdbg-gui.tcl`. Any application that includes the file `xdbg.tcl` will connect to it. ] .F[: Dictionaries are among the more recent features of Tcl and still not used in many Tcl applications with a long tradition, like Vivado. Be sure to RTFM. ]


import logging
_logger = logging.getLogger(__name__)
import gym
import sys
import os
import numpy as np
import cv2
from .env import Environment
[docs]class AtariEnv(Environment):
""" This class is an implementation of an Atari environment.
We are using the OpenAI Gym version, but pimp it a little with direct access
to some settings from the original ALE implementation.
The environment communicates the possible actions to the agent and provides
an interface to interact and observe changes in the state of the game.
Attributes:
ALL_ACTIONS (Dict): Dictionary that has the action ID as keys and the action name as values.
game (str): Name of the game to load into the emulator.
gym (str): OpenAI Gym environment with the selected game.
train_all (bool): Indicates if the network uses all possible actions as output or only the available ones.
avail_actions (tuple[int]): The IDs of the availabe actions.
n_avail_actions (int): Number of available actions for the agent to select for a specific environment.
avail_actions_indices (tuple): Array with size of n_avail_actions with numbers from n
counts_lives (bool): Indicates if the game has more than one live until game over.
just_lost_live (bool): Indicates if the agent has just lost a live.
current_lives (int): Number of available lives until game over.
current_frame (tuple[int]): The current frame as provided by the gym environment.
terminal_state (bool): Indicates if game over or not.
frame_dims (tuple[int]): Height and width of the current frame.
Note:
More attributes of this class are defined in the base class Environment.
"""
ALL_ACTIONS = {
0 : "NOOP",
1 : "FIRE",
2 : "UP",
3 : "RIGHT",
4 : "LEFT",
5 : "DOWN",
6 : "UPRIGHT",
7 : "UPLEFT",
8 : "DOWNRIGHT",
9 : "DOWNLEFT",
10 : "UPFIRE",
11 : "RIGHTFIRE",
12 : "LEFTFIRE",
13 : "DOWNFIRE",
14 : "UPRIGHTFIRE",
15 : "UPLEFTFIRE",
16 : "DOWNRIGHTFIRE",
17 : "DOWNLEFTFIRE",
}
def __str__(self):
""" Overwrites the object.__str__ method.
Returns:
string (str): Important parameters of the object.
"""
return "'name':" + str(self.name) + ", " + \
"'game':" + str(self.game) + ", " + \
"'actions':" + str(self.avail_actions) + ", " + \
"'actions':" + str((self.gym).get_action_meanings()) + ", " + \
"'n_avail_actions':" + str(self.n_avail_actions)
def __init__(self, args, rng, name = "OpenAIGym"):
""" Initializes the Atari environment.
Args:
args (argparse.Namespace): All settings either with a default value or set via command line arguments.
rng (mtrand.RandomState): Initialized Mersenne Twister pseudo-random number generator.
name (str): The name of the environment object.
Note:
This function should always call the base class first to initialize
the common values for all environments.
"""
_logger.info("Initializing new object of type " + str(type(self).__name__))
super(AtariEnv, self).__init__(name)
self.game = args.game
self.gym = gym.make(self.game)
(self.gym).ale.setInt('random_seed', rng.randint(666))
(self.gym).ale.setInt('frame_skip', args.frame_skip)
(self.gym).ale.setFloat('repeat_action_probability', args.repeat_action_probability)
(self.gym).ale.setBool('color_averaging', args.color_averaging)
self.train_all = args.train_all
self.avail_actions = (self.gym)._action_set
self.n_avail_actions = len(self.avail_actions)
#self.avail_actions_indices = np.arange(len(self.avail_actions))
if (self.gym).ale.lives() == 0:
self.counts_lives = False
else:
self.counts_lives = True
self.just_lost_live = False
self.current_lives = (self.gym).ale.lives()
self.current_frame = None
self.terminal_state = None
# OpenCV expects width as first and height as second s
self.frame_dims = (args.frame_width, args.frame_height)
_logger.debug("%s" % self)
[docs] def reset_env(self):
""" Resets the game parameters to start a new game. """
_logger.debug("Resetting environment and setting terminal=False")
self.current_frame = self.gym.reset()
self.terminal_state = False
if self.counts_lives:
self.just_lost_live = False
self.current_lives = (self.gym).ale.lives()
[docs] def step(self, action):
""" Perform an action and observe the resulting state.
Args:
action (int): Selected action ID to perform in envirnoment.
Returns:
reward (float): The change of score after performing the action.
"""
_logger.debug("Getting index of action %s" % (str(action)))
action = np.where(self.avail_actions == action)[0][0]
self.current_frame, reward, self.terminal_state, info = self.gym.step(action)
self.current_frame = cv2.resize(cv2.cvtColor(self.current_frame, cv2.COLOR_RGB2GRAY), self.frame_dims)
if self.counts_lives:
self.just_lost_live = self.has_just_lost_live()
return reward
[docs] def get_current_frame(self):
""" Check if there actually is current frame and if so return it.
Returns:
current_frame (tuple[int]): The current frame as provided by the gym environment.
"""
_logger.debug("Dims = %s" % str(self.frame_dims))
assert self.current_frame is not None
return self.current_frame
[docs] def is_state_terminal(self):
""" Check if the terminal state indicator is set and if so return it.
Returns:
terminal_state (bool): Indicates if game over or not.
"""
_logger.debug("terminal = %s" % str(self.terminal_state))
assert self.terminal_state is not None
return self.terminal_state
[docs] def has_just_lost_live(self):
""" Check if the agent has just lost a live.
Returns:
just_lost_live (bool): Indicates if the agent has just lost a live.
"""
_logger.debug("%d > %d ?" % (self.current_lives, (self.gym).ale.lives()))
if self.current_lives > (self.gym).ale.lives():
self.current_lives = (self.gym).ale.lives()
return True
return False


| 003:178 Khan | : |
And let not the disbelievers think that Our postponing of their punishment is good for them. We postpone the punishment only so that they may increase in sinfulness. And for them is a disgracing torment. |
| 003:178 Maulana | : |
And let not those who disbelieve think that our granting them respite is good for themselves. We grant them respite only that they may add to their sins; and for them is an humiliating chastisement. |
| 003:178 Pickthal | : |
And let not those who disbelieve imagine that the rein We give them bodeth good unto their souls. We only give them rein that they may grow in sinfulness. And theirs will be a shameful doom. |
| 003:178 Rashad | : |
Let not the disbelievers think that we lead them on for their own good. We only lead them on to confirm their sinfulness. They have incurred a humiliating retribution. |
| 003:178 Sarwar | : |
The unbelievers must not think that Our respite is for their good. We only give them time to let them increase their sins. For them there will be a humiliating torment. |
| 003:178 Shakir | : |
And let not those who disbelieve think that Our granting them respite is better for their souls; We grant them respite only that they may add to their sins; and they shall have a disgraceful chastisement. |
| 003:178 Sherali | : |
And let not the disbelievers think that OUR granting them respite is good for them; in fact the result of OUR granting them respite will only be that they will increase in sin; and they shall have an humiliating punishment. |
| 003:178 Yusufali | : |
Let not the Unbelievers think that our respite to them is good for themselves: We grant them respite that they may grow in their iniquity: But they will have a shameful punishment. |
Concepts/Themes Covered: أركان الإسلام > التوحيد > توحيد الله تعالي > الوعيد Pillars of Islam> Islamic> Oneness of Allah> The Threat أركان الإسلام > التوحيد > الكافرون > صفات الكفار Pillars of Islam> Islamic> The Disbelievers> The Characteristics of the Disbelievers العمل > العمل الطالح > العمل الآثم Action(Work)> Bad Deeds>The Sinful Action
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


[gecode-users] size of the search tree
Christian Schulte
cschulte at kth.se
Fri Mar 30 12:11:44 CEST 2007
Hi,
why would you like to know the size of the tree? Implicitly (assuming that
all branchings are binary, which they are), the size of the tree is almost
known: the number of leaves (failures plus solutions). The only part missing
are the open nodes.
Is it really important? It is somewhat easy to add (the only additional
information needed is the height of the tree) but for example for comparing
models, the number of failures is sufficient.
Cheers
Christian
--
Christian Schulte, http://www.imit.kth.se/~schulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Jean-Noël Monette
Sent: Thursday, March 29, 2007 5:25 PM
To: users at gecode.org
Subject: [gecode-users] size of the search tree
Hello,
Using Gecode, I would like to know what is the size of the search tree
but this information is not given. If recomputation is disabled, I think
that it can be computed as the sum of the number of clone, the number of
fails and the number of solution found. However, when recomputation is
activated, there is not a clone for each node of the search tree and I
don't see how to recover the size of the tree.
Have you any solution?
Thanks a lot for your help,
Jean-Noël Monette
_______________________________________________
Gecode users mailing list
users at gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list


"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PriceLevel = void 0;
var PriceLevel;
(function (PriceLevel) {
/** The price is greater than 90 % and smaller than 115 % compared to average price. */
PriceLevel["NORMAL"] = "NORMAL";
/** The price is greater than 60 % and smaller or equal to 90 % compared to average price. */
PriceLevel["CHEAP"] = "CHEAP";
/** The price is smaller or equal to 60 % compared to average price. */
PriceLevel["VERY_CHEAP"] = "VERY_CHEAP";
/** The price is greater or equal to 115 % and smaller than 140 % compared to average price. */
PriceLevel["EXPENSIVE"] = "EXPENSIVE";
/** The price is greater or equal to 140 % compared to average price. */
PriceLevel["VERY_EXPENSIVE"] = "VERY_EXPENSIVE";
})(PriceLevel = exports.PriceLevel || (exports.PriceLevel = {}));
//# sourceMappingURL=PriceLevel.js.map


I had troubles but I finally managed to get a new VM, I followed StakeNotary readme (KMD is synced and assetchains are under sync). I'm having a small issue with python and slickrpc. I searched this discord and google, I tried few fixes but it didn't work. Do you know how I can run NNvote.py ? I'm on ubuntu and it is a new VM (dedicated for KMDLabs setup).
python NNvote.py Traceback (most recent call last):
File "NNvote.py", line 2, in <module>
import lib
File "/home/administrator/StakedNotary/lib.py", line 11, in <module>
from slickrpc import Proxy
ImportError: No module named slickrpc


You can also use other inputs classes, such as .input-group-prepend or .input-group-append to attach an icon or have text next to the input field.
.input-group-prepend
.input-group-append


We'll keep you bouncing on your feet
Here's a great band for you to checkout
Listen to the best of the best


v Play
c Toggle Pause
x Stop
j k Next / Previous Track (Google Reader style)
n Next Track (same as j, Google Reader style)
b z Next / Previous Track (Winamp Style)
, . Reverse or Skip Ahead 1 second
{ } Reverse or Skip Ahead 5 seconds
[ ] Reverse or Skip Ahead 30 seconds
0 Reset to 0 position
s Toggle Shuffle
m Toggle Mute
? Toggle Help
r Randomize List
d Debug Mode


Heading 1
Heading 2
This is the
Paragraph!
Long sentences are shown here!
This
is
another
Paragraph
Tag!
H
2
0
2
2


Some People Are ‘Genetically Wired’ To Avoid Vegetables
by Lucy ConnollyPicture the scene: you’re about eight years old and have rushed home from school, excited at the prospect of having pizza or something equally as unhealthy for tea.
You run into the kitchen and scream, ‘WHAT’S FOR TEEEEAAAAA’ with pure unbridled joy, slamming down your book bag onto the table as your thoughts immediately turn towards food.
 Obviously, other food was mentioned – your family weren’t monsters, for God’s sake – but your mind focused solely on the one causing you the most anguish.
 But it’s also a well-known fact as we grow up, we tend to grow out of our hatred as our taste buds adapt and vegetables become a part of life.
Not for everyone though, as new research has found some people are ‘genetically wired’ to dislike some vegetables, with those who have two copies of a particular taste gene affected.
US scientists suggested this could explain why some people find it difficult to include enough vegetables in their diet, as the excess gene provides a ‘ruin-your-day’ level of bitterness to foods such as broccoli and sprouts.
The gene may also make beer, coffee and dark chocolate taste unpleasant.
So which gene is actually responsible? Everyone inherits two copies of a taste gene called TAS2R38, which allows us to taste bitterness by encoding for a protein in the taste receptors on the tongue.
However, there are different variants of the gene, with people who inherit two copies of a variant called PAV finding certain foods exceptionally bitter. These people are often referred to as ‘super-tasters’.
In contrast, people who inherit two copies of a variant called AVI are not sensitive to bitter tastes in food at all, whereas those with one copy of AVI and one of PAV perceive bitter tastes slightly.
The scientists studied 175 people and found those with two copies of the PAV variation of the gene only ate small amounts of leafy green vegetables.
Dr Jennifer Smith warned this could prevent some people from eating their recommended five-a-day of fresh fruit and veg, with the doctor adding, ‘You have to consider how things taste if you really want your patient to follow nutrition guidelines.’
Just as we had the coriander debate a few months ago, this new research seems to have given all of us veg-haters an excuse as to why we’re maybe not being as healthy as we possibly could be.
Sorry, doc.
A Broadcast Journalism Masters graduate who went on to achieve an NCTJ level 3 Diploma in Journalism, Lucy has done stints at ITV, BBC Inside Out and Key 103. While working as a journalist for UNILAD, Lucy has reported on breaking news stories while also writing features about mental health, cervical screening awareness, and Little Mix (who she is unapologetically obsessed with).


This is a lightweight landmarks regressor for the Smart Classroom scenario. It has a classic convolutional design: stacked 3x3 convolutions, batch normalizations, PReLU activations, and poolings. Final regression is done by the global depthwise pooling head and FullyConnected layers. The model predicts five facial landmarks: two eyes, nose, and two lip corners.
| Metric | Value |
|---|---|
| Mean Normed Error (on VGGFace2) | 0.0705 |
| Face location requirements | Tight crop |
| GFlops | 0.021 |
| MParams | 0.191 |
| Source framework | PyTorch* |
Normed Error (NE) for ith sample has the following form:
where N is the number of landmarks, p-hat and p are, correspondingly, the prediction and ground truth vectors of kth landmark of ith sample, and di is the interocular distance for ith sample.
Link to performance table
The expected color order is RGB.
[*] Other names and brands may be claimed as the property of others.


KAMAR Calendar allows you to have your school timetable show up in your calendar using an iCal subsciption. It has been tested in Google Calendar and macOS Calendar, but other common calendar applications should work too.
There is more infomation about the app in the GitHub Repo.


Overview
Your character will strip in a pre-determined order, which never changes from game to game. The Wardrobe tab is where you define this order.Each layer of clothing contains extra information about that article that other players will react to - what it covers, how much it covers, etc.
This screen lists out the layers of clothing your character has, ordered in the same order that your character will remove them.
To begin, simply start filling out the first line of the grid with the first article that will be removed.Setting Layers
Strip order can be controlled using layers.- Adding a Layer: Start typing into the last row of the grid to add a new layer. There is technically no limit to the number of layers, but no existing character has more than 8, and the editor will really not appreciate trying to add more than that.
- Removing a Layer: Click the open space to the left of a layer and press Delete to remove it.
- Reordering a Layer: Use the up and down arrows to move a layer around in the strip order.
Be careful changing layers after you've already written dialogue.
Rearranging layers will also rearrange that layer's (stage's) dialogue. While you won't lose any lines (unless you delete a layer, of course), it can be a real pain to update dialogue to reflect the new strip order. If your character is already released, it will be a massive pain for any opponents targeting the old stripping layer. For this reason, many options in the Wardrobe tab are locked down once a character leaves testing. If you really want to change things, you will need to do it manually outside the editor.Layer Data
Each layer has a few relevant pieces of information.- Name (lowercase): What people in the game will call the article of clothing. This should be lowercase. The game will capitalize it automatically where necessary.
- Is Plural: Check this if the clothing is plural (ex. pants, socks, anything where one would say, "Your X are" instead of "Your X is"). This helps dialogue writers use proper grammar when reacting to your clothing.
- Type: How much the clothing covers. Stripping reactions are based on this type.
- extra: Accessories or other minor, non-clothing articles.
- minor: Clothing that covers some skin, but not much. Examples: outer jacket, socks, etc.
- major: Clothing that covers a lot of skin, usually revealing underwear. Examples: shirt, dress, pants, etc.
- important: Clothing that covers a vital body part (chest or genitals). Typically underwear.
- Position: Where the clothing is located. This is both used for determining if an important layer is revealing a character's crotch or chest, and for advanced targeting such as a character recognizing if something was removed from the feet regardless of what that something is called.
- upper: Covers the character's chest
- lower: Covers the character's crotch
- other: Other options have no functional impact, but try to make them as accurate as possible for targeting purposes.


Chances are you are not taking full advantage of the range of investment opportunities offered by Over the Counter (OTC) options. Volos is the first intuitive OTC options analysis platform.
OPTIMIZE
STRUCTURE
ANALYZE
MANAGE
OTC Options
A True Source of Uncorrelated Alpha
There are much better ways to express your ideas than going long or short
A better way to invest in your abilities and accuracy
Margin trading exposes managers to unnecessary risk
You shouldn’t have to be consistently right on big moves up or down
You just have to be right a few times, on any move, or no move at all.


Paint is my preferred medium. I studied oils for a number of years - here are some of my favorite pieces.


Network Visualizer
Edge file (.xls only)
Username
Password
Create Account...
Login with user?
Upload


---
layout: post
title: "MySpace and music videos"
---
One of the things that impressed me initially with MySpace is the music player "widget" they've got all over the site. The player's using Flash to do it's magic, so it works on my machine (a Mac), my wife's machine, nearly everyone's machine. So I nearly fell over in shock when I clicked to watch Gnarls Barkley's video for Crazy, their single off GB's first album St. Elsewhere and received this in the pop-up:
"Sorry, we currently only support Internet Explorer browsers with Windows Media Player 9+"
Ummm....MySpace just a little tip....Flash+Video=Works really well (See YouTube).


by Jakub Blahut
Hybrid development combines the best (or worst) of both the native and HTML5 worlds.
Coded in specific platform language
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1,
width=device-width, height=device-height, target-densitydpi=device-dpi" />
Accelerometer
Camera
Capture
Compass
Connection
Contacts
Device
Events
File
Geolocation
Globalization
InAppBrowser
Media
Notification
Splashscreen
Storage
function onSuccess(acceleration) {
alert('Acceleration X: ' + acceleration.x + '\n' +
'Acceleration Y: ' + acceleration.y + '\n' +
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
};
function onError() {
alert('onError!');
};
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
navigator = global namespace for all API calls
in web browser
in iOS simulator
this presentation
LinkedIn: iOS official
BBC Olympics: official
old Facebook
Thank you, questions?


To Do List
-
Hit the gym
-
Meet George
-
Buy eggs
-
Read a book
-
Organize office
Completed
-
Pay bills
Hit the gym
Meet George
Buy eggs
Read a book
Organize office
Pay bills


THE HEROIC ONES A film review by J. Crawford Copyright 1995 J. Crawford
a.k.a. THIRTEEN FIGHTERS Directed by Chang Cheh - 1970? Running Time - 117 min.
Revenge, burnings, traditional dance numbers, drinking (drunkenness), lechery, attempted rape, plotting, more revenge, ... dynastic intrigue, pageantry, all the elements of a classic Shaw Brothers production (filmed in Shawscope!) are included in THE HEROIC ONES. This gem of the classic age of kung fu movies is directed by the great Chang Cheh who clearly is the forerunner of modern day filmmakers like Tsui Hark and his contemporaries. If you've seen any of Hark's films (SWORDSMAN; WONG FEI HONG 1, 2, 3; ZU, WARRIORS OF MAGIC MOUNTAIN; etc.), you should check out Cheh's HEROIC ONES.
This epic features David Chiang in the role of the 13th prince, a powerful young fighter, one of thirteen brothers who all seem to be skilled martial artists. Chiang, at the time, was a rising young star at the Shaw Brothers studio, Western audiences saw him paired with the late great Peter Cushing a few years later in the Hammer/Shaw Brothers co-production THE LEGEND OF THE 7 GOLDEN VAMPIRES (a.k.a. 7 BROTHERS AGAINST DRACULA).
The 13th prince is the favored son of the king with 13 sons. he appears to be the youngest, brashest, strongest, and most charming of the 13 brothers. His lofty status with the king causes jealousy among a couple of his brothers which leads to a very gruesome family feud. throughout this adventure there are a number of excellent fighting scenes. The last third of the film is full of great sword-fighting and super kung fu.
Director Chang Cheh has made over a hundred films in his long and illustrious career. His work for the Shaw Brothers studio represents the best films produced during the 1960s and early 1970s at that most renowned motion picture factory. His use of lighting and costumes to establish character is outstanding here. His camera seems to be always moving into the action and the editing draws the viewer in to the story at hand.
All the performers do well in their roles. Ti Lung performs well as the 11th prince as does Chin Han in his role as the eldest son. Han turns in a surprisingly poignant performance. there are many good scenes in THE HEROIC ONES but one of the very best is an extended scene in which Ti Lung must rescue his father from an assassination attempt and together they must fight their way out of the enemy's city.
This is apparently a complete version of the film and it contains one of the bloodiest, most visceral murders that I can recall seeing in any Shaw Brothers film of that era. It took this viewer completely by surprise and I loved it. The screenplay, up to that point, gives no indication of this scene happening and when it does, it blows you away. There are some universal ideas and concepts included in THE HEROIC ONES that are clearly expressed in this wonderful film without spoken words. Clearly, Chang Cheh should have a place of honor in the history of global cinema.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


I am a Web Developer with 2 years commercial experience and graduate of Computer Engineering. I create successful websites that are fast, easy to use, and built with best practices. I am currently working in Bhipra Software Solution as a Web Developer.
My main experience is in front-end development but I also work on back-end technologies. Given that producing a modern website requires the combination of design, server technology, and the layer that users interacts with, I believe having experience in both design and development allows for making the most optimal user experiences.
Below, I have listed the services that I offer to my clients along with a brief description.
I am capable to offer comprehensive UI/UX services that include branding, responsive web design, mobile app design, user experience consulting, and promotional designs using the latest tools and technologies.
My custom web design services help to convey your intended business messaage clearly and with an impact. My web design work is clean and has integrated content management system for easy editing and handling of content.
The outputs of my web development services are creating lasting impressions, both visually and interactively. It can transcend the physical and start to connect with people in a way that is transformational on the web.
I am using modern SEO services, backed by the best digital practices, to increase your traffic & rankings for vetted keywords and long-tail phrases that drive business to your site.


---
layout: post
title: Client list template
date: '2018-08-13T05:32:18+02:00'
categories:
- Templates
picture_url: https://film-Storyboards.tumblr.com/post/176946570736/client-list-template
---
A free spreadsheet template to help freelancers keeping track of prospective clients.
This is a template for Apple Numbers (.nmbtemplate file), so Mac users only.


Intro to Aurelia
- CEO Rob Eisenberg - Article
- M$
- Angular 2 core team
- Durandal
- Plain modern JS
- Open source - MIT license
Getting Started 2
- npm install -g aurelia-cli
- au new project_name
- au run --watch
- localhost:9000
Out of the Box
- Gulp
- ESNext (Current ES ++) or TypeScript
- Bluebird for Promises
- CSS: Less, Sass, Stylus, Post CSS, etc
- Default Editor support (VS Code, Atom, Sublime, Webstorm)
- Javascript Package Manager (JSPM)
- Optional testing framework: Jasmine / Karma
- Simple clean code / ES6 / ES7 (decorators)
- Convention over Configuration, but can override
- Code changes - auto reloads
- Testability, maintainability, extensibility, learnability
- Custom CLI generators
- Modular code packages => portable other places
- Unit and Integration testing
- Commercial Support
- Aurelia's dependencies are only polyfill
Cons
- Still at early stage 1.X
- Recommended Directory structure?
- Not as strict as Ember conventions
- Where to put local images?
- Gulp build / export?
- Documentation / Examples / Sample projects
Components (Elements)
- au generate element component-name
- Creates .js and .html in src/resources/elements folder
Element Template
<template>
<input value.bind="firstName">
<input value.bind="lastName">
<button click.trigger="sayHello()">Say Hello</button>
</template>
Element Javascript
export class Hello {
firstName = 'John';
lastName = 'Doe';
sayHello() {
alert(`Hello ${this.firstName} ${this.lastName}`);
}
}
Require
- Imports resources (js/css) for templates
<require from="bootstrap/css/bootstrap.css"></require>
<require from="./currency-format"></require>
Bindings
- one-time (one-way)
- one-way
- two-way
- bind (auto select - two-way for forms)
- I.E. Binds attribute of value for input whether data or form changes
E.G. <input type="text" value.two-way="lastName">


|
RayTracer
|
Interface for nodes in CSG-Tree according to composition-pattern. More...
#include <CSG.h>
Public Member Functions | |
| virtual double | distance_bound (const Vector3D &pos) const =0 |
| virtual BoundingBox | get_bounds () const =0 |
| virtual CSGComponent * | deep_copy () const =0 |
| virtual | ~CSGComponent ()=default |
Interface for nodes in CSG-Tree according to composition-pattern.
Note, that CSGComponent is not renderable and is not affiliated with SDFObject. Although its methods have the same names, they have (formally) nothing to do with SDFObject or BoundingBox methods.
|
virtualdefault |
|
pure virtual |
Implemented in CSGLeaf, CSGDifference, CSGIntersection, and CSGUnion.
|
pure virtual |
Implemented in CSGLeaf, CSGDifference, CSGIntersection, and CSGUnion.
|
pure virtual |
Implemented in CSGLeaf, CSGDifference, CSGIntersection, and CSGUnion.


Booming Mind Classes
{{ course.CourseCode }} - {{course.CourseName}}
Date
Time
Location
# of students signed up
{{cls.Date}}
{{cls.TimeBegin}} - {{cls.TimeEnd}}
{{cls.Location}}
{{cls.NumEnrolled}}


A PERFECT WORLD [Spoilers] A film review by Richard Montanari Copyright 1993 Richard Montanari
Unforgivable
What makes A PERFECT WORLD such a huge disappointment is not just the fact that it is, without peer, the worst film Clint Eastwood has ever directed, but also that it held the rare romise of combining the talents of two Oscar-winning directors: Eastwood and Kevin Costner.
The story is set in Texas, two weeks before JFK's fateful day at Dealey Plaza. This is mentioned early in the film, then never brought up again. A simple "1963" at the bottom of the screen would have sufficed, but that might have excised some of screenwriter John Lee Hancock's precious dialogue. And there's a *lot* of dialogue here, bubba.
An escaped convict, Butch Haynes (Costner), takes an eight-year-old Jehovah's Witness boy hostage and hits the road for a little psycho-daddy and son bonding. We never get to know for sure just what Butch did to put him in the joint, but we do learn that he killed a man when he was eight, and that his mother was a hooker, so we know he didn't grow up next door to the Cleavers. The Meat Cleavers, maybe.
In lukewarm pursuit is Texas Ranger Red Garnett (Eastwood), a Geritol-swiggin' veteran cop who doesn't take guff from anyone, exceptin' feisty criminologist Sally Gerber (Laura Dern), who pops up every so often for a little feminist relief and obligatory psychobabble. There's also a black-suited and sunglassed Fed around for stone-faced quips.
Oh, yeah, Red and his team phone the entire manhunt in from an Airstream trailer which has crashed into a tree in the woods.
When Butch finds out that Phillip (T. J. Lowther) has never been trick or treating he decides to give the kid a taste of normal childhood. They stop at a general store for a costume, and things move along just fine until, all of a sudden, The Guy at the Back of the Store hears The Broadcast about The Escaped Convict and starts giving them The Eye. The duo make a run for it, and soon we discover that the kid has stolen a Casper the Friendly Ghost costume. Twenty minutes on the road and the kid goes from Jehovah to John Dillinger.
Over the next day or so Butch and Buzz (Phillip's new nom de rue) take in a little gunpoint trick-or-treating, a little more larceny and, after eating dinner and spending the night with a poor farmer's family, a little pistol-whipping and duct-taping of the man, his wife and their grandson.
[Spoilers]
Eventually, Butch takes the mandatory gut shot as the Rangers close in -- beginning one of the longest death scenes in cinematic history -- and heads off to a better place. Which, for the audience, after more than two hours, means the lobby, the parking lot and then home.
What possessed Eastwood to believe that Kevin Costner could pull off the wacko-with-a-heart-of-gold is beyond me, as is Costner's tradition of astonishingly bad haircuts. (Although, this is the first film where we know for a fact it was cut in prison.)
Yet, ultimately, the blame must lie with Clint Eastwood, who follows the brilliance of Unforgiven, and his chunky performance in In the Line of Fire with such a lethargic, ill-conceived effort. Had he won the best director Oscar for Bird, like he should have, and followed it with Unforgiven, this wouldn't seem so bad. But alas, in spite of its promise, The Man with No Name has made a Film with No Soul.
~~~
A Perfect World: C- Rated PG-13
c. 1993 Richard Montanari CompuServe: 73112, 3705 InterNet<EMAIL_ADDRESS>.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


切换导航
Dashboard
RouterStatus
ActiveHosts
Config Settings
Client Setting
ReserveProxy Setting
Start Proxy Service
Stop Proxy Service
Reload Proxy Service


Our evidence briefings contain a one-page summary of the most recent research on modern code reviews. Based on your answers in the survey, we have selected the briefing(s) that you likely find the most interesting. We provide all summaries on our evidence briefings page.


--- layout: jsdoc title: "Class: CacheExpiration" jsdocNav: - Modules: - workbox-background-sync - workbox-broadcast-cache-update - workbox-build - workbox-cache-expiration - workbox-cacheable-response - workbox-google-analytics - workbox-precaching - workbox-routing - workbox-runtime-caching - workbox-sw - workbox-webpack-plugin ---
The CacheExpiration
class allows you define an expiration and / or
limit on the responses cached.
const cacheExpiration = new workbox.cacheExpiration.CacheExpiration({
maxEntries: 2,
maxAgeSeconds: 10,
});
Creates a new CacheExpiration
instance, which is used to remove entries
from a Cache
once certain criteria—max number of entries, age of entry, or both—is met.
| Parameters |
|
|---|
Expires entries based on the the maximum age and the maximum number of entries defined in the constructor.
To avoid concurrency issues, calls to this method when it's already running will result in the call begin re-run after the current execution has finished.
// Assume that entries have been added to 'example-cache-name', and that
// updateTimestamp() was called after each entry was added.
cacheExpiration.expireEntries({
cacheName: 'example-cache-name'
});
| Parameters |
|
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
Promise
Resolves when the cache expiration has been performed. If the function is currently executing the Promise will resolve immediately. |
Checks whether a Response
is "fresh", based on the Response's
Date
header and the maxAgeSeconds
parameter passed into the
constructor.
If maxAgeSeconds
or the Date
header is not set then it will
default to returning true
, i.e. the response is still fresh and should
be used.
expirationPlugin.isResponseFresh({
cachedResponse: responseFromCache
});
| Parameters |
|
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
boolean
Either |
Updates the timestamp stored in IndexedDB for url
to be equal to now
.
When using this class directly (i.e. not via CacheExpirationPlugin
),
it's your responsibility to call updateTimestap()
each time an entry is
put into the cache. Otherwise, the expireEntries()
method will not
know which entries to remove.
expirationPlugin.updateTimestamp({
cacheName: 'example-cache-name',
url: '/example-url'
});
| Parameters |
|
|---|


Behavior
Pokemon can curl up into a ball and roll to attack, escape or protect the belly. He also famously climbs trees and ambushes enemies.


Applies To
Solution Example
#! /usr/bin/env python
import os
import stat
import shutil
import sys
tmpdir = './mytmp'
# Create secure temp directory on startup
try:
os.mkdir(tmpdir)
except OSError:
print "Temporary directory already exists."
sys.exit()
# Restrict access to directory making it a secure location for temp files
os.chmod(tmpdir, stat.S_IRWXU)
tmpfile = tmpdir + "/temporary_file"
with open(tmpfile, 'w') as f:
f.write("Some temporary content here.")
# Cleanup temporary file once done
os.unlink(tmpfile)
# Remove temp directory on exit
shutil.rmtree(tmpdir)


DARA
This game from (at least) the XIXth century, is played in Nigeria by the Dakarkari people. Lada Urbanova knows this game under the name "Doki" meaning "horse" in Haussa language. It's another clever relative of Tic-Tac-Toe. The game starts in an empty 5x6 square board.
- FIRST PHASE [DROP] - Players alternate moves by dropping 24 stones (12 for each) into empty cells..
- SECOND PHASE [MOVE] - Each player moves a stone into an adjacent orthogonal empty cell.
- CAPTURE - When a player makes a 3 in-a-row (no diagonals, no 4+ in a row), it removes one enemy stone from the board which is not part of a 3 in-a-row.
- GOAL - A player wins, when his opponent is unable to form 3 in a row with his stones.
An example Black moves c6 to cell [1] and captures c3. White has no good moves and will loose the game (he cannot prevent Black's d4-d3, e4-d4)


Logrotate Issues after Linux Distribution Upgrade
Dec 22, 2014
The one in which your web and database server log files stop rotating properly
I received a dreaded “The web site is down!” call from a client this morning. I had stepped away from the computer and when I sat down to take a look at the problem my inbox was full with site outage notifications.
The VPS was non-responsive so I had to force reboot the server from the VMWare master. None of the other VM’s on the server were affected - just this one, which is running a LA(N)PP stack on SuSE 13.3. Once I got the server back up and running again, it was time to dig in to the logs to see what had caused the issue.
A look at /var/log/messages showed the last item logged before the system became non-responsive was an entry for syslog-ng, and then nothing until the reboot. Next I went and looked at the web server logs.
This particular machine uses NGINX as a reverse proxy for Apache. NGINX handles the static files (which it does really, really well) on Port 80 and high-level request caching, while Apache handles serving PHP and all requests on Port 443 (There is a method to this madness, which I’ll discuss in a future post). In addition, NGINX also reverse proxies to three other servers so the log for that site logs every requests to those subapps running on other servers.
The NGINX log for the site showed a filesize of nearly 1GB, which shouldn’t have happened, as rotation happens daily, plus the max filesize on that log is set at 4MB. Big problem.
Running logrotate in debug mode manually, logrotate -dv /etc/logrotate.conf
, returned the following message regarding the NGINX log (along with similar messages for few others):
error: skipping "/var/log/nginx/mysite.com.access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
Root cause found. After some digging in to the whys, it turns out the version of logrotate on SuSE 13.3, which this machine was upgraded to two weeks ago now requires explicit directory permissions to be specified in the logrotate command unless the the directory is chowned root:root. This change was introduced in logrotate version 3.8.0 so the this issue applies to all linux distros using that version or above.
On this system NGINX runs in group “nginx” and Apache runs in group “www” so adding the following to the configuration block in /etc/logrotate.d/nginx fixed the problem: su root nginx
.
The final configuration block looks like:
/var/log/nginx/*.log {
su root nginx
compress
dateext
maxage 365
rotate 99
size=+4096k
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/nginx reopen
endscript
}
I also had to change all of the Apache logrotate entry blocks to su root www
as the ownership permissions on those directories need to be writeable by the group in which httpd runs. If you’re running MySQL/MariaDB, you’ll need to change add su root mysql
to any config blocks in /etc/logrotate.d/mysql as well. PostgreSQL handles its own log rotation, so those will not be an issue.
Since this applies to all Linux distros running logrotate 3.8.0 and above, it’s worthy of a quick check of your systems, if you’ve upgraded recently. Running ls -l
from within your /var/log directory should allow you to pull the correct group names to ensure log rotation will keep functioning properly. If you started with a fresh machine running those versions, your package manager installation will add those blocks automatically.