text:
// Copyright 2017 DAIMTO ([Linda Lawton](https://twitter.com/LindaLawtonDK)) :  [www.daimto.com](http://www.daimto.com/)
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by DAIMTO-Google-apis-Sample-generator 1.0.0
//     Template File Name:  methodTemplate.tt
//     Build date: 2017-10-08
//     C# generater version: 1.0.0
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// About
//
// Unoffical sample for the Directory directory_v1 API for C#.
// This sample is designed to be used with the Google .Net client library. (https://github.com/google/google-api-dotnet-client)
//
// API Description: The Admin SDK Directory API lets you view and manage enterprise resources such as users and groups, administrative notifications, security features, and more.
// API Documentation Link https://developers.google.com/admin-sdk/directory/
//
// Discovery Doc  https://www.googleapis.com/discovery/v1/apis/Directory/directory_v1/rest
//
//------------------------------------------------------------------------------
// Installation
//
// This sample code uses the Google .Net client library (https://github.com/google/google-api-dotnet-client)
//
// NuGet package:
//
// Location: https://www.nuget.org/packages/Google.Apis.Directory.directory_v1/
// Install Command: PM>  Install-Package Google.Apis.Directory.directory_v1
//
//------------------------------------------------------------------------------
using Google.Apis.Directory.directory_v1;
using Google.Apis.Directory.directory_v1.Data;
using System;

namespace GoogleSamplecSharpSample.Directorydirectory_v1.Methods
{

    public static class CustomersSample
    {

        /// <summary>
        /// Retrieves a customer.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/customers/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Directory service.</param>
        /// <param name="customerKey">Id of the customer to be retrieved</param>
        /// <returns>CustomerResponse</returns>
        public static Customer Get(DirectoryService service, string customerKey)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (customerKey == null)
                    throw new ArgumentNullException(customerKey);

                // Make the request.
                return service.Customers.Get(customerKey).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Get failed.", ex);
            }
        }

        /// <summary>
        /// Updates a customer. This method supports patch semantics.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/customers/patch
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Directory service.</param>
        /// <param name="customerKey">Id of the customer to be updated</param>
        /// <param name="body">A valid Directory directory_v1 body.</param>
        /// <returns>CustomerResponse</returns>
        public static Customer Patch(DirectoryService service, string customerKey, Customer body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");
                if (customerKey == null)
                    throw new ArgumentNullException(customerKey);

                // Make the request.
                return service.Customers.Patch(body, customerKey).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Patch failed.", ex);
            }
        }

        /// <summary>
        /// Updates a customer.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/customers/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Directory service.</param>
        /// <param name="customerKey">Id of the customer to be updated</param>
        /// <param name="body">A valid Directory directory_v1 body.</param>
        /// <returns>CustomerResponse</returns>
        public static Customer Update(DirectoryService service, string customerKey, Customer body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");
                if (customerKey == null)
                    throw new ArgumentNullException(customerKey);

                // Make the request.
                return service.Customers.Update(body, customerKey).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Update failed.", ex);
            }
        }

        }

        public static class SampleHelpers
        {

        /// <summary>
        /// Using reflection to apply optional parameters to the request.
        ///
        /// If the optonal parameters are null then we will just return the request as is.
        /// </summary>
        /// <param name="request">The request. </param>
        /// <param name="optional">The optional parameters. </param>
        /// <returns></returns>
        public static object ApplyOptionalParms(object request, object optional)
        {
            if (optional == null)
                return request;

            System.Reflection.PropertyInfo[] optionalProperties = (optional.GetType()).GetProperties();

            foreach (System.Reflection.PropertyInfo property in optionalProperties)
            {
                // Copy value from optional parms to the request.  They should have the same names and datatypes.
                System.Reflection.PropertyInfo piShared = (request.GetType()).GetProperty(property.Name);
				if (property.GetValue(optional, null) != null) // TODO Test that we do not add values for items that are null
					piShared.SetValue(request, property.GetValue(optional, null), null);
            }

            return request;
        }
    }
}


text:
.class Landroid/service/media/MediaBrowserService$ServiceBinder$2;
.super Ljava/lang/Object;
.source "MediaBrowserService.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Landroid/service/media/MediaBrowserService$ServiceBinder;->disconnect(Landroid/service/media/IMediaBrowserServiceCallbacks;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$1:Landroid/service/media/MediaBrowserService$ServiceBinder;

.field final synthetic val$callbacks:Landroid/service/media/IMediaBrowserServiceCallbacks;

# direct methods
.method constructor <init>(Landroid/service/media/MediaBrowserService$ServiceBinder;Landroid/service/media/IMediaBrowserServiceCallbacks;)V
    .registers 3
    .param p1, "this$1"    # Landroid/service/media/MediaBrowserService$ServiceBinder;
    .param p2, "val$callbacks"    # Landroid/service/media/IMediaBrowserServiceCallbacks;

    .prologue
    .line 217
    iput-object p1, p0, Landroid/service/media/MediaBrowserService$ServiceBinder$2;->this$1:Landroid/service/media/MediaBrowserService$ServiceBinder;

    iput-object p2, p0, Landroid/service/media/MediaBrowserService$ServiceBinder$2;->val$callbacks:Landroid/service/media/IMediaBrowserServiceCallbacks;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()V
    .registers 4

    .prologue
    .line 220
    iget-object v2, p0, Landroid/service/media/MediaBrowserService$ServiceBinder$2;->val$callbacks:Landroid/service/media/IMediaBrowserServiceCallbacks;

    invoke-interface {v2}, Landroid/service/media/IMediaBrowserServiceCallbacks;->asBinder()Landroid/os/IBinder;

    move-result-object v0

    .line 223
    .local v0, "b":Landroid/os/IBinder;
    iget-object v2, p0, Landroid/service/media/MediaBrowserService$ServiceBinder$2;->this$1:Landroid/service/media/MediaBrowserService$ServiceBinder;

    iget-object v2, v2, Landroid/service/media/MediaBrowserService$ServiceBinder;->this$0:Landroid/service/media/MediaBrowserService;

    invoke-static {v2}, Landroid/service/media/MediaBrowserService;->-get0(Landroid/service/media/MediaBrowserService;)Landroid/util/ArrayMap;

    move-result-object v2

    invoke-virtual {v2, v0}, Landroid/util/ArrayMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/service/media/MediaBrowserService$ConnectionRecord;

    .line 224
    .local v1, "old":Landroid/service/media/MediaBrowserService$ConnectionRecord;
    if-eqz v1, :cond_16

    .line 219
    :cond_16
    return-void
.end method

redpajama_set_name: RedPajamaGithub


text:
package uk.ac.edukapp.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonUnwrapped;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import uk.ac.edukapp.renderer.CustomJsonDateSerializer;
import uk.ac.edukapp.renderer.Renderer;

/**
 * The persistent class for the widgetprofiles database table.
 *
 */
@Entity
@NamedQueries({
		@NamedQuery(name = "Widgetprofile.findByUri", query = "SELECT w FROM Widgetprofile w WHERE w.widId = :uri"),
		@NamedQuery(name = "Widgetprofile.featured", query = "SELECT w FROM Widgetprofile w WHERE w.featured = 1"),
		@NamedQuery(name = "Widgetprofile.created", query = "SELECT w FROM Widgetprofile w ORDERBY w.created DESC"),
		@NamedQuery(name = "Widgetprofile.ownedBy", query = "SELECT w FROM Widgetprofile w WHERE w.owner = :user")})

@Table(name = "widgetprofiles")
public class Widgetprofile implements Serializable {
	private static final long serialVersionUID = 1L;

	public static final String W3C_WIDGET = "w3c";
	public static final String OPENSOCIAL_GADGET = "opensocial";

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(unique = true, nullable = false)
	private int id;

	@Column(nullable = false, length = 100)
	private String name;

	@Column(nullable = false)
	private String icon;

	@Column(nullable = false)
	private int publish_level;

	@Column(nullable = false)
	private byte deleted;

	@Column(nullable = false)
	private String meta_data;

	@JsonIgnore
	@Column(name = "w3c_or_os", nullable = false)
	private byte w3cOrOs;

	@Column(name = "featured", nullable = true)
	private byte featured;

	@JsonProperty(value = "uri")
	@Column(name = "wid_id", nullable = false, length = 150)
	private String widId;

	@JsonSerialize(using=CustomJsonDateSerializer.class)
	@Column(nullable = false)
	private Date created;

	@JsonSerialize(using=CustomJsonDateSerializer.class)
	@Column(nullable = false)
	private Date updated;

	@Column(nullable = true)
	private String license;

	@Column(nullable = true)
	private String author;

	@Column(nullable = true)
	private String builder;

	// bi-directional many-to-many association to Tag
	@ManyToMany()
	@JoinTable(name = "widgetprofiles_tags",
			joinColumns = { @JoinColumn(name = "widgetprofile_id", nullable = false) },
			inverseJoinColumns = { @JoinColumn(name = "tag_id", nullable = false) })
	private List<Tag> tags;

	// bi-directional many-to-many association to Activity
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "widgetactivities",
			joinColumns = { @JoinColumn(name = "widgetprofile_id", nullable = false) },
			inverseJoinColumns = { @JoinColumn(name = "activity_id", nullable = false) })
	private List<Activity> activities;

	@JsonUnwrapped
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "id", referencedColumnName = "wid_id")
	WidgetDescription description;

	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "id", referencedColumnName = "wid_id")
	WidgetStats widgetStats;

	@OneToMany(mappedBy="widgetProfile")
	private List<WidgetFunctionality> functionalities;

	@ManyToOne
	@JoinColumn(name="owner", nullable=false)
	private Useraccount owner;

	@ManyToMany(fetch=FetchType.EAGER)
	@JoinTable(name="widgetprofiles_category",
			joinColumns = { @JoinColumn(name="widgetprofiles_id", referencedColumnName="id")},
			inverseJoinColumns = { @JoinColumn(name="category_id", referencedColumnName="id") })
	private List<Category> categories;

	public Widgetprofile() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the icon
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * @param icon
	 *            the icon to set
	 */
	public void setIcon(String icon) {
		this.icon = icon;
	}

	public byte getW3cOrOs() {
		return this.w3cOrOs;
	}

	public void setW3cOrOs(byte w3cOrOs) {
		this.w3cOrOs = w3cOrOs;
	}

	public String getWidId() {
		return this.widId;
	}

	public void setWidId(String widId) {
		this.widId = widId;
	}

	/**
	 * @return the created
	 */
	public Date getCreated() {
		return created;
	}

	/**
	 * @param created
	 *            the created to set
	 */
	public void setCreated(Date created) {
		this.created = created;
	}

	/**
	 * @return the updated
	 */
	public Date getUpdated() {
		return updated;
	}

	/**
	 * @param updated
	 *            the updated to set
	 */
	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	public List<Tag> getTags() {
		return this.tags;
	}

	public void setTags(List<Tag> tags) {
		this.tags = tags;
	}

	public List<Activity> getActivities() {
		return this.activities;
	}

	public void setActivities(List<Activity> activities) {
		this.activities = activities;
	}

	public byte getFeatured() {
		return featured;
	}

	public void setFeatured(byte featured) {
		this.featured = featured;
	}

	public WidgetDescription getDescription() {
		return description;
	}

	public void setDescription(WidgetDescription description) {
		this.description = description;
	}

	public WidgetStats getWidgetStats() {
		return widgetStats;
	}

	public void setWidgetStats(WidgetStats widgetStats) {
		this.widgetStats = widgetStats;
	}

	public String getType() {
		if (this.getW3cOrOs() == 0) {
			return "W3C Widget";
		} else {
			return "OpenSocial Gadget";
		}
	}

	   public String getDownloadUrl() {
	       return Renderer.getDownloadUrl(this);
	    }

	/**
	 * @return the widgetFunctionalities
	 */
	public List<WidgetFunctionality> getFunctionalities() {
		return functionalities;
	}

	/**
	 * @param widgetFunctionalities the widgetFunctionalities to set
	 */
	public void setFunctionalities(
			List<WidgetFunctionality> widgetFunctionalities) {
		this.functionalities = widgetFunctionalities;
	}

	/**
	 * @return the owner
	 */
	public Useraccount getOwner() {
		return owner;
	}

	/**
	 * @param owner the owner to set
	 */
	public void setOwner(Useraccount owner) {
		this.owner = owner;
	}

	/**
	 * @return the publish_level
	 */
	public int getPublish_level() {
		return publish_level;
	}

	/**
	 * @param publish_level the publish_level to set
	 */
	public void setPublish_level(int publish_level) {
		this.publish_level = publish_level;
	}

	/**
	 * @return the deleted
	 */
	public byte getDeleted() {
		return deleted;
	}

	/**
	 * @param deleted the deleted to set
	 */
	public void setDeleted(byte deleted) {
		this.deleted = deleted;
	}

	/**
	 * @return the meta_data
	 */
	public String getMeta_data() {
		return meta_data;
	}

	/**
	 * @param meta_data the meta_data to set
	 */
	public void setMeta_data(String meta_data) {
		this.meta_data = meta_data;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((activities == null) ? 0 : activities.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + featured;
		result = prime * result + id;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((tags == null) ? 0 : tags.hashCode());
		result = prime * result + w3cOrOs;
		result = prime * result + ((widId == null) ? 0 : widId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Widgetprofile other = (Widgetprofile) obj;
		if (activities == null) {
			if (other.activities != null)
				return false;
		} else if (!activities.equals(other.activities))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (featured != other.featured)
			return false;
		if (id != other.id)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (tags == null) {
			if (other.tags != null)
				return false;
		} else if (!tags.equals(other.tags))
			return false;
		if (w3cOrOs != other.w3cOrOs)
			return false;
		if (widId == null) {
			if (other.widId != null)
				return false;
		} else if (!widId.equals(other.widId))
			return false;
		return true;
	}

	/**
	 * @return the license
	 */
	public String getLicense() {
		return license;
	}

	/**
	 * @param license the license to set
	 */
	public void setLicense(String license) {
		this.license = license;
	}

	/**
	 * @return the author
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * @param author the author to set
	 */
	public void setAuthor(String author) {
		this.author = author;
	}

	/**
	 * @return the builder
	 */
	public String getBuilder() {
		return builder;
	}

	/**
	 * @param builder the builder to set
	 */
	public void setBuilder(String builder) {
		this.builder = builder;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void addCategory( Category category ) {
		if ( !this.getCategories().contains(category)) {
			this.getCategories().add(category);
		}
		if (!category.getWidgetprofiles().contains(this)) {
			category.getWidgetprofiles().add(this);
		}
	}

	public void removeCategory (Category category ) {
		if ( this.getCategories().contains(category)) {
			this.getCategories().remove(category);
		}
		if ( category.getWidgetprofiles().contains(this)) {
			category.getWidgetprofiles().remove(this);
		}
	}

}


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

#include <nuttx/arch.h>
#include "up_internal.h"

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/****************************************************************************
 * Private Data
 ****************************************************************************/

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name: up_idle
 *
 * Description:
 *   up_idle() is the logic that will be executed when their is no other
 *   ready-to-run task.  This is processor idle time and will continue until
 *   some interrupt occurs to cause a context switch from the idle task.
 *
 *   Processing in this state may be processor-specific. e.g., this is where
 *   power management operations might be performed.
 *
 ****************************************************************************/

void up_idle(void)
{
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
  /* If the system is idle and there are no timer interrupts, then process
   * "fake" timer interrupts. Hopefully, something will wake up.
   */

  sched_process_timer();
#else

  /* This would be an appropriate place to put some MCU-specific logic to
   * sleep in a reduced power mode until an interrupt occurs to save power
   */

  /* This is a kludge that I still don't understand.  The call to kmm_trysemaphore()
   * in the os_start.c IDLE loop seems necessary for the good health of the IDLE
   * loop.  When the work queue is enabled, this logic is removed from the IDLE
   * loop and it appears that we are somehow left idling with interrupts non-
   * functional. The following should be no-op, it just disables then re-enables
   * interrupts.  But it fixes the problem and will stay here until I understand
   * the problem/fix better.
   *
   * And no, the contents of the CP0 status register are not incorrect.  But for
   * some reason the status register needs to be re-written again on this thread
   * for it to take effect.  This might be a PIC32-only issue?
   */

#ifdef CONFIG_SCHED_WORKQUEUE
  irqstate_t flags = irqsave();
  irqrestore(flags);
#endif
#endif
}


text:
package io.v.vdl.psi;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface VdlArgumentList extends VdlCompositeElement {

  @NotNull
  List<VdlExpression> getExpressionList();

  @NotNull
  PsiElement getLparen();

  @Nullable
  PsiElement getRparen();

  @Nullable
  PsiElement getTripleDot();

}


text:
==Readme==

Empty file.


text:
namespace base {
class SingleThreadTaskRunner;
}  // namespace base

namespace media {

// This class is the native version of MediaDrmStorageBridge in Java. It's used
// to talk to the concrete implementation for persistent data management.
class MediaDrmStorageBridge {
 public:
  using InitCB = base::OnceCallback<void(bool)>;

  MediaDrmStorageBridge();

  MediaDrmStorageBridge(const MediaDrmStorageBridge&) = delete;
  MediaDrmStorageBridge& operator=(const MediaDrmStorageBridge&) = delete;

  ~MediaDrmStorageBridge();

  // Once storage is initialized, |init_cb| will be called and it will have a
  // random generated origin id for later usage. If this function isn't called,
  // all the other functions will fail.
  void Initialize(const CreateStorageCB& create_storage_cb, InitCB init_cb);

  const std::string& origin_id() const { return origin_id_; }

  // The following OnXXX functions are called by Java. The functions will post
  // task on message loop immediately to avoid reentrancy issues.

  // Called by the java object when device provision is finished. Implementation
  // will record the time as provisioning time.
  void OnProvisioned(JNIEnv* env,
                     const base::android::JavaParamRef<jobject>& j_storage,
                     // Callback<Boolean>
                     const base::android::JavaParamRef<jobject>& j_callback);

  // Called by the java object to load session data into memory. |j_callback|
  // will return a null object if load fails.
  void OnLoadInfo(JNIEnv* env,
                  const base::android::JavaParamRef<jobject>& j_storage,
                  const base::android::JavaParamRef<jbyteArray>& j_session_id,
                  // Callback<PersistentInfo>
                  const base::android::JavaParamRef<jobject>& j_callback);

  // Called by the java object to persistent session data.
  void OnSaveInfo(JNIEnv* env,
                  const base::android::JavaParamRef<jobject>& j_storage,
                  // PersistentInfo
                  const base::android::JavaParamRef<jobject>& j_persist_info,
                  // Callback<Boolean>
                  const base::android::JavaParamRef<jobject>& j_callback);

  // Called by the java object to remove persistent session data.
  void OnClearInfo(JNIEnv* env,
                   const base::android::JavaParamRef<jobject>& j_storage,
                   const base::android::JavaParamRef<jbyteArray>& j_session_id,
                   // Callback<Boolean>
                   const base::android::JavaParamRef<jobject>& j_callback);

 private:
  void RunAndroidBoolCallback(JavaObjectPtr j_callback, bool success);
  void OnInitialized(InitCB init_cb,
                     bool success,
                     const MediaDrmStorage::MediaDrmOriginId& origin_id);
  void OnSessionDataLoaded(
      JavaObjectPtr j_callback,
      const std::string& session_id,
      std::unique_ptr<MediaDrmStorage::SessionData> session_data);

  std::unique_ptr<MediaDrmStorage> impl_;

  // Randomly generated ID for origin.
  std::string origin_id_;

  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;

  base::WeakPtrFactory<MediaDrmStorageBridge> weak_factory_{this};
};

}  // namespace media
#endif  // MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_BRIDGE_H_


text:
using namespace cn::vimfung::luascriptcore;

LuaNativeClassFactory& LuaNativeClassFactory::shareInstance()
{
    static LuaNativeClassFactory factory;
    return factory;
}

void LuaNativeClassFactory::registerClass(std::string const& className, LuaNativeClass* nativeClass)
{
    _classMap[className] = nativeClass;
}

LuaNativeClass* LuaNativeClassFactory::findClass(std::string const& className)
{
    LuaClassMap::iterator it = _classMap.find(className);
    if (it != _classMap.end())
    {
        return it -> second;
    }

    return NULL;
}


text:
from collections import OrderedDict

d = OrderedDict()
number_of_items = int(input().strip())
for i in range(number_of_items):
    item, delimeter, price = input().strip().rpartition(" ")
    price = int(price)
    if (item in d):
        previous_total_purchased = d.get(item)
        next_total_purchased = previous_total_purchased + price
        d[item] = next_total_purchased
    else:
        d[item] = price

for item, price in d.items():
    print (f'{item} {price}')


text:
{% extends "account/base.html" %}

{% load i18n %}
{% load account %}

{% block title %}{% trans 'Password Reset' %}{% endblock %}

{% block content %}

    {% if user.is_authenticated %}
    {% include "account/snippets/already_logged_in.html" %}
    {% endif %}

    <p>{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
{% endblock %}


text:
<rules
    xmlns="http://namespaces.plone.org/diazo"
    xmlns:css="http://namespaces.plone.org/diazo/css"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <theme href="theme.html" />

    <replace css:theme="#content" css:content="#content" if="$someparam = 'value1'" />

</rules>


text:
class CannotResolveRelativeException(Exception):
    pass

class WatermarkException(Exception):
    pass


text:
package com.themillhousegroup.gasket

import com.themillhousegroup.gasket.test.TestHelpers
import org.specs2.mutable.Specification
import org.specs2.mock.Mockito
import com.google.gdata.data.spreadsheet.CellEntry
import com.google.gdata.data.TextConstruct

class RowSpec extends Specification with Mockito with TestHelpers {

  def mockCellAt(column: Int, columnName: String) = {
    val mockTitle = mock[TextConstruct]
    mockTitle.getPlainText returns s"${columnName}99"

    val mockEntry = mock[CellEntry]
    mockEntry.getTitle returns mockTitle

    val mockCell = mock[Cell]
    mockCell.googleEntry returns mockEntry
    mockCell.colNumber returns column
    mockCell.value returns s"$columnName $column"
    mockCell
  }

  val mockCell1 = mockCellAt(3, "C")
  val mockCell2 = mockCellAt(6, "F")
  val row = Row(1, Seq(mockCell1, mockCell2))

  "cellAt(Int)" should {

    "return None if no cell at desired column" in {
      row.cellAt(0) must beNone
      row.cellAt(1) must beNone
    }

    "return the cell at desired column" in {
      row.cellAt(3) must beSome(mockCell1)
      row.cellAt(6) must beSome(mockCell2)
    }
  }

  "cellAt(String)" should {

    "return None if no cell at desired column" in {
      row.cellAt("A") must beNone
      row.cellAt("B") must beNone
    }

    "return the cell at desired column" in {
      row.cellAt("C") must beSome(mockCell1)
      row.cellAt("F") must beSome(mockCell2)
    }
  }

  "values" should {
    "return a sequence of strings" in {
      row.values must beEqualTo(Seq("C 3", "F 6"))
    }
  }

  "columnValues" should {
    "return a sequence of (Int, String) representing the column -> value" in {
      row.columnValues must beEqualTo(Seq(3 -> "C 3", 6 -> "F 6"))
    }
  }
}


text:
\mainpage
vvopensource
============

Introduction
------------

I write software for a living at [Vidvox](www.vidvox.net).  The more I write, the more I find myself using a couple basic classes, or putting together frameworks so I can re-use code.  This project is an ever-growing collection of simple frameworks which I can link against to reuse code I already wrote and make my life easier; hopefully, it makes your life a bit easier too.

All of these frameworks are contained in a single XCode project- as I write more frameworks, I link against code in other frameworks, so collecting everything together in a single project ensures that you can get everything necessary to compile all of these frameworks in one go- there are no external dependencies.  All of the code is always being worked on, and you should never assume that anything is "finished"- I would recommend updating the trunk whenever you get a chance.  Get in touch with me if you bump into an unfinished method or other oddity/problem- the code posted here is used in any number of other applications, and I'm always willing to fix or work on it.

How to get help
---------------

Please open an "issue".  If i'm really busy (a frequent occurrence) it may take a while for me to get back to you- sorry in advance!  Documentation is generated with 'Doxygen', and can be found here: [http://www.vidvox.net/rays_oddsnends/vvopensource_doc/index.html](http://www.vidvox.net/rays_oddsnends/vvopensource_doc/index.html)

What does this project include/do/make?
---------------------------------------

  * VVBasics is an Objective-C framework with a number of common classes which I find to be generally useful; other frameworks and applications in this project link against VVBasics.

  * VVOSC is an Objective-C framework for quickly and easily working with OSC data.  Capable of doing everything necessary to send and receive OSC data.  There are also targets for compiling, assembling, and installing an SDK which allows you to link against and use VVOSC on iPhones.

  * VVMIDI is an Objective-C framework for quickly and easily working with MIDI data.

  * VVUIToolbox is an objective-c framework that I use extensively to ease the process of creating UI items.  It contains a number of objects that standardize the act of creating, drawing, and interacting with sprites that work transparently with both NS and GL views.

  * VVBufferPool is an objective-c framework for creating and managing GL-backed resources.  This framework is used as the basis for the rendering engines I build for various proejcts, and is focused on the general goal of simplifying the task of "rendering to a texture" in an extensible manner to better work with a variety of APIs and formats.

  * DDMathParser is the [DDMathParser project by Dave DeLong](https://github.com/davedelong/DDMathParser) packaged up as a framework.  this is a slightly older version of DDMathParser (the last version capable of compiling 32-bit binaries capable of running on 10.6).  DDMathParser is used by VVISFKit to parse and evaluate mathematical expressions- it's a really neat project, you should check it out!

  * JSONKit is the [JSONKit project by John Engelhart](https://github.com/johnezang/JSONKit) packaged up as a framework.  VVISFKit uses JSONKit to read JSON blobs (NSJSONSerialization wasn't available until 10.7 and everything in this project can compile and run in 10.6).

  * VVISFKit is an objective-c framework that opens and renders ISF files.  ISF is a simple/minimal image filter format based on GLSL- more about ISF files can be found [here](http://vidvox.net/rays_oddsnends/ISF.html).

  * OSCTestApp is a Cocoa application used for testing and debugging OSC Applications (created entirely with VVOSC).  Capable of both sending and receiving a number of OSC data types, it also demonstrates the use of bonjour/zero-configuration networking to automatically auto-locate and set up OSC Input Ports for OSC destinations found on the local network.  In other words, two copies of OSCTestApp on different machines on the same local network will "see" each other, and automatically do the backend work necessary to send data to one another.

  * MIDITestApp is a Cocoa application (created using VVMIDI) used to demonstrate the sending and receiving of MIDI data.

  * MIDIviaOSC is a Cocoa application (created using VVMIDI and VVOSC) that lets you send MIDI data to another computer on the internet via OSC

  * the CrashReporterTestApp is a Cocoa application (created using VVBasics) which demonstrates the use of the VVCrashReporter class and can also be used to test your server-side implementation

  * GLScene Test App demonstrates how to do use the VVBufferPool framework to easily render-to-texture with a VVBuffer using generic GL drawing commands, as well as how to create a VVBuffer/GL texture from an image file.

  * QCGLScene Test App demonstrates how to use VVBufferPool to render QC compositions to GL textures, as well as how to do MSAA rendering for smoother output images under some circumstances

  * CIGLScene Test App demonstrates how to use VVBufferPool to convert CIImages to GL textures- this makes it very, very easy to work with CIFilters and GL textures.

  * ISFGLScene Test App demonstrates how to use VVBufferPool and VVISFKit to open, interact with, and render ISF files to GL textures

  * QT and Hap Test App demonstrates how to use VVBufferPool to render QuickTime movies to GL textures.  Also shows how to use VVBufferPool to decode Hap video frames.

I'm not a programmer, I just want to download a MIDI/OSC test application!
--------------------------------------------------------------------------

Here's an OSC test application:
http://vidvox.com/rays_oddsnends/vvopensource_downloads/OSCTestApp_0.2.4.zip

Here's an application that sends MIDI input on one computer to another computer over the network/internet using OSC:
http://vidvox.com/rays_oddsnends/vvopensource_downloads/MIDIviaOSC_0.1.3.zip

Here's an extremely crude MIDI test application ("MIDIMonitor" from snoize is much more comprehensive and fully-featured!):
http://vidvox.com/rays_oddsnends/vvopensource_downloads/MIDITestApp_1.0.5.zip

How to use these frameworks in your Mac application
---------------------------------------------------

The general idea is to compile the framework/frameworks you want to use, add them to your XCode project so you may link against them, and then set up a build phase to copy the framework into your application bundle.  This is fairly important: most of the time when you link against a framework, the framework is expected to be installed on your OS.  VVOSC, VVBasics, and VVMIDI are different: your application will include a compiled copy of the relevant framework(s), so you're guaranteed that the framework won't change outside of your control (which means you won't inherit bugs or have to deal with changed APIs until you're ready to do so).  Here's the exact procedure:

  1.  In XCode, close the VVOpenSource project (if it is open), and then open your project.
  2.  In the Finder, drag "VVOpenSource.xcodeproj" into your project's workspace.
  3.  Switch back to XCode, and locate the "Build Phases" section for your project/application's target.
  4.  Add a dependency for "vvopensource-Build Mac Frameworks".  This will ensure that all the frameworks in the vvopensource project get compiled before your project, so there won't be any missing dependencies.
  5.  Add the frameworks you want to use to the "Link Binary with Libraries" section.
  6.  Create a new "Copy Files" build phase, set its destination to the "Frameworks" folder, and add the frameworks you linked against in the previous step- the goal is to copy the frameworks you need into the "Frameworks" folder inside your app package.  When you click the "+" button to add the frameworks, they will be listed in the "Products" folder in the "vvopensource" project in your workspace.
  7.  Switch to the "Build Settings" section of your project's target, locate the "Runpath Search Paths" settings, and add the following paths: "@loader_path/../Frameworks" and "@executable_path/../Frameworks".
  8.  That's it- you're done now.  You can import/include objects from the framework in your source just as you normally would.

How to use these frameworks in a plugin
---------------------------------------

If you're writing a plugin, you need to weak-link against these frameworks.  If you don't do this and the host app which loads your plugin has a different version of these frameworks installed, you won't know which version of the framework will get used- which usually means a crash and/or generally confusing and buggy behavior.  You can prevent this by weak-linking against the frameworks: your plugin will still contain its own copy of the framework, but if the host app has already loaded a different version of the framework that will be used instead.

  1.  Follow the steps listed above for using these frameworks in a Mac application- you're going to be embedding a copy of these frameworks in your plugin just as you would for a mac app.
  2.  Double-click your plugin/target in the left-hand list of your project window (or select it and get its info).  Click on the "Build" tab, locate the "Other Linker Flags" setting, and add the following flags: "-weak_framework VVBasics", "-weak_framework VVOSC", "-weak_framework VVMIDI".

How to use VVOSC in your iPhone application
-------------------------------------------

In addition to frameworks for development of mac apps, this project can produce static libraries for use with iOS app creation.  Here's how to use the static libs in your project:
  1.  In XCode, close the VVOpenSource project (if it is open), and then open your project.
  2.  In the Finder, drag "VVOpenSource.xcodeproj" into your project's workspace
  3.  Switch back to XCode, and locate the "Build Phases" settings for your project's target.
  4.  Add a target dependency for "Build iOS static libs (VVOpenSource)".
  5.  Add "libVVBasics.a" and "libVVOSC.a" to the "Link Binary with Libraries" section.
  6.  In XCode, switch to the "Build Settings" for your application, and under the "Other Linker Flags" setting add the flag "-ObjC".
  7.  That's it- you're done now.  You can import/include objects from the VVOSC framework in your source code as you normally would (#import \<VVOSC/VVOSC.h\>).

Here's a quick video demonstrating the above steps:[http://vidvox.net/rays_oddsnends/addingVVOSC.mov].

Using VVBasics/VVOSC/etc. in closed-source iOS applications
-----------------------------------------------------------

At some point it was brought to my attention that the LGPL doesn't cover static libraries, so I hereby grant permission to treat the static lib compiled by this project as if it were a dynamic lib with respect to the terms of the LGPL.  All the terms and provisions which apply to dynamic libs are conferred to the VVOSC SDK.  If you have a question about this, feel free to either email me directly or open an issue in the project for clarification.

Documentation and sample code
-----------------------------

Doxygen was used to generate documentation for most things in this project, which can be found here:

[http://www.vidvox.net/rays_oddsnends/vvopensource_doc/index.html]

...if you're reading this on the doc page, start by checking out the "Modules", which breaks down the documentation by framework!

Licensing
---------

This project is made available under the terms of the LGPL: http://www.gnu.org/copyleft/lesser.html.  Some classes in this project use code from other open-source projects- all third-party code and licensing information is located in the top-level "external" directory.  At present, the third-party code used includes MAZeroingWeakRef from Mike Ash, DDMathParser from Dave DeLong, and JSONKit by John Engelhart.


text:
<?php

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;

/**
 * Class BucketScript.
 *
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
 */
class BucketScript extends AbstractAggregation
{
    public function __construct(string $name, ?array $bucketsPath = null, ?string $script = null)
    {
        parent::__construct($name);

        if (null !== $bucketsPath) {
            $this->setBucketsPath($bucketsPath);
        }

        if (null !== $script) {
            $this->setScript($script);
        }
    }

    /**
     * Set the buckets_path for this aggregation.
     *
     * @return $this
     */
    public function setBucketsPath(array $bucketsPath): self
    {
        return $this->setParam('buckets_path', $bucketsPath);
    }

    /**
     * Set the script for this aggregation.
     *
     * @return $this
     */
    public function setScript(string $script): self
    {
        return $this->setParam('script', $script);
    }

    /**
     * Set the gap policy for this aggregation.
     *
     * @return $this
     */
    public function setGapPolicy(string $gapPolicy = 'skip'): self
    {
        return $this->setParam('gap_policy', $gapPolicy);
    }

    /**
     * Set the format for this aggregation.
     *
     * @return $this
     */
    public function setFormat(?string $format = null): self
    {
        return $this->setParam('format', $format);
    }

    /**
     * @throws InvalidException If buckets path or script is not set
     */
    public function toArray(): array
    {
        if (!$this->hasParam('buckets_path')) {
            throw new InvalidException('Buckets path is required');
        }
        if (!$this->hasParam('script')) {
            throw new InvalidException('Script parameter is required');
        }

        return parent::toArray();
    }
}


text:
default_target: all
.PHONY : default_target

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/local/bin/cmake

# The command to remove a file.
RM = /usr/local/bin/cmake -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
	/usr/local/bin/cmake -i .
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target install
install: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	/usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install

# Special rule for the target install
install/fast: preinstall/fast
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	/usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install/fast

# Special rule for the target install/local
install/local: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
	/usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local

# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast

# Special rule for the target install/strip
install/strip: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
	/usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip

# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast

# Special rule for the target list_install_components
list_install_components:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components

# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast

# Special rule for the target package
package: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && /usr/local/bin/cpack --config ./CPackConfig.cmake
.PHONY : package

# Special rule for the target package
package/fast: package
.PHONY : package/fast

# Special rule for the target package_source
package_source:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && /usr/local/bin/cpack --config ./CPackSourceConfig.cmake /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build/CPackSourceConfig.cmake
.PHONY : package_source

# Special rule for the target package_source
package_source/fast: package_source
.PHONY : package_source/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	/usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(CMAKE_COMMAND) -E cmake_progress_start /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build/CMakeFiles /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build/Samples/SkyBox/CMakeFiles/progress.marks
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f CMakeFiles/Makefile2 Samples/SkyBox/all
	$(CMAKE_COMMAND) -E cmake_progress_start /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f CMakeFiles/Makefile2 Samples/SkyBox/clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f CMakeFiles/Makefile2 Samples/SkyBox/preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f CMakeFiles/Makefile2 Samples/SkyBox/preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

# Convenience name for target.
Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/rule:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f CMakeFiles/Makefile2 Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/rule
.PHONY : Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/rule

# Convenience name for target.
Sample_SkyBox: Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/rule
.PHONY : Sample_SkyBox

# fast build rule for target.
Sample_SkyBox/fast:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/build.make Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/build
.PHONY : Sample_SkyBox/fast

src/SkyBox.o: src/SkyBox.cpp.o
.PHONY : src/SkyBox.o

# target to build an object file
src/SkyBox.cpp.o:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/build.make Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/src/SkyBox.cpp.o
.PHONY : src/SkyBox.cpp.o

src/SkyBox.i: src/SkyBox.cpp.i
.PHONY : src/SkyBox.i

# target to preprocess a source file
src/SkyBox.cpp.i:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/build.make Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/src/SkyBox.cpp.i
.PHONY : src/SkyBox.cpp.i

src/SkyBox.s: src/SkyBox.cpp.s
.PHONY : src/SkyBox.s

# target to generate assembly for a file
src/SkyBox.cpp.s:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(MAKE) -f Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/build.make Samples/SkyBox/CMakeFiles/Sample_SkyBox.dir/src/SkyBox.cpp.s
.PHONY : src/SkyBox.cpp.s

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... Sample_SkyBox"
	@echo "... edit_cache"
	@echo "... install"
	@echo "... install/local"
	@echo "... install/strip"
	@echo "... list_install_components"
	@echo "... package"
	@echo "... package_source"
	@echo "... rebuild_cache"
	@echo "... src/SkyBox.o"
	@echo "... src/SkyBox.i"
	@echo "... src/SkyBox.s"
.PHONY : help

#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	cd /home/jeff/dev/dev_apps/sand/ogre/ogre_src_v1-8-1/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system


text:
<?php

namespace PHPUnit\Extensions\Selenium2TestCase\SessionStrategy;

use PHPUnit\Extensions\Selenium2TestCase\Session;
use PHPUnit\Extensions\Selenium2TestCase\SessionStrategy;

/**
 * Keeps a Session object shared between test runs to save time.
 *
 * @package    PHPUnit_Selenium
 * @author     Giorgio Sironi <info@giorgiosironi.com>
 * @copyright  2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
 * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
 * @version    Release: @package_version@
 * @link       http://www.phpunit.de/
 * @since      Class available since Release 1.2.6
 */
class Shared implements SessionStrategy
{
    private $original;
    private $session;
    private $mainWindow;
    private $lastTestWasNotSuccessful = FALSE;
    private $keepSessionOnFailure;

    public function __construct(SessionStrategy $originalStrategy, $keepSessionOnFailure)
    {
        $this->original = $originalStrategy;
        $this->keepSessionOnFailure = $keepSessionOnFailure;
    }

    public function session(array $parameters)
    {
        if ($this->lastTestWasNotSuccessful && !$this->keepSessionOnFailure) {
            if ($this->session !== NULL) {
                $this->session->stop();
                $this->session = NULL;
            }
            $this->lastTestWasNotSuccessful = FALSE;
        }
        if ($this->session === NULL) {
            $this->session = $this->original->session($parameters);
            $this->mainWindow = $this->session->windowHandle();
        } else {
            $this->session->window($this->mainWindow);
        }
        return $this->session;
    }

    public function notSuccessfulTest()
    {
        $this->lastTestWasNotSuccessful = TRUE;
    }

    public function endOfTest(Session $session = NULL)
    {
    }
}


text:
'use strict'

var ldap    = require('ldapjs'),
    q       = require('q');

function Ldap(serviceLocator) {
    this.sl = serviceLocator;

    this.sl.set('ldap', this);
}

module.exports = Ldap;

Ldap.prototype.getClient = function () {
    if (typeof this.client != 'undefined')  // for tests
        return this.client;

    var config = this.sl.get('config');

    var client = ldap.createClient({
        url: config['ldap']['url'],
        timeout: 5000,
    });

    // we are not saving client to 'this' because
    // client must be recreated before each bind
    return client;
};

Ldap.prototype.authenticate = function (login, password) {
    var config = this.sl.get('config'),
        db = this.sl.get('database'),
        logger = this.sl.get('logger'),
        client = this.getClient(),
        defer = q.defer();

    if (!config['ldap']['enable']) {
        defer.resolve(false);
        return defer.promise;
    }

    var fullLogin = login;
    if (config['ldap']['domain'])
        fullLogin += '@' + config['ldap']['domain'];

    client.bind(fullLogin, password, function (err) {
        if (err) {
            if (err.name == 'InvalidCredentialsError') {
                logger.info('LDAP: Invalid credentials for ' + login);
                defer.resolve(false);
            } else {
                logger.error('LDAP bind', err);
                defer.reject(err);
            }
            client.unbind();
            return;
        }

        var opts = {
            filter: '(&(objectclass=user)(samaccountname='+login+'))',
            scope: 'sub',
            attributes: [config['ldap']['email_attr_name']]
        };

        client.search(config['ldap']['users_group'], opts, function (err, search) {
            if (err) {
                logger.error('LDAP search', err);
                defer.reject(err);
                client.unbind();
                return;
            }

            var email = null;
            search.on('searchEntry', function (entry) {
                if (!entry.object)
                    return;

                email = entry.object[config['ldap']['email_attr_name']];
                if (typeof email == 'undefined')
                    email = null;
                else
                    email = email.trim().toLowerCase();
            });

            search.on('end', function (result) {
                db.selectUsers({ login: login })
                    .then(function (users) {
                        var user = users.length && users[0];
                        if (user) {
                            db.setUserEmail(user['id'], email);
                            defer.resolve(true);
                            client.unbind();
                            return;
                        }

                        db.createUser(login, null, email)
                            .then(function () {
                                defer.resolve(true);
                                client.unbind();
                            })
                            .catch(function (err) {
                                defer.reject(err);
                                client.unbind();
                            });
                    })
                    .catch(function (err) {
                        defer.reject(err);
                        client.unbind();
                    });
            });

            search.on('error', function (err) {
                logger.error('LDAP search error event', err);
                defer.reject(err);
                client.unbind();
            });
        });
    });

    return defer.promise;
};


text:
from __future__ import unicode_literals

""" Integration tests against zimbraAdmin SOAP webservice

It has to be tested against a zimbra server (see README.md)
"""

import unittest
import random
from zimsoap.client import (
    DomainHasNoPreAuthKey, ZimbraAccountClient, ZimbraAdminClient,
    ZimbraAPISession, ZimbraSoapServerError)
from zimsoap.zobjects import (
    Account, CalendarResource, ClassOfService, COS, DistributionList, Domain,
    Mailbox, Server)
try:
    from urllib2 import URLError
except ImportError:
    from urllib.request import URLError
from six import text_type, binary_type, assertRegex

import tests

TEST_CONF = tests.get_config()

class ZimbraAdminClientTests(unittest.TestCase):
    def setUp(self):
        self.TEST_SERVER = TEST_CONF['host']
        self.TEST_LOGIN = TEST_CONF['admin_login']
        self.TEST_PASSWORD = TEST_CONF['admin_password']
        self.TEST_ADMIN_PORT = TEST_CONF['admin_port']
        self.LAMBDA_USER = TEST_CONF['lambda_user']
        self.SERVER_NAME = TEST_CONF['server_name']

    def testLogin(self):
        zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
        zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)
        self.assertTrue(zc._session.is_logged_in())

    def testBadLoginFailure(self):
        with self.assertRaises(ZimbraSoapServerError) as cm:
            zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
            zc.login('badlogin@zimbratest.example.com', self.TEST_PASSWORD)

        self.assertIn('authentication failed', cm.exception.msg)

    def testBadPasswordFailure(self):
        with self.assertRaises(ZimbraSoapServerError) as cm:
            zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
            zc.login(self.TEST_LOGIN, 'badpassword')

        self.assertIn('authentication failed', cm.exception.msg)

    def testBadHostFailure(self):
        with self.assertRaises(URLError):
            zc = ZimbraAdminClient('nonexistanthost.example.com',
                                   self.TEST_ADMIN_PORT)
            zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)

    def testBadPortFailure(self):
        with self.assertRaises(URLError):
            zc = ZimbraAdminClient(self.TEST_SERVER, 9999)
            zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)

class ZimbraAdminClientRequests(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        # Login/connection is done at class initialization to reduce tests time
        cls.zc = ZimbraAdminClient(TEST_CONF['host'], TEST_CONF['admin_port'])
        cls.zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

    def setUp(self):
        self.EXISTANT_DOMAIN = TEST_CONF['domain_1']
        self.EXISTANT_MBOX_ID = "d78fd9c9-f000-440b-bce6-ea938d40fa2d"
        # Should not exist before the tests
        self.TEST_DL_NAME = 'unittest-test-list-1@%s' % self.EXISTANT_DOMAIN

    def tearDown(self):
        # Try to delete a relief test distribution list (if any)
        try:
            resp = self.zc.request('GetDistributionList', {
                'dl': {'by': 'name', '_content': self.TEST_DL_NAME}
            })

            dl_id = resp['dl']['id']
            self.zc.request('DeleteDistributionList', {'id': dl_id})

        except ZimbraSoapServerError:
            pass

    def testGetAllAccountsReturnsSomething(self):
        resp = self.zc.request('GetAllAccounts')
        self.assertTrue(('account' in resp), list)
        self.assertIsInstance(resp['account'], list)

    def testGetAlllCalendarResourcesReturnsSomething(self):
        resp = self.zc.request_list('GetAllCalendarResources')
        self.assertIsInstance(resp, list)

    def testGetAllDomainsReturnsSomething(self):
        resp = self.zc.request('GetAllDomains')
        self.assertTrue(('domain' in resp), list)
        self.assertIsInstance(resp['domain'], list)

    def testGetDomainReturnsDomain(self):
        resp = self.zc.request('GetDomain', {'domain': {
            'by': 'name',
            '_content': self.EXISTANT_DOMAIN
        }})
        self.assertIsInstance(resp, dict)
        self.assertTrue('domain' in resp)
        self.assertIsInstance(resp['domain'], dict)

    def testGetMailboxStatsReturnsSomething(self):
        resp = self.zc.request('GetMailboxStats')
        self.assertTrue('stats' in resp)
        self.assertIsInstance(resp['stats'], dict)

    def testCountAccountReturnsSomething(self):
        """Count accounts on the first of domains"""

        resp = self.zc.request_list(
            'CountAccount',
            {'domain': {'by': 'name', '_content': self.EXISTANT_DOMAIN}}
        )
        first_cos = resp[0]
        self.assertTrue('id' in first_cos)

        # will fail if not convertible to int
        self.assertIsInstance(int(first_cos['_content']), int)

    def testGetMailboxRequest(self):
        try:
            EXISTANT_MBOX_ID = self.testGetAllMailboxes()[0]['accountId']
        except Exception as e:
            raise e('failed in self.testGetAllMailboxes()')

        resp = self.zc.request(
            'GetMailbox', {'mbox': {'id': EXISTANT_MBOX_ID}})
        self.assertIsInstance(resp['mbox'], dict)
        self.assertTrue('mbxid' in resp['mbox'])

    def testGetAllMailboxes(self):
        resp = self.zc.request('GetAllMailboxes')
        mailboxes = resp['mbox']
        self.assertIsInstance(resp['mbox'], list)
        return mailboxes

    def testCreateGetDeleteDistributionList(self):
        """ As Getting and deleting a list requires it to exist
        a list to exist, we group the 3 tests together.
        """

        def createDistributionList(name):
            resp = self.zc.request('CreateDistributionList', {'name': name})

            self.assertIsInstance(resp['dl'], dict)

        def getDistributionList(name):
            resp = self.zc.request('GetDistributionList',
                                   {'dl': {'by': 'name', '_content': name}})

            self.assertIsInstance(resp['dl'], dict)
            self.assertIsInstance(resp['dl']['id'], text_type)
            return resp['dl']['id']

        def deleteDistributionList(dl_id):
            self.zc.request('DeleteDistributionList', {'id': dl_id})

        # Should not exist
        with self.assertRaises(ZimbraSoapServerError):
            getDistributionList(self.TEST_DL_NAME)

        createDistributionList(self.TEST_DL_NAME)

        # It should now exist
        list_id = getDistributionList(self.TEST_DL_NAME)

        deleteDistributionList(list_id)

        # Should no longer exists
        with self.assertRaises(ZimbraSoapServerError):
            getDistributionList(self.TEST_DL_NAME)

    def testCheckDomainMXRecord(self):
        domain = {'by': 'name', '_content': self.EXISTANT_DOMAIN}
        try:
            self.zc.request('CheckDomainMXRecord', {'domain': domain})

        except ZimbraSoapServerError as sf:
            if 'NameNotFoundException' not in str(sf):
                # Accept for the moment this exception as it's kind a response
                # from server.
                raise

    def testGetAccount(self):
        account = {'by': 'name', '_content': TEST_CONF['lambda_user']}
        resp = self.zc.request('GetAccount', {'account': account})
        self.assertIsInstance(resp['account'], dict)

    def testGetAccountInfo(self):
        account = {'by': 'name', '_content': TEST_CONF['lambda_user']}
        resp = self.zc.request('GetAccountInfo', {'account': account})
        self.assertIsInstance(resp['cos']['id'], (text_type, binary_type))

    def testSearchDirectory(self):
        resp = self.zc.search_directory(
            query='mail=%s' % TEST_CONF['lambda_user'])

        self.assertEqual(resp['account'].name, TEST_CONF['lambda_user'])

        resp = self.zc.search_directory(
            query='dc=zimbratest', types='domains')

        self.assertEqual(resp['domain'].name, 'zimbratest.example.com')

class PythonicAdminAPITests(unittest.TestCase):
    """ Tests the pythonic API, the one that should be accessed by someone using
    the library, zimbraAdmin features.
    """

    @classmethod
    def setUpClass(cls):
        # Login/connection is done at class initialization to reduce tests time
        cls.zc = ZimbraAdminClient(TEST_CONF['host'],
                                   TEST_CONF['admin_port'])
        cls.zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

    def setUp(self):
        self.HOST = TEST_CONF['host']
        self.ADMIN_PASSWORD = TEST_CONF['admin_password']
        self.ADMIN_PORT = TEST_CONF['admin_port']
        self.ADMIN_LOGIN = TEST_CONF['admin_login']
        self.LAMBDA_USER = TEST_CONF['lambda_user']
        self.DOMAIN1 = TEST_CONF['domain_1']
        self.DOMAIN2 = TEST_CONF['domain_2']
        self.TMP_DOMAIN = 'oazimtools.test'
        self.SERVER_NAME = TEST_CONF['server_name']

        self.EXISTANT_MBOX_ID = "d78fd9c9-f000-440b-bce6-ea938d40fa2d"
        # Should not exist before the tests
        self.TEST_DL_NAME = 'unittest-test-list-1@%s' % self.DOMAIN1

    def tearDown(self):
        try:
            self.zc.delete_distribution_list(
                DistributionList(name=self.TEST_DL_NAME))
        except (ZimbraSoapServerError, KeyError):
            pass

    def test_get_all_domains(self):
        doms = self.zc.get_all_domains()
        self.assertIsInstance(doms, list)
        self.assertIsInstance(doms[0], Domain)

        # Look for client1.unbound.example.com
        found = False
        for i in doms:
            if i.name == self.DOMAIN1:
                found = True

        self.assertTrue(found)

    def test_create_delete_domain(self):

        # CREATE
        self.zc.create_domain(self.TMP_DOMAIN)
        dom = self.zc.get_domain(Domain(name=self.TMP_DOMAIN))

        self.assertIsInstance(dom, Domain)
        self.assertEqual(dom.name, self.TMP_DOMAIN)

        # DELETE
        self.zc.delete_domain(dom)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_domain(dom)

    def test_create_delete_forced_domain(self):
        account_mail = 'test_user@' + self.TMP_DOMAIN
        cal_res_mail = 'test_res@' + self.TMP_DOMAIN
        alias_name = self.LAMBDA_USER.split('@')[0] + '@' + self.TMP_DOMAIN
        dl_mail = 'test_dl@' + self.TMP_DOMAIN

        # CREATE
        self.zc.create_domain(self.TMP_DOMAIN)
        dom = self.zc.get_domain(Domain(name=self.TMP_DOMAIN))

        self.assertIsInstance(dom, Domain)
        self.assertEqual(dom.name, self.TMP_DOMAIN)

        self.zc.create_account(account_mail, 'pass1234')
        self.zc.create_calendar_resource(cal_res_mail, attrs={
            'displayName': 'test display name',
            'zimbraCalResType': CalendarResource.EQUIPMENT_TYPE
        })
        self.zc.add_account_alias(Account(name=self.LAMBDA_USER), alias_name)
        self.zc.create_distribution_list(dl_mail)

        # DELETE
        self.zc.delete_domain_forced(dom)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_domain(dom)

    def test_get_domain(self):
        dom = self.zc.get_domain(Domain(name=self.DOMAIN1))
        self.assertIsInstance(dom, Domain)
        self.assertEqual(dom.name, self.DOMAIN1)

    def test_modify_domain(self):
        rand_str = random.randint(0, 10**9)

        dom = self.zc.get_domain(Domain(name=self.DOMAIN1))
        a = {'zimbraAutoProvNotificationBody': rand_str}
        self.zc.modify_domain(dom, a)

        dom = self.zc.get_domain(Domain(name=self.DOMAIN1))
        self.assertEqual(dom['zimbraAutoProvNotificationBody'], rand_str)

    def test_get_all_accounts(self):
        accounts = self.zc.get_all_accounts()
        self.assertIsInstance(accounts[0], Account)
        self.assertEqual(len(accounts), 17)

    def test_get_all_accounts_by_single_server(self):
        test_server = Server(name=self.SERVER_NAME)
        accounts = self.zc.get_all_accounts(server=test_server)
        self.assertIsInstance(accounts[0], Account)
        self.assertEqual(len(accounts), 17)

    def test_get_all_accounts_by_single_domain(self):
        test_domain = Domain(name=self.DOMAIN2)
        accounts = self.zc.get_all_accounts(domain=test_domain)
        self.assertIsInstance(accounts[0], Account)
        self.assertEqual(len(accounts), 5)

    def test_get_all_accounts_by_single_domain_and_server(self):
        test_domain = Domain(name=self.DOMAIN2)
        test_server = Server(name=self.SERVER_NAME)
        accounts = self.zc.get_all_accounts(domain=test_domain,
                                            server=test_server)
        self.assertIsInstance(accounts[0], Account)
        self.assertEqual(len(accounts), 5)

    def test_get_all_accounts_exclusion_filters(self):
        # The self.DOMAIN1 contains 5 user accounts, 1 system and 1 admin
        test_domain = Domain(name=self.DOMAIN1)

        accounts = self.zc.get_all_accounts(
            domain=test_domain,
            include_system_accounts=True, include_admin_accounts=True)
        self.assertEqual(len(accounts), 7)

        accounts_no_admin = self.zc.get_all_accounts(
            domain=test_domain,
            include_system_accounts=True, include_admin_accounts=False)
        self.assertEqual(len(accounts_no_admin), 6)

        accounts_no_system = self.zc.get_all_accounts(
            domain=test_domain,
            include_system_accounts=False, include_admin_accounts=True)
        self.assertEqual(len(accounts_no_system), 6)

        accounts_no_admin_no_system = self.zc.get_all_accounts(
            domain=test_domain,
            include_admin_accounts=False, include_system_accounts=False)
        self.assertEqual(len(accounts_no_admin_no_system), 5)

    def test_get_all_calendar_resources(self):
        resources = self.zc.get_all_calendar_resources()
        self.assertIsInstance(resources[0], CalendarResource)
        self.assertEqual(len(resources), 2)

    def test_get_all_calendar_resources_by_single_server(self):
        test_server = Server(name=self.SERVER_NAME)
        resources = self.zc.get_all_calendar_resources(server=test_server)
        self.assertIsInstance(resources[0], CalendarResource)
        self.assertEqual(len(resources), 2)

    def test_get_all_calendar_resources_by_single_domain(self):
        test_domain = Domain(name=self.DOMAIN2)
        resources = self.zc.get_all_calendar_resources(domain=test_domain)
        self.assertEqual(len(resources), 1)

    def test_get_calendar_resource(self):
        calendar_resource = self.zc.get_calendar_resource(
            CalendarResource(name=TEST_CONF['calres1']))
        self.assertIsInstance(calendar_resource, CalendarResource)
        self.assertEqual(calendar_resource.name, TEST_CONF['calres1'])

        # Now grab it by ID
        calendar_resource_by_id = self.zc.get_calendar_resource(
            CalendarResource(id=calendar_resource.id))
        self.assertIsInstance(calendar_resource_by_id, CalendarResource)
        self.assertEqual(calendar_resource_by_id.name, TEST_CONF['calres1'])
        self.assertEqual(calendar_resource_by_id.id, calendar_resource.id)

    def test_get_quota_usage(self):
        resp = self.zc.get_quota_usage()
        for account in resp:
            if account['name'] == 'mackerel@zimbratest3.example.com':
                quota_user = account

        self.assertIsInstance(resp, list)
        self.assertEqual(quota_user['used'], '0')
        self.assertEqual(quota_user['limit'], '0')

    def test_create_get_update_delete_calendar_resource(self):
        name = 'test-{}@zimbratest.example.com'.format(
            random.randint(0, 10**9))
        new_name = 'new-{}@zimbratest.example.com'.format(
            random.randint(0, 10**9))
        res_req = CalendarResource(name=name)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_calendar_resource(res_req)

        # CREATE
        res = self.zc.create_calendar_resource(name, attrs={
            'displayName': 'test display name',
            'zimbraCalResType': CalendarResource.EQUIPMENT_TYPE
        })

        self.assertIsInstance(res, CalendarResource)
        self.assertEqual(res.name, name)

        # GET
        res_got = self.zc.get_calendar_resource(res_req)
        self.assertIsInstance(res_got, CalendarResource)
        self.assertEqual(res.name, name)

        # UPDATE
        random_name_1 = 'test-{}'.format(random.randint(0, 10**9))
        self.zc.modify_calendar_resource(res_got,
                                         {'displayName': random_name_1})

        res_got = self.zc.get_calendar_resource(res_req)
        self.assertEqual(res_got['displayName'], random_name_1)

        # RENAME
        new_r = self.zc.rename_calendar_resource(res_got, new_name)
        self.assertEqual(new_r.name, new_name)

        # DELETE
        self.zc.delete_calendar_resource(res_got)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_calendar_resource(res)

    def test_create_get_update_rename_delete_account(self):
        name = 'test-{}@zimbratest.example.com'.format(
            random.randint(0, 10**9))
        password = 'pass124'
        ac_req = Account(name=name)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_account(ac_req)

        # CREATE
        ac = self.zc.create_account(name, password)

        self.assertIsInstance(ac, Account)
        self.assertEqual(ac.name, name)

        # GET
        ac_got = self.zc.get_account(ac_req)
        self.assertIsInstance(ac_got, Account)
        self.assertEqual(ac_got.name, name)

        # UPDATE
        random_name_1 = 'test-{}'.format(random.randint(0, 10**9))
        self.zc.modify_account(ac_got, {'displayName': random_name_1})

        ac_got = self.zc.get_account(ac_req)
        self.assertEqual(ac_got['displayName'], random_name_1)

        # MODIFY PASSWORD
        new_password = 'new_pass1234'
        self.zc.set_password(ac, new_password)

        act_zc = ZimbraAccountClient(TEST_CONF['host'],
                                     TEST_CONF['https_port'])

        try:
            act_zc.login(ac.name, new_password)
        except ZimbraSoapServerError:
            self.fail('self.zc.set_password has failed to change password')

        # RENAME
        self.zc.rename_account(
            ac_got, 'renamed_account@zimbratest.example.com')

        renamed_ac_got = self.zc.get_account(
            Account(name='renamed_account@zimbratest.example.com'))
        self.assertEqual(renamed_ac_got['mail'],
                         'renamed_account@zimbratest.example.com')

        # DELETE
        self.zc.delete_account(renamed_ac_got)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_account(ac)

    def test_create_delete_account_alias(self):

        # prepare account

        ac_name = 'test-{}@zimbratest.example.com'.format(
            random.randint(0, 10**9))
        ac = self.zc.create_account(ac_name, 'pass1234')

        alias_name = 'test-{}@zimbratest.example.com'.format(
            random.randint(0, 10**9))

        # CREATE
        retval = self.zc.add_account_alias(Account(name=ac_name), alias_name)

        self.assertEqual(retval, None)

        # GET
        ac_got = self.zc.get_account(Account(name=ac_name))
        self.assertIn(alias_name, ac_got['mail'])

        # DELETE
        self.zc.remove_account_alias(ac, alias_name)

        # GET
        ac_got = self.zc.get_account(Account(name=ac_name))
        self.assertNotIn(alias_name, ac_got['mail'])

        self.zc.delete_account(ac)

    def test_get_mailbox_stats(self):
        stats = self.zc.get_mailbox_stats()
        self.assertIsInstance(stats, dict)
        self.assertIsInstance(stats['numMboxes'], int)
        self.assertIsInstance(stats['totalSize'], int)

    def test_count_account(self):
        d = Domain(name=self.DOMAIN1)

        # ex return: list: ((<ClassOfService object>, <int>), ...)
        cos_counts = self.zc.count_account(d)

        self.assertIsInstance(cos_counts, list)
        self.assertIsInstance(cos_counts[0], tuple)
        self.assertIsInstance(cos_counts[0][0],
                              ClassOfService)
        self.assertIsInstance(cos_counts[0][1], int)

    def test_get_all_mailboxes(self):
        mboxes = self.zc.get_all_mailboxes()
        self.assertIsInstance(mboxes, list)
        self.assertIsInstance(mboxes[0], Mailbox)

    def test_account_mailbox(self):
        # First, fetch an existing account_id
        first_account_id = self.zc.get_all_mailboxes()[0].accountId

        mbox = self.zc.get_account_mailbox(first_account_id)
        self.assertTrue(hasattr(mbox, 'mbxid'))
        self.assertTrue(hasattr(mbox, 's'))  # size

    def test_create_get_modify_rename_delete_distribution_list(self):
        name = self.TEST_DL_NAME
        dl_req = DistributionList(name=name)

        with self.assertRaises(ZimbraSoapServerError):
            print(self.zc.get_distribution_list(dl_req))

        # CREATE
        dl = self.zc.create_distribution_list(name)
        self.assertIsInstance(dl, DistributionList)
        self.assertEqual(dl.name, name)

        # GET ALL
        dl_list = self.zc.get_all_distribution_lists()
        self.assertIsInstance(dl_list[1], DistributionList)

        # MODIFY
        self.zc.add_distribution_list_member(
            dl, ['someone@example.com', 'another@example.com'])

        dl_membered = self.zc.get_distribution_list(dl_req)
        self.assertEqual(
            set(dl_membered.members),
            set(['someone@example.com', 'another@example.com']))

        self.zc.remove_distribution_list_member(
            dl, ['someone@example.com'])
        dl_unmembered = self.zc.get_distribution_list(dl_req)
        self.assertEqual(dl_unmembered.members, ['another@example.com'])

        rand = 'list-{}'.format(random.randint(0, 10**9))
        self.zc.modify_distribution_list(dl, {'displayName': rand})
        dl_modified = self.zc.get_distribution_list(dl_req)
        self.assertEqual(dl_modified.property('displayName'), rand)

        # GET
        dl_got = self.zc.get_distribution_list(dl_req)
        self.assertIsInstance(dl_got, DistributionList)
        self.assertEqual(dl_got, dl_list[1])

        # RENAME
        new_dl = self.zc.rename_distribution_list(
            dl_got,
            'new_dl_name@zimbratest.example.com')
        self.assertEqual(new_dl.name, 'new_dl_name@zimbratest.example.com')

        # ALIAS
        alias_name = 'new_dl_name_alias@zimbratest.example.com'
        self.zc.add_distribution_list_alias(new_dl, alias_name)
        new_dl_got = self.zc.get_distribution_list(
            DistributionList(name=new_dl.name)
        )
        if alias_name in new_dl_got.property('zimbraMailAlias'):
            alias_present = True
        else:
            alias_present = False
        self.assertTrue(alias_present)

        self.zc.remove_distribution_list_alias(new_dl, alias_name)

        new_dl_got = self.zc.get_distribution_list(
            DistributionList(name=new_dl.name)
        )
        if alias_name in new_dl_got.property('zimbraMailAlias'):
            alias_present = True
        else:
            alias_present = False
        self.assertFalse(alias_present)

        # DELETE
        self.zc.delete_distribution_list(new_dl)

        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_distribution_list(dl)

    def test_delete_distribution_list_by_name(self):
        name = self.TEST_DL_NAME
        dl_req = DistributionList(name=name)
        dl_full = self.zc.create_distribution_list(name)
        self.zc.delete_distribution_list(dl_req)

        # List with such a name does not exist
        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_distribution_list(dl_req)

        # List with such an ID does not exist
        with self.assertRaises(ZimbraSoapServerError):
            self.zc.get_distribution_list(dl_full)

    def test_get_account(self):
        account = self.zc.get_account(Account(name=self.LAMBDA_USER))
        self.assertIsInstance(account, Account)
        self.assertEqual(account.name, self.LAMBDA_USER)

        # Now grab it by ID
        account_by_id = self.zc.get_account(Account(id=account.id))
        self.assertIsInstance(account_by_id, Account)
        self.assertEqual(account_by_id.name, self.LAMBDA_USER)
        self.assertEqual(account_by_id.id, account.id)

    def test_get_account_cos(self):
        cos = self.zc.get_account_cos(Account(name=self.LAMBDA_USER))
        self.assertIsInstance(cos, COS)
        self.assertEqual(cos.name, 'default')
        assertRegex(self, cos.id, r'[\w\-]{36}')

    def test_mk_auth_token_succeeds(self):
        user = Account(name='admin@{0}'.format(self.DOMAIN1))
        tk = self.zc.mk_auth_token(user, 0)
        self.assertIsInstance(tk, str)

    def test_mk_auth_token_fails_if_no_key(self):
        user = Account(name='admin@{0}'.format(self.DOMAIN2))

        with self.assertRaises(DomainHasNoPreAuthKey):
            self.zc.mk_auth_token(user, 0)

    def test_admin_get_logged_in_by(self):
        new_zc = ZimbraAdminClient(self.HOST, self.ADMIN_PORT)
        new_zc.get_logged_in_by(self.ADMIN_LOGIN, self.zc)
        self.assertTrue(new_zc._session.is_logged_in())
        self.assertTrue(new_zc.is_session_valid())

    def test_deprecated_admin_delegate_auth(self):
        # Cannot assertWarns before py3.2
        zc_account = self.zc.delegate_auth(Account(name=self.LAMBDA_USER))
        self.assertTrue(zc_account._session.is_logged_in())
        self.assertTrue(zc_account.is_session_valid())

    def test_admin_get_account_authToken1(self):
        """ From an existing account """
        authToken, lifetime = self.zc.get_account_authToken(
            account=Account(name=self.LAMBDA_USER)
        )
        new_zc = ZimbraAccountClient(self.HOST)
        new_zc.login_with_authToken(authToken, lifetime)
        self.assertTrue(new_zc._session.is_logged_in())
        self.assertTrue(new_zc.is_session_valid())

    def test_admin_get_account_authToken2(self):
        """ From an account name """
        authToken, lifetime = self.zc.get_account_authToken(
            account_name=self.LAMBDA_USER
        )
        new_zc = ZimbraAccountClient(self.HOST)
        new_zc.login_with_authToken(authToken, lifetime)
        self.assertTrue(new_zc._session.is_logged_in())
        self.assertTrue(new_zc.is_session_valid())

    def test_get_modify_config(self):
        attr = 'zimbraMtaMaxMessageSize'
        new_value = '42'
        ori_value = '10240000'
        self.assertEqual(
            self.zc.get_config(attr)[attr],
            ori_value
        )
        modified_conf = self.zc.modify_config(attr, new_value)
        self.assertEqual(modified_conf[attr], new_value)

        # Undo
        self.zc.modify_config(attr, ori_value)

class ZimbraAPISessionTests(unittest.TestCase):
    def setUp(self):
        self.HOST = TEST_CONF['host']
        self.ADMIN_PORT = TEST_CONF['admin_port']
        self.ADMIN_LOGIN = TEST_CONF['admin_login']
        self.ADMIN_PASSWORD = TEST_CONF['admin_password']

        self.cli = ZimbraAdminClient(self.HOST, self.ADMIN_PORT)
        self.session = ZimbraAPISession(self.cli)

    def testInit(self):
        self.session = ZimbraAPISession(self.cli)
        self.assertFalse(self.session.is_logged_in())

    def testSuccessfullLogin(self):
        self.session.login(self.ADMIN_LOGIN, self.ADMIN_PASSWORD)

        self.assertTrue(self.session.is_logged_in())

    def testGoodSessionValidates(self):
        self.session.login(self.ADMIN_LOGIN, self.ADMIN_PASSWORD)
        self.assertTrue(self.session.is_session_valid())

    def testBadSessionFails(self):
        self.session.login(self.ADMIN_LOGIN, self.ADMIN_PASSWORD)
        self.session.authToken = '42'
        self.assertFalse(self.session.is_session_valid())


text:
using System;
using System.Collections.Generic;
using System.Linq;
using hw.DebugFormatter;
using hw.Helper;
using JetBrains.Annotations;
using Reni.Basics;
using Reni.Feature;
using Reni.TokenClasses;

namespace Reni.Type
{
    sealed class ConversionPath
        : DumpableObject
            , IEquatable<ConversionPath>
            , ResultCache.IResultProvider
    {
        static int NextObjectId;

        internal readonly TypeBase Source;
        internal readonly IConversion[] Elements;

        internal ConversionPath()
            : base(NextObjectId++) { }

        internal ConversionPath(TypeBase source)
            : this()
        {
            Source = source;
            Elements = new IConversion[0];
            IsValid.Assert();
        }

        [DisableDump]
        internal bool IsValid => Source != null;

        internal ConversionPath(params IConversion[] rawElements)
            : this()
        {
            rawElements.Any().Assert();
            Source = rawElements.First().Source;
            IsValid.Assert();
            Elements = rawElements.RemoveCircles().ToArray();

            AssertValid();
            StopByObjectIds(-284);
        }

        void AssertValid()
        {
            if(Elements.Any())
                (Source == Elements.First().Source).Assert
                    (() =>
                            "Wrong source type: "
                                + Source
                                + " should be: "
                                + Elements.First().Source);

            (Types.Count() == Types.Distinct().Count()).Assert
                (() => "Cyclic conversion:\n"
                        + Types.Select(t => t.DumpPrintText).Stringify("\n")
                        + "\n****\n"
                        + Dump()
                );

            var typesByDestination = TypesByDestination.ToArray();

            var merge = Types.Select
                (
                    (item, index) => new
                    {
                        index,
                        type = item,
                        typeDestination = typesByDestination[index]
                    }
                )
                .Where(item => item.type != item.typeDestination)
                .ToArray();

            (!merge.Any()).Assert
                (() =>
                        "Inconsistent path:\n"
                            + Source.Dump()
                            + "\n"
                            + Tracer.Dump
                                (
                                    Elements.Select
                                        (
                                            item => new
                                            {
                                                item.Source,
                                                Destination = item.ResultType()
                                            }
                                        )
                                        .ToArray()
                                )
                );
        }

        IEnumerable<TypeBase> Types
            => Elements
                .Select(element => element.Source)
                .Concat(new[] {Destination})
                .ToArray();

        IEnumerable<TypeBase> TypesByDestination
            => new[] {Source}
                .Concat(Elements.Select(element => element.ResultType()))
                .ToArray();

        [UsedImplicitly]
        IEnumerable<string> DumpConversions
            => Elements
                .Select(element => element.Result(Category.Code).Code.DebuggerDump())
                .ToArray();

        internal TypeBase Destination => Elements.LastOrDefault()?.ResultType() ?? Source;

        public static ConversionPath operator +(ConversionPath a, ConversionPath b)
            => new ConversionPath(a.Elements.Concat(b.Elements).ToArray());

        public static IEnumerable<ConversionPath> operator +
            (
            IEnumerable<ConversionPath> a,
            ConversionPath b
            )
            => a.Select(left => left + b);

        public static IEnumerable<ConversionPath> operator +(
            ConversionPath a,
            IEnumerable<ConversionPath> b)
            => b.Select(right => a + right);

        public static IEnumerable<ConversionPath> operator +(
            ConversionPath a,
            IEnumerable<IConversion> b)
            => b.Select(right => a + right);

        public static ConversionPath operator +(IConversion a, ConversionPath b)
            => new ConversionPath(new[] {a}.Concat(b.Elements).ToArray());

        public static ConversionPath operator +(ConversionPath a, IConversion b)
        {
            if(a == null)
                return new ConversionPath(b);

            return new ConversionPath(a.Elements.Concat(new[] {b}).ToArray());
        }

        internal Result Execute(Category category)
        {
            var results = Elements
                .Select(item => item.Result(category.WithType))
                //  .ToArray()
                ;
            //Tracer.FlaggedLine("\n"+Tracer.Dump(results));
            var result = results
                .Aggregate(new ResultCache(this), (c, n) => n.ReplaceArg(c))
                & category;
            //Tracer.FlaggedLine("\n"+Tracer.Dump(results));
            return result;
        }

        bool IEquatable<ConversionPath>.Equals(ConversionPath other)
        {
            if(this == other)
                return true;
            if(Source != other.AssertNotNull().Source)
                return false;
            if(Elements.Length != other.AssertNotNull().Elements.Length)
                return false;
            return !Elements.Where((element, index) => element != Elements[index]).Any();
        }

        internal IEnumerable<SearchResult> CloseRelativeSearchResults(Definable tokenClass)
            => Destination
                .DeclarationsForType(tokenClass)
                .Select(result => new SearchResult(result, this));

        internal bool HasHigherPriority(ConversionPath other)
        {
            if(Destination is PointerType && !(other.Destination is PointerType))
                return true;

            if(other.Destination is PointerType && !(Destination is PointerType))
                return false;

            if(Elements.Length < other.Elements.Length)
                return true;

            if(Elements.Length > other.Elements.Length)
                return false;

            NotImplementedMethod(other);
            return true;
        }

        Result ResultCache.IResultProvider.Execute(Category category, Category pendingCategory)
        {
            pendingCategory.IsNone.Assert();
            return Source.ArgResult(category);
        }
    }
}


text:
*   Syntax
*   Data types
*   Control flow
*   Object-orientated
*   etc..

## Runtime Environment

*   Configuration
*   Security
*   Threading
*   Input/output
*   ->
	*   Java SE
	*   Java EE
	*   Java ME
	*   Java FX
	*   Android `Android runtime environment is distinctly seperate from the Java runtimes from Oracle`


text:
<?php

use PHPAST\Null_;

class NullTest extends LiteralTest {

	public function createNode($label = NULL) {
		return new Null_(NULL, $label);
	}

	public function testToString() {
		$node = new Null_(NULL);
		$this->assertEquals('NULL', (string)$node);
	}

	public function testSingleInstanceValue() {
		$n1 = Null_::get();
		$n2 = Null_::get();
		$this->assertSame($n1, $n2);
	}

}


text:
*> \brief \b ZLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
*
*  =========== DOCUMENTATION ===========
*
* Online html documentation available at
*            http://www.netlib.org/lapack/explore-html/
*
*> \htmlonly
*> Download ZLADIV + dependencies
*>
*> [TGZ]
*>
*> [ZIP]
*>
*> [TXT]
*> \endhtmlonly
*
*  Definition:
*  ===========
*
*       COMPLEX*16     FUNCTION ZLADIV( X, Y )
*
*       .. Scalar Arguments ..
*       COMPLEX*16         X, Y
*       ..
*
*
*> \par Purpose:
*  =============
*>
*> \verbatim
*>
*> ZLADIV := X / Y, where X and Y are complex.  The computation of X / Y
*> will not overflow on an intermediary step unless the results
*> overflows.
*> \endverbatim
*
*  Arguments:
*  ==========
*
*> \param[in] X
*> \verbatim
*>          X is COMPLEX*16
*> \endverbatim
*>
*> \param[in] Y
*> \verbatim
*>          Y is COMPLEX*16
*>          The complex scalars X and Y.
*> \endverbatim
*
*  Authors:
*  ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date September 2012
*
*> \ingroup complex16OTHERauxiliary
*
*  =====================================================================
      COMPLEX*16     FUNCTION ZLADIV( X, Y )
*
*  -- LAPACK auxiliary routine (version 3.4.2) --
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
*     September 2012
*
*     .. Scalar Arguments ..
      COMPLEX*16         X, Y
*     ..
*
*  =====================================================================
*
*     .. Local Scalars ..
      DOUBLE PRECISION   ZI, ZR
*     ..
*     .. External Subroutines ..
      EXTERNAL           DLADIV
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          DBLE, DCMPLX, DIMAG
*     ..
*     .. Executable Statements ..
*
      CALL DLADIV( DBLE( X ), DIMAG( X ), DBLE( Y ), DIMAG( Y ), ZR,
     $             ZI )
      ZLADIV = DCMPLX( ZR, ZI )
*
      RETURN
*
*     End of ZLADIV
*
      END
c $Id$