text:
static id _activeSession = nil;

@interface LKSession ()

@property (nonatomic) LKSocketSession *socketSession;
@property (nonatomic) NSString *authToken;

@property (nonatomic, copy) void (^didReceiveStateBlock)(LKResponse *response);
@property (nonatomic, copy) void (^didReceiveDevicesBlock)(LKResponse *response);
@property (nonatomic, copy) void (^didReceivePresetsBlock)(LKResponse *response);
@property (nonatomic, copy) void (^didReceiveScheduleBlock)(LKResponse *response);

@end

@implementation LKSession

#pragma mark - Class lifecycle

+ (instancetype)activeSession {
    return _activeSession;
}

- (instancetype)initWithBaseURL:(NSURL *)url {
    self = [super initWithBaseURL:url];
    if (self) {
        _activeSession = self;
    }
    return self;
}

#pragma mark - SocketRocket methods

- (void)openSessionWithUsername:(NSString *)username password:(NSString *)password completion:(void (^)(NSDictionary *userDict))completion {
    NSDictionary *params = @{@"username": username, @"password": password};
    [self POST:@"api/v1/sessions" parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
        self.authToken = responseObject[@"auth"][@"token"];
        NSString *str = [self.baseURL absoluteString];
        NSInteger colon = [str rangeOfString:@":"].location;
        if (colon != NSNotFound) {
            str = [str substringFromIndex:colon];
            str = [@"ws" stringByAppendingString:str];
        }
        self.socketSession = [[LKSocketSession alloc] initWithServer:[[NSURL URLWithString:str] URLByAppendingPathComponent:@"websocket"]];
        [self.socketSession openSessionWithCompletion:^{
            completion(responseObject);
        }];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {

    }];
}

- (void)suspendSession {
    [self.socketSession closeSession];
}

- (void)resumeSessionWithCompletion:(void (^)())completion {
    [self.socketSession resumeSessionWithCompletion:completion];
}

- (void)registerDeviceToken:(NSString *)deviceToken completion:(void (^)())completion {
    [self POST:@"api/v1/users/register_device_token"
                   parameters:@{@"auth_token": self.authToken, @"device_token": deviceToken}
                      success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
                          if (completion) {
                              completion();
                          }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"%@", [error localizedDescription]);
    }];
}

- (void)sendEvent:(LKEvent *)event {
    [self.socketSession sendEvent:event];
}

- (void)sendEventCollection:(LKEventCollection *)collection {
    [self.socketSession sendEventCollection:collection];
}

- (void)scheduleEvent:(LKScheduledEvent *)event withCompletion:(void (^)())completion {
    NSMutableDictionary *params = [[event dictionaryRepresentation] mutableCopy];
    params[@"auth_token"] = self.authToken;
    [self POST:@"api/v1/schedule" parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
        [self.socketSession notifyServerOfScheduleUpdateInZone:event.zone withCompletion:^{
            if (completion) {
                completion();
            }
        }];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"%@", [error localizedDescription]);
    }];
}

- (void)updateEvent:(LKScheduledEvent *)event withCompletion:(void (^)())completion {
    NSMutableDictionary *params = [@{@"auth_token": self.authToken} mutableCopy];
    params[@"schedule"] = [event dictionaryRepresentation];
    NSString *urlString = [NSString stringWithFormat:@"api/v1/schedule/%li", event.scheduleId];
    [self POST:urlString parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
        [self.socketSession notifyServerOfScheduleUpdateInZone:event.zone withCompletion:^{
            if (completion) {
                completion();
            }
        }];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"%@", [error localizedDescription]);
    }];
}

- (void)addPreset:(LKPreset *)preset withCompletion:(void (^)())completion {
    NSMutableDictionary *params = [@{@"auth_token": self.authToken} mutableCopy];
    params[@"preset"] = [preset dictionaryRepresentation];
    [self POST:@"api/v1/presets" parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) {
        completion();
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"%@", [error localizedDescription]);
    }];
}

- (void)executePreset:(LKPreset *)preset {
    LKEventCollection *collection = [LKEventCollection collectionWithEvents:preset.actions];
    [self sendEventCollection:collection];
}

#pragma mark - Convenience methods

- (void)queryStateWithBlock:(void (^)(LKEvent *event))block {
    [self.socketSession queryStateWithCompletion:block];
}

- (void)queryX10DevicesWithBlock:(void (^)(NSArray *devices))block {
    [self getPath:@"users/devices" completion:^(NSArray *responseObject) {
        NSMutableArray *devices = [NSMutableArray array];
        for (NSDictionary *zoneDict in responseObject) {
            for (NSDictionary *deviceDict in zoneDict[@"x10_devices"]) {
                [devices addObject:[LKX10Device deviceWithDictionary:deviceDict]];
            }
        }
        block([devices copy]);
    }];
}

- (void)queryPresetsWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"presets" completion:^(NSArray *responseObject) {
        NSMutableArray *presets = [NSMutableArray array];
        int i = 0;
        for (NSDictionary *presetDict in responseObject) {
            LKPreset *preset = [LKPreset presetFromDictionary:presetDict atIndex:i];
            [presets addObject:preset];
            i++;
        }
        block([presets copy]);
    }];
}

- (void)queryScheduleWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"beacons" completion:^(NSDictionary *responseObject) {
        NSMutableArray *events = [NSMutableArray array];
        for (NSDictionary *eventDict in responseObject[@"events"]) {
            [events addObject:[LKScheduledEvent eventFromDictionary:eventDict]];
        }
        block([events copy]);
    }];
}

- (void)queryAnimationsWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"colors/animations" completion:^(NSDictionary *responseObject) {
        NSMutableArray *devices = [NSMutableArray array];
        for (NSDictionary *dict in responseObject[@"animations"]) {
            [devices addObject:[LKAnimation animationWithDictionary:dict]];
        }
        block([devices copy]);
    }];
}

- (void)queryColorPermissionsWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"users/color_zones" completion:^(NSDictionary *responseObject) {
        block(responseObject[@"color_zones"]);
    }];
}

- (void)queryRoomsWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"rooms" completion:^(NSArray *responseObject) {
        NSMutableArray *rooms = [NSMutableArray array];
        for (NSDictionary *roomDict in responseObject) {
            [rooms addObject:[LKRoom roomWithDictionary:roomDict]];
        }
        block([rooms copy]);
    }];
}

- (void)queryBeaconsWithBlock:(void (^)(NSArray *))block {
    [self getPath:@"beacons" completion:^(NSArray *responseObject) {
        NSMutableArray *beacons = [NSMutableArray array];
        for (NSDictionary *beaconDict in responseObject) {
            [beacons addObject:[LKBeacon beaconWithDictionary:beaconDict]];
        }
        block([beacons copy]);
    }];
}

#pragma mark - Private methods

- (void)getPath:(NSString *)path completion:(void (^)(id))completion {
    if ([path rangeOfString:@"api/v1"].location == NSNotFound) {
        path = [@"api/v1" stringByAppendingPathComponent:path];
    }
    [self GET:path parameters:@{@"auth_token": self.authToken} success:^(NSURLSessionDataTask *task, id responseObject) {
        completion(responseObject);
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        if ([self.delegate respondsToSelector:@selector(session:didFailWithError:retryHandler:)]) {
            [self.delegate session:self didFailWithError:error retryHandler:^{
                [self getPath:path completion:completion];
            }];
        }
    }];
}

@end


text:
<?php

require_once dirname(__FILE__).'/../lib/dmMailTemplateGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/dmMailTemplateGeneratorHelper.class.php';

/**
 * dmMailTemplate actions.
 *
 * @package    diem-commerce
 * @subpackage dmMailTemplate
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class dmMailTemplateActions extends autoDmMailTemplateActions
{
}

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Diagrams.Backend.GHCJS
import           Diagrams.Prelude
import qualified JavaScript.Web.Canvas          as C

import           GHCJS.DOM
import           GHCJS.DOM.Document
import           GHCJS.DOM.Element
import           GHCJS.DOM.Types                hiding (Event)
import           GHCJS.Types
import qualified JavaScript.Web.Canvas.Internal as C

import           Data.Coerce
import qualified Data.Text                      as T

main :: IO ()
main = do
  Just doc <- currentDocument
  Just body <- getBody doc
  setInnerHTML body $ Just initialHtml
  ctx <- getContextById "dia"
  renderDia Canvas (CanvasOptions (dims2D 200 200) ctx) dia

getContextById :: JSString -> IO C.Context
getContextById name = do
  Just doc <- currentDocument
  Just c <- getElementById doc name
  C.getContext . coerce $ c

initialHtml :: T.Text
initialHtml = "<canvas id=\"dia\" width=\"200\" height=\"200\"></canvas>"

dia :: Diagram Canvas
dia = triangle 1 # fc blue <> square 1 # fc red


text:
using System.Linq;
using FluentAssertions;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Xunit;
using Xunit.Abstractions;
using Parser = Microsoft.DotNet.Cli.Parser;

namespace Microsoft.DotNet.Tests.ParserTests
{
    public class UninstallToolParserTests
    {
        private readonly ITestOutputHelper output;

        public UninstallToolParserTests(ITestOutputHelper output)
        {
            this.output = output;
        }

        [Fact]
        public void UninstallToolParserCanGetPackageId()
        {
            var command = Parser.Instance;
            var result = command.Parse("dotnet tool uninstall -g console.test.app");

            var parseResult = result["dotnet"]["tool"]["uninstall"];

            var packageId = parseResult.Arguments.Single();

            packageId.Should().Be("console.test.app");
        }

        [Fact]
        public void UninstallToolParserCanGetGlobalOption()
        {
            var result = Parser.Instance.Parse("dotnet tool uninstall -g console.test.app");

            var appliedOptions = result["dotnet"]["tool"]["uninstall"];
            appliedOptions.ValueOrDefault<bool>("global").Should().Be(true);
        }

        [Fact]
        public void UninstallToolParserCanParseToolPathOption()
        {
            var result =
                Parser.Instance.Parse(@"dotnet tool uninstall --tool-path C:\Tools console.test.app");

            var appliedOptions = result["dotnet"]["tool"]["uninstall"];
            appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\Tools");
        }
    }
}


text:
package wdl.expression

import wdl.{SampleWdl, WdlExpression, WdlNamespaceWithWorkflow}
import org.scalatest.prop.TableDrivenPropertyChecks._
import org.scalatest.{FlatSpec, Matchers}
import wdl.types.WdlCallOutputsObjectType
import wom.types._
import wom.values.WomPrimitive

import scala.util.{Failure, Success, Try}

class TypeEvaluatorSpec extends FlatSpec with Matchers {
  val expr: String => WdlExpression = WdlExpression.fromString
  val namespace = WdlNamespaceWithWorkflow.load(SampleWdl.ThreeStep.workflowSource(), Seq.empty).get

  def noLookup(String: String): WomType = fail("No identifiers should be looked up in this test")

  def identifierLookup(String: String): WomType = {
    String match {
      case "cgrep" => WdlCallOutputsObjectType(namespace.workflow.calls.find(_.unqualifiedName == "cgrep").get)
      case "ps" => WdlCallOutputsObjectType(namespace.workflow.calls.find(_.unqualifiedName == "ps").get)
    }
  }

  def identifierEval(exprStr: String): WomPrimitiveType = expr(exprStr).evaluateType(identifierLookup, new WdlStandardLibraryFunctionsType).asInstanceOf[Try[WomPrimitiveType]].get
  def identifierEvalError(exprStr: String): Unit = {
    expr(exprStr).evaluateType(identifierLookup, new WdlStandardLibraryFunctionsType).asInstanceOf[Try[WomPrimitive]] match {
      case Failure(_) => // Expected
      case Success(badValue) => fail(s"Operation was supposed to fail, instead I got value: $badValue")
    }
  }

  private def operate(lhs: WomType, op: String, rhs: WomType): Try[WomType] = op match {
    case "+" => lhs.add(rhs)
    case "-" => lhs.subtract(rhs)
    case "*" => lhs.multiply(rhs)
    case "/" => lhs.divide(rhs)
    case "%" => lhs.mod(rhs)
    case "==" => lhs.equals(rhs)
    case "!=" => lhs.notEquals(rhs)
    case "<" => lhs.lessThan(rhs)
    case "<=" => lhs.lessThanOrEqual(rhs)
    case ">" => lhs.greaterThan(rhs)
    case ">=" => lhs.greaterThanOrEqual(rhs)
    case "||" => lhs.or(rhs)
    case "&&" => lhs.and(rhs)
    case _ => fail(s"unexpected operator: $op")
  }

  val validOperations = Table(
    ("lhs", "op", "rhs", "result"),
    (WomIntegerType, "+", WomIntegerType, WomIntegerType),
    (WomIntegerType, "+", WomFloatType, WomFloatType),
    (WomIntegerType, "+", WomStringType, WomStringType),
    (WomIntegerType, "-", WomIntegerType, WomIntegerType),
    (WomIntegerType, "-", WomFloatType, WomFloatType),
    (WomIntegerType, "*", WomIntegerType, WomIntegerType),
    (WomIntegerType, "*", WomFloatType, WomFloatType),
    (WomIntegerType, "/", WomIntegerType, WomIntegerType),
    (WomIntegerType, "/", WomFloatType, WomFloatType),
    (WomIntegerType, "%", WomIntegerType, WomIntegerType),
    (WomIntegerType, "%", WomFloatType, WomFloatType),
    (WomIntegerType, "==", WomIntegerType, WomBooleanType),
    (WomIntegerType, "==", WomFloatType, WomBooleanType),
    (WomIntegerType, "!=", WomIntegerType, WomBooleanType),
    (WomIntegerType, "!=", WomFloatType, WomBooleanType),
    (WomIntegerType, "<", WomIntegerType, WomBooleanType),
    (WomIntegerType, "<", WomFloatType, WomBooleanType),
    (WomIntegerType, "<=", WomIntegerType, WomBooleanType),
    (WomIntegerType, "<=", WomFloatType, WomBooleanType),
    (WomIntegerType, ">", WomIntegerType, WomBooleanType),
    (WomIntegerType, ">", WomFloatType, WomBooleanType),
    (WomIntegerType, ">=", WomIntegerType, WomBooleanType),
    (WomIntegerType, ">=", WomFloatType, WomBooleanType),
    (WomFloatType, "+", WomIntegerType, WomFloatType),
    (WomFloatType, "+", WomFloatType, WomFloatType),
    (WomFloatType, "+", WomStringType, WomStringType),
    (WomFloatType, "-", WomIntegerType, WomFloatType),
    (WomFloatType, "-", WomFloatType, WomFloatType),
    (WomFloatType, "*", WomIntegerType, WomFloatType),
    (WomFloatType, "*", WomFloatType, WomFloatType),
    (WomFloatType, "/", WomIntegerType, WomFloatType),
    (WomFloatType, "/", WomFloatType, WomFloatType),
    (WomFloatType, "%", WomIntegerType, WomFloatType),
    (WomFloatType, "%", WomFloatType, WomFloatType),
    (WomFloatType, "==", WomIntegerType, WomBooleanType),
    (WomFloatType, "==", WomFloatType, WomBooleanType),
    (WomFloatType, "!=", WomIntegerType, WomBooleanType),
    (WomFloatType, "!=", WomFloatType, WomBooleanType),
    (WomFloatType, "<", WomIntegerType, WomBooleanType),
    (WomFloatType, "<", WomFloatType, WomBooleanType),
    (WomFloatType, "<=", WomIntegerType, WomBooleanType),
    (WomFloatType, "<=", WomFloatType, WomBooleanType),
    (WomFloatType, ">", WomIntegerType, WomBooleanType),
    (WomFloatType, ">", WomFloatType, WomBooleanType),
    (WomFloatType, ">=", WomIntegerType, WomBooleanType),
    (WomFloatType, ">=", WomFloatType, WomBooleanType),
    (WomStringType, "+", WomIntegerType, WomStringType),
    (WomStringType, "+", WomFloatType, WomStringType),
    (WomStringType, "+", WomStringType, WomStringType),
    (WomStringType, "+", WomFileType, WomStringType),
    (WomStringType, "==", WomStringType, WomBooleanType),
    (WomStringType, "!=", WomStringType, WomBooleanType),
    (WomStringType, "<", WomStringType, WomBooleanType),
    (WomStringType, "<=", WomStringType, WomBooleanType),
    (WomStringType, ">", WomStringType, WomBooleanType),
    (WomStringType, ">=", WomStringType, WomBooleanType),
    (WomFileType, "+", WomStringType, WomFileType),
    (WomFileType, "==", WomStringType, WomBooleanType),
    (WomFileType, "==", WomFileType, WomBooleanType),
    (WomFileType, "!=", WomStringType, WomBooleanType),
    (WomFileType, "!=", WomFileType, WomBooleanType),
    (WomFileType, "<=", WomStringType, WomBooleanType),
    (WomFileType, "<=", WomFileType, WomBooleanType),
    (WomFileType, ">=", WomStringType, WomBooleanType),
    (WomFileType, ">=", WomFileType, WomBooleanType),
    (WomBooleanType, "==", WomBooleanType, WomBooleanType),
    (WomBooleanType, "!=", WomBooleanType, WomBooleanType),
    (WomBooleanType, "<", WomBooleanType, WomBooleanType),
    (WomBooleanType, "<=", WomBooleanType, WomBooleanType),
    (WomBooleanType, ">", WomBooleanType, WomBooleanType),
    (WomBooleanType, ">=", WomBooleanType, WomBooleanType),
    (WomBooleanType, "||", WomBooleanType, WomBooleanType),
    (WomBooleanType, "&&", WomBooleanType, WomBooleanType)
  )

  val invalidOperations = Table(
    ("lhs", "op", "rhs"),
    (WomIntegerType, "+", WomFileType),
    (WomIntegerType, "+", WomBooleanType),
    (WomIntegerType, "-", WomStringType),
    (WomIntegerType, "-", WomFileType),
    (WomIntegerType, "-", WomBooleanType),
    (WomIntegerType, "*", WomStringType),
    (WomIntegerType, "*", WomFileType),
    (WomIntegerType, "*", WomBooleanType),
    (WomIntegerType, "/", WomStringType),
    (WomIntegerType, "/", WomFileType),
    (WomIntegerType, "/", WomBooleanType),
    (WomIntegerType, "%", WomStringType),
    (WomIntegerType, "%", WomFileType),
    (WomIntegerType, "%", WomBooleanType),
    (WomIntegerType, "==", WomStringType),
    (WomIntegerType, "==", WomFileType),
    (WomIntegerType, "==", WomBooleanType),
    (WomIntegerType, "!=", WomStringType),
    (WomIntegerType, "!=", WomFileType),
    (WomIntegerType, "!=", WomBooleanType),
    (WomIntegerType, "<", WomStringType),
    (WomIntegerType, "<", WomFileType),
    (WomIntegerType, "<", WomBooleanType),
    (WomIntegerType, "<=", WomStringType),
    (WomIntegerType, "<=", WomFileType),
    (WomIntegerType, "<=", WomBooleanType),
    (WomIntegerType, ">", WomStringType),
    (WomIntegerType, ">", WomFileType),
    (WomIntegerType, ">", WomBooleanType),
    (WomIntegerType, ">=", WomStringType),
    (WomIntegerType, ">=", WomFileType),
    (WomIntegerType, ">=", WomBooleanType),
    (WomIntegerType, "||", WomIntegerType),
    (WomIntegerType, "||", WomFloatType),
    (WomIntegerType, "||", WomStringType),
    (WomIntegerType, "||", WomFileType),
    (WomIntegerType, "||", WomBooleanType),
    (WomIntegerType, "&&", WomIntegerType),
    (WomIntegerType, "&&", WomFloatType),
    (WomIntegerType, "&&", WomStringType),
    (WomIntegerType, "&&", WomFileType),
    (WomIntegerType, "&&", WomBooleanType),
    (WomFloatType, "+", WomFileType),
    (WomFloatType, "+", WomBooleanType),
    (WomFloatType, "-", WomStringType),
    (WomFloatType, "-", WomFileType),
    (WomFloatType, "-", WomBooleanType),
    (WomFloatType, "*", WomStringType),
    (WomFloatType, "*", WomFileType),
    (WomFloatType, "*", WomBooleanType),
    (WomFloatType, "/", WomStringType),
    (WomFloatType, "/", WomFileType),
    (WomFloatType, "/", WomBooleanType),
    (WomFloatType, "%", WomStringType),
    (WomFloatType, "%", WomFileType),
    (WomFloatType, "%", WomBooleanType),
    (WomFloatType, "==", WomStringType),
    (WomFloatType, "==", WomFileType),
    (WomFloatType, "==", WomBooleanType),
    (WomFloatType, "!=", WomStringType),
    (WomFloatType, "!=", WomFileType),
    (WomFloatType, "!=", WomBooleanType),
    (WomFloatType, "<", WomStringType),
    (WomFloatType, "<", WomFileType),
    (WomFloatType, "<", WomBooleanType),
    (WomFloatType, "<=", WomStringType),
    (WomFloatType, "<=", WomFileType),
    (WomFloatType, "<=", WomBooleanType),
    (WomFloatType, ">", WomStringType),
    (WomFloatType, ">", WomFileType),
    (WomFloatType, ">", WomBooleanType),
    (WomFloatType, ">=", WomStringType),
    (WomFloatType, ">=", WomFileType),
    (WomFloatType, ">=", WomBooleanType),
    (WomFloatType, "||", WomIntegerType),
    (WomFloatType, "||", WomFloatType),
    (WomFloatType, "||", WomStringType),
    (WomFloatType, "||", WomFileType),
    (WomFloatType, "||", WomBooleanType),
    (WomFloatType, "&&", WomIntegerType),
    (WomFloatType, "&&", WomFloatType),
    (WomFloatType, "&&", WomStringType),
    (WomFloatType, "&&", WomFileType),
    (WomFloatType, "&&", WomBooleanType),
    (WomStringType, "+", WomBooleanType),
    (WomStringType, "-", WomIntegerType),
    (WomStringType, "-", WomFloatType),
    (WomStringType, "-", WomStringType),
    (WomStringType, "-", WomFileType),
    (WomStringType, "-", WomBooleanType),
    (WomStringType, "*", WomIntegerType),
    (WomStringType, "*", WomFloatType),
    (WomStringType, "*", WomStringType),
    (WomStringType, "*", WomFileType),
    (WomStringType, "*", WomBooleanType),
    (WomStringType, "/", WomIntegerType),
    (WomStringType, "/", WomFloatType),
    (WomStringType, "/", WomStringType),
    (WomStringType, "/", WomFileType),
    (WomStringType, "/", WomBooleanType),
    (WomStringType, "%", WomIntegerType),
    (WomStringType, "%", WomFloatType),
    (WomStringType, "%", WomStringType),
    (WomStringType, "%", WomFileType),
    (WomStringType, "%", WomBooleanType),
    (WomStringType, "==", WomIntegerType),
    (WomStringType, "==", WomFloatType),
    (WomStringType, "==", WomFileType),
    (WomStringType, "==", WomBooleanType),
    (WomStringType, "!=", WomIntegerType),
    (WomStringType, "!=", WomFloatType),
    (WomStringType, "!=", WomFileType),
    (WomStringType, "!=", WomBooleanType),
    (WomStringType, "<", WomIntegerType),
    (WomStringType, "<", WomFloatType),
    (WomStringType, "<", WomFileType),
    (WomStringType, "<", WomBooleanType),
    (WomStringType, "<=", WomIntegerType),
    (WomStringType, "<=", WomFloatType),
    (WomStringType, "<=", WomFileType),
    (WomStringType, "<=", WomBooleanType),
    (WomStringType, ">", WomIntegerType),
    (WomStringType, ">", WomFloatType),
    (WomStringType, ">", WomFileType),
    (WomStringType, ">", WomBooleanType),
    (WomStringType, ">=", WomIntegerType),
    (WomStringType, ">=", WomFloatType),
    (WomStringType, ">=", WomFileType),
    (WomStringType, ">=", WomBooleanType),
    (WomStringType, "||", WomIntegerType),
    (WomStringType, "||", WomFloatType),
    (WomStringType, "||", WomStringType),
    (WomStringType, "||", WomFileType),
    (WomStringType, "||", WomBooleanType),
    (WomStringType, "&&", WomIntegerType),
    (WomStringType, "&&", WomFloatType),
    (WomStringType, "&&", WomStringType),
    (WomStringType, "&&", WomFileType),
    (WomStringType, "&&", WomBooleanType),
    (WomFileType, "+", WomFileType),
    (WomFileType, "+", WomIntegerType),
    (WomFileType, "+", WomFloatType),
    (WomFileType, "+", WomBooleanType),
    (WomFileType, "-", WomIntegerType),
    (WomFileType, "-", WomFloatType),
    (WomFileType, "-", WomStringType),
    (WomFileType, "-", WomFileType),
    (WomFileType, "-", WomBooleanType),
    (WomFileType, "*", WomIntegerType),
    (WomFileType, "*", WomFloatType),
    (WomFileType, "*", WomStringType),
    (WomFileType, "*", WomFileType),
    (WomFileType, "*", WomBooleanType),
    (WomFileType, "/", WomIntegerType),
    (WomFileType, "/", WomFloatType),
    (WomFileType, "/", WomStringType),
    (WomFileType, "/", WomFileType),
    (WomFileType, "/", WomBooleanType),
    (WomFileType, "%", WomIntegerType),
    (WomFileType, "%", WomFloatType),
    (WomFileType, "%", WomStringType),
    (WomFileType, "%", WomFileType),
    (WomFileType, "%", WomBooleanType),
    (WomFileType, "==", WomIntegerType),
    (WomFileType, "==", WomFloatType),
    (WomFileType, "==", WomBooleanType),
    (WomFileType, "!=", WomIntegerType),
    (WomFileType, "!=", WomFloatType),
    (WomFileType, "!=", WomBooleanType),
    (WomFileType, "<", WomIntegerType),
    (WomFileType, "<", WomFloatType),
    (WomFileType, "<", WomStringType),
    (WomFileType, "<", WomFileType),
    (WomFileType, "<", WomBooleanType),
    (WomFileType, "<=", WomIntegerType),
    (WomFileType, "<=", WomFloatType),
    (WomFileType, "<=", WomBooleanType),
    (WomFileType, ">", WomIntegerType),
    (WomFileType, ">", WomFloatType),
    (WomFileType, ">", WomStringType),
    (WomFileType, ">", WomFileType),
    (WomFileType, ">", WomBooleanType),
    (WomFileType, ">=", WomIntegerType),
    (WomFileType, ">=", WomFloatType),
    (WomFileType, ">=", WomBooleanType),
    (WomFileType, "||", WomIntegerType),
    (WomFileType, "||", WomFloatType),
    (WomFileType, "||", WomStringType),
    (WomFileType, "||", WomFileType),
    (WomFileType, "||", WomBooleanType),
    (WomFileType, "&&", WomIntegerType),
    (WomFileType, "&&", WomFloatType),
    (WomFileType, "&&", WomStringType),
    (WomFileType, "&&", WomFileType),
    (WomFileType, "&&", WomBooleanType),
    (WomBooleanType, "+", WomIntegerType),
    (WomBooleanType, "+", WomFloatType),
    (WomBooleanType, "+", WomStringType),
    (WomBooleanType, "+", WomFileType),
    (WomBooleanType, "+", WomBooleanType),
    (WomBooleanType, "-", WomIntegerType),
    (WomBooleanType, "-", WomFloatType),
    (WomBooleanType, "-", WomStringType),
    (WomBooleanType, "-", WomFileType),
    (WomBooleanType, "-", WomBooleanType),
    (WomBooleanType, "*", WomIntegerType),
    (WomBooleanType, "*", WomFloatType),
    (WomBooleanType, "*", WomStringType),
    (WomBooleanType, "*", WomFileType),
    (WomBooleanType, "*", WomBooleanType),
    (WomBooleanType, "/", WomIntegerType),
    (WomBooleanType, "/", WomFloatType),
    (WomBooleanType, "/", WomStringType),
    (WomBooleanType, "/", WomFileType),
    (WomBooleanType, "/", WomBooleanType),
    (WomBooleanType, "%", WomIntegerType),
    (WomBooleanType, "%", WomFloatType),
    (WomBooleanType, "%", WomStringType),
    (WomBooleanType, "%", WomFileType),
    (WomBooleanType, "%", WomBooleanType),
    (WomBooleanType, "==", WomIntegerType),
    (WomBooleanType, "==", WomFloatType),
    (WomBooleanType, "==", WomStringType),
    (WomBooleanType, "==", WomFileType),
    (WomBooleanType, "!=", WomIntegerType),
    (WomBooleanType, "!=", WomFloatType),
    (WomBooleanType, "!=", WomStringType),
    (WomBooleanType, "!=", WomFileType),
    (WomBooleanType, "<", WomIntegerType),
    (WomBooleanType, "<", WomFloatType),
    (WomBooleanType, "<", WomStringType),
    (WomBooleanType, "<", WomFileType),
    (WomBooleanType, "<=", WomIntegerType),
    (WomBooleanType, "<=", WomFloatType),
    (WomBooleanType, "<=", WomStringType),
    (WomBooleanType, "<=", WomFileType),
    (WomBooleanType, ">", WomIntegerType),
    (WomBooleanType, ">", WomFloatType),
    (WomBooleanType, ">", WomStringType),
    (WomBooleanType, ">", WomFileType),
    (WomBooleanType, ">=", WomIntegerType),
    (WomBooleanType, ">=", WomFloatType),
    (WomBooleanType, ">=", WomStringType),
    (WomBooleanType, ">=", WomFileType),
    (WomBooleanType, "||", WomIntegerType),
    (WomBooleanType, "||", WomFloatType),
    (WomBooleanType, "||", WomStringType),
    (WomBooleanType, "||", WomFileType),
    (WomBooleanType, "&&", WomIntegerType),
    (WomBooleanType, "&&", WomFloatType),
    (WomBooleanType, "&&", WomStringType),
    (WomBooleanType, "&&", WomFileType)
  )

  forAll (validOperations) { (lhs, op, rhs, expectedType) =>
    it should s"validate the output type for the expression: $lhs $op $rhs = $expectedType" in {
      operate(lhs, op, rhs) shouldEqual Success(expectedType)
    }
  }

  forAll (invalidOperations) { (lhs, op, rhs) =>
    it should s"not allow the expression: $lhs $op $rhs" in {
      operate(lhs, op, rhs) should be(a[Failure[_]])
    }
  }

  "Expression Evaluator with Object as LHS" should "Lookup object string attribute" in {
    identifierEval("cgrep.count") shouldEqual WomIntegerType
  }
  it should "Lookup object integer attribute" in {
    identifierEval("ps.procs") shouldEqual WomFileType
  }
  it should "Error if key doesn't exist" in {
    identifierEvalError("ps.badkey")
  }
}


text:
import express, { Router } from "express"
import * as path from "path"
import {
    renderFrontPage,
    renderGdocsPageBySlug,
    renderPageBySlug,
    renderChartsPage,
    renderMenuJson,
    renderSearchPage,
    renderDonatePage,
    entriesByYearPage,
    makeAtomFeed,
    feedbackPage,
    renderNotFoundPage,
    renderBlogByPageNum,
    renderCovidPage,
    countryProfileCountryPage,
    renderExplorerPage,
} from "../baker/siteRenderers.js"
import { grapherSlugToHtmlPage } from "../baker/GrapherBaker.js"
import {
    BAKED_BASE_URL,
    WORDPRESS_DIR,
    BASE_DIR,
    BAKED_SITE_DIR,
} from "../settings/serverSettings.js"

import { expectInt, renderToHtmlPage } from "../serverUtils/serverUtil.js"
import {
    countryProfilePage,
    countriesIndexPage,
} from "../baker/countryProfiles.js"
import { makeSitemap } from "../baker/sitemap.js"
import { OldChart } from "../db/model/Chart.js"
import { countryProfileSpecs } from "../site/countryProfileProjects.js"
import { ExplorerAdminServer } from "../explorerAdminServer/ExplorerAdminServer.js"
import { grapherToSVG } from "../baker/GrapherImageBaker.js"
import { getVariableData } from "../db/model/Variable.js"
import { MultiEmbedderTestPage } from "../site/multiembedder/MultiEmbedderTestPage.js"
import { bakeEmbedSnippet } from "../site/webpackUtils.js"
import { JsonError } from "@ourworldindata/utils"
import { GIT_CMS_DIR } from "../gitCms/GitCmsConstants.js"
import { isWordpressAPIEnabled } from "../db/wpdb.js"
import { EXPLORERS_ROUTE_FOLDER } from "../explorer/ExplorerConstants.js"
import { getExplorerRedirectForPath } from "../explorerAdminServer/ExplorerRedirects.js"
import { explorerUrlMigrationsById } from "../explorer/urlMigrations/ExplorerUrlMigrations.js"

require("express-async-errors")

// todo: switch to an object literal where the key is the path and the value is the request handler? easier to test, reflect on, and manipulate
const mockSiteRouter = Router()

mockSiteRouter.use(express.urlencoded({ extended: true }))
mockSiteRouter.use(express.json())

mockSiteRouter.get("/sitemap.xml", async (req, res) =>
    res.send(await makeSitemap(explorerAdminServer))
)

mockSiteRouter.get("/atom.xml", async (req, res) =>
    res.send(await makeAtomFeed())
)

mockSiteRouter.get("/entries-by-year", async (req, res) =>
    res.send(await entriesByYearPage())
)

mockSiteRouter.get(`/entries-by-year/:year`, async (req, res) =>
    res.send(await entriesByYearPage(parseInt(req.params.year)))
)

mockSiteRouter.get(
    "/grapher/data/variables/data/:variableId.json",
    async (req, res) => {
        res.set("Access-Control-Allow-Origin", "*")
        res.json((await getVariableData(expectInt(req.params.variableId))).data)
    }
)

mockSiteRouter.get(
    "/grapher/data/variables/metadata/:variableId.json",
    async (req, res) => {
        res.set("Access-Control-Allow-Origin", "*")
        const variableData = await getVariableData(
            expectInt(req.params.variableId)
        )
        res.json(variableData.metadata)
    }
)

mockSiteRouter.get("/grapher/embedCharts.js", async (req, res) =>
    res.send(bakeEmbedSnippet(BAKED_BASE_URL))
)

const explorerAdminServer = new ExplorerAdminServer(GIT_CMS_DIR)

mockSiteRouter.get(`/${EXPLORERS_ROUTE_FOLDER}/:slug`, async (req, res) => {
    res.set("Access-Control-Allow-Origin", "*")
    const explorers = await explorerAdminServer.getAllPublishedExplorers()
    const explorerProgram = explorers.find(
        (program) => program.slug === req.params.slug
    )
    if (explorerProgram) res.send(await renderExplorerPage(explorerProgram))
    else
        throw new JsonError(
            "A published explorer with that slug was not found",
            404
        )
})
mockSiteRouter.get("/*", async (req, res, next) => {
    const explorerRedirect = getExplorerRedirectForPath(req.path)
    // If no explorer redirect exists, continue to next express handler
    if (!explorerRedirect) return next()

    const { migrationId, baseQueryStr } = explorerRedirect
    const { explorerSlug } = explorerUrlMigrationsById[migrationId]
    const program = await explorerAdminServer.getExplorerFromSlug(explorerSlug)
    res.send(
        await renderExplorerPage(program, {
            explorerUrlMigrationId: migrationId,
            baseQueryStr,
        })
    )
})

mockSiteRouter.get("/grapher/:slug", async (req, res) => {
    // XXX add dev-prod parity for this
    res.set("Access-Control-Allow-Origin", "*")
    res.send(await grapherSlugToHtmlPage(req.params.slug))
})

mockSiteRouter.get("/", async (req, res) => {
    res.send(await renderFrontPage())
})

mockSiteRouter.get("/donate", async (req, res) =>
    res.send(await renderDonatePage())
)

mockSiteRouter.get("/charts", async (req, res) => {
    const explorerAdminServer = new ExplorerAdminServer(GIT_CMS_DIR)
    res.send(await renderChartsPage(explorerAdminServer))
})

countryProfileSpecs.forEach((spec) =>
    mockSiteRouter.get(`/${spec.rootPath}/:countrySlug`, async (req, res) =>
        res.send(await countryProfileCountryPage(spec, req.params.countrySlug))
    )
)

// Route only available on the dev server
mockSiteRouter.get("/covid", async (req, res) =>
    res.send(await renderCovidPage())
)

mockSiteRouter.get("/search", async (req, res) =>
    res.send(await renderSearchPage())
)

mockSiteRouter.get("/blog", async (req, res) =>
    res.send(await renderBlogByPageNum(1))
)

mockSiteRouter.get("/blog/page/:pageno", async (req, res) => {
    const pagenum = parseInt(req.params.pageno, 10)
    if (!isNaN(pagenum))
        res.send(await renderBlogByPageNum(isNaN(pagenum) ? 1 : pagenum))
    else throw new Error("invalid page number")
})

mockSiteRouter.get("/headerMenu.json", async (req, res) => {
    if (!isWordpressAPIEnabled) {
        res.status(404).send(await renderNotFoundPage())
        return
    }
    res.send(await renderMenuJson())
})

mockSiteRouter.use(
    // Not all /app/uploads paths are going through formatting
    // and being rewritten as /uploads. E.g. blog index images paths
    // on front page.
    ["/uploads", "/app/uploads"],
    express.static(path.join(WORDPRESS_DIR, "web/app/uploads"), {
        fallthrough: false,
    })
)

mockSiteRouter.use(
    "/exports",
    express.static(path.join(BAKED_SITE_DIR, "exports"))
)

mockSiteRouter.use("/grapher/exports/:slug.svg", async (req, res) => {
    const grapher = await OldChart.getBySlug(req.params.slug)
    const vardata = await grapher.getVariableData()
    res.setHeader("Content-Type", "image/svg+xml")
    res.send(await grapherToSVG(grapher.config, vardata))
})

mockSiteRouter.use("/", express.static(path.join(BASE_DIR, "public")))

mockSiteRouter.get("/countries", async (req, res) =>
    res.send(await countriesIndexPage(BAKED_BASE_URL))
)

mockSiteRouter.get("/country/:countrySlug", async (req, res) =>
    res.send(await countryProfilePage(req.params.countrySlug, BAKED_BASE_URL))
)

mockSiteRouter.get("/feedback", async (req, res) =>
    res.send(await feedbackPage())
)

mockSiteRouter.get("/multiEmbedderTest", async (req, res) =>
    res.send(
        renderToHtmlPage(
            MultiEmbedderTestPage(req.query.globalEntitySelector === "true")
        )
    )
)

mockSiteRouter.get("/*", async (req, res) => {
    const slug = req.path.replace(/^\//, "").replace("/", "__")

    try {
        res.send(await renderGdocsPageBySlug(slug))
    } catch (e) {}

    try {
        res.send(await renderPageBySlug(slug))
    } catch (e) {
        console.error(e)
        res.status(404).send(await renderNotFoundPage())
    }
})

export { mockSiteRouter }


text:
package cn.lhfei.hadoop.ch08.join;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * @version 0.1
 *
 * @author Hefei Li
 *
 * @since May 10, 2015
 */
public class JoinStationMapper extends
		Mapper<LongWritable, Text, TextPair, Text> {
	private NcdcStationMetadataParser parser = new NcdcStationMetadataParser();

	@Override
	protected void map(LongWritable key, Text value, Context context)
			throws IOException, InterruptedException {
		if (parser.parse(value)) {
			context.write(new TextPair(parser.getStationId(), "0"), new Text(
					parser.getStationName()));
		}
	}
}


text:
package pl.edu.bogdan.training.patterns.abstractfactory;

public interface Figure {
	public double getArea();
	public double getPerimeter();
}


text:
namespace pragma { namespace Raster
{

	template<>
	inline void RasterLines<VertexFormat::Color,VertexColorRaster>( Real& aLeftStart, Real& aRightStart, unsigned& aY
																  , Real aLeftIncrement, Real aRightIncrement, unsigned aCount
																  , VertexFormat::Color::ScanlineParameters::Increments& aIncrements
																  , VertexFormat::Color::ScanlineParameters::Edge& aLeft
																  , VertexFormat::Color::ScanlineParameters::Edge& aRight )
	{
		Real lLeftScan;
		Real lRightScan;

		while( aCount-- )
		{
			lLeftScan  = aLeftStart;
			lRightScan = aRightStart;

			unsigned lCount;
			Real lAdjustX = AdjustScanline(lLeftScan, lRightScan - lLeftScan, lCount);

			if(lCount > 0)
			{
				_Color lStartColor = ((aRight.mColor - aLeft.mColor) * lAdjustX) + aLeft.mColor;

				unsigned lPosition = (aY * Raster::sWidth + unsigned(lLeftScan));
				unsigned char* lPtr = &sScreen[lPosition<<2];

				while(lCount--)
				{
					*lPtr++ = lStartColor.x;
					*lPtr++ = lStartColor.y;
					*lPtr++ = lStartColor.z;
					*lPtr++ = 0;
					lStartColor+= aIncrements.mColorGradient; //lIncColor;
				}
			}
			aLeftStart+= aLeftIncrement;
			aRightStart+= aRightIncrement;

			aLeft.mColor+= aLeft.mColorGradient;
			aRight.mColor+= aRight.mColorGradient;

			aY++;
		}
	}

} }


text:
<!DOCTYPE html>

<?php $pagina = 'productos';?>
<?php include('_head.php');?>

<?php include('_header.php');?>

SISTEMA MECAL

Ventanas corredizas y proyectantes para el mercado de viviendas evolutivas y cooperativas. Ventanas corredizas para el mercado de viviendas de padrón medio.

SISTEMA PROBBA

Puertas y ventanas corredizas, ventana batiente, banderola, oscilobatiente, vidrio fijo, proyección y desliz, proyectante, puerta batiente interior y puerta batiente exterior.

SISTEMA GALA

Sistema de aberturas de diseño europeo para doble vidrio con cámara de aire con perfiles de aluminio fabricados por Aluminios del Uruguay.

SISTEMA GALA CR

Doble barrera de felpilla perimetral y central. Preciso ajuste de marcos y hojas.

SISTEMA SUMMA

Sistema de aberturas corredizas que nace como solución a las nuevas tendencias proyectuales de nuestros clientes.

SISTEMA SUMMA ALZANTE

Sistema de abertura alzante corrediza para grandes dimensiones. Los perfiles diseñados siguiendo las tendencias arquitectónicas a nivel mundial permiten integrar el ambiente
				con el paisaje exterior.

MODENA 2 A 45º Y A 90º

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin fringilla vestibulum tellus, ut gravida est ullamcorper vel. Interdum et malesuada fames ac ante ipsum primis in faucibus.

A 30 NEW

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin fringilla vestibulum tellus, ut gravida est ullamcorper vel. Interdum et malesuada fames ac ante ipsum primis in faucibus.

LINEA MONOBLOCK N

Posibilita la colocación de un cajón de cortina compacto, encima de cualquier abertura. Combina con todas las tipologías: corrediza, batiente, oscilobatiente, banderola, proyectante, proyección y desliz, y paño fijo. Rápido montaje.

LINEA MONOBLOCK G

Realizada 100% de aluminio, cuenta con lamas curvas de aluminio relleno de espuma de poliuretano o de PVC.mSu terminación sigue las tendencias estéticas a nivel mundial, incorporando cajón con tapa plana.

MAMPARAS DE BAÑO DE CRISTAL TEMPLADO

Las mamparas han sido concebidas para brindar belleza y tecnología al baño

BARANDAS DE ALUMINIO Y VIDRIO

Pasamanos en diversas opciones curvas o rectas, siempre a la medida de su proyecto. Estructura de aluminio resistente y de leve apariencia, destaca la continuidad del vidrio.

TABIQUES DIVISORIOS

Tabiques divisorios para espacio de vidrio, meláminico o sintra.

FACHADAS VIDRIADAS

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin fringilla vestibulum tellus, ut gravida est ullamcorper vel. Interdum et malesuada fames ac ante ipsum primis in faucibus.

FRENTE DE PLACARD

Sistema corredizo, de uso residencial, placares para cocina y dormitorio.

PARASOLES DE ALUMINIO

En vistas de la necesidad de mejorar el coeficiente de Factor Solar (FS) de forma tal de disminuir la irradiación solar incidente que entra al local a través de elementos vidriados.

cortinas roller screen

Con la intención de satisfacer nuevas  necesidades a nuestros clientes hemos incorporado a nuesta linea de productos ,las cortinas Roller Scrin y Black Out.

láminas de seguridad

El atentado o accidente suele dejar al vidrio sin daño alguno, con lo cual evita lesiones y trastornos. En aquellos casos en que los impactos son tan fuertes que llegan a romper el vidrio, la película laminada actúa como un escudo protector.

<?php include('_footer.php');?>
<?php include('_mobileMenu.php');?>


text:
<?php

namespace NavJobs\Transmit\Test\Integration;

use League\Fractal\Serializer\JsonApiSerializer;

class DefaultSerializerObjectTest extends TestCase
{
    public function setUp()
    {
        parent::setUp(new JsonApiSerializer());
    }

    /**
     * @test
     */
    public function it_can_use_an_instantiated_serializer_as_a_default()
    {
        $array = $this->fractal
            ->collection($this->testBooks, new TestTransformer(), 'books')
            ->toArray();

        $expectedArray = [
            'data' => [
                [
                    'id' => 1,
                    'type' => 'books',
                    'attributes' => [
                        'author' => 'Philip K Dick',
                    ],
                ],
                [
                    'id' => 2,
                    'type' => 'books',
                    'attributes' => [
                        'author' => 'George R. R. Satan',
                    ],
                ],
            ],
        ];

        $this->assertEquals($expectedArray, $array);
    }
}


text:
package de.zalando.spring.cloud.config.aws.kms;

import com.amazonaws.services.kms.AWSKMS;
import com.amazonaws.services.kms.model.DecryptRequest;
import com.amazonaws.services.kms.model.EncryptRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.crypto.encrypt.TextEncryptor;
import org.springframework.util.Assert;

import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.Optional;

import static de.zalando.spring.cloud.config.aws.kms.OutputMode.BASE64;

/**
 * This {@link TextEncryptor} uses AWS KMS (Key Management Service) to encrypt / decrypt strings. Encoded cipher strings
 * are represented in Base64 format, to have a nicer string representation (only alpha-numeric chars), that can be
 * easily used as values in property files.
 */
public class KmsTextEncryptor implements TextEncryptor {

    private static final Base64.Encoder BASE64_ENCODER = Base64.getEncoder();
    private static final String EMPTY_STRING = "";

    private static final boolean IS_ALGORITHM_AVAILABLE;

    static {
        boolean available;
        try {
            Class.forName("com.amazonaws.services.kms.model.EncryptionAlgorithmSpec");
            available = true;
        } catch (Exception e) {
            available = false;
        }
        IS_ALGORITHM_AVAILABLE = available;
    }

    private final Logger log = LoggerFactory.getLogger(getClass());
    private final AWSKMS kms;
    private final String kmsKeyId;
    private final String encryptionAlgorithm;

    /**
     * @param kms                 The AWS KMS client
     * @param kmsKeyId            The ID or full ARN of the KMS key, e.g.
     *                            arn:aws:kms:eu-west-1:089972051332:key/9d9fca31-54c5-4de5-ba4f-128dfb9a5031. Must not be blank,
     * @param encryptionAlgorithm the encryption algorithm that should be used
     */
    public KmsTextEncryptor(final AWSKMS kms, final String kmsKeyId, final String encryptionAlgorithm) {
        Assert.notNull(kms, "KMS client must not be null");
        Assert.notNull(encryptionAlgorithm, "encryptionAlgorithm must not be null");
        this.kms = kms;
        this.kmsKeyId = kmsKeyId;
        this.encryptionAlgorithm = encryptionAlgorithm;

        checkAlgorithm(encryptionAlgorithm);
    }

    @Override
    public String encrypt(final String text) {
        Assert.hasText(kmsKeyId, "kmsKeyId must not be blank");
        if (text == null || text.isEmpty()) {
            return EMPTY_STRING;
        } else {
            final EncryptRequest encryptRequest = new EncryptRequest()
                    .withKeyId(kmsKeyId)
                    .withPlaintext(ByteBuffer.wrap(text.getBytes()));

            checkAlgorithm(encryptionAlgorithm);

            if (IS_ALGORITHM_AVAILABLE) {
                encryptRequest.setEncryptionAlgorithm(encryptionAlgorithm);
            }

            final ByteBuffer encryptedBytes = kms.encrypt(encryptRequest).getCiphertextBlob();

            return extractString(encryptedBytes, BASE64);
        }
    }

    @Override
    public String decrypt(final String encryptedText) {
        if (encryptedText == null || encryptedText.isEmpty()) {
            return EMPTY_STRING;
        } else {

            final EncryptedToken token = EncryptedToken.parse(encryptedText);

            final DecryptRequest decryptRequest = new DecryptRequest()
                    .withCiphertextBlob(token.getCipherBytes())
                    .withEncryptionContext(token.getEncryptionContext());
            final KmsTextEncryptorOptions options = token.getOptions();
            final String keyId = Optional.ofNullable(options.getKeyId()).orElse(kmsKeyId);
            final String algorithm = Optional.ofNullable(options.getEncryptionAlgorithm()).orElse(encryptionAlgorithm);

            checkAlgorithm(algorithm);

            if (IS_ALGORITHM_AVAILABLE) {
                decryptRequest.setEncryptionAlgorithm(algorithm);
                if (isAsymmetricEncryption(algorithm)) {
                    Assert.hasText(keyId, "kmsKeyId must not be blank. Asymmetric decryption requires the key to be known");
                    decryptRequest.setKeyId(keyId);
                }
            }

            return extractString(kms.decrypt(decryptRequest).getPlaintext(), options.getOutputMode());
        }
    }

    private static String extractString(final ByteBuffer bb, final OutputMode outputMode) {
        if (bb.hasRemaining()) {
            final byte[] bytes = new byte[bb.remaining()];
            bb.get(bytes, bb.arrayOffset(), bb.remaining());
            if (outputMode == BASE64) {
                return BASE64_ENCODER.encodeToString(bytes);
            } else {
                return new String(bytes);
            }
        } else {
            return EMPTY_STRING;
        }
    }

    private void checkAlgorithm(String algorithm) {
        if (isAsymmetricEncryption(algorithm) && !IS_ALGORITHM_AVAILABLE) {
            log.warn("Asymmetric encryption '{}' has been configured," +
                    "but the version of aws-java-sdk you are using is outdated and does not support it. " +
                    "Please upgrade to a more recent version.", algorithm);
        }
    }

    private static boolean isAsymmetricEncryption(String algorithm) {
        return !algorithm.equals("SYMMETRIC_DEFAULT");
    }
}


text:
<?xml version='1.0' encoding='utf-8' ?>
<resource>
<item name="Hide" value="Nascondi" />
<item name="Prev" value="<<" />
<item name="Done" value="Fine" />
<item name="FtsInputPrompt" value="Digitare le parole da cercare:" />
<item name="JS_alert_InvalidExpression_3" value="Guida" />
<item name="InTopicSearchBtnText" value="Vai" />
<item name="SyncTocTooltip" value="Sincronizza Indice" />
<item name="Logo/Author" value="Prodotto da" />
<item name="JS_alert_cantLoadProject" value="Impossibile caricare il progetto:" />
<item name="JS_alert_InitDatabaseFailed" value="Errore: Impossibile inizializzare il database." />
<item name="JS_alert_InvalidExpression_4" value="per sapere come usare l'espressione dell'interrogazione.(Da completare)" />
<item name="MergeError1" value="La Guida in linea secondaria" />
<item name="SyncToc" value="SyncToc" />
<item name="Next" value=">>" />
<item name="SuggestViewNoFrameMessage" value="Per visualizzare la Guida senza fotogrammi, fare clic su questo" />
<item name="ToolBarSearchBtnText" value="Vai" />
<item name="nls_body_instruction" value="Immettete la domanda nella casella di testo di cui sopra e fate clic su GO." />
<item name="MergeError2" value="è in una lingua diversa rispetto alla Guida in linea principale; l'indice e le ricerche globali nella Guida in linea secondaria verranno disabilitati." />
<item name="CompletingContents" value="Completamento Argomenti in corso..." />
<item name="Definition" value="Definizione:" />
<item name="LoadingContentsData" value="Caricamento in corso... fare clic qui per annullare..." />
<item name="TopicsFound" value="Argomenti trovati" />
<item name="Title" value="Titolo" />
<item name="FtsBtnText" value="Vai" />
<item name="Hide_Navigation_Component" value="Nascondi il componente di navigazione" />
<item name="MergeError3" value="utilizza un contrassegno diverso dell'impostazione Web rispetto al sistema principale della Guida che comporterà la disattivazione della funzione di unione nel sistema della Guida." />
<item name="Seperate" value="|" />
<item name="IndexAlphabetBookmarks" value="ABCDEFGHIJKLMNOPQRSTUVWXYZ" />
<item name="PoweredBy" value="Prodotto da" />
<item name="GeneratedBy" value="Generato da" />
<item name="Contents" value="Argomenti" />
<item name="JS_alert_NotAllDatabaseInited" value="Avviso: Non tutti i database sono stati caricati. Alcuni argomenti non verranno trovati." />
<item name="IndexSelectTopicLabel" value="Selezionate un argomento e fate clic su Visualizza" />
<item name="Search" value="Cerca" />
<item name="Glossary" value="Glossario" />
<item name="Disabled Prev" value="<<" />
<item name="LoadingData" value="Caricamento dati in corso, attendere..." />
<item name="LoadingIndex" value="Caricamento indice analitico in corso..." />
<item name="CantSearch" value="Impossibile cercare la frase." />
<item name="Book" value="Libro" />
<item name="Show_Navigation_Component" value="Mostra il componente di navigazione" />
<item name="Disabled Next" value=">>" />
<item name="CantOpenURLorFile" value="Impossibile aprire URL o file" />
<item name="Find" value="Trova" />
<item name="FtsHilitePrompt" value="Evidenzia risultati della ricerca" />
<item name="FtsMaxResult" value="Risultati della ricerca per pagina" />
<item name="nls_button_go_hint" value="Avvia ricerca" />
<item name="nls_body_empty" value="Spiacenti, non siamo in grado di trovare una risposta adeguata alla vostra domanda." />
<item name="Cancel" value="Annulla" />
<item name="Display" value="Visualizza" />
<item name="LoadingTOCItem" value="Caricamento indice in corso:" />
<item name="BrowserLimitedMessage" value="Il browser non supporta i fotogrammi. Consigliamo di aggiornare il browser ad una versione che li supporta." />
<item name="Blank_topic_text" value="Questo argomento è stato creato dal programma guidato di conversione dei progetti WinHelp e corrisponde al punto di destinazione di un argomento mancante o di un hyperlink interrotto." />
<item name="IndexSelectTopicTitle" value="Selezionate un argomento" />
<item name="Author" value="Autore" />
<item name="About" value="Riguardo" />
<item name="Print" value="Stampa" />
<item name="RelateTopicListPrompt" value="Fare clic su un argomento e quindi su Visualizza." />
<item name="Canceled" value="Annullato" />
<item name="SearchLabel" value="Cerca" />
<item name="nls_edit_label" value="Immettete la vostra domanda:" />
<item name="IndexSelectTopicError" value="Selezionate un argomento." />
<item name="TopicsNotFound" value="Non è stato trovato nessun argomento." />
<item name="JS_alert_colorlimitation" value="WebHelp ha rilevato che il display è impostato su 16 colori. Per assistenza completa su WebHelp, impostare il display per l'utilizzo di 256 colori o più." />
<item name="JS_alert_LoadXmlFailed" value="Errore: Impossibile caricare il file XML." />
<item name="NextTooltip" value="Argomento successivo" />
<item name="Show" value="Mostra" />
<item name="Term" value="Parola:" />
<item name="LoadingContents" value="Caricamento argomenti in corso, attendere..." />
<item name="JS_alert_ProjectLoadingFail" value="Impossibile caricare correttamente, selezionare Aggiorna." />
<item name="Rank" value="Classifica" />
<item name="IndexBtnText" value="Vai" />
<item name="SearchPrompt" value="- Cerca -" />
<item name="PreTooltip" value="Argomento precedente" />
<item name="WebSearchButton" value="WebSearch" />
<item name="LoadingFTS" value="Lettura dati della ricerca in corso..." />
<item name="WebSearch" value="WebSearch" />
<item name="Remote_Page" value="Pagina remota" />
<item name="Index" value="Indice analitico" />
<item name="IndexInputPrompt" value="Digitare la parola chiave da cercare:" />
<item name="JS_alert_appletNotLoad" value="Impossibile caricare l'applet. Se si sta utilizzando una versione precedente di Netscape, occorre modificare il file prefs.js." />
<item name="JS_alert_ErrorInLoading" value="Errore nel caricamento del componente di navigazione. Rigenerare WebHelp." />
<item name="SuggestViewNoFrameMsg2" value="hyperlink." />
<item name="JS_alert_InvalidExpression_1" value="Il testo digitato non è un'espressione valida." />
<item name="Page" value="Pagina" />
<item name="Searching" value="Ricerca in corso..." />
<item name="JS_alert_InvalidExpression_2" value="Fate clic su" />
<item name="nls_button_go_text" value="Vai" />

  <item name="English"   value="" />
  <item name="langorder" value="0,1,2,3,4,5,6,7,8,40,41,42,43,44,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,38,45,46,47,48,49,50,33,51,52,53,88,54,34,55,56,115,119,121,123,125,126,127,128,129,130,57,58,89,90,91,59,60,131,148,150,154,158,168,171,173,175,185,187,189,191,193,197,214,216,218,220,225,230,240,242,244,246,252,61,62,63,64,66,67,131,148,150,154,158,168,171,173,175,185,187,189,191,193,197,214,216,218,220,225,230,240,242,244,251,252,68,69,70,71,27,114,28,82,170,85,112,109,110,65,113,223,86,213,29,255,30,31,80,81,83,84,111,36,37,79,229,222,87,212,32,254,251,39,72,97,98,99,100,73,101,74,102,133,93,103,35,104,75,105,92,122,124,76,106,107,108,77,120,199,94,116,117,118,78,131,131,131,131,131,131,131,150,158,158,158,158,175,175,175,175,154,193,197,197,197,197,197,95,197,230,230,230,230,246,227,224,131,131,131,131,131,131,131,150,158,158,158,158,175,175,175,175,154,193,197,197,197,197,197,96,197,230,230,230,230,246,227,250," />

  <panes show="0">
    <toc />
    <fts />
  </panes>

  <stopwords>
    <word name="0" />
    <word name="0" />
    <word name="1" />
    <word name="1" />
    <word name="2" />
    <word name="2" />
    <word name="3" />
    <word name="3" />
    <word name="4" />
    <word name="4" />
    <word name="5" />
    <word name="5" />
    <word name="6" />
    <word name="6" />
    <word name="7" />
    <word name="7" />
    <word name="8" />
    <word name="8" />
    <word name="9" />
    <word name="9" />
    <word name="a" />
    <word name="abbisognare" />
    <word name="abbisognare" />
    <word name="alcuna" />
    <word name="alcuna" />
    <word name="alcune" />
    <word name="alcune" />
    <word name="alcuni" />
    <word name="alcuni" />
    <word name="alcuno" />
    <word name="alcuno" />
    <word name="altra" />
    <word name="altra" />
    <word name="altre" />
    <word name="altre" />
    <word name="altri" />
    <word name="altri" />
    <word name="altro" />
    <word name="altro" />
    <word name="anche" />
    <word name="anche" />
    <word name="anziché" />
    <word name="anziché" />
    <word name="avere" />
    <word name="avere" />
    <word name="ciascun" />
    <word name="ciascun" />
    <word name="ciascuna" />
    <word name="ciascuna" />
    <word name="ciascuno" />
    <word name="ciascuno" />
    <word name="come" />
    <word name="con" />
    <word name="con" />
    <word name="cosa" />
    <word name="cosa" />
    <word name="così" />
    <word name="così" />
    <word name="da" />
    <word name="da" />
    <word name="dentro" />
    <word name="dentro" />
    <word name="di" />
    <word name="di" />
    <word name="dopo" />
    <word name="dopo" />
    <word name="dove" />
    <word name="dove" />
    <word name="dovere" />
    <word name="dovere" />
    <word name="e" />
    <word name="entrambe" />
    <word name="entrambe" />
    <word name="entrambi" />
    <word name="entrambi" />
    <word name="entro" />
    <word name="entro" />
    <word name="eppure" />
    <word name="eppure" />
    <word name="era" />
    <word name="erano" />
    <word name="erano" />
    <word name="eri" />
    <word name="eri" />
    <word name="ero" />
    <word name="ero" />
    <word name="essere" />
    <word name="essere" />
    <word name="essi" />
    <word name="essi" />
    <word name="esso" />
    <word name="esso" />
    <word name="fa" />
    <word name="fa" />
    <word name="fare" />
    <word name="fare" />
    <word name="fatto" />
    <word name="fatto" />
    <word name="già" />
    <word name="già" />
    <word name="ha" />
    <word name="il" />
    <word name="in" />
    <word name="io" />
    <word name="io" />
    <word name="loro" />
    <word name="loro" />
    <word name="lungo" />
    <word name="lungo" />
    <word name="lì" />
    <word name="lì" />
    <word name="ma" />
    <word name="modo" />
    <word name="modo" />
    <word name="nessuna" />
    <word name="nessuna" />
    <word name="nessuno" />
    <word name="nessuno" />
    <word name="noi" />
    <word name="noi" />
    <word name="non" />
    <word name="o" />
    <word name="ok" />
    <word name="ok" />
    <word name="okay" />
    <word name="okay" />
    <word name="ottenere" />
    <word name="ottenere" />
    <word name="per" />
    <word name="per" />
    <word name="perché" />
    <word name="perché" />
    <word name="più" />
    <word name="più" />
    <word name="potere" />
    <word name="potere" />
    <word name="potrebbe" />
    <word name="potrebbe" />
    <word name="quale" />
    <word name="quale" />
    <word name="quando" />
    <word name="quando" />
    <word name="quella" />
    <word name="quella" />
    <word name="quelle" />
    <word name="quelle" />
    <word name="quelli" />
    <word name="quelli" />
    <word name="quello" />
    <word name="quello" />
    <word name="questa" />
    <word name="questa" />
    <word name="queste" />
    <word name="queste" />
    <word name="questi" />
    <word name="questi" />
    <word name="questo" />
    <word name="questo" />
    <word name="qui" />
    <word name="qui" />
    <word name="quindi" />
    <word name="quindi" />
    <word name="sarai" />
    <word name="sarai" />
    <word name="sarà" />
    <word name="sarà" />
    <word name="sarò" />
    <word name="sarò" />
    <word name="se" />
    <word name="senza" />
    <word name="senza" />
    <word name="sono" />
    <word name="sono" />
    <word name="stato" />
    <word name="stato" />
    <word name="stessa" />
    <word name="stessa" />
    <word name="stesso" />
    <word name="stesso" />
    <word name="su" />
    <word name="tra" />
    <word name="tra" />
    <word name="troppo" />
    <word name="troppo" />
    <word name="tu" />
    <word name="tu" />
    <word name="tuo" />
    <word name="tuo" />
    <word name="tutte" />
    <word name="tutte" />
    <word name="tutti" />
    <word name="tutti" />
    <word name="un" />
    <word name="una" />
    <word name="una" />
    <word name="uno" />
    <word name="uno" />
    <word name="usando" />
    <word name="usando" />
    <word name="usare" />
    <word name="usare" />
    <word name="usato" />
    <word name="usato" />
    <word name="vedere" />
    <word name="vedere" />
    <word name="voi" />
    <word name="voi" />
    <word name="volere" />
    <word name="volere" />
    <word name="vostro" />
    <word name="vostro" />
    <word name="è" />
    <word name="è" />
  </stopwords>

	<paneskin>
		<background color="#e9e9e9" img="nor_back_ii.gif" />
		<font name="Tahoma" size="8pt" color="#ffffff" style="Normal" weight="Normal" decoration="none" />
		<toc>
			<background color="#cccccc" img="" />
			<icons>
				<book open="nor_folder_op.gif" close="nor_folder_cl.gif" />
				<item  local="nor_topic.gif" remote="nor_www.gif" />
				<newbook open="" close="" />
				<newitem  local="" remote="" />
			</icons>
			<fonts>
				<normal name="Tahoma" size="8pt" color="#000000" style="Normal" weight="Normal" decoration="none" />
				<hover name="Tahoma" size="8pt" color="#77b0ff" style="Normal" weight="Normal" decoration="underline" />
			</fonts>
			<activebackgroundcolor attr="#c4ddff" />
			<margin attr="" />
			<indent attr="" />
		</toc>
		<index>
			<form>
				<fonts>
					<title name="Tahoma" size="8pt" color="#ffffff" style="Normal" weight="Normal" decoration="none" />
				</fonts>
				<button normal="" hover="" />
				<editwith value="20" />
			</form>
			<background color="#cccccc" img="" />
			<fonts>
				<normal name="Tahoma" size="8pt" color="#000000" style="Normal" weight="Normal" decoration="none" />
				<hover name="Tahoma" size="8pt" color="#77b0ff" style="Normal" weight="Normal" decoration="underline" />
				<empty name="" size="8pt" color="" style="" weight="" decoration="" />
			</fonts>
			<activebackgroundcolor attr="#c4ddff" />
			<margin attr="" />
			<indent attr="" />
		</index>
		<fts>
			<form>
				<fonts>
					<title name="Tahoma" size="8pt" color="#ffffff" style="Normal" weight="Normal" decoration="none" />
				</fonts>
				<button normal="" hover="" />
				<editwith value="20" />
			</form>
			<background color="#cccccc" img="" />
			<fonts>
				<normal name="Tahoma" size="8pt" color="#000000" style="Normal" weight="Normal" decoration="none" />
				<hover name="Tahoma" size="8pt" color="#77b0ff" style="Normal" weight="Normal" decoration="underline" />
				<error name="Tahoma" size="8pt" color="#000000" style="Normal" weight="Normal" decoration="none" />
			</fonts>
			<activebackgroundcolor attr="#c4ddff" />
			<margin attr="" />
			<indent attr="" />
		</fts>
		<glossary>
			<background color="#cccccc" img="" />
			<fonts>
				<normal name="Tahoma" size="8pt" color="#000000" style="Normal" weight="Normal" decoration="none" />
				<hover name="Tahoma" size="8pt" color="#77b0ff" style="Normal" weight="Normal" decoration="underline" />
			</fonts>
			<activebackgroundcolor attr="#c4ddff" />
			<margin attr="" />
			<indent attr="" />
		</glossary>
	</paneskin>
</resource>


text:
layout: post
title: "Sushi lunch with the wife...w0..."
---
Sushi lunch with the wife...w00t!


text:
INITRAMFS_TOOLS_GIT=https://salsa.debian.org/kernel-team/initramfs-tools.git
INITRAMFS_TOOLS_VER="master"

# Grabs Debian's initramfs_tools from Git repo if no other options exist
if [[ ! `command -v unmkinitramfs` && ! -x "/usr/lib/dracut/skipcpio" ]] ; then
    # Create temp dir for pulling in initramfs-tools
    TMPDIR=`mktemp -d` || exit 1
    echo "INFO: Downloading initramfs-tools: $TMPDIR"

    # Clone initramfs-tools repo
    pushd $TMPDIR
    git clone $INITRAMFS_TOOLS_GIT initramfs-tools
    pushd initramfs-tools
    git checkout $INITRAMFS_TOOLS_VER
    popd # $TMPDIR
    popd

    shopt -s expand_aliases
    alias unmkinitramfs=$TMPDIR/initramfs-tools/unmkinitramfs
fi

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

if [ $# -lt 1 ]
then
    echo "Usage:  `basename $0` list.txt [hash-algo]" >&2
    exit $NOARGS;
fi

# Where to look for initramfs image
INITRAMFS_LOC="/boot/"
if [ -d "/ostree" ]; then
    # If we are on an ostree system change where we look for initramfs image
    loc=$(grep -E "/ostree/[^/]([^/]*)" -o /proc/cmdline | head -n 1 | cut -d / -f 3)
    INITRAMFS_LOC="/boot/ostree/${loc}/"
fi

if [ $# -eq 2 ]
then
    ALGO=$2
else
    ALGO=sha1sum
fi

OUTPUT=$(readlink -f $1)
rm -f $OUTPUT

echo "Writing allowlist to $OUTPUT with $ALGO..."

# Add boot_aggregate from /sys/kernel/security/ima/ascii_runtime_measurements (IMA Log) file.
# The boot_aggregate measurement is always the first line in the IMA Log file.
# The format of the log lines is the following:
#     <PCR_ID> <PCR_Value> <IMA_Template> <File_Digest> <File_Name> <File_Signature>
# File_Digest may start with the digest algorithm specified (e.g "sha1:", "sha256:") depending on the template used.
head -n 1 /sys/kernel/security/ima/ascii_runtime_measurements | awk '{ print $4 "  boot_aggregate" }' | sed 's/.*://' >> $OUTPUT

# Add all appropriate files under root FS to allowlist
cd /
find `ls / | grep -v "\bsys\b\|\brun\b\|\bproc\b\|\blost+found\b\|\bdev\b\|\bmedia\b\|\bsnap\b\|mnt"` \( -fstype rootfs -o -xtype f -type l -o -type f \) -uid 0 -exec $ALGO '/{}' >> $OUTPUT \;

# Create staging area for init ram images
rm -rf /tmp/ima/
mkdir -p /tmp/ima

# Iterate through init ram disks and add files to allowlist
echo "Creating allowlist for init ram disk"
for i in `ls ${INITRAMFS_LOC}/initr*`
do
    echo "extracting $i"
    mkdir -p /tmp/ima/$i-extracted
    cd /tmp/ima/$i-extracted

    # platform-specific handling of init ram disk images
    if [[ `command -v unmkinitramfs` ]] ; then
        mkdir -p /tmp/ima/$i-extracted-unmk
        unmkinitramfs $i /tmp/ima/$i-extracted-unmk
        if [[ -d "/tmp/ima/$i-extracted-unmk/main/" ]] ; then
            cp -r /tmp/ima/$i-extracted-unmk/main/. /tmp/ima/$i-extracted
        else
            cp -r /tmp/ima/$i-extracted-unmk/. /tmp/ima/$i-extracted
        fi
    elif [[ -x "/usr/lib/dracut/skipcpio" ]] ; then
        /usr/lib/dracut/skipcpio $i | gunzip -c | cpio -i -d 2> /dev/null
    else
        echo "ERROR: No tools for initramfs image processing found!"
        break
    fi

    find -type f -exec $ALGO "./{}" \; | sed "s| \./\./| /|" >> $OUTPUT
done

# Clean up
rm -rf /tmp/ima


text:
#pragma once

#include "CX/Platform.hpp"

#if defined(CX_OS_WINDOWS)

#include "CX/IO/IInputStream.hpp"
#include "CX/C/stdio.h"
#include "CX/String.hpp"
#include "CX/APIDefs.hpp"

namespace CX
{

namespace IO
{

class CX_API MemoryMappedFile
{
public:

	enum Flag
	{
		Flag_AttrNormal         = 1,
		Flag_AttrSequentialScan = 2,
		Flag_AttrRandomAccess   = 4,
	};

	MemoryMappedFile();

	MemoryMappedFile(const Char *szPath, UInt64 cbMapOffset = 0, UInt64 cbMapSize = 0, UInt32 nFlags = Flag_AttrNormal);

	MemoryMappedFile(const WChar *wszPath, UInt64 cbMapOffset = 0, UInt64 cbMapSize = 0,
	                 UInt32 nFlags = Flag_AttrNormal);

	~MemoryMappedFile();

	Status Open(const Char *szPath, UInt64 cbMapOffset = 0, UInt64 cbMapSize = 0, UInt32 nFlags = Flag_AttrNormal);

	Status Open(const WChar *wszPath, UInt64 cbMapOffset = 0, UInt64 cbMapSize = 0, UInt32 nFlags = Flag_AttrNormal);

	Status Close();

	Bool IsOK() const;

	UInt64 GetFileSize() const;

	const void *GetMapData() const;

	UInt64 GetMapOffset() const;

	UInt64 GetMapSize() const;

	const Char *GetPath() const;

	void *GetHandle();

	Status Remap(UInt64 cbNewMapOffset, UInt64 cbNewMapSize = 0);

private:

	UInt64    m_cbFileSize;
	void      *m_pMapData;
	UInt64    m_cbMapOffset;
	UInt64    m_cbMapSize;

#pragma warning(push)
#pragma warning(disable: 4251)
	String   m_sPath;
#pragma warning(pop)

	void     *m_pFile;
	void     *m_pFileMap;

	Status OpenInternal(const WChar *wszPath, UInt64 cbMapOffset = 0, UInt64 cbMapSize = 0,
	                    UInt32 nFlags = Flag_AttrNormal);

};

}//namespace IO

}//namespace CX

#endif


text:
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
import json

def init(url, key):
    return PyMISP(url, key, True, 'json', True)

def get_tags(m):
    result = m.get_all_tags(True)
    r = result
    print(json.dumps(r) + '\n')

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Get tags from MISP instance.')

    args = parser.parse_args()

    misp = init(misp_url, misp_key)

    get_tags(misp)


text:
<?php
/**
 * Unit tests for Logger object.
 *
 * @access      private
 * @package     Creovel
 * @subpackage  UnitTest
 * @license     http://creovel.org/license MIT License
 * @since       Class available since Release 0.4.5
 * @author      Nesbert Hidalgo
 **/
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'env.php';

class LoggerTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var Logger
     */
    protected $o;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->o = new Logger;
        $this->path = '/tmp/';
        $this->filename = 'creovel.logger.test.log';
        $this->file = $this->path . $this->filename;
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown()
    {
        $files = CDirectory::ls($this->path, array('filter' => '/^'.$this->filename.'/'));
        foreach ($files as $file) {
            unlink($file);
        }

        unset($this->o);
    }

    public function testWrite()
    {
        $p = 'Testing';
        $s = str_repeat($p, 250);

        // set logger vars
        $this->o->filename = $this->file;
        $this->o->timestamp = false; // disable timestamp

        // 4 x 250 = 1000
        $this->assertTrue($this->o->write($s)); // 1

        $c = file_get_contents($this->file);
        $this->assertTrue(strstr($c, date('Y-m-d')) === false);

        $this->o->timestamp = true; // enable timestamp

        $this->assertTrue($this->o->write($s)); // 2
        $this->assertTrue($this->o->write($s)); // 3
        $this->assertTrue($this->o->write($s)); // 4

        $c = file_get_contents($this->file);

        $this->assertTrue(strstr($c, $p) !== false);
        $this->assertTrue(strstr($c, date('Y-m-d')) !== false);

        preg_match_all("/{$p}/", $c, $matches, PREG_OFFSET_CAPTURE);

        $this->assertEquals(1000, count($matches[0]));
    }

    public function testPartition()
    {
        $this->o->filename = $this->file;
        $this->o->filesize_limit = 1000;

        $s = str_repeat('11', 4);

        for ($i = 0; $i < 10000; $i++) {
            $this->assertTrue($this->o->write($s));
        }

        $ls = CDirectory::ls($this->path, array('filter' => '/^'.$this->filename.'/'));
        $this->assertTrue(count($ls) >= 3);
    }
}
?>


text:
/*
 * 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.
 */
package org.skife.jdbi.v2.spring;

import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.IDBI;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;

import java.util.HashSet;
import java.util.Set;

/**
 * Utility for working with jDBI and Spring transaction bound resources
 */
public class DBIUtil
{
    private static final Set<Handle> TRANSACTIONAL_HANDLES = new HashSet<Handle>();

    /**
     * Obtain a Handle instance, either the transactionally bound one if we are in a transaction,
     * or a new one otherwise.
     * @param dbi the IDBI instance from which to obtain the handle
     */
    public static Handle getHandle(IDBI dbi)
    {
        Handle bound = (Handle) TransactionSynchronizationManager.getResource(dbi);
        if (bound == null) {
            bound = dbi.open();
            if (TransactionSynchronizationManager.isSynchronizationActive()) {
                TransactionSynchronizationManager.bindResource(dbi, bound);
                TransactionSynchronizationManager.registerSynchronization(new Adapter(dbi, bound));
                TRANSACTIONAL_HANDLES.add(bound);
            }
        }
        return bound;
    }

    /**
     * Close a handle if it is not transactionally bound, otherwise no-op
     * @param h the handle to consider closing
     */
    public static void closeIfNeeded(Handle h)
    {
        if (!TRANSACTIONAL_HANDLES.contains(h))
        {
            h.close();
        }
    }

    private static class Adapter extends TransactionSynchronizationAdapter {
        private final IDBI dbi;
        private final Handle handle;

        Adapter(IDBI dbi, Handle handle) {
            this.dbi = dbi;
            this.handle = handle;
        }

        @Override
        public void resume()
        {
            TransactionSynchronizationManager.bindResource(dbi, handle);
        }

        @Override
        public void suspend()
        {
            TransactionSynchronizationManager.unbindResource(dbi);
        }

        @Override
        public void beforeCompletion()
        {
            TRANSACTIONAL_HANDLES.remove(handle);
            TransactionSynchronizationManager.unbindResource(dbi);
        }
    }
}


text:
package abstractdatastructure;

/**
 * Created by Matthijs on 24-4-2016.
 */

/**
 * Data container class that stores the start and end of an edge, as well as its weight.
 */
public class Edge {

    /**
     * Edge start id.
     */
    private int startId;

    /**
     * Edge end id.
     */
    private int endId;

    /**
     * The number of genomes going through the edge.
     */
    private int weight;

    /**
     * Constructor to create an edge.
     *
     * @param startId Start id.
     * @param endId   End id.
     */
    public Edge(int startId, int endId) {
        this.startId = startId;
        this.endId = endId;
        this.weight = 1;
    }

    /**
     * Get the start id of an edge.
     *
     * @return The start id.
     */
    public int getStartId() {
        return startId;
    }

    /**
     * Set the startId.
     *
     * @param startId New startId.
     */
    public void setStartId(int startId) {
        this.startId = startId;
    }

    /**
     * Get the end id of an edge.
     *
     * @return The end id.
     */
    public int getEndId() {
        return endId;
    }

    /**
     * Set the endId.
     *
     * @param endId New endId.
     */
    public void setEndId(int endId) {
        this.endId = endId;
    }

    /**
     * Get the weight of an edge.
     *
     * @return The weight.
     */
    public int getWeight() {
        return weight;
    }

    /**
     * Set the weight of an edge.
     *
     * @param weight The new weight.
     */
    public void setWeight(int weight) {
        this.weight = weight;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Shoper.com</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">

    <link href="resource/user/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="resource/user/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">

    <link href="resource/user/themes/css/bootstrappage.css" rel="stylesheet"/>

    <link href="resource/user/themes/css/flexslider.css" rel="stylesheet"/>
    <link href="resource/user/themes/css/main.css" rel="stylesheet"/>
    <link href="bower_components/sweetalert2/dist/sweetalert2.css" rel="stylesheet"/>

    <![endif]-->


text:
package com.microsoft.azure.management.machinelearningservices.v2019_05_01.implementation;

import com.microsoft.azure.management.machinelearningservices.v2019_05_01.Usage;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import rx.Observable;
import com.microsoft.azure.management.machinelearningservices.v2019_05_01.UsageName;
import com.microsoft.azure.management.machinelearningservices.v2019_05_01.UsageUnit;

class UsageImpl extends WrapperImpl<UsageInner> implements Usage {
    private final MachineLearningServicesManager manager;

    UsageImpl(UsageInner inner,  MachineLearningServicesManager manager) {
        super(inner);
        this.manager = manager;
    }

    @Override
    public MachineLearningServicesManager manager() {
        return this.manager;
    }

    @Override
    public Long currentValue() {
        return this.inner().currentValue();
    }

    @Override
    public String id() {
        return this.inner().id();
    }

    @Override
    public Long limit() {
        return this.inner().limit();
    }

    @Override
    public UsageName name() {
        return this.inner().name();
    }

    @Override
    public String type() {
        return this.inner().type();
    }

    @Override
    public UsageUnit unit() {
        return this.inner().unit();
    }

}


text:
layout: page
title: Ranger Omega Motors Award Ceremony
date: 2016-05-24
author: Bruce Marshall
tags: weekly links, java
status: published
summary: Donec ut urna et risus semper maximus. Maecenas sit amet.
banner: images/banner/office-01.jpg
booking:
  startDate: 04/25/2019
  endDate: 04/27/2019
  ctyhocn: LTNNHHX
  groupCode: ROMAC
published: true
---
Etiam sagittis massa leo, non convallis lorem consequat finibus. Sed magna enim, elementum id malesuada quis, euismod eu nisl. Phasellus sit amet accumsan nibh. Proin eleifend vel arcu at bibendum. Integer facilisis pellentesque placerat. Sed egestas dui mollis dui tincidunt elementum. Praesent sed enim ac diam porttitor ultrices.

* Nulla malesuada orci non dictum iaculis
* Phasellus luctus purus sit amet risus vulputate, vitae fermentum nisi sodales
* Vivamus sed eros eu eros bibendum viverra ac ac sem
* Aenean condimentum sem nec nibh placerat fermentum.

Quisque vel mauris tristique, volutpat enim ac, pretium quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ac scelerisque metus. Praesent eu finibus diam, eu eleifend eros. Praesent pretium sit amet leo quis porttitor. Etiam congue elit sed quam commodo congue. Nulla iaculis mi sit amet risus posuere, nec vestibulum mi faucibus. Cras dui odio, tempus vel facilisis bibendum, rhoncus a magna. Mauris rutrum vel lacus scelerisque consequat. Suspendisse potenti. Aenean et porta tellus. Proin sagittis dui sem, nec auctor mi blandit eu. Curabitur justo eros, cursus eu quam nec, hendrerit ultrices massa. Nunc aliquam nulla nec dapibus ultrices.


text:
#pragma once
#include <aws/sesv2/SESV2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace SESV2
{
namespace Model
{
  /**
   *
An HTTP 200 response if the request succeeds, or an error message if the
   * request fails.

See Also:
   AWS
   * API Reference

   */
  class AWS_SESV2_API CreateImportJobResult
  {
  public:
    CreateImportJobResult();
    CreateImportJobResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    CreateImportJobResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
A string that represents the import job ID.

     */
    inline const Aws::String& GetJobId() const{ return m_jobId; }

    /**
     *
A string that represents the import job ID.

     */
    inline void SetJobId(const Aws::String& value) { m_jobId = value; }

    /**
     *
A string that represents the import job ID.

     */
    inline void SetJobId(Aws::String&& value) { m_jobId = std::move(value); }

    /**
     *
A string that represents the import job ID.

     */
    inline void SetJobId(const char* value) { m_jobId.assign(value); }

    /**
     *
A string that represents the import job ID.

     */
    inline CreateImportJobResult& WithJobId(const Aws::String& value) { SetJobId(value); return *this;}

    /**
     *
A string that represents the import job ID.

     */
    inline CreateImportJobResult& WithJobId(Aws::String&& value) { SetJobId(std::move(value)); return *this;}

    /**
     *
A string that represents the import job ID.

     */
    inline CreateImportJobResult& WithJobId(const char* value) { SetJobId(value); return *this;}

  private:

    Aws::String m_jobId;
  };

} // namespace Model
} // namespace SESV2
} // namespace Aws


text:
package eu.seaclouds.platform.planner.core.application.topology.modifier.relation;

import eu.seaclouds.platform.planner.core.application.topology.nodetemplate.NodeTemplate;

import java.util.Map;

public class JdbcPaasRelationModifier extends AbstractJdbcRelationModifier {

    private static final String PROP_COLLECTION_VALUE = "env";

    @Override
    protected boolean nodeTemplateCanBeModified(NodeTemplate nodeTemplate) {
        return topologyTemplate.isDeployedOnPaaS(nodeTemplate.getNodeTemplateId());
    }

    @Override
    protected String getPropCollection(Map<String, Object> requirementValues) {
        return PROP_COLLECTION_VALUE;
    }
}


text:
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy

from horizon import tables

from cloudkittydashboard.api import cloudkitty as api

def get_detail_link(datum):
    if datum.script_id:
        url = "horizon:admin:pyscripts:script_details"
        return reverse(url, kwargs={'script_id': datum.script_id})

class CreatePyScript(tables.LinkAction):
    name = "createpyscript"
    verbose_name = _("Create Script")
    url = "horizon:admin:pyscripts:script_create"
    icon = "plus"
    ajax = True
    classes = ("ajax-modal",)

class UpdateScript(tables.LinkAction):
    name = "updatepyscript"
    verbose_name = _("Edit Script")
    classes = ("ajax-modal",)
    icon = "pencil"

    def get_link_url(self, datum=None):
        url = "horizon:admin:pyscripts:script_update"
        return reverse(url, kwargs={'script_id': datum.script_id})

class DeletePyScript(tables.DeleteAction):
    name = "deletepyscript"
    verbose_name = _("Delete Script")
    data_type_singular = _("PyScript")
    data_type_plural = _("PyScripts")

    @staticmethod
    def action_present(count):
        return ungettext_lazy(
            u"Delete PyScript",
            u"Delete PyScripts",
            count
        )

    @staticmethod
    def action_past(count):
        return ungettext_lazy(
            u"Deleted PyScript",
            u"Deleted PyScripts",
            count
        )

    def action(self, request, script_id):
        api.cloudkittyclient(request).rating.pyscripts.delete_script(
            script_id=script_id)

class PyScriptsTable(tables.DataTable):
    id = tables.Column("id", verbose_name=_("id"), link=get_detail_link)
    name = tables.Column("name", verbose_name=_("Name"))
    checksum = tables.Column("checksum", verbose_name=_("Checksum"))

    class Meta(object):
        name = "pyscripts"
        verbose_name = _("pyscripts")
        table_actions = (CreatePyScript, DeletePyScript)
        row_actions = (UpdateScript, DeletePyScript)


text:
/**
 *
 */
package cn.aposoft.wechat.company.message.remote;

import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.impl.client.CloseableHttpClient;

import cn.aposoft.framework.io.QuietCloseable;
import cn.aposoft.framework.io.RemoteException;
import cn.aposoft.util.AposoftAssert;
import cn.aposoft.util.HttpClient;
import cn.aposoft.util.HttpClientFactory;

/**
 * 企业消息
 *
 * @author Jann Liu
 *
 */
public class CompanyMessgeClient implements QuietCloseable {
	static final CloseableHttpClient httpClient = HttpClientFactory.createDefault();
	//
	static final String COMPANY_MESSAGE_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=";

	@Override
	public void close() {
		HttpClientUtils.closeQuietly(httpClient);
	}

	/**
	 * 发送报文
	 *
	 * @param accessToken
	 * @param msg
	 *            报文内容
	 * @return 发送结果
	 * @throws RemoteException
	 */
	public MessageResp send(final String accessToken, final String msg) throws RemoteException {
		if (AposoftAssert.isBlank(accessToken, msg)) {
			throw new IllegalArgumentException("Some argument(s) is null or empty.");
		}
		return HttpClient.execute(HttpClient.jsonPost(getCompanyMessageUrl(accessToken), msg), MessageResp.class,
				httpClient);
	}

	// 发送消息
	private String getCompanyMessageUrl(String accessToken) {
		return COMPANY_MESSAGE_URL + accessToken;
	}
}


text:
package org.lnu.is.integration.cases.specialty

import java.util.UUID

import io.gatling.core.Predef.checkBuilder2Check
import io.gatling.core.Predef.findCheckBuilder2ValidatorCheckBuilder
import io.gatling.core.Predef.exec
import io.gatling.core.Predef.stringToExpression
import io.gatling.core.Predef.validatorCheckBuilder2CheckBuilder
import io.gatling.core.Predef.value2Expression
import io.gatling.core.Predef.value2Success
import io.gatling.http.Predef.ELFileBody
import io.gatling.http.Predef.http
import io.gatling.http.Predef.jsonPath
import io.gatling.http.Predef.status

object SpecialtyIntegrationTest {

  val testCase = exec(session => {
      session
      	.set("idnum", UUID.randomUUID())
    })
    .exec(http("Post Specialty")
    		.post("/specialties")
        .basicAuth("admin", "nimda")
    		.header("Content-Type", "application/json")
    		.body(ELFileBody("data/specialty/post.json"))
    		.asJSON
    		.check(status.is(201))
    		.check(jsonPath("$.id").find.saveAs("specialtyId")))
    .exec(http("Get Specialty")
        .get("/specialties/${specialtyId}")
        .basicAuth("admin", "nimda")
        .check(status.is(200)))
    .exec(http("Update Specialty")
        .put("/specialties/${specialtyId}")
        .basicAuth("admin", "nimda")
        .header("Content-Type", "application/json")
        .body(ELFileBody("data/specialty/put.json"))
        .asJSON
        .check(status.is(200)))
    .exec(http("Get Specialty")
        .get("/specialties/${specialtyId}")
        .basicAuth("admin", "nimda")
        .check(status.is(200))
        .check(jsonPath("$.abbrName").find.is("prm111")))
    .exec(http("Delete Specialty")
  		  .delete("/specialties/${specialtyId}")
  		  .basicAuth("admin", "nimda")
        .check(status.is(204)))
    .exec(http("Get Specialty")
  		  .get("/specialties/${specialtyId}")
        .basicAuth("admin", "nimda")
      	.check(status.is(404)))

}


text:
package com.uwetrottmann.shopr.algorithm.model;

import static org.fest.assertions.api.Assertions.assertThat;

import com.uwetrottmann.shopr.algorithm.model.ClothingType;
import com.uwetrottmann.shopr.algorithm.model.Color;
import com.uwetrottmann.shopr.algorithm.model.GenericAttribute;
import com.uwetrottmann.shopr.algorithm.model.Price;

import org.junit.Test;

public class LikeDislikeSuite {

    @Test
    public void testLikeValue() {
        /*
         * Using specifically created UNKNOWN type because it has no similar types.
         */
    	int index = ClothingType.Value.TOP.index();
        // all equal
        double[] actual = new double[] {
                0.25, 0.25, 0.25, 0.25
        };
        double weightOthers = 0.25 - (1.0 / 3) / 3;
        double[] expected = new double[] {
        		0.25 + 1.0 / 3, weightOthers, weightOthers, weightOthers
        };
        new ClothingType().likeValue(index, actual);
        assertThat(actual).isEqualTo(expected);

        // one getting bigger than zero
        expected = new double[] {
        		1.0, 0.0, 0.0, 0.0
        };
        new ClothingType().likeValue(index, actual);
        new ClothingType().likeValue(index, actual);
        assertThat(actual).isEqualTo(expected);
    }

    @Test
    public void testLikeValueWithSimilars() {
        // all equal
        double[] actual = new double[] {
                // BLUE, RED, PINK, VIOLET
                0.25, 0.25, 0.25, 0.25
        };
        new Color().likeValue(1, actual);
        double sumActual = GenericAttribute.getSum(actual);
        assertThat(sumActual).isEqualTo(1.0);

        // ensure value sum stays 1.0
        actual = new double[] {
                // BLUE, RED, PINK, VIOLET
                1.0 / 3, 0.0, 1.0 / 3, 1.0 / 3
        };
        new Color().likeValue(1, actual);
        sumActual = GenericAttribute.getSum(actual);
        assertThat(sumActual).isEqualTo(1.0);
    }

    @Test
    public void testShiftedLikeSmall() {
        // like RED
        double[] actual = new double[] {
                // BLUE, RED, PINK, VIOLET
                0.25, 0.25, 0.25, 0.25
        };
        new Color().likeValue(1, actual);

        // RED should have biggest weight
        assertThat(actual[1]).isGreaterThan(actual[0]);
        assertThat(actual[1]).isGreaterThan(actual[2]);
        assertThat(actual[1]).isGreaterThan(actual[3]);
        // sum should be one
        double sumActual = GenericAttribute.getSum(actual);
        assertThat(sumActual).isEqualTo(1.0);

        // like PURPLE
        new Color().likeValue(3, actual);

        // PURPLE should have bigger weight than RED
        assertThat(actual[3]).isGreaterThan(actual[1]);
        // sum should be one
        sumActual = GenericAttribute.getSum(actual);
        assertThat(sumActual).isEqualTo(1.0);
    }

    @Test
    public void testShiftedLikeLarge() {
        /*
         * The sums are close to one, but not exactly. This is due to the
         * imprecision of double. The impact on the results is negligible.
         */

        // like RED
        double[] actual = new double[] {
                // BLUE, RED, PINK, VIOLET, YELLOW, ...
                1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15,
                1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15, 1.0 / 15
        };
        new Color().likeValue(1, actual);

        // RED should have biggest weight
        assertThat(actual[1]).isGreaterThan(actual[0]);
        assertThat(actual[1]).isGreaterThan(actual[2]);
        assertThat(actual[1]).isGreaterThan(actual[3]);

        // like PURPLE
        new Color().likeValue(3, actual);

        // PURPLE should have bigger weight than RED
        assertThat(actual[3]).isGreaterThan(actual[1]);
    }

    @Test
    public void testdislikeValue() {
        // all equal
        double[] actual = new double[] {
                0.25, 0.25, 0.25, 0.25
        };
        double[] expected = new double[] {
                0.25 + 0.25 / 3, 0.0, 0.25 + 0.25 / 3, 0.25 + 0.25 / 3
        };
        new ClothingType().dislikeValue(1, actual);
        assertThat(actual).isEqualTo(expected);

        // two zero, keep them zero
        actual = new double[] {
                0.0, 0.5, 0.0, 0.5
        };
        expected = new double[] {
                0.0, 0.0, 0.0, 1.0
        };
        new ClothingType().dislikeValue(1, actual);
        assertThat(actual).isEqualTo(expected);
    }

    @Test
    public void testDislikeLikeValue() {
        /*
         * Using specifically created UNKNOWN type because it has no similar types.
         */
    	int index = ClothingType.Value.TOP.index();
        // first dislike
        double[] actual = new double[] {
                0.25, 0.25, 0.25, 0.25
        };
        double[] expected = new double[] {
        		0.0, 0.25 + 0.25 / 3, 0.25 + 0.25 / 3, 0.25 + 0.25 / 3
        };
        new ClothingType().dislikeValue(index, actual);
        assertThat(actual).isEqualTo(expected);

        // then like again
        // liked value should have highest weight now
        double weightOthers = 0.25 + 0.25 / 3 - 1.0 / (3 * 3);
        expected = new double[] {
        		1.0 / 3, weightOthers, weightOthers, weightOthers
        };
        new ClothingType().likeValue(index, actual);
        assertThat(actual).isEqualTo(expected);

        // liking with similars, make one non-similar zero
        actual = new double[] {
                1.0 / 7, 1.0 / 7, 1.0 / 7, 1.0 / 7, 1.0 / 7, 1.0 / 7, 1.0 / 7
        };
        double nonSimilarVal = 1.0 / 6 - ((1.0 / 7) / 4);
        expected = new double[] {
                1.0 / 6 + 1.0 / 7, 1.0 / 6, nonSimilarVal, nonSimilarVal,
                nonSimilarVal,
                nonSimilarVal, 0.0
        };
        new Price().dislikeValue(6, actual);
        new Price().likeValue(0, actual);
        assertThat(actual).isEqualTo(expected);
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextureView
        android:id="@+id/id_texture_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/id_tv_oval"
        android:layout_marginBottom="@dimen/camera_text_magin_bottom"
        android:paddingLeft="@dimen/camera_text_padding_r_l"
        android:paddingRight="@dimen/camera_text_padding_r_l"
        android:paddingBottom="@dimen/camera_text_padding_t_b"
        android:paddingTop="@dimen/camera_text_padding_t_b"
        android:background="@drawable/oval_drawable"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:textColor="@color/camera_shoot_color"
        android:text="@string/camera_shoot"
        android:textSize="@dimen/camera_shoot_font_size"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/id_iv_show_picture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop" />

    <LinearLayout
        android:id="@+id/bottom_linear_layout"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="@dimen/bottom_linear_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:orientation="horizontal"
        android:gravity="center"
        >
        <Button
            android:id="@+id/id_bt_again"
            android:text="@string/button_retry"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/button_retry_right_margin"/>
        <Button
            android:id="@+id/id_bt_ok"
            android:text="@string/button_ok"
            android:layout_gravity="center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <Button
        android:id="@+id/id_bt_home"
        android:text="@string/button_home"
        android:visibility="gone"
        android:layout_marginTop="@dimen/button_home_top_margin"
        android:layout_below="@id/id_iv_show_picture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"/>

</RelativeLayout>


text:
package edu.wustl.catissuecore.bean;

import java.util.Map;

import edu.wustl.common.util.Utility;
/**
 *
 * @author virender_mehta
 * @created-on Nov 9, 2009
 */
public class ExternalIdentifierBean
{
	/**
	 * ExternalIdentifier Id.
	 */
	private int xtrnId;
	/**
	 * ExternalIdentifier map.
	 */
	private Map<Object,Object> map;
	/**
	 * ExternalIdentifier name.
	 */
	private String exName = "";
	/**
	 * ExternalIdentifier value.
	 */
	private String exValue = "";
	/**
	 * ExternalIdentifier Id.
	 */
	private String exIdentifier = "";
	/**
	 * check condition.
	 */
	private String check = "";
	/**
	 * ExternalIdentifier condition.
	 */
	private String exCondition = "";
	/**
	 *  generate ExternalIdentifier keys.
	 */
	private void processData()
	{
		this.exName = "externalIdentifierValue(ExternalIdentifier:" + this.xtrnId + "_name)";
		this.exValue = "externalIdentifierValue(ExternalIdentifier:" + this.xtrnId + "_value)";
		this.exIdentifier = "externalIdentifierValue(ExternalIdentifier:" + this.xtrnId + "_id)";
		this.check = "chk_ex_" + this.xtrnId;
		final String exKey = "ExternalIdentifier:" + this.xtrnId + "_id";
		final boolean exBool = Utility.isPersistedValue(this.map, exKey);
		if (exBool)
		{
			this.exCondition = "disabled='disabled'";
		}
	}
	/**
	 * Default constructor.
	 */
	public ExternalIdentifierBean()
	{
		super();
	}

	/**
	 *
	 * @param xid ExternalIdentifier.
	 * @param map ExternalIdentifier map.
	 */
	public ExternalIdentifierBean(int xid, Map<Object,Object> map)
	{
		super();
		this.xtrnId = xid;
		this.map = map;
		this.processData();
	}

	/**
	 *
	 * @return check.
	 */
	public String getCheck()
	{
		return this.check;
	}
	/**
	 *
	 * @return exCondition.
	 */
	public String getExCondition()
	{
		return this.exCondition;
	}
	/**
	 *
	 * @return exIdentifier.
	 */
	public String getExIdentifier()
	{
		return this.exIdentifier;
	}
	/**
	 *
	 * @return exName.
	 */
	public String getExName()
	{
		return this.exName;
	}
	/**
	 *
	 * @return exValue
	 */
	public String getExValue()
	{
		return this.exValue;
	}
	/**
	 *
	 * @return xtrnId
	 */
	public int getXtrnId()
	{
		return this.xtrnId;
	}

}


text:
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">

{{ site.description }}

    Home

Search

All Recipes

Categories

appetizers

beef

beverages

breakfast

cake

chicken

christmasCookies

cookies

cookiesDone

desserts

dogTreats

events

fish

frosting

lamb

pasta

pies

pork

quickBreads

salads

sauces

sideDishes

soups

turkey

vegetableDishes

yeastBreads

    {% comment %}
      The code below dynamically generates a sidebar nav of pages with
      `layout: page` in the front-matter. See readme for usage.
    {% endcomment %}

   {% assign pages_list = site.pages %}
    {% for node in pages_list %}
      {% if node.title != null %}
        {% if node.layout == "page" %}
          {{ node.title }}
        {% endif %}
      {% endif %}
    {% endfor %}

      © {{ site.time | date: '%Y' }}. All rights reserved.