text:
#ifndef __EventMachine__H_
#define __EventMachine__H_

#ifdef BUILD_FOR_RUBY
  #include <ruby.h>
  #ifdef HAVE_RB_THREAD_FD_SELECT
    #define EmSelect rb_thread_fd_select
  #else
    // ruby 1.9.1 and below
    #define EmSelect rb_thread_select
  #endif

  #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
   #include <ruby/thread.h>
  #endif

  #ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
    #include <ruby/io.h>
  #endif

  #if defined(HAVE_RB_TRAP_IMMEDIATE)
    #include <rubysig.h>
  #elif defined(HAVE_RB_ENABLE_INTERRUPT)
    extern "C" {
      void rb_enable_interrupt(void);
      void rb_disable_interrupt(void);
    }

    #define TRAP_BEG rb_enable_interrupt()
    #define TRAP_END do { rb_disable_interrupt(); rb_thread_check_ints(); } while(0)
  #else
    #define TRAP_BEG
    #define TRAP_END
  #endif

  // 1.9.0 compat
  #ifndef RUBY_UBF_IO
    #define RUBY_UBF_IO RB_UBF_DFL
  #endif
  #ifndef RSTRING_PTR
    #define RSTRING_PTR(str) RSTRING(str)->ptr
  #endif
  #ifndef RSTRING_LEN
    #define RSTRING_LEN(str) RSTRING(str)->len
  #endif
  #ifndef RSTRING_LENINT
    #define RSTRING_LENINT(str) RSTRING_LEN(str)
  #endif
#else
  #define EmSelect select
#endif

#if !defined(HAVE_TYPE_RB_FDSET_T)
#define fd_check(n) (((n) < FD_SETSIZE) ? 1 : 0*fprintf(stderr, "fd %d too large for select\n", (n)))
// These definitions are cribbed from include/ruby/intern.h in Ruby 1.9.3,
// with this change: any macros that read or write the nth element of an
// fdset first call fd_check to make sure n is in bounds.
typedef fd_set rb_fdset_t;
#define rb_fd_zero(f) FD_ZERO(f)
#define rb_fd_set(n, f) do { if (fd_check(n)) FD_SET((n), (f)); } while(0)
#define rb_fd_clr(n, f) do { if (fd_check(n)) FD_CLR((n), (f)); } while(0)
#define rb_fd_isset(n, f) (fd_check(n) ? FD_ISSET((n), (f)) : 0)
#define rb_fd_copy(d, s, n) (*(d) = *(s))
#define rb_fd_dup(d, s) (*(d) = *(s))
#define rb_fd_resize(n, f)  ((void)(f))
#define rb_fd_ptr(f)  (f)
#define rb_fd_init(f) FD_ZERO(f)
#define rb_fd_init_copy(d, s) (*(d) = *(s))
#define rb_fd_term(f) ((void)(f))
#define rb_fd_max(f)  FD_SETSIZE
#define rb_fd_select(n, rfds, wfds, efds, timeout)  \
  select(fd_check((n)-1) ? (n) : FD_SETSIZE, (rfds), (wfds), (efds), (timeout))
#define rb_thread_fd_select(n, rfds, wfds, efds, timeout)  \
  rb_thread_select(fd_check((n)-1) ? (n) : FD_SETSIZE, (rfds), (wfds), (efds), (timeout))
#endif

// This Solaris fix is adapted from eval_intern.h in Ruby 1.9.3:
// Solaris sys/select.h switches select to select_large_fdset to support larger
// file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
// But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
// So following definition is required to use select_large_fdset.
#ifdef HAVE_SELECT_LARGE_FDSET
#define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
extern "C" {
  int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
}
#endif

class EventableDescriptor;
class InotifyDescriptor;
struct SelectData_t;

/*************
enum Poller_t
*************/
enum Poller_t {
	Poller_Default, // typically Select
	Poller_Epoll,
	Poller_Kqueue
};

/********************
class EventMachine_t
********************/

class EventMachine_t
{
	public:
		static int GetMaxTimerCount();
		static void SetMaxTimerCount (int);

		static int GetSimultaneousAcceptCount();
		static void SetSimultaneousAcceptCount (int);

	public:
		EventMachine_t (EMCallback, Poller_t);
		virtual ~EventMachine_t();

		bool RunOnce();
		void Run();
		void ScheduleHalt();
		bool Stopping();
		void SignalLoopBreaker();
		const uintptr_t InstallOneshotTimer (uint64_t);
		const uintptr_t ConnectToServer (const char *, int, const char *, int);
		const uintptr_t ConnectToUnixServer (const char *);

		const uintptr_t CreateTcpServer (const char *, int);
		const uintptr_t OpenDatagramSocket (const char *, int);
		const uintptr_t CreateUnixDomainServer (const char*);
		const uintptr_t AttachSD (SOCKET);
		const uintptr_t OpenKeyboard();
		//const char *Popen (const char*, const char*);
		const uintptr_t Socketpair (char* const*);

		void Add (EventableDescriptor*);
		void Modify (EventableDescriptor*);
		void Deregister (EventableDescriptor*);

		const uintptr_t AttachFD (SOCKET, bool);
		int DetachFD (EventableDescriptor*);

		void ArmKqueueWriter (EventableDescriptor*);
		void ArmKqueueReader (EventableDescriptor*);

		void SetTimerQuantum (int);
		static void SetuidString (const char*);
		static int SetRlimitNofile (int);

		pid_t SubprocessPid;
		int SubprocessExitStatus;

		int GetConnectionCount();
		float GetHeartbeatInterval();
		int SetHeartbeatInterval(float);

		const uintptr_t WatchFile (const char*);
		void UnwatchFile (int);
		void UnwatchFile (const uintptr_t);

		#ifdef HAVE_KQUEUE
		void _HandleKqueueFileEvent (struct kevent*);
		void _RegisterKqueueFileEvent(int);
		#endif

		const uintptr_t WatchPid (int);
		void UnwatchPid (int);
		void UnwatchPid (const uintptr_t);

		#ifdef HAVE_KQUEUE
		void _HandleKqueuePidEvent (struct kevent*);
		#endif

		uint64_t GetCurrentLoopTime() { return MyCurrentLoopTime; }

		void QueueHeartbeat(EventableDescriptor*);
		void ClearHeartbeat(uint64_t, EventableDescriptor*);

		uint64_t GetRealTime();

		Poller_t GetPoller() { return Poller; }

		static int name2address (const char *server, int port, int socktype, struct sockaddr *addr, size_t *addr_len);

	private:
		void _RunTimers();
		void _UpdateTime();
		void _AddNewDescriptors();
		void _ModifyDescriptors();
		void _InitializeLoopBreaker();
		void _CleanupSockets();

		void _RunSelectOnce();
		void _RunEpollOnce();
		void _RunKqueueOnce();

		void _ModifyEpollEvent (EventableDescriptor*);
		void _DispatchHeartbeats();
		timeval _TimeTilNextEvent();
		void _CleanBadDescriptors();

	public:
		void _ReadLoopBreaker();
		void _ReadInotifyEvents();
		int NumCloseScheduled;

	private:
		enum {
			MaxEpollDescriptors = 64*1024,
			MaxEvents = 4096
		};
		int HeartbeatInterval;
		EMCallback EventCallback;

		class Timer_t: public Bindable_t {
		};

		std::multimap<uint64_t, Timer_t> Timers;
		std::multimap<uint64_t, EventableDescriptor*> Heartbeats;
		std::map<int, Bindable_t*> Files;
		std::map<int, Bindable_t*> Pids;
		std::vector<EventableDescriptor*> Descriptors;
		std::vector<EventableDescriptor*> NewDescriptors;
		std::set<EventableDescriptor*> ModifiedDescriptors;

		SOCKET LoopBreakerReader;
		SOCKET LoopBreakerWriter;
		#ifdef OS_WIN32
		struct sockaddr_in LoopBreakerTarget;
		#endif

		timeval Quantum;

		uint64_t MyCurrentLoopTime;

		#ifdef OS_WIN32
		unsigned TickCountTickover;
		unsigned LastTickCount;
		#endif

		#ifdef OS_DARWIN
		mach_timebase_info_data_t mach_timebase;
		#endif

	private:
		bool bTerminateSignalReceived;
		SelectData_t *SelectData;

		Poller_t Poller;

		int epfd; // Epoll file-descriptor
		#ifdef HAVE_EPOLL
		struct epoll_event epoll_events [MaxEvents];
		#endif

		int kqfd; // Kqueue file-descriptor
		#ifdef HAVE_KQUEUE
		struct kevent Karray [MaxEvents];
		#endif

		#ifdef HAVE_INOTIFY
		InotifyDescriptor *inotify; // pollable descriptor for our inotify instance
		#endif
};

/*******************
struct SelectData_t
*******************/

struct SelectData_t
{
	SelectData_t();
	~SelectData_t();

	int _Select();
	void _Clear();

	SOCKET maxsocket;
	rb_fdset_t fdreads;
	rb_fdset_t fdwrites;
	rb_fdset_t fderrors;
	timeval tv;
	int nSockets;
};

#endif // __EventMachine__H_


text:
/** @babel */

import {remote} from 'electron'
import path from 'path'
import ipcHelpers from './ipc-helpers'
import util from 'util'

export default async function () {
  const getWindowLoadSettings = require('./get-window-load-settings')
  const {test, headless, resourcePath, benchmarkPaths} = getWindowLoadSettings()
  try {
    const Clipboard = require('../src/clipboard')
    const ApplicationDelegate = require('../src/application-delegate')
    const AtomEnvironment = require('../src/atom-environment')
    const TextEditor = require('../src/text-editor')
    require('./electron-shims')

    const exportsPath = path.join(resourcePath, 'exports')
    require('module').globalPaths.push(exportsPath) // Add 'exports' to module search path.
    process.env.NODE_PATH = exportsPath // Set NODE_PATH env variable since tasks may need it.

    document.title = 'Benchmarks'
    // Allow `document.title` to be assigned in benchmarks without actually changing the window title.
    let documentTitle = null
    Object.defineProperty(document, 'title', {
      get () { return documentTitle },
      set (title) { documentTitle = title }
    })

    window.addEventListener('keydown', (event) => {
      // Reload: cmd-r / ctrl-r
      if ((event.metaKey || event.ctrlKey) && event.keyCode === 82) {
        ipcHelpers.call('window-method', 'reload')
      }

      // Toggle Dev Tools: cmd-alt-i (Mac) / ctrl-shift-i (Linux/Windows)
      if (event.keyCode === 73) {
        const isDarwin = process.platform === 'darwin'
        if ((isDarwin && event.metaKey && event.altKey) || (!isDarwin && event.ctrlKey && event.shiftKey)) {
          ipcHelpers.call('window-method', 'toggleDevTools')
        }
      }

      // Close: cmd-w / ctrl-w
      if ((event.metaKey || event.ctrlKey) && event.keyCode === 87) {
        ipcHelpers.call('window-method', 'close')
      }

      // Copy: cmd-c / ctrl-c
      if ((event.metaKey || event.ctrlKey) && event.keyCode === 67) {
        ipcHelpers.call('window-method', 'copy')
      }
    }, true)

    const clipboard = new Clipboard()
    TextEditor.setClipboard(clipboard)

    const applicationDelegate = new ApplicationDelegate()
    const environmentParams = {
      applicationDelegate,
      window,
      document,
      clipboard,
      configDirPath: process.env.ATOM_HOME,
      enablePersistence: false
    }
    global.atom = new AtomEnvironment(environmentParams)
    global.atom.initialize(environmentParams)

    // Prevent benchmarks from modifying application menus
    global.atom.menu.sendToBrowserProcess = function () { }

    if (headless) {
      Object.defineProperties(process, {
        stdout: { value: remote.process.stdout },
        stderr: { value: remote.process.stderr }
      })

      console.log = function (...args) {
        const formatted = util.format(...args)
        process.stdout.write(formatted + '\n')
      }
      console.warn = function (...args) {
        const formatted = util.format(...args)
        process.stderr.write(formatted + '\n')
      }
      console.error = function (...args) {
        const formatted = util.format(...args)
        process.stderr.write(formatted + '\n')
      }
    } else {
      remote.getCurrentWindow().show()
    }

    const benchmarkRunner = require('../benchmarks/benchmark-runner')
    const statusCode = await benchmarkRunner({test, benchmarkPaths})
    if (headless) {
      exitWithStatusCode(statusCode)
    }
  } catch (error) {
    if (headless) {
      console.error(error.stack || error)
      exitWithStatusCode(1)
    } else {
      ipcHelpers.call('window-method', 'openDevTools')
      throw error
    }
  }
}

function exitWithStatusCode (statusCode) {
  remote.app.emit('will-quit')
  remote.process.exit(statusCode)
}

redpajama_set_name: RedPajamaGithub


text:
require 'puppet/util/instrumentation'

# This is the central point of all declared probes.
# Every class needed to declare probes should include this module
# and declare the methods that are subject to instrumentation:
#
#   class MyClass
#     extend Puppet::Util::Instrumentation::Instrumentable
#
#     probe :mymethod
#
#     def mymethod
#       ... this is code to be instrumented ...
#     end
#   end
module Puppet::Util::Instrumentation::Instrumentable
  INSTRUMENTED_CLASSES = {}

  attr_reader :probes

  class Probe
    attr_reader :klass, :method, :label, :data

    def initialize(method, klass, options = {})
      @method = method
      @klass = klass

      @label = options[:label] || method
      @data = options[:data] || {}
    end

    def enable
      raise "Probe already enabled" if enabled?

      # We're forced to perform this copy because in the class_eval'uated
      # block below @method would be evaluated in the class context. It's better
      # to close on locally-scoped variables than to resort to complex namespacing
      # to get access to the probe instance variables.
      method = @method; label = @label; data = @data
      klass.class_eval {
        alias_method("instrumented_#{method}", method)
        define_method(method) do |*args|
          id = nil
          instrumentation_data = nil
          begin
            instrumentation_label = label.respond_to?(:call) ? label.call(self, args) : label
            instrumentation_data = data.respond_to?(:call) ? data.call(self, args) : data
            id = Puppet::Util::Instrumentation.start(instrumentation_label, instrumentation_data)
            send("instrumented_#{method}".to_sym, *args)
          ensure
            Puppet::Util::Instrumentation.stop(instrumentation_label, id, instrumentation_data || {})
          end
        end
      }
      @enabled = true
    end

    def disable
      raise "Probe is not enabled" unless enabled?

      # For the same reason as in #enable, we're forced to do a local
      # copy
      method = @method
      klass.class_eval do
        alias_method(method, "instrumented_#{method}")
        remove_method("instrumented_#{method}".to_sym)
      end
      @enabled = false
    end

    def enabled?
      !!@enabled
    end
  end

  # Declares a new probe
  #
  # It is possible to pass several options that will be later on evaluated
  # and sent to the instrumentation layer.
  #
  # label::
  #   this can either be a static symbol/string or a block. If it's a block
  #   this one will be evaluated on every call of the instrumented method and
  #   should return a string or a symbol
  #
  # data::
  #   this can be a hash or a block. If it's a block this one will be evaluated
  #   on every call of the instrumented method and should return a hash.
  #
  #Example:
  #
  #   class MyClass
  #     extend Instrumentable
  #
  #     probe :mymethod, :data => Proc.new { |args|  { :data => args[1] } }, :label => Proc.new { |args| args[0] }
  #
  #     def mymethod(name, options)
  #     end
  #
  #   end
  #
  def probe(method, options = {})
    (@probes ||= []) << Probe.new(method, self, options)
    INSTRUMENTED_CLASSES[self] = @probes
  end

  def self.probes
    @probes
  end

  def self.probe_names
    probe_names = []
    each_probe { |probe| probe_names << "#{probe.klass}.#{probe.method}" }
    probe_names
  end

  def self.enable_probes
    each_probe { |probe| probe.enable }
  end

  def self.disable_probes
    each_probe { |probe| probe.disable }
  end

  def self.clear_probes
    INSTRUMENTED_CLASSES.clear
    nil # do not leak our probes to the exterior world
  end

  def self.each_probe
    INSTRUMENTED_CLASSES.each_key do |klass|
      klass.probes.each { |probe| yield probe }
    end
    nil # do not leak our probes to the exterior world
  end
end


text:
CliCommand::CliCommand(QObject *parent)
	: QObject(parent)
{}


text:
/*Declare two string variables and assign them with following value: The "use" of quotations causes difficulties.
Do the above in two different ways - with and without using quoted strings.
Print the variables to ensure that their value was correctly defined.*/

using System;

namespace QuotesInString
{
    class QuotesInString
    {
        static void Main()
        {
            string varUseQuote = "The \"use\" of quotations causes difficulties.";
            string varWithoutQuotesEscape =@"The ""use"" of quotations causes difficulties.";
            Console.WriteLine(varUseQuote);
            Console.WriteLine(varWithoutQuotesEscape);
        }
    }
}


text:
package demo.testing.junit;

public class Library {
    public boolean method1() {
        return true;
    }
}


text:
namespace allocgc { namespace details { namespace allocators {

const size_t gc_core_allocator::HEAP_START_LIMIT = 4 * 1024 * 1024;

const double gc_core_allocator::INCREASE_FACTOR = 2.0;

const double gc_core_allocator::MARK_THRESHOLD = 0.6;

const double gc_core_allocator::COLLECT_THRESHOLD = 1.0;

gc_core_allocator::gc_core_allocator()
    : m_gc_launcher(nullptr)
    , m_heap_size(0)
    , m_heap_limit(HEAP_START_LIMIT)
    , m_heap_maxlimit(std::numeric_limits<size_t>::max())
    , m_mark_threshold(false)
{ }

gc_core_allocator::gc_core_allocator(gc_launcher* gc)
    : m_gc_launcher(gc)
    , m_heap_size(0)
    , m_heap_limit(HEAP_START_LIMIT)
    , m_heap_maxlimit(std::numeric_limits<size_t>::max())
{ }

byte* gc_core_allocator::allocate(size_t size)
{
    assert(size != 0);
    size_t aligned_size = sys_allocator::align_size(size);

    std::unique_lock<mutex_t> lock(m_mutex);

    if (!increase_heap_size(aligned_size, &lock)) {
        return nullptr;
    }

    byte* page = nullptr;
    if (aligned_size <= MAX_BUCKETIZE_SIZE) {
        page = m_bucket_alloc.allocate(aligned_size);
        memset(page, 0, aligned_size);
    } else {
        page = sys_allocator::allocate(aligned_size);
    }
    return page;
}

void gc_core_allocator::deallocate(byte* ptr, size_t size)
{
    assert(size != 0);

    std::lock_guard<mutex_t> lock(m_mutex);

    size_t aligned_size = sys_allocator::align_size(size);

    if (aligned_size <= MAX_BUCKETIZE_SIZE) {
        m_bucket_alloc.deallocate(ptr, aligned_size);
    } else {
        m_freelist.deallocate(ptr, aligned_size);
    }

    decrease_heap_size(aligned_size);
}

size_t gc_core_allocator::shrink()
{
    std::lock_guard<mutex_t> lock(m_mutex);
    return m_freelist.shrink();
}

gc_core_allocator::memory_range_type gc_core_allocator::memory_range()
{
    return memory_range_type(nullptr, nullptr);
}

bool gc_core_allocator::increase_heap_size(size_t alloc_size, std::unique_lock<mutex_t>* lock)
{
    size_t size = m_heap_size + alloc_size;
    if (size > COLLECT_THRESHOLD * m_heap_limit) {
        return false;
    }
    else if (!m_mark_threshold && m_gc_launcher && m_gc_launcher->info().incremental_flag
             && size > MARK_THRESHOLD * m_heap_limit) {
        m_mark_threshold = true;

        gc_options opt;
        opt.kind = gc_kind::LAUNCH_CONCURRENT_MARK;
        opt.gen  = 0;

        lock->unlock();
        m_gc_launcher->gc(opt);
        lock->lock();
    }
    m_heap_size += alloc_size;
    return true;
}

void gc_core_allocator::decrease_heap_size(size_t size)
{
    m_heap_size -= size;
}

void gc_core_allocator::set_heap_limit(size_t limit)
{
    std::lock_guard<std::mutex> lock(m_mutex);
    m_heap_limit = limit;
//    m_heap_maxlimit = limit;
}

void gc_core_allocator::expand_heap(double increase_factor)
{
    std::lock_guard<std::mutex> lock(m_mutex);
    size_t increased_size = increase_factor * m_heap_limit;
    m_heap_limit = std::min(increased_size, m_heap_maxlimit);
    m_mark_threshold = false;
}

void gc_core_allocator::notify_gc()
{
    std::lock_guard<std::mutex> lock(m_mutex);
    m_mark_threshold = false;
}

gc_runstat gc_core_allocator::gc(const gc_options& options)
{
    assert(m_gc_launcher);
    return m_gc_launcher->gc(options);
}

size_t gc_core_allocator::page_bucket_policy::bucket(size_t size)
{
    return (size >> PAGE_SIZE_LOG2) - 1;
}

size_t gc_core_allocator::page_bucket_policy::bucket_size(size_t i)
{
    return (i + 1) << PAGE_SIZE_LOG2;
}

}}}


text:
package com.piketec.tpt.api.steplist;

import java.rmi.RemoteException;

/**
 * The {@link TableStep} is a step which provides the possibility to manage and execute similar wait
 * blocks in a compressed way. Abstractly, a {@link TableStep} consists of some usual columns and a
 * single (unusual) wait column. The usual columns will be, dependent to their
 * {@link TableStepColumnType}, executed as long there is enough time left. The time limit is
 * defined by the wait column. Then the next row will be executed.

 *

 */
public interface TableStep extends Step {

  /**
   * A table step column can apply the (check-,set-,call-)-rules.
   */
  enum TableStepColumnType {
    /**
     * This type provides a comparison operation in each row.
     */
    CHECK,
    /**
     * This type provides an assignment operation in each row.
     */
    SET,
    /**
     * This type provides a function call in each row.
     */
    CALL;
  }

  /**
   * @param columnIndex
   *          column index
   * @return the {@link TableStepColumnType} of the columnPosth column.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public TableStepColumnType getColumnType(int columnIndex) throws RemoteException;

  /**
   * Sets the {@link TableStepColumnType} of the column at position columnPos.
   *
   * @param columnIndex
   *          column index
   * @param type
   *          type of this column
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void setColumnType(int columnIndex, TableStepColumnType type) throws RemoteException;

  /**
   * @param columnIndex
   *          column index
   * @return the declaration name of the columnPosth column.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public String getDeclarationName(int columnIndex) throws RemoteException;

  /**
   * Sets the declaration of the columnPosth column by their name.
   *
   * @param columnIndex
   *          column index
   * @param name
   *          name of the channel/parameter/measurement/assessment to set/check in this column
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void setDeclarationName(int columnIndex, String name) throws RemoteException;

  /**
   * @param rowIndex
   *          row index
   * @return the time to wait after the row is executed.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public String getWaitExpr(int rowIndex) throws RemoteException;

  /**
   * Set the time to wait after the row is executed.
   *
   * @param rowIndex
   *          row index
   * @param expr
   *          expression to use as wait condition in this row
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void setWaitExpr(int rowIndex, String expr) throws RemoteException;

  /**
   * @param rowIndex
   *          row index
   * @param columnIndex
   *          column index
   * @return the value of an cell in the table.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public String getValueAt(int rowIndex, int columnIndex) throws RemoteException;

  /**
   * Sets the value of a cell in the table.
   *
   * @param rowIndex
   *          row index
   * @param columnIndex
   *          column index
   * @param value
   *          the expression to use in the specified table cell
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void setValueAt(int rowIndex, int columnIndex, String value) throws RemoteException;

  /**
   * Adds a new column at index. Index values starts to count with zero.
   *
   * @param index
   *          column index
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void addColumn(int index) throws RemoteException;

  /**
   * Removes the column at index. Index values starts to count with zero.
   *
   * @param index
   *          column index
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void removeColumn(int index) throws RemoteException;

  /**
   * Adds a new row at index. Index values starts to count with zero.
   *
   * @param index
   *          row index
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void addRow(int index) throws RemoteException;

  /**
   * Removes the row at index. Index values starts to count with zero.
   *
   * @param index
   *          row index
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public void removeRow(int index) throws RemoteException;

  /**
   * @return The number of columns, time column not included.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public int getColumnCount() throws RemoteException;

  /**
   * @return The number of rows, header row not included.
   *
   * @throws RemoteException
   *           remote communication problem
   */
  public int getRowCount() throws RemoteException;

}


text:
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="noindex,nofollow" />
<meta name="description" content="<?php echo SYSTEM_NAME; ?>" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<!-- will need the PSD to generate these
<link rel="shortcut icon" href="<?php echo FULL_URL; ?>_core/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="<?php echo FULL_URL; ?>_core/img/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="<?php echo FULL_URL; ?>_core/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo FULL_URL; ?>_core/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo FULL_URL; ?>_core/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo FULL_URL; ?>_core/img/touch-icon-ipad-retina.png">
-->
<title><?php echo SYSTEM_NAME; ?></title>
<!-- CSS -->
<link href='http://fonts.googleapis.com/css?family=Share+Tech' rel='stylesheet' type='text/css'>
<link href="<?php echo FULL_URL; ?>_core/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="<?php echo FULL_URL; ?>_core/js/plugins/datatables/css/jquery.dataTables.css" rel="stylesheet">
<link href="<?php echo FULL_URL; ?>_core/js/plugins/datatables/css/datatables.responsive.css" rel="stylesheet">
<link href="<?php echo FULL_URL; ?>_core/js/plugins/fineuploader/fineuploader.css" rel="stylesheet">
<link href="<?php echo FULL_URL; ?>_core/js/plugins/ui/jquery-ui-1.10.3.custom.min.css" rel="stylesheet">
<link href="<?php echo FULL_URL; ?>_core/css/styles.css?v2" type="text/css" rel="stylesheet" />
<!-- end CSS -->
<link rel="shortcut icon" href="<?php echo FULL_URL; ?>_core/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="<?php echo FULL_URL; ?>_core/img/favicon.ico" type="image/x-icon">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="<?php FULL_URL ?>_core/js/html5shiv.js"></script>
  <script src="<?php FULL_URL ?>_core/js/respond.min.js"></script>
<![endif]-->
<!-- jquery -->
<script src="<?php echo FULL_URL; ?>_core/js/jquery-1.9.1.min.js"></script>
<script src="<?php echo FULL_URL; ?>_core/js/jquery-migrate-1.2.1.min.js"></script>
<script src="<?php echo FULL_URL; ?>_core/js/plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>
<!-- end jquery -->


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.sunsystem.downloadfilechatapp"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:name=".downloader.utils.ApplicationClass"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".downloader.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <service android:name=".downloader.downloadServices.StartedServiceDownload"/>
        <service android:name=".downloader.downloadServices.IntentServiceDownload"/>

    </application>

</manifest>


text:
CodeMirror.registerHelper("fold", "markdown", function(cm, start) {
  var maxDepth = 100;

  function isHeader(lineNo) {
    var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
    return tokentype && /\bheader\b/.test(tokentype);
  }

  function headerLevel(lineNo, line, nextLine) {
    var match = line && line.match(/^#+/);
    if (match && isHeader(lineNo)) return match[0].length;
    match = nextLine && nextLine.match(/^[=\-]+\s*$/);
    if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
    return maxDepth;
  }

  var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
  var level = headerLevel(start.line, firstLine, nextLine);
  if (level === maxDepth) return undefined;

  var lastLineNo = cm.lastLine();
  var end = start.line, nextNextLine = cm.getLine(end + 2);
  while (end < lastLineNo) {
    if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
    ++end;
    nextLine = nextNextLine;
    nextNextLine = cm.getLine(end + 2);
  }

  return {
    from: CodeMirror.Pos(start.line, firstLine.length),
    to: CodeMirror.Pos(end, cm.getLine(end).length)
  };
});


text:
'use strict';

/**
 * @ngdoc function
 * @name catsGoApp.controller:MainCtrl
 * @descriptionhttp://localhost:9000/#/
 * # MainCtrl
 * Controller of the catsGoApp
 */
angular.module('catsGoApp')
  .controller('MainCtrl', ['$scope','mainService', function ($scope,mainService) {
   var baseURL='http://lorempixel.com/1920/1080/';

/*testing --------> mainService.get(URL,callback,config (params)) mainService.getPromises() */
mainService.get('database/quotes.json',function(data){
    var a=mainService.randomArray(3,10);
    var b=mainService.randomArray(3,data.frases.length,0);
    $scope.thumbnails = [
    {
      title:'',
      image:baseURL+'cats/'+a[0],
      quote:data.frases[b[0]].quote,
      author:data.frases[b[0]].author
    },
       {
      title:'',
      image:baseURL+'cats/'+a[1],
      quote:data.frases[b[1]].quote,
      author:data.frases[b[1]].author
    },
       {
      title:'',
      image:baseURL+'cats/'+a[2],
      quote:data.frases[b[2]].quote,
      author:data.frases[b[2]].author
    }

    ];
    a=null;
    b=null;
  $scope.onReset = function(){
    var a=mainService.randomArray(3,10);
    var b=mainService.randomArray(3,3,0);

    $scope.thumbnails = [
    {
      title:'',
      image:baseURL+'cats/'+a[0],
      quote:data.frases[b[0]].quote,
      author:data.frases[b[0]].author
    },
       {
      title:'',
      image:baseURL+'cats/'+a[1],
      quote:data.frases[b[1]].quote,
      author:data.frases[b[1]].author
    },
       {
      title:'',
      image:baseURL+'cats/'+a[2],
      quote:data.frases[b[2]].quote,
      author:data.frases[b[2]].author
    }

    ];

};
});

    var randomImage=mainService.randomArray(3,10);
   $scope.slides= [
   {
   	title:'',
    text:'',
   	image:baseURL+'cats/'+randomImage[0],
   	active:'item active'
   },

      {
   	title:'',
    text:'',
   	image:baseURL+'cats/'+randomImage[1],
   	active:'item'
   },

      {
   	title:'',
   	image:baseURL+'cats/'+randomImage[2],
    text:'',
   	active:'item'
   }

   ];

$scope.effectsJquey=$('#mainView').ready(function (){

//console.log($(window).height());  //
//console.log($(document).height()); // FOR TESTING
//console.log($(window).scrollTop()) //

// Espera a que termine de cargar la pagina
$(window).on('load',function() {
  if($(window).height()+$(window).scrollTop()  != $(document).height()) {
$( '.footer' ).hide(500);
console.log('load if hide');
console.log($(window).height(),$(document).height());
   }

else  {
  $( '.footer' ).show(500);
  console.log('bind else show');
}

});

// Detecta un cambio en la posision de la ventana  scroll
 $(window).scroll(function() {
   if($(window).scrollTop() + $(window).height()  == $(document).height() ||   $(document).height()-30<$(window).scrollTop() + $(window).height()) {
       $( '.footer' ).show(500);
   }
   else if($(window).height() != $(document).height()) {
    $( '.footer' ).hide(500);
   }

});

// Detecta un cambio en la URL 'hashchange'

$(window).bind('hashchange',{} ,function() {
// BUG JQUERY and angular. No setea las variables correctamente. //callback use
console.log($(document).height())
console.log(event.height);
console.log($(location).attr('href'));
//Detecta cambios en el DOM window or document.. mediante ciclo.
$(window).bind('DOMSubtreeModified',function() {
if($(window).height()  == $(document).height() && $('.footer').css('display') == 'none') {
  $( '.footer' ).show(500);
  console.log('bind if show');
  console.log($(window).scrollTop(),$(window).height(), $(document).height())
}

else if($('.footer').css('display') == 'block' && $(window).height()+ $(window).scrollTop()  != $(document).height()) {
     console.log($(window).height() , $(window).scrollTop(), $(document).height());
$( '.footer' ).hide(500);

console.log('bind else hide');
   }

   else {
    console.log('nada')
   }

});

console.log('stop(clearQueue, gotoEnd)');

});

// Desactivar eventos in angular scope controller

          $('#secondaryBotton').click(function (){
                if ($(window).width() <= 992) {
              setTimeout(function(){
                         $('html, body').animate({
                        scrollTop: $('#mainBotton').offset().top //Funcion para hacer focus el scroll en un elemento.
                    }, 2000 );   // Duracion del efecto
                                   }, 1); //<< Tiempo en ms.....
             }
               });

               $('.carousel').carousel({
                 interval: 5000
                       });

$('#secondaryBotton').click(function() {
    $(window).off('DOMSubtreeModified');

});

$('#secondaryBotton').click(function() {
    $('#owl-carousel-gallery').off();

});

        });

  }]);


text:
package org.apache.maven.plugin.dependency.its;

import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.invoker.InvocationRequest;
import org.apache.maven.shared.invoker.InvocationResult;
import org.apache.maven.shared.test.plugin.BuildTool;
import org.apache.maven.shared.test.plugin.PluginTestTool;
import org.apache.maven.shared.test.plugin.ProjectTool;
import org.apache.maven.shared.test.plugin.TestToolsException;
import org.codehaus.classworlds.ClassRealm;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.StringUtils;

/**
 * @author Brian Fox
 *         Copied from the Eclipse
 *         AbstractEclipsePluginTestCase v2.4
 * @version $Id: AbstractDependencyPluginITCase.java 556442
 *          2007-07-15 20:20:23Z dantran $
 */
public abstract class AbstractDependencyPluginITCase
    extends PlexusTestCase
{

    private BuildTool buildTool;

    private ProjectTool projectTool;

    /**
     * Test repository directory.
     */
    protected static File localRepositoryDirectory = getTestFile( "target/test-classes/m2repo" );

    /**
     * Pom File
     */
    protected static File PomFile = new File( getBasedir(), "pom.xml" );

    /**
     * Group-Id for running test builds.
     */
    protected static final String GROUP_ID = "org.apache.maven.plugins";

    /**
     * Artifact-Id for running test builds.
     */
    protected static final String ARTIFACT_ID = "maven-dependency-plugin";

    /**
     * Version under which the plugin was installed to the
     * test-time local repository for running test builds.
     */
    protected static final String VERSION = "test";

    private static final String BUILD_OUTPUT_DIRECTORY = "target/surefire-reports/build-output";

    private static boolean installed = false;

    /**
     * @see org.codehaus.plexus.PlexusTestCase#setUp()
     */
    protected void setUp()
        throws Exception
    {
        if ( !installed )
        {
            System.out
                .println( "*** Running test builds; output will be directed to: " + BUILD_OUTPUT_DIRECTORY + "\n" );
        }

        super.setUp();

        buildTool = (BuildTool) lookup( BuildTool.ROLE, "default" );

        projectTool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );

        String mavenHome = System.getProperty( "maven.home" );

        // maven.home is set by surefire when the test is
        // run with maven, but better make the test run in
        // IDEs without
        // the need of additional properties
        if ( mavenHome == null )
        {
            String path = System.getProperty( "java.library.path" );
            String[] paths = StringUtils.split( path, System.getProperty( "path.separator" ) );
            for (String pt : paths) {
                if (new File(pt, "mvn").exists()) {
                    System.setProperty("maven.home", new File(pt).getAbsoluteFile().getParent());
                    break;
                }

            }
        }

        System.setProperty( "MAVEN_TERMINATE_CMD", "on" );

        synchronized ( AbstractDependencyPluginITCase.class )
        {
            if ( !installed )
            {
                PluginTestTool pluginTestTool = (PluginTestTool) lookup( PluginTestTool.ROLE, "default" );

                localRepositoryDirectory = pluginTestTool
                    .preparePluginForUnitTestingWithMavenBuilds( PomFile, "test", localRepositoryDirectory );

                System.out.println( "*** Installed test-version of the Dependency plugin to: "
                    + localRepositoryDirectory + "\n" );

                installed = true;
            }
        }

    }

    /**
     * @see org.codehaus.plexus.PlexusTestCase#tearDown()
     */
    protected void tearDown()
        throws Exception
    {
        super.tearDown();

        List<PlexusContainer> containers = new ArrayList<PlexusContainer>();

        containers.add( getContainer() );

        for ( PlexusContainer container : containers )
        {
            if ( container != null )
            {
                container.dispose();

                ClassRealm realm = container.getContainerRealm();

                if ( realm != null )
                {
                    realm.getWorld().disposeRealm( realm.getId() );
                }
            }
        }
    }

    /**
     * Execute the plugin with no properties
     *
     * @param projectName project directory
     * @param goalList comma separated list of goals to
     *            execute
     * @throws Exception any exception generated during test
     */
    protected void testProject( String projectName, String goalList )
        throws Exception
    {
        Properties props = new Properties();
        testProject( projectName, props, goalList );
    }

    /**
     * Execute the plugin.
     *
     * @param projectName project directory
     * @param properties additional properties
     * @param goalList comma separated list of goals to
     *            execute
     * @throws Exception any exception generated during test
     */
    protected void testProject( String projectName, Properties properties, String goalList )
        throws Exception
    {
        File theBasedir = getTestFile( "target/test-classes/its/" + projectName );

        File pom = new File( theBasedir, "pom.xml" );

        List<String> goals = Arrays.asList( goalList.split( "," ) );

        executeMaven( pom, properties, goals );

        // MavenProject project = readProject( pom );

        /*
         * String outputDirPath = IdeUtils.getPluginSetting(
         * project, "maven-dependency-plugin", "outputDir",
         * null ); File outputDir; File projectOutputDir =
         * basedir;
         *
         * if ( outputDirPath == null ) { outputDir =
         * basedir; } else { outputDir = new File( basedir,
         * outputDirPath ); outputDir.mkdirs();
         * projectOutputDir = new File( outputDir,
         * project.getArtifactId() ); }
         */
    }

    protected File getOutputDirectory( String projectName )
    {
        return getTestFile( "target/test-classes/projects/" + projectName );
    }

    protected void executeMaven( File pom, Properties properties, List<String> goals )
        throws TestToolsException, ExecutionFailedException
    {
        executeMaven( pom, properties, goals, true );
    }

    protected void executeMaven( File pom, Properties properties, List<String> goals, boolean switchLocalRepo )
        throws TestToolsException, ExecutionFailedException
    {
        // insert the test property to activate the test
        // profile
        properties.setProperty( "test", "true" );
        new File( BUILD_OUTPUT_DIRECTORY ).mkdirs();

        File buildLog = null;

        for ( StackTraceElement element : new NullPointerException().getStackTrace() )
        {
            String methodName = element.getMethodName();

            if ( methodName.startsWith( "test" ) && !methodName.equals( "testProject" ) )
            {
                String classname = element.getClassName();

                buildLog = new File( BUILD_OUTPUT_DIRECTORY, classname + "_" + element.getMethodName() + ".build.log" );

                break;
            }
        }

        if ( buildLog == null )
        {
            buildLog = new File( BUILD_OUTPUT_DIRECTORY, "unknown.build.log" );
        }

        InvocationRequest request = buildTool.createBasicInvocationRequest( pom, properties, goals, buildLog );
        request.setUpdateSnapshots( false );
        request.setShowErrors( true );

        request.setDebug( true );

        if ( switchLocalRepo )
        {
            request.setLocalRepositoryDirectory( localRepositoryDirectory );
        }

        InvocationResult result = buildTool.executeMaven( request );

        if ( result.getExitCode() != 0 )
        {
            String buildLogUrl = buildLog.getAbsolutePath();

            try
            {

                buildLogUrl = buildLog.toURI().toURL().toExternalForm();
            }
            catch ( MalformedURLException e )
            {
            }

            throw new ExecutionFailedException( "Failed to execute build.\nPOM: " + pom + "\nGoals: "
                + StringUtils.join( goals.iterator(), ", " ) + "\nExit Code: " + result.getExitCode() + "\nError: "
                + result.getExecutionException() + "\nBuild Log: " + buildLogUrl + "\n", result );
        }
    }

    protected MavenProject readProject( File pom )
        throws TestToolsException
    {
        return projectTool.readProject( pom, localRepositoryDirectory );
    }

    protected String getPluginCLISpecification()
    {
        String pluginSpec = GROUP_ID + ":" + ARTIFACT_ID + ":";

        // String pluginVersion = System.getProperty(
        // "pluginVersion" );
        //
        // if ( pluginVersion != null )
        // {
        // pluginSpec += pluginVersion + ":";
        // }
        //
        // System.out.println( "\n\nUsing Eclipse plugin
        // version: " + pluginVersion + "\n\n" );

        // try using the test-version installed during
        // setUp()
        pluginSpec += VERSION + ":";

        return pluginSpec;
    }
}


text:
@implementation MASparks

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        self.mArrTimers = [[NSMutableArray alloc]init];

        self.intSizeFrom = 3;
        self.intSizeTo = 15;

        float r = (float)255/255;
        float g = (float)255/255;
        float b = (float)0/255;

        self.colorFrom = [UIColor colorWithRed:r green:g blue:b alpha:1];

        r = (float)255/255;
        g = (float)0/255;
        b = (float)125/255;

        self.colorTo = [UIColor colorWithRed:r green:g blue:b alpha:1];

        self.backgroundColor = [UIColor blackColor];
        self.multipleTouchEnabled = true;
    }
    return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

    for (int a = 0; a<[touches count]; a++) {
        UITouch * touch = [[touches allObjects]objectAtIndex:a];
        CGPoint location = [touch locationInView:self];

        NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(timerSparksCircle:) userInfo:[NSValue valueWithCGPoint:location] repeats:YES];
        [self.mArrTimers addObject:timer];
    }
    NSLog(@"%d",[self.mArrTimers count]);

//    UITouch *touch = [touches anyObject];
//
//    self.location = [touch locationInView:self];
//
//    //timerSparks = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(timerSparks:) userInfo:[NSValue valueWithCGPoint:location] repeats:YES];
//    self.timerSparks = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(timerSparksCircle:) userInfo:[NSValue valueWithCGPoint:self.location] repeats:YES];

}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{

    for (NSTimer *timer in self.mArrTimers) {
        [timer invalidate];
        [self.mArrTimers removeObject:timer];
    }

    for (int a = 0; a<[touches count]; a++) {
        UITouch * touch = [[touches allObjects]objectAtIndex:a];
        CGPoint location = [touch locationInView:self];

        NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(timerSparksCircle:) userInfo:[NSValue valueWithCGPoint:location] repeats:YES];
        [self.mArrTimers addObject:timer];
    }

}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{

    for (int a = 0; a<[self.mArrTimers count]; a++) {
        NSTimer *timer = [self.mArrTimers objectAtIndex:a];
        [timer invalidate];
    }
    [self.mArrTimers removeAllObjects];

    for (int a = 0; a<[touches count]; a++) {
        UITouch * touch = [[touches allObjects]objectAtIndex:a];
        CGPoint location = [touch locationInView:self];

        NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(timerSparksCircle:) userInfo:[NSValue valueWithCGPoint:location] repeats:YES];
        [self.mArrTimers addObject:timer];
    }

}

-(void)timerSparks:(NSTimer *)timer{

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.intSizeFrom, self.intSizeFrom)];
    view.center = self.location;
    view.layer.cornerRadius = view.frame.size.width/2;
    [self addSubview:view];

    int mySizeTo = arc4random()%self.intSizeTo;

    int x = 75-arc4random()%200;
    int y = 75-arc4random()%200;

    view.backgroundColor = self.colorFrom;
    int interval = arc4random()%10;
    float fInterval = (float)interval/10+0.1;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:fInterval];
    view.frame = CGRectMake(self.location.x, self.location.y, mySizeTo, mySizeTo);
    view.layer.cornerRadius = view.frame.size.width/2;
    view.center = CGPointMake(self.location.x+x, self.location.y+y);
    view.alpha = 0;
    view.backgroundColor = self.colorTo;

    [UIView commitAnimations];
    [self performSelector:@selector(removeMyView:) withObject:view afterDelay:fInterval];
}

-(void)timerSparksCircle:(NSTimer *)timer{

    CGPoint location = [[timer userInfo]CGPointValue];

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.intSizeFrom, self.intSizeFrom)];
    view.center = location;
    view.layer.cornerRadius = view.frame.size.width/2;
    [self addSubview:view];

    int mySizeTo = arc4random()%self.intSizeTo;

    int degree = arc4random()%360;
    int radius = arc4random()%100;

    UIBezierPath *aPath = [UIBezierPath bezierPathWithArcCenter:location radius:radius startAngle:0 endAngle:degree clockwise:YES];

    view.backgroundColor = self.colorFrom;
    int interval = arc4random()%10;
    float fInterval = (float)interval/10+0.1;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:fInterval];
    view.frame = CGRectMake(location.x, location.y, mySizeTo, mySizeTo);
    view.layer.cornerRadius = view.frame.size.width/2;
    view.center = aPath.currentPoint;
    view.alpha = 0;
    view.backgroundColor = self.colorTo;

    [UIView commitAnimations];
    [self performSelector:@selector(removeMyView:) withObject:view afterDelay:fInterval];
}

-(void)removeMyView:(UIView *)view{
    [view removeFromSuperview];
}

@end


text:
header,nav,aside,footer,section,article{
    display:block;
}
*{
    box-sizing: border-box;
}
*:before, *:after {
    box-sizing: border-box;
}

header .container{
    margin-left:auto;
    margin-right:auto;
    padding-left:15px;
    padding-right:5px;
    background-image: url("https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://s3.amazonaws.com/coursera_assets/growth_frontpage/us_europe/Bitmap.png?auto=format&dpr=2&fit=crop");
    background-repeat: no-repeat;
    width:auto;
    height:600px;
    border-bottom: 60px solid orange;
}
header nav{
    position:fixed;
    left:0;
    right:0;
    margin:40px 0px;
    z-index: 1;
}
header .logo-class {
    display:block;
    float:left;
    margin: -14px 20px;
    padding:0;
}
header img{
    height:75px;
    width:300px;
    opacity:0.6;
    box-shadow: gray 2px 2px;
}

header .navigation{
    float:right;
    margin-right:20px;
}
header table a{
    padding:15px;
    margin:4px;
    background-color: yellow;
    color:red;
    width:100px;
    border-radius: 10%;
    text-decoration: none;
}
header a:hover{
    background-color: green;
    color:red;
}
section .container{
    margin-left:auto;
    margin-right:auto;
    margin-top:30px;
    padding-left:15px;
    padding-right:5px;
    width:auto;
    height:600px;
}
section .section1 h1{
    text-align: center;
    color: orange;
}
section .section1 h4{
    text-align: center;
}
section .section1 .circle{
    height:240px;
    width:240px;
    border: 6px solid orange;
    border-radius: 50%;
    margin: 80px auto;
    padding:20px;
}
section .section1 .circle .title h4{

    margin-left: 6px;
    margin-top: 20px;
    font-weight:bolder;
    color:orange;
}
section .section1 .circle .title h5{

    margin-left: 45px;
    font-weight: bold;
}
section .section1 .circle .title p{
    text-align:center;
}
section .section2 .banner{
    margin-left:auto;
    margin-right:auto;
    padding-left:15px;
    padding-right:5px;
    background-image: url("https://egen.solutions/images/banner-2.jpg");
    background-repeat: no-repeat;
    width:auto;
    height:600px;
    position:relative;
    padding: 80px 0px;
    color:white;
    text-align:center;
    border-bottom: 60px solid orange;
}
section .section2 .content{
    padding:60px;
    margin-top:80px;
    background: rgba(3,14,40,0.27);

}
section .section2 .content h1{
    color:white;
    text-align:center;

}
section .section2 .content h2{
    color:orange;
    text-align:center;

}
section .section3{
    background-color: #ebeff2;
    height:400px;
    position:relative;
    padding: 80px 0px;
}

section .section3 .banner{
    text-align:center;
    padding: 20px;
    margin-top:10px;
}
section .section3 .banner:before, section .section3 .banner:after{
    content:"";
    display:inline-block;
    height:2px;
    width:300px;
    background-color: #EA5A27;
}


text:
package com.laytonsmith.abstraction;

import java.util.List;

public interface MCMetadatable extends AbstractionObject {
	public List<MCMetadataValue> getMetadata(String metadataKey);

	public boolean hasMetadata(String metadataKey);

	public void removeMetadata(String metadataKey, MCPlugin owningPlugin);

	public void setMetadata(String metadataKey, MCMetadataValue newMetadataValue);
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.vsked</groupId>
  <artifactId>xmldemo</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>xmldemo Maven Webapp</name>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.8</java.version>
		<slf4j.version>1.7.25</slf4j.version>
		<log4j2.version>2.11.0</log4j2.version>
		<dom4j.version>2.1.3</dom4j.version>
		<jackson.version>2.9.9</jackson.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
		</dependency>
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.glassfish.web/jstl-impl -->
		<dependency>
			<groupId>org.glassfish.web</groupId>
			<artifactId>jstl-impl</artifactId>
			<version>1.2</version>
		</dependency>
<!-- slf4j start -->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>${slf4j.version}</version>
</dependency>

<!-- slf4j end -->
		<!-- log4j2 start -->
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
			<version>${log4j2.version}</version>
</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>${log4j2.version}</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>${log4j2.version}</version>
		</dependency>
		<!-- log4j2 end -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.7</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.dom4j/dom4j -->
<dependency>
    <groupId>org.dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>${dom4j.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>
<!-- jackson start -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>${jackson.version}</version>
</dependency>
<dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-xml</artifactId>
      <version>${jackson.version}</version>
    </dependency>
<!-- jackson end -->

  </dependencies>
  <build>
    <finalName>xmldemo</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<!-- true:跳过测试 -->
					<skip>true</skip>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<!-- skip the test -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
  </build>
</project>


text:
Inconsolata
https://www.google.com/fonts/specimen/Inconsolata
http://www.levien.com/type/myfonts/inconsolata.html

Available under the SIL Open Font License, 1.1.
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL


text:
<?php

final class DrydockLogQuery extends DrydockQuery {

  private $resourceIDs;
  private $leaseIDs;

  public function withResourceIDs(array $ids) {
    $this->resourceIDs = $ids;
    return $this;
  }

  public function withLeaseIDs(array $ids) {
    $this->leaseIDs = $ids;
    return $this;
  }

  protected function loadPage() {
    $table = new DrydockLog();
    $conn_r = $table->establishConnection('r');

    $data = queryfx_all(
      $conn_r,
      'SELECT log.* FROM %T log %Q %Q %Q',
      $table->getTableName(),
      $this->buildWhereClause($conn_r),
      $this->buildOrderClause($conn_r),
      $this->buildLimitClause($conn_r));

    return $table->loadAllFromArray($data);
  }

  protected function willFilterPage(array $logs) {
    $resource_ids = array_filter(mpull($logs, 'getResourceID'));
    if ($resource_ids) {
      $resources = id(new DrydockResourceQuery())
        ->setParentQuery($this)
        ->setViewer($this->getViewer())
        ->withIDs($resource_ids)
        ->execute();
    } else {
      $resources = array();
    }

    foreach ($logs as $key => $log) {
      $resource = null;
      if ($log->getResourceID()) {
        $resource = idx($resources, $log->getResourceID());
        if (!$resource) {
          unset($logs[$key]);
          continue;
        }
      }
      $log->attachResource($resource);
    }

    $lease_ids = array_filter(mpull($logs, 'getLeaseID'));
    if ($lease_ids) {
      $leases = id(new DrydockLeaseQuery())
        ->setParentQuery($this)
        ->setViewer($this->getViewer())
        ->withIDs($lease_ids)
        ->execute();
    } else {
      $leases = array();
    }

    foreach ($logs as $key => $log) {
      $lease = null;
      if ($log->getLeaseID()) {
        $lease = idx($leases, $log->getLeaseID());
        if (!$lease) {
          unset($logs[$key]);
          continue;
        }
      }
      $log->attachLease($lease);
    }

    // These logs are meaningless and their policies aren't computable. They
    // shouldn't exist, but throw them away if they do.
    foreach ($logs as $key => $log) {
      if (!$log->getResource() && !$log->getLease()) {
        unset($logs[$key]);
      }
    }

    return $logs;
  }

  protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
    $where = array();

    if ($this->resourceIDs) {
      $where[] = qsprintf(
        $conn_r,
        'resourceID IN (%Ld)',
        $this->resourceIDs);
    }

    if ($this->leaseIDs) {
      $where[] = qsprintf(
        $conn_r,
        'leaseID IN (%Ld)',
        $this->leaseIDs);
    }

    $where[] = $this->buildPagingClause($conn_r);

    return $this->formatWhereClause($where);
  }

}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace P1
{
    public static class IOUtils
    {
        public static string ReadLine(TextReader txtIn)
        {
            string line;

            do
            {
                line = txtIn.ReadLine();
            }
            while (line != null && line.StartsWith("!"));

            return line;
        }

        public static int[] ReadInts(TextReader txtIn)
        {
            return ReadLine(txtIn).Split(' ').Select(s => int.Parse(s)).ToArray();
        }

        public static long[] ReadLongs(TextReader txtIn)
        {
            return ReadLine(txtIn).Split(' ').Select(s => long.Parse(s)).ToArray();
        }

        public static double[] ReadDoubles(TextReader txtIn)
        {
            return ReadLine(txtIn).Split(' ').Select(s => double.Parse(s)).ToArray();
        }

        public static T[,] ReadTable<T>(TextReader txtIn, int numCols, Func<string, T> func, int numRows = -1, char sep = ' ')
        {
            // Gets number of rows from parameter or input
            if (numRows == -1)
            {
                numRows = int.Parse(ReadLine(txtIn));
            }

            T[,] table = new T[numRows, numCols];

            // Reads each row and splits into columns
            for (int row = 0; row < numRows; row++)
            {
                var rec = ReadLine(txtIn).Split(sep).Select(s => func(s)).ToArray();
                Debug.Assert(rec.Length == numCols);
                for (int col = 0; col < numCols; col++)
                {
                    table[row, col] = rec[col];
                }
            }

            return table;
        }
    }
}


text:
package com.evolveum.midpoint.web.page.admin.reports.component;

import static java.util.stream.Collectors.toList;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEventSink;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.export.CSVDataExporter;
import org.apache.wicket.extensions.markup.html.repeater.data.table.export.ExportToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn;
import org.apache.wicket.extensions.yui.calendar.DateTimeField;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.ResourceLink;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.request.component.IRequestablePage;
import org.apache.wicket.request.resource.ResourceStreamResource;
import org.apache.wicket.util.resource.IResourceStream;

import com.evolveum.midpoint.audit.api.AuditEventRecord;
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.component.button.CsvDownloadButtonPanel;
import com.evolveum.midpoint.gui.api.component.path.ItemPathDto;
import com.evolveum.midpoint.gui.api.component.path.ItemPathPanel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.prism.path.CanonicalItemPath;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.data.column.LinkColumn;
import com.evolveum.midpoint.web.component.form.multivalue.MultiValueChoosePanel;
import com.evolveum.midpoint.web.component.input.DatePanel;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.input.QNameChoiceRenderer;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior;
import com.evolveum.midpoint.web.page.admin.reports.PageAuditLogDetails;
import com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordProvider;
import com.evolveum.midpoint.web.page.admin.reports.dto.AuditSearchDto;
import com.evolveum.midpoint.web.page.admin.users.PageUser;
import com.evolveum.midpoint.web.session.AuditLogStorage;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.util.DateValidator;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventStageType;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventTypeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

/**
 * Created by honchar.
 */
public class AuditLogViewerPanel extends BasePanel {

	private static final long serialVersionUID = 1L;
    private static final String ID_PARAMETERS_PANEL = "parametersPanel";
    private static final String ID_TABLE = "table";
    private static final String ID_FROM = "fromField";
    private static final String ID_TO = "toField";
    private static final String ID_INITIATOR_NAME = "initiatorNameField";
    private static final String ID_TARGET_NAME_FIELD = "targetNameField";
    private static final String ID_TARGET_NAME = "targetName";
    private static final String ID_TARGET_OWNER_NAME = "targetOwnerName";
    private static final String ID_TARGET_OWNER_NAME_FIELD = "targetOwnerNameField";
    private static final String ID_CHANNEL = "channelField";
    private static final String ID_HOST_IDENTIFIER = "hostIdentifierField";
    private static final String ID_EVENT_TYPE = "eventTypeField";
    private static final String ID_EVENT_STAGE_FIELD = "eventStageField";
    private static final String ID_EVENT_STAGE = "eventStage";
    private static final String ID_OUTCOME = "outcomeField";
    private static final String ID_CHANGED_ITEM = "changedItem";
    private static final String ID_VALUE_REF_TARGET_NAMES_FIELD = "valueRefTargetNamesField";
	private static final String ID_VALUE_REF_TARGET_NAMES = "valueRefTargetNames";

    private static final String ID_MAIN_FORM = "mainForm";
    private static final String ID_SEARCH_BUTTON = "searchButton";
    private static final String ID_FEEDBACK = "feedback";

    public static final String TARGET_NAME_LABEL_VISIBILITY = "targetNameLabel";
    public static final String TARGET_NAME_FIELD_VISIBILITY = "targetFieldField";
    public static final String TARGET_OWNER_LABEL_VISIBILITY = "targetOwnerLabel";
    public static final String TARGET_OWNER_FIELD_VISIBILITY = "targetOwnerField";
    public static final String TARGET_COLUMN_VISIBILITY = "targetColumn";
    public static final String TARGET_OWNER_COLUMN_VISIBILITY = "targetOwnerColumn";
	public static final String VALUE_REF_TARGET_NAME_LABEL_VISIBILITY = "valueRefTargetNameLabel";
	public static final String VALUE_REF_TARGET_NAME_FIELD_VISIBILITY = "valueRefTargetNameField";
    public static final String EVENT_STAGE_COLUMN_VISIBILITY = "eventStageColumn";
    public static final String EVENT_STAGE_LABEL_VISIBILITY = "eventStageLabel";
    public static final String EVENT_STAGE_FIELD_VISIBILITY = "eventStageField";

    static final Trace LOGGER = TraceManager.getTrace(AuditLogViewerPanel.class);

    private static final String OPERATION_RESOLVE_REFENRENCE_NAME = AuditLogViewerPanel.class.getSimpleName()
            + ".resolveReferenceName()";

    private static final int DEFAULT_PAGE_SIZE = 10;
    private IModel<AuditSearchDto> auditSearchDto;
    private AuditSearchDto searchDto;
    private PageBase pageBase;
    private Map<String, Boolean> visibilityMap;
    private AuditLogStorage auditLogStorage;

    public AuditLogViewerPanel(String id, PageBase pageBase){
        this(id, pageBase, null);
    }

    public AuditLogViewerPanel(String id, PageBase pageBase, AuditSearchDto searchDto) {
        this(id, pageBase, searchDto, new HashMap<String, Boolean>());
    }

    public AuditLogViewerPanel(String id, PageBase pageBase, AuditSearchDto searchDto, Map<String, Boolean> visibilityMap){
        super(id);
        this.pageBase = pageBase;
        this.searchDto = searchDto;
        this.visibilityMap = visibilityMap;
        initAuditSearchModel();
        initLayout();
    }

    private void initAuditSearchModel(){
        if (pageBase instanceof PageUser){
            auditLogStorage = pageBase.getSessionStorage().getUserHistoryAuditLog();
        } else {
            auditLogStorage = pageBase.getSessionStorage().getAuditLog();
        }
        if (searchDto == null){
            searchDto = auditLogStorage.getSearchDto();
        }
        auditSearchDto = new Model<AuditSearchDto>(searchDto);

    }

    private void initLayout() {

        Form mainForm = new Form(ID_MAIN_FORM);
        mainForm.setOutputMarkupId(true);
        add(mainForm);

//        FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
//        feedback.setOutputMarkupId(true);
//        mainForm.add(feedback);

        initParametersPanel(mainForm);
        addOrReplaceTable(mainForm);
    }

    private void initParametersPanel(Form mainForm) {
        WebMarkupContainer parametersPanel = new WebMarkupContainer(ID_PARAMETERS_PANEL);
        parametersPanel.setOutputMarkupId(true);
        mainForm.add(parametersPanel);

        PropertyModel<XMLGregorianCalendar> fromModel = new PropertyModel<XMLGregorianCalendar>(
                auditSearchDto, AuditSearchDto.F_FROM);

        DatePanel from = new DatePanel(ID_FROM, fromModel);
        DateValidator dateFromValidator = WebComponentUtil.getRangeValidator(mainForm,
                new ItemPath(AuditSearchDto.F_FROM));
        dateFromValidator.setMessageKey("AuditLogViewerPanel.dateValidatorMessage");
        dateFromValidator.setDateFrom((DateTimeField) from.getBaseFormComponent());
        for (FormComponent<?> formComponent : from.getFormComponents()) {
            formComponent.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        }

        from.setOutputMarkupId(true);
        parametersPanel.add(from);

        PropertyModel<XMLGregorianCalendar> toModel = new PropertyModel<XMLGregorianCalendar>(auditSearchDto,
                AuditSearchDto.F_TO);
        DatePanel to = new DatePanel(ID_TO, toModel);
        DateValidator dateToValidator = WebComponentUtil.getRangeValidator(mainForm,
                new ItemPath(AuditSearchDto.F_FROM));
        dateToValidator.setMessageKey("AuditLogViewerPanel.dateValidatorMessage");
        dateToValidator.setDateTo((DateTimeField) to.getBaseFormComponent());
        for (FormComponent<?> formComponent : to.getFormComponents()) {
            formComponent.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        }

        to.setOutputMarkupId(true);
        parametersPanel.add(to);

        PropertyModel<ItemPathDto> changedItemModel = new PropertyModel<ItemPathDto>(auditSearchDto,
                AuditSearchDto.F_CHANGED_ITEM);

        ItemPathPanel changedItemPanel = new ItemPathPanel(ID_CHANGED_ITEM, changedItemModel, pageBase);
//        changedItemPanel.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
//        changedItemPanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        changedItemPanel.setOutputMarkupId(true);
        parametersPanel.add(changedItemPanel);

        PropertyModel<String> hostIdentifierModel = new PropertyModel<>(auditSearchDto,
                AuditSearchDto.F_HOST_IDENTIFIER);
        TextPanel<String> hostIdentifier = new TextPanel<>(ID_HOST_IDENTIFIER, hostIdentifierModel);
        hostIdentifier.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        hostIdentifier.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        hostIdentifier.setOutputMarkupId(true);
        parametersPanel.add(hostIdentifier);

        ListModel<AuditEventTypeType> eventTypeListModel = new ListModel<AuditEventTypeType>(
                Arrays.asList(AuditEventTypeType.values()));
        PropertyModel<AuditEventTypeType> eventTypeModel = new PropertyModel<AuditEventTypeType>(
                auditSearchDto, AuditSearchDto.F_EVENT_TYPE);
        DropDownChoicePanel<AuditEventTypeType> eventType = new DropDownChoicePanel<AuditEventTypeType>(
                ID_EVENT_TYPE, eventTypeModel, eventTypeListModel,
                new EnumChoiceRenderer<AuditEventTypeType>(), true);
        eventType.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        eventType.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        eventType.setOutputMarkupId(true);
        parametersPanel.add(eventType);

        WebMarkupContainer eventStage = new WebMarkupContainer(ID_EVENT_STAGE);
        eventStage.add(visibilityByKey(visibilityMap, EVENT_STAGE_LABEL_VISIBILITY));
        eventStage.setOutputMarkupId(true);
        parametersPanel.add(eventStage);

        ListModel<AuditEventStageType> eventStageListModel = new ListModel<AuditEventStageType>(
                Arrays.asList(AuditEventStageType.values()));
        PropertyModel<AuditEventStageType> eventStageModel = new PropertyModel<AuditEventStageType>(
                auditSearchDto, AuditSearchDto.F_EVENT_STAGE);
        DropDownChoicePanel<AuditEventStageType> eventStageField = new DropDownChoicePanel<AuditEventStageType>(
                ID_EVENT_STAGE_FIELD, eventStageModel, eventStageListModel,
                new EnumChoiceRenderer<AuditEventStageType>(), true);
        eventStageField.add(visibilityByKey(visibilityMap, EVENT_STAGE_FIELD_VISIBILITY));
        eventStageField.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        eventStageField.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        eventStageField.setOutputMarkupId(true);
        eventStage.add(eventStageField);

        ListModel<OperationResultStatusType> outcomeListModel = new ListModel<OperationResultStatusType>(
                Arrays.asList(OperationResultStatusType.values()));
        PropertyModel<OperationResultStatusType> outcomeModel = new PropertyModel<OperationResultStatusType>(
                auditSearchDto, AuditSearchDto.F_OUTCOME);
        DropDownChoicePanel<OperationResultStatusType> outcome = new DropDownChoicePanel<OperationResultStatusType>(
                ID_OUTCOME, outcomeModel, outcomeListModel,
                new EnumChoiceRenderer<OperationResultStatusType>(), true);
        outcome.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        outcome.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        outcome.setOutputMarkupId(true);
        parametersPanel.add(outcome);

        List<String> channelList = WebComponentUtil.getChannelList();
        List<QName> channelQnameList = new ArrayList<QName>();
        for (int i = 0; i < channelList.size(); i++) {
            String channel = channelList.get(i);
            if (channel != null) {
                QName channelQName = QNameUtil.uriToQName(channel);
                channelQnameList.add(channelQName);
            }
        }
        ListModel<QName> channelListModel = new ListModel<QName>(channelQnameList);
        PropertyModel<QName> channelModel = new PropertyModel<QName>(auditSearchDto,
                AuditSearchDto.F_CHANNEL);
        DropDownChoicePanel<QName> channel = new DropDownChoicePanel<QName>(ID_CHANNEL, channelModel,
                channelListModel, new QNameChoiceRenderer(), true);
        channel.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
        channel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
        channel.setOutputMarkupId(true);
        parametersPanel.add(channel);

        List<Class<? extends ObjectType>> allowedClasses = new ArrayList<>();
        allowedClasses.add(UserType.class);
        MultiValueChoosePanel<ObjectType> chooseInitiatorPanel = new SingleValueChoosePanel<ObjectReferenceType, ObjectType>(
        		ID_INITIATOR_NAME, allowedClasses, objectReferenceTransformer,
        		new PropertyModel<ObjectReferenceType>(auditSearchDto, AuditSearchDto.F_INITIATOR_NAME));
        parametersPanel.add(chooseInitiatorPanel);

        WebMarkupContainer targetOwnerName = new WebMarkupContainer(ID_TARGET_OWNER_NAME);
        targetOwnerName.add(visibilityByKey(visibilityMap, TARGET_OWNER_LABEL_VISIBILITY));
        parametersPanel.add(targetOwnerName);

        MultiValueChoosePanel<ObjectType> chooseTargerOwnerPanel = new SingleValueChoosePanel<ObjectReferenceType, ObjectType>(
        		ID_TARGET_OWNER_NAME_FIELD, allowedClasses, objectReferenceTransformer, new PropertyModel<ObjectReferenceType>(auditSearchDto, AuditSearchDto.F_TARGET_OWNER_NAME));

        chooseTargerOwnerPanel.add(visibilityByKey(visibilityMap, TARGET_OWNER_FIELD_VISIBILITY));
        targetOwnerName.add(chooseTargerOwnerPanel);

        WebMarkupContainer targetName = new WebMarkupContainer(ID_TARGET_NAME);
        targetName.add(visibilityByKey(visibilityMap, TARGET_NAME_LABEL_VISIBILITY));
        parametersPanel.add(targetName);
        List<Class<? extends ObjectType>> allowedClassesAll = new ArrayList<>();
        allowedClassesAll.addAll(ObjectTypes.getAllObjectTypes());

        MultiValueChoosePanel<ObjectType> chooseTargetPanel = new MultiValueChoosePanel<ObjectType>(
        		ID_TARGET_NAME_FIELD,
        		new PropertyModel<List<ObjectType>>(auditSearchDto, AuditSearchDto.F_TARGET_NAMES_OBJECTS),
        		allowedClassesAll);
        chooseTargetPanel.setOutputMarkupId(true);
        chooseTargetPanel.add(visibilityByKey(visibilityMap, TARGET_NAME_FIELD_VISIBILITY));
        targetName.add(chooseTargetPanel);

        AjaxSubmitButton ajaxButton = new AjaxSubmitButton(ID_SEARCH_BUTTON,
                createStringResource("BasicSearchPanel.search")) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                auditLogStorage.setSearchDto(searchDto);
                auditLogStorage.setPageNumber(0);
                Form mainForm = (Form) getParent().getParent();
                addOrReplaceTable(mainForm);
                pageBase.getFeedbackPanel().getFeedbackMessages().clear();
                target.add(pageBase.getFeedbackPanel());
                target.add(mainForm);
            }

            @Override
        protected void onError(AjaxRequestTarget target, Form<?> form){
                target.add(pageBase.getFeedbackPanel());
            }
        };

        WebMarkupContainer valueRefTargetNameContainer = new WebMarkupContainer(ID_VALUE_REF_TARGET_NAMES);
        valueRefTargetNameContainer.add(visibilityByKey(visibilityMap, TARGET_NAME_LABEL_VISIBILITY));
        parametersPanel.add(valueRefTargetNameContainer);

        MultiValueChoosePanel<ObjectType> chooseValueRefTargetNamePanel = new MultiValueChoosePanel<ObjectType>(
        		ID_VALUE_REF_TARGET_NAMES_FIELD,
        		new PropertyModel<List<ObjectType>>(auditSearchDto, AuditSearchDto.F_VALUE_REF_TARGET_NAME),
        		allowedClassesAll);
        chooseValueRefTargetNamePanel.setOutputMarkupId(true);
        chooseValueRefTargetNamePanel.add(visibilityByKey(visibilityMap, VALUE_REF_TARGET_NAME_FIELD_VISIBILITY));
        valueRefTargetNameContainer.add(chooseValueRefTargetNamePanel);

        ajaxButton.setOutputMarkupId(true);
        parametersPanel.add(ajaxButton);
    }

	// Serializable as it becomes part of panel which is serialized
    private Function<ObjectType, ObjectReferenceType> objectReferenceTransformer =
    		(Function<ObjectType, ObjectReferenceType> & Serializable) (ObjectType o) ->
        		ObjectTypeUtil.createObjectRef(o);

	// Serializable as it becomes part of panel which is serialized
    private Function<ObjectType, String> stringTransformer =
    		(Function<ObjectType, String> & Serializable) (ObjectType o) ->
        		o.getName().getOrig();

	private VisibleEnableBehaviour visibilityByKey(Map<String, Boolean> visibilityMap2, String visibilityKey) {
		return new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;
            @Override
	        public boolean isVisible(){
					return visibilityMap2 == null || visibilityMap2.get(visibilityKey) == null ?
	                        true : visibilityMap2.get(visibilityKey);
            }
        };
	}

    private void addOrReplaceTable(Form mainForm) {
        AuditEventRecordProvider provider = new AuditEventRecordProvider(AuditLogViewerPanel.this) {
            private static final long serialVersionUID = 1L;

            public Map<String, Object> getParameters() {
                Map<String, Object> parameters = new HashMap<String, Object>();

                AuditSearchDto search = auditSearchDto.getObject();
                parameters.put("from", search.getFrom());
                parameters.put("to", search.getTo());

                if (search.getChannel() != null) {
                    parameters.put("channel", QNameUtil.qNameToUri(search.getChannel()));
                }
                parameters.put("hostIdentifier", search.getHostIdentifier());

                if (search.getInitiatorName() != null) {
                    parameters.put("initiatorName", search.getInitiatorName().getOid());
                }

                if (search.getTargetOwnerName() != null) {
                    parameters.put("targetOwnerName", search.getTargetOwnerName().getOid());
                }
                List<String> targetOids = new ArrayList<>();
                if (isNotEmpty(search.getTargetNamesObjects())) {
                    targetOids.addAll(search.getTargetNamesObjects().stream()
                    		.map(ObjectType::getOid)
                    		.collect(toList()));
                }
                if (isNotEmpty(search.getTargetNames())) {
                    targetOids.addAll(search.getTargetNames().stream()
                    		.map(ObjectReferenceType::getOid)
                    		.collect(toList()));
                }
                if( ! targetOids.isEmpty()) {
    				parameters.put("targetNames", targetOids);
                }
                if (search.getChangedItem().toItemPath() != null) {
                	ItemPath itemPath = search.getChangedItem().toItemPath();
                	parameters.put("changedItem", CanonicalItemPath.create(itemPath).asString());
                }
                parameters.put("eventType", search.getEventType());
                parameters.put("eventStage", search.getEventStage());
                parameters.put("outcome", search.getOutcome());
                if(isNotEmpty(search.getvalueRefTargetNames())) {
	                parameters.put(AuditEventRecordProvider.VALUE_REF_TARGET_NAMES_KEY,
	                		search.getvalueRefTargetNames().stream()
	                		.map(ObjectType::getName)
	                		.map(PolyStringType::getOrig)
	                		.collect(toList()));
                }
                return parameters;
            }

            @Override
            protected void saveCurrentPage(long from, long count) {
                if (count != 0) {
                    auditLogStorage.setPageNumber(from / count);
                }
            }

        };
        UserProfileStorage userProfile = pageBase.getSessionStorage().getUserProfile();
        int pageSize = DEFAULT_PAGE_SIZE;
        if (userProfile.getTables().containsKey(UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER)){
            pageSize = userProfile.getPagingSize(UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER);
        }
        List<IColumn<AuditEventRecordType, String>> columns = initColumns();
        BoxedTablePanel<AuditEventRecordType> table = new BoxedTablePanel<AuditEventRecordType>(ID_TABLE, provider, columns,
                UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER, pageSize){
            private static final long serialVersionUID = 1L;

            @Override
            protected WebMarkupContainer createButtonToolbar(String id) {
            	CsvDownloadButtonPanel exportDataLink = new CsvDownloadButtonPanel(id) {

					private static final long serialVersionUID = 1L;

					@Override
					protected String getFilename() {
						return "AuditLogViewer_" + createStringResource("MainObjectListPanel.exportFileName").getString();
					}

					@Override
					protected DataTable<?, ?> getDataTable() {
						return getAuditLogViewerTable().getDataTable();
					}
				};

                return exportDataLink;
            }

            @Override
            public void setShowPaging(boolean show) {
                //we don't need to do anything here
            }

            };
        table.setShowPaging(true);
        table.setCurrentPage(auditLogStorage.getPageNumber());
        table.setOutputMarkupId(true);
        mainForm.addOrReplace(table);
    }

    private BoxedTablePanel getAuditLogViewerTable(){
        return (BoxedTablePanel) get(ID_MAIN_FORM).get(ID_TABLE);
    }

    protected List<IColumn<AuditEventRecordType, String>> initColumns() {
        List<IColumn<AuditEventRecordType, String>> columns = new ArrayList<IColumn<AuditEventRecordType, String>>();
        IColumn<AuditEventRecordType, String> linkColumn = new LinkColumn<AuditEventRecordType>(
                createStringResource("AuditEventRecordType.timestamp"), "timestamp") {
            private static final long serialVersionUID = 1L;

            @Override
            protected IModel<String> createLinkModel(final IModel<AuditEventRecordType> rowModel){
                return new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        XMLGregorianCalendar time = rowModel.getObject().getTimestamp();
                        return WebComponentUtil.formatDate(time);
                    }
                };
            }
            @Override
            public void onClick(AjaxRequestTarget target, IModel<AuditEventRecordType> rowModel) {
                AuditEventRecordType record = rowModel.getObject();
                try {
                    AuditEventRecord.adopt(record, pageBase.getPrismContext());
                } catch (SchemaException e) {
                    throw new SystemException("Couldn't adopt event record: " + e, e);
                }
                pageBase.navigateToNext(new PageAuditLogDetails(record));
            }

        };
        columns.add(linkColumn);

        PropertyColumn<AuditEventRecordType, String> initiatorRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.initiatorRef"),
                AuditEventRecordType.F_INITIATOR_REF.getLocalPart()) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
                                     IModel<AuditEventRecordType> rowModel) {
                AuditEventRecordType auditEventRecordType = rowModel.getObject();
                createReferenceColumn(auditEventRecordType.getInitiatorRef(), item, componentId);
            }
        };
        columns.add(initiatorRefColumn);

        if (visibilityMap == null || visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY) == null ||
                visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY)) {
            IColumn<AuditEventRecordType, String> eventStageColumn = new PropertyColumn<AuditEventRecordType, String>(
                    createStringResource("PageAuditLogViewer.eventStageLabel"), "eventStage");
            columns.add(eventStageColumn);
        }
        IColumn<AuditEventRecordType, String> eventTypeColumn = new PropertyColumn<AuditEventRecordType, String>(
                createStringResource("PageAuditLogViewer.eventTypeLabel"), "eventType");
        columns.add(eventTypeColumn);

        if (visibilityMap == null || visibilityMap.get(TARGET_COLUMN_VISIBILITY) == null ||
                visibilityMap.get(TARGET_COLUMN_VISIBILITY)) {
            PropertyColumn<AuditEventRecordType, String> targetRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetRef"),
                    AuditEventRecordType.F_TARGET_REF.getLocalPart()) {
                private static final long serialVersionUID = 1L;

                @Override
                public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
                                         IModel<AuditEventRecordType> rowModel) {
                    AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
                    createReferenceColumn(auditEventRecordType.getTargetRef(), item, componentId);
                }
            };
            columns.add(targetRefColumn);
        }

        if (visibilityMap == null || visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY) == null ||
                visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY)) {
            PropertyColumn<AuditEventRecordType, String> targetOwnerRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetOwnerRef"),
                    AuditEventRecordType.F_TARGET_OWNER_REF.getLocalPart()) {
                private static final long serialVersionUID = 1L;

                @Override
                public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
                                         IModel<AuditEventRecordType> rowModel) {
                    AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
                    createReferenceColumn(auditEventRecordType.getTargetOwnerRef(), item, componentId);
                }
            };
            columns.add(targetOwnerRefColumn);
        }
        IColumn<AuditEventRecordType, String> channelColumn = new PropertyColumn<AuditEventRecordType, String>(
                createStringResource("AuditEventRecordType.channel"), "channel") {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
                                     IModel<AuditEventRecordType> rowModel) {
                AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
                String channel = auditEventRecordType.getChannel();
                if (channel != null) {
                    QName channelQName = QNameUtil.uriToQName(channel);
                    String return_ = channelQName.getLocalPart();
                    item.add(new Label(componentId, return_));
                } else {
                    item.add(new Label(componentId, ""));
                }
                item.add(new AttributeModifier("style", new Model<String>("width: 10%;")));
            }
        };
        columns.add(channelColumn);

        IColumn<AuditEventRecordType, String> outcomeColumn = new PropertyColumn<AuditEventRecordType, String>(
                createStringResource("PageAuditLogViewer.outcomeLabel"), "outcome");
        columns.add(outcomeColumn);

        return columns;
    }

    private void createReferenceColumn(ObjectReferenceType ref, Item item, String componentId) {
        String name = WebModelServiceUtils.resolveReferenceName(ref, pageBase,
                pageBase.createSimpleTask(OPERATION_RESOLVE_REFENRENCE_NAME),
                new OperationResult(OPERATION_RESOLVE_REFENRENCE_NAME));
        item.add(new Label(componentId, name));
        item.add(new AttributeModifier("style", new Model<String>("width: 10%;")));
    }

//    public WebMarkupContainer getFeedbackPanel() {
//        return (FeedbackPanel) get(pageBase.createComponentPath(ID_MAIN_FORM, ID_FEEDBACK));
//    }
}