text:
import logging
import os

import testtools
import zuul.cmd.cloner

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(name)-32s '
                    '%(levelname)-8s %(message)s')

class TestClonerCmdArguments(testtools.TestCase):

    def setUp(self):
        super(TestClonerCmdArguments, self).setUp()
        self.app = zuul.cmd.cloner.Cloner()

    def test_default_cache_dir_empty(self):
        self.app.parse_arguments(['base', 'repo'])
        self.assertEqual(None, self.app.args.cache_dir)

    def test_default_cache_dir_environ(self):
        try:
            os.environ['ZUUL_CACHE_DIR'] = 'fromenviron'
            self.app.parse_arguments(['base', 'repo'])
            self.assertEqual('fromenviron', self.app.args.cache_dir)
        finally:
            del os.environ['ZUUL_CACHE_DIR']

    def test_default_cache_dir_override_environ(self):
        try:
            os.environ['ZUUL_CACHE_DIR'] = 'fromenviron'
            self.app.parse_arguments(['--cache-dir', 'argument',
                                      'base', 'repo'])
            self.assertEqual('argument', self.app.args.cache_dir)
        finally:
            del os.environ['ZUUL_CACHE_DIR']

    def test_default_cache_dir_argument(self):
        self.app.parse_arguments(['--cache-dir', 'argument',
                                  'base', 'repo'])
        self.assertEqual('argument', self.app.args.cache_dir)

redpajama_set_name: RedPajamaGithub


text:
require 'bundler/setup'

if ENV["COVERAGE"]
  require 'simplecov'
  SimpleCov.start do
    add_filter '/test/'
  end
end

require 'vm_dl'

unless VM_DL.checksum
  puts
  puts "These tests require a test box for importing and machine tests."
  puts "This box will now be downloaded to '#{VM_DL::VM_LOC}'."
  puts

  require 'fileutils'
  FileUtils.rm_f(VM_DL::VM_LOC)
  VM_DL.download
  unless VM_DL.checksum
    raise "Cannot find an appropriate box for testing"
  end
end

require 'timeout'
require 'furnish/test'
require 'minitest/autorun'


text:
package com.frontlinedubai.dao;

import com.frontlinedubai.model.Menu;

import java.util.List;

public interface MenuDao {

    public List<Menu> getAllMenus();

    public List<Menu> getAllMenusByCuisine(String cuisineName);

    public List<Menu> getAllMenusByCuisineAndCategory(String cuisineName, String category);

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Package org.apache.poi.hssf.record.cf (POI API Documentation)
</TITLE>

<META NAME="date" CONTENT="2009-12-14">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.poi.hssf.record.cf

Packages that use org.apache.poi.hssf.record.cf

org.apache.poi.hssf.record
Record package contains class representations for XLS binary strutures.

org.apache.poi.hssf.usermodel
usermodel package maps HSSF low level strutures to familiar workbook/sheet model

Classes in org.apache.poi.hssf.record.cf used by org.apache.poi.hssf.record

BorderFormatting

          Border Formatting Block of the Conditional Formatting Rule Record.

FontFormatting

          Font Formatting Block of the Conditional Formatting Rule Record.

PatternFormatting

          Pattern Formatting Block of the Conditional Formatting Rule Record.

Classes in org.apache.poi.hssf.record.cf used by org.apache.poi.hssf.usermodel

BorderFormatting

          Border Formatting Block of the Conditional Formatting Rule Record.

FontFormatting

          Font Formatting Block of the Conditional Formatting Rule Record.

PatternFormatting

          Pattern Formatting Block of the Conditional Formatting Rule Record.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

                Copyright 2009 The Apache Software Foundation or
        its licensors, as applicable.


text:
<!DOCTYPE html>

    <title>Zoom Test - UGWA</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

Zoom Test


text:
package com.cisco.axl.api._8;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for UpdateCallManagerReq complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="UpdateCallManagerReq">
 *   <complexContent>
 *     <extension base="{http://www.cisco.com/AXL/API/8.0}NameAndGUIDRequest">
 *       <sequence>
 *         <element name="newName" type="{http://www.cisco.com/AXL/API/8.0}String50" minOccurs="0"/>
 *         <element name="description" type="{http://www.cisco.com/AXL/API/8.0}String50" minOccurs="0"/>
 *         <element name="autoRegistration" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence minOccurs="0">
 *                   <element name="startDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
 *                   <element name="endDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
 *                   <element name="nextDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
 *                   <element name="routePartitionName" type="{http://www.cisco.com/AXL/API/8.0}XFkType" minOccurs="0"/>
 *                   <element name="e164Mask" type="{http://www.cisco.com/AXL/API/8.0}String50" minOccurs="0"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="ports" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence minOccurs="0">
 *                   <choice>
 *                     <element name="ethernetPhonePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
 *                   </choice>
 *                   <element name="mgcpPorts">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <sequence minOccurs="0">
 *                             <element name="listen" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
 *                             <element name="keepAlive" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
 *                           </sequence>
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                   <element name="sipPorts">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <sequence minOccurs="0">
 *                             <element name="sipPhonePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
 *                             <element name="sipPhoneSecurePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
 *                           </sequence>
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UpdateCallManagerReq", propOrder = {
    "newName",
    "description",
    "autoRegistration",
    "ports"
})
public class UpdateCallManagerReq
    extends NameAndGUIDRequest
{

    protected String newName;
    protected String description;
    protected UpdateCallManagerReq.AutoRegistration autoRegistration;
    protected UpdateCallManagerReq.Ports ports;

    /**
     * Gets the value of the newName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getNewName() {
        return newName;
    }

    /**
     * Sets the value of the newName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setNewName(String value) {
        this.newName = value;
    }

    /**
     * Gets the value of the description property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the value of the description property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDescription(String value) {
        this.description = value;
    }

    /**
     * Gets the value of the autoRegistration property.
     *
     * @return
     *     possible object is
     *     {@link UpdateCallManagerReq.AutoRegistration }
     *
     */
    public UpdateCallManagerReq.AutoRegistration getAutoRegistration() {
        return autoRegistration;
    }

    /**
     * Sets the value of the autoRegistration property.
     *
     * @param value
     *     allowed object is
     *     {@link UpdateCallManagerReq.AutoRegistration }
     *
     */
    public void setAutoRegistration(UpdateCallManagerReq.AutoRegistration value) {
        this.autoRegistration = value;
    }

    /**
     * Gets the value of the ports property.
     *
     * @return
     *     possible object is
     *     {@link UpdateCallManagerReq.Ports }
     *
     */
    public UpdateCallManagerReq.Ports getPorts() {
        return ports;
    }

    /**
     * Sets the value of the ports property.
     *
     * @param value
     *     allowed object is
     *     {@link UpdateCallManagerReq.Ports }
     *
     */
    public void setPorts(UpdateCallManagerReq.Ports value) {
        this.ports = value;
    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence minOccurs="0">
     *         <element name="startDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
     *         <element name="endDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
     *         <element name="nextDn" type="{http://www.cisco.com/AXL/API/8.0}String255" minOccurs="0"/>
     *         <element name="routePartitionName" type="{http://www.cisco.com/AXL/API/8.0}XFkType" minOccurs="0"/>
     *         <element name="e164Mask" type="{http://www.cisco.com/AXL/API/8.0}String50" minOccurs="0"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "startDn",
        "endDn",
        "nextDn",
        "routePartitionName",
        "e164Mask"
    })
    public static class AutoRegistration {

        @XmlElement(defaultValue = "1000")
        protected String startDn;
        @XmlElement(defaultValue = "1000")
        protected String endDn;
        @XmlElement(defaultValue = "1000")
        protected String nextDn;
        @XmlElementRef(name = "routePartitionName", type = JAXBElement.class)
        protected JAXBElement<XFkType> routePartitionName;
        @XmlElementRef(name = "e164Mask", type = JAXBElement.class)
        protected JAXBElement<String> e164Mask;

        /**
         * Gets the value of the startDn property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getStartDn() {
            return startDn;
        }

        /**
         * Sets the value of the startDn property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setStartDn(String value) {
            this.startDn = value;
        }

        /**
         * Gets the value of the endDn property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getEndDn() {
            return endDn;
        }

        /**
         * Sets the value of the endDn property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setEndDn(String value) {
            this.endDn = value;
        }

        /**
         * Gets the value of the nextDn property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getNextDn() {
            return nextDn;
        }

        /**
         * Sets the value of the nextDn property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setNextDn(String value) {
            this.nextDn = value;
        }

        /**
         * Gets the value of the routePartitionName property.
         *
         * @return
         *     possible object is
         *     {@link JAXBElement }{@code <}{@link XFkType }{@code >}
         *
         */
        public JAXBElement<XFkType> getRoutePartitionName() {
            return routePartitionName;
        }

        /**
         * Sets the value of the routePartitionName property.
         *
         * @param value
         *     allowed object is
         *     {@link JAXBElement }{@code <}{@link XFkType }{@code >}
         *
         */
        public void setRoutePartitionName(JAXBElement<XFkType> value) {
            this.routePartitionName = ((JAXBElement<XFkType> ) value);
        }

        /**
         * Gets the value of the e164Mask property.
         *
         * @return
         *     possible object is
         *     {@link JAXBElement }{@code <}{@link String }{@code >}
         *
         */
        public JAXBElement<String> getE164Mask() {
            return e164Mask;
        }

        /**
         * Sets the value of the e164Mask property.
         *
         * @param value
         *     allowed object is
         *     {@link JAXBElement }{@code <}{@link String }{@code >}
         *
         */
        public void setE164Mask(JAXBElement<String> value) {
            this.e164Mask = ((JAXBElement<String> ) value);
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence minOccurs="0">
     *         <choice>
     *           <element name="ethernetPhonePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
     *         </choice>
     *         <element name="mgcpPorts">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <sequence minOccurs="0">
     *                   <element name="listen" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
     *                   <element name="keepAlive" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
     *                 </sequence>
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *         <element name="sipPorts">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <sequence minOccurs="0">
     *                   <element name="sipPhonePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
     *                   <element name="sipPhoneSecurePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
     *                 </sequence>
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "ethernetPhonePort",
        "mgcpPorts",
        "sipPorts"
    })
    public static class Ports {

        @XmlElement(defaultValue = "2000")
        protected String ethernetPhonePort;
        protected UpdateCallManagerReq.Ports.MgcpPorts mgcpPorts;
        protected UpdateCallManagerReq.Ports.SipPorts sipPorts;

        /**
         * Gets the value of the ethernetPhonePort property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getEthernetPhonePort() {
            return ethernetPhonePort;
        }

        /**
         * Sets the value of the ethernetPhonePort property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setEthernetPhonePort(String value) {
            this.ethernetPhonePort = value;
        }

        /**
         * Gets the value of the mgcpPorts property.
         *
         * @return
         *     possible object is
         *     {@link UpdateCallManagerReq.Ports.MgcpPorts }
         *
         */
        public UpdateCallManagerReq.Ports.MgcpPorts getMgcpPorts() {
            return mgcpPorts;
        }

        /**
         * Sets the value of the mgcpPorts property.
         *
         * @param value
         *     allowed object is
         *     {@link UpdateCallManagerReq.Ports.MgcpPorts }
         *
         */
        public void setMgcpPorts(UpdateCallManagerReq.Ports.MgcpPorts value) {
            this.mgcpPorts = value;
        }

        /**
         * Gets the value of the sipPorts property.
         *
         * @return
         *     possible object is
         *     {@link UpdateCallManagerReq.Ports.SipPorts }
         *
         */
        public UpdateCallManagerReq.Ports.SipPorts getSipPorts() {
            return sipPorts;
        }

        /**
         * Sets the value of the sipPorts property.
         *
         * @param value
         *     allowed object is
         *     {@link UpdateCallManagerReq.Ports.SipPorts }
         *
         */
        public void setSipPorts(UpdateCallManagerReq.Ports.SipPorts value) {
            this.sipPorts = value;
        }

        /**
         *
Java class for anonymous complex type.
         *
         *
The following schema fragment specifies the expected content contained within this class.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <sequence minOccurs="0">
         *         <element name="listen" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
         *         <element name="keepAlive" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
         *       </sequence>
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {
            "listen",
            "keepAlive"
        })
        public static class MgcpPorts {

            @XmlElement(defaultValue = "2427")
            protected String listen;
            @XmlElement(defaultValue = "2428")
            protected String keepAlive;

            /**
             * Gets the value of the listen property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getListen() {
                return listen;
            }

            /**
             * Sets the value of the listen property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setListen(String value) {
                this.listen = value;
            }

            /**
             * Gets the value of the keepAlive property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getKeepAlive() {
                return keepAlive;
            }

            /**
             * Sets the value of the keepAlive property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setKeepAlive(String value) {
                this.keepAlive = value;
            }

        }

        /**
         *
Java class for anonymous complex type.
         *
         *
The following schema fragment specifies the expected content contained within this class.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <sequence minOccurs="0">
         *         <element name="sipPhonePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
         *         <element name="sipPhoneSecurePort" type="{http://www.cisco.com/AXL/API/8.0}XInteger"/>
         *       </sequence>
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {
            "sipPhonePort",
            "sipPhoneSecurePort"
        })
        public static class SipPorts {

            @XmlElement(defaultValue = "5060")
            protected String sipPhonePort;
            @XmlElement(defaultValue = "5061")
            protected String sipPhoneSecurePort;

            /**
             * Gets the value of the sipPhonePort property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getSipPhonePort() {
                return sipPhonePort;
            }

            /**
             * Sets the value of the sipPhonePort property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setSipPhonePort(String value) {
                this.sipPhonePort = value;
            }

            /**
             * Gets the value of the sipPhoneSecurePort property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getSipPhoneSecurePort() {
                return sipPhoneSecurePort;
            }

            /**
             * Sets the value of the sipPhoneSecurePort property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setSipPhoneSecurePort(String value) {
                this.sipPhoneSecurePort = value;
            }

        }

    }

}


text:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
          http://maven.apache.org/xsd/assembly-1.1.2.xsd">

    <id>archive</id>

    <formats>
        <format>tar.gz</format>
    </formats>

    <includeBaseDirectory>false</includeBaseDirectory>

    <fileSets>
        <!-- copy any resources for the specified deployment type into config/ -->
        <fileSet>
            <directory>src/main/solr-5-config/</directory>
            <outputDirectory>solr5config/</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>


text:
using namespace utbm::atoms;

AtomsDialog::AtomsDialog()
{
}
AtomsDialog::~AtomsDialog()
{
}


text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/memory_pressure/system_memory_pressure_evaluator_win.h"

#include <windows.h>
#include <memory>

#include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/system/sys_info.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/win/object_watcher.h"
#include "components/memory_pressure/multi_source_memory_pressure_monitor.h"

namespace memory_pressure {
namespace win {

namespace {

static const DWORDLONG kMBBytes = 1024 * 1024;

// Implements ObjectWatcher::Delegate by forwarding to a provided callback.
class MemoryPressureWatcherDelegate
    : public base::win::ObjectWatcher::Delegate {
 public:
  MemoryPressureWatcherDelegate(base::win::ScopedHandle handle,
                                base::OnceClosure callback);
  ~MemoryPressureWatcherDelegate() override;
  MemoryPressureWatcherDelegate(const MemoryPressureWatcherDelegate& other) =
      delete;
  MemoryPressureWatcherDelegate& operator=(
      const MemoryPressureWatcherDelegate&) = delete;

  void ReplaceWatchedHandleForTesting(base::win::ScopedHandle handle);
  void SetCallbackForTesting(base::OnceClosure callback) {
    callback_ = std::move(callback);
  }

 private:
  void OnObjectSignaled(HANDLE handle) override;

  base::win::ScopedHandle handle_;
  base::win::ObjectWatcher watcher_;
  base::OnceClosure callback_;
};

MemoryPressureWatcherDelegate::MemoryPressureWatcherDelegate(
    base::win::ScopedHandle handle,
    base::OnceClosure callback)
    : handle_(std::move(handle)), callback_(std::move(callback)) {
  DCHECK(handle_.IsValid());
  CHECK(watcher_.StartWatchingOnce(handle_.Get(), this));
}

MemoryPressureWatcherDelegate::~MemoryPressureWatcherDelegate() = default;

void MemoryPressureWatcherDelegate::ReplaceWatchedHandleForTesting(
    base::win::ScopedHandle handle) {
  if (watcher_.IsWatching())
    watcher_.StopWatching();
  handle_ = std::move(handle);
  CHECK(watcher_.StartWatchingOnce(handle_.Get(), this));
}

void MemoryPressureWatcherDelegate::OnObjectSignaled(HANDLE handle) {
  DCHECK_EQ(handle, handle_.Get());
  std::move(callback_).Run();
}

}  // namespace

// Check the amount of RAM left every 5 seconds.
const base::TimeDelta SystemMemoryPressureEvaluator::kMemorySamplingPeriod =
    base::Seconds(5);

// The following constants have been lifted from similar values in the ChromeOS
// memory pressure monitor. The values were determined experimentally to ensure
// sufficient responsiveness of the memory pressure subsystem, and minimal
// overhead.
const base::TimeDelta SystemMemoryPressureEvaluator::kModeratePressureCooldown =
    base::Seconds(10);

// TODO(chrisha): Explore the following constants further with an experiment.

// A system is considered 'high memory' if it has more than 1.5GB of system
// memory available for use by the memory manager (not reserved for hardware
// and drivers). This is a fuzzy version of the ~2GB discussed below.
const int SystemMemoryPressureEvaluator::kLargeMemoryThresholdMb = 1536;

// These are the default thresholds used for systems with < ~2GB of physical
// memory. Such systems have been observed to always maintain ~100MB of
// available memory, paging until that is the case. To try to avoid paging a
// threshold slightly above this is chosen. The moderate threshold is slightly
// less grounded in reality and chosen as 2.5x critical.
const int
    SystemMemoryPressureEvaluator::kSmallMemoryDefaultModerateThresholdMb = 500;
const int
    SystemMemoryPressureEvaluator::kSmallMemoryDefaultCriticalThresholdMb = 200;

// These are the default thresholds used for systems with >= ~2GB of physical
// memory. Such systems have been observed to always maintain ~300MB of
// available memory, paging until that is the case.
const int
    SystemMemoryPressureEvaluator::kLargeMemoryDefaultModerateThresholdMb =
        1000;
const int
    SystemMemoryPressureEvaluator::kLargeMemoryDefaultCriticalThresholdMb = 400;

// A memory pressure evaluator that receives memory pressure notifications from
// the OS and forwards them to the memory pressure monitor.
class SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator {
 public:
  using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel;

  explicit OSSignalsMemoryPressureEvaluator(
      std::unique_ptr<MemoryPressureVoter> voter);
  ~OSSignalsMemoryPressureEvaluator();
  OSSignalsMemoryPressureEvaluator(
      const OSSignalsMemoryPressureEvaluator& other) = delete;
  OSSignalsMemoryPressureEvaluator& operator=(
      const OSSignalsMemoryPressureEvaluator&) = delete;

  // Creates the watcher used to receive the low and high memory notifications.
  void Start();

  MemoryPressureWatcherDelegate* GetWatcherForTesting() const {
    return memory_notification_watcher_.get();
  }
  void WaitForHighMemoryNotificationForTesting(base::OnceClosure closure);

 private:
  // Called when receiving a low/high memory notification.
  void OnLowMemoryNotification();
  void OnHighMemoryNotification();

  void StartLowMemoryNotificationWatcher();
  void StartHighMemoryNotificationWatcher();

  // The period of the critical pressure notification timer.
  static constexpr base::TimeDelta kHighPressureNotificationInterval =
      base::Seconds(2);

  // The voter used to cast the votes.
  std::unique_ptr<MemoryPressureVoter> voter_;

  // The memory notification watcher.
  std::unique_ptr<MemoryPressureWatcherDelegate> memory_notification_watcher_;

  // Timer that will re-emit the critical memory pressure signal until the
  // memory gets high again.
  base::RepeatingTimer critical_pressure_notification_timer_;

  // Beginning of the critical memory pressure session.
  base::TimeTicks critical_pressure_session_begin_;

  // Ensures that this object is used from a single sequence.
  SEQUENCE_CHECKER(sequence_checker_);
};

SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator(
    std::unique_ptr<MemoryPressureVoter> voter)
    : memory_pressure::SystemMemoryPressureEvaluator(std::move(voter)),
      moderate_threshold_mb_(0),
      critical_threshold_mb_(0),
      moderate_pressure_repeat_count_(0) {
  InferThresholds();
  StartObserving();
}

SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator(
    int moderate_threshold_mb,
    int critical_threshold_mb,
    std::unique_ptr<MemoryPressureVoter> voter)
    : memory_pressure::SystemMemoryPressureEvaluator(std::move(voter)),
      moderate_threshold_mb_(moderate_threshold_mb),
      critical_threshold_mb_(critical_threshold_mb),
      moderate_pressure_repeat_count_(0) {
  DCHECK_GE(moderate_threshold_mb_, critical_threshold_mb_);
  DCHECK_LE(0, critical_threshold_mb_);
  StartObserving();
}

SystemMemoryPressureEvaluator::~SystemMemoryPressureEvaluator() {
  StopObserving();
}

void SystemMemoryPressureEvaluator::CheckMemoryPressureSoon() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
      FROM_HERE, BindOnce(&SystemMemoryPressureEvaluator::CheckMemoryPressure,
                          weak_ptr_factory_.GetWeakPtr()));
}

void SystemMemoryPressureEvaluator::CreateOSSignalPressureEvaluator(
    std::unique_ptr<MemoryPressureVoter> voter) {
  os_signals_evaluator_ =
      std::make_unique<OSSignalsMemoryPressureEvaluator>(std::move(voter));
  os_signals_evaluator_->Start();
}

void SystemMemoryPressureEvaluator::ReplaceWatchedHandleForTesting(
    base::win::ScopedHandle handle) {
  os_signals_evaluator_->GetWatcherForTesting()->ReplaceWatchedHandleForTesting(
      std::move(handle));
}

void SystemMemoryPressureEvaluator::WaitForHighMemoryNotificationForTesting(
    base::OnceClosure closure) {
  os_signals_evaluator_->WaitForHighMemoryNotificationForTesting(
      std::move(closure));
}

void SystemMemoryPressureEvaluator::InferThresholds() {
  // Default to a 'high' memory situation, which uses more conservative
  // thresholds.
  bool high_memory = true;
  MEMORYSTATUSEX mem_status = {};
  if (GetSystemMemoryStatus(&mem_status)) {
    static const DWORDLONG kLargeMemoryThresholdBytes =
        static_cast<DWORDLONG>(kLargeMemoryThresholdMb) * kMBBytes;
    high_memory = mem_status.ullTotalPhys >= kLargeMemoryThresholdBytes;
  }

  if (high_memory) {
    moderate_threshold_mb_ = kLargeMemoryDefaultModerateThresholdMb;
    critical_threshold_mb_ = kLargeMemoryDefaultCriticalThresholdMb;
  } else {
    moderate_threshold_mb_ = kSmallMemoryDefaultModerateThresholdMb;
    critical_threshold_mb_ = kSmallMemoryDefaultCriticalThresholdMb;
  }
}

void SystemMemoryPressureEvaluator::StartObserving() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  timer_.Start(
      FROM_HERE, kMemorySamplingPeriod,
      BindRepeating(&SystemMemoryPressureEvaluator::CheckMemoryPressure,
                    weak_ptr_factory_.GetWeakPtr()));
}

void SystemMemoryPressureEvaluator::StopObserving() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  // If StartObserving failed, StopObserving will still get called.
  timer_.Stop();
  weak_ptr_factory_.InvalidateWeakPtrs();
}

void SystemMemoryPressureEvaluator::CheckMemoryPressure() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  // Get the previous pressure level and update the current one.
  MemoryPressureLevel old_vote = current_vote();
  SetCurrentVote(CalculateCurrentPressureLevel());

  // |notify| will be set to true if MemoryPressureListeners need to be
  // notified of a memory pressure level state change.
  bool notify = false;
  switch (current_vote()) {
    case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
      break;

    case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
      if (old_vote != current_vote()) {
        // This is a new transition to moderate pressure so notify.
        moderate_pressure_repeat_count_ = 0;
        notify = true;
      } else {
        // Already in moderate pressure, only notify if sustained over the
        // cooldown period.
        const int kModeratePressureCooldownCycles =
            kModeratePressureCooldown / kMemorySamplingPeriod;
        if (++moderate_pressure_repeat_count_ ==
            kModeratePressureCooldownCycles) {
          moderate_pressure_repeat_count_ = 0;
          notify = true;
        }
      }
      break;

    case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
      // Always notify of critical pressure levels.
      notify = true;
      break;
  }

  SendCurrentVote(notify);
}

base::MemoryPressureListener::MemoryPressureLevel
SystemMemoryPressureEvaluator::CalculateCurrentPressureLevel() {
  MEMORYSTATUSEX mem_status = {};
  if (!GetSystemMemoryStatus(&mem_status))
    return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;

  // How much system memory is actively available for use right now, in MBs.
  int phys_free = static_cast<int>(mem_status.ullAvailPhys / kMBBytes);

  // TODO(chrisha): This should eventually care about address space pressure,
  // but the browser process (where this is running) effectively never runs out
  // of address space. Renderers occasionally do, but it does them no good to
  // have the browser process monitor address space pressure. Long term,
  // renderers should run their own address space pressure monitors and act
  // accordingly, with the browser making cross-process decisions based on
  // system memory pressure.

  // Determine if the physical memory is under critical memory pressure.
  if (phys_free <= critical_threshold_mb_)
    return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL;

  // Determine if the physical memory is under moderate memory pressure.
  if (phys_free <= moderate_threshold_mb_)
    return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE;

  // No memory pressure was detected.
  return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
}

bool SystemMemoryPressureEvaluator::GetSystemMemoryStatus(
    MEMORYSTATUSEX* mem_status) {
  DCHECK(mem_status);
  mem_status->dwLength = sizeof(*mem_status);
  if (!::GlobalMemoryStatusEx(mem_status))
    return false;
  return true;
}

SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    OSSignalsMemoryPressureEvaluator(std::unique_ptr<MemoryPressureVoter> voter)
    : voter_(std::move(voter)) {}

SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    ~OSSignalsMemoryPressureEvaluator() = default;

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::Start() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  // Start by observing the low memory notifications. If the system is already
  // under pressure this will run the |OnLowMemoryNotification| callback and
  // automatically switch to waiting for the high memory notification/
  StartLowMemoryNotificationWatcher();
}

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    OnLowMemoryNotification() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  critical_pressure_session_begin_ = base::TimeTicks::Now();

  base::UmaHistogramEnumeration(
      "Discarding.WinOSPressureSignals.PressureLevelOnLowMemoryNotification",
      base::MemoryPressureMonitor::Get()->GetCurrentPressureLevel());

  base::UmaHistogramMemoryMB(
      "Discarding.WinOSPressureSignals."
      "AvailableMemoryMbOnLowMemoryNotification",
      base::SysInfo::AmountOfAvailablePhysicalMemory() / 1024 / 1024);

  voter_->SetVote(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL,
                  /* notify = */ true);

  // Start a timer to repeat the notification at regular interval until
  // OnHighMemoryNotification gets called.
  critical_pressure_notification_timer_.Start(
      FROM_HERE, kHighPressureNotificationInterval,
      base::BindRepeating(
          &MemoryPressureVoter::SetVote, base::Unretained(voter_.get()),
          base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL,
          /* notify = */ true));

  // Start the high memory notification watcher to be notified when the system
  // exits memory pressure.
  StartHighMemoryNotificationWatcher();
}

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    OnHighMemoryNotification() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  base::UmaHistogramMediumTimes(
      "Discarding.WinOSPressureSignals.LowMemorySessionLength",
      base::TimeTicks::Now() - critical_pressure_session_begin_);
  critical_pressure_session_begin_ = base::TimeTicks();

  critical_pressure_notification_timer_.Stop();
  voter_->SetVote(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
                  /* notify = */ false);

  // Start the low memory notification watcher to be notified the next time the
  // system hits memory pressure.
  StartLowMemoryNotificationWatcher();
}

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    StartLowMemoryNotificationWatcher() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  DCHECK(base::SequencedTaskRunner::HasCurrentDefault());
  memory_notification_watcher_ =
      std::make_unique<MemoryPressureWatcherDelegate>(
          base::win::ScopedHandle(::CreateMemoryResourceNotification(
              ::LowMemoryResourceNotification)),
          base::BindOnce(
              &SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
                  OnLowMemoryNotification,
              base::Unretained(this)));
}

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    StartHighMemoryNotificationWatcher() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  memory_notification_watcher_ =
      std::make_unique<MemoryPressureWatcherDelegate>(
          base::win::ScopedHandle(::CreateMemoryResourceNotification(
              ::HighMemoryResourceNotification)),
          base::BindOnce(
              &SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
                  OnHighMemoryNotification,
              base::Unretained(this)));
}

void SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator::
    WaitForHighMemoryNotificationForTesting(base::OnceClosure closure) {
  // If the timer isn't running then it means that the high memory notification
  // has already been received.
  if (!critical_pressure_notification_timer_.IsRunning()) {
    std::move(closure).Run();
    return;
  }

  memory_notification_watcher_->SetCallbackForTesting(base::BindOnce(
      [](SystemMemoryPressureEvaluator::OSSignalsMemoryPressureEvaluator*
             evaluator,
         base::OnceClosure closure) {
        evaluator->OnHighMemoryNotification();
        std::move(closure).Run();
      },
      base::Unretained(this), std::move(closure)));
}

}  // namespace win
}  // namespace memory_pressure


text:
package org.elasticsearch.gradle;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.file.ProjectLayout;

import javax.inject.Inject;
import java.io.File;

/**
 * A plugin to handle reaping external services spawned by a build if Gradle dies.
 */
public class ReaperPlugin implements Plugin<Project> {

    public static final String REAPER_SERVICE_NAME = "reaper";
    private final ProjectLayout projectLayout;

    @Inject
    public ReaperPlugin(ProjectLayout projectLayout) {
        this.projectLayout = projectLayout;
    }

    @Override
    public void apply(Project project) {
        registerReaperService(project, projectLayout, false);
    }

    public static void registerReaperService(Project project, ProjectLayout projectLayout, boolean internal) {
        if (project != project.getRootProject()) {
            throw new IllegalArgumentException("ReaperPlugin can only be applied to the root project of a build");
        }
        File inputDir = projectLayout.getProjectDirectory()
            .dir(".gradle")
            .dir("reaper")
            .dir("build-" + ProcessHandle.current().pid())
            .getAsFile();

        project.getGradle().getSharedServices().registerIfAbsent(REAPER_SERVICE_NAME, ReaperService.class, spec -> {
            // Provide some parameters
            spec.getParameters().getInputDir().set(inputDir);
            spec.getParameters().getBuildDir().set(projectLayout.getBuildDirectory());
            spec.getParameters().setInternal(internal);
        });
    }

}


text:
export Call from './1-call.js';
export Construct from './2-construct.js';
export BoundFunctionCreate from './3-bound-function-create.js';


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="200"
    android:shareInterpolator="true" >

    <scale
        android:fromXScale="100%"
        android:fromYScale="100%"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0%"
        android:toYScale="0%" />

    <alpha
        android:fromAlpha="1"
        android:toAlpha="0" />

</set>


text:
var express = require('express');
var router = express.Router();
var Content = require('../models/content');
var User = require('../models/user');
var Project = require('../models/project');
var ValidationErrors = require('../middleware/validation-error-handler');

router.all('*', function(req, res, next) {
    res.locals.currentSection = 'Content';
    next();
});

/* GET content tree */
router.get('/', function(req, res, next) {
    if (!req.session.project) return next(new Error(400));
    Content.find({
        '_project': req.session.project,
        '_parent': { $exists: false }
    }).populate('children _author').exec(function(err, content) {
        if (err) return next(err);
        Content.populate(content, {
            path: 'children.children'
        }, function(err, content) {
            User.populate(content, {
                path: 'children._author'
            }, function(err, content) {
                if (err) return next(err);
                res.render('content/index', {
                    content: content
                });
            })
        });
    });
});

/* GET content */
router.get('/view/:id', function(req, res, next) {
    Content.findById(req.params.id).populate('_author _project').exec(function(err, content) {
        if (err) return next(err);
        res.render('content/view', {
            content: content
        });
    });
});

/* GET add content */
router.get('/add', function(req, res) {
    res.render('content/add', { form: {} });
});

/* GET add child content */
router.get('/add-child/:parent', function(req, res) {
    res.render('content/add', {
        parent: req.params.parent,
        form: {}
    });
});

router.get('/populate/:num', function(req, res, next) {
    if (req.user.role === 'admin') {
        Project.findById(req.session.project, function (err, project) {
            if (err) return next(err);
            if (!project || !req.user._id) return next(new Error(404));
            Content.remove({'_project' : req.session.project}, function() {
                for (var i = 1; i <= req.params.num; i++) {
                    var content = new Content();
                    content._project = project._id;
                    content._author = req.user._id;
                    content.title = "Dummy content " + i;
                    content.path = "dummy-content-" + i;
                    content.status = (Math.floor(Math.random() * (2) + 1) > 1) ? 'published': 'draft';
                    var randomId = Math.floor(Math.random() * (10) + 1);
                    content.body = '
The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.

Metric	Percentage

A	40%

B	60%

I am a list

I am inside a list

I am not inside a list

';
                    content.save(function (err) {
                        if (err) return next(err);
                    });
                }
                req.flash('success', 'Content populated');
                res.redirect('/content');
            });
        });
    } else {
        return next(new Error(400));
    }
});

/* POST add content */
router.post('/add', function(req, res, next) {
    Project.findById(req.session.project, function(err, project) {
        if (err) return next(err);

        // Ensure that project exists and that the user is logged in, these should of already been caught but better safe than 500
        if (!project || !req.user._id) return next(new Error(404));

        var content = new Content();
        content._project = project._id;
        content._author = req.user._id;
        content.title = req.body.title;
        content.path = req.body.path;
        content.body = req.body.body;
        content.template = req.body.template;
        content.meta.description = req.body["meta.description"];
        content.meta.keywords = req.body["meta.keywords"].split(',').map(function(s) { return s.trim() });

        content.save(function(err) {
            if (err) {
                ValidationErrors.flash(req, err);
                res.render('content/add', {
                    form: req.body
                });
            } else {
                req.flash('success', 'Content created');
                res.redirect('/content');
            }
        });
    });
});

/* POST add child content 8 */
router.post('/add-child/:parent', function(req, res, next) {
    Project.findById(req.session.project, function(err, project) {
        if (err) return next(err);
        if (!project || !req.user._id) return next(new Error(404));

        var content = new Content();
        content._project = project._id;
        content._author = req.user._id;
        content._parent = req.params.parent;
        content.title = req.body.title;
        content.path = req.body.path;
        content.body = req.body.body;
        content.template = req.body.template;
        content.meta.description = req.body["meta.description"];
        content.meta.keywords = req.body["meta.keywords"].split(',').map(function(s) { return s.trim() });

        content.save(function(err, item) {
            if (err) return next(err);
            Content.findByIdAndUpdate(req.params.parent, {
                $push: {
                    children: item._id
                }
            }, function(err) {
                if (err) {
                    ValidationErrors.flash(req, err);
                    res.render('/content/add-child/' + req.params.parent, {
                        form: req.body
                    });
                } else {
                    req.flash('success', 'Content created');
                    res.redirect('/content');
                }
            });
        });
    });
});

/* GET edit content */
router.get('/edit/:id', function(req, res) {
    Content.findById(req.params.id, function(err, content) {
        if (err) return next(err);
        content.meta.keywords = content.meta.keywords.join(', ');
        res.render('content/edit', {
            content: content,
            form: {}
        });
    });
});

/* POST edit content */
router.post('/edit/:id', function(req, res) {
    Content.findById(req.params.id, function(err, content) {
        if (err) return next(err);

        content.title = req.body.title;
        content.path = req.body.path;
        content.body = req.body.body;
        content.template = req.body.template;
        content.modified = Date.now();
        content.meta.description = req.body["meta.description"];
        content.meta.keywords = req.body["meta.keywords"].split(',').map(function(s) { return s.trim() });

        content.save(function(err) {
            if (err) {
                ValidationErrors.flash(req, err);
                res.render('content/edit', {
                    content: content,
                    form: req.body
                });
            } else {
                req.flash('success', 'Content saved');
                res.redirect('/content');
            }
        });
    });
});

/* GET delete content */
router.get('/delete/:id', function(req, res) {
    Content.findById(req.params.id, function(err, content) {
        if (err) return next(err);
        if (!content) return next(new Error(400));
        if (content.children.length > 0) {
            req.flash('error', 'Cannot delete content that has children');
            res.redirect('/content');
        } else {
            content.remove(function(err, content) {
                if (err) return next(err);
                Content.update({
                    children: {
                        $in: [content.id]
                    }
                }, {
                    $pull: {
                        "children": content.id
                    }
                }, function(err) {
                    if (err) return next(err);
                    req.flash('success', 'Content deleted successfully');
                    res.redirect('/content')
                });

            });
        }
    });
});

/* GET publish content */
router.get('/publish/:id', function(req, res) {
    Content.findByIdAndUpdate(req.params.id, {
        status: 'published'
    }, function(err, content) {
        if (err) return next(err);
        req.flash('success', content.title + ' published');
        res.redirect('/content');
    });
});

/* GET draft content */
router.get('/draft/:id', function(req, res) {
    Content.findByIdAndUpdate(req.params.id, {
        status: 'draft'
    }, function(err, content) {
        if (err) return next(err);
        req.flash('success', content.title + ' returned to draft status');
        res.redirect('/content');
    });
});

module.exports = router;


text:
from distutils.core import setup

setup(name='django-model-repr',
      version='0.0.4',
      description='A django library for Model\'s __repr__ to be more informative',
      author='Larry Kim',
      author_email='pypi@relip.org',
      packages=['django_model_repr'],
)


text:
<?php

/**
 * This class allows you to use a wipe effect to change the height or the width
 * of an HTML element.  It cannot do both.  To do both, use DojoSizeToEffect.
 *
 */
class DojoWipeToEffect extends DojoEffect
{
    /**
     * Adds additional options for the wipe to effect.  These include:
     *
     * height - The new heigt for the element
     * width  - The new width for the element
     *
     * Remember, you can only choose to change one, but no both.  To combine
     * them, use DojoSizeToEffect.
     *
     * @param mixed $opts Set of options being built
     */
    protected function additionalOptions(&$opts)
    {
        if (isset($this->options['width']) && !isset($this->options['height']))
            $opts['width'] = $this->options['width'];
        if (!isset($this->options['width']) && isset($this->options['height']))
            $opts['height'] = $this->options['height'];
    }

    /**
     * Builds the Javascript to create a Dojo wipe to effect.
     *
     * @return string The generated Javascript for the effect
     */
    public function buildEffect()
    {
        $js_options = $this->optionsForEffect();
        DojoManager::addRequire(DojoTypes::DOJOX_FX);

        return "dojox.fx.wipeTo($js_options)";
    }
}
?>


text:
/*
 * gist
 */
.markdown-body .gist table tr {
  border: none;
}

.markdown-body .gist table th,
.markdown-body .gist table td {
  border: none;
}


text:
package amock

import (
	"fmt"
	"testing"

	"github.com/loopfz/gadgeto/amock/foo"
)

func TestMock(t *testing.T) {

	mock := NewMock()
	mock.Expect(200, foo.Foo{Identifier: "f1234", BarCount: 42}).OnIdentifier("f1234").OnFunc(foo.GetFoo)
	foo.Client.Transport = mock

	fmt.Println("get a foo with an identifier not matching the expected one")

	f, err := foo.GetFoo("f1")
	if err == nil {
		t.Error("Should not have returned foo object with non-matching ident")
	}

	fmt.Println("returned:", err)

	fmt.Println("----------------------------------------------------------------------")

	fmt.Println("get a foo with the correct identifier but going through an unexpected code path")

	f, err = foo.GetFoo2("f1234")
	if err == nil {
		t.Error("Should not have returned foo object with non-matching func")
	}

	fmt.Println("returned:", err)

	fmt.Println("----------------------------------------------------------------------")

	fmt.Println("get a foo with the correct identifier")

	f, err = foo.GetFoo("f1234")
	if err != nil {
		t.Error(err)
	}

	fmt.Println("returned:", f)

	fmt.Println("----------------------------------------------------------------------")

	fmt.Println("update foo object and call an update _method_")

	f.BarCount = 43

	mock.Expect(200, f).OnIdentifier(f.Identifier).OnFunc(f.UpdateFoo)

	f, err = f.UpdateFoo()
	if err != nil {
		t.Error(err)
	}

	fmt.Println("returned:", f)

	fmt.Println("----------------------------------------------------------------------")

	fmt.Println("make the mock simulate a 503, get a foo expecting an error")

	mock.Expect(503, Raw([]byte(`
503 Service Unavailable

No server is available to handle this request.
`))).Sticky()

	f, err = foo.GetFoo("f2")
	if err == nil {
		t.Error("expected a 503 error")
	}

	fmt.Println("returned:", err)

	fmt.Println("----------------------------------------------------------------------")

	fmt.Println("previous response is sticky, retry and expect same error")

	f, err2 := foo.GetFoo("f2")
	if err2 == nil {
		t.Error("expected a 503 error")
	}
	if err.Error() != err2.Error() {
		t.Errorf("Errors mismatched: '%s' // '%s'", err.Error(), err2.Error())
	}

	fmt.Println("returned:", err2)

	mock.AssertEmpty(t)
}


text: package fuseutil


text:
<?php

namespace SG\FoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Countries
 *
 * @ORM\Table(name="countries")
 * @ORM\Entity
 */
class Countries
{
    /**
     * @var integer
     *
     * @ORM\Column(name="country_id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $countryId;

    /**
     * @var string
     *
     * @ORM\Column(name="country_name", type="string", length=128, nullable=false)
     */
    private $countryName;

    /**
     * Get countryId
     *
     * @return integer
     */
    public function getCountryId()
    {
        return $this->countryId;
    }

    /**
     * Set countryName
     *
     * @param string $countryName
     * @return Countries
     */
    public function setCountryName($countryName)
    {
        $this->countryName = $countryName;

        return $this;
    }

    /**
     * Get countryName
     *
     * @return string
     */
    public function getCountryName()
    {
        return $this->countryName;
    }
}


text:
package weibo4j.examples.timeline;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

import weibo4j.Timeline;
import weibo4j.http.ImageItem;
import weibo4j.model.Status;
import weibo4j.util.WeiboConfig;

public class Upload {
	public static void main(String args[]) {
		try {
			try {
				byte[] content = readFileImage(args[2]);
				System.out.println("content length:" + content.length);
				ImageItem pic = new ImageItem("pic", content);
				String s = java.net.URLEncoder.encode(args[1], "utf-8");
				String access_token = args[0];
				Timeline tm = new Timeline(access_token);
				Status status = tm.uploadStatus(s, pic);

				System.out.println("Successfully upload the status to ["
						+ status.getText() + "].");
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		} catch (Exception ioe) {
			System.out.println("Failed to read the system input.");
		}
	}

	public static byte[] readFileImage(String filename) throws IOException {
		BufferedInputStream bufferedInputStream = new BufferedInputStream(
				new FileInputStream(filename));
		int len = bufferedInputStream.available();
		byte[] bytes = new byte[len];
		int r = bufferedInputStream.read(bytes);
		if (len != r) {
			bytes = null;
			throw new IOException("读取文件不正确");
		}
		bufferedInputStream.close();
		return bytes;
	}
}


text:
const debug = require('debug')('cygnus:api:project');
const express = require('express');
const router = express.Router();
const ProjectService = require('../service/srv.project');

// Get all actived projects.
router.get('/all', (req, res) => {
    var service = new ProjectService();
    service.getAllProjects(true)
        .then(ret => {
            res.json({
                code: 0,
                data: ret
            });
        })
        .fail(err => {
            res.status(500).send('GET /project/all error');
        });
});

// Get a project by specified project id.
router.get('/:id', (req, res) => {
    let prjId = req.params.id;
    if (prjId) {
        prjId = parseInt(prjId);
    }

    var service = new ProjectService();
    service.getProjectById(prjId)
        .then(ret => {
            res.json({
                code: 0,
                data: ret
            });
        })
        .fail(err => {
            res.status(500).send('GET /project/:id error');
        });
});

module.exports = router;


text:
Switching from TPM

Make sure your using the `@plugin` notation, switch the initialization line in
your tmux.conf and your good to go!

```
# Remove this
set -g @plugin 'tmux-plugins/tpm'
run '~/.tmux/plugins/tpm/tpm'

# Add this
run 'ellipsis-tpm run'
```


text:
function p = root()
    %ROOT  Obtain mexopencv root path
    p = fileparts(fileparts(mfilename('fullpath')));
end


text:
/****************************************************************************
 * kernel/environ/env_findvar.c
 *
 *   Copyright (C) 2007, 2009, 2013-2014 Gregory Nutt. All rights reserved.
 *   Author: Gregory Nutt <gnutt@nuttx.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name NuttX nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <tinyara/config.h>

#ifndef CONFIG_DISABLE_ENVIRON

#include <stdbool.h>
#include <string.h>
#include <sched.h>

#include "environ/environ.h"

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

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

/****************************************************************************
 * Name: env_cmpname
 ****************************************************************************/

static bool env_cmpname(const char *pszname, const char *peqname)
{
	/* Search until we find anything different in the two names */

	for (; *pszname == *peqname; pszname++, peqname++) ;

	/* On sucess, pszname will end with '\0' and peqname with '=' */

	if (*pszname == '\0' && *peqname == '=') {
		return true;
	}

	return false;
}

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

/****************************************************************************
 * Name: env_findvar
 *
 * Description:
 *   Search the provided environment structure for the variable of the
 *   specified name.
 *
 * Parameters:
 *   group The task group containging environment array to be searched.
 *   pname The variable name to find
 *
 * Return Value:
 *   A pointer to the name=value string in the environment
 *
 * Assumptions:
 *   - Not called from an interrupt handler
 *   - Pre-emptions is disabled by caller
 *
 ****************************************************************************/

FAR char *env_findvar(FAR struct task_group_s *group, const char *pname)
{
	char *ptr;
	char *end;

	/* Verify input parameters */

	DEBUGASSERT(group && pname);

	/* Search for a name=value string with matching name */

	end = &group->tg_envp[group->tg_envsize];
	for (ptr = group->tg_envp; ptr < end && !env_cmpname(pname, ptr); ptr += (strlen(ptr) + 1)) ;

	/* Check for success */

	return (ptr < end) ? ptr : NULL;
}

#endif							/* CONFIG_DISABLE_ENVIRON */


text:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  targetNamespace="Examples">

  <process id="process">

    <startEvent id="theStart" />

    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="fork" />

    <parallelGateway id="fork" />

    <sequenceFlow id="flow2" sourceRef="fork" targetRef="firstTask" />

    <userTask id="firstTask" />

    <sequenceFlow id="flow3" sourceRef="fork" targetRef="secondTask" />

    <userTask id="secondTask" />

    <sequenceFlow id="flow4" sourceRef="firstTask" targetRef="join" />

    <sequenceFlow id="flow5" sourceRef="secondTask" targetRef="join" />

    <parallelGateway id="join" />

    <sequenceFlow id="flow6" sourceRef="join" targetRef="thirdTask" />

    <userTask id="thirdTask" />

    <sequenceFlow id="flow7" sourceRef="thirdTask" targetRef="theEnd" />

    <endEvent id="theEnd" />

  </process>

</definitions>