text:
const config = {
    senderEmail: process.env.SMTP_SENDER_EMAIL || 'Leave Tracking <leave.tracking@my-domain.com>',
    host: process.env.SMTP_HOST || 'smtp.ethereal.email',
    port: process.env.SMTP_PORT || 587,
    secure: process.env.SMTP_SECURE || false,
    auth: {
        user: process.env.SMTP_USER || 'uhzdcegtgaxt427t@ethereal.email',
        pass: process.env.SMTP_PASSWORD || 'cR48DwNMD3ncEwykrG'
    },
    tls: {
        rejectUnauthorized: false
    }
};

export default config;


text:
import React from 'react'
import PropTypes from 'prop-types'
import css from 'styled-jsx/css' // eslint-disable-line import/no-extraneous-dependencies

const style = css`
  @import 'colors';

  .wrapper {
    display: inline-block;
    border: 0 none;
    border-radius: 2px;
    padding: 5px 7px;
    border: 1px solid transparent;
    cursor: pointer;
    -webkit-font-smoothing: antialiased;
    color: inherit;

    &:disabled {
      background-color: $lightgrey;
      color: $grey;
      cursor: not-allowed;
    }
  }

  .block {
    display: block;
    width: 100%;
  }

  .small {
    font-size: 0.8em;
    padding: 2px 4px;
  }

  .large {
    font-size: 1.2em;
    padding: 12px 16px;

    a {
      margin: -13px -17px;
      padding: 13px 17px;
    }
  }

  // Colors
  .blue {
    background-color: $blue;
    border-color: $blue;
    color: $white;

    &:hover {
      background-color: darken($blue, 10%);
      border-color: darken($blue, 10%);
    }
  }

  .red {
    background-color: $red;
    border-color: $red;
    color: $white;

    &:hover {
      background-color: darken($red, 10%);
      border-color: darken($red, 10%);
    }
  }

  .white {
    background-color: $white;
    border-color: $blue;
    color: $blue;

    &:hover {
      background-color: lighten($blue, 43%);
    }
  }
`

const Button = ({children, type, size, color, href, disabled, block, ...props}) => {
  if (href) {
    return (
      <a
        href={href}
        className={`wrapper ${size} ${disabled ? '' : color} ${block ? 'block' : ''}`}
        {...props}
      >
        {children}
        <style jsx>{style}</style>
      </a>
    )
  }

  return (
    <button
      type={type}
      disabled={disabled}
      className={`wrapper ${size} ${disabled ? '' : color} ${block ? 'block' : ''}`}
      {...props}
    >
      {children}
      <style jsx>{style}</style>
    </button>
  )
}

Button.propTypes = {
  children: PropTypes.node.isRequired,
  disabled: PropTypes.bool,
  block: PropTypes.bool,
  type: PropTypes.string,
  href: PropTypes.string,
  size: PropTypes.oneOf([
    '',
    'small',
    'large'
  ]),
  color: PropTypes.oneOf([
    'blue',
    'red',
    'white'
  ])
}

Button.defaultProps = {
  disabled: false,
  block: false,
  href: null,
  size: '',
  type: 'button',
  color: 'blue'
}

export default Button

redpajama_set_name: RedPajamaGithub


text:
public class Solution {
    public int divide(int dividend, int divisor) {
        if (divisor == 0) return 0;

        long a = Math.abs((long) dividend), b = Math.abs((long) divisor), result = 0;
        while (b <= a) {
            long cur = b, base = 1;
            while ((cur << 1) < a) {
                cur <<= 1;
                base <<= 1;
            }
            result += base;
            a -= cur;
        }

        if ((dividend < 0 && divisor > 0) || (dividend > 0 && divisor < 0)) result = -result;
        if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) return Integer.MAX_VALUE;
        return (int) result;
    }
}


text:
layout: post
title: "Daily commands #2: Debug startup problems"
...

I know some of these words ↓

>   **dmesg** (Display message or driver message) is a command which will show
>   Kernel ring buffers. These messages contain valuable information about
>   device drivers loaded into the kernel at the time of booting as well as when
>   we connect a hardware to the system on the fly. In other words dmesg will
>   give us details about hardware drivers connected to, disconnected from a
>   machine and any errors when hardware driver is loaded into the kernel. These
>   messages are helpful in diagnosing or debugging hardware and device driver
>   issues. Already covered command in the series is

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sudo dmesg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<!--more-->

<script type="text/javascript" src="https://asciinema.org/a/6zmrwj8hshjkk0z2wqc5brooc.js" id="asciicast-21264" async></script>


text:
<!DOCTYPE html><title>tcl.js</title><link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"><link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"><link href="http://code.jquery.com/qunit/git/qunit.css" rel="stylesheet" type="text/css">
<button onclick="show('docs');">Documentation</button><button onclick="show('tests');">Unit Tests</button><button onclick="show('codes');">Source Code</button>

tcl.js

Atomic OS WASH command

Run a tcl command

Author:  Scott Elcomb <psema4-at-gmail-dot-com (http://www.psema4.com)

Version:  2.0.0

Constructor
Dummy constructor

Access programmatically via system.bin.tcl.methodName

help -     help: function()

Simple synopsis on this command, used by the help command

Returns:

string
Returns a simple string synopsis for this command

exec -     exec: function(args)
Executes command with args. The calling HxProcess is available as this and it's first 3 file descriptors are stdin, stdout, and stderr respectively.

For example, to tcl text to stdout: this.fd[1].write('foobar');

Parameters:

Array
args
A list of arguments the command was called with

Generated by JSDog in about 0.003 seconds

tcl.js

/* tcl.js
 *
 * Atomic OS WASH command
 *
 * Run a tcl command
 *
 * @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com)
 * @version 2.0.0
 */

window.system = window.system || {};
system.bin = system.bin || {};

/* Dummy constructor
 *
 * Access programmatically via system.bin.tcl.!!methodName!!
 * @constructor
 */
system.bin.tcl = {
    /* @method help
     * @returns {string} Returns a simple string synopsis for this command
     *
     * Simple synopsis on this command, used by the <a href="help.html">help command</a>
     */
    help: function() {
        return "Run a tcl command and print the result \n\n  Usage: tcl [string]";
    },

    /* @method exec
     * @param {Array} args A list of arguments the command was called with
     * Executes command with args. The calling HxProcess is available as **this** and it's first 3 file descriptors are stdin, stdout, and stderr respectively.
     * For example, to tcl text to stdout: **this.fd[1].write('foobar');**
     */
    exec: function(args) {
        var debug = false;
        // 'this' is the calling process

        var stdin  = (this.fd && this.fd.length > 0) ? this.fd[0] : false;
        var stdout = (this.fd && this.fd.length > 1) ? this.fd[1] : false;
        var stderr = (this.fd && this.fd.length > 2) ? this.fd[2] : false;

        try {
            var message = (args instanceof Array) ? message = args.join(' ') : args;
            var filename = '', result;

            if (message.match(/^< /)) {
                filename = message.replace(/^< /, '');
                var buf = system.fs.readFile(filename);
                result = tcl(buf);

            } else {
                result = tcl(message);
            }

            if (result && result.content) stdout.write(result.content);

        } catch(e) {
            if (stderr) {
                stderr.write('command exception: ' + e);

            } else {
                console.log('command exception:');
                console.dir(e);
            }
        }

    }
};


text:
'use strict';

function SigninCtrl($location, $scope, UserService) {

    this.submitted = false
    this.message = ""

    this.submit = function() {
        this.submitted = true
        if (!$scope.signin_form.$valid) {
            return;
        }
        UserService.login({
            email: this.user.email,
            password: this.user.password
        })
        .then(function(user) {
            console.log('User logged in');
            UserService.setUserId(user.id)
            $scope.main.show_menu = true
            $location.path('/main/mychecklists')
        }, function(error) {
            console.log(error);
            $scope.signin.message = "Invalid Password"
        });
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/checkout_cart_preview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:visibility="invisible">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginLeft="@dimen/checkout_status_margin"
            android:layout_marginRight="@dimen/checkout_status_margin"
            android:layout_marginTop="@dimen/checkout_status_margin"
            android:text="@string/checkout_pay"
            android:textSize="@dimen/textsize_checkout_status" />

        <TextView
            android:id="@+id/checkout_total_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textColor="@android:color/black"
            android:textSize="@dimen/textsize_slidinguppanel_bottom_total_price"
            android:textStyle="bold" />

        <include layout="@layout/divider" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/checkout_cart_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight=".70"
            android:scrollbars="vertical" />

    </LinearLayout>

    <TextView
        android:id="@+id/checkout_status_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:textColor="@color/colorPrimaryDark"
        android:textSize="@dimen/textsize_checkout_status" />

    <Button
        android:id="@+id/checkout_retry_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkout_status_description"
        android:layout_centerHorizontal="true"
        android:text="@string/retry"
        android:textSize="@dimen/textsize_button" />

    <Button
        android:id="@+id/checkout_ok_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkout_status_description"
        android:layout_centerHorizontal="true"
        android:text="@android:string/ok"
        android:textSize="@dimen/textsize_button" />

    <ProgressBar
        android:id="@+id/checkout_progress_bar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:visibility="gone" />

</RelativeLayout>


text:
using System.Linq;
using Abp.Configuration;
using Abp.Localization;
using Abp.Net.Mail;
using Microsoft.EntityFrameworkCore;

namespace Satrabel.OpenApp.EntityFramework.Seed.Host
{
    public class DefaultSettingsCreator<TSelf>
        where TSelf : OpenAppDbContext<TSelf>
    {
        private readonly OpenAppDbContext<TSelf> _context;

        public DefaultSettingsCreator(OpenAppDbContext<TSelf> context)
        {
            _context = context;
        }

        public void Create()
        {
            //Emailing
            AddSettingIfNotExists(EmailSettingNames.DefaultFromAddress, "admin@mydomain.com");
            AddSettingIfNotExists(EmailSettingNames.DefaultFromDisplayName, "mydomain.com mailer");

            //Languages
            AddSettingIfNotExists(LocalizationSettingNames.DefaultLanguage, "en");
        }

        private void AddSettingIfNotExists(string name, string value, int? tenantId = null)
        {
            if (_context.Settings.IgnoreQueryFilters().Any(s => s.Name == name && s.TenantId == tenantId && s.UserId == null))
            {
                return;
            }

            _context.Settings.Add(new Setting(tenantId, null, name, value));
            _context.SaveChanges();
        }
    }
}


text:
function [theta,w]=hp_mapping(wp)
%   usage   [theta,w]=hp_mapping(wp)
%
%   where   theta = values of theta (original filter)
%           w = mapped valued of omega (transformed filter)
%           wp = desired passband cutoff in transformed filter in radians

w = 0:.01:pi;
theta_p = pi-wp;                                % set pass band frequency
a = -cos((theta_p+wp)/2)/cos((theta_p-wp)/2);   % set constant
Z = -(exp(-j*w)+a)./(1+a*exp(-j*w));            % pg 434 from old Oppenheim & Schafer book
theta = abs(angle(Z));
%plot(w/pi,theta/pi)


text:
package bits.collect;

/**
 * Three comparison functions that impose a total ordering on a set
 * of intervals. IntervalComparators are not necessarily consistent
 * with equal. Two non-equivalent objects MAY share the same interval
 * ordering, and equivalent objects SHOULD share the same interval ordering.
 *
 * @author Philip DeCamp
 * @see java.util.Comparator
 */
public interface IntervalComparator<T> {

    /**
     * Compare the minimum values of two intervals.
     *
     * @param a  First object to compare.
     * @param b  Second object to compare.
     * @return negative mValue iff min of <tt>a</tt> is less than min of <tt>b</tt>;
     *         0 iff equivalent; positive mValue iff min of <tt>a</tt> is greater
     *         than min of <tt>b</tt>
     */
    int compareMins( T a, T b );

    /**
     * Compare the maximum values of two intervals.
     *
     * @param a  First object to compare.
     * @param b  Second object to compare.
     * @return negative mValue iff max of <tt>a</tt> is less than max of <tt>b</tt>;
     *         0 iff equivalent; positive mValue iff max of <tt>a</tt> is greater
     *         than max of <tt>b</tt>
     */
    int compareMaxes( T a, T b );

    /**
     * Compare the minimum mValue of one interval to the maximum mValue of
     * another.
     *
     * @param a  First object to compare.
     * @param b  Second object to compare.
     * @return negative mValue iff min of <tt>a</tt> is smaller than max of
     *         <tt>b</tt>; 0 iff equivalent; positive mValue iff min of <tt>a</tt> is
     *         greater than maxof <tt>b</tt>
     */
    int compareMinToMax( T a, T b );

}


text:
SET ( AWK_FIND_REQUIRED FALSE )
SET ( Boost_FIND_REQUIRED TRUE )
SET ( Boost_USE_MULTITHREADED ON )
SET ( Boost_USE_STATIC_LIBS OFF )
SET ( Boost_USE_STATIC_RUNTIME OFF )
SET ( CRYPTOPP_FIND_REQUIRED TRUE )
SET ( CURLPP_FIND_REQUIRED TRUE )
SET ( CUT_FIND_REQUIRED FALSE )
SET ( GIT_FIND_REQUIRED TRUE )
SET ( GRAPHICS_MAGICKPP_FIND_REQUIRED FALSE )
SET ( GRAPHICS_MAGICK_FIND_REQUIRED FALSE )
SET ( GRAPHICS_MAGICK_WAND_FIND_REQUIRED FALSE )
SET ( GRAPHICS_MAGICKPP_CONFIG_FIND_REQUIRED FALSE )
SET ( GRAPHICS_MAGICK_CONFIG_FIND_REQUIRED FALSE )
SET ( GRAPHICS_MAGICK_WAND_CONFIG_FIND_REQUIRED FALSE )
SET ( GREP_FIND_REQUIRED FALSE )
SET ( GULP_FIND_REQUIRED TRUE )
SET ( GEOLITE2_CITY_MMDB_FIND_REQUIRED TRUE )
SET ( GEOLITE2_COUNTRY_MMDB_FIND_REQUIRED TRUE )
SET ( GEOLITE2_ASN_MMDB_FIND_REQUIRED TRUE )
SET ( IMAGE_MAGICKPP_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICK_CORE_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICK_WAND_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICKPP_CONFIG_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICK_CONFIG_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICK_CORE_CONFIG_FIND_REQUIRED FALSE )
SET ( IMAGE_MAGICK_WAND_CONFIG_FIND_REQUIRED FALSE )
SET ( KVM_FIND_REQUIRED TRUE )
SET ( LIBARCHIVE_FIND_REQUIRED TRUE )
SET ( LIBB64_FIND_REQUIRED TRUE )
SET ( LIBCURL_FIND_REQUIRED TRUE )
SET ( LIBSTATGRAB_FIND_REQUIRED TRUE )
SET ( LIBZIP_FIND_REQUIRED TRUE )
SET ( MAGICKPP_FIND_REQUIRED TRUE )
SET ( MAXMINDDB_FIND_REQUIRED TRUE )
SET ( NPM_FIND_REQUIRED TRUE )
SET ( PERL_FIND_REQUIRED FALSE )
SET ( PGSQL_FIND_REQUIRED TRUE )
SET ( PQXX_FIND_REQUIRED TRUE )
SET ( SED_FIND_REQUIRED FALSE )
SET ( SODIUM_FIND_REQUIRED TRUE )
SET ( Threads_FIND_REQUIRED TRUE )
SET ( TR_FIND_REQUIRED FALSE )
SET ( VMIME_FIND_REQUIRED TRUE )
SET ( WT_FIND_REQUIRED TRUE )
IF ( "${WT_APPLICATION_TYPE}" STREQUAL "FASTCGI" )
    SET ( WT_FCGI_FIND_REQUIRED TRUE )
    SET ( WT_HTTPD_FIND_REQUIRED FALSE )
ELSEIF ( "${WT_APPLICATION_TYPE}" STREQUAL "WTHTTPD" )
    SET ( WT_FCGI_FIND_REQUIRED FALSE )
    SET ( WT_HTTPD_FIND_REQUIRED TRUE )
ENDIF (  )
SET ( WT_RESOURCES_FIND_REQUIRED TRUE )

SET ( PREFERRED_MAGICK_IMPLEMENTATION "GM" CACHE STRING "" )
SET_PROPERTY( CACHE PREFERRED_MAGICK_IMPLEMENTATION PROPERTY STRINGS "GM" "IM" )

### Boost ###
FIND_PACKAGE (Boost 1.55.0
    COMPONENTS
        date_time filesystem iostreams locale random regex system thread
    )
INCLUDE_DIRECTORIES ( SYSTEM ${Boost_INCLUDE_DIRS} )

### Common Unix Utilities ###
FIND_PACKAGE ( CommonUnixUtilities )

### Crypto++ ###
FIND_PACKAGE ( Cryptopp )
INCLUDE_DIRECTORIES ( SYSTEM ${CRYPTOPP_INCLUDE_DIR} )

### cURLpp ###
FIND_PACKAGE ( cURLpp )
INCLUDE_DIRECTORIES ( SYSTEM ${CURLPP_INCLUDE_DIR} )

### Git ###
FIND_PACKAGE ( Git )
IF ( NOT GIT_FOUND )
    IF ( GIT_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find Git" )
    ENDIF (  )
ENDIF (  )

### Gulp ###
FIND_PACKAGE ( Gulp )

### kvm ###
IF ( ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" )
    FIND_PACKAGE ( KVM )
    LINK_DIRECTORIES ( ${KVM_LIBRARY} )
ENDIF (  )

### libarchive ###
FIND_PACKAGE ( libarchive )
INCLUDE_DIRECTORIES ( SYSTEM ${LIBARCHIVE_INCLUDE_DIR} )

### libb64 ###
FIND_PACKAGE ( libb64 )
INCLUDE_DIRECTORIES ( SYSTEM ${LIBB64_INCLUDE_DIR} )

### libcurl ###
FIND_PACKAGE ( libcurl )
INCLUDE_DIRECTORIES ( SYSTEM ${LIBCURL_INCLUDE_DIR} )

### libstatgrab ###
FIND_PACKAGE ( libstatgrab )
INCLUDE_DIRECTORIES ( SYSTEM ${LIBSTATGRAB_INCLUDE_DIR} )

### libzip ###
FIND_PACKAGE ( libzip )
INCLUDE_DIRECTORIES ( SYSTEM ${LIBZIP_INCLUDE_DIR} )

### Magick ###
FIND_PACKAGE ( Magick )
INCLUDE_DIRECTORIES ( SYSTEM ${MAGICKPP_INCLUDE_DIR} )
IF ( ${PREFERRED_MAGICK_IMPLEMENTATION} MATCHES "IM" )
    SET ( MAGICKCORE_QUANTUM_DEPTH 8 )
    SET ( MAGICKCORE_HDRI_ENABLE FALSE )
ENDIF (  )

### MaxMind DB ###
FIND_PACKAGE ( MaxMindDB )
INCLUDE_DIRECTORIES ( SYSTEM ${MAXMINDDB_INCLUDE_DIR} )

### npm ###
FIND_PACKAGE ( npm )

### pgSQL ###
FIND_PACKAGE ( pgSQL )
INCLUDE_DIRECTORIES ( SYSTEM ${PGSQL_INCLUDE_DIR} )

### pqxx ###
FIND_PACKAGE ( pqxx )
INCLUDE_DIRECTORIES ( SYSTEM ${PQXX_INCLUDE_DIR} )

### Sodium ###
FIND_PACKAGE ( Sodium )
INCLUDE_DIRECTORIES ( SYSTEM ${SODIUM_INCLUDE_DIR} )

### Threads ###
FIND_PACKAGE ( Threads )
IF ( NOT Threads_FOUND )
    IF ( Threads_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find Threads" )
    ENDIF (  )
ENDIF (  )

### VMime ###
FIND_PACKAGE ( VMime )
INCLUDE_DIRECTORIES ( SYSTEM ${VMIME_INCLUDE_DIR} )

### Wt ###
FIND_PACKAGE ( Wt )
INCLUDE_DIRECTORIES ( SYSTEM ${WT_INCLUDE_DIR} )


text:
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd"
	  view-id="/auth/oneid/oneidlogin.xhtml">

    <action execute="#{authenticator.prepareAuthenticationForStep}" on-postback="false" if="#{not identity.loggedIn}"/>

    <rewrite pattern="/auth/oneid/oneid-login" />

    <navigation from-action="#{authenticator.prepareAuthenticationForStep}">
        <rule if-outcome="success">
            <render view-id="/auth/oneid/oneidlogin.xhtml" />
        </rule>

        <rule if-outcome="no_permissions">
            <end-conversation />
            <redirect view-id="/error.xhtml">
                <message severity="ERROR">You don't have permissions</message>
            </redirect>
        </rule>

        <rule if-outcome="failure">
            <end-conversation />
            <redirect view-id="/error.xhtml">
                <message severity="ERROR">Failed to authenticate</message>
            </redirect>
        </rule>
    </navigation>
</page>


text:
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-behaviors/paper-button-behavior.html">

<dom-module id="paper-toggle-button">

  <link rel="import" type="css" href="paper-toggle-button.css">

  <template>

        <paper-ripple id="ink" class="toggle-ink circle" recenters=""></paper-ripple>

  </template>

  </dom-module>


text:
Exercises

        <input ng-model="searchString"></input>

        <button ng-click="create(searchString)" type="button" class="btn btn-default">
             Add
        </button>

{{exercise.name}}

        {{exercise.currentTarget}}

        <form ng-show="doingIt" >
            <button class="btn btn-lg btn-success smashedItButton" ng-click="doingIt = false;changingIt = true;">Smashed it</button>

            <button class="btn btn-lg btn-info justMadeItButton" ng-click="doingIt = false">Just made it</button>

            <button class="btn btn-lg btn-warning failedButton" ng-click="doingIt = false;changingIt = true;">Failed</button>

        </form>

        <form class="new-target-form" ng-show="changingIt" ng-submit="changingIt=false;update(exercise);">

enter new target

            <input type="text" ng-model="exercise.currentTarget" placeholder="CurrentTarget" ng-required/>

            <button class="btn" type="submit" >Save</button>
        </form>


text:
namespace node_tree_sitter {

using namespace v8;

Nan::Persistent<String> row_key;
Nan::Persistent<String> column_key;
Nan::Persistent<String> start_index_key;
Nan::Persistent<String> start_position_key;
Nan::Persistent<String> end_index_key;
Nan::Persistent<String> end_position_key;

static unsigned BYTES_PER_CHARACTER = 2;
static uint32_t *point_transfer_buffer;

void InitConversions(Local<Object> exports) {
  row_key.Reset(Nan::Persistent<String>(Nan::New("row").ToLocalChecked()));
  column_key.Reset(Nan::Persistent<String>(Nan::New("column").ToLocalChecked()));
  start_index_key.Reset(Nan::Persistent<String>(Nan::New("startIndex").ToLocalChecked()));
  start_position_key.Reset(Nan::Persistent<String>(Nan::New("startPosition").ToLocalChecked()));
  end_index_key.Reset(Nan::Persistent<String>(Nan::New("endIndex").ToLocalChecked()));
  end_position_key.Reset(Nan::Persistent<String>(Nan::New("endPosition").ToLocalChecked()));

  point_transfer_buffer = static_cast<uint32_t *>(malloc(2 * sizeof(uint32_t)));

  #if _MSC_VER && NODE_RUNTIME_ELECTRON && NODE_MODULE_VERSION >= 89
    // this is a terrible thing we have to do because of https://github.com/electron/electron/issues/29893
    v8::Local<v8::Object> bufferView;
    bufferView = node::Buffer::New(Isolate::GetCurrent(), point_transfer_buffer, 0, 2 * sizeof(uint32_t)).ToLocalChecked();
    auto js_point_transfer_buffer = node::Buffer::Data(bufferView);
  #elif V8_MAJOR_VERSION >= 8
    auto backing_store = ArrayBuffer::NewBackingStore(point_transfer_buffer, 2 * sizeof(uint32_t), BackingStore::EmptyDeleter, nullptr);
    auto js_point_transfer_buffer = ArrayBuffer::New(Isolate::GetCurrent(), std::move(backing_store));
  #else
    auto js_point_transfer_buffer = ArrayBuffer::New(Isolate::GetCurrent(), point_transfer_buffer, 2 * sizeof(uint32_t));
  #endif

  Nan::Set(exports, Nan::New("pointTransferArray").ToLocalChecked(), Uint32Array::New(js_point_transfer_buffer, 0, 2));
}

void TransferPoint(const TSPoint &point) {
  point_transfer_buffer[0] = point.row;
  point_transfer_buffer[1] = point.column / 2;
}

Local<Object> RangeToJS(const TSRange &range) {
  Local<Object> result = Nan::New<Object>();
  Nan::Set(result, Nan::New(start_position_key), PointToJS(range.start_point));
  Nan::Set(result, Nan::New(start_index_key), ByteCountToJS(range.start_byte));
  Nan::Set(result, Nan::New(end_position_key), PointToJS(range.end_point));
  Nan::Set(result, Nan::New(end_index_key), ByteCountToJS(range.end_byte));
  return result;
}

Nan::Maybe<TSRange> RangeFromJS(const Local<Value> &arg) {
  if (!arg->IsObject()) {
    Nan::ThrowTypeError("Range must be a {startPosition, endPosition, startIndex, endIndex} object");
    return Nan::Nothing<TSRange>();
  }

  TSRange result;

  Local<Object> js_range = Local<Object>::Cast(arg);

  #define INIT(field, key, Convert) { \
    auto value = Nan::Get(js_range, Nan::New(key)); \
    if (value.IsEmpty()) { \
      Nan::ThrowTypeError("Range must be a {startPosition, endPosition, startIndex, endIndex} object"); \
      return Nan::Nothing<TSRange>(); \
    } \
    auto field = Convert(value.ToLocalChecked()); \
    if (field.IsJust()) { \
      result.field = field.FromJust(); \
    } else { \
      return Nan::Nothing<TSRange>(); \
    } \
  }

  INIT(start_point, start_position_key, PointFromJS);
  INIT(end_point, end_position_key, PointFromJS);
  INIT(start_byte, start_index_key, ByteCountFromJS);
  INIT(end_byte, end_index_key, ByteCountFromJS);

  #undef INIT

  return Nan::Just(result);
}

Local<Object> PointToJS(const TSPoint &point) {
  Local<Object> result = Nan::New<Object>();
  Nan::Set(result, Nan::New(row_key), Nan::New<Number>(point.row));
  Nan::Set(result, Nan::New(column_key), ByteCountToJS(point.column));
  return result;
}

Nan::Maybe<TSPoint> PointFromJS(const Local<Value> &arg) {
  Local<Object> js_point;
  if (!arg->IsObject() || !Nan::To<Object>(arg).ToLocal(&js_point)) {
    Nan::ThrowTypeError("Point must be a {row, column} object");
    return Nan::Nothing<TSPoint>();
  }

  Local<Value> js_row;
  if (!Nan::Get(js_point, Nan::New(row_key)).ToLocal(&js_row)) {
    Nan::ThrowTypeError("Point must be a {row, column} object");
    return Nan::Nothing<TSPoint>();
  }

  Local<Value> js_column;
  if (!Nan::Get(js_point, Nan::New(column_key)).ToLocal(&js_column)) {
    Nan::ThrowTypeError("Point must be a {row, column} object");
    return Nan::Nothing<TSPoint>();
  }

  uint32_t row;
  if (!std::isfinite(Nan::To<double>(js_row).FromMaybe(0))) {
    row = UINT32_MAX;
  } else if (js_row->IsNumber()) {
    row = Nan::To<uint32_t>(js_row).FromJust();
  } else {
    Nan::ThrowTypeError("Point.row must be a number");
    return Nan::Nothing<TSPoint>();
  }

  uint32_t column;
  if (!std::isfinite(Nan::To<double>(js_column).FromMaybe(0))) {
    column = UINT32_MAX;
  } else if (js_column->IsNumber()) {
    column = Nan::To<uint32_t>(js_column).FromMaybe(0) * BYTES_PER_CHARACTER;
  } else {
    Nan::ThrowTypeError("Point.column must be a number");
    return Nan::Nothing<TSPoint>();
  }

  return Nan::Just<TSPoint>({row, column});
}

Local<Number> ByteCountToJS(uint32_t byte_count) {
  return Nan::New<Number>(byte_count / BYTES_PER_CHARACTER);
}

Nan::Maybe<uint32_t> ByteCountFromJS(const v8::Local<v8::Value> &arg) {
  auto result = Nan::To<uint32_t>(arg);
  if (!arg->IsNumber()) {
    Nan::ThrowTypeError("Character index must be a number");
    return Nan::Nothing<uint32_t>();
  }

  return Nan::Just<uint32_t>(result.FromJust() * BYTES_PER_CHARACTER);
}

}  // namespace node_tree_sitter


text:
<?php

require_once(PATH_BASE . 'model.class.php');

class RestaurantModel extends Model {

    public function getList() {
        $result = $this->db->select('SELECT * FROM ?_restaurants');
        return $result;
    }

    public function getItemUrl($urlname) {
        $result = $this->db->selectRow('SELECT * FROM ?_restaurants WHERE url = ?', $urlname);
        if(count($result) == 0)
            $result = null;
        else
            $result['analytics'] = json_decode ($result['analytics'], true);
        return $result;
    }

    public function getItemId($id) {
        $result = $this->db->selectRow('SELECT * FROM ?_restaurants WHERE id = ?', $id);
        if(isset($result['analytics']))
            $result['analytics'] = json_decode ($result['analytics'], true);
        return $result;
    }

    public function getCategories() {
        $result = $this->db->select('SELECT * FROM ?_restuarants_category');
        return $result;
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Cake.Common.Tests.Fixtures.Tools.DotNetCore.Test;
using Cake.Testing;
using Xunit;

namespace Cake.Common.Tests.Unit.Tools.DotNetCore.Test
{
    public sealed class DotNetCoreTesterTests
    {
        public sealed class TheTestMethod
        {
            [Fact]
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Project = "./src/*";
                fixture.Settings = null;
                fixture.GivenDefaultToolDoNotExist();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "settings");
            }

            [Fact]
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Project = "./src/*";
                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process was not started.");
            }

            [Fact]
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Project = "./src/*";
                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process returned an error (exit code 1).");
            }

            [Fact]
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("test", result.Args);
            }

            [Fact]
            public void Should_Add_Path()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Project = "./test/Project.Tests/*";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("test \"./test/Project.Tests/*\"", result.Args);
            }

            [Theory]
            [InlineData("./test/*", "test \"./test/*\"")]
            [InlineData("./test/cake unit tests/", "test \"./test/cake unit tests/\"")]
            [InlineData("./test/cake unit tests/cake core tests", "test \"./test/cake unit tests/cake core tests\"")]
            public void Should_Quote_Project_Path(string text, string expected)
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Project = text;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }

            [Fact]
            public void Should_Add_Additional_Settings()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Settings.NoBuild = true;
                fixture.Settings.Framework = "dnxcore50";
                fixture.Settings.Configuration = "Release";
                fixture.Settings.OutputDirectory = "./artifacts/";
                fixture.Settings.Settings = "./demo.runsettings";
                fixture.Settings.Filter = "Priority = 1";
                fixture.Settings.TestAdapterPath = @"/Working/custom-test-adapter";
                fixture.Settings.Logger = @"trx;LogFileName=/Working/logfile.trx";
                fixture.Settings.DiagnosticFile = "./artifacts/logging/diagnostics.txt";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("test --settings \"/Working/demo.runsettings\" --filter \"Priority = 1\" --test-adapter-path \"/Working/custom-test-adapter\" --logger \"trx;LogFileName=/Working/logfile.trx\" --output \"/Working/artifacts\" --framework dnxcore50 --configuration Release --diag \"/Working/artifacts/logging/diagnostics.txt\" --no-build", result.Args);
            }

            [Fact]
            public void Should_Add_Host_Arguments()
            {
                // Given
                var fixture = new DotNetCoreTesterFixture();
                fixture.Settings.DiagnosticOutput = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("--diagnostics test", result.Args);
            }
        }
    }
}


text:
package com.thoughtworks.go.server.valuestreammap;

import java.util.Arrays;

import com.thoughtworks.go.config.CaseInsensitiveString;
import com.thoughtworks.go.domain.MaterialRevision;
import com.thoughtworks.go.domain.valuestreammap.Node;
import com.thoughtworks.go.domain.valuestreammap.NodeLevelMap;
import com.thoughtworks.go.domain.valuestreammap.SCMDependencyNode;
import com.thoughtworks.go.domain.valuestreammap.ValueStreamMap;
import com.thoughtworks.go.domain.valuestreammap.PipelineDependencyNode;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.is;

public class CrossingMinimizationTest {

    private CrossingMinimization crossingMinimization;

    @Before
    public void setup(){
        crossingMinimization = new CrossingMinimization();
    }

    @Test
    public void shouldReorderNodesBasedOnBaryCenterValueForUpstreamGraph(){
        /*
            g1 --> P1--->P3
               \/      /
               /\    /
            g2    P2
         */

        CaseInsensitiveString p3 = new CaseInsensitiveString("P3");
        CaseInsensitiveString p1 = new CaseInsensitiveString("P1");
        CaseInsensitiveString p2 = new CaseInsensitiveString("P2");
        CaseInsensitiveString g1 = new CaseInsensitiveString("g1");
        CaseInsensitiveString g2 = new CaseInsensitiveString("g2");
        ValueStreamMap graph = new ValueStreamMap(p3, null);
        graph.addUpstreamNode(new PipelineDependencyNode(p1, p1.toString()), null, p3);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1.toString(), g1.toString(), "git"), null, p1, new MaterialRevision(null));
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g2.toString(), g2.toString(), "git"), null, p1, new MaterialRevision(null));
        graph.addUpstreamNode(new PipelineDependencyNode(p2, p2.toString()), null, p3);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1.toString(), g1.toString(), "git"), null, p2, new MaterialRevision(null));

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(graph.findNode(p1), graph.findNode(p2))));

        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.findNode(p3))));
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(graph.findNode(p2), graph.findNode(p1))));
        assertThat(levelToNodesMap.get(-2), is(Arrays.asList(graph.findNode(g1), graph.findNode(g2))));

        assertThat(graph.findNode(g1).getDepth(), is(1));
        assertThat(graph.findNode(g2).getDepth(), is(2));
        assertThat(graph.findNode(p1).getDepth(), is(2));
        assertThat(graph.findNode(p2).getDepth(), is(1));
        assertThat(graph.findNode(p3).getDepth(), is(1));
    }

    @Test
    public void shouldAssignNodesBasedOnMinimumDepthForUpstreamGraph(){
/*
            g1 --> P1 --> P
               \        / ^
                \     /   |
            g2   +->P2    |
               \          |
                \         |
            g3 --> P3-----+
         */

        CaseInsensitiveString p = new CaseInsensitiveString("P");
        CaseInsensitiveString p1 = new CaseInsensitiveString("P1");
        CaseInsensitiveString p2 = new CaseInsensitiveString("P2");
        CaseInsensitiveString p3 = new CaseInsensitiveString("P3");
        CaseInsensitiveString g1 = new CaseInsensitiveString("g1");
        CaseInsensitiveString g2 = new CaseInsensitiveString("g2");
        CaseInsensitiveString g3 = new CaseInsensitiveString("g3");
        ValueStreamMap graph = new ValueStreamMap(p, null);

        graph.addUpstreamNode(new PipelineDependencyNode(p1, p1.toString()), null, p);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1.toString(), g1.toString(), "git"), null, p1, new MaterialRevision(null));
        graph.addUpstreamNode(new PipelineDependencyNode(p2, p2.toString()), null, p);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1.toString(), g1.toString(), "git"), null, p2, new MaterialRevision(null));
        graph.addUpstreamNode(new PipelineDependencyNode(p3, p3.toString()), null, p);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g2.toString(), g2.toString(), "git"), null, p3, new MaterialRevision(null));
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g3.toString(), g3.toString(), "git"), null, p3, new MaterialRevision(null));

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.findNode(p))));
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(graph.findNode(p1), graph.findNode(p2), graph.findNode(p3))));
        assertThat(levelToNodesMap.get(-2), is(Arrays.asList(graph.findNode(g1), graph.findNode(g2), graph.findNode(g3))));

        assertThat(graph.findNode(g1).getDepth(), is(1));
        assertThat(graph.findNode(g2).getDepth(), is(2));
        assertThat(graph.findNode(g3).getDepth(), is(3));
        assertThat(graph.findNode(p1).getDepth(), is(1));
        assertThat(graph.findNode(p2).getDepth(), is(2));
        assertThat(graph.findNode(p3).getDepth(), is(3));
        assertThat(graph.findNode(p).getDepth(), is(1));
    }

    @Test
    public void shouldAssignNodesBasedOnMinimumDepthForDownstreamGraph(){
/*
            g1 --> P ---> P1  P3
                     \      /
                      +-> P2
         */

        CaseInsensitiveString p = new CaseInsensitiveString("P");
        CaseInsensitiveString g1Name = new CaseInsensitiveString("g1");
        CaseInsensitiveString p1Name = new CaseInsensitiveString("p1");
        CaseInsensitiveString p2Name = new CaseInsensitiveString("P2");
        CaseInsensitiveString p3Name = new CaseInsensitiveString("P3");
        ValueStreamMap graph = new ValueStreamMap(p, null);
        Node g1 = graph.addUpstreamMaterialNode(new SCMDependencyNode(g1Name.toString(), g1Name.toString(), "git"), null, p, new MaterialRevision(null));
        Node p1 = graph.addDownstreamNode(new PipelineDependencyNode(p1Name, p1Name.toString()), p);
        Node p2 = graph.addDownstreamNode(new PipelineDependencyNode(p2Name, p2Name.toString()), p);
        Node p3 = graph.addDownstreamNode(new PipelineDependencyNode(p3Name, p3Name.toString()), p2Name);

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(g1)));
        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.getCurrentPipeline())));
        assertThat(levelToNodesMap.get(1), is(Arrays.asList(p1, p2)));
        assertThat(levelToNodesMap.get(2), is(Arrays.asList(p3)));

        assertThat(p1.getDepth(), is(1));
        assertThat(p2.getDepth(), is(2));
        assertThat(p3.getDepth(), is(2));
    }

    @Test
    public void shouldNotReassignMinimumDepthIfOverallSlopeIncreases() {
        /*

             g1    g4---->  p
               \       /  /
                \    /  /
             g2--> p1 /
                    /
             g3--> p2

        */

        CaseInsensitiveString p = new CaseInsensitiveString("P");
        CaseInsensitiveString g4Name = new CaseInsensitiveString("g4");
        CaseInsensitiveString p1name = new CaseInsensitiveString("P1");
        CaseInsensitiveString g1name = new CaseInsensitiveString("g1");
        CaseInsensitiveString p2name = new CaseInsensitiveString("P2");
        CaseInsensitiveString g3name = new CaseInsensitiveString("g3");
        ValueStreamMap graph = new ValueStreamMap(p, null);
        Node g4 = graph.addUpstreamMaterialNode(new SCMDependencyNode(g4Name.toString(), g4Name.toString(), "git"), null, p, new MaterialRevision(null));
        Node p1 = graph.addUpstreamNode(new PipelineDependencyNode(p1name, p1name.toString()), null, p);
        Node g1 = graph.addUpstreamMaterialNode(new SCMDependencyNode(g1name.toString(), g1name.toString(), "git"), null, p1name, new MaterialRevision(null));
        Node g2 = graph.addUpstreamMaterialNode(new SCMDependencyNode("g2", "g2", "git"), null, p1name, new MaterialRevision(null));
        Node p2 = graph.addUpstreamNode(new PipelineDependencyNode(p2name, p2name.toString()), null, p);
        Node g3 = graph.addUpstreamMaterialNode(new SCMDependencyNode(g3name.toString(), g3name.toString(), "git"), null, p2name, new MaterialRevision(null));

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.getCurrentPipeline())));
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(g4, p1, p2)));
        assertThat(levelToNodesMap.get(-2), is(Arrays.asList(g1, g2, g3)));

        assertThat(graph.toString(), g1.getDepth(), is(1));
        assertThat(g2.getDepth(), is(2));
        assertThat(g3.getDepth(), is(3));
        assertThat(g4.getDepth(), is(1));
        assertThat(p1.getDepth(), is(2));
        assertThat(p2.getDepth(), is(3));
        assertThat(graph.getCurrentPipeline().getDepth(), is(1));
    }

    @Test
    public void shouldReorderBasedOnBarycenterForDownstreamGraph(){
/*
       g1 -->p ---->p1 -----> p4
             \ \            /
              \ \         /
               \ +->p2 -(---> p5
                \      /
                 \    /
                  >p3
         */

        String g1 = "g1";
        CaseInsensitiveString p = new CaseInsensitiveString("P");
        CaseInsensitiveString p1 = new CaseInsensitiveString("P1");
        CaseInsensitiveString p2 = new CaseInsensitiveString("P2");
        CaseInsensitiveString p3 = new CaseInsensitiveString("P3");
        CaseInsensitiveString p4 = new CaseInsensitiveString("P4");
        CaseInsensitiveString p5 = new CaseInsensitiveString("P5");
        ValueStreamMap graph = new ValueStreamMap(p, null);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1, g1, "git"), null, p, new MaterialRevision(null));
        graph.addDownstreamNode(new PipelineDependencyNode(p1, p1.toString()), p);
        graph.addDownstreamNode(new PipelineDependencyNode(p4, p4.toString()), p1);
        graph.addDownstreamNode(new PipelineDependencyNode(p2, p2.toString()), p);
        graph.addDownstreamNode(new PipelineDependencyNode(p5, p5.toString()), p2);
        graph.addDownstreamNode(new PipelineDependencyNode(p3, p3.toString()), p);
        graph.addDownstreamNode(new PipelineDependencyNode(p4, p4.toString()), p3);

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.findNode(p))));
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(graph.findNode(new CaseInsensitiveString(g1)))));
        assertThat(levelToNodesMap.get(1), is(Arrays.asList(graph.findNode(p1), graph.findNode(p3), graph.findNode(p2))));
        assertThat(levelToNodesMap.get(2), is(Arrays.asList(graph.findNode(p4), graph.findNode(p5))));

        assertThat(graph.findNode(new CaseInsensitiveString(g1)).getDepth(), is(1));
        assertThat(graph.findNode(p).getDepth(), is(1));
        assertThat(graph.findNode(p1).getDepth(), is(1));
        assertThat(graph.findNode(p2).getDepth(), is(3));
        assertThat(graph.findNode(p3).getDepth(), is(2));
        assertThat(graph.findNode(p4).getDepth(), is(1));
        assertThat(graph.findNode(p5).getDepth(), is(3));
    }

    @Test
    public void shouldReorderGraphsWithScmMaterialsOccurringInLevelsOtherThanTheFirst(){
/*
        g1   g3 ---> P
          \          ^
           \         |
        g2-->P1+-----+

         */

        String g1 = "g1";
        String g2 = "g2";
        String g3 = "g3";
        CaseInsensitiveString p1 = new CaseInsensitiveString("P1");
        CaseInsensitiveString p = new CaseInsensitiveString("P");

        ValueStreamMap graph = new ValueStreamMap(p, null);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g3, g3, "git"), null, p, new MaterialRevision(null));
        graph.addUpstreamNode(new PipelineDependencyNode(p1, p1.toString()), null, p);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1, g1, "git"), null, p1, new MaterialRevision(null));
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g2, g2, "git"), null, p1, new MaterialRevision(null));

        NodeLevelMap levelToNodesMap = nodeLevelMap(graph);
        crossingMinimization.apply(levelToNodesMap);

        assertThat(levelToNodesMap.get(0), is(Arrays.asList(graph.findNode(p))));
        assertThat(levelToNodesMap.get(-1), is(Arrays.asList(graph.findNode(new CaseInsensitiveString(g3)), graph.findNode(p1))));
        assertThat(levelToNodesMap.get(-2), is(Arrays.asList(graph.findNode(new CaseInsensitiveString(g1)), graph.findNode(new CaseInsensitiveString(g2)))));

        assertThat(graph.findNode(new CaseInsensitiveString(g1)).getDepth(), is(1));
        assertThat(graph.findNode(new CaseInsensitiveString(g2)).getDepth(), is(2));
        assertThat(graph.findNode(new CaseInsensitiveString(g3)).getDepth(), is(1));
        assertThat(graph.findNode(p1).getDepth(), is(2));
        assertThat(graph.findNode(p).getDepth(), is(1));
    }

    @Test
    public void shouldInitializeNodeDepthsInDfSOrder(){

        /*
        g2   p1 --> P --> p3   p6
          \ /    /          \/
          /\   /           / \
        g1  p2           p4   p5

         */
        String g1 = "g1";
        String g2 = "g2";
        CaseInsensitiveString p1 = new CaseInsensitiveString("p1");
        CaseInsensitiveString p2 = new CaseInsensitiveString("p2");
        CaseInsensitiveString p = new CaseInsensitiveString("p");
        CaseInsensitiveString p3 = new CaseInsensitiveString("p3");
        CaseInsensitiveString p4 = new CaseInsensitiveString("p4");
        CaseInsensitiveString p5 = new CaseInsensitiveString("p5");
        CaseInsensitiveString p6 = new CaseInsensitiveString("p6");

        ValueStreamMap graph = new ValueStreamMap(p, null);
        graph.addUpstreamNode(new PipelineDependencyNode(p1, p1.toString()), null, p);
        graph.addUpstreamNode(new PipelineDependencyNode(p2, p2.toString()), null, p);
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g2, g2, "git"), null, p2, new MaterialRevision(null));
        graph.addUpstreamMaterialNode(new SCMDependencyNode(g1, g1, "git"), null, p1, new MaterialRevision(null));

        graph.addDownstreamNode(new PipelineDependencyNode(p3, p3.toString()), p);
        graph.addDownstreamNode(new PipelineDependencyNode(p4, p4.toString()), p);
        graph.addDownstreamNode(new PipelineDependencyNode(p6, p6.toString()), p4);
        graph.addDownstreamNode(new PipelineDependencyNode(p5, p5.toString()), p3);

        crossingMinimization.initializeNodeDepths(nodeLevelMap(graph));

        assertThat(graph.findNode(new CaseInsensitiveString(g1)).getDepth(), is(1));
        assertThat(graph.findNode(new CaseInsensitiveString(g2)).getDepth(), is(2));
        assertThat(graph.findNode(p1).getDepth(), is(1));
        assertThat(graph.findNode(p2).getDepth(), is(2));

        assertThat(graph.findNode(p).getDepth(), is(1));

        assertThat(graph.findNode(p3).getDepth(), is(1));
        assertThat(graph.findNode(p4).getDepth(), is(2));
        assertThat(graph.findNode(p5).getDepth(), is(1));
        assertThat(graph.findNode(p6).getDepth(), is(2));
    }

    private NodeLevelMap nodeLevelMap(ValueStreamMap graph) {
        return new LevelAssignment().apply(graph);
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.smartdevicemanagement.v1.model;

/**
 * Request message for SmartDeviceManagementService.ExecuteDeviceCommand
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Smart Device Management API. For a detailed
 * explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest extends com.google.api.client.json.GenericJson {

  /**
   * The command name to execute, represented by the fully qualified protobuf message name.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String command;

  /**
   * The command message to execute, represented as a Struct.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Object> params;

  /**
   * The command name to execute, represented by the fully qualified protobuf message name.
   * @return value or {@code null} for none
   */
  public java.lang.String getCommand() {
    return command;
  }

  /**
   * The command name to execute, represented by the fully qualified protobuf message name.
   * @param command command or {@code null} for none
   */
  public GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest setCommand(java.lang.String command) {
    this.command = command;
    return this;
  }

  /**
   * The command message to execute, represented as a Struct.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Object> getParams() {
    return params;
  }

  /**
   * The command message to execute, represented as a Struct.
   * @param params params or {@code null} for none
   */
  public GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest setParams(java.util.Map<String, java.lang.Object> params) {
    this.params = params;
    return this;
  }

  @Override
  public GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest set(String fieldName, Object value) {
    return (GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest) super.set(fieldName, value);
  }

  @Override
  public GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest clone() {
    return (GoogleHomeEnterpriseSdmV1ExecuteDeviceCommandRequest) super.clone();
  }

}


text:
using namespace std;
using namespace GPULogger;

char OccupancyInfoEntry::m_cListSeparator = ';';

OccupancyInfoEntry::~OccupancyInfoEntry()
{
    SAFE_DELETE(m_pCLCUInfo);
}

std::string OccupancyInfoEntry::ToString()
{
    stringstream sout;

    SpAssertRet(m_pCLCUInfo != NULL) "";

    // print out the thread ID
    sout << left << m_tid << m_cListSeparator;

    // print out kernel name
    sout << left << m_strKernelName << m_cListSeparator;

    // print out the device name
    sout << left << m_strDeviceName << m_cListSeparator;

    size_t nCU = 0;
    size_t nMaxNumWavePerCU = 0;
    size_t nMaxVGPR = 0;
    size_t nMaxSGPR = 0;
    size_t nMaxLDS = 0;
    size_t nUsedVGPR = 0;
    size_t nUsedSGPR = 0;
    size_t nUsedLDS = 0;
    size_t nWaveSize = 0;
    size_t nFlattenedLocalSize = 0;
    size_t nFlattenedGlobalSize = 0;
    size_t nMaxGlobalSize = 0;
    size_t nActiveWaveLimitedByVGPR = 0;
    size_t nActiveWaveLimtiedBySGPR = 0;
    size_t nActiveWaveLimtiedByLDS = 0;
    size_t nActiveWaveLimtiedByWG = 0;
    float fOccupancy = 0;
    size_t nDeviceGfxIpVer = 0;
    size_t nSimdsPerCU = 0;

    m_pCLCUInfo->ReadCUParam(CU_PARAMS_KERNEL_OCCUPANCY, fOccupancy);

    // print out work group size (flattened)
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_KERNEL_WG_SIZE, nFlattenedLocalSize);
    size_t nWorkItemsInWG = nFlattenedLocalSize;

    if (fOccupancy < 0.0f)
    {
        nWorkItemsInWG = 0;
    }

    // print out the number of compute units
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_NBR_COMPUTE_UNITS, nCU);
    sout << left << nCU << m_cListSeparator;

    // print out the max. number of wavefronts per compute unit
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WAVEFRONT_PER_COMPUTE_UNIT, nMaxNumWavePerCU);
    sout << left << nMaxNumWavePerCU << m_cListSeparator;

    // print out the max. number of workgroup per compute unit
    sout << left << m_pCLCUInfo->GetMaxWorkgroupPerCU(nWorkItemsInWG) << m_cListSeparator;

    // print out the max number of vector GPR on a compute unit
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_VECTOR_GPRS_MAX, nMaxVGPR);
    sout << left << nMaxVGPR << m_cListSeparator;

    // print out the max number of scalar GPR on a compute unit
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_SCALAR_GPRS_MAX, nMaxSGPR);
    sout << left << nMaxSGPR << m_cListSeparator;

    // print the max amount of available LDS
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_LDS_MAX, nMaxLDS);
    sout << left << nMaxLDS << m_cListSeparator;

    // print the number of vector GPR used
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_VECTOR_GPRS_USED, nUsedVGPR);
    sout << left << nUsedVGPR << m_cListSeparator;

    // print the number of scalar GPR used
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_SCALAR_GPRS_USED, nUsedSGPR);
    sout << left << nUsedSGPR << m_cListSeparator;

    // print the amount of LDS used
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_LDS_USED, nUsedLDS);
    sout << left << nUsedLDS << m_cListSeparator;

    // print the wavefront size
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WAVEFRONT_SIZE, nWaveSize);
    sout << left << nWaveSize << m_cListSeparator;

    sout << left << nWorkItemsInWG << m_cListSeparator;

    //print out the number of wavefronts in work-group
    if (nWorkItemsInWG == 0)
    {
        sout << left << 0 << m_cListSeparator;
    }
    else
    {
        if (nWaveSize != 0)
        {
            sout << left << (unsigned int)ceil((double)nWorkItemsInWG / (double)nWaveSize) << m_cListSeparator;
        }
        else
        {
            sout << left << 0 << m_cListSeparator;
        }
    }

    // print out the max work-group size
    size_t nMaxWGSize = 0;
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WG_SIZE_MAX, nMaxWGSize);
    sout << left << nMaxWGSize << m_cListSeparator;

    //print out the max number of wavefronts in a work-group
    if (nWaveSize == 0)
    {
        sout << left << 0 << m_cListSeparator;
    }
    else
    {
        sout << left << (unsigned int)ceil((double)nMaxWGSize / (double)nWaveSize) << m_cListSeparator;
    }

    // print out the global work size
    sout << std::dec;
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_KERNEL_GLOBAL_SIZE, nFlattenedGlobalSize);

    if (fOccupancy < 0.0f)
    {
        nFlattenedGlobalSize = 0;
    }

    sout << left << nFlattenedGlobalSize << m_cListSeparator;

    // print the maximum global size
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_GLOBAL_SIZE_MAX, nMaxGlobalSize);
    sout << left << nMaxGlobalSize << m_cListSeparator;

    // print the number of vector GPR-limited waves
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WF_MAX_VECTOR_GPRS, nActiveWaveLimitedByVGPR);
    sout << left << nActiveWaveLimitedByVGPR << m_cListSeparator;

    // print the number of scalar GPR-limited waves
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WF_MAX_SCALAR_GPRS, nActiveWaveLimtiedBySGPR);
    sout << left << nActiveWaveLimtiedBySGPR << m_cListSeparator;

    // print the number of LDS-limited waves
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WF_MAX_LDS, nActiveWaveLimtiedByLDS);
    sout << left << nActiveWaveLimtiedByLDS << m_cListSeparator;

    // print the number of wavefronts limited by the work-group size (other factors not limiting
    // the number of wavefronts)
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_WF_MAX_WG, nActiveWaveLimtiedByWG);
    sout << left << nActiveWaveLimtiedByWG << m_cListSeparator;

    // print out the kernel occupancy
    sout << left << fOccupancy << m_cListSeparator;

    // print out the GFX IP version
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_DEVICE_GFXIP_VER, nDeviceGfxIpVer);
    sout << left << nDeviceGfxIpVer << m_cListSeparator;

    // print out the number of simds per CU
    m_pCLCUInfo->ReadCUParam(CU_PARAMS_SIMDS_PER_CU, nSimdsPerCU);
    sout << left << nSimdsPerCU << std::endl;

    return sout.str();
}

OccupancyInfoManager::OccupancyInfoManager() :
    TraceInfoManager(),
    m_bIsProfilingEnabled(true),
    m_bDelayStartEnabled(false),
    m_bProfilerDurationEnabled(false),
    m_delayInMilliseconds(0ul),
    m_durationInMilliseconds(0ul),
    m_pDelayTimer(nullptr),
    m_pDurationTimer(nullptr)
{
}

OccupancyInfoManager::~OccupancyInfoManager()
{
    if (nullptr != m_pDelayTimer)
    {
        m_pDelayTimer->stopTimer();
        delete m_pDelayTimer;
        m_pDelayTimer = nullptr;
    }

    if (nullptr != m_pDurationTimer)
    {
        m_pDurationTimer->stopTimer();
        delete m_pDurationTimer;
        m_pDurationTimer = nullptr;
    }
}

void OccupancyInfoManager::FlushTraceData(bool bForceFlush)
{
    SP_UNREFERENCED_PARAMETER(bForceFlush);
    m_mtxFlush.lock();
    osProcessId pid = osGetCurrentProcessId();
    TraceInfoMap& nonActiveMap = m_TraceInfoMap[ 1 - m_iActiveMap ];

    for (TraceInfoMap::iterator mapIt = nonActiveMap.begin(); mapIt != nonActiveMap.end(); ++mapIt)
    {
        osThreadId tid = mapIt->first;
        stringstream ss;
        string path;

        if (GlobalSettings::GetInstance()->m_params.m_strOutputFile.empty())
        {
            path = FileUtils::GetDefaultOutputPath();
        }
        else
        {
            path = FileUtils::GetTempFragFilePath();
        }

        // File name: pid_tid.TMP_OCCUPANCY_EXT

        ss << path << pid << "_" << tid << TMP_OCCUPANCY_EXT;
        string tmpTraceFile = ss.str();

        // Open file for append
        ofstream foutTrace(tmpTraceFile.c_str(), fstream::out | fstream::app);

        if (foutTrace.fail())
        {
            continue;
        }

        while (!mapIt->second.empty())
        {
            ITraceEntry* item = mapIt->second.front();
            foutTrace << item->ToString();
            mapIt->second.pop_front();

            delete item;
        }

        foutTrace.close();
    }

    m_mtxFlush.unlock();
}

void OccupancyInfoManager::SetOutputFile(const string& strFileName)
{
    std::string strExtension("");

    if (strFileName.empty())
    {
        m_strOutputFile = FileUtils::GetDefaultOutputPath() + FileUtils::GetExeName() + OCCUPANCY_EXT;
    }
    else
    {
        strExtension = FileUtils::GetFileExtension(strFileName);

        if (strExtension != OCCUPANCY_EXT)
        {
            if ((strExtension == TRACE_EXT) || (strExtension == PERF_COUNTER_EXT))
            {
                string strBaseFileName = FileUtils::GetBaseFileName(strFileName);
                m_strOutputFile = strBaseFileName + "." + OCCUPANCY_EXT;
            }
            else
            {
                m_strOutputFile = strFileName + "." + OCCUPANCY_EXT;
            }
        }
        else
        {
            m_strOutputFile = strFileName;
        }
    }

    if (FileUtils::FileExist(m_strOutputFile))
    {
        cout << "Specified output file " << m_strOutputFile << " already exists. It will be overwritten.\n";
        remove(m_strOutputFile.c_str());
    }

}

void OccupancyInfoManager::SaveToOccupancyFile()
{
    TraceInfoMap& activeMap = m_TraceInfoMap[ 0 ];

    if (!activeMap.empty())
    {
        ofstream fout(m_strOutputFile.c_str());

        if (fout.fail())
        {
            Log(logWARNING, "Failed to open file: %s.\n", m_strOutputFile.c_str());
            cout << "Failed to generate " OCCUPANCY_EXT " file: " << m_strOutputFile << ". Make sure you have permission to write to the path you specified." << endl;
            return;
        }

        // Count the kernels in the map
        size_t kernelCount = 0u;

        for (TraceInfoMap::iterator mapIt = activeMap.begin(); mapIt != activeMap.end(); ++mapIt)
        {
            kernelCount += mapIt->second.size();
        }

        CLOccupancyHdr header;
        header.m_strAppArgs = GlobalSettings::GetInstance()->m_params.m_strCmdArgs;
        header.m_strAppName = FileUtils::GetExeFullPathAsUnicode();
        header.m_listSeparator = GlobalSettings::GetInstance()->m_params.m_cOutputSeparator;
        WriteOccupancyHeader(fout, header, kernelCount, m_cListSeparator);
        fout << endl;

        for (TraceInfoMap::iterator mapIt = activeMap.begin(); mapIt != activeMap.end(); ++mapIt)
        {
            for (list<ITraceEntry*>::iterator listIt = mapIt->second.begin(); listIt != mapIt->second.end(); ++listIt)
            {
                ITraceEntry* en = *listIt;
                fout << en->ToString().c_str();
            }
        }
    }
}

void CLOccupancyAgentTimerEndResponse(ProfilerTimerType timerType)
{
    switch (timerType)
    {
        case PROFILEDELAYTIMER:
            OccupancyInfoManager::Instance()->ResumeTracing();
            OccupancyInfoManager::Instance()->EnableProfiling(true);
            unsigned long profilerDuration;

            if (OccupancyInfoManager::Instance()->IsProfilerDurationEnabled(profilerDuration))
            {
                OccupancyInfoManager::Instance()->CreateTimer(PROFILEDURATIONTIMER, profilerDuration);
                OccupancyInfoManager::Instance()->SetTimerFinishHandler(PROFILEDURATIONTIMER, CLOccupancyAgentTimerEndResponse);
                OccupancyInfoManager::Instance()->startTimer(PROFILEDURATIONTIMER);
            }

            break;

        case PROFILEDURATIONTIMER:
            OccupancyInfoManager::Instance()->StopTracing();
            OccupancyInfoManager::Instance()->EnableProfiling(false);
            break;

        default:
            break;
    }
}

bool OccupancyInfoManager::IsProfilerDelayEnabled(unsigned long& delayInMilliseconds)
{
    delayInMilliseconds = m_delayInMilliseconds;
    return m_bDelayStartEnabled;
}

bool OccupancyInfoManager::IsProfilerDurationEnabled(unsigned long& durationInMilliseconds)
{
    durationInMilliseconds = m_durationInMilliseconds;
    return m_bProfilerDurationEnabled;
}

void OccupancyInfoManager::SetTimerFinishHandler(ProfilerTimerType timerType, TimerEndHandler timerEndHandler)
{
    switch (timerType)
    {
        case PROFILEDELAYTIMER:
            if (nullptr != m_pDelayTimer)
            {
                m_pDelayTimer->SetTimerFinishHandler(timerEndHandler);
            }

            break;

        case PROFILEDURATIONTIMER:
            if (nullptr != m_pDurationTimer)
            {
                m_pDurationTimer->SetTimerFinishHandler(timerEndHandler);
            }

            break;

        default:
            break;
    }
}

void OccupancyInfoManager::EnableProfileDelayStart(bool doEnable, unsigned long delayInSeconds)
{
    m_bDelayStartEnabled = doEnable;
    m_delayInMilliseconds = doEnable ? delayInSeconds : 0;
}

void OccupancyInfoManager::EnableProfileDuration(bool doEnable, unsigned long durationInMilliseconds)
{
    m_bProfilerDurationEnabled = doEnable;
    m_durationInMilliseconds = doEnable ? durationInMilliseconds : 0;
}

void OccupancyInfoManager::CreateTimer(ProfilerTimerType timerType, unsigned long timeIntervalInMilliseconds)
{
    switch (timerType)
    {
        case PROFILEDELAYTIMER:
            if (nullptr == m_pDelayTimer && timeIntervalInMilliseconds > 0)
            {
                m_pDelayTimer = new(std::nothrow) ProfilerTimer(timeIntervalInMilliseconds);

                if (nullptr == m_pDelayTimer)
                {
                    Log(logERROR, "CreateTimer: unable to allocate memory for delay timer\n");
                }
                else
                {
                    m_pDelayTimer->SetTimerType(PROFILEDELAYTIMER);
                    m_bDelayStartEnabled = true;
                    m_delayInMilliseconds = timeIntervalInMilliseconds;
                }
            }

            break;

        case PROFILEDURATIONTIMER:
            if (nullptr == m_pDurationTimer && timeIntervalInMilliseconds > 0)
            {
                m_pDurationTimer = new(std::nothrow) ProfilerTimer(timeIntervalInMilliseconds);

                if (nullptr == m_pDurationTimer)
                {
                    Log(logERROR, "CreateTimer: unable to allocate memory for duration timer\n");
                }
                else
                {
                    m_pDurationTimer->SetTimerType(PROFILEDURATIONTIMER);
                    m_bProfilerDurationEnabled = true;
                    m_durationInMilliseconds = timeIntervalInMilliseconds;
                }
            }

            break;

        default:
            break;
    }
}

void OccupancyInfoManager::startTimer(ProfilerTimerType timerType)
{
    switch (timerType)
    {
        case PROFILEDELAYTIMER:
            if (nullptr != m_pDelayTimer)
            {
                m_pDelayTimer->startTimer(true);
            }

            break;

        case PROFILEDURATIONTIMER:
            if (nullptr != m_pDurationTimer)
            {
                m_pDurationTimer->startTimer(true);
            }

            break;

        default:
            break;
    }
}


text:
module ImageHelper

  def list_photos(resource, options={})
    photo_version   = options[:photo_version] || :gallery_thumb
    is_sortable     = options.has_key?(:is_sortable) ? options[:is_sortable] : true
    sortable_class  = is_sortable ? 'is-sortable' : ''

    content_tag(:div, class: "lol-multiple-uploads images-container #{sortable_class}", 'data-resource' => 'photo', 'data-has-caption' => resource.class.caption_status, 'data-has-caption-localized' => resource.class.caption_localized_status) do
      render partial: '/layouts/lol_multiple_uploads/photo', collection: resource.photos.prioritized, locals: {photo_version: photo_version}
    end
  end

end


text:
require_relative '../../spec_helper'
require_relative 'fixtures/classes'

describe "Singleton#clone" do
  it "is prevented" do
    lambda { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError)
  end
end


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Frontend\CorresponsaliaBundle\Entity\Tecnologia\EntityRepository;

use Doctrine\ORM\EntityRepository;
/**
 * Description of AsignacionRepository
 *
 * @author ecastro
 */
class AsignacionRepository extends EntityRepository{

    public function actualizarAsignacion($equipo_id, $fechaRetorno){
        $consulta = $this->getEntityManager()->createQuery('update CorresponsaliaBundle:Tecnologia\Asignacion a set a.fechaRetorno= :fecha WHERE a.id = :equipo_id');
        $consulta->setParameter('equipo_id', $equipo_id);
        $consulta->setParameter('fecha', $fechaRetorno);
        $consulta->execute();
        return $consulta;
    }

}


text:
import Day from './Day';
import DaysOfWeek from './DaysOfWeek';
import Entry from './Entry';
import Month from './Month';
import Week from './Week';

export default {
  Day: Day,
  DaysOfWeek: DaysOfWeek,
  Entry: Entry,
  Month: Month,
  Week: Week
};


text:
package org.apache.camel.component.olingo2;

import java.io.IOException;
import java.lang.reflect.Method;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The embedded server for hosting the olingo2 sample service during the tests
 */
public final class Olingo2TestUtil {
    private static final Logger LOG = LoggerFactory.getLogger(Olingo2TestUtil.class);

    private Olingo2TestUtil() {

    }

    static void generateSampleData(String serviceUrl) throws IOException {
        try {
            // need to use reflection to avoid a build error even when the
            // sample source is not available
            Class<?> clz = Class.forName("org.apache.olingo.sample.annotation.util.AnnotationSampleDataGenerator");
            Method m = clz.getMethod("generateData", String.class);
            m.invoke(null, serviceUrl);
        } catch (Throwable t) {
            LOG.error("Unable to load the required sample class", t);
            throw new IOException("unable to load the required sample class", t);
        }
    }
}


text:
package com.buscape.developer.http;

/**
 * The methods that can be used in API calls.
 *
 * @author cartagena
 */
enum URLRequestMethod {

  /**
   * Http DELETE method
   */
  DELETE,
  /**
   * Http GET method
   */
  GET,
  /**
   * Http POST method
   */
  POST;

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="250dp"
    android:layout_height="match_parent"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:background="@color/white">

    <LinearLayout
        android:id="@+id/list_dialog_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_marginLeft="20dp"
            android:id="@+id/list_dialog_title"
            android:layout_width="wrap_content"
            android:layout_height="65dp"
            android:layout_gravity="left"
            android:gravity="center"
            android:text="提示"
            android:textColor="#58aa48"
            android:textSize="26sp"
            android:textStyle="normal" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:background="@color/gray" />

        <ListView
            android:id="@+id/list_dialog_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="#c8c8c8"
            android:dividerHeight="1px" />

    </LinearLayout>

</LinearLayout>


text:
from unittest import TestCase

from mock import patch
import uuid

from container_transform.ecs import ECSTransformer

class ECSTransformerTests(TestCase):
    """
    Tests for ECS Transformer
    """

    def setUp(self):
        self.file_name = './container_transform/tests/task.json'
        self.transformer = ECSTransformer(self.file_name)

    @patch.object(uuid, 'uuid4', return_value='2e9c3538-b9d3-4f47-8a23-2a19315b370b')
    def test_validate(self, mock_uuid):
        """
        Test .validate()
        """
        container = {
            'image': 'postgres:9.3',
            'cpu': 200,
            'memory': 40
        }

        validated = self.transformer.validate(container)
        self.assertEqual(
            validated['name'],
            mock_uuid.return_value
        )
        self.assertTrue(validated['essential'])

    def test_ingest_cpu(self):
        cpu = 100
        self.assertEqual(
            self.transformer.ingest_cpu(cpu),
            cpu
        )

    def test_emit_cpu(self):
        cpu = 100
        self.assertEqual(
            self.transformer.emit_cpu(cpu),
            cpu
        )


text:
<?php
namespace Application\Domain\Shared\Calculator\Contracts;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
interface Calculator
{

    public static function supported();

    public function compare($a, $b);

    public function multiply($amount, $multiplier);

    public function add($amount, $addend);

    public function subtract($amount, $subtrahend);

    public function divide($amount, $divisor);

}


text:
{% extends "shared/layout.html" %}
{% block page_title %} {{ _('Unauthorized') }} {% endblock %}
{% block header %}{{ _('Error 401') }}{% endblock %}

{% block content %}

{{ _('You are not authorized to see this page. Please') }}
        {{ _('log in') }} .

{% endblock %}


text:
const assert = require('assert');
const environment = require('../../fixtures/cli/environment');
const adminHelper = require('../../common/admin-helper')();
const namespace = 'express-gateway:apps:activate';
const idGen = require('uuid-base62');

describe('eg apps activate', () => {
  let program, env, user, app1, app2;
  before(() => {
    ({ program, env } = environment.bootstrap());
    return adminHelper.start();
  });
  after(() => adminHelper.stop());

  beforeEach(() => {
    env.prepareHijack();
    return adminHelper.admin.users.create({
      username: idGen.v4(),
      firstname: 'La',
      lastname: 'Deeda'
    })
    .then(createdUser => {
      user = createdUser;

      return adminHelper.admin.apps.create(user.id, {
        name: 'appy1',
        redirectUri: 'http://localhost:3000/cb'
      });
    })
    .then(createdApp => {
      app1 = createdApp;
      return adminHelper.admin.apps.create(user.id, {
        name: 'appy2',
        redirectUri: 'http://localhost:3000/cb'
      });
    })
    .then(createdApp => {
      app2 = createdApp;
      return adminHelper.admin.apps.create(user.id, {
        name: 'appy2',
        redirectUri: 'http://localhost:3000/cb'
      });
    })
    .then(() => adminHelper.admin.apps.deactivate(app1.id))
    .then(() => adminHelper.admin.apps.deactivate(app2.id));
  });

  afterEach(() => {
    env.resetHijack();
    return adminHelper.reset();
  });

  it('activates an app', done => {
    env.hijack(namespace, generator => {
      let output = null;

      generator.once('run', () => {
        generator.log.error = message => {
          done(new Error(message));
        };
        generator.log.ok = message => {
          output = message;
        };
      });

      generator.once('end', () => {
        return adminHelper.admin.apps.info(app1.id)
          .then(app => {
            assert.equal(app.isActive, true);
            assert.equal(output, 'Activated ' + app1.id);
            done();
          }).catch(done);
      });
    });

    env.argv = program.parse(`apps activate ${app1.id}`);
  });

  it('activates multiple apps', done => {
    env.hijack(namespace, generator => {
      const output = {};

      generator.once('run', () => {
        generator.log.error = message => {
          done(new Error(message));
        };
        generator.log.ok = message => {
          output[message] = true;
        };
      });

      generator.once('end', () => {
        return adminHelper.admin.apps.list()
          .then(data => {
            const apps = data.apps;
            assert.equal(apps[0].isActive, true);
            assert.equal(apps[1].isActive, true);

            assert.ok(output['Activated ' + app1.id]);
            assert.ok(output['Activated ' + app2.id]);
            assert.equal(Object.keys(output).length, 2);
            done();
          });
      });
    });
    env.argv = program.parse(`apps activate ${app1.id} ${app2.id}`);
  });

  it('prints only the app id when using the --quiet flag', done => {
    env.hijack(namespace, generator => {
      let output = null;

      generator.once('run', () => {
        generator.log.error = message => {
          done(new Error(message));
        };
        generator.stdout = message => {
          output = message;
        };
      });

      generator.once('end', () => {
        return adminHelper.admin.apps.info(app1.id)
          .then(app => {
            assert.equal(app.isActive, true);
            assert.equal(output, app1.id);
            done();
          });
      });
    });

    env.argv = program.parse(`apps activate ${app1.id} -q`);
  });
});


text:
class texture
{
public:
    static const texture *Load(const std::string &Path);

    explicit texture(u32 Width, u32 Height, const void *const Data);
    texture(const texture &Other);
    ~texture();

    GLuint Handle() const;
    u32 Width() const;
    u32 Height() const;
    float Aspect() const;

private:
    GLuint mHandle;
    u32 mWidth;
    u32 mHeight;

    void mSetupTexture(const void *const Data);
};

#endif // __TEXTURE_H__


text:
#if !defined(BOOST_SPIRIT_X3_CALC8_ANNOTATION_HPP)
#define BOOST_SPIRIT_X3_CALC8_ANNOTATION_HPP

#include <map>
#include "ast.hpp"
#include <boost/spirit/home/x3/support/utility/lambda_visitor.hpp>

namespace client
{
    // tag used to get our error handler from the context
    struct error_handler_tag;
}

namespace client { namespace parser
{
    struct annotation_base
    {
        ////////////////////////////////////////////////////////////////////////
        //  The on_success handler links the AST to a vector of iterator
        //  positions for the purpose of subsequent semantic error handling
        //  when the program is being compiled. See x3::position_cache in
        //  x3/support/ast
        ////////////////////////////////////////////////////////////////////////

        template <typename Iterator, typename Context>
        inline void
        on_success(Iterator const& first, Iterator const& last
          , ast::operand& ast, Context const& context)
        {
            auto& error_handler = x3::get<error_handler_tag>(context).get();
            auto annotate = [&](auto& node)
            {
                error_handler.tag(node, first, last);
            };
            ast.apply_visitor(x3::make_lambda_visitor<void>(annotate));
        }

        template <typename T, typename Iterator, typename Context>
        inline void
        on_success(Iterator const& first, Iterator const& last
          , T& ast, Context const& context)
        {
            auto& error_handler = x3::get<error_handler_tag>(context).get();
            error_handler.tag(ast, first, last);
        }
    };
}}

#endif


text:
package org.keysupport.shibboleth.idp.x509;

import java.io.IOException;
import java.security.cert.X509Certificate;
import java.util.Arrays;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.security.auth.Subject;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.ExternalAuthentication;
import net.shibboleth.idp.authn.ExternalAuthenticationException;
import net.shibboleth.idp.profile.interceptor.ProfileInterceptorFlowDescriptor;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;

import org.opensaml.security.SecurityException;
import org.opensaml.security.trust.TrustEngine;
import org.opensaml.security.x509.BasicX509Credential;
import org.opensaml.security.x509.X509Credential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * Servlet compatible with the {@link ExternalAuthentication} interface that
 * extracts and validates an X.509 client certificate for user authentication.
 */
public class X509AuthServlet extends HttpServlet {

	/** Serial UUID. */
	private static final long serialVersionUID = 7466474175700654990L;

	/** Init parameter identifying optional {@link TrustEngine} bean name. */
	@Nonnull
	@NotEmpty
	private static final String TRUST_ENGINE_PARAM = "trustEngine";

	/** Parameter/cookie for bypassing prompt page. */
	@Nonnull
	@NotEmpty
	private static final String PASSTHROUGH_PARAM = "x509passthrough";

	/** Class logger. */
	@Nonnull
	private final Logger log = LoggerFactory.getLogger(X509AuthServlet.class);

	/** Trust engine. */
	@Nullable
	private TrustEngine<? super X509Credential> trustEngine;

	/**
	 * Set the {@link TrustEngine} to use.
	 *
	 * @param tm
	 *            trust engine to use
	 */
	public void setTrustEngine(
			@Nullable final TrustEngine<? super X509Credential> tm) {
		trustEngine = tm;
	}

	/** {@inheritDoc} */
	@Override
	public void init(final ServletConfig config) throws ServletException {
		super.init(config);

		final WebApplicationContext springContext = WebApplicationContextUtils
				.getRequiredWebApplicationContext(getServletContext());

		final String param = config.getInitParameter(TRUST_ENGINE_PARAM);
		if (param != null) {
			log.debug("Looking up TrustEngine bean: {}", param);
			final Object bean = springContext.getBean(param);
			if (bean instanceof TrustEngine) {
				trustEngine = (TrustEngine) bean;
			} else {
				throw new ServletException("Bean " + param
						+ " was missing, or not a TrustManager");
			}
		}
	}

	// Checkstyle: CyclomaticComplexity OFF
	/** {@inheritDoc} */
	@Override
	protected void service(final HttpServletRequest httpRequest,
			final HttpServletResponse httpResponse) throws ServletException,
			IOException {

		try {
			final String key = ExternalAuthentication
					.startExternalAuthentication(httpRequest);

			final X509Certificate[] certs = (X509Certificate[]) httpRequest
					.getAttribute("javax.servlet.request.X509Certificate");
			log.debug("{} X.509 Certificate(s) found in request",
					certs != null ? certs.length : 0);

			if (certs == null || certs.length < 1) {
				log.error("No X.509 Certificates found in request");
				httpRequest.setAttribute(
						ExternalAuthentication.AUTHENTICATION_ERROR_KEY,
						AuthnEventIds.NO_CREDENTIALS);
				ExternalAuthentication.finishExternalAuthentication(key,
						httpRequest, httpResponse);
				return;
			}

			final X509Certificate cert = certs[0];
			log.debug(
					"End-entity X.509 certificate found with subject '{}', issued by '{}'",
					cert.getSubjectDN().getName(), cert.getIssuerDN().getName());

			if (trustEngine != null) {
				try {
					final BasicX509Credential cred = new BasicX509Credential(
							cert);
					cred.setEntityCertificateChain(Arrays.asList(certs));
					if (trustEngine.validate(cred, new CriteriaSet())) {
						log.debug("Trust engine validated X.509 certificate");
					} else {
						log.warn("Trust engine failed to validate X.509 certificate");
						httpRequest
								.setAttribute(
										ExternalAuthentication.AUTHENTICATION_ERROR_KEY,
										AuthnEventIds.INVALID_CREDENTIALS);
						ExternalAuthentication.finishExternalAuthentication(
								key, httpRequest, httpResponse);
						return;
					}
				} catch (final SecurityException e) {
					log.error("Exception raised by trust engine", e);
					httpRequest
							.setAttribute(
									ExternalAuthentication.AUTHENTICATION_EXCEPTION_KEY,
									e);
					ExternalAuthentication.finishExternalAuthentication(key,
							httpRequest, httpResponse);
					return;
				}
			}

			final String passthrough = httpRequest
					.getParameter(PASSTHROUGH_PARAM);
			if (passthrough != null && Boolean.parseBoolean(passthrough)) {
				log.debug("Setting UI passthrough cookie");
				final Cookie cookie = new Cookie(PASSTHROUGH_PARAM, "1");
				cookie.setPath(httpRequest.getContextPath());
				cookie.setMaxAge(60 * 60 * 24 * 365);
				cookie.setSecure(true);
				httpResponse.addCookie(cookie);
			}

			final Subject subject = new Subject();
			subject.getPublicCredentials().add(cert);
			subject.getPrincipals().add(cert.getSubjectX500Principal());

			httpRequest.setAttribute(ExternalAuthentication.SUBJECT_KEY,
					subject);

//			final String revokeConsent = httpRequest
//					.getParameter(ProfileInterceptorFlowDescriptor.REVOKE_CONSENT_PARAM);
//			if (revokeConsent != null
//					&& ("1".equals(revokeConsent) || "true"
//							.equals(revokeConsent))) {
//				httpRequest.setAttribute(
//						ExternalAuthentication.REVOKECONSENT_KEY, Boolean.TRUE);
//			}

			ExternalAuthentication.finishExternalAuthentication(key,
					httpRequest, httpResponse);

		} catch (final ExternalAuthenticationException e) {
			throw new ServletException(
					"Error processing external authentication request", e);
		}
	}
	// Checkstyle: CyclomaticComplexity ON

}


text:
OseoServer
==========

.. automodule:: oseoserver.server
   :members:
   :show-inheritance:
   :undoc-members:


text:
```bash
# Install SDK
brew install pebble/pebble-sdk/pebble-sdk

# Configure
pebble login
pebble package login

# Packages don't seem to work for Rocky.js?
pebble package install ui
pebble package install vector2
```

```bash
# Install on phone: https://developer.pebble.com/guides/tools-and-resources/pebble-tool/
pebble build; pebble install --phone 192.168.0.104 --logs

# Run emulator each time for Pebble 2
pebble build; pebble install --emulator diorite --logs
# Then launch config
pebble emu-app-config --emulator diorite
```

## Other

Try the Clay interface for setting configuration settings from my phone: https://developer.pebble.com/guides/user-interfaces/app-configuration/

Demos: https://github.com/pebble-examples


text:
package com.sung.hee.filter;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

//com.sung.hee.filter.AccessLoggerFilter
public class AccessLoggerFilter implements Filter {

    private Logger logger = LoggerFactory.getLogger(AccessLoggerFilter.class);

    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;

        //String ssoUser = request.getHeader("SSO_USER");

        String remoteAddr = StringUtils.defaultString(request.getRemoteAddr(), "-");
        String uri = StringUtils.defaultIfEmpty(request.getRequestURI(), "");

        String url = (request.getRequestURL() == null) ? "" : request.getRequestURL().toString();

        String queryString = StringUtils.defaultIfEmpty(request.getQueryString(), "");
        String referer = StringUtils.defaultString(request.getHeader("Referer"), "-");

        String agent = StringUtils.defaultString(request.getHeader("User-Agent"), "-");

        String fullUrl = url;
        fullUrl += StringUtils.isNotEmpty(queryString) ? "?" + queryString : queryString;

        StringBuilder result = new StringBuilder();
        result
                //.append(" Tomcat SSO User : " + ssoUser)
                .append(" : ")
                .append(remoteAddr)
                .append(" :")
                .append(fullUrl)
                .append(" :")
                .append(referer)
                .append(":")
                .append(agent);

        logger.info("[LOG FILTER] " + result.toString());

        chain.doFilter(req, res);
    }

    public void init(FilterConfig fileterConfig) throws ServletException {
    }

    public void destroy() {
    }

}


text:
<?php

namespace Magento\Eav\Model\ResourceModel\Entity\Attribute\Option;

/**
 * Entity attribute option collection
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * Option value table
     *
     * @var string
     */
    protected $_optionValueTable;

    /**
     * @var \Magento\Framework\App\ResourceConnection
     */
    protected $_coreResource;

    /**
     * @var \Magento\Store\Model\StoreManagerInterface
     */
    protected $_storeManager;

    /**
     * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
     * @param \Psr\Log\LoggerInterface $logger
     * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
     * @param \Magento\Framework\Event\ManagerInterface $eventManager
     * @param \Magento\Framework\App\ResourceConnection $coreResource
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     * @param mixed $connection
     * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
     * @codeCoverageIgnore
     */
    public function __construct(
        \Magento\Framework\Data\Collection\EntityFactory $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\App\ResourceConnection $coreResource,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
    ) {
        $this->_storeManager = $storeManager;
        $this->_coreResource = $coreResource;
        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
    }

    /**
     * Resource initialization
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init(
            'Magento\Eav\Model\Entity\Attribute\Option',
            'Magento\Eav\Model\ResourceModel\Entity\Attribute\Option'
        );
        $this->_optionValueTable = $this->_coreResource->getTableName('eav_attribute_option_value');
    }

    /**
     * Set attribute filter
     *
     * @param int $setId
     * @return $this
     * @codeCoverageIgnore
     */
    public function setAttributeFilter($setId)
    {
        return $this->addFieldToFilter('attribute_id', $setId);
    }

    /**
     * Add store filter to collection
     *
     * @param int $storeId
     * @param bool $useDefaultValue
     * @return $this
     */
    public function setStoreFilter($storeId = null, $useDefaultValue = true)
    {
        if ($storeId === null) {
            $storeId = $this->_storeManager->getStore()->getId();
        }
        $connection = $this->getConnection();

        $joinCondition = $connection->quoteInto('tsv.option_id = main_table.option_id AND tsv.store_id = ?', $storeId);

        if ($useDefaultValue) {
            $this->getSelect()->join(
                ['tdv' => $this->_optionValueTable],
                'tdv.option_id = main_table.option_id',
                ['default_value' => 'value']
            )->joinLeft(
                ['tsv' => $this->_optionValueTable],
                $joinCondition,
                [
                    'store_default_value' => 'value',
                    'value' => $connection->getCheckSql('tsv.value_id > 0', 'tsv.value', 'tdv.value')
                ]
            )->where(
                'tdv.store_id = ?',
                0
            );
        } else {
            $this->getSelect()->joinLeft(
                ['tsv' => $this->_optionValueTable],
                $joinCondition,
                'value'
            )->where(
                'tsv.store_id = ?',
                $storeId
            );
        }

        $this->setOrder('value', self::SORT_ORDER_ASC);

        return $this;
    }

    /**
     * Add option id(s) filter to collection
     *
     * @param int|array $optionId
     * @return $this
     * @codeCoverageIgnore
     */
    public function setIdFilter($optionId)
    {
        return $this->addFieldToFilter('main_table.option_id', ['in' => $optionId]);
    }

    /**
     * Convert collection items to select options array
     *
     * @param string $valueKey
     * @return array
     */
    public function toOptionArray($valueKey = 'value')
    {
        return $this->_toOptionArray('option_id', $valueKey);
    }

    /**
     * Set order by position or alphabetically by values in admin
     *
     * @param string $dir direction
     * @param bool $sortAlpha sort alphabetically by values in admin
     * @return $this
     */
    public function setPositionOrder($dir = self::SORT_ORDER_ASC, $sortAlpha = false)
    {
        $this->setOrder('main_table.sort_order', $dir);
        // sort alphabetically by values in admin
        if ($sortAlpha) {
            $this->getSelect()->joinLeft(
                ['sort_alpha_value' => $this->_optionValueTable],
                'sort_alpha_value.option_id = main_table.option_id AND sort_alpha_value.store_id = 0',
                ['value']
            );
            $this->setOrder('sort_alpha_value.value', $dir);
        }

        return $this;
    }
}


text:
.. _require_apache_module:

:mod:`fabtools.require.apache`
------------------------------

.. automodule:: fabtools.require.apache
    :members:

    .. seealso:: :ref:`apache_module`


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../ncollide_procedural/struct.TriMesh.html">

Redirecting to ../../ncollide_procedural/struct.TriMesh.html...


text:
FROM alpine:3.2
MAINTAINER Picturae <contact@picturae.com>

RUN mkdir -p /opt/geoserver/data_dir && chmod 777 /opt/geoserver/data_dir

RUN echo "File on the geoserver-data volume" > /opt/geoserver/data_dir/Readme.txt

VOLUME /opt/geoserver/data_dir


text:
#ifdef USE_TI_UIIPHONEPROGRESSBARSTYLE

#import "TiProxy.h"

@interface TiUIiPhoneProgressBarStyleProxy : TiProxy {

}

@property(nonatomic,readonly) NSNumber *DEFAULT;
@property(nonatomic,readonly) NSNumber *PLAIN;
@property(nonatomic,readonly) NSNumber *BAR;

@end

#endif


text:
package com.viewer.model;

public class GetImageUrlsResponse extends OperationStatusResponse
{
    public String[] imageUrls =  new String[0];

    public String[] getImageUrls(){
    	return imageUrls;
    }
    public void setImageUrls(String[] imageUrls){
    	this.imageUrls = imageUrls;
    }
}


text:
#ifndef ITEMWEAPONSUBTYPE_H
#define ITEMWEAPONSUBTYPE_H

#include <QObject>
#include "itemsubtype.h"

class ItemWeaponSubtype : public ItemSubtype {
    Q_OBJECT
public:
    ItemWeaponSubtype(DFInstance *df, VIRTADDR address, QObject *parent = 0);
    virtual ~ItemWeaponSubtype();

    QString group_name() const {return m_group_name;}

    int single_grasp() {return m_single_grasp_size;}
    int multi_grasp() {return  m_multi_grasp_size;}
    int melee_skill() {return m_melee_skill_id;}
    int ranged_skill() {return m_ranged_skill_id;}

private:
    QString m_group_name;
    int m_single_grasp_size;
    int m_multi_grasp_size;
    QString m_ammo;
    int m_melee_skill_id;
    int m_ranged_skill_id;

    void read_data();
};

#endif // ITEMWEAPONSUBTYPE_H