text:
package network::infoblox::snmp::mode::services;

use base qw(centreon::plugins::templates::hardware);

use strict;
use warnings;

sub set_system {
    my ($self, %options) = @_;

    $self->{regexp_threshold_overload_check_section_option} = '^(service)$';

    $self->{cb_hook2} = 'snmp_execute';

    $self->{thresholds} = {
        default => [
            ['unknown', 'OK'],
            ['working', 'OK'],
            ['inactive', 'OK'],
            ['warning', 'WARNING'],
            ['failed', 'CRITICAL'],
        ],
    };

    $self->{components_path} = 'network::infoblox::snmp::mode::components';
    $self->{components_module} = ['service'];
}

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1);
    bless $self, $class;

    $self->{version} = '1.0';
    $options{options}->add_options(arguments =>
                                {
                                });

    return $self;
}

sub snmp_execute {
    my ($self, %options) = @_;

    $self->{snmp} = $options{snmp};
    $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
}

1;

=head1 MODE

Check physical service status.

=over 8

=item B<--component>

Which component to check (Default: '.*').
Can be: 'service'.

=item B<--filter>

Exclude some parts (comma seperated list)
Can also exclude specific instance: --filter=service,fan1

=item B<--no-component>

Return an error if no compenents are checked.
If total (with skipped) is 0. (Default: 'critical' returns).

=item B<--threshold-overload>

Set to overload default threshold values (syntax: section,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='service,OK,warning'

=back

=cut

package network::infoblox::snmp::mode::components::service;

use strict;
use warnings;

my %map_service_status = (
    1 => 'working', 2 => 'warning',
    3 => 'failed', 4 => 'inactive', 5 => 'unknown',
);
my %map_service_name = (
    1 => 'dhcp', 2 => 'dns', 3 => 'ntp', 4 => 'tftp', 5 => 'http-file-dist',
    6 => 'ftp', 7 => 'bloxtools-move', 8 => 'bloxtools', 9 => 'node-status',
    10 => 'disk-usage', 11 => 'enet-lan', 12 => 'enet-lan2', 13 => 'enet-ha',
    14 => 'enet-mgmt', 15 => 'lcd', 16 => 'memory', 17 => 'replication', 18 => 'db-object',
    19 => 'raid-summary', 20 => 'raid-disk1', 21 => 'raid-disk2', 22 => 'raid-disk3',
    23 => 'raid-disk4', 24 => 'raid-disk5', 25 => 'raid-disk6', 26 => 'raid-disk7',
    27 => 'raid-disk8', 28 => 'fan1', 29 => 'fan2', 30 => 'fan3', 31 => 'fan4',
    32 => 'fan5', 33 => 'fan6', 34 => 'fan7', 35 => 'fan8', 36 => 'power-supply1',
    37 => 'power-supply2', 38 => 'ntp-sync', 39 => 'cpu1-temp', 40 => 'cpu2-temp',
    41 => 'sys-temp', 42 => 'raid-battery', 43 => 'cpu-usage', 44 => 'ospf',
    45 => 'bgp', 46 => 'mgm-service', 47 => 'subgrid-conn', 48 => 'network-capacity',
    49 => 'reporting', 50 => 'dns-cache-acceleration', 51 => 'ospf6',
    52 => 'swap-usage', 53 => 'discovery-consolidator', 54 => 'discovery-collector',
    55 => 'discovery-capacity', 56 => 'threat-protection', 57 => 'cloud-api',
    58 => 'threat-analytics', 59 => 'taxii', 60 => 'bfd', 61 => 'outbound',
);

my $mapping = {
    ibNodeServiceName   => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1.1', map => \%map_service_name },
    ibNodeServiceStatus => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1.2', map => \%map_service_status },
};
my $oid_ibMemberNodeServiceStatusEntry = '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1';

sub load {
    my ($self) = @_;

    push @{$self->{request}}, { oid => $oid_ibMemberNodeServiceStatusEntry, end => $mapping->{ibNodeServiceStatus}->{oid} };
}

sub check {
    my ($self) = @_;

    $self->{output}->output_add(long_msg => "Checking services");
    $self->{components}->{service} = {name => 'services', total => 0, skip => 0};
    return if ($self->check_filter(section => 'service'));

    foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ibMemberNodeServiceStatusEntry}})) {
        next if ($oid !~ /^$mapping->{ibNodeServiceName}->{oid}\.(.*)$/);
        my $instance = $1;
        my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ibMemberNodeServiceStatusEntry}, instance => $instance);

        next if ($self->check_filter(section => 'service', instance => $result->{ibNodeServiceName}));

        $self->{components}->{service}->{total}++;
        $self->{output}->output_add(long_msg => sprintf("service '%s' status is '%s' [instance = %s]",
                                                        $result->{ibNodeServiceName}, $result->{ibNodeServiceStatus}, $result->{ibNodeServiceName}));
        my $exit = $self->get_severity(section => 'default', instance => $result->{ibNodeServiceName}, value => $result->{ibNodeServiceStatus});
        if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
            $self->{output}->output_add(severity => $exit,
                                        short_msg => sprintf("Service '%s' status is '%s'", $result->{ibNodeServiceName}, $result->{ibNodeServiceStatus}));
        }
    }
}

1;


text:
<?xml version="1.0"?>
<doc>
<assembly>
<name>
Spaceshipgame
</name>
</assembly>
<members>
<member name="P:Spaceship_game.My.Resources.Resources.ResourceManager">
	<summary>
  Returns the cached ResourceManager instance used by this class.
</summary>
</member><member name="P:Spaceship_game.My.Resources.Resources.Culture">
	<summary>
  Overrides the current thread's CurrentUICulture property for all
  resource lookups using this strongly typed resource class.
</summary>
</member><member name="P:Spaceship_game.My.Resources.Resources.laser">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:Spaceship_game.My.Resources.Resources.spaceship">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:Spaceship_game.My.Resources.Resources.starfield006">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="T:Spaceship_game.My.Resources.Resources">
	<summary>
  A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
</members>
</doc>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>QUnit Integration Test</title>
	<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">


text:
#include "rp_allocation.h"

VALUE cRpAllocation;

prof_allocation_t* allocations_table_lookup(st_table* table, st_data_t key)
{
    prof_allocation_t* result = NULL;
    st_data_t value;
    if (rb_st_lookup(table, key, &value))
    {
        result = (prof_allocation_t*)value;
    }

    return result;
}

void allocations_table_insert(st_table* table, st_data_t key, prof_allocation_t* allocation)
{
    rb_st_insert(table, (st_data_t)key, (st_data_t)allocation);
}

st_data_t allocations_key(VALUE klass, int source_line)
{
    return (klass << 4) + source_line;
}

/* ======   prof_allocation_t  ====== */
prof_allocation_t* prof_allocation_create(void)
{
    prof_allocation_t* result = ALLOC(prof_allocation_t);
    result->count = 0;
    result->klass = Qnil;
    result->klass_name = Qnil;
    result->object = Qnil;
    result->memory = 0;
    result->source_line = 0;
    result->source_file = Qnil;
    result->key = 0;

    return result;
}

prof_allocation_t* prof_get_allocation(VALUE self)
{
    /* Can't use Data_Get_Struct because that triggers the event hook
       ending up in endless recursion. */
    prof_allocation_t* result = RTYPEDDATA_DATA(self);

    if (!result)
        rb_raise(rb_eRuntimeError, "This RubyProf::Allocation instance has already been freed, likely because its profile has been freed.");

    return result;
}

prof_allocation_t* prof_allocate_increment(prof_method_t* method, rb_trace_arg_t* trace_arg)
{
    VALUE object = rb_tracearg_object(trace_arg);
    if (BUILTIN_TYPE(object) == T_IMEMO)
        return NULL;

    VALUE klass = rb_obj_class(object);

    int source_line = FIX2INT(rb_tracearg_lineno(trace_arg));
    st_data_t key = allocations_key(klass, source_line);

    prof_allocation_t* allocation = allocations_table_lookup(method->allocations_table, key);
    if (!allocation)
    {
        allocation = prof_allocation_create();
        allocation->source_line = source_line;
        allocation->source_file = rb_tracearg_path(trace_arg);
        allocation->klass_flags = 0;
        allocation->klass = resolve_klass(klass, &allocation->klass_flags);

        allocation->key = key;
        allocations_table_insert(method->allocations_table, key, allocation);
    }

    allocation->count++;
    allocation->memory += rb_obj_memsize_of(object);

    return allocation;
}

static void prof_allocation_ruby_gc_free(void* data)
{
    if (data)
    {
        prof_allocation_t* allocation = (prof_allocation_t*)data;
        allocation->object = Qnil;
    }
}

void prof_allocation_free(prof_allocation_t* allocation)
{
    /* Has this allocation object been accessed by Ruby?  If
       yes clean it up so to avoid a segmentation fault. */
    if (allocation->object != Qnil)
    {
        RTYPEDDATA(allocation->object)->data = NULL;
        allocation->object = Qnil;
    }

    xfree(allocation);
}

size_t prof_allocation_size(const void* data)
{
    return sizeof(prof_allocation_t);
}

void prof_allocation_mark(void* data)
{
    if (!data) return;

    prof_allocation_t* allocation = (prof_allocation_t*)data;
    if (allocation->object != Qnil)
        rb_gc_mark(allocation->object);

    if (allocation->klass != Qnil)
        rb_gc_mark(allocation->klass);

    if (allocation->klass_name != Qnil)
        rb_gc_mark(allocation->klass_name);

    if (allocation->source_file != Qnil)
        rb_gc_mark(allocation->source_file);
}

static const rb_data_type_t allocation_type =
{
    .wrap_struct_name = "Allocation",
    .function =
    {
        .dmark = prof_allocation_mark,
        .dfree = prof_allocation_ruby_gc_free,
        .dsize = prof_allocation_size,
    },
    .data = NULL,
    .flags = RUBY_TYPED_FREE_IMMEDIATELY
};

VALUE prof_allocation_wrap(prof_allocation_t* allocation)
{
    if (allocation->object == Qnil)
    {
        allocation->object = TypedData_Wrap_Struct(cRpAllocation, &allocation_type, allocation);
    }
    return allocation->object;
}

static VALUE prof_allocation_allocate(VALUE klass)
{
    prof_allocation_t* allocation = prof_allocation_create();
    allocation->object = prof_allocation_wrap(allocation);
    return allocation->object;
}

prof_allocation_t* prof_allocation_get(VALUE self)
{
    /* Can't use Data_Get_Struct because that triggers the event hook
       ending up in endless recursion. */
    prof_allocation_t* result = RTYPEDDATA_DATA(self);
    if (!result)
        rb_raise(rb_eRuntimeError, "This RubyProf::Allocation instance has already been freed, likely because its profile has been freed.");

    return result;
}

/* call-seq:
   klass -> Class

Returns the type of Class being allocated. */
static VALUE prof_allocation_klass_name(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);

    if (allocation->klass_name == Qnil)
        allocation->klass_name = resolve_klass_name(allocation->klass, &allocation->klass_flags);

    return allocation->klass_name;
}

/* call-seq:
   klass_flags -> integer

Returns the klass flags */

static VALUE prof_allocation_klass_flags(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);
    return INT2FIX(allocation->klass_flags);
}

/* call-seq:
   source_file -> string

Returns the the line number where objects were allocated. */
static VALUE prof_allocation_source_file(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);
    return allocation->source_file;
}

/* call-seq:
   line -> number

Returns the the line number where objects were allocated. */
static VALUE prof_allocation_source_line(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);
    return INT2FIX(allocation->source_line);
}

/* call-seq:
   count -> number

Returns the number of times this class has been allocated. */
static VALUE prof_allocation_count(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);
    return INT2FIX(allocation->count);
}

/* call-seq:
   memory -> number

Returns the amount of memory allocated. */
static VALUE prof_allocation_memory(VALUE self)
{
    prof_allocation_t* allocation = prof_allocation_get(self);
    return ULL2NUM(allocation->memory);
}

/* :nodoc: */
static VALUE prof_allocation_dump(VALUE self)
{
    prof_allocation_t* allocation = prof_get_allocation(self);

    VALUE result = rb_hash_new();

    rb_hash_aset(result, ID2SYM(rb_intern("key")), INT2FIX(allocation->key));
    rb_hash_aset(result, ID2SYM(rb_intern("klass_name")), prof_allocation_klass_name(self));
    rb_hash_aset(result, ID2SYM(rb_intern("klass_flags")), INT2FIX(allocation->klass_flags));
    rb_hash_aset(result, ID2SYM(rb_intern("source_file")), allocation->source_file);
    rb_hash_aset(result, ID2SYM(rb_intern("source_line")), INT2FIX(allocation->source_line));
    rb_hash_aset(result, ID2SYM(rb_intern("count")), INT2FIX(allocation->count));
    rb_hash_aset(result, ID2SYM(rb_intern("memory")), LONG2FIX(allocation->memory));

    return result;
}

/* :nodoc: */
static VALUE prof_allocation_load(VALUE self, VALUE data)
{
    prof_allocation_t* allocation = prof_get_allocation(self);
    allocation->object = self;

    allocation->key = FIX2LONG(rb_hash_aref(data, ID2SYM(rb_intern("key"))));
    allocation->klass_name = rb_hash_aref(data, ID2SYM(rb_intern("klass_name")));
    allocation->klass_flags = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("klass_flags"))));
    allocation->source_file = rb_hash_aref(data, ID2SYM(rb_intern("source_file")));
    allocation->source_line = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("source_line"))));
    allocation->count = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("count"))));
    allocation->memory = FIX2LONG(rb_hash_aref(data, ID2SYM(rb_intern("memory"))));

    return data;
}

void rp_init_allocation(void)
{
    cRpAllocation = rb_define_class_under(mProf, "Allocation", rb_cObject);
    rb_undef_method(CLASS_OF(cRpAllocation), "new");
    rb_define_alloc_func(cRpAllocation, prof_allocation_allocate);

    rb_define_method(cRpAllocation, "klass_name", prof_allocation_klass_name, 0);
    rb_define_method(cRpAllocation, "klass_flags", prof_allocation_klass_flags, 0);
    rb_define_method(cRpAllocation, "source_file", prof_allocation_source_file, 0);
    rb_define_method(cRpAllocation, "line", prof_allocation_source_line, 0);
    rb_define_method(cRpAllocation, "count", prof_allocation_count, 0);
    rb_define_method(cRpAllocation, "memory", prof_allocation_memory, 0);
    rb_define_method(cRpAllocation, "_dump_data", prof_allocation_dump, 0);
    rb_define_method(cRpAllocation, "_load_data", prof_allocation_load, 1);
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <property name="acs-oauth-secret-production" type="string">iTxo35jBUwLYTvMcz0XMUvH6hmKr8Wee</property>
    <property name="acs-oauth-key-production" type="string">Jb5kEkSNw97nmNI6yzLHkWeW7tarFdjj</property>
    <property name="acs-api-key-production" type="string">thV7cj7bvI2uVLK6GiPXHiMI7j1BdhkG</property>
    <property name="acs-oauth-secret-development" type="string">aG7ryQgMmTSOrKSSXsA8hJpN6BQdGzUh</property>
    <property name="acs-oauth-key-development" type="string">KojaJFcxBXNSxohq0D4x9ebjNSOSbWtQ</property>
    <property name="acs-api-key-development" type="string">tC0PVrxNqlryTaQW2IZfnxqbuZqXwZq1</property>
    <deployment-targets>
        <target device="tizen">false</target>
        <target device="mobileweb">false</target>
        <target device="iphone">true</target>
        <target device="ipad">true</target>
        <target device="android">true</target>
        <target device="blackberry">false</target>
    </deployment-targets>
    <sdk-version>3.2.1.GA</sdk-version>
    <id>edu.uwm.restaurants</id>
    <name>UWM Restaurants</name>
    <version>1.2.1</version>
    <publisher>emylin.alex</publisher>
    <url>http://chariti.mobi</url>
    <description>UWM Restaurant App provides menus, prices and locations for selected restaurants on UWM's campus.</description>
    <copyright>2014 by Emylin and Alex</copyright>
    <icon>appicon.png</icon>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>false</analytics>
    <guid>66774a0a-ba43-45f5-9686-f2de98701f32</guid>
    <property name="ti.ui.defaultunit">dip</property>
    <ios>
        <min-ios-ver>4.3</min-ios-ver>
        <plist>
            <dict>
                <key>UIRequiresPersistentWiFi</key>
                <false/>
                <key>UIPrerenderedIcon</key>
                <true/>
                <key>UIStatusBarHidden</key>
                <false/>
                <key>UIStatusBarStyle</key>
                <string>UIStatusBarStyleDefault</string>
                <key>UISupportedInterfaceOrientations~iphone</key>
                <array>
                    <string>UIInterfaceOrientationPortrait</string>
                </array>
                <key>UISupportedInterfaceOrientations~ipod</key>
                <array>
                    <string>UIInterfaceOrientationPortrait</string>
                </array>
                <key>UISupportedInterfaceOrientations~ipad</key>
                <array>
                    <string>UIInterfaceOrientationPortrait</string>
                    <string>UIInterfaceOrientationPortraitUpsideDown</string>
                    <string>UIInterfaceOrientationLandscapeLeft</string>
                    <string>UIInterfaceOrientationLandscapeRight</string>
                </array>
                <key>UIBackgroundModes</key>
                <array>
                    <string>audio</string>
                </array>
            </dict>
        </plist>
    </ios>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <!-- Allows the API to download data from Google Map servers -->
            <uses-permission android:name="android.permission.INTERNET"/>
            <!-- Allows the API to cache data -->
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <!-- Use GPS for device location -->
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <!-- Use Wi-Fi or mobile connection for device location -->
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
            <!-- Allows the API to access Google web-based services -->
            <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
            <!-- Specify OpenGL ES 2.0 as a requirement -->
            <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
            <!-- Replace <com.domain.appid> with your application ID -->
            <uses-permission android:name="edu.uwm.restaurants.permission.MAPS_RECEIVE"/>
            <permission
                android:name="edu.uwm.restaurants.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
            <application>
                <!-- Replace "PASTE YOUR GOOGLE MAPS API KEY HERE" with the Google API key you obtained -->
                <meta-data
                    android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyAcKnt0d2E1x5pzNvkuF9zV-huYVX_8c5U"/>
            </application>
        </manifest>
    </android>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="iphone">dk.napp.social</module>
        <module platform="commonjs">ti.cloud</module>
        <module platform="android">ti.map</module>
    </modules>
    <plugins>
        <plugin version="1.0">ti.alloy</plugin>
    </plugins>
</ti:app>


text:
// This file is part of Indico.
// Copyright (C) 2002 - 2022 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.

/* eslint-disable import/unambiguous */
/* global handleAjaxError:false, ajaxDialog:false, alertPopup:false, $T:false */

(function(global) {
  $(document).ready(function() {
    setupRegistrationFormScheduleDialogs();
    setupRegistrationFormSummaryPage();
  });

  $(window).scroll(function() {
    IndicoUI.Effect.followScroll();
  });

  function setupRegistrationFormScheduleDialogs() {
    $('a.js-regform-schedule-dialog').on('click', function(e) {
      e.preventDefault();
      ajaxDialog({
        url: $(this).data('href'),
        title: $(this).data('title'),
        onClose(data) {
          if (data) {
            location.reload();
          }
        },
      });
    });
  }

  function setupRegistrationFormSummaryPage() {
    $('.js-check-conditions').on('click', function(e) {
      const conditions = $('#conditions-accepted');
      if (conditions.length && !conditions.prop('checked')) {
        const msg =
          'Please, confirm that you have read and accepted the Terms and Conditions before proceeding.';
        alertPopup($T.gettext(msg), $T.gettext('Terms and Conditions'));
        e.preventDefault();
      }
    });

    $('.js-highlight-payment').on('click', function() {
      $('#payment-summary').effect('highlight', 800);
    });
  }

  global.setupRegistrationFormListPage = function setupRegistrationFormListPage() {
    $('#payment-disabled-notice').on('indico:confirmed', '.js-enable-payments', function(evt) {
      evt.preventDefault();

      const $this = $(this);
      $.ajax({
        url: $this.data('href'),
        method: $this.data('method'),
        complete: IndicoUI.Dialogs.Util.progress(),
        error: handleAjaxError,
        success(data) {
          $('#payment-disabled-notice').remove();
          $('#event-side-menu').html(data.event_menu);
        },
      });
    });
  };
})(window);


text:
import 'source-sans-pro/source-sans-pro.css'
import 'source-code-pro/source-code-pro.css'
import '@fortawesome/fontawesome-free/css/solid.css'
import '@fortawesome/fontawesome-free/css/brands.css'
import '@fortawesome/fontawesome-free/css/regular.css'
import '@fortawesome/fontawesome-free/css/fontawesome.css'
import 'ngx-toastr/toastr.css'
import '../app/src/preload.scss'

// Required before other imports
import './polyfills.buffer'

const mocks = {}
const modules = {}

const customRequire = path => {
    if (mocks[path]) {
        console.log(':: mock', path)
        return mocks[path]
    }
    if (modules[path]) {
        return modules[path]
    }
    throw new Error(`Attempted to require ${path}`)
}

customRequire['resolve'] = (() => null) as any
customRequire['main'] = {
    paths: [],
}

async function webRequire (url) {
    console.log(`>> Loading ${url}`)
    const e = document.createElement('script')
    window['module'] = { exports: {} } as any
    window['exports'] = window['module'].exports
    await new Promise(resolve => {
        e.onload = resolve
        e.src = url
        document.querySelector('head').appendChild(e)
    })
    return window['module'].exports
}

async function prefetchURL (url) {
    console.log(`:: Prefetching ${url}`)
    await (await fetch(url)).text()
}

const Tabby = {
    registerMock: (name, mod) => {
        mocks[name] = mod
    },
    registerModule: (name, mod) => {
        modules[name] = mod
    },
    resolvePluginInfo: async (url): Promise<any> => {
        const pkg = await (await fetch(url + '/package.json')).json()
        url += '/' + pkg.main
        return { ...pkg, url }
    },
    registerPluginModule: (packageName, module) => {
        Tabby.registerModule(`resources/builtin-plugins/${packageName}`, module)
        Tabby.registerModule(packageName, module)
    },
    loadPlugin: async (url) => {
        const info = await Tabby.resolvePluginInfo(url)
        const module = await webRequire(info.url)
        Tabby.registerPluginModule(info.name, module)
        return module
    },
    loadPlugins: async (urls, progressCallback) => {
        const infos: any[] = await Promise.all(urls.map(Tabby.resolvePluginInfo))
        progressCallback?.(0, 1)
        await Promise.all(infos.map(x => prefetchURL(x.url)))
        const pluginModules = []
        for (const info of infos) {
            const module = await webRequire(info.url)
            Tabby.registerPluginModule(info.name, module)
            pluginModules.push(module)
            progressCallback?.(infos.indexOf(info), infos.length)
        }
        progressCallback?.(1, 1)
        return pluginModules
    },
    bootstrap: (...args) => window['bootstrapTabby'](...args),
    webRequire,
}

Object.assign(window, {
    require: customRequire,
    module: {
        paths: [],
    },
    Tabby,
    __filename: '',
    __dirname: '',
    process: {
        env: { },
        argv: ['tabby'],
        platform: 'darwin',
        on: () => null,
        stdout: {},
        stderr: {},
        resourcesPath: 'resources',
        version: '14.0.0',
        versions: {
            modules: 0,
        },
        nextTick: (f, ...args) => setTimeout(() => f(...args)),
        cwd: () => '/',
    },
    global: window,
})


text:
package yaml

import (
	"fmt"
	"io"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"time"
	"unicode"
	"unicode/utf8"

	"github.com/fatih/color"
	glob "github.com/gobwas/glob"
)

// Colors is a structure passed to NewEncoder for specifying the colors used
// for printing keys, values and comments in the resulting YAML.
type Colors struct {
	KeyColor     *color.Color
	ValueColor   *color.Color
	CommentColor *color.Color
}

// An Encoder writes values as YAML to an output stream.
type Encoder struct {
	w              io.Writer
	keyPrinter     func(w io.Writer, format string, a ...interface{})
	commentPrinter func(w io.Writer, format string, a ...interface{})

	// List of globs that define the keys whose values should be encoded as a
	// date. Every key that matches any of the globs are considered a key if
	// they are a number.
	dateKeys []glob.Glob

	Colors     *Colors
	indentSize int
}

// EncoderOption represents an option for creating a new encoder.
type EncoderOption func(*Encoder)

// EncoderColors sets the colors for highlighting keys, values and comments.
func EncoderColors(c *Colors) EncoderOption {
	return func(e *Encoder) { e.Colors = c }
}

// EncoderDateKeys sets a list of globs that define the keys whose values
// should be encoded as a date. Every key that matches any of the globs and
// have a numeric value are encoded as a date, which means that a comment is
// added with the human-friendly date.
func EncoderDateKeys(g []glob.Glob) EncoderOption {
	return func(e *Encoder) { e.dateKeys = g }
}

// EncoderIndent sets the indentation size used while encoding the YAML.
func EncoderIndent(i int) EncoderOption {
	return func(e *Encoder) { e.indentSize = i }
}

// NewEncoder returns a new YAML encoder that writes to w.
func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder {
	enc := &Encoder{w: w, indentSize: 2}
	for _, opt := range options {
		opt(enc)
	}
	if enc.Colors == nil {
		enc.Colors = &Colors{
			KeyColor:     color.New(),
			ValueColor:   color.New(),
			CommentColor: color.New(),
		}
	}
	return enc
}

// lineBreakV decides whether or not a line break should be written based in
// the type of v. It returns an indentation increment, a boolean indicating if
// a line break was actually written and an error.
func (enc *Encoder) lineBreakV(v reflect.Value, indent int) (int, error) {
	switch v.Kind() {
	case reflect.Interface:
		if v.IsNil() {
			return 0, nil
		}
		return enc.lineBreakV(v.Elem(), indent)
	case reflect.Map:
		if v.Len() > 0 {
			return enc.indentSize, enc.lineBreak(indent + enc.indentSize)
		}
	case reflect.Slice:
		if v.Len() > 0 {
			return 0, enc.lineBreak(indent)
		}
	}
	return 0, nil
}

// lineBreak writes a line break into the encoder's writer, followed by
// the number of indention characters specified by indent.
func (enc *Encoder) lineBreak(indent int) error {
	_, err := fmt.Fprintf(enc.w, "\n%s", strings.Repeat(" ", indent))
	return err
}

func (enc *Encoder) matchDateKey(key string) bool {
	for _, glob := range enc.dateKeys {
		if glob.Match(key) {
			return true
		}
	}
	return false
}

func (enc *Encoder) encodeMap(m reflect.Value, indent int, prefix string) (err error) {

	keyPrinter := enc.Colors.KeyColor.FprintfFunc()
	commentPrinter := enc.Colors.CommentColor.FprintfFunc()

	keys := keyList(m.MapKeys())
	sort.Sort(keys)
	n := len(keys)

	if prefix != "" {
		prefix += "."
	}

	var indentIncr int

	for i, k := range keys {
		// If the key is an empty string or starts with some non-letter character
		// let's enclose the key in double quotes.
		firstChar, kLen := utf8.DecodeRuneInString(k.String())
		if kLen == 0 || (firstChar != '_' && !unicode.IsLetter(firstChar))  {
			keyPrinter(enc.w, "\"%s\": ", k)
		} else {
			keyPrinter(enc.w, "%s: ", k)
		}
		v := m.MapIndex(k)
		if indentIncr, err = enc.lineBreakV(v, indent); err != nil {
			return err
		}
		if err = enc.encodeValue(v, indent+indentIncr, prefix+k.String()); err != nil {
			return err
		}
		switch v.Kind() {
		case reflect.Interface:
			v = v.Elem()
		case reflect.Ptr:
			v = v.Elem()
		}
		if v.IsValid() {
			vt := v.Type()
			ks := k.String()
			// If key matches any of the patterns specified in the EncoderDateKeys
			// option while creating the YAML encoder, this field should be treated
			// as a date, let's add a comment with the date in a human-readable format.
			if enc.matchDateKey(ks) {
				var ts int64
				switch {
				case vt.Name() == "Number" && vt.PkgPath() == "encoding/json":
					var err error
					if ts, err = strconv.ParseInt(v.String(), 10, 64); err != nil {
						panic(err)
					}
				case vt.Name() == "float64":
					ts = int64(v.Float())
				case vt.Name() == "int64":
					ts = v.Int()
				}
				commentPrinter(enc.w, "  # %v", time.Unix(ts, 0))
			}
		}
		if i < n-1 {
			err = enc.lineBreak(indent)
		}
		if err != nil {
			return err
		}
	}

	return err
}

// encodeValue writes the YAML encoding of v.
func (enc *Encoder) encodeValue(v reflect.Value, indent int, prefix string) (err error) {

	switch v.Kind() {
	case reflect.Map:
		return enc.encodeMap(v, indent, prefix)
	case reflect.Struct:
		m := make(map[string]interface{})
		n := v.NumField()
		for i := 0; i < n; i++ {
			typeField := v.Type().Field(i)
			key := typeField.Tag.Get("yaml")
			if key == "" {
				key = typeField.Name
			}
			m[key] = v.Field(i).Interface()
		}
		return enc.encodeMap(reflect.ValueOf(m), indent, prefix)
	case reflect.Slice:
		n := v.Len()
		if n == 0 {
			fmt.Fprint(enc.w, "[]")
		}
		for i := 0; i < n; i++ {
			_, err = fmt.Fprint(enc.w, "- ")
			if err == nil {
				err = enc.encodeValue(v.Index(i), 2+indent, prefix)
			}
			if err == nil && i < n-1 {
				err = enc.lineBreak(indent)
			}
			if err != nil {
				return err
			}
		}
	case reflect.Interface, reflect.Ptr:
		if v.IsNil() {
			_, err = fmt.Fprintf(enc.w, "null")
		} else {
			err = enc.encodeValue(v.Elem(), indent, prefix)
		}
	case reflect.String:
		s := v.String()
		t := v.Type()
		switch {
		case t.PkgPath() == "encoding/json" && t.Name() == "Number":
			// This string is a actually a json.Number.
			_, err = enc.Colors.ValueColor.Fprintf(enc.w, "%s", s)
		case strings.Contains(s, "\n"):
			// If string contains new line characters lets encode it as a
			// literal block. Example:
			// literal_block : |
			//   Lorem ipsum dolor sit amet consectetur
			//   adipiscing elit potenti, ante taciti montes
			//   risus mollis
			enc.Colors.ValueColor.Fprint(enc.w, "|")
			for _, line := range strings.Split(s, "\n") {
				enc.lineBreak(2 + indent)
				enc.Colors.ValueColor.Fprintf(enc.w, "%s", line)
			}
		default:
			_, err = enc.Colors.ValueColor.Fprintf(enc.w, "%#v", v)
		}
	default:
		_, err = enc.Colors.ValueColor.Fprintf(enc.w, "%#v", v)
	}

	return err
}

// Encode writes the YAML encoding of v to the stream.
func (enc *Encoder) Encode(v interface{}) error {
	if err := enc.encodeValue(reflect.ValueOf(v), 0, ""); err != nil {
		return err
	}
	return enc.lineBreak(0)
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DatenMeister.Core.EMOF.Implementation;
using DatenMeister.Core.EMOF.Interface.Common;
using DatenMeister.Core.EMOF.Interface.Identifiers;
using DatenMeister.Core.EMOF.Interface.Reflection;

namespace DatenMeister.Core.Runtime.Proxies
{
    public class ProxyReflectiveCollection : IReflectiveCollection, IHasExtent
    {
        protected IReflectiveCollection Collection { get; set; }

        /// <summary>
        /// Gets or sets the conversion method being used, when content of the
        /// reflective collection is being extracted out of the reflective collection.
        /// </summary>
        public Func<object?, object?>? PublicizeElementFunc { get; set; }

        /// <summary>
        /// Gets or sets the conversion method being used, when content of the
        /// reflective collection is being stored into the reflective collection.
        /// </summary>
        public Func<object?, object?>? PrivatizeElementFunc { get; set; }

        public ProxyReflectiveCollection(IReflectiveCollection collection)
        {
            Collection = collection;
            ActivateObjectConversion();
        }

        public virtual bool add(object value)
        {
            if (PrivatizeElementFunc == null)
                throw new InvalidOperationException("PrivatizeElementFunc is not set");

            var newValue = PrivatizeElementFunc(value);
            if (newValue != null)
            {
                return Collection.add(newValue);
            }

            return false;
        }

        public virtual bool addAll(IReflectiveSequence value)
        {
            if (PrivatizeElementFunc == null)
                throw new InvalidOperationException("PrivatizeElementFunc is not set");

            var result = false;
            foreach (var element in value.Select(x => PrivatizeElementFunc(x)))
            {
                if (element != null)
                {
                    result |= Collection.add(element);
                }
            }

            return result;
        }

        public virtual void clear()
        {
            Collection.clear();
        }

        public virtual IEnumerator<object?> GetEnumerator()
        {
            if (PublicizeElementFunc == null)
                throw new InvalidOperationException("PublicizeElementFunc is not set");

            foreach (var obj in Collection)
            {
                yield return PublicizeElementFunc(obj);
            }
        }

        public virtual bool remove(object? value)
        {
            if (PrivatizeElementFunc == null)
                throw new InvalidOperationException("PrivatizeElementFunc is not set");

            value = PrivatizeElementFunc(value);
            if (value != null)
            {
                return Collection.remove(value);
            }

            return false;
        }

        public virtual int size() =>
            Collection.size();

        IEnumerator IEnumerable.GetEnumerator() =>
            GetEnumerator();

        public ProxyReflectiveCollection ActivateObjectConversion<TObjectType, TElementType>(
            Func<IElement, TElementType> publicizeElement,
            Func<IObject, TObjectType> publicizeObject,
            Func<TElementType, IElement> privatizeElement,
            Func<TObjectType, IObject> privatizeObject)
            where TObjectType : class
            where TElementType : class
        {
            PublicizeElementFunc = x =>
            {
                if (x is IElement asElement)
                    return publicizeElement(asElement);

                return x is IObject asObject ? publicizeObject(asObject) : x;
            };

            PrivatizeElementFunc = x =>
            {
                if (x is TElementType asElement)
                    return privatizeElement(asElement);

                return x is TObjectType asObject ? privatizeObject(asObject) : x;
            };

            return this;
        }

        public ProxyReflectiveCollection ActivateObjectConversion()
        {
            return ActivateObjectConversion(
                x => new ProxyMofElement((MofElement) x),
                x => new ProxyMofObject(x),
                x => x.GetProxiedElement(),
                x => x.GetProxiedElement());
        }

        /// <summary>
        /// Gets the extent associated to the parent extent
        /// </summary>
        public IExtent? Extent => (Collection as IHasExtent)?.Extent;
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.ai.anomalydetector;

import com.azure.ai.anomalydetector.models.ChangePointDetectRequest;
import com.azure.ai.anomalydetector.models.ChangePointDetectResponse;
import com.azure.ai.anomalydetector.models.TimeGranularity;
import com.azure.ai.anomalydetector.models.TimeSeriesPoint;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.http.ContentType;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddHeadersPolicy;
import com.azure.core.http.policy.AzureKeyCredentialPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Sample for detecting change points in a piece of time series.
 */
public class DetectChangePoints {

    /**
     * Main method to invoke this demo.
     *
     * @param args Unused arguments to the program.
     * @throws IOException Exception thrown when there is an error in reading all the lines from the csv file.
     */
    public static void main(final String[] args) throws IOException {
        String endpoint = "<anomaly-detector-resource-endpoint>";
        String key = "<anomaly-detector-resource-key>";
        HttpHeaders headers = new HttpHeaders()
            .put("Accept", ContentType.APPLICATION_JSON);

        HttpPipelinePolicy authPolicy = new AzureKeyCredentialPolicy("Ocp-Apim-Subscription-Key",
            new AzureKeyCredential(key));
        AddHeadersPolicy addHeadersPolicy = new AddHeadersPolicy(headers);

        HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(HttpClient.createDefault())
            .policies(authPolicy, addHeadersPolicy).build();
        // Instantiate a client that will be used to call the service.
        AnomalyDetectorClient anomalyDetectorClient = new AnomalyDetectorClientBuilder()
            .pipeline(httpPipeline)
            .endpoint(endpoint)
            .buildClient();

        // Read the time series from csv file and organize the time series into list of TimeSeriesPoint.
        // The sample csv file has no header, and it contains 2 columns, namely timestamp and value.
        // The following is a snippet of the sample csv file:
        //      2018-03-01T00:00:00Z,32858923
        //      2018-03-02T00:00:00Z,29615278
        //      2018-03-03T00:00:00Z,22839355
        //      2018-03-04T00:00:00Z,25948736
        Path path = Paths.get("./src/samples/java/sample_data/request-data.csv");
        List<String> requestData = Files.readAllLines(path);
        List<TimeSeriesPoint> series = requestData.stream()
            .map(line -> line.trim())
            .filter(line -> line.length() > 0)
            .map(line -> line.split(",", 2))
            .filter(splits -> splits.length == 2)
            .map(splits -> {
                TimeSeriesPoint timeSeriesPoint = new TimeSeriesPoint();
                timeSeriesPoint.setTimestamp(OffsetDateTime.parse(splits[0]));
                timeSeriesPoint.setValue(Float.parseFloat(splits[1]));
                return timeSeriesPoint;
            })
            .collect(Collectors.toList());

        System.out.println("Detecting change points...");
        ChangePointDetectRequest request = new ChangePointDetectRequest();
        request.setSeries(series);
        // Set the granularity to be DAILY since the minimal interval in time of the sample data is one day.
        request.setGranularity(TimeGranularity.DAILY);
        ChangePointDetectResponse response = anomalyDetectorClient.detectChangePoint(request);
        if (response.getIsChangePoint().contains(true)) {
            System.out.println("Change points found in the following data positions:");
            for (int i = 0; i < request.getSeries().size(); ++i) {
                if (response.getIsChangePoint().get(i)) {
                    System.out.print(i + " ");
                }
            }
            System.out.println();
        } else {
            System.out.println("No change points were found in the series.");
        }
    }
}


text:
extern const char* TEST_WRITE_ROOT;

using namespace re2;

TEST_F(StatWriterTest, testNormalOperation) {
  Params params;
  params.add<bool>("ENABLE_STAT_WRITER", true);
  params.add<std::string>("LOG_DIR", TEST_WRITE_ROOT);

  StatWriter::init(params);
  StatWriter::setCurrentPhaseName("test_phase_before");

  StatLogger* testLogger = new StatLogger("test_logger");
  uint64_t dummyStatID = testLogger->registerStat("dummy_stat");

  StatWriter::spawn();

  StatWriter::setCurrentPhaseName("test_phase");

  testLogger->add(dummyStatID, 42);
  testLogger->add(dummyStatID, 64);

  delete testLogger;
  testLogger = NULL;

  StatWriter::teardown();

  std::string hostname;
  getHostname(hostname);

  std::string logFilePath(
    std::string(TEST_WRITE_ROOT) + "/" + hostname + "_stats.log");

  File logFile(logFilePath);

  logFile.open(File::READ);
  uint64_t fileSize = logFile.getCurrentSize();

  EXPECT_TRUE(fileSize > 0);

  char* buffer = new char[fileSize];
  memset(buffer, 0, fileSize);

  logFile.read(reinterpret_cast<uint8_t*>(buffer), fileSize);

  // There should be eight lines total, two for the stats themselves and 6 for
  // summary statistics

  std::vector<uint64_t> lineStartIndices;
  lineStartIndices.push_back(0);

  for (uint64_t i = 0; i < fileSize; i++) {
    if (buffer[i] == '\n') {
      if (i + 1 < fileSize) {
        lineStartIndices.push_back(i + 1);
      }
      buffer[i] = 0;
    }
  }

  uint64_t numLines = lineStartIndices.size();

  EXPECT_EQ(static_cast<uint64_t>(8), numLines);

  RE2 collLineRegex(
    "COLL\\s+test_phase\\s+0\\s+test_logger\\s+dummy_stat\\s+[0-9]+\\s+"
    "([0-9]+)");

  uint64_t stat;

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[0]), collLineRegex, &stat));

  EXPECT_EQ(static_cast<uint64_t>(42), stat);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[1]), collLineRegex, &stat));

  EXPECT_EQ(static_cast<uint64_t>(64), stat);

  RE2 statLineRegex("SUMM\\s+test_phase\\s+0\\s+test_logger\\s+dummy_stat"
                         "\\s+(.*?)\\s+([0-9]+)");

  std::string statName;
  uint64_t statValue;

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[2]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("min"), statName);
  EXPECT_EQ(static_cast<uint64_t>(42), statValue);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[3]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("max"), statName);
  EXPECT_EQ(static_cast<uint64_t>(64), statValue);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[4]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("sum"), statName);
  EXPECT_EQ(static_cast<uint64_t>(106), statValue);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[5]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("count"), statName);
  EXPECT_EQ(static_cast<uint64_t>(2), statValue);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[6]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("mean"), statName);
  EXPECT_EQ(static_cast<uint64_t>(53), statValue);

  EXPECT_TRUE(RE2::FullMatch(
      std::string(buffer + lineStartIndices[7]), statLineRegex, &statName,
      &statValue));

  EXPECT_EQ(std::string("variance"), statName);
  EXPECT_EQ(static_cast<uint64_t>(121), statValue);

  delete[] buffer;
}


text:
// Type definitions for fs-readfile-promise 3.0
// Project: https://github.com/shinnn/fs-readfile-promise
// Definitions by: Motosugi Murata <https://github.com/mtsg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />
import { PathLike } from "fs";
type PathType = PathLike | number;
type OptionsType = { encoding: string; flag?: string | undefined; } | string;

export = fsReadFilePromise;

/**
 * Asynchronously reads the entire contents of a file.
 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
 * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
 * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
 * If a flag is not provided, it defaults to `'r'`.
 */
declare function fsReadFilePromise(path: PathType, options: OptionsType): Promise<string>;

/**
 * Asynchronously reads the entire contents of a file.
 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
 * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
 */
declare function fsReadFilePromise(path: PathType, options?: null): Promise<Buffer>;

declare namespace fsReadFilePromise { }


text:
<?php
// src/Sdz/BlogBundle/Entity/ArticleRepository.php

namespace Sdz\BlogBundle\Entity;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;

class ArticleRepository extends EntityRepository
{
  // On ajoute deux arguments : le nombre d'articles par page, ainsi que la page courante
  public function getArticles($nombreParPage, $page)
  {
    // On déplace la vérification du numéro de page dans cette méthode
    if ($page < 1) {
      throw new \InvalidArgumentException('L\'argument $page ne peut être inférieur à 1 (valeur : "'.$page.'").');
    }

    // La construction de la requête reste inchangée
    $query = $this->createQueryBuilder('a')
                  ->leftJoin('a.image', 'i')
                    ->addSelect('i')
                  ->leftJoin('a.categories', 'cat')
                    ->addSelect('cat')
                  ->orderBy('a.date', 'DESC')
                  ->getQuery();

    // On définit l'article à partir duquel commencer la liste
    $query->setFirstResult(($page-1) * $nombreParPage)
    // Ainsi que le nombre d'articles à afficher
          ->setMaxResults($nombreParPage);

    // Enfin, on retourne l'objet Paginator correspondant à la requête construite
    // (n'oubliez pas le use correspondant en début de fichier)
    return new Paginator($query);
  }
}


text:
JMX is a library which allows you to access JMX MBeans as a client or create
your own MBeans as a Ruby class.

## SYNOPSIS:

Connect to same JVM as client script and look at Memory MBean

```ruby
   require 'jmx'

   client = JMX.connect(:host => 'localhost', :port => 9999)

   memory = client["java.lang:type=Memory"]
   puts memory.attributes
```

You can also create your own MBeans and register them as well:

```ruby
   require 'jmx'

   class MyDynamicMBean < RubyDynamicMBean
     rw_attribute :name, :string, "My sample attribute"
     r_attribute :explicit_reader, :int, "Sample int with writer", :my_reader

     operation "Doubles a value"
     parameter :int, "a", "Value to double"
     returns :int
     def double(a)
       a + a
     end
   end

   my_server = JMX::MBeanServer.new
   my_server_connector = JMX.simple_server(server: my_server)

   dyna = MyDynamicMBean.new("domain.MySuperBean", "Heh")
   domain = my_server.default_domain
   my_server.register_mbean dyna, "#{domain}:type=MyDynamicMBean"
```

## REQUIREMENTS:

* JRuby

## INSTALL:

* jruby -S gem install jmx

## PROBLEMS:

* Use '-J-Dcom.sun.management.jmxremote' to make jruby process accessible from a jruby command-line


text:
package com.wci.umls.server.helpers;

import com.wci.umls.server.model.workflow.WorkflowEpoch;

/**
 * Represents a sortable list of {@link WorkflowEpoch}
 */
public interface WorkflowEpochList extends ResultList<WorkflowEpoch> {
  // nothing extra, a simple wrapper for easy serialization
}


text:
[jvm]
Content
open override fun [bounds](bounds.md)(value: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[GenericType.Bound](../../../-generic-type/-bound/index.md)>): [GenericType.Builder](../../../-generic-type/-builder/index.md)<[AnnotatedKoresType.GenericAnnotatedKoresType](../index.md), [AnnotatedKoresType.GenericAnnotatedKoresType.GenericBuilder](index.md)>
More info

See T.bounds


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Plethora.Test
{
    [TestClass]
    public class StringHelper_Test
    {
        //                        000000000011111111112222222222
        //                        012345678901234567890123456789
        private const string s = "This is a test string.";

        //                                       0 0000000001111111111 2222222222333333
        //                                       0 1234567890123456789 0123456789012345
        private const string lotsOfWhiteSpace = " \t  lots  of  white \t space.     ";

        //For the variable s above:
        // the first character not in this set should be 'a'.
        // the last character not in this set should be 'r'.
        private readonly char[] notOfAny = new[] { 'T', 'h', 'i', 's', ' ', 't', 'n', 'g', '.' };

        #region WhiteSpace

        [TestMethod]
        public void WhiteSpace()
        {
            // Action
            char[] whiteSpace = StringHelper.WhiteSpace;

            // Assert
            Assert.IsNotNull(whiteSpace);
            var spaceIndex = Array.IndexOf(whiteSpace, ' ');
            Assert.IsTrue(spaceIndex >= 0);
        }
        #endregion

        #region IndexNotOfAny

        [TestMethod]
        public void IndexNotOfAny()
        {
            // Action
            int index = s.IndexNotOfAny(notOfAny);

            // Assert
            Assert.AreEqual(8, index);
        }

        [TestMethod]
        public void IndexNotOfAny_NotFound()
        {
            // Action
            int index = s.IndexNotOfAny(s.ToCharArray());

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfAny_Start()
        {
            // Action
            int index = s.IndexNotOfAny(notOfAny, 4);

            // Assert
            Assert.AreEqual(8, index);
        }

        [TestMethod]
        public void IndexNotOfAny_Start_NotFound()
        {
            // Action
            int index = s.IndexNotOfAny(s.ToCharArray(), 4);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfAny_Start_Count()
        {
            // Action
            int index = s.IndexNotOfAny(notOfAny, 4, 9);

            // Assert
            Assert.AreEqual(8, index);
        }

        [TestMethod]
        public void IndexNotOfAny_Start_Count_NotFound()
        {
            // Action
            int index = s.IndexNotOfAny(notOfAny, 4, 3);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfAny_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).IndexNotOfAny(notOfAny);

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfAny_Fail_StartNegative()
        {
            try
            {
                // Action
                s.IndexNotOfAny(notOfAny, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfAny_Fail_CountNegative()
        {
            try
            {
                // Action
                s.IndexNotOfAny(notOfAny, 4, -2);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfAny_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                s.IndexNotOfAny(notOfAny, 17, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region LastIndexNotOfAny

        [TestMethod]
        public void LastIndexNotOfAny()
        {
            // Action
            int index = s.LastIndexNotOfAny(notOfAny);

            // Assert
            Assert.AreEqual(17, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_NotFound()
        {
            // Action
            int index = s.LastIndexNotOfAny(s.ToCharArray());

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_Start()
        {
            // Action
            int index = s.LastIndexNotOfAny(notOfAny, 15);

            // Assert
            Assert.AreEqual(11, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_Start_NotFound()
        {
            // Action
            int index = s.LastIndexNotOfAny(s.ToCharArray(), 4);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_Start_Count()
        {
            // Action
            int index = s.LastIndexNotOfAny(notOfAny, 15, 9);

            // Assert
            Assert.AreEqual(11, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_Start_Count_NotFound()
        {
            // Action
            int index = s.LastIndexNotOfAny(notOfAny, 4, 3);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfAny_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).LastIndexNotOfAny(notOfAny);

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfAny_Fail_StartNegative()
        {
            try
            {
                // Action
                s.LastIndexNotOfAny(notOfAny, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfAny_Fail_CountNegative()
        {
            try
            {
                // Action
                s.LastIndexNotOfAny(notOfAny, 4, -2);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfAny_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                s.IndexNotOfAny(notOfAny, 17, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region IndexOfWhiteSpace

        [TestMethod]
        public void IndexOfWhiteSpace()
        {
            // Action
            int index = s.IndexOfWhiteSpace();

            // Assert
            Assert.AreEqual(4, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_NotFound()
        {
            // Action
            int index = "ThereIsNoWhiteSpace".IndexOfWhiteSpace();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_StartIndex()
        {
            // Action
            int index = s.IndexOfWhiteSpace(11);

            // Assert
            Assert.AreEqual(14, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_StartIndex_NotFound()
        {
            // Action
            int index = s.IndexOfWhiteSpace(16);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_StartIndex_Count()
        {
            // Action
            int index = s.IndexOfWhiteSpace(11, 5);

            // Assert
            Assert.AreEqual(14, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_StartIndex_Count_NotFound()
        {
            // Action
            int index = s.IndexOfWhiteSpace(11, 2);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWhiteSpace_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).IndexOfWhiteSpace();

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void IndexOfWhiteSpace_Fail_StartNegative()
        {
            try
            {
                // Action
                s.IndexOfWhiteSpace(-5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexOfWhiteSpace_Fail_CountNegative()
        {
            try
            {
                // Action
                s.IndexOfWhiteSpace(0, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexOfWhiteSpace_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                s.IndexOfWhiteSpace(16, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region LastIndexOfWhiteSpace

        [TestMethod]
        public void LastIndexOfWhiteSpace()
        {
            // Action
            int index = s.LastIndexOfWhiteSpace();

            // Assert
            Assert.AreEqual(14, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_NotFound()
        {
            // Action
            int index = "ThereIsNoWhiteSpace".LastIndexOfWhiteSpace();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_StartIndex()
        {
            // Action
            int index = s.LastIndexOfWhiteSpace(11);

            // Assert
            Assert.AreEqual(9, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_StartIndex_NotFound()
        {
            // Action
            int index = s.LastIndexOfWhiteSpace(3);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_StartIndex_Count()
        {
            // Action
            int index = s.LastIndexOfWhiteSpace(11, 5);

            // Assert
            Assert.AreEqual(9, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_StartIndex_Count_NotFound()
        {
            // Action
            int index = s.LastIndexOfWhiteSpace(11, 2);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).LastIndexOfWhiteSpace();

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_Fail_StartNegative()
        {
            try
            {
                // Action
                s.LastIndexOfWhiteSpace(-5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_Fail_CountNegative()
        {
            try
            {
                // Action
                s.LastIndexOfWhiteSpace(0, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexOfWhiteSpace_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                s.LastIndexOfWhiteSpace(16, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region IndexNotOfWhiteSpace

        [TestMethod]
        public void IndexNotOfWhiteSpace()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexNotOfWhiteSpace();

            // Assert
            Assert.AreEqual(4, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_NotFound()
        {
            // Action
            int index = "  \t  ".IndexNotOfWhiteSpace();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_StartIndex()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexNotOfWhiteSpace(19);

            // Assert
            Assert.AreEqual(22, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_StartIndex_NotFound()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexNotOfWhiteSpace(30);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_StartIndex_Count()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexNotOfWhiteSpace(19, 5);

            // Assert
            Assert.AreEqual(22, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_StartIndex_Count_NotFound()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexNotOfWhiteSpace(19, 2);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).IndexNotOfWhiteSpace();

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_Fail_StartNegative()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.IndexNotOfWhiteSpace(-5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_Fail_CountNegative()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.IndexNotOfWhiteSpace(0, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void IndexNotOfWhiteSpace_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.IndexNotOfWhiteSpace(16, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region LastIndexNotOfWhiteSpace

        [TestMethod]
        public void LastIndexNotOfWhiteSpace()
        {
            // Action
            int index = lotsOfWhiteSpace.LastIndexNotOfWhiteSpace();

            // Assert
            Assert.AreEqual(27, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_NotFound()
        {
            // Action
            int index = "   \t   ".LastIndexNotOfWhiteSpace();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_StartIndex()
        {
            // Action
            int index = lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(21);

            // Assert
            Assert.AreEqual(18, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_StartIndex_NotFound()
        {
            // Action
            int index = lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(3);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_StartIndex_Count()
        {
            // Action
            int index = lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(21, 5);

            // Assert
            Assert.AreEqual(18, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_StartIndex_Count_NotFound()
        {
            // Action
            int index = lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(21, 2);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).LastIndexNotOfWhiteSpace();

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_Fail_StartNegative()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(-5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_Fail_CountNegative()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(0, -5);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }

        [TestMethod]
        public void LastIndexNotOfWhiteSpace_Fail_StartPlusCountTooLarge()
        {
            try
            {
                // Action
                lotsOfWhiteSpace.LastIndexNotOfWhiteSpace(16, 22);

                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region IndexOfWord

        [TestMethod]
        public void IndexOfWord()
        {
            // Action
            int index = s.IndexOfWord();

            // Assert
            Assert.AreEqual(1, index);
        }

        [TestMethod]
        public void IndexOfWord_NotFound()
        {
            // Action
            int index = "    ".IndexOfWord();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWord_NotLeading()
        {
            // Action
            int index = lotsOfWhiteSpace.IndexOfWord();

            // Assert
            Assert.AreEqual(4, index);
        }

        [TestMethod]
        public void IndexOfWord_Start()
        {
            // Action
            int index = s.IndexOfWord(11);

            // Assert
            Assert.AreEqual(15, index);
        }

        [TestMethod]
        public void IndexOfWord_Start_NotFound()
        {
            // Action
            int index = s.IndexOfWord(19);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWord_StartBeginning()
        {
            // Action
            int index = s.IndexOfWord(11, true);

            // Assert
            Assert.AreEqual(15, index);
        }

        [TestMethod]
        public void IndexOfWord_StartBeginning_NotFound()
        {
            // Action
            int index = s.IndexOfWord(19, true);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWord_StartEnd()
        {
            // Action
            int index = s.IndexOfWord(11, false);

            // Assert
            Assert.AreEqual(13, index);
        }

        [TestMethod]
        public void IndexOfWord_StartEnd_NotFound()
        {
            // Action
            int index = "     ".IndexOfWord(2, false);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void IndexOfWord_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).IndexOfWord();

                Assert.Fail();
            }
            catch(ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void IndexOfWord_Fail_StartNegative()
        {
            try
            {
                // Action
                s.IndexOfWord(-5);

                Assert.Fail();
            }
            catch(ArgumentOutOfRangeException)
            {
            }
        }
        #endregion

        #region LastIndexOfWord

        [TestMethod]
        public void LastIndexOfWord()
        {
            // Action
            int index = s.LastIndexOfWord();

            // Assert
            Assert.AreEqual(15, index);
        }

        [TestMethod]
        public void LastIndexOfWord_NotFound()
        {
            // Action
            int index = "    ".LastIndexOfWord();

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWord_Start()
        {
            // Action
            int index = s.LastIndexOfWord(11);

            // Assert
            Assert.AreEqual(10, index);
        }

        [TestMethod]
        public void LastIndexOfWord_Start_NotFound()
        {
            // Action
            int index = "    this".LastIndexOfWord(3);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWord_StartBeginning()
        {
            // Action
            int index = s.LastIndexOfWord(12, true);

            // Assert
            Assert.AreEqual(10, index);
        }

        [TestMethod]
        public void LastIndexOfWord_StartBeginning_NotFound()
        {
            // Action
            int index = "    this".LastIndexOfWord(3, true);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWord_StartEnd_NotEndOfWord()
        {
            // Action
            int index = s.LastIndexOfWord(11, false);

            // Assert
            Assert.AreEqual(8, index);
        }

        [TestMethod]
        public void LastIndexOfWord_StartEnd_EndOfWord()
        {
            // Action
            int index = s.LastIndexOfWord(13, false);

            // Assert
            Assert.AreEqual(13, index);
        }

        [TestMethod]
        public void LastIndexOfWord_StartEnd_NotFound()
        {
            // Action
            int index = "     ".LastIndexOfWord(2, false);

            // Assert
            Assert.AreEqual(-1, index);
        }

        [TestMethod]
        public void LastIndexOfWord_Fail_Null()
        {
            try
            {
                // Action
                ((string)null).LastIndexOfWord();

                Assert.Fail();
            }
            catch(ArgumentNullException)
            {
            }
        }

        [TestMethod]
        public void LastIndexOfWord_Fail_StartNegative()
        {
            try
            {
                // Action
                s.LastIndexOfWord(-5);

                Assert.Fail();
            }
            catch(ArgumentOutOfRangeException)
            {
            }
        }
        #endregion
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.containerregistry.generated;

import com.azure.core.util.Context;

/** Samples for Webhooks Get. */
public final class WebhooksGetSamples {
    /*
     * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2021-09-01/examples/WebhookGet.json
     */
    /**
     * Sample code: WebhookGet.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void webhookGet(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .containerRegistries()
            .manager()
            .serviceClient()
            .getWebhooks()
            .getWithResponse("myResourceGroup", "myRegistry", "myWebhook", Context.NONE);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Tincan.IO - Simple File Sharing</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mark Lavin">
    <link href="{{ static_url('css/tincan.css') }}" rel="stylesheet">

Tincan.IO

It's just that simple

                Initiate transfer


text:
package cubicchunks.worldgen.generator.custom;

import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.Biome;

import java.util.Random;

import cubicchunks.world.ICubicWorld;
import cubicchunks.world.cube.Cube;
import cubicchunks.worldgen.generator.GlobalGeneratorConfig;
import cubicchunks.worldgen.generator.ICubePrimer;
import cubicchunks.worldgen.generator.custom.builder.BasicBuilder;
import cubicchunks.worldgen.generator.custom.builder.IBuilder;

import static cubicchunks.util.Coords.localToBlock;
import static cubicchunks.util.MathUtil.lerp;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.MAX_ELEV;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.X_SECTIONS;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.X_SECTION_SIZE;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.Y_SECTIONS;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.Y_SECTION_SIZE;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.Z_SECTIONS;
import static cubicchunks.worldgen.generator.GlobalGeneratorConfig.Z_SECTION_SIZE;

public class CustomTerrainGenerator {
	private static final int OCTAVES = 16;

	private final ICubicWorld world;
	private Biome[] biomes;

	private final long seed;
	private final Random rand;

	private final double[][][] noiseArrayHigh;
	private final double[][][] noiseArrayLow;
	private final double[][][] noiseArrayAlpha;

	private final double[][][] rawDensity;

	private final double[][][] expandedDensity;

	private final IBuilder builderHigh;
	private final IBuilder builderLow;
	private final IBuilder builderAlpha;

	private double biomeVolatility;
	private double biomeHeight;

	private final int maxSmoothRadius;
	private final int maxSmoothDiameter;

	private final double[][] noiseArrayHeight;

	private final double[] nearBiomeWeightArray;

	private final BasicBuilder builderHeight;

	private final boolean needsScaling = true;

	public CustomTerrainGenerator(ICubicWorld world, final long seed) {

		this.seed = seed;
		this.rand = new Random(seed);

		this.maxSmoothRadius = 2*(int) (MAX_ELEV/64);
		this.maxSmoothDiameter = this.maxSmoothRadius*2 + 1;

		this.world = world;

		this.noiseArrayHigh = new double[X_SECTIONS][Y_SECTIONS][Z_SECTIONS];
		this.noiseArrayLow = new double[X_SECTIONS][Y_SECTIONS][Z_SECTIONS];
		this.noiseArrayAlpha = new double[X_SECTIONS][Y_SECTIONS][Z_SECTIONS];

		this.rawDensity = new double[X_SECTIONS][Y_SECTIONS][Z_SECTIONS];
		this.expandedDensity = new double[Cube.SIZE][Cube.SIZE][Cube.SIZE];

		this.builderHigh = createHighBuilder();
		this.builderLow = createLowBuilder();
		this.builderAlpha = createAlphaBuilder();

		this.noiseArrayHeight = new double[X_SECTIONS][Z_SECTIONS];

		this.nearBiomeWeightArray = new double[this.maxSmoothDiameter*this.maxSmoothDiameter];

		for (int x = -this.maxSmoothRadius; x <= this.maxSmoothRadius; x++) {
			for (int z = -this.maxSmoothRadius; z <= this.maxSmoothRadius; z++) {
				final double f1 = 10.0F/Math.sqrt(x*x + z*z + 0.2F);
				this.nearBiomeWeightArray[x + this.maxSmoothRadius + (z + this.maxSmoothRadius)
					*this.maxSmoothDiameter] = f1;
			}
		}

		double freq = 200.0/Math.pow(2, 10)/(MAX_ELEV/64);

		this.builderHeight = new BasicBuilder();
		this.builderHeight.setSeed(this.rand.nextInt());
		this.builderHeight.setOctaves(10);
		this.builderHeight.setMaxElev(8);
		this.builderHeight.setFreq(freq);
		this.builderHeight.build();
	}

	public void generate(final ICubePrimer cube, int cubeX, int cubeY, int cubeZ) {
		generateNoiseArrays(cubeX, cubeY, cubeZ);
		generateTerrainArray(cube, cubeX, cubeY, cubeZ);

		generateTerrain(cube, this.rawDensity, cubeX, cubeY, cubeZ);
	}

	private void generateTerrain(ICubePrimer cube, double[][][] input, int cubeX, int cubeY, int cubeZ) {
		int xSteps = X_SECTION_SIZE - 1;
		int ySteps = Y_SECTION_SIZE - 1;
		int zSteps = Z_SECTION_SIZE - 1;

		// use the noise to generate the generator
		for (int noiseX = 0; noiseX < X_SECTIONS - 1; noiseX++) {
			for (int noiseZ = 0; noiseZ < Z_SECTIONS - 1; noiseZ++) {
				for (int noiseY = 0; noiseY < Y_SECTIONS - 1; noiseY++) {
					// get the noise samples
					double x0y0z0 = input[noiseX][noiseY][noiseZ];
					double x0y0z1 = input[noiseX][noiseY][noiseZ + 1];
					double x1y0z0 = input[noiseX + 1][noiseY][noiseZ];
					double x1y0z1 = input[noiseX + 1][noiseY][noiseZ + 1];

					double x0y1z0 = input[noiseX][noiseY + 1][noiseZ];
					double x0y1z1 = input[noiseX][noiseY + 1][noiseZ + 1];
					double x1y1z0 = input[noiseX + 1][noiseY + 1][noiseZ];
					double x1y1z1 = input[noiseX + 1][noiseY + 1][noiseZ + 1];

					for (int x = 0; x < xSteps; x++) {
						int xRel = noiseX*xSteps + x;

						double xd = (double) x/xSteps;

						// interpolate along x
						double xy0z0 = lerp(xd, x0y0z0, x1y0z0);
						double xy0z1 = lerp(xd, x0y0z1, x1y0z1);
						double xy1z0 = lerp(xd, x0y1z0, x1y1z0);
						double xy1z1 = lerp(xd, x0y1z1, x1y1z1);

						for (int z = 0; z < zSteps; z++) {
							int zRel = noiseZ*zSteps + z;

							double zd = (double) z/zSteps;

							// interpolate along z
							double xy0z = lerp(zd, xy0z0, xy0z1);
							double xy1z = lerp(zd, xy1z0, xy1z1);

							for (int y = 0; y < ySteps; y++) {
								int yRel = noiseY*ySteps + y;

								double yd = (double) y/ySteps;

								// interpolate along y
								double xyz = lerp(yd, xy0z, xy1z);

								//values needed to calculate gradient vector
								double xyz0 = lerp(yd, xy0z0, xy1z0);
								double xyz1 = lerp(yd, xy0z1, xy1z1);

								double x0y0z = lerp(zd, x0y0z0, x0y0z1);
								double x0y1z = lerp(zd, x0y1z0, x0y1z1);
								double x1y0z = lerp(zd, x1y0z0, x1y0z1);
								double x1y1z = lerp(zd, x1y1z0, x1y1z1);

								double x0yz = lerp(yd, x0y0z, x0y1z);
								double x1yz = lerp(yd, x1y0z, x1y1z);

								//calculate gradient vector
								double xGrad = (x1yz - x0yz)/xSteps;
								double yGrad = (xy1z - xy0z)/ySteps;
								double zGrad = (xyz1 - xyz0)/zSteps;

								IBlockState state = getBlockStateFor(localToBlock(cubeY, yRel), xyz, xGrad, yGrad, zGrad);
								cube.setBlockState(xRel, yRel, zRel, state);
							}
						}
					}
				}
			}
		}
	}

	private IBlockState getBlockStateFor(int height, double density, double xGrad, double yGrad, double zGrad) {
		final double dirtDepth = 4;
		IBlockState state = Blocks.AIR.getDefaultState();
		if (density > 0) {
			state = Blocks.STONE.getDefaultState();
			//if the block above would be empty:
			if (density + yGrad <= 0) {
				state = Blocks.GRASS.getDefaultState();
				//if density decreases as we go down && density < dirtDepth
			} else if (yGrad < 0 && density < dirtDepth) {
				state = Blocks.DIRT.getDefaultState();
			}
		} else if (height < 64) {
			state = Blocks.WATER.getDefaultState();
		}
		return state;
	}

	private IBuilder createHighBuilder() {
		Random rand = new Random(this.seed*2);
		double freq = 684.412D/Math.pow(2, OCTAVES)/(MAX_ELEV/64.0);

		BasicBuilder builderHigh = new BasicBuilder();
		builderHigh.setSeed(rand.nextInt());
		builderHigh.setOctaves(OCTAVES);
		builderHigh.setPersistance(0.5);
		// with 16 octaves probability of getting 1 is too low
		builderHigh.setMaxElev(2);
		builderHigh.setClamp(-1, 1);
		builderHigh.setFreq(freq, freq, freq);
		builderHigh.build();

		return builderHigh;
	}

	private IBuilder createLowBuilder() {
		Random rand = new Random(this.seed*3);
		double freq = 684.412D/Math.pow(2, OCTAVES)/(MAX_ELEV/64.0);

		BasicBuilder builderLow = new BasicBuilder();
		builderLow.setSeed(rand.nextInt());
		builderLow.setOctaves(OCTAVES);
		builderLow.setPersistance(0.5);
		builderLow.setMaxElev(2);
		builderLow.setClamp(-1, 1);
		builderLow.setFreq(freq, freq, freq);
		builderLow.build();

		return builderLow;
	}

	private IBuilder createAlphaBuilder() {
		Random rand = new Random(this.seed*4);
		double freq = 8.55515/Math.pow(2, 8)/(MAX_ELEV/64.0);

		BasicBuilder builderAlpha = new BasicBuilder();
		builderAlpha.setSeed(rand.nextInt());
		builderAlpha.setOctaves(8);
		builderAlpha.setPersistance(0.5);
		builderAlpha.setMaxElev(25.6);
		builderAlpha.setSeaLevel(0.5);
		builderAlpha.setClamp(0, 1);
		builderAlpha.setFreq(freq, freq*2, freq);
		builderAlpha.build();

		return builderAlpha;
	}

	/*
	 * (non-Javadoc)
	 * @see cubicchunks.worldgen.generator.ITerrainGenerator#generateNoiseArrays(cubicchunks.world.cube.Cube)
	 */
	private void generateNoiseArrays(int cubeX, int cubeY, int cubeZ) {
		int cubeXMin = cubeX*(X_SECTIONS - 1);
		int cubeYMin = cubeY*(Y_SECTIONS - 1);
		int cubeZMin = cubeZ*(Z_SECTIONS - 1);

		for (int x = 0; x < X_SECTIONS; x++) {
			int xPos = cubeXMin + x;

			for (int z = 0; z < Z_SECTIONS; z++) {
				int zPos = cubeZMin + z;

				for (int y = 0; y < Y_SECTIONS; y++) {
					int yPos = cubeYMin + y;

					this.noiseArrayHigh[x][y][z] = this.builderHigh.getValue(xPos, yPos, zPos);
					this.noiseArrayLow[x][y][z] = this.builderLow.getValue(xPos, yPos, zPos);
					this.noiseArrayAlpha[x][y][z] = this.builderAlpha.getValue(xPos, yPos, zPos);
				}
			}
		}
	}

	/*
	 * (non-Javadoc)
	 * @see cubicchunks.worldgen.generator.ITerrainGenerator#generateTerrainArray(cubicchunks.world.cube.Cube)
	 */
	private void generateTerrainArray(final ICubePrimer cube, int cubeX, int cubeY, int cubeZ) {
		this.biomes = getBiomeMap(cubeX, cubeZ);

		fillHeightArray(cubeX, cubeZ);
		for (int x = 0; x < X_SECTIONS; x++) {
			for (int z = 0; z < Z_SECTIONS; z++) {
				// TODO: Remove addHeight?
				double addHeight = getAddHeight(x, z);
				biomeFactor(x, z, addHeight);

				for (int y = 0; y < Y_SECTIONS; y++) {
					final double vol1Low = this.noiseArrayLow[x][y][z];
					final double vol2High = this.noiseArrayHigh[x][y][z];

					final double noiseAlpha = this.noiseArrayAlpha[x][y][z];

					double output = lerp(noiseAlpha, vol1Low, vol2High);

					double heightModifier = this.biomeHeight;
					double volatilityModifier = this.biomeVolatility;

					final double yAbs = (cubeY*16.0 + y*8.0)/MAX_ELEV;
					if (yAbs < heightModifier) {
						// generator below average biome geight is more flat
						volatilityModifier /= 4.0;
					}

					// NOTE: Multiplication by nonnegative number and addition when using 3d noise effects are the same
					// as with heightmap.

					// make height range lower
					output *= volatilityModifier;
					// height shift
					output += heightModifier;

					// Since in TWM we don't have height limit we could skip it but PLATEAU biomes need it
					int maxYSections = (int) Math.round(MAX_ELEV/Y_SECTION_SIZE);
					if (yAbs*MAX_ELEV > maxYSections - 4) {
						// TODO: Convert Y cutoff to work correctly with noise between -1 and 1
						// final double a = ( yAbs - ( maxYSections - 4 ) ) / 3.0F;
						// output = output * ( 1.0D - a ) - 10.0D * a;
					}
					this.rawDensity[x][y][z] = output*GlobalGeneratorConfig.MAX_ELEV + 64 - yAbs*MAX_ELEV;
				}
			}
		}
	}

	private Biome[] getBiomeMap(int cubeX, int cubeZ) {
		return world.getProvider().getBiomeProvider().getBiomesForGeneration(this.biomes,
			cubeX*4 - this.maxSmoothRadius, cubeZ*4 - this.maxSmoothRadius,
			X_SECTION_SIZE + this.maxSmoothDiameter, Z_SECTION_SIZE + this.maxSmoothDiameter);
	}

	/**
	 * Calculates biome height and volatility and adds addHeight to result.
	 *

	 * It converts vanilla biome values to some more predictable format:
	 *

	 * biome volatility == 0 will generate flat generator
	 *

	 * biome volatility == 0.5 means that max difference between the actual height and average height is 0.5 of max
	 * generation height from sea level. High volatility will generate overhangs
	 *

	 * biome height == 0 will generate generator at sea level
	 *

	 * biome height == 1 will generate generator will generate at max generation height above sea level.
	 *

	 * Volatility Note: Terrain below biome height has volatility divided by 4, probably to add some flat generator to
	 * mountanious biomes
	 */
	private void biomeFactor(final int x, final int z, final double addHeight) {
		// Calculate weighted average of nearby biomes height and volatility
		float smoothVolatility = 0.0F;
		float smoothHeight = 0.0F;

		float biomeWeightSum = 0.0F;
		final Biome centerBiomeConfig = getCenterBiome(x, z);
		final int lookRadius = this.maxSmoothRadius;

		for (int nextX = -lookRadius; nextX <= lookRadius; nextX++) {
			for (int nextZ = -lookRadius; nextZ <= lookRadius; nextZ++) {
				final Biome biome = getOffsetBiome(x, z, nextX, nextZ);
				final float biomeHeight = biome.getBaseHeight();
				final float biomeVolatility = biome.getHeightVariation();

				double biomeWeight = calcBiomeWeight(nextX, nextZ, biomeHeight);

				biomeWeight = Math.abs(biomeWeight);
				if (biomeHeight > centerBiomeConfig.getBaseHeight()) {
					// prefer biomes with lower height?
					biomeWeight /= 2.0F;
				}
				smoothVolatility += biomeVolatility*biomeWeight;
				smoothHeight += biomeHeight*biomeWeight;

				biomeWeightSum += biomeWeight;
			}
		}

		smoothVolatility /= biomeWeightSum;
		smoothHeight /= biomeWeightSum;

		// Convert from vanilla height/volatility format
		// to something easier to predict
		this.biomeVolatility = smoothVolatility*0.9 + 0.1;
		this.biomeVolatility *= 4.0/3.0;

		// divide everything by 64, then it will be multpllied by maxElev
		// vanilla sea level: 63.75 / 64.00

		// sea level 0.75/64 of height above sea level (63.75 = 63+0.75)
		this.biomeHeight = 0.75/64.0;
		this.biomeHeight += smoothHeight*17.0/64.0;
		// TODO: Remove addHeight? it changes the result by at most 1 block
		this.biomeHeight += 0.2*addHeight*17.0/64.0;
	}

	private Biome getCenterBiome(final int x, final int z) {
		return this.biomes[x + this.maxSmoothRadius + (z + this.maxSmoothRadius)
			*(X_SECTION_SIZE + this.maxSmoothDiameter)];
	}

	private Biome getOffsetBiome(final int x, final int z, int nextX, int nextZ) {
		return this.biomes[x + nextX + this.maxSmoothRadius + (z + nextZ + this.maxSmoothRadius)
			*(X_SECTION_SIZE + this.maxSmoothDiameter)];
	}

	private double calcBiomeWeight(int nextX, int nextZ, float biomeHeight) {
		return this.nearBiomeWeightArray[nextX + this.maxSmoothRadius + (nextZ + this.maxSmoothRadius)
			*this.maxSmoothDiameter]
			/(biomeHeight + 2.0F);
	}

	private void fillHeightArray(int cubeX, int cubeZ) {
		int cubeXMin = cubeX*(X_SECTION_SIZE - 1);
		int cubeZMin = cubeZ*(Z_SECTION_SIZE - 1);

		for (int x = 0; x < X_SECTIONS; x++) {
			int xPos = cubeXMin + x;

			for (int z = 0; z < Z_SECTIONS; z++) {
				int zPos = cubeZMin + z;

				this.noiseArrayHeight[x][z] = this.builderHeight.getValue(xPos, 0, zPos);

			}
		}
	}

	/**
	 * This method is there only because the code exists in vanilla, it affects generator height by at most 1 block
	 * (+/-0.425 blocks). In Minecraft beta it was base generator height, but as of beta 1.8 it doesn't have any
	 * significant effect. It's multiplied 0.2 before it's used.
	 */
	private double getAddHeight(final int x, final int z) {
		double noiseHeight = this.noiseArrayHeight[x][z];

		assert noiseHeight <= 8 && noiseHeight >= -8;

		if (noiseHeight < 0.0D) {
			noiseHeight = -noiseHeight*0.3D;
		}

		noiseHeight = noiseHeight*3.0D - 2.0D;

		if (noiseHeight < 0.0D) {
			noiseHeight /= 2.0D;

			if (noiseHeight < -1.0D) {
				noiseHeight = -1.0D;
			}
			noiseHeight /= 1.4D;
			noiseHeight /= 2.0D;

		} else {
			if (noiseHeight > 1.0D) {
				noiseHeight = 1.0D;
			}
			noiseHeight /= 8.0D;
		}
		return noiseHeight;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".network.ui.EnterCodeFragment"
    tools:background="@drawable/gradient_background">

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/titleTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/login_to_ruuvi_network"
        android:singleLine="false"
        android:layout_marginTop="88dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:textColor="@color/white"
        android:fontFamily="@font/montserrat_extra_bold_ttf"
        android:textSize="40sp"
        android:textAlignment="center"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        />

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/registerTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        android:layout_marginTop="48dp"
        android:singleLine="false"
        android:text="@string/sign_in_check_email"
        android:textColor="@color/white"
        android:fontFamily="@font/montserrat_bold"
        android:textSize="14sp"
        android:lineSpacingExtra="16dp"
        android:textAlignment="center"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/titleTextView" />

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/enterCodeLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        android:layout_marginBottom="64dp"
        android:textColorHint="@color/white"
        app:hintTextColor="@color/white"
        app:layout_constraintBottom_toTopOf="@+id/submitCodeButton">
        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/enterCodeManuallyEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:textColor="@color/white"
            android:fontFamily="@font/montserrat"
            android:hint="@string/sign_in_code_hint" />
    </com.google.android.material.textfield.TextInputLayout>

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/errorTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        tools:text="error text"
        android:textColor="@color/white"
        android:fontFamily="@font/montserrat"
        app:layout_constraintTop_toBottomOf="@+id/enterCodeLayout" />

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/submitCodeButton"
        style="@style/roundButton"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="64dp"
        android:layout_marginEnd="64dp"
        android:layout_marginBottom="88dp"
        android:text="@string/sign_in_login_button"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/skipTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="28dp"
        android:layout_marginBottom="28dp"
        android:text="@string/skip"
        android:textColor="@color/white"
        android:fontFamily="@font/montserrat_extra_bold_ttf"
        android:textAlignment="textEnd"
        android:textSize="14sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>


text:
#ifndef STDLIB_CONSTANTS_FLOAT64_EXPONENT_BIAS_H
#define STDLIB_CONSTANTS_FLOAT64_EXPONENT_BIAS_H

/**
* Macro for the bias of a double-precision floating-point number's exponent.
*/
#define STDLIB_CONSTANT_FLOAT64_EXPONENT_BIAS 1023

#endif // !STDLIB_CONSTANTS_FLOAT64_EXPONENT_BIAS_H


text:
Register

                    Plenty of room for you, your colleagues, your friends... but don't wait too long, seats are limited!

Registration is FREE, but mandatory - we need to know how much cake and pizza to buy. Please be fair and only reserve a seat if you intend to be in Munich on December 2nd. Thank you!

Powered by Eventbrite


text:
<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class BaseDatosPersonas extends CI_Model {
    private $tablePersonas               =   "";
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->tablePersonas             = "app_personas";
    }
    public function getPersonas($where)
    {
        $this->db->select("*");
        $this->db->where($where);
        $this->db->from($this->tablePersonas);
        $id = $this->db->get();
        //print_r($this->db->last_query());die();
        return $id->result_array();
    }/*
    public function creaNuevaArea($dataInserta)
    {
        $this->db->insert($this->tableAreas,$dataInserta);
        //print_r($this->db->last_query());die();
        return $this->db->insert_id();
    }

    public function borrarArea($where,$dataInserta)
    {
        $this->db->where($where);
        $this->db->update($this->tableAreas,$dataInserta);
        //print_r($this->db->last_query());die();
        return $this->db->affected_rows();
    }*/

}

?>