text:
import * as React from 'react';
import { PaginatorTemplate } from '../paginator/Paginator';

type DataViewLayoutType = 'list' | 'grid' | (string & {});

type DataViewPaginatorPositionType = 'top' | 'bottom' | 'both';

type DataViewSortOrderType = 1 | 0 | -1 | undefined | null;

type DataViewAppendToType = 'self' | HTMLElement | undefined | null;

interface DataViewPageParams {
    originalEvent: React.SyntheticEvent;
    first: number;
    rows: number;
}

interface DataViewLayoutOptionsChangeParams {
    originalEvent: React.MouseEvent<HTMLButtonElement>;
    value: DataViewLayoutType;
}

export interface DataViewLayoutOptionsProps {
    id?: string;
    layout?: DataViewLayoutType;
    style?: object;
    className?: string;
    onChange(e: DataViewLayoutOptionsChangeParams): void;
}

export declare class DataViewLayoutOptions extends React.Component<DataViewLayoutOptionsProps, any> { }

export interface DataViewProps {
    id?: string;
    header?: React.ReactNode;
    footer?: React.ReactNode;
    value?: any[];
    layout?: DataViewLayoutType;
    rows?: number;
    first?: number;
    totalRecords?: number;
    paginator?: boolean;
    paginatorPosition?: DataViewPaginatorPositionType;
    alwaysShowPaginator?: boolean;
    paginatorClassName?: string;
    paginatorTemplate?: PaginatorTemplate;
    paginatorLeft?: React.ReactNode;
    paginatorRight?: React.ReactNode;
    pageLinkSize?: number;
    paginatorDropdownAppendTo?: DataViewAppendToType;
    rowsPerPageOptions?: number[];
    currentPageReportTemplate?: string;
    emptyMessage?: string;
    sortField?: string;
    sortOrder?: DataViewSortOrderType;
    style?: object;
    className?: string;
    lazy?: boolean;
    loading?: boolean;
    loadingIcon?: string;
    onPage?(e: DataViewPageParams): void;
    itemTemplate?(item: any, layout: DataViewLayoutType): React.ReactNode;
}

// tslint:disable-next-line:max-classes-per-file
export declare class DataView extends React.Component<DataViewProps, any> { }


text:
#nullable disable
using CommandLine;
using System.Text;

namespace WizBot.Modules.Games.Common;

public class TicTacToe
{
    public event Action<TicTacToe> OnEnded;
    private readonly ITextChannel _channel;
    private readonly IGuildUser[] _users;
    private readonly int?[,] _state;
    private Phase phase;
    private int curUserIndex;
    private readonly SemaphoreSlim _moveLock;

    private IGuildUser winner;

    private readonly string[] _numbers =
    {
        ":one:", ":two:", ":three:", ":four:", ":five:", ":six:", ":seven:", ":eight:", ":nine:"
    };

    private IUserMessage previousMessage;
    private Timer timeoutTimer;
    private readonly IBotStrings _strings;
    private readonly DiscordSocketClient _client;
    private readonly Options _options;
    private readonly IEmbedBuilderService _eb;

    public TicTacToe(
        IBotStrings strings,
        DiscordSocketClient client,
        ITextChannel channel,
        IGuildUser firstUser,
        Options options,
        IEmbedBuilderService eb)
    {
        _channel = channel;
        _strings = strings;
        _client = client;
        _options = options;
        _eb = eb;

        _users = new[] { firstUser, null };
        _state = new int?[,] { { null, null, null }, { null, null, null }, { null, null, null } };

        phase = Phase.Starting;
        _moveLock = new(1, 1);
    }

    private string GetText(LocStr key)
        => _strings.GetText(key, _channel.GuildId);

    public string GetState()
    {
        var sb = new StringBuilder();
        for (var i = 0; i < _state.GetLength(0); i++)
        {
            for (var j = 0; j < _state.GetLength(1); j++)
            {
                sb.Append(_state[i, j] is null ? _numbers[(i * 3) + j] : GetIcon(_state[i, j]));
                if (j < _state.GetLength(1) - 1)
                    sb.Append("┃");
            }

            if (i < _state.GetLength(0) - 1)
                sb.AppendLine("\n──────────");
        }

        return sb.ToString();
    }

    public IEmbedBuilder GetEmbed(string title = null)
    {
        var embed = _eb.Create()
                       .WithOkColor()
                       .WithDescription(Environment.NewLine + GetState())
                       .WithAuthor(GetText(strs.vs(_users[0], _users[1])));

        if (!string.IsNullOrWhiteSpace(title))
            embed.WithTitle(title);

        if (winner is null)
        {
            if (phase == Phase.Ended)
                embed.WithFooter(GetText(strs.ttt_no_moves));
            else
                embed.WithFooter(GetText(strs.ttt_users_move(_users[curUserIndex])));
        }
        else
            embed.WithFooter(GetText(strs.ttt_has_won(winner)));

        return embed;
    }

    private static string GetIcon(int? val)
    {
        switch (val)
        {
            case 0:
                return "❌";
            case 1:
                return "⭕";
            case 2:
                return "❎";
            case 3:
                return "🅾";
            default:
                return "⬛";
        }
    }

    public async Task Start(IGuildUser user)
    {
        if (phase is Phase.Started or Phase.Ended)
        {
            await _channel.SendErrorAsync(_eb, user.Mention + GetText(strs.ttt_already_running));
            return;
        }

        if (_users[0] == user)
        {
            await _channel.SendErrorAsync(_eb, user.Mention + GetText(strs.ttt_against_yourself));
            return;
        }

        _users[1] = user;

        phase = Phase.Started;

        timeoutTimer = new(async _ =>
            {
                await _moveLock.WaitAsync();
                try
                {
                    if (phase == Phase.Ended)
                        return;

                    phase = Phase.Ended;
                    if (_users[1] is not null)
                    {
                        winner = _users[curUserIndex ^= 1];
                        var del = previousMessage?.DeleteAsync();
                        try
                        {
                            await _channel.EmbedAsync(GetEmbed(GetText(strs.ttt_time_expired)));
                            if (del is not null)
                                await del;
                        }
                        catch { }
                    }

                    OnEnded?.Invoke(this);
                }
                catch { }
                finally
                {
                    _moveLock.Release();
                }
            },
            null,
            _options.TurnTimer * 1000,
            Timeout.Infinite);

        _client.MessageReceived += Client_MessageReceived;

        previousMessage = await _channel.EmbedAsync(GetEmbed(GetText(strs.game_started)));
    }

    private bool IsDraw()
    {
        for (var i = 0; i < 3; i++)
        for (var j = 0; j < 3; j++)
        {
            if (_state[i, j] is null)
                return false;
        }

        return true;
    }

    private Task Client_MessageReceived(SocketMessage msg)
    {
        _ = Task.Run(async () =>
        {
            await _moveLock.WaitAsync();
            try
            {
                var curUser = _users[curUserIndex];
                if (phase == Phase.Ended || msg.Author?.Id != curUser.Id)
                    return;

                if (int.TryParse(msg.Content, out var index)
                    && --index >= 0
                    && index <= 9
                    && _state[index / 3, index % 3] is null)
                {
                    _state[index / 3, index % 3] = curUserIndex;

                    // i'm lazy
                    if (_state[index / 3, 0] == _state[index / 3, 1] && _state[index / 3, 1] == _state[index / 3, 2])
                    {
                        _state[index / 3, 0] = curUserIndex + 2;
                        _state[index / 3, 1] = curUserIndex + 2;
                        _state[index / 3, 2] = curUserIndex + 2;

                        phase = Phase.Ended;
                    }
                    else if (_state[0, index % 3] == _state[1, index % 3]
                             && _state[1, index % 3] == _state[2, index % 3])
                    {
                        _state[0, index % 3] = curUserIndex + 2;
                        _state[1, index % 3] = curUserIndex + 2;
                        _state[2, index % 3] = curUserIndex + 2;

                        phase = Phase.Ended;
                    }
                    else if (curUserIndex == _state[0, 0]
                             && _state[0, 0] == _state[1, 1]
                             && _state[1, 1] == _state[2, 2])
                    {
                        _state[0, 0] = curUserIndex + 2;
                        _state[1, 1] = curUserIndex + 2;
                        _state[2, 2] = curUserIndex + 2;

                        phase = Phase.Ended;
                    }
                    else if (curUserIndex == _state[0, 2]
                             && _state[0, 2] == _state[1, 1]
                             && _state[1, 1] == _state[2, 0])
                    {
                        _state[0, 2] = curUserIndex + 2;
                        _state[1, 1] = curUserIndex + 2;
                        _state[2, 0] = curUserIndex + 2;

                        phase = Phase.Ended;
                    }

                    var reason = string.Empty;

                    if (phase == Phase.Ended) // if user won, stop receiving moves
                    {
                        reason = GetText(strs.ttt_matched_three);
                        winner = _users[curUserIndex];
                        _client.MessageReceived -= Client_MessageReceived;
                        OnEnded?.Invoke(this);
                    }
                    else if (IsDraw())
                    {
                        reason = GetText(strs.ttt_a_draw);
                        phase = Phase.Ended;
                        _client.MessageReceived -= Client_MessageReceived;
                        OnEnded?.Invoke(this);
                    }

                    _ = Task.Run(async () =>
                    {
                        var del1 = msg.DeleteAsync();
                        var del2 = previousMessage?.DeleteAsync();
                        try { previousMessage = await _channel.EmbedAsync(GetEmbed(reason)); }
                        catch { }

                        try { await del1; }
                        catch { }

                        try
                        {
                            if (del2 is not null)
                                await del2;
                        }
                        catch { }
                    });
                    curUserIndex ^= 1;

                    timeoutTimer.Change(_options.TurnTimer * 1000, Timeout.Infinite);
                }
            }
            finally
            {
                _moveLock.Release();
            }
        });

        return Task.CompletedTask;
    }

    public class Options : IWizBotCommandOptions
    {
        [Option('t', "turn-timer", Required = false, Default = 15, HelpText = "Turn time in seconds. Default 15.")]
        public int TurnTimer { get; set; } = 15;

        public void NormalizeOptions()
        {
            if (TurnTimer is < 5 or > 60)
                TurnTimer = 15;
        }
    }

    private enum Phase
    {
        Starting,
        Started,
        Ended
    }
}

redpajama_set_name: RedPajamaGithub


text:
{% block modal_irods_browse %}

                    <button type="button" class="close" data-dismiss="modal">×Close</button>

iRODS user:

                <form class="form-signin" role="form" action="" method="post" id="irodsUpload">

                        {% csrf_token %}
                        <input type="hidden" name="store" id="root_store" value=""/>
                        <input type="hidden" name="res_id" id="res_id" value="{{ cm.short_id }}"/>
                        <input type="hidden" id="irods_username" name="irods_username" value="">
                        <input type="hidden" id="irods_password" name="irods_password" value="">
                        <input type="hidden" id="irods_host" name="irods_host" value="">
                        <input type="hidden" id="irods_port" name="irods_port" value="">
                        <input type="hidden" id="irods_zone" name="irods_zone" value="">
                        <input type="hidden" id="upload_store" value=""/>

Viewing : <input type="text" class="form-control" id="irods_view_store" >

Any file type can be uploaded.

Multiple file upload is allowed.

                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" id="iget_irods" class="btn btn-primary">Select</button>

                </form>

{% endblock %}

{% block extra_js %}

{% endblock %}


text:
package es.um.nosql.s13e.stackoverflow;

import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import org.mongodb.morphia.annotations.Reference;
import javax.validation.constraints.NotNull;

@Entity(value = "postlinks", noClassnameStored = true)
public class Postlinks
{
  @Property
  @NotNull(message = "CreationDate can't be null")
  private String CreationDate;
  public String getCreationDate() {return this.CreationDate;}
  public void setCreationDate(String CreationDate) {this.CreationDate = CreationDate;}

  @Property
  @NotNull(message = "LinkTypeId can't be null")
  private Integer LinkTypeId;
  public Integer getLinkTypeId() {return this.LinkTypeId;}
  public void setLinkTypeId(Integer LinkTypeId) {this.LinkTypeId = LinkTypeId;}

  @Reference(idOnly = true, lazy = true)
  @NotNull(message = "PostId can't be null")
  private Posts PostId;
  public Posts getPostId() {return this.PostId;}
  public void setPostId(Posts PostId) {this.PostId = PostId;}

  @Reference(idOnly = true, lazy = true)
  @NotNull(message = "RelatedPostId can't be null")
  private Posts RelatedPostId;
  public Posts getRelatedPostId() {return this.RelatedPostId;}
  public void setRelatedPostId(Posts RelatedPostId) {this.RelatedPostId = RelatedPostId;}

  @Id
  @NotNull(message = "_id can't be null")
  private String _id;
  public String get_id() {return this._id;}
  public void set_id(String _id) {this._id = _id;}
}


text:
<!--
    @license
    Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
    This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
    The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
    The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
    Code distributed by Google as part of the polymer project is also
    subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<style>
  .styled {
    background: blue;
  }
</style>
<style>
  .overridden-style {
    background: red;
  }
</style>
<style>
  .styled {
    background: red;
  }
</style>

<style type="foo">
  .style-typed {
    background: red;
  }
</style>


text:
package com.marshalchen.common.uimodule.tileView.tileview.geom;

import android.graphics.Point;

import java.util.ArrayList;
import java.util.List;

public class PositionManager {

	private double left;
	private double top;
	private double right;
	private double bottom;

	private double offsetWidth;
	private double offsetHeight;

	private int pixelWidth;
	private int pixelHeight;

	private boolean definedBounds;

	private void calculateOffsets() {
		offsetWidth = right - left;
		offsetHeight = bottom - top;
	}

	public void setSize( int w, int h ) {
		pixelWidth = w;
		pixelHeight = h;
		if(!definedBounds){
			right = pixelWidth;
			bottom = pixelHeight;
			calculateOffsets();
		}
	}

	public void setBounds( double l, double t, double r, double b ) {
		definedBounds = true;
		left = l;
		top = t;
		right = r;
		bottom = b;
		calculateOffsets();
	}

	public void unsetBounds() {
		definedBounds = false;
		left = 0;
		top = 0;
		right = pixelWidth;
		bottom = pixelHeight;
		calculateOffsets();
	}

	public Point translate( double x, double y, double scale ) {
		Point point = translate( x, y );
		point.x = (int) ( (0.5 + point.x ) * scale );
		point.y = (int) ( (0.5 + point.y ) * scale );
		return point;
	}

	// get back the point coordinates *not* scaled (for markers, callouts, etc, that handle scale internally)
	public Point translate( double x, double y ) {

		Point point = new Point();

		double factorX = ( x - left ) / offsetWidth;
		point.x = (int) ( 0.5 + ( pixelWidth * factorX ) );

		double factorY = ( y - top ) / offsetHeight;
		point.y = (int) ( 0.5 + ( pixelHeight * factorY ) );

		return point;

	}

	public ArrayList<Point> translate( List<double[]> positions ){
		ArrayList<Point> points = new ArrayList<Point>();
		for( double[] position : positions ) {
			Point point = translate( position[0], position[1] );
			points.add( point );
		}
		return points;
	}

	public boolean contains( double x, double y ) {
		double minX = Math.min( left, right );
		double maxX = Math.max( left, right );
		double minY = Math.min( top, bottom );
		double maxY = Math.max( top, bottom );
		return y >= minY
			&& y <= maxY
			&& x >= minX
			&& x <= maxX;
	}

}

/*

	public double getLeft() {
		return left;
	}

	public void setLeft( double left ) {
		this.left = left;
	}

	public double getTop() {
		return top;
	}

	public void setTop( double top ) {
		this.top = top;
	}

	public double getRight() {
		return right;
	}

	public void setRight( double right ) {
		this.right = right;
	}

	public double getBottom() {
		return bottom;
	}

	public void setBottom( double bottom ) {
		this.bottom = bottom;
	}

	public int getWidth() {
		return pixelWidth;
	}

	public void setWidth( int width ) {
		pixelWidth = width;
	}

	public int getHeight() {
		return pixelHeight;
	}

	public void setHeight( int height ) {
		pixelHeight = height;
	}

 */

/*
package com.qozix.geom;

import java.util.ArrayList;

import android.graphics.Point;

public class Geolocator {

	private Coordinate topLeft = new Coordinate();
	private Coordinate bottomRight = new Coordinate();

	private int pixelWidth = 0;
	private int pixelHeight = 0;

	public void setCoordinates( Coordinate tl, Coordinate br ) {
		topLeft = tl;
		bottomRight = br;
	}

	public void setCoordinates( double left, double top, double right, double bottom ){
		topLeft = new Coordinate( left, top );
		bottomRight = new Coordinate( right, bottom );
	}

	public void setSize( int w, int h ) {
		pixelWidth = w;
		pixelHeight = h;
	}

	public Point translate( Coordinate c ) {

		Point p = new Point();

		double longitudanalDelta = bottomRight.longitude - topLeft.longitude;
		double longitudanalDifference = c.longitude - topLeft.longitude;
		double longitudanalFactor = longitudanalDifference / longitudanalDelta;
		p.x = (int) ( longitudanalFactor * pixelWidth );

		double latitudanalDelta = bottomRight.latitude - topLeft.latitude;
		double latitudanalDifference = c.latitude - topLeft.latitude;
		double latitudanalFactor = latitudanalDifference / latitudanalDelta;
		p.y = (int) ( latitudanalFactor * pixelHeight );

		return p;

	}

	public Coordinate translate( Point p ) {

		Coordinate c = new Coordinate();

		double relativeX = p.x / (double) pixelWidth;
		double deltaX = bottomRight.longitude - topLeft.longitude;
		c.longitude = topLeft.longitude + deltaX * relativeX;

		double relativeY = p.y / (double) pixelHeight;
		double deltaY = bottomRight.latitude - topLeft.latitude;
		c.latitude = topLeft.latitude + deltaY * relativeY;

		return c;
	}

	public int[] coordinatesToPixels( double lat, double lng ) {

		int[] positions = new int[2];

		double longitudanalDelta = bottomRight.longitude - topLeft.longitude;
		double longitudanalDifference = lng - topLeft.longitude;
		double longitudanalFactor = longitudanalDifference / longitudanalDelta;
		positions[0] = (int) ( longitudanalFactor * pixelWidth );

		double latitudanalDelta = bottomRight.latitude - topLeft.latitude;
		double latitudanalDifference = lat - topLeft.latitude;
		double latitudanalFactor = latitudanalDifference / latitudanalDelta;
		positions[1] = (int) ( latitudanalFactor * pixelHeight );

		return positions;

	}

	public ArrayList<Point> getPointsFromCoordinates( ArrayList<Coordinate> coordinates ) {
		ArrayList<Point> points = new ArrayList<Point>();
		for ( Coordinate coordinate : coordinates ) {
			Point point = translate( coordinate );
			points.add( point );
		}
		return points;
	}

	public ArrayList<Coordinate> getCoordinatesFromPoints( ArrayList<Point> points ) {
		ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
		for ( Point point : points ) {
			Coordinate coordinate = translate( point );
			coordinates.add( coordinate );
		}
		return coordinates;
	}

	public boolean contains( Coordinate coordinate ) {
		double minLat = Math.min( topLeft.latitude, bottomRight.latitude );
		double maxLat = Math.max( topLeft.latitude, bottomRight.latitude );
		double minLng = Math.min( topLeft.longitude, bottomRight.longitude );
		double maxLng = Math.max( topLeft.longitude, bottomRight.longitude );
		return coordinate.latitude >= minLat
			&& coordinate.latitude <= maxLat
			&& coordinate.longitude >= minLng
			&& coordinate.longitude <= maxLng;
	}
}
*/


text:
import React, { Children, useEffect, useLayoutEffect } from 'react'

type State = JSX.Element[] | undefined

export type SideEffectProps = {
  reduceComponentsToState: <T extends {}>(
    components: Array<React.ReactElement<any>>,
    props: T
  ) => State
  handleStateChange?: (state: State) => void
  headManager: any
  inAmpMode?: boolean
  children: React.ReactNode
}

const isServer = typeof window === 'undefined'
const useClientOnlyLayoutEffect = isServer ? () => {} : useLayoutEffect
const useClientOnlyEffect = isServer ? () => {} : useEffect

export default function SideEffect(props: SideEffectProps) {
  const { headManager, reduceComponentsToState } = props

  function emitChange() {
    if (headManager && headManager.mountedInstances) {
      const headElements = Children.toArray(
        Array.from(headManager.mountedInstances as Set<unknown>).filter(Boolean)
      ) as React.ReactElement[]
      headManager.updateHead(reduceComponentsToState(headElements, props))
    }
  }

  if (isServer) {
    headManager?.mountedInstances?.add(props.children)
    emitChange()
  }

  useClientOnlyLayoutEffect(() => {
    headManager?.mountedInstances?.add(props.children)
    return () => {
      headManager?.mountedInstances?.delete(props.children)
    }
  })

  // We need to call `updateHead` method whenever the `SideEffect` is trigger in all
  // life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s
  // being rendered, we only trigger the method from the last one.
  // This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate`
  // singleton in the layout effect pass, and actually trigger it in the effect pass.
  useClientOnlyLayoutEffect(() => {
    if (headManager) {
      headManager._pendingUpdate = emitChange
    }
    return () => {
      if (headManager) {
        headManager._pendingUpdate = emitChange
      }
    }
  })

  useClientOnlyEffect(() => {
    if (headManager && headManager._pendingUpdate) {
      headManager._pendingUpdate()
      headManager._pendingUpdate = null
    }
    return () => {
      if (headManager && headManager._pendingUpdate) {
        headManager._pendingUpdate()
        headManager._pendingUpdate = null
      }
    }
  })

  return null
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Immutable;
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers
{
    internal abstract class AbstractAllocationAnalyzer : DiagnosticAnalyzer
    {
        protected abstract ImmutableArray<OperationKind> Operations { get; }

        protected abstract void AnalyzeNode(OperationAnalysisContext context, in PerformanceSensitiveInfo info);

        public override void Initialize(AnalysisContext context)
        {
            context.EnableConcurrentExecution();

            // This analyzer is triggered by an attribute, even if it appears in generated code
            context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);

            if (Operations.IsEmpty)
            {
                return;
            }

            context.RegisterCompilationStartAction(compilationStartContext =>
            {
                var compilation = compilationStartContext.Compilation;
                var attributeSymbol = compilation.GetOrCreateTypeByMetadataName(AllocationRules.PerformanceSensitiveAttributeName);

                // Bail if PerformanceSensitiveAttribute is not declared in the compilation.
                if (attributeSymbol == null)
                {
                    return;
                }

                compilationStartContext.RegisterOperationBlockStartAction(blockStartContext =>
                {
                    var checker = new AttributeChecker(attributeSymbol);
                    RegisterOperationAnalysis(blockStartContext, checker);
                });
            });
        }

        private void RegisterOperationAnalysis(OperationBlockStartAnalysisContext operationBlockStartAnalysisContext, AttributeChecker performanceSensitiveAttributeChecker)
        {
            var owningSymbol = operationBlockStartAnalysisContext.OwningSymbol;
            if (!performanceSensitiveAttributeChecker.TryGetContainsPerformanceSensitiveInfo(owningSymbol, out var info))
            {
                return;
            }

            operationBlockStartAnalysisContext.RegisterOperationAction(
                syntaxNodeContext =>
                {
                    AnalyzeNode(syntaxNodeContext, in info);
                },
                Operations);
        }

        protected sealed class AttributeChecker
        {
            private INamedTypeSymbol PerfSensitiveAttributeSymbol { get; }

            public AttributeChecker(INamedTypeSymbol perfSensitiveAttributeSymbol)
            {
                PerfSensitiveAttributeSymbol = perfSensitiveAttributeSymbol;
            }

            public bool TryGetContainsPerformanceSensitiveInfo(ISymbol symbol, out PerformanceSensitiveInfo info)
            {
                if (TryGet(symbol, out info))
                {
                    return true;
                }

                // The attribute might be applied to a property declaration, instead of its accessor declaration.
                if (symbol is IMethodSymbol methodSymbol &&
                    (methodSymbol.MethodKind == MethodKind.PropertyGet || methodSymbol.MethodKind == MethodKind.PropertySet) &&
                    TryGet(methodSymbol.AssociatedSymbol, out info))
                {
                    return true;
                }

                info = default;
                return false;

                bool TryGet(ISymbol s, out PerformanceSensitiveInfo i)
                {
                    var attributes = s.GetAttributes();
                    foreach (var attribute in attributes)
                    {
                        if (attribute.AttributeClass.Equals(PerfSensitiveAttributeSymbol))
                        {
                            i = CreatePerformanceSensitiveInfo(attribute);
                            return true;
                        }
                    }

                    i = default;
                    return false;
                }
            }

            private static PerformanceSensitiveInfo CreatePerformanceSensitiveInfo(AttributeData data)
            {
                var allowCaptures = true;
                var allowGenericEnumeration = true;
                var allowLocks = true;

                foreach (var namedArgument in data.NamedArguments)
                {
                    switch (namedArgument.Key)
                    {
                        case "AllowCaptures":
                            allowCaptures = (bool)namedArgument.Value.Value;
                            break;
                        case "AllowGenericEnumeration":
                            allowGenericEnumeration = (bool)namedArgument.Value.Value;
                            break;
                        case "AllowLocks":
                            allowLocks = (bool)namedArgument.Value.Value;
                            break;
                    }
                }

                return new PerformanceSensitiveInfo(allowCaptures, allowGenericEnumeration, allowLocks);
            }
        }

#pragma warning disable CA1815 // Override equals and operator equals on value types. This type is never used for comparison
        protected readonly struct PerformanceSensitiveInfo
#pragma warning restore CA1815
        {
            public bool AllowCaptures { get; }
            public bool AllowGenericEnumeration { get; }
            public bool AllowLocks { get; }

            public PerformanceSensitiveInfo(
                bool allowCaptures = true,
                bool allowGenericEnumeration = true,
                bool allowLocks = true)
            {
                AllowCaptures = allowCaptures;
                AllowGenericEnumeration = allowGenericEnumeration;
                AllowLocks = allowLocks;
            }
        }
    }
}


text:
namespace google_breakpad {
namespace mach_o {

using std::map;
using std::string;
using std::vector;

// The Mac headers don't specify particular types for these groups of
// constants, but defining them here provides some documentation
// value.  We also give them the same width as the fields in which
// they appear, which makes them a bit easier to use with ByteCursors.
typedef uint32_t Magic;
typedef uint32_t FileType;
typedef uint32_t FileFlags;
typedef uint32_t LoadCommandType;
typedef uint32_t SegmentFlags;
typedef uint32_t SectionFlags;

// A parser for fat binary files, used to store universal binaries.
// When applied to a (non-fat) Mach-O file, this behaves as if the
// file were a fat file containing a single object file.
class FatReader {
 public:

  // A class for reporting errors found while parsing fat binary files. The
  // default definitions of these methods print messages to stderr.
  class Reporter {
   public:
    // Create a reporter that attributes problems to |filename|.
    explicit Reporter(const string &filename) : filename_(filename) { }

    virtual ~Reporter() { }

    // The data does not begin with a fat binary or Mach-O magic number.
    // This is a fatal error.
    virtual void BadHeader();

    // The Mach-O fat binary file ends abruptly, without enough space
    // to contain an object file it claims is present.
    virtual void MisplacedObjectFile();

    // The file ends abruptly: either it is not large enough to hold a
    // complete header, or the header implies that contents are present
    // beyond the actual end of the file.
    virtual void TooShort();

   private:
    // The filename to which the reader should attribute problems.
    string filename_;
  };

  // Create a fat binary file reader that uses |reporter| to report problems.
  explicit FatReader(Reporter *reporter) : reporter_(reporter) { }

  // Read the |size| bytes at |buffer| as a fat binary file. On success,
  // return true; on failure, report the problem to reporter_ and return
  // false.
  //
  // If the data is a plain Mach-O file, rather than a fat binary file,
  // then the reader behaves as if it had found a fat binary file whose
  // single object file is the Mach-O file.
  bool Read(const uint8_t *buffer, size_t size);

  // Return an array of 'struct fat_arch' structures describing the
  // object files present in this fat binary file. Set |size| to the
  // number of elements in the array.
  //
  // Assuming Read returned true, the entries are validated: it is
  // safe to assume that the offsets and sizes in each 'struct
  // fat_arch' refer to subranges of the bytes passed to Read.
  //
  // If there are no object files in this fat binary, then this
  // function can return NULL.
  //
  // The array is owned by this FatReader instance; it will be freed when
  // this FatReader is destroyed.
  //
  // This function returns a C-style array instead of a vector to make it
  // possible to use the result with OS X functions like NXFindBestFatArch,
  // so that the symbol dumper will behave consistently with other OS X
  // utilities that work with fat binaries.
  const struct fat_arch *object_files(size_t *count) const {
    *count = object_files_.size();
    if (object_files_.size() > 0)
      return &object_files_[0];
    return NULL;
  }

 private:
  // We use this to report problems parsing the file's contents. (WEAK)
  Reporter *reporter_;

  // The contents of the fat binary or Mach-O file we're parsing. We do not
  // own the storage it refers to.
  ByteBuffer buffer_;

  // The magic number of this binary, in host byte order.
  Magic magic_;

  // The list of object files in this binary.
  // object_files_.size() == fat_header.nfat_arch
  vector<struct fat_arch> object_files_;
};

// A segment in a Mach-O file. All these fields have been byte-swapped as
// appropriate for use by the executing architecture.
struct Segment {
  // The ByteBuffers below point into the bytes passed to the Reader that
  // created this Segment.

  ByteBuffer section_list;    // This segment's section list.
  ByteBuffer contents;        // This segment's contents.

  // This segment's name.
  string name;

  // The address at which this segment should be loaded in memory. If
  // bits_64 is false, only the bottom 32 bits of this value are valid.
  uint64_t vmaddr;

  // The size of this segment when loaded into memory. This may be larger
  // than contents.Size(), in which case the extra area will be
  // initialized with zeros. If bits_64 is false, only the bottom 32 bits
  // of this value are valid.
  uint64_t vmsize;

  // The maximum and initial VM protection of this segment's contents.
  uint32_t maxprot;
  uint32_t initprot;

  // The number of sections in section_list.
  uint32_t nsects;

  // Flags describing this segment, from SegmentFlags.
  uint32_t flags;

  // True if this is a 64-bit section; false if it is a 32-bit section.
  bool bits_64;
};

// A section in a Mach-O file. All these fields have been byte-swapped as
// appropriate for use by the executing architecture.
struct Section {
  // This section's contents. This points into the bytes passed to the
  // Reader that created this Section.
  ByteBuffer contents;

  // This section's name.
  string section_name;  // section[_64].sectname
  // The name of the segment this section belongs to.
  string segment_name;  // section[_64].segname

  // The address at which this section's contents should be loaded in
  // memory. If bits_64 is false, only the bottom 32 bits of this value
  // are valid.
  uint64_t address;

  // The contents of this section should be loaded into memory at an
  // address which is a multiple of (two raised to this power).
  uint32_t align;

  // Flags from SectionFlags describing the section's contents.
  uint32_t flags;

  // We don't support reading relocations yet.

  // True if this is a 64-bit section; false if it is a 32-bit section.
  bool bits_64;
};

// A map from section names to Sections.
typedef map<string, Section> SectionMap;

// A reader for a Mach-O file.
//
// This does not handle fat binaries; see FatReader above. FatReader
// provides a friendly interface for parsing data that could be either a
// fat binary or a Mach-O file.
class Reader {
 public:

  // A class for reporting errors found while parsing Mach-O files. The
  // default definitions of these member functions print messages to
  // stderr.
  class Reporter {
   public:
    // Create a reporter that attributes problems to |filename|.
    explicit Reporter(const string &filename) : filename_(filename) { }
    virtual ~Reporter() { }

    // Reporter functions for fatal errors return void; the reader will
    // definitely return an error to its caller after calling them

    // The data does not begin with a Mach-O magic number, or the magic
    // number does not match the expected value for the cpu architecture.
    // This is a fatal error.
    virtual void BadHeader();

    // The data contained in a Mach-O fat binary (|cpu_type|, |cpu_subtype|)
    // does not match the expected CPU architecture
    // (|expected_cpu_type|, |expected_cpu_subtype|).
    virtual void CPUTypeMismatch(cpu_type_t cpu_type,
                                 cpu_subtype_t cpu_subtype,
                                 cpu_type_t expected_cpu_type,
                                 cpu_subtype_t expected_cpu_subtype);

    // The file ends abruptly: either it is not large enough to hold a
    // complete header, or the header implies that contents are present
    // beyond the actual end of the file.
    virtual void HeaderTruncated();

    // The file's load command region, as given in the Mach-O header, is
    // too large for the file.
    virtual void LoadCommandRegionTruncated();

    // The file's Mach-O header claims the file contains |claimed| load
    // commands, but the I'th load command, of type |type|, extends beyond
    // the end of the load command region, as given by the Mach-O header.
    // If |type| is zero, the command's type was unreadable.
    virtual void LoadCommandsOverrun(size_t claimed, size_t i,
                                     LoadCommandType type);

    // The contents of the |i|'th load command, of type |type|, extend beyond
    // the size given in the load command's header.
    virtual void LoadCommandTooShort(size_t i, LoadCommandType type);

    // The LC_SEGMENT or LC_SEGMENT_64 load command for the segment named
    // |name| is too short to hold the sections that its header says it does.
    // (This more specific than LoadCommandTooShort.)
    virtual void SectionsMissing(const string &name);

    // The segment named |name| claims that its contents lie beyond the end
    // of the file.
    virtual void MisplacedSegmentData(const string &name);

    // The section named |section| in the segment named |segment| claims that
    // its contents do not lie entirely within the segment.
    virtual void MisplacedSectionData(const string &section,
                                      const string &segment);

    // The LC_SYMTAB command claims that symbol table contents are located
    // beyond the end of the file.
    virtual void MisplacedSymbolTable();

    // An attempt was made to read a Mach-O file of the unsupported
    // CPU architecture |cpu_type|.
    virtual void UnsupportedCPUType(cpu_type_t cpu_type);

   private:
    string filename_;
  };

  // A handler for sections parsed from a segment. The WalkSegmentSections
  // member function accepts an instance of this class, and applies it to
  // each section defined in a given segment.
  class SectionHandler {
   public:
    virtual ~SectionHandler() { }

    // Called to report that the segment's section list contains |section|.
    // This should return true if the iteration should continue, or false
    // if it should stop.
    virtual bool HandleSection(const Section &section) = 0;
  };

  // A handler for the load commands in a Mach-O file.
  class LoadCommandHandler {
   public:
    LoadCommandHandler() { }
    virtual ~LoadCommandHandler() { }

    // When called from WalkLoadCommands, the following handler functions
    // should return true if they wish to continue iterating over the load
    // command list, or false if they wish to stop iterating.
    //
    // When called from LoadCommandIterator::Handle or Reader::Handle,
    // these functions' return values are simply passed through to Handle's
    // caller.
    //
    // The definitions provided by this base class simply return true; the
    // default is to silently ignore sections whose member functions the
    // subclass doesn't override.

    // COMMAND is load command we don't recognize. We provide only the
    // command type and a ByteBuffer enclosing the command's data (If we
    // cannot parse the command type or its size, we call
    // reporter_->IncompleteLoadCommand instead.)
    virtual bool UnknownCommand(LoadCommandType type,
                                const ByteBuffer &contents) {
      return true;
    }

    // The load command is LC_SEGMENT or LC_SEGMENT_64, defining a segment
    // with the properties given in |segment|.
    virtual bool SegmentCommand(const Segment &segment) {
      return true;
    }

    // The load command is LC_SYMTAB. |entries| holds the array of nlist
    // entries, and |names| holds the strings the entries refer to.
    virtual bool SymtabCommand(const ByteBuffer &entries,
                               const ByteBuffer &names) {
      return true;
    }

    // Add handler functions for more load commands here as needed.
  };

  // Create a Mach-O file reader that reports problems to |reporter|.
  explicit Reader(Reporter *reporter)
      : reporter_(reporter) { }

  // Read the given data as a Mach-O file. The reader retains pointers
  // into the data passed, so the data should live as long as the reader
  // does. On success, return true; on failure, return false.
  //
  // At most one of these functions should be invoked once on each Reader
  // instance.
  bool Read(const uint8_t *buffer,
            size_t size,
            cpu_type_t expected_cpu_type,
            cpu_subtype_t expected_cpu_subtype);
  bool Read(const ByteBuffer &buffer,
            cpu_type_t expected_cpu_type,
            cpu_subtype_t expected_cpu_subtype) {
    return Read(buffer.start,
                buffer.Size(),
                expected_cpu_type,
                expected_cpu_subtype);
  }

  // Return this file's characteristics, as found in the Mach-O header.
  cpu_type_t    cpu_type()    const { return cpu_type_; }
  cpu_subtype_t cpu_subtype() const { return cpu_subtype_; }
  FileType      file_type()   const { return file_type_; }
  FileFlags     flags()       const { return flags_; }

  // Return true if this is a 64-bit Mach-O file, false if it is a 32-bit
  // Mach-O file.
  bool bits_64() const { return bits_64_; }

  // Return true if this is a big-endian Mach-O file, false if it is
  // little-endian.
  bool big_endian() const { return big_endian_; }

  // Apply |handler| to each load command in this Mach-O file, stopping when
  // a handler function returns false. If we encounter a malformed load
  // command, report it via reporter_ and return false. Return true if all
  // load commands were parseable and all handlers returned true.
  bool WalkLoadCommands(LoadCommandHandler *handler) const;

  // Set |segment| to describe the segment named |name|, if present. If
  // found, |segment|'s byte buffers refer to a subregion of the bytes
  // passed to Read. If we find the section, return true; otherwise,
  // return false.
  bool FindSegment(const string &name, Segment *segment) const;

  // Apply |handler| to each section defined in |segment|. If |handler| returns
  // false, stop iterating and return false. If all calls to |handler| return
  // true and we reach the end of the section list, return true.
  bool WalkSegmentSections(const Segment &segment, SectionHandler *handler)
    const;

  // Clear |section_map| and then populate it with a map of the sections
  // in |segment|, from section names to Section structures.
  // Each Section's contents refer to bytes in |segment|'s contents.
  // On success, return true; if a problem occurs, report it and return false.
  bool MapSegmentSections(const Segment &segment, SectionMap *section_map)
    const;

 private:
  // Used internally.
  class SegmentFinder;
  class SectionMapper;

  // We use this to report problems parsing the file's contents. (WEAK)
  Reporter *reporter_;

  // The contents of the Mach-O file we're parsing. We do not own the
  // storage it refers to.
  ByteBuffer buffer_;

  // True if this file is big-endian.
  bool big_endian_;

  // True if this file is a 64-bit Mach-O file.
  bool bits_64_;

  // This file's cpu type and subtype.
  cpu_type_t cpu_type_;        // mach_header[_64].cputype
  cpu_subtype_t cpu_subtype_;  // mach_header[_64].cpusubtype

  // This file's type.
  FileType file_type_;         // mach_header[_64].filetype

  // The region of buffer_ occupied by load commands.
  ByteBuffer load_commands_;

  // The number of load commands in load_commands_.
  uint32_t load_command_count_;  // mach_header[_64].ncmds

  // This file's header flags.
  FileFlags flags_;
};

}  // namespace mach_o
}  // namespace google_breakpad

#endif  // BREAKPAD_COMMON_MAC_MACHO_READER_H_


text:
package org.apache.rya.indexing.smarturi;

import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.apache.rya.api.domain.RyaType;
import org.apache.rya.api.domain.RyaURI;
import org.apache.rya.api.resolver.RdfToRyaConversions;
import org.apache.rya.api.resolver.RyaToRdfConversions;
import org.apache.rya.indexing.entity.model.Entity;
import org.apache.rya.indexing.entity.model.Property;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.vocabulary.XMLSchema;

import com.google.common.base.Charsets;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;

/**
 * Interface for serializing and deserializing Smart URIs.
 */
public class SmartUriAdapter {
    private static final String ENTITY_TYPE_MAP_URN = "urn://entityTypeMap";
    private static final URI RYA_TYPES_URI = new URIImpl("urn://ryaTypes");

    /**
     * Private constructor to prevent instantiation.
     */
    private SmartUriAdapter() {
    }

    private static URI createTypePropertiesUri(final ImmutableMap<RyaURI, ImmutableMap<RyaURI, Property>> typeProperties) throws SmartUriException {
        final List<NameValuePair> nameValuePairs = new ArrayList<>();
        for (final Entry<RyaURI, ImmutableMap<RyaURI, Property>> typeProperty : typeProperties.entrySet()) {
            final RyaURI type = typeProperty.getKey();
            final Map<RyaURI, Property> propertyMap = typeProperty.getValue();
            final URI typeUri = createIndividualTypeWithPropertiesUri(type, propertyMap);
            final String keyString = type.getDataType().getLocalName();
            final String valueString = typeUri.getLocalName();
            nameValuePairs.add(new BasicNameValuePair(keyString, valueString));
        }

        final URIBuilder uriBuilder = new URIBuilder();
        uriBuilder.addParameters(nameValuePairs);

        String uriString;
        try {
            final java.net.URI uri = uriBuilder.build();
            final String queryString = uri.getRawSchemeSpecificPart();
            uriString = "urn:test" + queryString;
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to create type properties for the Smart URI", e);
        }

        return new URIImpl(uriString);
    }

    private static String getShortNameForType(final RyaURI type) throws SmartUriException {
        final String shortName = new URIImpl(type.getData()).getLocalName();
        return shortName;
    }

    private static String addTypePrefixToUri(final String uriString, final String typePrefix) {
        final String localName = new URIImpl(uriString).getLocalName();
        final String beginning = StringUtils.removeEnd(uriString, localName);
        final String formattedUriString = beginning + typePrefix + localName;
        return formattedUriString;
    }

    private static String removeTypePrefixFromUri(final String uriString, final String typePrefix) {
        final String localName = new URIImpl(uriString).getLocalName();
        final String beginning = StringUtils.removeEnd(uriString, localName);
        final String replacement = localName.replaceFirst(typePrefix + ".", "");
        final String formattedUriString = beginning + replacement;
        return formattedUriString;
    }

    private static Map<RyaURI, String> createTypeMap(final List<RyaURI> types) throws SmartUriException {
        final Map<RyaURI, String> map = new LinkedHashMap<>();
        for (final RyaURI type : types) {
            final String shortName = getShortNameForType(type);
            map.put(type, shortName);
        }
        return map;
    }

    private static URI createTypeMapUri(final List<RyaURI> types) throws SmartUriException {
        final List<NameValuePair> nameValuePairs = new ArrayList<>();
        for (final RyaURI type : types) {
            final String shortName = getShortNameForType(type);
            nameValuePairs.add(new BasicNameValuePair(type.getData(), shortName));
        }

        final URIBuilder uriBuilder = new URIBuilder();
        uriBuilder.addParameters(nameValuePairs);

        String uriString;
        try {
            final java.net.URI uri = uriBuilder.build();
            final String queryString = uri.getRawSchemeSpecificPart();
            uriString = ENTITY_TYPE_MAP_URN + queryString;
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to create type properties for the Smart URI", e);
        }

        return new URIImpl(uriString);
    }

    private static Map<RyaURI, String> convertUriToTypeMap(final URI typeMapUri) throws SmartUriException {
        final Map<RyaURI, String> map = new HashMap<>();
        java.net.URI uri;
        try {
            final URIBuilder uriBuilder = new URIBuilder(typeMapUri.stringValue());
            uri = uriBuilder.build();
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to parse Rya type map in Smart URI", e);
        }

        final List<NameValuePair> params = URLEncodedUtils.parse(uri, Charsets.UTF_8.name());

        for (final NameValuePair param : params) {
            final String name = param.getName();
            final String value = param.getValue();
            final RyaURI type = new RyaURI(name);
            map.put(type, value);
        }
        return map;
    }

    private static URI createIndividualTypeWithPropertiesUri(final RyaURI type, final Map<RyaURI, Property> map) throws SmartUriException {
        final List<NameValuePair> nameValuePairs = new ArrayList<>();
        for (final Entry<RyaURI, Property> entry : map.entrySet()) {
            final RyaURI key = entry.getKey();
            final Property property = entry.getValue();

            final RyaType ryaType = property.getValue();
            final String keyString = (new URIImpl(key.getData())).getLocalName();
            final Value value = RyaToRdfConversions.convertValue(ryaType);
            final String valueString = value.stringValue();
            nameValuePairs.add(new BasicNameValuePair(keyString, valueString));
        }

        final URIBuilder uriBuilder = new URIBuilder();
        uriBuilder.addParameters(nameValuePairs);

        String uriString;
        try {
            final java.net.URI uri = uriBuilder.build();
            final String queryString = uri.getRawSchemeSpecificPart();
            uriString = type.getData()/*new URIImpl(type.getData()).getLocalName()*/ + queryString;
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to create type URI with all its properties for the Smart URI", e);
        }

        return new URIImpl(uriString);
    }

    private static Entity convertMapToEntity(final RyaURI subject, final Map<RyaURI, Map<URI, Value>> map) {
        final Entity.Builder entityBuilder = Entity.builder();
        entityBuilder.setSubject(subject);

        for (final Entry<RyaURI, Map<URI, Value>> typeEntry : map.entrySet()) {
            final RyaURI type = typeEntry.getKey();
            final Map<URI, Value> subMap = typeEntry.getValue();
            entityBuilder.setExplicitType(type);
            for (final Entry<URI, Value> entry : subMap.entrySet()) {
                final URI uri = entry.getKey();
                final Value value = entry.getValue();
                final RyaURI ryaUri = new RyaURI(uri.stringValue());
                final RyaURI ryaName = new RyaURI(uri.stringValue());
                final RyaType ryaType = new RyaType(value.stringValue());
                final Property property = new Property(ryaName, ryaType);
                entityBuilder.setProperty(ryaUri, property);
            }
        }
        final Entity entity = entityBuilder.build();
        return entity;
    }

    public static RyaURI findSubject(final URI uri) throws SmartUriException {
        final String uriString = uri.stringValue();
        return findSubject(uriString);
    }

    public static RyaURI findSubject(final String uriString) throws SmartUriException {
        java.net.URI uri;
        try {
            uri = new java.net.URI(uriString);
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Could not find subject in Smart URI", e);
        }
        final RyaURI subject;
        final String fullFragment = uri.getFragment();
        if (fullFragment != null) {
            final int queryPosition = fullFragment.indexOf("?");
            String partialFragment = null;
            if (queryPosition != - 1) {
                partialFragment = fullFragment.substring(0, queryPosition);
            }
            final String subjectString = uri.getScheme() + ":" + uri.getSchemeSpecificPart() + "#" + partialFragment;
            subject = new RyaURI(subjectString);
        } else {
            final int queryPosition = uriString.indexOf("?");
            String subjectString = null;
            if (queryPosition != - 1) {
                subjectString = uriString.substring(0, queryPosition);
            } else {
                subjectString = uriString;
            }
            subject = new RyaURI(subjectString);
        }

        return subject;
    }

    /**
     * Serializes an {@link Entity} into a Smart {@link URI}.
     * @param entity the {@link Entity} to serialize into a Smart URI.
     * @return the Smart {@link URI}.
     * @throws SmartUriException
     */
    public static URI serializeUriEntity(final Entity entity) throws SmartUriException {
        final Map<URI, Value> objectMap = new LinkedHashMap<>();

        // Adds the entity's types to the Smart URI
        final List<RyaURI> typeIds = entity.getExplicitTypeIds();
        final Map<RyaURI, String> ryaTypeMap = createTypeMap(typeIds);
        final URI ryaTypeMapUri = createTypeMapUri(typeIds);
        final RyaType valueRyaType = new RyaType(XMLSchema.ANYURI, ryaTypeMapUri.stringValue());
        final Value typeValue = RyaToRdfConversions.convertValue(valueRyaType);
        objectMap.put(RYA_TYPES_URI, typeValue);

        final RyaURI subject = entity.getSubject();
        final Map<RyaURI, ImmutableMap<RyaURI, Property>> typeMap = entity.getProperties();
        for (final Entry<RyaURI, ImmutableMap<RyaURI, Property>> typeEntry : typeMap.entrySet()) {
            final RyaURI type = typeEntry.getKey();
            String typeShortName = ryaTypeMap.get(type);
            typeShortName = typeShortName != null ? typeShortName + "." : "";
            final ImmutableMap<RyaURI, Property> typeProperties = typeEntry.getValue();
            for (final Entry<RyaURI, Property> properties : typeProperties.entrySet()) {
                final RyaURI key = properties.getKey();
                final Property property = properties.getValue();
                final String valueString = property.getValue().getData();
                final RyaType ryaType = property.getValue();

                //final RyaType ryaType = new RyaType(new URIImpl(key.getData()), valueString);

                final Value value = RyaToRdfConversions.convertValue(ryaType);

                String formattedKey = key.getData();
                if (StringUtils.isNotBlank(typeShortName)) {
                    formattedKey = addTypePrefixToUri(formattedKey, typeShortName);
                }
                final URI uri = new URIImpl(formattedKey);
                objectMap.put(uri, value);
            }
        }

        return serializeUri(subject, objectMap);
    }

    /**
     * Serializes a map into a URI.
     * @param subject the {@link RyaURI} subject of the Entity. Identifies the
     * thing that is being represented as an Entity.
     * @param map the {@link Map} of {@link URI}s to {@link Value}s.
     * @return the Smart {@link URI}.
     * @throws SmartUriException
     */
    public static URI serializeUri(final RyaURI subject, final Map<URI, Value> map) throws SmartUriException {
        final String subjectData = subject.getData();
        final int fragmentPosition = subjectData.indexOf("#");
        String prefix = subjectData;
        String fragment = null;
        if (fragmentPosition > -1) {
            prefix = subjectData.substring(0, fragmentPosition);
            fragment = subjectData.substring(fragmentPosition + 1, subjectData.length());
        }

        URIBuilder uriBuilder = null;
        try {
            if (fragmentPosition > -1) {
                uriBuilder = new URIBuilder(new java.net.URI("urn://" + fragment));
            } else {
                uriBuilder = new URIBuilder(new java.net.URI(subjectData.replaceFirst(":", "://")));
            }
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to serialize a Smart URI from the provided properties", e);
        }
        final List<NameValuePair> nameValuePairs = new ArrayList<>();

        for (final Entry<URI, Value> entry : map.entrySet()) {
            final URI key = entry.getKey();
            final Value value = entry.getValue();
            nameValuePairs.add(new BasicNameValuePair(key.getLocalName(), value.stringValue()));
        }

        uriBuilder.setParameters(nameValuePairs);

        URI uri = null;
        try {
            if (fragmentPosition > -1) {
                final java.net.URI partialUri = uriBuilder.build();
                final String uriString = StringUtils.removeStart(partialUri.getRawSchemeSpecificPart(), "//");
                final URIBuilder fragmentUriBuilder = new URIBuilder(new java.net.URI(prefix));
                fragmentUriBuilder.setFragment(uriString);
                final String fragmentUriString = fragmentUriBuilder.build().toString();
                uri = new URIImpl(fragmentUriString);
            } else {
                final String uriString = uriBuilder.build().toString();
                uri = new URIImpl(uriString);
            }
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Smart URI could not serialize the property map.", e);
        }

        return uri;
    }

    /**
     * Deserializes a URI into a map of URI's to values.
     * @param uri the {@link URI}.
     * @return the {@link Map} of {@link URI}s to {@link Value}s.
     * @throws SmartUriException
     */
    public static Map<URI, Value> deserializeUri(final URI uri) throws SmartUriException {
        final String uriString = uri.stringValue();
        final int fragmentPosition = uriString.indexOf("#");
        String prefix = uriString.substring(0, fragmentPosition + 1);
        if (fragmentPosition == -1) {
            prefix = uriString.split("\\?", 2)[0];
        }
        final String fragment = uriString.substring(fragmentPosition + 1, uriString.length());
        java.net.URI queryUri;

        URIBuilder uriBuilder = null;
        try {
             if (fragmentPosition > -1) {
                 queryUri = new java.net.URI("urn://" + fragment);
             } else {
                 queryUri = new java.net.URI(uriString);
             }
            uriBuilder = new URIBuilder(queryUri);
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to deserialize Smart URI", e);
        }
        final Map<URI, Value> map = new HashMap<>();
        final RyaURI subject = findSubject(uri.stringValue());

        final List<NameValuePair> parameters = uriBuilder.getQueryParams();
        Map<RyaURI, String> entityTypeMap = new LinkedHashMap<>();
        Map<String, RyaURI> invertedEntityTypeMap = new LinkedHashMap<>();
        final Map<RyaURI, Map<URI, Value>> fullMap = new LinkedHashMap<>();
        for (final NameValuePair pair : parameters) {
            final String keyString = pair.getName();
            final String valueString = pair.getValue();

            final URI keyUri = new URIImpl(prefix + keyString);
            final String decoded;
            try {
                decoded = URLDecoder.decode(valueString, Charsets.UTF_8.name());
            } catch (final UnsupportedEncodingException e) {
                throw new SmartUriException("", e);
            }
            final URI type = TypeDeterminer.determineType(decoded);
            if (type == XMLSchema.ANYURI) {
                if (keyString.equals(RYA_TYPES_URI.getLocalName())) {
                    entityTypeMap = convertUriToTypeMap(new URIImpl(decoded));
                    invertedEntityTypeMap = HashBiMap.create(entityTypeMap).inverse();
                }
            } else {
                final int keyPrefixLocation = keyString.indexOf(".");
                final String keyPrefix = keyString.substring(0, keyPrefixLocation);
                final RyaURI keyCorrespondingType = invertedEntityTypeMap.get(keyPrefix);
                final String keyName = keyString.substring(keyPrefixLocation + 1, keyString.length());
                final RyaType ryaType = new RyaType(type, valueString);

                final Value value = RyaToRdfConversions.convertValue(ryaType);

                final String formattedKeyUriString = removeTypePrefixFromUri(keyUri.stringValue(), keyPrefix);
                final URI formattedKeyUri = new URIImpl(formattedKeyUriString);

                map.put(formattedKeyUri, value);
            }
        }
        return map;
    }

    public static Entity deserializeUriEntity(final URI uri) throws SmartUriException {
        final String uriString = uri.stringValue();
        final int fragmentPosition = uriString.indexOf("#");
        String prefix = uriString.substring(0, fragmentPosition + 1);
        if (fragmentPosition == -1) {
            prefix = uriString.split("\\?", 2)[0];
        }
        final String fragment = uriString.substring(fragmentPosition + 1, uriString.length());
        java.net.URI queryUri;

        URIBuilder uriBuilder = null;
        try {
             if (fragmentPosition > -1) {
                 queryUri = new java.net.URI("urn://" + fragment);
             } else {
                 queryUri = new java.net.URI(uriString);
             }
            uriBuilder = new URIBuilder(queryUri);
        } catch (final URISyntaxException e) {
            throw new SmartUriException("Unable to deserialize Smart URI", e);
        }

        final RyaURI subject = findSubject(uri.stringValue());

        final List<NameValuePair> parameters = uriBuilder.getQueryParams();
        Map<RyaURI, String> entityTypeMap = new LinkedHashMap<>();
        Map<String, RyaURI> invertedEntityTypeMap = new LinkedHashMap<>();
        final Map<RyaURI, Map<URI, Value>> fullMap = new LinkedHashMap<>();
        for (final NameValuePair pair : parameters) {
            final String keyString = pair.getName();
            final String valueString = pair.getValue();

            final URI keyUri = new URIImpl(prefix + keyString);
            final String decoded;
            try {
                decoded = URLDecoder.decode(valueString, Charsets.UTF_8.name());
            } catch (final UnsupportedEncodingException e) {
                throw new SmartUriException("", e);
            }
            final URI type = TypeDeterminer.determineType(decoded);
            if (type == XMLSchema.ANYURI) {
                if (keyString.equals(RYA_TYPES_URI.getLocalName())) {
                    entityTypeMap = convertUriToTypeMap(new URIImpl(decoded));
                    invertedEntityTypeMap = HashBiMap.create(entityTypeMap).inverse();
                }
            } else {
                final int keyPrefixLocation = keyString.indexOf(".");
                final String keyPrefix = keyString.substring(0, keyPrefixLocation);
                final RyaURI keyCorrespondingType = invertedEntityTypeMap.get(keyPrefix);
                final String keyName = keyString.substring(keyPrefixLocation + 1, keyString.length());
                final RyaType ryaType = new RyaType(type, valueString);

                final Value value = RyaToRdfConversions.convertValue(ryaType);

                final String formattedKeyUriString = removeTypePrefixFromUri(keyUri.stringValue(), keyPrefix);
                final URI formattedKeyUri = new URIImpl(formattedKeyUriString);
                final Map<URI, Value> map = fullMap.get(keyCorrespondingType);

                if (map == null) {
                    final Map<URI, Value> subMap = new HashMap<>();
                    subMap.put(formattedKeyUri, value);
                    fullMap.put(keyCorrespondingType, subMap);
                } else {
                    map.put(formattedKeyUri, value);
                    fullMap.put(keyCorrespondingType, map);
                }
            }
        }
        final Entity entity = convertMapToEntity(subject, fullMap);
        return entity;
    }

    private static final class TypeDeterminer {
        /**
         * Private constructor to prevent instantiation.
         */
        private TypeDeterminer() {
        }

        private static URI determineType(final String data) {
            if (Ints.tryParse(data) != null) {
                return XMLSchema.INTEGER;
            } else if (Doubles.tryParse(data) != null) {
                return XMLSchema.DOUBLE;
            } else if (Floats.tryParse(data) != null) {
                return XMLSchema.FLOAT;
            } else if (isShort(data)) {
                return XMLSchema.SHORT;
            } else if (Longs.tryParse(data) != null) {
                return XMLSchema.LONG;
            } if (Boolean.parseBoolean(data)) {
                return XMLSchema.BOOLEAN;
            } else if (isByte(data)) {
                return XMLSchema.BYTE;
            } else if (isDate(data)) {
                return XMLSchema.DATETIME;
            } else if (isUri(data)) {
                return XMLSchema.ANYURI;
            }

            return XMLSchema.STRING;
        }

        private static boolean isDate(final String data) {
            try {
                DateTime.parse(data, ISODateTimeFormat.dateTimeParser());
                return true;
            } catch (final IllegalArgumentException e) {
                // not a date
                return false;
            }
        }

        private static boolean isShort(final String data) {
            try {
                Short.parseShort(data);
                return true;
            } catch (final NumberFormatException e) {
                // not a short
                return false;
            }
        }

        private static boolean isByte(final String data) {
            try {
                Byte.parseByte(data);
                return true;
            } catch (final NumberFormatException e) {
                // not a byte
                return false;
            }
        }

        private static boolean isUri(final String data) {
            try {
                final String decoded = URLDecoder.decode(data, Charsets.UTF_8.name());
                new URIImpl(decoded);
                return true;
            } catch (final IllegalArgumentException | UnsupportedEncodingException e) {
                // not a URI
                return false;
            }
        }
    }

    public static Map<URI, Value> entityToValueMap(final Entity entity) {
        final Map<URI, Value> map = new LinkedHashMap<>();
        for (final Entry<RyaURI, ImmutableMap<RyaURI, Property>> entry : entity.getProperties().entrySet()) {
            for (final Entry<RyaURI, Property> property : entry.getValue().entrySet()) {
                final RyaURI propertyKey = property.getKey();
                final URI uri = new URIImpl(propertyKey.getData());
                final Property propertyValue = property.getValue();
                final Value value = RyaToRdfConversions.convertValue(propertyValue.getValue());
                map.put(uri, value);
            }
        }
        return map;
    }

    /**
     * Converts a {@link Map} of {@link URI}/{@link Value}s to a {@link Set} of
     * {@link Property}s.
     * @param map the {@link Map} of {@link URI}/{@link Value}.
     * @return the {@link Set} of {@link Property}s.
     */
    public static Set<Property> mapToProperties(final Map<URI, Value> map) {
        final Set<Property> properties = new LinkedHashSet<>();
        for (final Entry<URI, Value> entry : map.entrySet()) {
            final URI uri = entry.getKey();
            final Value value = entry.getValue();

            final RyaURI ryaUri = new RyaURI(uri.stringValue());
            final RyaType ryaType = RdfToRyaConversions.convertValue(value);

            final Property property = new Property(ryaUri, ryaType);
            properties.add(property);
        }
        return properties;
    }

    public static Map<URI, Value> propertiesToMap(final Set<Property> properties) {
        final Map<URI, Value> map = new LinkedHashMap<>();
        for (final Property property : properties) {
            final URI uri = new URIImpl(property.getName().getData());
            final Value value = RyaToRdfConversions.convertValue(property.getValue());
            map.put(uri, value);
        }
        return map;
    }
}


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) Sulu GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\FormBundle\Dynamic\Types;

use Sulu\Bundle\FormBundle\Dynamic\FormFieldTypeConfiguration;
use Sulu\Bundle\FormBundle\Dynamic\FormFieldTypeInterface;
use Sulu\Bundle\FormBundle\Entity\FormField;
use Symfony\Component\Form\Extension\Core\Type\CountryType as TypeCountryType;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * The Country form field type.
 */
class CountryType implements FormFieldTypeInterface
{
    use SimpleTypeTrait;

    public function getConfiguration(): FormFieldTypeConfiguration
    {
        return new FormFieldTypeConfiguration(
            'sulu_form.type.country',
            __DIR__ . '/../../Resources/config/form-fields/field_example_default.xml'
        );
    }

    public function build(FormBuilderInterface $builder, FormField $field, string $locale, array $options): void
    {
        if (isset($options['attr']['placeholder'])) {
            $options['placeholder'] = $options['attr']['placeholder'];
            unset($options['attr']['placeholder']);
        }

        $type = TypeCountryType::class;
        $builder->add($field->getKey(), $type, $options);
    }
}


text:
/* $Id: AFPBridgeContext.java 1099829 2011-05-05 14:49:27Z jeremias $ */

package org.apache.fop.afp.svg;

import java.awt.geom.AffineTransform;

import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.DocumentLoader;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.gvt.TextPainter;

import org.apache.xmlgraphics.image.loader.ImageManager;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;

import org.apache.fop.afp.AFPGraphics2D;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.svg.AbstractFOPBridgeContext;

/**
 * An AFP specific implementation of a Batik BridgeContext
 */
public class AFPBridgeContext extends AbstractFOPBridgeContext {

    private final AFPGraphics2D g2d;

    /**
     * Constructs a new bridge context.
     *
     * @param userAgent the user agent
     * @param fontInfo the font list for the text painter, may be null
     *                 in which case text is painted as shapes
     * @param imageManager an image manager
     * @param imageSessionContext an image session context
     * @param linkTransform AffineTransform to properly place links,
     *                      may be null
     * @param g2d an AFPGraphics 2D implementation
     */
    public AFPBridgeContext(UserAgent userAgent, FontInfo fontInfo,
            ImageManager imageManager, ImageSessionContext imageSessionContext,
            AffineTransform linkTransform, AFPGraphics2D g2d) {
        super(userAgent, fontInfo, imageManager, imageSessionContext, linkTransform);
        this.g2d = g2d;
    }

    /**
     * Constructs a new bridge context.
     * @param userAgent the user agent
     * @param documentLoader the Document Loader to use for referenced documents.
     * @param fontInfo the font list for the text painter, may be null
     *                 in which case text is painted as shapes
     * @param imageManager an image manager
     * @param imageSessionContext an image session context
     * @param linkTransform AffineTransform to properly place links,
     *                      may be null
     * @param g2d an AFPGraphics 2D implementation
     */
    public AFPBridgeContext(UserAgent userAgent, DocumentLoader documentLoader,
            FontInfo fontInfo, ImageManager imageManager,
            ImageSessionContext imageSessionContext,
            AffineTransform linkTransform, AFPGraphics2D g2d) {
        super(userAgent, documentLoader, fontInfo, imageManager,
              imageSessionContext, linkTransform);
        this.g2d = g2d;
    }

    /** {@inheritDoc} */
    @Override
    public void registerSVGBridges() {
        super.registerSVGBridges();

        if (fontInfo != null) {
            AFPTextHandler textHandler = new AFPTextHandler(fontInfo, g2d.getResourceManager());
            g2d.setCustomTextHandler(textHandler);

            TextPainter textPainter = new AFPTextPainter(textHandler);
            setTextPainter(textPainter);

            putBridge(new AFPTextElementBridge(textPainter));
        }

        putBridge(new AFPImageElementBridge());
    }

    /** {@inheritDoc} */
    @Override
    public BridgeContext createBridgeContext() {
        return new AFPBridgeContext(getUserAgent(), getDocumentLoader(),
                fontInfo,
                getImageManager(),
                getImageSessionContext(),
                linkTransform, g2d);
    }

}


text:
from menus.base import Menu
from django.core.exceptions import ValidationError

class CMSAttachMenu(Menu):
    cms_enabled = True
    name = None

    def __init__(self, *args, **kwargs):
        super(CMSAttachMenu, self).__init__(*args, **kwargs)
        if self.cms_enabled and not self.name:
            raise ValidationError("the menu %s is a CMSAttachMenu but has no name defined!" % self.__class__.__name__)


text:
all:
	rm -rf ../files/*
	rm -f *.png
	curl -f -O https://www.google.de/images/srpr/logo11w.png
	curl -f -X GET http://localhost:8080/
	curl -f -X POST --data-binary @logo11w.png http://localhost:8080/foo/logo.png
	curl -f -X GET http://localhost:8080/
	curl -f -X GET http://localhost:8080/foo/
	curl -f -X GET http://localhost:8080/foo/logo.png > get_logo.png
	curl -f -X PUT --data-binary @logo11w.png http://localhost:8080/foo/logo.png
	curl -f -X DELETE http://localhost:8080/foo/logo.png
	curl -f -X GET http://localhost:8080/foo/


text:
<?php

class Moraso_Plugin_Revisionprogression_Article_Controller extends Moraso_Adm_Plugin_Controller {

    const ID = '4df8d3e8-f820-4dde-8a41-129a7f000101';

    public function init() {

        header("Content-type: text/javascript");
        $this->_helper->layout->disableLayout();
    }

    public static function register($idart) {

        return (object) array(
                    'name' => 'revisionprogression',
                    'tabname' => Aitsu_Registry :: get()->Zend_Translate->translate('Revision Progression'),
                    'enabled' => self :: getPosition($idart, 'revisionprogression'),
                    'position' => self :: getPosition($idart, 'revisionprogression'),
                    'id' => self :: ID
        );
    }

    public function indexAction() {

        $this->view->idart = $this->getRequest()->getParam('idart');
        $this->view->idartlang = Moraso_Util::getIdArtLang($this->view->idart, AItsu_Registry::get()->session->currentLanguage);
    }

    public function storeAction() {

        $idart = $this->getRequest()->getParam('idart');

        $publications = Aitsu_Db :: fetchAll("
		            SELECT
		                `pub`.`pubid`,
		                `pub`.`idartlang`,
		                `pub`.`pubtime`,
		                `pub`.`status` AS `isPublished`,
		                concat(`user`.`lastname`, ', ', `user`.`firstname`) AS `user`
		            FROM
		                `_pub` as `pub`
		            RIGHT JOIN
		                `_acl_user` AS `user` ON `pub`.`userid` = `user`.`userid`
		            WHERE
		                `pub`.`idartlang` =:idartlang
		            ORDER BY
		                `pub`.`pubid` DESC", array(
                    ':idartlang' => Aitsu_Util :: getIdArtLang($idart, Aitsu_Registry :: get()->session->currentLanguage)
        ));

        $data = array();
        if ($publications) {
            foreach ($publications as $publication) {
                $publication['isEdit'] = self :: isEdit($publication['idartlang'], $publication['pubid']);
                $data[] = (object) $publication;
            }
        }

        $this->_helper->json((object) array(
                    'data' => $data
        ));
    }

    public static function isEdit($idartlang, $pubid) {

        $isPublished = Aitsu_Db :: fetchOne('' .
                        'select count(*) ' .
                        'from _art_lang as artlang, _pub as pub ' .
                        'where artlang.idartlang = pub.idartlang ' .
                        'and artlang.lastmodified = pub.pubtime ' .
                        'and pub.pubid = :pubid ' .
                        'and artlang.idartlang = :idartlang', array(
                    ':pubid' => $pubid,
                    ':idartlang' => $idartlang
        ));

        if ($isPublished > 0) {
            return true;
        }

        return false;
    }

    public function activateAction() {

        try {
            $idart = $this->getRequest()->getParam('idart');
            $pubid = $this->getRequest()->getParam('pubid');

            Aitsu_Persistence_Article :: factory($idart)->rebuild($pubid);
        } catch (Exception $e) {
            $this->_helper->json((object) array(
                        'success' => false
            ));
        }

        $this->_helper->json((object) array(
                    'success' => true
        ));
    }

    public function publishAction() {

        $idartlang = $this->getRequest()->getParam('idartlang');
        $pubid = $this->getRequest()->getParam('pubid');

        $idart = Aitsu_Util :: getIdArt($idartlang);

        Aitsu_Db :: startTransaction();

        try {

            $article = Aitsu_Persistence_Article :: factory($idart)->load();

            Aitsu_Db :: query('' .
                    'update _pub set status = 0 where idartlang = :idartlang and status = 1', array(
                ':idartlang' => $idartlang
            ));

            Aitsu_Db :: query('' .
                    'update _pub set status = 1 where pubid = :pubid', array(
                ':pubid' => $pubid
            ));

            $publishMap = new Zend_Config_Ini(APPLICATION_PATH . '/configs/publishmap.ini');

            foreach ($publishMap as $type => $tables) {
                foreach ($tables->toArray() as $table) {
                    $marker = $table['marker'];

                    Aitsu_Db :: query('' .
                            'update ' . $table['target'] . ' set ' .
                            'status = 0 ' .
                            'where ' . $marker . ' = :marker ' .
                            'and status = 1', array(
                        ':marker' => $article->$marker
                    ));

                    Aitsu_Db :: query('' .
                            'update ' . $table['target'] . ' set ' .
                            'status = 1 ' .
                            'where pubid = :pubid', array(
                        ':pubid' => $pubid
                    ));
                }
            }

            Aitsu_Cache :: getInstance()->clean(array(
                'art_' . $article->idart
            ));

            Aitsu_Db :: commit();
        } catch (Exception $e) {
            Aitsu_Db :: rollback();
            $this->_helper->json((object) array(
                        'success' => false
            ));
        }

        $this->_helper->json((object) array(
                    'success' => true
        ));
    }

    public function deleterevisionsAction() {

        $idartlang = $this->getRequest()->getParam('idartlang');

        Aitsu_Db :: startTransaction();

        try {

            Aitsu_Db :: query('' .
                    'delete from _pub ' .
                    'where status = -1 ' .
                    'and idartlang = :idartlang', array(
                ':idartlang' => $idartlang
            ));

            Aitsu_Db :: commit();
        } catch (Exception $e) {
            Aitsu_Db :: rollback();
            $this->_helper->json((object) array(
                        'success' => false
            ));
        }

        $this->_helper->json((object) array(
                    'success' => true
        ));
    }

}


text:
<?php
/**
 * Dummy object caching.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @ingroup Cache
 */

/**
 * A BagOStuff object with no objects in it. Used to provide a no-op object to calling code.
 *
 * @ingroup Cache
 */
class EmptyBagOStuff extends BagOStuff {
	public function get( $key, &$casToken = null ) {
		return false;
	}

	public function set( $key, $value, $exp = 0 ) {
		return true;
	}

	public function delete( $key ) {
		return true;
	}

	public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
		return true; // faster
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>SourceFileConstants xref</title>
<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />

View Javadoc

1   package net.sourceforge.pmd;
2
3   /**
4    * Constants used when handling names of source files.
5    *
6    * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
7    */
8   public class SourceFileConstants {
9
10      public static final String JAVA_EXTENSION_UPPERCASE = "JAVA";
11      public static final String JSP_EXTENSION_UPPERCASE = "JSP";
12      public static final String JSPX_EXTENSION_UPPERCASE = "JSPX";
13
14  }

This page was automatically generated by Maven


text:
using System;
using System.Collections.Generic;
using System.Linq;
using MorePlanning.Plan;
using MorePlanning.Utility;
using RimWorld;
using UnityEngine;
using Verse;

namespace MorePlanning.Designators
{
    public class CopyDesignator : BaseDesignator
    {

        public override int DraggableDimensions => 2;

        public override bool DragDrawMeasurements => true;

        public CopyDesignator() :
            base("MorePlanning.PlanCopy".Translate(), "MorePlanning.PlanCopyDesc".Translate())
        {
            icon = ContentFinder<Texture2D>.Get("UI/PlanCopy");
        }

        public override AcceptanceReport CanDesignateCell(IntVec3 c)
        {
            if (!c.InBounds(Map))
            {
                return false;
            }
            if (c.InNoBuildEdgeArea(Map))
            {
                return "TooCloseToMapEdge".Translate();
            }
            return MapUtility.HasAnyPlanDesignationAt(c, Map);
        }

        public override void RenderHighlight(List<IntVec3> dragCells)
        {
            DesignatorUtility.RenderHighlightOverSelectableCells(this, dragCells);
        }

        public override void DesignateMultiCell(IEnumerable<IntVec3> cells)
        {
            var planDesignations = cells.Select(cell => MapUtility.GetPlanDesignationAt(cell, Map)).Where(designation => designation != null).ToList();
            cells = planDesignations.Select(plan => plan.target.Cell);

            if (planDesignations.Count == 0)
            {
                Messages.Message("MorePlanning.MissingPlanningDesignations".Translate(), MessageTypeDefOf.RejectInput);
                return;
            }

            int left = cells.Min(cell => cell.x);
            int top = cells.Max(cell => cell.z);
            int right = cells.Max(cell => cell.x);
            int bottom = cells.Min(cell => cell.z);

            IntVec2 mousePos = new IntVec2((int) Math.Floor(UI.MouseMapPosition().x), (int) Math.Floor(UI.MouseMapPosition().z));

            // Adjust mouse position to nearest planning designation
            if (mousePos.x < left)
            {
                mousePos.x = left;
            }
            else if (mousePos.x > left)
            {
                mousePos.x = right;
            }

            if (mousePos.z > top)
            {
                mousePos.z = top;
            }
            else if (mousePos.z < bottom)
            {
                mousePos.z = bottom;
            }

            int sizeCompX = mousePos.x;
            int sizeCompZ = mousePos.z;

            List<PlanInfo> planDesignationInfo = new List<PlanInfo>();

            // Copy all data from designations
            foreach (var planDesignation in planDesignations)
            {
                var moddedPlanDesignation = planDesignation as PlanDesignation;

                var planInfo = new PlanInfo
                {
                    Color = moddedPlanDesignation != null ? moddedPlanDesignation.Color : 0,
                    Pos = new IntVec3(planDesignation.target.Cell.x - sizeCompX, planDesignation.target.Cell.y, planDesignation.target.Cell.z - sizeCompZ)
                };
                planDesignationInfo.Add(planInfo);
            }

            var planCopy = new PlanInfoSet(planDesignationInfo);

            PasteDesignator.CurrentPlanCopy = planCopy;
            Finalize(true);

            var designatorPlanPaste = MenuUtility.GetPlanningDesignator<PasteDesignator>();
            Find.DesignatorManager.Select(designatorPlanPaste);
        }

    }
}


text:
package com.amazonaws.services.waf.model.transform;

import static com.amazonaws.util.StringUtils.UTF8;
import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.regex.Pattern;

import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.waf.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;

/**
 * UpdateIPSetRequest Marshaller
 */
public class UpdateIPSetRequestMarshaller implements
        Marshaller<Request<UpdateIPSetRequest>, UpdateIPSetRequest> {

    public Request<UpdateIPSetRequest> marshall(
            UpdateIPSetRequest updateIPSetRequest) {

        if (updateIPSetRequest == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        Request<UpdateIPSetRequest> request = new DefaultRequest<UpdateIPSetRequest>(
                updateIPSetRequest, "AWSWAF");
        request.addHeader("X-Amz-Target", "AWSWAF_20150824.UpdateIPSet");

        request.setHttpMethod(HttpMethodName.POST);

        request.setResourcePath("");

        try {
            final SdkJsonGenerator jsonGenerator = new SdkJsonGenerator();

            jsonGenerator.writeStartObject();

            if (updateIPSetRequest.getIPSetId() != null) {
                jsonGenerator.writeFieldName("IPSetId").writeValue(
                        updateIPSetRequest.getIPSetId());
            }
            if (updateIPSetRequest.getChangeToken() != null) {
                jsonGenerator.writeFieldName("ChangeToken").writeValue(
                        updateIPSetRequest.getChangeToken());
            }

            java.util.List<IPSetUpdate> updatesList = updateIPSetRequest
                    .getUpdates();
            if (updatesList != null) {
                jsonGenerator.writeFieldName("Updates");
                jsonGenerator.writeStartArray();
                for (IPSetUpdate updatesListValue : updatesList) {
                    if (updatesListValue != null) {

                        IPSetUpdateJsonMarshaller.getInstance().marshall(
                                updatesListValue, jsonGenerator);
                    }
                }
                jsonGenerator.writeEndArray();
            }

            jsonGenerator.writeEndObject();

            byte[] content = jsonGenerator.getBytes();
            request.setContent(new ByteArrayInputStream(content));
            request.addHeader("Content-Length",
                    Integer.toString(content.length));
            request.addHeader("Content-Type", "application/x-amz-json-1.1");
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }

        return request;
    }

}


text:
namespace Boxed.AspNetCore.TagHelpers.OpenGraph
{
    /// <summary>
    /// <see cref="OpenGraphMusicReleaseType"/> extension methods.
    /// </summary>
    internal static class OpenGraphMusicReleaseTypeExtensions
    {
        /// <summary>
        /// Returns the lower-case <see cref="string" /> representation of the <see cref="OpenGraphMusicReleaseType" />.
        /// </summary>
        /// <param name="musicReleaseType">Type of the music release.</param>
        /// <returns>
        /// The lower-case <see cref="string" /> representation of the <see cref="OpenGraphMusicReleaseType" />.
        /// </returns>
        public static string ToLowercaseString(this OpenGraphMusicReleaseType musicReleaseType)
        {
            switch (musicReleaseType)
            {
                case OpenGraphMusicReleaseType.OriginalRelease:
                    return "original_release";
                case OpenGraphMusicReleaseType.ReRelease:
                    return "re_release";
                case OpenGraphMusicReleaseType.Anthology:
                    return "anthology";
                default:
                    return string.Empty;
            }
        }
    }
}