text:
package nl.erlkdev.adhocmonitor;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;

import org.json.JSONObject;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Timer;
import java.util.TimerTask;

/**
 * Created on 18-4-2016.
 */
public class AdhocMonitorService extends Service{
    private final String TAG = this.getClass().getSimpleName();

    /* Connection information. */
    private String address = null;
    private String HOST = null;
    private Integer UDP_PORT = null;
    private Integer TCP_PORT = null;
    private MonitorErrorListener monitorErrorListener = null;

    /* Configuration. */
    private boolean syncTimeEnabled = true;
    private int monitorInterval = 500;
    private long monitorTimeOffset = 0;

    /* Monitor sender thread. */
    private Timer mMonitorSender;

    /* Monitor node. */
    private MonitorNode monitorNode;

    /**
     * Constructor for the monitor service
     * Displays debug message that the service has started
     */
    public AdhocMonitorService() {
        Log.d(TAG, "Monitor service started");
    }

    /**
     * Function to enable or disable the time synchronization
     *
     * @param syncTimeEnabled Default value is true
     */
    public void setSyncTimeEnabled(boolean syncTimeEnabled) {
        this.syncTimeEnabled = syncTimeEnabled;
    }

    /**
     * Function that returns if time synchronization is enabled
     *
     * @return true if time synchronization is enabled, else false
     */
    public boolean isSyncTimeEnabled(){
        return syncTimeEnabled;
    }

    /**
     * Function to set the monitor interval
     *
     * @param monitorInterval Default value is 500 milliseconds
     */
    public void setMonitorInterval(int monitorInterval){
        this.monitorInterval = monitorInterval;
    }

    /**
     * Function that returns the interval on which the monitor sends the data
     *
     * @return The interval on which the monitor sends the data
     */
    public int getMonitorInterval() {
        return monitorInterval;
    }

    /**
     * Gets the ip address of the monitor system
     *
     * @return the ip address of the monitor system
     */
    public String getHOST(){
        return HOST;
    }

    /**
     * Gets the udp port used by the monitor system for transferring data
     *
     * @return the udp port number used by the monitor system
     */
    public Integer getUdpPORT() {
        return UDP_PORT;
    }

    /**
     * Gets the tcp port used by the monitor system to synchronize the time
     *
     * @return the tcp port number used by the monitor system
     */
    public Integer getTcpPORT() {
        return TCP_PORT;
    }

    /**
     * Gets the address of the node
     *
     * @return the address of the node
     */
    public String getAddress(){
        return address;
    }

    /**
     * Gets the monitor node
     * @return MonitorNode
     */
    public MonitorNode getMonitorNode(){
        return monitorNode;
    }

    /**
     * Returns the time offset between the monitor and the node
     *
     * @return the time offset between the monitor and the node
     */
    public long getMonitorTimeOffset(){
        return monitorTimeOffset;
    }

    /**
     * Stops the monitor
     */
    public void stopMonitor(){
        mMonitorSender.cancel();
    }

    /**
     * Starts the monitor process using the default ports
     *
     * If time synchronization is enabled it first syncs the time between the monitor and the node
     * It then start the send thread to send data to the monitor system on an interval
     */
    public void startMonitor(String address, String HOST) {
        startMonitor(address, HOST, 7000, 7001);
    }

    /**
     * Starts the monitor process with the monitor error listener using the default ports
     *
     * If time synchronization is enabled it first syncs the time between the monitor and the node
     * It then start the send thread to send data to the monitor system on an interval
     */
    public void startMonitor(String address, String HOST, MonitorErrorListener monitorErrorListener) {
        this.monitorErrorListener = monitorErrorListener;
        startMonitor(address, HOST, 7000, 7001);
    }

    /**
     * Starts the monitor process with the monitor error listener
     *
     * If time synchronization is enabled it first syncs the time between the monitor and the node
     * It then start the send thread to send data to the monitor system on an interval
     */
    public void startMonitor(String address, String HOST, int UDP_PORT, int TCP_PORT, MonitorErrorListener monitorErrorListener) {
        this.monitorErrorListener = monitorErrorListener;
        startMonitor(address, HOST, UDP_PORT, TCP_PORT);
    }

    /**
     * Starts the monitor process
     *
     * If time synchronization is enabled it first syncs the time between the monitor and the node
     * It then start the send thread to send data to the monitor system on an interval
     */
    public void startMonitor(String address, String HOST, int UDP_PORT, int TCP_PORT) {
        this.address = address;
        this.HOST = HOST;
        this.UDP_PORT = UDP_PORT;
        this.TCP_PORT = TCP_PORT;
        this.monitorNode = new MonitorNode(address);

        Thread startMonitorThread = new Thread(new Runnable() {
            @Override
            public void run() {
                /* Syncs the time between the monitor and the node if enabled. */
                if (syncTimeEnabled){
                    syncTime();
                }
                monitorNode.setMonitorTimeOffset(monitorTimeOffset);

                /* Starts the monitor send thread. */
                try {
                    mMonitorSender = startSendThread();
                } catch (UnknownHostException e) {
                    if (monitorErrorListener != null){
                        monitorErrorListener.onError("Host not found");
                    }
                }
            }
        });
        startMonitorThread.start();
    }

    /**
     * Thread to send data after to the monitor system on a fixed interval.
     * If the host couldn't be find it throws a exception.
     *
     * @return the send threads
     * @throws UnknownHostException
     */
    private Timer startSendThread() throws UnknownHostException {
        Timer monitorSender = new Timer();
        monitorSender.scheduleAtFixedRate(new TimerTask() {
            private InetAddress address = InetAddress.getByName(HOST);

            @Override
            public void run() {
                try {
                    /* Creates a JSON object of the data. */
                    JSONObject parent = new JSONObject();
                    parent.put("type", "data");
                    parent.put("node", monitorNode.getJson());

                    /* Opens a datagram socket and sends the json object as datagram package. */
                    DatagramSocket s = new DatagramSocket();
                    DatagramPacket packet = new DatagramPacket(parent.toString().getBytes(), parent.toString().getBytes().length, address, UDP_PORT);
                    s.send(packet);
                    s.close();

                } catch (Exception e) {
                    if (monitorErrorListener != null) {
                        monitorErrorListener.onError("Data couldn't be send");
                    }
                }
            }

        }, 0, monitorInterval);

        return monitorSender;
    }

    /**
     * Function to synchronize the time between the node and the monitor
     * It uses the method of the precision time protocol: https://en.wikipedia.org/wiki/Precision_Time_Protocol
     */
    private void syncTime(){
        try{
            byte[] bytes = new byte[4048];
            long time1, time1d, time2, time2d;
            JSONObject packageJson;

            /* Creates a socket. */
            Socket s = new Socket();
            s.connect(new InetSocketAddress(HOST, TCP_PORT));

            /* Creates an in- and output stream. */
            DataOutputStream dos = new DataOutputStream(s.getOutputStream());
            DataInputStream dis = new DataInputStream(s.getInputStream());

            /* Creates a json object and sends it. */
            JSONObject parent = new JSONObject();
            parent.put("type", "sync");

            time1 = System.currentTimeMillis();
            dos.write(parent.toString().getBytes());
            dos.flush();

            /* Waits until the a package is received. */
            while (dis.read(bytes) == -1);
            time2d = System.currentTimeMillis();

            /* Gets t1' and t2 from the JSON packet. */
            packageJson = new JSONObject(new String(bytes));
            time1d = Long.parseLong(((String) packageJson.get("time1d")).replace("L", ""));
            time2 = Long.parseLong(((String) packageJson.get("time2")).replace("L", ""));

            /* Calculates the offset. */
            monitorTimeOffset = -((time1d - time1 - time2d + time2) / 2);

            dis.close();
            dos.close();
            s.close();
        } catch (Exception e) {
            if (monitorErrorListener != null){
                monitorErrorListener.onError("Time synchronization failed");
            }
            e.printStackTrace();
        }
    }

    /**
     * Bind method for the adhoc monitor binder
     *
     * @param intent The monitor intent
     * @return Adhoc monitor binder
     */
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return new AdhocMonitorBinder(this);
    }

    /**
     * Interface for a monitor error listener
     *
     * All the monitor errors will be send to the monitor error listener
     */
    public interface MonitorErrorListener {
        void onError(String errorMsg);
    }
}


text:
package io.oasp.gastronomy.restaurant.offermanagement.batch.impl.productimport;

import static org.junit.Assert.assertEquals;

import java.util.List;

import javax.inject.Inject;

import org.flywaydb.core.Flyway;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import io.oasp.gastronomy.restaurant.SpringBootApp;
import io.oasp.gastronomy.restaurant.general.common.TestUtil;
import io.oasp.gastronomy.restaurant.general.common.api.constants.PermissionConstants;
import io.oasp.gastronomy.restaurant.general.common.api.datatype.Money;
import io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer;
import io.oasp.gastronomy.restaurant.offermanagement.common.api.datatype.OfferSortByHitEntry;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.Offermanagement;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferEto;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferFilter;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferSortBy;
import io.oasp.module.jpa.common.api.to.OrderDirection;
import io.oasp.module.test.common.base.ComponentTest;

/**
 * This is the test-case of {@link Offermanagement}
 *
 * @since dev
 */
@SpringApplicationConfiguration(classes = { SpringBootApp.class })
@WebAppConfiguration
public class OfferManagementTest extends ComponentTest {

  @Inject
  private Offermanagement offerManagement;

  @Inject
  private Flyway flyway;

  /**
   * Login
   */
  @Before
  public void setUp() {

    this.flyway.clean();
    this.flyway.migrate();

    TestUtil.login("waiter", PermissionConstants.FIND_OFFER);
  }

  /**
   * Logout
   */
  @After
  public void tearDown() {

    TestUtil.logout();
  }

  /**
   * Tests if the {@link Offer} is filtered correctly.
   */
  @Test
  public void testFindOffersFiltered() {

    OfferFilter filter = new OfferFilter();
    filter.setDrinkId(12L);
    filter.setMinPrice(new Money(5));
    filter.setMaxPrice(new Money(7));

    OfferSortBy sort = new OfferSortBy();
    sort.setSortByEntry(OfferSortByHitEntry.PRICE);
    List<OfferEto> offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.size(), 3);
    assertEquals(offerEntity.get(0).getPrice(), new Money(5.99));
    assertEquals(offerEntity.get(1).getPrice(), new Money(6.23));
    assertEquals(offerEntity.get(2).getPrice(), new Money(6.99));

    sort.setOrderBy(OrderDirection.DESC);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.get(0).getPrice(), new Money(6.99));
    assertEquals(offerEntity.get(1).getPrice(), new Money(6.23));
    assertEquals(offerEntity.get(2).getPrice(), new Money(5.99));

    sort.setOrderBy(OrderDirection.ASC);
    sort.setSortByEntry(OfferSortByHitEntry.ID);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.get(0).getId(), new Long(1));
    assertEquals(offerEntity.get(1).getId(), new Long(6));
    assertEquals(offerEntity.get(2).getId(), new Long(7));

    sort.setSortByEntry(OfferSortByHitEntry.DESCRIPTION);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.size(), 3);
    assertEquals(offerEntity.get(0).getDescription(), "Description of Flammkuchen-Menü");
    assertEquals(offerEntity.get(1).getDescription(), "Description of Pizza-Menü");
    assertEquals(offerEntity.get(2).getDescription(), "Description of Schnitzel-Menü");

    sort.setSortByEntry(OfferSortByHitEntry.MEAL);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.size(), 3);
    assertEquals(offerEntity.get(0).getMealId(), new Long(6));
    assertEquals(offerEntity.get(1).getMealId(), new Long(5));
    assertEquals(offerEntity.get(2).getMealId(), new Long(1));

    sort.setSortByEntry(OfferSortByHitEntry.ID);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.get(0).getPrice(), new Money(6.99));
    assertEquals(offerEntity.get(1).getPrice(), new Money(6.23));
    assertEquals(offerEntity.get(2).getPrice(), new Money(5.99));

    filter.setMealId(1L);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.size(), 1);
    assertEquals(offerEntity.get(0).getPrice(), new Money(6.99));

    filter.setSideDishId(7L);
    offerEntity = this.offerManagement.findOffersFiltered(filter, sort);
    assertEquals(offerEntity.size(), 1);
    assertEquals(offerEntity.get(0).getId(), new Long(1));
    assertEquals(offerEntity.get(0).getDescription(), "Description of Schnitzel-Menü");
    assertEquals(offerEntity.get(0).getDrinkId(), new Long(12));
    assertEquals(offerEntity.get(0).getMealId(), new Long(1));
    assertEquals(offerEntity.get(0).getSideDishId(), new Long(7));

  }
}

redpajama_set_name: RedPajamaGithub


text:
package cyclops.monads.collections.mutable;

import com.oath.cyclops.anym.AnyMSeq;
import cyclops.monads.Witness;
import cyclops.monads.Witness.*;
import cyclops.reactive.collections.mutable.DequeX;
import cyclops.monads.AnyM;
import cyclops.monads.collections.AbstractAnyMSeqOrderedDependentTest;
import org.junit.Test;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

public class DequeXTest extends AbstractAnyMSeqOrderedDependentTest<deque> {

	@Override
	public <T> AnyMSeq<deque,T> of(T... values) {
		return AnyM.fromDeque(DequeX.of(values));
	}
	/* (non-Javadoc)
	 * @see com.oath.cyclops.function.collections.extensions.AbstractCollectionXTest#zero()
	 */
	@Override
	public <T> AnyMSeq<Witness.deque,T> empty() {
		return AnyM.fromDeque(DequeX.empty());
	}

}


text:
define({
  root:{
    editButton: "Edit ... (E)",
    cancelButton: "Cancel",
    cancelButtonTitle: "Cancel (ESC)",
    saveButton: "Save (CTRL/COMMAND-S)",
    deleteButton: "Delete",
    closeButton: "Close (W)",
    busy: "Sending …"
  },
  nl: true,
  fr: true
});


text:
// Original - Christopher Lloyd <cjwl@objc.net>
#import <AppKit/Win32Event.h>

@implementation Win32Event

-initWithMSG:(MSG)msg {
   _msg=msg;
   return self;
}

+(Win32Event *)eventWithMSG:(MSG)msg {
   return [[[self alloc] initWithMSG:msg] autorelease];
}

-(MSG)msg {
   return _msg;
}

@end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.notebooks.v1.model;

/**
 * Request for upgrading a Managed Notebook Runtime to the latest version. option
 * (google.api.message_visibility).restriction = "TRUSTED_TESTER,SPECIAL_TESTER";
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Notebooks API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class UpgradeRuntimeRequest extends com.google.api.client.json.GenericJson {

  /**
   * Idempotent request UUID.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String requestId;

  /**
   * Idempotent request UUID.
   * @return value or {@code null} for none
   */
  public java.lang.String getRequestId() {
    return requestId;
  }

  /**
   * Idempotent request UUID.
   * @param requestId requestId or {@code null} for none
   */
  public UpgradeRuntimeRequest setRequestId(java.lang.String requestId) {
    this.requestId = requestId;
    return this;
  }

  @Override
  public UpgradeRuntimeRequest set(String fieldName, Object value) {
    return (UpgradeRuntimeRequest) super.set(fieldName, value);
  }

  @Override
  public UpgradeRuntimeRequest clone() {
    return (UpgradeRuntimeRequest) super.clone();
  }

}


text:
namespace NAMESPACE {

class SimpleTest :
public SelfTest::Test<PLUGINNAMEPlugin, SimpleTest>
{ public: void test()
{
	CHECK_INT_EQUAL(1, 1);
}};

}


text:
@implementation RawStats

@end


text:
/**
 * Abstract Screen class.
 *
 * @author: artlessAvian
 */
var Screen = function() {

	if (this.constructor === Screen) {
		throw new error("Cannot initialize abstract class!");
	}
}

Screen.prototype.update = function(dt) {
	throw new error("Cannot initialize abstract class!");
}

Screen.prototype.draw = function(accumulator) {
	throw new error("Cannot initialize abstract class!");
}

Screen.prototype.keydown_handler = function(key, meaning) {
	throw new error("Cannot initialize abstract class!");
}

Screen.prototype.keyup_handler = function(key, meaning) {
	throw new error("Cannot initialize abstract class!");
}


text:
#import "NSObject.h"

#import "DVTInvalidation.h"

@class DVTExtension, DVTStackBacktrace, IDEWorkspace, NSArray, NSImage, NSMutableArray, NSString;

@interface IDEActivityReporter : NSObject <DVTInvalidation>
{
    DVTExtension *_representedExtension;
    IDEWorkspace *_workspace;
    NSArray *_activityReports;
    NSImage *_image;
}

+ (id)activityReporterWithExtension:(id)arg1 workspace:(id)arg2;
+ (void)initialize;
- (void).cxx_destruct;
@property(readonly) NSImage *image;
- (id)initWithWorkspace:(id)arg1;
- (id)newActivityReportWithTitle:(id)arg1 options:(int)arg2 image:(id)arg3;
- (id)newActivityReportWithTitle:(id)arg1 options:(int)arg2 image:(id)arg3 fileIOPriority:(unsigned long long)arg4 fileIOCoordinatorBlock:(id)arg5;
- (id)newActivityReportWithTitle:(id)arg1 options:(int)arg2 isUserVisible:(BOOL)arg3 image:(id)arg4 fileIOPriority:(unsigned long long)arg5 fileIOCoordinatorBlock:(id)arg6;
- (void)primitiveInvalidate;
@property(retain) DVTExtension *representedExtension; // @synthesize representedExtension=_representedExtension;
@property(readonly) IDEWorkspace *workspace; // @synthesize workspace=_workspace;

// Remaining properties
@property(readonly) NSArray *activityReports; // @dynamic activityReports;
@property(retain) DVTStackBacktrace *creationBacktrace;
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) DVTStackBacktrace *invalidationBacktrace;
@property(readonly) NSMutableArray *mutableActivityReports; // @dynamic mutableActivityReports;
@property(readonly) Class superclass;
@property(readonly, nonatomic, getter=isValid) BOOL valid;

@end


text:
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using NewsSite.Web.Models;
using System.Data.Entity;
using NewsSite.Web.Migrations;

namespace NewsSite.Web.Models
{
}

#region Helpers
namespace NewsSite.Web
{
    public static class IdentityHelper
    {
        // Used for XSRF when linking external logins
        public const string XsrfKey = "XsrfId";

        public static void SignIn(ApplicationUserManager manager, User user, bool isPersistent)
        {
            IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
            authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
            var identity = manager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
            authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
        }

        public const string ProviderNameKey = "providerName";
        public static string GetProviderNameFromRequest(HttpRequest request)
        {
            return request.QueryString[ProviderNameKey];
        }

        public const string CodeKey = "code";
        public static string GetCodeFromRequest(HttpRequest request)
        {
            return request.QueryString[CodeKey];
        }

        public const string UserIdKey = "userId";
        public static string GetUserIdFromRequest(HttpRequest request)
        {
            return HttpUtility.UrlDecode(request.QueryString[UserIdKey]);
        }

        public static string GetResetPasswordRedirectUrl(string code)
        {
            return "/Account/ResetPassword?" + CodeKey + "=" + HttpUtility.UrlEncode(code);
        }

        public static string GetUserConfirmationRedirectUrl(string code, string userId)
        {
            return "/Account/Confirm?" + CodeKey + "=" + HttpUtility.UrlEncode(code) + "&" + UserIdKey + "=" + HttpUtility.UrlEncode(userId);
        }

        private static bool IsLocalUrl(string url)
        {
            return !string.IsNullOrEmpty(url) && ((url[0] == '/' && (url.Length == 1 || (url[1] != '/' && url[1] != '\\'))) || (url.Length > 1 && url[0] == '~' && url[1] == '/'));
        }

        public static void RedirectToReturnUrl(string returnUrl, HttpResponse response)
        {
            if (!String.IsNullOrEmpty(returnUrl) && IsLocalUrl(returnUrl))
            {
                response.Redirect(returnUrl);
            }
            else
            {
                response.Redirect("~/");
            }
        }
    }
}
#endregion


text:
Input::
//// [/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };

//// [/src/a.ts]
export class A {}

//// [/src/b.ts]
import {A} from 'a';
export const b = new A();

//// [/src/c.ts]
import {b} from './b';
import {X} from "@ref/a";
b;
X;

//// [/src/refs/a.d.ts]
export class X {}
export class A {}

//// [/src/tsconfig.a.json]
{"compilerOptions": {"composite": true}, "files": ["a.ts"]}

//// [/src/tsconfig.b.json]
{"compilerOptions":{"composite":true,"moduleResolution":"node"},"files":["b.ts"],"references":[{"path":"tsconfig.a.json"}]}

//// [/src/tsconfig.c.json]
{
    "files": [ "c.ts" ],
    "compilerOptions": {
        "baseUrl": "./",
        "paths": {
            "@ref/*": [ "./refs/*" ]
        }
    },
    "references": [ { "path": "tsconfig.b.json" } ]
}

Output::
/lib/tsc --b /src/tsconfig.c.json --listFiles
/lib/lib.d.ts
/src/a.ts
src/b.ts:1:17 - error TS2307: Cannot find module 'a' or its corresponding type declarations.

1 import {A} from 'a';
                  ~~~

/lib/lib.d.ts
/src/b.ts

Found 1 error.

exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated

//// [/src/a.d.ts]
export declare class A {
}

//// [/src/a.js]
"use strict";
exports.__esModule = true;
exports.A = void 0;
var A = /** @class */ (function () {
    function A() {
    }
    return A;
}());
exports.A = A;

//// [/src/tsconfig.a.tsbuildinfo]
{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-8566332115-export class A {}\r\n","signature":"-9529994156-export declare class A {\r\n}\r\n"}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2],"dtsChangeTime":8000},"version":"FakeTSVersion"}

//// [/src/tsconfig.a.tsbuildinfo.readable.baseline.txt]
{
  "program": {
    "fileNames": [
      "../lib/lib.d.ts",
      "./a.ts"
    ],
    "fileInfos": {
      "../lib/lib.d.ts": {
        "version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
        "signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
        "affectsGlobalScope": true
      },
      "./a.ts": {
        "version": "-8566332115-export class A {}\r\n",
        "signature": "-9529994156-export declare class A {\r\n}\r\n"
      }
    },
    "options": {
      "composite": true
    },
    "referencedMap": {},
    "exportedModulesMap": {},
    "semanticDiagnosticsPerFile": [
      "../lib/lib.d.ts",
      "./a.ts"
    ],
    "dtsChangeTime": 8000
  },
  "version": "FakeTSVersion",
  "size": 809
}

//// [/src/tsconfig.b.tsbuildinfo]
{"program":{"fileNames":["../lib/lib.d.ts","./b.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-17186364832-import {A} from 'a';\nexport const b = new A();"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./b.ts","start":16,"length":3,"messageText":"Cannot find module 'a' or its corresponding type declarations.","category":1,"code":2307}]]],"affectedFilesPendingEmit":[[2,1]],"emitSignatures":[2]},"version":"FakeTSVersion"}

//// [/src/tsconfig.b.tsbuildinfo.readable.baseline.txt]
{
  "program": {
    "fileNames": [
      "../lib/lib.d.ts",
      "./b.ts"
    ],
    "fileInfos": {
      "../lib/lib.d.ts": {
        "version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
        "signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
        "affectsGlobalScope": true
      },
      "./b.ts": {
        "version": "-17186364832-import {A} from 'a';\nexport const b = new A();",
        "signature": "-17186364832-import {A} from 'a';\nexport const b = new A();"
      }
    },
    "options": {
      "composite": true
    },
    "referencedMap": {},
    "exportedModulesMap": {},
    "semanticDiagnosticsPerFile": [
      "../lib/lib.d.ts",
      [
        "./b.ts",
        [
          {
            "file": "./b.ts",
            "start": 16,
            "length": 3,
            "messageText": "Cannot find module 'a' or its corresponding type declarations.",
            "category": 1,
            "code": 2307
          }
        ]
      ]
    ],
    "affectedFilesPendingEmit": [
      [
        "./b.ts",
        "Full"
      ]
    ],
    "emitSignatures": [
      "./b.ts"
    ]
  },
  "version": "FakeTSVersion",
  "size": 947
}


text:
module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    // basePath: '',

    frameworks: ['jasmine', 'traceur'],

    files: [
      '../build/js/**/*.js',
      '../app/**/*.html',
      '../app/**/test/**/*.js'
    ],

    preprocessors: {
      '**/*.html': 'html2js',
      '../app/**/test/**/*.js': [ 'traceur' ]
    },
    //TODO - add coverage

    // browsify config
    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    },

    // default configuration, not required
    traceurPreprocessor: {
      // options passed to the traceur-compiler
      // see traceur --longhelp for list of options
      options: {
        sourceMaps: false,
        modules: 'commonjs'
      },
      // custom filename transformation function
      //transformPath: function(path) {
        //return path.replace(/\.es6$/, '.js');
      //}
    },

    // list of files to exclude
    exclude: [],

    // test results reporter to use
    // possible values: dots || progress || nested || junit
    // use just 'spec' if you need to see the names of specs to be printed out, sometimes useful to find out
    // where warnigns are thrown.
    reporters: ['nested'],

    junitReporter: {
      outputFile: 'build/test-reports/test-results.xml'
    },

    // web server port
    port: 8080,

    // cli runner port
    runnerPort: 9100,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari
    // - PhantomJS
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: true
  });
}


text:
package io.gatling.http.client.body.multipart.impl;

import static io.gatling.http.client.util.MiscUtils.*;

import io.gatling.http.client.body.multipart.FilePart;
import io.netty.buffer.ByteBuf;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;

public class FilePartImpl extends FileLikePartImpl<FilePart> {

  private final File file;
  private FileChannel channel;
  private long position = 0L;

  public FilePartImpl(FilePart part, byte[] boundary) {
    super(part, boundary);
    file = part.getContent();
  }

  private FileChannel getChannel() throws IOException {
    if (channel == null) {
      channel = new RandomAccessFile(file, "r").getChannel();
    }
    return channel;
  }

  @Override
  protected long getContentLength() {
    return file.length();
  }

  @Override
  protected void copyContentInto(ByteBuf target) throws IOException {
    // can return -1 if file is empty or FileChannel was closed
    int transferred = target.writeBytes(getChannel(), target.writableBytes());
    if (transferred > 0) {
      position += transferred;
    }
    if (position == file.length() || transferred < 0) {
      state = PartImplState.POST_CONTENT;
      if (channel.isOpen()) {
        channel.close();
      }
    }
  }

  @Override
  public void close() {
    super.close();
    closeSilently(channel);
  }
}


text:
/**
*  @mixin Task
*  @property {String}  title       The task's title
*  @property {String}  description The task's description
*  @property {Date}    deadline    The task's deadline
*  @property {INTEGER} priority    The task's priority
*  @property {BOOLEAN} status      The task's status ('Done','Undone')
*  @property {INTEGER} evaluation  The task's evaluation
*/

/**
* This Function define the model of the task Object
* @param  {sequelize} connection the instance of the sequelize Object
* @ignore
*/
module.exports.defineTask = function(sequelize) {
     var Sequelize = require("sequelize");

     module.exports.Task = sequelize.define('task', {
          title: {
               type: Sequelize.STRING,
               allowNull: false
          },
          description: {
            type: Sequelize.TEXT,
            allowNull: true
          },
          deadline: {
               type: Sequelize.DATE,
               allowNull: false
          },
          priority: {
               type: Sequelize.INTEGER,
               allowNull: false
          },
          status: {
               type: Sequelize.ENUM('New', 'In Progress', 'Ready', 'Done'),
               allowNull: false
          },
          evaluation: {
               type: Sequelize.INTEGER,
               allowNull: true
          }

     },
     {
          underscored: true,
          underscoredAll: true,
          instanceMethods:
          /** @lends Task.prototype */
          {

               /**
               * This function checks if the task is done.
               * @return {Boolean} true if the task is done.
               */
               isDone: function() {
                    return this.status === 'Done';
               },
               /**
               * This function checks if the task is new.
               * @return {Boolean} true if the task is new.
               */
               isNew: function() {
                    return this.status === 'New';
               },
               /**
               * This function checks if the task is In Progress.
               * @return {Boolean} true if the task is In Progress.
               */
               isInProgress: function() {
                    return this.status === 'In Progress';
               },
               /**
               * This function checks if the task is Ready.
               * @return {Boolean} true if the task is Ready.
               */
               isReady: function() {
                    return this.status === 'Ready';
               }

          }
     });
};


text:
<!DOCTYPE HTML>

<title>NOKSwapRegion2 (LWJGL 3.1.0 - EGL)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2016-10-30">
<link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

SEARCH:
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package org.lwjgl.egl

Class NOKSwapRegion2

java.lang.Object

org.lwjgl.egl.NOKSwapRegion2

public class NOKSwapRegion2
extends java.lang.Object

Native bindings to the NOK_swap_region2 extension.

This extension adds a new function which provides an alternative to eglSwapBuffers. eglSwapBuffersRegion2NOK accepts two new parameters in addition to
 those in eglSwapBuffers. The new parameters consist of a pointer to a list of 4-integer blocks defining rectangles (x, y, width, height) and an integer
 specifying the number of rectangles in the list.

The new parameters allow users to declare the region of the surface that has been updated. The implementation uses this information to transfer the
 updated region to the front buffer. Only the pixels within the specified region are copied; any rendering outside that region will not become visible
 on the window surface. This in contrast with the EGL_NOK_swap_region extension which treats the modified region only as a hint.

This functional change is aimed at further reducing the processing and bandwidth requirements of optimizations of applications whose graphics are
 commonly subjected to region-based changes. Specifically, this extension enables partial surface updates without requiring the use of preserved swaps.

Requires EGL 1.4.

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static boolean
eglSwapBuffersRegion2NOK(long dpy,
                        long surface,
                        int[] rects)

Array version of: SwapBuffersRegion2NOK

static boolean
eglSwapBuffersRegion2NOK(long dpy,
                        long surface,
                        java.nio.IntBuffer rects)

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

eglSwapBuffersRegion2NOK

public static boolean eglSwapBuffersRegion2NOK(long dpy,
                                               long surface,
                                               java.nio.IntBuffer rects)

eglSwapBuffersRegion2NOK

public static boolean eglSwapBuffersRegion2NOK(long dpy,
                                               long surface,
                                               int[] rects)

Array version of: SwapBuffersRegion2NOK

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright LWJGL. All Rights Reserved. License terms.


text:
<?php declare(strict_types=1);
namespace ImboClient;

use GuzzleHttp\Client as GuzzleHttpClient;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Uri;
use ImboClient\Exception\ClientException;
use ImboClient\Exception\InvalidArgumentException;
use ImboClient\Exception\InvalidLocalFileException;
use ImboClient\Exception\RequestException;
use ImboClient\Exception\RuntimeException;
use ImboClient\Middleware\Authenticate;
use ImboClient\Response\AccessControlRule;
use ImboClient\Response\AccessControlRules;
use ImboClient\Response\AddedImage;
use ImboClient\Response\AddedShortUrl;
use ImboClient\Response\DeletedImage;
use ImboClient\Response\DeletedShortUrl;
use ImboClient\Response\DeletedShortUrls;
use ImboClient\Response\ImageProperties;
use ImboClient\Response\Images;
use ImboClient\Response\PublicKey;
use ImboClient\Response\ResourceGroup;
use ImboClient\Response\ResourceGroups;
use ImboClient\Response\Stats;
use ImboClient\Response\Status;
use ImboClient\Response\User;
use ImboClient\Url\AccessTokenUrl;
use ImboClient\Url\ImageUrl;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;

class Client
{
    public const MAJOR_VERSION = 3;

    /** @var array<string> */
    private array $baseUrls;
    private string $user;
    private string $publicKey;
    private string $privateKey;
    private GuzzleHttpClient $httpClient;

    /**
     * Class constructor
     *
     * @param string|array<string> $baseUrls URL(s) to the Imbo server
     * @param string $user User for imbo
     * @param string $publicKey Public key for user
     * @param string $privateKey Private key for user
     * @param GuzzleHttpClient $httpClient Pre-configured HTTP client
     */
    public function __construct($baseUrls, string $user, string $publicKey, string $privateKey, GuzzleHttpClient $httpClient = null)
    {
        if (!is_array($baseUrls)) {
            $baseUrls = [$baseUrls];
        }

        $this->baseUrls = array_map(fn (string $url): string => rtrim($url, '/'), $baseUrls);
        $this->user = $user;
        $this->publicKey = $publicKey;
        $this->privateKey = $privateKey;

        if (null === $httpClient) {
            $handler = HandlerStack::create();
            $handler->push(new Authenticate($this->publicKey, $this->privateKey));
            $httpClient = new GuzzleHttpClient([
                'handler' => $handler,
                'headers' => [
                    'User-Agent' => 'ImboClient/' . self::MAJOR_VERSION,
                ],
            ]);
        }

        $this->httpClient = $httpClient;
    }

    /**
     * @throws RequestException
     */
    public function getServerStatus(): Status
    {
        try {
            $response = $this->getHttpResponse(
                $this->getUrlForPath('status.json'),
            );
        } catch (RequestException $e) {
            $previous = $e->getPrevious();

            if (!$previous instanceof ServerException) {
                throw $e;
            }

            $response = $previous->getResponse();
        }

        return Status::fromHttpResponse($response);
    }

    public function getServerStats(): Stats
    {
        return Stats::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('stats.json'),
            ),
        );
    }

    public function getUserInfo(): User
    {
        return User::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('users/' . $this->user . '.json'),
            ),
        );
    }

    public function getImages(ImagesQuery $query = null): Images
    {
        $query = $query ?: new ImagesQuery();
        return Images::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('users/' . $this->user . '/images.json'),
                [
                    'query' => $query->toArray(),
                ],
            ),
            $query,
        );
    }

    /**
     * @param string $image Path to a local file, a URL, or a blob
     */
    public function addImage(string $image): AddedImage
    {
        if (preg_match('|^https?://|', $image)) {
            return $this->addImageFromUrl($image);
        }

        try {
            return $this->addImageFromPath($image);
        } catch (InvalidLocalFileException $e) {
            // not a local file
        }

        return $this->addImageFromString($image);
    }

    public function addImageFromString(string $blob): AddedImage
    {
        return AddedImage::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('users/' . $this->user . '/images'),
                [
                    'body' => $blob,
                ],
                'POST',
                true,
            ),
        );
    }

    public function addImageFromPath(string $path): AddedImage
    {
        $this->validateLocalFile($path);
        return $this->addImageFromString(file_get_contents($path));
    }

    /**
     * @throws RuntimeException
     */
    public function addImageFromUrl(string $url): AddedImage
    {
        try {
            $blob = $this->httpClient->get($url)->getBody()->getContents();
        } catch (BadResponseException $e) {
            throw new RuntimeException('Unable to fetch file at URL: ' . $url, (int) $e->getCode(), $e);
        }

        return $this->addImageFromString($blob);
    }

    public function deleteImage(string $imageIdentifier): DeletedImage
    {
        return DeletedImage::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier,
                ),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function getImageProperties(string $imageIdentifier): ImageProperties
    {
        return ImageProperties::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier,
                ),
                [],
                'HEAD',
            ),
        );
    }

    public function getMetadata(string $imageIdentifier): array
    {
        return Utils::convertResponseToArray(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier . '/metadata.json',
                    $this->getHostForImageIdentifier($imageIdentifier),
                ),
            ),
        );
    }

    public function setMetadata(string $imageIdentifier, array $metadata): array
    {
        return Utils::convertResponseToArray(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier . '/metadata',
                ),
                [
                    'json' => $metadata,
                ],
                'PUT',
                true,
            ),
        );
    }

    public function updateMetadata(string $imageIdentifier, array $metadata): array
    {
        return Utils::convertResponseToArray(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier . '/metadata',
                ),
                [
                    'json' => $metadata,
                ],
                'POST',
                true,
            ),
        );
    }

    public function deleteMetadata(string $imageIdentifier): array
    {
        return Utils::convertResponseToArray(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier . '/metadata',
                ),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function getImageUrl(string $imageIdentifier): ImageUrl
    {
        return new ImageUrl(
            $this->getHostForImageIdentifier($imageIdentifier) . '/users/' . $this->user . '/images/' . $imageIdentifier,
            $this->privateKey,
        );
    }

    public function addShortUrl(ImageUrl $imageUrl): AddedShortUrl
    {
        return AddedShortUrl::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageUrl->getImageIdentifier() . '/shorturls',
                ),
                [
                    'json' => [
                        'user'            => $this->user,
                        'imageIdentifier' => $imageUrl->getImageIdentifier(),
                        'extension'       => $imageUrl->getExtension(),
                        'query'           => $imageUrl->getQuery() ?: null,
                    ],
                ],
                'POST',
                true,
            ),
        );
    }

    public function deleteImageShortUrls(string $imageIdentifier): DeletedShortUrls
    {
        return DeletedShortUrls::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $imageIdentifier . '/shorturls',
                ),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function getShortUrlProperties(string $shortUrlId): ImageProperties
    {
        return ImageProperties::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    's/' . $shortUrlId,
                ),
                [],
                'HEAD',
            ),
        );
    }

    public function deleteShortUrl(string $shortUrlId): DeletedShortUrl
    {
        $properties = $this->getShortUrlProperties($shortUrlId);
        return DeletedShortUrl::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath(
                    'users/' . $this->user . '/images/' . $properties->getImageIdentifier() . '/shorturls/' . $shortUrlId,
                ),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function imageExists(string $path): bool
    {
        $this->validateLocalFile($path);
        $checksum = md5_file($path);
        $query = new ImagesQuery();
        $images = $this->getImages(
            $query
                ->withOriginalChecksums([$checksum])
                ->withLimit(1),
        );

        return 0 < count($images);
    }

    public function imageIdentifierExists(string $imageIdentifier): bool
    {
        try {
            $this->getImageProperties($imageIdentifier);
        } catch (ClientException $e) {
            if (404 === $e->getCode()) {
                return false;
            }

            throw $e;
        }

        return true;
    }

    public function getImageData(string $imageIdentifier): string
    {
        return $this->getImageDataFromUrl($this->getImageUrl($imageIdentifier));
    }

    /**
     * @throws RuntimeException
     */
    public function getImageDataFromUrl(ImageUrl $url): string
    {
        try {
            $blob = $this->httpClient->get($url)->getBody()->getContents();
        } catch (BadResponseException $e) {
            throw new RuntimeException('Unable to fetch file at URL: ' . $url, (int) $e->getCode(), $e);
        }

        return $blob;
    }

    /**
     * @param array<string> $resources
     * @throws InvalidArgumentException
     */
    public function addResourceGroup(string $name, array $resources = []): ResourceGroup
    {
        $this->validateResourceGroupName($name);

        if ($this->resourceGroupExists($name)) {
            throw new InvalidArgumentException('Resource group already exists');
        }

        return ResourceGroup::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('groups'),
                [
                    'json' => [
                        'name'      => $name,
                        'resources' => $resources,
                    ],
                ],
                'POST',
                true,
            ),
        );
    }

    /**
     * @param array<string> $resources
     */
    public function updateResourceGroup(string $name, array $resources = []): ResourceGroup
    {
        $this->validateResourceGroupName($name);
        return ResourceGroup::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('groups/' . $name),
                [
                    'json' => [
                        'resources' => $resources,
                    ],
                ],
                'PUT',
                true,
            ),
        );
    }

    public function deleteResourceGroup(string $name): ResourceGroup
    {
        $this->validateResourceGroupName($name);
        return ResourceGroup::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('groups/' . $name),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function resourceGroupExists(string $name): bool
    {
        try {
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('groups/' . $name),
                [
                    'query' => [
                        'publicKey' => $this->publicKey,
                    ],
                ],
                'HEAD',
            );
        } catch (ClientException $e) {
            if (404 === $e->getCode()) {
                return false;
            }

            throw $e;
        }

        return true;
    }

    public function getResourceGroup(string $name): ResourceGroup
    {
        $this->validateResourceGroupName($name);
        return ResourceGroup::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('groups/' . $name),
                [
                    'query' => [
                        'publicKey' => $this->publicKey,
                    ],
                ],
            ),
        );
    }

    public function getResourceGroups(Query $query = null): ResourceGroups
    {
        $query = $query ?: new Query();
        return ResourceGroups::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('groups'),
                [
                    'query' => array_merge(
                        $query->toArray(),
                        [
                            'publicKey' => $this->publicKey,
                        ],
                    ),
                ],
            ),
            $query,
        );
    }

    public function addPublicKey(string $publicKey, string $privateKey): PublicKey
    {
        $this->validatePublicKeyName($publicKey);

        if ($this->publicKeyExists($publicKey)) {
            throw new InvalidArgumentException('Public key already exists');
        }

        return PublicKey::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('keys'),
                [
                    'json' => [
                        'publicKey'  => $publicKey,
                        'privateKey' => $privateKey,
                    ],
                ],
                'POST',
                true,
            ),
        );
    }

    public function updatePublicKey(string $publicKey, string $privateKey): PublicKey
    {
        $this->validatePublicKeyName($publicKey);

        if (!$this->publicKeyExists($publicKey)) {
            throw new InvalidArgumentException('Public key does not exist');
        }

        return PublicKey::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('keys/' . $publicKey),
                [
                    'json' => [
                        'privateKey' => $privateKey,
                    ],
                ],
                'PUT',
                true,
            ),
        );
    }

    public function deletePublicKey(string $publicKey): PublicKey
    {
        $this->validatePublicKeyName($publicKey);

        if (!$this->publicKeyExists($publicKey)) {
            throw new InvalidArgumentException('Public key does not exist');
        }

        return PublicKey::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('keys/' . $publicKey),
                [],
                'DELETE',
                true,
            ),
        );
    }

    public function publicKeyExists(string $publicKey): bool
    {
        $this->validatePublicKeyName($publicKey);

        try {
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('keys/' . $publicKey),
                [
                    'query' => [
                        'publicKey' => $this->publicKey,
                    ],
                ],
                'HEAD',
            );
        } catch (ClientException $e) {
            if (404 === $e->getCode()) {
                return false;
            }

            throw $e;
        }

        return true;
    }

    public function getAccessControlRules(string $publicKey): AccessControlRules
    {
        $this->validatePublicKeyName($publicKey);
        return AccessControlRules::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('keys/' . $publicKey . '/access.json'),
                [
                    'query' => [
                        'publicKey' => $this->publicKey,
                    ],
                ],
                'GET',
            ),
        );
    }

    public function getAccessControlRule(string $publicKey, string $ruleId): AccessControlRule
    {
        $this->validatePublicKeyName($publicKey);
        return AccessControlRule::fromHttpResponse(
            $this->getHttpResponse(
                $this->getAccessTokenUrlForPath('keys/' . $publicKey . '/access/' . $ruleId . '.json'),
                [
                    'query' => [
                        'publicKey' => $this->publicKey,
                    ],
                ],
            ),
        );
    }

    public function addAccessControlRules(string $publicKey, array $rules): AccessControlRules
    {
        $this->validatePublicKeyName($publicKey);
        return AccessControlRules::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('keys/' . $publicKey . '/access.json'),
                [
                    'json' => $rules,
                ],
                'POST',
                true,
            ),
        );
    }

    public function deleteAccessControlRule(string $publicKey, string $ruleId): AccessControlRule
    {
        $this->validatePublicKeyName($publicKey);
        return AccessControlRule::fromHttpResponse(
            $this->getHttpResponse(
                $this->getUrlForPath('keys/' . $publicKey . '/access/' . $ruleId . '.json'),
                [],
                'DELETE',
                true,
            ),
        );
    }

    private function getAccessTokenUrlForPath(string $path, string $baseUrl = null): AccessTokenUrl
    {
        return new AccessTokenUrl(
            ($baseUrl ?: $this->baseUrls[0]) . '/' . $path,
            $this->privateKey,
        );
    }

    private function getUrlForPath(string $path, string $baseUrl = null): UriInterface
    {
        return new Uri(
            ($baseUrl ?: $this->baseUrls[0]) . '/' . $path,
        );
    }

    /**
     * @param array<string,mixed> $options
     */
    private function getHttpResponse(UriInterface $url, array $options = [], string $method = 'GET', bool $requireSignature = false): ResponseInterface
    {
        try {
            return $this->httpClient->request(
                $method,
                $url,
                array_merge(
                    $options,
                    [
                        'require_imbo_signature' => $requireSignature,
                    ],
                ),
            );
        } catch (BadResponseException $e) {
            throw new RequestException('Imbo request failed', $e->getRequest(), $e->getResponse(), $e);
        }
    }

    /**
     * Get a predictable hostname for the given image identifier
     *
     * @param string $imageIdentifier The image identifier
     * @return string
     */
    private function getHostForImageIdentifier(string $imageIdentifier): string
    {
        if (1 === count($this->baseUrls)) {
            return $this->baseUrls[0];
        }

        $dec = ord($imageIdentifier[-1]);
        return $this->baseUrls[$dec % count($this->baseUrls)];
    }

    /**
     * @param string $path
     * @throws InvalidLocalFileException
     */
    private function validateLocalFile(string $path): void
    {
        if (!is_file($path)) {
            throw new InvalidLocalFileException('File does not exist: ' . $path);
        }

        if (!filesize($path)) {
            throw new InvalidLocalFileException('File is of zero length: ' . $path);
        }
    }

    private function validateResourceGroupName(string $name): void
    {
        if (!preg_match('/^[a-z0-9_-]+$/', $name)) {
            throw new InvalidArgumentException(
                'Group name can only consist of: a-z, 0-9 and the characters _ and -',
            );
        }
    }

    private function validatePublicKeyName(string $name): void
    {
        if (!preg_match('/^[a-z0-9_-]+$/', $name)) {
            throw new InvalidArgumentException(
                'Public key can only consist of: a-z, 0-9 and the characters _ and -',
            );
        }
    }
}


text:
/************************************************************
 * Student Name:     TreeBots                               *
 * Exercise Name:    Ex6                                    *
 * File description: Declaration of Vector Class            *
 ***********************************************************/

#ifndef __Robocup__WaitBodyStateUpdateNode__
#define __Robocup__WaitBodyStateUpdateNode__

#include "BehaviorTreeNode.h"

namespace behavior {

    /****************************************************************************************************
     * TurnNode Class:        This command will turn the player's body direction Moment                 *
     *                        degrees relative to the current direction.                                *
     ***************************************************************************************************/

    class WaitBodyStateUpdateNode : public BehaviorTreeNode {

    public:
        WaitBodyStateUpdateNode();
        ~WaitBodyStateUpdateNode();

        virtual StatusType process();

    };

}

#endif


text:
using System;
using System.Collections.Generic;
using System.Reflection;
using NUnit.Framework.Internal;

#if NETFRAMEWORK
using System.Runtime.Remoting.Messaging;
#endif

namespace NUnit.Framework.Assertions
{
    public class AdhocTestExecutionTests
    {
        // These unit tests demonstrate that the user can call a test directly
        // and have it execute. Only information from exceptions thrown is
        // available in this case, but it appears that a number of users do this.
        // When a user calls a test method directly, without use of NUnit,
        // the TestExecutionContext is null. We provide an AdhocContext in
        // that case, so that the tests can run. The technique is not useful
        // with warnings or multiple asserts, but will at least run without
        // crashing.

        [TestCaseSource(typeof(AdhocTests), nameof(AdhocTests.TestMethods))]
        public void CanCallAssertWithoutTestExecutionContext(MethodInfo method)
        {
            var savedContext = ClearExecutionContext();
            Exception testException = null;

            try
            {
                // Currently, we know all the tests are static, without arguments
                method.Invoke(null, null);
            }
            catch(Exception ex)
            {
                testException = ex is TargetInvocationException
                    ? ex.InnerException
                    : ex;
            }
            finally
            {
                RestoreExecutionContext(savedContext);
            }

            // Throw any exception we got only after context is restored
            if (testException != null)
                throw testException;
        }

#if !NETFRAMEWORK
        private TestExecutionContext ClearExecutionContext()
        {
            var savedContext = TestExecutionContext.CurrentContext;
            TestExecutionContext.CurrentContext = null;
            return savedContext;
        }

        private void RestoreExecutionContext(TestExecutionContext savedContext)
        {
            TestExecutionContext.CurrentContext = savedContext;
        }
#else
        private TestExecutionContext ClearExecutionContext()
        {
            var savedContext = TestExecutionContext.CurrentContext;
            CallContext.FreeNamedDataSlot(NUnitCallContext.TestExecutionContextKey);
            return savedContext;
        }

        private void RestoreExecutionContext(TestExecutionContext savedContext)
        {
            CallContext.SetData(NUnitCallContext.TestExecutionContextKey, savedContext);
        }
#endif

        static class AdhocTests
        {
            private static readonly MethodInfo[] _methods =
                typeof(AdhocTests).GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

            public static IEnumerable<MethodInfo> TestMethods
            {
                get
                {
                    foreach (var method in _methods)
                        if (method.Name.StartsWith("Test"))
                            yield return method;
                }
            }

            static public void TestValidContext()
            {
                Assert.NotNull(TestExecutionContext.CurrentContext);
                Assert.That(TestExecutionContext.CurrentContext, Is.TypeOf<TestExecutionContext.AdhocContext>());
            }

            static public void TestPassingAssert()
            {
                Assert.That(true, Is.True);
            }

            static public void TestPassingAssumption()
            {
                Assume.That(true, Is.True);
            }

            static public void TestPassingWarning()
            {
                Warn.Unless(true, Is.True);
            }

            static public void TestFailingAssertion()
            {
                Assert.That(() => Assert.That(true, Is.False), Throws.TypeOf<AssertionException>());
            }

            static public void TestFailingAssumption()
            {
                Assert.That(() => Assume.That(true, Is.False), Throws.TypeOf<InconclusiveException>());
            }

            static public void TestFailingWarning()
            {
                // Warnings don't throw at all. They are of no use in ad-hoc execution.
                Assert.That(() => Warn.Unless(true, Is.False), Throws.Nothing);
            }

            static public void TestAssertPass()
            {
                Assert.That(() => Assert.Pass(), Throws.TypeOf<SuccessException>());
            }

            static public void TestAssertInconclusive()
            {
                Assert.That(() => Assert.Inconclusive(), Throws.TypeOf<InconclusiveException>());
            }

            static public void TestAssertIgnore()
            {
                Assert.That(() => Assert.Ignore(), Throws.TypeOf<IgnoreException>());
            }

            static public void TestAssertFail()
            {
                Assert.That(() => Assert.Fail(), Throws.TypeOf<AssertionException>());
            }

            static public void TestAssertMultiple_AllAssertsPassing()
            {
                Assert.Multiple(() =>
                {
                    Assert.That(2 + 2, Is.EqualTo(4));
                    Assert.That(2 * 2, Is.EqualTo(4));
                    Assert.That(2 - 2, Is.EqualTo(0));
                    Assert.That(2 / 2, Is.EqualTo(1));
                });
            }

            static public void TestAssertMultiple_OneAssertFailing()
            {
                Assert.That(() =>
                    Assert.Multiple(() =>
                    {
                        Assert.That(2 + 2, Is.EqualTo(5));
                        Assert.That(2 * 2, Is.EqualTo(4));
                        Assert.That(2 - 2, Is.EqualTo(0));
                        Assert.That(2 / 2, Is.EqualTo(1));
                    }),
                    Throws.TypeOf<MultipleAssertException>());
            }
        }
    }
}


text:
package com.lucidastar.observer;

public class Hobbits implements WeatherObserver {

	@Override
	public void update(WeatherType weatherType) {
		switch (weatherType) {
	      case COLD:
	        System.out.println("The hobbits are shivering in the cold weather.");
	        break;
	      case RAINY:
	        System.out.println("The hobbits look for cover from the rain.");
	        break;
	      case SUNNY:
	        System.out.println("The happy hobbits bade in the warm sun.");
	        break;
	      case WINDY:
	        System.out.println("The hobbits hold their hats tightly in the windy weather.");
	        break;
	      default:
	        break;
	    }

	}

}


text:
function  checkTrials  = get_missingTrials(temp)
%GET_MISSINGTRIALS finds missing trials in trials directory

if nargin < 1 || isempty(temp), temp = dir('trials/'); end

load('expt.mat')

%create trialList to contain all trial numbers in trials directory
nfiles = length(temp);
for i = 3:nfiles
    trialList(i-2) = str2double(temp(i).name(1:end-4));
end

%sort trial list
trialList = sort(trialList);

%create a numerical list from 1 to expt.ntrials (number of trials)
allTrials = 1:expt.ntrials;

%find missing trials and save to checkTrials
checkTrials = setdiff(allTrials,trialList)

end


text:
class Logger
{
public:
  Logger();

  virtual size_t append(const uint8_t* buf, size_t nbytes);
  virtual void flush();

  void msg(const char* msg);
  void vprintf(const char* format, va_list ap);
  void printf(const char* format, ...);
};

//
// PrintLogger
//
class PrintLogger : public Logger
{
private:
  Print& print_;

public:
  PrintLogger(Print& print);
  size_t append(const uint8_t* buf, size_t nbytes);
  void flush();
};

class NullLogger : public Logger
{
};

extern Logger& logger;

void setLogger(Logger& logger);

#endif // _LOGGER_HPP