text:
void baz() {
  int *foo = (int *)-1; // make a bad pointer
  printf("%d\n", *foo); // causes segfault
}

void bar() { baz(); }
void foo() { bar(); }

int main(int argc, char *argv[]) {
  QApplication application(argc, argv);
  CrashCpp::init();
  CrashCpp::addReporter(std::make_shared<crashcpp::PostReport>(
      "http://localhost:3000/api/report"));
  foo();
  return application.exec();
}

redpajama_set_name: RedPajamaGithub


text:
/* jshint esnext: true */

import IntlMessageFormat from 'intl-messageformat';
import IntlRelativeFormat from 'intl-relativeformat';
import createFormatCache from 'intl-format-cache';

import {
    assertIsDate,
    extend,
    contextGet,
    getFormatOptions,
    getLocales,
    tap
} from './utils.js';

export {registerWith};

// -----------------------------------------------------------------------------

var getNumberFormat   = createFormatCache(Intl.NumberFormat),
    getDateTimeFormat = createFormatCache(Intl.DateTimeFormat),
    getMessageFormat  = createFormatCache(IntlMessageFormat),
    getRelativeFormat = createFormatCache(IntlRelativeFormat);

function registerWith (dust) {
    extend(dust.helpers, {
        intl          : intl,
        formatDate    : formatDate,
        formatTime    : formatTime,
        formatRelative: formatRelative,
        formatNumber  : formatNumber,
        formatMessage : formatMessage
    });

    // Deprecated helpers (renamed):
    extend(dust.helpers, {
        intlDate   : deprecate('intlDate', formatDate),
        intlTime   : deprecate('intlTime', formatTime),
        intlNumber : deprecate('intlNumber', formatNumber),
        intlMessage: deprecate('intlMessage', formatMessage)
    });

    function deprecate(name, suggestion) {
        return function () {
            if (typeof console !== 'undefined' &&
                typeof console.warn === 'function') {

                console.warn(
                    '{@' + name + '} is deprecated, use: ' +
                    '{@' + suggestion.name + '}'
                );
            }

            return suggestion.apply(this, arguments);
        };
    }

    // -- Helpers ------------------------------------------------------------------

    /**
    A block wrapper which stashes the `params` in the context so that
    they are available for other intl helpers within the block.
    @method intl
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function intl(chunk, context, bodies, params) {
        var ctx = {};
        if (bodies.block) {
            ctx.intl = params || {};
            return chunk.render(bodies.block, context.push(ctx));
        }
        return chunk;
    }

    /**
    Interprets `params.val` as a date or time to format and uses the custom `date`
    formats.
    @method formatDate
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function formatDate(chunk, context, bodies, params) {
        var formatOptions,
            locales,
            val,
            formatter;
        params = params || {};

        if (!params.hasOwnProperty('val')) {
            throw new ReferenceError('@formatDate needs a `val` parameter');
        }
        val = tap(params.val, chunk, context);
        delete params.val;  // since params might be interpreted as format options
        val = new Date(val);
        assertIsDate(val, '@formatDate requires a valid date or timestamp `val`');

        formatOptions = getFormatOptions('date', chunk, params, context);
        locales = getLocales(chunk, params, context);
        formatter = getDateTimeFormat(locales, formatOptions);
        chunk.write(dust.escapeHtml(formatter.format(val)));
        return chunk;
    }

    /**
    Interprets `params.val` as a date or time to format and uses the custom `time`
    formats.
    @method formatTime
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function formatTime(chunk, context, bodies, params) {
        var formatOptions,
            locales,
            val,
            formatter;
        params = params || {};

        if (!params.hasOwnProperty('val')) {
            throw new ReferenceError('@formatTime needs a `val` parameter');
        }
        val = tap(params.val, chunk, context);
        delete params.val;  // since params might be interpretted as format options
        val = new Date(val);
        assertIsDate(val, '@formatTime requires a valid date or timestamp `val`');

        formatOptions = getFormatOptions('time', chunk, params, context);
        locales = getLocales(chunk, params, context);
        formatter = getDateTimeFormat(locales, formatOptions);
        chunk.write(dust.escapeHtml(formatter.format(val)));
        return chunk;
    }

    /**
    Interprets `params.val` as a date or time to format relative to "now", and uses
    the custom `relative` formats.
    @method formatRelative
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function formatRelative(chunk, context, bodies, params) {
        params = params || {};

        if (!params.hasOwnProperty('val')) {
            throw new ReferenceError('@formatRelative needs a `val` parameter');
        }

        var val = new Date(tap(params.val, chunk, context));
        assertIsDate(val, '@formatRelative requires a valid date or timestamp `val`');
        delete params.val;  // since params might be interpreted as format options

        var now = tap(params.now, chunk, context);
        delete params.now;

        var formatOptions = getFormatOptions('relative', chunk, params, context);
        var locales       = getLocales(chunk, params, context);
        var formatter     = getRelativeFormat(locales, formatOptions);

        chunk.write(dust.escapeHtml(formatter.format(val, {now: now})));
        return chunk;
    }

    /**
    Interprets `params.val` as a number to format.
    @method formatNumber
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function formatNumber(chunk, context, bodies, params) {
        var formatOptions,
            locales,
            val,
            formatter;
        params = params || {};

        if (!params.hasOwnProperty('val')) {
            throw new ReferenceError('@formatNumber needs a `val` parameter');
        }
        val = tap(params.val, chunk, context);
        delete params.val;  // since params might be interpretted as format options

        formatOptions = getFormatOptions('number', chunk, params, context);
        locales = getLocales(chunk, params, context);
        formatter = getNumberFormat(locales, formatOptions);
        chunk.write(dust.escapeHtml(formatter.format(val)));
        return chunk;
    }

    /**
    Interprets `params.val` as a YRB message to format.
    @method formatMessage
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
    function formatMessage(chunk, context, bodies, params) {
        var formatOptions = {},
            locales,
            msg,
            formatter;
        params = params || {};

        if (params.hasOwnProperty('_msg')) {
            msg = params._msg;
        }
        else if (params._key) {
            msg = contextGet(context, ['intl', 'messages', tap(params._key, chunk, context)]);
        }
        else {
            throw new ReferenceError('@formatMessage needs either a `_msg` or `_key` parameter');
        }

        // optimization for messages that have already been compiled
        if ('object' === typeof msg && 'function' === typeof msg.format) {
            chunk.write(msg.format(params));
            return chunk;
        }

        formatOptions = contextGet(context, ['intl', 'formats']);
        locales = getLocales(chunk, params, context);
        formatter = getMessageFormat(msg, locales, formatOptions);
        chunk.write(dust.escapeHtml(formatter.format(params)));
        return chunk;
    }
}


text:
from captcha.fields import ReCaptchaField

from django.forms.widgets import Select
from django import forms
from django.forms.widgets import Textarea
from django.utils.translation import get_language, ugettext_lazy as _

from rando.feedback.models import FeedbackCategory

class CategorySelect(Select):
    def render_options(self, *args, **kwargs):
        categories = FeedbackCategory.objects.filter(language=get_language()).all()
        self.choices = [(c.id, c.label) for c in categories]
        return super(CategorySelect, self).render_options(*args, **kwargs)

class FeedBackForm(forms.Form):

    name = forms.CharField(max_length=200, label=_('Name'))
    email = forms.EmailField(max_length=200, label=_('Email'))
    category = forms.CharField(label=_('Category'),
                               widget=CategorySelect)
    comment = forms.CharField(widget=Textarea(
        attrs={'rows': 3, 'cols': 50,
               'placeholder': _(u'Description of your problem')}),
        label=_('Description'))

    latitude = forms.FloatField(required=False, label=_(u'Lat'))
    longitude = forms.FloatField(required=False, label=_(u'Lng'))

    captcha = ReCaptchaField(label=_(u'Captcha'))


text:
namespace blunted {

void Initialize() {
  DO_VALIDATION;
  // initialize resource managers
  GetContext().geometry_manager.RegisterLoader("ase", &GetContext().aseLoader);
  GetContext().surface_manager.RegisterLoader("jpg", &GetContext().imageLoader);
  GetContext().surface_manager.RegisterLoader("png", &GetContext().imageLoader);
  GetContext().surface_manager.RegisterLoader("bmp", &GetContext().imageLoader);
  TTF_Init();
}

void Exit() {
  DO_VALIDATION;
  GetContext().scene2D->Exit();
  GetContext().scene3D->Exit();
  GetContext().graphicsSystem.Exit();
  TTF_Quit();
  SDL_Quit();
}
}


text:
* [Download ZIP](http://tutorials.pipeline-dev.services.acquia.io/pipelinestutorial501.zip)
* [Watch video](https://player.vimeo.com/video/184399322)

The purpose of the 501 tutorial is to demonstrate the Pipelines web env and show how you can run Behat as an example use of the web
environment.

Copy the files and directories from this directory into your Acquia Cloud repository. To get the files, clone this repository and look in the tutorial-501 folder, or you can [download the ZIP file here](http://tutorials.pipeline-dev.services.acquia.io/pipelinestutorial501.zip).

The Drupal 8 composer.json has been modified to include behat packages and the installation directories and script handler use docroot for Acquia Cloud instead of the default Drupal composer directory web.

The steps are:

* Clear out a branch in your Acquia Cloud repo so that only the tutorial files are included.
* Commit the sample files to your Cloud repo.
* Commit the changed YAML file and push to Cloud:
```
   git commit -a -m 'web environment test'
   git push origin master
```
* Run ```pipelines start```.
* When ```pipelines status``` shows the job is complete, run ```pipeline logs``` to see the results of the Behat tests.


text:
@interface NSDate (Formatter)

#pragma mark DATE TO STRING

- (NSString *)stringWithFormat:(NSString *)fmtString;

- (NSString *)stringWithFormat:(NSString *)fmtString andTimezone:(NSString *)timezoneName;

#pragma mark STRING TO DATE

#pragma mark UTC

- (NSNumber *)utcTimeIntervalSince1970;

- (NSNumber *)utcTimeIntervalIntSince1970;

- (NSString *)timeIntervalStringSince1970;

#pragma mark WEEKDAY

- (int)weekdayNumber;

- (int)weekdayNumberPRC;

#pragma mark HOUR MINUTE SECOND

- (int)hourNumberPRC;

@end


text:
Rails.application.routes.draw do
  # GET /
  root 'static_pages#index'

  namespace :admin do
    get 'control_panel' => 'control_panel#index'
    get 'static_page' => 'static_pages#index'
  end

  devise_for :users , :skip => [:sessions, :passwords, :registrations]
  as :user do
    #new_user_session
    get   'signin' => 'devise/sessions#new', :as => :new_user_session
    #user_session
    post  'signin' => 'devise/sessions#create', :as => :user_session
    #destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
    match 'signout' => 'devise/sessions#destroy', :as => :destroy_user_session, :via => Devise.mappings[:user].sign_out_via
    #user_password POST   /users/password(.:format)      devise/passwords#create
    get   'user_password' => 'devise/passwords#create', :as => :user_password
    #new_user_password GET    /users/password/new(.:format)  devise/passwords#new
    get   'new_user_password' => 'devise/passwords#new', :as => :new_user_password
    #edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
    get   'edit_password' => 'devise/passwords#edit', :as => :edit_user_password
    #PATCH  /users/password(.:format)      devise/passwords#update
    patch '/users/password(.:format)' => 'devise/passwords#update'
    #PUT    /users/password(.:format)      devise/passwords#update
    put   '/users/password(.:format)' => 'devise/passwords#update'
    #cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
    get   'cancel_user_registration' => 'devise/registrations#cancel', :as => :cancel_user_registration
    #user_registration POST   /users(.:format)               devise/registrations#create
    post  'user_registration' => 'devise/registrations#create'
    #new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
    get   'sign_up' => 'devise/registrations#new', :as => :new_user_registration
    #edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
    get   'edit_user_registration' => 'devise/registrations#edit', :as => :edit_user_registration
    #PATCH  /users(.:format)               devise/registrations#update
    patch '/users(.:format)' => 'devise/registrations#update'
    #PUT    /users(.:format)               devise/registrations#update
    put   'users(.:format)' => 'devise/registrations#update'
    #DELETE /users(.:format)               devise/registrations#destroy
    delete '/users(.:format)' => 'devise/registrations#destroy'
  end
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end


text:
namespace glslang {

//
// TPrefixType is used to centralize how info log messages start.
// See below.
//
enum TPrefixType {
    EPrefixNone,
    EPrefixWarning,
    EPrefixError,
    EPrefixInternalError,
    EPrefixUnimplemented,
    EPrefixNote
};

enum TOutputStream {
    ENull = 0,
    EDebugger = 0x01,
    EStdOut = 0x02,
    EString = 0x04,
};
//
// Encapsulate info logs for all objects that have them.
//
// The methods are a general set of tools for getting a variety of
// messages and types inserted into the log.
//
class TInfoSinkBase {
public:
    TInfoSinkBase() : outputStream(4) {}
    void erase() { sink.erase(); }
    TInfoSinkBase& operator<<(const TPersistString& t) { append(t); return *this; }
    TInfoSinkBase& operator<<(char c)                  { append(1, c); return *this; }
    TInfoSinkBase& operator<<(const char* s)           { append(s); return *this; }
    TInfoSinkBase& operator<<(int n)                   { append(String(n)); return *this; }
    TInfoSinkBase& operator<<(unsigned int n)          { append(String(n)); return *this; }
    TInfoSinkBase& operator<<(float n)                 { const int size = 40; char buf[size];
                                                         snprintf(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ? "%f" : "%g", n);
                                                         append(buf);
                                                         return *this; }
    TInfoSinkBase& operator+(const TPersistString& t)  { append(t); return *this; }
    TInfoSinkBase& operator+(const TString& t)         { append(t); return *this; }
    TInfoSinkBase& operator<<(const TString& t)        { append(t); return *this; }
    TInfoSinkBase& operator+(const char* s)            { append(s); return *this; }
    const char* c_str() const { return sink.c_str(); }
    void prefix(TPrefixType message) {
        switch(message) {
        case EPrefixNone:                                      break;
        case EPrefixWarning:       append("WARNING: ");        break;
        case EPrefixError:         append("ERROR: ");          break;
        case EPrefixInternalError: append("INTERNAL ERROR: "); break;
        case EPrefixUnimplemented: append("UNIMPLEMENTED: ");  break;
        case EPrefixNote:          append("NOTE: ");           break;
        default:                   append("UNKNOWN ERROR: ");   break;
        }
    }
    void location(const TSourceLoc& loc) {
        const int maxSize = 24;
        char locText[maxSize];
        snprintf(locText, maxSize, ":%d", loc.line);
        append(loc.getStringNameOrNum(false).c_str());
        append(locText);
        append(": ");
    }
    void message(TPrefixType message, const char* s) {
        prefix(message);
        append(s);
        append("\n");
    }
    void message(TPrefixType message, const char* s, const TSourceLoc& loc) {
        prefix(message);
        location(loc);
        append(s);
        append("\n");
    }

    void setOutputStream(int output = 4)
    {
        outputStream = output;
    }

protected:
    void append(const char* s);

    void append(int count, char c);
    void append(const TPersistString& t);
    void append(const TString& t);

    void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2)
                                       sink.reserve(sink.capacity() +  sink.capacity() / 2); }
    void appendToStream(const char* s);
    TPersistString sink;
    int outputStream;
};

} // end namespace glslang

class TInfoSink {
public:
    glslang::TInfoSinkBase info;
    glslang::TInfoSinkBase debug;
};

#endif // _INFOSINK_INCLUDED_


text:
'use strict';

// Setting up route
angular.module('core').config(['$stateProvider', '$urlRouterProvider',
	function($stateProvider, $urlRouterProvider) {
        // Redirect to home view when route not found
        $urlRouterProvider.otherwise('/');

        // Home state routing
        $stateProvider
            .state('client', {
                url: '/client',
                templateUrl: 'modules/client/views/index-client.client.view.html'
            })
            .state('client.scanDevices', {
                url: '/scan',
                templateUrl: 'modules/client/views/scan-client.client.view.html'
            })
            .state('client.systemInfo', {
                url: '/systemInfo',
                templateUrl: 'modules/client/views/info-client.client.view.html'
            })
            .state('client.dataRw', {
                url: '/dataRw',
                templateUrl: 'modules/client/views/dataRw-client.client.view.html'
            });
    }

]);


text:
 <a href='<?php echo APP_ROOT; ?>'>Home

 <a href='<?php echo APP_ROOT; ?>/pages/admin_index.php'>Admin

                <?php if ($page->userPosition == "admin") { ?>
                    Reservations

                    Rooms

                    Inventory

                    Logout

                <?php } elseif ($page->userPosition == "clerk") { ?>
                    Reservations

                    Logout

                <?php } ?>

Reservations

                                    <?php if (count($page->reservations) > 0) { ?>

                                            Name
                                            Arrival
                                            Departure
                                            Room Type
                                            No. of Nights
                                            Action

                                        <?php foreach($page->reservations as $reservation) { ?>

                                            <?php echo $reservation['firstname'] . ' ' . $reservation['lastname']; ?>
                                            <?php echo $reservation['arrival_date']; ?>
                                            <?php echo $reservation['departure_date']; ?>

                                                <?php
                                                $roomId = $reservation['room_id'];
                                                $room = R::getRow("SELECT * FROM room WHERE id = ?", Array($roomId));
                                                echo $room['type'];
                                                ?>

                                            <?php echo $reservation['number_days']; ?>
                                            <a href='checkout.php?resid=<?php echo $reservation["id"];?>'>Check Out | <a rel="facebox" href='reservationview.php?resid=<?php echo $reservation["id"];?>'>View

                                        <?php } ?>

                                    <?php } else { ?>
                                    No reservations are currently active
                                    <?php } ?>

                                    Search

Rooms

                                            Type
                                            Rate
                                            Descripton
                                            Quantity
                                            Action

                                        <?php foreach($page->rooms as $room) { ?>

                                            <?php echo $room['type'];?>
                                            <?php echo $room['rate'];?>
                                            <?php echo $room['description'];?>
                                            <?php echo $room['quantity']; ?>

                                                <a rel="facebox" href='roomedit.php?id=<?php echo $room["id"]; ?>'>Edit |
                                                <a rel="facebox" href='roomdelete.php?id=<?php echo $room["id"]; ?>'>Delete

                                        <?php } ?>

                                    Add Room

Inventory

                                        <?php foreach($page->rooms as $room) {
                                            $roomId = $room["id"];
                                            $roomType = $room["type"];
                                            $quantityReserved = R::getRow("SELECT SUM(quantity_reserve) FROM room_inventory WHERE status != :status AND room_id = :roomId", Array(":status" => 'Out', ":roomId" => $roomId));
                                            $quantityReservedSum = (isset($quantityReserved['SUM(quantity_reserve)'])) ? $quantityReserved['SUM(quantity_reserve)'] : 0; ?>

<?php echo $roomType; ?> reservations:	 <?php echo $quantityReservedSum; ?>

                                        <?php } ?>

                                            Arrival
                                            Departure
                                            Quantity Reserve
                                            Room Type
                                            Confirmation Number
                                            Status

                                        <?php foreach($page->roomInventory as $inventory) { ?>

                                            <?php echo $inventory['arrival_date']; ?>
                                            <?php echo $inventory['departure_date']; ?>
                                            <?php echo $inventory['quantity_reserve']; ?>
                                             <?php
                                                $roomId = $inventory['room_id'];
                                                $room = R::getRow("SELECT * FROM room WHERE id = ?", Array($roomId));
                                                echo $room["type"];
                                            ?>

                                            <?php echo $inventory['confirmation_code'];?>
                                            <?php echo $inventory['status'];?>

                                        <?php } ?>


text:
package org.apache.hive.ptest.execution;

import org.apache.hive.ptest.execution.conf.Host;

public interface HostExecutorBuilder {
  public HostExecutor build(Host host);
}


text:
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<a href="<?php echo site_url('clients/open_ticket?project_id='.$project->id); ?>" class="btn btn-info mbot15">
	<?php echo _l('clients_ticket_open_subject'); ?>
</a>
<?php get_template_part('tickets_table'); ?>


text:
<?php

$prefixIdentifier = 'api/';
$prefixPos = strpos($_SERVER['REQUEST_URI'], $prefixIdentifier);
$suffix = substr($_SERVER['REQUEST_URI'], $prefixPos + strlen($prefixIdentifier));

// /users
if(strpos($suffix, 'users') !== false) {

	require_once 'users.php';

}


text:
#include "include/core/SkTraceMemoryDump.h"
#include "src/gpu/GrSemaphore.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrTexturePriv.h"
#include "src/gpu/gl/GrGLGpu.h"
#include "src/gpu/gl/GrGLTexture.h"

#define GPUGL static_cast<GrGLGpu*>(this->getGpu())
#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)

GrTextureType GrGLTexture::TextureTypeFromTarget(GrGLenum target) {
    switch (target) {
        case GR_GL_TEXTURE_2D:
            return GrTextureType::k2D;
        case GR_GL_TEXTURE_RECTANGLE:
            return GrTextureType::kRectangle;
        case GR_GL_TEXTURE_EXTERNAL:
            return GrTextureType::kExternal;
    }
    SK_ABORT("Unexpected texture target");
}

static inline GrGLenum target_from_texture_type(GrTextureType type) {
    switch (type) {
        case GrTextureType::k2D:
            return GR_GL_TEXTURE_2D;
        case GrTextureType::kRectangle:
            return GR_GL_TEXTURE_RECTANGLE;
        case GrTextureType::kExternal:
            return GR_GL_TEXTURE_EXTERNAL;
        default:
            SK_ABORT("Unexpected texture target");
    }
    SK_ABORT("Unexpected texture type");
}

// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const Desc& desc,
                         GrMipMapsStatus mipMapsStatus)
        : GrSurface(gpu, desc.fSize, GrProtected::kNo)
        , INHERITED(gpu, desc.fSize, GrProtected::kNo,
                    TextureTypeFromTarget(desc.fTarget), mipMapsStatus)
        , fParameters(sk_make_sp<GrGLTextureParameters>()) {
    this->init(desc);
    this->registerWithCache(budgeted);
    if (GrGLFormatIsCompressed(desc.fFormat)) {
        this->setReadOnly();
    }
}

GrGLTexture::GrGLTexture(GrGLGpu* gpu, const Desc& desc, GrMipMapsStatus mipMapsStatus,
                         sk_sp<GrGLTextureParameters> parameters, GrWrapCacheable cacheable,
                         GrIOType ioType)
        : GrSurface(gpu, desc.fSize, GrProtected::kNo)
        , INHERITED(gpu, desc.fSize, GrProtected::kNo,
                    TextureTypeFromTarget(desc.fTarget), mipMapsStatus)
        , fParameters(std::move(parameters)) {
    SkASSERT(fParameters);
    this->init(desc);
    this->registerWithCacheWrapped(cacheable);
    if (ioType == kRead_GrIOType) {
        this->setReadOnly();
    }
}

GrGLTexture::GrGLTexture(GrGLGpu* gpu, const Desc& desc, sk_sp<GrGLTextureParameters> parameters,
                         GrMipMapsStatus mipMapsStatus)
        : GrSurface(gpu, desc.fSize, GrProtected::kNo)
        , INHERITED(gpu, desc.fSize, GrProtected::kNo,
                    TextureTypeFromTarget(desc.fTarget), mipMapsStatus) {
    SkASSERT(parameters || desc.fOwnership == GrBackendObjectOwnership::kOwned);
    fParameters = parameters ? std::move(parameters) : sk_make_sp<GrGLTextureParameters>();
    this->init(desc);
}

void GrGLTexture::init(const Desc& desc) {
    SkASSERT(0 != desc.fID);
    SkASSERT(GrGLFormat::kUnknown != desc.fFormat);
    fID = desc.fID;
    fFormat = desc.fFormat;
    fTextureIDOwnership = desc.fOwnership;
}

GrGLenum GrGLTexture::target() const {
    return target_from_texture_type(this->texturePriv().textureType());
}

void GrGLTexture::onRelease() {
    TRACE_EVENT0("skia.gpu", TRACE_FUNC);

    if (fID) {
        if (GrBackendObjectOwnership::kBorrowed != fTextureIDOwnership) {
            GL_CALL(DeleteTextures(1, &fID));
        }
        fID = 0;
    }
    INHERITED::onRelease();
}

void GrGLTexture::onAbandon() {
    fID = 0;
    INHERITED::onAbandon();
}

GrBackendTexture GrGLTexture::getBackendTexture() const {
    GrGLTextureInfo info;
    info.fTarget = target_from_texture_type(this->texturePriv().textureType());
    info.fID = fID;
    info.fFormat = GrGLFormatToEnum(fFormat);
    return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(), info,
                            fParameters);
}

GrBackendFormat GrGLTexture::backendFormat() const {
    return GrBackendFormat::MakeGL(GrGLFormatToEnum(fFormat),
                                   target_from_texture_type(this->texturePriv().textureType()));
}

sk_sp<GrGLTexture> GrGLTexture::MakeWrapped(GrGLGpu* gpu,
                                            GrMipMapsStatus mipMapsStatus,
                                            const Desc& desc,
                                            sk_sp<GrGLTextureParameters> parameters,
                                            GrWrapCacheable cacheable,
                                            GrIOType ioType) {
    return sk_sp<GrGLTexture>(
            new GrGLTexture(gpu, desc, mipMapsStatus, std::move(parameters), cacheable, ioType));
}

bool GrGLTexture::onStealBackendTexture(GrBackendTexture* backendTexture,
                                        SkImage::BackendTextureReleaseProc* releaseProc) {
    *backendTexture = this->getBackendTexture();
    // Set the release proc to a no-op function. GL doesn't require any special cleanup.
    *releaseProc = [](GrBackendTexture){};

    // It's important that we only abandon this texture's objects, not subclass objects such as
    // those held by GrGLTextureRenderTarget. Those objects are not being stolen and need to be
    // cleaned up by us.
    this->GrGLTexture::onAbandon();
    return true;
}

void GrGLTexture::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
    // Don't check this->fRefsWrappedObjects, as we might be the base of a GrGLTextureRenderTarget
    // which is multiply inherited from both ourselves and a texture. In these cases, one part
    // (texture, rt) may be wrapped, while the other is owned by Skia.
    bool refsWrappedTextureObjects =
            this->fTextureIDOwnership == GrBackendObjectOwnership::kBorrowed;
    if (refsWrappedTextureObjects && !traceMemoryDump->shouldDumpWrappedObjects()) {
        return;
    }

    // Dump as skia/gpu_resources/resource_#/texture, to avoid conflicts in the
    // GrGLTextureRenderTarget case, where multiple things may dump to the same resource. This
    // has no downside in the normal case.
    SkString resourceName = this->getResourceName();
    resourceName.append("/texture");

    // As we are only dumping our texture memory (not any additional memory tracked by classes
    // which may inherit from us), specifically call GrGLTexture::gpuMemorySize to avoid
    // hitting an override.
    this->dumpMemoryStatisticsPriv(traceMemoryDump, resourceName, "Texture",
                                   GrGLTexture::gpuMemorySize());

    SkString texture_id;
    texture_id.appendU32(this->textureID());
    traceMemoryDump->setMemoryBacking(resourceName.c_str(), "gl_texture", texture_id.c_str());
}


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "TestHarness.h"

#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXMLHttpRequest.h"

#define TEST_ENSURE_BASE(_test, _msg)       \
  PR_BEGIN_MACRO                            \
    if (_test) {                            \
      fail(_msg);                           \
      return NS_ERROR_FAILURE;              \
    }                                       \
  PR_END_MACRO

#define TEST_ENSURE_SUCCESS(_rv, _msg)      \
  TEST_ENSURE_BASE(NS_FAILED(_rv), _msg)

#define TEST_ENSURE_FAILED(_rv, _msg)       \
  TEST_ENSURE_BASE(NS_SUCCEEDED(_rv), _msg)

nsresult TestGetURL(const nsCString& aURL)
{
  nsresult rv;

  nsCOMPtr<nsIXMLHttpRequest> xhr =
    do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
  TEST_ENSURE_SUCCESS(rv, "Couldn't create nsIXMLHttpRequest instance!");

  NS_NAMED_LITERAL_CSTRING(getString, "GET");
  const nsAString& empty = EmptyString();

  nsCOMPtr<nsIScriptSecurityManager> secman =
    do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
  TEST_ENSURE_SUCCESS(rv, "Couldn't get script security manager!");

  nsCOMPtr<nsIPrincipal> systemPrincipal;
  rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
  TEST_ENSURE_SUCCESS(rv, "Couldn't get system principal!");

  rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr);
  TEST_ENSURE_SUCCESS(rv, "Couldn't initialize the XHR!");

  rv = xhr->Open(getString, aURL, false, empty, empty);
  TEST_ENSURE_SUCCESS(rv, "OpenRequest failed!");

  rv = xhr->Send(nullptr);
  TEST_ENSURE_SUCCESS(rv, "Send failed!");

  nsAutoString response;
  rv = xhr->GetResponseText(response);
  TEST_ENSURE_SUCCESS(rv, "GetResponse failed!");

  nsAutoCString responseUTF8 = NS_ConvertUTF16toUTF8(response);
  printf("#BEGIN\n");
  printf("%s", responseUTF8.get());
  printf("\n#EOF\n");

  return NS_OK;
}

int main(int argc, char** argv)
{
  if (argc <  2) {
    printf("Usage: TestGetURL <url>\n");
    exit(0);
  }

  ScopedXPCOM xpcom("XMLHttpRequest");
  if (xpcom.failed())
    return 1;

  nsAutoCString targetURL(argv[1]);

  int retval = 0;
  if (NS_FAILED(TestGetURL(targetURL))) {
    retval = 1;
  }

  return retval;
}


text:
Minesweep
=========

Simple JavaScript minesweeper game

Survive the Mines(in red)

It's a game of luck

There's no cheats in this game


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.spark;

import com.facebook.airlift.configuration.testing.ConfigAssertions;
import com.google.common.collect.ImmutableMap;
import io.airlift.units.DataSize;
import org.testng.annotations.Test;

import java.util.Map;

import static com.facebook.airlift.configuration.testing.ConfigAssertions.assertFullMapping;
import static com.facebook.airlift.configuration.testing.ConfigAssertions.assertRecordedDefaults;
import static io.airlift.units.DataSize.Unit.GIGABYTE;
import static io.airlift.units.DataSize.Unit.KILOBYTE;
import static io.airlift.units.DataSize.Unit.MEGABYTE;

public class TestPrestoSparkConfig
{
    @Test
    public void testDefaults()
    {
        assertRecordedDefaults(ConfigAssertions.recordDefaults(PrestoSparkConfig.class)
                .setSparkPartitionCountAutoTuneEnabled(true)
                .setInitialSparkPartitionCount(16)
                .setMinSparkInputPartitionCountForAutoTune(100)
                .setMaxSparkInputPartitionCountForAutoTune(1000)
                .setMaxSplitsDataSizePerSparkPartition(new DataSize(2, GIGABYTE))
                .setShuffleOutputTargetAverageRowSize(new DataSize(1, KILOBYTE))
                .setStorageBasedBroadcastJoinEnabled(false)
                .setStorageBasedBroadcastJoinStorage("local")
                .setStorageBasedBroadcastJoinWriteBufferSize(new DataSize(24, MEGABYTE))
                .setSparkBroadcastJoinMaxMemoryOverride(null)
                .setSmileSerializationEnabled(true)
                .setSplitAssignmentBatchSize(1_000_000)
                .setMemoryRevokingThreshold(0));
    }

    @Test
    public void testExplicitPropertyMappings()
    {
        Map<String, String> properties = new ImmutableMap.Builder<String, String>()
                .put("spark.partition-count-auto-tune-enabled", "false")
                .put("spark.initial-partition-count", "128")
                .put("spark.min-spark-input-partition-count-for-auto-tune", "200")
                .put("spark.max-spark-input-partition-count-for-auto-tune", "2000")
                .put("spark.max-splits-data-size-per-partition", "4GB")
                .put("spark.shuffle-output-target-average-row-size", "10kB")
                .put("spark.storage-based-broadcast-join-enabled", "true")
                .put("spark.storage-based-broadcast-join-storage", "tempfs")
                .put("spark.storage-based-broadcast-join-write-buffer-size", "4MB")
                .put("spark.broadcast-join-max-memory-override", "1GB")
                .put("spark.smile-serialization-enabled", "false")
                .put("spark.split-assignment-batch-size", "420")
                .put("spark.memory-revoking-threshold", "0.5")
                .build();
        PrestoSparkConfig expected = new PrestoSparkConfig()
                .setSparkPartitionCountAutoTuneEnabled(false)
                .setInitialSparkPartitionCount(128)
                .setMinSparkInputPartitionCountForAutoTune(200)
                .setMaxSparkInputPartitionCountForAutoTune(2000)
                .setMaxSplitsDataSizePerSparkPartition(new DataSize(4, GIGABYTE))
                .setShuffleOutputTargetAverageRowSize(new DataSize(10, KILOBYTE))
                .setStorageBasedBroadcastJoinEnabled(true)
                .setStorageBasedBroadcastJoinStorage("tempfs")
                .setStorageBasedBroadcastJoinWriteBufferSize(new DataSize(4, MEGABYTE))
                .setSparkBroadcastJoinMaxMemoryOverride(new DataSize(1, GIGABYTE))
                .setSmileSerializationEnabled(false)
                .setSplitAssignmentBatchSize(420)
                .setMemoryRevokingThreshold(0.5);
        assertFullMapping(properties, expected);
    }
}


text:
pmodload 'helper'

# Load manually installed or package manager installed pyenv into the shell
# session.
if [[ -s "${local_pyenv::=${PYENV_ROOT:-$HOME/.pyenv}/bin/pyenv}" ]] \
      || (( $+commands[pyenv] )); then

  # Ensure manually installed pyenv is added to path when present.
  [[ -s $local_pyenv ]] && path=($local_pyenv:h $path)

  # pyenv 2+ requires shims to be added to path before being initialized.
  autoload -Uz is-at-least
  if is-at-least 2 ${"$(pyenv --version 2>&1)"[(w)2]}; then
    eval "$(pyenv init --path zsh)"
  fi

  eval "$(pyenv init - zsh)"

# Prepend PEP 370 per user site packages directory, which defaults to
# ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The
# path can be overridden using PYTHONUSERBASE.
else
  if [[ -n "$PYTHONUSERBASE" ]]; then
    path=($PYTHONUSERBASE/bin(N) $path)
  elif is-darwin; then
    path=($HOME/Library/Python/*/bin(N) $path)
  else
    # This is subject to change.
    path=($HOME/.local/bin(N) $path)
  fi
fi

unset local_pyenv

# Return if requirements are not found.
if (( ! $+commands[(i)python[23]] && ! $+functions[pyenv] && ! $+commands[conda] )); then
  return 1
fi

function _python-workon-cwd {
  # Check if this is a Git repo.
  local GIT_REPO_ROOT="$(git rev-parse --show-toplevel 2> /dev/null)"
  # Get absolute path, resolving symlinks.
  local PROJECT_ROOT="$PWD:A"
  while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \
        && ! -d "$PROJECT_ROOT/.git"  && "$PROJECT_ROOT" != "$GIT_REPO_ROOT" ]]; do
    PROJECT_ROOT="$PROJECT_ROOT:h"
  done
  if [[ $PROJECT_ROOT == "/" ]]; then
    PROJECT_ROOT="."
  fi
  # Check for virtualenv name override.
  local ENV_NAME=""
  if [[ -f "$PROJECT_ROOT/.venv" ]]; then
    ENV_NAME="$(<$PROJECT_ROOT/.venv)"
  elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]]; then
    ENV_NAME="$PROJECT_ROOT/.venv"
  elif [[ $PROJECT_ROOT != "." ]]; then
    ENV_NAME="$PROJECT_ROOT:t"
  fi
  if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
    # We've just left the repo, deactivate the environment.
    # Note: this only happens if the virtualenv was activated automatically.
    deactivate && unset CD_VIRTUAL_ENV
  fi
  if [[ $ENV_NAME != "" ]]; then
    # Activate the environment only if it is not already active.
    if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
      if [[ -n "$WORKON_HOME" && -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
        workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
      elif [[ -e "$ENV_NAME/bin/activate" ]]; then
        source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
      fi
    fi
  fi
}

# Load auto workon cwd hook.
if zstyle -t ':prezto:module:python:virtualenv' auto-switch; then
  # Auto workon when changing directory.
  autoload -Uz add-zsh-hook
  add-zsh-hook chpwd _python-workon-cwd
fi

# Load virtualenvwrapper into the shell session, if pre-requisites are met
# and unless explicitly requested not to
if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) \
      && zstyle -T ':prezto:module:python:virtualenv' initialize ; then
  # Set the directory where virtual environments are stored.
  export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}"

  # Disable the virtualenv prompt. Note that we use the magic value used by the
  # pure prompt because there's some additional logic in that prompt which tries
  # to figure out if a user set this variable and disable the python portion of
  # that prompt based on it which is the exact opposite of what we want to do.
  export VIRTUAL_ENV_DISABLE_PROMPT=12

  # Create a sorted array of available virtualenv related 'pyenv' commands to
  # look for plugins of interest. Scanning shell '$path' isn't enough as they
  # can exist in 'pyenv' synthesized paths (e.g., '~/.pyenv/plugins') instead.
  local -a pyenv_plugins
  if (( $+commands[pyenv] )); then
    pyenv_plugins=(${(@oM)${(f)"$(pyenv commands --no-sh 2> /dev/null)"}:#virtualenv*})
  fi

  if (( $pyenv_plugins[(i)virtualenv-init] <= $#pyenv_plugins )); then
    # Enable 'virtualenv' with 'pyenv'.
    eval "$(pyenv virtualenv-init - zsh)"

    # Optionally activate 'virtualenvwrapper' plugin when available.
    if (( $pyenv_plugins[(i)virtualenvwrapper(_lazy|)] <= $#pyenv_plugins )); then
      pyenv "$pyenv_plugins[(R)virtualenvwrapper(_lazy|)]"
    fi
  else
    # Fallback to 'virtualenvwrapper' without 'pyenv' wrapper if 'python' is
    # available in '$path'.
    if (( ! $+VIRTUALENVWRAPPER_PYTHON )) && (( $+commands[(i)python[23]] )); then
      VIRTUALENVWRAPPER_PYTHON=$commands[(i)python[23]#]
    fi

    virtenv_sources=(
      ${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
      /usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)
    )
    if (( $#virtenv_sources )); then
      source "$virtenv_sources[1]"
    fi

    unset virtenv_sources
  fi

  unset pyenv_plugins
fi

# Load conda into the shell session, if requested.
zstyle -T ':prezto:module:python' conda-init
if (( $? && $+commands[conda] )); then
  if (( $(conda ..changeps1) )); then
    echo "To make sure Conda doesn't change your prompt (should do that in the prompt module) run:\n  conda config --set changeps1 false"
    # TODO:
    # We could just run this ourselves. In an exit hook
    # (add zsh-hook zshexit [(anonymous) function]) we could then set it back
    # to the way it was before we changed it. However, I'm not sure if this is
    # exception safe, so left it like this for now.
  fi
fi

#
# Aliases
#

alias py='python'
alias py2='python2'
alias py3='python3'


text:
//this utility adds (modified) inchis as comments to Chemkin files

/**
 *
 * @author gmagoon
 */

import java.util.*;
import java.io.*;
import jing.chem.*;
import jing.chemParser.*;
import jing.chemUtil.*;

//arg[0]=dictionary file
//arg[1]=original chemkin file
//arg[2]=new chemkin file
public class InchifyCHEMKINusingDictionary {
    public static void main(String[] args) {
        String workingDir = System.getenv("RMG");
        System.setProperty("RMG.workingDirectory", workingDir);

	//1. read the Dictionary file, converting to modified inchis along the way and adding them into inchiDict HashMap
        HashMap inchiDict = new HashMap();
	try {
            FileReader in = new FileReader(args[0]);
            BufferedReader data = new BufferedReader(in);
            String line = ChemParser.readMeaningfulLine(data, true);
            // While more species
            while (line != null) {
                System.out.println(line);//print the name of the molecule
                Graph g = ChemParser.readChemGraph(data);
                System.out.println(g);
                ChemGraph chemgraph = ChemGraph.make(g);
		//get the inchi
		String inchiString = chemgraph.getModifiedInChIAnew();
		//get the molecule name; ***this assumes that the names in the dictionary are the same as the names in the chemkin file; additional considerations would be needed if the CHEMKIN names are shortened names of the dictionary names***
		String name = line.split("\\s+")[0];//split on whitespace and take the first part of the name (in case the second part happens to be a pre-existing InChI
		inchiDict.put(name, inchiString);//add the chemkin name as key, and InChI as value
                line = ChemParser.readMeaningfulLine(data, true);
	}
            in.close();
	 }
	 catch (FileNotFoundException e) {
	   System.err.println("File was not found!\n");
	 }
	 catch(IOException e){
	   System.err.println("Something wrong with ChemParser.readChemGraph");
	 }
	 catch(ForbiddenStructureException e){
	   System.err.println("Something wrong with ChemGraph.make");
	 }

         //2. read the CHEMKIN file, while simultaneously writing a CHEMKIN output file with InChI comments, where available
         try {
           FileReader chemkinOld = new FileReader(args[1]);
           FileWriter chemkinNew = new FileWriter(args[2]);
           BufferedReader chemkinReader = new BufferedReader(chemkinOld);
           BufferedWriter chemkinWriter = new BufferedWriter(chemkinNew);
           String line = chemkinReader.readLine();
           // While more InChIs remain
           while (line != null) {
               String[] spl = line.split(" "); //split on  space
               int len= spl.length;
               //if the last "word" is a 1 and the first word can be found in the dictionary, write a comment line before copying the line; otherwise, just copy the line
               if (spl[len-1].equals("1")){
		   if (inchiDict.containsKey(spl[0])){
		       chemkinWriter.write("! [_ SMILES=\""+inchiDict.get(spl[0])+"\" _]\n");
		   }
		   else{
			System.out.println("Warning: Could not find InChI corresponding to CHEMKIN file species "+ spl[0]);
		   }
               }
               chemkinWriter.write(line+"\n");

               line = chemkinReader.readLine();
           }
           chemkinOld.close();
           chemkinWriter.flush();
           chemkinWriter.close();
           chemkinNew.close();
         }
         catch (FileNotFoundException e) {
           System.err.println("File was not found!\n");
         }
         catch (IOException eIO) {
           System.err.println("IO Exception!\n");
         }

    }
}


text:
<?php
require("config.inc.php");
try {
	$o = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);

	/* Google scopes are in the following format: urlencoded(scope) urlencoded(scope) */
	$scopes = urlencode("http://www.google.com/calendar/feeds/") . "%20" . urlencode("http://www.blogger.com/feeds/");

	$arrayResp = $o->getRequestToken("https://www.google.com/accounts/OAuthGetRequestToken?scope={$scopes}");
	file_put_contents(OAUTH_TMP_DIR . "/request_token_resp",serialize($arrayResp));
	$authorizeUrl = "https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token={$arrayResp["oauth_token"]}";
	if(PHP_SAPI=="cli") {
		echo "Navigate your http client to: {$authorizeUrl}\n";
	} else {
		header("Location: {$authorizeUrl}");
	}
} catch(OAuthException $E) {
	echo "Response: ". $E->lastResponse . "\n";
}


text:
require 'active_support/all'
require 'rest-client'

require 'apple_reporter/version'
require 'apple_reporter/reporter'
require 'apple_reporter/sale'
require 'apple_reporter/finance'
require 'apple_reporter/token'

module AppleReporter
  #raise "Cannot require AppleReporter, unsupported engine '#{RUBY_ENGINE}'" unless RUBY_ENGINE == "ruby"
end


text:
package org.apache.ignite.testsuites;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheConfigurationFileConsistencyCheckTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheObjectBinaryProcessorOnDiscoveryTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDestroyCacheTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDestroyCacheWithoutCheckpointsTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsDataRegionMetricsTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.DefaultPageSizeBackwardsCompatibilityTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCheckpointSimpleTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCheckpointSimulationWithRealCpDisabledTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsPageReplacementTest;
import org.apache.ignite.internal.processors.cache.persistence.metastorage.IgniteMetaStorageBasicTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreePageMemoryImplTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreeReuseListPageMemoryImplTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.FillFactorMetricTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.IndexStoragePageMemoryImplTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImplNoLoadTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImplTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryNoStoreLeakTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PagesWriteThrottleSmokeTest;
import org.apache.ignite.internal.processors.cache.persistence.wal.SegmentedRingByteBufferTest;
import org.apache.ignite.internal.processors.cache.persistence.wal.aware.SegmentAwareTest;
import org.apache.ignite.testframework.junits.DynamicSuite;
import org.junit.runner.RunWith;

/** */
@RunWith(DynamicSuite.class)
public class IgnitePdsMvccTestSuite {
    /**
     * @return Suite.
     */
    public static List<Class<?>> suite() {
        System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true");

        Set<Class> ignoredTests = new HashSet<>();

        // Skip classes that already contains Mvcc tests.
        ignoredTests.add(IgnitePdsCheckpointSimulationWithRealCpDisabledTest.class);

        // Atomic tests.
        ignoredTests.add(IgnitePdsDataRegionMetricsTest.class);

        // Non-relevant tests.
        ignoredTests.add(IgnitePdsCacheConfigurationFileConsistencyCheckTest.class);
        ignoredTests.add(DefaultPageSizeBackwardsCompatibilityTest.class);
        ignoredTests.add(IgniteMetaStorageBasicTest.class);

        ignoredTests.add(IgnitePdsPageReplacementTest.class);

        ignoredTests.add(PageMemoryImplNoLoadTest.class);
        ignoredTests.add(PageMemoryNoStoreLeakTest.class);
        ignoredTests.add(IndexStoragePageMemoryImplTest.class);
        ignoredTests.add(PageMemoryImplTest.class);
        ignoredTests.add(BPlusTreePageMemoryImplTest.class);
        ignoredTests.add(BPlusTreeReuseListPageMemoryImplTest.class);
        ignoredTests.add(SegmentedRingByteBufferTest.class);
        ignoredTests.add(PagesWriteThrottleSmokeTest.class);
        ignoredTests.add(FillFactorMetricTest.class);
        ignoredTests.add(IgnitePdsCacheObjectBinaryProcessorOnDiscoveryTest.class);
        ignoredTests.add(SegmentAwareTest.class);

        ignoredTests.add(IgnitePdsDestroyCacheTest.class);
        ignoredTests.add(IgnitePdsDestroyCacheWithoutCheckpointsTest.class);
        ignoredTests.add(IgnitePdsCheckpointSimpleTest.class);

        return new ArrayList<>(IgnitePdsTestSuite.suite(ignoredTests));
    }
}


text:
import { RunTag, Experiment, RunInfo, Metric } from '../../sdk/MlflowMessages';

export const emptyState = {
  apis: {},
  entities: {
    runInfosByUuid: {},
    experimentsById: {},
    experimentTagsByExperimentId: {},
    tagsByRunUuid: {},
    modelVersionsByRunUuid: {},
  },
};

export const addApiToState = (state, api) => {
  const oldApi = state.apis || {};
  return {
    ...state,
    apis: {
      ...oldApi,
      [api.id]: api,
    },
  };
};

export const addExperimentToState = (state, experiment) => {
  const oldExperiments = state.entities.experimentsById;
  return {
    ...state,
    entities: {
      ...state.entities,
      experimentsById: {
        ...oldExperiments,
        [experiment.experiment_id]: experiment,
      },
    },
  };
};

export const addExperimentTagsToState = (state, experiment_id, tags) => {
  const oldExperimentTags = state.entities.experimentTagsByExperimentId;
  const tagsArrToObject = (tagsArr) => {
    const tagObj = {};
    tagsArr.forEach((tag) => (tagObj[tag.key] = RunTag.fromJs(tag)));
    return tagObj;
  };
  return {
    ...state,
    entities: {
      ...state.entities,
      experimentTagsByExperimentId: {
        ...oldExperimentTags,
        [experiment_id]: tagsArrToObject(tags),
      },
    },
  };
};

export const createPendingApi = (id) => {
  return { id, active: true };
};

export const mockExperiment = (eid, name) => {
  return Experiment.fromJs({ experiment_id: eid, name: name });
};

export const mockRunInfo = (
  run_id,
  experiment_id = undefined,
  artifact_uri = undefined,
  lifecycle_stage = undefined,
) => {
  return RunInfo.fromJs({
    run_uuid: run_id,
    experiment_id: experiment_id,
    artifact_uri: artifact_uri,
    lifecycle_stage: lifecycle_stage,
  });
};

export const mockMetric = (params) => {
  return Metric.fromJs(params);
};


text:
describe('Mp4TtmlParser', function() {
  /** @const */
  var ttmlInitSegmentUri = '/base/test/test/assets/ttml-init.mp4';
  /** @const */
  var ttmlSegmentUri = '/base/test/test/assets/ttml-segment.mp4';
  /** @const */
  var ttmlSegmentMultipleMDATUri =
      '/base/test/test/assets/ttml-segment-multiplemdat.mp4';
  /** @const */
  var audioInitSegmentUri = '/base/test/test/assets/sintel-audio-init.mp4';

  /** @type {!Uint8Array} */
  var ttmlInitSegment;
  /** @type {!Uint8Array} */
  var ttmlSegment;
  /** @type {!Uint8Array} */
  var ttmlSegmentMultipleMDAT;
  /** @type {!Uint8Array} */
  var audioInitSegment;

  beforeAll(function(done) {
    Promise.all([
      shaka.test.Util.fetch(ttmlInitSegmentUri),
      shaka.test.Util.fetch(ttmlSegmentUri),
      shaka.test.Util.fetch(ttmlSegmentMultipleMDATUri),
      shaka.test.Util.fetch(audioInitSegmentUri)
    ]).then(function(responses) {
      ttmlInitSegment = new Uint8Array(responses[0]);
      ttmlSegment = new Uint8Array(responses[1]);
      ttmlSegmentMultipleMDAT = new Uint8Array(responses[2]);
      audioInitSegment = new Uint8Array(responses[3]);
    }).catch(fail).then(done);
  });

  it('parses init segment', function() {
    new shaka.text.Mp4TtmlParser().parseInit(ttmlInitSegment);
  });

  it('parses media segment', function() {
    var parser = new shaka.text.Mp4TtmlParser();
    parser.parseInit(ttmlInitSegment);
    var time = {periodStart: 0, segmentStart: 0, segmentEnd: 0 };
    var ret = parser.parseMedia(ttmlSegment, time);
    expect(ret.length).toBe(10);
  });

  it('handles media segments with multiple mdats', function() {
    var parser = new shaka.text.Mp4TtmlParser();
    parser.parseInit(ttmlInitSegment);
    var time = {periodStart: 0, segmentStart: 0, segmentEnd: 0 };
    var ret = parser.parseMedia(ttmlSegmentMultipleMDAT, time);
    expect(ret.length).toBe(20);
  });

  it('accounts for offset', function() {
    var time1 = {periodStart: 0, segmentStart: 0, segmentEnd: 0 };
    var time2 = {periodStart: 7, segmentStart: 0, segmentEnd: 0 };

    var parser = new shaka.text.Mp4TtmlParser();
    parser.parseInit(ttmlInitSegment);

    var ret1 = parser.parseMedia(ttmlSegment, time1);
    expect(ret1.length).toBeGreaterThan(0);

    var ret2 = parser.parseMedia(ttmlSegment, time2);
    expect(ret2.length).toBeGreaterThan(0);

    expect(ret2[0].startTime).toEqual(ret1[0].startTime + 7);
    expect(ret2[0].endTime).toEqual(ret1[0].endTime + 7);
  });

  it('rejects init segment with no ttml', function() {
    var error = new shaka.util.Error(
        shaka.util.Error.Severity.CRITICAL,
        shaka.util.Error.Category.TEXT,
        shaka.util.Error.Code.INVALID_MP4_TTML);

    try {
      new shaka.text.Mp4TtmlParser().parseInit(audioInitSegment);
      fail('Mp4 file with no ttml supported');
    } catch (e) {
      shaka.test.Util.expectToEqualError(e, error);
    }
  });
});


text:
require 'mongoid/fixture_set'

module Mongoid
  module Document
    attr_accessor :__fixture_name
  end
end


text:
{% load i18n %}

{% url sentry-manage-project project.pk as project_link %}

{% blocktrans with 'https://github.com/lincolnloop/raven-js' as link and 'http://jquery.com/' as jquery and 'http://zeptojs.com/' as zepto %}Start by installing raven-js and either jQuery or Zepto.{% endblocktrans %}

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/raven.min.js"></script>

{% blocktrans %}Add the any URLs which will be logging errors in your project's settings under Client Security:{% endblocktrans %}

{% trans "Configure the client:" %}

<script type="text/javascript">
Raven.config('{% if dsn_public %}{{ dsn_public }}{% else %}SENTRY_DSN{% endif %}');
</script>

{% trans "Now call out to the raven client to capture events:" %}

// {% trans "record a simple message" %}
Raven.captureMessage('hello world!')

// {% trans "capture an exception" %}
try {
    errorThrowingCode();
} catch(err) {
    Raven.captureException(err);
}

{% trans "You can also optionally install a default error handler to catch all exceptions:" %}

window.onerror = Raven.process;

{% trans "Note: This will only work on browsers that properly support window.onerror." %}

{% blocktrans with 'https://github.com/lincolnloop/raven-js' as link %}For more information on other uses of Raven with Javascript, please see the official documentation for raven-js.{% endblocktrans %}


text:
key-api
=======

openstack Key Management API


text:
package org.fastcatsearch.ir.search;

public class DocIdList {
	private String[] segmentIdList;
	private int[] docNoList;
	private int size;

	private DocIdList[] bundleDocIdListArray;

	public DocIdList(){
		this(32);
	}
	public DocIdList(int initSize){
		segmentIdList = new String[initSize];
		docNoList = new int[initSize];
	}

	public void add(String segmentId, int docNo){
		add(segmentId, docNo, null);
	}

	public void add(String segmentId, int docNo, DocIdList bundleDocIdList){
		if(bundleDocIdList != null) {
			if(bundleDocIdListArray == null){
				bundleDocIdListArray = new DocIdList[segmentIdList.length];
			}
		}

		if(docNoList.length == size){
			int newSize = size * 2;
            String[] newSegmentIdList = new String[newSize];
			int[] newDocNoList = new int[newSize];
			System.arraycopy(segmentIdList, 0, newSegmentIdList, 0, size);
			System.arraycopy(docNoList, 0, newDocNoList, 0, size);
			segmentIdList = newSegmentIdList;
			docNoList = newDocNoList;

			if(bundleDocIdListArray != null) {
				DocIdList[] newBundleDocIdListArray = new DocIdList[newSize];
				System.arraycopy(bundleDocIdListArray, 0, newBundleDocIdListArray, 0, size);
				bundleDocIdListArray = newBundleDocIdListArray;
			}
		}

		segmentIdList[size] = segmentId;
		docNoList[size] = docNo;
		if(bundleDocIdList != null) {
			bundleDocIdListArray[size] = bundleDocIdList;
		}

		size++;
	}

	public String segmentId(int i){
		return segmentIdList[i];
	}

	public int docNo(int i){
		return docNoList[i];
	}

	public int size(){
		return size;
	}

	public DocIdList bundleDocIdList(int i) {
		if(bundleDocIdListArray == null) {
			return null;
		}
		return bundleDocIdListArray[i];
	}

}


text:
probe_module_t module_ntp;

static int num_ports;
static int udp_send_msg_len = 0;
static char *udp_send_msg = NULL;

static const char *udp_send_msg_default = "GET / HTTP/1.1\r\nHost: www\r\n\r\n";

int ntp_make_packet(void *buf, ipaddr_n_t src_ip, ipaddr_n_t dst_ip,
                    uint32_t *validation, int probe_num)
{

	struct ether_header *eth_header = (struct ether_header *) buf;
	struct ip *ip_header = (struct ip*) (&eth_header[1]);
	struct udphdr *udp_header= (struct udphdr *) &ip_header[1];
    struct ntphdr *ntp = (struct ntphdr *) &udp_header[1];

	ip_header->ip_src.s_addr = src_ip;
	ip_header->ip_dst.s_addr = dst_ip;
	udp_header->uh_sport = htons(get_src_port(num_ports, probe_num,
                                              validation));
	ip_header->ip_sum = 0;
	ip_header->ip_sum = zmap_ip_checksum((unsigned short *) ip_header);

    //Sets LI_VN_MODE to 11100011
    //Sends a packet with NTP version 4 and as a client (to a server)
    ntp->LI_VN_MODE = 227;

	return EXIT_SUCCESS;
}

void ntp_process_packet(const u_char *packet, __attribute__((unused)) uint32_t len, fieldset_t *fs){
    struct ip *ip_hdr =  (struct ip *) &packet[sizeof(struct ether_header)];
    int *ptr;
    uint64_t temp64;
    uint8_t temp8;
    uint32_t temp32;

    if(ip_hdr->ip_p ==  IPPROTO_UDP){
        struct udphdr *udp = (struct udphdr *) ((char *) ip_hdr + ip_hdr->ip_hl * 4);
        struct module_ntp *ntp = (struct module_ntp *) &udp[1];

        fs_add_string(fs, "classification", (char*) "ntp", 0);
        fs_add_uint64(fs, "success", 1);
        fs_add_uint64(fs, "sport", ntohs(udp->uh_sport));
        fs_add_uint64(fs, "dport", ntohs(udp->uh_dport));
        fs_add_null(fs, "icmp_responder");
        fs_add_null(fs, "icmp_type");
        fs_add_null(fs, "icmp_code");
        fs_add_null(fs, "icmp_unreach_str");

        ptr = (int *)ntp;

        temp8 = *((uint8_t *)ptr);
        fs_add_uint64(fs, "LI_VN_MODE", temp8);
        temp8 = *((uint8_t *)ptr +1);
        fs_add_uint64(fs, "stratum", temp8);
        temp8 = *((uint8_t *)ptr +2);
        fs_add_uint64(fs, "poll", temp8);
        temp8 = *((uint8_t *)ptr + 3);
        fs_add_uint64(fs, "precision", temp8);

        temp32 = *((uint32_t *)ptr + 4);
        fs_add_uint64(fs, "root_delay", temp32);
        temp32 = *((uint32_t *)ptr + 8);
        fs_add_uint64(fs, "root_dispersion", temp32);
        temp32 = *((uint32_t *)ptr + 12);
        fs_add_uint64(fs, "reference_clock_identifier", temp32);

        temp64 = *((uint64_t *)ptr + 16);
        fs_add_uint64(fs, "reference_timestamp", temp64);
        temp64 = *((uint64_t *)ptr + 24);
        fs_add_uint64(fs, "originate_timestap", temp64);
        temp64 = *((uint64_t *)ptr + 32);
        fs_add_uint64(fs, "receive_timestamp", temp64);
        temp64 = *((uint64_t *)ptr + 40);
        fs_add_uint64(fs, "transmit_timestamp", temp64);

    }else if(ip_hdr->ip_p ==  IPPROTO_ICMP){
        struct icmp *icmp = (struct icmp *) ((char *) ip_hdr + ip_hdr -> ip_hl + 4);
        struct ip *ip_inner = (struct ip *) &icmp[1];

		fs_modify_string(fs, "saddr", make_ip_str(ip_inner->ip_dst.s_addr), 1);
		fs_add_string(fs, "classification", (char*) "icmp-unreach", 0);
		fs_add_uint64(fs, "success", 0);
		fs_add_null(fs, "sport");
		fs_add_null(fs, "dport");
		fs_add_string(fs, "icmp_responder", make_ip_str(ip_hdr->ip_src.s_addr), 1);
		fs_add_uint64(fs, "icmp_type", icmp->icmp_type);
		fs_add_uint64(fs, "icmp_code", icmp->icmp_code);

    }else{
        fs_add_string(fs, "classification", (char *) "other", 0);
        fs_add_uint64(fs, "success", 0);
        fs_add_null(fs, "sport");
        fs_add_null(fs, "dport");
        fs_add_null(fs, "icmp_responder");
        fs_add_null(fs, "icmp_type");
        fs_add_null(fs, "icmp_code");
        fs_add_null(fs, "icmp_unreach_str");
    }
}

int ntp_init_perthread(void *buf, macaddr_t *src,
        macaddr_t *gw, __attribute__((unused)) port_h_t dst_port, void **arg){

    udp_send_msg = strdup(udp_send_msg_default);
    udp_send_msg_len = strlen(udp_send_msg);

    memset(buf, 0, MAX_PACKET_SIZE);
	struct ether_header *eth_header = (struct ether_header *) buf;
	make_eth_header(eth_header, src, gw);
	struct ip *ip_header = (struct ip*)(&eth_header[1]);
	uint16_t len = htons(sizeof(struct ip) + sizeof(struct udphdr) + sizeof(struct ntphdr));
	make_ip_header(ip_header, IPPROTO_UDP, len);

	struct udphdr *udp_header = (struct udphdr*)(&ip_header[1]);
	struct ntphdr *ntp_header = (struct ntphdr*)(&udp_header[1]);
    ntp_header -> LI_VN_MODE = 227;
    len = sizeof(struct udphdr) + sizeof(struct ntphdr);

	make_udp_header(udp_header, zconf.target_port, len);

	char* payload = (char*)(&ntp_header[1]);

	module_ntp.packet_length = sizeof(struct ether_header) + sizeof(struct ip)
				+ sizeof(struct udphdr) + sizeof(struct ntphdr);

	assert(module_ntp.packet_length <= MAX_PACKET_SIZE);

	memcpy(payload, ntp_header, module_ntp.packet_length);

    uint32_t seed = aesrand_getword(zconf.aes);
    aesrand_t *aes = aesrand_init_from_seed(seed);
    *arg = aes;

	return EXIT_SUCCESS;
}

void ntp_print_packet(FILE *fp, void *packet){

    struct ether_header *ethh = (struct ether_header *)packet;
    struct ip *iph = (struct ip *) &ethh[1];
    struct udphdr *udph = (struct udphdr *) (iph + 4*iph->ip_hl);
    struct ntphdr *ntph = (struct ntphdr *) &udph[1];
    fprintf(fp, "ntp { LI_VN_MODE: %u | stratum: %u | poll: %u }\n",
            ntph->LI_VN_MODE, ntph->stratum, ntph->poll);
    fprintf(fp, "udp { source: %u | dest: %u | checksum: %u }\n",
            ntohs(udph->uh_sport),
            ntohs(udph->uh_dport),
            ntohl(udph->uh_sum));
    fprintf_ip_header(fp, iph);
    fprintf_eth_header(fp, ethh);

    fprintf(fp, "-------------------------------------------------\n");
}

static fielddef_t fields[] = {
    {.name = "classification", .type = "string", .desc = "packet classification"},
    {.name = "success", .type = "int", .desc = "is  response considered success"},
    {.name = "sport", .type = "int", .desc = "UDP source port"},
    {.name = "dport", .type = "int", .desc = "UDP destination port"},
    {.name = "icmp_responder", .type = "string", .desc = "Source IP of ICMP_UNREACH messages"},
    {.name = "icmp_type", .type = "int", .desc = "icmp message type"},
    {.name = "icmp_code", .type = "int", .desc = "icmp message sub type code"},
    {.name = "icmp_unreach_str", .type = "string", .desc = "for icmp_unreach responses, the string version of icmp_code "},
    {.name = "LI_VN_MODE", .type = "int", .desc = "leap indication, version number, mode"},
    {.name = "stratum", .type = "int", .desc = "stratum"},
    {.name = "poll", .type ="int", .desc = "poll"},
    {.name = "precision", .type = "int", .desc = "precision"},
    {.name = "root_delay", .type = "int", .desc = "root delay"},
    {.name = "root_dispersion", .type = "int", .desc = "root dispersion"},
    {.name = "reference_clock_identifier", .type = "int", .desc = "code identifying clock reference"},
    {.name = "reference_timestamp", .type = "int", .desc = "local time at which local clock was last set or corrected"},
    {.name = "originate_timestamp", .type = "int", .desc = "local time at which request deparated client for service"},
    {.name = "receive_timestamp", .type = "int", .desc = "local time at which request arrvied at service host"},
    {.name = "transmit_timestamp", .type = "int", .desc = "local time which reply departed service host for client"},

};

probe_module_t module_ntp = {
    .name = "ntp",
    .packet_length = 1,
    .pcap_filter = "udp || icmp",
    .pcap_snaplen = 1500,
    .port_args = 1,
    .thread_initialize = &ntp_init_perthread,
    .global_initialize = &udp_global_initialize,
    .make_packet = &udp_make_packet,
    .print_packet = &ntp_print_packet,
    .validate_packet = &udp_validate_packet,
    .process_packet = &ntp_process_packet,
    .close = &udp_global_cleanup,
    .fields = fields,
    .numfields = sizeof(fields)/sizeof(fields[0])
};


text:
<?php

namespace KJSencha\Frontend\Grid;

use KJSencha\Frontend\Component;

class Panel extends Component
{
    protected $attributes = array(
        'extend'	=> 'Ext.grid.Panel',
        'xtype'		=> 'gridpanel',
        'colModel'	=> array(
            'items' => array(),
        )
    );

    /**
     * Add a grid column
     *
     * @param  string $name
     * @param  array  $attrs
     * @return Panel
     */
    public function addColumn($name, $attrs = NULL)
    {
        if (is_array($name)) {
            $column = $name;
        } else {
            $column = array();
            $column['text'] = $name;

            if (is_array($attrs)) {
                $column+= $attrs;
            } elseif (is_string($attrs)) {
                $column['dataIndex'] = $attrs;
            }
        }

        $this->attributes['colModel']['items'][] = $column;

        return $this;
    }
}


text:
/**
 * @file
 * @author  Jan Olszak (j.olszak@samsung.com)
 * @brief   Main file for the Vasum Daemon
 */

#include "config.hpp"

#include "exception.hpp"
#include "runner.hpp"

#include "logger/logger.hpp"
#include "logger/backend-stderr.hpp"
#include "logger/backend-journal.hpp"
#include "logger/backend-syslog.hpp"
#include "utils/typeinfo.hpp"
#include "utils/daemon.hpp"

#include <boost/program_options.hpp>
#include <iostream>

using namespace logger;
using namespace vasum;

namespace po = boost::program_options;

namespace {

const std::string PROGRAM_NAME_AND_VERSION =
    "Vasum Zones Daemon " PROGRAM_VERSION;

} // namespace

int main(int argc, char* argv[])
{
    try {
#ifndef NDEBUG
        const char *defaultLoggingBackend = "stderr";
#else
        const char *defaultLoggingBackend = "syslog";
#endif

        // 100 - wider terminal, nicer option descriptions
        po::options_description desc("Allowed options", 100);

        desc.add_options()
        ("help,h", "print this help")
        ("daemon,d", "Run server as daemon")
        ("log-level,l", po::value<std::string>()->default_value("DEBUG"), "set log level")
        ("log-backend,b", po::value<std::string>()->default_value(defaultLoggingBackend),
                          "set log backend [stderr,syslog,file"
#ifdef HAVE_SYSTEMD
                          ",journal"
#endif
                          "]")
        ("log-file,f", po::value<std::string>()->default_value("zoned.log"),
                          "set filename for file logging, optional")
        ("version,v", "show application version")
        ;

        po::variables_map vm;
        po::basic_parsed_options< char > parsed =
            po::command_line_parser(argc, argv).options(desc).allow_unregistered().run();

        std::vector<std::string> unrecognized_options =
            po::collect_unrecognized(parsed.options, po::include_positional);

        if (!unrecognized_options.empty()) {
            std::cerr << "Unrecognized options: ";

            for (auto& uo : unrecognized_options) {
                std::cerr << ' ' << uo;
            }

            std::cerr << std::endl << std::endl;
            std::cerr << desc << std::endl;

            return 1;
        }

        po::store(parsed, vm);
        po::notify(vm);

        if (vm.count("help")) {
            std::cout << desc << std::endl;
            return 0;
        } else if (vm.count("version")) {
            std::cout << PROGRAM_NAME_AND_VERSION << std::endl;
            return 0;
        }

        bool runAsDaemon = vm.count("daemon") > 0;

        if (runAsDaemon && !utils::daemonize()) {
            std::cerr << "Failed to daemonize" << std::endl;
            return 1;
        }

        Logger::setLogLevel(vm["log-level"].as<std::string>());
        const std::string logBackend = vm["log-backend"].as<std::string>();
        if(logBackend.compare("stderr") == 0) {
            Logger::setLogBackend(new StderrBackend());
        }
        else if(logBackend.compare("file") == 0) {
            const std::string logFilename = vm["log-file"].as<std::string>();
            if(logFilename.empty()) {
                std::cerr << "Error: invalid log file provided for file logging backend" << std::endl;
                return 1;
            }
            Logger::setLogBackend(new FileBackend(logFilename));
        }
#ifdef HAVE_SYSTEMD
        else if(logBackend.compare("journal") == 0) {
            Logger::setLogBackend(new SystemdJournalBackend());
        }
#endif
        else if(logBackend.compare("syslog") == 0) {
            Logger::setLogBackend(new SyslogBackend());
        }
        else {
            std::cerr << "Error: unrecognized logging backend option: " << logBackend << std::endl;
            return 1;
        }

    } catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
        return 1;
    }

    try {
        zone_daemon::Runner daemon;
        daemon.run();

    } catch (std::exception& e) {
        LOGE("Unexpected: " << utils::getTypeName(e) << ": " << e.what());
        return 1;
    }

    return 0;
}


text:
//===- mlir-cpu-runner.cpp - MLIR CPU Execution Driver---------------------===//
//
// Copyright 2019 The MLIR Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================
//
// This is a command line utility that executes an MLIR file on the GPU by
// translating MLIR to NVVM/LVVM IR before JIT-compiling and executing the
// latter.
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/STLExtras.h"

#include "mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h"
#include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/JitRunner.h"
#include "mlir/Transforms/DialectConversion.h"

#include "cuda.h"

using namespace mlir;

inline void emit_cuda_error(const llvm::Twine &message, const char *buffer,
                            CUresult error, FuncOp &function) {
  function.emitError(message.concat(" failed with error code ")
                         .concat(llvm::Twine{error})
                         .concat("[")
                         .concat(buffer)
                         .concat("]"));
}

#define RETURN_ON_CUDA_ERROR(expr, msg)                                        \
  {                                                                            \
    auto _cuda_error = (expr);                                                 \
    if (_cuda_error != CUDA_SUCCESS) {                                         \
      emit_cuda_error(msg, jitErrorBuffer, _cuda_error, function);             \
      return {};                                                               \
    }                                                                          \
  }

OwnedCubin compilePtxToCubin(const std::string ptx, FuncOp &function) {
  char jitErrorBuffer[4096] = {0};

  RETURN_ON_CUDA_ERROR(cuInit(0), "cuInit");

  // Linking requires a device context.
  CUdevice device;
  RETURN_ON_CUDA_ERROR(cuDeviceGet(&device, 0), "cuDeviceGet");
  CUcontext context;
  RETURN_ON_CUDA_ERROR(cuCtxCreate(&context, 0, device), "cuCtxCreate");
  CUlinkState linkState;

  CUjit_option jitOptions[] = {CU_JIT_ERROR_LOG_BUFFER,
                               CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES};
  void *jitOptionsVals[] = {jitErrorBuffer,
                            reinterpret_cast<void *>(sizeof(jitErrorBuffer))};

  RETURN_ON_CUDA_ERROR(cuLinkCreate(2,              /* number of jit options */
                                    jitOptions,     /* jit options */
                                    jitOptionsVals, /* jit option values */
                                    &linkState),
                       "cuLinkCreate");

  RETURN_ON_CUDA_ERROR(
      cuLinkAddData(linkState, CUjitInputType::CU_JIT_INPUT_PTX,
                    const_cast<void *>(static_cast<const void *>(ptx.c_str())),
                    ptx.length(), function.getName().data(), /* kernel name */
                    0,       /* number of jit options */
                    nullptr, /* jit options */
                    nullptr  /* jit option values */
                    ),
      "cuLinkAddData");

  void *cubinData;
  size_t cubinSize;
  RETURN_ON_CUDA_ERROR(cuLinkComplete(linkState, &cubinData, &cubinSize),
                       "cuLinkComplete");

  char *cubinAsChar = static_cast<char *>(cubinData);
  OwnedCubin result =
      std::make_unique<std::vector<char>>(cubinAsChar, cubinAsChar + cubinSize);

  // This will also destroy the cubin data.
  RETURN_ON_CUDA_ERROR(cuLinkDestroy(linkState), "cuLinkDestroy");

  return result;
}

namespace {
// A pass that lowers all Standard and Gpu operations to LLVM dialect. It does
// not lower the GPULaunch operation to actual code but dows translate the
// signature of its kernel argument.
class LowerStandardAndGpuToLLVMAndNVVM
    : public ModulePass<LowerStandardAndGpuToLLVMAndNVVM> {
public:
  void runOnModule() override {
    ModuleOp m = getModule();

    OwningRewritePatternList patterns;
    LLVMTypeConverter converter(m.getContext());
    populateStdToLLVMConversionPatterns(converter, patterns);
    populateGpuToNVVMConversionPatterns(converter, patterns);

    ConversionTarget target(getContext());
    target.addLegalDialect<LLVM::LLVMDialect>();
    target.addLegalDialect<NVVM::NVVMDialect>();
    target.addLegalOp<ModuleOp>();
    target.addLegalOp<ModuleTerminatorOp>();
    target.addDynamicallyLegalOp<FuncOp>(
        [&](FuncOp op) { return converter.isSignatureLegal(op.getType()); });
    if (failed(applyFullConversion(m, target, patterns, &converter)))
      signalPassFailure();
  }
};
} // end anonymous namespace

static LogicalResult runMLIRPasses(ModuleOp m) {
  PassManager pm(m.getContext());

  pm.addPass(createGpuKernelOutliningPass());
  pm.addPass(static_cast<std::unique_ptr<OpPassBase<ModuleOp>>>(
      std::make_unique<LowerStandardAndGpuToLLVMAndNVVM>()));
  pm.addPass(createConvertGPUKernelToCubinPass(&compilePtxToCubin));
  pm.addPass(createGenerateCubinAccessorPass());
  pm.addPass(createConvertGpuLaunchFuncToCudaCallsPass());

  if (failed(pm.run(m)))
    return failure();

  return success();
}

int main(int argc, char **argv) {
  return mlir::JitRunnerMain(argc, argv, &runMLIRPasses);
}


text:
<?php

/**
 *	@author Félix Girault <felix.girault@gmail.com>
 *	@license FreeBSD License (http://opensource.org/licenses/BSD-2-Clause)
 */

namespace Essence\Cache\Engine;

use Essence\Cache\Engine;
use Cache;

/**
 *	A bridge to use a CakePHP cache.
 *
 *	@package fg.Essence.Cache.Engine
 */

class Cake implements Engine {

	/**
	 *	The cache config.
	 *
	 *	@var string
	 */

	protected $_config = '';

	/**
	 *	Sets the config to use.
	 *
	 *	@param string $config Config.
	 */

	public function __construct( $config = 'default' ) {

		$this->_config = $config;
	}

	/**
	 *	{@inheritDoc}
	 */

	public function has( $key ) {

		return ( Cache::read( $key, $this->_config ) !== false );
	}

	/**
	 *	{@inheritDoc}
	 */

	public function get( $key, $default = null ) {

		$data = Cache::read( $key, $this->_config );

		return ( $data === false )
			? $default
			: $data;
	}

	/**
	 *	{@inheritDoc}
	 */

	public function set( $key, $data ) {

		Cache::write( $key, $data, $this->_config );
	}
}


text:
FlugEdit

Hier könnte doch auch der Eintrag mit der ID {{id}} stehen!

        Daten wurden nicht gespeichert! Trotzdem Maske verlassen?

        Ja
        Nein


text:
/*
	WeaponPsiFocusedDisruptor.h
	(c)2004 Palestar Inc, Richard Lyle
*/

#ifndef WEAPONPSIFOCUSEDDISRUPTOR_H
#define WEAPONPSIFOCUSEDDISRUPTOR_H

#include "DarkSpace/Constants.h"
#include "DarkSpace/GadgetBeamWeapon.h"

//----------------------------------------------------------------------------

class WeaponPsiFocusedDisruptor : public GadgetBeamWeapon
{
public:
	DECLARE_WIDGET_CLASS();

	// NounGadget interface
	Type type() const
	{
		return WEAPON_CLOSE;
	}
	int maxDamage() const
	{
		return (3000 + (level() * 150));
	}
	int addValue() const
	{
		return 3000;
	}
	int buildTechnology() const
	{
		return 15;
	}
	int	buildCost() const
	{
		return 50;
	}
	dword buildFlags() const
	{
		return NounPlanet::FLAG_METALS;
	}
	int buildTime() const
	{
		return 300;
	}

	// GadgetWeapon interface
	int energyCost() const
	{
		return 800;
	}
	int	 energyCharge() const
	{
		return 2;
	}
	int	damage() const
	{
		return 20;
	}
	int	damageRandom() const
	{
		return 1;
	}
	bool reverseFalloff() const
	{
		return false;
	}
	float damageFalloff() const
	{
		return 1.00f;
	}
	int repairRate() const
	{
		return 2;
	}
	dword damageType() const
	{
		return DAMAGE_ENERGY;
	}
	int	duration() const
	{
		return 60;
	}
	float length() const
	{
		return 400.0f;
	}
	bool allowPointDefense() const
	{
		return true;
	}
};

//----------------------------------------------------------------------------

#endif

//----------------------------------------------------------------------------
// EOF


text:
import os
import re

try:
    from urllib import unquote
except ImportError:  # py3k
    from urllib.parse import unquote

try:
    from ConfigParser import SafeConfigParser as ConfigParser
except ImportError:  # py3k
    import sys
    minor = sys.version_info[1]
    if minor >= 2:
        # SafeConfigParser is deprecated as of 3.2
        from configparser import ConfigParser
    else:
        from configparser import SafeConfigParser as ConfigParser

__all__ = ['fix_path']

class ConfigurationError(Exception):
    pass

FILE_PREFIXES = ['file:///', 'file://', 'smb://']
DRIVE_RE = re.compile(r'^[A-Z](:|\|)(\\|/)')

def _get_config(fname=None):
    if not fname:
        fnames = []
        # If we're running from a .pyc file, there won't be a symlink, so
        # finding our way back to the config.ini won't work unless we do it
        # from the symlinked .py file.
        this_file = __file__
        if this_file.endswith('.pyc'):
            this_file = this_file[:-1]

        fname = os.path.join(
            # Allow symlinking pathfix.py to, eg, /usr/local/bin
            os.path.dirname(os.path.realpath(this_file)),
            'config.ini',
        )
        fnames.append(fname)

        # Check for $HOME/.config/pathfix/config.ini
        if not os.path.exists(fname):
            fname = os.path.join(
                os.getenv('HOME'), '.config', 'pathfix', 'config.ini'
            )
            fnames.append(fname)

        if not os.path.exists(fname):
            raise ConfigurationError(
                "Unable to find configuration file. Tried:\n * %s" %
                '\n * '.join(fnames)
            )

    config = ConfigParser()
    config.read(fname)

    return config

def fix_path(path, cfg=None):
    """Fix the given path.

    If ``cfg`` is provided, we read the configuration from that path instead
    of the default.

    """
    config = _get_config(cfg)

    drive_map = dict()
    for option in config.options('drive_maps'):
        drive_map[option.upper()] = tuple(
            config.get('drive_maps', option).split(':')
        )

    for prefix in FILE_PREFIXES:
        if path.startswith(prefix):
            path = path[len(prefix):]
            break

    prefix = config.get('main', 'network_root')

    if DRIVE_RE.match(path):
        drive = path[0].upper()
        if drive not in drive_map:
            raise ConfigurationError("Unknown drive mapping: %s" % drive)
        path = DRIVE_RE.split(path)[-1]
        prefix += '/%s/%s/' % drive_map.get(drive)

    path = unquote(path.replace('\\', '/'))

    if not (path.startswith('/') or prefix.endswith('/')):
        path = '/%s' % path

    return os.path.normpath('%s%s' % (prefix, path))

def main():
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('path', help='the path to fix')
    parser.add_argument('--config', dest='config', help='config file path')
    args = parser.parse_args()

    print(fix_path(args.path, args.config))

if __name__ == '__main__':
    main()


text:
@ParametersAreNonnullByDefault
package retrofit2.converter.scalars;

import javax.annotation.ParametersAreNonnullByDefault;


text:
//
//  CADisplayLineImageView.m
//  LoadGIF
//
//  Created by ZhengWei on 16/4/26.
//  Copyright © 2016年 Bourbon. All rights reserved.
//

#import "CADisplayLineImageView.h"

@interface CADisplayLineImageView ()
{
    int tmp;
}
@property (nonatomic) NSUInteger currentFrameIndex;
@property (nonatomic,strong) CADisplayLineImage *animatedImage;
@property (nonatomic,strong) CADisplayLink *displayLink;
@property (nonatomic) NSTimeInterval accumulator;
@property (nonatomic,strong) UIImage *currentFrame;
@property (nonatomic) NSUInteger loopCountdown;

@end
@implementation CADisplayLineImageView

const NSTimeInterval kMaxTimeStep = 1;
@synthesize runLoopMode = _runLoopMode;
@synthesize displayLink = _displayLink;
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)init
{
    if (self = [super init]) {
        self.currentFrameIndex = 0;
    }
    return self;
}
-(CADisplayLink *)displayLink
{
    //如果有superview就是已经创建了,创建时新建一个CADisplayLink,并制定方法,最后加到一个Runloop中,完成创建
    if (self.superview) {
        if (!_displayLink && self.animatedImage) {

            _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(changeKeyframe:)];
            [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.runLoopMode];
        }
    }else{
        [_displayLink invalidate];
        _displayLink = nil;
    }
    return _displayLink;
}
-(NSString *)runLoopMode
{
    return _runLoopMode ?: NSRunLoopCommonModes;
}
-(void)setRunLoopMode:(NSString *)runLoopMode{
    //这个地方需要重写,因为CADisplayLink是依赖在runloop中的,所以如果设置了imageview的runloop的话
    //就要停止动画,并重新设置CADisplayLink对应的runloop,最后在根据情况是否开始动画
    if (runLoopMode != _runLoopMode) {
        [self stopAnimating];
        NSRunLoop *runloop = [NSRunLoop mainRunLoop];
        [self.displayLink removeFromRunLoop:runloop forMode:_runLoopMode];
        [self.displayLink addToRunLoop:runloop forMode:runLoopMode];

        _runLoopMode = runLoopMode;
        [self startAnimating];
    }
}
-(void)setImage:(UIImage *)image
{
    if (image == self.image) {
        return;
    }

    [self stopAnimating];

    self.currentFrameIndex = 0;
    self.loopCountdown = 0;
    self.accumulator = 0;
    if ([image isKindOfClass:[CADisplayLineImage class]] && image.images) {

        //设置静止态的图片
        if (image.images[0]) {
            [super setImage:image.images[0]];
        }else{
            [super setImage:nil];
        }
        self.currentFrame = nil;
        self.animatedImage = (CADisplayLineImage *)image;
        self.loopCountdown = self.animatedImage.loopCount ? : NSUIntegerMax;
        [self startAnimating];

    }else{
        self.animatedImage = nil;
        [super setImage:image];
    }
    [self.layer setNeedsDisplay];
}
//如果知道这个图就是gif,那可以直接调用这个方法
-(void)setAnimatedImage:(CADisplayLineImage *)animatedImage
{
    _animatedImage = animatedImage;
    if (animatedImage == nil) {
        self.layer.contents = nil;
    }
}
//判断是否正在进行动画
-(BOOL)isAnimating
{
    return [super isAnimating] || (self.displayLink && !self.displayLink.isPaused);
}
//停止动画
-(void)stopAnimating
{
    //如果不是gif就返回父类方法
    if (!self.animatedImage) {
        [super stopAnimating];
        return;
    }
    self.loopCountdown = 0;
    self.displayLink.paused = YES;
}
//开始动画
-(void)startAnimating
{
    if (!self.animatedImage) {
        [super startAnimating];
        return;
    }
    if (self.isAnimating) {
        return;
    }
    self.loopCountdown = self.animatedImage.loopCount ? :NSUIntegerMax;
    self.displayLink.paused = NO;
}
//切换动画的关键方法
-(void)changeKeyframe:(CADisplayLink *)displayLink
{
    if (self.currentFrameIndex >= self.animatedImage.images.count) {
        return;
    }
    //这里就是不停的取图,不停的设置,然后不停的调用displayLayer:方法
    self.accumulator += fmin(displayLink.duration, kMaxTimeStep);
    while (self.accumulator >= self.animatedImage.frameDurations[self.currentFrameIndex]) {
        self.accumulator -= self.animatedImage.frameDurations[self.currentFrameIndex];
        if (++self.currentFrameIndex >= self.animatedImage.images.count) {
            if (--self.loopCountdown == 0) {
                [self stopAnimating];
                return;
            }
            self.currentFrameIndex = 0;
        }
        self.currentFrameIndex = MIN(self.currentFrameIndex, self.animatedImage.images.count - 1);
        self.currentFrame = [self.animatedImage getFrameWithIndex:self.currentFrameIndex];
        [self.layer setNeedsDisplay];
    }
}
//绘制图片
-(void)displayLayer:(CALayer *)layer
{
    if (!self.animatedImage || [self.animatedImage.images count] == 0) {
        return;
    }
    if(self.currentFrame && ![self.currentFrame isKindOfClass:[NSNull class]]){
        layer.contents = (__bridge id)([self.currentFrame CGImage]);
    }
}
-(void)didMoveToWindow
{
    [super didMoveToWindow];
    if (self.window) {
        [self startAnimating];
    }else{
        dispatch_async(dispatch_get_main_queue(), ^{
            if (!self.window) {
                [self stopAnimating];
            }
        });
    }
}
-(void)didMoveToSuperview
{
    [super didMoveToSuperview];
    if (self.superview) {
        //Has a superview, make sure it has a displayLink
        [self displayLink];
    } else {
        //Doesn't have superview, let's check later if we need to remove the displayLink
        dispatch_async(dispatch_get_main_queue(), ^{
            [self displayLink];
        });
    }
}
-(void)setHighlighted:(BOOL)highlighted
{
    if (!self.animatedImage) {
        [super setHighlighted:highlighted];
    }
}
-(UIImage *)image
{
    return self.animatedImage ? : [super image];
}
-(CGSize)sizeThatFits:(CGSize)size
{
    return self.image.size;
}
@end


text:
package org.requs.maven;

import com.jcabi.log.Logger;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.requs.Compiler;
import org.slf4j.impl.StaticLoggerBinder;

/**
 * Compile requs sources into XML.
 *
 * @author Yegor Bugayenko (yegor@tpc2.com)
 * @version $Id$
 * @since 1.1
 * @checkstyle VisibilityModifierCheck (500 lines)
 */
@ToString
@EqualsAndHashCode(callSuper = false)
@Mojo(
    name = "compile", threadSafe = true,
    defaultPhase = LifecyclePhase.COMPILE
)
public final class CompileMojo extends AbstractMojo {

    /**
     * The source directory.
     */
    @Parameter(
        required = true,
        defaultValue = "${basedir}/src/main/requs"
    )
    @NotNull
    public transient File input;

    /**
     * Output directory.
     */
    @Parameter(
        required = true,
        defaultValue = "${project.build.directory}/requs"
    )
    @NotNull
    public transient File output;

    /**
     * Optional properties/options.
     * @since 1.14
     */
    @Parameter(required = false)
    @NotNull
    @SuppressWarnings("PMD.UseConcurrentHashMap")
    public transient Map<String, String> options =
        new ConcurrentHashMap<String, String>(0);

    @Override
    public void execute() throws MojoFailureException {
        StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
        if (!this.input.exists()) {
            Logger.info(this, "input directory %s is absent", this.input);
            return;
        }
        try {
            new Compiler(this.input, this.output, this.options).compile();
            final XML srs = new XMLDocument(new File(this.output, "requs.xml"));
            final Collection<XML> errors = srs.nodes("//errors/error");
            final int prefix = this.input.getAbsolutePath().length() + 1;
            if (!errors.isEmpty()) {
                for (final XML error : errors) {
                    Logger.error(
                        this, "%s[%s:%s] %s",
                        srs.xpath(
                            String.format(
                                "/spec/files/file[@id='%d']/text()",
                                Integer.parseInt(error.xpath("@file").get(0))
                            )
                        ).get(0).substring(prefix),
                        error.xpath("@line").get(0),
                        error.xpath("@pos").get(0),
                        error.xpath("text()").get(0)
                    );
                }
                throw new MojoFailureException(
                    String.format(
                        "%d requs error(s), see log above",
                        errors.size()
                    )
                );
            }
        } catch (final IOException ex) {
            throw new IllegalArgumentException("IO failure", ex);
        }
    }

}