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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>EnumUtil.EnumConstruct (Alternet Tools 1.0 API)</title>
<meta name="date" content="2020-01-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

ml.alternet.util

Interface EnumUtil.EnumConstruct

All Known Implementing Classes:

EnumUtil.EnumConstruct.SunEnumConstruct

Enclosing class:

EnumUtil

public static interface EnumUtil.EnumConstruct

Interchangeable constructor for Enum values.

Author:

Philippe Poulard

See Also:

EnumUtil.extend(Class, Class)

Nested Class Summary

Nested Classes

Modifier and Type
Interface and Description

static class
EnumUtil.EnumConstruct.SunEnumConstruct

Default implementation of EnumConstruct that relies on sun.reflect

Method Summary

All Methods Static Methods Instance Methods Abstract Methods Default Methods

Modifier and Type
Method and Description

static EnumUtil.EnumConstruct
$()

Create a new instance of EnumConstruct

Enum<?>
build(String name,
     int i,
     Enum<?> baseValue)

Build an enum value.

void
init(Class<? extends Enum<?>> baseEnumClass,
    Class<? extends Enum<?>> targetEnumClass)

Initialize this EnumConstruct

Method Detail

init

void init(Class<? extends Enum<?>> baseEnumClass,
          Class<? extends Enum<?>> targetEnumClass)
   throws NoSuchMethodException,
          SecurityException,
          IllegalAccessException,
          IllegalArgumentException,
          InvocationTargetException

Initialize this EnumConstruct

Parameters:

baseEnumClass - The base enum class, maybe used as argument in the constructor of the target enum class.

targetEnumClass - The target enum class.

Throws:

NoSuchMethodException - When an error occurs

SecurityException - When an error occurs

IllegalAccessException - When an error occurs

IllegalArgumentException - When an error occurs

InvocationTargetException - When an error occurs

build

Enum<?> build(String name,
              int i,
              Enum<?> baseValue)

Build an enum value.

Parameters:

name - The name of the enum value.

i - The order.

baseValue - The base value it is made of, or null

Returns:

A new enum value.

$

static EnumUtil.EnumConstruct $()
                         throws ClassNotFoundException,
                                InstantiationException,
                                IllegalAccessException

Create a new instance of EnumConstruct

Returns:

A new instance of EnumConstruct

Throws:

ClassNotFoundException - When no implementation is found.

InstantiationException - When no implementation is found.

IllegalAccessException - When no implementation is found.

See Also:

DiscoveryService.newInstance(Class)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2020 Alternet. All rights reserved.


text:
class AddIndexedToVersions < ActiveRecord::Migration[4.2]
  def self.up
    add_column :versions, :indexed, :boolean, default: true
  end

  def self.down
    remove_column :versions, :indexed
  end
end

redpajama_set_name: RedPajamaGithub


text:
import React = require("react");
import State = require( "../state");
import { IProps, IState, IScene } from "../i-state";

// export default class Actor extends React.Component<IProps, any> {
//     render() {
//         return (
//
A C T O R

//         );
//     }
// }

// Stateless functional component. Has no lifecycle methods.
var ActorList = (props: IProps) => {
    return
ACTOR
;
};

export default ActorList;


text:
package org.apache.hadoop.mapreduce.lib.input;

import java.io.IOException;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;

/**
 * This class is similar to SequenceFileInputFormat, except it generates
 * SequenceFileAsTextRecordReader which converts the input keys and values
 * to their String forms by calling toString() method.
 */
@InterfaceAudience.Public
@InterfaceStability.Stable
public class SequenceFileAsTextInputFormat
  extends SequenceFileInputFormat<Text, Text> {

  public SequenceFileAsTextInputFormat() {
    super();
  }

  public RecordReader<Text, Text> createRecordReader(InputSplit split,
      TaskAttemptContext context) throws IOException {
    context.setStatus(split.toString());
    return new SequenceFileAsTextRecordReader();
  }
}


text:
module Ci
  class Admin::RunnersController < Ci::Admin::ApplicationController
    before_action :runner, except: :index

    def index
      @runners = Ci::Runner.order('id DESC')
      @runners = @runners.search(params[:search]) if params[:search].present?
      @runners = @runners.page(params[:page]).per(30)
      @active_runners_cnt = Ci::Runner.online.count
    end

    def show
      @builds = @runner.builds.order('id DESC').first(30)
      @projects = Ci::Project.all
      if params[:search].present?
        @gl_projects = ::Project.search(params[:search])
        @projects = @projects.where(gitlab_id: @gl_projects.select(:id))
      end
      @projects = @projects.where("ci_projects.id NOT IN (?)", @runner.projects.pluck(:id)) if @runner.projects.any?
      @projects = @projects.page(params[:page]).per(30)
    end

    def update
      @runner.update_attributes(runner_params)

      respond_to do |format|
        format.js
        format.html { redirect_to ci_admin_runner_path(@runner) }
      end
    end

    def destroy
      @runner.destroy

      redirect_to ci_admin_runners_path
    end

    def resume
      if @runner.update_attributes(active: true)
        redirect_to ci_admin_runners_path, notice: 'Runner was successfully updated.'
      else
        redirect_to ci_admin_runners_path, alert: 'Runner was not updated.'
      end
    end

    def pause
      if @runner.update_attributes(active: false)
        redirect_to ci_admin_runners_path, notice: 'Runner was successfully updated.'
      else
        redirect_to ci_admin_runners_path, alert: 'Runner was not updated.'
      end
    end

    def assign_all
      Ci::Project.unassigned(@runner).all.each do |project|
        @runner.assign_to(project, current_user)
      end

      redirect_to ci_admin_runner_path(@runner), notice: "Runner was assigned to all projects"
    end

    private

    def runner
      @runner ||= Ci::Runner.find(params[:id])
    end

    def runner_params
      params.require(:runner).permit(:token, :description, :tag_list, :active)
    end
  end
end


text:
fourDigitLCDDisplay
===================

Arduino library to use a 7 segment 4 digit LCD Display

This code can be used to display numbers on a 7x4 Display like this https://www.sparkfun.com/products/11407.
For the right pins see the following schema:

![Pins](pins.png)

This pins layout will fit the LCD above but it can be easily changed in the code.

To connect the digit pins you may want to use a resistor (e.g. 1k). It will work (for a short time) without but then it will burn out your segments.


text:
#include <config.h>
#include <signal.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <math.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif

#include <mono/metadata/assembly.h>
#include <mono/metadata/loader.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/class.h>
#include <mono/metadata/object.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/io-layer/io-layer.h>
#include "mono/metadata/profiler.h"
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/threads-types.h>
#include <mono/metadata/verify.h>
#include <mono/metadata/verify-internals.h>
#include <mono/metadata/mempool-internals.h>
#include <mono/metadata/attach.h>
#include <mono/utils/mono-math.h>
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-counters.h>
#include <mono/utils/mono-logger-internal.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/dtrace.h>
#include <mono/utils/mono-signal-handler.h>

#include "mini.h"
#include <string.h>
#include <ctype.h>
#include "trace.h"
#include "version.h"
#include "debugger-agent.h"

#include "jit-icalls.h"

#if defined(__native_client__)

void
mono_runtime_setup_stat_profiler (void)
{
	printf("WARNING: mono_runtime_setup_stat_profiler() called!\n");
}

void
mono_runtime_shutdown_stat_profiler (void)
{
}

gboolean
SIG_HANDLER_SIGNATURE (mono_chain_signal)
{
	return FALSE;
}

void
mono_runtime_install_handlers (void)
{
}

void
mono_runtime_shutdown_handlers (void)
{
}

void
mono_runtime_cleanup_handlers (void)
{
}

pid_t
mono_runtime_syscall_fork (void)
{
	g_assert_not_reached();
	return 0;
}

void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
}

#else

static GHashTable *mono_saved_signal_handlers = NULL;

static gpointer
get_saved_signal_handler (int signo)
{
	if (mono_saved_signal_handlers)
		/* The hash is only modified during startup, so no need for locking */
		return g_hash_table_lookup (mono_saved_signal_handlers, GINT_TO_POINTER (signo));
	return NULL;
}

static void
save_old_signal_handler (int signo, struct sigaction *old_action)
{
	struct sigaction *handler_to_save = g_malloc (sizeof (struct sigaction));

	mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_CONFIG,
				"Saving old signal handler for signal %d.", signo);

	if (! (old_action->sa_flags & SA_SIGINFO)) {
		handler_to_save->sa_handler = old_action->sa_handler;
	} else {
#ifdef MONO_ARCH_USE_SIGACTION
		handler_to_save->sa_sigaction = old_action->sa_sigaction;
#endif /* MONO_ARCH_USE_SIGACTION */
	}
	handler_to_save->sa_mask = old_action->sa_mask;
	handler_to_save->sa_flags = old_action->sa_flags;

	if (!mono_saved_signal_handlers)
		mono_saved_signal_handlers = g_hash_table_new (NULL, NULL);
	g_hash_table_insert (mono_saved_signal_handlers, GINT_TO_POINTER (signo), handler_to_save);
}

static void
free_saved_sig_handler_func (gpointer key, gpointer value, gpointer user_data)
{
	g_free (value);
}

static void
free_saved_signal_handlers (void)
{
	if (mono_saved_signal_handlers) {
		g_hash_table_foreach (mono_saved_signal_handlers, free_saved_sig_handler_func, NULL);
		g_hash_table_destroy (mono_saved_signal_handlers);
		mono_saved_signal_handlers = NULL;
	}
}

/*
 * mono_chain_signal:
 *
 *   Call the original signal handler for the signal given by the arguments, which
 * should be the same as for a signal handler. Returns TRUE if the original handler
 * was called, false otherwise.
 */
gboolean
SIG_HANDLER_SIGNATURE (mono_chain_signal)
{
	int signal = _dummy;
	struct sigaction *saved_handler = get_saved_signal_handler (signal);

	GET_CONTEXT;

	if (saved_handler && saved_handler->sa_handler) {
		if (!(saved_handler->sa_flags & SA_SIGINFO)) {
			saved_handler->sa_handler (signal);
		} else {
#ifdef MONO_ARCH_USE_SIGACTION
			saved_handler->sa_sigaction (signal, info, ctx);
#endif /* MONO_ARCH_USE_SIGACTION */
		}
		return TRUE;
	}
	return FALSE;
}

SIG_HANDLER_FUNC (static, sigabrt_signal_handler)
{
	MonoJitInfo *ji = NULL;
	GET_CONTEXT;

	if (mono_thread_internal_current ())
		ji = mono_jit_info_table_find (mono_domain_get (), mono_arch_ip_from_context(ctx));
	if (!ji) {
        if (mono_chain_signal (SIG_HANDLER_PARAMS))
			return;
		mono_handle_native_sigsegv (SIGABRT, ctx);
	}
}

SIG_HANDLER_FUNC (static, sigusr1_signal_handler)
{
	gboolean running_managed;
	MonoException *exc;
	MonoInternalThread *thread = mono_thread_internal_current ();
	MonoDomain *domain = mono_domain_get ();
	void *ji;

	GET_CONTEXT;

	if (!thread || !domain) {
		/* The thread might not have started up yet */
		/* FIXME: Specify the synchronization with start_wrapper () in threads.c */
		mono_debugger_agent_thread_interrupt (ctx, NULL);
		return;
	}

	if (thread->ignore_next_signal) {
		thread->ignore_next_signal = FALSE;
		return;
	}

	if (thread->thread_dump_requested) {
		thread->thread_dump_requested = FALSE;

		mono_print_thread_dump (ctx);
	}

	/*
	 * This is an async signal, so the code below must not call anything which
	 * is not async safe. That includes the pthread locking functions. If we
	 * know that we interrupted managed code, then locking is safe.
	 */
	/*
	 * On OpenBSD, ctx can be NULL if we are interrupting poll ().
	 */
	if (ctx) {
		ji = mono_jit_info_table_find (mono_domain_get (), mono_arch_ip_from_context(ctx));
		running_managed = ji != NULL;

		if (mono_debugger_agent_thread_interrupt (ctx, ji))
			return;
	} else {
		running_managed = FALSE;
	}

	/* We can't do handler block checking from metadata since it requires doing
	 * a stack walk with context.
	 *
	 * FIXME add full-aot support.
	 */
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
	if (!mono_aot_only && ctx) {
		MonoThreadUnwindState unwind_state;
		if (mono_thread_state_init_from_sigctx (&unwind_state, ctx)) {
			if (mono_install_handler_block_guard (&unwind_state)) {
#ifndef HOST_WIN32
				/*Clear current thread from been wapi interrupted otherwise things can go south*/
				wapi_clear_interruption ();
#endif
				return;
			}
		}
	}
#endif

	exc = mono_thread_request_interruption (running_managed);
	if (!exc)
		return;

	mono_arch_handle_exception (ctx, exc);
}

#if defined(__i386__) || defined(__x86_64__)
#define FULL_STAT_PROFILER_BACKTRACE 1
#define CURRENT_FRAME_GET_BASE_POINTER(f) (* (gpointer*)(f))
#define CURRENT_FRAME_GET_RETURN_ADDRESS(f) (* (((gpointer*)(f)) + 1))
#if MONO_ARCH_STACK_GROWS_UP
#define IS_BEFORE_ON_STACK <
#define IS_AFTER_ON_STACK >
#else
#define IS_BEFORE_ON_STACK >
#define IS_AFTER_ON_STACK <
#endif
#else
#define FULL_STAT_PROFILER_BACKTRACE 0
#endif

#ifdef SIGPROF
#if defined(__ia64__) || defined(__sparc__) || defined(sparc) || defined(__s390__) || defined(s390)

SIG_HANDLER_FUNC (static, sigprof_signal_handler)
{
	if (mono_chain_signal (SIG_HANDLER_PARAMS))
		return;

	NOT_IMPLEMENTED;
}

#else

SIG_HANDLER_FUNC (static, sigprof_signal_handler)
{
	int call_chain_depth = mono_profiler_stat_get_call_chain_depth ();
	MonoProfilerCallChainStrategy call_chain_strategy = mono_profiler_stat_get_call_chain_strategy ();
	GET_CONTEXT;

	if (call_chain_depth == 0) {
		mono_profiler_stat_hit (mono_arch_ip_from_context (ctx), ctx);
	} else {
		MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
		int current_frame_index = 1;
		MonoContext mono_context;
		guchar *ips [call_chain_depth + 1];

		mono_arch_sigctx_to_monoctx (ctx, &mono_context);
		ips [0] = MONO_CONTEXT_GET_IP (&mono_context);

		if (jit_tls != NULL) {
			if (call_chain_strategy == MONO_PROFILER_CALL_CHAIN_NATIVE) {
#if FULL_STAT_PROFILER_BACKTRACE
			guchar *current_frame;
			guchar *stack_bottom;
			guchar *stack_top;

			stack_bottom = jit_tls->end_of_stack;
			stack_top = MONO_CONTEXT_GET_SP (&mono_context);
			current_frame = MONO_CONTEXT_GET_BP (&mono_context);

			while ((current_frame_index <= call_chain_depth) &&
					(stack_bottom IS_BEFORE_ON_STACK (guchar*) current_frame) &&
					((guchar*) current_frame IS_BEFORE_ON_STACK stack_top)) {
				ips [current_frame_index] = CURRENT_FRAME_GET_RETURN_ADDRESS (current_frame);
				current_frame_index ++;
				stack_top = current_frame;
				current_frame = CURRENT_FRAME_GET_BASE_POINTER (current_frame);
			}
#else
				call_chain_strategy = MONO_PROFILER_CALL_CHAIN_GLIBC;
#endif
			}

			if (call_chain_strategy == MONO_PROFILER_CALL_CHAIN_GLIBC) {
#if GLIBC_PROFILER_BACKTRACE
				current_frame_index = backtrace ((void**) & ips [1], call_chain_depth);
#else
				call_chain_strategy = MONO_PROFILER_CALL_CHAIN_MANAGED;
#endif
			}

			if (call_chain_strategy == MONO_PROFILER_CALL_CHAIN_MANAGED) {
				MonoDomain *domain = mono_domain_get ();
				if (domain != NULL) {
					MonoLMF *lmf = NULL;
					MonoJitInfo *ji;
					MonoJitInfo res;
					MonoContext new_mono_context;
					int native_offset;
					ji = mono_find_jit_info (domain, jit_tls, &res, NULL, &mono_context,
							&new_mono_context, NULL, &lmf, &native_offset, NULL);
					while ((ji != NULL) && (current_frame_index <= call_chain_depth)) {
						ips [current_frame_index] = MONO_CONTEXT_GET_IP (&new_mono_context);
						current_frame_index ++;
						mono_context = new_mono_context;
						ji = mono_find_jit_info (domain, jit_tls, &res, NULL, &mono_context,
								&new_mono_context, NULL, &lmf, &native_offset, NULL);
					}
				}
			}
		}

		mono_profiler_stat_call_chain (current_frame_index, & ips [0], ctx);
	}

	mono_chain_signal (SIG_HANDLER_PARAMS);
}

#endif
#endif

SIG_HANDLER_FUNC (static, sigquit_signal_handler)
{
	gboolean res;

	GET_CONTEXT;

	/* We use this signal to start the attach agent too */
	res = mono_attach_start ();
	if (res)
		return;

	if (mono_thread_info_new_interrupt_enabled ()) {
		mono_threads_request_thread_dump ();
	} else {
		printf ("Full thread dump:\n");

		mono_threads_request_thread_dump ();

		/*
		 * print_thread_dump () skips the current thread, since sending a signal
		 * to it would invoke the signal handler below the sigquit signal handler,
		 * and signal handlers don't create an lmf, so the stack walk could not
		 * be performed.
		 */
		mono_print_thread_dump (ctx);
	}

	mono_chain_signal (SIG_HANDLER_PARAMS);
}

SIG_HANDLER_FUNC (static, sigusr2_signal_handler)
{
	gboolean enabled = mono_trace_is_enabled ();

	mono_trace_enable (!enabled);

	mono_chain_signal (SIG_HANDLER_PARAMS);
}

static void
add_signal_handler (int signo, gpointer handler)
{
	struct sigaction sa;
	struct sigaction previous_sa;

#ifdef MONO_ARCH_USE_SIGACTION
	sa.sa_sigaction = handler;
	sigemptyset (&sa.sa_mask);
	sa.sa_flags = SA_SIGINFO;
#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK

/*Apple likes to deliver SIGBUS for *0 */
#ifdef __APPLE__
	if (signo == SIGSEGV || signo == SIGBUS) {
#else
	if (signo == SIGSEGV) {
#endif
		sa.sa_flags |= SA_ONSTACK;

		/*
		 * libgc will crash when trying to do stack marking for threads which are on
		 * an altstack, so delay the suspend signal after the signal handler has
		 * executed.
		 */
		if (mono_gc_get_suspend_signal () != -1)
			sigaddset (&sa.sa_mask, mono_gc_get_suspend_signal ());
	}
#endif
	if (signo == SIGSEGV) {
		/*
		 * Delay abort signals while handling SIGSEGVs since they could go unnoticed.
		 */
		sigset_t block_mask;

		sigemptyset (&block_mask);
		sigaddset (&sa.sa_mask, mono_thread_get_abort_signal ());
	}
#else
	sa.sa_handler = handler;
	sigemptyset (&sa.sa_mask);
	sa.sa_flags = 0;
#endif
	g_assert (sigaction (signo, &sa, &previous_sa) != -1);

	/* if there was already a handler in place for this signal, store it */
	if (! (previous_sa.sa_flags & SA_SIGINFO) &&
			(SIG_DFL == previous_sa.sa_handler)) {
		/* it there is no sa_sigaction function and the sa_handler is default, we can safely ignore this */
	} else {
		if (mono_do_signal_chaining)
			save_old_signal_handler (signo, &previous_sa);
	}
}

static void
remove_signal_handler (int signo)
{
	struct sigaction sa;
	struct sigaction *saved_action = get_saved_signal_handler (signo);

	if (!saved_action) {
		sa.sa_handler = SIG_DFL;
		sigemptyset (&sa.sa_mask);
		sa.sa_flags = 0;

		sigaction (signo, &sa, NULL);
	} else {
		g_assert (sigaction (signo, saved_action, NULL) != -1);
	}
}

void
mono_runtime_posix_install_handlers (void)
{

	sigset_t signal_set;

	if (mini_get_debug_options ()->handle_sigint)
		add_signal_handler (SIGINT, mono_sigint_signal_handler);

	add_signal_handler (SIGFPE, mono_sigfpe_signal_handler);
	add_signal_handler (SIGQUIT, sigquit_signal_handler);
	add_signal_handler (SIGILL, mono_sigill_signal_handler);
	add_signal_handler (SIGBUS, mono_sigsegv_signal_handler);
	if (mono_jit_trace_calls != NULL)
		add_signal_handler (SIGUSR2, sigusr2_signal_handler);

	if (!mono_thread_info_new_interrupt_enabled ())
		add_signal_handler (mono_thread_get_abort_signal (), sigusr1_signal_handler);
	/* it seems to have become a common bug for some programs that run as parents
	 * of many processes to block signal delivery for real time signals.
	 * We try to detect and work around their breakage here.
	 */
	sigemptyset (&signal_set);
	sigaddset (&signal_set, mono_thread_get_abort_signal ());
	if (mono_gc_get_suspend_signal () != -1)
		sigaddset (&signal_set, mono_gc_get_suspend_signal ());
	if (mono_gc_get_restart_signal () != -1)
		sigaddset (&signal_set, mono_gc_get_restart_signal ());
	sigaddset (&signal_set, SIGCHLD);
	sigprocmask (SIG_UNBLOCK, &signal_set, NULL);

	signal (SIGPIPE, SIG_IGN);

	add_signal_handler (SIGABRT, sigabrt_signal_handler);

	/* catch SIGSEGV */
	add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler);
}

#ifndef PLATFORM_MACOSX
void
mono_runtime_install_handlers (void)
{
	mono_runtime_posix_install_handlers ();
}
#endif

void
mono_runtime_cleanup_handlers (void)
{
	if (mini_get_debug_options ()->handle_sigint)
		remove_signal_handler (SIGINT);

	remove_signal_handler (SIGFPE);
	remove_signal_handler (SIGQUIT);
	remove_signal_handler (SIGILL);
	remove_signal_handler (SIGBUS);
	if (mono_jit_trace_calls != NULL)
		remove_signal_handler (SIGUSR2);

	remove_signal_handler (mono_thread_get_abort_signal ());

	remove_signal_handler (SIGABRT);

	remove_signal_handler (SIGSEGV);

	free_saved_signal_handlers ();
}

#ifdef HAVE_LINUX_RTC_H
#include <linux/rtc.h>
#include <sys/ioctl.h>
#include <fcntl.h>
static int rtc_fd = -1;

static int
enable_rtc_timer (gboolean enable)
{
	int flags;
	flags = fcntl (rtc_fd, F_GETFL);
	if (flags < 0) {
		perror ("getflags");
		return 0;
	}
	if (enable)
		flags |= FASYNC;
	else
		flags &= ~FASYNC;
	if (fcntl (rtc_fd, F_SETFL, flags) == -1) {
		perror ("setflags");
		return 0;
	}
	return 1;
}
#endif

void
mono_runtime_shutdown_stat_profiler (void)
{
#ifdef HAVE_LINUX_RTC_H
	if (rtc_fd >= 0)
		enable_rtc_timer (FALSE);
#endif
}

void
mono_runtime_setup_stat_profiler (void)
{
#ifdef ITIMER_PROF
	struct itimerval itval;
	static int inited = 0;
#ifdef HAVE_LINUX_RTC_H
	const char *rtc_freq;
	if (!inited && (rtc_freq = g_getenv ("MONO_RTC"))) {
		int freq = 0;
		inited = 1;
		if (*rtc_freq)
			freq = atoi (rtc_freq);
		if (!freq)
			freq = 1024;
		rtc_fd = open ("/dev/rtc", O_RDONLY);
		if (rtc_fd == -1) {
			perror ("open /dev/rtc");
			return;
		}
		add_signal_handler (SIGPROF, sigprof_signal_handler);
		if (ioctl (rtc_fd, RTC_IRQP_SET, freq) == -1) {
			perror ("set rtc freq");
			return;
		}
		if (ioctl (rtc_fd, RTC_PIE_ON, 0) == -1) {
			perror ("start rtc");
			return;
		}
		if (fcntl (rtc_fd, F_SETSIG, SIGPROF) == -1) {
			perror ("setsig");
			return;
		}
		if (fcntl (rtc_fd, F_SETOWN, getpid ()) == -1) {
			perror ("setown");
			return;
		}
		enable_rtc_timer (TRUE);
		return;
	}
	if (rtc_fd >= 0)
		return;
#endif

	itval.it_interval.tv_usec = 999;
	itval.it_interval.tv_sec = 0;
	itval.it_value = itval.it_interval;
	setitimer (ITIMER_PROF, &itval, NULL);
	if (inited)
		return;
	inited = 1;
	add_signal_handler (SIGPROF, sigprof_signal_handler);
#endif
}

#if !defined(__APPLE__)
pid_t
mono_runtime_syscall_fork ()
{
#if defined(SYS_fork)
	return (pid_t) syscall (SYS_fork);
#else
	g_assert_not_reached ();
	return 0;
#endif
}

void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
	const char *argv [9];
	char template [] = "/tmp/mono-lldb-commands.XXXXXX";
	char buf1 [128];
	FILE *commands;
	gboolean using_lldb = FALSE;

	argv [0] = g_find_program_in_path ("gdb");
	if (argv [0] == NULL) {
		argv [0] = g_find_program_in_path ("lldb");
		using_lldb = TRUE;
	}

	if (argv [0] == NULL)
		return;

	if (using_lldb) {
		if (mkstemp (template) == -1)
			return;

		commands = fopen (template, "w");

		fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid);
		fprintf (commands, "thread list\n");
		fprintf (commands, "thread backtrace all\n");
		fprintf (commands, "detach\n");
		fprintf (commands, "quit\n");

		fflush (commands);
		fclose (commands);

		argv [1] = "--source";
		argv [2] = template;
		argv [3] = 0;
	} else {
		argv [1] = "-ex";
		sprintf (buf1, "attach %ld", (long) crashed_pid);
		argv [2] = buf1;
		argv [3] = "--ex";
		argv [4] = "info threads";
		argv [5] = "--ex";
		argv [6] = "thread apply all bt";
		argv [7] = "--batch";
		argv [8] = 0;
	}

	execv (argv [0], (char**)argv);

	if (using_lldb)
		unlink (template);
}
#endif
#endif /* __native_client__ */

#if !defined (__MACH__)

gboolean
mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
{
	g_error ("Posix systems don't support mono_thread_state_init_from_handle");
	return FALSE;
}

#endif


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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.vsked</groupId>
	<artifactId>manamountain</artifactId>
	<version>1.0</version>
	<name>manamountain</name>
	<description>manamountain</description>
	<packaging>jar</packaging>

	<properties>
		<!-- 声明项目配置依赖编码格式为 utf-8 -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<!-- java jdk 版本声明 可变更 根据自己配置去匹配 -->
		<java.version>1.8</java.version>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.deploy.skip>true</maven.deploy.skip>
		<maven.install.skip>true</maven.install.skip>
		<!-- 解决pom头部unkonow错误 -->
		<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
		<lombok.version>1.18.12</lombok.version>
		<slf4j.version>1.7.30</slf4j.version>
		<log4j2.version>2.13.1</log4j2.version>
		<junit5.version>5.6.1</junit5.version>
		<junit5platform.version>1.6.1</junit5platform.version>
	</properties>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.6.RELEASE</version>
		<relativePath/>
		<!-- lookup parent from repository -->
	</parent>

	<dependencies>
    <!-- 对web开发的支持,包含了spring webmvc和tomcat等web开发的特性 -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

		<!-- spring boot devtools 第一步添加依赖-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
			<scope>runtime</scope>
		</dependency>
		<!-- spring boot核心,包括自动配置支持,日志和YAML -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<!--log4j2 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-log4j2</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
		</dependency>
		<!-- junit5 test start -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
		</dependency>
		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-launcher</artifactId>
		</dependency>
		<!-- junit5 test end -->
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<mainClass>com.vsked.Application</mainClass>
				</configuration>
			</plugin>
			<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>
			<!-- spring boot devtools 第二步添加maven插件-->
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<!--fork如果没有该项配置,这个devtools不会起作用,即应用不会restart这个要手动加进去 -->
					<fork>true</fork>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
/**
 * Created by wesley on 6/18/14.
 */

'use strict';

/**
 * @ngdoc function
 * @name waveWebsiteApp.controller:AboutCtrl
 * @description
 * # AboutCtrl
 * Controller of the waveWebsiteApp
 */
angular.module('waveWebsiteApp')
    .controller('CareersCtrl', function () {

    });


text:
namespace GPUCA_NAMESPACE
{
namespace gpu
{

class ThrustVolatileAsyncAllocator
{
 public:
  typedef char value_type;

  ThrustVolatileAsyncAllocator(GPUReconstruction* r) : mRec(r) {}
  char* allocate(std::ptrdiff_t n) { return (char*)mRec->AllocateVolatileDeviceMemory(n); }

  void deallocate(char* ptr, size_t) {}

 private:
  GPUReconstruction* mRec;
};

} // namespace gpu
} // namespace GPUCA_NAMESPACE

#endif


text:
module.exports = function ($scope, $document, $window, $element, $location) {

  // Navigation drawer state.
  $scope.navOpen = false;

  // Check if given path is active.
  $scope.isActive = function (path) { return path === $location.path(); };

  // Close navigation if page changes.
  $scope.$on('$locationChangeStart', function() {
    $window.scroll(0, 0);
    $scope.navOpen = false;
  });

  var closeNav = function (e) {
    if ($scope.navOpen) {
      $scope.$apply(function () { $scope.navOpen = false; });
      e.preventDefault();
    }
  };

  var isolateNav = function (e) { e.stopPropagation(); };

  // Close navigation if user clicks outside nav.
  $element.on('click', isolateNav);
  $element.on('touchstart', isolateNav);
  $document.on('touchstart', closeNav);
  $document.on('click', closeNav);

  $scope.$on('$destroy', function () {
    $document.off('touchstart', closeNav);
    $document.off('click', closeNav);
  });

};


text:
<?php

namespace Bestyear\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class BestyearUserBundle extends Bundle
{
    public function getParent()
    {
        return 'FOSUserBundle';
    }
}


text:
package org.ovirt.engine.ui.webadmin.section.main.view.popup.host;

import org.ovirt.engine.core.common.businessentities.NetworkBootProtocol;
import org.ovirt.engine.core.common.businessentities.VdsNetworkInterface;
import org.ovirt.engine.core.compat.Event;
import org.ovirt.engine.core.compat.EventArgs;
import org.ovirt.engine.core.compat.IEventListener;
import org.ovirt.engine.core.compat.KeyValuePairCompat;
import org.ovirt.engine.core.compat.PropertyChangedEventArgs;
import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
import org.ovirt.engine.ui.common.widget.Align;
import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
import org.ovirt.engine.ui.common.widget.editor.EntityModelCheckBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.EntityModelLabelEditor;
import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
import org.ovirt.engine.ui.uicommonweb.models.ListModel;
import org.ovirt.engine.ui.uicommonweb.models.hosts.HostManagementNetworkModel;
import org.ovirt.engine.ui.webadmin.ApplicationConstants;
import org.ovirt.engine.ui.webadmin.ApplicationResources;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.host.HostManagementPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.widget.editor.EnumRadioEditor;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.SimpleBeanEditorDriver;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.inject.Inject;

public class HostManagementPopupView extends AbstractModelBoundPopupView<HostManagementNetworkModel> implements HostManagementPopupPresenterWidget.ViewDef {

    interface Driver extends SimpleBeanEditorDriver<HostManagementNetworkModel, HostManagementPopupView> {
        Driver driver = GWT.create(Driver.class);
    }

    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, HostManagementPopupView> {
        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
    }

    @UiField
    @Ignore
    EntityModelLabelEditor nameEditor;

    @UiField(provided = true)
    @Path(value = "interface.selectedItem")
    ListModelListBoxEditor<Object> networkEditor;

    @UiField(provided = true)
    @Path(value = "bondingOptions.selectedItem")
    ListModelListBoxEditor<Object> bondingModeEditor;

    @UiField
    @Ignore
    EntityModelTextBoxEditor customEditor;

    @UiField(provided = true)
    EnumRadioEditor<NetworkBootProtocol> bootProtocol;

    @UiField
    @Ignore
    EntityModelLabelEditor bootProtocolLabel;

    @UiField
    @Path(value = "address.entity")
    EntityModelTextBoxEditor address;

    @UiField
    @Path(value = "subnet.entity")
    EntityModelTextBoxEditor subnet;

    @UiField
    @Path(value = "gateway.entity")
    EntityModelTextBoxEditor gateway;

    @UiField(provided = true)
    @Path(value = "checkConnectivity.entity")
    EntityModelCheckBoxEditor checkConnectivity;

    @UiField
    @Ignore
    Label message;

    @UiField
    @Ignore
    HTML info;

    @UiField
    @Ignore
    DockLayoutPanel layoutPanel;

    @UiField
    @Ignore
    VerticalPanel mainPanel;

    @UiField
    @Ignore
    VerticalPanel infoPanel;

    @UiField(provided = true)
    @Path(value = "commitChanges.entity")
    EntityModelCheckBoxEditor commitChanges;

    @UiField
    Style style;

    @Inject
    public HostManagementPopupView(EventBus eventBus, ApplicationResources resources, final ApplicationConstants constants) {
        super(eventBus, resources);

        networkEditor = new ListModelListBoxEditor<Object>(new NullSafeRenderer<Object>() {
            @Override
            protected String renderNullSafe(Object object) {
                return ((VdsNetworkInterface) object).getName();
            }

        });
        bondingModeEditor = new ListModelListBoxEditor<Object>(new NullSafeRenderer<Object>() {
            @SuppressWarnings("unchecked")
            @Override
            protected String renderNullSafe(Object object) {
                KeyValuePairCompat<String, EntityModel> pair = (KeyValuePairCompat<String, EntityModel>) object;
                String key = pair.getKey();
                if ("custom".equals(key)) { //$NON-NLS-1$
                    return constants.customHostPopup() + ":"; //$NON-NLS-1$
                }
                EntityModel value = pair.getValue();
                return (String) value.getEntity();
            }
        });
        bootProtocol = new EnumRadioEditor<NetworkBootProtocol>(NetworkBootProtocol.class, eventBus);

        checkConnectivity = new EntityModelCheckBoxEditor(Align.RIGHT);
        commitChanges = new EntityModelCheckBoxEditor(Align.RIGHT);

        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));

        // Set Styles
        checkConnectivity.setContentWidgetStyleName(style.checkCon());

        // Localize
        nameEditor.setLabel(constants.networkNameInterface() + ":"); //$NON-NLS-1$
        networkEditor.setLabel(constants.intefaceHostPopup() + ":"); //$NON-NLS-1$
        bondingModeEditor.setLabel(constants.bondingModeHostPopup() + ":"); //$NON-NLS-1$
        bootProtocolLabel.setLabel(constants.bootProtocolHostPopup() +":"); //$NON-NLS-1$
        bootProtocolLabel.asEditor().getSubEditor().setValue("   "); //$NON-NLS-1$
        customEditor.setLabel(constants.customModeHostPopup() + ":"); //$NON-NLS-1$
        address.setLabel(constants.ipHostPopup() + ":"); //$NON-NLS-1$
        subnet.setLabel(constants.subnetMaskHostPopup() + ":"); //$NON-NLS-1$
        gateway.setLabel(constants.defaultGwHostPopup() + ":"); //$NON-NLS-1$
        checkConnectivity.setLabel(constants.checkConHostPopup()); //$NON-NLS-1$
        info.setHTML(constants.changesTempHostPopup());
        commitChanges.setLabel(constants.saveNetConfigHostPopup());

        Driver.driver.initialize(this);
    }

    @Override
    public void edit(final HostManagementNetworkModel object) {
        Driver.driver.edit(object);
        bootProtocol.setEnabled(NetworkBootProtocol.None, object.getNoneBootProtocolAvailable());

        object.getPropertyChangedEvent().addListener(new IEventListener() {
            @Override
            public void eventRaised(Event ev, Object sender, EventArgs args) {
                HostManagementNetworkModel model = (HostManagementNetworkModel) sender;
                String propertyName = ((PropertyChangedEventArgs) args).PropertyName;
                if ("NoneBootProtocolAvailable".equals(propertyName)) { //$NON-NLS-1$
                    bootProtocol.setEnabled(NetworkBootProtocol.None, model.getNoneBootProtocolAvailable());
                }
                else if ("Message".equals(propertyName)) { //$NON-NLS-1$
                    message.setText(model.getMessage());
                }
                else if ("Entity".equals(propertyName)) { //$NON-NLS-1$
                    nameEditor.asEditor().getSubEditor().setValue(object.getEntity().getname());
                }
            }
        });

        object.getBondingOptions().getSelectedItemChangedEvent().addListener(new IEventListener() {
            @Override
            public void eventRaised(Event ev, Object sender, EventArgs args) {
                ListModel list = (ListModel) sender;
                @SuppressWarnings("unchecked")
                KeyValuePairCompat<String, EntityModel> pair =
                        (KeyValuePairCompat<String, EntityModel>) list.getSelectedItem();
                if ("custom".equals(pair.getKey())) { //$NON-NLS-1$
                    customEditor.setVisible(true);
                    Object entity = pair.getValue().getEntity();
                    customEditor.asEditor().getSubEditor().setValue(entity == null ? "" : entity); //$NON-NLS-1$
                } else {
                    customEditor.setVisible(false);
                }
            }
        });

        customEditor.asValueBox().addValueChangeHandler(new ValueChangeHandler<Object>() {
            @SuppressWarnings("unchecked")
            @Override
            public void onValueChange(ValueChangeEvent<Object> event) {
                for (Object item : object.getBondingOptions().getItems()) {
                    KeyValuePairCompat<String, EntityModel> pair = (KeyValuePairCompat<String, EntityModel>) item;
                    if ("custom".equals(pair.getKey())) { //$NON-NLS-1$
                        pair.getValue().setEntity(event.getValue());
                    }
                }
            }
        });

        bondingModeEditor.setVisible(true);
        bondingModeEditor.asWidget().setVisible(true);

        if (object.isCompactMode()) {
            // hide widgets
            info.setVisible(false);
            message.setVisible(false);
            checkConnectivity.setVisible(false);
            bondingModeEditor.setVisible(false);
            commitChanges.setVisible(false);
            // resize
            layoutPanel.remove(infoPanel);
            layoutPanel.setWidgetSize(mainPanel, 250);
            asPopupPanel().setPixelSize(400, 350);
        }

        if (object.getEntity() != null){
            nameEditor.asValueBox().setValue(object.getEntity().getName());
        }
    }

    @Override
    public HostManagementNetworkModel flush() {
        return Driver.driver.flush();
    }

    @Override
    public void focusInput() {
        networkEditor.setFocus(true);
    }

    @Override
    public void setMessage(String message) {
    }

    interface Style extends CssResource {

        String checkCon();
    }
}


text:
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://mockbin.com/har")
  .get()
  .build();

Response response = client.newCall(request).execute();


text:
`dename` is a decentralized system that securely maps usernames to
profiles. A profile can contain any information the user wishes; for
example, it can serve as a public key infrastructure, a store of
electronic business cards, or as a domain name. By "secure", we
mean that (a) everybody sees the same profile for the same name and (b)
only the owner of a profile can modify it.  The abstraction `dename`
provides is similar NameCoin's, but `dename` does not rely on proof of
work -- instead, each client can pick a set of verifier servers which it
believes to contain at least one honest member.

## Usage

Let's say a friend of yours wishes to grant you write access to a `git`
repository on his server. However, as nobody other than the two of you
should be able to change the code, you decide to use `git` over `ssh`
with public-key authentication.

Everything seems fine, except that all ways of telling each other your
public keys seem to be lacking something. Sending them over email or
another conventional online channel would be susceptible to attack --
anybody could send an email from your address to your friend, asking to
add their key instead. Printing out the keys and handing them to each
other the next time you meet would definitely establish their
authenticity, but typing them in again would be tedious. Handing over
hashes of keys on paper, downloading the keys separately and verifying
the hashes is also a fine strategy, but neither of you is well-versed in
cryptography and you are rightfully unsure whether this convoluted
strategy would be secure. Even if it was, it would still be
inconvenient.

### Installation

	go get github.com/andres-erbsen/dename/{dnmgr/dnmgr,dnmlookup}

This requires the [`go` language toolchain](http://golang.org/).

To update an existing `dename` installation, run

	go get -u github.com/andres-erbsen/dename/{dnmgr/dnmgr,dnmlookup}

### Command line

Authorize *Alice* to control the current machine using `ssh`:

	dnmlookup alice ssh | tee -a ~/.ssh/authorized_keys

Add the [`ssh` host key] of *Alice's* machine *yummy.tld*:

	dnmlookup alice ssh-host | grep -w "^yummy.tld" | tee -a ~/.ssh/known_hosts

Add *Alice's* [OpenPGP] key to the local keyring:

	gpg --recv-keys "$(dnmlookup alice pgp)"

Encrypt a message so that only *Alice* can read it:

	gpg --armor --encrypt --recipient "$(dnmlookup alice pgp)" > message.pgp

Verify a message *Alice* signed using [`signify`]:

	signify -V -e -p <(dnmlookup alice 9881561) -s signed-message -m verified-message

Display all fields in a profile (using [protoc](https://github.com/google/protobuf/#protocol-buffers---googles-data-interchange-format)):

	dnmlookup andres | protoc --decode_raw

### Management

Create a new name-profile pair with the name *Bob*:

	dnmgr init bob # visit <https://dename.mit.edu/> first to get an invite code

Add `ssh` public keys a profile: (the `.pub` is crucial, otherwise the secret keys will be uploaded as well)

	dnmgr set bob ssh "$(cat ~/.ssh/id_*.pub)"

Add a `gpg` key to the profile (by fingerprint, the key itself is too big):

	dnmgr set bob pgp "$(gpg --fingerprint -K $KEYID | grep -im1 fingerprint\ = | tr -dc A-F0-9)"

#### Back up `~/.config/dename`

Each `dename` name is controlled by a secret key, which `dnmgr` by default
stores in `~/.config/dename`. You probably want to back it up somewhere safe (as
the secret key is just 64 bytes, I would recommend printing it out, both in hex
and QR code format). There is no way to modify a profile without having the
corresponding key. This is so because we (the `dename` server operators) would
not have any way of proving to the world that the correct user actually
contacted us and asked us to recover their name (as opposed to a third party
compelling us to do so).

### Update your profile every 6 months

If a profile stays unmodified for a year, the name will become available for
registration. This way the profiles for which the corresponding secret key is
long lost won't be cluttering the namespace forever. To make sure legitimate
users do not lose control of their profiles, lookups will start returning an
error earlier -- currently at the 6 months mark. The profile does not need to
change, any `dnmgr set` command will bump the expiration time if successful.

### Scripts

`dngpg` performs arbitrary `gpg` commands with a `dename` user's public key as
the recipient. Specifically, `dngpg <user> [args...]` is equivalent to `gpg
--always-trust --recipient 0xabcdef01 [args...]` where 0xabcdef01 is the user's
PGP key fingerprint as retrieved from `dename`. The local keyring trust state is
not modified.

`dnget <user> <filename>` looks up the URL and hash of the file from the
user's profile, downloads it and verifies that the downloaded file matches the
hash advertised on `dename`. As both current and past `dename` profiles are
public, this program can be seen as a barebones [software transparency] tool.

### Client Library

`client/` contains a Go library for interfacing with the `dename` servers.
It provides functions for registering, modifying and transferring profiles. For
POSIX userland applications, `dnmgr/` exposes the persistence layer used by the
`dnmgr` command line tool.

How `dename` works
------------------

A universally known (but not trusted) group of core servers
accept profile modification requests and pick a consistent order in
which to apply them. Independently operated verifier servers compute the
result of these operations and sign it. Clients can contact any of the
servers to look up names and be assured that unless *all* servers are
broken or colluding against them, the result is correct.

Names are allocated to users on a first-come first-serve basis.
Specifically, any user can at any time contact a core server and ask
them to "assign name N to public key P". Rate-limiting and spam
prevention is the responsibility of the core servers: currently, a
non-profit email address is required for registration. The bearer of a
name can transfer the name to another key (their own or somebody else's)
by signing the message "transfer name N to public key P'" with the old
secret key and sending it to a server. This enables key
revocations/upgrades and (domain) name sales.

When a core server receives a request, it first verifies that it is valid
(the name is available / the transfer is signed by the bearer of the
name) and forwards it to the verifiers. With some regularity, all
core servers commit to the requests they have forwarded, verifiers
handle these requests in a stable pseudo-random order, and sign the new
name assignments.

To speed up updating and signing the name assignments, the names-profile
mapping is stored in a crit-bit tree with Merkle hashing. That is, every
crit-bit node also contains the hash of its children. This way the
hash of the root node summarizes the state of all the names and can be
signed instead of the possibly large table of all names. When a client
asks for the profile associated with a name, the server also returns all
children of the nodes on the path from the root to the node storing that
name and the corresponding profile. The client can use the hashes of
these nodes to compute the root and be assured that the (name, profile)
pair is indeed present in that tree. After verifying the servers'
signatures on that root, the client can be assured that if at least
least one server is correct then the profile he saw is the same that
everybody else sees.

Contribute
----------

### Use it and report back!

We would love to hear how `dename` worked for you, and even if it really
didn't you should let us know so that we can fix the issue, saving
somebody else the trouble. Technical and non-technical feedback are
equally appreciated. To get in touch with us, use the Github issues link
on this page or [contact us](mailto:dename@mit.edu) by email.

the public mailing list
[dename-servers@mit.edu](http://mailman.mit.edu/mailman/listinfo/dename-servers)
will receive notifications about updates and issues related to the dename
utilities and the server software respectively.

### Integrate `dename` with `$YOUR_FAVORITE_APPLICATION`

`dename` is designed to be easy to integrate into other applications for a
seamless user experience. See the command line examples above for ideas --
pretty much any application that already uses secure cryptographic identifiers
can be made easier to use using `dename`, and building a new system that uses
`dename` for user management should be comparably easy.

### Run a server

The security of `dename` depends on having a diverse set of
[servers](community-servers.md). The following notes are provided to give you a
rough idea on how to set up an independent server.

1. Add yourself to
[dename-servers@mit.edu](http://mailman.mit.edu/mailman/listinfo/dename-servers).
2. Download and build the code:

		go get -u -d github.com/andres-erbsen/{dename/server/server,chatterbox/transport}
		cd $GOPATH/src/github.com/andres-erbsen/dename/server/server && go build -v; cd ../..

3. Configure the server

		mkdir /home/dename/keys && chmod 700 /home/dename/keys
		go run utils/mkkey/mkkey.go /home/dename/keys
		go run ../chatterbox/transport/transport-keygen/main.go /home/dename/keys

	Into `~dename/denameserver.cfg`:

		[backend]
		DataDirectory = /home/dename/leveldb
		SigningKeyPath = /home/dename/keys/secret_key
		Listen = 0.0.0.0:8877
		[frontend]
		TransportKeyPath = /home/dename/keys/transport_secret_key
		Listen = 0.0.0.0:6263
		[server "dename.mit.edu:8877"]
		PublicKey = CiCheFqDmJ0Pg+j+lypkmmiHrFmRn50rlDi5X0l4+lJRFA==
		IsCore = true
		[server "127.0.0.1:8877"]
		PublicKey = # run `base64 /home/dename/keys/public_key` and copy here

	Run it: `./server/server/server /home/dename/denameserver.cfg`

4. Configure your client to talk to your server. Into `~/.config/dename/authorities.cfg`:

		[verifier "mit-pilot"]
		PublicKey = CiCheFqDmJ0Pg+j+lypkmmiHrFmRn50rlDi5X0l4+lJRFA==
		[verifier "my-verifier"]
		PublicKey = # run `base64 /home/dename/keys/public_key` and copy here

		[lookup "my-verifier-address:port"]
		TransportPublicKey = # run `base64 /home/dename/keys/transport_public_key` and copy here

		[update "dename.mit.edu:6263"]
		TransportPublicKey = 4f2i+j65JCE2xNKhxE3RPurAYALx9GRy0Pm9c6J7eDY=

5. (or if you get stuck) Email [dename@mit.edu](mailto:dename.mit.edu) and let
   us know how it went, and whether you'd like to have your server added to a
   public list of [community servers](community-servers.md).

   People interested about `dename` are encouraged to join our irc channel: #dename @ irc.freenode.net

[OpenPGP]: https://andreser.scripts.mit.edu/blog/2013-08-10-how-to-use-openpgp-for-email-in-1000-words/
[`ssh` host key]: http://www.rackspace.com/knowledge_center/article/rackspace-cloud-essentials-checking-a-server%E2%80%99s-ssh-host-fingerprint-with-the-web-console#Explaining
[`signify`]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/signify.1
[software transparency]: https://zyan.scripts.mit.edu/blog/software-transparency/


text:
#ifndef _ASM_POWERPC_PGTABLE_PPC64_4K_H
#define _ASM_POWERPC_PGTABLE_PPC64_4K_H
/*
 * Entries per page directory level.  The PTE level must use a 64b record
 * for each page table entry.  The PMD and PGD level use a 32b record for
 * each entry by assuming that each entry is page aligned.
 */
#define PTE_INDEX_SIZE  9
#define PMD_INDEX_SIZE  7
#define PUD_INDEX_SIZE  7
#define PGD_INDEX_SIZE  9

#ifndef __ASSEMBLY__
#define PTE_TABLE_SIZE	(sizeof(pte_t) << PTE_INDEX_SIZE)
#define PMD_TABLE_SIZE	(sizeof(pmd_t) << PMD_INDEX_SIZE)
#define PUD_TABLE_SIZE	(sizeof(pud_t) << PUD_INDEX_SIZE)
#define PGD_TABLE_SIZE	(sizeof(pgd_t) << PGD_INDEX_SIZE)
#endif	/* __ASSEMBLY__ */

#define PTRS_PER_PTE	(1 << PTE_INDEX_SIZE)
#define PTRS_PER_PMD	(1 << PMD_INDEX_SIZE)
#define PTRS_PER_PUD	(1 << PMD_INDEX_SIZE)
#define PTRS_PER_PGD	(1 << PGD_INDEX_SIZE)

/* PMD_SHIFT determines what a second-level page table entry can map */
#define PMD_SHIFT	(PAGE_SHIFT + PTE_INDEX_SIZE)
#define PMD_SIZE	(1UL << PMD_SHIFT)
#define PMD_MASK	(~(PMD_SIZE-1))

/* With 4k base page size, hugepage PTEs go at the PMD level */
#define MIN_HUGEPTE_SHIFT	PMD_SHIFT

/* PUD_SHIFT determines what a third-level page table entry can map */
#define PUD_SHIFT	(PMD_SHIFT + PMD_INDEX_SIZE)
#define PUD_SIZE	(1UL << PUD_SHIFT)
#define PUD_MASK	(~(PUD_SIZE-1))

/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
#define PGDIR_SHIFT	(PUD_SHIFT + PUD_INDEX_SIZE)
#define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
#define PGDIR_MASK	(~(PGDIR_SIZE-1))

/* Bits to mask out from a PMD to get to the PTE page */
#define PMD_MASKED_BITS		0
/* Bits to mask out from a PUD to get to the PMD page */
#define PUD_MASKED_BITS		0
/* Bits to mask out from a PGD to get to the PUD page */
#define PGD_MASKED_BITS		0

/*
 * 4-level page tables related bits
 */

#define pgd_none(pgd)		(!pgd_val(pgd))
#define pgd_bad(pgd)		(pgd_val(pgd) == 0)
#define pgd_present(pgd)	(pgd_val(pgd) != 0)
#define pgd_clear(pgdp)		(pgd_val(*(pgdp)) = 0)
#define pgd_page_vaddr(pgd)	(pgd_val(pgd) & ~PGD_MASKED_BITS)
#define pgd_page(pgd)		virt_to_page(pgd_page_vaddr(pgd))

#define pud_offset(pgdp, addr)	\
  (((pud_t *) pgd_page_vaddr(*(pgdp))) + \
    (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))

#define pud_ERROR(e) \
	printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))

/*
 * On all 4K setups, remap_4k_pfn() equates to remap_pfn_range() */
#define remap_4k_pfn(vma, addr, pfn, prot)	\
	remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot))

#endif /* _ASM_POWERPC_PGTABLE_PPC64_4K_H */


text:
package awstasks

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/ec2"
	"k8s.io/klog/v2"
	"k8s.io/kops/upup/pkg/fi"
	"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
	"k8s.io/kops/upup/pkg/fi/cloudup/cloudformation"
	"k8s.io/kops/upup/pkg/fi/cloudup/terraform"
	"k8s.io/kops/upup/pkg/fi/cloudup/terraformWriter"
)

// +kops:fitask
type Route struct {
	Name      *string
	Lifecycle fi.Lifecycle

	RouteTable *RouteTable
	Instance   *Instance
	CIDR       *string
	IPv6CIDR   *string

	// Exactly one of the below fields
	// MUST be provided.
	InternetGateway  *InternetGateway
	NatGateway       *NatGateway
	TransitGatewayID *string
}

func (e *Route) Find(c *fi.Context) (*Route, error) {
	cloud := c.Cloud.(awsup.AWSCloud)

	if e.RouteTable == nil || (e.CIDR == nil && e.IPv6CIDR == nil) {
		// TODO: Move to validate?
		return nil, nil
	}

	if e.RouteTable.ID == nil {
		return nil, nil
	}

	request := &ec2.DescribeRouteTablesInput{
		RouteTableIds: []*string{e.RouteTable.ID},
	}

	response, err := cloud.EC2().DescribeRouteTables(request)
	if err != nil {
		return nil, fmt.Errorf("error listing RouteTables: %v", err)
	}
	if response == nil || len(response.RouteTables) == 0 {
		return nil, nil
	} else {
		if len(response.RouteTables) != 1 {
			klog.Fatalf("found multiple RouteTables matching tags")
		}
		rt := response.RouteTables[0]
		for _, r := range rt.Routes {
			if (r.DestinationCidrBlock == nil || aws.StringValue(r.DestinationCidrBlock) != aws.StringValue(e.CIDR)) &&
				(r.DestinationIpv6CidrBlock == nil || aws.StringValue(r.DestinationIpv6CidrBlock) != aws.StringValue(e.IPv6CIDR)) {
				continue
			}
			actual := &Route{
				Name:       e.Name,
				RouteTable: &RouteTable{ID: rt.RouteTableId},
				CIDR:       r.DestinationCidrBlock,
				IPv6CIDR:   r.DestinationIpv6CidrBlock,
			}
			if r.GatewayId != nil {
				actual.InternetGateway = &InternetGateway{ID: r.GatewayId}
			}
			if r.NatGatewayId != nil {
				actual.NatGateway = &NatGateway{ID: r.NatGatewayId}
			}
			if r.InstanceId != nil {
				actual.Instance = &Instance{ID: r.InstanceId}
			}
			if r.TransitGatewayId != nil {
				actual.TransitGatewayID = r.TransitGatewayId
			}

			if aws.StringValue(r.State) == "blackhole" {
				klog.V(2).Infof("found route is a blackhole route")
				// These should be nil anyway, but just in case...
				actual.Instance = nil
				actual.InternetGateway = nil
				actual.TransitGatewayID = nil
			}

			// Prevent spurious changes
			actual.Lifecycle = e.Lifecycle

			klog.V(2).Infof("found route matching CIDR=%q IPv6CIDR=%q", aws.StringValue(e.CIDR), aws.StringValue(e.IPv6CIDR))
			return actual, nil
		}
	}

	return nil, nil
}

func (e *Route) Run(c *fi.Context) error {
	return fi.DefaultDeltaRunMethod(e, c)
}

func (s *Route) CheckChanges(a, e, changes *Route) error {
	if a == nil {
		// TODO: Create validate method?
		if e.RouteTable == nil {
			return fi.RequiredField("RouteTable")
		}
		if e.CIDR == nil && e.IPv6CIDR == nil {
			return fi.RequiredField("CIDR/IPv6CIDR")
		}
		if e.CIDR != nil && e.IPv6CIDR != nil {
			return fmt.Errorf("cannot set more than 1 CIDR or IPv6CIDR")
		}
		targetCount := 0
		if e.InternetGateway != nil {
			targetCount++
		}
		if e.Instance != nil {
			targetCount++
		}
		if e.NatGateway != nil {
			targetCount++
		}
		if e.TransitGatewayID != nil {
			targetCount++
		}
		if targetCount == 0 {
			return fmt.Errorf("InternetGateway, Instance, NatGateway, or TransitGateway is required")
		}
		if targetCount != 1 {
			return fmt.Errorf("cannot set more than 1 InternetGateway, Instance, NatGateway, or TransitGateway")
		}
	}

	if a != nil {
		if changes.RouteTable != nil {
			return fi.CannotChangeField("RouteTable")
		}
		if changes.CIDR != nil {
			return fi.CannotChangeField("CIDR")
		}
		if changes.IPv6CIDR != nil {
			return fi.CannotChangeField("IPv6CIDR")
		}
	}
	return nil
}

func (_ *Route) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *Route) error {
	if a == nil {
		request := &ec2.CreateRouteInput{}
		request.RouteTableId = checkNotNil(e.RouteTable.ID)

		if e.CIDR != nil || e.IPv6CIDR != nil {
			request.DestinationCidrBlock = e.CIDR
			request.DestinationIpv6CidrBlock = e.IPv6CIDR
		} else {
			klog.Fatal("both CIDR and IPv6CIDR were unexpectedly nil")
		}

		if e.InternetGateway == nil && e.NatGateway == nil && e.TransitGatewayID == nil {
			return fmt.Errorf("missing target for route")
		} else if e.InternetGateway != nil {
			request.GatewayId = checkNotNil(e.InternetGateway.ID)
		} else if e.NatGateway != nil {
			request.NatGatewayId = checkNotNil(e.NatGateway.ID)
		} else if e.TransitGatewayID != nil {
			request.TransitGatewayId = e.TransitGatewayID
		}

		if e.Instance != nil {
			request.InstanceId = checkNotNil(e.Instance.ID)
		}

		klog.V(2).Infof("Creating Route with RouteTable:%q CIDR:%q IPv6CIDR:%q",
			aws.StringValue(e.RouteTable.ID), aws.StringValue(e.CIDR), aws.StringValue(e.IPv6CIDR))

		response, err := t.Cloud.EC2().CreateRoute(request)
		if err != nil {
			code := awsup.AWSErrorCode(err)
			message := awsup.AWSErrorMessage(err)
			if code == "InvalidNatGatewayID.NotFound" {
				klog.V(4).Infof("error creating Route: %s", message)
				return fi.NewTryAgainLaterError("waiting for the NAT Gateway to be created")
			}
			return fmt.Errorf("error creating Route: %s", message)
		}

		if !aws.BoolValue(response.Return) {
			return fmt.Errorf("create Route request failed: %v", response)
		}
	} else {
		request := &ec2.ReplaceRouteInput{}
		request.RouteTableId = checkNotNil(e.RouteTable.ID)

		if e.CIDR != nil || e.IPv6CIDR != nil {
			request.DestinationCidrBlock = e.CIDR
			request.DestinationIpv6CidrBlock = e.IPv6CIDR
		} else {
			klog.Fatal("both CIDR and IPv6CIDR were unexpectedly nil")
		}

		if e.InternetGateway == nil && e.NatGateway == nil && e.TransitGatewayID == nil {
			return fmt.Errorf("missing target for route")
		} else if e.InternetGateway != nil {
			request.GatewayId = checkNotNil(e.InternetGateway.ID)
		} else if e.NatGateway != nil {
			request.NatGatewayId = checkNotNil(e.NatGateway.ID)
		} else if e.TransitGatewayID != nil {
			request.TransitGatewayId = e.TransitGatewayID
		}

		if e.Instance != nil {
			request.InstanceId = checkNotNil(e.Instance.ID)
		}

		klog.V(2).Infof("Updating Route with RouteTable:%q CIDR:%q", *e.RouteTable.ID, *e.CIDR)

		if _, err := t.Cloud.EC2().ReplaceRoute(request); err != nil {
			code := awsup.AWSErrorCode(err)
			message := awsup.AWSErrorMessage(err)
			if code == "InvalidNatGatewayID.NotFound" {
				klog.V(4).Infof("error creating Route: %s", message)
				return fi.NewTryAgainLaterError("waiting for the NAT Gateway to be created")
			}
			return fmt.Errorf("error creating Route: %s", message)
		}
	}

	return nil
}

func checkNotNil(s *string) *string {
	if s == nil {
		klog.Fatal("string pointer was unexpectedly nil")
	}
	return s
}

type terraformRoute struct {
	RouteTableID      *terraformWriter.Literal `json:"route_table_id" cty:"route_table_id"`
	CIDR              *string                  `json:"destination_cidr_block,omitempty" cty:"destination_cidr_block"`
	IPv6CIDR          *string                  `json:"destination_ipv6_cidr_block,omitempty" cty:"destination_ipv6_cidr_block"`
	InternetGatewayID *terraformWriter.Literal `json:"gateway_id,omitempty" cty:"gateway_id"`
	NATGatewayID      *terraformWriter.Literal `json:"nat_gateway_id,omitempty" cty:"nat_gateway_id"`
	TransitGatewayID  *string                  `json:"transit_gateway_id,omitempty" cty:"transit_gateway_id"`
	InstanceID        *terraformWriter.Literal `json:"instance_id,omitempty" cty:"instance_id"`
}

func (_ *Route) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Route) error {
	tf := &terraformRoute{
		RouteTableID: e.RouteTable.TerraformLink(),
		CIDR:         e.CIDR,
		IPv6CIDR:     e.IPv6CIDR,
	}

	if e.InternetGateway == nil && e.NatGateway == nil && e.TransitGatewayID == nil {
		return fmt.Errorf("missing target for route")
	} else if e.InternetGateway != nil {
		tf.InternetGatewayID = e.InternetGateway.TerraformLink()
	} else if e.NatGateway != nil {
		tf.NATGatewayID = e.NatGateway.TerraformLink()
	} else if e.TransitGatewayID != nil {
		tf.TransitGatewayID = e.TransitGatewayID
	}

	if e.Instance != nil {
		tf.InstanceID = e.Instance.TerraformLink()
	}

	// Terraform 0.12 doesn't support resource names that start with digits. See #7052
	// and https://www.terraform.io/upgrade-guides/0-12.html#pre-upgrade-checklist
	name := fmt.Sprintf("route-%v", *e.Name)
	return t.RenderResource("aws_route", name, tf)
}

type cloudformationRoute struct {
	RouteTableID      *cloudformation.Literal `json:"RouteTableId"`
	CIDR              *string                 `json:"DestinationCidrBlock,omitempty"`
	IPv6CIDR          *string                 `json:"DestinationIpv6CidrBlock,omitempty"`
	InternetGatewayID *cloudformation.Literal `json:"GatewayId,omitempty"`
	NATGatewayID      *cloudformation.Literal `json:"NatGatewayId,omitempty"`
	TransitGatewayID  *string                 `json:"TransitGatewayId,omitempty"`
	InstanceID        *cloudformation.Literal `json:"InstanceId,omitempty"`
}

func (_ *Route) RenderCloudformation(t *cloudformation.CloudformationTarget, a, e, changes *Route) error {
	tf := &cloudformationRoute{
		RouteTableID: e.RouteTable.CloudformationLink(),
		CIDR:         e.CIDR,
		IPv6CIDR:     e.IPv6CIDR,
	}

	if e.InternetGateway == nil && e.NatGateway == nil && e.TransitGatewayID == nil {
		return fmt.Errorf("missing target for route")
	} else if e.InternetGateway != nil {
		tf.InternetGatewayID = e.InternetGateway.CloudformationLink()
	} else if e.NatGateway != nil {
		tf.NATGatewayID = e.NatGateway.CloudformationLink()
	} else if e.TransitGatewayID != nil {
		tf.TransitGatewayID = e.TransitGatewayID
	}

	if e.Instance != nil {
		return fmt.Errorf("instance cloudformation routes not yet implemented")
		//tf.InstanceID = e.Instance.CloudformationLink()
	}

	return t.RenderResource("AWS::EC2::Route", *e.Name, tf)
}


text:
@deprecate reshape(arr::NDArray; shape=()) reshape(arr, shape)
@deprecate Reshape(arr::NDArray; shape=()) reshape(arr, shape)

# SymbolicNode reshape (#279)
@deprecate reshape(sym::SymbolicNode; shape=()) reshape(sym, shape)
@deprecate Reshape(sym::SymbolicNode; shape=()) reshape(sym, shape)

# srand (#282)
@deprecate srand!(seed_state::Int) srand(seed_state)

# v0.4
@deprecate sin(x::NDArray)    sin.(x)
@deprecate cos(x::NDArray)    cos.(x)
@deprecate tan(x::NDArray)    tan.(x)
@deprecate arcsin(x::NDArray) asin.(x)
@deprecate arccos(x::NDArray) acos.(x)
@deprecate arctan(x::NDArray) atan.(x)

@deprecate sinh(x::NDArray)    sinh.(x)
@deprecate cosh(x::NDArray)    cosh.(x)
@deprecate tanh(x::NDArray)    tanh.(x)
@deprecate arcsinh(x::NDArray) asinh.(x)
@deprecate arccosh(x::NDArray) acosh.(x)
@deprecate arctanh(x::NDArray) atanh.(x)

# @deprecate make `randn` exported accidentially
# so we make the depwarn manually
function randn(μ, σ, dims::NTuple{N,Int}, ctx::Context = cpu()) where N
  @warn("mx.randn(μ, σ, dims, ctx = cpu()) is deprecated, use " *
        "mx.randn(dims...; μ = μ, σ = σ, context = ctx) instead.")
  mx.randn(dims...; μ = μ, σ = σ, context = ctx)
end

function randn!(μ, σ, x::NDArray)
  @warn("mx.randn!(μ, σ, x::NDArray) is deprecated, use " *
        "mx.randn!(x; μ = μ, σ = σ) instead.")
  randn!(x; μ = μ, σ = σ)
end

function rand!(low::Real, high::Real, x::NDArray)
  @warn("rand!(low, high, x::NDArray) is deprecated, use " *
        "rand!(x, low = low, high = high) instead.")
  rand!(x, low = low, high = high)
end

function rand(low::Real, high::Real, dims::NTuple{N,Int}, context::Context = cpu()) where N
  @warn("rand!(low, high, dims, x::NDArray, context = cpu()) is deprecated, use " *
        "rand!(dims..., x; low = low, high = high, context = cpu()) instead.")
  rand(dims...; low = low, high = high, context = context)
end

@deprecate sigmoid(x::NDArray)                      sigmoid.(x)
@deprecate relu(x::NDArray)                         relu.(x)
@deprecate softmax(x::NDArray; axis = ndims(x))     softmax.(x, axis)
@deprecate log_softmax(x::NDArray; axis = ndims(x)) log_softmax.(x, axis)

function broadcast_plus(x::NDArray, y::NDArray)
  @warn("broadcast_plus(x, y) is deprecated, use x .+ y instead.")
  x .+ y
end

function broadcast_add(x::NDArray, y::NDArray)
  @warn("broadcast_add(x, y) is deprecated, use x .+ y instead.")
  x .+ y
end

function broadcast_sub(x::NDArray, y::NDArray)
  @warn("broadcast_sub(x, y) is deprecated, use x .- y instead.")
  x .- y
end

function broadcast_minus(x::NDArray, y::NDArray)
  @warn("broadcast_minus(x, y) is deprecated, use x .- y instead.")
  x .- y
end

function broadcast_mul(x::NDArray, y::NDArray)
  @warn("broadcast_mul(x, y) is deprecated, use x .* y instead.")
  x .* y
end

function broadcast_div(x::NDArray, y::NDArray)
  @warn("broadcast_div(x, y) is deprecated, use x ./ y instead.")
  x ./ y
end

function broadcast_mod(x::NDArray, y::NDArray)
  @warn("broadcast_mod(x, y) is deprecated, use x .% y instead.")
  x .% y
end

function broadcast_power(x::NDArray, y::NDArray)
  @warn("broadcast_power(x, y) is deprecated, use x.^y instead.")
  x.^y
end

function broadcast_equal(x::NDArray, y::NDArray)
  @warn("broadcast_equal(x, y) is deprecated, use x .== y instead.")
  x .== y
end

function broadcast_not_equal(x::NDArray, y::NDArray)
  @warn("broadcast_not_equal(x, y) is deprecated, use x .== y instead.")
  x .!= y
end

function broadcast_greater(x::NDArray, y::NDArray)
  @warn("broadcast_greater(x, y) is deprecated, use x .== y instead.")
  x .> y
end

function broadcast_greater_equal(x::NDArray, y::NDArray)
  @warn("broadcast_greater_equal(x, y) is deprecated, use x .== y instead.")
  x .>= y
end

function broadcast_lesser(x::NDArray, y::NDArray)
  @warn("broadcast_lesser(x, y) is deprecated, use x .== y instead.")
  x .< y
end

function broadcast_lesser_equal(x::NDArray, y::NDArray)
  @warn("broadcast_lesser_equal(x, y) is deprecated, use x .== y instead.")
  x .<= y
end

function broadcast_maximum(x::NDArray, y::NDArray)
  @warn("broadcast_maximum(x, y) is deprecated, use max.(x, y) instead.")
  max.(x, y)
end

function broadcast_minimum(x::NDArray, y::NDArray)
  @warn("broadcast_minimum(x, y) is deprecated, use min.(x, y) instead.")
  min.(x, y)
end

function broadcast_hypot(x::NDArray, y::NDArray)
  @warn("broadcast_hypot(x, y) is deprecated, use hypot.(x, y) instead.")
  hypot.(x, y)
end

# Introduced by https://github.com/apache/incubator-mxnet/pull/12845
import Base: sum, maximum, minimum, prod, cat
@deprecate sum(x::NDArray, dims) sum(x, dims = dims)
@deprecate maximum(x::NDArray, dims) maximum(x, dims = dims)
@deprecate minimum(x::NDArray, dims) minimum(x, dims = dims)
@deprecate prod(x::NDArray, dims) prod(x, dims = dims)
@deprecate cat(dims, As::NDArray{T}...) where T cat(As..., dims = dims)

import Statistics: mean
@deprecate mean(x::NDArray, dims) mean(x, dims = dims)

# replaced by UndefInitializer
function empty(::Type{T}, dims::NTuple{N,Int}, ctx::Context = cpu()) where {N,T<:DType}
  @warn("`mx.empty(T, dims, ctx)` is deprecated, " *
        "use `NDArray{T,N}(undef, dims; ctx = ctx)` instead.")
  NDArray{T,N}(undef, dims; ctx = ctx)
end

function empty(::Type{T}, dims::Int...) where {T<:DType}
  @warn("`mx.empty(T, dims...)` is deprecated, " *
        "use `NDArray{T,N}(undef, dims...)` instead.")
  NDArray{T,N}(undef, dims...)
end

function empty(dims::NTuple{N,Int}, ctx::Context = cpu()) where N
  @warn("`mx.empty(dims, ctx)` is deprecated, " *
        "use `NDArray(undef, dims; ctx = ctx)` instead.")
  NDArray(undef, dims; ctx = ctx)
end

function empty(dims::Int...)
  @warn("`mx.empty(dims...)` is deprecated, " *
        "use `NDArray(undef, dims...)` instead.")
  NDArray(undef, dims...)
end

# replaced by Base.clamp
@deprecate clip(x::NDArray, lo::Real, hi::Real)  clamp(x, lo, hi)
@deprecate clip!(x::NDArray, lo::Real, hi::Real) clamp!(x, lo, hi)
@deprecate clip(x; a_min = 0, a_max = 0) clamp(x, a_min, a_max)


text:
name: Update Entry
about: Tell us if you found out that the deletion process changed on a given website
title: ''
labels: 'update_entry'
assignees: ''

---

# Backstory
<!-- Tell a bit about how you noticed the deletion process changed -->

# Data
<!-- Check the fields that changed below and provide the new value -->

- [ ] `name`: <!-- New name -->
- [ ] `url`: <!-- New url -->
- [ ] `difficulty`: <!-- New difficulty: easy/medium/hard/impossible -->
- [ ] `notes`: <!-- Updated notes -->
- [ ] `email`: <!-- New e-mail address -->
- [ ] `domains`: <!--New e-mail subject -->


text:
package org.springframework.boot.web.embedded.undertow;

import java.util.Arrays;

import io.undertow.Undertow;
import org.junit.Test;
import org.mockito.InOrder;

import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactoryTests;
import org.springframework.http.server.reactive.HttpHandler;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;

/**
 * Tests for {@link UndertowReactiveWebServerFactory} and {@link UndertowWebServer}.
 *
 * @author Brian Clozel
 * @author Madhura Bhave
 */
public class UndertowReactiveWebServerFactoryTests
		extends AbstractReactiveWebServerFactoryTests {

	@Override
	protected UndertowReactiveWebServerFactory getFactory() {
		return new UndertowReactiveWebServerFactory(0);
	}

	@Test
	public void setNullBuilderCustomizersShouldThrowException() {
		UndertowReactiveWebServerFactory factory = getFactory();
		this.thrown.expect(IllegalArgumentException.class);
		this.thrown.expectMessage("Customizers must not be null");
		factory.setBuilderCustomizers(null);
	}

	@Test
	public void addNullBuilderCustomizersShouldThrowException() {
		UndertowReactiveWebServerFactory factory = getFactory();
		this.thrown.expect(IllegalArgumentException.class);
		this.thrown.expectMessage("Customizers must not be null");
		factory.addBuilderCustomizers((UndertowBuilderCustomizer[]) null);
	}

	@Test
	public void builderCustomizersShouldBeInvoked() throws Exception {
		UndertowReactiveWebServerFactory factory = getFactory();
		HttpHandler handler = mock(HttpHandler.class);
		UndertowBuilderCustomizer[] customizers = new UndertowBuilderCustomizer[4];
		for (int i = 0; i < customizers.length; i++) {
			customizers[i] = mock(UndertowBuilderCustomizer.class);
		}
		factory.setBuilderCustomizers(Arrays.asList(customizers[0], customizers[1]));
		factory.addBuilderCustomizers(customizers[2], customizers[3]);
		this.webServer = factory.getWebServer(handler);
		InOrder ordered = inOrder((Object[]) customizers);
		for (UndertowBuilderCustomizer customizer : customizers) {
			ordered.verify(customizer).customize(any(Undertow.Builder.class));
		}
	}

}


text:
The Polymer Renamer
===================

[![Build Status](https://travis-ci.org/PolymerLabs/PolymerRenamer.svg?branch=master)](https://travis-ci.org/PolymerLabs/PolymerRenamer)

The Polymer Renamer helps developers integrate the Google Closure compiler with
their Polymer projects by forwarding renames performed by the compiler to HTML
and JS files.

## Building the Polymer Renamer
    > ant jar

## Running the Polymer Renamer
    > java -jar PolymerRenamer.jar <Property Map Filename> <HTML or JS Filename>

## Running the Tests
    > ant run-tests


text:
A  [9-Slice](http://www.centigrade.de/blog/en/article/modern-user-interface-design-tools-part-2-graphical-approach-of-gui-design-tools/) component for [A-Frame](https://aframe.io).

 ![slice9](https://cloud.githubusercontent.com/assets/674727/24439830/8e493334-1405-11e7-9463-3da06712da91.png)

### API

| Property | Description | Default Value |
| -------- | ----------- | ------------- |
| width       |             | 1              |
| height      |             | 1              |
| left        |             | 0              |
| right       |             | 0              |
| bottom      |             | 0              |
| top         |             | 0              |
| side        |             | front              |
| padding     |             | 0.1              |
| color       |             | #fff              |
| opacity     |             | 1.0              |
| transparent |             | true              |
| debug       |             | false              |
| map         |             | ''              |

### Installation

#### Browser

Install and use by directly including the [browser files](dist):

```html
<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-slice9-component/dist/aframe-slice9-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity slice9="foo: bar"></a-entity>
  </a-scene>
</body>
```

<!-- If component is accepted to the Registry, uncomment this. -->
<!--
Or with [angle](https://npmjs.com/package/angle/), you can install the proper
version of the component straight into your HTML file, respective to your
version of A-Frame:

```sh
angle install aframe-slice9-component
```
-->

#### npm

Install via npm:

```bash
npm install aframe-slice9-component
```

Then require and use.

```js
require('aframe');
require('aframe-slice9-component');
```


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

package org.chromium.chrome.browser.externalnav;

import android.content.Intent;

import androidx.annotation.Nullable;

import org.chromium.base.IntentUtils;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.url.Origin;

import java.security.SecureRandom;
import java.util.Arrays;

/**
 * This class generates a token for the most recently launched external intent that has
 * any metadata that the browser is interested in. If the external intent resolves
 * to the browser itself, the token will be used to validate the intent and return the
 * store metadata.
 * Since there could be at most one intent chooser at a time, this class only stores
 * the metadata associated with the most recently launched intent. Token for a previously
 * launched intent will be invalidated if a new one comes.
 */
public class IntentWithRequestMetadataHandler {
    /**
     * Extra to record the token associated with the URL request metadata.
     */
    public static final String EXTRA_REQUEST_METADATA_TOKEN =
            "org.chromium.chrome.browser.request_metadata_token";

    private static final String TAG = "MetadataHandler";

    private static final Object INSTANCE_LOCK = new Object();
    private static IntentWithRequestMetadataHandler sIntentWithRequestMetadataHandler;
    private SecureRandom mSecureRandom = new SecureRandom();
    private RequestMetadata mRequestMetadata;
    private byte[] mIntentToken;
    private String mUri;

    /**
     * Class representing the URL request metadata that can be retrieved later.
     */
    public static class RequestMetadata {
        private final boolean mHasUserGesture;
        private final boolean mIsRendererIntiated;
        private final Origin mInitiatorOrigin;

        public RequestMetadata(boolean hasUserGesture, boolean isRendererIntiated,
                @Nullable Origin initiatorOrigin) {
            mHasUserGesture = hasUserGesture;
            mIsRendererIntiated = isRendererIntiated;
            mInitiatorOrigin = initiatorOrigin;
        }

        public boolean isRendererInitiated() {
            return mIsRendererIntiated;
        }

        public boolean hasUserGesture() {
            return mHasUserGesture;
        }

        @Nullable
        public Origin getInitiatorOrigin() {
            return mInitiatorOrigin;
        }
    };

    /**
     * Get the singleton instance of this object.
     */
    public static IntentWithRequestMetadataHandler getInstance() {
        synchronized (INSTANCE_LOCK) {
            if (sIntentWithRequestMetadataHandler == null) {
                sIntentWithRequestMetadataHandler = new IntentWithRequestMetadataHandler();
            }
        }
        return sIntentWithRequestMetadataHandler;
    }

    /**
     * Generate a new token for the intent and put the token and request metadata in the
     * intent extra. This will invalidate the token on the previously launched intent with request
     * metadata.
     *
     * @param intent Intent with request metadata.
     * @param metadata Request metadata to be put into the intent extra.
     */
    public void onNewIntentWithRequestMetadata(Intent intent, RequestMetadata metadata) {
        mIntentToken = new byte[32];
        mSecureRandom.nextBytes(mIntentToken);
        intent.putExtra(EXTRA_REQUEST_METADATA_TOKEN, mIntentToken);
        mRequestMetadata = metadata;
        mUri = IntentHandler.getUrlFromIntent(intent);
    }

    /**
     * Get the request metadata from the intent and clear the stored metadata.
     *
     * @param intent Intent that is used to launch chrome.
     * @return Request metadata from the intent if available, or null otherwise.
     */
    @Nullable
    public RequestMetadata getRequestMetadataAndClear(Intent intent) {
        if (mIntentToken == null || mUri == null) return null;
        byte[] bytes = IntentUtils.safeGetByteArrayExtra(intent, EXTRA_REQUEST_METADATA_TOKEN);
        RequestMetadata result = null;
        if ((bytes != null) && Arrays.equals(bytes, mIntentToken)
                && mUri.equals(IntentHandler.getUrlFromIntent(intent))) {
            result = mRequestMetadata;
        }
        clear();
        return result;
    }

    /**
     * Clear the stored metadata.
     */
    public void clear() {
        mIntentToken = null;
        mUri = null;
        mRequestMetadata = null;
    }
}


text:
int main(int argc, char *argv[])
{
    @autoreleasepool
    {
        NSString *device =
            [[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)] ? [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)] : nil;
        struct utsname systemInfo;
        uname(&systemInfo);
        NSString *model = [NSString stringWithCString:systemInfo.machine
                                             encoding:NSUTF8StringEncoding];
        [GAI sharedInstance].trackUncaughtExceptions = YES;
        [GAI sharedInstance].dispatchInterval = 0;
        [[GAI sharedInstance] trackerWithTrackingId:@"UA-41220983-2"];

        [[GAI sharedInstance].defaultTracker send:[[[GAIDictionaryBuilder createEventWithCategory:model
                                                                                action:@"Demo Launch"
                                                                                label:device
                                                                                value:nil]
                                                         set:@"start"
                                                      forKey:kGAISessionControl] build]];
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([DEMOAppDelegate class]));
    }
}


text:
<?php

namespace FriendlyScore\OAuth2\Client\Provider;

use FriendlyScore\OAuth2\Client\User\User;
use League\OAuth2\Client\Provider\AbstractProvider;

use FriendlyScore\OAuth2\Client\Exception\NoBaseUrlException;

class BaseProvider extends AbstractProvider {
	use \League\OAuth2\Client\Tool\BearerAuthorizationTrait;

	protected $__access_token
	        , $__id
	        , $__by
	        , $__base_url = 'https://friendlyscore.com/'
	        , $_json_decode_assoc = false;

	public function setBaseUrl($v) {
		$this->__base_url = preg_match('#/$#', $v) ? $v : $v.'/';
		return $this;
	}

    public function setJsonDecodeAssoc($bool) {
        $this->_json_decode_assoc = $bool;
        return $this;
    }

    public function getJsonDecodeAssoc($bool) {
        return $this->_json_decode_assoc;
    }

    public function jsonDecode($json) {
        return json_decode($json, $this->_json_decode_assoc);
    }

	public function getBaseUrl() {

		if (!$this->__base_url) {
			throw new NoBaseUrlException();
		}

		return $this->__base_url;
	}

	public function getBaseAuthorizationUrl() {
		return $this->getBaseUrl().'oauth/v2/auth';
	}
	public function getBaseAccessTokenUrl(array $params) {
		return $this->getBaseUrl().'oauth/v2/token';
	}
	public function getResourceOwnerDetailsUrl(\League\OAuth2\Client\Token\AccessToken $token) {
		return $this->getBaseUrl().'api/v2/current-user';
	}
	protected function getDefaultScopes() {
		return [];
	}
	protected function checkResponse(\Psr\Http\Message\ResponseInterface $response, $data) {
		// If you'd like to throw exceptions when there is { "error": "..." } response
	}
	protected function createResourceOwner(array $response, \League\OAuth2\Client\Token\AccessToken $token) {
		return new User($response);
	}

	public function getHttpClient() {
		static $client = null;

		if ($client === null) {
			$client = new \GuzzleHttp\Client(['headers' => [
				'Content-Type' => 'application/json',
				'Accept'       => 'application/json',
			]]);
		}

		return $client;
	}

	public function with($token) {
		$this->__access_token = $token;
		return $this;
	}

	public function send($method, $endpoint, $params = []) {

		if (strtoupper($method) === 'GET') {
			$endpoint .= '?'.http_build_query($params);
			$params    = [];
		} else {
			$params = [ 'body' => json_encode($params) ];
		}

		$request = $this->getAuthenticatedRequest(
			$method,
			$this->getBaseUrl().$endpoint,
			$this->__access_token,
			$params
		);

		return $this->jsonDecode($this->getHttpClient()->send($request)->getBody());
	}

}


text:
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals

import unittest

from nose import tools
from lxml import html
from justext.core import preprocessor, html_to_dom

class TestDomUtils(unittest.TestCase):
    def test_remove_comments(self):
        dom = html.fromstring(
            ''
            '
Header
'
            ' text'
            '
footer'
            ''
        )

        expected = '
Header
 text
footer
'
        returned = html.tostring(dom).decode("utf8")
        tools.assert_equal(expected, returned)

        dom = preprocessor(dom)

        expected = '
Header
 text
footer
'
        returned = html.tostring(dom).decode("utf8")
        tools.assert_equal(expected, returned)

    def test_remove_head_tag(self):
        html_string = (
            '<title>Title</title>'
            '
Header
'
            '
text
'
            '
footer like a boss
'
            ''
        )

        dom = html.fromstring(html_string)
        returned = html.tostring(dom).decode("utf8")
        tools.assert_equal(html_string, returned)

        dom = preprocessor(dom)
        returned = html.tostring(dom).decode("utf8")
        expected = (
            ''
            '
Header
'
            '
text
'
            '
footer like a boss
'
            ''
        )
        tools.assert_equal(expected, returned)

    def test_preprocess_simple_unicode_string(self):
        html_string = (
            '<title>Title</title>'
            '
Header
'
            '
pretextpostemphpopost
'
            '
footer like a boss
'
            ''
        )

        dom = preprocessor(html_to_dom(html_string))
        returned = html.tostring(dom).decode("utf8")
        expected = (
            ''
            '
Header
'
            '
pretextpostemphpopost
'
            '
footer like a boss
'
            ''
        )
        tools.assert_equal(expected, returned)

    def test_preprocess_simple_bytes_string(self):
        html_string = (
            b'<title>Title</title>'
            b'
Header
'
            b'
pretextpostemphpopost
'
            b'
footer like a boss
'
            b'  \n'
            b''
        )

        dom = preprocessor(html_to_dom(html_string))
        returned = html.tostring(dom).decode("utf8")
        expected = (
            ''
            '
Header
'
            '
pretextpostemphpopost
'
            '
footer like a boss
'
            '  \n'
            ''
        )
        tools.assert_equal(expected, returned)

    def test_preprocess_simple_unicode_xhtml_string_with_declaration(self):
        html_string = (
            '<?xml version="1.0" encoding="windows-1250"?>'
            '<!DOCTYPE html>'
            ''
            ''
            '<title>Hello World</title>'
            '<meta http-equiv="imagetoolbar" content="no" />'
            '<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />'
            ''
            ''
            ''
            ''
        )

        dom = preprocessor(html_to_dom(html_string))
        returned = html.tostring(dom).decode("utf8")
        expected = (
            ''
            ''
            ''
            ''
        )
        tools.assert_equal(expected, returned)

    def test_preprocess_simple_bytes_xhtml_string_with_declaration(self):
        html_string = (
            b'<?xml version="1.0" encoding="windows-1250"?>'
            b'<!DOCTYPE html>'
            b''
            b''
            b'<title>Hello World</title>'
            b'<meta http-equiv="imagetoolbar" content="no" />'
            b'<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />'
            b''
            b''
            b''
            b''
        )

        dom = preprocessor(html_to_dom(html_string))
        returned = html.tostring(dom).decode("utf8")
        expected = (
            ''
            ''
            ''
            ''
        )
        tools.assert_equal(expected, returned)


text:
/***************
Jonathan Hanson
CS 120 - 01
Sept 24, 2013
Lab 4 Part 2

In addition to the changes assigned I rearranged the menu to feel more natural,
added labels so the user is reminded what operation he or she selected, and
removed the annoying bug where upon exit the previous answer is stated again.
***************/
#include<iostream>
using namespace std;

//////// Function Prototypes ////////
void print_menu();
float get_value();
float divide(float,float);
float minimum(float,float);

//////// Main ////////
int main() {
	float operand1, operand2, answer;
	int choice, valid_choice;

	cout << "\n\nSimple Calculator\n\n";
	cout << "Created by: Jonathan Hanson\nSept 24, 2013\n";
	cout << "This program uses functions and a simple, menu-based\nformat to make basic math operations easy and fun.\n";
	cout << "Input the integer labels in the menu to navigate, and\ninput floating point numbers or integers as operands.\n";

	do{
		print_menu();
		cin >> choice;
		valid_choice = 1;
		switch(choice){
		case 0:
			break;
		case 1:
			cout << "\nAddition Calculator\n";
			operand1 = get_value();
			operand2 = get_value();
			answer = operand1 + operand2;
			break;
		case 2:
			cout << "\nSubtraction Calculator\n";
			operand1 = get_value();
			operand2 = get_value();
			answer = operand1 - operand2;
			break;
		case 3:
			cout << "\nDivision Calculator\n";
			operand1 = get_value();
			operand2 = get_value();
			answer = divide(operand1,operand2);
			break;
		case 4:
			cout << "\nMinimum Calculator\n";
			operand1 = get_value();
			operand2 = get_value();
			answer = minimum(operand1,operand2);
			break;
		default:
			valid_choice = 0;
			cout << "Invalid Choice." << endl;
		}
		if(valid_choice && choice != 0){
			cout << endl << "Answer = " << answer << endl;
		}
	}while(choice != 0);

	cout << "\nGoodbye!\n\n";

	return 0;
}

//////// Functions ////////
float divide(float dividend, float divisor){
	if(divisor == 0)
		return 0;
	else
		return (dividend/divisor);
}

float minimum(float value1, float value2){
	if(value1 < value2)
		return value1;
	else
		return value2;
}

float get_value(){
	float temp_value;
		cout << "Enter a value: ";
		cin >> temp_value;
		return temp_value;
}

void print_menu(){
	cout << endl;
	cout << "Add (1)" << endl;
	cout << "Subtract (2)" << endl;
	cout << "Divide (3)" << endl;
	cout << "Minimum (4)" << endl;
	cout << "Exit (0)" << endl;
	cout << "Enter your choice: ";
}


text:
Domains
=======

user = mail
password = passw0rd
dbname = mail
hosts = localhost
query = SELECT domain FROM domain WHERE domain = '%s'

User
====

user = mail
password = passw0rd
dbname = mail
hosts = localhost
query = SELECT
CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM user WHERE email = '%s' AND active=1

Alias
=====

user = mail
password = passw0rd
dbname = mail
hosts = localhost
query = SELECT destination FROM alias WHERE source = '%s' AND active=1

Transport
=========

user = mail
password = passw0rd
dbname = mail
hosts = localhost
query = SELECT transport FROM transport WHERE domain = '%s'


text:
package org.odata4j.producer.resources;

import java.util.Properties;
import java.util.logging.Logger;

import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

import org.odata4j.core.Throwables;
import org.odata4j.producer.ODataProducer;
import org.odata4j.producer.ODataProducerFactory;

/**
 * Default OData producer provider.
 *
 *
OData producer instances can either be set statically (method {@code setInstance})
 * or created by a factory ({@link ODataProducerFactory}) specified by the corresponding
 * system property (constant {@code FACTORY_PROPNAME}).
 *
 *
To introduce an additional container-specific setting, it is required to extend
 * this class and override method {@code createInstanceFromFactoryInContainerSpecificSetting}.
 * Furthermore a subclass of {@link AbstractODataApplication} has to be created to make
 * the new provider available to the JAX-RS runtime.
 */
@Provider
public class DefaultODataProducerProvider implements ContextResolver<ODataProducer> {

  /**
   * Constant used as system property name.
   */
  public static final String FACTORY_PROPNAME = "odata4j.producerfactory";

  private static ODataProducer STATIC;

  /**
   * Sets the given OData producer as a static singleton.
   *
   * @param producer  the OData producer
   */
  public static void setInstance(ODataProducer producer) {
    STATIC = producer;
  }

  private final Logger log = Logger.getLogger(getClass().getName());

  private ODataProducer instance;

  @Override
  public final ODataProducer getContext(Class<?> type) {
    if (!type.equals(ODataProducer.class))
      throw new RuntimeException("Invalid context type");

    if (instance != null)
      return instance;

    initializeInstance();
    return instance;
  }

  private void initializeInstance() {
    instance = setInstanceToStaticSingleton();
    if (instance == null)
      instance = createInstanceFromFactoryInContainerSpecificSetting();
    if (instance == null)
      instance = createInstanceFromFactoryInSystemProperties();
    if (instance == null)
      throw new RuntimeException("Unable to find an OData producer implementation. Call ODataProducerProvider.setInstance to set the static singleton or set the producer factory property \'" + FACTORY_PROPNAME + "\' in either the system properties or a container-specifc manner to a class name that implements ODataProducerFactory.");
  }

  private ODataProducer setInstanceToStaticSingleton() {
    if (STATIC != null) {
      log("Setting producer instance to static singleton: " + STATIC);
      return STATIC;
    }
    return null;
  }

  /**
   * Creates an OData producer instance using a factory specified in a container-specific
   * setting.
   *
   *
The default implementation returns {@code null}. Implementers can use the helper
   * methods {@code newProducerFromFactory} and {@code log}.
   *
   * @return the OData producer or {@code null} if no container-specific setting exists
   */
  protected ODataProducer createInstanceFromFactoryInContainerSpecificSetting() {
    return null;
  }

  private ODataProducer createInstanceFromFactoryInSystemProperties() {
    if (System.getProperty(FACTORY_PROPNAME) != null) {
      String factoryTypeName = System.getProperty(FACTORY_PROPNAME);
      log("Creating producer from factory in system properties: " + factoryTypeName);
      return newProducerFromFactory(factoryTypeName, System.getProperties());
    }
    return null;
  }

  /**
   * Helper method to create an OData producer instance from a given producer factory
   * ({@link ODataProducerFactory}).
   *
   * @param factoryTypeName  the factory's type name (fully qualified)
   * @param props  the properties to use when constructing the producer
   * @return the new producer
   */
  protected final ODataProducer newProducerFromFactory(String factoryTypeName, Properties props) {
    try {
      Class<?> factoryType = Class.forName(factoryTypeName);
      Object obj = factoryType.newInstance();
      ODataProducerFactory factory = (ODataProducerFactory) obj;
      return factory.create(props);
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }

  /**
   * Helper method to log an INFO message.
   *
   * @param msg  the log message
   */
  protected final void log(String msg) {
    log.info(msg);
  }
}


text:
#pragma once

bool setup_shutdown_pipe(int pipedes_[2]);


text:
namespace vgui
{
	class Panel;
}

class CMainMenu : public vgui::Frame
{
	DECLARE_CLASS_SIMPLE(CMainMenu, vgui::Frame);

public:
	CMainMenu(vgui::VPANEL parent);
	~CMainMenu();

	void OnShowPanel(bool state);
	void PaintBackground();
	void PerformDefaultLayout();
	void PerformLayout();
	void OnScreenSizeChanged(int iOldWide, int iOldTall);
	void OnThink();

	bool InGame();

	void OnCommand(const char *command);
	void ApplySchemeSettings(vgui::IScheme *pScheme);

	void OnKeyCodeTyped(vgui::KeyCode code);

	void ReturnToMainMenu();
	void PlayMenuSound();

	void OnTick();

private:

	void CheckSaveRollovers(int x, int y);

	vgui::ImagePanel *m_pImgBegin;
	vgui::ImagePanel *m_pImgContinue;
	vgui::ImagePanel *m_pImgCredits;
	vgui::ImagePanel *m_pImgOptions;
	vgui::ImagePanel *m_pImgLeave;
	vgui::ImagePanel *m_pImgAchievements;
	vgui::ImagePanel *m_pImgBack;

	// Quit
	vgui::ImagePanel *m_pImgYes;
	vgui::ImagePanel *m_pImgNo;
	vgui::ImagePanel *m_pImgSure;

	// Info Version
	vgui::Label *m_pLabelVersion;

	// Achievements
	vgui::ImagePanel *m_pImgAchievementItems[12];
	vgui::Button *m_pButtonAchievementItems[12];
	bool InRolloverAchievementItems[12];

	vgui::ImagePanel *m_pImgAchievementText;
	vgui::ImagePanel *m_pImgGotAll;
	vgui::ImagePanel *m_pImgAchievementBackground;

	// Credits
	vgui::CreditsListing *m_pCreditsPanelList;

	vgui::ImagePanel *m_pImgBackground;

	vgui::Button *m_pButtonBegin;
	vgui::Button *m_pButtonContinue;
	vgui::Button *m_pButtonCredits;
	vgui::Button *m_pButtonOptions;
	vgui::Button *m_pButtonLeave;
	vgui::Button *m_pButtonAchievements;
	vgui::Button *m_pButtonBack;
	vgui::Button *m_pButtonRedirect;

	// Quit
	vgui::Button *m_pButtonYes;
	vgui::Button *m_pButtonNo;

	// Begin/Continue
	vgui::Button *m_pButtonSlot[4];
	vgui::ImagePanel *m_pImgSlot[4];
	vgui::ImagePanel *m_pImgSlots;

	bool InOptions;
	bool InAchievements;
	bool InQuit;
	bool InCredits;

	bool InStart;
	bool InLoad;

	bool InAnyMenu;

	KeyValues *GetSaveData(const char *szFile);
	void DeleteSaveDataFile(const char *szFile);

	// TFO Options:
	void ShowBaseOtherOptions(bool bShow);

	// Base
	bool InCustomOptionMenu[6];

	vgui::ImagePanel *m_pImgCustomOptions[6];
	vgui::Button *m_pButtonCustomOptions[6];

	// Controls - Keyboard
	vgui::OptionsKeyboard *m_pOptionsKeyboardList;

	// Controls - Mouse
	vgui::OptionsMenuMouse *m_pOptionsMousePanel;

	// Controls - Audio
	vgui::OptionsMenuAudio *m_pOptionsAudioPanel;

	// Controls - Video
	vgui::OptionsMenuVideo *m_pOptionsVideoPanel;

	// Controls - Graphics
	vgui::OptionsMenuGraphics *m_pOptionsGraphicsPanel;

	// Controls - Other
	vgui::ImagePanel *m_pImgDialogue;
	vgui::ImagePanel *m_pImgViewbob;
	vgui::ImagePanel *m_pImgMirror;
	vgui::ImagePanel *m_pImgSubtitles;
	vgui::ImagePanel *m_pImgFilmGrain;

	vgui::Button *m_pButtonDialogue;
	vgui::Button *m_pButtonViewbob;
	vgui::Button *m_pButtonMirror;
	vgui::Button *m_pButtonSubtitles;
	vgui::Button *m_pButtonFilmGrain;

	// Film Grain Strength
	vgui::GraphicalSlider *m_pFilmGrainStrengthSlider;
	vgui::GraphicalOverlay *m_pFilmGrainSliderGUI;
	vgui::Label *m_pFilmGrainSliderInfo;

	MESSAGE_FUNC_PARAMS(OnSliderMove, "SliderMoved", data);
};