text:
package org.omg.PortableServer;

import gnu.CORBA.Minor;

import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.portable.IDLEntity;

import java.io.Serializable;

/**
 * Defines the possible values for the POA thread policy.
 *
 * This enumeration can obtain the following values:
 *

 *
ORB_CTRL_MODEL Each object in POA has a separate serving thread
 * and a separate server socket, listening on the objects individual
 * port. Additionally, when the request is accepted, it is also
 * served in a separate thread, so several requests to the same
 * object can be processed in parallel. The servant can always get
 * the Id and POA of the object it is currently serving by
 * invoking {@link Servant#_object_id()} and {@link Servant#_poa}.
 * These two methods use thread to data map and must work correctly
 * even then the servant code is executed in several parallel threads.
 *

 *
SINGLE_THREAD_MODEL All objects in POA share the same server
 * socket and are served in the same thread. This model is applicable
 * when the number of objects is greater than the number of threads
 * and (or) ports, supported by the system.

 *

 * OMG also defines a MAIN_THREAD_MODEL, currently not supported by
 * the java API.
 *
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
 */
public class ThreadPolicyValue
  implements Serializable, IDLEntity
{
  /**
   * Use serialVersionUID (v1.4) for interoperability.
   */
  private static final long serialVersionUID = -8874988828297141512L;

  /**
   * The value field for the current instance.
   */
  private final int _value;

  /**
  * The possible value of this enumeration (ORB_CTRL_MODEL).
  */
  public static final int _ORB_CTRL_MODEL = 0;

  /**
   * An instance of ThreadPolicyValue, initialized to ORB_CTRL_MODEL.
   */
  public static final ThreadPolicyValue ORB_CTRL_MODEL =
    new ThreadPolicyValue(_ORB_CTRL_MODEL);

  /**
  * The possible value of this enumeration (SINGLE_THREAD_MODEL).
  */
  public static final int _SINGLE_THREAD_MODEL = 1;

  /**
   * An instance of ThreadPolicyValue, initialized to SINGLE_THREAD_MODEL.
   */
  public static final ThreadPolicyValue SINGLE_THREAD_MODEL =
    new ThreadPolicyValue(_SINGLE_THREAD_MODEL);

  /**
   * The private array that maps integer codes to the enumeration
   * values.
   */
  private static final ThreadPolicyValue[] enume =
    new ThreadPolicyValue[] { ORB_CTRL_MODEL, SINGLE_THREAD_MODEL };

  /**
   * The private array of state names.
   */
  private static final String[] state_names =
    new String[] { "ORB_CTRL_MODEL", "SINGLE_THREAD_MODEL" };

  /**
   * Normally, no new instances are required, so the constructor is protected.
   */
  protected ThreadPolicyValue(int a_value)
  {
    _value = a_value;
  }

  /**
   * Returns the ThreadPolicyValue, matching the given integer constant.
   *
   * @param code one of _ORB_CTRL_MODEL, _SINGLE_THREAD_MODEL.
   * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL.
   * @throws BAD_PARAM if the parameter is not one of the valid values.
   */
  public static ThreadPolicyValue from_int(int code)
  {
    try
      {
        return enume [ code ];
      }
    catch (ArrayIndexOutOfBoundsException ex)
      {
        BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
        bad.minor = Minor.PolicyType;
        throw bad;
      }
  }

  /**
   * Returns a short string representation.
   * @return the name of the current enumeration value.
   */
  public String toString()
  {
    return state_names [ _value ];
  }

  /**
   * Returns the integer code of the enumeration value.
   * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL.
   */
  public int value()
  {
    return _value;
  }
}


text:
package filesystem

import (
	"bufio"
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"syscall"

	"golang.org/x/sys/unix"

	"github.com/lxc/lxd/shared/logger"
)

// Filesystem magic numbers.
const (
	FilesystemSuperMagicZfs = 0x2fc12fc1
)

// StatVFS retrieves Virtual File System (VFS) info about a path.
func StatVFS(path string) (*unix.Statfs_t, error) {
	var st unix.Statfs_t

	err := unix.Statfs(path, &st)
	if err != nil {
		return nil, err
	}

	return &st, nil
}

// Detect returns the filesystem on which the passed-in path sits.
func Detect(path string) (string, error) {
	fs, err := StatVFS(path)
	if err != nil {
		return "", err
	}

	return FSTypeToName(int32(fs.Type))
}

// FSTypeToName returns the name of the given fs type.
// The fsType is from the Type field of unix.Statfs_t. We use int32 so that this function behaves the same on both
// 32bit and 64bit platforms by requiring any 64bit FS types to be overflowed before being passed in. They will
// then be compared with equally overflowed FS type constant values.
func FSTypeToName(fsType int32) (string, error) {
	// This function is needed to allow FS type constants that overflow an int32 to be overflowed without a
	// compile error on 32bit platforms. This allows us to use any 64bit constants from the unix package on
	// both 64bit and 32bit platforms without having to define the constant in its rolled over form on 32bit.
	to32 := func(fsType int64) int32 {
		return int32(fsType)
	}

	switch fsType {
	case to32(unix.BTRFS_SUPER_MAGIC): // BTRFS' constant required overflowing to an int32.
		return "btrfs", nil
	case unix.TMPFS_MAGIC:
		return "tmpfs", nil
	case unix.EXT4_SUPER_MAGIC:
		return "ext4", nil
	case unix.XFS_SUPER_MAGIC:
		return "xfs", nil
	case unix.NFS_SUPER_MAGIC:
		return "nfs", nil
	case FilesystemSuperMagicZfs:
		return "zfs", nil
	}

	logger.Debugf("Unknown backing filesystem type: 0x%x", fsType)
	return fmt.Sprintf("0x%x", fsType), nil
}

func parseMountinfo(name string) int {
	// In case someone uses symlinks we need to look for the actual
	// mountpoint.
	actualPath, err := filepath.EvalSymlinks(name)
	if err != nil {
		return -1
	}

	f, err := os.Open("/proc/self/mountinfo")
	if err != nil {
		return -1
	}
	defer f.Close()

	scanner := bufio.NewScanner(f)
	for scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		if len(tokens) < 5 {
			return -1
		}
		cleanPath := filepath.Clean(tokens[4])
		if cleanPath == actualPath {
			return 1
		}
	}

	return 0
}

// IsMountPoint returns true if path is a mount point.
func IsMountPoint(path string) bool {
	// If we find a mount entry, it is obviously a mount point.
	ret := parseMountinfo(path)
	if ret == 1 {
		return true
	}

	// Get the stat details.
	stat, err := os.Stat(path)
	if err != nil {
		return false
	}

	rootStat, err := os.Lstat(path + "/..")
	if err != nil {
		return false
	}

	// If the directory has the same device as parent, then it's not a mountpoint.
	if stat.Sys().(*syscall.Stat_t).Dev == rootStat.Sys().(*syscall.Stat_t).Dev {
		return false
	}

	// Btrfs annoyingly uses a different Dev id for different subvolumes on the same mount.
	// So for btrfs, we require a matching mount entry in mountinfo.
	fs, _ := Detect(path)
	if err == nil && fs == "btrfs" {
		return false
	}

	return true
}

redpajama_set_name: RedPajamaGithub


text:
FOUNDATION_EXPORT double Pods_OraChatTestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_OraChatTestsVersionString[];


text:
package dk.sidereal.lumm.components.input;

import dk.sidereal.lumm.architecture.LummComponent;
import dk.sidereal.lumm.architecture.LummObject;

public class MousePosition extends LummComponent {

    public MousePosition(LummObject obj) {
        super(obj);
    }

    @Override
    protected void onUpdate() {
        // TODO Auto-generated method stub

    }

    @Override
    protected void onRender() {
        // TODO Auto-generated method stub

    }

    @Override
    protected void onDebug() {
        // TODO Auto-generated method stub

    }

}


text:
package com.tapchatapp.android.network.ssl;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.util.Base64;

import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.squareup.okhttp.internal.tls.OkHostnameVerifier;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;

public class MemorizingHostnameVerifier implements HostnameVerifier {

    public static final String EXTRA_DECISION_ID = "com.tapchatapp.android.EXTRA_DECISION_ID";
    public static final String EXTRA_HOSTNAME = "com.tapchatapp.android.EXTRA_HOSTNAME";
    public static final String EXTRA_FINGERPRINT = "com.tapchatapp.android.EXTRA_FINGERPRINT";

    private static final String PREFS_FILENAME = "known_hosts";

    private static int sLastDecisionId = 0;

    private static final Map<Integer, Decision> sDecisions = new HashMap<>();

    private final Context mContext;
    private final SharedPreferences mPreferences;

    private final Handler mHandler = new Handler();
    private final Gson mGson = new Gson();

    public MemorizingHostnameVerifier(Context context, Bus bus) {
        mContext = context;
        mPreferences = mContext.getSharedPreferences(PREFS_FILENAME, Context.MODE_PRIVATE);

        bus.register(this);
    }

    @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
    @Override public boolean verify(final String hostname, final SSLSession session) {
        if (OkHostnameVerifier.INSTANCE.verify(hostname, session)) {
            return true;
        }

        final byte[] encodedCertificate = CertUtil.getEncodedCertificate(session);
        final String fingerprint = CertUtil.certHash(encodedCertificate, CertUtil.SHA1);
        final String base64Certificate = Base64.encodeToString(encodedCertificate, Base64.DEFAULT);

        if (getKnownCertificates(hostname).contains(base64Certificate)) {
            return true;
        }

        final Decision decision = createDecision();

        mHandler.post(new Runnable() {
            @Override public void run() {
                Intent intent = new Intent(mContext, VerifyHostnameActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.putExtra(EXTRA_DECISION_ID, decision.id);
                intent.putExtra(EXTRA_HOSTNAME, hostname);
                intent.putExtra(EXTRA_FINGERPRINT, fingerprint);
                mContext.startActivity(intent);
            }
        });

        try {
            synchronized (decision) {
                decision.wait();
            }
        } catch (InterruptedException ignored) { }

        if (decision.allow) {
            addKnownCertificate(hostname, base64Certificate);
        }

        return decision.allow;
    }

    @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
    @Subscribe public void onHostnameVerifyDecisionEvent(HostnameVerifyDecisionEvent event) {
        final Decision decision = getDecision(event.getDecisionId());
        if (decision == null) {
            return;
        }
        synchronized (decision) {
            decision.allow = event.isDecisionAllow();
            decision.notify();
        }
    }

    private Set<String> getKnownCertificates(String hostname) {
        if (!mPreferences.contains(hostname)) {
            return new HashSet<>();
        }
        Type type = new TypeToken<Set<String>>() { }.getType();
        return mGson.fromJson(mPreferences.getString(hostname, null), type);
    }

    private void addKnownCertificate(String hostname, String base64Certificate) {
        Set<String> knownCertificates = new HashSet<>(getKnownCertificates(hostname));
        knownCertificates.add(base64Certificate);

        SharedPreferences.Editor editor = mPreferences.edit();
        editor.putString(hostname, mGson.toJson(knownCertificates));
        editor.apply();
    }

    private static Decision createDecision() {
        synchronized (sDecisions) {
            Decision decision = new Decision(sLastDecisionId);
            sDecisions.put(sLastDecisionId, decision);
            sLastDecisionId++;
            return decision;
        }
    }

    private static Decision getDecision(int decisionId) {
        synchronized (sDecisions) {
            return sDecisions.remove(decisionId);
        }
    }

    private static class Decision {
        final int id;
        boolean allow;
        private Decision(int id) {
            this.id = id;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='../../../../../../../../../../test.xsl'?>
<!--
    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.
-->
<!DOCTYPE Test SYSTEM '../../../../../../../../../../test.dtd'>
<Test
    ID="F_ClassLoaderTest_01"
        date-of-creation="2004-12-22"
    timeout="1"
        >
        <!--
        -->

                <APITestDescription>
                    <TestedClass name="java.lang.ClassLoader"/>
                    <TestedMethod name="public static ClassLoader getSystemClassLoader()"/>
                    <TestedMethod name="protected ClassLoader(ClassLoader parent)"/>
                    <TestedMethod name="protected Class<?> findClass(String name) throws ClassNotFoundException"/>
                    <TestedMethod name="protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException"/>
                    <TestedMethod name="public InputStream getResourceAsStream(String name)"/>
                    <TestedMethod name="protected Package getPackage(String name)"/>
                    <TestedMethod name="protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase)"/>
                    <TestedMethod name="protected final Class<?> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError"/>
                    <TestedMethod name="protected URL findResource(String name)"/>
                    <TestedMethod name="public final ClassLoader getParent()"/>
                    <TestedMethod name="protected final Class<?> findLoadedClass(String name)"/>

                    <TestedClass name="java.lang.Class"/>
                    <TestedMethod name="public T newInstance() throws InstantiationException, IllegalAccessException"/>
                    <TestedMethod name="public Field getField(String name)"/>
                    <TestedMethod name="public Package getPackage()"/>
                    <TestedMethod name="public ProtectionDomain getProtectionDomain()"/>

                    <TestedClass name="java.io.DataInputStream"/>
                    <TestedMethod name="public DataInputStream(InputStream in)"/>
                    <TestedMethod name="public final void readFully(byte[] b, int off, int len)"/>

                    <TestedClass name="java.io.FilterInputStream"/>
                    <TestedMethod name="public int available()"/>

                    <TestedClass name="java.lang.reflect.Field"/>
                    <TestedMethod name="public void set(Object obj, Object value)"/>
                    <TestedMethod name="public int getInt(Object obj)"/>

                    <TestedClass name="java.lang.String"/>
                    <TestedMethod name="public String replace(char oldChar, char newChar)"/>
                    <TestedMethod name="public String substring(int beginIndex, int endIndex)"/>
                    <TestedMethod name="public int lastIndexOf(int ch)"/>

                    <TestedClass name="java.lang.Package"/>
                    <TestedMethod name="public boolean isSealed()"/>

                    <TestedClass name="java.lang.Object"/>
                    <TestedMethod name="public final Class<? extends Object> getClass()"/>

                    <TestedClass name="java.lang.ClassNotFoundException"/>
                    <TestedMethod name="public ClassNotFoundException()"/>

                    <TestedClass name="java.lang.Throwable"/>
                    <TestedMethod name="public void printStackTrace()"/>

                    <Description>
                        Test ClassLoader.
                    </Description>
                </APITestDescription>

                <Keyword name="functional"/>
                <Source name="F_ClassLoaderTest_01.java"/>
                <Modification date="2004-12-23" />

        <Runner ID="Runtime">
            <Option name="-cp" value="$CP$PathSeparator$TestSuiteRoot$FileSeparatorsrc$FileSeparatortest$FileSeparatorfunctional"/>
            <Param name="toRun" value="org.apache.harmony.test.func.api.java.lang.F_ClassLoaderTest_01.F_ClassLoaderTest_01">
            </Param>
        </Runner>
        <Restriction name="OtherVMOnly"/>
</Test>


text:
// $Id: lambda.hpp 27 2008-06-16 14:50:58Z maehne $

#ifndef BOOST_UNITS_LAMBDA_HPP
#define BOOST_UNITS_LAMBDA_HPP

////////////////////////////////////////////////////////////////////////
///
/// \file lambda.hpp
///
/// \brief Definitions to ease the usage of Boost.Units' quantity,
///        unit, and absolute types in functors created with the
///        Boost.Lambda library.
///
/// \author Torsten Maehne
/// \date   2008-06-16
///
/// Boost.Lambda's return type deduction system is extented to make
/// use of Boost.Units' typeof_helper trait classes for Boost.Units'
/// quantity, absolute, and unit template classes.
///
////////////////////////////////////////////////////////////////////////

#include <boost/lambda/lambda.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/operators.hpp>

namespace boost {

namespace lambda {

    /// Partial specialization of return type trait for action
    /// unit<Dim, System> * Y.
    template<typename System, typename Dim, typename Y>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::unit<Dim, System>,
                               Y > {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::unit<Dim, System>, Y >::type type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct multiply_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
              boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
              tuple<typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type, boost::lambda::lambda_functor<Arg> >
          >
        > type;
    };

    /// Disambiguating overload for action
    /// unit<Dim, System> * lambda_functor<Arg>
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename multiply_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> >::type
    operator*(const boost::units::unit<Dim, System>& a,
              const boost::lambda::lambda_functor<Arg>& b) {
        return typename multiply_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> >::type::inherited
               (tuple<typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type,
                      boost::lambda::lambda_functor<Arg> >
                     (a, b));
    }

} // namespace units

namespace lambda {

    /// Partial specialization of return type trait for action
    /// unit<Dim, System> / Y.
    template<typename System, typename Dim, typename Y>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::unit<Dim, System>,
                               Y > {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::unit<Dim, System>, Y >::type type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct divide_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
            boost::lambda::arithmetic_action<boost::lambda::divide_action>,
              tuple<typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type, boost::lambda::lambda_functor<Arg> >
          >
        > type;
    };

    /// Disambiguating overload for action
    /// unit<Dim, System> / lambda_functor<Arg>
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename divide_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> >::type
    operator/(const boost::units::unit<Dim, System>& a,
              const boost::lambda::lambda_functor<Arg>& b) {
        return typename divide_typeof_helper<boost::units::unit<Dim, System>, boost::lambda::lambda_functor<Arg> >::type::inherited
               (tuple<typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type,
                      boost::lambda::lambda_functor<Arg> >
                     (a, b));
    }

} // namespace units

namespace lambda {

    /// Partial specialization of return type trait for action
    /// Y * unit<Dim, System>.
    template<typename System, typename Dim, typename Y>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               Y,
                               boost::units::unit<Dim, System> > {
        typedef typename boost::units::multiply_typeof_helper<
            Y, boost::units::unit<Dim, System> >::type type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
            boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
              tuple<boost::lambda::lambda_functor<Arg>, typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type>
          >
        > type;
    };

    /// Disambiguating overload for action
    /// lambda_functor<Arg> * unit<Dim, System>
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> >::type
    operator*(const boost::lambda::lambda_functor<Arg>& a,
              const boost::units::unit<Dim, System>& b) {
        return typename multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> >::type::inherited
               (tuple<boost::lambda::lambda_functor<Arg>,
                      typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type>
                     (a, b));
    }

} // namespace units

namespace lambda {

    /// Partial specialization of return type trait for action
    /// Y / unit<Dim, System>.
    template<typename System, typename Dim, typename Y>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               Y,
                               boost::units::unit<Dim, System> > {
        typedef typename boost::units::divide_typeof_helper<
            Y, boost::units::unit<Dim, System> >::type type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct divide_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
            boost::lambda::arithmetic_action<boost::lambda::divide_action>,
              tuple<boost::lambda::lambda_functor<Arg>, typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type>
          >
        > type;
    };

    /// Disambiguating overload for action
    /// lambda_functor<Arg> / unit<Dim, System>
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename divide_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> >::type
    operator/(const boost::lambda::lambda_functor<Arg>& a,
              const boost::units::unit<Dim, System>& b) {
        return typename divide_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::unit<Dim, System> >::type::inherited
               (tuple<boost::lambda::lambda_functor<Arg>,
                      typename boost::lambda::const_copy_argument<const boost::units::unit<Dim, System> >::type>
                     (a, b));
    }

} // namespace units

namespace lambda {

    /// Partial specialization of return type trait for action
    /// quantity<Unit, X> * X.
    template<typename Unit, typename X>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::quantity<Unit, X>,
                               X> {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::quantity<Unit, X>, X>::type type;
    };

    /// Partial specialization of return type trait for action
    /// X * quantity<Unit, X>.
    template<typename Unit, typename X>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               X,
                               boost::units::quantity<Unit, X> > {
        typedef typename boost::units::multiply_typeof_helper<
            X, boost::units::quantity<Unit, X> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit, X> / X.
    template<typename Unit, typename X>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::quantity<Unit, X>,
                               X> {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::quantity<Unit, X>, X>::type type;
    };

    /// Partial specialization of return type trait for action
    /// X / quantity<Unit, X>.
    template<typename Unit, typename X>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               X,
                               boost::units::quantity<Unit, X> > {
        typedef typename boost::units::divide_typeof_helper<
            X, boost::units::quantity<Unit, X> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> * quantity<Unit2, Y>.
    template<typename System1, typename Dim1, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> / quantity<Unit2, Y>.
    template<typename System1, typename Dim1, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, Y> * unit<Dim2, System2>.
    template<typename Unit1, typename Y, typename System2, typename Dim2>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::quantity<Unit1, Y>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::quantity<Unit1, Y>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, Y> / unit<Dim2, System2>.
    template<typename Unit1, typename Y, typename System2, typename Dim2>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::quantity<Unit1, Y>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::quantity<Unit1, Y>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// +quantity<Unit, Y>.
    template<typename Unit, typename Y>
    struct plain_return_type_1<unary_arithmetic_action<plus_action>,
                               boost::units::quantity<Unit, Y> > {
        typedef typename boost::units::unary_plus_typeof_helper<
            boost::units::quantity<Unit, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// -quantity<Unit, Y>.
    template<typename Unit, typename Y>
    struct plain_return_type_1<unary_arithmetic_action<minus_action>,
                               boost::units::quantity<Unit, Y> > {
        typedef typename boost::units::unary_minus_typeof_helper<
            boost::units::quantity<Unit, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, X> + quantity<Unit2, Y>.
    template<typename Unit1, typename X, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<plus_action>,
                               boost::units::quantity<Unit1, X>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::add_typeof_helper<
            boost::units::quantity<Unit1, X>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, X> - quantity<Unit2, Y>.
    template<typename Unit1, typename X, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<minus_action>,
                               boost::units::quantity<Unit1, X>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::subtract_typeof_helper<
            boost::units::quantity<Unit1, X>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, X> * quantity<Unit2, Y>.
    template<typename Unit1, typename X, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::quantity<Unit1, X>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::quantity<Unit1, X>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// quantity<Unit1, X> / quantity<Unit2, Y>.
    template<typename Unit1, typename X, typename Unit2, typename Y>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::quantity<Unit1, X>,
                               boost::units::quantity<Unit2, Y> > {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::quantity<Unit1, X>,
            boost::units::quantity<Unit2, Y> >::type type;
    };

    ////////////////////////////////////////////////////////////////////////
    // Partial specialization of Boost.Lambda's trait classes for all
    // operators overloaded in <boost/units/unit.hpp>
    ////////////////////////////////////////////////////////////////////////

    /// Partial specialization of return type trait for action
    /// +unit<Dim, System>.
    template<typename Dim, typename System>
    struct plain_return_type_1<unary_arithmetic_action<plus_action>,
                               boost::units::unit<Dim, System> > {
        typedef typename boost::units::unary_plus_typeof_helper<
            boost::units::unit<Dim, System> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// -unit<Dim, System>.
    template<typename Dim, typename System>
    struct plain_return_type_1<unary_arithmetic_action<minus_action>,
                               boost::units::unit<Dim, System> > {
        typedef typename boost::units::unary_minus_typeof_helper<
            boost::units::unit<Dim, System> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> + unit<Dim2, System2>.
    template<typename Dim1, typename Dim2, typename System1, typename System2>
    struct plain_return_type_2<arithmetic_action<plus_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::add_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> - unit<Dim2, System2>.
    template<typename Dim1, typename Dim2, typename System1, typename System2>
    struct plain_return_type_2<arithmetic_action<minus_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::subtract_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> * unit<Dim2, System2>.
    template<typename Dim1, typename Dim2, typename System1, typename System2>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::multiply_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> / unit<Dim2, System2>.
    template<typename Dim1, typename Dim2, typename System1, typename System2>
    struct plain_return_type_2<arithmetic_action<divide_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::unit<Dim2, System2> > {
        typedef typename boost::units::divide_typeof_helper<
            boost::units::unit<Dim1, System1>,
            boost::units::unit<Dim2, System2> >::type type;
    };

    ////////////////////////////////////////////////////////////////////////
    // Partial specialization of Boost.Lambda's trait classes for all
    // operators overloaded in <boost/units/absolute.hpp>
    ////////////////////////////////////////////////////////////////////////

    /// Partial specialization of return type trait for action
    /// absolute<Y> + Y.
    template<typename Y>
    struct plain_return_type_2<arithmetic_action<plus_action>,
                               boost::units::absolute<Y>,
                               Y> {
        typedef typename boost::units::absolute<Y> type;
    };

    /// Partial specialization of return type trait for action
    /// Y + absolute<Y>.
    template<typename Y>
    struct plain_return_type_2<arithmetic_action<plus_action>,
                               Y,
                               boost::units::absolute<Y> > {
        typedef typename boost::units::absolute<Y> type;
    };

    /// Partial specialization of return type trait for action
    /// absolute<Y> - Y.
    template<typename Y>
    struct plain_return_type_2<arithmetic_action<minus_action>,
                               boost::units::absolute<Y>,
                               Y> {
        typedef typename boost::units::absolute<Y> type;
    };

    /// Partial specialization of return type trait for action
    /// absolute<Y> - absolute<Y>.
    template<typename Y>
    struct plain_return_type_2<arithmetic_action<minus_action>,
                               boost::units::absolute<Y>,
                               boost::units::absolute<Y> > {
        typedef Y type;
    };

    /// Partial specialization of return type trait for action
    /// T * absolute<unit<D, S> >.
    template<typename D, typename S, typename T>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               T,
                               boost::units::absolute<boost::units::unit<D, S> > > {
        typedef typename boost::units::quantity<
            boost::units::absolute<boost::units::unit<D, S> >, T> type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::absolute<boost::units::unit<Dim, System> > > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
            boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
              tuple<boost::lambda::lambda_functor<Arg>,
                    typename boost::lambda::const_copy_argument<const boost::units::absolute<boost::units::unit<Dim, System> > >::type>
          >
        > type;
    };

    /// Disambiguating overload for action
    /// lambda_functor<Arg> * absolute<unit<Dim, System> >
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::absolute<boost::units::unit<Dim, System> > >::type
    operator*(const boost::lambda::lambda_functor<Arg>& a,
              const boost::units::absolute<boost::units::unit<Dim, System> >& b) {
        return typename multiply_typeof_helper<boost::lambda::lambda_functor<Arg>, boost::units::absolute<boost::units::unit<Dim, System> > >::type::inherited
               (tuple<boost::lambda::lambda_functor<Arg>,
                      typename boost::lambda::const_copy_argument<const boost::units::absolute<boost::units::unit<Dim, System> > >::type>
                     (a, b));
    }

} // namespace units

namespace lambda {

    /// Partial specialization of return type trait for action
    /// absolute<unit<D, S> > * T.
    template<typename D, typename S, typename T>
    struct plain_return_type_2<arithmetic_action<multiply_action>,
                               boost::units::absolute<boost::units::unit<D, S> >,
                               T> {
        typedef typename boost::units::quantity<
            boost::units::absolute<boost::units::unit<D, S> >, T> type;
    };

} // namespace lambda

namespace units {

    template<typename System, typename Dim, typename Arg>
    struct multiply_typeof_helper<boost::units::absolute<boost::units::unit<Dim, System> >, boost::lambda::lambda_functor<Arg> > {
        typedef boost::lambda::lambda_functor<
          boost::lambda::lambda_functor_base<
            boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
              tuple<typename boost::lambda::const_copy_argument<const boost::units::absolute<boost::units::unit<Dim, System> > >::type,
                    boost::lambda::lambda_functor<Arg> >
          >
        > type;
    };

    /// Disambiguating overload for action
    /// absolute<unit<Dim, System> > * lambda_functor<Arg>
    /// based on \<boost/lambda/detail/operators.hpp\>.
    template<typename System, typename Dim, typename Arg>
    inline const typename multiply_typeof_helper<boost::units::absolute<boost::units::unit<Dim, System> >, boost::lambda::lambda_functor<Arg> >::type
    operator*(const boost::units::absolute<boost::units::unit<Dim, System> >& a,
              const boost::lambda::lambda_functor<Arg>& b) {
        return typename multiply_typeof_helper<boost::units::absolute<boost::units::unit<Dim, System> >, boost::lambda::lambda_functor<Arg> >::type::inherited
               (tuple<typename boost::lambda::const_copy_argument<const boost::units::absolute<boost::units::unit<Dim, System> > >::type,
                      boost::lambda::lambda_functor<Arg> >
                     (a, b));
    }

} // namespace units

} // namespace boost

#endif // BOOST_UNITS_LAMBDA_HPP


text:
function [key, val] = get_way_tag_key(tag)
%
% See also PLOT_WAY, EXTRACT_CONNECTIVITY.
%
% File:         get_way_tag_key.m
% Author:       Ioannis Filippidis, jfilippidis@gmail.com
% Date:         2010.11.21
% Language:     MATLAB R2011b
% Purpose:      get tags and key values for ways
% Copyright:    Ioannis Filippidis, 2010-

if isstruct(tag) == 1
    key = tag.Attributes.k;
    val = tag.Attributes.v;
elseif iscell(tag) == 1
    key = tag{1}.Attributes.k;
    val = tag{1}.Attributes.v;
else
    if isempty(tag)
        warning('Way has NO tag.')
    else
        warning('Way has tag which is not a structure nor cell array, but:')
        disp(tag)
    end

    key = '';
    val = '';
end


text:
<?php

// Call Zend_View_Helper_UserAgentTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
    define("PHPUnit_MAIN_METHOD", "Zend_View_Helper_UserAgentTest::main");
}

require_once 'Zend/View.php';
require_once 'Zend/View/Helper/UserAgent.php';
require_once 'Zend/Http/UserAgent.php';

/**
 * Zend_View_Helper_UserAgentTest
 *
 * @category   Zend
 * @package    Zend_View
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_View
 * @group      Zend_View_Helper
 */
class Zend_View_Helper_UserAgentTest extends PHPUnit_Framework_TestCase
{

    /**
     * @var Zend_View_Helper_UserAgent
     */
    protected $helper;

    /**
     * @var Zend_Http_UserAgent
     */
    protected $userAgent;

    /**
     * Runs the test methods of this class.
     */
    public static function main()
    {

        $suite  = new PHPUnit_Framework_TestSuite("Zend_View_Helper_UrlTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    /**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->helper    = new Zend_View_Helper_UserAgent();
        $this->userAgent = new Zend_Http_UserAgent();
    }

    public function testHelperMethod()
    {
        $this->assertTrue(
            $this->helper->userAgent() instanceof Zend_Http_UserAgent
        );
        $this->helper->userAgent($this->userAgent);
        $this->assertEquals(
            spl_object_hash($this->userAgent),
            spl_object_hash($this->helper->getUserAgent())
        );
    }

    public function testGetUserAgentDefault()
    {
        $this->assertTrue(
            $this->helper->getUserAgent() instanceof Zend_Http_UserAgent
        );
    }

    public function testSetAndGetUserAgent()
    {
        $this->helper->setUserAgent($this->userAgent);
        $this->assertEquals(
            spl_object_hash($this->userAgent),
            spl_object_hash($this->helper->getUserAgent())
        );
    }
}

// Call Zend_View_Helper_UrlTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_UserAgentTest::main") {
    Zend_View_Helper_UserAgentTest::main();
}


text:
import config from '../../config';

const googleTimezonePath = config.googleTimezonePath;
const googleAPIKey = config.googleApiKey;

const LOAD = googleTimezonePath + '/LOAD';
const LOAD_SUCCESS = googleTimezonePath + '/LOAD_SUCCESS';
const LOAD_FAIL = googleTimezonePath + '/LOAD_FAIL';

const initialState = {
  loaded: false,
  loading: false,
  data: null,
  error: null
};

export default function reducer(state = initialState, action = {}) {
  switch (action.type) {
    case LOAD:
      return {
        ...state,
        loading: true
      };
    case LOAD_SUCCESS:
      return {
        ...state,
        loading: false,
        loaded: true,
        data: action.result,
        receivedAt: Date.now(),
        error: null
      };
    case LOAD_FAIL:
      return {
        ...state,
        loading: false,
        loaded: false,
        data: null,
        receivedAt: Date.now(),
        error: action.error
      };
    default:
      return state;
  }
}

export function fetch(geocode, timestamp) {
  const reqPath = 'location=' + googleTimezonePath + '&timestamp=' + timestamp + '&key=' + googleAPIKey;

  return {
    types: [LOAD, LOAD_SUCCESS, LOAD_FAIL],
    promise: (client) => client.get(reqPath)
  };
}


text:
cd ..

php vendor/bin/phpcs --colors --standard=.travis/phpcs-ruleset.xml -n src/

php vendor/bin/phpmd src/ text naming,codesize,design,unusedcode

php vendor/bin/phpcpd src/


text:
<ons-page ng-controller="DetailController">

	<ons-toolbar>

			<ons-toolbar-button class="toolbar-button--quiet" ui-sref="^">
				<ons-icon class="ion-ios-arrow-back ons-back-button__icon"></ons-icon>
				Back
			</ons-toolbar-button>

Details

	</ons-toolbar>

	<ons-list modifier="inset" style="margin-top: 10px">
		<ons-list-item class="item">
			<ons-row>
				<ons-col width="60px">

				</ons-col>
				<ons-col>

						{{item.title}}
						{{item.label}}

{{item.desc}}

				</ons-col>
			</ons-row>
		</ons-list-item>

		<ons-list-item modifier="chevron" ui-sref="page2">
			<ons-icon icon="ion-chatboxes" fixed-width="true" style="color: #ccc"></ons-icon>
			Add a note
		</ons-list-item>
	</ons-list>

	<ons-list style="margin-top: 10px">
		<ons-list-item class="item" ng-repeat="i in [1,2,3]">

				Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

		</ons-list-item>
	</ons-list>

</ons-page>


text:
<component name="libraryTable">
  <library name="Generated files" type="javaScript">
    <properties>
      <sourceFilesUrls>
        <item url="file://$PROJECT_DIR$/range-coder/range-coder.js" />
        <item url="file://$PROJECT_DIR$/range-coder/o0c_v2a.js" />
        <item url="file://$PROJECT_DIR$/range-coder/io_ramd.js" />
        <item url="file://$PROJECT_DIR$/range-coder/subbotin.js" />
        <item url="file://$PROJECT_DIR$/range-coder/shindlet.js" />
      </sourceFilesUrls>
    </properties>
    <CLASSES>
      <root url="file://$PROJECT_DIR$/aridemojs/shindlet.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/huffman.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/test.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/lzw.js" />
      <root url="file://$PROJECT_DIR$/aridemojs/subbotin_bak.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/huffman2.js" />
      <root url="file://$PROJECT_DIR$/src/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/binaryHeap.js" />
      <root url="file://$PROJECT_DIR$/aridemojs/aridemo.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/aridemojs/shindlet.js" />
      <root url="file://$PROJECT_DIR$/aridemojs/subbotin_bak.js" />
      <root url="file://$PROJECT_DIR$/aridemojs/aridemo.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/huffman.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/test.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/lzw.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/huffman2.js" />
      <root url="file://$PROJECT_DIR$/src/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/binaryHeap.js" />
      <root url="file://$PROJECT_DIR$/tmp/compressjs-master/lzp3/huffman/rangeCoder.js" />
      <root url="file://$PROJECT_DIR$/range-coder/range-coder.js" />
      <root url="file://$PROJECT_DIR$/range-coder/o0c_v2a.js" />
      <root url="file://$PROJECT_DIR$/range-coder/io_ramd.js" />
      <root url="file://$PROJECT_DIR$/range-coder/subbotin.js" />
      <root url="file://$PROJECT_DIR$/range-coder/shindlet.js" />
    </CLASSES>
    <SOURCES />
  </library>
</component>


text:
using namespace std;
void centralityBoundaries(){

     long nEvt;

     Float_t b;
     vector<float> impactPar;

     TChain t1("hadronTree");
     t1.Add("../slurmjob_merged_tree.root");
     t1.SetBranchAddress("bTree", &b);
     nEvt=t1.GetEntries();
     //nEvtProcess=50;
     // first event loop for estimatig the event plane resolution
     for(long ne=0; ne<nEvt; ne++)
     {
       if(ne%2000==0)  cout<<"Have run "<<ne<<" of the total "<<nEvt<<" events; "<<endl;
       t1.GetEntry(ne);
       impactPar.push_back(b);

     } // end of the first event loop

     sort(impactPar.begin(), impactPar.end());

     //cout<<"size: "<<impactPar.size()<<endl;

     const int nCentralityBin = 100;
     float binBoundaries[nCentralityBin+1];
     binBoundaries[0] = 0.0;

     for(int i=0; i< nCentralityBin; i++){
       binBoundaries[i+1] = impactPar[(i+1)*impactPar.size()/nCentralityBin];
       //cout<<"boundaries: "<<binBoundaries[i+1]<<endl;
     }
     binBoundaries[nCentralityBin] = impactPar[impactPar.size()-1];

     ofstream outFile;
     outFile.open("boundaries100Bins.txt");
     for(int i=0; i< nCentralityBin+1; i++){
       cout<<binBoundaries[i]<<", ";
       outFile<<binBoundaries[i]<<", ";
     }
     cout<<endl;

}


text:
namespace content {

// Uniquely identifies a target that legacy IPCs can be routed to.
struct GlobalRoutingID {
  GlobalRoutingID() : child_id(-1), route_id(-1) {}

  GlobalRoutingID(int child_id, int route_id)
      : child_id(child_id), route_id(route_id) {}

  // The unique ID of the child process (this is different from OS's PID / this
  // should come from RenderProcessHost::GetID()).
  int child_id;

  // The route ID.
  int route_id;

  bool operator<(const GlobalRoutingID& other) const {
    return std::tie(child_id, route_id) <
           std::tie(other.child_id, other.route_id);
  }
  bool operator==(const GlobalRoutingID& other) const {
    return child_id == other.child_id && route_id == other.route_id;
  }
  bool operator!=(const GlobalRoutingID& other) const {
    return !(*this == other);
  }
};

// Same as GlobalRoutingID except the route_id must be a RenderFrameHost routing
// id.
struct GlobalFrameRoutingId {
  GlobalFrameRoutingId() : child_id(0), frame_routing_id(MSG_ROUTING_NONE) {}

  GlobalFrameRoutingId(int child_id, int frame_routing_id)
      : child_id(child_id), frame_routing_id(frame_routing_id) {}

  // GlobalFrameRoutingId is copyable.
  GlobalFrameRoutingId(const GlobalFrameRoutingId&) = default;
  GlobalFrameRoutingId& operator=(const GlobalFrameRoutingId&) = default;

  // The unique ID of the child process (this is different from OS's PID / this
  // should come from RenderProcessHost::GetID()).
  int child_id;

  // The route ID of a RenderFrame - should come from
  // RenderFrameHost::GetRoutingID().
  int frame_routing_id;

  bool operator<(const GlobalFrameRoutingId& other) const {
    return std::tie(child_id, frame_routing_id) <
           std::tie(other.child_id, other.frame_routing_id);
  }
  bool operator==(const GlobalFrameRoutingId& other) const {
    return child_id == other.child_id &&
           frame_routing_id == other.frame_routing_id;
  }
  bool operator!=(const GlobalFrameRoutingId& other) const {
    return !(*this == other);
  }
  explicit operator bool() const {
    return frame_routing_id != MSG_ROUTING_NONE;
  }
};

struct GlobalFrameRoutingIdHasher {
  std::size_t operator()(const GlobalFrameRoutingId& id) const {
    return base::HashInts(id.child_id, id.frame_routing_id);
  }
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_GLOBAL_ROUTING_ID_H_


text:
from __future__ import division, print_function

import logging
import json
import sys

import numpy as np
from sklearn.externals import six

def identity(x):
    return x

################################################################################
### Type utilities for numpy

def is_integer_type(x):
    "Checks whether the array is of an integral type."
    return issubclass(np.asanyarray(x).dtype.type, np.integer)

def is_categorical_type(ary):
    "Checks whether the array is either integral or boolean."
    ary = np.asanyarray(ary)
    return is_integer_type(ary) or ary.dtype.kind == 'b'

def is_integer(x):
    "Checks whether the argument is a single integer."
    return np.isscalar(x) and is_integer_type(x)

def is_categorical(x):
    "Checks whether the argument is a single integer or boolean."
    return np.isscalar(x) and is_categorical_type(x)

def as_integer_type(ary):
    '''
    Returns argument as an integer array, converting floats if convertable.
    Raises ValueError if it's a float array with nonintegral values.
    '''
    ary = np.asanyarray(ary)
    if is_integer_type(ary):
        return ary
    rounded = np.rint(ary)
    if np.any(rounded != ary):
        raise ValueError("argument array must contain only integers")
    return rounded.astype(int)

################################################################################

class NoImportStub(object):
    '''
    A class to use so that if there are missing optional dependencies, we can
    still import the name, but using it will raise the original import error
    that prevented us using the name anyway.
    '''
    def __init__(self, exception):
        self.exception = exception

    def __getattribute__(self, name):
        if name == 'exception':
            return object.__getattribute__(self, name)
        six.reraise(*self.exception)

    def __call__(self, *args, **kwargs):
        six.reraise(*self.exception)

################################################################################

class ProgressLogger(object):
    '''
    A little class to use to wrap logging progress to a logger object.

    Parameters
    ----------
    logger : :class:`logging.Logger`
        The logger instance to use.

    name : string, optional, default None
        The name of the process.

    Notes
    -----
    Instances of this class can be used as callables. In that case,
    they take an iterable and return a generator that yields each element, with
    appropriate progress messages in between. For example::

        ProgressLogger(logger)([x ** 2 for x in range(10)])
        ProgressLogger(logger)((x ** 2 for x in range(10)), total=10)

    will each yield the integers 1, 4, 9, ... while logging progress messages
    to ``logger``. In the second case, we passed the ``total`` argument to
    communicate the length of the iterable, which is not available via
    :func:`len`.

    A gotcha here is that :meth:`finish` will only be called if the iterator
    actually terminates. For example::

        for x, y in zip(things, ProgressLogger(logger)(f(x) for x in things)):
            pass

    won't ever :meth:`finish`, because :func:`zip` will see that ``things``
    ends first and not continue iterating over the generator.
    '''
    def __init__(self, logger, name=None):
        self.logger = logger
        self.name = name

    def start(self, total):
        '''
        Signal the start of the process.

        Parameters
        ----------
        total : int
            The total number of steps in the process, or None if unknown.
        '''
        self.logger.info(json.dumps(['START', self.name, total]))

    def update(self, idx):
        '''
        Update the current state.

        Parameters
        ----------
        idx : int
            The current state through the process.
        '''
        # json format, but since we might call this a lot do it a little faster
        self.logger.info('["SET", {}]'.format(idx))

    def finish(self):
        '''
        Marks the process as done.
        '''
        self.logger.info(json.dumps(['DONE']))

    def __call__(self, it, total=None):
        if total is None:
            try:
                total = len(it)
            except TypeError:
                total = None
        self.start(total)
        for i, thing in enumerate(it, 1):
            self.update(i)
            yield thing
        self.finish()

class ProgressBarHandler(logging.Handler):
    '''
    A logging handler that uses the progressbar module to show progress from
    a :class:`ProgressLogger`.

    Takes the same parameters as :class:`progressbar.ProgressBar`,
    but gives a default for ``widgets`` that applies only when maxval is
    available; you'll need to pass different widgets if not.
    '''
    def __init__(self, widgets=None, **kwargs):
        import progressbar as pb

        logging.Handler.__init__(self)

        if widgets is None:
            class CommaProgress(pb.Widget):
                def update(self, pbar):
                    return '{:,} of {:,}'.format(pbar.currval, pbar.maxval)

            widgets = [' ', CommaProgress(), ' (', pb.Percentage(), ') ',
                       pb.Bar(), ' ', pb.ETA()]

        self.pbar_args = {'widgets': widgets}
        self.pbar_args.update(kwargs)

    def emit(self, record):
        import progressbar as pb

        msg = json.loads(record.msg)
        # print(msg)
        if msg[0] == 'SET':
            pass
            self.pbar.update(msg[1])
        elif msg[0] == 'START':
            print(msg[1] + ':', file=sys.stderr)
            self.pbar = pb.ProgressBar(maxval=msg[2], **self.pbar_args)
            self.pbar.start()
        elif msg[0] == 'DONE':
            self.pbar.finish()
            del self.pbar
            print('', file=sys.stderr)

def show_progress(name, **kwargs):
    '''
    Sets up a :class:`ProgressBarHandler` to handle progess logs for
    a given module.

    Parameters
    ----------
    name : string
        The module name of the progress logger to use. For example,
        :class:`skl_groups.divergences.KNNDivergenceEstimator`
        uses ``'skl_groups.divergences.knn.progress'``.

    * : anything
        Other keyword arguments are passed to the :class:`ProgressBarHandler`.
    '''
    logger = logging.getLogger(name)
    logger.setLevel(logging.INFO)
    logger.addHandler(ProgressBarHandler(**kwargs))


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>cn.jdworks.etl</groupId>
  <artifactId>footask</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>footask</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>cn.jdworks.etl</groupId>
      <artifactId>protocol</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

  <build>
    <finalName>footask</finalName>
    <plugins>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<configuration>
	  <archive>
	    <manifest>
              <mainClass>cn.jdworks.etl.task.FooTask</mainClass>
	    </manifest>
	  </archive>
	</configuration>
      </plugin>
      <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <configuration>
                <mainClass>cn.jdworks.etl.task.FooTask</mainClass>
            </configuration>
      </plugin>
    </plugins>
  </build>

</project>


text:
require "sinatra/activerecord"
require "active_record"

module JetFuel
  class UserLink < ActiveRecord::Base
    validates_presence_of :full_url, :short_url, :relative_short_url, :user_id
    belongs_to :user

    def self.create_user_link(url,vanity,user_id)
      relative_link = generate_relative_link(10)
      user_link = UserLink.create(:full_url => check_url(url),
        :short_url => "jetfuel.herokuapp.com/jf/#{vanity}/#{relative_link}",
        :relative_short_url => relative_link,
        :vanity => vanity,
        :created_at => Time.now,
        :visits_count => 0,
        :user_id => user_id,
        :updated_at => Time.now
        )
    end

    def self.check_url(url)
      ("http://" + url) unless (url[0..6] == "http://")
    end

    def self.get_redirect(redirect)
      user_link = UserLink.find_by_relative_short_url(redirect)
      begin
        user_link.visits_count += 1
        user_link.save
      rescue

      end
      user_link
    end

    def self.generate_relative_link(length)
      x ||= [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten
      (0..(length-1)).map{ x[rand(x.length)] }.join
    end

    def self.shorten(url,vanity,user_id)
      #if url_exist?(url)
       # user_link = UserLink.find_by_full_url(url)
      #else
        user_link = create_user_link(url,vanity,user_id)
      #end
      #user_link
    end

    def self.url_exist?(url)
      UserLink.where(full_url: url).count > 0
    end

  end
end


text:
<?php

namespace Transfer\EzPlatform\Repository\Values;

use eZ\Publish\API\Repository\Values\Content\Location;
use Transfer\EzPlatform\Repository\Values\Mapper\LocationMapper;

/**
 * Location object.
 *
 * @see http://transfer-framework.com/docs/1.0/sources_and_targets/ezplatform/the_objects/locationobject.html
 */
class LocationObject extends EzPlatformObject
{
    /**
     * @var LocationMapper
     */
    private $mapper;

    /**
     * LocationObject constructor.
     *
     * @param array|Location $data
     * @param array          $properties
     */
    public function __construct($data, array $properties = [])
    {
        if ($data instanceof Location) {
            $this->getMapper()->locationToObject($data);
        } else {
            parent::__construct($data, $properties);
        }
    }

    /**
     * Allows direct control in LocationCreateStruct and LocationUpdateStruct.
     *
     * @param \Closure $callback
     */
    public function setStructCallback(\Closure $callback)
    {
        $this->setProperty('struct_callback', $callback);
    }

    /**
     * @return LocationMapper
     */
    public function getMapper()
    {
        if (!$this->mapper) {
            $this->mapper = new LocationMapper($this);
        }

        return $this->mapper;
    }
}


text:
@class Arena;

@interface Barrier : NSObject {
	Arena *arena;
	int xLoc, yLoc;
}

- initWithArena:a location:(int)x :(int)y;
- (void)drawOnPixmap:(PixelUnion *)pixmap width:(int)pixWidth;
- (void)die;
- (int)xLoc;
- (int)yLoc;
- (BOOL)isCreature;
- (Pixel24)color;

@end


text:
package org.robolectric.bytecode.testing;

import org.robolectric.internal.Instrument;

@SuppressWarnings("UnusedDeclaration")
@Instrument
public class AClassWithMethodReturningDouble {
  public double normalMethodReturningDouble(double doubleArg) {
    return doubleArg + 1;
  }
}


text: Fork of atom/tree-view for WebGL Studio


text:
function googleMap_initialize() {
	var mapOptions = {
		zoom: 8,
		center: new google.maps.LatLng(-34.397, 150.644),
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var mapObj = document.getElementById('googleMap1');
	console.log(mapObj);
	var map = new google.maps.Map(mapObj, mapOptions);
	console.log('init')
}


text:
<?php

namespace VitessPdo\PDO\MySql\QueryHandler;

use VitessPdo\PDO\VtCtld\ClientInterface;

/**
 * Description of class VtCtldMember
 *
 * @author  mfris
 * @package VitessPdo\PDO\MySql\Handler\Chain
 */
abstract class VtCtldMember extends Member
{

    use DependencyTrait\VtCtld;

    /**
     * VtCtldMember constructor.
     *
     * @param ClientInterface $client
     */
    public function __construct(ClientInterface $client)
    {
        $this->setClient($client);
    }
}


text:
#import "GDTLibrary/Public/GDTRegistrar.h"

#import "GDTLibrary/Private/GDTRegistrar_Private.h"

@implementation GDTRegistrar {
  /** Backing ivar for targetToUploader property. */
  NSMutableDictionary<NSNumber *, id<GDTUploader>> *_targetToUploader;

  /** Backing ivar for targetToPrioritizer property. */
  NSMutableDictionary<NSNumber *, id<GDTPrioritizer>> *_targetToPrioritizer;
}

+ (instancetype)sharedInstance {
  static GDTRegistrar *sharedInstance;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    sharedInstance = [[GDTRegistrar alloc] init];
  });
  return sharedInstance;
}

- (instancetype)init {
  self = [super init];
  if (self) {
    _registrarQueue = dispatch_queue_create("com.google.GDTRegistrar", DISPATCH_QUEUE_CONCURRENT);
    _targetToPrioritizer = [[NSMutableDictionary alloc] init];
    _targetToUploader = [[NSMutableDictionary alloc] init];
  }
  return self;
}

- (void)registerUploader:(id<GDTUploader>)backend target:(GDTTarget)target {
  __weak GDTRegistrar *weakSelf = self;
  dispatch_barrier_async(_registrarQueue, ^{
    GDTRegistrar *strongSelf = weakSelf;
    if (strongSelf) {
      strongSelf->_targetToUploader[@(target)] = backend;
    }
  });
}

- (void)registerPrioritizer:(id<GDTPrioritizer>)prioritizer target:(GDTTarget)target {
  __weak GDTRegistrar *weakSelf = self;
  dispatch_barrier_async(_registrarQueue, ^{
    GDTRegistrar *strongSelf = weakSelf;
    if (strongSelf) {
      strongSelf->_targetToPrioritizer[@(target)] = prioritizer;
    }
  });
}

- (NSMutableDictionary<NSNumber *, id<GDTUploader>> *)targetToUploader {
  __block NSMutableDictionary<NSNumber *, id<GDTUploader>> *targetToUploader;
  __weak GDTRegistrar *weakSelf = self;
  dispatch_sync(_registrarQueue, ^{
    GDTRegistrar *strongSelf = weakSelf;
    if (strongSelf) {
      targetToUploader = strongSelf->_targetToUploader;
    }
  });
  return targetToUploader;
}

- (NSMutableDictionary<NSNumber *, id<GDTPrioritizer>> *)targetToPrioritizer {
  __block NSMutableDictionary<NSNumber *, id<GDTPrioritizer>> *targetToPrioritizer;
  __weak GDTRegistrar *weakSelf = self;
  dispatch_sync(_registrarQueue, ^{
    GDTRegistrar *strongSelf = weakSelf;
    if (strongSelf) {
      targetToPrioritizer = strongSelf->_targetToPrioritizer;
    }
  });
  return targetToPrioritizer;
}

#pragma mark - GDTLifecycleProtocol

- (void)appWillBackground:(nonnull GDTApplication *)app {
  dispatch_async(_registrarQueue, ^{
    for (id<GDTUploader> uploader in [self->_targetToUploader allValues]) {
      if ([uploader respondsToSelector:@selector(appWillBackground:)]) {
        [uploader appWillBackground:app];
      }
    }
    for (id<GDTPrioritizer> prioritizer in [self->_targetToPrioritizer allValues]) {
      if ([prioritizer respondsToSelector:@selector(appWillBackground:)]) {
        [prioritizer appWillBackground:app];
      }
    }
  });
}

- (void)appWillForeground:(nonnull GDTApplication *)app {
  dispatch_async(_registrarQueue, ^{
    for (id<GDTUploader> uploader in [self->_targetToUploader allValues]) {
      if ([uploader respondsToSelector:@selector(appWillForeground:)]) {
        [uploader appWillForeground:app];
      }
    }
    for (id<GDTPrioritizer> prioritizer in [self->_targetToPrioritizer allValues]) {
      if ([prioritizer respondsToSelector:@selector(appWillForeground:)]) {
        [prioritizer appWillForeground:app];
      }
    }
  });
}

- (void)appWillTerminate:(nonnull GDTApplication *)app {
  dispatch_sync(_registrarQueue, ^{
    for (id<GDTUploader> uploader in [self->_targetToUploader allValues]) {
      if ([uploader respondsToSelector:@selector(appWillTerminate:)]) {
        [uploader appWillTerminate:app];
      }
    }
    for (id<GDTPrioritizer> prioritizer in [self->_targetToPrioritizer allValues]) {
      if ([prioritizer respondsToSelector:@selector(appWillTerminate:)]) {
        [prioritizer appWillTerminate:app];
      }
    }
  });
}

@end


text:
require File.join(File.dirname(__FILE__), '../spec_helper.rb')

module ActiveRecord
  module HyperRecord
    describe HyperBase, '.describe_table' do
      fixtures :pages

      it "should return a string describing the table schema" do
        table_description = Page.connection.describe_table(Page.table_name)
        table_description.should_not be_empty
        table_description.should include("name")
        table_description.should include("url")
      end
    end

    describe HyperBase, '.table_exists?' do
      fixtures :pages

      it "should return true if the underlying table exists" do
        Page.table_exists?.should be_true
      end

      it "should return false if the underlying table does not exists" do
        Dummy.table_exists?.should be_false
      end
    end

    describe HyperBase, '.drop_table' do
      fixtures :pages

      it "should remove a table from hypertable" do
        Page.table_exists?.should be_true
        Page.drop_table
        Page.table_exists?.should be_false
      end
    end

    describe HyperBase, '.columns' do
      fixtures :pages

      it "should return an array of columns within the table" do
        table_columns = Page.columns
        table_columns.should_not be_empty
        # column list include the special ROW key.
        table_columns.map{|c| c.name}.should == ['ROW', 'name', 'url']
      end
    end

    describe HyperBase, '.column_families_without_row_key' do
      fixtures :pages

      it "should return an array of columns within the table but does not include the row key" do
        columns_without_row_key = Page.column_families_without_row_key
        columns_without_row_key.should_not be_empty
        # column list does not include the special ROW key.
        columns_without_row_key.map{|c| c.name}.should == ['name', 'url']
      end
    end

    describe HyperBase, '.qualified_column_names_without_row_key' do
      fixtures :pages

      it "should return an array of column names where column families are replaced by fully qualified columns" do
        cols = QualifiedPage.qualified_column_names_without_row_key
        cols.should_not be_empty
        cols.should == ['misc:name', 'misc:url', 'misc2:foo', 'misc2:bar']
      end
    end

    describe HyperBase, '.qualified_columns' do
      it "should include qualified columns in the regular column list" do
        columns = QualifiedPage.columns
        columns.should_not be_empty
        columns.map{|c| c.name}.should == ['ROW', 'misc', 'misc2']
      end
    end

    describe HyperBase, '.find_initial' do
      fixtures :pages

      it "should return the first row in the table" do
        page = Page.find_initial({})
        page.class.should == Page
        page.name.should == "LOLcats and more"
        page.url.should == "http://www.icanhascheezburger.com"
      end
    end

    describe HyperBase, '.find_one' do
      fixtures :pages

      it "should return the requested row from the table" do
        page = Page.find_one('page_1', {})
        page.class.should == Page
        page.name.should == "LOLcats and more"
        page.url.should == "http://www.icanhascheezburger.com"
      end
    end

    describe HyperBase, '.find_some' do
      fixtures :pages

      it "should return the requested rows from the table" do
        row_keys = Page.find(:all).map{|p| p.ROW}
        record_count = row_keys.length
        record_count.should == 2
        pages = Page.find(row_keys)
        pages.length.should == record_count
      end
    end

    describe HyperBase, '.find' do
      fixtures :pages, :qualified_pages

      it "should return the declared list of qualified columns by default" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.misc['name'] = 'new page'
        qp.misc['url']= 'new.com'
        qp.ROW = 'new_qualified_page'
        qp.save.should be_true

        qp = QualifiedPage.find('new_qualified_page')
        qp.misc.keys.sort.should == ['name', 'url']
      end

      it "should support the limit option" do
        Page.new({:ROW => 'row key'}).save.should be_true
        Page.find(:all).length.should == 3
        pages = Page.find(:all, :limit => 2)
        pages.length.should == 2
      end

      it "should not support finder conditions not in Hash format" do
        lambda {Page.find(:all, :conditions => "value = 1")}.should raise_error
      end

      it "should not support finder conditions in Hash format" do
        # NOTE: will be supported in the future when Hypertable supports
        # efficient lookup on arbitrary columns
        lambda {
          pages = Page.find(:all, :conditions => {:name => 'ESPN'})
          pages.length.should == 1
          p = pages.first
          p.name.should == 'ESPN'
          p.ROW.should == 'page_2'
        }.should raise_error
      end

      it "should not support finder conditions in Hash format when the value is an array" do
        # NOTE: will be supported in the future when Hypertable supports
        # efficient lookup on arbitrary columns
        lambda {
          all_pages = Page.find(:all)
          all_pages.length.should == 2
          name_values = all_pages.map{|p| p.name}
          pages = Page.find(:all, :conditions => {:name => name_values})
          pages.length.should == 2
        }.should raise_error
      end

      it "should return a specific list of qualifiers when requested explicitly in finder options" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.misc['name'] = 'new page'
        qp.misc['url']= 'new.com'
        qp.ROW = 'new_qualified_page'
        qp.save.should be_true

        qp = QualifiedPage.find('new_qualified_page', :select => 'misc:url')
        # NOTE: will be supported in the future when Hypertable supports
        # efficient lookup on arbitrary columns
        # qp.misc.keys.sort.should == ['url']
        # For now, it returns all columns
        qp.misc.keys.sort.should == ['name', 'url']
      end

      it "should return an empty hash for all qualified columns even if none are explicitly listed in qualifiers" do
        qpweq = QualifiedPageWithoutExplicitQualifiers.new
        qpweq.new_record?.should be_true
        qpweq.misc['name'] = 'new page'
        qpweq.misc['url']= 'new.com'
        qpweq.ROW = 'new_qualified_page'
        qpweq.save.should be_true

        qpweq2 = QualifiedPageWithoutExplicitQualifiers.find(qpweq.ROW)
        # NOTE: will be supported in the future when Hypertable supports
        # efficient lookup on arbitrary columns
        # qpweq2.misc.should == {}
        # qpweq2.misc2.should == ""
        # For now, it returns all columns
        qpweq2.misc.should == {"name"=>"new page", "url"=>"new.com"}
        qpweq2.misc2.should be_nil
      end

      it "should instantiate the object with empty hashes for qualified columns when no explicit select list is supplied" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.ROW = 'new_qualified_page'
        qp.misc2 = 'test'
        qp.save.should be_true

        qp = QualifiedPage.find(:first)
        qp.misc.should == {}
      end

      it "should allow user to specify ROW key as part of initialize attributes" do
        p = Page.new({:ROW => 'row key'})
        p.ROW.should == 'row key'
      end

      it "should not have any residual state between calls to new" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.misc['name'] = 'new page'
        qp.misc['url']= 'new.com'
        qp.ROW = 'new_qualified_page'
        qp.save.should be_true

        qp2 = QualifiedPage.new
        qp2.misc.should == {}
        qp2.misc2.should == {}
        qp.misc.object_id.should_not == qp2.misc.object_id
      end
    end

    describe HyperBase, '.table_exists?' do
      fixtures :pages

      it "should return true for a table that does exist" do
        Page.table_exists?.should be_true
      end

      it "should return false for a table that does exist" do
        Dummy.table_exists?.should be_false
      end
    end

    describe HyperBase, '.primary_key' do
      it "should always return the special ROW key" do
        Dummy.primary_key.should == 'ROW'
      end
    end

    describe HyperBase, '.new' do
      fixtures :pages, :qualified_pages

      it "should an object of correct class" do
        p = Page.new
        p.new_record?.should be_true
        p.class.should == Page
        p.class.should < ActiveRecord::HyperBase
        p.attributes.keys.sort.should == ['name', 'url']
      end

      it "should not allow an object to be saved without a row key" do
        page_count = Page.find(:all).length
        p = Page.new
        p.new_record?.should be_true
        p.name = "new page"
        p.url = "new.com"
        p.valid?.should be_false
        p.save.should be_false
        p.new_record?.should be_true
        p.ROW = "new_page"
        p.valid?.should be_true
        p.save.should be_true
        p.new_record?.should be_false
        Page.find(:all).length.should == page_count + 1
      end

      it "should save a table with qualified columns correctly" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.misc['name'] = 'new page'
        qp.misc['url']= 'new.com'
        qp.ROW = 'new_qualified_page'
        qp.save.should be_true
        qp.new_record?.should be_false
        qp.reload.should == qp
        qp.misc['name'].should == 'new page'
        qp.misc['url'].should == 'new.com'
        qp.misc.keys.sort.should == ['name', 'url']
      end
    end

    describe HyperBase, '.reload' do
      fixtures :pages

      it "should reload an object and revert any changed state" do
        p = Page.find(:first)
        p.class.should == Page
        original_url = p.url.clone
        p.url = "new url"
        p.reload.should == p
        p.url.should == original_url
      end
    end

    describe HyperBase, '.save' do
      fixtures :pages, :qualified_pages

      it "should update an object in hypertable" do
        p = Page.find(:first)
        p.class.should == Page
        original_url = p.url.clone
        p.url = "new url"
        p.save.should be_true
        p.url.should == "new url"
        p.reload.should == p
        p.url.should == "new url"
      end

      it "should allow undeclared qualified columns to be saved, provided that the column family is declared" do
        qp = QualifiedPage.new
        qp.new_record?.should be_true
        qp.misc['name'] = 'new page'
        qp.misc['url'] = 'new.com'
        qp.misc['new_column'] = 'value'
        qp.ROW = 'new_qualified_page'
        qp.save.should be_true
        qp.new_record?.should be_false
        qp.reload.should == qp
        qp.misc['name'].should == 'new page'
        qp.misc['url'].should == 'new.com'
        qp.misc['new_column'].should == 'value'
      end
    end

    describe HyperBase, '.update' do
      fixtures :pages

      it "should update an object in hypertable" do
        p = Page.find(:first)
        p.class.should == Page
        original_url = p.url.clone
        p.url = "new url"
        p.update.should be_true
        p.url.should == "new url"
        p.reload.should == p
        p.url.should == "new url"
      end
    end

    describe HyperBase, '.destroy' do
      fixtures :pages

      it "should remove an object from hypertable" do
        p = Page.find(:first)
        p.reload.should == p
        p.destroy
        lambda {p.reload}.should raise_error(::ActiveRecord::RecordNotFound)
      end

      it "should remove an object from hypertable based on the id" do
        p = Page.find(:first)
        p.reload.should == p
        Page.destroy(p.ROW)
        lambda {p.reload}.should raise_error(::ActiveRecord::RecordNotFound)
      end

      it "should remove multiple objects from hypertable based on ids" do
        pages = Page.find(:all)
        pages.length.should == 2
        Page.destroy(pages.map{|p| p.ROW})
        pages = Page.find(:all)
        pages.length.should == 0
      end
    end

    describe HyperBase, '.delete' do
      fixtures :pages

      it "should remove an object from hypertable based on the id" do
        p = Page.find(:first)
        p.reload.should == p
        Page.delete(p.ROW)
        lambda {p.reload}.should raise_error(::ActiveRecord::RecordNotFound)
      end

      it "should remove multiple objects from hypertable based on ids" do
        pages = Page.find(:all)
        pages.length.should == 2
        Page.delete(pages.map{|p| p.ROW})
        pages = Page.find(:all)
        pages.length.should == 0
      end
    end

    describe HyperBase, '.exists' do
      fixtures :pages

      it "should confirm that a record exists" do
        p = Page.find(:first)
        Page.exists?(p.ROW).should be_true
      end

      it "should refute that a record does not exists" do
        Page.exists?('foofooofoofoofoofoomonkey').should be_false
      end

      it "should not support arguments that are not numbers, strings or hashes" do
        lambda {Page.exists?([1])}.should raise_error
      end

      it "should not allow a Hash argument for conditions" do
        lambda {
          Page.exists?(:name => 'ESPN').should be_true
        }.should raise_error

        lambda {
          Page.find(:first, :conditions => {:name => 'ESPN'}).should_not be_nil
        }.should raise_error

        lambda {
          Page.exists?(:name => 'foofoofoofoofoo').should be_false
        }.should raise_error

        lambda {
          Page.find(:first, :conditions => {:name => 'foofoofoofoofoo'}).should be_nil
        }.should raise_error
      end
    end

    describe HyperBase, '.increment' do
      fixtures :pages

      it "should increment an integer value" do
        p = Page.find(:first)
        p.name = 7
        p.save
        p.reload
        p.increment('name')
        p.name.should == 8
        p.save
        p.reload
        p.name.should == "8"
        p.increment('name', 2)
        p.save
        p.reload
        p.name.should == "10"
      end
    end

    describe HyperBase, '.increment!' do
      fixtures :pages

      it "should increment an integer value and save" do
        p = Page.find(:first)
        p.name = 7
        p.increment!('name')
        p.name.should == 8
        p.reload
        p.name.should == "8"
        p.increment!('name', 2)
        p.reload
        p.name.should == "10"
      end
    end

    describe HyperBase, '.decrement' do
      fixtures :pages

      it "should decrement an integer value" do
        p = Page.find(:first)
        p.name = 7
        p.save
        p.reload
        p.decrement('name')
        p.name.should == 6
        p.save
        p.reload
        p.name.should == "6"
        p.decrement('name', 2)
        p.save
        p.reload
        p.name.should == "4"
      end
    end

    describe HyperBase, '.decrement!' do
      fixtures :pages

      it "should decrement an integer value and save" do
        p = Page.find(:first)
        p.name = 7
        p.decrement!('name')
        p.name.should == 6
        p.reload
        p.name.should == "6"
        p.decrement!('name', 2)
        p.reload
        p.name.should == "4"
      end
    end

    describe HyperBase, '.update_attribute' do
      fixtures :pages

      it "should allow a single attribute to be updated" do
        p = Page.find(:first)
        p.update_attribute(:name, 'new name value')
        p.name.should == 'new name value'
        p.reload
        p.name.should == 'new name value'
      end

      it "should save changes to more than the named column because that's the way activerecord works" do
        p = Page.find(:first)
        p.name = "name"
        p.url = "url"
        p.save!
        p.url = "new url"
        p.update_attribute(:name, 'new name value')
        p.name.should == 'new name value'
        p.url.should == 'new url'
        p.reload
        p.name.should == 'new name value'
        p.url.should == 'new url'
      end
    end

    describe HyperBase, '.update_attributes' do
      fixtures :pages

      it "should allow multiple attributes to be updated" do
        p = Page.find(:first)
        p.update_attributes({:name => 'new name value', :url => 'http://new/'})
        p.name.should == 'new name value'
        p.url.should == 'http://new/'
        p.reload
        p.name.should == 'new name value'
        p.url.should == 'http://new/'
      end
    end
  end
end


text:
def quick_sort(data, start, end):
    # print('Use quick sort with recursion'
    if start >= end:
        return
    mid = partition(data, start, end)
    quick_sort(data, start, mid)
    quick_sort(data, mid + 1, end)

# 非递归方式
def quick_sort2(data, start, end):
    print('Use quick sort without recursion')
    sub_sequences = [(start, end)]
    while sub_sequences:
        i, j = sub_sequences.pop()
        mid = partition(data, i, j)
        if mid > i:
            sub_sequences.append((i, mid))
        if j > mid + 1:
            sub_sequences.append((mid + 1, j))

def partition(data, start, end):
    basic = data[start]
    left, right = start, end
    while left < right:
        while left < right and data[right] >= basic:
            right -= 1
        data[left] = data[right]
        while left < right and data[left] <= basic:
            left += 1
        data[right] = data[left]
    data[left] = basic
    return left

if __name__ == '__main__':
    import random

    data = [i for i in range(100)]
    random.shuffle(data)
    print('src', data)
    # data = [1, 8, 5, 2, 3]
    quick_sort2(data, 0, len(data) - 1)
    print('after sort:', data)


text:
/*
 * An XML document type.
 * Localname: stringelement
 * Namespace: http://xmlbeans.apache.org/samples/any
 * Java type: org.apache.xmlbeans.samples.any.StringelementDocument
 *
 * Automatically generated - do not modify.
 */
package org.apache.xmlbeans.samples.any;

/**
 * A document containing one stringelement(@http://xmlbeans.apache.org/samples/any) element.
 *
 * This is a complex type.
 */
public interface StringelementDocument extends org.apache.xmlbeans.XmlObject
{
    public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("stringelementc479doctype");

    /**
     * Gets the "stringelement" element
     */
    java.lang.String getStringelement();

    /**
     * Gets (as xml) the "stringelement" element
     */
    org.apache.xmlbeans.XmlString xgetStringelement();

    /**
     * Sets the "stringelement" element
     */
    void setStringelement(java.lang.String stringelement);

    /**
     * Sets (as xml) the "stringelement" element
     */
    void xsetStringelement(org.apache.xmlbeans.XmlString stringelement);

    /**
     * A factory class with static methods for creating instances
     * of this type.
     */

    public static final class Factory
    {
        public static org.apache.xmlbeans.samples.any.StringelementDocument newInstance() {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }

        /** @param xmlAsString the string value to parse */
        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }

        /** @param file the file from which to load an xml document */
        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }

        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }

        /** @deprecated {@link XMLInputStream} */
        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }

        /** @deprecated {@link XMLInputStream} */
        public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
          return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }

        /** @deprecated {@link XMLInputStream} */
        public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
          return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }

        /** @deprecated {@link XMLInputStream} */
        public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
          return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }

        private Factory() { } // No instance of this class allowed
    }
}