Contents
Overview
A standard C++ library for interacting with the Sidecar Event API. Developed for use on Arduino platform, but was developed and tested on Mac OS X and Windows.
The library exposes two interfaces. A simple (SimpleSidecarClient) Arduino specific class that abstracts the raw C++ API, and the raw C++ API that can be used from all platforms (including Arduino).
Workflow
The general workflow for publishing an event to the Sidecar Event API is as follows:
- Register with Sidecar and provision your application with an access key/secret pair.
- While bootstrapping your application, provision a user account (email address/password) and retrieve the user access key/secret pair. Use the user access key/secret to initialise the library.
- Create an instance of qsense::Event.
- Add instances of qsense::Reading to the event.
- Add any tag values to the event (tags are instances of qsense::QString).
- Create an instance of qsense::net::SidecarClient
- Publish the event using qsense::net::SidecarClient::publish
The simplified Arduino client encapsulates all these steps and variety of classes into a single class. There is no need to create instances of qsense::Event or qsense::Reading. You can add reading data directly to the client and then publish the accumulated readings as one event.
Initialisation
The QSense Sidecar Library needs some initialisation (from the Arduino sketch for instance). The accompanying example sketches illustrate the recommended way of initialising the library.
Simple Arduino API
- Initialise the library with the type of networking used by the device using the SimpleSidecarClient::initNetworkType static method.
- Initialise the UUID engine with a proper MAC address using the SimpleSidecarClient::initUUID methods. Note, that there is an overloaded version of the method that will generate a random MAC address to use to initialise the UUID engine.
Provisioning API
Event API
Core API
- Initialise the library with the type of networking used by the device. Use the qsense::net::initNetworkType( qsense::net::NetworkType ) function to indicate the type of network being used.
- Initialise the UUID engine with a proper MAC address (qsense::UUID::init). Official Arduino ethernet shields come with a MAC address labelled on the board (as per Arduino documentation). If using WiFi, the Arduino WiFi API allows lookup of the current MAC address. A stable and unique MAC address is essential for ensuring that UUID values generated (generates time based values) are truly universally unique.
- Initialise the API with the application access key/secret pair. Use the qsense::net::SidecarClient::initAPIKey method.
- Authenticate (or create a user account) with the Sidecar service using user's email address and password. This will retrieve the user access key/secret pair that will be used to submit sensor data to Sidecar. Use the qsense::net::SidecarClient::authenticate or qsense::net::SidecarClient::createUser methods to authenticate or create and provision the user account.
- Initialise the Sidecar library with the user access key and secret used for authentication/authorisation (qsense::net::SidecarClient::initUserKey).
- Initialise the Event API with the stream identifier, device UUID, and a default geographic qsense::Location (qsense::Event::init).
Seed Studio Ethernet Shield
The standard Arduino Ethernet Library seems to be incompatible with Arduino Mega boards (the board the library supports). For users of the common Seed Studio Ethernet Shield, Seed Studio provides their own Ethernet Shield V2.0 library (which is also included in the source distribution for convenience). Separate example sketches (ending with -SeedStudio) are provided for use with Seed Studio Ethernet Shields. A minor modification to the QSense.h file is necessary to be able to use the Seed Studio library (documented in the example sketches as well). Set the USE_Ethernet_Shield_V2
to 1 in QSense.h to use the Seed Studio Ethernet library instead of the standard Arduino Ethernet library.
Debug Output
To enable debug information (print request/response data to the Serial interface), edit the QSense.h file and set the value of DEBUG
to 1. The default value is 0, and no debug information will be output by the API. Users building applications using tools other than the official Arduino IDE may be able to specify the DEBUG pre-processor definition as part of the build process.
Publish Sensor Data
Once the Sidecar library has been properly initialised with the user access key and secret combination, sensor data may be published to Sidecar as events at any time.
Simple Arduino API
Core API
Libraries
The only third-party library necessary is the Standard C++ Library.
- Standard C++
- Ethernet Shield V2.0 for Seed Studio Ethernet boards
- Poco - needed for using on non-Arduino platforms (for network interactions). We have tested only on Mac OS X and Windows, however Poco runs on most platforms including iOS and Android.


Datapoint. More...
Public Member Functions | |
| (id) | - init |
| Default constructor for a new object. | |
| (NSString *) | - description |
| Returns a string representation of this object; useful for testing and debugging. | |
Properties | |
| NSDate * | timestamp |
| The time stamp used for the datapoint. | |
| NSNumber * | sampleCount |
| The number of metric values that contributed to the aggregate value of this datapoint. | |
| NSNumber * | average |
| The average of metric values that correspond to the datapoint. | |
| NSNumber * | sum |
| The sum of metric values used for the datapoint. | |
| NSNumber * | minimum |
| The minimum metric value used for the datapoint. | |
| NSNumber * | maximum |
| The maximum of the metric value used for the datapoint. | |
| NSString * | unit |
| The standard unit used for the datapoint. |
Datapoint.
| - (NSString * CloudWatchDatapoint.)description |
Returns a string representation of this object; useful for testing and debugging.
| - (id CloudWatchDatapoint.)init |
Default constructor for a new object.
Callers should use the property methods to initialize this object after creating it.
- (NSString *) unit [read, write, retain] |
The standard unit used for the datapoint.
Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None


PCRETEST
Section: User Commands (1)Index Return to Main Contents
NAME
pcretest - a program for testing Perl-compatible regular expressions.SYNOPSIS
pcretest [options] [source] [destination]
pcretest was written as a test program for the PCRE regular expression library itself, but it can also be used for experimenting with regular expressions. This document describes the features of the test program; for details of the regular expressions themselves, see the pcrepattern documentation. For details of the PCRE library function calls and their options, see the pcreapi documentation.
OPTIONS
- -b
- Behave as if each regex has the /B (show byte code) modifier; the internal form is output after compilation.
- -C
- Output the version number of the PCRE library, and all available information about the optional features that are included, and then exit.
- -d
- Behave as if each regex has the /D (debug) modifier; the internal form and information about the compiled pattern is output after compilation; -d is equivalent to -b -i.
- -dfa
- Behave as if each data line contains the \D escape sequence; this causes the alternative matching function, pcre_dfa_exec(), to be used instead of the standard pcre_exec() function (more detail is given below).
- -help
- Output a brief summary these options and then exit.
- -i
- Behave as if each regex has the /I modifier; information about the compiled pattern is given after compilation.
- -m
- Output the size of each compiled pattern after it has been compiled. This is equivalent to adding /M to each regular expression. For compatibility with earlier versions of pcretest, -s is a synonym for -m.
- -o osize
- Set the number of elements in the output vector that is used when calling pcre_exec() or pcre_dfa_exec() to be osize. The default value is 45, which is enough for 14 capturing subexpressions for pcre_exec() or 22 different matches for pcre_dfa_exec(). The vector size can be changed for individual matching calls by including \O in the data line (see below).
- -p
- Behave as if each regex has the /P modifier; the POSIX wrapper API is used to call PCRE. None of the other options has any effect when -p is set.
- -q
- Do not output the version number of pcretest at the start of execution.
- -S size
- On Unix-like systems, set the size of the run-time stack to size megabytes.
- -t
- Run each compile, study, and match many times with a timer, and output resulting time per compile or match (in milliseconds). Do not set -m with -t, because you will then get the size output a zillion times, and the timing will be distorted. You can control the number of iterations that are used for timing by following -t with a number (as a separate item on the command line). For example, "-t 1000" would iterate 1000 times. The default is to iterate 500000 times.
- -tm
- This is like -t except that it times only the matching phase, not the compile or study phases.
DESCRIPTION
If pcretest is given two filename arguments, it reads from the first and writes to the second. If it is given only one filename argument, it reads from that file and writes to stdout. Otherwise, it reads from stdin and writes to stdout, and prompts for each line of input, using "re>" to prompt for regular expressions, and "data>" to prompt for data lines. When pcretest is built, a configuration option can specify that it should be linked with the libreadline library. When this is done, if the input is from a terminal, it is read using the readline() function. This provides line-editing and history facilities. The output from the -help option states whether or not readline() will be used. The program handles any number of sets of input on a single input file. Each set starts with a regular expression, and continues with any number of data lines to be matched against the pattern. Each data line is matched separately and independently. If you want to do multi-line matches, you have to use the \n escape sequence (or \r or \r\n, etc., depending on the newline setting) in a single line of input to encode the newline sequences. There is no limit on the length of data lines; the input buffer is automatically extended if it is too small. An empty line signals the end of the data lines, at which point a new regular expression is read. The regular expressions are given enclosed in any non-alphanumeric delimiters other than backslash, for example:
/(a|bc)x+yz/
White space before the initial delimiter is ignored. A regular expression may be continued over several input lines, in which case the newline characters are included within it. It is possible to include the delimiter within the pattern by escaping it, for example
/abc\/def/
If you do so, the escape and the delimiter form part of the pattern, but since delimiters are always non-alphanumeric, this does not affect its interpretation. If the terminating delimiter is immediately followed by a backslash, for example,
/abc/\
then a backslash is added to the end of the pattern. This is done to provide a way of testing the error condition that arises if a pattern finishes with a backslash, because
/abc\/
is interpreted as the first line of a pattern that starts with "abc/", causing pcretest to read the next line as a continuation of the regular expression.
PATTERN MODIFIERS
A pattern may be followed by any number of modifiers, which are mostly single characters. Following Perl usage, these are referred to below as, for example, "the /i modifier", even though the delimiter of the pattern need not always be a slash, and no slash is used when writing modifiers. White space may appear between the final pattern delimiter and the first modifier, and between the modifiers themselves. The /i, /m, /s, and /x modifiers set the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when pcre_compile() is called. These four modifier letters have the same effect as they do in Perl. For example:
/caseless/i
The following table shows additional modifiers for setting PCRE options that do not correspond to anything in Perl:
/A PCRE_ANCHORED
/C PCRE_AUTO_CALLOUT
/E PCRE_DOLLAR_ENDONLY
/f PCRE_FIRSTLINE
/J PCRE_DUPNAMES
/N PCRE_NO_AUTO_CAPTURE
/U PCRE_UNGREEDY
/X PCRE_EXTRA
/<JS> PCRE_JAVASCRIPT_COMPAT
/<cr> PCRE_NEWLINE_CR
/<lf> PCRE_NEWLINE_LF
/<crlf> PCRE_NEWLINE_CRLF
/<anycrlf> PCRE_NEWLINE_ANYCRLF
/<any> PCRE_NEWLINE_ANY
/<bsr_anycrlf> PCRE_BSR_ANYCRLF
/<bsr_unicode> PCRE_BSR_UNICODE
Those specifying line ending sequences are literal strings as shown, but the letters can be in either case. This example sets multiline matching with CRLF as the line ending sequence:
/^abc/m<crlf>
Details of the meanings of these PCRE options are given in the pcreapi documentation.
Finding all matches in a string
Searching for all possible matches within each subject string can be requested by the /g or /G modifier. After finding a match, PCRE is called again to search the remainder of the subject string. The difference between /g and /G is that the former uses the startoffset argument to pcre_exec() to start searching at a new point within the entire string (which is in effect what Perl does), whereas the latter passes over a shortened substring. This makes a difference to the matching process if the pattern begins with a lookbehind assertion (including \b or \B). If any call to pcre_exec() in a /g or /G sequence matches an empty string, the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED flags set in order to search for another, non-empty, match at the same point. If this second match fails, the start offset is advanced by one, and the normal match is retried. This imitates the way Perl handles such cases when using the /g modifier or the split() function.
Other modifiers
There are yet more modifiers for controlling the way pcretest operates. The /+ modifier requests that as well as outputting the substring that matched the entire pattern, pcretest should in addition output the remainder of the subject string. This is useful for tests where the subject contains multiple copies of the same substring. The /B modifier is a debugging feature. It requests that pcretest output a representation of the compiled byte code after compilation. Normally this information contains length and offset values; however, if /Z is also present, this data is replaced by spaces. This is a special feature for use in the automatic test scripts; it ensures that the same output is generated for different internal link sizes. The /L modifier must be followed directly by the name of a locale, for example,
/pattern/Lfr_FR
For this reason, it must be the last modifier. The given locale is set, pcre_maketables() is called to build a set of character tables for the locale, and this is then passed to pcre_compile() when compiling the regular expression. Without an /L modifier, NULL is passed as the tables pointer; that is, /L applies only to the expression on which it appears. The /I modifier requests that pcretest output information about the compiled pattern (whether it is anchored, has a fixed first character, and so on). It does this by calling pcre_fullinfo() after compiling a pattern. If the pattern is studied, the results of that are also output. The /D modifier is a PCRE debugging feature, and is equivalent to /BI, that is, both the /B and the /I modifiers. The /F modifier causes pcretest to flip the byte order of the fields in the compiled pattern that contain 2-byte and 4-byte numbers. This facility is for testing the feature in PCRE that allows it to execute patterns that were compiled on a host with a different endianness. This feature is not available when the POSIX interface to PCRE is being used, that is, when the /P pattern modifier is specified. See also the section about saving and reloading compiled patterns below. The /S modifier causes pcre_study() to be called after the expression has been compiled, and the results used when the expression is matched. The /M modifier causes the size of memory block used to hold the compiled pattern to be output. The /P modifier causes pcretest to call PCRE via the POSIX wrapper API rather than its native API. When this is done, all other modifiers except /i, /m, and /+ are ignored. REG_ICASE is set if /i is present, and REG_NEWLINE is set if /m is present. The wrapper functions force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set. The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 option set. This turns on support for UTF-8 character handling in PCRE, provided that it was compiled with this support enabled. This modifier also causes any non-printing characters in output strings to be printed using the \x{hh...} notation if they are valid UTF-8 sequences. If the /? modifier is used with /8, it causes pcretest to call pcre_compile() with the PCRE_NO_UTF8_CHECK option, to suppress the checking of the string for UTF-8 validity.
DATA LINES
Before each data line is passed to pcre_exec(), leading and trailing white space is removed, and it is then scanned for \ escapes. Some of these are pretty esoteric features, intended for checking out some of the more complicated features of PCRE. If you are just testing "ordinary" regular expressions, you probably don't need any of these. The following escapes are recognized:
\a alarm (BEL, \x07)
\b backspace (\x08)
\e escape (\x27)
\f form feed (\x0c)
\n newline (\x0a)
\qdd set the PCRE_MATCH_LIMIT limit to dd
(any number of digits)
\r carriage return (\x0d)
\t tab (\x09)
\v vertical tab (\x0b)
\nnn octal character (up to 3 octal digits)
\xhh hexadecimal character (up to 2 hex digits)
\x{hh...} hexadecimal character, any number of digits
in UTF-8 mode
\A pass the PCRE_ANCHORED option to pcre_exec()
or pcre_dfa_exec()
\B pass the PCRE_NOTBOL option to pcre_exec()
or pcre_dfa_exec()
\Cdd call pcre_copy_substring() for substring dd
after a successful match (number less than 32)
\Cname call pcre_copy_named_substring() for substring
"name" after a successful match (name terminated
by next non-alphanumeric character)
\C+ show the current captured substrings at callout
time
\C- do not supply a callout function
\C!n return 1 instead of 0 when callout number n is
reached
\C!n!m return 1 instead of 0 when callout number n is
reached for the nth time
\C*n pass the number n (may be negative) as callout
data; this is used as the callout return value
\D use the pcre_dfa_exec() match function
\F only shortest match for pcre_dfa_exec()
\Gdd call pcre_get_substring() for substring dd
after a successful match (number less than 32)
\Gname call pcre_get_named_substring() for substring
"name" after a successful match (name terminated
by next non-alphanumeric character)
\L call pcre_get_substringlist() after a
successful match
\M discover the minimum MATCH_LIMIT and
MATCH_LIMIT_RECURSION settings
\N pass the PCRE_NOTEMPTY option to pcre_exec()
or pcre_dfa_exec()
\Odd set the size of the output vector passed to
pcre_exec() to dd (any number of digits)
\P pass the PCRE_PARTIAL option to pcre_exec()
or pcre_dfa_exec()
\Qdd set the PCRE_MATCH_LIMIT_RECURSION limit to dd
(any number of digits)
\R pass the PCRE_DFA_RESTART option to pcre_dfa_exec()
\S output details of memory get/free calls during matching
\Z pass the PCRE_NOTEOL option to pcre_exec()
or pcre_dfa_exec()
\? pass the PCRE_NO_UTF8_CHECK option to
pcre_exec() or pcre_dfa_exec()
\>dd start the match at offset dd (any number of digits);
this sets the startoffset argument for pcre_exec()
or pcre_dfa_exec()
\<cr> pass the PCRE_NEWLINE_CR option to pcre_exec()
or pcre_dfa_exec()
\<lf> pass the PCRE_NEWLINE_LF option to pcre_exec()
or pcre_dfa_exec()
\<crlf> pass the PCRE_NEWLINE_CRLF option to pcre_exec()
or pcre_dfa_exec()
\<anycrlf> pass the PCRE_NEWLINE_ANYCRLF option to pcre_exec()
or pcre_dfa_exec()
\<any> pass the PCRE_NEWLINE_ANY option to pcre_exec()
or pcre_dfa_exec()
The escapes that specify line ending sequences are literal strings, exactly as shown. No more than one newline setting should be present in any data line. A backslash followed by anything else just escapes the anything else. If the very last character is a backslash, it is ignored. This gives a way of passing an empty line as data, since a real empty line terminates the data input. If \M is present, pcretest calls pcre_exec() several times, with different values in the match_limit and match_limit_recursion fields of the pcre_extra data structure, until it finds the minimum numbers for each parameter that allow pcre_exec() to complete. The match_limit number is a measure of the amount of backtracking that takes place, and checking it out can be instructive. For most simple matches, the number is quite small, but for patterns with very large numbers of matching possibilities, it can become large very quickly with increasing length of subject string. The match_limit_recursion number is a measure of how much stack (or, if PCRE is compiled with NO_RECURSE, how much heap) memory is needed to complete the match attempt. When \O is used, the value specified may be higher or lower than the size set by the -O command line option (or defaulted to 45); \O applies only to the call of pcre_exec() for the line in which it appears. If the /P modifier was present on the pattern, causing the POSIX wrapper API to be used, the only option-setting sequences that have any effect are \B and \Z, causing REG_NOTBOL and REG_NOTEOL, respectively, to be passed to regexec(). The use of \x{hh...} to represent UTF-8 characters is not dependent on the use of the /8 modifier on the pattern. It is recognized always. There may be any number of hexadecimal digits inside the braces. The result is from one to six bytes, encoded according to the original UTF-8 rules of RFC 2279. This allows for values in the range 0 to 0x7FFFFFFF. Note that not all of those are valid Unicode code points, or indeed valid UTF-8 characters according to the later rules in RFC 3629.
THE ALTERNATIVE MATCHING FUNCTION
By default, pcretest uses the standard PCRE matching function, pcre_exec() to match each data line. From release 6.0, PCRE supports an alternative matching function, pcre_dfa_test(), which operates in a different way, and has some restrictions. The differences between the two functions are described in the pcrematching documentation. If a data line contains the \D escape sequence, or if the command line contains the -dfa option, the alternative matching function is called. This function finds all possible matches at a given point. If, however, the \F escape sequence is present in the data line, it stops after the first match is found. This is always the shortest possible match.
DEFAULT OUTPUT FROM PCRETEST
This section describes the output when the normal matching function, pcre_exec(), is being used. When a match succeeds, pcretest outputs the list of captured substrings that pcre_exec() returns, starting with number 0 for the string that matched the whole pattern. Otherwise, it outputs "No match" or "Partial match" when pcre_exec() returns PCRE_ERROR_NOMATCH or PCRE_ERROR_PARTIAL, respectively, and otherwise the PCRE negative error number. Here is an example of an interactive pcretest run.
$ pcretest
PCRE version 7.0 30-Nov-2006
re> /^abc(\d+)/
data> abc123
0: abc123
1: 123
data> xyz
No match
Note that unset capturing substrings that are not followed by one that is set are not returned by pcre_exec(), and are not shown by pcretest. In the following example, there are two capturing substrings, but when the first data line is matched, the second, unset substring is not shown. An "internal" unset substring is shown as "<unset>", as for the second data line.
re> /(a)|(b)/
data> a
0: a
1: a
data> b
0: b
1: <unset>
2: b
If the strings contain any non-printing characters, they are output as \0x escapes, or as \x{...} escapes if the /8 modifier was present on the pattern. See below for the definition of non-printing characters. If the pattern has the /+ modifier, the output for substring 0 is followed by the the rest of the subject string, identified by "0+" like this:
re> /cat/+
data> cataract
0: cat
0+ aract
If the pattern has the /g or /G modifier, the results of successive matching attempts are output in sequence, like this:
re> /\Bi(\w\w)/g
data> Mississippi
0: iss
1: ss
0: iss
1: ss
0: ipp
1: pp
"No match" is output only if the first match attempt fails. If any of the sequences \C, \G, or \L are present in a data line that is successfully matched, the substrings extracted by the convenience functions are output with C, G, or L after the string number instead of a colon. This is in addition to the normal full list. The string length (that is, the return from the extraction function) is given in parentheses after each string for \C and \G. Note that whereas patterns can be continued over several lines (a plain ">" prompt is used for continuations), data lines may not. However newlines can be included in data by means of the \n escape (or \r, \r\n, etc., depending on the newline sequence setting).
OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
When the alternative matching function, pcre_dfa_exec(), is used (by means of the \D escape sequence or the -dfa command line option), the output consists of a list of all the matches that start at the first point in the subject where there is at least one match. For example:
re> /(tang|tangerine|tan)/
data> yellow tangerine\D
0: tangerine
1: tang
2: tan
(Using the normal matching function on this data finds only "tang".) The longest matching string is always given first (and numbered zero). If /g is present on the pattern, the search for further matches resumes at the end of the longest match. For example:
re> /(tang|tangerine|tan)/g
data> yellow tangerine and tangy sultana\D
0: tangerine
1: tang
2: tan
0: tang
1: tan
0: tan
Since the matching function does not support substring capture, the escape sequences that are concerned with captured substrings are not relevant.
RESTARTING AFTER A PARTIAL MATCH
When the alternative matching function has given the PCRE_ERROR_PARTIAL return, indicating that the subject partially matched the pattern, you can restart the match with additional subject data by means of the \R escape sequence. For example:
re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data> 23ja\P\D
Partial match: 23ja
data> n05\R\D
0: n05
For further information about partial matching, see the pcrepartial documentation.
CALLOUTS
If the pattern contains any callout requests, pcretest's callout function is called during matching. This works with both matching functions. By default, the called function displays the callout number, the start and current positions in the text at the callout time, and the next pattern item to be tested. For example, the output
--->pqrabcdef
0 ^ ^ \d
indicates that callout number 0 occurred for a match attempt starting at the fourth character of the subject string, when the pointer was at the seventh character of the data, and when the next pattern item was \d. Just one circumflex is output if the start and current positions are the same. Callouts numbered 255 are assumed to be automatic callouts, inserted as a result of the /C pattern modifier. In this case, instead of showing the callout number, the offset in the pattern, preceded by a plus, is output. For example:
re> /\d?[A-E]\*/C
data> E*
--->E*
+0 ^ \d?
+3 ^ [A-E]
+8 ^^ \*
+10 ^ ^
0: E*
The callout function in pcretest returns zero (carry on matching) by default, but you can use a \C item in a data line (as described above) to change this. Inserting callouts can be helpful when using pcretest to check complicated regular expressions. For further information about callouts, see the pcrecallout documentation.
NON-PRINTING CHARACTERS
When pcretest is outputting text in the compiled version of a pattern, bytes other than 32-126 are always treated as non-printing characters are are therefore shown as hex escapes. When pcretest is outputting text that is a matched part of a subject string, it behaves in the same way, unless a different locale has been set for the pattern (using the /L modifier). In this case, the isprint() function to distinguish printing and non-printing characters.
SAVING AND RELOADING COMPILED PATTERNS
The facilities described in this section are not available when the POSIX interface to PCRE is being used, that is, when the /P pattern modifier is specified. When the POSIX interface is not in use, you can cause pcretest to write a compiled pattern to a file, by following the modifiers with > and a file name. For example:
/pattern/im >/some/file
See the pcreprecompile documentation for a discussion about saving and re-using compiled patterns. The data that is written is binary. The first eight bytes are the length of the compiled pattern data followed by the length of the optional study data, each written as four bytes in big-endian order (most significant byte first). If there is no study data (either the pattern was not studied, or studying did not return any data), the second length is zero. The lengths are followed by an exact copy of the compiled pattern. If there is additional study data, this follows immediately after the compiled pattern. After writing the file, pcretest expects to read a new pattern. A saved pattern can be reloaded into pcretest by specifying < and a file name instead of a pattern. The name of the file must not contain a < character, as otherwise pcretest will interpret the line as a pattern delimited by < characters. For example:
re> </some/file
Compiled regex loaded from /some/file
No study data
When the pattern has been loaded, pcretest proceeds to read data lines in the usual way. You can copy a file written by pcretest to a different host and reload it there, even if the new host has opposite endianness to the one on which the pattern was compiled. For example, you can compile on an i86 machine and run on a SPARC machine. File names for saving and reloading can be absolute or relative, but note that the shell facility of expanding a file name that starts with a tilde (~) is not available. The ability to save and reload files in pcretest is intended for testing and experimentation. It is not intended for production use because only a single pattern can be written to a file. Furthermore, there is no facility for supplying custom character tables for use with a reloaded pattern. If the original pattern was compiled with custom tables, an attempt to match a subject string using a reloaded pattern is likely to cause pcretest to crash. Finally, if you attempt to load a file that is not in the correct format, the result is undefined.
SEE ALSO
pcre(3), pcreapi(3), pcrecallout(3), pcrematching(3), pcrepartial(d), pcrepattern(3), pcreprecompile(3).
AUTHOR
Philip Hazel University Computing Service Cambridge CB2 3QH, England.
REVISION
Last updated: 12 April 2008 Copyright (c) 1997-2008 University of Cambridge.
Index
- NAME
- SYNOPSIS
- OPTIONS
- DESCRIPTION
- PATTERN MODIFIERS
- DATA LINES
- THE ALTERNATIVE MATCHING FUNCTION
- DEFAULT OUTPUT FROM PCRETEST
- OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
- RESTARTING AFTER A PARTIAL MATCH
- CALLOUTS
- NON-PRINTING CHARACTERS
- SAVING AND RELOADING COMPILED PATTERNS
- SEE ALSO
- AUTHOR
- REVISION
This document was created by man2html, using the manual pages.
Time: 05:29:07 GMT, December 24, 2015


One
NUM
of
ADP
the
DET
other
ADJ
reviewers
NOUN
has
VERB
mentioned
VERB
that
ADP
after
ADP
watching
VERB
just
ADV
1
NUM
Oz
PROPN
episode
NOUN
you
PRON
'll
VERB
be
VERB
hooked.
VERB
They
PRON
are
VERB
right,
ADJ
as
ADP
this
DET
is
VERB
exactly
ADV
what
PRON
happened
VERB
with
ADP
me.<br
PROPN
/><br
ADJ
/>The
DET
first
ADJ
thing
NOUN
that
DET
struck
VERB
me
PRON
about
ADP
Oz
PROPN
was
VERB
its
DET
brutality
NOUN
and
CCONJ
unflinching
ADJ
scenes
NOUN
of
ADP
violence,
NOUN
which
DET
set
VERB
in
PART
right
NOUN
from
ADP
the
DET
word
NOUN
GO.
PROPN
Trust
VERB
me,
PRON
this
DET
is
VERB
not
ADV
a
DET
show
NOUN
for
ADP
the
DET
faint
ADJ
hearted
ADJ
or
CCONJ
timid.
ADJ
This
DET
show
NOUN
pulls
VERB
no
DET
punches
NOUN
with
ADP
regards
NOUN
to
ADP
drugs,
NOUN
sex
NOUN
or
CCONJ
violence.
NOUN
Its
DET
is
VERB
hardcore,
ADV
in
ADP
the
DET
classic
ADJ
use
NOUN
of
ADP
the
DET
word.<br
PROPN
/><br
PUNCT
/>It
PROPN
is
VERB
called
VERB
OZ
PROPN
as
ADP
that
DET
is
VERB
the
DET
nickname
NOUN
given
VERB
to
ADP
the
DET
Oswald
PROPN
Maximum
PROPN
Security
PROPN
State
PROPN
Penitentary.
PROPN
It
PRON
focuses
VERB
mainly
ADV
on
ADP
Emerald
PROPN
City,
PROPN
an
DET
experimental
ADJ
section
NOUN
of
ADP
the
DET
prison
NOUN
where
ADV
all
DET
the
DET
cells
NOUN
have
VERB
glass
NOUN
fronts
NOUN
and
CCONJ
face
NOUN
inwards,
NOUN
so
CCONJ
privacy
NOUN
is
VERB
not
ADV
high
ADJ
on
ADP
the
DET
agenda.
NOUN
Em
PROPN
City
NOUN
is
VERB
home
NOUN
to
ADP
many..
ADJ
Aryans,
PROPN
Muslims,
PROPN
gangstas,
NOUN
Latinos,
PROPN
Christians,
PROPN
Italians,
PROPN
Irish
ADJ
and
CCONJ
more....
ADJ
so
ADP
scuffles,
NOUN
death
NOUN
stares,
NOUN
dodgy
NOUN
dealings
NOUN
and
CCONJ
shady
ADJ
agreements
NOUN
are
VERB
never
ADV
far
ADV
away.<br
PROPN
/><br
PROPN
/>I
PROPN
would
VERB
say
VERB
the
DET
main
ADJ
appeal
NOUN
of
ADP
the
DET
show
NOUN
is
VERB
due
ADJ
to
ADP
the
DET
fact
NOUN
that
ADP
it
PRON
goes
VERB
where
ADV
other
ADJ
shows
NOUN
would
VERB
n't
ADV
dare.
VERB
Forget
VERB
pretty
ADJ
pictures
NOUN
painted
VERB
for
ADP
mainstream
NOUN
audiences,
NOUN
forget
VERB
charm,
NOUN
forget
VERB
romance...
NOUN
OZ
PROPN
does
VERB
n't
ADV
mess
VERB
around.
ADV
The
DET
first
ADJ
episode
NOUN
I
PRON
ever
ADV
saw
VERB
struck
VERB
me
PRON
as
ADP
so
ADV
nasty
ADJ
it
PRON
was
VERB
surreal,
ADJ
I
PRON
could
VERB
n't
ADV
say
VERB
I
PRON
was
VERB
ready
ADJ
for
ADP
it,
PRON
but
CCONJ
as
ADP
I
PRON
watched
VERB
more,
ADJ
I
PRON
developed
VERB
a
DET
taste
NOUN
for
ADP
Oz,
PROPN
and
CCONJ
got
VERB
accustomed
ADJ
to
ADP
the
DET
high
ADJ
levels
NOUN
of
ADP
graphic
ADJ
violence.

NOUN
thats
NOUN
if
ADP
you
PRON
can
VERB
get
VERB
in
ADP
touch
NOUN
with
ADP
your
DET
darker
ADJ
side.


Get Session Result
Session ID
State
Client Session Token
Client Session Token TTL
User Tracking ID
Biometric Consent Timestamp
Checks
Authenticity Checks
ID Document Text Data Checks
Face Match Checks
Liveness Checks
ID Document Comparison Checks
Face Comparison Checks
Third Party Identity Checks
Watchlist Screening Checks
Watchlist Advanced Checks
Supplementary Document Text Data Checks
Third Party Identity Fraud One Checks
Synectics Identity Fraud Checks
IBV Visual Review Checks
Document Scheme Validity Checks
Profile Document Match Checks
ID Documents
Document Fields
Media
ID
Document ID Photo
Text Extraction Tasks
Generated Text Data Checks
ID
Generated Media
ID
Type
Page
Frame
Supplementary Documents
Document Fields
Media
ID
Text Extraction Tasks
Generated Text Data Checks
ID
Generated Media
ID
Type
Download File
Page
Frame
Zoom Liveness Resources
ID
Frames
Frame
Static Liveness Resources
ID
Image
Applicant Profile Resources
ID
JSON
Identity Profile Preview
JSON
Import Token
Failure Reason:
JSON


#include "defs.h"
Go to the source code of this file.
Defines | |
| #define | ASSIMP_CFLAGS_SHARED 0x1 |
| Assimp was compiled as a shared object (Windows: DLL). | |
| #define | ASSIMP_CFLAGS_STLPORT 0x2 |
| Assimp was compiled against STLport. | |
| #define | ASSIMP_CFLAGS_DEBUG 0x4 |
| Assimp was compiled as a debug build. | |
| #define | ASSIMP_CFLAGS_NOBOOST 0x8 |
| Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined. | |
| #define | ASSIMP_CFLAGS_SINGLETHREADED 0x10 |
| Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined. | |
Functions | |
| ASSIMP_API const char * | aiGetLegalString (void) |
| Returns a string with legal copyright and licensing information about Assimp. The string may include multiple lines. | |
| ASSIMP_API unsigned int | aiGetVersionMinor (void) |
| Returns the current minor version number of Assimp. | |
| ASSIMP_API unsigned int | aiGetVersionMajor (void) |
| Returns the current major version number of Assimp. | |
| ASSIMP_API unsigned int | aiGetVersionRevision (void) |
| Returns the repository revision of the Assimp runtime. | |
| ASSIMP_API unsigned int | aiGetCompileFlags (void) |
| Returns assimp's compile flags. |
Definition in file version.h.
| ASSIMP_API unsigned int aiGetCompileFlags | ( | void | ) |
Returns assimp's compile flags.
| ASSIMP_API const char* aiGetLegalString | ( | void | ) |
Returns a string with legal copyright and licensing information about Assimp. The string may include multiple lines.
| ASSIMP_API unsigned int aiGetVersionMajor | ( | void | ) |
| ASSIMP_API unsigned int aiGetVersionMinor | ( | void | ) |
| ASSIMP_API unsigned int aiGetVersionRevision | ( | void | ) |


| DOSE: |
60 mg |
oral |
2C-T-7 |
(powder / crystals) |
Where my first two attempts failed, my third came through in an incredible way. I have used acid and shrooms on a number of occasions, but experienced dissapointingly mild visuals even at high doses. I still chose to approach this new (legal) drug with caution.
My first try was at 20 mg - no effects. My second was at 40 mg - mild loss of coordination. My most recent time, I fasted for 36 hours, drinking only water, and then took 60 mg, leading me to the most visual trip of my life.
12:30 I came home from work just after midnight and weighed out 60 mg powder and ate it. The nasty mediciny taste washed out after about 30 minutes. I throw in 'Lolita' on DVD to kill some time because it takes about 2 hours for the trip to start.
2:30 This movie is seriously weird. I think part of it is due to the effects of the 2C-T-7 coming on. Bits of color start splashing on the black and white screen. The ceiling fan starts morphing. I feel very pleased inside because I'm finally getting this stuff to work.
3:00 The movie ends, and I get up to go to my room and get some cigarettes. There's a good stagger in my walk, but I make it. When I take my hand down from the light switch, I start seeing some mega tracers. My hand and arm leave an 8 inch trail behind them. I venture outside to go for a walk and have a smoke. The nicotine gives me a serious buzz, numbing my feet and fingertips. I can tell I'm walking weird. The trees are moving all over the place and taking the shapes of mysterious animals, waving me on. My hearing is very acute. Everything is disproportionate, seeming too close or too far away, including the ground, but I manage to stay upright.
3:30 I get a bit overwhelmed and head back inside. The bathroom is incredible. The shower curtain is like a work of 3-D art, enhanced with flowing colors. The toilet paper designs bubble in and out as if boiling.  As I head into my bedroom and notice some whippets. I crack one open and blast with good feelings.  The textured ceiling flows like a river as I lay back. Specks of color are flowing everywhere.
4:30 The trip is still going full blast, but I am exhausted, and I try to sleep. My mind fills with dissociative thoughts, and any time I open my eyes, the visuals are instantly there wherever I look. I'm able to pleasantly fall asleep while still riding the plateau, and have no bad dreams or any problems getting to sleep.
In conclusion, this stuff works in a serious way on someone who has had a hard time with other hallucinogens. I think it is extremely important to have a very empty stomach. This may have been the reason I didn't go the first two tries. I had no nasuea or neck/shoulder pain. I never had a hint on any negative feelings, or felt any potential for a 'bad trip' to happen. I'm dissapointed I had to sleep, but I had worked for 13 hours that day and was very tired. I'm confident the trip will last much longer, and I will definitely do it again. The most unbelievable part is that it's legal, for now at least.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


What is Collab Seeker?
Collab Seeker provides an easy way to find collaboration with other iGEM teams.
How to use the Collab Seeker
1. Edit your team page. Add collaboration categories and details about what kind of collaboration you are looking for.
2. Just write a project keyword (e.g. cyanobacteria) in the box above or search through the list of collaboration categories, and the seeker will find all the matching teams for you!
3. Contact your new collaboration partner(s)!


Dearly Departed
Deaths in Louth - Sunday November 17 2019
RIP
by Donard McCabeThe death has occurred of Rosa Laverty (née Flynn) of Doolargy Avenue, Muirhevnamor, Dundalk, Louth
On Thursday November 15, 2019, peacefully in the loving care of The Lourdes Hospital. Predeceased by her parents Charlie and Maureen, and brother Terry (late of Bridge Street).
Rosa will be sadly missed by her loving husband Peter, sons Michael, Peter and Alex, brothers Jimmy, Charlie and Paddy, sisters Patricia Byrne, Sheila Murphy and Maureen Clarke, daughters in-law Bridget and Suzanne, grand-daughter Toni-Leigh, brothers and sisters in-law, nephews, nieces extended family relatives, neighbours and friends.
Reposing at her home Doolargy Avenue, from Sunday 12 noon to 6pm and Monday from 12 noon.
Removal on Monday evening at 5.45pm proceeding on foot to The Church of The Holy Family, arriving for reception prayers at 6pm.
Funeral Mass on Tuesday morning at 11am, followed by burial in St Patrick's Cemetery, Dundalk.
Donations in lieu of flowers please to The Multiple Sclerosis Foundation.
May she rest in peace
The death has occurred of James Kelly of Arthurstown., Tallanstown, Louth
Peacefully in Our Lady of Lourdes Hospital in his 89th year on November 17, 2019. James, beloved brother of Lily Melia and the late Joe and Mary Crowley (Mullingar). James will be sadly missed by his sister, nephews, nieces, relatives and friends.
Reposing at his nephew Gerard Melia's home A91 NY91 Charlestown, Tallanstown from 5pm on Sunday and from 2pm on Monday.
Removal on Tuesday morning to St. Peter and Paul’s Church, Tallanstown, arriving for Mass at 11 o'clock. Burial afterwards in Louth Cemetery.
May he rest in peace
The death has occurred of Ann Dullaghan (née Daly) of 128 Manydown Close and late of Marian Park, Dundalk, Louth
Peacefully surrounded by her loving family in the kind and gentle care of the staff at Our lady of Lourdes Hospital, Drogheda.
Predeceased by her parents Lena and Peter, sister Marie (Kemp) and brother-in-law Ollie (Kemp).
Ann will be sadly missed and remembered with love by her husband Gerry, daughters Catherine and Rosemary, son Martin, sons-in-laws Paul and Joe, doting grandchildren Shane, Gerard, Jackey, Cian and Emma, nieces, nephews and a large circle of friends.
Reposing in 128 Manydown Close, Dundalk on Sunday between 12 noon and 8 o’clock.
Removal on Monday afternoon at 12.30pm arriving for 1 o’clock Funeral Mass in St. Joseph’s Redemptorist Church followed by burial in St. Patrick's Cemetery.
Funeral arrangements entrusted to Niall E. Kehoe, Dixons Funeral Home T:<PHONE_NUMBER>.
May she rest in peace
The death has occurred of Patsy Mullen of Lis Na Dara, Carrick Road, Dundalk, Louth
On Thursday November 14, 2019, peacefully in the love and tender care of The Louth Co. Hospital. Formerly of Muirhevnamor and The Point Road.
Predeceased by his mother Tessie, brother Paddy, sisters Kathleen and Mena, Patsy will be missed by his loving daughter Lisa, sons Liam and Kieron, Lisa partner Kevin McRory, nephews, nieces, extended family, neighbours and friends.
Reposing at Shevlin's Funeral Home, Barrack Street, from Sunday 12 noon to 6pm.
Remembrance Service in Funeral Home on Monday morning at 11am, followed by burial in Dowdallshill Cemetery, Dundalk.
No flowers or cards by request.
May he rest in peace
The death has occurred of Jim (James) Keegan of Pearse Park, Drogheda, Co. Louth
On November 14, 2019, peacefully at Our Lady of Lourdes Hospital. Jim (James), beloved husband of the late Marie and loving dad of the late Niall.
Sadly missed by his family Paul, Derek, Jacqueline and Eileen, son-in-law Dermot, daughter-in-law Cathy, grandchildren Darren, Andrea, Cormac, Lisa, Claire, Ciaran, Dermot, Cathal, Shannen and Jack, great-grandchildren, brother Declan, sister Nuala, brothers-in-law, sisters-in-law, nephews, nieces, relatives and friends.
Reposing at Townley’s Funeral Home, Crosslanes from 5 o’clock until 7 o’clock on Sunday evening.
Removal on Monday morning at 10.30am arriving to Our Lady of Lourdes Church for Funeral Mass at 11 o’clock. Burial afterwards in St. Peter’s Cemetery.
May he rest in peace
The death has occurred of John Haggins of Brookville Park, Drogheda and formerly of Glenview
On November 15, 2019, at Our Lady of Lourdes Hospital. John beloved husband of Marie and loving dad to Caroline, Janice, Sandra, Belinda, John, Dermot and Lorraine.
Sadly missed by his wife and family, sons-in-law Paul, Jeff, Ged, Eamonn and Stephen, daughters-in-law Shirley and Tina, grandchildren Leona, Emma, Luke, Conor, Leah, Nicole, Shannon, Sarah, Mark, Katie, Anna, Sophie, Lucy and Dylan, great-grandchildren Elsie, Kaytlyn, Layla and Amber, brother Christopher, sisters Bredeen and Nuala, brothers-in-law, sisters-in-law, nieces, nephews, relatives and friends.
Reposing at his home from 3pm until 8pm on Sunday evening.
Removal on Monday morning at 12 noon arriving to Our Lady of Lourdes Church, for Funeral Mass at 12.30pm. Cremation afterwards in Dardistown Crematorium.
No flowers or Mass cards please. Donations, if desired, to Drogheda Day Care Centre, Cottage Hospital.
House private on Monday morning.
May he rest in peace


Hovering over the live graph allows a text box to appear in the x-y coordinate you pause at and gives you the catagory selected, the percentage, and the time. This is a good way of getting exact values without the guess work from the user to predict where the cursor is falling under.
While guiding yourself through the interactive visualization, one part of the screen is always fragmented on the top. It tells you which state visualization you currently on, gives a drop down menu to access other states in ascending order.
Allows user who is aware of the map of the United States and can geographically pick an individual state that stands out to them in a grander scale.
Easy Sharability with platforms:
Each state's information is different based on the people that are born in the state vs people moved there to live there. And depending on what perspective you look at it from, it varies of the information presented to you.
Every state's information is in an ordered form which gives us a huge scrollable selection which can overwhelm the user. Each state contains similar type of information so having a single dynamic graph that changed through a selection process would have benefited in this scenerio.
Just having a cool visualization is useless if you dont have someone to share it with. In this visualization, the creators have targeted famous social medias to help spread their visualization to the world.
Some more platforms they could have included:
The chart above shows that we are able to hover over individual contents of the graph, however also lets the user think it is clickable and give us further information. Also notice that the information is redundant as we hovered over "Born in other states in the Midwest", the hoverable box's only useful information is the percentage, but everything else is already stated.
The data points are also broken up by decades so the data is scewed to averages rather than precision. If major events happened begining of the decade, and rest of the years didnt have much activity, we cant tell where concentration of data lies.
It lacks a proper searchability for a specific year, or even comparison to other states directly. The user must locate both charts individually, screenshot and then compare side to side. This puts too much work on the user, and by then the user is uninterested.
The data collected for this study goes until 2012 and above every state's graph there is "new" written. What is new exactly or is this a rushed error that they developers didnt have time to finish. It grabs the attention of the user in a useless way because there is no functionality to this.
The application is well made, however if New York Times could provide a proper link to the application which stays away from News article feel. It feels less interactive and more of a article read since so much put on a single page. The ads arent too invasive but distracting and breaks focus on what matters. When we are looking at a visualization, we want to focus on that entirely, not think about tax seasons, or what other articles are available to read next.
The interactive data visualization was approved by the professor of the course, Dr. Andy Johnson for the Viewer Choice Assignment.
How the Data/Charts was collected:
Data Collecting Reasons/Biases:
The population of Illinois in 1900 that was living there is 20% of population is born outside the US. This could be for a various amounts of reasons since Civil War ended in 1865 and in the north for states like Illinois was the habbitant of the first accepting non whites and immigrants for their freedom. So the population was 20% which was every 1 in 5 were born outside the country. The number for current population is 15% which infers that over time amd acceptance of other states have let them migrate to different states.
In retrospect, Alabama is hard sourthern state, shows us that from 1900-1980, the population born outside the country is 1%. Even after the Civil war and until day now, this could infer a variaty of things. That Alabama was known not for colored people or accepting of immigrants. Or that Immigrants and colored people had their own preconceived notions of the Alabama and chose to not live there.
Racism or acceptance are not the only possible reasons since opportunity in urban areas were more readily available. When immigrants come to this country, they go where the jobs are located and in places they know people in their position have succeeded in the past.
The population of native born Nevada in the 1900 that was living there had 25% moved to California. Nevada is mainly a desert state so looking at geographic and environmental advantages that California had to offer was enticing. Nevada and California are also border states so it makes sense that people will want to go where they can get more opportunities and close in distance.
In retrospect, California in the 1900, residents born in this state: 91% chose to stay here due to its opportunities and resources. However if you look at the current 2010, only 75% of residents live in California. This could be for a variety of reasons like the growth of the Tech hub in california which has caused the rise of cost of living, resources depleting like natural drinking water.
Also the growth of other metropolitian areas have created more jobs and further more tech hubs like Seatle, Chicago, New York, etc. So maybe the concentration of people that want to live in California is normalizing and spreading to other states.
Here we are given two states that not directly connected to the United States due to their geographic locations. Also keep in mind that the census for the two states are from 1960 and onward. When comparing the populus born outside the country, Alaska at 8% and Hawaii at 20%, it brought up the question why is Hawaii have twice as many immigrants than Alaska.
The weather in Hawaii is much more tropical and is considered a vacation state in which there is huge economic market for native Hawaians. People dont really travel to Alaska for vacation since its mainly cold and alot of unusable land. Also the plane travel distance from many countries to Hawaii is obtainable but for Alaska, you must do connecting flights since there arent many planes going to Alaska.


Ah, Snap! Could you please try again?
It seems like you entered some incorrect values.
Try again
Enter values of x and y separated by commas


Uploadr extension extensions 2008/09/07
Getting re-acquainted with Flickr Uploadr, I discovered a sorely missing piece of the Extension API. There are plenty of hooks to catch higher-level events than clicks and mouseovers — things like logins, uploads and adding photos. However, there is no way to store persistent data and associate it with a certain Flickr user. Here is a way:
var userinfo = { set: function(k, v) { // Only allow userinfo if they're signed into Flickr if (!users.nsid) { return false; } // It's just a hash for storing whatever you want var u = users.list[users.nsid]; u.userinfo = u.userinfo || {}; u.userinfo[k] = v; return true; }, get: function(k) { if (!users.nsid) { return undefined; } if (!users.list[users.nsid].userinfo) { return undefined; } return users.list[users.nsid].userinfo[k]; }, unset: function(k) { if (!users.nsid) { return true; } if (!users.list[users.nsid].userinfo) { return true; } delete users.list[users.nsid].userinfo[k]; return true; } };
Another thing I found missing was an after_logout
event. So
I monkeypatched one:
users.old_logout = users.logout; users.logout = function(save) { users.old_logout(save); extension.after_logout.exec(); }; extension.after_logout = new extension.Handler(); extension.after_logout.add(function() { Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService) .logStringMessage('after_logout!'); });
T-minus five days and I've got my development environment ready to go. I'll be at Yahoo! Open Hack Day September 12-13 in Sunnyvale, hacking on Uploadr. Hopefully others will join me in creating some cool extensions. Stop by and say hello.
Comments (0)


service worker 注册状态:
doing...
serviceWorker.register的状态:
注册状态更变，应该如下:
installing
installed
activing
actived


Multitouch Vi Mode changes h,j,k,l keys to arrow keys while your finger is on the trackpad.
| Key | When one finger is on the trackpad | When two fingers are on the trackpad |
|---|---|---|
| h | left arrow | home |
| j | down arrow | page down |
| k | up arrow | page up |
| l | right arrow | end |
Multitouch Vi Mode requires MultitouchExtension. Please follow this instruction before using Multitouch Vi Mode.


Isotope - data filter without javascript
nth-child selected
All
Every even
Every odd
Every third
Radius 0
Radius 1
Radius 2
class selected images - lorempixel.com
All
nature
people
animals
Radius 0
Radius 1
Radius 2
class selected
All
webdesign
icons
illustration
Radius 0
Radius 1
Radius 2


MIUI 11 notifications' sound effect changes with time - Gizchina.com
by Efe UdinMIUI 11 notifications’ sound effect changes with time
4 (80%) 11 votes
The stable version of MIUI 11 started rolling out in mid-October. While Xiaomi is preparing this update for more devices, it is also adding some new features. Earlier, there were reports that Xiaomi is preparing Focus mode, Vientiane screen custom image & Class schedule features for MIUI 11. However, these new features are still in the internal testing stage. In addition, the company also added a new drawer mode to the system desktop. Now, its latest announcement on Twitter shows that MIUI 11 notifications’ sound effect changes with time. Of course, the changes in notification sound depends on user settings. The company said on Twitter
“You’ve got a message from #MIUI11 Surprised! We are happy to announce that on MIUI11, notifications’ sound effect is changed by time. Tune-up to experience it now”.
As of now, many Xiaomi devices, especially the older ones are yet to receive this update. However, if you are wondering if your device got MIUI 11, see the list below
The devices include:
- Xiaomi Mi 9 Pro 5G
- Redmi S2
- Xiaomi Mi 6
- Redmi Note 5A Standard Edition
- Xiaomi Mi MIX 2
- Redmi Note 7
- Xiaomi Mi CC9 Meitu Edition
- Redmi Note 5A High Edition
- Xiaomi Mi 9
- Redmi K20 Pro
- Xiaomi Mi CC9
- Redmi K20 Pro Premium Edition
- Redmi 6 Pro
- Xiaomi Mi Note 3
- Redmi 7A
- Xiaomi Mi 9 SE
Others include
- Xiaomi Mi Mix 3
- Redmi 7
- Xiaomi Mix 2s
- Xiaomi Mi 8
- Redmi Note 7 Pro
- Xiaomi Mi 8 SE
- Xiaomi Mi 8 Explorer Edition
- Redmi K20
- Xiaomi Mi 8 Screen Fingerprint Edition
- Xiaomi Mi 8 Youth Edition
- Mi Max 3
If your smartphone is not on this list, be patient. More devices are getting this update. Note that this list contains devices with MIUI 11 based on Android 10. There are other devices with MIUI 11 on top of Android 9 Pie. This new feature is really interesting because there are some sounds that we really like but seem to be too loud for night time. Now, with this new feature, we can customize a particular sound for the day time and another for night time. In fact, we can set the notification sound to change depending on the hour.


1. Introduction
Generators are a fundamental abstraction of the Python language.
Generators were first introduced in Python 2.2 together with the yield
keyword turning a function into an generator. In subsequent releases
Python became ever more generator friendly with generator expressions
and finally with turning yield statements into yield expressions and
generators into proper coroutines. A few limitations however remained.
Most notably generators are not copyable and can't be pickled which is
an
obstacle for using generators to implement lightweight concurrency a la
Erlang and distribute them transparently across different OS level
processes. These problems have been solved by the Stackless Python dialect of
Python which addressed coroutines and cooperative multitasking
specifically.While SP preceeded CPythons development of coroutines for
years, the arival of Python 2.5 means a significant feature overlap
between SP tasklets and generators.
As long as no native implementation for copying generators is available
the generator_tools package can be used to close the gap. The package
is implemented in pure Python and it is available for Python 2.5 and
also Python 3.0.
The basic facilities are the copy_generator
and pickle_generator
functions. Those were described in sections 2 and 3.
2.
copy_generator
The implementation of copy_generator is based on a deep bytecode hack
or expressed in less pejorative manner: it uses runtime introspection
and Python bytecode assembler synthesis. For those who are impatient
and not interested in detail design the API is treated first. Later in
section 2.2 the implementation strategy is iluminated.
2.1
copy_generator usage
-
| copy_generator( |
f_gen,
[copy_filter]) |
- Keeps a generator object and returns a generatorcopy
object. A generatorcopy
object provides the same public interface and behaviour as a generator
object but stores additional data used for re-copying. Passing a generatorcopy
object is permitted as well.
New in version
0.2: You can pass an
optional copy_filter parameter which is a boolean function of one
argument. The argument being passed on call of copy_filter is a local
variable of the copied generator. The default behaviour is such that
all locals ( and therefore the generator ) is deepcopied. An exception
is made with objects that have an attribute "sharable" with value
sharable = True. Locals which are assigned as sharable are passed into
the generatorcopy uncopied i.e. without creating new object identities
( see also 2.1.2 for examples ).
Example 1:
def
f(start):
# generator
i = start
while i<start+10:
yield i
i+=1
>>> f_gen = f(3) # creating a generator object f_gen
>>> f_gen.next() # do some action
3
>>> g_gen = copy_generator(f_gen)
>>> g_gen.next()
4
>>> f_gen.next()
4
>>> list(f_gen) == list(g_gen)
True
|
2.1.1
copy_generator and for-loops
Copying generators containing while-loops, even nested while loops
doesn't cause known problems. Also interactions with try...except
statements is not troublesome. However for-loop defintions don't work
out of the
box. We elaborate on this in the nexrt subsection. Here I will present
the
workaround only that makes for-loops copyable. Note, this workaround is
enforced by the current implementation and a CopyGeneratorException
is raised when not being detected.
Syntactically a for-loop has three user defined parts:
for_stmt: 'for' exprlist 'in' testlist ':' suite
We are only interested in the testlist
part which is highlighted in the following example:
for k in range(20): # in this
form copy_generator can't transfer state
yield k
|
This testlist part has to be factored out. But this alone is not
sufficient. It has to be wrapped using the for_iter
function:
it = for_iter(range(20))
# required boilerplate
for k in it:
yield k
|
-
- Keeps an iterable and returns an object of type
IteratorView. IteratorViews can be saved and copied. Different
IteratorViews can share a unique iterator and maintain
their own state of iteration.
IteratorViews being exposed as local variables enable the
copy_generator function to deal with nested
for-loops and generator sequences:
Example 2 ( continues Example 1):
def g(x,y):
r = for_iter(range(x,y))
for i in r:
yield i
def f():
G = for_iter([g(0,7), g(7,14), g(14, 21)])
for h in G:
H = for_iter(h)
for item in H:
yield item
>>> gen_f = f()
>>> gen_f.next()
0
>>> gen_f.next()
1
>>> gen_g.next()
2
>>> gen_f.next()
2
>>> list(gen_f) == list(gen_g)
True
|
For additional examples you might take a look at unit tests
implemented in test/test_copygenerators.py
2.1.2 Modify
the copying behaviour ( new
in version 0.2 )
Basically the copy_generator function produces deepcopies of generator
objects. However this can be regulated. The second optional parameter
is a function with signature object -> bool.
It is called copy_filter. The copy_generator function has a default
copy_filter defined as:
lambda loc :
hasattr(loc, "sharable") and loc.sharable
The idea is that only those objects that pass the filter get shared or
passed unmodifed into the generator copy. All others are deepcopied and
a shared nothing policy is applied.
One other relevant copy_filter is simple:
lambda loc : True
Here everying is shared. This copy_filter is used on
reconstring a generator object from pickling. The usecase is motivated
as follows. One cannot pickle a generator object gen_f directly but has
to map it onto a GeneratorSnapshot object GS_f first that can be
pickled. On unpickling GS_f will be reconstructed and to get gen_f back
one has to apply copy_generator(GS_f) once. Here we share each local of
GS_f with the new gen_f and throw GS_f away in the next step. Note this
is fully automized and you usually don't have to care unless you want
to implement your own pickling routines.
2.2
copy_generator implementation
The implementation of copy_generator is based on two ideas:
- Modify the generator assembly and generate JUMP_ABSOLUTE
commands on certain jump addresses. That's easy on a first try but hard
to get it right s.t. no stack is corrupted.
- Read all local variables of an existing generator object
f_gen using runtime introspection and pass them as parameters into a
newly created generator function g. These parameters constitute the
local
environment for executing the generator object g_gen created from g.
2.2.1 Making a
JUMP ABSOLUTE
Let's consider the following simple Python generator containing two
nested while-loops and the related disassembly:
def f(x, y):
i = 0
while i<x:
j = 0
yield i
while j<y:
yield (i,j)
j+=1
>>> import dis
>>> dis.dis(f)
2 0
LOAD_CONST
1 (0)
3
STORE_FAST
2 (i)
3 6
SETUP_LOOP
71 (to 80)
>> 9
LOAD_FAST
2 (i)
12
LOAD_FAST
0 (x)
15
COMPARE_OP
0 (<)
18
JUMP_IF_FALSE
57 (to 78)
21
POP_TOP
4 22
LOAD_CONST
1 (0)
25
STORE_FAST
3 (j)
5 28
LOAD_FAST
2 (i)
31 YIELD_VALUE
32
POP_TOP
6 33
SETUP_LOOP
39 (to 75)
>> 36
LOAD_FAST
3 (j)
39
LOAD_FAST
1 (y)
42
COMPARE_OP
0 (<)
45
JUMP_IF_FALSE
25 (to 73)
48
POP_TOP
7 49
LOAD_FAST
2 (i)
52
LOAD_FAST
3 (j)
55
BUILD_TUPLE
2
58 YIELD_VALUE
59
POP_TOP
8 60
LOAD_FAST
3 (j)
63
LOAD_CONST
2 (1)
66 INPLACE_ADD
67
STORE_FAST
3 (j)
70
JUMP_ABSOLUTE
36
>> 73
POP_TOP
74
POP_BLOCK
>> 75
JUMP_ABSOLUTE
9
>> 78
POP_TOP
79
POP_BLOCK
>> 80
LOAD_CONST
0 (None)
83 RETURN_VALUE
|
In case of stopping the generator and yielding the first value ( here
it is i ) the last executed
instruction has the index 31 which is considered as a label or offset
when counting from the start of the bytecode sequence. We can read this
value from an generator object in a state of execution with non-empty
stack frame:
>>> f_gen = f(3,4)
>>> f_gen.gi_frame.f_lasti
-1
>>> f_gen.next()
0
>>> f_gen.gi_frame.f_lasti
31
|
Actually we can keep more information from f_gen, namely the current
local context of evaluation:
>>> f_gen.gi_frame.f_locals
{'i': 0, 'y': 4, 'j': 0, 'x': 3}
|
Now suppose we have a function g which keeps all local variables at
jump address 31 of f as parameters:
def
g(x, y, i, j):
i = 0
while i<x:
j = 0
yield i
while j<y:
yield (i,j)
j+=1
|
But instead of starting evaluation with a LOAD_CONST bytecode we aim to
jump directly of the offset 31 i.e. exactly to the place where
evaluation of f_gen has
stopped. The bytecode interpreter actually needs to jump a little
further because evaluating
POP_TOP is meaningfull only when a preceeding stack operation was
performed. So we increment the offset by 2.
We express our decision by prepending a
JUMP_ABSOLUTE bytecode with 33 as its argument.
2 0
JUMP_ABSOLUTE
33
3
LOAD_CONST
1 (0)
6
STORE_FAST
2 (i)
3 9
SETUP_LOOP
74 (to 83)
>> 12
LOAD_FAST
2 (i)
15
LOAD_FAST
0 (x)
....
|
With this modified bytecode we can create the function g which resumes
execution where f_gen was stopped.
2.2.2 A
crash with many causes
The first naive solution has been suggested as a recipe
in the ActiveState Python Cookbook and it failed as Klaus Müller from
the SimPy projected
pointed out. The cause of error is not easy to see. There are three
factors:
- The first implementation didn't correct the jump addresses
of all other JUMP_ABSOLUTE calls. This caused the error message Klaus
reported. The algorithm jumped to invalid address.
- With SETUP_LOOP and other SETUP_XXX commands a block is
pushed on a block stack. The complementary action is POP_BLOCK. While
an
underflow ( too many POP_BLOCK calls ) leads to immediate crash, an
upper threshold for SETUP_LOOP calls ( currently 20 ) that guides
overflow exceptions. You can check this out by creating 20 nested
while-loops for example.
- Klaus example contained a for-loop. For-loops are more
complex to handle than while-loops. On bytecode level they are
distincted by the
additional bytecodes GET_ITER and FOR_ITER. GET_ITER creates an
internal iterable not being exposed a user level code and pushes it on
the stack. Without exposition it can't be copied. But what's worse
GET_ITER must be called to enable subsequent calls of FOR_ITER and
GET_ITER is not a jump target for one next iteration but FOR_ITER only.
2.2.3
Chains of jumps and blocks
As a solution for problem 2) and 3) chains of JUMP_ABSOLUTE bytecodes
are used to connect different SETUP_XXX bytecodes preceeding the
cricical offset. So we are hopping from one SETUP to the next and
initialize the block stack. In case of a SETUP_LOOP belonging to
a for-loop we are processing all bytecodes until the first one after
FOR_ITER .
However generating jumps alone is not sufficient because each jump
shall be processed exactly one. We need to deactivate all jumps when
reaching the target offset. This cannot be done dynamically or by
another bytecode transformation. Instead we use a local variable called
jump_forward_on
as a switch and prepare a bytecode block carefully s.t.
the JUMP_ABSOLUTE command is called when jump_forward_on =
True and skipped otherwise.
The final block is a modified version of the block shown in the
diagram. When jump_forward_on is
True a second variable called jump_forward_off is
loaded and its value is assigned to jump_forward_on.
If this value is False the JUMP_IF_FALSE command causes skipping
JUMP_ABSOLUTE in the next iteration:
0
LOAD_FAST n
(jump_forward_on)
3
JUMP_IF_FALSE 10
6
LOAD_FAST n+1 (jump_forward_off)
9
STORE_FAST n
12 POP_TOP
13 JUMP_ABSOLUTE
setup_offset
16 POP_TOP
|
Finally we summarize and highlight changes on transformations of our
original bytecode.
>>> f_gen = f(3,4)
>>> f_gen.next()
0
>>> f_gen.next()
1
>>> g_gen = copy_generator(f_gen)
>>> import dis
>>> dis.dis(g_gen._g)
352 0
JUMP_ABSOLUTE
9
3
LOAD_CONST
1 (0)
353 6
STORE_FAST
2 (i)
>>
9
SETUP_LOOP
99 (to 111)
12
LOAD_FAST
4 (jump_forward_on)
15
JUMP_IF_FALSE
4 (to 22)
18
POP_TOP
19
JUMP_ABSOLUTE
47
354
>>
22
POP_TOP
>> 23
LOAD_FAST
2 (i)
26
LOAD_FAST
0 (x)
29
COMPARE_OP
0 (<)
32
JUMP_IF_FALSE
74 (to 109)
35
POP_TOP
36
LOAD_CONST
1 (0)
39
STORE_FAST
3 (j)
42
LOAD_FAST
2 (i)
45 YIELD_VALUE
46
POP_TOP
>> 47
SETUP_LOOP
56 (to 106)
50
LOAD_FAST
4 (jump_forward_on)
53
JUMP_IF_FALSE
10 (to 66)
56
LOAD_FAST
5 (jump_forward_off)
59
STORE_FAST
4 (jump_forward_on)
62
POP_TOP
63
JUMP_ABSOLUTE
91
>> 66
POP_TOP
>> 67
LOAD_FAST
3 (j)
70
LOAD_FAST
1 (y)
73
COMPARE_OP
0 (<)
76
JUMP_IF_FALSE
25 (to 104)
79
POP_TOP
80
LOAD_FAST
2 (i)
83
LOAD_FAST
3 (j)
86
BUILD_TUPLE
2
89 YIELD_VALUE
90
POP_TOP
>> 91
LOAD_FAST
3 (j)
94
LOAD_CONST
2 (1)
97 INPLACE_ADD
98
STORE_FAST
3 (j)
101
JUMP_ABSOLUTE
67
>> 104
POP_TOP
105
POP_BLOCK
>> 106
JUMP_ABSOLUTE
23
>> 109
POP_TOP
110
POP_BLOCK
>> 111
LOAD_CONST
0 (None)
114
RETURN_VALUE
|
2.3 How to
clone a running for-loop ?
How can one clone an iterator? Hasn't this question been answered
already with regard to cloning generators? Or else: if we invent a
different cloning algorithm for iterators why not applying it also
towards generators, something more simple than bytecode hackery? The
basic answer for cloning iterators is very simple: turn them into lists
and clone those. But this is inefficient and a serialization strategy
at best - something being important when we pickle iterators.
The answer to copying iterators is to provide IteratorViews. This means
we do not copy iterators at all but provide copies of IteratorView
objects that refer to one unique _IterWrapper object which encapsulate
an iterator and caches its values. The real iterator is therefore
shared among different IteratorViews. An IteratorView just stored the state of its own iteration. This
state is an index into the cached iterator value list. When an
IteratorView is copied it is the index that is copied as well and it
will then be incremented separately in subsequent calls to next().
However the truth about IteratorViews is actually a little bit more
complicated as will be shown below:
>>>
r = range(4)
>>> iv = for_iter(r)
>>> iv
<__main__.IteratorView object at 0x0134B330>
>>> iv.next() # iv.offset -> 0 , recorded ->
[0]
0
>>> iv.next() # iv.offset -> 1 , recorded ->
[0, 1]
1
>>> iv2 = iv.__gencopy__() # copy iv with offset = 1
>>> iv2.next()
1
# ??? Bug?
# Didn't we all expect the offset being 1 and the next value being 2 ?
|
The reason for this admittedly strange behaviour is the fact that
for_iter is not used primarily for just copying iterators but copying
iterators of for-loops. To understand why we decrement the offset on
copy we need to decompile an iterator containing a for-loop.
352
0
JUMP_ABSOLUTE
21
3
LOAD_GLOBAL
0 (for_iter)
6
LOAD_GLOBAL
1 (range)
9
LOAD_CONST
1 (10)
12
CALL_FUNCTION
1
15
CALL_FUNCTION
1
353 18
STORE_FAST
0 (it)
>> 21
SETUP_LOOP
36 (to 60)
24
LOAD_FAST
0 (it)
27
GET_ITER
>> 28
FOR_ITER
28 (to 59)
354
31
STORE_FAST
1 (i)
34
LOAD_FAST
2 (jump_forward_on)
37
JUMP_IF_FALSE
10 (to 50)
40
LOAD_FAST
3 (jump_forward_off)
43
STORE_FAST
2 (jump_forward_on)
46
POP_TOP
47
JUMP_ABSOLUTE
56
>> 50
POP_TOP
51
LOAD_FAST
1 (i)
54 YIELD_VALUE
55
POP_TOP
>> 56
JUMP_ABSOLUTE
28
>> 59
POP_BLOCK
>> 60
LOAD_CONST
0 (None)
63 RETURN_VALUE
|
The critical section is highlighted. What happened here is that the
iterator is called once with FOR_ITER before the JUMP_ABSOLUTE command
at offset 56 is reached which continues iteration with another jump to
FOR_ITER. So FOR_ITER is called twice! By decrementing the index in the
IteratorView we ensure that the correct value is used at each
iteration.
Maybe you have noticed that the name of the copy function is called
__gencopy__ and it might be applied for internal copying purposes only.
Another function is called __itercopy__ and it provides non-surprising
behaviour as being shown in the next example:
>>>
iv = for_iter(range(4))
>>> iv.next()
0
>>> iv.next()
1
>>> iv2 = iv.__itercopy__()
>>> iv2.next()
2
>>> iv2.next()
3
>>> iv.next()
2
>>> list(iv)
[3]
>>> iv2.next()
Traceback (most recent
call last):
File
"<interactive input>", line 1, in <module>
File
"c:\lang\python25\lib\site-packages\generator_tools\copygenerators.py",
line 64, in next
item = self.itwrap.next(self)
File
"c:\lang\python25\lib\site-packages\generator_tools\copygenerators.py",
line 28, in next
item = self.it.next()
StopIteration
|
You can use also use copy.deepcopy to achieve the same effect.
3. The
picklegenerators
module
Changed
in
version
0.3
The picklegenerators modules serves as a full replacement for the
pickle
module. You can use convenient API functions like dump, dumps or load
or the classes Pickler, Unpickler. The only notable difference is that
generator objects ( as well as some derived objects ) can now be
pickled / unpickled. Classes like GeneratorPickler or functions like
unpickle_generator are marked as deprecated and a warning is sent when
being called. They will be entirely removed in version 0.5 of
generator_tools.
4. Caveats and
Limitations
Some additional advices
for the user of generator_tools
4.1 Avoid yield
statements in finally clauses
On a few occasions yield statements in finally clauses crashed my
Python interpreter. This behaviour even lead to drop of those tests
from the test suite and leave the note here instead. While not always
being harmfull when copied there are at least indications for not
working correctly and they shall be avoided.
4.2 Avoid
Python 2.5 yield expressions
This is a rather strong demand and it is justified in many cases, at
least when you intend to copy them using generator_tools. Otherwise
they are just fine. If you are careful you can sidestep at least some
of the caveats but not all.
Notice that I've added a new module called enhanced_generator.py which
describes an attempt to make a class of Python 2.5 style "enhanced
generators" viable in generator_tools. However these are not the
generators described in the next subsection.
4.2.1
How to use generator_tools to crash the interpreter
Python 2.5 yield expressions do not generally work. They work to some
extent in the most simple cases but they are generally broken and I
don't believe this can be fixed. I try to explain using the following
example:
def
f():
yield
a = 0
it = for_iter(range(3))
for i in it:
a = ((yield a) or 1) +
((yield a) or 1)
|
The critical section in the disassembled bytecode of the copied
generator shall be examined:
311
0
JUMP_ABSOLUTE
32
...
58
JUMP_ABSOLUTE
77
...
76 YIELD_VALUE
>> 77
JUMP_IF_TRUE
4 (to 84)
80
POP_TOP
81
LOAD_CONST
3 (1)
>> 84
BINARY_ADD
...
|
The execution starts with a JUMP_ABSOLUTE.
A few operations will be performed to intialize the iterator which are
not of interest here. Then another JUMP_ABSOLUTE
will be executed to the offset right after YIELD_VALUE
which is the point of suspension of the original generator. So the
first opcode of interest is JUMP_IF_TRUE.
What does it? Well it looks at the top of the stack for a value v. If v == True it jumps directly to BINARY_ADD.
If False it POP_TOPs
v from the stack and LOAD_CONST
pushes 1 on the stack.
But what is v? Where does it
come from? Well v was pushed
on the stack by YIELD_VALUE.
The YIELD_VALUE
opcode always does even when a Python 2.4 style yield statement is
executed. In that case the execution sequence looks like this
76 YIELD_VALUE
77
POP_TOP
|
and POP_TOP
simply pops None from the stack. But where is v in case of a copied generator?
The depressing answer is: nowhere. That's why the BINARY_ADD
opcode produces an interpreter crash. It tries to gather a value from
the stack that is not there. It is easy to void the crash in case of
yield statements. Just shift the offset from POP_TOP
where None is popped from the stack to the next opcode. The push/pop
sequence is completely skipped.
4.2.2
Why aren't yield expressions entirely evil?
Consider the following generator
def f():
yield 1
a = 0
it = for_iter(range(10))
for i in it:
b =
yield a+i 2
print "b =", b
|
The tiny red numbers indicate the positions where the generator stops
when being called with next/send.
>>>
f_gen = f()
>>> f_gen.next() # stops at 1
- no b yet available
>>> f_gen.next() # stops at
2
- no b yet available
>>> f_gen.send(5) # stops at 2
- b is 5
b = 5
|
Now suppose you want to copy f_gen. The resulting generator copy has
the following disassembly at the critical spot:
311
0
JUMP_ABSOLUTE
32
...
58
JUMP_ABSOLUTE
73
>> 61
POP_TOP
62
LOAD_FAST
0 (a)
65
LOAD_FAST
2 (i)
68 BINARY_ADD
69 YIELD_VALUE
70
STORE_FAST
3 (b)
>> 73
LOAD_CONST
3 ('B')
76 PRINT_ITEM
77
LOAD_FAST
3 (b)
...
|
What you see here is that JUMP_ABSOLUTE
targets
LOAD_CONST but not STORE_FAST.
That's because STORE_FAST suffers
from the same problems as we have just mentioned: it pops a value from
the stack and stores it in the locals of the generator. However we
don't need it because we can access the locals via gen_f.gi_frame.f_locals
and pass b as a parameter into the generator copy. The fact that f_gen
did store the value for us already makes live easier. But no no-brainer
because:
4.2.3 A
generator copy is always a fresh
generator
A copy of a generator is always a fresh
generator not a running one
and it has to be started with next() or send(None)
according to Pythons rules.
This is not open to manipulation because it would require to adjust the
bytecode offset g_gen.gi_frame.f_lasti
of g_gen from within Python which is readonly.
We need to start gen_g once to jump to the LOAD_CONST opcode.
Only after this step you can use send() for passing values back into
the generator:
>>>
g_gen = copy_generator(f_gen)
>>> g_gen.next()
B 5
|
4.3 Avoid
closures
Closures ( inner functions ) are not supported.
4.4 Python 3.0
is not dry yet
I've done some wrapping of datatypes after unpickling. I believe
pickling/unpickling is broken in Python 3.0 at this stage of
development but I expected struggling with type conversions anyway.
New in
version
0.2: pickling is
troublesome using Python 3.0 a2. Not sure if it's a bug in
generator_tools or in Python 3.0. I will suspend additional releases
supporting 3.0 and wait until the first beta.
5.
Acknowledgements
Thanks to Klaus Müller, Jenna Louis, Lorenz Quack, Marek Majkowski, Tom
Salfield, Markus Brückner for
important reinforcements. Special thanks to
Lorenz Quack for providing a redesign of the picklegenerators module.
6. History
Date
|
Version
|
Change
|
| 2009-02-24 |
0.3.6
|
- generator copy is is created with globals of copied
generator
|
| 2009-01-04 |
0.3.5 |
- If a yield expression has the form 'b = yield a' and
the surrounding generator is copied it has to be resumed sending next()
or send(None). So b always will always be None. In version 0.3.4 the
last value of b being used within the generator was passed instead.
This error has been corrected now.
|
2008-07-28
|
0.3.4
|
- Make a subset of Python 2.5 style yield expressions
actually work within tight boundaries. Read the extended discussion of their limitations in
generator_tools.
|
2008-07-07
|
0.3.3
|
- For simple yield expressions or simple sequences of
yield expressions no jump was generated. This bug came in with version
0.3.2.
- Make functions loads() and dumps() visible on package
level.
|
2008-05-17
|
0.3.2
|
- Fix initialization bug. When a generator gen_f
contains a nested for loop or a sequence of for loops not all for_iter
IteratorViews might have been initialized. When gen_f is copied the
copying routine counts the number of IteratorView objects and compares
it with the number of FOR_ITER opcodes available in gen_f. This is too
eager and the copying routine has been modified s.t. only the number of
FOR_ITER opcodes preceeding the last_i opcode are counted.
- Fixing sequences of for-loops. When two or more for
loops occured within a generator in sequence generator_tools produced a
wrong jump sequence. This has been adjusted in this version.
|
2008-03-28
|
0.3.1
|
- Fix sameness bug for
pickling generators. A generator object G which existed at different
locations loc1, loc2 has been converted into distinct
GeneratorSnapshots GS1, GS2 for pickling which lead to distinct
unpickled generators uG1, uG2. We have established now a unique
correspondence of G with uG.
|
2008-01-26
|
0.3
|
- Redesign of the
picklegenerators module ( by Lorenz Quack )
|
2008-01-22
|
0.2
|
- Implement copy_filter function as second optional
parameter
- Modify unpickling s.t. GeneratorSnapshot is not
deepcopied anymore
- Adapt interface of GeneratorPickler to be complient
with interface of pickler.Pickler and declare the old interface as
deprecated.
- Delay a 0.2 release for Python 3.0
|
2007-10-5
|
0.1
|
Initial release
|
|


Model
Classes
Comments
CommentsModel
CommentUser
FavouriteComment
FavouriteModel
IDModel
SaveFavourite
SubCommentModel
UserModel


Picture upload example
Image upload example
#### Settings ```javascript { imageUpload: false, imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], imageUploadURL: "./php/upload.php", } ``` #### JSON data ```json { success: 0 | 1, // 0 means upload failed, 1 means upload succeeded message: "Prompt message, upload success or upload failure, error message, etc.", url: "path" // only return when the upload is successful } ```


|
EvolutronicLife
1.0
|
Functions | |
| def | init |
| def | update |
| def | replace_option |
| def | key_pressed |
| def | terminate |
| def | progress_info |
Variables | |
| tuple | _main_win = curses.initscr() |
| int | options_padding = 14 |
| def WindowManager.init | ( | ) |
init subwindows
| def WindowManager.key_pressed | ( | ) |
returns the current pressed key
| def WindowManager.progress_info | ( | end | ) |
| def WindowManager.replace_option | ( | option_to_replace, | |
| new_option | |||
| ) |
replaces option_to_replace with new_option in the_option pane :param option_to_replace: the option to replace :param new_option: the new option to take its place
| def WindowManager.terminate | ( | ) |
unloads curses
| def WindowManager.update | ( | the_map = None , |
|
tile_info = None |
|||
| ) |
updates content of info window and also the map window, if a map is given :param the_map: the game map in the current state
| tuple WindowManager._main_win = curses.initscr() |
| int WindowManager.options_padding = 14 |


Translator: Dong Wang
Author: labuladong
The pancake sorting is a very interesting practical problem: assuming there are n
pieces of pancakes of different sizes on the plate, how do you turn it several times with a spatula to make these pancakes in order(small up, big down)?
Imagine using a spatula to flip a pile of pancakes. There are actually a few restrictions that we can only flip the top cakes at a time:
Our question is, how do you use an algorithm to get a sequence of flips to make the cake pile order?
First, we need to abstract this problem and use an array to represent the pancakes heap:
How to solve this problem? In fact, it is similar to the previous article Part of a Recursive Reverse Linked List, which also requires recursive thinking.
Why is this problem recursive? For example, we need to implement a function like this:
// cakes is a bunch of pancakes, the function will sort the first n pancakes
void sort(int[] cakes, int n);
If we find the largest of the first n
pancakes, then we try to flip this pancake to the bottom:
Then, the scale of the original problem can be reduced, recursively calling pancakeSort (A, n-1)
:
Next, how to sort the n-1
pancakes above? Still find the largest piece of pancakes from it, then place this piece of pancake to the bottom, and then recursively call pancakeSort (A, n-1-1)
…
You see, this is the nature of recursion. To summarize, the idea is:
n
pancakes.pancakeSort(A, n-1)
.Base case: When n == 1
, there is no need to flip when sorting 1 pancake.
So, the last question left, how do you manage to turn a piece of pancake to the end?
In fact, it is very simple. For example, the third pancake is the largest, and we want to change it to the end, that is, to the n
block. You can do this:
n
cakes, so that the largest pancake turns to the n
-th pancake, which is the last pancake.After the above two processes are understood, the solution can be basically written, but the title requires us to write a specific sequence of inversion operations, which is also very simple, as long as it is recorded each time the pancake is turned.
As long as the above ideas are implemented in code, the only thing to note is that the array index starts from 0, and the results we want to return are calculated from 1.
// record the reverse operation sequence
LinkedList<Integer> res = new LinkedList<>();
List<Integer> pancakeSort(int[] cakes) {
sort(cakes, cakes.length);
return res;
}
void sort(int[] cakes, int n) {
// base case
if (n == 1) return;
// find the index of the largest pancake
int maxCake = 0;
int maxCakeIndex = 0;
for (int i = 0; i < n; i++)
if (cakes[i] > maxCake) {
maxCakeIndex = i;
maxCake = cakes[i];
}
// first flip, turn the largest pancake to the top
reverse(cakes, 0, maxCakeIndex);
res.add(maxCakeIndex + 1);
// second flip, turn the largest pancake to the bottom
reverse(cakes, 0, n - 1);
res.add(n);
// recursive
sort(cakes, n - 1);
}
void reverse(int[] arr, int i, int j) {
while (i < j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++; j--;
}
}
hrough the detailed explanation just now, this code should be very clear.
The time complexity of the algorithm is easy to calculate, because the number of recursive calls is n
, each recursive call requires a for loop, the time complexity is O(n), so the total complexity is O(n^2).
Finally, we can think about a problem.: According to our thinking, the length of the operation sequence should be 2(n-1)
, because each recursion needs to perform 2 flips and record operations and there are always n
layers of recursion, but since the base case returns the result directly without inversion, the length of the final operation sequence should be fixed 2(n-1)
.
Obviously, this result is not optimal (shortest). For example, a bunch of pancakes [3,2,4,1]
. The flip sequence obtained by our algorithm is [3,4,2,3,1,2]
, but the fastest way to flip should be [2,3,4]
:
[3,2,4,1]
[2,3,4,1]
[4,3,2,1]
[1,2,3,4]
If your algorithm is required to calculate the shortest operation sequence for sorting biscuits, how do you calculate it? In other words, what is the core idea and what algorithm skills must be used to solve the problem of finding the optimal solution?
May wish to share your thoughts.


Entrepreneurial, creative professional full of moxie, with a penchant for knowledge, higher thinking, and systems with twenty-six years of experience in design, brand development, web development, and animation. I’ve developed web presence solutions for major corporations including Marriott, Universal, and NBC. Now I'm putting those years of experience and expertise to work for small businesses.
Here are some services I can help with:
You can view my resume here and when you're ready contact me for a free consultation.


Video: Ex-Spurs player Kane could win Champions League under Mourinho and won’t want to leave
by Seb JenkinsTottenham Hotspur have appointed Jose Mourinho as their new manager, and Jamie O’Hara believes that Harry Kane will be happy under the Special One in North London.
Ex-Spurs man, O’Hara, asks why Kane would want to leave under Mourinho, a manager who wins trophies wherever he goes.
He goes as far to say that, with Jose in charge, Kane could win a Champions League title. This comes after Spurs finished second in the European competition last season, with Kane having to make do with a runners-up medal.
Have something to tell us about this article?


post_title: Documentation
author: Claudius Weinberger
post_excerpt: ""
layout: page
permalink: /documentation
dsq_thread_id:
- ""
---
-
First Steps We will help you to get a quick impression what ArangoDB stands for. Get familiar with the open-source multi-purpose database and all of its features.
quickstart
-
ManualThe documentation for the current release. You can read the manual online or download the pdf.
onlinepdfepub
-
DriversHere you will find all drivers. Note: Many drivers are developed by the community. We welcome every developing-notes and requests.
find the right driver
-
InstallationFollow the instructions on this high-level guide to install ArangoDB for Mac OS X, Windows and several Linux- versions under apache 2 lincense.
install ArangoDB
-
Whats new in ArangoDB Explore the new Features and improvements in the current version of ArangoDB in detail.
read more
-
Upgrading ArangoDB Upgrade your ArangoDB to the newest version. If you are running an older version, please follow the instructions given.
read more
-
Set up your Cluster Setting up a cluster can be an intimidating task. With our How-To you can set up your own ArangoDB cluster easily
set up
-
The way to future Planed Features for the next releases.
read more
-
Media Here you can watch some videos about ArangoDB. You can also look at slides from conferences or user groups.
watch
-
Customers There is a growing number of organizations using ArangoDB. Here you can find the list of our customers
read more
Note: Our bug tracker is on Github, feel free to open tickets!
In the meantime: in case you have questions, don't hesitate and contact us - for options see the community page.
Frank is twittering for the project on Twitter using @fceller. We've also a "generic" twitter account mainly for announcements called @arangodb You can also subscribe to a low traffic announcement list on the connect page.
The documentation for previous, now outdated releases of ArangoDB can be found here:


|
Halide
|
#include <mini_d3d12.h>
Definition at line 3235 of file mini_d3d12.h.
| D3D12_FILTER D3D12_STATIC_SAMPLER_DESC::Filter |
Definition at line 3237 of file mini_d3d12.h.
| D3D12_TEXTURE_ADDRESS_MODE D3D12_STATIC_SAMPLER_DESC::AddressU |
Definition at line 3238 of file mini_d3d12.h.
| D3D12_TEXTURE_ADDRESS_MODE D3D12_STATIC_SAMPLER_DESC::AddressV |
Definition at line 3239 of file mini_d3d12.h.
| D3D12_TEXTURE_ADDRESS_MODE D3D12_STATIC_SAMPLER_DESC::AddressW |
Definition at line 3240 of file mini_d3d12.h.
| FLOAT D3D12_STATIC_SAMPLER_DESC::MipLODBias |
Definition at line 3241 of file mini_d3d12.h.
| UINT D3D12_STATIC_SAMPLER_DESC::MaxAnisotropy |
Definition at line 3242 of file mini_d3d12.h.
| D3D12_COMPARISON_FUNC D3D12_STATIC_SAMPLER_DESC::ComparisonFunc |
Definition at line 3243 of file mini_d3d12.h.
| D3D12_STATIC_BORDER_COLOR D3D12_STATIC_SAMPLER_DESC::BorderColor |
Definition at line 3244 of file mini_d3d12.h.
| FLOAT D3D12_STATIC_SAMPLER_DESC::MinLOD |
Definition at line 3245 of file mini_d3d12.h.
| FLOAT D3D12_STATIC_SAMPLER_DESC::MaxLOD |
Definition at line 3246 of file mini_d3d12.h.
| UINT D3D12_STATIC_SAMPLER_DESC::ShaderRegister |
Definition at line 3247 of file mini_d3d12.h.
| UINT D3D12_STATIC_SAMPLER_DESC::RegisterSpace |
Definition at line 3248 of file mini_d3d12.h.
| D3D12_SHADER_VISIBILITY D3D12_STATIC_SAMPLER_DESC::ShaderVisibility |
Definition at line 3249 of file mini_d3d12.h.


BATMAN FOREVER A film review by Nizam U. Ahmed Copyright 1995 Nizam U. Ahmed
The Making of BATMAN FOREVER: A Play
Cast of characters: Al, a mild-mannered studio exec Bob, a superior studio exec
Act 1 Scene 1: A meeting
Bob: I called you in here today for one reason, son. Al: What's that sir? Bob: Our plans for an infinite series of blockbuster money-spinners is in jeopardy! Al: You mean ... the Batman franchise? Bob: Exactly! And you know who is behind it? Al: The public ... getting fed up with the same tired old formula perhaps? Bob: WHAT? Al: (Gulp) Erm ... sorry, I mean the film-makers, naturally. They do their best to reduce a film's appeal to merely the intelligent and thoughtful, don't they? Bob: That's better ... And who is the prime mover behind this attempt at bringing ... the "A" word ... into our money-spinning franchise? Al: The "A" word? You mean artistry?  Al: I'm sorry sir! It's Mr. Burton, surely? A guaranteed happy, smiley kids film, turned into a dark, brooding nightmare piece? Bob: (smiles) I see great things for you boy ... Al: And as for the sequel- Bob: Don't talk to me about that sequel! We've probably lost $20m in revenue for Batman 3 'cos of that movie. I mean, what could be guaranteed to turn kids off more than a film about 3 demented freaks running around with personality disorders ... Al: Not forgetting the fact that McDonalds didn't want to plug it on the side of their milkshakes ... Bob: You've got it in one! We must make sure the new Batman appeals to the youngest possible audience - McDonalds must support us! Al: So we should drop Tim Burton ... replace him with more of a "team player"? Bob: I was thinking perhaps Joel Schumacher ... Al: I completely agree sir! Someone we can contro- communicate with. And the cast? Bob: Think "big stars." Al: But shouldn't we think up a story first? Bob: Forget the story! We just need lots of running around, loud bangs, vivid colours ... Stars! Jim Carrey! Tommy Lee Jones! Al: But they wouldn't gel. Bob: PARDON? Al: Nothing. You were saying, big stars ... Bob: Sex appeal ... Nicole Kidman. New feminist angle ... make her a shrink! Yes ... and Robin! We can hype up his appearance in the press releases. Al: Shouldn't we work on a script now? Bob: Give it to one of our lowly writers, tell 'em to knock it up in an hour. It's not important, we want to get the kids! Al: But the parents, boss! They want something they can watch with their kids. Bob: Okay. Keep the dark visuals. Maybe ol' Mr. Burton was onto something there ... but I want bright day-glo colours everywhere! Al: You got it. I'll get to work right away sir. Anything else? Bob: Never forget, why are we making this movie? Al: $ CHING $ ! Bob: You'll go far son ...
Overall rating: 25 %
-- Nizam U Ahmed University of Surrey at Guildford , UK E-mail<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


The w3-bar class is a container for displaying HTML elements horizontally.
The w3-bar-item class defines the container elements.
It it a perfect tool for creating navigation bars:
The Italian / Austrian Alps


Toggle navigation
Ready to Fetch Wikipedia
English
French
Spanish
German
Polish
Hebrew
Ido
Portugese
Italian
Twi
Fetch
Article name
Fetched Content will appear here :)


Do small exercises throughout the day. Anywhere. No equipment required. Tailored to your fitness level.
Login with Facebook


Leading and trailing whitespace in table cells gets trimmed by the HTML parser. Using the HTML escape does not help, as SPACE (U+0020) is not equal to NON-BREAKING SPACE (U+00A0).
If leading of trailing whitespace is significant in tests, fixtures and test tables should both wrap the actual and expected test with suitable delimiters, e.g. "[" and "]".
| rules for | org.ops4j.pax.carrot.sample1.TextWithNull | |
| id | comment | text? |
| 1 | plain text | Carrots and peas |
| 2 | whitespace | |
| 3 | empty string | |
| 4 | null |


She is a developer.
Her goal is to constantly learn,
then build great real world solutions.
She has a strong leaning toward B2B.
She undertook the Moringa School Web Development class and continues to learn and practice code.
She also undertook a Web Development Training by DevCTraining with Andela, Facebook Developer Circles and Open Classrooms.
She is currently learning Python and building small projects.
I go for an "omni-channel" approach.
My layouts look great across a range of devices.
I go for optimized.
Allowing for fast loading pages.
I go for easy to use.
The user just needs to do, not think
Pages that are 'alive'
Pages that 'pop'
This is a passion project for a small e-commerce store that sells business card holders and wallets.
It is entirely powered by Javascript, jQuery, HTML and CSS.
At Moringa, we had lightning talks where we would talk about our other interests, apart from code.
Reach me on +254-712-227-589


The first important concept to understand about any webpage is that every element on a web page, the title, the images the paragraphs are all treated in blocks. Try to imagine a border enclosing each element on the web page as a way to keep them separated so they can be styled.
Without any display styling each box of content on your page would sit one on top of the other in a vertical line which is called block display and is the default styling. To position content as we want it to appear on screen we add a value to the display styling of its element. Inline and inline block are two of these display options.
Inline display will position each box with it’s contents in a horizontal line one after the other and always to the width of the contents inside. Inline display is best used as the display for a sentence or paragraph of text where you want to highlight one phrase with different italics or highlight a section of the paragraph.
Inline display ignores the following values when associated to the element;
Inline block display will position each box with it’s content side-by-side much the same as Inline display. The differences between the two are that Inline Block will account for extra values such as height associated to the element.
When you add extra styling such as a padding around the content, the box will account for this and increase the white space between contents and the box border by the padding indicated. This option will also account forw rapping, when the row can fit no more boxes on it will automatically wrap underneath in the appropriate margin spacing indicated.
Do you need to be able to change the height, width, top or bottom padding? choose inline blocks, if not inline it is.