text:
#region License
// The MIT License (MIT)
//
// Copyright (c) 2016 SimplePersistence
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace SimplePersistence.UoW.EFCore
{
    using System;
    using System.Linq.Expressions;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.EntityFrameworkCore;

    public partial class EFCoreAsyncQueryable<T>
    {
        #region Implementation of IAsyncQueryable<T>

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<decimal> SumAsync(Expression<Func<T, decimal>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<decimal?> SumAsync(Expression<Func<T, decimal?>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<int> SumAsync(Expression<Func<T, int>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<int?> SumAsync(Expression<Func<T, int?>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<long> SumAsync(Expression<Func<T, long>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<long?> SumAsync(Expression<Func<T, long?>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<double> SumAsync(Expression<Func<T, double>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<double?> SumAsync(Expression<Func<T, double?>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<float> SumAsync(Expression<Func<T, float>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        /// <summary>
        ///     Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on
        ///     each element of the input sequence.
        /// </summary>
        /// <param name="selector"> A projection function to apply to each element. </param>
        /// <param name="ct">
        ///     A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the sum of the projected values..
        /// </returns>
        public async Task<float?> SumAsync(Expression<Func<T, float?>> selector, CancellationToken ct = new CancellationToken())
        {
            return await _queryable.SumAsync(selector, ct);
        }

        #endregion
    }
}


text:
template struct custom::Array<T>;             \
template struct custom::RefT<T>;              \
template struct custom::Asset_RefT<T>;        \

#include "engine/registry_impl/asset_types.h"

namespace custom {

#define ASSET_IMPL(T)                                                               \
static REF_VOID_FUNC(ref_pool_create_##T) { return RefT<T>::pool.create(); }        \
static VOID_REF_FUNC(ref_pool_destroy_##T) { RefT<T>::pool.destroy(ref); }          \
static BOOL_REF_FUNC(ref_pool_contains_##T) { return RefT<T>::pool.contains(ref); } \

#include "engine/registry_impl/asset_types.h"

}

#include "loading.cpp.inl"
// namespace custom {
// namespace loading {
//
// #define ASSET_IMPL(T)                \
// LOADING_FUNC(asset_pool_load_##T);   \
// LOADING_FUNC(asset_pool_unload_##T); \
// LOADING_FUNC(asset_pool_update_##T); \
//
// #include "engine/registry_impl/asset_types.h"
//
// }}

void init_asset_types(void) {
	#define ASSET_IMPL(T)                                              \
	custom::Asset_Registry<T>::type = custom::asset_names.get_count(); \
	custom::asset_names.store_string(#T, custom::empty_index);         \

	#include "engine/registry_impl/asset_types.h"

	custom::Asset::vtable.create.set_capacity(custom::asset_names.get_count());
	custom::Asset::vtable.destroy.set_capacity(custom::asset_names.get_count());
	custom::Asset::vtable.contains.set_capacity(custom::asset_names.get_count());
	custom::Asset::vtable.load.set_capacity(custom::asset_names.get_count());
	custom::Asset::vtable.unload.set_capacity(custom::asset_names.get_count());
	custom::Asset::vtable.update.set_capacity(custom::asset_names.get_count());

	#define ASSET_IMPL(T)                                                       \
	custom::Asset::vtable.create.push(&custom::ref_pool_create_##T);            \
	custom::Asset::vtable.destroy.push(&custom::ref_pool_destroy_##T);          \
	custom::Asset::vtable.contains.push(&custom::ref_pool_contains_##T);        \
	custom::Asset::vtable.load.push(&custom::loading::asset_pool_load_##T);     \
	custom::Asset::vtable.unload.push(&custom::loading::asset_pool_unload_##T); \
	custom::Asset::vtable.update.push(&custom::loading::asset_pool_update_##T); \

	#include "engine/registry_impl/asset_types.h"
}

redpajama_set_name: RedPajamaGithub


text:
xhrGet("SimpleServlet", function(responseText){
	// add to document
	var mytitle = document.getElementById('message');
	mytitle.innerHTML = responseText;

}, function(err){
	console.log(err);
});

//utilities
function createXHR(){
	if(typeof XMLHttpRequest != 'undefined'){
		return new XMLHttpRequest();
	}else{
		try{
			return new ActiveXObject('Msxml2.XMLHTTP');
		}catch(e){
			try{
				return new ActiveXObject('Microsoft.XMLHTTP');
			}catch(e){}
		}
	}
	return null;
}
function xhrGet(url, callback, errback){
	var xhr = new createXHR();
	xhr.open("GET", url, true);
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4){
			if(xhr.status == 200){
				callback(xhr.responseText);
			}else{
				errback('service not available');
			}
		}
	};
	xhr.timeout = 3000;
	xhr.ontimeout = errback;
	xhr.send();
}
function parseJson(str){
	return window.JSON ? JSON.parse(str) : eval('(' + str + ')');
}
function prettyJson(str){
	// If browser does not have JSON utilities, just print the raw string value.
	return window.JSON ? JSON.stringify(JSON.parse(str), null, '  ') : str;
}


text:
#include <aws/redshift/model/DataShareStatus.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace Redshift
  {
    namespace Model
    {
      namespace DataShareStatusMapper
      {

        static const int ACTIVE_HASH = HashingUtils::HashString("ACTIVE");
        static const int PENDING_AUTHORIZATION_HASH = HashingUtils::HashString("PENDING_AUTHORIZATION");
        static const int AUTHORIZED_HASH = HashingUtils::HashString("AUTHORIZED");
        static const int DEAUTHORIZED_HASH = HashingUtils::HashString("DEAUTHORIZED");
        static const int REJECTED_HASH = HashingUtils::HashString("REJECTED");
        static const int AVAILABLE_HASH = HashingUtils::HashString("AVAILABLE");

        DataShareStatus GetDataShareStatusForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == ACTIVE_HASH)
          {
            return DataShareStatus::ACTIVE;
          }
          else if (hashCode == PENDING_AUTHORIZATION_HASH)
          {
            return DataShareStatus::PENDING_AUTHORIZATION;
          }
          else if (hashCode == AUTHORIZED_HASH)
          {
            return DataShareStatus::AUTHORIZED;
          }
          else if (hashCode == DEAUTHORIZED_HASH)
          {
            return DataShareStatus::DEAUTHORIZED;
          }
          else if (hashCode == REJECTED_HASH)
          {
            return DataShareStatus::REJECTED;
          }
          else if (hashCode == AVAILABLE_HASH)
          {
            return DataShareStatus::AVAILABLE;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<DataShareStatus>(hashCode);
          }

          return DataShareStatus::NOT_SET;
        }

        Aws::String GetNameForDataShareStatus(DataShareStatus enumValue)
        {
          switch(enumValue)
          {
          case DataShareStatus::ACTIVE:
            return "ACTIVE";
          case DataShareStatus::PENDING_AUTHORIZATION:
            return "PENDING_AUTHORIZATION";
          case DataShareStatus::AUTHORIZED:
            return "AUTHORIZED";
          case DataShareStatus::DEAUTHORIZED:
            return "DEAUTHORIZED";
          case DataShareStatus::REJECTED:
            return "REJECTED";
          case DataShareStatus::AVAILABLE:
            return "AVAILABLE";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return {};
          }
        }

      } // namespace DataShareStatusMapper
    } // namespace Model
  } // namespace Redshift
} // namespace Aws


text:
package io.opentracing.contrib.jaxrs2.serialization;

import io.opentracing.Span;
import javax.ws.rs.ext.InterceptorContext;

public interface InterceptorSpanDecorator {

    /**
     * Decorate spans by outgoing object.
     *
     * @param context
     * @param span
     */
    void decorateRead(InterceptorContext context, Span span);

    /**
     * Decorate spans by outgoing object.
     *
     * @param context
     * @param span
     */
    void decorateWrite(InterceptorContext context, Span span);

    /**
     * Adds tags: \"media.type\", \"entity.type\"
     */
    InterceptorSpanDecorator STANDARD_TAGS = new InterceptorSpanDecorator() {
        @Override
        public void decorateRead(InterceptorContext context, Span span) {
            span.setTag("media.type", context.getMediaType().toString());
            span.setTag("entity.type", context.getType().getName());
        }

        @Override
        public void decorateWrite(InterceptorContext context, Span span) {
            decorateRead(context, span);
        }
    };
}


text:
Are you sure you want to delete this record?

{{key | translate}}

{{value | translate}}

  <button class="btn btn-default" ng-click="cancel()">
    Cancel
  </button>
  <button class="btn btn-danger" ng-click="delete()">

    Delete
  </button>


text:
require 'spec_helper'
require 'support/features/credentials'
include Credentials

feature 'inst admin user' do

	scenario 'institutional administrator visibility' do #, :js => true do

		logs_in_with "#{INST_ADMIN_USERNAME}", "#{INST_ADMIN_PASSWORD}", "#{INST_ADMIN_INSTITUTION_NAME}"

		expect(page).to have_link('My Dashboard')
		expect(page).to have_link('DMP Templates')
		expect(page).to have_link('Institution Profile')
		expect(page).to have_link('My Profile')

		expect(page).to have_no_link('DMP Administration')

	end

end


text:
/* First created by JCasGen Mon May 11 11:00:52 EDT 2015 */
package org.apache.ctakes.typesystem.type.util;

import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;

import org.apache.uima.jcas.cas.FSArray;
import org.apache.uima.jcas.cas.TOP;

/** A brute force "hash" that stores multiple Pairs in a list.
Equivalent to cTAKES: edu.mayo.bmi.uima.core.type.Properties
 * Updated by JCasGen Mon May 11 11:00:52 EDT 2015
 * XML source: /home/tseytlin/Work/DeepPhe/ctakes-cancer/src/main/resources/org/apache/ctakes/cancer/types/TypeSystem.xml
 * @generated */
public class Pairs extends TOP {
  /** @generated
   * @ordered
   */
  @SuppressWarnings ("hiding")
  public final static int typeIndexID = JCasRegistry.register(Pairs.class);
  /** @generated
   * @ordered
   */
  @SuppressWarnings ("hiding")
  public final static int type = typeIndexID;
  /** @generated
   * @return index of the type
   */
  @Override
  public              int getTypeIndexID() {return typeIndexID;}

  /** Never called.  Disable default constructor
   * @generated */
  protected Pairs() {/* intentionally empty block */}

  /** Internal - constructor used by generator
   * @generated
   * @param addr low level Feature Structure reference
   * @param type the type of this Feature Structure
   */
  public Pairs(int addr, TOP_Type type) {
    super(addr, type);
    readObject();
  }

  /** @generated
   * @param jcas JCas to which this Feature Structure belongs
   */
  public Pairs(JCas jcas) {
    super(jcas);
    readObject();
  }

  /**
   * <!-- begin-user-doc -->
   * Write your own initialization here
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  private void readObject() {/*default - does nothing empty block */}

  //*--------------*
  //* Feature: pairs

  /** getter for pairs - gets
   * @generated
   * @return value of the feature
   */
  public FSArray getPairs() {
    if (Pairs_Type.featOkTst && ((Pairs_Type)jcasType).casFeat_pairs == null)
      jcasType.jcas.throwFeatMissing("pairs", "org.apache.ctakes.typesystem.type.util.Pairs");
    return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs)));}

  /** setter for pairs - sets
   * @generated
   * @param v value to set into the feature
   */
  public void setPairs(FSArray v) {
    if (Pairs_Type.featOkTst && ((Pairs_Type)jcasType).casFeat_pairs == null)
      jcasType.jcas.throwFeatMissing("pairs", "org.apache.ctakes.typesystem.type.util.Pairs");
    jcasType.ll_cas.ll_setRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs, jcasType.ll_cas.ll_getFSRef(v));}

  /** indexed getter for pairs - gets an indexed value -
   * @generated
   * @param i index in the array to get
   * @return value of the element at index i
   */
  public Pair getPairs(int i) {
    if (Pairs_Type.featOkTst && ((Pairs_Type)jcasType).casFeat_pairs == null)
      jcasType.jcas.throwFeatMissing("pairs", "org.apache.ctakes.typesystem.type.util.Pairs");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs), i);
    return (Pair)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs), i)));}

  /** indexed setter for pairs - sets an indexed value -
   * @generated
   * @param i index in the array to set
   * @param v value to set into the array
   */
  public void setPairs(int i, Pair v) {
    if (Pairs_Type.featOkTst && ((Pairs_Type)jcasType).casFeat_pairs == null)
      jcasType.jcas.throwFeatMissing("pairs", "org.apache.ctakes.typesystem.type.util.Pairs");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs), i);
    jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Pairs_Type)jcasType).casFeatCode_pairs), i, jcasType.ll_cas.ll_getFSRef(v));}
  }


text:
package javax.swing.plaf;

import java.awt.event.MouseEvent;

import javax.swing.JPopupMenu;
import javax.swing.Popup;
import javax.swing.PopupFactory;

/**
 * An abstract base class for delegates that implement the pluggable
 * look and feel for a JPopupMenu.
 *
 * @see javax.swing.JPopupMenu
 *
 * @author Andrew Selkirk (aselkirk@sympatico.ca)
 * @author Sascha Brawer (brawer@dandelis.ch)
 */
public abstract class PopupMenuUI extends ComponentUI
{
  /**
   * Constructs a new PopupMenuUI.
   */
  public PopupMenuUI()
  {
    // Nothing to do here.
  }

  /**
   * Tests whether or not a mouse event triggers a popup menu.
   *
   *
The default implementation calls
   * event.isPopupTrigger(), which checks for the gesture
   * that is common for the platform on which the application runs. If
   * a look and feel wants to employ non-standard conventions for
   * triggering a popup menu, it can override this method.
   *
   * @param event the event to check.
   *
   * @return true if the event triggers a popup menu;
   *         false otherwise.
   *
   * @since 1.3
   */
  public boolean isPopupTrigger(MouseEvent event)
  {
    return event.isPopupTrigger();
  }

  /**
   * Creates a Popup for displaying the popup menu.  The
   * default implementation uses the {@link javax.swing.PopupFactory}
   * for retrieving a suitable Popup, but subclasses
   * might want to override this method if a LookAndFeel needs special
   * Popups.
   *
   * @param popup the JPopupMenu for whose display
   *        a Popup is needed.
   *
   * @param x the horizontal position where the popup will be
   *        displayed.
   *
   * @param y the vertical position where the popup will be
   *        displayed.
   *
   * @return a Popup for showing and hiding
   *         the menu.
   *
   * @since 1.4
   */
  public Popup getPopup(JPopupMenu popup, int x, int y)
  {
    return PopupFactory.getSharedInstance().getPopup(
      /* origin/owner of the popup */ popup.getInvoker(),
      /* contents */                  popup,
      x, y);
  }
}


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/inviwo-module-opengl_pch"
  "cotire/inviwo-module-opengl_CXX_prefix.hxx.gch"
  "cotire/inviwo-module-opengl_CXX_prefix.hxx"
  "cotire/inviwo-module-opengl_CXX_prefix.cxx"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang)
  INCLUDE(CMakeFiles/inviwo-module-opengl_pch.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)


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

#include "boost/python.hpp"

#include "GafferUI/Frame.h"

#include "GafferUIBindings/FrameBinding.h"
#include "GafferUIBindings/GadgetBinding.h"

using namespace boost::python;
using namespace GafferUIBindings;
using namespace GafferUI;

void GafferUIBindings::bindFrame()
{
	// disabled because it clashes with the qt python frame
	/*GadgetClass<Frame>()
		.def( init<GadgetPtr>() )
	;*/
}


text:
<?php

namespace Ivory\GoogleMap\Service\Elevation\Request;

use Ivory\GoogleMap\Service\Base\Location\LocationInterface;

/**
 * @author GeLo <geloen.eric@gmail.com>
 */
class PathElevationRequest implements ElevationRequestInterface
{
    /**
     * @var LocationInterface[]
     */
    private $paths = [];

    /**
     * @var int
     */
    private $samples;

    /**
     * @param LocationInterface[] $paths
     * @param int                 $samples
     */
    public function __construct(array $paths, $samples = 3)
    {
        $this->setPaths($paths);
        $this->setSamples($samples);
    }

    /**
     * @return bool
     */
    public function hasPaths()
    {
        return !empty($this->paths);
    }

    /**
     * @return LocationInterface[]
     */
    public function getPaths()
    {
        return $this->paths;
    }

    /**
     * @param LocationInterface[] $paths
     */
    public function setPaths(array $paths)
    {
        $this->paths = [];
        $this->addPaths($paths);
    }

    /**
     * @param LocationInterface[] $paths
     */
    public function addPaths(array $paths)
    {
        foreach ($paths as $path) {
            $this->addPath($path);
        }
    }

    /**
     * @param LocationInterface $path
     *
     * @return bool
     */
    public function hasPath(LocationInterface $path)
    {
        return in_array($path, $this->paths, true);
    }

    /**
     * @param LocationInterface $path
     */
    public function addPath(LocationInterface $path)
    {
        if (!$this->hasPath($path)) {
            $this->paths[] = $path;
        }
    }

    /**
     * @param LocationInterface $path
     */
    public function removePath(LocationInterface $path)
    {
        unset($this->paths[array_search($path, $this->paths, true)]);
        $this->paths = array_values($this->paths);
    }

    /**
     * @return int
     */
    public function getSamples()
    {
        return $this->samples;
    }

    /**
     * @param int $samples
     */
    public function setSamples($samples)
    {
        $this->samples = $samples;
    }

    /**
     * {@inheritdoc}
     */
    public function build()
    {
        return [
            'path' => implode('|', array_map(function (LocationInterface $path) {
                return $path->build();
            }, $this->paths)),
            'samples' => $this->samples,
        ];
    }
}


text:
<?php

/**
 * Template used to show a list created with createlist
 *
 * @param string $list_id
 */
function template_show_list($list_id = null)
{
	global $context, $settings;

	// Get a shortcut to the current list.
	$list_id = $list_id === null ? $context['default_list'] : $list_id;
	$cur_list = &$context[$list_id];

	if (isset($cur_list['form']))
		echo '
	<form class="generic_list_wrapper" action="', $cur_list['form']['href'], '" method="post"', empty($cur_list['form']['name']) ? '' : ' name="' . $cur_list['form']['name'] . '" id="' . $cur_list['form']['name'] . '"', ' accept-charset="UTF-8">

';
	else
		echo '

';

	// Show the title of the table (if any), with an icon (if defined)
	if (!empty($cur_list['title']))
		echo '

', $cur_list['title'], '
';

	// Show any data right after the title
	if (isset($cur_list['additional_rows']['after_title']))
	{
		echo '

';

		template_additional_rows('after_title', $cur_list);

		echo '

';
	}

	// Show some data above this list
	if (isset($cur_list['additional_rows']['top_of_list']))
		template_additional_rows('top_of_list', $cur_list);

	$close_div = false;
	if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['above_column_headers']))
	{
		$close_div = true;
		echo '

';

		// Show the page index (if this list doesn't intend to show all items). @todo - Needs old top/bottom stuff cleaned up.
		if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index']))
			echo '

',
			template_pagesection(false, false, array('page_index_markup' => $cur_list['page_index'])), '

';

		if (isset($cur_list['additional_rows']['above_column_headers']))
			template_additional_rows('above_column_headers', $cur_list);
	}

	// These are the main tabs that is used all around the template.
	if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top'))
	{
		if (!$close_div)
			echo '

';

		$close_div = true;

		template_create_list_menu($cur_list['list_menu']);
	}

	if ($close_div)
		echo '

';

	// Start of the main table
	echo '

';

	// Show the column headers.
	$header_count = count($cur_list['headers']);
	if (!($header_count < 2 && empty($cur_list['headers'][0]['label'])))
	{
		echo '

';

		// Loop through each column and add a table header.
		$i = 0;
		foreach ($cur_list['headers'] as $col_header)
		{
			$i++;
			if ($i === 1)
				$col_header['class'] = empty($col_header['class']) ? '' : $col_header['class'];
			elseif ($i === $header_count)
				$col_header['class'] = empty($col_header['class']) ? '' : $col_header['class'];

			echo '
					', empty($col_header['href']) ? '' : '', empty($col_header['label']) ? ' ' : $col_header['label'], empty($col_header['href']) ? '' : (empty($col_header['sort_image']) ? '' : ' '), '	';
		}

		echo '

';
	}

	echo '

';

	// Show a nice message informing there are no items in this list.
	// @todo - Nasty having styles and aligns still in the markup (IE6 stuffz).
	// @todo - Should be done via the class.
	if (empty($cur_list['rows']) && !empty($cur_list['no_items_label']))
		echo '

', $cur_list['no_items_label'], '

';
	// Show the list rows.
	elseif (!empty($cur_list['rows']))
	{
		$alternate = false;
		foreach ($cur_list['rows'] as $id => $row)
		{
			echo '

';

			foreach ($row['data'] as $row_data)
				echo '
					', $row_data['value'], '	';

			echo '

';

			$alternate = !$alternate;
		}
	}

	echo '

';

	echo '

';

	// Do we have multiple pages to show or data to show below the table
	if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['below_table_data']))
	{
		// Show the page index (if this list doesn't intend to show all items).
		if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index']))
			echo '

',
			template_pagesection(false, false, array('page_index_markup' => $cur_list['page_index'])), '

';

		if (isset($cur_list['additional_rows']['below_table_data']))
			template_additional_rows('below_table_data', $cur_list);
	}

	// Tabs at the bottom.  Usually bottom aligned.
	if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom'))
		template_create_list_menu($cur_list['list_menu']);

	echo '

';

	// Last chance to show more data, like buttons and links
	if (isset($cur_list['additional_rows']['bottom_of_list']))
		template_additional_rows('bottom_of_list', $cur_list);

	if (isset($cur_list['form']))
	{
		foreach ($cur_list['form']['hidden_fields'] as $name => $value)
			echo '
			<input type="hidden" name="', $name, '" value="', $value, '" />';

		echo '

	</form>';
	}
	else
		echo '

';
}

/**
 * Generic template used to show additional rows of data (above/below)
 *
 * @param int $row_position
 * @param array $cur_list
 */
function template_additional_rows($row_position, $cur_list)
{
	foreach ($cur_list['additional_rows'][$row_position] as $row)
		echo '

', $row['value'], '
';
}

/**
 * Used this if you want your generic lists to have navigation menus.
 *
 * $cur_list['list_menu'] = array(
 *    // The position of the tabs/buttons.  Left or Right.  By default is set to left.
 *    'position' => 'left',
 *    // Links.  This is the core of the array.  It has all the info that we need.
 *    'links' => array(
 *      'name' => array(
 *        // This will tell use were to go when they click it.
 *        'href' => $scripturl . '?action=theaction',
 *        // The name that you want to appear for the link.
 *        'label' => $txt['name'],
 *        // If we use tabs instead of buttons we highlight the current tab.
 *        // Must use conditions to determine if its selected or not.
 *        'is_selected' => isset($_REQUEST['name']),
 *      ),
 *    ),
 * );
 *
 * @param array $list_menu
 */
function template_create_list_menu($list_menu)
{
	global $settings;

	echo '

';

	$items = count($list_menu['links']);
	$count = 0;

	foreach ($list_menu['links'] as $link)
	{
		$count++;
		if (!empty($link['href']))
			echo '
				', $link['is_selected'] ? ' ' : '';

		echo $link['label'], !empty($link['href']) ? '' : '', $items !== $count ? ' | ' : '';
	}

	echo '

';
}


text:
module Fog
  module Compute
    class Vsphere
      class Real
        def vm_reconfig_cdrom(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          # Attach iso / disattach
          if options.has_key?('iso')
            raise ArgumentError, "datastore is a required parameter" unless options.key? 'datastore'
            backing = RbVmomi::VIM::VirtualCdromIsoBackingInfo(
              fileName: "[#{options['datastore']}] #{options['iso']}"
            )
          else
            backing = RbVmomi::VIM::VirtualCdromRemoteAtapiBackingInfo(deviceName: '')
          end
          cdrom_obj = get_vm_ref(options['instance_uuid']).config.hardware.device.grep(RbVmomi::VIM::VirtualCdrom).first
          hardware_spec = {
            deviceChange: [{
              operation: :edit,
              device: RbVmomi::VIM::VirtualCdrom(
                backing: backing,
                key: cdrom_obj.key,
                controllerKey: cdrom_obj.controllerKey,
                connectable: RbVmomi::VIM::VirtualDeviceConnectInfo(
                  startConnected: options['start_connected'] || false,
                  connected: options['connected'] || false,
                  allowGuestControl: options['allow_guest_control'] || true,
                )
              )
            }]
          }
          vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
        end
      end

      class Mock
        def vm_reconfig_cdrom(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          if options.has_key?('iso')
            raise ArgumentError, "datastore is a required parameter" unless options.key? 'datastore'
            backing = {
              fileName: "[#{options['datastore']}] #{options['iso']}"
            }
          else
            backing = {deviceName: ''}
          end
          cdrom_obj = list_vm_cdroms(options['instance_uuid']).first
          hardware_spec = {
            deviceChange: [{
              operation: :edit,
              device: {
                backing: backing,
                key: cdrom_obj['key'],
                controllerKey: cdrom_obj['controllerKey'],
                connectable: {
                  startConnected: options['start_connected'] || false,
                  connected: options['connected'] || false,
                  allowGuestControl: options['allow_guest_control'] || true,
                }
              }
            }]
          }
          vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
        end
      end
    end
  end
end


text:
//----------------------------------*-C++-*----------------------------------//
/**
 *  @file   BoundaryMOC.hh
 *  @brief  BoundaryMOC class definition
 *  @author Jeremy Roberts
 *  @date   Jun 25, 2012
 */
//---------------------------------------------------------------------------//

#ifndef detran_BOUNDARYMOC_HH_
#define detran_BOUNDARYMOC_HH_

#include "boundary/BoundaryBase.hh"
#include "boundary/BoundaryConditionMOC.hh"
#include "geometry/Mesh.hh"
#include "angle/ProductQuadrature.hh"

namespace detran
{

/**
 *  @class BoundaryMOC
 *  @brief Boundary flux container for MOC problems.
 *
 *  The method of characteristics solves the transport equation
 *  by sweeping along fixed tracks crossing the domain.  Tracks
 *  begin and end at a global boundary.  This class stores the
 *  angular flux for each track.
 */

template <class D>
class BoundaryMOC : public BoundaryBase<D>
{

public:

  //-------------------------------------------------------------------------//
  // TYPEDEFS
  //-------------------------------------------------------------------------//

  typedef BoundaryBase<D>                       Base;
  typedef typename Base::SP_boundary            SP_base;
  typedef detran_utilities::SP<BoundaryMOC<D> > SP_boundary;
  typedef typename Base::SP_input               SP_input;
  typedef detran_geometry::Mesh                 Mesh;
  typedef Mesh::SP_mesh                         SP_mesh;
  typedef detran_angle::ProductQuadrature       QuadratureMOC;
  typedef detran_utilities::SP<QuadratureMOC>   SP_quadrature;
  typedef BoundaryConditionMOC<D>               BC_T;
  typedef typename BC_T::SP_bc                  SP_bc;
  typedef detran_utilities::size_t              size_t;
  typedef detran_utilities::vec_int             vec_int;
  typedef detran_utilities::vec2_int            vec2_int;
  typedef detran_utilities::vec3_int            vec3_int;
  typedef detran_utilities::vec2_dbl            vec2_dbl;
  typedef detran_utilities::vec3_dbl            vec3_dbl;
  typedef std::vector<vec3_dbl>                 bf_type;
  typedef D                                     D_T;

  using Base::IN;
  using Base::OUT;

  //-------------------------------------------------------------------------//
  // CONSTRUCTORS & DESTRUCTORS
  //-------------------------------------------------------------------------//

  /**
   *  @brief Constructor.
   *  @param    input       User input database.
   *  @param    mesh        Cartesian mesh.
   *  @param    quadrature  Angular quadrature.
   */
  BoundaryMOC(SP_input        input,
              SP_mesh         mesh,
              SP_quadrature   quadrature);

  /// SP Constructor.
  static SP_base
  Create(SP_input       input,
         SP_mesh        mesh,
         SP_quadrature  quadrature);

  //-------------------------------------------------------------------------//
  // ABSTRACT INTERFACE -- ALL BOUNDARY TYPES MUST IMPLEMENT THESE
  //-------------------------------------------------------------------------//

  /// Set the boundaries for a within-group solve.
  void set(const size_t g);

  /// Update the boundaries for each sweep.
  void update(const size_t g);

  /// brief Update the boundaries for a single angle.
  void update(const size_t g, const size_t o, const size_t a);

  /// Clear the boundary container for a group.
  void clear(const size_t g);

  /// Set the entire group boundary flux for reflecting sides.
  void psi(const size_t g, double *v, const int inout, const int gs,
           bool onlyref = true)
  {
    THROW("IMPLEMENT ME");
  }

  //-------------------------------------------------------------------------//
  // BOUNDARY FLUX ACCESS
  //-------------------------------------------------------------------------//

  /**
   *  @brief Const access to a boundary flux using cardinal indices.
   *
   *  This (and the mutable version) interface is for use
   *  in sweeping, where octants and angles are cycled.
   *
   *  @param    g     Energy group.
   *  @param    o     Octant index.
   *  @param    a     Angle index (within octant).
   *  @param    t     Track index for angle.
   *  @return         Constant reference to boundary flux.
   */
  const double&
  operator()(const size_t g, const size_t o, const size_t a,
             const size_t inout, const size_t t) const;

  /// Mutable access to boundary flux using cardinal indices.
  double&
  operator()(const size_t g, const size_t o, const size_t a,
             const size_t inout, const size_t t);

  /**
   *  @brief Assign the octant, angle, and track fed by an octant,
   *         angle, and track
   *
   *  To make the boundary condition as independent as
   *  possible, BoundaryMOC knows what to do with the
   *  cardinal angle within an octant (i.e. with polar implicit)
   *
   *  @param o1   Incident octant
   *  @param a1   Incident angle within octant
   *  @param t1   Incident track
   *  @param o2   Outgoing octant
   *  @param a2   Outgoing angle within octant
   *  @param t2   Outgoing track
   */
  void feed_into(const size_t o1, const size_t a1, const size_t t1,
                 size_t &o2, size_t &a2, size_t &t2);

  /**
   *  @brief Assign the octant, angle, and track feeding an octant,
   *         angle, and track
   *  @param o1   Outgoing octant
   *  @param a1   Outgoing angle within octant
   *  @param t1   Outgoing track
   *  @param o2   Incident octant
   *  @param a2   Incident angle within octant
   *  @param t2   Incident track
   */
  void feed_from(const size_t o1, const size_t a1, const size_t t1,
                 size_t &o2, size_t &a2, size_t &t2);

  /// Return vector of octant, azimuth, track triplets for a side.
  const vec2_int& side_indices(const size_t side) const
  {
    return d_side_index[side];
  }

private:

  //-------------------------------------------------------------------------//
  // DATA
  //-------------------------------------------------------------------------//

  // Expose base class members.
  using Base::d_input;
  using Base::d_mesh;
  using Base::d_number_groups;
  using Base::d_has_reflective;
  using Base::d_is_reflective;
  using Base::d_has_vacuum;
  using Base::d_boundary_flux_size;

  /// MOC Quadrature
  SP_quadrature d_quadrature;
  /// Boundary flux [energy, angle, inout, track]
  bf_type d_boundary_flux;
  /// Vector of boundary conditions.
  std::vector<SP_bc> d_bc;
  /// d_feed_into[o0][a0][t0][o1 a1 t1] says track a0, t0 feeds into track a1, t1
  std::vector<vec3_int> d_feed_into;
  /// d_feed_from[a0][t0][a1 t1] says track a0, t0 feeds from track a1, t1
  std::vector<vec3_int> d_feed_from;
  /// d_side_index[side][o a t]
  vec3_int d_side_index;

  //-------------------------------------------------------------------------//
  // IMPLEMENTATION
  //-------------------------------------------------------------------------//

  /// Size the boundaries, etc.
  void initialize();

  /// Setup reflection indices.
  void setup_indices();

  /// Setup indices for an incident side.
  void setup_side_indices();

};

} // end namespace detran

//---------------------------------------------------------------------------//
// INLINE FUNCTIONS
//---------------------------------------------------------------------------//

#include "BoundaryMOC.i.hh"

#endif // detran_BOUNDARYMOC_HH_

//---------------------------------------------------------------------------//
//              end of file BoundaryMOC.hh
//---------------------------------------------------------------------------//


text:
/*
 * $Id: DOM_DocumentFragment.hpp 176026 2004-09-08 13:57:07Z peiyongz $
 */

#ifndef DOM_DocumentFragment_HEADER_GUARD_
#define DOM_DocumentFragment_HEADER_GUARD_

#include <xercesc/util/XercesDefs.hpp>
#include "DOM_Node.hpp"

XERCES_CPP_NAMESPACE_BEGIN

class DocumentFragmentImpl;

/**
 * DocumentFragment is a "lightweight" or "minimal"
 * Document object.
 *
 * It is very common to want to be able to
 * extract a portion of a document's tree or to create a new fragment of a
 * document. Imagine implementing a user command like cut or rearranging a
 * document by moving fragments around. It is desirable to have an object
 * which can hold such fragments and it is quite natural to use a Node for
 * this purpose. While it is true that a Document object could
 * fulfil this role,  a Document object can potentially be a
 * heavyweight  object, depending on the underlying implementation. What is
 * really needed for this is a very lightweight object.
 * DocumentFragment is such an object.
 *
Furthermore, various operations -- such as inserting nodes as children
 * of another Node -- may take DocumentFragment
 * objects as arguments;  this results in all the child nodes of the
 * DocumentFragment  being moved to the child list of this node.
 *
The children of a DocumentFragment node are zero or more
 * nodes representing the tops of any sub-trees defining the structure of the
 * document. DocumentFragment nodes do not need to be
 * well-formed XML documents (although they do need to follow the rules
 * imposed upon well-formed XML parsed entities, which can have multiple top
 * nodes).  For example, a DocumentFragment might have only one
 * child and that child node could be a Text node. Such a
 * structure model  represents neither an HTML document nor a well-formed XML
 * document.
 *
When a DocumentFragment is inserted into a
 * Document (or indeed any other Node that may take
 * children) the children of the DocumentFragment and not the
 * DocumentFragment  itself are inserted into the
 * Node. This makes the DocumentFragment very
 * useful when the user wishes to create nodes that are siblings; the
 * DocumentFragment acts as the parent of these nodes so that the
 *  user can use the standard methods from the Node  interface,
 * such as insertBefore() and  appendChild().
 */

class DEPRECATED_DOM_EXPORT DOM_DocumentFragment: public DOM_Node {

public:
    /** @name Constructors and assignment operators */
    //@{
    /**
    * Default constructor for DOM_DocumentFragment.  The resulting object does not
    * refer to an actual Document Fragment node; it will compare == to 0, and is similar
    * to a null object reference variable in Java.  It may subsequently be
    * assigned to refer to an actual Document Fragment node.
    *

    * New document fragment nodes are created by DOM_Document::createDocumentFragment().
    *
    */

    DOM_DocumentFragment();

    /**
      * Copy constructor.  Creates a new DOM_DocumentFragment that refers to the
      *   same underlying node as the original.  See also DOM_Node::clone(),
      * which will copy the actual Document fragment node, rather than just creating a new
      * reference to the original node.
      *
      * @param other The object to be copied
      */
    DOM_DocumentFragment(const DOM_DocumentFragment &other);

    /**
      * Assignment operator
      *
      * @param other The object to be copied
      */
    DOM_DocumentFragment & operator = (const DOM_DocumentFragment &other);

    /**
      * Assignment operator.  This overloaded variant is provided for
      *   the sole purpose of setting a DOM_Node reference variable to
      *   zero.  Nulling out a reference variable in this way will decrement
      *   the reference count on the underlying Node object that the variable
      *   formerly referenced.  This effect is normally obtained when reference
      *   variable goes out of scope, but zeroing them can be useful for
      *   global instances, or for local instances that will remain in scope
      *   for an extended time,  when the storage belonging to the underlying
      *   node needs to be reclaimed.
      *
      * @param val   Only a value of 0, or null, is allowed.
      */
    DOM_DocumentFragment & operator = (const DOM_NullPtr *val);

	//@}
    /** @name Destructor */
    //@{

    /**
      * Destructor.  The object being destroyed is the reference
      * object, not the underlying Comment node itself.
      *
      */
    ~DOM_DocumentFragment();

	//@}

protected:
    DOM_DocumentFragment(DocumentFragmentImpl *);

    friend class DOM_Document;
    friend class RangeImpl;
};

XERCES_CPP_NAMESPACE_END

#endif


text:
package com.jusfoun.dao.mapper;

import com.jusfoun.dao.BaseMapper;
import com.jusfoun.model.RoleHasModuleExample;
import com.jusfoun.model.RoleHasModuleKey;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleHasModuleMapper extends BaseMapper<RoleHasModuleKey, RoleHasModuleExample> {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    int countByExample(RoleHasModuleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    int deleteByExample(RoleHasModuleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    @Delete({
        "delete from role_has_module",
        "where roleId = #{roleId,jdbcType=INTEGER}",
          "and moduleId = #{moduleId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(RoleHasModuleKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    @Insert({
        "insert into role_has_module (roleId, moduleId)",
        "values (#{roleId,jdbcType=INTEGER}, #{moduleId,jdbcType=INTEGER})"
    })
    int insert(RoleHasModuleKey record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    int insertSelective(RoleHasModuleKey record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    List<RoleHasModuleKey> selectByExample(RoleHasModuleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    int updateByExampleSelective(@Param("record") RoleHasModuleKey record, @Param("example") RoleHasModuleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role_has_module
     *
     * @mbggenerated Wed May 24 10:49:22 CST 2017
     */
    int updateByExample(@Param("record") RoleHasModuleKey record, @Param("example") RoleHasModuleExample example);
}


text:
.NET idiomatic client libraries for [Google Cloud Platform](https://cloud.google.com/) services.

[![Travis build Status](https://travis-ci.org/GoogleCloudPlatform/google-cloud-dotnet.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/google-cloud-dotnet)
[![Appveyor build status](https://ci.appveyor.com/api/projects/status/d25hbwksdu6y9v5t?svg=true)](https://ci.appveyor.com/project/GoogleCloudPlatform/google-cloud-dotnet)
[![Coverage Status](https://codecov.io/gh/GoogleCloudPlatform/google-cloud-dotnet/branch/master/graph/badge.svg)](https://codecov.io/gh/GoogleCloudPlatform/google-cloud-dotnet)

* [Homepage](https://cloud.google.com/dotnet/)
* [API Documentation](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/)

The following libraries are available at a [GA](#versioning) quality level:

* [Google Cloud Datastore](https://cloud.google.com/datastore/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Datastore.V1/) (GA)
* Google Cloud Diagnostics for ASP.NET - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Diagnostics.AspNet/) (GA)
* Google Cloud Diagnostics for ASP.NET Core - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Diagnostics.AspNetCore/) (GA)
* [Google Stackdriver Logging](https://cloud.google.com/logging/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Logging.V2/) (GA)
  * Integration with Log4Net is provided via [Google.Cloud.Logging.Log4Net](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Logging.Log4Net/) (GA)
* [Google Cloud Natural Language](https://cloud.google.com/natural-language/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Language.V1/) (GA)
* [Stackdriver Monitoring](https://cloud.google.com/monitoring/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Monitoring.V3/) (GA)
* [Google Cloud Speech](https://cloud.google.com/speech/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Speech.V1/) (GA)
* [Google Cloud Storage](https://cloud.google.com/storage/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Storage.V1/) (GA)
* [Stackdriver Trace](https://cloud.google.com/trace/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Trace.V1/) (GA)
* [Google Cloud Translation](https://cloud.google.com/translate/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Translation.V2/) (GA)
* [Google Cloud Video Intelligence](https://cloud.google.com/video-intelligence/) - [API docs](https://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.VideoIntelligence.V1/) (GA)
* [Google Cloud Vision](https://cloud.google.com/vision/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Vision.V1/) (GA)
  * Additionally, a [Google.Cloud.Vision.V1P1Beta1](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Vision.V1P1Beta1/)
    library is available for access to beta API functionality.

The following libraries are available at a [late beta](#versioning) quality level:

* [Google BigQuery](https://cloud.google.com/bigquery/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.BigQuery.V2/) (late beta)

The following libraries are available at a [beta](#versioning) quality level:

* [Google BigQuery Data Transfer](https://cloud.google.com/bigquery/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.BigQuery.DataTransfer.V1/) (beta)
* [Stackdriver Error Reporting](https://cloud.google.com/error-reporting/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.ErrorReporting.V1Beta1/) (beta)
* [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.PubSub.V1/) (beta)
* [Google Cloud Spanner](https://cloud.google.com/spanner/): four packages are available, all beta:
  * [Google.Cloud.Spanner.Data](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Spanner.Data/): ADO.NET provider for Google Cloud Spanner (recommended)
  * [Google.Cloud.Spanner.V1](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Spanner.V1/): Low-level access to Spanner API
  * [Google.Cloud.Spanner.Admin.Database.V1](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Spanner.Admin.Database.V1/): Database administration API
  * [Google.Cloud.Spanner.Admin.Instance.V1](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Spanner.Admin.Instance.V1/): Instance administration API

The following libraries are available at an [alpha](#versioning) quality level:

* [Google Cloud Debugger](https://cloud.google.com/debugger/) - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Debugger.V2) (alpha)
* [Google Cloud Data Loss Prevention](https://cloud.google.com/dlp/) - [API docs](https://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Dlp.V2Beta1/) (alpha)
* Google Cloud Metadata - [API docs](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Metadata.V1) (alpha)

See the [API documentation](http://googlecloudplatform.github.io/google-cloud-dotnet/docs/) for details of the status
of each library.

> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.

If you need support for other Google APIs, check out the
[Google .NET API Client library](https://github.com/google/google-api-dotnet-client)

## Example Applications

* [getting-started-dotnet](https://github.com/GoogleCloudPlatform/getting-started-dotnet/) -
  A [quickstart and tutorial](https://cloud.google.com/dotnet/) that demonstrates how to build a complete web
  application using Cloud Datastore, Cloud Storage, and Cloud Pub/Sub and deploy it to Google Compute Engine.

## Specifying a Project ID

Most Google Cloud Libraries for .NET require a project ID. If you
don't remember yours (or haven't created a project yet), navigate to
the [Google Developers Console](https://console.developers.google.com/project) to view
your project ID (or create a new project and then get the ID). Once
done, record the value and make sure to pass it as a parameter to
the methods that require it.

## Authentication

Every API call needs to be authenticated. In order to successfully
make a call, first ensure that the necessary [Google Cloud
APIs](https://console.developers.google.com/apis/library/) are enabled for your project and that
you've downloaded the right set of keys (if it applies to you) as
explained in the [authentication
document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication).

Next, choose a method for authenticating API requests from within your project:

1. When using `google-cloud-dotnet` libraries from within Compute/App Engine, no additional authentication steps are necessary.
2. When using `google-cloud-dotnet` libraries elsewhere, you can do one of the following:
    * Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key.  For example:

      ```
      set GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json
      ```
    * If running locally for development/testing, you can authenticate using the [Google Cloud SDK)(https://cloud.google.com/sdk/).
      Download the SDK if you haven't already, then login by running the following in the command line:

      ```
      gcloud auth application-default login
      ```

## Supported platforms

See the [Supported Platforms
documentation](https://googlecloudplatform.github.io/google-cloud-dotnet/docs/guides/platforms.html)
for details on where the Google Cloud Libraries for .NET are
supported.

## Contributing

Contributions to this library are always welcome and highly encouraged.

See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information on how to get started.

## Versioning

The Google Cloud Client Libraries for .NET follow [Semantic Versioning](http://semver.org/).

The version number in the package *name* (and .NET namespace)
represents the version of the underlying API; the version number for
the package itself indicates the status of the client library, according to
the following quality levels:

**GA**: Libraries defined at a GA (General Availability) quality level are
expected to be stable: breaking API changes will not be made without a new major
release.

**Late Beta**: Libraries defined at a Late Beta quality level are
expected to be mostly stable and we're working towards their release
candidate. We will address issues and requests with a higher
priority.

**Beta**: Libraries defined at a Beta quality level are expected to
be stable and working, but the API surface is still under active
development. We encourage you to experiment with these libraries, but
expect breaking changes in future versions. There may still be
issues, but we have a fairly high degree of confidence.

**Alpha**: Libraries defined at an Alpha quality level are still
experimental. They may have significant issues, and the API surface
will almost certainly change before a final release. We encourage
experimentation with these libraries on test projects, but strongly
discourage you from using them in a production environment.

## License

Apache 2.0 - See [LICENSE](./LICENSE) for more information.


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

    <TextView
        android:id="@+id/gift_desc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:drawableLeft="@drawable/rtc_icon_flower1"
        android:gravity="center"
        android:textColor="@color/white"
        android:textSize="12sp"/>

    <com.demo.amazing.widget.StrokeTextView
        android:id="@+id/gift_count"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@id/gift_desc"
        android:paddingLeft="6dp"
        android:paddingRight="14dp"
        android:text="x 1 "
        android:textSize="13sp"
        android:textStyle="italic"
        app:draw_border="true"
        app:inner_color="@color/color_ffa800"
        app:out_color="@color/color_ffd200"/>

</RelativeLayout>


text:
"""
Itop REST API interaction.

This module implements a simple REST API parser, intended to be used between you python script and the available Itop
REST API.
The module also implements a CSV parser that helps parse CSV generated by Itop.

For further information about the REST Itop API please visit https://wiki.openitop.org/doku.php?id=advancedtopics:rest_json
"""

import csv
import json
import re
import requests

DEFAULT_VERSION = "1.0"

class PitopError(BaseException):
    """
    Class used to wrapped up most common REST API error comming from Itop as response to a CRUD operation.
    See the **Error codes** section of the the Itop REST API at https://wiki.openitop.org/doku.php?id=advancedtopics:rest_json

    Attributes
    ----------
    code: int
        The code number returned by any CRUD operation if it has failed.
    url: str
        The original URL that was requested.
    message: str
        The message received as response from Itop API.

    Parameters
    ----------
    code: int
        The code number returned by any CRUD operation if it has failed.
    url: str
        The original URL that was requested.
    message: str
        The message received as response from Itop API.
    """
    REQUESTOR_ERROR = {1: "UNAUTHORIZED",
                       2: "MISSING_VERSION",
                       3: "MISSING_JSON",
                       4: "INVALID_JSON",
                       10: "UNSUPPORTED_VERSION",
                       11: "UNKNOWN_OPERATION",
                       12: "UNSAFE",
                       99: "SERVER_ERROR",
                       100: "INTERNAL_ERROR"}

    def __init__(self, code, url, message):
        """
        Constructor of the RequestorError
        """
        self.status = PitopError.REQUESTOR_ERROR.get(code, PitopError.REQUESTOR_ERROR[99])
        self.url = url
        self.message = message

    def __str__(self):
        """
        """
        return "%s - %s : %s" %(self.status, self.url, self.message)

def search(url, username, password, object="", filter="", output_fields=[], timeout=30, itop_version=DEFAULT_VERSION):
    """
    Search for any Itop object using the REST API. The function is using the *core/get* operation of Itop.
    The function will interact with the Itop API and create dynamic python object based on Itop object returned.

    Parameters
    ----------
    url: str
        The Base URL of the Itop REST API.
    username: str
        Username to authenticate against Itop.
    password: str
        Password to authenticate against Itop.
    object: str
        The Itop object that is being requested.
    filter: str
        The filter statement to filetr out the Itop object.
    output_fields: list, optional
        A list of field that should be returned for the Itop object, default to 'all'.
    timeout: int, optional
        Time to wait to complete a request on server side, default to 30s.
    itop_version: str, optional
        The Itop version as required using any CRUD operation, default to '1.0'.

    Return
    ------
    itop_objects: list
        List of Itop Object as python object.
    """
    # Empty Itop object list
    itop_objects = []

    json_data = {"operation": "core/get", "class": object, "key": filter, "output_fieds": ",".join(output_fields)}

    payload = {"auth_user": username, "auth_pwd": password, "version": itop_version, "json_data": json.dumps(json_data)}

    # Launch a POST request using 'request' library
    try:
        response = requests.post(url, data=payload, timeout=timeout)
    except requests.exceptions.Timeout as timeout:
        raise PitopError(99, url, "Request timeout error")

    # Getting anything than HTTP 200 raise an Exception
    if response.status_code != 200:
        raise PitopError(99, url, response.status_code)

    json_objects = response.json()
    # Getting anything than '0' ('success') in the code keyword raise an Exception
    if json_objects["code"] != 0:
        raise PitopError(json_objects["code"], url, json_objects["message"])

    # Dynamic creation of python object using metaclass feature, based on Itop object and returned JSON
    itop_object = type(object, (), {"__init__": factory, "__getattr__": get_attribute, "__str__": to_string})

    for json_object in json_objects["objects"]:
        itop_objects.append(itop_object(json_objects["objects"],[json_object]["fields"]))

    return itop_objects

def factory(class_name, dict):
    """
    Creates a new class with its attribute set as the dictionary passed in argument.

    Parameters
    ----------
    dict: dict
        A dictionary where key will be the class attributes and value is the attribute's value.
    """
    class_name.__dict__ = dict

def get_attribute(class_name, attribute):
    """
    Magic method that will be used by the Metaclass created for Itop object.
    The function will avoid raising an exception if the atrtibute requested does not exist but rather return None.

    Parameters
    ----------
    attributes: str
        The attribute from the class that you want to retrieve the value.
    """
    return None

def to_string(class_name):
    """
    Magic method that is used by the Metaclass created for Itop object.
    """
    string = "%s : { " % type(class_name)
    for attribute, value in class_name.__dict__.iteritems():
        string += "%s : %s, " % (attribute, value)
    string += "}"
    return string

def parse_csv(file, object="", char_to_replace="(\s|\->|\-)"):
    """
    Parse an Itop CSV export file to rendered dynamic python objects.

    Parameters
    ----------
    file: str
        Full path of the CSV file to parse.
    object: str
        The Itop object's name that will be rendered as metaclass.
    char_to_replace: regex as str, optional
        Regex as string for character in the CSV file header that should be filtered.
    """
    # Regex used because Itop CSV header contains illegal character's for python variable name.
    to_be_replaced = re.compile(char_to_replace)
    # Empty Itop object list
    itop_objects = []

    itop_object = type(object, (), {"__init__": factory, "__getattr__": get_attribute, "__str__": to_string})

    with open(file, "rb") as csvfh:
        csv_file = csv.reader(csvfh)

        array = []
        for line in csv_file:
            array.append(line)

        header = [to_be_replaced.sub("_", value).replace("?","").lower() for value in array[0]]

        for line in array[1:]:
            itop_objects.append(itop_object(dict(zip(header, line))))

    return itop_objects


text:
This page describes how to create, manage, and delete accounts for contributors to the Seattle project.

## Overview
When a new developer joins the Seattle project accounts have to be created for the developer. Accounts need to be created so the developer can login to the Trac page, can checkout and commit to our SVN and have access to our several testbed machines. The developer also needs to be added to the developers email list.

## Account creation
Accounts for developers need to be created for our Trac system, seattle.poly.edu, all the testbed machines and optionally for blackbox.cs.washington.edu and maybe betabox.cs.washington.edu. The initial password assigned to the developers should be random and unique. The password should be a mixture of letters, numbers and symbols. Once the accounts have been created, an email should be sent to the developer with their account info and the email should remind the developer to change the password as soon as possible.

## Creating/Deleting Trac Account
To create a Trac account, you have to be an admin on our Seattle Trac page. After logging in as an admin, click on the 'Admin' tab on the left side of the page. Then go to the Accounts->Users section under the Administration section. Then fill in the information for the new user in the 'Add Account' box on the right side of the page.

To remove an user, check the box next to the user you want to remove and then click on the 'remove selected accounts' at the bottom of the page.

## Creating accounts on testbed machines
 * Windows XP and Vista
  * We have two windows machine currently: testbed-xp2.cs.washington.edu and testbed-vista1.cs.washington.edu.
  * Click on Start->Control Panel->User Accounts.
  * Once the User Accounts windows pops up, click on 'Create a new account'
  * Fill in the account name and create the account.
  * Remember to restart the SSH daemon. Check out [wiki:Local/SshService SSHService] on how to do this.

 * *NIX machines
  * Here are the machines that the user will need an account on:
    * seattle.poly.edu
    * testbed-opensuse.cs.washington.edu
    * testbed-freebsd.cs.washington.edu
  * Optional machines that user may need account on:
    * betabox.cs.washington.edu
    * blackbox.cs.washington.edu
  * To add an user you must log in as a sudo user on these machines.
  * The command to add user on *nix machines is:
    ```
    useradd -d /home/user_name -m user_name
    ```
    The -d option is for providing the location for the home folder for the user, and the -m option ensures that a home directory is created. In opensuse, a user's home directory is not created by default.
  * Some machines may accept the command 'adduser user_name'

 * Mac machines
  * Coming soon!!

## Deleting accounts on testbed machines
 * Windows XP and Vista
  * Click on Start->Control Panel->User Accounts.
  * Click on the account you are planning to remove.
  * Click on 'Delete the account'.
  * It then gives you the option to not delete the user file. In most cases you would want to keep the files and only delete the account, just in case the user had some important files or were running a daemon or tests regularly.

 * *NIX machines.
  * To remove an user account, you must log in as a sudo user on the machine.
  * The command to delete user accounts on *nix machines is:
    ```
    userdel user_name
    ```
    This will remove the user account but will not delete the user's home directory. We want to keep the user's files around in case we need them in the future. To remove the home directory as well, use the option -r with the userdel command.

 * Mac machines.
  * Coming soon!!

## SVN access for users
To give a user access to our SVN so they can commit, they must first have an account on seattle.poly.edu as that is where our SVN resides. Open up the /etc/groups file and add the user to the 'dev:' group. Deleting the user account from seattle.poly.edu will remove their access to the Seattle SVN.

## Adding developers to mailing list
To add a developer to the developers mailing list, you must be an admin for the mailing list. Visit the [seattle-devel administrative page](https://mailman.cs.washington.edu/mailman/admin/seattle-devel) click on the Membership Management->Mass Subscription link. Enter the developers email address and subscribe him.


text:
#ifndef __PINCTRL_MESON_H__
#define __PINCTRL_MESON_H__

#include <linux/types.h>

struct meson_pmx_group {
	const char *name;
	const unsigned int *pins;
	unsigned int num_pins;
	bool is_gpio;
	unsigned int reg;
	unsigned int bit;
};

struct meson_pmx_func {
	const char *name;
	const char * const *groups;
	unsigned int num_groups;
};

struct meson_pinctrl_data {
	const char *name;
	struct meson_pmx_group *groups;
	struct meson_pmx_func *funcs;
	struct meson_bank *banks;
	unsigned int pin_base;
	unsigned int num_pins;
	unsigned int num_groups;
	unsigned int num_funcs;
	unsigned int num_banks;
};

struct meson_pinctrl {
	struct meson_pinctrl_data *data;
	void __iomem *reg_mux;
	void __iomem *reg_gpio;
};

/**
 * struct meson_reg_desc - a register descriptor
 *
 * @reg:	register offset in the regmap
 * @bit:	bit index in register
 *
 * The structure describes the information needed to control pull,
 * pull-enable, direction, etc. for a single pin
 */
struct meson_reg_desc {
	unsigned int reg;
	unsigned int bit;
};

/**
 * enum meson_reg_type - type of registers encoded in @meson_reg_desc
 */
enum meson_reg_type {
	REG_PULLEN,
	REG_PULL,
	REG_DIR,
	REG_OUT,
	REG_IN,
	NUM_REG,
};

/**
 * struct meson bank
 *
 * @name:	bank name
 * @first:	first pin of the bank
 * @last:	last pin of the bank
 * @regs:	array of register descriptors
 *
 * A bank represents a set of pins controlled by a contiguous set of
 * bits in the domain registers. The structure specifies which bits in
 * the regmap control the different functionalities. Each member of
 * the @regs array refers to the first pin of the bank.
 */
struct meson_bank {
	const char *name;
	unsigned int first;
	unsigned int last;
	struct meson_reg_desc regs[NUM_REG];
};

#define PIN(x, b)	(b + x)

#define GROUP(grp, r, b)						\
	{								\
		.name = #grp,						\
		.pins = grp ## _pins,					\
		.num_pins = ARRAY_SIZE(grp ## _pins),			\
		.reg = r,						\
		.bit = b,						\
	 }

#define GPIO_GROUP(gpio, b)						\
	{								\
		.name = #gpio,						\
		.pins = (const unsigned int[]){ PIN(gpio, b) },		\
		.num_pins = 1,						\
		.is_gpio = true,					\
	 }

#define FUNCTION(fn)							\
	{								\
		.name = #fn,						\
		.groups = fn ## _groups,				\
		.num_groups = ARRAY_SIZE(fn ## _groups),		\
	}

#define BANK(n, f, l, per, peb, pr, pb, dr, db, or, ob, ir, ib)		\
	{								\
		.name	= n,						\
		.first	= f,						\
		.last	= l,						\
		.regs	= {						\
			[REG_PULLEN]	= { per, peb },			\
			[REG_PULL]	= { pr, pb },			\
			[REG_DIR]	= { dr, db },			\
			[REG_OUT]	= { or, ob },			\
			[REG_IN]	= { ir, ib },			\
		},							\
	 }

#define MESON_PIN(x, b) PINCTRL_PIN(PIN(x, b), #x)

extern const struct pinctrl_ops meson_pinctrl_ops;

int meson_pinctrl_probe(struct udevice *dev);

#endif /* __PINCTRL_MESON_H__ */


text:
layout: post
authors: ["Greg Wilson"]
title: "Publishing on the Web"
date: 2014-01-15
time: "10:30:00"
favorite: true
tags: ["Opinion", "Publishing", "Tooling", "Community"]
---

  Back in December,
  I asked a question on the Software Carpentry issue track:
  What should we teach about writing/publishing papers in a webby world?
  It led to a lively discussion about how the web is changing scientific publishing,
  the tools people can use to take advantage of those changes,
  and the gap between what's possible and what publishers (and senior academics) will actually accept.
  Many commenters dove immediately into the details of specific tools,
  but Justin Kitzes nailed it when he said:

    I think the biggest hurdle,
    and most important teaching point,
    is simply the idea of writing papers in plain text (regardless of the markup language)...
    There are lots of advantages to plain text...but in the context of the bootcamp,
    one of the biggest is that it provides a really good use case for version control..

    The elephant in the room for students, of course, is
    (a) why they should change to a practice (leaving Word)
    that will be viewed as strange and potentially difficult by other collaborators,
    and (b) more specifically, how they will interact with collaborators who only use Word for track changes and commenting.
    I don't know that I have good answers to either of these questions.

  A few comments later,
  Cameron Neylon chimed in:

    I think it could be worth taking a step back and re-phrasing the question a little.
    Is the object to teach those building tools about publishing in general
    (i.e., what tools and hacks might be useful to create)
    or is the focus here specifically on how to get better incorporation of code into published work?
    I think the latter is the focus but it might be good to be explicit.

    On that basis it would be good in my view to touch on some background in literate programming to give people a bit of context
    and then look at various authoring tools (knitr, IPyNB, Sweave, Dexy...others presumably)
    alongside various code repositories and data repositories in that light.
    This would then provide a way of thinking about the available tools as a way of telling the story,
    which is different to how they are generally used in practice to manage code and records and actually do the work.

    It's a personal bias,
    but I'd also be inclined to spend some time on the sausage making of the publishing process
    and why it doesn't fit with what the tools above.
    What gaps are there?
    How could they be filled?
    What would the optimal system look like?
    What formats would be used?

  Carl Boettiger then added his recommendations,
  which I've condensed as:

Start with data publishing and code publishing.

Endorse plain text for publications.

Address the pain points:

Journal submission software

Collaboration

Citations

Dynamic documents: more important to teach the concept than the specifics.

  He also said later (in a comment on an early draft of this post) that:

    ...the opening question asked about "publishing in a webby world",
    while current publishers and practices are inherently non-webby.
    This creates a tension I think we never quite resolve.
    We're stuck tackling the question of how to do "webby publishing in a non-webby world"...

  At this point I pushed back a bit based on conversations with bootcamp attendees:

    Word is easier to use for normal tasks (like writing a paper with bullet points and italics) than Markdown,
    much less LaTeX—it's only Stockholm Syndrome that makes us believe otherwise :-).
    And as long as both senior faculty and journals require people to submit Word (or PDFs derived from specific Word templates),
    it's hard for us to say, "No, really, version control is better in the long run,"
    because the long run ends in you wrestling with Pandoc to try to get it to format things the way some particular conference requires.
    (True story: I submitted the outline for our upcoming SIGCSE workshop to the ACM using their LaTeX template.
    During the holiday break,
    I got mail telling me I had to re-do it using their MICROSOFT WORD template (their capitalization),
    which of course LibreOffice couldn't load properly.)
    So: given that the end product must be acceptable to senior profs and journals,
    and that markup-based tools impose more cognitive load on newcomers than WYSIWYG alternatives
    (i.e., the payoff for switching is tomorrow, the pain is today),
    what's our path forward?
    What can we teach in an hour that the average biologist will find compelling?

  The last question is the most important.
  Everybody's deadline is tomorrow or next week;
  the hours they spend today learning something that might pay off in the long run
  increase the risk of them not meeting that near-term deadline
  (and the risk that their supervisor will ask them to re-do it because what's GitHub?).

  But Jon Pipitone (who works in a research hospital) disagreed:

    Even if folks are writing their papers in Word,
    I still think version control is a useful tool when paper writing,
    because there is so much more to writing a paper than just the final document,
    e.g., results files, figures, images, correspondence, submission documents, as well as any scripts you use to do analysis and generate other assets.
    You may not be able to use git diff on a Word doc but you can use it on many of these other things.
    And even then,
    under version control you can still checkout an older copy of your paper,
    and use Word's compare feature to do the diff.
    Plus you get the benefits of having a log of your changes,
    easy backups (e.g., git push) and rollbacks, etc.

    The point I'm making is I think the benefits of version control when paper writing are worthwhile despite the fact that Word files don't diff easily.
    I'd also like to suggest that teaching folks to use knitr or IPython Notebooks or even just to create scripts to generate figures) can be a really useful thing.
    I've been showing people how to use RStudio to create a draft of their paper in Markdown to leverage the power of knitr.
    Even those that don't draft their paper in Markdown but just use it like an IPython Notebook
    get value out of being able to build up a document of figures and tables which they can paste into their word documents.

  Cameron Neylon then tried to refocus the discussion on this key point:

    We need a framework to discuss this in that steps a little away from the framework of the rest of Software Carpentry.
    The reason I say this is actually well demonstrated by the subtle ways in which all the suggestions are butting up against each other in not so comfortable ways.
    All of us have an implicit framework into which our thinking about authoring and sharing papers fits.
    Many of us also have a similar,
    but perhaps not identical,
    framework we use to think about code (and data, and... and...)

    The students don't.

    They're just at the point of trying to wrap their head around version control and the shell.
    That means to my mind... that a combination of the practical and the abstract will help them understand
    both the software side better as well as allow them to come to their own conclusions about how that framework does or does not apply to authoring papers.

    Or to put it more simply:
    You've just learned about some ways of thinking about writing and using code and data that might help you work better.
    Authoring a paper is a different process.
    Here's why.
    Maybe it doesn't need to be...or maybe it does.
    What do you think?
    What will work for you?
    And do you now understand why version control is such a fantastic thing?

  Ian Mulvany then contributed
  a lengthy comment,
  which he later turned into
  a detailed, insightful blog post.
  The whole thing merits close reading,
  but his key recommendations are:

Use a reference management tool.

Find the fastest venue to publish in.

Publish in an open access journal.

Add your work to the best preprint server for your discipline (and possibly a university archive).

    Add as much supporting material as you can to the right locations, e.g.,
    github for code,
    vimeo or you tube for videos,
    and figshare for almost anything.

Register for an ORCID and add your publication to your ORCID profile.

Don't be afraid to alter publishers' copyright transfer statements.

Use version control.

    Don't waste time formatting your paper (especially your references),
    because it will all be thrown away by the publisher.

    If the collaborative environment of your choice is not working for your group,
    drop it and get the damn paper finished.

  There's a lot here to digest,
  but I now believe that
  Software Carpentry should introduce bootcamp participants
  to new ideas in scientific publishing.
  I believe we can as well,
  i.e.,
  that the tools and practices people like Justin, Cameron, Carl, Jon, and Ian use
  are now within reach of our learners (if only just).
  If you'd like to help us work out the specifics—in particular,
  if you'd like to help us create an hour-long teaching module
  on 21st Century scientific publishing—please
  join the discussion.


text:
<iframe src="http://localhost:3000" width="1024" height="768">
  Contenuto alternativo per i browser che non leggono gli iframe.
</iframe>


text:
<meta charset="UTF-8">
<title>Delegate - kapsule-core</title>
<link rel="stylesheet" href="../../../style.css">

kapsule-core / space.traversal.kapsule / Delegate

Delegate

sealed class Delegate<in M, T>

Kapsule property delegate.

Parameters

initializer - Value initializer function.

Parameters

Parameters

Types

Optional

class Optional<in M, T> : Delegate<M, T>

Delegate for optional (nullable) values.

Required

class Required<in M, T> : Delegate<M, T>

Delegate for required (non-null) values.

Properties

value

var value: T?

Functions

initialize

fun initialize(module: M): Unit

Initializes value from the injection module.

Inheritors

Optional

class Optional<in M, T> : Delegate<M, T>

Delegate for optional (nullable) values.

Required

class Required<in M, T> : Delegate<M, T>

Delegate for required (non-null) values.


text:
package net.spy.memcached.protocol.binary;

import net.spy.memcached.ops.DeleteOperation;
import net.spy.memcached.ops.OperationCallback;
import net.spy.memcached.ops.OperationStatus;

class DeleteOperationImpl extends OperationImpl implements
		DeleteOperation {

	private static final int CMD=4;

	private final String key;
	private final int when;
	private final long cas;

	public DeleteOperationImpl(String k, int w, OperationCallback cb) {
		this(k, w, 0, cb);
	}

	public DeleteOperationImpl(String k, int w, long c, OperationCallback cb) {
		super(CMD, generateOpaque(), cb);
		key=k;
		when=w;
		cas=c;
	}

	@Override
	public void initialize() {
		prepareBuffer(key, cas, EMPTY_BYTES, when);
	}

	@Override
	protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) {
		return errCode == ERR_NOT_FOUND ? NOT_FOUND_STATUS : null;
	}

}


text:
package org.dita.dost.writer;

import org.dita.dost.exception.DITAOTException;
import org.dita.dost.log.MessageUtils;
import org.dita.dost.util.DitaClass;
import org.dita.dost.util.Job.FileInfo;
import org.w3c.dom.*;

import java.io.File;
import java.net.URI;
import java.util.Map;

import static org.apache.commons.io.FilenameUtils.normalize;
import static org.dita.dost.reader.ConrefPushReader.MoveKey;
import static org.dita.dost.util.Constants.*;
import static org.dita.dost.util.URLUtils.toURI;
import static org.dita.dost.util.XMLUtils.*;

/**
 * This class is for writing conref push contents into
 * specific files.
 */
public final class ConrefPushParser extends AbstractDomFilter {

    private Map<MoveKey, DocumentFragment> movetable;
    private boolean hasConref = false;
    private boolean hasKeyref = false;
    private File tempDir;

    public void setMoveTable(final Map<MoveKey, DocumentFragment> movetable) {
        this.movetable = movetable;
    }

    public void setTempDir(final File tempDir) {
        this.tempDir = tempDir;
    }

    @Override
    public void read(final File filename) throws DITAOTException {
        hasConref = false;
        hasKeyref = false;

        super.read(filename);

        for (final MoveKey key : movetable.keySet()) {
            logger.warn(MessageUtils.getMessage("DOTJ043W", key.idPath, filename.getPath()).toString());
        }
        if (hasConref || hasKeyref) {
            updateList(filename);
        }
    }

    @Override
    protected Document process(final Document doc) {
        walk(doc.getDocumentElement(), null);
        return doc;
    }

    /**
     * Update conref list in job configuration and in conref list file.
     *
     * @param filename filename
     */
    private void updateList(final File filename) {
        try {
            final URI relativePath = toURI(filename.getAbsolutePath().substring(new File(normalize(tempDir.toString())).getPath().length() + 1));
            final FileInfo f = job.getOrCreateFileInfo(relativePath);
            if (hasConref) {
                f.hasConref = true;
            }
            if (hasKeyref) {
                f.hasKeyref = true;
            }
            job.write();
        } catch (final RuntimeException e) {
            throw e;
        } catch (final Exception e) {
            logger.error(e.getMessage(), e);
        }
    }

    /**
     * The function is to judge if the pushed content type march the type of content being pushed/replaced
     *
     * @param targetClassAttribute the class attribute of target element which is being pushed
     * @param content              pushedContent
     * @return boolean: if type match, return true, else return false
     */
    private boolean isPushedTypeMatch(final DitaClass targetClassAttribute, final DocumentFragment content) {
        if (content.hasChildNodes()) {
            final NodeList nodeList = content.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                final Node node = nodeList.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    final Element elem = (Element) node;
                    final DitaClass cls = DitaClass.getInstance(elem);
                    if (cls != null) {
                        return targetClassAttribute.matches(cls);
                    }
                }
            }
        }
        return false;
    }

    private DocumentFragment replaceElementName(final DitaClass targetClassAttribute, final DocumentFragment content) {
        if (content.hasChildNodes()) {
            final NodeList nodeList = content.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                final Node node = nodeList.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    final Element elem = (Element) node;
                    final DitaClass cls = DitaClass.getInstance(elem);
                    // get type of the target element
                    final String type = targetClassAttribute.toString().substring(1, targetClassAttribute.toString().indexOf("/")).trim();
                    if (!cls.equals(targetClassAttribute) && targetClassAttribute.matches(cls)) {
                        // Specializing the pushing content is not handled here
                        // but we can catch such a situation to emit a warning by comparing the class values.
                        final String targetElementName = targetClassAttribute.toString().substring(targetClassAttribute.toString().indexOf("/") + 1).trim();
                        if (elem.getAttributeNode(ATTRIBUTE_NAME_CONREF) != null) {
                            hasConref = true;
                        }
                        if (elem.getAttributeNode(ATTRIBUTE_NAME_KEYREF) != null) {
                            hasKeyref = true;
                        }
                        elem.getOwnerDocument().renameNode(elem, elem.getNamespaceURI(), targetElementName);
                        // process the child nodes of the current node
                        final NodeList nList = elem.getChildNodes();
                        for (int j = 0; j < nList.getLength(); j++) {
                            final Node subNode = nList.item(j);
                            if (subNode.getNodeType() == Node.ELEMENT_NODE) {
                                //replace the subElement Name
                                replaceSubElementName(type, (Element) subNode);
                            }
                        }
                    } else {
                        replaceSubElementName(STRING_BLANK, elem);
                    }
                }
            }
        }
        return content;
    }

    private void replaceSubElementName(final String type, final Element elem) {
        if (elem.getAttributeNode(ATTRIBUTE_NAME_CONREF) != null) {
            hasConref = true;
        }
        if (elem.getAttributeNode(ATTRIBUTE_NAME_KEYREF) != null) {
            hasKeyref = true;
        }
        String generalizedElemName = elem.getNodeName();
        final DitaClass cls = DitaClass.getInstance(elem);
        if (cls != null) {
            if (cls.toString().contains(type) && !type.equals(STRING_BLANK)) {
                final int index = cls.toString().indexOf("/");
                generalizedElemName = cls.toString().substring(index + 1, cls.toString().indexOf(STRING_BLANK, index)).trim();
            }
        }
        elem.getOwnerDocument().renameNode(elem, elem.getNamespaceURI(), generalizedElemName);
        final NodeList nodeList = elem.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            final Node node = nodeList.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                replaceSubElementName(type, (Element) node);
            }
        }
    }

    private MoveKey hasAction(final DitaClass classValue, final String idPath, final String defaultIdPath,
                              final String action) {
        if (movetable.containsKey(new MoveKey(idPath, action))) {
            final MoveKey containkey = new MoveKey(idPath, action);
            if (isPushedTypeMatch(classValue, movetable.get(containkey))) {
                return containkey;
            }
        } else if (movetable.containsKey(new MoveKey(defaultIdPath, action))) {
            final MoveKey containkey = new MoveKey(defaultIdPath, action);
            if (isPushedTypeMatch(classValue, movetable.get(containkey))) {
                return containkey;
            }
        }
        return null;
    }

    private void walk(final Element elem, final String parentTopicId) {
        String topicId = parentTopicId;
        final String idValue = elem.getAttribute(ATTRIBUTE_NAME_ID);
        if (idValue != null) {
            final DitaClass cls = DitaClass.getInstance(elem);
            if (TOPIC_TOPIC.matches(cls)) {
                topicId = idValue;
            } else {
                final String idPath;
                if (MAP_TOPICREF.matches(cls) || MAP_MAP.matches(cls)) {
                    idPath = SHARP + idValue;
                } else {
                    idPath = SHARP + topicId + SLASH + idValue;
                }
                final String defaultidPath = SHARP + idValue;

                final MoveKey pushBefore = hasAction(cls, idPath, defaultidPath, ATTR_CONACTION_VALUE_PUSHBEFORE);
                if (pushBefore != null) {
                    final DocumentFragment fragment = movetable.remove(pushBefore);
                    insertBefore(elem, replaceElementName(cls, fragment));
                }

                final MoveKey pushAfter = hasAction(cls, idPath, defaultidPath, ATTR_CONACTION_VALUE_PUSHAFTER);
                if (pushAfter != null) {
                    final DocumentFragment fragment = movetable.remove(pushAfter);
                    insertAfter(elem, replaceElementName(cls, fragment));
                }

                final MoveKey pushReplace = hasAction(cls, idPath, defaultidPath, ATTR_CONACTION_VALUE_PUSHREPLACE);
                if (pushReplace != null) {
                    final DocumentFragment fragment = movetable.remove(pushReplace);
                    insertBefore(elem, replaceElementName(cls, fragment));
                    elem.getParentNode().removeChild(elem);
                    return;
                }
            }
        }
        for (final Element child : getChildElements(elem)) {
            walk(child, topicId);
        }
    }
}