text:
""" Named entity recognition fine-tuning: utilities to work with CoNLL-2003 task. """

import logging
import os
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union

from filelock import FileLock
from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available

logger = logging.getLogger(__name__)

@dataclass
class InputExample:
    """
    A single training/test example for token classification.

    Args:
        guid: Unique id for the example.
        words: list. The words of the sequence.
        labels: (Optional) list. The labels for each word of the sequence. This should be
        specified for train and dev examples, but not for test examples.
    """

    guid: str
    words: List[str]
    labels: Optional[List[str]]

@dataclass
class InputFeatures:
    """
    A single set of features of data.
    Property names are the same names as the corresponding inputs to a model.
    """

    input_ids: List[int]
    attention_mask: List[int]
    token_type_ids: Optional[List[int]] = None
    label_ids: Optional[List[int]] = None

class Split(Enum):
    train = "train"
    dev = "dev"
    test = "test"

class TokenClassificationTask:
    @staticmethod
    def read_examples_from_file(data_dir, mode: Union[Split, str]) -> List[InputExample]:
        raise NotImplementedError

    @staticmethod
    def get_labels(path: str) -> List[str]:
        raise NotImplementedError

    @staticmethod
    def convert_examples_to_features(
        examples: List[InputExample],
        label_list: List[str],
        max_seq_length: int,
        tokenizer: PreTrainedTokenizer,
        cls_token_at_end=False,
        cls_token="[CLS]",
        cls_token_segment_id=1,
        sep_token="[SEP]",
        sep_token_extra=False,
        pad_on_left=False,
        pad_token=0,
        pad_token_segment_id=0,
        pad_token_label_id=-100,
        sequence_a_segment_id=0,
        mask_padding_with_zero=True,
    ) -> List[InputFeatures]:
        """Loads a data file into a list of `InputFeatures`
        `cls_token_at_end` define the location of the CLS token:
            - False (Default, BERT/XLM pattern): [CLS] + A + [SEP] + B + [SEP]
            - True (XLNet/GPT pattern): A + [SEP] + B + [SEP] + [CLS]
        `cls_token_segment_id` define the segment id associated to the CLS token (0 for BERT, 2 for XLNet)
        """
        # TODO clean up all this to leverage built-in features of tokenizers

        label_map = {label: i for i, label in enumerate(label_list)}

        features = []
        for ex_index, example in enumerate(examples):
            if ex_index % 10_000 == 0:
                logger.info("Writing example %d of %d", ex_index, len(examples))

            tokens = []
            label_ids = []
            for word, label in zip(example.words, example.labels):
                word_tokens = tokenizer.tokenize(word)

                # bert-base-multilingual-cased sometimes output "nothing ([]) when calling tokenize with just a space.
                if len(word_tokens) > 0:
                    tokens.extend(word_tokens)
                    # Use the real label id for the first token of the word, and padding ids for the remaining tokens
                    label_ids.extend([label_map[label]] + [pad_token_label_id] * (len(word_tokens) - 1))

            # Account for [CLS] and [SEP] with "- 2" and with "- 3" for RoBERTa.
            special_tokens_count = tokenizer.num_special_tokens_to_add()
            if len(tokens) > max_seq_length - special_tokens_count:
                tokens = tokens[: (max_seq_length - special_tokens_count)]
                label_ids = label_ids[: (max_seq_length - special_tokens_count)]

            # The convention in BERT is:
            # (a) For sequence pairs:
            #  tokens:   [CLS] is this jack ##son ##ville ? [SEP] no it is not . [SEP]
            #  type_ids:   0   0  0    0    0     0       0   0   1  1  1  1   1   1
            # (b) For single sequences:
            #  tokens:   [CLS] the dog is hairy . [SEP]
            #  type_ids:   0   0   0   0  0     0   0
            #
            # Where "type_ids" are used to indicate whether this is the first
            # sequence or the second sequence. The embedding vectors for `type=0` and
            # `type=1` were learned during pre-training and are added to the wordpiece
            # embedding vector (and position vector). This is not *strictly* necessary
            # since the [SEP] token unambiguously separates the sequences, but it makes
            # it easier for the model to learn the concept of sequences.
            #
            # For classification tasks, the first vector (corresponding to [CLS]) is
            # used as the "sentence vector". Note that this only makes sense because
            # the entire model is fine-tuned.
            tokens += [sep_token]
            label_ids += [pad_token_label_id]
            if sep_token_extra:
                # roberta uses an extra separator b/w pairs of sentences
                tokens += [sep_token]
                label_ids += [pad_token_label_id]
            segment_ids = [sequence_a_segment_id] * len(tokens)

            if cls_token_at_end:
                tokens += [cls_token]
                label_ids += [pad_token_label_id]
                segment_ids += [cls_token_segment_id]
            else:
                tokens = [cls_token] + tokens
                label_ids = [pad_token_label_id] + label_ids
                segment_ids = [cls_token_segment_id] + segment_ids

            input_ids = tokenizer.convert_tokens_to_ids(tokens)

            # The mask has 1 for real tokens and 0 for padding tokens. Only real
            # tokens are attended to.
            input_mask = [1 if mask_padding_with_zero else 0] * len(input_ids)

            # Zero-pad up to the sequence length.
            padding_length = max_seq_length - len(input_ids)
            if pad_on_left:
                input_ids = ([pad_token] * padding_length) + input_ids
                input_mask = ([0 if mask_padding_with_zero else 1] * padding_length) + input_mask
                segment_ids = ([pad_token_segment_id] * padding_length) + segment_ids
                label_ids = ([pad_token_label_id] * padding_length) + label_ids
            else:
                input_ids += [pad_token] * padding_length
                input_mask += [0 if mask_padding_with_zero else 1] * padding_length
                segment_ids += [pad_token_segment_id] * padding_length
                label_ids += [pad_token_label_id] * padding_length

            assert len(input_ids) == max_seq_length
            assert len(input_mask) == max_seq_length
            assert len(segment_ids) == max_seq_length
            assert len(label_ids) == max_seq_length

            if ex_index < 5:
                logger.info("*** Example ***")
                logger.info("guid: %s", example.guid)
                logger.info("tokens: %s", " ".join([str(x) for x in tokens]))
                logger.info("input_ids: %s", " ".join([str(x) for x in input_ids]))
                logger.info("input_mask: %s", " ".join([str(x) for x in input_mask]))
                logger.info("segment_ids: %s", " ".join([str(x) for x in segment_ids]))
                logger.info("label_ids: %s", " ".join([str(x) for x in label_ids]))

            if "token_type_ids" not in tokenizer.model_input_names:
                segment_ids = None

            features.append(
                InputFeatures(
                    input_ids=input_ids, attention_mask=input_mask, token_type_ids=segment_ids, label_ids=label_ids
                )
            )
        return features

if is_torch_available():
    import torch
    from torch import nn
    from torch.utils.data import Dataset

    class TokenClassificationDataset(Dataset):
        """
        This will be superseded by a framework-agnostic approach
        soon.
        """

        features: List[InputFeatures]
        pad_token_label_id: int = nn.CrossEntropyLoss().ignore_index
        # Use cross entropy ignore_index as padding label id so that only
        # real label ids contribute to the loss later.

        def __init__(
            self,
            token_classification_task: TokenClassificationTask,
            data_dir: str,
            tokenizer: PreTrainedTokenizer,
            labels: List[str],
            model_type: str,
            max_seq_length: Optional[int] = None,
            overwrite_cache=False,
            mode: Split = Split.train,
        ):
            # Load data features from cache or dataset file
            cached_features_file = os.path.join(
                data_dir,
                "cached_{}_{}_{}".format(mode.value, tokenizer.__class__.__name__, str(max_seq_length)),
            )

            # Make sure only the first process in distributed training processes the dataset,
            # and the others will use the cache.
            lock_path = cached_features_file + ".lock"
            with FileLock(lock_path):

                if os.path.exists(cached_features_file) and not overwrite_cache:
                    logger.info(f"Loading features from cached file {cached_features_file}")
                    self.features = torch.load(cached_features_file)
                else:
                    logger.info(f"Creating features from dataset file at {data_dir}")
                    examples = token_classification_task.read_examples_from_file(data_dir, mode)
                    # TODO clean up all this to leverage built-in features of tokenizers
                    self.features = token_classification_task.convert_examples_to_features(
                        examples,
                        labels,
                        max_seq_length,
                        tokenizer,
                        cls_token_at_end=bool(model_type in ["xlnet"]),
                        # xlnet has a cls token at the end
                        cls_token=tokenizer.cls_token,
                        cls_token_segment_id=2 if model_type in ["xlnet"] else 0,
                        sep_token=tokenizer.sep_token,
                        sep_token_extra=False,
                        # roberta uses an extra separator b/w pairs of sentences, cf. github.com/pytorch/fairseq/commit/1684e166e3da03f5b600dbb7855cb98ddfcd0805
                        pad_on_left=bool(tokenizer.padding_side == "left"),
                        pad_token=tokenizer.pad_token_id,
                        pad_token_segment_id=tokenizer.pad_token_type_id,
                        pad_token_label_id=self.pad_token_label_id,
                    )
                    logger.info(f"Saving features into cached file {cached_features_file}")
                    torch.save(self.features, cached_features_file)

        def __len__(self):
            return len(self.features)

        def __getitem__(self, i) -> InputFeatures:
            return self.features[i]

if is_tf_available():
    import tensorflow as tf

    class TFTokenClassificationDataset:
        """
        This will be superseded by a framework-agnostic approach
        soon.
        """

        features: List[InputFeatures]
        pad_token_label_id: int = -100
        # Use cross entropy ignore_index as padding label id so that only
        # real label ids contribute to the loss later.

        def __init__(
            self,
            token_classification_task: TokenClassificationTask,
            data_dir: str,
            tokenizer: PreTrainedTokenizer,
            labels: List[str],
            model_type: str,
            max_seq_length: Optional[int] = None,
            overwrite_cache=False,
            mode: Split = Split.train,
        ):
            examples = token_classification_task.read_examples_from_file(data_dir, mode)
            # TODO clean up all this to leverage built-in features of tokenizers
            self.features = token_classification_task.convert_examples_to_features(
                examples,
                labels,
                max_seq_length,
                tokenizer,
                cls_token_at_end=bool(model_type in ["xlnet"]),
                # xlnet has a cls token at the end
                cls_token=tokenizer.cls_token,
                cls_token_segment_id=2 if model_type in ["xlnet"] else 0,
                sep_token=tokenizer.sep_token,
                sep_token_extra=False,
                # roberta uses an extra separator b/w pairs of sentences, cf. github.com/pytorch/fairseq/commit/1684e166e3da03f5b600dbb7855cb98ddfcd0805
                pad_on_left=bool(tokenizer.padding_side == "left"),
                pad_token=tokenizer.pad_token_id,
                pad_token_segment_id=tokenizer.pad_token_type_id,
                pad_token_label_id=self.pad_token_label_id,
            )

            def gen():
                for ex in self.features:
                    if ex.token_type_ids is None:
                        yield (
                            {"input_ids": ex.input_ids, "attention_mask": ex.attention_mask},
                            ex.label_ids,
                        )
                    else:
                        yield (
                            {
                                "input_ids": ex.input_ids,
                                "attention_mask": ex.attention_mask,
                                "token_type_ids": ex.token_type_ids,
                            },
                            ex.label_ids,
                        )

            if "token_type_ids" not in tokenizer.model_input_names:
                self.dataset = tf.data.Dataset.from_generator(
                    gen,
                    ({"input_ids": tf.int32, "attention_mask": tf.int32}, tf.int64),
                    (
                        {"input_ids": tf.TensorShape([None]), "attention_mask": tf.TensorShape([None])},
                        tf.TensorShape([None]),
                    ),
                )
            else:
                self.dataset = tf.data.Dataset.from_generator(
                    gen,
                    ({"input_ids": tf.int32, "attention_mask": tf.int32, "token_type_ids": tf.int32}, tf.int64),
                    (
                        {
                            "input_ids": tf.TensorShape([None]),
                            "attention_mask": tf.TensorShape([None]),
                            "token_type_ids": tf.TensorShape([None]),
                        },
                        tf.TensorShape([None]),
                    ),
                )

        def get_dataset(self):
            self.dataset = self.dataset.apply(tf.data.experimental.assert_cardinality(len(self.features)))

            return self.dataset

        def __len__(self):
            return len(self.features)

        def __getitem__(self, i) -> InputFeatures:
            return self.features[i]


text:
Clock by merging streams

<button (click)="click$.next()">Update an hour</button> {{ clock | async | date: 'dd-MM-yyyy hh:mm:ss'}}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Behat\Behat\Tester\Result;

use Behat\Testwork\Tester\Result\TestResult;

/**
 * Extends Testwork test result with support for undefined status.
 *
 * @author Konstantin Kudryashov <ever.zet@gmail.com>
 */
interface StepResult extends TestResult
{
    const UNDEFINED = 30;
}


text:
package com.intellij.java.codeInspection;

import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.sameParameterValue.SameParameterValueInspection;
import com.intellij.testFramework.EdtTestUtil;
import com.intellij.testFramework.TestRunnerUtil;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

@RunWith(Parameterized.class)
public class SameParameterValueSlashesTest extends LightCodeInsightFixtureTestCase {

  private SameParameterValueInspection myInspection = new SameParameterValueInspection();

  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    myFixture.enableInspections(myInspection);
  }

  @Override
  @After
  public void tearDown() throws Exception {
    try {
      myFixture.disableInspections(myInspection);
    }
    catch (Throwable e) {
      addSuppressedException(e);
    }
    finally {
      myInspection = null;
      super.tearDown();
    }
  }

  @Parameterized.Parameters(name = "\\{0}")
  public static Object[] data() {
    return new Object[] { "n", "r", "b", "t", "f", "\"", "\'", "\\", "1"};
  }

  @Parameterized.Parameter
  public String symbol;

  @Test
  public void testSlashes() {
    Runnable runnable = () -> {
      String specialSymbol = "\\" + symbol;
      String ourIntentionName = "Inline value '";

      String before = "class C { " +
                      "  void test() {" +
                      "    String s = f(\"" + specialSymbol + "\");" +
                      "  }" +
                      "  String f(String <caret>p) {" +
                      "    return \"123\" + p;" +
                      "  }" +
                      "}";
      myFixture.configureByText("C.java", before);

      final IntentionAction singleIntention = myFixture.findSingleIntention(ourIntentionName);
      myFixture.launchAction(singleIntention);

      String after = "class C { " +
                     "  void test() {" +
                     "    String s = f();" +
                     "  }" +
                     "  String f() {" +
                     "    return \"123\" + \"" + specialSymbol + "\";" +
                     "  }" +
                     "}";
      myFixture.checkResult(after);
    };
    doTest(runnable);
  }

  private void doTest(Runnable runnable) {
    TestRunnerUtil.replaceIdeEventQueueSafely();
    EdtTestUtil.runInEdtAndWait(runnable::run);
  }
}


text:
//
//  KCSStore.h
//  KinveyKit
//
//  Copyright (c) 2012-2014 Kinvey, Inc. All rights reserved.
//
// This software is licensed to you under the Kinvey terms of service located at
// http://www.kinvey.com/terms-of-use. By downloading, accessing and/or using this
// software, you hereby accept such terms of service  (and any agreement referenced
// therein) and agree that you have read, understand and agree to be bound by such
// terms of service and are of legal age to agree to such terms with Kinvey.
//
// This software contains valuable confidential and proprietary information of
// KINVEY, INC and is subject to applicable licensing agreements.
// Unauthorized reproduction, transmission or distribution of this file and its
// contents is a violation of applicable laws.
//

#import <Foundation/Foundation.h>
#import "KCSBlockDefs.h"
#import "KCSQuery.h"
#import "KinveyHeaderInfo.h"
#import "KCSRequestConfiguration.h"
#import "KCSRequest.h"

// Forward decl
@class KCSAuthHandler;
@class KCSReduceFunction;
@class KCSGroup;

KCS_DEPRECATED(use [KCSQuery query] instead, 1.26.0)
@interface KCSAllObjects : KCSQuery
@end

/*! Kinvey Store Protocol

 A Kinvey Store is a representation of a group of backend items,
 stores have several operations in common to all stores:

 - Add an object/s (save* methods)
 - Update an object/s (save* methods)
 - Get an object/s (query* methods)
 - Remove an object/s (remove* methods)
 - Configure the store (configure* methods)

 Additionally, stores may have store specific methods that are documented
 in the Store itself.  You should be able to use the documentation in
 KCSStore to understand how to accomplish all basic tasks in Stores without
 needing to refer to the specific stores implementation, but you should
 refer to that implementation to maximize performance or to configure
 store specific items prior to your app's release.

 */
@protocol KCSStore <NSObject>

#pragma mark -
#pragma mark Initialization
///---------------------------------------------------------------------------------------
/// @name Initialization
///---------------------------------------------------------------------------------------

/*! Initialize an empty Kinvey Store with the default options

 This routine is called to return an empty store with default options and default authentication.

 @return An autoreleased empty store with default options and default authentication.

 */
+ (instancetype)store;

/*! Initialize an empty store with the given options and the default authentication

 This will initialize an empty store with the given options and default authentication,
 the given options dictionary should be defined by the Kinvey Store that's implementing
 the protocol.

 @param options A dictionary of options to configure the store.

 @return An autoreleased empty store with configured options and default authentication.

 */
+ (instancetype)storeWithOptions: (NSDictionary *)options;

/*! Initialize an empty store with the given options and the given authentication

 This will initialize an empty store with the given options and given authentication,
 the options dictionary should be defined by the Kinvey Store that's implementing
 the protocol.  Authentication is Kinvey Store specific, refer to specific store's
 documentation for details.

 @param options A dictionary of options to configure the store.
 @param authHandler The Kinvey Authentication Handler used to authenticate backend requests. Reserved for future use.

 @return An autoreleased empty store with configured options and given authentication.
 @deprecatedIn 1.22.0
 @deprecated Use storeWithOptions: instead
 */
+ (instancetype)storeWithAuthHandler: (KCSAuthHandler *)authHandler withOptions: (NSDictionary *)options KCS_DEPRECATED(Auth handler not used--use storeWitOptions: instead, 1.22.0);

#pragma mark -
#pragma mark Adding/Updating
///---------------------------------------------------------------------------------------
/// @name Adding/Updating
///---------------------------------------------------------------------------------------

/*! Add or update an object (or objects) in the store.

 This is the basic method to add or update objects in a Kinvey Store.  Specific stores may
 have specific requirements on objects that are added to the store.  This will result in the
 completion callback being called informing you of an error.

 @param object An object to add/update in the store (if the object is a `NSArray`, all objects will be added/updated)
 @param completionBlock A block that gets invoked when the addition/update is "complete" (as defined by the store)
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
 */
-(KCSRequest*)saveObject:(id)object
     withCompletionBlock:(KCSCompletionBlock)completionBlock
       withProgressBlock:(KCSProgressBlock)progressBlock;

/*! Add or update an object (or objects) in the store.

 This is the basic method to add or update objects in a Kinvey Store.  Specific stores may
 have specific requirements on objects that are added to the store.  This will result in the
 completion callback being called informing you of an error.

 @param object An object to add/update in the store (if the object is a `NSArray`, all objects will be added/updated)
 @param requestConfiguration defines how the client requests should be set up by default
 @param completionBlock A block that gets invoked when the addition/update is "complete" (as defined by the store)
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
 */
-(KCSRequest*)saveObject:(id)object
    requestConfiguration:(KCSRequestConfiguration*)requestConfiguration
     withCompletionBlock:(KCSCompletionBlock)completionBlock
       withProgressBlock:(KCSProgressBlock)progressBlock;

#pragma mark - Querying/Fetching
///---------------------------------------------------------------------------------------
/// @name Querying/Fetching
///---------------------------------------------------------------------------------------

/*! Query or fetch an object (or objects) in the store.

 This method takes a query object and calls the store to provide an array of objects that satisfies the query.

 @param query A query to act on a store.  The store defines the type of queries it accepts, an object of type `[KCSQuery query]` causes all objects to be returned.
 @param completionBlock A block that gets invoked when the query/fetch is "complete" (as defined by the store)
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
*/
-(KCSRequest*)queryWithQuery:(id)query
         withCompletionBlock:(KCSCompletionBlock)completionBlock
           withProgressBlock:(KCSProgressBlock)progressBlock;

/*! Query or fetch an object (or objects) in the store.

 This method takes a query object and calls the store to provide an array of objects that satisfies the query.

 @param query A query to act on a store.  The store defines the type of queries it accepts, an object of type `[KCSQuery query]` causes all objects to be returned.
 @param requestConfiguration defines how the client requests should be set up by default
 @param completionBlock A block that gets invoked when the query/fetch is "complete" (as defined by the store)
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
 */
-(KCSRequest*)queryWithQuery:(id)query
        requestConfiguration:(KCSRequestConfiguration*)requestConfiguration
         withCompletionBlock:(KCSCompletionBlock)completionBlock
           withProgressBlock:(KCSProgressBlock)progressBlock;

#pragma mark - Removing
///---------------------------------------------------------------------------------------
/// @name Removing
///---------------------------------------------------------------------------------------

/*! Remove an object (or objects) from the store.

 @param object An object (or query) to remove from the store (if the object is a NSArray or query, matching objects will be removed)
 @param completionBlock A block that gets invoked when the remove is "complete" (as defined by the store). Count is the number of items deleted, if any.
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @updated 1.24.0 completion block is now a count block instead of an object block
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
 */
-(KCSRequest*)removeObject:(id)object
       withCompletionBlock:(KCSCountBlock)completionBlock
         withProgressBlock:(KCSProgressBlock)progressBlock;

/*! Remove an object (or objects) from the store.

 @param object An object (or query) to remove from the store (if the object is a NSArray or query, matching objects will be removed)
 @param requestConfiguration defines how the client requests should be set up by default
 @param completionBlock A block that gets invoked when the remove is "complete" (as defined by the store). Count is the number of items deleted, if any.
 @param progressBlock A block that is invoked whenever the store can offer an update on the progress of the operation.
 @updated 1.24.0 completion block is now a count block instead of an object block
 @return KCSRequest object that represents the pending request made against the store. Since version 1.36.0
 */
-(KCSRequest*)removeObject:(id)object
      requestConfiguration:(KCSRequestConfiguration*)requestConfiguration
       withCompletionBlock:(KCSCountBlock)completionBlock
         withProgressBlock:(KCSProgressBlock)progressBlock;

#pragma mark -
#pragma mark Configuring
///---------------------------------------------------------------------------------------
/// @name Configuring
///---------------------------------------------------------------------------------------

/*! This is the general configuration routine for a Kinvey Store

 This routine is used to pass a Store specific options dictionary to the store
 allow the user to configure store specific items in a way that's compatible with multiple
 stores.

 All stores are expected to handle the following options (however they're allowed to interpret
 the values in a store specific manner):

 - backend -- The backend represented by this store
 - debug   -- Should debugging be enabled for this store

 @param options A dictionary containing store specific options, see store documentation for details

 @return A BOOL value indicating whether the options were accepted by the store.

 */
- (BOOL)configureWithOptions: (NSDictionary *)options;

#pragma mark -
#pragma mark Authentication
///---------------------------------------------------------------------------------------
/// @name Authentication
///---------------------------------------------------------------------------------------

/*! Set the Kinvey Auth Handler for this store

 This method is used to control how the store authenticates with the backend.

 @param handler The Kinvey Auth Handler to be used during requests.
 @deprecatedIn 1.22.0
 */
- (void)setAuthHandler: (KCSAuthHandler *)handler KCS_DEPRECATED(Auth handler not used, 1.22.0);
;

/*! Get the currently set Kinvey Auth Handler for this Store

 This method is used to find the currently set Kinvey Auth Handler for this Store.

 @return The currently set Kinvey Auth Handler.
 @deprecatedIn 1.22.0
 */
- (KCSAuthHandler *)authHandler KCS_DEPRECATED(Auth handler not used, 1.22.0);

@end


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = listMetrics;
function listMetrics(utapiRequest, data, cb) {
    return cb(null, data);
}


text:
require 'spec_helper'

module TinyMCE
  describe Rails do
    describe ".configuration" do
      after(:each) do
        TinyMCE::Rails.configuration = nil
        ::Rails.application.config.tinymce.config_path = nil
      end

      let(:configuration_file) { double(:configuration => configuration) }
      let(:configuration) { double }

      it "loads the tinymce.yml config file" do
        path = ::Rails.root.join("config/tinymce.yml")
        expect(TinyMCE::Rails::ConfigurationFile).to receive(:new).with(path).and_return(configuration_file)
        expect(TinyMCE::Rails.configuration).to eq(configuration)
      end

      it "loads a custom config file if config.tinymce.config is set" do
        path = ::Rails.root.join("config/tinymce-custom.yml")
        ::Rails.application.config.tinymce.config_path = path

        expect(TinyMCE::Rails::ConfigurationFile).to receive(:new).with(path).and_return(configuration_file)
        expect(TinyMCE::Rails.configuration).to eq(configuration)
      end
    end
  end
end


text:
require 'spec_helper'

module AWS

  shared_examples_for "sdb expect conditions" do

    context ':if' do

      it 'accepts a hash with a string key' do
        should_expect(:name => 'version',
                      :value => '1')
        do_with_condition(:if => { 'version' => '1' })
      end

      it 'accepts a hash with a symbol key' do
        should_expect(:name => 'version',
                      :value => '1')
        do_with_condition(:if => { :version => '1' })
      end

    end

    context ':unless' do

      it 'accepts an attribute name as a string' do
        should_expect(:name => 'immutable',
                      :exists => false)
        do_with_condition(:unless => 'immutable')
      end

      it 'accepts a symbol attribute name' do
        should_expect(:name => 'immutable',
                      :exists => false)
        do_with_condition(:unless => :immutable)
      end

    end

  end

end


text:
require 'bundler/setup'
require 'serializer'
require 'mocha/api'

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.mock_with :mocha
  config.order = 'random'
end


text:
import * as mobx from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { GetUser } from './GetUser';
import { Search } from './Search';

@observer
export class App extends React.Component {
  @mobx.observable error: string | null = null;
  @mobx.observable userName: string | null = null;
  @mobx.observable value?: string;

  @mobx.action
  handleSubmit = (userName: string) => {
    this.userName = userName;
    this.error = null;
  };

  @mobx.action
  handleError = (error: string) => {
    this.error = error;
  };

  render() {
    if (this.userName && !this.error) {
      return <GetUser userName={this.userName} onError={this.handleError} />;
    } else {
      return <Search onSubmit={this.handleSubmit} showError={this.error} />;
    }
  }
}


text:
import {Component, Input, SimpleChanges, Output, EventEmitter} from '@angular/core';
import {BaseComponent} from '../../base-component/base-component';
import {FileUtils} from '../../common/file.utils';
import {UploadSongMetadataDTO} from '../../model/music/upload.song.metadata.dto';
import {MusicService} from '../../service/music-service/music.service';
import {MusicArtistsDTO} from '../../model/music/music.artist.dto';
import {Observable} from 'rxjs';
import {MusicAlbumDTO} from '../../model/music/music.album.dto';
import {MusicGenreDTO} from '../../model/music/music.genre.dto';
import {MetadataFileItem} from '../../common/metadata.file.item';
import {TypeaheadMatch} from 'ngx-bootstrap/typeahead/typeahead-match.class';
import {SongDTO} from '../../model/music/song.dto';

@Component({
  selector: 'app-edit-music-metadata',
  templateUrl: './edit-music-metadata.component.html',
  styleUrls: ['./edit-music-metadata.component.css']
})
export class EditMusicMetadataComponent extends BaseComponent {

  @Input() item: MetadataFileItem;
  public musicMetadata: UploadSongMetadataDTO;

  @Output() hide = new EventEmitter<boolean>();

  public typeaheadLoading: boolean = false;

  private artistsTypeaheadList: Observable<MusicArtistsDTO[]>;
  private albumsTypeaheadList: Observable<MusicAlbumDTO[]>;
  private genresTypeaheadList: Observable<MusicGenreDTO[]>;

  private isAuthorsValid: boolean = true;

  public overStar: number;
  public percent: number;
  public rate: number;
  public maxRate: number = 10;

  @Input() isVisible: boolean = true;
  @Input() isEdit: boolean = false;

  constructor(private musicService: MusicService) {
    super();
    this.musicMetadata = new UploadSongMetadataDTO();
    this.percent = 0;
  }

  ngOnInit() {
  }

  public ngOnChanges(changes: SimpleChanges): void {
    let change = changes['item'];
    if (change == null) {
      return;
    }
    let current = change.currentValue;
    let previous = change.previousValue;
    if (current !== previous) {
      this.prepareForm();
      this.prepareMusicMetadata();
    }
  }

  private prepareForm(): void {
    if (this.item == null) {
      return;
    }
    if (this.item.metadata != null && this.item.metadata.isValid()) {
      this.musicMetadata = <UploadSongMetadataDTO>this.item.metadata;
      return;
    }
    this.musicMetadata = new UploadSongMetadataDTO();
  }

  private prepareMusicMetadata(): void {
    let isValid: boolean = this.musicMetadata.isValid();
    if (isValid) {
      return;
    }
    this.musicMetadata._song._fileMetadata._fileName = FileUtils.getFileName(this.item);
    this.musicMetadata._song._fileMetadata._extension = FileUtils.getExtension(this.item);
    this.musicMetadata._song._fileMetadata._fileSize = FileUtils.getFileSize(this.item);
    this.musicMetadata._song._fileMetadata._creationDate = FileUtils.getFileCreationDate(this.item);
    if (this.musicMetadata._song._fileMetadata._creationDate == null) {
      this.musicMetadata._song._fileMetadata._creationDate = new Date();
    }
    this.musicMetadata._song._title = FileUtils.getFileName(this.item);
    this.musicMetadata._song._productionYear = new Date().getFullYear();
  }

  public changeTypeaheadLoading(e: boolean): void {
    this.typeaheadLoading = e;
  }

  public onAddMusicAuthor(): void {
    let artist: MusicArtistsDTO = new MusicArtistsDTO();
    this.musicMetadata._song._authors.push(artist);
  }

  public onRemoveMusicAuthor(): void {
    this.musicMetadata._song._authors.pop();
    if (this.musicMetadata._song._authors.length <= 0) {
      this.isAuthorsValid = true;
    }
  }

  public onMusicAuthorInput(index: number): void {
    this.artistsTypeaheadList = new Observable<MusicArtistsDTO[]>((observer: any) => {
      observer.next(this.musicMetadata._song._authors[index]._name);
      observer.next(this.musicMetadata._song._authors[index]._name2);
      observer.next(this.musicMetadata._song._authors[index]._surname);
    }).mergeMap(() => this.getAristsPredictionList(index));
  }

  private getAristsPredictionList(index: number): Observable<MusicArtistsDTO[]> {
    let author = this.musicMetadata._song._authors[index];
    return this.musicService.getAristsPredictionList(author._name, author._name2, author._surname);
  }

  public onMusicAlbumInput(): void {
    this.albumsTypeaheadList = new Observable<MusicAlbumDTO[]>((observer: any) => {
      observer.next(this.musicMetadata._song._album._albumTitle);
    }).mergeMap(() => this.getAlbumsPredictionList());
  }

  private getAlbumsPredictionList(): Observable<MusicAlbumDTO[]> {
    return this.musicService.getAlbumsPredictionList(this.musicMetadata._song._album._albumTitle,
      this.musicMetadata._song._title);
  }

  public onMusicGenreInput(): void {
    this.genresTypeaheadList = new Observable<MusicGenreDTO[]>((observer: any) => {
      observer.next(this.musicMetadata._song._genre._name);
    }).mergeMap(() => this.getGenresPredictionList());
  }

  private getGenresPredictionList(): Observable<MusicGenreDTO[]> {
    return this.musicService.getGenresPredictionList(this.musicMetadata._song._genre._name);
  }

  public onSave() {
    if (!this.isEdit) {
      this.musicMetadata._song._rating = this.percent;
      this.musicMetadata._song._ratingTimes = 1;
      this.musicMetadata._userName = localStorage.getItem('username');
      this.item.metadata = this.musicMetadata;
    } else {
      let rating: number = this.musicMetadata._song._rating;
      let times: number = this.musicMetadata._song._ratingTimes;
      let result: number = rating * times + this.percent;
      result = result / (times + 1);
      this.musicMetadata._song._rating = result;
      this.musicMetadata._song._ratingTimes = times + 1;
    }
    this.hide.emit(true);
  }

  public checkAuthorsValidation(): void {
    if (this.musicMetadata._song._authors == null) {
      this.isAuthorsValid = true;
      return;
    }
    if (this.musicMetadata._song._authors.length <= 0) {
      this.isAuthorsValid = true;
      return;
    }
    let itemIsValid: boolean = true;
    this.musicMetadata._song._authors.forEach((item: MusicArtistsDTO) => {
      if (item._name == null || item._name.length <= 0) {
        itemIsValid = false;
        return;
      }
      if (item._surname == null || item._surname.length <= 0) {
        itemIsValid = false;
        return;
      }
    });
    this.isAuthorsValid = itemIsValid;
  }

  public onTypeaheadAuthorSelect(match: TypeaheadMatch, index: number): void {
    this.musicMetadata._song._authors[index] = <MusicArtistsDTO>match.item;
    this.checkAuthorsValidation();
  }

  public onTypeaheadAlbumSelect(match: TypeaheadMatch): void {
    this.musicMetadata._song._album = <MusicAlbumDTO>match.item;
  }

  public onTypeaheadGenreSelect(match: TypeaheadMatch): void {
    this.musicMetadata._song._genre = <MusicGenreDTO>match.item;
  }

  public hoveringOver(value: number): void {
    this.overStar = value;
    this.percent = 100 * (value / 10);
  };

  public resetStar(): void {
    this.overStar = void 0;
  }

  public setMetadata(item: UploadSongMetadataDTO): void {
    this.musicMetadata = item;
    this.setRate();
  }

  public getMetadata(): SongDTO {
    return this.musicMetadata._song;
  }

  public setRate(): void {
    this.rate = this.musicMetadata._song._rating / 10;
  }

}


text:
#include "vulkanCore.h"
#include "util/gvr_log.h"
#include <assert.h>
#include <cstring>

VulkanCore* VulkanCore::theInstance = NULL;

bool VulkanCore::CreateInstance(){
    VkResult ret = VK_SUCCESS;

    // Discover the number of extensions listed in the instance properties in order to allocate
    // a buffer large enough to hold them.
    uint32_t instanceExtensionCount = 0;
    ret = vkEnumerateInstanceExtensionProperties(nullptr, &instanceExtensionCount, nullptr);
    GVR_VK_CHECK(!ret);

    VkBool32 surfaceExtFound = 0;
    VkBool32 platformSurfaceExtFound = 0;
    VkExtensionProperties* instanceExtensions = nullptr;
    instanceExtensions = new VkExtensionProperties[instanceExtensionCount];

    // Now request instanceExtensionCount VkExtensionProperties elements be read into out buffer
    ret = vkEnumerateInstanceExtensionProperties(nullptr, &instanceExtensionCount, instanceExtensions);
    GVR_VK_CHECK(!ret);

    // We require two extensions, VK_KHR_surface and VK_KHR_android_surface. If they are found,
    // add them to the extensionNames list that we'll use to initialize our instance with later.
    uint32_t enabledExtensionCount = 0;
    const char* extensionNames[16];
    for (uint32_t i = 0; i < instanceExtensionCount; i++) {
        if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, instanceExtensions[i].extensionName)) {
            surfaceExtFound = 1;
            extensionNames[enabledExtensionCount++] = VK_KHR_SURFACE_EXTENSION_NAME;
        }

        if (!strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, instanceExtensions[i].extensionName)) {
            platformSurfaceExtFound = 1;
            extensionNames[enabledExtensionCount++] = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
        }
        GVR_VK_CHECK(enabledExtensionCount < 16);
    }
    if (!surfaceExtFound) {
        LOGE("vkEnumerateInstanceExtensionProperties failed to find the " VK_KHR_SURFACE_EXTENSION_NAME" extension.");
        return false;
    }
    if (!platformSurfaceExtFound) {
        LOGE("vkEnumerateInstanceExtensionProperties failed to find the " VK_KHR_ANDROID_SURFACE_EXTENSION_NAME" extension.");
        return false;
    }

    // We specify the Vulkan version our application was built with,
    // as well as names and versions for our application and engine,
    // if applicable. This allows the driver to gain insight to what
    // is utilizing the vulkan driver, and serve appropriate versions.
    VkApplicationInfo applicationInfo = {};
    applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
    applicationInfo.pNext = nullptr;
    applicationInfo.pApplicationName = GVR_VK_SAMPLE_NAME;
    applicationInfo.applicationVersion = 0;
    applicationInfo.pEngineName = "VkSample";
    applicationInfo.engineVersion = 1;
    applicationInfo.apiVersion = VK_API_VERSION_1_0;

    // Creation information for the instance points to details about
    // the application, and also the list of extensions to enable.
    VkInstanceCreateInfo instanceCreateInfo = {};
    instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
    instanceCreateInfo.pNext = nullptr;
    instanceCreateInfo.pApplicationInfo = &applicationInfo;
    instanceCreateInfo.enabledLayerCount = 0;
    instanceCreateInfo.ppEnabledLayerNames = nullptr;
    instanceCreateInfo.enabledExtensionCount = enabledExtensionCount;
    instanceCreateInfo.ppEnabledExtensionNames = extensionNames;

    // The main Vulkan instance is created with the creation infos above.
    // We do not specify a custom memory allocator for instance creation.
    ret = vkCreateInstance(&instanceCreateInfo, nullptr, &(m_instance));

    // we can delete the list of extensions after calling vkCreateInstance
    delete[] instanceExtensions;

    // Vulkan API return values can expose further information on a failure.
    // For instance, INCOMPATIBLE_DRIVER may be returned if the API level
    // an application is built with, exposed through VkApplicationInfo, is
    // newer than the driver present on a device.
    if (ret == VK_ERROR_INCOMPATIBLE_DRIVER) {
        LOGE("Cannot find a compatible Vulkan installable client driver: vkCreateInstance Failure");
        return false;
    } else if (ret == VK_ERROR_EXTENSION_NOT_PRESENT) {
        LOGE("Cannot find a specified extension library: vkCreateInstance Failure");
        return false;
    } else {
        GVR_VK_CHECK(!ret);
    }

    return true;
}

bool VulkanCore::GetPhysicalDevices(){
    VkResult ret = VK_SUCCESS;

    // Query number of physical devices available
    ret = vkEnumeratePhysicalDevices(m_instance, &(m_physicalDeviceCount), nullptr);
    GVR_VK_CHECK(!ret);

    if (m_physicalDeviceCount == 0)
    {
        LOGE("No physical devices detected.");
        return false;
    }

    // Allocate space the the correct number of devices, before requesting their data
    m_pPhysicalDevices = new VkPhysicalDevice[m_physicalDeviceCount];
    ret = vkEnumeratePhysicalDevices(m_instance, &(m_physicalDeviceCount), m_pPhysicalDevices);
    GVR_VK_CHECK(!ret);

    // For purposes of this sample, we simply use the first device.
    m_physicalDevice = m_pPhysicalDevices[0];

    // By querying the device properties, we learn the device name, amongst
    // other details.
    vkGetPhysicalDeviceProperties(m_physicalDevice, &(m_physicalDeviceProperties));

    LOGI("Vulkan Device: %s", m_physicalDeviceProperties.deviceName);

    // Get Memory information and properties - this is required later, when we begin
    // allocating buffers to store data.
    vkGetPhysicalDeviceMemoryProperties(m_physicalDevice, &(m_physicalDeviceMemoryProperties));

    return true;
}

void VulkanCore::InitDevice() {
    VkResult ret = VK_SUCCESS;
    // Akin to when creating the instance, we can query extensions supported by the physical device
    // that we have selected to use.
    uint32_t deviceExtensionCount = 0;
    VkExtensionProperties *device_extensions = nullptr;
    ret = vkEnumerateDeviceExtensionProperties(m_physicalDevice, nullptr, &deviceExtensionCount, nullptr);
    GVR_VK_CHECK(!ret);

    VkBool32 swapchainExtFound = 0;
    VkExtensionProperties* deviceExtensions = new VkExtensionProperties[deviceExtensionCount];
    ret = vkEnumerateDeviceExtensionProperties(m_physicalDevice, nullptr, &deviceExtensionCount, deviceExtensions);
    GVR_VK_CHECK(!ret);

    // For our example, we require the swapchain extension, which is used to present backbuffers efficiently
    // to the users screen.
    uint32_t enabledExtensionCount = 0;
    const char* extensionNames[16] = {0};
    for (uint32_t i = 0; i < deviceExtensionCount; i++) {
        if (!strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME, deviceExtensions[i].extensionName)) {
            swapchainExtFound = 1;
            extensionNames[enabledExtensionCount++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
        }
        GVR_VK_CHECK(enabledExtensionCount < 16);
    }
    if (!swapchainExtFound) {
        LOGE("vkEnumerateDeviceExtensionProperties failed to find the " VK_KHR_SWAPCHAIN_EXTENSION_NAME " extension: vkCreateInstance Failure");

        // Always attempt to enable the swapchain
        extensionNames[enabledExtensionCount++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
    }

    //InitSurface();

    // Before we create our main Vulkan device, we must ensure our physical device
    // has queue families which can perform the actions we require. For this, we request
    // the number of queue families, and their properties.
    uint32_t queueFamilyCount = 0;
    vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &queueFamilyCount, nullptr);

    VkQueueFamilyProperties* queueProperties = new VkQueueFamilyProperties[queueFamilyCount];
    vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &queueFamilyCount, queueProperties);
    GVR_VK_CHECK(queueFamilyCount >= 1);

    // We query each queue family in turn for the ability to support the android surface
    // that was created earlier. We need the device to be able to present its images to
    // this surface, so it is important to test for this.
    VkBool32* supportsPresent = new VkBool32[queueFamilyCount];
    for (uint32_t i = 0; i < queueFamilyCount; i++) {
        vkGetPhysicalDeviceSurfaceSupportKHR(m_physicalDevice, i,  m_surface, &supportsPresent[i]);
    }

    // Search for a graphics queue, and ensure it also supports our surface. We want a
    // queue which can be used for both, as to simplify operations.
    uint32_t queueIndex = queueFamilyCount + 1;
    for (uint32_t i = 0; i < queueFamilyCount; i++) {
        if ((queueProperties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) {
            if (supportsPresent[i] == VK_TRUE) {
                queueIndex = i;
                break;
            }
        }
    }

    delete [] supportsPresent;
    delete [] queueProperties;

    if (queueIndex == (queueFamilyCount + 1)) {
        GVR_VK_CHECK("Could not obtain a queue family for both graphics and presentation." && 0);
    }

    // We have identified a queue family which both supports our android surface,
    // and can be used for graphics operations.
    m_queueFamilyIndex = queueIndex;

    // As we create the device, we state we will be creating a queue of the
    // family type required. 1.0 is the highest priority and we use that.
    float queuePriorities[1] = { 1.0 };
    VkDeviceQueueCreateInfo deviceQueueCreateInfo = {};
    deviceQueueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
    deviceQueueCreateInfo.pNext = nullptr;
    deviceQueueCreateInfo.queueFamilyIndex = m_queueFamilyIndex;
    deviceQueueCreateInfo.queueCount = 1;
    deviceQueueCreateInfo.pQueuePriorities = queuePriorities;

    // Now we pass the queue create info, as well as our requested extensions,
    // into our DeviceCreateInfo structure.
    VkDeviceCreateInfo deviceCreateInfo = {};
    deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
    deviceCreateInfo.pNext = nullptr;
    deviceCreateInfo.queueCreateInfoCount = 1;
    deviceCreateInfo.pQueueCreateInfos = &deviceQueueCreateInfo;
    deviceCreateInfo.enabledLayerCount = 0;
    deviceCreateInfo.ppEnabledLayerNames = nullptr;
    deviceCreateInfo.enabledExtensionCount = enabledExtensionCount;
    deviceCreateInfo.ppEnabledExtensionNames = extensionNames;

    // Create the device.
    ret = vkCreateDevice(m_physicalDevice, &deviceCreateInfo, nullptr, &m_device);
    GVR_VK_CHECK(!ret);

    // Obtain the device queue that we requested.
    vkGetDeviceQueue(m_device, m_queueFamilyIndex, 0, &m_queue);
}

void VulkanCore::InitSwapchain(uint32_t width, uint32_t height){
    VkResult ret = VK_SUCCESS;

    m_width = width;// 320;//surfaceCapabilities.currentExtent.width;
    m_height = height;//240;//surfaceCapabilities.currentExtent.height;

    VkImageCreateInfo imageCreateInfo = {};
    imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
    imageCreateInfo.pNext = nullptr;
    imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
    imageCreateInfo.format = VK_FORMAT_R8G8B8A8_UINT;//VK_FORMAT_R8G8B8A8_UNORM;//m_surfaceFormat.format;//VK_FORMAT_R32G32B32A32_SFLOAT;
    imageCreateInfo.extent = {m_width, m_height, 1};
    imageCreateInfo .mipLevels = 1;
    imageCreateInfo .arrayLayers = 1;
    imageCreateInfo .samples = VK_SAMPLE_COUNT_1_BIT;
    imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;
    imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT  | VK_IMAGE_USAGE_TRANSFER_SRC_BIT ;
    imageCreateInfo .flags = 0;
    imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;

    //LOGI("Vulkan Format %d ", m_surfaceFormat.format);
    // Create the image with details as imageCreateInfo
    m_swapchainImageCount = 2;
    m_swapchainBuffers = new GVR_VK_SwapchainBuffer[m_swapchainImageCount];
    GVR_VK_CHECK(m_swapchainBuffers);

    for(int i = 0; i < m_swapchainImageCount; i++) {
        VkMemoryRequirements mem_reqs;
        VkResult  err;
        bool  pass;

        ret = vkCreateImage(m_device, &imageCreateInfo, nullptr, &m_swapchainBuffers[i].image);
        GVR_VK_CHECK(!ret);

        // discover what memory requirements are for this image.
        vkGetImageMemoryRequirements(m_device, m_swapchainBuffers[i].image, &mem_reqs);
        //LOGD("Vulkan image memreq %d", mem_reqs.size);
        m_swapchainBuffers[i].size = mem_reqs.size;

        // Allocate memory according to requirements
        VkMemoryAllocateInfo memoryAllocateInfo = {};
        memoryAllocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
        memoryAllocateInfo.pNext = nullptr;
        memoryAllocateInfo.allocationSize = 0;
        memoryAllocateInfo.memoryTypeIndex = 0;
        memoryAllocateInfo.allocationSize = mem_reqs.size;
        pass = GetMemoryTypeFromProperties(mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &memoryAllocateInfo.memoryTypeIndex);
        GVR_VK_CHECK(pass);

        err = vkAllocateMemory(m_device, &memoryAllocateInfo, nullptr, &m_swapchainBuffers[i].mem);
        GVR_VK_CHECK(!err);

        // Bind memory to the image
        err = vkBindImageMemory(m_device, m_swapchainBuffers[i].image, m_swapchainBuffers[i].mem, 0);
        GVR_VK_CHECK(!err);

        VkImageViewCreateInfo imageViewCreateInfo = {};
        imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
        imageViewCreateInfo.pNext = nullptr;
        imageViewCreateInfo.format = VK_FORMAT_R8G8B8A8_UINT;//VK_FORMAT_R8G8B8A8_UNORM;//m_surfaceFormat.format;
        imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_R;
        imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_G;
        imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_B;
        imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_A;
        imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
        imageViewCreateInfo.subresourceRange.baseMipLevel = 0;
        imageViewCreateInfo.subresourceRange.levelCount = 1;
        imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
        imageViewCreateInfo.subresourceRange.layerCount = 1;
        imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
        imageViewCreateInfo.flags = 0;
        imageViewCreateInfo.image = m_swapchainBuffers[i].image;

        err = vkCreateImageView(m_device, &imageViewCreateInfo, nullptr, &m_swapchainBuffers[i].view);
        GVR_VK_CHECK(!err);

    }

    m_depthBuffers = new GVR_VK_DepthBuffer[m_swapchainImageCount];
    for (int i = 0; i < m_swapchainImageCount; i++) {
        const VkFormat depthFormat = VK_FORMAT_D16_UNORM;

        VkImageCreateInfo imageCreateInfo = {};
        imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
        imageCreateInfo.pNext = nullptr;
        imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
        imageCreateInfo.format = depthFormat;
        imageCreateInfo.extent = {m_width, m_height, 1};
        imageCreateInfo .mipLevels = 1;
        imageCreateInfo .arrayLayers = 1;
        imageCreateInfo .samples = VK_SAMPLE_COUNT_1_BIT;
        imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
        imageCreateInfo.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
        imageCreateInfo .flags = 0;

        VkImageViewCreateInfo imageViewCreateInfo = {};
        imageViewCreateInfo .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
        imageViewCreateInfo .pNext = nullptr;
        imageViewCreateInfo .image = VK_NULL_HANDLE;
        imageViewCreateInfo.format = depthFormat;
        imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
        imageViewCreateInfo.subresourceRange.baseMipLevel = 0;
        imageViewCreateInfo.subresourceRange.levelCount = 1;
        imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
        imageViewCreateInfo.subresourceRange.layerCount = 1;
        imageViewCreateInfo.flags = 0;
        imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;

        VkMemoryRequirements mem_reqs;
        VkResult  err;
        bool  pass;

        m_depthBuffers[i].format = depthFormat;

        // Create the image with details as imageCreateInfo
        err = vkCreateImage(m_device, &imageCreateInfo, nullptr, &m_depthBuffers[i].image);
        GVR_VK_CHECK(!err);

        // discover what memory requirements are for this image.
        vkGetImageMemoryRequirements(m_device, m_depthBuffers[i].image, &mem_reqs);

        // Allocate memory according to requirements
        VkMemoryAllocateInfo memoryAllocateInfo = {};
        memoryAllocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
        memoryAllocateInfo.pNext = nullptr;
        memoryAllocateInfo.allocationSize = 0;
        memoryAllocateInfo.memoryTypeIndex = 0;
        memoryAllocateInfo.allocationSize = mem_reqs.size;
        pass = GetMemoryTypeFromProperties(mem_reqs.memoryTypeBits, 0, &memoryAllocateInfo.memoryTypeIndex);
        GVR_VK_CHECK(pass);

        err = vkAllocateMemory(m_device, &memoryAllocateInfo, nullptr, &m_depthBuffers[i].mem);
        GVR_VK_CHECK(!err);

        // Bind memory to the image
        err = vkBindImageMemory(m_device, m_depthBuffers[i].image, m_depthBuffers[i].mem, 0);
        GVR_VK_CHECK(!err);

        // Create the view for this image
        imageViewCreateInfo.image = m_depthBuffers[i].image;
        err = vkCreateImageView(m_device, &imageViewCreateInfo, nullptr, &m_depthBuffers[i].view);
        GVR_VK_CHECK(!err);
    }
}

bool VulkanCore::GetMemoryTypeFromProperties( uint32_t typeBits, VkFlags requirements_mask, uint32_t* typeIndex)
{
    GVR_VK_CHECK(typeIndex != nullptr);
    // Search memtypes to find first index with those properties
    for (uint32_t i = 0; i < 32; i++) {
        if ((typeBits & 1) == 1) {
            // Type is available, does it match user properties?
            if ((m_physicalDeviceMemoryProperties.memoryTypes[i].propertyFlags &
                 requirements_mask) == requirements_mask) {
                *typeIndex = i;
                return true;
            }
        }
        typeBits >>= 1;
    }
    // No memory types matched, return failure
    return false;
}

void VulkanCore::InitCommandbuffers(){
    VkResult ret = VK_SUCCESS;
    // Command buffers are allocated from a pool; we define that pool here and create it.
    VkCommandPoolCreateInfo commandPoolCreateInfo = {};
    commandPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
    commandPoolCreateInfo.pNext = nullptr;
    commandPoolCreateInfo.queueFamilyIndex = m_queueFamilyIndex;
    commandPoolCreateInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;

    ret = vkCreateCommandPool(m_device, &commandPoolCreateInfo, nullptr, &m_commandPool);
    GVR_VK_CHECK(!ret);

    VkCommandBufferAllocateInfo commandBufferAllocateInfo = {};
    commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
    commandBufferAllocateInfo.pNext = nullptr;
    commandBufferAllocateInfo.commandPool = m_commandPool;
    commandBufferAllocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
    commandBufferAllocateInfo.commandBufferCount = 1;

    // Create render command buffers, one per swapchain image
    for (int i=0; i < m_swapchainImageCount; i++)
    {
        ret = vkAllocateCommandBuffers(m_device, &commandBufferAllocateInfo, &m_swapchainBuffers[i].cmdBuffer);
        GVR_VK_CHECK(!ret);
    }
}

void VulkanCore::InitVertexBuffers(){
    // Our vertex buffer data is a simple triangle, with associated vertex colors.
    const float vb[3][7] = {
            //      position                   color
            { -0.9f, -0.9f,  0.9f,     1.0f, 0.0f, 0.0f, 1.0f },
            {  0.9f, -0.9f,  0.9f,     1.0f, 0.0f, 0.0f, 1.0f },
            {  0.0f,  0.9f,  0.9f,     1.0f, 0.0f, 0.0f, 1.0f },
    };

    VkResult   err;
    bool   pass;

    // Our m_vertices member contains the types required for storing
    // and defining our vertex buffer within the graphics pipeline.
    memset(&m_vertices, 0, sizeof(m_vertices));

    // Create our buffer object.
    VkBufferCreateInfo bufferCreateInfo = {};
    bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
    bufferCreateInfo.pNext = nullptr;
    bufferCreateInfo.size = sizeof(vb);
    bufferCreateInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
    bufferCreateInfo.flags = 0;
    err = vkCreateBuffer(m_device, &bufferCreateInfo, nullptr, &m_vertices.buf);
    GVR_VK_CHECK(!err);

    // Obtain the memory requirements for this buffer.
    VkMemoryRequirements mem_reqs;
    vkGetBufferMemoryRequirements(m_device, m_vertices.buf, &mem_reqs);
    GVR_VK_CHECK(!err);

    // And allocate memory according to those requirements.
    VkMemoryAllocateInfo memoryAllocateInfo = {};
    memoryAllocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
    memoryAllocateInfo.pNext = nullptr;
    memoryAllocateInfo.allocationSize = 0;
    memoryAllocateInfo.memoryTypeIndex = 0;
    memoryAllocateInfo.allocationSize  = mem_reqs.size;
    pass = GetMemoryTypeFromProperties(mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &memoryAllocateInfo.memoryTypeIndex);
    GVR_VK_CHECK(pass);

    err = vkAllocateMemory(m_device, &memoryAllocateInfo, nullptr, &m_vertices.mem);
    GVR_VK_CHECK(!err);

    // Now we need to map the memory of this new allocation so the CPU can edit it.
    void *data;
    err = vkMapMemory(m_device, m_vertices.mem, 0, memoryAllocateInfo.allocationSize, 0, &data);
    GVR_VK_CHECK(!err);

    // Copy our triangle verticies and colors into the mapped memory area.
    memcpy(data, vb, sizeof(vb));

    // Unmap the memory back from the CPU.
    vkUnmapMemory(m_device, m_vertices.mem);

    // Bind our buffer to the memory.
    err = vkBindBufferMemory(m_device, m_vertices.buf, m_vertices.mem, 0);
    GVR_VK_CHECK(!err);

    // The vertices need to be defined so that the pipeline understands how the
    // data is laid out. This is done by providing a VkPipelineVertexInputStateCreateInfo
    // structure with the correct information.
    m_vertices.vi.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
    m_vertices.vi.pNext = nullptr;
    m_vertices.vi.vertexBindingDescriptionCount = 1;
    m_vertices.vi.pVertexBindingDescriptions = m_vertices.vi_bindings;
    m_vertices.vi.vertexAttributeDescriptionCount = 2;
    m_vertices.vi.pVertexAttributeDescriptions = m_vertices.vi_attrs;

    // We bind the buffer as a whole, using the correct buffer ID.
    // This defines the stride for each element of the vertex array.
    m_vertices.vi_bindings[0].binding = GVR_VK_VERTEX_BUFFER_BIND_ID;
    m_vertices.vi_bindings[0].stride = sizeof(vb[0]);
    m_vertices.vi_bindings[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;

    // Within each element, we define the attributes. At location 0,
    // the vertex positions, in float3 format, with offset 0 as they are
    // first in the array structure.
    m_vertices.vi_attrs[0].binding = GVR_VK_VERTEX_BUFFER_BIND_ID;
    m_vertices.vi_attrs[0].location = 0;
    m_vertices.vi_attrs[0].format = VK_FORMAT_R32G32B32_SFLOAT; //float3
    m_vertices.vi_attrs[0].offset = 0;

    // The second location is the vertex colors, in RGBA float4 format.
    // These appear in each element in memory after the float3 vertex
    // positions, so the offset is set accordingly.
    m_vertices.vi_attrs[1].binding = GVR_VK_VERTEX_BUFFER_BIND_ID;
    m_vertices.vi_attrs[1].location = 1;
    m_vertices.vi_attrs[1].format = VK_FORMAT_R32G32B32A32_SFLOAT; //float4
    m_vertices.vi_attrs[1].offset = sizeof(float) * 3;
}

void VulkanCore::InitLayouts(){
    VkResult ret = VK_SUCCESS;
    // This sample has no bindings, so the layout is empty.
    VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = {};
    descriptorSetLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
    descriptorSetLayoutCreateInfo.pNext = nullptr;
    descriptorSetLayoutCreateInfo.bindingCount = 0;
    descriptorSetLayoutCreateInfo.pBindings = nullptr;

    ret = vkCreateDescriptorSetLayout(m_device, &descriptorSetLayoutCreateInfo, nullptr, &m_descriptorLayout);
    GVR_VK_CHECK(!ret);

    // Our pipeline layout simply points to the empty descriptor layout.
    VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo = {};
    pipelineLayoutCreateInfo.sType              = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
    pipelineLayoutCreateInfo.pNext              = nullptr;
    pipelineLayoutCreateInfo.setLayoutCount     = 1;
    pipelineLayoutCreateInfo.pSetLayouts        = &m_descriptorLayout;
    ret = vkCreatePipelineLayout(m_device, &pipelineLayoutCreateInfo, nullptr, &m_pipelineLayout);
    GVR_VK_CHECK(!ret);
}

void VulkanCore::InitRenderPass(){
// The renderpass defines the attachments to the framebuffer object that gets
    // used in the pipeline. We have two attachments, the colour buffer, and the
    // depth buffer. The operations and layouts are set to defaults for this type
    // of attachment.
    VkAttachmentDescription attachmentDescriptions[2] = {};
    attachmentDescriptions[0].flags = 0;
    attachmentDescriptions[0].format = m_surfaceFormat.format;
    attachmentDescriptions[0].samples = VK_SAMPLE_COUNT_1_BIT;
    attachmentDescriptions[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
    attachmentDescriptions[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
    attachmentDescriptions[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
    attachmentDescriptions[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
    attachmentDescriptions[0].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
    attachmentDescriptions[0].finalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;

    attachmentDescriptions[1].flags = 0;
    attachmentDescriptions[1].format = m_depthBuffers[0].format;
    attachmentDescriptions[1].samples = VK_SAMPLE_COUNT_1_BIT;
    attachmentDescriptions[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
    attachmentDescriptions[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
    attachmentDescriptions[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
    attachmentDescriptions[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
    attachmentDescriptions[1].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
    attachmentDescriptions[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;

    // We have references to the attachment offsets, stating the layout type.
    VkAttachmentReference colorReference = {};
    colorReference.attachment = 0;
    colorReference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;

    VkAttachmentReference depthReference = {};
    depthReference.attachment = 1;
    depthReference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;

    // There can be multiple subpasses in a renderpass, but this example has only one.
    // We set the color and depth references at the grahics bind point in the pipeline.
    VkSubpassDescription subpassDescription = {};
    subpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
    subpassDescription.flags = 0;
    subpassDescription.inputAttachmentCount = 0;
    subpassDescription.pInputAttachments = nullptr;
    subpassDescription.colorAttachmentCount = 1;
    subpassDescription.pColorAttachments = &colorReference;
    subpassDescription.pResolveAttachments = nullptr;
    subpassDescription.pDepthStencilAttachment = nullptr;//&depthReference;
    subpassDescription.preserveAttachmentCount = 0;
    subpassDescription.pPreserveAttachments = nullptr;

    // The renderpass itself is created with the number of subpasses, and the
    // list of attachments which those subpasses can reference.
    VkRenderPassCreateInfo renderPassCreateInfo = {};
    renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
    renderPassCreateInfo.pNext = nullptr;
    renderPassCreateInfo.attachmentCount = 2;
    renderPassCreateInfo.pAttachments = attachmentDescriptions;
    renderPassCreateInfo.subpassCount = 1;
    renderPassCreateInfo.pSubpasses = &subpassDescription;
    renderPassCreateInfo.dependencyCount = 0;
    renderPassCreateInfo.pDependencies = nullptr;

    VkResult ret;
    ret = vkCreateRenderPass(m_device, &renderPassCreateInfo, nullptr, &m_renderPass);
    GVR_VK_CHECK(!ret);
}

void VulkanCore::InitPipeline(){
#if 0
    VkResult   err;

    // The pipeline contains all major state for rendering.

    // Our vertex input is a single vertex buffer, and its layout is defined
    // in our m_vertices object already. Use this when creating the pipeline.
    VkPipelineVertexInputStateCreateInfo   vi = {};
    vi = m_vertices.vi;

    // Our vertex buffer describes a triangle list.
    VkPipelineInputAssemblyStateCreateInfo ia = {};
    ia.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
    ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;

    // State for rasterization, such as polygon fill mode is defined.
    VkPipelineRasterizationStateCreateInfo rs = {};
    rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
    rs.polygonMode = VK_POLYGON_MODE_FILL;
    rs.cullMode = VK_CULL_MODE_BACK_BIT;
    rs.frontFace = VK_FRONT_FACE_CLOCKWISE;
    rs.depthClampEnable = VK_FALSE;
    rs.rasterizerDiscardEnable = VK_FALSE;
    rs.depthBiasEnable = VK_FALSE;

    // For this example we do not do blending, so it is disabled.
    VkPipelineColorBlendAttachmentState att_state[1] = {};
    att_state[0].colorWriteMask = 0xf;
    att_state[0].blendEnable = VK_FALSE;

    VkPipelineColorBlendStateCreateInfo    cb = {};
    cb.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
    cb.attachmentCount = 1;
    cb.pAttachments = &att_state[0];

    // We define a simple viewport and scissor. It does not change during rendering
    // in this sample.
    VkPipelineViewportStateCreateInfo      vp = {};
    vp.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
    vp.viewportCount = 1;
    vp.scissorCount = 1;

    VkViewport viewport = {};
    viewport.height = (float) m_height;
    viewport.width = (float) m_width;
    viewport.minDepth = (float) 0.0f;
    viewport.maxDepth = (float) 1.0f;
    vp.pViewports = &viewport;

    VkRect2D scissor = {};
    scissor.extent.width = m_width;
    scissor.extent.height = m_height;
    scissor.offset.x = 0;
    scissor.offset.y = 0;
    vp.pScissors = &scissor;

    // Standard depth and stencil state is defined
    VkPipelineDepthStencilStateCreateInfo  ds = {};
    ds.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
    ds.depthTestEnable = VK_TRUE;
    ds.depthWriteEnable = VK_TRUE;
    ds.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL;
    ds.depthBoundsTestEnable = VK_FALSE;
    ds.back.failOp = VK_STENCIL_OP_KEEP;
    ds.back.passOp = VK_STENCIL_OP_KEEP;
    ds.back.compareOp = VK_COMPARE_OP_ALWAYS;
    ds.stencilTestEnable = VK_FALSE;
    ds.front = ds.back;

    // We do not use multisample
    VkPipelineMultisampleStateCreateInfo   ms = {};
    ms.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
    ms.pSampleMask = nullptr;
    ms.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;

    // We define two shader stages: our vertex and fragment shader.
    // they are embedded as SPIR-V into a header file for ease of deployment.
    VkPipelineShaderStageCreateInfo shaderStages[2] = {};
    shaderStages[0].sType  = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
    shaderStages[0].stage  = VK_SHADER_STAGE_VERTEX_BIT;
    shaderStages[0].module = CreateShaderModule( (const uint32_t*)&shader_tri_vert[0], shader_tri_vert_size);
    shaderStages[0].pName  = "main";
    shaderStages[1].sType  = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
    shaderStages[1].stage  = VK_SHADER_STAGE_FRAGMENT_BIT;
    shaderStages[1].module = CreateShaderModule( (const uint32_t*)&shader_tri_frag[0], shader_tri_frag_size);
    shaderStages[1].pName  = "main";

    // Pipelines are allocated from pipeline caches.
    VkPipelineCacheCreateInfo pipelineCache = {};
    pipelineCache.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
    pipelineCache.pNext = nullptr;
    pipelineCache.flags = 0;

    VkPipelineCache piplineCache;
    err = vkCreatePipelineCache(m_device, &pipelineCache, nullptr, &piplineCache);
    GVR_VK_CHECK(!err);

    // Out graphics pipeline records all state information, including our renderpass
    // and pipeline layout. We do not have any dynamic state in this example.
    VkGraphicsPipelineCreateInfo pipelineCreateInfo = {};
    pipelineCreateInfo.sType               = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
    pipelineCreateInfo.layout              = m_pipelineLayout;
    pipelineCreateInfo.pVertexInputState   = &vi;
    pipelineCreateInfo.pInputAssemblyState = &ia;
    pipelineCreateInfo.pRasterizationState = &rs;
    pipelineCreateInfo.pColorBlendState    = &cb;
    pipelineCreateInfo.pMultisampleState   = &ms;
    pipelineCreateInfo.pViewportState      = &vp;
    pipelineCreateInfo.pDepthStencilState  = nullptr;//&ds;
    pipelineCreateInfo.pStages             = &shaderStages[0];
    pipelineCreateInfo.renderPass          = m_renderPass;
    pipelineCreateInfo.pDynamicState       = nullptr;
    pipelineCreateInfo.stageCount          = 2; //vertex and fragment

    err = vkCreateGraphicsPipelines(m_device, piplineCache, 1, &pipelineCreateInfo, nullptr, &m_pipeline);
    GVR_VK_CHECK(!err);

    // We can destroy the cache now as we do not need it. The shader modules also
    // can be destroyed after the pipeline is created.
    vkDestroyPipelineCache(m_device, piplineCache, nullptr);

    vkDestroyShaderModule(m_device, shaderStages[0].module, nullptr);
    vkDestroyShaderModule(m_device, shaderStages[1].module, nullptr);
#endif
}

void VulkanCore::InitFrameBuffers(){
//The framebuffer objects reference the renderpass, and allow
    // the references defined in that renderpass to now attach to views.
    // The views in this example are the colour view, which is our swapchain image,
    // and the depth buffer created manually earlier.
    VkImageView attachments [2] = {};
    VkFramebufferCreateInfo framebufferCreateInfo = {};
    framebufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
    framebufferCreateInfo.pNext = nullptr;
    framebufferCreateInfo.renderPass = m_renderPass;
    framebufferCreateInfo.attachmentCount = 2;
    framebufferCreateInfo.pAttachments = attachments;
    framebufferCreateInfo.width  = m_width;
    framebufferCreateInfo.height = m_height;
    framebufferCreateInfo.layers = 1;

    VkResult ret;

    m_frameBuffers = new VkFramebuffer[m_swapchainImageCount];
    // Reusing the framebufferCreateInfo to create m_swapchainImageCount framebuffers,
    // only the attachments to the relevent image views change each time.
    for (uint32_t i = 0; i < m_swapchainImageCount; i++) {
        attachments[0] = m_swapchainBuffers[i].view;
        //framebufferCreateInfo.pAttachments = &m_swapchainBuffers[i].view;
        attachments[1] = m_depthBuffers[i].view;

        LOGI("Vulkan view %d created", i);
        if((m_swapchainBuffers[i].view == VK_NULL_HANDLE) || (m_renderPass == VK_NULL_HANDLE)){
            LOGI("Vulkan image view null");
        }
        else
            LOGI("Vulkan image view not null");
        ret = vkCreateFramebuffer(m_device, &framebufferCreateInfo, nullptr, &m_frameBuffers[i]);
        GVR_VK_CHECK(!ret);
    }
}

void VulkanCore::InitSync(){
    VkResult ret = VK_SUCCESS;
    // For synchronization, we have semaphores for rendering and backbuffer signalling.
    VkSemaphoreCreateInfo semaphoreCreateInfo = {};
    semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
    semaphoreCreateInfo.pNext = nullptr;
    semaphoreCreateInfo.flags = 0;
    ret = vkCreateSemaphore(m_device, &semaphoreCreateInfo, nullptr, &m_backBufferSemaphore);
    GVR_VK_CHECK(!ret);

    ret = vkCreateSemaphore(m_device, &semaphoreCreateInfo, nullptr, &m_renderCompleteSemaphore);
    GVR_VK_CHECK(!ret);
}

void VulkanCore::BuildCmdBuffer()
{
    // For the triangle sample, we pre-record our command buffer, as it is static.
    // We have a buffer per swap chain image, so loop over the creation process.
    for (uint32_t i = 0; i < m_swapchainImageCount; i++) {
        VkCommandBuffer &cmdBuffer = m_swapchainBuffers[i].cmdBuffer;

        // vkBeginCommandBuffer should reset the command buffer, but Reset can be called
        // to make it more explicit.
        VkResult err;
        err = vkResetCommandBuffer(cmdBuffer, 0);
        GVR_VK_CHECK(!err);

        VkCommandBufferInheritanceInfo cmd_buf_hinfo = {};
        cmd_buf_hinfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
        cmd_buf_hinfo.pNext = nullptr;
        cmd_buf_hinfo.renderPass = VK_NULL_HANDLE;
        cmd_buf_hinfo.subpass = 0;
        cmd_buf_hinfo.framebuffer = VK_NULL_HANDLE;
        cmd_buf_hinfo.occlusionQueryEnable = VK_FALSE;
        cmd_buf_hinfo.queryFlags = 0;
        cmd_buf_hinfo.pipelineStatistics = 0;

        VkCommandBufferBeginInfo cmd_buf_info = {};
        cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
        cmd_buf_info.pNext = nullptr;
        cmd_buf_info.flags = 0;
        cmd_buf_info.pInheritanceInfo = &cmd_buf_hinfo;

        // By calling vkBeginCommandBuffer, cmdBuffer is put into the recording state.
        err = vkBeginCommandBuffer(cmdBuffer, &cmd_buf_info);
        GVR_VK_CHECK(!err);

        // Before we can use the back buffer from the swapchain, we must change the
        // image layout from the PRESENT mode to the COLOR_ATTACHMENT mode.
        // PRESENT mode is optimal for sending to the screen for users to see, so the
        // image will be set back to that mode after we have completed rendering.
        VkImageMemoryBarrier preRenderBarrier = {};
        preRenderBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
        preRenderBarrier.pNext = nullptr;
        preRenderBarrier.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT;
        preRenderBarrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
        preRenderBarrier.oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
        preRenderBarrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
        preRenderBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
        preRenderBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
        preRenderBarrier.image = m_swapchainBuffers[i].image;
        preRenderBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
        preRenderBarrier.subresourceRange.baseArrayLayer = 0;
        preRenderBarrier.subresourceRange.baseMipLevel = 1;
        preRenderBarrier.subresourceRange.layerCount = 0;
        preRenderBarrier.subresourceRange.levelCount = 1;

        // Thie PipelineBarrier function can operate on memoryBarriers,
        // bufferMemory and imageMemory buffers. We only provide a single
        // imageMemoryBarrier.
        vkCmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                             VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                             0, 0, nullptr, 0, nullptr, 1, &preRenderBarrier);

        // When starting the render pass, we can set clear values.
        VkClearValue clear_values[2] = {};
        clear_values[0].color.float32[0] = 0.3f;
        clear_values[0].color.float32[1] = 0.3f;
        clear_values[0].color.float32[2] = 0.3f;
        clear_values[0].color.float32[3] = 1.0f;
        clear_values[1].depthStencil.depth = 1.0f;
        clear_values[1].depthStencil.stencil = 0;

        VkRenderPassBeginInfo rp_begin = {};
        rp_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
        rp_begin.pNext = nullptr;
        rp_begin.renderPass = m_renderPass;
        rp_begin.framebuffer =  m_frameBuffers[i];
        rp_begin.renderArea.offset.x = 0;
        rp_begin.renderArea.offset.y = 0;
        rp_begin.renderArea.extent.width = m_width;
        rp_begin.renderArea.extent.height = m_height;
        rp_begin.clearValueCount = 2;
        rp_begin.pClearValues = clear_values;

        vkCmdBeginRenderPass(cmdBuffer, &rp_begin, VK_SUBPASS_CONTENTS_INLINE);

        // Set our pipeline. This holds all major state
        // the pipeline defines, for example, that the vertex buffer is a triangle list.
        vkCmdBindPipeline(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipeline);

        // Bind our vertex buffer, with a 0 offset.
        VkDeviceSize offsets[1] = {0};
        vkCmdBindVertexBuffers(cmdBuffer, GVR_VK_VERTEX_BUFFER_BIND_ID, 1, &m_vertices.buf, offsets);

        // Issue a draw command, with our 3 vertices.
        vkCmdDraw(cmdBuffer, 3, 1, 0, 0);

        // Copy Image to Buffer
        VkOffset3D off = {};
        off.x = 0;
        off.y = 0;
        off.z = 0;

        VkExtent3D extent3D = {};
        extent3D.width = 320;
        extent3D.height = 240;

        VkImageSubresourceLayers subResource = {};
        subResource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
        subResource.baseArrayLayer = 0;
        subResource.mipLevel = 0;
        subResource.layerCount = 1;

        VkBufferImageCopy someDetails = {};
        someDetails.bufferOffset = 0;
        someDetails.bufferRowLength = 0;
        someDetails.bufferImageHeight = 0;
        someDetails.imageSubresource = subResource;
        someDetails.imageOffset = off;
        someDetails.imageExtent = extent3D;

        VkBufferImageCopy region = { 0 };
                 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
                 region.imageSubresource.layerCount = 1;
                 region.imageExtent.width = m_width;
                 region.imageExtent.height = m_height;
                 region.imageExtent.depth = 1;

        // Now our render pass has ended.
        vkCmdEndRenderPass(cmdBuffer);
        //vkCmdCopyImageToBuffer(cmdBuffer, m_swapchainBuffers[i].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, m_outputBuffers[i].imageOutputBuffer, 1,  &region);

        // As stated earlier, now transition the swapchain image to the PRESENT mode.
        VkImageMemoryBarrier prePresentBarrier = {};
        prePresentBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
        prePresentBarrier.pNext = nullptr;
        prePresentBarrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
        prePresentBarrier.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
        prePresentBarrier.oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
        prePresentBarrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
        prePresentBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
        prePresentBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
        prePresentBarrier.image = m_swapchainBuffers[i].image;
        prePresentBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
        prePresentBarrier.subresourceRange.baseArrayLayer = 0;
        prePresentBarrier.subresourceRange.baseMipLevel = 1;
        prePresentBarrier.subresourceRange.layerCount = 0;

        vkCmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                             VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
                             0, 0, nullptr, 0, nullptr, 1, &prePresentBarrier);

        // By ending the command buffer, it is put out of record mode.
        err = vkEndCommandBuffer(cmdBuffer);
        GVR_VK_CHECK(!err);
    }

    VkFence nullFence = VK_NULL_HANDLE;

    VkSubmitInfo submitInfo = {};
    submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
    submitInfo.pNext = nullptr;
    submitInfo.waitSemaphoreCount = 1;
    submitInfo.pWaitSemaphores = &m_backBufferSemaphore;
    submitInfo.pWaitDstStageMask = nullptr;
    submitInfo.commandBufferCount = 1;
    submitInfo.pCommandBuffers = &m_swapchainBuffers[m_swapchainCurrentIdx].cmdBuffer;
    submitInfo.signalSemaphoreCount = 1;
    submitInfo.pSignalSemaphores = &m_renderCompleteSemaphore;

    VkResult err;

    err = vkQueueSubmit(m_queue, 1, &submitInfo,  VK_NULL_HANDLE);
    GVR_VK_CHECK(!err);

    err = vkQueueWaitIdle(m_queue);
    if(err != VK_SUCCESS)
        LOGI("Vulkan vkQueueWaitIdle submit failed");

    LOGI("Vulkan vkQueueWaitIdle submitted");

    uint8_t * data;
    static bool printflag = true;
    if(printflag){
        uint8_t * data;
        err = vkMapMemory(m_device, m_swapchainBuffers[m_swapchainCurrentIdx].mem, 0, m_swapchainBuffers[m_swapchainCurrentIdx].size, 0, (void **)&data);
        GVR_VK_CHECK(!err);

        //void* data;
        uint8_t *finaloutput = (uint8_t*)malloc(m_width*m_height*4* sizeof(uint8_t));
        for(int i = 0; i < (320); i++)
            finaloutput[i] = 0;

        LOGI("Vulkna size of %d", sizeof(finaloutput));
        //while(1) {
        memcpy(finaloutput, data, (m_width*m_height*4* sizeof(uint8_t)));

        LOGI("Vulkan memcpy map done");
        float tt;
        for (int i = 0; i < (m_width*m_height)-4; i++) {
            //tt = (float) data[i];
            LOGI("Vulkan Data %u, %u %u %u", data[i], data[i+1], data[i+2], data[i+3]);
            i+=3;
        }

        texDataVulkan = data;//finaloutput;
        LOGI("Vulkan data reading done");
        vkUnmapMemory(m_device,m_swapchainBuffers[m_swapchainCurrentIdx].mem);

        printflag = false;
    }
}

void VulkanCore::initVulkanCore()
{
#if 0
        InitVulkan();
        CreateInstance();
        GetPhysicalDevices();
        InitDevice();
        InitSwapchain(1024  , 1024);
        LOGI("Vulkan after swap chain");
        InitCommandbuffers();
        LOGI("Vulkan after cmd buffers");
        InitVertexBuffers();
        LOGI("Vulkan after vert buf");
        InitLayouts();
        LOGI("Vulkan after layout");
        InitRenderPass();
        LOGI("Vulkan after render pass");
        InitPipeline();
        LOGI("Vulkan after piplen");
        InitFrameBuffers();
        LOGI("Vulkan after FBO");
        InitSync();
        LOGI("Vulkan after synch");

        // Initialize our command buffers
        BuildCmdBuffer();
#endif
}


text:
<?php

  require "includer".DIRECTORY_SEPARATOR."includer.php";

  $pageID = 4;
  $pageComposer = new pageComposer($pageID);
  $includer = new includer($pageID);

  $pageMetaData = $pageComposer -> getPageMetaData();
  $pageContentIncludeLinks = $pageComposer -> getPageContentIncludings();
  $includer -> includePageContent($pageContentIncludeLinks);

?>


text:
describe RuboCop::Cop::Lint::RescueWithoutErrorClass, :config do
  subject(:cop) { described_class.new(config) }

  context 'when rescuing in a begin block' do
    it 'registers an offense without an error class' do
      expect_offense(<<-RUBY.strip_indent)
        begin
          foo
        rescue
        ^^^^^^ Avoid rescuing without specifying an error class.
          bar
        end
      RUBY
    end

    it 'registers an offense without an error class, assigning to variable' do
      expect_offense(<<-RUBY.strip_indent)
        begin
          foo
        rescue => e
        ^^^^^^ Avoid rescuing without specifying an error class.
          bar
        end
      RUBY
    end

    it 'does not register an offense with an error class' do
      expect_no_offenses(<<-RUBY.strip_indent)
        begin
          foo
        rescue BarError
          bar
        end
      RUBY
    end

    it 'does not register an offense with an error class, ' \
       'assigning to variable' do
      expect_no_offenses(<<-RUBY.strip_indent)
        begin
          foo
        rescue BarError => e
          bar
        end
      RUBY
    end
  end

  context 'when rescuing in a method definition' do
    it 'registers an offense without an error class' do
      expect_offense(<<-RUBY.strip_indent)
        def baz
          foo
        rescue
        ^^^^^^ Avoid rescuing without specifying an error class.
          bar
        end
      RUBY
    end

    it 'registers an offense without an error class, assigning to variable' do
      expect_offense(<<-RUBY.strip_indent)
        def baz
          foo
        rescue => e
        ^^^^^^ Avoid rescuing without specifying an error class.
          bar
        end
      RUBY
    end

    it 'does not register an offense with an error class' do
      expect_no_offenses(<<-RUBY.strip_indent)
        def baz
          foo
        rescue BarError
          bar
        end
      RUBY
    end

    it 'does not register an offense with an error class, ' \
       'assigning to variable' do
      expect_no_offenses(<<-RUBY.strip_indent)
        def baz
          foo
        rescue BarError => e
          bar
        end
      RUBY
    end
  end

  context 'when rescuing as a modifier' do
    it 'does not register an offense without an error class' do
      expect_no_offenses(<<-RUBY.strip_indent)
        foo rescue 42
      RUBY
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <title>Autojar</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="../css/moc.css"  rel="stylesheet" type="text/css" />
    <link href="../css/en.css"  rel="stylesheet" type="text/css" />
    <link href="../css/stdFooter.css"  rel="stylesheet" type="text/css" />

Automatic creation of Java archives

Preface	Command line version	Eclipse plugin

        Bernd Eggink,  monoped@users.sourceforge.net
        Project page:

                    German version

Plugin

Usage

Plugin start

Configuration

Classpath

Options

Class lookup

File lookup

Directly supplied files

Configuration

    This wizard page deals with configurations.

    Any configurations you have already created are listed in the upper window.
    You may select one of them to change or execute it. To execute, i.e. to re-create
    it, simply click on "Finish". "Delete" removes the configuration,
    "Rename" allows to rename it, "Clone" creates an exact copy, which can then be
    altered.

To create a new configuration, click on "New". Then go through the wizard
    pages and enter the necessary parameters. As soon as all mandatory inputs
    have been made, the "Finish" button gets active. Clicking on it saves
    the configuration and creates the output archive.

                  Plugin start

Classpath

        Created 2011-05-16 by mopcoge


text:
namespace telnetpp { namespace options { namespace echo {

//* =========================================================================
/// \class telnetpp::options::echo::client
/// \extends telnetpp::client_option
/// \brief An implementation of the client side of Telnet ECHO option
/// \see https://tools.ietf.org/html/rfc857
//* =========================================================================
class TELNETPP_EXPORT client : public telnetpp::options::basic_client<
    telnetpp::options::echo::detail::option
>
{
public:
    explicit client(telnetpp::session &sess) noexcept;
};

}}}


text:
import element from 'virtual-element';
import { Grid, Cell } from 'deku-grid';
import * as Actions from '../actions';
import * as Class from '../class';
import * as Entities from '../entities';
import * as Links from '../links';
import * as Properties from '../properties';

export function render({ props }) {
  let { entity, onAction, onLink } = props;

  return (

{entity.title || Untitled Entity}

      <Grid gutter>
        <Cell size="1of3">
          <Class classes={entity.class} />
          <Properties properties={entity.properties} />
          <Links links={entity.links} onLink={onLink} />
          <Actions actions={entity.actions} onAction={onAction} />
        </Cell>
        <Cell size="2of3">
          <Entities entities={entity.entities}
            onAction={onAction} onLink={onLink} />
        </Cell>
      </Grid>

  );
}


text:
'use strict';

(function() {
	/**
	 * @ngdoc function
	 * @name spacesimperiumApp.controller:LoginCtrl
	 * @description # LoginCtrl Controller of the spacesimperiumApp
	 */
	var myApp = angular.module('dontforgetApp');
	myApp.controller('LoginCtrl', [
			'$scope',
			'$state',
			'User',
			'Connection', 'Dialog',
			function($scope, $state, User, Connection, Dialog) {
				$scope.isNewCompte = false;
				var lLoginIsOK = false;

				$scope.login = document.getElementById('fake_login_login').value;
				$scope.password = document.getElementById('fake_login_password').value;
				$scope.password2 = "";
				$scope.email = "";
				$scope.action = "";

				$scope.submit = function() {
					if (lLoginIsOK) {
						return true;
					}
					if ($scope.isNewCompte) {
						return $scope.newcompte_submit();
					} else {
						return $scope.login_submit();
					}
				}

				$scope.login_close = function() {
					window.modalInstance.dismiss('cancel');
				}

				$scope.login_submit = function() {
					// window.modalInstance.close();
					if ($scope.login == "") {
						Dialog.alert("dontforget.login.login_error.login.title", "dontforget.login.login_error.login.text").then(function () {
							document.getElementById("login_login").focus();
						});
						return;
					}
					if ($scope.password == "") {
						Dialog.alert("dontforget.login.login_error.password.title", "dontforget.login.login_error.password.text").then(function () {
							document.getElementById("login_password").focus();
						});
						return;
					}
					Connection.connect($scope.login, $scope.password,
							function() {
								// Connexion OK
								lLoginIsOK = true;
								document.getElementById('fake_login_login').value = $scope.login;
								document.getElementById('fake_login_password').value = $scope.password;
								document.getElementById("fake_login_form").submit();
								window.modalInstance.close(true);
							});
					return false;
				}

				$scope.newcompte_submit = function() {
					if ($scope.login == "") {
						Dialog.alert("dontforget.login.newaccount_error.login.title", "dontforget.login.newaccount_error.login.text").then(function () {
							document.getElementById("login_login").focus();
						});
						return;
					}
					if ($scope.password == "") {
						Dialog.alert("dontforget.login.newaccount_error.password.title", "dontforget.login.newaccount_error.password.text").then(function () {
							document.getElementById("login_password").focus();
						});
						return;
					}
					if ($scope.password2 == "") {
						Dialog.alert("dontforget.login.newaccount_error.password2.title", "dontforget.login.newaccount_error.password2.text").then(function () {
							document.getElementById("login_password2").focus();
						});
						return;
					}
					if ($scope.email == "") {
						Dialog.alert("dontforget.login.newaccount_error.email.title", "dontforget.login.newaccount_error.email.text").then(function () {
							document.getElementById("newcompte_mail").focus();
						});
						return;
					}
					if ($scope.password != $scope.password2) {
						Dialog.alert("dontforget.login.newaccount_error.password_confirm.title", "dontforget.login.newaccount_error.password_confirm.text").then(function () {
							document.getElementById("login_password2").focus();
						});
						return;
					}
					User.create($scope.login, $scope.password, $scope.email,
							function(pData) {
								lLoginIsOK = true;
								document.getElementById('fake_login_login').value = $scope.login;
								document.getElementById('fake_login_password').value = $scope.password;
								document.getElementById("fake_login_form").submit();
								window.modalInstance.close(true);
							});
					return false;
				}
				$scope.newcompte_close = $scope.login_close;
				$scope.login_gotonewcompte = function(pForm) {
					$scope.isNewCompte = true;
				};

				$scope.newcompte_gotologin = function() {
					$scope.isNewCompte = false;
				};

			} ]);
})();


text:
package com.sync.sz.netty.protocol.udp;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;

/**
 * Created by YH on 2017-02-12.
 */
public class ChineseProverbServer {

  public void run(int port) throws Exception {
    EventLoopGroup group = new NioEventLoopGroup();
    try {
      Bootstrap b = new Bootstrap();
      b.group(group).channel(NioDatagramChannel.class)
          .option(ChannelOption.SO_BROADCAST, true)
          .handler(new ChineseProverbSeverHandler());
      b.bind(port).sync().channel().closeFuture().await();
    } finally {
      group.shutdownGracefully();
    }
  }

  public static void main(String[] args) throws Exception {
    int port = 8080;
    if (args.length > 0) {
      try {
        port = Integer.parseInt(args[0]);
      } catch (NumberFormatException e) {
        e.printStackTrace();
      }
    }
    new ChineseProverbServer().run(port);
  }
}


text:
layout: page
title: Freeman House Inc. Show
date: 2016-05-24
author: Donald Mckinney
tags: weekly links, java
status: published
summary: Nam suscipit, nibh sed tempor.
banner: images/banner/leisure-03.jpg
booking:
  startDate: 12/31/2018
  endDate: 01/04/2019
  ctyhocn: NYCEMHX
  groupCode: FHIS
published: true
---
Morbi tellus sem, rutrum non commodo faucibus, consequat nec sapien. Pellentesque semper porta lorem. Mauris vitae euismod felis, et laoreet velit. Cras erat mauris, semper eget tincidunt vitae, volutpat molestie nunc. Curabitur aliquet tempor auctor. Cras sed porttitor elit. Suspendisse nisl sapien, finibus a tellus et, lobortis convallis lectus. Pellentesque sed ex at quam iaculis elementum eu in ante. Nullam augue quam, eleifend in lorem ac, aliquet rhoncus dui. Quisque ullamcorper neque eu ligula aliquam tristique. Vivamus nec magna urna.
Nulla tincidunt mi quis turpis vehicula posuere. Nunc velit metus, ultricies eu urna sit amet, molestie volutpat dolor. Maecenas tincidunt eros nec bibendum hendrerit. Nunc euismod scelerisque sapien sit amet porttitor. Aenean ac finibus urna. Fusce nec ligula gravida, condimentum nisl sed, efficitur felis. Curabitur ultricies convallis laoreet. Maecenas eu elementum risus. Curabitur venenatis finibus est iaculis luctus. Praesent finibus cursus tortor, eu cursus sapien varius ac. Donec sed tincidunt justo. Phasellus dignissim quam eu lorem suscipit tempor. Mauris in tellus sed lectus semper posuere. Suspendisse blandit velit id porta ullamcorper. Sed sollicitudin ultricies enim, non rutrum mi lobortis nec. Etiam fringilla tellus ac condimentum laoreet.

* Quisque viverra est eu laoreet ultricies
* In in odio non ligula malesuada efficitur sed vitae velit
* Aenean in ipsum sed augue aliquet sodales tincidunt a mauris.

Suspendisse at nunc nibh. Aenean porttitor porttitor turpis, vitae tristique tellus luctus elementum. Nulla sed justo eros. Aliquam vestibulum fringilla dictum. Pellentesque consequat sem a arcu ullamcorper lobortis. Fusce vel ante sagittis orci dignissim fringilla ut vitae nunc. Phasellus erat risus, mattis id accumsan sit amet, semper sed odio. Donec dignissim pretium imperdiet. Mauris porta vulputate augue, eget mollis dolor viverra a.