text:
{-# LANGUAGE TupleSections, FlexibleInstances, FlexibleContexts, DeriveFunctor #-}

-- | This module defines a few types as an alternative to Euterpea's Music structure; Music
-- is more flexible but also somewhat ambiguous (e.g. depending on the values of a and b,
-- a :=: b might represent either a single chord or two independent simultaneous parts,
-- each of which might contain chords)
module Piece where

import Control.Arrow
import Data.Function
import Data.List hiding (insert)
import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as NonEmpty
import Data.Map (Map, insert, (!))
import qualified Data.Map as Map
import Data.Ratio
import Data.Semigroup
import Euterpea hiding (Rest, Note, note, Mode, chord)
import qualified Euterpea as E

import Music () -- just for Functor instance

data Note d p = Note d p | Rest d
              deriving (Show, Eq, Ord, Functor)

type Chord d p = Note d [p]
type Part = []
type Piece a = Map InstrumentName (Part a)

newtype Flip f a b = Flip { unflip :: f b a }

fmap' :: (Functor (Flip f c)) => (a -> b) -> f a c -> f b c
fmap' f = unflip . fmap f . Flip

sconcatMap :: Semigroup b => (a -> b) -> NonEmpty a -> b
sconcatMap f = sconcat . fmap f

instance Functor (Flip Note p) where
  fmap f (Flip (Note d p)) = Flip $ Note (f d) p
  fmap f (Flip (Rest d)) = Flip $ Rest (f d)

type Beat = Dur

-- Keeps the rightmost duration, or the rightmost Rest if there are no Notes.
-- For predictable behavior, both operands should have the same duration (or
-- irrelevant durations)
instance Semigroup p => Semigroup (Note d p) where
  Rest _ <> r@(Rest _) = r
  Rest _ <> n@(Note _ _) = n
  n@(Note _ _) <> Rest _ = n
  Note _ n1 <> Note d n2 = Note d (n1 <> n2)

-- truncate a part after a given number of beats
truncatePart :: (Num d, Ord d) => d -> Part (Note d a) -> Part (Note d a)
truncatePart cutoff = tail . map snd . takeWhile ((<= cutoff) . fst) . scanl totalDurs empty
  where empty = (fromInteger 0, error "placeholder") -- can this be avoided?
        totalDurs (d1,a) r@(Rest d2) = (d1+d2, r)
        totalDurs (d1,a) n@(Note d2 _) = (d1+d2, n)

convertNote :: Music (a,Beat) -> Note (Dur,Beat) a
convertNote (Prim (E.Rest d)) = Rest (d, 0 % 1) -- TODO - I have no beat info for rests
convertNote (Prim (E.Note d (p,b))) = Note (d,b) p

concatNotes :: Eq d => [Note d p] -> Chord d p
concatNotes = sconcatMap (fmap (:[])) . NonEmpty.fromList

-- inverse of Euterpea.chord
unchord :: Music a -> [Music a]
unchord (a :=: b) = a : unchord b
unchord (Prim (E.Rest dur)) | (dur == 0 % 1) = []
unchord _ = error "unsupported music structure"

remainder :: Integral n => Ratio n -> Ratio n
remainder n = (num `mod` den) % den
  where (num,den) = (numerator n, denominator n)

unmodify :: Music a -> Music a
unmodify (Modify _ m) = m
unmodify (a :=: b) = unmodify a :=: unmodify b
unmodify (a :+: b) = unmodify a :+: unmodify b
unmodify m = m

-- instrument assignments happen only at the outermost level of Music in fromMidi
instrumentMap :: E.Music a -> Map InstrumentName (E.Music a)
instrumentMap (Modify (Instrument inst) m1 :=: m2) = insert inst m1 $ instrumentMap m2
instrumentMap (Prim (E.Rest dur)) | dur == (0 % 1) = Map.empty
instrumentMap _ = error "unsupported music structure"

lstrip :: E.Music a -> E.Music a
lstrip (Prim (E.Rest dur) :+: m) | (dur == 0 % 1) = lstrip m
lstrip (Prim (E.Rest dur) :=: m) | (dur == 0 % 1) = lstrip m
lstrip (Modify m n) = Modify m (lstrip n)
lstrip m = m

stripAttributes :: Music1 -> Music Pitch
stripAttributes = fmap fst

-- assumes the format that Euterpea.fromMidi emits
restructure :: E.Music a -> Part [E.Music (a,Beat)]
restructure = map (map fixOffset) . groupBy ((==) `on` absOffset) . unchord
  where fixOffset (Prim (E.Rest dur) :+: m) = fmap (,remainder dur) m
        fixOffset _ = error "unsupported music structure"
        absOffset (Prim (E.Rest d) :+: a) = d
        absOffset _ = error "unsupported music structure"

-- assumes the format that Euterpea.fromMidi emits
toPiece :: Music1 -> Piece (Chord (Dur,Beat) Pitch)
toPiece = Map.map convertInstrument . instrumentMap
  where convertInstrument = map (concatNotes . map convertNote)
                          . restructure
                          . unmodify
                          . stripAttributes
                          . lstrip

fromPiece :: Piece (Chord Dur Pitch) -> Music Pitch
fromPiece = E.chord . Map.foldrWithKey addInstrument []
  where addInstrument inst part song = Modify (Instrument inst) (fromPart part) : song
        fromPart = line . map fromChord
        fromChord (Note d ps) = E.chord [Prim $ E.Note d p | p <- ps]
        fromChord (Rest d) = Prim $ E.Rest d

stripBeats :: Part (Note (d,Beat) p) -> Part (Note d p)
stripBeats = map (fmap' fst)


text:
namespace
{
const std::string username = TEST_USER_1_USERNAME;
const std::string password = TEST_USER_1_PASSWORD;
}  // end anonymous namespace

namespace api = mf::api;

BOOST_AUTO_TEST_CASE(UTPollForeignChanges)
{
    boost::asio::io_service io_service;
    auto http_config = mf::http::HttpConfig::Create();
    http_config->SetWorkIoService(&io_service);

    api::SessionMaintainer stm(http_config);

    stm.SetLoginCredentials(api::credentials::Email{username, password});

    using DeviceGetStatusType = mf::api::device::get_status::Request;
    using ContactFetchType = mf::api::contact::fetch::Request;
    using DeviceGetForeignChangesType
            = mf::api::device::get_foreign_changes::Request;
    using FolderGetInfoType = mf::api::folder::get_info::Request;
    using FileGetInfoType = mf::api::file::get_info::Request;

    using PollForeignChangesType
            = mf::api::PollForeignChanges<DeviceGetForeignChangesType,
                                          FolderGetInfoType,
                                          FileGetInfoType>;

    // Response types
    using File = typename PollForeignChangesType::File;
    using Folder = typename PollForeignChangesType::Folder;
    using FolderInfo = typename PollForeignChangesType::FolderInfo;
    using FileInfo = typename PollForeignChangesType::FileInfo;

    // Error types
    using DeviceGetForeignChangesErrorType =
            typename PollForeignChangesType::DeviceGetForeignChangesErrorType;
    using FileGetInfoErrorType =
            typename PollForeignChangesType::FileGetInfoErrorType;
    using FolderGetInfoErrorType =
            typename PollForeignChangesType::FolderGetInfoErrorType;

    auto HandlePollForeignChanges = [this, &io_service](
            uint32_t latest_changes_revision,
            const std::vector<File> & deleted_files,
            const std::vector<Folder> & deleted_folders,
            const std::vector<FileInfo> & updated_files_info,
            const std::vector<FolderInfo> & updated_folders_info,
            const std::vector<DeviceGetForeignChangesErrorType> &
                    get_changes_errors,
            const std::vector<FileGetInfoErrorType> & get_info_file_errors,
            const std::vector<FolderGetInfoErrorType> & get_info_folder_errors)
    {
        if (!get_changes_errors.empty())
            BOOST_FAIL("device/get_foreign_changes returned errors");

        if (!get_info_file_errors.empty())
            BOOST_FAIL("file/get_info returned errors");

        if (!get_info_folder_errors.empty())
            BOOST_FAIL("folder/get_info returned errors");

        for (const auto & updated_file_info : updated_files_info)
        {
            std::cout << "Updated File Info: " << updated_file_info.quickkey
                      << " " << updated_file_info.filename << std::endl;
        }

        for (const auto & updated_folder_info : updated_folders_info)
        {
            std::cout << "Updated Folder Info: "
                      << updated_folder_info.folderkey << " "
                      << updated_folder_info.name << std::endl;
        }

        for (const auto & deleted_file : deleted_files)
        {
            std::cout << "Deleted File: " << deleted_file.quickkey << std::endl;
        }

        for (const auto & deleted_folder : deleted_folders)
        {
            std::cout << "Deleted Folder: " << deleted_folder.folderkey
                      << std::endl;
        }

        io_service.stop();
    };

    auto work_manager = mf::api::WorkManager::Create(&io_service);

    auto poll_foreign_changes = PollForeignChangesType::Create(
            &stm,
            "t4j3iee",
            0,
            work_manager,
            std::move(HandlePollForeignChanges));

    poll_foreign_changes->Start();

    io_service.run();
}

redpajama_set_name: RedPajamaGithub


text:
namespace CLDEParser {
    namespace Exceptions {

        class ParserException : public Exception {

            int _code;
            SPtrTokenVectorIterator _iterator;
            std::string _description;

        public:
            ParserException(int code, SPtrTokenVectorIterator const &iterator, std::string const &description);
            ParserException(int code, SPtrTokenVectorIterator const &iterator);
            ParserException(const ParserException &) = default;
            ParserException(ParserException &&) = default;
            ParserException &operator=(const ParserException &) = default;
            ParserException &operator=(ParserException &&) = default;
            ~ParserException();

            enum class ParserExceptionCode {
                UnmatchedToken = 0,
                UnknownEntityType = 1,
                UnknownValueType = 2
            };

            // Locals
            SPtrTokenVectorIterator const &Iterator() const { return _iterator; }
            ParserExceptionCode Code() const { return (ParserExceptionCode) _code; }

            static std::string CopyToString(ParserExceptionCode code);
        };
    }
}

#endif //CLDEPARSER_EXCEPTIONS_PARSEREXCEPTION_H


text:
#include "shader.h"

const char *vertex_glsl =
  "#version 330\n"
  "uniform mat4 view;"
  "uniform mat4 projection;"
  "uniform mat4 world;"
  "layout (location=1) in vec3 position;"
  "out vec3 world_position;"
  "void main()"
  "{"
    "world_position = (world * vec4(position,1.0f)).xyz;"
    "gl_Position = projection * view * world * vec4(position,1.0f);"
    // "gl_Position = vec4(position,1.0f);\n"
  "}";
const char *fragment_glsl =
  "#version 330\n"
  "layout (location = 0) out vec4 colour;"
  "in vec3 world_position;"
  "void main()"
  "{"
    "vec3 wp = world_position + vec3(100,100,100);"
    "float scale = 0.5;"
    "float xm = mod(int(wp.x*scale),2);"
    "float ym = mod(int(wp.y*scale),2);"
    "float zm = mod(int(wp.z*scale),2);"
    "float ip = 0;"
    "if ("
      "xm == zm"
      ") ip = 0.5;"
    "colour = vec4(ip,ip,ip,1);"
  "}";

// Just some helper functions for checking shaders...
void shaderLog(GLuint handle)
{
  int status;
  glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
  if (status == GL_FALSE)
  {
     /* Get the length of the info log. */
     int len;
     glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &len);
     /* Get the info log. */
     char* log = new char[(unsigned)len];
     glGetShaderInfoLog(handle, len, &len, log);
     /* Print error */
     cerr << "Compilation error: " << log << endl;
     /* Finally, free the memory allocated. */
     delete log;
     /* Exit the program. */
     exit(-1);
  }
}

void programLog(GLuint handle)
{
  int status;
  glGetProgramiv(handle, GL_LINK_STATUS, &status);
  if (status == GL_FALSE)
  {
     /* Get the length of the info log. */
     int len;
     glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &len);
     /* Get the info log. */
     char* log = new char[(unsigned)len];
     glGetProgramInfoLog(handle, len, &len, log);
     /* Print error */
     cerr << "Link error: " << log << endl;
     /* Finally, free the memory allocated. */
     delete log;
     /* Exit the program. */
     exit(-1);
  }
}


text:
import signal
import time
import sys

import PshellServer
import TraceLog as Trace

#################################################################################
#################################################################################
def sampleOutputFunction(outputString_):

   # this sample log output function is registered with the TraceLog
   # 'registerOutputFunction' call to show a client supplied
   # log function, the string passed in is a fully formatted log
   # string, it is up to the registering application to decide
   # what to do with that string, i.e. write to stdout, write to
   # a custom logfile, write to syslog etc

   # write to stdout
   print("CUSTOM OUTPUT - %s" % outputString_)

   # write to syslog
   #syslog(LOG_INFO, "%s", outputString_)

#################################################################################
#################################################################################
def sampleFormatFunction(logname_, level_, timestamp_, message_):

  # this sample format function is registered with the TraceLog
  # 'registerFormatFunction' call to show a client supplied
  #
  # formatting function, the formating must be done into the outputString_
  # variable, the user can check to see if the various formatting items
  # are enabled, or they can just use a fixed format

  # standard output format: name | level | timestamp | user-message
  # custom format is: timestamp level:[name] - user-message

  message = ""
  if Trace.isFormatEnabled():
    if Trace.isTimestampEnabled():
      message = "%s " % timestamp_
    message += "%-7s : " % level_
    if Trace.isLogNameEnabled():
      message += "[%s] - " % logname_
    message += message_
    return (message)
  else:
    return (message_)

#################################################################################
#################################################################################
def showUsage():
  print("")
  print("Usage: traceLogDemo <level> [custom]")
  print("")
  print("  where:")
  print("    <level>  - The desired log level value, 0-%d" % Trace.TL_ALL)
  print("    custom   - Use a custom log format")
  print("")
  exit(0)

#################################################################################
#################################################################################
def signalHandler(signal, frame):
  PshellServer.cleanupResources()
  print("")
  Trace.FORCE("Exiting program traceLogDemo...")
  sys.exit()

#################################################################################
#################################################################################
def registerSignalHandlers():
  # register a signal handlers so we can cleanup our
  # system resources upon abnormal termination
  signal.signal(signal.SIGHUP, signalHandler)      # 1  Hangup (POSIX)
  signal.signal(signal.SIGINT, signalHandler)      # 2  Interrupt (ANSI)
  signal.signal(signal.SIGQUIT, signalHandler)     # 3  Quit (POSIX)
  signal.signal(signal.SIGILL, signalHandler)      # 4  Illegal instruction (ANSI)
  signal.signal(signal.SIGABRT, signalHandler)     # 6  Abort (ANSI)
  signal.signal(signal.SIGBUS, signalHandler)      # 7  BUS error (4.2 BSD)
  signal.signal(signal.SIGFPE, signalHandler)      # 8  Floating-point exception (ANSI)
  signal.signal(signal.SIGSEGV, signalHandler)     # 11 Segmentation violation (ANSI)
  signal.signal(signal.SIGPIPE, signalHandler)     # 13 Broken pipe (POSIX)
  signal.signal(signal.SIGALRM, signalHandler)     # 14 Alarm clock (POSIX)
  signal.signal(signal.SIGTERM, signalHandler)     # 15 Termination (ANSI)
  signal.signal(signal.SIGXCPU, signalHandler)     # 24 CPU limit exceeded (4.2 BSD)
  signal.signal(signal.SIGXFSZ, signalHandler)     # 25 File size limit exceeded (4.2 BSD)
  signal.signal(signal.SIGSYS, signalHandler)      # 31 Bad system call

##############################
#
# start of main program
#
##############################
if __name__ == '__main__':

  registerSignalHandlers()

  logLevel = Trace.TL_ALL

  # validate our command line arguments and get desired log level
  if len(sys.argv) == 2 or len(sys.argv) == 3:
    if sys.argv[1] == "-h":
      showUsage()
    if len(sys.argv) == 3:
      if sys.argv[2] == "custom":
        # register our custom format function
        Trace.registerFormatFunction(sampleFormatFunction)
        # set a custom timestamp format, add the date, the time must be last because the usec portion is appended to the time
        Trace.setTimestampFormat("%Y-%m-%d %T")
        # register our custom output function
        Trace.registerOutputFunction(sampleOutputFunction)
      else:
        showUsage()
    logLevel = int(sys.argv[1])

  Trace.init("DEMO", "/var/log/traceLogDemo.log", logLevel)

  PshellServer.startServer("traceLogDemo", PshellServer.UDP, PshellServer.NON_BLOCKING, PshellServer.ANYHOST, 9292);

  data = []
  for i in range(256):
    data += chr(i)

  while True:
    Trace.FORCE("Force Message")
    time.sleep(1)
    Trace.ERROR("Error Message")
    time.sleep(1)
    Trace.FAILURE("Failure Message")
    time.sleep(1)
    Trace.WARNING("Warning Message")
    time.sleep(1)
    Trace.INFO("Info Message")
    time.sleep(1)
    Trace.DEBUG("Debug Message")
    time.sleep(1)
    Trace.ENTER("Enter Message")
    time.sleep(1)
    Trace.EXIT("Exit Message")
    time.sleep(1)
    Trace.DUMP(data, len(data), "Dump Message")
    time.sleep(1)


text:
{{{
  "title": "Getting Started with MapR - Blueprint",
  "date": "01-26-2016",
  "author": "@KeithResar",
  "attachments": [],
  "contentIsHTML": false
}}}

### Overview
After reading this article, the reader should feel comfortable deploying MapR Apache Hadoop on CenturyLink Cloud.

### Partner Profile

https://www.mapr.com/

##### Customer Support
|Sales Contact | Support Contact	|
|:-	|	:-|
|[Contact us](http://info.mapr.com/ContactUs.html)
855.669.6277   	| support@mapr.com
[Support overview](https://www.mapr.com/support/overview)
1.855.669.6277, Option 2 |

### Description
MapR Inc. has integrated their Hadoop Platform with the CenturyLink Cloud platform. The purpose of this KB article is to help the reader take advantage of this integration to achieve rapid time-to-value for this Hadoop distribution.

The MapR Converged Data Platform integrates the power of Hadoop and Spark with global event streaming, real-time database capabilities, and enterprise storage for developing and running innovative data applications.

The MapR Platform is powered by the industry's fastest, most reliable, secure, and open data infrastructure that dramatically lowers TCO and enables global real-time data applications.- now available as part of the CenturyLink Cloud Blueprint Engine.

### Audience
* CenturyLink Cloud Users
* Hadoop Administrators
* Hadoop Users
* Developers interested in Hadoop

### Impact
After reading this article, the user should feel comfortable getting started using the partner technology on CenturyLink Cloud.

After executing the steps in this Getting Started document, the users will have a functioning Hadoop instance upon which they can start developing solutions.

The MapR Converged Data Platform integrates Hadoop and Spark, real-time database capabilities, and global event streaming with big data enterprise storage, for developing and running innovative data applications. The MapR Platform is powered by the industry's fastest, most reliable, secure, and open data infrastructure that dramatically lowers TCO and enables global real-time data applications.

### Deploying MapR Cluster Blueprint
1. Locate the Blueprint in the Blueprint Library.
   * Login to the Control Portal. From the Nav Menu on the left, click **Orchestration > Blueprints Library**.
   * Search for "MapR" in the keyword search on the right side of the page.

2. Click the `deploy blueprint` button.

3. Set Required parameters.

  * **MapR User Password** - The password you will use to log on to the MapR Control System, the Installer, or the MapR Linux user.
  * **Cluster Name** - The name of the cluster used for filesystem names and NFS published volumes.

4. Set Optional Parameters.
   * Password/Confirm Password (This is the root password for the server. Keep this in a secure place).
   * Set DNS to "Manually Specify" and use "8.8.8.8" (or any other public DNS server of your choice).
   * Optionally set the server name prefix.
   * The default values are fine for every other option.

5. Review and Confirm the Blueprint.

6. Deploy the Blueprint.
   * Once verified, click on the `deploy blueprint` button. You will see the deployment details stating the Blueprint is queued for execution.
   * This will kick off the Blueprint deploy process and load a page where you can track the deployment progress. Deployment will typically complete within five minutes.

7. Enable public access. (optional)
   * Servers are built using private IPs only with access with client or IPSEC VPN. For access from the Internet at large add a public IP to your master server. This service will require access to 8443/TCP and 9443/TCP.

    Adding a public IP to your virtual machine

8. Access MapR Cluster Service.
   * Navigate to `https://<ipaddress>:8443`.
    ![MCS Login](../../images/mapr/Picture1.png)

   * View the MCS dashboard.
    ![MCS Login](../../images/mapr/Picture2.png)

### Pricing
The costs listed in the above steps are for the infrastructure only. The default installation will install MapR Community Edition. You can upgrade to the Enterprise Edition through the MCS or by contacting MapR. [View a feature comparison between the editions](https://www.mapr.com/products/mapr-distribution-editions).

### Frequently Asked Questions
**Who should I contact for support?**
* For issues related to cloud infrastructure, please open a ticket using the [CenturyLink Cloud Support Process](../../Support/how-do-i-report-a-support-issue.md).
* For issues related to deploying the MapR Blueprints and application operation on CenturyLink Cloud,[contact MapR Support](https://www.mapr.com/support/overview).


text:
from django.core.handlers.wsgi import WSGIHandler
from django.test import SimpleTestCase, override_settings
from django.test.client import FakePayload

class ExceptionHandlerTests(SimpleTestCase):

    def get_suspicious_environ(self):
        payload = FakePayload('a=1&a=2&a=3\r\n')
        return {
            'REQUEST_METHOD': 'POST',
            'CONTENT_TYPE': 'application/x-www-form-urlencoded',
            'CONTENT_LENGTH': len(payload),
            'wsgi.input': payload,
            'SERVER_NAME': 'test',
            'SERVER_PORT': '8000',
        }

    @override_settings(DATA_UPLOAD_MAX_MEMORY_SIZE=12)
    def test_data_upload_max_memory_size_exceeded(self):
        response = WSGIHandler()(self.get_suspicious_environ(), lambda *a, **k: None)
        self.assertEqual(response.status_code, 400)

    @override_settings(DATA_UPLOAD_MAX_NUMBER_FIELDS=2)
    def test_data_upload_max_number_fields_exceeded(self):
        response = WSGIHandler()(self.get_suspicious_environ(), lambda *a, **k: None)
        self.assertEqual(response.status_code, 400)


text:
package org.uberfire.ext.wires.core.grids.client.widget.context;

import com.ait.lienzo.client.core.types.Transform;
import org.uberfire.ext.wires.core.grids.client.model.GridData;
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;

/**
 * The context of a Grid's column during the rendering phase.
 */
public class GridBodyColumnRenderContext {

    private final double absoluteGridX;
    private final double absoluteGridY;
    private final double absoluteColumnX;
    private final double clipMinY;
    private final double clipMinX;
    private final int minVisibleRowIndex;
    private final int maxVisibleRowIndex;
    private final boolean isFloating;
    private final GridData model;
    private final Transform transform;
    private final GridRenderer renderer;

    public GridBodyColumnRenderContext( final double absoluteGridX,
                                        final double absoluteGridY,
                                        final double absoluteColumnX,
                                        final double clipMinY,
                                        final double clipMinX,
                                        final int minVisibleRowIndex,
                                        final int maxVisibleRowIndex,
                                        final boolean isFloating,
                                        final GridData model,
                                        final Transform transform,
                                        final GridRenderer renderer ) {
        this.absoluteGridX = absoluteGridX;
        this.absoluteGridY = absoluteGridY;
        this.absoluteColumnX = absoluteColumnX;
        this.clipMinY = clipMinY;
        this.clipMinX = clipMinX;
        this.minVisibleRowIndex = minVisibleRowIndex;
        this.maxVisibleRowIndex = maxVisibleRowIndex;
        this.isFloating = isFloating;
        this.model = model;
        this.transform = transform;
        this.renderer = renderer;
    }

    /**
     * Returns the canvas x-coordinate of the Grid; not transformed.
     * @return
     */
    public double getAbsoluteGridX() {
        return absoluteGridX;
    }

    /**
     * Returns the canvas y-coordinate of the Grid; not transformed.
     * @return
     */
    public double getAbsoluteGridY() {
        return absoluteGridY;
    }

    /**
     * Returns the canvas x-coordinate of the Column; not transformed.
     * @return
     */
    public double getAbsoluteColumnX() {
        return absoluteColumnX;
    }

    /**
     * Returns the minimum Y coordinate for visible content. Content outside the region should be clipped.
     * @return
     */
    public double getClipMinY() {
        return clipMinY;
    }

    /**
     * Returns the minimum X coordinate for visible content. Content outside the region should be clipped.
     * @return
     */
    public double getClipMinX() {
        return clipMinX;
    }

    /**
     * Returns the index of the first row being rendered.
     * @return
     */
    public int getMinVisibleRowIndex() {
        return minVisibleRowIndex;
    }

    /**
     * Returns the index of the last row being rendered.
     * @return
     */
    public int getMaxVisibleRowIndex() {
        return maxVisibleRowIndex;
    }

    /**
     * Returns whether the column is floating.
     * @return true if the column is floating.
     */
    public boolean isFloating() {
        return isFloating;
    }

    /**
     * Returns the data model for the Grid Widget to which the Column relates.
     * @return
     */
    public GridData getModel() {
        return model;
    }

    /**
     * Returns the transformation of the Grid Widget.
     * @return
     */
    public Transform getTransform() {
        return transform;
    }

    /**
     * Returns the Renderer for the Grid Widget.
     * @return
     */
    public GridRenderer getRenderer() {
        return renderer;
    }

}


text:
;(function(){

// Cache Library //
// Designed to have a similar syntax as the the PHP caching library //

var ttlPrefix = "!!#";		// TTL variable prefix
var dataPrefix = "!!$";		// Data variable prefix
var userPrefix = "@";		// User Data variable prefix

// The cache uses Session Storage (free'd after closing browser) //
var storage = window.sessionStorage;
var canWrite = false;

// Confirm that we have sessionStorage //
if ( storage ) {
	// Confirm that writing works (i.e. will fail on Safari in Incogneto). //
	// That said, we assume if there are ANY keys, then writing is allowed //
	if ( storage.length > 0 ) {
		canWrite = true;
	}
	else {
		// If there are no keys, we write something to find out if it works //
		try {
			storage.setItem( "!", "" );
			storage.removeItem( "!" );
			canWrite = true;
		}
		catch (e) {
			// Writing failed //
		}
	}

	window.cache_Exists = function( key ) {
		var ttl = storage.getItem( ttlPrefix+key );

		// Does it exist? //
		if ( ttl == null ) {
			return false;
		}
		// Has the TTL expired? //
		else if ( Date.now() > ttl ) {
			// Remove in reverse order, just in case //
			storage.removeItem( dataPrefix+key );
			storage.removeItem( ttlPrefix+key );

			return false;
		}

		return true;
	}

	window.cache_Fetch = function( key ) {
		if ( !cache_Exists(key) )
			return null;

		// Return Data //
		return JSON.parse(storage.getItem( dataPrefix+key ));
	}

	// Remove expired items.
	// Optionally, specify the maximum number of items to remove.
	//
	// NOTE: Due to differences in browser implementations, this is not guaranteed
	//   to remove all expired items. But if there is one, it will remove it.
	//   Think of this as a single pass cache flush that *may* catch everything.
	window.cache_Flush = function( max_items ) {
		var itemsRemoved = 0;
		// Reverse order, just in case keys are like an array, so removing
		// elements off the end wont give us bad indexes
		for ( var idx = storage.length; idx--; ) {
			var key = storage.key(idx);
			// For this, we only care about items with the ttlPrefix
			if ( key && key.indexOf(ttlPrefix) === 0 ) {
				key = key.substr(ttlPrefix.length);
				if ( Date.now() > storage.getItem(ttlPrefix+key) ) {
					// Remove in reverse order, just in case
					storage.removeItem( dataPrefix+key );
					storage.removeItem( ttlPrefix+key );
					itemsRemoved++;

					// CLEVERNESS: If omitted, max_items is undefined, and
					//   itemsRemoved will always be 1+.
					if ( itemsRemoved === max_items ) {
						return itemsRemoved;
					}
				}
			}
		}
		return itemsRemoved;
	}

	// NOTE: User data is assumed to be any key prefixed with an @ sign.
	window.cache_FlushUserData = function() {
		// Since we can't be 100% sure the browser isn't fragmenting the key order,
		// we need to repeat until we are sure there are no user data keys left.
		do {
			var itemsRemoved = 0;
			// Reverse order, just in case keys are like an array, so removing
			// elements off the end wont give us bad indexes
			for ( var idx = storage.length; idx--; ) {
				var key = storage.key(idx);
				if ( key && key.indexOf(ttlPrefix) === 0 ) {
					key = key.substr(ttlPrefix.length);
					if ( key.indexOf(userPrefix) === 0 ) {
						// Remove in reverse order, just in case
						storage.removeItem( dataPrefix+key );
						storage.removeItem( ttlPrefix+key );
						itemsRemoved++;
					}
				}
			}
		} while ( itemsRemoved == 0 );
	}
}
else /* storage */ {
	window.cache_Exists = function() { return false; }
	window.cache_Fetch = function() { return null; }
	window.cache_Flush = function() { return 0; }
} /* storage */

if ( canWrite ) {
	window.cache_Store = function( key, value, new_ttl ) {
		if ( typeof new_ttl === 'undefined' )
			var ttl = Number.MAX_VALUE;
		else
			var ttl = Date.now()+new_ttl;

		// Store TTL first, then Data //
		try {
			storage.setItem( ttlPrefix+key, ttl );
			storage.setItem( dataPrefix+key, JSON.stringify(value) );
		}
		catch (e) {
			// Flush and try again //
			cache_Flush();

			try {
				storage.setItem( ttlPrefix+key, ttl );
				storage.setItem( dataPrefix+key, JSON.stringify(value) );
			}
			catch (e2) {
				// Cleanup - Only ttlPrefix should exist, but just in case //
				storage.removeItem( dataPrefix+key );
				storage.removeItem( ttlPrefix+key );

				return false;
			}
		}

		// Success //
		return true;
	}

	window.cache_Create = function( key, value, new_ttl ) {
		if ( cache_Exists(key) )
			return false;

		return cache_Store( key, value, new_ttl );
	}

	window.cache_Touch = function( key, new_ttl ) {
		if ( !cache_Exists(key) )
			return false;

		if ( typeof new_ttl === 'undefined' )
			var ttl = Number.MAX_VALUE;
		else
			var ttl = Date.now()+new_ttl;

		// Update the TTL //
		try {
			storage.setItem( ttlPrefix+key, ttl );
		}
		catch (e) {
			// Flush and try again //
			cache_Flush();

			try {
				storage.setItem( ttlPrefix+key, ttl );
			}
			catch (e2) {
				return false;
			}
		}

		// Success //
		return true;
	}
}
else /* canwrite */ {
	window.cache_Store = function() { return false; }
	window.cache_Create = function() { return false; }
	window.cache_Touch = function() { return false; }
} /* canwrite */

})();


text:
if [ -f /etc/lsb-release ]; then
    . /etc/lsb-release
    DISTRO=$DISTRIB_ID
elif [ -f /etc/debian_version ]; then
    DISTRO=Debian
    # XXX or Ubuntu
elif [ -f /etc/redhat-release ]; then
    DISTRO="Red Hat"
    # XXX or CentOS or Fedora
else
    DISTRO=$(uname -s)
fi

if [ "$DISTRO" = "Red Hat" ]  || [ "$DISTRO" = "Ubuntu" ] || [ "$DISTRO" = "Debian" ]
then
CONF='//usr/share/megam/verticegulpd/conf/gulpd.conf'
else if [ "$DISTRO" = "CoreOS" ]; then
  CONF='//var/lib/megam/verticegulpd/conf/gulpd.conf'
fi
fi
cat >$CONF  << 'EOF'

### Welcome to the Gulpd configuration file.

  ###
  ### [meta]
  ###
  ### Controls the parameters for the Raft consensus group that stores metadata
  ### about the gulp.
  ###

  [meta]
    riak = ["192.168.1.105:8087"]
    api  = "https://api.megam.io/v2"
    nsqd = ["103.56.92.4:4151"]

  ###
  ### [gulpd]
  ###
  ### Controls which assembly to be deployed into machine
  ###

  [gulpd]
    enabled =true
    name_gulp = "hostname"
    cats_id = "AMS1259077729232486400"
    cat_id = "ASM1260230009767985152"
	provider = "chefsolo"
	cookbook = "megam_run"
	repository = "github"
	repository_path = "https://github.com/megamsys/chef-repo.git"
  repository_tar_path = "https://github.com/megamsys/chef-repo/archive/0.96.tar.gz"

  ###
  ### [http]
  ###
  ### Controls how the HTTP endpoints are configured. This a frill
  ### mechanism for pinging gulpd (ping)
  ###

  [http]
    enabled = false
    bind-address = "127.0.0.1:6666"

EOF

sed -i "s/^[ \t]*name_gulp.*/    name = \"$NODE_NAME\"/" $CONF
sed -i "s/^[ \t]*cats_id.*/    cats_id = \"$ASSEMBLIES_ID\"/" $CONF
sed -i "s/^[ \t]*cat_id.*/    cat_id = \"$ASSEMBLY_ID\"/" $CONF

case "$DISTRO" in
   "Ubuntu")
stop verticegulpd
start verticegulpd
   ;;
   "Debian")
systemctl stop verticegulpd.service
systemctl start verticegulpd.service
systemctl stop cadvisor.service
systemctl start cadvisor.service
   ;;
   "Red Hat")
systemctl stop verticegulpd.service
systemctl start verticegulpd.service
systemctl stop cadvisor.service
systemctl start cadvisor.service
   ;;
   "CoreOS")
if [ -f /mnt/context.sh ]; then
  . /mnt/context.sh
fi

systemctl stop verticegulpd.service
systemctl start verticegulpd.service
systemctl stop cadvisor.service
systemctl start cadvisor.service

sudo cat >> //home/core/.ssh/authorized_keys <<EOF
$SSH_PUBLIC_KEY
EOF

sudo -s

sudo cat > //etc/hostname <<EOF
$HOSTNAME
EOF

sudo cat >> //etc/hosts <<EOF
$IP_ADDRESS $HOSTNAME localhost

EOF

sudo cat > //etc/systemd/network/static.network <<EOF
[Match]
Name=ens3

[Network]
Address=$IP_ADDRESS/24
Gateway=$GATEWAY
DNS=8.8.8.8
DNS=8.8.4.4
EOF

sudo systemctl restart systemd-networkd

   ;;
esac


text:
//
// PaketSearchDataSource.cs
//
// Author:
//       Matt Ward <ward.matt@gmail.com>
//
// Copyright (c) 2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

using System.Collections.Generic;
using System.Linq;
using MonoDevelop.Components.MainToolbar;
using MonoDevelop.Paket.Commands;

namespace MonoDevelop.Paket
{
	public class PaketSearchDataSource
	{
		List<PaketSearchResult> searchResults;

		public PaketSearchDataSource (SearchPopupSearchPattern searchPattern)
		{
			searchResults = PaketSearchCommands
				.FilterCommands (searchPattern.Pattern)
				.Select (command => new PaketSearchResult (command))
				.ToList ();
		}

		public IEnumerable<PaketSearchResult> GetResults ()
		{
			return searchResults;
		}
	}
}


text:
namespace WorldSalt.UnitTests.Network.Frames {
	using NUnit.Framework;
	using Rhino.Mocks;
	using WorldSalt.Network.Direction;
	using WorldSalt.Network.Frames;
	using WorldSalt.Network.Payloads;

	[TestFixture]
	public class UntypedFrameUnitTest {
		[Test]
		public void ShouldConstructWithDefaults() {
			var target = new UntypedFrame<FromClient>();

			Assert.AreEqual(0x00, target.Type);
			Assert.AreEqual(0x00, target.Subtype);
			Assert.NotNull(target.Payload);
			Assert.AreEqual(0, target.Payload.Length);
		}

		[Test]
		public void ShouldConstructWithArguments() {
			var expectedType = (byte)0x12;
			var expectedSubtype = (byte)0x34;
			var expectedPayload = MockRepository.GenerateMock<IRawPayload<FromClient>>();
			var target = new UntypedFrame<FromClient>(expectedType, expectedSubtype, expectedPayload);

			Assert.AreEqual(expectedType, target.Type);
			Assert.AreEqual(expectedSubtype, target.Subtype);
			Assert.AreSame(expectedPayload, target.Payload);
		}
	}
}


text:
@class NSMutableArray, NSString;

@interface EmoticonBoughtListCache : MMObject <PBCoding>
{
    NSMutableArray *itemList;
}

+ (void)initialize;
@property(retain, nonatomic) NSMutableArray *itemList; // @synthesize itemList;
- (void).cxx_destruct;
- (id)init;
- (const map_0e718273 *)getValueTagIndexMap;
- (id)getValueTypeTable;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
namespace chrono {
namespace vehicle {

// -----------------------------------------------------------------------------
ChTrackShoeBandBushing::ChTrackShoeBandBushing(const std::string& name) : ChTrackShoeBand(name) {}

ChTrackShoeBandBushing::~ChTrackShoeBandBushing() {}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::Initialize(std::shared_ptr<ChBodyAuxRef> chassis,
                                        const ChVector<>& location,
                                        const ChQuaternion<>& rotation) {
    // Initialize base class (create tread body)
    ChTrackShoeBand::Initialize(chassis, location, rotation);

    // Cache values calculated from template parameters.
    m_seg_length = GetWebLength() / GetNumWebSegments();
    m_seg_mass = GetWebMass() / GetNumWebSegments();
    m_seg_inertia = GetWebInertia();  //// TODO - properly distribute web inertia

    // Express the tread body location and orientation in global frame.
    ChVector<> loc = chassis->TransformPointLocalToParent(location);
    ChQuaternion<> rot = chassis->GetRot() * rotation;
    ChVector<> xdir = rot.GetXaxis();

    // Create the required number of web segment bodies
    ChVector<> seg_loc = loc + (0.5 * GetToothBaseLength()) * xdir;
    for (int is = 0; is < GetNumWebSegments(); is++) {
        m_web_segments.push_back(std::shared_ptr<ChBody>(chassis->GetSystem()->NewBody()));
        m_web_segments[is]->SetNameString(m_name + "_web_" + std::to_string(is));
        m_web_segments[is]->SetPos(seg_loc + ((2 * is + 1) * m_seg_length / 2) * xdir);
        m_web_segments[is]->SetRot(rot);
        m_web_segments[is]->SetMass(m_seg_mass);
        m_web_segments[is]->SetInertiaXX(m_seg_inertia);
        m_web_segments[is]->SetCollide(true);
        chassis->GetSystem()->AddBody(m_web_segments[is]);

        // Add contact geometry
        AddWebContact(m_web_segments[is]);
    }
}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::Initialize(std::shared_ptr<ChBodyAuxRef> chassis,
                                        const std::vector<ChCoordsys<>>& component_pos) {
    // Check the number of provided locations and orientations.
    assert(component_pos.size() == GetNumWebSegments() + 1);

    // Initialize at origin.
    Initialize(chassis, VNULL, QUNIT);

    // Overwrite absolute body locations and orientations.
    m_shoe->SetPos(chassis->TransformPointLocalToParent(component_pos[0].pos));
    m_shoe->SetRot(chassis->GetRot() * component_pos[0].rot);

    for (int is = 0; is < GetNumWebSegments(); is++) {
        m_web_segments[is]->SetPos(chassis->TransformPointLocalToParent(component_pos[is + 1].pos));
        m_web_segments[is]->SetRot(chassis->GetRot() * component_pos[is + 1].rot);
    }
}

void ChTrackShoeBandBushing::InitializeInertiaProperties() {
    m_mass = GetTreadMass() + GetWebMass();
}

void ChTrackShoeBandBushing::UpdateInertiaProperties() {
    m_xform = m_shoe->GetFrame_REF_to_abs();

    // Calculate COM and inertia expressed in global frame
    utils::CompositeInertia composite;
    composite.AddComponent(m_shoe->GetFrame_COG_to_abs(), m_shoe->GetMass(), m_shoe->GetInertia());
    for (int is = 0; is < GetNumWebSegments(); is++) {
        composite.AddComponent(m_web_segments[is]->GetFrame_COG_to_abs(), m_web_segments[is]->GetMass(),
                               m_web_segments[is]->GetInertia());
    }

    // Express COM and inertia in subsystem reference frame
    m_com.coord.pos = m_xform.TransformPointParentToLocal(composite.GetCOM());
    m_com.coord.rot = QUNIT;

    m_inertia = m_xform.GetA().transpose() * composite.GetInertia() * m_xform.GetA();
}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::AddWebContact(std::shared_ptr<ChBody> segment) {
    segment->GetCollisionModel()->ClearModel();

    segment->GetCollisionModel()->SetFamily(TrackedCollisionFamily::SHOES);
    segment->GetCollisionModel()->SetFamilyMaskNoCollisionWithFamily(TrackedCollisionFamily::SHOES);

    segment->GetCollisionModel()->AddBox(m_body_material, m_seg_length / 2, GetBeltWidth() / 2, GetWebThickness() / 2);

    segment->GetCollisionModel()->BuildModel();
}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::AddVisualizationAssets(VisualizationType vis) {
    if (vis == VisualizationType::NONE)
        return;

    AddShoeVisualization();
    for (auto& segment : m_web_segments)
        AddWebVisualization(segment);
}

void ChTrackShoeBandBushing::RemoveVisualizationAssets() {
    ChPart::RemoveVisualizationAssets(m_shoe);
    for (auto& segment : m_web_segments) {
        ChPart::RemoveVisualizationAssets(segment);
    }
}

void ChTrackShoeBandBushing::AddWebVisualization(std::shared_ptr<ChBody> segment) {
    auto box = chrono_types::make_shared<ChBoxShape>();
    box->GetBoxGeometry().SetLengths(ChVector<>(m_seg_length, GetBeltWidth(), GetWebThickness()));
    segment->AddVisualShape(box);

    auto cyl = chrono_types::make_shared<ChCylinderShape>();
    double radius = GetWebThickness() / 4;
    cyl->GetCylinderGeometry().rad = radius;
    cyl->GetCylinderGeometry().p1 = ChVector<>(m_seg_length / 2, -GetBeltWidth() / 2 - 2 * radius, 0);
    cyl->GetCylinderGeometry().p2 = ChVector<>(m_seg_length / 2, +GetBeltWidth() / 2 + 2 * radius, 0);
    segment->AddVisualShape(cyl);
}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::Connect(std::shared_ptr<ChTrackShoe> next,
                                     ChTrackAssembly* assembly,
                                     ChChassis* chassis,
                                     bool ccw) {
    int index = 0;

    auto z2y = Q_from_AngX(CH_C_PI_2);

    // Connect tread body to the first web segment.
    {
        ChVector<> loc = m_shoe->TransformPointLocalToParent(ChVector<>(GetToothBaseLength() / 2, 0, 0));
        ChQuaternion<> rot = m_shoe->GetRot() * z2y;
        auto bushing = chrono_types::make_shared<ChVehicleJoint>(
            ChVehicleJoint::Type::REVOLUTE, m_name + "_bushing_" + std::to_string(index++), m_web_segments[0], m_shoe,
            ChCoordsys<>(loc, rot), GetBushingData());
        chassis->AddJoint(bushing);
        m_web_bushings.push_back(bushing->GetAsBushing());
    }

    // Connect the web segments to each other.
    for (size_t is = 0; is < GetNumWebSegments() - 1; is++) {
        ChVector<> loc = m_web_segments[is]->TransformPointLocalToParent(ChVector<>(m_seg_length / 2, 0, 0));
        ChQuaternion<> rot = m_web_segments[is]->GetRot() * z2y;
        auto bushing = chrono_types::make_shared<ChVehicleJoint>(
            ChVehicleJoint::Type::REVOLUTE, m_name + "_bushing_" + std::to_string(index++), m_web_segments[is + 1],
            m_web_segments[is], ChCoordsys<>(loc, rot), GetBushingData());
        chassis->AddJoint(bushing);
        m_web_bushings.push_back(bushing->GetAsBushing());
    }

    {
        // Connect the last web segment to the tread body from the next track shoe.
        int is = GetNumWebSegments() - 1;
        ChVector<> loc = m_web_segments[is]->TransformPointLocalToParent(ChVector<>(m_seg_length / 2, 0, 0));
        ChQuaternion<> rot = m_web_segments[is]->GetRot() * z2y;
        auto bushing = chrono_types::make_shared<ChVehicleJoint>(
            ChVehicleJoint::Type::REVOLUTE, m_name + "_bushing_" + std::to_string(index++), next->GetShoeBody(),
            m_web_segments[is], ChCoordsys<>(loc, rot), GetBushingData());
        chassis->AddJoint(bushing);
        m_web_bushings.push_back(bushing->GetAsBushing());
    }
}

ChVector<> ChTrackShoeBandBushing::GetTension() const {
    return m_web_bushings[0]->GetForce();
}

// -----------------------------------------------------------------------------
void ChTrackShoeBandBushing::ExportComponentList(rapidjson::Document& jsonDocument) const {
    ChPart::ExportComponentList(jsonDocument);

    std::vector<std::shared_ptr<ChBody>> bodies;
    bodies.push_back(m_shoe);
    bodies.insert(bodies.end(), m_web_segments.begin(), m_web_segments.end());
    ChPart::ExportBodyList(jsonDocument, bodies);

    ChPart::ExportBodyLoadList(jsonDocument, m_web_bushings);
}

void ChTrackShoeBandBushing::Output(ChVehicleOutput& database) const {
    if (!m_output)
        return;

    std::vector<std::shared_ptr<ChBody>> bodies;
    bodies.push_back(m_shoe);
    bodies.insert(bodies.end(), m_web_segments.begin(), m_web_segments.end());
    database.WriteBodies(bodies);

    database.WriteBodyLoads(m_web_bushings);
}

}  // end namespace vehicle
}  // end namespace chrono