text:
// -*- C++ -*-

class list_box;

class box {
private:
  static int next_uid;
public:
  int spacing_type;
  const int uid;
  box();
  virtual void debug_print() = 0;
  virtual ~box();
  void top_level();
  virtual int compute_metrics(int);
  virtual void compute_subscript_kern();
  virtual void compute_skew();
  virtual void output();
  void extra_space();
  virtual list_box *to_list_box();
  virtual int is_simple();
  virtual int is_char();
  virtual int left_is_italic();
  virtual int right_is_italic();
  virtual void handle_char_type(int, int);
  enum { FOUND_NOTHING = 0, FOUND_MARK = 1, FOUND_LINEUP = 2 };
  void set_spacing_type(char *type);
  virtual void hint(unsigned);
  virtual void check_tabs(int);
};

class box_list {
private:
  int maxlen;
public:
  box **p;
  int len;

  box_list(box *);
  ~box_list();
  void append(box *);
  void list_check_tabs(int);
  void list_debug_print(const char *sep);
  friend class list_box;
};

// declarations to avoid friend name injection problems
box *make_script_box(box *, box *, box *);
box *make_mark_box(box *);
box *make_lineup_box(box *);

class list_box : public box {
  int is_script;
  box_list list;
  int sty;
public:
  list_box(box *);
  void debug_print();
  int compute_metrics(int);
  void compute_subscript_kern();
  void output();
  void check_tabs(int);
  void append(box *);
  list_box *to_list_box();
  void handle_char_type(int, int);
  void compute_sublist_width(int n);
  friend box *make_script_box(box *, box *, box *);
  friend box *make_mark_box(box *);
  friend box *make_lineup_box(box *);
};

enum alignment { LEFT_ALIGN, RIGHT_ALIGN, CENTER_ALIGN };

class column : public box_list {
  alignment align;
  int space;
public:
  column(box *);
  void set_alignment(alignment);
  void set_space(int);
  void debug_print(const char *);

  friend class matrix_box;
  friend class pile_box;
};

class pile_box : public box {
  column col;
public:
  pile_box(box *);
  int compute_metrics(int);
  void output();
  void debug_print();
  void check_tabs(int);
  void set_alignment(alignment a) { col.set_alignment(a); }
  void set_space(int n) { col.set_space(n); }
  void append(box *p) { col.append(p); }
};

class matrix_box : public box {
private:
  int len;
  int maxlen;
  column **p;
public:
  matrix_box(column *);
  ~matrix_box();
  void append(column *);
  int compute_metrics(int);
  void output();
  void check_tabs(int);
  void debug_print();
};

class pointer_box : public box {
protected:
  box *p;
public:
  pointer_box(box *);
  ~pointer_box();
  int compute_metrics(int);
  void compute_subscript_kern();
  void compute_skew();
  void debug_print() = 0;
  void check_tabs(int);
};

class vcenter_box : public pointer_box {
public:
  vcenter_box(box *);
  int compute_metrics(int);
  void output();
  void debug_print();
};

class simple_box : public box {
public:
  int compute_metrics(int);
  void compute_subscript_kern();
  void compute_skew();
  void output() = 0;
  void debug_print() = 0;
  int is_simple();
};

class quoted_text_box : public simple_box {
  char *text;
public:
  quoted_text_box(char *);
  ~quoted_text_box();
  void debug_print();
  void output();
};

class half_space_box : public simple_box {
public:
  half_space_box();
  void output();
  void debug_print();
};

class space_box : public simple_box {
public:
  space_box();
  void output();
  void debug_print();
};

class tab_box : public box {
  int disabled;
public:
  tab_box();
  void output();
  void debug_print();
  void check_tabs(int);
};

class size_box : public pointer_box {
private:
  char *size;
public:
  size_box(char *, box *);
  ~size_box();
  int compute_metrics(int);
  void output();
  void debug_print();
};

class font_box : public pointer_box {
private:
  char *f;
public:
  font_box(char *, box *);
  ~font_box();
  int compute_metrics(int);
  void output();
  void debug_print();
};

class fat_box : public pointer_box {
public:
  fat_box(box *);
  int compute_metrics(int);
  void output();
  void debug_print();
};

class vmotion_box : public pointer_box {
private:
  int n;			// up is >= 0
public:
  vmotion_box(int, box *);
  int compute_metrics(int);
  void output();
  void debug_print();
};

class hmotion_box : public pointer_box {
  int n;
public:
  hmotion_box(int, box *);
  int compute_metrics(int);
  void output();
  void debug_print();
};

box *split_text(char *);
box *make_delim_box(char *, box *, char *);
box *make_sqrt_box(box *);
box *make_prime_box(box *);
box *make_over_box(box *, box *);
box *make_small_over_box(box *, box *);
box *make_limit_box(box *, box *, box *);
box *make_accent_box(box *, box *);
box *make_uaccent_box(box *, box *);
box *make_overline_box(box *);
box *make_underline_box(box *);
box *make_special_box(char *, box *);

void set_space(int);
int set_gsize(const char *);
void set_gfont(const char *);
void set_grfont(const char *);
void set_gbfont(const char *);
const char *get_gfont();
const char *get_grfont();
const char *get_gbfont();
void start_string();
void output_string();
void do_text(const char *);
void restore_compatibility();
void set_script_reduction(int n);
void set_minimum_size(int n);
void set_param(const char *name, int value);

void set_char_type(const char *type, char *ch);

void init_char_table();
void init_extensible();
void define_extensible(const char *name, const char *ext, const char *top = 0,
		       const char *mid = 0, const char *bot = 0);


text:
package com.axemblr.service.cm.models.cm;

import com.axemblr.service.cm.models.clusters.ClusterRef;
import com.axemblr.service.cm.models.clusters.HealthCheck;
import com.axemblr.service.cm.models.clusters.HealthSummary;
import com.google.common.collect.ImmutableSet;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;

import java.util.Set;

/**
 * A service (such as HDFS, MapReduce, HBase) runs in a cluster. It has roles, which are the actual entities (NameNode,
 * DataNodes, etc.) that perform the service's functions.
 *
HDFS services and health checks

 *

 * In CDH4, HDFS services may not present any health checks. This will happen if the service has more than
 * one nameservice configured. In those cases, the health information will be available by fetching information
 * about the nameservices instead. The health summary is still available, and reflects a service-wide summary.
 *

 * http://cloudera.github.com/cm_api/apidocs/v1/ns0_apiService.html
 * http://cloudera.github.com/cm_api/apidocs/v1/el_ns0_service.html
 */
public class Service {
  private final String name;
  private final ServiceType type;
  private final ClusterRef clusterRef;
  private final ServiceState serviceState;
  private final HealthSummary healthSummary;
  private final boolean configStale;
  private final ImmutableSet<HealthCheck> healthChecks;
  private final String serviceUrl;

  @JsonCreator
  public Service(@JsonProperty("name") String name,
                 @JsonProperty("type") ServiceType type,
                 @JsonProperty("clusterRef") ClusterRef clusterRef,
                 @JsonProperty("serviceState") ServiceState serviceState,
                 @JsonProperty("healthSummary") HealthSummary healthSummary,
                 @JsonProperty("configStale") boolean configStale,
                 @JsonProperty("healthChecks") Set<HealthCheck> healthChecks,
                 @JsonProperty("serviceUrl") String serviceUrl) {
    this.name = name;
    this.type = type;
    this.clusterRef = clusterRef;
    this.serviceState = serviceState;
    this.healthSummary = healthSummary;
    this.configStale = configStale;
    this.healthChecks = (healthChecks == null) ? ImmutableSet.<HealthCheck>of() : ImmutableSet.copyOf(healthChecks);
    this.serviceUrl = serviceUrl;
  }

  /**
   * The name of the service.
   *
   * @return
   */
  public String getName() {
    return name;
  }

  /**
   * The type of the service, e.g. HDFS, MAPREDUCE, HBASE.
   *
   * @return
   */
  public ServiceType getType() {
    return type;
  }

  /**
   * Readonly. A reference to the enclosing cluster.
   *
   * @return
   */
  @JsonIgnore
  public ClusterRef getClusterRef() {
    return clusterRef;
  }

  /**
   * Readonly. The configured run state of this service. Whether it's running, etc.
   *
   * @return
   */
  @JsonIgnore
  public ServiceState getServiceState() {
    return serviceState;
  }

  /**
   * Readonly. The high-level health status of this service.
   *
   * @return
   */
  @JsonIgnore
  public HealthSummary getHealthSummary() {
    return healthSummary;
  }

  /**
   * Readonly. Expresses whether the service configuration is stale.
   *
   * @return
   */
  @JsonIgnore
  public boolean isConfigStale() {
    return configStale;
  }

  /**
   * Readonly. The list of health checks of this service.
   *
   * @return
   */
  @JsonIgnore
  public ImmutableSet<HealthCheck> getHealthChecks() {
    return healthChecks;
  }

  /**
   * Readonly. Link into the Cloudera Manager web UI for this specific service.
   *
   * @return
   */
  @JsonIgnore
  public String getServiceUrl() {
    return serviceUrl;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof Service)) return false;

    Service service = (Service) o;

    if (configStale != service.configStale) return false;
    if (clusterRef != null ? !clusterRef.equals(service.clusterRef) : service.clusterRef != null) return false;
    if (healthChecks != null ? !healthChecks.equals(service.healthChecks) : service.healthChecks != null) return false;
    if (healthSummary != service.healthSummary) return false;
    if (name != null ? !name.equals(service.name) : service.name != null) return false;
    if (serviceState != service.serviceState) return false;
    if (serviceUrl != null ? !serviceUrl.equals(service.serviceUrl) : service.serviceUrl != null) return false;
    if (type != null ? !type.equals(service.type) : service.type != null) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = name != null ? name.hashCode() : 0;
    result = 31 * result + (type != null ? type.hashCode() : 0);
    result = 31 * result + (clusterRef != null ? clusterRef.hashCode() : 0);
    result = 31 * result + (serviceState != null ? serviceState.hashCode() : 0);
    result = 31 * result + (healthSummary != null ? healthSummary.hashCode() : 0);
    result = 31 * result + (configStale ? 1 : 0);
    result = 31 * result + (healthChecks != null ? healthChecks.hashCode() : 0);
    result = 31 * result + (serviceUrl != null ? serviceUrl.hashCode() : 0);
    return result;
  }

  @Override
  public String toString() {
    return "Service{" +
        "name='" + name + '\'' +
        ", type='" + type + '\'' +
        ", clusterRef=" + clusterRef +
        ", serviceState=" + serviceState +
        ", healthSummary=" + healthSummary +
        ", configStale=" + configStale +
        ", healthChecks=" + healthChecks +
        ", serviceUrl='" + serviceUrl + '\'' +
        '}';
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.massive.deliveries.test.ui.delivery;

import com.massive.deliveries.test.di.PerActivity;
import com.massive.deliveries.test.ui.base.MvpPresenter;

/**
 *  Creaated by Balwinder on  26/08/17.
 */

@PerActivity
public interface DeliveryIPresenter<V extends DeliveryIView> extends MvpPresenter<V> {

}


text:
package com.example.ruolan.lovego.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.ruolan.lovego.R;

public class MainFragment extends Fragment {

    private View mView;
    public MainFragment(){

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (mView == null){
            mView = inflater.inflate(R.layout.fragment_main,container,false);
        } else {
            ViewGroup parent = (ViewGroup) mView.getParent();
           // parent.removeView(mView);
        }
        return mView;
    }
}


text:
// Copyright (C) 2012 The Android Open Source Project
//
// 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.

package com.google.gerrit.server.account;

import com.google.common.collect.Iterables;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.project.ProjectControl;

import java.util.Collection;
import java.util.Comparator;

/**
 * Utility class for dealing with a GroupBackend.
 */
public class GroupBackends {

  public static final Comparator<GroupReference> GROUP_REF_NAME_COMPARATOR =
      new Comparator<GroupReference>() {
    @Override
    public int compare(GroupReference a, GroupReference b) {
      return a.getName().compareTo(b.getName());
    }
  };

  /**
   * Runs {@link GroupBackend#suggest(String, Project)} and filters the result to return
   * the best suggestion, or null if one does not exist.
   *
   * @param groupBackend the group backend
   * @param name the name for which to suggest groups
   * @return the best single GroupReference suggestion
   */
  @Nullable
  public static GroupReference findBestSuggestion(GroupBackend groupBackend,
      String name) {
    return findBestSuggestion(groupBackend, name, null);
  }
  /**
   * Runs {@link GroupBackend#suggest(String, Project)} and filters the result to return
   * the best suggestion, or null if one does not exist.
   *
   * @param groupBackend the group backend
   * @param name the name for which to suggest groups
   * @param project the project for which to suggest groups
   * @return the best single GroupReference suggestion
   */
  @Nullable
  public static GroupReference findBestSuggestion(GroupBackend groupBackend,
      String name, @Nullable ProjectControl project) {
    Collection<GroupReference> refs = groupBackend.suggest(name, project);
    if (refs.size() == 1) {
      return Iterables.getOnlyElement(refs);
    }

    for (GroupReference ref : refs) {
      if (isExactSuggestion(ref, name)) {
        return ref;
      }
    }
    return null;
  }

  /**
   * Runs {@link GroupBackend#suggest(String, Project)} and filters the result to return
   * the exact suggestion, or null if one does not exist.
   *
   * @param groupBackend the group backend
   * @param name the name for which to suggest groups
   * @return the exact single GroupReference suggestion
   */
  @Nullable
  public static GroupReference findExactSuggestion(
      GroupBackend groupBackend, String name) {
    return findExactSuggestion(groupBackend, name, null);
  }

  /**
   * Runs {@link GroupBackend#suggest(String, Project)} and filters the result to return
   * the exact suggestion, or null if one does not exist.
   *
   * @param groupBackend the group backend
   * @param name the name for which to suggest groups
   * @param project the project for which to suggest groups
   * @return the exact single GroupReference suggestion
   */
  @Nullable
  public static GroupReference findExactSuggestion(
      GroupBackend groupBackend, String name, ProjectControl project) {
    Collection<GroupReference> refs = groupBackend.suggest(name, project);
    for (GroupReference ref : refs) {
      if (isExactSuggestion(ref, name)) {
        return ref;
      }
    }
    return null;
  }

  /** Returns whether the GroupReference is an exact suggestion for the name. */
  public static boolean isExactSuggestion(GroupReference ref, String name) {
    return ref.getName().equalsIgnoreCase(name) || ref.getUUID().get().equals(name);
  }

  private GroupBackends() {
  }
}


text:
/*
 * clock_gettime.h
 *
 *  Created on: 08.04.2017
 *      Author: Stefan
 */

#ifndef CLOCK_GETTIME_H_
#define CLOCK_GETTIME_H_

// Provide function clock_gettime(..).
// Credit goes to its author "work.bin", as I copied this code from
// http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows

#define BILLION                             (1E9)

static BOOL g_first_time = 1;
static LARGE_INTEGER g_counts_per_sec;

int clock_gettime(struct timespec *ct)
{
    LARGE_INTEGER count;

    if (g_first_time)
    {
        g_first_time = 0;

        if (0 == QueryPerformanceFrequency(&g_counts_per_sec))
        {
            g_counts_per_sec.QuadPart = 0;
        }
    }

    if ((NULL == ct) || (g_counts_per_sec.QuadPart <= 0) ||
            (0 == QueryPerformanceCounter(&count)))
    {
        return -1;
    }

    ct->tv_sec = count.QuadPart / g_counts_per_sec.QuadPart;
    ct->tv_nsec = ((count.QuadPart % g_counts_per_sec.QuadPart) * BILLION) / g_counts_per_sec.QuadPart;

    return 0;
}

#endif /* CLOCK_GETTIME_H_ */


text:
license: >
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.

title: BlackBerry 10 Platform Guide
---

BlackBerry 10 Platform Guide
==================================

Apache Cordova is an application development platform that allows you to use common web technologies, primarily HTML5, JavaScript, and CSS, to create applications for mobile devices. Cordova uses a standard set of APIs to access common device features. Additional plugins allow you to access BlackBerry specific APIs, so that you can extend your application to tightly integrate with the BlackBerry 10 OS.

Requirements
------------

Cordova for BlackBerry has the following software requirements:

-   Windows XP (32-bit) or Windows 7 (32-bit and 64-bit) or Mac OSX 10.6.4+
-   node.js (> 0.9.9) [Download node.js now](http://nodejs.org/)
-   BlackBerry 10 Native SDK. [Download the BlackBerry 10 Native SDK now.](http://developer.blackberry.com/native/download/)

Setting up your signing keys
----------------------------

Before starting development, you'll need to register for your code signing key and debug token. The signing key allows you to sign your completed app so that you can distribute it through BlackBerry World. The debug token allows you to test an unsigned app on a BlackBerry 10 device. You do not need to create and install the debug token yourself; if you supply the keystore password, the build script will create and install the debug token for you.

-   [Register for your code signing key now.](https://www.blackberry.com/SignedKeys/codesigning.html)
-   [Set your computer up for code signing. ](http://developer.blackberry.com/html5/documentation/set_up_for_signing.html)
-   [Learn more about debug tokens.](http://developer.blackberry.com/html5/documentation/running_your_bb10_app_2008471_11.html)

Creating your project
-------------------------

To create a new project, you use the `create` command to set up the folder structure for your app.

1.  On the command line, navigate to the folder where you extracted Cordova.
2.  Run the `create` command using the following syntax:
    ```
	bin/create <path-to-project>
	```

This command creates the folder structure for your project at the specified location. All of your project resource files should be stored in the *<path-to-project>*/www folder, or in a subfolder within it.

Adding and managing targets
---------------------------

A target refers to a BlackBerry device or simulator that you will use to test your app. Targets are added directly to your project; you can add multiple targets to your project, each with a unique name. Then, when you want to deploy your app to a particular target, you can simply refer to that target by name when you run your script.

###Add a target

To add a target, on the command line, type the following command:

```
<path-to-project>/cordova/target  add  <name>  <ip-address>  [-t <device | simulator>]  [-p | --password <password>]  [--pin <device-pin>]
```

where

-   `<name>`  specifies a unique name for the target.
-   `<ip-address>`  specifies the ip address of the BlackBerry device or simulator.
-   `-t <device | simulator>` specifies the target type. If not provided, the default value is device.
-   `-p|--password <password>`  specifies the password for the device or simulator. This is required only if the device or simulator is password protected.
-   `--pin <device-pin>`  specifies the PIN of the BlackBerry device, which identifies that device as a valid host for the debug token. This argument is required only if you are creating a debug token.

###Remove a target

To remove a target, on the command line, type the following command:

```
<path-to-project>/cordova/target  remove  <name>
```

###Set a target as the default

To specify a specific target as the default, on the command line, type the following command:

```
<path-to-project>/cordova/target  default  <name>
```

Building your app
-----------------

To build your app, run the build script. You can build the app in either release mode or in debug mode.

-   When you build the app in release mode, you are preparing it for distribution through BlackBerry World. The script packages your app resources and plugins together in a .bar file, then signs the app.
-   When you build the app in debug mode, you are preparing it to be tested. The script packages your app resources and plugins together in a .bar file, but does not sign it. The script can also deploy the app onto a previously defined target. If you have not already created and installed a debug token, you can supply the keystore password, and the build script will create and install the debug token for you as well.

    Debug mode also enables Web Inspector for the app, which allows you to remotely inspect the source code. A prompt displays the URL that you can use to connect to and inspect your app. For more information on using Web Inspector, see [Debugging using Web Inspector](http://developer.blackberry.com/html5/documentation/web_inspector_overview_1553586_11.html).

###Build your app in release mode

To build your app in release mode, on the command line, type the following command:

```
<path-to-project>/cordova/build  release  -k|--keystorepass <password>  [-b|--buildId <number>]  [-p|--params <params-JSON-file>]
```

where

-   `-k|--keystorepass <password>`  specifies the password you defined when you configured your computer to sign applications.
-   `-b|--buildId <number>`  specifies the build version number of your application. Typically, this number should be incremented from the previous signed version. This argument is optional.
-   `-p|--params <params-JSON-file>`  specifies a JSON file containing additional parameters to pass to downstream tools. This argument is optional.

###Build your app in debug mode

To build your app in release mode, on the command line, type the following command:

```
<path-to-project>/cordova/build  debug  [<target>]  [-k|--keystorepass <password>]  [-p|--params <params-JSON-file>]  [-ll|--loglevel <error|warn|verbose>]
```

where

-   `<target>`  specifies the name of a previously added target. If `<target>`  is not specified, the default target is used, if one has been created. This argument is only required if you want the script to deploy your app to a BlackBerry device or simulator and you have not created a default target. Additionally, if `<target>`  is a device, then that device must be connected to your computer by USB connection or be connected to the same Wi-Fi network as your computer.
-   `-k|--keystorepass <password>`  specifies the password you defined when you configured your computer to sign applications. This password is also used to create your debug token. This argument is only required if you want the script to create and install the debug token for you.
-   `-p|--params <params-JSON-file>`  specifies a JSON file containing additional parameters to pass to downstream tools.
-   `-ll|--loglevel <level>`  specifies the log level. The log level may be one of `error`, `warn`, or `verbose`.

Note that all of these parameters are optional. If you have previously defined a default target (and installed a debug token, if that target is a BlackBerry device), you can run the script with no arguments, and the script will package your app and deploy it to the default target. For example:

```
<path-to-project>/cordova/build debug
```

Deploying an app
-------------------------

You can test your app using either a BlackBerry device or a simulator. Before deploying your app, you must first create a target for the device or simulator you want to deploy your app to.

The run script will first build  your app. If you intend to deploy an app to a physical device for testing, you must first install a debug token on that device. If you specify the `--keystorepass <password>` argument when running the run script, the script will create and install the debug token for you. You do not need a debug token to test your app on a simulator, even if that app is unsigned.

To deploy your app to a device or simulator, on a command line type the following command:

```
<path-to-project>/cordova/run <target> [--no-build]
```

where
-   `<target>`  specifies the name of a previously added target. If `<target>`  is a device, then that device must be connected to your computer by USB connection or be connected to the same Wi-Fi network as your computer.

-   `-no--build` will use the most recently built version of the application rather than re-building. This is useful to test an application in release mode.

Adding and managing plugins
---------------------------

To add additional functionality that is outside of the core features of Cordova, you'll need to add plugins. A plugin represents a set of APIs that provide access to additional features of the platform.

In order to use a plugin, you must first add it into your project. Once added into your project, the plugin will be bundled with your project during the build process, to ensure that your app has access to all the APIs it needs.

###Add a plugin

To add a plugin, on the command line, type the following command:

```
<path-to-project>/cordova/plugin add <path to plugin>
```

###Remove a plugin

To remove a plugin, on the command line, type the following command:

```
<path-to-project>/cordova/plugin rm <name>
```

###View a list of installed plugins

To view a list of installed plugins, on the command line, type the following command:

```
<path-to-project>/cordova/plugin ls
```


text:
</textarea>

<input type="checkbox" id="svg" name="svg" value="svg"></input>
SVG (scalable image)
<input type="checkbox" id="latex" name="latex" value="latex"></input>
LaTeX
<input type="submit" value="Visualize!"></input>
</form>


text:
''' Provide the Struct property.

'''

#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import logging # isort:skip
log = logging.getLogger(__name__)

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

# Bokeh imports
from .bases import ParameterizedProperty

#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------

__all__ = (
    'Struct',
)

#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------

class Struct(ParameterizedProperty):
    ''' Accept values that are structures.

    '''
    def __init__(self, **fields):
        default = fields.pop("default", None)
        help = fields.pop("help", None)

        self._fields = {}
        for name, type in fields.items():
            self._fields[name] = self._validate_type_param(type)

        super().__init__(default=default, help=help)

    @property
    def type_params(self):
        return list(self._fields.values())

    def validate(self, value, detail=True):
        super().validate(value, detail)

        if value is None:
            return

        if isinstance(value, dict) and len(value) <= len(self._fields):
            for name, type in self._fields.items():
                if not type.is_valid(value.get(name, None)):
                    break
            else:
                return

        msg = "" if not detail else "expected an element of %s, got %r" % (self, value)
        raise ValueError(msg)

    def __str__(self):
        fields = [ "%s=%s" % (name, type) for name, type in self._fields.items() ]
        return "%s(%s)" % (self.__class__.__name__, ", ".join(fields))

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------


text:
layout: goimport
path: cmd/bosun/database/test
---


text:
<?php
/**
 * Config class
 * Configuration for Skeleton\Core
 *
 * @author Christophe Gosiau <christophe@tigron.be>
 * @author Gerry Demaret <gerry@tigron.be>
 */

namespace Skeleton\Core;

class Config {
	/**
	 * Config array
	 *
	 * @var array
	 * @access private
	 */
	protected $config_data = [];

	/**
	 * Config object
	 *
	 * @var Config
	 * @access private
	 */
	private static $config = null;

	/**
	 * Private (disabled) constructor
	 *
	 * @access private
	 */
	public function __construct() {
	}

	/**
	 * Get config vars as properties
	 *
	 * @param string name
	 * @return mixed
	 * @throws Exception When accessing an unknown config variable, an Exception is thrown
	 * @access public
	 */
	public function __get($name) {
		if (!isset($this->config_data[$name])) {
			throw new \Exception('Attempting to read unkown config key: '.$name);
		}
		return $this->config_data[$name];
	}

	/**
	 * Get config vars as properties
	 *
	 * @param string name
	 * @param mixed value
	 * @access public
	 */
	public function __set($name, $value) {
		$this->config_data[$name] = $value;
	}

	/**
	 * Get function, returns a Config object
	 *
	 * @return Config
	 * @access public
	 */
	public static function Get() {
		try {
			$application = \Skeleton\Core\Application::get();
			return $application->config;
		} catch (\Exception $e) {
			if (self::$config === null) {
				throw new \Exception('No config set');
			}
			return self::$config;
		}
	}

	/**
	 * Check if config var exists
	 *
	 * @param string key
	 * @return bool $isset
	 * @access public
	 */
	public function __isset($key) {
		if (!isset($this->config_data) OR $this->config_data === null) {
			$this->read();
		}

		if (isset($this->config_data[$key])) {
			return true;
		}

		return false;
	}

	/**
	 * Read a config file into this config
	 *
	 * @access public
	 */
	public function read_file($file) {
		if (!file_exists($file)) {
			throw new \Exception($file . ' cannot be included in config. File does not exist.');
		}

		$config_data = require $file;

		if (!is_array($config_data)) {
			return;
		}
		foreach ($config_data as $key => $value) {
			$this->$key = $value;
		}
	}

	/**
	 * Read config files from directory
	 *
	 * @access public
	 */
	public function read_path($path) {
		if (!file_exists($path)) {
			throw new \Exception('Config directory does not exist');
		}

		$files = scandir($path);
		foreach ($files as $file) {
			if ($file[0] == '.') {
				continue;
			}
			$info = pathinfo($file);

			if (!isset($info['extension']) or $info['extension'] !== 'php') {
				continue;
			}

			if ($info['filename'] == 'environment') {
				continue;
			}

			$this->read_file($path . DIRECTORY_SEPARATOR . $info['basename']);
		}

		if (file_exists($path . DIRECTORY_SEPARATOR . 'environment.php')) {
			$this->read_file($path . DIRECTORY_SEPARATOR . 'environment.php');
		}
	}

	/**
	 * Include a config directory
	 *
	 * @access public
	 */
	public static function include_path($path) {
		if (!file_exists($path)) {
			throw new \Exception('Config directory does not exist');
		}

		try {
			$config = self::get();
		} catch (\Exception $e) {
			$config = new self();
			self::$config = $config;
		}
		$config->read_path($path);
		self::$config = $config;
	}

	/**
	 * Include a config directory
	 *
	 * @access public
	 */
	public static function include_directory($directory) {
		self::include_path($directory);
	}

}


text:
package org.omg.CORBA;

import org.omg.CORBA.portable.Streamable;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;

/**
 * The Holder for <tt>Char</tt>.  For more information on
 * Holder files, see
 * "Generated Files: Holder Files".

 * A Holder class for a char
 * that is used to store "out" and "inout" parameters in IDL methods.
 * If an IDL method signature has an IDL char as an "out"
 * or "inout" parameter, the programmer must pass an instance of
 * CharHolder as the corresponding
 * parameter in the method invocation; for "inout" parameters, the programmer
 * must also fill the "in" value to be sent to the server.
 * Before the method invocation returns, the ORB will fill in the
 * value corresponding to the "out" value returned from the server.
 *

 * If myCharHolder is an instance of CharHolder,
 * the value stored in its value field can be accessed with
 * myCharHolder.value.
 *
 * @since       JDK1.2
 */
public final class CharHolder implements Streamable {

    /**
     * The char value held by this CharHolder
     * object.
     */
    public char value;

    /**
     * Constructs a new CharHolder object with its
     * value field initialized to 0.
     */
    public CharHolder() {
    }

    /**
     * Constructs a new CharHolder object for the given
     * char.
     * @param initial the char with which to initialize
     *                the value field of the new
     *                CharHolder object
     */
    public CharHolder(char initial) {
        value = initial;
    }

    /**
     * Reads from input and initalizes the value in
     * this CharHolder object
     * with the unmarshalled data.
     *
     * @param input the InputStream containing CDR formatted data from the wire
     */
    public void _read(InputStream input) {
        value = input.read_char();
    }

    /**
     * Marshals to output the value in
     * this CharHolder object.
     *
     * @param output the OutputStream which will contain the CDR formatted data
     */
    public void _write(OutputStream output) {
        output.write_char(value);
    }

    /**
     * Returns the TypeCode object  corresponding
     * to the value held in
     * this CharHolder object.
     *
     * @return    the TypeCode of the value held in
     *            this CharHolder object
     */
    public org.omg.CORBA.TypeCode _type() {
        return ORB.init().get_primitive_tc(TCKind.tk_char);
    }
}


text:
package org.wso2.msf4j.service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

/**
 * Simple RESTful web service.
 */
@Path("/SecondService")
public class SecondService {

    @GET
    @Path("/addNumbers/{no1}/{no2}")
    public int add(@PathParam("no1") int no1, @PathParam("no2") int no2) {
        return no1 + no2;
    }
}


text:
/**
 * SWFObject v2.0: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}


text:
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var browserSync = require('browser-sync').create();
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var change = require('gulp-change');
var fs = require('fs');
var mochaPhantomJS = require('gulp-mocha-phantomjs');
var exec = require('child_process').exec;
var sass        = require('gulp-sass');

var insertURL = function(content){
	var config = JSON.parse(fs.readFileSync('./config.json','utf8'));
	var protocol = (config['use-https']?'https':'http');
	var root = protocol+'://'+config['server-ip']+':'+config['server-port'];
	return content.replace('HTTP_ROOT', root);
}

gulp.task('default', function(){
	gulp.watch(['browser_modules/**/*.js','!browser_modules/**/*.test.js'],['scripts','compress']);
});

gulp.task('buildtest', function(){
	gulp.src('browser_modules/test/browser.test.js')
		.pipe(change(insertURL))
		.pipe(browserify())
		.pipe(gulp.dest('browser_modules/test/bundle'));
})

gulp.task('phantomtest', function(cb){

	//var www = require('./app');
	var rooms = require('./source/models/Rooms');
	var room = new rooms.Room();
	rooms.getLobby().addRoom('testid', room);
	//console.log('testing');
	gulp.src('browser_modules/test/test.html')
		.pipe(mochaPhantomJS({reporter:'spec'}));
	//www.close();
})

gulp.task('scripts', function(){
	gulp.src('browser_modules/*.js')
		.pipe(change(insertURL))
		.pipe(browserify())
		.pipe(gulp.dest('public/javascripts/'));
});

gulp.task('compress', function(){
	return gulp.src('public/javascripts/*.js')
		.pipe(uglify())
		.pipe(rename({
			suffix: '.min'
		}))
		.pipe(gulp.dest('public/javascripts/'));
})

gulp.task('server', function(cb) {
	return exec('npm --c=config.json start', {maxBuffer: 1024 * 1000}, function (err, stdout, stderr) {
		process.stdout.write(stdout);
	    process.stdout.write(stderr);
	    cb(err);
  	});
})

gulp.task('browser-sync', function() {
	setTimeout(function(){
	    browserSync.init({
	        proxy: "http://localhost:3000/dashboard",
	        port: 7000,
	        ghost: false,
		});
	}, 3000);
});

gulp.task("watch", function() {
	// gulp.watch("browser_modules/**/*.js", ['scripts']);
	gulp.watch("scss/**/*.scss", ['sass']);
    gulp.watch("source/views/**/*.ejs").on('change', function() {
    	browserSync.reload();
    });
    gulp.watch("browser_modules/**/*.js", ['js-watch']);
})

gulp.task('js-watch', ['scripts'], function() {
	setTimeout(function(){
		browserSync.reload();
	}, 2000);
});

// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
    return gulp.src("scss/*.scss")
        .pipe(sass({errLogToConsole: true}))
        .pipe(gulp.dest("public/stylesheets"))
        .pipe(browserSync.stream());
});

gulp.task('dev', ['server', 'scripts', 'browser-sync', 'sass', 'watch'], function(cb) {

})


text:
A simple node library to read SSL certificate files according to a basic convention.

## Usage

``` js
var readSsl = require('read-ssl');

readSsl({
  root: __dirname,
  key: 'relative/path/to/file.key',
  cert: 'relative/path/to/file.cert',
  ca: 'relative/path/to/ca.pem'
  //
  // `ca` can alternatively be an Array
  //
  ca: [
    'relative/path/to/ca.pem'
    'relative/path/to/intermediate-ca.pem'
  ]
}, function (err, res) {
  assert(Buffer.isBuffer(res.key));
  assert(Buffer.isBuffer(res.cert));
  assert(Buffer.isBuffer(res.ca));
});
```

`readSsl` can also be used to create the `crypto` context necessary for performing operations like responding appropriately to an `SNICallback`:

``` js
var readSsl = require('read-ssl');

readSsl.createContext({
  root: __dirname,
  key: 'relative/path/to/file.key',
  cert: 'relative/path/to/file.cert'
}, function (err, context) {
  //
  // Context is the result of
  // require('crypto').createCredentials().context
  // with the result of a `readSsl` call.
  //
});
```

##### AUTHOR: [Charlie Robbins](https://github.com/indexzero)
##### LICENSE: MIT


text:
<?php

namespace Sabre\HTTP\Auth;

use Sabre\HTTP\Request;
use Sabre\HTTP\Response;

class BearerTest extends \PHPUnit_Framework_TestCase {

    function testGetToken() {

        $request = new Request('GET', '/', [
            'Authorization' => 'Bearer 12345'
        ]);

        $bearer = new Bearer('Dagger', $request, new Response());

        $this->assertEquals(
            '12345',
            $bearer->getToken()
        );

    }

    function testGetCredentialsNoheader() {

        $request = new Request('GET', '/', []);
        $bearer = new Bearer('Dagger', $request, new Response());

        $this->assertNull($bearer->getToken());

    }

    function testGetCredentialsNotBearer() {

        $request = new Request('GET', '/', [
            'Authorization' => 'QBearer 12345'
        ]);
        $bearer = new Bearer('Dagger', $request, new Response());

        $this->assertNull($bearer->getToken());

    }

    function testRequireLogin() {

        $response = new Response();
        $bearer = new Bearer('Dagger', new Request(), $response);

        $bearer->requireLogin();

        $this->assertEquals('Bearer realm="Dagger"', $response->getHeader('WWW-Authenticate'));
        $this->assertEquals(401, $response->getStatus());

    }

}


text:
[![Build Status](https://travis-ci.org/sunggun-yu/chef-mongodb3.svg?branch=master)](https://travis-ci.org/sunggun-yu/chef-mongodb3)

## Install and configure the MongoDB 3

* Install and configure the mongod (or configure the config server for shard cluster)
* Install and configure the mongos
 * Also, mongos configure the mongos service with runit : `service mongos start|stop|restart|status`
* Install and configure the MMS Automation Agent
* Install and configure the MMS Monitoring Agent

### NOTICE :

* Current version is not supporting automation and monitoring mms agent installation for Debian 7.8.
* MongoDB **3.2.8** is default version of mongodb3 cookbook.
* Mongodb3 cookbook is **NO LONGER SUPPORT** Chef Client version 11.

### Contributors

* David Herges - [@dherges](https://github.com/dherges)
* Joe Passavanti - [@gottaloveit](https://github.com/gottaloveit)
* MEGA MOnolithic meTHod - [@megamoth](https://github.com/megamoth)
* Dave Augustus - [@daugustus](https://github.com/daugustus)
* Constantin Guay - [@Cog-g](https://github.com/Cog-g)
* Julien Pervillé - [@jperville](https://github.com/jperville)
* Daniel Doubrov - [@dblock](https://github.com/dblock)
* Damien Raude-Morvan - [@drazzib](https://github.com/drazzib)
* Jose Olcese - [@jolcese](https://github.com/jolcese)
* Dennis Pattmann - [@dpattmann](https://github.com/dpattmann)
* Marcin Skurski - [@mskurski](https://github.com/mskurski)
* Popsikle - [@popsikle](https://github.com/popsikle)
* Amsdard - [@amsdard](https://github.com/amsdard)

## Supported Platforms

The following platforms have been tested with Test Kitchen

* Ubuntu 12.04, 14.04, 15.04, 16.04
* Debian 7.8
* CentOS 6.8, 7.2
* Oralce 6.6
* Amazon Linux

## Attributes

### Cookbook Attributes
mongodb3 cookbook uses the package installation of mongodb3 such as yum or apt. and these attributes are used for setting default values in order to provide the correct installation of mongodb3. typically, you can modify cookbook attributes if you need. however, I do not recommend to modify these attributes if you want to use package that is provided from MongoDB.

WARNING : Please do not set the user and group attribute on your side. This cook book let installing user and group by mongodb package (except `mongos` and `mms-monitoring-agent` recipe). The user and group name will be set by condition in default attribute because mongodb package installs different user and group name by platform.

```
# MongoDB version to install
default['mongodb3']['version'] = '3.2.1'
default['mongodb3']['package']['version'] = Actual package version to install. It builds from version attribute.

# Package repository url
default['mongodb3']['package']['repo']['url'] = Package repository url

# Attribute for apt_repository
default['mongodb3']['package']['repo']['apt']['name'] = nil  # eg. 3.0, 3.2
default['mongodb3']['package']['repo']['apt']['keyserver'] = nil # eg. hkp://keyserver.ubuntu.com:80
default['mongodb3']['package']['repo']['apt']['key'] = nil # eg. 3.2 : 'EA312927', 3.0 : '7F0CEB10'
default['mongodb3']['package']['repo']['apt']['components'] = nil # `multiverse` for ubuntu. `main` for debian

# MongoDB user:group : PLEASE DO NOT SET THE USER AND GROUP ATTRIBUTE
default['mongodb3']['user'] = 'mongod' | 'mongodb'
default['mongodb3']['group'] = 'mongod' | 'mongodb'

# Mongod config file path
default['mongodb3']['mongod']['config_file'] = '/etc/mongod.conf'

# Mongos config file path
default['mongodb3']['mongos']['config_file'] = '/etc/mongos.conf'

# Runit template cookbook for mongos
default['mongodb3']['mongos']['runit_template_cookbook'] = 'mongodb3'

# Key file contents
default['mongodb3']['config']['key_file_content'] = nil
```

### Mongod config Attributes

* The default value of the attribute is referred to the MongoDB documentation.
* The `nil` value attribute will be ignored for mongod config file.
* This cookbook fills nil for some of the attribute value to concise initial mongod config file.
* Also, deprecated attributed is not included.

#### systemLog Options

http://docs.mongodb.org/manual/reference/configuration-options/#systemlog-options

```
default['mongodb3']['config']['mongod']['systemLog']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['quiet'] = nil # default : false
default['mongodb3']['config']['mongod']['systemLog']['traceAllException'] = nil # default : false
default['mongodb3']['config']['mongod']['systemLog']['syslogFacility'] = nil # default : 'user'
default['mongodb3']['config']['mongod']['systemLog']['path'] = '/var/log/mongodb/mongod.log'
default['mongodb3']['config']['mongod']['systemLog']['logAppend'] = true # default : false
default['mongodb3']['config']['mongod']['systemLog']['logRotate'] = nil # default : 'rename'
default['mongodb3']['config']['mongod']['systemLog']['destination'] = 'file' # default : 'file'
default['mongodb3']['config']['mongod']['systemLog']['timeStampFormat'] = nil # default : 'iso8601-local'
```

#### systemLog.component Options

http://docs.mongodb.org/manual/reference/configuration-options/#systemlog-component-options

```
default['mongodb3']['config']['mongod']['systemLog']['component']['accessControl']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['command']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['control']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['geo']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['index']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['network']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['query']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['replication']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['sharding']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['storage']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['storage']['journal']['verbosity'] = nil # default : 0
default['mongodb3']['config']['mongod']['systemLog']['component']['write']['verbosity'] = nil # default : 0
```

#### processManagement Options

http://docs.mongodb.org/manual/reference/configuration-options/#processmanagement-options

```
default['mongodb3']['config']['mongod']['processManagement']['fork'] = true or nil # default : false
default['mongodb3']['config']['mongod']['processManagement']['pidFilePath'] = '/var/run/mongodb/mongodb.pid' or nil
```

#### net Options

http://docs.mongodb.org/manual/reference/configuration-options/#net-options

```
default['mongodb3']['config']['mongod']['net']['port'] = 27017
default['mongodb3']['config']['mongod']['net']['bindIp'] = nil # default : '0.0.0.0'
default['mongodb3']['config']['mongod']['net']['maxIncomingConnections'] = nil # default : 65536
default['mongodb3']['config']['mongod']['net']['wireObjectCheck'] = nil # default : true
default['mongodb3']['config']['mongod']['net']['ipv6'] = nil # default : false
```

#### net.unixDomainSocket Options

http://docs.mongodb.org/manual/reference/configuration-options/#net-unixdomainsocket-options

```
default['mongodb3']['config']['mongod']['net']['unixDomainSocket']['enabled'] = nil # default : true
default['mongodb3']['config']['mongod']['net']['unixDomainSocket']['pathPrefix'] = nil # default : '/tmp'
default['mongodb3']['config']['mongod']['net']['unixDomainSocket']['filePermissions'] = nil # default : '0700'
```

#### net.http Options

http://docs.mongodb.org/manual/reference/configuration-options/#net-http-options

```
default['mongodb3']['config']['mongod']['net']['http']['enabled'] = nil # default : false
default['mongodb3']['config']['mongod']['net']['http']['JSONPEnabled'] = nil # default : false
default['mongodb3']['config']['mongod']['net']['http']['RESTInterfaceEnabled'] = nil # default : false
```

#### net.ssl Options

http://docs.mongodb.org/manual/reference/configuration-options/#net-ssl-options

```
default['mongodb3']['config']['mongod']['net']['ssl']['mode'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['PEMKeyFile'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['PEMKeyPassword'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['clusterFile'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['clusterPassword'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['CAFile'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['CRLFile'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['allowConnectionsWithoutCertificates'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['allowInvalidCertificates'] = nil
default['mongodb3']['config']['mongod']['net']['ssl']['allowInvalidHostnames'] = nil # default : false
default['mongodb3']['config']['mongod']['net']['ssl']['FIPSMode'] = nil
```

#### security Options

http://docs.mongodb.org/manual/reference/configuration-options/#security-options

```
default['mongodb3']['config']['mongod']['security']['keyFile'] = nil
default['mongodb3']['config']['mongod']['security']['clusterAuthMode'] = nil
default['mongodb3']['config']['mongod']['security']['authorization'] = 'disabled'
default['mongodb3']['config']['mongod']['security']['javascriptEnabled'] = nil # default : true
```

#### security.sasl Options

http://docs.mongodb.org/manual/reference/configuration-options/#security-sasl-options

```
default['mongodb3']['config']['mongod']['security']['sasl']['hostName'] = nil
default['mongodb3']['config']['mongod']['security']['sasl']['serviceName'] = nil
default['mongodb3']['config']['mongod']['security']['sasl']['saslauthdSocketPath'] = nil
```

#### storage Options

http://docs.mongodb.org/manual/reference/configuration-options/#storage-options

```
default['mongodb3']['config']['mongod']['storage']['dbPath'] = '/var/lib/mongo' | '/var/lib/mongodb'
default['mongodb3']['config']['mongod']['storage']['indexBuildRetry'] = nil # default : true
default['mongodb3']['config']['mongod']['storage']['repairPath'] = nil
default['mongodb3']['config']['mongod']['storage']['journal']['enabled'] = true
default['mongodb3']['config']['mongod']['storage']['directoryPerDB'] = nil # default : false
default['mongodb3']['config']['mongod']['storage']['syncPeriodSecs'] = nil # default : 60
default['mongodb3']['config']['mongod']['storage']['engine'] = 'mmapv1'
```

#### storage.mmapv1 Options

http://docs.mongodb.org/manual/reference/configuration-options/#storage-mmapv1-options

```
default['mongodb3']['config']['mongod']['storage']['mmapv1']['preallocDataFiles'] = nil # default : true
default['mongodb3']['config']['mongod']['storage']['mmapv1']['nsSize'] = nil # default : 16
default['mongodb3']['config']['mongod']['storage']['mmapv1']['quota']['enforced'] = nil # default : false
default['mongodb3']['config']['mongod']['storage']['mmapv1']['quota']['maxFilesPerDB'] = nil # default : 8
default['mongodb3']['config']['mongod']['storage']['mmapv1']['smallFiles'] = nil # default : false
default['mongodb3']['config']['mongod']['storage']['mmapv1']['journal']['debugFlags'] = nil
default['mongodb3']['config']['mongod']['storage']['mmapv1']['journal']['commitIntervalMs'] = nil # default : 100 or 30
```

#### storage.wiredTiger Options

http://docs.mongodb.org/manual/reference/configuration-options/#storage-wiredtiger-options

```
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['engineConfig']['cacheSizeGB'] = nil
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['engineConfig']['statisticsLogDelaySecs'] = nil # default : 0
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['engineConfig']['journalCompressor'] = nil # default : 'snappy'
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['engineConfig']['directoryForIndexes'] = nil # default : false
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['collectionConfig']['blockCompressor'] = nil # default : 'snappy'
default['mongodb3']['config']['mongod']['storage']['wiredTiger']['indexConfig']['prefixCompression'] = nil # default : true
```

#### operationProfiling Options

http://docs.mongodb.org/manual/reference/configuration-options/#operationprofiling-options

```
default['mongodb3']['config']['mongod']['operationProfiling']['slowOpThresholdMs'] = nil # default : 100
default['mongodb3']['config']['mongod']['operationProfiling']['mode'] = nil # default : 'off'
```

#### replication Options

http://docs.mongodb.org/manual/reference/configuration-options/#replication-options

```
default['mongodb3']['config']['mongod']['replication']['oplogSizeMB'] = nil
default['mongodb3']['config']['mongod']['replication']['replSetName'] = nil
default['mongodb3']['config']['mongod']['replication']['secondaryIndexPrefetch'] = nil # default : 'all'
```

#### sharding Options

http://docs.mongodb.org/manual/reference/configuration-options/#sharding-options

```
default['mongodb3']['config']['mongod']['sharding']['clusterRole'] = nil
default['mongodb3']['config']['mongod']['sharding']['archiveMovedChunks'] = nil # default : true
```

#### auditLog Options

http://docs.mongodb.org/manual/reference/configuration-options/#auditlog-options

```
default['mongodb3']['config']['mongod']['auditLog']['destination'] = nil
default['mongodb3']['config']['mongod']['auditLog']['format'] = nil
default['mongodb3']['config']['mongod']['auditLog']['path'] = nil
default['mongodb3']['config']['mongod']['auditLog']['filter'] = nil
```

#### snmp Options

http://docs.mongodb.org/manual/reference/configuration-options/#snmp-options

```
default['mongodb3']['config']['mongod']['snmp']['subagent'] = nil
default['mongodb3']['config']['mongod']['snmp']['master'] = nil
```

### Mongos config Attributes

#### Default config for mongos

```
default['mongodb3']['config']['mongos']['net']['port'] = 27018 # default : 27017
default['mongodb3']['config']['mongos']['net']['bindIp'] = '127.0.0.1' # default : '0.0.0.0'
default['mongodb3']['config']['mongos']['systemLog']['path'] = '/var/log/mongodb/mongos.log'
default['mongodb3']['config']['mongos']['systemLog']['logAppend'] = true # default : false
default['mongodb3']['config']['mongos']['systemLog']['destination'] = 'file' # default : 'file'
```

#### mongos-only Options

http://docs.mongodb.org/manual/reference/configuration-options/#mongos-only-options

```
default['mongodb3']['config']['mongos']['replication']['localPingThresholdMs'] = nil # default : 15
default['mongodb3']['config']['mongos']['sharding']['autoSplit'] = true # default : true
default['mongodb3']['config']['mongos']['sharding']['configDB'] = nil
default['mongodb3']['config']['mongos']['sharding']['chunkSize'] = 64 # default : 64
```

### MMS Automation/Monitoring Agent

#### Common configuration attributes for both automation and monitoring agent.
```
default['mongodb3']['config']['mms']['mmsApiKey'] = nil
default['mongodb3']['config']['mms']['mmsBaseUrl'] = 'https://api-agents.mongodb.com'
default['mongodb3']['config']['mms']['httpProxy'] = nil
default['mongodb3']['config']['mms']['krb5ConfigLocation'] = nil
default['mongodb3']['config']['mms']['sslTrustedMMSServerCertificate'] = nil
default['mongodb3']['config']['mms']['sslRequireValidMMSServerCertificates'] = nil
```

#### Attributes for automation agent.
https://docs.opsmanager.mongodb.com/current/reference/automation-agent
```
default['mongodb3']['config']['mms']['mmsGroupId'] = nil
default['mongodb3']['config']['mms']['logFile'] = '/var/log/mongodb-mms-automation/automation-agent.log'
default['mongodb3']['config']['mms']['mmsConfigBackup'] = '/var/lib/mongodb-mms-automation/mms-cluster-config-backup.json'
default['mongodb3']['config']['mms']['logLevel'] = 'INFO'
default['mongodb3']['config']['mms']['maxLogFiles'] = 10
default['mongodb3']['config']['mms']['maxLogFileSize'] = 268435456
```

#### Attributes for monitoring agent.
https://docs.opsmanager.mongodb.com/current/reference/monitoring-agent
```
default['mongodb3']['config']['mms']['useSslForAllConnections'] = nil
default['mongodb3']['config']['mms']['sslClientCertificate'] = nil
default['mongodb3']['config']['mms']['sslClientCertificatePassword'] = nil
default['mongodb3']['config']['mms']['sslTrustedServerCertificates'] = nil
default['mongodb3']['config']['mms']['sslRequireValidServerCertificates'] = nil
default['mongodb3']['config']['mms']['krb5Principal'] = nil
default['mongodb3']['config']['mms']['krb5Keytab'] = nil
default['mongodb3']['config']['mms']['gsappiServiceName'] = nil
default['mongodb3']['config']['mms']['enableMunin'] = nil
```

## Usage

### mongodb3::default

Install and configure the mongod or config server instance.

Include `mongodb3::default` in your node's `run_list`:

```json
{
  "run_list": [
    "recipe[mongodb3::default]"
  ]
}
```

### mongodb3::mongos

Install and configure the mongos.

Include `mongodb3::mongos` in your node's `run_list`:

```json
{
  "run_list": [
    "recipe[mongodb3::mongos]"
  ]
}
```

### mongodb3::mms\_automation_agent

Install the MMS Automation Agent.

Include `mongodb3::mms_automation_agent` in your node's `run_list`:

```json
{
  "run_list": [
    "recipe[mongodb3::mms_automation_agent]"
  ]
}
```

### mongodb3::mms\_monitoring_agent

Install the MMS Monitoring Agent.

Include `mongodb3::mms_monitoring_agent` in your node's `run_list`:

```json
{
  "run_list": [
    "recipe[mongodb3::mms_monitoring_agent]"
  ]
}
```

## Examples

### Default mongod.conf file contents

Simply `mongodb3::default` recipe with none of additional attribute setting

```json
{
  "run_list": [
    "recipe[mongodb3::default]"
  ]
}
```

#### Result of mongod.conf

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.
---
systemLog:
  path: /var/log/mongodb/mongod.log
  logAppend: true
  destination: file
net:
  port: 27017
security:
  authorization: disabled
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  engine: mmapv1
```

### Replicaset

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "replica",
  "description": "Role for Replica set",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3" : {
      "config" : {
        "mongod" : {
          "replication" : {
            "replSetName" : "replset-1"
          }
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::default]"
  ],
  "env_run_lists": {
  }
}
```

#### Result of mongod.conf

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.
---
systemLog:
  path: /var/log/mongodb/mongod.log
  logAppend: true
  destination: file
net:
  port: 27017
security:
  authorization: disabled
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  engine: mmapv1
replication:
  replSetName: replset-1
```

### Config server

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "configsvr",
  "description": "Role for MongoDB Config server",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3": {
      "config" : {
        "mongod" : {
          "net" : {
            "port" : 27019
          },
          "sharding" : {
            "clusterRole" : "configsvr"
          }
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::default]"
  ],
  "env_run_lists": {
  }
}
```

#### Result of mongod.conf

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.
---
systemLog:
  path: /var/log/mongodb/mongod.log
  logAppend: true
  destination: file
net:
  port: 27019
security:
  authorization: disabled
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  engine: mmapv1
sharding:
  clusterRole: configsvr
```

### WiredTiger storage engine config

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "wired_tiger",
  "description": "Role for testing Wired Tiger storage engine",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3" : {
      "config" : {
        "mongod" : {
          "storage" : {
            "dbPath" : "/var/lib/mongodb/wiredTiger",
            "engine" : "wiredTiger",
            "wiredTiger" : {
              "engineConfig" : {
                "cacheSizeGB" : 10,
                "statisticsLogDelaySecs" : 60,
                "journalCompressor" : "snappy",
                "directoryForIndexes" : false
              },
              "collectionConfig" : {
                "blockCompressor" : "snappy"
              },
              "indexConfig" : {
                "prefixCompression" : true
              }
            }
          }
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::default]"
  ],
  "env_run_lists": {
  }
}

```

#### Result of mongod.conf

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.
---
systemLog:
  path: /var/log/mongodb/mongod.log
  logAppend: true
  destination: file
net:
  port: 27017
security:
  authorization: disabled
storage:
  dbPath: /var/lib/mongodb/wiredTiger
  journal:
    enabled: true
  engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 10
      statisticsLogDelaySecs: 60
      journalCompressor: snappy
      directoryForIndexes: false
    collectionConfig:
      blockCompressor: snappy
    indexConfig:
      prefixCompression: true
```

### Mongos

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "mongos",
  "description": "Role for Mongos",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3" : {
      "config" : {
        "mongos" : {
          "sharding" : {
            "configDB" : "configsvr1:27019, configsvr2:27019, configsvr3:27019"
          }
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::mongos]"
  ],
  "env_run_lists": {
  }
}
```

#### Result of mongos.conf

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.
---
net:
  port: 27017
  bindIp: 0.0.0.0
systemLog:
  path: /var/log/mongodb/mongos.log
  logAppend: true
  destination: file
sharding:
  autoSplit: true
  configDB: configsvr1:27019, configsvr2:27019, configsvr3:27019
  chunkSize: 64
```

### MMS Automation agent

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "mms_automation_agent",
  "description": "Role for MMS automation agent",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3" : {
      "config" : {
        "mms" : {
          "mmsGroupId" : "grpgrpididid",
          "mmsApiKey" : "apikeykekekekeke"
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::mms_automation_agent]"
  ],
  "env_run_lists": {
  }
}

```

#### Result of `/etc/mongodb-mms/automation-agent.config`

```text
# /etc/mongodb-mms/automation-agent.config

#
# REQUIRED
# Enter your Group ID - It can be found at https://cloud.mongodb.com/settings/group
#
mmsGroupId=grpgrpididid

#
# REQUIRED
# Enter your API key - It can be found at https://cloud.mongodb.com/settings/group
#
mmsApiKey=apikeykekekekeke

#
# Base url of the MMS web server.
#
mmsBaseUrl=https://api-agents.mongodb.com

#
# Path to log file
#
logFile=/var/log/mongodb-mms-automation/automation-agent.log

#
# Path to backup cluster config to
#
mmsConfigBackup=/var/lib/mongodb-mms-automation/mms-cluster-config-backup.json

#
# Lowest log level to log.  Can be (in order): DEBUG, ROUTINE, INFO, WARN, ERROR, DOOM
#
logLevel=INFO

#
# Maximum number of rotated log files
#
maxLogFiles=10

#
# Maximum size in bytes of a log file (before rotating)
#
maxLogFileSize=268435456

#
# URL to proxy all HTTP requests through
#
#httpProxy=

#
# The absolute path to an non-system-standard location for the Kerberos configuration file
#
#krb5ConfigLocation=

#
# The path on disk that contains the trusted certificate authority certificates in PEM format.
#
#sslTrustedMMSServerCertificate=

#
# Use this option to disable certificate verification by setting this value to false.
#
#sslRequireValidMMSServerCertificates=

# For additional optional settings, please see
# https://docs.cloud.mongodb.com/reference/automation-agent/

```

### MMS Monitoring agent

#### Role file

You can set the config attribute on node or wrapper recipe.

```json
{
  "name": "mms_monitoring_agent",
  "description": "Role for MMS monitoring agent",
  "json_class": "Chef::Role",
  "default_attributes": {
    "mongodb3" : {
      "config" : {
        "mms" : {
          "api_key" : "apikeykekekekeke"
        }
      }
    }
  },
  "override_attributes": {
  },
  "chef_type": "role",
  "run_list": [
    "recipe[mongodb3::mms_monitoring_agent]"
  ],
  "env_run_lists": {
  }
}

```

#### Result of `/etc/mongodb-mms/monitoring-agent.config`

```text
# THIS FILE IS MAINTAINED BY CHEF. DO NOT MODIFY AS IT WILL BE OVERWRITTEN.

#
# Enter your API key  - See: cloud.mongodb.com/settings/group
#
mmsApiKey=apikeykekekekeke

#
# Hostname of the MMS monitoring web server.
#
mmsBaseUrl=https://api-agents.mongodb.com

#
# URL to proxy all HTTP requests through
#
#httpProxy=

#
# Set to true to enable SSL support globally and to use SSL for all MongoDB connections.
#
#useSslForAllConnections=

#
# The path to the private key, client certificate, and optional intermediate certificates in PEM format
#
#sslClientCertificate=

#
# The password needed to decrypt the private key in the file specified in sslClientCertificate.
#
#sslClientCertificatePassword=

#
# The path on disk that contains the trusted certificate authority certificates in PEM format.
#
#sslTrustedServerCertificates=

#
# Use this option to disable certificate verification by setting this value to false.
#
#sslRequireValidServerCertificates=

#
# The Kerberos principal used by the agent.
#
#krb5Principal=

#
# The absolute path to Kerberos principal's keytab file.
#
#krb5Keytab=

#
# The absolute path to an non-system-standard location for the Kerberos configuration file.
#
#krb5ConfigLocation=

#
# The default service name used by MongoDB is mongodb can specify a custom service name with the gssapiServiceName option.
#
#gsappiServiceName=

#
# By default the Monitoring Agent will use the trusted root CAs installed on the system. If the agent cannot find the trusted root CAs, configure these settings manually.
#
#sslTrustedMMSServerCertificate=

#
# You can disable certificate verification by setting this value to false.
#
#sslRequireValidMMSServerCertificates=

#
# Set to false if you do not with the Monitoring Agent to collect hardware statistics via Munin-node.
#
#enableMunin=

# For additional optional settings, please see
# https://docs.cloud.mongodb.com/reference/monitoring-agent/

```

## License and Authors

Author:: Sunggun Yu (sunggun.dev@gmail.com)

```text
Copyright (c) 2016, Sunggun Yu.

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.
```


text:
//Problem:
//Java 8
/*
Initial Thoughts:
This is a basic Quicksort, with a lot of extra space used so
that you can meet the ridiculous requirements of printing
the array in a specific order. I want to say thanks to
Ankur Sharma for helping me deal with the annoying
restrictions of this problem.

Time Complexity: O(n^2)
Space Complexity: O(n)
*/
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] ar = new int[n];
        for(int i=0;i<n;i++)
        {
           ar[i]=in.nextInt();
        }
        quickSort(ar, 0, ar.length-1);
    }

    static void quickSort(int array[], int beg, int end)
    {
        if(beg >= end)
            return;

        int wall = partition (array,beg,end);

        quickSort(array,beg,wall-1);
        quickSort(array,wall+1,end);

        printArray(array,beg, end);
    }

    static int partition(int array[], int beg, int end)
    {
        int pivot = array[beg];
        List<Integer> left = new ArrayList<>();
        List<Integer> right = new ArrayList<>();

        for(int i = beg+1 ; i <= end; i++)
        {
               if(array[i] > pivot)
                   right.add(array[i]);
               else
                   left.add(array[i]);
        }
        copy(left,array,beg);
        int wall = left.size()+beg;
        array[wall] = pivot;
        copy(right,array,wall+1);

        return beg + left.size();
    }

    static void copy(List<Integer> list, int array[], int beg)
    {
        for(int num : list)
        {
           array[beg++] = num;
        }
    }

    static void printArray(int[] ar,int beg, int end)
    {
        for(int i = beg; i <= end;i++)
        {
            System.out.print(ar[i]+" ");
        }
        System.out.println("");
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:security="http://www.springframework.org/schema/security"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

    <security:global-method-security secured-annotations="enabled" />

	<security:http auto-config="true">
        <security:intercept-url pattern="/app/resources/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <security:intercept-url pattern="/app/javax.faces.resource/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<!--         <security:intercept-url pattern="/app/authenticated" access="IS_AUTHENTICATED_ANONYMOUSLY" /> -->
        <security:intercept-url pattern="/app/signin*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <security:intercept-url pattern="/**" access="ROLE_USER" />

        <security:form-login login-page="/app/signin"
                             default-target-url="/app/home"
                             always-use-default-target="true"
                             authentication-failure-url="/app/signin?failed=1" />

        <security:logout logout-url="/app/signout" logout-success-url="/app/signin" />

        <security:remember-me key="remember-me-key"/>
    </security:http>

	<security:authentication-manager erase-credentials="false">
		<security:authentication-provider user-service-ref="cvz-user-service">
			<security:password-encoder ref="encoder" />
<!-- 			<security:user-service> -->
<!-- 				<security:user name="owner" password="$2a$10$w.Jjtx0mrjH4E.DxQEmBZu.D1oCBKy26utS8KCOSn0fmq1xs2GXiK" authorities="ROLE_USER" /> -->
<!-- 			</security:user-service> -->
		</security:authentication-provider>
	</security:authentication-manager>

	<bean id="cvz-user-service" class="com.civilizer.security.UserDetailsService">
	</bean>

	<bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
		<constructor-arg name="strength" value="11" />
	</bean>

</beans>


text:
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<!-- TODO: a jarjar format would be better -->
    <id>project</id>
    <formats>
        <format>tar.gz</format>
        <format>tar.bz2</format>
        <format>zip</format>
    </formats>
    <fileSets>
        <fileSet>
            <directory>${project.basedir}</directory>
            <outputDirectory>/</outputDirectory>
            <useDefaultExcludes>true</useDefaultExcludes>
            <excludes>
                <exclude>**/*.log</exclude>
                <exclude>**/${project.build.directory}/**</exclude>
            </excludes>
        </fileSet>
    </fileSets>
</assembly>


text:
repo: wq.db
date: 2014-07-08
---

# wq.db 0.6.1

This release provides additional improvements to wq.db 0.6.0, particularly to the `wq.db.contrib.dbio` submodule.
- made auto_import a fully async task
- serialize import exceptions with `str()`
- hooks to filter and modify identified metadata
- use timezone-aware now() for `Report.entered`


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

using tursibNow.Model;
using tursibNow.Core;

namespace tursibNow.AndroidUI
{
    public class BusSearchResultsViewAdapter : BaseAdapter<Bus>
    {
        readonly Activity _context;
        readonly IEnumerable<Tuple<Bus, Station>> _searchResultsBuses;

        public override Bus this[int position]
        {
            get { return _searchResultsBuses.ElementAt(position).Item1; }
        }

        public override int Count
        {
            get { return _searchResultsBuses.Count(); }
        }

        public override long GetItemId(int position)
        {
            int toReturn;
            if (Int32.TryParse(_searchResultsBuses.ElementAt(position).Item1.Number, out toReturn))
            {
                return toReturn;
            }
            return 0;
        }

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            //reuse an already created view
            View view = convertView;

            //create new view if one does not exist
            if (view == null)
            {
                view = _context.LayoutInflater.Inflate(Resource.Layout.BusSearchResultsItem, null);
            }

            Bus bus = _searchResultsBuses.ElementAt(position).Item1;
            Station station = _searchResultsBuses.ElementAt(position).Item2;
            view.FindViewById<TextView>(Resource.Id.BusSearchResultsItemBusName).Text = bus.Number + " - " + bus.Name;
            view.FindViewById<TextView>(Resource.Id.BusSearchResultsItemDepartureStationName).Text = ""; //station.Name;

            // Add next bus arrivals
            Timing timing = new Timing();
            view.FindViewById<TextView>(Resource.Id.BusSearchResultsItemDepartureTimes).Text =
                timing.NextTimes(station.TimeTable, 5).DateTimeListToString();

            return view;
        }

        public BusSearchResultsViewAdapter(Activity context, IEnumerable<Tuple<Bus, Station>> searchResultsBuses)
        {
            _context = context;
            _searchResultsBuses = searchResultsBuses;
        }
    }
}


text:
class OtherLang < ActiveRecord::Base
  belongs_to :manuscript
  belongs_to :lang, class_name: "Iso639Config::Lang"

  delegate :name, to: :lang, prefix: true
  delegate :bib_code, to: :lang
end


text:
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from populous.advertising.models import TextAd, GraphicAd, VideoAd, CouponCategory, \
                                        Coupon, ClassifiedSubCategory, ClassifiedCategory, \
                                        ClassifiedAd, UploadClassifiedAdSet, CurrentClassifiedAdSet, \
                                        Client, Placement, Statistic, ScheduledAd

DEFAULT_ADMIN_JS = ['js/jquery.js', 'js/related_content.js', 'js/generic.js',]
DEFAULT_ADMIN_FIELDS = [
        (None, {
            'fields': (('name', 'slug'), 'client',)
        }),
    ]

def fields(fields):
    """
    Helper function to extend default admin fields.

    Usage::

    class ExampleAdmin(admin.ModelAdmin):
        fields = fields(
            (_('Label'), {
                'fields': ('some', 'field', 'names',)
            })
        )
    """
    import copy
    return_fields = copy.copy(DEFAULT_ADMIN_FIELDS)
    return_fields.append(fields)
    return return_fields

class TextAdAdmin(admin.ModelAdmin):
    fields = fields(
        (_('Ad information'), {
            'fields': ('kicker', 'caption', 'decked_head', 'content', ('image_only', 'image'), ('link_only', 'link',),)
        })
    )
    js = (DEFAULT_ADMIN_JS, )
    prepopulate_fields = {'slug': ('name',)}
    list_display = ('name', 'client')
    search_fields = ('name', 'kicker', 'decked_head', 'content',)
    list_filter = ('image_only', 'link_only')
    list_select_related = True
    raw_id_fields = ('client',)

class GraphicAdAdmin(admin.ModelAdmin):
    fields = fields(
        (_('Ad information'), {
            'fields': ('image', 'url', )
        })
    )
    js = (DEFAULT_ADMIN_JS, )
    prepopulate_fields = {'slug': ('name',)}
    list_display = ('name', 'client',)
    search_fields = ('name', 'client__name', 'image', 'url',)
    list_select_related = True
    raw_id_fields = ('client',)
    save_as = True

class VideoAdAdmin(admin.ModelAdmin):
    fields = fields(
        (_('Ad information'), {
            'fields': ('video', 'url',)
        })
    )
    js = (DEFAULT_ADMIN_JS, )
    prepopulate_fields = {'slug': ('name',)}
    raw_id_fields = ('client',)

class CouponCategoryAdmin(admin.ModelAdmin):
    prepopulate_fields = {'slug': ('name',)}

class CouponAdmin(admin.ModelAdmin):
    fields = fields(
        (_('Ad information'), {
            'fields': ('headline', 'category', 'image', 'image_orientation',)
        })
    )
    js = (DEFAULT_ADMIN_JS, )
    prepopulate_fields = {'slug': ('name',)}
    raw_id_fields = ('client',)

class ClassifiedSubCategoryAdmin(admin.ModelAdmin):
    prepopulate_fields = {'slug': ('sub_category_id', 'name',)}

class ClassifiedCategoryAdmin(admin.ModelAdmin):
    prepopulate_fields = {'slug': ('name',)}

class ClassifiedAdAdmin(admin.ModelAdmin):
    prepopulate_fields = {'slug': ('name',)}

#####################
##  Admin Options  ##
#####################

class ClientAdmin(admin.ModelAdmin):
    fields = (
        (None, {
            'classes': 'wide',
            'fields': ('name', ('phone1', 'phone2',), 'fax', 'email', 'website',)
        }),
        (_('Contact information'), {
            'classes': 'wide',
            'fields': ('address1', 'address2', 'city', 'state', 'zipcode', 'country', )
        }),
    )
    js = ('js/jquery.js', 'js/related_content.js', )
    list_display = ('name', 'get_client_ad_count')
    search_fields = ('name', 'phone1', 'phone2', 'fax', 'email', 'website', 'address1', 'address2', 'city', 'state', 'ziode', 'country',)
    list_select_related = True

class PlacementStackedInline(admin.StackedInline):
    model = ScheduledAd
    extra = 1

class PlacementAdmin(admin.ModelAdmin):
    fields = (
        (None, {
            'fields': (('location', 'type_placement'), 'notes', 'sites', 'allowable_ad_types', 'image', 'height', 'width', 'template', 'num_ads', 'orientation')
        }),
        (_('Random properties'), {
            'fields': ('random', 'random_ad_types',),
            'classes': 'collapse',
        }),
    )
    js = ('js/advertising/jquery.js', 'js/advertising/thickbox.js', 'js/advertising/generic.js', 'js/advertising/ad_behavior.js', 'js/advertising/placements.js',)
    list_display = ('location', 'notes', 'type_placement', 'get_ad_count')
    list_filter = ('type_placement',)
    list_select_related = True
    filter_horizontal = ('random_ad_types', )
    ordering = ('location',)
    inlines = (PlacementStackedInline,)

class StatisticAdmin(admin.ModelAdmin):
    fields = (
        (None, {
            'fields': (('ad_type', 'ad_id'), 'placement', ('clickthrough_count', 'impression_count'), ('start_date', 'end_date'),)
        }),
    )
    js = ('js/jquery.js', 'js/generic.js')
    list_display = ('get_advertisement', 'placement', 'clickthrough_count', 'impression_count',  'ad_type',)
    list_select_related = True
    date_hierarchy = 'start_date'

admin.site.register(Client, ClientAdmin)
admin.site.register(Placement, PlacementAdmin)
admin.site.register(Statistic, StatisticAdmin)
admin.site.register(ScheduledAd)

admin.site.register(TextAd, TextAdAdmin)
admin.site.register(GraphicAd, GraphicAdAdmin)
admin.site.register(VideoAd, VideoAdAdmin)
admin.site.register(CouponCategory, CouponCategoryAdmin)
admin.site.register(Coupon, CouponAdmin)
admin.site.register(ClassifiedSubCategory, ClassifiedSubCategoryAdmin)
admin.site.register(ClassifiedCategory, ClassifiedCategoryAdmin)
admin.site.register(ClassifiedAd, ClassifiedAdAdmin)
admin.site.register(UploadClassifiedAdSet)
admin.site.register(CurrentClassifiedAdSet)


text: nodeschool tuts


text:
      PY_VERSION_HEX >= 0x03060000
#    include <filesystem>
#    define PYBIND11_HAS_FILESYSTEM 1
#  endif
#endif

#if !defined(PYBIND11_HAS_FILESYSTEM) && !defined(PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL)
#    error                                                                                \
        "#include <filesystem> is not available. (Use -DPYBIND11_HAS_FILESYSTEM_IS_OPTIONAL to ignore.)"
#endif

PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
PYBIND11_NAMESPACE_BEGIN(detail)

#if defined(PYBIND11_HAS_FILESYSTEM)
template<typename T> struct path_caster {

private:
    static PyObject* unicode_from_fs_native(const std::string& w) {
#if !defined(PYPY_VERSION)
        return PyUnicode_DecodeFSDefaultAndSize(w.c_str(), ssize_t(w.size()));
#else
        // PyPy mistakenly declares the first parameter as non-const.
        return PyUnicode_DecodeFSDefaultAndSize(
            const_cast<char*>(w.c_str()), ssize_t(w.size()));
#endif
    }

    static PyObject* unicode_from_fs_native(const std::wstring& w) {
        return PyUnicode_FromWideChar(w.c_str(), ssize_t(w.size()));
    }

public:
    static handle cast(const T& path, return_value_policy, handle) {
        if (auto py_str = unicode_from_fs_native(path.native())) {
            return module_::import("pathlib").attr("Path")(reinterpret_steal<object>(py_str))
                   .release();
        }
        return nullptr;
    }

    bool load(handle handle, bool) {
        // PyUnicode_FSConverter and PyUnicode_FSDecoder normally take care of
        // calling PyOS_FSPath themselves, but that's broken on PyPy (PyPy
        // issue #3168) so we do it ourselves instead.
        PyObject* buf = PyOS_FSPath(handle.ptr());
        if (!buf) {
            PyErr_Clear();
            return false;
        }
        PyObject* native = nullptr;
        if constexpr (std::is_same_v<typename T::value_type, char>) {
            if (PyUnicode_FSConverter(buf, &native) != 0) {
                if (auto c_str = PyBytes_AsString(native)) {
                    // AsString returns a pointer to the internal buffer, which
                    // must not be free'd.
                    value = c_str;
                }
            }
        } else if constexpr (std::is_same_v<typename T::value_type, wchar_t>) {
            if (PyUnicode_FSDecoder(buf, &native) != 0) {
                if (auto c_str = PyUnicode_AsWideCharString(native, nullptr)) {
                    // AsWideCharString returns a new string that must be free'd.
                    value = c_str;  // Copies the string.
                    PyMem_Free(c_str);
                }
            }
        }
        Py_XDECREF(native);
        Py_DECREF(buf);
        if (PyErr_Occurred()) {
            PyErr_Clear();
            return false;
        }
        return true;
    }

    PYBIND11_TYPE_CASTER(T, const_name("os.PathLike"));
};

template<> struct type_caster<std::filesystem::path>
    : public path_caster<std::filesystem::path> {};
#endif // PYBIND11_HAS_FILESYSTEM

PYBIND11_NAMESPACE_END(detail)
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)


text:
root_dir=`dirname $0`
cd $root_dir
rm -rf build dist kvmagent.egg-info

python setup.py sdist
pip uninstall -y kvmagent
pip install  dist/*.tar.gz --force-reinstall