text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
Spring Framework: Class  BindException
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

com.interface21.validation

Class  BindException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--com.interface21.validation.BindException

All Implemented Interfaces:
Errors, java.io.Serializable

Direct Known Subclasses:
DataBinder

public class BindException
extends java.lang.Exception
implements Errors

Default implementation of the Errors interface, supporting
 registration and evaluation of binding errors.
 Slightly unusual, as it _is_ an exception.

This is mainly a framework-internal class. Normally,
 application code will work with the Errors interface.

Supports exporting a model, suitable for example for web MVC.
 Thus, it is sometimes used as parameter type instead of the
 Errors interface itself - if extracting the model makes sense
 in the respective context.

Author:
Rod Johnson, Juergen Hoeller

See Also:
getModel(), Serialized Form

Field Summary

static java.lang.String
ERROR_KEY_PREFIX

          Prefix for the name of the Errors instance in a model,
 followed by the object name.

Constructor Summary

BindException(java.lang.Object target,
              java.lang.String name)

          Create a new BindException instance.

Method Summary

protected  void
addFieldError(FieldError fe)

          Add a FieldError to the errors list.

 java.util.List
getAllErrors()

          Get all errors, both global and field ones.

protected  BeanWrapper
getBeanWrapper()

          Return the BeanWrapper that this instance uses.

 int
getErrorCount()

          Return the total number of errors.

 FieldError
getFieldError(java.lang.String field)

          Get the first error associated with the given field, if any.

 int
getFieldErrorCount(java.lang.String field)

          Return the number of errors associated with the given field.

 java.util.List
getFieldErrors(java.lang.String field)

          Get all errors associated with the given field.

 java.lang.Object
getFieldValue(java.lang.String field)

          Return the current value of the given field, either the current
 bean property value or a rejected update from the last binding.

 ObjectError
getGlobalError()

          Get the first global error, if any.

 int
getGlobalErrorCount()

          Return the number of global (i.e. not field-specific) errors.

 java.util.List
getGlobalErrors()

          Get all global errors.

 java.lang.String
getMessage()

          Returns diagnostic information about the errors held in this object.

 java.util.Map
getModel()

          Return a model Map for the contained state, exposing an Errors
 instance as ERROR_KEY_PREFIX + object name, and the object itself.

 java.lang.String
getObjectName()

          Return the name of the bound object.

 java.lang.Object
getTarget()

          Return the wrapped target object.

 boolean
hasErrors()

          Return if there were any errors.

 boolean
hasFieldErrors(java.lang.String field)

          Return if there are any errors associated with the given field.

 boolean
hasGlobalErrors()

          Return if there were any global (i.e. not field-specific) errors.

 void
reject(java.lang.String errorCode,
       java.lang.Object[] errorArgs,
       java.lang.String defaultMessage)

          Reject the current object, using the given error description.

 void
reject(java.lang.String errorCode,
       java.lang.String defaultMessage)

          Reject the current object, using the given error description.

 void
rejectValue(java.lang.String field,
            java.lang.String errorCode,
            java.lang.Object[] errorArgs,
            java.lang.String defaultMessage)

          Reject the given field of the current object, using the given error description.

 void
rejectValue(java.lang.String field,
            java.lang.String errorCode,
            java.lang.String defaultMessage)

          Reject the given field of the current object, using the given error description.

 void
setNestedPath(java.lang.String nestedPath)

          Allow context to be changed so that standard validators can
 validate subtrees.

Methods inherited from class java.lang.Throwable

fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

ERROR_KEY_PREFIX

public static final java.lang.String ERROR_KEY_PREFIX

Prefix for the name of the Errors instance in a model,
 followed by the object name.

Constructor Detail

BindException

public BindException(java.lang.Object target,
                     java.lang.String name)

Create a new BindException instance.

Parameters:
target - target object to bind onto
name - name of the target object

Method Detail

getBeanWrapper

protected BeanWrapper getBeanWrapper()

Return the BeanWrapper that this instance uses.

addFieldError

protected void addFieldError(FieldError fe)

Add a FieldError to the errors list.
 Intended to be used by subclasses like DataBinder.

getTarget

public java.lang.Object getTarget()

Return the wrapped target object.

getObjectName

public java.lang.String getObjectName()

Description copied from interface: Errors

Return the name of the bound object.

Specified by:
getObjectName in interface Errors

reject

public void reject(java.lang.String errorCode,
                   java.lang.String defaultMessage)

Description copied from interface: Errors

Reject the current object, using the given error description.

Specified by:
reject in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
errorCode - error code, interpretable as message key
defaultMessage - fallback default message

reject

public void reject(java.lang.String errorCode,
                   java.lang.Object[] errorArgs,
                   java.lang.String defaultMessage)

Description copied from interface: Errors

Reject the current object, using the given error description.

Specified by:
reject in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
errorCode - error code, interpretable as message key
errorArgs - error arguments, for argument binding via MessageFormat
 (can be null)
defaultMessage - fallback default message

rejectValue

public void rejectValue(java.lang.String field,
                        java.lang.String errorCode,
                        java.lang.String defaultMessage)

Description copied from interface: Errors

Reject the given field of the current object, using the given error description.

Specified by:
rejectValue in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
errorCode - error code, interpretable as message key
defaultMessage - fallback default message

rejectValue

public void rejectValue(java.lang.String field,
                        java.lang.String errorCode,
                        java.lang.Object[] errorArgs,
                        java.lang.String defaultMessage)

Description copied from interface: Errors

Reject the given field of the current object, using the given error description.

Specified by:
rejectValue in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
errorCode - error code, interpretable as message key
errorArgs - error arguments, for argument binding via MessageFormat
 (can be null)
defaultMessage - fallback default message

hasErrors

public boolean hasErrors()

Description copied from interface: Errors

Return if there were any errors.

Specified by:
hasErrors in interface Errors

getErrorCount

public int getErrorCount()

Description copied from interface: Errors

Return the total number of errors.

Specified by:
getErrorCount in interface Errors

getAllErrors

public java.util.List getAllErrors()

Description copied from interface: Errors

Get all errors, both global and field ones.

Specified by:
getAllErrors in interface Errors

Following copied from interface: com.interface21.validation.Errors

Returns:
List of ObjectError instances

hasGlobalErrors

public boolean hasGlobalErrors()

Description copied from interface: Errors

Return if there were any global (i.e. not field-specific) errors.

Specified by:
hasGlobalErrors in interface Errors

getGlobalErrorCount

public int getGlobalErrorCount()

Description copied from interface: Errors

Return the number of global (i.e. not field-specific) errors.

Specified by:
getGlobalErrorCount in interface Errors

getGlobalErrors

public java.util.List getGlobalErrors()

Description copied from interface: Errors

Get all global errors.

Specified by:
getGlobalErrors in interface Errors

Following copied from interface: com.interface21.validation.Errors

Returns:
List of ObjectError instances

getGlobalError

public ObjectError getGlobalError()

Description copied from interface: Errors

Get the first global error, if any.

Specified by:
getGlobalError in interface Errors

Following copied from interface: com.interface21.validation.Errors

Returns:
the global error, or null

hasFieldErrors

public boolean hasFieldErrors(java.lang.String field)

Description copied from interface: Errors

Return if there are any errors associated with the given field.

Specified by:
hasFieldErrors in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
Returns:
if there were any errors associated with the given field

getFieldErrorCount

public int getFieldErrorCount(java.lang.String field)

Description copied from interface: Errors

Return the number of errors associated with the given field.

Specified by:
getFieldErrorCount in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
Returns:
the number of errors associated with the given field

getFieldErrors

public java.util.List getFieldErrors(java.lang.String field)

Description copied from interface: Errors

Get all errors associated with the given field.

Specified by:
getFieldErrors in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
Returns:
List of FieldError instances

getFieldError

public FieldError getFieldError(java.lang.String field)

Description copied from interface: Errors

Get the first error associated with the given field, if any.

Specified by:
getFieldError in interface Errors

Following copied from interface: com.interface21.validation.Errors

Returns:
the field-specific error, or null

getFieldValue

public java.lang.Object getFieldValue(java.lang.String field)

Description copied from interface: Errors

Return the current value of the given field, either the current
 bean property value or a rejected update from the last binding.
 Allows for convenient access to user-specified field values,
 even if there were type mismatches.

Specified by:
getFieldValue in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
field - field name
Returns:
the current value of the given field

setNestedPath

public void setNestedPath(java.lang.String nestedPath)

Description copied from interface: Errors

Allow context to be changed so that standard validators can
 validate subtrees. Reject calls prepend the given nested
 path to the field names.

For example, an address validator could validate the
 subobject address of a customer object.

Specified by:
setNestedPath in interface Errors

Following copied from interface: com.interface21.validation.Errors

Parameters:
nestedPath - nested path within this object,
 e.g. "address" (defaults to "", null is also acceptable)

getModel

public final java.util.Map getModel()

Return a model Map for the contained state, exposing an Errors
 instance as ERROR_KEY_PREFIX + object name, and the object itself.

See Also:
ERROR_KEY_PREFIX

getMessage

public java.lang.String getMessage()

Returns diagnostic information about the errors held in this object.

Overrides:
getMessage in class java.lang.Throwable

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

Rod Johnson and Spring contributors 2001-2003.

redpajama_set_name: RedPajamaGithub


text:
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "AVSCommon/AVS/EditableMessageRequest.h"

using namespace ::testing;

namespace alexaClientSDK {

namespace avsCommon {
namespace avs {
namespace test {

class MockAttachmentReader : public attachment::AttachmentReader {
public:
    MOCK_METHOD4(
        read,
        std::size_t(
            void* buf,
            std::size_t numBytes,
            attachment::AttachmentReader::ReadStatus* readStatus,
            std::chrono::milliseconds timeoutMs));
    MOCK_METHOD1(seek, bool(uint64_t offset));
    MOCK_METHOD0(getNumUnreadBytes, uint64_t());
    MOCK_METHOD1(close, void(attachment::AttachmentReader::ClosePoint closePoint));
};

class EditableMessageRequestTest : public ::testing::Test {};

TEST_F(EditableMessageRequestTest, test_setJsonContent) {
    std::string jsonContent = "{\"name\": \"value\"}";
    MessageRequest sourceRequest("{}", true, "", {});
    EditableMessageRequest messageRequest = sourceRequest;

    EXPECT_NE(jsonContent, messageRequest.getJsonContent());
    messageRequest.setJsonContent(jsonContent);
    EXPECT_EQ(jsonContent, messageRequest.getJsonContent());
}

TEST_F(EditableMessageRequestTest, test_setAttachmentReaders) {
    std::shared_ptr<attachment::AttachmentReader> reader = std::make_shared<MockAttachmentReader>();
    std::vector<std::shared_ptr<MessageRequest::NamedReader>> attachmentReaders{
        std::make_shared<MessageRequest::NamedReader>("Test", reader)};
    MessageRequest sourceRequest("{}", true, "", {});
    EditableMessageRequest messageRequest = sourceRequest;

    EXPECT_EQ(0, messageRequest.attachmentReadersCount());
    messageRequest.setAttachmentReaders(attachmentReaders);
    EXPECT_EQ(1, messageRequest.attachmentReadersCount());
    auto namedReader = messageRequest.getAttachmentReader(0);
    EXPECT_TRUE(namedReader != nullptr);
    EXPECT_EQ(attachmentReaders[0]->name, namedReader->name);
    EXPECT_EQ(attachmentReaders[0]->reader, namedReader->reader);
}

TEST_F(EditableMessageRequestTest, test_setAttachmentReadersFails) {
    auto reader = std::make_shared<MockAttachmentReader>();
    auto validNamedReader = std::make_shared<MessageRequest::NamedReader>("Test", reader);
    std::vector<std::shared_ptr<MessageRequest::NamedReader>> attachmentReaders{
        validNamedReader, nullptr, std::make_shared<MessageRequest::NamedReader>("Test2", nullptr)};
    MessageRequest sourceRequest("{}", true, "", {});
    EditableMessageRequest messageRequest = sourceRequest;

    EXPECT_EQ(0, messageRequest.attachmentReadersCount());
    messageRequest.setAttachmentReaders(attachmentReaders);
    EXPECT_EQ(1, messageRequest.attachmentReadersCount());
    auto namedReader = messageRequest.getAttachmentReader(0);
    EXPECT_TRUE(namedReader != nullptr);
    EXPECT_EQ(attachmentReaders[0]->name, namedReader->name);
    EXPECT_EQ(attachmentReaders[0]->reader, namedReader->reader);
}

TEST_F(EditableMessageRequestTest, test_setMessageRequestResolveFunction) {
    MessageRequest sourceRequest("{}", true, "", {});
    EditableMessageRequest request = sourceRequest;
    MockFunction<bool(const std::shared_ptr<EditableMessageRequest>&, std::string)> mockResolverFunc;

    EXPECT_TRUE(request.isResolved());
    request.setMessageRequestResolveFunction(mockResolverFunc.AsStdFunction());
    EXPECT_FALSE(request.isResolved());
}

}  // namespace test
}  // namespace avs
}  // namespace avsCommon
}  // namespace alexaClientSDK


text:
package com.github.bingoohuang.utils.str;

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

public class AntPathMatcher {
    public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) {
        if (str == null) {
            return null;
        }
        StringTokenizer st = new StringTokenizer(str, delimiters);
        List<String> tokens = new ArrayList<>();
        while (st.hasMoreTokens()) {
            String token = st.nextToken();
            if (trimTokens) {
                token = token.trim();
            }
            if (!ignoreEmptyTokens || token.length() > 0) {
                tokens.add(token);
            }
        }
        return tokens.toArray(new String[tokens.size()]);
    }

    public static boolean match(String pattern, String str, String separator) {
        if (str.startsWith(separator) != pattern.startsWith(separator)) {
            return false;
        }

        String[] patDirs = tokenizeToStringArray(pattern, separator, true, true);
        String[] strDirs = tokenizeToStringArray(str, separator, true, true);

        int patIdxStart = 0;
        int patIdxEnd = patDirs.length - 1;
        int strIdxStart = 0;
        int strIdxEnd = strDirs.length - 1;

        // Match all elements up to the first **
        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
            String patDir = patDirs[patIdxStart];
            if (patDir.equals("**")) {
                break;
            }
            if (!matchStrings(patDir, strDirs[strIdxStart])) {
                return false;
            }
            patIdxStart++;
            strIdxStart++;
        }

        if (strIdxStart > strIdxEnd) {
            // String is exhausted, only match if rest of pattern is **'s
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (!patDirs[i].equals("**")) {
                    return false;
                }
            }
            return true;
        } else {
            if (patIdxStart > patIdxEnd) {
                // String not exhausted, but pattern is. Failure.
                return false;
            }
        }

        // up to last '**'
        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
            String patDir = patDirs[patIdxEnd];
            if (patDir.equals("**")) {
                break;
            }
            if (!matchStrings(patDir, strDirs[strIdxEnd])) {
                return false;
            }
            patIdxEnd--;
            strIdxEnd--;
        }
        if (strIdxStart > strIdxEnd) {
            // String is exhausted
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (!patDirs[i].equals("**")) {
                    return false;
                }
            }
            return true;
        }

        while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
            int patIdxTmp = -1;
            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
                if (patDirs[i].equals("**")) {
                    patIdxTmp = i;
                    break;
                }
            }
            if (patIdxTmp == patIdxStart + 1) {
                // '**/**' situation, so skip one
                patIdxStart++;
                continue;
            }
            // Find the pattern between padIdxStart & padIdxTmp in str between
            // strIdxStart & strIdxEnd
            int patLength = (patIdxTmp - patIdxStart - 1);
            int strLength = (strIdxEnd - strIdxStart + 1);
            int foundIdx = -1;
            strLoop:
            for (int i = 0; i <= strLength - patLength; i++) {
                for (int j = 0; j < patLength; j++) {
                    String subPat = patDirs[patIdxStart + j + 1];
                    String subStr = strDirs[strIdxStart + i + j];
                    if (!matchStrings(subPat, subStr)) {
                        continue strLoop;
                    }
                }

                foundIdx = strIdxStart + i;
                break;
            }

            if (foundIdx == -1) {
                return false;
            }

            patIdxStart = patIdxTmp;
            strIdxStart = foundIdx + patLength;
        }

        for (int i = patIdxStart; i <= patIdxEnd; i++) {
            if (!patDirs[i].equals("**")) {
                return false;
            }
        }

        return true;
    }

    /**
     * Tests whether or not a string matches against a pattern. The pattern may contain two special characters:

     * '*' means zero or more characters

     * '?' means one and only one character
     *
     * @param pattern pattern to match against. Must not be null.
     * @param str     string which must be matched against the pattern. Must not be null.
     * @return true if the string matches against the pattern, or false otherwise.
     */
    private static boolean matchStrings(String pattern, String str) {
        char[] patArr = pattern.toCharArray();
        char[] strArr = str.toCharArray();
        int patIdxStart = 0;
        int patIdxEnd = patArr.length - 1;
        int strIdxStart = 0;
        int strIdxEnd = strArr.length - 1;
        char ch;

        boolean containsStar = false;
        for (int i = 0; i < patArr.length; i++) {
            if (patArr[i] == '*') {
                containsStar = true;
                break;
            }
        }

        if (!containsStar) {
            // No '*'s, so we make a shortcut
            if (patIdxEnd != strIdxEnd) {
                return false; // Pattern and string do not have the same size
            }
            for (int i = 0; i <= patIdxEnd; i++) {
                ch = patArr[i];
                if (ch != '?') {
                    if (ch != strArr[i]) {
                        return false;// Character mismatch
                    }
                }
            }
            return true; // String matches against pattern
        }

        if (patIdxEnd == 0) {
            return true; // Pattern contains only '*', which matches anything
        }

        // Process characters before first star
        while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) {
            if (ch != '?') {
                if (ch != strArr[strIdxStart]) {
                    return false;// Character mismatch
                }
            }
            patIdxStart++;
            strIdxStart++;
        }
        if (strIdxStart > strIdxEnd) {
            // All characters in the string are used. Check if only '*'s are
            // left in the pattern. If so, we succeeded. Otherwise failure.
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (patArr[i] != '*') {
                    return false;
                }
            }
            return true;
        }

        // Process characters after last star
        while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) {
            if (ch != '?') {
                if (ch != strArr[strIdxEnd]) {
                    return false;// Character mismatch
                }
            }
            patIdxEnd--;
            strIdxEnd--;
        }
        if (strIdxStart > strIdxEnd) {
            // All characters in the string are used. Check if only '*'s are
            // left in the pattern. If so, we succeeded. Otherwise failure.
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (patArr[i] != '*') {
                    return false;
                }
            }
            return true;
        }

        // process pattern between stars. padIdxStart and patIdxEnd point
        // always to a '*'.
        while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
            int patIdxTmp = -1;
            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
                if (patArr[i] == '*') {
                    patIdxTmp = i;
                    break;
                }
            }
            if (patIdxTmp == patIdxStart + 1) {
                // Two stars next to each other, skip the first one.
                patIdxStart++;
                continue;
            }
            // Find the pattern between padIdxStart & padIdxTmp in str between
            // strIdxStart & strIdxEnd
            int patLength = (patIdxTmp - patIdxStart - 1);
            int strLength = (strIdxEnd - strIdxStart + 1);
            int foundIdx = -1;
            strLoop:
            for (int i = 0; i <= strLength - patLength; i++) {
                for (int j = 0; j < patLength; j++) {
                    ch = patArr[patIdxStart + j + 1];
                    if (ch != '?') {
                        if (ch != strArr[strIdxStart + i + j]) {
                            continue strLoop;
                        }
                    }
                }

                foundIdx = strIdxStart + i;
                break;
            }

            if (foundIdx == -1) {
                return false;
            }

            patIdxStart = patIdxTmp;
            strIdxStart = foundIdx + patLength;
        }

        // All characters in the string are used. Check if only '*'s are left
        // in the pattern. If so, we succeeded. Otherwise failure.
        for (int i = patIdxStart; i <= patIdxEnd; i++) {
            if (patArr[i] != '*') {
                return false;
            }
        }

        return true;
    }

}


text:
import __future__
import os
import sys
import script.rio as io
from timeit import default_timer as timer
import numpy as np

def split_domain(domain_dir, output_dir, nSDD_X, nSDD_Y):
    io.make_sure_path_exists(output_dir)

    domain_f = open(os.path.join(domain_dir, 'domain.dat'), 'r')
    line_split = domain_f.readline().split()
    domain_lx = line_split[2]
    domain_ly = line_split[3]
    domain_Nx = int(line_split[4])
    domain_Ny = int(line_split[5])
    BClayer = int(line_split[6])

    SDD_Nx = domain_Nx // nSDD_X
    SDD_Ny = domain_Ny // nSDD_Y

    # Writing short domain info
    domain_shortinfo = open(os.path.join(output_dir, 'domain.info'), 'w+')
    domain_shortinfo.write(domain_lx + " " + domain_ly +\
            " " + str(domain_Nx) + " " + str(domain_Ny) +\
            " " + str(nSDD_X) + " " + str(nSDD_Y) + " " + str(BClayer) + "\n")
    domain_shortinfo.close()

    sdd_to_coords = dict()
    for SDDid in range(nSDD_X * nSDD_Y):
        sdd_to_coords[SDDid] = list()

    # Now iterating through all coords of domain
    for line in domain_f.readlines():
        line_split = line.split()
        uid = int(line_split[0])
        coordX = int(line_split[1])
        coordY = int(line_split[2])

        x = coordX // SDD_Nx
        y = coordY // SDD_Ny
        BL_X = SDD_Nx * x
        BL_Y = SDD_Ny * y

        # SDD id is known based on coords
        SDDid = y * nSDD_X + x
        sdd_to_coords[SDDid].append((uid, coordX - BL_X, coordY - BL_Y))

    # Closing all streams
    domain_f.close()

    # We build for each SDD a file stream that will be updated through
    # iterations on the domain data
    for x in range(nSDD_X):
        for y in range(nSDD_Y):
            # Writing SDD file
            SDDid = y * nSDD_X + x
            SDDpath = os.path.join(output_dir, 'sdd' + str(SDDid))
            io.make_sure_path_exists(SDDpath)

            # Writing bottom-left coords on domain
            BL_X = SDD_Nx * x
            BL_Y = SDD_Ny * y
            with open(os.path.join(SDDpath, 'sdd.dat'), 'w+') as file_stream:
                file_stream.write(str(BL_X) + " " + str(BL_Y) + "\n")
                file_stream.write(str(SDD_Nx) + " " + str(SDD_Ny) + "\n")

                # Finally writing uid on domain and position on SDD
                for c in sdd_to_coords[SDDid]:
                    file_stream.write("%s %s %s\n" % (c[0], c[1], c[2]))

    return sdd_to_coords

def merge_domain(split_dir, output_dir):
    domain_shortinfo = open(os.path.join(split_dir, "domain.info"), 'r')
    line_domain = domain_shortinfo.readline()
    line_split = line_domain.split()
    domain_shortinfo.close()

    io.make_sure_path_exists(output_dir)
    domain_f = open(os.path.join(output_dir, "domain.dat"), 'w+')
    domain_f.write("2D cartesian ")
    domain_f.write(" ".join([st for st in line_split[:4]]) + "\n")

    nSDD_X = int(line_split[4])
    nSDD_Y = int(line_split[5])

    for x in range(nSDD_X):
        for y in range(nSDD_Y):
            # Writing SDD file
            SDDid = y * nSDD_X + x
            SDDpath = os.path.join(split_dir, 'sdd' + str(SDDid))

            with open(os.path.join(SDDpath, 'sdd.dat'), 'r') as file_stream:
                line_split = file_stream.readline().split()
                BL_X = int(line_split[0])
                BL_Y = int(line_split[1])
                line_split = file_stream.readline().split()
                SDD_Nx = int(line_split[0])
                SDD_Ny = int(line_split[1])

                for i in range(SDD_Nx):
                    for j in range(SDD_Ny):
                        line_split = file_stream.readline().split()
                        uid = line_split[0]
                        coordX_SDD = int(line_split[1])
                        coordY_SDD = int(line_split[2])
                        domain_f.write(uid + " " + str(BL_X + coordX_SDD) + " " + str(BL_Y + coordY_SDD) + "\n")

    domain_f.close()

def split_quantity(quantity_dir, output_dir, quantity_name, sdd_to_coords):

    quantity_file_name = os.path.join(quantity_dir, quantity_name + '.dat')

    # Assume the file is only zero in this case (to save space).
    if not os.path.exists(quantity_file_name):
        return

    domain_shortinfo = open(os.path.join(output_dir, "domain.info"), 'r')
    line_domain = domain_shortinfo.readline()
    line_split = line_domain.split()
    domain_shortinfo.close()

    nSDD = int(line_split[4]) * int(line_split[5])
    quantity = np.loadtxt(quantity_file_name, usecols=[1])

    # Opening streams for all SDDs
    for SDDid in range(nSDD):
        SDDpath = os.path.join(output_dir, 'sdd' + str(SDDid))
        with open(os.path.join(SDDpath, quantity_name + '.dat'), 'w+') as file_stream:
            # Now iterationg through all cell uids on quantity file
            for c in sdd_to_coords[SDDid]:
                file_stream.write("%s %s %16.16g\n" % (c[1], c[2], quantity[c[0]]))

def split_bc(bc_dir, output_dir):
    domain_shortinfo = open(os.path.join(output_dir, "domain.info"), 'r')
    line_split = domain_shortinfo.readline().split()

    domain_Nx = int(line_split[2])
    domain_Ny = int(line_split[3])
    nSDD_X = int(line_split[4])
    nSDD_Y = int(line_split[5])
    BClayer = int(line_split[6])

    nSDD = nSDD_X * nSDD_Y
    SDD_Nx = domain_Nx / nSDD_X
    SDD_Ny = domain_Ny / nSDD_Y
    domain_shortinfo.close()

    # Opening file streams
    file_streams = list()
    BL = list()
    for SDDid in range(nSDD):
        SDDpath = os.path.join(output_dir, 'sdd' + str(SDDid))
        # BL coordinates of SDDs, needed for coord conversion
        sdd_f = open(os.path.join(SDDpath, 'sdd.dat'), 'r')
        line_split = sdd_f.readline().split()
        BL.append((int(line_split[0]), int(line_split[1])))
        sdd_f.close()
        file_streams.append(open(os.path.join(SDDpath, 'bc.dat'), 'w+'))

    bc_f = open(os.path.join(bc_dir, 'bc.dat'), 'r')
    for line in bc_f:
        line_split = line.split()
        uid = line_split[0]
        coordX = int(line_split[1])
        coordY = int(line_split[2])

        # Determine to which SDD belongs the boundary cell
        eqCoordX = coordX
        eqCoordY = coordY

        # Left
        if coordX < 0:
            eqCoordX = 0
        # Top
        if coordY >= domain_Ny:
            eqCoordY = domain_Ny - 1
        # Right
        if coordX >= domain_Nx:
            eqCoordX = domain_Nx - 1
        # Bottom
        if coordY < 0:
            eqCoordY = 0

        # Determine SDD corresponding to eq coords
        x = eqCoordX // SDD_Nx
        y = eqCoordY // SDD_Ny
        SDDid = int(x + nSDD_X * y)

        # Determine coords on SDD: we use bottom-left coords of SDD
        BL_X = BL[SDDid][0]
        BL_Y = BL[SDDid][1]

        newLine = uid + " " + str(coordX - BL_X) + " " + str(coordY - BL_Y) + " " + " ".join(line_split[3:])  + "\n"
        # and add the boundary cell to the corresponding file
        file_streams[SDDid].write(newLine)

        # Corners ...
        cornerX = eqCoordX
        if BL_X > 0 and eqCoordX - BClayer - BL_X < 0:
            cornerX = eqCoordX - BClayer
        elif BL_X + SDD_Nx < domain_Nx and eqCoordX + BClayer - BL_X > 0:
            cornerX = eqCoordX + BClayer

        cornerY = eqCoordY
        if BL_Y > 0 and eqCoordY - BClayer - BL_Y < 0:
            cornerY = eqCoordY - BClayer
        elif BL_Y + SDD_Ny < domain_Ny and eqCoordY + BClayer - BL_Y > 0:
            cornerY = eqCoordY + BClayer

        otherX = cornerX // SDD_Nx
        otherY = cornerY // SDD_Ny
        otherSDDid = int(otherX + nSDD_X * otherY)

        '''
        if coordX == -1 and coordY == 32:
            print "BL_X: ", BL_X, "BL_Y: ", BL_Y
            print "coordX: ", coordX, "coordY: ", coordY
            print "eqCoordX: ", eqCoordX, "eqCoordY: ", eqCoordY
            print "cornerX: ", cornerX, "cornerY: ", cornerY
            print "my SDD: ", SDDid
            print "my other SDD: ", otherSDDid
        '''

        if otherSDDid != SDDid:
            # Determine coords on SDD: we use bottom-left coords of SDD
            otherBL_X = BL[otherSDDid][0]
            otherBL_Y = BL[otherSDDid][1]

            # and add the boundary cell to the corresponding file
            newLine = uid + " " + str(coordX - otherBL_X) + " " + str(coordY - otherBL_Y) + " " + " ".join(line_split[3:]) + "\n"
            file_streams[otherSDDid].write(newLine)

    bc_f.close()
    for i in range(nSDD):
        file_streams[i].close()

    return

def merge_quantity(split_dir, output_dir, quantity_name):
    domain_shortinfo = open(os.path.join(split_dir, "domain.info"), 'r')
    line_domain = domain_shortinfo.readline()
    line_split = line_domain.split()
    nSDD_X = int(line_split[4])
    nSDD_Y = int(line_split[5])
    domain_shortinfo.close()

    qty_stream = open(os.path.join(output_dir, quantity_name + '.dat'), 'w+')

    for SDDid in range(nSDD_X * nSDD_Y):
        # Build coords -> uid correspondence
        coords_to_uid = dict()
        SDDpath = os.path.join(split_dir, 'sdd' + str(SDDid))
        sdd_f = open(os.path.join(SDDpath, 'sdd.dat'), 'r')

        # First line is bottom-left coords of SDD
        # Second line is size of SDD
        # Both are useless here
        sdd_f.readline()
        sdd_f.readline()

        for line in sdd_f.readlines():
            line_split = line.split()
            coords = (int(line_split[1]), int(line_split[2]))
            uid = line_split[0]
            coords_to_uid[coords] = uid

        sdd_f.close()

        # Now iterating through quantity and add to global quantity stream
        with open(os.path.join(SDDpath, quantity_name + '.dat'), 'r') as quantity_f:
            for line in quantity_f.readlines():
                line_split = line.split()
                coords = (int(line_split[0]), int(line_split[1]))
                qty_stream.write(coords_to_uid[coords] + " " + line_split[2] + "\n")

    qty_stream.close()

def split_case(domain_dir, nSDD_X, nSDD_Y, qty_name_list):
    output_dir = os.path.join(domain_dir, str(nSDD_X) + "x" + str(nSDD_Y))
    if os.path.isdir(output_dir):
        print("Split already exists")
        return output_dir
    io.make_sure_path_exists(output_dir)
    start = timer()
    sdd_to_coords = split_domain(domain_dir, output_dir, nSDD_X, nSDD_Y)
    end = timer()
    print("Time to split domain %s second(s)" % int((end - start)))

    split_bc(domain_dir, output_dir)
    for q_str in qty_name_list:
        start = timer()
        split_quantity(domain_dir, output_dir, q_str, sdd_to_coords)
        end = timer()
        print("Time to split quantity", q_str, "%s second(s)" % int((end - start)))

    return output_dir


text:
<?php
namespace Kambo\Http\Message;

// \Spl
use InvalidArgumentException;

// \Psr
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;

// \Http\Message
use Kambo\Http\Message\Message;
use Kambo\Http\Message\Headers;
use Kambo\Http\Message\RequestTrait;
use Kambo\Http\Message\Factories\String\UriFactory;
use Kambo\Http\Message\Stream;

/**
 * Representation of an outgoing, client-side request.
 *
 * Per the HTTP specification, this interface includes properties for
 * each of the following:
 *
 * - Protocol version
 * - HTTP method
 * - URI
 * - Headers
 * - Message body
 *
 * During construction, implementations attempt to set the Host header from
 * a provided URI if no Host header is provided.
 *
 * Requests are considered immutable; all methods that change state retain
 * the internal state of the current message and return an instance that
 * contains the changed state.
 *
 * @package Kambo\Http\Message
 * @author  Bohuslav Simek <bohuslav@simek.si>
 * @license MIT
 */
class Request extends Message implements RequestInterface
{
    use RequestTrait;

    /**
     * Create new outgoing HTTP request.
     *
     * Adds a host header when none was provided and a host is defined in URI.
     *
     * @param string                      $requestMethod The request method
     * @param UriInterface|string         $uri           The request URI object
     * @param Headers                     $headers       The request headers collection
     * @param StreamInterface|string|null $body          The request body object
     * @param string                      $protocol      The request version of the protocol
     *
     * @throws \InvalidArgumentException If an unsupported argument type is
     *                                   provided for URI or body.
     */
    public function __construct(
        $requestMethod,
        $uri,
        $headers = [],
        $body = null,
        $protocol = '1.1'
    ) {
        parent::__construct($headers, $body, $protocol);

        if (is_string($uri)) {
            $this->uri = (new UriFactory())->create($uri);
        } elseif ($uri instanceof UriInterface) {
            $this->uri = $uri;
        } else {
            throw new InvalidArgumentException(
                'URI must be a string or implement Psr\Http\Message\UriInterface'
            );
        }

        $this->validateMethod($requestMethod);
        $this->requestMethod = $requestMethod;

        if ($this->shouldSetHost()) {
            $this->headers->set('Host', $this->uri->getHost());
        }
    }
}


text: void update(T a) {}


text:
#include "namespace.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
#include "un-namespace.h"
#include "thr_private.h"

__weak_reference(_pthread_mutexattr_getprioceiling, pthread_mutexattr_getprioceiling);
__weak_reference(_pthread_mutexattr_setprioceiling, pthread_mutexattr_setprioceiling);
__weak_reference(_pthread_mutex_getprioceiling, pthread_mutex_getprioceiling);
__weak_reference(_pthread_mutex_setprioceiling, pthread_mutex_setprioceiling);

int
_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling)
{
	int ret = 0;

	if ((mattr == NULL) || (*mattr == NULL))
		ret = EINVAL;
	else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT)
		ret = EINVAL;
	else
		*prioceiling = (*mattr)->m_ceiling;

	return(ret);
}

int
_pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling)
{
	int ret = 0;

	if ((mattr == NULL) || (*mattr == NULL))
		ret = EINVAL;
	else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT)
		ret = EINVAL;
	else
		(*mattr)->m_ceiling = prioceiling;

	return(ret);
}

int
_pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
			      int *prioceiling)
{
	int ret;

	if ((mutex == NULL) || (*mutex == NULL))
		ret = EINVAL;
	else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
		ret = EINVAL;
	else {
		*prioceiling = (*mutex)->m_prio;
		ret = 0;
	}
	return (ret);
}

int
_pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
			      int prioceiling, int *old_ceiling)
{
	int ret = 0;
	int tmp;

	if ((mutex == NULL) || (*mutex == NULL))
		ret = EINVAL;
	else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
		ret = EINVAL;
	/* Lock the mutex: */
	else if ((ret = _pthread_mutex_lock(mutex)) == 0) {
		tmp = (*mutex)->m_prio;
		/* Set the new ceiling: */
		(*mutex)->m_prio = prioceiling;

		/* Unlock the mutex: */
		ret = _pthread_mutex_unlock(mutex);

		/* Return the old ceiling: */
		*old_ceiling = tmp;
	}
	return(ret);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
<context>
    <name>page100</name>
    <message>
        <location filename="page100.ui" line="26"/>
        <source>page100</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="43"/>
        <location filename="page100.ui" line="55"/>
        <location filename="page100.ui" line="510"/>
        <location filename="page100.ui" line="522"/>
        <source>PLC_DigOut_4</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="46"/>
        <location filename="page100.ui" line="188"/>
        <location filename="page100.ui" line="292"/>
        <location filename="page100.ui" line="359"/>
        <location filename="page100.ui" line="401"/>
        <location filename="page100.ui" line="462"/>
        <source>ATCMled widget</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="94"/>
        <location filename="page100.ui" line="106"/>
        <location filename="page100.ui" line="289"/>
        <location filename="page100.ui" line="301"/>
        <source>PLC_DigOut_1</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="97"/>
        <location filename="page100.ui" line="513"/>
        <source>ATCMbutton widget</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="129"/>
        <location filename="page100.ui" line="132"/>
        <source>Output_1</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="160"/>
        <source>ATCM QTime</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="163"/>
        <source>ATCMtime widget</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="185"/>
        <location filename="page100.ui" line="197"/>
        <source>PLC_DigIn_5</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="233"/>
        <location filename="page100.ui" line="239"/>
        <source>var_to_convert</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="236"/>
        <source>ATCMlabel widget</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="242"/>
        <source>time:  </source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="343"/>
        <source>Output_6</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="356"/>
        <location filename="page100.ui" line="368"/>
        <source>PLC_DigOut_3</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="398"/>
        <location filename="page100.ui" line="410"/>
        <source>PLC_DigOut_6</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="459"/>
        <location filename="page100.ui" line="471"/>
        <source>PLC_DigIn_2</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="567"/>
        <source>DigIn_2</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="586"/>
        <source>DigIn_5</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="446"/>
        <source>Output_3</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="page100.ui" line="545"/>
        <location filename="page100.ui" line="548"/>
        <source>Output_4</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>


text:
class InterfaceConformanceError(RuntimeError):
    pass


text:
package org.spotter.eclipse.ui.navigator;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.spotter.eclipse.ui.Activator;
import org.spotter.eclipse.ui.editors.AbstractSpotterEditor;
import org.spotter.eclipse.ui.editors.MeasurementEditor;
import org.spotter.eclipse.ui.editors.MeasurementEditorInput;
import org.spotter.eclipse.ui.handlers.OpenHandler;
import org.spotter.eclipse.ui.menu.IOpenable;
import org.spotter.shared.configuration.FileManager;

/**
 * An element that represents the measurement controllers node.
 *
 * @author Denis Knoepfle
 *
 */
public class SpotterProjectConfigMeasurement extends AbstractProjectElement {

	public static final String IMAGE_PATH = "icons/measurement.png"; //$NON-NLS-1$

	private static final String ELEMENT_NAME = "Measurement Satellite Adapter";
	private static final String OPEN_ID = MeasurementEditor.ID;

	private ISpotterProjectElement parent;

	/**
	 * Creates a new instance of this element.
	 *
	 * @param parent
	 *            the parent element
	 */
	public SpotterProjectConfigMeasurement(ISpotterProjectElement parent) {
		super(IMAGE_PATH);
		this.parent = parent;
		addHandler(OpenHandler.OPEN_COMMAND_ID, new IOpenable() {
			@Override
			public void open() {
				SpotterProjectConfigMeasurement.this.open();
			}

			@Override
			public String getOpenId() {
				return OPEN_ID;
			}

			@Override
			public String getElementName() {
				return ELEMENT_NAME;
			}
		});
	}

	@Override
	public String getText() {
		return ELEMENT_NAME;
	}

	@Override
	public Object getParent() {
		return parent;
	}

	@Override
	public IProject getProject() {
		return parent.getProject();
	}

	private void open() {
		if (!Activator.getDefault().testServiceStatus(getProject().getName(), true)) {
			return;
		}
		IFile file = getProject().getFile(FileManager.ENVIRONMENT_FILENAME);
		AbstractSpotterEditor.openInstance(new MeasurementEditorInput(file), OPEN_ID);
	}

}


text:
layout: post
date: 2018-02-21
title: "Enzoani inara Sleeveless Sweep/Brush Train Sheath/Column"
category: Enzoani
tags: [Enzoani,Sheath/Column,Cowl,Sweep/Brush Train,Sleeveless]
---
### Enzoani inara
Just **$289.99**
###   Sleeveless Sweep/Brush Train Sheath/Column

BRANDS	Enzoani

Silhouette	Sheath/Column

Neckline	Cowl

Hemline/Train	Sweep/Brush Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/enzoani/5246-enzoani-inara.html](https://www.readybrides.com/en/enzoani/5246-enzoani-inara.html)


text:
{% import './data.html' as data %}

After completing the warmup exercises, your task is to do four more slightly
more challenges analyses.

## How many students like sushi as their favorite food?

{% lodash %}
var total_count = 0
for (i = 0; i < _.size(data.comments); i++) {
    var text = data.comments[i].body
    var search_string=  _.last(text.split('Food: '))
    var found_count = 0

    function splitString(stringToSplit, separator) {
        var arrayOfStrings = stringToSplit.split(separator)
        var j
        var count = 0

        for (j = 0; j < arrayOfStrings.length; j++) {
            if (arrayOfStrings[j] == "Sushi") { count++ }
        }
        return count
    }
    found_count = splitString(search_string, ' ')
    total_count += found_count
}
return total_count
{% endlodash %}

The answer is {{result}}.

## Who are the students liking Python the most?

{% lodash %}
var answer = ""
var ndx = 0
for (i = 0; i < _.size(data.comments); i++) {
    var text = data.comments[i].body
    var found_name

    function splitString(stringToSplit, separator) {
        var arrayOfStrings = stringToSplit.split(separator)
        var name = arrayOfStrings[0]
        var language = arrayOfStrings[2]
        var strip = _.trimLeft(_.last(language.split(':')))

        var array = strip.split(' ')
        var language = _.trimRight(_.first(array), ',')

        if (language == "Python") {
            return (_.last(name.split('Name:')))
        }
        else {
            return 'false'
        }
    }

    found_name = splitString(text, '\r\n')

    if (found_name != 'false') {
	answer += (found_name + ',')
    }
}
return answer
{% endlodash %}

Their names are {{result}}.

## Are there more Javascript lovers or Java lovers?

{% lodash %}
var java_count = 0
var javascript_count = 0

for (i = 0; i < _.size(data.comments); i++) {
    var text = data.comments[i].body
    var found_language

    function splitString(stringToSplit, separator) {
        var arrayOfStrings = stringToSplit.split(separator)
        var language = arrayOfStrings[2]

        found_language = _.last(language.split(':'))
        if (found_language == " JAVA" || found_language == ' Java') {
            java_count++
        }
        else if (found_language == " Javascript" || found_language == 'javascript') {
            javascript_count++
        }
        else {
	    return 'false'
        }
    }
    found_language = splitString(text, '\r\n')
}

if (java_count > javascript_count) {answer = " there are more Java Lovers"}
else if (javascript_count > java_count) {answer = " there are more Javascript Lover"}
else {answer = " there are the same number of Java Lovers and Javascript Lovers..."}
return answer
{% endlodash %}

The answer is {{result}}.

##  (1) Who like the same food as `kjblakemore`?
##  (2) Who like the same food as `willzfarmer`?

{% lodash %}
var food_string = ""
var search_name = "kjblakemore"
// var search_name = "willzfarmer"
var answer = ""

for (var n = 0; n < _.size(data.comments); n++) {
    var text = data.comments[n].body
    var login = data.comments[n].user.login
    var food =  _.last(text.split('Food:'))

    function splitString(stringToSplit, separator) {
        var arrayOfStrings = stringToSplit.split(separator)
        var j
        var count = 0

        for (j = 0; j < arrayOfStrings.length; j++) {
            if (arrayOfStrings[j] == food) { count++ }
        }
        return count
    }

    if (login == search_name) {
        food_string = food

        for (i = 0; i < _.size(data.comments); i++) {
            var new_text = data.comments[i].body
            var login = data.comments[i].user.login
            if (login != search_name) {
                var search_string =  _.last(new_text.split('Food:'))
                if (splitString(search_string, " ") != 0) {
                    answer += login + ','
                }
            }
        }
    }
}
if (answer == "") {answer = "none"}
return answer
{% endlodash %}

(1) Their names are {{result}}.


text:
class Alarm
{
public:
    enum class Status {
        NO_TIMEOUT,
        TIMEOUT
    };

    explicit Alarm(std::chrono::milliseconds timeout_duration):
        timeout_duration_(timeout_duration),
        remaining_time_(timeout_duration) {}

    void notify() {
        alarm_.notify_one();
    }

    //Status wait(std::chrono::milliseconds timeout_duration) {
    //    std::unique_lock<std::mutex> wait_lock(mutex_);
    //    auto status = alarm_.wait_for(wait_lock, timeout_duration);
    //    return std::cv_status::no_timeout == status
    //           ? Status::NO_TIMEOUT
    //           : Status::TIMEOUT;
    //}
    Status wait() {
        std::unique_lock<std::mutex> wait_lock(mutex_);

        auto start_time = std::chrono::high_resolution_clock::now();
        auto status = alarm_.wait_for(wait_lock, remaining_time_);
        auto finish_time = std::chrono::high_resolution_clock::now();
        auto duration = std::chrono::duration_cast<
            std::chrono::milliseconds
        >(finish_time - start_time);

        if (std::cv_status::timeout == status) {
            remaining_time_ = timeout_duration_;
            return Status::TIMEOUT;
        }
        else {
            if (duration < remaining_time_) {
                remaining_time_ -= duration;
            }
            else {
                remaining_time_ = timeout_duration_;
            }
            return Status::NO_TIMEOUT;
        }
    }

private:
    std::mutex mutex_;
    std::condition_variable alarm_;
    std::chrono::milliseconds timeout_duration_;
    std::chrono::milliseconds remaining_time_;

};

template <class Item>
class ConcurrentAlarmingQueue
{
public:
    explicit ConcurrentAlarmingQueue(std::shared_ptr<Alarm> alarm):
        alarm_(alarm) {}

    bool empty() {
        std::lock_guard<std::mutex> lock(mutex_);
        return items_.empty();
    }

    size_t size() {
        std::lock_guard<std::mutex> lock(mutex_);
        return items_.size();
    }

    void push(Item&& item) {
        std::lock_guard<std::mutex> lock(mutex_);
        items_.push(std::move(item));
        alarm_->notify();
    }

    Item pop() {
        std::lock_guard<std::mutex> lock(mutex_);
        Item item = std::move(items_.front());
        items_.pop();
        return item;
    }

private:
    std::mutex mutex_;
    std::shared_ptr<Alarm> alarm_;
    std::queue<Item> items_;

};

template <class Item>
class ConcurrentQueue
{
public:
    bool empty() {
        std::lock_guard<std::mutex> lock(mutex_);
        return items_.empty();
    }

    void push(Item&& item) {
        std::lock_guard<std::mutex> lock(mutex_);
        items_.push(std::move(item));
        non_empty_.notify_one();
    }

    Item pop() {
        std::unique_lock<std::mutex> lock(mutex_);
        if (items_.empty()) {
            non_empty_.wait(lock);
        }
        Item item = std::move(items_.front());
        items_.pop();
        return item;
    }

private:
    std::mutex mutex_;
    std::condition_variable non_empty_;
    std::queue<Item> items_;

};

class Executor
{
public:
    using Task = std::function<void(void)>;

    Executor(): is_running_(true) {
        thread_ = std::thread([this]() {
            this->run();
        });
        thread_.detach();
    }

    ~Executor() {
        is_running_ = false;
        thread_.join();
    }

    void addTask(Task&& task) {
        tasks_.push(std::move(task));
    }

private:
    std::thread thread_;
    ConcurrentQueue<Task> tasks_;
    std::atomic_bool is_running_;

    void run() {
        while (is_running_) {
            auto task = tasks_.pop();
            task();
        }
    }
};


text:
<?php

namespace Fk\StrategyMakerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * Default controller.
 *
 * @Route("/")
 */
class DefaultController extends Controller
{
    /**
     * @Route("/home", name="home")
     * @Template()
     */
    public function indexAction()
    {
        return $this->render('FkStrategyMakerBundle:Default:index.html.twig');
    }
}


text:
package uk.co.morleydev.zander.client.model.arg

object BuildCompiler extends Enumeration {

  type BuildCompiler = Value

  val VisualStudio10 = Value("msvc10")
  val VisualStudio11 = Value("msvc11")
  val VisualStudio12 = Value("msvc12")
  val VisualStudio14 = Value("msvc14")
  val VisualStudio10Win64 = Value("msvc10w64")
  val VisualStudio11Win64 = Value("msvc11w64")
  val VisualStudio12Win64 = Value("msvc12w64")
  val VisualStudio14Win64 = Value("msvc14w64")
  val Mingw = Value("mingw")
  val Unix = Value("unix")
  val Msys = Value("msys")
  val Borland = Value("borland")
  val NMake = Value("nmake")
  val NMakeJom = Value("nmake-jom")
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gem5: Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Modules

Namespaces

Classes

Files

Related Pages

      <form action="search.php" method="get">

             Search for
            <input type="text" name="query" value="" size="20" accesskey="s"/>

      </form>

Alphabetical List

Class List

Class Hierarchy

Class Members

TimingSimpleCPU::IcachePort::ITickEvent Member List
This is the complete list of members for TimingSimpleCPU::IcachePort::ITickEvent, including all inherited members.

description() const 	TimingSimpleCPU::IcachePort::ITickEvent	 [inline]

ITickEvent(TimingSimpleCPU *_cpu)	TimingSimpleCPU::IcachePort::ITickEvent	 [inline]

process()	TimingSimpleCPU::IcachePort::ITickEvent

<address style="align: right;">
Generated on Fri Apr 17 12:40:25 2015 for gem5 by  doxygen 1.4.7</address>


text:
package sjsonnet

import java.util

import scala.collection.mutable
import scala.jdk.CollectionConverters._

class ProfilingEvaluator(resolver: CachedResolver,
                         extVars: Map[String, ujson.Value],
                         wd: Path,
                         settings: Settings,
                         warn: Error => Unit)
  extends Evaluator(resolver, extVars, wd, settings, warn) {

  trait Box {
    def name: String
    var time: Long = 0
    var count: Long = 0
  }

  class ExprBox(val expr: Expr) extends Box {
    var children: Seq[Expr] = Nil
    var totalTime: Long = 0
    lazy val prettyOffset = prettyIndex(expr.pos).map { case (l,c) => s"$l:$c" }.getOrElse("?:?")
    lazy val prettyPos = s"${expr.pos.currentFile.asInstanceOf[OsPath].p}:$prettyOffset"
    lazy val name = expr.getClass.getName.split('.').last.split('$').last
  }

  class OpBox(val op: Int, val name: String) extends Box

  class ExprTypeBox(val name: String) extends Box

  class BuiltinBox(val name: String) extends Box

  private val data = new util.IdentityHashMap[Expr, ExprBox]
  private var parent: ExprBox = null

  private def getOrCreate(e: Expr): ExprBox = {
    var box = data.get(e)
    if(box == null) {
      box = new ExprBox(e)
      data.put(e, box)
    }
    box
  }

  override def visitExpr(e: Expr)(implicit scope: ValScope): Val = {
    val pt0 = System.nanoTime()
    val box = getOrCreate(e)
    val prevParent = parent
    parent = box
    val t0 = System.nanoTime()
    try super.visitExpr(e) finally {
      box.time += (System.nanoTime() - t0)
      box.count += 1
      parent = prevParent
      if(parent != null) {
        parent.time -= (System.nanoTime() - pt0)
      }
    }
  }

  def clear(): Unit = data.clear()

  def get(e: Expr): ExprBox = data.get(e)

  def accumulate(e: Expr): Long = {
    val box = getOrCreate(e)
    box.children = getChildren(e)
    box.totalTime = box.time + box.children.map(accumulate).sum
    box.totalTime
  }

  private def getChildren(e: Expr): Seq[Expr] = e match {
    case p: Product =>
      (0 until p.productArity).iterator.map(p.productElement).flatMap {
        case e: Expr => Seq(e)
        case a: Array[Expr] => a.toSeq
        case a: Array[Expr.CompSpec] => a.toSeq
        case p: Expr.Params => getChildren(p)
        case a: Expr.Member.AssertStmt => Seq(a.value, a.msg)
        case a: Array[Expr.Bind] => a.iterator.flatMap(getChildren).toSeq
        case a: Array[Expr.Member.Field] => a.iterator.flatMap(getChildren).toSeq
        case a: Array[Expr.Member.AssertStmt] => a.iterator.flatMap(getChildren).toSeq
        case s: Seq[_] => s.collect { case e: Expr => e }
        case s: Some[_] => s.collect { case e: Expr => e }
        case _ => Nil
      }.filter(_ != null).toSeq
    case _ => Nil
  }

  private def getChildren(p: Expr.Params): Seq[Expr] =
    if(p == null || p.defaultExprs == null) Nil else p.defaultExprs.toSeq

  private def getChildren(b: Expr.Bind): Seq[Expr] =
    getChildren(b.args) :+ b.rhs

  private def getChildren(m: Expr.Member): Seq[Expr] = m match {
    case b: Expr.Bind => getChildren(b.args) :+ b.rhs
    case a: Expr.Member.AssertStmt => Seq(a.value, a.msg)
    case f: Expr.Member.Field => getChildren(f.fieldName) ++ getChildren(f.args) :+ f.rhs
    case _ => Nil
  }

  private def getChildren(f: Expr.FieldName): Seq[Expr] = f match {
    case f: Expr.FieldName.Dyn => Seq(f.expr)
    case _ => Nil
  }

  def all: Seq[ExprBox] = data.values().asScala.toSeq

  def binaryOperators(): Seq[OpBox] = {
    val m = new mutable.HashMap[Int, OpBox]
    all.foreach { b =>
      b.expr match {
        case Expr.BinaryOp(_, _, op, _) =>
          val ob = m.getOrElseUpdate(op, new OpBox(op, Expr.BinaryOp.name(op)))
          ob.time += b.time
          ob.count += b.count
        case _ =>
      }
    }
    m.valuesIterator.toSeq
  }

  def unaryOperators(): Seq[OpBox] = {
    val m = new mutable.HashMap[Int, OpBox]
    all.foreach { b =>
      b.expr match {
        case Expr.UnaryOp(_, op, _) =>
          val ob = m.getOrElseUpdate(op, new OpBox(op, Expr.UnaryOp.name(op)))
          ob.time += b.time
          ob.count += b.count
        case _ =>
      }
    }
    m.valuesIterator.toSeq
  }

  def exprTypes(): Seq[ExprTypeBox] = {
    val m = new mutable.HashMap[String, ExprTypeBox]
    all.foreach { b =>
      val cl = b.expr match {
        case _: Val => classOf[Val]
        case e => e.getClass
      }
      val n = cl.getName.replaceAll("^sjsonnet\\.", "").replace('$', '.')
      val eb = m.getOrElseUpdate(n, new ExprTypeBox(n))
      eb.time += b.time
      eb.count += b.count
    }
    m.valuesIterator.toSeq
  }

  def builtins(): Seq[BuiltinBox] = {
    val names = new util.IdentityHashMap[Val.Func, String]()
    Std.functions.foreachEntry((n, f) => names.put(f, n))
    val m = new mutable.HashMap[String, BuiltinBox]
    def add(b: ExprBox, func: Val.Builtin): Unit = {
      val n = names.getOrDefault(func, func.getClass.getName)
      val bb = m.getOrElseUpdate(n, new BuiltinBox(n))
      bb.time += b.time
      bb.count += b.count
    }
    all.foreach { b =>
      b.expr match {
        case a: Expr.ApplyBuiltin1 => add(b, a.func)
        case a: Expr.ApplyBuiltin2 => add(b, a.func)
        case a: Expr.ApplyBuiltin => add(b, a.func)
        case _ =>
      }
    }
    m.valuesIterator.toSeq
  }
}


text:
package com.crm.provisioning.impl.vb;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import com.crm.kernel.message.Constants;
import com.crm.product.cache.ProductEntry;
import com.crm.product.cache.ProductFactory;
import com.crm.product.cache.ProductMessage;
import com.crm.provisioning.cache.ProvisioningCommand;
import com.crm.provisioning.impl.CommandImpl;
import com.crm.provisioning.message.CommandMessage;
import com.crm.provisioning.thread.CommandInstance;
import com.crm.provisioning.util.ResponseUtil;
import com.crm.subscriber.bean.SubscriberProduct;
import com.crm.subscriber.impl.IDDServiceImpl;
import com.crm.subscriber.impl.SubscriberProductImpl;

public class VBCommandImpl extends CommandImpl
{
	public CommandMessage confirmRegister(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		try
		{
			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.confirmRegister", request.getIsdn() + ", " + request.getProductId()));

			IDDServiceImpl.confirmRegister(request.getUserId(), request.getUserName(), request.getSubscriberId()
					, request.getIsdn(), request.getSubscriberType(), request.getProductId(), request.getLanguageId(),
					Constants.SUBSCRIBER_PENDING_STATUS, getActivationDate(request));

			setResponse(instance, request, "success", sessionId);
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return request;
	}

	public CommandMessage cancelConfirmRegister(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		try
		{
			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl..vb.VBCommandImpl.cancelConfirmRegister", request.getIsdn() + ", " + request.getProductId()));

			IDDServiceImpl.removeConfirm(request.getSubProductId());

			setResponse(instance, request, "success", sessionId);
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return request;
	}

	public CommandMessage registerIDD(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		try
		{
			boolean includeCurrentDay = request.getParameters().getBoolean(
					"includeCurrentDay");

//			if (request.getActionType().equals(Constants.ACTION_REGISTER)
//					|| request.getActionType().equals(Constants.ACTION_UPGRADE))
//				includeCurrentDay = false;

			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.registerIDD", request.getIsdn() + ", " + request.getProductId()));

			SubscriberProduct subProduct = null;

			if (!request.getParameters()
					.getProperty("PropertiesRenew", "false").equals("true")
					&& request.getChannel().equals(Constants.CHANNEL_SMS))
			{
				subProduct = IDDServiceImpl.registerIDD(
						request.getUserId(), request.getUserName(),
						request.getSubscriberId(), request.getIsdn(),
						request.getSubscriberType(), request.getProductId(),
						request.getCampaignId(), request.getLanguageId(),
						includeCurrentDay, true, Constants.SUBSCRIBER_PENDING_STATUS,
						getActivationDate(request), request.getSubProductId());
			}
			else
			{
				subProduct = SubscriberProductImpl.register(
						request.getUserId(), request.getUserName(),
						request.getSubscriberId(), request.getIsdn(),
						request.getSubscriberType(), request.getProductId(),
						request.getCampaignId(), request.getLanguageId(),
						includeCurrentDay, true, Constants.SUBSCRIBER_PENDING_STATUS,
						getActivationDate(request));
			}

			setResponse(instance, request, "success", sessionId);

			if (request.getParameters()
							.getProperty("PropertiesRenew", "false")
							.equals("true"))
			{
				IDDServiceImpl.updateProperties(request.getIsdn(),
						request.getProductId(), "renew");
//				IDDServiceImpl.removeExtendIDDBuffet(request.getIsdn(),
//						request.getProductId());

				SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
				SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
				Calendar cal = Calendar.getInstance();
				cal.add(cal.HOUR_OF_DAY, 14);

				request.setCause(Constants.VB_RENEW_SUCCESS);
				request.setResponseValue(ResponseUtil.SERVICE_START_DATE, sdf1.format(cal
						.getTime()));
				request.setResponseValue(ResponseUtil.SERVICE_ACTIVE_DATE,
						sdf.format(cal.getTime()));
			}
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return request;
	}

	public CommandMessage registerByPassComfirmIDD(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		try
		{
			boolean includeCurrentDay = request.getParameters().getBoolean(
					"includeCurrentDay");

//			if (request.getActionType().equals(Constants.ACTION_REGISTER)
//					|| request.getActionType().equals(Constants.ACTION_UPGRADE))
//				includeCurrentDay = false;

			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.registerIDD", request.getIsdn() + ", " + request.getProductId()));

			SubscriberProduct subProduct = null;

			subProduct = SubscriberProductImpl.register(
					request.getUserId(), request.getUserName(),
					request.getSubscriberId(), request.getIsdn(),
					request.getSubscriberType(), request.getProductId(),
					request.getCampaignId(), request.getLanguageId(),
					includeCurrentDay, true, Constants.SUBSCRIBER_PENDING_STATUS,
					getActivationDate(request));

			setResponse(instance, request, "success", sessionId);

			if (request.getParameters()
							.getProperty("PropertiesRenew", "false")
							.equals("true"))
			{
				IDDServiceImpl.updateProperties(request.getIsdn(),
						request.getProductId(), "renew");

				SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
				SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
				Calendar cal = Calendar.getInstance();
				cal.add(cal.HOUR_OF_DAY, 14);

				request.setCause(Constants.VB_RENEW_SUCCESS);
				request.setResponseValue(ResponseUtil.SERVICE_START_DATE,
						sdf1.format(cal.getTime()));
				request.setResponseValue(ResponseUtil.SERVICE_ACTIVE_DATE,
						sdf.format(cal.getTime()));
			}
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return request;
	}

	public CommandMessage unregisterIDD(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		try
		{
			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.unregisterIDD", request.getIsdn() + ", " + request.getProductId()));

			SubscriberProductImpl.unregister(request.getUserId(),
					request.getUserName(), request.getSubProductId(),
					request.getProductId());

			setResponse(instance, request, "success", sessionId);

			if (request.getChannel().equals(Constants.CHANNEL_CORE))
			{
				ProductEntry product = ProductFactory.getCache().getProduct(request.getProductId());
				ProductMessage productMessage = product.getProductMessage(request.getActionType(),
						request.getCampaignId(), request.getLanguageId(), request.getChannel(), Constants.SUCCESS);
				if (productMessage != null)
				{
					String content = productMessage.getContent();
					SubscriberProductImpl.insertSendSMS(product.getParameter("ProductShotCode", ""), request.getIsdn(), content);
				}
			}
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return request;
	}

	public CommandMessage subscriptionIDD(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		CommandMessage result = request;

		try
		{
			boolean includeCurrentDay = result.getParameters().getBoolean(
					"includeCurrentDay");

			long sessionId = setRequest(instance, result,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.subscriptionIDD", result.getIsdn() + ", " + request.getProductId()));

			SubscriberProduct subProduct = IDDServiceImpl.subscription(result.getUserId(),
					result.getUserName(), result.getSubProductId(),
					result.isFullOfCharge(), result.getQuantity(), includeCurrentDay);

			setResponse(instance, result, "success", sessionId);

			IDDServiceImpl.updateProperties(result.getIsdn(),
					result.getProductId(), "renew");

			SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
			SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
			Calendar cal = Calendar.getInstance();
			cal.add(cal.HOUR_OF_DAY, 14);

			result.setResponseValue(ResponseUtil.SERVICE_START_DATE, sdf1.format(cal
					.getTime()));
			result.setResponseValue(ResponseUtil.SERVICE_ACTIVE_DATE,
					sdf.format(cal.getTime()));

			if (!result.getChannel().equals(Constants.CHANNEL_SMS))
			{
				ProductEntry product = ProductFactory.getCache().getProduct(result.getProductId());
				ProductMessage productMessage = product.getProductMessage(result.getActionType(),
						result.getCampaignId(), result.getLanguageId(), result.getChannel(), Constants.SUCCESS);
				if (productMessage != null)
				{
					String content = productMessage.getContent();
					if (subProduct.getExpirationDate() != null)
					{
						content = content.replaceAll("~SERVICE_START_DATE~", sdf1.format(cal.getTime()));
						content = content.replaceAll("~SERVICE_ACTIVE_DATE~", sdf.format(cal.getTime()));
					}
					SubscriberProductImpl.insertSendSMS(product.getParameter("ProductShotCode", ""), result.getIsdn(), content);
				}
			}
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, result, error);
		}

		return result;
	}

	public CommandMessage barringIDD(CommandInstance instance,
			ProvisioningCommand provisioningCommand, CommandMessage request)
			throws Exception
	{
		CommandMessage result = request;

		try
		{
			long sessionId = setRequest(instance, request,
					getLogRequest("com.crm.provisioning.impl.vb.VBCommandImpl.barringIDD", request.getIsdn() + ", " + request.getProductId()));

			IDDServiceImpl.barringVBService(result.getUserId(),
					result.getUserName(), result.getSubProductId());

			setResponse(instance, request, "success", sessionId);
		}
		catch (Exception error)
		{
			processError(instance, provisioningCommand, request, error);
		}

		return result;
	}
}


text:
namespace gfx {

struct GFX_EXPORT OverlayPlaneData {
  OverlayPlaneData();
  OverlayPlaneData(int z_order,
                   OverlayTransform plane_transform,
                   const RectF& display_bounds,
                   const RectF& crop_rect,
                   bool enable_blend,
                   const Rect& damage_rect,
                   float opacity,
                   OverlayPriorityHint priority_hint,
                   const gfx::RRectF& rounded_corners,
                   const gfx::ColorSpace& color_space,
                   const absl::optional<HDRMetadata>& hdr_metadata,
                   absl::optional<SkColor> solid_color = absl::nullopt);
  ~OverlayPlaneData();

  OverlayPlaneData(const OverlayPlaneData& other);

  // Specifies the stacking order of the plane relative to the main framebuffer
  // located at index 0.
  int z_order = 0;

  // Specifies how the buffer is to be transformed during composition.
  OverlayTransform plane_transform = OverlayTransform::OVERLAY_TRANSFORM_NONE;

  // Bounds within the display to position the image in pixel coordinates. They
  // are sent as floating point rect as some backends such as Wayland are able
  // to do delegated compositing with sub-pixel accurate positioning.
  RectF display_bounds;

  // Normalized bounds of the image to be displayed in |display_bounds|.
  RectF crop_rect = RectF(1.f, 1.f);

  // Whether alpha blending should be enabled.
  bool enable_blend = false;

  // Damage on the buffer.
  Rect damage_rect;

  // Opacity of overlay plane. For a blending buffer (|enable_blend|) the total
  // transparency will by = channel alpha * |opacity|.
  float opacity = 1.0f;

  // Hints for overlay prioritization when delegated composition is used.
  OverlayPriorityHint priority_hint = OverlayPriorityHint::kNone;

  // Specifies the rounded corners of overlay plane.
  RRectF rounded_corners;

  // ColorSpace for this overlay.
  gfx::ColorSpace color_space;

  // Optional HDR meta data required to display this overlay.
  absl::optional<HDRMetadata> hdr_metadata;

  // Set if this is a solid color quad.
  absl::optional<SkColor> solid_color;
};

}  // namespace gfx

#endif  // UI_GFX_OVERLAY_PLANE_DATA_H_


text:
import sys
import time
import unittest
from winlogbeat import WriteReadTest

if sys.platform.startswith("win"):
    import win32evtlog
    import win32security

"""
Contains tests for reading from the Windows Event Log API (MS Vista and newer).
"""

@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
class Test(WriteReadTest):
    @classmethod
    def setUpClass(self):
        self.api = "wineventlog"
        super(WriteReadTest, self).setUpClass()

    def test_read_one_event(self):
        """
        wineventlog - Read one classic event
        """
        msg = "Hello world!"
        self.write_event_log(msg)
        evts = self.read_events()
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], msg=msg, extra={
            "keywords": ["Classic"],
            "opcode": "Info",
        })

    def test_read_unknown_event_id(self):
        """
        wineventlog - Read unknown event ID
        """
        msg = "Unknown event ID"
        event_id = 1111
        self.write_event_log(msg, eventID=event_id)
        evts = self.read_events()
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], eventID=event_id, extra={
            "keywords": ["Classic"],
            "opcode": "Info",
        })
        # Oddly, no rendering error is being given.
        self.assertTrue("message_error" not in evts[0])

    def test_read_unknown_sid(self):
        """
        wineventlog - Read event with unknown SID
        """
        # Fake SID that was made up.
        accountIdentifier = "S-1-5-21-3623811015-3361044348-30300820-1013"
        sid = win32security.ConvertStringSidToSid(accountIdentifier)

        msg = "Unknown SID " + accountIdentifier
        self.write_event_log(msg, sid=sid)
        evts = self.read_events()
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], msg=msg, sid=accountIdentifier, extra={
            "keywords": ["Classic"],
            "opcode": "Info",
        })

    def test_fields_under_root(self):
        """
        wineventlog - Add tags and custom fields under root
        """
        msg = "Add tags and fields under root"
        self.write_event_log(msg)
        evts = self.read_events(config={
            "tags": ["global"],
            "fields": {"global": "field", "env": "prod", "level": "overwrite"},
            "fields_under_root": True,
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "tags": ["local"],
                    "fields_under_root": True,
                    "fields": {"local": "field", "env": "dev"}
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], msg=msg, level="overwrite", extra={
            "keywords": ["Classic"],
            "opcode": "Info",
            "global": "field",
            "env": "dev",
            "local": "field",
            "tags": ["global", "local"],
        })

    def test_fields_not_under_root(self):
        """
        wineventlog - Add custom fields (not under root)
        """
        msg = "Add fields (not under root)"
        self.write_event_log(msg)
        evts = self.read_events(config={
            "fields": {"global": "field", "env": "prod", "level": "overwrite"},
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "fields": {"local": "field", "env": "dev", "num": 1}
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], msg=msg, extra={
            "keywords": ["Classic"],
            "opcode": "Info",
            "fields.global": "field",
            "fields.env": "dev",
            "fields.level": "overwrite",
            "fields.local": "field",
            "fields.num": 1,
        })
        self.assertTrue("tags" not in evts[0])

    def test_include_xml(self):
        """
        wineventlog - Include raw XML event
        """
        msg = "Include raw XML event"
        self.write_event_log(msg)
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "include_xml": True,
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assert_common_fields(evts[0], msg=msg)
        self.assertTrue("xml" in evts[0])

    def test_query_event_id(self):
        """
        wineventlog - Query by event IDs
        """
        msg = "event_id test case"
        self.write_event_log(msg, eventID=10)  # Excluded
        self.write_event_log(msg, eventID=50)
        self.write_event_log(msg, eventID=100)
        self.write_event_log(msg, eventID=150)  # Excluded
        self.write_event_log(msg, eventID=175)
        self.write_event_log(msg, eventID=200)
        evts = self.read_events(config={
            "tags": ["event_id"],
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "event_id": "50, 100-200, -150"
                }
            ]
        }, expected_events=4)
        self.assertTrue(len(evts), 4)
        self.assertEqual(evts[0]["event_id"], 50)
        self.assertEqual(evts[1]["event_id"], 100)
        self.assertEqual(evts[2]["event_id"], 175)
        self.assertEqual(evts[3]["event_id"], 200)

    def test_query_level_single(self):
        """
        wineventlog - Query by level (warning)
        """
        self.write_event_log("success", level=win32evtlog.EVENTLOG_SUCCESS)
        self.write_event_log("error", level=win32evtlog.EVENTLOG_ERROR_TYPE)
        self.write_event_log("warning", level=win32evtlog.EVENTLOG_WARNING_TYPE)
        self.write_event_log("information", level=win32evtlog.EVENTLOG_INFORMATION_TYPE)
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "level": "warning"
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assertEqual(evts[0]["level"], "Warning")

    def test_query_level_multiple(self):
        """
        wineventlog - Query by level (error, warning)
        """
        self.write_event_log("success", level=win32evtlog.EVENTLOG_SUCCESS) # Level 0, Info
        self.write_event_log("error", level=win32evtlog.EVENTLOG_ERROR_TYPE) # Level 2
        self.write_event_log("warning", level=win32evtlog.EVENTLOG_WARNING_TYPE) # Level 3
        self.write_event_log("information", level=win32evtlog.EVENTLOG_INFORMATION_TYPE) # Level 4
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "level": "error, warning"
                }
            ]
        }, expected_events=2)
        self.assertTrue(len(evts), 2)
        self.assertEqual(evts[0]["level"], "Error")
        self.assertEqual(evts[1]["level"], "Warning")

    def test_query_ignore_older(self):
        """
        wineventlog - Query by time (ignore_older than 2s)
        """
        self.write_event_log(">=2 seconds old", eventID=20)
        time.sleep(2)
        self.write_event_log("~0 seconds old", eventID=10)
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "ignore_older": "2s"
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assertEqual(evts[0]["event_id"], 10)

    def test_query_provider(self):
        """
        wineventlog - Query by provider (event source)
        """
        self.write_event_log("selected", source=self.otherAppName)
        self.write_event_log("filtered")
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "provider": [self.otherAppName]
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assertEqual(evts[0]["source_name"], self.otherAppName)

    def test_query_multi_param(self):
        """
        wineventlog - Query by multiple params
        """
        self.write_event_log("selected", source=self.otherAppName,
                             eventID=556, level=win32evtlog.EVENTLOG_ERROR_TYPE)
        self.write_event_log("filtered", source=self.otherAppName, eventID=556)
        self.write_event_log("filtered", level=win32evtlog.EVENTLOG_WARNING_TYPE)
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "event_id": "10-20, 30-40, -35, -18, 400-1000, -432",
                    "level": "warn, error",
                    "provider": [self.otherAppName]
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assertEqual(evts[0]["message"], "selected")

    def test_unknown_eventlog_config(self):
        """
        wineventlog - Unknown config parameter
        """
        self.render_config_template(
            event_logs=[
                {
                    "name": self.providerName,
                    "api": self.api,
                    "invalid": "garbage"}
            ]
        )
        self.start_beat(extra_args=["-configtest"]).check_wait(exit_code=1)
        assert self.log_contains("1 error: Invalid event log key 'invalid' found.")

    def test_utf16_characters(self):
        """
        wineventlog - UTF-16 characters
        """
        msg = (u'\u89E3\u51CD\u3057\u305F\u30D5\u30A9\u30EB\u30C0\u306E'
               u'\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u30B9\u30AF\u30EA'
               u'\u30D7\u30C8\u3092\u5B9F\u884C\u3057'
               u'\u8C61\u5F62\u5B57')
        self.write_event_log(msg)
        evts = self.read_events(config={
            "event_logs": [
                {
                    "name": self.providerName,
                    "api": self.api,
                    "include_xml": True,
                }
            ]
        })
        self.assertTrue(len(evts), 1)
        self.assertEqual(evts[0]["message"], msg)


text:
package com.vmware.vim25;

/**
@author Steve Jin (sjin@vmware.com)
*/

public class DasEnabledEvent extends ClusterEvent
{
}


text:
'use strict';

var React = require('react'), //eslint-disable-line no-unused-vars
	TestUtils = require( 'react-addons-test-utils' ),
	sinon = require('sinon'),
	FileViewerResolved = require('../fileViewerResolved.js');

describe('FileViewer Resolved', function() {
	var getComponentStub,
		genericViewerStub;

	beforeEach(function() {
		getComponentStub = sinon.stub();
		FileViewerResolved.__Rewire__('viewers', [{
			test: function() { return true; },
			getComponent: getComponentStub
		}]);

		genericViewerStub = sinon.stub();
		FileViewerResolved.__Rewire__('genericViewer', { getComponent: genericViewerStub });
	});

	it('should render wrapper with expected class name', function() {
		var elem = TestUtils.renderIntoDocument(
			<FileViewerResolved mimeType='text/html' src="test.html"/>
		);
		var wrapper = TestUtils.findRenderedDOMComponentWithClass(
			elem,
			'vui-fileviewer'
		);
		expect(wrapper).toBeDefined();
	});

	it('should render plugin which tests true', function() {
		TestUtils.renderIntoDocument(
			<FileViewerResolved mimeType='text/html' src="test.html" />
		);
		expect(getComponentStub.calledOnce).toBe(true);
	});

	it('should render a generic viewer if mimeType is null', function() {
		TestUtils.renderIntoDocument(
			<FileViewerResolved mimeType={null} src="test.html"/>
		);

		expect(genericViewerStub.called).toBe(true);
	});
});


text:
<!doctype html>

        <base href="../../" target="_blank">

		<meta charset="utf-8">

		<title>MvvmCross</title>

		<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
		<meta name="author" content="Hakim El Hattab">

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<link rel="stylesheet" href="css/reveal.min.css">
		<link rel="stylesheet" href="css/theme/coderus.css" id="theme">

		<link rel="stylesheet" href="lib/css/zenburn.css">

MvvmCross

https://github.com/MvvmCross/MvvmCross

What Is It?

Cross platform MVVM framework

for Xamarin

What's Provided?

Supports wide range of platforms

Core libraries

Android

Android support libraries

iOS

iOS support libraries

Mac

Xamarin Forms

Windows Phone 8

WPF

UWP

IoC Container

Implement dependency injection

Allows injection of platform specific code

Cross-Platform Databinding

Android

UWP

iOS

Advantages

Less code between Views & ViewModels

Bringing other platforms into line takes less time

Has very powerful tools, such as converters

Dependency injection framework allows powerful expressions

Disadvantages

Documentation!

Learning curve

iOS

MvvmCross ties the platform application to the framework

Would I Use It Again?

Questions


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.cordovatest.MainActivityFragment"
                tools:showIn="@layout/activity_main">

    <org.apache.cordova.engine.SystemWebView
        android:id="@+id/cordova_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </org.apache.cordova.engine.SystemWebView>

</RelativeLayout>


text:
<?php

namespace JBZoo\CrossCMS\Joomla;

use JBZoo\CrossCMS\AbstractHttp;
use JBZoo\Data\Data;

/**
 * Class Http
 * @package JBZoo\CrossCMS
 */
class Http extends AbstractHttp
{
    /**
     * {@inheritdoc}
     */
    protected function _request($url, $args, Data $options)
    {
        $method    = $options->get('method');
        $headers   = $options->get('headers');
        $timeout   = $options->get('timeout');
        $sslVerify = $options->get('ssl_verify');

        if (empty($headers)) {
            $headers = null;
        }

        if ($sslVerify) {
            // "curl" driver doesn't have such option
            $httpClient = \JHttpFactory::getHttp(); // try to find curl driver
        } else {
            $httpClient = \JHttpFactory::getHttp(null, 'stream');
        }

        $httpClient->setOption('userAgent', $options->get('user_agent'));

        if (self::METHOD_GET === $method) {
            $apiResponse = $httpClient->get($url, $headers, $timeout);

        } elseif (self::METHOD_POST === $method) {
            $apiResponse = $httpClient->post($url, $args, $headers, $timeout);

        } elseif (self::METHOD_HEAD === $method) {
            $apiResponse = $httpClient->head($url, $headers, $timeout);

        } elseif (self::METHOD_PUT === $method) {
            $apiResponse = $httpClient->put($url, $args, $headers, $timeout);

        } elseif (self::METHOD_DELETE === $method) {
            $apiResponse = $httpClient->delete($url, $headers, $timeout);

        } elseif (self::METHOD_OPTIONS === $method) {
            $apiResponse = $httpClient->options($url, $headers, $timeout);

        } elseif (self::METHOD_PATCH === $method) {
            $apiResponse = $httpClient->patch($url, $args, $headers, $timeout);

        } else {
            $apiResponse = $httpClient->get($url, $headers, $timeout);
        }

        return $apiResponse;
    }

    /**
     * @param $apiResponse
     * @return Data
     */
    protected function _compactResponse($apiResponse)
    {
        $response = array(
            'code'    => (int)$apiResponse->code,
            'headers' => array_change_key_case($apiResponse->headers, CASE_LOWER),
            'body'    => $apiResponse->body,
        );

        $response = new Data($response);

        return $response;
    }
}