text:
/* This is a way for it to be DRYER

$(document).ready(function(){

	$(".borderBaths").hide();
	$("#myCarouselBaths").hide();
	// hiding kitchen slider content
	$(".borderKitchens").hide();
	$("#myCarouselKitchens").hide();
	// hiding living room slider content
	$(".borderLivingRooms").hide();
	$("#myCarouselLivingRooms").hide();
	// hiding offices / built-ins slider content
	$(".borderOffices").hide();
	$("#myCarouselOffices").hide();

	$(".galleryDescriptions").hide();

	$('.carousel-button').on('click', function(){
		var carouselID = $(this).attr('data-carouselId');
		$('#'+carouselID).show();
		alert(carouselID)
	})
});

*/

$(document).ready(function(){
/*
	var galleries = [{

		galleryName: "Kitchen Gallery"
	}, {
		galleryName: "Bath Gallery"
	}, {
		galleryName: "Living Room Gallery"
	}, {
		galleryName: "Office | Built-In | Outdoor"
	}];

	var galleryCount = 0;

	*/

	//originally hiding all carousel for sections from showing
	//hiding bath slider content
	$(".borderBaths").hide();
	$("#myCarouselBaths").hide();
	// hiding kitchen slider content
	$(".borderKitchens").hide();
	$("#myCarouselKitchens").hide();
	// hiding living room slider content
	$(".borderLivingRooms").hide();
	$("#myCarouselLivingRooms").hide();
	// hiding offices / built-ins slider content
	$(".borderOffices").hide();
	$("#myCarouselOffices").hide();

	$(".galleryDescriptions").hide();

	// when kitchens button is clicked on function will run and show the below items
	$("#kitchens").click(function(){
		//checking to see if click was succesful
		console.log('succes')

		$("#myCarouselKitchens").fadeIn(1000);
		$(".borderKitchens").show(1000);

		// this will hide everyone in the Welcome PAGE DIV therefore it will hide myCarousel on the Home page and the textUnder it
		$(".hideMeWelcomePage").hide(500);

		// hides original welcome page carousel
		// 			$("#myCarousel").hide();

		// hides textUnderCarousel on welcome page
		//			$(".textUnderCarousel").hide();

		// hides border around the welcome page carousel
		// 			$(".border").hide();

		// hides businessBox which is in the About page Where its ABOUT HAMPSON DESIGN
		$(".businessBox").hide(500);

		// hides all the Feauttete boxes which are the ones that say DESIGN, CONSULTATION, And PRoject Management
		$("#feautretteDeals").hide(500);

		$("#myCarouselBaths").hide(500);
		$(".borderBaths").hide(500);

		$(".borderLivingRooms").hide(500);
		$("#myCarouselLivingRooms").hide(500);

		$(".borderOffices").hide(500);
		$("#myCarouselOffices").hide(500);

		// clearGalleryName()
		// showGallery();

	});
/*
	function showGallery(){
		$("#galleryName").html(galleries[galleryCount].galleryName);
		console.log("grrr")
		$(".galleryDescriptions").show();

	}

	function clearGalleryName(){
		$("#galleryName").html("");
		console.log("chimp")
	}

	*/

	// when baths button is clicked on function will run and show the below items
	$('#baths').click(function(){
		// checking to see if function is succesful
		console.log('success again!')

		$("#myCarouselBaths").fadeIn(1000);
		$(".borderBaths").show(1000);

		// this will hide everyone in the Welcome PAGE DIV therefore it will hide myCarousel on the Home page and the textUnder it
		$(".hideMeWelcomePage").hide(500);

		// hides businessBox which is in the About page Where its ABOUT HAMPSON DESIGN
		$(".businessBox").hide();

		// hides all the Feauttete boxes which are the ones that say DESIGN, CONSULTATION, And PRoject Management
		$("#feautretteDeals").hide();

		$(".borderKitchens").hide(500);
		$("#myCarouselKitchens").hide(500);

		$(".borderLivingRooms").hide(500);
		$("#myCarouselLivingRooms").hide(500);

		$(".borderOffices").hide(500);
		$("#myCarouselOffices").hide(500);

		// clearGalleryName();
		// showGallery();

	});

	// when livingRoom button is clicked on function will run and show/hide below items
	$('#livingRoom').click(function(){
		// checking to see if function is succesful
		console.log('success again again!')

		$("#myCarouselLivingRooms").fadeIn(1000);
		$(".borderLivingRooms").show(1000);

		// this will hide everyone in the Welcome PAGE DIV therefore it will hide myCarousel on the Home page and the textUnder it
		$(".hideMeWelcomePage").hide(500);

		// hides businessBox which is in the About page Where its ABOUT HAMPSON DESIGN
		$(".businessBox").hide(500);

		// hides all the Feauttete boxes which are the ones that say DESIGN, CONSULTATION, And PRoject Management
		$("#feautretteDeals").hide(500);

		$(".borderKitchens").hide(500);
		$("#myCarouselKitchens").hide(500);

		$("#myCarouselBaths").hide(500);
		$(".borderBaths").hide(500);

		$(".borderOffices").hide(500);
		$("#myCarouselOffices").hide(500);

		// clearGalleryName();
		// showGallery();

	});

	$('#offices').click(function(){
		// checking to see if function is succesful
		console.log('success again again again!')

		$("#myCarouselOffices").fadeIn(1000);
		$(".borderOffices").show(1000);

		// this will hide everyone in the Welcome PAGE DIV therefore it will hide myCarousel on the Home page and the textUnder it
		$(".hideMeWelcomePage").hide(500);

		// hides businessBox which is in the About page Where its ABOUT HAMPSON DESIGN
		$(".businessBox").hide(500);

		// hides all the Feauttete boxes which are the ones that say DESIGN, CONSULTATION, And PRoject Management
		$("#feautretteDeals").hide(500);

		$(".borderKitchens").hide(500);
		$("#myCarouselKitchens").hide(500);

		$("#myCarouselBaths").hide(500);
		$(".borderBaths").hide(500);

		$(".borderLivingRooms").hide(500);
		$("#myCarouselLivingRooms").hide(500);

		// clearGalleryName();
		// showGallery();

	});

	//
	//$(".kitchenDrop").click(function(){
	//	$(".kitchenDrop").html("<li><")
	//})

});


text:
package de.jpaw.util.tests;

import java.io.IOException;

import org.junit.jupiter.api.Test;

import de.jpaw.util.ExceptionUtil;

public class TestExceptions {
    static void f1() throws IOException {
        throw new IOException("root cause");
    }
    static void f2() {
        try {
            f1();
        } catch (Exception e) {
            throw new RuntimeException("intermediate cause", e);
        }
    }

    @Test
    public void exTest() {
        try {
            f2();
        } catch (Exception e) {
            System.out.println("Caught exception: " + ExceptionUtil.causeChain(e));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
  <title>03-subpub-banter</title>

  {{> msgs}}
  {{> input}}

<template name="msgs">

    {{#each msgs}}
      {{> msg}}
    {{/each}}

</template>

<template name="msg">

        <time datetime="{{created}}">{{fromnow created}}</time>

{{msg}}

</template>

<template name="input">

    <form class="input-append">
       <input id="msg" class="span4" type="text" placeholder="Message"/>
       <button id="send" class="btn btn-success" type="button">Send</button>
    </form>

        @
        <input id="handle" type="text" placeholder="Email"/>

</template>


text:
namespace FurnitureManufacturer.Models
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using FurnitureManufacturer.Interfaces;

    class Table : Furniture, IFurniture, ITable
    {
        private decimal length;
        private decimal width;

        public Table(string model, string materialType, decimal price, decimal height, decimal length, decimal width)
            : base(model, materialType, price, height)
        {
            this.Length = length;
            this.Width = width;
        }

        public decimal Length
        {
            get
            {
                return this.length;
            }
            private set
            {
                this.length = value;
            }
        }

        public decimal Width
        {
            get
            {
                return this.width;
            }
            private set
            {
                this.width = value;
            }
        }

        public decimal Area
        {
            get
            {
                return this.length * this.width;
            }
        }
    }
}


text:
namespace blink {

class ExternalPopupMenuDisplayNoneItemsTest : public testing::Test {
public:
    ExternalPopupMenuDisplayNoneItemsTest() { }

protected:
    void SetUp() override
    {
        m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
        RefPtrWillBeRawPtr<HTMLSelectElement> element = HTMLSelectElement::create(m_dummyPageHolder->document());
        // Set the 4th an 5th items to have "display: none" property
        element->setInnerHTML("<option><option><option><option style='display:none;'><option style='display:none;'><option><option>", ASSERT_NO_EXCEPTION);
        m_dummyPageHolder->document().body()->appendChild(element.get(), ASSERT_NO_EXCEPTION);
        m_ownerElement = element.release();
        m_dummyPageHolder->document().updateLayoutIgnorePendingStylesheets();
    }

    OwnPtr<DummyPageHolder> m_dummyPageHolder;
    RefPtrWillBePersistent<HTMLSelectElement> m_ownerElement;
};

TEST_F(ExternalPopupMenuDisplayNoneItemsTest, PopupMenuInfoSizeTest)
{
    WebPopupMenuInfo info;
    ExternalPopupMenu::getPopupMenuInfo(info, *m_ownerElement);
    EXPECT_EQ(5U, info.items.size());
}

TEST_F(ExternalPopupMenuDisplayNoneItemsTest, IndexMappingTest)
{
    // 6th indexed item in popupmenu would be the 4th item in ExternalPopupMenu,
    // and vice-versa.
    EXPECT_EQ(4, ExternalPopupMenu::toExternalPopupMenuItemIndex(6, *m_ownerElement));
    EXPECT_EQ(6, ExternalPopupMenu::toPopupMenuItemIndex(4, *m_ownerElement));

    // Invalid index, methods should return -1.
    EXPECT_EQ(-1, ExternalPopupMenu::toExternalPopupMenuItemIndex(8, *m_ownerElement));
    EXPECT_EQ(-1, ExternalPopupMenu::toPopupMenuItemIndex(8, *m_ownerElement));
}

class ExternalPopupMenuWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
public:
    WebExternalPopupMenu* createExternalPopupMenu(const WebPopupMenuInfo&, WebExternalPopupMenuClient*) override
    {
        return &m_mockWebExternalPopupMenu;
    }
    WebRect shownBounds() const
    {
        return m_mockWebExternalPopupMenu.shownBounds();
    }
private:
    class MockWebExternalPopupMenu : public WebExternalPopupMenu {
        void show(const WebRect& bounds) override
        {
            m_shownBounds = bounds;
        }
        void close() override { }

    public:
        WebRect shownBounds() const
        {
            return m_shownBounds;
        }

    private:
        WebRect m_shownBounds;
    };
    WebRect m_shownBounds;
    MockWebExternalPopupMenu m_mockWebExternalPopupMenu;
};

class ExternalPopupMenuTest : public testing::Test {
public:
    ExternalPopupMenuTest() : m_baseURL("http://www.test.com") { }

protected:
    void SetUp() override
    {
        m_helper.initialize(false, &m_webFrameClient, &m_webViewClient);
        webView()->setUseExternalPopupMenus(true);
    }
    void TearDown() override
    {
        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    }

    void registerMockedURLLoad(const std::string& fileName)
    {
        URLTestHelpers::registerMockedURLLoad(URLTestHelpers::toKURL(m_baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html"));
    }

    void loadFrame(const std::string& fileName)
    {
        FrameTestHelpers::loadFrame(mainFrame(), m_baseURL + fileName);
    }

    WebViewImpl* webView() const { return m_helper.webViewImpl(); }
    const ExternalPopupMenuWebFrameClient& client() const { return m_webFrameClient; }
    WebLocalFrameImpl* mainFrame() const { return m_helper.webViewImpl()->mainFrameImpl(); }

private:
    std::string m_baseURL;
    FrameTestHelpers::TestWebViewClient m_webViewClient;
    ExternalPopupMenuWebFrameClient m_webFrameClient;
    FrameTestHelpers::WebViewHelper m_helper;
};

TEST_F(ExternalPopupMenuTest, PopupAccountsForVisualViewportOffset)
{
    registerMockedURLLoad("select_mid_screen.html");
    loadFrame("select_mid_screen.html");

    webView()->resize(WebSize(100, 100));
    webView()->updateAllLifecyclePhases();

    HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->getElementById("select"));
    LayoutMenuList* menuList = toLayoutMenuList(select->layoutObject());
    ASSERT_TRUE(menuList);

    VisualViewport& visualViewport = webView()->page()->frameHost().visualViewport();

    IntRect rectInDocument = menuList->absoluteBoundingBoxRect();

    webView()->setPageScaleFactor(2);
    IntPoint scrollDelta(20, 30);
    visualViewport.move(scrollDelta);

    select->showPopup();

    EXPECT_EQ(rectInDocument.x() - scrollDelta.x(), client().shownBounds().x);
    EXPECT_EQ(rectInDocument.y() - scrollDelta.y(), client().shownBounds().y);
}

TEST_F(ExternalPopupMenuTest, DidAcceptIndex)
{
    registerMockedURLLoad("select.html");
    loadFrame("select.html");

    HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->getElementById("select"));
    LayoutMenuList* menuList = toLayoutMenuList(select->layoutObject());
    ASSERT_TRUE(menuList);

    select->showPopup();
    ASSERT_TRUE(select->popupIsVisible());

    WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select->popup());
    client->didAcceptIndex(2);
    EXPECT_FALSE(select->popupIsVisible());
    ASSERT_STREQ("2", menuList->text().utf8().data());
    EXPECT_EQ(2, select->selectedIndex());
}

TEST_F(ExternalPopupMenuTest, DidAcceptIndices)
{
    registerMockedURLLoad("select.html");
    loadFrame("select.html");

    HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->getElementById("select"));
    LayoutMenuList* menuList = toLayoutMenuList(select->layoutObject());
    ASSERT_TRUE(menuList);

    select->showPopup();
    ASSERT_TRUE(select->popupIsVisible());

    WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select->popup());
    int indices[] = { 2 };
    WebVector<int> indicesVector(indices, 1);
    client->didAcceptIndices(indicesVector);
    EXPECT_FALSE(select->popupIsVisible());
    EXPECT_STREQ("2", menuList->text().utf8().data());
    EXPECT_EQ(2, select->selectedIndex());
}

TEST_F(ExternalPopupMenuTest, DidAcceptIndicesClearSelect)
{
    registerMockedURLLoad("select.html");
    loadFrame("select.html");

    HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->getElementById("select"));
    LayoutMenuList* menuList = toLayoutMenuList(select->layoutObject());
    ASSERT_TRUE(menuList);

    select->showPopup();
    ASSERT_TRUE(select->popupIsVisible());

    WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select->popup());
    WebVector<int> indices;
    client->didAcceptIndices(indices);
    EXPECT_FALSE(select->popupIsVisible());
    EXPECT_EQ(-1, select->selectedIndex());
}

} // namespace blink


text:
package nl.gogognome.textsearch.criteria;

import java.util.ArrayList;
import java.util.Collection;

class LexicalScanner {

    private final String text;
    private int index;
    private final Collection<Token> tokens = new ArrayList<>();

    LexicalScanner(String text) {
        this.text = text;
    }

    Collection<Token> scan() {
        while (text != null && index < text.length()) {
            skipWhiteSpaces();
            if (index < text.length()) {
                if (isBracket()) {
                    tokens.add(Token.of(text.substring(index, index + 1)));
                    index++;
                } else if (isQuote()) {
                    char quoteChar = text.charAt(index);
                    index++;
                    int startIndex = index;
                    while (index < text.length() && text.charAt(index) != quoteChar) {
                        index++;
                    }
                    if (index == text.length()) {
                        throw new IllegalArgumentException("String literal starting at index " + (startIndex-1) + " was not terminated with a " + quoteChar + " character");
                    }
                    tokens.add(Token.betweenQuotes(text.substring(startIndex, index)));
                    index++; // skip closing quote
                } else {
                    int startIndex = index;
                    index++;
                    while (index < text.length() && !Character.isWhitespace(text.charAt(index)) && !isBracket()) {
                        index++;
                    }
                    tokens.add(Token.of(text.substring(startIndex, index)));
                }
            }
        }
        return tokens;
    }

    private boolean isBracket() {
        return "()".indexOf(text.charAt(index)) != -1;
    }

    private boolean isQuote() {
        return "'\"".indexOf(text.charAt(index)) != -1;
    }

    private void skipWhiteSpaces() {
        while (index < text.length() && Character.isWhitespace(text.charAt(index))) {
            index++;
        }
    }

}


text:
This C# project presents a test project to show how MATLAB .NET libraries generated by MATLAB Compiler SDK can be used in C#.

The marshaling data between .NET and MATLAB is carried out by MWArray API. This requires a bit of programming to manually convert .NET data types to MATLAB data types and vice versa. For more automatic data marshalling, use type safe mode, explored https://github.com/EhsanPeymani/Matlab_Csharp_using_TypeSafeMode.

MATLAB M-Code and MATLAB Compiler SDK projects are in M-Code and MCS Projects	folder.

The generated MATLAB .NET Assembly is found in Matlab .NET Libraries folder.

IMPORTANT >>> Read the readme file in Matlab folder, for details of implementation and requirements.

IMPORTANT >>> Remember to handle exceptions (try-catch) when you pass objects between MATLAB and .NET.

The solution has two projects:

1. Presentation project which is a WinForm project. This project refers to the second project in the solution, but has no reference to MATLAB data conversion API (MWArray) or the generated .NET assemblies. All data types are .NET native types.

2. Matlab Class library, which creates an abstraction layer for MATLAB API and MATLAB .NET libraries.

To be able to run the application, you need to have MATALAB Runtime v9.0 (64bit) installed. Get it for free from https://se.mathworks.com/supportfiles/downloads/R2015b/deployment_files/R2015b/installers/win64/MCR_R2015b_win64_installer.exe


text:
from django.conf.urls.defaults import *

urlpatterns = patterns('lingcod.screencasts.views',
    (r'^$', 'listTutorials'),
    (r'^(\w+)/$', 'showVideo'),
    url(r'^(?P<pk>\d)/show/$', 'showVideoByPk', name='screencasts-show-video'),
    url(r'^(?P<pk>\d+)/show_youtube/$', 'showYoutubeVideo', name='screencasts-show-youtube-video'),
)


text:
using namespace std;

class MapsReceiver {
public:

	// functions
	static vector<string> getAllMaps();
	static void getMapByName(string name);
	static string showChooseMapMenu();
	static string chooseMap();
};

#endif


text:
USE master
GO

SET NOCOUNT ON
DECLARE @DBName varchar(50)
DECLARE @spidstr varchar(8000)
DECLARE @ConnKilled smallint
SET @ConnKilled=0
SET @spidstr = ''

Set @DBName = 'ArduinoMonitor'
IF db_id(@DBName) < 4
BEGIN
PRINT 'Connections to system databases cannot be killed'
RETURN
END
SELECT @spidstr=coalesce(@spidstr,',' )+'kill '+convert(varchar, spid)+ '; '
FROM master..sysprocesses WHERE dbid=db_id(@DBName)

SELECT *
FROM master..sysprocesses WHERE dbid=db_id(@DBName)

IF LEN(@spidstr) > 0
BEGIN
EXEC(@spidstr)
SELECT @ConnKilled = COUNT(1)
FROM master..sysprocesses WHERE dbid=db_id(@DBName)
END


text:
/* tslint:disable:no-unused-variable */

import { TestBed, async, inject } from '@angular/core/testing';
import { LoadAverageService } from './load-average.service';

describe('Service: LoadAverage', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [LoadAverageService]
    });
  });

  it('should ...', inject([LoadAverageService], (service: LoadAverageService) => {
    expect(service).toBeTruthy();
  }));
});


text:
<!--
http://www.apache.org/licenses/LICENSE-2.0.txt

Copyright 2015 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

## Plugin Authoring
snap itself runs as a master daemon with the core functionality that may load and unload plugin processes via either CLI or HTTP APIs.

A snap plugin is a program, or a set of functions or services, written in Go or any language; that may seamlessly integrate with snap as executables.

Communication between snap and plugins uses RPC either through HTTP or TCP protocols. HTTP JSON-RPC is good for any language to use due to its nature of JSON representation of data while the native client is only suitable for plugins written in Golang. The data that plugins report to snap is in the form of JSON or GOB CODEC.

Before starting writing snap plugins, check out the [Plugin Catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) to see if any suit your needs. If not, you need to reference the plugin packages that defines the type of structures and interfaces inside snap and then write plugin endpoints to implement the defined interfaces.

## Getting started with the plugin development
Before writing a plugin, you may sketch the type of metrics you want to collect or understand what kind of metrics you like to publish. Basic steps are:

1. Plan your plugin
2. Decide the CODEC for the plugin
3. Download or clone snap
4. Setup your development enviroment properly
5. Write the plugin that implements the type of interfaces defined in snap
6. Test the plugin
7. Expose the plugin

### Naming, Files, and Directory
snap supports three type of plugins. They are collectors, processors, and publishers.  The plugin project name should use the following format:
>snap-plugin-[type]-[name]

For example:
>snap-plugin-collector-hana
>snap-plugin-processor-movingaverage
>snap-plugin-publisher-influxdb

Example files and directory structure:
```
snap-plugin-[type]-[name]
 |--[name]
  |--[name].go
  |--[name]_test.go
  |--[name]_integration_test.go
 |--main.go
 |--main_test.go
```
### Mandatory packages
There are three mandatory packages that every plugin must use. Other than those three packages, you can use other packages as necessary. There is no danger of colliding dependencies as plugins are separated processes. The mandatory packages are:
```
github.com/intelsdi-x/snap/control/plugin
github.com/intelsdi-x/snap/control/plugin/cpolicy
github.com/intelsdi-x/snap/core/ctypes
```
### Writing a collector plugin
A snap collector plugin collects telemetry data by communicating with the snap daemon. To confine to collector plugin interfaces and metric types defined in snap,  a collector plugin must implement the following methods:
```
GetConfigPolicy() (*cpolicy.ConfigPolicy, error)
CollectMetrics([]PluginMetricType) ([]PluginMetricType, error)
GetMetricTypes(PluginConfigType) ([]PluginMetricType, error)
```
### Writing a processor plugin
A snap processor plugin allows filtering, aggregation, transformation, etc of collected telemetry data. To complaint with processor plugin interfaces defined in snap,  a processor plugin must implement the following methods:
```
GetConfigPolicy() (*cpolicy.ConfigPolicy, error)
Process(contentType string, content []byte, config map[string]ctypes.ConfigValue) (string, []byte, error)
```
### Writing a publisher plugin
A snap publisher plugin allows publishing processed telemetry data into a variety of systems, databases, and monitors through snap metrics. To compliant with metric types and plugin interfaces defined in snap,  a publisher plugin must implement the following methods:
```
GetConfigPolicy() (*cpolicy.ConfigPolicy, error)
Publish(contentType string, content []byte, config map[string]ctypes.ConfigValue) error
```
### Exposing a plugin
Creating the main program to serve the newly written plugin as an external process in main.go. By defining "Plugin.PluginMeta" with plugin specific settings, the newly created plugin may have its setting to override snap global settings. Please refer to [a sample](https://github.com/intelsdi-x/snap/blob/master/plugin/collector/snap-collector-mock1/main.go) to see how main.go is written. You may browse [snap global settings](https://github.com/intelsdi-x/snap/blob/master/snap.go#L45-L119).

Building main.go generates a binary executable. You may choose to sign the executable with our [plugin signing](https://github.com/intelsdi-x/snap/blob/master/pkg/psigning/README.md).

### Localization
All comments and READMEs within the plugin code should be in English.  For different languages, include appropriate translation files within the plugin package for internationalization.

### README
All plugins should have a README with some standard fields:
```
 1. snap version requires at least
 2. snap version tested up to
 3. Supported platforms
 4. Contributor
 5. License
```
### Encryption
snap provides the encryption capability for both HTTP and TCP clients. The communication between the snap Daemon and the plugins is encrypted by default. Should you want to disable the encrypted communication, when authoring a plugin, use the `Unsecure` option for your plugin's meta:
```
//Meta returns the metadata for MyPlugin
func Meta() *plugin.PluginMeta {
    return plugin.NewPluginMeta(name, ver, type, ct, ct2, plugin.Unsecure(true))
}
```

## Logging and debugging
snap uses [logrus](http://github.com/Sirupsen/logrus) to log. Your plugins can use it, or any standard Go log package. Each plugin has its log file. If no logging directory is specified, logs are in the /tmp directory of the running machine. INFO is the logging level for the release version of plugins. Loggers are excellent resources for debugging. You can also use Go GDB to debug.

## Building and running the tests
While developing a plugin, unit and integration tests need to be performed. snap uses [goconvery](http://github.com/smartystreets/goconvey/convey) for unit tests. You are welcome to use it or any other unit test framework. For the integration tests, you have to set up $SNAP_PATH and some necessary direct, or indirect dependencies. Using Docker container for integration tests is an effective testing strategy. Integration tests may define an input workflow. Refer to a sample [integration test input](https://github.com/intelsdi-x/snap/blob/master/examples/configs/snap-config-sample.json).

For example, to run a plugin integration test
```
go test -v tag=integration ./…
```

For more build and test tips, please refer to our [contributing doc](https://github.com/intelsdi-x/snap/blob/master/CONTRIBUTING.md).

## Distributing plugins
If you think others would find your plugin useful, we encourage you to submit it to our [Plugin Catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) for possible inclusion.

## License
Project snap is released under the Apache 2.0 license.

## For more help
Please browse more at our [repo](https://github.com/intelsdi-x/snap) or contact snap [maintainers](https://github.com/intelsdi-x/snap#maintainers).


text:
package org.broadleafcommerce.openadmin.web.service;

import org.broadleafcommerce.common.media.domain.Media;

/**
 * @author Chad Harchar (charchar)
 */
public interface MediaBuilderService {

    /**
     * Converts the given json {@link String} to {@link org.broadleafcommerce.common.media.domain.Media} given the
     * {@link java.lang.Class} that has been passed in.
     *
     * @param json the {@link String} to be converted to {@link Media}
     * @param type the {@link Class} that the {@link Media} should be
     */
    public Media convertJsonToMedia(String json, Class<?> type);
}


text:
function Console(panel) {
  this.panel = panel;
  this.codeEntry = panel.FindChildrenWithClassTraverse('content__entry')[0];
  this.stackLabel = panel.FindChildrenWithClassTraverse('content__stack')[0];
  this.playerList = panel.FindChildrenWithClassTraverse('header__js-player')[0];
  this.header = panel.FindChildrenWithClassTraverse('header__top')[0];

  var think = function() {
    this.updateHeroes();
    $.Schedule(1, think);
  }.bind(this);
  think();

  this.setPinned(false);

  $.RegisterEventHandler('DragStart', this.header, this.onDragStart.bind(this));
  $.RegisterEventHandler('DragEnd', this.header, this.onDragEnd.bind(this));

  GameEvents.Subscribe(
    'console-stack',
    function(event) {
      this.setStack(event.stack);
    }.bind(this),
  );

  GameEvents.Subscribe(
    'console-set-visible',
    function(event) {
      this.setVisible(event.value != null ? event.value : !this.isVisible());
    }.bind(this),
  );
}

Console.prototype.setPinned = function(pinned) {
  this.header.SetDraggable(!pinned);
};

Console.prototype.isVisible = function() {
  return this.panel.BHasClass('console_visible');
};

Console.prototype.setVisible = function(visible) {
  this.panel.SetHasClass('console_visible', visible);
  if (visible && !this.opened) {
    this.opened = true;
    $.Schedule(
      1 / 30,
      function() {
        // Save center position and reset it to fix dragging offset
        this.panel.style.position =
          this.panel.actualxoffset + 'px ' + this.panel.actualyoffset + 'px 0';
        this.panel.style.align = 'left top';
      }.bind(this),
    );
  }
};

Console.prototype.setStack = function(stack) {
  this.stackLabel.text = '>>>\n' + stack;
};

Console.prototype.onDragStart = function(panelId, event) {
  event.displayPanel = this.panel;

  var cursor = GameUI.GetCursorPosition();

  event.offsetX = cursor[0] - this.panel.actualxoffset;
  event.offsetY = cursor[1] - this.panel.actualyoffset;
  event.removePositionBeforeDrop = false;
  return false;
};

Console.prototype.onDragEnd = function() {
  this.panel.SetParent($.GetContextPanel());
  this.setPinned(false);
  return true;
};

Console.prototype.updateHeroes = function() {
  var lines = _.map(Game.GetAllPlayerIDs(), function(playerId) {
    var team = Players.GetTeam(playerId);
    var line = '';
    line +=
      playerId +
      ': ' +
      $.Localize(GetPlayerHeroName(playerId)) +
      ' - ' +
      Players.GetPlayerName(playerId);
    return line;
  });

  var generated = _.map(this.playerList.AccessDropDownMenu().Children(), function(panel) {
    return panel.text;
  });

  var playerList = this.playerList;

  if (!_.isEqualWith(generated, lines, _.isMatch)) {
    /**
     * Regenerate all options if some are not matching
     * Required to have consistent order
     * TODO: More performant panel sorting with AddOption and RemoveOption
     */

    playerList.RemoveAllOptions();

    _.each(lines, function(line) {
      var label = $.CreatePanel('Label', playerList, line.split(':')[0]);
      label.text = line;
      playerList.AddOption(label);
    });

    playerList.SetSelected(lines[0].split(':')[0]);
  }
};

Console.prototype.getCode = function() {
  return this.codeEntry.text;
};

Console.prototype.sendLua = function() {
  GameEvents.SendCustomGameEventToServer('console-evaluate', {
    type: 'lua',
    code: this.getCode(),
  });
};

Console.prototype.sendJS = function(target) {
  if (target === 'self') {
    try {
      this.setStack(eval(this.getCode()));
    } catch (err) {
      this.setStack(err.stack);
    }
    return;
  } else if (target === 'player') {
    target = this.playerList.GetSelected().id;
  }

  GameEvents.SendCustomGameEventToServer('console-evaluate', {
    type: 'js',
    target: target,
    code: this.getCode(),
  });
};

// Export 'con' variable, so it can be called from layout event handlers
var con = new Console($('#console'));

GameEvents.Subscribe('console-evaluate', function(event) {
  eval(event.code);
});


text:
package tonmoy71.github.io.pathsensedemo;

import dagger.Component;
import javax.inject.Singleton;
import tonmoy71.github.io.pathsensedemo.main.MainActivity;
import tonmoy71.github.io.pathsensedemo.main.MainModule;
import tonmoy71.github.io.pathsensedemo.map.MapModule;

/**
 * Created by Fahim on 10-Apr-17.
 */

@Singleton @Component(modules = { AppModule.class, MapModule.class, MainModule.class })
public interface AppComponent {
  void inject(MainActivity target);
  void inject(PathsenseApp target);
}


text:
import { getFiltered } from '../../utils/model_utils';
import { ASSIGNED_ROLE, REVIEWING_ROLE } from '../../constants/assignments';
import { uniqBy, flow, flatten, compact } from 'lodash-es';

export const delayFetchAssignmentsAndArticles = (props, cb) => {
  const { loadingArticles, loadingAssignments } = props;
  if (!loadingArticles && !loadingAssignments) return cb();

  const requests = [];
  if (loadingAssignments) {
    requests.push(props.fetchAssignments(props.course_id));
  }
  if (loadingArticles) {
    requests.push(props.fetchArticles(props.course_id, props.limit));
  }

  Promise.all(requests).then(() => setTimeout(cb, 750));
};

const pluck = key => ({ [key]: val }) => val;

export const groupByAssignmentType = (assignments, user_id) => {
  // Unassigned to anyone
  const unassignedOptions = { user_id: null, role: ASSIGNED_ROLE };
  const unassigned = getFiltered(assignments, unassignedOptions);

  // Assigned to the current user
  const assignOptions = { user_id, role: ASSIGNED_ROLE };
  const assigned = getFiltered(assignments, assignOptions);

  // Assignable to the current user: unassigned, and the current user
  // isn't already assigned the same one
  const pluckArticleUrl = pluck('article_url');
  const assignedArticleUrls = assigned.map(pluckArticleUrl);
  const assignable = unassigned.filter(assignment => !assignedArticleUrls.includes(assignment.article_url));

  // The current user is reviewing
  const reviewOptions = { user_id, role: REVIEWING_ROLE };
  const reviewing = getFiltered(assignments, reviewOptions);

  // To find articles that are able to be reviewed...
  const pluckArticleId = pluck('article_id');
  const assignedArticleIds = assigned.map(pluckArticleId);
  const reviewingArticleIds = reviewing.map(pluckArticleId);

  const allAssigned = getFiltered(assignments, { role: ASSIGNED_ROLE });
  const reviewableDuplicates = allAssigned.filter((assignment) => {
    // If the article doesn't have an article id, that means it's a new article,
    // so we want to allow for new articles to be reviewable as well as long as
    // it isn't the current user's new article.
    const { article_id: id, article_title: title, project } = assignment;
    // Check that the assignment is assigned to someone else
    if (!id && assignment.user_id && assignment.user_id !== user_id) {
      const all = assigned.concat(reviewing);
      // Find similar articles that have already been assigned
      const alreadyAssigned = all.find((assign) => {
        return assign.article_title === title && assign.project === project;
      });
      // Only return if it has not been assigned
      return !alreadyAssigned;
    }

    return assignment.user_id // ...the article must have a user_id
      // which shouldn't match the current user's id
      && assignment.user_id !== user_id
      // and should not be an article that is assigned to them
      && !assignedArticleIds.includes(id)
      // and should not be an article they are already reviewing
      && !reviewingArticleIds.includes(id);
  });

  const reviewable = uniqBy(reviewableDuplicates, 'article_url');
  return { assigned, reviewing, unassigned, reviewable, assignable };
};

export const getModulesAndBlocksFromWeeks = (weeks) => {
  const flattenAndCompact = flow([flatten, compact]);
  const blocks = flatten(weeks.map(week => week.blocks));
  const modules = flattenAndCompact(blocks.map(block => block.training_modules));
  return { blocks, modules };
};

// Here we're working around the quirks of react-router version 5.
// When parsing route params, react-router doesn't return the same values as
// the native JavaScript utils like encodeURIComponent and decodeURIComponent.
// We need to handle cases where the username param that comes from a router `match`
// object is not the same as the actual username.
// Examples include:
//   CaesSion? — ends in question mark
//   Wikster808% — includes a percent sign, which react-router doesn't like.
//   If you ain't runnin' game, Say my name — comma causes problems.
// Upgrading to react-router 6 and the history 5 might (or might not) fix these issues.
export const selectUserByUsernameParam = (users, usernameParam) => {
  if (!usernameParam) return null;

  let selectedUser = users.find(({ username }) => username === usernameParam);
  if (selectedUser) return selectedUser;

  selectedUser = users.find(({ username }) => username.replace(',', '%2C') === usernameParam);
  if (selectedUser) return selectedUser;

  selectedUser = users.find(({ username }) => username.replace('?', '%3F') === usernameParam);
  return selectedUser;
};


text:
class JsonVersion < PaperTrail::Version
  self.table_name = 'json_versions'
end


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

import java.math.BigInteger;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

public interface TokenRing
{
    /**
     * Returns ring fraction (value between 0 and 1) represented by the token range
     *
     * @param startToken exclusive
     * @param endToken inclusive
     */
    double getRingFraction(String startToken, String endToken);

    /**
     * Returns token count in a given range
     */
    BigInteger getTokenCountInRange(String startToken, String endToken);

    static Optional<TokenRing> createForPartitioner(String partitioner)
    {
        requireNonNull(partitioner, "partitioner is null");
        switch (partitioner) {
            case "org.apache.cassandra.dht.Murmur3Partitioner":
                return Optional.of(Murmur3PartitionerTokenRing.INSTANCE);
            case "org.apache.cassandra.dht.RandomPartitioner":
                return Optional.of(RandomPartitionerTokenRing.INSTANCE);
            default:
                return Optional.empty();
        }
    }
}


text:
module Azure::PolicyInsights::Mgmt::V2019_10_01
  module Models
    #
    # Query results.
    #
    class PolicyEventsQueryResults

      include MsRestAzure

      include MsRest::JSONable
      # @return [String] OData context string; used by OData clients to resolve
      # type information based on metadata.
      attr_accessor :odatacontext

      # @return [Integer] OData entity count; represents the number of policy
      # event records returned.
      attr_accessor :odatacount

      # @return [String] Odata next link; URL to get the next set of results.
      attr_accessor :odatanext_link

      # @return [Array<PolicyEvent>] Query results.
      attr_accessor :value

      # return [Proc] with next page method call.
      attr_accessor :next_method

      #
      # Gets the rest of the items for the request, enabling auto-pagination.
      #
      # @return [Array<PolicyEvent>] operation results.
      #
      def get_all_items
        items = @value
        page = self
        while page.odatanext_link != nil && !page.odatanext_link.strip.empty? do
          page = page.get_next_page
          items.concat(page.value)
        end
        items
      end

      #
      # Gets the next page of results.
      #
      # @return [PolicyEventsQueryResults] with next page content.
      #
      def get_next_page
        response = @next_method.call(@odatanext_link).value! unless @next_method.nil?
        unless response.nil?
          @odatanext_link = response.body.odatanext_link
          @value = response.body.value
          self
        end
      end

      #
      # Mapper for PolicyEventsQueryResults class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'PolicyEventsQueryResults',
          type: {
            name: 'Composite',
            class_name: 'PolicyEventsQueryResults',
            model_properties: {
              odatacontext: {
                client_side_validation: true,
                required: false,
                serialized_name: '@odata\\.context',
                type: {
                  name: 'String'
                }
              },
              odatacount: {
                client_side_validation: true,
                required: false,
                serialized_name: '@odata\\.count',
                constraints: {
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              },
              odatanext_link: {
                client_side_validation: true,
                required: false,
                serialized_name: '@odata\\.nextLink',
                type: {
                  name: 'String'
                }
              },
              value: {
                client_side_validation: true,
                required: false,
                serialized_name: 'value',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'PolicyEventElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'PolicyEvent'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
from six import PY3

import sys
if PY3:
    from xmlrpc.server import SimpleXMLRPCServer
else:
    from SimpleXMLRPCServer import SimpleXMLRPCServer

from remoteserver import announce_port

class SimpleServer(SimpleXMLRPCServer):

    def __init__(self, port=8270, port_file=None):
        SimpleXMLRPCServer.__init__(self, ('127.0.0.1', int(port)))
        self.register_function(self.get_keyword_names)
        self.register_function(self.run_keyword)
        announce_port(self.socket, port_file)
        self.serve_forever()

    def get_keyword_names(self):
        return ['Passing', 'Failing', 'Traceback', 'Returning', 'Logging',
                'Extra stuff in result dictionary',
                'Conflict', 'Should Be True']

    def run_keyword(self, name, args):
        if name == 'Passing':
            return {'status': 'PASS'}
        if name == 'Failing':
            return {'status': 'FAIL', 'error': ' '.join(args)}
        if name == 'Traceback':
            return {'status': 'FAIL', 'traceback': ' '.join(args)}
        if name == 'Returning':
            return {'status': 'PASS', 'return': ' '.join(args)}
        if name == 'Logging':
            return {'status': 'PASS', 'output': '\n'.join(args)}
        if name == 'Extra stuff in result dictionary':
            return {'status': 'PASS', 'extra': 'stuff', 'is': 'ignored'}
        if name == 'Conflict':
            return {'status': 'FAIL', 'error': 'Should not be executed'}
        if name == 'Should Be True':
            return {'status': 'PASS', 'output': 'Always passes'}

if __name__ == '__main__':
    SimpleServer(*sys.argv[1:])


text:
// @link http://schemas.wbeme.com/json-schema/eme/users/request/get-user-history-response/1-0-0.json#
import GdbotsPbjxGetEventsResponseV1Mixin from '@gdbots/schemas/gdbots/pbjx/mixin/get-events-response/GetEventsResponseV1Mixin';
import GdbotsPbjxResponseV1Mixin from '@gdbots/schemas/gdbots/pbjx/mixin/response/ResponseV1Mixin';
import GdbotsPbjxResponseV1Trait from '@gdbots/schemas/gdbots/pbjx/mixin/response/ResponseV1Trait';
import Message from '@gdbots/pbj/Message';
import MessageResolver from '@gdbots/pbj/MessageResolver';
import Schema from '@gdbots/pbj/Schema';

export default class GetUserHistoryResponseV1 extends Message {
  /**
   * @private
   *
   * @returns {Schema}
   */
  static defineSchema() {
    return new Schema('pbj:eme:users:request:get-user-history-response:1-0-0', GetUserHistoryResponseV1,
      [],
      [
        GdbotsPbjxResponseV1Mixin.create(),
        GdbotsPbjxGetEventsResponseV1Mixin.create(),
      ],
    );
  }
}

GdbotsPbjxResponseV1Trait(GetUserHistoryResponseV1);
MessageResolver.register('eme:users:request:get-user-history-response', GetUserHistoryResponseV1);
Object.freeze(GetUserHistoryResponseV1);
Object.freeze(GetUserHistoryResponseV1.prototype);


text:
WalmartTemplateShippingHandler = Class.create();
WalmartTemplateShippingHandler.prototype = Object.extend(new WalmartTemplateEditHandler(), {

    rulesIndex: 0,

    // ---------------------------------------

    initialize: function()
    {
        this.setValidationCheckRepetitionValue('M2ePro-shipping-tpl-title',
                                                M2ePro.translator.translate('The specified Title is already used for other Policy. Policy Title must be unique.'),
                                                'Walmart_Template_Shipping', 'title', 'id',
                                                M2ePro.formData.id);
    },

    // ---------------------------------------

    duplicate_click: function($headId)
    {
        this.setValidationCheckRepetitionValue('M2ePro-shipping-tpl-title',
                                                M2ePro.translator.translate('The specified Title is already used for other Policy. Policy Title must be unique.'),
                                                'Walmart_Template_Shipping', 'title', 'id', '');

        CommonHandlerObj.duplicate_click($headId, M2ePro.translator.translate('Add Shipping Policy'));
    },

    // ---------------------------------------

    templateNameModeChange: function()
    {
        $('template_name_custom_value_tr').hide();
        $('template_name_attribute').value = '';

        if (this.value == M2ePro.php.constant('Ess_M2ePro_Model_Walmart_Template_Shipping::TEMPLATE_NAME_VALUE')) {
            $('template_name_custom_value_tr').show();
        } else if (this.value == M2ePro.php.constant('Ess_M2ePro_Model_Walmart_Template_Shipping::TEMPLATE_NAME_ATTRIBUTE')) {
            WalmartTemplateShippingHandlerObj.updateHiddenValue(this, $('template_name_attribute'));
        }
    }

    // ---------------------------------------

});


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

<title>R-Index</title>
<meta name="date" content="2016-11-09">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A C D E F I N O P R S T

R

remainingCapacity() - Method in class com.hybhub.util.concurrent.ConcurrentSetBlockingQueue

remove(Object) - Method in class com.hybhub.util.concurrent.ConcurrentSetCollection

remove() - Method in class com.hybhub.util.concurrent.ConcurrentSetQueue

removeAll(Collection<?>) - Method in class com.hybhub.util.concurrent.ConcurrentSetCollection

retainAll(Collection<?>) - Method in class com.hybhub.util.concurrent.ConcurrentSetCollection

A C D E F I N O P R S T

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
class ChatRoom < ApplicationRecord
  belongs_to :user
  has_many :messages, dependent: :destroy
end


text:
namespace NServiceBus.Persistence.Sql.ScriptBuilder
{
    public enum CorrelationPropertyType
    {
        //nvarchar(450)
        //https://technet.microsoft.com/en-us/library/ms191241(v=sql.105).aspx
        String,
        DateTime,
        DateTimeOffset,
        Int,
        Guid
    }
}


text:
package com.amazonaws.services.certificatemanager.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RequestCertificateResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * String that contains the ARN of the issued certificate. This must be of the form:
     *

     *

     * arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     *

     */
    private String certificateArn;

    /**
     *

     * String that contains the ARN of the issued certificate. This must be of the form:
     *

     *

     * arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     *

     *
     * @param certificateArn
     *        String that contains the ARN of the issued certificate. This must be of the form:

     *

     *        arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     */

    public void setCertificateArn(String certificateArn) {
        this.certificateArn = certificateArn;
    }

    /**
     *

     * String that contains the ARN of the issued certificate. This must be of the form:
     *

     *

     * arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     *

     *
     * @return String that contains the ARN of the issued certificate. This must be of the form:

     *

     *         arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     */

    public String getCertificateArn() {
        return this.certificateArn;
    }

    /**
     *

     * String that contains the ARN of the issued certificate. This must be of the form:
     *

     *

     * arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     *

     *
     * @param certificateArn
     *        String that contains the ARN of the issued certificate. This must be of the form:

     *

     *        arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public RequestCertificateResult withCertificateArn(String certificateArn) {
        setCertificateArn(certificateArn);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCertificateArn() != null)
            sb.append("CertificateArn: ").append(getCertificateArn());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof RequestCertificateResult == false)
            return false;
        RequestCertificateResult other = (RequestCertificateResult) obj;
        if (other.getCertificateArn() == null ^ this.getCertificateArn() == null)
            return false;
        if (other.getCertificateArn() != null && other.getCertificateArn().equals(this.getCertificateArn()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getCertificateArn() == null) ? 0 : getCertificateArn().hashCode());
        return hashCode;
    }

    @Override
    public RequestCertificateResult clone() {
        try {
            return (RequestCertificateResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
#include "condor_common.h"
#include "condition.h"

using namespace std;

Condition::
Condition( )
{
	myTree = NULL;
	pos = ATTR_POS_LEFT;
	op = classad::Operation::__NO_OP__;
	multiAttr = false;
	isComplex = false;
	op2 = op;
}

Condition::
~Condition( )
{
}

bool Condition::
Init( const string &_attr, classad::ExprTree *_tree, bool bVal )
{
	if( !( BoolExpr::Init( _tree ) ) ) {
		return false;
	}
	attr = _attr;
	op = classad::Operation::EQUAL_OP;
	val.SetBooleanValue( bVal );
	isComplex = false;
	initialized = true;
	return true;
}

bool Condition::
Init( const string &_attr, classad::Operation::OpKind _op,
	  const classad::Value &_val,
	  classad::ExprTree *_tree, AttrPos _pos )
{
	if( _op < classad::Operation::__COMPARISON_START__ ||
		_op > classad::Operation::__COMPARISON_END__ ) {
		return false;
	}
	if( !( BoolExpr::Init( _tree ) ) ) {
		return false;
	}
	attr = _attr;
	op = _op;
	val.CopyFrom( _val );
	pos = _pos;
	isComplex = false;
	initialized = true;
	return true;
}

bool Condition::
InitComplex( classad::ExprTree *_tree )
{
	if( !( BoolExpr::Init( _tree ) ) ) {
		return false;
	}
	isComplex = true;
	multiAttr = true;
	initialized = true;
	return true;
}

bool Condition::
InitComplex( const string &_attr,
			 classad::Operation::OpKind _op1, const classad::Value &_val1,
			 classad::Operation::OpKind _op2, const classad::Value &_val2,
			 classad::ExprTree *_tree )
{
	if( !( BoolExpr::Init( _tree ) ) ) {
		return false;
	}
	attr = _attr;
	op = _op1;
	val.CopyFrom( _val1 );
	op2 = _op2;
	val2.CopyFrom( _val2 );
	isComplex = true;
	multiAttr = false;
	initialized = true;
	return true;
}

bool Condition::
GetAttr( string& attribute )
{
	if( !initialized ) {
		return false;
	}
	if( isComplex && multiAttr) {
		return false;
	}
	attribute = this->attr;
	return true;
}

bool Condition::
GetOp( classad::Operation::OpKind &result )
{
	if( !initialized ) {
		return false;
	}
	if( isComplex && multiAttr) {
		return false;
	}
	result = op;
	return true;
}

bool Condition::
GetOp2( classad::Operation::OpKind &result )
{
	if( !initialized ) {
		return false;
	}
	if( !isComplex || multiAttr ) {
		return false;
	}
	result = op2;
	return true;
}

bool Condition::
GetVal( classad::Value &value )
{
	if( !initialized ) {
		return false;
	}
	if( isComplex && multiAttr ) {
		return false;
	}
	value.CopyFrom( this->val );
	return true;
}

bool Condition::
GetVal2( classad::Value &value )
{
	if( !initialized ) {
		return false;
	}
	if( !isComplex || multiAttr ) {
		return false;
	}
	value.CopyFrom( this->val2 );
	return true;
}

bool Condition::
GetType( classad::Value::ValueType &result )
{
	if( !initialized ) {
		return false;
	}
	if( isComplex ) {
		if( multiAttr ) {
			return false;
		}
		else {
			if( val.IsUndefinedValue( ) ) {
				result = val2.GetType( );
			}
		}
	}
	result = val.GetType( );
	return true;
}

bool Condition::
GetAttrPos( Condition::AttrPos &result )
{
	if( !initialized ) {
		return false;
	}
	if( isComplex ) {
		return false;
	}
	result = pos;
	return true;
}

bool Condition::
IsComplex( ) const
{
	return isComplex;
}

bool Condition::
HasMultipleAttrs( ) const
{
	return multiAttr;
}


text:
HMODULE hInstance;
HICON hDefaultIcon;
HCURSOR hDefaultCursor;
HFONT controlfont;

void panic(char *fmt, ...);
TCHAR *toWideString(char *what);
void init(void);

LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	NMHDR *nmhdr = (NMHDR *) lparam;
	NMLVDISPINFOW *fill = (NMLVDISPINFO *) lparam;

	switch (msg) {
	case WM_NOTIFY:
		if (nmhdr->code == LVN_GETDISPINFO) {
			if (fill->item.iSubItem == 0) {
				fill->item.state = INDEXTOSTATEIMAGEMASK(fill->item.iItem + 1);
				fill->item.stateMask = LVIS_STATEIMAGEMASK;
			} else
				fill->item.pszText = L"No State Image Here";
			return 0;
		}
		return DefWindowProc(hwnd, msg, wparam, lparam);
	case WM_CLOSE:
		PostQuitMessage(0);
		return 0;
	default:
		return DefWindowProc(hwnd, msg, wparam, lparam);
	}
	panic("oops: message %ud does not return anything; bug in wndproc()", msg);
}

HWND makeMainWindow(void)
{
	WNDCLASS cls;
	HWND hwnd;

	ZeroMemory(&cls, sizeof (WNDCLASS));
	cls.lpszClassName = L"mainwin";
	cls.lpfnWndProc = wndproc;
	cls.hInstance = hInstance;
	cls.hIcon = hDefaultIcon;
	cls.hCursor = hDefaultCursor;
	cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
	if (RegisterClass(&cls) == 0)
		panic("error registering window class");
	hwnd = CreateWindowEx(0,
		L"mainwin", L"Main Window",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT,
		300, 300,
		NULL, NULL, hInstance, NULL);
	if (hwnd == NULL)
		panic("opening main window failed");
	return hwnd;
}

void buildUI(HWND mainwin)
{
#define CSTYLE (WS_CHILD | WS_VISIBLE)
#define CXSTYLE (0)
#define SETFONT(hwnd) SendMessage(hwnd, WM_SETFONT, (WPARAM) controlfont, (LPARAM) TRUE);

	HWND lv;
	LVCOLUMN column;
	HIMAGELIST imglist;

	lv = CreateWindowEx(WS_EX_CLIENTEDGE | CXSTYLE,
		WC_LISTVIEW, L"",
		LVS_REPORT | LVS_OWNERDATA | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP | CSTYLE,
		10, 10, 250, 250,
		mainwin, (HMENU) 100, hInstance, NULL);
	if (lv == NULL)
		panic("error making list view");
	SETFONT(lv);
	SendMessageW(lv, LVM_SETEXTENDEDLISTVIEWSTYLE,
		LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES,
		LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);

	// error checking elided from this point to where otherwise noted

	HTHEME theme = NULL;
	HIMAGELIST makeCheckboxImageList(HWND hwnddc, HTHEME *theme);

	SendMessageW(lv, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM) makeCheckboxImageList(lv, &theme));

	ZeroMemory(&column, sizeof (LVCOLUMN));
	column.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
	column.fmt = LVCFMT_LEFT;
	column.pszText = L"State Image";
	column.iSubItem = 0;
	column.iOrder = 0;
	SendMessageW(lv, LVM_INSERTCOLUMN, 0, (LPARAM) (&column));
	ZeroMemory(&column, sizeof (LVCOLUMN));
	column.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
	column.fmt = LVCFMT_LEFT;
	column.pszText = L"No State Image";
	column.iSubItem = 1;
	column.iOrder = 1;
	SendMessageW(lv, LVM_INSERTCOLUMN, 1, (LPARAM) (&column));

	// end of error eliding

        if (SendMessageW(lv, LVM_SETCALLBACKMASK, LVIS_STATEIMAGEMASK, 0) == FALSE)
		panic("error marking state image list as application-managed");
	if (SendMessageW(lv, LVM_SETITEMCOUNT, 8, 0) == 0)
		panic("error setting number of items in list view");
}

void firstShowWindow(HWND hwnd);

int main(void)
{
	HWND mainwin;
	MSG msg;

	init();

	mainwin = makeMainWindow();
	buildUI(mainwin);
	firstShowWindow(mainwin);

	for (;;) {
		BOOL gmret;

		gmret = GetMessage(&msg, NULL, 0, 0);
		if (gmret == -1)
			panic("error getting message");
		if (gmret == 0)
			break;
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return 0;
}

DWORD iccFlags =
//	ICC_ANIMATE_CLASS |			// animation control
//	ICC_BAR_CLASSES |				// toolbar, statusbar, trackbar, tooltip
//	ICC_COOL_CLASSES |			// rebar
//	ICC_DATE_CLASSES |			// date and time picker
//	ICC_HOTKEY_CLASS |			// hot key
//	ICC_INTERNET_CLASSES |		// IP address entry field
//	ICC_LINK_CLASS |				// hyperlink
	ICC_LISTVIEW_CLASSES |			// list-view, header
//	ICC_NATIVEFNTCTL_CLASS |		// native font
//	ICC_PAGESCROLLER_CLASS |		// pager
//	ICC_PROGRESS_CLASS |			// progress bar
//	ICC_STANDARD_CLASSES |		// "one of the intrinsic User32 control classes"
//	ICC_TAB_CLASSES |				// tab, tooltip
//	ICC_TREEVIEW_CLASSES |		// tree-view, tooltip
//	ICC_UPDOWN_CLASS |			// up-down
//	ICC_USEREX_CLASSES |			// ComboBoxEx
//	ICC_WIN95_CLASSES |			// some of the above
	0;

void init(void)
{
	INITCOMMONCONTROLSEX icc;
	NONCLIENTMETRICS ncm;

	hInstance = GetModuleHandle(NULL);
	if (hInstance == NULL)
		panic("error getting hInstance");
	hDefaultIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
	if (hDefaultIcon == NULL)
		panic("error getting default window class icon");
	hDefaultCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
	if (hDefaultCursor == NULL)
		panic("error getting default window cursor");
	icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
	icc.dwICC = iccFlags;
	if (InitCommonControlsEx(&icc) == FALSE)
		panic("error initializing Common Controls");
	ncm.cbSize = sizeof (NONCLIENTMETRICS);
	if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
		sizeof (NONCLIENTMETRICS), &ncm, 0) == 0)
		panic("error getting non-client metrics for getting control font");
	controlfont = CreateFontIndirect(&ncm.lfMessageFont);
	if (controlfont == NULL)
		panic("error getting control font");
}

void panic(char *fmt, ...)
{
	char *msg;
	TCHAR *lerrmsg;
	char *fullmsg;
	va_list arg;
	DWORD lasterr;
	DWORD lerrsuccess;

	lasterr = GetLastError();
	va_start(arg, fmt);
	if (vasprintf(&msg, fmt, arg) == -1) {
		fprintf(stderr, "critical error: vasprintf() failed in panic() preparing panic message; fmt = \"%s\"\n", fmt);
		abort();
	}
	// according to http://msdn.microsoft.com/en-us/library/windows/desktop/ms680582%28v=vs.85%29.aspx
	lerrsuccess = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL, lasterr,
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		(LPTSTR) &lerrmsg, 0, NULL);
	if (lerrsuccess == 0) {
		fprintf(stderr, "critical error: FormatMessage() failed in panic() preparing GetLastError() string; panic message = \"%s\", last error in panic(): %ld, last error from FormatMessage(): %ld\n", msg, lasterr, GetLastError());
		abort();
	}
	// note to self: use %ws instead of %S (thanks jon_y in irc.oftc.net/#mingw-w64)
	if (asprintf(&fullmsg, "panic: %s\nlast error: %ws\n", msg, lerrmsg) == -1) {
		fprintf(stderr, "critical error: asprintf() failed in panic() preparing full report; panic message = \"%s\", last error message: \"%ws\"\n", msg, lerrmsg);
		abort();
	}
	fprintf(stderr, "%s\n", fullmsg);
	va_end(arg);
	exit(1);
}

void firstShowWindow(HWND hwnd)
{
	// we need to get nCmdShow
	int nCmdShow;
	STARTUPINFO si;

	nCmdShow = SW_SHOWDEFAULT;
	GetStartupInfo(&si);
	if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
		nCmdShow = si.wShowWindow;
	ShowWindow(hwnd, nCmdShow);
	if (UpdateWindow(hwnd) == 0)
		panic("UpdateWindow(hwnd) failed in first show");
}

TCHAR *toWideString(char *what)
{
	TCHAR *buf;
	int n;
	size_t len;

	len = strlen(what);
	if (len == 0) {
		buf = (TCHAR *) malloc(sizeof (TCHAR));
		if (buf == NULL)
			goto mallocfail;
		buf[0] = L'\0';
	} else {
		n = MultiByteToWideChar(CP_UTF8, 0, what, -1, NULL, 0);
		if (n == 0)
			panic("error getting number of bytes to convert \"%s\" to UTF-16", what);
		buf = (TCHAR *) malloc((n + 1) * sizeof (TCHAR));
		if (buf == NULL)
			goto mallocfail;
		if (MultiByteToWideChar(CP_UTF8, 0, what, -1, buf, n) == 0)
			panic("erorr converting \"%s\" to UTF-16", what);
	}
	return buf;
mallocfail:
	panic("error allocating memory for UTF-16 version of \"%s\"", what);
}

#define checkboxnStates 8

static int themestates[checkboxnStates] = {
	CBS_UNCHECKEDNORMAL,			// 0
	CBS_CHECKEDNORMAL,				// checked
	CBS_UNCHECKEDHOT,				// hot
	CBS_CHECKEDHOT,					// checked | hot
	CBS_UNCHECKEDPRESSED,			// pushed
	CBS_CHECKEDPRESSED,				// checked | pushed
	CBS_UNCHECKEDPRESSED,			// hot | pushed
	CBS_CHECKEDPRESSED,				// checked | hot | pushed
};

static SIZE getStateSize(HDC dc, int cbState, HTHEME theme)
{
	SIZE s;
	HRESULT res;

	res = GetThemePartSize(theme, dc, BP_CHECKBOX, themestates[cbState], NULL, TS_DRAW, &s);
	if (res != S_OK)
		panic("error getting theme part size; HRESULT: %x", res);
	return s;
}

static void themeImage(HDC dc, RECT *r, int cbState, HTHEME theme)
{
	HRESULT res;

	res = DrawThemeBackground(theme, dc, BP_CHECKBOX, themestates[cbState], r, NULL);
	if (res != S_OK)
		panic("error drawing checkbox image; HRESULT: %x", res);
}

static void themeSize(HDC dc, int *width, int *height, HTHEME theme)
{
	SIZE size;
	int cbState;

	size = getStateSize(dc, 0, theme);
	for (cbState = 1; cbState < checkboxnStates; cbState++) {
		SIZE against;

		against = getStateSize(dc, cbState, theme);
		if (size.cx != against.cx || size.cy != against.cy)
			panic("size mismatch in checkbox states");
	}
	*width = (int) size.cx;
	*height = (int) size.cy;
}

static HBITMAP makeCheckboxImageListEntry(HDC dc, int width, int height, int cbState, void (*drawfunc)(HDC, RECT *, int, HTHEME), HTHEME theme)
{
	BITMAPINFO bi;
	VOID *ppvBits;
	HBITMAP bitmap;
	RECT r;
	HDC drawDC;
	HBITMAP prevbitmap;

	r.left = 0;
	r.top = 0;
	r.right = width;
	r.bottom = height;
	ZeroMemory(&bi, sizeof (BITMAPINFO));
	bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
	bi.bmiHeader.biWidth = (LONG) width;
	bi.bmiHeader.biHeight = -((LONG) height);			// negative height to force top-down drawing;
	bi.bmiHeader.biPlanes = 1;
	bi.bmiHeader.biBitCount = 32;
	bi.bmiHeader.biCompression = BI_RGB;
	bi.bmiHeader.biSizeImage = (DWORD) (width * height * 4);
	bitmap = CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, &ppvBits, 0, 0);
	if (bitmap == NULL)
		panic("error creating HBITMAP for unscaled ImageList image copy");

	drawDC = CreateCompatibleDC(dc);
	if (drawDC == NULL)
		panic("error getting DC for checkbox image list bitmap");
	prevbitmap = SelectObject(drawDC, bitmap);
	if (prevbitmap == NULL)
		panic("error selecting checkbox image list bitmap into DC");
	(*drawfunc)(drawDC, &r, cbState, theme);
	if (SelectObject(drawDC, prevbitmap) != bitmap)
		panic("error selecting previous bitmap into checkbox image's DC");
	if (DeleteDC(drawDC) == 0)
		panic("error deleting checkbox image's DC");

	return bitmap;
}

static HIMAGELIST newCheckboxImageList(HWND hwnddc, void (*sizefunc)(HDC, int *, int *, HTHEME), void (*drawfunc)(HDC, RECT *, int, HTHEME), HTHEME theme)
{
	int width, height;
	int cbState;
	HDC dc;
	HIMAGELIST il;

	dc = GetDC(hwnddc);
	if (dc == NULL)
		panic("error getting DC for making the checkbox image list");
	(*sizefunc)(dc, &width, &height, theme);
	il = ImageList_Create(width, height, ILC_COLOR32, 20, 20);		// should be reasonable
	if (il == NULL)
		panic("error creating checkbox image list");
	for (cbState = 0; cbState < checkboxnStates; cbState++) {
		HBITMAP bitmap;

		bitmap = makeCheckboxImageListEntry(dc, width, height, cbState, drawfunc, theme);
		if (ImageList_Add(il, bitmap, NULL) == -1)
			panic("error adding checkbox image to image list");
		if (DeleteObject(bitmap) == 0)
			panic("error deleting checkbox bitmap");
	}
	if (ReleaseDC(hwnddc, dc) == 0)
		panic("error deleting checkbox image list DC");
	return il;
}

HIMAGELIST makeCheckboxImageList(HWND hwnddc, HTHEME *theme)
{
	if (*theme != NULL) {
		HRESULT res;

		res = CloseThemeData(*theme);
		if (res != S_OK)
			panic("error closing theme; HRESULT: %x", res);
		*theme = NULL;
	}
	// ignore error; if it can't be done, we can fall back to DrawFrameControl()
	if (*theme == NULL)		// try to open the theme
		*theme = OpenThemeData(hwnddc, L"button");
	if (*theme != NULL)		// use the theme
		return newCheckboxImageList(hwnddc, themeSize, themeImage, *theme);
	panic("error loading theme");
	return NULL;		// unreached
}


text:
import { AL_MASK, OBJECT, OBJECT_OVERHEAD, BLOCK_MAXSIZE, BLOCK_OVERHEAD, BLOCK, OBJECT_MAXSIZE } from "./common";
import { E_ALLOCATION_TOO_LARGE } from "../util/error";

// === A minimal runtime stub ===

// @ts-ignore: decorator
@lazy var startOffset: usize = ((__heap_base + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;
// @ts-ignore: decorator
@lazy var offset: usize = startOffset;

function maybeGrowMemory(newOffset: usize): void {
  // assumes newOffset is aligned
  var pagesBefore = memory.size();
  var maxOffset = ((<usize>pagesBefore << 16) + AL_MASK) & ~AL_MASK;
  if (newOffset > maxOffset) {
    let pagesNeeded = <i32>(((newOffset - maxOffset + 0xffff) & ~0xffff) >>> 16);
    let pagesWanted = max(pagesBefore, pagesNeeded); // double memory
    if (memory.grow(pagesWanted) < 0) {
      if (memory.grow(pagesNeeded) < 0) unreachable(); // out of memory
    }
  }
  offset = newOffset;
}

// @ts-ignore: decorator
@inline function computeSize(size: usize): usize {
  return ((size + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;
}

// @ts-ignore: decorator
@unsafe @global
export function __alloc(size: usize): usize {
  if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);
  var block = changetype<BLOCK>(offset);
  var ptr = offset + BLOCK_OVERHEAD;
  var payloadSize = computeSize(size);
  maybeGrowMemory(ptr + payloadSize);
  block.mmInfo = payloadSize;
  return ptr;
}

// @ts-ignore: decorator
@unsafe @global
export function __realloc(ptr: usize, size: usize): usize {
  assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned
  var block = changetype<BLOCK>(ptr - BLOCK_OVERHEAD);
  var actualSize = block.mmInfo;
  var isLast = ptr + actualSize == offset;
  var payloadSize = computeSize(size);
  if (size > actualSize) {
    if (isLast) { // last block: grow
      if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);
      maybeGrowMemory(ptr + payloadSize);
      block.mmInfo = payloadSize;
    } else { // copy to new block at least double the size
      let newPtr = __alloc(max<usize>(payloadSize, actualSize << 1));
      memory.copy(newPtr, ptr, actualSize);
      block = changetype<BLOCK>((ptr = newPtr) - BLOCK_OVERHEAD);
    }
  } else if (isLast) { // last block: shrink
    offset = ptr + payloadSize;
    block.mmInfo = payloadSize;
  }
  return ptr;
}

// @ts-ignore: decorator
@unsafe @global
export function __free(ptr: usize): void {
  assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned
  var block = changetype<BLOCK>(ptr - BLOCK_OVERHEAD);
  if (ptr + block.mmInfo == offset) { // last block: discard
    offset = changetype<usize>(block);
  }
}

// @ts-ignore: decorator
@unsafe @global
export function __reset(): void { // special
  offset = startOffset;
}

// @ts-ignore: decorator
@unsafe @global
export function __new(size: usize, id: u32): usize {
  if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);
  var ptr = __alloc(OBJECT_OVERHEAD + size);
  var object = changetype<OBJECT>(ptr - BLOCK_OVERHEAD);
  object.gcInfo = 0;
  object.gcInfo2 = 0;
  object.rtId = id;
  object.rtSize = <u32>size;
  return ptr + OBJECT_OVERHEAD;
}

// @ts-ignore: decorator
@unsafe @global
export function __renew(oldPtr: usize, size: usize): usize {
  if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);
  var newPtr = __realloc(oldPtr - OBJECT_OVERHEAD, OBJECT_OVERHEAD + size);
  changetype<OBJECT>(newPtr - BLOCK_OVERHEAD).rtSize = <u32>size;
  return newPtr + OBJECT_OVERHEAD;
}

// @ts-ignore: decorator
@global @unsafe
export function __link(parentPtr: usize, childPtr: usize, expectMultiple: bool): void {
  // nop
}

// @ts-ignore: decorator
@global @unsafe
export function __pin(ptr: usize): usize {
  return ptr;
}

// @ts-ignore: decorator
@global @unsafe
export function __unpin(ptr: usize): void {
  // nop
}

// @ts-ignore: decorator
@global @unsafe
function __visit(ptr: usize, cookie: u32): void { // eslint-disable-line @typescript-eslint/no-unused-vars
  // nop
}

// @ts-ignore: decorator
@global @unsafe
export function __collect(): void {
  // nop
}


text:
@interface NBPhoneMetadataTest979 : NBPhoneMetaData
{
}

- (id)init;

@end


text:
#ifndef cmDependsJava_h
#define cmDependsJava_h

#include "cmDepends.h"

/** \class cmDependsJava
 * \brief Dependency scanner for Java class files.
 */
class cmDependsJava: public cmDepends
{
public:
  /** Checking instances need to know the build directory name and the
      relative path from the build directory to the target file.  */
  cmDependsJava();

  /** Virtual destructor to cleanup subclasses properly.  */
  virtual ~cmDependsJava();

protected:
  // Implement writing/checking methods required by superclass.
  virtual bool WriteDependencies(const char *src, const char *file,
    std::ostream& makeDepends, std::ostream& internalDepends);
  virtual bool CheckDependencies(std::istream& internalDepends);

private:
  cmDependsJava(cmDependsJava const&); // Purposely not implemented.
  void operator=(cmDependsJava const&); // Purposely not implemented.
};

#endif


text:
from setuptools import setup, find_packages
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='pythymiodw',
    version='2.4.1',
    description='Python library for Thymio used in Digital World class',
    long_description=long_description,
    url='https://github.com/kurniawano/pythymiodw',
    author='Oka Kurniawan',
    author_email='kurniawano@ieee.org',
    license='MIT',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Education',
        'License :: OSI Approved :: MIT License',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python :: 3',
        'Topic :: Education',
        ],
    keywords='robot library education',
    packages=find_packages(exclude=['contrib', 'docs', 'tests']),
    install_requires=['libdw', 'pygame', 'requests', 'Pyro4', 'cryptography'],
    package_data={
        'pythymiodw': ['thymiohandlers.aesl','images/iodisplay.png'],
        'pythymiodw.pg':['images/thymio1.png', 'images/thymio2.png', 'images/thymio3.png', 'images/thymio4.png', 'images/thymio5.png'],
        },
    )


text:
package SSHCure::Bruteforce::Utils;
use strict;
use warnings;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw (
    get_histogram_stats
    get_histogram_end
    get_concurrent_connection_stats
);

# Determines the following values in the supplied histogram:
#   * Highest peak
#   * Highest peak frequency
#   * Highest peak share (overall, fraction)
#   * Highest key
sub get_histogram_stats {
    my $h = $_[0];
    my @sorted_keys_by_value_frequency = sort { $$h{$a} <=> $$h{$b} } keys (%$h);
    my $top_value = $sorted_keys_by_value_frequency[-1];

    my $highest_key = (sort {$a <=> $b} keys (%$h))[-1];

    my $total_values = 0;
    $total_values += $_ for (values %$h);

    my $top_value_fraction = $$h{$top_value} / $total_values;
    return ($top_value, $$h{$top_value}, $top_value_fraction, $highest_key);
}

# The get_histogram_end routine determines whether the last 'bins' of the histogram
# contain a peak. This is used to find possible network-wide blocks in a collection of flow records.
sub get_histogram_end {
    my ($h, $bin_count) = @_;
    my $total_item_count = 0;
    $total_item_count += $_ for (values %$h);

    my @sorted = sort keys %$h;

    my $last_bins_sum = 0;
    my $number_of_bins_to_check = $bin_count;
    $number_of_bins_to_check = scalar @sorted;
    my $timestamp_to_return = 0;
    foreach (0..$number_of_bins_to_check-1) {
        last if $sorted[-1 - $_] < $timestamp_to_return - 1;
        $last_bins_sum += $$h{$sorted[-1 - $_]};
        $timestamp_to_return = $sorted[-1 - $_];
    }

    my $percentage = $last_bins_sum/$total_item_count;
    return ($timestamp_to_return, $last_bins_sum, $percentage);
}

sub get_concurrent_connection_stats {
    my $conc_conns = $_[0];
    my $sum = 0;
    $sum += $_ for (values %$conc_conns);

    my $avg = $sum/(scalar keys %$conc_conns);
    my $max = (sort (values %$conc_conns))[-1];
    return ($avg, $max);
}

1;