text:
@implementation TCDropFileZoneView

- (id)initWithFrame:(NSRect)frame
{
    if ( self = [super initWithFrame:frame] )
    {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventHandler:) name:@"TCDropbFileZoneGetFiles" object:nil];
        [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
        fileisEntered = NO;
    }
    return self;
}

- (void)drawRect:(NSRect)dirtyRect
{
    // Drawing code here.

    // Mitte berechnen
    CGPoint center;
    center.x = dirtyRect.size.width / 2;
    center.y = dirtyRect.size.height / 2;

    // Settings Rounded Rect
    CGFloat rectLength = 200;

    if ( fileisEntered == NO )
    { // Kein File is auf der Drag Zone
        //// Color Declarations
        NSColor* color = [NSColor colorWithCalibratedRed: 0.568 green: 0.577 blue: 0.585 alpha: 1];

        //// DropbZone
        {
            //// Pfeil Drawing
            NSBezierPath* pfeilPath = [NSBezierPath bezierPath];
            [pfeilPath moveToPoint: NSMakePoint(center.x, center.y)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 41.67 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 41.67 - 52.5, center.y + 78.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 60.67 - 52.5, center.y + 78.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 60.67 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 70.5 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 51.5 - 52.5, center.y + 25.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 32.5 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath closePath];
            [color setFill];
            [pfeilPath fill];

            //// Rounded Rectangle Drawing
            NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(center.x - rectLength/2, center.y - rectLength/2, rectLength, rectLength) xRadius: 7 yRadius: 7];
            [color setStroke];
            [roundedRectanglePath setLineWidth: 10];
            CGFloat roundedRectanglePattern[] = {24, 24, 24, 24};
            [roundedRectanglePath setLineDash: roundedRectanglePattern count: 4 phase: 2.3];
            [roundedRectanglePath stroke];
        }
    }
    else
    { // File befindet sich auf der Drag Zone
        //// Color Declarations
        NSColor* color = [NSColor whiteColor];

        [[NSColor colorWithSRGBRed:0.52f green:0.77f blue:0.94f alpha:1.00f] set];
        NSRectFill(dirtyRect);
        //// DropbZone
        {
            //// Pfeil Drawing
            NSBezierPath* pfeilPath = [NSBezierPath bezierPath];
            [pfeilPath moveToPoint: NSMakePoint(center.x, center.y)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 41.67 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 41.67 - 52.5, center.y + 78.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 60.67 - 52.5, center.y + 78.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 60.67 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 70.5 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 51.5 - 52.5, center.y + 25.5 - 46.44)];
            [pfeilPath lineToPoint: NSMakePoint(center.x + 32.5 - 52.5, center.y + 46.44 - 46.44)];
            [pfeilPath closePath];
            [color setFill];
            [pfeilPath fill];

            //// Rounded Rectangle Drawing
            NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(center.x - rectLength/2, center.y - rectLength/2, rectLength, rectLength) xRadius: 7 yRadius: 7];
            [color setStroke];
            [roundedRectanglePath setLineWidth: 10];
            CGFloat roundedRectanglePattern[] = {24, 24, 24, 24};
            [roundedRectanglePath setLineDash: roundedRectanglePattern count: 4 phase: 2.3];
            [roundedRectanglePath stroke];
        }
    }
}

#pragma mark - Drop Delegate

- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender
{
    NSLog(@"Drag entered");

    fileisEntered = YES;
    [self setNeedsDisplay:YES];

    return NSDragOperationCopy;
}

- (void)draggingExited:(id < NSDraggingInfo >)sender
{
    fileisEntered = NO;
    [self setNeedsDisplay:YES];
}

- (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)sender
{
    return YES;
}

- (BOOL)performDragOperation:(id)sender
{
    fileisEntered = NO;
    [self setNeedsDisplay:YES];
    NSPasteboard *pboard = [sender draggingPasteboard];

    if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
        NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
        // Count testen ? int numberOfFiles = [files count];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"TCDropbFileZoneGetFiles" object:files];
        return YES;
    }
    return NO;
}

#pragma mark - Notification

- (void)eventHandler: (NSNotification *) notification
{
    if ( self.delegate && [self.delegate respondsToSelector:@selector(dropZoneGetFiles:)] )
    {
        [self.delegate dropZoneGetFiles:[notification object]];
    }
}

@end


text:
using System;

namespace Public.Common.Lib.IO.Serialization
{
    public class FileCopySerializationUnit : SerializationUnitBase
    {
        public string SourcePath { get; set; }

        public FileCopySerializationUnit(string destinationPath, string sourcePath)
            : base(destinationPath)
        {
            this.SourcePath = sourcePath;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
@interface FTEBooksDB : NSObject

@property (nonatomic, strong) NSMutableArray *downloadedBooks;
@property (nonatomic, strong) NSMutableArray *availableBooks;

@property (nonatomic, assign) long lastSynced;
@property (nonatomic, strong) FTEBook *currentBook;
@property (nonatomic, strong) NSMutableDictionary *booksPosition; //Will store

@end


text:
package arturhgca.datablink.messagecrypto.controllers;

import arturhgca.datablink.messagecrypto.Util;
import arturhgca.datablink.messagecrypto.models.Message;
import arturhgca.datablink.messagecrypto.persistence.MessageRepository;
import arturhgca.datablink.messagecrypto.security.CustomBCryptPasswordEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.encrypt.Encryptors;
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Controller responsible for message-related views
 */
@Controller
public class MessageController
{
    /**
     * This autowired property implements the Repository connected to the Message model
     */
    @Autowired
    private MessageRepository messageRepository;

    /**
     * This autowired property enables access to the password encoder used for authentication
     */
    @Autowired
    private BCryptPasswordEncoder bCryptPasswordEncoder;

    /**
     * Maps and handles custom behavior in the Edit page (GET mode)
     * @param model The information that is bound to the HTML form
     * @return Custom message sent to the client
     */
    @RequestMapping(value="/edit", method=RequestMethod.GET)
    public String edit(Model model)
    {
        String username = Util.getUsername();
        Message message = getMessage(username);

        // TO-DO: clear message.decryptedMessage
        message = decryptMessage(message);

        model.addAttribute("message", message);
        return "edit";
    }

    /**
     * Maps and handles custom behavior in the Edit page (POST mode)
     * @param message The information that is bound to the HTML form and used to update the database
     * @return Custom message sent to the client - in this case, a redirect
     */
    @RequestMapping(value="/edit", method=RequestMethod.POST)
    public String submit(@ModelAttribute Message message)
    {
        try
        {
            String username = Util.getUsername();
            message.setUsername(username);

            message = encryptMessage(message);
            messageRepository.save(message);

            // TO-DO: redirect and show a success message
            return "redirect:/cpanel.html";
        }
        catch(DataIntegrityViolationException ex) // message is too long for DB field
        {
            return "redirect:/edit?error";
        }
    }

    /**
     * Maps and handles custom behavior in the Decrypt page
     * @param model The information that is bound to the HTML form
     * @return Custom message sent to the client
     */
    @RequestMapping(value="/decrypt", method=RequestMethod.GET)
    public String decrypt(Model model)
    {
        String username = Util.getUsername();
        Message message = getMessage(username);

        // TO-DO: clear message.decryptedMessage
        // (same as edit GET)
        message = decryptMessage(message);

        model.addAttribute("message", message);
        return "decrypt";
    }

    /**
     * Maps and handles custom behavior in the View page
     * @param model The information that is bound to the HTML form
     * @return Custom message sent to the client
     */
    @RequestMapping(value="/view", method=RequestMethod.GET)
    public String view(Model model)
    {
        String username = Util.getUsername();
        Message message = getMessage(username);
        model.addAttribute("message", message);
        return "view";
    }

    /**
     * Queries the database through a Repository to get a user's message
     * If no message is found, instantiates a new one
     * @param username The username to be used as parameter in the query
     * @return The message found in the database or a new one if none is found
     */
    Message getMessage(String username)
    {
        Message message = messageRepository.findOne(username);
        if(message == null)
        {
            message = new Message();
        }
        return message;
    }

    /**
     * Gets a raw message, generates a new encryption key and encrypts the message
     * @param message The object that contains the message to be encrypted
     * @return The Message object with the encrypted message and the decryptedMessage field cleared
     */
    Message encryptMessage(Message message)
    {
        Object credentials = Util.getCredentials();
        // bcrypt: $version$cost$salthash, with 22 chars for salt
        String cryptoKey = bCryptPasswordEncoder.encode(credentials.toString());
        // Spring BCrypt considers version and cost as part of the salt, so:
        String cryptoKeySalt = cryptoKey.substring(0, 29);
        message.setCryptoKeySalt(cryptoKeySalt);
        String cryptoSalt = KeyGenerators.string().generateKey();
        message.setCryptoSalt(cryptoSalt);
        String encryptedMessage = Encryptors.text(cryptoKey, cryptoSalt).encrypt(message.getDecryptedMessage());
        message.setEncryptedMessage(encryptedMessage);
        message.setDecryptedMessage("");
        return message;
    }

    /**
     * Gets an encrypted message, reconstructs the encryption key and decrypts the message
     * @param message The object that contains the message to be decrypted and its encryption information
     * @return The Message object with the decrypted message
     */
    Message decryptMessage(Message message)
    {
        if(message.getCryptoSalt() != null)
        {
            CustomBCryptPasswordEncoder encoder = new CustomBCryptPasswordEncoder();
            Object credentials = Util.getCredentials();
            String cryptoKeySalt = message.getCryptoKeySalt();
            String cryptoKey = encoder.encode(credentials.toString(), cryptoKeySalt);
            String cryptoSalt = message.getCryptoSalt();
            String encryptedMessage = message.getEncryptedMessage();
            String decryptedMessage = Encryptors.text(cryptoKey, cryptoSalt).decrypt(encryptedMessage);
            message.setDecryptedMessage(decryptedMessage);
        }
        return message;
    }
}


text:
/* $Id: UIDnDDataObject_win.h $ */
/** @file
 * VBox Qt GUI - UIDnDDataObject class declaration.
 */

/*
 * Copyright (C) 2014 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef ___UIDnDDataObject_win_h___
#define ___UIDnDDataObject_win_h___

#include <iprt/critsect.h>

#include <QString>
#include <QStringList>
#include <QVariant>

/* COM includes: */
#include "COMEnums.h"
#include "CDndSource.h"
#include "CSession.h"

/* Forward declarations: */
class UIDnDHandler;

class UIDnDDataObject : public IDataObject
{
public:

    enum Status
    {
        Uninitialized = 0,
        Initialized,
        Dropping,
        Dropped,
        Aborted
    };

public:

    UIDnDDataObject(UIDnDHandler *pDnDHandler, const QStringList &lstFormats);
    virtual ~UIDnDDataObject(void);

public: /* IUnknown methods. */

    STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
    STDMETHOD_(ULONG, AddRef)(void);
    STDMETHOD_(ULONG, Release)(void);

public: /* IDataObject methods. */

    STDMETHOD(GetData)(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium);
    STDMETHOD(GetDataHere)(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium);
    STDMETHOD(QueryGetData)(LPFORMATETC pFormatEtc);
    STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pFormatEct,  LPFORMATETC pFormatEtcOut);
    STDMETHOD(SetData)(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium, BOOL fRelease);
    STDMETHOD(EnumFormatEtc)(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc);
    STDMETHOD(DAdvise)(LPFORMATETC pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection);
    STDMETHOD(DUnadvise)(DWORD dwConnection);
    STDMETHOD(EnumDAdvise)(IEnumSTATDATA **ppEnumAdvise);

public:

    static const char* ClipboardFormatToString(CLIPFORMAT fmt);

    int Abort(void);
    void SetStatus(Status status);
    int Signal(const QString &strFormat, const void *pvData, uint32_t cbData);

protected:

    bool LookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex);
    static HGLOBAL MemDup(HGLOBAL hMemSource);
    void RegisterFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, TYMED tyMed = TYMED_HGLOBAL,
                        LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL);

    UIDnDHandler   *m_pDnDHandler;

    Status          mStatus;
    LONG            mRefCount;
    /** Number of native formats registered. This can be a different number than supplied with mlstFormats. */
    ULONG           mcFormats;
    FORMATETC      *mpFormatEtc;
    STGMEDIUM      *mpStgMedium;
    RTSEMEVENT      mSemEvent;
    QStringList     mlstFormats;
    QString         mstrFormat;
    /** The retrieved data as a QVariant. Needed for buffering in case a second format needs the same data,
     *  e.g. CF_TEXT and CF_UNICODETEXT. */
    QVariant        mVaData;
    /** The retrieved data as a raw buffer. */
    void           *mpvData;
    /** Raw buffer size (in bytes). */
    uint32_t        mcbData;
};

#endif /* ___UIDnDDataObject_win_h___ */


text: - Door schedule


text:
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.util;

/**
 * Loop iterator that provides various counting data about the loop cycles.
 * Should be used as in while construct:
 *
 *

 * while (loopIterator.next()) {
 * 		// do something
 * }
 *

 */
public class LoopIterator {

	protected final int start;
	protected final int end;
	protected final int step;
	protected final int modulus;

	protected boolean first;
	protected boolean last;
	protected int value;
	protected int count;
	protected final boolean looping;

	public LoopIterator(int start, int end) {
		this(start, end, 1, 2);
	}

	public LoopIterator(int start, int end, int step) {
		this(start, end, step, 2);
	}

	public LoopIterator(int start, int end, int step, int modulus) {
		this.start = start;
		this.end = end;
		this.step = step;
		this.modulus = modulus;
		this.looping = step > 0 ? start <= end : start >= end;
	}

	/**
	 * Returns current item count (1-based).
	 */
	public int getCount() {
		return count;
	}

	/**
	 * Returns current item index (0-based).
	 */
	public int getIndex() {
		return count - 1;
	}

	/**
	 * Returns current loop value.
	 */
	public int getValue() {
		return value;
	}

	/**
	 * Returns true if current count is even.
	 */
	public boolean isEven() {
		return (count % 2) == 0;
	}

	/**
	 * Returns true if current count is odd.
	 */
	public boolean isOdd() {
		return (count % 2) == 1;
	}

	/**
	 * Calculates modulus of current count.
	 */
	public int modulus(int operand) {
		return count % operand;
	}

	/**
	 * Returns modulus of current count.
	 */
	public int getModulus() {
		return count % modulus;
	}

	/**
	 * Returns modulus value.
	 */
	public int getModulusValue() {
		return modulus;
	}

	/**
	 * Returns modulus of current index.
	 */
	public int getIndexModulus() {
		return (count - 1) % modulus;
	}

	/**
	 * Returns true if current item is the first one.
	 */
	public boolean isFirst() {
		return first;
	}

	/**
	 * Returns true if current item is the last one.
	 */
	public boolean isLast() {
		return last;
	}

	// ---------------------------------------------------------------- iterate

	/**
	 * Iterates to next value at the beginning of the loop.
	 */
	public boolean next() {
		if (looping == false) {
			return false;
		}
		if (last == true) {
			return false;
		}
		if (count == 0) {
			value = start;
			first = true;
		} else {
			value += step;
			first = false;
		}
		count++;
		last = isLastIteration(value + step);
		return true;
	}

	/**
	 * Resets the loop from the beginning.
	 */
	public void reset() {
		count = 0;
		last = false;
	}

	protected boolean isLastIteration(int value) {
		return step > 0 ? value > end : value < end;
	}

	@Override
	public String toString() {
		return looping ?
				value + ":" + count + ':' + (first ? 'F':'_') + ':' + (last ? 'L':'_') + ':' + getModulus()
				:
				"N.A.";
	}

}


text:
package org.gradle.test.performance.mediummonolithicjavaproject.p310;

import org.gradle.test.performance.mediummonolithicjavaproject.p309.Production6198;
import org.gradle.test.performance.mediummonolithicjavaproject.p309.Production6199;

import org.junit.Test;
import static org.junit.Assert.*;

public class Test6201 {
    Production6201 objectUnderTest = new Production6201();

    @Test
    public void testProperty0() {
        Production6198 value = new Production6198();
        objectUnderTest.setProperty0(value);
        assertEquals(value, objectUnderTest.getProperty0());
    }

    @Test
    public void testProperty1() {
        Production6199 value = new Production6199();
        objectUnderTest.setProperty1(value);
        assertEquals(value, objectUnderTest.getProperty1());
    }

    @Test
    public void testProperty2() {
        Production6200 value = new Production6200();
        objectUnderTest.setProperty2(value);
        assertEquals(value, objectUnderTest.getProperty2());
    }

    @Test
    public void testProperty3() {
        String value = "value";
        objectUnderTest.setProperty3(value);
        assertEquals(value, objectUnderTest.getProperty3());
    }

    @Test
    public void testProperty4() {
        String value = "value";
        objectUnderTest.setProperty4(value);
        assertEquals(value, objectUnderTest.getProperty4());
    }

    @Test
    public void testProperty5() {
        String value = "value";
        objectUnderTest.setProperty5(value);
        assertEquals(value, objectUnderTest.getProperty5());
    }

    @Test
    public void testProperty6() {
        String value = "value";
        objectUnderTest.setProperty6(value);
        assertEquals(value, objectUnderTest.getProperty6());
    }

    @Test
    public void testProperty7() {
        String value = "value";
        objectUnderTest.setProperty7(value);
        assertEquals(value, objectUnderTest.getProperty7());
    }

    @Test
    public void testProperty8() {
        String value = "value";
        objectUnderTest.setProperty8(value);
        assertEquals(value, objectUnderTest.getProperty8());
    }

    @Test
    public void testProperty9() {
        String value = "value";
        objectUnderTest.setProperty9(value);
        assertEquals(value, objectUnderTest.getProperty9());
    }

}


text:
namespace DSInternals.Common.Data
{
    using System;

    [Flags]
    public enum RoamedCredentialFlags : short
    {
        Tombstone = 1,
        Unreadable = 2,
        Unwritable = 4,
        Unroamable = 8,
        KnownType = 16,
        EncryptionKey = 32
    }
}


text:
layout: default
category: liveservices
title: "Portugal Government Open Data Portal"
link: "http://www.dados.gov.pt/pt/catalogodados/catalogodados.aspx"
---
Portugal Government open data portal running on OGDI DataLab and Windows Azure.


text:
.info {
  margin-top: 30px;
  margin-bottom: 30px;
}

.info > aside {
  float: left;
}

.info > aside .square {
  background-color: #00bff3;
  width: 80px;
  height: 80px;
}

.info > aside .square a {
  display: block;
  width: 100%;
  height: 100%;
}

.info > aside .square a span {
  display: block;
  width: 0;
  height: 0;
  position: relative;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 20px solid white;
  top: 30px;
  left: 20px;
}

.info > aside li {
  text-align: center;
  list-style-type: none;
  text-transform: uppercase;
}

.info > aside li:nth-child(odd) {
  font-family: Oswald;
  font-size: 0.8em;
  color: white;
  padding-top: 10px;
}

.info > aside li:nth-child(even) {
  font-family: OpenSansCond;
  font-size: 0.9em;
  color: #00bff3;
}

.info > header {
  height: 80px;
  margin-left: 100px;
  margin-bottom: 10px;
}

.info > header span {
  font-family: Oswald;
  text-transform: uppercase;
  color: white;
  font-size: 0.8em;
}

.info > section {
  margin-left: 80px;
  padding-left: 20px;
}

.info > section p {
  text-align: justify;
  line-height: 30px;
  padding-left: 20px;
}

.info > section h3 {
  padding-left: 40px;
}

article > p {
  text-align: justify;
}

article > p + p {
  margin-top: 20px;
}

article > p + h3,
section > p + h3 {
  margin-top: 35px;
}

article > ul li {
  list-style: none;
}

article > ul li:before {
  content:'\2022';
  display: block;
  position: relative;
  max-width: 0px;
  max-height: 0px;
  color: white;
  font-size: 23px;
  bottom: 4px;
  left: -20px;
}

/** Squares **/

#horaire > aside .square, #finale > aside .square {
  background: white;
}

#horaire > aside .square a span, #finale > aside .square a span  {
  display: block;
  position: relative;
  width: 0;
  height: 0;
  border-top: 20px solid transparent;  /* left arrow slant */
  border-bottom: 20px solid transparent; /* right arrow slant */
  border-left: 20px solid black; /* bottom, add background color here */
  top: 20px;
  left: 30px;
}

#tarif > aside .square a span {
  display: block;
  position: relative;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;  /* left arrow slant */
  border-right: 20px solid transparent; /* right arrow slant */
  border-top: 20px solid white; /* bottom, add background color here */
  border-bottom: none;
  top: 30px;
  left: 20px;
}

#anim > aside .square {
  background: white;
}

#anim > aside .square a span {
  display: block;
  position: relative;
  width: 0;
  height: 0;
  border-top: 20px solid transparent;  /* left arrow slant */
  border-bottom: 20px solid transparent; /* right arrow slant */
  border-right: 20px solid black; /* bottom, add background color here */
  top: 20px;
  left: 10px;
}

#tournoi section ul li, #finale section ul li {
  list-style-type: none;
  margin-left: 60px;
  color: #00bff3;
}

#tournoi section ul li span, #finale section ul li span, .emphase {
  font-family: Oswald;
  font-size: 0.9em;
  color: white;
  text-transform: uppercase;
  padding-right: 20px;
}

.hero > h1 {
  font-family: OpenSansCond;
  font-size: 50px;
  color: #fff;
}

.block:first-child { margin-left:none; }
.block {
  width: 200px;
  margin: 0;
  margin-left: 1px;
}

.block-huge {
  width: 396px;
}

.shift {
  padding-left: 60px;
}

.moto {
  text-align: left;
  margin-left: 130px;
  color: #fff;
  font-size: 35px;
  font-family: Oswald;
}

table {
  height: auto;
  width: auto;
  background-color: rgba(22, 22, 22, 0.8);
  border: 1px solid #393939;
  border-collapse: collapse;
}

td {
  border: 1px solid #393939;
  padding: 10px;
  text-align: center;
}

th {
  border: 1px solid #393939;
  padding: 10px;
  text-align: center;
  font-weight: bold !important;
}


text:
package co.ecso.dacato;

import co.ecso.dacato.database.cache.Cache;
import co.ecso.dacato.database.cache.CacheKey;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

/**
 * TestApplicationCache.
 *
 * @author Christian Scharmach (cs@e-cs.co)
 * @since 04.09.16
 */
public final class TestApplicationCache implements Cache {

    private static final HazelcastInstance HAZELCAST_INSTANCE = Hazelcast.newHazelcastInstance();
    private static final Map<CacheKey<Object>, Object> APPLICATION_CACHE = HAZELCAST_INSTANCE.getMap("application");

    @Override
    public <V> CompletableFuture<V> get(final CacheKey<Object> cacheKey, final Callable<CompletableFuture<V>> callable)
            throws ExecutionException {
        synchronized (APPLICATION_CACHE) {
            if (!APPLICATION_CACHE.containsKey(cacheKey)) {
                try {
                    final CompletableFuture<V> future = callable.call();
                    //well, we have to "get" here, otherwise we'd be *too* lazy.
                    future.thenApply(toPut -> APPLICATION_CACHE.put(cacheKey, toPut)).get(10, TimeUnit.SECONDS);
                    return future;
                } catch (final Exception e) {
                    throw new ExecutionException(e.getMessage(), e);
                }
            }

            //noinspection unchecked
            return CompletableFuture.completedFuture((V) APPLICATION_CACHE.get(cacheKey));
        }
    }

    @Override
    public <V> void put(final CacheKey<Object> cacheKey, final CompletableFuture<V> value) {
        synchronized (APPLICATION_CACHE) {
            if (!APPLICATION_CACHE.containsKey(cacheKey)) {
                value.thenAccept(toPut -> APPLICATION_CACHE.put(cacheKey, toPut));
            }
        }
    }

    @Override
    public void invalidate(final CacheKey<Object> cacheKey) {
        synchronized (APPLICATION_CACHE) {
            APPLICATION_CACHE.remove(cacheKey);
        }
    }

    @Override
    public Set<CacheKey<Object>> keySet() {
        synchronized (APPLICATION_CACHE) {
            return APPLICATION_CACHE.keySet();
        }
    }

    @Override
    public void invalidateAll() {
        synchronized (APPLICATION_CACHE) {
            APPLICATION_CACHE.clear();
        }
    }

    @Override
    public long size() {
        synchronized (APPLICATION_CACHE) {
            return APPLICATION_CACHE.size();
        }
    }

    @Override
    public void cleanUp() {
        synchronized (APPLICATION_CACHE) {
            APPLICATION_CACHE.clear();
        }
    }

}


text:
#import <UIKit/UIKit.h>

@interface MobileAssistantIOSAppDelegate : UIResponder<UIApplicationDelegate>

@property(strong, nonatomic) UIWindow *window;

@end


text:
require "bundler/setup"
require "benchmark/ips"
require "pathutil"

Benchmark.ips :quiet => true do |x|
  x.json! "benchmark.json"
  x.report("A:Pathname#root?") { Pathname.new("/tmp").root? }
  x.report("B:Pathutil#root?") { Pathutil.new("/tmp").root? }
  x.compare!
end


text:
from datetime import datetime
from dateutil import tz as tzutil

from .common import BaseTest

from c7n.resources.asg import LaunchInfo
from c7n.resources.aws import shape_validate

class LaunchConfigTest(BaseTest):

    def test_config_unused(self):
        factory = self.replay_flight_data("test_launch_config_unused")
        p = self.load_policy(
            {
                "name": "unused-cfg",
                "resource": "launch-config",
                "filters": [{"type": "unused"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["LaunchConfigurationName"], "CloudClusterCopy")

    def test_config_delete(self):
        factory = self.replay_flight_data("test_launch_config_delete")
        p = self.load_policy(
            {
                "name": "delete-cfg",
                "resource": "launch-config",
                "filters": [{"LaunchConfigurationName": "CloudClusterCopy"}],
                "actions": ["delete"],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["LaunchConfigurationName"], "CloudClusterCopy")

class TestUserData(BaseTest):

    def test_regex_filter(self):
        session_factory = self.replay_flight_data("test_launch_config_userdata")
        policy = self.load_policy(
            {
                "name": "launch_config_userdata",
                "resource": "asg",
                'filters': [
                    {
                        'or': [
                            {'type': 'user-data', 'op': 'regex', 'value': '(?smi).*A[KS]IA'}
                        ]
                    }
                ],
            },
            session_factory=session_factory
        )
        resources = policy.run()
        self.assertGreater(len(resources), 0)

class AutoScalingTemplateTest(BaseTest):

    def test_asg_mixed_instance_templates(self):
        d = {
            "AutoScalingGroupName": "devx",
            "MixedInstancesPolicy": {
                "LaunchTemplate": {
                    "LaunchTemplateSpecification": {
                        "LaunchTemplateId": "lt-0877401c93c294001",
                        "LaunchTemplateName": "test",
                        "Version": "4"},
                    "Overrides": [{"InstanceType": "t1.micro"},
                                  {"InstanceType": "t2.small"}]
                },
                "InstancesDistribution": {
                    "OnDemandAllocationStrategy": "prioritized",
                    "OnDemandBaseCapacity": 1,
                    "OnDemandPercentageAboveBaseCapacity": 0,
                    "SpotAllocationStrategy": "capacity-optimized"
                }
            },
            "MinSize": 1,
            "MaxSize": 1,
            "DesiredCapacity": 1,
            "DefaultCooldown": 300,
            "AvailabilityZones": ["us-east-1d", "us-east-1e"],
            "HealthCheckType": "EC2",
            "HealthCheckGracePeriod": 300,
            "VPCZoneIdentifier": "subnet-3a334610,subnet-e3b194de"}

        p = self.load_policy({"name": "mixed-instance", "resource": "asg"})
        self.assertEqual(
            list(p.resource_manager.get_resource_manager(
                'launch-template-version').get_asg_templates([d]).keys()),
            [("lt-0877401c93c294001", "4")])
        self.assertEqual(
            LaunchInfo(p.resource_manager).get_launch_id(d), ("lt-0877401c93c294001", "4"))

class AutoScalingTest(BaseTest):

    def get_ec2_tags(self, ec2, instance_id):
        results = ec2.describe_tags(
            Filters=[
                {"Name": "resource-id", "Values": [instance_id]},
                {"Name": "resource-type", "Values": ["instance"]},
            ]
        )[
            "Tags"
        ]
        return {t["Key"]: t["Value"] for t in results}

    def test_asg_delete(self):
        factory = self.replay_flight_data("test_asg_delete")
        p = self.load_policy(
            {
                "name": "asg-delete",
                "resource": "asg",
                "filters": [{"AutoScalingGroupName": "ContainersFTW"}],
                "actions": [{"type": "delete", "force": True}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "ContainersFTW")

    def test_asg_non_encrypted_filter(self):
        factory = self.replay_flight_data("test_asg_non_encrypted_filter")
        p = self.load_policy(
            {
                "name": "asg-encrypted-filter",
                "resource": "asg",
                "filters": [{"type": "not-encrypted"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["Unencrypted"], ["Image", "LaunchConfig"])

    def test_asg_non_encrypted_filter_with_templates(self):
        factory = self.replay_flight_data("test_asg_non_encrypted_filter_with_templates")
        p = self.load_policy(
            {
                "name": "asg-encrypted-with-launch-templates",
                "resource": "asg",
                "filters": [
                    {"type": "not-encrypted"},
                    {'LaunchTemplate': 'present'}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_image_age_filter(self):
        factory = self.replay_flight_data("test_asg_image_age_filter")
        p = self.load_policy(
            {
                "name": "asg-cfg-filter",
                "resource": "asg",
                "filters": [{"type": "image-age", "days": 90}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_image_age_filter_template(self):
        factory = self.replay_flight_data("test_asg_image_age_filter_template")
        p = self.load_policy(
            {
                "name": "asg-cfg-filter",
                "resource": "asg",
                "filters": [
                    {"type": "image-age", "days": 1, 'op': 'ge'},
                    {"LaunchTemplate": "present"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_image_age_filter_deleted_config(self):
        factory = self.replay_flight_data("test_asg_image_age_filter_deleted_config")
        p = self.load_policy(
            {
                "name": "asg-image-age-filter",
                "resource": "asg",
                "filters": [
                    {"tag:Env": "present"},
                    {"type": "image-age", "days": 5000, "op": "gt"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertTrue('Env' in resources[0].get('Tags')[1].values())

    def test_asg_image_filter_from_launch_template(self):
        factory = self.replay_flight_data("test_asg_image_filter_from_launch_template")
        p = self.load_policy(
            {
                "name": "asg-image-filter_lt",
                "resource": "asg",
                "filters": [
                    {
                        "type": "image",
                        "key": "Description",
                        "value": ".*CentOS7.*",
                        "op": "regex"
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_image_filter_from_launch_config(self):
        factory = self.replay_flight_data("test_asg_image_filter_from_launch_config")
        p = self.load_policy(
            {
                "name": "asg-image-filter_lc",
                "resource": "asg",
                "filters": [
                    {
                        "type": "image",
                        "key": "Description",
                        "value": ".*Ubuntu1804.*",
                        "op": "regex"
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_image_filter_from_lc_and_lt(self):
        factory = self.replay_flight_data("test_asg_image_filter_from_lc_and_lt")
        p = self.load_policy(
            {
                "name": "asg-image-filter_lc_lt",
                "resource": "asg",
                "filters": [
                    {
                        "type": "image",
                        "key": "Description",
                        "value": ".*AmazonLinux2.*",
                        "op": "regex"
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 2)

    def test_asg_config_filter(self):
        factory = self.replay_flight_data("test_asg_config_filter")
        p = self.load_policy(
            {
                "name": "asg-cfg-filter",
                "resource": "asg",
                "filters": [
                    {"type": "launch-config", "key": "ImageId", "value": "ami-9abea4fb"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_vpc_filter(self):
        factory = self.replay_flight_data("test_asg_vpc_filter")
        p = self.load_policy(
            {
                "name": "asg-vpc-filter",
                "resource": "asg",
                "filters": [{"type": "vpc-id", "value": "vpc-d2d616b5"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["LaunchConfigurationName"], "foo-bar")

    def test_asg_tag_and_propagate(self):
        factory = self.replay_flight_data("test_asg_tag")
        p = self.load_policy(
            {
                "name": "asg-tag",
                "resource": "asg",
                "filters": [{"tag:Platform": "ubuntu"}],
                "actions": [
                    {
                        "type": "tag",
                        "key": "CustomerId",
                        "value": "GetSome",
                        "propagate": True,
                    },
                    {
                        "type": "propagate-tags",
                        "trim": True,
                        "tags": ["CustomerId", "Platform"],
                    },
                ],
            },
            session_factory=factory,
        )

        session = factory()
        client = session.client("autoscaling")

        # Put an orphan tag on an instance
        result = client.describe_auto_scaling_groups()["AutoScalingGroups"].pop()
        ec2 = session.client("ec2")
        instance_id = result["Instances"][0]["InstanceId"]
        ec2.create_tags(
            Resources=[instance_id], Tags=[{"Key": "Home", "Value": "Earth"}]
        )

        # Run the policy
        resources = p.run()
        self.assertEqual(len(resources), 1)

        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        tag_map = {
            t["Key"]: (t["Value"], t["PropagateAtLaunch"]) for t in result["Tags"]
        }
        self.assertTrue("CustomerId" in tag_map)
        self.assertEqual(tag_map["CustomerId"][0], "GetSome")
        self.assertEqual(tag_map["CustomerId"][1], True)

        tag_map = self.get_ec2_tags(ec2, instance_id)
        self.assertTrue("CustomerId" in tag_map)
        self.assertFalse("Home" in tag_map)

    def test_asg_remove_tag(self):
        factory = self.replay_flight_data("test_asg_remove_tag")
        p = self.load_policy(
            {
                "name": "asg-remove-tag",
                "resource": "asg",
                "filters": [{"tag:CustomerId": "not-null"}],
                "actions": [{"type": "remove-tag", "key": "CustomerId"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        tag_map = {
            t["Key"]: (t["Value"], t["PropagateAtLaunch"]) for t in result["Tags"]
        }
        self.assertFalse("CustomerId" in tag_map)

    def test_asg_post_finding_format(self):
        factory = self.replay_flight_data('test_asg_mark_for_op')
        p = self.load_policy({
            'name': 'asg-post',
            'resource': 'aws.asg',
            'actions': [
                {'type': 'post-finding',
                 'types': [
                     'Software and Configuration Checks/OrgStandard/abc-123']}]},
            session_factory=factory)

        resources = p.resource_manager.resources()
        rfinding = p.resource_manager.actions[0].format_resource(
            resources[0])
        self.maxDiff = None
        self.assertEqual(
            rfinding,
            {'Details': {
                'AwsAutoScalingAutoScalingGroup': {
                    'CreatedTime': '2016-05-16T18:31:32.276000+00:00',
                    'HealthCheckGracePeriod': 300,
                    'HealthCheckType': 'EC2',
                    'LaunchConfigurationName': 'CustodianASGTestCopyCopy',
                    'LoadBalancerNames': []}},
             'Id': 'arn:aws:autoscaling:us-west-2:619193117841:autoScalingGroup:650754f5-21d3-409f-b43a-fffdeb22910d:autoScalingGroupName/CustodianASG',  # noqa
             'Partition': 'aws',
             'Region': 'us-east-1',
             'Tags': {'Platform': 'ubuntu',
                      'custodian_action': (
                          'AutoScaleGroup does not meet org tag policy: '
                          'suspend@2016/05/21')},
             'Type': 'AwsAutoScalingAutoScalingGroup'})

        shape_validate(
            rfinding['Details']['AwsAutoScalingAutoScalingGroup'],
            'AwsAutoScalingAutoScalingGroupDetails', 'securityhub')

    def test_asg_mark_for_op(self):
        factory = self.replay_flight_data("test_asg_mark_for_op")
        p = self.load_policy(
            {
                "name": "asg-mark-for-op",
                "resource": "asg",
                "filters": [{"tag:Platform": "ubuntu"}],
                "actions": [
                    {
                        "type": "mark-for-op",
                        "key": "custodian_action",
                        "op": "suspend",
                        "days": 1,
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        tag_map = {t["Key"]: t["Value"] for t in result["Tags"]}
        self.assertTrue("custodian_action" in tag_map)
        self.assertTrue("suspend@" in tag_map["custodian_action"])

    def test_asg_mark_for_op_hours(self):
        session_factory = self.replay_flight_data("test_asg_mark_for_op_hours")
        session = session_factory(region="us-east-1")
        asg = session.client("autoscaling")
        localtz = tzutil.gettz("America/New_York")
        dt = datetime.now(localtz)
        dt = dt.replace(
            year=2018, month=2, day=20, hour=12, minute=42, second=0, microsecond=0
        )

        policy = self.load_policy(
            {
                "name": "asg-mark-for-op-hours",
                "resource": "asg",
                "filters": [{"tag:Service": "absent"}],
                "actions": [{"type": "mark-for-op", "op": "delete", "hours": 1}],
            },
            session_factory=session_factory,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 1)

        describe_auto_scaling_groups = asg.describe_auto_scaling_groups(
            AutoScalingGroupNames=["marked"]
        )
        resource = describe_auto_scaling_groups["AutoScalingGroups"][0]
        tags = [t["Value"] for t in resource["Tags"] if t["Key"] == "maid_status"]
        result = datetime.strptime(
            tags[0].strip().split("@", 1)[-1], "%Y/%m/%d %H%M %Z"
        ).replace(
            tzinfo=localtz
        )
        self.assertEqual(result, dt)

    def test_asg_marked_for_op_hours(self):
        session_factory = self.replay_flight_data("test_asg_marked_for_op_hours")
        policy = self.load_policy(
            {
                "name": "asg-marked-for-delete",
                "resource": "asg",
                "filters": [{"type": "marked-for-op", "op": "delete"}],
            },
            session_factory=session_factory,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "marked")

    def test_asg_rename_tag(self):
        factory = self.replay_flight_data("test_asg_rename")
        p = self.load_policy(
            {
                "name": "asg-rename-tag",
                "resource": "asg",
                "filters": [{"tag:Platform": "ubuntu"}],
                "actions": [
                    {"type": "rename-tag", "source": "Platform", "dest": "Linux"}
                ],
            },
            session_factory=factory,
        )

        # Fetch ASG
        session = factory()
        client = session.client("autoscaling")
        result = client.describe_auto_scaling_groups()["AutoScalingGroups"].pop()

        # Fetch instance and make sure it has tags
        ec2 = session.client("ec2")
        instance_id = result["Instances"][0]["InstanceId"]

        tag_map = self.get_ec2_tags(ec2, instance_id)
        self.assertTrue("Platform" in tag_map)
        self.assertFalse("Linux" in tag_map)

        # Run the policy
        resources = p.run()
        self.assertEqual(len(resources), 1)

        # Validate the ASG tag changed
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        tag_map = {
            t["Key"]: (t["Value"], t["PropagateAtLaunch"]) for t in result["Tags"]
        }
        self.assertFalse("Platform" in tag_map)
        self.assertTrue("Linux" in tag_map)

        tag_map = self.get_ec2_tags(ec2, instance_id)
        self.assertFalse("Platform" in tag_map)
        self.assertTrue("Linux" in tag_map)

    def test_asg_suspend(self):
        factory = self.replay_flight_data("test_asg_suspend")
        p = self.load_policy(
            {
                "name": "asg-suspend",
                "resource": "asg",
                "filters": [{"tag:Platform": "not-null"}],
                "actions": ["suspend"],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        self.assertTrue(result["SuspendedProcesses"])

    def test_asg_suspend_when_no_instances(self):
        factory = self.replay_flight_data("test_asg_suspend_when_no_instances")
        client = factory().client("autoscaling")

        # Ensure we have a non-suspended ASG with no instances
        name = "zero-instances"
        result = client.describe_auto_scaling_groups(AutoScalingGroupNames=[name])[
            "AutoScalingGroups"
        ].pop()
        self.assertEqual(len(result["SuspendedProcesses"]), 0)
        self.assertEqual(len(result["Instances"]), 0)

        # Run policy and verify suspend occurs
        p = self.load_policy(
            {
                "name": "asg-suspend",
                "resource": "asg",
                "filters": [{"AutoScalingGroupName": name}],
                "actions": ["suspend"],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        result = client.describe_auto_scaling_groups(AutoScalingGroupNames=[name])[
            "AutoScalingGroups"
        ].pop()
        self.assertTrue(result["SuspendedProcesses"])

    def test_asg_resume(self):
        factory = self.replay_flight_data("test_asg_resume")
        p = self.load_policy(
            {
                "name": "asg-suspend",
                "resource": "asg",
                "filters": [{"tag:Platform": "not-null"}],
                "actions": [{"type": "resume", "delay": 0.1}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        self.assertFalse(result["SuspendedProcesses"])

    def test_asg_resize_save_to_tag(self):
        factory = self.replay_flight_data("test_asg_resize_save_to_tag")
        p = self.load_policy(
            {
                "name": "asg-resize",
                "resource": "asg",
                "filters": [{"tag:CustodianUnitTest": "not-null"}],
                "actions": [
                    {
                        "type": "resize",
                        "min-size": 0,
                        "desired-size": 0,
                        "save-options-tag": "OffHoursPrevious",
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        # test that we set ASG size to zero
        self.assertEqual(result["MinSize"], 0)
        self.assertEqual(result["DesiredCapacity"], 0)
        tag_map = {t["Key"]: t["Value"] for t in result["Tags"]}
        # test that we saved state to a tag
        self.assertTrue("OffHoursPrevious" in tag_map)
        self.assertEqual(
            tag_map["OffHoursPrevious"], "DesiredCapacity=2;MinSize=2;MaxSize=2"
        )

    def test_asg_resize_restore_from_tag(self):
        factory = self.replay_flight_data("test_asg_resize_restore_from_tag")
        p = self.load_policy(
            {
                "name": "asg-resize",
                "resource": "asg",
                "filters": [
                    {"tag:CustodianUnitTest": "not-null"},
                    {"tag:OffHoursPrevious": "not-null"},
                ],
                "actions": [
                    {"type": "resize", "restore-options-tag": "OffHoursPrevious"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        # test that we set ASG min and desired back from 0 to 2
        self.assertEqual(result["MinSize"], 2)
        self.assertEqual(result["DesiredCapacity"], 2)

    def test_asg_resize_to_current(self):
        factory = self.replay_flight_data("test_asg_resize_to_current")
        # test scenario:
        # - create ASG with min=2, desired=2 running in account A
        # - launch config specifies a test AMI in account B
        # - remove permissions on the AMI for account A
        # - kill one of the 2 running instances, wait until the ASG sees that
        # - leaves min=2, desired=2, running=1 and it's unable to launch more
        p = self.load_policy(
            {
                "name": "asg-resize",
                "resource": "asg",
                "filters": [
                    {"type": "capacity-delta"}, {"tag:CustodianUnitTest": "not-null"}
                ],
                "actions": [{"type": "resize", "desired-size": "current"}],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        client = factory().client("autoscaling")
        result = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[resources[0]["AutoScalingGroupName"]]
        )[
            "AutoScalingGroups"
        ].pop()
        # test that we changed ASG min and desired from 2 to 1
        self.assertEqual(result["MinSize"], 1)
        self.assertEqual(result["DesiredCapacity"], 1)

    def test_asg_third_ami_filter(self):
        factory = self.replay_flight_data("test_asg_invalid_third_ami")
        p = self.load_policy(
            {
                "name": "asg-invalid-filter-3ami",
                "resource": "asg",
                "filters": ["invalid"],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 0)

    def test_valid_asg_with_launch_templates(self):
        factory = self.replay_flight_data("test_valid_asg_with_launch_templates")
        p = self.load_policy(
            {
                "name": "asg-valid-templates",
                "resource": "asg",
                "filters": [
                    {"type": "valid"},
                    {"LaunchTemplate": "present"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_invalid_filter_good(self):
        factory = self.replay_flight_data("test_asg_invalid_filter_good")
        p = self.load_policy(
            {"name": "asg-invalid-filter", "resource": "asg", "filters": ["invalid"]},
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 0)

    def test_asg_invalid_filter_bad(self):
        factory = self.replay_flight_data("test_asg_invalid_filter_bad")
        p = self.load_policy(
            {"name": "asg-invalid-filter", "resource": "asg", "filters": ["invalid"]},
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

        s = {x[0] for x in resources[0]["Invalid"]}
        self.assertTrue("invalid-subnet" in s)
        self.assertTrue("invalid-security-group" in s)

    def test_asg_subnet(self):
        factory = self.replay_flight_data("test_asg_subnet")
        p = self.load_policy(
            {
                "name": "asg-sub",
                "resource": "asg",
                "filters": [
                    {
                        "type": "subnet",
                        "match-resource": True,
                        "key": "tag:NetworkLocation",
                        "value": "",
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(
            sorted(resources[0]["c7n:matched-subnets"]),
            sorted(["subnet-65dbce1d", "subnet-b77a4ffd", "subnet-db9f62b2"]),
        )

    def test_asg_security_group_not_matched(self):
        factory = self.replay_flight_data("test_asg_security_group_not_matched")
        p = self.load_policy(
            {
                "name": "asg-sg",
                "resource": "asg",
                "filters": [
                    {
                        "type": "security-group",
                        "key": "tag:NetworkLocation",
                        "op": "not-equal",
                        "value": "",
                    }
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["c7n:matched-security-groups"], ["sg-0b3d3377"])

    def test_asg_security_group(self):
        factory = self.replay_flight_data("test_asg_security_group")
        p = self.load_policy(
            {
                "name": "asg-sg",
                "resource": "asg",
                "filters": [
                    {"type": "security-group", "key": "GroupName", "value": "default"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "ContainersFTW")

    def test_asg_propagate_tag_filter(self):
        session = self.replay_flight_data("test_asg_propagate_tag_filter")
        policy = self.load_policy(
            {
                "name": "asg-propagated-tag-filter",
                "resource": "asg",
                "filters": [
                    {"type": "progagated-tags", "keys": ["Tag01", "Tag02", "Tag03"]}
                ],
            },
            session_factory=session,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "c7n.asg.ec2.01")

        policy = self.load_policy(
            {
                "name": "asg-propagated-tag-filter",
                "resource": "asg",
                "filters": [
                    {"type": "propagated-tags", "keys": ["Tag01", "Tag02", "Tag03"]}
                ],
            },
            session_factory=session,
        )

        policy.validate()

    def test_asg_propagate_tag_missing(self):
        session = self.replay_flight_data("test_asg_propagate_tag_missing")
        policy = self.load_policy(
            {
                "name": "asg-propagated-tag-filter",
                "resource": "asg",
                "filters": [
                    {
                        "type": "progagated-tags",
                        "match": False,
                        "keys": ["Tag01", "Tag02", "Tag03"],
                    }
                ],
            },
            session_factory=session,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 2)
        self.assertEqual(
            sorted([r["AutoScalingGroupName"] for r in resources]),
            ["c7n.asg.ec2.02", "c7n.asg.ec2.03"],
        )

    def test_asg_not_propagate_tag_match(self):
        session = self.replay_flight_data("test_asg_not_propagate_match")
        policy = self.load_policy(
            {
                "name": "asg-propagated-tag-filter",
                "resource": "asg",
                "filters": [
                    {
                        "type": "progagated-tags",
                        "keys": ["Tag01", "Tag02", "Tag03"],
                        "propagate": False,
                    }
                ],
            },
            session_factory=session,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "c7n-asg-np-match")

    def test_asg_not_propagate_tag_missing(self):
        session = self.replay_flight_data("test_asg_not_propagate_missing")
        policy = self.load_policy(
            {
                "name": "asg-propagated-tag-filter",
                "resource": "asg",
                "filters": [
                    {
                        "type": "progagated-tags",
                        "keys": ["Tag01", "Tag02", "Tag03"],
                        "match": False,
                        "propagate": False,
                    }
                ],
            },
            session_factory=session,
        )
        resources = policy.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "c7n-asg-np-missing")

    def test_asg_propagate_tag_no_instances(self):
        factory = self.replay_flight_data("test_asg_propagate_tag_no_instances")
        p = self.load_policy(
            {
                "name": "asg-tag",
                "resource": "asg",
                "filters": [{"tag:Platform": "ubuntu"}],
                "actions": [
                    {
                        "type": "propagate-tags",
                        "trim": True,
                        "tags": ["CustomerId", "Platform"],
                    },
                ],
            },
            session_factory=factory,
        )

        resources = p.run()
        self.assertEqual(len(resources), 1)
        self.assertEqual(resources[0]["AutoScalingGroupName"], "c7n.asg.ec2.01")

    def test_asg_filter_capacity_delta_match(self):
        factory = self.replay_flight_data("test_asg_filter_capacity_delta_match")
        p = self.load_policy(
            {
                "name": "asg-capacity-delta",
                "resource": "asg",
                "filters": [
                    {"type": "capacity-delta"}, {"tag:CustodianUnitTest": "not-null"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 1)

    def test_asg_filter_capacity_delta_nomatch(self):
        factory = self.replay_flight_data("test_asg_filter_capacity_delta_nomatch")
        p = self.load_policy(
            {
                "name": "asg-capacity-delta",
                "resource": "asg",
                "filters": [
                    {"type": "capacity-delta"}, {"tag:CustodianUnitTest": "not-null"}
                ],
            },
            session_factory=factory,
        )
        resources = p.run()
        self.assertEqual(len(resources), 0)


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>PinterestPlus</title>

Here's a Pinterest button using the new HTML5 syntax that the pinterest-plus-html5.min.js script supports:


text:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.OpenApi.Models;

namespace EasyRpc.AspNetCore.Documentation
{
    /// <summary>
    /// Operation filter context
    /// </summary>
    public class OperationFilterContext
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="methodConfiguration"></param>
        /// <param name="operation"></param>
        /// <param name="document"></param>
        public OperationFilterContext(HttpContext httpContext, IEndPointMethodConfigurationReadOnly methodConfiguration,
            OpenApiOperation operation, OpenApiDocument document)
        {
            HttpContext = httpContext;
            MethodConfiguration = methodConfiguration;
            Operation = operation;
            Document = document;
        }

        /// <summary>
        /// HttpContext for call
        /// </summary>
        public HttpContext HttpContext { get; }

        /// <summary>
        /// Method configuration
        /// </summary>
        public IEndPointMethodConfigurationReadOnly MethodConfiguration { get; }

        /// <summary>
        /// Document this will go in
        /// </summary>
        public OpenApiDocument Document { get; }

        /// <summary>
        /// Api operation
        /// </summary>
        public OpenApiOperation Operation { get; }

    }

    /// <summary>
    /// Operation filter
    /// </summary>
    public interface IOperationFilter
    {
        /// <summary>
        /// Apply logic
        /// </summary>
        /// <param name="context"></param>
        void Apply(OperationFilterContext context);
    }
}


text:
package org.apache.hadoop.mount;

import java.net.InetAddress;

import org.apache.hadoop.oncrpc.XDR;

/**
 * This is an interface that should be implemented for handle Mountd related
 * requests. See RFC 1094 for more details.
 */
public interface MountInterface {
  /** Mount procedures */
  public enum MNTPROC {
    // the order of the values below are significant.
    NULL,
    MNT,
    DUMP,
    UMNT,
    UMNTALL,
    EXPORT,
    EXPORTALL,
    PATHCONF;

    /** @return the int value representing the procedure. */
    public int getValue() {
      return ordinal();
    }

    /** The procedure of given value.
     * @param value specifies the procedure index
     * @return the procedure corresponding to the value.
     */
    public static MNTPROC fromValue(int value) {
      if (value < 0 || value >= values().length) {
        return null;
      }
      return values()[value];
    }
  }

  /**
   * MNTPRC_NULL - Do Nothing.
   * @param out XDR response used in NFS protocol
   * @param xid transaction id
   * @param client represents IP address
   * @return XDR response
   */
  public XDR nullOp(XDR out, int xid, InetAddress client);

  /**
   * MNTPROC_MNT - Add mount entry.
   * @param xdr XDR message used in NFS protocol
   * @param out XDR response used in NFS protocol
   * @param xid transaction id
   * @param client represents IP address
   * @return XDR response
   */
  public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client);

  /**
   * MNTPROC_DUMP - Return mount entries.
   * @param out XDR response used in NFS protocol
   * @param xid transaction id
   * @param client represents IP address
   * @return XDR response
   */
  public XDR dump(XDR out, int xid, InetAddress client);

  /**
   * MNTPROC_UMNT - Remove mount entry.
   * @param xdr XDR message used in NFS protocol
   * @param out XDR response used in NFS protocol
   * @param xid transaction id
   * @param client represents IP address
   * @return XDR response
   */
  public XDR umnt(XDR xdr, XDR out, int xid, InetAddress client);

  /**
   * MNTPROC_UMNTALL - Remove all mount entries.
   * @param out XDR response used in NFS protocol
   * @param xid transaction id
   * @param client represents IP address
   * @return XDR response
   */
  public XDR umntall(XDR out, int xid, InetAddress client);

  /** MNTPROC_EXPORT and MNTPROC_EXPORTALL - Return export list */
  //public XDR exportall(XDR out, int xid, InetAddress client);

  /** MNTPROC_PATHCONF - POSIX pathconf information */
  //public XDR pathconf(XDR out, int xid, InetAddress client);
}


text:
namespace TickTackToe.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Windows.Foundation;

    public class HumanPlayer : IPlayer
    {
        private char symbol;

        public HumanPlayer(char symbol)
        {
            this.symbol = symbol;
        }

        public PlayerType PlayerType
        {
            get
            {
                return PlayerType.Human;
            }
        }

        public char Symbol
        {
            get
            {
                return this.symbol;
            }
        }

        public IAsyncOperationWithProgress<uint, double> ThinkAsync(IEnumerable<char> gameBoard)
        {
            return null;
        }
    }
}


text:
import uuid from 'uuid';
import utils from './utils';
import Layer from './Layer';

/**
 * @class Network
 * @description The network which will predict the result than you want computed.
 */
export default class Network {
    /**
     * @constructor
     * @param {object} options Options configuration
     * @param {string} [options.name = 'N/A'] The name of the network
     * @param {object} [options.layers]
     * @param {object} [options.layers.config] The layers configuration
     */
    constructor(options = {
        name: 'N/A',
        activationFunction: utils.activationFunction.SIGMOID,
        layers: {
            config: {
                input: 2,
                hidden: [5, 5],
                output: 1
            }
        }
    }) {
        this.id = uuid.v4();
        this.name = options.name;
        this.activationFunction = options.activationFunction;
        this.layers = {
            config: {
                input: options.layers.config.input || 3,
                hidden: options.layers.config.hidden || [2, 2],
                output: options.layers.config.output || 1
            },
            input: null,
            hidden: [],
            output: null
        };

        this.layers.input = new Layer({
            type: 'input',
            size: options.layers.config.input,
            activationFunction: options.activationFunction
        });

        this.layers.hidden = Array.from({ length: options.layers.config.hidden.length }).map((v, i) => {
            return new Layer({
                type: 'hidden',
                size: options.layers.config.hidden[i],
                activationFunction: options.activationFunction
            });
        });

        this.layers.output = new Layer({
            type: 'output',
            size: options.layers.config.output,
            activationFunction: options.activationFunction
        });

        this.layers.input.project(this.layers.hidden[0]);
        this.layers.hidden.map((layer, i) => {
            if (i < this.layers.hidden.length - 1) {
                layer.project(this.layers.hidden[i + 1]);
            } else {
                layer.project(this.layers.output);
            }
        });
    }

    /**
     * Take input values and predict the expected result.
     * @param {Array<number>} input The input values to predict
     * @returns {Array<number>}
     */
    activate(input) {
        this.layers.input.activate(input);
        for (const hiddenLayer of this.layers.hidden) {
            hiddenLayer.activate();
        }

        return this.layers.output.activate();
    }

    propagate(learningRate, expected) {
        this.layers.output.propagate(learningRate, expected);

        const hiddenLayersCopy = Array.from(this.layers.hidden);
        hiddenLayersCopy.reverse().map(layer => layer.propagate(learningRate));
    }

    train(options = {
        costFunction: utils.costFn.CROSS_ENTROPY,
        learningRate: 0.01,
        error: 0.005,
        epoch: 1000,
        logging: 0
    }, set) {
        const startAt = Date.now();
        let error = 1;
        let iterations = 0;

        while (iterations < options.epoch && error > options.error) {
            error = 0;
            iterations++;

            error += this._trainSet(set, options);
            error /= set.length;

            if (options.logging && iterations % options.logging === 0) {
                console.log(`LOG::train -- Iterations ${iterations}/${options.epoch} -- Error ${error}.`);
            }
        }

        return {
            error: error,
            iterations: iterations,
            executionTime: (Date.now() - startAt)
        };
    }

    /**
     * Return a JSON object representing the layer.
     * @returns {{id: number, name: string, activationFunction: (string|*), layers: {config: Object, input: Layer, hidden: Array<Layer>, output: Layer}}}
     */
    toJSON() {
        return {
            id: this.id,
            name: this.name,
            activationFunction: this.activationFunction,
            layers: {
                config: this.layers.config,
                input: this.layers.input.toJSON(),
                hidden: this.layers.hidden.map(l => l.toJSON()),
                output: this.layers.output.toJSON()
            }
        };
    }

    _trainSet(set, options) {
        let errorSum = 0;
        for (const data of set) {
            const input = data.input;
            const expected = data.output;

            const outputResult = this.activate(input);
            this.propagate(options.learningRate, expected);

            errorSum += options.costFunction(expected, outputResult);
        }

        return errorSum;
    }
}