text:
package de.machmireinebook.epubeditor.htmlcleaner;

/**
 * @author patmoore
 *
 */
public enum BelongsTo {

    HEAD_AND_BODY("all"),
    HEAD("head"),
    BODY("body");
    private final String dbCode;
    private BelongsTo(String dbCode) {
        this.dbCode =dbCode;
    }

    /**
     * @return the dbCode
     */
    public String getDbCode() {
        return dbCode;
    }

    public static BelongsTo toValue(Object value) {
        BelongsTo result = null;
        if ( value instanceof BelongsTo) {
            result = (BelongsTo) value;
        } else if ( value != null ) {
            String dbCode = value.toString().trim();
            for(BelongsTo belongsTo: BelongsTo.values()) {
                if ( belongsTo.getDbCode().equalsIgnoreCase(dbCode) || belongsTo.name().equalsIgnoreCase(dbCode)) {
                    result = belongsTo;
                    break;
                }
            }
        }

        return result;
    }
}


text:
import unittest

import TestCommand
import TestFilter
import TestRelational
import TestRelationalCommand
import TestRelationalPickle

def additional_tests():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestFilter.TestCase, 'test'))
    suite.addTest(unittest.makeSuite(TestRelational.TestCase, 'test'))
    suite.addTest(unittest.makeSuite(TestRelationalCommand.TestCase, 'test'))
    suite.addTest(unittest.makeSuite(TestRelationalPickle.TestCase, 'test'))
    return suite

redpajama_set_name: RedPajamaGithub


text:
This is a demo project intended to display implementation examples of Elasto.js.
Download the source package or visit the
[sandbox demo site](https://godiagonal.github.io/elasto-js/demo) to try it out.

Note: When using Elasto.js it's a good idea to override elasto.css styles in a custom
css file to avoid loss of data when updating to a new version of the library. See
[elasto-custom.css](css/elasto-custom.css) for an example on how to do this.


text:
angular.module('jobApp')
.controller('ShowApplicantsController', function($scope) {

    $scope.message = 'This is the Show Applicants screen';

});


text:
/**
* <TextInput>
* Kevin Lee 3 Sept 2017
**/

import React from 'react'
import {
  Screen, Bar, Block,
  DataBar, DataBlock,
  Text, CheckBox, Input,
  Roll,
} from 'rn-naive'

export default class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      disabled: false,
      d1: '',
      d2: '',
      d3: '',
      d4: '',
      d5: '',
    }
  }
  logos = [
      {icon:'logo-android', text:'Android'},
      {icon:'logo-apple', text:'Apple'},
      {icon:'logo-dropbox', text:'Dropbox'},
      {icon:'logo-facebook', text:'Facebook'},
      {icon:'logo-playstation', text:'PlayStation'},
      {icon:'logo-xbox', text:'X-Box'},
  ]
  genders = [
      {icon:'md-man', text:'Man', iconColor:'green', textStyle:{color:'green'}},
      {icon:'md-woman', text:'Woman', iconColor:'red', textStyle:{color:'red'}},
  ]
  render() {
    k = 1
    return (
      <Screen lines={16}
        title='<Roll Input> Control Test'
        left={<CheckBox iconOnly
          style={{alignItems:'flex-start'}}
          iconSize={20}
          iconColor='#ddd'
          icons={['md-eye-off', 'md-eye']}
          value={this.state.DisableAll}
          onValueChange={(disabled)=>this.setState({disabled})}
        />}
      >
        <Bar lines={2} text={<Text D3>Roll Input change value upon user clicks. It is styled to align with other input elements.</Text>} />
        <Block lines={7} style={{borderWidth:1, margin:2}}>
          <DataBar
            text={(k++) + '. Basic Input'}
            input={<Input disabled={this.state.disabled}/>}
          />
          <DataBar
            text={(k++) + '. Basic Roll Input'}
            input={<Roll input items={this.logos}
              disabled={this.state.disabled}
              value={this.state.d1}
              onValueChange={(d1)=>this.setState({d1})}
            />}
          />
          <DataBar
            text={(k++) + '. Underlined Input'}
            input={<Input underline disabled={this.state.disabled}/>}
          />
          <DataBar
            text={(k++) + '. Underlined Roll Input'}
            input={<Roll input items={this.logos}
              underline
              disabled={this.state.disabled}
              value={this.state.d2}
              onValueChange={(d2)=>this.setState({d2})}
            />}
          />
          <DataBar
            text={(k++) + '. Underlined IconOnly Roll'}
            input={<Roll input items={this.logos} iconOnly underline
              disabled={this.state.disabled}
              value={this.state.d5}
              onValueChange={(d5)=>this.setState({d5})}
            />}
          />
          <DataBar lines={1.5}
            text={(k++) + '. Underlined IconOnly Roll'}
            input={<Roll input items={this.logos} iconTop underline
              disabled={this.state.disabled}
              value={this.state.d5}
              onValueChange={(d5)=>this.setState({d5})}
            />}
          />
        </Block>
        <Bar lines={2}>
          <DataBlock style={{borderWidth:1}}
            text={(k++) + '. Basic Input'}
            input={<Input disabled={this.state.disabled}/>}
          />
          <DataBlock style={{borderWidth:1}}
            text={(k++) + '. Basic Roll Input'}
            input={<Roll input items={this.genders} iconRight
              disabled={this.state.disabled}
              value={this.state.d3}
              onValueChange={(d3)=>this.setState({d3})}
            />}
          />
        </Bar>
        <Bar lines={2}>
          <DataBlock style={{borderWidth:1}}
            text={(k++) + '. Underlined Input'}
            input={<Input underline disabled={this.state.disabled}/>}
          />
          <DataBlock style={{borderWidth:1}}
            text={(k++) + '. Underlined Roll Input'}
            input={<Roll input items={this.genders} iconRight underline
              disabled={this.state.disabled}
              value={this.state.d4}
              onValueChange={(d4)=>this.setState({d4})}
            />}
          />
        </Bar>
      </Screen>
    )
  }
}


text:
/** Automatically generated file. DO NOT MODIFY */
package com.xinfan.blueblue;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}


text:
package org.openqa.grid.web.servlet;

import static com.google.common.net.MediaType.JSON_UTF_8;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.openqa.selenium.remote.ErrorCodes.SUCCESS;

import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.internal.BuildInfo;
import org.openqa.selenium.json.Json;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class NodeW3CStatusServlet extends HttpServlet {

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    ImmutableMap.Builder<String, Object> value = ImmutableMap.builder();

    // W3C spec
    value.put("ready", true);
    value.put("message", "Node is running");

    BuildInfo buildInfo = new BuildInfo();
    value.put("build", ImmutableMap.of(
        // We need to fix the BuildInfo to properly fill out these values.
        "revision", buildInfo.getBuildRevision(),
        "time", buildInfo.getBuildTime(),
        "version", buildInfo.getReleaseLabel()));

    value.put("os", ImmutableMap.of(
        "arch", System.getProperty("os.arch"),
        "name", System.getProperty("os.name"),
        "version", System.getProperty("os.version")));

    value.put("java", ImmutableMap.of("version", System.getProperty("java.version")));

    Map<String, Object> payloadObj = ImmutableMap.of(
        "status", SUCCESS,
        "value", value.build());

    // Write out a minimal W3C status response.
    byte[] payload = new Json().toJson(payloadObj).getBytes(UTF_8);

    resp.setStatus(HTTP_OK);
    resp.setHeader("Content-Type", JSON_UTF_8.toString());
    resp.setHeader("Content-Length", String.valueOf(payload.length));

    try (ServletOutputStream out = resp.getOutputStream()) {
      out.write(payload);
    }

  }
}


text:
import './App.css';
import Layout from './components/Layout/Layout';
import Home from './containers/Home';
import { ElectronProvider } from './contexts';

function App() {
  return (
    <ElectronProvider>
      <Layout>
        <Home />
      </Layout>
    </ElectronProvider>
  );
}

export default App;


text:
#pragma once

#include "ObjectExtractorLibrary.h"
using namespace System;
using namespace Runtime::InteropServices;

namespace NumberExtractor
{
	public ref class NumberExtractorLibrary
	{
	public:
		bool ProcessImages(System::String ^ fileName)
		{
			char* filename;

			try
			{
				filename = (char*)(Marshal::StringToHGlobalAnsi(fileName)).ToPointer();

				ObjectExtractorLibrary library(filename);
				library.ExtractAndSaveObjects();

				return true;
			}
			catch(...)
			{
				return false;
			}
			finally
			{
				Marshal::FreeHGlobal(IntPtr((void*)filename));
			}
		}
	};
}


text:
<?php

class Auth_Yadis_HTTPResponse {
    function Auth_Yadis_HTTPResponse($final_url = null, $status = null,
                                         $headers = null, $body = null)
    {
        $this->final_url = $final_url;
        $this->status = $status;
        $this->headers = $headers;
        $this->body = $body;
    }
}

/**
 * This class is the interface for HTTP fetchers the Yadis library
 * uses.  This interface is only important if you need to write a new
 * fetcher for some reason.
 *
 * @access private
 * @package OpenID
 */
class Auth_Yadis_HTTPFetcher {

    var $timeout = 20; // timeout in seconds.

    /**
     * Return whether a URL should be allowed. Override this method to
     * conform to your local policy.
     *
     * By default, will attempt to fetch any http or https URL.
     */
    function allowedURL($url)
    {
        return $this->URLHasAllowedScheme($url);
    }

    /**
     * Does this fetcher implementation (and runtime) support fetching
     * HTTPS URLs?  May inspect the runtime environment.
     *
     * @return bool $support True if this fetcher supports HTTPS
     * fetching; false if not.
     */
    function supportsSSL()
    {
        trigger_error("not implemented", E_USER_ERROR);
    }

    /**
     * Is this an https URL?
     *
     * @access private
     */
    function isHTTPS($url)
    {
        return (bool)preg_match('/^https:\/\//i', $url);
    }

    /**
     * Is this an http or https URL?
     *
     * @access private
     */
    function URLHasAllowedScheme($url)
    {
        return (bool)preg_match('/^https?:\/\//i', $url);
    }

    /**
     * @access private
     */
    function _findRedirect($headers)
    {
        foreach ($headers as $line) {
            if (strpos($line, "Location: ") === 0) {
                $parts = explode(" ", $line, 2);
                return $parts[1];
            }
        }
        return null;
    }

    /**
     * Fetches the specified URL using optional extra headers and
     * returns the server's response.
     *
     * @param string $url The URL to be fetched.
     * @param array $extra_headers An array of header strings
     * (e.g. "Accept: text/html").
     * @return mixed $result An array of ($code, $url, $headers,
     * $body) if the URL could be fetched; null if the URL does not
     * pass the URLHasAllowedScheme check or if the server's response
     * is malformed.
     */
    function get($url, $headers)
    {
        trigger_error("not implemented", E_USER_ERROR);
    }
}

?>


text:
A [Sass](https://github.com/sass/sass) docker container

- built on top of `alpine` base image
- ~24 MB in size

## Setup

If you don't already have docker setup you'll need to install VirtualBox and boot2docker.

### VirtualBox

You can get VirtualBox from their [download page](https://www.virtualbox.org/wiki/Downloads).

### boot2docker

##### OSX

You can install boot2docker by
- `brew install boot2docker` (osx only)
- download the [osx installer](https://github.com/boot2docker/osx-installer/releases)

Once installed follow [official setup instructions](http://docs.docker.com/installation/mac/#from-your-command-line)

##### Windows

Follow [official setup instructions](http://docs.docker.com/installation/windows/)

## Versions

When pulling or running an this container you can select which version of Libsass you want to use. The currently supported versions are:

- 3.2
- 3.3
- 3.4

## Usage

The image has the `scss` binary as its entrypoint, so it should be invoked with whatever arguments you would normally pass to `scss`. For example,

```bash
$ cat file.scss
$blue: #00f;
.foo { color: $blue; }
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) xzyfer/docker-ruby-sass:<version> file.scss
.foo {
  color: #00f; }
```

You may also want to create a bash alias:

```bash
alias scss="docker run -it --rm -v \$(pwd):\$(pwd) -w \$(pwd) xzyfer/docker-ruby-libsass:3.4"
```

so you will be able to simply run

```
$ scss file.scss
.foo {
  color: #00f; }
```


text:
__author__ = 'richard'

import logging
from datetime import datetime

from scipy.optimize import minimize_scalar

from roboskeeter.experiments import start_simulation
from roboskeeter.scripts import load_mosquito_kde_data_dicts

# wrapper func for agent 3D
def fly_wrapper(BOUNCE_COEFF, *args):
    """
    :param bias_scale_BOUNCE_COEFF:
    :param mass_BOUNCE_COEFF:
        mean mosquito mass is 2.88e-6
    :param damping_BOUNCE_COEFF:
        estimated damping was 5e-6, # cranked up to get more noise #5e-6,#1e-6,  # 1e-5
    :return:
    """
    print """
    ####a##########################################################
    BOUNCE_COEFF: {}
    ##############################################################""".format(BOUNCE_COEFF)
    N_TRAJECTORIES = 100

    experiment_kwargs = {'condition': 'Control',
                         'time_max': 6.,
                         'bounded': True,
                         'number_trajectories': N_TRAJECTORIES
                         }

    agent_kwargs = {'random_f_strength': 6.55599224e-06,
                    'stim_f_strength': 0.,
                    'damping_coeff': 3.63674551e-07,
                    'collision_type': 'part_elastic',
                    'restitution_coeff': BOUNCE_COEFF,
                    'stimulus_memory': 100,
                    'decision_policy': 'cast_only',  # 'surge_only', 'cast_only', 'cast+surge', 'ignore'
                    'initial_position_selection': 'downwind_high',
                    'verbose': False
                    }

    (EXP_BINS, EXP_VALS) = args

    simulation, trajectory_s, windtunnel, plume, agent = start_simulation(agent_kwargs, experiment_kwargs)

    combined_score, score_components, _ = trajectory_s.calc_score(ref_ensemble=(EXP_BINS, EXP_VALS))

    global HIGH_SCORE
    global BEST_BOUNCE_COEFF
    if combined_score < HIGH_SCORE:
        HIGH_SCORE = combined_score
        BEST_BOUNCE_COEFF = BOUNCE_COEFF
        string = "{0} New high score: {1}. BOUNCE_COEFF: {2}. Score components = {3}".format(datetime.now(), HIGH_SCORE,
                                                                                BOUNCE_COEFF,
                                                                                score_components)
        print(string)
        logging.info(string)

    return combined_score

def main(x_0=None):
    logging.basicConfig(filename='optimize_restitution_coeff.log', level=logging.DEBUG)

    global HIGH_SCORE
    HIGH_SCORE = 1e10

    global BEST_BOUNCE_COEFF
    BEST_BOUNCE_COEFF = None

    print "Starting optimizer."

    result = minimize_scalar(
        fly_wrapper,
        bounds=(0., 1.),
        method='bounded',
        args=(load_mosquito_kde_data_dicts())
    )

    return BEST_BOUNCE_COEFF, HIGH_SCORE, result

if __name__ == '__main__':
    BEST_BOUNCE_COEFF, HIGH_SCORE, result = main()

    msg = """############################################################
    Trial end. FINAL BOUNCE_COEFF: {0}
    SCORE: {1}
     {2}
    ############################################################""".format(BEST_BOUNCE_COEFF, HIGH_SCORE, result)

    logging.info(msg)
    print msg


text:
package com.cyf.base.common.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Created by chenyf on 2017/3/20.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Permission {

}


text:
package au.com.mountainpass.hyperstate.client;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.KeyDeserializer;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;

@Component
public class SpringBeanHandlerInstantiator extends HandlerInstantiator {

  private final ApplicationContext applicationContext;

  @Autowired
  public SpringBeanHandlerInstantiator(final ApplicationContext applicationContext) {
    this.applicationContext = applicationContext;
  }

  /*
   * (non-Javadoc)
   *
   * @see com.fasterxml.jackson.databind.cfg.HandlerInstantiator#
   * deserializerInstance(com.fasterxml.jackson.databind. DeserializationConfig,
   * com.fasterxml.jackson.databind.introspect.Annotated, java.lang.Class)
   */
  @Override
  public JsonDeserializer<?> deserializerInstance(final DeserializationConfig config,
      final Annotated annotated, final Class<?> deserClass) {
    return (JsonDeserializer<?>) findInstance(deserClass);
  }

  private Object findInstance(final Class<?> type) {

    return BeanUtils.instantiateClass(type);
  }

  /*
   * (non-Javadoc)
   *
   * @see com.fasterxml.jackson.databind.cfg.HandlerInstantiator#
   * keyDeserializerInstance(com.fasterxml.jackson.databind. DeserializationConfig,
   * com.fasterxml.jackson.databind.introspect.Annotated, java.lang.Class)
   */
  @Override
  public KeyDeserializer keyDeserializerInstance(final DeserializationConfig config,
      final Annotated annotated, final Class<?> keyDeserClass) {
    return (KeyDeserializer) findInstance(keyDeserClass);
  }

  /*
   * (non-Javadoc)
   *
   * @see com.fasterxml.jackson.databind.cfg.HandlerInstantiator#serializerInstance
   * (com.fasterxml.jackson.databind.SerializationConfig,
   * com.fasterxml.jackson.databind.introspect.Annotated, java.lang.Class)
   */
  @Override
  public JsonSerializer<?> serializerInstance(final SerializationConfig config,
      final Annotated annotated, final Class<?> serClass) {
    return (JsonSerializer<?>) findInstance(serClass);
  }

  /*
   * (non-Javadoc)
   *
   * @see com.fasterxml.jackson.databind.cfg.HandlerInstantiator#
   * typeIdResolverInstance(com.fasterxml.jackson.databind.cfg.MapperConfig,
   * com.fasterxml.jackson.databind.introspect.Annotated, java.lang.Class)
   */
  @Override
  public TypeIdResolver typeIdResolverInstance(final MapperConfig<?> config,
      final Annotated annotated, final Class<?> resolverClass) {
    return (TypeIdResolver) findInstance(resolverClass);
  }

  /*
   * (non-Javadoc)
   *
   * @see com.fasterxml.jackson.databind.cfg.HandlerInstantiator#
   * typeResolverBuilderInstance(com.fasterxml.jackson.databind.cfg. MapperConfig,
   * com.fasterxml.jackson.databind.introspect.Annotated, java.lang.Class)
   */
  @Override
  public TypeResolverBuilder<?> typeResolverBuilderInstance(final MapperConfig<?> config,
      final Annotated annotated, final Class<?> builderClass) {
    return (TypeResolverBuilder<?>) findInstance(builderClass);
  }
}


text:
'use strict';

import assert from 'assert';
import { isolate as i } from '../util';
import { Env } from '../../../src/lib/env';
import { fetchResource } from '../../../src/runtime/node/io';

const path = __dirname + '/..';
const langs = [
  { code: 'pl', src: 'app' },
  { code: 'en-US', src: 'app' },
];

function assertValue(promise, expected, done) {
  promise.then(function(value) {
    assert.strictEqual(value[0], expected);
  }).then(done, done);
}

describe('One fallback locale', function() {
  var env, ctx;

  beforeEach(function(done) {
    env = new Env(fetchResource);
    ctx = env.createContext(langs, [path + '/fixtures/{locale}.properties']);
    ctx.fetch().then(() => done(), done);
  });

  describe('Translation in the first locale exists and is OK', function() {
    it('[e]', function(done) {
      assertValue(ctx.formatValues('e'), 'E pl', done);
    });
  });

  describe('ValueError in first locale', function() {
    describe('Entity exists in second locale:', function() {
      it('[ve]', function(done) {
        assertValue(
          ctx.formatValues('ve'),
          i('VE {{ boo }} pl', '{{ boo }}'),
          done);
      });
    });

    describe('ValueError in second locale:', function() {
      it('[vv]', function(done) {
        assertValue(
          ctx.formatValues('vv'),
          i('VV {{ boo }} pl', '{{ boo }}'),
          done);
      });
    });

    describe('IndexError in second locale:', function() {
      it('[vi]', function(done) {
        assertValue(
          ctx.formatValues('vi'),
          i('VI {{ boo }} pl', '{{ boo }}'),
          done);
      });
    });

    describe('Entity missing in second locale:', function() {
      it('[vm]', function(done) {
        assertValue(
          ctx.formatValues('vm'),
          i('VM {{ boo }} pl', '{{ boo }}'),
          done);
      });
    });
  });

  describe('IndexError in first locale', function() {
    describe('Entity exists in second locale', function() {
      it('[ie]', function(done) {
        assertValue(ctx.formatValues('ie'), 'ie', done);
      });
    });

    describe('ValueError in second locale', function() {
      it('[iv]', function(done) {
        assertValue(ctx.formatValues('iv'), 'iv', done);
      });
    });

    describe('IndexError in second locale', function() {
      it('[ii]', function(done) {
        assertValue(ctx.formatValues('ii'), 'ii', done);
      });
    });

    describe('Entity missing in second locale:', function() {
      it('[im]', function(done) {
        assertValue(ctx.formatValues('im'), 'im', done);
      });
    });
  });

  describe('Entity not found in first locale', function() {
    describe('Entity exists in second locale:', function() {
      it('[me]', function(done) {
        assertValue(ctx.formatValues('me'), 'ME en-US', done);
      });
    });

    describe('ValueError in second locale:', function() {
      it('[mv]', function(done) {
        assertValue(
          ctx.formatValues('mv'),
          i('MV {{ boo }} en-US', '{{ boo }}'),
          done);
      });
    });

    describe('IndexError in second locale:', function() {
      it('[mi]', function(done) {
        assertValue(ctx.formatValues('mi'), 'mi', done);
      });
    });

    describe('Entity missing in second locale:', function() {
      it('[mm]', function(done) {
        assertValue(ctx.formatValues('mm'), 'mm', done);
      });
    });
  });
});


text:
package commands.control;

import commands.basic.CommandList;
import model.TurtleState;

/**
 * The Class IfElse.
 */
public class IfElse extends CommandList{

	@Override
	public double doCommand(TurtleState turtleState) {
		double condition = (Double) getInputs().get(0).doCommand(turtleState);
		double result = -1;
		if(condition!=0){
			for(int i=1; i<getNumInputs(); i++){
				result = getInputs().get(i).doCommand(turtleState);
			}
			return result;
		}

		for(int i=0; i<getNumFalseInputs(); i++){
			result = getFalseInputs().get(i).doCommand(turtleState);
		}
		return result;
	}

}


text:
<?php

namespace User\Model;

class User
{
    const IS_ACTIVE = 1;
    const IS_NOT_ACTIVE = 0;

    const SUPER_USER = 4;
    const INVESTOR = 1;
    const ADVISER = 2;
    const VISITOR = 3;

    public $id;
    public $email;
    public $roleId;
    public $action;
    public $dateCreate;
    public $pass;
    public $urlImg;
    public $keyAction;
    public $keyReset;
    public $keyMail;
    public $keyDelete;

    public $map = array(
        'id' => 'id',
        'email' => 'email',
        'roleId' => 'role_id',
        'action' => 'action',
        'dateCreate' => 'data_create',
        'pass' => 'pass',
        'urlImg' => 'url_img',
        'keyAction' => 'key_action',
        'keyReset' => 'key_reset',
        'keyMail' => 'key_mail',
        'keyDelete' => 'key_delete',
    );

    public function exchangeArray($data)
    {
        foreach ($this->map as $key =>$value) {
            (array_key_exists($value,$data)) ? $this->$key = $data[$value] : false;
        }
    }

    public static $roleMap = array(
        self::SUPER_USER => 'SUPER_USER',
        self::INVESTOR => 'INVESTOR',
        self::ADVISER => 'ADVISER',
        self::VISITOR => 'VISITOR',
    );

    public static $statusMap = array(
        self::IS_ACTIVE => 'Active',
        self::IS_NOT_ACTIVE => 'Inactive',
    );

    public static function isAdmin($id) {
        return self::SUPER_USER == $id;
    }

    public static function getRoleName() {
        return self::$roleMap;
    }

    public static function getRoleNameById($id) {
        return self::$roleMap[$id];
    }

    public static function getStatusNameById($id) {
        return self::$statusMap[$id];
    }

}


text:
package org.mmymoney.gateway.repository;

import org.mmymoney.gateway.domain.User;

import java.time.ZonedDateTime;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;

/**
 * Spring Data JPA repository for the User entity.
 */
public interface UserRepository extends JpaRepository<User, Long> {

    Optional<User> findOneByActivationKey(String activationKey);

    List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);

    Optional<User> findOneByResetKey(String resetKey);

    Optional<User> findOneByEmail(String email);

    Optional<User> findOneByLogin(String login);

    @Query(value = "select distinct user from User user left join fetch user.authorities",
        countQuery = "select count(user) from User user")
    Page<User> findAllWithAuthorities(Pageable pageable);
}


text:
const extensionManifest = require("./manifest.json");
const getLanguages = require("./views/website/libraries/support/get-languages.js");

module.exports = (grunt) => {
    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-contrib-stylus");
    grunt.loadNpmTasks("grunt-contrib-pug");
    grunt.loadNpmTasks("grunt-webpack");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-mocha-test");
    grunt.loadNpmTasks("grunt-contrib-connect");
    grunt.loadNpmTasks("grunt-exec");
    grunt.loadNpmTasks("grunt-crx");

    grunt.initConfig({
        clean: {
            website: ["dist/website"],
            extension: ["dist/extension"],
        },

        copy: {
            website: {
                files: [{
                        expand: true,
                        cwd: "img/website",
                        src: ["**"],
                        dest: "dist/website/img",
                    },
                    {
                        expand: true,
                        src: ["fonts/**", "opensearch.xml"],
                        dest: "dist/website",
                    },
                    {
                        expand: true,
                        flatten: true,
                        src: [
                            "node_modules/bootstrap/dist/css/bootstrap.min.css",
                            "node_modules/codemirror/lib/codemirror.css",
                            "node_modules/codemirror/addon/lint/lint.css",
                            "css/budicon.css",
                            "css/google-roboto-mono.css",
                        ],
                        dest: "dist/website/css/",
                    },
                    {
                        src: ["sitemap.xml"],
                        dest: "dist/website/",
                    },
                ],
            },
            extension: {
                files: [{
                        expand: true,
                        flatten: true,
                        src: ["manifest.json", "html/extension/bg.html"],
                        dest: "dist/extension",
                    },
                    {
                        expand: true,
                        cwd: "img/extension",
                        src: ["**"],
                        dest: "dist/extension/img",
                    },
                    {
                        expand: true,
                        src: ["fonts/**"],
                        dest: "dist/extension",
                    },
                    {
                        expand: true,
                        flatten: true,
                        src: [
                            "node_modules/bootstrap/dist/css/bootstrap.min.css",
                            "node_modules/codemirror/lib/codemirror.css",
                            "node_modules/codemirror/addon/lint/lint.css",
                            "css/budicon.css",
                            "css/google-roboto-mono.css",
                        ],
                        dest: "dist/extension/css/",
                    },
                ],
            },
        },

        crx: {
            pack: {
                src: "dist/extension/**/*",
                dest: "dist/chrome-jwt-debugger-extension-v" +
                    `${extensionManifest.version}.zip`,
            },
        },

        exec: {
            firefoxExtensionPack: {
                command: "node_modules/web-ext/bin/web-ext build " +
                    "--source-dir=dist/extension --artifacts-dir=dist " +
                    "--overwrite-dest",
            },
            renameFirefoxExtension: {
                command: `mv dist/jwt_debugger-${extensionManifest.version}.zip ` +
                    "dist/firefox-jwt-debugger-extension-" +
                    `v${extensionManifest.version}.zip`,
            },
        },

        stylus: {
            website: {
                files: {
                    "dist/website/css/index.css": "stylus/website/index.styl",
                },
            },
            extension: {
                files: {
                    "dist/extension/css/index.css": "stylus/extension/index.styl",
                },
            },
        },

        pug: {
            extension: {
                files: {
                    "dist/extension/index.html": "views/extension/index.pug",
                },
            },
        },

        webpack: {
            websiteProd: require("./webpack.website-prod.js"),
            websiteDev: require("./webpack.website-dev.js"),
            extensionProd: require("./webpack.extension-prod.js"),
            extensionDev: require("./webpack.extension-dev.js"),
            unitTests: require("./webpack.website-unit-tests.js"),
        },

        watch: {
            websiteSrc: {
                files: ["src/*.js", "src/website/**", "src/editor/**"],
                tasks: "webpack:websiteDev",
            },
            extensionSrc: {
                files: ["src/*.js", "src/extension/**", "src/editor/**"],
                tasks: "webpack:extensionDev",
            },
            websiteImg: {
                files: ["img/website/**"],
                tasks: "copy:website",
            },
            extensionImg: {
                files: ["img/extension/**"],
                tasks: "copy:extension",
            },
            opensearch: {
                files: "opensearch.xml",
                tasks: "copy:website",
            },
            assets: {
                files: [
                    "fonts/**",
                    "node_modules/bootstrap/dist/css/bootstrap.min.css",
                    "node_modules/codemirror/lib/codemirror.css",
                    "node_modules/codemirror/addon/lint/lint.css",
                    "css/budicon.css",
                ],
                tasks: "copy",
            },
            websiteViews: {
                files: [
                    "stylus/*.styl",
                    "stylus/website/**",
                    "views/*.pug",
                    "views/website/**",
                ],
                tasks: ["build-website-views"],
            },
            extensionViews: {
                files: [
                    "stylus/*.styl",
                    "stylus/extension/**",
                    // Yes, we still share styles with the website, it's really hard
                    // to refactor them out without breaking stuff
                    "stylus/website/**",
                    "views/*.pug",
                    "views/extension/**",
                ],
                tasks: ["build-extension-views"],
            },
        },

        mochaTest: {
            unit: {
                options: {},
                src: ["dist/test/unit-tests.js"],
            },
            functional: {
                options: {
                    // Higher default timeout to account for some animations
                    timeout: 10000,
                },
                src: ["test/functional/**.js"],
            },
        },

        connect: {
            website: {
                options: {
                    hostname: "127.0.0.1",
                    base: "dist/website",
                },
            },
        },
    });

    grunt.registerTask("build-website-views", ["stylus:website"]);

    grunt.registerTask("build-extension-views", [
        "stylus:extension",
        "pug:extension",
    ]);

    grunt.registerTask("build-website", [
        "clean:website",
        "copy:website",
        "build-website-views",
        "webpack:websiteProd",
    ]);

    grunt.registerTask("build-website-dev", [
        "clean:website",
        "copy:website",
        "build-website-views",
        "webpack:websiteDev",
    ]);

    grunt.registerTask("build-extension", [
        "clean:extension",
        "copy:extension",
        "build-extension-views",
        "webpack:extensionProd",
        "crx:pack",
        "exec:firefoxExtensionPack",
        "exec:renameFirefoxExtension",
    ]);

    grunt.registerTask("build-extension-dev", [
        "clean:extension",
        "copy:extension",
        "build-extension-views",
        "webpack:extensionDev",
    ]);

    grunt.registerTask("build", ["build-website", "build-extension"]);

    grunt.registerTask("build-dev", ["build-website-dev", "build-extension-dev"]);

    grunt.registerTask("unit-tests", ["webpack:unitTests", "mochaTest:unit"]);

    grunt.registerTask("functional-tests", [
        "build-website-dev",
        "connect:website",
        "mochaTest:functional",
    ]);

    grunt.registerTask("test", ["unit-tests", "functional-tests"]);

    grunt.registerTask("default", ["build-dev", "connect:website", "watch"]);
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 5(3): 270 (1907)

#### Original name
Cercosporella achilleae Jaap

### Remarks
null


text:
from os.path import *
from os import listdir
from numpy import genfromtxt, array

class MetricValues:
    def __init__(self, transform_dir):
        self._values = [genfromtxt(join(transform_dir, file)) for file in listdir(transform_dir)]

    def values(self):
        return self._values

    def delta_values(self):
        # subtract the previous value from each value
        return [row[1:] - row[:-1] for row in self._values]

    def initial_values(self):
        return [row[0] for row in self._values]

    def final_values(self):
        return [row[-1] for row in self._values]

    def number_of_slices(self):
        return len(self._values)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using MonitoringClient.refMonitoring;

namespace MonitoringClient
{
    class Program
    {
        static void Main(string[] args)
        {
            MonitoringServiceClient proxy = new MonitoringServiceClient(
                //"netTcpEndpoint"
                "httpEndpoint"
                );

            proxy.Open();
            while (true)
            {

                Thread.Sleep(TimeSpan.FromSeconds(1));

                MonitoringValues values = proxy.CurrentValues();
                bool isAlive = proxy.isAlive();

                Console.WriteLine("Maschinenstatus: {0}\nGutmengen: {1}\nAusschussmengen: {2}",
                    values.Maschinenstatus, values.Gutmengen, values.Ausschussmengen);
//                Console.ReadLine();

            }
            proxy.Close();
        }
    }
}


text:
The Camel **amq:** component uses the [Kubernetes Service](http://fabric8.io/guide/services.html) discovery mechanism to discover and connect to the ActiveMQ brokers. So you can just use the endpoint directly; no configuration is required.

e.g. just use the camel endpoint **"amq:Cheese"** to access the Cheese queue in ActiveMQ; no configuration required!

The Camel **amq:** is used in the example **Fabric8 MQ Producer** and **Fabric8 MQ Consumer** apps in the **Library** in the [console](http://fabric8.io/guide/console.html)

For more information check out the [Fabric8 MQ documentation](http://fabric8.io/guide/fabric8MQ.html)

### Add it to your Maven pom.xml

To be able to use the Java code in your [Apache Maven](http://maven.apache.org/) based project add this into your pom.xml

            <dependency>
                <groupId>io.fabric8.mq</groupId>
                <artifactId>camel-amq</artifactId>
                <version>2.2.1</version>
            </dependency>


text:
<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>WebSocket-Client</title>
<link rel="stylesheet" type="text/css" href="./static/API/css/Main.css?1" />

        Контент.


text:
package org.jbpm.workbench.cm.client.actions;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import org.jboss.errai.common.client.dom.HTMLElement;
import org.jboss.errai.common.client.dom.MouseEvent;
import org.jboss.errai.common.client.dom.Span;
import org.jboss.errai.common.client.dom.TextInput;
import org.jboss.errai.ui.client.local.spi.TranslationService;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.ForEvent;
import org.jboss.errai.ui.shared.api.annotations.Templated;

import org.jbpm.workbench.cm.model.CaseStageSummary;
import org.jbpm.workbench.cm.util.CaseActionType;
import org.jbpm.workbench.cm.util.CaseStageStatus;
import org.uberfire.client.views.pfly.widgets.*;
import org.uberfire.mvp.Command;

import static com.google.common.base.Strings.*;
import static org.jbpm.workbench.cm.client.resources.i18n.Constants.*;
import static org.jboss.errai.common.client.dom.DOMUtil.*;

@Dependent
@Templated
public class NewActionViewImpl implements CaseActionsPresenter.NewActionView {

    @Inject
    @DataField("action-creation-title")
    Span modalTitle;

    @Inject
    @DataField("action-name-group")
    FormGroup actionNameGroup;

    @Inject
    @DataField("action-name-label")
    FormLabel actionNameLabel;

    @Inject
    @DataField("action-name-input")
    TextInput actionNameInput;

    @Inject
    @DataField("action-name-help")
    Span actionNameHelp;

    @Inject
    @DataField("action-desc-group")
    FormGroup actionDescGroup;

    @Inject
    @DataField("action-desc-input")
    TextInput actionDescInput;

    @Inject
    @DataField("action-users-group")
    FormGroup actionUsersGroup;

    @Inject
    @DataField("action-users-input")
    TextInput actionUsersInput;

    @Inject
    @DataField("action-groups-group")
    FormGroup actionGroupsGroup;

    @Inject
    @DataField("action-groups-input")
    TextInput actionGroupsInput;

    @Inject
    @DataField("assignation-help")
    Span assignationHelp;

    @Inject
    @DataField("action-process-definitions-group")
    FormGroup actionProcessDefinitionsGroup;

    @Inject
    @DataField("action-case-definitions-label")
    FormLabel processDefinitionsLabel;

    @Inject
    @DataField("process-definitions-help")
    Span processDefinitionsHelp;

    @Inject
    @DataField("stages-select")
    Select stages;

    @Inject
    @DataField("action-process-definitions-select")
    private Select processDefinitionsList;

    @Inject
    @DataField("modal")
    private Modal modal;

    private Command okCommand;

    private CaseActionType caseActionType;

    @Inject
    private TranslationService translationService;

    @PostConstruct
    public void init() {
        this.actionNameLabel.addRequiredIndicator();
        this.processDefinitionsLabel.addRequiredIndicator();
    }

    @Override
    public void init(final CaseActionsPresenter presenter) {
    }

    @Override
    public void show(final CaseActionType caseActionType,
                     final Command okCommand) {
        setCaseActionType(caseActionType);
        clearErrorMessages();
        clearValues();
        this.okCommand = okCommand;
        modal.show();
    }

    @Override
    public void hide() {
        modal.hide();
    }

    @Override
    public void setCaseStagesList(List<CaseStageSummary> caseStagesList) {
        caseStagesList.stream()
                .filter(s -> s.getStatus().equals(CaseStageStatus.ACTIVE.getStatus()))
                .forEach(e -> stages.addOption(e.getIdentifier(),
                                               e.getName()));
        stages.refresh();
    }

    @Override
    public String getStageId() {
        return stages.getValue();
    }

    private boolean validateForm() {
        boolean validForm = true;
        clearErrorMessages();
        if (isNullOrEmpty(actionNameInput.getValue())) {
            actionNameInput.focus();
            actionNameHelp.setTextContent(translationService.format(PLEASE_INTRO_ACTION_NAME));
            actionNameGroup.setValidationState(ValidationState.ERROR);
            validForm = false;
        }
        switch (caseActionType) {
            case DYNAMIC_USER_TASK: {
                if (isNullOrEmpty(actionUsersInput.getValue()) && isNullOrEmpty(actionGroupsInput.getValue())) {
                    actionUsersInput.focus();
                    actionUsersGroup.setValidationState(ValidationState.ERROR);
                    actionGroupsGroup.setValidationState(ValidationState.ERROR);
                    assignationHelp.setTextContent(translationService.format(PLEASE_INTRO_USER_OR_GROUP_TO_ASSIGN_NEW_ACTION));
                    validForm = false;
                }
                break;
            }
            case DYNAMIC_SUBPROCESS_TASK: {
                if (isNullOrEmpty(processDefinitionsList.getValue())) {
                    processDefinitionsList.getElement().focus();
                    actionProcessDefinitionsGroup.setValidationState(ValidationState.ERROR);
                    processDefinitionsHelp.setTextContent(translationService.format(PLEASE_INTRO_SUBPROCESS_ID));
                    validForm = false;
                }
                break;
            }
        }

        if (validForm) {
            actionGroupsGroup.setValidationState(ValidationState.SUCCESS);
            actionUsersGroup.setValidationState(ValidationState.SUCCESS);
            actionNameGroup.setValidationState(ValidationState.SUCCESS);
            actionProcessDefinitionsGroup.setValidationState(ValidationState.SUCCESS);
        }
        return validForm;
    }

    private void clearValues() {
        actionUsersInput.setValue("");
        actionGroupsInput.setValue("");
        actionNameInput.setValue("");
        actionDescInput.setValue("");
        processDefinitionsList.setValue("");
        stages.setValue("");
    }

    private void clearErrorMessages() {
        actionNameHelp.setTextContent("");
        assignationHelp.setTextContent("");
        processDefinitionsHelp.setTextContent("");

        actionUsersGroup.clearValidationState();
        actionGroupsGroup.clearValidationState();
        actionNameGroup.clearValidationState();
        actionProcessDefinitionsGroup.clearValidationState();
    }

    @Override
    public void setProcessDefinitions(final List<String> definitions) {
        for (final String definition : definitions) {
            processDefinitionsList.addOption(definition);
        }
        processDefinitionsList.refresh();
    }

    @Override
    public String getTaskName() {
        return actionNameInput.getValue();
    }

    @Override
    public String getDescription() {
        return actionDescInput.getValue();
    }

    @Override
    public String getProcessDefinitionName() {
        return processDefinitionsList.getValue();
    }

    @Override
    public String getActors() {
        return actionUsersInput.getValue();
    }

    @Override
    public String getGroups() {
        return actionGroupsInput.getValue();
    }

    @Override
    public HTMLElement getElement() {
        return modal.getElement();
    }

    public void setCaseActionType(CaseActionType caseActionType) {
        this.caseActionType = caseActionType;
        switch (caseActionType) {
            case DYNAMIC_USER_TASK: {
                modalTitle.setTextContent(translationService.format(NEW_USER_TASK));
                removeCSSClass(this.actionDescGroup.getElement(),
                               "hidden");
                removeCSSClass(this.actionUsersGroup.getElement(),
                               "hidden");
                removeCSSClass(this.actionGroupsGroup.getElement(),
                               "hidden");
                addCSSClass(this.actionProcessDefinitionsGroup.getElement(),
                            "hidden");
                break;
            }
            case DYNAMIC_SUBPROCESS_TASK: {
                modalTitle.setTextContent(translationService.format(NEW_PROCESS_TASK));
                addCSSClass(this.actionDescGroup.getElement(),
                            "hidden");
                addCSSClass(this.actionUsersGroup.getElement(),
                            "hidden");
                addCSSClass(this.actionGroupsGroup.getElement(),
                            "hidden");
                removeCSSClass(this.actionProcessDefinitionsGroup.getElement(),
                               "hidden");
                break;
            }
        }
    }

    @EventHandler("addDynamicTask")
    public void onAssignClick(final @ForEvent("click") MouseEvent event) {
        if (!validateForm()) {
            return;
        }
        if (okCommand != null) {
            okCommand.execute();
        }
        hide();
    }

    @EventHandler("cancel")
    public void onCancelClick(final @ForEvent("click") MouseEvent event) {
        hide();
    }

    @EventHandler("close")
    public void onCloseClick(final @ForEvent("click") MouseEvent event) {
        hide();
    }
}


text:
using Microsoft.AspNetCore.Mvc.Rendering;
using NetCoreCMS.Framework.Core.Auth;
using NetCoreCMS.Framework.Core.Models;
using NetCoreCMS.Framework.Core.Models.ViewModels;
using NetCoreCMS.Framework.Utility;
using Core.Admin.Models.ViewModels.UserAuthViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace Core.Admin.Models.ViewModels
{
    public class UserViewModel
    {
        public long Id { get; set; }

        public long PermissionId { get; set; }

        [Required]
        public string UserName { get; set; }
        [Required]
        public string Password { get; set; }
        [Required]
        public string ConfirmPassword { get; set; }
        [Required]
        public string FullName { get; set; }
        [Required(ErrorMessage = "The Email field is required")]
        [EmailAddress]
        public string Email { get; set; }
        public string Mobile { get; set; }
        public bool SendEmailNotification { get; set; }
        public bool IsSuperAdmin { get; set; }
        [Required]
        public long[] Roles { get; set; }
        public List<ModuleViewModel> DenyModules { get; set; }
        public List<ModuleViewModel> AllowModules { get; set; }
        public string RoleNames { get; set; }

        public string Status { get; set; }

        private readonly NccPermission _permission;
        private readonly NccUser _nccUser;

        public UserViewModel()
        {
            DenyModules = new List<ModuleViewModel>();
            AllowModules = new List<ModuleViewModel>();

            foreach (var item in GlobalContext.GetActiveModules())
            {
                var module = new ModuleViewModel();

                var menus = item.Menus;
                var adminMenus = menus
                    .Where(x => x.Type == Menu.MenuType.Admin)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(x => x.MenuItems).ToList() }
                    ).ToList();

                var siteMenus = menus.Where(x => x.Type == Menu.MenuType.WebSite)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(z => z.MenuItems).ToList() }
                    ).ToList();

                foreach (var adminMenu in adminMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "Admin",
                        Name = adminMenu.MenuName,
                        Order = adminMenu.Menu.Order,
                        MenuItems = GetMenuItems(adminMenu.Items, item.ModuleName),
                    };
                    module.AdminMenus.Add(menu);
                }

                foreach (var webSiteMenu in siteMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "WebSite",
                        Name = webSiteMenu.MenuName,
                        Order = webSiteMenu.Menu.Order,
                        MenuItems = GetMenuItems(webSiteMenu.Items, item.ModuleName),
                    };
                    module.SiteMenus.Add(menu);
                }
                DenyModules.Add(module);
                AllowModules.Add(module);
            }
        }
        public UserViewModel(NccPermission permission)
        {
            _permission = permission;
            PermissionId = permission.Id;

            DenyModules = new List<ModuleViewModel>();
            AllowModules = new List<ModuleViewModel>();

            foreach (var item in GlobalContext.GetActiveModules())
            {
                var module = new ModuleViewModel();

                var menus = item.Menus;
                var adminMenus = menus
                    .Where(x => x.Type == Menu.MenuType.Admin)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(x => x.MenuItems).ToList() }
                    ).ToList();

                var siteMenus = menus.Where(x => x.Type == Menu.MenuType.WebSite)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(z => z.MenuItems).ToList() }
                    ).ToList();

                foreach (var adminMenu in adminMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "Admin",
                        Name = adminMenu.MenuName,
                        Order = adminMenu.Menu.Order,
                        MenuItems = GetMenuItems(adminMenu.Items, item.ModuleName),
                    };
                    module.AdminMenus.Add(menu);
                }

                foreach (var webSiteMenu in siteMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "WebSite",
                        Name = webSiteMenu.MenuName,
                        Order = webSiteMenu.Menu.Order,
                        MenuItems = GetMenuItems(webSiteMenu.Items, item.ModuleName),
                    };
                    module.SiteMenus.Add(menu);
                }
                DenyModules.Add(module);
                AllowModules.Add(module);
            }
        }
        public UserViewModel(NccUser user)
        {
            _nccUser = user;
            Id = user.Id;
            Email = user.Email;
            FullName = user.FullName;
            Mobile = user.Mobile;
            UserName = user.UserName;

            DenyModules = new List<ModuleViewModel>();
            AllowModules = new List<ModuleViewModel>();

            foreach (var item in GlobalContext.GetActiveModules())
            {
                var module = new ModuleViewModel();
                module.ModuleName = item.ModuleName;
                module.Name = item.ModuleTitle;

                var menus = item.Menus;
                var adminMenus = menus
                    .Where(x => x.Type == Menu.MenuType.Admin)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(x => x.MenuItems).ToList() }
                    ).ToList();

                var siteMenus = menus.Where(x => x.Type == Menu.MenuType.WebSite)
                    .GroupBy(y => y.DisplayName,
                        (key, g) => new { MenuName = key, Menu = g.FirstOrDefault(), Items = g.SelectMany(z => z.MenuItems).ToList() }
                    ).ToList();

                foreach (var adminMenu in adminMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "Admin",
                        Name = adminMenu.MenuName,
                        Order = adminMenu.Menu.Order,
                        MenuItems = GetMenuItems(adminMenu.Items, item.ModuleName),
                    };
                    module.AdminMenus.Add(menu);
                }

                foreach (var webSiteMenu in siteMenus)
                {
                    var menu = new MenuViewModel()
                    {
                        Type = "WebSite",
                        Name = webSiteMenu.MenuName,
                        Order = webSiteMenu.Menu.Order,
                        MenuItems = GetMenuItems(webSiteMenu.Items, item.ModuleName),
                    };
                    module.SiteMenus.Add(menu);
                }

                AllowModules.Add(module);
                DenyModules.Add(NccHelper.DeepClone(module));
            }

            foreach (var module in AllowModules)
            {
                foreach (var adminMenu in module.AdminMenus)
                {
                    foreach (var adminMenuItem in adminMenu.MenuItems)
                    {
                        var pd = user.ExtraPermissions.Where(
                            x => x.ModuleName == module.ModuleName
                            && x.AllowUser != null
                            && x.ExtraAllowUserId == user.Id
                            && x.Action == adminMenuItem.Action
                            && x.Controller == adminMenuItem.Controller
                            ).FirstOrDefault();
                        if (pd != null)
                        {
                            module.IsChecked = true;
                            adminMenu.IsChecked = true;
                            adminMenuItem.Id = pd.Id;
                            adminMenuItem.Name = pd.Name;
                            adminMenuItem.IsChecked = true;
                        }
                        else
                        {
                            adminMenuItem.IsChecked = false;
                        }
                    }
                }

                foreach (var siteMenu in module.SiteMenus)
                {
                    foreach (var siteMenuItem in siteMenu.MenuItems)
                    {
                        var pd = user.ExtraPermissions.Where(
                            x => x.ModuleName == module.ModuleName
                            && x.AllowUser != null
                            && x.ExtraAllowUserId == user.Id
                            && x.Action == siteMenuItem.Action
                            && x.Controller == siteMenuItem.Controller
                            ).FirstOrDefault();
                        if (pd != null)
                        {
                            module.IsChecked = true;
                            siteMenu.IsChecked = true;
                            siteMenuItem.Id = pd.Id;
                            siteMenuItem.Name = pd.Name;
                            siteMenuItem.IsChecked = true;
                        }
                        else
                        {
                            siteMenuItem.IsChecked = false;
                        }
                    }
                }
            }

            foreach (var module in DenyModules)
            {
                foreach (var adminMenu in module.AdminMenus)
                {
                    foreach (var adminMenuItem in adminMenu.MenuItems)
                    {
                        var pd = user.ExtraDenies.Where(
                            x => x.ModuleName == module.ModuleName
                            && x.DenyUser != null
                            && x.ExtraDenyUserId == user.Id
                            && x.Action == adminMenuItem.Action
                            && x.Controller == adminMenuItem.Controller
                            ).FirstOrDefault();

                        if (pd != null)
                        {
                            module.IsChecked = true;
                            adminMenu.IsChecked = true;
                            adminMenuItem.Id = pd.Id;
                            adminMenuItem.Name = pd.Name;
                            adminMenuItem.IsChecked = true;
                        }
                        else
                        {
                            adminMenuItem.IsChecked = false;
                        }
                    }

                }

                foreach (var siteMenu in module.SiteMenus)
                {
                    foreach (var siteMenuItem in siteMenu.MenuItems)
                    {
                        var pd = user.ExtraDenies.Where(
                            x => x.ModuleName == module.ModuleName
                            && x.DenyUser != null
                            && x.ExtraDenyUserId == user.Id
                            && x.Action == siteMenuItem.Action
                            && x.Controller == siteMenuItem.Controller
                            ).FirstOrDefault();

                        if (pd != null)
                        {
                            module.IsChecked = true;
                            siteMenu.IsChecked = true;
                            siteMenuItem.Id = pd.Id;
                            siteMenuItem.Name = pd.Name;
                            siteMenuItem.IsChecked = true;
                        }
                        else
                        {
                            siteMenuItem.IsChecked = false;
                        }
                    }
                }
            }
        }

        private List<MenuItemViewModel> GetMenuItems(List<MenuItem> menuItems, string moduleName)
        {
            var list = new List<MenuItemViewModel>();
            foreach (var item in menuItems)
            {
                string area = "", controller = "", action = "";
                if (string.IsNullOrEmpty(item.Url) == false)
                {
                    var parts = item.Url.Split("/".ToArray(), StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length > 2)
                    {
                        area = parts[0];
                        controller = parts[1];
                        action = parts[2];
                    }
                    else if (parts.Length > 1)
                    {
                        controller = parts[0];
                        action = parts[1];
                    }
                    else if (parts.Length == 1)
                    {
                        controller = parts[0];
                        action = "Index";
                    }
                }

                if (_permission != null)
                {
                    var mip = _permission.PermissionDetails?.Where(x => x.ModuleName == moduleName && x.Action == action && x.Controller == controller).FirstOrDefault();
                    if (mip != null)
                    {
                        var mi = new MenuItemViewModel()
                        {
                            Id = mip.Id,
                            Area = area,
                            Action = action,
                            Controller = controller,
                            Name = mip.Name,
                            Order = mip.Order,
                            IsChecked = true,
                        };
                        list.Add(mi);
                    }
                    else
                    {
                        var mi = new MenuItemViewModel()
                        {
                            Id = 0,
                            Action = action,
                            Area = area,
                            Controller = controller,
                            Name = item.Name,
                            Order = item.Order,
                            IsChecked = false
                        };
                        list.Add(mi);
                    }
                }
                else
                {
                    var mi = new MenuItemViewModel()
                    {
                        Area = area,
                        Action = action,
                        Controller = controller,
                        Name = item.Name,
                        Order = item.Order,
                        IsChecked = false,
                    };

                    list.Add(mi);
                }
            }
            return list;
        }
    }
}


text:
<!DOCTYPE html>

    <meta name="project_path" value="/java/docs/reference/_project.yaml">
    <meta name="book_path" value="/java/docs/reference/cloud.google.com/java/latest/_book.yaml">

    {% verbatim %}

Class WordInfo.Builder (2.0.0)

public static final class WordInfo.Builder extends GeneratedMessageV3.Builder<WordInfo.Builder> implements WordInfoOrBuilder

 Word-specific information for recognized words.

 Protobuf type google.cloud.speech.v1p1beta1.WordInfo

Inheritance

    Object  >
    AbstractMessageLite.Builder<MessageType,BuilderType>  >
    AbstractMessage.Builder<BuilderType>  >
    GeneratedMessageV3.Builder  >
    WordInfo.Builder

Implements

    WordInfoOrBuilder

Inherited Members

      AbstractMessage.Builder.findInitializationErrors()

      AbstractMessage.Builder.getInitializationErrorString()

      AbstractMessage.Builder.internalMergeFrom(AbstractMessageLite)

      AbstractMessage.Builder.mergeDelimitedFrom(InputStream)

      AbstractMessage.Builder.mergeDelimitedFrom(InputStream,ExtensionRegistryLite)

      AbstractMessage.Builder.mergeFrom(byte[])

      AbstractMessage.Builder.mergeFrom(byte[],ExtensionRegistryLite)

      AbstractMessage.Builder.mergeFrom(byte[],int,int)

      AbstractMessage.Builder.mergeFrom(byte[],int,int,ExtensionRegistryLite)

      AbstractMessage.Builder.mergeFrom(ByteString)

      AbstractMessage.Builder.mergeFrom(ByteString,ExtensionRegistryLite)

      AbstractMessage.Builder.mergeFrom(CodedInputStream)

      AbstractMessage.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite)

      AbstractMessage.Builder.mergeFrom(Message)

      AbstractMessage.Builder.mergeFrom(InputStream)

      AbstractMessage.Builder.mergeFrom(InputStream,ExtensionRegistryLite)

      AbstractMessage.Builder.newUninitializedMessageException(Message)

      AbstractMessage.Builder.toString()

      AbstractMessageLite.Builder.<T>addAll(Iterable<T>,Collection<? super T>)

      AbstractMessageLite.Builder.<T>addAll(Iterable<T>,List<? super T>)

      AbstractMessageLite.Builder.internalMergeFrom(MessageType)

      AbstractMessageLite.Builder.mergeFrom(MessageLite)

      AbstractMessageLite.Builder.newUninitializedMessageException(MessageLite)

      GeneratedMessageV3.Builder.addRepeatedField(Descriptors.FieldDescriptor,Object)

      GeneratedMessageV3.Builder.clear()

      GeneratedMessageV3.Builder.clearField(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.clearOneof(Descriptors.OneofDescriptor)

      GeneratedMessageV3.Builder.clone()

      GeneratedMessageV3.Builder.getAllFields()

      GeneratedMessageV3.Builder.getDescriptorForType()

      GeneratedMessageV3.Builder.getField(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.getFieldBuilder(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.getOneofFieldDescriptor(Descriptors.OneofDescriptor)

      GeneratedMessageV3.Builder.getParentForChildren()

      GeneratedMessageV3.Builder.getRepeatedField(Descriptors.FieldDescriptor,int)

      GeneratedMessageV3.Builder.getRepeatedFieldBuilder(Descriptors.FieldDescriptor,int)

      GeneratedMessageV3.Builder.getRepeatedFieldCount(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.getUnknownFields()

      GeneratedMessageV3.Builder.hasField(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.hasOneof(Descriptors.OneofDescriptor)

      GeneratedMessageV3.Builder.internalGetFieldAccessorTable()

      GeneratedMessageV3.Builder.internalGetMapField(int)

      GeneratedMessageV3.Builder.internalGetMutableMapField(int)

      GeneratedMessageV3.Builder.isClean()

      GeneratedMessageV3.Builder.isInitialized()

      GeneratedMessageV3.Builder.markClean()

      GeneratedMessageV3.Builder.mergeUnknownFields(UnknownFieldSet)

      GeneratedMessageV3.Builder.newBuilderForField(Descriptors.FieldDescriptor)

      GeneratedMessageV3.Builder.onBuilt()

      GeneratedMessageV3.Builder.onChanged()

      GeneratedMessageV3.Builder.setField(Descriptors.FieldDescriptor,Object)

      GeneratedMessageV3.Builder.setRepeatedField(Descriptors.FieldDescriptor,int,Object)

      GeneratedMessageV3.Builder.setUnknownFields(UnknownFieldSet)

      GeneratedMessageV3.Builder.setUnknownFieldsProto3(UnknownFieldSet)

      Object.equals(Object)

      Object.finalize()

      Object.getClass()

      Object.hashCode()

      Object.notify()

      Object.notifyAll()

      Object.wait()

      Object.wait(long)

      Object.wait(long,int)

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()

  Returns

        Type
        Description

        Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public WordInfo.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)

  Parameters

        Name
        Description

        field
        FieldDescriptor

        value
        Object

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.addRepeatedField(Descriptors.FieldDescriptor field, Object value)

build()

public WordInfo build()

  Returns

        Type
        Description

        WordInfo

buildPartial()

public WordInfo buildPartial()

  Returns

        Type
        Description

        WordInfo

clear()

public WordInfo.Builder clear()

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.clear()

clearConfidence()

public WordInfo.Builder clearConfidence()

 The confidence estimate between 0.0 and 1.0. A higher number
 indicates an estimated greater likelihood that the recognized words are
 correct. This field is set only for the top alternative of a non-streaming
 result or, of a streaming result where is_final=true.
 This field is not guaranteed to be accurate and users should not rely on it
 to be always provided.
 The default of 0.0 is a sentinel value indicating confidence was not set.

 float confidence = 4;

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

clearEndTime()

public WordInfo.Builder clearEndTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Returns

        Type
        Description

        WordInfo.Builder

clearField(Descriptors.FieldDescriptor field)

public WordInfo.Builder clearField(Descriptors.FieldDescriptor field)

  Parameter

        Name
        Description

        field
        FieldDescriptor

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.clearField(Descriptors.FieldDescriptor field)

clearOneof(Descriptors.OneofDescriptor oneof)

public WordInfo.Builder clearOneof(Descriptors.OneofDescriptor oneof)

  Parameter

        Name
        Description

        oneof
        OneofDescriptor

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.clearOneof(Descriptors.OneofDescriptor oneof)

clearSpeakerTag()

public WordInfo.Builder clearSpeakerTag()

 Output only. A distinct integer value is assigned for every speaker within
 the audio. This field specifies which one of those speakers was detected to
 have spoken this word. Value ranges from '1' to diarization_speaker_count.
 speaker_tag is set if enable_speaker_diarization = 'true' and only in the
 top alternative.

 int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

clearStartTime()

public WordInfo.Builder clearStartTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Returns

        Type
        Description

        WordInfo.Builder

clearWord()

public WordInfo.Builder clearWord()

 The word corresponding to this set of information.

 string word = 3;

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

clone()

public WordInfo.Builder clone()

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.clone()

getConfidence()

public float getConfidence()

 The confidence estimate between 0.0 and 1.0. A higher number
 indicates an estimated greater likelihood that the recognized words are
 correct. This field is set only for the top alternative of a non-streaming
 result or, of a streaming result where is_final=true.
 This field is not guaranteed to be accurate and users should not rely on it
 to be always provided.
 The default of 0.0 is a sentinel value indicating confidence was not set.

 float confidence = 4;

  Returns

        Type
        Description

        float

The confidence.

getDefaultInstanceForType()

public WordInfo getDefaultInstanceForType()

  Returns

        Type
        Description

        WordInfo

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()

  Returns

        Type
        Description

        Descriptor

  Overrides

GeneratedMessageV3.Builder<BuilderType>.getDescriptorForType()

getEndTime()

public Duration getEndTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Returns

        Type
        Description

        Duration

The endTime.

getEndTimeBuilder()

public Duration.Builder getEndTimeBuilder()

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Returns

        Type
        Description

        Builder

getEndTimeOrBuilder()

public DurationOrBuilder getEndTimeOrBuilder()

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Returns

        Type
        Description

        DurationOrBuilder

getSpeakerTag()

public int getSpeakerTag()

 Output only. A distinct integer value is assigned for every speaker within
 the audio. This field specifies which one of those speakers was detected to
 have spoken this word. Value ranges from '1' to diarization_speaker_count.
 speaker_tag is set if enable_speaker_diarization = 'true' and only in the
 top alternative.

 int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

  Returns

        Type
        Description

        int

The speakerTag.

getStartTime()

public Duration getStartTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Returns

        Type
        Description

        Duration

The startTime.

getStartTimeBuilder()

public Duration.Builder getStartTimeBuilder()

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Returns

        Type
        Description

        Builder

getStartTimeOrBuilder()

public DurationOrBuilder getStartTimeOrBuilder()

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Returns

        Type
        Description

        DurationOrBuilder

getWord()

public String getWord()

 The word corresponding to this set of information.

 string word = 3;

  Returns

        Type
        Description

        String

The word.

getWordBytes()

public ByteString getWordBytes()

 The word corresponding to this set of information.

 string word = 3;

  Returns

        Type
        Description

        ByteString

The bytes for word.

hasEndTime()

public boolean hasEndTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Returns

        Type
        Description

        boolean

Whether the endTime field is set.

hasStartTime()

public boolean hasStartTime()

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Returns

        Type
        Description

        boolean

Whether the startTime field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()

  Returns

        Type
        Description

        FieldAccessorTable

  Overrides

GeneratedMessageV3.Builder<BuilderType>.internalGetFieldAccessorTable()

isInitialized()

public final boolean isInitialized()

  Returns

        Type
        Description

        boolean

  Overrides

GeneratedMessageV3.Builder<BuilderType>.isInitialized()

mergeEndTime(Duration value)

public WordInfo.Builder mergeEndTime(Duration value)

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Parameter

        Name
        Description

        value
        Duration

  Returns

        Type
        Description

        WordInfo.Builder

mergeFrom(WordInfo other)

public WordInfo.Builder mergeFrom(WordInfo other)

  Parameter

        Name
        Description

        other
        WordInfo

  Returns

        Type
        Description

        WordInfo.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public WordInfo.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

  Parameters

        Name
        Description

        input
        CodedInputStream

        extensionRegistry
        ExtensionRegistryLite

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

AbstractMessage.Builder<BuilderType>.mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

  Exceptions

        Type
        Description

        IOException

mergeFrom(Message other)

public WordInfo.Builder mergeFrom(Message other)

  Parameter

        Name
        Description

        other
        Message

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

AbstractMessage.Builder<BuilderType>.mergeFrom(Message other)

mergeStartTime(Duration value)

public WordInfo.Builder mergeStartTime(Duration value)

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Parameter

        Name
        Description

        value
        Duration

  Returns

        Type
        Description

        WordInfo.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final WordInfo.Builder mergeUnknownFields(UnknownFieldSet unknownFields)

  Parameter

        Name
        Description

        unknownFields
        UnknownFieldSet

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.mergeUnknownFields(UnknownFieldSet unknownFields)

setConfidence(float value)

public WordInfo.Builder setConfidence(float value)

 The confidence estimate between 0.0 and 1.0. A higher number
 indicates an estimated greater likelihood that the recognized words are
 correct. This field is set only for the top alternative of a non-streaming
 result or, of a streaming result where is_final=true.
 This field is not guaranteed to be accurate and users should not rely on it
 to be always provided.
 The default of 0.0 is a sentinel value indicating confidence was not set.

 float confidence = 4;

  Parameter

        Name
        Description

        value
        float

The confidence to set.

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

setEndTime(Duration value)

public WordInfo.Builder setEndTime(Duration value)

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Parameter

        Name
        Description

        value
        Duration

  Returns

        Type
        Description

        WordInfo.Builder

setEndTime(Duration.Builder builderForValue)

public WordInfo.Builder setEndTime(Duration.Builder builderForValue)

 Time offset relative to the beginning of the audio,
 and corresponding to the end of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration end_time = 2;

  Parameter

        Name
        Description

        builderForValue
        Builder

  Returns

        Type
        Description

        WordInfo.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public WordInfo.Builder setField(Descriptors.FieldDescriptor field, Object value)

  Parameters

        Name
        Description

        field
        FieldDescriptor

        value
        Object

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.setField(Descriptors.FieldDescriptor field, Object value)

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public WordInfo.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

  Parameters

        Name
        Description

        field
        FieldDescriptor

        index
        int

        value
        Object

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

setSpeakerTag(int value)

public WordInfo.Builder setSpeakerTag(int value)

 Output only. A distinct integer value is assigned for every speaker within
 the audio. This field specifies which one of those speakers was detected to
 have spoken this word. Value ranges from '1' to diarization_speaker_count.
 speaker_tag is set if enable_speaker_diarization = 'true' and only in the
 top alternative.

 int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

  Parameter

        Name
        Description

        value
        int

The speakerTag to set.

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

setStartTime(Duration value)

public WordInfo.Builder setStartTime(Duration value)

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Parameter

        Name
        Description

        value
        Duration

  Returns

        Type
        Description

        WordInfo.Builder

setStartTime(Duration.Builder builderForValue)

public WordInfo.Builder setStartTime(Duration.Builder builderForValue)

 Time offset relative to the beginning of the audio,
 and corresponding to the start of the spoken word.
 This field is only set if enable_word_time_offsets=true and only
 in the top hypothesis.
 This is an experimental feature and the accuracy of the time offset can
 vary.

 .google.protobuf.Duration start_time = 1;

  Parameter

        Name
        Description

        builderForValue
        Builder

  Returns

        Type
        Description

        WordInfo.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final WordInfo.Builder setUnknownFields(UnknownFieldSet unknownFields)

  Parameter

        Name
        Description

        unknownFields
        UnknownFieldSet

  Returns

        Type
        Description

        WordInfo.Builder

  Overrides

GeneratedMessageV3.Builder<BuilderType>.setUnknownFields(UnknownFieldSet unknownFields)

setWord(String value)

public WordInfo.Builder setWord(String value)

 The word corresponding to this set of information.

 string word = 3;

  Parameter

        Name
        Description

        value
        String

The word to set.

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

setWordBytes(ByteString value)

public WordInfo.Builder setWordBytes(ByteString value)

 The word corresponding to this set of information.

 string word = 3;

  Parameter

        Name
        Description

        value
        ByteString

The bytes for word to set.

  Returns

        Type
        Description

        WordInfo.Builder

This builder for chaining.

    {% endverbatim %}


text:
const chai = require('chai');
chai.use(require('chai-as-promised'));
const {ControllerPromise} = require('./controller-promise');

let installed;
let lastExpectError;
let networkLogger;

function clearLastExpectError() {
  lastExpectError = null;
}

/**
 * @return {?Error}
 */
function getLastExpectError() {
  return lastExpectError;
}

/**
 * @param {*} actual
 * @param {string=} opt_message
 * @return {!ExpectStatic}
 */
function expect(actual, opt_message) {
  if (!installed) {
    installed = true;
    // See https://www.chaijs.com/guide/helpers/ for details on implementation
    chai.use(installWrappers);
  }

  return chai.expect(actual, opt_message);
}

/** @enum {string} */
const ChaiType = {
  METHOD: 'method',
  PROPERTY: 'property',
  CHAINABLE_METHOD: 'chainable-method',
};

/**
 * These properties will be overridden to accept a Promise value and then
 * continue to process the value like normal.
 * Only the chai properties that make assertions need to be overwritten.
 * Not all chai properties need to be overwritten, like those that set
 * flags or are only language chains e.g. `not` or 'to'
 * See the Chai implementation for the original definitions:
 * {@link https://github.com/chaijs/chai/blob/main/lib/chai/core/assertions.js}
 */
const chaiMethodsAndProperties = [
  {name: 'a', type: ChaiType.CHAINABLE_METHOD},
  {name: 'above', type: ChaiType.METHOD},
  {name: 'an', type: ChaiType.CHAINABLE_METHOD},
  {name: 'approximately', type: ChaiType.METHOD},
  {name: 'arguments', type: ChaiType.PROPERTY},
  {name: 'Arguments', type: ChaiType.PROPERTY},
  {name: 'below', type: ChaiType.METHOD},
  {name: 'by', type: ChaiType.METHOD, unsupported: true},
  {name: 'change', type: ChaiType.METHOD, unsupported: true},
  {name: 'changes', type: ChaiType.METHOD, unsupported: true},
  {name: 'closeTo', type: ChaiType.METHOD},
  {name: 'contain', type: ChaiType.CHAINABLE_METHOD},
  {name: 'contains', type: ChaiType.CHAINABLE_METHOD},
  {name: 'decrease', type: ChaiType.METHOD, unsupported: true},
  {name: 'decreases', type: ChaiType.METHOD, unsupported: true},
  {name: 'empty', type: ChaiType.PROPERTY},
  {name: 'eq', type: ChaiType.METHOD},
  {name: 'eql', type: ChaiType.METHOD},
  {name: 'eqls', type: ChaiType.METHOD},
  {name: 'equal', type: ChaiType.METHOD},
  {name: 'equals', type: ChaiType.METHOD},
  {name: 'exist', type: ChaiType.PROPERTY},
  {name: 'extensible', type: ChaiType.PROPERTY},
  {name: 'false', type: ChaiType.PROPERTY},
  {name: 'finite', type: ChaiType.PROPERTY},
  {name: 'frozen', type: ChaiType.PROPERTY},
  {name: 'greaterThan', type: ChaiType.METHOD},
  {name: 'gt', type: ChaiType.METHOD},
  {name: 'gte', type: ChaiType.METHOD},
  {name: 'haveOwnProperty', type: ChaiType.METHOD},
  {name: 'haveOwnPropertyDescriptor', type: ChaiType.METHOD},
  {name: 'include', type: ChaiType.CHAINABLE_METHOD},
  {name: 'includes', type: ChaiType.CHAINABLE_METHOD},
  {name: 'increase', type: ChaiType.METHOD, unsupported: true},
  {name: 'increases', type: ChaiType.METHOD, unsupported: true},
  {name: 'instanceof', type: ChaiType.METHOD},
  {name: 'instanceOf', type: ChaiType.METHOD},
  {name: 'key', type: ChaiType.METHOD},
  {name: 'keys', type: ChaiType.METHOD},
  {name: 'least', type: ChaiType.METHOD},
  {name: 'length', type: ChaiType.CHAINABLE_METHOD},
  {name: 'lengthOf', type: ChaiType.CHAINABLE_METHOD},
  {name: 'lessThan', type: ChaiType.METHOD},
  {name: 'lt', type: ChaiType.METHOD},
  {name: 'lte', type: ChaiType.METHOD},
  {name: 'match', type: ChaiType.METHOD},
  {name: 'matches', type: ChaiType.METHOD},
  {name: 'members', type: ChaiType.METHOD},
  {name: 'most', type: ChaiType.METHOD},
  {name: 'NaN', type: ChaiType.PROPERTY},
  {name: 'null', type: ChaiType.PROPERTY},
  {name: 'ok', type: ChaiType.PROPERTY},
  {name: 'oneOf', type: ChaiType.METHOD},
  {name: 'ownProperty', type: ChaiType.METHOD},
  {name: 'ownPropertyDescriptor', type: ChaiType.METHOD},
  {name: 'property', type: ChaiType.METHOD},
  {name: 'respondsTo', type: ChaiType.METHOD, unsupported: true},
  {name: 'respondTo', type: ChaiType.METHOD, unsupported: true},
  {name: 'satisfies', type: ChaiType.METHOD},
  {name: 'satisfy', type: ChaiType.METHOD},
  {name: 'sealed', type: ChaiType.PROPERTY},
  {name: 'string', type: ChaiType.METHOD},
  {name: 'throw', type: ChaiType.METHOD, unsupported: true},
  {name: 'Throw', type: ChaiType.METHOD, unsupported: true},
  {name: 'throws', type: ChaiType.METHOD, unsupported: true},
  {name: 'true', type: ChaiType.PROPERTY},
  {name: 'undefined', type: ChaiType.PROPERTY},
  {name: 'within', type: ChaiType.METHOD},
];

/**
 * @param {chai.ChaiStatic} chai
 * @param {chai.ChaiUtils} utils
 */
function installWrappers(chai, utils) {
  const {METHOD, PROPERTY, CHAINABLE_METHOD} = ChaiType;
  const {Assertion} = chai;

  for (const {name, type, unsupported} of chaiMethodsAndProperties) {
    const overwrite = unsupported
      ? overwriteUnsupported
      : overwriteAlwaysUseSuper(utils);

    switch (type) {
      case METHOD:
        Assertion.overwriteMethod(name, overwrite);
        break;
      case PROPERTY:
        Assertion.overwriteProperty(name, overwrite);
        break;
      case CHAINABLE_METHOD:
        Assertion.overwriteChainableMethod(
          name,
          overwrite,
          inheritChainingBehavior
        );
        break;
      default:
        throw new Error('Unknown ChaiType');
    }
  }
}

/**
 * @param {Chai.ChaiUtils} utils
 * @return {Function(_super: Chai.AssertionStatic): Function(): any}
 */
function overwriteAlwaysUseSuper(utils) {
  const {flag} = utils;

  return function (_super) {
    return function () {
      const obj = this._obj;
      const isControllerPromise = obj instanceof ControllerPromise;
      if (!isControllerPromise) {
        return _super.apply(this, arguments);
      }
      const {waitForValue} = obj;
      if (!waitForValue) {
        return obj.then((result) => {
          flag(this, 'object', result);
          return _super.apply(this, arguments);
        });
      }

      /**
       * When passed to `waitForValue`, this method causes the Promise
       * returned by `waitForValue` to resolve only when the value it
       * polls matches expectation set by the `expect` chain.
       * @param {*} value
       * @return {boolean} true if the ControllerPromise polling value
       * satisfies the `expect` chain.
       */
      const valueSatisfiesExpectation = (value) => {
        try {
          // Tell chai to use value as the subject of the expect chain.
          flag(this, 'object', value);

          // Run the code that checks the condition.
          _super.apply(this, arguments);

          clearLastExpectError();
          // Let waitForValue know we are done.
          return true;
        } catch (e) {
          // The condition checking code threw an error, so we are not done
          // yet. Save the error so that it can be grabbed in case the test
          // times out.
          lastExpectError = e;
          return false;
        } finally {
          flag(this, 'object', resultPromise);
        }
      };

      const resultPromise = waitForValue(valueSatisfiesExpectation);
      flag(this, 'object', resultPromise);
      return resultPromise;
    };
  };
}

/**
 * @param {Chai.AssertionStatic} _super
 * @return {Function(): *}
 */
function inheritChainingBehavior(_super) {
  return function () {
    _super.apply(this, arguments);
  };
}

/**
 * @param {Chai.AssertionStatic} _super
 * @return {Function(): *}
 */
function overwriteUnsupported(_super) {
  return function () {
    const obj = this._obj;
    const isControllerPromise = obj instanceof ControllerPromise;
    if (isControllerPromise) {
      throw new Error(
        'ControllerPromise used with unsupported expectation. Await the Promise and expect the value.'
      );
    }
    return _super.apply(this, arguments);
  };
}

/**
 * @param {*} _networkLogger
 */
function installBrowserAssertions(_networkLogger) {
  networkLogger = _networkLogger;
  chai.use(installBrowserWrappers);
}

/**
 * @param {chai.ChaiStatic} chai
 * @param {chai.ChaiUtils} utils
 */
function installBrowserWrappers(chai, utils) {
  const {Assertion} = chai;

  // Assert that a request with a testUrl was sent
  // Example usage: await expect(testUrl).to.have.been.sent;
  utils.addProperty(Assertion.prototype, 'sent', async function () {
    const url = this._obj;
    const requests = await networkLogger.getSentRequests(url);
    this.assert(0 < requests.length, 'expected #{this} to have been sent');
  });
  Assertion.overwriteProperty('sent', overwriteAlwaysUseSuper(utils));

  // Assert that a request was sent n number of times
  // Example usage: await expect(testUrl).to.have.sentCount(n);
  utils.addMethod(Assertion.prototype, 'sentCount', async function (count) {
    const url = this._obj;
    const requests = await networkLogger.getSentRequests(url);
    this.assert(
      count === requests.length,
      `expected #{this} to have been sent ${
        count == 1 ? 'once' : count + ' times'
      }`
    );
  });
  Assertion.overwriteMethod('sentCount', overwriteAlwaysUseSuper(utils));
}

module.exports = {
  clearLastExpectError,
  expect,
  getLastExpectError,
  installBrowserAssertions,
};


text:
layout: post
title: Moving my site to Jekyll
---

Today I migrated my website from hand crafted HTML to a static blog using Jekyll.
But what is it ?
According to their website:

> Jekyll is a simple, blog-aware, static site generator.
> It takes a template directory containing raw text files in various formats, runs it through Markdown (or Textile) and Liquid converters, and spits out a complete, ready-to-publish static website suitable for serving with your favorite web server.

What will it change for me ?
Hopefully the publishing process will be easier which means I will write more.
I know my writing skills are pretty low so far, and I plan to improve them by maintaining this site.

I wanted to write an article describing Jekyll setup, but a lot of blog already do this and it is not very complicated.
My only suggestion would be to do this in a virtual machine.
Setting up a VM using tools such as Vagrant is really painless and Jekyll has a lot of dependencies on various gems and specific versions.
It is probably totally doable to put everything in something like a virtualenv for Ruby but I did not want to think about it too much.

See you soon, anonymous readers.


text:
package com.intellij.execution.dashboard.actions;

import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.RunManager;
import com.intellij.execution.RunManagerEx;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.configuration.ConfigurationFactoryEx;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.dashboard.DashboardRunConfigurationNode;
import com.intellij.execution.impl.RunDialog;
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;

/**
 * @author konstantin.aleev
 */
public class CopyConfigurationAction extends RunConfigurationTreeAction {
  public CopyConfigurationAction() {
    super(ExecutionBundle.message("copy.configuration.action.name"),
          ExecutionBundle.message("copy.configuration.action.name"),
          PlatformIcons.COPY_ICON);
  }

  @Override
  public void update(@NotNull AnActionEvent e) {
    super.update(e);
    if (ActionPlaces.isPopupPlace(e.getPlace())) {
      e.getPresentation().setText(ExecutionBundle.message("copy.configuration.action.name") + "...");
    }
  }

  @Override
  protected boolean isEnabled4(DashboardRunConfigurationNode node) {
    return RunManager.getInstance(node.getProject()).hasSettings(node.getConfigurationSettings());
  }

  @Override
  @SuppressWarnings("unchecked")
  protected void doActionPerformed(DashboardRunConfigurationNode node) {
    RunManagerEx runManager = RunManagerEx.getInstanceEx(node.getProject());
    RunnerAndConfigurationSettings settings = node.getConfigurationSettings();

    RunnerAndConfigurationSettings copiedSettings = ((RunnerAndConfigurationSettingsImpl)settings).clone();
    runManager.setUniqueNameIfNeed(copiedSettings);
    copiedSettings.setFolderName(settings.getFolderName());

    final ConfigurationFactory factory = settings.getFactory();
    if (factory instanceof ConfigurationFactoryEx) {
      ((ConfigurationFactoryEx)factory).onConfigurationCopied(settings.getConfiguration());
    }

    if (RunDialog.editConfiguration(node.getProject(), copiedSettings, ExecutionBundle.message("run.dashboard.edit.configuration.dialog.title"))) {
      runManager.addConfiguration(copiedSettings, settings.isShared());
    }
  }
}