text:
package eCommerce.core.utils;

import java.util.HashMap;
import java.util.Map;

public class JsonBuilder {

	private Map<String, String> jsonMap;
	private Map<String, Boolean> jsonOpt;

	public JsonBuilder() {
		jsonMap = new HashMap<String, String>();
		jsonOpt = new HashMap<String, Boolean>();
	}

	public void StringToJson(String string) {
		jsonMap.clear();
		String[] parts;
		// Faz o tratamento da string para criar objeto semelhante a json
		// Remove o primeiro e o último caracter ( Chaves {} )
		if( string != null && string.length() > 0 ) {
			string = string.substring(1, string.length()-1);
			parts = string.split(",");

			for( String s : parts ) {
				String[] duo = s.split(":");
				String str1 = duo[0].trim();
				String str2 = duo[1].trim();
				str1 = str1.substring(1);
				str1 = str1.substring(0, str1.length()-1);
				str2 = str2.substring(1);
				str2 = str2.substring(0, str2.length()-1);

				jsonMap.put(str1,str2);
			}
		}
	}

	public void addKey( String key, String value ) {
		jsonMap.put(key, value);
		jsonOpt.put(key, false);
	}
	public void addListKey( String key, String value ) {
		// Se a chave não existe, cria um nova.
		if( jsonMap.get(key) == null ) {
			jsonMap.put(key, "[" + value + "]" );
		}else {
			// Caso a chave exista, verifica se tem conteúdo para adicionar o registro a lista
			String oldValue = jsonMap.get(key);
			if ( oldValue == null || oldValue.length() <= 0 ) {
				oldValue = value;
			}else {
				oldValue = oldValue.substring(0, oldValue.length()-1 );
				oldValue += "," + value + "]";
				jsonMap.put(key, oldValue);
			}
		}
		jsonOpt.put(key, true);
	}

	public String getValue(String key) {
		return jsonMap.get(key);
	}
	public Map<String,String> getJson(){
		return jsonMap;
	}
	public Map<String,Boolean> getJsonOpt(){
		return jsonOpt;
	}
	public static String JsonToString(JsonBuilder json) {
		StringBuilder sb = new StringBuilder();
		for (Map.Entry<String, String> entry : json.getJson().entrySet())
		{
			if( sb.length() > 0 )
				sb.append(",");
			sb.append("\"");
			sb.append(entry.getKey());
			if( json.getJsonOpt().get(entry.getKey()) ) {
				sb.append("\":");
				sb.append(entry.getValue());
			}else {
				sb.append("\":\"");
				sb.append(entry.getValue());
				sb.append("\"");
			}
		}
		return "{" + sb.toString() + "}";
	}
	public String JsonToString() {
		StringBuilder sb = new StringBuilder();
		for (Map.Entry<String, String> entry : getJson().entrySet())
		{
			if( sb.length() > 0 )
				sb.append(",");
			sb.append("\"");
			sb.append(entry.getKey());
			if( jsonOpt.get(entry.getKey()) ) {
				sb.append("\":");
				sb.append(entry.getValue());
			}else {
				sb.append("\":\"");
				sb.append(entry.getValue());
				sb.append("\"");
			}
		}
		return "{" + sb.toString() + "}";
	}
}


text:
{-# LANGUAGE RecordWildCards, GADTs, ScopedTypeVariables, RankNTypes #-}
module Main (main) where

import GHCi.Run
import GHCi.TH
import GHCi.Message
import GHCi.Signals
import GHCi.Utils

import Control.DeepSeq
import Control.Exception
import Control.Monad
import Data.Binary
import Data.IORef
import System.Environment
import System.Exit
import Text.Printf

main :: IO ()
main = do
  (arg0:arg1:rest) <- getArgs
  let wfd1 = read arg0; rfd2 = read arg1
  verbose <- case rest of
    ["-v"] -> return True
    []     -> return False
    _      -> die "iserv: syntax: iserv <write-fd> <read-fd> [-v]"
  when verbose $ do
    printf "GHC iserv starting (in: %d; out: %d)\n"
      (fromIntegral rfd2 :: Int) (fromIntegral wfd1 :: Int)
  inh  <- getGhcHandle rfd2
  outh <- getGhcHandle wfd1
  installSignalHandlers
  lo_ref <- newIORef Nothing
  let pipe = Pipe{pipeRead = inh, pipeWrite = outh, pipeLeftovers = lo_ref}
  uninterruptibleMask $ serv verbose pipe
    -- we cannot allow any async exceptions while communicating, because
    -- we will lose sync in the protocol, hence uninterruptibleMask.

serv :: Bool -> Pipe -> (forall a .IO a -> IO a) -> IO ()
serv verbose pipe@Pipe{..} restore = loop
 where
  loop = do
    Msg msg <- readPipe pipe getMessage
    discardCtrlC
    when verbose $ putStrLn ("iserv: " ++ show msg)
    case msg of
      Shutdown -> return ()
      RunTH st q ty loc -> wrapRunTH $ runTH pipe st q ty loc
      FinishTH st -> wrapRunTH $ finishTH pipe st
      _other -> run msg >>= reply

  reply :: forall a. (Binary a, Show a) => a -> IO ()
  reply r = do
    when verbose $ putStrLn ("iserv: return: " ++ show r)
    writePipe pipe (put r)
    loop

  wrapRunTH :: forall a. (Binary a, Show a) => IO a -> IO ()
  wrapRunTH io = do
    r <- try io
    case r of
      Left e
        | Just (GHCiQException _ err) <- fromException e  -> do
           when verbose $ putStrLn "iserv: QFail"
           writePipe pipe (putMessage (QFail err))
           loop
        | otherwise -> do
           when verbose $ putStrLn "iserv: QException"
           str <- showException e
           writePipe pipe (putMessage (QException str))
           loop
      Right a -> do
        when verbose $ putStrLn "iserv: QDone"
        writePipe pipe (putMessage QDone)
        reply a

  -- carefully when showing an exception, there might be other exceptions
  -- lurking inside it.  If so, we return the inner exception instead.
  showException :: SomeException -> IO String
  showException e0 = do
     r <- try $ evaluate (force (show (e0::SomeException)))
     case r of
       Left e -> showException e
       Right str -> return str

  -- throw away any pending ^C exceptions while we're not running
  -- interpreted code.  GHC will also get the ^C, and either ignore it
  -- (if this is GHCi), or tell us to quit with a Shutdown message.
  discardCtrlC = do
    r <- try $ restore $ return ()
    case r of
      Left UserInterrupt -> return () >> discardCtrlC
      Left e -> throwIO e
      _ -> return ()

redpajama_set_name: RedPajamaGithub


text:
package io.irontest.core.teststep;

import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, property = "minClassName")
public class APIResponse {
}


text:
test_is_arguments_1_not_true() {
	expect_not_true $LINENO $(is_arguments $LINENO 2 1)
}


text:
package com.emilburzo.hnjobs.shared.rpc;

import java.util.Date;

public class SearchLogRPC {

    public String query;
    public int results;
    public long durationMs;
    public long timestamp = new Date().getTime();

    public SearchLogRPC() {
    }

    public SearchLogRPC(String query, int results, long durationMs) {
        this.query = query;
        this.results = results;
        this.durationMs = durationMs;
    }
}


text:
require 'rails_helper'

RSpec.describe CollectionDecorator do
  subject(:decorator) { described_class.new(collection) }

  it 'extends ResourceDecorator' do
    expect(described_class).to be < ResourceDecorator
  end

  describe '#decorated_work_versions' do
    let(:work_1) { create :work, versions_count: 2, has_draft: true }
    let(:work_1_published_version) { work_1.latest_published_version }

    let(:work_2) { create :work, versions_count: 1, has_draft: false }
    let(:work_2_published_version) { work_2.latest_published_version }

    # Note, this work has no published version, only a draft
    let(:work_3) { create :work, versions_count: 1, has_draft: true }

    let(:collection) { create :collection, works: [work_1, work_2, work_3] }

    it 'returns an array of the latest published versions of all works in the collection, decorated' do
      work_versions = decorator.decorated_work_versions

      expect(work_versions.map(&:id)).to contain_exactly(
        work_1_published_version.uuid,
        work_2_published_version.uuid
      )
    end
  end
end


text:
package cmd

import (
	"fmt"

	"github.com/spf13/cobra"

	"github.com/akerl/speculate/v2/version"
)

var versionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version of speculate",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("%s\n", version.Version)
	},
}

func init() {
	rootCmd.AddCommand(versionCmd)
}


text:
@class DVTStackBacktrace, NSMapTable, NSString;

@interface DVTAutosynchingProxyArray : NSArray <DVTInvalidation>
{
    id _observedObject;
    NSString *_observedKeyPath;
    NSArray *_proxies;
    NSMapTable *_objectsToProxies;
    dispatch_block_t _proxyObtainBlock;
    dispatch_block_t _proxyDiscardBlock;
    id _kvoNotifyObject;
    NSString *_kvoNotifyKeyPath;
}

+ (void)initialize;
+ (id)proxyArrayObservingObject:(id)arg1 keyPath:(id)arg2 withProxyObtainBlock:(dispatch_block_t)arg3;
@property(retain) id observedObject; // @synthesize observedObject=_observedObject;
@property(copy) NSString *kvoNotifyKeyPath; // @synthesize kvoNotifyKeyPath=_kvoNotifyKeyPath;
@property(retain) id kvoNotifyObject; // @synthesize kvoNotifyObject=_kvoNotifyObject;
@property(copy) dispatch_block_t proxyDiscardBlock; // @synthesize proxyDiscardBlock=_proxyDiscardBlock;
@property(copy) dispatch_block_t proxyObtainBlock; // @synthesize proxyObtainBlock=_proxyObtainBlock;
- (void)observeValueForKeyPath:(id)arg1 ofObject:(id)arg2 change:(id)arg3 context:(void *)arg4;
- (void)primitiveInvalidate;
- (id)proxyForObject:(id)arg1;
- (id)objectAtIndex:(unsigned long long)arg1;
- (unsigned long long)count;
@property(readonly) NSString *observedKeyPath;
- (id)init;
- (id)initWithObservedObject:(id)arg1 keyPath:(id)arg2 withProxyObtainBlock:(dispatch_block_t)arg3;

// Remaining properties
@property(retain) DVTStackBacktrace *creationBacktrace;
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) DVTStackBacktrace *invalidationBacktrace;
@property(readonly) Class superclass;
@property(readonly, nonatomic, getter=isValid) BOOL valid;

@end


text:
module Language.Lua.Parser
  ( A.parseText
  , A.parseNamedText
  , parseFile
  , A.parseTokens
  , stat
  , exp
  , chunk
  ) where

import           Control.Monad                   (liftM)
import           Prelude                         hiding (exp)

import qualified Language.Lua.Annotated.Parser   as A
import           Language.Lua.Annotated.Lexer (SourceRange)
import           Language.Lua.Annotated.Simplify
import           Language.Lua.Syntax

parseFile :: FilePath -> IO (Either (SourceRange,String) Block)
parseFile = liftM (liftM sBlock) . A.parseFile

stat :: A.Parser Stat
stat = fmap sStat A.stat

exp :: A.Parser Exp
exp = fmap sExp A.exp

chunk :: A.Parser Block
chunk = fmap sBlock A.chunk


text:
package net.jsunit.model;

import java.util.List;

public abstract class AbstractResult implements Result {

    public ResultType getResultType() {
        ResultType worstResultType = ResultType.SUCCESS;
        for (Result childResult : getChildren()) {
            ResultType childResultType = childResult.getResultType();
            if (childResultType.isWorseThan(worstResultType))
                worstResultType = childResultType;
        }
        return worstResultType;
    }

    public int getFailureCount() {
        int failureCount = 0;
        for (Result childResult : getChildren())
            failureCount += childResult.getFailureCount();
        return failureCount;
    }

    public int getErrorCount() {
        int errorCount = 0;
        for (Result childResult : getChildren())
            errorCount += childResult.getErrorCount();
        return errorCount;
    }

    public int getTestCount() {
        int result = 0;
        for (Result childResult : getChildren())
            result += childResult.getTestCount();
        return result;
    }

    public boolean wasSuccessful() {
        return getResultType() == ResultType.SUCCESS;
    }

    protected abstract List<? extends Result> getChildren();

    public String displayString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("The test run had ");
        buffer.append(getErrorCount());
        buffer.append(" error(s) and ");
        buffer.append(getFailureCount());
        buffer.append(" failure(s).");
        return buffer.toString();
    }

}


text:
import { merge } from 'ramda'
import Promise from 'bluebird'
import runTest from '../../test/runTest'

test('client.gatewayOperations.find', () => {
  const options = {
    connect: {
      api_key: 'abc123',
    },
    method: 'GET',
    body: {
      api_key: 'abc123',
    },
  }

  const findInTransaction = runTest(merge(options, {
    subject: client => client.gatewayOperations.find({ transactionId: 1234 }),
    url: '/transactions/1234/operations',
  }))

  const findInSubscription = runTest(merge(options, {
    subject: client => client.gatewayOperations.find({ subscriptionId: 1234 }),
    url: '/subscriptions/1234/operations',
  }))

  const findOne = runTest(merge(options, {
    subject: client => client.gatewayOperations.find({ transactionId: 1234, id: 54321 }),
    url: '/transactions/1234/operations/54321',
  }))

  return Promise.props({
    findInTransaction,
    findInSubscription,
    findOne,
  })
})

test('client.gatewayOperations.refuseMessage', () =>
  runTest({
    connect: {
      api_key: 'abc123',
    },
    subject: client => client.gatewayOperations.refuseMessage({ subscriptionId: 4321, id: 1234 }),
    url: '/subscriptions/4321/operations/1234/refuse_message',
    method: 'GET',
    body: {
      api_key: 'abc123',
    },
  })
)


text:
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#appzi-navigation">
                Toggle navigation

            </button>

Home

Basically

Features

Pricing

Contact

Login


text:
<!DOCTYPE html>

<meta charset=utf-8>
<title>222 nips-2012-Multi-Task Averaging</title>

nips nips2012 nips2012-222 nips2012-222-reference knowledge-graph by maker-knowledge-mining

222 nips-2012-Multi-Task Averaging

Source: pdf

Author: Sergey Feldman, Maya Gupta, Bela Frigyik

Abstract: We present a multi-task learning approach to jointly estimate the means of multiple independent data sets. The proposed multi-task averaging (MTA) algorithm results in a convex combination of the single-task averages. We derive the optimal amount of regularization, and show that it can be effectively estimated. Simulations and real data experiments demonstrate that MTA outperforms both maximum likelihood and James-Stein estimators, and that our approach to estimating the amount of regularization rivals cross-validation in performance but is more computationally efficient. 1

reference text

[1] C. Stein, "Inadmissibility of the usual estimator for the mean of a multivariate distribution," Proc. Third Berkeley Symposium on Mathematical Statistics and Probability, pp. 197–206, 1956.

[2] B. Efron and C. N. Morris, "Stein's paradox in statistics," Scientific American, vol. 236, no. 5, pp. 119–127, 1977.

[3] A. Banerjee, S. Merugu, I. S. Dhillon, and J. Ghosh, "Clustering with Bregman divergences," Journal Machine Learning Research, vol. 6, pp. 1705–1749, December 2005.

[4] C. A. Micchelli and M. Pontil, "Kernels for multi–task learning," in Advances in Neural Information Processing Systems (NIPS), 2004.

[5] E. V. Bonilla, K. M. A. Chai, and C. K. I. Williams, "Multi-task Gaussian process prediction," in Advances in Neural Information Processing Systems (NIPS). MIT Press, 2008.

[6] A. Argyriou, T. Evgeniou, and M. Pontil, "Convex multi-task feature learning," Machine Learning, vol. 73, no. 3, pp. 243–272, 2008.

[7] W. James and C. Stein, "Estimation with quadratic loss," Proc. Fourth Berkeley Symposium on Mathematical Statistics and Probability, pp. 361–379, 1961.

[8] M. E. Bock, "Minimax estimators of the mean of a multivariate normal distribution," The Annals of Statistics, vol. 3, no. 1, 1975.

[9] G. Casella, "An introduction to empirical Bayes data analysis," The American Statistician, pp. 83–87, 1985.

[10] E. L. Lehmann and G. Casella, Theory of Point Estimation.  New York: Springer, 1998.

[11] H. Rue and L. Held, Gaussian Markov Random Fields: Theory and Applications, ser. Monographs on Statistics and Applied Probability. London: Chapman & Hall, 2005, vol. 104.

[12] A. Argyriou, C. A. Micchelli, M. Pontil, and Y. Ying, "A spectral regularization framework for multi-task structure learning," in Advances in Neural Information Processing Systems (NIPS), 2007.

[13] Y. Xue, X. Liao, L. Carin, and B. Krishnapuram, "Multi-task learning for classification with Dirichlet process priors," Journal Machine Learning Research, vol. 8, pp. 35–63, 2007.

[14] L. Jacob, F. Bach, and J.-P. Vert, "Clustered multi-task learning: A convex formulation," in Advances in Neural Information Processing Systems (NIPS), 2008, pp. 745–752.

[15] Y. Zhang and D.-Y. Yeung, "A convex formulation for learning task relationships," in Proc. of the 26th Conference on Uncertainty in Artificial Intelligence (UAI), 2010.

[16] R. A. Horn and C. R. Johnson, Matrix Analysis. Cambridge University Press, 1990, corrected reprint of the 1985 original.

[17] A. Berman and R. J. Plemmons, Nonnegative Matrices in the Mathematical Sciences. demic Press, 1979.

[18] B. W. Silverman, Density Estimation for Statistics and Data Analysis. and Hall, 1986.  Aca-  New York: Chapman

[19] D. Brown, J. Dalton, and H. Hoyle, "Spatial forecast methods for terrorist events in urban environments," Lecture Notes in Computer Science, vol. 3073, pp. 426–435, 2004.  9


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/prntbase.h
// Purpose:     Base classes for printing framework
// Author:      Julian Smart
// Modified by:
// Created:     01/02/97
// Copyright:   (c) Julian Smart
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_PRNTBASEH__
#define _WX_PRNTBASEH__

#include "wx/defs.h"

#if wxUSE_PRINTING_ARCHITECTURE

#include "wx/event.h"
#include "wx/cmndata.h"
#include "wx/panel.h"
#include "wx/scrolwin.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/dc.h"

class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxChoice;
class WXDLLIMPEXP_FWD_CORE wxPrintout;
class WXDLLIMPEXP_FWD_CORE wxPrinterBase;
class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase;
class WXDLLIMPEXP_FWD_CORE wxPrintDialog;
class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase;
class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog;
class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase;
class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas;
class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar;
class WXDLLIMPEXP_FWD_CORE wxPreviewFrame;
class WXDLLIMPEXP_FWD_CORE wxPrintFactory;
class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
class WXDLLIMPEXP_FWD_CORE wxPrintPreview;
class WXDLLIMPEXP_FWD_CORE wxPrintAbortDialog;
class WXDLLIMPEXP_FWD_CORE wxStaticText;
class wxPrintPageMaxCtrl;
class wxPrintPageTextCtrl;

//----------------------------------------------------------------------------
// error consts
//----------------------------------------------------------------------------

enum wxPrinterError
{
    wxPRINTER_NO_ERROR = 0,
    wxPRINTER_CANCELLED,
    wxPRINTER_ERROR
};

// Preview frame modality kind used with wxPreviewFrame::Initialize()
enum wxPreviewFrameModalityKind
{
    // Disable all the other top level windows while the preview is shown.
    wxPreviewFrame_AppModal,

    // Disable only the parent window while the preview is shown.
    wxPreviewFrame_WindowModal,

    // Don't disable any windows.
    wxPreviewFrame_NonModal
};

//----------------------------------------------------------------------------
// wxPrintFactory
//----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPrintFactory
{
public:
    wxPrintFactory() {}
    virtual ~wxPrintFactory() {}

    virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0;

    virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
                                                    wxPrintout *printout = NULL,
                                                    wxPrintDialogData *data = NULL ) = 0;
    virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
                                                    wxPrintout *printout,
                                                    wxPrintData *data ) = 0;

    virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
                                                  wxPrintDialogData *data = NULL ) = 0;
    virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
                                                  wxPrintData *data ) = 0;

    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
                                                          wxPageSetupDialogData * data = NULL ) = 0;

    virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0;

    // What to do and what to show in the wxPrintDialog
    // a) Use the generic print setup dialog or a native one?
    virtual bool HasPrintSetupDialog() = 0;
    virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0;
    // b) Provide the "print to file" option ourselves or via print setup?
    virtual bool HasOwnPrintToFile() = 0;
    // c) Show current printer
    virtual bool HasPrinterLine() = 0;
    virtual wxString CreatePrinterLine() = 0;
    // d) Show Status line for current printer?
    virtual bool HasStatusLine() = 0;
    virtual wxString CreateStatusLine() = 0;

    virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0;

    static void SetPrintFactory( wxPrintFactory *factory );
    static wxPrintFactory *GetFactory();
private:
    static wxPrintFactory *m_factory;
};

class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory
{
public:
    virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );

    virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
                                                    wxPrintout *printout = NULL,
                                                    wxPrintDialogData *data = NULL );
    virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
                                                    wxPrintout *printout,
                                                    wxPrintData *data );

    virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
                                                  wxPrintDialogData *data = NULL );
    virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
                                                  wxPrintData *data );

    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
                                                          wxPageSetupDialogData * data = NULL );

    virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );

    virtual bool HasPrintSetupDialog();
    virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
    virtual bool HasOwnPrintToFile();
    virtual bool HasPrinterLine();
    virtual wxString CreatePrinterLine();
    virtual bool HasStatusLine();
    virtual wxString CreateStatusLine();

    virtual wxPrintNativeDataBase *CreatePrintNativeData();
};

//----------------------------------------------------------------------------
// wxPrintNativeDataBase
//----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPrintNativeDataBase: public wxObject
{
public:
    wxPrintNativeDataBase();
    virtual ~wxPrintNativeDataBase() {}

    virtual bool TransferTo( wxPrintData &data ) = 0;
    virtual bool TransferFrom( const wxPrintData &data ) = 0;

    virtual bool Ok() const { return IsOk(); }
    virtual bool IsOk() const = 0;

    int  m_ref;

private:
    DECLARE_CLASS(wxPrintNativeDataBase)
    wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase);
};

//----------------------------------------------------------------------------
// wxPrinterBase
//----------------------------------------------------------------------------

/*
 * Represents the printer: manages printing a wxPrintout object
 */

class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject
{
public:
    wxPrinterBase(wxPrintDialogData *data = NULL);
    virtual ~wxPrinterBase();

    virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
    virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);

    virtual wxPrintDialogData& GetPrintDialogData() const;
    bool GetAbort() const { return sm_abortIt; }

    static wxPrinterError GetLastError() { return sm_lastError; }

    ///////////////////////////////////////////////////////////////////////////
    // OVERRIDES

    virtual bool Setup(wxWindow *parent) = 0;
    virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0;
    virtual wxDC* PrintDialog(wxWindow *parent) = 0;

protected:
    wxPrintDialogData     m_printDialogData;
    wxPrintout*           m_currentPrintout;

    static wxPrinterError sm_lastError;

public:
    static wxWindow*      sm_abortWindow;
    static bool           sm_abortIt;

private:
    DECLARE_CLASS(wxPrinterBase)
    wxDECLARE_NO_COPY_CLASS(wxPrinterBase);
};

//----------------------------------------------------------------------------
// wxPrinter
//----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase
{
public:
    wxPrinter(wxPrintDialogData *data = NULL);
    virtual ~wxPrinter();

    virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
    virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);

    virtual bool Setup(wxWindow *parent);
    virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
    virtual wxDC* PrintDialog(wxWindow *parent);

    virtual wxPrintDialogData& GetPrintDialogData() const;

protected:
    wxPrinterBase    *m_pimpl;

private:
    DECLARE_CLASS(wxPrinter)
    wxDECLARE_NO_COPY_CLASS(wxPrinter);
};

//----------------------------------------------------------------------------
// wxPrintout
//----------------------------------------------------------------------------

/*
 * Represents an object via which a document may be printed.
 * The programmer derives from this, overrides (at least) OnPrintPage,
 * and passes it to a wxPrinter object for printing, or a wxPrintPreview
 * object for previewing.
 */

class WXDLLIMPEXP_CORE wxPrintout: public wxObject
{
public:
    wxPrintout(const wxString& title = wxGetTranslation("Printout"));
    virtual ~wxPrintout();

    virtual bool OnBeginDocument(int startPage, int endPage);
    virtual void OnEndDocument();
    virtual void OnBeginPrinting();
    virtual void OnEndPrinting();

    // Guaranteed to be before any other functions are called
    virtual void OnPreparePrinting() { }

    virtual bool HasPage(int page);
    virtual bool OnPrintPage(int page) = 0;
    virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);

    virtual wxString GetTitle() const { return m_printoutTitle; }

    wxDC *GetDC() const { return m_printoutDC; }
    void SetDC(wxDC *dc) { m_printoutDC = dc; }

    void FitThisSizeToPaper(const wxSize& imageSize);
    void FitThisSizeToPage(const wxSize& imageSize);
    void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData);
    void MapScreenSizeToPaper();
    void MapScreenSizeToPage();
    void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
    void MapScreenSizeToDevice();

    wxRect GetLogicalPaperRect() const;
    wxRect GetLogicalPageRect() const;
    wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const;

    void SetLogicalOrigin(wxCoord x, wxCoord y);
    void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff);

    void SetPageSizePixels(int w, int  h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
    void GetPageSizePixels(int *w, int  *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
    void SetPageSizeMM(int w, int  h) { m_pageWidthMM = w; m_pageHeightMM = h; }
    void GetPageSizeMM(int *w, int  *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }

    void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
    void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); }
    void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
    void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
    void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); }
    void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }

    void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; }
    wxRect GetPaperRectPixels() const { return m_paperRectPixels; }

    // This must be called by wxPrintPreview to associate itself with the
    // printout it uses.
    virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; }

    wxPrintPreview *GetPreview() const { return m_preview; }
    virtual bool IsPreview() const { return GetPreview() != NULL; }

private:
    wxString         m_printoutTitle;
    wxDC*            m_printoutDC;
    wxPrintPreview  *m_preview;

    int              m_pageWidthPixels;
    int              m_pageHeightPixels;

    int              m_pageWidthMM;
    int              m_pageHeightMM;

    int              m_PPIScreenX;
    int              m_PPIScreenY;
    int              m_PPIPrinterX;
    int              m_PPIPrinterY;

    wxRect           m_paperRectPixels;

private:
    DECLARE_ABSTRACT_CLASS(wxPrintout)
    wxDECLARE_NO_COPY_CLASS(wxPrintout);
};

//----------------------------------------------------------------------------
// wxPreviewCanvas
//----------------------------------------------------------------------------

/*
 * Canvas upon which a preview is drawn.
 */

class WXDLLIMPEXP_CORE wxPreviewCanvas: public wxScrolledWindow
{
public:
    wxPreviewCanvas(wxPrintPreviewBase *preview,
                    wxWindow *parent,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& size = wxDefaultSize,
                    long style = 0,
                    const wxString& name = wxT("canvas"));
    virtual ~wxPreviewCanvas();

    void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; }

    void OnPaint(wxPaintEvent& event);
    void OnChar(wxKeyEvent &event);
    // Responds to colour changes
    void OnSysColourChanged(wxSysColourChangedEvent& event);

private:
#if wxUSE_MOUSEWHEEL
    void OnMouseWheel(wxMouseEvent& event);
#endif // wxUSE_MOUSEWHEEL
    void OnIdle(wxIdleEvent& event);

    wxPrintPreviewBase* m_printPreview;

    DECLARE_CLASS(wxPreviewCanvas)
    DECLARE_EVENT_TABLE()
    wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas);
};

//----------------------------------------------------------------------------
// wxPreviewFrame
//----------------------------------------------------------------------------

/*
 * Default frame for showing preview.
 */

class WXDLLIMPEXP_CORE wxPreviewFrame: public wxFrame
{
public:
    wxPreviewFrame(wxPrintPreviewBase *preview,
                   wxWindow *parent,
                   const wxString& title = wxGetTranslation("Print Preview"),
                   const wxPoint& pos = wxDefaultPosition,
                   const wxSize& size = wxDefaultSize,
                   long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
                   const wxString& name = wxFrameNameStr);
    virtual ~wxPreviewFrame();

    // Either Initialize() or InitializeWithModality() must be called before
    // showing the preview frame, the former being just a particular case of
    // the latter initializing the frame for being showing app-modally.

    // Notice that we must keep Initialize() with its existing signature to
    // avoid breaking the old code that overrides it and we can't reuse the
    // same name for the other functions to avoid virtual function hiding
    // problem and the associated warnings given by some compilers (e.g. from
    // g++ with -Woverloaded-virtual).
    virtual void Initialize()
    {
        InitializeWithModality(wxPreviewFrame_AppModal);
    }

    // Also note that this method is not virtual as it doesn't need to be
    // overridden: it's never called by wxWidgets (of course, the same is true
    // for Initialize() but, again, it must remain virtual for compatibility).
    void InitializeWithModality(wxPreviewFrameModalityKind kind);

    void OnCloseWindow(wxCloseEvent& event);
    virtual void CreateCanvas();
    virtual void CreateControlBar();

    inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; }

protected:
    wxPreviewCanvas*      m_previewCanvas;
    wxPreviewControlBar*  m_controlBar;
    wxPrintPreviewBase*   m_printPreview;
    wxWindowDisabler*     m_windowDisabler;

    wxPreviewFrameModalityKind m_modalityKind;

private:
    void OnChar(wxKeyEvent& event);

    DECLARE_EVENT_TABLE()
    DECLARE_CLASS(wxPreviewFrame)
    wxDECLARE_NO_COPY_CLASS(wxPreviewFrame);
};

//----------------------------------------------------------------------------
// wxPreviewControlBar
//----------------------------------------------------------------------------

/*
 * A panel with buttons for controlling a print preview.
 * The programmer may wish to use other means for controlling
 * the print preview.
 */

#define wxPREVIEW_PRINT        1
#define wxPREVIEW_PREVIOUS     2
#define wxPREVIEW_NEXT         4
#define wxPREVIEW_ZOOM         8
#define wxPREVIEW_FIRST       16
#define wxPREVIEW_LAST        32
#define wxPREVIEW_GOTO        64

#define wxPREVIEW_DEFAULT  (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
                            |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)

// Ids for controls
#define wxID_PREVIEW_CLOSE      1
#define wxID_PREVIEW_NEXT       2
#define wxID_PREVIEW_PREVIOUS   3
#define wxID_PREVIEW_PRINT      4
#define wxID_PREVIEW_ZOOM       5
#define wxID_PREVIEW_FIRST      6
#define wxID_PREVIEW_LAST       7
#define wxID_PREVIEW_GOTO       8
#define wxID_PREVIEW_ZOOM_IN    9
#define wxID_PREVIEW_ZOOM_OUT   10

class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel
{
    DECLARE_CLASS(wxPreviewControlBar)

public:
    wxPreviewControlBar(wxPrintPreviewBase *preview,
                        long buttons,
                        wxWindow *parent,
                        const wxPoint& pos = wxDefaultPosition,
                        const wxSize& size = wxDefaultSize,
                        long style = wxTAB_TRAVERSAL,
                        const wxString& name = wxT("panel"));
    virtual ~wxPreviewControlBar();

    virtual void CreateButtons();
    virtual void SetPageInfo(int minPage, int maxPage);
    virtual void SetZoomControl(int zoom);
    virtual int GetZoomControl();
    virtual wxPrintPreviewBase *GetPrintPreview() const
        { return m_printPreview; }

    // Implementation only from now on.
    void OnWindowClose(wxCommandEvent& event);
    void OnNext();
    void OnPrevious();
    void OnFirst();
    void OnLast();
    void OnGotoPage();
    void OnPrint();

    void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
    void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
    void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
    void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
    void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); }
    void OnPaint(wxPaintEvent& event);

    void OnUpdateNextButton(wxUpdateUIEvent& event)
        { event.Enable(IsNextEnabled()); }
    void OnUpdatePreviousButton(wxUpdateUIEvent& event)
        { event.Enable(IsPreviousEnabled()); }
    void OnUpdateFirstButton(wxUpdateUIEvent& event)
        { event.Enable(IsFirstEnabled()); }
    void OnUpdateLastButton(wxUpdateUIEvent& event)
        { event.Enable(IsLastEnabled()); }
    void OnUpdateZoomInButton(wxUpdateUIEvent& event)
        { event.Enable(IsZoomInEnabled()); }
    void OnUpdateZoomOutButton(wxUpdateUIEvent& event)
        { event.Enable(IsZoomOutEnabled()); }

    // These methods are not private because they are called by wxPreviewCanvas.
    void DoZoomIn();
    void DoZoomOut();

protected:
    wxPrintPreviewBase*   m_printPreview;
    wxButton*             m_closeButton;
    wxChoice*             m_zoomControl;
    wxPrintPageTextCtrl*  m_currentPageText;
    wxPrintPageMaxCtrl*   m_maxPageText;

    long                  m_buttonFlags;

private:
    void DoGotoPage(int page);

    void DoZoom();

    bool IsNextEnabled() const;
    bool IsPreviousEnabled() const;
    bool IsFirstEnabled() const;
    bool IsLastEnabled() const;
    bool IsZoomInEnabled() const;
    bool IsZoomOutEnabled() const;

    void OnZoomInButton(wxCommandEvent & WXUNUSED(event)) { DoZoomIn(); }
    void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); }
    void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); }

    DECLARE_EVENT_TABLE()
    wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar);
};

//----------------------------------------------------------------------------
// wxPrintPreviewBase
//----------------------------------------------------------------------------

/*
 * Programmer creates an object of this class to preview a wxPrintout.
 */

class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject
{
public:
    wxPrintPreviewBase(wxPrintout *printout,
                       wxPrintout *printoutForPrinting = NULL,
                       wxPrintDialogData *data = NULL);
    wxPrintPreviewBase(wxPrintout *printout,
                       wxPrintout *printoutForPrinting,
                       wxPrintData *data);
    virtual ~wxPrintPreviewBase();

    virtual bool SetCurrentPage(int pageNum);
    virtual int GetCurrentPage() const;

    virtual void SetPrintout(wxPrintout *printout);
    virtual wxPrintout *GetPrintout() const;
    virtual wxPrintout *GetPrintoutForPrinting() const;

    virtual void SetFrame(wxFrame *frame);
    virtual void SetCanvas(wxPreviewCanvas *canvas);

    virtual wxFrame *GetFrame() const;
    virtual wxPreviewCanvas *GetCanvas() const;

    // This is a helper routine, used by the next 4 routines.

    virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect);

    // The preview canvas should call this from OnPaint
    virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);

    // Updates rendered page by calling RenderPage() if needed, returns true
    // if there was some change. Preview canvas should call it at idle time
    virtual bool UpdatePageRendering();

    // This draws a blank page onto the preview canvas
    virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);

    // Adjusts the scrollbars for the current scale
    virtual void AdjustScrollbars(wxPreviewCanvas *canvas);

    // This is called by wxPrintPreview to render a page into a wxMemoryDC.
    virtual bool RenderPage(int pageNum);

    virtual void SetZoom(int percent);
    virtual int GetZoom() const;

    virtual wxPrintDialogData& GetPrintDialogData();

    virtual int GetMaxPage() const;
    virtual int GetMinPage() const;

    virtual bool Ok() const { return IsOk(); }
    virtual bool IsOk() const;
    virtual void SetOk(bool ok);

    ///////////////////////////////////////////////////////////////////////////
    // OVERRIDES

    // If we own a wxPrintout that can be used for printing, this
    // will invoke the actual printing procedure. Called
    // by the wxPreviewControlBar.
    virtual bool Print(bool interactive) = 0;

    // Calculate scaling that needs to be done to get roughly
    // the right scaling for the screen pretending to be
    // the currently selected printer.
    virtual void DetermineScaling() = 0;

protected:
    // helpers for RenderPage():
    virtual bool RenderPageIntoDC(wxDC& dc, int pageNum);
    // renders preview into m_previewBitmap
    virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);

    void InvalidatePreviewBitmap();

protected:
    wxPrintDialogData m_printDialogData;
    wxPreviewCanvas*  m_previewCanvas;
    wxFrame*          m_previewFrame;
    wxBitmap*         m_previewBitmap;
    bool              m_previewFailed;
    wxPrintout*       m_previewPrintout;
    wxPrintout*       m_printPrintout;
    int               m_currentPage;
    int               m_currentZoom;
    float             m_previewScaleX;
    float             m_previewScaleY;
    int               m_topMargin;
    int               m_leftMargin;
    int               m_pageWidth;
    int               m_pageHeight;
    int               m_minPage;
    int               m_maxPage;

    bool              m_isOk;
    bool              m_printingPrepared; // Called OnPreparePrinting?

private:
    void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);

    wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase);
    DECLARE_CLASS(wxPrintPreviewBase)
};

//----------------------------------------------------------------------------
// wxPrintPreview
//----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase
{
public:
    wxPrintPreview(wxPrintout *printout,
                   wxPrintout *printoutForPrinting = NULL,
                   wxPrintDialogData *data = NULL);
    wxPrintPreview(wxPrintout *printout,
                   wxPrintout *printoutForPrinting,
                   wxPrintData *data);
    virtual ~wxPrintPreview();

    virtual bool SetCurrentPage(int pageNum);
    virtual int GetCurrentPage() const;
    virtual void SetPrintout(wxPrintout *printout);
    virtual wxPrintout *GetPrintout() const;
    virtual wxPrintout *GetPrintoutForPrinting() const;
    virtual void SetFrame(wxFrame *frame);
    virtual void SetCanvas(wxPreviewCanvas *canvas);

    virtual wxFrame *GetFrame() const;
    virtual wxPreviewCanvas *GetCanvas() const;
    virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
    virtual bool UpdatePageRendering();
    virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
    virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
    virtual bool RenderPage(int pageNum);
    virtual void SetZoom(int percent);
    virtual int GetZoom() const;

    virtual bool Print(bool interactive);
    virtual void DetermineScaling();

    virtual wxPrintDialogData& GetPrintDialogData();

    virtual int GetMaxPage() const;
    virtual int GetMinPage() const;

    virtual bool Ok() const { return IsOk(); }
    virtual bool IsOk() const;
    virtual void SetOk(bool ok);

private:
    wxPrintPreviewBase *m_pimpl;

private:
    DECLARE_CLASS(wxPrintPreview)
    wxDECLARE_NO_COPY_CLASS(wxPrintPreview);
};

//----------------------------------------------------------------------------
// wxPrintAbortDialog
//----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
{
public:
    wxPrintAbortDialog(wxWindow *parent,
                       const wxString& documentTitle,
                       const wxPoint& pos = wxDefaultPosition,
                       const wxSize& size = wxDefaultSize,
                       long style = wxDEFAULT_DIALOG_STYLE,
                       const wxString& name = wxT("dialog"));

    void SetProgress(int currentPage, int totalPages,
                     int currentCopy, int totalCopies);

    void OnCancel(wxCommandEvent& event);

private:
    wxStaticText *m_progress;

    DECLARE_EVENT_TABLE()
    wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog);
};

#endif // wxUSE_PRINTING_ARCHITECTURE

#endif
    // _WX_PRNTBASEH__


text:
using System.Collections.Generic;
using TeamleaderDotNet.Utils;

namespace TeamleaderDotNet.Crm
{
    public class Contact : Entity
    {

        [TeamleaderDataType(Name = "contact_id")]
        public int Id { get; set; }

        [TeamleaderDataType(Name = "forename")]
        public string Forename { get; set; }

        [TeamleaderDataType(Name = "surname")]
        public string Surname { get; set; }

        [TeamleaderDataType(Name = "email")]
        public string Email { get; set; }

        [TeamleaderDataType(Name = "telephone")]
        public string Telephone { get; set; }

        [TeamleaderDataType(Name = "gsm")]
        public string Gsm { get; set; }

        [TeamleaderDataType(Name = "fax")]
        public string Fax { get; set; }

        [TeamleaderDataType(Name = "website")]
        public string Website { get; set; }

        [TeamleaderDataType(Name = "street")]
        public string Street { get; set; }

        [TeamleaderDataType(Name = "number")]
        public string Number { get; set; }

        [TeamleaderDataType(Name = "zipcode")]
        public string Zipcode { get; set; }

        [TeamleaderDataType(Name = "city")]
        public string City { get; set; }

        [TeamleaderDataType(Name = "country")]
        public string Country { get; set; }

        [TeamleaderDataType(Name = "extraaddresses")]
        public string[] ExtraAddresses { get; set; }

        [TeamleaderDataType(Name = "language")]
        public string Language { get; set; }

        [TeamleaderDataType(Name = "gender")]
        public string Gender { get; set; }

        [TeamleaderDataType(Name = "dob")]
        public int Dob { get; set; }

        [TeamleaderDataType(Name = "iban")]
        public string Iban { get; set; }

        [TeamleaderDataType(Name = "bic")]
        public string Bic { get; set; }

        [TeamleaderDataType(Name = "dateadded")]
        public int DateAdded { get; set; }

        [TeamleaderDataType(Name = "dateedited")]
        public int DateEdited { get; set; }

        [TeamleaderDataType(Name = "deleted")]
        public bool Deleted { get; set; }

        [TeamleaderDataType(Name = "status")]
        public string Status { get; set; }

        public string[] CustomFields { get; set; }

        [TeamleaderDataType(Name = "getLinkedCompanyIds")]
        public string[] LinkedCompanyIds { get; set; }

        public string[] Tags { get; set; }

    }
}


text:
package de._125m125.kt.ktapi.websocket.responses.parsers;

import java.util.Optional;

import com.google.gson.Gson;
import com.google.gson.JsonObject;

import de._125m125.kt.ktapi.websocket.responses.ResponseMessage;

public class ResponseMessageParser implements WebsocketMessageParser<ResponseMessage> {

    @Override
    public boolean parses(final String raw, final Optional<JsonObject> json) {
        return json.filter(j -> j.has("rid")).isPresent();
    }

    @Override
    public ResponseMessage parse(final String raw, final Optional<JsonObject> json) {
        return new Gson().fromJson(json.get(), ResponseMessage.class);
    }

}


text:
Add this line to your application's Gemfile:

    gem 'i'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install i

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
<?php

namespace Alchemist\Console\Command;

use Alchemist\Console\Utils\ConsoleUtils;
use Alchemist\DistantSource\GithubSourceManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Alchemist\Template;

/**
 * @author Lukáš Drahník (http://ldrahnik.com)
 */
class LoadGithubSourcesCommand extends Command
{

    /** @var GithubSourceManager $manager */
    private $githubSourceManager;

    /**
     * @param GithubSourceManager $manager
     */
    public function __construct(
        GithubSourceManager $githubSourceManager
    )
    {
        parent::__construct();
        $this->githubSourceManager = $githubSourceManager;
    }

    protected function configure()
    {
        $this
            ->setName('load-github-sources')
            ->setDescription('Load github sources')
            ->setDefinition(array(
                new InputArgument('username', InputArgument::REQUIRED, 'Github username'),
                new InputOption('template', 't', InputOption::VALUE_REQUIRED, 'Template name'),
                new InputOption('token', 'token', InputOption::VALUE_REQUIRED, 'Github token associated with given username'),
                new InputOption('projects-dir', 'd', InputOption::VALUE_REQUIRED, 'Projects dir'),
                new InputOption('install', 'i', InputOption::VALUE_NONE, 'Install projects'),
                new InputOption('force', 'f', InputOption::VALUE_NONE, 'Re-create alredy existing project'),
                new InputOption('suppress', 's', InputOption::VALUE_NONE, 'Suppress re-create already existing projects'),
                new InputOption('save', 'save', InputOption::VALUE_NONE, 'Save given github username, token'),
            ));
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $manager = $this->githubSourceManager;

        $username = $input->getArgument('username');
        $template = $input->getOption('template');
        $projectsDir = $input->getOption('projects-dir');
        $install = $input->getOption('install');
        $force = $input->getOption('force');
        $suppress = $input->getOption('suppress');
        $save = $input->getOption('save');
        $token = $input->getOption('token');

        if($force && $suppress) {
            throw new \InvalidArgumentException("Option -f [force] & -s [suppress] can not be set up together.");
        }

        $result = $manager->loadGithubSources($username, $token, $projectsDir, $template, $install, $force, $suppress, $save);

        ConsoleUtils::writeln($result, $output);

        return 0;
    }

}


text:
'use strict';

import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, RequestType, DocumentRangeFormattingRequest, Disposable, DocumentSelector } from 'vscode-languageserver';
import { DocumentContext } from 'vscode-html-languageservice';
import { TextDocument, Diagnostic, DocumentLink, Range, SymbolInformation } from 'vscode-languageserver-types';
import { getLanguageModes, LanguageModes } from './modes/languageModes';

import { format } from './modes/formatting';

import * as url from 'url';
import * as path from 'path';
import uri from 'vscode-uri';

import * as nls from 'vscode-nls';
nls.config(process.env['VSCODE_NLS_CONFIG']);

namespace ColorSymbolRequest {
	export const type: RequestType<string, Range[], any, any> = new RequestType('css/colorSymbols');
}

// Create a connection for the server
let connection: IConnection = createConnection();

console.log = connection.console.log.bind(connection.console);
console.error = connection.console.error.bind(connection.console);

// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);

let workspacePath: string;
var languageModes: LanguageModes;
var settings: any = {};

let clientSnippetSupport = false;
let clientDynamicRegisterSupport = false;

// After the server has started the client sends an initilize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilites
connection.onInitialize((params: InitializeParams): InitializeResult => {
	let initializationOptions = params.initializationOptions;

	workspacePath = params.rootPath;

	languageModes = getLanguageModes(initializationOptions ? initializationOptions.embeddedLanguages : { css: true, javascript: true });
	documents.onDidClose(e => {
		languageModes.onDocumentRemoved(e.document);
	});
	connection.onShutdown(() => {
		languageModes.dispose();
	});

	function hasClientCapability(...keys: string[]) {
		let c = params.capabilities;
		for (let i = 0; c && i < keys.length; i++) {
			c = c[keys[i]];
		}
		return !!c;
	}

	clientSnippetSupport = hasClientCapability('textDocument', 'completion', 'completionItem', 'snippetSupport');
	clientDynamicRegisterSupport = hasClientCapability('workspace', 'symbol', 'dynamicRegistration');
	return {
		capabilities: {
			// Tell the client that the server works in FULL text document sync mode
			textDocumentSync: documents.syncKind,
			completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '=', '/'] } : null,
			hoverProvider: true,
			documentHighlightProvider: true,
			documentRangeFormattingProvider: false,
			documentLinkProvider: { resolveProvider: false },
			documentSymbolProvider: true,
			definitionProvider: true,
			signatureHelpProvider: { triggerCharacters: ['('] },
			referencesProvider: true,
		}
	};
});

let validation = {
	html: true,
	css: true,
	javascript: true
};

let formatterRegistration: Thenable<Disposable> = null;

// The settings have changed. Is send on server activation as well.
connection.onDidChangeConfiguration((change) => {
	settings = change.settings;
	let validationSettings = settings && settings.html && settings.html.validate || {};
	validation.css = validationSettings.styles !== false;
	validation.javascript = validationSettings.scripts !== false;

	languageModes.getAllModes().forEach(m => {
		if (m.configure) {
			m.configure(change.settings);
		}
	});
	documents.all().forEach(triggerValidation);

	// dynamically enable & disable the formatter
	if (clientDynamicRegisterSupport) {
		let enableFormatter = settings && settings.html && settings.html.format && settings.html.format.enable;
		if (enableFormatter) {
			if (!formatterRegistration) {
				let documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
				formatterRegistration = connection.client.register(DocumentRangeFormattingRequest.type, { documentSelector });
			}
		} else if (formatterRegistration) {
			formatterRegistration.then(r => r.dispose());
			formatterRegistration = null;
		}
	}

});

let pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {};
const validationDelayMs = 200;

// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(change => {
	triggerValidation(change.document);
});

// a document has closed: clear all diagnostics
documents.onDidClose(event => {
	cleanPendingValidation(event.document);
	connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
});

function cleanPendingValidation(textDocument: TextDocument): void {
	let request = pendingValidationRequests[textDocument.uri];
	if (request) {
		clearTimeout(request);
		delete pendingValidationRequests[textDocument.uri];
	}
}

function triggerValidation(textDocument: TextDocument): void {
	cleanPendingValidation(textDocument);
	pendingValidationRequests[textDocument.uri] = setTimeout(() => {
		delete pendingValidationRequests[textDocument.uri];
		validateTextDocument(textDocument);
	}, validationDelayMs);
}

function validateTextDocument(textDocument: TextDocument): void {
	let diagnostics: Diagnostic[] = [];
	if (textDocument.languageId === 'html') {
		languageModes.getAllModesInDocument(textDocument).forEach(mode => {
			if (mode.doValidation && validation[mode.getId()]) {
				pushAll(diagnostics, mode.doValidation(textDocument));
			}
		});
	}
	connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}

function pushAll<T>(to: T[], from: T[]) {
	if (from) {
		for (var i = 0; i < from.length; i++) {
			to.push(from[i]);
		}
	}
}

connection.onCompletion(textDocumentPosition => {
	let document = documents.get(textDocumentPosition.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
	if (mode && mode.doComplete) {
		if (mode.getId() !== 'html') {
			connection.telemetry.logEvent({ key: 'html.embbedded.complete', value: { languageId: mode.getId() } });
		}
		return mode.doComplete(document, textDocumentPosition.position);
	}
	return { isIncomplete: true, items: [] };
});

connection.onCompletionResolve(item => {
	let data = item.data;
	if (data && data.languageId && data.uri) {
		let mode = languageModes.getMode(data.languageId);
		let document = documents.get(data.uri);
		if (mode && mode.doResolve && document) {
			return mode.doResolve(document, item);
		}
	}
	return item;
});

connection.onHover(textDocumentPosition => {
	let document = documents.get(textDocumentPosition.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
	if (mode && mode.doHover) {
		return mode.doHover(document, textDocumentPosition.position);
	}
	return null;
});

connection.onDocumentHighlight(documentHighlightParams => {
	let document = documents.get(documentHighlightParams.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
	if (mode && mode.findDocumentHighlight) {
		return mode.findDocumentHighlight(document, documentHighlightParams.position);
	}
	return [];
});

connection.onDefinition(definitionParams => {
	let document = documents.get(definitionParams.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, definitionParams.position);
	if (mode && mode.findDefinition) {
		return mode.findDefinition(document, definitionParams.position);
	}
	return [];
});

connection.onReferences(referenceParams => {
	let document = documents.get(referenceParams.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, referenceParams.position);
	if (mode && mode.findReferences) {
		return mode.findReferences(document, referenceParams.position);
	}
	return [];
});

connection.onSignatureHelp(signatureHelpParms => {
	let document = documents.get(signatureHelpParms.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
	if (mode && mode.doSignatureHelp) {
		return mode.doSignatureHelp(document, signatureHelpParms.position);
	}
	return null;
});

connection.onDocumentRangeFormatting(formatParams => {
	let document = documents.get(formatParams.textDocument.uri);

	let unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
	let enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };

	return format(languageModes, document, formatParams.range, formatParams.options, enabledModes);
});

connection.onDocumentLinks(documentLinkParam => {
	let document = documents.get(documentLinkParam.textDocument.uri);
	let documentContext: DocumentContext = {
		resolveReference: ref => {
			if (workspacePath && ref[0] === '/') {
				return uri.file(path.join(workspacePath, ref)).toString();
			}
			return url.resolve(document.uri, ref);
		}
	};
	let links: DocumentLink[] = [];
	languageModes.getAllModesInDocument(document).forEach(m => {
		if (m.findDocumentLinks) {
			pushAll(links, m.findDocumentLinks(document, documentContext));
		}
	});
	return links;
});

connection.onDocumentSymbol(documentSymbolParms => {
	let document = documents.get(documentSymbolParms.textDocument.uri);
	let symbols: SymbolInformation[] = [];
	languageModes.getAllModesInDocument(document).forEach(m => {
		if (m.findDocumentSymbols) {
			pushAll(symbols, m.findDocumentSymbols(document));
		}
	});
	return symbols;
});

connection.onRequest(ColorSymbolRequest.type, uri => {
	let ranges: Range[] = [];
	let document = documents.get(uri);
	if (document) {
		languageModes.getAllModesInDocument(document).forEach(m => {
			if (m.findColorSymbols) {
				pushAll(ranges, m.findColorSymbols(document));
			}
		});
	}
	return ranges;
});

// Listen on the connection
connection.listen();


text:
/**
 * MLLib evaluation module
 * @module eclairjs/mllib/evaluation
 */
module.exports = function(kernelP) {
  return {
    BinaryClassificationMetrics: require('./BinaryClassificationMetrics.js')(kernelP),
    MulticlassMetrics: require('./MulticlassMetrics.js')(kernelP),
    RankingMetrics: require('./RankingMetrics.js')(kernelP),
    RegressionMetrics: require('./RegressionMetrics.js')(kernelP)
  };
};


text:
package ru.job4j.testcollectiont;

public class SweetPrice {
    public static void out(int price) {
        while(price < 50) {
            System.out.println(price);
        }
    }
}


text:
export default function Example() {
  return <DayPicker fixedWeeks />;
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>AADC: Cubic Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

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

AADC

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

 All Classes Namespaces Files Functions Variables Enumerations

Public Member Functions |
List of all members

Cubic Class Reference

Interpolates a given set of points using cubic spline fitting.
 More...

#include <cCubic.h>

Public Member Functions

 	Cubic (tInt n, vector< tFloat32 > x, vector< tFloat32 > y)

 	Class constructor.

 	~Cubic ()

 	m_class destructor

tFloat64 	getValue (tFloat64 x)

 	Returns an interpolated value.

Detailed Description

Interpolates a given set of points using cubic spline fitting.

Interpolates a given set of points using cubic spline fitting.

Definition at line 24 of file cCubic.h.

The documentation for this class was generated from the following file:

C:/Development/3510_AADC_ADTF/trunk/src/adtfBase/AADC_ADTF_BaseFilters/src/calibration/AADC_SignalCalibrationExt/cCubic.h

Cubic

Generated on Tue Sep 16 2014 14:13:26 for AADC by

     1.8.8


text:
package com.hazelcast.spi.impl.proxyservice.impl.operations;

import com.hazelcast.cache.CacheNotExistsException;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.spi.ExecutionService;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.spi.Operation;
import com.hazelcast.spi.impl.SpiDataSerializerHook;
import com.hazelcast.spi.impl.proxyservice.impl.ProxyInfo;
import com.hazelcast.spi.impl.proxyservice.impl.ProxyRegistry;
import com.hazelcast.spi.impl.proxyservice.impl.ProxyServiceImpl;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

public class PostJoinProxyOperation extends Operation implements IdentifiedDataSerializable {

    private Collection<ProxyInfo> proxies;

    public PostJoinProxyOperation() {
    }

    public PostJoinProxyOperation(Collection<ProxyInfo> proxies) {
        this.proxies = proxies;
    }

    @Override
    public void run() throws Exception {
        if (proxies == null || proxies.size() <= 0) {
            return;
        }

        NodeEngine nodeEngine = getNodeEngine();
        ProxyServiceImpl proxyService = getService();
        ExecutionService executionService = nodeEngine.getExecutionService();
        for (final ProxyInfo proxy : proxies) {
            final ProxyRegistry registry = proxyService.getOrCreateRegistry(proxy.getServiceName());

            try {
                executionService.execute(ExecutionService.SYSTEM_EXECUTOR, new CreateProxyTask(registry, proxy));
            } catch (Throwable t) {
                getLogger().warning("Cannot create proxy [" + proxy.getServiceName() + ":"
                        + proxy.getObjectName() + "]!", t);
            }
        }
    }

    @Override
    public String getServiceName() {
        return ProxyServiceImpl.SERVICE_NAME;
    }

    @Override
    public boolean returnsResponse() {
        return false;
    }

    @Override
    protected void writeInternal(ObjectDataOutput out) throws IOException {
        super.writeInternal(out);
        int len = proxies != null ? proxies.size() : 0;
        out.writeInt(len);
        if (len > 0) {
            for (ProxyInfo proxy : proxies) {
                out.writeUTF(proxy.getServiceName());
                out.writeObject(proxy.getObjectName());
                // writing as object for backward-compatibility
            }
        }
    }

    @Override
    protected void readInternal(ObjectDataInput in) throws IOException {
        super.readInternal(in);
        int len = in.readInt();
        if (len > 0) {
            proxies = new ArrayList<ProxyInfo>(len);
            for (int i = 0; i < len; i++) {
                ProxyInfo proxy = new ProxyInfo(in.readUTF(), (String) in.readObject());
                proxies.add(proxy);
            }
        }
    }

    @Override
    public int getFactoryId() {
        return SpiDataSerializerHook.F_ID;
    }

    @Override
    public int getId() {
        return SpiDataSerializerHook.POST_JOIN_PROXY;
    }

    private class CreateProxyTask implements Runnable {
        private final ProxyRegistry registry;
        private final ProxyInfo proxyInfo;

        CreateProxyTask(ProxyRegistry registry, ProxyInfo proxyInfo) {
            this.registry = registry;
            this.proxyInfo = proxyInfo;
        }

        @Override
        public void run() {
            try {
                registry.createProxy(proxyInfo.getObjectName(), false, true);
            } catch (CacheNotExistsException e) {
                // This can happen when cache destroy event is received
                // after cache config is replicated during join (pre-join)
                // but before cache proxy is created (post-join).
                getLogger().fine("Could not create Cache[" + proxyInfo.getObjectName()
                        + "]. It is already destroyed.", e);
            }
        }
    }
}


text:
<namespace>
  <id>gsmlgu_namespace</id>
  <prefix>gsmlgu</prefix>
  <uri>http://xmlns.geosciml.org/GeologicUnit/3.2</uri>
</namespace>


text:
import datetime
from unittest import TestCase
from unittest.mock import MagicMock, call, patch

from airflow import DAG
from airflow.providers.yandex.operators.yandexcloud_dataproc import (
    DataprocCreateClusterOperator, DataprocCreateHiveJobOperator, DataprocCreateMapReduceJobOperator,
    DataprocCreatePysparkJobOperator, DataprocCreateSparkJobOperator, DataprocDeleteClusterOperator,
)

# Airflow connection with type "yandexcloud"
CONNECTION_ID = 'yandexcloud_default'

# Name of the datacenter where Dataproc cluster will be created
AVAILABILITY_ZONE_ID = 'ru-central1-c'

CLUSTER_NAME = 'dataproc_cluster'
CLUSTER_IMAGE_VERSION = '1.1'

# https://cloud.yandex.com/docs/resource-manager/operations/folder/get-id
FOLDER_ID = 'my_folder_id'

# Subnetwork id should belong to the availability zone set above
SUBNET_ID = 'my_subnet_id'

# Dataproc cluster jobs will produce logs in specified s3 bucket
S3_BUCKET_NAME_FOR_LOGS = 'my_bucket_name'

# https://cloud.yandex.com/docs/iam/concepts/users/service-accounts
SERVICE_ACCOUNT_ID = 'my_service_account_id'

# https://cloud.yandex.com/docs/iam/concepts/authorization/oauth-token
OAUTH_TOKEN = 'my_oauth_token'

# Ssh public keys will be placed to Dataproc cluster nodes, allowing to get a root shell at the nodes
SSH_PUBLIC_KEYS = [
    'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQCxO38tKAJXIs9ivPxt7AYdfybgtAR1ow3Qkb9GPQ6wkFHQq'
    'cFDe6faKCxH6iDRteo4D8L8BxwzN42uZSB0nfmjkIxFTcEU3mFSXEbWByg78aoddMrAAjatyrhH1pON6P0='
]

class DataprocClusterCreateOperatorTest(TestCase):
    def setUp(self):
        dag_id = 'test_dag'
        self.dag = DAG(
            dag_id,
            default_args={
                'owner': 'airflow',
                'start_date': datetime.datetime.today(),
                'end_date': datetime.datetime.today() + datetime.timedelta(days=1),
            },
            schedule_interval='@daily'
        )

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.create_cluster')
    def test_create_cluster(self, create_cluster_mock, *_):
        operator = DataprocCreateClusterOperator(
            task_id='create_cluster',
            ssh_public_keys=SSH_PUBLIC_KEYS,
            folder_id=FOLDER_ID,
            subnet_id=SUBNET_ID,
            zone=AVAILABILITY_ZONE_ID,
            connection_id=CONNECTION_ID,
            s3_bucket=S3_BUCKET_NAME_FOR_LOGS,
            cluster_image_version=CLUSTER_IMAGE_VERSION,
        )
        context = {'task_instance': MagicMock()}
        operator.execute(context)
        create_cluster_mock.assert_called_once_with(
            cluster_description='',
            cluster_image_version='1.1',
            cluster_name=None,
            computenode_count=0,
            computenode_disk_size=15,
            computenode_disk_type='network-ssd',
            computenode_resource_preset='s2.small',
            datanode_count=2,
            datanode_disk_size=15,
            datanode_disk_type='network-ssd',
            datanode_resource_preset='s2.small',
            folder_id='my_folder_id',
            masternode_disk_size=15,
            masternode_disk_type='network-ssd',
            masternode_resource_preset='s2.small',
            s3_bucket='my_bucket_name',
            service_account_id=None,
            services=('HDFS', 'YARN', 'MAPREDUCE', 'HIVE', 'SPARK'),
            ssh_public_keys=[
                'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQCxO38tKAJXIs9ivPxt7AYdfybgtAR1ow3Qkb9GPQ6wkFHQqcFD'
                'e6faKCxH6iDRteo4D8L8BxwzN42uZSB0nfmjkIxFTcEU3mFSXEbWByg78aoddMrAAjatyrhH1pON6P0='
            ],
            subnet_id='my_subnet_id',
            zone='ru-central1-c'
        )
        context['task_instance'].xcom_push.assert_has_calls([
            call(key='cluster_id', value=create_cluster_mock().response.id),
            call(key='yandexcloud_connection_id', value=CONNECTION_ID),
        ])

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.delete_cluster')
    def test_delete_cluster_operator(self, delete_cluster_mock, *_):
        operator = DataprocDeleteClusterOperator(
            task_id='delete_cluster',
            connection_id=CONNECTION_ID,
        )
        context = {'task_instance': MagicMock()}
        context['task_instance'].xcom_pull.return_value = 'my_cluster_id'
        operator.execute(context)
        context['task_instance'].xcom_pull.assert_called_once_with(key='cluster_id')
        delete_cluster_mock.assert_called_once_with('my_cluster_id')

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.create_hive_job')
    def test_create_hive_job_operator(self, create_hive_job_mock, *_):
        operator = DataprocCreateHiveJobOperator(
            task_id='create_hive_job',
            query='SELECT 1;',
        )
        context = {'task_instance': MagicMock()}
        context['task_instance'].xcom_pull.return_value = 'my_cluster_id'
        operator.execute(context)

        context['task_instance'].xcom_pull.assert_has_calls([
            call(key='cluster_id'),
            call(key='yandexcloud_connection_id'),
        ])

        create_hive_job_mock.assert_called_once_with(
            cluster_id='my_cluster_id',
            continue_on_failure=False,
            name='Hive job',
            properties=None,
            query='SELECT 1;',
            query_file_uri=None,
            script_variables=None,
        )

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.create_mapreduce_job')
    def test_create_mapreduce_job_operator(self, create_mapreduce_job_mock, *_):
        operator = DataprocCreateMapReduceJobOperator(
            task_id='run_mapreduce_job',
            main_class='org.apache.hadoop.streaming.HadoopStreaming',
            file_uris=[
                's3a://some-in-bucket/jobs/sources/mapreduce-001/mapper.py',
                's3a://some-in-bucket/jobs/sources/mapreduce-001/reducer.py'
            ],
            args=[
                '-mapper', 'mapper.py',
                '-reducer', 'reducer.py',
                '-numReduceTasks', '1',
                '-input', 's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2',
                '-output', 's3a://some-out-bucket/dataproc/job/results'
            ],
            properties={
                'yarn.app.mapreduce.am.resource.mb': '2048',
                'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
                'mapreduce.job.maps': '6',
            },
        )
        context = {'task_instance': MagicMock()}
        context['task_instance'].xcom_pull.return_value = 'my_cluster_id'
        operator.execute(context)

        context['task_instance'].xcom_pull.assert_has_calls([
            call(key='cluster_id'),
            call(key='yandexcloud_connection_id'),
        ])

        create_mapreduce_job_mock.assert_called_once_with(
            archive_uris=None,
            args=[
                '-mapper', 'mapper.py', '-reducer', 'reducer.py', '-numReduceTasks', '1', '-input',
                's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2', '-output',
                's3a://some-out-bucket/dataproc/job/results'
            ],
            cluster_id='my_cluster_id',
            file_uris=[
                's3a://some-in-bucket/jobs/sources/mapreduce-001/mapper.py',
                's3a://some-in-bucket/jobs/sources/mapreduce-001/reducer.py'
            ],
            jar_file_uris=None,
            main_class='org.apache.hadoop.streaming.HadoopStreaming',
            main_jar_file_uri=None,
            name='Mapreduce job',
            properties={
                'yarn.app.mapreduce.am.resource.mb': '2048',
                'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
                'mapreduce.job.maps': '6'
            }
        )

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.create_spark_job')
    def test_create_spark_job_operator(self, create_spark_job_mock, *_):
        operator = DataprocCreateSparkJobOperator(
            task_id='create_spark_job',
            main_jar_file_uri='s3a://data-proc-public/jobs/sources/java/dataproc-examples-1.0.jar',
            main_class='ru.yandex.cloud.dataproc.examples.PopulationSparkJob',
            file_uris=[
                's3a://some-in-bucket/jobs/sources/data/config.json',
            ],
            archive_uris=[
                's3a://some-in-bucket/jobs/sources/data/country-codes.csv.zip',
            ],
            jar_file_uris=[
                's3a://some-in-bucket/jobs/sources/java/icu4j-61.1.jar',
                's3a://some-in-bucket/jobs/sources/java/commons-lang-2.6.jar',
                's3a://some-in-bucket/jobs/sources/java/opencsv-4.1.jar',
                's3a://some-in-bucket/jobs/sources/java/json-20190722.jar'
            ],
            args=[
                's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2',
                's3a://some-out-bucket/dataproc/job/results/${{JOB_ID}}',
            ],
            properties={
                'spark.submit.deployMode': 'cluster',
            },
        )
        context = {'task_instance': MagicMock()}
        context['task_instance'].xcom_pull.return_value = 'my_cluster_id'
        operator.execute(context)

        context['task_instance'].xcom_pull.assert_has_calls([
            call(key='cluster_id'),
            call(key='yandexcloud_connection_id'),
        ])

        create_spark_job_mock.assert_called_once_with(
            archive_uris=['s3a://some-in-bucket/jobs/sources/data/country-codes.csv.zip'],
            args=[
                's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2',
                's3a://some-out-bucket/dataproc/job/results/${{JOB_ID}}'
            ],
            cluster_id='my_cluster_id',
            file_uris=['s3a://some-in-bucket/jobs/sources/data/config.json'],
            jar_file_uris=[
                's3a://some-in-bucket/jobs/sources/java/icu4j-61.1.jar',
                's3a://some-in-bucket/jobs/sources/java/commons-lang-2.6.jar',
                's3a://some-in-bucket/jobs/sources/java/opencsv-4.1.jar',
                's3a://some-in-bucket/jobs/sources/java/json-20190722.jar'
            ],
            main_class='ru.yandex.cloud.dataproc.examples.PopulationSparkJob',
            main_jar_file_uri='s3a://data-proc-public/jobs/sources/java/dataproc-examples-1.0.jar',
            name='Spark job',
            properties={'spark.submit.deployMode': 'cluster'}
        )

    @patch('airflow.providers.yandex.hooks.YandexCloudBaseHook._get_credentials')
    @patch('airflow.hooks.base_hook.BaseHook.get_connection')
    @patch('yandexcloud._wrappers.dataproc.Dataproc.create_pyspark_job')
    def test_create_pyspark_job_operator(self, create_pyspark_job_mock, *_):
        operator = DataprocCreatePysparkJobOperator(
            task_id='create_pyspark_job',
            main_python_file_uri='s3a://some-in-bucket/jobs/sources/pyspark-001/main.py',
            python_file_uris=[
                's3a://some-in-bucket/jobs/sources/pyspark-001/geonames.py',
            ],
            file_uris=[
                's3a://some-in-bucket/jobs/sources/data/config.json',
            ],
            archive_uris=[
                's3a://some-in-bucket/jobs/sources/data/country-codes.csv.zip',
            ],
            args=[
                's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2',
                's3a://some-out-bucket/jobs/results/${{JOB_ID}}',
            ],
            jar_file_uris=[
                's3a://some-in-bucket/jobs/sources/java/dataproc-examples-1.0.jar',
                's3a://some-in-bucket/jobs/sources/java/icu4j-61.1.jar',
                's3a://some-in-bucket/jobs/sources/java/commons-lang-2.6.jar',
            ],
            properties={
                'spark.submit.deployMode': 'cluster',
            },
        )
        context = {'task_instance': MagicMock()}
        context['task_instance'].xcom_pull.return_value = 'my_cluster_id'
        operator.execute(context)

        context['task_instance'].xcom_pull.assert_has_calls([
            call(key='cluster_id'),
            call(key='yandexcloud_connection_id'),
        ])

        create_pyspark_job_mock.assert_called_once_with(
            archive_uris=['s3a://some-in-bucket/jobs/sources/data/country-codes.csv.zip'],
            args=[
                's3a://some-in-bucket/jobs/sources/data/cities500.txt.bz2',
                's3a://some-out-bucket/jobs/results/${{JOB_ID}}'
            ],
            cluster_id='my_cluster_id',
            file_uris=['s3a://some-in-bucket/jobs/sources/data/config.json'],
            jar_file_uris=[
                's3a://some-in-bucket/jobs/sources/java/dataproc-examples-1.0.jar',
                's3a://some-in-bucket/jobs/sources/java/icu4j-61.1.jar',
                's3a://some-in-bucket/jobs/sources/java/commons-lang-2.6.jar'
            ],
            main_python_file_uri='s3a://some-in-bucket/jobs/sources/pyspark-001/main.py',
            name='Pyspark job',
            properties={'spark.submit.deployMode': 'cluster'},
            python_file_uris=['s3a://some-in-bucket/jobs/sources/pyspark-001/geonames.py']
        )


text:
Aggregator
==========

.. automodule:: hazelcast.aggregator


text:
@extends('layout.default')
@section('page-meta')
<title>Wiki: {!! $wiki_page['wiki_page_title'] !!} - Javul.org</title>
@endsection
@section('page-css')
    <link href="{!! url('assets/css/wiki.css') !!}" rel="stylesheet" type="text/css" />
@endsection
@section('content')
<link rel="stylesheet" type="text/css" href="{!! url('assets/css/forum.css') !!}">

        @include('elements.user-menu',['page'=>'units'])

            @include('units.partials.unit_information_left_table')

                    @include('elements.site_activities',['ajax'=>false])

 {!! $wiki_page['wiki_page_title'] !!}

                        + New Page |
                        Recent Changes |
                        List All Pages

                        Edit |
                        View History

{!! $wiki_page['page_content'] !!}

@include('elements.footer')
@stop
@section('page-scripts')
@endsection


text:
package gq.baijie.onetab.client.cli;

import javax.inject.Singleton;

import dagger.Component;
import gq.baijie.onetab.StorageService;
import gq.baijie.onetab.internal.storage.StorageModule;

@Singleton
@Component(modules = StorageModule.class)
public interface MainComponent {

  StorageService storageService();

}


text:
class AddProjectCounterCache < ActiveRecord::Migration
  def up
    add_column :projects, :likes_count, :integer
    add_column :projects, :memberships_count, :integer
  end

  def down
    remove_column :projects, :likes_count
    remove_column :projects, :memberships_count
  end

end