text:
package com.gemstone.gemfire.internal.cache;
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp

import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import com.gemstone.gemfire.internal.concurrent.AtomicUpdaterFactory;
import com.gemstone.gemfire.internal.cache.lru.EnableLRU;
import com.gemstone.gemfire.internal.cache.persistence.DiskRecoveryStore;
import com.gemstone.gemfire.internal.concurrent.CustomEntryConcurrentHashMap.HashEntry;
// macros whose definition changes this class:
// disk: DISK
// lru: LRU
// stats: STATS
// versioned: VERSIONED
// offheap: OFFHEAP
// rowlocation: ROWLOCATION
// local: LOCAL
// bucket: BUCKET
// package: PKG
/**
 * Do not modify this class. It was generated.
 * Instead modify LeafRegionEntry.cpp and then run
 * bin/generateRegionEntryClasses.sh from the directory
 * that contains your build.xml.
 */
@SuppressWarnings("serial")
public class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry
{
  public VMThinDiskRegionEntryHeap (RegionEntryContext context, Object key,
    Object value
      ) {
    super(context,
          (value instanceof RecoveredEntry ? null : value)
        );
    // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
    initialize(context, value);
    this.key = key;
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  // common code
  protected int hash;
  private HashEntry<Object, Object> next;
  @SuppressWarnings("unused")
  private volatile long lastModified;
  private static final AtomicLongFieldUpdater<VMThinDiskRegionEntryHeap> lastModifiedUpdater
    = AtomicUpdaterFactory.newLongFieldUpdater(VMThinDiskRegionEntryHeap.class, "lastModified");
  protected long getlastModifiedField() {
    return lastModifiedUpdater.get(this);
  }
  protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) {
    return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue);
  }
  /**
   * @see HashEntry#getEntryHash()
   */
  @Override
  public final int getEntryHash() {
    return this.hash;
  }
  @Override
  protected void setEntryHash(int v) {
    this.hash = v;
  }
  /**
   * @see HashEntry#getNextEntry()
   */
  @Override
  public final HashEntry<Object, Object> getNextEntry() {
    return this.next;
  }
  /**
   * @see HashEntry#setNextEntry
   */
  @Override
  public final void setNextEntry(final HashEntry<Object, Object> n) {
    this.next = n;
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  // disk code
  protected void initialize(RegionEntryContext context, Object value) {
    diskInitialize(context, value);
  }
  @Override
  public int updateAsyncEntrySize(EnableLRU capacityController) {
    throw new IllegalStateException("should never be called");
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  private void diskInitialize(RegionEntryContext context, Object value) {
    DiskRecoveryStore drs = (DiskRecoveryStore)context;
    DiskStoreImpl ds = drs.getDiskStore();
    long maxOplogSize = ds.getMaxOplogSize();
    //get appropriate instance of DiskId implementation based on maxOplogSize
    this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList());
    Helper.initialize(this, drs, value);
  }
  /**
   * DiskId
   *
   * @since 5.1
   */
  protected DiskId id;//= new DiskId();
  public DiskId getDiskId() {
    return this.id;
  }
  @Override
  public void setDiskId(RegionEntry old) {
    this.id = ((AbstractDiskRegionEntry)old).getDiskId();
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  // key code
  private Object key;
  @Override
  public final Object getRawKey() {
    return this.key;
  }
  @Override
  protected void _setRawKey(Object key) {
    this.key = key;
  }
  private volatile Object value;
  @Override
  protected Object getValueField() {
    return this.value;
  }
  @Override
  protected void setValueField(Object v) {
    this.value = v;
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  private static RegionEntryFactory factory = new RegionEntryFactory() {
    public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
      return new VMThinDiskRegionEntryHeap(context, key, value);
    }
    public final Class<?> getEntryClass() {
      return VMThinDiskRegionEntryHeap.class;
    }
    public RegionEntryFactory makeVersioned() {
      return VMThinDiskRegionEntryHeap.getEntryFactory();
    }
    @Override
    public RegionEntryFactory makeOnHeap() {
      return this;
    }
  };
  public static RegionEntryFactory getEntryFactory() {
    return factory;
  }
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}


text:
/** @jsx React.DOM */
//=require react/blog.react

var Blogs = React.createClass({
  render: function() {
    return (

{this.props.currentTag}

          {this.props.blogs.map(function(blog) {
            return <Blog blog={blog} />
          })}

    )
  }
})

redpajama_set_name: RedPajamaGithub


text:
from troubleshooting.framework.libraries.baseString import parseRecoveryArgs
from troubleshooting.framework.libraries.baseList import isSublist,compareList
from troubleshooting.framework.variable.variable import *
from troubleshooting.framework.modules.builder import BuilderFactory
from troubleshooting.framework.modules.manager import ManagerFactory
from troubleshooting.framework.log.logger import logger
from troubleshooting.framework.output.record import  record
from troubleshooting.framework.modules.configuration import  ConfigManagerInstance
import traceback
def recovery(args):
    recoverSteps = parseRecoveryArgs(args)
    logger().info("recovery steps: %s"%recoverSteps)
    recoverStepsName = [step["method"] for step in recoverSteps]
    RecoveryManagerInstance = ManagerFactory().getManager(LAYER.Recovery)
    builderfactory = BuilderFactory()
    builderfactory.getBuilder(LAYER.Recovery).builder()
    recoveryList = RecoveryManagerInstance.get_keyword()

    if isSublist(recoveryList, recoverStepsName):
        for i, step in enumerate(recoverSteps):
            stepName = step["method"]
            stepArgs = step["args"].split(";")

            try:
                status,Log = RecoveryManagerInstance.run_recovery(stepName, *stepArgs)
            except Exception, e:
                logger().error(traceback.format_exc())
                status = STATUS.FAIL
            finally:
                if status == STATUS.FAIL:
                    break

        if status == STATUS.FAIL:
            print "
Recovery Failed!
"

        else:
            record().update_testpoint_status(ConfigManagerInstance.config["R_TestPoint"])
            record().update_testpoint_log(ConfigManagerInstance.config["R_TestPoint"],Log)
            print "
Recovery Successfully!
"

    else:
        print "Unkown Recovery Steps : %s" % compareList(recoveryList, recoverStepsName)


text:
using System.Windows;

namespace Memoizator
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var bootstrapper = new Bootstrapper();
            bootstrapper.Run();
        }
    }
}


text:
The purpose of this document is to record the basic style and design guidelines of CharLS to ensure consistency and
to record decisions.

## Style

### Tabs and Spaces

Spaces with an indent of 4. This to ensure maximum readability with different editors/platforms.
To document this and ensure editors are configured correctly an .editorconfig file and a .clang-format file
is placed in the root of the repository.

### Template: class vs typename

The typename keyword is the preferred keyword to "mark" template variables.

### Prevent header file double include

There are 2 methods to prevent double include:

1) #pragma once. Supported by all main compilers MSVC, GCC, clang and many other compilers, but in essence a compiler extension.

2) #ifdef CHARLS_\<FILENAME> \ #define CHARLS_\<FILENAME> \ #endif construction.

* Given the industry acceptance, use method 1 (easier and less manual code).

## Exceptions and Error Handling

* C++ exceptions should be derived from `std::exception`. (Common accepted idiom)
* The exception should be convertible to an error code to support the C API
* An english error text that describes the problem is extreme useful.

=> Design: std::system_error is the standard solution to throw exceptions from libraries (CharLS is a library)

By deriving an exception type from `std::system_error` user code can catch CharLS exceptions by type.
It make sense to support this common pattern. The alternative is

``` cpp
catch (const std::system_error& e)
{
    if (e.code.category() == charls::jpegls_category())
    {
        // Handle JPEG-LS errors.
    }

    // Note that checking for a single error can be done directly.
    if (e.code == charls::jpegls_invalid_argument_width)
    {
        // ...
    }
}
```

## Types

The type charls_jpegls_encoder is placed in the charls namespace as the type needs also to be defined as a C type.
It makes it also easier to keep the header only type charls::jpegls_encoder and the implementation class charls_jpegls_encoder separate.

## Jpeg-LS Design decisions

### Width and Height

The Jpeg-LS standards support a height and weight up to 2^32-1. This means that at least an 32-bit unsigned integer is
needed to support the complete range. Using unsigned integers has however the drawback that the interoperability with other languages is poor:

C# : supports unsigned 32 bit integers (but .NET marks them as not CLS compliant)
VB.NET : supports unsigned 32 bit integers (but .NET marks them as not CLS compliant)
Java : by default integers are signed
Javascript: only signed integers
Python: only signed integers

Having unsigned integers in the C and C++ application and signed integers in wrapping libaries should
not be a practical problem. Most real world images can be expressed in signed integers,  8K Images = (7680×4320).

### ABI

A C style interface is used to ensure that the ABI is stable. However just a C style API is not enough.
As CharLS can be distributes as a dynamic link library also the filename needs to be managed.

* It should be possible for applications to use v1 and v2 DLL at the same time.

* It should be possible to load the correct CPU architecture from the same directory.

Design (Windows):

* filename = charls-\<ABI version>-\<CPU architecture>.dll

#### Null pointer checking

Passing a NULL pointer as parameter into the C ABI can be handled in 2 ways:

* There can be an explicit check and an error return value.

* The pointer can be dereferenced directly and passing NULL will just crash the process.

Passing a NULL pointer is a defect of the calling application, it is however helpful to
not generate an access violation inside the library module. If the library is build without
symbol info, it is difficult for the user to detect this mistake. Returning a "bad parameter"
error is in this case more helpful.
Note: NULL is the only special value that can be checked, but also the common mistake.

### Variable names versus JPEG-LS Standard

The JPEG-LS standard uses pseudo-code to define certain parts of the algorithm. It makes
sense to define a good naming convention. Not all JPEG-LS names are good C++ variable\parameter names.

| JPEG-LS Symbol | C++ name                 | Description |
| -------------- | ------------------------ |------------ |
| a, b, c, d     | a, b, c, d               | positions of samples in the causal template |
| bpp            | bits_per_pixel           | number of bits needed to represent MAXVAL (not less than 2) |
| D1, D2, D3, Di | d1, d2, d3, di           | local gradients |
| EMErrval       | e_mapped_error_value     | Errval mapped to non-negative integers in run interruption mode |
| Errval         | error_value              | prediction error (quantized or unquantized, before and after modulo reduction) |
| ILV            | interleave_mode          | indication of the interleave mode used for the scan |
| LIMIT          | limit                    | the value of glimit for a sample encoded in regular mode |
| J[0..31]       | J[0..31]                 | 32 variables indicating order of run-length codes |
| k              | k (or golomb_code)       | Golomb coding variable for regular mode |
| MErrval        | mapped_error_value       | Errval mapped to non-negative integers in regular mode |
| MAXVAL         | maximum_sample_value     | maximum possible image sample value over all components of a scan |
| NEAR           | near_lossless            | difference bound for near-lossless coding |
| Px             | predicted_value          | predicted value for the current sample |
| Q1, Q2, Q3, Qi | q1, q2, q3, qi           | region numbers to quantize local gradients |
| qbpp           | quantized_bits_per_pixel | number of bits needed to represent a mapped error value |
| Ra, Rb, Rc, Rd | ra, rb, rc, rd           | reconstructed values of samples in the causal template |
| RANGE          | range                    | range of prediction error representation
| RESET          | reset_threshold          | threshold value at which A, B, and N are halved |

### Supported C++ language

CharLS currently targets C++14 on the main branch. This will be done until December 2022 (5 years after the release of C++17)

#### Features currently not available (C++17)

* nodiscard attribute
* maybe_unused attribute
* Inline variables
* Guaranteed copy elision
* constexpr if-statements
* __has_include
* std::byte
* clamp ?

#### Features currently not available (C++20)

The following features are available in C++20 (usable after 2023), or in dual language support mode.

* endian
* \<span>
* modules

### Portable Anymap Format

The de facto standard used by the JPEG standard to deliver test files is the Portable Anymap Format.
This format has been made populair by the netpbm project. It is an extreme simple format and only
designed to make it easy to exchange images on many platforms.
It consists of the following variants

* P5 = Portable Graymap (0 ... 16 bits monochrome), extension = .pgm
* P6 = Portable PixMap (0 .. 16 bits RGB), extension = .ppm
* P7 = Portable Arbitrary Map (0..16 bits, N channels), extension = .pam

### External components \ Package Manager

One of the missing features of C++ is a standard Package Manager. The following packages would be useful to use:

* Cross-platform unit test library (for example Catch2)
* Library to read Anymap files (for example Netpbm)
* Library to parse command line parameters (for example Clara, CLI11)

### Performance

#### Decoding the bitstream

There are 2 main ways to decode the bitstream

* Basic: Read it byte for byte and store the results in a cache variable

* Improved: read when possible a register in 1 step. The problem is that 0xFF can exists in the
bitstream. If such a 0xFF exists the next bit needs to be ignored. There are a couple of way to do this:
  * A) Search for the first position with a 0xFF it and remember the position. 0xFFs are rare.
  * B) Search for the first 0xFF with memchr. memchr can leverage special CPU instructions when possible.
  * C) Load a register and check if it contains a 0xFF byte.

Measurements conclusion: option B is the fastest on x64. This is the original algorithm. There is not a large difference between the different options.
Examples of decoding performance on a AMD 5950X x64 CPU:

| Image                       | Basic   | Improved A | Improved B |Improved C |
| --------------              | ------- | ---------- | ---------- |---------- |
| 16 bit 512 * 512 (CT image) | 3.09 ms | 3.17 ms    | 3.06 ms    | 3.10 ms   |
|  8 bit 5412 * 7216          | 517 ms  | 509 ms     | 507 ms     | 512 ms    |

#### Using special "checked" functions for decoding

The input data for decoding is untrusted. Additional checks are included to detect invalid bitstream data.
Most of these routines are also shared with the encoding process.
Measurements show that there is no impact by creating special functions that don't these checks.
In normal cases the checks never fail and the unlikely branch is never taken. This makes is very easy for
the CPU branch predictor to always the correct outcome based on the branch history.

### Supported C++ Compilers

#### Clang

Recommended warnings:

* -Wall (warning collection switch)
* -Wextra (warning collection switch)
* -Wnon-gcc (warning collection switch)
* -Walloca (not included in Wall or Wextra)
* -Wcast-qual (not included in Wall or Wextra)
* -Wformat=2 (not included in Wall or Wextra)
* -Wformat-security (enabled by -Wformat=2)
* -Wnull-dereference (enabled by default)
* -Wstack-protector (enabled by default)
* -Wvla (not included in Wall or Wextra)
* -Warray-bounds (enabled by default)
* -Warray-bounds-pointer-arithmetic (not included in Wall or Wextra)
* -Wassign-enum (not included in Wall or Wextra)
* -Wbad-function-cast (not included in Wall or Wextra)
* -Wconditional-uninitialized (not included in Wall or Wextra)
* -Wconversion (enabled by Wnon-gcc)
* -Widiomatic-parentheses (not included in Wall or Wextra)
* -Wimplicit-fallthrough (not included in Wall or Wextra)
* -Wloop-analysis (not included in Wall or Wextra)
* -Wpointer-arith (not included in Wall or Wextra)
* -Wshift-sign-overflow (not included in Wall or Wextra)
* -Wshorten-64-to-32 (enabled by Wnon-gcc)
* -Wswitch-enum (not included in Wall or Wextra)
* -Wtautological-constant-in-range-compare (not included in Wall or Wextra)
* -Wunreachable-code-aggressive (not included in Wall or Wextra)
* -Wthread-safety (not included in Wall or Wextra)
* -Wthread-safety-beta (not included in Wall or Wextra)
* -Wcomma (not included in Wall or Wextra)


text:
using System;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Win32;
using System.Windows;

namespace System.Windows.Input
{
    /// <summary>
    ///     The RawUIStateInputReport class encapsulates the raw input
    ///     provided from WM_*UISTATE* messages.
    /// </summary>
    internal class RawUIStateInputReport : InputReport
    {
         /// <summary>
        ///     Constructs an instance of the RawUIStateInputReport class.
        /// </summary>
        /// <param name="inputSource">
        ///     The input source that provided this input.
        /// </param>
        /// <param name="mode">
        ///     The mode in which the input is being provided.
        /// </param>
        /// <param name="timestamp">
        ///     The time when the input occured.
        /// </param>
        /// <param name="action">
        ///     The action being reported.
        /// </param>
        /// <param name="targets">
        ///     The targets being reported.
        /// </param>
        /// <SecurityNote>
        ///     Critical:This handles critical data in the form of PresentationSource
        ///     TreatAsSafe:The data has demands on the property when someone tries to access it.
        /// </SecurityNote>
        [SecurityCritical,SecurityTreatAsSafe]
        public RawUIStateInputReport(
            PresentationSource inputSource,
            InputMode mode,
            int timestamp,
            RawUIStateActions action,
            RawUIStateTargets targets) : base(inputSource, InputType.Keyboard, mode, timestamp)
        {
            if (!IsValidRawUIStateAction(action))
                throw new System.ComponentModel.InvalidEnumArgumentException("action", (int)action, typeof(RawUIStateActions));
            if (!IsValidRawUIStateTargets(targets))
                throw new System.ComponentModel.InvalidEnumArgumentException("targets", (int)targets, typeof(RawUIStateTargets));

            _action = action;
            _targets = targets;
        }

        /// <summary>
        ///     Read-only access to the action that was reported.
        /// </summary>
        public RawUIStateActions Action {get {return _action;}}

        /// <summary>
        ///     Read-only access to the targets that were reported.
        /// </summary>
        public RawUIStateTargets Targets {get {return _targets;}}

        // IsValid Method for RawUIStateActions.
        internal static bool IsValidRawUIStateAction(RawUIStateActions action)
        {
            return (action == RawUIStateActions.Set ||
                    action == RawUIStateActions.Clear ||
                    action == RawUIStateActions.Initialize);
        }

        // IsValid Method for RawUIStateTargets. Relies on the enum being [Flags].
        internal static bool IsValidRawUIStateTargets(RawUIStateTargets targets)
        {
            return ((targets & (RawUIStateTargets.HideFocus |
                                RawUIStateTargets.HideAccelerators |
                                RawUIStateTargets.Active))
                    == targets);
        }

        private RawUIStateActions _action;
        private RawUIStateTargets _targets;
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('node', '0003_node_is_paused_errors'),
        ('queue', '0004_remove_queue_is_job_type_paused'),
    ]

    operations = [
        migrations.AddField(
            model_name='queue',
            name='node_required',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, blank=True, to='node.Node', null=True),
            preserve_default=True,
        ),
    ]


text:
{-# LANGUAGE OverloadedStrings #-}
-- | Organization API.
module Web.Mackerel.Api.Organization (getOrganization) where

import Network.HTTP.Types (StdMethod(..))

import Web.Mackerel.Client
import Web.Mackerel.Internal.Api
import Web.Mackerel.Types.Organization

getOrganization :: Client -> IO (Either ApiError Organization)
getOrganization client = request client GET "/api/v0/org" [] emptyBody (createHandler id)


text:
<?php

/** @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();

$table = $installer->getConnection()
    ->newTable($installer->getTable('admin/permission_variable'))
    ->addColumn('variable_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'identity'  => true,
        'unsigned'  => true,
        'nullable'  => false,
        'primary'   => true,
    ), 'Variable ID')
    ->addColumn('variable_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'primary'   => true,
        'nullable'  => false,
        'default'   => "",
        ), 'Config Path')
    ->addColumn('is_allowed', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
        'nullable'  => false,
        'default'   => 0,
        ), 'Mark that config can be processed by filters')
    ->addIndex($installer->getIdxName('admin/permission_variable', array('variable_name'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
        array('variable_name'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
    ->setComment('System variables that can be processed via content filter');
$installer->getConnection()->createTable($table);

$installer->getConnection()->insertMultiple(
    $installer->getTable('admin/permission_variable'),
    array(
        array('variable_name' => 'trans_email/ident_support/name', 'is_allowed' => 1),
        array('variable_name' => 'trans_email/ident_support/email','is_allowed' =>  1),
        array('variable_name' => 'web/unsecure/base_url','is_allowed' =>  1),
        array('variable_name' => 'web/secure/base_url','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_general/name','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_general/email', 'is_allowed' => 1),
        array('variable_name' => 'trans_email/ident_sales/name','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_sales/email','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_custom1/name','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_custom1/email','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_custom2/name','is_allowed' =>  1),
        array('variable_name' => 'trans_email/ident_custom2/email','is_allowed' =>  1),
        array('variable_name' => 'general/store_information/name', 'is_allowed' => 1),
        array('variable_name' => 'general/store_information/phone','is_allowed'  => 1),
        array('variable_name' => 'general/store_information/address', 'is_allowed' => 1),
    )
);

$table = $installer->getConnection()
    ->newTable($installer->getTable('admin/permission_block'))
    ->addColumn('block_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'identity'  => true,
        'unsigned'  => true,
        'nullable'  => false,
        'primary'   => true,
        ), 'Block ID')
    ->addColumn('block_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'nullable'  => false,
        'default'   => "",
        ), 'Block Name')
    ->addColumn('is_allowed', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
        'nullable'  => false,
        'default'   => 0,
        ), 'Mark that block can be processed by filters')
    ->addIndex($installer->getIdxName('admin/permission_block', array('block_name'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
        array('block_name'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
    ->setComment('System blocks that can be processed via content filter');
$installer->getConnection()->createTable($table);

$installer->getConnection()->insertMultiple(
    $installer->getTable('admin/permission_block'),
    array(
        array('block_name' => 'core/template', 'is_allowed' => 1),
        array('block_name' => 'catalog/product_new', 'is_allowed' => 1),
    )
);

$installer->endSetup();


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <title>Coverage for /home/wia/PycharmProjects/wia/venv/lib/python3.5/site-packages/urllib3/util/connection.py: 64%</title>
    <link rel="stylesheet" href="style.css" type="text/css">

Coverage for /home/wia/PycharmProjects/wia/venv/lib/python3.5/site-packages/urllib3/util/connection.py :
            64%

            66 statements
            42 run
            24 missing
            0 excluded

Hot-keys on this page

        r
        m
        x
        p   toggle line displays

        j
        k   next/prev highlighted chunk

        0   (zero) top of page

        1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

from __future__ import absolute_import

import socket

from .wait import wait_for_read

from .selectors import HAS_SELECT, SelectorError

def is_connection_dropped(conn):  # Platform-specific

    """

    Returns True if the connection is dropped and should be closed.

    :param conn:

        :class:`httplib.HTTPConnection` object.

    Note: For platforms like AppEngine, this will always return ``False`` to

    let the platform handle connection recycling transparently for us.

    """

    sock = getattr(conn, 'sock', False)

    if sock is False:  # Platform-specific: AppEngine

        return False

    if sock is None:  # Connection already closed (such as by httplib).

        return True

    if not HAS_SELECT:

        return False

    try:

        return bool(wait_for_read(sock, timeout=0.0))

    except SelectorError:

        return True

# This function is copied from socket.py in the Python 2.7 standard

# library test suite. Added to its signature is only `socket_options`.

# One additional modification is that we avoid binding to IPv6 servers

# discovered in DNS if the system doesn't have IPv6 functionality.

def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,

                      source_address=None, socket_options=None):

    """Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,

    port)``) and return the socket object.  Passing the optional

    *timeout* parameter will set the timeout on the socket instance

    before attempting to connect.  If no *timeout* is supplied, the

    global default timeout setting returned by :func:`getdefaulttimeout`

    is used.  If *source_address* is set it must be a tuple of (host, port)

    for the socket to bind as a source address before making the connection.

    An host of '' or port 0 tells the OS to use the default.

    """

    host, port = address

    if host.startswith('['):

        host = host.strip('[]')

    err = None

    # Using the value from allowed_gai_family() in the context of getaddrinfo lets

    # us select whether to work with IPv4 DNS records, IPv6 records, or both.

    # The original create_connection function always returns all records.

    family = allowed_gai_family()

    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):

        af, socktype, proto, canonname, sa = res

        sock = None

        try:

            sock = socket.socket(af, socktype, proto)

            # If provided, set socket level options before connecting.

            _set_socket_options(sock, socket_options)

            if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:

                sock.settimeout(timeout)

            if source_address:

                sock.bind(source_address)

            sock.connect(sa)

            return sock

        except socket.error as e:

            err = e

            if sock is not None:

                sock.close()

                sock = None

    if err is not None:

        raise err

    raise socket.error("getaddrinfo returns an empty list")

def _set_socket_options(sock, options):

    if options is None:

        return

    for opt in options:

        sock.setsockopt(*opt)

def allowed_gai_family():

    """This function is designed to work in the context of

    getaddrinfo, where family=socket.AF_UNSPEC is the default and

    will perform a DNS search for both IPv6 and IPv4 records."""

    family = socket.AF_INET

    if HAS_IPV6:

        family = socket.AF_UNSPEC

    return family

def _has_ipv6(host):

    """ Returns True if the system can bind an IPv6 address. """

    sock = None

    has_ipv6 = False

    if socket.has_ipv6:

        # has_ipv6 returns true if cPython was compiled with IPv6 support.

        # It does not tell us if the system has IPv6 support enabled. To

        # determine that we must bind to an IPv6 address.

        # https://github.com/shazow/urllib3/pull/611

        # https://bugs.python.org/issue658327

        try:

            sock = socket.socket(socket.AF_INET6)

            sock.bind((host, 0))

            has_ipv6 = True

        except Exception:

            pass

    if sock:

        sock.close()

    return has_ipv6

HAS_IPV6 = _has_ipv6('::1')

            « index     coverage.py v4.2,
            created at 2018-03-13 10:37


text:
@interface ODRefreshControl : UIControl {
    CAShapeLayer *_shapeLayer;
    CAShapeLayer *_arrowLayer;
    CAShapeLayer *_highlightLayer;
    UIView *_activity;
    BOOL _refreshing;
    BOOL _canRefresh;
    BOOL _ignoreInset;
    BOOL _ignoreOffset;
    BOOL _didSetInset;
    BOOL _hasSectionHeaders;
}

@property (nonatomic, readonly) BOOL refreshing;
@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle;

- (id)initInScrollView:(UIScrollView *)scrollView;

// use custom activity indicator
- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity;

// Tells the control that a refresh operation was started programmatically
- (void)beginRefreshing;

// Tells the control the refresh operation has ended
- (void)endRefreshing;

@end


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--配置来自于mybatis 配置官网:http://www.mybatis.org/mybatis-3/zh/configuration.html#settings-->

<configuration>

    <settings>
        <!--jdbc自动生成主键-->
        <setting name="useGeneratedKeys" value="true"/>
        <!--驼峰命名转换:即从经典数据库列名 A_COLUMN 到经典 Java 属性名 aColumn 的类似映射-->
        <setting name="mapUnderscoreToCamelCase" value="true"/>

        <!--使用列标签代替列名-->
        <setting name="useColumnLabel" value="true"/>
    </settings>
    <!--mybatis 分页插件-->
    <!--<plugins>-->
        <!--<plugin interceptor="cn.bdqn.mybatis.plugin.PaginationInterceptor">-->
            <!--<property name="dialectClass" value="cn.bdqn.mybatis.plugin.MySQLDialect"/>-->
        <!--</plugin>-->
    <!--</plugins>-->

</configuration>


text:
'use strict';

Object.defineProperty(exports, '__esModule', {
    value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _Node = require('./Node');

var _Node2 = _interopRequireDefault(_Node);

/**
 * A `Structure` is an abstract class that all data structures extend from.
 *
 * @abstract
 */

var Structure = (function () {
    function Structure() {
        _classCallCheck(this, Structure);
    }

    _createClass(Structure, [{
        key: 'createNode',

        /**
         * Create a new Node and assign a value.
         *
         * @param {*} data
         * @returns {Node}
         */
        value: function createNode(data) {
            return new _Node2['default'](data);
        }

        /**
         * Throw an error with a custom interpolated message.
         *
         * @param {String} message
         * @param {Object} params
         */
    }, {
        key: 'error',
        value: function error(message) {
            var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

            params['class'] = this.constructor.name;

            Object.keys(params).forEach(function (key) {
                message = message.replace('{' + key + '}', params[key]);
            });

            throw new Error(message);
        }
    }]);

    return Structure;
})();

exports['default'] = Structure;
module.exports = exports['default'];


text:
package org.wso2.balana.cond.cluster.xacml3;

import org.wso2.balana.cond.Function;
import org.wso2.balana.cond.cluster.FunctionCluster;
import org.wso2.balana.cond.xacml3.StringConversionFunction;

import java.util.HashSet;
import java.util.Set;

/**
 * Clusters all the functions supported by StringConversionFunction
 */
public class StringConversionFunctionCluster implements FunctionCluster {

    public Set<Function> getSupportedFunctions() {
        Set<Function> set = new HashSet<Function>();
        for (String identifier : StringConversionFunction.getSupportedIdentifiers()){
            set.add(new StringConversionFunction(identifier));
        }
        return set;
    }
}


text:
package com.groupon.jenkins.dynamic.build.api;

import com.groupon.jenkins.dynamic.build.cause.BuildCause;
import hudson.model.Cause;
import hudson.model.ParameterValue;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;

import java.io.IOException;
import java.util.List;

@ExportedBean
public abstract class Build {

    @Exported
    public abstract int getNumber();
    @Exported
    public abstract String getResult();

    @Exported(inline = true)
    public abstract BuildCause.CommitInfo getCommit();

    @Exported
    public abstract String getDisplayTime();
    @Exported
    public abstract long getDuration();
    @Exported
    public abstract String getDurationString();

    @Exported
    public abstract boolean isCancelable();
    @Exported
    public abstract String getCancelUrl();

    @Exported
    public abstract String getUrl();

    @Exported
    public abstract String getFullUrl();

    @Exported
    public abstract Cause getCause();

    @Exported
    public abstract List<ParameterValue> getParameters();

    @Exported(inline = true)
    public abstract String getId();

}


text:
@extends('template.basicoAdmin.main')
@section('titulo_container','Lista Usuarios')
@section('titulo_pestaña','Miembros')

@section('contenido_container')

            Nombre
            Apellido
            Telefono
            Email
            Foto

            @foreach($usuarios as $usuario)

                    {{$usuario->nombre}}
                    {{$usuario->apellido}}
                    {{$usuario->telefono}}
                    {{$usuario->email}}
                    {{$usuario->foto}}
                    id)}}" class="btn btn-info">
                        id)}}" onclick="return confirm('¿seguro que desea eliminar al usuario?')"
                           class="btn btn-danger">

            @endforeach

    {!! $usuarios->render() !!}

    Registrar nuevo usuario
@endsection


text:
.. webapi-error::
   :title: Repository File Not Found
   :instance: reviewboard.webapi.errors.REPO_FILE_NOT_FOUND
   :example-data:
       {
           "file": "/src/foobar.c",
           "revision": 42
       }

   A file specified in a request that should have been in the repository was
   not found there. This could be a problem with the path or the revision.

   This will provide ``file`` and ``revision`` keys containing the file path
   and revision that failed.


text:
using System.Collections;
using LLVMSharp.Compiler.Ast;

namespace LLVMSharp.Compiler
{
    public partial class LLVMSharpCompiler
    {
        internal void CheckEntryPoint(Hashtable methodTable, AstType astType)
        {
            const string mainFunction = "_mt_4Main";

            foreach (string methodKey in methodTable.Keys)
            {
                if (methodKey.EndsWith(mainFunction)) // possible candidate for entry point
                {
                    AstMethod astMethod = (AstMethod)methodTable[methodKey];
                    if (astMethod.AstMemberModifierCollection.IsStatic)
                    {
                        if (astMethod.FullQReturnType == "System.Void" || astMethod.FullQReturnType == "System.Int32")
                        {
                            if (astMethod.Parameters.Count == 0) // rite now we dont support string[] args
                            {
                                if (EntryPoint == null)
                                {
                                    EntryPointFQType = astMethod.FullQReturnType;
                                    EntryPoint = astMethod;
                                    EntryPointAstType = astType;
                                }
                                else // there already exist an entry point before
                                {
                                    Errors.Add(new ErrorInfo(
                                        ErrorType.SymenticError, "Program has more than one entry point defined",
                                        astMethod.LineNumber, astMethod.ColumnNumber, astMethod.Path));
                                }
                            }
                        }
                    }
                }
            }
        }

        //public AstMethod CheckEntryPoint(LLVMSharpCompiler Compiler)
        //{
        //    return null;
        //    /*  string MainFunction1 = "_mt_4Main";
        //      string MainFunction2 = "_mt_4Main_14_6System6String";
        //      AstMethod MainFunc = null;
        //      bool MainEntry = false;
        //      foreach (AstSourceFile astSource in Compiler.AstProgram.SourceFiles)
        //      {
        //          foreach (AstNamespaceBlock astNameSp in astSource.AstNamespaceBlockCollection)
        //          {
        //              foreach (AstType astType in astNameSp.AstTypeCollection)
        //              {
        //                  #region CheckClasses
        //                  if (astType is AstClass)
        //                  {
        //                      AstClass astClass = (AstClass)astType;
        //                      if (astClass.methodTable.Contains(MainFunction1))
        //                      {
        //                          MainFunc = (AstMethod)astClass.methodTable[MainFunction1];
        //                          if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                          {
        //                              if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                              {
        //                                  MainEntry = true;
        //                                  EntryPointFQType = astType.FullQualifiedName;
        //                              }
        //                          }
        //                      }
        //                      if (astClass.methodTable.Contains(MainFunction2) && MainEntry)
        //                      {
        //                          ErrorInfo e = new ErrorInfo();
        //                          e.message = "Program has more than one defined entry point";
        //                          e.type = ErrorType.SymenticError;
        //                          Compiler.Errors.Add(e);
        //                      }
        //                      if (astClass.methodTable.Contains(MainFunction2) && !MainEntry)
        //                      {
        //                          MainFunc = (AstMethod)astClass.methodTable[MainFunction2];
        //                          if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                          {
        //                              if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                              {
        //                                  MainEntry = true;
        //                                  EntryPointFQType = astType.FullQualifiedName;
        //                              }
        //                          }
        //                      }

        //                  }
        //                  #endregion
        //                  #region CheckStructs
        //                  if (astType is AstStruct)
        //                  {
        //                      AstStruct astStruct = (AstStruct)astType;
        //                      if (astStruct.methodTable.Contains(MainFunction1) && MainEntry || astStruct.methodTable.Contains(MainFunction2) && MainEntry)
        //                      {
        //                          ErrorInfo e = new ErrorInfo();
        //                          e.type = ErrorType.SymenticError;
        //                          e.message = "Program has more than one defined entry point";
        //                          Compiler.Errors.Add(e);
        //                      }
        //                      if (astStruct.methodTable.Contains(MainFunction1) && !MainEntry)
        //                      {
        //                          MainFunc = (AstMethod)astStruct.methodTable[MainFunction1];
        //                          if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                          {
        //                              if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                              {
        //                                  MainEntry = true;
        //                                  EntryPointFQType = astType.FullQualifiedName;
        //                              }
        //                          }
        //                      }
        //                      if (astStruct.methodTable.Contains(MainFunction2) && !MainEntry)
        //                      {
        //                          MainFunc = (AstMethod)astStruct.methodTable[MainFunction2];
        //                          if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                          {
        //                              if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                              {
        //                                  MainEntry = true;
        //                                  EntryPointFQType = astType.FullQualifiedName;
        //                              }
        //                          }
        //                      }
        //                  }
        //                  #endregion

        //              }

        //          }

        //          foreach (AstType astType in astSource.AstTypeCollection)
        //          {
        //              #region CheckClasses
        //              if (astType is AstClass)
        //              {
        //                  AstClass astClass = (AstClass)astType;
        //                  if (astClass.methodTable.Contains(MainFunction1))
        //                  {
        //                      MainFunc = (AstMethod)astClass.methodTable[MainFunction1];
        //                      if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                      {
        //                          if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                          {
        //                              MainEntry = true;
        //                              EntryPointFQType = astType.FullQualifiedName;
        //                          }
        //                      }
        //                  }
        //                  if (astClass.methodTable.Contains(MainFunction2) && MainEntry)
        //                  {
        //                      ErrorInfo e = new ErrorInfo();
        //                      e.message = "Program has more than one defined entry point";
        //                      e.type = ErrorType.SymenticError;
        //                      Compiler.Errors.Add(e);
        //                  }
        //                  if (astClass.methodTable.Contains(MainFunction2) && !MainEntry)
        //                  {
        //                      MainFunc = (AstMethod)astClass.methodTable[MainFunction2];
        //                      if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                      {
        //                          if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                          { MainEntry = true; EntryPointFQType = astType.FullQualifiedName; }
        //                      }
        //                  }

        //              }
        //              #endregion
        //              #region CheckStructs
        //              if (astType is AstStruct)
        //              {
        //                  AstStruct astStruct = (AstStruct)astType;
        //                  if (astStruct.methodTable.Contains(MainFunction1) && MainEntry || astStruct.methodTable.Contains(MainFunction2) && MainEntry)
        //                  {
        //                      ErrorInfo e = new ErrorInfo();
        //                      e.type = ErrorType.SymenticError;
        //                      e.message = "Program has more than one defined entry point";
        //                      Compiler.Errors.Add(e);
        //                  }
        //                  if (astStruct.methodTable.Contains(MainFunction1) && !MainEntry)
        //                  {
        //                      MainFunc = (AstMethod)astStruct.methodTable[MainFunction1];
        //                      if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                      {
        //                          if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                          { MainEntry = true; EntryPointFQType = astType.FullQualifiedName; }
        //                      }
        //                  }
        //                  if (astStruct.methodTable.Contains(MainFunction2) && !MainEntry)
        //                  {
        //                      MainFunc = (AstMethod)astStruct.methodTable[MainFunction2];
        //                      if (MainFunc.AstMemberModifierCollection.IsStatic)
        //                      {
        //                          if (MainFunc.FullQReturnType == "System.Void" || MainFunc.FullQReturnType == "System.Int32")
        //                          { MainEntry = true; EntryPointFQType = astType.FullQualifiedName; }
        //                      }
        //                  }
        //              }
        //              #endregion
        //          }
        //      }
        //      if (!MainEntry)
        //      {
        //          ErrorInfo e = new ErrorInfo();
        //          e.message = " The Program does not contain a static method 'Main' suitable for an entry point";
        //          e.type = ErrorType.SymenticError;
        //          Compiler.Errors.Add(e);
        //          return null;
        //      }
        //      else { return MainFunc; }*/

        //}

    }
}


text:
package black.door.intertalk;

import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * Created by nfischer on 9/6/2016.
 */
@ToString
@EqualsAndHashCode
public class User {
	public String handle;
	public byte[] password;
	public byte[] salt;
}


text:
import os, random, string

length = 13
chars = string.ascii_letters + string.digits + '!@#$%^&*()-=+'
random.seed = (os.urandom(2000))

print ''.join(random.choice(chars) for i in range (length))


text:
<?php

namespace Furbook\Providers;

use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\View\Factory as ViewFactory;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(ViewFactory $view)
    {
        $view->composer('partials.forms.cat', \Furbook\Http\Views\Composers\CatFormComposer::class);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}


text:
Conditions

<select data-rv-value="model.<%= Formbuilder.options.mappings.MATCH_CONDITIONS %>">
  <option value="or">Select Matching</option>
  <option value="and">Match All Conditions</option>
  <option value="or">Match Any Conditions</option>
</select>

       If

        <select data-rv-value='condition:source'>
          <option value="">Select Field</option>
          <% var con_source_fields = opts.parentView.collection.exceptRecurAndNonInputFields().sort();%>
          <% for( var i=0 ; i < con_source_fields.length ; i++){%>
            <% if(con_source_fields.toJSON()[i].cid == rf.getCid()){ %>
              <% break %>
            <% } %>
            <option value="<%= con_source_fields.toJSON()[i].cid %>"><%= con_source_fields.toJSON()[i].label %></option>
          <%}%>
        </select>

       field

        <select data-rv-value='condition:condition'>
            <option value="">Select Comparator</option>
            <option>equals</option>
            <option>greater than</option>
            <option>less than</option>
            <option>is not empty</option>
        </select>

      <input class='span5 pull-right' data-rv-input='condition:value' type='text'/>
       then

        <select data-rv-value='condition:action'>
            <option value="">Select Action</option>
            <option>show</option>
            <option>hide</option>
        </select>

        <input type='text' class='fb-this-field-input' disabled value='This Field'>

      <a class="pull-right js-remove-condition <%= Formbuilder.options.BUTTON_CLASS %>" title="Remove Condition">

  <a class="js-add-condition <%= Formbuilder.options.BUTTON_CLASS %>">Add Condition


text:
export * from './toastdemo.component';
export * from './toastdemo.route';


text:
/**
 * Autogenerated by Thrift Compiler (0.9.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package net.floodlightcontroller.packetstreamer.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings("all") public class Message implements org.apache.thrift.TBase<Message, Message._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Message");

  private static final org.apache.thrift.protocol.TField SESSION_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionIDs", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField PACKET_FIELD_DESC = new org.apache.thrift.protocol.TField("packet", org.apache.thrift.protocol.TType.STRUCT, (short)2);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new MessageStandardSchemeFactory());
    schemes.put(TupleScheme.class, new MessageTupleSchemeFactory());
  }

  public List<String> sessionIDs; // required
  public Packet packet; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    SESSION_IDS((short)1, "sessionIDs"),
    PACKET((short)2, "packet");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // SESSION_IDS
          return SESSION_IDS;
        case 2: // PACKET
          return PACKET;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.SESSION_IDS, new org.apache.thrift.meta_data.FieldMetaData("sessionIDs", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Packet.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Message.class, metaDataMap);
  }

  public Message() {
  }

  public Message(
    List<String> sessionIDs,
    Packet packet)
  {
    this();
    this.sessionIDs = sessionIDs;
    this.packet = packet;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Message(Message other) {
    if (other.isSetSessionIDs()) {
      List<String> __this__sessionIDs = new ArrayList<String>();
      for (String other_element : other.sessionIDs) {
        __this__sessionIDs.add(other_element);
      }
      this.sessionIDs = __this__sessionIDs;
    }
    if (other.isSetPacket()) {
      this.packet = new Packet(other.packet);
    }
  }

  public Message deepCopy() {
    return new Message(this);
  }

  @Override
  public void clear() {
    this.sessionIDs = null;
    this.packet = null;
  }

  public int getSessionIDsSize() {
    return (this.sessionIDs == null) ? 0 : this.sessionIDs.size();
  }

  public java.util.Iterator<String> getSessionIDsIterator() {
    return (this.sessionIDs == null) ? null : this.sessionIDs.iterator();
  }

  public void addToSessionIDs(String elem) {
    if (this.sessionIDs == null) {
      this.sessionIDs = new ArrayList<String>();
    }
    this.sessionIDs.add(elem);
  }

  public List<String> getSessionIDs() {
    return this.sessionIDs;
  }

  public Message setSessionIDs(List<String> sessionIDs) {
    this.sessionIDs = sessionIDs;
    return this;
  }

  public void unsetSessionIDs() {
    this.sessionIDs = null;
  }

  /** Returns true if field sessionIDs is set (has been assigned a value) and false otherwise */
  public boolean isSetSessionIDs() {
    return this.sessionIDs != null;
  }

  public void setSessionIDsIsSet(boolean value) {
    if (!value) {
      this.sessionIDs = null;
    }
  }

  public Packet getPacket() {
    return this.packet;
  }

  public Message setPacket(Packet packet) {
    this.packet = packet;
    return this;
  }

  public void unsetPacket() {
    this.packet = null;
  }

  /** Returns true if field packet is set (has been assigned a value) and false otherwise */
  public boolean isSetPacket() {
    return this.packet != null;
  }

  public void setPacketIsSet(boolean value) {
    if (!value) {
      this.packet = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SESSION_IDS:
      if (value == null) {
        unsetSessionIDs();
      } else {
        setSessionIDs((List<String>)value);
      }
      break;

    case PACKET:
      if (value == null) {
        unsetPacket();
      } else {
        setPacket((Packet)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SESSION_IDS:
      return getSessionIDs();

    case PACKET:
      return getPacket();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case SESSION_IDS:
      return isSetSessionIDs();
    case PACKET:
      return isSetPacket();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof Message)
      return this.equals((Message)that);
    return false;
  }

  public boolean equals(Message that) {
    if (that == null)
      return false;

    boolean this_present_sessionIDs = true && this.isSetSessionIDs();
    boolean that_present_sessionIDs = true && that.isSetSessionIDs();
    if (this_present_sessionIDs || that_present_sessionIDs) {
      if (!(this_present_sessionIDs && that_present_sessionIDs))
        return false;
      if (!this.sessionIDs.equals(that.sessionIDs))
        return false;
    }

    boolean this_present_packet = true && this.isSetPacket();
    boolean that_present_packet = true && that.isSetPacket();
    if (this_present_packet || that_present_packet) {
      if (!(this_present_packet && that_present_packet))
        return false;
      if (!this.packet.equals(that.packet))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  public int compareTo(Message other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    Message typedOther = (Message)other;

    lastComparison = Boolean.valueOf(isSetSessionIDs()).compareTo(typedOther.isSetSessionIDs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSessionIDs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionIDs, typedOther.sessionIDs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPacket()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("Message(");
    boolean first = true;

    sb.append("sessionIDs:");
    if (this.sessionIDs == null) {
      sb.append("null");
    } else {
      sb.append(this.sessionIDs);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("packet:");
    if (this.packet == null) {
      sb.append("null");
    } else {
      sb.append(this.packet);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (packet != null) {
      packet.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class MessageStandardSchemeFactory implements SchemeFactory {
    public MessageStandardScheme getScheme() {
      return new MessageStandardScheme();
    }
  }

  private static class MessageStandardScheme extends StandardScheme<Message> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Message struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // SESSION_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.sessionIDs = new ArrayList<String>(_list0.size);
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
                {
                  String _elem2; // required
                  _elem2 = iprot.readString();
                  struct.sessionIDs.add(_elem2);
                }
                iprot.readListEnd();
              }
              struct.setSessionIDsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PACKET
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.packet = new Packet();
              struct.packet.read(iprot);
              struct.setPacketIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, Message struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.sessionIDs != null) {
        oprot.writeFieldBegin(SESSION_IDS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.sessionIDs.size()));
          for (String _iter3 : struct.sessionIDs)
          {
            oprot.writeString(_iter3);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.packet != null) {
        oprot.writeFieldBegin(PACKET_FIELD_DESC);
        struct.packet.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class MessageTupleSchemeFactory implements SchemeFactory {
    public MessageTupleScheme getScheme() {
      return new MessageTupleScheme();
    }
  }

  private static class MessageTupleScheme extends TupleScheme<Message> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetSessionIDs()) {
        optionals.set(0);
      }
      if (struct.isSetPacket()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetSessionIDs()) {
        {
          oprot.writeI32(struct.sessionIDs.size());
          for (String _iter4 : struct.sessionIDs)
          {
            oprot.writeString(_iter4);
          }
        }
      }
      if (struct.isSetPacket()) {
        struct.packet.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.sessionIDs = new ArrayList<String>(_list5.size);
          for (int _i6 = 0; _i6 < _list5.size; ++_i6)
          {
            String _elem7; // required
            _elem7 = iprot.readString();
            struct.sessionIDs.add(_elem7);
          }
        }
        struct.setSessionIDsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.packet = new Packet();
        struct.packet.read(iprot);
        struct.setPacketIsSet(true);
      }
    }
  }

}


text:
package io.cyberstock.tcdop.server.integration.digitalocean;

import io.cyberstock.tcdop.model.DOSettings;
import io.cyberstock.tcdop.model.error.DOError;
import io.cyberstock.tcdop.server.integration.teamcity.DOCloudImage;
import io.cyberstock.tcdop.server.integration.teamcity.DOCloudInstance;

/**
 * Async Wrapper for DOClientService
 *
 * Created by beolnix on 09/08/15.
 */
public interface DOAsyncClientService {

    /**
     * Restarts Instance in Digital Ocean
     * @param cloudInstance cloud instance to be restarted
     */
    void restartInstance(final DOCloudInstance cloudInstance);

    /**
     * Creates new instance in Digital Ocean, doesn't wait for it's initialization
     * @param cloudImage image used for the instance creatation
     * @param doSettings integration parameters
     * @return newly created instance
     * @throws DOError throws an error in case of any issue
     */
    DOCloudInstance initializeInstance(DOCloudImage cloudImage, DOSettings doSettings) throws DOError;

    /**
     * Terminates Instance in Digital Ocean
     * @param cloudInstance cloud instance to be terminated
     */
    void terminateInstance(final DOCloudInstance cloudInstance);
}


text:
using System.Collections.ObjectModel;
using EspaceClient.FrontOffice.Domaine;
using nRoute.ViewModels;
using OGDC.Silverlight.Toolkit.ViewModels;

namespace EspaceClient.BackOffice.Silverlight.ViewModels.DtoViewModels.Composites
{
    public class GetDroitsByIdCompositeViewModel : ViewModelBase
    {
        private DroitDtoViewModel _droit;
        private ObservableCollection<LienDroitDtoViewModel<ModuleDto>> _droitModuleDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<ActionGeneraleDto>> _droitActionGeneralesDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<ActionSpecifiqueDto>> _droitActionSpecifiquesDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<VueDto>> _droitVuesDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<EditionDto>> _droitEditionsDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<LienExterneDto>> _droitLienExterneDtoViewModel;
        private ObservableCollection<LienDroitDtoViewModel<AlerteDto>> _droitAlerteDtoViewModel;

        public GetDroitsByIdCompositeViewModel()
        {
            _droitModuleDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<ModuleDto>>();
            _droitActionGeneralesDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<ActionGeneraleDto>>();
            _droitActionSpecifiquesDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<ActionSpecifiqueDto>>();
            _droitVuesDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<VueDto>>();
            _droitEditionsDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<EditionDto>>();
            _droitLienExterneDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<LienExterneDto>>();
            _droitAlerteDtoViewModel = new ObservableCollection<LienDroitDtoViewModel<AlerteDto>>();
        }

        [TrackProperty]
        public DroitDtoViewModel Droit
        {
            get
            {
                return _droit;
            }

            set
            {
                if (_droit != value)
                {
                    _droit = value;
                    NotifyPropertyChanged(() => Droit);
                }
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<ModuleDto>> DroitModule
        {
            get { return _droitModuleDtoViewModel; }
            set
            {
                _droitModuleDtoViewModel = value;
                NotifyPropertyChanged(() => DroitModule);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<ActionGeneraleDto>> DroitActionGenerales
        {
            get { return _droitActionGeneralesDtoViewModel; }
            set
            {
                _droitActionGeneralesDtoViewModel = value;
                NotifyPropertyChanged(() => DroitActionGenerales);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<ActionSpecifiqueDto>> DroitActionSpecifiques
        {
            get { return _droitActionSpecifiquesDtoViewModel; }
            set
            {
                _droitActionSpecifiquesDtoViewModel = value;
                NotifyPropertyChanged(() => DroitActionSpecifiques);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<VueDto>> DroitVues
        {
            get { return _droitVuesDtoViewModel; }
            set
            {
                _droitVuesDtoViewModel = value;
                NotifyPropertyChanged(() => DroitVues);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<EditionDto>> DroitEditions
        {
            get { return _droitEditionsDtoViewModel; }
            set
            {
                _droitEditionsDtoViewModel = value;
                NotifyPropertyChanged(() => DroitEditions);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<LienExterneDto>> DroitLienExterne
        {
            get { return _droitLienExterneDtoViewModel; }
            set
            {
                _droitLienExterneDtoViewModel = value;
                NotifyPropertyChanged(() => DroitLienExterne);
            }
        }

        [TrackProperty]
        public ObservableCollection<LienDroitDtoViewModel<AlerteDto>> DroitAlerte
        {
            get { return _droitAlerteDtoViewModel; }
            set
            {
                _droitAlerteDtoViewModel = value;
                NotifyPropertyChanged(() => DroitAlerte);
            }
        }
    }
}


text:
package org.osgi.test.cases.resourcemonitoring.utils;

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

import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.resourcemonitoring.ResourceContextEvent;
import org.osgi.service.resourcemonitoring.ResourceContextListener;

/**
 * A resource context listener implementation for test purpose.
 *
 * @author $Id$
 */
public class ResourceContextListenerTestImpl implements ResourceContextListener {

	/**
	 * service registration ServiceRegistration<ResourceContextListener>
	 */
	private ServiceRegistration<ResourceContextListener>	serviceRegistration;

	/**
	 * list of received events
	 */
	private final List<ResourceContextEvent>	events;

	/**
	 *
	 */
	public ResourceContextListenerTestImpl() {
		events = new ArrayList<>();
	}

	/**
	 * Register this instance as a {@link ResourceContextListener} service. Once registered, this instance will receive
	 * {@link ResourceContextEvent}.
	 *
	 * @param bundleContext
	 */
	public void start(BundleContext bundleContext) {
		serviceRegistration = bundleContext
				.registerService(ResourceContextListener.class, this, null);
	}

	/**
	 * Unregister this instance as a {@link ResourceContextListener} service. Once unregistered, this instance won't receive anymore
	 * {@link ResourceContextEvent}.
	 */
	public void stop() {
		serviceRegistration.unregister();
		events.clear();
	}

	/**
	 * this method is called when a {@link ResourceContextEvent} is sent.
	 */
	public void notify(ResourceContextEvent event) {
		// store received event
		events.add(event);
	}

	/**
	 * Returns the last received event got through {@link #notify(ResourceContextEvent)} method.
	 *
	 * @return last received resource context event.
	 */
	public ResourceContextEvent getLastEvent() {
		int index = events.size() - 1;
		if (index < 0) {
			return null;
		} else {
			return events.get(index);
		}
	}

	/**
	 * Returns the last last event got through {@link #notify(ResourceContextEvent)} method.
	 *
	 * @return last last received event
	 */
	public ResourceContextEvent getLastLastEvent() {
		int index = events.size() - 2;
		if (index < 0) {
			return null;
		} else {
			return events.get(index);
		}
	}

	/**
	 * Retrieves the received events
	 *
	 * @return received events, or an empty list if there is no event.
	 */
	public List<ResourceContextEvent> getReceivedEvents() {
		return events;
	}

}


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<meta name="description" content="Official Website for David Roberts">
	<meta name="author" content="David Roberts">
	<title>David Roberts</title>
	<link type="text/css" rel="stylesheet" href="stylesheets/default.css">

DAVID F. ROBERTS

A professional and personal introduction.

Home

About Me

Projects

Blog

Satisfied in India

This site will serve to introduce myself to you my life and work through 2015. I come from a variety of backgrounds, but have always been excited about what technology can offer everyone. Because of this, I am currently enrolled in an immersive web development training program called DevBootcamp and will be tracking my progress here. For more info about my journey, click on my Blog.

If you wish to get to know where I come from and the type of person I am, please navigate to About Me and if you wish to know the type of work I have done (both professional and non-professional), please head on over to the Projects. There just might be a little entertainment there.

Facebook

LinkedIn

GitHub

Quora

Soundcloud


text:
package net.kamradtfamily.servertrack.spi;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.Random;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author randalkamradt
 */
public class LoadValueTest {
    Random r = new Random(new Date().getTime());

    public LoadValueTest() {
    }

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of creating a bean with specific values and now timestamp
     */
    @Test
    public void testCreateLoadNow() {
        System.out.println("addLoad");
        double cpuLoad = r.nextDouble();
        double ramLoad = r.nextDouble();
        LoadValue instance = new LoadValue(cpuLoad, ramLoad);
        assertEquals(cpuLoad, instance.getCpuLoad(), 0.0);
        assertEquals(ramLoad, instance.getRamLoad(), 0.0);
        assertNotNull(instance.getTimestamp()); // no test is made to ensure now
    }
    /**
     * Test of creating a bean with specific values and specific timestamp
     */
    @Test
    public void testCreateLoadSpecificTime() {
        System.out.println("addLoad");
        double cpuLoad = r.nextDouble();
        double ramLoad = r.nextDouble();
        long timestamp = new Date().getTime(); // just use now
        LoadValue instance = new LoadValue(cpuLoad, ramLoad, timestamp);
        assertEquals(cpuLoad, instance.getCpuLoad(), 0.0);
        assertEquals(ramLoad, instance.getRamLoad(), 0.0);
        assertEquals(timestamp, instance.getTimestamp());
    }

}


text:
class AddOwnerToInventory < ActiveRecord::Migration
  def change
    add_reference :inventories, :owner
  end
end


text:
using namespace mcld;

//===----------------------------------------------------------------------===//
// MemoryAreaFactory
//===----------------------------------------------------------------------===//
MemoryAreaFactory::MemoryAreaFactory(size_t pNum)
  : GCFactory<MemoryArea, 0>(pNum) {
}

MemoryAreaFactory::~MemoryAreaFactory()
{
  HandleToArea::iterator rec, rEnd = m_HandleToArea.end();
  for (rec = m_HandleToArea.begin(); rec != rEnd; ++rec) {
    if (rec->handle->isOpened()) {
      rec->handle->close();
    }
    delete rec->handle;
  }
}

MemoryArea*
MemoryAreaFactory::produce(const sys::fs::Path& pPath,
                           FileHandle::OpenMode pMode)
{
  HandleToArea::Result map_result = m_HandleToArea.findFirst(pPath);
  if (NULL == map_result.area) {
    // can not found
    FileHandle* handler = new FileHandle();
    if (!handler->open(pPath, pMode)) {
      error(diag::err_cannot_open_file) << pPath
                                        << sys::strerror(handler->error());
    }

    MemoryArea* result = allocate();
    new (result) MemoryArea(*handler);

    m_HandleToArea.push_back(handler, result);
    return result;
  }

  return map_result.area;
}

MemoryArea*
MemoryAreaFactory::produce(const sys::fs::Path& pPath,
                           FileHandle::OpenMode pMode,
                           FileHandle::Permission pPerm)
{
  HandleToArea::Result map_result = m_HandleToArea.findFirst(pPath);
  if (NULL == map_result.area) {
    // can not found
    FileHandle* handler = new FileHandle();
    if (!handler->open(pPath, pMode, pPerm)) {
      error(diag::err_cannot_open_file) << pPath
                                        << sys::strerror(handler->error());
    }

    MemoryArea* result = allocate();
    new (result) MemoryArea(*handler);

    m_HandleToArea.push_back(handler, result);
    return result;
  }

  return map_result.area;
}

MemoryArea* MemoryAreaFactory::produce(void* pMemBuffer, size_t pSize)
{
  Space* space = Space::Create(pMemBuffer, pSize);
  MemoryArea* result = allocate();
  new (result) MemoryArea(*space);
  return result;
}

MemoryArea*
MemoryAreaFactory::produce(int pFD, FileHandle::OpenMode pMode)
{
  FileHandle* handler = new FileHandle();
  handler->delegate(pFD, pMode);

  MemoryArea* result = allocate();
  new (result) MemoryArea(*handler);

  return result;
}

void MemoryAreaFactory::destruct(MemoryArea* pArea)
{
  m_HandleToArea.erase(pArea);
  pArea->clear();
  pArea->handler()->close();
  destroy(pArea);
  deallocate(pArea);
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <link href="http://gmpg.org/xfn/11" rel="profile">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>

      What's Jekyll? · ./rennan

  </title>

  <link rel="stylesheet" href="/public/css/build/global.min.css">

  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-precomposed.png">
  <link rel="shortcut icon" href="/public/favicon.ico">

  <link rel="alternate" type="application/atom+xml" title="./rennan" href="/atom.xml">

          ./rennan
          dotfiles

        About

        Archive

        Feed

What's Jekyll?

  <time datetime="2013-12-31T00:00:00-02:00" class="page-date">31 Dec 2013</time>

Jekyll is a static site generator, an open-source tool for creating simple yet powerful websites of all shapes and sizes. From the project's readme:

Jekyll is a simple, blog aware, static site generator. It takes a template directory […] and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind GitHub Pages, which you can use to host your project's page or blog right here from GitHub.

It's an immensely useful tool. Find out more by visiting the project on GitHub.

Related Posts

            [games] Mutant Mudds me mostrou como perfeccionismo pode ser Divertido
            <time datetime="2014-01-21T00:00:00-02:00">21 Jan 2014</time>

            Introducing Poole
            <time datetime="2014-01-02T00:00:00-02:00">02 Jan 2014</time>

            Example content
            <time datetime="2014-01-01T00:00:00-02:00">01 Jan 2014</time>

          © <time datetime="2015-02-02T14:40:10-02:00">2015</time>. All rights reserved.


text:
var constant = require('./constant'),
    defineProperty = require('./_defineProperty'),
    identity = require('./identity');

/**
 * The base implementation of `setToString` without support for hot loop shorting.
 *
 * @private
 * @param {Function} func The function to modify.
 * @param {Function} string The `toString` result.
 * @returns {Function} Returns `func`.
 */
var baseSetToString = !defineProperty ? identity : function (func, string) {
    return defineProperty(func, 'toString', {
        'configurable': true,
        'enumerable': false,
        'value': constant(string),
        'writable': true
    });
};

module.exports = baseSetToString;


text:
<?php
require_once 'settings.php';

class ErrorHandling {
    var $num;
    var $msg;
    var $err;

    var $emails_dev;
    var $emails_customer;

    function __construct(){
//        $settings = Settings::getInstance();
        $this->emails_dev = Settings::$emails_dev;
        $this->emails_customer = Settings::$emails_customer;
    }

    function writeError($err){
        error_log($err);
    }

    function createError($num,$msg){
        $this->err = 'APP ERROR '.$num.' '.$msg;
        echo $this->err;
        throw new Exception($this->err);
    }

    function sendEmail($num,$msg){
        if($num>=100 and $num<300){
            error_log($msg, 1,$this->emails_dev.','.$this->emails_customer);
        } elseif ($num>=300 and $num<500){
            error_log($msg, 1,$this->emails_dev);
        } elseif ($num>500){
            error_log($msg, 1,$this->emails_customer);
        }
    }

    function exitApp(){
        exit();
    }

}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Crassula expansa subsp. peculiaris Toelken

### Remarks
null