text:
FROM scratch
MAINTAINER AOSC-dev
ADD "aosc-os_container_20161202.tar.xz" /
CMD ["/bin/bash"]
ARG CONT_IMG_VER
ENV CONT_IMG_VER 20161202


text:
package apple.corebluetooth;

import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.foundation.NSUUID;
import apple.foundation.protocol.NSCopying;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.MappedReturn;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;

@Generated
@Library("CoreBluetooth")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class CBPeer extends NSObject implements NSCopying {
    static {
        NatJ.register();
    }

    @Generated
    protected CBPeer(Pointer peer) {
        super(peer);
    }

    @Generated
    @Selector("accessInstanceVariablesDirectly")
    public static native boolean accessInstanceVariablesDirectly();

    @Generated
    @Owned
    @Selector("alloc")
    public static native CBPeer alloc();

    @Owned
    @Generated
    @Selector("allocWithZone:")
    public static native CBPeer allocWithZone(VoidPtr zone);

    @Generated
    @Selector("automaticallyNotifiesObserversForKey:")
    public static native boolean automaticallyNotifiesObserversForKey(String key);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:")
    public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
    public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
            @Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
            @Mapped(ObjCObjectMapper.class) Object anArgument);

    @Generated
    @Selector("classFallbacksForKeyedArchiver")
    public static native NSArray<String> classFallbacksForKeyedArchiver();

    @Generated
    @Selector("classForKeyedUnarchiver")
    public static native Class classForKeyedUnarchiver();

    @Generated
    @Selector("debugDescription")
    public static native String debugDescription_static();

    @Generated
    @Selector("description")
    public static native String description_static();

    @Generated
    @Selector("hash")
    @NUInt
    public static native long hash_static();

    @Generated
    @Selector("instanceMethodForSelector:")
    @FunctionPtr(name = "call_instanceMethodForSelector_ret")
    public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);

    @Generated
    @Selector("instanceMethodSignatureForSelector:")
    public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);

    @Generated
    @Selector("instancesRespondToSelector:")
    public static native boolean instancesRespondToSelector(SEL aSelector);

    @Generated
    @Selector("isSubclassOfClass:")
    public static native boolean isSubclassOfClass(Class aClass);

    @Generated
    @Selector("keyPathsForValuesAffectingValueForKey:")
    public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);

    @Generated
    @Owned
    @Selector("new")
    public static native CBPeer new_objc();

    @Generated
    @Selector("resolveClassMethod:")
    public static native boolean resolveClassMethod(SEL sel);

    @Generated
    @Selector("resolveInstanceMethod:")
    public static native boolean resolveInstanceMethod(SEL sel);

    @Generated
    @Selector("setVersion:")
    public static native void setVersion_static(@NInt long aVersion);

    @Generated
    @Selector("superclass")
    public static native Class superclass_static();

    @Generated
    @Selector("version")
    @NInt
    public static native long version_static();

    @Generated
    @Owned
    @Selector("copyWithZone:")
    @MappedReturn(ObjCObjectMapper.class)
    public native Object copyWithZone(VoidPtr zone);

    /**
     * [@property] identifier
     * <p>
     * The unique, persistent identifier associated with the peer.
     */
    @Generated
    @Selector("identifier")
    public native NSUUID identifier();

    @Generated
    @Selector("init")
    public native CBPeer init();
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.drill.exec.server.rest;

import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.StringUtils;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.server.rest.auth.AuthDynamicFeature;
import org.apache.drill.exec.server.rest.auth.DrillHttpSecurityHandlerProvider;
import org.apache.drill.exec.work.WorkManager;
import org.eclipse.jetty.security.authentication.FormAuthenticator;
import org.eclipse.jetty.util.security.Constraint;
import org.glassfish.jersey.server.mvc.Viewable;

import javax.annotation.security.PermitAll;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.net.URLDecoder;
import java.util.Set;

@Path(WebServerConstants.WEBSERVER_ROOT_PATH)
@PermitAll
public class LogInLogOutResources {

  @Inject
  WorkManager workManager;

  /**
   * Update the destination URI to be redirect URI if specified in the request URL so that after the login is
   * successful, request is forwarded to redirect page.
   *
   * @param redirect - Redirect parameter in the request URI
   * @param request  - Http Servlet Request
   * @throws Exception
   */
  private void updateSessionRedirectInfo(String redirect, HttpServletRequest request) throws Exception {
    if (!StringUtils.isEmpty(redirect)) {
      // If the URL has redirect in it, set the redirect URI in session, so that after the login is successful, request
      // is forwarded to the redirect page.
      final HttpSession session = request.getSession(true);
      final URI destURI = UriBuilder.fromUri(URLDecoder.decode(redirect, "UTF-8")).build();
      session.setAttribute(FormAuthenticator.__J_URI, destURI.toString());
    }
  }

  @GET
  @Path(WebServerConstants.FORM_LOGIN_RESOURCE_PATH)
  @Produces(MediaType.TEXT_HTML)
  public Viewable getLoginPage(@Context HttpServletRequest request, @Context HttpServletResponse response,
                               @Context SecurityContext sc, @Context UriInfo uriInfo,
                               @QueryParam(WebServerConstants.REDIRECT_QUERY_PARM) String redirect) throws Exception {

    if (AuthDynamicFeature.isUserLoggedIn(sc)) {
      // if the user is already login, forward the request to homepage.
      request.getRequestDispatcher(WebServerConstants.WEBSERVER_ROOT_PATH).forward(request, response);
      return null;
    }

    updateSessionRedirectInfo(redirect, request);
    return ViewableWithPermissions.createLoginPage(null);
  }

  @GET
  @Path(WebServerConstants.SPENGO_LOGIN_RESOURCE_PATH)
  @Produces(MediaType.TEXT_HTML)
  public Viewable getSpnegoLogin(@Context HttpServletRequest request, @Context HttpServletResponse response,
                                 @Context SecurityContext sc, @Context UriInfo uriInfo,
                                 @QueryParam(WebServerConstants.REDIRECT_QUERY_PARM) String redirect) throws Exception {
    if (AuthDynamicFeature.isUserLoggedIn(sc)) {
      request.getRequestDispatcher(WebServerConstants.WEBSERVER_ROOT_PATH).forward(request, response);
      return null;
    }

    final String errorString = "Invalid SPNEGO credentials or SPNEGO is not configured";
    final MainLoginPageModel model = new MainLoginPageModel(errorString);
    return ViewableWithPermissions.createMainLoginPage(model);
  }

  // Request type is POST because POST request which contains the login credentials are invalid and the request is
  // dispatched here directly.
  @POST
  @Path(WebServerConstants.FORM_LOGIN_RESOURCE_PATH)
  @Produces(MediaType.TEXT_HTML)
  public Viewable getLoginPageAfterValidationError() {
    return ViewableWithPermissions.createLoginPage("Invalid username/password credentials.");
  }

  @GET
  @Path(WebServerConstants.LOGOUT_RESOURCE_PATH)
  public void logout(@Context HttpServletRequest req, @Context HttpServletResponse resp) throws Exception {
    final HttpSession session = req.getSession();
    if (session != null) {
      session.invalidate();
    }

    req.getRequestDispatcher(WebServerConstants.WEBSERVER_ROOT_PATH).forward(req, resp);
  }

  @GET
  @Path(WebServerConstants.MAIN_LOGIN_RESOURCE_PATH)
  @Produces(MediaType.TEXT_HTML)
  public Viewable getMainLoginPage(@Context HttpServletRequest request, @Context HttpServletResponse response,
                                   @Context SecurityContext sc, @Context UriInfo uriInfo,
                                   @QueryParam(WebServerConstants.REDIRECT_QUERY_PARM) String redirect) throws Exception {
    updateSessionRedirectInfo(redirect, request);
    final MainLoginPageModel model = new MainLoginPageModel(null);
    return ViewableWithPermissions.createMainLoginPage(model);
  }

  /**
   * This class should be public for it's method's to be accessible by mainLogin.ftl file
   */
  @VisibleForTesting
  public class MainLoginPageModel {

    private final String error;

    private final boolean authEnabled;

    private final Set<String> configuredMechs;

    MainLoginPageModel(String error) {
      this.error = error;
      final DrillConfig config = workManager.getContext().getConfig();
      authEnabled = config.getBoolean(ExecConstants.USER_AUTHENTICATION_ENABLED);
      configuredMechs = DrillHttpSecurityHandlerProvider.getHttpAuthMechanisms(config);
    }

    public boolean isSpnegoEnabled() {
      return authEnabled && configuredMechs.contains(Constraint.__SPNEGO_AUTH);
    }

    public boolean isFormEnabled() {
      return authEnabled && configuredMechs.contains(Constraint.__FORM_AUTH);
    }

    public String getError() {
      return error;
    }
  }
}


text:
<?php
/**
 * The template for displaying posts in the Quote post format.
 *
 * @package Sugar & Spice
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

		<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
			<?php the_post_thumbnail(); ?>
		<?php endif; ?>

			<?php story_posted_on(); ?>

			<?php the_content( __( 'Continue reading →', 'story' ) ); ?>


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableServergroups extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('servergroups', function (Blueprint $table) {
            $table->increments('id');
            $table->string('servergroup_name');
            $table->integer('platform_id')->references('id')->on('platforms');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('servergroups');
    }
}


text:
import * as React from "react";

import { OverlayContainer, Overlay, Alignment, AlignType } from "./overlay";

export interface AppState {
    visible: boolean;
    alignment?: Alignment;
}

export default class App extends React.Component<{}, AppState> {

    constructor(props: {}) {
        super(props);

        this.state = {
            visible: false,
            alignment: {
                target: {
                    horizontal: AlignType.Left,
                    vertical: AlignType.Bottom
                },
                overlay: {
                    horizontal: AlignType.Left,
                    vertical: AlignType.Top
                }
            }
        };
    }

    public render() {
        return (
            <OverlayContainer>

 this.setState({ visible: true })}>
                    Lorem ipsum dolor sit amet, consectetur adipisicing elit.
                    At ea expedita modi quis, ullam voluptatem?
                    Ab alias aperiam dolor doloribus, explicabo fugit,
                    ipsa ipsum laboriosam laudantium, minima optio quod sint?

                <Overlay
                    visible={this.state.visible}
                    onClickOutside={(clickedOnContainer) => this.setState({ visible: clickedOnContainer })}
                    alignment={this.state.alignment}
                >
                    {
                        (left: string, top: string) =>

                                Lorem ipsum dolor sit.

                    }
                </Overlay>
            </OverlayContainer>
        );
    }
}


text:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{data.header_layout} != 100">
    <f:if condition="{data.header} || {data.subheader} || {data.date}">
        <header class="frame-header">
            <f:render partial="Header/Header" arguments="{
                header: data.header,
                layout: data.header_layout,
                class: settings.header.class,
                positionClass: '{f:if(condition: data.header_position, then: \'text-{data.header_position}\')}',
                link: data.header_link,
                default: settings.header.defaultHeaderType}" />
            <f:render partial="Header/SubHeader" arguments="{
                subheader: data.subheader,
                layout: data.header_layout,
                class: settings.subheader.class,
                positionClass: '{f:if(condition: data.header_position, then: \'text-{data.header_position}\')}',
                default: settings.header.defaultHeaderType}" />
            <f:render partial="Header/Date" arguments="{
                date: data.date,
                positionClass: '{f:if(condition: data.header_position, then: \'text-{data.header_position}\')}'}" />
        </header>
    </f:if>
</f:if>
</html>


text:
<?php
namespace pdt256\article\ReusableCode;

class UserPasswordValidatorTest extends \PHPUnit_Framework_TestCase
{
    public function testPasswordHasValidLength()
    {
        $this->assertTrue($this->isValid('12345678'));
        $this->assertFalse($this->isValid('1234567'));
    }

    public function testPasswordCannotContainUsersName()
    {
        $this->assertTrue($this->isValid('^YUZ#*wFPys?k8eN'));
        $this->assertFalse($this->isValid('---john---'));
        $this->assertFalse($this->isValid('---doe----'));
    }

    private function isValid($password)
    {
        $user = new User('John', 'Doe');
        $userPasswordValidator = new UserPasswordValidator;

        try {
            $userPasswordValidator->assertPasswordValid($user, $password);
            return true;
        } catch (UserPasswordValidationException $e) {
            return false;
        }
    }
}


text:
/* file: security-rate-limit-all.js */
/*!
 * Copyright 2017 ikarus512
 * https://github.com/ikarus512/fcc1.git
 *
 * DESCRIPTION: Security Login Rate Limit
 * AUTHOR: ikarus512
 * CREATED: 2017/03/13
 *
 * MODIFICATION HISTORY
 *  2017/04/04, ikarus512. Added copyright header.
 *
 */

/*jshint node: true*/
'use strict';

var
    APPCONST = require('./../config/constants.js'),
    RateLimit = require('express-rate-limit');

var limiter =

    (APPCONST.env.NODE_ENV === 'production') ?

    // Here if production:
    // istanbul ignore next
    new RateLimit({
        windowMs: 15 * 60 * 1000, // 15 minutes
        max: 100, // limit each IP to 5 requests per windowMs
        delayMs: 0, // disable delaying - full speed until the max limit is reached
        keyGenerator: function(req) { return req.ip; } // IP-related limit
    })

    :

    // Here if test env:
    // istanbul ignore next
    function(err, req, res, next) {
        return next(err);
    };

module.exports = limiter;


text:
In this article I give you 5 questions I feel that you should be asking your development team.

During this article I use a Word document as an analogy for a software project. I wanted to keep the technobabble to a minimum and a Word document should be a fairly universal concept to all. It is a huge over simplification, but the principals hold true.

## Do you have a copy of the document from 3 months ago?
Your development team will be working on one or many Word documents over a prolonged period. This could be weeks, month, years and in some cases even decades.

So image multiple developers making changes to your Word document over the course of twelve months. They add a paragraph or fifty, they reorder the chapters, change some titles, fix a whole bunch of spelling and grammatical errors and remove extraneous content.

You later come to the document and find that someone has removed the all-important price list – possibly the most important part of the document (for you anyway). You remember it being there two months ago when you last needed it – but now it's gone.

The price list was months of painstaking work from all involved and something you'd dearly not want to start again from scratch – plus you've just promised it to you biggest customer.

This is where hopefully your development team say "no problem, we'll get the old version out of source control".

Think of Source Control as a curator and guardian of every different version of your Work documents.

Let's imagine Betty (I'm sure why I've chosen that name – I'm sure that it says something deeply psychological about me that I'd rather not think about). Her job is to take a copy of every version of the document as it is changed. Each developer will go to Betty at the end of the day (or as needed) with their updated document(s), Betty will then file that change in her collection of filing cabinets along with a note of which developer passed it to her. If Betty is really good at her job (which she is) she will also insist that the developer tell her why the change was made.

At any time you can ask Betty for the last version with the price list, who removed it and, possibly more importantly, why.

There are many products available for source control – each have their own merits. The decision on which should be left to the development team. But they should be able to demonstrate an ability to get you old versions - along with who made the change and why.

## How much is our technical debt?
> "Technical debt (also known as design debt or code debt) is a recent metaphor referring to the eventual consequences of any system design, software architecture or software development within a codebase." Wikipedia

You know the finances of the company. You understand if the company is in financial debt and you have a plan in place to service this debt. Debt isn't a bad thing if it is understood and in control. If you don't understand your debt or have a means of servicing it – then bad things will happen.

Technical debt is exactly the same principal. It is acquired when something in our Word document is fine for now, but will cost us time and effort to resolve in the future. For example, the development team have pulled an all-nighter to add the changes you wanted to document – and while everything is in there, the document hardly flows the way it used to. But it does the job so you send it out to your biggest customers and you forget about it. Time passes and you repeat the process – and in the back of your mind you are thinking that the document is hardly as polished as it used to be. Eventually you get you customers coming back to you complaining that it's almost impossible to read.

Rather than having dealt with the problem when it was small, you've now let it grow to the point that fixing it will take weeks of painstaking work by the development team – this is you technical debt.

Sometimes it is correct to allow technical debt to achieve an aim (in the same way you would accept financial debt for the improvement of the business). Sometimes it happens by accident. But the important thing is understanding how much you have.

You can then make decisions on when to pay that debt down – rather than having the technical equivalent of the bailiffs turning up at the door.

Technical debt can be difficult to measure. The best method is to establish a culture where technical debt is understood and tracked. As developers find (or create) technical debt, keep a track of it and an estimate of how much work it is to resolve. You then have a choice on when to service it.

## How are they keeping up with technology changes?
With changes to development tools, processes and principles occurring daily – this is a great question to ask.

I've seen various articles describing the half-life of developers skills being between 2-5 years – roughly meaning that half the skills they know and use today will obsolete within that timeframe.

Thus developers (and everyone in my opinion) need to be constantly learning new skills and improving old ones.

One of my first bosses said "If you haven't learnt something new today, then it was a waste of a day".

I firmly believe that continual learning development should be baked in with every techie. So much so I've added the following to every interview I conduct:

* How do you keep current with technology?
* What one skill would you like to master this year?

## But what does this mean to your business?

Software development is a relatively young industry (circa 70 years old) and is still very much experimenting and growing. All of that leads to better ways of performing software development – be that faster, with more quality, with more accuracy, or with more efficiency.

Do you want your development team spending 3 months writing something, when an update to Word could have the job done in a week?

## How do we limit the cost of mistakes?
Mistakes happen.

The important thing with development is to catch them as early as possible.

Take for example if a developer makes a spelling mistake in our document.

If the developer spots it straight away then great, it gets fixed and costs are negligible.

Now imagine that it didn't get spotted. The document is sent to the printers for a 10k print run. It's handed out to your entire customer based at your yearly conference. It even appears on the slide pack behind you are you are delivering your keynote speech.

How much does that cost you?

This is why you would use an automated spell checker. This is why you would use a proof reader. The same should be true for your development team.

Within development, the equivalent of proof reading is peer review and manual testing.

Peer review is great for checking that firstly the change does as requested and secondly that it was a good way to do it. This latter point comes back to the technical debt point raised earlier. Sometimes there are many ways to solve a problem – some will be more maintainable over the life of the software than others. This should always be a collaborative decision within the development team – it helps them to grow and learn from each other.

Manual testing is dull. Spending hours looking at the same screen, making sure that everything works as expected (not just what we have changes, but also everything else in case we accidently broke that) – it's almost the entire opposite of a developers natural disposition to be problem solving. It is however essential to test thoroughly – without it then you can have no confidence that you are releasing very costly mistakes into your business. Some businesses employ a separate quality team for testing (personally I prefer it to be part of the development team's responsibility).

Some testing (note, not all) can be automated. There are a growing number of tools to help (a bit like our spell checker in Word). The developers can use those tools to build automated tests that can produce a huge amount of validation very quickly.

What would you prefer? Your development team spending two days manually testing or it being done automatically while they move onto the next big thing?

It should be noted that automated testing doesn't come for free. While there can be costs with some of the tools, the tests themselves have to be written by the development team. This will take time and should be considered on a cost vs benefit basis. There is a huge library of work written on approaches to building automated testing. For me the general advice is test the critical and what is heavily changed – then evaluate to see if there is benefit in doing more (generally there will be).

Referencing the price list problem above; wouldn't it have been great to have an automated test to tell you that it had been removed?

## What do they need to be better at their job?
The most important question by far.

Your development team will invariably be a group of very intelligent people. They will be natural problem solvers and will always be looking for ways to improve themselves, their work and the processes they work within.

They will generally need help to achieve do it - be that time, money or even a simple nod of approval.

I can do nothing else here but recommend that you build a culture of open conversation – one in which everyone is encouraged to contribute. And between the occasional requests for a slide in the office (I blame Google) there will be some real gems.


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Macro BOOST_VMD_ASSERT_IS_IDENTIFIER</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Chapter 1. The Variadic Macro Data Library 1.9">
<link rel="up" href="header/boost/vmd/assert_is_identifier_hpp.html" title="Header <boost/vmd/assert_is_identifier.hpp>">
<link rel="prev" href="header/boost/vmd/assert_is_identifier_hpp.html" title="Header <boost/vmd/assert_is_identifier.hpp>">
<link rel="next" href="BOOST_VMD_ASSERT_IS_IDENTIFIER_D.html" title="Macro BOOST_VMD_ASSERT_IS_IDENTIFIER_D">

Home
Libraries
People
FAQ
More

Macro BOOST_VMD_ASSERT_IS_IDENTIFIER

BOOST_VMD_ASSERT_IS_IDENTIFIER — Asserts that the sequence is an identifier.

Synopsis

// In header: <boost/vmd/assert_is_identifier.hpp>

BOOST_VMD_ASSERT_IS_IDENTIFIER(...)

Description

The macro checks that the sequence is an identifier. If it is not an identifier, it forces a compiler error.

The macro normally checks for an identifier only in debug mode. However an end-user can force the macro to check or not check by defining the macro BOOST_VMD_ASSERT_DATA to 1 or 0 respectively.

... = variadic parameters

The variadic parameters are:

sequence = A sequence to test as an identifier. ids (optional) = The data may take one of two forms: it is either one or more single identifiers or a single Boost PP tuple of identifiers.

returns = Normally the macro returns nothing.       If the sequence is an identifier, nothing is
      output. If optional ids are specified, for the
      sequence to be an identifier it must be an
      identifier that matches one of the optional
      ids.

      For VC++, because there is no sure way of forcing
      a compiler error from within a macro without producing
      output, if the sequence is not an identifier the
      macro forces a compiler error by outputting invalid C++.

      For all other compilers a compiler error is forced
      without producing output if the sequence is not an
      identifier.

Identifiers are registered in VMD with: #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.

The identifier must be registered to be found.

Identifiers are pre-detected in VMD with: #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.

If you specify optional ids and have not specified the detection of an optional id, that id will never match an identifier.

Copyright © 2010-2015 Tropic Software East Inc


text:
/* tslint:disable component-selector */
import { AfterViewInit, Component, ElementRef, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';
import { CodeComponent } from './code.component';

export interface TabInfo {
  class: string|null;
  code: string;
  language: string|null;
  linenums: any;
  path: string;
  region: string;
  header: string|null;
}

/**
 * Renders a set of tab group of code snippets.
 *
 * The innerHTML of the `<code-tabs>` component should contain `<code-pane>` elements.
 * Each `<code-pane>` has the same interface as the embedded `<code-example>` component.
 * The optional `linenums` attribute is the default `linenums` for each code pane.
 */
@Component({
  selector: 'code-tabs',
  template: `

<ng-content></ng-content>

    <mat-card>
      <mat-tab-group class="code-tab-group" disableRipple>
        <mat-tab style="overflow-y: hidden;" *ngFor="let tab of tabs">
          <ng-template mat-tab-label>
            {{ tab.header }}
          </ng-template>
          <aio-code class="{{ tab.class }}"
                    [language]="tab.language"
                    [linenums]="tab.linenums"
                    [path]="tab.path"
                    [region]="tab.region"
                    [header]="tab.header">
          </aio-code>
        </mat-tab>
      </mat-tab-group>
    </mat-card>
  `,
})
export class CodeTabsComponent implements OnInit, AfterViewInit {
  tabs: TabInfo[];

  @Input() linenums: string;

  @ViewChild('content', { static: true }) content: ElementRef<HTMLDivElement>;

  @ViewChildren(CodeComponent) codeComponents: QueryList<CodeComponent>;

  ngOnInit() {
    this.tabs = [];
    const codeExamples = Array.from(this.content.nativeElement.querySelectorAll('code-pane'));

    for (const tabContent of codeExamples) {
      this.tabs.push(this.getTabInfo(tabContent));
    }
  }

  ngAfterViewInit() {
    this.codeComponents.toArray().forEach((codeComponent, i) => {
      codeComponent.code = this.tabs[i].code;
    });
  }

  /** Gets the extracted TabInfo data from the provided code-pane element. */
  private getTabInfo(tabContent: Element): TabInfo {
    return {
      class: tabContent.getAttribute('class'),
      code: tabContent.innerHTML,
      language: tabContent.getAttribute('language'),
      linenums: tabContent.getAttribute('linenums') || this.linenums,
      path: tabContent.getAttribute('path') || '',
      region: tabContent.getAttribute('region') || '',
      header: tabContent.getAttribute('header')
    };
  }
}


text:
#include "bid_internal.h"

#define SIZE_MASK      0xffffff00
#define INVALID_RESULT 0x80

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_rnint,
				BID_UINT128, x, bid128_to_uint32_rnint,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_xrnint,
				BID_UINT128, x, bid128_to_uint32_xrnint,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_rninta,
				BID_UINT128, x, bid128_to_uint32_rninta,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_xrninta,
				BID_UINT128, x, bid128_to_uint32_xrninta,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_int,
				BID_UINT128, x, bid128_to_uint32_int,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_xint,
				BID_UINT128, x, bid128_to_uint32_xint,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_floor,
				BID_UINT128, x, bid128_to_uint32_floor,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_ceil,
				BID_UINT128, x, bid128_to_uint32_ceil,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_xfloor,
				BID_UINT128, x, bid128_to_uint32_xfloor,
				unsigned int, SIZE_MASK, INVALID_RESULT)

BID_TO_SMALL_BID_UINT_CVT_FUNCTION (unsigned char, bid128_to_uint8_xceil,
				BID_UINT128, x, bid128_to_uint32_xceil,
				unsigned int, SIZE_MASK, INVALID_RESULT)


text:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs
	title="AttendIt :: powered by HomeworkNYC"
	height="400"
	description="Search and share teen-specific events hosted by the NYCity Libraries. Search by topic and/or boro."
	screenshot="http://homeworknycbeta.org/widgets/events/screenshot.jpg"
	thumbnail="http://homeworknycbeta.org/widgets/media/icon_64x64.png"
	directory_title="AttendIt - powered by HomeWorkNYC">

    	<Require feature="opensocial-0.8"/>

	</ModulePrefs>

  <Content type="html">
	  <![CDATA[
<script>

  var user_id = '0';
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == 'viewerId') {
      user_id =  pair[1];
    }
  }

document.write('<iframe id="main" frameBorder=0 width=96% height=460 src="http://homeworknycbeta.org/widgets/events/widget.php?platform=myspace&nypl_user_id='+user_id+'"></iframe>');
</script>

]]>
	</Content>
</Module>


text:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/person_list"
    android:name="com.iangclifton.androidessentials.PersonListFragment"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
    tools:context="com.iangclifton.androidessentials.PersonListActivity"
    tools:layout="@android:layout/list_content" />


text:
package org.wso2.carbon.apimgt.rest.api.admin.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.apimgt.core.api.APIMgtAdminService;
import org.wso2.carbon.apimgt.core.exception.APIManagementException;
import org.wso2.carbon.apimgt.core.models.policy.APIPolicy;
import org.wso2.carbon.apimgt.core.models.policy.ApplicationPolicy;
import org.wso2.carbon.apimgt.core.models.policy.Policy;
import org.wso2.carbon.apimgt.core.models.policy.SubscriptionPolicy;
import org.wso2.carbon.apimgt.core.util.APIMgtConstants;
import org.wso2.carbon.apimgt.rest.api.admin.NotFoundException;
import org.wso2.carbon.apimgt.rest.api.admin.PoliciesApiService;
import org.wso2.carbon.apimgt.rest.api.admin.dto.*;
import org.wso2.carbon.apimgt.rest.api.admin.mappings.AdvancedThrottlePolicyMappingUtil;
import org.wso2.carbon.apimgt.rest.api.admin.mappings.ApplicationThrottlePolicyMappingUtil;
import org.wso2.carbon.apimgt.rest.api.admin.mappings.SubscriptionThrottlePolicyMappingUtil;
import org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO;
import org.wso2.carbon.apimgt.rest.api.common.util.RestApiUtil;
import org.wso2.msf4j.Request;

import javax.ws.rs.core.Response;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PoliciesApiServiceImpl extends PoliciesApiService {

    private static final Logger log = LoggerFactory.getLogger(PoliciesApiServiceImpl.class);

    /**
     *
     * @param accept            Accept header value
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingAdvancedGet(String accept, String ifNoneMatch, String ifModifiedSince,
            Request request) throws NotFoundException {
        if (log.isDebugEnabled()) {
            log.debug("Received Advance Throttle Policy GET request");
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            List<APIPolicy> policies = apiMgtAdminService.getApiPolicies();
            AdvancedThrottlePolicyListDTO advancedThrottlePolicyListDTO = AdvancedThrottlePolicyMappingUtil
                    .fromAPIPolicyArrayToListDTO(policies);
            return Response.ok().entity(advancedThrottlePolicyListDTO).build();
        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while retrieving Advance Policies";
            org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     *
     * @param policyId          Uuid of the Advanced policy.
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingAdvancedPolicyIdDelete(String policyId, String ifMatch,
            String ifUnmodifiedSince, Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.api;
        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy DELETE request with uuid: " + policyId);
        }
        return deletePolicy(policyId, tierLevel);
    }

    /**
     *
     * @param policyId          Uuid of the Advanced policy.
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingAdvancedPolicyIdGet(String policyId, String ifNoneMatch,
            String ifModifiedSince, Request request) throws NotFoundException {
        if (log.isDebugEnabled()) {
            log.info("Received Advanced Policy Get request. Policy uuid: " + policyId);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            APIPolicy policy = apiMgtAdminService.getApiPolicyByUuid(policyId);
            return Response.status(Response.Status.OK).entity(AdvancedThrottlePolicyMappingUtil.
                    fromAdvancedPolicyToDTO(policy)).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while getting Advanced Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     *
     * @param policyId          Uuid of the Advanced policy.
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override
    public Response policiesThrottlingAdvancedPolicyIdPut(String policyId, AdvancedThrottlePolicyDTO body,
            String contentType, String ifMatch, String ifUnmodifiedSince, Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.api;
        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy PUT request " + body + " with tierLevel = " + tierLevel);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            APIPolicy apiPolicy = AdvancedThrottlePolicyMappingUtil.fromAdvancedPolicyDTOToPolicy(body);
            apiPolicy.setUuid(policyId);
            apiMgtAdminService.updateApiPolicy(apiPolicy);
            return Response.status(Response.Status.CREATED).entity(AdvancedThrottlePolicyMappingUtil
                    .fromAdvancedPolicyToDTO(apiMgtAdminService.getApiPolicyByUuid(policyId))).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while updating Advanced Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();

        }
    }

    /**
     *
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingAdvancedPost(AdvancedThrottlePolicyDTO body, String contentType,
            Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.api;
        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy POST request " + body + " with tierLevel = " + tierLevel);
        }

        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy PUT request " + body + " with tierLevel = " + tierLevel);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            APIPolicy apiPolicy = AdvancedThrottlePolicyMappingUtil.fromAdvancedPolicyDTOToPolicy(body);
            String policyId = apiMgtAdminService.addApiPolicy(apiPolicy);
            return Response.status(Response.Status.CREATED).entity(AdvancedThrottlePolicyMappingUtil
                    .fromAdvancedPolicyToDTO(apiMgtAdminService.getApiPolicyByUuid(policyId)))
                    .build();
        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while adding Advanced Throttle Policy, policy name: " + body
                    .getPolicyName();
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     * Returns all Application Policies deployed in the system
     *
     * @param accept            Accept header value
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object  Response containing the Application Policy list {@link ApplicationThrottlePolicyListDTO}
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingApplicationGet(String accept, String ifNoneMatch,
            String ifModifiedSince, Request request) throws NotFoundException {

        if (log.isDebugEnabled()) {
            log.debug("Received Application Throttle Policy GET request");
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            List<ApplicationPolicy> policies = apiMgtAdminService.getApplicationPolicies();
            ApplicationThrottlePolicyListDTO applicationThrottlePolicyListDTO = ApplicationThrottlePolicyMappingUtil
                    .fromApplicationPolicyArrayToListDTO(policies);
            return Response.ok().entity(applicationThrottlePolicyListDTO).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while retrieving Application Policies";
            org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     * Deletes an Application throttle policy
     *
     * @param policyId          Uuid of the Application policy.
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingApplicationPolicyIdDelete(String policyId, String ifMatch,
            String ifUnmodifiedSince, Request request) throws NotFoundException {

        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.application;
        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy DELETE request with uuid: " + policyId);
        }
        return deletePolicy(policyId, tierLevel);
    }

    /**
     * Returns a matching Application policy for the given policy id @{policyId}
     *
     * @param policyId          Uuid of the Application policy
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object  Response with matching {@link ApplicationThrottlePolicyDTO} object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingApplicationPolicyIdGet(String policyId, String ifNoneMatch,
            String ifModifiedSince, Request request) throws NotFoundException {

        if (log.isDebugEnabled()) {
            log.info("Received Application Policy Get request. Policy uuid: " + policyId);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            Policy applicationPolicy = apiMgtAdminService.getApplicationPolicyByUuid(policyId);
            return Response.status(Response.Status.OK).entity(ApplicationThrottlePolicyMappingUtil.
                    fromApplicationThrottlePolicyToDTO(applicationPolicy)).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while getting Application Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     * Updates/adds a new Application throttle policy to the system
     *
     * @param policyId          Uuid of the policy.
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object  response object with the updated application throttle policy resource
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingApplicationPolicyIdPut(String policyId,
            ApplicationThrottlePolicyDTO body, String contentType, String ifMatch, String ifUnmodifiedSince,
            Request request) throws NotFoundException {

        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.application;
        if (log.isDebugEnabled()) {
            log.info("Received Application Policy PUT request " + body + " with tierLevel = " + tierLevel);
        }

        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            ApplicationPolicy applicationPolicy = ApplicationThrottlePolicyMappingUtil
                    .fromApplicationThrottlePolicyDTOToModel(body);
            applicationPolicy.setUuid(policyId);
            apiMgtAdminService.updateApplicationPolicy(applicationPolicy);
            return Response.status(Response.Status.OK).entity(ApplicationThrottlePolicyMappingUtil.
                    fromApplicationThrottlePolicyToDTO(apiMgtAdminService.getApplicationPolicyByUuid(policyId))).
                    build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while updating Application Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     * Adds a new Application throttle policy to the system
     *
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param request           msf4j request object
     * @return Response object  response object with the created application throttle policy resource
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingApplicationPost(ApplicationThrottlePolicyDTO body, String contentType,
            Request request) throws NotFoundException {

        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.application;
        if (log.isDebugEnabled()) {
            log.info("Received Application Policy PUT request " + body + " with tierLevel = " + tierLevel);
        }

        String policyName = null;
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            ApplicationPolicy applicationPolicy = ApplicationThrottlePolicyMappingUtil.
                    fromApplicationThrottlePolicyDTOToModel(body);
            policyName = applicationPolicy.getPolicyName();
            String applicationPolicyUuid = apiMgtAdminService.addApplicationPolicy(applicationPolicy);
            return Response.status(Response.Status.CREATED).entity(ApplicationThrottlePolicyMappingUtil
                    .fromApplicationThrottlePolicyToDTO(apiMgtAdminService
                            .getApplicationPolicyByUuid(applicationPolicyUuid))).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while adding Application Policy. policy name: " + policyName;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     *
     * @param accept            Accept header value
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingSubscriptionGet(String accept, String ifNoneMatch,
            String ifModifiedSince, Request request) throws NotFoundException {
        if (log.isDebugEnabled()) {
            log.debug("Received Application Throttle Policy GET request");
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            List<SubscriptionPolicy> policies = apiMgtAdminService.getSubscriptionPolicies();
            SubscriptionThrottlePolicyListDTO subscriptionThrottlePolicyListDTO = SubscriptionThrottlePolicyMappingUtil
                    .fromSubscriptionPolicyArrayToListDTO(policies);
            return Response.ok().entity(subscriptionThrottlePolicyListDTO).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while retrieving Application Policies";
            org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     *
     * @param policyId          Uuid of the Subscription policy.
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingSubscriptionPolicyIdDelete(String policyId, String ifMatch,
            String ifUnmodifiedSince, Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.subscription;
        if (log.isDebugEnabled()) {
            log.info("Received Advance Policy DELETE request with uuid: " + policyId);
        }
        return deletePolicy(policyId, tierLevel);
    }

    /**
     *
     * @param policyId          Uuid of the Subscription policy
     * @param ifNoneMatch       If-None-Match header value
     * @param ifModifiedSince   If-Modified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingSubscriptionPolicyIdGet(String policyId, String ifNoneMatch,
            String ifModifiedSince, Request request) throws NotFoundException {
        if (log.isDebugEnabled()) {
            log.info("Received Subscription Policy Get request. Policy uuid: " + policyId);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            SubscriptionPolicy subscriptionPolicy = apiMgtAdminService.getSubscriptionPolicyByUuid(policyId);
            SubscriptionThrottlePolicyDTO subscriptionThrottlePolicyDTO = SubscriptionThrottlePolicyMappingUtil
                    .fromSubscriptionThrottlePolicyToDTO(subscriptionPolicy);
            return Response.status(Response.Status.OK).entity(subscriptionThrottlePolicyDTO).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while getting Subscription Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    /**
     *
     * @param policyId          Uuid of the Subscription policy.
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param ifMatch           If-Match header value
     * @param ifUnmodifiedSince If-Unmodified-Since header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override
    public Response policiesThrottlingSubscriptionPolicyIdPut(String policyId,
            SubscriptionThrottlePolicyDTO body, String contentType, String ifMatch, String ifUnmodifiedSince,
            Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.subscription;
        if (log.isDebugEnabled()) {
            log.info("Received Subscription Policy PUT request " + body + " with tierLevel = " + tierLevel);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            SubscriptionPolicy subscriptionPolicy = SubscriptionThrottlePolicyMappingUtil
                    .fromSubscriptionThrottlePolicyDTOToModel(body);
            subscriptionPolicy.setUuid(policyId);
            apiMgtAdminService.updateSubscriptionPolicy(subscriptionPolicy);
            return Response.status(Response.Status.CREATED).entity(SubscriptionThrottlePolicyMappingUtil
                    .fromSubscriptionThrottlePolicyToDTO(apiMgtAdminService.
                            getSubscriptionPolicyByUuid(subscriptionPolicy.getUuid()))).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while updating Application Policy. policy uuid: " + policyId;
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();

        }
    }

    /**
     *
     * @param body              DTO object including the Policy meta information
     * @param contentType       Content-Type header value
     * @param request           msf4j request object
     * @return Response object
     * @throws NotFoundException if an error occurred when particular resource does not exits in the system.
     */
    @Override public Response policiesThrottlingSubscriptionPost(SubscriptionThrottlePolicyDTO body, String contentType,
            Request request) throws NotFoundException {
        APIMgtAdminService.PolicyLevel tierLevel = APIMgtAdminService.PolicyLevel.subscription;
        if (log.isDebugEnabled()) {
            log.info("Received Subscription Policy POST request " + body + " with tierLevel = " + tierLevel);
        }
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            SubscriptionPolicy subscriptionPolicy = SubscriptionThrottlePolicyMappingUtil.
                    fromSubscriptionThrottlePolicyDTOToModel(body);
            String policyId = apiMgtAdminService.addSubscriptionPolicy(subscriptionPolicy);
            return Response.status(Response.Status.CREATED).entity(SubscriptionThrottlePolicyMappingUtil
                    .fromSubscriptionThrottlePolicyToDTO(apiMgtAdminService
                            .getSubscriptionPolicyByUuid(policyId))).build();

        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while adding Subscription Policy. policy name: " +
                    body.getPolicyName();
            ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

    private Response deletePolicy(String policyId, APIMgtAdminService.PolicyLevel tierLevel) {
        try {
            APIMgtAdminService apiMgtAdminService = RestApiUtil.getAPIMgtAdminService();
            apiMgtAdminService.deletePolicyByUuid(policyId, tierLevel);
            return Response.ok().build();
        } catch (APIManagementException e) {
            String errorMessage = "Error occurred while deleting a Policy uuid : " + policyId;
            Map<String, String> paramList = new HashMap<>();
            paramList.put(APIMgtConstants.ExceptionsConstants.TIER, policyId);
            org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO errorDTO = RestApiUtil
                    .getErrorDTO(e.getErrorHandler(), paramList);
            log.error(errorMessage, e);
            return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
        }
    }

}


text:
package es.alrocar.jpe.parser;

import java.util.ArrayList;

import org.geotools.geometry.jts.JTS;

import es.alrocar.poiproxy.configuration.DescribeService;
import es.alrocar.poiproxy.geotools.GeotoolsUtils;
import es.alrocar.poiproxy.proxy.LocalFilter;
import es.prodevelop.gvsig.mini.geom.impl.jts.JTSFeature;

/**
 * An abstract class to parse an xml or json document and return a GeoJSON given
 * a {@link DescribeService} instance.
 *
 * The idea is having a single parser that is configurable with a json document
 * that is parsed into a {@link DescribeService} instance
 *
 * @author albertoromeu
 *
 */
public abstract class JPEParser {

	public static final String CATEGORIES = "px_categories";
	public static final String SERVICE = "px_service";

	/**
	 * Parses a contentFile using a {@link DescribeService} instance
	 *
	 * @param contentFile
	 *            The content of the file to parse into a String
	 * @param service
	 *            The DescribeService instance. THe
	 *            {@link DescribeService#getFeatureTypes()} will be used to get
	 *            some attributes to be parsed
	 * @param localFilter
	 *            A LocalFilter instance to perform a filter operation in the
	 *            contentFile
	 * @return An array of {@link JTSFeature}
	 */
	public abstract ArrayList<JTSFeature> parse(String contentFile,
			DescribeService service, LocalFilter localFilter);

	/**
	 * The GeoJSON document corresponding to the array of {@link JTS} returned
	 * by the {@link JPEParser#parse(String, DescribeService)} method
	 *
	 * @return
	 */
	public abstract String getGeoJSON();

	/**
	 * The format that supports the parser
	 *
	 * @return either {@link JPEParser#FORMAT_JSON} or
	 *         {@link JPEParser#FORMAT_XML}
	 */
	public abstract String getFormat();

	/**
	 * Transform a pair of coordinates from a SRS to another expressed as EPSG
	 * codes
	 *
	 * @param from
	 *            The EPSG code of the source SRS
	 * @param to
	 *            The EPSG code of the destination SRS
	 * @param xy
	 *            The pair of coordinates (x,y) or (lon,lat)
	 * @return
	 */
	public double[] transform(String from, String to, double[] xy) {
		return GeotoolsUtils.transform(from, to, xy);
	}
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: maxpowers
 * Date: 12/6/14
 * Time: 8:38 AM
 */

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version4 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        $this->addSql("CREATE TABLE phone_calls(
            id int PRIMARY KEY AUTO_INCREMENT,
            uuid CHAR(36) NOT NULL,
            user_id int NOT NULL,
            name VARCHAR(50) NOT NULL,
            created_at DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
            updated_at DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
            is_active tinyint DEFAULT 1 NOT NULL,
            INDEX (id),
            INDEX (user_id),
            INDEX (uuid),
            UNIQUE (uuid),
            FOREIGN KEY (user_id)
                REFERENCES users(id)
        )");

        $this->addSql("CREATE TABLE phone_call_audio(
            id int PRIMARY KEY AUTO_INCREMENT,
            user_id int NOT NULL,
            audio_id int NOT NULL,
            position int NOT NULL,
            FOREIGN KEY (user_id)
                REFERENCES users(id),
            FOREIGN KEY (audio_id)
                REFERENCES audio(id)
        )");
    }

    public function down(Schema $schema)
    {
        $this->addSql("DROP TABLE phone_call_audio");
        $this->addSql("DROP TABLE phone_calls");
    }
}


text:
LAB

    				<bloquote>Ajax + RSA + AES</bloquote>

                    Parametro 1
    				<input type="text" class="form-control" id="par1" value="" placeholder="Parametro 1">
    				Parametro 2
    				<input type="number" pattern="^[$\-\s]*[\d\,]*?([\.]\d{0,2})?\s*$" class="form-control" id="par2" value="" placeholder="Parametro 2">
    				Parametro 3
    				<input type="currency" class="form-control" id="par3" value="" placeholder="Parametro 3">

    				Retorno
    				<textarea id="returno" class="form-control" placeholder="return" rows="7"></textarea>

    				<input type="file" class="form-control" id="file" value="" placeholder="" multiple="true">

40%

    				<button type="button" class="btn btn-default" onclick="run()">Enviar formulário</button>
                    <button type="button" class="btn btn-default" onclick="fileSend()">Upload</button>
                    <button type="button" class="btn btn-default" onclick="fileRequest()">Download</button>

Tigalogin

                    <input type="text"
                           name="login"
                           placeholder="Login"
                           autocomplete="off"
                           autofocus
                           required />

                    <input type="password"
                           name="password"
                           placeholder="Senha"
                           autocomplete="off"
                           required />

                        <button type="submit" onclick="login()">Entrar</button>


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Ill. pl. orient. 1:114, t. 59. 1843

#### Original name
null

### Remarks
null


text:
This sample demonstrates how a SY application can handle HTTP redirection (`3xx`) from a web service endpoint.

## How to run this example

1. Run SY server and deploy target web service endpoint:

        $ cd ws/
        $ mvn clean package jboss-as:deploy

2. Deploy HTTP redirection SY application:

        $ cd sy/
        $ mvn clean package jboss-as:deploy


text:
// Copyright 2016 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.

// values contains all kind of non pattern types usable as values.

package anim1d

import (
	"math/rand"

	"github.com/maruel/fastbezier"
)

// MinMax limits the value between a min and a max
func MinMax(v, min, max int) int {
	if v < min {
		return min
	}
	if v > max {
		return max
	}
	return v
}

// MinMax32 limits the value between a min and a max
func MinMax32(v, min, max int32) int32 {
	if v < min {
		return min
	}
	if v > max {
		return max
	}
	return v
}

// Values

// Value defines a value that may be constant or that may evolve over time.
type Value interface {
	Eval(timeMS uint32, l int) int32
}

// Const is a constant value.
type Const int32

// Eval implements Value.
func (c Const) Eval(timeMS uint32, l int) int32 {
	return int32(c)
}

// Percent is a percentage of the length. It is stored as a 16.16 fixed point.
type Percent int32

// Eval implements Value.
func (p Percent) Eval(timeMS uint32, l int) int32 {
	return int32(int64(l) * int64(p) / 65536)
}

// OpAdd adds a constant to timeMS.
type OpAdd struct {
	AddMS int32
}

// Eval implements Value.
func (o *OpAdd) Eval(timeMS uint32, l int) int32 {
	return int32(timeMS) + o.AddMS
}

// OpMod is a value that is cycling downward.
type OpMod struct {
	TickMS int32 // The cycling time. Maximum is ~25 days.
}

// Eval implements Value.
func (o *OpMod) Eval(timeMS uint32, l int) int32 {
	return int32(timeMS % uint32(o.TickMS))
}

// OpStep is a value that is cycling upward.
//
// It is useful for offsets that are increasing as a stepping function.
type OpStep struct {
	TickMS int32 // The cycling time. Maximum is ~25 days.
}

// Eval implements Value.
func (o *OpStep) Eval(timeMS uint32, l int) int32 {
	return int32(timeMS / uint32(o.TickMS) * uint32(o.TickMS))
}

// Rand is a value that pseudo-randomly changes every TickMS millisecond. If
// unspecified, changes every 60fps.
type Rand struct {
	TickMS int32 // The resolution at which the random value changes.
}

// Eval implements Value.
func (r *Rand) Eval(timeMS uint32, l int) int32 {
	m := uint32(r.TickMS)
	if m == 0 {
		m = 16
	}
	return int32(rand.NewSource(int64(timeMS / m)).Int63())
}

// MovePerHour is the number of movement per hour.
//
// Can be either positive or negative. Maximum supported value is ±3600000, 1000
// move/sec.
//
// Sample values:
//   - 1: one move per hour
//   - 60: one move per minute
//   - 3600: one move per second
//   - 216000: 60 move per second
type MovePerHour SValue

// Eval is not a Value implementation but it leverages an inner one.
func (m *MovePerHour) Eval(timeMS uint32, l int, cycle int) int {
	s := SValue(*m)
	// Prevent overflows.
	v := MinMax32(s.Eval(timeMS, l), -3600000, 3600000)
	// TODO(maruel): Reduce the amount of int64 code in there yet keeping it from
	// overflowing.
	// offset ranges [0, 3599999]
	offset := timeMS % 3600000
	// (1<<32)/3600000 = 1193 is too low. Temporarily upgrade to int64 to
	// calculate the value.
	low := int64(offset) * int64(v) / 3600000
	hour := timeMS / 3600000
	high := int64(hour) * int64(v)
	if cycle != 0 {
		return int((low + high) % int64(cycle))
	}
	return int(low + high)
}

/*
// Equation evaluate an equation at every call.
type Equation struct {
	V string
	f func(timeMS uint32) int32
}

// Eval implements Value.
func (e *Equation) Eval(timeMS uint32) int32 {
	// Compiles the equation to an actual value and precompile it.
	if e.f == nil {
		e.f = func(timeMS uint32) int32 {
			return 0
		}
	}
	return e.f(timeMS)
}
*/

// Scalers

// Bell is a "good enough" approximation of a gaussian curve by using 2
// symmetrical ease-in-out bezier curves.
//
// It is not named Gaussian since it is not a gaussian curve; it really is a
// bell.
type Bell struct{}

// Scale scales input [0, 65535] to output [0, 65535] as a bell curve.
func (b *Bell) Scale(v uint16) uint16 {
	switch {
	case v == 0:
		return 0
	case v == 65535:
		return 0
	case v == 32767:
		return 65535

	case v < 32767:
		return EaseInOut.Scale(v * 2)
	default:
		return EaseInOut.Scale(65535 - v*2)
	}
}

// Curve models visually pleasing curves.
//
// They are modeled against CSS transitions.
// https://www.w3.org/TR/web-animations/#scaling-using-a-cubic-bezier-curve
type Curve string

// All the kind of known curves.
const (
	Ease       Curve = "ease"
	EaseIn     Curve = "ease-in"
	EaseInOut  Curve = "ease-in-out"
	EaseOut    Curve = "ease-out" // Recommended and default value.
	Direct     Curve = "direct"   // linear mapping
	StepStart  Curve = "steps(1,start)"
	StepMiddle Curve = "steps(1,middle)"
	StepEnd    Curve = "steps(1,end)"
)

var lutCache map[Curve]fastbezier.LUT

func setupCache() map[Curve]fastbezier.LUT {
	cache := map[Curve]fastbezier.LUT{
		Ease:      fastbezier.Make(0.25, 0.1, 0.25, 1, 18),
		EaseIn:    fastbezier.Make(0.42, 0, 1, 1, 18),
		EaseInOut: fastbezier.Make(0.42, 0, 0.58, 1, 18),
		EaseOut:   fastbezier.Make(0, 0, 0.58, 1, 18),
	}
	cache[""] = cache[EaseOut]
	return cache
}

func init() {
	lutCache = setupCache()
}

// Scale scales input [0, 65535] to output [0, 65535] using the curve
// requested.
func (c Curve) Scale(intensity uint16) uint16 {
	switch c {
	case Ease, EaseIn, EaseInOut, EaseOut, "":
		return lutCache[c].Eval(intensity)
	default:
		return lutCache[""].Eval(intensity)
	case Direct:
		return intensity
	case StepStart:
		if intensity < 256 {
			return 0
		}
		return 65535
	case StepMiddle:
		if intensity < 32768 {
			return 0
		}
		return 65535
	case StepEnd:
		if intensity >= 65535-256 {
			return 65535
		}
		return 0
	}
}

// Scale8 saves on casting.
func (c Curve) Scale8(intensity uint16) uint8 {
	return uint8(c.Scale(intensity) >> 8)
}

// Interpolation specifies a way to scales a pixel strip.
type Interpolation string

// All the kinds of interpolations.
const (
	NearestSkip Interpolation = "nearestskip" // Selects the nearest pixel but when upscaling, skips on missing pixels.
	Nearest     Interpolation = "nearest"     // Selects the nearest pixel, gives a blocky view.
	Linear      Interpolation = "linear"      // Linear interpolation, recommended and default value.
)

// Scale interpolates a frame into another using integers as much as possible
// for reasonable performance.
func (i Interpolation) Scale(in, out Frame) {
	li := len(in)
	lo := len(out)
	if li == 0 || lo == 0 {
		return
	}
	switch i {
	case NearestSkip:
		if li < lo {
			// Do not touch skipped pixels.
			for i, p := range in {
				out[(i*lo+lo/2)/li] = p
			}
			return
		}
		// When the destination is smaller than the source, Nearest and NearestSkip
		// have the same behavior.
		fallthrough
	case Nearest, "":
		fallthrough
	default:
		for i := range out {
			out[i] = in[(i*li+li/2)/lo]
		}
	case Linear:
		for i := range out {
			x := (i*li + li/2) / lo
			c := in[x]
			if x < li-1 {
				gradient := uint8(127)
				c.Mix(in[x+1], gradient)
			}
			out[i] = c
			//a := in[(i*li+li/2)/lo]
			//b := in[(i*li+li/2)/lo]
			//out[i] = (a + b) / 2
		}
	}
}

//

const epsilon = 1e-7


text:
user=
host=
dbname="SyncServer_SharedImages"

result=$(mysql -P 3306 -p --user="$user" --host="$host" --database="$dbname" < 5.sql 2>&1 )

if [ $? = 0 ]; then
    echo "Success running migration"
else
    echo "**** Failure running migration *******"
    echo $result
fi


text:
package middleware

import (
	"context"
	"fmt"
	"net/url"

	storagedriver "github.com/distribution/distribution/v3/registry/storage/driver"
	storagemiddleware "github.com/distribution/distribution/v3/registry/storage/driver/middleware"
)

type redirectStorageMiddleware struct {
	storagedriver.StorageDriver
	scheme string
	host   string
}

var _ storagedriver.StorageDriver = &redirectStorageMiddleware{}

func newRedirectStorageMiddleware(sd storagedriver.StorageDriver, options map[string]interface{}) (storagedriver.StorageDriver, error) {
	o, ok := options["baseurl"]
	if !ok {
		return nil, fmt.Errorf("no baseurl provided")
	}
	b, ok := o.(string)
	if !ok {
		return nil, fmt.Errorf("baseurl must be a string")
	}
	u, err := url.Parse(b)
	if err != nil {
		return nil, fmt.Errorf("unable to parse redirect baseurl: %s", b)
	}
	if u.Scheme == "" {
		return nil, fmt.Errorf("no scheme specified for redirect baseurl")
	}
	if u.Host == "" {
		return nil, fmt.Errorf("no host specified for redirect baseurl")
	}

	return &redirectStorageMiddleware{StorageDriver: sd, scheme: u.Scheme, host: u.Host}, nil
}

func (r *redirectStorageMiddleware) URLFor(ctx context.Context, path string, options map[string]interface{}) (string, error) {
	u := &url.URL{Scheme: r.scheme, Host: r.host, Path: path}
	return u.String(), nil
}

func init() {
	storagemiddleware.Register("redirect", newRedirectStorageMiddleware)
}


text:
<?php

declare(strict_types=1);

namespace DataTypes\Tests\Net;

use DataTypes\Net\Exceptions\IPAddressInvalidArgumentException;
use DataTypes\Net\IPAddress;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;

/**
 * Test IPAddress class.
 */
class IPAddressTest extends TestCase
{
    /**
     * Test __toString method.
     */
    public function testToString()
    {
        self::assertSame('127.0.0.1', IPAddress::parse('127.0.0.1')->__toString());
        self::assertSame('255.255.255.255', IPAddress::parse('255.255.255.255')->__toString());
    }

    /**
     * Test that empty IP address is invalid.
     */
    public function testEmptyIPAddressIsInvalid()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('IP address "" is empty.');

        IPAddress::parse('');
    }

    /**
     * Test that empty IP address with not four octets is invalid.
     */
    public function testIPAddressWithNotFourOctetsIsInvalid()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('IP address "1.2.3" is invalid: IP address must consist of four octets.');

        IPAddress::parse('1.2.3');
    }

    /**
     * Test that IP address with empty octet is invalid.
     */
    public function testIPAddressWithEmptyOctetIsInvalid()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('IP address "192.168..1" is invalid: Octet "" is empty.');

        IPAddress::parse('192.168..1');
    }

    /**
     * Test that IP address with invalid character in octet is invalid.
     */
    public function testIPAddressWithInvalidCharacterInOctetIsInvalid()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('IP address "127.0.0X.1" is invalid: Octet "0X" contains invalid character "X".');

        IPAddress::parse('127.0.0X.1');
    }

    /**
     * Test that IP address with octet out of range is invalid.
     */
    public function testIPAddressWithOctetOutOfRangeIsInvalid()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('IP address "255.255.256.255" is invalid: Octet 256 is out of range: Maximum value for an octet is 255.');

        IPAddress::parse('255.255.256.255');
    }

    /**
     * Test isValid method.
     */
    public function testIsValid()
    {
        self::assertFalse(IPAddress::isValid(''));
        self::assertFalse(IPAddress::isValid('1.2.3'));
        self::assertFalse(IPAddress::isValid('1.2.3.'));
        self::assertFalse(IPAddress::isValid('256.1.1.1'));
        self::assertFalse(IPAddress::isValid('yyy.123.234.1'));
        self::assertTrue(IPAddress::isValid('0.0.0.0'));
        self::assertTrue(IPAddress::isValid('255.255.255.255'));
    }

    /**
     * Test tryParse method.
     */
    public function testTryParse()
    {
        self::assertNull(IPAddress::tryParse(''));
        self::assertNull(IPAddress::tryParse('1.2.3'));
        self::assertNull(IPAddress::tryParse('1.2.3.'));
        self::assertNull(IPAddress::tryParse('256.1.1.1'));
        self::assertNull(IPAddress::tryParse('yyy.123.234.1'));
        self::assertSame('0.0.0.0', IPAddress::tryParse('0.0.0.0')->__toString());
        self::assertSame('255.255.255.255', IPAddress::tryParse('255.255.255.255')->__toString());
    }

    /**
     * Test getParts method.
     */
    public function testGetParts()
    {
        self::assertSame([192, 168, 0, 1], IPAddress::parse('192.168.0.1')->getParts());
    }

    /**
     * Test fromParts method.
     */
    public function testFromParts()
    {
        self::assertSame('192.168.0.1', IPAddress::fromParts([192, 168, 0, 1])->__toString());
    }

    /**
     * Test fromParts method with invalid number of octets.
     */
    public function testFromPartsWithInvalidNumberOfOctets()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('Octets are invalid: IP address must consist of four octets.');

        IPAddress::fromParts([1, 2, 3]);
    }

    /**
     * Test fromParts method with invalid octet type.
     */
    public function testFromPartsWithInvalidOctetType()
    {
        self::expectException(InvalidArgumentException::class);
        self::expectExceptionMessage('$octets is not an array of integers.');

        IPAddress::fromParts([1, 'Foo', 3, 4]);
    }

    /**
     * Test fromParts method with octet value too low.
     */
    public function testFromPartsWithOctetValueTooLow()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('Octets are invalid: Octet -1 is out of range: Minimum value for an octet is 0.');

        IPAddress::fromParts([1, 2, -1, 4]);
    }

    /**
     * Test fromParts method with octet value too high.
     */
    public function testFromPartsWithOctetValueTooHigh()
    {
        self::expectException(IPAddressInvalidArgumentException::class);
        self::expectExceptionMessage('Octets are invalid: Octet 256 is out of range: Maximum value for an octet is 255.');

        IPAddress::fromParts([1, 2, 256, 4]);
    }

    /**
     * Test withMask method.
     */
    public function testWithMask()
    {
        self::assertSame('192.168.1.1', IPAddress::parse('192.168.1.1')->withMask(IPAddress::parse('255.255.255.255'))->__toString());
        self::assertSame('192.168.1.0', IPAddress::parse('192.168.1.1')->withMask(IPAddress::parse('255.255.255.0'))->__toString());
        self::assertSame('192.168.0.0', IPAddress::parse('192.168.1.1')->withMask(IPAddress::parse('255.255.0.0'))->__toString());
        self::assertSame('192.0.0.0', IPAddress::parse('192.168.1.1')->withMask(IPAddress::parse('255.0.0.0'))->__toString());
        self::assertSame('0.0.0.0', IPAddress::parse('192.168.1.1')->withMask(IPAddress::parse('0.0.0.0'))->__toString());
    }

    /**
     * Test equals method.
     */
    public function testEquals()
    {
        self::assertTrue(IPAddress::parse('1.2.3.4')->equals(IPAddress::parse('1.2.3.4')));
        self::assertFalse(IPAddress::parse('1.2.3.4')->equals(IPAddress::parse('1.2.3.0')));
        self::assertTrue(IPAddress::parse('127.0.0.1')->equals(IPAddress::fromParts([127, 0, 0, 1])));
    }

    /**
     * Test toInteger method.
     */
    public function testToInteger()
    {
        self::assertSame(0, IPAddress::parse('0.0.0.0')->toInteger());
        self::assertSame(203569230, IPAddress::parse('12.34.56.78')->toInteger());
        self::assertSame(2147483647, IPAddress::parse('127.255.255.255')->toInteger());
        self::assertSame(2147483648, IPAddress::parse('128.0.0.0')->toInteger());
        self::assertSame(3232235521, IPAddress::parse('192.168.0.1')->toInteger());
        self::assertSame(4294967295, IPAddress::parse('255.255.255.255')->toInteger());
    }

    /**
     * Test fromInteger method.
     */
    public function testFromInteger()
    {
        self::assertSame('0.0.0.0', IPAddress::fromInteger(0)->__toString());
        self::assertSame('12.34.56.78', IPAddress::fromInteger(203569230)->__toString());
        self::assertSame('127.255.255.255', IPAddress::fromInteger(2147483647)->__toString());
        self::assertSame('128.0.0.0', IPAddress::fromInteger(-2147483648)->__toString());
        self::assertSame('192.168.0.1', IPAddress::fromInteger(-1062731775)->__toString());
        self::assertSame('255.255.255.255', IPAddress::fromInteger(-1)->__toString());
        self::assertSame('128.0.0.0', IPAddress::fromInteger(2147483648)->__toString());
        self::assertSame('192.168.0.1', IPAddress::fromInteger(3232235521)->__toString());
        self::assertSame('255.255.255.255', IPAddress::fromInteger(4294967295)->__toString());
    }
}


text:
<?php
if (!isset($current_board)) {
	?>

<?php echo translate('No board available. Please go to the Project Administration.'); ?>

<?php
			die();
		}
?>


text:
title: Create a Simple Python Server on Raspberry Pi
tags:
- Raspberry Pi
- Python
link: http://www.whatimade.today/data-junkies-part-1/
---


text:
name              "networking"
maintainer        "OpenStreetMap Administrators"
maintainer_email  "admins@openstreetmap.org"
license           "Apache-2.0"
description       "Configures networking"

version           "1.0.0"
depends           "chef"


text:
"""
Here we handle loading of "OTOKO" data (for more info about this format see
the comment in load_otoko_data).  Given the paths of header and data files, we
aim to load the data into numpy arrays for use later.
"""

import itertools
import os
import struct
import numpy as np

class CStyleStruct:
    """A nice and easy way to get "C-style struct" functionality."""
    def __init__(self, **kwds):
        self.__dict__.update(kwds)

class OTOKOParsingError(Exception):
    pass

class OTOKOData:
    def __init__(self, q_axis, data_axis):
        self.q_axis = q_axis
        self.data_axis = data_axis

class OTOKOLoader(object):

    def __init__(self, qaxis_path, data_path):
        self.qaxis_path = qaxis_path
        self.data_path = data_path

    def load_otoko_data(self):
        """
        Loads "OTOKO" data, which is a format that stores each axis separately.
        An axis is represented by a "header" file, which in turn will give details
        of one or more binary files where the actual data is stored.

        Given the paths of two header files, this function will load each axis in
        turn.  If loading is successfull then an instance of the OTOKOData class
        will be returned, else an exception will be raised.

        For more information on the OTOKO file format, please see:
        http://www.diamond.ac.uk/Home/Beamlines/small-angle/SAXS-Software/CCP13/
        XOTOKO.html
        """
        q_axis    = self._load_otoko_axis(self.qaxis_path)
        data_axis = self._load_otoko_axis(self.data_path)

        return OTOKOData(q_axis, data_axis)

    def _load_otoko_axis(self, header_path):
        """
        Loads an "OTOKO" axis, given the header file path.  Essentially, the
        header file contains information about the data in the form of integer
        "indicators", as well as the names of each of the binary files which are
        assumed to be in the same directory as the header.
        """
        if not os.path.exists(header_path):
            raise OTOKOParsingError("The header file %s does not exist." % header_path)

        binary_file_info_list = []
        total_frames = 0
        header_dir = os.path.dirname(os.path.abspath(header_path))

        with open(header_path, "r") as header_file:
            lines = header_file.readlines()
            if len(lines) < 4:
                raise OTOKOParsingError("Expected more lines in %s." % header_path)

            info = lines[0] + lines[1]

            def pairwise(iterable):
                """
                s -> (s0,s1), (s2,s3), (s4, s5), ...
                From http://stackoverflow.com/a/5389547/778572
                """
                a = iter(iterable)
                return itertools.izip(a, a)

            for indicators, filename in pairwise(lines[2:]):
                indicators = indicators.split()

                if len(indicators) != 10:
                    raise OTOKOParsingError(
                        "Expected 10 integer indicators on line 3 of %s." \
                        % header_path)
                if not all([i.isdigit() for i in indicators]):
                    raise OTOKOParsingError(
                        "Expected all indicators on line 3 of %s to be integers." \
                        % header_path)

                binary_file_info = CStyleStruct(
                    # The indicators at indices 4 to 8 are always zero since they
                    # have been reserved for future use by the format.  Also, the
                    # "last_file" indicator seems to be there for legacy reasons,
                    # as it doesn't appear to be something we have to bother
                    # enforcing correct use of; we just define the last file as
                    # being the last file in the list.
                    file_path  = os.path.join(header_dir, filename.strip()),
                    n_channels = int(indicators[0]),
                    n_frames   = int(indicators[1]),
                    dimensions = int(indicators[2]),
                    swap_bytes = int(indicators[3]) == 0,
                    last_file  = int(indicators[9]) == 0 # We don't use this.
                )
                if binary_file_info.dimensions != 1:
                    msg = "File {} has {} dimensions, expected 1. Is it a BSL file?"
                    raise OTOKOParsingError(msg.format(filename.strip(),
                        binary_file_info.dimensions))

                binary_file_info_list.append(binary_file_info)

                total_frames += binary_file_info.n_frames

        # Check that all binary files are listed in the header as having the same
        # number of channels, since I don't think CorFunc can handle ragged data.
        all_n_channels = [info.n_channels for info in binary_file_info_list]
        if not all(all_n_channels[0] == c for c in all_n_channels):
            raise OTOKOParsingError(
                "Expected all binary files listed in %s to have the same number of channels." % header_path)

        data = np.zeros(shape=(total_frames, all_n_channels[0]))
        frames_so_far = 0

        for info in binary_file_info_list:
            if not os.path.exists(info.file_path):
                raise OTOKOParsingError(
                    "The data file %s does not exist." % info.file_path)

            with open(info.file_path, "rb") as binary_file:
                # Ideally we'd like to use numpy's fromfile() to read in binary
                # data, but we are forced to roll our own float-by-float file
                # reader because of the rules imposed on us by the file format;
                # namely, if the swap indicator flag has been raised then the bytes
                # of each float occur in reverse order.
                for frame in range(info.n_frames):
                    for channel in range(info.n_channels):
                        b = bytes(binary_file.read(4))
                        if info.swap_bytes:
                            b = b[::-1] # "Extended slice" syntax, used to reverse.
                        value = struct.unpack('f', b)[0]
                        data[frames_so_far + frame][channel] = value

                frames_so_far += info.n_frames

        return CStyleStruct(
            header_path = header_path,
            data = data,
            binary_file_info_list = binary_file_info_list,
            header_info = info
        )


text:
<?php

namespace Matthias\SymfonyConsoleForm\Bridge\Transformer;

use Matthias\SymfonyConsoleForm\Bridge\Transformer\Exception\CouldNotResolveTransformer;
use Matthias\SymfonyConsoleForm\Form\FormUtil;
use Symfony\Component\Form\FormInterface;

class TypeAncestryBasedTransformerResolver implements TransformerResolver
{
    /**
     * @var FormToQuestionTransformer[]
     */
    private $transformers = [];

    /**
     * @param string                    $formType
     * @param FormToQuestionTransformer $transformer
     */
    public function addTransformer($formType, FormToQuestionTransformer $transformer)
    {
        $this->transformers[$formType] = $transformer;
    }

    /**
     * @param FormInterface $form
     *
     * @throws CouldNotResolveTransformer
     *
     * @return FormToQuestionTransformer
     */
    public function resolve(FormInterface $form)
    {
        $types = FormUtil::typeAncestry($form);

        foreach ($types as $type) {
            if (isset($this->transformers[$type])) {
                return $this->transformers[$type];
            }
        }

        throw new CouldNotResolveTransformer(
            sprintf(
                'Could not find a transformer for any of these types (%s)',
                implode(', ', $types)
            )
        );
    }
}


text:
import html from 'choo/html';
import messages from '../../locales/ptBr';

export default (pages, selectedPage, classes, selectId) => html`
<select
    value=${selectedPage.pageId}
    name=${selectId}
    class=${classes.input}
>
    <option>
        ${messages.channels.facebook.selectAPage}
    </option>
    ${pages.map(page => html`
        <option
            value=${page.id}
            ${(selectedPage.pageId === page.id) ? 'selected' : ''}
        >
            ${page.name}
        </option>
    `)}
</select>`;


text:
1.1.2 / 2017-08-28
==================

 * [IMPROVEMENT] Better logging when a process was not found. See [#609][]

1.1.1 / 2017-07-18
==================

### Changes

* [BUGFIX] Make process validation case-insensitve on Windows See [#479][]

1.1.0 / 2017-06-05
==================

### Changes

* [FEATURE] Add option to collect metrics for children of matched processes. See [#425][]

1.0.1 / 2017-05-11
==================

### Changes

* [BUGFIX] Handle the case where the pidfile doesn't exist. See [#349][]

1.0.0 / 2017-05-08
==================

### Changes

* [FEATURE] adds process integration.

<!--- The following link definition list is generated by PimpMyChangelog --->
[#349]: https://github.com/DataDog/integrations-core/issues/349
[#425]: https://github.com/DataDog/integrations-core/issues/425
[#479]: https://github.com/DataDog/integrations-core/pull/479


text:
System.register([], function (_export) {
  "use strict";

  var _prototypeProperties, latency, id, contacts, WebAPI;

  function getId() {
    return ++id;
  }

  return {
    setters: [],
    execute: function () {
      _prototypeProperties = function (child, staticProps, instanceProps) {
        if (staticProps) Object.defineProperties(child, staticProps);
        if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
      };

      latency = 500;
      id = 0;
      contacts = [{
        id: getId(),
        firstName: "John",
        lastName: "Tolkien",
        email: "tolkien@inklings.com",
        phoneNumber: "867-5309"
      }, {
        id: getId(),
        firstName: "Clive",
        lastName: "Lewis",
        email: "lewis@inklings.com",
        phoneNumber: "867-5309"
      }, {
        id: getId(),
        firstName: "Owen",
        lastName: "Barfield",
        email: "barfield@inklings.com",
        phoneNumber: "867-5309"
      }, {
        id: getId(),
        firstName: "Charles",
        lastName: "Williams",
        email: "williams@inklings.com",
        phoneNumber: "867-5309"
      }, {
        id: getId(),
        firstName: "Roger",
        lastName: "Green",
        email: "green@inklings.com",
        phoneNumber: "867-5309"
      }];
      WebAPI = (function () {
        function WebAPI() {}

        _prototypeProperties(WebAPI, null, {
          getContactList: {
            value: function getContactList() {
              var _this = this;
              this.isRequesting = true;
              return new Promise(function (resolve) {
                setTimeout(function () {
                  var results = contacts.map(function (x) {
                    return {
                      id: x.id,
                      firstName: x.firstName,
                      lastName: x.lastName,
                      email: x.email
                    };
                  });
                  resolve(results);
                  _this.isRequesting = false;
                }, latency);
              });
            },
            writable: true,
            enumerable: true,
            configurable: true
          },
          getContactDetails: {
            value: function getContactDetails(id) {
              var _this2 = this;
              this.isRequesting = true;
              return new Promise(function (resolve) {
                setTimeout(function () {
                  var found = contacts.filter(function (x) {
                    return x.id == id;
                  })[0];
                  resolve(JSON.parse(JSON.stringify(found)));
                  _this2.isRequesting = false;
                }, latency);
              });
            },
            writable: true,
            enumerable: true,
            configurable: true
          },
          saveContact: {
            value: function saveContact(contact) {
              var _this3 = this;
              this.isRequesting = true;
              return new Promise(function (resolve) {
                setTimeout(function () {
                  var instance = JSON.parse(JSON.stringify(contact));
                  var found = contacts.filter(function (x) {
                    return x.id == contact.id;
                  })[0];

                  if (found) {
                    var index = contacts.indexOf(found);
                    contacts[index] = instance;
                  } else {
                    instance.id = getId();
                    contacts.push(instance);
                  }

                  _this3.isRequesting = false;
                  resolve(instance);
                }, latency);
              });
            },
            writable: true,
            enumerable: true,
            configurable: true
          }
        });

        return WebAPI;
      })();
      _export("WebAPI", WebAPI);
    }
  };
});