text:
package net.logvv.raven.push.jpush.notification;

import java.util.HashMap;
import java.util.Map;

import net.logvv.raven.push.model.jpush.PushModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.logvv.raven.utils.Preconditions;

public abstract class PlatformNotification implements PushModel {
    public static final String ALERT = "alert";
    private static final String EXTRAS = "extras";

    protected static final Logger LOG = LoggerFactory.getLogger(PlatformNotification.class);

    private Object alert;
    private final Map<String, String> extras;
    private final Map<String, Number> numberExtras;
    private final Map<String, Boolean> booleanExtras;
    private final Map<String, JsonObject> jsonExtras;

    public PlatformNotification(Object alert, Map<String, String> extras,
    		Map<String, Number> numberExtras,
    		Map<String, Boolean> booleanExtras,
    		Map<String, JsonObject> jsonExtras) {
        this.alert = alert;
        this.extras = extras;
        this.numberExtras = numberExtras;
        this.booleanExtras = booleanExtras;
        this.jsonExtras = jsonExtras;
    }

    @Override
    public JsonElement toJSON() {
        JsonObject json = new JsonObject();

        if (null != alert) {
            if ( alert instanceof JsonObject) {
                json.add(ALERT, (JsonObject) alert);
            } else if (alert instanceof IosAlert) {
                json.add(ALERT, ((IosAlert) alert).toJSON());
            } else {
                json.add(ALERT, new JsonPrimitive(alert.toString()));
            }
        }

        JsonObject extrasObject = null;
        if (null != extras || null != numberExtras || null != booleanExtras || null != jsonExtras) {
            extrasObject = new JsonObject();
        }

        if (null != extras) {
            String value = null;
            for (String key : extras.keySet()) {
                value = extras.get(key);
                if (null != value) {
                    extrasObject.add(key, new JsonPrimitive(value));
                }
            }
        }
        if (null != numberExtras) {
            Number value = null;
            for (String key : numberExtras.keySet()) {
                value = numberExtras.get(key);
                if (null != value) {
                    extrasObject.add(key, new JsonPrimitive(value));
                }
            }
        }
        if (null != booleanExtras) {
            Boolean value = null;
            for (String key : booleanExtras.keySet()) {
                value = booleanExtras.get(key);
                if (null != value) {
                    extrasObject.add(key, new JsonPrimitive(value));
                }
            }
        }
        if (null != jsonExtras) {
            JsonObject value = null;
            for (String key : jsonExtras.keySet()) {
                value = jsonExtras.get(key);
                if (null != value) {
                    extrasObject.add(key, value);
                }
            }
        }

        if (null != extras || null != numberExtras || null != booleanExtras || null != jsonExtras) {
            json.add(EXTRAS, extrasObject);
        }

        return json;
    }

    protected Object getAlert() {
        return this.alert;
    }

    protected void setAlert(Object alert) {
        this.alert = alert;
    }

    protected abstract String getPlatform();

    protected abstract static class Builder<T extends PlatformNotification, B extends Builder<T, B>> {
    	private B theBuilder;

        protected Object alert;
        protected Map<String, String> extrasBuilder;
        protected Map<String, Number> numberExtrasBuilder;
        protected Map<String, Boolean> booleanExtrasBuilder;
        protected Map<String, JsonObject> jsonExtrasBuilder;

        public Builder () {
        	theBuilder = getThis();
        }

        protected abstract B getThis();

        public abstract B setAlert(Object alert);

        public B addExtra(String key, String value) {
            Preconditions.checkArgument(! (null == key), "Key should not be null.");
            if (null == value) {
                LOG.debug("Extra value is null, throw away it.");
                return theBuilder;
            }
            if (null == extrasBuilder) {
                extrasBuilder = new HashMap<String, String>();
            }
            extrasBuilder.put(key, value);
            return theBuilder;
        }

        public B addExtras(Map<String, String> extras) {
            if (null == extras) {
                LOG.warn("Null extras param. Throw away it.");
                return theBuilder;
            }

            if (null == extrasBuilder) {
                extrasBuilder = new HashMap<String, String>();
            }
            for (String key : extras.keySet()) {
                extrasBuilder.put(key, extras.get(key));
            }
            return theBuilder;
        }

        public B addExtra(String key, Number value) {
            Preconditions.checkArgument(! (null == key), "Key should not be null.");
            if (null == value) {
                LOG.debug("Extra value is null, throw away it.");
                return theBuilder;
            }
            if (null == numberExtrasBuilder) {
                numberExtrasBuilder = new HashMap<String, Number>();
            }
            numberExtrasBuilder.put(key, value);
            return theBuilder;
        }

        public B addExtra(String key, Boolean value) {
            Preconditions.checkArgument(! (null == key), "Key should not be null.");
            if (null == value) {
                LOG.debug("Extra value is null, throw away it.");
                return theBuilder;
            }
            if (null == booleanExtrasBuilder) {
                booleanExtrasBuilder = new HashMap<String, Boolean>();
            }
            booleanExtrasBuilder.put(key, value);
            return theBuilder;
        }

        public B addExtra(String key, JsonObject value) {
            Preconditions.checkArgument(! (null == key), "Key should not be null.");
            if (null == value) {
                LOG.debug("Extra value is null, throw away it.");
                return theBuilder;
            }
            if (null == jsonExtrasBuilder) {
            	jsonExtrasBuilder = new HashMap<String, JsonObject>();
            }
            jsonExtrasBuilder.put(key, value);
            return theBuilder;
        }

        public abstract T build();
    }

}


text:
package crawler;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class PreventMultiInstanceTest {

    @Test
    void testLock() throws Exception {
        PreventMultiInstance pmi = new PreventMultiInstance();
        pmi.release();

        assertFalse(pmi.isLocked());
        assertTrue(pmi.tryLock());
        assertFalse(pmi.tryLock());
        assertTrue(pmi.isLocked());
        pmi.release();
        assertFalse(pmi.isLocked());

        pmi.close();
    }

    @Test
    void testNotFoundLockFile() throws Exception {
        PreventMultiInstance pmi = new PreventMultiInstance("./test/.lock");

        assertFalse(pmi.tryLock());

        pmi.close();
    }
 }

redpajama_set_name: RedPajamaGithub


text:
First, what is the scale of the data we're dealing with? Just how long is the
Consolidated Screening List? We can find out with `wc -l`:

```shell
$ cat data/csl/consolidated_party_list_final.csv | wc -l
   28729
```

> `wc` stands for "word count"; the `-l` option tells it to count lines instead.

Woah, more than 28000 lines. We probably don't want to look at them all
every time, so let's take a peek at the first five lines with
`head -n 5`:

```shell
$ head -n 5 data/csl/consolidated_party_list_final.csv
"Last updated: May 23, 2014",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Source List,Entity Number,SDN Type,Programs,Name,Title,Address,City,State/Province,Postal Code,Country,Federal Register Notice,Effective Date,Date Lifted/Waived/Expired,Standard Order,License Requirement,License Policy,Call Sign,Vessel Type,Gross Tonnage,Gross Register Tonnage,Vessel Flag,Vessel Owner,Remarks/Notes,Address Number,Address Remarks,Alternate Number,Alternate Type,Alternate Name,Alternate Remarks,Web Link
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,13th Institute China Aerospace Times Electronics Corp (CATEC),,http://www.bis.doc.gov/entities/default.htm
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,713 Institute of Beijing,,http://www.bis.doc.gov/entities/default.htm
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,Beijing Aerospace Control Instruments Institute,,http://www.bis.doc.gov/entities/default.htm
```

We could also do this by piping the file to `head`, of course:
```shell
$ cat data/csl/consolidated_party_list_final.csv | head -n 5
```
This tells us that the first row is **not** the column names, as we might expect.

Get rid of that extra line with `sed`:

```shell
$ cat data/csl/consolidated_party_list_final.csv | head -n 5 | sed "1d"
Source List,Entity Number,SDN Type,Programs,Name,Title,Address,City,State/Province,Postal Code,Country,Federal Register Notice,Effective Date,Date Lifted/Waived/Expired,Standard Order,License Requirement,License Policy,Call Sign,Vessel Type,Gross Tonnage,Gross Register Tonnage,Vessel Flag,Vessel Owner,Remarks/Notes,Address Number,Address Remarks,Alternate Number,Alternate Type,Alternate Name,Alternate Remarks,Web Link
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,13th Institute China Aerospace Times Electronics Corp (CATEC),,http://www.bis.doc.gov/entities/default.htm
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,713 Institute of Beijing,,http://www.bis.doc.gov/entities/default.htm
EL,,,,"13 Institute, China Academy of Launch Vehicle Technology (CALT)",,,,,,China,66 FR 24265,05/14/2001,,,For all items subject to the EAR (See ?744.11 of the EAR),See ?744.3(d) of this part,,,,,,,,,,,,Beijing Aerospace Control Instruments Institute,,http://www.bis.doc.gov/entities/default.htm
```

> `sed` stands for "stream editor". `"1d"` means "delete line 1".

## Figure out the columns

Now let's figure out what the columns are with `csvcut`:

```shell
$ cat data/csl/consolidated_party_list_final.csv | head -n 5 | sed "1d" | csvcut -n
  1: Source List
  2: Entity Number
  3: SDN Type
  4: Programs
  5: Name
  6: Title
  7: Address
  8: City
  9: State/Province
 10: Postal Code
 11: Country
 12: Federal Register Notice
 13: Effective Date
 14: Date Lifted/Waived/Expired
 15: Standard Order
 16: License Requirement
 17: License Policy
 18: Call Sign
 19: Vessel Type
 20: Gross Tonnage
 21: Gross Register Tonnage
 22: Vessel Flag
 23: Vessel Owner
 24: Remarks/Notes
 25: Address Number
 26: Address Remarks
 27: Alternate Number
 28: Alternate Type
 29: Alternate Name
 30: Alternate Remarks
 31: Web Link
```

## Deal with encoding issues

Let's inspect just columns 1 and 11 to see list and country:
```shell
$ cat data/csl/consolidated_party_list_final.csv | head -n 5 | sed "1d" | csvcut -c 1,11
Source List,Country
Your file is not "utf-8" encoded. Please specify the correct encoding with the -e flag. Use the -v flag to see the complete error.
```

Oops. Looks like it's not Unicode. Trial end error results in a valid guess
that it's `latin-1` [encoded](http://csvkit.readthedocs.org/en/0.7.3/scripts/common_arguments.html#examples).

Try again:
```shell
$ cat data/csl/consolidated_party_list_final.csv | head -n 5 | sed "1d" | csvcut -c 1,11 -e latin-1
Source List,Country
EL,China
EL,China
EL,China
```

So our first three entries are all from China.

## More statistics

But what does "EL" mean? For that, we have to look at the government's [download instructions](http://export.gov/static/cl_downloading_instructions_08102011_gh_Latest_eg_main_040971.pdf), which say:

> Field Name  |Description
> ------------|-------------
> Source List |3-position code describing the source (agency or agency list) of the record (DPL= Denied Persons List, UVL= Unverified List, EL=Entity List, SDN= Specially Designated Nationals, DTC= AECA Debarred List, ISN= Nonproliferation Sanctions)

So now we know those three Chinese entries are from the [Entity List](http://www.bis.doc.gov/entities/default.htm).

Let's find out more about where these entries are all from, using `csvstat`.
This time let's process the full list (by omitting the call to `head`):

```shell
$ cat data/csl/consolidated_party_list_final.csv | sed "1d" | csvcut -c 1,11 -e latin-1 | csvstat
  1. Source List
	<type 'unicode'>
	Nulls: False
	Unique values: 6
	5 most frequent values:
		SDN:	25454
		EL:	1766
		DTC:	523
		DPL:	474
		ISN:	462
	Max length: 3
  2. Country
	<type 'unicode'>
	Nulls: True
	Unique values: 188
	5 most frequent values:
		Colombia:	3384
		Mexico:	2502
		Kuwait:	2485
		Iran:	1397
		Pakistan:	1128
	Max length: 33

Row count: 28727
```

Now we're getting some interesting data. Just looking at these two columns,
it looks like our initial inquiries were a fluke. The lists are dominated not
by China, but by Colombia, Mexico, and some countries in the Middle East. Also,
the Entity List has just 1766 entries, but the SDN, or
Specially Designated Nationals list, has more than 25000. The SDN is a list
provided by the [Office of Foreign Assets Control](http://www.treasury.gov/about/organizational-structure/offices/Pages/Office-of-Foreign-Assets-Control.aspx) within the US Treasury.

## Let's find out about ships!

What's are the most common names of ships on the SDN? To find out, we'll
chain `csvcut`, `csvgrep`, and `csvstat` together.
1. Use `csvcut` to select columns (Select Source List, SDN Type, Name, and Vessel Flag): `csvcut -e latin-1 -c 1,3,5,22`
2. Use `csvgrep` to search for just vessels, in the SDN Type column: `csvgrep -c 2 -m vessel`
3. Use `csvstat` again to show statistics.

```shell
$ cat data/csl/consolidated_party_list_final.csv | sed "1d" | csvcut -e latin-1 -c 1,3,5,22 | csvgrep -c 2 -m vessel | csvstat
  1. Source List
	<type 'unicode'>
	Nulls: False
	Values: SDN
  2. SDN Type
	<type 'unicode'>
	Nulls: False
	Values: vessel
  3. Name
	<type 'unicode'>
	Nulls: False
	Unique values: 239
	5 most frequent values:
		DORITA:	5
		CATALINA:	4
		PARMIS:	4
		SAVIZ:	4
		HONESTY:	3
	Max length: 21
  4. Vessel Flag
	<type 'unicode'>
	Nulls: True
	Unique values: 17
	5 most frequent values:
		None Identified:	84
		Iran:	78
		Tanzania:	36
		Bolivia:	34
		Hong Kong:	28
	Max length: 15

Row count: 374
```

There's some irony: the fifth most common ship name on the SDN is *Honesty*.

Where is the *Honesty* from? We can further `csvgrep` the Name column to find out:
```shell
$ cat data/csl/consolidated_party_list_final.csv | sed "1d" | csvcut -e latin-1 -c 1,3,5,22 | csvgrep -c 2 -m vessel | csvgrep -c 3 -m HONESTY
Source List,SDN Type,Name,Vessel Flag
SDN,vessel,HONESTY,None Identified
SDN,vessel,HONESTY,None Identified
SDN,vessel,HONESTY,None Identified
```

Oops, actually we can't; there's no flag country listed for any of the
*Honesty* entries. Let's add some more columns. Let's try Vessel Type
(column 19), Call Sign (column 18), Vessel Owner (column 23), and Programs (column 4):
```shell
$ cat data/csl/consolidated_party_list_final.csv | sed "1d" | csvcut -e latin-1 -c 1,3,5,22,19,18,23,4 | csvgrep -c 2 -m vessel | csvgrep -c 3 -m HONESTY
Source List,SDN Type,Name,Vessel Flag,Vessel Type,Call Sign,Vessel Owner,Programs
SDN,vessel,HONESTY,None Identified,Crude Oil Tanker,T2DZ4,,IRAN
SDN,vessel,HONESTY,None Identified,Crude Oil Tanker,T2DZ4,,IRAN
SDN,vessel,HONESTY,None Identified,Crude Oil Tanker,T2DZ4,,IRAN
```

Now we know the *Honesty* is a crude oil tanker with the call sign T2DZ4, and
is linked to Iran somehow. With a little Googling, we can find out all kinds
of interesting stuff about this vessel!
* It bounces back between the ports at [Kharg Island](http://en.wikipedia.org/wiki/Kharg_Island), Iran and [Zhoushan](http://en.wikipedia.org/wiki/Zhoushan#Economy), China
* Latest info: [*Honesty* on MarineTraffic.com](http://www.marinetraffic.com/ais/details/ships/9357391/vessel:HONESTY?lang=pl)

## Well, that's weird

But why is the *Honesty* listed three times? Let's look again at the raw data, all columns:

```shell
$ cat data/csl/consolidated_party_list_final.csv | sed "1d" | csvgrep -m HONESTY -c 5 -e latin-1
Source List,Entity Number,SDN Type,Programs,Name,Title,Address,City,State/Province,Postal Code,Country,Federal Register Notice,Effective Date,Date Lifted/Waived/Expired,Standard Order,License Requirement,License Policy,Call Sign,Vessel Type,Gross Tonnage,Gross Register Tonnage,Vessel Flag,Vessel Owner,Remarks/Notes,Address Number,Address Remarks,Alternate Number,Alternate Type,Alternate Name,Alternate Remarks,Web Link
SDN,15056,vessel,IRAN,HONESTY,,,,,,,,,,,,,T2DZ4,Crude Oil Tanker,"317,356","163,660",None Identified,,Former Vessel Flag Cyprus; alt. Former Vessel Flag Tuvalu; alt. Former Vessel Flag Tanzania; Vessel Registration Identification IMO 9357391; MMSI 572450210; Linked To: NATIONAL IRANIAN TANKER COMPANY.,22392,,22165,fka,HIRMAND,,http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx
SDN,15056,vessel,IRAN,HONESTY,,,,,,,,,,,,,T2DZ4,Crude Oil Tanker,"317,356","163,660",None Identified,,Former Vessel Flag Cyprus; alt. Former Vessel Flag Tuvalu; alt. Former Vessel Flag Tanzania; Vessel Registration Identification IMO 9357391; MMSI 572450210; Linked To: NATIONAL IRANIAN TANKER COMPANY.,22392,,23483,fka,HONESTY,,http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx
SDN,15056,vessel,IRAN,HONESTY,,,,,,,,,,,,,T2DZ4,Crude Oil Tanker,"317,356","163,660",None Identified,,Former Vessel Flag Cyprus; alt. Former Vessel Flag Tuvalu; alt. Former Vessel Flag Tanzania; Vessel Registration Identification IMO 9357391; MMSI 572450210; Linked To: NATIONAL IRANIAN TANKER COMPANY.,22392,,24782,fka,MILLIONAIRE,,http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx
```

Flipping between this and the column descriptions, we can see that columns 28
and 29 hold the answer. Column 28 for each says "fka" and Column 29 has a
different name in each of the three rows: "HIRMAND", then "HONESTY", then
"MILLIONAIRE". This tells us that there are three rows because the ship has
had multiple former names, **two of which are pretty awesome**.


text:
using Abp.Authorization.Users;
using Abp.Domain.Entities;

namespace Abp.MultiTenancy
{
    /// <summary>
    /// Implement this interface for an entity which may have Tenant.
    /// </summary>
    public interface IMayHaveTenant<TTenant, TUser> : IMayHaveTenant
        where TTenant : AbpTenant<TTenant, TUser>
        where TUser : AbpUser<TTenant, TUser>
    {
        /// <summary>
        /// Tenant.
        /// </summary>
        TTenant Tenant { get; set; }
    }
}


text:
package oauth

import (
	"io/ioutil"
	"log"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strings"
	"testing"

	"golang.org/x/oauth2"
)

func TestOAuthBegin(t *testing.T) {
	handler := New(&Config{
		Logger:     log.New(ioutil.Discard, "", 0),
		MountURL:   "https://example.test/forum/oauth",
		CookiePath: "/forum/",
	})
	handler.providers = map[string]*provider{
		"testprovider": {
			config: &oauth2.Config{
				ClientID:     "test-client-id",
				ClientSecret: "test-client-secret",
				Endpoint: oauth2.Endpoint{
					AuthURL:  "https://provider.test/auth",
					TokenURL: "https://provider.test/token",
				},
				RedirectURL: "https://example.test/forum/oauth/end/testprovider",
				Scopes:      []string{"testscope1", "testscope2"},
			},
		},
	}

	tests := []struct {
		desc          string
		provider      string
		wantCode      int
		checkLocation bool
	}{
		{
			desc:          "test provider",
			provider:      "testprovider",
			wantCode:      http.StatusFound,
			checkLocation: true,
		},
		{
			desc:          "unknown provider",
			provider:      "unknownprovider",
			wantCode:      http.StatusNotFound,
			checkLocation: false,
		},
	}

	for _, tc := range tests {
		req, err := http.NewRequest("GET", "/begin/"+tc.provider, nil)
		if err != nil {
			t.Fatal(err)
		}

		w := httptest.NewRecorder()
		handler.ServeHTTP(w, req)

		if tc.wantCode != w.Code {
			t.Fatalf("test %q: want status code %d got %d", tc.desc, tc.wantCode, w.Code)
		}

		if !tc.checkLocation {
			continue
		}

		loc := w.Header().Get("Location")
		locURL, err := url.Parse(loc)
		if err != nil {
			t.Fatal(err)
		}

		wantPrefix := handler.providers[tc.provider].config.Endpoint.AuthURL
		if !strings.HasPrefix(loc, wantPrefix) {
			t.Fatalf("test %q: bad location prefix: location: %q, want prefix: %q", tc.desc, loc, wantPrefix)
		}

		state := locURL.Query().Get("state")
		if state == "" {
			t.Fatalf("test %q: empty location state: %q", tc.desc, state)
		}

		redirectURI := locURL.Query().Get("redirect_uri")
		wantRedirectURI := handler.providers[tc.provider].config.RedirectURL
		if redirectURI != wantRedirectURI {
			t.Fatalf("test %q: bad location redirect URI: want %q got %q", tc.desc, wantRedirectURI, redirectURI)
		}
	}
}


text:
(function() {
  'use strict';

  var _ = require('lodash');
  var stringify = require('json-stable-stringify');

  function Utils() {
  }

  Utils.prototype.customStringify = function(val, options) {
    if (options) {
      return stringify(val, _.isObject(options) ? options : {
        space: '    ',
        cmp: function (a, b) {
          var lower = function (a) {
            return a.toLowerCase();
          };
          return lower(a.key) < lower(b.key) ? -1 : 1;
        }
      });
    }
    return JSON.stringify(val, null, 4);
  };

  module.exports = Utils;
}());


text:
package org.apache.jackrabbit.test.api;

import org.apache.jackrabbit.test.AbstractJCRTest;
import org.apache.jackrabbit.test.NotExecutableException;

import javax.jcr.NamespaceRegistry;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.RepositoryException;
import javax.jcr.NamespaceException;
import java.util.Set;
import java.util.HashSet;
import java.util.Arrays;

/**
 * NamespaceRegistryReadMethodsTest This class tests read method of the
 * NamespaceRegistry class and also the correct Exception throwing for methods
 * not supported in level 1.
 *
 * @test
 * @sources NamespaceRegistryReadMethodsTest.java
 * @executeClass org.apache.jackrabbit.test.api.NamespaceRegistryReadMethodsTest
 * @keywords level1
 */
public class NamespaceRegistryReadMethodsTest extends AbstractJCRTest {

    /** The built in namespace prefixes */
    private static final String[] BUILTIN_PREFIXES = {"jcr", "nt", "mix", "sv", ""};

    /** The built in namespace uris */
    private static final String[] BUILTIN_URIS = {NS_JCR_URI, NS_NT_URI, NS_MIX_URI, NS_SV_URI, ""};

    /** The NamespaceRegistry of the repository */
    private NamespaceRegistry nsr;

    /** A read-only session */
    private Session session;

    public void setUp() throws Exception {
        isReadOnly = true;
        super.setUp();
        session = getHelper().getReadOnlySession();
        Workspace ws = session.getWorkspace();
        nsr = ws.getNamespaceRegistry();
    }

    /**
     * Releases the session aquired in {@link #setUp()}.
     */
    protected void tearDown() throws Exception {
        if (session != null) {
            session.logout();
            session = null;
        }
        nsr = null;
        super.tearDown();
    }

    /**
     * Tests if {@link javax.jcr.NamespaceRegistry#getPrefixes()} returns the
     * required namespace prefixes and if they are mapped to the correct URIs.
     */
    public void testGetNamespacePrefixes() throws RepositoryException {
        Set<String> prefixes = new HashSet<String>();
        prefixes.addAll(Arrays.asList(nsr.getPrefixes()));
        for (int i = 0; i < BUILTIN_PREFIXES.length; i++) {
            String prefix = BUILTIN_PREFIXES[i];
            assertTrue("NamespaceRegistry does not contain built in prefix: " + prefix, prefixes.contains(prefix));
            String uri = nsr.getURI(prefix);
            assertEquals("Wrong namespace mapping for prefix: " + prefix, BUILTIN_URIS[i], uri);
        }
    }

    /**
     * Tests if {@link javax.jcr.NamespaceRegistry#getURIs()} returns the
     * required namespace URIs and if they are mapped to the correct prefixes.
     */
    public void testGetNamespaceURIs() throws RepositoryException {
        Set<String> uris = new HashSet<String>();
        uris.addAll(Arrays.asList(nsr.getURIs()));
        for (int i = 0; i < BUILTIN_URIS.length; i++) {
            String uri = BUILTIN_URIS[i];
            assertTrue("NamespaceRegistry does not contain built in uri: " + uri, uris.contains(uri));
            String prefix = nsr.getPrefix(uri);
            assertEquals("Wrong namespace mapping for uri: " + uri, BUILTIN_PREFIXES[i], prefix);
        }
    }

    /**
     * Tests if a {@link javax.jcr.NamespaceException} is thrown when
     * {@link javax.jcr.NamespaceRegistry#getURI(String)} is called for an
     * unknown prefix.
     */
    public void testGetURINamespaceException() throws RepositoryException, NotExecutableException {
        Set<String> prefixes = new HashSet<String>();
        prefixes.addAll(Arrays.asList(nsr.getPrefixes()));
        String prefix = "myapp";
        int count = 0;
        while (prefixes.contains(prefix + count)) {
            count++;
        }
        String testPrefix = prefix + count;
        try {
            nsr.getURI(testPrefix);
            fail("NamespaceRegistry.getURI should throw a NamespaceException " +
                    "in case of an unmapped prefix.");
        } catch (NamespaceException nse) {
            //ok
        }
    }

    /**
     * Tests if a {@link javax.jcr.NamespaceException} is thrown when
     * {@link javax.jcr.NamespaceRegistry#getPrefix(String)} is called for an
     * unknown URI.
     */
    public void testGetPrefixNamespaceException() throws RepositoryException, NotExecutableException {
        Set<String> uris = new HashSet<String>();
        uris.addAll(Arrays.asList(nsr.getURIs()));
        String uri = "http://www.unknown-company.com/namespace";
        int count = 0;
        while (uris.contains(uri + count)) {
            count++;
        }
        String testURI = uri + count;
        try {
            nsr.getPrefix(testURI);
            fail("NamespaceRegistry.getPrefix should throw a NamespaceException " +
                    "in case of an unregistered URI.");
        } catch (NamespaceException nse) {
            //ok
        }
    }

}


text:
module ActiveRecord #:nodoc:
  module Acts #:nodoc:
    module Loggable #:nodoc:
      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        def acts_as_loggable(*conditions)
          has_many :action_logs, :as => :loggable, :order => 'action_logs.created_at desc'
          send :include, ActiveRecord::Acts::Loggable::InstanceMethods
          conditions = extract_conditions(conditions)
          do_logging(conditions)
        end

        private
          def do_logging(conditions)
            actions = set_actions(conditions)
            actions.each do |action|
              send("before_#{action}") { |record| record.log_action(:action => action.humanize) }
            end
          end

          def extract_conditions(*conditions)
            return if conditions.empty?
            conditions.flatten!
            conditions = conditions.respond_to?(:extract_options!) ? conditions.extract_options! : (conditions.last.is_a?(::Hash) ? conditions.pop : {}) # apparently rails v. 1.2.6 doesn't have the extract_options! method, so this little workaround does it
            conditions
          end

          def humanize(word)
            word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
          end

          def set_actions(conditions)
            actions = %w( create update destroy )
            if conditions[:except]
              conditions[:except].each { |condition| actions.delete("#{condition}") }
            elsif conditions[:only]
              actions = conditions[:only].map(&:to_s)
            end
            return actions
          end
      end #ClassMethods

      module InstanceMethods
        def log_action(attributes = {})
          if User.current_user
            attributes.assert_valid_keys(:action, :description, :loggable_before_changes, :loggable_after_changes)
            attributes.merge!(:user => User.current_user)
            record = self.action_logs.build(attributes)
          end
        end
      end #InstanceMethods
    end #Loggable
  end #Acts
end #ActiveRecord
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Loggable)


text:
<?php

namespace Prophecy\Argument\Token;

/**
 * Approximate value token
 *
 * @author Daniel Leech <daniel@dantleech.com>
 */
class ApproximateValueToken implements TokenInterface
{
    private $value;
    private $precision;

    public function __construct($value, $precision = 0)
    {
        $this->value = $value;
        $this->precision = $precision;
    }

    /**
     * {@inheritdoc}
     */
    public function scoreArgument($argument)
    {
        return round($argument, $this->precision) === round($this->value, $this->precision) ? 10 : false;
    }

    /**
     * {@inheritdoc}
     */
    public function isLast()
    {
        return false;
    }

    /**
     * Returns string representation for token.
     *
     * @return string
     */
    public function __toString()
    {
        return sprintf('≅%s', round($this->value, $this->precision));
    }
}


text:
title: How Do I Install Discourse?
weight: 400
---

Simple 30 minute basic install:
[**Beginner Docker install guide**][basic]

Powerful, flexible, large or multiple server install:
[**Advanced Docker install guide**][advanced]

The only officially supported installs of Discourse are the [Docker](https://www.docker.io/) based beginner and advanced installs. We regret that we cannot support any other methods of installation.

### Why do you only officially support Docker?

Hosting Rails applications is complicated. Even if you already have Postgres, Redis and Ruby installed on your server, you still need to worry about running and monitoring your Sidekiq and Rails processes. Additionally, our Docker install comes bundled with a web-based GUI that makes upgrading to new versions of Discourse as easy as clicking a button.

### Hardware Requirements

- Dual core CPU recommended
- 1 GB RAM minimum (with [swap][swap])
- 64 bit Linux compatible with Docker

### Software Requirements

- [Postgres 9.3+](http://www.postgresql.org/download/)
- [Redis 2.6+](http://redis.io/download)
- [Ruby 2.0+](http://www.ruby-lang.org/en/downloads/) (we recommend 2.0.0-p353 or higher)

## Security

We take security very seriously at Discourse, and all our code is 100% open source and peer reviewed. Please read [our security guide](https://github.com/discourse/discourse/blob/master/docs/SECURITY.md) for an overview of security measures in Discourse.

[basic]: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
[advanced]: https://github.com/discourse/discourse_docker
[swap]: https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880

<small class="documentation-source">Source: [https://github.com/discourse/discourse/blob/master/docs/INSTALL.md](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md)</small>


text:
package de.vandermeer.skb.commons.utils;

import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import de.vandermeer.skb.commons.collections.Tree;

/**
 * A Portable Database Object.
 *
 * @author     Sven van der Meer <vdmeer.sven@mykolab.com>
 * @version    v0.0.4 build 150701 (01-Jul-15) for Java 1.8
 */
public interface PDO {
	/**
	 * Clears all warnings.
	 * @throws SQLException from library call
	 */
	public void clearWarnings() throws SQLException;

	/**
	 * Closes the local connection.
	 * Connections are: the connection to the database, the result set and the statement.
	 * @throws SQLException from library call
	 */
	public void close() throws SQLException;

	/**
	 * Calls commit on the database.
	 * @throws SQLException from library call
	 */
	public void commit() throws SQLException;

	/**
	 * Creates an SQL statement.
	 * @return new statement
	 * @throws SQLException from library call
	 */
	public Statement createStatement() throws SQLException;

	/**
	 * Creates an SQL statement.
	 * @param resultSetType
	 * @param resultSetConcurrency
	 * @return new statement
	 * @throws SQLException
	 */
	public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException;

	/**
	 * Creates an SQL statement.
	 * @param resultSetType
	 * @param resultSetConcurrency
	 * @param resultSetHoldability
	 * @return new statement
	 * @throws SQLException
	 */
	public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException;

	/**
	 * Returns columns of a result set by parsing the meta data.
	 * @return detected columns
	 */
	public ArrayList<String> getColumns();

	/**
	 * Returns SQL metadata
	 * @return metadata
	 * @throws SQLException
	 */
	public DatabaseMetaData getMetaData() throws SQLException;

	/**
	 * Queries the database.
	 * @param sel select parameters
	 * @param table table to query
	 * @param whe where parameter
	 * @param ord order parameter
	 * @return query result
	 */
	public ResultSet query(ArrayList<String> sel, String table, String whe, String ord);

	/**
	 * Queries the database.
	 * @param sel select parameter
	 * @param table table to query
	 * @param whe where parameter
	 * @param ord order parameter
	 * @return query result
	 */
	public ResultSet query(String sel, String table, String whe, String ord);

	//TODO explain the semantic query!
	/**
	 * Issues a semantic query, with specialised parameters.
	 * @param query query object
	 * @param from
	 * @return results of the query
	 */
	public Tree<Object> semanticQuery(Tree<Object> query, String from);

	/**
	 *
	 * @return
	 */
	public PDO getCopy();
}


text:
// Type definitions for idyll 2.10
// Project: https://github.com/idyll-lang/idyll/tree/master/packages/idyll-cli
// Definitions by: Thanh Ngo <https://github.com/iocat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import { EventEmitter } from "events";
import { Options as CompilerOptions } from "idyll-compiler";

interface Options {
    /**
     * Monitor input files and rebuild on changes
     */
    watch?: boolean;
    /**
     * The datasets directory
     */
    datasets?: string;
    /**
     * Whether to minify output build
     */
    minify?: boolean;
    /**
     *
     * Pre-render HTML as part of the build
     */
    ssr?: boolean;
    /**
     * The components directory
     */
    components?: boolean;
    /**
     * The default component directory
     * This corresponds to where the idyll-components package stays
     */
    defaultComponents?: boolean;
    /**
     * The layout defined in idyll-layouts package
     */
    layout?: string;
    /**
     * The theme defined in idyll-theme package
     */
    theme?: string;
    /**
     * The output directory for compiled documents
     */
    output?: string;
    /**
     * Custom port to bind the local server to.
     */
    port?: number;
    /**
     * Temporary directory used by idyll
     */
    temp?: string;
    /**
     * path to HTML template
     *
     */
    template?: string;

    /**
     * Custom CSS file to include in output
     */
    css?: string;
    /**
     * Custom browserify transforms to apply.
     */
    transform?: string[];
    /**
     * Compiler options
     */
    compiler?: CompilerOptions;
    /**
     * the idyll file to be compiled into
     */
    inputFile?: string;

    /**
     * used internally by IdyllInstance
     */
    inputConfig?: {
        components: any;
        transform: any[];
        compiler: CompilerOptions;
    };
}

type PredefinedFile =
    | "APP_PATH"
    | "CSS_INPUT_FILE"
    | "DATA_DIR"
    | "HTML_TEMPLATE_FILE"
    | "IDYLL_INPUT_FILE"
    | "INPUT_DIR"
    | "PACKAGE_FILE"
    | "OUTPUT_DIR"
    | "TMP_DIR"
    | "CSS_OUTPUT_FILE"
    | "HTML_OUTPUT_FILE"
    | "JS_OUTPUT_FILE";

type ComponentFiles = "COMPONENT_DIRS" | "DEFAULT_COMPONENT_DIRS";

type Paths = Record<PredefinedFile, string> & Record<ComponentFiles, string[]>;

declare class IdyllInstance extends EventEmitter {
    /**
     * Returns internal paths used by idyll-cli
     */
    getPaths(): Paths;
    /**
     * Returns idyll compiling's options
     */
    getOptions(): Options;
    /**
     *
     * if indexIdyllMarkup is provided, compiles it
     *
     * Otherwise, compiles and optionally watches
     * the idyll file at IOptions.inputFile
     *
     */
    build(indexIdyllMarkup?: string | null): this;
}

declare function idyll(options: Options, callback?: () => void): IdyllInstance;

export = idyll;


text:
goog.provide('fireauth.storage.AsyncStorage');

goog.require('fireauth.AuthError');
goog.require('fireauth.authenum.Error');
goog.require('fireauth.storage.Storage');
goog.require('fireauth.util');
goog.require('goog.Promise');

/**
 * AsyncStorage provides an interface to the React Native AsyncStorage API.
 * @param {!Object=} opt_asyncStorage The AsyncStorage API. If not provided
 *     this method will attempt to fetch an implementation from
 *     firebase.INTERNAL.reactNative.
 * @constructor
 * @implements {fireauth.storage.Storage}
 * @see https://facebook.github.io/react-native/docs/asyncstorage.html
 */
fireauth.storage.AsyncStorage = function(opt_asyncStorage) {
  /**
   * The underlying storage instance for persistent data.
   * @private
   */
  this.storage_ =
      opt_asyncStorage || (firebase.INTERNAL['reactNative'] &&
                           firebase.INTERNAL['reactNative']['AsyncStorage']);

  if (!this.storage_) {
    throw new fireauth.AuthError(fireauth.authenum.Error.INTERNAL_ERROR,
        'The React Native compatibility library was not found.');
  }
};

/**
 * Retrieves the value stored at the key.
 * @param {string} key
 * @return {!goog.Promise<*>}
 * @override
 */
fireauth.storage.AsyncStorage.prototype.get = function(key) {
  return goog.Promise.resolve(this.storage_['getItem'](key))
      .then(function(val) {
        return val && fireauth.util.parseJSON(val);
      });
};

/**
 * Stores the value at the specified key.
 * @param {string} key
 * @param {*} value
 * @return {!goog.Promise<void>}
 * @override
 */
fireauth.storage.AsyncStorage.prototype.set = function(key, value) {
  return goog.Promise.resolve(
      this.storage_['setItem'](key, fireauth.util.stringifyJSON(value)));
};

/**
 * Removes the value at the specified key.
 * @param {string} key
 * @return {!goog.Promise<void>}
 * @override
 */
fireauth.storage.AsyncStorage.prototype.remove = function(key) {
  return goog.Promise.resolve(this.storage_['removeItem'](key));
};

/**
 * Does nothing. AsyncStorage does not support storage events,
 * @param {function(!goog.events.BrowserEvent)} listener The storage event
 *     listener.
 * @override
 */
fireauth.storage.AsyncStorage.prototype.addStorageListener = function(
    listener) {};

/**
 * Does nothing. AsyncStorage does not support storage events,
 * @param {function(!goog.events.BrowserEvent)} listener The storage event
 *     listener.
 * @override
 */
fireauth.storage.AsyncStorage.prototype.removeStorageListener = function(
    listener) {};


text:
openinfoman-anon
================

XQuery Libary for anonymization using CSD

It makes use of the OpenInfoMan software https://github.com/openhie/openinfoman

Ubuntu Installation
===================
You can easily install on Ubuntu 14.04 and Ubuntu 14.10 using the following commands
<pre>
sudo add-apt-repository ppa:openhie/release
sudo apt-get update
sudo apt-get install openinfoman-anon
</pre>

Once installed, you should be able to access OpenInfoMan at:
> http://localhost:8984/CSD


text:
module Harvest
  class ExpenseCategory < BaseModel
    include HappyMapper

    tag 'expense-category'
    api_path '/expense_categories'

    element :id, Integer
    element :name, String
    element :unit_name, String, :tag => 'unit-name'
    element :unit_price, Float, :tag => 'unit-price'
    element :deactivated, Boolean

    def active?
      !deactivated
    end
  end
end


text:
package com.siyeh.igtest.threading;

public class FieldAccessedSynchronizedAndUnsynchronized
{
    private final Object m_lock = new Object();
    private Object m_contents = new Object();

    public void foo()
    {
        synchronized(m_lock)
        {
            m_contents = new Object();
        }
        getContents();
    }

    private Object getContents()
    {
        getContents2();
        return m_contents;
    }

    private void getContents2() {
        getContents();
    }

}


text:
rm -fr dist
cp setup.py  mltoolbox/_structured_data/master_setup.py
python setup.py sdist


text:
System.config({
    baseURL: '/base',
    paths: {
        'npm:': 'node_modules/'
    },
    map: {
        '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
        '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
        '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
        '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
        '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
        '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
        '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
        '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
        '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
        '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
        '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
        'rxjs': 'npm:rxjs',
    },
    packages: {
        '': {defaultExtension: 'js'},
        rxjs: {defaultExtension: 'js'}
    }
});

(function() {
    var originalKarmaLoaded = window.__karma__.loaded.bind(window.__karma__);
    window.__karma__.loaded = function() {};

    document.addEventListener('WebComponentsReady', function () {
        System.import('index.spec')
            .then(function () {
                return Promise.all([
                    System.import('@angular/core/testing'),
                    System.import('@angular/platform-browser-dynamic/testing')
                ]).then(function (providers) {
                    var testing = providers[0];
                    var testingBrowser = providers[1];

                    testing.TestBed.initTestEnvironment(
                        testingBrowser.BrowserDynamicTestingModule,
                        testingBrowser.platformBrowserDynamicTesting());
                });
            })
            .then(originalKarmaLoaded)
            .catch(console.error.bind(console));
    });
})();


text:
package com.hubspot.jinjava.el.ext;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;

import com.hubspot.jinjava.Jinjava;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
import java.util.Collection;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;

@SuppressWarnings("unchecked")
public class AdditionOperatorTest {
  private JinjavaInterpreter interpreter;

  @Before
  public void setup() {
    interpreter = new Jinjava().newInterpreter();
  }

  @Test
  public void itConcatsStrings() {
    assertThat(interpreter.resolveELExpression("'foo' + 'bar'", -1)).isEqualTo("foobar");
  }

  @Test
  public void itAddsNumbers() {
    assertThat(interpreter.resolveELExpression("1 + 2", -1)).isEqualTo(3L);
  }

  @Test
  public void itConcatsNumberWithString() {
    assertThat(interpreter.resolveELExpression("'1' + 2", -1)).isEqualTo("12");
    assertThat(interpreter.resolveELExpression("1 + '2'", -1)).isEqualTo("12");
  }

  @Test
  public void itCombinesTwoLists() {
    assertThat(
        (Collection<Object>) interpreter.resolveELExpression(
          "['foo', 'bar'] + ['other', 'one']",
          -1
        )
      )
      .containsExactly("foo", "bar", "other", "one");
  }

  @Test
  public void itAddsToList() {
    assertThat(
        (Collection<Object>) interpreter.resolveELExpression("['foo'] + 'bar'", -1)
      )
      .containsExactly("foo", "bar");
  }

  @Test
  public void itCombinesTwoDicts() {
    assertThat(
        (Map<Object, Object>) interpreter.resolveELExpression(
          "{'k1':'v1'} + {'k2':'v2'}",
          -1
        )
      )
      .containsOnly(entry("k1", "v1"), entry("k2", "v2"));
  }
}


text:
#include <stdio.h>  /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"

/* All that's needed is to get the high 53 bits of the quotient num/den,
   rounded towards zero.  More than 53 bits is fine, any excess is ignored
   by mpn_get_d.

   N_QLIMBS is how many quotient limbs we need to satisfy the mantissa of a
   double, assuming the highest of those limbs is non-zero.  The target
   qsize for mpn_tdiv_qr is then 1 more than this, since that function may
   give a zero in the high limb (and non-zero in the second highest).

   The use of 8*sizeof(double) in N_QLIMBS is an overestimate of the
   mantissa bits, but it gets the same result as the true value (53 or 48 or
   whatever) when rounded up to a multiple of GMP_NUMB_BITS, for non-nails.

   Enhancements:

   Use the true mantissa size in the N_QLIMBS formula, to save a divide step
   in nails.

   Examine the high limbs of num and den to see if the highest 1 bit of the
   quotient will fall high enough that just N_QLIMBS-1 limbs is enough to
   get the necessary bits, thereby saving a division step.

   Bit shift either num or den to arrange for the above condition on the
   high 1 bit of the quotient, to save a division step always.  A shift to
   save a division step is definitely worthwhile with mpn_tdiv_qr, though we
   may want to reassess this on big num/den when a quotient-only division
   exists.

   Maybe we could estimate the final exponent using nsize-dsize (and
   possibly the high limbs of num and den), so as to detect overflow and
   return infinity or zero quickly.  Overflow is never very helpful to an
   application, and can therefore probably be regarded as abnormal, but we
   may still like to optimize it if the conditions are easy.  (This would
   only be for float formats we know, unknown formats are not important and
   can be left to mpn_get_d.)

   Future:

   If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of
   padding n with zeros in temporary space.

   If/when a quotient-only division exists it can be used here immediately.
   remp is only to satisfy mpn_tdiv_qr, the remainder is not used.

   Alternatives:

   An alternative algorithm, that may be faster:
   0. Let n be somewhat larger than the number of significant bits in a double.
   1. Extract the most significant n bits of the denominator, and an equal
      number of bits from the numerator.
   2. Interpret the extracted numbers as integers, call them a and b
      respectively, and develop n bits of the fractions ((a + 1) / b) and
      (a / (b + 1)) using mpn_divrem.
   3. If the computed values are identical UP TO THE POSITION WE CARE ABOUT,
      we are done.  If they are different, repeat the algorithm from step 1,
      but first let n = n * 2.
   4. If we end up using all bits from the numerator and denominator, fall
      back to a plain division.
   5. Just to make life harder, The computation of a + 1 and b + 1 above
      might give carry-out...  Needs special handling.  It might work to
      subtract 1 in both cases instead.

   Not certain if this approach would be faster than a quotient-only
   division.  Presumably such optimizations are the sort of thing we would
   like to have helping everywhere that uses a quotient-only division. */

double
mpq_get_d (mpq_srcptr src)
{
  double res;
  mp_srcptr np, dp;
  mp_ptr remp, tp;
  mp_size_t nsize = SIZ(NUM(src));
  mp_size_t dsize = SIZ(DEN(src));
  mp_size_t qsize, prospective_qsize, zeros, chop, tsize;
  mp_size_t sign_quotient = nsize;
  long exp;
#define N_QLIMBS (1 + (sizeof (double) + GMP_LIMB_BYTES-1) / GMP_LIMB_BYTES)
  mp_limb_t qarr[N_QLIMBS + 1];
  mp_ptr qp = qarr;
  TMP_DECL;

  ASSERT (dsize > 0);    /* canonical src */

  /* mpn_get_d below requires a non-zero operand */
  if (UNLIKELY (nsize == 0))
    return 0.0;

  TMP_MARK;
  nsize = ABS (nsize);
  dsize = ABS (dsize);
  np = PTR(NUM(src));
  dp = PTR(DEN(src));

  prospective_qsize = nsize - dsize + 1;   /* from using given n,d */
  qsize = N_QLIMBS + 1;                    /* desired qsize */

  zeros = qsize - prospective_qsize;       /* padding n to get qsize */
  exp = (long) -zeros * GMP_NUMB_BITS;     /* relative to low of qp */

  chop = MAX (-zeros, 0);                  /* negative zeros means shorten n */
  np += chop;
  nsize -= chop;
  zeros += chop;                           /* now zeros >= 0 */

  tsize = nsize + zeros;                   /* size for possible copy of n */

  if (WANT_TMP_DEBUG)
    {
      /* separate blocks, for malloc debugging */
      remp = TMP_ALLOC_LIMBS (dsize);
      tp = (zeros > 0 ? TMP_ALLOC_LIMBS (tsize) : NULL);
    }
  else
    {
      /* one block with conditionalized size, for efficiency */
      remp = TMP_ALLOC_LIMBS (dsize + (zeros > 0 ? tsize : 0));
      tp = remp + dsize;
    }

  /* zero extend n into temporary space, if necessary */
  if (zeros > 0)
    {
      MPN_ZERO (tp, zeros);
      MPN_COPY (tp+zeros, np, nsize);
      np = tp;
      nsize = tsize;
    }

  ASSERT (qsize == nsize - dsize + 1);
  mpn_tdiv_qr (qp, remp, (mp_size_t) 0, np, nsize, dp, dsize);

  /* strip possible zero high limb */
  qsize -= (qp[qsize-1] == 0);

  res = mpn_get_d (qp, qsize, sign_quotient, exp);
  TMP_FREE;
  return res;
}


text:
package migrations

import "github.com/BurntSushi/migration"

func DropOldLocks(tx migration.LimitedTx) error {
	_, err := tx.Exec(`DROP TABLE resource_checking_lock`)
	if err != nil {
		return err
	}

	_, err = tx.Exec(`DROP TABLE build_scheduling_lock`)
	if err != nil {
		return err
	}

	return nil
}


text:
#include <pcl/point_types.h>
#include <pcl/common/io.h>

//////////////////////////////////////////////////////////////////////////
void
getFieldsSizes (const std::vector<pcl::PCLPointField> &fields,
                std::vector<int> &fields_sizes)
{
  int valid = 0;
  fields_sizes.resize (fields.size ());
  for (size_t i = 0; i < fields.size (); ++i)
  {
    if (fields[i].name == "_")
      continue;

    int fs = fields[i].count * pcl::getFieldSize (fields[i].datatype);
    fields_sizes[i] = fs;
    valid++;
  }
  fields_sizes.resize (valid);
}

bool fieldComp (const pcl::PCLPointField* i, const pcl::PCLPointField* j)
{
  return i->offset < j->offset;
}

//////////////////////////////////////////////////////////////////////////
bool
pcl::concatenateFields (const pcl::PCLPointCloud2 &cloud1,
                        const pcl::PCLPointCloud2 &cloud2,
                        pcl::PCLPointCloud2 &cloud_out)
{
  // If the cloud's sizes differ (points wise), then exit with error
  if (cloud1.width != cloud2.width || cloud1.height != cloud2.height)
  {
    PCL_ERROR ("[pcl::concatenateFields] Dimensions of input clouds do not match: cloud1 (w, %d, h, %d), cloud2 (w, %d, h, %d)\n", cloud1.width, cloud1.height, cloud2.width, cloud2.height );
    return (false);
  }

  if (cloud1.is_bigendian != cloud2.is_bigendian)
  {
    PCL_ERROR ("[pcl::concatenateFields] Endianness of clouds does not match\n");
    return (false);
  }

  // Else, copy the second cloud (width, height, header stay the same)
  // we do this since fields from the second cloud are supposed to overwrite
  // those of the first
  cloud_out.header = cloud2.header;
  cloud_out.fields = cloud2.fields;
  cloud_out.width = cloud2.width;
  cloud_out.height = cloud2.height;
  cloud_out.is_bigendian = cloud2.is_bigendian;

  //We need to find how many fields overlap between the two clouds
  size_t total_fields = cloud2.fields.size ();

  //for the non-matching fields in cloud1, we need to store the offset
  //from the beginning of the point
  std::vector<const pcl::PCLPointField*> cloud1_unique_fields;
  std::vector<int> field_sizes;

  //We need to make sure that the fields for cloud 1 are sorted
  //by offset so that we can compute sizes correctly. There is no
  //guarantee that the fields are in the correct order when they come in
  std::vector<const pcl::PCLPointField*> cloud1_fields_sorted;
  for (size_t i = 0; i < cloud1.fields.size (); ++i)
    cloud1_fields_sorted.push_back (&(cloud1.fields[i]));

  std::sort (cloud1_fields_sorted.begin (), cloud1_fields_sorted.end (), fieldComp);

  for (size_t i = 0; i < cloud1_fields_sorted.size (); ++i)
  {
    bool match = false;
    for (size_t j = 0; j < cloud2.fields.size (); ++j)
    {
      if (cloud1_fields_sorted[i]->name == cloud2.fields[j].name)
        match = true;
    }

    //if the field is new, we'll increment out total fields
    if (!match && cloud1_fields_sorted[i]->name != "_")
    {
      cloud1_unique_fields.push_back (cloud1_fields_sorted[i]);

      int size = 0;
      size_t next_valid_field = i + 1;

      while (next_valid_field < cloud1_fields_sorted.size())
      {
        if (cloud1_fields_sorted[next_valid_field]->name != "_")
          break;
        next_valid_field++;
      }

      if (next_valid_field < cloud1_fields_sorted.size ())
        //compute the true size of the field, including padding
        size = cloud1_fields_sorted[next_valid_field]->offset - cloud1_fields_sorted[i]->offset;
      else
        //for the last point, we'll just use the point step to compute the size
        size = cloud1.point_step - cloud1_fields_sorted[i]->offset;

      field_sizes.push_back (size);

      total_fields++;
    }
  }

  //we need to compute the size of the additional data added from cloud 1
  uint32_t cloud1_unique_point_step = 0;
  for (size_t i = 0; i < cloud1_unique_fields.size (); ++i)
    cloud1_unique_point_step += field_sizes[i];

  //the total size of extra data should be the size of data per point
  //multiplied by the total number of points in the cloud
  uint32_t cloud1_unique_data_size = cloud1_unique_point_step * cloud1.width * cloud1.height;

  // Point step must increase with the length of each matching field
  cloud_out.point_step = cloud2.point_step + cloud1_unique_point_step;
  // Recalculate row_step
  cloud_out.row_step = cloud_out.point_step * cloud_out.width;

  // Resize data to hold all clouds
  cloud_out.data.resize (cloud2.data.size () + cloud1_unique_data_size);

  // Concatenate fields
  cloud_out.fields.resize (cloud2.fields.size () + cloud1_unique_fields.size ());
  int offset = cloud2.point_step;

  for (size_t d = 0; d < cloud1_unique_fields.size (); ++d)
  {
    const pcl::PCLPointField& f = *cloud1_unique_fields[d];
    cloud_out.fields[cloud2.fields.size () + d].name = f.name;
    cloud_out.fields[cloud2.fields.size () + d].datatype = f.datatype;
    cloud_out.fields[cloud2.fields.size () + d].count = f.count;
    // Adjust the offset
    cloud_out.fields[cloud2.fields.size () + d].offset = offset;
    offset += field_sizes[d];
  }

  // Iterate over each point and perform the appropriate memcpys
  int point_offset = 0;
  for (size_t cp = 0; cp < cloud_out.width * cloud_out.height; ++cp)
  {
    memcpy (&cloud_out.data[point_offset], &cloud2.data[cp * cloud2.point_step], cloud2.point_step);
    int field_offset = cloud2.point_step;

    // Copy each individual point, we have to do this on a per-field basis
    // since some fields are not unique
    for (size_t i = 0; i < cloud1_unique_fields.size (); ++i)
    {
      const pcl::PCLPointField& f = *cloud1_unique_fields[i];
      int local_data_size = f.count * pcl::getFieldSize (f.datatype);
      int padding_size = field_sizes[i] - local_data_size;

      memcpy (&cloud_out.data[point_offset + field_offset], &cloud1.data[cp * cloud1.point_step + f.offset], local_data_size);
      field_offset +=  local_data_size;

      //make sure that we add padding when its needed
      if (padding_size > 0)
        memset (&cloud_out.data[point_offset + field_offset], 0, padding_size);
      field_offset += padding_size;
    }
    point_offset += field_offset;
  }

  if (!cloud1.is_dense || !cloud2.is_dense)
    cloud_out.is_dense = false;
  else
    cloud_out.is_dense = true;

  return (true);
}

//////////////////////////////////////////////////////////////////////////
bool
pcl::concatenatePointCloud (const pcl::PCLPointCloud2 &cloud1,
                            const pcl::PCLPointCloud2 &cloud2,
                            pcl::PCLPointCloud2 &cloud_out)
{
  //if one input cloud has no points, but the other input does, just return the cloud with points
  if (cloud1.width*cloud1.height == 0 && cloud2.width*cloud2.height > 0)
  {
    cloud_out = cloud2;
    return (true);
  }
  else if (cloud1.width*cloud1.height > 0 && cloud2.width*cloud2.height == 0)
  {
    cloud_out = cloud1;
    return (true);
  }

  bool strip = false;
  for (size_t i = 0; i < cloud1.fields.size (); ++i)
    if (cloud1.fields[i].name == "_")
      strip = true;

  for (size_t i = 0; i < cloud2.fields.size (); ++i)
    if (cloud2.fields[i].name == "_")
      strip = true;

  if (!strip && cloud1.fields.size () != cloud2.fields.size ())
  {
    PCL_ERROR ("[pcl::concatenatePointCloud] Number of fields in cloud1 (%u) != Number of fields in cloud2 (%u)\n", cloud1.fields.size (), cloud2.fields.size ());
    return (false);
  }

  // Copy cloud1 into cloud_out
  cloud_out = cloud1;
  size_t nrpts = cloud_out.data.size ();
  // Height = 1 => no more organized
  cloud_out.width    = cloud1.width * cloud1.height + cloud2.width * cloud2.height;
  cloud_out.height   = 1;
  if (!cloud1.is_dense || !cloud2.is_dense)
    cloud_out.is_dense = false;
  else
    cloud_out.is_dense = true;

  // We need to strip the extra padding fields
  if (strip)
  {
    // Get the field sizes for the second cloud
    std::vector<pcl::PCLPointField> fields2;
    std::vector<int> fields2_sizes;
    for (size_t j = 0; j < cloud2.fields.size (); ++j)
    {
      if (cloud2.fields[j].name == "_")
        continue;

      fields2_sizes.push_back (cloud2.fields[j].count *
                               pcl::getFieldSize (cloud2.fields[j].datatype));
      fields2.push_back (cloud2.fields[j]);
    }

    cloud_out.data.resize (nrpts + (cloud2.width * cloud2.height) * cloud_out.point_step);

    // Copy the second cloud
    for (size_t cp = 0; cp < cloud2.width * cloud2.height; ++cp)
    {
      int i = 0;
      for (size_t j = 0; j < fields2.size (); ++j)
      {
        if (cloud1.fields[i].name == "_")
        {
          ++i;
          continue;
        }

        // We're fine with the special RGB vs RGBA use case
        if ((cloud1.fields[i].name == "rgb" && fields2[j].name == "rgba") ||
            (cloud1.fields[i].name == "rgba" && fields2[j].name == "rgb") ||
            (cloud1.fields[i].name == fields2[j].name))
        {
          memcpy (reinterpret_cast<char*> (&cloud_out.data[nrpts + cp * cloud1.point_step + cloud1.fields[i].offset]),
                  reinterpret_cast<const char*> (&cloud2.data[cp * cloud2.point_step + cloud2.fields[j].offset]),
                  fields2_sizes[j]);
          ++i;  // increment the field size i
        }
      }
    }
  }
  else
  {
    for (size_t i = 0; i < cloud1.fields.size (); ++i)
    {
      // We're fine with the special RGB vs RGBA use case
      if ((cloud1.fields[i].name == "rgb" && cloud2.fields[i].name == "rgba") ||
          (cloud1.fields[i].name == "rgba" && cloud2.fields[i].name == "rgb"))
        continue;
      // Otherwise we need to make sure the names are the same
      if (cloud1.fields[i].name != cloud2.fields[i].name)
      {
        PCL_ERROR ("[pcl::concatenatePointCloud] Name of field %d in cloud1, %s, does not match name in cloud2, %s\n", i, cloud1.fields[i].name.c_str (), cloud2.fields[i].name.c_str ());
        return (false);
      }
    }

    cloud_out.data.resize (nrpts + cloud2.data.size ());
    memcpy (&cloud_out.data[nrpts], &cloud2.data[0], cloud2.data.size ());
  }
  return (true);
}

//////////////////////////////////////////////////////////////////////////
bool
pcl::getPointCloudAsEigen (const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out)
{
  // Get X-Y-Z indices
  int x_idx = getFieldIndex (in, "x");
  int y_idx = getFieldIndex (in, "y");
  int z_idx = getFieldIndex (in, "z");

  if (x_idx == -1 || y_idx == -1 || z_idx == -1)
  {
    PCL_ERROR ("Input dataset has no X-Y-Z coordinates! Cannot convert to Eigen format.\n");
    return (false);
  }

  if (in.fields[x_idx].datatype != pcl::PCLPointField::FLOAT32 ||
      in.fields[y_idx].datatype != pcl::PCLPointField::FLOAT32 ||
      in.fields[z_idx].datatype != pcl::PCLPointField::FLOAT32)
  {
    PCL_ERROR ("X-Y-Z coordinates not floats. Currently only floats are supported.\n");
    return (false);
  }

  size_t npts = in.width * in.height;
  out = Eigen::MatrixXf::Ones (4, npts);

  Eigen::Array4i xyz_offset (in.fields[x_idx].offset, in.fields[y_idx].offset, in.fields[z_idx].offset, 0);

  // Copy the input dataset into Eigen format
  for (size_t i = 0; i < npts; ++i)
  {
     // Unoptimized memcpys: assume fields x, y, z are in random order
     memcpy (&out (0, i), &in.data[xyz_offset[0]], sizeof (float));
     memcpy (&out (1, i), &in.data[xyz_offset[1]], sizeof (float));
     memcpy (&out (2, i), &in.data[xyz_offset[2]], sizeof (float));

     xyz_offset += in.point_step;
  }

  return (true);
}

//////////////////////////////////////////////////////////////////////////
bool
pcl::getEigenAsPointCloud (Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out)
{
  // Get X-Y-Z indices
  int x_idx = getFieldIndex (out, "x");
  int y_idx = getFieldIndex (out, "y");
  int z_idx = getFieldIndex (out, "z");

  if (x_idx == -1 || y_idx == -1 || z_idx == -1)
  {
    PCL_ERROR ("Output dataset has no X-Y-Z coordinates set up as fields! Cannot convert from Eigen format.\n");
    return (false);
  }

  if (out.fields[x_idx].datatype != pcl::PCLPointField::FLOAT32 ||
      out.fields[y_idx].datatype != pcl::PCLPointField::FLOAT32 ||
      out.fields[z_idx].datatype != pcl::PCLPointField::FLOAT32)
  {
    PCL_ERROR ("X-Y-Z coordinates not floats. Currently only floats are supported.\n");
    return (false);
  }

  if (in.cols () != static_cast<int>(out.width * out.height))
  {
    PCL_ERROR ("Number of points in the point cloud differs from the Eigen matrix. Cannot continue.\n");
    return (false);
  }

  size_t npts = in.cols ();

  Eigen::Array4i xyz_offset (out.fields[x_idx].offset, out.fields[y_idx].offset, out.fields[z_idx].offset, 0);

  // Copy the input dataset into Eigen format
  for (size_t i = 0; i < npts; ++i)
  {
     // Unoptimized memcpys: assume fields x, y, z are in random order
     memcpy (&out.data[xyz_offset[0]], &in (0, i), sizeof (float));
     memcpy (&out.data[xyz_offset[1]], &in (1, i), sizeof (float));
     memcpy (&out.data[xyz_offset[2]], &in (2, i), sizeof (float));

     xyz_offset += out.point_step;
  }

  return (true);
}

//////////////////////////////////////////////////////////////////////////
void
pcl::copyPointCloud (
    const pcl::PCLPointCloud2 &cloud_in,
    const std::vector<int> &indices,
    pcl::PCLPointCloud2 &cloud_out)
{
  cloud_out.header       = cloud_in.header;
  cloud_out.height       = 1;
  cloud_out.width        = static_cast<uint32_t> (indices.size ());
  cloud_out.fields       = cloud_in.fields;
  cloud_out.is_bigendian = cloud_in.is_bigendian;
  cloud_out.point_step   = cloud_in.point_step;
  cloud_out.row_step     = cloud_in.point_step * static_cast<uint32_t> (indices.size ());
  cloud_out.is_dense     = cloud_in.is_dense;

  cloud_out.data.resize (cloud_out.width * cloud_out.height * cloud_out.point_step);

  // Iterate over each point
  for (size_t i = 0; i < indices.size (); ++i)
    memcpy (&cloud_out.data[i * cloud_out.point_step], &cloud_in.data[indices[i] * cloud_in.point_step], cloud_in.point_step);
}

//////////////////////////////////////////////////////////////////////////
void
pcl::copyPointCloud (
    const pcl::PCLPointCloud2 &cloud_in,
    const std::vector<int, Eigen::aligned_allocator<int> > &indices,
    pcl::PCLPointCloud2 &cloud_out)
{
  cloud_out.header       = cloud_in.header;
  cloud_out.height       = 1;
  cloud_out.width        = static_cast<uint32_t> (indices.size ());
  cloud_out.fields       = cloud_in.fields;
  cloud_out.is_bigendian = cloud_in.is_bigendian;
  cloud_out.point_step   = cloud_in.point_step;
  cloud_out.row_step     = cloud_in.point_step * static_cast<uint32_t> (indices.size ());
  cloud_out.is_dense     = cloud_in.is_dense;

  cloud_out.data.resize (cloud_out.width * cloud_out.height * cloud_out.point_step);

  // Iterate over each point
  for (size_t i = 0; i < indices.size (); ++i)
    memcpy (&cloud_out.data[i * cloud_out.point_step], &cloud_in.data[indices[i] * cloud_in.point_step], cloud_in.point_step);
}

////////////////////////////////////////////////////////////////////////////////
void
pcl::copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
                     pcl::PCLPointCloud2 &cloud_out)
{
  cloud_out.header       = cloud_in.header;
  cloud_out.height       = cloud_in.height;
  cloud_out.width        = cloud_in.width;
  cloud_out.fields       = cloud_in.fields;
  cloud_out.is_bigendian = cloud_in.is_bigendian;
  cloud_out.point_step   = cloud_in.point_step;
  cloud_out.row_step     = cloud_in.row_step;
  cloud_out.is_dense     = cloud_in.is_dense;
  cloud_out.data         = cloud_in.data;
}

////////////////////////////////////////////////////////////////////////////////
int
pcl::interpolatePointIndex (int p, int len, InterpolationType type)
{
  if (static_cast<unsigned> (p) >= static_cast<unsigned> (len))
  {
    if (type == BORDER_REPLICATE)
      p = p < 0 ? 0 : len - 1;
    else if (type == BORDER_REFLECT || type == BORDER_REFLECT_101)
    {
      int delta = type == BORDER_REFLECT_101;
      if (len == 1)
        return 0;
      do
      {
        if (p < 0)
          p = -p - 1 + delta;
        else
          p = len - 1 - (p - len) - delta;
      }
      while (static_cast<unsigned> (p) >= static_cast<unsigned> (len));
    }
    else if (type == BORDER_WRAP)
    {
      if (p < 0)
        p -= ((p-len+1)/len)*len;
      if (p >= len)
        p %= len;
    }
    else if (type == BORDER_CONSTANT)
      p = -1;
    else
    {
      PCL_THROW_EXCEPTION (BadArgumentException,
                           "[pcl::interpolate_point_index] error: Unhandled interpolation type "
                           << type << " !");
    }
  }

  return (p);
}


text:
Reinforcement learning framework and algorithms implemented in PyTorch.

Implemented algorithms:
 - Skew-Fit
    - [example script](examples/skewfit/sawyer_door.py)
    - [paper](https://arxiv.org/abs/1903.03698)
    - [Documentation](docs/SkewFit.md)
    - Requires [multiworld](https://github.com/vitchyr/multiworld) to be installed
 - Reinforcement Learning with Imagined Goals (RIG)
    - See [this version](https://github.com/vitchyr/rlkit/tree/v0.1.2) of this repository.
    - [paper](https://arxiv.org/abs/1807.04742)
 - Temporal Difference Models (TDMs)
    - Only implemented in [v0.1.2 of RLkit](https://github.com/vitchyr/rlkit/tree/v0.1.2). See Legacy Documentation section below.
    - [paper](https://arxiv.org/abs/1802.09081)
    - [Documentation](docs/TDMs.md)
 - Hindsight Experience Replay (HER)
    - [example script](examples/her/her_sac_gym_fetch_reach.py)
    - [paper](https://arxiv.org/abs/1707.01495)
    - [Documentation](docs/HER.md)
 - (Double) Deep Q-Network (DQN)
    - [example script](examples/dqn_and_double_dqn.py)
    - [paper](https://arxiv.org/abs/1509.06461.pdf)
    - [Double Q-learning paper](https://www.nature.com/articles/nature14236)
 - Soft Actor Critic (SAC)
    - [example script](examples/sac.py)
    - [original paper](https://arxiv.org/abs/1801.01290) and [updated
    version](https://arxiv.org/abs/1812.05905)
    - [TensorFlow implementation from author](https://github.com/rail-berkeley/softlearning)
    - Includes the "min of Q" method, the entropy-constrained implementation,
     reparameterization trick, and numerical tanh-Normal Jacbian calcuation.
 - Twin Delayed Deep Determinstic Policy Gradient (TD3)
    - [example script](examples/td3.py)
    - [paper](https://arxiv.org/abs/1802.09477)
 - Advantage Weighted Actor Critic (AWAC)
    - [example scripts](examples/awac)
    - [paper](https://arxiv.org/abs/2006.09359)

To get started, checkout the example scripts, linked above.

## What's New
### Version 0.2

#### 04/25/2019
 - Use new `multiworld` code that requires explicit environment registration.
 - Make installation easier by adding `setup.py` and using default `conf.py`.

#### 04/16/2019
 - Log how many train steps were called
 - Log `env_info` and `agent_info`.

#### 04/05/2019-04/15/2019
 - Add rendering
 - Fix SAC bug to account for future entropy (#41, #43)
 - Add online algorithm mode (#42)

#### 04/05/2019

The initial release for 0.2 has the following major changes:
 - Remove `Serializable` class and use default pickle scheme.
 - Remove `PyTorchModule` class and use native `torch.nn.Module` directly.
 - Switch to batch-style training rather than online training.
   - Makes code more amenable to parallelization.
   - Implementing the online-version is straightforward.
 - Refactor training code to be its own object, rather than being integrated
 inside of `RLAlgorithm`.
 - Refactor sampling code to be its own object, rather than being integrated
 inside of `RLAlgorithm`.
 - Implement [Skew-Fit:
State-Covering Self-Supervised Reinforcement Learning](https://arxiv.org/abs/1903.03698),
a method for performing goal-directed exploration to maximize the entropy of
visited states.
 - Update soft actor-critic to more closely match TensorFlow implementation:
   - Rename `TwinSAC` to just `SAC`.
   - Only have Q networks.
   - Remove unnecessary policy regualization terms.
   - Use numerically stable Jacobian computation.

Overall, the refactors are intended to make the code more modular and
readable than the previous versions.

### Version 0.1
#### 12/04/2018
 - Add RIG implementation

#### 12/03/2018
 - Add HER implementation
 - Add doodad support

#### 10/16/2018
 - Upgraded to PyTorch v0.4
 - Added Twin Soft Actor Critic Implementation
 - Various small refactor (e.g. logger, evaluate code)

## Installation

1. Install and use the included Ananconda environment
```
$ conda env create -f environment/[linux-cpu|linux-gpu|mac]-env.yml
$ source activate rlkit
(rlkit) $ python examples/ddpg.py
```
Choose the appropriate `.yml` file for your system.
These Anaconda environments use MuJoCo 1.5 and gym 0.10.5.
You'll need to [get your own MuJoCo key](https://www.roboti.us/license.html) if you want to use MuJoCo.

2. Add this repo directory to your `PYTHONPATH` environment variable or simply
run:
```
pip install -e .
```

3. (Optional) Copy `conf.py` to `conf_private.py` and edit to override defaults:
```
cp rlkit/launchers/conf.py rlkit/launchers/conf_private.py
```

4. (Optional) If you plan on running the Skew-Fit experiments or the HER
example with the Sawyer environment, then you need to install
[multiworld](https://github.com/vitchyr/multiworld).

DISCLAIMER: the mac environment has only been tested without a GPU.

For an even more portable solution, try using the docker image provided in `environment/docker`.
The Anaconda env should be enough, but this docker image addresses some of the rendering issues that may arise when using MuJoCo 1.5 and GPUs.
The docker image supports GPU, but it should work without a GPU.
To use a GPU with the image, you need to have [nvidia-docker installed](https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)).

## Using a GPU
You can use a GPU by calling
```
import rlkit.torch.pytorch_util as ptu
ptu.set_gpu_mode(True)
```
before launching the scripts.

If you are using `doodad` (see below), simply use the `use_gpu` flag:
```
run_experiment(..., use_gpu=True)
```

## Visualizing a policy and seeing results
During training, the results will be saved to a file called under
```
LOCAL_LOG_DIR/<exp_prefix>/<foldername>
```
 - `LOCAL_LOG_DIR` is the directory set by `rlkit.launchers.config.LOCAL_LOG_DIR`. Default name is 'output'.
 - `<exp_prefix>` is given either to `setup_logger`.
 - `<foldername>` is auto-generated and based off of `exp_prefix`.
 - inside this folder, you should see a file called `params.pkl`. To visualize a policy, run

```
(rlkit) $ python scripts/run_policy.py LOCAL_LOG_DIR/<exp_prefix>/<foldername>/params.pkl
```
or
```
(rlkit) $ python scripts/run_goal_conditioned_policy.py LOCAL_LOG_DIR/<exp_prefix>/<foldername>/params.pkl
```
depending on whether or not the policy is goal-conditioned.

If you have rllab installed, you can also visualize the results
using `rllab`'s viskit, described at
the bottom of [this page](http://rllab.readthedocs.io/en/latest/user/cluster.html)

tl;dr run

```bash
python rllab/viskit/frontend.py LOCAL_LOG_DIR/<exp_prefix>/
```
to visualize all experiments with a prefix of `exp_prefix`. To only visualize a single run, you can do
```bash
python rllab/viskit/frontend.py LOCAL_LOG_DIR/<exp_prefix>/<folder name>
```

Alternatively, if you don't want to clone all of `rllab`, a repository containing only viskit can be found [here](https://github.com/vitchyr/viskit). You can similarly visualize results with.
```bash
python viskit/viskit/frontend.py LOCAL_LOG_DIR/<exp_prefix>/
```
This `viskit` repo also has a few extra nice features, like plotting multiple Y-axis values at once, figure-splitting on multiple keys, and being able to filter hyperparametrs out.

## Visualizing a goal-conditioned policy
To visualize a goal-conditioned policy, run
```
(rlkit) $ python scripts/run_goal_conditioned_policy.py
LOCAL_LOG_DIR/<exp_prefix>/<foldername>/params.pkl
```

## Launching jobs with `doodad`
The `run_experiment` function makes it easy to run Python code on Amazon Web
Services (AWS) or Google Cloud Platform (GCP) by using
[this fork of doodad](https://github.com/vitchyr/doodad/tree/v0.2.1).

It's as easy as:
```
from rlkit.launchers.launcher_util import run_experiment

def function_to_run(variant):
    learning_rate = variant['learning_rate']
    ...

run_experiment(
    function_to_run,
    exp_prefix="my-experiment-name",
    mode='ec2',  # or 'gcp'
    variant={'learning_rate': 1e-3},
)
```
You will need to set up parameters in config.py (see step one of Installation).
This requires some knowledge of AWS and/or GCP, which is beyond the scope of
this README.
To learn more, more about `doodad`, [go to the repository](https://github.com/vitchyr/doodad/), which is based on [this original repository](https://github.com/justinjfu/doodad/).

# Requests for pull-requests
 - Implement policy-gradient algorithms.
 - Implement model-based algorithms.

# Legacy Code (v0.1.2)
For Temporal Difference Models (TDMs) and the original implementation of
Reinforcement Learning with Imagined Goals (RIG), run
`git checkout tags/v0.1.2`.

# References
The algorithms are based on the following papers

[Skew-Fit: State-Covering Self-Supervised Reinforcement Learning](https://arxiv.org/abs/1903.03698).
Vitchyr H. Pong*, Murtaza Dalal*, Steven Lin*, Ashvin Nair, Shikhar Bahl, Sergey Levine. arXiv preprint, 2019.

[Visual Reinforcement Learning with Imagined Goals](https://arxiv.org/abs/1807.04742).
Ashvin Nair*, Vitchyr Pong*, Murtaza Dalal, Shikhar Bahl, Steven Lin, Sergey Levine. NeurIPS 2018.

[Temporal Difference Models: Model-Free Deep RL for Model-Based Control](https://arxiv.org/abs/1802.09081).
Vitchyr Pong*, Shixiang Gu*, Murtaza Dalal, Sergey Levine. ICLR 2018.

[Hindsight Experience Replay](https://arxiv.org/abs/1707.01495).
Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, Wojciech Zaremba. NeurIPS 2017.

[Deep Reinforcement Learning with Double Q-learning](https://arxiv.org/abs/1509.06461).
Hado van Hasselt, Arthur Guez, David Silver. AAAI 2016.

[Human-level control through deep reinforcement learning](https://www.nature.com/articles/nature14236).
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, Demis Hassabis. Nature 2015.

[Soft Actor-Critic Algorithms and Applications](https://arxiv.org/abs/1812.05905).
Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, Sergey Levine. arXiv preprint, 2018.

[Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor](https://arxiv.org/abs/1801.01290).
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. ICML, 2018.

[Addressing Function Approximation Error in Actor-Critic Methods](https://arxiv.org/abs/1802.09477)
Scott Fujimoto, Herke van Hoof, David Meger. ICML, 2018.

# Credits
A lot of the coding infrastructure is based on [rllab](https://github.com/rll/rllab).
The serialization and logger code are basically a carbon copy of the rllab versions.

The Dockerfile is based on the [OpenAI mujoco-py Dockerfile](https://github.com/openai/mujoco-py/blob/master/Dockerfile).

Other major collaborators and contributions:
 - [Murtaza Dalal](https://github.com/mdalal2020)
 - [Steven Lin](https://github.com/stevenlin1111)
 - [Ashvin Nair](https://github.com/anair13)


text:
package com.winterwell.nlp.classifier;

import java.util.ArrayList;
import java.util.List;

import com.winterwell.maths.datastorage.IIndex;
import com.winterwell.maths.datastorage.Vectoriser;
import com.winterwell.nlp.corpus.IDocument;
import com.winterwell.nlp.io.ITokenStream;
import com.winterwell.nlp.io.Tkn;

/**
 * Convenience implementation of {@link Vectoriser} for {@link IDocument}. Just
 * uses a tokeniser to break up the doc.
 *
 * @author daniel
 * @testedby  DocVectoriserTest}
 */
public class DocVectoriser extends Vectoriser<String, IDocument> {

	private ITokenStream tokeniser;

	public DocVectoriser(ITokenStream tokeniser, IIndex<String> index,
			KUnknownWordPolicy policy) {
		super(index, policy);
		this.tokeniser = tokeniser;
	}

	public ITokenStream getTokeniser() {
		return tokeniser;
	}

	public void setTokeniser(ITokenStream tokeniser) {
		this.tokeniser = tokeniser;
	}

	@Override
	protected Iterable<String> toBitStream(IDocument doc) {
		ITokenStream tokens = tokeniser.factory(doc.getContents());
		List<String> words = new ArrayList<String>();
		for (Tkn token : tokens) {
			words.add(token.getText());
		}
		return words;
	}

}


text:
const Promise = require('bluebird');
const common = require('../../lib/common');
const models = require('../../models');
const permissionsService = require('../../services/permissions');
const ALLOWED_INCLUDES = ['count.posts', 'permissions', 'roles', 'roles.permissions'];
const UNSAFE_ATTRS = ['status', 'roles'];

module.exports = {
    docName: 'users',

    browse: {
        options: [
            'include',
            'filter',
            'fields',
            'limit',
            'order',
            'page',
            'debug'
        ],
        validation: {
            options: {
                include: {
                    values: ALLOWED_INCLUDES
                }
            }
        },
        permissions: true,
        query(frame) {
            return models.User.findPage(frame.options);
        }
    },

    read: {
        options: [
            'include',
            'filter',
            'fields',
            'debug'
        ],
        data: [
            'id',
            'slug',
            'email',
            'role'
        ],
        validation: {
            options: {
                include: {
                    values: ALLOWED_INCLUDES
                }
            }
        },
        permissions: true,
        query(frame) {
            return models.User.findOne(frame.data, frame.options)
                .then((model) => {
                    if (!model) {
                        return Promise.reject(new common.errors.NotFoundError({
                            message: common.i18n.t('errors.api.users.userNotFound')
                        }));
                    }

                    return model;
                });
        }
    },

    edit: {
        headers: {},
        options: [
            'id',
            'include'
        ],
        validation: {
            options: {
                include: {
                    values: ALLOWED_INCLUDES
                },
                id: {
                    required: true
                }
            }
        },
        permissions: {
            unsafeAttrs: UNSAFE_ATTRS
        },
        query(frame) {
            return models.User.edit(frame.data.users[0], frame.options)
                .then((model) => {
                    if (!model) {
                        return Promise.reject(new common.errors.NotFoundError({
                            message: common.i18n.t('errors.api.users.userNotFound')
                        }));
                    }

                    if (model.wasChanged()) {
                        this.headers.cacheInvalidate = true;
                    } else {
                        this.headers.cacheInvalidate = false;
                    }

                    return model;
                });
        }
    },

    destroy: {
        statusCode: 204,
        headers: {
            cacheInvalidate: true
        },
        options: [
            'id'
        ],
        validation: {
            options: {
                id: {
                    required: true
                }
            }
        },
        permissions: true,
        query(frame) {
            return models.Base.transaction((t) => {
                frame.options.transacting = t;

                return Promise.all([
                    models.Post.destroyByAuthor(frame.options)
                ]).then(() => {
                    return models.User.destroy(Object.assign({status: 'all'}, frame.options));
                }).return(null);
            }).catch((err) => {
                return Promise.reject(new common.errors.NoPermissionError({
                    err: err
                }));
            });
        }
    },

    changePassword: {
        validation: {
            docName: 'password',
            data: {
                newPassword: {required: true},
                ne2Password: {required: true},
                user_id: {required: true}
            }
        },
        permissions: {
            docName: 'user',
            method: 'edit',
            identifier(frame) {
                return frame.data.password[0].user_id;
            }
        },
        query(frame) {
            return models.User.changePassword(frame.data.password[0], frame.options);
        }
    },

    transferOwnership: {
        permissions(frame) {
            return models.Role.findOne({name: 'Owner'})
                .then((ownerRole) => {
                    return permissionsService.canThis(frame.options.context).assign.role(ownerRole);
                });
        },
        query(frame) {
            return models.User.transferOwnership(frame.data.owner[0], frame.options);
        }
    }
};


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * If Type(x) and Type(y) are Null-s, return false
 *
 * @path ch11/11.9/11.9.5/S11.9.5_A6.2.js
 * @description null === null
 */

//CHECK#1
if (null !== null) {
  $ERROR('#1: null === null');
}


text:
"""
Created on Sat Oct 29 21:27:52 2016

@author: k nityan suman

A Discrete Mathematics professor has a class of n students.
Frustrated with their lack of discipline, he decides to cancel class
if fewer than k students are present when class starts.
Given the arrival time of each student, determine if the class is canceled.

The first line of input contains,the number of t test classes/cases.

Each test case consists of two lines.
The first line has two space-separated integers, n(students in the class)
and k(the cancelation threshold).
The second line contains n space-separated integers (a1,a2,..)
describing the arrival times for each student.

If ax<=0 then reached on or before time to class,
else they are late by ax minutes

For each test class,
print the word YES if the class is canceled or NO if it is not.

"""

# get the input from the user about number of cases/classes
t = int(input().strip())

# for the number of classes t, get the input for each class
for x in range(t):
    # take input for students in class and the cancellation threshold
    # split the input using space delimeter
    n,k = input().strip().split(' ')
    # convert it into int
    n,k = [int(n),int(k)]
    # take input about the arrival of each student and make a map
    arrival = map(int, input().strip().split(' '))
    # sort the map in ascending order
    arrival = sorted(arrival, key=int)
    # check for first value greater than 0
    # if the index value for it is greater or equal to k-1 then
    # class is not cancelled else it si cancelled
    print('NO') if arrival[k-1] <= 0 else print('YES')

# end of script


text:
using namespace lldb_private;

StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
    : llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {}

void StreamCallback::write_impl(const char *Ptr, size_t Size) {
  m_callback(std::string(Ptr, Size).c_str(), m_baton);
}

uint64_t StreamCallback::current_pos() const { return 0; }


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Owning bus names</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="ch32.html" title="Migrating to GDBus">
<link rel="prev" href="ch32s02.html" title="API comparison">
<link rel="next" href="ch32s04.html" title="Creating proxies for well-known names">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

GIO Reference Manual

Owning bus names

      Using dbus-glib, you typically call RequestName manually
      to own a name, like in the following excerpt:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

error = NULL;
res = dbus_g_proxy_call (system_bus_proxy,
                         "RequestName",
                         &error,
                         G_TYPE_STRING, NAME_TO_CLAIM,
                         G_TYPE_UINT,   DBUS_NAME_FLAG_ALLOW_REPLACEMENT,
                         G_TYPE_INVALID,
                         G_TYPE_UINT,   &result,
                         G_TYPE_INVALID);
if (!res)
  {
    if (error != NULL)
      {
        g_warning ("Failed to acquire %s: %s",
                   NAME_TO_CLAIM, error->message);
        g_error_free (error);
      }
    else
      {
        g_warning ("Failed to acquire %s", NAME_TO_CLAIM);
      }
    goto out;
  }

if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
  {
    if (error != NULL)
      {
        g_warning ("Failed to acquire %s: %s",
                   NAME_TO_CLAIM, error->message);
        g_error_free (error);
      }
    else
      {
        g_warning ("Failed to acquire %s", NAME_TO_CLAIM);
      }
    exit (1);
  }

dbus_g_proxy_add_signal (system_bus_proxy, "NameLost",
                         G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (system_bus_proxy, "NameLost",
                             G_CALLBACK (on_name_lost), NULL, NULL);

/* further setup ... */

    While you can do things this way with GDBus too, using
    g_dbus_proxy_call_sync(), it is much nicer to use the high-level API
    for this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

static void
on_name_acquired (GDBusConnection *connection,
                  const gchar     *name,
                  gpointer         user_data)
{
  /* further setup ... */
}

/* ... */

  owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
                             NAME_TO_CLAIM,
                             G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT,
                             on_bus_acquired,
                             on_name_acquired,
                             on_name_lost,
                             NULL,
                             NULL);

  g_main_loop_run (loop);

  g_bus_unown_name (owner_id);

    Note that g_bus_own_name() works asynchronously and requires
    you to enter your mainloop to await the on_name_aquired()
    callback. Also note that in order to avoid race conditions (e.g.
    when your service is activated by a method call), you have to export
    your manager object before acquiring the
    name. The on_bus_acquired() callback is the right place to do
    such preparations.

          Generated by GTK-Doc V1.18


text:
layout: post
title: Wie kann ich mein Konto manuell konfigurieren?
date: 2015-02-22 17:54:56.000000000 +02:00
type: post
published: true
status: publish
categories:
- Konten
tags: []
lang: de
meta: /configure-account-manually/
---

Sie können Ihr Konto manuell hinzufügen, indem Sie auf *Mehr ...* \| *Verschiedene Kontoeinstellungen* \| *Konto hinzufügen (+)* \| *Anderes Konto hinzufügen* \| *Andere E-Mail*, dann folgen Sie diesen Schritten:

1. Geben Sie Ihre E-Mail-Adresse und Ihr Passwort ein.
2. Untick *Automatic* und tippen Sie auf *Next*.
3. Wählen Sie Ihren Kontotyp: *IMAP* / [*Exchange*](/add-exchange-account/) / *POP3*.
4. Konfigurieren Sie Ihre eingehenden Einstellungen vollständig und tippen Sie auf *Weiter*.
5. Konfigurieren Sie Ihre ausgehenden Einstellungen vollständig und tippen Sie auf *Weiter*.
6. Warten Sie, bis Ihr Konto eingerichtet ist und Voila! Willkommen bei BlueMail.

Hinweis: Wenn Sie sich Ihrer E-Mail-Einstellungen nicht sicher sind, wenden Sie sich bitte an Ihren Netzwerkadministrator.
Sie sehen diese Schritte in unserem Video unten gezeigt:
<iframe src="https://www.youtube.com/embed/_kIvr2azxaY?list=PLXcA1xyD8E7dB0XsKApln4AqCumFbmOJK&loop=1" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>


text:
#pragma config(Sensor, in1,    lineFollower,   sensorLineFollower)
#pragma config(Sensor, dgtl1,  encod,          sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  pushB,          sensorTouch)
#pragma config(Sensor, dgtl11, ind0,           sensorLEDtoVCC)
#pragma config(Sensor, dgtl12, ind1,           sensorLEDtoVCC)
#pragma config(Motor,  port1,           flight,        tmotorVexFlashlight, openLoop, reversed)
#pragma config(Motor,  port2,           rMotorGateId,         tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           rMotorServRId,        tmotorServoStandard, openLoop)
#pragma config(Motor,  port4,           rMotorServLId,        tmotorServoStandard, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "utilities.c"
#include "indicators.c"
#include "measure.c"
#include "gate.c"

int material = -1;

int sort(bool learn);

task main() {

  doConfig();
  indMode[0] = 1;
  indMode[1] = 3;
  while (!SensorValue[pushB]) doIndicateTick();
  delayInd(100);
  while (SensorValue[pushB]) doIndicateTick();
  indMode[0] = 2;
  indMode[1] = 0;

  // precalibrate

  SensorValue[encod] = 0;
  mgate = 0;

  // learn four materials

  for (int i = 0; i < 4; ++i) {
    sort(true);
    delayInd(CONFIG.SORT_DELAY);
  }

  while (1) {

    indMode[0] = 0;
	  indMode[1] = 3;
	  while (!SensorValue[pushB]) doIndicateTick();
	  delayInd(100);
	  while (SensorValue[pushB]) doIndicateTick();
	  delayInd(100);

    while (1) {
      indMode[1] = 1;
      indMode[0] = 4;
      if (SensorValue[pushB]) break;

      delayInd(CONFIG.SORT_DELAY);

      indMode[1] = 0;
      indMode[0] = 4;

      sort(false);
    }

    indMode[1] = 1;
    indMode[0] = 3;

    while (!SensorValue[pushB]) doIndicateTick();
    delayInd(100);
    while (SensorValue[pushB]) doIndicateTick();
    delayInd(100);
  }
}

int sort(bool learn) {
  material = getMaterial(learn);

  switch (material) {
    case 0:
      mgate = -CONFIG.GATE_SPEED;
      msl = CONFIG.SERVO_PATH_LEFT;
      break;
    case 1:
      mgate = -CONFIG.GATE_SPEED;
      msl = CONFIG.SERVO_PATH_RIGHT;
      break;
    case 2:
      mgate = CONFIG.GATE_SPEED;
      msr = CONFIG.SERVO_PATH_LEFT;
      break;
    case 3:
      mgate = CONFIG.GATE_SPEED;
      msr = CONFIG.SERVO_PATH_RIGHT;
      break;
    default:
      return -1;
  }

  delayInd(CONFIG.GATE_LENGTH);
  if (material > 1) {
    // do a quick hop back the other way -
    // this should help get the sensor in a better place each time.
    mgate = -100;
    delayInd(50);
    mgate = 0;
  }
  goToZero();

  return material;
}


text:
from ...game.card import Minion, Spell, Weapon
from ...game.hero import Hero, HeroPower
from .basic_cards import *
from .frontend_checker import *
from .enchantment import *
from .misc import *

__author__ = 'fyabc'


text:
/**
 *   2017-09-19   Wang Jian
 */

var person  = {
    a : 1
};
person.getage = function(){
    return 0;
};

var a = Object.create(person,{
    age: {
        value : 20
    }
});
console.log(a.__proto__);
console.log(a.getage());
console.log(`-------------------`)
console.log(person.getage());

a.__proto__.name = 1;
console.log(person.name);
var b = Object.create (person,{})
b.__proto__.sex = 3;
console.log(a.sex);

console.log(a.age, b.age);
console.log(`---------------Array------------------`)
var m =[1, 2, 3];
console.log(typeof m);
console.log(m.__proto__ === Object.prototype);
console.log(m.__proto__.__proto__ === Object.prototype);
console.log(m.__proto__ === Array.prototype);

console.log(`-----------string--------------------`)
var n = 'name';
console.log(n.__proto__.__proto__ === Object.prototype);
console.log(n.__proto__ === String.prototype);
console.log(n.__proto__ === Array.prototype);
console.log(`String.__proto__ =>${String.__proto__}`)
console.log(`Object.__proto__ => ${Object.__proto__} `)

console.log(`-----------------Number-------------`)
var b = 12;
console.log(b.__proto__.__proto__ === Object.prototype);
console.log(b.__proto__ === Number.prototype);
console.log(b.__proto__.__proto__);
console.log(Number.prototype.__proto__ === Object.prototype)

console.log(`-------------------Boolean------------`)
var c = true;
console.log(`c.__proto__ =>${c.__proto__}`);
console.log(`c.__proto__.__proto__ =>${c.__proto__.__proto__}`);
console.log(c.__proto__.__proto__ === Object.prototype);
console.log(c.__proto__ === Boolean.prototype);
console.log(c.__proto__ === Function.prototype);

console.log(`------------Constuctor------------------------`);
console.log(`Function.prototype.constructor === Function => ${Function.prototype.constructor=== Function}`);
console.log(`Function.constructor => ${Function.constructor}`);


text:
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
#include <openthread/platform/spi-slave.h>

#include "platform-zephyr.h"

/* Spi-slave stubs */

otError otPlatSpiSlaveEnable(
	otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback,
	otPlatSpiSlaveTransactionProcessCallback aProcessCallback,
	void *aContext)
{
	ARG_UNUSED(aCompleteCallback);
	ARG_UNUSED(aProcessCallback);
	ARG_UNUSED(aContext);

	return OT_ERROR_NOT_IMPLEMENTED;
}

void otPlatSpiSlaveDisable(void)
{
	/* Intentionally empty */
}

otError otPlatSpiSlavePrepareTransaction(
	uint8_t *anOutputBuf,
	uint16_t anOutputBufLen,
	uint8_t *anInputBuf,
	uint16_t anInputBufLen,
	bool aRequestTransactionFlag
)
{
	ARG_UNUSED(anOutputBuf);
	ARG_UNUSED(anOutputBufLen);
	ARG_UNUSED(anInputBuf);
	ARG_UNUSED(anInputBufLen);
	ARG_UNUSED(aRequestTransactionFlag);

	return OT_ERROR_NOT_IMPLEMENTED;
}


text:
#ifndef _DATA_CODE_BLOCK_HPP_
#define _DATA_CODE_BLOCK_HPP_

#include <cstdio>
#include "BinaryBlock.hpp"

namespace RecursiveTraversal {

	class BinaryDataBlock : public BinaryBlock {

	public:

		enum Granularity { Byte = 1, Word = 2, Dword = 4, Qword = 8 };

		BinaryDataBlock(const int64_t& address, size_t length);

		inline Granularity granularity() const {
			return m_granularity;
		}

		virtual void getDisassembled(const AbstractBinaryBlockDisassembler&) const;

	private:
		Granularity m_granularity;

	};

}
#endif /* _DATA_CODE_BLOCK_HPP_ */


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycotaxon 64: 414 (1997)

#### Original name
Cercospora ubatubensis Chupp & Viégas

### Remarks
null