text:
//-*- Mode: C++ -*-
// $Id$

#ifndef ALIHLTPHOSRAWANALYZERCOMPONENTV3_H
#define ALIHLTPHOSRAWANALYZERCOMPONENTV3_H

/**
 * Raw data analyzer component base class for PHOS HLT
 *
 * @file   AliHLTPHOSRawAnalyzerComponentv3.h
 * @author Oystein Djuvsland
 * @date
 * @brief  A clusterizer component for PHOS HLT
*/

// see below for class documentation
// or
// refer to README to build package
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt

#include "AliHLTCaloRawAnalyzerComponentv3.h"

class AliHLTPHOSRawAnalyzer;

/**
 * @class AliHLTPHOSRawAnalyzerComponentv3
 * This the new and fast version of the component taking care of the decoding and energy and timing
 * extraction of the raw data from PHOS.
 *
 *
General properties:

 *
 * Component ID: \b PhosRawAnalyzerv3

 * Library: \b libAliHLTPHOS.so

 * Input Data Types: @ref

 * Output Data Types: @ref AliHLTPHOSDefinitions::fgkChannelDataType

 *
 *
Mandatory arguments:

 *
 * \li No mandatory arguments for component

 *
 *
Optional arguments:

 *
 * \li -offset       value

 *      gives the offset added to the data during zero suppression (default value: 0)
 * \li -bunchsizecut  value

 *      minimum number of samples a bunch must contain to be considered  (default value: 0)
 * \li -minpeakposition  value

 *      cut on minimum postion of the peak in the bunch (defaul value: 0)
 * \li -maxpeakposition  value

 *      cut on maximum postion of the peak in the bunch (defaul value: 100)
 *
 *
Configuration:

 *
 * \li No configuration arguments
 *
 *
Default CDB entries:

 * \li No CDB entry yet, will come.
 *
 *
Performance:

 * Pretty good (~ 3 kHz), depends on amount of data...
 *
 *
Memory consumption:

 * Depends on the amount of data, but pretty godd
 *
 *
Output size:

 * Depends on the amount of data...
 *
 * More detailed description. (Soon)
 *
 * @ingroup alihlt_phos
 */

//#include "AliCaloConstants.h"

//using namespace Algo;

class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTCaloRawAnalyzerComponentv3
{
 public:
  AliHLTPHOSRawAnalyzerComponentv3( fitAlgorithm algo ); /** Standard constructor */
  virtual ~AliHLTPHOSRawAnalyzerComponentv3();
  virtual void GetInputDataTypes( vector <AliHLTComponentDataType>& list);/** interface function, see @ref AliHLTComponent for description */
  virtual AliHLTComponentDataType GetOutputDataType();/** interface function, see @ref AliHLTComponent for description */
  virtual const char* GetComponentID() = 0;
  virtual AliHLTComponent* Spawn() = 0; /** interface function, see @ref AliHLTComponent for description */

 protected:

  /** interface function, see @ref AliHLTComponent for description */
  virtual int DoInit(int argc, const char** argv);

  virtual void InitMapping(const int specification);

 private:
  AliHLTPHOSRawAnalyzerComponentv3();
  AliHLTPHOSRawAnalyzerComponentv3(const AliHLTPHOSRawAnalyzerComponentv3 & );
  AliHLTPHOSRawAnalyzerComponentv3 & operator = (const AliHLTPHOSRawAnalyzerComponentv3 &);

};

#endif


text:
DROP INDEX index_crates_name;
ALTER TABLE crates ADD CONSTRAINT packages_name_key UNIQUE (name);

redpajama_set_name: RedPajamaGithub


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _lib = require('../../lib');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * A loader alerts a user to wait for an activity to complete.
 * @see Dimmer
 */
function Loader(props) {
  var active = props.active,
      children = props.children,
      className = props.className,
      content = props.content,
      disabled = props.disabled,
      indeterminate = props.indeterminate,
      inline = props.inline,
      inverted = props.inverted,
      size = props.size;

  var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(indeterminate, 'indeterminate'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(children || content, 'text'), (0, _lib.useKeyOrValueAndKey)(inline, 'inline'), 'loader', className);
  var rest = (0, _lib.getUnhandledProps)(Loader, props);
  var ElementType = (0, _lib.getElementType)(Loader, props);

  return _react2.default.createElement(
    ElementType,
    (0, _extends3.default)({}, rest, { className: classes }),
    _lib.childrenUtils.isNil(children) ? content : children
  );
}

Loader.handledProps = ['active', 'as', 'children', 'className', 'content', 'disabled', 'indeterminate', 'inline', 'inverted', 'size'];
Loader._meta = {
  name: 'Loader',
  type: _lib.META.TYPES.ELEMENT
};

Loader.propTypes = process.env.NODE_ENV !== "production" ? {
  /** An element type to render as (string or function). */
  as: _lib.customPropTypes.as,

  /** A loader can be active or visible. */
  active: _propTypes2.default.bool,

  /** Primary content. */
  children: _propTypes2.default.node,

  /** Additional classes. */
  className: _propTypes2.default.string,

  /** Shorthand for primary content. */
  content: _lib.customPropTypes.contentShorthand,

  /** A loader can be disabled or hidden. */
  disabled: _propTypes2.default.bool,

  /** A loader can show it's unsure of how long a task will take. */
  indeterminate: _propTypes2.default.bool,

  /** Loaders can appear inline with content. */
  inline: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['centered'])]),

  /** Loaders can have their colors inverted. */
  inverted: _propTypes2.default.bool,

  /** Loaders can have different sizes. */
  size: _propTypes2.default.oneOf(_lib.SUI.SIZES)
} : {};

exports.default = Loader;


text:
:
# simple script to find all regular files and creates a sha1 signiture for that file and places it
# into the single file sha1chklist.txt
# A check of all the files can then be performed via
# sha1sum -c sha1chklist.txt
# this line starts from the currecnt work directory
# find . -type f -exec sha1sum {} > sha1chklist.txt \;

#
# RHEl, Ubuntu sha1sum, INterix sha1  (note output is reversed name then sha1)
#
if [ "$(uname -s)" = "Darwin" ]; then
  if [ -x /sbin/md5 ]; then
     SHA1SUM="/sbin/md5"
  else
     echo "No md5 application, exiting."
     exit
  fi
elif [ -x /usr/bin/sha1sum ]; then
  SHA1SUM="sha1sum"
elif [ -x /bin/sha1 ]; then
  SHA1SUM="sha1"
else
  echo "No sha1 application, exiting."
  exit
fi

# this one would go to the working vnmr directory and start there.
if [ ! -d ../../vnmr/adm/sha1 ]
then
   mkdir -p ../../vnmr/adm/sha1
fi
cd ../../vnmr;

## regular files
# find . -type f -exec sha1sum {} > sha1chklist.txt \;
## regular files  and symlinks
## have find follow the symlink to real type of file.
## since the sha1sum will follow the symlink to the file to create the sha1 anyway
##
# find . -follow \( -type f -o -type l \) -exec sha1sum {} > adm/sha1/sha1chklist.txt \;
#
#  some attempt was to remove pubsmanual html files out of the sha1 list
#  however this prove to be problematic since some names have control chars embeeded in them, thus refusing
# attempt to regex them the closest obtain was the following but good enough...
#  find ../../vnmr  ! -regex '.*/help/html/.*'  -print > /workspace/greg/master/git-repo/scripts/tst.txt
#   GMB
# find . -follow \( -type f -o -type l \) ! -name ".git*" -exec sha1sum {} > adm/sha1/sha1chklist.txt \;
find . -follow \( -type f -o -type l \) ! -name ".git*" -exec $SHA1SUM {} > adm/sha1/sha1chklist.txt \;
cd ../options
find standard -follow \( -type f -o -type l \)  ! -name ".git*" -exec $SHA1SUM {} > ../vnmr/adm/sha1/sha1chklistOptionsStd.txt \;
find console -follow \( -type f -o -type l \)  ! -name ".git*" -exec $SHA1SUM {} > ../vnmr/adm/sha1/sha1chklistOptionsConsole.txt \;
cd ../console
find . -follow \( -type f -o -type l \) ! -name ".git*" -exec $SHA1SUM {} > ../vnmr/adm/sha1/sha1chklistConsole.txt \;

cd ../vnmr
$SHA1SUM ./adm/sha1/Build_Id.txt ./adm/sha1/sha1chklist.txt ./adm/sha1/sha1chklistOptionsStd.txt ./adm/sha1/sha1chklistOptionsConsole.txt ./adm/sha1/sha1chklistConsole.txt > adm/sha1/sha1chklistFiles.txt


text:
module Gitlab
  module Utils
    extend self

    # Ensure that the relative path will not traverse outside the base directory
    def check_path_traversal!(path)
      raise StandardError.new("Invalid path") if path.start_with?("..#{File::SEPARATOR}") ||
          path.include?("#{File::SEPARATOR}..#{File::SEPARATOR}") ||
          path.end_with?("#{File::SEPARATOR}..")

      path
    end

    # Run system command without outputting to stdout.
    #
    # @param  cmd [Array<String>]
    # @return [Boolean]
    def system_silent(cmd)
      Popen.popen(cmd).last.zero?
    end

    def force_utf8(str)
      str.force_encoding(Encoding::UTF_8)
    end

    # A slugified version of the string, suitable for inclusion in URLs and
    # domain names. Rules:
    #
    #   * Lowercased
    #   * Anything not matching [a-z0-9-] is replaced with a -
    #   * Maximum length is 63 bytes
    #   * First/Last Character is not a hyphen
    def slugify(str)
      return str.downcase
        .gsub(/[^a-z0-9]/, '-')[0..62]
        .gsub(/(\A-+|-+\z)/, '')
    end

    # Converts newlines into HTML line break elements
    def nlbr(str)
      ActionView::Base.full_sanitizer.sanitize(str, tags: []).gsub(/\r?\n/, '<br>').html_safe
    end

    def remove_line_breaks(str)
      str.gsub(/\r?\n/, '')
    end

    def to_boolean(value)
      return value if [true, false].include?(value)
      return true if value =~ /^(true|t|yes|y|1|on)$/i
      return false if value =~ /^(false|f|no|n|0|off)$/i

      nil
    end

    def boolean_to_yes_no(bool)
      if bool
        'Yes'
      else
        'No'
      end
    end

    def random_string
      Random.rand(Float::MAX.to_i).to_s(36)
    end

    # See: http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
    # Cross-platform way of finding an executable in the $PATH.
    #
    #   which('ruby') #=> /usr/bin/ruby
    def which(cmd, env = ENV)
      exts = env['PATHEXT'] ? env['PATHEXT'].split(';') : ['']

      env['PATH'].split(File::PATH_SEPARATOR).each do |path|
        exts.each do |ext|
          exe = File.join(path, "#{cmd}#{ext}")
          return exe if File.executable?(exe) && !File.directory?(exe)
        end
      end

      nil
    end

    def bytes_to_megabytes(bytes)
      bytes.to_f / Numeric::MEGABYTE
    end

    # Used in EE
    # Accepts either an Array or a String and returns an array
    def ensure_array_from_string(string_or_array)
      return string_or_array if string_or_array.is_a?(Array)

      string_or_array.split(',').map(&:strip)
    end
  end
end


text:
package model;

import javax.swing.JOptionPane;
import java.sql.*;

/**
 * Created by Thagus on 03/09/16.
 */
public class InvertedIndexOperations {
    private PreparedStatement stAddTerm;

    protected InvertedIndexOperations(Connection connection) throws SQLException{
        stAddTerm = connection.prepareStatement("INSERT INTO SPATIA.INVERTEDINDEX(url,term,tf) VALUES(?,?,?)");
    }

    /**
     * Add a term to the database
     * @param url The id of the document containing the term
     * @param term The term to be added
     * @param tf The Term Frequency (TF) of the term in the document
     */
    public synchronized void addTerm(String url, String term, int tf){
        try{
            stAddTerm.setString(1, url);
            stAddTerm.setString(2, term);
            stAddTerm.setInt(3, tf);

            stAddTerm.executeUpdate();
        } catch(SQLException e){
            //The insertion fails due to duplicate key
            if(e.getErrorCode()==23505){
                System.out.println("There is already the term \"" + term + "\" for document id: " + url);
                JOptionPane.showMessageDialog(null, "There is already the term \"" + term + "\" for document id: " + url);
            }
            //The insertion fails due to foreign key constraint failure
            else if(e.getErrorCode()==23506){
                System.out.println("There is no document with id: " + url);
                JOptionPane.showMessageDialog(null, "There is no document with id: " + url);
            }

            //Unhandled error
            System.out.println("Error adding term '" + term + "'");
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, e.toString(), "Error adding term '" + term + "' in " + url + " with " + tf + " frequency", JOptionPane.ERROR_MESSAGE);
        }
    }
}


text:
namespace KFS
{
class AtomicRecordAppender;
class Properties;

// central struct for all the record appenders.  would be nice to make this a singleton
class AtomicRecordAppendManager {
public:
    struct Counters
    {
        typedef int64_t Counter;

        Counter mAppendCount;
        Counter mAppendByteCount;
        Counter mAppendErrorCount;
        Counter mReplicationErrorCount;
        Counter mReplicationTimeoutCount;
        Counter mAppenderAllocCount;
        Counter mAppenderAllocMasterCount;
        Counter mAppenderAllocErrorCount;
        Counter mWriteIdAllocCount;
        Counter mWriteIdAllocErrorCount;
        Counter mWriteIdAllocNoAppenderCount;
        Counter mSpaceReserveCount;
        Counter mSpaceReserveByteCount;
        Counter mSpaceReserveDeniedCount;
        Counter mSpaceReserveErrorCount;
        Counter mBeginMakeStableCount;
        Counter mBeginMakeStableErrorCount;
        Counter mMakeStableCount;
        Counter mMakeStableErrorCount;
        Counter mMakeStableLengthErrorCount;
        Counter mMakeStableChecksumErrorCount;
        Counter mChecksumErrorCount;
        Counter mReadErrorCount;
        Counter mWriteErrorCount;
        Counter mGetOpStatusCount;
        Counter mGetOpStatusErrorCount;
        Counter mGetOpStatusKnownCount;
        Counter mLeaseExpiredCount;
        Counter mTimeoutLostCount;
        Counter mLostChunkCount;

        void Clear()
        {
            mAppendCount = 0;
            mAppendByteCount = 0;
            mAppendErrorCount = 0;
            mReplicationErrorCount = 0;
            mReplicationTimeoutCount = 0;
            mAppenderAllocCount = 0;
            mAppenderAllocMasterCount = 0;
            mAppenderAllocErrorCount = 0;
            mWriteIdAllocCount = 0;
            mWriteIdAllocErrorCount = 0;
            mWriteIdAllocNoAppenderCount = 0;
            mSpaceReserveCount = 0;
            mSpaceReserveByteCount = 0;
            mSpaceReserveDeniedCount = 0;
            mSpaceReserveErrorCount = 0;
            mBeginMakeStableCount = 0;
            mBeginMakeStableErrorCount = 0;
            mMakeStableCount = 0;
            mMakeStableErrorCount = 0;
            mMakeStableLengthErrorCount = 0;
            mMakeStableChecksumErrorCount = 0;
            mChecksumErrorCount = 0;
            mReadErrorCount = 0;
            mWriteErrorCount = 0;
            mGetOpStatusCount = 0;
            mGetOpStatusErrorCount = 0;
            mGetOpStatusKnownCount = 0;
            mLeaseExpiredCount = 0;
            mTimeoutLostCount = 0;
            mLostChunkCount = 0;
        }
    };
    AtomicRecordAppendManager();
    ~AtomicRecordAppendManager();
    void    SetParameters(const Properties& props);
    void    AllocateChunk(AllocChunkOp *op, int replicationPos,
        ServerLocation peerLoc, const DiskIo::FilePtr& chunkFileHandle);
    void    AllocateWriteId(WriteIdAllocOp *op, int replicationPos,
        ServerLocation peerLoc, const DiskIo::FilePtr& chunkFileHandle);
    int    GetCleanUpSec()              const { return mCleanUpSec;              }
    int    GetCloseEmptyWidStateSec()   const { return mCloseEmptyWidStateSec;   }
    int    GetFlushIntervalSec()        const { return mFlushIntervalSec;        }
    int    GetSendCommitAckTimeoutSec() const { return mSendCommitAckTimeoutSec; }
    int    GetReplicationTimeoutSec()   const { return mReplicationTimeoutSec;   }
    int    GetMetaMinUptimeSec()        const { return mMinMetaUptimeSec;        }
    int    GetFlushLimit()              const { return mFlushLimit;              }
    double GetBufferLimitRatio()        const { return mBufferLimitRatio;        }
    int    GetMaxWriteIdsPerChunk()     const { return mMaxWriteIdsPerChunk;     }
    bool   IsChunkStable(kfsChunkId_t chunkId) const;
    /// For record appends, (1) clients will reserve space in a chunk and
    /// then write and (2) clients can release their reserved space.
    /// As long as space is reserved on a chunk, the chunkserver will
    /// renew the write lease with the metaserver.
    /// @param[in] chunkId  id of the chunk for which space should be
    ///                     reserved/released
    /// @param[in] nbytes  # of bytes of space reservation/release
    /// @retval status code
    ///
    int    ChunkSpaceReserve(kfsChunkId_t chunkId, int64_t writeId, size_t nBytes, std::string* errMsg = 0);
    int    ChunkSpaceRelease(kfsChunkId_t chunkId, int64_t writeId, size_t nBytes, std::string* errMsg = 0);
    int    InvalidateWriteId(kfsChunkId_t chunkId, int64_t writeId, bool declareFailureFlag = false);
    int    InvalidateWriteIdDeclareFailure(kfsChunkId_t chunkId, int64_t writeId) {
        return InvalidateWriteId(chunkId, writeId, true);
    }
    int64_t GetOpenAppendersCount() const {
        return mOpenAppendersCount;
    }
    int64_t GetAppendersWithWidCount() const {
        return mAppendersWithWidCount;
    }
    bool   IsSpaceReservedInChunk(kfsChunkId_t chunkId);
    int    GetAlignment(kfsChunkId_t chunkId) const;
    bool   CloseChunk(CloseOp* op, int64_t writeId, bool& forwardFlag);
    bool   BeginMakeChunkStable(BeginMakeChunkStableOp* op);
    bool   MakeChunkStable(MakeChunkStableOp* op);
    void   AppendBegin(RecordAppendOp* op, int replicationPos, ServerLocation peerLoc);
    void   GetOpStatus(GetRecordAppendOpStatus* op);
    bool   WantsToKeepLease(kfsChunkId_t chunkId) const;
    void   Timeout();
    void   FlushIfLowOnBuffers();
    void   DeleteChunk(kfsChunkId_t chunkId);
    void   Shutdown();
    size_t GetAppendersCount() const
        { return (size_t)mAppenders.size(); }
    void   GetCounters(Counters& outCounters)
        { outCounters = mCounters; }

    void   UpdateAppenderFlushLimit(const AtomicRecordAppender* appender = 0);
    int    GetFlushLimit(AtomicRecordAppender& appender, int addBytes = 0);
    inline void UpdatePendingFlush(AtomicRecordAppender& appender);
    inline void Detach(AtomicRecordAppender& appender);
    inline void DecOpenAppenderCount();
    inline void IncAppendersWithWidCount();
    inline void DecAppendersWithWidCount();
    inline Counters& Cntrs();

private:
    typedef std::tr1::unordered_map<kfsChunkId_t, AtomicRecordAppender*> ARAMap;

    ARAMap                mAppenders;
    int                   mCleanUpSec;
    int                   mCloseEmptyWidStateSec;
    int                   mFlushIntervalSec;
    int                   mSendCommitAckTimeoutSec;
    int                   mReplicationTimeoutSec;
    int                   mMinMetaUptimeSec;
    int                   mFlushLimit;
    int                   mMaxAppenderBytes;
    int64_t               mTotalBuffersBytes;
    int64_t               mTotalPendingBytes;
    int64_t               mActiveAppendersCount;
    int64_t               mOpenAppendersCount;
    int64_t               mAppendersWithWidCount;
    double                mBufferLimitRatio;
    int                   mMaxWriteIdsPerChunk;
    AtomicRecordAppender* mPendingFlushList[1];
    const uint64_t        mInstanceNum;
    Counters              mCounters;
};

extern AtomicRecordAppendManager gAtomicRecordAppendManager;
}

#endif // CHUNK_ATOMICRECORDAPPENDER_H


text:
package com.google.gapid.widgets;

import com.google.gapid.views.Formatter.LinkableStyledString;
import com.google.gapid.views.Formatter.StylingString;

import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.StyledCellLabelProvider;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.TextLayout;

import java.util.Arrays;

/**
 * A {@link StyledCellLabelProvider} that can be used to measure the size of the label to correctly
 * determine if the the mouse pointer is hovering over a link in the {@link StylingString}.
 */
public abstract class MeasuringViewLabelProvider extends StyledCellLabelProvider {
  private final ColumnViewer viewer;
  private final Theme theme;
  private final TextLayout layout;

  public MeasuringViewLabelProvider(ColumnViewer viewer, Theme theme) {
    this.viewer = viewer;
    this.theme = theme;
    this.layout = new TextLayout(viewer.getControl().getDisplay());
  }

  @Override
  public void dispose() {
    super.dispose();
    layout.dispose();
  }

  @Override
  public void update(ViewerCell cell) {
    // Adjusted from the DelegatingStyledCellLabelProvider implementation.

    StyledString styledString =
        format(cell.getElement(), LinkableStyledString.ignoring(theme)).getString();
    String newText = styledString.toString();

    StyleRange[] oldStyleRanges = cell.getStyleRanges();
    StyleRange[] newStyleRanges = styledString.getStyleRanges();

    if (!Arrays.equals(oldStyleRanges, newStyleRanges)) {
      cell.setStyleRanges(newStyleRanges);
      if (cell.getText().equals(newText)) {
        cell.setText("");
      }
    }
    cell.setImage(getImage(cell.getElement()));
    cell.setText(newText);
  }

  protected Image getImage(@SuppressWarnings("unused") Object element) {
    return null;
  }

  protected abstract <S extends StylingString> S format(Object element, S string);

  public Object getFollow(Point point) {
    ViewerCell cell = viewer.getCell(point);
    if (cell == null || !isFollowable(cell.getElement())) {
      return null;
    }

    LinkableStyledString string = format(cell.getElement(), LinkableStyledString.create(theme));
    string.endLink();
    string.append("dummy", string.defaultStyle());
    updateLayout(cell, string.getString());

    Rectangle bounds = cell.getTextBounds();
    int offset = layout.getOffset(point.x - bounds.x, point.y - bounds.y, null);
    return string.getLinkTarget(offset);
  }

  protected abstract boolean isFollowable(Object element);

  private void updateLayout(ViewerCell cell, StyledString string) {
    // Adjusted from similar method from super class.
    layout.setStyle(null, 0, Integer.MAX_VALUE);
    layout.setText(string.toString());

    for (StyleRange range : cell.getStyleRanges()) {
      layout.setStyle(range, range.start, range.start + range.length - 1);
    }
  }
}


text:
package org.apache.fineract.accounting.producttoaccountmapping.data;

import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;

public class PaymentTypeToGLAccountMapper {

    @SuppressWarnings("unused")
    private final PaymentTypeData paymentType;
    @SuppressWarnings("unused")
    private final GLAccountData fundSourceAccount;

    public PaymentTypeToGLAccountMapper(final PaymentTypeData paymentType, final GLAccountData fundSourceAccount) {
        this.paymentType = paymentType;
        this.fundSourceAccount = fundSourceAccount;
    }

}


text: There's nothing to see here!


text:
<?php

namespace security\Models\Authenticator;

require_once(dirname(dirname(dirname(__DIR__))). DIRECTORY_SEPARATOR . 'public/init.php');

class PasswordCheck
{
    public function __construct($password)
    {
        $this->password = $password;
    }
    public function needsNewHash()
    {
        if (password_needs_rehash($this->password, PASSWORD_DEFAULT)) {
            return true;
        }
        return false;
    }
    public function makeHash()
    {
        $this->password = password_hash($this->password, PASSWORD_DEFAULT);
        return $this->password;
    }
}


text:
module LobbyTypes where
import qualified Control.Concurrent as CC
import Haste.App

type Name = String
type Player = (SessionID, Name)
type PlayerList = CC.MVar [Player]

type LobbyGame = (String, [Player])
type GamesList = CC.MVar [LobbyGame]


text:
layout: post
title: "Extracting data out of Excel Files using Azure Batch and Azure Data Factory"
modified:
categories: blog
excerpt:
tags: ['Azure', 'AzureBatch', 'AzureDataFactory']
image:
  feature:
date: 2016-05-14T00:00:00-05:00
share: true,
comments: true
---

Sometimes you have a requirement to get data out of Excel files as part of your data ingestion process. Perhaps the business users create reports in Excel and then send them to you on a regular basis. Unfortunately though, there is not always a great mechanism to extract data out of Excel files, especially if you want to use the data as part of a data processing pipeline with Azure Data Factory. In this post I outline an approach to leverage and extract data out of Excel files as part of an Azure Data Factory pipeline.

Imagine the following scenario: on a daily basis reports are created by the business team in Excel and dropped into an Azure Storage account. Each report contain two sheets - Orders and Customers. The Orders sheet contains the details of the orders for the day and the customer id of the customer who purchased them. The Customers sheet contains the customer details for that day. For this scenario we want to extract just the orders sheet to a CSV file as we already have the customers stored in our data warehouse. Here is the input file:

![Input Excel File]({{ site.images }}/adf-excel/input_excel.png)

In building this pipeline we will have two datasets - one input which will be the Excel file and one output that will be the CSV. I will use Azure Batch and a custom .net task to extract out the data from the input file and convert it into CSV.

![Completed Data Factory Pipeline]({{ site.images }}/adf-excel/pipeline_diagram.png)

The custom .net code to extract data out of the Excel file uses the [Microsoft.ACE.OLEDB.12.0 provider](https://www.microsoft.com/en-us/download/details.aspx?id=13255) to open a connection to the Excel data and pull it in for conversion. Since this activity will run on nodes within Azure Batch as part of an Azure Data Factory activity you have to implement the **Execute** method from the [IDotNetActivity interface](https://msdn.microsoft.com/en-us/library/microsoft.azure.management.datafactories.runtime.idotnetactivity.aspx). When Data Factory executes this activity it will pass in a couple of parameters such as the input and output datasets.

To get started, create a .NET Class Library project and add the code to do the conversion. Here is my full code:

<script src="https://gist.github.com/johndehavilland/703835cff8f406cc8f7344f78c561f76.js"></script>

After you have created your class, build it and then go to the build output folder and zip up all the dlls and upload to your Azure Storage account. Note that you have to zip it at the file level and not the output folder level.

Next you need to [create an Azure Batch service](https://azure.microsoft.com/en-us/documentation/articles/batch-account-create-portal/). Once the service is created you will need to create a pool to use. This pool will contain the compute nodes to run the activity. For this process, each node will need the Microsoft.ACE.OLEDB.12.0 provider to be installed. The best way to do this is to add the installation as a startup task for each node. This way, whenever a node is spun up it will first install the provider.

You can [download the provider here](https://www.microsoft.com/en-us/download/details.aspx?id=13255) (use the 64 bit one) and then upload to an Azure Storage account container. This will either need to be publicly accessible or use a Shared Access Signature URI.

Below are the steps to create your Azure Batch pool.

1. Download and run the [Azure Batch Explorer](https://github.com/Azure/azure-batch-samples/tree/master/CSharp/BatchExplorer).
2. Connect to your Azure Batch Service in the Batch Explorer. (This will require you to build the Batch Explorer project).
3. Create a pool within your batch service using the Batch Explorer tool. In the add pool options make sure to set the following
    * Check **Run Elevated**
    * Enter this as the **Command Line**: AccessDatabaseEngine_x64.exe /quiet /passive
    * Enter this as **Resource Files**: _<URL TO AccessDatabaseEngine_x64.exe file in Storage> => AccessDatabaseEngine_x64.exe_

![Azure Batch Pool Creation]({{ site.images }}/adf-excel/azure_batch_pool_creation.png)

Now connect your Batch Service to your Data Factory as a linked service. Create a custom activity in your data factory pipeline and point the type properties to the package location and make sure to enter the dll name and namespace.classname of the entry point. [See here](https://azure.microsoft.com/en-us/documentation/articles/data-factory-use-custom-activities/) for more details on how to do this. Make sure to add the input and output datasets to the activity.

You can then sit back and watch your datafactory pipeline execute and convert your incoming Excel files into CSV. Don't forget to flag the input dataset as external via the "external":"true" property. The resulting CSV looks like this:

![Resulting CSV File]({{ site.images }}/adf-excel/output_csv.png)

As you can see, this was a simple use case that could easily be extended to more complex scenarios.


text:
import argparse
from target_interaction_finder import TargetInteractionFinder

def main():

    parser = argparse.ArgumentParser(
        description='''Extract subgraph(s) from XGMML network(s).''')
    parser.add_argument('ids',
                        type=str,
                        help='identifier or file path to identifier list')
    parser.add_argument('-c', '--column',
                        default=1,
                        type=int,
                        help='''column number for identifiers in identifier list file
                        (default = 1)''')
    parser.add_argument('-s', '--source',
                        default='./source_xgmml/',
                        help='''source file or directory path(s) to database XGMML
                        (default = directory named "source_xgmml"
                            in current working directory)''')
    parser.add_argument('-t', '--type',
                        default='rna',
                        help='input type (rna or protein; default = rna)')
    parser.add_argument('-o', '--output',
                        default='./',
                        help='''output directory path
                        (default = current working directory)''')
    """
    parser.add_argument('--cache',
                        default=True,
                        type=bool,
                        help='''Cache source_xgmml graph(s) and use in
                        subsequent runs to reduce parse time
                        (default = True)''')
    """
    parser.add_argument('-d', '--debug',
                        default=False,
                        type=bool,
                        help='Show debug messages (default = False)')
    args = parser.parse_args()

    node_ids = args.ids
    source_xgmml = args.source
    node_id_list_column_index = args.column - 1
    node_type = args.type
    output_dir = args.output
    #cache = args.cache
    cache = True
    debug = args.debug

    return TargetInteractionFinder(
        source_xgmml=source_xgmml,
        node_ids=node_ids,
        node_id_list_column_index=node_id_list_column_index,
        node_type=node_type,
        output_dir=output_dir,
        cache=cache,
        debug=debug)

if __name__ == '__main__':
    main()


text:
import { ChartComponent } from '../../chart.component';
import { ChangeDetectorRef } from '@angular/core';
import { Component, ElementRef, HostListener,
  OnChanges, OnInit, SimpleChange } from '@angular/core';
import * as d3 from 'd3';
import * as _ from 'lodash';

@Component({
    selector: 'chain-transition',
    template: `<ng-content></ng-content>`,
    styleUrls: ['chain-transition.component.scss']
})
export class ChainTransitionComponent implements ChartComponent, OnInit, OnChanges {

  public options: any;

  public _data: any[];

  private width;
  private height;
  private navContainerHeight: number = 50;
  private navHeight: number;
  private navMarginTop: number = 20;
  private navMarginBottom: number = 10;
  private margin;
  private xScale;
  private yScaleLeft;
  private yScaleRight;
  private navYScale;
  private htmlElement: HTMLElement;
  private parentElement: any;
  private host: any;
  private chart: any;
  private visCont: any;
  private xAxis: any;
  private yAxis1: any;
  private yAxis2: any;
  private priceLine: any;
  private resizeChart: () => void;
  private navChart: any;
  private navVisCont: any;
  private navXAxis: any;
  private navYAxis1: any;
  private navPriceLine: any;
  private wholeChartVisibleHeight: number;
  private navChartBrush;

  constructor(private el: ElementRef, private cdRef: ChangeDetectorRef) {
    this.htmlElement = this.el.nativeElement;
    // this.parentElement = this.htmlElement.parentElement;
    this.host = d3.select(this.htmlElement);
    this.resizeChart = this.makeResizeChart();
  }

  public set data(val: any) {
    this.cdRef.markForCheck();
    this._data = val;
    this.render();
  }

  public get data() {
    return this.data;
  }

  public ngOnInit() {
    this.initChart();
    // this.render();
  }

  public ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
    if (this._data) {
      this.render();
    }
  }

  @HostListener('window:resize', ['$event'])
  public onResize(event) {
    this.resizeChart();
  }

  public render() {
    if (this._data) {
      this.setup();
      this.renderMain();
      this.renderNav();
    }
  }

  private initChart() {
    this.initMainChart();
    this.initNavChart();
  }

  private initMainChart() {
    this.chart = this.host.append('svg').attr('class', 'chart main');
    this.visCont = this.chart.append('g').attr('class', 'vis main');
    this.xAxis = this.visCont.append('g').attr('class', 'x axis main');
    this.yAxis1 = this.visCont.append('g').attr('class', 'y axis main');
    this.yAxis1
      .append('text')
      // .attr('transform', 'rotate(0)')
      .attr('y', -15)
      .attr('x', 30)
      .attr('dy', '.71em')
      .style('text-anchor', 'end')
      .text('Volume');
    this.yAxis2 = this.visCont.append('g').attr('class', 'y y2 axis main');
    this.yAxis2
      .append('text')
      // .attr('transform', 'rotate(-90)')
      .attr('y', -15)
      .attr('dy', '.71em')
      .style('text-anchor', 'end')
      .text('Price ($)');
    this.priceLine = this.visCont.append('path').attr('class', 'price line main');
  }

  private initNavChart() {
    this.navChart = this.host.append('svg').attr('class', 'chart nav');
    this.navVisCont = this.navChart.append('g').attr('class', 'vis nav');
    this.navXAxis = this.navVisCont.append('g').attr('class', 'x axis nav');
    this.navYAxis1 = this.navVisCont.append('g').attr('class', 'y axis nav');
    this.navYAxis1
      .append('text')
      // .attr('transform', 'rotate(0)')
      .attr('y', -15)
      .attr('x', 30)
      .attr('dy', '.71em')
      .style('text-anchor', 'end')
      .text('Volume');
    this.navPriceLine = this.navVisCont.append('path').attr('class', 'price line nav');
    this.navChartBrush = this.navVisCont.append('g').attr('class', 'brush');
  }

  private renderMain() {
    this.chart
      .attr('width', this.width + this.options.margin.left + this.options.margin.right)
      .attr('height',
          this.height + this.options.margin.top + this.options.mainChart.margin.bottom);
      // .attr('height',
      //     this.height + this.config.margin.top);
    this.visCont
      .attr('transform', 'translate(' +
        this.options.margin.left + ',' + this.options.margin.top + ')');
    this.yAxis2
      .attr('transform', 'translate(' + this.width + ' ,0)');
    const xAxis = d3.axisBottom(this.xScale);
    const yAxisLeft = d3.axisLeft(this.yScaleLeft);
    const yAxisRight = d3.axisRight(this.yScaleRight);
    const line = d3.line<{asOf: any, px: any}>()
      .x((d) => this.xScale(d.asOf))
      .y((d) => this.yScaleRight(d.px));
    this.xScale.domain([this._data[0].asOf, _.last(this._data).asOf]);
    this.yScaleLeft.domain(d3.extent(this._data, (d) => d.deltaVol));
    this.yScaleRight.domain(d3.extent(this._data, (d) => d.px));
    this.xAxis.attr('transform', 'translate(0,' + this.height + ')')
      .call(xAxis);

    this.yAxis1
      .call(yAxisLeft);
    this.yAxis2
      .call(yAxisRight);

    this.priceLine.attr('d', line(this._data));
  }

  private renderNav() {
    this.navChart
      .attr('width', this.width + this.options.margin.left + this.options.margin.right)
      // .attr('height', this.navHeight + this.navMarginTop + this.navMarginBottom);
      .attr('height', this.navHeight + this.options.margin.bottom);
    this.navVisCont
      .attr('transform', 'translate(' +
        this.options.margin.left + ',' + 0 + ')');
    this.navYAxis1
      .attr('transform', 'translate(' + this.width + ' ,0)');
    const xAxis = d3.axisBottom(this.xScale);
    const yAxisLeft = d3.axisLeft(this.navYScale);
    const line = d3.line<{asOf: any, deltaVol: any}>()
      .x((d) => this.xScale(d.asOf))
      .y((d) => this.navYScale(d.deltaVol));
    this.xScale.domain([this._data[0].asOf, _.last(this._data).asOf]);
    this.navYScale.domain(d3.extent(this._data, (d) => d.deltaVol));
    this.navXAxis.attr('transform', 'translate(0,' + this.navHeight + ')')
      .call(xAxis);

    this.navYAxis1
      .call(yAxisLeft);

    this.navPriceLine.attr('d', line(this._data));
    this.navChartBrush.call(d3.brush().on('end', () => {
      console.log('brush');
    }));
  }

  private setup(): void {
    this.parentElement = this.parentElement || this.el.nativeElement.parentElement;
    this.width = this.parentElement.clientWidth -
      this.options.margin.left - this.options.margin.right - 15;
    this.wholeChartVisibleHeight =
      this.parentElement.clientHeight -
      this.options.margin.top -
      this.options.mainChart.margin.bottom;
    // this.height = Math.floor(this.wholeChartVisibleHeight *
    //   (this.config.mainChart.heightPct / 100));
    this.height = Math.floor(this.parentElement.clientHeight *
       (this.options.mainChart.heightPct / 100)) -
      this.options.margin.top -
      this.options.mainChart.margin.bottom;
    // this.height = this.parentElement.clientHeight -
    //   this.config.margin.top - this.navContainerHeight;
    // this.navHeight = this.navContainerHeight - this.navMarginBottom - this.navMarginTop;
    this.navHeight = Math.floor(this.parentElement.clientHeight *
       (this.options.navChart.heightPct / 100)) -
      this.options.margin.bottom;
    // this.navHeight = this.navContainerHeight - this.navMarginBottom;
    this.xScale = d3.scaleTime().range([0, this.width]);
    this.yScaleLeft = d3.scaleLinear().range([this.height, 0]);
    this.yScaleRight = d3.scaleLinear().range([this.height, 0]);
    this.navYScale = d3.scaleLinear().range([this.navHeight, 0]);
  }

  private makeResizeChart = () => {
    return _.debounce(() => {
      this.render();
    }, 200);
  }

}


text:
<!DOCTYPE html>

        <meta charset="utf-8" />
        <link href="../../assets/lib/normalize/normalize.css" rel="stylesheet" />
        <link href="../../assets/fonts/font-awesome.css" rel="stylesheet" />
        <link href="../../assets/fonts/open-sans.css" rel="stylesheet" />
        <link href="../../assets/css/main.css" rel="stylesheet" />
        <link href="../assets/css/clicktodial.css" rel="stylesheet" />

                ?


text:
require 'bundler/setup'

require 'rmagick/screwdrivers'

require 'coveralls'
Coveralls.wear!

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|

end


text:
<?php

defined('_JEXEC') or die;

?>
<a class="btn" type="button" onclick="document.getElementById('batch-category-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-dismiss="modal">
	<?php echo JText::_('JCANCEL'); ?>
</a>
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('category.batch');">
	<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>


text:
"""
 example of how2use batchOpenMPI, with lastProcessBatch=True to avoid process being tied down unessarcyilly
"""

import batchOpenMPI, time
def randomPause_base(pause) :
    time.sleep(pause)
randomPause = batchOpenMPI.batchFunction(randomPause_base)

batchOpenMPI.begin_MPI_loop()
print('lastProcessBatch=True example/test')
pauses = [1,3]
for pause in pauses :
    randomPause.addtoBatch(pause)
batchOpenMPI.processBatch(lastProcessBatch=True)
for pause in pauses:
    randomPause(pause)

batchOpenMPI.end_MPI_loop(print_stats=True)

print('The first worker should have exited before the last worker, and spent less time processing')


text:
title: Getting Started
date: "2018-08-28T22:30:00.000Z"
---

Why is getting started so damn hard?

Setting up this blog has been on my backlog for way too long. I've been procrastinating on this task
for longer than I'd like to admit, and I've gotten extremely good at finding excuses for not to do it.

But today is the day. I'm determined to not let the day end before publishing these words out to the interwebs.

Unfortunately, it's almost 11pm and I'm running out of time, so I won't be able to write a big inspirational essay
on the meaning of life and the secret of happiness. Instead, I'll leave you with one of my favorite **Mark Twain** quotes;
which is not only way better than anything I could ever write, but also seemed particularly appropriate for the occasion.

> **The secret of getting ahead is getting started.**
> The secret of getting started is breaking your complex overwhelming
> tasks into small manageable tasks, and starting on the first one.
> #### Mark Twain


text:
'use strict';

module.exports = {
	db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/svensicabiggestloser-dev',
	assets: {
		lib: {
			css: [
				'public/lib/bootstrap/dist/css/bootstrap.min.css',
				'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
				'public/lib/nvd3/nv.d3.css'
			],
			js: [
				'public/lib/angular/angular.min.js',
				'public/lib/angular-resource/angular-resource.js',
				'public/lib/angular-ui-router/release/angular-ui-router.min.js',
				'public/lib/angular-ui-utils/ui-utils.min.js',
				'public/lib/angular-sanitize/angular-sanitize.js',
				'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
				'public/lib/socket.io-client/socket.io.js'
			]
		},
		css: 'public/dist/application.min.css',
		js: 'public/dist/application.min.js'
	},
	facebook: {
		clientID: process.env.FACEBOOK_ID || 'APP_ID',
		clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/facebook/callback'
	},
	twitter: {
		clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
		clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
		callbackURL: 'http://localhost:3000/auth/twitter/callback'
	},
	google: {
		clientID: process.env.GOOGLE_ID || 'APP_ID',
		clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/google/callback'
	},
	linkedin: {
		clientID: process.env.LINKEDIN_ID || 'APP_ID',
		clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/linkedin/callback'
	}
};


text:
SegmentBase::SegmentBase(std::string text_in):
myText(text_in)
{
}

SegmentBase::~SegmentBase()
{
}


text:
/**
 *
 */
package com.github.nest.quelea.codes;

import com.github.nest.arcteryx.data.internal.codes.AbstractConstantedCodeTable;
import com.github.nest.arcteryx.data.internal.codes.annotation.CodeTableRegistration;

/**
 * marital status
 *
 * @author brad.wu
 */
@CodeTableRegistration(name = MaritalStatus.CODE_TABLE_NAME)
public class MaritalStatus extends AbstractConstantedCodeTable {
	private static final long serialVersionUID = -8688577447140512608L;
	public static final String CODE_TABLE_NAME = "MaritalStatus";

	public static final String MARRIED = "M";
	public static final String SINGLE = "S";

	/**
	 * (non-Javadoc)
	 *
	 * @see com.github.nest.arcteryx.data.internal.codes.AbstractConstantedCodeTable#createCodes()
	 */
	@Override
	protected String[] createCodes() {
		return new String[] { MARRIED, SINGLE };
	}
}


text:
function getHeatmap(tab) {

    var url = "/dashboard/data/heatmap?" + window.location.hash.substring(1);
    getData(url, tab).done(function (heatMapData) {

        var templatePlaceHolder;
        switch(tab){
            case "anomalies":
                templatePlaceHolder = $("#anomaly-details-heatmap-placeholder");
            break;
            default: //case heatmap
                templatePlaceHolder = $("#" + tab + "-display-chart-section")
        }

        renderD3heatmap(heatMapData, tab, templatePlaceHolder);

        heatMapEventListeners(tab);
        hideLoader(tab);

        var summaryUrl = "/dashboard/summary/autoDimensionOrder?" +
            "dataset=" + hash.dataset +
            "&baselineStart=" + hash.baselineStart +
            "&baselineEnd=" + hash.baselineEnd +
            "&currentStart=" + hash.currentStart +
            "&currentEnd=" + hash.currentEnd +
            "&dimensions=" + hash.dimensions +
            "&filters=" + hash.filters +
            "&topDimensions=3" +
            "&oneSideError=false" +
            "&summarySize=10" +
            "&hierarchies=[[\"browser_name\", \"browser_version\"],[\"continent\",\"countryCode\"]]"
        var metrics = hash.metrics.split(",")
        for (var index = 0, len = metrics.length; index < len; index++) {
            getSummaryData(summaryUrl, tab)
        }

        function getSummaryData(summaryUrl, tab){
            summaryUrl += "&metric=" + metrics[index];
            getDataCustomCallback(summaryUrl, tab).done(function (data) {
                var summaryData = data;
                renderHeatMapSummary(summaryData);
            })
        }
    });
};

function renderD3heatmap(data, tab, templatePlaceHolder) {
    //Error handling when data is falsy (empty, undefined or null)
    if (!data) {
        $("#" + tab + "-chart-area-error").empty()
        var warning = $('

', { class: 'uk-alert uk-alert-warning' })
        warning.append($('

', { html: 'Something went wrong. Please try and reload the page. Error: data =' + data  }))
        $("#" + tab + "-chart-area-error").append(warning)
        $("#" + tab + "-chart-area-error").show()
        return
    } else {
        $("#" + tab + "-chart-area-error").hide()
    }

    /* Handelbars template for treemap table */
    var templateData = {heatMapData : data}
    var result_treemap_template = HandleBarsTemplates.template_treemap(templateData)
    templatePlaceHolder.html(result_treemap_template);

    //var invertColorMetrics
    var baseForLtZero = 'rgba(255,0,0,'; //lt zero is default red
    var baseForGtZero = 'rgba(0,0,255,'; //gt zero is default blue
    var invertColorMetrics = window.datasetConfig.invertColorMetrics;

    var numMetrics = data["metrics"].length;
    for (var m = 0; m < numMetrics; m++) {
        var metric = data["metrics"][m];

        var numDimensions = data["dimensions"].length
        for (var d = 0; d < numDimensions; d++) {
            var dimension = data["dimensions"][d];

            var dimensionData = data["data"][metric + "." + dimension]["responseData"]
            var schema = data["data"][metric + "." + dimension]["schema"]["columnsToIndexMapping"]

            //PARSE DATA
            var root_0 = {}
            var root_1 = {}
            var root_2 = {}
            root_0.name = dimension;
            root_1.name = dimension;
            root_2.name = dimension;

            root_0.metric = metric;
            root_1.metric = metric;
            root_2.metric = metric;
            if (typeof invertColorMetrics !== "undefined" && invertColorMetrics.indexOf(metric) > -1) { // invert
                baseForLtZero = 'rgba(0,0,255,'; //lt zero becomes blue
                baseForGtZero = 'rgba(255,0,0,'; //gt zero becomes red
            }

            var children_0 = [];
            var children_1 = [];
            var children_2 = [];
            var numDimValues = dimensionData.length;
            for (valId = 0; valId < numDimValues; valId++) {

                var dimensionValue = dimensionData[valId][schema["dimensionValue"]]
                //Todo: remove this "" handler once backend is adding it to other
                if (dimensionValue == "") {
                    dimensionValue = "UNKNOWN";
                }
                ;

                var color_0 = parseFloat(dimensionData[valId][schema["deltaColor"]]); //percentageChange
                var color_1 = parseFloat(dimensionData[valId][schema["contributionColor"]]); //baselineContribution
                var color_2 = parseFloat(dimensionData[valId][schema["contributionToOverallColor"]]); // contributionToOverallChange

                var delta_0 = parseFloat(dimensionData[valId][schema["percentageChange"]]);
                var delta_1 = parseFloat(dimensionData[valId][schema["contributionDifference"]]);
                var delta_2 = parseFloat(dimensionData[valId][schema["contributionToOverallChange"]]);

                var opacity_0 = parseFloat(Math.abs(Math.round(color_0)) / 25);
                var opacity_1 = parseFloat(Math.abs(Math.round(color_1)) / 25);
                var opacity_2 = parseFloat(Math.abs(Math.round(color_2)) / 25);

                var fontColor_0 = opacity_0 < 0.3 ? '#000000' : '#ffffff';
                var fontColor_1 = opacity_1 < 0.3 ? '#000000' : '#ffffff';
                var fontColor_2 = opacity_2 < 0.3 ? '#000000' : '#ffffff';

                var backgroundColor_0 = Math.round(color_0) < 0 ? baseForLtZero + opacity_0 + ")" : ( Math.round(color_0) > 0 ? baseForGtZero + opacity_0 + ")" : "rgba(221,221,221,1)");
                var backgroundColor_1 = Math.round(color_1) < 0 ? baseForLtZero + opacity_1 + ")" : ( Math.round(color_1) > 0 ? baseForGtZero + opacity_1 + ")" : "rgba(221,221,221,1)");
                var backgroundColor_2 = Math.round(color_2) < 0 ? baseForLtZero + opacity_2 + ")" : ( Math.round(color_2) > 0 ? baseForGtZero + opacity_2 + ")" : "rgba(221,221,221,1)");

                var label_0 = delta_0 <= 0 ? dimensionValue + " (" + delta_0 + "%)" : dimensionValue + " (+" + delta_0 + "%)";
                var label_1 = delta_1 <= 0 ? dimensionValue + " (" + delta_1 + "%)" : dimensionValue + " (+" + delta_1 + "%)";
                var label_2 = delta_2 <= 0 ? dimensionValue + " (" + delta_2 + "%)" : dimensionValue + " (+" + delta_2 + "%)";

                var size = parseFloat(dimensionData[valId][schema["deltaSize"]]);

                children_0.push({ "name": dimensionValue, "size": size, "label": label_0, "bgcolor": backgroundColor_0, "color": fontColor_0, "valueId": valId, "tooltip": tooltip});
                children_1.push({ "name": dimensionValue, "size": size, "label": label_1, "bgcolor": backgroundColor_1, "color": fontColor_1, "valueId": valId, "tooltip": tooltip});
                children_2.push({ "name": dimensionValue, "size": size, "label": label_2, "bgcolor": backgroundColor_2, "color": fontColor_2, "valueId": valId, "tooltip": tooltip});

            }
            root_0.children = children_0;
            root_1.children = children_1;
            root_2.children = children_2;

            //CHART LAYOUT
            var margin = {top: 0, right: 0, bottom: 5, left: 0};
            var width = 0.65 * window.innerWidth;
            var height = window.innerHeight * 0.7 / numDimensions;

            var placeholder_0 = '#metric_' + metric + '_dim_' + d + '_treemap_0'
            var placeholder_1 = '#metric_' + metric + '_dim_' + d + '_treemap_1'
            var placeholder_2 = '#metric_' + metric + '_dim_' + d + '_treemap_2'

            var mousemove = function (d) {

                var tooltipWidthPx = $("#tooltip").css("width");
                var tooltipHeightPx = $("#tooltip").css("height");
                var tooltipWidth = tooltipWidthPx.substring(0, tooltipWidthPx.length - 2);

                var target = $(this);
                var dimension = target.attr("data-dimension");
                var metric = target.attr("data-metric");
                var valueId = target.attr("data-value-id");
                var value = target.attr("id");

                var treemapOffset = $($(".dimension-treemap")[0]).offset();

                var tooltipHeightOffset = parseInt(tooltipHeightPx.substring(0, tooltipHeightPx.length - 2)) / 2;
                var tooltipWidthOffset = tooltipWidth / 2;

                var directionX = d3.event.pageX - treemapOffset.left < (window.innerWidth - treemapOffset.left) / 2 ? "-1" : "1";
                var directionY = d3.event.pageY - treemapOffset.top < window.innerHeight / 2 ? "-1" : "1";
                var distanceFromMousePointer = 50;

                var xPosition = d3.event.pageX - treemapOffset.left - directionX * (tooltipWidthOffset + distanceFromMousePointer);
                var yPosition = d3.event.pageY - (tooltipHeightOffset + distanceFromMousePointer);

                var dimData = data["data"][metric + "." + dimension]["responseData"]

                var cellSizeExpression = dimData[valueId][schema["cellSizeExpression"]];

                d3.select("#tooltip")
                    .style("left", xPosition + "px")
                    .style("top", yPosition + "px");

                d3.select("#tooltip #dim-value")
                    .text(value);

                d3.select("#tooltip #delta").text(dimData[valueId][schema["percentageChange"]] + '%');
                d3.select("#tooltip #baseline-contribution").text(dimData[valueId][schema["baselineContribution"]]);
                d3.select("#tooltip #current-contribution").text(dimData[valueId][schema["currentContribution"]]);
                d3.select("#tooltip #contribution-diff").text(dimData[valueId][schema["contributionDifference"]] + '%');

                if (cellSizeExpression != null && undefined != cellSizeExpression) {
                    var cellSizeExpressionDisplay = dimData[valueId][schema["deltaSize"]] + " (" + cellSizeExpression + ")";
                    d3.select("#tooltip #baseline-value").text(dimData[valueId][schema["baselineValue"]] + " (" + dimData[valueId][schema["numeratorBaseline"]] + "/" + dimData[valueId][schema["denominatorBaseline"]] + ")");
                    d3.select("#tooltip #current-value").text(dimData[valueId][schema["currentValue"]] + " (" + dimData[valueId][schema["numeratorCurrent"]] + "/" + dimData[valueId][schema["denominatorCurrent"]] + ")");
                    d3.select("#tooltip #cell-size").text(cellSizeExpressionDisplay);
                } else {
                    d3.select("#tooltip #baseline-value").text(dimData[valueId][schema["baselineValue"]]);
                    d3.select("#tooltip #current-value").text(dimData[valueId][schema["currentValue"]]);
                }
                d3.select("#tooltip").classed("hidden", false);
            };

            var mouseleave = function () {
                d3.select("#tooltip").classed("hidden", true);
            };

            //DRAW TREEMAP
            function drawTreemap(root, placeholder) {
                var treemap = d3.layout.treemap()
                    .size([width, height])
                    .sticky(true)
                    .sort(function (a, b) {
                        return a.value - b.value;
                    })
                    .value(function (d) {
                        return d.size;
                    });

                var div = d3.select(placeholder).append("div")
                    .style("position", "relative")
                    .style("width", width + "px")
                    .style("height", (height + margin.top + margin.bottom) + "px")
                    .style("left", margin.left + "px")
                    .style("top", margin.top + "px");

                var node = div.datum(root).selectAll(".node")
                    .data(treemap.nodes)
                    .enter().append("div")
                    .attr("class", "node")
                    .attr("data-dimension", function (d) {
                        return root.name
                    })
                    .attr("data-metric", function (d) {
                        return root.metric
                    })
                    .attr("data-value-id", function (d) {
                        return d.valueId
                    })
                    .attr("id", function (d) {
                        return d.name
                    })
                    .on("mousemove", mousemove)
                    .on("mouseout", mouseleave)
                    .call(position)
                    .style("background", function (d) {
                        return d.children ? null : d.bgcolor
                    })
                    .style("text-align", "center")
                    .style("color", function (d) {
                        return d.color
                    })
                    .style("font-size", "12px")
                    .style("display", "flex")
                    .style("align-items", "center")
                    .style("justify-content", "center")
                    .text(function (d) {
                        return d.children ? null : d.label
                    });

                function position() {
                    this.style("left", function (d) {
                        return d.x + "px";
                    })
                        .style("top", function (d) {
                            return d.y + "px";
                        })
                        .style("width", function (d) {
                            return Math.max(0, d.dx - 1) + "px";
                        })
                        .style("height", function (d) {
                            return Math.max(0, d.dy - 1) + "px";
                        });
                }
            }

            drawTreemap(root_0, placeholder_0)
            drawTreemap(root_1, placeholder_1)
            drawTreemap(root_2, placeholder_2)
        }
    }
}

function renderHeatMapSummary(summaryData){
    var data = {summaryData : summaryData}
    var result_treemap_summary_template = HandleBarsTemplates.template_treemap_summary(data)
    if (summaryData.responseRows == 0) {
        var warning = $('

', { class: 'uk-alert uk-alert-warning' })
        warning.append($('

', { html: 'Data is not complete (e.g., Pinot segment is missing)'
        + ' in order to explain the difference.'}))
        $("#difference-summary-" + summaryData.metricName).html(
            result_treemap_summary_template).append(warning)
    } else {
        $("#difference-summary-" + summaryData.metricName).html(result_treemap_summary_template);
    }

    //Create dataTable instance of summary table
    $("#heat-map-" + summaryData.metricName +"-difference-summary-table").DataTable({
        "bSort" : false
    });
    $("#heat-map-" + summaryData.metricName +"-gainer-summary-table").DataTable({
        "order": [[ 7, "desc" ]]
    });
    $("#heat-map-" + summaryData.metricName +"-loser-summary-table").DataTable({
        "order": [[ 7, "desc" ]]
    });
}

function heatMapEventListeners(tab) {
    //Treemap eventlisteners

    $(".dimension-treemap-mode").click(function () {

        var currentMode = $(this).attr('mode');
        var currentMetricArea = $(this).closest(".dimension-heat-map-treemap-section");

        // Display related treemap
        $(".treemap-container", currentMetricArea).hide();
        $($(".treemap-container", currentMetricArea)[currentMode]).show();

        //Change icon on the radio buttons
        $('.dimension-treemap-mode i', currentMetricArea).removeClass("uk-icon-eye");
        $('.dimension-treemap-mode i', currentMetricArea).addClass("uk-icon-eye-slash");
        $('i', this).removeClass("uk-icon-eye-slash");
        $('i', this).addClass("uk-icon-eye");
    });

    //Set initial view

    //Preselect treeemap mode on pageload (mode 0 = Percentage Change)
    $(".dimension-treemap-mode[mode = '0']").click()

    //Indicate baseline total value increase/decrease with red/blue colors next to the title of the table and the treemap
    $(".title-box .delta-ratio, .title-box .delta-value").each(function (index, currentDelta) {

        var delta = $(currentDelta).html().trim().replace(/[\$,]/g, '') * 1

        if (delta != 0 && !isNaN(delta)) {
            var color = delta > 0 ? "blue plus-symbol" : "red"

            $(currentDelta).addClass(color)
        }
    })

    //Clicking a hetamap cell should fix the value in the filter
    $("#" + tab + "-display-chart-section").on("click", "div.node", function () {

        var dimensionValue = $(this).attr("id");
        if (dimensionValue.toLowerCase() == "other" || dimensionValue.toLowerCase() == "unknown") {
            alert("'Other' or 'unknown' value cannot be the filter.");
        } else {

            var dimension = $(this).attr("data-dimension")
            var filters = readFiltersAppliedInCurrentView(hash.view);
            filters[dimension] = [dimensionValue];

            updateFilterSelection(filters);

            hash.filters = encodeURIComponent(JSON.stringify(filters));
            hash.aggTimeGranularity = "aggregateAll";

            //update hash will trigger window.onhashchange event:
            //update the form area and trigger the ajax call
            window.location.hash = encodeHashParameters(hash);
        }
    })

}


text:
from collections import defaultdict
import crafts.scaler
import uuid

class NullScaler(crafts.scaler.ScalerDriver):
    def __init__(self, cluster=defaultdict(list)):
        self.cluster = cluster

    def scale_up(self, role, count):
        for _ in xrange(count):
            self.cluster[role].append(str(uuid.uuid4()))

    def scale_down(self, role, count):
        self.cluster[role] = self.cluster[role][:-count]

    def describe_cluster(self):
        return self.cluster


text:
package main

import (
	"fmt"
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
)

var spool = filepath.Join(os.TempDir(), "godep")

var cmdGo = &Command{
	Usage: "go command [arguments]",
	Short: "run the go tool in a sandbox",
	Long: `
Go runs the go tool in a temporary GOPATH sandbox
with the dependencies listed in file Godeps.

Any go tool command can run this way, but "godep go get"
is unnecessary and has been disabled. Instead, use
"godep go install".
`,
	Run: runGo,
}

// Set up a sandbox and run the go tool. The sandbox is built
// out of specific checked-out revisions of repos. We keep repos
// and revs materialized on disk under the assumption that disk
// space is cheap and plentiful, and writing files is slow.
// Everything is kept in the spool directory.
func runGo(cmd *Command, args []string) {
	gopath := prepareGopath()
	if s := os.Getenv("GOPATH"); s != "" {
		gopath += string(os.PathListSeparator) + os.Getenv("GOPATH")
	}
	if len(args) > 0 && args[0] == "get" {
		log.Printf("invalid subcommand: %q", "go get")
		fmt.Fprintln(os.Stderr, "Use 'godep go install' instead.")
		fmt.Fprintln(os.Stderr, "Run 'godep help go' for usage.")
		os.Exit(2)
	}
	c := exec.Command("go", args...)
	c.Env = append(envNoGopath(), "GOPATH="+gopath)
	c.Stdin = os.Stdin
	c.Stdout = os.Stdout
	c.Stderr = os.Stderr
	err := c.Run()
	if err != nil {
		log.Fatalln("go", err)
	}
}

// prepareGopath reads dependency information from the filesystem
// entry name, fetches any necessary code, and returns a gopath
// causing the specified dependencies to be used.
func prepareGopath() (gopath string) {
	dir, isDir := findGodeps()
	if dir == "" {
		log.Fatalln("No Godeps found (or in any parent directory)")
	}
	if isDir {
		return filepath.Join(dir, "Godeps", "_workspace")
	}
	log.Println(strings.TrimSpace(noSourceCodeWarning))
	g, err := ReadAndLoadGodeps(filepath.Join(dir, "Godeps"))
	if err != nil {
		log.Fatalln(err)
	}
	gopath, err = sandboxAll(g.Deps)
	if err != nil {
		log.Fatalln(err)
	}
	return gopath
}

// findGodeps looks for a directory entry "Godeps" in the
// current directory or any parent, and returns the containing
// directory and whether the entry itself is a directory.
// If Godeps can't be found, findGodeps returns "".
// For any other error, it exits the program.
func findGodeps() (dir string, isDir bool) {
	wd, err := os.Getwd()
	if err != nil {
		log.Fatalln(err)
	}
	return findInParents(wd, "Godeps")
}

// isRoot returns true iff a path is a root.
// On Unix: "/".
// On Windows: "C:\", "D:\", ...
func isRoot(p string) bool {
	p = filepath.Clean(p)
	volume := filepath.VolumeName(p)

	p = strings.TrimPrefix(p, volume)
	p = filepath.ToSlash(p)

	return p == "/"
}

// findInParents returns the path to the directory containing name
// in dir or any ancestor, and whether name itself is a directory.
// If name cannot be found, findInParents returns the empty string.
func findInParents(dir, name string) (container string, isDir bool) {
	for {
		fi, err := os.Stat(filepath.Join(dir, name))
		if os.IsNotExist(err) && isRoot(dir) {
			return "", false
		}
		if os.IsNotExist(err) {
			dir = filepath.Dir(dir)
			continue
		}
		if err != nil {
			log.Fatalln(err)
		}
		return dir, fi.IsDir()
	}
}

func envNoGopath() (a []string) {
	for _, s := range os.Environ() {
		if !strings.HasPrefix(s, "GOPATH=") {
			a = append(a, s)
		}
	}
	return a
}

// sandboxAll ensures that the commits in deps are available
// on disk, and returns a GOPATH string that will cause them
// to be used.
func sandboxAll(a []Dependency) (gopath string, err error) {
	var path []string
	for _, dep := range a {
		dir, err := sandbox(dep)
		if err != nil {
			return "", err
		}
		path = append(path, dir)
	}
	return strings.Join(path, ":"), nil
}

// sandbox ensures that commit d is available on disk,
// and returns a GOPATH string that will cause it to be used.
func sandbox(d Dependency) (gopath string, err error) {
	if !exists(d.RepoPath()) {
		if err = d.CreateRepo("fast", "main"); err != nil {
			return "", fmt.Errorf("create repo: %s", err)
		}
	}
	err = d.checkout()
	if err != nil && d.FastRemotePath() != "" {
		err = d.fetchAndCheckout("fast")
	}
	if err != nil {
		err = d.fetchAndCheckout("main")
	}
	if err != nil {
		return "", err
	}
	return d.Gopath(), nil
}

const noSourceCodeWarning = `
warning: outdated Godeps missing source code

The ability to read this format will be removed in the future.
See http://goo.gl/RpYs8e for a discussion of the upcoming removal.

To avoid this warning, ask the maintainer of this package to run
'godep save' without flag -copy.
`


text:
body {
  /*background: #bdc3c7;*/
}

.bandera {
  margin: 0em;
  height: 150px;
  width: 260px;
  float: none;
}

.nicaragua {
  background: -webkit-linear-gradient(top, #0067c6 33%, #fff 33%, #fff 66%, #0067c6 66%);
  background: linear-gradient(to bottom, #0067c6 33%, #fff 33%, #fff 66%, #0067c6 66%);
}

.guatemala {
  background: -webkit-linear-gradient(left, #4897d2 33%, #fff 33%, #fff 66%, #4897d2 66%);
  background: linear-gradient(to right, #4897d2 33%, #fff 33%, #fff 66%, #4897d2 66%);
}

.costarica {
  background: -webkit-linear-gradient(top, #022a7f 17%, #fff 17%, #fff 33%, #ce1127 33%, #ce1127 66%, #fff 66%, #fff 83%, #022a7f 83%, #022a7f 83%);
  background: linear-gradient(to bottom, #022a7f 17%, #fff 17%, #fff 33%, #ce1127 33%, #ce1127 66%, #fff 66%, #fff 83%, #022a7f 83%, #022a7f 83%);
}

.panama {
  background: #fff;
}

.panama:before {
  position:relative;
  display:block;
  content:"";
  padding:0px 0px 0 0px;
  width:50%;
  height:50%;
  top:75px;
  left:0;
  background: #015293;
}

.panama:after {
  position:relative;
  display:block;
  content:"";
  padding:0px 0px 0 0px;
  width:50%;
  height:50%;
  top:-365px;
  left:100px;
  background: #d31134;
}

.estrella-azul {
  position: relative;
  top: -240px;
  left: -50px;
  -webkit-transform: scale(.25);
  -ms-transform: scale(.25);
  transform: scale(.25);
}

.estrella-azul2 {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #015293;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #015293;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-azul2:before {
   border-bottom: 80px solid #015293;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);

}
.estrella-azul2:after {
   position: absolute;
   display: block;
   color: #015293;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #015293;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.estrella-roja {
  position: relative;
  top: -50px;
  left: 45px;
  -webkit-transform: scale(.25);
  -ms-transform: scale(.25);
  transform: scale(.25);
}

.estrella-roja2 {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #d31134;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #d31134;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-roja2:before {
   border-bottom: 80px solid #d31134;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);

}
.estrella-roja2:after {
   position: absolute;
   display: block;
   color: #d31134;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #d31134;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.honduras {
  background: -webkit-linear-gradient(top, #0073ce 33%, #fff 33%, #fff 66%, #0073ce 66%);
  background: linear-gradient(to bottom, #0073ce 33%, #fff 33%, #fff 66%, #0073ce 66%);
}

.estrella-1 {
  position: relative;
  top: -25px;
  left: -35px;
  -webkit-transform: scale(.1);
  -ms-transform: scale(.1);
  transform: scale(.1);
}

.estrella-1a {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #0073ce;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #0073ce;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-1a:before {
   border-bottom: 80px solid #0073ce;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);

}
.estrella-1a:after {
   position: absolute;
   display: block;
   color: #0073ce;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #0073ce;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.estrella-2 {
  position: relative;
  top: -120px;
  left: -35px;
  -webkit-transform: scale(.1);
  -ms-transform: scale(.1);
  transform: scale(.1);
}

.estrella-2a {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #0073ce;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #0073ce;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-2a:before {
   border-bottom: 80px solid #0073ce;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);

}
.estrella-2a:after {
   position: absolute;
   display: block;
   color: #0073ce;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #0073ce;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.estrella-3 {
  position: relative;
  top: -265px;
  left: 35px;
  -webkit-transform: scale(.1);
  -ms-transform: scale(.1);
  transform: scale(.1);
}

.estrella-3a {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #0073ce;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #0073ce;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-3a:before {
   border-bottom: 80px solid #0073ce;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);
}

.estrella-3a:after {
   position: absolute;
   display: block;
   color: #0073ce;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #0073ce;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.estrella-4 {
  position: relative;
  top: -360px;
  left: 35px;
  -webkit-transform: scale(.1);
  -ms-transform: scale(.1);
  transform: scale(.1);
}

.estrella-4a {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #0073ce;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #0073ce;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-4a:before {
   border-bottom: 80px solid #0073ce;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);
}

.estrella-4a:after {
   position: absolute;
   display: block;
   color: #0073ce;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #0073ce;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.estrella-5 {
  position: relative;
  top: -490px;
  left: 0px;
  -webkit-transform: scale(.1);
  -ms-transform: scale(.1);
  transform: scale(.1);
}

.estrella-5a {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #0073ce;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #0073ce;
   border-left:   100px solid transparent;
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   transform:      rotate(35deg);
}

.estrella-5a:before {
   border-bottom: 80px solid #0073ce;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   transform:      rotate(-35deg);
}

.estrella-5a:after {
   position: absolute;
   display: block;
   color: #0073ce;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #0073ce;
   border-left: 100px solid transparent;
  content: '';
   -webkit-transform: rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   transform:      rotate(-70deg);
}

.elsalvador {
  background: -webkit-linear-gradient(top, #1047ae 33%, #fff 33%, #fff 66%, #1047ae 66%);
  background: linear-gradient(to bottom, #1047ae 33%, #fff 33%, #fff 66%, #1047ae 66%);
}

.texto {
  font-family: 'Lato', sans-serif;
  line-height:1;
}


text:
/**
 * \file: BinaryFile.h
 * @brief: This file contains the definition of the abstract class BinaryFile
*/

#ifndef __BINARYFILE_H__
#define __BINARYFILE_H__

/***************************************************************************/ /**
  * Dependencies.
  ******************************************************************************/

#include "types.h"
#include "db/SectionInfo.h"

//#include "SymTab.h"    // Was used for relocaton stuff
#include <QStringList>
#include <QDebug>
#include <QString>
#include <cassert>
#include <list>
#include <cstddef>
#include <map>
#include <string>
#include <vector>
#include <cstdio> // For FILE
// Given a pointer p, returns the 16 bits (halfword) in the two bytes
// starting at p.
#define LH(p) ((int)((Byte *)(p))[0] + ((int)((Byte *)(p))[1] << 8))
class IBoomerang;

// Objective-C stuff
class ObjcIvar {
public:
    QString name, type;
    unsigned offset;
};

class ObjcMethod {
public:
    QString name, types;
    ADDRESS addr;
};

class ObjcClass {
public:
    QString name;
    std::map<QString, ObjcIvar> ivars;
    std::map<QString, ObjcMethod> methods;
};

class ObjcModule {
public:
    QString name;
    std::map<QString, ObjcClass> classes;
};

// This enum allows a sort of run time type identification, without using
// compiler specific features
enum LOAD_FMT {
    LOADFMT_ELF,
    LOADFMT_PE,
    LOADFMT_PALM,
    LOADFMT_PAR,
    LOADFMT_EXE,
    LOADFMT_MACHO,
    LOADFMT_LX,
    LOADFMT_COFF
};
enum MACHINE {
    MACHINE_UNKNOWN=0,
    MACHINE_PENTIUM,
    MACHINE_SPARC,
    MACHINE_HPRISC,
    MACHINE_PALM,
    MACHINE_PPC,
    MACHINE_ST20,
    MACHINE_MIPS,
    MACHINE_68K
};

class BinaryFileFactory {
    std::vector<QObject *> m_loader_plugins;
    QObject *getInstanceFor(const QString &sName);
    static QString m_base_path; //!< path from which the executable is being ran, used to find lib/ directory
    void populatePlugins();
public:
    BinaryFileFactory() {
        populatePlugins();
    }
    static void setBasePath(const QString &path) { m_base_path = path; } //!< sets the base directory for plugin search
    QObject *Load(const QString &sName);
    void UnLoad();
};

#define LoaderInterface_iid "org.boomerang.LoaderInterface"
#define ObjcInterface_iid "org.boomerang.LoaderInterface.ObjC"
// TODO: create a default implmentation for this interface that will notify the user about the missing functionality ?

class ObjcAccessInterface {
public:
    virtual ~ObjcAccessInterface() {}

    virtual std::map<QString, ObjcModule> &getObjcModules() = 0;
};
Q_DECLARE_INTERFACE(ObjcAccessInterface, ObjcInterface_iid)

class LoaderInterface {
public:
    virtual ~LoaderInterface() {}

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // General loader functions
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    virtual void initialize(IBoomerang *sys) = 0;
    virtual void UnLoad() = 0;                //!< Unload the file. Pure virtual
    virtual void Close() = 0;                 //!< Close file opened with Open()
    virtual LOAD_FMT GetFormat() const = 0;   //!< Get the format (e.g. LOADFMT_ELF)
    virtual MACHINE getMachine() const = 0;   //!< Get the expected machine (e.g. MACHINE_PENTIUM)
    virtual bool LoadFromMemory(QByteArray &data) = 0;
    virtual int canLoad(QIODevice &data) const = 0;

    /// Return the virtual address at which the binary expects to be loaded.
    /// For position independent / relocatable code this should be NO_ADDDRESS
    virtual ADDRESS getImageBase() = 0;
    virtual size_t getImageSize() = 0; //!< Return the total size of the loaded image

    virtual bool IsRelocationAt(ADDRESS /*uNative*/) { return false; }

    virtual ADDRESS IsJumpToAnotherAddr(ADDRESS /*uNative*/) { return NO_ADDRESS; }
    virtual bool hasDebugInfo() { return false; }

    virtual ADDRESS GetMainEntryPoint() = 0;
    virtual ADDRESS GetEntryPoint() = 0; //!< Return the "real" entry point, ie where execution of the program begins
    ///////////////////////////////////////////////////////////////////////////////
    // Internal information
    // Dump headers, etc
    virtual bool DisplayDetails(const char * /*fileName*/, FILE * /*f*/ /* = stdout */) {
        return false; // Should always be overridden
        // Should display file header, program
        // headers and section headers, as well
        // as contents of each of the sections.
    }

    // Special load function for archive members
protected:
    virtual bool PostLoad(void *handle) = 0; //!< Called after loading archive member
};
Q_DECLARE_INTERFACE(LoaderInterface, LoaderInterface_iid)
struct LoaderPluginWrapper {
    QObject *plugin;
    template <class T> T *iface() { return plugin ? qobject_cast<T *>(plugin) : nullptr; }
};

#endif // #ifndef __BINARYFILE_H__


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

<TITLE>
MXQueryXQMetaData
</TITLE>

<META NAME="date" CONTENT="2009-05-04">

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

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

ch.ethz.mxquery.xqj

Class MXQueryXQMetaData

java.lang.Object
  ch.ethz.mxquery.xqj.MXQueryXQMetaData

All Implemented Interfaces:
javax.xml.xquery.XQMetaData

public class MXQueryXQMetaData
extends java.lang.Object
implements javax.xml.xquery.XQMetaData

Constructor Summary

MXQueryXQMetaData(MXQueryXQConnection connection)

Method Summary

 int
getMaxExpressionLength()

 int
getMaxUserNameLength()

 int
getProductMajorVersion()

 int
getProductMinorVersion()

 java.lang.String
getProductName()

 java.lang.String
getProductVersion()

 java.util.Set
getSupportedXQueryEncodings()

 java.lang.String
getUserName()

 int
getXQJMajorVersion()

 int
getXQJMinorVersion()

 java.lang.String
getXQJVersion()

 boolean
isFullAxisFeatureSupported()

 boolean
isModuleFeatureSupported()

 boolean
isReadOnly()

 boolean
isSchemaImportFeatureSupported()

 boolean
isSchemaValidationFeatureSupported()

 boolean
isSerializationFeatureSupported()

 boolean
isStaticTypingExtensionsSupported()

 boolean
isStaticTypingFeatureSupported()

 boolean
isTransactionSupported()

 boolean
isUserDefinedXMLSchemaTypeSupported()

 boolean
isXQueryEncodingDeclSupported()

 boolean
isXQueryEncodingSupported(java.lang.String encoding)

 boolean
isXQueryXSupported()

 boolean
wasCreatedFromJDBCConnection()

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

MXQueryXQMetaData

public MXQueryXQMetaData(MXQueryXQConnection connection)

Method Detail

getMaxExpressionLength

public int getMaxExpressionLength()
                           throws javax.xml.xquery.XQException

Specified by:
getMaxExpressionLength in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getMaxUserNameLength

public int getMaxUserNameLength()
                         throws javax.xml.xquery.XQException

Specified by:
getMaxUserNameLength in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getProductMajorVersion

public int getProductMajorVersion()
                           throws javax.xml.xquery.XQException

Specified by:
getProductMajorVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getProductMinorVersion

public int getProductMinorVersion()
                           throws javax.xml.xquery.XQException

Specified by:
getProductMinorVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getProductName

public java.lang.String getProductName()
                                throws javax.xml.xquery.XQException

Specified by:
getProductName in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getProductVersion

public java.lang.String getProductVersion()
                                   throws javax.xml.xquery.XQException

Specified by:
getProductVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getSupportedXQueryEncodings

public java.util.Set getSupportedXQueryEncodings()
                                          throws javax.xml.xquery.XQException

Specified by:
getSupportedXQueryEncodings in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getUserName

public java.lang.String getUserName()
                             throws javax.xml.xquery.XQException

Specified by:
getUserName in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getXQJMajorVersion

public int getXQJMajorVersion()
                       throws javax.xml.xquery.XQException

Specified by:
getXQJMajorVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getXQJMinorVersion

public int getXQJMinorVersion()
                       throws javax.xml.xquery.XQException

Specified by:
getXQJMinorVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

getXQJVersion

public java.lang.String getXQJVersion()
                               throws javax.xml.xquery.XQException

Specified by:
getXQJVersion in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isFullAxisFeatureSupported

public boolean isFullAxisFeatureSupported()
                                   throws javax.xml.xquery.XQException

Specified by:
isFullAxisFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isModuleFeatureSupported

public boolean isModuleFeatureSupported()
                                 throws javax.xml.xquery.XQException

Specified by:
isModuleFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isReadOnly

public boolean isReadOnly()
                   throws javax.xml.xquery.XQException

Specified by:
isReadOnly in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isSchemaImportFeatureSupported

public boolean isSchemaImportFeatureSupported()
                                       throws javax.xml.xquery.XQException

Specified by:
isSchemaImportFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isSchemaValidationFeatureSupported

public boolean isSchemaValidationFeatureSupported()
                                           throws javax.xml.xquery.XQException

Specified by:
isSchemaValidationFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isSerializationFeatureSupported

public boolean isSerializationFeatureSupported()
                                        throws javax.xml.xquery.XQException

Specified by:
isSerializationFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isStaticTypingExtensionsSupported

public boolean isStaticTypingExtensionsSupported()
                                          throws javax.xml.xquery.XQException

Specified by:
isStaticTypingExtensionsSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isStaticTypingFeatureSupported

public boolean isStaticTypingFeatureSupported()
                                       throws javax.xml.xquery.XQException

Specified by:
isStaticTypingFeatureSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isTransactionSupported

public boolean isTransactionSupported()
                               throws javax.xml.xquery.XQException

Specified by:
isTransactionSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isUserDefinedXMLSchemaTypeSupported

public boolean isUserDefinedXMLSchemaTypeSupported()
                                            throws javax.xml.xquery.XQException

Specified by:
isUserDefinedXMLSchemaTypeSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isXQueryEncodingDeclSupported

public boolean isXQueryEncodingDeclSupported()
                                      throws javax.xml.xquery.XQException

Specified by:
isXQueryEncodingDeclSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isXQueryEncodingSupported

public boolean isXQueryEncodingSupported(java.lang.String encoding)
                                  throws javax.xml.xquery.XQException

Specified by:
isXQueryEncodingSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

isXQueryXSupported

public boolean isXQueryXSupported()
                           throws javax.xml.xquery.XQException

Specified by:
isXQueryXSupported in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

wasCreatedFromJDBCConnection

public boolean wasCreatedFromJDBCConnection()
                                     throws javax.xml.xquery.XQException

Specified by:
wasCreatedFromJDBCConnection in interface javax.xml.xquery.XQMetaData

Throws:

javax.xml.xquery.XQException

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich


text:
void encode64 (char *orig, char *dest, int nbcar);
int decode64 (char *buffer);

#endif // BASE64_H_INCLUDED


text:
package com.google.gerrit.extensions.common;

import java.util.List;

public class PluginConfigInfo {
  public Boolean hasAvatars;
  public List<String> jsResourcePaths;
}