text:
BOOL areIntDifferent(int thing1, int thing2){
    if (thing1 == thing2) {
        return (NO);
    } else {
        return (YES);
    }
}

NSString *boolString(BOOL yesNo){
    if (yesNo == NO) {
        return @"no";
    } else {
        return @"yes";
    }
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        BOOL areTheyDifferent;

        areTheyDifferent = areIntDifferent(5, 5);
        // 此处的%@标示是NSString类型的指针
        NSLog(@"are %d and %d different? %@",5 ,5, boolString(areTheyDifferent));

        areTheyDifferent = areIntDifferent(22, 34);

        NSLog(@"are %d and %d different? %@",5 ,5, boolString(areTheyDifferent));

    }
    return 0;
}


text:
package geotrigger

import (
	"github.com/Esri/geotrigger-go/geotrigger/test"
	"sync"
	"testing"
	"time"
)

func TestNewTokenManager(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)
	test.Refute(t, tm, nil)
	test.Expect(t, tm.getAccessToken(), "acc")
	test.Expect(t, tm.getRefreshToken(), "rfr")

	tm.setAccessToken("merp")
	test.Expect(t, tm.getAccessToken(), "merp")
}

func TestSimpleTokenRequest(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)

	// access token req
	tr := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}
	go tm.tokenRequest(tr)

	tokenResp := <-tr.tokenResponses
	test.Refute(t, tokenResp, nil)
	test.Expect(t, tokenResp.isAccessToken, true)
	test.Expect(t, tokenResp.token, "acc")

	// refresh token req
	tr = &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}
	go tm.tokenRequest(tr)

	tokenResp = <-tr.tokenResponses
	test.Refute(t, tokenResp, nil)
	test.Expect(t, tokenResp.isAccessToken, false)
	test.Expect(t, tokenResp.token, "rfr")
}

func TestUnknownPurposeInt(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)

	tr := &tokenRequest{
		purpose:        39846,
		tokenResponses: make(chan *tokenResponse),
	}
	go tm.tokenRequest(tr)

	tokenResp := <-tr.tokenResponses
	test.Expect(t, tokenResp, nil)
}

func TestConcurrentTokenAccess(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)

	tr1 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr2 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr3 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr4 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr1)
	go tm.tokenRequest(tr2)
	go tm.tokenRequest(tr3)
	go tm.tokenRequest(tr4)

	var w sync.WaitGroup
	w.Add(4)
	go func() {
		tokenResp := <-tr1.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr2.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr3.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr4.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "acc")
		w.Done()
	}()
	w.Wait()
}

func TestTokenExpiry(t *testing.T) {
	// refresh succeeds first
	tm := newTokenManager("acc", "rfr", -100)

	tr1 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr2 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr3 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr4 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr1)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr1 arrives first
	go tm.tokenRequest(tr2)
	go tm.tokenRequest(tr3)
	go tm.tokenRequest(tr4)

	var w sync.WaitGroup
	w.Add(4)
	go func() {
		tokenResp := <-tr1.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	go func() {
		tokenResp := <-tr2.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr3.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr4.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	w.Wait()

	// refresh fails first
	tm.setExpiresAt(-100)
	tr5 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr6 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr7 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr8 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr5)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr5 arrives first
	go tm.tokenRequest(tr6)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr6 arrives second
	go tm.tokenRequest(tr7)
	go tm.tokenRequest(tr8)

	w.Add(4)
	go func() {
		tokenResp := <-tr5.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		rc := &tokenRequest{
			purpose:        refreshFailed,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	go func() {
		tokenResp := <-tr6.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}

		go tm.tokenRequest(rc)
		w.Done()
	}()
	go func() {
		tokenResp := <-tr7.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr8.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	w.Wait()
}

func TestMultipleRoutinesNeedRefreshToken(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)

	// refresh succeeds first
	tr1 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr2 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr3 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr4 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr1)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr1 arrives first
	go tm.tokenRequest(tr2)
	go tm.tokenRequest(tr3)
	go tm.tokenRequest(tr4)

	var w sync.WaitGroup
	w.Add(4)
	go func() {
		tokenResp := <-tr2.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr3.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr4.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr1.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	w.Wait()

	// refresh fails first
	tr5 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr6 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr7 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr8 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr5)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr5 arrives first
	go tm.tokenRequest(tr6)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr6 arrives second
	go tm.tokenRequest(tr7)
	go tm.tokenRequest(tr8)

	w.Add(4)
	go func() {
		tokenResp := <-tr7.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr8.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr6.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	go func() {
		tokenResp := <-tr5.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		rc := &tokenRequest{
			purpose:        refreshFailed,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	w.Wait()
}

func TestRefreshWithMultipleRoutinesNeedAccessToken(t *testing.T) {
	tm := newTokenManager("acc", "rfr", 1800)

	// refresh succeeds first
	tr1 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr2 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr3 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr4 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr1)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr1 arrives first
	go tm.tokenRequest(tr2)
	go tm.tokenRequest(tr3)
	go tm.tokenRequest(tr4)

	var w sync.WaitGroup
	w.Add(4)
	go func() {
		tokenResp := <-tr2.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr3.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr4.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr1.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	w.Wait()

	// refresh fails first
	tr5 := &tokenRequest{
		purpose:        refreshNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr6 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr7 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	tr8 := &tokenRequest{
		purpose:        accessNeeded,
		tokenResponses: make(chan *tokenResponse),
	}

	go tm.tokenRequest(tr5)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr5 arrives first
	go tm.tokenRequest(tr6)
	time.Sleep(20 * time.Millisecond) // pause to ensure tr6 arrives second
	go tm.tokenRequest(tr7)
	go tm.tokenRequest(tr8)

	w.Add(4)
	go func() {
		tokenResp := <-tr7.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr8.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, true)
		test.Expect(t, tokenResp.token, "new acc")
		w.Done()
	}()
	go func() {
		tokenResp := <-tr6.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		tm.setAccessToken("new acc")
		rc := &tokenRequest{
			purpose:        refreshComplete,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	go func() {
		tokenResp := <-tr5.tokenResponses
		test.Refute(t, tokenResp, nil)
		test.Expect(t, tokenResp.isAccessToken, false)
		test.Expect(t, tokenResp.token, "rfr")

		rc := &tokenRequest{
			purpose:        refreshFailed,
			tokenResponses: nil,
		}
		go tm.tokenRequest(rc)
		w.Done()
	}()
	w.Wait()
}

redpajama_set_name: RedPajamaGithub


text:
from __future__ import division, unicode_literals, print_function
from django.db import models

class SingletonModel(models.Model):

    class Meta:
        abstract = True

    def save(self, *args, **kwargs):
        self.id=1
        super(SingletonModel, self).save(*args, **kwargs)

    def delete(self, *args, **kwargs):
        pass

    @classmethod
    def only_one(cls):
        return cls.objects.get(id=1)


text:
<?php

namespace PhpSpec\Extension;

use PhpSpec\ServiceContainer;

/**
 * Interface ExtensionInterface is used for PhpSpec extensions to interface
 * with PhpSpec through the service container
 */
interface ExtensionInterface {

    /**
     * @param ServiceContainer $container
     */
    public function load(ServiceContainer $container);
}


text:
package stripe

import "encoding/json"

// ReversalParams is the set of parameters that can be used when reversing a transfer.
type ReversalParams struct {
	Params
	Transfer string
	Amount   uint64
	Fee      bool
}

// ReversalListParams is the set of parameters that can be used when listing reversals.
type ReversalListParams struct {
	ListParams
	Transfer string
}

// Reversal represents a transfer reversal.
type Reversal struct {
	ID       string            `json:"id"`
	Amount   uint64            `json:"amount"`
	Created  int64             `json:"created"`
	Currency Currency          `json:"currency"`
	Transfer string            `json:"transfer"`
	Meta     map[string]string `json:"metadata"`
}

// ReversalList is a list of object for reversals.
type ReversalList struct {
	ListMeta
	Values []*Reversal `json:"data"`
}

// UnmarshalJSON handles deserialization of a Reversal.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (r *Reversal) UnmarshalJSON(data []byte) error {
	type reversal Reversal
	var rr reversal
	err := json.Unmarshal(data, &rr)
	if err == nil {
		*r = Reversal(rr)
	} else {
		// the id is surrounded by "\" characters, so strip them
		r.ID = string(data[1 : len(data)-1])
	}

	return nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Asp.Net.JWT.Token.TokenBaseAuth
{
    public static class UserStorage
    {
        public static List<User> Users { get; set; } = new List<User> {
        new User {ID=Guid.NewGuid(),Username="user1",Password = "user1psd" },
        new User {ID=Guid.NewGuid(),Username="user2",Password = "user2psd" },
        new User {ID=Guid.NewGuid(),Username="user3",Password = "user3psd" }
    };
    }
}


text:
/**
 * Grid container
 */
#tiles {
list-style-type: none;
position: relative; /** Needed to ensure items are laid out relative to this container **/
margin: 0;
}

/**
 * Grid items
 */
#tiles li {
width: 200px;
background-color: #ffffff;
border: 1px solid #dedede;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
/**display: none; YSW Hide items initially to avoid a flicker effect **/display: none;
/*cursor: pointer;*/
padding: 10px;
margin-right:7px;margin-bottom:7px;float:left;/* YSW */
}

#tiles li img {
display: block;
}

/** Loader **/

#loader {
  height: 16px;
  text-align: center;
  padding: 25px 0 25px 0;
}

#loaderCircle {
  width: 16px;
  height: 16px;
margin: 0 auto;
  background-image: url('../images/loader.gif');
}


text:
import pytest

def test_access_key_upgrade(upgrader, access_key_1):
    value = upgrader.upgrade('access_key', access_key_1, target_version='2')
    assert value['schema_version'] == '2'
    assert value['status'] == 'current'


text:
namespace Glyph3
{
	class LuaScene
	{
	public:
		LuaScene();
		virtual ~LuaScene();

		static void Register( lua_State* L );
		static Scene* CheckType( lua_State* L, int n );

		static int Creator( lua_State* L );
		static int CreateExisting( lua_State* L, std::string& name, Scene* pScene );
		static int Destroyer( lua_State* L );

		static int AddActor( lua_State* L );
	};
};
//--------------------------------------------------------------------------------
#endif // LuaScene_h


text:
package com.croconaut.wifonmini;

import android.app.Application;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.util.Log;

import com.croconaut.cpt.data.Communication;
import com.croconaut.cpt.data.NearbyUser;
import com.croconaut.cpt.ui.CptController;

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

public class WifonMiniApplication extends Application implements NearbyManager {
    private static final String TAG = "WifonMiniApplication";

    private final ArrayList<NearbyListener> nearbyListeners = new ArrayList<>();
    private long latestNearbyUsersTimestamp = -1;
    private List<NearbyUser> latestNearbyUsers;

    @Override
    public void onCreate() {
        super.onCreate();

        WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
        List<WifiConfiguration> networks = wm.getConfiguredNetworks();
        if (networks != null) {
            // disable configured networks so we minimize the risk of something going wrong
            for (WifiConfiguration wifiConfiguration : networks) {
                wm.disableNetwork(wifiConfiguration.networkId);
            }
        }

        // first thing before any CPT related enquiry
        Communication.register(this, "User " + UUID.randomUUID().toString().substring(0, 20), CptBroadcastReceiver.class);

        CptController cptController = new CptController(this);
        if (cptController.isBatteryOptimizationModifiable()) {
            Log.i(TAG, "Disabling batter optimization");
            cptController.setBatteryOptimizationEnabled(false);
        }
        if (cptController.isWifiSleepPolicyModifiable()) {
            Log.i(TAG, "Setting WiFi sleep policy to 'never'");
            cptController.setWifiSleepPolicy(CptController.SleepPolicy.WIFI_SLEEP_POLICY_NEVER);
        }
        if (cptController.isDimScreenWorkaroundRecommended()) {
            Log.i(TAG, "Applying dim screen workaround");
            cptController.setDimScreenWorkaroundEnabled(true);
        }
    }

    @Override
    public void addNearbyListener(NearbyListener nearbyListener) {
        nearbyListeners.add(nearbyListener);
        if (latestNearbyUsersTimestamp != -1) {
            nearbyListener.onNearbyPeers(latestNearbyUsers);
        }
    }

    @Override
    public void removeNearbyListener(NearbyListener nearbyListener) {
        nearbyListeners.remove(nearbyListener);
    }

    @Override
    public void updateNearbyPeers(List<NearbyUser> nearbyPeers) {
        latestNearbyUsersTimestamp = System.currentTimeMillis();
        latestNearbyUsers = nearbyPeers;

        for (NearbyListener nearbyListener : nearbyListeners) {
            nearbyListener.onNearbyPeers(nearbyPeers);
        }
    }
}


text:
Router.map(function () {
  this.route('home', {
    path: '/',
    template: 'home',
    layoutTemplate: 'layout'
  });
});


text:
// RUN: %clang_cc1 -std=c++11 -verify %s

// Note that this puts the expected lines before the directives to work around
// limitations in the -verify mode.

void test(int *List, int Length) {
  int i = 0;

#pragma unroll
  while (i + 1 < Length) {
    List[i] = i;
  }

#pragma nounroll
  while (i < Length) {
    List[i] = i;
  }

#pragma unroll 4
  while (i - 1 < Length) {
    List[i] = i;
  }

#pragma unroll(8)
  while (i - 2 < Length) {
    List[i] = i;
  }

/* expected-error {{expected ')'}} */ #pragma unroll(4
/* expected-error {{missing argument; expected an integer value}} */ #pragma unroll()
/* expected-warning {{extra tokens at end of '#pragma unroll'}} */ #pragma unroll 1 2
  while (i-6 < Length) {
    List[i] = i;
  }

/* expected-warning {{extra tokens at end of '#pragma nounroll'}} */ #pragma nounroll 1
  while (i-7 < Length) {
    List[i] = i;
  }

/* expected-error {{expected ')'}} */ #pragma unroll(()
/* expected-error {{expected expression}} */ #pragma unroll -
/* expected-error {{invalid value '0'; must be positive}} */ #pragma unroll(0)
/* expected-error {{invalid value '0'; must be positive}} */ #pragma unroll 0
/* expected-error {{value '3000000000' is too large}} */ #pragma unroll(3000000000)
/* expected-error {{value '3000000000' is too large}} */ #pragma unroll 3000000000
  while (i-8 < Length) {
    List[i] = i;
  }

#pragma unroll
/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ int j = Length;
#pragma unroll 4
/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ int k = Length;
#pragma nounroll
/* expected-error {{expected a for, while, or do-while loop to follow '#pragma nounroll'}} */ int l = Length;

/* expected-error {{incompatible directives 'unroll(disable)' and '#pragma unroll(4)'}} */ #pragma unroll 4
#pragma clang loop unroll(disable)
  while (i-10 < Length) {
    List[i] = i;
  }

/* expected-error {{incompatible directives 'unroll(full)' and '#pragma unroll(4)'}} */ #pragma unroll(4)
#pragma clang loop unroll(full)
  while (i-11 < Length) {
    List[i] = i;
  }

/* expected-error {{incompatible directives 'unroll(enable)' and '#pragma unroll(4)'}} */ #pragma unroll(4)
#pragma clang loop unroll(enable)
  while (i-11 < Length) {
    List[i] = i;
  }

/* expected-error {{incompatible directives '#pragma unroll' and '#pragma unroll(4)'}} */ #pragma unroll(4)
#pragma unroll
  while (i-11 < Length) {
    List[i] = i;
  }

/* expected-error {{incompatible directives '#pragma nounroll' and 'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
#pragma nounroll
  while (i-12 < Length) {
    List[i] = i;
  }

/* expected-error {{duplicate directives '#pragma nounroll' and '#pragma nounroll'}} */ #pragma nounroll
#pragma nounroll
  while (i-13 < Length) {
    List[i] = i;
  }

/* expected-error {{duplicate directives '#pragma unroll' and '#pragma unroll'}} */ #pragma unroll
#pragma unroll
  while (i-14 < Length) {
    List[i] = i;
  }

/* expected-error {{duplicate directives 'unroll(full)' and '#pragma unroll'}} */ #pragma unroll
#pragma clang loop unroll(full)
  while (i-15 < Length) {
    List[i] = i;
  }

/* expected-error {{duplicate directives '#pragma unroll(4)' and '#pragma unroll(4)'}} */ #pragma unroll 4
#pragma unroll(4)
  while (i-16 < Length) {
    List[i] = i;
  }

#pragma unroll
/* expected-error {{expected statement}} */ }


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe NormalForm do
  it 'should order pitch classes so the largest interval is last' do
    [
      [0,3,5,8], [11,2,5], [7,11,4,6], [2,8,9],
    ].each do |input_pitch_classes|
      normal_form = NormalForm.new(input_pitch_classes)
      intervals = normal_form.interval_classes
      intervals.last.should eq(intervals.max)
    end
  end
end


text:
FactoryGirl.define do
  factory :performance_profile, class: Performance do
    value 1.5
    association :criterion, factory: :criterion
    association :performable, factory: :profile
  end

  factory :performance_alternative, class: Performance do
    value 2.5
    association :criterion, factory: :criterion
    association :performable, factory: :alternative
  end

  factory :performance, class: Performance do
    value 2.5
  end

  factory :invalid_performance, class: Performance do
    value nil
  end
end


text:
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\PengurusanProgramBinaanAtlet */

$this->title = 'Create Anugerah Ahli Jawatankuasa Pengelola Item';
$this->params['breadcrumbs'][] = ['label' => 'Anugerah Ahli Jawatankuasa Pengelola Item', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

    <?= $this->render('_form', [
        'model' => $model,
        'readonly' => $readonly,
    ]) ?>


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

<title>PriorityScheduler</title>
<meta name="date" content="2013-03-03">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Class PriorityScheduler

java.lang.Object

Scheduler

PriorityScheduler

public class PriorityScheduler
extends Scheduler

A rough implementation of the Priority scheduler that assigns randomly probabilities to
 processes and them executes them accordingly

Author:

nicolav0

Field Summary

Fields inherited from class Scheduler

processes, sliceSize

Constructor Summary

Constructors

Constructor and Description

PriorityScheduler()

Method Summary

Methods

Modifier and Type
Method and Description

void
run()

Methods inherited from class Scheduler

addProcess, getProcess

Methods inherited from class java.lang.Object

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

Constructor Detail

PriorityScheduler

public PriorityScheduler()

Method Detail

run

public void run()

Specified by:

run in class Scheduler

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
local copas = require "copas"
local socket = require "socket"

copas.loop(function()

  local client_socket
  local close_time
  local send_end_time
  local receive_end_time

  print "------------- starting close test ---------------"

  local function check_exit()
    if receive_end_time and send_end_time then
      -- both set, so we're done
      print "success!"
      os.exit(0)
    end
  end

  do -- set up a server that accepts but doesn't read or write anything
    local server = socket.bind("localhost", 20000)

    copas.addserver(server, copas.handler(function(conn_skt)
      -- client connected, we're not doing anything, let the client
      -- wait in the read/write queues
      copas.sleep(2)
      -- now we're closing the connecting_socket
      close_time = socket.gettime()
      print("closing client socket now, client receive and send operation should immediately error out now")
      client_socket:close()

      copas.sleep(10)
      conn_skt:close()
      copas.removeserver(server)
      print "timeout, test failed"
      os.exit(1)
    end))
  end

  do -- create a client that connect to the server
    client_socket = copas.wrap(socket.connect("localhost", 20000))

    copas.addthread(function()
      local data, err = client_socket:receive(1)
      print("receive result: ", tostring(data), tostring(err))
      receive_end_time = socket.gettime()
      print("receive took: ", receive_end_time - close_time)
      check_exit()
    end)

    copas.addthread(function()
      local ok, err = true, nil
      while ok do -- loop to fill any buffers, until we get stuck
        ok, err = client_socket:send(("hello world"):rep(100))
      end
      print("send result: ", tostring(ok), tostring(err))
      send_end_time = socket.gettime()
      print("send took: ", send_end_time - close_time)
      check_exit()
    end)
  end

end)


text:
import math
from sys import argv
import glob

def sample_variance(my_list):
    variance = 0
    mean = average(my_list)
    for i in my_list:
        variance += (mean - i) ** 2
    return variance / (len(my_list) - 1)

def average(my_list):
    return sum(my_list) / len(my_list)

def calculate_error(my_list):
    error = 2 * math.sqrt(sample_variance(my_list) / len(my_list))
    return average(my_list), error

def conf_interval(output_name):
    result_rounds = dict()
    final_result = dict()
    runs = glob.glob(output_name+'*iperfTCP.data')
    print "Getting Confidence Intervals for " + argv[1] + " using {num_runs} runs".format(num_runs=len(runs))
    for output_data in runs:
        with open(output_data) as input_file:
            for line in input_file:
                values = line.split(' ')
                current_time = float(values[0])
                current_bitrate = float(values[1])
                result_rounds.setdefault(current_time, []).append(current_bitrate)

    for key, value in result_rounds.iteritems():
        if len(value) > 1:
            result, error = calculate_error(value)
            final_result[key] = result, error

    with open(output_name + '-conf.data', 'w') as the_file:
        for key, value in sorted(final_result.iteritems()):
            the_file.write('{time} {bitrate} {error}\n'.format(time=key, bitrate=value[0], error=value[1]))

if len(argv) == 2:
    conf_interval(argv[1])


text:
// Create a function that gets the value of <input type="text"> ands prints its value to the console
function getValue() {
    var el = document.getElementById("input").value;
    console.log(el);
}


text:
	<input type="text" class="form-control" ng-model="notebookFilter" placeholder="{{'NARROW_DOWN'|translate}}" />

		{{notebook.name}}


text:
import os
import logging

from conf.config import SITE_ROOT

class LogManager(object):
    def __init__(self, logFile="", logLevel=0, logTree=""):
        logFile = SITE_ROOT+"/log/" + logFile
        try:
            self.logger = self._configLogger(
                logFile=logFile, logLevel=logLevel, logTree=logTree)
        except Exception, e:
            raise Exception

    def _configLogger(self, logFile="", logLevel=0, logTree=""):
        '''配置logging的日志文件以及日志的记录等级'''
        logger = logging.getLogger(logTree)
        LEVELS = {
            1: logging.CRITICAL,
            2: logging.ERROR,
            3: logging.WARNING,
            4: logging.INFO,
            5: logging.DEBUG,  # 数字最大记录最详细
        }
        formatter = logging.Formatter(
            '%(asctime)s %(threadName)s %(levelname)s %(message)s')

        done = False

        while not done:
            try:
                fileHandler = logging.FileHandler(logFile)
            except IOError as e:
                if e.args[0] == 2 and e.filename:
                    # "Most likely the full path to the \
                    # file doesn't exit,so we will create one."
                    fp = e.filename[:e.filename.rfind("/")]

                    if not os.path.exists(fp):
                        os.makedirs(fp)
                else:
                    # "Most likely some other error...\
                    # let's just reraise for now"
                    raise
            else:
                done = True

        fileHandler.setFormatter(formatter)
        logger.addHandler(fileHandler)
        logger.setLevel(LEVELS.get(logLevel))
        return logger


text:
package org.apache.wicket.cdi;

import org.apache.wicket.Page;
import org.apache.wicket.core.request.handler.IPageRequestHandler;
import org.apache.wicket.request.IRequestHandler;

/**
 * A strategy that specifies how conversations should be propagated between
 * pages/resources. {@link ConversationPropagation} provides sensible default
 * implementations of this interface.
 *
 * @author papegaaij
 */
@FunctionalInterface
public interface IConversationPropagation
{
	/**
	 * Indicates if the conversation should be propagated via url-parameters for
	 * the given request handler and page (if any). A conversation is always
	 * propagated via the cid query parameter.
	 *
	 * @param handler
	 *            The current request handler
	 * @param page
	 *            The page associated with the request handler, or null if the
	 *            handler is not an {@link IPageRequestHandler}.
	 * @return true if the conversation should be propagated for the given
	 *         request handler.
	 */
	boolean propagatesVia(IRequestHandler handler, Page page);
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CkanDotNet.Web.Models
{
    public class MetaTags
    {
        public string Description { get; set; }
        public string Keywords { get; set; }
    }
}


text:
package com.spacetofu.umlaut.model;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import com.spacetofu.umlaut.model.note.Note;
import com.spacetofu.umlaut.model.note.NoteFactory;

public class DBHelper {

   private static final String 	DATABASE_NAME 	= "umlaut.db";
   private static final int 	DATABASE_VERSION 	= 13;

   private static final String T_NOTES 			= "unotes_extended";
   private static final String T_LOCATIONS		= "ulocations";

   private Context context;
   private SQLiteDatabase db;

   private static final String TAG = "DBHelper";

   public DBHelper(Context context) {
      this.context = context;
      OpenHelper openHelper = new OpenHelper(this.context);
      this.db = openHelper.getWritableDatabase();

   }

   public void close() {
	   if(this.db != null) {
		   this.db.close();
	   }
   }

   public void write(Note n) {
	   if(n.isSaved()) {
		   updateNote(n);
	   }else{
		   insertNote(n);
	   }
   }

   public void writePriority(Note n) {
	   if(n.isSaved()) {
		   updateNotePriority(n);
	   }else{
		   insertNote(n);
	   }
   }

   public void writeReminder(Note n) {
	   if(n.isSaved()) {
		   updateNoteReminder(n);
	   }else{
		   insertNote(n);
	   }
   }

   private long insertNote(Note n) {
	   Calendar c = new GregorianCalendar();

	   /*int step = (int) Math.round(Math.random() * 4);
	   Log.i(TAG, "roll back days: " + step);
	   c.add(Calendar.DATE, -step);*/

	   long now = c.getTimeInMillis();

       ContentValues values = new ContentValues();
       values.put("parent_id", n.getParentId());
       values.put("name", n.getName());
       values.put("content", n.getContent());
       values.put("createdAt", now);
       values.put("updatedAt", now);
       values.put("type", n.getType());
       values.put("priority", n.getPriority());
       values.put("reminderAt", n.getReminderDate());

       long id = db.insert(T_NOTES, null, values);

       Log.i("MODEL", "Inserted: " + id + " " + n.getType());

       n.setId(id);

       return id;
   }

   private void updateNote(Note n) {
	   Calendar c = new GregorianCalendar();
	   long now = c.getTimeInMillis();

	   ContentValues values = new ContentValues();
	   values.put("name", n.getName());
	   values.put("content", n.getContent());
	   values.put("updatedAt", now);

	   this.db.update(T_NOTES, values, "_id = " + n.getId(), null);
   }

   private void updateNotePriority(Note n) {
	   Calendar c = new GregorianCalendar();
	   long now = c.getTimeInMillis();

	   ContentValues values = new ContentValues();
	   values.put("priority", n.getPriority());
	   values.put("updatedAt", now);

	   Log.i("MODEL", "Update note priority. id:" + n.getId() + " priority:" + n.getPriority());

	   this.db.update(T_NOTES, values, "_id = " + n.getId(), null);
   }

   private void updateNoteReminder(Note n) {
	   Calendar c = new GregorianCalendar();
	   long now = c.getTimeInMillis();

	   ContentValues values = new ContentValues();
	   values.put("reminderAt", n.getReminderDate());
	   values.put("updatedAt", now);

	   Log.i("MODEL", "Update note reminder date. id:" + n.getId() + " reminderAt:" + n.getReminderDate());

	   this.db.update(T_NOTES, values, "_id = " + n.getId(), null);
   }

   public void deleteNote(Note n) {
	   if(n.getId() > 0) {
		   Log.i(TAG, "Delete note: " + n.getId() + " " + n.getType());
		   this.db.delete(T_NOTES, "_id = " + n.getId(), null);
	   }
   }

   public void deleteAllNotes() {
      this.db.delete(T_NOTES, null, null);
   }

   public Note getNoteById(long id) {
	   Cursor cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId"}, null, null, null, null, "createdAt desc");
	      if (cursor.moveToFirst()) {
	         do {

	        	if(cursor.getLong(cursor.getColumnIndex("_id")) == id) {

					try {
						Note note = NoteFactory.create(
												cursor.getLong(cursor.getColumnIndex("_id")),
												cursor.getLong(cursor.getColumnIndex("parent_id")),
												cursor.getString(cursor.getColumnIndex("name")),
												cursor.getString(cursor.getColumnIndex("content")),
												cursor.getLong(cursor.getColumnIndex("createdAt")),
												cursor.getLong(cursor.getColumnIndex("updatedAt")),
												cursor.getLong(cursor.getColumnIndex("type")),
												cursor.getLong(cursor.getColumnIndex("priority")),
												cursor.getLong(cursor.getColumnIndex("reminderAt")),
												cursor.getLong(cursor.getColumnIndex("locationId"))
											);

						note.setChildren(getChildrenFor(note.getId()));

						if (cursor != null && !cursor.isClosed()) {
			        		cursor.close();
			   	      	}
						return note;

					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

	        	}

	         } while (cursor.moveToNext());
	      }
	      if (cursor != null && !cursor.isClosed()) {
	         cursor.close();
	      }

	      return null;
   }

   public ArrayList<Note> getNotes(int filter) {
	  ArrayList<Note> list = new ArrayList<Note>();
	  Cursor cursor;

	  if(filter == Model.FILTER_HIGH_PRIORITY) {
		  cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId"}, "type != '" + Model.TYPE_NOTE_ROW + "' AND priority = '" + Note.PRIORITY_HIGH + "'", null, null, null, "createdAt desc");
	  }else if (filter == Model.FILTER_NORMAL_PRIORITY){
		  cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId" }, "type != '" + Model.TYPE_NOTE_ROW + "' AND priority != '" + Note.PRIORITY_HIGH + "'", null, null, null, "createdAt desc");
	  }else if(filter == Model.FILTER_HAS_REMINDER) {
		  cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId" }, "reminderAt > 0", null, null, null, "createdAt desc");
	  }else{
		  cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId"}, "type != '" + Model.TYPE_NOTE_ROW + "'", null, null, null, "createdAt desc");
	  }

	  if (cursor.moveToFirst()) {
         do {
        	 Note note;
			try {
				note = NoteFactory.create(
						 				cursor.getLong(cursor.getColumnIndex("_id")),
						 				cursor.getLong(cursor.getColumnIndex("parent_id")),
										cursor.getString(cursor.getColumnIndex("name")),
										cursor.getString(cursor.getColumnIndex("content")),
										cursor.getLong(cursor.getColumnIndex("createdAt")),
										cursor.getLong(cursor.getColumnIndex("updatedAt")),
										cursor.getLong(cursor.getColumnIndex("type")),
										cursor.getLong(cursor.getColumnIndex("priority")),
										cursor.getLong(cursor.getColumnIndex("reminderAt")),
										cursor.getLong(cursor.getColumnIndex("locationId"))
									);

				note.setChildren(getChildrenFor(note.getId()));

				list.add(note);

			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

         } while (cursor.moveToNext());
      }
      if (cursor != null && !cursor.isClosed()) {
         cursor.close();
      }

      return list;
   }

   public ArrayList<Note> getChildrenFor(long parentId) {
	   if(parentId != 0) {
		   ArrayList<Note> list = new ArrayList<Note>();
		      Cursor cursor = this.db.query(T_NOTES, new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type", "priority", "reminderAt", "locationId" }, "parent_id = '" + parentId + "' AND type = '" + Model.TYPE_NOTE_ROW + "'", null, null, null, "createdAt desc");
		      if (cursor.moveToFirst()) {
		         do {

					try {
						Note child = NoteFactory.create(
								 				cursor.getLong(cursor.getColumnIndex("_id")),
								 				cursor.getLong(cursor.getColumnIndex("parent_id")),
												cursor.getString(cursor.getColumnIndex("name")),
												cursor.getString(cursor.getColumnIndex("content")),
												cursor.getLong(cursor.getColumnIndex("createdAt")),
												cursor.getLong(cursor.getColumnIndex("updatedAt")),
												cursor.getLong(cursor.getColumnIndex("type")),
												cursor.getLong(cursor.getColumnIndex("priority")) ,
												cursor.getLong(cursor.getColumnIndex("reminderAt")),
												cursor.getLong(cursor.getColumnIndex("locationId"))
											);
						list.add(child);

					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

		         } while (cursor.moveToNext());
		      }
		      if (cursor != null && !cursor.isClosed()) {
		         cursor.close();
		      }
		      return list;
	   	  }
	   return null;
   }

   public int getCount() {
	   Cursor cursor = this.db.query(T_NOTES, new String[] { "_id", "name", "content", "createdAt", "updatedAt", "type" }, null, null, null, null, "createdAt");
	   int count = cursor.getCount();

	   cursor.close();
	   return count;
	}

   private static class OpenHelper extends SQLiteOpenHelper {

      OpenHelper(Context context) {
         super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }

      @Override
      public void onCreate(SQLiteDatabase db) {
         db.execSQL("CREATE TABLE " + T_NOTES + " (_id INTEGER PRIMARY KEY, parent_id INTEGER, name TEXT, content TEXT, createdAt INTEGER, updatedAt INTEGER, type INTEGER, priority INTEGER, reminderAt INTEGER, locationId INTEGER)");
         db.execSQL("CREATE TABLE " + T_LOCATIONS + " (_id INTEGER PRIMARY KEY, name TEXT, long TEXT, lat TEXT, createdAt INTEGER, updatedAt INTEGER)");
      }

      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    	  if(oldVersion == 12) {
    		  Log.i("Umlaut.Model", "Migrating DB from 12 to 13.");
    		  onCreate(db);

    		  //Migrate all the old notes
    		  Cursor cursor = db.query("unotes", new String[] { "_id", "parent_id", "name", "content", "createdAt", "updatedAt", "type" }, null, null, null, null, "createdAt desc");
    	      if (cursor.moveToFirst()) {
    	         do {
					try {

	    	        	ContentValues values = new ContentValues();
	    	        	values.put("_id", cursor.getLong(cursor.getColumnIndex("_id")));
	     		        values.put("parent_id", cursor.getLong(cursor.getColumnIndex("parent_id")));
	     		        values.put("name", cursor.getString(cursor.getColumnIndex("name")));
	     		        values.put("content", cursor.getString(cursor.getColumnIndex("content")));
	     		        values.put("createdAt", cursor.getLong(cursor.getColumnIndex("createdAt")));
	     		        values.put("updatedAt", cursor.getLong(cursor.getColumnIndex("updatedAt")));
	     		        values.put("type", cursor.getLong(cursor.getColumnIndex("type")));
	     		        values.put("priority", 0);
	     		        values.put("reminderAt", 0);

	     		        long id = db.insert(T_NOTES, null, values);

	     		        //Log.i("Umlaut.Model", "Migrated 12>13 note: " + id + " parent_id: " + cursor.getLong(cursor.getColumnIndex("parent_id")) + " type: " + cursor.getLong(cursor.getColumnIndex("type")));

					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
    	         } while (cursor.moveToNext());
    	      }
    	      if (cursor != null && !cursor.isClosed()) {
    	         cursor.close();
    	      }

    	      //db.execSQL("DROP TABLE IF EXISTS unotes");
    	      Log.i("Umlaut.Model", "Migration complete!");

    	  }else if(oldVersion < 12) {
    		  Log.i("Umlaut.Model", "Migrating DB from 11 to 12.");
    		  //Old versions only had textnotes, so just migrate those.

    		  String OLD_TABLE = "notes";

    		  //Create new tables
    		  onCreate(db);

    		  Calendar c = new GregorianCalendar();
			   long now = c.getTimeInMillis();

    		  //Fetch old data and insert into new tables
    		  Cursor cursor = db.query(OLD_TABLE, new String[] { "_id", "name", "body", "date" }, null, null, null, null, "_id desc");
    	      if (cursor.moveToFirst()) {
    	         do {
					try {

						Note n = NoteFactory.create(Model.TYPE_TEXT_NOTE);
						n.setName(cursor.getString(cursor.getColumnIndex("name")));
	    	        	n.setContent(cursor.getString(cursor.getColumnIndex("body")));
	    	        	n.setCreatedAt(cursor.getLong(cursor.getColumnIndex("date")));

	    	        	long createdAtDate;
	     			   	if(n.getCreatedAt() > 0) {
	     				   createdAtDate = n.getCreatedAt();
	     			   	}else{
	     				   createdAtDate = now;
	     			   	}

	    	        	ContentValues values = new ContentValues();
	     		        values.put("parent_id", n.getParentId());
	     		        values.put("name", n.getName());
	     		        values.put("content", n.getContent());
	     		        values.put("createdAt", createdAtDate);
	     		        values.put("updatedAt", now);
	     		        values.put("type", n.getType());

	     		        long id = db.insert(T_NOTES, null, values);

	     		        Log.i("Umlaut.Model", "Migrated 11>12 note: " + id + " " + n.getType());

					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
    	         } while (cursor.moveToNext());
    	      }
    	      if (cursor != null && !cursor.isClosed()) {
    	         cursor.close();
    	      }

    	      //Remove old table
    	      //disabled for now.. do it in next version instead!
    	      //db.execSQL("DROP TABLE IF EXISTS " + OLD_TABLE);

    	      Log.i("Umlaut.Model", "Migration complete!");
    	  }

         //For the future...

    	  //Log.w("DBHelper", "Upgrading database, this will drop tables and recreate.");
         //db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
         //onCreate(db);

      }

   }

}


text:
mkdir -p ${PREFIX}/bin
make CC=$CC

cp metilene ${PREFIX}/bin/
cp metilene_input.pl ${PREFIX}/bin/
cp metilene_output.pl ${PREFIX}/bin/
cp metilene_output.R ${PREFIX}/bin/

install -d ${PREFIX}/share/doc/metilene
install manual.pdf ${PREFIX}/share/doc/metilene
install README ${PREFIX}/share/doc/metilene


text:
// ZAP: 2011/04/16 i18n
// ZAP: 2012/04/25 Added @Override annotation to all appropriate methods.
// ZAP: 2013/01/25 Removed the "(non-Javadoc)" comments.
// ZAP: 2013/03/03 Issue 546: Remove all template Javadoc comments

package org.parosproxy.paros.extension.filter;

import java.util.regex.Matcher;

import org.parosproxy.paros.Constant;
import org.parosproxy.paros.network.HttpMessage;

public class FilterReplaceResponseBody extends FilterAbstractReplace {

    @Override
    public int getId() {
        return 80;
    }

    @Override
    public String getName() {
        return Constant.messages.getString("filter.replacerespbody.name");
    }

    @Override
    public void onHttpRequestSend(HttpMessage httpMessage) {

    }

    @Override
    public void onHttpResponseReceive(HttpMessage msg) {
        if (getPattern() == null) {
            return;
        } else if (msg.getResponseHeader().isEmpty() || msg.getResponseHeader().isImage() || msg.getResponseBody().length() == 0) {
            return;
        }

        Matcher matcher = getPattern().matcher(msg.getResponseBody().toString());
        String result = matcher.replaceAll(getReplaceText());
        msg.getResponseBody().setBody(result);
        msg.getResponseHeader().setContentLength(msg.getResponseBody().length());

    }

 }


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

<TITLE>
Overview
</TITLE>

<META NAME="keywords" CONTENT="Overview">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

All Classes

Packages

avrora

avrora.actions

avrora.core

avrora.core.isdl

avrora.core.isdl.ast

avrora.core.isdl.dep

avrora.core.isdl.gen

avrora.core.isdl.parser

avrora.gui

avrora.monitors

avrora.sim

avrora.sim.clock

avrora.sim.dbbc

avrora.sim.energy

avrora.sim.mcu

avrora.sim.platform

avrora.sim.platform.sensors

avrora.sim.radio

avrora.sim.radio.freespace

avrora.sim.types

avrora.sim.util

avrora.stack

avrora.stack.isea

avrora.syntax

avrora.syntax.atmel

avrora.syntax.gas

avrora.syntax.objdump

avrora.test

avrora.test.probes

avrora.util

avrora.util.help

avrora.util.profiling


text:
.. _configuration:

Configuration
=============

Command Line Options
-----------------------------

Locust is configured mainly through command line arguments.

.. code-block:: console

    $ locust --help

.. literalinclude:: cli-help-output.txt
    :language: console

.. _environment-variables:

Environment Variables
---------------------

Most of the options that can be set through command line arguments can also be set through
environment variables. Example:

.. code-block::

    $ LOCUST_LOCUSTFILE=custom_locustfile.py locust

.. _configuration-file:

Configuration File
------------------

Any of the options that can be set through command line arguments can also be set by a
configuration file in the `config file <https://github.com/bw2/ConfigArgParse#config-file-syntax>`_
format.

Locust will look for ``~/.locust.conf`` and ``./locust.conf`` by default, and you can specify an
additional file using the ``--config`` flag.

Example:

.. code-block::

    # master.conf in current directory
    locustfile = locust_files/my_locust_file.py
    headless = true
    master = true
    expect-workers = 5
    host = http://target-system
    users = 100
    spawn-rate = 10
    run-time = 10m

.. code-block:: console

    $ locust --config=master.conf

.. note::

    Configuration values are read (overridden) in the following order:

    .. code-block:: console

        ~/locust.conf -> ./locust.conf -> (file specified using --conf) -> env vars -> cmd args

All available configuration options
-----------------------------------

Here's a table of all the available configuration options, and their corresponding Environment and config file keys:

.. include:: config-options.rst

Custom arguments
----------------

See :ref:`custom-arguments`

Customization of statistics settings
------------------------------------

Default configuration for Locust statistics is set in constants of stats.py file.
It can be tuned to specific requirements by overriding these values.
To do this, import locust.stats module and override required settings

.. code-block:: python

    import locust.stats
    locust.stats.CONSOLE_STATS_INTERVAL_SEC = 15

It can be done directly in Locust file or extracted to separate file for common usage by all Locust files.

The list of statistics parameters that can be modified is:

+-------------------------------------------+--------------------------------------------------------------------------------------+
| Parameter name                            | Purpose                                                                              |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| STATS_NAME_WIDTH                          | Width of column for request name in console output                                   |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| STATS_TYPE_WIDTH                          | Width of column for request type in console output                                   |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| CSV_STATS_INTERVAL_SEC                    | Interval for how frequently the CSV file is written if this option is configured     |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| CONSOLE_STATS_INTERVAL_SEC                | Interval for how frequently results are written to console                           |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| CURRENT_RESPONSE_TIME_PERCENTILE_WINDOW   | Window size/resolution - in seconds - when calculating the current response          |
|                                           | time percentile                                                                      |
+-------------------------------------------+--------------------------------------------------------------------------------------+
| PERCENTILES_TO_REPORT                     | The list of response time percentiles to be calculated & reported                    |
+-------------------------------------------+--------------------------------------------------------------------------------------+


text:
copy %GLASSFISH_HOME%\glassfish\lib\appserv-rt.jar .\lib
copy %GLASSFISH_HOME%\glassfish\lib\gf-client.jar .\lib
copy %GLASSFISH_HOME%\glassfish\lib\javaee.jar .\lib
copy %GLASSFISH_HOME%\glassfish\modules\*.jar .\modules


text:
//-----------------------------------------------------------------------
// <copyright file="RfcommServiceId.uwp.cs" company="In The Hand Ltd">
//   Copyright (c) 2017 In The Hand Ltd, All rights reserved.
//   This source code is licensed under the MIT License - see License.txt
// </copyright>
//-----------------------------------------------------------------------

using System;

namespace InTheHand.Devices.Bluetooth.Rfcomm
{
    partial class RfcommServiceId
    {
        private static RfcommServiceId FromShortIdImpl(uint shortId)
        {
            return Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId.FromShortId(shortId);
        }

        private static RfcommServiceId FromUuidImpl(Guid uuid)
        {
            return Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId.FromUuid(uuid);
        }

        private Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId _id;

        private RfcommServiceId(Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId id)
        {
            _id = id;
        }

        public static implicit operator Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId(RfcommServiceId id)
        {
            return id._id;
        }

        public static implicit operator RfcommServiceId(Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId id)
        {
            return new RfcommServiceId(id);
        }

        private Guid GetUuid()
        {
            return _id.Uuid;
        }

        private uint AsShortIdImpl()
        {
            return _id.AsShortId();
        }

        private string AsStringImpl()
        {
            return _id.AsString();
        }
    }
}


text:
// Copyright 2014 Konstantin Alexandroff
//
// 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.

using System.Linq;

namespace Kostassoid.Liar.Specs
{
	using System;
	using Machine.Specifications;
	using Generators.Base;

	// ReSharper disable InconsistentNaming
	// ReSharper disable UnusedMember.Local
	public class DecoratorsSpecs
	{
		[Subject("Decorators")]
		[Tags("Unit")]
		public class when_alternating_instance_with_action
		{
			static Boo _value;

			Because of = () =>
			{
				_value = A<Boo>.As(_ => new Boo
					{
						A = A<int>.Any().Value
					})
					.With(v => v.A = 13)
					.Value;
			};

			It should_comply_with_rules = () => _value.A.ShouldEqual(13);
		}

		[Subject("Decorators")]
		[Tags("Unit")]
		public class when_filtering_values_with_predicate
		{
			static int[] _values;

			Because of = () =>
			{
				_values = A<int>.Any().Where(i => i % 2 == 0).Sequence.Take(100).ToArray();
			};

			It should_comply_with_rules = () => _values.ShouldEachConformTo(i => i % 2 == 0);
		}

	}

	// ReSharper restore InconsistentNaming
	// ReSharper restore UnusedMember.Local
}


text:
// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis
{
    public struct SolutionChanges
    {
        private readonly Solution newSolution;
        private readonly Solution oldSolution;

        internal SolutionChanges(Solution newSolution, Solution oldSolution)
        {
            this.newSolution = newSolution;
            this.oldSolution = oldSolution;
        }

        public IEnumerable<Project> GetAddedProjects()
        {
            foreach (var id in this.newSolution.ProjectIds)
            {
                if (!this.oldSolution.ContainsProject(id))
                {
                    yield return this.newSolution.GetProject(id);
                }
            }
        }

        public IEnumerable<ProjectChanges> GetProjectChanges()
        {
            var old = this.oldSolution;

            // if the project states are different then there is a change.
            foreach (var id in this.newSolution.ProjectIds)
            {
                var newState = this.newSolution.GetProjectState(id);
                var oldState = old.GetProjectState(id);
                if (oldState != null && newState != null && newState != oldState)
                {
                    yield return newSolution.GetProject(id).GetChanges(oldSolution.GetProject(id));
                }
            }
        }

        public IEnumerable<Project> GetRemovedProjects()
        {
            foreach (var id in this.oldSolution.ProjectIds)
            {
                if (!this.newSolution.ContainsProject(id))
                {
                    yield return this.oldSolution.GetProject(id);
                }
            }
        }
    }
}


text:
  Cheniménil est
      une ville géographiquement positionnée dans le département des Vosges en Lorraine. Elle comptait 1 173 habitants en 2008.

Le nombre de logements, à Cheniménil, était réparti en 2011 en 150 appartements et 371 maisons soit
 un marché plutôt équilibré.

À Cheniménil, le prix moyen à l'achat d'un appartement s'évalue à 1 433 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 1 171 € du m². À la location la valorisation moyenne se situe à 0 € du m² mensuel.

La ville offre de nombreux  équipements sportifs, elle dispose, entre autres, de un centre d'équitation, un terrain de sport, une salle de combat et une boucle de randonnée.

À coté de Cheniménil sont localisées les villes de
La Baffe localisée à 3 km, 621 habitants,
Charmois-devant-Bruyères située à 3 km, 407 habitants,
Jarménil à 3 km, 425 habitants,
Faucompierre à 4 km, 209 habitants,
Pouxeux située à 4 km, 1 957 habitants,
Docelles à 1 km, 1 012 habitants,
 entre autres. De plus, Cheniménil est située à seulement douze km de Épinal.


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.4.4.15-3-6
description: >
    Array.prototype.lastIndexOf - value of 'length' is a number (value
    is a positive number)
---*/

        var obj = { 99: true, 100: 100, length: 100 };

assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 99, 'Array.prototype.lastIndexOf.call(obj, true)');
assert.sameValue(Array.prototype.lastIndexOf.call(obj, 100), -1, 'Array.prototype.lastIndexOf.call(obj, 100)');


text:
@implementation TTRemoveComponentFromEntityAction

- (instancetype) initWithComponents: (NSArray *) components fromEntity: (TTEntity *) entity {
    if ((self = [super init])) {
        _entity = entity;
        _components = components;
    }

    return self;
}

- (BOOL) canExecute {
    if ([super canExecute]) {
        return self.entity && (self.components && self.components.count > 0);
    }

    return NO;
}

- (BOOL) execute {
    if ([super execute]) {
        return [self.entity removeComponents:
                self.components];
    }

    return NO;
}

- (BOOL) undo {
    if ([super undo]) {
        return [self.entity addComponents:
                self.components];
    }

    return NO;
}

- (NSString *) displayTitle {
    return @"Remove component";
}

- (NSString *) displayInfo {
    return [NSString stringWithFormat:
            @"Removed %lu %@ to '%@'",
            self.components.count,
            self.components.count > 1 ? @"components" : @"component",
            self.entity];
}

@end


text:
package org.killbill.billing.invoice.dao;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.joda.time.LocalDate;
import org.killbill.billing.account.api.Account;
import org.killbill.billing.callcontext.InternalCallContext;
import org.killbill.billing.callcontext.InternalTenantContext;
import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.invoice.InvoiceDispatcher.FutureAccountNotifications;
import org.killbill.billing.invoice.api.Invoice;
import org.killbill.billing.invoice.api.InvoiceApiException;
import org.killbill.billing.invoice.api.InvoiceStatus;
import org.killbill.billing.invoice.api.user.DefaultInvoiceCreationEvent;
import org.killbill.billing.util.entity.DefaultPagination;
import org.killbill.billing.util.entity.Pagination;
import org.killbill.billing.util.entity.dao.MockEntityDaoBase;
import org.killbill.bus.api.PersistentBus;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.inject.Inject;

public class MockInvoiceDao extends MockEntityDaoBase<InvoiceModelDao, Invoice, InvoiceApiException> implements InvoiceDao {

    private final PersistentBus eventBus;
    private final Object monitor = new Object();
    private final Map<UUID, InvoiceModelDao> invoices = new LinkedHashMap<UUID, InvoiceModelDao>();
    private final Map<UUID, InvoiceItemModelDao> items = new LinkedHashMap<UUID, InvoiceItemModelDao>();
    private final Map<UUID, InvoicePaymentModelDao> payments = new LinkedHashMap<UUID, InvoicePaymentModelDao>();
    private final BiMap<UUID, Long> accountRecordIds = HashBiMap.create();

    @Inject
    public MockInvoiceDao(final PersistentBus eventBus) {
        this.eventBus = eventBus;
    }

    @Override
    public void createInvoice(final InvoiceModelDao invoice,
                              final FutureAccountNotifications callbackDateTimePerSubscriptions, final InternalCallContext context) {
        synchronized (monitor) {
            storeInvoice(invoice, context);
        }
        try {
            eventBus.post(new DefaultInvoiceCreationEvent(invoice.getId(), invoice.getAccountId(),
                                                          InvoiceModelDaoHelper.getRawBalanceForRegularInvoice(invoice), invoice.getCurrency(),
                                                          context.getAccountRecordId(), context.getTenantRecordId(), context.getUserToken()));
        } catch (final PersistentBus.EventBusException ex) {
            throw new RuntimeException(ex);
        }
    }

    @Override
    public void setFutureAccountNotificationsForEmptyInvoice(final UUID accountId, final FutureAccountNotifications callbackDateTimePerSubscriptions, final InternalCallContext context) {

    }

    @Override
    public List<InvoiceItemModelDao> createInvoices(final List<InvoiceModelDao> invoiceModelDaos, final InternalCallContext context) {
        synchronized (monitor) {
            final List<InvoiceItemModelDao> createdItems = new LinkedList<InvoiceItemModelDao>();
            for (final InvoiceModelDao invoice : invoiceModelDaos) {
                createdItems.addAll(storeInvoice(invoice, context));
            }
            return createdItems;
        }
    }

    private Collection<InvoiceItemModelDao> storeInvoice(final InvoiceModelDao invoice, final InternalCallContext context) {
        final Collection<InvoiceItemModelDao> createdItems = new LinkedList<InvoiceItemModelDao>();

        invoices.put(invoice.getId(), invoice);
        for (final InvoiceItemModelDao invoiceItemModelDao : invoice.getInvoiceItems()) {
            final InvoiceItemModelDao oldItemOrNull = items.put(invoiceItemModelDao.getId(), invoiceItemModelDao);
            if (oldItemOrNull == null) {
                createdItems.add(invoiceItemModelDao);
            }
        }
        accountRecordIds.put(invoice.getAccountId(), context.getAccountRecordId());

        return createdItems;
    }

    @Override
    public InvoiceModelDao getById(final UUID id, final InternalTenantContext context) {
        synchronized (monitor) {
            return invoices.get(id);
        }
    }

    @Override
    public InvoiceModelDao getByNumber(final Integer number, final InternalTenantContext context) {
        synchronized (monitor) {
            for (final InvoiceModelDao invoice : invoices.values()) {
                if (invoice.getInvoiceNumber().equals(number)) {
                    return invoice;
                }
            }
        }

        return null;
    }

    @Override
    public Pagination<InvoiceModelDao> getAll(final InternalTenantContext context) {
        synchronized (monitor) {
            return new DefaultPagination<InvoiceModelDao>((long) invoices.values().size(), invoices.values().iterator());
        }
    }

    @Override
    public List<InvoiceModelDao> getInvoicesByAccount(final InternalTenantContext context) {
        final List<InvoiceModelDao> result = new ArrayList<InvoiceModelDao>();

        synchronized (monitor) {
            final UUID accountId = accountRecordIds.inverse().get(context.getAccountRecordId());
            for (final InvoiceModelDao invoice : invoices.values()) {
                if (accountId.equals(invoice.getAccountId()) && !invoice.isMigrated()) {
                    result.add(invoice);
                }
            }
        }
        return result;
    }

    @Override
    public List<InvoiceModelDao> getInvoicesByAccount(final LocalDate fromDate, final InternalTenantContext context) {
        final List<InvoiceModelDao> invoicesForAccount = new ArrayList<InvoiceModelDao>();
        synchronized (monitor) {
            final UUID accountId = accountRecordIds.inverse().get(context.getAccountRecordId());
            for (final InvoiceModelDao invoice : getAll(context)) {
                if (accountId.equals(invoice.getAccountId()) && !invoice.getTargetDate().isBefore(fromDate) && !invoice.isMigrated()) {
                    invoicesForAccount.add(invoice);
                }
            }
        }

        return invoicesForAccount;
    }

    @Override
    public List<InvoiceModelDao> getInvoicesBySubscription(final UUID subscriptionId, final InternalTenantContext context) {
        final List<InvoiceModelDao> result = new ArrayList<InvoiceModelDao>();

        synchronized (monitor) {
            for (final InvoiceModelDao invoice : invoices.values()) {
                for (final InvoiceItemModelDao item : invoice.getInvoiceItems()) {
                    if (subscriptionId.equals(item.getSubscriptionId()) && !invoice.isMigrated()) {
                        result.add(invoice);
                        break;
                    }
                }
            }
        }
        return result;
    }

    @Override
    public Pagination<InvoiceModelDao> searchInvoices(final String searchKey, final Long offset, final Long limit, final InternalTenantContext context) {
        final List<InvoiceModelDao> results = new LinkedList<InvoiceModelDao>();
        int maxNbRecords = 0;
        for (final InvoiceModelDao invoice : getAll(context)) {
            maxNbRecords++;
            if (invoice.getId().toString().equals(searchKey) ||
                invoice.getAccountId().toString().equals(searchKey) ||
                invoice.getInvoiceNumber().toString().equals(searchKey) ||
                invoice.getCurrency().toString().equals(searchKey)) {
                results.add(invoice);
            }
        }

        return DefaultPagination.<InvoiceModelDao>build(offset, limit, maxNbRecords, results);
    }

    @Override
    public void test(final InternalTenantContext context) {
    }

    @Override
    public UUID getInvoiceIdByPaymentId(final UUID paymentId, final InternalTenantContext context) {
        synchronized (monitor) {
            for (final InvoicePaymentModelDao payment : payments.values()) {
                if (paymentId.equals(payment.getPaymentId())) {
                    return payment.getInvoiceId();
                }
            }
        }
        return null;
    }

    @Override
    public List<InvoicePaymentModelDao> getInvoicePaymentsByPaymentId(final UUID paymentId, final InternalTenantContext context) {
        final List<InvoicePaymentModelDao> result = new LinkedList<InvoicePaymentModelDao>();
        synchronized (monitor) {
            for (final InvoicePaymentModelDao payment : payments.values()) {
                if (paymentId.equals(payment.getPaymentId())) {
                    result.add(payment);
                }
            }
        }
        return result;
    }

    @Override
    public List<InvoicePaymentModelDao> getInvoicePaymentsByAccount(final InternalTenantContext context) {

        throw new UnsupportedOperationException();
/*
        InvoicePaymentModelDao does not export accountId ?

        final List<InvoicePaymentModelDao> invoicesForAccount = new ArrayList<InvoicePaymentModelDao>();
        synchronized (monitor) {
            final UUID accountId = accountRecordIds.inverse().get(context.getAccountRecordId());
            for (final InvoicePaymentModelDao payment : payments.values()) {
            }
        }
        return null;
*/
    }

    @Override
    public void notifyOfPaymentCompletion(final InvoicePaymentModelDao invoicePayment, final InternalCallContext context) {
        synchronized (monitor) {
            payments.put(invoicePayment.getId(), invoicePayment);
        }
    }

    @Override
    public void consumeExstingCBAOnAccountWithUnpaidInvoices(final UUID accountId, final InternalCallContext context) {
    }

    @Override
    public BigDecimal getAccountBalance(final UUID accountId, final InternalTenantContext context) {
        BigDecimal balance = BigDecimal.ZERO;

        for (final InvoiceModelDao invoice : getAll(context)) {
            if (accountId.equals(invoice.getAccountId())) {
                balance = balance.add(InvoiceModelDaoHelper.getRawBalanceForRegularInvoice(invoice));
            }
        }

        return balance;
    }

    @Override
    public List<InvoiceModelDao> getUnpaidInvoicesByAccountId(final UUID accountId, final LocalDate upToDate, final InternalTenantContext context) {
        final List<InvoiceModelDao> unpaidInvoices = new ArrayList<InvoiceModelDao>();

        for (final InvoiceModelDao invoice : getAll(context)) {
            if (accountId.equals(invoice.getAccountId()) && (InvoiceModelDaoHelper.getRawBalanceForRegularInvoice(invoice).compareTo(BigDecimal.ZERO) > 0) && !invoice.isMigrated()) {
                unpaidInvoices.add(invoice);
            }
        }

        return unpaidInvoices;
    }

    @Override
    public List<InvoiceModelDao> getAllInvoicesByAccount(final InternalTenantContext context) {
        final List<InvoiceModelDao> result = new ArrayList<InvoiceModelDao>();

        synchronized (monitor) {
            final UUID accountId = accountRecordIds.inverse().get(context.getAccountRecordId());
            for (final InvoiceModelDao invoice : invoices.values()) {
                if (accountId.equals(invoice.getAccountId())) {
                    result.add(invoice);
                }
            }
        }
        return result;
    }

    @Override
    public InvoicePaymentModelDao postChargeback(final UUID invoicePaymentId, final String chargebackTransactionExternalKey, final BigDecimal amount, final Currency currency, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoicePaymentModelDao postChargebackReversal(final UUID paymentId, final String chargebackTransactionExternalKey, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoiceItemModelDao doCBAComplexity(final InvoiceModelDao invoice, final InternalCallContext context) throws InvoiceApiException {
        // Do nothing unless we need it..
        return null;
    }

    @Override
    public Map<UUID, BigDecimal> computeItemAdjustments(final String invoiceId, final Map<UUID, BigDecimal> invoiceItemIdsWithNullAmounts, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public BigDecimal getRemainingAmountPaid(final UUID invoicePaymentId, final InternalTenantContext context) {
        throw new UnsupportedOperationException();
    }

    @Override
    public UUID getAccountIdFromInvoicePaymentId(final UUID invoicePaymentId, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<InvoicePaymentModelDao> getChargebacksByAccountId(final UUID accountId, final InternalTenantContext context) {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<InvoicePaymentModelDao> getChargebacksByPaymentId(final UUID paymentId, final InternalTenantContext context) {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoicePaymentModelDao getChargebackById(final UUID chargebackId, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoiceItemModelDao getExternalChargeById(final UUID externalChargeId, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoiceItemModelDao getCreditById(final UUID creditId, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public BigDecimal getAccountCBA(final UUID accountId, final InternalTenantContext context) {
        return null;
    }

    @Override
    public InvoicePaymentModelDao createRefund(final UUID paymentId, final BigDecimal amount, final boolean isInvoiceAdjusted,
                                               final Map<UUID, BigDecimal> invoiceItemIdsWithAmounts, final String transactionExternalKey,
                                               final InternalCallContext context)
            throws InvoiceApiException {
        return null;
    }

    @Override
    public void deleteCBA(final UUID accountId, final UUID invoiceId, final UUID invoiceItemId, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void notifyOfPaymentInit(final InvoicePaymentModelDao invoicePayment, final InternalCallContext context) {
        synchronized (monitor) {
            payments.put(invoicePayment.getId(), invoicePayment);
        }

    }

    @Override
    public void changeInvoiceStatus(final UUID invoiceId, final InvoiceStatus newState, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void createParentChildInvoiceRelation(final InvoiceParentChildModelDao invoiceRelation, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public InvoiceModelDao getParentDraftInvoice(final UUID parentAccountId, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<InvoiceParentChildModelDao> getChildInvoicesByParentInvoiceId(final UUID parentInvoiceId, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    public void updateInvoiceItemAmount(final UUID invoiceItemId, final BigDecimal amount, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void transferChildCreditToParent(final Account childAccount, final InternalCallContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<InvoiceItemModelDao> getInvoiceItemsByParentInvoice(final UUID parentInvoiceId, final InternalTenantContext context) throws InvoiceApiException {
        throw new UnsupportedOperationException();
    }
}


text:
<TITLE>Review for Matewan (1987)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Matewan (1987)

reviewed by
Mark R. Leeper

                                   MATEWAN
                       A film review by Mark R. Leeper
                        Copyright 1987 Mark R. Leeper

          Capsule review:  A great propaganda film in the best
     traditions of Sergei Eisenstein.  An engrossing account of
     the birth pangs of the coal miners' union in Matewan, West
     Virginia, as seen purely from the union's point of view.
     Rating: +2.  Disclaimer: No political intention should be
     inferred from this article.  I am addressing issues of
     filmmaking style only.

     I think a lot of people were very surprised when REDS came out.  Warren
Beatty had been in some okay films but he had never shown any great talent.
Then he made REDS and people realized that somewhere inside him there was a
serious filmmaker with something to say.  John Sayles's track record has
been only moderately better than Beatty's.  His films had been mostly low-
budget pieces, usually with a social message.  Included are films like
RETURN OF THE SECAUCUS SEVEN, LIANNA, and BROTHER FROM ANOTHER PLANET.
MATEWAN is very much Sayles's REDS.  It is a detailed historical piece done
on a reasonable budget and it is a very moving film.

     MATEWAN is the story of how the union came to the mines of West
Virginia.  It is the story of open warfare between the miners and the
company who had kept the miners in virtual slavery.  Each side has its
general.  Leading the miners is Joe Kenehan, an idealistic young union man
with visions of a worldwide union.  Leading the fight for the company are
Hickey and Griggs, mercenaries brought in to put down the insurrection of
mine workers and to get the mines turning a profit again.  There is a lot of
history in MATEWAN, but it does not detract one iota from the story-telling.

     But while in some ways MATEWAN is similar to REDS, in some ways it is
very different.  REDS was sympathetic to the socialists, but showed them
reasonably realistically, warts and all.  Sayles instead was trying to make
a perfect propaganda film and, with some borrowing from masters like
Eisenstein, I think he has made it.  MATEWAN is the American equivalent of
BATTLESHIP POTEMKIN.  In two and a half hours of film Joe Kenehan shows
absolutely no faults at all.  He is intelligent, considerate, idealistic,
committed, self-sacrificing, and courageous.  Hickey and Griggs show not one
single virtue.  They are mean-spirited, rude, lecherous, impious, selfish,
and they kill people.  Sayles is taking no chances that you might not know
who are the good guys and who are not.

     The miners are a little more human.  The whites start out bigotted
against the blacks and Italians brought in to break the strike, but Kenehan
shows them that the only real fight is the union against the company and all
the workers eventually come to love each other.  In BATTLESHIP POTEMKIN one
of a group of jubilant revolutionaries yells, "Down with Jews!" only to be
shouted down by others who understand "the real fight."

     You see almost nothing of characters who favor the company side other
than Hickey and Griggs.  Sayles wants no possibility of them being humanized
in any way.  In the climactic "Battle on the Tracks" they are simply brought
off a train and seen at a distance without any humanizing close-ups.
Characters who are humanized include the callow young boy, innocent yet
resourceful, who was always anti-company but who gets to see at close range
just how despicable the company men are and, in an almost too perfect
substory, he becomes a hero of the strike.  We also see others uncommitted
at the beginning who are won over by the justice of the strike.

     MATEWAN, in its copious cinematic quoting from Eisenstein, right down
to the "mourning of the dead" scene, undercuts its own credibility.  It is
too perfect a propaganda film to be really trusted on its facts.  It is,
however, a really fine propaganda film and does everything Eisenstein would
have tried for.  It is moving and affecting.  It pulls all the right
strings.  As such it is a pleasure to watch.  Rate it a high +2 on the -4 to
+4 scale.

                                        Mark R. Leeper
                                        ihnp4!mtgzz!leeper
                                        mtgzz!leeper@rutgers.rutgers.edu

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
from a10sdk.common.A10BaseClass import A10BaseClass

class Uri(A10BaseClass):

    """This class does not support CRUD Operations please use parent.

    :param match_type: {"enum": ["contains", "ends-with", "equals", "starts-with"], "type": "string", "description": "'contains': Match URI if request URI contains specified URI; 'ends-with': Match URI if request URI ends with specified URI; 'equals': Match URI if request URI equals specified URI; 'starts-with': Match URI if request URI starts with specified URI; ", "format": "enum"}
    :param uri_str: {"minLength": 1, "maxLength": 128, "type": "string", "description": "Specify URI string", "format": "string-rlx"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""

        self.b_key = "uri"
        self.DeviceProxy = ""
        self.match_type = ""
        self.uri_str = ""

        for keys, value in kwargs.items():
            setattr(self,keys, value)

class SamplingEnable(A10BaseClass):

    """This class does not support CRUD Operations please use parent.

    :param counters1: {"enum": ["all", "total_count", "hit_count"], "type": "string", "description": "'all': all; 'total_count': total_count; 'hit_count': hit_count; ", "format": "enum"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""

        self.b_key = "sampling-enable"
        self.DeviceProxy = ""
        self.counters1 = ""

        for keys, value in kwargs.items():
            setattr(self,keys, value)

class AccessList(A10BaseClass):

    """This class does not support CRUD Operations please use parent.

    :param acl_name: {"not": "acl-id", "enum": ["ip-name", "ipv6-name"], "type": "string", "description": "'ip-name': Apply an IP named access list; 'ipv6-name': Apply an IPv6 named access list; ", "format": "enum"}
    :param acl_id: {"description": "ACL id", "format": "number", "maximum": 199, "minimum": 1, "not": "acl-name", "type": "number", "$ref": "/axapi/v3/access-list/standard"}
    :param name: {"minLength": 1, "maxLength": 16, "type": "string", "description": "Specify Named Access List", "format": "string"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""

        self.b_key = "access-list"
        self.DeviceProxy = ""
        self.acl_name = ""
        self.acl_id = ""
        self.name = ""

        for keys, value in kwargs.items():
            setattr(self,keys, value)

class AaaRule(A10BaseClass):

    """Class Description::
    Rules of AAA policy.

    Class aaa-rule supports CRUD Operations and inherits from `common/A10BaseClass`.
    This class is the `"PARENT"` class for this module.`

    :param index: {"description": "Specify AAA rule index", "format": "number", "type": "number", "maximum": 256, "minimum": 1, "optional": false}
    :param match_encoded_uri: {"default": 0, "optional": true, "type": "number", "description": "Enable URL decoding for URI matching", "format": "flag"}
    :param uuid: {"description": "uuid of the object", "format": "string", "minLength": 1, "modify-not-allowed": 1, "optional": true, "maxLength": 64, "type": "string"}
    :param authorize_policy: {"description": "Specify authorization policy to bind to the AAA rule", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "type": "string", "$ref": "/axapi/v3/aam/authorization/policy"}
    :param uri: {"minItems": 1, "items": {"type": "object"}, "uniqueItems": true, "type": "array", "array": [{"properties": {"optional": true, "match-type": {"enum": ["contains", "ends-with", "equals", "starts-with"], "type": "string", "description": "'contains': Match URI if request URI contains specified URI; 'ends-with': Match URI if request URI ends with specified URI; 'equals': Match URI if request URI equals specified URI; 'starts-with': Match URI if request URI starts with specified URI; ", "format": "enum"}, "uri-str": {"minLength": 1, "maxLength": 128, "type": "string", "description": "Specify URI string", "format": "string-rlx"}}}]}
    :param action: {"optional": true, "enum": ["allow", "deny"], "type": "string", "description": "'allow': Allow traffic that matches this rule; 'deny': Deny traffic that matches this rule; ", "format": "enum"}
    :param sampling_enable: {"minItems": 1, "items": {"type": "object"}, "uniqueItems": true, "type": "array", "array": [{"properties": {"optional": true, "counters1": {"enum": ["all", "total_count", "hit_count"], "type": "string", "description": "'all': all; 'total_count': total_count; 'hit_count': hit_count; ", "format": "enum"}}}]}
    :param domain_name: {"description": "Specify domain name to bind to the AAA rule (ex: a10networks.com, www.a10networks.com)", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 127, "type": "string"}
    :param authentication_template: {"description": "Specify authentication template name to bind to the AAA rule", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "type": "string", "$ref": "/axapi/v3/aam/authentication/template"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

    URL for this object::
    `https://<Hostname|Ip address>//axapi/v3/aam/aaa-policy/{name}/aaa-rule/{index}`.

    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""
        self.required = [ "index"]

        self.b_key = "aaa-rule"
        self.a10_url="/axapi/v3/aam/aaa-policy/{name}/aaa-rule/{index}"
        self.DeviceProxy = ""
        self.index = ""
        self.match_encoded_uri = ""
        self.uuid = ""
        self.authorize_policy = ""
        self.uri = []
        self.action = ""
        self.sampling_enable = []
        self.domain_name = ""
        self.authentication_template = ""
        self.access_list = {}

        for keys, value in kwargs.items():
            setattr(self,keys, value)


text:
'use strict';

/**
 * @ngdoc function
 * @name tbsApp.controller:ExploreBuddiesEvolutionListCtrl
 * @description
 * # ExploreBuddiesEvolutionListCtrl
 * Controller of the tbsApp
 */
angular.module('tbsApp')
  .controller('ExploreBuddiesEvolutionListCtrl', function ($scope, RBuddyEvolution) {
    RBuddyEvolution.all(function(data){
        $scope.evolutions = data;
    })
  });


text:
using UnityEngine;
using System.Collections;

[System.Serializable]
public class Utterance
{
	public string name;
	public string message;
	public string animation;
	public float  speechThreshold;
	public AudioClip audioClip;
}

public class BehaviourManager : MonoBehaviour {

	public Utterance [] utterances;
	public Animator anim;
	public GameObject [] GUIprops;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {

	}

	void PlayUtterance(string val){
		Debug.Log("Play Utterance " + val);
		for(int i = 0; i < utterances.Length; i++){
			if(utterances[i].name == val){
				Debug.Log(utterances[i].message);
				if (utterances[i].animation != ""){
					Debug.Log("animation " + utterances[i].animation);
					anim.SetTrigger(utterances[i].animation);
				}
				if (utterances[i].audioClip != null){
					GetComponent<AudioSource>().clip= utterances[i].audioClip;
					GetComponent<AudioSource>().Play();
				}
				return;
			}
		}
	}
}


text:
using System;
using System.Linq;
using UnityEngine;

namespace UnityEditor.VFX.Operator
{
    // DEPRECATED
    class PerlinNoise : NoiseBaseOld
    {
        override protected string noiseName { get { return "Perlin"; } }

        protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            VFXExpression parameters = new VFXExpressionCombine(inputExpression[1], inputExpression[2], inputExpression[4]);

            if (type == NoiseType.Curl)
            {
                if (curlDimensions == CurlDimensionCount.Two)
                {
                    return new[] { new VFXExpressionPerlinCurlNoise2D(inputExpression[0], parameters, inputExpression[3]) };
                }
                else
                {
                    return new[] { new VFXExpressionPerlinCurlNoise3D(inputExpression[0], parameters, inputExpression[3]) };
                }
            }
            else
            {
                VFXExpression rangeMultiplier = (inputExpression[5].y - inputExpression[5].x);

                if (dimensions == DimensionCount.One)
                {
                    VFXExpression noise = new VFXExpressionPerlinNoise1D(inputExpression[0], parameters, inputExpression[3]);
                    VFXExpression x = VFXOperatorUtility.Fit(noise.x, VFXValue.Constant(0.0f), VFXValue.Constant(1.0f), inputExpression[5].x, inputExpression[5].y);
                    VFXExpression y = noise.y * rangeMultiplier;
                    return new[] { x, y };
                }
                else if (dimensions == DimensionCount.Two)
                {
                    VFXExpression noise = new VFXExpressionPerlinNoise2D(inputExpression[0], parameters, inputExpression[3]);
                    VFXExpression x = VFXOperatorUtility.Fit(noise.x, VFXValue.Constant(0.0f), VFXValue.Constant(1.0f), inputExpression[5].x, inputExpression[5].y);
                    VFXExpression y = noise.y * rangeMultiplier;
                    VFXExpression z = noise.z * rangeMultiplier;
                    return new[] { x, new VFXExpressionCombine(y, z) };
                }
                else
                {
                    VFXExpression noise = new VFXExpressionPerlinNoise3D(inputExpression[0], parameters, inputExpression[3]);
                    VFXExpression x = VFXOperatorUtility.Fit(noise.x, VFXValue.Constant(0.0f), VFXValue.Constant(1.0f), inputExpression[5].x, inputExpression[5].y);
                    VFXExpression y = noise.y * rangeMultiplier;
                    VFXExpression z = noise.z * rangeMultiplier;
                    VFXExpression w = noise.w * rangeMultiplier;
                    return new[] { x, new VFXExpressionCombine(y, z, w) };
                }
            }
        }

        public override void Sanitize(int version)
        {
            Debug.Log("Sanitizing Graph: Automatically replace PerlinNoise with Noise or CurlNoise");
            Sanitize(NoiseBase.NoiseType.Perlin);
            base.Sanitize(version);
        }
    }
}