text:
package com.example.cognitive.alchemy;

import com.alchemyapi.api.AlchemyAPI_Params;
import com.ibm.watson.developer_cloud.personality_insights.v2.PersonalityInsights;
import com.ibm.watson.developer_cloud.personality_insights.v2.model.Profile;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alchemyapi.api.AlchemyAPI;

import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import java.io.*;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

public class AlchemyLanguageServlet extends HttpServlet
{
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        // Create an AlchemyAPI object.
        AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromString("9f55b116a2bc68aa9f4fbedb3f630f8f55f27f30");

        // Extract a ranked list of named entities for a web URL.
        Document doc;
		try {
			String words = request.getParameter("words");
			doc = alchemyObj.URLGetRankedNamedEntities(words);
			PrintWriter out = response.getWriter();
			out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" +" +
                    "http://www.w3.org/TR/html4/loose.dtd\">\n" +
                " \n" +
                  " \n" +
                    "<meta http-equiv=\"Content-Type\" content=\"text/html; " +
                      "charset=ISO-8859-1\"> \n" +
                    "<title> Crunchify.com JSP Servlet Example  </title> \n" +
                  " \n" +
                  "
 \n" +
                    "


text:
package persistence;

import java.util.List;

public interface UserDAO {
	public void create(User user);
	public User get(Integer id);
	public User get(String username);
	public void update(User user);
	public void delete(User user);
	public int numberOfUsers();
	public List<User> getUsers();
}

redpajama_set_name: RedPajamaGithub


text:
def eat(meal)
  if block_given?
    meal.each {|food| yield(food)}
  end
  'delicious!'
end


text:
[![Build Status](https://travis-ci.org/refinery/refinerycms-news.svg?branch=master)](https://travis-ci.org/refinery/refinerycms-news)

## About

__Refinery's news engine allows you to post updates to the news section of your website.__

Key features:

* Default news page shows a summary of recent news posts
* Detail view shows the full post and also linked to recent news on the "side bar"

## Requirements

[Refinery CMS](http://refinerycms.com) "core" engine version 2.0.0 or later.

### Gem Installation using Bundler (The very best way)

Include the latest [gem](http://rubygems.org/gems/refinerycms-news) into your Refinery CMS application's Gemfile:

```ruby
gem "refinerycms-news", '~> 2.1.0'
```

Then type the following at command line inside your Refinery CMS application's root directory:

    bundle install
    rails generate refinery:news
    rake db:migrate
    rake db:seed

## How to display a news feed on the homepage:

Assuming you've already overridden the homepage view:

    $ rake refinery:override view=refinery/pages/home

You can render the `recent_posts` partial. However, you will need to set the recent News items manually, since this is normally handled in the News::Items controller:

```erb
<% @items = Refinery::News::Item.latest(5) %>
<%= render :partial => '/refinery/news/items/recent_posts' %>
```

## Configuring the number of items per page

To modify the number of items per page for the news items index without
affecting the archive page you must override the method in the controller that
sets `@items` for the index: `find_published_news_items`.

Currently the method body is:
```ruby
@items = Item.published.translated.page(params[:page])
```

The `page` convenience method needs to be replaced with `paginate` and
`per_page` passed as an option.  Add a decorator for the items controller with
the following contents:

```ruby
module Refinery::News
  ItemsController.class_eval do
    def find_published_news_items
      @items = Item.published.translated.paginate :page => params[:page],
                                                  :per_page => 8
    end
  end
end
```

## Customising the views

Type this command at your project root to override the default front end views:

    $ rake refinery:override view=refinery/news/items/*
    Copied view template file to app/views/refinery/news/items/_recent_posts.html.erb
    Copied view template file to app/views/refinery/news/items/index.html.erb
    Copied view template file to app/views/refinery/news/items/show.html.erb
    etc.

## RSS (Really Simple Syndication)

To get RSS for your entire site, insert this into the head section of your layout after installing:

```erb
<%= auto_discovery_link_tag(:rss, refinery.news_items_url(:format => 'rss')) %>
```

## More Information
* Check out our [Website](http://refinerycms.com/)
* Refinery Documentation is available in the [guides](http://refinerycms.com/guides)
* Questions can be asked on our [Google Group](http://group.refinerycms.org)
* Questions can also be asked in our IRC room, [#refinerycms on freenode](irc://irc.freenode.net/refinerycms)


text:
'use strict'

const tabShadowSize = '15px';
const css = `
    .hyperterm_main {
        border: none !important;
    }
    .header_header {
        overflow: hidden !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    .tabs_nav {
        background: linear-gradient(to bottom, #ececec 0%,#e2e2e2 100%) !important;
    }
    .tabs_nav .tabs_title {
        height: 34px !important;
        border-bottom: 1px solid #cacaca !important;
    }
    .tabs_nav .tabs_title, .tabs_nav .tab_tab {
        color: #333 !important;
        font-family: "Lucida Grande" !important;
        border-color: #cacaca !important;
        background: linear-gradient(to bottom, #ececec 0%,#e2e2e2 100%) !important;
    }
    .tabs_nav .tab_tab:not(.tab_active) {
        color: #888 !important;
        border-left: 1px solid #ddd !important;
    }
    .tabs_nav .tab_tab.tab_first:after, .tabs_nav .tab_tab:last-of-type:after {
        content: "" !important;
        display: block !important;
        background: linear-gradient(to bottom, #ececec 0%,#e2e2e2 100%) !important;
        width: 256px !important;
        position: absolute !important;
        top: 0 !important;
        bottom: 1px !important;
        z-index: 1 !important;
    }
    .tabs_nav .tab_tab.tab_first:after {
        left: -257px !important;
        right: auto !important;
    }
    .tabs_nav .tab_tab:last-of-type:after {
        right: -257px !important;
        left: auto !important;
    }
    .tabs_nav .tab_tab:last_of_type.tab_active:after {
        right: -256px !important;
    }
    .tabs_nav .tab_tab.tab_first:not(.tab_active):not(:hover) {
        border-left: 1px solid transparent !important;
    }
    .tabs_nav .tab_tab:not(.tab_active):hover {
        color: #333 !important;
        background: linear-gradient(to bottom, #efefef 0%,#eaeaea 100%) !important;
    }
    .tabs_nav .tabs_list .tab_active {
        background: linear-gradient(to bottom, #fff 0%,#f3f3f3 100%) !important;
    }
    .tabs_nav .tabs_list .tab_active:before {
        border-bottom-color: #f3f3f3 !important;
        border-bottom-color: #e6e6e6 !important;
    }
    .tabs_nav .tabs_list .tab_active .tab_text {
        border-right: none !important;
        border-right: 1px solid transparent !important;
        box-shadow: 0 0 ${tabShadowSize} 0 rgba(0,0,0,0.1) !important;
        z-index: 1 !important;
    }
    .tabs_nav .tabs_list .tab_icon {
        right: auto !important;
        left: 7px !important;
        z-index: 2 !important;
        color: #333 !important;
    }
    .tabs_nav .tabs_list .tab_icon:hover {
        color: #fff !important;
        padding: 4px !important;
        background-color: #aaa !important;
    }
    .tabs_nav .tabs_borderShim {
        border-color: #ccc !important;
    }
`;
exports.decorateConfig = config => {
    return Object.assign({}, config, {
        css: (config.css || '') + css
    });
}
exports.decorateBrowserOptions = defaults => {
    return Object.assign({}, defaults, {
    	titleBarStyle: '',
    	transparent: true,
    	frame: false
    });
}


text:
package Practice01;

/**
 * Created by oddie on 23/06/2017.
 */
public class sample02 {
public static void main(String []args){
    String []weatherConditions ={"sunny","rainy", "windy"};
    for(String weatherCondition : weatherConditions){
        System.out.println("various weather conditions are "+ weatherCondition);
    }
  }
}


text:
Open RESTful API Specification
______________________________

Introduction to the PMI Policy API
==================================

Please check the `FIWARE Open Specifications Legal Notice
<https://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specifications_Legal_Notice>`_
to understand the rights to use FIWARE Open Specifications.

PMI Policy API
--------------

The PMI Policy API is a RESTful, resource-oriented API accessed via
HTTP/HTTPS that uses JSON-based representations for information
interchange that provide functionalities to the Policy Manager GE. This
document describes the FIWARE-specific features extension, which allows
cloud user to extend the basic functionalities offered by Policy Manager
GE in order to cope with elasticity management.

Intended Audience
-----------------

This specification is intended for both software developers and Cloud
Providers. For the former, this document provides a full specification
of how to interoperate with Cloud Platforms that implements PMI API. For
the latter, this specification indicates the interface to be provided in
order to create policies and actions associated the facts received from
cloud resources (currently associated to servers but not only oriented
to them). To use this information, the reader should first have a
general understanding of the `Policy Manager Generic Enabler
<https://forge.fi-ware.org/plugins/mediawiki/wiki/fi-ware-private/index.php/FIWARE.ArchitectureDescription.Cloud.PolicyManager>`_
and also be familiar with:

-  RESTful web services
-  `HTTP/1.1 (RFC2616) <http://www.ietf.org/rfc/rfc2616.txt>`_
-  `JSON <http://www.ietf.org/rfc/rfc4627.txt?number=4627>`_ data
   serialization formats.

|

API Change History
------------------

This version of the PMI Policy API Guide replaces and obsoletes all
previous versions. The most recent changes are described in the table
below:

+-----------------+-------------------------------------------+
| Revision Date   | Changes Summary                           |
+=================+===========================================+
| Oct 17, 2012    | First version of the PMI Policy API.      |
+-----------------+-------------------------------------------+

|

How to Read This Document
-------------------------

In the whole document the assumption is taken that the reader is
familiarized with REST architecture style. Along the document, some
special notations are applied to differentiate some special words or
concepts. The following list summarizes these special notations.

-  A **bold**, mono-spaced font is used to represent code or logical
   entities, e.g., HTTP method (GET, PUT, POST, DELETE).
-  An *italic* font is used to represent document titles or some other
   kind of special text, e.g., *URI*.
-  The variables are represented between brackets, e.g. {id} and in
   italic font. When the reader find it, can change it by any value.

For a description of some terms used along this document, see `[1]
<https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Cloud_Hosting_Architecture>`_.

Additional Resources
--------------------

You can download the most current version of this document from the
FIWARE API specification selecting **PDF Version** from the Toolbox
menu (left side), which will generate the file to download it. For more
details about the **Policy Manager** that this API is based upon, please
refer to `FIWARE Cloud Hosting
<https://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/Cloud_Hosting>`_.

General PMI Policy API Information
==================================

Resources Summary
-----------------

A graphical diagram, including the different Uniform Resource Names
(URNs) that can be used in the API, is shown here. The URL is
http://{serverRoot}:{serverPort}.

.. raw:: html

.. figure:: resources/Policy_Manager_open_specification_diagram_v1.png
   :alt: Policy_Manager_open_specification_diagram_v1.png

   Policy\_Manager\_open\_specification\_diagram\_v1.png

.. raw:: html

|

.. raw:: html

**Policy Manager Open RESTful API resource summary**

.. raw:: html

Authentication
--------------

Each HTTP request against the **PMI** requires the inclusion of
specific authentication credentials. The specific implementation of this
API supports OAuth v2.0 authentication schemes and will be determined by
the specific provider that implements this GE and Interface. Please
contact with it to determine the best way to authenticate against this
API. Remember that some authentication schemes may require that the API
operate using SSL over HTTP (HTTPS).

Representation Format
---------------------

The PMI Policy API resources are represented by hypertext that allows
each resource to reference other related resources. More concisely, JSON
format are used for resource representation and URLs are used for
referencing other resources by default. The request format is specified
using the Content-Type header and is required for operations that have a
request body. The response format can be specified in requests using
either the Accept header with values application/json or adding a .json
extension to the request URI. In the following examples we can see the
different options in order to represent format.

+-------------------------------------------------------------------------------------------------+
| POST /v1.0/d3fdddc6324c439780a6fd963a9fa148/servers/15520fa6dc914f97bd1e54f8e1444d41 HTTP/1.1   |
+-------------------------------------------------------------------------------------------------+
| Host: servers.api.openstack.org                                                                 |
+-------------------------------------------------------------------------------------------------+
| Content-Type: application/json                                                                  |
+-------------------------------------------------------------------------------------------------+
| Accept: application/json                                                                        |
+-------------------------------------------------------------------------------------------------+
| X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb                                              |
+-------------------------------------------------------------------------------------------------+

+------------------------------------------------------------------------------------------------------+
| POST /v1.0/d3fdddc6324c439780a6fd963a9fa148/servers/15520fa6dc914f97bd1e54f8e1444d41.json HTTP/1.1   |
+------------------------------------------------------------------------------------------------------+
| Host: servers.api.openstack.org                                                                      |
+------------------------------------------------------------------------------------------------------+
| Content-Type: application/json                                                                       |
+------------------------------------------------------------------------------------------------------+
| X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb                                                   |
+------------------------------------------------------------------------------------------------------+

Representation Transport
------------------------

Resource representation is transmitted between client and server by
using HTTP 1.1 protocol, as defined by IETF RFC-2616. Each time an HTTP
request contains payload, a Content-Type header shall be used to specify
the MIME type of wrapped representation. In addition, both client and
server may use as many HTTP headers as they consider necessary.

Resource Identification
-----------------------

API consumer must indicate the resource identifier while invoking a GET,
PUT, POST or DELETE operation. PMI Policy API combines both
identification and location by terms of URL. Each invocation provides
the URL of the target resource along the verb and any required input
data. That URL is used to identify unambiguously the resource. For HTTP
transport, this is made using the mechanisms described by HTTP protocol
specification as defined by IETF RFC-2616.

PMI Policy API does not enforce any determined URL pattern to identify
its resources. Anyway the SM Policy API follows the HATEOAS principle
(Hypermedia As The Engine Of Application State). This means that
resource representation contains the URLs of the related resources
(e.g., book representation contains hyperlinks to its chapters; chapter
representation contains hyperlinks to its pages...). API consumer
obtains the server representation as its following point, which in turn
provides hyperlinks that directly or indirectly take to other resources
like scalability rules.

Some PMI Policy API entities provide an instance identifier property
(instance ID). This property is used to identify unambiguously the
entity but not the REST resource used to manage it, which is identified
by its URL as described above. It is common that most implementations
make use of instance ID to compose the URL (e.g., the book with instance
ID 1492 could be represented by resource http://.../book/1492), but such
an assumption should not be taken by API consumer to obtain the resource
URL from its instance ID.

Links and References
--------------------

Resources often lead to refer to other resources. In those cases, we
have to provide an ID or an URL to a remote resource. see `OpenStack
Compute Developer Guide
<http://docs.openstack.org/api/openstack-compute/2/content/LinksReferences.html>`_
on their application to infrastructural resources.

Limits
------

n.a.

Rate Limits
~~~~~~~~~~~

n.a.

Absolute Limits
~~~~~~~~~~~~~~~

n.a.

Determining Limits Programmatically
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

n.a.

Versions
--------

This section shows the version of this API. You can see the historical
change of the API at the beginning of this document. Currently, the
version of this API is the 1.0.

Extensions
----------

n.a.

Faults
------

n.a.

API Operations
==============

In this section we go in depth for each operation. These operations were
described in the `Policy Manager Architectural description
<https://forge.fi-ware.org/plugins/mediawiki/wiki/fi-ware-private/index.php/FIWARE.ArchitectureDescription.Cloud.PolicyManager>`_.
The FI-WARE programmer guide will also provide examples of how to use
this API. The specify operations of this extensions are related to the
management of scalability rules.

General Operations
------------------

This section has the general operations related to this service.

Get the information of the API
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+----------------+-------------------------------------------+
| **Verb**   | **URI**        | **Description**                           |
+============+================+===========================================+
| GET        | /{tenantId}/   | Get information about this current API.   |
+------------+----------------+-------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation does not require a request body and lists the information
of the current version of the API. The following examples show a JSON
response for the API operation:

Response:

::

     {
         "owner": "TELEFONICA I+D",
         "windowsize": <windows_size>,
         "version": "<API_version>",
         "runningfrom": "<last_launch_date>
         "doc": "<URL_DOCUMENTATION>"
     }

The descriptions of the returned values are the following:

-  **owner** is the key whose value is the company name that develops
   this API. Its value is fixed to "Telefonica I+D".
-  **windowsize** is the key that represents the window size () to
   stabilize the values of the measures probes to checking rules and
   taking actions. This value is very important due to allow resolving
   false positives that could launch the action to scaling up and down a
   server.
-  **version** is the key whose value is the version () of the API
   currently in execution.
-  **runningfrom** is the key whose value is the date of the last launch
   () of the service. This value takes the ISO 8601 an example of this
   value 2013-10-04 20:32:17.
-  **doc** is the key whose value is the link to this API specification.

Update the window size
~~~~~~~~~~~~~~~~~~~~~~

+------------+----------------+------------------------------------------+
| **Verb**   | **URI**        | **Description**                          |
+============+================+==========================================+
| PUT        | /{tenantId}/   | Update the window size of the service.   |
+------------+----------------+------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This call updates the window size of the service in order to change the
stabilization window size to be applied to the monitoring data received
from the Monitoring GE. The request is in JSON format and the response
has no body.

Request:

::

     {
         "windowsize": <windows_size>
     }

Where **windowsize** is the key whose value is the size of the windows
to stabilized the values of the measures probes to checking rules and
taking actions. This value is very important due to allow resolving
false values that could launch the action to scaling up and down a
server.

Response:

::

     {
         "windowsize": <windows_size>
     }

Servers
-------

This section has the operations related to the subscription to the
platform together with the rules associated to the servers to be
analyzed by the rules engine.

Get the list of all servers' rules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+-----------------------+-----------------------------------------------------------+
| **Verb**   | **URI**               | **Description**                                           |
+============+=======================+===========================================================+
| GET        | /{tenantId}/servers   | Get the list of all servers registered in the platform.   |
+------------+-----------------------+-----------------------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

Returns a list of servers with their rules. There is no body in the
request and the response is the following one:

Response:

::

     {
         "servers": [
              {
                  "serverId": "<serverId>",
                  "rules": [
                     {
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     },
                     {
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     }
                  ]
              },
              {
                  "serverId": "<serverId>",
                  "rules": [
                     {
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     },
                     {
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     }
                  ]
              }
          ]
     }

The values that you receive are the following:

-  **serverId** is the key whose value specifies the server ID in the
   URI, following the OpenStack ID format. An example of it is the id
   52415800-8b69-11e0-9b19-734f6af67565.
-  **condition** is the key whose value is the description of the
   scalability rule associated to this server. It could be one or more
   than one. You can find an example condition at the end of this document.
-  **action** is the key whose value represents the action to take over
   the server. Its values are up and down.
-  **ruleId** is the key that represents the id of the rule, following
   the OpenStack Id format (e.g. 52415800-8b69-11e0-9b19-734f6f006e54).

Get the list of all rules of a server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+--------------------------------------+----------------------------------------------+
| **Verb**   | **URI**                              | **Description**                              |
+============+======================================+==============================================+
| GET        | /*{tenantId}*/servers/*{serverId}*   | Get all rules related to specified server.   |
+------------+--------------------------------------+----------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation returns the list of elasticity rules associated with a
server identified with its *{serverId}*. This operation does not require
a body and the response is in JSON format.

Response:

::

     {
          "serverId": "<serverId>",
          "rules": [
                     {
                          "name": <NAME>,
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     },
                     {
                          "name": <NAME>,
                          "condition": <CONDITION_DESCRIPTION>,
                          "action": <ACTION_ON_SERVER>,
                          "ruleId": "<RULE_ID>"
                     }
          ]
     }

The values that you receive are the following:

-  **serverId** is the key whose value specifies the server ID in the
   URI, following the OpenStack ID format. An example of it is the id
   52415800-8b69-11e0-9b19-734f6af67565.
-  **condition** is the key whose value is the description of the
   scalability rule associated to this server. It could be one or more
   than one and the format of this rule is the following:
-  **action** is the key whose value represents the action to take over
   the server. Its values are up and down.
-  **ruleId** is the key that represents the id of the rule, following
   the OpenStack Id format (e.g. 52415800-8b69-11e0-9b19-734f6f006e54).

Update the context of a server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+--------------------------------------+----------------------------------------+
| **Verb**   | **URI**                              | **Description**                        |
+============+======================================+========================================+
| POST       | /*{tenantId}*/servers/*{serverId}*   | Update Context of a specific server.   |
+------------+--------------------------------------+----------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation updates the context related to a specific server,
identified with its *serverId*. The context information contains the
description of the CPU, Memory, Disk and/or Network usages. This message
follows the `NGSI-10 information model
<http://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/NGSI-9/NGSI-10_information_model>`_
but using JSON format and the response has no body.

Request:

::

    {
        "subscriptionId": "<SubscriptionId>",
        "originator": "http://localhost/test",
        "contextResponses": [
            {
                "contextElement": {
                    "type": "Server",
                    "isPattern": "false",
                    "id": "<ServerId>",
                    "attributes": [
                        {
                            "name": "CPU",
                            "type": "Probe",
                            "value": "0.75",
                        },
                        {
                            "name": "Memory",
                            "type": "Probe",
                            "value": "0.83",
                        },
                        {
                            "name": "Disk",
                            "type": "Probe",
                            "value": "0.83",
                        },
                        {
                            "name": "Network",
                            "type": "Probe",
                            "value": "0.83",
                        }
                    ],
                },
                "statusCode": {
                    "code": "200",
                    "reasonPhrase": "Ok",
                    "details": "a message"
                }
            }
        ]
    }

The values that you receive are the following:

-  **SubscriptionId**, is the identifier of a subscription process
   following the id schemas of OpenStack.
-  **type**, is the element type, in our case, it is always "Server".
-  **isPattern**, is used to define some type of pattern in order to
   search the information in the list of attributes. In our case, this
   attribute is not used and is always fixed to "false".
-  **id**, is the id of a server, the same id of ServerId of OpenStack.
-  **attributes**, this is a list of attributes:

   -  **type** is the type of attribute, for our case, this key has
      always the value "Probe".
   -  **value**, is the value of the attribute expressed in percentage.
   -  **name** is the name of the attribute. In our case, this key takes
      one of the following values:

      -  **CPU**, amount of used CPU of a server.
      -  **Memory**, amount of used Memory of the same server.
      -  **Disk**, amount of used disk (HDD) of the same server.
      -  **Network**, amount of used network interface of the same
         server.

-  **statusCode**, in NGSI-10 this key shows the information that the
   system should return when it receives this message. Currently, our
   implementation does not take into consideration this information but
   have to be defined following the standard. Its values are always the
   same in that case how you can see in the previous example.

Elasticity rules
----------------

Create a new elasticity rule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+----------------------------------------+-----------------------------------------------+
| **Verb**   | **URI**                                | **Description**                               |
+============+========================================+===============================================+
| POST       | /{tenantId}/servers/{serverId}/rules   | Create a new rule associated to the server.   |
+------------+----------------------------------------+-----------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation creates a new elasticity rules associated to a server,
which is identified by {serverId}. The request specifies the rule to be
activated and the action associated to it (increase or decrease the
number of servers). The response returns a 200 Ok message together with
the id of the new rule created.

Request:

::

     {
        "name": <NAME>,
        "condition": <CONDITION_DESCRIPTION>,
        "action": <ACTION_ON_SERVER>
     }

The values that you receive are the following:

-  **name** is the key whose value represents the name of the rule.
-  **condition** is the key whose value is the description of the
   scalability rule associated to this server. It could be one or more
   than one and the format of this rule is the following:
-  **action** is the key whose value represents the action to take over
   the server. Its values are up and down.

Response:

::

     {
        "serverId": <serverId>,
        "ruleId": <RULE_ID>
     }

The values that you receive are the following:

-  **serverId** is the key whose value specifies the server ID in the
   URI, following the OpenStack ID format. An example of it is the id
   52415800-8b69-11e0-9b19-734f6af67565.
-  **ruleId** is the key that represents the id of the rule, following
   the OpenStack Id format (e.g. 52415800-8b69-11e0-9b19-734f6f006e54).

Update an elasticity rule
~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+-------------------------------------------------+------------------------------+
| **Verb**   | **URI**                                         | **Description**              |
+============+=================================================+==============================+
| PUT        | /{tenantId}/servers/{serverId}/rules/{ruleId}   | Update an elasticity rule.   |
+------------+-------------------------------------------------+------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation allows to update the rule condition, the action or both
or a specific server identified by its {serverId} and a specific rule
identified by its {ruleId}. This operation requires a request context
and the response has no body on it.

Request:

::

     {
        "name": <NAME>,
        "condition": <CONDITION_DESCRIPTION>,
        "action": <ACTION_ON_SERVER>
     }

Where:

-  **name** is the key whose value represents the name of the rule.
-  **condition** is the key whose value is the description of the
   scalability rule associated to this server. It could be one or more
   than one and the format of this rule is the following:
-  **action** is the key whose value represents the action to take over
   the server. Its values are up and down.

Response:

::

     {
        "name": <NAME>,
        "condition": <CONDITION_DESCRIPTION>,
        "action": <ACTION_ON_SERVER>
     }

Delete an elasticity rule
~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+-------------------------------------------------+------------------------------+
| **Verb**   | **URI**                                         | **Description**              |
+============+=================================================+==============================+
| DELETE     | /{tenantId}/servers/{serverId}/rules/{ruleId}   | Delete an elasticity rule.   |
+------------+-------------------------------------------------+------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation deletes a specific rule, identified by its {ruleId},
within a server, identified by its {serverId}. This operation does not
require a request body and response body. The response is a 200 Ok if it
was deleted without any problem or error message in other case.

Get an elasticity rule
~~~~~~~~~~~~~~~~~~~~~~

+------------+-------------------------------------------------+---------------------------+
| **Verb**   | **URI**                                         | **Description**           |
+============+=================================================+===========================+
| GET        | /{tenantId}/servers/{serverId}/rules/{ruleId}   | Get an elasticity rule.   |
+------------+-------------------------------------------------+---------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation gets a specific rule, identified by its {ruleId}, within
a server, identified by its {serverId}. This operation does not require
a request body and response body is in JSON format.

Response:

::

     {
        "name": <NAME>,
        "condition": <CONDITION_DESCRIPTION>,
        "action": <ACTION_ON_SERVER>,
        "ruleId": "<RULE_ID>"
     }

Where:

-  **name** is the key whose value represents the name of the rule.
-  **condition** is the key whose value is the description of the
   scalability rule associated to this server. It could be one or more
   than one and the format of this rule is the following:
-  **action** is the key whose value represents the action to take over
   the server. Its values are up and down.
-  **ruleId** is the key that represents the id of the rule, following
   the OpenStack Id format (e.g. 52415800-8b69-11e0-9b19-734f6f006e54).

Subscription to rules
---------------------

Create a new subscription
~~~~~~~~~~~~~~~~~~~~~~~~~

+------------+------------------------------------------------+---------------------------------------------+
| **Verb**   | **URI**                                        | **Description**                             |
+============+================================================+=============================================+
| POST       | /{tenantId}/servers/{serverId}/subscription/   | Create a new subscription for the server.   |
+------------+------------------------------------------------+---------------------------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation creates a new subcription rules associated to a rule,
which is identified by {ruleId}. The request specifies the rule to be
activated and the action associated to it (increase or decrease the
number of servers). The response returns a 200 Ok message together with
the id of the new subscription created.

Request:

::

     {
        "ruleId": <RULE_ID>,
        "url": <URL_TO_NOTIFY>,
     }

The values that you receive are the following:

-  **ruleId** is the key whose value identifies the rule associated to
   this server.
-  **url** is the key whose value is the url to notify the action when
   the rule is fired.

Response:

::

     {
        "subscriptionId": <SUBSCRIPTION_ID>
     }

The values that you receive are the following:

-  **subscriptionId** is the key that represents the id of the
   subscription, following the OpenStack Id format (e.g.
   52415800-8b69-11e0-9b19-734f6f006e54).

Delete a subscription
~~~~~~~~~~~~~~~~~~~~~

+------------+----------------------------------------------------------------+--------------------------+
| **Verb**   | **URI**                                                        | **Description**          |
+============+================================================================+==========================+
| DELETE     | /{tenantId}/servers/{serverId}/subscription/{subscriptionId}   | Delete a subscription.   |
+------------+----------------------------------------------------------------+--------------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation deletes a subscription, identified by its
{subscriptionId}, within a server, identified by its {serverId}. This
operation does not require a request body and response body. The
response is a 200 Ok if it was deleted without any problem or error
message in other case.

Get a subscription
~~~~~~~~~~~~~~~~~~

+------------+---------------------------------------------------------------+-----------------------+
| **Verb**   | **URI**                                                       | **Description**       |
+============+===============================================================+=======================+
| GET        | /{tenantId}/servers/{serverId}/subscription/subscriptionId}   | Get a subscription.   |
+------------+---------------------------------------------------------------+-----------------------+

Normal Response Code(s): 200 (Ok)

Error Response Code(s): identityFault (400, 500, …), badRequest (400),
unauthorized (401), forbidden (403), badMethod (405), serviceUnavailable (503)

This operation gets a subscription, identified by its {subscriptionId},
within a server, identified by its {serverId}. This operation does not
require a request body and response body is in JSON format.

Response:

::

     {
        "subscriptionId": <SUBSCRIPTION_ID>,
        "url": <URL_TO_NOTIFY>,
        "serverId": <SERVER_ID>,
        "ruleId": "<RULE_ID>"
     }

Where:

-  **subscriptionId** is the key that represents the id of the
   subscription, following the OpenStack Id format (e.g.
   52415800-8b69-11e0-9b19-734f6f006e54).
-  **url** is the key whose value is the url to notify the action when
   the rule is fired.
-  **serverId** is the key whose value specifies the server ID in the
   URI, following the OpenStack ID format. An example of it is the id
   52415800-8b69-11e0-9b19-734f6af67565.
-  **ruleId** is the key that represents the id of the rule, following
   the OpenStack Id format (e.g. 52415800-8b69-11e0-9b19-734f6f006e54).

Elasticity Rules
================

In this section we explain how it is represented an elasticity rule.

Rules Engine
------------

Rules are described using JSON, and contain information about CPU and
Memory, Disk and Network usage, in first instance.

Conditions
----------

Conditions are represented as JSON format as a compound of attributes
 representing server measures with a value and an operator.

Attributes are:
 -  cpu
 -  mem
 -  hdd
 -  net

Supported operators are:
 - greater
 - greater equal
 - less
 - less equal

::

    "condition": {
               "cpu": {
                      "value": 98.3,
                      "operand": "greater"
               },
               "mem": {
                      "value": 95,
                      "operand": "greater equal"
               },
               "hdd": {
                      "value": 95,
                      "operand": "greater equal"
               },
               "net": {
                      "value": 95,
                      "operand": "greater equal"
               }
       }

Actions
-------

There are two types of actions:

- notify-scale: with two different options

 -  scaleUp

::

        "action": {
              "actionName": "notify-scale",
              "operation": "scaleUp"
        },

|

 -  scaleDown

::

        "action": {
              "actionName": "notify-scale",
              "operation": "scaleDown"
        },

These actions send a meessage with the following format:

::

    {"action": <ACTION_NAME>,
     "serverId": <SERVER_ID>}

Where:

-  **ACTION_NAME** is the name of the action (scaleUp or Scale Down).
-  **SERVER_ID** is the key whose value specifies the server ID that fulfills
   the condition, following the OpenStack ID format. An example of it is the
   id 52415800-8b69-11e0-9b19-734f6af67565.

- notify-email

::

    "action": {
          "actionName": "notify-email",
          "email": "name@host.com",
          "body": "Example body"
    },

This action send a meessage with the following format:
::

    {"action": "notify-email",
     "serverId": <SERVER_ID>,
     "email": <EMAIL>,
     "description": <DESCRIPTION>}

Where:

-  **SERVER_ID** is the key whose value specifies the server ID that fulfills
   the contidion, following the OpenStack ID format. An example of it is the
   id 52415800-8b69-11e0-9b19-734f6af67565.
-  **EMAIL** is the email address where the message should be sent.
-  **DESCRIPTION** is the body of the email which contains the detail that the
   creator of the rule wanted to inform.

Example Rule
------------

The rule is compound of three parts, name, conditions and actions. In
this case, the name will be "AlertCPU"

Every fact is like "(server (server-id 12345-abcd)(cpu 50)(mem 33)(hdd 66)(net 66))"

In this case, the condition defined expects all server with cpu usage
more than 98.3, memory usage 95, hdd space used 95 and network usage 95.

Actions will create an HTTP POST notification to an url specified on
every subscription to this rule. In this case the notification will be
that server should be scaled up because CPU usage is greater than limit.

This is the rule as is expected to:

::

    {
        "action": {
              "actionName": "notify-scale",
              "operation": "scaleUp"
        },
        "name": "AlertCPU",
        "condition": {
               "cpu": {
                      "value": 98.3,
                      "operand": "greater"
               },
               "mem": {
                      "value": 95,
                      "operand": "greater equal"
               },
               "hdd": {
                      "value": 95,
                      "operand": "greater equal"
               },
               "net": {
                      "value": 95,
                      "operand": "greater equal"
               }
       }
    }


text:
perl Cookbook CHANGELOG
=======================
This file is used to list changes made in each version of the perl cookbook.

v1.2.0
------
### Improvement
- **[COOK-3230](https://tickets.opscode.com/browse/COOK-3230)** - Upgrade cpanm
- **[COOK-2998](https://tickets.opscode.com/browse/COOK-2998)** - Improve install speed by using `--notest`

v1.1.2
------
### Bug
- [COOK-2973]: perl cookbook has foodcritic errors

v1.1.0
------
- [COOK-1765] - Install Strawberry Perl on Windows in Perl Cookbook

v1.0.2
------
- [COOK-1300] - add support for Mac OS X

v1.0.0
------
- [COOK-1129] - move lists of perl packages to attributes by platform
- [COOK-1279] - resolve regression from COOK-1129
- [COOK-1299] - use App::cpanminus (cpanm) to install "cpan packages"

v0.10.2
------
- [COOK-1279] Re-factor recipe and fix platform_version 5 bug for redhat family platforms

v0.10.1
------
- [COOK-1129] centos/redhat needs the CPAN RPM installed

v0.10.0
------
- Current released version


text:
package javax.swing;

import java.awt.*;
import java.beans.ConstructorProperties;
import java.io.Serializable;
import java.io.PrintStream;

/**
 * A layout manager that allows multiple components to be laid out either
 * vertically or horizontally. The components will not wrap so, for
 * example, a vertical arrangement of components will stay vertically
 * arranged when the frame is resized.
 *

 *

 *
 *

 *
 *

 *

 *

 * Nesting multiple panels with different combinations of horizontal and
 * vertical gives an effect similar to GridBagLayout, without the
 * complexity. The diagram shows two panels arranged horizontally, each
 * of which contains 3 components arranged vertically.
 *
 *
 The BoxLayout manager is constructed with an axis parameter that
 * specifies the type of layout that will be done. There are four choices:
 *
 *
<tt>X_AXIS</tt> - Components are laid out horizontally
 * from left to right.

 *
 *
<tt>Y_AXIS</tt> - Components are laid out vertically
 * from top to bottom.

 *
 *
<tt>LINE_AXIS</tt> - Components are laid out the way
 * words are laid out in a line, based on the container's
 * <tt>ComponentOrientation</tt> property. If the container's
 * <tt>ComponentOrientation</tt> is horizontal then components are laid out
 * horizontally, otherwise they are laid out vertically.  For horizontal
 * orientations, if the container's <tt>ComponentOrientation</tt> is left to
 * right then components are laid out left to right, otherwise they are laid
 * out right to left. For vertical orientations components are always laid out
 * from top to bottom.

 *
 *
<tt>PAGE_AXIS</tt> - Components are laid out the way
 * text lines are laid out on a page, based on the container's
 * <tt>ComponentOrientation</tt> property. If the container's
 * <tt>ComponentOrientation</tt> is horizontal then components are laid out
 * vertically, otherwise they are laid out horizontally.  For horizontal
 * orientations, if the container's <tt>ComponentOrientation</tt> is left to
 * right then components are laid out left to right, otherwise they are laid
 * out right to left.  For vertical orientations components are always
 * laid out from top to bottom.

 *

 * For all directions, components are arranged in the same order as they were
 * added to the container.
 *

 * BoxLayout attempts to arrange components
 * at their preferred widths (for horizontal layout)
 * or heights (for vertical layout).
 * For a horizontal layout,
 * if not all the components are the same height,
 * BoxLayout attempts to make all the components
 * as high as the highest component.
 * If that's not possible for a particular component,
 * then BoxLayout aligns that component vertically,
 * according to the component's Y alignment.
 * By default, a component has a Y alignment of 0.5,
 * which means that the vertical center of the component
 * should have the same Y coordinate as
 * the vertical centers of other components with 0.5 Y alignment.
 *

 * Similarly, for a vertical layout,
 * BoxLayout attempts to make all components in the column
 * as wide as the widest component.
 * If that fails, it aligns them horizontally
 * according to their X alignments.  For PAGE_AXIS layout,
 * horizontal alignment is done based on the leading edge of the component.
 * In other words, an X alignment value of 0.0 means the left edge of a
 * component if the container's ComponentOrientation is left to
 * right and it means the right edge of the component otherwise.
 *

 * Instead of using BoxLayout directly, many programs use the Box class.
 * The Box class is a lightweight container that uses a BoxLayout.
 * It also provides handy methods to help you use BoxLayout well.
 * Adding components to multiple nested boxes is a powerful way to get
 * the arrangement you want.
 *

 * For further information and examples see
 * How to Use BoxLayout,
 * a section in The Java Tutorial.
 *

 * Warning:
 * Serialized objects of this class will not be compatible with
 * future Swing releases. The current serialization support is
 * appropriate for short term storage or RMI between applications running
 * the same version of Swing.  As of 1.4, support for long term storage
 * of all JavaBeansTM
 * has been added to the java.beans package.
 * Please see {@link java.beans.XMLEncoder}.
 *
 * @see Box
 * @see java.awt.ComponentOrientation
 * @see JComponent#getAlignmentX
 * @see JComponent#getAlignmentY
 *
 * @author   Timothy Prinzing
 */
public class BoxLayout implements LayoutManager2, Serializable {

    /**
     * Specifies that components should be laid out left to right.
     */
    public static final int X_AXIS = 0;

    /**
     * Specifies that components should be laid out top to bottom.
     */
    public static final int Y_AXIS = 1;

    /**
     * Specifies that components should be laid out in the direction of
     * a line of text as determined by the target container's
     * ComponentOrientation property.
     */
    public static final int LINE_AXIS = 2;

    /**
     * Specifies that components should be laid out in the direction that
     * lines flow across a page as determined by the target container's
     * ComponentOrientation property.
     */
    public static final int PAGE_AXIS = 3;

    /**
     * Creates a layout manager that will lay out components along the
     * given axis.
     *
     * @param target  the container that needs to be laid out
     * @param axis  the axis to lay out components along. Can be one of:
     *              BoxLayout.X_AXIS,
     *              BoxLayout.Y_AXIS,
     *              BoxLayout.LINE_AXIS or
     *              BoxLayout.PAGE_AXIS
     *
     * @exception AWTError  if the value of axis is invalid
     */
    @ConstructorProperties({"target", "axis"})
    public BoxLayout(Container target, int axis) {
        if (axis != X_AXIS && axis != Y_AXIS &&
            axis != LINE_AXIS && axis != PAGE_AXIS) {
            throw new AWTError("Invalid axis");
        }
        this.axis = axis;
        this.target = target;
    }

    /**
     * Constructs a BoxLayout that
     * produces debugging messages.
     *
     * @param target  the container that needs to be laid out
     * @param axis  the axis to lay out components along. Can be one of:
     *              BoxLayout.X_AXIS,
     *              BoxLayout.Y_AXIS,
     *              BoxLayout.LINE_AXIS or
     *              BoxLayout.PAGE_AXIS
     *
     * @param dbg  the stream to which debugging messages should be sent,
     *   null if none
     */
    BoxLayout(Container target, int axis, PrintStream dbg) {
        this(target, axis);
        this.dbg = dbg;
    }

    /**
     * Returns the container that uses this layout manager.
     *
     * @return the container that uses this layout manager
     *
     * @since 1.6
     */
    public final Container getTarget() {
        return this.target;
    }

    /**
     * Returns the axis that was used to lay out components.
     * Returns one of:
     * BoxLayout.X_AXIS,
     * BoxLayout.Y_AXIS,
     * BoxLayout.LINE_AXIS or
     * BoxLayout.PAGE_AXIS
     *
     * @return the axis that was used to lay out components
     *
     * @since 1.6
     */
    public final int getAxis() {
        return this.axis;
    }

    /**
     * Indicates that a child has changed its layout related information,
     * and thus any cached calculations should be flushed.
     *

     * This method is called by AWT when the invalidate method is called
     * on the Container.  Since the invalidate method may be called
     * asynchronously to the event thread, this method may be called
     * asynchronously.
     *
     * @param target  the affected container
     *
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     */
    public synchronized void invalidateLayout(Container target) {
        checkContainer(target);
        xChildren = null;
        yChildren = null;
        xTotal = null;
        yTotal = null;
    }

    /**
     * Not used by this class.
     *
     * @param name the name of the component
     * @param comp the component
     */
    public void addLayoutComponent(String name, Component comp) {
        invalidateLayout(comp.getParent());
    }

    /**
     * Not used by this class.
     *
     * @param comp the component
     */
    public void removeLayoutComponent(Component comp) {
        invalidateLayout(comp.getParent());
    }

    /**
     * Not used by this class.
     *
     * @param comp the component
     * @param constraints constraints
     */
    public void addLayoutComponent(Component comp, Object constraints) {
        invalidateLayout(comp.getParent());
    }

    /**
     * Returns the preferred dimensions for this layout, given the components
     * in the specified target container.
     *
     * @param target  the container that needs to be laid out
     * @return the dimensions >= 0 && <= Integer.MAX_VALUE
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     * @see Container
     * @see #minimumLayoutSize
     * @see #maximumLayoutSize
     */
    public Dimension preferredLayoutSize(Container target) {
        Dimension size;
        synchronized(this) {
            checkContainer(target);
            checkRequests();
            size = new Dimension(xTotal.preferred, yTotal.preferred);
        }

        Insets insets = target.getInsets();
        size.width = (int) Math.min((long) size.width + (long) insets.left + (long) insets.right, Integer.MAX_VALUE);
        size.height = (int) Math.min((long) size.height + (long) insets.top + (long) insets.bottom, Integer.MAX_VALUE);
        return size;
    }

    /**
     * Returns the minimum dimensions needed to lay out the components
     * contained in the specified target container.
     *
     * @param target  the container that needs to be laid out
     * @return the dimensions >= 0 && <= Integer.MAX_VALUE
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     * @see #preferredLayoutSize
     * @see #maximumLayoutSize
     */
    public Dimension minimumLayoutSize(Container target) {
        Dimension size;
        synchronized(this) {
            checkContainer(target);
            checkRequests();
            size = new Dimension(xTotal.minimum, yTotal.minimum);
        }

        Insets insets = target.getInsets();
        size.width = (int) Math.min((long) size.width + (long) insets.left + (long) insets.right, Integer.MAX_VALUE);
        size.height = (int) Math.min((long) size.height + (long) insets.top + (long) insets.bottom, Integer.MAX_VALUE);
        return size;
    }

    /**
     * Returns the maximum dimensions the target container can use
     * to lay out the components it contains.
     *
     * @param target  the container that needs to be laid out
     * @return the dimenions >= 0 && <= Integer.MAX_VALUE
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     * @see #preferredLayoutSize
     * @see #minimumLayoutSize
     */
    public Dimension maximumLayoutSize(Container target) {
        Dimension size;
        synchronized(this) {
            checkContainer(target);
            checkRequests();
            size = new Dimension(xTotal.maximum, yTotal.maximum);
        }

        Insets insets = target.getInsets();
        size.width = (int) Math.min((long) size.width + (long) insets.left + (long) insets.right, Integer.MAX_VALUE);
        size.height = (int) Math.min((long) size.height + (long) insets.top + (long) insets.bottom, Integer.MAX_VALUE);
        return size;
    }

    /**
     * Returns the alignment along the X axis for the container.
     * If the box is horizontal, the default
     * alignment will be returned. Otherwise, the alignment needed
     * to place the children along the X axis will be returned.
     *
     * @param target  the container
     * @return the alignment >= 0.0f && <= 1.0f
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     */
    public synchronized float getLayoutAlignmentX(Container target) {
        checkContainer(target);
        checkRequests();
        return xTotal.alignment;
    }

    /**
     * Returns the alignment along the Y axis for the container.
     * If the box is vertical, the default
     * alignment will be returned. Otherwise, the alignment needed
     * to place the children along the Y axis will be returned.
     *
     * @param target  the container
     * @return the alignment >= 0.0f && <= 1.0f
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     */
    public synchronized float getLayoutAlignmentY(Container target) {
        checkContainer(target);
        checkRequests();
        return yTotal.alignment;
    }

    /**
     * Called by the AWT  when the specified container
     * needs to be laid out.
     *
     * @param target  the container to lay out
     *
     * @exception AWTError  if the target isn't the container specified to the
     *                      BoxLayout constructor
     */
    public void layoutContainer(Container target) {
        checkContainer(target);
        int nChildren = target.getComponentCount();
        int[] xOffsets = new int[nChildren];
        int[] xSpans = new int[nChildren];
        int[] yOffsets = new int[nChildren];
        int[] ySpans = new int[nChildren];

        Dimension alloc = target.getSize();
        Insets in = target.getInsets();
        alloc.width -= in.left + in.right;
        alloc.height -= in.top + in.bottom;

        // Resolve axis to an absolute value (either X_AXIS or Y_AXIS)
        ComponentOrientation o = target.getComponentOrientation();
        int absoluteAxis = resolveAxis( axis, o );
        boolean ltr = (absoluteAxis != axis) ? o.isLeftToRight() : true;

        // determine the child placements
        synchronized(this) {
            checkRequests();

            if (absoluteAxis == X_AXIS) {
                SizeRequirements.calculateTiledPositions(alloc.width, xTotal,
                                                         xChildren, xOffsets,
                                                         xSpans, ltr);
                SizeRequirements.calculateAlignedPositions(alloc.height, yTotal,
                                                           yChildren, yOffsets,
                                                           ySpans);
            } else {
                SizeRequirements.calculateAlignedPositions(alloc.width, xTotal,
                                                           xChildren, xOffsets,
                                                           xSpans, ltr);
                SizeRequirements.calculateTiledPositions(alloc.height, yTotal,
                                                         yChildren, yOffsets,
                                                         ySpans);
            }
        }

        // flush changes to the container
        for (int i = 0; i < nChildren; i++) {
            Component c = target.getComponent(i);
            c.setBounds((int) Math.min((long) in.left + (long) xOffsets[i], Integer.MAX_VALUE),
                        (int) Math.min((long) in.top + (long) yOffsets[i], Integer.MAX_VALUE),
                        xSpans[i], ySpans[i]);

        }
        if (dbg != null) {
            for (int i = 0; i < nChildren; i++) {
                Component c = target.getComponent(i);
                dbg.println(c.toString());
                dbg.println("X: " + xChildren[i]);
                dbg.println("Y: " + yChildren[i]);
            }
        }

    }

    void checkContainer(Container target) {
        if (this.target != target) {
            throw new AWTError("BoxLayout can't be shared");
        }
    }

    void checkRequests() {
        if (xChildren == null || yChildren == null) {
            // The requests have been invalidated... recalculate
            // the request information.
            int n = target.getComponentCount();
            xChildren = new SizeRequirements[n];
            yChildren = new SizeRequirements[n];
            for (int i = 0; i < n; i++) {
                Component c = target.getComponent(i);
                if (!c.isVisible()) {
                    xChildren[i] = new SizeRequirements(0,0,0, c.getAlignmentX());
                    yChildren[i] = new SizeRequirements(0,0,0, c.getAlignmentY());
                    continue;
                }
                Dimension min = c.getMinimumSize();
                Dimension typ = c.getPreferredSize();
                Dimension max = c.getMaximumSize();
                xChildren[i] = new SizeRequirements(min.width, typ.width,
                                                    max.width,
                                                    c.getAlignmentX());
                yChildren[i] = new SizeRequirements(min.height, typ.height,
                                                    max.height,
                                                    c.getAlignmentY());
            }

            // Resolve axis to an absolute value (either X_AXIS or Y_AXIS)
            int absoluteAxis = resolveAxis(axis,target.getComponentOrientation());

            if (absoluteAxis == X_AXIS) {
                xTotal = SizeRequirements.getTiledSizeRequirements(xChildren);
                yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
            } else {
                xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
                yTotal = SizeRequirements.getTiledSizeRequirements(yChildren);
            }
        }
    }

    /**
     * Given one of the 4 axis values, resolve it to an absolute axis.
     * The relative axis values, PAGE_AXIS and LINE_AXIS are converted
     * to their absolute couterpart given the target's ComponentOrientation
     * value.  The absolute axes, X_AXIS and Y_AXIS are returned unmodified.
     *
     * @param axis the axis to resolve
     * @param o the ComponentOrientation to resolve against
     * @return the resolved axis
     */
    private int resolveAxis( int axis, ComponentOrientation o ) {
        int absoluteAxis;
        if( axis == LINE_AXIS ) {
            absoluteAxis = o.isHorizontal() ? X_AXIS : Y_AXIS;
        } else if( axis == PAGE_AXIS ) {
            absoluteAxis = o.isHorizontal() ? Y_AXIS : X_AXIS;
        } else {
            absoluteAxis = axis;
        }
        return absoluteAxis;
   }

    private int axis;
    private Container target;

    private transient SizeRequirements[] xChildren;
    private transient SizeRequirements[] yChildren;
    private transient SizeRequirements xTotal;
    private transient SizeRequirements yTotal;

    private transient PrintStream dbg;
}


text:
<?php

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

// Constants and Definitions

if ( ! defined( 'MHDM_PLUGIN_BASENAME' ) )
	define( 'MHDM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

if ( ! defined( 'MHDM_PLUGIN_DIR' ) )
	define( 'MHDM_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) );

if ( ! defined( 'MHDM_PLUGIN_URL' ) )
	define( 'MHDM_PLUGIN_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );

// get rid of the tempting file editor!
if ( !defined ('DISALLOW_FILE_EDIT') )
 	define( 'DISALLOW_FILE_EDIT', true );

 // pull in the meta-box functionality
if ( !defined ( 'RWMB_URL' ) )
    define( 'RWMB_URL', MHDM_PLUGIN_URL .  '/admin/includes/plugin/meta-box/' );

if ( !defined ( 'RWMB_DIR' ) )
    define( 'RWMB_DIR', MHDM_PLUGIN_DIR . '/admin/includes/plugin/meta-box/' );

/*----------------------------------------------------------------------------*
 * Public-Facing Functionality
 *----------------------------------------------------------------------------*/

require_once( plugin_dir_path( __FILE__ ) . 'public/class-mh-deal-manager.php' );

/*
 * Register hooks that are fired when the plugin is activated or deactivated.
 * When the plugin is deleted, the uninstall.php file is loaded.
 *
 */
register_activation_hook( __FILE__, array( 'MH_Deal_Manager', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'MH_Deal_Manager', 'deactivate' ) );

add_action( 'plugins_loaded', array( 'MH_Deal_Manager', 'get_instance' ) );

/*----------------------------------------------------------------------------*
 * Dashboard and Administrative Functionality
 *----------------------------------------------------------------------------*/

/*
 *
 * If you want to include Ajax within the dashboard, change the following
 * conditional to:
 *
 * if ( is_admin() ) {
 *   ...
 * }
 *
 * The code below is intended to to give the lightest footprint possible.
 */
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {

	require_once( plugin_dir_path( __FILE__ ) . 'admin/class-mh-deal-manager-admin.php' );
	add_action( 'plugins_loaded', array( 'MH_Deal_Manager_Admin', 'get_instance' ) );

}


text:
<HTML>
	<HEAD>
		<meta charset="utf-8"/>
	</HEAD>
<BODY>

	<form action="upload.php" method="post" enctype="multipart/form-data" >

		<input type="file" name="arquivo"/>

		<input type="submit"/>

	</form>

	<?php
	// enctype="multipart/form-data" >>> Responsavel por compactar o arquivo em Bytes e enviar para o Servidor

	?>
</BODY>
</HTML>


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding field 'Registration.voter_id'
        db.add_column('registrations', 'voter_id',
                      self.gf('django.db.models.fields.CharField')(max_length=20, unique=True, null=True),
                      keep_default=False)

    def backwards(self, orm):
        # Deleting field 'Registration.voter_id'
        db.delete_column('registrations', 'voter_id')

    models = {
        'server.alist': {
            'Meta': {'unique_together': "(('registration', 'user', 'user_starred'),)", 'object_name': 'AList', 'db_table': "'alist'"},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'registration': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.Registration']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user'", 'to': "orm['server.User']"}),
            'user_starred': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_starred'", 'to': "orm['server.User']"})
        },
        'server.app': {
            'Meta': {'object_name': 'App', 'db_table': "'apps'"},
            'app_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
            'app_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'app_token': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.User']"})
        },
        'server.conference': {
            'Meta': {'ordering': "['-start_date']", 'object_name': 'Conference', 'db_table': "'conferences'"},
            'admins': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
            'blurb': ('django.db.models.fields.TextField', [], {}),
            'confer_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
            'end_date': ('django.db.models.fields.DateField', [], {}),
            'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'location': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'start_date': ('django.db.models.fields.DateField', [], {}),
            'subtitle': ('django.db.models.fields.TextField', [], {}),
            'title': ('django.db.models.fields.TextField', [], {}),
            'unique_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'})
        },
        'server.following': {
            'Meta': {'unique_together': "(('paper_id', 'conference', 'user'),)", 'object_name': 'Following', 'db_table': "'following'"},
            'conference': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.Conference']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'paper_id': ('django.db.models.fields.TextField', [], {}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.User']"})
        },
        'server.likes': {
            'Meta': {'object_name': 'Likes', 'db_table': "'likes'"},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'likes': ('django.db.models.fields.TextField', [], {}),
            'registration': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.Registration']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'server.logs': {
            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Logs', 'db_table': "'logs'"},
            'action': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'data': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'registration': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.Registration']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'server.permission': {
            'Meta': {'object_name': 'Permission', 'db_table': "'permissions'"},
            'access': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'app': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.App']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.User']"})
        },
        'server.registration': {
            'Meta': {'object_name': 'Registration', 'db_table': "'registrations'"},
            'conference': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.Conference']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['server.User']"}),
            'voter_id': ('django.db.models.fields.CharField', [], {'max_length': '20', 'unique': 'True', 'null': 'True'})
        },
        'server.user': {
            'Meta': {'object_name': 'User', 'db_table': "'users'"},
            'email': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
            'f_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'friendly': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'l_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'meetups_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        }
    }

    complete_apps = ['server']


text:
package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import com.google.cloud.bigquery.JobInfo.CreateDisposition;
import com.google.cloud.bigquery.JobInfo.WriteDisposition;
import com.google.cloud.bigquery.JobInfo.SchemaUpdateOption;
import com.google.cloud.bigquery.QueryJobConfiguration.Priority;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;

public class QueryJobConfigurationTest {

  private static final String QUERY = "BigQuery SQL";
  private static final DatasetId DATASET_ID = DatasetId.of("dataset");
  private static final TableId TABLE_ID = TableId.of("dataset", "table");
  private static final List<String> SOURCE_URIS = ImmutableList.of("uri1", "uri2");
  private static final Field FIELD_SCHEMA1 =
      Field.newBuilder("StringField", LegacySQLTypeName.STRING)
          .setMode(Field.Mode.NULLABLE)
          .setDescription("FieldDescription1")
          .build();
  private static final Field FIELD_SCHEMA2 =
      Field.newBuilder("IntegerField", LegacySQLTypeName.INTEGER)
          .setMode(Field.Mode.REPEATED)
          .setDescription("FieldDescription2")
          .build();
  private static final Field FIELD_SCHEMA3 =
      Field.newBuilder("RecordField", LegacySQLTypeName.RECORD, FIELD_SCHEMA1, FIELD_SCHEMA2)
          .setMode(Field.Mode.REQUIRED)
          .setDescription("FieldDescription3")
          .build();
  private static final Schema TABLE_SCHEMA = Schema.of(FIELD_SCHEMA1, FIELD_SCHEMA2, FIELD_SCHEMA3);
  private static final Integer MAX_BAD_RECORDS = 42;
  private static final Boolean IGNORE_UNKNOWN_VALUES = true;
  private static final String COMPRESSION = "GZIP";
  private static final CsvOptions CSV_OPTIONS = CsvOptions.newBuilder().build();
  private static final ExternalTableDefinition TABLE_CONFIGURATION =
      ExternalTableDefinition.newBuilder(SOURCE_URIS, TABLE_SCHEMA, CSV_OPTIONS)
          .setCompression(COMPRESSION)
          .setIgnoreUnknownValues(IGNORE_UNKNOWN_VALUES)
          .setMaxBadRecords(MAX_BAD_RECORDS)
          .build();
  private static final Map<String, ExternalTableDefinition> TABLE_DEFINITIONS =
      ImmutableMap.of("tableName", TABLE_CONFIGURATION);
  private static final CreateDisposition CREATE_DISPOSITION = CreateDisposition.CREATE_IF_NEEDED;
  private static final WriteDisposition WRITE_DISPOSITION = WriteDisposition.WRITE_APPEND;
  private static final Priority PRIORITY = Priority.BATCH;
  private static final boolean ALLOW_LARGE_RESULTS = true;
  private static final boolean USE_QUERY_CACHE = false;
  private static final boolean FLATTEN_RESULTS = true;
  private static final boolean USE_LEGACY_SQL = true;
  private static final Integer MAX_BILLING_TIER = 123;
  private static final List<SchemaUpdateOption> SCHEMA_UPDATE_OPTIONS =
      ImmutableList.of(SchemaUpdateOption.ALLOW_FIELD_RELAXATION);
  private static final List<UserDefinedFunction> USER_DEFINED_FUNCTIONS = ImmutableList.of(
      UserDefinedFunction.inline("Function"), UserDefinedFunction.fromUri("URI"));
  private static final QueryJobConfiguration QUERY_JOB_CONFIGURATION =
      QueryJobConfiguration.newBuilder(QUERY)
          .setUseQueryCache(USE_QUERY_CACHE)
          .setTableDefinitions(TABLE_DEFINITIONS)
          .setAllowLargeResults(ALLOW_LARGE_RESULTS)
          .setCreateDisposition(CREATE_DISPOSITION)
          .setDefaultDataset(DATASET_ID)
          .setDestinationTable(TABLE_ID)
          .setWriteDisposition(WRITE_DISPOSITION)
          .setPriority(PRIORITY)
          .setFlattenResults(FLATTEN_RESULTS)
          .setUserDefinedFunctions(USER_DEFINED_FUNCTIONS)
          .setDryRun(true)
          .setUseLegacySql(USE_LEGACY_SQL)
          .setMaximumBillingTier(MAX_BILLING_TIER)
          .setSchemaUpdateOptions(SCHEMA_UPDATE_OPTIONS)
          .build();

  @Test
  public void testToBuilder() {
    compareQueryJobConfiguration(QUERY_JOB_CONFIGURATION,
        QUERY_JOB_CONFIGURATION.toBuilder().build());
    QueryJobConfiguration job = QUERY_JOB_CONFIGURATION.toBuilder()
        .setQuery("New BigQuery SQL")
        .build();
    assertEquals("New BigQuery SQL", job.getQuery());
    job = job.toBuilder().setQuery(QUERY).build();
    compareQueryJobConfiguration(QUERY_JOB_CONFIGURATION, job);
  }

  @Test
  public void testOf() {
    QueryJobConfiguration job = QueryJobConfiguration.of(QUERY);
    assertEquals(QUERY, job.getQuery());
  }

  @Test
  public void testToBuilderIncomplete() {
    QueryJobConfiguration job = QueryJobConfiguration.of(QUERY);
    compareQueryJobConfiguration(job, job.toBuilder().build());
  }

  @Test
  public void testToPbAndFromPb() {
    assertNotNull(QUERY_JOB_CONFIGURATION.toPb().getQuery());
    assertNull(QUERY_JOB_CONFIGURATION.toPb().getExtract());
    assertNull(QUERY_JOB_CONFIGURATION.toPb().getCopy());
    assertNull(QUERY_JOB_CONFIGURATION.toPb().getLoad());
    compareQueryJobConfiguration(QUERY_JOB_CONFIGURATION,
        QueryJobConfiguration.fromPb(QUERY_JOB_CONFIGURATION.toPb()));
    QueryJobConfiguration job = QueryJobConfiguration.of(QUERY);
    compareQueryJobConfiguration(job, QueryJobConfiguration.fromPb(job.toPb()));
  }

  @Test
  public void testSetProjectId() {
    QueryJobConfiguration configuration = QUERY_JOB_CONFIGURATION.setProjectId("p");
    assertEquals("p", configuration.getDefaultDataset().getProject());
    assertEquals("p", configuration.getDestinationTable().getProject());
  }

  @Test
  public void testGetType() {
    assertEquals(JobConfiguration.Type.QUERY, QUERY_JOB_CONFIGURATION.getType());
  }

  private void compareQueryJobConfiguration(QueryJobConfiguration expected,
      QueryJobConfiguration value) {
    assertEquals(expected, value);
    assertEquals(expected.hashCode(), value.hashCode());
    assertEquals(expected.toString(), value.toString());
    assertEquals(expected.dryRun(), value.dryRun());
    assertEquals(expected.allowLargeResults(), value.allowLargeResults());
    assertEquals(expected.getCreateDisposition(), value.getCreateDisposition());
    assertEquals(expected.getDefaultDataset(), value.getDefaultDataset());
    assertEquals(expected.getDestinationTable(), value.getDestinationTable());
    assertEquals(expected.flattenResults(), value.flattenResults());
    assertEquals(expected.getPriority(), value.getPriority());
    assertEquals(expected.getQuery(), value.getQuery());
    assertEquals(expected.getTableDefinitions(), value.getTableDefinitions());
    assertEquals(expected.useQueryCache(), value.useQueryCache());
    assertEquals(expected.getUserDefinedFunctions(), value.getUserDefinedFunctions());
    assertEquals(expected.getWriteDisposition(), value.getWriteDisposition());
    assertEquals(expected.useLegacySql(), value.useLegacySql());
    assertEquals(expected.getMaximumBillingTier(), value.getMaximumBillingTier());
    assertEquals(expected.getSchemaUpdateOptions(), value.getSchemaUpdateOptions());
  }
}


text:
<!DOCTYPE html>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src="../resources/picker-common.js"></script>

<select style="width: 10px; font-size: 300px;">
  <option>X</option>
  <option>X</option>
  <option>X</option>
  <option>X</option>
  <option>X</option>
</select>

<script>
  window.onload = openPickerAppearanceOnly(document.querySelector('select'));
</script>


text:
import RestfulModel, { SaveCallback } from './restful-model';
import Attributes, { Attribute } from './attributes';
import Model from './model';
import NylasConnection from '../nylas-connection';

export type EmailAddressProperties = {
  type: string;
  email: string;
};

export class EmailAddress extends Model implements EmailAddressProperties {
  type = '';
  email = '';
  static attributes: Record<string, Attribute> = {
    type: Attributes.String({
      modelKey: 'type',
    }),
    email: Attributes.String({
      modelKey: 'email',
    }),
  };

  constructor(props?: EmailAddressProperties) {
    super();
    this.initAttributes(props);
  }
}

export type IMAddressProperties = {
  type: string;
  imAddress: string;
};

export class IMAddress extends Model implements IMAddressProperties {
  type = '';
  imAddress = '';
  static attributes: Record<string, Attribute> = {
    type: Attributes.String({
      modelKey: 'type',
    }),
    imAddress: Attributes.String({
      modelKey: 'imAddress',
      jsonKey: 'im_address',
    }),
  };

  constructor(props?: IMAddressProperties) {
    super();
    this.initAttributes(props);
  }
}

export type PhysicalAddressProperties = {
  type: string;
  format: string;
  streetAddress: string;
  city: string;
  postalCode: string;
  state: string;
  country: string;
  address?: string;
};

export class PhysicalAddress extends Model
  implements PhysicalAddressProperties {
  type = '';
  format = '';
  streetAddress = '';
  city = '';
  postalCode = '';
  state = '';
  country = '';
  address = '';
  static attributes: Record<string, Attribute> = {
    type: Attributes.String({
      modelKey: 'type',
    }),
    format: Attributes.String({
      modelKey: 'format',
    }),
    address: Attributes.String({
      modelKey: 'address',
    }),
    streetAddress: Attributes.String({
      modelKey: 'streetAddress',
      jsonKey: 'street_address',
    }),
    city: Attributes.String({
      modelKey: 'city',
    }),
    postalCode: Attributes.String({
      modelKey: 'postalCode',
      jsonKey: 'postal_code',
    }),
    state: Attributes.String({
      modelKey: 'state',
    }),
    country: Attributes.String({
      modelKey: 'country',
    }),
  };

  constructor(props?: PhysicalAddressProperties) {
    super();
    this.initAttributes(props);
  }

  toJSON(): Record<string, string> {
    const json: Record<string, string> = {
      type: this.type,
      format: this.format,
    };
    if (this.format == 'unstructured') {
      json.address = this.address;
    } else {
      json.street_address = this.streetAddress;
      json.postal_code = this.postalCode;
      json.state = this.state;
      json.city = this.city;
      json.country = this.country;
    }
    return json;
  }
}

export type PhoneNumberProperties = {
  type: string;
  number: string;
};

export class PhoneNumber extends Model implements PhoneNumberProperties {
  type = '';
  number = '';
  static attributes: Record<string, Attribute> = {
    type: Attributes.String({
      modelKey: 'type',
    }),
    number: Attributes.String({
      modelKey: 'number',
    }),
  };

  constructor(props?: PhoneNumberProperties) {
    super();
    this.initAttributes(props);
  }
}

export type WebPageProperties = {
  type: string;
  url: string;
};

export class WebPage extends Model implements WebPageProperties {
  type = '';
  url = '';
  static attributes: Record<string, Attribute> = {
    type: Attributes.String({
      modelKey: 'type',
    }),
    url: Attributes.String({
      modelKey: 'url',
    }),
  };

  constructor(props?: WebPageProperties) {
    super();
    this.initAttributes(props);
  }
}

export type GroupProperties = {
  name: string;
  path: string;
  id?: string;
  accountId?: string;
  object?: string;
};

export class Group extends Model implements GroupProperties {
  name = '';
  path = '';
  id?: string;
  accountId?: string;
  object?: string;
  static attributes: Record<string, Attribute> = {
    name: Attributes.String({
      modelKey: 'name',
    }),
    path: Attributes.String({
      modelKey: 'path',
    }),
    id: Attributes.String({
      modelKey: 'id',
      readOnly: true,
    }),
    object: Attributes.String({
      modelKey: 'object',
      readOnly: true,
    }),
    accountId: Attributes.String({
      modelKey: 'accountId',
      jsonKey: 'account_id',
      readOnly: true,
    }),
  };

  constructor(props?: GroupProperties) {
    super();
    this.initAttributes(props);
  }
}

export type ContactProperties = {
  givenName?: string;
  middleName?: string;
  surname?: string;
  suffix?: string;
  nickname?: string;
  birthday?: string;
  companyName?: string;
  jobTitle?: string;
  officeLocation?: string;
  notes?: string;
  pictureUrl?: string;
  emailAddresses?: EmailAddressProperties[];
  imAddresses?: IMAddressProperties[];
  physicalAddresses?: PhysicalAddressProperties[];
  phoneNumbers?: PhoneNumberProperties[];
  webPages?: WebPageProperties[];
  groups?: GroupProperties[];
  source?: string;
};

export default class Contact extends RestfulModel implements ContactProperties {
  givenName?: string;
  middleName?: string;
  surname?: string;
  suffix?: string;
  nickname?: string;
  birthday?: string;
  companyName?: string;
  jobTitle?: string;
  officeLocation?: string;
  notes?: string;
  pictureUrl?: string;
  emailAddresses?: EmailAddress[];
  imAddresses?: IMAddress[];
  physicalAddresses?: PhysicalAddress[];
  phoneNumbers?: PhoneNumber[];
  webPages?: WebPage[];
  groups?: Group[];
  source?: string;
  jobStatusId?: string;
  static collectionName = 'contacts';
  static attributes: Record<string, Attribute> = {
    ...RestfulModel.attributes,
    givenName: Attributes.String({
      modelKey: 'givenName',
      jsonKey: 'given_name',
    }),
    middleName: Attributes.String({
      modelKey: 'middleName',
      jsonKey: 'middle_name',
    }),
    surname: Attributes.String({
      modelKey: 'surname',
    }),
    suffix: Attributes.String({
      modelKey: 'suffix',
    }),
    nickname: Attributes.String({
      modelKey: 'nickname',
    }),
    birthday: Attributes.String({
      modelKey: 'birthday',
    }),
    companyName: Attributes.String({
      modelKey: 'companyName',
      jsonKey: 'company_name',
    }),
    jobTitle: Attributes.String({
      modelKey: 'jobTitle',
      jsonKey: 'job_title',
    }),
    managerName: Attributes.String({
      modelKey: 'managerName',
      jsonKey: 'manager_name',
    }),
    officeLocation: Attributes.String({
      modelKey: 'officeLocation',
      jsonKey: 'office_location',
    }),
    notes: Attributes.String({
      modelKey: 'notes',
    }),
    pictureUrl: Attributes.String({
      modelKey: 'pictureUrl',
      jsonKey: 'picture_url',
    }),
    emailAddresses: Attributes.Collection({
      modelKey: 'emailAddresses',
      jsonKey: 'emails',
      itemClass: EmailAddress,
    }),
    imAddresses: Attributes.Collection({
      modelKey: 'imAddresses',
      jsonKey: 'im_addresses',
      itemClass: IMAddress,
    }),
    physicalAddresses: Attributes.Collection({
      modelKey: 'physicalAddresses',
      jsonKey: 'physical_addresses',
      itemClass: PhysicalAddress,
    }),
    phoneNumbers: Attributes.Collection({
      modelKey: 'phoneNumbers',
      jsonKey: 'phone_numbers',
      itemClass: PhoneNumber,
    }),
    webPages: Attributes.Collection({
      modelKey: 'webPages',
      jsonKey: 'web_pages',
      itemClass: WebPage,
    }),
    groups: Attributes.Collection({
      modelKey: 'groups',
      itemClass: Group,
    }),
    source: Attributes.String({
      modelKey: 'source',
    }),
    jobStatusId: Attributes.String({
      modelKey: 'jobStatusId',
      jsonKey: 'job_status_id',
      readOnly: true,
    }),
  };

  constructor(connection: NylasConnection, props?: ContactProperties) {
    super(connection);
    this.initAttributes(props);
  }

  getPicture(
    params: Record<string, any> = {},
    callback?: (error: Error | null, result?: any) => void
  ): any {
    return this.get(params, callback, '/picture');
  }

  save(params: {} | SaveCallback = {}, callback?: SaveCallback): Promise<this> {
    return super.save(params, callback);
  }
}


text:
import React from "react";
import ReactDOM from "react-dom";
import TestUtils from "react-addons-test-utils";
import DatePicker from "../src/datepicker.jsx";
import moment from "moment";

describe("DatePicker", () => {
  it("should show the calendar when focusing on the date input", done => {
    var datePicker = TestUtils.renderIntoDocument(
      <DatePicker />
    );
    var dateInput = datePicker.refs.input;
    TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
    setTimeout(() => {
      expect(datePicker.refs.calendar).to.exist;
      done();
    }, 200);
  });

  it("should hide the calendar when blurring the date input", done => {
    var datePicker = TestUtils.renderIntoDocument(
      <DatePicker />
    );
    var dateInput = datePicker.refs.input;
    TestUtils.Simulate.focus(ReactDOM.findDOMNode(dateInput));
    TestUtils.Simulate.blur(ReactDOM.findDOMNode(dateInput));
    setTimeout(() => {
      expect(datePicker.refs.calendar).to.not.exist;
      done();
    }, 300);
  });

  it("should allow clearing the date when isClearable is true", () => {
    var datePicker = TestUtils.renderIntoDocument(
      <DatePicker isClearable={true} selected={moment("2015-12-15")} />
    );
    var clearButton = TestUtils.findRenderedDOMComponentWithClass(datePicker, "close-icon");
    TestUtils.Simulate.click(clearButton);
    var dateInput = datePicker.refs.input;
    expect(ReactDOM.findDOMNode(dateInput).value).to.equal("");
  });

  it("should not hide the calendar if multiple clicks are made in a short interval", done => {
    var datePicker = TestUtils.renderIntoDocument(
      <DatePicker />
    );
    var dateInput = datePicker.refs.input;
    TestUtils.Simulate.click(ReactDOM.findDOMNode(dateInput));

    setTimeout(() => {
      var calendar = datePicker.refs.calendar;
      TestUtils.Simulate.blur(ReactDOM.findDOMNode(dateInput));

      setTimeout(() => {
        TestUtils.Simulate.click(ReactDOM.findDOMNode(calendar));
        TestUtils.Simulate.click(ReactDOM.findDOMNode(calendar));
      }, 0);

      TestUtils.Simulate.blur(ReactDOM.findDOMNode(dateInput));
    }, 0);

    setTimeout(() => {
      expect(datePicker.refs.calendar).to.exist;
      done();
    }, 300);
  });
});


text:
@implementation GrowlDelegate
- (id) initWithAllNotifications:(NSArray *)allNotifications defaultNotifications:(NSArray *)defaultNotifications {
	if ((self = [self init])) {
		registrationDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
			allNotifications,     GROWL_NOTIFICATIONS_ALL,
			defaultNotifications, GROWL_NOTIFICATIONS_DEFAULT,
			nil];
	}
	return self;
}

- (void) dealloc {
	[registrationDictionary      release];
	[applicationNameForGrowl     release];
	[applicationIconDataForGrowl release];
	[super dealloc];
}

- (NSDictionary *) registrationDictionaryForGrowl {
	return registrationDictionary;
}

- (NSString *) applicationNameForGrowl {
	return applicationNameForGrowl;
}

- (void) setApplicationNameForGrowl:(NSString *)name {
	if (name != applicationNameForGrowl) {
		[applicationNameForGrowl release];
		applicationNameForGrowl = [name retain];
	}
}

- (NSData *) applicationIconDataForGrowl {
	return applicationIconDataForGrowl;
}

- (void) setApplicationIconDataForGrowl:(NSData *)data {
	if (data != applicationIconDataForGrowl) {
		[applicationIconDataForGrowl release];
		applicationIconDataForGrowl = [data retain];
	}
}

@end