text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

			<title>phpDocumentor Tutorial</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>

							Previous

							Up

							Next

							Source code for sample3.php

							phpDocumentor Guide to Creating Fantastic Documentation

							Documentable PHP Elements

phpDocumentor Tutorial

An in-depth look at using phpDocumentor to document PHP Source Code, and phpDocumentor internals

Gregory Beaver

Tutorial written by cellog@php.net

Table of Contents

Introduction

phpDocumentor Basics

Starting Out From Scratch

DocBlocks

DocBlock Description details

DocBlock Templates

Tags

Documenting your PHP project

Where to begin

Elements of the source code that can be documented

Dividing projects into packages

Advanced phpDocumentor: tutorials and extended Documentation

Running phpDocumentor

Using the new Web Interface docbuilder

Using the old Web Interface phpdoc.php or new_phpdoc.php

Using the Command-line tool

Running the command-line in MS Windows

Running the command-line in unix

-c, --config

-cp, --converterparams

-ct, --customtags

-dh, --hidden

-dc, --defaultcategoryname

-dn, --defaultpackagename

-d, --directory

-ed, --examplesdir

-f, --filename

-i, --ignore

-is, --ignoresymlinks

-it, --ignore-tags

-j, --javadocdesc

-o, --output

-pp, --parseprivate

-po, --packageoutput

-p, --pear

-q, --quiet

-ric, --readmeinstallchangelog

-s, --sourcecode

-t, --target

-tb, --templatebase

-ti, --title

-ue, --undocumentedelements

phpDocumentor's dynamic User-defined config files

phpDocumentor.ini - global configuration options

Introduction

phpDocumentor is the most advanced automatic documentation system written for PHP, in PHP. This package has many features:

NEW The first auto-documentor with PHP 5 support

Extended documentation in docbook format with linking to any element and to other documentation,
      including sub-sections, from the source code (see phpDocumentor Tutorials)

docblock templates to cut down on repetition

XML:DocBook:peardoc2 templates for PEAR developers

Greater ease of extending a Converter, see Converter Manual

ability to parse any PHP file, regardless of documentation format

conforms loosely to the JavaDOC protocol,
     and will be familiar to Java programmers

documents all includes, constants, functions, static functions, classes,
      methods, static variables, class variables, and can document global variables and
      external tutorials

auto-linking to pre-defined PHP functions

Output in HTML, CHM, PDF, XML DocBook formats

templateable with many bundled templates

automatic linking to elements in any documented package

documents name conflicts between packages to help avoid PHP errors

document CVS repository directly.

support for JavaDoc doclet-like output through Converters

error/warning tracking system

extreme class intelligence: inherits documentation, package

complete phpdoc.de DocBlock tag support.  Additions include @var, @magic, @deprec, @todo, and phpdoc.de parsing of @param.

alphabetical indexing of all elements by package and overall

class trees

MUCH more than just this short list

phpDocumentor Basics

Starting Out From Scratch

The documentation process begins with the most basic element of phpDocumentor: a
    Documentation block or DocBlock. A basic
    DocBlock looks like this:

/**

 *

 */

A DocBlock is an extended C++-style PHP comment that begins with "/**" and has
    an "*" at the beginning of every line.  DocBlocks precede the element they are documenting.

   Any line within a DocBlock that doesn't begin with a * will be ignored.

To document function "foo()", place the DocBlock immediately before the function declaration:

/**

 * Defies imagination, extends boundaries and saves the world ...all before breakfast!

 */

function foo()

{

}

This example will apply the DocBlock to "define('me',2);" instead of to "function foo()":

/**

 * DocBlock for function foo?

 *

 * No, this will be for the constant me!

 */

define('me',2);

function foo($param = me)

{

}

define() statements, functions, classes, class methods, and class vars, include()
    statements, and global variables can all be documented, see
    Elements of the source code that can be documented

DocBlocks

A DocBlock contains three basic segments in this order:

Short Description

Long Description

Tags

The Short Description starts on the first line, and can be terminated with a blank line
    or a period. A period inside a word (like example.com or 0.1 %) is ignored. If the Short
    Description would become more than three lines long, only the first line is taken. The Long
    Description continues for as many lines as desired and may contain html markup for display
    formatting.  Here is a sample DocBlock with a Short and a Long Description:

/**

 * return the date of Easter

 *

 * Using the formula from "Formulas that are way too complicated for anyone to

 * ever understand except for me" by Irwin Nerdy, this function calculates the

 * date of Easter given a date in the Ancient Mayan Calendar, if you can also

 * guess the birthday of the author.

 */

Optionally, you may enclose all paragraphs in a <p></p> tag.  Be careful,
    if the first paragraph does not begin with <p>, phpDocumentor will assume that the
    DocBlock is using the simple double linebreak to define paragraph breaks as in:

/**

 * Short desc

 *

 * Long description first sentence starts here

 * and continues on this line for a while

 * finally concluding here at the end of

 * this paragraph

 *

 * The blank line above denotes a paragraph break

 */

Here is an example of using <p>

/**

 * Short desc

 *

 * <p>Long description first sentence starts here

 * and continues on this line for a while

 * finally concluding here at the end of

 * this paragraph</p>

 * This text is completely ignored! it is not enclosed in p tags

 * <p>This is a new paragraph</p>

 */

phpDocumentor also supports JavaDoc's DocBlock format through the command-line
    option -j, --javadocdesc.  Due to
    the non-xhtml compliant unmatched p tag, we highly recommend you avoid this syntax
    whenever possible

/**

 * <p>

 * Short desc is only to the first period.

 * This means a sentence like:

 * "Parses Mr./Mrs. out of $_GET." will

 * parse a short description of "Parses Mr."

 * which is rather silly.  Long description is

 * the entire DocBlock description including the

 * Short desc, and paragraphs begin where p is like:

 * <p>

 * The p above denotes a paragraph break

 */

phpDocumentor will convert all whitespace into a single space in the
    long description, use paragraph breaks to define newlines, or <pre>,
    as discussed in the next section.

DocBlock Description details

As of phpDocumentor 1.2.0, the long and short description of a DocBlock
    is parsed for a few select html tags that determine additional formatting.  Due
    to the nature of phpDocumentor's output as multiple-format, straight html is not
    allowed in a DocBlock, and will be converted into plain text by all of the
    converters unless it is one of these tags:

<b> -- emphasize/bold text

<code> -- Use this to surround php code, some converters will highlight it

<br> -- hard line break, may be ignored by some converters

<i> -- italicize/mark as important

<kbd> -- denote keyboard input/screen display

<li> -- list item

<ol> -- ordered list

<p> -- If used to enclose all paragraphs, otherwise it will be considered text

<pre> -- Preserve line breaks and spacing, and assume all tags are text (like XML's CDATA)

<samp> -- denote sample or examples (non-php)

<ul> -- unordered list

<var> -- denote a variable name

    Do not think of these tags as text, they are parsed into objects and converted
    into the appropriate output format by the converter.  So, a b tag may become
    <emphasis> in DocBook, and a <p> tag might become
"    "
 (4 spaces)
    in the PDF converter!  The text output is determined by the template options file
    options.ini found in the base directory of every template.  For instance, the
    options.ini file for the HTML:frames:default template is in
    phpDocumentor/Converters/HTML/frames/templates/default/options.ini

For the rare case when the text "<b>" is needed in a DocBlock,
    use a double delimiter as in <<b>>.  phpDocumentor will automatically
    translate that to the physical text "<b>".

Similarly, if you need an actual "@" in your DocBlock's description parts,
   you should be careful to either ensure it is not the first character on a line,
   or else escape it ("\@") to avoid it being interpreted as a PhpDocumentor tag marker.

/**

 * Demonstrate an @include file

 * line in a code block:

 *

 * <code>

 * \@include somefile.php

 * </code>

 */

This will parse as if it were:

/**

 * Demonstrate an @include file

 * line in a code block:

 *

 * <code>

 * @include somefile.php

 *  </code>

 */

   The <code>, <kbd>, and <pre> tags ignore any html listed above
    except for their own closing tags (</code> </kbd> </pre>).
    This is obviously necessary for each of those tag's behavior of controlling the appearance of the text
    inside their tag blocks, without allowing other nested tags (like <b>) interfering inside them.
    In general, other tags will allow other tags to be nested in them
    (i.e. <samp><b>bold_my_sample</b></samp>).

New 1.2.0rc1: If you need to use the closing comment "*/"
    in a DocBlock, use the special escape sequence "{@*}."  Here's an example:

/**

 * Simple DocBlock with a code example containing a docblock

 *

 * <code>

 *  /**

 *   * My sample DocBlock in code

 *   {@*}

 * </code>

 */

This will parse as if it were:

/**

 * Simple DocBlock with a code example containing a docblock

 *

 * <code>

 *  /**

 *   * My sample DocBlock in code

 *   */

 * </code>

 */

New 1.2.0rc1: The phpEdit tool supports very clever list
    extraction from DocBlocks, and now phpDocumentor supports the same cleverness.  This example:

/**

 * Simple DocBlock with simple lists

 *

 * Here's a simple list:

 * - item 1

 * - item 2, this one

 *   is multi-line

 * - item 3

 * end of list.  Next list is ordered

 * 1 ordered item 1

 * 2 ordered item 2

 * end of list. This is also ordered:

 * 1. ordered item 1

 * 2. ordered item 2

 */

phpDocumentor recognizes any simple list that begins with "-",
    "+", "#" and "o", and any ordered list with
    sequential numbers or numbers followed by "." as above.  The list
    delimiter must be followed by a space (not a tab!) and whitespace must line
    up exactly, or phpDocumentor will not recognize the list items as being in
    the same list.

/**

 * Simple DocBlock with screwy lists

 *

 * +not a list at all, no space

 * Here's 3 lists!

 * - item 1

 *  - item 2, this one

 *   is multi-line

 *- item 3

 */

Again, you must line up the list iterators in the same vertical column
     in order for those list items to be considered "on the same list".
     Also, you cannot create nested lists using the simple list iterators...
     doing so means it's no longer a "simple" list!  Varying the spacing
     of the list iterators does not create nesting of the lists... it only starts up
     new simple lists.  If you specifically need a nested list, you must use the list
     tags (<ol>, <ul>):

/**

 * DocBlock with nested lists

 *

 * Here's the "complex" list:

 * <ul>

 * <li>outer item 1</li>

 * <li>outer item 2, this one

 *   is multi-line</li>

 * <li>item 3 is a nested inner list

 * <ul>

 * <li>inner item 1</li>

 * <li>inner item 2</li>

 * </ul>

 * <li>outer item 4</li>

 * </ul>

 */

In some cases, the text description in a doc tag can contain a list, be it simple
     or complex.  Notice that a title line is needed, with the list items themselves
     beginning on the next line:

/**

 * DocBlock with nested lists

 * in the tag descriptions

 * @todo My Simple TODO List

 *     - item 1

 *     - item 2

 *     - item 3

 * @todo My Complex TODO List

 *     <ol>

 *       <li>item 1.0</li>

 *       <li>item 2.0</li>

 *       <li>item 3.0</li>

 *         <ol>

 *           <li>item 3.1</li>

 *           <li>item 3.2</li>

 *         </ol>

 *       <li>item 4.0</li>

 *     </ol>

 */

Tagged lists are always a more robust and predictable option for you to
     use.  Simple lists are convenient, but if you find yourself trying to bend
     a simple list into displaying a certain way in your generated docs, you may
     be better served by switching to a tagged list instead.

For in-depth information on how phpDocumentor parses the description
    field, see ParserDescCleanup.inc

DocBlock Templates

New for version 1.2.0, phpDocumentor supports the use of DocBlock
    templates.  The purpose of a DocBlock template is to reduce redundant
    typing.  For instance, if a large number of class variables are private,
    one would use a DocBlock template to mark them as private.  DocBlock templates
    simply augment any normal DocBlocks found in the template block.

A DocBlock template is distinguished from a normal DocBlock by its header.
    Here is the most basic DocBlock template:

/**#@+

 *

 */

The text that marks this as a DocBlock template is "/**#@+"
    - all 6 characters must be present.  DocBlock templates are applied to all
    documentable elements until the ending template marker:

/**#@-*/

Note that all 8 characters must appear as "/**#@-*/" in order
    for phpDocumentor to recognize them as a template.  Here is an example of a
    DocBlock template in action:

class Bob

{

    // beginning of docblock template area

    /**#@+

     * @access private

     * @var string

     */

    var $_var1 = 'hello';

    var $_var2 = 'my';

    var $_var3 = 'name';

    var $_var4 = 'is';

    var $_var5 = 'Bob';

    var $_var6 = 'and';

    var $_var7 = 'I';

    /**

     * Two words

     */

    var $_var8 = 'like strings';

    /**#@-*/

    var $publicvar = 'Lookee me!';

}

This example will parse as if it were:

class Bob

{

    // beginning of docblock template area

    /**

     * @access private

     * @var string

     */

    var $_var1 = 'hello';

    /**

     * @access private

     * @var string

     */

    var $_var2 = 'my';

    /**

     * @access private

     * @var string

     */

    var $_var3 = 'name';

    /**

     * @access private

     * @var string

     */

    var $_var4 = 'is';

    /**

     * @access private

     * @var string

     */

    var $_var5 = 'Bob';

    /**

     * @access private

     * @var string

     */

    var $_var6 = 'and';

    /**

     * @access private

     * @var string

     */

    var $_var7 = 'I';

    /**

     * Two words

     * @access private

     * @var string

     */

    var $_var8 = 'like strings';

    var $publicvar = 'Lookee me!';

}

Note that for $_var8 the DocBlock template merged
    with the DocBlock.  The rules for merging are simple:

The long description of the docblock template is added to
      the front of the long description.  The short description is ignored.

All tags are merged from the docblock template

Tags

Tags are single words prefixed by a "@" symbol.  Tags inform
    phpDocumentor how to present information and modify display of documentation.
    All tags are optional, but if you use a tag, they do have specific requirements
    to parse properly.

A list of all possible tags in phpDocumentor follows:

/**

 * The short description

 *

 * As many lines of extendend description as you want {@link element}

 * links to an element

 * {@link http://www.example.com Example hyperlink inline link} links to

 * a website. The inline

 * source tag displays function source code in the description:

 * {@source }

 *

 * In addition, in version 1.2+ one can link to extended documentation like this

 * documentation using {@tutorial phpDocumentor/phpDocumentor.howto.pkg}

 * In a method/class var, {@inheritdoc may be used to copy documentation from}

 * the parent method

 * {@internal

 * This paragraph explains very detailed information that will only

 * be of use to advanced developers, and can contain

 * {@link http://www.example.com Other inline links!} as well as text}}}

 *

 * Here are the tags:

 *

 * @abstract

 * @access       public or private

 * @author       author name <author@email>

 * @copyright    name date

 * @deprecated   description

 * @deprec       alias for deprecated

 * @example      /path/to/example

 * @exception    Javadoc-compatible, use as needed

 * @global       type $globalvarname

   or

 * @global       type description of global variable usage in a function

 * @ignore

 * @internal     private information for advanced developers only

 * @param        type [$varname] description

 * @return       type description

 * @link         URL

 * @name         procpagealias

   or

 * @name         $globalvaralias

 * @magic        phpdoc.de compatibility

 * @package      package name

 * @see          name of another element that can be documented,

 *                produces a link to it in the documentation

 * @since        a version or a date

 * @static

 * @staticvar    type description of static variable usage in a function

 * @subpackage    sub package name, groupings inside of a project

 * @throws       Javadoc-compatible, use as needed

 * @todo         phpdoc.de compatibility

 * @var        type    a data type for a class variable

 * @version    version

 */

function if_there_is_an_inline_source_tag_this_must_be_a_function()

{

// ...

}

In addition, tutorials allow two addition inline tags: {@id}, used to
    allow direct linking to sections in a tutorial, and {@toc}, used to generate
    a table of contents from {@id}s in the file.  Think of {@id} like an <a
    name="idname"> HTML tag, it serves the same function.

See inline {@id} and inline {@toc} for
    detailed information

In the example below, {@id} is used to name the refsect1 "mysection"
    and the refsect2 "mysection.mysubsection" - note that the sub-sections inherit
    the parent section's id.

<refentry id="{@id}">
 <refsect1 id="{@id mysection}">
  <refsect2 id="{@id mysubsection}">
  </refsect2>
 </refsect1>
</refentry>

For an in-depth look at phpDocumentor tags, read phpDocumentor tags,
    and for an in-depth look at inline tags, read phpDocumentor Inline tags.

Documenting your PHP project

Where to begin

Before you begin documenting your PHP project, you might want to try
    a test run on your undocumented source code to see what kind of information
    phpDocumentor will automatically extract from the source code.  phpDocumentor
    is designed to make the task of documenting minimally redundant.  This means
    less work, and better, up-to-date documentation with less effort than it used
    to take.

   phpDocumentor is a great tool, but it will not write good documentation
    for you.  Please read the phpDocumentor Guide to Creating Fantastic Documentation

Elements of the source code that can be documented

Dividing projects into packages

To understand the role of packages and how to use @package,
     it is important to know the logic behind packaging in PHP.  The quest for structured
     programming led to the invention of functions, then classes, and finally packages.
     Traditionally, a re-usable software module was a collection of variables, constants
     and functions that could be used by another software package.  PHP is an example of
     this model, as their are many extensions that consist of constants and functions like
     the tokenizer extension.  One can think of the tokenizer extension as a package: it
     is a complete set of data, variables and functions that can be used in other programs.
     A more structured format of this model is of course objects, or classes.  A class
     contains variables and functions (but no constants in PHP).  A single class packages
     together related functions and variables to be re-used.

phpDocumentor defines package in two ways:

Functions, Constants and Global Variables are grouped into files
       (by the filesystem), which are in turn grouped into packages using the @package
       tag in a page-level DocBlock

Methods and Class Variables are grouped into classes (by PH),
       which are in turn grouped into packages in a Class DocBlock

     These two definitions of package are exclusive.  In other words, it is possible
     to have classes of a different package of the file that contains it!  Here's an example:

    It may be possible, but don't put classes into a different package from the
     file they reside in, that will be very confusing and unnecessary.  This behavior is
     deprecated, in version 2.0, phpDocumentor will halt parsing upon this condition.

<?php

/**

 * Pretend this is a file

 *

 * Page-level DocBlock is here because it is the first DocBlock

 * in the file, and is immediately followed by the second

 * DocBlock before any documentable element is declared

 * (function, define, class, global variable, include)

 * @package pagepackage

 */

/**

 * Here is the class DocBlock

 *

 * The class package is different from the page package!

 * @package classpackage

 */

class myclass

{

}

?>

For more information on page-level versus class-level packaging, see Procedural Elements

Perhaps the best way to organize packages is to put all procedural code
     into separate files from classes.  PEAR recommends
     putting every class into a separate file.  For small, utility classes, this may
     not be the best solution for all cases, but it is still best to separate packages
     into different files for consistency.

Advanced phpDocumentor: tutorials and extended Documentation

phpDocumentor developers have received a number of requests to allow linking
    to external documentation, and to sections of that documentation.  If phpDocumentor
    only could create HTML documents, this would be a simple task, but the presence of
    PDF and now XML converters as well as future possibilities complicates this question
    tremendously.  What is the solution?

Give phpDocumentor the ability to parse external documentation in a common format
    and then convert it to the appropriate format for each converter.  The implementation
    of this solution in version 1.2.0 is very versatile.  Making use of the standard DocBook
    XML format, external documentation can be designed and then reformatted for any output.
    No longer is external documentation tied down to one "look."  Here's a short
    list of the benefits of this approach:

Benefits of using DocBook as the format:

DocBook is very similar to HTML at the basic level and very
      easy to learn.

Each template has its own options.ini file which determines
      how the DocBook tags will be translated into the output language - no need
      to learn xslt.

Adding in xslt support will be very easy to allow for future
      customization

    Benefits of integrating tutorials/external documentation into phpDocumentor:

Linking to external documentation from within API docs is possible

Linking to API docs from external documentation is also possible

Customizable table of contents, both of all tutorials and within
      a tutorial via inline {@toc}

It is possible to create User-level documentation that has direct
      access to Programmer-level documentation

User-level documentation generally consists of tutorials and information on how
    to use a package, and avoids extreme detail.  On the other hand, programmer-level
    documentation has all the details a programmer needs to extend and modify a package.
    phpDocumentor has been assisting the creation of programmer-level documentation since
    its inception.  With the addition of tutorials, it can now ease the creation of user-level
    documentation.

For an in-depth look at how to use tutorials, read phpDocumentor Tutorials

Running phpDocumentor

There are two bundled ways of invoking phpDocumentor, the command-line phpdoc,
   or the web interface phpdoc.php/new_phpdoc.php.

Using the new Web Interface docbuilder

The new web interface requires a working installation of PHP with a web server,
    and must be accessible from the document root.  Docbuilder is the creation of Andrew
    Eddies, and it combines some slick formatting with the functionality of the old web
    interface.  The docbuilder interface can be accessed via index.html in the install
    directory of phpDocumentor, or the docbuilder subdirectory.

Using the old Web Interface phpdoc.php or new_phpdoc.php

In order to use the web interface, there are a number of factors that must
    be set up before anything else can occur.  First, you need a working web server
    with php (it had to be said).  This manual will not assist with that setup.  Next,
    the phpdoc.php or new_phpdoc.php file needs to be accessible by the webserver.  In
    unix, place a symbolic link using ln -s to the desired interface into the public
    html directory.

   Security is always an issue with the internet.  Do not place phpDocumentor
    into the web server publicly available path on a server connected to the internet.
    Make sure that phpDocumentor will not have the power to overwrite ANY
    system or user files.

Note that since the webserver runs as user nobody in unix, the generated files
    will be owned by nobody.  The only way to change this is to either run phpDocumentor
    from the command-line or to add a chuser wrapper around httpd.  We do not
    recommend using a chuser wrapper or running phpDocumentor as root.  It is
    much easier and safer to use a config file (see phpDocumentor's dynamic User-defined config files)
    from the command line.

Using the Command-line tool

Running the command-line in MS Windows

Running phpDocumentor from the command-line is fairly straightforward, even in
     windows.  It is recommended to use the web interface in windows, from a non-publicly
     accessible server root, as none of the permissions issues exist that exist in unix.
     However, to use phpDocumentor from the command line is possible.  First, put the
     location of php into the system path, then type:

C:\>php-cli C:\path\to\phpdoc\phpdoc [commandline]

An alternative is to edit the phpdoc.bat file, and place phpdoc in the path,
     then you can run phpdoc as a normal command.

Running the command-line in unix

Running the command-line tool phpdoc is very easy in unix:

.\phpdoc [commandline]

<colgroup span = "3"/>

Command-line switches

-cp
      --converterparams
      dynamic parameters for a converter, separate values with commas

-ct
      --customtags
      comma-separated list of non-standard @tags to pass to the converter as valid tags

-d
      --directory
      name of a directory(s) to parse directory1,directory2

-dc
      --defaultcategoryname
      name to use for the default category.  If not specified, uses 'default'

-dh
      --hidden
      set equal to on (-dh on) to descend into hidden directories (directories
       starting with '.'), default is off

-dn
      --defaultpackagename
      name to use for the default package.  If not specified, uses 'default'

-ed
      --examplesdir
      full path of the directory to look for example files from @example tags

-f
      --filename
      name of file(s) to parse ',' file1,file2.  Can contain complete path and * ? wildcards

-i
      --ignore
      file(s) that will be ignored, multiple separated by ','.  Wildcards * and ? are ok

-is
      --ignoresymlinks
      Explicitly ignore symlinks, both symlinked directories and symlinked files.
      Valid options are "on" and "offn" default value is "off"

-it
      --ignore-tags
      tags to ignore for this parse.  @package, @subpackage, @access and @ignore may not be ignored.

-j
      --javadocdesc
      use JavaDoc-compliant description (short desc is part of description, and is everything up to first .)

-o
      --output
      output information, format:converter:template (HTML:frames:phpedit for example)

-p
      --pear
      Parse a PEAR-style repository (package is directory, _members are @access private) on/off default off

-po
      --packageoutput
      output documentation only for selected packages.  Use a comma-delimited list

-pp
      --parseprivate
      parse elements marked private with @access.  Valid options are "on"
       and "off" default value is "off"

-q
      --quiet
      do not display parsing/conversion messages.  Useful for cron jobs.  Valid options are "on"
       and "off" default value is "off"

-ric
      --readmeinstallchangelog
      Specify custom filenames to parse like README, INSTALL or CHANGELOG files

-s
      --sourcecode
      generate highlighted sourcecode for every parsed file (PHP 4.3.0+ only) on/off default off

-t
      --target
      path where to save the generated files

-ti
      --title
      title of generated documentation, default is 'Generated Documentation'

-tb
      --templatebase
      base location of all templates for this parse.  Note that if -tb /path/to/here, then
       templates for HTML:frames:default must be in /path/to/here/Converters/HTML/frames/templates/default/templates
       and the /path/to/here/Converters/HTML/frames/templates/default/templates_c directory must
       exist, or Smarty will bail on attempting to compile the templates.

-ue
      --undocumentedelements
      Enable warnings for undocumented elements. Useful for identifying classes and methods that haven't yet been documented.
      Valid options are "on" and "offn" default value is "off"

-c, --config

Use this option to load a config file (see phpDocumentor's dynamic User-defined config files)

"phpdoc -c default" will load the default.ini file

-cp, --converterparams

This option is only used to pass dynamic parameters to extended converters.  The options
     passed should be separated by commas, and are placed in the global variable
     $_phpDocumentor_setting['converterparams'], an array.  It is the
     responsibility of the Converter to access this variable, the code included with phpDocumentor
     does nothing with it.

-ct, --customtags

Use this option to specify tags that should be included in the list of valid tags for
     the current run of phpdoc

"phpdoc -ct mytag,anothertag" will tell phpDocumentor to parse this DocBlock:

/**

 * @mytag this is my tag

 * @anothertag this is another tag

 */

without raising any errors, and include the tags in the known tags list for the
     template to handle.  Note that in version 1.2.0+, the unknown_tags array is passed to templates.

-dh, --hidden

Use this option to tell phpDocumentor to parse files and directories that begin with a period (.)

-dc, --defaultcategoryname

This will tell phpDocumentor to group any uncategorized elements into the primary
     categoryname.  If not specified, the primary category is "default."  The
     category should be specified using the @category tag.

/**

 * This package has no category and will be grouped into the default

 * category unless -dc categoryname is used

 * @package mypackage

 */

class nocategory

{

}

-dn, --defaultpackagename

Use this option to tell phpDocumentor what the primary package's name is.  This will also tell phpDocumentor to group any unpackaged elements into the primary packagename.  If not specified, the primary package is "default"

/**

 * This class has no package and will be grouped into the default

 * package unless -dn packagename is used

 */

class nopackage

{

}

-d, --directory

This or the -f option must be present, either on the command-line or in the config file.

Unlike -f, -d does not accept wildcards.  Use -d to specify full paths or relative paths to the current directory that phpDocumentor should recursively search for documentable files.  phpDocumentor will search through all subdirectories of any directory in the command-line list for tutorials/ and any files that have valid .php extensions as defined in phpDocumentor.ini.  For example:

"phpdoc -d relative/path/to/dir1,/fullpath/to/here,.."

-ed, --examplesdir

The -ed option is used to specify the full path to a directory that example files are located in.  This command-line setting affects the output of the @example tag.

"phpdoc -ed /fullpath/to/examples"

-f, --filename

This or the -d option must be present, either on the command-line or in the config file.

This option is used to specify individual files or expressions with wildcards * and ?.  Use * to match any string, and ? to match any single character.

phpdoc -f m*.p* will match myfile.php, mary_who.isthat.phtml, etc.

phpdoc -f /path/m* will match /path/my/files/here.php, /path/mommy.php /path/mucho/grande/what.doc, etc.

phpdoc -f file?.php will match file1.php, file2.php and will not match file10.php

-i, --ignore

Use the -i option to exclude files and directories from parsing.  The -i option recognizes the * and ? wildcards, like -f does.  In addition, it is possible to ignore a subdirectory of any directory using "dirname/".

phpdoc -i tests/ will ignore /path/to/here/tests/* and /path/tests/*

phpdoc -i *.inc will ignore all .inc files

phpdoc -i *path/to/* will ignore /path/path/to/my/* as well as /path/to/*

phpdoc -i *test* will ignore /path/tests/* and /path/here/my_test.php

Since v1.3.2, the value or pattern you provide will be case-sensitive (OS permitting, anyway), and will be applied relative to the top-level directory in the -d argument.

phpdoc -i CVS/ will ignore /path/to/CVS/* but will not ignore /path/to/cvs

phpdoc -d /home/myhome/cvs/myproject -i cvs/ will ignore /home/myhome/cvs/myproject/files/cvs/* but will not ignore /home/myhome/cvs/*

-is, --ignoresymlinks

Use the -is option to explicitly ignore any symlinks, whether they be links to directories or links to files.

This only works on a Unix/Linux environment, since Windows doesn't have symlinks.

-it, --ignore-tags

Use the -it option to exclude specific tags from output.  This is used for creating multiple sets of documentation for different audiences.  For instance, to generate documentation for end-users, it may not be desired to output all @todo tags, so --ignore-tags @todo would be used.  To ignore inline tags, surround them with brackets {} like --ignore-tags {@internal}.

--ignore-tags will not ignore the core tags @global, @access, @package, @ignore, @name, @param, @return, @staticvar or @var.

    The --ignore-tags option requires a full tag name like --ignore-tags @todo.  --ignore-tags todo will not work.

-j, --javadocdesc

Use this command-line option to enforce strict compliance with JavaDoc.  JavaDoc DocBlocks are much less flexible than phpDocumentor's DocBlocks (see DocBlocks for information).

-o, --output

Use this required option to tell phpDocumentor which Converters and templates to use.  In this release, there are several choices:

HTML:frames:* - output is HTML with frames.

HTML:frames:default - JavaDoc-like template, very plain, minimal formatting

HTML:frames:earthli - BEAUTIFUL template written by Marco von Ballmoos

HTML:frames:l0l33t - Stylish template

HTML:frames:phpdoc.de - Similar to phpdoc.de's PHPDoc output

HTML:frames:phphtmllib - Very nice user-contributed template

all of the templates listed above are also available with javascripted expandable indexes, as HTML:frames:DOM/name where name is default, l0l33t, phpdoc.de, etcetera

HTML:frames:phpedit - Based on output from PHPEdit Help Generator

HTML:Smarty:* - output is HTML with no frames.

HTML:Smarty:default - Bold template design using css to control layout

HTML:Smarty:HandS - Layout is based on PHP, but more refined, with logo image

HTML:Smarty:PHP - Layout is identical to the PHP website

CHM:default:* - output is CHM, compiled help file format (Windows help).

CHM:default:default - Windows help file, based on HTML:frames:l0l33t

PDF:default:* - output is PDF, Adobe Acrobat format

PDF:default:default - standard, plain PDF formatting

XML:DocBook:* - output is XML, in DocBook format

XML:DocBook/peardoc2:default - documentation ready for compiling into peardoc for online pear.php.net documentation, 2nd revision

In 1.2.0+, it is possible to generate output for several converters and/or templates at once.  Simply specify a comma-delimited list of output:converter:template like:

phpdoc -o HTML:frames:default,HTML:Smarty:PHP,HTML:frames:phpedit,PDF:default:default -t ./docs -d .

-pp, --parseprivate

By default, phpDocumentor does not create documentation for any elements marked @access private.  This allows creation of end-user API docs that filter out low-level information that will not be useful to most developers using your code.  To create complete documentation of all elements, use this command-line option to turn on parsing of elements marked private with @access private.

-po, --packageoutput

Use this option to remove all elements grouped by @package tags in a comma-delimited list from output.  This option is useful for projects that are not organized into separate files for each package.  Parsing speed is not affected by this option, use -i, --ignore whenever possible instead of --packageoutput.

phpdoc -o HTML:frames:default -t ./docs -d . -po mypackage,thatotherpackage will only display documentation for elements marked with "@package mypackage" or "@package thatotherpackage"

-p, --pear

Use this option to parse a PEAR-style repository.  phpDocumentor will do several "smart" things to make life easier:

PEAR-style destructors are automatically parsed

If no @package tag is present in a file or class DocBlock, it will guess the package based on subdirectory

If a variable or method name begins with "_", it will be assumed to be @access private, unless an @access tag is present.  Constructors are also assumed to be @access private in the current version.

Warnings will be raised for every case above, as @package should always be explicit, as should @access private.  We do not like to assume that phpDocumentor knows better than you what to do with your code, and so will always require explicit usage or raise warnings if phpDocumentor does make any assumptions.

-q, --quiet

This option tells phpDocumentor to suppress output of parsing/conversion information to the console.  Use this for cron jobs or other situations where human intervention will not be needed.

-ric, --readmeinstallchangelog

This comma-separated list of files specifies files that should be parsed and included in the
    documentation.  phpDocumentor will automatically grab files listed here if and only if they are located
    in the top-level directory that is parsed.  In other words, if you parse these files:

/path/to/files/file1.php

/path/to/files/file2.php

/path/to/files/README

/path/to/files/subdir/file2.php

/path/to/files/subdir/README

The only README file that will be grabbed is /path/to/files/README, and not /path/to/files/subdir/REAMDE,
     because the directory that is closest to the root directory that contains a parsed file is /path/to/files.

The default list of files is located in phpDocumentor.ini, which is found in the root installation directory
     of phpDocumentor.

-s, --sourcecode

This option tells phpDocumentor to generate highlighted cross-referenced source code for every file parsed.  The highlighting code is somewhat unstable, so use this option at your own risk.

-t, --target

Use this to tell phpDocumentor where to put generated documentation.  Legal values are paths that phpDocumentor will have write access and directory creation priveleges.

-tb, --templatebase

-tb accepts a single pathname as its parameter.  The default value of -tb if unspecified is <phpDocumentor install directory>/phpDocumentor.  This raises a very important point to understand.  The -tb command-line is designed to tell phpDocumentor to look for all templates for all converters in subdirectories of the path specified.  By default, templates are located in a special subdirectory structure.

For the hypothetical outputformat:convertername:templatename -o, --output argument, the directory structure is Converters/outputformat/convertname/templates/templatename/.  The class file for convertname should be in the convertname/templates directly, right beside your templatename directory/ies.  In addition, Smarty expects to find two subdirectories, templates/ (containing the Smarty template files) and templates_c/ (which will contain the compiled template files).

"phpdoc -tb ~/phpdoctemplates -o HTML:frames:default" will only work if the directory ~/phpdoctemplates/Converters/HTML/frames/default/templates contains all the template files, and ~/phpdoctemplates/Converters/HTML/frames/default/templates_c exists.

-ti, --title

Set the global title of the generated documentation

-ue, --undocumentedelements

This option tells phpDocumentor whether or not to suppress warnings about certain objects (classes, methods) that are not documented via a DocBlock comment.  Use this to help identify objects that you still need to write documentation for.

phpDocumentor's dynamic User-defined config files

The new -c, --config command-line options heralds a new era of ease in using phpDocumentor.  What used to require:

phpdoc -t /path/to/output -d path/to/directory1,/another/path,/third/path\
-f /path/to/anotherfile.php -i *test.php,tests/ -pp on -ti My Title -o HTML:frames:phpedit

Can now be done in a single stroke!

phpdoc -c myconfig

What makes this all possible is the use of config files that contain all of the command-line information.  There are two configuration files included in the distribution of phpDocumentor, and both are in the user/ subdirectory.  To use a configuration file "myconfig.ini," simply place it in the user directory, and the command-line "phpdoc -c myconfig" will tell phpDocumentor to read all the command-line settings from that config file.  Configuration files may also be placed in another directory, just specify the full path to the configuration file:

phpdoc -c /full/path/to/myconfig.ini

The best way to ensure your config file matches the format expected by phpDocumentor is to copy the default.ini config file, and modify it to match your needs.  Lines that begin with a semi-colon (;) are ignored, and can be used for comments.

   Be sure to put in your config file all the runtime options you need, because all other command-line arguments are ignored if you use a config file.

phpDocumentor.ini - global configuration options

The phpDocumentor.ini file contains several useful options, most of which will never need to be changed.  However, some are useful.  The section [_phpDocumentor_options] contains several configuration settings that may be changed to enhance output documentation.  For Program Location, the relative path is specified as Program_Root/relativepath/to/file.  The prefix "Program_Root" may be changed to any text, including none at all, or "Include ", etc.  The [_phpDocumentor_setting] section can be used to specify a config file that should be used by default, so phpDocumentor may be run without any command-line arguments whatsoever!  The [_phpDocumentor_phpfile_exts] section tells phpDocumentor which file extensions are php files, add any non-standard extensions, such as "class" to this section.

							Previous

							Up

							Next

							Source code for sample3.php

							phpDocumentor Guide to Creating Fantastic Documentation

							Documentable PHP Elements

		Documentation generated on Mon, 05 Dec 2011 20:55:49 -0600 by phpDocumentor 1.4.4


text:
package com.github.twitch4j.pubsub.events;

import com.github.twitch4j.common.events.TwitchEvent;
import com.github.twitch4j.pubsub.domain.CheerbombData;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class CheerbombEvent extends TwitchEvent {
    private final String channelId;
    private final CheerbombData cheerbomb;
}

redpajama_set_name: RedPajamaGithub


text:
@interface RAPlayerViewController ()<UIGestureRecognizerDelegate, UINavigationControllerDelegate>

@property (nonatomic, retain) id <IJKMediaPlayback> player;
@property (weak, nonatomic) UIView *playerView;

- (void)play_btn:(id)sender;

@end

@implementation RAPlayerViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    //直播视频
    //    self.url = [NSURL URLWithString:@"http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8"];
    self.view.backgroundColor = [UIColor whiteColor];
    IJKFFOptions *options = [IJKFFOptions optionsByDefault];
    self.player = [[IJKFFMoviePlayerController alloc] initWithContentURLString:_url withOptions:options];

    UIView *playerView = [self.player view];
    UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
    singleRecognizer.numberOfTapsRequired = 1;
    [self.view addGestureRecognizer:singleRecognizer];
    CGFloat heigth = self.view.frame.size.height;
    UIView *displayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, heigth)];
    self.playerView = displayView;
    self.playerView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:self.playerView];

    playerView.frame = self.playerView.bounds;
    playerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [self.playerView insertSubview:playerView atIndex:1];
    [_player setScalingMode:IJKMPMovieScalingModeAspectFill];
    [self installMovieNotificationObservers];
}

- (void)singleTap:(UITapGestureRecognizer *)gesture
{
    [_player pause];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    _player = nil;
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewWillAppear:(BOOL)animated
{
    if (![self.player isPlaying])
    {
        [self.player prepareToPlay];
    }
}

#pragma Selector func
- (void)loadStateDidChange:(NSNotification*)notification
{
    IJKMPMovieLoadState loadState = _player.loadState;

    if ((loadState & IJKMPMovieLoadStatePlaythroughOK) != 0)
    {
        NSLog(@"LoadStateDidChange: IJKMovieLoadStatePlayThroughOK: %d\n",(int)loadState);
    }else if ((loadState & IJKMPMovieLoadStateStalled) != 0)
    {
        NSLog(@"loadStateDidChange: IJKMPMovieLoadStateStalled: %d\n", (int)loadState);
    } else
    {
        NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);
    }
}

- (void)moviePlayBackFinish:(NSNotification*)notification
{
    int reason =[[[notification userInfo] valueForKey:IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
    switch (reason)
    {
        case IJKMPMovieFinishReasonPlaybackEnded:
            NSLog(@"playbackStateDidChange: IJKMPMovieFinishReasonPlaybackEnded: %d\n", reason);
            break;

        case IJKMPMovieFinishReasonUserExited:
            NSLog(@"playbackStateDidChange: IJKMPMovieFinishReasonUserExited: %d\n", reason);
            break;

        case IJKMPMovieFinishReasonPlaybackError:
            NSLog(@"playbackStateDidChange: IJKMPMovieFinishReasonPlaybackError: %d\n", reason);
            break;

        default:
            NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);
            break;
    }
}

- (void)mediaIsPreparedToPlayDidChange:(NSNotification*)notification
{
    NSLog(@"mediaIsPrepareToPlayDidChange\n");
}

- (void)moviePlayBackStateDidChange:(NSNotification*)notification
{
    switch (_player.playbackState)
    {
        case IJKMPMoviePlaybackStateStopped:
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: stoped", (int)_player.playbackState);
            break;

        case IJKMPMoviePlaybackStatePlaying:
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: playing", (int)_player.playbackState);
            break;

        case IJKMPMoviePlaybackStatePaused:
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: paused", (int)_player.playbackState);
            break;

        case IJKMPMoviePlaybackStateInterrupted:
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: interrupted", (int)_player.playbackState);
            break;

        case IJKMPMoviePlaybackStateSeekingForward:
        case IJKMPMoviePlaybackStateSeekingBackward: {
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: seeking", (int)_player.playbackState);
            break;
        }

        default: {
            NSLog(@"IJKMPMoviePlayBackStateDidChange %d: unknown", (int)_player.playbackState);
            break;
        }
    }
}

#pragma Install Notifiacation

- (void)installMovieNotificationObservers
{
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(loadStateDidChange:)
                                                 name:IJKMPMoviePlayerLoadStateDidChangeNotification
                                               object:_player];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackFinish:)
                                                 name:IJKMPMoviePlayerPlaybackDidFinishNotification
                                               object:_player];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(mediaIsPreparedToPlayDidChange:)
                                                 name:IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification
                                               object:_player];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackStateDidChange:)
                                                 name:IJKMPMoviePlayerPlaybackStateDidChangeNotification
                                               object:_player];

}

- (void)removeMovieNotificationObservers
{
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:IJKMPMoviePlayerLoadStateDidChangeNotification
                                                  object:_player];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:IJKMPMoviePlayerPlaybackDidFinishNotification
                                                  object:_player];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification
                                                  object:_player];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:IJKMPMoviePlayerPlaybackStateDidChangeNotification
                                                  object:_player];

}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)play_btn:(id)sender
{
    if (![self.player isPlaying]) {
        [self.player play];
    }else{
        [self.player pause];
    }
}

- (BOOL)fd_prefersNavigationBarHidden
{
    return YES;
}

- (void)dealloc
{
    RALog(@"%s", __func__);
}

@end


text:
package config

import (
	"flag"
	"fmt"
	"io/ioutil"
	"net"
	"net/url"
	"os"
	"path/filepath"
	"reflect"
	"strconv"
	"strings"

	"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"

	"github.com/coreos/etcd/log"
	ustrings "github.com/coreos/etcd/pkg/strings"
	"github.com/coreos/etcd/server"
)

// The default location for the etcd configuration file.
const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"

// A lookup of deprecated flags to their new flag name.
var newFlagNameLookup = map[string]string{
	"C":                      "peers",
	"CF":                     "peers-file",
	"n":                      "name",
	"c":                      "addr",
	"cl":                     "bind-addr",
	"s":                      "peer-addr",
	"sl":                     "peer-bind-addr",
	"d":                      "data-dir",
	"m":                      "max-result-buffer",
	"r":                      "max-retry-attempts",
	"maxsize":                "max-cluster-size",
	"clientCAFile":           "ca-file",
	"clientCert":             "cert-file",
	"clientKey":              "key-file",
	"serverCAFile":           "peer-ca-file",
	"serverCert":             "peer-cert-file",
	"serverKey":              "peer-key-file",
	"snapshotCount":          "snapshot-count",
	"peer-heartbeat-timeout": "peer-heartbeat-interval",
}

// Config represents the server configuration.
type Config struct {
	SystemPath string

	Addr             string `toml:"addr" env:"ETCD_ADDR"`
	BindAddr         string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
	CAFile           string `toml:"ca_file" env:"ETCD_CA_FILE"`
	CertFile         string `toml:"cert_file" env:"ETCD_CERT_FILE"`
	CPUProfileFile   string
	CorsOrigins      []string `toml:"cors" env:"ETCD_CORS"`
	DataDir          string   `toml:"data_dir" env:"ETCD_DATA_DIR"`
	Discovery        string   `toml:"discovery" env:"ETCD_DISCOVERY"`
	Force            bool
	KeyFile          string   `toml:"key_file" env:"ETCD_KEY_FILE"`
	Peers            []string `toml:"peers" env:"ETCD_PEERS"`
	PeersFile        string   `toml:"peers_file" env:"ETCD_PEERS_FILE"`
	MaxClusterSize   int      `toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
	MaxResultBuffer  int      `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
	MaxRetryAttempts int      `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
	RetryInterval    float64  `toml:"retry_interval" env:"ETCD_RETRY_INTERVAL"`
	Name             string   `toml:"name" env:"ETCD_NAME"`
	Snapshot         bool     `toml:"snapshot" env:"ETCD_SNAPSHOT"`
	SnapshotCount    int      `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
	ShowHelp         bool
	ShowVersion      bool
	Verbose          bool `toml:"verbose" env:"ETCD_VERBOSE"`
	VeryVerbose      bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
	VeryVeryVerbose  bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
	Peer             struct {
		Addr              string `toml:"addr" env:"ETCD_PEER_ADDR"`
		BindAddr          string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
		CAFile            string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
		CertFile          string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
		KeyFile           string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
		HeartbeatInterval int    `toml:"heartbeat_interval" env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
		ElectionTimeout   int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
	}
	strTrace     string `toml:"trace" env:"ETCD_TRACE"`
	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
}

// New returns a Config initialized with default values.
func New() *Config {
	c := new(Config)
	c.SystemPath = DefaultSystemConfigPath
	c.Addr = "127.0.0.1:4001"
	c.MaxClusterSize = 9
	c.MaxResultBuffer = 1024
	c.MaxRetryAttempts = 3
	c.RetryInterval = 10.0
	c.Snapshot = true
	c.SnapshotCount = 10000
	c.Peer.Addr = "127.0.0.1:7001"
	c.Peer.HeartbeatInterval = defaultHeartbeatInterval
	c.Peer.ElectionTimeout = defaultElectionTimeout
	return c
}

// Loads the configuration from the system config, command line config,
// environment variables, and finally command line arguments.
func (c *Config) Load(arguments []string) error {
	var path string
	f := flag.NewFlagSet("etcd", -1)
	f.SetOutput(ioutil.Discard)
	f.StringVar(&path, "config", "", "path to config file")
	f.Parse(arguments)

	// Load from system file.
	if err := c.LoadSystemFile(); err != nil {
		return err
	}

	// Load from config file specified in arguments.
	if path != "" {
		if err := c.LoadFile(path); err != nil {
			return err
		}
	}

	// Load from the environment variables next.
	if err := c.LoadEnv(); err != nil {
		return err
	}

	// Load from command line flags.
	if err := c.LoadFlags(arguments); err != nil {
		return err
	}

	// Loads peers if a peer file was specified.
	if err := c.LoadPeersFile(); err != nil {
		return err
	}

	// Sanitize all the input fields.
	if err := c.Sanitize(); err != nil {
		return fmt.Errorf("sanitize: %v", err)
	}

	// Force remove server configuration if specified.
	if c.Force {
		c.Reset()
	}

	return nil
}

// Loads from the system etcd configuration file if it exists.
func (c *Config) LoadSystemFile() error {
	if _, err := os.Stat(c.SystemPath); os.IsNotExist(err) {
		return nil
	}
	return c.LoadFile(c.SystemPath)
}

// Loads configuration from a file.
func (c *Config) LoadFile(path string) error {
	_, err := toml.DecodeFile(path, &c)
	return err
}

// LoadEnv loads the configuration via environment variables.
func (c *Config) LoadEnv() error {
	if err := c.loadEnv(c); err != nil {
		return err
	}
	if err := c.loadEnv(&c.Peer); err != nil {
		return err
	}
	return nil
}

func (c *Config) loadEnv(target interface{}) error {
	value := reflect.Indirect(reflect.ValueOf(target))
	typ := value.Type()
	for i := 0; i < typ.NumField(); i++ {
		field := typ.Field(i)

		// Retrieve environment variable.
		v := strings.TrimSpace(os.Getenv(field.Tag.Get("env")))
		if v == "" {
			continue
		}

		// Set the appropriate type.
		switch field.Type.Kind() {
		case reflect.Bool:
			value.Field(i).SetBool(v != "0" && v != "false")
		case reflect.Int:
			newValue, err := strconv.ParseInt(v, 10, 0)
			if err != nil {
				return fmt.Errorf("Parse error: %s: %s", field.Tag.Get("env"), err)
			}
			value.Field(i).SetInt(newValue)
		case reflect.String:
			value.Field(i).SetString(v)
		case reflect.Slice:
			value.Field(i).Set(reflect.ValueOf(ustrings.TrimSplit(v, ",")))
		}
	}
	return nil
}

// Loads configuration from command line flags.
func (c *Config) LoadFlags(arguments []string) error {
	var peers, cors, path string

	f := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
	f.SetOutput(ioutil.Discard)

	f.BoolVar(&c.ShowHelp, "h", false, "")
	f.BoolVar(&c.ShowHelp, "help", false, "")
	f.BoolVar(&c.ShowVersion, "version", false, "")

	f.BoolVar(&c.Force, "f", false, "")
	f.BoolVar(&c.Force, "force", false, "")

	f.BoolVar(&c.Verbose, "v", c.Verbose, "")
	f.BoolVar(&c.VeryVerbose, "vv", c.VeryVerbose, "")
	f.BoolVar(&c.VeryVeryVerbose, "vvv", c.VeryVeryVerbose, "")

	f.StringVar(&peers, "peers", "", "")
	f.StringVar(&c.PeersFile, "peers-file", c.PeersFile, "")

	f.StringVar(&c.Name, "name", c.Name, "")
	f.StringVar(&c.Addr, "addr", c.Addr, "")
	f.StringVar(&c.Discovery, "discovery", c.Discovery, "")
	f.StringVar(&c.BindAddr, "bind-addr", c.BindAddr, "")
	f.StringVar(&c.Peer.Addr, "peer-addr", c.Peer.Addr, "")
	f.StringVar(&c.Peer.BindAddr, "peer-bind-addr", c.Peer.BindAddr, "")

	f.StringVar(&c.CAFile, "ca-file", c.CAFile, "")
	f.StringVar(&c.CertFile, "cert-file", c.CertFile, "")
	f.StringVar(&c.KeyFile, "key-file", c.KeyFile, "")

	f.StringVar(&c.Peer.CAFile, "peer-ca-file", c.Peer.CAFile, "")
	f.StringVar(&c.Peer.CertFile, "peer-cert-file", c.Peer.CertFile, "")
	f.StringVar(&c.Peer.KeyFile, "peer-key-file", c.Peer.KeyFile, "")

	f.StringVar(&c.DataDir, "data-dir", c.DataDir, "")
	f.IntVar(&c.MaxResultBuffer, "max-result-buffer", c.MaxResultBuffer, "")
	f.IntVar(&c.MaxRetryAttempts, "max-retry-attempts", c.MaxRetryAttempts, "")
	f.Float64Var(&c.RetryInterval, "retry-interval", c.RetryInterval, "")
	f.IntVar(&c.MaxClusterSize, "max-cluster-size", c.MaxClusterSize, "")
	f.IntVar(&c.Peer.HeartbeatInterval, "peer-heartbeat-interval", c.Peer.HeartbeatInterval, "")
	f.IntVar(&c.Peer.ElectionTimeout, "peer-election-timeout", c.Peer.ElectionTimeout, "")

	f.StringVar(&cors, "cors", "", "")

	f.BoolVar(&c.Snapshot, "snapshot", c.Snapshot, "")
	f.IntVar(&c.SnapshotCount, "snapshot-count", c.SnapshotCount, "")
	f.StringVar(&c.CPUProfileFile, "cpuprofile", "", "")

	f.StringVar(&c.strTrace, "trace", "", "")
	f.StringVar(&c.GraphiteHost, "graphite-host", "", "")

	// BEGIN IGNORED FLAGS
	f.StringVar(&path, "config", "", "")
	// BEGIN IGNORED FLAGS

	// BEGIN DEPRECATED FLAGS
	f.StringVar(&peers, "C", "", "(deprecated)")
	f.StringVar(&c.PeersFile, "CF", c.PeersFile, "(deprecated)")
	f.StringVar(&c.Name, "n", c.Name, "(deprecated)")
	f.StringVar(&c.Addr, "c", c.Addr, "(deprecated)")
	f.StringVar(&c.BindAddr, "cl", c.BindAddr, "(deprecated)")
	f.StringVar(&c.Peer.Addr, "s", c.Peer.Addr, "(deprecated)")
	f.StringVar(&c.Peer.BindAddr, "sl", c.Peer.BindAddr, "(deprecated)")
	f.StringVar(&c.Peer.CAFile, "serverCAFile", c.Peer.CAFile, "(deprecated)")
	f.StringVar(&c.Peer.CertFile, "serverCert", c.Peer.CertFile, "(deprecated)")
	f.StringVar(&c.Peer.KeyFile, "serverKey", c.Peer.KeyFile, "(deprecated)")
	f.StringVar(&c.CAFile, "clientCAFile", c.CAFile, "(deprecated)")
	f.StringVar(&c.CertFile, "clientCert", c.CertFile, "(deprecated)")
	f.StringVar(&c.KeyFile, "clientKey", c.KeyFile, "(deprecated)")
	f.StringVar(&c.DataDir, "d", c.DataDir, "(deprecated)")
	f.IntVar(&c.MaxResultBuffer, "m", c.MaxResultBuffer, "(deprecated)")
	f.IntVar(&c.MaxRetryAttempts, "r", c.MaxRetryAttempts, "(deprecated)")
	f.IntVar(&c.MaxClusterSize, "maxsize", c.MaxClusterSize, "(deprecated)")
	f.IntVar(&c.SnapshotCount, "snapshotCount", c.SnapshotCount, "(deprecated)")
	f.IntVar(&c.Peer.HeartbeatInterval, "peer-heartbeat-timeout", c.Peer.HeartbeatInterval, "(deprecated)")
	// END DEPRECATED FLAGS

	if err := f.Parse(arguments); err != nil {
		return err
	}

	// Print deprecation warnings on STDERR.
	f.Visit(func(f *flag.Flag) {
		if len(newFlagNameLookup[f.Name]) > 0 {
			fmt.Fprintf(os.Stderr, "[deprecated] use -%s, not -%s\n", newFlagNameLookup[f.Name], f.Name)
		}
	})

	// Convert some parameters to lists.
	if peers != "" {
		c.Peers = ustrings.TrimSplit(peers, ",")
	}
	if cors != "" {
		c.CorsOrigins = ustrings.TrimSplit(cors, ",")
	}

	return nil
}

// LoadPeersFile loads the peers listed in the peers file.
func (c *Config) LoadPeersFile() error {
	if c.PeersFile == "" {
		return nil
	}

	b, err := ioutil.ReadFile(c.PeersFile)
	if err != nil {
		return fmt.Errorf("Peers file error: %s", err)
	}
	c.Peers = ustrings.TrimSplit(string(b), ",")

	return nil
}

// DataDirFromName sets the data dir from a machine name and issue a warning
// that etcd is guessing.
func (c *Config) DataDirFromName() {
	c.DataDir = c.Name + ".etcd"
	log.Warnf("Using the directory %s as the etcd curation directory because a directory was not specified. ", c.DataDir)

	return
}

// NameFromHostname sets the machine name from the hostname. This is to help
// people get started without thinking up a name.
func (c *Config) NameFromHostname() {
	host, err := os.Hostname()
	if err != nil && host == "" {
		log.Fatal("Node name required and hostname not set. e.g. '-name=name'")
	}
	c.Name = host
}

// Reset removes all server configuration files.
func (c *Config) Reset() error {
	if err := os.RemoveAll(filepath.Join(c.DataDir, "log")); err != nil {
		return err
	}
	if err := os.RemoveAll(filepath.Join(c.DataDir, "conf")); err != nil {
		return err
	}
	if err := os.RemoveAll(filepath.Join(c.DataDir, "snapshot")); err != nil {
		return err
	}

	return nil
}

// Sanitize cleans the input fields.
func (c *Config) Sanitize() error {
	var err error

	// Sanitize the URLs first.
	if c.Addr, err = sanitizeURL(c.Addr, c.EtcdTLSInfo().Scheme()); err != nil {
		return fmt.Errorf("Advertised URL: %s", err)
	}
	if c.BindAddr, err = sanitizeBindAddr(c.BindAddr, c.Addr); err != nil {
		return fmt.Errorf("Listen Host: %s", err)
	}
	if c.Peer.Addr, err = sanitizeURL(c.Peer.Addr, c.PeerTLSInfo().Scheme()); err != nil {
		return fmt.Errorf("Peer Advertised URL: %s", err)
	}
	if c.Peer.BindAddr, err = sanitizeBindAddr(c.Peer.BindAddr, c.Peer.Addr); err != nil {
		return fmt.Errorf("Peer Listen Host: %s", err)
	}

	// Only guess the machine name if there is no data dir specified
	// because the info file should have our name
	if c.Name == "" && c.DataDir == "" {
		c.NameFromHostname()
	}

	if c.DataDir == "" && c.Name != "" && !c.ShowVersion && !c.ShowHelp {
		c.DataDirFromName()
	}

	return nil
}

// EtcdTLSInfo retrieves a TLSInfo object for the etcd server
func (c *Config) EtcdTLSInfo() server.TLSInfo {
	return server.TLSInfo{
		CAFile:   c.CAFile,
		CertFile: c.CertFile,
		KeyFile:  c.KeyFile,
	}
}

// PeerRaftInfo retrieves a TLSInfo object for the peer server.
func (c *Config) PeerTLSInfo() server.TLSInfo {
	return server.TLSInfo{
		CAFile:   c.Peer.CAFile,
		CertFile: c.Peer.CertFile,
		KeyFile:  c.Peer.KeyFile,
	}
}

// MetricsBucketName generates the name that should be used for a
// corresponding MetricsBucket object
func (c *Config) MetricsBucketName() string {
	return fmt.Sprintf("etcd.%s", c.Name)
}

// Trace determines if any trace-level information should be emitted
func (c *Config) Trace() bool {
	return c.strTrace == "*"
}

// sanitizeURL will cleanup a host string in the format hostname[:port] and
// attach a schema.
func sanitizeURL(host string, defaultScheme string) (string, error) {
	// Blank URLs are fine input, just return it
	if len(host) == 0 {
		return host, nil
	}

	p, err := url.Parse(host)
	if err != nil {
		return "", err
	}

	// Make sure the host is in Host:Port format
	_, _, err = net.SplitHostPort(host)
	if err != nil {
		return "", err
	}

	p = &url.URL{Host: host, Scheme: defaultScheme}
	return p.String(), nil
}

// sanitizeBindAddr cleans up the BindAddr parameter and appends a port
// if necessary based on the advertised port.
func sanitizeBindAddr(bindAddr string, addr string) (string, error) {
	aurl, err := url.Parse(addr)
	if err != nil {
		return "", err
	}

	// If it is a valid host:port simply return with no further checks.
	bhost, bport, err := net.SplitHostPort(bindAddr)
	if err == nil && bhost != "" {
		return bindAddr, nil
	}

	// SplitHostPort makes the host optional, but we don't want that.
	if bhost == "" && bport != "" {
		return "", fmt.Errorf("IP required can't use a port only")
	}

	// bindAddr doesn't have a port if we reach here so take the port from the
	// advertised URL.
	_, aport, err := net.SplitHostPort(aurl.Host)
	if err != nil {
		return "", err
	}

	return net.JoinHostPort(bindAddr, aport), nil
}


text:
#ifndef CPPNOTESMAIN_VERIFY_ALIEN_DICTIONAY_HPP
#define CPPNOTESMAIN_VERIFY_ALIEN_DICTIONAY_HPP

/*
https://leetcode.com/problems/verifying-an-alien-dictionary/
In an alien language, surprisingly they also use english lowercase letters, but possibly in a
different order. The order of the alphabet is some permutation of lowercase letters.

Given a sequence of words written in the alien language, and the order of the alphabet,
return true if and only if the given words are sorted lexicographicaly in this alien language.

Example 1:
Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
Output: true
Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.

Example 2:
Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
Output: false
Explanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence
is unsorted.

Example 3:
Input: words = ["apple","app"], order = "abcdefghijklmnopqrstuvwxyz"
Output: false
Explanation: The first three characters "app" match, and the second string is shorter (in size).
According to lexicographical rules "apple" > "app", because 'l' > '∅', where '∅' is defined as
the blank character which is less than any other character (More info).

Constraints:
- 1 <= words.length <= 100
- 1 <= words[i].length <= 20
- order.length == 26
- All characters in words[i] and order are English lowercase letters.
*/

#include <string>
#include <vector>
#include <unordered_map>

namespace Algo::DS::HashMap {
    class AlienDictionary {
    public:
        bool isAlienSorted(std::vector<std::string>& words, std::string order) {
            if (words.size() < 2) { return true; }

            std::unordered_map<char, size_t> m_alphabet;
            for (size_t i = 0; i < order.size(); ++i) {
                m_alphabet[order[i]] = i;
            }

            for (size_t i = 1; i < words.size(); ++i) {
                auto& w1 = words[i - 1];
                auto& w2 = words[i];

                const auto max_length = std::max(w1.size(), w2.size());
                for (size_t j = 0; j < max_length; ++j) {
                    if (w1.size() <= j) { break; }
                    if (w2.size() <= j) { return false; }
                    if (m_alphabet[w1[j]] < m_alphabet[w2[j]]) { break; }
                    if (m_alphabet[w1[j]] > m_alphabet[w2[j]]) { return false; }
                }
            }

            return true;
        }
    };
}

#endif //CPPNOTESMAIN_VERIFY_ALIEN_DICTIONAY_HPP


text:
<?php

/**
 * This file is part of the LmCondition library.
 *
 * @author Łukasz Makuch <kontakt@lukaszmakuch.pl>
 * @license MIT http://opensource.org/licenses/MIT
 */

namespace lukaszmakuch\LmCondition\EqualityComparator\Exception;

/**
 * Thrown when it's not possible to compare given conditions.
 *
 * @author Łukasz Makuch <kontakt@lukaszmakuch.pl>
 */
class IncomparableConditions extends \InvalidArgumentException
{
}


text:
export default function fixXMLHttpRequest() {
    return {
        name: "fixXMLHttpRequest",
        renderChunk: (code, settings, outputOptions) => codefix + code,
    };
}

// xmlhttprequest in the node repository is not up to date. So we take the latest version from github (located in the file githubXMLHttpRequest.js) and inject our own special bugfix on top of that.
var codefix = `
if (typeof exports === 'object' && typeof module !== 'undefined') {
    var XMLHttpRequest = ` + require("fs").readFileSync('./rollupExtra/githubXMLHttpRequest.js') + `;
    require('xmlhttprequest').XMLHttpRequest = function() {
        var req = new XMLHttpRequest;
        req.target = req;
        var de = req.dispatchEvent;
        req.dispatchEvent = function(event) {
            var a = req["on" + event];
            if (typeof a === "function") {
                a({
                    "target": req
                });
                req["on" + event] = null;
            }
            de(event);
            if (a != null) {
                req["on" + event] = a;
            }
        };
        return req;
    };
};
`;


text:
package org.analogweb.scala

import scala.language.implicitConversions
import scala.concurrent.Future
import scala.util.Try
import org.analogweb.{RequestValueResolver, Renderable}

trait RouteExtensions {
  self: Resolvers =>

  implicit def response(f: => Any): Any = { implicit r: Request =>
    f
  }

  implicit def asResolverSyntax[T <: RequestValueResolver](resolver: T)(
      implicit request: Request): InstanceResolverSyntax[T] =
    InstanceResolverSyntax(resolver, request)

  implicit def asRequestObjectMapping[T](mapping: Request => T)(implicit request: Request): T =
    mapping(request)

  implicit def toArounds(around: Around): Arounds =
    Arounds(Seq(around))

  implicit class FutureExtensions(future: Future[Renderable]) {
    def asRenderable() =
      RenderableFuture(future)
  }

  def param(query: String)(implicit r: Request): String = {
    parameter
      .as[String](query)
      .right
      .getOrElse(
        path.as[String](query) match {
          case Right(v) =>
            v
          case Left(t) =>
            ""
        }
      )
  }

  def passedWith[T](key: String)(implicit r: Request): Option[T] = {
    r.passedWith
      .get(key)
      .flatMap(v =>
        Try {
          v.asInstanceOf[T]
        }.toOption)
  }
}


text:
<!doctype html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

      Weight:

      Lbs:

      <input type="number" pattern="\d*"  ng-model="weight_lbs" ng-change="weightPounds()" placeholder="lbs">

      Ounces:

      <input type="number" pattern="\d*"  ng-model="weight_ounces" ng-change="weightOunces()" placeholder="oz">

      Kg:

      <input type="number" pattern="\d*"  ng-model="weight_kgs" ng-change="weightKgs()" placeholder="Kgs">

      Kcal per Kg per day:

      <input type="number" pattern="\d*"  ng-model="kcal_per_day" ng-change="kcal()" placeholder="kcal">

      Calories per Ounce:

      <input type="number" pattern="\d*"  ng-model="cal_per_ounce" ng-change="calPerOunce()" placeholder="cal">

      Number of feeds per day:

      <input type="number" pattern="\d*"  ng-model="feeds" ng-change="feedsPerDay()" placeholder="Feeds">

      ml per day:

      <input type="number" pattern="\d*"  ng-model="ml_day" ng-change="mlsToOunces()" placeholder="ml">

      oz per day:

      <input ng-model="oz_day" ng-change="ouncesToMls()" type="number" pattern="\d*" placeholder="oz">

      ml per feed:

      <input type="number" pattern="\d*"  ng-model="ml_feed" ng-change="mlsToOuncesFeed()" placeholder="ml">

      oz per feed:

      <input ng-model="oz_feed" ng-change="ouncesToMlsFeed()" type="number" pattern="\d*" placeholder="oz">


text:
using JetBrains.Annotations;
using JoinRpg.Data.Interfaces;
using JoinRpg.DataModel;
using JoinRpg.Portal.Infrastructure.DiscoverFilters;
using JoinRpg.Services.Interfaces;
using JoinRpg.Services.Interfaces.Projects;
using JoinRpg.Web.Filter;
using JoinRpg.Web.Models;
using JoinRpg.Web.Models.Exporters;
using Microsoft.AspNetCore.Mvc;

namespace JoinRpg.Portal.Controllers.Common;

[CaptureNoAccessExceptionHandler]
[DiscoverProjectFilter]
[AddFullUriFilter]
public abstract class ControllerGameBase : LegacyJoinControllerBase
{
    [ProvidesContext, NotNull]
    protected IProjectService ProjectService { get; }
    public IProjectRepository ProjectRepository { get; }

    protected ControllerGameBase(
        IProjectRepository projectRepository,
        IProjectService projectService,
        IUserRepository userRepository
        ) : base(userRepository)
    {
        ProjectRepository = projectRepository ?? throw new ArgumentNullException(nameof(projectRepository));
        ProjectService = projectService;
    }

    protected ActionResult NoAccesToProjectView(Project project) => View("ErrorNoAccessToProject", new ErrorNoAccessToProjectViewModel(project));

    //protected IReadOnlyDictionary<int, string> GetCustomFieldValuesFromPost() =>
    //    GetDynamicValuesFromPost(FieldValueViewModel.HtmlIdPrefix);

    [Obsolete]
    protected async Task<Project> GetProjectFromList(int projectId, IEnumerable<IProjectEntity> folders) => folders.FirstOrDefault()?.Project ?? await ProjectRepository.GetProjectAsync(projectId);

    protected ActionResult RedirectToIndex(Project project) => RedirectToAction("Index", "GameGroups", new { project.ProjectId, area = "" });

    protected ActionResult RedirectToIndex(int projectId, int characterGroupId, [AspMvcAction] string action = "Index") => RedirectToAction(action, "GameGroups", new { projectId, characterGroupId, area = "" });

    protected async Task<ActionResult> RedirectToProject(int projectId)
    {
        var project = await ProjectRepository.GetProjectAsync(projectId);
        return project == null ? NotFound() : RedirectToIndex(project);
    }

    [Obsolete]
    protected static ExportType? GetExportTypeByName(string export) => ExportTypeNameParserHelper.ToExportType(export);

    //protected async Task<FileContentResult> ReturnExportResult(string fileName, IExportGenerator generator)
    //{
    //    return File(await generator.Generate(), generator.ContentType,
    //      Path.ChangeExtension(fileName.ToSafeFileName(), generator.FileExtension));
    //}
}


text:
get "https://raw.github.com/rmm5t/jquery-timeago/master/jquery.timeago.js", "vendor/assets/javascripts/jquery.timeago.js"
get "https://raw.github.com/rmm5t/jquery-timeago/master/locales/jquery.timeago.ja.js", "vendor/assets/javascripts/jquery.timeago.ja.js"

# with jquery-mobile
if File.directory?("app/assets/javascripts/mobile")
  create_file "app/assets/javascripts/mobile/jquery-timeago.js.coffee", <<-COFFEE
#= require jquery.timeago
#= require jquery.timeago.ja
jquery_timeago = ->
  jQuery(".timeago").timeago()

$(document).on "pageshow", (event, ui) ->
  jquery_timeago()
  COFFEE
end


text:
namespace yas::audio {
struct io_core {
    virtual ~io_core() = default;

    virtual void set_render_handler(std::optional<io_render_f>) = 0;
    virtual void set_maximum_frames_per_slice(uint32_t const) = 0;

    virtual bool start() = 0;
    virtual void stop() = 0;
};

using io_core_ptr = std::shared_ptr<io_core>;
}  // namespace yas::audio


text:
dolla dolla watchers yo
=======

A bookmarklet that tells you how many $$watchers you have in your AngularJS app.

Pull requests accepted!

# Building the Bookmarklet

On the CLI, cd into the directory that contains these files, then...

    ./make_bookmarklet.pl watchers.js > bookmarklet.js

# Installing the Bookmarklet

* Make a new bookmark in your browser and name it.
* Copypasta from bookmarklet.js into the URL of the new bookmark.
* Go to your Angular app.
* Click the bookmark and read the console.log();

# License

MIT

# Aknowlegements

* Original idea via [clouddueling's gist](https://gist.github.com/clouddueling/8853332)
* bookmarklet.js built using [gruber's perl script](https://gist.github.com/gruber/8658935)

### Changelog

* 0.0.2 - using querySelectorAll and jqLite, support for multiple Angular apps
* 0.0.1 - first release, removed jQuery dependency


text:
package org.apache.calcite.statistic;

import org.apache.calcite.adapter.jdbc.JdbcTable;
import org.apache.calcite.materialize.SqlStatisticProvider;
import org.apache.calcite.plan.RelOptTable;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Implementation of {@link SqlStatisticProvider} that looks up values in a
 * table.
 *
 * <p>Only for testing.
 */
public enum MapSqlStatisticProvider implements SqlStatisticProvider {
  INSTANCE;

  private final ImmutableMap<String, Double> cardinalityMap;

  private final ImmutableMultimap<String, ImmutableList<String>> keyMap;

  MapSqlStatisticProvider() {
    final Initializer initializer = new Initializer()
        .put("foodmart", "agg_c_14_sales_fact_1997", 86_805, "id")
        .put("foodmart", "account", 11, "account_id")
        .put("foodmart", "category", 4, "category_id")
        .put("foodmart", "currency", 10_281, "currency_id")
        .put("foodmart", "customer", 10_281, "customer_id")
        .put("foodmart", "days", 7, "day")
        .put("foodmart", "employee", 1_155, "employee_id")
        .put("foodmart", "employee_closure", 7_179)
        .put("foodmart", "department", 10_281, "department_id")
        .put("foodmart", "inventory_fact_1997", 4_070)
        .put("foodmart", "position", 18, "position_id")
        .put("foodmart", "product", 1560, "product_id")
        .put("foodmart", "product_class", 110, "product_class_id")
        .put("foodmart", "promotion", 1_864, "promotion_id")
        // region really has 110 rows; made it smaller than store to trick FK
        .put("foodmart", "region", 24, "region_id")
        .put("foodmart", "salary", 21_252)
        .put("foodmart", "sales_fact_1997", 86_837)
        .put("foodmart", "store", 25, "store_id")
        .put("foodmart", "store_ragged", 25, "store_id")
        .put("foodmart", "time_by_day", 730, "time_id", "the_date") // 2 keys
        .put("foodmart", "warehouse", 24, "warehouse_id")
        .put("foodmart", "warehouse_class", 6, "warehouse_class_id")
        .put("scott", "EMP", 10, "EMPNO")
        .put("scott", "DEPT", 4, "DEPTNO")
        .put("tpcds", "CALL_CENTER", 8, "id")
        .put("tpcds", "CATALOG_PAGE", 11_718, "id")
        .put("tpcds", "CATALOG_RETURNS", 144_067, "id")
        .put("tpcds", "CATALOG_SALES", 1_441_548, "id")
        .put("tpcds", "CUSTOMER", 100_000, "id")
        .put("tpcds", "CUSTOMER_ADDRESS", 50_000, "id")
        .put("tpcds", "CUSTOMER_DEMOGRAPHICS", 1_920_800, "id")
        .put("tpcds", "DATE_DIM", 73049, "id")
        .put("tpcds", "DBGEN_VERSION", 1, "id")
        .put("tpcds", "HOUSEHOLD_DEMOGRAPHICS", 7200, "id")
        .put("tpcds", "INCOME_BAND", 20, "id")
        .put("tpcds", "INVENTORY", 11_745_000, "id")
        .put("tpcds", "ITEM", 18_000, "id")
        .put("tpcds", "PROMOTION", 300, "id")
        .put("tpcds", "REASON", 35, "id")
        .put("tpcds", "SHIP_MODE", 20, "id")
        .put("tpcds", "STORE", 12, "id")
        .put("tpcds", "STORE_RETURNS", 287_514, "id")
        .put("tpcds", "STORE_SALES", 2_880_404, "id")
        .put("tpcds", "TIME_DIM", 86_400, "id")
        .put("tpcds", "WAREHOUSE", 5, "id")
        .put("tpcds", "WEB_PAGE", 60, "id")
        .put("tpcds", "WEB_RETURNS", 71_763, "id")
        .put("tpcds", "WEB_SALES", 719_384, "id")
        .put("tpcds", "WEB_SITE", 1, "id");
    cardinalityMap = initializer.cardinalityMapBuilder.build();
    keyMap = initializer.keyMapBuilder.build();
  }

  @Override public double tableCardinality(RelOptTable table) {
    final List<String> qualifiedName =
        table.maybeUnwrap(JdbcTable.class)
            .map(value ->
                Arrays.asList(value.jdbcSchemaName, value.jdbcTableName))
            .orElseGet(table::getQualifiedName);
    return cardinalityMap.get(qualifiedName.toString());
  }

  @Override public boolean isForeignKey(RelOptTable fromTable, List<Integer> fromColumns,
      RelOptTable toTable, List<Integer> toColumns) {
    // Assume that anything that references a primary key is a foreign key.
    // It's wrong but it's enough for our current test cases.
    return isKey(toTable, toColumns)
        // supervisor_id contains one 0 value, which does not match any
        // employee_id, therefore it is not a foreign key
        && !"[foodmart, employee].[supervisor_id]"
            .equals(fromTable.getQualifiedName() + "."
                + columnNames(fromTable, fromColumns));
  }

  @Override public boolean isKey(RelOptTable table, List<Integer> columns) {
    // In order to match, all column ordinals must be in range 0 .. columnCount
    return columns.stream().allMatch(columnOrdinal ->
        (columnOrdinal >= 0)
            && (columnOrdinal < table.getRowType().getFieldCount()))
        // ... and the column names match the name of the primary key
        && keyMap.get(table.getQualifiedName().toString())
            .contains(columnNames(table, columns));
  }

  private static List<String> columnNames(RelOptTable table, List<Integer> columns) {
    return columns.stream()
        .map(columnOrdinal -> table.getRowType().getFieldNames()
            .get(columnOrdinal))
        .collect(Collectors.toList());
  }

  /** Helper during construction. */
  private static class Initializer {
    final ImmutableMap.Builder<String, Double> cardinalityMapBuilder =
        ImmutableMap.builder();
    final ImmutableMultimap.Builder<String, ImmutableList<String>> keyMapBuilder =
        ImmutableMultimap.builder();

    Initializer put(String schema, String table, int count, Object... keys) {
      String qualifiedName = Arrays.asList(schema, table).toString();
      cardinalityMapBuilder.put(qualifiedName, (double) count);
      for (Object key : keys) {
        final ImmutableList<String> keyList;
        if (key instanceof String) {
          keyList = ImmutableList.of((String) key);
        } else if (key instanceof String[]) {
          keyList = ImmutableList.copyOf((String[]) key); // composite key
        } else {
          throw new AssertionError("unknown key " + key);
        }
        keyMapBuilder.put(qualifiedName, keyList);
      }
      return this;
    }
  }
}


text:
asyncTest('Spaced CES File', function() {
    expect(22);

    ces.download('test10.ces', function(source) {
        stop();

        var body = document.querySelector('#qunit-fixture');

        var button = document.createElement('button');
        button.id = 'button';
        button.textContent = 'Button';
        body.appendChild(button);

        var button2 = document.createElement('button');
        button2.id = 'button2';
        button2.textContent = 'Disable';
        button2.disabled = true;
        body.appendChild(button2);

        var enableButton = document.createElement('button');
        enableButton.id = 'enableButton';
        enableButton.textContent = 'Enable';
        body.appendChild(enableButton);

        var changeButton = document.createElement('button');
        changeButton.id = 'change';
        changeButton.textContent = 'Change';
        body.appendChild(changeButton);

        var text = document.createElement('p');
        text.id = 'text';
        text.classList.add('backred');
        text.classList.add('big');
        body.appendChild(text);

        var js = ces.ces2js(source, 'test10.ces');
        ces.execute(js);

        equal(button.textContent, 'Button', 'Text is set to "Button".');

        trigger(button, 'click');

        equal(button.textContent, 'Clicked', 'Text is set to "Clicked".');

        equal(button2.disabled, true, 'HTML attribute disabled is set.');

        trigger(enableButton, 'click');

        equal(button2.disabled, false, 'HTML attribute disabled is not set.');

        ok(!text.style.getPropertyValue('color'), 'Property color is not set.');
        equal(text.title, '', 'HTML attribute title is not set.');
        equal(text.getAttribute('data-text'), null, 'HTML attribute data-text is not set.');

        trigger(changeButton, 'click');

        equal(text.classList.length, 3, 'Class list contains 3 elements.');
        ok(text.classList.contains('backred'), 'Class backred is set.');
        ok(text.classList.contains('big'), 'Class big is set.');
        ok(text.classList.contains('italic'), 'Class italic is set.');
        ok(!text.classList.contains('underline'), 'Class underline is not set.');
        equal(text.style.getPropertyValue('color'), 'blue', 'Property color is set to "blue".');
        equal(text.title, 'title', 'HTML attribute title is set to "title".');
        equal(text.getAttribute('data-text'), 'text', 'HTML attribute data-text is set to "text".');

        trigger(changeButton, 'click');

        equal(text.classList.length, 2, 'Class list contains 2 elements.');
        ok(text.classList.contains('backred'), 'Class backred is set.');
        ok(text.classList.contains('big'), 'Class big is set.');
        ok(!text.classList.contains('italic'), 'Class italic is not set.');
        ok(!text.classList.contains('underline'), 'Class underline is not set.');

        start();
    });

    ces.download('test11.ces', function(source) {
        var body = document.querySelector('#qunit-fixture');

        var div = document.createElement('div');
        body.appendChild(div);

        var button = document.createElement('button');
        button.id = 'button';
        button.textContent = 'Button';
        div.appendChild(button);

        var paragraph = document.createElement('p');
        paragraph.id = 'par';
        paragraph.textContent = 'Text';
        div.appendChild(paragraph);

        var js = ces.ces2js(source, 'test11.ces');
        ces.execute(js);

        ok(!paragraph.style.getPropertyValue('color'), 'Color is not set.');

        trigger(document.querySelector('div button#button'), 'click');

        equal(paragraph.style.getPropertyValue('color'), 'blue', 'Color is set to "blue".');

        start();
    });
});


text:
Rails.application.config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
Rails.application.config.i18n.default_locale = :'pt-BR'


text:
Welcome to Google Calendar Simple API's documentation!
======================================================

`Google Calendar Simple API` or `gcsa` is a library that simplifies event management in a Google Calendars.
It is a Pythonic object oriented adapter for the `official API`_.

Example usage
-------------

List events
~~~~~~~~~~~

.. code-block:: python

    from gcsa.google_calendar import GoogleCalendar

    calendar = GoogleCalendar('your_email@gmail.com')
    for event in calendar:
        print(event)

Create event
~~~~~~~~~~~~

.. code-block:: python

    from gcsa.event import Event

    event = Event(
        'The Glass Menagerie',
        start=datetime(2020, 7, 10, 19, 0),
        location='Záhřebská 468/21'
        minutes_before_popup_reminder=15
    )
    calendar.add_event(event)

Create recurring event
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

    from gcsa.recurrence import Recurrence, DAILY

    event = Event(
        'Breakfast',
        start=date(2020, 7, 16),
        recurrence=Recurrence.rule(freq=DAILY)
    )
    calendar.add_event(event)

Contents
--------

.. toctree::
   :maxdepth: 2

   getting_started
   authentication
   events
   attendees
   attachments
   conference
   reminders
   recurrence
   serializers
   code/code

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

References
==========

Template for `setup.py` was taken from `kennethreitz/setup.py`_.

.. _kennethreitz/setup.py: https://github.com/kennethreitz/setup.py
.. _`official API`: https://developers.google.com/calendar


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 4: 13 (1886)

#### Original name
Torula pedicellata Preuss

### Remarks
null


text:
#pragma once
#include <aws/inspector/Inspector_EXPORTS.h>
#include <aws/inspector/InspectorRequest.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Inspector
{
namespace Model
{

  /**
   */
  class AWS_INSPECTOR_API DescribeAssessmentTargetsRequest : public InspectorRequest
  {
  public:
    DescribeAssessmentTargetsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DescribeAssessmentTargets"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline const Aws::Vector<Aws::String>& GetAssessmentTargetArns() const{ return m_assessmentTargetArns; }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline bool AssessmentTargetArnsHasBeenSet() const { return m_assessmentTargetArnsHasBeenSet; }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline void SetAssessmentTargetArns(const Aws::Vector<Aws::String>& value) { m_assessmentTargetArnsHasBeenSet = true; m_assessmentTargetArns = value; }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline void SetAssessmentTargetArns(Aws::Vector<Aws::String>&& value) { m_assessmentTargetArnsHasBeenSet = true; m_assessmentTargetArns = std::move(value); }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline DescribeAssessmentTargetsRequest& WithAssessmentTargetArns(const Aws::Vector<Aws::String>& value) { SetAssessmentTargetArns(value); return *this;}

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline DescribeAssessmentTargetsRequest& WithAssessmentTargetArns(Aws::Vector<Aws::String>&& value) { SetAssessmentTargetArns(std::move(value)); return *this;}

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline DescribeAssessmentTargetsRequest& AddAssessmentTargetArns(const Aws::String& value) { m_assessmentTargetArnsHasBeenSet = true; m_assessmentTargetArns.push_back(value); return *this; }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline DescribeAssessmentTargetsRequest& AddAssessmentTargetArns(Aws::String&& value) { m_assessmentTargetArnsHasBeenSet = true; m_assessmentTargetArns.push_back(std::move(value)); return *this; }

    /**
     *
The ARNs that specifies the assessment targets that you want to describe.

     */
    inline DescribeAssessmentTargetsRequest& AddAssessmentTargetArns(const char* value) { m_assessmentTargetArnsHasBeenSet = true; m_assessmentTargetArns.push_back(value); return *this; }

  private:

    Aws::Vector<Aws::String> m_assessmentTargetArns;
    bool m_assessmentTargetArnsHasBeenSet = false;
  };

} // namespace Model
} // namespace Inspector
} // namespace Aws


text:
@interface ATDefaultTextView : UITextView  {
@private
	UILabel *placeholderLabel;
	ATDrawRectBlock at_drawRectBlock;
}
@property (nonatomic, copy) NSString *placeholder;
@property (nonatomic, readwrite, copy) ATDrawRectBlock at_drawRectBlock;
- (BOOL)isDefault;
@end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Shvartsman et al. , Flora Sporovykh Rastenii Kazakhstana [Cryptogamic Flora of Kazakhstan], 7, [Fungi Imperfecti, Melanconiales] (Alma-Ata) (Alma-Ata) 58 (1971)

#### Original name
Gloeosporium campanulae Schwarzman & Vasyag.

### Remarks
null


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using mszcoolPoDMachineInventory.Models;
using Microsoft.Extensions.Configuration;
using MongoDB.Driver;

namespace mszcoolPoDInventoryApi.Components.Implementations
{
    public class EnvironmentsMongoDbRepository : IEnvironmentsRepository
    {
        private MongoClient _mongoDbClient;
        private string _mongoDbConnectionString = string.Empty;

        public EnvironmentsMongoDbRepository(IConfiguration config)
        {
            _mongoDbConnectionString = config.GetValue<string>(Constants.MongoDbConnectionStringSettingName);
            if (string.IsNullOrEmpty(_mongoDbConnectionString))
            {
                throw new Exception($"Missing connection string configuration '{Constants.MongoDbConnectionStringSettingName}' for MongoDB!");
            }
            else
            {
                try
                {
                    _mongoDbClient = new MongoClient(_mongoDbConnectionString);
                }
                catch (Exception ex)
                {
                    throw new Exception($"Failed instantiating MongoClient, please verify connection string!", ex);
                }
            }
        }

        #region IEnvironmentsRepository

        public void AddEnvironment(PoDEnvironment newEnvironment)
        {
            try
            {
                var collection = GetEnvironmentsCollection();
                collection.InsertOne(newEnvironment);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed adding new environment to system.", ex);
            }
        }

        public PoDEnvironment GetEnvironment(string environmentName)
        {
            try
            {
                var collection = GetEnvironmentsCollection();
                var result = collection.Find(filter => filter.EnvironmentName == environmentName).FirstOrDefault();
                return result;
            }
            catch (Exception ex)
            {
                throw new Exception("Failed retrieving existing environment from system.", ex);
            }
        }

        public IList<PoDEnvironment> GetEnvironments(string ownerNameId)
        {
            try
            {
                var collection = GetEnvironmentsCollection();
                var results = collection.Find(filter => filter.EnvironmentOwnerNameId == ownerNameId);
                return results.ToList();
            }
            catch (Exception ex)
            {
                throw new Exception("Failed retrieving existing environments from system.", ex);
            }
        }

        public void UpdateEnvironment(PoDEnvironment updatedEnvironment)
        {
            try
            {
                var collection = GetEnvironmentsCollection();

                var filterDef = new ExpressionFilterDefinition<PoDEnvironment>(d => d.EnvironmentName == updatedEnvironment.EnvironmentName);
                var updateDef = new ObjectUpdateDefinition<PoDEnvironment>(updatedEnvironment);

                var result = collection.UpdateOne(filterDef, updateDef);

                if (result.MatchedCount == 0)
                    throw new Exception("Record not found!");
                if (result.ModifiedCount == 0)
                    throw new Exception("No records updated!");
            }
            catch (Exception ex)
            {
                throw new Exception("Failed updating existing environment in system.", ex);
            }
        }

        public void DeleteEnvironment(string environmentName)
        {
            try
            {
                var collection = GetEnvironmentsCollection();

                var filterDef = new ExpressionFilterDefinition<PoDEnvironment>(d => d.EnvironmentName == environmentName);

                var results = collection.DeleteOne(filterDef);

                if (results.DeletedCount == 0)
                    throw new Exception("No records where deleted!");
            }
            catch (Exception ex)
            {
                throw new Exception("Failed deleting existing environment from system.", ex);
            }
        }

        #endregion

        #region Private Helper Methods

        private IMongoCollection<PoDEnvironment> GetEnvironmentsCollection()
        {
            var db = _mongoDbClient.GetDatabase(Constants.MongoDbDatabaseName);
            var collection = db.GetCollection<PoDEnvironment>(
                                Constants.MongoDbCollectionEnvironments,
                                new MongoCollectionSettings
                                {
                                    AssignIdOnInsert = false,
                                    GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard,
                                    ReadConcern = ReadConcern.Default,
                                    WriteConcern = WriteConcern.WMajority
                                }
                            );
            return collection;
        }

        #endregion
    }
}