text:
package com.ibm.streamsx.topology.internal.functional;

import com.ibm.streamsx.topology.function.FunctionContext;

public final class StatelessFunctionalHandler<T> extends FunctionalHandler<T> {

    private final T logic;

    public StatelessFunctionalHandler(FunctionContext context, String serializedLogic) throws Exception {
        super(context, serializedLogic);
        logic = initialLogic();
        initializeLogic();
    }

    public T getLogic() {
        return logic;
    }
}

redpajama_set_name: RedPajamaGithub


text:
module Main where

import qualified Bot

main = Bot.main


text: a lightweight class for handling continuous ajax


text:
'use strict';

var path = require('path');
var _ = require('lodash');
var util = require('util');

module.exports = function(grunt) {

  var plugin_dir = path.resolve(__dirname, '../');
  grunt.loadTasks(path.dirname(require.resolve('grunt-esformatter/tasks/esformatter')));
  grunt.loadTasks(path.dirname(require.resolve('grunt-jsbeautifier/tasks/jsbeautifier')));

  grunt.registerMultiTask('ef-coding-style', 'Reformat files with EF coding style conventions', function() {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options();
    // each file type lives as a separate target - js, css, html
    var type = this.target;
    var preset = {};

    // read preset
    if(options.preset) {
      // If this is not a directory in working dir
      if (!grunt.file.isDir(options.preset)) {
        options.preset = path.join(plugin_dir, 'preset', options.preset);
      }

      // read formatting rules from JSON file in preset directory
      preset = grunt.file.readJSON(path.join(options.preset, type) + '.json');
    }

    // allows for override formatting rules from task options
    var formatOptions = _.extend(preset, options.rules);

    // Iterate over all file formatting types, and
    // generate formatting task configuration dynamically
    this.files.forEach(function(fileObj) {
      var target;
      switch (type) {
        case 'javascript':
          grunt.config.set('esformatter', {
            options: formatOptions,
            src: fileObj.src
          });
          break;
        case 'css':
        case 'html':
          target = {
            options: {},
            src: fileObj.src
          };
          target.options[type] = formatOptions;
          grunt.config.set('jsbeautifier.' + type, target);
      }
    });

    var formatterName = type === 'javascript' ? 'esformatter' : 'jsbeautifier';

    // Log formatter task configs
    grunt.verbose.subhead('Formatter task: '+ formatterName+' config is now:');
    grunt.verbose.writeln(util.inspect(grunt.config(formatterName), {depth:4, colors: true}));
    grunt.task.run(formatterName);
  });
};


text:
<!DOCTYPE html>

<title>What are the My Workspace Recent Announcements?</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="sakai.myworkspace.announcements" name="description">
<meta content="My Workspace, landing page, navigation" name="search">
<link href="/library/skin/tool_base.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/library/skin/morpheus-default/tool.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/sakai-help-tool/css/help.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/library/js/jquery/featherlight/0.4.0/featherlight.min.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">

What are the My Workspace Recent Announcements?

The Announcements area in My Workspace displays announcements from all of the sites in which you are enrolled. You may use the drop-down menu to view All items, Public items only, or items By Group. (You must be a member of a group in order to see group announcements.)

View recent announcements.

              Zoom

Customize announcements display. (Optional)

You may select either All, Public, or By Group from the View drop-down menu to customize the display.

Note: By default, you will only see announcements that have been posted within the last 10 days in this location. (If you wish to see announcements posted within the past year, you should click on the Announcements link in the Tool Menu.)


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

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.ScriptCompilationException;
import org.camunda.bpm.engine.ScriptEvaluationException;
import org.camunda.bpm.engine.exception.NullValueException;
import org.camunda.bpm.engine.impl.test.PluggableProcessEngineTestCase;
import org.camunda.bpm.engine.repository.Deployment;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;

/**
 *
 * @author Daniel Meyer (Javascript)
 * @author Sebastian Menski (Python)
 * @author Nico Rehwaldt (Ruby)
 * @author Christian Lipphardt (Groovy)
 *
 */
public class ScriptTaskTest extends PluggableProcessEngineTestCase {

  private static final String JAVASCRIPT = "javascript";
  private static final String PYTHON = "python";
  private static final String RUBY = "ruby";
  private static final String GROOVY = "groovy";
  private static final String JUEL = "juel";

  private List<String> deploymentIds = new ArrayList<String>();

  protected void tearDown() throws Exception {
    for (String deploymentId : deploymentIds) {
      repositoryService.deleteDeployment(deploymentId, true);
    }
  }

  public void testJavascriptProcessVarVisibility() {

    deployProcess(JAVASCRIPT,

        // GIVEN
        // an execution variable 'foo'
        "execution.setVariable('foo', 'a');"

        // THEN
        // there should be a script variable defined
      + "if (typeof foo !== 'undefined') { "
      + "  throw 'Variable foo should be defined as script variable.';"
      + "}"

        // GIVEN
        // a script variable with the same name
      + "var foo = 'b';"

        // THEN
        // it should not change the value of the execution variable
      + "if(execution.getVariable('foo') != 'a') {"
      + "  throw 'Execution should contain variable foo';"
      + "}"

        // AND
        // it should override the visibility of the execution variable
      + "if(foo != 'b') {"
      + "  throw 'Script variable must override the visibiltity of the execution variable.';"
      + "}"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the script task can be executed without exceptions
    // the execution variable is stored and has the correct value
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("a", variableValue);

  }

  public void testPythonProcessVarAssignment() {

    deployProcess(PYTHON,

        // GIVEN
        // an execution variable 'foo'
        "execution.setVariable('foo', 'a')\n"

        // THEN
        // there should be a script variable defined
      + "if not foo:\n"
      + "    raise Exception('Variable foo should be defined as script variable.')\n"

        // GIVEN
        // a script variable with the same name
      + "foo = 'b'\n"

        // THEN
        // it should not change the value of the execution variable
      + "if execution.getVariable('foo') != 'a':\n"
      + "    raise Exception('Execution should contain variable foo')\n"

        // AND
        // it should override the visibility of the execution variable
      + "if foo != 'b':\n"
      + "    raise Exception('Script variable must override the visibiltity of the execution variable.')\n"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the script task can be executed without exceptions
    // the execution variable is stored and has the correct value
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("a", variableValue);

  }

  public void testRubyProcessVarVisibility() {

    deployProcess(RUBY,

        // GIVEN
        // an execution variable 'foo'
        "$execution.setVariable('foo', 'a')\n"

        // THEN
        // there should NOT be a script variable defined (this is unsupported in Ruby binding)
      + "raise 'Variable foo should be defined as script variable.' if !$foo.nil?\n"

        // GIVEN
        // a script variable with the same name
      + "$foo = 'b'\n"

        // THEN
        // it should not change the value of the execution variable
      + "if $execution.getVariable('foo') != 'a'\n"
      + "  raise 'Execution should contain variable foo'\n"
      + "end\n"

        // AND
        // it should override the visibility of the execution variable
      + "if $foo != 'b'\n"
      + "  raise 'Script variable must override the visibiltity of the execution variable.'\n"
      + "end"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the script task can be executed without exceptions
    // the execution variable is stored and has the correct value
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("a", variableValue);

  }

  public void testGroovyProcessVarVisibility() {

    deployProcess(GROOVY,

        // GIVEN
        // an execution variable 'foo'
        "execution.setVariable('foo', 'a')\n"

        // THEN
        // there should be a script variable defined
      + "if ( !foo ) {\n"
      + "  throw new Exception('Variable foo should be defined as script variable.')\n"
      + "}\n"

        // GIVEN
        // a script variable with the same name
      + "foo = 'b'\n"

        // THEN
        // it should not change the value of the execution variable
      + "if (execution.getVariable('foo') != 'a') {\n"
      + "  throw new Exception('Execution should contain variable foo')\n"
      + "}\n"

        // AND
        // it should override the visibility of the execution variable
      + "if (foo != 'b') {\n"
      + "  throw new Exception('Script variable must override the visibiltity of the execution variable.')\n"
      + "}"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the script task can be executed without exceptions
    // the execution variable is stored and has the correct value
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("a", variableValue);

  }

  public void testJavascriptFunctionInvocation() {

    deployProcess(JAVASCRIPT,

        // GIVEN
        // a function named sum
        "function sum(a,b){"
      + "  return a+b;"
      + "};"

        // THEN
        // i can call the function
      + "var result = sum(1,2);"

      + "execution.setVariable('foo', result);"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the variable is defined
    Object variable = runtimeService.getVariable(pi.getId(), "foo");

    if (variable instanceof Double) {
      // jdk 6/7 - rhino returns Double 3.0 for 1+2
      assertEquals(3.0, variable);
    } else if (variable instanceof Integer) {
      // jdk8 - nashorn returns Integer 3 for 1+2
      assertEquals(3, variable);
    }

  }

  public void testPythonFunctionInvocation() {

    deployProcess(PYTHON,

        // GIVEN
        // a function named sum
        "def sum(a, b):\n"
      + "    return a + b\n"

        // THEN
        // i can call the function
      + "result = sum(1,2)\n"
      + "execution.setVariable('foo', result)"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the variable is defined
    Object variable = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals(3, variable);

  }

  public void testRubyFunctionInvocation() {

    deployProcess(RUBY,

        // GIVEN
        // a function named sum
        "def sum(a, b)\n"
      + "    return a + b\n"
      + "end\n"

        // THEN
        // i can call the function
      + "result = sum(1,2)\n"

      + "$execution.setVariable('foo', result)\n"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the variable is defined
    Object variable = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals(3l, variable);

  }

  public void testGroovyFunctionInvocation() {

    deployProcess(GROOVY,

        // GIVEN
        // a function named sum
        "def sum(a, b) {\n"
      + "    return a + b\n"
      + "}\n"

        // THEN
        // i can call the function
      + "result = sum(1,2)\n"

      + "execution.setVariable('foo', result)\n"

    );

    // GIVEN
    // that we start an instance of this process
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    // THEN
    // the variable is defined
    Object variable = runtimeService.getVariable(pi.getId(), "foo");
    assertEquals(3, variable);

  }

  public void testJsVariable() {

    String scriptText = "var foo = 1;";

    deployProcess(JAVASCRIPT, scriptText);

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertNull(variableValue);

  }

  public void testPythonVariable() {

    String scriptText = "foo = 1";

    deployProcess(PYTHON, scriptText);

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertNull(variableValue);

  }

  public void testRubyVariable() {

    String scriptText = "foo = 1";

    deployProcess(RUBY, scriptText);

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertNull(variableValue);

  }

  public void testGroovyVariable() {

    String scriptText = "def foo = 1";

    deployProcess(GROOVY, scriptText);

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");
    Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
    assertNull(variableValue);

  }

  public void testJuelExpression() {
    deployProcess(JUEL, "${execution.setVariable('foo', 'bar')}");

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    String variableValue = (String) runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("bar", variableValue);
  }

  public void testSourceAsExpressionAsVariable() {
    deployProcess(PYTHON, "${scriptSource}");

    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("scriptSource", "execution.setVariable('foo', 'bar')");
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);

    String variableValue = (String) runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("bar", variableValue);
  }

  public void testSourceAsExpressionAsNonExistingVariable() {
    deployProcess(PYTHON, "${scriptSource}");

    try {
      runtimeService.startProcessInstanceByKey("testProcess");
      fail("Process variable 'scriptSource' not defined");
    }
    catch (ProcessEngineException e) {
      assertTextPresentIgnoreCase("Cannot resolve identifier 'scriptSource'", e.getMessage());
    }
  }

  public void testSourceAsExpressionAsBean() {
    deployProcess(PYTHON, "#{scriptResourceBean.getSource()}");

    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("scriptResourceBean", new ScriptResourceBean());
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);

    String variableValue = (String) runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("bar", variableValue);
  }

  public void testSourceAsExpressionWithWhitespace() {
    deployProcess(PYTHON, "\t\n  \t \n  ${scriptSource}");

    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("scriptSource", "execution.setVariable('foo', 'bar')");
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);

    String variableValue = (String) runtimeService.getVariable(pi.getId(), "foo");
    assertEquals("bar", variableValue);
  }

  public void testJavascriptVariableSerialization() {
    deployProcess(JAVASCRIPT, "execution.setVariable('date', new java.util.Date(0));");

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    Date date = (Date) runtimeService.getVariable(pi.getId(), "date");
    assertEquals(0, date.getTime());

    deployProcess(JAVASCRIPT, "execution.setVariable('myVar', new org.camunda.bpm.engine.test.bpmn.scripttask.MySerializable('test'));");

    pi = runtimeService.startProcessInstanceByKey("testProcess");

    MySerializable myVar = (MySerializable) runtimeService.getVariable(pi.getId(), "myVar");
    assertEquals("test", myVar.getName());
  }

  public void testPythonVariableSerialization() {
    deployProcess(PYTHON, "import java.util.Date\nexecution.setVariable('date', java.util.Date(0))");

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    Date date = (Date) runtimeService.getVariable(pi.getId(), "date");
    assertEquals(0, date.getTime());

    deployProcess(PYTHON, "import org.camunda.bpm.engine.test.bpmn.scripttask.MySerializable\n" +
      "execution.setVariable('myVar', org.camunda.bpm.engine.test.bpmn.scripttask.MySerializable('test'));");

    pi = runtimeService.startProcessInstanceByKey("testProcess");

    MySerializable myVar = (MySerializable) runtimeService.getVariable(pi.getId(), "myVar");
    assertEquals("test", myVar.getName());
  }

  public void testRubyVariableSerialization() {
    deployProcess(RUBY, "require 'java'\n$execution.setVariable('date', java.util.Date.new(0))");

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    Date date = (Date) runtimeService.getVariable(pi.getId(), "date");
    assertEquals(0, date.getTime());

    deployProcess(RUBY, "$execution.setVariable('myVar', org.camunda.bpm.engine.test.bpmn.scripttask.MySerializable.new('test'));");

    pi = runtimeService.startProcessInstanceByKey("testProcess");

    MySerializable myVar = (MySerializable) runtimeService.getVariable(pi.getId(), "myVar");
    assertEquals("test", myVar.getName());
  }

  public void testGroovyVariableSerialization() {
    deployProcess(GROOVY, "execution.setVariable('date', new java.util.Date(0))");

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");

    Date date = (Date) runtimeService.getVariable(pi.getId(), "date");
    assertEquals(0, date.getTime());

    deployProcess(GROOVY, "execution.setVariable('myVar', new org.camunda.bpm.engine.test.bpmn.scripttask.MySerializable('test'));");

    pi = runtimeService.startProcessInstanceByKey("testProcess");

    MySerializable myVar = (MySerializable) runtimeService.getVariable(pi.getId(), "myVar");
    assertEquals("test", myVar.getName());
  }

  public void testGroovyNotExistingImport() {
    deployProcess(GROOVY, "import unknown");

    try {
      runtimeService.startProcessInstanceByKey("testProcess");
      fail("Should fail during script compilation");
    }
    catch (ScriptCompilationException e) {
      assertTextPresentIgnoreCase("import unknown", e.getMessage());
    }
  }

  public void testGroovyNotExistingImportWithoutCompilation() {
    // disable script compilation
    processEngineConfiguration.setEnableScriptCompilation(false);

    deployProcess(GROOVY, "import unknown");

    try {
      runtimeService.startProcessInstanceByKey("testProcess");
      fail("Should fail during script evaluation");
    }
    catch (ScriptEvaluationException e) {
      assertTextPresentIgnoreCase("import unknown", e.getMessage());
    }
    finally {
      // re-enable script compilation
      processEngineConfiguration.setEnableScriptCompilation(true);
    }
  }

  public void testShouldNotDeployProcessWithMissingScriptElementAndResource() {
    try {
      deployProcess(Bpmn.createExecutableProcess("testProcess")
        .startEvent()
        .scriptTask()
          .scriptFormat(RUBY)
        .userTask()
        .endEvent()
      .done());

      fail("this process should not be deployable");
    } catch (ProcessEngineException e) {
      // happy path
    }
  }

  public void testShouldUseJuelAsDefaultScriptLanguage() {
    deployProcess(Bpmn.createExecutableProcess("testProcess")
      .startEvent()
      .scriptTask()
        .scriptText("${true}")
      .userTask()
      .endEvent()
    .done());

    runtimeService.startProcessInstanceByKey("testProcess");

    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
  }

  protected void deployProcess(BpmnModelInstance process) {
    Deployment deployment = repositoryService.createDeployment()
        .addModelInstance("testProcess.bpmn", process)
        .deploy();
      deploymentIds.add(deployment.getId());
  }

  protected void deployProcess(String scriptFormat, String scriptText) {
    BpmnModelInstance process = createProcess(scriptFormat, scriptText);
    deployProcess(process);
  }

  protected BpmnModelInstance createProcess(String scriptFormat, String scriptText) {

    return Bpmn.createExecutableProcess("testProcess")
      .startEvent()
      .scriptTask()
        .scriptFormat(scriptFormat)
        .scriptText(scriptText)
      .userTask()
      .endEvent()
    .done();

  }

  public void testAutoStoreScriptVarsOff() {
    assertFalse(processEngineConfiguration.isAutoStoreScriptVariables());
  }

  @org.camunda.bpm.engine.test.Deployment
  public void testPreviousTaskShouldNotHandleException(){
    try {
      runtimeService.startProcessInstanceByKey("process");
      fail();
    }
    // since the NVE extends the ProcessEngineException we have to handle it
    // separately
    catch (NullValueException nve) {
      fail("Shouldn't have received NullValueException");
    } catch (ProcessEngineException e) {
      assertThat(e.getMessage(), containsString("Invalid format"));
    }
  }
}


text:
package shredzzz.kirkwood.cumath.tensor.operations

import shredzzz.kirkwood.cumath.tensor.CuTensor
import shredzzz.kirkwood.cumath.tensor.operations.TensorBinaryImplicits._
import shredzzz.kirkwood.cumath.{Assigner, CuValue, Sentinel}
import shredzzz.kirkwood.driver.CuContext
import shredzzz.kirkwood.cumath.tensor.modules.BinaryModule

trait TensorBinaryImplicits
{
  implicit def CuTensorBinaryOps[TT[X] <: CuTensor[X, _, TT]](tensor: TT[Boolean])
    (implicit ctx: CuContext, binary: BinaryModule[TT]) = new CuTensorBinaryOps[TT](tensor)
  implicit def CuTensorBinaryAllocatingOps[TT[X] <: CuTensor[X, _, TT]](tensor: TT[Boolean])
    (implicit ctx: CuContext, binary: BinaryModule[TT]) = new CuTensorBinaryAllocatingOps[TT](tensor)
}

object TensorBinaryImplicits extends TensorBinaryImplicits

class CuTensorBinaryOps[TT[X] <: CuTensor[X, _, TT]](thisObj: TT[Boolean])
  (implicit ctx: CuContext, binary: BinaryModule[TT])
{
  // Element-wise operations {!, &&, ||, ^^}
  def unary_:!@() = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.neg[TT](thisObj, res)
      res
    }
  }

  def :&&@(c: CuValue[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.and[TT](thisObj, c, res)
      res
    }
  }

  def :||@(c: CuValue[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.or[TT](thisObj, c, res)
      res
    }
  }

  def :^^@(c: CuValue[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.xor[TT](thisObj, c, res)
      res
    }
  }

  def :&&@(y: TT[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.and[TT](thisObj, y, res)
      res
    }
  }

  def :||@(y: TT[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.or[TT](thisObj, y, res)
      res
    }
  }

  def :^^@(y: TT[Boolean]) = new Assigner[TT[Boolean]]
  {
    override def =:(res: TT[Boolean]) = {
      binary.xor[TT](thisObj, y, res)
      res
    }
  }

  // Aliases for element-wise operations {!, &&, ||, ^^}
  def unary_!@() = unary_:!@()

  def &&@(c: CuValue[Boolean]) = :&&@(c)

  def ||@(c: CuValue[Boolean]) = :||@(c)

  def ^^@(c: CuValue[Boolean]) = :^^@(c)

  def &&@(y: TT[Boolean]) = :&&@(y)

  def ||@(y: TT[Boolean]) = :||@(y)

  def ^^@(y: TT[Boolean]) = :^^@(y)
}

class CuTensorBinaryAllocatingOps[TT[X] <: CuTensor[X, _, TT]](thisObj: TT[Boolean])
  (implicit ctx: CuContext, binary: BinaryModule[TT])
{
  // Element-wise operations {!, &&, ||, ^^}
  def unary_:!()(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj.unary_:!@()
    res
  }

  def :&&(c: CuValue[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :&&@ c
    res
  }

  def :||(c: CuValue[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :||@ c
    res
  }

  def :^^(c: CuValue[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :^^@ c
    res
  }

  def :&&(y: TT[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :&&@ y
    res
  }

  def :||(y: TT[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :||@ y
    res
  }

  def :^^(y: TT[Boolean])(implicit sentinel: Sentinel) = sentinel.aware {
    val res = sentinel.register(thisObj.cloneShape[Boolean]())
    res =: thisObj :^^@ y
    res
  }

  // Aliases for element-wise operations {!, &&, ||, ^^}
  def unary_!()(implicit sentinel: Sentinel) = unary_:!()

  def &&(c: CuValue[Boolean])(implicit sentinel: Sentinel) = :&&(c)

  def ||(c: CuValue[Boolean])(implicit sentinel: Sentinel) = :||(c)

  def ^^(c: CuValue[Boolean])(implicit sentinel: Sentinel) = :^^(c)

  def &&(y: TT[Boolean])(implicit sentinel: Sentinel) = :&&(y)

  def ||(y: TT[Boolean])(implicit sentinel: Sentinel) = :||(y)

  def ^^(y: TT[Boolean])(implicit sentinel: Sentinel) = :^^(y)
}


text:
Jawaf provides a basic, optional RESTful interface to build an admin site on.

## Setup

By default jawaf.admin is in INSTALLED_APPS in `settings.py`, and you'll find entries in your project `routes.py` as well.

## Registering Tables

To use the admin views you will need to register the tables you wish to access through the admin.

Editing `polls/tables.py`

```python
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, Table, Text
from jawaf.admin import registry

metadata = MetaData()

question = Table('polls_question', metadata,
    Column('id', Integer, primary_key=True),
    Column('question_text', Text()),
    Column('pub_date', DateTime(timezone=True)),
    )

choice = Table('polls_choice', metadata,
    Column('id', Integer, primary_key=True),
    Column('question_id', Integer, ForeignKey('polls_question.id'), nullable=False),
    Column('choice_text', Text()),
    Column('votes', Integer()),
    )

# Optionally you can specify the database the tables in this file should use.
DATABASE = 'default'

### Adding in admin registry!
registry.register('question', question, DATABASE)
registry.register('choice', choice, DATABASE)
```

The `name` is the first argument to register, and tells the admin what `name` to use as a lookup reference when processing urls.

## CRUD

You can hit `/admin/question/` to access CRUD operations on the `question` table. Supported operations:

**delete** - pass in a json body with `id` specified to delete the matching `question` row.

**get** - Add `id` to the url params to get a json object containing a success message and the data from the matching `question` row.

**post** - pass in a json body with the columns and values in a dictionary to create a new `question` row.

**put** - pass in a json body with `id` specified plus the columns and values - all in a single dictionary to edit an existing `question` row.

## Current Status

Very much in progress. Basic features are still being completed and will need reviewing. See the roadmap for reference.


text:
angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])
  .provider('Idle', function() {
    var options = {
      idle: 20 * 60, // in seconds (default is 20min)
      timeout: 30, // in seconds (default is 30sec)
      autoResume: 'idle', // lets events automatically resume (unsets idle state/resets warning)
      interrupt: 'mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll',
      keepalive: true,
      titleDisabled: false // disable changes in document's title
    };

    /**
     *  Sets the number of seconds a user can be idle before they are considered timed out.
     *  @param {Number|Boolean} seconds A positive number representing seconds OR 0 or false to disable this feature.
     */
    var setTimeout = this.timeout = function(seconds) {
      if (seconds === false) options.timeout = 0;
      else if (angular.isNumber(seconds) && seconds >= 0) options.timeout = seconds;
      else throw new Error('Timeout must be zero or false to disable the feature, or a positive integer (in seconds) to enable it.');
    };

    this.interrupt = function(events) {
      options.interrupt = events;
    };

    var setIdle = this.idle = function(seconds) {
      if (seconds <= 0) throw new Error('Idle must be a value in seconds, greater than 0.');

      options.idle = seconds;
    };

    var setTitleDisabled = this.titleDisabled = function(disabled) {
      options.titleDisabled = disabled === true;
    };

    this.autoResume = function(value) {
      if (value === true) options.autoResume = 'idle';
      else if (value === false) options.autoResume = 'off';
      else options.autoResume = value;
    };

    this.keepalive = function(enabled) {
      options.keepalive = enabled === true;
    };

    this.$get = ['$interval', '$log', '$rootScope', '$document', 'Keepalive', 'IdleLocalStorage', '$window',
      function($interval, $log, $rootScope, $document, Keepalive, LocalStorage, $window) {
        var state = {
          idle: null,
          timeout: null,
          idling: false,
          running: false,
          countdown: null
        };

        var id = new Date().getTime();

        function startKeepalive() {
          if (!options.keepalive) return;

          if (state.running) Keepalive.ping();

          Keepalive.start();
        }

        function stopKeepalive() {
          if (!options.keepalive) return;

          Keepalive.stop();
        }

        function toggleState() {
          state.idling = !state.idling;
          var name = state.idling ? 'Start' : 'End';

          $rootScope.$broadcast('Idle' + name);

          if (state.idling) {
            stopKeepalive();
            if (options.timeout) {
              state.countdown = options.timeout;
              countdown();
              state.timeout = $interval(countdown, 1000, options.timeout, false);
            }
          } else {
            startKeepalive();
          }

          $interval.cancel(state.idle);
        }

        function countdown() {
          // countdown has expired, so signal timeout
          if (state.countdown <= 0) {
            timeout();
            return;
          }

          // countdown hasn't reached zero, so warn and decrement
          $rootScope.$broadcast('IdleWarn', state.countdown);
          state.countdown--;
        }

        function timeout() {
          stopKeepalive();
          $interval.cancel(state.idle);
          $interval.cancel(state.timeout);

          state.idling = true;
          state.running = false;
          state.countdown = 0;

          $rootScope.$broadcast('IdleTimeout');
        }

        function changeOption(self, fn, value) {
          var reset = self.running();

          self.unwatch();
          fn(value);
          if (reset) self.watch();
        }

        function getExpiry() {
          var obj = LocalStorage.get('expiry');

          return obj && obj.time ? new Date(obj.time) : null;
        }

        function setExpiry(date) {
          if (!date) LocalStorage.remove('expiry');
          else LocalStorage.set('expiry', {id: id, time: date});
        }

        var svc = {
          _options: function() {
            return options;
          },
          _getNow: function() {
            return new Date();
          },
          getIdle: function(){
            return options.idle;
          },
          getTimeout: function(){
            return options.timeout;
          },
          setIdle: function(seconds) {
            changeOption(this, setIdle, seconds);
          },
          setTitleDisabled: function(disabled) {
            changeOption(this, setTitleDisabled, disabled);
          },
          isTitleDisabled: function() {
            return options.titleDisabled;
          },
          setTimeout: function(seconds) {
            changeOption(this, setTimeout, seconds);
          },
          isExpired: function() {
            var expiry = getExpiry();
            return expiry !== null && expiry <= this._getNow();
          },
          running: function() {
            return state.running;
          },
          idling: function() {
            return state.idling;
          },
          watch: function(noExpiryUpdate) {
            $interval.cancel(state.idle);
            $interval.cancel(state.timeout);

            // calculate the absolute expiry date, as added insurance against a browser sleeping or paused in the background
            var timeout = !options.timeout ? 0 : options.timeout;
            if (!noExpiryUpdate) setExpiry(new Date(new Date().getTime() + ((options.idle + timeout) * 1000)));

            if (state.idling) toggleState(); // clears the idle state if currently idling
            else if (!state.running) startKeepalive(); // if about to run, start keep alive

            state.running = true;

            state.idle = $interval(toggleState, options.idle * 1000, 0, false);
          },
          unwatch: function() {
            $interval.cancel(state.idle);
            $interval.cancel(state.timeout);

            state.idling = false;
            state.running = false;
            setExpiry(null);

            stopKeepalive();
          },
          interrupt: function(noExpiryUpdate) {
            if (!state.running) return;

            if (options.timeout && this.isExpired()) {
              timeout();
              return;
            }

            // note: you can no longer auto resume once we exceed the expiry; you will reset state by calling watch() manually
            if (options.autoResume === 'idle' || (options.autoResume === 'notIdle' && !state.idling)) this.watch(noExpiryUpdate);
          }
        };

        $document.find('body').on(options.interrupt, function(event) {
          /*
            note:
              webkit fires fake mousemove events when the user has done nothing, so the idle will never time out while the cursor is over the webpage
              Original webkit bug report which caused this issue:
                https://bugs.webkit.org/show_bug.cgi?id=17052
              Chromium bug reports for issue:
                https://code.google.com/p/chromium/issues/detail?id=5598
                https://code.google.com/p/chromium/issues/detail?id=241476
                https://code.google.com/p/chromium/issues/detail?id=317007
          */
          if (event.type !== 'mousemove' || (event.movementX || event.movementY)) {
            svc.interrupt();
          }
        });

        var wrap = function(event) {
          if (event.key === 'ngIdle.expiry' && event.newValue !== event.oldValue) {
            var val = angular.fromJson(event.newValue);
            if (val.id === id) return;
            svc.interrupt(true);
          }
        };

        if ($window.addEventListener) $window.addEventListener('storage', wrap, false);
        else $window.attachEvent('onstorage', wrap);

        return svc;
      }
    ];
  });


text:
package net.francesbagual.github.eip.pattern.channel.adapter.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.inject.Inject;
import javax.jms.JMSContext;
import javax.jms.JMSDestinationDefinition;
import javax.jms.JMSDestinationDefinitions;
import javax.jms.Queue;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@JMSDestinationDefinitions(
		value = {
				@JMSDestinationDefinition(
						name = "jms/queue/hellows",
						interfaceName = "javax.jms.Queue",
						destinationName = "hellows"
				)
		})
@WebServlet("/wsadapter")
public class WSAdapterServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Resource(lookup = "jms/queue/hellows")
	private Queue hellowsQueue;

	@Inject
	private JMSContext context;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setContentType("text/html");
		PrintWriter out = resp.getWriter();
		out.write("Channel Adapters help to integrate existing application to a messaging system. It can be through UI (can be html, json, xml ...), or API (like EJB) or database");
		out.write("
");
		out.write("Here we are triggering a webservice through messaging using an adapter");
		context.createProducer().send(hellowsQueue, "hello");
		out.write("
Go to your WildFly Server console or Server log to see the result of messages processing
");

	}
}


text: alias ag='ag --pager="less --quit-if-one-screen --RAW-CONTROL-CHARS --no-init"'


text:
#pragma once

namespace upm
{
/**
* @brief Interface for Luminance Measuring Sensors
*/
    class iLight
    {
    public:
        virtual ~iLight() {}

        /**
         * Get luminance
         *
         * @return Luminance value in lux
         */
        virtual float getLuminance() = 0;
    };
}


text:
<!doctype html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <meta name="nodejs.org:node-version" content="v14.8.0">
  <title>Punycode | Node.js v14.8.0 Documentation</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
  <link rel="stylesheet" href="assets/style.css">
  <link rel="stylesheet" href="assets/hljs.css">
  <link rel="canonical" href="https://nodejs.org/api/punycode.html">

          Node.js

About this documentation

Usage and example

Assertion testing

Async hooks

Buffer

C++ addons

C/C++ addons with N-API

C++ embedder API

Child processes

Cluster

Command line options

Console

Crypto

Debugger

Deprecated APIs

DNS

Domain

ECMAScript modules

Errors

Events

File system

Globals

HTTP

HTTP/2

HTTPS

Inspector

Internationalization

Modules

Net

OS

Path

Performance hooks

Policies

Process

Punycode

Query strings

Readline

REPL

Report

Stream

String decoder

Timers

TLS/SSL

Trace events

TTY

UDP/datagram

URL

Utilities

V8

VM

WASI

Worker threads

Zlib

Code repository and issue tracker

Node.js v14.8.0 Documentation

              Index

              View on single page

              View as JSON

      View another version ▼

14.x

13.x

12.x LTS

11.x

10.x LTS

9.x

8.x

7.x

6.x

5.x

4.x

0.12.x

0.10.x

<svg height="16" width="16" viewBox="0 0 16.1 16.1" fill="currentColor"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4 0 .5-.2.5-.4v-1.5c-2 .4-2.5-.5-2.7-1 0-.1-.5-.9-.8-1-.3-.2-.7-.6 0-.6.6 0 1 .6 1.2.8.7 1.2 1.9 1 2.4.7 0-.5.2-.9.5-1-1.8-.3-3.7-1-3.7-4 0-.9.3-1.6.8-2.2 0-.2-.3-1 .1-2 0 0 .7-.3 2.2.7a7.4 7.4 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.5 1.1.2 2 .1 2.1.5.6.8 1.3.8 2.2 0 3-1.9 3.7-3.6 4 .3.2.5.7.5 1.4v2.2c0 .2.1.5.5.4A8 8 0 0 0 16 8a8 8 0 0 0-8-8z"/></svg>Edit on GitHub

Table of Contents

Punycode

punycode.decode(string)

punycode.encode(string)

punycode.toASCII(domain)

punycode.toUnicode(domain)

punycode.ucs2

punycode.ucs2.decode(string)

punycode.ucs2.encode(codePoints)

punycode.version

Punycode#

History

Version	Changes

v7.0.0

Accessing this module will now emit a deprecation warning.

Stability: 0 - Deprecated

Source Code: lib/punycode.js

The version of the punycode module bundled in Node.js is being deprecated.
In a future major version of Node.js this module will be removed. Users
currently depending on the punycode module should switch to using the
userland-provided Punycode.js module instead.

The punycode module is a bundled version of the Punycode.js module. It
can be accessed using:

const punycode = require('punycode');

Punycode is a character encoding scheme defined by RFC 3492 that is
primarily intended for use in Internationalized Domain Names. Because host
names in URLs are limited to ASCII characters only, Domain Names that contain
non-ASCII characters must be converted into ASCII using the Punycode scheme.
For instance, the Japanese character that translates into the English word,
'example' is '例'. The Internationalized Domain Name, '例.com' (equivalent
to 'example.com') is represented by Punycode as the ASCII string
'xn--fsq.com'.

The punycode module provides a simple implementation of the Punycode standard.

The punycode module is a third-party dependency used by Node.js and
made available to developers as a convenience. Fixes or other modifications to
the module must be directed to the Punycode.js project.

punycode.decode(string)#

Added in: v0.5.1

string <string>

The punycode.decode() method converts a Punycode string of ASCII-only
characters to the equivalent string of Unicode codepoints.

punycode.decode('maana-pta'); // 'mañana'
punycode.decode('--dqo34k'); // '☃-⌘'

punycode.encode(string)#

Added in: v0.5.1

string <string>

The punycode.encode() method converts a string of Unicode codepoints to a
Punycode string of ASCII-only characters.

punycode.encode('mañana'); // 'maana-pta'
punycode.encode('☃-⌘'); // '--dqo34k'

punycode.toASCII(domain)#

Added in: v0.6.1

domain <string>

The punycode.toASCII() method converts a Unicode string representing an
Internationalized Domain Name to Punycode. Only the non-ASCII parts of the
domain name will be converted. Calling punycode.toASCII() on a string that
already only contains ASCII characters will have no effect.

// encode domain names
punycode.toASCII('mañana.com');  // 'xn--maana-pta.com'
punycode.toASCII('☃-⌘.com');   // 'xn----dqo34k.com'
punycode.toASCII('example.com'); // 'example.com'

punycode.toUnicode(domain)#

Added in: v0.6.1

domain <string>

The punycode.toUnicode() method converts a string representing a domain name
containing Punycode encoded characters into Unicode. Only the Punycode
encoded parts of the domain name are be converted.

// decode domain names
punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
punycode.toUnicode('xn----dqo34k.com');  // '☃-⌘.com'
punycode.toUnicode('example.com');       // 'example.com'

punycode.ucs2#

Added in: v0.7.0

punycode.ucs2.decode(string)#

Added in: v0.7.0

string <string>

The punycode.ucs2.decode() method returns an array containing the numeric
codepoint values of each Unicode symbol in the string.

punycode.ucs2.decode('abc'); // [0x61, 0x62, 0x63]
// surrogate pair for U+1D306 tetragram for centre:
punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]

punycode.ucs2.encode(codePoints)#

Added in: v0.7.0

codePoints <integer[]>

The punycode.ucs2.encode() method returns a string based on an array of
numeric code point values.

punycode.ucs2.encode([0x61, 0x62, 0x63]); // 'abc'
punycode.ucs2.encode([0x1D306]); // '\uD834\uDF06'

punycode.version#

Added in: v0.6.1

<string>

Returns a string identifying the current Punycode.js version number.


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;

class Program
{
    static int Main()
    {
        // Run all tests 3x times to exercise both slow and fast paths work
        for (int i = 0; i < 3; i++)
            RunAllTests();

        Console.WriteLine(Assert.HasAssertFired ? "FAILED" : "PASSED");
        return Assert.HasAssertFired ? 1 : 100;
    }

    static void RunAllTests()
    {
        RunTest1();
        RunTest2();
        RunTest3();
        RunTest4();
        RunTest5();
        RunTest6();
        RunTest7();
    }

    static void RunTest1()
    {
        DateTime dt = new DateTime(1776, 7, 4);
        string dtString = dt.ToString();
        Assert.AreEqual(new GenClass1c<DateTime>(dt).ToStringEx(7), dtString + " 7");
        Assert.AreEqual(new GenClass1c<int>(1).ToStringEx(7), "1 7");
        Assert.AreEqual(new GenClass1c<long>(2).ToStringEx(7), "2 7");
        Assert.AreEqual(new GenClass1c<float>(3.14f).ToStringEx(7), "3.14 7");
        Assert.AreEqual(new GenClass1c<double>(4.13).ToStringEx(7), "4.13 7");
        Assert.AreEqual(new GenClass1c<int?>(9).ToString(), "9");

        Assert.AreEqual(new GenClass2<DateTime, double>(dt, 3.1416).ToString(), dtString + " 3.1416");
        Assert.AreEqual(new GenClass2<DateTime, double>(dt, 3.1416).ToStringEx(7, 8), dtString + " 3.1416 7 8");
        Assert.AreEqual(new GenClass2<object, string>(new object(), "3.1416").ToString(), "System.Object 3.1416");
        Assert.AreEqual(new GenClass2<object, string>(new object(), "3.1416").ToStringEx(7L, 8L), "System.Object 3.1416 7 8");
        Assert.AreEqual(GetString(7.0, 8.0), "7 8");

        var gen1a = new GenClass1a<object>();
        Assert.AreEqual(gen1a.CreateGenClass1b(), "GenClass1b`1[System.Object]");
        Assert.AreEqual(gen1a.CreateGenClass1bArray(), "GenClass1b`1[System.Object][]");

        var gen1aInt = new GenClass1a<int>();
        var gen1bInt = new GenClass1b<int>();
        var gen1bLong = new GenClass1b<long>();
        Assert.AreEqual(gen1bInt.IsGenClass1a(gen1aInt).ToString(), "True");
        Assert.AreEqual(gen1bLong.IsGenClass1a(gen1aInt).ToString(), "False");
        Assert.AreEqual(gen1bInt.AsGenClass1a(gen1aInt)?.ToString() ?? "null", gen1aInt.ToString());
        Assert.AreEqual(gen1bLong.AsGenClass1a(gen1aInt)?.ToString() ?? "null", "null");

        var gen1aString = new GenClass1a<string>();
        var gen1b = new GenClass1b<string>();
        Assert.AreEqual(gen1b.IsGenClass1a(gen1aString).ToString(), "True");
        Assert.AreEqual(gen1b.AsGenClass1a(gen1aString)?.ToString() ?? "null", gen1aString.ToString());
        Assert.AreEqual(GenClass1a<string>.CallVirtual(gen1b), "GenClass1b`1[System.String].VirtualMethod");
        Assert.AreEqual(GenClass1a<string>.CallInterface(gen1b), "GenClass1b`1[System.String].InterfaceMethod1");
        Assert.AreEqual(GenClass1a<string>.CallInterface(gen1b, "Test").ToString(), "GenClass1b`1[System.String]");

        NormalClass n = new NormalClass();
        Assert.AreEqual(CallGenVirtMethod<int>(n).ToString(), "GenClass1a`1[System.Int32]");
        Assert.AreEqual(CallGenVirtMethod<int>(n, 42).ToString(), "System.Int32[]");
        Assert.AreEqual(CallGenVirtMethod<string>(n).ToString(), "GenClass1a`1[System.String]");
        Assert.AreEqual(CallGenVirtMethod<string>(n, "forty-two").ToString(), "System.String[]");
    }

    static void RunTest2()
    {
        var mi = new GenBase<MyClass0, int>();
        var ol = new GenBase<object, long>();

        // LDTOKEN OF TYPE PARAMETERS TEST
        Assert.AreEqual(mi.GetT(), "MyClass0");
        Assert.AreEqual(mi.GetU(), "System.Int32");
        Assert.AreEqual(ol.GetT(), "System.Object");
        Assert.AreEqual(ol.GetU(), "System.Int64");
        Assert.AreEqual(mi.GetT(), "MyClass0");
        Assert.AreEqual(mi.GetU(), "System.Int32");

        Assert.AreEqual(mi.GetTArray(), "MyClass0[]");
        Assert.AreEqual(ol.GetTArray(), "System.Object[]");
        Assert.AreEqual(mi.GetTArray(), "MyClass0[]");
        Assert.AreEqual(mi.GetTBasedInst(), "MyGenClass2`1[MyGenClass1`1[MyClass0]]");
        Assert.AreEqual(ol.GetTBasedInst(), "MyGenClass2`1[MyGenClass1`1[System.Object]]");
        Assert.AreEqual(mi.GetTBasedInst(), "MyGenClass2`1[MyGenClass1`1[MyClass0]]");
    }

    static void RunTest3()
    {
        var mi = new GenBase<MyClass0, int>();
        var ol = new GenBase<object, long>();

        // GENERIC INTERFACE CALL AND CASTING TEST
        Assert.AreEqual(mi.IFaceCallTest(mi), "IFaceCallTest = IFooFunc - GenBase`2[MyClass0,System.Int32]");
        Assert.AreEqual(ol.IFaceCallTest(ol), "IFaceCallTest = IFooFunc - GenBase`2[System.Object,System.Int64]");
        Assert.AreEqual(mi.IFaceCallTest(mi), "IFaceCallTest = IFooFunc - GenBase`2[MyClass0,System.Int32]");

        // LDTOKEN TEST
        Assert.AreEqual(mi.LdTokenTest(), "LdTokenTest - System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]");
        Assert.AreEqual(ol.LdTokenTest(), "LdTokenTest - System.Collections.Generic.Dictionary`2[System.Object,System.Int64]");
        Assert.AreEqual(mi.LdTokenTest(), "LdTokenTest - System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]");

        // DICTIONARY ACCESS FROM STATIC METHOD
        Assert.AreEqual(GenBase<MyClass0, int>.StaticNonGenMethod(), "StaticNonGenMethod - System.Collections.Generic.List`1[MyClass0]");
        Assert.AreEqual(GenBase<object, long>.StaticNonGenMethod(), "StaticNonGenMethod - System.Collections.Generic.List`1[System.Object]");
        Assert.AreEqual(GenBase<MyClass0, int>.StaticNonGenMethod(), "StaticNonGenMethod - System.Collections.Generic.List`1[MyClass0]");
        Assert.AreEqual(GenBase<MyClass0, int>.StaticGenMethod<Type>(), "StaticGenMethod - System.Collections.Generic.Dictionary`2[System.Type,MyClass0]");
        Assert.AreEqual(GenBase<object, long>.StaticGenMethod<Type>(), "StaticGenMethod - System.Collections.Generic.Dictionary`2[System.Type,System.Object]");
        Assert.AreEqual(GenBase<MyClass0, int>.StaticGenMethod<Type>(), "StaticGenMethod - System.Collections.Generic.Dictionary`2[System.Type,MyClass0]");

        // NEW TEST
        Assert.AreEqual(mi.NewTest(), "NewTest - MyClass0 - MyGenClass1`1[MyClass0] - MyClass0[] - MyClass0[,] - MyGenClass3`1[MyClass0][] - MyGenClass3`1[MyClass0][,]");
        Assert.AreEqual(ol.NewTest(), "NewTest - System.Object - MyGenClass1`1[System.Object] - System.Object[] - System.Object[,] - MyGenClass3`1[System.Object][] - MyGenClass3`1[System.Object][,]");
        Assert.AreEqual(mi.NewTest(), "NewTest - MyClass0 - MyGenClass1`1[MyClass0] - MyClass0[] - MyClass0[,] - MyGenClass3`1[MyClass0][] - MyGenClass3`1[MyClass0][,]");
    }

    static void RunTest4()
    {
        // FIELDS TEST
        var fobj1 = new GenBase<MyIdClass0, int>();
        var fobj2 = new GenBase<MyIdClass1, int>();
        GenBase<MyIdClass0, int>.SetFieldsTest(fobj1, new MyIdClass0("1"), new MyIdClass0("2"), new MyIdClass0("3"), 1, 2, 3);
        GenBase<MyIdClass1, int>.SetFieldsTest(fobj2, new MyIdClass1("1"), new MyIdClass1("2"), new MyIdClass1("3"), 1, 2, 3);

        GenBase<MyIdClass0, int>.GetFieldsTest(fobj1, "MyIdClass0=1", "MyIdClass0=2", "MyIdClass0=3", 1, 2, 3);
        GenBase<MyIdClass1, int>.GetFieldsTest(fobj2, "MyIdClass1=1", "MyIdClass1=2", "MyIdClass1=3", 1, 2, 3);

        Thread t = new Thread(new ThreadStart(() =>
        {
            GenBase<MyIdClass0, int>.SetFieldsTest(fobj1, new MyIdClass0("11"), new MyIdClass0("22"), new MyIdClass0("33"), 11, 22, 33);
            GenBase<MyIdClass1, int>.SetFieldsTest(fobj2, new MyIdClass1("11"), new MyIdClass1("22"), new MyIdClass1("33"), 11, 22, 33);

            GenBase<MyIdClass0, int>.GetFieldsTest(fobj1, "MyIdClass0=11", "MyIdClass0=22", "MyIdClass0=33", 11, 22, 33);
            GenBase<MyIdClass1, int>.GetFieldsTest(fobj2, "MyIdClass1=11", "MyIdClass1=22", "MyIdClass1=33", 11, 22, 33);
        }));
        t.Start();
        t.Join();

        GenBase<MyIdClass0, int>.GetFieldsTest(fobj1, "MyIdClass0=11", "MyIdClass0=22", "MyIdClass0=3", 11, 22, 3);
        GenBase<MyIdClass1, int>.GetFieldsTest(fobj2, "MyIdClass1=11", "MyIdClass1=22", "MyIdClass1=3", 11, 22, 3);
    }

    static void RunTest5()
    {
        // DELEGATES TEST
        var fobj1 = new GenBase<MyIdClass0, int>();
        var fobj2 = new GenBase<MyIdClass1, int>();

        Func<MyIdClass0, int, string>[] del1 = fobj1.GetDelegateTest();
        Func<MyIdClass1, int, string>[] del2 = fobj2.GetDelegateTest();
        Assert.AreEqual(del1[0](new MyIdClass0("1"), 1), "InstanceDelMethod(GenBase`2[MyIdClass0,System.Int32] - MyIdClass0=1 - 1)");
        Assert.AreEqual(del1[1](new MyIdClass0("2"), 2), "StaticDelMethod(MyIdClass0=2 - 2)");
        Assert.AreEqual(del2[0](new MyIdClass1("3"), 3), "InstanceDelMethod(GenBase`2[MyIdClass1,System.Int32] - MyIdClass1=3 - 3)");
        Assert.AreEqual(del2[1](new MyIdClass1("4"), 4), "StaticDelMethod(MyIdClass1=4 - 4)");
        Assert.AreEqual(del1[0](new MyIdClass0("5"), 5), "InstanceDelMethod(GenBase`2[MyIdClass0,System.Int32] - MyIdClass0=5 - 5)");
        Assert.AreEqual(del1[1](new MyIdClass0("6"), 6), "StaticDelMethod(MyIdClass0=6 - 6)");
    }

    static void RunTest6()
    {
        // BOXING AND NULLABLE TEST
        var mi = new GenBase<MyClass0, int>();
        var ol = new GenBase<object, long>();

        Assert.AreEqual(mi.BoxingAndNullableTest(
            new MyGenClass1<KeyValuePair<MyClass0, int>>(),
            new MyGenStruct1<Dictionary<MyClass0, int>>(),
            new MyGenStruct1<Dictionary<MyClass0, int>>()),
            "BoxingAndNullableTest - GenBase`2[MyClass0,System.Int32]::(MyGenClass1`1[System.Collections.Generic.KeyValuePair`2[MyClass0,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]])");
        Assert.AreEqual(ol.BoxingAndNullableTest(
            new MyGenClass1<KeyValuePair<object, long>>(),
            new MyGenStruct1<Dictionary<object, long>>(),
            new MyGenStruct1<Dictionary<object, long>>()),
            "BoxingAndNullableTest - GenBase`2[System.Object,System.Int64]::(MyGenClass1`1[System.Collections.Generic.KeyValuePair`2[System.Object,System.Int64]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[System.Object,System.Int64]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[System.Object,System.Int64]])");
    }

    static void RunTest7()
    {
        // GENERIC METHOD TEST

        Base b = new Base();
        var obj1 = new GenBase<MyClass1, int>();
        var obj2 = new GenBase<MyClass2, long>();

        // LDTOKEN OF TYPE PARAMETERS TEST
        Assert.AreEqual(b.GetT<string>().ToString(), "System.String");
        Assert.AreEqual(b.GetT<object>().ToString(), "System.Object");
        Assert.AreEqual(b.GetTArray<string>().ToString(), "System.String[]");
        Assert.AreEqual(b.GetTArray<object>().ToString(), "System.Object[]");
        Assert.AreEqual(b.GetTBasedInst<string>().ToString(), "MyGenClass2`1[MyGenClass1`1[System.String]]");
        Assert.AreEqual(b.GetTBasedInst<object>().ToString(), "MyGenClass2`1[MyGenClass1`1[System.Object]]");

        Assert.AreEqual(b.GetT<MyClass1, int>(), "MyClass1");
        Assert.AreEqual(b.GetU<MyClass1, int>(), "System.Int32");
        Assert.AreEqual(b.GetT<MyClass2, long>(), "MyClass2");
        Assert.AreEqual(b.GetU<MyClass2, long>(), "System.Int64");

        // GENERIC INTERFACE CALL AND CASTING TEST
        Assert.AreEqual(b.IFaceCallTest<MyClass1, int>(obj1), "IFaceCallTest = IFooFunc - GenBase`2[MyClass1,System.Int32]");
        Assert.AreEqual(b.IFaceCallTest<MyClass2, long>(obj2), "IFaceCallTest = IFooFunc - GenBase`2[MyClass2,System.Int64]");

        // LDTOKEN TEST
        Assert.AreEqual(b.LdTokenTest<MyClass1, int>(), "System.Collections.Generic.Dictionary`2[MyClass1,System.Int32]");
        Assert.AreEqual(b.LdTokenTest<MyClass2, long>(), "System.Collections.Generic.Dictionary`2[MyClass2,System.Int64]");

        // DICTIONARY ACCESS FROM STATIC METHOD
        Assert.AreEqual(Base.StaticGenMethod<float, MyClass1>(), "StaticGenMethod - System.Collections.Generic.Dictionary`2[MyClass1,System.Single]");
        Assert.AreEqual(Base.StaticGenMethod<float, MyClass2>(), "StaticGenMethod - System.Collections.Generic.Dictionary`2[MyClass2,System.Single]");

        // NEW TEST
        Assert.AreEqual(b.NewTest<MyClass1, MyClass2>(),
            "NewTest - MyClass1 - MyGenClass1`1[MyClass1] - MyClass1[] - MyClass1[,] - MyGenClass2`1[MyClass1][] - MyGenClass2`1[MyClass1][,]");
        Assert.AreEqual(b.NewTest<MyClass2, MyClass1>(),
            "NewTest - MyClass2 - MyGenClass1`1[MyClass2] - MyClass2[] - MyClass2[,] - MyGenClass2`1[MyClass2][] - MyGenClass2`1[MyClass2][,]");

        // BOXING AND NULLABLE TEST
        Assert.AreEqual(b.BoxingAndNullableTest<MyClass0, int>(
            new MyGenClass1<KeyValuePair<MyClass0, int>>(),
            new MyGenStruct1<Dictionary<MyClass0, int>>(),
            new MyGenStruct1<Dictionary<MyClass0, int>>()),
            "BoxingAndNullableTest - Base::(MyGenClass1`1[System.Collections.Generic.KeyValuePair`2[MyClass0,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[MyClass0,System.Int32]])");
        Assert.AreEqual(b.BoxingAndNullableTest<object, int>(
            new MyGenClass1<KeyValuePair<object, int>>(),
            new MyGenStruct1<Dictionary<object, int>>(),
            new MyGenStruct1<Dictionary<object, int>>()),
            "BoxingAndNullableTest - Base::(MyGenClass1`1[System.Collections.Generic.KeyValuePair`2[System.Object,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[System.Object,System.Int32]] - MyGenStruct1`1[System.Collections.Generic.Dictionary`2[System.Object,System.Int32]])");
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static string GetString<X, Y>(X x, Y y)
    {
        return string.Join(" ", x, y);
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static GenClass1a<T> CallGenVirtMethod<T>(NormalClass n)
    {
        return n.GetGenClass1a<T>();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static IEnumerable<T> CallGenVirtMethod<T>(NormalClass n, object o)
    {
        return n.GetEnumerable<T>(o);
    }
}

interface IGenInterface<T>
{
    string InterfaceMethod1();
    IGenInterface<T> InterfaceMethod2<U>(U u);
}

class GenClass1a<T>
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public string CreateGenClass1b()
    {
        var x = new GenClass1b<T>();
        return x.ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string CreateGenClass1bArray()
    {
        var x = new GenClass1b<T>[3];
        return x.ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static string CallVirtual(GenClass1b<T> x)
    {
        return x.VirtualMethod();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static string CallInterface(IGenInterface<T> x)
    {
        return x.InterfaceMethod1();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static IGenInterface<U> CallInterface<U, V>(IGenInterface<U> x, V v)
    {
        return x.InterfaceMethod2(v);
    }
}

class GenClass1b<T> : IGenInterface<T>
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public virtual string VirtualMethod()
    {
        return ToString() + ".VirtualMethod";
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public virtual string InterfaceMethod1()
    {
        return ToString() + ".InterfaceMethod1";
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public virtual IGenInterface<T> InterfaceMethod2<U>(U u)
    {
        return this;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public bool IsGenClass1a(object o)
    {
        return o is GenClass1a<T>;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public GenClass1a<T> AsGenClass1a(object o)
    {
        return o as GenClass1a<T>;
    }
}

class GenClass1c<T> where T : new()
{
    public T t;

    [MethodImpl(MethodImplOptions.NoInlining)]
    public GenClass1c()
    {
        t = new T();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public GenClass1c(T _t)
    {
        t = _t;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public void SetT(object x)
    {
        t = (T)x;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public override string ToString()
    {
        return t.ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string ToStringEx<X>(X x)
    {
        return string.Join(" ", t, x);
    }
}

class GenClass2<T, U>
{
    T t;
    U u;

    [MethodImpl(MethodImplOptions.NoInlining)]
    public GenClass2(T t, U u)
    {
        this.t = t;
        this.u = u;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public override string ToString()
    {
        return t.ToString() + " " + u.ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string ToStringEx<X, Y>(X x, Y y)
    {
        return string.Join(" ", t, u, x, y);
    }
}

class NormalClass
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public virtual GenClass1a<T> GetGenClass1a<T>()
    {
        return new GenClass1a<T>();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public virtual IEnumerable<T> GetEnumerable<T>(object o)
    {
        T[] array = new T[1];
        array[0] = (T)o;
        return array;
    }
}

public interface IFoo<T> { string IFooFunc(); }
public class MyClass0 { }
public class MyClass1 { }
public class MyClass2 { }
public class MyGenClass1<T> { public override string ToString() { return this.GetType().ToString(); } }
public class MyGenClass2<T> { public override string ToString() { return this.GetType().ToString(); } }
public class MyGenClass3<T> { public override string ToString() { return this.GetType().ToString(); } }
public struct MyGenStruct1<T> { public override string ToString() { return this.GetType().ToString(); } }
public class MyIdClass0 { string _id; public MyIdClass0() { } public MyIdClass0(string id) { _id = id; } public override string ToString() { return "MyIdClass0=" + _id; } }
public class MyIdClass1 { string _id; public MyIdClass1() { } public MyIdClass1(string id) { _id = id; } public override string ToString() { return "MyIdClass1=" + _id; } }

public class GenBase<T, U> : IFoo<T> where T : new()
{
    public T m_fieldT;
    public U m_fieldU;
    public static T s_fieldT;
    public static U s_fieldU;
    [ThreadStatic]
    public static T st_fieldT;
    [ThreadStatic]
    public static U st_fieldU;

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void SetFieldsTest(GenBase<T, U> obj, T t1, T t2, T t3, U u1, U u2, U u3)
    {
        obj.m_fieldT = t1;
        GenBase<T, U>.s_fieldT = t2;
        GenBase<T, U>.st_fieldT = t3;

        obj.m_fieldU = u1;
        GenBase<T, U>.s_fieldU = u2;
        GenBase<T, U>.st_fieldU = u3;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void GetFieldsTest(GenBase<T, U> obj, string s1, string s2, string s3, U u1, U u2, U u3)
    {
        Assert.AreEqual(obj.m_fieldT.ToString(), s1);
        Assert.AreEqual(GenBase<T, U>.s_fieldT.ToString(), s2);
        Assert.AreEqual(GenBase<T, U>.st_fieldT.ToString(), s3);

        Assert.AreEqual(obj.m_fieldU, u1);
        Assert.AreEqual(GenBase<T, U>.s_fieldU, u2);
        Assert.AreEqual(GenBase<T, U>.st_fieldU, u3);
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    // BUG BUG BUG: bad codegen when method is private
    public string InstanceDelMethod(T t, U u)
    {
        return "InstanceDelMethod(" + this + " - " + t + " - " + u + ")";
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    // BUG BUG BUG: bad codegen when method is private
    public static string StaticDelMethod(T t, U u)
    {
        return "StaticDelMethod(" + t + " - " + u + ")";
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public Func<T, U, string>[] GetDelegateTest()
    {
        Func<T, U, string> del1 = this.InstanceDelMethod;
        Func<T, U, string> del2 = StaticDelMethod;
        return new Func<T, U, string>[] { del1, del2 };
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string IFooFunc()
    {
        return "IFooFunc - " + this.ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string IFaceCallTest(object ifoo)
    {
        IFoo<T> i = (IFoo<T>)ifoo;
        return "IFaceCallTest = " + i.IFooFunc();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetT()
    {
        return typeof(T).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetU()
    {
        return typeof(U).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetTArray()
    {
        return typeof(T[]).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetTBasedInst()
    {
        return typeof(MyGenClass2<MyGenClass1<T>>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string LdTokenTest()
    {
        return "LdTokenTest - " + typeof(Dictionary<T, U>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static string StaticNonGenMethod()
    {
        return "StaticNonGenMethod - " + typeof(List<T>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static string StaticGenMethod<V>()
    {
        return "StaticGenMethod - " + typeof(Dictionary<V, T>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string NewTest()
    {
        var a = new T();
        var b = new MyGenClass1<T>();
        var c = new T[10];
        var d = new T[30,30];
        var e = new MyGenClass3<T>[5];
        var f = new MyGenClass3<T>[5,13];
        return "NewTest - " + a + " - " + b + " - " + c + " - " + d + " - " + e + " - " + f;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string BoxingAndNullableTest(MyGenClass1<KeyValuePair<T,U>> t, MyGenStruct1<Dictionary<T,U>> u, MyGenStruct1<Dictionary<T,U>>? u2)
    {
        return "BoxingAndNullableTest - " + this + "::(" + t + " - " + u + " - " + u2 + ")";
    }
}

public class Base
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetT<T>()
    {
        return typeof(T).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetT<T, U>()
    {
        return typeof(T).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetU<T, U>()
    {
        return typeof(U).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetTArray<T>()
    {
        return typeof(T[]).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string GetTBasedInst<T>()
    {
        return typeof(MyGenClass2<MyGenClass1<T>>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string IFaceCallTest<T, U>(object ifoo)
    {
        IFoo<T> i = (IFoo<T>)ifoo;
        return "IFaceCallTest = " + i.IFooFunc();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string LdTokenTest<T, U>()
    {
        return typeof(Dictionary<T, U>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static string StaticGenMethod<T, U>()
    {
        return "StaticGenMethod - " + typeof(Dictionary<U, T>).ToString();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string NewTest<T, U>() where T : new()
    {
        var a = new T();
        var b = new MyGenClass1<T>();
        var c = new T[10];
        var d = new T[30, 30];
        var e = new MyGenClass2<T>[5];
        var f = new MyGenClass2<T>[5, 13];
        return "NewTest - " + a + " - " + b + " - " + c + " - " + d + " - " + e + " - " + f;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public string BoxingAndNullableTest<T, U>(MyGenClass1<KeyValuePair<T, U>> t, MyGenStruct1<Dictionary<T, U>> u, MyGenStruct1<Dictionary<T, U>>? u2)
    {
        return "BoxingAndNullableTest - " + this + "::(" + t + " - " + u + " - " + u2 + ")";
    }
}

public static class Assert
{
    public static bool HasAssertFired;

    public static void AreEqual(Object actual, Object expected)
    {
        if (!(actual == null && expected == null) && !actual.Equals(expected))
        {
            Console.WriteLine("Not equal!");
            Console.WriteLine("actual   = " + actual.ToString());
            Console.WriteLine("expected = " + expected.ToString());
            HasAssertFired = true;
        }
    }
}


text:
/**
 *
 */
package com.royalstone.vss.his;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.jdom.Element;

import com.royalstone.util.daemon.XResultAdapter;

/**
 * @author BaiJian
 * 带货安装单明细显示
 */
public class ShowSalePick {
	final private Connection conn;
	final private String sheetid;
	/**
	 * @param conn
	 * @param sheetid
	 * @param venderid
	 */
	public ShowSalePick(Connection conn, String sheetid) {
		super();
		this.conn = conn;
		this.sheetid = sheetid;
	}

	public Element getSheetHead() throws SQLException, IOException{
		String sql=" SELECT sp.sheetid,sp.refsheetid,sp.flag,sp.shopid,s.shopname,sp.saledate,sp.customer,sp.telephone, " +
		" sp.cman,sp.address,sp.deliverdate,sp.pickshopid,sp.pickdate,sp.consignee,sp.dman,sp.notes,sp.recordtime, " +
		" sp.deliverflag,sp.venderid,v.vendername,sp.paytypeid,sp.majorid,sp.editor,sp.operator,sp.editdate,sp.checker, " +
		" sp.checkdate,sp.trandate,sp.name,sp.btime,sp.servicephone,sp.sendphone,sp.nopayvalue " +
		" FROM salepick_cdept sp " +
		" INNER JOIN shop s ON ( s.shopid=sp.shopid ) " +
		" INNER JOIN vender v ON ( v.venderid=sp.venderid ) " +
		" where sp.sheetid=?";
		PreparedStatement pstmt = conn.prepareStatement( sql );
		pstmt.setString( 1, this.sheetid );
		ResultSet rs = pstmt.executeQuery();

		XResultAdapter adapter = new XResultAdapter( rs );
		Element elm_sheethead = adapter.getRowSetElement( "head", "rows" );
		rs.close();
		pstmt.close();

		return elm_sheethead;
	}

	public Element getSheetBody() throws SQLException, IOException{
		String sql=" SELECT spi.sheetid,spi.placeid,p.placename,spi.goodsid,g.barcode, " +
				" g.deptid,g.goodsname,spi.price,spi.qty,spi.discpricev,spi.disccostv " +
				" FROM salepickitem_cdept spi " +
				" INNER JOIN salepick_cdept sp ON ( sp.sheetid=spi.sheetid ) " +
				" INNER JOIN goods_cdept g ON ( g.goodsid=spi.goodsid ) " +
				" LEFT OUTER JOIN place p ON ( p.placeid=spi.placeid AND sp.shopid=p.shopid ) " +
				" where spi.sheetid=?";

		PreparedStatement pstmt = conn.prepareStatement( sql );
		pstmt.setString( 1, this.sheetid );
		ResultSet rs = pstmt.executeQuery();

		XResultAdapter adapter = new XResultAdapter( rs );
		Element elm_body = adapter.getRowSetElement( "body", "rows" );
		rs.close();
		pstmt.close();

		return elm_body;
	}

	public String getVenderId() throws SQLException{
		String venderid="";
		String sql=" select venderid from salepick_cdept where sheetid=?";
		PreparedStatement pstmt = conn.prepareStatement( sql );
		pstmt.setString( 1, this.sheetid );
		ResultSet rs = pstmt.executeQuery();
		if(rs.next())
			venderid=rs.getString(1);
		rs.close();
		pstmt.close();

		return venderid;
	}

	public int updateStatus(int oldStatus,int newStatus,String sheetid) throws SQLException{
		String sql="update cat_salepick_cdept set status=? where sheetid=? and status=?";
		PreparedStatement pstmt = conn.prepareStatement(sql);
		pstmt.setInt(1, newStatus);
		pstmt.setString(2, sheetid);
		pstmt.setInt(3, oldStatus);
		int i = pstmt.executeUpdate();
		pstmt.close();
		return i;
	}

	public Element getSheetDetail() throws SQLException, IOException{
		Element elm = new Element("sheet");
		elm.setAttribute("sheetname","rentnote");
		elm.addContent(getSheetHead());
		elm.addContent(getSheetBody());
		return elm;
	}
}


text:
@interface OTPAuthAboutWebViewController : UIViewController
  <UIWebViewDelegate, UIAlertViewDelegate> {
 @private
  NSURL *url_;
  NSString *label_;
  UIActivityIndicatorView *spinner_;
}
- (id)initWithURL:(NSURL *)url accessibilityLabel:(NSString *)label;
@end

@implementation OTPAuthAboutController

- (id)init {
  return [super initWithNibName:@"OTPAuthAboutController" bundle:nil];
}

- (void)viewDidLoad {
  UITableView *view = (UITableView *)[self view];
  [view setAccessibilityLabel:@"LegalOptions"];
  [view setBackgroundColor:[UIColor googleBlueBackgroundColor]];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // On an iPad, support both portrait modes and landscape modes.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation) ||
           UIInterfaceOrientationIsPortrait(interfaceOrientation);
  }
  // On a phone/pod, don't support upside-down portrait.
  return interfaceOrientation == UIInterfaceOrientationPortrait ||
         UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

#pragma mark -
#pragma mark TableView Delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return 1;
}

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section {
  return 3;
}

- (NSString *)tableView:(UITableView *)tableView
    titleForFooterInSection:(NSInteger)section {
  NSString *version
      = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
  version = [NSString stringWithFormat:@"Version: %@", version];
  return version;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {

  static NSString *CellIdentifier = @"AboutCell";

  UITableViewCell *cell
    = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (!cell) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
                                   reuseIdentifier:CellIdentifier] autorelease];
    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
  }

  NSString *text = nil;
  NSString *label = nil;
  switch([indexPath row]) {
    case 0:
      label = @"Terms of Service";
      text = GTMLocalizedString(@"Terms of Service",
                                @"Terms of Service Table Item Title");
      break;

    case 1:
      label = @"Privacy Policy";
      text = GTMLocalizedString(@"Privacy Policy",
                                @"Privacy Policy Table Item Title");
      break;

    case 2:
      label = @"Legal Notices";
      text = GTMLocalizedString(@"Legal Notices",
                                @"Legal Notices Table Item Title");
      break;

    default:
      label = @"Unknown Index";
      text = label;
      break;
  }
  [[cell textLabel] setText:text];
  [cell setIsAccessibilityElement:YES];
  [cell setAccessibilityLabel:label];
  return cell;
}

- (void)tableView:(UITableView *)tableView
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  NSURL *url = nil;
  NSString *label = nil;
  switch([indexPath row]) {
    case 0: {
      url = [NSURL URLWithString:@"http://m.google.com/tospage"];
      label = @"Terms of Service";
      break;
    }

    case 1:
      // Privacy appears to do the localization thing correctly. So no hacks
      // needed (contrast to case 0 above.
      url = [NSURL URLWithString:@"http://www.google.com/mobile/privacy.html"];
      label = @"Privacy Policy";
      break;

    case 2: {
        NSBundle *bundle = [NSBundle mainBundle];
        NSString *legalNotices = [bundle pathForResource:@"LegalNotices"
                                                  ofType:@"html"];
        url = [NSURL fileURLWithPath:legalNotices];
        label = @"Legal Notices";
      }
      break;

    default:
      break;
  }
  if (url) {
    OTPAuthAboutWebViewController *controller
        = [[[OTPAuthAboutWebViewController alloc] initWithURL:url
                                           accessibilityLabel:label]
           autorelease];
    [[self navigationController] pushViewController:controller animated:YES];
  }
}

@end

@implementation OTPAuthAboutWebViewController

- (id)initWithURL:(NSURL *)url accessibilityLabel:(NSString *)label {
  if ((self = [super initWithNibName:nil bundle:nil])) {
    url_ = [url retain];
    label_ = [label copy];
  }
  return self;
}

- (void)dealloc {
  [url_ release];
  [label_ release];
  [super dealloc];
}

- (void)loadView {
  UIWebView *webView
    = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease];
  [webView setScalesPageToFit:YES];
  [webView setDelegate:self];
  [webView setAccessibilityLabel:label_];
  NSURLRequest *request = [NSURLRequest requestWithURL:url_];
  [webView loadRequest:request];
  [self setView:webView];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // On an iPad, support both portrait modes and landscape modes.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation) ||
           UIInterfaceOrientationIsPortrait(interfaceOrientation);
  }
  // On a phone/pod, don't support upside-down portrait.
  return interfaceOrientation == UIInterfaceOrientationPortrait ||
         UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

#pragma mark -
#pragma mark UIWebViewDelegate

- (void)webViewDidStartLoad:(UIWebView *)webView {
  spinner_ = [[UIActivityIndicatorView alloc]
              initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
  CGRect bounds = webView.bounds;
  CGPoint middle = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
  [spinner_ setCenter:middle];
  [webView addSubview:spinner_];
  [spinner_ startAnimating];
}

- (void)stopSpinner {
  [spinner_ stopAnimating];
  [spinner_ removeFromSuperview];
  [spinner_ release];
  spinner_ = nil;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
  [self stopSpinner];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
  [self stopSpinner];
  NSString *errString
    = GTMLocalizedString(@"Unable to load webpage.",
                         @"Notification that a web page cannot be loaded");
  UIAlertView *alert
    = [[[UIAlertView alloc] initWithTitle:errString
                                  message:[error localizedDescription]
                                 delegate:nil
                        cancelButtonTitle:GTMLocalizedString(@"OK",
                                                             @"OK button")
                        otherButtonTitles:nil] autorelease];
  [alert setDelegate:self];
  [alert show];
}

#pragma mark -
#pragma mark UIAlertViewDelegate

- (void)alertView:(UIAlertView *)alertView
  clickedButtonAtIndex:(NSInteger)buttonIndex {
  [[self navigationController] popViewControllerAnimated:YES];
}

@end


text:
.class Lcom/android/server/DropBoxManagerService$2;
.super Landroid/database/ContentObserver;
.source "DropBoxManagerService.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/server/DropBoxManagerService;-><init>(Landroid/content/Context;Ljava/io/File;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/DropBoxManagerService;

.field final synthetic val$context:Landroid/content/Context;

# direct methods
.method constructor <init>(Lcom/android/server/DropBoxManagerService;Landroid/os/Handler;Landroid/content/Context;)V
    .locals 0
    .param p1, "this$0"    # Lcom/android/server/DropBoxManagerService;
    .param p2, "$anonymous0"    # Landroid/os/Handler;
    .param p3, "val$context"    # Landroid/content/Context;

    .prologue
    .line 151
    iput-object p1, p0, Lcom/android/server/DropBoxManagerService$2;->this$0:Lcom/android/server/DropBoxManagerService;

    iput-object p3, p0, Lcom/android/server/DropBoxManagerService$2;->val$context:Landroid/content/Context;

    invoke-direct {p0, p2}, Landroid/database/ContentObserver;-><init>(Landroid/os/Handler;)V

    return-void
.end method

# virtual methods
.method public onChange(Z)V
    .locals 3
    .param p1, "selfChange"    # Z

    .prologue
    .line 154
    iget-object v0, p0, Lcom/android/server/DropBoxManagerService$2;->this$0:Lcom/android/server/DropBoxManagerService;

    invoke-static {v0}, Lcom/android/server/DropBoxManagerService;->-get1(Lcom/android/server/DropBoxManagerService;)Landroid/content/BroadcastReceiver;

    move-result-object v1

    iget-object v2, p0, Lcom/android/server/DropBoxManagerService$2;->val$context:Landroid/content/Context;

    const/4 v0, 0x0

    check-cast v0, Landroid/content/Intent;

    invoke-virtual {v1, v2, v0}, Landroid/content/BroadcastReceiver;->onReceive(Landroid/content/Context;Landroid/content/Intent;)V

    .line 153
    return-void
.end method


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace JesseJohnston
{
	internal class FilterEvaluator<T> : FilterEvaluator
	{
		private T currentListItem;
		private Dictionary<FilterNode, Predicate<T>> nodePredicates;

		public FilterEvaluator(FilterNode expressionTree, PropertyDescriptorCollection listItemProperties) : base(expressionTree, listItemProperties)
		{
		}

		public bool Matches(T listItem)
		{
			if (listItem == null)
				throw new ArgumentNullException("listItem");
			this.currentListItem = listItem;

			bool result = this.tree.Evaluate(this.Evaluator);

			// The expression tree must be re-evaluated anew for each list item.
			this.tree.Reset();

			return result;
		}

		protected override void CreatePredicates(FilterNode tree, PropertyDescriptorCollection properties)
		{
			nodePredicates = new Dictionary<FilterNode, Predicate<T>>();

			List<PropertyDescriptor> propList = new List<PropertyDescriptor>();

			foreach (FilterNode node in tree)
			{
				// Only create predicates for terminal nodes.
				if (node.Term == null)
					continue;

				string propertyName = node.Term.PropertyName;
				string propertyValue = node.Term.Value;
				PropertyDescriptor property = null;

				// Verify that the property name in the expression is a property of the list item type.
				// If the property name is of the form "A.B", it is assumed to refer to a property of a property (a property path).
				if (propertyName.Contains("."))
				{
					property = new PropertyPathDescriptor(properties[0].ComponentType, propertyName);
				}
				else
				{
					foreach (PropertyDescriptor prop in properties)
					{
						if (prop.Name == propertyName)
						{
							property = prop;
							break;
						}
					}
				}

				if (property == null)
					throw new ArgumentException("The property '" + propertyName + "' is not a property of the list item type.", "Filter");

				if (!propList.Contains(property))
					propList.Add(property);

				// "null" is a special literal meaning a null value, not the characters 'n' 'u' 'l' 'l'.
				if (string.Compare(propertyValue, "null", true) == 0)
					propertyValue = null;

				// If the property is of string type, create a predicate that does regular expression matching.  Otherwise create a predicate
				// that uses the default Comparer<V> where V is the property type.
				Predicate<T> predicate = null;
				if (property.PropertyType == typeof(string))
				{
					predicate = new StringComparerPredicate<T>(property, propertyValue, node.Term.Operator).Matches;
				}
				else
				{
					Type predicateType = typeof(PropertyComparerPredicate<>).MakeGenericType(new Type[] { property.PropertyType });
					object pred = Activator.CreateInstance(predicateType, property, propertyValue, node.Term.Operator);
					predicate = (Predicate<T>)Delegate.CreateDelegate(typeof(Predicate<T>), pred, predicateType.GetMethod("Matches"));
				}

				// Save the predicate for use by the Evaluator method.
				this.nodePredicates.Add(node, predicate);
			}

			// Save the list of properties referenced in the filter expression.
			this.props = new PropertyDescriptorCollection(propList.ToArray(), true);
		}
		private bool Evaluator(FilterNode node)
		{
			return this.nodePredicates[node](this.currentListItem);
		}
	}
}


text: export * from './encrypting.service';


text:
/**
 * Defines the interface for an IDL that specifies the data types for properties on
 * a compliance metadata object
 * @interface IMetadataType
 */
export interface IMetadataType {
  // the expected type or types for the property with @name
  '@type': string | Array<string>;
  // the name of the property that should be on the metadata object
  '@name': string;
  // optional list of properties that are expected on the metadata object
  '@props'?: Array<IMetadataType>;
  // optional list of expected string values for an enum type (not implemented)
  '@symbols'?: Array<string>;
}


text:
layout: post
title: "My Blog Hosting Notes"
description: ""
category: notes
tags: [jekyll, github]
---

I started constructing this blog on GitHub from June 2014. This blog post will record tips and tricks I learned through the whole process. I will update it regularly.

##10/08/2014

I still did not decide the domain name for this website, so the website analytics and the feedburner functions haved not been implemented yet. At this time I mainly focus on my About page construction.

- Problem: Syntax Highligting does not function.
    Solution: In the blog root directory, type `pygmentize -S emacs -f html > syntax.css`, and move the syntax.css file to the `assets/theme/tom/css/` folder. Note that the pygmentize will result core dumped error, which has no influence on the produced css file.

- Problem: Create a new About page and add a link on the navigation bar.
    Solution: in the blog root directory, type `rake page name="about.md"` to generate a new About page. Also adjust the default page layout setting, which is configured by the file in `_includes/themes/tom/default.html`. Although the about.md file in the root directory is a markdown file, we still set the page url as /about.html as jekyll will translate the markdown file to html directly just like the index.md file.

- Problem: Headers in Tom theme do not have margins on the top and bottom.
    Solution: Adjust the css setting of headers in `assets/theme/tom/css/screen.css`.
    This will set 1em margin on the top and bottom of the h1 header. So when we want to have margins, we just choose the h1 headers.

{% highlight css %}
    h1 {
      margin-bottom: 1em;
      margin-top: 1em;
    }
{% endhighlight %}

#11/08/2014

Today I bought a domain name for my blog. I choose [GoDaddy](http://www.godaddy.com/) as it is the world's largest domain name registrar. After some thinking, I finally decided to buy `codingthoughts.today`, which is about 20 bucks per year. Then I followed the instructions [here](https://help.github.com/articles/tips-for-configuring-an-a-record-with-your-dns-provider) to set the A record.

As setting an A record for the apex domain is not recommended, the website loading speed is a little bit slow.

Later I decide to follow the [answer](http://stackoverflow.com/questions/23097397/github-pages-setting-up-custom-domain) from StackOverflow to change the DNS setting so that I can take advantage of the CDN and DoS services provided by GitHub Pages.

Finally I have my own domain name, next I can set the feedburner and the website analytics.

#11/08/2014

Google Analytics and feedburner are successfully added. I also remove some useless js link on the default.html file. A detailed review on this theme should be conducted as the original Github page has not been updated for two years already. There must be a lot of aspects in terms of layout, functionality, UX etc. to improve.

Everything works fine for my blog site right now. I deleted those useless website and plan to add my CV to the website. This website almost becomes a self-branding website already! Anyway I am Year 4 and finding job now:)

Back to the topic, I have subscribe my blog using feedly (I am currently the first and the only subscriber). However, my site shows like the figure below in the feedly.

![feedly status screenshot](/images/feedly-screenshot.jpg)

So it should be a good idea to add an relevant picture at the beginning of posts so that the future subscribers can have better user experience.

Btw, is there a spelling check plugin for vim? I guess there must be quite a lot of typos on my website!


text:
package org.javafp.javapickling.core;

import com.google.common.base.Optional;

public class OptionalPickler<PF, T> extends PicklerBase<Optional<T>, PF> {

    private final Pickler<T, PF> valuePickler;

    public OptionalPickler(PicklerCore<PF> core, Pickler<T, PF> valuePickler) {
        super(core, Optional.class);
        this.valuePickler = valuePickler;
    }

    @Override
    public PF pickle(Optional<T> optional, PF target) throws Exception {
        final PF target2 = boolean_p().pickle(optional.isPresent(), target);
        if (optional.isPresent()) {
            return valuePickler.pickle(optional.get(), target2);
        } else {
            return target2;
        }
    }

    @Override
    public Optional<T> unpickle(PF source) throws Exception {
        if (boolean_p().unpickle(source)) {
            return Optional.of(valuePickler.unpickle(source));
        } else {
            return Optional.absent();
        }
    }
}


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Contracts\Customer;

/**
*	Array list of possible valid address matches based on the entry supplied in the request.
*/
class AddressValidationResponse
{
	/**
	*Array list of possible valid address matches based on the entry supplied in the request.
	*/
	public $addressCandidates;

}

?>


text:
layout: post
title: Ideas for Holidays?
date: '2011-02-09T18:19:00.001Z'
author: John Overington
tags:
- Some Of The Interesting Things You'll See On A Long Distance Flight
modified_time: '2011-02-10T08:18:36.718Z'
thumbnail: http://4.bp.blogspot.com/_SlPG9DIz_AA/TVLaeB-W8uI/AAAAAAAABAY/mCzZ_9R9Mx8/s72-c/IMG_1502.jpg
blogger_id: tag:blogger.com,1999:blog-2546008714740235720.post-8864593042922599142
blogger_orig_url: http://chembl.blogspot.com/2011/02/ideas-for-holidays.html
---

There is a cool travel guide (cool if you are a nerdy scientist, I am!) available on the website of the British Society for the History of Science (BSHS). Don't worry, it doesn't just deal with staycations, but with interesting places around the whole world.


text:
package com.intellij.ide;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.impl.welcomeScreen.NewRecentProjectPanel;
import com.intellij.util.ui.UIUtil;

import javax.swing.*;

/**
 * @author Konstantin Bulenkov
 */
public class ManageRecentProjectsAction extends DumbAwareAction {
  @Override
  public void actionPerformed(AnActionEvent e) {
    Disposable disposable = Disposer.newDisposable();
    NewRecentProjectPanel panel = new NewRecentProjectPanel(disposable);
    JList list = UIUtil.findComponentOfType(panel, JList.class);
    JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, list)
      .setTitle("Recent Projects")
      .setFocusable(true)
      .setRequestFocus(true)
      .setMayBeParent(true)
      .setMovable(true)
      .createPopup();
    Disposer.register(popup, disposable);
    Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    popup.showCenteredInCurrentWindow(project);
  }

  @Override
  public void update(AnActionEvent e) {
    Project project = e.getProject();
    boolean enable = false;
    if (project != null) {
      enable = RecentProjectsManager.getInstance().getRecentProjectsActions(false).length > 0;
    }

    e.getPresentation().setEnabledAndVisible(enable);
  }
}


text:
package org.macrogl

import scala.language.experimental.macros
import scala.reflect.macros.Context
import scala.collection._

package object ex {

  object computing {
    object MeshBufferObject {
      def foreach[U](f: Unit => U)(implicit glex: Macroglex): Unit =
        macro ex.MeshBuffer.computing[U]
    }
    object AttributeBufferObject {
      def foreach[U](f: Unit => U)(implicit glex: Macroglex): Unit =
        macro ex.AttributeBuffer.computing[U]
    }

    def meshbuffer(layoutIndex: Int, mesh: MeshBuffer) = MeshBufferObject
    def attributebuffer(layoutIndex: Int, mesh: AttributeBuffer) = AttributeBufferObject
  }

}