text:
package unsynchronized;
public class Bank {
	// Akif Hatipoðlu
	//Github Deneme11
	// accounts
	private final double[] hesap;

	// n=hesap no kaç hesap olacaði
	public Bank(int n, double baslangicbakiyesi) {

		hesap = new double[n];
		for (int i = 0; i < hesap.length; i++) {
			hesap[i] = baslangicbakiyesi;
		}
	}

	// kimden=>AMOUNT
	public void transfer(int kimden, int kime, double miktar) {
		if (hesap[kimden] < miktar) {
			return;
		}
		System.out.println(Thread.currentThread());

		hesap[kimden] -= miktar;

		System.out.println(miktar + " miktar para " + kimden + " den " + kime
				+ " gonderildi.");

		hesap[kime] += miktar;

		System.out.println("Toplam miktar: " + getToplamMiktar()
				+ " Gönderen kisinin bakiyesi: " + hesap[kimden]
				+ " Alan kisinin bakiyesi:" + hesap[kime]);
		System.out.println();
	}

	public double getToplamMiktar() {
		double toplam = 0;
		for (double a : hesap) {
			toplam += a;
		}
		return toplam;
	}

	public int size() {

		return hesap.length;

	}

}


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sun.facelets;

import java.io.IOException;

import javax.el.ELException;
import javax.faces.FacesException;

/**
 * FaceletFactory for producing Facelets relative to the context of the
 * underlying implementation.
 *
 * @author Jacob Hookom
 * @version $Id: FaceletFactory.java,v 1.4 2008/07/13 19:01:39 rlubke Exp $
 */
public abstract class FaceletFactory {

    private static ThreadLocal Instance = new ThreadLocal();

    /**
     * Return a Facelet instance as specified by the file at the passed URI.
     *
     * @param uri
     * @return
     * @throws IOException
     * @throws FaceletException
     * @throws FacesException
     * @throws ELException
     */
    public abstract Facelet getFacelet(String uri) throws IOException,
            FaceletException, FacesException, ELException;

    /**
     * Set the static instance
     *
     * @param factory
     */
    public static final void setInstance(FaceletFactory factory) {
        Instance.set(factory);
    }

    /**
     * Get the static instance
     *
     * @return
     */
    public static final FaceletFactory getInstance() {
        return (FaceletFactory) Instance.get();
    }
}

redpajama_set_name: RedPajamaGithub


text:
function pth = getDefaultSingularValueSubpath( obj )
% GETDEFAULTSINGULARVALUESUBPATH Get default singular value subpath of
% nlsaCocarianceOperator objects
%
% Modified 2014/08/07

pth = 'dataS';


text:
package org.wildfly.nosql.common;

import static org.jboss.logging.Logger.Level.ERROR;
import static org.jboss.logging.Logger.Level.DEBUG;
import static org.jboss.logging.Logger.Level.INFO;

import java.util.ArrayList;
import java.util.Collection;

import org.jboss.as.controller.OperationFailedException;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;

/**
 * NoSQLLogger
 *
 * @author Scott Marlow
 */
@MessageLogger(projectCode = "WFLYNOSQL", length = 4)
public interface NoSQLLogger extends BasicLogger {
    /**
     * Default root level logger with the package name for he category.
     */
    NoSQLLogger ROOT_LOGGER = Logger.getMessageLogger(NoSQLLogger.class, "org.wildfly.nosql");

    /**
     * Logs an error message indicating the driver failed to stop
     *
     * @param cause the cause of the error.
     */
    @LogMessage(level = ERROR)
    @Message(id = 1, value = "Failed to stop")
    void driverFailedToStop(@Cause Throwable cause);

    /**
     * Creates an exception
     * module to the deployment.
     *
     * @param module
     * @param currentValue
     * @param deploymentName
     * @return a {@link RuntimeException} for the error.
     */
    @Message(id = 2, value = "Cannot specify NoSQL module '%s' " +
            "when a different module '%s' is already associated with application (%s)")
    IllegalStateException cannotAddReferenceToModule(String module, Object currentValue, String deploymentName);

    /**
     * indicate that the annotation did not provide the attribute.
     *
     * @param annotation the annotation.
     * @param attribute  the attribute.
     * @return an {@link IllegalArgumentException} for the exception.
     */
    @LogMessage(level = DEBUG)
    @Message(id = 3, value = "Ignored %s annotation, does not have %s.")
    void annotationAttributeMissing(String annotation, String attribute);

    @Message(id = 4, value = "Cannot unwrap class '%s'.")
    IllegalArgumentException unassignable(Class clazz);

    @Message(id = 5, value = "Cannot set %s to %s.  Instead set to one of %s")
    OperationFailedException invalidParameter(String transaction, String str, ArrayList arrayList);

    @LogMessage(level = INFO)
    @Message(id = 6, value = "Ignored @Inject @Named(%s), does not reference known NoSQL profile name. Known NoSQL profile names=%s")
    void ignoringNamedQualifier(String profile, Collection<String> strings);

    @LogMessage(level = INFO)
    @Message(id = 7, value = "Scanned @Inject @Named reference to NoSQL profile %s, which refers to NoSQL module %s")
    void scannedNamedQualifier(String profile, String moduleName);

    @LogMessage(level = INFO)
    @Message(id = 8, value = "Ignored @Resource lookup %s, does not reference known NoSQL jndi-name. Known NoSQL jndi-names=%s")
    void ignoringResourceLookup(String lookup, Collection<String> strings);

    @LogMessage(level = INFO)
    @Message(id = 9, value = "Scanned @Resource lookup %s, which refers to NoSQL module %s")
    void scannedResourceLookup(String lookup, String moduleName);

}


text:
#pragma once

#include <iostream>
#include <list>

#include "trace_file.hpp"
#include "trace_format.hpp"
#include "trace_model.hpp"
#include "trace_api.hpp"

namespace trace {

struct ParseBookmark
{
    File::Offset offset;
    unsigned next_call_no;
};

class Parser
{
protected:
    File *file;

    enum Mode {
        FULL = 0,
        SCAN,
        SKIP
    };

    typedef std::list<Call *> CallList;
    CallList calls;

    struct FunctionSigFlags : public FunctionSig {
        CallFlags flags;
    };

    // Helper template that extends a base signature structure, with additional
    // parsing information.
    template< class T >
    struct SigState : public T {
        // Offset in the file of where signature was defined.  It is used when
        // reparsing to determine whether the signature definition is to be
        // expected next or not.
        File::Offset fileOffset;
    };

    typedef SigState<FunctionSigFlags> FunctionSigState;
    typedef SigState<StructSig> StructSigState;
    typedef SigState<EnumSig> EnumSigState;
    typedef SigState<BitmaskSig> BitmaskSigState;
    typedef SigState<StackFrame> StackFrameState;

    typedef std::vector<FunctionSigState *> FunctionMap;
    typedef std::vector<StructSigState *> StructMap;
    typedef std::vector<EnumSigState *> EnumMap;
    typedef std::vector<BitmaskSigState *> BitmaskMap;
    typedef std::vector<StackFrameState *> StackFrameMap;

    FunctionMap functions;
    StructMap structs;
    EnumMap enums;
    BitmaskMap bitmasks;
    StackFrameMap frames;

    FunctionSig *glGetErrorSig;

    unsigned next_call_no;

public:
    unsigned long long version;
    API api;

    Parser();

    ~Parser();

    bool open(const char *filename);

    void close(void);

    Call *parse_call(void) {
        return parse_call(FULL);
    }

    bool supportsOffsets() const
    {
        return file->supportsOffsets();
    }

    void getBookmark(ParseBookmark &bookmark);

    void setBookmark(const ParseBookmark &bookmark);

    int percentRead()
    {
        return file->percentRead();
    }

    Call *scan_call() {
        return parse_call(SCAN);
    }

protected:
    Call *parse_call(Mode mode);

    FunctionSigFlags *parse_function_sig(void);
    StructSig *parse_struct_sig();
    EnumSig *parse_old_enum_sig();
    EnumSig *parse_enum_sig();
    BitmaskSig *parse_bitmask_sig();

    static CallFlags
    lookupCallFlags(const char *name);

    Call *parse_Call(Mode mode);

    void parse_enter(Mode mode);

    Call *parse_leave(Mode mode);

    bool parse_call_details(Call *call, Mode mode);

    bool parse_call_backtrace(Call *call, Mode mode);
    StackFrame * parse_backtrace_frame(Mode mode);

    void adjust_call_flags(Call *call);

    void parse_arg(Call *call, Mode mode);

    Value *parse_value(void);
    void scan_value(void);
    inline Value *parse_value(Mode mode) {
        if (mode == FULL) {
            return parse_value();
        } else {
            scan_value();
            return NULL;
        }
    }

    Value *parse_sint();
    void scan_sint();

    Value *parse_uint();
    void scan_uint();

    Value *parse_float();
    void scan_float();

    Value *parse_double();
    void scan_double();

    Value *parse_string();
    void scan_string();

    Value *parse_enum();
    void scan_enum();

    Value *parse_bitmask();
    void scan_bitmask();

    Value *parse_array(void);
    void scan_array(void);

    Value *parse_blob(void);
    void scan_blob(void);

    Value *parse_struct();
    void scan_struct();

    Value *parse_opaque();
    void scan_opaque();

    Value *parse_repr();
    void scan_repr();

    Value *parse_wstring();
    void scan_wstring();

    const char * read_string(void);
    void skip_string(void);

    signed long long read_sint(void);
    void skip_sint(void);

    unsigned long long read_uint(void);
    void skip_uint(void);

    inline int read_byte(void);
    inline void skip_byte(void);
};

} /* namespace trace */


text:
module SuggestedTypesHelper
  def suggested_type_modal_boxes
    boxes = suggested_type_modal_box(@assay.assay_type_reader.ontology_term_type)
    boxes << suggested_type_modal_box(@assay.technology_type_reader.ontology_term_type) unless @assay.is_modelling?
    boxes
  end

  def suggested_type_modal_box(term_type)
    modal_id = "#{term_type.underscore.downcase}-new-term-modal"
    modal_options = { id: modal_id, size: 's', 'data-role' => 'create-new-suggested-type' }
    suggested_type = if term_type == 'technology'
                       SuggestedTechnologyType.new
                     else
                       SuggestedAssayType.new
                     end
    suggested_type.term_type = term_type

    modal_title = "New suggested #{term_type.humanize.downcase} type"

    modal(modal_options) do
      modal_header(modal_title) +
        modal_body do
          render partial: 'suggested_types/new_modal_type', locals: { suggested_type: suggested_type }
        end
    end
  end

  def create_suggested_type_popup_link(term_type)
    link_name = image('new') + ' ' + "New #{term_type.humanize.downcase} type"
    modal_id = "#{term_type.underscore.downcase}-new-term-modal"

    link_to(link_name, '#', 'data-toggle' => 'modal', 'data-target' => "##{modal_id}")
  end

  def create_or_update_text
    submit_button_text = action_name == 'edit' ? 'Update' : 'Create'
    submit_button_text
  end

  def all_types_text(join_word = 'and')
    model_class = controller_name.classify.constantize
    model_class.all_term_types.map { |type| type.split('_').join(' ') }.join(" #{join_word} ")
  end

  def cancel_link
    if is_ajax_request?
      link_to_function('Cancel', "$j('.modal:visible').modal('toggle');", class: 'btn btn-default')
    else
      manage_path = eval "#{controller_name}_path"
      cancel_button(manage_path)
    end
  end

  def ontology_editor_display(types, selected_uri = nil)
    list = []
    Array(types).each do |type|
      list += render_list(type, selected_uri)
    end
    list.join("\n").html_safe
  end

  def render_list(type, selected_uri = nil)
    reader = reader_for_type(type)
    classes = reader.class_hierarchy
    render_ontology_class_tree(classes, selected_uri)
  end

  def render_ontology_class_tree(clz, selected_uri, depth = 0)
    list = []
    uri = clz.uri.try(:to_s)
    clz_li = "
#{ontology_class_list_item(clz)}"
    list << clz_li
    list << '
' if clz.children.any?
    clz.children.each do |ontology_class_or_suggested_type|
      list += render_ontology_class_tree(ontology_class_or_suggested_type, selected_uri, depth + 1)
    end
    list << '
' if clz.children.any?
    list << '
'
    list
  end

  def ontology_class_list_item(clz)
    list_item = show_ontology_class_link(clz)
    list_item += '* ' if clz.suggested_type?
    list_item += edit_ontology_class_link(clz) + delete_ontology_class_link(clz) + related_assays_text(clz)
    list_item.html_safe
  end

  def related_assays_text(clz)
    count = clz.assays.size
    count == 0 ? '' : " (#{pluralize(count, 'assay')})".html_safe
  end

  def show_ontology_class_link(clz)
    label = clz.label
    type = clz.term_type
    raise 'error' if type.nil?
    path = send("#{type}_types_path", uri: clz.uri.try(:to_s), label: label)
    html_options = clz.suggested_type? ? { style: 'color:green;font-style:italic' } : {}
    link_to label, path, html_options
  end

  def edit_ontology_class_link(clz)
    link = if clz.can_edit?
             new_popup_request? ? popup_link_to_edit(clz) : normal_link_to_edit(clz)
           else
             ''
           end
    link.html_safe
  end

  def delete_ontology_class_link(clz)
    link = if clz.can_destroy?
             link_to image('destroy'), clz, data: { confirm: "Are you sure you want to remove this #{clz.term_type} type?  This cannot be undone." },
                                            method: :delete
           else
             ''
           end
    link.html_safe
  end

  def normal_link_to_edit(clz)
    link_to(image('edit'), send("edit_suggested_#{clz.term_type}_type_path", id: clz))
  end

  def popup_link_to_edit(clz)
    type = clz.term_type
    link_to_with_callbacks(image('edit'), html: { remote: true, method: :get },
                                          url: send("edit_suggested_#{type}_type_path", id: clz, term_type: type),
                                          method: :get,
                                          loading: "$('RB_redbox').scrollTo();Element.show('edit_suggested_type_spinner'); Element.hide('new_suggested_#{type}_type_form')",
                                          loaded: "Element.hide('edit_suggested_type_spinner'); Element.show('new_suggested_#{type}_type_form')")
  end

  def new_popup_request?
    action_name == 'new' && is_ajax_request?
  end

  def is_ajax_request?
    request.xhr?
  end
end


text:
<TITLE>Review for Abre los ojos (1997)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Abre los ojos (1997)

reviewed by
Steve Rhodes

OPEN YOUR EYES
A film review by Steve Rhodes
Copyright 1999 Steve Rhodes
RATING (0 TO ****):  ** 1/2

The rich and incredibly handsome playboy César (Eduardo Noriega) has
been horribly disfigured in a car accident.

Or has he?

To make his nightmare worse, he's been accused of murdering his
ex-girlfriend, Nuria (Najwa Nimri), a sexual predator straight out of
FATAL ATTRACTION.  Not only does he believe that he didn't murder her,
he has recently been confused by her claims that she is really his new
girlfriend, Sofía.  He knows and loves Sofía (Penélope Cruz), and she
doesn't look anything like Nuria.  Even his best friend, Pelayo (Fele
Martínez from THE LOVERS OF THE ARCTIC CIRCLE), doesn't believe him.

It is even suggested that César isn't disfigured at all.  Perhaps, he's
told, he's like those anorexic teenage girls who just think they're fat.

Welcome to the Escher world of writer and director Alejandro Amenábar's
OPEN YOUR EYES (ABRE LOS OJOS), a movie that delights in playing tricks
with our minds.  Dreams within dreams within dreams are some of its more
straightforward stratagems.  More baroque is the layering of cryogenics
onto virtual reality in this MASK meets THE TRUMAN SHOW meets EXISTENZ.

As a purposely-confusing mind game of what's real and what's a mirage,
the story has an undeniable attraction.  Like trying to finish the
Sunday crossword puzzle before your spouse, you're likely to stay glued
to the screen.  But when it's over, you won't have much more to take
away than the puzzle's solution.  The characters act like disconnected
figures in a video game.  They run through their lines as fast as they
can but never connect with each other.

The screenplay uses sexually charged settings to establish the story and
then lets it get bogged down with long discussions between César and his
prison psychiatrist, Antonio (Chete Lera).  The latter character should
have been eliminated entirely.

With its richly textured music and its striking cinematography, the
movie is a feast for the ears and eyes.  As the story drags and turns
increasingly bizarre, its handsome production makes up for many of its
shortfalls.  Never a bad movie, it's more of a near miss, unlike the
other recent Spanish film, THE LOVERS OF THE ARCTIC CIRCLE, which is
nearly perfect.  Both films play games with reality and time sequences.

César's experiences are just "one of those Candid Camera jokes,"
Antonio suggests.  Perhaps.

When they finally reveal the Big Secret in the end, you're liable to
just shake your head -- both because it's so ludicrous and because you
can easily and correctly write the epilogue.  The latter is so obvious
as to be trite.

OPEN YOUR EYES runs too long at 1:50.  The film is in rapid fire Spanish
with English subtitles.  It is rated R for sex, nudity, profanity and
violence and would be fine for older teenagers.

Email: Steve.Rhodes@InternetReviews.com
Web: www.InternetReviews.com

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<!--
Description: entry summary content value
Expect:      not bozo and entries[0]['summary_detail']['value'] == u'Example Atom'
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
  <summary>Example Atom</summary>
</entry>
</feed>


text:
<template name="accountRow">

        <input type="date" name="time" value="{{time}}"  placeholder="aaaa-mm-jj">
        <input type="text" name="title" value="{{title}}" placeholder="Libellé">
        <input type="number" name="value" value="{{value}}" placeholder="000.00">
        <input type="text" name="tags" value="{{tags}}" placeholder="mot clé 1, mot clé 2 ...">

          <button type="submit" class="btn btn-sm btn-primary edit-row"></button>
          <button type="button" class="btn btn-sm btn-danger remove-row"></button>

</template>


text:
#ifndef ALIFLATMultiplicity_H
#define ALIFLATMultiplicity_H

/**
 * Flat structure representing a ESD Multiplicity
 */

#include "Rtypes.h"
#include "AliVMisc.h"
#include "AliMultiplicity.h"
#include <algorithm>

class AliFlatMultiplicity
{
 public:
  // -- Constructor / Destructors

  AliFlatMultiplicity();
 ~AliFlatMultiplicity() {}

  // constructor and method for reinitialisation of virtual table
  AliFlatMultiplicity( AliVConstructorReinitialisationFlag );
  void Reinitialize() const {} // no virtual table - do nothing

  void SetFromMultiplicity(const AliMultiplicity &v );
  void GetMultiplicity( AliMultiplicity &v ) const;

  void SetNumberOfTracklets(Int_t n) {fNtracks = n;}
  void SetITSClusters(const UInt_t* c) {std::copy(c,c+6,fITSClusters);}
  Int_t GetNumberOfTracklets() const {return fNtracks;}
  UInt_t GetITSClusters(Int_t layer) const {return (layer<6)?fITSClusters[layer]:0;}

  static size_t GetSize() { return sizeof(AliFlatMultiplicity); }

private:
  Int_t fNtracks;            // Number of tracklets
  UInt_t fITSClusters[6];    // Number of ITS cluster per layer
};

inline AliFlatMultiplicity::AliFlatMultiplicity() :
  fNtracks(0)
{
  // Default constructor
  for( int i=0; i<6; i++ ) fITSClusters[i] = 0;
}

#pragma GCC diagnostic ignored "-Weffc++"
inline AliFlatMultiplicity::AliFlatMultiplicity( AliVConstructorReinitialisationFlag ){}  // do nothing
#pragma GCC diagnostic warning "-Weffc++"

inline void AliFlatMultiplicity::SetFromMultiplicity(const AliMultiplicity &v )
{
  fNtracks = v.GetNumberOfTracklets();
  fITSClusters[0] = v.GetNumberOfITSClusters(0);
  fITSClusters[1] = v.GetNumberOfITSClusters(1);
  fITSClusters[2] = v.GetNumberOfITSClusters(2);
  fITSClusters[3] = v.GetNumberOfITSClusters(3);
  fITSClusters[4] = v.GetNumberOfITSClusters(4);
  fITSClusters[5] = v.GetNumberOfITSClusters(5);
}

inline void AliFlatMultiplicity::GetMultiplicity( AliMultiplicity &v ) const
{
  v.SetNumberOfTracklets(fNtracks);
  v.SetITSClusters(0,fITSClusters[0]);
  v.SetITSClusters(1,fITSClusters[1]);
  v.SetITSClusters(2,fITSClusters[2]);
  v.SetITSClusters(3,fITSClusters[3]);
  v.SetITSClusters(4,fITSClusters[4]);
  v.SetITSClusters(5,fITSClusters[5]);
}

#endif


text:
use crate::extensions::clangd;
use crate::{language_client::LanguageClient, language_server_protocol::Direction, types::*};
use anyhow::{anyhow, Result};
use log::*;
use lsp_types::notification::{self, Notification};
use lsp_types::request::{self, Request};
use serde_json::Value;

fn is_content_modified_error(err: &anyhow::Error) -> bool {
    match err.downcast_ref::<LSError>() {
        Some(err) if err == &LSError::ContentModified => true,
        _ => false,
    }
}

impl LanguageClient {
    pub fn handle_call(&self, msg: Call) -> Result<()> {
        match msg {
            Call::MethodCall(lang_id, method_call) => {
                let result = self.handle_method_call(lang_id.as_deref(), &method_call);
                if let Err(ref err) = result {
                    if is_content_modified_error(err) {
                        return Ok(());
                    }

                    if err.downcast_ref::<LCError>().is_none() {
                        error!(
                            "Error handling message: {}\n\nMessage: {}\n\nError: {:?}",
                            err,
                            serde_json::to_string(&method_call).unwrap_or_default(),
                            err
                        );
                    }
                }
                self.get_client(&lang_id)?
                    .output(method_call.id.to_int()?, result)?;
            }
            Call::Notification(lang_id, notification) => {
                let result = self.handle_notification(lang_id.as_deref(), &notification);
                if let Err(ref err) = result {
                    if is_content_modified_error(err) {
                        return Ok(());
                    }

                    if err.downcast_ref::<LCError>().is_none() {
                        error!(
                            "Error handling message: {}\n\nMessage: {}\n\nError: {:?}",
                            err,
                            serde_json::to_string(&notification).unwrap_or_default(),
                            err
                        );
                    }
                }
            }
        }

        // FIXME
        if let Err(err) = self.handle_fs_events() {
            warn!("{:?}", err);
        }

        Ok(())
    }

    pub fn handle_method_call(
        &self,
        language_id: Option<&str>,
        method_call: &jsonrpc_core::MethodCall,
    ) -> Result<Value> {
        let params = serde_json::to_value(method_call.params.clone())?;

        let user_handler =
            self.get_state(|state| state.user_handlers.get(&method_call.method).cloned())?;
        if let Some(user_handler) = user_handler {
            return self.vim()?.rpcclient.call(&user_handler, params);
        }

        match method_call.method.as_str() {
            request::RegisterCapability::METHOD => {
                self.client_register_capability(language_id.unwrap_or_default(), &params)
            }
            request::UnregisterCapability::METHOD => {
                self.client_unregister_capability(language_id.unwrap_or_default(), &params)
            }
            request::HoverRequest::METHOD => self.text_document_hover(&params),
            request::Rename::METHOD => self.text_document_rename(&params),
            request::DocumentSymbolRequest::METHOD => self.text_document_document_symbol(&params),
            request::ShowMessageRequest::METHOD => self.window_show_message_request(&params),
            request::WorkspaceSymbol::METHOD => self.workspace_symbol(&params),
            request::CodeActionRequest::METHOD => self.text_document_code_action(&params),
            request::Completion::METHOD => self.text_document_completion(&params),
            request::SignatureHelpRequest::METHOD => self.text_document_signature_help(&params),
            request::GotoDefinition::METHOD => self.text_document_definition(&params),
            request::References::METHOD => self.text_document_references(&params),
            request::Formatting::METHOD => self.text_document_formatting(&params),
            request::RangeFormatting::METHOD => self.text_document_range_formatting(&params),
            request::CodeLensRequest::METHOD => self.text_document_code_lens(&params),
            request::ResolveCompletionItem::METHOD => self.completion_item_resolve(&params),
            request::ExecuteCommand::METHOD => self.workspace_execute_command(&params),
            request::ApplyWorkspaceEdit::METHOD => self.workspace_apply_edit(&params),
            request::Shutdown::METHOD => self.shutdown(&params),
            request::DocumentHighlightRequest::METHOD => {
                self.text_document_document_highlight(&params)
            }
            // Extensions.
            REQUEST_FIND_LOCATIONS => self.find_locations(&params),
            REQUEST_GET_STATE => self.get_client_state(&params),
            REQUEST_IS_ALIVE => self.is_alive(&params),
            REQUEST_START_SERVER => self.start_server(&params),
            REQUEST_REGISTER_SERVER_COMMANDS => self.register_server_commands(&params),
            REQUEST_SET_LOGGING_LEVEL => self.set_logging_level(&params),
            REQUEST_SET_DIAGNOSTICS_LIST => self.set_diagnostics_list(&params),
            REQUEST_REGISTER_HANDLERS => self.register_handlers(&params),
            REQUEST_NCM_REFRESH => self.ncm_refresh(&params),
            REQUEST_NCM2_ON_COMPLETE => self.ncm2_on_complete(&params),
            REQUEST_EXPLAIN_ERROR_AT_POINT => self.explain_error_at_point(&params),
            REQUEST_OMNI_COMPLETE => self.omnicomplete(&params),
            REQUEST_CLASS_FILE_CONTENTS => self.java_class_file_contents(&params),
            REQUEST_DEBUG_INFO => self.debug_info(&params),
            REQUEST_CODE_LENS_ACTION => self.handle_code_lens_action(&params),
            REQUEST_SEMANTIC_SCOPES => self.semantic_scopes(&params),
            REQUEST_SHOW_SEMANTIC_HL_SYMBOLS => self.semantic_highlight_symbols(&params),
            REQUEST_EXECUTE_CODE_ACTION => self.execute_code_action(&params),

            clangd::request::SwitchSourceHeader::METHOD => {
                self.text_document_switch_source_header(&params)
            }

            _ => {
                let language_id_target = if language_id.is_some() {
                    // Message from language server. No handler found.
                    let msg = format!("Message not handled: {:?}", method_call);
                    if method_call.method.starts_with('$') {
                        warn!("{}", msg);
                        return Ok(Value::default());
                    } else {
                        return Err(anyhow!(msg));
                    }
                } else {
                    // Message from vim. Proxy to language server.
                    let filename = self.vim()?.get_filename(&params)?;
                    let language_id_target = self.vim()?.get_language_id(&filename, &params)?;
                    info!(
                        "Proxy message directly to language server: {:?}",
                        method_call
                    );
                    Some(language_id_target)
                };

                self.get_client(&language_id_target)?
                    .call(&method_call.method, &params)
            }
        }
    }

    pub fn handle_notification(
        &self,
        language_id: Option<&str>,
        notification: &jsonrpc_core::Notification,
    ) -> Result<()> {
        let params = serde_json::to_value(notification.params.clone())?;

        let user_handler =
            self.get_state(|state| state.user_handlers.get(&notification.method).cloned())?;
        if let Some(user_handler) = user_handler {
            return self.vim()?.rpcclient.notify(&user_handler, params);
        }

        match notification.method.as_str() {
            notification::DidChangeConfiguration::METHOD => {
                self.workspace_did_change_configuration(&params)?
            }
            notification::DidOpenTextDocument::METHOD => self.text_document_did_open(&params)?,
            notification::DidChangeTextDocument::METHOD => {
                self.text_document_did_change(&params)?
            }
            notification::DidSaveTextDocument::METHOD => self.text_document_did_save(&params)?,
            notification::DidCloseTextDocument::METHOD => self.text_document_did_close(&params)?,
            notification::PublishDiagnostics::METHOD => {
                self.text_document_publish_diagnostics(&params)?
            }
            notification::SemanticHighlighting::METHOD => {
                self.text_document_semantic_highlight(&params)?
            }
            notification::Progress::METHOD => self.progress(&params)?,
            notification::LogMessage::METHOD => self.window_log_message(&params)?,
            notification::ShowMessage::METHOD => self.window_show_message(&params)?,
            notification::Exit::METHOD => self.exit(&params)?,
            // Extensions.
            NOTIFICATION_HANDLE_FILE_TYPE => self.handle_file_type(&params)?,
            NOTIFICATION_HANDLE_BUF_NEW_FILE => self.handle_buf_new_file(&params)?,
            NOTIFICATION_HANDLE_BUF_ENTER => self.handle_buf_enter(&params)?,
            NOTIFICATION_HANDLE_TEXT_CHANGED => self.handle_text_changed(&params)?,
            NOTIFICATION_HANDLE_BUF_WRITE_POST => self.handle_buf_write_post(&params)?,
            NOTIFICATION_HANDLE_BUF_DELETE => self.handle_buf_delete(&params)?,
            NOTIFICATION_HANDLE_CURSOR_MOVED => self.handle_cursor_moved(&params, false)?,
            NOTIFICATION_HANDLE_COMPLETE_DONE => self.handle_complete_done(&params)?,
            NOTIFICATION_FZF_SINK_LOCATION => self.fzf_sink_location(&params)?,
            NOTIFICATION_FZF_SINK_COMMAND => self.fzf_sink_command(&params)?,
            NOTIFICATION_CLEAR_DOCUMENT_HL => self.clear_document_highlight(&params)?,
            NOTIFICATION_LANGUAGE_STATUS => self.language_status(&params)?,
            NOTIFICATION_WINDOW_PROGRESS => self.window_progress(&params)?,
            NOTIFICATION_SERVER_EXITED => self.handle_server_exited(&params)?,
            NOTIFICATION_RUST_BEGIN_BUILD => self.rust_handle_begin_build(&params)?,
            NOTIFICATION_RUST_DIAGNOSTICS_BEGIN => self.rust_handle_diagnostics_begin(&params)?,
            NOTIFICATION_RUST_DIAGNOSTICS_END => self.rust_handle_diagnostics_end(&params)?,
            NOTIFICATION_DIAGNOSTICS_NEXT => self.cycle_diagnostics(&params, Direction::Next)?,
            NOTIFICATION_DIAGNOSTICS_PREVIOUS => {
                self.cycle_diagnostics(&params, Direction::Previous)?
            }

            _ => {
                let language_id_target = if language_id.is_some() {
                    // Message from language server. No handler found.
                    let msg = format!("Message not handled: {:?}", notification);
                    if notification.method.starts_with('$') {
                        warn!("{}", msg);
                        return Ok(());
                    } else {
                        return Err(anyhow!(msg));
                    }
                } else {
                    // Message from vim. Proxy to language server.
                    let filename = self.vim()?.get_filename(&params)?;
                    let language_id_target = self.vim()?.get_language_id(&filename, &params)?;
                    info!(
                        "Proxy message directly to language server: {:?}",
                        notification
                    );
                    Some(language_id_target)
                };

                self.get_client(&language_id_target)?
                    .notify(&notification.method, &params)?;
            }
        };

        Ok(())
    }
}


text:
namespace Mgc {

// squared distance measurements

MAGICFM Real SqrDistance (const Triangle3& rkTri, const Rectangle3& rkRct,
    Real* pfTriP0 = NULL, Real* pfTriP1 = NULL, Real* pfRctP0 = NULL,
    Real* pfRctP1 = NULL);

// distance measurements

MAGICFM Real Distance (const Triangle3& rkTri, const Rectangle3& rkRct,
    Real* pfTriP0 = NULL, Real* pfTriP1 = NULL, Real* pfRctP0 = NULL,
    Real* pfRctP1 = NULL);

} // namespace Mgc

#endif


text:
using MongoDB.Driver;
using TreeGecko.Library.Mongo.DAOs;
using TreeGecko.Library.Net.Objects;

namespace TreeGecko.Library.Net.DAOs
{
    public class SystemEmailDAO : AbstractMongoDAO<SystemEmail>
    {
        public SystemEmailDAO(MongoDatabase _mongoDB)
            : base(_mongoDB)
        {
            HasParent = false;
        }

        public override string TableName
        {
            get { return "SystemEmail"; }
        }

        public override void BuildTable()
        {
            base.BuildTable();

            BuildNonuniqueIndex("SentDateTime", "SENT");
        }
    }
}


text:
'use strict';

var express = require('express'),
    path = require('path'),
    config = require('./config'),
    passport = require('passport'),
    mongoStore = require('connect-mongo')(express);

/**
 * Express configuration
 */
module.exports = function(app) {
  app.configure('development', function(){
    app.use(require('connect-livereload')());

    // Disable caching of scripts for easier testing
    app.use(function noCache(req, res, next) {
      if (req.url.indexOf('/scripts/') === 0) {
        res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
        res.header('Pragma', 'no-cache');
        res.header('Expires', 0);
      }
      next();
    });

    app.use(express.static(path.join(config.root, '.tmp')));
    app.use(express.static(path.join(config.root, 'app')));
    app.set('views', config.root + '/app/views');
  });

  app.configure('production', function(){
    app.use(express.compress());
    app.use(express.favicon(path.join(config.root, 'public', 'favicon.ico')));
    app.use(express.static(path.join(config.root, 'public')));
    app.set('views', config.root + '/views');
  });

  app.configure(function(){
    /****************************** CORS ******************************/
    app.disable('x-powered-by');
    // TODO: Env variables?
    // app.set('client-url', 'http://corsnection-client.herokuapp.com');
    app.set('client-url', 'http://promome.mx');
    app.set('client-facebook-signup-path', '/facebook?action=signup');
    app.set('client-facebook-signin-path', '/facebook?action=signin');

    // Password encryption
    app.set('crypto-key', 'k3yb0ardc4t');

    // Facebook settings
    app.set('facebook-oauth-key', '1416028771976001');
    app.set('facebook-oauth-secret', '7ede7a6cd35d6bec48f526f529c5b73c');
    /******************** moddlewares ********************/
    // Create middleware for this.
    app.use(function(req, res, next){
      res.redirect = function(url) {
        res.send(200, url);
      };
      next();
    });

    app.use(function (req, res, next) {
      res.header('Access-Control-Allow-Origin', app.get('client-url'));
      res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
      res.header('Access-Control-Allow-Headers', 'Content-Type,X-Requested-With');
      res.header('Access-Control-Allow-Credentials', 'true');
      next();
    });
/*
    app.options('*', function(req, res){
      res.send(200);
    });

    app.all('/api/user*', function(req, res, next) {
      if (req.isAuthenticated()) return next();

      return res.send(401, 'You shall not pass!');
    });
    /*******************************************************************/

    app.engine('html', require('ejs').renderFile);
    app.set('view engine', 'html');
    app.use(express.logger('dev'));
    app.use(express.json());
    app.use(express.urlencoded());
    app.use(express.methodOverride());
    app.use(express.cookieParser());

    // Persist sessions with mongoStore
    app.use(express.session({
      secret: 'angular-fullstack secret',
      store: new mongoStore({
        url: config.mongo.uri,
        collection: 'sessions'
      }, function () {
          console.log("db connection open");
      })
    }));

    //use passport session
    app.use(passport.initialize());
    app.use(passport.session());

    // Router (only error handlers should come after this)
    app.use(app.router);
  });

  // Error handler
  app.configure('development', function(){
    app.use(express.errorHandler());
  });

};


text:
/*
 Write a program that enters from the console a positive integer n and prints
 all the numbers from 1 to n, on a single line, separated by a space.
 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int number;

    printf("Enter number: ");
    if ((scanf("%du", &number)) != 1)
    {
        printf("Not digit!");
        exit(EXIT_FAILURE);
    }
    else
    {
        int ctr = 1;
        while (ctr <= number)
        {
            printf("%d ", ctr);
            ctr++;
        }
    }

    return (EXIT_SUCCESS);
}


text:
import java.io.*;
import java.util.*;

class TreeNode
{
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode(int x) { val = x; }
}

class SerializeAndDeserializeBinaryTree
{
    public static void main(String[] args) {
        System.out.println("=== Serialize and Deserialize Binary Tree ===");
        Codec codec = new Codec();

        TreeNode n1 = new TreeNode(1);
        TreeNode n2 = new TreeNode(2);
        TreeNode n3 = new TreeNode(3);
        TreeNode n4 = new TreeNode(4);
        TreeNode n5 = new TreeNode(5);

        n1.left = n2;
        n1.right = n3;
        n3.left= n4;
        n3.right = n5;

        String str = codec.serialize(n1);
        System.out.println("str = "+str);
        TreeNode root = codec.deserialize(str);

        System.out.println("=== Print Tree ===");
        printTree(n1);
        System.out.println("=== Print Tree ===");
        printTree(root);
    }

    public static void printTree(TreeNode root)
    {
        if(root == null) { return; }
        System.out.println("node = "+root.val+", left = "+((root.left != null)?root.left.val:null)+", right = "+((root.right != null)?root.right.val:null));
        printTree(root.left);
        printTree(root.right);
    }
}

class Codec
{
    public String serialize(TreeNode root) {
        StringBuffer buf = new StringBuffer();

        ArrayList<TreeNode> list = new ArrayList<TreeNode>();
        TreeNode node = root;
        if(root != null) { list.add(root); }

        int idx = 0;
        while(idx < list.size()) {
            TreeNode n = list.get(idx);

            if(n != null) {
                list.add(n.left);
                list.add(n.right);
            }

            idx++;
        }

        // trim the trailing nulls
        for(int i = list.size()-1; i>= 0; i--) {
            if(list.get(i) == null) {
                list.remove(i);
            } else {
                break;
            }
        }

        for(int i = 0; i < list.size(); i++) {
            TreeNode n = list.get(i);
            String str = null;
            if(n == null) {
                str = "null";
            } else {
                str = new String(""+n.val);
            }
            buf.append(str);
            if(i < list.size()-1) { buf.append(","); }
        }

        return buf.toString();
    }

    public TreeNode deserialize(String data) {
        TreeNode root = null;

        StringTokenizer stok = new StringTokenizer(data, ",");

        // get the list of tree nodes
        ArrayList<TreeNode> list = new ArrayList<TreeNode>();
        while(stok.hasMoreTokens()) {
            String item = stok.nextToken();
            if(item.equals("null")) {
                list.add(null);
            } else{
                list.add(new TreeNode(Integer.parseInt(item)));
            }
        }

        // build the tree
        int parent_idx = 0;
        int child_idx = 1;
        while(parent_idx < list.size() && child_idx < list.size()) {

            // get parent
            TreeNode parent = list.get(parent_idx);
            if(parent == null) { parent_idx++; continue; }

            // get left
            parent.left = list.get(child_idx);

            // increase child_idx
            child_idx++;

            // get right
            if(child_idx >= list.size()) { continue; }
            parent.right = list.get(child_idx);

            // increase child_idx
            child_idx++;

            // increase root_idx
            parent_idx++;
        }

        return (list.size() > 0)?list.get(0):null;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>com.pvsagar.smartlockscreen.applogic_objects</title>
<meta name="date" content="2014-10-25">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

com.pvsagar.smartlockscreen.applogic_objects

Classes

BluetoothEnvironmentVariable

Environment

LocationEnvironmentVariable

NoiseLevelEnvironmentVariable

OverlappingEnvironmentIdsWithResolved

OverlappingEnvironmentIdsWithResolved.SimpleEnvironmentRetrievalFactory

User

WiFiEnvironmentVariable


text:
namespace GrafeasV1.Snippets
{
    // [START containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_sync_flattened]
    using Grafeas.V1;

    public sealed partial class GeneratedGrafeasClientSnippets
    {
        /// <summary>Snippet for GetOccurrenceNote</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void GetOccurrenceNote()
        {
            string endpoint = "";
            // Create client
            GrafeasClient grafeasClient = new GrafeasClientBuilder { Endpoint = endpoint }.Build();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/occurrences/[OCCURRENCE]";
            // Make the request
            Note response = grafeasClient.GetOccurrenceNote(name);
        }
    }
    // [END containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_sync_flattened]
}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BodyStreamBuffer_h
#define BodyStreamBuffer_h

#include "core/dom/DOMException.h"
#include "core/streams/ReadableByteStream.h"
#include "core/streams/ReadableByteStreamReader.h"
#include "core/streams/UnderlyingSource.h"
#include "modules/ModulesExport.h"
#include "modules/fetch/FetchDataConsumerHandle.h"
#include "modules/fetch/FetchDataLoader.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebDataConsumerHandle.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"

namespace blink {

class EncodedFormData;
class ExecutionContext;

class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<BodyStreamBuffer>, public UnderlyingSource, public WebDataConsumerHandle::Client {
    WTF_MAKE_NONCOPYABLE(BodyStreamBuffer);
    USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer);
public:
    // |handle| cannot be null and cannot be locked.
    explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */);

    ReadableByteStream* stream() { return m_stream; }

    // Callable only when not locked.
    PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::BlobSizePolicy);
    PassRefPtr<EncodedFormData> drainAsFormData();
    void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Client* /* client */);

    // Callable only when not locked. Returns a non-null handle.
    // There is no means to "return" the handle to the body buffer: Calling
    // this function locks, disturbs and closes the stream and no one will
    // not be able to get any information from the stream and this buffer after
    // that.
    PassOwnPtr<FetchDataConsumerHandle> releaseHandle(ExecutionContext*);

    bool hasPendingActivity() const;

    // UnderlyingSource
    void pullSource() override;
    ScriptPromise cancelSource(ScriptState*, ScriptValue reason) override;

    // WebDataConsumerHandle::Client
    void didGetReadable() override;

    DEFINE_INLINE_TRACE()
    {
        visitor->trace(m_stream);
        visitor->trace(m_loader);
        UnderlyingSource::trace(visitor);
    }

private:
    class LoaderClient;
    void close();
    void error();
    void processData();
    void endLoading();
    void stopLoading();

    OwnPtr<FetchDataConsumerHandle> m_handle;
    OwnPtr<FetchDataConsumerHandle::Reader> m_reader;
    Member<ReadableByteStream> m_stream;
    // We need this member to keep it alive while loading.
    Member<FetchDataLoader> m_loader;
    bool m_streamNeedsMore;
};

} // namespace blink

#endif // BodyStreamBuffer_h


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;

namespace NPoco
{
    public class MappingFactory
    {
        private PocoData _pocoData;
        static readonly EnumMapper EnumMapper = new EnumMapper();
        static List<Func<object, object>> m_Converters = new List<Func<object, object>>();
        static MethodInfo fnGetValue = typeof(IDataRecord).GetMethod("GetValue", new Type[] { typeof(int) });
        static MethodInfo fnIsDBNull = typeof(IDataRecord).GetMethod("IsDBNull");
        static FieldInfo fldConverters = typeof(MappingFactory).GetField("m_Converters", BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic);
        static MethodInfo fnListGetItem = typeof(List<Func<object, object>>).GetProperty("Item").GetGetMethod();
        static MethodInfo fnInvoke = typeof(Func<object, object>).GetMethod("Invoke");
        static Cache<Type, Type> _underlyingTypes = new Cache<Type, Type>();
        Cache<string, Delegate> _pocoFactories = new Cache<string, Delegate>();

        public MappingFactory(PocoData pocoData)
        {
            _pocoData = pocoData;
        }

        public Delegate GetFactory(string sql, string connString, int firstColumn, int countColumns, IDataReader r, object instance)
        {
            // Check cache
            var key = string.Format("{0}:{1}:{2}:{3}:{4}:{5}", sql, connString, firstColumn, countColumns, instance != GetDefault(_pocoData.type), _pocoData.EmptyNestedObjectNull);

            Func<Delegate> createFactory = () =>
            {
                // Create the method
                var m = new DynamicMethod("poco_factory_" + _pocoFactories.Count, _pocoData.type, new Type[] { typeof(IDataReader), _pocoData.type }, true);
                var il = m.GetILGenerator();

#if !POCO_NO_DYNAMIC
                if (_pocoData.type == typeof(object))
                {
                    // var poco=new T()
                    il.Emit(OpCodes.Newobj, typeof(PocoExpando).GetConstructor(Type.EmptyTypes));			// obj

                    MethodInfo fnAdd = typeof(IDictionary<string, object>).GetMethod("Add");

                    // Enumerate all fields generating a set assignment for the column
                    for (int i = firstColumn; i < firstColumn + countColumns; i++)
                    {
                        var srcType = r.GetFieldType(i);

                        il.Emit(OpCodes.Dup);						// obj, obj
                        il.Emit(OpCodes.Ldstr, r.GetName(i));		// obj, obj, fieldname

                        // Get the converter
                        Func<object, object> converter = null;
                        if (_pocoData.Mapper != null)
                            converter = _pocoData.Mapper.GetFromDbConverter((Type)null, srcType);

                        //if (ForceDateTimesToUtc && converter == null && srcType == typeof(DateTime))
                        //    converter = delegate(object src) { return new DateTime(((DateTime)src).Ticks, DateTimeKind.Utc); };

                        // Setup stack for call to converter
                        AddConverterToStack(il, converter);

                        // r[i]
                        il.Emit(OpCodes.Ldarg_0);					// obj, obj, fieldname, converter?,    rdr
                        il.Emit(OpCodes.Ldc_I4, i);					// obj, obj, fieldname, converter?,  rdr,i
                        il.Emit(OpCodes.Callvirt, fnGetValue);		// obj, obj, fieldname, converter?,  value

                        // Convert DBNull to null
                        il.Emit(OpCodes.Dup);						// obj, obj, fieldname, converter?,  value, value
                        il.Emit(OpCodes.Isinst, typeof(DBNull));	// obj, obj, fieldname, converter?,  value, (value or null)
                        var lblNotNull = il.DefineLabel();
                        il.Emit(OpCodes.Brfalse_S, lblNotNull);		// obj, obj, fieldname, converter?,  value
                        il.Emit(OpCodes.Pop);						// obj, obj, fieldname, converter?
                        if (converter != null)
                            il.Emit(OpCodes.Pop);					// obj, obj, fieldname,
                        il.Emit(OpCodes.Ldnull);					// obj, obj, fieldname, null
                        if (converter != null)
                        {
                            var lblReady = il.DefineLabel();
                            il.Emit(OpCodes.Br_S, lblReady);
                            il.MarkLabel(lblNotNull);
                            il.Emit(OpCodes.Callvirt, fnInvoke);
                            il.MarkLabel(lblReady);
                        }
                        else
                        {
                            il.MarkLabel(lblNotNull);
                        }

                        il.Emit(OpCodes.Callvirt, fnAdd);
                    }
                }
                else
#endif
                    if (_pocoData.type.IsValueType || _pocoData.type == typeof(string) || _pocoData.type == typeof(byte[]))
                    {
                        // Do we need to install a converter?
                        var srcType = r.GetFieldType(0);
                        var converter = GetConverter(_pocoData.Mapper, null, srcType, _pocoData.type);

                        // "if (!rdr.IsDBNull(i))"
                        il.Emit(OpCodes.Ldarg_0);										// rdr
                        il.Emit(OpCodes.Ldc_I4_0);										// rdr,0
                        il.Emit(OpCodes.Callvirt, fnIsDBNull);							// bool
                        var lblCont = il.DefineLabel();
                        il.Emit(OpCodes.Brfalse_S, lblCont);
                        il.Emit(OpCodes.Ldnull);										// null
                        var lblFin = il.DefineLabel();
                        il.Emit(OpCodes.Br_S, lblFin);

                        il.MarkLabel(lblCont);

                        // Setup stack for call to converter
                        AddConverterToStack(il, converter);

                        il.Emit(OpCodes.Ldarg_0);										// rdr
                        il.Emit(OpCodes.Ldc_I4_0);										// rdr,0
                        il.Emit(OpCodes.Callvirt, fnGetValue);							// value

                        // Call the converter
                        if (converter != null)
                            il.Emit(OpCodes.Callvirt, fnInvoke);

                        il.MarkLabel(lblFin);
                        il.Emit(OpCodes.Unbox_Any, _pocoData.type);								// value converted
                    }
                    else if (_pocoData.type == typeof(Dictionary<string, object>))
                    {
                        Func<IDataReader, object, Dictionary<string, object>> func = (reader, inst) =>
                        {
                            var dict = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
                            for (int i = firstColumn; i < firstColumn + countColumns; i++)
                            {
                                var value = reader.IsDBNull(i) ? null : reader.GetValue(i);
                                var name = reader.GetName(i);
                                if (!dict.ContainsKey(name))
                                    dict.Add(name, value);
                            }
                            return dict;
                        };

                        var delegateType = typeof(Func<,,>).MakeGenericType(typeof(IDataReader), _pocoData.type, typeof(Dictionary<string, object>));
                        var localDel = Delegate.CreateDelegate(delegateType, func.Target, func.Method);
                        return localDel;
                    }
                    else if (_pocoData.type.IsArray)
                    {
                        il.Emit(OpCodes.Ldc_I4_S, countColumns - firstColumn);
                        il.Emit(OpCodes.Newarr, _pocoData.type.GetElementType());

                        var valueset = typeof(Array).GetMethod("SetValue", new[] { typeof(object), typeof(int) });

                        for (int i = firstColumn; i < firstColumn + countColumns; i++)
                        {
                            // "if (!rdr.IsDBNull(i))"
                            il.Emit(OpCodes.Ldarg_0);									// arr,rdr
                            il.Emit(OpCodes.Ldc_I4, i);									// arr,rdr,i
                            il.Emit(OpCodes.Callvirt, fnIsDBNull);						// arr,bool
                            var lblNext = il.DefineLabel();
                            il.Emit(OpCodes.Brtrue_S, lblNext);							// arr

                            il.Emit(OpCodes.Dup);		                                    // arr,arr
                            il.Emit(OpCodes.Ldarg_0);										// arr,arr,rdr
                            il.Emit(OpCodes.Ldc_I4, i - firstColumn);						// arr,arr,rdr,i
                            il.Emit(OpCodes.Callvirt, fnGetValue);							// arr,arr,value

                            il.Emit(OpCodes.Ldc_I4, i - firstColumn);                       // arr,arr,value,i
                            il.Emit(OpCodes.Callvirt, valueset);                            // arr

                            il.MarkLabel(lblNext);
                        }

                        il.Emit(OpCodes.Castclass, _pocoData.type);
                    }
                    else
                    {
                        if (instance != null)
                        {
                            il.Emit(OpCodes.Ldarg_1);
                        }
                        else
                        {
                            var constructorInfo = _pocoData.type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[0], null);
                            if (constructorInfo == null)
                                throw new Exception(string.Format("Poco '{0}' has no parameterless constructor", _pocoData.type.FullName));

                            // var poco=new T()
                            il.Emit(OpCodes.Newobj, constructorInfo);
                        }

                        LocalBuilder a = il.DeclareLocal(typeof(Int32));
                        if (_pocoData.EmptyNestedObjectNull)
                        {
                            il.Emit(OpCodes.Ldc_I4, 0);
                            il.Emit(OpCodes.Stloc, a);
                        }

                        // Enumerate all fields generating a set assignment for the column
                        for (int i = firstColumn; i < firstColumn + countColumns; i++)
                        {
                            // Get the PocoColumn for this db column, ignore if not known
                            PocoColumn pc;
                            if (!TryGetColumnByName(_pocoData.Columns, r.GetName(i), out pc)
                                || (!pc.MemberInfo.IsField() && ((PropertyInfo)pc.MemberInfo).GetSetMethodOnDeclaringType() == null))
                            {
                                var pcAlias = _pocoData.Columns.Values.SingleOrDefault(x => x.AutoAlias == r.GetName(i))
                                    ?? _pocoData.Columns.Values.SingleOrDefault(x => string.Equals(x.ColumnAlias, r.GetName(i), StringComparison.OrdinalIgnoreCase));

                                if (pcAlias != null)
                                {
                                    pc = pcAlias;
                                }
                                else
                                {
                                    continue;
                                }
                            }

                            // Get the source type for this column
                            var srcType = r.GetFieldType(i);
                            var dstType = pc.MemberInfo.GetMemberInfoType();

                            // "if (!rdr.IsDBNull(i))"
                            il.Emit(OpCodes.Ldarg_0);										// poco,rdr
                            il.Emit(OpCodes.Ldc_I4, i);										// poco,rdr,i
                            il.Emit(OpCodes.Callvirt, fnIsDBNull);							// poco,bool
                            var lblNext = il.DefineLabel();
                            il.Emit(OpCodes.Brtrue_S, lblNext);								// poco

                            il.Emit(OpCodes.Dup);											// poco,poco

                            // Do we need to install a converter?
                            var converter = GetConverter(_pocoData.Mapper, pc, srcType, dstType);

                            // Fast
                            bool Handled = false;
                            if (converter == null)
                            {
                                var valuegetter = typeof(IDataRecord).GetMethod("Get" + srcType.Name, new Type[] { typeof(int) });
                                if (valuegetter != null
                                    && valuegetter.ReturnType == srcType
                                    && (valuegetter.ReturnType == dstType || valuegetter.ReturnType == Nullable.GetUnderlyingType(dstType)))
                                {
                                    il.Emit(OpCodes.Ldarg_0);										// *,rdr
                                    il.Emit(OpCodes.Ldc_I4, i);										// *,rdr,i
                                    il.Emit(OpCodes.Callvirt, valuegetter);							// *,value

                                    // Convert to Nullable
                                    if (Nullable.GetUnderlyingType(dstType) != null)
                                    {
                                        il.Emit(OpCodes.Newobj, dstType.GetConstructor(new Type[] { Nullable.GetUnderlyingType(dstType) }));
                                    }

                                    PushMemberOntoStack(il, pc); //poco
                                    Handled = true;
                                }
                            }

                            // Not so fast
                            if (!Handled)
                            {
                                // Setup stack for call to converter
                                AddConverterToStack(il, converter);

                                // "value = rdr.GetValue(i)"
                                il.Emit(OpCodes.Ldarg_0);										// *,rdr
                                il.Emit(OpCodes.Ldc_I4, i);										// *,rdr,i
                                il.Emit(OpCodes.Callvirt, fnGetValue);							// *,value

                                // Call the converter
                                if (converter != null)
                                    il.Emit(OpCodes.Callvirt, fnInvoke);

                                // Assign it
                                il.Emit(OpCodes.Unbox_Any, pc.MemberInfo.GetMemberInfoType());          // poco,poco,value

                                PushMemberOntoStack(il, pc); //poco
                            }

                            if (_pocoData.EmptyNestedObjectNull)
                            {
                                il.Emit(OpCodes.Ldloc, a); // poco, a
                                il.Emit(OpCodes.Ldc_I4, 1); // poco, a, 1
                                il.Emit(OpCodes.Add); // poco, a+1
                                il.Emit(OpCodes.Stloc, a); // poco
                            }
                            il.MarkLabel(lblNext);
                        }

                        var fnOnLoaded = RecurseInheritedTypes<MethodInfo>(_pocoData.type, (x) => x.GetMethod("OnLoaded", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[0], null));
                        if (fnOnLoaded != null)
                        {
                            il.Emit(OpCodes.Dup);
                            il.Emit(OpCodes.Callvirt, (MethodInfo) fnOnLoaded);
                        }

                        if (_pocoData.EmptyNestedObjectNull)
                        {
                            var lblNull = il.DefineLabel();
                            var lblElse = il.DefineLabel();

                            il.Emit(OpCodes.Ldc_I4_0); // poco, 0
                            il.Emit(OpCodes.Ldloc, a); // poco, 0, a

                            il.Emit(OpCodes.Beq, lblNull); // poco
                            il.Emit(OpCodes.Br_S, lblElse);

                            il.MarkLabel(lblNull);

                            il.Emit(OpCodes.Pop); //
                            il.Emit(OpCodes.Ldnull); // null

                            il.MarkLabel(lblElse);
                        }
                    }

                il.Emit(OpCodes.Ret);

                // Cache it, return it
                var del = m.CreateDelegate(Expression.GetFuncType(typeof(IDataReader), _pocoData.type, _pocoData.type));
                return del;
            };

            var fac = _pocoFactories.Get(key, createFactory);
            return fac;
        }

        private static void PushMemberOntoStack(ILGenerator il, PocoColumn pc)
        {
            if (pc.MemberInfo.IsField())
                il.Emit(OpCodes.Stfld, (FieldInfo)pc.MemberInfo);
            else
                il.Emit(OpCodes.Callvirt, ((PropertyInfo)pc.MemberInfo).GetSetMethodOnDeclaringType());
        }

        private static void AddConverterToStack(ILGenerator il, Func<object, object> converter)
        {
            if (converter != null)
            {
                // Add the converter
                int converterIndex = m_Converters.Count;
                m_Converters.Add(converter);

                // Generate IL to push the converter onto the stack
                il.Emit(OpCodes.Ldsfld, fldConverters);
                il.Emit(OpCodes.Ldc_I4, converterIndex);
                il.Emit(OpCodes.Callvirt, fnListGetItem);					// Converter
            }
        }

        public static Func<object, object> GetConverter(IMapper mapper, PocoColumn pc, Type srcType, Type dstType)
        {
            Func<object, object> converter = null;

            // Get converter from the mapper
            if (mapper != null)
            {
                converter = pc != null ? mapper.GetFromDbConverter(pc.MemberInfo, srcType) : mapper.GetFromDbConverter(dstType, srcType);
                if (converter != null)
                    return converter;
            }

            // Standard DateTime->Utc mapper
            if (pc != null && pc.ForceToUtc && srcType == typeof(DateTime) && (dstType == typeof(DateTime) || dstType == typeof(DateTime?)))
            {
                converter = delegate(object src) { return new DateTime(((DateTime)src).Ticks, DateTimeKind.Utc); };
                return converter;
            }

            // Forced type conversion including integral types -> enum
            var underlyingType = _underlyingTypes.Get(dstType, () => Nullable.GetUnderlyingType(dstType));
            if (dstType.IsEnum || (underlyingType != null && underlyingType.IsEnum))
            {
                if (srcType == typeof(string))
                {
                    converter = src => EnumMapper.EnumFromString((underlyingType ?? dstType), (string)src);
                    return converter;
                }

                if (IsIntegralType(srcType))
                {
                    converter = src => Enum.ToObject((underlyingType ?? dstType), src);
                    return converter;
                }
            }
            else if (!dstType.IsAssignableFrom(srcType))
            {
                converter = src => Convert.ChangeType(src, (underlyingType ?? dstType), null);
            }
            return converter;
        }

        static bool IsIntegralType(Type t)
        {
            var tc = Type.GetTypeCode(t);
            return tc >= TypeCode.SByte && tc <= TypeCode.UInt64;
        }

        public static object GetDefault(Type type)
        {
            if (type.IsValueType)
            {
                return Activator.CreateInstance(type);
            }
            return null;
        }

        static T RecurseInheritedTypes<T>(Type t, Func<Type, T> cb)
        {
            while (t != null)
            {
                T info = cb(t);
                if (info != null)
                    return info;
                t = t.BaseType;
            }
            return default(T);
        }

        public static bool TryGetColumnByName(Dictionary<string, PocoColumn> columns, string name, out PocoColumn pc)
        {
            // Try to get the column by name directly (works when the poco property name matches the DB column name).
            var found = (columns.TryGetValue(name, out pc) || columns.TryGetValue(name.Replace("_", ""), out pc));
            if (!found)
            {
                // Try to get the column by the poco member name (the poco property name is different from the DB column name).
                pc = columns.Values.Where(c => c.MemberInfo.Name == name).FirstOrDefault();
                found = (pc != null);
            }
            return found;
        }
    }
}


text:
require 'gaigo/helpers/form_helper_v3/form_builder'
require 'gaigo/helpers/form_helper_v3/instance_tag'

module Gaigo

  module FormHelper
    # module_eval <<-EOV
    def ilabel(object_name, method, content_or_options = nil, options = nil, &block)
      options ||= {}

      content_is_options = content_or_options.is_a?(Hash)
      if content_is_options || block_given?
        options.merge!(content_or_options) if content_is_options
        text = nil
      else
        text = content_or_options
      end

      ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_ilabel_tag(text, options, &block)
    end
  end

end

ActionView::Helpers::InstanceTag.send(:include, Gaigo::FormHelperV3::InstanceTag)
ActionView::Helpers::FormBuilder.send(:include, Gaigo::FormHelperV3::FormBuilder)


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use backend\models\UserRole;

/* @var $this yii\web\View */
/* @var $model backend\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => 255]) ?>

    <?=
    $form->field($model, 'role')->dropDownList(
            ArrayHelper::map(UserRole::find()->all(), 'role_id', 'role_desc')
    );
    ?>

<?= $form->field($model, 'status')->textInput() ?>

<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

<?php ActiveForm::end(); ?>


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:twig="http://symfony.com/schema/dic/twig"
           xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
                        http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">

    <twig:config />
</container>


text:
(function() {
    'use strict';

    var moduleName = 'app.books.edit',

        angularDependencies = [
            'ui.router',
            'app.books.services'
        ];

    define([
        'angular',
        'ui.router',
        'app.books.services'
    ], function(angular) {

        var module = angular.module(moduleName, angularDependencies);

        module.config(['$stateProvider',
            function($stateProvider) {

                $stateProvider.state('app.books.edit', {
                    controller: 'BooksEditCtrl',
                    url: '/:bookId/edit',
                    templateUrl: 'books/_books_form.html',
                    resolve: {
                        'book': ['BooksService', '$stateParams',
                            function(BooksService, $stateParams) {
                                return BooksService.get($stateParams.bookId);
                            }
                        ]
                    }
                });
            }
        ]);

        module.controller('BooksEditCtrl', ['$scope', '$state', 'BooksService', 'book',
            function($scope, $state, BooksService, book) {
                console.log('BooksEditCtrl');

                $scope.book = book.data;

                $scope.feedback = {
                    hasFeedback: false,
                    message: null,
                    status: null
                };

                $scope.saveBook = function() {
                    BooksService.update($scope.book).then(
                        function success(response) {
                            $scope.setFeedback(true, 'success', 'Successfully updated book');
                        },
                        function error(response) {
                            $scope.setFeedback(true, 'danger', response);
                        });
                };

                $scope.setFeedback = function(hasFeedback, message, status) {
                    $scope.feedback.hasFeedback = hasFeedback;
                    $scope.feedback.status      = message;
                    $scope.feedback.message     = status;
                };

                // begin datepicker options
                $scope.openedStart = false;
                $scope.openedFinish = false;
                $scope.maxDate = new Date();

                $scope.today = function() {
                    $scope.dt = new Date();
                };

                $scope.today();

                $scope.showWeeks = true;

                $scope.toggleWeeks = function() {
                    $scope.showWeeks = !$scope.showWeeks;
                };

                $scope.clear = function() {
                    $scope.dt = null;
                };

                $scope.openStart = function($event) {
                    $event.preventDefault();
                    $event.stopPropagation();

                    $scope.openedStart = !$scope.openedStart;
                };

                $scope.openFinish = function($event) {
                    $event.preventDefault();
                    $event.stopPropagation();

                    $scope.openedFinish = !$scope.openedFinish;
                };

                $scope.format = 'MMMM dd, yyyy';
            }
        ]);

        return module;
    });
})();


text:
<?php

namespace Stalker\Lib\RESTAPI\v2;

class RESTApiResourceVideoCategories extends RESTApiCollection
{
    public function __construct(array $nested_params, array $external_params){
        parent::__construct($nested_params, $external_params);
        $this->document = new RESTApiVideoCategoryDocument();
    }

    public function getCount(RESTApiRequest $request){
        $categories = new \VideoCategory();
        return count($categories->getAll(true));
    }

    public function get(RESTApiRequest $request){
        $categories = new \VideoCategory();
        $categories->setLocale($request->getLanguage());

        return $this->filter($categories->getAll(true));
    }

    private function filter($categories){

        $categories = array_map(function($category){

            unset($category['category_name']);
            unset($category['original_title']);
            unset($category['category_alias']);
            unset($category['num']);

            return $category;

        },$categories);

        return $categories;
    }
}


text:
    <?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\Console\Output\ConsoleOutput as Output;

class FrameworkDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS = 0');
        Model::unguard();
        $output = new Output;

        $this->call(FrameworkPermissionTableSeeder::class);
        $this->call(FrameworkSettingsTableSeeder::class);
        $this->call(FrameworkCoaTableSeeder::class);
        $this->call(FrameworkSettingJournalSeeder::class);
        $this->call(FrameworkItemTypeTableSeeder::class);
        $this->call(FrameworkAllocationTableSeeder::class);
        $this->call(FrameworkPersonTypeTableSeeder::class);
        $this->call(FrameworkPersonGroupTableSeeder::class);
        $this->call(FrameworkFormulirNumberTableSeeder::class);

        Model::reguard();
        DB::statement('SET FOREIGN_KEY_CHECKS = 1');
    }
}


text:
// +build !windows

package proc

import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"syscall"
	"time"

	"github.com/containerd/console"
	"github.com/containerd/containerd/log"
	"github.com/containerd/containerd/mount"
	"github.com/containerd/containerd/runtime/proc"
	"github.com/containerd/fifo"
	runc "github.com/containerd/go-runc"
	google_protobuf "github.com/gogo/protobuf/types"
	specs "github.com/opencontainers/runtime-spec/specs-go"
	"github.com/pkg/errors"
)

// InitPidFile name of the file that contains the init pid
const InitPidFile = "init.pid"

// Init represents an initial process for a container
type Init struct {
	wg sync.WaitGroup
	initState

	// mu is used to ensure that `Start()` and `Exited()` calls return in
	// the right order when invoked in separate go routines.
	// This is the case within the shim implementation as it makes use of
	// the reaper interface.
	mu sync.Mutex

	waitBlock chan struct{}

	WorkDir string

	id           string
	Bundle       string
	console      console.Console
	Platform     proc.Platform
	io           runc.IO
	runtime      *runc.Runc
	status       int
	exited       time.Time
	pid          int
	closers      []io.Closer
	stdin        io.Closer
	stdio        proc.Stdio
	Rootfs       string
	IoUID        int
	IoGID        int
	NoPivotRoot  bool
	NoNewKeyring bool
}

// NewRunc returns a new runc instance for a process
func NewRunc(root, path, namespace, runtime, criu string, systemd bool) *runc.Runc {
	if root == "" {
		root = RuncRoot
	}
	return &runc.Runc{
		Command:       runtime,
		Log:           filepath.Join(path, "log.json"),
		LogFormat:     runc.JSON,
		PdeathSignal:  syscall.SIGKILL,
		Root:          filepath.Join(root, namespace),
		Criu:          criu,
		SystemdCgroup: systemd,
	}
}

// New returns a new process
func New(id string, runtime *runc.Runc, stdio proc.Stdio) *Init {
	p := &Init{
		id:        id,
		runtime:   runtime,
		stdio:     stdio,
		status:    0,
		waitBlock: make(chan struct{}),
	}
	p.initState = &createdState{p: p}
	return p
}

// Create the process with the provided config
func (p *Init) Create(ctx context.Context, r *CreateConfig) error {
	var (
		err    error
		socket *runc.Socket
	)
	if r.Terminal {
		if socket, err = runc.NewTempConsoleSocket(); err != nil {
			return errors.Wrap(err, "failed to create OCI runtime console socket")
		}
		defer socket.Close()
	} else if hasNoIO(r) {
		if p.io, err = runc.NewNullIO(); err != nil {
			return errors.Wrap(err, "creating new NULL IO")
		}
	} else {
		if p.io, err = runc.NewPipeIO(p.IoUID, p.IoGID, withConditionalIO(p.stdio)); err != nil {
			return errors.Wrap(err, "failed to create OCI runtime io pipes")
		}
	}
	pidFile := filepath.Join(p.Bundle, InitPidFile)
	if r.Checkpoint != "" {
		opts := &runc.RestoreOpts{
			CheckpointOpts: runc.CheckpointOpts{
				ImagePath:  r.Checkpoint,
				WorkDir:    p.WorkDir,
				ParentPath: r.ParentCheckpoint,
			},
			PidFile:     pidFile,
			IO:          p.io,
			NoPivot:     p.NoPivotRoot,
			Detach:      true,
			NoSubreaper: true,
		}
		p.initState = &createdCheckpointState{
			p:    p,
			opts: opts,
		}
		return nil
	}
	opts := &runc.CreateOpts{
		PidFile:      pidFile,
		IO:           p.io,
		NoPivot:      p.NoPivotRoot,
		NoNewKeyring: p.NoNewKeyring,
	}
	if socket != nil {
		opts.ConsoleSocket = socket
	}
	if err := p.runtime.Create(ctx, r.ID, r.Bundle, opts); err != nil {
		return p.runtimeError(err, "OCI runtime create failed")
	}
	if r.Stdin != "" {
		sc, err := fifo.OpenFifo(ctx, r.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
		if err != nil {
			return errors.Wrapf(err, "failed to open stdin fifo %s", r.Stdin)
		}
		p.stdin = sc
		p.closers = append(p.closers, sc)
	}
	var copyWaitGroup sync.WaitGroup
	if socket != nil {
		console, err := socket.ReceiveMaster()
		if err != nil {
			return errors.Wrap(err, "failed to retrieve console master")
		}
		console, err = p.Platform.CopyConsole(ctx, console, r.Stdin, r.Stdout, r.Stderr, &p.wg, &copyWaitGroup)
		if err != nil {
			return errors.Wrap(err, "failed to start console copy")
		}
		p.console = console
	} else if !hasNoIO(r) {
		if err := copyPipes(ctx, p.io, r.Stdin, r.Stdout, r.Stderr, &p.wg, &copyWaitGroup); err != nil {
			return errors.Wrap(err, "failed to start io pipe copy")
		}
	}

	copyWaitGroup.Wait()
	pid, err := runc.ReadPidFile(pidFile)
	if err != nil {
		return errors.Wrap(err, "failed to retrieve OCI runtime container pid")
	}
	p.pid = pid
	return nil
}

// Wait for the process to exit
func (p *Init) Wait() {
	<-p.waitBlock
}

// ID of the process
func (p *Init) ID() string {
	return p.id
}

// Pid of the process
func (p *Init) Pid() int {
	return p.pid
}

// ExitStatus of the process
func (p *Init) ExitStatus() int {
	p.mu.Lock()
	defer p.mu.Unlock()
	return p.status
}

// ExitedAt at time when the process exited
func (p *Init) ExitedAt() time.Time {
	p.mu.Lock()
	defer p.mu.Unlock()
	return p.exited
}

// Status of the process
func (p *Init) Status(ctx context.Context) (string, error) {
	p.mu.Lock()
	defer p.mu.Unlock()
	c, err := p.runtime.State(ctx, p.id)
	if err != nil {
		if strings.Contains(err.Error(), "does not exist") {
			return "stopped", nil
		}
		return "", p.runtimeError(err, "OCI runtime state failed")
	}
	return c.Status, nil
}

func (p *Init) start(context context.Context) error {
	err := p.runtime.Start(context, p.id)
	return p.runtimeError(err, "OCI runtime start failed")
}

func (p *Init) setExited(status int) {
	p.exited = time.Now()
	p.status = status
	p.Platform.ShutdownConsole(context.Background(), p.console)
	close(p.waitBlock)
}

func (p *Init) delete(context context.Context) error {
	p.wg.Wait()
	err := p.runtime.Delete(context, p.id, nil)
	// ignore errors if a runtime has already deleted the process
	// but we still hold metadata and pipes
	//
	// this is common during a checkpoint, runc will delete the container state
	// after a checkpoint and the container will no longer exist within runc
	if err != nil {
		if strings.Contains(err.Error(), "does not exist") {
			err = nil
		} else {
			err = p.runtimeError(err, "failed to delete task")
		}
	}
	if p.io != nil {
		for _, c := range p.closers {
			c.Close()
		}
		p.io.Close()
	}
	if err2 := mount.UnmountAll(p.Rootfs, 0); err2 != nil {
		log.G(context).WithError(err2).Warn("failed to cleanup rootfs mount")
		if err == nil {
			err = errors.Wrap(err2, "failed rootfs umount")
		}
	}
	return err
}

func (p *Init) resize(ws console.WinSize) error {
	if p.console == nil {
		return nil
	}
	return p.console.Resize(ws)
}

func (p *Init) pause(context context.Context) error {
	err := p.runtime.Pause(context, p.id)
	return p.runtimeError(err, "OCI runtime pause failed")
}

func (p *Init) resume(context context.Context) error {
	err := p.runtime.Resume(context, p.id)
	return p.runtimeError(err, "OCI runtime resume failed")
}

func (p *Init) kill(context context.Context, signal uint32, all bool) error {
	err := p.runtime.Kill(context, p.id, int(signal), &runc.KillOpts{
		All: all,
	})
	return checkKillError(err)
}

// KillAll processes belonging to the init process
func (p *Init) KillAll(context context.Context) error {
	err := p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
		All: true,
	})
	return p.runtimeError(err, "OCI runtime killall failed")
}

// Stdin of the process
func (p *Init) Stdin() io.Closer {
	return p.stdin
}

// Runtime returns the OCI runtime configured for the init process
func (p *Init) Runtime() *runc.Runc {
	return p.runtime
}

// exec returns a new exec'd process
func (p *Init) exec(context context.Context, path string, r *ExecConfig) (proc.Process, error) {
	// process exec request
	var spec specs.Process
	if err := json.Unmarshal(r.Spec.Value, &spec); err != nil {
		return nil, err
	}
	spec.Terminal = r.Terminal

	e := &execProcess{
		id:     r.ID,
		path:   path,
		parent: p,
		spec:   spec,
		stdio: proc.Stdio{
			Stdin:    r.Stdin,
			Stdout:   r.Stdout,
			Stderr:   r.Stderr,
			Terminal: r.Terminal,
		},
		waitBlock: make(chan struct{}),
	}
	e.State = &execCreatedState{p: e}
	return e, nil
}

func (p *Init) checkpoint(context context.Context, r *CheckpointConfig) error {
	var actions []runc.CheckpointAction
	if !r.Exit {
		actions = append(actions, runc.LeaveRunning)
	}
	work := filepath.Join(p.WorkDir, "criu-work")
	defer os.RemoveAll(work)
	if err := p.runtime.Checkpoint(context, p.id, &runc.CheckpointOpts{
		WorkDir:                  work,
		ImagePath:                r.Path,
		AllowOpenTCP:             r.AllowOpenTCP,
		AllowExternalUnixSockets: r.AllowExternalUnixSockets,
		AllowTerminal:            r.AllowTerminal,
		FileLocks:                r.FileLocks,
		EmptyNamespaces:          r.EmptyNamespaces,
	}, actions...); err != nil {
		dumpLog := filepath.Join(p.Bundle, "criu-dump.log")
		if cerr := copyFile(dumpLog, filepath.Join(work, "dump.log")); cerr != nil {
			log.G(context).Error(err)
		}
		return fmt.Errorf("%s path= %s", criuError(err), dumpLog)
	}
	return nil
}

func (p *Init) update(context context.Context, r *google_protobuf.Any) error {
	var resources specs.LinuxResources
	if err := json.Unmarshal(r.Value, &resources); err != nil {
		return err
	}
	return p.runtime.Update(context, p.id, &resources)
}

// Stdio of the process
func (p *Init) Stdio() proc.Stdio {
	return p.stdio
}

func (p *Init) runtimeError(rErr error, msg string) error {
	if rErr == nil {
		return nil
	}

	rMsg, err := getLastRuntimeError(p.runtime)
	switch {
	case err != nil:
		return errors.Wrapf(rErr, "%s: %s (%s)", msg, "unable to retrieve OCI runtime error", err.Error())
	case rMsg == "":
		return errors.Wrap(rErr, msg)
	default:
		return errors.Errorf("%s: %s", msg, rMsg)
	}
}

func withConditionalIO(c proc.Stdio) runc.IOOpt {
	return func(o *runc.IOOption) {
		o.OpenStdin = c.Stdin != ""
		o.OpenStdout = c.Stdout != ""
		o.OpenStderr = c.Stderr != ""
	}
}


text:
package com.focusit.jsflight.recorder.internalevent.httprequest;

import com.focusit.jsflight.recorder.internalevent.InternalEventRecorder;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class HttpRecorderFilterBase implements Filter
{
    public static final String ALREADY_FILTERED_SUFFIX = ".FILTERED";
    private static final AtomicBoolean enabled = new AtomicBoolean(false);

    public static void setEnabled(boolean enabled)
    {
        HttpRecorderFilterBase.enabled.set(enabled);
    }

    @Override
    public final void destroy()
    {
        InternalEventRecorder.getInstance().stopRecording();
        try
        {
            InternalEventRecorder.getInstance().shutdown();
        }
        catch (InterruptedException e)
        {
            logException(e);
        }
    }

    @Override
    public final void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
            throws ServletException, IOException
    {

        if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse))
        {
            throw new ServletException("OncePerRequestFilter just supports HTTP requests");
        }
        HttpServletRequest httpRequest = (HttpServletRequest)request;
        HttpServletResponse httpResponse = (HttpServletResponse)response;

        String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName();
        boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null;

        if (hasAlreadyFilteredAttribute || skipDispatch() || doNotRecordRequest(httpRequest, httpResponse))
        {

            // Proceed without invoking this filter...
            filterChain.doFilter(request, response);
        }
        else
        {
            // Do invoke this filter...
            request.setAttribute(alreadyFilteredAttributeName, Boolean.TRUE);
            try
            {
                doFilterInternal(httpRequest, httpResponse, filterChain);
            }
            finally
            {
                // Remove the "already filtered" request attribute for this request.
                request.removeAttribute(alreadyFilteredAttributeName);
            }
        }
    }

    public final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
            throws IOException, ServletException
    {
        if (!HttpRecorderFilterBase.enabled.get())
        {
            chain.doFilter(request, response);
            return;
        }

        if (doNotRecordRequest(request, response))
        {
            chain.doFilter(request, response);
            return;
        }

        HttpRecordInformation info = new HttpRecordInformation();
        RecordableHttpServletRequest requestForRecord = null;
        try
        {
            try
            {
                prepareHttpRecordInfo(info, request, response);
                requestForRecord = HttpRecorder.prepareRequestToRecord(request, info);
            }
            catch (Exception e)
            {
                logException(e);
            }
            chain.doFilter(requestForRecord, response);

        }
        finally
        {
            try
            {
                updateHttpRecordInfo(info, requestForRecord, response);
                HttpRecorder.recordRequest(requestForRecord, info);
            }
            catch (InterruptedException e)
            {
                logException(e);
            }
        }
    }

    @Override
    public final void init(FilterConfig filterConfig) throws ServletException
    {
        InternalEventRecorder.getInstance().startRecording();
    }

    public abstract void prepareHttpRecordInfo(HttpRecordInformation info, ServletRequest request,
            ServletResponse response);

    public abstract void updateHttpRecordInfo(HttpRecordInformation info, ServletRequest request,
            ServletResponse response);

    protected abstract boolean doNotRecordRequest(HttpServletRequest request, HttpServletResponse response);

    protected String getAlreadyFilteredAttributeName()
    {
        String name = "HttpRecorder";
        return name + ALREADY_FILTERED_SUFFIX;
    }

    protected abstract void logException(Exception e);

    protected final void openFileForWriting(String filename)
    {
        InternalEventRecorder.getInstance().openFileForWriting(filename);
    }

    protected boolean shouldNotFilterAsyncDispatch()
    {
        return false;
    }

    protected boolean shouldNotFilterErrorDispatch()
    {
        return false;
    }

    private boolean skipDispatch()
    {
        return shouldNotFilterErrorDispatch();
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/pasteItem"
        android:icon="@drawable/ic_paste"
        android:title="@android:string/paste"
        android:visible="false"
        app:showAsAction="always" />

    <item
        android:id="@+id/toggleExpandItem"
        android:icon="@drawable/ic_expand"
        android:title="Expand"
        app:showAsAction="always" />
</menu>