text:
Docker Image wrapping Certbot client to automate the tasks of obtaining Let's Encrypt certificates.

> Until May 2016, Certbot was named simply letsencrypt or letsencrypt-auto, depending on install method. Instructions on the Internet, and some pieces of the software, may still refer to this older name.

Perfectly working with this reverse proxy: [blacklabelops/nginx](https://github.com/blacklabelops/nginx)

Features:

* Initial setup of Let's Encrypt certificates
* Automatic renewal of Let's Encrypt certificates each month
* Manual creation of new certificates.
* Manual renewal of certificates.

# Requirements

Will not work inside your local environment. In order to generate valid certificates you will have to run this container on your internet host. Certbot does a bidirectional handshake with letsencrypt.org, this means that the container must be reachable under the respective domain name (e.g. mysubdomain.example.com).

# Make It Short!

In short, you can create and renew Let's Encrypt SSL certificates!

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=www.example.com" \
    blacklabelops/letsencrypt install
~~~~

> Will generate certificates inside docker volume! If you want to add new certificates then use 'renew' instead of 'install'. Note: This example works in debug mode!

# How It Works

You can create and renew Let's Encrypt SSL certificates!

Generate the certificates. This is a one time operation!

Example:

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=www.example.com" \
    blacklabelops/letsencrypt install
~~~~

> Will generate the certificates inside Docker volume. If you want to add new certificates then use 'renew' instead of 'install'.

Now setup the container for monthly renewal!

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_DOMAIN1=www.example.com" \
    blacklabelops/letsencrypt
~~~~

> Will renew the specified certificates on 15th at 1:15AM of each month.

# Let's Encrypt Domains

You can specify multiple domains which will be handled by the image. Each domain must be followed by a number:

Note: Multiple domains will result in one certificate with the specified domains! Let's Encrypt currently takes the
certificate specified with LETSENCRYPT_DOMAIN1 as the certificate name for all sub-certificates!

Example:

* Domain1: subdomain1.example.com
* Domain2: www.quitschie.com
* Domain3: mydomain.squeeze.de

Will result in:

~~~~
$ docker run -d \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    -e "LETSENCRYPT_DOMAIN2=www.quitschie.com" \
    -e "LETSENCRYPT_DOMAIN3=mydomain.squeeze.de" \
    blacklabelops/letsencrypt
~~~~

> Will renew the certificate inside its volume /etc/letsencrypt/live/subdomain1.example.com

# Choosing between HTTP and HTTPS

Let's Encrypt uses either HTTP port 80 or HTTPS port 443 for authenticating the domains.

Choose according to the port which is free in your environment and disable the other with
the environment variables HTTP_ENABLED and HTTPS_ENABLED. Both are true by default.

Example using HTTP only:

~~~~
$ docker run -d \
    -p 80:80 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_HTTPS_ENABLED=false" \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt
~~~~

> Will renew the certificates inside its volume /etc/letsencrypt

Example using HTTPS only:

~~~~
$ docker run -d \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_HTTP_ENABLED=false" \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt
~~~~

> Will renew the certificates inside its volume /etc/letsencrypt

# Multiple Accounts

Multiple installations will result in multiple accounts inside /etc/letsencrypt/. Multiple installations need an account ID in order to make the container work!

The account ID's can be found inside the folder: /etc/letsencrypt/accounts/acme-v01.api.letsencrypt.org/directory

Now specify the account ID with the environment variable LETSENCRYPT_ACCOUNT_ID.

Example:

~~~~
$ docker run -d \
    -p 80:80 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_HTTPS_ENABLED=false" \
    -e "LETSENCRYPT_ACCOUNT_ID=YOUR_ACCOUNT_ID_HERE" \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt
~~~~

> Will renew the certificates inside its volume /etc/letsencrypt for the specific account.

# Using Let's Encrypt Manually

You can invoke all functionality manually. Supported commands are:

* install: Automatic initial install. If you use this multiple times then Certbot will create multiple accounts.
* newcert: Simply generate a new certificate.
* renewal: Automatically renew certificate.

Example `install`:

~~~~
$ docker run \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt install
~~~~

Example `newcert`:

~~~~
$ docker run -it \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt newcert
~~~~

Example `renewal`:

~~~~
$ docker run \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_DOMAIN1=subdomain1.example.com" \
    blacklabelops/letsencrypt renewal
~~~~

# Additional Certbot Parameters

You can pass additional parameters to any command!

Example adding Certbot `--expand` parameter:

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_data:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=www.example.com" \
    blacklabelops/letsencrypt install --expand
~~~~

Example adding Certbot `--expand` parameter to periodic task:

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    --name letsencrypt \
    -v letsencrypt_data:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=www.example.com" \
    blacklabelops/letsencrypt jobberd --expand
~~~~

# Letsencrypt and Nginx

Note: This will not work inside on your local comp. You will have to do this inside your target environment.

Steps:

1. Create Docker volume for certificates
1. Create certificates.
1. Start Nginx with certificates.
1. Start Container in renewal mode
1. Start Cron Container for reloading Nginx config

First create a volume for your certificates:

~~~~
$ docker volume create letsencrypt_certificates
~~~~

> Creates volume on hosts hard disk.

Then start the letsencrypt container once and create the certificates.

~~~~
$ docker run --rm \
    -p 80:80 \
    -p 443:443 \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=example.com" \
    blacklabelops/letsencrypt install
~~~~

> This container will handshake with letsencrypt.org and an account and the certificate when successful.

Then create additional volume for ACME handshakes:

~~~~
$ docker volume create letsencrypt_challenges
~~~~

Now you can use the certificate for your reverse proxy! The additional volume will be used for renewal.

~~~~
$ docker run -d \
    -p 443:443 \
    -p 80:80 \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -v letsencrypt_challenges:/var/www/letsencrypt \
    -e "NGINX_REDIRECT_PORT80=true" \
    -e "SERVER1REVERSE_PROXY_LOCATION1=/" \
    -e "SERVER1REVERSE_PROXY_PASS1=http://yourserver" \
    -e "SERVER1HTTPS_ENABLED=true" \
    -e "SERVER1HTTP_ENABLED=true" \
    -e "SERVER1LETSENCRYPT_CERTIFICATES=true" \
    -e "SERVER1CERTIFICATE_FILE=/etc/letsencrypt/live/example.com/fullchain.pem" \
    -e "SERVER1CERTIFICATE_KEY=/etc/letsencrypt/live/example.com/privkey.pem" \
    -e "SERVER1CERTIFICATE_TRUSTED=/etc/letsencrypt/live/example.com/fullchain.pem" \
    --name nginx \
    blacklabelops/nginx
~~~~

> LETSENCRYPT_CERTIFICATES switches on special configuration for Let's Encrypt certificates. E.g. in order to accept certificate challenges

Now start letsencrypt in renewal mode, this will renew certificates each month!

~~~~
$ docker run -d \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -v letsencrypt_challenges:/var/www/letsencrypt \
    -e "LETSENCRYPT_WEBROOT_MODE=true" \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=example.com" \
    --name letsencrypt \
    blacklabelops/letsencrypt
~~~~

> This container will handshake with letsencrypt.org each month on the 15th and renewal the certificate when successful.

Finally start a cron container that will reload the Nginx configuration after the certificates have been renewed!

~~~~
$ docker run -d \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e "JOB_NAME1=ReloadNginx" \
    -e "JOB_COMMAND1=docker exec nginx nginx -s reload" \
    -e "JOB_TIME1=0 0 2 15 * *" \
    -e "JOB_ON_ERROR1=Continue" \
    blacklabelops/jobber:docker
~~~~

> Reloads Nginx configuration each month on the 15th over Docker without restarting Nginx! In order to achieve high availability!

# Certificate File Permissions and Nginx

Certbot creates the certificates with root permissions per default. If you doesn't run Nginx with the root user, a deploy hook that applies appropriate file permissions need to be used. Otherwise, the Nginx container won't start.

~~~~
$ docker run -d \
    -v letsencrypt_certificates:/etc/letsencrypt \
    -v letsencrypt_challenges:/var/www/letsencrypt \
    -e "LETSENCRYPT_WEBROOT_MODE=true" \
    -e "LETSENCRYPT_EMAIL=dummy@example.com" \
    -e "LETSENCRYPT_DOMAIN1=example.com" \
		-e "LETSENCRYPT_CERTIFICATES_UID=1000" \
		-e "LETSENCRYPT_CERTIFICATES_GID=1000" \
    --name letsencrypt \
    blacklabelops/letsencrypt
~~~~

> Changes ownership of all content in /etc/letsencrypt from root.root to 1000.1000 and file permissions of all private keys to user read only.

# References

* [Let's Encrypt](https://letsencrypt.org/)
* [Certbot](https://certbot.eff.org)
* [Certbot Source Code](https://github.com/certbot/certbot)
* [Certbot Documentation](http://letsencrypt.readthedocs.org/en/latest/index.html)
* [Jobber](https://github.com/dshearer/jobber)
* [Docker Homepage](https://www.docker.com/)
* [Docker Userguide](https://docs.docker.com/userguide/)


text:
namespace edash_packager {
namespace media {

/// Represents a queue of bytes.
/// Data is added to the end of the queue via an Push() and removed via Pop().
/// The contents of the queue can be observed via the Peek() method. This class
/// manages the underlying storage of the queue and tries to minimize the
/// number of buffer copies when data is appended and removed.
class ByteQueue {
 public:
  ByteQueue();
  ~ByteQueue();

  /// Reset the queue to the empty state.
  void Reset();

  /// Append new bytes to the end of the queue.
  void Push(const uint8_t* data, int size);

  /// Get a pointer to the front of the queue and the queue size.
  /// These values are only valid until the next Push() or Pop() call.
  void Peek(const uint8_t** data, int* size) const;

  /// Remove a number of bytes from the front of the queue.
  /// @param count specifies number of bytes to be popped.
  void Pop(int count);

 private:
  // Returns a pointer to the front of the queue.
  uint8_t* front() const;

  scoped_ptr<uint8_t[]> buffer_;

  // Size of |buffer_|.
  size_t size_;

  // Offset from the start of |buffer_| that marks the front of the queue.
  size_t offset_;

  // Number of bytes stored in the queue.
  int used_;

  DISALLOW_COPY_AND_ASSIGN(ByteQueue);
};

}  // namespace media
}  // namespace edash_packager

#endif  // MEDIA_BASE_BYTE_QUEUE_H_

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Trident\Component\HttpKernel\Controller;

use Phimple\Container;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Trident\Component\DependencyInjection\ContainerAwareInterface;

/**
 * Controller Resolver
 *
 * @author Elliot Wright <elliot@elliotwright.co>
 */
class ControllerResolver
{
    protected $container;

    /**
     * Constructor.
     *
     * @param Container       $container
     * @param LoggerInterface $logger
     */
    public function __construct(Container $container, LoggerInterface $logger = null)
    {
        $this->container = $container;
    }

    /**
     * Get a callable controller
     *
     * @param  Request $request
     * @param  array   $matched
     * @return callable
     */
    public function getController(Request $request, array $matched)
    {
        if (null !== $request->attributes->get('_controller')) {
            return $this->createController($request->attributes->get('_controller'));
        }

        if ( ! $controller = $matched['_controller']) {
            throw new \InvalidArgumentException('Unable to look for controller as the "_controller" parameter is missing');
        }

        $callable = $this->createController($controller);

        if ( ! is_callable($callable)) {
            throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', $controller, $request));
        }

        return $callable;
    }

    /**
     * Creates the callable from the controller string
     *
     * @param  string $controller
     * @return callable
     */
    protected function createController($controller)
    {
        if (false === strpos($controller, '::')) {
            throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller));
        }

        list($class, $method) = explode('::', $controller, 2);

        if ($this->container->has($class)) {
            $controller = $this->container->get($class);
        } else {
            if ( ! class_exists($class)) {
                throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
            }

            $controller = new $class();
        }

        if ($controller instanceof ContainerAwareInterface) {
            $controller->setContainer($this->container);
        }

        return array($controller, $method);
    }

    /**
     * Get controller action arguments
     *
     * @param  Request $request
     * @param  array   $controller
     * @param  array   $matched
     * @return array
     */
    public function getArguments(Request $request, array $controller, array $matched)
    {
        $reflection = new \ReflectionMethod($controller[0], $controller[1]);
        $attributes = $request->attributes->all();
        $arguments  = [];

        foreach ($reflection->getParameters() as $param) {
            if (array_key_exists($param->name, $matched)) {
                $arguments[] = $matched[$param->name];
            } elseif (array_key_exists($param->name, $attributes)) {
                $arguments[] = $attributes[$param->name];
            } elseif ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
            } else {
                $controller = sprintf('%s::%s()', get_class($controller[0]), $controller[1]);
                throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (either because there is no default value, or because there is a non-optional argument after this one).', $controller, $param->name));
            }
        }

        return $arguments;
    }
}


text:
using System;
using System.CodeDom;

using Orleans.Serialization;

namespace Orleans.CodeGeneration.Serialization
{
    class SerializerGenerationUtilities
    {
        static internal CodeMemberMethod GenerateCopier(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
        {
            var copier = new CodeMemberMethod { Name = name };
            copier.Attributes = (copier.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            copier.Attributes = (copier.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
            copier.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(CopierMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
            copier.ReturnType = new CodeTypeReference(typeof(object));
            copier.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "original"));
            copier.Statements.Add(new CodeVariableDeclarationStatement(typeName, "input", new CodeCastExpression(typeName, new CodeArgumentReferenceExpression("original"))));
            return copier;
        }

        static internal CodeMemberMethod GenerateSerializer(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
        {
            var serializer = new CodeMemberMethod { Name = name };
            serializer.Attributes = (serializer.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            serializer.Attributes = (serializer.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
            serializer.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(SerializerMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
            serializer.ReturnType = new CodeTypeReference(typeof(void));
            serializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "original"));
            serializer.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(BinaryTokenStreamWriter), CodeTypeReferenceOptions.GlobalReference), "stream"));
            serializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Type), "expected"));
            serializer.Statements.Add(new CodeVariableDeclarationStatement(typeName, "input", new CodeCastExpression(typeName, new CodeArgumentReferenceExpression("original"))));
            return serializer;
        }

        static internal CodeMemberMethod GenerateDeserializer(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
        {
            var deserializer = new CodeMemberMethod { Name = name };
            deserializer.Attributes = (deserializer.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            deserializer.Attributes = (deserializer.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
            deserializer.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DeserializerMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
            deserializer.ReturnType = new CodeTypeReference(typeof(object));
            deserializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Type), "expected"));
            deserializer.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(BinaryTokenStreamReader), CodeTypeReferenceOptions.GlobalReference), "stream"));
            return deserializer;
        }
    }
}


text:
<?php

namespace Tomahawk\HttpCore;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;

interface ResponseBuilderInterface
{
    /**
     * @param string $content
     * @param int $status
     * @param array $headers
     * @return Response
     */
    public function content($content = '', $status = 200, $headers = []);

    /**
     * @param $url
     * @param int $status
     * @param array $headers
     * @return RedirectResponse
     */
    public function redirect($url, $status = 302, $headers = []);

    /**
     * @param callable $callback
     * @param int $status
     * @param array $headers
     * @return StreamedResponse
     */
    public function stream(callable $callback, $status = 200, $headers = []);

    /**
     * @param array $data
     * @param int $status
     * @param array $headers
     * @return JsonResponse
     */
    public function json(array $data, $status = 200, $headers = []);

    /**
     * @param $file
     * @param int $status
     * @param array $headers
     * @param bool $public
     * @param $contentDisposition
     * @param bool $autoEtag
     * @param bool $autoLastModified
     * @return BinaryFileResponse
     */
    public function download($file, $status = 200, $headers = [], $public = true, $contentDisposition, $autoEtag = false, $autoLastModified = true);
}


text:
<html>
    <head>
        <title>Chat Demo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
        <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/live.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/chosen.min.css">
    </head>
    <body>
        <!-- <script src="js/socket.io.js" type="text/javascript"></script> -->
        <script src="js/socket.io.min.js" type="text/javascript"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
        <script src="js/chosen.jquery.js"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/lodash/4.16.1/lodash.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/chat.js"></script>
        <style>
            .hidden{
                display: none;
            }
        </style>
        <script type="text/javascript">
            var socket = io("http://chatqlvb.mic.gov.vn");
            var user = {userId:"chtuan"};
            var chatapp = new ChatApp(user,socket,"http://chatqlvb.mic.gov.vn");
            $("body").append(chatapp.dom);
        </script>

    </body>
</html>

<!-- <html>
    <head>
        <title>Chat Demo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
        <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/live.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/chosen.min.css">
    </head>
    <body>
        <script src="http://123.31.10.29:3000/socket.io/socket.io.js" type="text/javascript"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
        <script src="js/chosen.jquery.js"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/lodash/4.16.1/lodash.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/chat.js"></script>
        <style>
            .hidden{
                display: none;
            }
        </style>
        <script type="text/javascript">
            var socket = io("http://123.31.10.29:3000/");
            var user = {userId:"dtthien"};
            var chatapp = new ChatApp(user,socket,"http://123.31.10.29:3000");
            $("body").append(chatapp.dom);
        </script>

    </body>
</html> -->


text:
package com.banka.services.impl;

import com.banka.model.PaymentRequest;
import com.banka.repository.PaymentRequestRepository;
import com.banka.services.PaymentRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
public class PaymentRequestServiceImpl implements PaymentRequestService {

    @Autowired
    PaymentRequestRepository paymentRequestRepository;

    @Override
    public PaymentRequest findOne(Long id) {
        return paymentRequestRepository.getOne(id);
    }

    @Override
    public List<PaymentRequest> findByBankCode(String bankCode) {
        return paymentRequestRepository.findByBankCode(bankCode);
    }

    @Override
    public List<PaymentRequest> findByIdMT(String idMt) {
        return paymentRequestRepository.findByIdMT(idMt);
    }

    @Override
    public PaymentRequest save(PaymentRequest paymentRequest) {
        return paymentRequestRepository.save(paymentRequest);
    }
}


text:
const zlib = require('zlib');

const gzip = zlib.createGzip();
const fs = require('fs');
const inp = fs.createReadStream('input.txt');
const out = fs.createWriteStream('input.txt.gz');

inp.pipe(gzip).pipe(out);


text:
<!DOCTYPE html>

    <title>@if(isset($title)) {{$title}} @else Property Web Builder @endif</title>

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Tenements Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
    {{----}}

    <link href="{{asset('assets/front/css/bootstrap.css')}}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{asset('assets/front/css/style.css')}}" rel="stylesheet" type="text/css" media="all" />

    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/jquery-ui1.css')}}">

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

    <link href="//fonts.googleapis.com/css?family=Oswald:300,400,700&subset=latin-ext" rel="stylesheet">
    <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>

    @yield("page:styles")

Property Web Builder

hello[at]prodsters.com

(+234) 08109276123

                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                    <?php if(!isset($active) || $active == null) $active = ""; ?>

Home

Properties

About Us

Contact Us

                        @if(!Auth::check())

Register/Log In

                        @else

                                    Log Out

                            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                {{ csrf_field() }}
                            </form>
                        @endif

@yield('content')

© <?php echo date('Y'); ?> Prodsters. All Rights Reserved | Design base by W3layouts

{{--footer--}}

@yield("page:scripts")


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>MapAllStringsExceptListTransform</title>
<meta name="date" content="2016-09-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.datavec.api.transform.transform.string

Class MapAllStringsExceptListTransform

java.lang.Object

org.datavec.api.transform.transform.BaseTransform

org.datavec.api.transform.transform.BaseColumnTransform

org.datavec.api.transform.transform.string.BaseStringTransform

org.datavec.api.transform.transform.string.MapAllStringsExceptListTransform

All Implemented Interfaces:

java.io.Serializable, Transform

public class MapAllStringsExceptListTransform
extends BaseStringTransform

This method maps all String values, except those is the specified list, to a single String  value

See Also:

Serialized Form

Field Summary

Fields inherited from class org.datavec.api.transform.transform.BaseColumnTransform

columnName, columnNumber

Fields inherited from class org.datavec.api.transform.transform.BaseTransform

inputSchema

Constructor Summary

Constructors

Constructor and Description

MapAllStringsExceptListTransform(java.lang.String columnName,
                                java.lang.String newValue,
                                java.util.List<java.lang.String> exceptions)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

Text
map(Writable writable)

Methods inherited from class org.datavec.api.transform.transform.string.BaseStringTransform

getNewColumnMetaData

Methods inherited from class org.datavec.api.transform.transform.BaseColumnTransform

equals, hashCode, map, setInputSchema, toString, transform

Methods inherited from class org.datavec.api.transform.transform.BaseTransform

getInputSchema, mapSequence

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

MapAllStringsExceptListTransform

public MapAllStringsExceptListTransform(java.lang.String columnName,
                                        java.lang.String newValue,
                                        java.util.List<java.lang.String> exceptions)

Method Detail

map

public Text map(Writable writable)

Specified by:

map in class BaseStringTransform

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
'use strict';

/**
 * Module dependencies.
 */
var _ = require('lodash'),
	mongoose = require('mongoose'),
	Command = mongoose.model('Command');

exports.getAll = function (req,res) {
	Command.find().exec(function(err, commands) {
		if (err) {
			return res.status(400).send({
				message: 'failure!'
			});
		} else {
			res.json(commands);
		}
	});
};


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

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/class-name-casing */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable no-irregular-whitespace */

import {
  OAuth2Client,
  JWT,
  Compute,
  UserRefreshClient,
  BaseExternalAccountClient,
  GaxiosPromise,
  GoogleConfigurable,
  createAPIRequest,
  MethodOptions,
  StreamMethodOptions,
  GlobalOptions,
  GoogleAuth,
  BodyResponseCallback,
  APIRequestContext,
} from 'googleapis-common';
import {Readable} from 'stream';

export namespace doubleclickbidmanager_v1 {
  export interface Options extends GlobalOptions {
    version: 'v1';
  }

  interface StandardParameters {
    /**
     * Auth client or API Key for the request
     */
    auth?:
      | string
      | OAuth2Client
      | JWT
      | Compute
      | UserRefreshClient
      | BaseExternalAccountClient
      | GoogleAuth;

    /**
     * V1 error format.
     */
    '$.xgafv'?: string;
    /**
     * OAuth access token.
     */
    access_token?: string;
    /**
     * Data format for response.
     */
    alt?: string;
    /**
     * JSONP
     */
    callback?: string;
    /**
     * Selector specifying which fields to include in a partial response.
     */
    fields?: string;
    /**
     * API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
     */
    key?: string;
    /**
     * OAuth 2.0 token for the current user.
     */
    oauth_token?: string;
    /**
     * Returns response with indentations and line breaks.
     */
    prettyPrint?: boolean;
    /**
     * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
     */
    quotaUser?: string;
    /**
     * Legacy upload protocol for media (e.g. "media", "multipart").
     */
    uploadType?: string;
    /**
     * Upload protocol for media (e.g. "raw", "multipart").
     */
    upload_protocol?: string;
  }

  /**
   * DoubleClick Bid Manager API
   *
   * DoubleClick Bid Manager API allows users to manage and create campaigns and reports.
   *
   * @example
   * ```js
   * const {google} = require('googleapis');
   * const doubleclickbidmanager = google.doubleclickbidmanager('v1');
   * ```
   */
  export class Doubleclickbidmanager {
    context: APIRequestContext;

    constructor(options: GlobalOptions, google?: GoogleConfigurable) {
      this.context = {
        _options: options || {},
        google,
      };
    }
  }
}


text:
<?php

namespace SpecGen\StateWorkflowSpecGenBundle\UI\Representation;

use SpecGen\StateWorkflowSpecGenBundle\Domain\IntrospectedState;
use SpecGen\StateWorkflowSpecGenBundle\Domain\IntrospectedTransition;
use SpecGen\StateWorkflowSpecGenBundle\Domain\IntrospectedWorkflow;
use SpecGen\StateWorkflowSpecGenBundle\Domain\Representation\WorkflowRepresentationInterface;

/**
 * @author Guillaume MOREL <github.com/gmorel>
 */
class CytoscapeWorkflowRepresentation implements WorkflowRepresentationInterface
{
    const KEY_STATE = 'nodes';
    const KEY_TRANSITION = 'edges';

    const DEFAULT_STATE_WEIGHT = 50;
    const DEFAULT_TRANSITION_STRENGTH = 20;

    const STATE_SHAPE_ROOT = 'triangle';
    const STATE_SHAPE_NORMAL = 'rectangle';
    const STATE_SHAPE_LEAF = 'ellipse';

    /** @var string */
    private $workflowName;

    /** @var array */
    private $jsonableStates;

    /** @var array */
    private $jsonableTransitions;

    public function __construct(IntrospectedWorkflow $instrospectedWorkflow)
    {
        $this->workflowName = $instrospectedWorkflow->getWorkflowName();
        $colors = $this->assignUniqueColorToStates(
            $instrospectedWorkflow->getIntrospectedStates()
        );

        $this->jsonableStates = $this->createStatesRepresentation(
            $instrospectedWorkflow->getIntrospectedStates(),
            $colors
        );

        $this->jsonableTransitions = $this->createTransitionsRepresentation(
            $instrospectedWorkflow->getIntrospectedTransitions(),
            $colors
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getWorkflowName()
    {
        return $this->workflowName;
    }

    /**
     * {@inheritdoc}
     * @return string JSON
     */
    public function serialize()
    {
        return json_encode(
            array(
                self::KEY_STATE => $this->jsonableStates,
                self::KEY_TRANSITION => $this->jsonableTransitions
            )
        );
    }

    /**
     * @param IntrospectedState[] $introspectedStates
     * @param string[]            $colors
     *
     * @return array
     */
    private function createStatesRepresentation(array $introspectedStates, array $colors)
    {
        $jsonableStates = array();
        foreach ($introspectedStates as $introspectedState) {
            $jsonableStates[] = array(
                'data' => array(
                    'id' => $introspectedState->getKey(),
                    'name' => $introspectedState->getName(),
                    'weight' => self::DEFAULT_STATE_WEIGHT,
                    'faveColor' => $colors[$introspectedState->getKey()],
                    'faveShape' => $this->getStateShape($introspectedState)
                )
            );
        }

        return $jsonableStates;
    }

    /**
     * @param IntrospectedTransition[] $introspectedTransitions
     * @param string[] $colors
     *
     * @return array
     */
    private function createTransitionsRepresentation(array $introspectedTransitions, array $colors)
    {
        $jsonableTransitions = array();
        foreach ($introspectedTransitions as $introspectedTransition) {
            $jsonableTransitions[] = array(
                'data' => array(
                    'source' => $introspectedTransition->getFromIntrospectedState()->getKey(),
                    'target' => $introspectedTransition->getToIntrospectedState()->getKey(),
                    'faveColor' => $colors[$introspectedTransition->getFromIntrospectedState()->getKey()],
                    'strength' => self::DEFAULT_TRANSITION_STRENGTH
                )
            );
        }

        return $jsonableTransitions;
    }

    /**
     * @param IntrospectedState[] $introspectedStates
     *
     * @return string[]
     */
    private function assignUniqueColorToStates(array $introspectedStates)
    {
        $colors = array();
        foreach ($introspectedStates as $introspectedState) {
            $colors[$introspectedState->getKey()] = $this->createUniqueColor($introspectedState->getKey());
        }

        return $colors;
    }

    /**
     * @param IntrospectedState $introspectedState
     *
     * @return string
     */
    private function getStateShape(IntrospectedState $introspectedState)
    {
        if ($introspectedState->isRoot()) {
            return self::STATE_SHAPE_ROOT;
        }

        if ($introspectedState->isLeaf()) {
            return self::STATE_SHAPE_LEAF;
        }

        return self::STATE_SHAPE_NORMAL;
    }

    /**
     * @param int $number
     *
     * @return string
     */
    private function getColorChar($number)
    {
        $modulo = $number % 22;

        if ($modulo < 10) {
            return strrev((string) $modulo);
        }

        $numberMap = array(
            10 => 'A',
            11 => 'B',
            12 => 'C',
            13 => 'D',
            14 => 'E'
        );

        if (isset($numberMap[$number])) {
            return strrev($numberMap[$number]);
        }

        $moduloMap = array(
            21 => 'A',
            20 => 'B',
            19 => 'C',
            18 => 'D',
            17 => 'E'
        );

        if (isset($moduloMap[$modulo])) {
            return strrev($moduloMap[$modulo]);
        }

        return strrev('F');
    }

    /**
     * @param string $initializationVector
     *
     * @return string #FF0000
     * @credits https://github.com/baykall/Php-Unique-HTML-Color-Generator-From-String/blob/master/color.php
     */
    private function createUniqueColor($initializationVector)
    {
        if(empty($initializationVector)) {
            return '#FF0000';
        }

        $length = strlen($initializationVector);
        $color = '';
        for ($i = 1; $i <= 6; $i++) {

            $charNumber = ($i - 1) % $length;
            $color = $color . $this->getColorChar(ord($initializationVector{$charNumber}));
        }

        return '#' . $color;
    }
}


text:
from keystone.resource import controllers  # noqa
from keystone.resource.core import *  # noqa
from keystone.resource import routers  # noqa


text:
package jadx.tests.integration.inner;

import org.junit.jupiter.api.Test;

import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;

import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static jadx.tests.api.utils.JadxMatchers.countString;
import static org.hamcrest.MatcherAssert.assertThat;

public class TestAnonymousClass4 extends IntegrationTest {

	public static class TestCls {
		@SuppressWarnings("unused")
		public static class Inner {
			private int f;
			private double d;

			public void test() {
				new Thread() {
					{
						f = 1;
					}

					@Override
					public void run() {
						d = 7.5;
					}
				}.start();
			}
		}
	}

	@Test
	public void test() {
		ClassNode cls = getClassNode(TestCls.class);
		String code = cls.getCode().toString();

		assertThat(code, containsOne(indent(3) + "new Thread() {"));
		assertThat(code, containsOne(indent(4) + '{'));
		assertThat(code, containsOne("f = 1;"));
		assertThat(code, countString(2, indent(4) + '}'));
		assertThat(code, containsOne(indent(4) + "public void run() {"));
		assertThat(code, containsOne("d = 7.5"));
		assertThat(code, containsOne(indent(3) + "}.start();"));
	}
}


text:
@interface ViewController : UIViewController

@property (strong, nonatomic) UIImageView *avatar;

@end


text:
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace MasterDevs.ChromeDevTools.Protocol.iOS.Console
{
	/// <summary>
	/// Disables console domain, prevents further console messages from being reported to the client.
	/// </summary>
	[Command(ProtocolName.Console.Disable)]
	[SupportedBy("iOS")]
	public class DisableCommand: ICommand<DisableCommandResponse>
	{
	}
}


text:
Omnicoin-Ticker
===============

Static image ticker to display current OMC price.


text:
import unittest

from telemetry.core.chrome import timeline_event

class TimelineEventTest(unittest.TestCase):
  def testChildrenLogic(self):
    # [      top          ]
    #   [ a  ]    [  b  ]
    #    [x]
    top = timeline_event.TimelineEvent('top', 0, 10)
    a = timeline_event.TimelineEvent('a', 1, 2)
    x = timeline_event.TimelineEvent('x', 1.5, 0.25)
    b = timeline_event.TimelineEvent('b', 5, 2)
    top.children.extend([a, b])
    a.children.append(x)

    all_children = top.GetAllChildrenRecursive(include_self=True)
    self.assertEquals([top, a, x, b], all_children)

    self.assertEquals(x.self_time_ms, 0.25)
    self.assertEquals(a.self_time_ms, 1.75) # 2 - 0.25
    self.assertEquals(top.self_time_ms, 6) # 10 - 2 -2


text:
{{+bindTo:partials.standard_nacl_article}}

NOTE:
Deprecation of the technologies described here has been announced
for platforms other than ChromeOS.

Please visit our
migration guide
for details.

NaCl and PNaCl

This document describes the differences between Native Client and
Portable Native Client, and provides recommendations for when to use each.

Native Client (NaCl)

Portable Native Client (PNaCl)

When to use PNaCl

When to use NaCl

Native Client (NaCl)

Native Client enables the execution of native code securely inside web
applications through the use of advanced Software Fault Isolation (SFI)
techniques. Native Client
allows you to harness a client machine’s computational power to a fuller extent
than traditional web technologies. It does this by running compiled C and C++
code at near-native speeds, and exposing a CPU’s full capabilities, including
SIMD vectors and multiple-core processing with shared memory.

While Native Client provides operating system independence, it requires you to
generate architecture-specific executables (nexe) for each hardware
platform. This is neither portable nor convenient, making it ill-suited for the
open web.

The traditional method of application distribution on the web is through self-
contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.)
that can be hosted on a server and run inside a web browser. With this type of
distribution, a website created today should still work years later, on all
platforms. Architecture-specific executables are clearly not a good fit for
distribution on the web. Consequently, Native Client has been until recently
restricted to applications and browser extensions that are installed through the
Chrome Web Store.

Portable Native Client (PNaCl)

PNaCl solves the portability problem by splitting the compilation process
into two parts:

compiling the source code to a bitcode executable (pexe), and

translating the bitcode to a host-specific executable as soon as the module
loads in the browser but before any code execution.

This portability aligns Native Client with existing open web technologies such
as JavaScript. You can distribute a pexe as part of an application (along with
HTML, CSS, and JavaScript), and the user’s machine is simply able to run it.

With PNaCl, you’ll generate a single pexe, rather than multiple platform-
specific nexes. Since the pexe uses an abstract, architecture- and OS-
independent format, it does not suffer from the portability problem described
above. Although, PNaCl can be more efficient on some operating systems than on
others. PNaCl boasts the same level of security as NaCl. Future versions of
hosting environments should have no problem executing the pexe, even on new
architectures. Moreover, if an existing architecture is enhanced, the pexe
doesn’t need to be recompiled. In some cases the client-side translation will
automatically take advantage of new capabilities. A pexe can be part of any web
application. It does not have to be distributed through the Chrome Web Store. In
short, PNaCl combines the portability of existing web technologies with the
performance and security benefits of Native Client.

PNaCl is a new technology, and as such it still has a few limitations
as compared to NaCl. These limitations are described below.

When to use PNaCl

PNaCl is the preferred toolchain for Native Client, and the only way to deploy
Native Client modules without the Google Web Store. Unless your project is
subject to one of the narrow limitations described under “When to use
NaCl”, you should use PNaCl.

Chrome supports translation of pexe modules and their use in web applications
without requiring installation either of a browser plug-in or of the
applications themselves. Native Client and PNaCl are open-source technologies,
and our hope is that they will be added to other hosting platforms in the
future.

If controlled distribution through the Chrome Web Store is an important part of
your product plan, the benefits of PNaCl are less critical for you. But you can
still use the PNaCl toolchain and distribute your application through the Chrome
Web Store, and thereby take advantage of the conveniences of PNaCl, such as not
having to explicitly compile your application for all supported architectures.

When to use NaCl

Use NaCl if any of the following apply to your application:

Your application requires architecture-specific instructions such as, for
example, inline assembly. PNaCl tries to offer high-performance portable
equivalents. One such example is PNaCl’s Portable SIMD Vectors.

Your application uses dynamic linking. PNaCl only supports static linking
with a PNaCl port of the newlib C standard library. Dynamic linking and
glibc are not yet supported in PNaCl. Work is under way to enable dynamic
linking in future versions of PNaCl.

Your application uses certain GNU extensions not supported by PNaCl’s LLVM
toolchain, like taking the address of a label for computed goto, or nested
functions.

{{/partials.standard_nacl_article}}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.compute.samples;

import com.azure.core.credential.TokenCredential;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.management.AzureEnvironment;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.resourcemanager.AzureResourceManager;
import com.azure.resourcemanager.compute.models.CachingTypes;
import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage;
import com.azure.resourcemanager.compute.models.VirtualMachine;
import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes;
import com.azure.resourcemanager.authorization.models.BuiltInRole;
import com.azure.core.management.Region;
import com.azure.core.management.profile.AzureProfile;
import com.azure.resourcemanager.samples.Utils;
import com.azure.resourcemanager.storage.models.StorageAccount;

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

/**
 * Azure Compute sample for managing virtual machines -
 *   - Create a virtual machine with Managed Service Identity enabled with access to resource group
 *   - Set custom script in the virtual machine that
 *          - install az cli in the virtual machine
 *          - uses az cli MSI credentials to create a storage account
 *   - Get storage account created through MSI credentials.
 */
public final class ManageStorageFromMSIEnabledVirtualMachine {
    /**
     * Main function which runs the actual sample.
     *
     * @param azureResourceManager instance of the azure client
     * @return true if sample runs successfully
     */
    public static boolean runSample(AzureResourceManager azureResourceManager) {
        final String linuxVMName = Utils.randomResourceName(azureResourceManager, "VM1", 15);
        final String rgName = Utils.randomResourceName(azureResourceManager, "rgCOMV", 15);
        final String pipName = Utils.randomResourceName(azureResourceManager, "pip1", 15);
        final String userName = "tirekicker";
        final String password = Utils.password();
        final Region region = Region.US_WEST_CENTRAL;

        final String installScript = "https://raw.githubusercontent.com/Azure/azure-libraries-for-java/master/azure-samples/src/main/resources/create_resources_with_msi.sh";
        String installCommand = "bash create_resources_with_msi.sh {stgName} {rgName} {location}";
        List<String> fileUris = new ArrayList<>();
        fileUris.add(installScript);

        try {
            //=============================================================
            // Create a Linux VM with MSI enabled for contributor access to the current resource group

            System.out.println("Creating a Linux VM with MSI enabled");

            VirtualMachine virtualMachine = azureResourceManager.virtualMachines()
                    .define(linuxVMName)
                        .withRegion(region)
                        .withNewResourceGroup(rgName)
                        .withNewPrimaryNetwork("10.0.0.0/28")
                        .withPrimaryPrivateIPAddressDynamic()
                        .withNewPrimaryPublicIPAddress(pipName)
                        .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
                        .withRootUsername(userName)
                        .withRootPassword(password)
                        .withSize(VirtualMachineSizeTypes.STANDARD_DS2_V2)
                        .withOSDiskCaching(CachingTypes.READ_WRITE)
                        .withSystemAssignedManagedServiceIdentity()
                        .withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(BuiltInRole.CONTRIBUTOR)
                        .create();

            System.out.println("Created virtual machine with MSI enabled");
            Utils.print(virtualMachine);

            // Prepare custom script t install az cli that uses MSI to create a storage account
            //
            final String stgName = Utils.randomResourceName(azureResourceManager, "st44", 15);
            installCommand = installCommand.replace("{stgName}", stgName)
                    .replace("{rgName}", rgName)
                    .replace("{location}", region.name());

            // Update the VM by installing custom script extension.
            //
            System.out.println("Installing custom script extension to configure az cli in the virtual machine");
            System.out.println("az cli will use MSI credentials to create storage account");

            virtualMachine
                    .update()
                        .defineNewExtension("CustomScriptForLinux")
                            .withPublisher("Microsoft.OSTCExtensions")
                            .withType("CustomScriptForLinux")
                            .withVersion("1.4")
                            .withMinorVersionAutoUpgrade()
                            .withPublicSetting("fileUris", fileUris)
                            .withPublicSetting("commandToExecute", installCommand)
                            .attach()
                        .apply();

            // Retrieve the storage account created by az cli using MSI credentials
            //
            StorageAccount storageAccount = azureResourceManager.storageAccounts()
                    .getByResourceGroup(rgName, stgName);

            System.out.println("Storage account created by az cli using MSI credential");
            Utils.print(storageAccount);
            return true;
        } finally {
            try {
                System.out.println("Deleting Resource Group: " + rgName);
                azureResourceManager.resourceGroups().beginDeleteByName(rgName);
            } catch (NullPointerException npe) {
                System.out.println("Did not create any resources in Azure. No clean up is necessary");
            } catch (Exception g) {
                g.printStackTrace();
            }
        }
    }

    /**
     * Main entry point.
     * @param args the parameters
     */
    public static void main(String[] args) {
        try {
            //=============================================================
            // Authenticate

            final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
            final TokenCredential credential = new DefaultAzureCredentialBuilder()
                .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
                .build();

            AzureResourceManager azureResourceManager = AzureResourceManager
                .configure()
                .withLogLevel(HttpLogDetailLevel.BASIC)
                .authenticate(credential, profile)
                .withDefaultSubscription();

            // Print selected subscription
            System.out.println("Selected subscription: " + azureResourceManager.subscriptionId());

            runSample(azureResourceManager);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }

    private ManageStorageFromMSIEnabledVirtualMachine() {
    }
}


text:
package com.intellij.execution.junit;

import com.intellij.codeInsight.TestFrameworks;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiClassOwner;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import com.intellij.testIntegration.TestFramework;

public class JUnitDetectionTest extends LightCodeInsightFixtureTestCase {

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myFixture.addClass("package org.junit; public @interface Test {}");
    myFixture.addClass("package org.junit.runners; public class Parameterized { public @interface Parameters {} public @interface Parameter {}}");
    myFixture.addClass("package org.junit.runner; public @interface RunWith {Class value();}");
  }

  public void testInnerClassesForKnownRunners() {
    PsiFile file = myFixture.configureByText("A.java", "import org.junit.Test;\n" +
                                                       "import org.junit.runner.RunWith;\n" +
                                                       "import org.junit.runners.Parameterized;\n" +
                                                       "import java.util.*;\n" +
                                                       "@RunWith(Parameterized.class)\n" +
                                                       "public class A {\n" +
                                                       "  @Parameterized.Parameters\n" +
                                                       "  public static Collection<Object[]> data() {\n" +
                                                       "    return Arrays.asList(new Object[] {\"11\"}, new Object[] {\"12\"});\n" +
                                                       "  }\n" +
                                                       "  @Parameterized.Parameter\n" +
                                                       "  public String myJUnitVersion;\n" +
                                                       "  @Test\n" +
                                                       "  public void ignoredTestMethod() throws Exception {}\n" +
                                                       "  public class Foo {\n" +
                                                       "    public void testMe() {}\n " +
                                                       "  }\n" +
                                                       "}\n");
    PsiClass aClass = ((PsiClassOwner)file).getClasses()[0];
    TestFramework framework = TestFrameworks.detectFramework(aClass);
    assertTrue(framework != null);
    assertTrue(framework.isTestClass(aClass));
    PsiClass innerClass = aClass.getInnerClasses()[0];
    assertFalse(framework.isTestClass(innerClass));
    assertFalse(framework.isTestMethod(innerClass.getMethods()[0]));
  }

  public void testKnownClassInheritor() {
    myFixture.addClass("package p; import org.junit.*; import org.junit.runners.*; public class Theories extends Parameterized {}");
    myFixture.addClass("package p; public @interface Theory {}"); //custom annotation
    PsiFile file = myFixture.configureByText("A.java", "import org.junit.Test;\n" +
                                                       "import org.junit.runner.RunWith;\n" +
                                                       "import p.Theories;\n" +
                                                       "import java.util.*;\n" +
                                                       "@RunWith(Theories.class)\n" +
                                                       "public class A {\n" +
                                                       "  @Theory\n" +
                                                       "  public void validTestMethod(int param) {}\n" +
                                                       "  public class Foo {\n" +
                                                       "    public void testMe() {}\n " +
                                                       "  }\n" +
                                                       "}\n");
    PsiClass aClass = ((PsiClassOwner)file).getClasses()[0];
    TestFramework framework = TestFrameworks.detectFramework(aClass);
    assertNotNull(framework);
    assertTrue(framework.isTestClass(aClass));
    assertTrue(framework.isTestMethod(aClass.getMethods()[0]));
    PsiClass innerClass = aClass.getInnerClasses()[0];
    assertFalse(framework.isTestClass(innerClass));
    assertFalse(framework.isTestMethod(innerClass.getMethods()[0]));
  }
}


text:
<?php

namespace Rwmt\Bundle\RwmtBundle\Entity;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\NoResultException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;

/**
 * UserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class UserRepository extends EntityRepository implements UserProviderInterface
{

    public function loadUserByUsername($username)
    {
        $q = $this
            ->createQueryBuilder('u')
            ->select('u, r')
            ->leftJoin('u.roles', 'r')
            ->where('u.username = :username OR u.email = :email')
            ->setParameter('username', $username)
            ->setParameter('email', $username)
            ->getQuery();

        try {
            // The Query::getSingleResult() method throws an exception
            // if there is no record matching the criteria.
            $user = $q->getSingleResult();
        } catch (NoResultException $e) {
            $message = sprintf(
                'Unable to find an active user identified by "%s".',
                $username
            );
            throw new UsernameNotFoundException($message, 0, $e);
        }

        return $user;
    }

    public function refreshUser(UserInterface $user)
    {

        // this is used for storing authentication in the session
        // but in this example, the token is sent in each request,
        // so authentication can be stateless. Throwing this exception
        // is proper to make things stateless
        throw new UnsupportedUserException();

//        $class = get_class($user);
//        if (!$this->supportsClass($class)) {
//            throw new UnsupportedUserException(
//                sprintf(
//                    'Instances of "%s" are not supported.',
//                    $class
//                )
//            );
//        }
//
//        return $this->find($user->getId());
    }

    public function supportsClass($class)
    {
        return $this->getEntityName() === $class
            || is_subclass_of($class, $this->getEntityName());
    }

    /**
    *
    * getUserRide
    * Returns a single UserRide from the database
    *
    * @param int $id The id of the user
    * @param int $userRideId The id of the RideToUser
    * @param \Doctrine\Orm\Query const $hydrationMode
    * @return array/object
    */
   public function getUserRide($id,$userRideId,$hydrationMode = Query::HYDRATE_ARRAY){
       $q = $this->createQueryBuilder('u')
               ->select('u, ru, r')
               ->innerJoin('u.rides', 'ru')
               ->innerJoin('ru.ride', 'r')
               ->where('u.id = :id')
               ->andWhere('ru.id = :userRideId')
               ->setParameter('id', $id)
               ->setParameter('userRideId', $userRideId)
               ->getQuery();

       return $q->getOneOrNullResult($hydrationMode);
   }

   /**
    *
    * getUserAllRides
    * Returns all rides for a user from the database
    *
    * @param int $id The id of the user
    * @param \Doctrine\Orm\Query const $hydrationMode
    * @return array/object
    */
   public function getUserAllRides($id,$hydrationMode = Query::HYDRATE_ARRAY){
       $q = $this->createQueryBuilder('u')
               ->select('u, ru, r')
               ->innerJoin('u.rides', 'ru')
               ->innerJoin('ru.ride', 'r')
               ->where('u.id = :id')
               ->setParameter('id', $id)
               ->getQuery();

       return $q->execute(null, $hydrationMode);
   }

   /**
    *
    * @param type $token
    * @return object User
    */
   public function getUserForActivation($token)
   {
       $q = $this->createQueryBuilder('u')
               #->select('u')
               ->where('u.confirmationToken = :token')
               ->andWhere('u.isActive = 0')
               ->setParameter('token', $token)
               ->getQuery();

       return $q->getOneOrNullResult();
   }
}


text:
<!DOCTYPE html>

Welcome, ::name::!

            Thank you for joining us at metahill. We can tell, you won't regret it.

            Activating your account is as easy as pie. All you got to do is clicking this activation link. And we will do the rest. Have a great time here!

            Psst... have you seen these?

Metahill Blog

Metahill Help

Sincerely yours,

            the enthusiasts community


text:
package org.springframework.boot.actuate.endpoint.web;

import java.util.Collection;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.util.Assert;

/**
 * {@link ServletContextInitializer} to register {@link ExposableServletEndpoint servlet
 * endpoints}.
 *
 * @author Phillip Webb
 * @author Madhura Bhave
 * @since 2.0.0
 */
public class ServletEndpointRegistrar implements ServletContextInitializer {

	private static final Log logger = LogFactory.getLog(ServletEndpointRegistrar.class);

	private final String basePath;

	private final Collection<ExposableServletEndpoint> servletEndpoints;

	public ServletEndpointRegistrar(String basePath,
			Collection<ExposableServletEndpoint> servletEndpoints) {
		Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
		this.basePath = (basePath != null) ? basePath : "";
		this.servletEndpoints = servletEndpoints;
	}

	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		this.servletEndpoints
				.forEach((servletEndpoint) -> register(servletContext, servletEndpoint));
	}

	private void register(ServletContext servletContext,
			ExposableServletEndpoint endpoint) {
		String name = endpoint.getId() + "-actuator-endpoint";
		String path = this.basePath + "/" + endpoint.getRootPath();
		String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
		EndpointServlet endpointServlet = endpoint.getEndpointServlet();
		Dynamic registration = servletContext.addServlet(name,
				endpointServlet.getServlet());
		registration.addMapping(urlMapping);
		registration.setInitParameters(endpointServlet.getInitParameters());
		logger.info("Registered '" + path + "' to " + name);
	}

}


text:
import React from 'react';
import Codeblock from './Codeblock';

export default ({}) => {
  return (
    <Codeblock>
      {`// BrushChart.js
import React from 'react';
import { genRandomNormalPoints } from '@vx/mock-data';
import { scaleLinear } from '@vx/scale';
import { Group } from '@vx/group';
import { AxisLeft, AxisBottom } from '@vx/axis';
import colors from '../util/sillyColorScale';
import { Motion, spring } from 'react-motion';
import {
  BoxBrush,
  withBrush,
  getCoordsFromEvent,
  constrainToRegion
} from '@vx/brush';

const points = genRandomNormalPoints();

class BrushChart extends React.Component {
  constructor(props) {
    super(props);
    const { width, height, margin } = props;

    this.extent = {
      x0: margin.left,
      x1: width - margin.left,
      y0: margin.top,
      y1: height - margin.top,
    };

    this.initialDomain = {
      x: [-4.5, 4.5],
      y: [-4.5 / 2, 4.5 / 2]
    };

    this.xScale = scaleLinear({
      domain: this.initialDomain.x,
      range: [0, width - margin.left - margin.right],
      clamp: true,
    });

    this.yScale = scaleLinear({
      domain: this.initialDomain.y,
      range: [height - margin.top - margin.bottom, 0],
      clamp: true,
    });

    this.handleMouseDown = this.handleMouseDown.bind(this);
    this.handleMouseMove = this.handleMouseMove.bind(this);
    this.handleMouseUp = this.handleMouseUp.bind(this);
  }

  scaleReset() {
    const { xScale, yScale, initialDomain } = this;
    xScale.domain(initialDomain.x);
    yScale.domain(initialDomain.y);
  }

  handleMouseDown(event) {
    const { onBrushStart } = this.props;
    const { extent: region } = this;
    const { x, y } = getCoordsFromEvent(this.svg, event);
    onBrushStart(constrainToRegion({ region, x, y }));
  }

  handleMouseMove(event) {
    const { brush, onBrushDrag, updateBrush } = this.props;
    // only update the brush region if we're dragging
    if (!brush.isBrushing) return;
    const { extent: region } = this;
    const { x, y } = getCoordsFromEvent(this.svg, event);
    onBrushDrag(constrainToRegion({ region, x, y }));
  }

  handleMouseUp(event) {
    const { brush, onBrushEnd, onBrushReset } = this.props;
    const { extent: region } = this;
    if (brush.end) {
      const { x, y } = getCoordsFromEvent(this.svg, event);
      onBrushEnd(constrainToRegion({ region, x, y }));
      return;
    }
    onBrushReset(event);
    this.scaleReset();
  }

  render() {
    const { width, height, brush, margin } = this.props;
    const { xScale, yScale } = this;

    const x = d => d[0];
    const y = d => d[1];
    const z = d => d[2];

    const xMax = width - margin.left - margin.right;
    const yMax = height - margin.top - margin.bottom;

    if (brush.domain) {
      const { domain } = brush;
      const { x0, x1, y0, y1 } = domain;
      xScale.domain([x0, x1].map(d => d - margin.left).map(xScale.invert));
      yScale.domain([y1, y0].map(d => d - margin.top).map(yScale.invert));
    }

    return (
      <svg
        ref={(c) => { this.svg = c; }}
        width={width}
        height={height}
        onMouseDown={this.handleMouseDown}
        onMouseMove={this.handleMouseMove}
        onMouseUp={this.handleMouseUp}
      >
        <AxisBottom
          scale={xScale}
          top={yMax + margin.top}
          left={margin.left}
          label={''}
          stroke={'#1b1a1e'}
          tickTextFill={'#1b1a1e'}
        />
        <AxisLeft
          scale={yScale}
          top={margin.top}
          left={margin.left}
          label={''}
          stroke={'#1b1a1e'}
          tickTextFill={'#1b1a1e'}
        />
        <Group top={margin.top} left={margin.left}>
          {points.map((point) => {
            return (
              <Motion
                key={"%{x(point)}-%{y(point)}-%{z(point)}"}
                defaultStyle={{ x: xMax / 2, y: yMax / 2 }}
                style={{
                  x: spring(xScale(x(point))),
                  y: spring(yScale(y(point))),
                }}>
                {interpolatingStyle => {
                  return (
                    <circle
                      fill={colors(z(point))}
                      cx={interpolatingStyle.x}
                      cy={interpolatingStyle.y}
                      r={3}
                    />
                  );
                }}
              </Motion>
            );
          })}
        </Group>
        <BoxBrush brush={brush} />
      </svg>
    );
  }
}

export default withBrush(BrushChart);
`}
    </Codeblock>
  );
}


text:
+++
toc = false
draft = true
comments = false
slug = ""
title = "{{ replace .TranslationBaseName "-" " " | title }}"
date = {{ .Date }}
+++


text:
namespace MSBuild.ExtensionPack.Computer
{
    using System;
    using System.Globalization;
    using System.Management;
    using System.Text;
    using Microsoft.Build.Framework;

    ///
    /// Valid TaskActions are:
    /// <para>Get (Required:  Variable Optional: Target Output:  Value)</para>
    /// <para>Set (Required:  Variable, Value Optional: Target)</para>
    /// <para>Remote Execution Support: For Get TaskAction only</para>
    ///
    /// <example>
    /// <![CDATA[
    /// <Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    ///     <PropertyGroup>
    ///         <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
    ///         <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    ///     </PropertyGroup>
    ///     <Import Project="$(TPath)"/>
    ///     <Target Name="Default">
    ///
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Set" Variable="PATH" Value="$(VCInstallDir)Common7\IDE%3B$(VCInstallDir)VC\BIN%3B$(VCInstallDir)Common7\Tools%3B$(VCInstallDir)Common7\Tools\bin%3B$(VCInstallDir)VC\PlatformSDK\bin%3B$(SDKInstallDir)bin%3B$(PATH)"/>
    ///
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Set" Variable="ANewEnvSample" Value="bddd"/>
    ///
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Get" Variable="ANewEnvSample">
    ///             <Output PropertyName="EnvValue" TaskParameter="Value"/>
    ///         </MSBuild.ExtensionPack.Computer.EnvironmentVariable>
    ///         <Message Text="Get: $(EnvValue)"/>
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Set" Variable="ANewEnvSample" Value="newddd"/>
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Get" Variable="ANewEnvSample">
    ///             <Output PropertyName="EnvValue" TaskParameter="Value"/>
    ///         </MSBuild.ExtensionPack.Computer.EnvironmentVariable>
    ///         <Message Text="Get: $(EnvValue)"/>
    ///
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Set" Variable="ANewEnvSample" Value="bddd" MachineName="MediaHub"/>
    ///
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Get" Variable="INOCULAN" Target="Machine" MachineName="machinename" UserName="Administrator" UserPassword="passw">
    ///             <Output PropertyName="EnvValue" TaskParameter="Value"/>
    ///         </MSBuild.ExtensionPack.Computer.EnvironmentVariable>
    ///         <Message Text="INOCULAN Get: $(EnvValue)"/>
    ///         <MSBuild.ExtensionPack.Computer.EnvironmentVariable TaskAction="Get" Variable="FT" Target="User" MachineName="machinename" UserName="Administrator" UserPassword="passw">
    ///             <Output PropertyName="EnvValue" TaskParameter="Value"/>
    ///         </MSBuild.ExtensionPack.Computer.EnvironmentVariable>
    ///         <Message Text="FT Get: $(EnvValue)"/>
    ///     </Target>
    /// </Project>
    /// ]]>
    /// </example>
    [HelpUrl("http://www.msbuildextensionpack.com/help/3.5.12.0/html/17390384-36ed-d9a9-b208-7e5207c778af.htm")]
    public class EnvironmentVariable : BaseTask
    {
        private const string GetTaskAction = "Get";
        private const string SetTaskAction = "Set";

        private EnvironmentVariableTarget target = EnvironmentVariableTarget.Process;

        [DropdownValue(GetTaskAction)]
        [DropdownValue(SetTaskAction)]
        public override string TaskAction
        {
            get { return base.TaskAction; }
            set { base.TaskAction = value; }
        }

        ///
        /// Gets or sets the value. May be a string array for Get. If Value is not passed or empty for Set, the environment variable is deleted.
        ///
        [Output]
        [TaskAction(GetTaskAction, false)]
        [TaskAction(SetTaskAction, true)]
        public string[] Value { get; set; }

        ///
        /// The name of the Environment Variable to get or set.
        ///
        [Required]
        [TaskAction(GetTaskAction, true)]
        [TaskAction(SetTaskAction, true)]
        public string Variable { get; set; }

        ///
        /// Machine, Process or User. Defaults to Process
        ///
        [TaskAction(GetTaskAction, false)]
        [TaskAction(SetTaskAction, false)]
        public string Target
        {
            get
            {
                return this.target.ToString();
            }

            set
            {
                if (Enum.IsDefined(typeof(EnvironmentVariableTarget), value))
                {
                    this.target = (EnvironmentVariableTarget)Enum.Parse(typeof(EnvironmentVariableTarget), value);
                }
                else
                {
                    this.Log.LogError(string.Format(CultureInfo.CurrentCulture, "The value '{0}' is not in the EnvironmentVariableTarget Enum. Use Process, User or Machine.", value));
                    return;
                }
            }
        }

        ///
        /// Performs the action of this task.
        ///
        protected override void InternalExecute()
        {
            switch (this.TaskAction)
            {
                case GetTaskAction:
                    this.Get();
                    break;
                case SetTaskAction:
                    this.Set();
                    break;
                default:
                    this.Log.LogError(string.Format(CultureInfo.CurrentCulture, "Invalid TaskAction passed: {0}", this.TaskAction));
                    return;
            }
        }

        ///
        /// Sets this instance.
        ///
        private void Set()
        {
            if (this.Value == null)
            {
                this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Removing Environment Variable: \"{0}\" for target \"{1}\" to \"{2}\".", this.Variable, this.target, string.Empty));
                Environment.SetEnvironmentVariable(this.Variable, string.Empty, this.target);
            }
            else
            {
                StringBuilder s = new StringBuilder(this.Value.Length);
                foreach (string val in this.Value)
                {
                    s.Append(val + ";");
                }

                string newValue = s.ToString();
                newValue = newValue.Remove(newValue.Length - 1, 1);
                this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Setting Environment Variable: \"{0}\" for target \"{1}\" to \"{2}\".", this.Variable, this.target, newValue));
                Environment.SetEnvironmentVariable(this.Variable, newValue, this.target);
            }
        }

        ///
        /// Gets this instance.
        ///
        private void Get()
        {
            this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Getting Environment Variable: {0} for target: {1} from: {2}", this.Variable, this.target, this.MachineName));

            if (this.MachineName == Environment.MachineName)
            {
                string temp = Environment.GetEnvironmentVariable(this.Variable, this.target);
                if (!string.IsNullOrEmpty(temp))
                {
                    this.Value = Environment.GetEnvironmentVariable(this.Variable, this.target).Split(';');
                }
                else
                {
                    this.LogTaskWarning(string.Format(CultureInfo.CurrentCulture, "The Environment Variable was not found: {0}", this.Variable));
                }
            }
            else
            {
                this.GetManagementScope(@"\root\cimv2");
                ObjectQuery query = new ObjectQuery(string.Format(CultureInfo.CurrentCulture, "SELECT * FROM Win32_Environment WHERE Name = '{0}'", this.Variable));
                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(this.Scope, query))
                {
                    ManagementObjectCollection moc = searcher.Get();
                    foreach (ManagementObject mo in moc)
                    {
                        if (mo["VariableValue"] != null)
                        {
                            this.Value = mo["VariableValue"].ToString().Split(';');
                        }
                    }
                }
            }
        }
    }
}


text:
package org.geoint.saasy.authc.event;

import java.util.Objects;

/**
 * Event identifying a new {@link SecurityCredential} for a subject.
 *
 * @author steve_siebert
 */
public final class AuthenticationCredentialGranted {

    private final String subjectGuid;
    private final String credentialToken;

    public AuthenticationCredentialGranted(String subjectGuid,
            String credentialToken) {
        this.subjectGuid = subjectGuid;
        this.credentialToken = credentialToken;
    }

    public String getSubjectGuid() {
        return subjectGuid;
    }

    public String getCredentialToken() {
        return credentialToken;
    }

    @Override
    public String toString() {
        return String.format("New credential for subject '%s'",
                subjectGuid);
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + Objects.hashCode(this.subjectGuid);
        hash = 29 * hash + Objects.hashCode(this.credentialToken);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final AuthenticationCredentialGranted other = (AuthenticationCredentialGranted) obj;
        if (!Objects.equals(this.subjectGuid, other.subjectGuid)) {
            return false;
        }
        return Objects.equals(this.credentialToken, other.credentialToken);
    }

}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/pink"
    tools:context="${packageName}.${activityClass}" >

     <com.loopj.android.image.SmartImageView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/smartImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:maxWidth="600dp"
        android:src="@android:drawable/screen_background_light" >
	</com.loopj.android.image.SmartImageView>

</RelativeLayout>


text:
package api

import (
	"fmt"

	"github.com/golang/glog"

	v1 "k8s.io/api/core/v1"
)

// NodeInfo is node level aggregated information.
type NodeInfo struct {
	Name string
	Node *v1.Node

	// The state of node
	State NodeState

	// The releasing resource on that node
	Releasing *Resource
	// The idle resource on that node
	Idle *Resource
	// The used resource on that node, including running and terminating
	// pods
	Used *Resource

	Allocatable *Resource
	Capability  *Resource

	Tasks map[TaskID]*TaskInfo
}

// NodeState defines the current state of node.
type NodeState struct {
	Phase  NodePhase
	Reason string
}

// NewNodeInfo is used to create new nodeInfo object
func NewNodeInfo(node *v1.Node) *NodeInfo {
	var ni *NodeInfo

	if node == nil {
		ni = &NodeInfo{
			Releasing: EmptyResource(),
			Idle:      EmptyResource(),
			Used:      EmptyResource(),

			Allocatable: EmptyResource(),
			Capability:  EmptyResource(),

			Tasks: make(map[TaskID]*TaskInfo),
		}
	} else {
		ni = &NodeInfo{
			Name: node.Name,
			Node: node,

			Releasing: EmptyResource(),
			Idle:      NewResource(node.Status.Allocatable),
			Used:      EmptyResource(),

			Allocatable: NewResource(node.Status.Allocatable),
			Capability:  NewResource(node.Status.Capacity),

			Tasks: make(map[TaskID]*TaskInfo),
		}
	}

	ni.setNodeState(node)

	return ni
}

// Clone used to clone nodeInfo Object
func (ni *NodeInfo) Clone() *NodeInfo {
	res := NewNodeInfo(ni.Node)

	for _, p := range ni.Tasks {
		res.AddTask(p)
	}

	return res
}

// Ready returns whether node is ready for scheduling
func (ni *NodeInfo) Ready() bool {
	return ni.State.Phase == Ready
}

func (ni *NodeInfo) setNodeState(node *v1.Node) {
	// If node is nil, the node is un-initialized in cache
	if node == nil {
		ni.State = NodeState{
			Phase:  NotReady,
			Reason: "UnInitialized",
		}
		return
	}

	// set NodeState according to resources
	if !ni.Used.LessEqual(NewResource(node.Status.Allocatable)) {
		ni.State = NodeState{
			Phase:  NotReady,
			Reason: "OutOfSync",
		}
		return
	}

	// Node is ready (ignore node conditions because of taint/toleration)
	ni.State = NodeState{
		Phase:  Ready,
		Reason: "",
	}
}

// SetNode sets kubernetes node object to nodeInfo object
func (ni *NodeInfo) SetNode(node *v1.Node) {
	ni.setNodeState(node)

	if !ni.Ready() {
		glog.Warningf("Failed to set node info, phase: %s, reason: %s",
			ni.State.Phase, ni.State.Reason)
		return
	}

	ni.Name = node.Name
	ni.Node = node

	ni.Allocatable = NewResource(node.Status.Allocatable)
	ni.Capability = NewResource(node.Status.Capacity)
	ni.Idle = NewResource(node.Status.Allocatable)
	ni.Used = EmptyResource()

	for _, task := range ni.Tasks {
		if task.Status == Releasing {
			ni.Releasing.Add(task.Resreq)
		}

		ni.Idle.Sub(task.Resreq)
		ni.Used.Add(task.Resreq)
	}
}

func (ni *NodeInfo) allocateIdleResource(ti *TaskInfo) error {
	if ti.Resreq.LessEqual(ni.Idle) {
		ni.Idle.Sub(ti.Resreq)
		return nil
	}
	return fmt.Errorf("Selected node NotReady")
}

// AddTask is used to add a task in nodeInfo object
//
// If error occurs both task and node are guaranteed to be in the original state.
func (ni *NodeInfo) AddTask(task *TaskInfo) error {
	if len(task.NodeName) > 0 && len(ni.Name) > 0 && task.NodeName != ni.Name {
		return fmt.Errorf("task <%v/%v> already on different node <%v>",
			task.Namespace, task.Name, task.NodeName)
	}

	key := PodKey(task.Pod)
	if _, found := ni.Tasks[key]; found {
		return fmt.Errorf("task <%v/%v> already on node <%v>",
			task.Namespace, task.Name, ni.Name)
	}

	// Node will hold a copy of task to make sure the status
	// change will not impact resource in node.
	ti := task.Clone()

	if ni.Node != nil {
		switch ti.Status {
		case Releasing:
			if err := ni.allocateIdleResource(ti); err != nil {
				return err
			}
			ni.Releasing.Add(ti.Resreq)
		case Pipelined:
			ni.Releasing.Sub(ti.Resreq)
		default:
			if err := ni.allocateIdleResource(ti); err != nil {
				return err
			}
		}

		ni.Used.Add(ti.Resreq)
	}

	// Update task node name upon successful task addition.
	task.NodeName = ni.Name
	ti.NodeName = ni.Name
	ni.Tasks[key] = ti

	return nil
}

// RemoveTask used to remove a task from nodeInfo object.
//
// If error occurs both task and node are guaranteed to be in the original state.
func (ni *NodeInfo) RemoveTask(ti *TaskInfo) error {
	key := PodKey(ti.Pod)

	task, found := ni.Tasks[key]
	if !found {
		return fmt.Errorf("failed to find task <%v/%v> on host <%v>",
			ti.Namespace, ti.Name, ni.Name)
	}

	if ni.Node != nil {
		switch task.Status {
		case Releasing:
			ni.Releasing.Sub(task.Resreq)
			ni.Idle.Add(task.Resreq)
		case Pipelined:
			ni.Releasing.Add(task.Resreq)
		default:
			ni.Idle.Add(task.Resreq)
		}

		ni.Used.Sub(task.Resreq)
	}

	delete(ni.Tasks, key)

	return nil
}

// UpdateTask is used to update a task in nodeInfo object.
//
// If error occurs both task and node are guaranteed to be in the original state.
func (ni *NodeInfo) UpdateTask(ti *TaskInfo) error {
	if err := ni.RemoveTask(ti); err != nil {
		return err
	}
	if err := ni.AddTask(ti); err != nil {
		// This should never happen if task removal was successful,
		// because only possible error during task addition is when task is still on a node.
		glog.Fatalf("Failed to add Task <%s,%s> to Node <%s> during task update",
			ti.Namespace, ti.Name, ni.Name)
	}
	return nil
}

// String returns nodeInfo details in string format
func (ni NodeInfo) String() string {
	tasks := ""

	i := 0
	for _, task := range ni.Tasks {
		tasks = tasks + fmt.Sprintf("\n\t %d: %v", i, task)
		i++
	}

	return fmt.Sprintf("Node (%s): idle <%v>, used <%v>, releasing <%v>, state <phase %s, reaseon %s>, taints <%v>%s",
		ni.Name, ni.Idle, ni.Used, ni.Releasing, ni.State.Phase, ni.State.Reason, ni.Node.Spec.Taints, tasks)

}

// Pods returns all pods running in that node
func (ni *NodeInfo) Pods() (pods []*v1.Pod) {
	for _, t := range ni.Tasks {
		pods = append(pods, t.Pod)
	}

	return
}


text:
package com.thm.unicap.app.connection;

import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;
import com.thm.unicap.app.UnicapApplication;
import com.thm.unicap.app.model.Student;
import com.thm.unicap.app.model.Subject;
import com.thm.unicap.app.model.SubjectStatus;
import com.thm.unicap.app.model.SubjectTest;

import java.util.Date;

public class UnicapDataManager {

    public static void cleanDatabase() {
        new Delete().from(Student.class).execute();
    }

    public static void cleanUserData(String registration) {

        Student student = new Select().from(Student.class).where("Registration = ?", registration).executeSingle();

        if (student != null)
            student.delete(); // Models configured with cascade delete
    }

    public static void initStudent(String registration, String password) {
        Student student = new Select().from(Student.class).where("Registration = ?", registration).executeSingle();

        if (student == null) {
            student = new Student();
            student.registration = registration;
            student.password = password;
            student.save();
        }

    }

    public static void persistPersonalData(String registration, String name, String course, String shift, String gender, String birthday, String email) {

        Student student = new Select().from(Student.class).where("Registration = ?", registration).executeSingle();

        if (student == null) {
            student = new Student();
            student.registration = registration;
        }

        student.name = name;
        student.course = course;
        student.shift = shift;
        student.gender = gender;
        student.birthday = birthday;
        student.email = email;

        student.save();

        UnicapApplication.setCurrentStudent(student);

    }

    public static void persistPastSubject(String code, String name, String paidIn, Float average, SubjectStatus.Situation situation) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject == null) {
            subject = new Subject();
            subject.code = code;
            subject.student = UnicapApplication.getCurrentStudent();
        }

        subject.name = name;

        subject.save();

        SubjectStatus subjectStatus = new Select().from(SubjectStatus.class)
                .where("Subject = ?", subject.getId())
                .where("PaidIn = ?", paidIn)
                .executeSingle();

        if (subjectStatus == null) {
            subjectStatus = new SubjectStatus();
            subjectStatus.subject = subject;
            subjectStatus.paidIn = paidIn;
        }

        subjectStatus.average = average;
        subjectStatus.situation = situation;

        subjectStatus.save();

    }

    public static void persistActualSubject(String code, String paidIn, String name, Integer workload, Integer credits, Integer period, String team, String room, String schedule) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject == null) {
            subject = new Subject();
            subject.code = code;
            subject.student = UnicapApplication.getCurrentStudent();
        }

        subject.name = name;
        subject.workload = workload;
        subject.credits = credits;
        subject.period = period;

        subject.save();

        SubjectStatus subjectStatus = new Select().from(SubjectStatus.class)
                .where("Subject = ?", subject.getId())
                .where("PaidIn = ?", paidIn)
                .executeSingle();

        if (subjectStatus == null) {
            subjectStatus = new SubjectStatus();
            subjectStatus.subject = subject;
            subjectStatus.paidIn = paidIn;
        } else {

            // Merging room from different rows, but same subject
            if (subjectStatus.room != null && !subjectStatus.room.contains(room))
                room = subjectStatus.room + "-" + room;

            // Merging schedule from different rows, but same subject
            if (subjectStatus.schedule != null && !subjectStatus.schedule.contains(schedule))
                schedule = subjectStatus.schedule + " " + schedule;
        }

        subjectStatus.situation = SubjectStatus.Situation.ACTUAL;
        subjectStatus.team = team;
        subjectStatus.room = room;
        subjectStatus.schedule = schedule;

        subjectStatus.save();
    }

    public static void persistPendingSubject(String code, int period, String name, int credits, int workload) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject == null) {
            subject = new Subject();
            subject.code = code;
            subject.student = UnicapApplication.getCurrentStudent();
        }

        subject.period = period;
        subject.name = name;
        subject.credits = credits;
        subject.workload = workload;

        subject.save();

        SubjectStatus subjectStatus = new Select().from(SubjectStatus.class)
                .where("Subject = ?", subject.getId())
                .where("Situation = ?", SubjectStatus.Situation.PENDING)
                .executeSingle();

        if (subjectStatus == null) {
            subjectStatus = new SubjectStatus();
            subjectStatus.subject = subject;
            subjectStatus.situation = SubjectStatus.Situation.PENDING;
        }

        subjectStatus.subject = subject;

        subjectStatus.save();
    }

    public static void persistSubjectCalendar(String code, SubjectTest.Degree degree, Date date1, Date date2) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject != null) {
            SubjectTest subjectTest = subject.getTestByDegree(degree);

            if (subjectTest == null) {
                subjectTest = new SubjectTest();
                subjectTest.subject = subject;
                subjectTest.degree = degree;
                subjectTest.first_time = true;
            }
            subjectTest.date1 = date1;
            subjectTest.date2 = date2;
            subjectTest.save();
        }

    }

    public static void persistSubjectGrade(String code, SubjectTest.Degree degree, Float grade) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject != null) {
            SubjectTest subjectTest = subject.getTestByDegree(degree);

            if (subjectTest != null) {
                if (grade != null && !grade.equals(subjectTest.grade) && !subjectTest.first_time) {
                    subjectTest.notify = true;
                }
                subjectTest.grade = grade;
                subjectTest.first_time = false;
                subjectTest.save();
            }

        }

    }

    public static void persistSubjectAverage(String code, Float grade) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject != null) {
            SubjectStatus actualSubjectStatus = subject.getActualSubjectStatus();

            if (actualSubjectStatus != null) {
                actualSubjectStatus.average = grade;
                actualSubjectStatus.save();
            }
        }

    }

    public static void persistSubjectFinalAverage(String code, Float grade) {

        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject != null) {
            SubjectStatus actualSubjectStatus = subject.getActualSubjectStatus();

            if (actualSubjectStatus != null) {
                actualSubjectStatus.final_average = grade;
                actualSubjectStatus.save();
            }
        }

    }

    public static void persistStudentCoefficients(Float courseCoefficient, Float lastCoefficient) {

        Student student = UnicapApplication.getCurrentStudent();

        if (student != null) {
            student.courseCoefficient = courseCoefficient;
            student.lastCoefficient = lastCoefficient;

            student.save();
        }

    }

    public static void setSubjectFlowSituation(String code, SubjectStatus.FlowSituation flowSituation) {
        Subject subject = new Select().from(Subject.class)
                .where("Code = ?", code)
                .where("Student = ?", UnicapApplication.getCurrentStudent().getId())
                .executeSingle();

        if (subject != null) {
            SubjectStatus actualSubjectStatus = subject.getActualSubjectStatus();

            if (actualSubjectStatus != null) {
                actualSubjectStatus.flowSituation = flowSituation;
                actualSubjectStatus.save();
            }
        }
    }
}


text:
<!doctype html>

	<meta charset="utf-8">
	<title>Multiple reload test</title>

	<link rel="stylesheet" href="../css/style.css" type="text/css"/>

		browse other examples

Multiple reload test

			<button ng-click="doSingleReload()"> Do single reload</button>
			<button ng-click="doMultipleReload()"> Do multiple reload</button>
			Loading: {{adapter.isLoading}}

{{item}}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=struct.U2.html">

Redirecting to struct.U2.html...


text:
chrome.devtools.network.onRequestFinished.addListener(function(HAR) {
	chrome.extension.sendMessage(HAR.response.headers);
});