text:
package org.jboss.aesh.console.export;

import org.jboss.aesh.console.Config;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Ståle W. Pedersen
 */
public class ExportManager {

    private static final char DOLLAR = '$';
    private final Map<String, String> variables;
    private final Pattern exportPattern = Pattern.compile("^(export)\\s+(\\w+)\\s*=\\s*(\\S+).*$");
    private final Pattern variableDollarFirstPattern = Pattern.compile("\\$(\\w+|\\{(\\w+)\\})(.*)");
    private final Pattern variablePattern = Pattern.compile("(.*)\\$(\\w+|\\{(\\w+)\\})(.*)");

    private static final Logger LOGGER = Logger.getLogger(ExportManager.class.getName());

    private static final String EXPORT = "export";

    private final File exportFile;
    private final boolean exportUsesSystemEnvironment;

    public ExportManager(File exportFile) {
        this(exportFile, false);
    }

    public ExportManager(File exportFile, boolean exportUsesSystemEnvironment) {
        this.exportFile = exportFile;
        this.exportUsesSystemEnvironment = exportUsesSystemEnvironment;
        variables = new HashMap<>();
        if (exportFile.isFile())
            readVariablesFromFile();
    }

    private void readVariablesFromFile() {
        try (BufferedReader br = new BufferedReader(new FileReader(exportFile))) {
            String line;
            while ((line = br.readLine()) != null) {
                if (line.startsWith(EXPORT))
                    addVariable(line);
            }
        }
        catch (IOException e) {
            LOGGER.warning("Failed to read variables from file " + exportFile + ", error: " + e);
        }
    }

    public String addVariable(String line) {
        Matcher variableMatcher = exportPattern.matcher(line);
        if (variableMatcher.matches()) {
            String name = variableMatcher.group(2);
            String value = variableMatcher.group(3);
            if (value.contains(String.valueOf(DOLLAR + name))) {
                value = value.replace(String.valueOf(DOLLAR + name), variables.get(name));
            }
            variables.put(name, value);
            return null;
        }
        return "export: usage: export [name[=value] ...]";
    }

    /**
     * line that contains a non escaped $
     *
     * @param key input
     * @return line with variables replaced with their value
     */
    public String getValue(String key) {
        if (key.indexOf(DOLLAR) == -1) {
            String value = getVariable(key);

            if (value == null)
                return "";

            if (value.indexOf(DOLLAR) == -1)
                return value;
            else
                return parseValue(value);
        }
        return parseValue(key);
    }

    private String getVariable(String key) {
        if (this.variables.containsKey(key))
            return this.variables.get(key);

        if (this.exportUsesSystemEnvironment)
            return System.getenv().get(key);

        return null;
    }

    private boolean containsKey(String key) {
        boolean result = false;
        result = this.variables.containsKey(key);

        if (!result && this.exportUsesSystemEnvironment)
            result = System.getenv().containsKey(key);

        return result;
    }

    public String getValueIgnoreCase(String name) {
        for (String key : variables.keySet()) {
            if (key.equalsIgnoreCase(name))
                return variables.get(key);
        }

        if (this.exportUsesSystemEnvironment) {
            for (String key : System.getenv().keySet()) {
                if (key.equalsIgnoreCase(name))
                    return System.getenv().get(key);
            }
        }

        return "";
    }

    private String parseValue(String value) {
        if (value == null)
            return "";

        if (value.indexOf(DOLLAR) == -1) {
            return value;
        }

        if (value.indexOf(DOLLAR) == 0) {
            Matcher matcher = variableDollarFirstPattern.matcher(value);
            if (matcher.matches()) {
                String group1 = matcher.group(1);
                String group2 = matcher.group(3);

                if (matcher.group(2) != null)
                    group1 = matcher.group(2);

                if (group1 != null && containsKey(group1)) {
                    if (group2 != null && group2.indexOf(DOLLAR) > -1) {
                        if (getVariable(group1).indexOf(DOLLAR) == -1)
                            return getVariable(group1) + parseValue(group2);
                        else
                            return parseValue(getVariable(group1)) + parseValue(group2);

                    }

                    if (getVariable(group1).indexOf(DOLLAR) == -1)
                        return getVariable(group1) + group2;
                    else
                        return parseValue(getVariable(group1)) + group2;
                }
                return group2;
            }
            return "";
        }

        Matcher matcher = variablePattern.matcher(value);
        if (matcher.matches()) {
            String group1 = matcher.group(1);
            String group2 = matcher.group(2);
            String group3 = matcher.group(4);

            if (matcher.group(3) != null)
                group2 = matcher.group(3);

            if (group2 != null && containsKey(group2)) {
                if (group3 != null && group3.indexOf(DOLLAR) > -1) {
                    if (getVariable(group2).indexOf(DOLLAR) == -1)
                        return parseValue(group1) + getVariable(group2) + parseValue(group3);
                    else
                        return parseValue(group1) + parseValue(getVariable(group2)) + parseValue(group3);
                }

                if (getVariable(group2).indexOf(DOLLAR) == -1)
                    return parseValue(group1) + getVariable(group2) + group3;

                return parseValue(group1) + parseValue(getVariable(group2)) + group3;
            }
            return group1 + group3;
        }
        return "";
    }

    public String listAllVariables() {
        StringBuilder builder = new StringBuilder();
        for (String key : variables.keySet()) {
            builder.append(key).append('=').append(parseValue(variables.get(key))).append(Config.getLineSeparator());
        }

        if (this.exportUsesSystemEnvironment) {
            for (String key : System.getenv().keySet()) {
                builder.append(key).append('=').append(parseValue(variables.get(key))).append(Config.getLineSeparator());
            }
        }
        return builder.toString();
    }

    public void persistVariables() {
        if (exportFile.isFile())
            exportFile.delete();

        try (FileWriter fw = new FileWriter(exportFile)) {
            for (String key : variables.keySet()) {
                fw.write(EXPORT + " " + key + "=" + variables.get(key) + Config.getLineSeparator());
            }
        }
        catch (IOException e) {
            LOGGER.warning("Failed to persist variables to file " + exportFile + ", error: " + e);
        }
    }

    public List<String> getAllNamesWithEquals() {
        List<String> names = new ArrayList<>(variables.size());
        for (String key : variables.keySet())
            names.add(key + "=");

        if (this.exportUsesSystemEnvironment) {
            for (String key : System.getenv().keySet())
                names.add(key + "=");
        }

        return names;
    }

    public List<String> getAllNames() {
        List<String> names = new ArrayList<>(variables.size());
        for (String key : variables.keySet())
            names.add(key);

        if (this.exportUsesSystemEnvironment) {
            for (String key : System.getenv().keySet())
                names.add(key);
        }

        return names;
    }

    public List<String> findAllMatchingKeys(String word) {
        int index = word.lastIndexOf(DOLLAR);
        if (index > -1)
            word = word.substring(index + 1, word.length());
        List<String> keys = new ArrayList<>();
        for (String key : variables.keySet()) {
            if (key.startsWith(word)) {
                if (index > -1)
                    keys.add("$" + key);
                else
                    keys.add(key);
            }
        }

        if (this.exportUsesSystemEnvironment) {
            for (String key : System.getenv().keySet()) {
                if (key.startsWith(word)) {
                    if (index > -1)
                        keys.add("$" + key);
                    else
                        keys.add(key);
                }
            }
        }

        return keys;
    }

}


text:
<!DOCTYPE html>

    <title>Helicopter thing</title>

redpajama_set_name: RedPajamaGithub


text:
package com.azure.resourcemanager.hybridcontainerservice.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridcontainerservice.models.AgentPoolExtendedLocation;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AgentPoolExtendedLocationTests {
    @Test
    public void testDeserialize() {
        AgentPoolExtendedLocation model =
            BinaryData
                .fromString("{\"type\":\"dnbbglzps\",\"name\":\"ydmcwyhzdxssa\"}")
                .toObject(AgentPoolExtendedLocation.class);
        Assertions.assertEquals("dnbbglzps", model.type());
        Assertions.assertEquals("ydmcwyhzdxssa", model.name());
    }

    @Test
    public void testSerialize() {
        AgentPoolExtendedLocation model =
            new AgentPoolExtendedLocation().withType("dnbbglzps").withName("ydmcwyhzdxssa");
        model = BinaryData.fromObject(model).toObject(AgentPoolExtendedLocation.class);
        Assertions.assertEquals("dnbbglzps", model.type());
        Assertions.assertEquals("ydmcwyhzdxssa", model.name());
    }
}


text:
<?php

class CSqlDataProviderTest extends CTestCase
{

    /**
     * @var CDbConnection
     */
    private $db;

    public function setUp()
    {

        if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) {
            $this->markTestSkipped('PDO and SQLite extensions are required.');
        }

        $this->db         = new CDbConnection('sqlite::memory:');
        $this->db->active = true;
        $this->db->pdoInstance->exec(file_get_contents(dirname(__FILE__) . '/../db/data/sqlite.sql'));
        CActiveRecord::$db = $this->db;
    }

    public function tearDown()
    {

        $this->db->active = false;
    }

    /**
     * https://github.com/yiisoft/yii/issues/2449
     */
    public function testFetchKeysWithDbCommandSpecifiedAndPdoFetchObjEnabled()
    {

        $command1      = $this->db->createCommand()->select('*')->from('posts')->setFetchMode(PDO::FETCH_ASSOC);
        $dataProvider1 = new CSqlDataProvider($command1);
        $this->assertSame(array('1', '2', '3', '4', '5'), $dataProvider1->keys);

        $command2      = $this->db->createCommand()->select('*')->from('posts')->setFetchMode(PDO::FETCH_OBJ);
        $dataProvider2 = new CSqlDataProvider($command2);
        $this->assertSame(array('1', '2', '3', '4', '5'), $dataProvider2->keys);
    }
}


text:
<!-- field/annalist_edit_entityid.html (uses a fixed field name 'entity_id') -->
<input type="text" size="64" name="entity_id"
       placeholder="{{field.description.field_placeholder}}"
       value="{{field.field_value}}"/>


text:
//
//  CommentListRequest.m
//  FATodos
//
//  Created by qingqing on 16/1/26.
//  Copyright © 2016年 fallen.ink. All rights reserved.
//

#import "CommentListRequest.h"

@interface CommentListRequest () <HTTPRequestProtocol>

@end

@implementation CommentListRequest

//@"http://photo.poco.cn/dianping/module/get_data_ajax.php?action=get_article&article_page=10&type=theme&type_id=8&data_type=list&show_type=show&struction=index&article_last_update_time=1437499820&zero_type=0&_no_cache=1&_=1453736485787"

+ (CommentListRequest *)instance {
    CommentListRequest *request = [CommentListRequest new];

    request.action  = @"get_article";
    request.articlePage = 10;
    request.type    = @"theme";
    request.typeId  = type_id_portrait;
    request.dataType    = @"list";
    request.showType    = @"show";
    request.struction   = @"index";
    request.articleLastUpdateTime   = [[NSDate new] timeIntervalSince1970];
    request.zeroType    = 0;
    request.noCache     = 1;
    request.timestamp        = [[NSDate new] timeIntervalSince1970];

    return request;
}

#pragma mark - HTTPRequestProtocol

+ (NSDictionary *)HTTParamKeyPathsByPropertyKey {
    return @{
             @"action":@"action",
             @"articlePage":@"article_page",
             @"type":@"type",
             @"typeId":@"type_id",
             @"dataType":@"data_type",
             @"showType":@"show_type",
             @"struction":@"struction",
             @"articleLastUpdateTime":@"article_last_update_time",
             @"zeroType":@"zero_type",
             @"noCache":@"_no_chache",
             @"timestamp":@"_"
             };
}

/**
 *  MTLModel:dictionaryValue, supported by KeyValueCoding!!!
 */

- (NSDictionary *)params {
    NSError *error;
    NSDictionary *params    = [MTLHTTParamAdapter HTTParamDictionaryFromModel:self error:&error];
    if (error) {
        DLog(@"error=%@", error);
    }

    return params;
}

@end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>20.12. smtplib — SMTP protocol client — Python 2.7.12 documentation</title>

    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.12 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
    <link rel="up" title="20. Internet Protocols and Support" href="internet.html" />
    <link rel="next" title="20.13. smtpd — SMTP Server" href="smtpd.html" />
    <link rel="prev" title="20.11. nntplib — NNTP protocol client" href="nntplib.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />

Navigation

          index

          modules |

          next |

          previous |

Python »

          2.7.12
          Documentation »

The Python Standard Library »

20. Internet Protocols and Support »

20.12. smtplib — SMTP protocol client¶

Source code: Lib/smtplib.py

The smtplib module defines an SMTP client session object that can be used
to send mail to any Internet machine with an SMTP or ESMTP listener daemon.  For
details of SMTP and ESMTP operation, consult RFC 821 (Simple Mail Transfer
Protocol) and RFC 1869 (SMTP Service Extensions).

class smtplib.SMTP([host[, port[, local_hostname[, timeout]]]])¶

A SMTP instance encapsulates an SMTP connection.  It has methods
that support a full repertoire of SMTP and ESMTP operations. If the optional
host and port parameters are given, the SMTP connect() method is
called with those parameters during initialization.  If specified,
local_hostname is used as the FQDN of the local host in the HELO/EHLO
command.  Otherwise, the local hostname is found using
socket.getfqdn().  If the connect() call returns anything other
than a success code, an SMTPConnectError is raised. The optional
timeout parameter specifies a timeout in seconds for blocking operations
like the connection attempt (if not specified, the global default timeout
setting will be used).  If the timeout expires, socket.timeout
is raised.

For normal use, you should only require the initialization/connect,
sendmail(), and quit() methods.
An example is included below.

Changed in version 2.6: timeout was added.

class smtplib.SMTP_SSL([host[, port[, local_hostname[, keyfile[, certfile[, timeout]]]]]])¶

A SMTP_SSL instance behaves exactly the same as instances of
SMTP. SMTP_SSL should be used for situations where SSL is
required from the beginning of the connection and using starttls() is
not appropriate. If host is not specified, the local host is used. If
port is omitted, the standard SMTP-over-SSL port (465) is used.
local_hostname has the same meaning as it does for the SMTP
class.  keyfile and certfile are also optional, and can contain a PEM
formatted private key and certificate chain file for the SSL connection. The
optional timeout parameter specifies a timeout in seconds for blocking
operations like the connection attempt (if not specified, the global default
timeout setting will be used).  If the timeout expires, socket.timeout
is raised.

New in version 2.6.

class smtplib.LMTP([host[, port[, local_hostname]]])¶

The LMTP protocol, which is very similar to ESMTP, is heavily based on the
standard SMTP client. It’s common to use Unix sockets for LMTP, so our
connect() method must support that as well as a regular host:port
server.  local_hostname has the same meaning as it does for the
SMTP class.  To specify a Unix socket, you must use an absolute
path for host, starting with a ‘/’.

Authentication is supported, using the regular SMTP mechanism. When using a
Unix socket, LMTP generally don’t support or require any authentication, but
your mileage might vary.

New in version 2.6.

A nice selection of exceptions is defined as well:

exception smtplib.SMTPException¶

The base exception class for all the other exceptions provided by this
module.

exception smtplib.SMTPServerDisconnected¶

This exception is raised when the server unexpectedly disconnects, or when an
attempt is made to use the SMTP instance before connecting it to a
server.

exception smtplib.SMTPResponseException¶

Base class for all exceptions that include an SMTP error code. These exceptions
are generated in some instances when the SMTP server returns an error code.  The
error code is stored in the smtp_code attribute of the error, and the
smtp_error attribute is set to the error message.

exception smtplib.SMTPSenderRefused¶

Sender address refused.  In addition to the attributes set by on all
SMTPResponseException exceptions, this sets ‘sender’ to the string that
the SMTP server refused.

exception smtplib.SMTPRecipientsRefused¶

All recipient addresses refused.  The errors for each recipient are accessible
through the attribute recipients, which is a dictionary of exactly the
same sort as SMTP.sendmail() returns.

exception smtplib.SMTPDataError¶

The SMTP server refused to accept the message data.

exception smtplib.SMTPConnectError¶

Error occurred during establishment of a connection  with the server.

exception smtplib.SMTPHeloError¶

The server refused our HELO message.

exception smtplib.SMTPAuthenticationError¶

SMTP authentication went wrong.  Most probably the server didn’t accept the
username/password combination provided.

See also

RFC 821 - Simple Mail Transfer Protocol

Protocol definition for SMTP.  This document covers the model, operating
procedure, and protocol details for SMTP.

RFC 1869 - SMTP Service Extensions

Definition of the ESMTP extensions for SMTP.  This describes a framework for
extending SMTP with new commands, supporting dynamic discovery of the commands
provided by the server, and defines a few additional commands.

20.12.1. SMTP Objects¶

An SMTP instance has the following methods:

SMTP.set_debuglevel(level)¶

Set the debug output level.  A true value for level results in debug messages
for connection and for all messages sent to and received from the server.

SMTP.docmd(cmd[, argstring])¶

Send a command cmd to the server.  The optional argument argstring is simply
concatenated to the command, separated by a space.

This returns a 2-tuple composed of a numeric response code and the actual
response line (multiline responses are joined into one long line.)

In normal operation it should not be necessary to call this method explicitly.
It is used to implement other methods and may be useful for testing private
extensions.

If the connection to the server is lost while waiting for the reply,
SMTPServerDisconnected will be raised.

SMTP.connect([host[, port]])¶

Connect to a host on a given port.  The defaults are to connect to the local
host at the standard SMTP port (25). If the hostname ends with a colon (':')
followed by a number, that suffix will be stripped off and the number
interpreted as the port number to use. This method is automatically invoked by
the constructor if a host is specified during instantiation.  Returns a
2-tuple of the response code and message sent by the server in its
connection response.

SMTP.helo([hostname])¶

Identify yourself to the SMTP server using HELO.  The hostname argument
defaults to the fully qualified domain name of the local host.
The message returned by the server is stored as the helo_resp attribute
of the object.

In normal operation it should not be necessary to call this method explicitly.
It will be implicitly called by the sendmail() when necessary.

SMTP.ehlo([hostname])¶

Identify yourself to an ESMTP server using EHLO.  The hostname argument
defaults to the fully qualified domain name of the local host.  Examine the
response for ESMTP option and store them for use by has_extn().
Also sets several informational attributes: the message returned by
the server is stored as the ehlo_resp attribute, does_esmtp
is set to true or false depending on whether the server supports ESMTP, and
esmtp_features will be a dictionary containing the names of the
SMTP service extensions this server supports, and their
parameters (if any).

Unless you wish to use has_extn() before sending mail, it should not be
necessary to call this method explicitly.  It will be implicitly called by
sendmail() when necessary.

SMTP.ehlo_or_helo_if_needed()¶

This method call ehlo() and or helo() if there has been no
previous EHLO or HELO command this session.  It tries ESMTP EHLO
first.

SMTPHeloError

The server didn’t reply properly to the HELO greeting.

New in version 2.6.

SMTP.has_extn(name)¶

Return True if name is in the set of SMTP service extensions returned
by the server, False otherwise. Case is ignored.

SMTP.verify(address)¶

Check the validity of an address on this server using SMTP VRFY. Returns a
tuple consisting of code 250 and a full RFC 822 address (including human
name) if the user address is valid. Otherwise returns an SMTP error code of 400
or greater and an error string.

Note

Many sites disable SMTP VRFY in order to foil spammers.

SMTP.login(user, password)¶

Log in on an SMTP server that requires authentication. The arguments are the
username and the password to authenticate with. If there has been no previous
EHLO or HELO command this session, this method tries ESMTP EHLO
first. This method will return normally if the authentication was successful, or
may raise the following exceptions:

SMTPHeloError

The server didn’t reply properly to the HELO greeting.

SMTPAuthenticationError

The server didn’t accept the username/password combination.

SMTPException

No suitable authentication method was found.

SMTP.starttls([keyfile[, certfile]])¶

Put the SMTP connection in TLS (Transport Layer Security) mode.  All SMTP
commands that follow will be encrypted.  You should then call ehlo()
again.

If keyfile and certfile are provided, these are passed to the socket
module’s ssl() function.

If there has been no previous EHLO or HELO command this session,
this method tries ESMTP EHLO first.

Changed in version 2.6.

SMTPHeloError

The server didn’t reply properly to the HELO greeting.

SMTPException

The server does not support the STARTTLS extension.

Changed in version 2.6.

RuntimeError

SSL/TLS support is not available to your Python interpreter.

SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])¶

Send mail.  The required arguments are an RFC 822 from-address string, a list
of RFC 822 to-address strings (a bare string will be treated as a list with 1
address), and a message string.  The caller may pass a list of ESMTP options
(such as 8bitmime) to be used in MAIL FROM commands as mail_options.
ESMTP options (such as DSN commands) that should be used with all RCPT
commands can be passed as rcpt_options.  (If you need to use different ESMTP
options to different recipients you have to use the low-level methods such as
mail(), rcpt() and data() to send the message.)

Note

The from_addr and to_addrs parameters are used to construct the message
envelope used by the transport agents. The SMTP does not modify the
message headers in any way.

If there has been no previous EHLO or HELO command this session, this
method tries ESMTP EHLO first. If the server does ESMTP, message size and
each of the specified options will be passed to it (if the option is in the
feature set the server advertises).  If EHLO fails, HELO will be tried
and ESMTP options suppressed.

This method will return normally if the mail is accepted for at least one
recipient. Otherwise it will raise an exception.  That is, if this method does
not raise an exception, then someone should get your mail. If this method does
not raise an exception, it returns a dictionary, with one entry for each
recipient that was refused.  Each entry contains a tuple of the SMTP error code
and the accompanying error message sent by the server.

This method may raise the following exceptions:

SMTPRecipientsRefused

All recipients were refused.  Nobody got the mail.  The recipients
attribute of the exception object is a dictionary with information about the
refused recipients (like the one returned when at least one recipient was
accepted).

SMTPHeloError

The server didn’t reply properly to the HELO greeting.

SMTPSenderRefused

The server didn’t accept the from_addr.

SMTPDataError

The server replied with an unexpected error code (other than a refusal of a
recipient).

Unless otherwise noted, the connection will be open even after an exception is
raised.

SMTP.quit()¶

Terminate the SMTP session and close the connection.  Return the result of
the SMTP QUIT command.

Changed in version 2.6: Return a value.

Low-level methods corresponding to the standard SMTP/ESMTP commands HELP,
RSET, NOOP, MAIL, RCPT, and DATA are also supported.
Normally these do not need to be called directly, so they are not documented
here.  For details, consult the module code.

20.12.2. SMTP Example¶

This example prompts the user for addresses needed in the message envelope (‘To’
and ‘From’ addresses), and the message to be delivered.  Note that the headers
to be included with the message must be included in the message as entered; this
example doesn’t do any processing of the RFC 822 headers.  In particular, the
‘To’ and ‘From’ addresses must be included in the message headers explicitly.

import smtplib

def prompt(prompt):
    return raw_input(prompt).strip()

fromaddr = prompt("From: ")
toaddrs  = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"

# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n"
       % (fromaddr, ", ".join(toaddrs)))
while 1:
    try:
        line = raw_input()
    except EOFError:
        break
    if not line:
        break
    msg = msg + line

print "Message length is " + repr(len(msg))

server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

Note

In general, you will want to use the email package’s features to
construct an email message, which you can then convert to a string and send
via sendmail(); see email: Examples.

Table Of Contents

20.12. smtplib — SMTP protocol client

20.12.1. SMTP Objects

20.12.2. SMTP Example

Previous topic

20.11. nntplib — NNTP protocol client

Next topic

20.13. smtpd — SMTP Server

This Page

Report a Bug

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

Python »

          2.7.12
          Documentation »

The Python Standard Library »

20. Internet Protocols and Support »

    © Copyright 1990-2016, Python Software Foundation.

    The Python Software Foundation is a non-profit corporation.
    Please donate.

    Last updated on Jun 25, 2016.
    Found a bug?

    Created using Sphinx 1.3.3.


text:
<?php

class sfDoctrineCreateInPlaceActions extends sfActions
{
  public function executeCreate(sfWebRequest $request)
  {
    $className = sprintf('%sForm',$request->getParameter('model'));
    $this->form = new $className();

    if ($request->isMethod('post'))
    {
      $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
      if ($this->form->isValid())
      {
        $this->form->save();
      }
    }
  }
}
?>


text:
<?php

declare(strict_types=1);

$loader = require __DIR__.'/../vendor/autoload.php';

$rulerz = new \RulerZ\RulerZ(
    \RulerZ\Compiler\Compiler::create(), [
        new RulerZ\Target\Native\Native([
            'length' => function ($item) {
                return is_array($item) ? count($item) : strlen($item);
            },
        ]),
        // other compilation targets...
    ]
);

return $rulerz;


text:
namespace accel {

/// A collection of information about the assertion calling an assertion function.
template <size_t SIZE>
struct Assertion {
    /// The location of the assertion.
    Location location;
    /// The string representation of the assertion.
    const char* assertion;
    /// The string representations of the arguments supplied by the assertion.
    std::array<const char*, SIZE> arguments;

    /// Constructs a collection of information about an assertion.
    Assertion(Location location, const char* assertion, std::array<const char*, SIZE> arguments)
        : location{location}, assertion{assertion}, arguments{arguments} { }
};

/// Assists `ACCEL_SIZEOF`.
#define ACCEL_SIZEOF_HELPER(_) + 1
/// Expands to the number of supplied arguments.
#define ACCEL_SIZEOF(...) (0 ACCEL_MAP(ACCEL_SIZEOF_HELPER, __VA_ARGS__))

/// Defines a templated assertion function.
#define ASSERTION_T(FUNCTION, TYPES, ...) \
    template <TYPES> \
    std::optional<::accel::Failure> \
    FUNCTION(::accel::Assertion<ACCEL_SIZEOF(__VA_ARGS__)> assertion, __VA_ARGS__)

/// Defines an assertion function.
#define ASSERTION(FUNCTION, ...) \
    ASSERTION_T(FUNCTION, ACCEL_GROUP(class = void), __VA_ARGS__)

/// Defines a templated assertion group function.
#define ASSERTION_GROUP_T(FUNCTION, TYPES, ...) \
    template <TYPES> \
    void FUNCTION(ACCEL_UNUSED std::vector<::accel::Failure>& _Accel_failures, __VA_ARGS__)

/// Defines an assertion group function.
#define ASSERTION_GROUP(FUNCTION, ...) \
    ASSERTION_GROUP_T(FUNCTION, ACCEL_GROUP(class = void), __VA_ARGS__)

/// Expands to a value which is returned by successful assertion functions.
#define PASS (std::optional<::accel::Failure>{})
/// Expands to a value which is returned by non-successful assertion functions.
#define FAIL (::accel::Failure{assertion.location, assertion.assertion})

namespace detail {
    std::optional<std::string> stringify(bool value);
    std::optional<std::string> stringify(char value);
    std::optional<std::string> stringify(const char* value);
    std::optional<std::string> stringify(const std::string& value);

    template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0>
    std::optional<std::string> stringify(T value) {
        return {std::to_string(value)};
    }

    template <class T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
    std::optional<std::string> stringify(T value) {
        std::stringstream ss;
        ss << std::setprecision(std::is_same_v<T, float> ? 9 : 17);
        ss << value;
        return {ss.str()};
    }

    template <class T, std::enable_if_t<std::is_pointer_v<T>, int> = 0>
    std::optional<std::string> stringify(T value) {
        std::stringstream ss;
        ss << "0x" << std::hex << std::uppercase;
        ss << std::setfill('0') << std::setw(sizeof(T) == 4 ? 8 : 16);
        ss << reinterpret_cast<uintptr_t>(value);
        return {ss.str()};
    }

    template <class T, std::enable_if_t<std::is_enum_v<T>, int> = 0>
    std::optional<std::string> stringify(T value) {
        return stringify(static_cast<std::underlying_type_t<T>>(value));
    }

    template <class T>
    static auto test_stringstream(int)
        -> decltype(std::declval<std::stringstream&>() << std::declval<const T&>(), int());

    template <class T>
    static void test_stringstream(bool);

    template <class T, std::enable_if_t<!std::is_scalar_v<T>, int> = 0>
    std::optional<std::string> stringify(const T& value) {
        if constexpr (std::is_same_v<decltype(test_stringstream<T>(0)), int>) {
            std::stringstream ss;
            ss << value;
            return {ss.str()};
        } else {
            return {};
        }
    }
}

/// Returns a string representation of the supplied value.
template <class T>
std::optional<std::string> stringify(const T& value) {
    return detail::stringify(value);
}

/// Adds a key-value pair to the supplied assertion failure if the string representation of the
/// supplied value differs from the supplied argument string representation.
template <class T>
void add_information(Failure& failure, const char* key, const T& value, const char* argument) {
    if (auto string = stringify(value); string && *string != argument) {
        failure.add_information(key, std::move(*string));
    }
}

namespace detail {
    ASSERTION_T(boolean,
    ACCEL_GROUP(class T), const T& value, bool expected) {
        if (value == expected) {
            return PASS;
        } else {
            auto failure = FAIL;
            add_information(failure, "value", value, assertion.arguments[0]);
            return failure;
        }
    }

    ASSERTION_T(cmp,
    ACCEL_GROUP(class T, class U, class C), const T& left, const U& right, C cmp) {
        if (cmp(left, right)) {
            return PASS;
        } else {
            auto failure = FAIL;
            add_information(failure, "left", left, assertion.arguments[0]);
            add_information(failure, "right", right, assertion.arguments[1]);
            return failure;
        }
    }

    /// Returns the difference in units in the last place for the supplied floats.
    uint64_t get_ulp_difference(float left, float right);
    /// Returns the difference in units in the last place for the supplied doubles.
    uint64_t get_ulp_difference(double left, double right);

    ASSERTION_T(fpcmp,
    ACCEL_GROUP(class T,  class F), T left, T right, uint64_t ulp, F f) {
        auto difference = get_ulp_difference(left, right);
        if (f(difference, ulp)) {
            return PASS;
        } else {
            auto failure = FAIL;
            add_information(failure, "left", left, assertion.arguments[0]);
            add_information(failure, "right", right, assertion.arguments[1]);
            failure.add_information("difference", std::to_string(difference));
            return failure;
        }
    }

#if !defined(ACCEL_NO_EXCEPTIONS)
    ASSERTION_T(exception,
    ACCEL_GROUP(class E), E expression, bool expected) {
        try {
            expression();
            if (!expected) {
                return PASS;
            } else {
                return FAIL << "Expected exception";
            }
        } catch (const std::runtime_error& e) {
            if (expected) {
                return PASS;
            } else {
                auto failure = FAIL << "Unexpected std::runtime_error";
                failure.add_information("what()", *stringify(e.what()));
                return failure;
            }
        } catch (...) {
            if (expected) {
                return PASS;
            } else {
                return FAIL << "Unexpected exception of unknown type";
            }
        }
    }
#endif
}

//================================================
// Custom
//================================================

/// Expands to the stringified version of the supplied argument.
#define ACCEL_STRINGIFY(VALUE) #VALUE,

/// Assists `ACCEL_ASSERT`.
#define ACCEL_ASSERT_HELPER(RETURN, ASSERTION, FUNCTION, ...) { \
    constexpr auto SIZE = ACCEL_SIZEOF(__VA_ARGS__); \
    ::accel::Location location{__FILE__, __LINE__}; \
    std::array<const char*, SIZE> arguments{{ACCEL_MAP(ACCEL_STRINGIFY, __VA_ARGS__)}}; \
    ::accel::Assertion<SIZE> assertion{location, ASSERTION, arguments}; \
    if (auto failure = FUNCTION(assertion, __VA_ARGS__); failure) { \
        _Accel_failures.push_back(std::move(*failure)); \
        if (RETURN) { \
            return; \
        } \
    } \
}

/// Defines a custom assertion.
#define ACCEL_ASSERT(RETURN, NAME, FUNCTION, ...) \
    ACCEL_ASSERT_HELPER(RETURN, NAME "(" #FUNCTION ", " #__VA_ARGS__ ")", FUNCTION, __VA_ARGS__)

/// Defines a terminating custom assertion.
#define ASSERT(FUNCTION, ...) ACCEL_ASSERT(true, "ASSERT", FUNCTION, __VA_ARGS__)
/// Defines a non-terminating custom assertion.
#define EXPECT(FUNCTION, ...) ACCEL_ASSERT(false, "EXPECT", FUNCTION, __VA_ARGS__)

/// Defines a custom group assertion.
#define ACCEL_ASSERT_GROUP(RETURN, FUNCTION, ...) { \
    std::vector<::accel::Failure> failures; \
    FUNCTION(failures, __VA_ARGS__); \
    auto failed = !failures.empty(); \
    for (auto failure : failures) { \
        failure.stack.insert(failure.stack.begin(), ::accel::Location{__FILE__, __LINE__}); \
        _Accel_failures.push_back(std::move(failure)); \
    } \
    if (failed && RETURN) { \
        return; \
    } \
}

/// Defines a terminating custom group assertion.
#define ASSERT_GROUP(FUNCTION, ...) ACCEL_ASSERT_GROUP(true, FUNCTION, __VA_ARGS__)
/// Defines a non-terminating custom group assertion.
#define EXPECT_GROUP(FUNCTION, ...) ACCEL_ASSERT_GROUP(false, FUNCTION, __VA_ARGS__)

//================================================
// Boolean
//================================================

/// Defines a boolean assertion.
#define ACCEL_ASSERT_BOOLEAN(RETURN, NAME, VALUE, EXPECTED) \
    ACCEL_ASSERT_HELPER(RETURN, NAME "(" #VALUE ")", \
        ::accel::detail::boolean, VALUE, EXPECTED)

/// Defines a terminating truth assertion.
#define ASSERT_TRUE(VALUE) ACCEL_ASSERT_BOOLEAN(true, "ASSERT_TRUE", VALUE, true)
/// Defines a non-terminating truth assertion.
#define EXPECT_TRUE(VALUE) ACCEL_ASSERT_BOOLEAN(false, "EXPECT_TRUE", VALUE, true)

/// Defines a terminating falsity assertion.
#define ASSERT_FALSE(VALUE) ACCEL_ASSERT_BOOLEAN(true, "ASSERT_FALSE", VALUE, false)
/// Defines a non-terminating falsity assertion.
#define EXPECT_FALSE(VALUE) ACCEL_ASSERT_BOOLEAN(false, "EXPECT_FALSE", VALUE, false)

//================================================
// Comparison
//================================================

/// Defines a comparison assertion.
#define ACCEL_ASSERT_CMP(RETURN, NAME, LEFT, RIGHT, F) \
    ACCEL_ASSERT_HELPER(RETURN, NAME "(" #LEFT ", " #RIGHT ")", \
        ::accel::detail::cmp, LEFT, RIGHT, F{})

/// Defines a terminating equality assertion.
#define ASSERT_EQ(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_EQ", LEFT, RIGHT, std::equal_to)
/// Defines a non-terminating equality assertion.
#define EXPECT_EQ(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_EQ", LEFT, RIGHT, std::equal_to)

/// Defines a terminating inequality assertion.
#define ASSERT_NE(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_NE", LEFT, RIGHT, std::not_equal_to)
/// Defines a non-terminating inequality assertion.
#define EXPECT_NE(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_NE", LEFT, RIGHT, std::not_equal_to)

/// Defines a terminating greater than assertion.
#define ASSERT_GT(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_GT", LEFT, RIGHT, std::greater)
/// Defines a non-terminating greater than assertion.
#define EXPECT_GT(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_GT", LEFT, RIGHT, std::greater)

/// Defines a terminating less than assertion.
#define ASSERT_LT(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_LT", LEFT, RIGHT, std::less)
/// Defines a non-terminating less than assertion.
#define EXPECT_LT(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_LT", LEFT, RIGHT, std::less)

/// Defines a terminating greater than or equal assertion.
#define ASSERT_GE(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_GE", LEFT, RIGHT, std::greater_equal)
/// Defines a non-terminating greater than or equal assertion.
#define EXPECT_GE(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_GE", LEFT, RIGHT, std::greater_equal)

/// Defines a terminating less than or equal assertion.
#define ASSERT_LE(LEFT, RIGHT) ACCEL_ASSERT_CMP(true, "ASSERT_LE", LEFT, RIGHT, std::less_equal)
/// Defines a non-terminating less than or equal assertion.
#define EXPECT_LE(LEFT, RIGHT) ACCEL_ASSERT_CMP(false, "EXPECT_LE", LEFT, RIGHT, std::less_equal)

// Floating-point --------------------------------

/// Defines a floating-point comparison assertion.
#define ACCEL_ASSERT_FPCMP(RETURN, NAME, LEFT, RIGHT, ULP, F) \
    ACCEL_ASSERT_HELPER(RETURN, NAME "(" #LEFT ", " #RIGHT "," #ULP ")", \
        ::accel::detail::fpcmp, LEFT, RIGHT, ULP, F{})

/// Defines a terminating floating-point equality assertion.
#define ASSERT_FPEQ(LEFT, RIGHT, ULP) \
    ACCEL_ASSERT_FPCMP(true, "ASSERT_FPEQ", LEFT, RIGHT, ULP, std::less_equal)
/// Defines a non-terminating floating-point equality assertion.
#define EXPECT_FPEQ(LEFT, RIGHT, ULP) \
    ACCEL_ASSERT_FPCMP(false, "EXPECT_FPEQ", LEFT, RIGHT, ULP, std::less_equal)

/// Defines a terminating floating-point inequality assertion.
#define ASSERT_FPNE(LEFT, RIGHT, ULP) \
    ACCEL_ASSERT_FPCMP(true, "ASSERT_FPNE", LEFT, RIGHT, ULP, std::greater)
/// Defines a non-terminating inequality assertion.
#define EXPECT_FPNE(LEFT, RIGHT, ULP) \
    ACCEL_ASSERT_FPCMP(false, "EXPECT_FPNE", LEFT, RIGHT, ULP, std::greater)

//================================================
// Exception
//================================================

#if !defined(ACCEL_NO_EXCEPTIONS)
/// Defines an exception assertion.
#define ACCEL_ASSERT_THROW(RETURN, NAME, EXPRESSION, EXPECTED) \
    ACCEL_ASSERT_HELPER(RETURN, NAME "(" #EXPRESSION ")", \
        ::accel::detail::exception, [&] { EXPRESSION; }, EXPECTED)

/// Defines a terminating throw assertion.
#define ASSERT_THROW(EXPRESSION) ACCEL_ASSERT_THROW(true, "ASSERT_THROW", EXPRESSION, true)
/// Defines a non-terminating throw assertion.
#define EXPECT_THROW(EXPRESSION) ACCEL_ASSERT_THROW(false, "EXPECT_THROW", EXPRESSION, true)

/// Defines a terminating nothrow assertion.
#define ASSERT_NOTHROW(EXPRESSION) ACCEL_ASSERT_THROW(true, "ASSERT_NOTHROW", EXPRESSION, false)
/// Defines a non-terminating nothrow assertion.
#define EXPECT_NOTHROW(EXPRESSION) ACCEL_ASSERT_THROW(false, "EXPECT_NOTHROW", EXPRESSION, false)
#endif

}

#endif


text:
namespace Microsoft.Azure.Batch.Protocol
{
    using System;
    using System.Collections.Generic;
    using System.Net.Http;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;

    /// <summary>
    /// PoolOperations operations.
    /// </summary>
    public partial interface IPoolOperations
    {
        /// <summary>
        /// Lists the usage metrics, aggregated by pool across individual time
        /// intervals, for the specified account.
        /// </summary>
        /// <param name='poolListPoolUsageMetricsOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<PoolUsageMetrics>,PoolListPoolUsageMetricsHeaders>> ListPoolUsageMetricsWithHttpMessagesAsync(PoolListPoolUsageMetricsOptions poolListPoolUsageMetricsOptions = default(PoolListPoolUsageMetricsOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Gets lifetime summary statistics for all of the pools in the
        /// specified account.
        /// </summary>
        /// <remarks>
        /// Statistics are aggregated across all pools that have ever existed
        /// in the account, from account creation to the last update time of
        /// the statistics.
        /// </remarks>
        /// <param name='poolGetAllPoolsLifetimeStatisticsOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<PoolStatistics,PoolGetAllPoolsLifetimeStatisticsHeaders>> GetAllPoolsLifetimeStatisticsWithHttpMessagesAsync(PoolGetAllPoolsLifetimeStatisticsOptions poolGetAllPoolsLifetimeStatisticsOptions = default(PoolGetAllPoolsLifetimeStatisticsOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Adds a pool to the specified account.
        /// </summary>
        /// <param name='pool'>
        /// The pool to be added.
        /// </param>
        /// <param name='poolAddOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolAddHeaders>> AddWithHttpMessagesAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions = default(PoolAddOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Lists all of the pools in the specified account.
        /// </summary>
        /// <param name='poolListOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<CloudPool>,PoolListHeaders>> ListWithHttpMessagesAsync(PoolListOptions poolListOptions = default(PoolListOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Deletes a pool from the specified account.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to delete.
        /// </param>
        /// <param name='poolDeleteOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolDeleteHeaders>> DeleteWithHttpMessagesAsync(string poolId, PoolDeleteOptions poolDeleteOptions = default(PoolDeleteOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Gets basic properties of a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to get.
        /// </param>
        /// <param name='poolExistsOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<bool,PoolExistsHeaders>> ExistsWithHttpMessagesAsync(string poolId, PoolExistsOptions poolExistsOptions = default(PoolExistsOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Gets information about the specified pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to get.
        /// </param>
        /// <param name='poolGetOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<CloudPool,PoolGetHeaders>> GetWithHttpMessagesAsync(string poolId, PoolGetOptions poolGetOptions = default(PoolGetOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Updates the properties of a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to update.
        /// </param>
        /// <param name='poolPatchParameter'>
        /// The parameters for the request.
        /// </param>
        /// <param name='poolPatchOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolPatchHeaders>> PatchWithHttpMessagesAsync(string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions = default(PoolPatchOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Disables automatic scaling for a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool on which to disable automatic scaling.
        /// </param>
        /// <param name='poolDisableAutoScaleOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolDisableAutoScaleHeaders>> DisableAutoScaleWithHttpMessagesAsync(string poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions = default(PoolDisableAutoScaleOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Enables automatic scaling for a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool on which to enable automatic scaling.
        /// </param>
        /// <param name='poolEnableAutoScaleParameter'>
        /// The parameters for the request.
        /// </param>
        /// <param name='poolEnableAutoScaleOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolEnableAutoScaleHeaders>> EnableAutoScaleWithHttpMessagesAsync(string poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions = default(PoolEnableAutoScaleOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Gets the result of evaluating an automatic scaling formula on the
        /// pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool on which to evaluate the automatic scaling
        /// formula.
        /// </param>
        /// <param name='autoScaleFormula'>
        /// A formula for the desired number of compute nodes in the pool.
        /// </param>
        /// <param name='poolEvaluateAutoScaleOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<AutoScaleRun,PoolEvaluateAutoScaleHeaders>> EvaluateAutoScaleWithHttpMessagesAsync(string poolId, string autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions = default(PoolEvaluateAutoScaleOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Changes the number of compute nodes that are assigned to a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to resize.
        /// </param>
        /// <param name='poolResizeParameter'>
        /// The parameters for the request.
        /// </param>
        /// <param name='poolResizeOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolResizeHeaders>> ResizeWithHttpMessagesAsync(string poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions = default(PoolResizeOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Stops an ongoing resize operation on the pool.
        /// </summary>
        /// <remarks>
        /// This does not restore the pool to its previous state before the
        /// resize operation: it only stops any further changes being made,
        /// and the pool maintains its current state.
        /// </remarks>
        /// <param name='poolId'>
        /// The id of the pool whose resizing you want to stop.
        /// </param>
        /// <param name='poolStopResizeOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolStopResizeHeaders>> StopResizeWithHttpMessagesAsync(string poolId, PoolStopResizeOptions poolStopResizeOptions = default(PoolStopResizeOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Updates the properties of a pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to update.
        /// </param>
        /// <param name='poolUpdatePropertiesParameter'>
        /// The parameters for the request.
        /// </param>
        /// <param name='poolUpdatePropertiesOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolUpdatePropertiesHeaders>> UpdatePropertiesWithHttpMessagesAsync(string poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions = default(PoolUpdatePropertiesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Upgrades the operating system of the specified pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool to upgrade.
        /// </param>
        /// <param name='targetOSVersion'>
        /// The Azure Guest OS version to be installed on the virtual machines
        /// in the pool.
        /// </param>
        /// <param name='poolUpgradeOSOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolUpgradeOSHeaders>> UpgradeOSWithHttpMessagesAsync(string poolId, string targetOSVersion, PoolUpgradeOSOptions poolUpgradeOSOptions = default(PoolUpgradeOSOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Removes compute nodes from the specified pool.
        /// </summary>
        /// <param name='poolId'>
        /// The id of the pool from which you want to remove nodes.
        /// </param>
        /// <param name='nodeRemoveParameter'>
        /// The parameters for the request.
        /// </param>
        /// <param name='poolRemoveNodesOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<PoolRemoveNodesHeaders>> RemoveNodesWithHttpMessagesAsync(string poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions = default(PoolRemoveNodesOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Lists the usage metrics, aggregated by pool across individual time
        /// intervals, for the specified account.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='poolListPoolUsageMetricsNextOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<PoolUsageMetrics>,PoolListPoolUsageMetricsHeaders>> ListPoolUsageMetricsNextWithHttpMessagesAsync(string nextPageLink, PoolListPoolUsageMetricsNextOptions poolListPoolUsageMetricsNextOptions = default(PoolListPoolUsageMetricsNextOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Lists all of the pools in the specified account.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='poolListNextOptions'>
        /// Additional parameters for the operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="BatchErrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<CloudPool>,PoolListHeaders>> ListNextWithHttpMessagesAsync(string nextPageLink, PoolListNextOptions poolListNextOptions = default(PoolListNextOptions), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
package com.planet_ink.coffee_mud.Libraries.interfaces;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.io.IOException;
import java.util.*;

public interface CharCreationLibrary extends CMLibrary
{
	public void reRollStats(MOB mob, CharStats C, int pointsLeft);
	public void promptPlayerStats(int theme, MOB mob, Session session, int bonusPoints) throws IOException;
	public CharClass promptCharClass(int theme, MOB mob, Session session) throws IOException;
	public int getTrainingCost(MOB mob, int abilityCode, boolean quiet);
	public boolean canChangeToThisClass(MOB mob, CharClass thisClass, int theme);
	// mob is optional
	public List<CharClass> classQualifies(MOB mob, int theme);
	// mob is optional
	public void moveSessionToCorrectThreadGroup(final Session session, int theme);
	public List<String> getExpiredList();
	public List<Race> raceQualifies(MOB mob, int theme);
	public boolean isOkName(String login, boolean spacesOk);
	public boolean isBadName(String login);
	public void reloadTerminal(MOB mob);
	public void showTheNews(MOB mob);
	public void notifyFriends(MOB mob, String message);
	public LoginResult createCharacter(PlayerAccount acct, String login, Session session) throws java.io.IOException;
	public LoginResult loginSystem(Session session, LoginSession loginObj) throws java.io.IOException;
	public NewCharNameCheckResult newCharNameCheck(String login, String ipAddress, boolean checkPlayerName);
	public NewCharNameCheckResult newAccountNameCheck(String login, String ipAddress);
	public void pageRooms(CMProps page, Map<String, String> table, String start);
	public void initStartRooms(CMProps page);
	public void initDeathRooms(CMProps page);
	public void initBodyRooms(CMProps page);
	public Room getDefaultStartRoom(MOB mob);
	public Room getDefaultDeathRoom(MOB mob);
	public Room getDefaultBodyRoom(MOB mob);
	public String generateRandomName(int minSyllable, int maxSyllable);

	public enum LoginState {LOGIN_START, LOGIN_NAME, LOGIN_ACCTCHAR_PWORD, LOGIN_PASS_START, LOGIN_NEWACCOUNT_CONFIRM, LOGIN_NEWCHAR_CONFIRM,
							LOGIN_PASS_RECEIVED, LOGIN_EMAIL_PASSWORD, LOGIN_ACCTCONV_CONFIRM,
							ACCTMENU_COMMAND, ACCTMENU_PROMPT, ACCTMENU_CONFIRMCOMMAND, ACCTMENU_ADDTOCOMMAND,
							ACCTMENU_SHOWMENU, ACCTMENU_SHOWCHARS, ACCTMENU_START,
							ACCTCREATE_START, ACCTCREATE_ANSICONFIRM, ACCTCREATE_PASSWORDED,
							ACCTCREATE_EMAILSTART, ACCTCREATE_EMAILPROMPT, ACCTCREATE_EMAILENTERED, ACCTCREATE_EMAILCONFIRMED,
							CHARCR_EMAILCONFIRMED, CHARCR_EMAILPROMPT, CHARCR_EMAILENTERED, CHARCR_EMAILSTART, CHARCR_EMAILDONE,
							CHARCR_PASSWORDDONE, CHARCR_START, CHARCR_ANSIDONE, CHARCR_ANSICONFIRMED, CHARCR_THEMEDONE,
							CHARCR_THEMEPICKED, CHARCR_THEMESTART, CHARCR_GENDERSTART, CHARCR_GENDERDONE,
							CHARCR_RACEDONE, CHARCR_RACESTART, CHARCR_RACEENTERED, CHARCR_RACECONFIRMED,
							CHARCR_STATDONE, CHARCR_STATSTART, CHARCR_STATCONFIRM, CHARCR_STATPICK, CHARCR_STATPICKADD,
							CHARCR_CLASSSTART, CHARCR_CLASSDONE, CHARCR_CLASSPICKED, CHARCR_CLASSCONFIRM,
							CHARCR_FACTIONNEXT, CHARCR_FACTIONDONE, CHARCR_FACTIONPICK,
							CHARCR_FINISH
							}

	public static class LoginSession
	{
		public boolean 		 wizi	   = false;
		public boolean		 reset	   = false;
		public boolean		 skipInput = false;
		public LoginState 	 state	   = LoginState.LOGIN_START;
		public String 		 login	   = null;
		public PlayerAccount acct 	   = null;
		public String 		 lastInput = null;
		public String		 savedInput= null;
		public String 		 password  = null;
		public int			 attempt   = 0;
		public MOB			 mob	   = null;
		public int			 theme	   = -1;
		public int			 statPoints= 0;
		public CharStats	 baseStats = null;
		public int			 index	   = 0;
		public PlayerLibrary.ThinnerPlayer player = null;
	}

	public enum NewCharNameCheckResult { OK, NO_NEW_PLAYERS, NO_NEW_LOGINS, BAD_USED_NAME, CREATE_LIMIT_REACHED }

	public final static String[] DEFAULT_BADNAMES = new String[]{"LIST","DELETE","QUIT","NEW","HERE","YOU","SHIT","FUCK","CUNT","FAGGOT","ASSHOLE","NIGGER","ARSEHOLE","PUSSY","COCK","SLUT","BITCH","DAMN","CRAP","GOD","JESUS","CHRIST","NOBODY","SOMEBODY","MESSIAH","ADMIN","SYSOP"};

	public enum LoginResult
	{
		NO_LOGIN, NORMAL_LOGIN, INPUT_REQUIRED
	}
}


text:
    target_os = "linux",
    target_os = "dragonfly",
    target_os = "freebsd",
    target_os = "netbsd",
    target_os = "openbsd"
))]

use sctk::reexports::client::protocol::wl_surface::WlSurface;

pub use event_loop::{EventLoop, EventLoopProxy, EventLoopWindowTarget};
pub use output::{MonitorHandle, VideoMode};
pub use window::Window;

mod env;
mod event_loop;
mod output;
mod seat;
mod window;

#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DeviceId;

impl DeviceId {
    pub unsafe fn dummy() -> Self {
        DeviceId
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct WindowId(usize);

impl WindowId {
    pub unsafe fn dummy() -> Self {
        WindowId(0)
    }
}

#[inline]
fn make_wid(surface: &WlSurface) -> WindowId {
    WindowId(surface.as_ref().c_ptr() as usize)
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;

#if NET_CORE
using System.Runtime.Loader;
#endif

namespace Blur.Processing
{
    /// <summary>
    /// Static class used to run, edit and save assemblies
    /// using Blur.
    /// </summary>
    public static class Processor
    {
        #region Fields & Constructor
        private const string ATTRIBUTE_FULLNAME = "Blur.BlurAttribute";
        private const string PROCESSOR_FULLNAME = "Blur.Processor";
        private const string PROCESSOR_METHOD = "Process";
        private const string PROCESSOR_GETASSEMBLIES = "GetAssemblies";
        private const string PROCESSOR_GETASSEMBLY = "GetAssembly";
        private const string PROCESSOR_LOGMESSAGE = "LogMessage";
        private const string PROCESSOR_PREPROCESS = "Preprocess";
        private const string PROCESSOR_GETASSEMBLYSTREAM = "GetAssemblyStream";

        private static bool WillSave = true;
        private static bool HasBeenInitialized;
        private static string AssemblyDirectory;
        private static string AssemblyPath;

        private static Stream TargetStream;
        private static Stream SymbolStream;
        private static string TargetPath;

        internal static Assembly Assembly;
        internal static Assembly BlurLibrary;
        private static Type ProcessorType;

        public static event Action<string> MessageLogged;
        public static event Action<string> WarningLogged;

        static Processor()
        {
#if NET_CORE
            // Handle case where Blur.Library can't be found.
            AssemblyLoadContext.Default.Resolving += ResolvingAssembly;
#else
            // Handle case where Blur.Library can't be found.
            AppDomain.CurrentDomain.AssemblyResolve += ResolvingAssembly;
#endif
        }
        #endregion

        #region Public methods
        /// <summary>
        /// Initialize the <see cref="Processor"/>, given the file that it'll modify.
        /// </summary>
        /// <param name="assemblyPath">Path of the assembly to process.</param>
        /// <param name="copyPath">Path of the shadow copy of the assembly to process. If <see langword="null"/>, a temporary file will be used instead.</param>
        public static void Initialize(string assemblyPath, string copyPath = null)
        {
            HasBeenInitialized = true;

            TargetPath = copyPath;
            AssemblyPath = assemblyPath;
            AssemblyDirectory = Path.GetDirectoryName(assemblyPath);

            // Copy file to modify it later.
            if (copyPath == null)
                copyPath = Path.GetTempFileName();

            File.Copy(assemblyPath, copyPath, true);

            // Load Blur.Library first.
            if (AssemblyResolver.References != null)
            {
                string blurLibraryPath = AssemblyResolver.References
                    .FirstOrDefault(x => x.EndsWith("Blur.Library.dll", StringComparison.OrdinalIgnoreCase));

                if (blurLibraryPath != null)
                    BlurLibrary = Assembly.LoadFrom(blurLibraryPath);
            }

            if (BlurLibrary == null)
            {
                try
                {
                    BlurLibrary = Assembly.Load(new AssemblyName("Blur.Library"));
                }
                catch
                {
                    string currentDir = Path.GetDirectoryName(typeof(Processor).Assembly.Location);
                    BlurLibrary = Assembly.LoadFrom(Path.Combine(currentDir, "Blur.Library.dll"));
                }
            }

            // Load the assembly to modify.
            TargetStream = File.Open(copyPath, FileMode.Open, FileAccess.ReadWrite);

            // If possible, load the symbols.
            string symbolsPath;

            if (File.Exists(symbolsPath = Path.ChangeExtension(assemblyPath, ".pdb")))
                SymbolStream = File.Open(symbolsPath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);

            else if (File.Exists(symbolsPath = Path.ChangeExtension(symbolsPath, ".mdb")))
                SymbolStream = File.Open(symbolsPath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
        }

        /// <summary>
        /// Dispose the Processor, saving its content.
        /// </summary>
        public static void Dispose()
        {
            if (!WillSave)
                return;

            TargetStream.Dispose();
        }

        /// <summary>
        /// Cancel the operation, discarding changes.
        /// </summary>
        public static void Cancel()
        {
            WillSave = false;

            Dispose();
        }

        /// <summary>
        /// Process the <see cref="Assembly"/> at the given path.
        /// </summary>
        /// <inheritdoc cref="FileStream(string, FileMode, FileAccess)" select="exception"/>
        public static void Process()
        {
            if (!HasBeenInitialized)
                throw new Exception("Please initialize the processor before calling Process.");

            // Load the assembly.
#if NET_CORE
            Assembly = AssemblyLoadContext.Default.LoadFromStream(TargetStream);
#else
            byte[] assemblyBytes = new byte[TargetStream.Length];

            TargetStream.Position = 0;
            TargetStream.Read(assemblyBytes, 0, assemblyBytes.Length);

            Assembly = Assembly.Load(assemblyBytes);
#endif
            // Initialize the remote processor.
            if (ProcessorType == null)
                ProcessorType = GetRemoteProcessor();

            // Process the assembly.
            ProcessAssembly();
        }

        /// <summary>
        /// Preprocess the target assembly.
        /// </summary>
        public static void Preprocess()
        {
            if (!HasBeenInitialized)
                throw new Exception("Please initialize the processor before calling Preprocess.");

            TargetStream.Position = 0;

            // Initialize the remote processor.
            if (ProcessorType == null)
                ProcessorType = GetRemoteProcessor();

            ProcessorType.GetMethod(PROCESSOR_PREPROCESS, BindingFlags.Static | BindingFlags.Public)
                         .Invoke(null, new object[] { TargetStream, SymbolStream });
        }
        #endregion

        #region Assembly Resolution
        /// <summary>
        /// Attempts to resolve an assembly.
        /// </summary>
#if NET_CORE
        private static Assembly ResolvingAssembly(AssemblyLoadContext loadContext, AssemblyName name)
        {
            string assemblyPath = Path.Combine(Path.GetDirectoryName(AssemblyPath), name.Name + ".dll");

            if (File.Exists(assemblyPath))
                return loadContext.LoadFromAssemblyPath(assemblyPath);

            return AssemblyResolver.Resolve(name);
        }
#else
        private static Assembly ResolvingAssembly(object sender, ResolveEventArgs e)
        {
            string assemblyPath = Path.Combine(AssemblyDirectory, e.Name.Substring(0, e.Name.IndexOf(',')) + ".dll");

            if (File.Exists(assemblyPath))
                return Assembly.LoadFrom(assemblyPath);

            return AssemblyResolver.Resolve(e.Name);
        }
#endif
        #endregion

        #region Utils
        /// <summary>
        /// Returns the type of the remote processor, after initializing it.
        /// </summary>
        private static Type GetRemoteProcessor()
        {
            //foreach (var t in BlurLibrary.GetTypes())
            //    Console.WriteLine($"type: {t}");

            Type processor = BlurLibrary.GetType(PROCESSOR_FULLNAME, true);

            // Set the processor's "tunnel" functions.
            Func<Assembly[]> getAssemblies = AppDomain.CurrentDomain.GetAssemblies;
            Func<string, Assembly> getAssembly = assemblyName
                => AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName == assemblyName)
                ?? AssemblyResolver.Resolve(new AssemblyName(assemblyName));
            Func<string, Stream> getAssemblyStream = assemblyName =>
            {
                string location = getAssembly(assemblyName)?.Location;

                if (location == null)
                    return null;

                try
                {
                    return File.OpenRead(location);
                }
                catch
                {
                    return null;
                }
            };

            Console.WriteLine($"Enumerating fields from {processor}");
            foreach (var fld in processor.GetRuntimeFields())
                Console.WriteLine($"field: {fld}");

            processor.GetField(PROCESSOR_GETASSEMBLIES).SetValue(null, getAssemblies);
            processor.GetField(PROCESSOR_GETASSEMBLY).SetValue(null, getAssembly);
            processor.GetField(PROCESSOR_GETASSEMBLYSTREAM).SetValue(null, getAssemblyStream);
            processor.GetField(PROCESSOR_LOGMESSAGE).SetValue(null, new Action<string, bool>((msg, isWarning) =>
                     {
                         if (isWarning)
                             WarningLogged?.Invoke(msg);
                         else
                             MessageLogged?.Invoke(msg);
                     }));

            return processor;
        }

		/// <summary>
        /// Create a BlurAttribute, given its custom attribute data.
        /// </summary>
        private static object CreateAttribute(CustomAttributeData blurAttribute)
        {
            object[] args = new object[blurAttribute.ConstructorArguments.Count];
            for (int i = 0; i < args.Length; i++)
                args[i] = blurAttribute.ConstructorArguments[i].Value;

            Type attrType = blurAttribute.AttributeType;
            object attrObj = blurAttribute.Constructor.Invoke(args);

            if (blurAttribute.NamedArguments != null)
            {
                foreach (CustomAttributeNamedArgument namedArg in blurAttribute.NamedArguments)
                {
                    object value = namedArg.TypedValue.Value;

                    IReadOnlyList<CustomAttributeTypedArgument> typedArgs = value as IReadOnlyList<CustomAttributeTypedArgument>;
                    if (typedArgs != null)
                    {
                        Array array = (Array)Activator.CreateInstance(namedArg.TypedValue.ArgumentType, typedArgs.Count);

                        for (int i = 0; i < array.Length; i++)
                            array.SetValue(typedArgs[i].Value, i);

                        value = array;
                    }

                    if (namedArg.IsField)
                        attrType.GetField(namedArg.MemberName).SetValue(attrObj, value);
                    else
                        attrType.GetProperty(namedArg.MemberName).SetValue(attrObj, value);
                }
            }

            return attrObj;
        }

        /// <summary>
        /// Process the target assembly.
        /// </summary>
        private static void ProcessAssembly()
        {
            // Get the BlurAttribute set on the assembly.
            CustomAttributeData blurAttribute =
                Assembly.CustomAttributes.FirstOrDefault(x => x.AttributeType.FullName == ATTRIBUTE_FULLNAME);

            if (blurAttribute == null)
                throw new ArgumentException("The given assembly must be marked with the Blur attribute.");

            // Make the Blur attribute out of its data.
            object attrObj = CreateAttribute(blurAttribute);

            // Retrieve the BlurAttribute's TypeInfo, to access its declaring Assembly.
            if (BlurLibrary == null)
                BlurLibrary = blurAttribute.AttributeType.GetTypeInfo().Assembly;

            TargetStream.Position = 0;

            // Call Processor.Process();
            ProcessorType.GetMethod(PROCESSOR_METHOD, new[] { typeof(string), typeof(Assembly), attrObj.GetType(), typeof(Stream), typeof(Stream) })
                         .Invoke(null, new[] { TargetPath, Assembly, attrObj, TargetStream, SymbolStream });
        }
        #endregion
    }
}


text:
    <alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>

FluksoChart

            Specify time interval to select TMPO data from

                    From

                    <input class="form-control" id="fromDate" type="date" name="fromDate" placeholder="YYYY-MM-DD"/>

                    <input class="form-control" id="fromTime" type="time" name="fromTime" placeholder="HH:MM:SS"/>

                    To

                    <input class="form-control" id="toDate" type="date" name="toDate" placeholder="YYYY-MM-DD"/>

                    <input class="form-control" id="toTime" type="time" name="toTime" placeholder="HH:MM:SS"/>

                <button class="btn btn-success" id="submit">Submit</button>
                <button class="btn btn-danger" id="refresh">Refresh</button>

FLM Chart Display © 2015 -
        Toggle Selection


text:
var module = angular.module("example", ["angularGrid"]);

module.controller("exampleCtrl", function($scope, $http) {

    var irishAthletes = ['John Joe Nevin','Katie Taylor','Paddy Barnes','Kenny Egan','Darren Sutherland', 'Margaret Thatcher', 'Tony Blair', 'Ronald Regan', 'Barack Obama'];

    var columnDefs = [
        {headerName: "Athlete", field: "athlete", width: 150, filter: 'set',
            filterParams: { cellHeight: 20, values: irishAthletes} },
        {headerName: "Age", field: "age", width: 90, filter: 'number'},
        {headerName: "Country", field: "country", width: 120},
        {headerName: "Year", field: "year", width: 90},
        {headerName: "Date", field: "date", width: 110},
        {headerName: "Sport", field: "sport", width: 110},
        {headerName: "Gold", field: "gold", width: 100, filter: 'number'},
        {headerName: "Silver", field: "silver", width: 100, filter: 'number'},
        {headerName: "Bronze", field: "bronze", width: 100, filter: 'number'},
        {headerName: "Total", field: "total", width: 100, filter: 'number'}
    ];

    $scope.gridOptions = {
        columnDefs: columnDefs,
        rowData: null,
        enableFilter: true
    };

    $http.get("../olympicWinners.json")
        .then(function(res){
            $scope.gridOptions.rowData = res.data;
            $scope.gridOptions.api.onNewRows();
        });
});


text:
package com.twu.biblioteca.view;

import com.twu.biblioteca.model.Login;
import com.twu.biblioteca.model.User;

public class LoginView implements ViewInterface {
    private Login login;
    private final UserView userView;
    private final AdminView adminView;
    private User user;
    private View view;

    public LoginView(View view, Login login, UserView userView, AdminView adminView) {
        this.view = view;
        this.login = login;
        this.userView = userView;
        this.adminView = adminView;
    }

    @Override
    public ViewInterface render(ViewInterface viewInterface) {
        String username, password;
        do {
            while(!view.initialMenu());
            System.out.println("Enter the user name");
            username = view.takeInput();
            System.out.println("Enter the password");
            password = view.takeInput();
        }
        while (!login.setCurrentUser(username, password));
        if(login.isCurrentUserAdmin())
            return adminView;
        else
            return userView;
    }
}


text:
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Mindosa.Hydra.Tests.Infrastructure;
using NUnit.Framework;

namespace Mindosa.Hydra.Tests
{
    [TestFixture]
    public class UnitTest1
    {
        private const string DatabaseConnName = "Db";
        private const string DatabaseName = "TestDatabase";

        #region private methods

        protected static void ExecuteNonQuery(string sql)
        {
            using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[DatabaseConnName].ConnectionString))
            {
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = sql;

                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                }
            }
        }
        #endregion

        [TestFixtureSetUp]
        public void Setup()
        {
            UnitTestStartAndEnd.Start(DatabaseName);

            var customObject = new CustomObject()
            {
                IntegerField = 42,
                StringField = "The answer to everything..."
            };

            var customXml = string.Empty;
            var stringBuilder = new StringBuilder();

            using(var writer = XmlWriter.Create(stringBuilder, new XmlWriterSettings() { OmitXmlDeclaration = true }))
            {
                XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
                ns.Add(string.Empty, string.Empty);
                new XmlSerializer(typeof(CustomObject)).Serialize(writer, customObject, ns);
                customXml = stringBuilder.ToString();
            }

            ExecuteNonQuery("CREATE Table TestObject (id int not null, name varchar(250), location geography, customData xml)");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(1, 'One', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(2, 'Two', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(3, 'Three', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(4, 'Four', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(5, 'Five', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
        }

        [Test]
        public void TestingSynchronousHydration()
        {
            using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[DatabaseConnName].ConnectionString))
            {
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = @"select id, name, id * 4 as Comp, Location, CustomData from TestObject order by id;
                                        select top 1 id, name, id * 4 as Comp, Location, CustomData from TestObject order by id desc;";

                    cmd.Connection.Open();
                    using (var reader = cmd.ExecuteReader())
                    {
                        var resultSet = reader.Hydrate<TestObject>();

                        var secondResultSet = reader.Hydrate<TestObject>();

                        Assert.AreEqual(5, resultSet.Count);
                        Assert.AreEqual("One", resultSet.First().Name);
                        Assert.AreEqual(4, resultSet.First().Comp);
                        Assert.AreEqual("Id: 1", resultSet.First().StringId);
                        Assert.AreEqual(42, resultSet.First().CustomData.IntegerField);

                        Assert.AreEqual(1, secondResultSet.Count);
                        Assert.AreEqual("Id: 5", secondResultSet.Single().StringId);
                    }
                }
            }
        }

        [Test]
        public async void TestingAsyncHydration()
        {
            using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[DatabaseConnName].ConnectionString))
            {
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = @"select id, name, id * 4 as Comp, Location, CustomData from TestObject order by id;
                                        select top 1 id, name, id * 4 as Comp, Location, CustomData from TestObject order by id desc;";

                    cmd.Connection.Open();
                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        var resultSet = await reader.HydrateAsync<TestObject>();

                        var secondResultSet = await reader.HydrateAsync<TestObject>();

                        Assert.AreEqual(5, resultSet.Count);
                        Assert.AreEqual("One", resultSet.First().Name);
                        Assert.AreEqual(4, resultSet.First().Comp);
                        Assert.AreEqual("Id: 1", resultSet.First().StringId);
                        Assert.AreEqual(42, resultSet.First().CustomData.IntegerField);

                        Assert.AreEqual(1, secondResultSet.Count);
                        Assert.AreEqual("Id: 5", secondResultSet.Single().StringId);
                    }
                }
            }
        }

        [TestFixtureTearDown]
        public void TearDown()
        {
            UnitTestStartAndEnd.End(DatabaseName);
        }
    }
}


text:
Parses a set of iCalendar feeds and combines them into one feed.

## Configuration

TODO

## Parsing

TODO

## Postprocessing

TODO

## Caching

TODO

## Known issues

TODO


text:
Here are the Stephen King books I've read. Except for a limited few, they've mostly been completed chronologically:

1. Misery (read-to:1989)
2. The Long Walk
2. The Gunslinger (completed:20010131)
3. Hearts in Atlantis (completed:20010228)
4. The Drawing of the Three (completed:20010331)
5. The Wastelands (completed:20010430)
6. Wizard and Glass (completed:20010531)
6. Night Shift
6. Different Seasons
6. Skeleton Crew
6. Four Past Midnight
6. Nightmares and Dreamscapes
7. Carrie (completed:20010631)
8. Salems Lot (completed:20010731)
9. The Shining
10. Rage
11. The Stand [uncut]
13. The Dead Zone
14. Firestarter
15. Roadwork
16. Cujo
17. The Running Man
18. Christine
19. Pet Semetary
20. Cycle of the Werewolf
21. The Talisman
22. Thinner
23. The Eyes of the Dragon (completed:20041201)
24. It (completed:20130501)
25. The Tommyknockers (completed:20130901)
26. The Dark Half (completed:20140101)
27. Needful Things (completed:20140401)
28. Gerald's Game (completed:20150301)
29. Dolores Claiborne (completed:20150401)
30. Insomnia (completed:20150701)
31. Rose Madder (completed:20150801)
32. The Green Mile (completed:20150901)
33. Desperation (started:20150901;completed:20150919)
34. The Regulators (started:20150919;completed:20150927)
35. Bag of Bones (completed:20151012)
36. The Girl Who Loved Tom Gordon (completed:20151019)
2. Everything's Eventual (completed:20160106)
3. Black House (completed:20160125)
4. From a Buick 8 (completed:0206)
1. On Writing (completed:20160305)
5. Faithful (non-fiction) (completed:20160317)
6. The Colorado Kid (completed:20160312)
7. Cell (completed:20160320)
8. Lisey's Story (completed:20160406)
9. Blaze (Bachman) (completed:2016)
10. Duma Key (completed:20160504)
1. Just After Sunset (started:20160501)
2. Under the Dome (started:20160514)
3. Storm of the Century (started:20160521;completed:20160704)
13. Full Dark, No Stars (completed:201606)
14. 11/22/63 (completed:20160727)
15. Joyland (completed:20160901)
16. Dr. Sleep (completed:20160909)
17. Mr. Mercedes (completed:20160920)
18. Revival (completed:20160928)

# Reading
19. Finders Keepers
20. The Bazaar of Bad Dreams

# To Read

21. End of Watch (published:6/7/16)

Notes
* I intend to re-read "Misery" on my own; it will be after I get through the 20th century works.
* Stories with incomplete dates are inaccurate. In fact, only "The Green Mile" is accurate to the day. The rest are approximations, and only the most recent are accurate to within 90 days.
* Both Pet Semetary and Gerald's Game were attempted in my teenage years. My mother had copies of both but I never got through more than 20 pages.
* After "The Dark Half", I got on a Shane Stevens kick (Dead City, By Reason of Insanity, The Anvil Chorus), thanks to the King himself.