text:
package com.datatorrent.lib.io;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

import com.datatorrent.api.Context.OperatorContext;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.InputOperator;
import com.datatorrent.common.util.BaseOperator;

/**
 * Generates apache server log entries. The apache access log has the following
 * format
 *
 * %s %h %l %u %t "%r" %s %b "%{Referer}" "%{User-agent}"
 *
 * %s - server name - server0.mydomain.com:80 .......................  server9.mydomain.com:80
 * %h - The ip address of the client
 * %l - The identity of the client typically "-"
 * %u - The username of the user if HTTP authentication was used otherwise "-"
 * %t - The time the request was received e.g., [31/May/2013:08:03:46 -0700]
 * %r - The HTTP request string e.g., "GET /favicon.ico HTTP/1.1"
 * %s - The status code of the response e.g., 404
 * %b - The number of bytes in the response
 * %{Referer} - The referer web site reported by the client, "-" if there is none
 * %{User-agent} - Unique string identifying the client browser e.g.,
 * "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36"
 *
 * Putting it all together a sample log string looks like :
 * --------------------------------------------------------
 * 127.0.0.1 - [31/May/2013:09:05:49 -0700] "GET /favicon.ico HTTP/1.1" 304 210 "-"
 * "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22"
 *
 * @displayName Generate Random Apache Logs
 * @category Input
 * @tags log, input operator, generate
 *
 * @since 0.3.2
 */
@org.apache.hadoop.classification.InterfaceStability.Evolving
public class ApacheGenRandomLogs extends BaseOperator implements InputOperator
{
  /**
   * This is the output port which emits generated log strings.
   */
  public final transient DefaultOutputPort<String> outport = new DefaultOutputPort<String>();

  // server name/ip-address  random variable
  private Random rand = new Random();

  // Apache date format
  private static SimpleDateFormat apapcheDateFormat = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z");

  // http status codes
  private static String[] httpStatusCodes = {"100", "101", "200", "201", "202", "203", "204", "205", "206", "300", "301",
      "301", "302", "303", "304", "305", "306", "307", "400", "401", "402", "403",
      "405", "406", "407", "408", "409", "410", "411", "412", "413", "414",
      "415", "416", "417", "500", "501", "502", "503", "504", "505"};

  // possible url string formats
  private static String[] urlFormats = {
    "mydomain.com/home.php", "mydomain.com/products.php", "mydomain.com/products.php?productid=%d",
    "mydomain.com/solutions.php", "mydomain.com/solutions.php?solutionid=%d", "mydomain.com/support.php",
    "mydomain.com/about.php", "mydomain.com/contactus.php", "mydomain.com/services.php",
    "mydomain.com/services.php?serviceid=%d", "mydomain.com/partners.php", "mydomain.com/partners.php?partnerid=%d"
  };

  // browser id
  private static String[] browserIds = {
    "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/%d Firefox/20.0",
    "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/%d Firefox/18.0",
    "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/%d Fedora/1.0.4-4 Firefox/1.0.",
    "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.10) Gecko/%d CentOS/1.5.0.10-0.1.el4.centos Firefox/1.5.0.10"
  };

  // generate server name and IP address for server
  private int genServerId()
  {
    return rand.nextInt(10);
  }

  private String genServerName(int serverId)
  {
    return new StringBuilder("server").append(new Integer(serverId).toString()).append(".mydomain.com:80").toString();
  }

  private String genIpAddress(int serverId)
  {
    return new StringBuilder().append(rand.nextInt(255))
        .append(".").append(rand.nextInt(255)).append(".").append(rand.nextInt(255))
        .append(".").append(rand.nextInt(255)).toString();
  }

  private String getTimeStamp()
  {
    return new StringBuilder("[").append(apapcheDateFormat.format(new Date())).append("]").toString();
  }

  private String genHttpCode()
  {
    return httpStatusCodes[rand.nextInt(httpStatusCodes.length)];
  }

  private String genUrl()
  {
    String format = urlFormats[rand.nextInt(urlFormats.length)];
    return String.format(format, rand.nextInt(100));
  }

  private String genBrowserId()
  {
    String format = browserIds[rand.nextInt(browserIds.length)];
    return String.format(format, rand.nextInt(100000));
  }

  // generate log string
  private String genLogString(String ipAddress, String browserId, String httpCode, String url)
  {
    // server/ipaddress
    int serverId = genServerId();
    String serverName = genServerName(serverId);
    if (ipAddress == null) {
      ipAddress = genIpAddress(serverId);
    }

    // time
    String logTime = getTimeStamp();

    // url
    if (url == null) {
      url = new StringBuilder("\"").append("GET").append(" ").append(genUrl()).append(" ").append("HTTP/1.1")
          .append("\"").toString();
    }

    // http code
    if (httpCode == null) {
      httpCode = genHttpCode();
    }

    // number of bytes
    int numBytes = rand.nextInt(4000);

    // browser id
    if (browserId == null) {
      browserId = genBrowserId();
    }

    // print
    return new StringBuilder().append(serverName).append(" ").append(ipAddress).append(" - - ").append(logTime)
        .append(" ").append(url).append(" ").append(httpCode).append(" ").append(numBytes).append(" \" \" \"")
        .append(browserId).append("\"").toString();
  }

  @Override
  public void beginWindow(long windowId)
  {
    // TODO Auto-generated method stub

  }

  @Override
  public void endWindow()
  {
    // TODO Auto-generated method stub

  }

  boolean genTuples;
  int attackInterval;

  @Override
  public void setup(OperatorContext context)
  {
    genTuples = true;
    attackInterval = rand.nextInt(10) + 1;
  }

  @Override
  public void teardown()
  {
    genTuples = false;
  }

  @Override
  public void emitTuples()
  {
    attackInterval--;
    String browserId = null;
    String ipAdddress = null;
    if (attackInterval == 0) {
      browserId = genBrowserId();
      ipAdddress = genIpAddress(rand.nextInt(10));
      attackInterval += rand.nextInt(10) + 1;
      for (int i = 0; i < rand.nextInt(3); i++) {
        outport.emit(genLogString(ipAdddress, browserId, "404", null));
      }
      String url = new StringBuilder("\"").append("GET").append(" ").append(genUrl()).append(" ").append("HTTP/1.1")
          .append("\"").toString();
      for (int i = 0; i < rand.nextInt(3); i++) {
        outport.emit(genLogString(ipAdddress, browserId, "404", url));
      }
    }
    for (int i = 0; i < rand.nextInt(100000); i++) {
      outport.emit(genLogString(ipAdddress, browserId, null, null));
    }
  }
}


text:
#include "common/datatypes.h"

class SpectrumPlot : public QwtPlot
{
     Q_OBJECT

public:
     SpectrumPlot(QWidget *parent = NULL, bool withGrid=false);
     ~SpectrumPlot() {
         //qDebug() << "SpectrumPlot::~SpectrumPlot" ;
     }

     void showPeak( double freq, double amplitude ) ;

     void setNewParams( double center_frequency, double bw=0 );
     void setPowerTab( qint64 center_frequency, double *power_dB, int length, double bw=0 );

     void setMaxHoldVisible( bool show );
     void setMinMaxScales( float min, float max );
     void razMaxHold();
     void setShowPeak( bool show ) { show_peak = show ; }

     double getMinScale() { return( min_scale ); }
     double getMaxScale() { return( max_scale ); }

signals:
     void NewDemodFreq(qint64 freq, qint64 delta);

public slots:
     void SLOT_setCurrentRXFreq( double rx_freq , int channel );

private Q_SLOTS:
    void SLOT_selected(const QPointF &pos);

protected:
    virtual void resizeEvent( QResizeEvent * );

private:
    QwtPlotCurve *curve ;
    QwtPlotCurve *curve_maxhold ;
    QwtPlotMarker *mark_max ;

    QwtPlotMarker *mark_rx ;
    QwtPlotMarker *sub_rx ;
    QwtPlotPicker *d_picker ;

    bool show_maxhold ;
    bool show_peak ;

    double s_center_frequency ;
    double s_bw ;
    double max_scale ;
    double min_scale ;

    QSemaphore *semspectrum;

    double *spectrum ;
    double *max_hold ;
    double *frequencies ;
    int last_fft_size;
};

#endif // SPECTRUMPLOT_H

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'
require 'ahoy'

describe Campaign do
  describe 'validations' do
    it 'has a valid factory' do
      expect(build(:campaign)).to be_valid
    end

    it 'is not valid without a name' do
      should validate_presence_of(:name)
    end
  end

  describe '#url_parameters' do
    it 'returns the parameters in the correct format' do
      campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
                                   utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
      campaign.conference = create(:conference)

      result = '?utm_source=google+&utm_medium=advertisement&utm_term=opensource&utm_content=content&utm_campaign=20percent'
      expect(campaign.url_parameters).to eq(result)
    end

    it 'returns only utm_campaign parameter if there are no parameters' do
      campaign = create(:campaign)
      campaign.conference = create(:conference)
      expect(campaign.url_parameters).to eq('?utm_campaign=testcampaign')
    end
  end

  describe '#visits' do
    it 'returns one if there is one visit' do
      campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
                                   utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
      campaign.conference = build(:conference)

      create(:visit, utm_source: 'google+', utm_medium: 'advertisement',
                     utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent', started_at: Time.now)
      expect(campaign.visits_count).to eq(1)
    end

    it 'returns zero if there are no visits' do
      campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
                                   utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
      campaign.conference = create(:conference)

      expect(campaign.visits_count).to eq(0)
    end
  end

  describe '#registrations' do
    it 'returns zero if there are no registration' do
      campaign = build(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
                                  utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
      campaign.conference = build(:conference)

      expect(campaign.registrations_count).to eq(0)
    end
  end

  describe '#submissions' do
    it 'returns zero if there are no submissions' do
      campaign = build(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
                                  utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
      campaign.conference = build(:conference)

      expect(campaign.submissions_count).to eq(0)
    end
  end
end


text:
'use strict';

const { BasePage } = require('kakunin');

class AppearTabularData extends BasePage {
  constructor() {
    super();

    this.url = '/wait-for-appear/table';

    this.tableAppearBtn = $('.colored');
    this.rows = $$('table tr');
    this.indexLocator = $('.index');
    this.descendingIndex = $('.descending-sort');
    this.idLocator = $('.id');
    this.nameLocator = $('.name');
    this.viewButton = $('button.view');
  }
}

module.exports = AppearTabularData;


text:
package io.advantageous.qbit.events.impl;

import io.advantageous.qbit.events.spi.EventConnector;
import io.advantageous.qbit.events.spi.EventTransferObject;
import io.advantageous.qbit.message.Event;

import java.util.function.Predicate;

/**
 * Allows you to modify which events get sent to an event connector.
 * The predicate can inspect the event and decide to send or
 * not to send an event to a given event connector.
 *
 * You would use this for example if you wanted some events replicated to Kafka, but not all events.
 */
public class ConditionalEventConnector implements EventConnector {

    private final Predicate<Event<Object>> handleEvent;
    private final EventConnector eventConnector;

    public ConditionalEventConnector(Predicate<Event<Object>> handleEvent, EventConnector remoteChannel) {
        this.handleEvent = handleEvent;
        this.eventConnector = remoteChannel;
    }

    @Override
    public void forwardEvent(
            final EventTransferObject<Object> event) {
        if (handleEvent.test(event)) {
            eventConnector.forwardEvent(event);
        }
    }
}


text:
# Events

OneAuth use two events, one during login with OAuth/OAuth2 and another to synchronize user login/register with OAuth/OAuth2 database.

This is to ensure authentication between 3rd party providers and your own application authentication works synchronously.

## oneauth.logged

This event will be triggered once user logged in with OAuth or OAuth2, this would be good if you need to get extra information from providers including name, personal information or even profile picture.

	/**
	 * @param   OneAuth\Auth\Client   $client       (instanceof Eloquent)
	 * @param   array                 $user_data    users' data from provider
	 */
	Event::listen('oauth.logged', function ($client, $user_data)
	{
		// do something cool with those information
	});

## oneauth.sync

This event should be fired when the user actually create an account in your application. For example, you may have `User` Eloquent Model and authenticate using `Auth`.

	$login = array('username' => Input::get('username'), 'password' => Input::get('password'));

	if (Auth::attempt($login))
	{
		// get logged user id.
		$user_id = Auth::user()->id;

		// Synced it with oneauth, this will create a relationship between
		// `oneauth_clients` table with `users` table.
		Event::fire('oneauth.sync', array($user_id));
	}


text:
---
layout: post
title:  "Avoid handwriting ACL permissions in Zend Framework"
description: "Zend Framework module for ACL"
date:   2015-03-10 20:34:00 +0100
tags: [ zend framework, library, acl ]
comments: true
author: itrascastro
redirect_from: "/acl-module-zend-framework/"
---

[GitHub repository](https://github.com/itrascastro/TrascastroACL/) |
[Zend Modules](http://zfmodules.com/itrascastro/TrascastroACL) |
[Packagist](https://packagist.org/packages/itrascastro/acl)

One of the things to do in a web application is controlling the access to the different pages. Zend Framework comes with an Acl component for that purpose.

Our task is make a setup of the Acl instance creating the roles, the resources and the permissions of each role over the resources.

One possible solution can be creating a config file with the roles and its allowed routes. You can also use the inheritance system of the Acl for roles.

The problem with that approach is that we will have repeated code in different configuration files: this one for the Acl and the other config files where the routes are defined.

I've created an Acl Module for ZF2 that allows you to put your access control information inside the routes. Something like this:

{% highlight php %}
<?php

array(
    'router' => array(
        'routes' => array(
            'user\users\update' => array(
                'type' => 'Segment',
                'options' => array(
                    'route'    => '/admin/users/update/id/:id/',
                    'constraints' => array(
                        'id' => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'User\Controller\Users',
                        'action'     => 'update',
                        'roles'      => ['admin', 'moderator'],
                    ),
                ),
            ),
        ),
    ),
);
{% endhighlight %}

With that configuration only users with the roles 'admin' or 'user' would be able to access to that route.

The idea is simple, only the user roles defined under the route can access to that route.

If the array 'roles' is empty or if it is not defined, then the route becomes public.

## TrascastroACL Module

I have created a Factory to setup the default Acl service ('Zend\Permissions\Acl\Acl') parsing the routes of the entire application. So now you will have a new Acl Service ready to use with all the roles, resources (routes) and permissions automatically created.

### The code

The GitHub repository for this module is: [TrascastroACL](https://github.com/itrascastro/TrascastroACL)

The factory takes the default Acl service from the container and also takes the configuration array. Then with the 'roles' and the 'routes' defined in config it creates all the resources, roles and allow rules in the Acl service.

The only thing that we have to take care is that each 'route' can have 'child routes', so we have to parse them recursively.

{% highlight php %}
<?php

namespace TrascastroACL\Service\Factory;
use Zend\Permissions\Acl\Acl;
class ACLServiceFactory
{
    /**
     * @var Acl
     */
    private $acl;
    /**
     * @var array
     */
    private $roles;
    public function __invoke($serviceLocator)
    {
        $this->acl      = $serviceLocator->get('Zend\Permissions\Acl\Acl');
        $config         = $serviceLocator->get('config');
        $this->roles    = $config['TrascastroACL']['roles'];
        $routes         = $config['router']['routes'];
        foreach ($this->roles as $role) {
            $this->acl->addRole($role);
        }
        foreach ($routes as $route => $value) {
            $this->parseRoute($route, $value);
        }
        return $this->acl;
    }
    /**
     * parseRoute
     *
     * For each route
     *      - It has not a parent route
     *          - It has not child routes
     *          - It has child routes
     *              - It can be alone (may_terminate == true)
     *              - It can't be alone (may_terminate == false)
     *      - It has a parent route
     *          - It has not child routes
     *          - It has child routes
     *              - It can be alone (may_terminate == true)
     *              - It can't be alone (may_terminate == false)
     *
     * @param string $route
     * @param array $value
     * @param string $parent
     */
    private function parseRoute($route, $value, $parent = null)
    {
        if (!$parent) {
            if (empty($value['child_routes'])) {
                $this->routeRolesToAcl($route, $value);
            } elseif ($value['may_terminate']) {
                $this->routeRolesToAcl($route, $value);
                $this->iterateChildRoutes($route, $value);
            } else {
                $this->iterateChildRoutes($route, $value);
            }
        } else {
            $route = $parent . '/' . $route;
            if (empty($value['child_routes'])) {
                $this->routeRolesToAcl($route, $value);
            } elseif ($value['may_terminate']) {
                $this->routeRolesToAcl($route, $value);
                $this->iterateChildRoutes($route, $value);
            } else {
                $this->iterateChildRoutes($route, $value);
            }
        }
    }
    /**
     * routeRolesToAcl
     *
     * Creates an allow rule in Acl for that route and its allowed roles
     *
     * @param string $route
     * @param array $value
     */
    private function routeRolesToAcl($route, $value)
    {
        $this->acl->addResource($route);
        $routeRoles = !empty($value['options']['defaults']['roles']) ? $value['options']['defaults']['roles'] : $this->roles;
        $this->acl->allow($routeRoles, $route);
    }
    /**
     * iterateChildRoutes
     *
     * Iterates child routes for a given route parsing each child
     *
     * @param string $route
     * @param array $value
     */
    private function iterateChildRoutes($route, $value)
    {
        foreach ($value['child_routes'] as $childRoute => $childValue) {
            $this->parseRoute($childRoute, $childValue, $route);
        }
    }
}
{% endhighlight %}

### Installation and configuration

Installation of TrascastroACL uses composer. For composer documentation, please refer to [getcomposer.org](http://getcomposer.org).

```
php composer.phar require itrascastro/acl:dev-master
```

**Configuration**

- Add the module name 'TrascastroACL' to your config/application.config.php

{% highlight php %}
<?php
array(
    'modules' => array(
        'Application',
        'TrascastroACL',
    ),
);
{% endhighlight %}

- Copy the 'TrascastroACL.global.dist' from TrascastroACL config directory and paste it to config/autoload folder removing the '.dist' termination. Now add your application roles and also add the 'controller' and the 'action' where the ACL will redirect unallowed access tries. You also need to add a role provider:

{% highlight php %}
<?php
return [
    'TrascastroACL' => [
        'roles' => [
            'guest',
            'user',
            'admin',
        ],
        'forbidden' => [
            'controller' => 'YOUR_FORBIDDEN_MANAGER_CONTROLLER',
            'action'     => 'YOUR_FORBIDDEN_MANAGER_ACTION',
        ],
        'role_provider' => 'YOUR_ROLE_PROVIDER',
    ],
];
{% endhighlight %}

The role provider must implement the interface 'TrascastroACL\Provider\RoleProviderInterface':

{% highlight php %}
<?php
namespace TrascastroACL\Provider;

interface RoleProviderInterface
{
    /**
     * @return String
     */
    public function getUserRole();
}
{% endhighlight %}

This is an example of a role provider class:

{% highlight php %}
<?php
namespace User\Provider;

use TrascastroACL\Provider\RoleProviderInterface;
use Zend\Authentication\AuthenticationServiceInterface;
use Zend\Authentication\AuthenticationService;

class RoleProvider implements RoleProviderInterface
{
    /**
     * @var AuthenticationService
     */
    private $authenticationService;

    /**
     * @param AuthenticationServiceInterface $authenticationService
     */
    public function __construct(AuthenticationServiceInterface $authenticationService)
    {
        $this->authenticationService = $authenticationService;
    }

    /**
     * @return String
     */
    public function getUserRole()
    {
        return ($identity = $this->authenticationService->getIdentity()) ? $identity->role : 'guest';
    }
}
{% endhighlight %}

Where the Factory would be as follows:

{% highlight php %}
<?php
namespace User\Provider\Factory;

use User\Provider\RoleProvider;

class RoleProviderFactory
{
    public function __invoke($serviceLocator)
    {
        $authenticationService = $serviceLocator->get('User\Service\Authentication');

        return new RoleProvider($authenticationService);
    }
}
{% endhighlight %}

Do not forget to add your provider to your module.config.php:

{% highlight php %}
<?php
'service_manager' => array(
    'factories' => array(
        // [ ... ]
        'User\Provider\RoleProvider' => 'User\Provider\Factory\RoleProviderFactory',
    ),
),
{% endhighlight %}

### Usage

Now you can manage your application access control from your routes by simply adding a 'roles' key like in this example:

{% highlight php %}
<?php
array(
    'router' => array(
        'routes' => array(
            'user\users\update' => array(
                'type' => 'Segment',
                'options' => array(
                    'route'    => '/admin/users/update/id/:id/',
                    'constraints' => array(
                        'id' => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'User\Controller\Users',
                        'action'     => 'update',
                        'roles'      => ['admin', 'moderator'],
                    ),
                ),
            ),
        ),
    ),
);
{% endhighlight %}

Only users with 'admin' or 'moderator' roles can now access to that route. If you do not create the 'roles' key in a route or you left it empty, then the resource will be public.

#### Accessing the Acl Service

- **From a Controller**

{% highlight php %}
<?php
$acl = $this->serviceLocator->get('TrascastroACL');
{% endhighlight %}

- **onBootstrap**

{% highlight php %}
<?php
namespace MyModule;

use Zend\Mvc\MvcEvent;

class Module implements AutoloaderProviderInterface
{
    public function onBootstrap(MvcEvent $e)
    {
        $sm  = $e->getApplication()->getServiceManager();
        $acl = $sm->get('TrascastroACL');
    }

    ...
}
{% endhighlight %}

- **From Views**

This module provides a View Helper to have access to TrascastroACL in your views:

{% highlight php %}
<?php if ($this->tacl()->isAllowed($this->identity()->role, 'admin\users\update')): ?>
{% endhighlight %}

It is also available using the layout() View Helper:

{% highlight php %}
<?php if ($this->layout()->tacl->isAllowed($this->identity()->role, 'admin\users\update')): ?>
{% endhighlight %}

- **From Layout**

{% highlight php %}
<?php if ($this->tacl()->isAllowed($this->identity()->role, 'admin\users\update')): ?>
{% endhighlight %}

It is also available using a layout variable:

{% highlight php %}
<?php if ($this->tacl->isAllowed($this->identity()->role, 'admin\users\update')): ?>
{% endhighlight %}


text:
cask :v1 => 'sauerbraten' do
  version '2013.01.26'
  sha256 'c6807484fa0d2c42ac774b97f9b21e9eace720e4403abc11b0321b2645d3589d'

  # sourceforge.net is the official download host per the vendor homepage
  url "http://downloads.sourceforge.net/sauerbraten/sauerbraten_#{version.gsub('.','_')}_collect_edition_macosx.dmg"
  name 'Cube 2: Sauerbraten'
  homepage 'http://sauerbraten.org'
  license :oss

  app 'Sauerbraten.app'
end


text: An example application based on [angular2-basic](https://github.com/Mavlarn/angular2-basic).


text:
<?php return array (
  'Select Image' => 'Bild auswählen',
  'Add Image' => 'Bild hinzufügen',
  'Select Video' => 'Video auswählen',
  'Ok' => 'Ok',
  'Cancel' => 'Abbrechen',
  'Image' => 'Bild',
  'URL' => 'URL',
  'Alt' => 'Alt',
  'Update' => 'Aktualisieren',
  'Select' => 'auswählen',
  1 => '1',
  2 => '2',
  3 => '3',
  4 => '4',
  5 => '5',
  6 => '6',
  7 => '7',
  8 => '8',
  9 => '9',
  10 => '10',
  15 => '15',
  20 => '20',
  25 => '25',
  30 => '30',
  33 => '33',
  40 => '40',
  50 => '50',
  100 => '100',
  'Settings' => 'Einstellungen',
  'Widgets' => 'Widgets',
  'Menus' => 'Menüs',
  'Users' => 'Benutzer',
  'Permissions' => 'Berechtigungen',
  'Roles' => 'Rollen',
  'Access' => 'Zugriff',
  'Manage media files' => 'Medien verwalten',
  'Manage menus' => 'Menüs verwalten',
  'Manage widgets' => 'Widgets verwalten',
  'Manage themes' => 'Themes verwalten',
  'Manage extensions' => 'Erweiterungen verwalten',
  'Apply system updates' => 'Systemupdates anwenden',
  'Access admin area' => 'Auf Admin-Bereich zugreifen',
  'Access system settings' => 'Auf Systemeinstellungen zugreifen',
  'Manage user permissions' => 'Benutzerberechtigungen verwalten',
  'Manage users' => 'Benutzer verwalten',
  'Use the site in maintenance mode' => 'Benutze die Seite im Wartungsmodus',
  'Warning: Give to trusted roles only; this permission has security implications.' => 'Warnung: Nur auf vertrauenswürdige Rollen anwenden. Diese Berechtigung hat Auswirkungen auf die Sicherheit.',
  'Cache' => 'Zwischenspeicher',
  'Save' => 'Speichern',
  'Developer' => 'Entwickler',
  'Disable cache' => 'Zwischenspeicher deaktivieren',
  'Clear Cache' => 'Zwischenspeicher leeren',
  'Select Cache to Clear' => 'Wähle den zu löschenden Zwischenspeicher',
  'System Cache' => 'System Zwischenspeicher',
  'Temporary Files' => 'Temporäre Dateien',
  'Clear' => 'Löschen',
  'Title' => 'Titel',
  'Location' => 'Ort',
  'No location found.' => 'Kein Ort gefunden.',
  'Number of Posts' => 'Anzahl Beiträge',
  'Post Content' => 'Inhalt des Beitrags',
  'Don\'t show' => 'Nicht anzeigen',
  'Show on all posts' => 'Zeige alle Beiträge',
  'Only show on first post.' => 'Nur erster Beitrag anzeigen',
  'Unable to retrieve feed data.' => 'Feed-Daten können nicht abgerufen werden',
  'No URL given.' => 'Keine URL angegeben.',
  'Unit' => 'Einheit',
  'Metric' => 'Metrisch',
  'Imperial' => 'Imperial',
  'Dashboard' => 'Dashboard',
  'Widget deleted.' => 'Widget gelöscht.',
  'Widgets reordered.' => 'Widgets neu geordnet.',
  'Pagekit %version% is available.' => 'Pagekit %version% ist verfügbar.',
  'Add Widget' => 'Widget hinzufügen',
  'Select Link' => 'Link auswählen',
  'Add Video' => 'Video hinzufügen',
  'Add Link' => 'Link hinzufügen',
  'Url' => 'Url',
  'Width' => 'Breite',
  'Height' => 'Höhe',
  'Autoplay' => 'Automatisch abspielen',
  'Controls' => 'Steuerelemente',
  'Loop' => 'Wiederholen',
  'Muted' => 'Stumm',
  'Poster Image' => 'Posterbild',
  'File' => 'Datei',
  'Name' => 'Name',
  'Add Folder' => 'Ordner hinzufügen',
  '{0} %count% Files|{1} %count% File|]1,Inf[ %count% Files' => '{0} %count% Dateien|{1} %count% Datei|]1,Inf[ %count% Dateien',
  'Home' => 'Startseite',
  'Folder Name' => 'Verzeichnis Name',
  'Rename' => 'Umbenennen',
  'Upload' => 'Hochladen',
  'No files found.' => 'Keine Dateien gefunden.',
  '{1} %count% File selected|]1,Inf[ %count% Files selected' => '{1} %count% Datei ausgewählt|]1,Inf[ %count% Dateien ausgewählt',
  'Size' => 'Grösse',
  'Modified' => 'Verändert',
  'Invalid path.' => 'Ungültiger Pfad.',
  'Permission denied.' => 'Zugriff verweigert.',
  'Invalid file name.' => 'Ungültiger Dateiname.',
  'Folder already exists.' => 'Ordner existiert bereits.',
  'Directory created.' => 'Verzeichnis erstellt.',
  'Unable to create directory.' => 'Erstellen von Verzeichnis fehlgeschlagen.',
  'Unable to rename.' => 'Umbenennen fehlgeschlagen.',
  'Renamed.' => 'Umbenannt.',
  'Unable to remove.' => 'Entfernen fehlgeschlagen.',
  'Removed selected.' => 'Ausgewählte entfernt.',
  'No files uploaded.' => 'Keine Dateien hochgeladen.',
  'Uploaded file invalid. (%s)' => 'Hochgeladene Datei fehlerhaft. (%s)',
  'Upload complete.' => 'Hochladen erfolgreich.',
  'Unable to upload.' => 'Hochladen nicht möglich.',
  'n/a' => 'n/a',
  '%d Bytes' => '%d Bytes',
  '%d  KB' => '%d KB',
  '%d  MB' => '%d MB',
  '%d  GB' => '%d GB',
  '%d TB' => '%d TB',
  '%d PB' => '%d PB',
  '%d EB' => '%d EB',
  '%d ZB' => '%d ZB',
  '%d YB' => '%d YB',
  'Storage' => 'Speicher',
  'Info' => 'Info',
  'System' => 'System',
  'PHP' => 'PHP',
  'Database' => 'Datenbank',
  'Setting' => 'Einstellungen',
  'Value' => 'Wert',
  'Pagekit Version' => 'Pagekit Version',
  'Web Server' => 'Webserver',
  'User Agent' => 'Benutzerverwaltung',
  'Version' => 'Version',
  'Handler' => 'Handler',
  'Built On' => 'Erstellt mit',
  'Extensions' => 'Erweiterungen',
  'Driver' => 'Treiber',
  'Client' => 'Client',
  'Permission' => 'Recht',
  'Path' => 'Pfad',
  'Status' => 'Status',
  'Writable' => 'beschreibbar',
  'Unwritable' => 'nicht beschreibbar',
  'Mail' => 'E-Mail',
  'From Email' => 'Von E-Mail',
  'From Name' => 'Von Name',
  'Mailer' => 'E-Mail Versand',
  'PHP Mailer' => 'PHP Mailversand',
  'SMTP Mailer' => 'SMTP Mailversand',
  'SMTP Port' => 'SMTP Port',
  'SMTP Host' => 'SMTP Host',
  'SMTP User' => 'SMTP Benutzer',
  'SMTP Password' => 'SMTP Passwort',
  'Show' => 'Zeige',
  'SMTP Encryption' => 'SMTP Verschlüsselung',
  'None' => 'Keine',
  'SSL' => 'SSL',
  'TLS' => 'TLS',
  'Please enable the PHP Open SSL extension.' => 'Bitte aktivieren Sie die PHP Open SSL Erweiterung.',
  'Check Connection' => 'Prüfe Verbindung',
  'Send Test Email' => 'Test E-Mail versenden',
  'Connection established!' => 'Verbindung hergestellt!',
  'Connection not established! (%s)' => 'Mail-Übermittlung fehlgeschlagen! (%s)',
  'Test email!' => 'Test E-Mail!',
  'Testemail' => 'Test E-Mail',
  'Mail successfully sent!' => 'Mail erfolgreich gesendet!',
  'Mail delivery failed!' => 'Mail-Übermittlung fehlgeschlagen!',
  'Mail delivery failed! (%s)' => 'Mail-Übermittlung fehlgeschlagen! (%s)',
  'Localization' => 'Ortschaft',
  'Site Locale' => 'Seiten Lokalisierung',
  'Admin Locale' => 'Admin Lokalisierung',
  'Is your language not available? Please help out by translating Pagekit into your own language on %link%.' => 'Deine Sprache ist nicht verfügbar? Hilf uns auf %link% dabei, Pagekit in deine Sprache zu übersetzen.',
  'Enable debug mode' => 'Debug Modus aktivieren',
  'Enable debug toolbar' => 'Debug Werkzeugleiste aktivieren',
  'Please enable the SQLite database extension.' => 'Bitte aktiviere die SQLite Datenbank Erweiterung.',
  'Menu Title' => 'Menü Titel',
  '%type% saved.' => '%type% gespeichert.',
  'Pages moved to %menu%.' => 'Seiten verschoben zu %menu%.',
  'Trash' => 'Papierkorb',
  'View' => 'Ansehen',
  'Title cannot be blank.' => 'Titel kann nicht leer sein.',
  'Extension' => 'Erweiterung',
  'Code' => 'Code',
  'Meta' => 'Meta',
  'General' => 'Allgemeines',
  'Maintenance' => 'Wartungsmodus',
  'Invalid url.' => 'Ungültige URL',
  'Type' => 'Typ',
  'Link' => 'Link',
  'URL Alias' => 'URL Alias',
  'Redirect' => 'Weiterleitung',
  'Description' => 'Beschreibung',
  'Enable Markdown' => 'Markdown aktivieren',
  'Slug' => 'Slug',
  'Disabled' => 'Deaktiviert',
  'Enabled' => 'Aktiviert',
  'Restrict Access' => 'Eingeschränkter Zugriff',
  'Menu' => 'Menü',
  'Hide in menu' => 'In Menü verstecken',
  'Insert code in the header and footer of your theme. This is useful for tracking codes and meta tags.' => 'Fügt Code in die Kopf- und Fusszeile Ihres Theme ein. Das ist nützlich für Tracking Codes und Meta Tags.',
  'Header' => 'Kopfzeile',
  'Footer' => 'Fusszeile',
  'Site title cannot be blank.' => 'Seiten Titel darf nicht leer sein.',
  'Logo' => 'Logo',
  'Favicon' => 'Favicon',
  'Appicon' => 'Appicon',
  'Offline' => 'Offline',
  'Put the site offline and show the offline message.' => 'Schalte die Seite Offline und zeige eine Wartungsnachricht.',
  'Message' => 'Mitteilung',
  '- Menu -' => 'Menü',
  'Start Level' => 'Start Ebene',
  'Depth' => 'Tiefe',
  'No Limit' => 'Keine Limite',
  'Sub Items' => 'Unterpunkte',
  'Show all' => 'Zeige alle',
  'Show only for active item' => 'Zeige nur für aktives Element',
  'Invalid name.' => 'Ungültiger Name.',
  'Invalid id.' => 'Ungültige ID.',
  'Duplicate Menu Id.' => 'Doppelte Menü ID',
  'Node not found.' => 'Seite nicht gefunden',
  'Invalid slug.' => 'Ungültiger Slug',
  'Invalid type.' => 'Ungültiger Typ',
  'Invalid node type.' => 'Ungültiger ',
  'Pages' => 'Seiten',
  'Page not found.' => 'Seite nicht gefunden.',
  'Insufficient User Rights.' => 'Unzureichende Benutzerrechte.',
  'We\'ll be back soon.' => 'Wir sind bald zurück.',
  'No Frontpage assigned.' => 'Keine Frontseite zugewiesen.',
  'Edit %type%' => '%type% bearbeiten',
  'Add %type%' => '%type% hinzufügen',
  'Add Menu' => 'Menü hinzufügen',
  'Add Page' => 'Seite hinzufügen',
  'No pages found.' => 'Keine Seiten gefunden.',
  'Menu Positions' => 'Menü Positionen',
  '(Currently set to: %menu%)' => '(Aktuell gesetzt: %menu%)',
  'Hidden' => 'Ausgeblendet',
  '_subset' => '_subset',
  'Error' => 'Fehler',
  'Username' => 'Benutzername',
  'Password' => 'Passwort',
  'Login' => 'Login',
  'Remember Me' => 'Erinnere mich',
  'Forgot Password?' => 'Passwort vergessen?',
  'Request Password' => 'Passwort anfordern',
  'Email' => 'E-Mail',
  'Reset Password' => 'Passwort zurücksetzen',
  'Update Pagekit' => 'Pagekit aktualisieren',
  'Pagekit has been updated! Before we send you on your way, we have to update your database to the newest version.' => 'Pagekit wurde Updated! Bevor wir Dich auf den Weg schicken, müssen wir noch deine Datenbank auf die neuste Version updaten.',
  'Visit Site' => 'Seite besuchen',
  'Logout' => 'Ausloggen',
  'Session expired. Please log in again.' => 'Sitzung abgelaufen. Bitte melde dich erneut an.',
  'New' => 'Neu',
  'Filter by' => 'Filtern nach',
  'User Type' => 'Benutzertyp',
  '{0} Registered Users|{1} Registered User|]1,Inf[ Registered Users' => '{0} Registrierte Benutzer|{1} Registrierter Benutzer|]1,Inf[ Registrierte Benutzer',
  'User Login' => 'Benutzer einloggen',
  'User Logout' => 'Benutzer ausloggen',
  'User Registration' => 'Benutzer Registrierung',
  'User Profile' => 'Benutzer Profil',
  'User Password Reset' => 'Benutzer Passwort zurücksetzen',
  'Username cannot be blank and may only contain alphanumeric characters (A-Z, 0-9) and some special characters ("._-")' => 'Der Benutzername darf nicht leer sein und nur alphanumerische Zeichen (A-Z, 0-9) und ein paar spezielle Zeichen ("._-") enthalten.',
  'Name cannot be blank.' => 'Name kann nicht leer sein.',
  'Field must be a valid email address.' => 'Feld muss eine gültige E-Mail Adresse enthalten.',
  'Change password' => 'Passwort wechseln',
  'Last login' => 'Letzter Login',
  'Registered since' => 'Registriert seit',
  'Login Redirect' => 'Login weiterleitung',
  'Logout Redirect' => 'Logout weiterleitung',
  'Logged in' => 'Eingeloggt',
  'Last registered' => 'Zuletzt Registriert',
  'Display' => 'Zeigen',
  'Thumbnail' => 'Miniaturbild',
  'List' => 'Liste',
  'Total Users' => 'Total Benutzer',
  'Hide' => 'ausblenden',
  'Number of Users' => 'Anzahl Benutzer',
  'Latest registered Users' => 'Zuletzt registrierte Benutzer',
  'Latest logged in Users' => 'Zuletzt eingeloggte Benutzer',
  '{0} Logged in Users|{1} Logged in User|]1,Inf[ Logged in Users' => '{0} angemeldete Benutzer|{1} angemeldeter Benutzer|]1,Inf[ angemeldete Benutzer',
  'Hello!' => 'Hallo!',
  'A new user signed up for %site% with the username %username%. Please click the button below to approve the account.' => 'Ein neuer Benutzer hat sich mit dem Benutzernamen %username% für %site% registriert. Klicken Sie auf den Button weiter unten, um den die Registrierung zu erlauben.',
  'Approve Account' => 'Konto genehmigen',
  'Hi %name%!' => 'Hallo %name%!',
  'We got a request to reset your %site% password for %username%. If you ignore this message, your password won\'t be changed.' => 'Wir erhielten eine Anfrage zum Zurücksetzen des Passworts für %username% auf %site%. Wenn Sie diese Nachricht ignorieren, bleibt Ihr Passwort wie bisher.',
  'Thank you for signing up for %site%. Just one more step! Please click the button below to activate your account.' => 'Danke für Ihre Registrierung auf %site%. Es fehlt nur noch ein Schritt! Klicken Sie auf den Button weiter unten, um Ihren Account zu aktivieren.',
  'Activate Account' => 'Konto aktivieren',
  'Welcome to %site%!' => 'Willkommen auf %site%!',
  'We\'re really happy to have you, %name%! Just login with the username %username%.' => 'Wir freuen uns dass Sie zu uns gestossen sind, %name%! Melden Sie sich mit Ihrem Benutzernamen %username% an.',
  'Login Now' => 'Jetzt einloggen',
  'Invalid token. Please try again.' => 'Ungültiger Wert. Bitte versuche es erneut.',
  'Invalid username or password.' => 'Ungültiger Benutzername oder Passwort.',
  'Sign in to your account' => 'Melden Sie sich mit Ihrem Account an',
  'Account activation' => 'Account Aktivierung',
  'Your Profile' => 'Dein Profil',
  'Invalid Password.' => 'Ungültiges Passwort.',
  'Password must be 6 characters or longer.' => 'Das Passwort muss 6 oder mehr Zeichen enthalten.',
  'Complete your registration by clicking the link provided in the mail that has been sent to you.' => 'Schliesse deine Registrierung ab, indem du auf den Link klickst, welcher dir per Mail zugeschickt wurde.',
  'Your user account has been created and is pending approval by the site administrator.' => 'Dein Benutzer Konto wurde erstellt und muss vom Administrator genehmigt werden.',
  'Your user account has been created.' => 'Dein Benutzer Konto wurde erstellt.',
  'Invalid key.' => 'Ungültiger Schlüssel.',
  'Your email has been verified. Once an administrator approves your account, you will be notified by email.' => 'Deine Emailadresse wurde aufgenommen. Sobald dich ein Administrator freigibt, wirst du eine Email erhalten.',
  'The user\'s account has been activated and the user has been notified about it.' => 'Dein Konto wurde noch nicht aktiviert oder geblockt.',
  'Your account has been activated.' => 'Dein Benutzer Konto wurde aktiviert.',
  'Activate your %site% account.' => 'Aktiviere dein %site% Konto.',
  'Unable to send verification link.' => 'Link zur Verifizierung konnte nicht gesendet werden.',
  'Approve an account at %site%.' => 'Überprüfen Sie einen Account auf %site%.',
  'Reset' => 'Zurücksetzen',
  'Enter a valid email address.' => 'Bitte gib eine gültige E-Mail Adresse ein.',
  'Unknown email address.' => 'Unbekannte E-Mail Adresse',
  'Your account has not been activated or is blocked.' => 'Dein Konto wurde noch nicht aktiviert oder geblockt.',
  'Reset password for %site%.' => 'Setze das Passwort für %site% zurück.',
  'Unable to send confirmation link.' => 'Bestätigungslink konnte nicht gesendet werden.',
  'Check your email for the confirmation link.' => 'Überprüfe deine Email für den Bestätigungslink. ',
  'Enter password.' => 'Passwort eintragen',
  'Invalid password.' => 'Passwort ungültig',
  'Your password has been reset.' => 'Ihr Passwort wurde zurückgesetzt.',
  'Reset Confirm' => 'Bestätigung zurücksetzen.',
  'Reset password' => 'Passwort zurücksetzen',
  'Role not found.' => 'Rolle nicht gefunden.',
  'User not found.' => 'Benutzer nicht gefunden.',
  'Password required.' => 'Passwort erforderlich.',
  'Unable to block yourself.' => 'Sie können sich nicht selbst blockieren.',
  'Unable to delete yourself.' => 'Sie können sich nicht selbst löschen.',
  'Edit User' => 'Benutzer editieren',
  'Add User' => 'Benutzer hinzufügen',
  'User Settings' => 'Benutzer Einstellungen',
  'You do not have access to the administration area of this site.' => 'Du hast keinen Zugang zum Administrationsbereich dieser Seite.',
  'Unauthorized' => 'Unauthorisiert',
  'Your account is blocked.' => 'Dein Account ist gesperrt.',
  'Your account has not been activated.' => 'Dein Account ist nicht aktiviert worden.',
  'Slow down a bit.' => 'Etwas langsamer bitte.',
  'Unknown' => 'Unbekannt',
  'Active' => 'Aktiviert',
  'Blocked' => 'Blockiert',
  'Name required.' => 'Name benötigt.',
  'Username is invalid.' => 'Benutzername ist ungültig.',
  'Email is invalid.' => 'E-Mail ist ungültig.',
  'Username not available.' => 'Benutzername nicht verfügbar.',
  'Email not available.' => 'E-Mail nicht verfügbar.',
  'Add Role' => 'Rolle hinzufügen',
  'Registration' => 'Registrierung',
  'Enabled, but approval is required.' => 'Aktiviert, aber eine Zustimmung ist erforderlich.',
  'Verification' => 'Verifizierung',
  'Require e-mail verification when a guest creates an account.' => 'Wenn sich ein Gast registriert, muss er sein Konto per E-Mail aktivieren.',
  'User' => 'Benutzer',
  'No user found.' => 'Kein Benutzer gefunden.',
  '{0} %count% Users|{1} %count% User|]1,Inf[ %count% Users' => '{0} %count% Benutzer|{1} %count% Benutzer|]1,Inf[ %count% Benutzer',
  '{1} %count% User selected|]1,Inf[ %count% Users selected' => '{1} %count% Benuzer ausgewählt|]1,Inf[ %count% Benutzer ausgewählt',
  'Sign in' => 'Anmelden',
  'No account yet?' => 'Sie haben noch keinen Account?',
  'Sign up now' => 'Jetzt registrieren',
  'Invalid Email.' => 'Ungültige E-Mail.',
  'Current Password' => 'Aktuelles Passwort',
  'New Password' => 'Neues Passwort',
  'Create an account' => 'Account erstellen',
  'Email address is invalid.' => 'Die E-Mail Adresse ist ungültig.',
  'Sign up' => 'Registrieren',
  'Already have an account?' => 'Sie haben bereits einen Account?',
  'Login!' => 'Anmelden!',
  'Password Confirmation' => 'Passwort bestätigen',
  'Confirm' => 'bestätigen',
  'Forgot Password' => 'Passwort vergessen',
  'Please enter your email address. You will receive a link to create a new password via email.' => 'Bitte gebe deine Email-Adresse ein. Du bekommst einen Link um ein neues Passwort per Email zu erstellen.',
  'Request password' => 'Passwort anfordern',
  'Hi %username%' => 'Hallo %username%',
  'username' => 'Benutzername',
  'password' => 'Passwort',
  'Unassigned' => 'nicht zugeordnet',
  '{1} %count% Widget moved|]1,Inf[ %count% Widgets moved' => '{1} %count% Widget bewegt|]1,Inf[ %count% Widgets bewegt',
  'All' => 'Alle',
  'Selected' => 'Ausgewählt',
  'Position' => 'Position',
  '- Assign -' => '- zuordnen -',
  'Copy' => 'Kopieren',
  'Edit Widget' => 'Widget bearbeiten',
  'Positions' => 'Positionen',
  'No widgets found.' => 'Keine Widgets gefunden.',
  '{1} %count% Widget selected|]1,Inf[ %count% Widgets selected' => '{1} %count% Widget ausgewählt|]1,Inf[ %count% Widgets ausgewählt',
  'Missing order data.' => 'Fehlende Bestelldaten.',
  'Order saved.' => 'Bestellung gespeichert.',
  'Whoops, looks like something went wrong.' => 'Upps, es ist etwas schief gelaufen.',
  'Your Pagekit database has been updated successfully.' => 'Deine Pagekit Datenbank wurde erfolgreich aktualisiert.',
  'Your database is up to date.' => 'Deine Datenbank ist aktuell.',
  'Installing %title% %version%' => 'Installiere %title% %version%',
  'Removing %title% %version%' => 'Entferne %title% %version%',
  'Version %version%' => 'Version %version%',
  '"%title%" enabled.' => '"%title%" aktiviert.',
  '"%title%" disabled.' => '"%title%" deaktiviert.',
  'Installed' => 'Installiert',
  'Cannot obtain versions. Please try again later.' => 'Kann Versionen nicht abrufen. Bitte später erneut versuchen.',
  'Cannot connect to the server. Please try again later.' => 'Kann nicht zum Server verbinden. Bitte später erneut versuchen.',
  'Whoops, something went wrong.' => 'Upps, etwas ist schief gelaufen.',
  'Install' => 'Installieren',
  'Demo' => 'Demo',
  'Support' => 'Support',
  'Documentation' => 'Dokumentation',
  'Nothing found.' => 'Nichts gefunden.',
  'Cannot connect to the marketplace. Please try again later.' => 'Verbindung zum Marktplatz konnte nicht hergestellt werden. Versuche es bitte später erneut.',
  'There is an update available for the package.' => 'Es ist ein Update für ein Paket verfügbar.',
  'License:' => 'Lizenz:',
  'Homepage:' => 'Webseite:',
  'Email:' => 'E-Mail:',
  'Successfully installed.' => 'Erfolgreich installiert.',
  'Close' => 'Schliessen',
  'Enable' => 'Aktivieren',
  'Successfully removed.' => 'Erfolgreich entfernt.',
  'Pagekit Installer' => 'Pagekit Installier',
  'Marketplace' => 'Marktplatz',
  'Themes' => 'Themes',
  'Unable to find "%name%".' => '"%name%" konnte nicht gefunden werden.',
  'Unable to enable "%name%".' => '"%name%" konnte nicht aktiviert werden.',
  '"%name%" has not been loaded.' => '"%name%" wurde nicht geladen.',
  'No file uploaded.' => 'Keine Datei hochgeladen.',
  '"composer.json" file not valid.' => '"composer.json" ist ungültig.',
  'No Pagekit %type%' => 'Kein Pagekit %type%',
  'Can\'t load json file from package.' => 'Kann JSON Datei aus dem Paket nicht laden.',
  'Unable to activate "%name%".<br>A fatal error occured.' => 'Konnte "%name%".<br>  nicht aktivieren. Es gab einen schweren Fehler.',
  'You may not call this step directly.' => 'Du kannst diesen Schritt nicht direkt ausführen.',
  'Existing Pagekit installation detected. Choose different table prefix?' => 'Bereits existierende Pagekit Installation entdeckt. Anderen Tabellen-Präfix wählen?',
  'Database connection failed!' => 'Datenbank Verbindung fehlgeschlagen!',
  'Database access denied!' => 'Datenbank Zugriff verweigert!',
  'No database connection.' => 'Keine Datenbank Verbindung.',
  'Can\'t write config.' => 'Config kann nicht geschrieben werden.',
  'Database error: %error%' => 'Datenbank Fehler: %error%',
  'Package path is missing.' => 'Paket Pfad fehlt.',
  'Removing package folder.' => 'Paket Ordner entfernen.',
  '\'composer.json\' is missing.' => '\'composer.json\' fehlt.',
  'Folder' => 'Ordner',
  'No extension found.' => 'Keine Erweiterung gefunden.',
  'Choose language' => 'Sprache auswählen',
  'Select your site language.' => 'Wähle deine Seitensprache.',
  'Next' => 'Weiter',
  'Connect database' => 'Datenbank verbinden',
  'Enter your database connection details.' => 'Datenbank Verbindungsdetails eintragen.',
  'Hostname' => 'Host Name',
  'Host cannot be blank.' => 'Host darf nicht leer sein.',
  'User cannot be blank.' => 'Benutzer kann nicht leer sein.',
  'Database Name' => 'Datenbank Name',
  'Database name cannot be blank.' => 'Datenbank Name darf nicht leer sein.',
  'Table Prefix' => 'Tabellen Präfix',
  'Prefix must start with a letter and can only contain alphanumeric characters (A-Z, 0-9) and underscore (_)' => 'Der Präfix muss mit einem Buchstaben beginnen und darf nur alphanumerische Zeichen (A-Z, 0-9) und Unterstriche (_) enthalten',
  'Setup your site' => 'Seite einrichten',
  'Choose a title and create the administrator account.' => 'Wähle einen Titel und erstelle einen Administrator Account.',
  'Site Title' => 'Seiten Titel',
  'Password cannot be blank.' => 'Passwort darf nicht leer sein.',
  'Installation failed!' => 'Installation fehlgeschlagen',
  'Retry' => 'Erneut versuchen',
  'No theme found.' => 'Keine Themes gefunden.',
  'There is an update available.' => 'Es ist keine Aktualisierung verfügbar.',
  'You have the latest version of Pagekit.' => 'Du hast die neuste Version von Pagekit.',
  'You have the latest version of Pagekit. You do not need to update. However, if you want to re-install version %version%, you can download the package and re-install manually.' => 'Du hast die neuste Version von Pagekit und brauchst deshalb kein Update. Wie auch immer wenn du die Version %version% neu installieren möchtest kannst du das Paket herunterladen und Manuell installieren.',
  'Download %version%' => '%version% herunterladen',
  'Changelog' => 'Änderungsprotokoll',
);


text:
build with `overflow: hidden`

> codepen:
> [CSS image] hummingbird
> http://codepen.io/Rplus/pen/rjbpGm

inspired from [Tom Anders Watkins](https://www.behance.net/tomanders)'s [Animal Logos Vol 1](https://www.behance.net/gallery/16129389/Animal-Logos-Vol-1)


text:
package models

import anorm.SqlParser._
import anorm._
import play.api.Play.current
import play.api.db._

import scala.language.postfixOps

case class User(username: String, password: String, admin: Boolean = false) {
  def toAdmin =
    copy(admin = true)
}

object User {
  /**
    * Parse a User from a ResultSet
    */
  val simple = {
    get[String]("username") ~ get[String]("password") ~ get[Boolean]("admin") map {
      case username ~ password ~ admin => User(username, password, admin)
    }
  }

  /**
    * Get a user by its username
    */
  def findByUsername(username: String) = {
    DB.withConnection { implicit connection =>
      SQL("select * from user where username = {username}")
        .on('username -> username)
        .as(simple.singleOpt)
    }
  }

  /**
    * Get a user ID by its username and password
    */
  def findByCredentials(username: String, password: String) = {
    DB.withConnection { implicit connection =>
      SQL(s"select * from user where username = '${username}' and password = '${password}'")
        .as(simple.singleOpt)
    }
  }

  /**
    * Count number of users
    */
  def count() = {
    DB.withConnection { implicit connection =>
      SQL("select count(*) from user")
        .as(scalar[Long].single)
    }
  }

  /**
    * Check whether the user table is empty
    */
  def isEmpty = count() == 0

  /**
    * Insert a new user
    *
    * @param user The user values.
    */
  def insert(user: User) = {
    DB.withConnection { implicit connection =>
      SQL(
        """
          insert into user set
            username = {username},
            password = {password},
            admin = {admin}
        """
      ).on(
        'username -> user.username,
        'password -> user.password,
        'admin -> user.admin
      ).executeUpdate()
    }
  }

  /**
    * Delete a computer.
    *
    * @param username Username of the user to delete.
    */
  def delete(username: String) = {
    DB.withConnection { implicit connection =>
      SQL("delete from user where username = {username}").on('username -> username).executeUpdate()
    }
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.dmallcott.dismissibleimageview.DismissibleImageView
        android:id="@+id/activity_main_dismissibleImageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</android.support.constraint.ConstraintLayout>


text:
package com.cleveroad.cyclemenusample;

import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.cleveroad.sy.cyclemenuwidget.CycleMenuWidget;
import com.cleveroad.sy.cyclemenuwidget.OnMenuItemClickListener;
import com.cleveroad.sy.cyclemenuwidget.OnStateChangedListener;
import com.cleveroad.sy.cyclemenuwidget.StateSaveListener;

import java.util.Arrays;

public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ItemHolder> implements OnItemCycleMenuStateChangedListener, StateSaver {

    private static final int COUNT = 20;

    private Context mContext;
    private boolean[] mMenuStatesOpen = {true, true, false, true, false, true, false, true, false, true, true, true, false, true, false, true, false, true, false, true,};

    private int[] mPositions = new int[COUNT];
    private double[] mAngles = new double[COUNT];

    RecyclerViewAdapter(Context context) {
        mContext = context;
        Arrays.fill(mAngles, CycleMenuWidget.UNDEFINED_ANGLE_VALUE);
        Arrays.fill(mPositions, RecyclerView.NO_POSITION);
    }

    @Override
    public int getItemViewType(int position) {
        return position % 5;
    }

    @Override
    public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view;
        if (viewType != 4) {
            view = LayoutInflater.from(mContext).inflate(R.layout.item_example, parent, false);
            CycleMenuWidget cycleMenuWidget = (CycleMenuWidget) view.findViewById(R.id.itemCycleMenuWidget);
            switch (viewType) {
                case 0:
                    cycleMenuWidget.setMenuRes(R.menu.cycle_menu_22);
                    cycleMenuWidget.setCorner(CycleMenuWidget.CORNER.LEFT_TOP);
                    break;
                case 1:
                    cycleMenuWidget.setMenuRes(R.menu.cycle_menu_3);
                    cycleMenuWidget.setCorner(CycleMenuWidget.CORNER.LEFT_BOTTOM);
                    break;
                case 2:
                    cycleMenuWidget.setMenuRes(R.menu.cycle_menu_4);
                    break;
                default:
                    cycleMenuWidget.setMenuRes(R.menu.cycle_menu_5);
                    cycleMenuWidget.setCorner(CycleMenuWidget.CORNER.RIGHT_BOTTOM);
                    break;
            }
        } else {
            view = LayoutInflater.from(mContext).inflate(R.layout.item_example_2, parent, false);
            RelativeLayout layout = (RelativeLayout) view;
            CycleMenuWidget cycleMenuWidget = new CycleMenuWidget(mContext);
            cycleMenuWidget.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            cycleMenuWidget.setId(R.id.itemCycleMenuWidget);
            cycleMenuWidget.setMenuRes(R.menu.cycle_menu_22);
            cycleMenuWidget.setCorner(CycleMenuWidget.CORNER.LEFT_BOTTOM);
            cycleMenuWidget.setRippleColor(Color.argb(100, 200, 100, 100));
            layout.addView(cycleMenuWidget);
        }
        return new ItemHolder(view, this, this);
    }

    @Override
    public void onBindViewHolder(RecyclerViewAdapter.ItemHolder holder, int position) {
        holder.mCycleMenuWidget.setCurrentPosition(mPositions[position]);
        holder.mCycleMenuWidget.setCurrentItemsAngleOffset(mAngles[position]);
        if (mMenuStatesOpen[position]) {
            holder.mCycleMenuWidget.open(false);
        } else {
            holder.mCycleMenuWidget.close(false);
        }
    }

    @Override
    public int getItemCount() {
        return COUNT;
    }

    @Override
    public void onOpen(int position) {
        Log.e("onOpenComplete", "onOpenComplete " + position + " " + mMenuStatesOpen.length);
        if (position >= 0 && position < mMenuStatesOpen.length) {
            mMenuStatesOpen[position] = true;
        }
    }

    @Override
    public void onClose(int position) {
        Log.e("onCloseComplete", "onCloseComplete " + position + " " + mMenuStatesOpen.length);
        if (position >= 0 && position < mMenuStatesOpen.length) {
            mMenuStatesOpen[position] = false;
        }
    }

    @Override
    public void saveState(int adapterPosition, int itemPosition, double lastItemAngleShift) {
        mPositions[adapterPosition] = itemPosition;
        mAngles[adapterPosition] = lastItemAngleShift;
    }

    static class ItemHolder extends RecyclerView.ViewHolder implements OnStateChangedListener, StateSaveListener, OnMenuItemClickListener {

        private CycleMenuWidget mCycleMenuWidget;
        private OnItemCycleMenuStateChangedListener mListener;
        private StateSaver saver;

        ItemHolder(View itemView, OnItemCycleMenuStateChangedListener listener, StateSaver saver) {
            super(itemView);
            this.mListener = listener;
            mCycleMenuWidget = (CycleMenuWidget) itemView.findViewById(R.id.itemCycleMenuWidget);
            mCycleMenuWidget.setStateChangeListener(this);
            mCycleMenuWidget.setStateSaveListener(this);
            mCycleMenuWidget.setOnMenuItemClickListener(this);
            mCycleMenuWidget.setScalingType(CycleMenuWidget.RADIUS_SCALING_TYPE.FIXED);
            this.saver = saver;
        }

        @Override
        public void saveState(int itemPosition, double lastItemAngleShift) {
            if (saver != null) {
                saver.saveState(getAdapterPosition(), itemPosition, lastItemAngleShift);
            }
        }

        @Override
        public void onStateChanged(CycleMenuWidget.STATE state) {
            if (mListener == null) {
                return;
            }
            //Will save state in process because user can scroll to next item and onOpenComplete or onCloseComplete will not be received due to reuse of holder.
            if (state == CycleMenuWidget.STATE.IN_OPEN_PROCESS) {
                mListener.onOpen(getAdapterPosition());
            }
            if (state == CycleMenuWidget.STATE.IN_CLOSE_PROCESS) {
                mListener.onClose(getAdapterPosition());
            }
        }

        @Override
        public void onOpenComplete() {

        }

        @Override
        public void onCloseComplete() {

        }

        @Override
        public void onMenuItemClick(View view, int itemPosition) {
            Log.i("onMenuItemClick", "Click view id = " + view.getId() + " itemPosition = " + itemPosition);
            Toast.makeText(view.getContext(), "Click id = " + view.getId() + " itemPosition = " + itemPosition, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onMenuItemLongClick(View view, int itemPosition) {
            Log.i("onMenuItemLongClick", "LongClick view id = " + view.getId() + " itemPosition = " + itemPosition);
            Toast.makeText(view.getContext(), "LongClick id = " + view.getId() + " itemPosition = " + itemPosition, Toast.LENGTH_SHORT).show();
        }
    }

}


text:
local S = factory.S

---
-- the base for electronic devices
-- @type device
local device = {}

factory.electronics = {
  device = device
}

--- #list<#table> facedir table for iterating
local facedir_to_dir = {
	{x= 0, y=0,  z= 1},
	{x= 1, y=0,  z= 0},
	{x= 0, y=0,  z=-1},
	{x=-1, y=0,  z= 0},
	{x= 0, y=-1, z= 0},
	{x= 0, y=1,  z= 0},
}

---
-- set the infotext of a device:
-- the device's description, status, energy and max charge as infotext
--
-- @function [parent=#device] set_infotext
-- @param #userdata meta the metadata of the device
function device.set_infotext(meta)
	local desc = meta:get_string("factory_description")
	local status = meta:get_string("factory_status")
	if status ~= "" then
		desc = S("@1status: @2",desc.."\n",status)
	end
	local charge = meta:get_int("factory_energy") .. "/" .. meta:get_int("factory_max_charge")
	meta:set_string("infotext", S("@1charge: @2", desc.."\n", charge))
end

---
-- gets the current amount of energy
-- stored in the device
--
-- @function [parent=#device] get_energy
-- @param #userdata meta the metadata of the device
-- @return #number the energy sored in the device
function device.get_energy(meta)
	return meta:get_int("factory_energy")
end

---
-- sets the current amount of energy
-- stored in the device
--
-- @function [parent=#device] set_energy
-- @param #userdata meta the metadata of the device
-- @param #number value the energy that will be stored in the device
function device.set_energy(meta,value)
	meta:set_int("factory_energy", value)
	device.set_infotext(meta)
end

---
-- sets the description of the device
-- shown in the infotext
--
-- @function [parent=#device] set_name
-- @param #userdata meta the metadata of the device
-- @param #string device_name the name of the device
function device.set_name(meta,device_name)
	meta:set_string("factory_description", device_name)
	device.set_infotext(meta)
end

---
-- sets the status of the device
-- shown in the infotext
--
-- @function [parent=#device] set_status
-- @param #userdata meta the metadata of the device
-- @param #string status the status of the device
function device.set_status(meta,status)
	meta:set_string("factory_status", status)
	device.set_infotext(meta)
end

---
-- sets the max charge,
-- the maximal amount of energy that can be stored in the device
--
-- @function [parent=#device] set_max_charge
-- @param #userdata meta the metadata of the device
-- @param #number max_charge the maximal mount of energy
function device.set_max_charge(meta,max_charge)
	meta:set_int("factory_max_charge", max_charge)
	device.set_infotext(meta)
end

---
-- gets the max charge,
-- the maxmimal amount of energy that ca be stored in the device
--
-- @function [parent=#device] get_max_charge
-- @param #userdata meta the metadata of the device
-- @return #number the maximal mount of energy
function device.get_max_charge(meta)
	return meta:get_int("factory_max_charge")
end

---
-- stores energy into the device
-- if too much energy is pushed it's not stored but returned
--
-- @function [parent=#device] store
-- @param #userdata meta the metadata of the device
-- @param #number push_energy the energy pushed to the device
-- @param #number max_amount an extra limit apart from the max_charge
-- @return #number the amount of energy that was not stored into the device
function device.store(meta, push_energy, max_amount)
  assert(push_energy >= 0, "energy amount should not be negative")
	local energy = device.get_energy(meta)
	local max_energy = device.get_max_charge(meta)
	local taken = math.min(push_energy, max_energy - energy)
	if max_amount ~= nil and max_amount >= 0 then
	 taken = math.min(taken, max_amount)
	end
	device.set_energy(meta, taken + energy)
	return push_energy - taken
end

---
-- tries to use the energy
-- if there is enough it's taken and true is returned else false is returned
--
-- @function [parent=#device] try_use
-- @param #userdata meta the metadata of the device
-- @param #number energy_amount the amount of energy that is to be used
-- @return #boolean if the energy was consumed or not
function device.try_use(meta,energy_amount)
  assert(energy_amount >= 0, "energy amount should not be negative")
	local energy = device.get_energy(meta)
	if energy >= energy_amount then
		device.set_energy(meta, energy - energy_amount)
		return true
	else
		return false
	end
end

---
-- check if a given node is a factory device,
-- the item group of the node will be checked for factory_electronic
--
-- @function [parent=#electronics] is_device
-- @param #userdata node the node to be checked
-- @return #boolean whether the group is present
function factory.electronics.is_device(node)
	local nname = factory.get_node_name(node)
	return minetest.get_item_group(nname, "factory_electronic") > 0
end

---
-- try to distribute energy
-- to the surrounding devices
--
-- @function [parent=#device] distribute
-- @param #table pos the position of the energy source
-- @param #number energy_amount the amount of energy to be distributed
-- @param #number max_amount the maximal amount of energy distributed to each side
-- @return #number the energy that was not distributed
function device.distribute(pos,energy_amount, max_amount)
  assert(energy_amount >= 0, "energy amount should not be negative")
	local remain = energy_amount
	for _,dir in pairs(facedir_to_dir) do
		if remain == 0 then
			break
		end
		local nodepos = vector.add(pos,dir)
		local node = minetest.get_node(nodepos)
		if factory.electronics.is_device(node) then
			local nodedef = minetest.registered_nodes[node.name]
			if nodedef then
				local pushfunc = nodedef.on_push_electricity
				if pushfunc then
				  local pushed_energy = remain
				  if max_amount ~= nil and max_amount >= 0 then
				    pushed_energy = math.min(pushed_energy,max_amount)
				  end
				  local extra = remain - pushed_energy
					remain = pushfunc(nodepos,pushed_energy) + extra
				end
			end
		end
	end
	return remain
end

return device


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Splorr.Services
{
    public enum RecipeType
    {
        WoodAxe,
        WoodPickaxe,
        WoodShovel,
        WoodHoe,
        WoodHammer,
        WoodKnife
    }
    public static class RecipeTypeExtensions
    {
        public static List<ItemInstance> GetInputs(this RecipeType recipeType)
        {
            List<ItemInstance> result = new List<ItemInstance>();
            switch(recipeType)
            {
                case RecipeType.WoodAxe:
                case RecipeType.WoodPickaxe:
                    result.AddNewItems(ItemType.Log, 5);
                    break;
                case RecipeType.WoodHoe:
                case RecipeType.WoodHammer:
                    result.AddNewItems(ItemType.Log, 4);
                    break;
                case RecipeType.WoodShovel:
                    result.AddNewItems(ItemType.Log, 3);
                    break;
                case RecipeType.WoodKnife:
                    result.AddNewItems(ItemType.Log, 2);
                    break;
            }
            return result.Restack();
        }
        public static List<ItemInstance> GetOutputs(this RecipeType recipeType)
        {
            List<ItemInstance> result = new List<ItemInstance>();
            switch (recipeType)
            {

            }
            return result;
        }
    }
}


text:
package org.testmonkeys.jentitytest.test.integration.validations.validateNotNull.ignoreAnnotation;

import org.junit.Assert;
import org.junit.Test;
import org.testmonkeys.jentitytest.hamcrest.Entity;

public class ValidateNotNullTest {

    @Test
    public void testPassing() {

        SimpleModelWithIgnore expected = new SimpleModelWithIgnore("John", 26);
        SimpleModelWithIgnore actual = new SimpleModelWithIgnore("John", 27);
        Assert.assertThat(actual, Entity.isEqualTo(expected));
    }

    @Test(expected = AssertionError.class)
    public void testFailing() {

        SimpleModelWithIgnore expected = new SimpleModelWithIgnore("Johan", 26);
        SimpleModelWithIgnore actual = new SimpleModelWithIgnore("John", 26);
        Assert.assertThat(actual, Entity.isEqualTo(expected));
    }

    @Test(expected = AssertionError.class)
    public void testFailing2() {

        SimpleModelWithIgnore expected = new SimpleModelWithIgnore("Johan", 26);
        SimpleModelWithIgnore actual = new SimpleModelWithIgnore(null, 26);
        Assert.assertThat(actual, Entity.isEqualTo(expected));
    }
}


text:
package com.start.common.validation-app.common.validation;

import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.metadata.ConstraintDescriptor;

import org.springframework.beans.NotReadablePropertyException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.validation.beanvalidation.SpringValidatorAdapter;

import com.start-app.common.util.ClassUtil;
import com.start-app.common.util.StringUtil;

public class CustomSpringValidatorAdapter extends SpringValidatorAdapter {

	public CustomSpringValidatorAdapter(javax.validation.Validator targetValidator) {
	    super(targetValidator);
    }

	/**
	 *
	 * 因为前端暂时不支持对应的字段显示错误信息, 后端暂时只返回一条错误信息给前台
	 *
	 * 因此只返回ObjectError给异常捕捉层, 异常捕捉层可以根据返回的ObjectError的error message来返回error message
	 *
	 * */
	@Override
	protected void processConstraintViolations(Set<ConstraintViolation<Object>> violations, Errors errors) {
		for (ConstraintViolation<Object> violation : violations) {
			String fieldName = determineField(violation);
			FieldError fieldError = errors.getFieldError(fieldName);
			Class<?> rootBeanCLass = violation.getRootBeanClass();
			if (fieldError == null || !fieldError.isBindingFailure()) {
				try {
					ConstraintDescriptor<?> cd = violation.getConstraintDescriptor();
					String errorCode = determineErrorCode(cd);
					Object[] errorArgs = getArgumentsForConstraint(errors.getObjectName(), fieldName, cd);
					if (errors instanceof BindingResult) {
						BindingResult bindingResult = (BindingResult) errors;
						String[] errorCodes = bindingResult.resolveMessageCodes(errorCode);
						bindingResult.addError(new ObjectError(
								errors.getObjectName(), errorCodes, errorArgs, formatViolationErrorMsg(rootBeanCLass, fieldName, violation.getMessage())));
					}
					else {
						errors.rejectValue(fieldName, errorCode, errorArgs, violation.getMessage());
					}
				}
				catch (NotReadablePropertyException ex) {
					throw new IllegalStateException("JSR-303 validated property '" + fieldName +
							"' does not have a corresponding accessor for Spring data binding - " +
							"check your DataBinder's configuration (bean property versus direct field access)", ex);
				}
			}
		}
	}

	private String formatViolationErrorMsg(Class<?> rootBeanCLass, String fieldName, String msg){
		if (msg.contains("{}")) {
	        MsgParams params = ClassUtil.getAnnotationOnField(rootBeanCLass, fieldName, MsgParams.class);
	        if (params == null) {
	            return msg;
            }
	        String[] originParams = params.value();
	        Object[] args = new Object[originParams.length];
	        System.arraycopy(originParams, 0, args, 0, originParams.length);
	        return StringUtil.fastStringFormat(msg, args);
        }
		return msg;
	}

}


text:
@implementation UIImage (HWBaseControl)

//按比例缩小
- (nonnull UIImage *)HW_imageByScalingAndCroppingForSize:(CGSize)targetSize
{
//    WKWebView *myWebView = [[WKWebView alloc] initWithFrame:<#(CGRect)#> ];
    //如果一样就返回
    if (CGSizeEqualToSize(self.size, targetSize) == YES)  {
        return self;
    }

    CGFloat selfWidth = self.size.width;
    CGFloat selfHeight = self.size.height;

    CGFloat needWidth  = targetSize.width;
    CGFloat neddHeight = targetSize.height;

    //如果原图比你的想要得到的图小返回
    if (selfWidth < needWidth && selfHeight < neddHeight) {
        return self;
    }

    CGFloat wscale = selfWidth/needWidth;
    CGFloat hscale = selfHeight/neddHeight;

    CGFloat scale = (wscale>hscale)?wscale:hscale;
    CGSize newSize = CGSizeMake(selfWidth/scale, selfHeight/scale);

    // 创建一个bitmap的context
    // 并把它设置成为当前正在使用的context
    CGFloat mainScreenScale = [UIScreen mainScreen].scale;
    UIGraphicsBeginImageContextWithOptions(newSize, YES, mainScreenScale);
    [self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return scaledImage;
}

//生成固定大小的二维码
+ (nonnull UIImage *)HW_QRForString:(NSString *)qrString withSize:(CGFloat)size {

    NSData *stringData = [qrString dataUsingEncoding:NSUTF8StringEncoding];
    // 创建filter
    CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
    // 设置内容和纠错级别
    [qrFilter setValue:stringData forKey:@"inputMessage"];
    [qrFilter setValue:@"M" forKey:@"inputCorrectionLevel"];
    // 返回CIImage
    CIImage *outputImage = qrFilter.outputImage;

    CGRect extent = CGRectIntegral(outputImage.extent);
    CGFloat scale = MIN(size/CGRectGetWidth(extent), size/CGRectGetHeight(extent));
    // 创建bitmap;
    size_t width = CGRectGetWidth(extent) * scale;
    size_t height = CGRectGetHeight(extent) * scale;
    CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray();
    CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone);
    CIContext *context = [CIContext contextWithOptions:nil];
    CGImageRef bitmapImage = [context createCGImage:outputImage fromRect:extent];
    CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone);
    CGContextScaleCTM(bitmapRef, scale, scale);
    CGContextDrawImage(bitmapRef, extent, bitmapImage);
    // 保存bitmap到图片
    CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef);
    CGContextRelease(bitmapRef);
    CGImageRelease(bitmapImage);

    UIImage *resultImage = [UIImage imageWithCGImage:scaledImage];
    return resultImage;
}

+ (nonnull UIImage *)HW_singleDotImageWithColor:(nonnull UIColor *)color{

    UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), YES, 0);

    [color setFill];
    UIRectFill(CGRectMake(0, 0, 1, 1));

    UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return result;
}

//转正
- (nonnull UIImage *)HW_fixOrientation{

    // No-op if the orientation is already correct
    if (self.imageOrientation == UIImageOrientationUp)
        return self;

    // We need to calculate the proper transformation to make the image upright.
    // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored.
    CGAffineTransform transform = CGAffineTransformIdentity;

    switch (self.imageOrientation) {
        case UIImageOrientationDown:
        case UIImageOrientationDownMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, self.size.height);
            transform = CGAffineTransformRotate(transform, M_PI);
            break;

        case UIImageOrientationLeft:
        case UIImageOrientationLeftMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, 0);
            transform = CGAffineTransformRotate(transform, M_PI_2);
            break;

        case UIImageOrientationRight:
        case UIImageOrientationRightMirrored:
            transform = CGAffineTransformTranslate(transform, 0, self.size.height);
            transform = CGAffineTransformRotate(transform, -M_PI_2);
            break;
        default:
            break;
    }
    switch (self.imageOrientation) {
        case UIImageOrientationUpMirrored:
        case UIImageOrientationDownMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, 0);
            transform = CGAffineTransformScale(transform, -1, 1);
            break;

        case UIImageOrientationLeftMirrored:
        case UIImageOrientationRightMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.height, 0);
            transform = CGAffineTransformScale(transform, -1, 1);
            break;
        default:
            break;
    }

    // Now we draw the underlying CGImage into a new context, applying the transform
    // calculated above.
    CGContextRef ctx = CGBitmapContextCreate(NULL, self.size.width, self.size.height,
                                             CGImageGetBitsPerComponent(self.CGImage), 0,
                                             CGImageGetColorSpace(self.CGImage),
                                             CGImageGetBitmapInfo(self.CGImage));
    CGContextConcatCTM(ctx, transform);
    switch (self.imageOrientation) {
        case UIImageOrientationLeft:
        case UIImageOrientationLeftMirrored:
        case UIImageOrientationRight:
        case UIImageOrientationRightMirrored:
            // Grr...
            CGContextDrawImage(ctx, CGRectMake(0,0,self.size.height,self.size.width), self.CGImage);
            break;

        default:
            CGContextDrawImage(ctx, CGRectMake(0,0,self.size.width,self.size.height), self.CGImage);
            break;
    }

    // And now we just create a new UIImage from the drawing context
    CGImageRef cgimg = CGBitmapContextCreateImage(ctx);
    UIImage *img = [UIImage imageWithCGImage:cgimg];
    CGContextRelease(ctx);
    CGImageRelease(cgimg);
    return img;
}

@end


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>书中第16页(body,head,和title)</title>

This is the Body of the Page

Anything within the body of a web page is displayed in the main browser window.


text:
% Initialise
close all
clear
clc

% Matrix size
N = 400;

% Number of trials
numTrials = 100;

% Initialise time counters
timeMATLAB = 0;
timeMEX = 0;

% Initialise error counters
absErrorMEX = zeros(numTrials, 1);
relErrorMEX = zeros(numTrials, 1);
absErrorMATLAB = zeros(numTrials, 1);
relErrorMATLAB = zeros(numTrials, 1);

for i = 1 : 1 : numTrials

    % =====================================================================
    % Create a positive definite diagonal matrix
    % =====================================================================
    % Create random positive eigenvalues
    positiveEigs = 10.^sum(rand(N, 3)*diag([1, 1, 0.1]), 2);
    Lambda = abs(diag(positiveEigs));
    % Get a random orthonormal matrix
    [Q, ~] = qr(rand(N));
    % Get a random s.p.d. matrix
    P = Q'*Lambda*Q;
    % =====================================================================

    % Perform Cholesky decomposition
    R = chol(P, 'upper');

    % Get a random downdate vector
    x = (rand(N, 1) - 0.5).*(10.^((rand(N, 1) - 0.5)));

    ticMATLAB = tic;
    RNewMATLAB = cholupdate(R, x, '+');
    timeMATLAB = timeMATLAB + toc(ticMATLAB);

    ticMEX = tic;
    RNewMEX = CholeskyUpdateReal(R, x);
    timeMEX = timeMEX + toc(ticMEX);

    exactPNew = R'*R + x*x';

    absErrorMATLAB(i) = norm(RNewMATLAB'*RNewMATLAB - exactPNew, 'fro');
    relErrorMATLAB(i) = absErrorMATLAB(i)/norm(exactPNew, 'fro');

    absErrorMEX(i) = norm(RNewMEX'*RNewMEX - exactPNew, 'fro');
    relErrorMEX(i) = absErrorMEX(i)/norm(exactPNew, 'fro');

    fprintf('MEX absolute error: %.4e\n', absErrorMEX(i));
    fprintf('MEX relative error: %.4e\n', relErrorMEX(i));
    fprintf('\n');
    fprintf('MATLAB absolute error: %.4e\n', absErrorMATLAB(i));
    fprintf('MATLAB relative error: %.4e\n', relErrorMATLAB(i));
    fprintf('\n\n');
end

fprintf('Total trials:        %12i\n', numTrials);
fprintf('\n');
fprintf('Mean MEX runtime:    %12.4f ms\n', timeMEX*1e3/numTrials);
fprintf('Mean MATLAB runtime: %12.4f ms\n', timeMATLAB*1e3/numTrials);
fprintf('Speedup:             %12.4f x\n', timeMATLAB/timeMEX);
fprintf('\n');
fprintf('Max MEX absolute error:  %.4e\n', max(absErrorMEX));
fprintf('Max MEX relative error:  %.4e\n', max(relErrorMEX));
fprintf('\n');
fprintf('Max MATLAB absolute error:  %.4e\n', max(absErrorMATLAB));
fprintf('Max MATLAB relative error:  %.4e\n', max(relErrorMATLAB));


text:
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;

[CustomEditor(typeof(LeapImageRetriever))]
public class LeapImageRetrieverEditor : Editor {

  private GUIContent _brightTextureGUIContent;
  private GUIContent _rawTextureGUIContent;
  private GUIContent _distortionTextureGUIContent;

  void OnEnable() {
    _brightTextureGUIContent = new GUIContent("Bright Texture");
    _rawTextureGUIContent = new GUIContent("Raw Texture");
    _distortionTextureGUIContent = new GUIContent("Distortion Texture");
  }

  public override void OnInspectorGUI() {
    serializedObject.Update();
    SerializedProperty properties = serializedObject.GetIterator();

    bool useEnterChildren = true;
    while (properties.NextVisible(useEnterChildren) == true) {
      useEnterChildren = false;
      EditorGUILayout.PropertyField(properties, true);
    }

    if (Application.isPlaying) {
      LeapImageRetriever retriever = target as LeapImageRetriever;
      var data = retriever.TextureData;
      var dataType = typeof(Object);

      EditorGUI.BeginDisabledGroup(true);
      EditorGUILayout.ObjectField(_brightTextureGUIContent, data.BrightTexture.CombinedTexture, dataType, true);
      EditorGUILayout.ObjectField(_rawTextureGUIContent, data.RawTexture.CombinedTexture, dataType, true);
      EditorGUILayout.ObjectField(_distortionTextureGUIContent, data.Distortion.CombinedTexture, dataType, true);
      EditorGUI.EndDisabledGroup();
    }

    serializedObject.ApplyModifiedProperties();
  }

}