text:
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls.base import reverse_lazy
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.list import ListView

from hordak.models import Account, Leg
from hordak.forms import accounts as account_forms

class AccountListView(LoginRequiredMixin, ListView):
    """View for listing accounts

    Examples:

        .. code-block:: python

            urlpatterns = [
                ...
                url(r'^accounts/$', AccountListView.as_view(), name='accounts_list'),
            ]

    """

    model = Account
    template_name = "hordak/accounts/account_list.html"
    context_object_name = "accounts"

class AccountCreateView(LoginRequiredMixin, CreateView):
    """View for creating accounts

    Examples:

        .. code-block:: python

            urlpatterns = [
                ...
                url(r'^accounts/create/$', AccountCreateView.as_view(success_url=reverse_lazy('accounts_list')), name='accounts_create'),
            ]

    """

    form_class = account_forms.AccountForm
    template_name = "hordak/accounts/account_create.html"
    success_url = reverse_lazy("hordak:accounts_list")

class AccountUpdateView(LoginRequiredMixin, UpdateView):
    """View for updating accounts

    Note that :class:`hordak.forms.AccountForm` prevents updating of the ``currency``
    and ``type`` fields. Also note that this view expects to receive the Account's
    ``uuid`` field in the URL (see example below).

    Examples:

        .. code-block:: python

            urlpatterns = [
                ...
                url(r'^accounts/update/(?P<uuid>.+)/$', AccountUpdateView.as_view(success_url=reverse_lazy('accounts_list')), name='accounts_update'),
            ]

    """

    model = Account
    form_class = account_forms.AccountForm
    template_name = "hordak/accounts/account_update.html"
    slug_field = "uuid"
    slug_url_kwarg = "uuid"
    context_object_name = "account"
    success_url = reverse_lazy("hordak:accounts_list")

class AccountTransactionsView(LoginRequiredMixin, SingleObjectMixin, ListView):
    template_name = "hordak/accounts/account_transactions.html"
    model = Leg
    slug_field = "uuid"
    slug_url_kwarg = "uuid"

    def get(self, request, *args, **kwargs):
        self.object = self.get_object()
        return super(AccountTransactionsView, self).get(request, *args, **kwargs)

    def get_object(self, queryset=None):
        if queryset is None:
            queryset = Account.objects.all()
        return super(AccountTransactionsView, self).get_object(queryset)

    def get_context_object_name(self, obj):
        return "legs" if hasattr(obj, "__iter__") else "account"

    def get_queryset(self):
        queryset = super(AccountTransactionsView, self).get_queryset()
        queryset = (
            Leg.objects.filter(account=self.object)
            .order_by("-transaction__date", "-pk")
            .select_related("transaction")
        )
        return queryset


text:
Simply add `parser` to your config.php `always_loaded.packages` config option.

## Included Parsers

* Mustache - A lightweight, yet powerful templating library.
* Markdown - A PHP version of Markdown by Michel Fortin.

## Usage

```php
// old usage still valid, will load app/views/example.php
View::forge('example');

// load a SimpleTags template, will load and parse app/views/example.stags
View::forge('example.stags');

// load a Mustache template, will load and parse app/views/example.mustache
View::forge('example.mustache');

// load a Twig template, will load and parse app/views/example.twig
View::forge('example.twig');

// load a Jade template, will load and parse app/views/example.jade
View::forge('example.jade');

// load a Haml template, will load and parse app/views/example.haml
View::forge('example.haml');

// load a Smarty template, will load and parse app/views/example.smarty
View::forge('example.smarty');

// load a Dwoo template, ATTENTION: this one expects app/views/example.tpl
View::forge('example.dwoo');
```

## Installing parsers

Only Markdown and Mustache are included. While many other drivers are included, their libraries are not and are by default expected in `app/vendor/lib_name` (capitalize lib_name), you'll have to download them yourself. Don't change the casing or anything, keep it as much original as possible within the `vendor/lib_name` dir to keep updating easy (also because some come with their own autoloader).

You can configure them to be loaded from other locations by copying the parser.php config file to your app and editing it.

## Config and runtime config

Currently the drivers still lack a lot of config options they should probably accept. They are currently all configured to work with one instance of their parser library, which is available to config:

```php
$view = View::forge('example.stags');
$view->parser()->set_delimiters('{', '}');
```

redpajama_set_name: RedPajamaGithub


text:
namespace em = enterprise_management;

namespace chromeos {
using content::BrowserThread;

const char kDevicePolicyType[] = "google/chromeos/device";

SignedSettings::SignedSettings()
    : service_(OwnershipService::GetSharedInstance()) {
}

SignedSettings::~SignedSettings() {}

// static
bool SignedSettings::PolicyIsSane(const em::PolicyFetchResponse& value,
                                  em::PolicyData* poldata) {
  if (value.has_policy_data()) {
    poldata->ParseFromString(value.policy_data());
    if (poldata->has_policy_type() &&
        poldata->policy_type() == kDevicePolicyType &&
        poldata->has_policy_value()) {
      return true;
    }
  }
  return false;
}

// static
SignedSettings::ReturnCode SignedSettings::MapKeyOpCode(
    OwnerManager::KeyOpCode return_code) {
  return (return_code == OwnerManager::KEY_UNAVAILABLE ?
          KEY_UNAVAILABLE : BAD_SIGNATURE);
}

class StorePolicyOp : public SignedSettings {
 public:
  StorePolicyOp(em::PolicyFetchResponse* policy,
                SignedSettings::Delegate<bool>* d);
  void Succeed(bool value);
  // Implementation of OwnerManager::Delegate
  virtual void Execute() OVERRIDE;
  virtual void Fail(SignedSettings::ReturnCode code) OVERRIDE;
  virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
                               const std::vector<uint8>& payload) OVERRIDE;

 protected:
  virtual ~StorePolicyOp();

 private:
  void RequestStorePolicy();

  void OnBoolComplete(bool success);
  // Always call d_->OnSettingOpCompleted() via this call.
  // It guarantees that the callback will not be triggered until _after_
  // Execute() returns, which is implicitly assumed by SignedSettingsHelper
  // in some cases.
  void PerformCallback(SignedSettings::ReturnCode code, bool value);

  em::PolicyFetchResponse* policy_;
  SignedSettings::Delegate<bool>* d_;
};

class RetrievePolicyOp : public SignedSettings {
 public:
  explicit RetrievePolicyOp(
      SignedSettings::Delegate<const em::PolicyFetchResponse&>* d);
  void Succeed(const em::PolicyFetchResponse& value);
  // Implementation of OwnerManager::Delegate
  virtual void Execute() OVERRIDE;
  virtual void Fail(SignedSettings::ReturnCode code) OVERRIDE;
  virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
                               const std::vector<uint8>& payload) OVERRIDE;

 protected:
  virtual ~RetrievePolicyOp();

 private:
  void OnStringComplete(const std::string& serialized_proto);
  // Always call d_->OnSettingOpCompleted() via this call.
  // It guarantees that the callback will not be triggered until _after_
  // Execute() returns, which is implicitly assumed by SignedSettingsHelper
  // in some cases.
  void PerformCallback(SignedSettings::ReturnCode code,
                       const em::PolicyFetchResponse& value);

  void ProcessPolicy(const std::string& serialized_proto);

  em::PolicyFetchResponse policy_;
  SignedSettings::Delegate<const em::PolicyFetchResponse&>* d_;
};

// static
SignedSettings* SignedSettings::CreateStorePolicyOp(
    em::PolicyFetchResponse* policy,
    SignedSettings::Delegate<bool>* d) {
  DCHECK(d != NULL);
  DCHECK(policy != NULL);
  return new StorePolicyOp(policy, d);
}

// static
SignedSettings* SignedSettings::CreateRetrievePolicyOp(
    SignedSettings::Delegate<const em::PolicyFetchResponse&>* d) {
  DCHECK(d != NULL);
  return new RetrievePolicyOp(d);
}

StorePolicyOp::StorePolicyOp(em::PolicyFetchResponse* policy,
                             SignedSettings::Delegate<bool>* d)
    : policy_(policy),
      d_(d) {
}

void StorePolicyOp::Succeed(bool ignored) {
  SignedSettings::ReturnCode code = SUCCESS;
  bool to_ret = true;
  em::PolicyData poldata;
  if (SignedSettings::PolicyIsSane(*policy_, &poldata)) {
  } else {
    code = NOT_FOUND;
    to_ret = false;
  }
  BrowserThread::PostTask(
      BrowserThread::UI, FROM_HERE,
      base::Bind(&StorePolicyOp::PerformCallback, this, code, to_ret));
}

void StorePolicyOp::Execute() {
  // get protobuf contents to sign
  if (!policy_->has_policy_data())
    Fail(OPERATION_FAILED);
  else if (!policy_->has_policy_data_signature())
    service_->StartSigningAttempt(policy_->policy_data(), this);
  else
    RequestStorePolicy();
}

void StorePolicyOp::Fail(SignedSettings::ReturnCode code) {
  BrowserThread::PostTask(
      BrowserThread::UI, FROM_HERE,
      base::Bind(&StorePolicyOp::PerformCallback, this, code, false));
}

void StorePolicyOp::OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
                                    const std::vector<uint8>& payload) {
  // Ensure we're on the UI thread, due to the need to send DBus traffic.
  if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
    BrowserThread::PostTask(
        BrowserThread::UI, FROM_HERE,
        base::Bind(&StorePolicyOp::OnKeyOpComplete, this, return_code,
                   payload));
    return;
  }
  VLOG(2) << "StorePolicyOp::OnKeyOpComplete return_code = " << return_code;
  // Now, sure we're on the UI thread.
  if (return_code == OwnerManager::SUCCESS) {
    policy_->set_policy_data_signature(std::string(payload.begin(),
                                                   payload.end()));
    RequestStorePolicy();
    return;
  }
  Fail(SignedSettings::MapKeyOpCode(return_code));
}

StorePolicyOp::~StorePolicyOp() {}

void StorePolicyOp::RequestStorePolicy() {
  std::string serialized;
  if (policy_->SerializeToString(&serialized)) {
    DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy(
        serialized,
        base::Bind(&StorePolicyOp::OnBoolComplete, this));
  } else {
    Fail(OPERATION_FAILED);
  }
}

void StorePolicyOp::OnBoolComplete(bool success) {
  if (success)
    Succeed(true);
  else
    Fail(NOT_FOUND);
}

void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code,
                                    bool value) {
  d_->OnSettingsOpCompleted(code, value);
}

RetrievePolicyOp::RetrievePolicyOp(
    SignedSettings::Delegate<const em::PolicyFetchResponse&>* d)
    : d_(d) {
}

void RetrievePolicyOp::Succeed(const em::PolicyFetchResponse& value) {
  em::PolicyData poldata;
  if (SignedSettings::PolicyIsSane(value, &poldata)) {
    BrowserThread::PostTask(
        BrowserThread::UI, FROM_HERE,
        base::Bind(&RetrievePolicyOp::PerformCallback, this, SUCCESS, value));
  } else {
    Fail(NOT_FOUND);
  }
}

void RetrievePolicyOp::Execute() {
  DBusThreadManager::Get()->GetSessionManagerClient()->RetrieveDevicePolicy(
      base::Bind(&RetrievePolicyOp::OnStringComplete, this));
}

void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) {
  VLOG(2) << "RetrievePolicyOp::Execute() failed with " << code;
  BrowserThread::PostTask(
      BrowserThread::UI, FROM_HERE,
      base::Bind(&RetrievePolicyOp::PerformCallback, this, code,
                 em::PolicyFetchResponse()));
}

void RetrievePolicyOp::OnKeyOpComplete(
    const OwnerManager::KeyOpCode return_code,
    const std::vector<uint8>& payload) {
  if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
    BrowserThread::PostTask(
        BrowserThread::UI, FROM_HERE,
        base::Bind(&RetrievePolicyOp::OnKeyOpComplete, this, return_code,
                   payload));
    return;
  }
  // Now, sure we're on the UI thread.
  if (return_code == OwnerManager::SUCCESS)
    Succeed(policy_);
  else
    Fail(SignedSettings::MapKeyOpCode(return_code));
}

RetrievePolicyOp::~RetrievePolicyOp() {}

void RetrievePolicyOp::OnStringComplete(const std::string& serialized_proto) {
  ProcessPolicy(serialized_proto);
}

void RetrievePolicyOp::ProcessPolicy(const std::string& serialized_proto) {
  if (serialized_proto.empty() || !policy_.ParseFromString(serialized_proto) ||
      (!policy_.has_policy_data() && !policy_.has_policy_data_signature())) {
    Fail(NOT_FOUND);
    return;
  }
  if (!policy_.has_policy_data()) {
    Fail(OPERATION_FAILED);
    return;
  }
  if (!policy_.has_policy_data_signature()) {
    Fail(BAD_SIGNATURE);
    return;
  }
  std::vector<uint8> sig;
  const char* sig_ptr = policy_.policy_data_signature().c_str();
  sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length());
  service_->StartVerifyAttempt(policy_.policy_data(), sig, this);
}

void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code,
                                       const em::PolicyFetchResponse& value) {
  d_->OnSettingsOpCompleted(code, value);
}

}  // namespace chromeos


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Hope Idaewor - Physical Prototyping</title>
	<meta name="description"  content="Physical Prototyping" />
	<meta name="author" content="Hope Idaewor">
	<meta name="keywords"  content="ux, physical prototyping, ux design, ux research, research, ethnography, cross-cultural design, design research, portfolio, georgia tech, ux portfolio, georgia tech ux, africa, localization, product design" />
	<meta property="og:title" content="Hope Idaewor" />
	<meta property="og:type" content="website" />
	<meta property="og:url" content="" />
	<meta property="og:image" content="" />
	<meta property="og:image:width" content="470" />
	<meta property="og:image:height" content="246" />
	<meta property="og:site_name" content="" />
	<meta property="og:description" content="User Experience Portfolio" />

	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#212121"/>
    <meta name="msapplication-navbutton-color" content="#212121"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="#212121"/>

	<link href="https://fonts.googleapis.com/css?family=Work+Sans:100,200,300,400,500,600,700,800,900" rel="stylesheet"/>
	<link href="https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet"/>
	<link href="https://fonts.googleapis.com/css?family=Comfortaa:400,300,600,700,800,900|Open+Sans:400,300,600,700,800,900" rel="stylesheet">

	<link rel="stylesheet" href="css/bootstrap.min.css"/>
	<link rel="stylesheet" href="css/font-awesome.min.css"/>
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/brands.css" integrity="sha384-QT2Z8ljl3UupqMtQNmPyhSPO/d5qbrzWmFxJqmY7tqoTuT2YrQLEqzvVOP2cT5XW" crossorigin="anonymous">
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/fontawesome.css" integrity="sha384-u5J7JghGz0qUrmEsWzBQkfvc8nK3fUT7DCaQzNQ+q4oEXhGSx+P2OqjWsfIRB8QT" crossorigin="anonymous">
	<link rel="stylesheet" href="css/style.css"/>
	<link rel="stylesheet" href="css/colors/color.css"/>
	<link rel="stylesheet" href="css/ionicons.min.css"/>
	<link rel="stylesheet" href="css/owl.carousel.css"/>
	<link rel="stylesheet" href="css/owl.transitions.css"/>

	<link rel="icon" type="image/png" href="favicon.png">
	<link rel="apple-touch-icon" href="apple-touch-icon.png">
	<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png">
	<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png">

						Work

Shasha

Neurospeculative Afrofeminism

Happy Paths

Physical Prototyping

						About

						Blog

						Resume

physical
prototyping

								A compilation of products designed through the iteration of sketches, foam, cardboard, and 3D printing.

Foam

scultping

Paper

lasercut

Foam

Sculpting

From sketches to foam models, this project showcases a series ofperfume bottles created through iterative modeling. This method allowed me to stretch the boundaries of creativity while still preserving form and intent.

lasercut

Paper

Using storyboards, cardboard, and lasercutting, this interactive model was created to showcase a redesigned rice cooker. This model allowed for repeated testing and iteration in order to improve the user experience of the design.

				<button class="overlay__close"></button>

prev
Happy Paths

next
Physical Prototyping

2018 © Hope Idaewor


text:
set -eux

echo "Download Mirrorlist and rank them..."
reflector --latest 20 --protocol https --ipv4 --ipv6 --country de,be,fr,nl --connection-timeout 1 --sort rate > /tmp/mirrorlist
echo "Backup old mirrorlist"
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
echo "Set new mirrorlist"
sudo mv /tmp/mirrorlist /etc/pacman.d/mirrorlist

echo "Download Updates with new Mirrorlist"
sudo pacman -Syy --asdeps --needed --noconfirm archlinux-keyring
sudo pacman -Syuw --noconfirm


text:
Angular seed app: v

$location.path() = {{$location.path()}}

$route.current.templateUrl = {{$route.current.templateUrl}}

$route.current.params = {{$route.current.params}}

$route.current.scope.name = {{$route.current.scope.name}}

$routeParams = {{$routeParams}}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>The IM List</title>
		<link>http://bvs.wikidot.com/forum/t-184304/the-im-list</link>
		<description>Posts in the discussion thread "The IM List" - Update</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 10 Jul 2022 04:19:45 +0000</lastBuildDate>

					<item>
				<guid>http://bvs.wikidot.com/forum/t-184304#post-591866</guid>
				<title>The IM List</title>
				<link>http://bvs.wikidot.com/forum/t-184304/the-im-list#post-591866</link>
				<description></description>
				<pubDate>Wed, 23 Sep 2009 23:45:24 +0000</pubDate>
				<wikidot:authorName>Omnifox</wikidot:authorName>				<wikidot:authorUserId>83749</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

McMasters posted an accurate list of completers of the IM on the forums. Shouldn't someone fix the list here on the wiki?

Its not just off by a couple tings, its off bad with people and order etc.

Just a suggestion.

				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>


text:
package com.alibaba.dubbo.governance.web.common.pulltool;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.service.pull.ToolFactory;
import com.alibaba.dubbo.governance.biz.common.i18n.MessageResourceService;

/**
 * PullTool for accessing message bundle.
 *
 * @author gerry
 */
public class I18nMessageTool implements ToolFactory {

    @Autowired
    private MessageResourceService messageResourceService;

    public Object createTool() throws Exception {
        return messageResourceService;
    }

    private boolean singleton = true; //应该是global范围的对象!!

    public void setSingleton(boolean singleton) {
        this.singleton = singleton;
    }

    public boolean isSingleton() {
        return this.singleton;
    }

}


text:
#include "internal.h"

/*
 *----------------------------------------------------------------------
 *
 * Tcl_BreakCmd --
 *
 *	This procedure is invoked to process the "break" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_BreakCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    if (argc != 1) {
	Tcl_AppendResult(interp, "wrong # args: should be \"",
		argv[0], "\"", 0);
	return TCL_ERROR;
    }
    return TCL_BREAK;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_CaseCmd --
 *
 *	This procedure is invoked to process the "case" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_CaseCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    int i, result;
    int body;
    unsigned char *string;
    int caseArgc, splitArgs;
    unsigned char **caseArgv;

    if (argc < 3) {
	Tcl_AppendResult(interp, "wrong # args: should be \"",
		argv[0], " string ?in? patList body ... ?default body?\"", 0);
	return TCL_ERROR;
    }
    string = argv[1];
    body = -1;
    if (strcmp(argv[2], (unsigned char*) "in") == 0) {
	i = 3;
    } else {
	i = 2;
    }
    caseArgc = argc - i;
    caseArgv = argv + i;

    /*
     * If all of the pattern/command pairs are lumped into a single
     * argument, split them out again.
     */

    splitArgs = 0;
    if (caseArgc == 1) {
	result = Tcl_SplitList(interp, caseArgv[0], &caseArgc, &caseArgv);
	if (result != TCL_OK) {
	    return result;
	}
	splitArgs = 1;
    }

    for (i = 0; i < caseArgc; i += 2) {
	int patArgc, j;
	unsigned char **patArgv;
	register unsigned char *p;

	if (i == (caseArgc-1)) {
	    interp->result = (unsigned char*) "extra case pattern with no body";
	    result = TCL_ERROR;
	    goto cleanup;
	}

	/*
	 * Check for special case of single pattern (no list) with
	 * no backslash sequences.
	 */

	for (p = caseArgv[i]; *p != 0; p++) {
	    if (isspace(*p) || (*p == '\\')) {
		break;
	    }
	}
	if (*p == 0) {
	    if ((*caseArgv[i] == 'd')
		    && (strcmp(caseArgv[i], (unsigned char*) "default") == 0)) {
		body = i+1;
	    }
	    if (Tcl_StringMatch(string, caseArgv[i])) {
		body = i+1;
		goto match;
	    }
	    continue;
	}

	/*
	 * Break up pattern lists, then check each of the patterns
	 * in the list.
	 */

	result = Tcl_SplitList(interp, caseArgv[i], &patArgc, &patArgv);
	if (result != TCL_OK) {
	    goto cleanup;
	}
	for (j = 0; j < patArgc; j++) {
	    if (Tcl_StringMatch(string, patArgv[j])) {
		body = i+1;
		break;
	    }
	}
	free (patArgv);
	if (j < patArgc) {
	    break;
	}
    }

    match:
    if (body != -1) {
	result = Tcl_Eval(interp, caseArgv[body], 0, 0);
	if (result == TCL_ERROR) {
	    unsigned char msg[100];
	    sprintf(msg, "\n    (\"%.50s\" arm line %d)", caseArgv[body-1],
		    interp->errorLine);
	    Tcl_AddErrorInfo(interp, msg);
	}
	goto cleanup;
    }

    /*
     * Nothing matched:  return nothing.
     */

    result = TCL_OK;

    cleanup:
    if (splitArgs) {
	free (caseArgv);
    }
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_CatchCmd --
 *
 *	This procedure is invoked to process the "catch" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_CatchCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    int result;

    if ((argc != 2) && (argc != 3)) {
	Tcl_AppendResult(interp, "wrong # args: should be \"",
		argv[0], " command ?varName?\"", 0);
	return TCL_ERROR;
    }
    result = Tcl_Eval(interp, argv[1], 0, 0);
    if (argc == 3) {
	if (Tcl_SetVar(interp, argv[2], interp->result, 0) == 0) {
	    Tcl_SetResult(interp, (unsigned char*) "couldn't save command result in variable",
		    TCL_STATIC);
	    return TCL_ERROR;
	}
    }
    Tcl_ResetResult(interp);
    sprintf(interp->result, "%d", result);
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ConcatCmd --
 *
 *	This procedure is invoked to process the "concat" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ConcatCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    if (argc == 1) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" arg ?arg ...?\"", 0);
	return TCL_ERROR;
    }

    interp->result = Tcl_Concat (argc-1, argv+1);
    interp->freeProc = (Tcl_FreeProc *) free;
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ContinueCmd --
 *
 *	This procedure is invoked to process the "continue" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ContinueCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    if (argc != 1) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		"\"", 0);
	return TCL_ERROR;
    }
    return TCL_CONTINUE;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ErrorCmd --
 *
 *	This procedure is invoked to process the "error" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ErrorCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    Interp *iPtr = (Interp *) interp;

    if ((argc < 2) || (argc > 4)) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" message ?errorInfo? ?errorCode?\"", 0);
	return TCL_ERROR;
    }
    if ((argc >= 3) && (argv[2][0] != 0)) {
	Tcl_AddErrorInfo(interp, argv[2]);
	iPtr->flags |= ERR_ALREADY_LOGGED;
    }
    if (argc == 4) {
	Tcl_SetVar2(interp, (unsigned char*) "errorCode", 0, argv[3],
		TCL_GLOBAL_ONLY);
	iPtr->flags |= ERROR_CODE_SET;
    }
    Tcl_SetResult(interp, argv[1], TCL_VOLATILE);
    return TCL_ERROR;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_EvalCmd --
 *
 *	This procedure is invoked to process the "eval" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_EvalCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    int result;
    unsigned char *cmd;

    if (argc < 2) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" arg ?arg ...?\"", 0);
	return TCL_ERROR;
    }
    if (argc == 2) {
	result = Tcl_Eval(interp, argv[1], 0, 0);
    } else {

	/*
	 * More than one argument:  concatenate them together with spaces
	 * between, then evaluate the result.
	 */

	cmd = Tcl_Concat (argc-1, argv+1);
	result = Tcl_Eval(interp, cmd, 0, 0);
	free(cmd);
    }
    if (result == TCL_ERROR) {
	unsigned char msg[60];
	sprintf(msg, "\n    (\"eval\" body line %d)", interp->errorLine);
	Tcl_AddErrorInfo(interp, msg);
    }
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ExprCmd --
 *
 *	This procedure is invoked to process the "expr" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ExprCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    if (argc != 2) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" expression\"", 0);
	return TCL_ERROR;
    }

    return Tcl_ExprString(interp, argv[1]);
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ForCmd --
 *
 *	This procedure is invoked to process the "for" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ForCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    int result, value;

    if (argc != 5) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" start test next command\"", 0);
	return TCL_ERROR;
    }

    result = Tcl_Eval(interp, argv[1], 0, 0);
    if (result != TCL_OK) {
	if (result == TCL_ERROR) {
	    Tcl_AddErrorInfo(interp, (unsigned char*) "\n    (\"for\" initial command)");
	}
	return result;
    }
    while (1) {
	result = Tcl_ExprBoolean(interp, argv[2], &value);
	if (result != TCL_OK) {
	    return result;
	}
	if (!value) {
	    break;
	}
	result = Tcl_Eval(interp, argv[4], 0, 0);
	if (result == TCL_CONTINUE) {
	    result = TCL_OK;
	} else if (result != TCL_OK) {
	    if (result == TCL_ERROR) {
		unsigned char msg[60];
		sprintf(msg, "\n    (\"for\" body line %d)", interp->errorLine);
		Tcl_AddErrorInfo(interp, msg);
	    }
	    break;
	}
	result = Tcl_Eval(interp, argv[3], 0, 0);
	if (result == TCL_BREAK) {
	    break;
	} else if (result != TCL_OK) {
	    if (result == TCL_ERROR) {
		Tcl_AddErrorInfo(interp, (unsigned char*) "\n    (\"for\" loop-end command)");
	    }
	    return result;
	}
    }
    if (result == TCL_BREAK) {
	result = TCL_OK;
    }
    if (result == TCL_OK) {
	Tcl_ResetResult(interp);
    }
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_ForeachCmd --
 *
 *	This procedure is invoked to process the "foreach" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_ForeachCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    int listArgc, i, result;
    unsigned char **listArgv;

    if (argc != 4) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" varName list command\"", 0);
	return TCL_ERROR;
    }

    /*
     * Break the list up into elements, and execute the command once
     * for each value of the element.
     */

    result = Tcl_SplitList(interp, argv[2], &listArgc, &listArgv);
    if (result != TCL_OK) {
	return result;
    }
    for (i = 0; i < listArgc; i++) {
	if (Tcl_SetVar(interp, argv[1], listArgv[i], 0) == 0) {
	    Tcl_SetResult(interp, (unsigned char*) "couldn't set loop variable", TCL_STATIC);
	    result = TCL_ERROR;
	    break;
	}

	result = Tcl_Eval(interp, argv[3], 0, 0);
	if (result != TCL_OK) {
	    if (result == TCL_CONTINUE) {
		result = TCL_OK;
	    } else if (result == TCL_BREAK) {
		result = TCL_OK;
		break;
	    } else if (result == TCL_ERROR) {
		unsigned char msg[100];
		sprintf(msg, "\n    (\"foreach\" body line %d)",
			interp->errorLine);
		Tcl_AddErrorInfo(interp, msg);
		break;
	    } else {
		break;
	    }
	}
    }
    free (listArgv);
    if (result == TCL_OK) {
	Tcl_ResetResult(interp);
    }
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_FormatCmd --
 *
 *	This procedure is invoked to process the "format" Tcl command.
 *	See the user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

	/* ARGSUSED */
int
Tcl_FormatCmd(dummy, interp, argc, argv)
    void *dummy;			/* Not used. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int argc;				/* Number of arguments. */
    unsigned char **argv;		/* Argument strings. */
{
    register unsigned char *format; /* Used to read characters from the format
				 * string. */
    unsigned char newFormat[40]; /* A new format specifier is generated here. */
    int width;			/* Field width from field specifier, or 0 if
				 * no width given. */
    int precision;		/* Field precision from field specifier, or 0
				 * if no precision given. */
    int size;			/* Number of bytes needed for result of
				 * conversion, based on type of conversion
				 * ("e", "s", etc.) and width from above. */
    unsigned char *oneWordValue = 0; /* Used to hold value to pass to sprintf, if
				 * it's a one-word value. */
    unsigned char *dst = interp->result; /* Where result is stored.  Starts off at
				 * interp->resultSpace, but may get dynamically
				 * re-allocated if this isn't enough. */
    int dstSize = 0;		/* Number of non-null characters currently
				 * stored at dst. */
    int dstSpace = TCL_RESULT_SIZE;
				/* Total amount of storage space available
				 * in dst (not including null terminator. */
    int noPercent;		/* Special case for speed:  indicates there's
				 * no field specifier, just a string to copy. */
    unsigned char **curArg;	/* Remainder of argv array. */
    int useShort;		/* Value to be printed is short (half word). */

    /*
     * This procedure is a bit nasty.  The goal is to use sprintf to
     * do most of the dirty work.  There are several problems:
     * 1. this procedure can't trust its arguments.
     * 2. we must be able to provide a large enough result area to hold
     *    whatever's generated.  This is hard to estimate.
     * 2. there's no way to move the arguments from argv to the call
     *    to sprintf in a reasonable way.  This is particularly nasty
     *    because some of the arguments may be two-word values (doubles).
     * So, what happens here is to scan the format string one % group
     * at a time, making many individual calls to sprintf.
     */

    if (argc < 2) {
	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" formatString ?arg arg ...?\"", 0);
	return TCL_ERROR;
    }
    curArg = argv+2;
    argc -= 2;
    for (format = argv[1]; *format != 0; ) {
	register unsigned char *newPtr = newFormat;

	width = precision = noPercent = useShort = 0;

	/*
	 * Get rid of any characters before the next field specifier.
	 * Collapse backslash sequences found along the way.
	 */

	if (*format != '%') {
	    register unsigned char *p;
	    int bsSize;

	    oneWordValue = p = format;
	    while ((*format != '%') && (*format != 0)) {
		if (*format == '\\') {
		    *p = Tcl_Backslash(format, &bsSize);
		    if (*p != 0) {
			p++;
		    }
		    format += bsSize;
		} else {
		    *p = *format;
		    p++;
		    format++;
		}
	    }
	    size = p - oneWordValue;
	    noPercent = 1;
	    goto doField;
	}

	if (format[1] == '%') {
	    oneWordValue = format;
	    size = 1;
	    noPercent = 1;
	    format += 2;
	    goto doField;
	}

	/*
	 * Parse off a field specifier, compute how many characters
	 * will be needed to store the result, and substitute for
	 * "*" size specifiers.
	 */

	*newPtr = '%';
	newPtr++;
	format++;
	while ((*format == '-') || (*format == '#') || (*format == '0')
		|| (*format == ' ') || (*format == '+')) {
	    *newPtr = *format;
	    newPtr++;
	    format++;
	}
	if (isdigit(*format)) {
	    width = atoi(format);
	    do {
		format++;
	    } while (isdigit(*format));
	} else if (*format == '*') {
	    if (argc <= 0) {
		goto notEnoughArgs;
	    }
	    if (Tcl_GetInt(interp, *curArg, &width) != TCL_OK) {
		goto fmtError;
	    }
	    argc--;
	    curArg++;
	    format++;
	}
	if (width != 0) {
	    sprintf(newPtr, "%d", width);
	    while (*newPtr != 0) {
		newPtr++;
	    }
	}
	if (*format == '.') {
	    *newPtr = '.';
	    newPtr++;
	    format++;
	}
	if (isdigit(*format)) {
	    precision = atoi(format);
	    do {
		format++;
	    } while (isdigit(*format));
	} else if (*format == '*') {
	    if (argc <= 0) {
		goto notEnoughArgs;
	    }
	    if (Tcl_GetInt(interp, *curArg, &precision) != TCL_OK) {
		goto fmtError;
	    }
	    argc--;
	    curArg++;
	    format++;
	}
	if (precision != 0) {
	    sprintf(newPtr, "%d", precision);
	    while (*newPtr != 0) {
		newPtr++;
	    }
	}
	if (*format == 'l') {
	    format++;
	} else if (*format == 'h') {
	    useShort = 1;
	    *newPtr = 'h';
	    newPtr++;
	    format++;
	}
	*newPtr = *format;
	newPtr++;
	*newPtr = 0;
	if (argc <= 0) {
	    goto notEnoughArgs;
	}
	switch (*format) {
	    case 'D':
	    case 'O':
	    case 'U':
		if (!useShort) {
		    newPtr++;
		} else {
		    useShort = 0;
		}
		newPtr[-1] = tolower(*format);
		newPtr[-2] = 'l';
		*newPtr = 0;
	    case 'd':
	    case 'o':
	    case 'u':
	    case 'x':
	    case 'X':
		if (Tcl_GetInt(interp, *curArg, (void*) &oneWordValue)
			!= TCL_OK) {
		    goto fmtError;
		}
		size = 40;
		break;
	    case 's':
		oneWordValue = *curArg;
		size = strlen(*curArg);
		break;
	    case 'c':
		if (Tcl_GetInt(interp, *curArg, (void*) &oneWordValue)
			!= TCL_OK) {
		    goto fmtError;
		}
		size = 1;
		break;
	    case 0:
		interp->result = (unsigned char*)
			"format string ended in middle of field specifier";
		goto fmtError;
	    default:
		sprintf(interp->result,
			"bad field specifier \"%c\"", *format);
		goto fmtError;
	}
	argc--;
	curArg++;
	format++;

	/*
	 * Make sure that there's enough space to hold the formatted
	 * result, then format it.
	 */

	doField:
	if (width > size) {
	    size = width;
	}
	if ((dstSize + size) > dstSpace) {
	    unsigned char *newDst;
	    int newSpace;

	    newSpace = 2*(dstSize + size);
	    newDst = malloc ((unsigned) newSpace+1);
	    if (dstSize != 0) {
		memcpy ((void*) newDst, (void*) dst, dstSize);
	    }
	    if (dstSpace != TCL_RESULT_SIZE) {
		free (dst);
	    }
	    dst = newDst;
	    dstSpace = newSpace;
	}
	if (noPercent) {
	    memcpy ((void*) (dst+dstSize), (void*) oneWordValue, size);
	    dstSize += size;
	    dst[dstSize] = 0;
	} else {
	    if (useShort) {
		/*
		 * The double cast below is needed for a few machines
		 * (e.g. Pyramids as of 1/93) that don't like casts
		 * directly from pointers to shorts.
		 */
		sprintf(dst+dstSize, (char*) newFormat, (short) (int) oneWordValue);
	    } else {
		sprintf(dst+dstSize, (char*) newFormat, oneWordValue);
	    }
	    dstSize += strlen(dst+dstSize);
	}
    }

    interp->result = dst;
    if (dstSpace != TCL_RESULT_SIZE) {
	interp->freeProc = (Tcl_FreeProc *) free;
    } else {
	interp->freeProc = 0;
    }
    return TCL_OK;

    notEnoughArgs:
    interp->result = (unsigned char*) "not enough arguments for all format specifiers";
    fmtError:
    if (dstSpace != TCL_RESULT_SIZE) {
	free(dst);
    }
    return TCL_ERROR;
}


text:
package jp.gr.java_conf.dyama.rink.common;

public interface IDConverter {
    /** the reserved ID for undefined string and null. */
    public static final int UNDEFINED      = 0;

    /** the reserved ID for BOS */
    public static final int BOS            = 1;

    /** the reserved ID for EOS */
    public static final int EOS            = 2;

    /** the reserved ID for EOS */
    public static final int NONE           = 3;

    /** the starting ID for normal strings */
    static final int START                 = 10;

    /**
     * Converts the string into the positive unique ID
     * @param string  the target string.
     * @return ID. return 0 if string is null.
     */
    public int convert(String string);
}


text:
package com.api;

import com.app.annotation.apt.ApiFactory;
import com.base.entity.CreatedResult;
import com.base.entity.DataArr;
import com.base.entity.Face;
import com.model.Image;
import com.model.Comment;
import com.model.CommentInfo;
import com.model.ImageInfo;
import com.model.Message;
import com.model.MessageInfo;
import com.model._User;

import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by Administrator on 2016/3/23.
 */
@ApiFactory
public interface ApiService {
    @GET("login")
    Observable<_User> login(@Query("username") String username, @Query("password") String password);

    @POST("users")
    Observable<CreatedResult> createUser(@Body _User user);

    @GET("users")
    Observable<DataArr<_User>> getAllUser(@Query("skip") int skip, @Query("limit") int limit);

    @GET("classes/Image")
    Observable<DataArr<ImageInfo>> getAllImages(@Query("where") String where, @Query("skip") int skip, @Query("limit") int limit, @Query("order") String order);

    @POST("classes/Image")
    Observable<CreatedResult> createArticle(@Body Image mArticle);

    @GET("classes/Comment")
    Observable<DataArr<CommentInfo>> getCommentList(@Query("include") String include, @Query("where") String where, @Query("skip") int skip, @Query("limit") int limit);

    @POST("classes/Comment")
    Observable<CreatedResult> createComment(@Body Comment mComment);

    @Headers("Content-Type: image/png")
    @POST("files/{name}")
    Observable<CreatedResult> upFile(@Path("name") String name, @Body RequestBody body);

    @PUT("users/{uid}")
    Observable<CreatedResult> upUser(@Header("X-LC-Session") String session, @Path("uid") String uid, @Body Face face);

    @POST("classes/Message")
    Observable<CreatedResult> createMessage(@Body Message mComment);

    @GET("classes/Message")
    Observable<DataArr<MessageInfo>> getMessageList(@Query("include") String include, @Query("where") String where, @Query("skip") int skip, @Query("limit") int limit, @Query("order") String order);

}


text:
local View = torch.class("dp.View")
View.isView = true

function View:__init()
   -- caches
   self._tensors = {}
   self._warn = false
end

local function getType(arg)
   local arg_type = torch.type(arg)
   if arg_type == 'table' then
      return getType(arg[1])
   end
   return arg_type
end

-- view is a string or a table of strings
function View:forward(view, inputORtype)
   view = view or 'default'
   local arg_type = getType(inputORtype)
   if arg_type == 'string' or arg_type == 'nil' then
      return self:forwardGet(view, inputORtype)
   end
   return self:forwardPut(view, inputORtype)
end

-- This method should be called by a maximum of one input Model.
-- It is assumed that any input Tensor to forward is represented as
-- the most expanded size of the orignal data. For example, an image
-- batch would be forwarded with its 4 dimensions, and never with
-- collapses dimensions (2D).
function View:forwardPut(view, input)
   error"Not Implemented"
end

-- This method could be called from multiple output Models
function View:forwardGet(view, tensor_type)
   error"Not Implemented"
end

-- view is a string or a table of strings
function View:backward(view, gradOutputORtype)
   local arg_type = getType(gradOutputORtype)
   if arg_type == 'string' or arg_type == 'nil' then
      return self:backwardGet(view, gradOutputORtype)
   end
   return self:backwardPut(view, gradOutputORtype)
end

-- This method could be called from multiple output Models
function View:backwardPut(view, gradOutput)
   error"Not Implemented"
end

-- This method should be called by a maximum of one input Model.
-- In the case of multiple output models having called backwardPut,
-- the different gradInputs must be accumulated (sum grads).
function View:backwardGet(view, tensor_type)
   error"Not Implemented"
end

function View:findAxis(axis_char, view)
   view = view or self._view
   local axis_pos = view:find(axis_char)
   if not axis_pos then
      error("Provided view '"..view.."' has no axis '"..axis_char.."'", 2)
   end
   return axis_pos
end

-- Returns number of samples
function View:nSample()
   error"Not Implemented"
end

-- Returns a subet of data.
-- If v is provided, copy indexed elements into its existing memory.
-- However, use the metadata found in self.
-- Providing v is faster (no memory allocation).
function View:index(v, indices)
   error"Not Implemented"
end

function View:sub(v, start, stop)
   error"Not Implemented"
end

-- return iterator over component Views
function View:pairs()
   error"Not Implemented"
end

-- return current view of data
function View:default()
   error"Not Implemented"
end

-- Changes the internal type of the data.
-- different behavior than torch.Tensor:type() (torch returns a tensor
-- with new type and keeps old)
function View:type(type)
   error"Not Implemented"
end

function View:float()
   return self:type('torch.FloatTensor')
end

function View:double()
   return self:type('torch.DoubleTensor')
end

function View:cuda()
   return self:type('torch.CudaTensor')
end

function View:toModule()
   error"Not Implemented"
end

function View:view()
   return self._view or ''
end

function View:flush()
   error"Not Implemented"
end

---- static methods ----
--returns true if all indices in obj_table are instances of View
--else return false and index of first non-element
function View.areInstances(obj_table)
   local map = _.values(
      _.map(obj_table,
         function(key, obj)
            return torch.isTypeOf(obj, 'dp.View')
         end
      )
   )
   return _.all(map, function(k,v) return v; end), _.indexOf(map, false)
end

function View.assertInstances(obj_table)
   local areInstances, index = View.areInstances(obj_table)
   index = index or 0
   assert(areInstances, "Error : object at index " .. index ..
      " is of wrong type. Expecting type dp.View.")
end


text:
var config = require('config')
var page = require('page')
var view = require('view')

var Nav = module.exports = view(require('./template.html'), function (view, model) {
  model.on('change', function () {
    model.emit('change isAdmin', model.isAdmin())
    model.emit('change isLoggedIn', model.isLoggedIn())
    model.emit('change isManager', model.isManager())
  })
})

Nav.prototype.application = function () {
  return config.application()
}

Nav.prototype.logout = function () {
  this.model.logout(function () {
    page('/manager')
  })
}


text:
package org.coursera.naptime.ari.graphql.schema

import com.linkedin.data.DataMap
import org.coursera.naptime.ResourceName
import org.coursera.naptime.ari.graphql.SangriaGraphQlContext
import org.coursera.naptime.ari.graphql.SangriaGraphQlSchemaBuilder
import org.coursera.naptime.schema.Handler
import org.coursera.naptime.schema.HandlerKind
import org.coursera.naptime.schema.RelationType
import org.coursera.naptime.schema.Resource
import org.coursera.naptime.schema.ReverseRelationAnnotation
import sangria.schema.Context
import sangria.schema.Field
import sangria.schema.ListType
import sangria.schema.ObjectType
import sangria.schema.Value

import scala.collection.JavaConverters._

object NaptimePaginatedResourceField {

  val COMPLEXITY_COST = 10.0D

  sealed trait FieldRelation

  case class ForwardRelation(resourceName: String) extends FieldRelation
  case class ReverseRelation(annotation: ReverseRelationAnnotation) extends FieldRelation

  def build(
      schemaMetadata: SchemaMetadata,
      resourceName: String,
      fieldName: String,
      handlerOverride: Option[Handler] = None,
      fieldRelation: Option[FieldRelation]): Option[Field[SangriaGraphQlContext, DataMap]] = {

    (for {
      resource <- schemaMetadata.getResourceOpt(resourceName)
      schema <- schemaMetadata.getSchema(resource)
    } yield {
      val handlerOpt = (handlerOverride, fieldRelation) match {
        case (Some(handler), _) =>
          Some(handler)
        case (None, Some(ForwardRelation(_))) =>
          resource.handlers.find(_.kind == HandlerKind.MULTI_GET)
        case (None, Some(ReverseRelation(annotation))) =>
          annotation.relationType match {
            case RelationType.FINDER =>
              val finderName = annotation.arguments.get("q").getOrElse {throw new IllegalStateException("Finder reverse relation on " +
                  s"${annotation.resourceName} does not have a q parameter specified")
              }
              resource.handlers.find(_.name == finderName)

            case RelationType.MULTI_GET =>
              resource.handlers.find(_.kind == HandlerKind.MULTI_GET)

            case RelationType.GET | RelationType.SINGLE_ELEMENT_FINDER | RelationType.$UNKNOWN =>
              None
          }
        case _ =>
          resource.handlers.find(_.kind == HandlerKind.MULTI_GET)
      }

      handlerOpt.map { handler =>

        val reverseRelationSpecifiedArguments = fieldRelation match {
          case Some(ReverseRelation(annotation)) => annotation.arguments.keySet
          case _ => Set[String]()
        }

        val arguments = SangriaGraphQlSchemaBuilder
          .generateHandlerArguments(handler, includePagination = true)
          .filterNot(_.name == "ids")
          .filterNot(arg => reverseRelationSpecifiedArguments.contains(arg.name))
        Field.apply[SangriaGraphQlContext, DataMap, Any, Any](
          name = fieldName,
          fieldType = getType(schemaMetadata, resourceName, fieldName),
          resolve = context => ParentContext(context),
          complexity = Some(
            (ctx, args, childScore) => {
              // API calls should count 10x, and we take limit into account because there could be
              // N child API calls for each response here
              val limit = args.arg(NaptimePaginationField.limitArgument)
              Math.max(limit / 10, 1) * COMPLEXITY_COST * childScore
            }),
          arguments = arguments)
      }
    }).flatten
  }

  //TODO(bryan): add arguments for pagination in here
  private[this] def getType(
      schemaMetadata: SchemaMetadata,
      resourceName: String,
      fieldName: String): ObjectType[SangriaGraphQlContext, ParentContext] = {

    val resource = schemaMetadata.getResourceOpt(resourceName).getOrElse {
      throw SchemaGenerationException(s"Cannot find schema for $resourceName")
    }
    schemaMetadata.getSchema(resource).getOrElse {
      throw SchemaGenerationException(s"Cannot find schema for $resourceName")
    }

    ObjectType[SangriaGraphQlContext, ParentContext](
      name = formatPaginatedResourceName(resource),
      fieldsFn = () => {
        val elementType = NaptimeResourceField.getType(schemaMetadata, resourceName)
        val listType = ListType(elementType)
        List(
          Field.apply[SangriaGraphQlContext, ParentContext, Any, Any](
            name = "elements",
            fieldType = listType,
            resolve = getResolver(resourceName, fieldName)),
          Field.apply[SangriaGraphQlContext, ParentContext, Any, Any](
            name = "paging",
            fieldType = NaptimePaginationField.getField(resourceName, fieldName),
            resolve = context => context.value
          ))
      })
  }

  private[this] def getResolver(
      resourceName: String,
      fieldName: String): Context[SangriaGraphQlContext, ParentContext] => Value[SangriaGraphQlContext, Any] = {
    (context: Context[SangriaGraphQlContext, ParentContext]) => {

      val parsedResourceName = ResourceName.parse(resourceName).getOrElse {
        throw SchemaExecutionException(s"Cannot parse resource name from $resourceName")
      }
      val connection = context.ctx.response.data.get(parsedResourceName).map { objects =>
        val ids = if (context.value.parentContext.value.isEmpty) {
          // Top-Level Request
          context.ctx.response.topLevelResponses.find { case (topLevelRequest, _) =>
            topLevelRequest.resource.identifier == resourceName &&
              topLevelRequest.selection.alias ==
                context.value.parentContext.astFields.headOption.flatMap(_.alias) &&
              context.value.parentContext.astFields.headOption.map(_.name)
                .contains(topLevelRequest.selection.name)
          }.flatMap(r => Option(r._2.ids).map(_.asScala)).getOrElse(List.empty)
        } else {
          Option(context.value.parentContext.value).map { parentElement =>
            // Nested Request
            val alias = context.value.parentContext.astFields.headOption.flatMap(_.alias)
            val aliasedFieldName = alias.getOrElse(fieldName)
            val allIds = Option(parentElement.getDataList(aliasedFieldName))
              .map(_.asScala)
              .getOrElse(List.empty)
            val startOption = context.value.parentContext.arg(NaptimePaginationField.startArgument)
            val limit = context.value.parentContext.arg(NaptimePaginationField.limitArgument)
            val idsWithStart = startOption
              .map(s => allIds.dropWhile(_.toString != s))
              .getOrElse(allIds)
            idsWithStart.take(limit)
          }.getOrElse(List.empty)
        }
        objects.collect {
          case (id, element) if ids.contains(id) => element
        }.toSeq
      }.getOrElse(List.empty)

      Value[SangriaGraphQlContext, Any](connection)
    }
  }

  /**
    * Converts a resource name to a GraphQL compatible name. (i.e. 'courses.v1' to 'CoursesV1')
    *
    * @param resource Naptime resource
    * @return GraphQL-safe resource name
    */
  private[this] def formatPaginatedResourceName(resource: Resource): String = {
    s"${resource.name.capitalize}V${resource.version.getOrElse(0)}Connection"
  }

}


text:
.class Landroid/os/ParcelFileDescriptor$Status;
.super Ljava/lang/Object;
.source "ParcelFileDescriptor.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/os/ParcelFileDescriptor;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "Status"
.end annotation

# static fields
.field public static final DEAD:I = -0x2

.field public static final DETACHED:I = 0x2

.field public static final ERROR:I = 0x1

.field public static final LEAKED:I = 0x3

.field public static final OK:I = 0x0

.field public static final SILENCE:I = -0x1

# instance fields
.field public final msg:Ljava/lang/String;

.field public final status:I

# direct methods
.method public constructor <init>(I)V
    .locals 1
    .param p1, "status"    # I

    .prologue
    .line 1016
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Landroid/os/ParcelFileDescriptor$Status;-><init>(ILjava/lang/String;)V

    .line 1015
    return-void
.end method

.method public constructor <init>(ILjava/lang/String;)V
    .locals 0
    .param p1, "status"    # I
    .param p2, "msg"    # Ljava/lang/String;

    .prologue
    .line 1019
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 1020
    iput p1, p0, Landroid/os/ParcelFileDescriptor$Status;->status:I

    .line 1021
    iput-object p2, p0, Landroid/os/ParcelFileDescriptor$Status;->msg:Ljava/lang/String;

    .line 1019
    return-void
.end method

# virtual methods
.method public asIOException()Ljava/io/IOException;
    .locals 3

    .prologue
    .line 1025
    iget v0, p0, Landroid/os/ParcelFileDescriptor$Status;->status:I

    packed-switch v0, :pswitch_data_0

    .line 1037
    :pswitch_0
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "Unknown status: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget v2, p0, Landroid/os/ParcelFileDescriptor$Status;->status:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    return-object v0

    .line 1027
    :pswitch_1
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "Remote side is dead"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    return-object v0

    .line 1029
    :pswitch_2
    const/4 v0, 0x0

    return-object v0

    .line 1031
    :pswitch_3
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "Remote error: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Landroid/os/ParcelFileDescriptor$Status;->msg:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    return-object v0

    .line 1033
    :pswitch_4
    new-instance v0, Landroid/os/ParcelFileDescriptor$FileDescriptorDetachedException;

    invoke-direct {v0}, Landroid/os/ParcelFileDescriptor$FileDescriptorDetachedException;-><init>()V

    return-object v0

    .line 1035
    :pswitch_5
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "Remote side was leaked"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    return-object v0

    .line 1025
    nop

    :pswitch_data_0
    .packed-switch -0x2
        :pswitch_1
        :pswitch_0
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
    .end packed-switch
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 1043
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v1, "{"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Landroid/os/ParcelFileDescriptor$Status;->status:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string/jumbo v1, ": "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Landroid/os/ParcelFileDescriptor$Status;->msg:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string/jumbo v1, "}"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
angular.module('angular-simple-tree', [])

  .directive("treeTemplate", function () {
    return {
      restrict: 'E',
      scope: {
        nodes: '=',
        action: '&'
      },
      transclude: 'true',
      template: '<tree nodes="nodes"></tree>',
      controller: function () {
        this.transclude = null;
        this.action = null;
      },
      link: {
        pre: function (scope, $element, attrs, ctrl, transclude) {
          ctrl.transclude = transclude;
          ctrl.action = scope.action;
        }
      }
    };
  })

  .directive('tree', function () {
    return {
      restrict: 'EA',
      scope: {
        nodes: '='
      },
      require: '^treeTemplate',
      link: function (scope, $element, attrs, ctrl) {
        scope.action = function (params) {
          ctrl.action({params: params});
        };

        ctrl.transclude(scope, function (clone) {
          $element.append(clone);
        });
      }
    };
  })


text:
package org.apache.zookeeper.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.zookeeper.PortAssignment;
import org.apache.zookeeper.TestableZooKeeper;
import org.apache.zookeeper.server.quorum.Election;
import org.apache.zookeeper.server.quorum.QuorumPeer;
import org.apache.zookeeper.server.util.OSMXBean;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class QuorumBaseOracle_2Nodes extends ClientBase{

    private static final Logger LOG = LoggerFactory.getLogger(QuorumBase.class);

    private static final String LOCALADDR = "127.0.0.1";

    private static final String oraclePath_0 = "./tmp/oraclePath/0/mastership/";
    private static final String oraclePath_1 = "./tmp/oraclePath/1/mastership/";

    private static final String mastership = "value";

    File s1dir, s2dir;
    QuorumPeer s1, s2;
    protected int port1;
    protected int port2;

    protected int portLE1;
    protected int portLE2;

    protected int portClient1;
    protected int portClient2;

    protected boolean localSessionsEnabled = false;
    protected boolean localSessionsUpgradingEnabled = false;

    @BeforeEach
    @Override
    public void setUp() throws Exception {
        LOG.info("QuorumBase.setup {}", getTestName());
        setupTestEnv();

        JMXEnv.setUp();

        setUpAll();

        port1 = PortAssignment.unique();
        port2 = PortAssignment.unique();

        portLE1 = PortAssignment.unique();
        portLE2 = PortAssignment.unique();

        portClient1 = PortAssignment.unique();
        portClient2 = PortAssignment.unique();

        hostPort = "127.0.0.1:"
                + portClient1
                + ",127.0.0.1:"
                + portClient2;
        LOG.info("Ports are: {}", hostPort);

        s1dir = ClientBase.createTmpDir();
        s2dir = ClientBase.createTmpDir();

        startServers();

        OSMXBean osMbean = new OSMXBean();
        if (osMbean.getUnix()) {
            LOG.info("Initial fdcount is: {}", osMbean.getOpenFileDescriptorCount());
        }

        File directory = new File(oraclePath_0);
        directory.mkdirs();
        FileWriter fw = new FileWriter(oraclePath_0 + mastership);
        fw.write("0");
        fw.close();

        directory = new File(oraclePath_1);
        directory.mkdirs();
        fw = new FileWriter(oraclePath_1 + mastership);
        fw.write("1");
        fw.close();

        LOG.info("Setup finished");
    }

    void startServers() throws Exception {
        int tickTime = 2000;
        int initLimit = 3;
        int syncLimit = 3;
        int connectToLearnerMasterLimit = 3;
        Map<Long, QuorumPeer.QuorumServer> peers = new HashMap<Long, QuorumPeer.QuorumServer>();
        peers.put(Long.valueOf(1), new QuorumPeer.QuorumServer(1, new InetSocketAddress(LOCALADDR, port1), new InetSocketAddress(LOCALADDR, portLE1), new InetSocketAddress(LOCALADDR, portClient1), QuorumPeer.LearnerType.PARTICIPANT));
        peers.put(Long.valueOf(2), new QuorumPeer.QuorumServer(2, new InetSocketAddress(LOCALADDR, port2), new InetSocketAddress(LOCALADDR, portLE2), new InetSocketAddress(LOCALADDR, portClient2), QuorumPeer.LearnerType.PARTICIPANT));

        LOG.info("creating QuorumPeer 1 port {}", portClient1);
        s1 = new QuorumPeer(peers, s1dir, s1dir, portClient1, 3, 1, tickTime, initLimit, syncLimit, connectToLearnerMasterLimit, oraclePath_0 + mastership);
        assertEquals(portClient1, s1.getClientPort());
        LOG.info("creating QuorumPeer 2 port {}", portClient2);
        s2 = new QuorumPeer(peers, s2dir, s2dir, portClient2, 3, 2, tickTime, initLimit, syncLimit, connectToLearnerMasterLimit, oraclePath_1 + mastership);
        assertEquals(portClient2, s2.getClientPort());

        LOG.info("QuorumPeer 1 voting view: {}", s1.getVotingView());
        LOG.info("QuorumPeer 2 voting view: {}", s2.getVotingView());

        s1.enableLocalSessions(localSessionsEnabled);
        s2.enableLocalSessions(localSessionsEnabled);
        s1.enableLocalSessionsUpgrading(localSessionsUpgradingEnabled);
        s2.enableLocalSessionsUpgrading(localSessionsUpgradingEnabled);

        LOG.info("start QuorumPeer 1");
        s1.start();
        LOG.info("start QuorumPeer 2");
        s2.start();

        LOG.info("Checking ports {}", hostPort);
        for (String hp : hostPort.split(",")) {
            assertTrue(ClientBase.waitForServerUp(hp, CONNECTION_TIMEOUT), "waiting for server up");
            LOG.info("{} is accepting client connections", hp);
        }

        // interesting to see what's there...
        JMXEnv.dump();
        // make sure we have these 5 servers listed
        Set<String> ensureNames = new LinkedHashSet<String>();
        for (int i = 1; i <= 2; i++) {
            ensureNames.add("InMemoryDataTree");
        }
        for (int i = 1; i <= 2; i++) {
            ensureNames.add("name0=ReplicatedServer_id" + i + ",name1=replica." + i + ",name2=");
        }
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                ensureNames.add("name0=ReplicatedServer_id" + i + ",name1=replica." + j);
            }
        }
        for (int i = 1; i <= 2; i++) {
            ensureNames.add("name0=ReplicatedServer_id" + i);
        }
        JMXEnv.ensureAll(ensureNames.toArray(new String[ensureNames.size()]));
    }

    public int getLeaderIndex() {
        if (s1.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return 0;
        } else if (s2.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return 1;
        }
        return -1;
    }

    public int getLeaderClientPort() {
        if (s1.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return portClient1;
        } else if (s2.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return portClient2;
        }
        return -1;
    }

    public QuorumPeer getLeaderQuorumPeer() {
        if (s1.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return s1;
        } else if (s2.getPeerState() == QuorumPeer.ServerState.LEADING) {
            return s2;
        }
        return null;
    }

    public QuorumPeer getFirstObserver() {
        if (s1.getLearnerType() == QuorumPeer.LearnerType.OBSERVER) {
            return s1;
        } else if (s2.getLearnerType() == QuorumPeer.LearnerType.OBSERVER) {
            return s2;
        }
        return null;
    }

    public int getFirstObserverClientPort() {
        if (s1.getLearnerType() == QuorumPeer.LearnerType.OBSERVER) {
            return portClient1;
        } else if (s2.getLearnerType() == QuorumPeer.LearnerType.OBSERVER) {
            return portClient2;
        }
        return -1;
    }

    public String getPeersMatching(QuorumPeer.ServerState state) {
        StringBuilder hosts = new StringBuilder();
        for (QuorumPeer p : getPeerList()) {
            if (p.getPeerState() == state) {
                hosts.append(String.format("%s:%d,", LOCALADDR, p.getClientAddress().getPort()));
            }
        }
        LOG.info("getPeersMatching ports are {}", hosts);
        return hosts.toString();
    }

    public ArrayList<QuorumPeer> getPeerList() {
        ArrayList<QuorumPeer> peers = new ArrayList<QuorumPeer>();
        peers.add(s1);
        peers.add(s2);
        return peers;
    }

    public QuorumPeer getPeerByClientPort(int clientPort) {
        for (QuorumPeer p : getPeerList()) {
            if (p.getClientAddress().getPort() == clientPort) {
                return p;
            }
        }
        return null;
    }

    public void setupServers() throws IOException {
        setupServer(1);
        setupServer(2);
    }

    Map<Long, QuorumPeer.QuorumServer> peers = null;

    public void setupServer(int i) throws IOException {
        int tickTime = 2000;
        int initLimit = 3;
        int syncLimit = 3;
        int connectToLearnerMasterLimit = 3;

        if (peers == null) {
            peers = new HashMap<Long, QuorumPeer.QuorumServer>();

            peers.put(Long.valueOf(1), new QuorumPeer.QuorumServer(1, new InetSocketAddress(LOCALADDR, port1), new InetSocketAddress(LOCALADDR, portLE1), new InetSocketAddress(LOCALADDR, portClient1), QuorumPeer.LearnerType.PARTICIPANT));
            peers.put(Long.valueOf(2), new QuorumPeer.QuorumServer(2, new InetSocketAddress(LOCALADDR, port2), new InetSocketAddress(LOCALADDR, portLE2), new InetSocketAddress(LOCALADDR, portClient2), QuorumPeer.LearnerType.PARTICIPANT));
        }

        switch (i) {
            case 1:
                LOG.info("creating QuorumPeer 1 port {}", portClient1);
                s1 = new QuorumPeer(peers, s1dir, s1dir, portClient1, 3, 1, tickTime, initLimit, syncLimit, connectToLearnerMasterLimit);
                assertEquals(portClient1, s1.getClientPort());
                break;
            case 2:
                LOG.info("creating QuorumPeer 2 port {}", portClient2);
                s2 = new QuorumPeer(peers, s2dir, s2dir, portClient2, 3, 2, tickTime, initLimit, syncLimit, connectToLearnerMasterLimit);
                assertEquals(portClient2, s2.getClientPort());
                break;
        }
    }

    @AfterEach
    @Override
    public void tearDown() throws Exception {
        LOG.info("TearDown started");

        OSMXBean osMbean = new OSMXBean();
        if (osMbean.getUnix()) {
            LOG.info("fdcount after test is: {}", osMbean.getOpenFileDescriptorCount());
        }

        shutdownServers();

        for (String hp : hostPort.split(",")) {
            assertTrue(ClientBase.waitForServerDown(hp, ClientBase.CONNECTION_TIMEOUT), "waiting for server down");
            LOG.info("{} is no longer accepting client connections", hp);
        }

        JMXEnv.tearDown();
    }
    public void shutdownServers() {
        shutdown(s1);
        shutdown(s2);
    }

    public static void shutdown(QuorumPeer qp) {
        if (qp == null) {
            return;
        }
        try {
            LOG.info("Shutting down quorum peer {}", qp.getName());
            qp.shutdown();
            Election e = qp.getElectionAlg();
            if (e != null) {
                LOG.info("Shutting down leader election {}", qp.getName());
                e.shutdown();
            } else {
                LOG.info("No election available to shutdown {}", qp.getName());
            }
            LOG.info("Waiting for {} to exit thread", qp.getName());
            long readTimeout = qp.getTickTime() * qp.getInitLimit();
            long connectTimeout = qp.getTickTime() * qp.getSyncLimit();
            long maxTimeout = Math.max(readTimeout, connectTimeout);
            maxTimeout = Math.max(maxTimeout, ClientBase.CONNECTION_TIMEOUT);
            qp.join(maxTimeout * 2);
            if (qp.isAlive()) {
                fail("QP failed to shutdown in " + (maxTimeout * 2) + " seconds: " + qp.getName());
            }
        } catch (InterruptedException e) {
            LOG.debug("QP interrupted: {}", qp.getName(), e);
        }
    }

    protected TestableZooKeeper createClient() throws IOException, InterruptedException {
        return createClient(hostPort);
    }

    protected TestableZooKeeper createClient(String hp) throws IOException, InterruptedException {
        ClientBase.CountdownWatcher watcher = new ClientBase.CountdownWatcher();
        return createClient(watcher, hp);
    }

    protected TestableZooKeeper createClient(ClientBase.CountdownWatcher watcher, QuorumPeer.ServerState state) throws IOException, InterruptedException {
        return createClient(watcher, getPeersMatching(state));
    }

}


text:
<?php

if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'Zend_XmlRpc_AllTests::main');
}

require_once 'Zend/XmlRpc/BigIntegerValueTest.php';
require_once 'Zend/XmlRpc/ValueTest.php';
require_once 'Zend/XmlRpc/RequestTest.php';
require_once 'Zend/XmlRpc/Request/HttpTest.php';
require_once 'Zend/XmlRpc/ResponseTest.php';
require_once 'Zend/XmlRpc/FaultTest.php';
require_once 'Zend/XmlRpc/ClientTest.php';
require_once 'Zend/XmlRpc/ServerTest.php';
require_once 'Zend/XmlRpc/GeneratorTest.php';
require_once 'Zend/XmlRpc/Server/CacheTest.php';
require_once 'Zend/XmlRpc/Server/FaultTest.php';

/**
 * @category   Zend
 * @package    Zend_XmlRpc
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_XmlRpc
 */
class Zend_XmlRpc_AllTests
{
    public static function main()
    {
        PHPUnit_TextUI_TestRunner::run(self::suite());
    }

    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('Zend Framework - Zend_XmlRpc');

        $suite->addTestSuite('Zend_XmlRpc_BigIntegerValueTest');
        $suite->addTestSuite('Zend_XmlRpc_ValueTest');
        $suite->addTestSuite('Zend_XmlRpc_RequestTest');
        $suite->addTestSuite('Zend_XmlRpc_Request_HttpTest');
        $suite->addTestSuite('Zend_XmlRpc_ResponseTest');
        $suite->addTestSuite('Zend_XmlRpc_FaultTest');
        $suite->addTestSuite('Zend_XmlRpc_ClientTest');
        $suite->addTestSuite('Zend_XmlRpc_ServerTest');
        $suite->addTestSuite('Zend_XmlRpc_GeneratorTest');
        $suite->addTestSuite('Zend_XmlRpc_Server_CacheTest');
        $suite->addTestSuite('Zend_XmlRpc_Server_FaultTest');

        return $suite;
    }
}

if (PHPUnit_MAIN_METHOD == 'Zend_XmlRpc_AllTests::main') {
    Zend_XmlRpc_AllTests::main();
}


text:
#region License
//
// Author: Nate Kohari <nkohari@gmail.com>
// Copyright (c) 2007-2008, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
#region Using Directives
using System;
using Ninject.Core.Behavior;
using Ninject.Core.Infrastructure;
#endregion

namespace Ninject.Core
{
	/// <summary>
	/// Specifies that only a single instance of the type should exist throughout the application.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
	public sealed class SingletonAttribute : BehaviorAttribute
	{
		/*----------------------------------------------------------------------------------------*/
		/// <summary>
		/// Creates an instance of the behavior associated with the attribute.
		/// </summary>
		/// <returns>The instance of the behavior that will manage the decorated type.</returns>
		public override IBehavior CreateBehavior()
		{
			return new SingletonBehavior();
		}
		/*----------------------------------------------------------------------------------------*/
	}
}


text:
<?php

namespace App\Modules\Project\Facades;

use App\Modules\Search\Http\Controllers\Search as BaseSearch;
use Caffeinated\Modules\Facades\Module;
use Illuminate\Support\Facades\Route;

class Search extends BaseSearch
{
    public $tableName = 'projects';
    public $routeName = 'projects.show';

    public $dateField = 'date';

    public function getResult()
    {
        $sql = $this->getTable()
            ->select()
            ->where(function ($query){
                $query->where($this->getSearchSqlWhere(
                    $this->getQuery(),
                    array('title', 'preview', 'content')
                ));
            })
            ->where('lang', \Lang::locale())
            ->get();

        return $this->addNodes($sql, 'project', trans('project::index.title'));
    }

    public function getUrl($row)
    {

        if (!$this->routeName || !Route::has($this->routeName)) {
            return '';
        }

        return route($this->routeName,$row->id);
    }
}


text:
package coop.ekologia.presentation.controller.group.wiki;

import java.io.IOException;
import java.util.List;

import javax.ejb.EJB;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import coop.ekologia.DTO.group.GroupDTO;
import coop.ekologia.DTO.group.wiki.WikiDTO;
import coop.ekologia.presentation.EkologiaServlet;
import coop.ekologia.presentation.constants.GroupWikiConstants;
import coop.ekologia.presentation.request.GlobalRequestScope;
import coop.ekologia.presentation.request.RoutingCentral;
import coop.ekologia.presentation.session.LoginSession;
import coop.ekologia.service.group.GroupServiceInterface;
import coop.ekologia.service.group.wiki.WikiServiceInterface;
import coop.ekologia.service.utils.StringUtilitiesInterface;

@WebServlet("/group/wiki/list/*")
public class WikiListServlet extends EkologiaServlet {
    private static final long serialVersionUID = 5346421818656887507L;

    public static final String routing = "/group/wiki/list/{groupCanonical}";

    @EJB
    private WikiServiceInterface wikiService;

    @EJB
    private GroupServiceInterface groupService;

    @EJB
    private StringUtilitiesInterface stringUtilities;

    @Inject
    private LoginSession loginSession;

    @Inject
    private RoutingCentral router;

    @Inject
    private GlobalRequestScope globalRequestScope;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        GroupDTO groupDTO = (GroupDTO)request.getAttribute(GroupWikiConstants.ATTRIBUTE_GROUP_DTO);
        List<WikiDTO> wikiDTOList = wikiService.findRootsByGroup(globalRequestScope.getLanguage(), groupDTO.getId());
        request.setAttribute(GroupWikiConstants.ATTRIBUTE_WIKI_LIST, wikiDTOList);
        forwardToJsp("/group/wiki/list", request, response);
    }
}


text:
using Autumn.Common.Sync;

namespace Autumn.Server.Sync
{
    public interface ISyncRequestHandler
    {
        ISyncResponse Execute(ISyncRequest request);
    }

    public interface ISyncRequestHandler<TRequest, TResponse> : ISyncRequestHandler
        where TRequest : ISyncRequest
        where TResponse : ISyncResponse
    {
    }
}


text:
<?php

declare(strict_types=1);

namespace Inowas\Common\Id;

class CalculationId
{
    /** @var string */
    private $checksum;

    public static function fromString(string $id): CalculationId
    {
        return new self($id);
    }

    private function __construct(string $checksum)
    {
        $this->checksum = $checksum;
    }

    public function toString(): string
    {
        return $this->checksum;
    }

    public function sameValueAs($other): bool
    {
        if (!($other instanceof $this)) {
            return false;
        }

        return $this->toString() === $other->toString();
    }
}


text:
"""
    KFServing

    Python SDK for KFServing  # noqa: E501

    The version of the OpenAPI document: v0.1
    Generated by: https://openapi-generator.tech
"""

from __future__ import absolute_import

import unittest
import datetime

import kfserving
from kfserving.models.v1beta1_predictor_config import V1beta1PredictorConfig  # noqa: E501
from kfserving.rest import ApiException

class TestV1beta1PredictorConfig(unittest.TestCase):
    """V1beta1PredictorConfig unit test stubs"""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def make_instance(self, include_optional):
        """Test V1beta1PredictorConfig
            include_option is a boolean, when False only required
            params are included, when True both required and
            optional params are included """
        # model = kfserving.models.v1beta1_predictor_config.V1beta1PredictorConfig()  # noqa: E501
        if include_optional :
            return V1beta1PredictorConfig(
                default_gpu_image_version = '0',
                default_image_version = '0',
                image = '0',
                supported_frameworks=['0']
            )
        else :
            return V1beta1PredictorConfig(
                default_gpu_image_version = '0',
                default_image_version = '0',
                image = '0',
                supported_frameworks=['0']
        )

    def testV1beta1PredictorConfig(self):
        """Test V1beta1PredictorConfig"""
        inst_req_only = self.make_instance(include_optional=False)
        inst_req_and_optional = self.make_instance(include_optional=True)

if __name__ == '__main__':
    unittest.main()