text:
class User < ApplicationRecord
  has_paper_trail
  devise :database_authenticatable, :recoverable, :registerable, :timeoutable

  has_many :incident_reports, dependent: :restrict_with_error
  has_many :divisions_users
  has_many :divisions, through: :divisions_users

  validates :first_name, :last_name, :badge_number, :divisions, presence: true
  validates :badge_number, uniqueness: { case_sensitive: false }

  validates :password,
            presence: true, confirmation: true, if: :password_required?
  validates :password,
            length: { in: 6..128 },
            allow_blank: true,
            if: :password_changed_from_default?

  scope :active, -> { where active: true }
  scope :inactive, -> { where.not active: true }
  scope :drivers, -> { where supervisor: false, staff: false }
  scope :supervisors, -> { where supervisor: true }
  scope :staff, -> { where staff: true }
  scope :with_email, -> { where.not email: [nil, ''] }

  scope :name_order, -> { order :last_name, :first_name }
  scope :in_divisions, (lambda do |divisions|
    joins(:divisions_users).where(divisions_users: { division_id: divisions.pluck(:id) })
  end)

  before_validation :set_default_password, if: :new_record?
  before_validation :track_password_changed

  # Only active users should be able to log in.
  def active_for_authentication?
    super && active?
  end

  def deactivate
    update active: false
  end

  def division
    divisions.first
  end

  def driver?
    !(supervisor? || staff?)
  end

  def full_name
    [first_name, last_name].join ' '
  end

  def group
    if staff? then 'Staff'
    elsif supervisor? then 'Supervisors'
    else 'Drivers'
    end
  end

  def inactive_message
    if active? then super
    else :inactive
    end
  end

  def proper_name
    [last_name, first_name].join ', '
  end

  def requires_password_change?
    !(driver? || password_changed_from_default?)
  end

  def set_default_password
    assign_attributes password: last_name,
                      password_confirmation: last_name,
                      password_changed_from_default: false
  end

  def self.import_from_xml(xml)
    statuses = Hash.new(0)
    users_present = []
    xml.css('User').each do |user_data|
      hastus_id = user_data.at_css('hastus_id').text
      attrs = {}
      attrs[:first_name] = user_data.at_css('first_name').text.capitalize
      attrs[:last_name] = user_data.at_css('last_name').text.capitalize
      job_class = user_data.at_css('job_class').text
      attrs[:supervisor] = job_class == 'Supervisor'
      user = User.find_by badge_number: hastus_id
      if user.present?
        user.assign_attributes attrs
        if user.changed?
          if user.valid?
            user.save!
            users_present << user
            statuses[:updated] += 1
          else statuses[:rejected] += 1
          end
        else users_present << user
        end
      else
        # Only assign divisions to new users.
        division_name = user_data.at_css('division').text.upcase
        division = Division.where(name: division_name).first
        attrs[:divisions] = [division] if division.present?
        user = User.new attrs.merge(badge_number: hastus_id)
        if user.save
          users_present << user
          statuses[:imported] += 1
        else statuses[:rejected] += 1
        end
      end
    end
    # Don't deactivate staff automatically, since they're not always
    # in Hastus.
    inactive_users = User.active - User.staff - users_present
    inactive_users.each(&:deactivate)
    statuses[:deactivated] = inactive_users.count
    statuses
  end

  def self.dev_login_options
    order(:last_name).group_by(&:group).transform_values do |users|
      users.map { |user| [user.proper_name, user.id] }
    end
  end

  private

  def password_required?
    # Only if we're trying to change the password
    !password.nil? || !password_confirmation.nil?
  end

  def track_password_changed
    assign_attributes password_changed_from_default: true unless valid_password?(last_name)
  end
end


text:
var _curry2 = require('./internal/_curry2');

/**
 * Calls an input function `n` times, returning an array containing the results of those
 * function calls.
 *
 * `fn` is passed one argument: The current value of `n`, which begins at `0` and is
 * gradually incremented to `n - 1`.
 *
 * @func
 * @memberOf R
 * @category List
 * @sig (i -> a) -> i -> [a]
 * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
 * @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
 * @return {Array} An array containing the return values of all calls to `fn`.
 * @example
 *
 *      R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
 */
module.exports = _curry2(function times(fn, n) {
    var len = Number(n);
    var list = new Array(len);
    var idx = 0;
    while (idx < len) {
        list[idx] = fn(idx);
        idx += 1;
    }
    return list;
});

redpajama_set_name: RedPajamaGithub


text:
// expose test function names
function exposeTestFunctionNames()
{
return ['Conformance_Expressions'];
}

var docsLoaded = -1000000;
var builder = null;

//
//   This function is called by the testing framework before
//      running the test suite.
//
//   If there are no configuration exceptions, asynchronous
//        document loading is started.  Otherwise, the status
//        is set to complete and the exception is immediately
//        raised when entering the body of the test.
//
function setUpPage() {
   setUpPageStatus = 'running';
   try {
     //
     //   creates test document builder, may throw exception
     //
     builder = createConfiguredBuilder();

      docsLoaded = 0;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      docsLoaded += preload(docRef, "doc", "staffNS");

       if (docsLoaded == 1) {
          setUpPageStatus = 'complete';
       }
    } catch(ex) {
        catchInitializationError(builder, ex);
        setUpPageStatus = 'complete';
    }
}

//
//   This method is called on the completion of
//      each asychronous load started in setUpTests.
//
//   When every synchronous loaded document has completed,
//      the page status is changed which allows the
//      body of the test to be executed.
function loadComplete() {
    if (++docsLoaded == 1) {
        setUpPageStatus = 'complete';
    }
}

/**
*
      1.3 Conformance - Iterate over a list of strings containing
      valid XPath expressions, calling XPathEvaluator.createExpression
      for each. If no expections are thrown and each result is non-null,
      then the test passes.

* @author Bob Clary
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#Conformance
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-createNSResolver
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-createExpression
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathNSResolver
*/
function Conformance_Expressions() {
   var success;
    if(checkInitialization(builder, "Conformance_Expressions") != null) return;
    var doc;
      var resolver;
      var evaluator;
      var expression;
      var expressionList = new Array();

      var xpathexpression;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "staffNS");
      evaluator = createXPathEvaluator(doc);
resolver = evaluator.createNSResolver(doc);
      expressionList[expressionList.length] = "/";
expressionList[expressionList.length] = "child::comment()";
expressionList[expressionList.length] = "child::text()";
expressionList[expressionList.length] = "child::processing-instruction()";
expressionList[expressionList.length] = "child::processing-instruction('name')";
expressionList[expressionList.length] = "child::node()";
expressionList[expressionList.length] = "child::*";
expressionList[expressionList.length] = "child::nist:*";
expressionList[expressionList.length] = "child::employee";
expressionList[expressionList.length] = "descendant::comment()";
expressionList[expressionList.length] = "descendant::text()";
expressionList[expressionList.length] = "descendant::processing-instruction()";
expressionList[expressionList.length] = "descendant::processing-instruction('name')";
expressionList[expressionList.length] = "descendant::node()";
expressionList[expressionList.length] = "descendant::*";
expressionList[expressionList.length] = "descendant::nist:*";
expressionList[expressionList.length] = "descendant::employee";
expressionList[expressionList.length] = "parent::comment()";
expressionList[expressionList.length] = "parent::text()";
expressionList[expressionList.length] = "parent::processing-instruction()";
expressionList[expressionList.length] = "parent::processing-instruction('name')";
expressionList[expressionList.length] = "parent::node()";
expressionList[expressionList.length] = "parent::*";
expressionList[expressionList.length] = "parent::nist:*";
expressionList[expressionList.length] = "parent::employee";
expressionList[expressionList.length] = "ancestor::comment()";
expressionList[expressionList.length] = "ancestor::text()";
expressionList[expressionList.length] = "ancestor::processing-instruction()";
expressionList[expressionList.length] = "ancestor::processing-instruction('name')";
expressionList[expressionList.length] = "ancestor::node()";
expressionList[expressionList.length] = "ancestor::*";
expressionList[expressionList.length] = "ancestor::nist:*";
expressionList[expressionList.length] = "ancestor::employee";
expressionList[expressionList.length] = "following-sibling::comment()";
expressionList[expressionList.length] = "following-sibling::text()";
expressionList[expressionList.length] = "following-sibling::processing-instruction()";
expressionList[expressionList.length] = "following-sibling::processing-instruction('name')";
expressionList[expressionList.length] = "following-sibling::node()";
expressionList[expressionList.length] = "following-sibling::*";
expressionList[expressionList.length] = "following-sibling::nist:*";
expressionList[expressionList.length] = "following-sibling::employee";
expressionList[expressionList.length] = "preceding-sibling::comment()";
expressionList[expressionList.length] = "preceding-sibling::text()";
expressionList[expressionList.length] = "preceding-sibling::processing-instruction()";
expressionList[expressionList.length] = "preceding-sibling::processing-instruction('name')";
expressionList[expressionList.length] = "preceding-sibling::node()";
expressionList[expressionList.length] = "preceding-sibling::*";
expressionList[expressionList.length] = "preceding-sibling::nist:*";
expressionList[expressionList.length] = "preceding-sibling::employee";
expressionList[expressionList.length] = "following::comment()";
expressionList[expressionList.length] = "following::text()";
expressionList[expressionList.length] = "following::processing-instruction()";
expressionList[expressionList.length] = "following::processing-instruction('name')";
expressionList[expressionList.length] = "following::node()";
expressionList[expressionList.length] = "following::*";
expressionList[expressionList.length] = "following::nist:*";
expressionList[expressionList.length] = "following::employee";
expressionList[expressionList.length] = "preceding::comment()";
expressionList[expressionList.length] = "preceding::text()";
expressionList[expressionList.length] = "preceding::processing-instruction()";
expressionList[expressionList.length] = "preceding::processing-instruction('name')";
expressionList[expressionList.length] = "preceding::node()";
expressionList[expressionList.length] = "preceding::*";
expressionList[expressionList.length] = "preceding::nist:*";
expressionList[expressionList.length] = "preceding::employee";
expressionList[expressionList.length] = "attribute::comment()";
expressionList[expressionList.length] = "attribute::text()";
expressionList[expressionList.length] = "attribute::processing-instruction()";
expressionList[expressionList.length] = "attribute::processing-instruction('name')";
expressionList[expressionList.length] = "attribute::node()";
expressionList[expressionList.length] = "attribute::*";
expressionList[expressionList.length] = "attribute::nist:*";
expressionList[expressionList.length] = "attribute::employee";
expressionList[expressionList.length] = "namespace::comment()";
expressionList[expressionList.length] = "namespace::text()";
expressionList[expressionList.length] = "namespace::processing-instruction()";
expressionList[expressionList.length] = "namespace::processing-instruction('name')";
expressionList[expressionList.length] = "namespace::node()";
expressionList[expressionList.length] = "namespace::*";
expressionList[expressionList.length] = "namespace::nist:*";
expressionList[expressionList.length] = "namespace::employee";
expressionList[expressionList.length] = "self::comment()";
expressionList[expressionList.length] = "self::text()";
expressionList[expressionList.length] = "self::processing-instruction()";
expressionList[expressionList.length] = "self::processing-instruction('name')";
expressionList[expressionList.length] = "self::node()";
expressionList[expressionList.length] = "self::*";
expressionList[expressionList.length] = "self::nist:*";
expressionList[expressionList.length] = "self::employee";
expressionList[expressionList.length] = "descendant-or-self::comment()";
expressionList[expressionList.length] = "descendant-or-self::text()";
expressionList[expressionList.length] = "descendant-or-self::processing-instruction()";
expressionList[expressionList.length] = "descendant-or-self::processing-instruction('name')";
expressionList[expressionList.length] = "descendant-or-self::node()";
expressionList[expressionList.length] = "descendant-or-self::*";
expressionList[expressionList.length] = "descendant-or-self::nist:*";
expressionList[expressionList.length] = "descendant-or-self::employee";
expressionList[expressionList.length] = "ancestor-or-self::comment()";
expressionList[expressionList.length] = "ancestor-or-self::text()";
expressionList[expressionList.length] = "ancestor-or-self::processing-instruction()";
expressionList[expressionList.length] = "ancestor-or-self::processing-instruction('name')";
expressionList[expressionList.length] = "ancestor-or-self::node()";
expressionList[expressionList.length] = "ancestor-or-self::*";
expressionList[expressionList.length] = "ancestor-or-self::nist:*";
expressionList[expressionList.length] = "ancestor-or-self::employee";
expressionList[expressionList.length] = "comment()";
expressionList[expressionList.length] = "text()";
expressionList[expressionList.length] = "processing-instruction()";
expressionList[expressionList.length] = "processing-instruction('name')";
expressionList[expressionList.length] = "node()";
expressionList[expressionList.length] = "*";
expressionList[expressionList.length] = "nist:*";
expressionList[expressionList.length] = "employee";
expressionList[expressionList.length] = ".//comment()";
expressionList[expressionList.length] = ".//text()";
expressionList[expressionList.length] = ".//processing-instruction()";
expressionList[expressionList.length] = ".//processing-instruction('name')";
expressionList[expressionList.length] = ".//node()";
expressionList[expressionList.length] = ".//*";
expressionList[expressionList.length] = ".//nist:*";
expressionList[expressionList.length] = ".//employee";
expressionList[expressionList.length] = "../comment()";
expressionList[expressionList.length] = "../text()";
expressionList[expressionList.length] = "../processing-instruction()";
expressionList[expressionList.length] = "../processing-instruction('name')";
expressionList[expressionList.length] = "../node()";
expressionList[expressionList.length] = "../*";
expressionList[expressionList.length] = "../nist:*";
expressionList[expressionList.length] = "../employee";
expressionList[expressionList.length] = "@attributename";
expressionList[expressionList.length] = "./comment()";
expressionList[expressionList.length] = "./text()";
expressionList[expressionList.length] = "./processing-instruction()";
expressionList[expressionList.length] = "./processing-instruction('name')";
expressionList[expressionList.length] = "./node()";
expressionList[expressionList.length] = "./*";
expressionList[expressionList.length] = "./nist:*";
expressionList[expressionList.length] = "./employee";
expressionList[expressionList.length] = "comment() | text() | processing-instruction() | node()";
expressionList[expressionList.length] = "employee[address]";
expressionList[expressionList.length] = "employee/address[@street]";
expressionList[expressionList.length] = "employee[position='Computer Specialist']";
expressionList[expressionList.length] = "employee[position!='Computer Specialist']";
expressionList[expressionList.length] = "employee[gender='Male' or gender='Female']";
expressionList[expressionList.length] = "employee[gender!='Male' and gender!='Female']";
expressionList[expressionList.length] = "employee/address[@street='Yes']";
expressionList[expressionList.length] = "employee/address[@street!='Yes']";
expressionList[expressionList.length] = "employee[position()=1]";
expressionList[expressionList.length] = "employee[1]";
expressionList[expressionList.length] = "employee[position()=last()]";
expressionList[expressionList.length] = "employee[last()]";
expressionList[expressionList.length] = "employee[position()>1 and position<last()]";
expressionList[expressionList.length] = "employee[position()>=1 and position<=last()]";
expressionList[expressionList.length] = "employee[count(.)>0]";
expressionList[expressionList.length] = "employee[position() mod 2=0]";
expressionList[expressionList.length] = "employee[position() mod -2=0]";
expressionList[expressionList.length] = "employee[position() div 2=0]";
expressionList[expressionList.length] = "employee[position() div -2=-1]";
expressionList[expressionList.length] = "employee[position() div 2 * 2=position()]";
expressionList[expressionList.length] = "employee[3 > 2 > 1]";
expressionList[expressionList.length] = "id('CANADA')";
expressionList[expressionList.length] = "*[local-name()='employee']";
expressionList[expressionList.length] = "*[local-name(.)='employee']";
expressionList[expressionList.length] = "*[local-name(employee)='employee']";
expressionList[expressionList.length] = "*[local-name()='employee']";
expressionList[expressionList.length] = "*[namespace-uri()='http://www.nist.gov']";
expressionList[expressionList.length] = "*[name()='nist:employee']";
expressionList[expressionList.length] = "*[string()]";
expressionList[expressionList.length] = "*[string(10 div foo)='NaN']";
expressionList[expressionList.length] = "*[concat('a', 'b', 'c')]";
expressionList[expressionList.length] = "*[starts-with('employee', 'emp')]";
expressionList[expressionList.length] = "*[contains('employee', 'emp')]";
expressionList[expressionList.length] = "*[substring-before('employeeId', 'Id')]";
expressionList[expressionList.length] = "*[substring-after('employeeId', 'employee')]";
expressionList[expressionList.length] = "*[substring('employeeId', 4)]";
expressionList[expressionList.length] = "*[substring('employeeId', 4, 5)]";
expressionList[expressionList.length] = "*[string-length()=2]";
expressionList[expressionList.length] = "*[string-length(.)=string-length(normalize-space(.))]";
expressionList[expressionList.length] = "*[translate('bar', 'abc', 'ABC')='BAr']";
expressionList[expressionList.length] = "*[boolean(.)]";
expressionList[expressionList.length] = "*[not(boolean(.))]";
expressionList[expressionList.length] = "*[true()]";
expressionList[expressionList.length] = "*[false()]";
expressionList[expressionList.length] = "*[lang('en')]";
expressionList[expressionList.length] = "*[number()]";
expressionList[expressionList.length] = "*[number('4')]";
expressionList[expressionList.length] = "*[floor(.)]>0";
expressionList[expressionList.length] = "*[ceiling(.)]<1";
expressionList[expressionList.length] = "*[round(number(.))=0]<1";
for(var indexN66388 = 0;indexN66388 < expressionList.length; indexN66388++) {
      expression = expressionList[indexN66388];
      xpathexpression = evaluator.createExpression(expression,resolver);

    }

}

function runTest() {
   Conformance_Expressions();
}


text:
package common

import (
	"math/rand"
	"time"
)

var (
	randRunes = []rune("abcdefghijklmnopqrstABCDEFGHIJKLMNOP0123456789")
)

// Upload object
type Upload struct {
	ID          string           `json:"id" bson:"id"`
	Creation    int64            `json:"uploadDate" bson:"uploadDate"`
	Comments    string           `json:"comments" bson:"comments"`
	Files       map[string]*File `json:"files" bson:"files"`
	RemoteIP    string           `json:"uploadIp,omitempty" bson:"uploadIp"`
	ShortURL    string           `json:"shortUrl" bson:"shortUrl"`
	UploadToken string           `json:"uploadToken,omitempty" bson:"uploadToken"`
	TTL         int              `json:"ttl" bson:"ttl"`

	OneShot   bool `json:"oneShot" bson:"oneShot"`
	Removable bool `json:"removable" bson:"removable"`

	ProtectedByPassword bool   `json:"protectedByPassword" bson:"protectedByPassword"`
	Login               string `json:"login,omitempty" bson:"login"`
	Password            string `json:"password,omitempty" bson:"password"`

	ProtectedByYubikey bool   `json:"protectedByYubikey" bson:"protectedByYubikey"`
	Yubikey            string `json:"yubikey,omitempty" bson:"yubikey"`
}

// NewUpload instantiate a new upload object
func NewUpload() (upload *Upload) {
	upload = new(Upload)
	upload.Files = make(map[string]*File)
	return
}

// Create fills token, id, date
// We have split in two functions because, the unmarshalling made
// in http handlers would erase the fields
func (upload *Upload) Create() {
	upload.ID = GenerateRandomID(16)
	upload.Creation = time.Now().Unix()
	upload.Files = make(map[string]*File)
	upload.UploadToken = GenerateRandomID(32)
}

// Sanitize removes sensible information from
// object. Used to hide information in API.
func (upload *Upload) Sanitize() {
	upload.RemoteIP = ""
	upload.Password = ""
	upload.Yubikey = ""
	upload.UploadToken = ""
	for _, file := range upload.Files {
		file.Sanitize()
	}
}

// GenerateRandomID generates a random string with specified length.
// Used to generate upload id, tokens, ...
func GenerateRandomID(length int) string {
	b := make([]rune, length)
	for i := range b {
		b[i] = randRunes[rand.Intn(len(randRunes))]
	}

	return string(b)
}


text:
#ifndef __TestMockSupportc_CFile__h
#define __TestMockSupportc_CFile__h

extern void all_mock_support_c_calls();

#endif


text:
    <button type="button" class="navigation__toggle" ng-click="vm.sidebarCollapsed = !vm.sidebarCollapsed">
      Toggle navigation

    </button>

      <form class="navigation__form" ng-submit="vm.navSearch.onSubmit()">

          <input type="text" class="form-control search-input" placeholder="{{ vm.navSearch.placeholder }}"
                 ng-model="vm.navSearch.value">

            <button class="btn btn-default" type="submit">

            </button>

      </form>

          <form class="sidebar__form" ng-submit="vm.sidebarSearch.onSubmit()">

              <input type="text" class="form-control search-input" placeholder="{{ ::vm.sidebarSearch.placeholder }}"
                     ng-model="vm.sidebarSearch.value">

                <button class="btn btn-default" type="submit">

                </button>

          </form>

          <sidebar-item item="::item"></sidebar-item>


text:
require "fog/core/model"

module Fog
  module Compute
    class Brkt
      class Zone < Fog::Model
        # @!group Attributes
        identity :id

        attribute :cidr_block
        attribute :name
        attribute :provider_zone
        attribute :network,           :aliases => [:network_id, "network_id"]
        attribute :use_main_route_table, :type => :boolean
        # @!endgroup

        # Create zone.
        # Required attributes for create: {#name}, {#network}, {#cidr_block}
        #
        # @return [true]
        def save
          requires :network, :name, :cidr_block

          data = service.create_zone(associations[:network], cidr_block, name).body
          merge_attributes(data)
          true
        end

        # Delete zone
        #
        # @return [true]
        def destroy
          requires :id

          service.delete_zone(id)
          true
        end

        alias_method :use_main_route_table?, :use_main_route_table
      end
    end
  end
end


text:
comments on the paper
comments on the encoding

### META:
# This tutorial is divided into sections, with one section per paper.
# In each section, the ideas of the paper regarding the search space are discussed
# and we discuss its implementation in DeepArchitect using the language to write
# search spaces.
# Finally, we discuss a summary about general guidelines to express search
# spaces in DeepArchitect.

# In this tutorial, we will show how to use DeepArchitect to implement
# search spaces from the literature.
# We will take the textual description of a paper in the architecture search
# literature and we will show how can we write it in DeepArchitect.
# This exercise serves to show to the reader the process by which one would go
# about writing existing search spaces from the literature in DeepArchitect.
# We will follow the description of the search space as it is done in the paper.
# We make no effort to implement idiosyncracies in the actual implementation.

# It should also give a sense to the reader of how the search space constructs
# can be used to express non-trivial search spaces.

# We believe that most of the search spaces that we have seen in the framework
# can be expressed straightforwardly in DeepArchitect.

# ### Zoph and Le 2017

# Let us take one of the first architecture search papers: Zoph and Le, 2017.
# In section 4.1, they describe their search space:

### TODO: add some copy from the paper.
# In our framework, if one layer has many input layers then all input layers are
# concatenated in the depth dimension. Skip connections can cause "compilation
# failures" where one layer is not compatible with another layer, or one layer
# may not have any input or output. To circumvent these issues, we employ three
# simple techniques. First, if a layer is not connected to any input layer then
# the image is used as the input layer. Second, at the final layer we take all
# layer outputs that have not been connected and concatenate them before sending
# this final hiddenstate to the classifier. Lastly, if input layers to be
# concatenated have different sizes, we pad the small layers with zeros so that the
# concatenated layers have the same sizes.

# 4.1 LEARNING CONVOLUTIONAL ARCHITECTURES FOR CIFAR-10

# Search space: Our search space consists of convolutional architectures, with
# rectified linear units as non-linearities (Nair & Hinton, 2010),
# batch normalization (Ioffe & Szegedy, 2015) and skip connections between layers
# (Section 3.3). For every convolutional layer, the controller RNN has to select
# a filter height in [1, 3, 5, 7], a filter width in [1, 3, 5, 7], and a number of
# filters in [24, 36, 48,64]. For strides, we perform two sets of experiments,
# one where we fix the strides to be 1, and one where we allow the controller to
# predict the strides in [1, 2, 3].

# NOTE: this is an important part of teh model. I think that it is most important
# to consider it.

# Dataset: In these experiments we use the CIFAR-10 dataset with data preprocessing and augmentation
# procedures that are in line with other previous results. We first preprocess the data by
# whitening all the images. Additionally, we upsample each image then choose a random 32x32 crop
# of this upsampled image. Finally, we use random horizontal flips on this 32x32 cropped image.

### Negrinho and Gordon, 2017

# TODO: short description of what DeepArchitect is about.
# This was the original paper for DeepArchitect having

#### TODO: do the example for DeepArchitect

# Let us take one of the examples from original DeepArchitect paper
# https://arxiv.org/abs/1704.08792.
# The main ideas from writing a DSL to express search spaces came from this paper.
# The ideas were considerably extended for this current implementation
# (e.g., multi-input multi-output modules, hyperparameter sharing, general
# framework support, ...).
# The original DeepArchitect paper presented the following search space

# def Module_fn(filter_ns, filter_ls, keep_ps, repeat_ns):
#     b = RepeatTied(
#     Concat([
#         Conv2D(filter_ns, filter_ls, [1], ["SAME"]),
#         MaybeSwap_fn( ReLU(), BatchNormalization() ),
#         Optional_fn( Dropout(keep_ps) )
#     ]), repeat_ns)
#     return b

# filter_nums = range(48, 129, 16)
# repeat_nums = [2 ** i for i in xrange(6)]
# mult_fn = lambda ls, alpha: list(alpha * np.array(ls))
# M = Concat([MH,
#         Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"]),
#         Module_fn(filter_nums, [3, 5], [0.5, 0.9], repeat_nums),
#         Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"]),
#         Module_fn(mult_fn(filter_nums, 2), [3, 5], [0.5, 0.9], repeat_nums),
#         Affine([num_classes], aff_initers) ])

# ### NOTE: I could develop this one.

# ### NOTE: now talk about a different search space.

# Neural Architecture Search with Reinforcement Learning (Zoph and Le. 2016)
# https://arxiv.org/abs/1611.01578

####

The description of the search space employed is spread out across the paper.
The main idea of the paper is to write architectures as hierarchical compositions
of motifs.

Architectures in this case are just motifs at a higher level of composition.
In the description of the paper, a motif is generated by connecting lower level
using an acyclical directed graph.
All motifs have a single input and a single output.
If multiple edges come into a node, the inputs are merged into a single
input and then passed as input to the motif.
Each of the lower motifs is placed in one of the nodes of the graph and the

Given some number of higher level motifs, these can be constructed

There are the high-level ideas for the paper.

NOTE: the motif is generated by putting the elements in topological order and
picking which ones should be there.

To paraphrase and summarize what they describe in the paper, they start with a
set of six operations (which they call primitives).

This is used to search for a cell that is then used in an architecture for
evaluation. Be

# We consider the following six primitives at the bottom level of the hierarchy (` = 1, M` = 6):
# • 1 × 1 convolution of C channels
# • 3 × 3 depthwise convolution
# • 3 × 3 separable convolution of C channels
# • 3 × 3 max-pooling
# • 3 × 3 average-pooling
# • identity

### TODO: what is going to be the plan for the other parts of the model.
# I think that this is going to be useful.

# NOTE: multiplying the initial number of filters.
# how to extract a search space from it. that seems kind of tricky?

For the hierarchical representation, we use three levels (L = 3),
with M1 = 6, M2 = 6, M3 = 1. Each of the level-2 motifs is a graph with
# |G(2)| = 4 nodes, and the level-3 motif is a graph with |G(3)| = 5 nodes.
# Each level-2 motif is followed by a 1×1 convolution
# with the same number of channels as on the motif input to reduce the number
# of parameters. For the flat representation, we used a graph with 11 nodes to
# achieve a comparable number of edges.

# NOTE: the sampling of the motifs is going to be important.
# I think that this is important.

The two main ideas are the

# Number of lower level motifs. (number of acyclical graphs between these models)

# L = 3;

# This is the hierarchical composition.

It is arguably more complicated to understand the textual description of the
search space in the paper than to express it in DeepArchitect.
This is a strong indicator of value of DeepArchitect for greatly improving the
reproducibility and reusability of architecture search research.

# NOTE: it would

# NOTE: most of these models where used.

# TODO: show some information in the model.

# TODO: show three architectures sampled from the search space.
# I think that this is going to be interesting.

#### Genetic CNN,

As in other cases that we have looked at, the paper proposes an ad-hoc encoding
for the search space that can be represented in the language for representing
search spaces of DeepArchitect.
The main aspect that is searched over in this search space is the connectivity
pattern.

We follow the description of the search space that can be found (here)[https://arxiv.org/pdf/1703.01513.pdf].
The description of the search space can be found on Section 3.1 and Section 3.1.1.
The first part contains an explanation of the encoding, while the second part
contains a discussion of the handling of some special cases.

Briefly, networks from the search space described are composed S stages.
Each stage takes the input from the previous (the input to the first stage is
the input to the network), applies a convolution, then the stage computation,
which is essentially a DAG of convolutions ending in a single convolutional node,
which is followed by a last convolution. There is a pooling layer between stages.
For each stage of the search space, we have to choose the number of nodes in the
DAG, e.g., in the search space represented in Figure~1, the first stage has
four nodes and the second stage has five nodes.
Each time we do a spatial reduction with a pooling layer, the number of filters is
increased, e.g., if we use a pooling layer with stride 2, the number of filters is
multiplied by two.
Neither the spatial dimension or the number of filters changes within a stage.
Each convolution is followed by ReLU nonlinearities and batch normalization.

The connection pattern of the DAG nodes is encoded by a binary string with
K_s(K _s - 1) / 2, where K_s is the number of nodes in the DAG in stage s.
The bit string is composed by K _s - 1 sections, where section i \in [K _s - 1],
encodes the connections of node i to the earlier nodes.

Section 3.1.1 describes a few edge cases. If a node does not get its input
from any of the earlier nodes in the stage, it gets its input from the initial
node of the stage. If a node in a stage is not used, then it is excluded from
the network.
We see that most of the complexity of the search space lies in the stage part.
For simplicity, we will focus on how to represent this part of the search
space and use the

# NOTE: multiple inputs to the same node are summed.

This description is better understood by reading directly the sections mentioned
along with Figure~1,
or looking at the encoding of the search space in DeepArchitect.

# define DeepArchitect

# TODO: I think that a good idea is to check that I can use this search space
# encoding in a separate file and see that it runs and that I can sample.

# TODO: copy 3.1; binary representation section.

# TODO: copy the 3.1.1 technical details section from the paper.

From reading this section, our understanding is that all stages have the
same number of nodes

# NOTE: what does it that the connections between the ordinary nodes and the
# the default nodes are not encoded.

Some of the advantages of the encoding of this search space in DeepArchitect
when compared to the ad-hoc one are that it is easy to change the search space
within using DeepArchitect, e.g., it is trivial to extend the search space to
also search over depth of the network or to search over the number of computational
nodes on each stage (tying them or not).
Arguably, doing all these extensions in an ad-hoc encoding is not straightforward
as we have to think about custom ways of encoding these options.
Within DeepArchitect, these transformations can be expressed in a straightforward
way with basic and substitution modules.

# FOR example, we see that trivial extensions of the search space by working with
# the model.

# TODO: perhaps show that this is indeed the case.

# Summary

This tutorial has two main purposes.
First, we aim to show that many (arguably, most) of the search spaces in the
literature can be represented straightforwardly using constructs from our
language, where understanding the definition of the search space is often more
difficult than actually writing down the search space in DeepArchitect.
Second, we argue that writing ad-hoc representations is a terribly innefficient
way of doing architecture search research.
Some of the main problems with ad-hoc encodings for search spaces is that they
are hard to reuse.
We recommend researchers to use DeepArchitect as a starting point for
research on architecture search to make the search spaces and the search
algorithms readily available for reuse and extension.

We made a serious effort to mimic represent the search spaces in DeepArchitect
in a way that is analog to the way that was used in the paper.
This means that we may need we may need to opt for a representation that is
more complex to

# TODO: distinguish place where we are talking and places where someone else is
# talking.

# TODO: another aspect that I want to show off is how to take the existing
# parts of the model, and put them together.
# I think that this is the right way of go

# and many more. If you would like me to write a search space that is not
# covered in this model, just let me know and I will consider adding it.

#

# In this tutorial we showed that it is possible to use the language constructs
# that we defined in DeepArchitect to implement the search spaces over architectures.
# In many cases, the textual description of the search space in the paper is
# more complex than the description in DeepArchitect, show casing the capabilities
# of our framework.

# The papers were chosen part based on chronology and part based on the number
# of citations that they

# TODO: searching for activation functions.

# We believe that DeepArchitect will make research in architecture search
# dramatically easier, allowing researchers to more easily build on previous
# work.

# We are confident that the primitives that were introduced are sufficient to
# represent a very large number of search spaces.

# TODO: check with max what does he have for the concatenation of search
# spaces.

# what do they talk about depth wise and separable convolution.

# in merging stuff, I think that it is a good idea to have them run.
# TODO: what is a depth

# they end up having three levels.
# NOTE: it should be easier to maintain if they are in multiple files.
# it should generate a high level tutorial file, but I don't know exactly
# what should be the structure for it.

# let us get started from scratch.
# we will use

# NOTE: this is just the search space for the cell, if we wish
# to write something

# try it for a stage, and try it for multiple stages.

# NOTE: some general comments about the motifs.


text:
layout: post
date: 2017-10-20
title: "Mikaella Bridal 1851 Sleeveless Chapel Train Aline/Princess"
category: Mikaella
tags: [Mikaella ,Mikaella,Aline/Princess ,Queen Anne,Chapel Train,Sleeveless]
---
### Mikaella Bridal 1851
Just **$339.99**
###   Sleeveless Chapel Train Aline/Princess

BRANDS	Mikaella

Silhouette	Aline/Princess

Neckline	Queen Anne

Hemline/Train	Chapel Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/mikaella-/46389-mikaella-bridal-1851.html](https://www.readybrides.com/en/mikaella-/46389-mikaella-bridal-1851.html)


text:
export class Tab {
    name:string
    key:string
    active:boolean
    href:string
    constructor(options:{
        name?:string,
        key?:string,
        active?:boolean,
        href?:string
    } = {}){
        this.name = options.name
        this.key = options.key
        this.active = options.active
        this.href = options.href
    }
}


text:
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/sunrpc/clnt.h>
#include <linux/nfs.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_mount.h>
#include <linux/in.h>
#include <linux/major.h>
#include <linux/utsname.h>
#include <linux/inet.h>
#include <linux/root_dev.h>
#include <net/ipconfig.h>
#include <linux/parser.h>

/* Define this to allow debugging output */
#undef NFSROOT_DEBUG
#define NFSDBG_FACILITY NFSDBG_ROOT

/* Default path we try to mount. "%s" gets replaced by our IP address */
#define NFS_ROOT		"/tftpboot/%s"

/* Parameters passed from the kernel command line */
static char nfs_root_name[256] __initdata = "";

/* Address of NFS server */
static __be32 servaddr __initdata = 0;

/* Name of directory to mount */
static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, };

/* NFS-related data */
static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */
static int nfs_port __initdata = 0;		/* Port to connect to for NFS */
static int mount_port __initdata = 0;		/* Mount daemon port number */

/***************************************************************************

			     Parsing of options

 ***************************************************************************/

enum {
	/* Options that take integer arguments */
	Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
	Opt_acregmax, Opt_acdirmin, Opt_acdirmax,
	/* Options that take no arguments */
	Opt_soft, Opt_hard, Opt_intr,
	Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac,
	Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp,
	Opt_acl, Opt_noacl,
	/* Error token */
	Opt_err
};

static match_table_t __initdata tokens = {
	{Opt_port, "port=%u"},
	{Opt_rsize, "rsize=%u"},
	{Opt_wsize, "wsize=%u"},
	{Opt_timeo, "timeo=%u"},
	{Opt_retrans, "retrans=%u"},
	{Opt_acregmin, "acregmin=%u"},
	{Opt_acregmax, "acregmax=%u"},
	{Opt_acdirmin, "acdirmin=%u"},
	{Opt_acdirmax, "acdirmax=%u"},
	{Opt_soft, "soft"},
	{Opt_hard, "hard"},
	{Opt_intr, "intr"},
	{Opt_nointr, "nointr"},
	{Opt_posix, "posix"},
	{Opt_noposix, "noposix"},
	{Opt_cto, "cto"},
	{Opt_nocto, "nocto"},
	{Opt_ac, "ac"},
	{Opt_noac, "noac"},
	{Opt_lock, "lock"},
	{Opt_nolock, "nolock"},
	{Opt_v2, "nfsvers=2"},
	{Opt_v2, "v2"},
	{Opt_v3, "nfsvers=3"},
	{Opt_v3, "v3"},
	{Opt_udp, "proto=udp"},
	{Opt_udp, "udp"},
	{Opt_tcp, "proto=tcp"},
	{Opt_tcp, "tcp"},
	{Opt_acl, "acl"},
	{Opt_noacl, "noacl"},
	{Opt_err, NULL}

};

/*
 *  Parse option string.
 */

static int __init root_nfs_parse(char *name, char *buf)
{

	char *p;
	substring_t args[MAX_OPT_ARGS];
	int option;

	if (!name)
		return 1;

	/* Set the NFS remote path */
	p = strsep(&name, ",");
	if (p[0] != '\0' && strcmp(p, "default") != 0)
		strlcpy(buf, p, NFS_MAXPATHLEN);

	while ((p = strsep (&name, ",")) != NULL) {
		int token;
		if (!*p)
			continue;
		token = match_token(p, tokens, args);

		/* %u tokens only. Beware if you add new tokens! */
		if (token < Opt_soft && match_int(&args[0], &option))
			return 0;
		switch (token) {
			case Opt_port:
				nfs_port = option;
				break;
			case Opt_rsize:
				nfs_data.rsize = option;
				break;
			case Opt_wsize:
				nfs_data.wsize = option;
				break;
			case Opt_timeo:
				nfs_data.timeo = option;
				break;
			case Opt_retrans:
				nfs_data.retrans = option;
				break;
			case Opt_acregmin:
				nfs_data.acregmin = option;
				break;
			case Opt_acregmax:
				nfs_data.acregmax = option;
				break;
			case Opt_acdirmin:
				nfs_data.acdirmin = option;
				break;
			case Opt_acdirmax:
				nfs_data.acdirmax = option;
				break;
			case Opt_soft:
				nfs_data.flags |= NFS_MOUNT_SOFT;
				break;
			case Opt_hard:
				nfs_data.flags &= ~NFS_MOUNT_SOFT;
				break;
			case Opt_intr:
				nfs_data.flags |= NFS_MOUNT_INTR;
				break;
			case Opt_nointr:
				nfs_data.flags &= ~NFS_MOUNT_INTR;
				break;
			case Opt_posix:
				nfs_data.flags |= NFS_MOUNT_POSIX;
				break;
			case Opt_noposix:
				nfs_data.flags &= ~NFS_MOUNT_POSIX;
				break;
			case Opt_cto:
				nfs_data.flags &= ~NFS_MOUNT_NOCTO;
				break;
			case Opt_nocto:
				nfs_data.flags |= NFS_MOUNT_NOCTO;
				break;
			case Opt_ac:
				nfs_data.flags &= ~NFS_MOUNT_NOAC;
				break;
			case Opt_noac:
				nfs_data.flags |= NFS_MOUNT_NOAC;
				break;
			case Opt_lock:
				nfs_data.flags &= ~NFS_MOUNT_NONLM;
				break;
			case Opt_nolock:
				nfs_data.flags |= NFS_MOUNT_NONLM;
				break;
			case Opt_v2:
				nfs_data.flags &= ~NFS_MOUNT_VER3;
				break;
			case Opt_v3:
				nfs_data.flags |= NFS_MOUNT_VER3;
				break;
			case Opt_udp:
				nfs_data.flags &= ~NFS_MOUNT_TCP;
				break;
			case Opt_tcp:
				nfs_data.flags |= NFS_MOUNT_TCP;
				break;
			case Opt_acl:
				nfs_data.flags &= ~NFS_MOUNT_NOACL;
				break;
			case Opt_noacl:
				nfs_data.flags |= NFS_MOUNT_NOACL;
				break;
			default:
				printk(KERN_WARNING "Root-NFS: unknown "
					"option: %s\n", p);
				return 0;
		}
	}

	return 1;
}

/*
 *  Prepare the NFS data structure and parse all options.
 */
static int __init root_nfs_name(char *name)
{
	static char buf[NFS_MAXPATHLEN] __initdata;
	char *cp;

	/* Set some default values */
	memset(&nfs_data, 0, sizeof(nfs_data));
	nfs_port          = -1;
	nfs_data.version  = NFS_MOUNT_VERSION;
	nfs_data.flags    = NFS_MOUNT_NONLM;	/* No lockd in nfs root yet */
	nfs_data.rsize    = NFS_DEF_FILE_IO_SIZE;
	nfs_data.wsize    = NFS_DEF_FILE_IO_SIZE;
	nfs_data.acregmin = 3;
	nfs_data.acregmax = 60;
	nfs_data.acdirmin = 30;
	nfs_data.acdirmax = 60;
	strcpy(buf, NFS_ROOT);

	/* Process options received from the remote server */
	root_nfs_parse(root_server_path, buf);

	/* Override them by options set on kernel command-line */
	root_nfs_parse(name, buf);

	cp = utsname()->nodename;
	if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) {
		printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
		return -1;
	}
	sprintf(nfs_path, buf, cp);

	return 1;
}

/*
 *  Get NFS server address.
 */
static int __init root_nfs_addr(void)
{
	if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) {
		printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n");
		return -1;
	}

	snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
		 "%u.%u.%u.%u", NIPQUAD(servaddr));
	return 0;
}

/*
 *  Tell the user what's going on.
 */
#ifdef NFSROOT_DEBUG
static void __init root_nfs_print(void)
{
	printk(KERN_NOTICE "Root-NFS: Mounting %s on server %s as root\n",
		nfs_path, nfs_data.hostname);
	printk(KERN_NOTICE "Root-NFS:     rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
		nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans);
	printk(KERN_NOTICE "Root-NFS:     acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n",
		nfs_data.acregmin, nfs_data.acregmax,
		nfs_data.acdirmin, nfs_data.acdirmax);
	printk(KERN_NOTICE "Root-NFS:     nfsd port = %d, mountd port = %d, flags = %08x\n",
		nfs_port, mount_port, nfs_data.flags);
}
#endif

static int __init root_nfs_init(void)
{
#ifdef NFSROOT_DEBUG
	nfs_debug |= NFSDBG_ROOT;
#endif

	/*
	 * Decode the root directory path name and NFS options from
	 * the kernel command line. This has to go here in order to
	 * be able to use the client IP address for the remote root
	 * directory (necessary for pure RARP booting).
	 */
	if (root_nfs_name(nfs_root_name) < 0 ||
	    root_nfs_addr() < 0)
		return -1;

#ifdef NFSROOT_DEBUG
	root_nfs_print();
#endif

	return 0;
}

/*
 *  Parse NFS server and directory information passed on the kernel
 *  command line.
 */
static int __init nfs_root_setup(char *line)
{
	ROOT_DEV = Root_NFS;
	if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) {
		strlcpy(nfs_root_name, line, sizeof(nfs_root_name));
	} else {
		int n = strlen(line) + sizeof(NFS_ROOT) - 1;
		if (n >= sizeof(nfs_root_name))
			line[sizeof(nfs_root_name) - sizeof(NFS_ROOT) - 2] = '\0';
		sprintf(nfs_root_name, NFS_ROOT, line);
	}
	root_server_addr = root_nfs_parse_addr(nfs_root_name);
	return 1;
}

__setup("nfsroot=", nfs_root_setup);

/***************************************************************************

	       Routines to actually mount the root directory

 ***************************************************************************/

/*
 *  Construct sockaddr_in from address and port number.
 */
static inline void
set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port)
{
	sin->sin_family = AF_INET;
	sin->sin_addr.s_addr = addr;
	sin->sin_port = port;
}

/*
 *  Query server portmapper for the port of a daemon program.
 */
static int __init root_nfs_getport(int program, int version, int proto)
{
	struct sockaddr_in sin;

	printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
		program, version, NIPQUAD(servaddr));
	set_sockaddr(&sin, servaddr, 0);
	return rpcb_getport_external(&sin, program, version, proto);
}

/*
 *  Use portmapper to find mountd and nfsd port numbers if not overriden
 *  by the user. Use defaults if portmapper is not available.
 *  XXX: Is there any nfs server with no portmapper?
 */
static int __init root_nfs_ports(void)
{
	int port;
	int nfsd_ver, mountd_ver;
	int nfsd_port, mountd_port;
	int proto;

	if (nfs_data.flags & NFS_MOUNT_VER3) {
		nfsd_ver = NFS3_VERSION;
		mountd_ver = NFS_MNT3_VERSION;
		nfsd_port = NFS_PORT;
		mountd_port = NFS_MNT_PORT;
	} else {
		nfsd_ver = NFS2_VERSION;
		mountd_ver = NFS_MNT_VERSION;
		nfsd_port = NFS_PORT;
		mountd_port = NFS_MNT_PORT;
	}

	proto = (nfs_data.flags & NFS_MOUNT_TCP) ? IPPROTO_TCP : IPPROTO_UDP;

	if (nfs_port < 0) {
		if ((port = root_nfs_getport(NFS_PROGRAM, nfsd_ver, proto)) < 0) {
			printk(KERN_ERR "Root-NFS: Unable to get nfsd port "
					"number from server, using default\n");
			port = nfsd_port;
		}
		nfs_port = port;
		dprintk("Root-NFS: Portmapper on server returned %d "
			"as nfsd port\n", port);
	}

	if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {
		printk(KERN_ERR "Root-NFS: Unable to get mountd port "
				"number from server, using default\n");
		port = mountd_port;
	}
	mount_port = port;
	dprintk("Root-NFS: mountd port is %d\n", port);

	return 0;
}

/*
 *  Get a file handle from the server for the directory which is to be
 *  mounted.
 */
static int __init root_nfs_get_handle(void)
{
	struct nfs_fh fh;
	struct sockaddr_in sin;
	int status;
	int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
					IPPROTO_TCP : IPPROTO_UDP;
	int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
					NFS_MNT3_VERSION : NFS_MNT_VERSION;

	set_sockaddr(&sin, servaddr, htons(mount_port));
	status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol);
	if (status < 0)
		printk(KERN_ERR "Root-NFS: Server returned error %d "
				"while mounting %s\n", status, nfs_path);
	else {
		nfs_data.root.size = fh.size;
		memcpy(nfs_data.root.data, fh.data, fh.size);
	}

	return status;
}

/*
 *  Get the NFS port numbers and file handle, and return the prepared 'data'
 *  argument for mount() if everything went OK. Return NULL otherwise.
 */
void * __init nfs_root_data(void)
{
	if (root_nfs_init() < 0
	 || root_nfs_ports() < 0
	 || root_nfs_get_handle() < 0)
		return NULL;
	set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port));
	return (void*)&nfs_data;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LambdastylePrototype.Interpreter;

namespace LambdastylePrototype
{
    struct ApplyContext
    {
        public readonly IEnumerator<Sentence> Style;
        public readonly PositionStep[] Position;
        public readonly Action<string, Sentence, bool, int> Write;
        public readonly Func<Sentence, bool> Written;
        public readonly Action<Sentence[], Sentence, bool> Spawn;
        public readonly PositionStep[] SpawnerPosition;
        public readonly GlobalState GlobalState;
        public readonly SentenceScope SentenceScope;
        public readonly ParentScope ParentScope;
        public readonly ReducedsScope ReducedsScope;
        public readonly WriteAsScope WriteAsScope;
        public readonly bool Scan;
        public readonly bool Strict;
        public readonly bool SpawnerCanCopy;
        public readonly Sentence Spawner;
        public readonly Sentence[] Previous;

        public ApplyContext(IEnumerator<Sentence> style, PositionStep[] position,
            Action<string, Sentence, bool, int> write, Func<Sentence, bool> written,
            Action<Sentence[], Sentence, bool> spawn, PositionStep[] spawnerPosition, GlobalState globalState,
            SentenceScope sentenceScope, ParentScope parentScope, ReducedsScope reducedsScope,
            WriteAsScope writeAsScope, bool scan, bool strict, bool spawnerCanCopy,
            Sentence spawner, params Sentence[] previous)
        {
            Style = style;
            Position = position;
            Write = write;
            Written = written;
            Spawn = spawn;
            SpawnerPosition = spawnerPosition;
            GlobalState = globalState;
            SentenceScope = sentenceScope;
            ParentScope = parentScope;
            ReducedsScope = reducedsScope;
            WriteAsScope = writeAsScope;
            Scan = scan;
            Strict = strict;
            SpawnerCanCopy = spawnerCanCopy;
            Spawner = spawner;
            Previous = previous;
        }

        public ApplyContext Copy(Sentence caller)
        {
            return this.Copy(caller: caller, style: Style, spawnerPosition: SpawnerPosition, scan: Scan,
                strict: Strict, spawnerCanCopy: SpawnerCanCopy, spawner: Spawner);
        }

        public ApplyContext Copy(Sentence caller, IEnumerator<Sentence> style, PositionStep[] spawnerPosition,
            bool scan, bool spawnerCanCopy, Sentence spawner)
        {
            return this.Copy(caller: caller, style: style, spawnerPosition: spawnerPosition, scan: scan,
                strict: Strict, spawnerCanCopy: spawnerCanCopy, spawner: spawner);
        }

        public ApplyContext Copy(Sentence caller, bool strict)
        {
            return this.Copy(caller: caller, style: Style, spawnerPosition: SpawnerPosition, scan: Scan,
                strict: strict, spawnerCanCopy: SpawnerCanCopy, spawner: Spawner);
        }

        ApplyContext Copy(Sentence caller, IEnumerator<Sentence> style, PositionStep[] spawnerPosition, bool scan,
            bool strict, bool spawnerCanCopy, Sentence spawner)
        {
            return new ApplyContext(
                style: style,
                position: Position,
                write: Write,
                written: Written,
                spawn: Spawn,
                spawnerPosition: spawnerPosition,
                globalState: GlobalState,
                sentenceScope: SentenceScope,
                parentScope: ParentScope,
                reducedsScope: ReducedsScope,
                writeAsScope: WriteAsScope,
                scan: scan,
                strict: strict,
                spawnerCanCopy: spawnerCanCopy,
                spawner: spawner,
                previous: Previous.Concat(new Sentence[] { caller }).ToArray());
        }
    }
}


text:
namespace app {
namespace Uno {
namespace Data {
namespace Json {

::uEnumType* JsonDataType__typeof();

}}}}

#endif


text:
package com.example.tunky.gandflogin;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.widget.Toast;

import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.Profile;
import com.facebook.ProfileTracker;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.google.android.gms.common.api.GoogleApiClient;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MainActivity extends AppCompatActivity {

    private CallbackManager callbackManager;
    private AccessTokenTracker accessTokenTracker;
    private ProfileTracker profileTracker;

    private FacebookCallback<LoginResult> callback = new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            Profile profile = Profile.getCurrentProfile();
            nextActivity(profile);
        }

        @Override
        public void onCancel() {
        }

        @Override
        public void onError(FacebookException e) {
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        FragmentManager fm = getSupportFragmentManager();
        Fragment fragment = fm.findFragmentById(R.id.fragment_container);

        if (fragment == null) {
            fragment = new GooglePlusFragment();

            fm.beginTransaction()
                    .add(R.id.fragment_container, fragment)
                    .commit();
        }

        FacebookSdk.sdkInitialize(getApplicationContext());
        callbackManager = CallbackManager.Factory.create();
        accessTokenTracker = new AccessTokenTracker() {
            @Override
            protected void onCurrentAccessTokenChanged(AccessToken oldToken, AccessToken newToken) {
            }
        };

        profileTracker = new ProfileTracker() {
            @Override
            protected void onCurrentProfileChanged(Profile oldProfile, Profile newProfile) {
                nextActivity(newProfile);
            }
        };
        accessTokenTracker.startTracking();
        profileTracker.startTracking();

        LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
        callback = new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                AccessToken accessToken = loginResult.getAccessToken();
                Profile profile = Profile.getCurrentProfile();
                nextActivity(profile);
                Toast.makeText(getApplicationContext(), "Logging in...", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onCancel() {
            }

            @Override
            public void onError(FacebookException e) {
            }
        };
        loginButton.setReadPermissions("user_friends");
        loginButton.registerCallback(callbackManager, callback);

        try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.example.tunky.gandflogin",
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
        } catch (PackageManager.NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

    }

    @Override
    protected void onResume() {
        super.onResume();
        Profile profile = Profile.getCurrentProfile();
        nextActivity(profile);
    }

    @Override
    protected void onPause() {

        super.onPause();
    }

    protected void onStop() {
        super.onStop();
        accessTokenTracker.stopTracking();
        profileTracker.stopTracking();
    }

    @Override
    protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
        super.onActivityResult(requestCode, responseCode, intent);
        callbackManager.onActivityResult(requestCode, responseCode, intent);

    }

    private void nextActivity(Profile profile) {
        if (profile != null) {
            Intent main = new Intent(MainActivity.this, FacebookLoginActivity.class);
            main.putExtra("name", profile.getFirstName());
            main.putExtra("surname", profile.getLastName());
            main.putExtra("imageUrl", profile.getProfilePictureUri(200, 200).toString());
            startActivity(main);
        }
    }

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

    }
}


text:
package net.nautsch.eisenbahnapp.fahrzeuge;

public interface Fahrzeug {

    int getAktuelleGeschwindigkeit();

}


text:
package org.kie.workbench.common.stunner.project.editor.impl;

import org.junit.Test;
import org.kie.workbench.common.stunner.core.graph.impl.GraphImpl;
import org.kie.workbench.common.stunner.core.graph.impl.NodeImpl;
import org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl;
import org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl;
import org.kie.workbench.common.stunner.project.diagram.impl.ProjectMetadataImpl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.kie.workbench.common.stunner.project.editor.ProjectDiagramResource.Type.PROJECT_DIAGRAM;
import static org.kie.workbench.common.stunner.project.editor.ProjectDiagramResource.Type.XML_DIAGRAM;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;

public class ProjectDiagramResourceImplTest {

    @Test
    public void testEqualsWhenProjectDiagramIsDifferent() {

        final ProjectDiagramImpl projectDiagram1 = new ProjectDiagramImpl("Diagram", makeGraph(), makeMetadata());
        final ProjectDiagramImpl projectDiagram2 = new ProjectDiagramImpl("Diagram_", makeGraph(), makeMetadata());
        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl(projectDiagram1);
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl(projectDiagram2);

        assertNotEquals(projectDiagramResource1, projectDiagramResource2);
        assertNotEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test
    public void testEqualsWhenXmlDiagramIsDifferent() {

        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl("<xml>");
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl("<xml />");

        assertNotEquals(projectDiagramResource1, projectDiagramResource2);
        assertNotEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test
    public void testEqualsWhenTypeIsDifferent() {

        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl(null, null, PROJECT_DIAGRAM);
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl(null, null, XML_DIAGRAM);

        assertNotEquals(projectDiagramResource1, projectDiagramResource2);
        assertNotEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test
    public void testEqualsWhenProjectDiagramIsDifferentGraph() {

        final GraphImpl graphOne = makeGraph();
        final GraphImpl graphTwo = makeGraph();

        graphTwo.addNode(new NodeImpl("unique id"));

        final ProjectDiagramImpl projectDiagram1 = new ProjectDiagramImpl("Diagram", graphOne, makeMetadata());
        final ProjectDiagramImpl projectDiagram2 = new ProjectDiagramImpl("Diagram", graphTwo, makeMetadata());
        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl(projectDiagram1);
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl(projectDiagram2);

        assertNotEquals(projectDiagramResource1, projectDiagramResource2);
        assertNotEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test
    public void testEqualsWhenProjectDiagramIsDifferentMetadata() {

        final ProjectMetadataImpl metadataOne = spy(makeMetadata());
        final ProjectMetadataImpl metadataTwo = spy(makeMetadata());

        doReturn("moduleOne").when(metadataOne).getModuleName();
        doReturn("moduleTwo").when(metadataTwo).getModuleName();

        final ProjectDiagramImpl projectDiagram1 = new ProjectDiagramImpl("Diagram", makeGraph(), metadataOne);
        final ProjectDiagramImpl projectDiagram2 = new ProjectDiagramImpl("Diagram", makeGraph(), metadataTwo);
        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl(projectDiagram1);
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl(projectDiagram2);

        assertNotEquals(projectDiagramResource1, projectDiagramResource2);
        assertNotEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test
    public void testEqualsWhenObjectsAreEqual() {

        final ProjectDiagramImpl projectDiagram1 = new ProjectDiagramImpl("Diagram", makeGraph(), makeMetadata());
        final ProjectDiagramImpl projectDiagram2 = new ProjectDiagramImpl("Diagram", makeGraph(), makeMetadata());
        final ProjectDiagramResourceImpl projectDiagramResource1 = new ProjectDiagramResourceImpl(projectDiagram1);
        final ProjectDiagramResourceImpl projectDiagramResource2 = new ProjectDiagramResourceImpl(projectDiagram2);

        assertEquals(projectDiagramResource1, projectDiagramResource2);
        assertEquals(projectDiagramResource1.hashCode(), projectDiagramResource2.hashCode());
    }

    @Test(expected = IllegalArgumentException.class)
    public void testInstanceCreationWhenTypeIsNull() {
        new ProjectDiagramResourceImpl(null, null, null);
    }

    private GraphImpl makeGraph() {
        return new GraphImpl("Graph", new GraphNodeStoreImpl());
    }

    private ProjectMetadataImpl makeMetadata() {
        return new ProjectMetadataImpl();
    }
}


text:
package cn.ac.ict.acs.netflow.metrics

import java.io.{ FileInputStream, InputStream }
import java.util.Properties

import scala.collection.mutable

import cn.ac.ict.acs.netflow.Logging

import scala.util.matching.Regex

class MetricsConfig(val configFile: Option[String]) extends Logging {

  private val DEFAULT_PREFIX = "*"
  private val INSTANCE_REGEX = "^(\\*|[a-zA-Z]+)\\.(.+)".r
  private val DEFAULT_METRICS_CONF_FILENAME = "metrics.properties"

  private[metrics] val properties = new Properties()
  private[metrics] var propertyCategories: mutable.HashMap[String, Properties] = null

  def initialize() {

    // If spark.metrics.conf is not set, try to get file in class path
    val isOpt: Option[InputStream] = configFile.map(new FileInputStream(_)).orElse {
      try {
        Option(getClass.getClassLoader.getResourceAsStream(DEFAULT_METRICS_CONF_FILENAME))
      } catch {
        case e: Exception =>
          logError("Error loading default configuration file", e)
          None
      }
    }

    isOpt.foreach { is =>
      try {
        properties.load(is)
      } finally {
        is.close()
      }
    }

    propertyCategories = subProperties(properties, INSTANCE_REGEX)
    if (propertyCategories.contains(DEFAULT_PREFIX)) {
      import scala.collection.JavaConversions._

      val defaultProperty = propertyCategories(DEFAULT_PREFIX)
      for {
        (inst, prop) <- propertyCategories
        if (inst != DEFAULT_PREFIX)
        (k, v) <- defaultProperty
        if (prop.getProperty(k) == null)
      } {
        prop.setProperty(k, v)
      }
    }
  }

  def subProperties(prop: Properties, regex: Regex): mutable.HashMap[String, Properties] = {
    val subProperties = new mutable.HashMap[String, Properties]
    import scala.collection.JavaConversions._
    prop.foreach { kv =>
      if (regex.findPrefixOf(kv._1).isDefined) {
        val regex(prefix, suffix) = kv._1
        subProperties.getOrElseUpdate(prefix, new Properties).setProperty(suffix, kv._2)
      }
    }
    subProperties
  }

  def getInstance(inst: String): Properties = {
    propertyCategories.get(inst) match {
      case Some(s) => s
      case None => propertyCategories.getOrElse(DEFAULT_PREFIX, new Properties)
    }
  }

}


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

namespace GetAllGetOne.Controllers
{
    public class CustomersController : Controller
    {
        // Reference to a manager object
        private Manager m = new Manager();

        // GET: Customers
        public ActionResult Index()
        {
            // Attention 06 - Error - object reference not set to an instance of an object
            // Just as it says... an object is null, and you're trying to use it
            // Set a breakpoint on line 24 above, then "step over" to get to the error
            // Inspect the variable values as you step through the lines of code

            // Create a new CustomerEditContactInfo object
            // Intentionally leave out some property values
            var newCust = new CustomerEditContactInfo
            {
                //Fax = "(416) 661-4034",
                //Email = "customer@example.com",
                CustomerId = 2,
                Phone = "(416) 491-5050"
            };

            // Now, attempt to use some values that are not set
            var email = newCust.Email;
            var emailLength = email.Length;

            // Fetch the collection
            var c = m.CustomerGetAll();

            // Pass the collection to the view
            return View(c);
        }

        // GET: Customers/Details/5
        public ActionResult Details(int? id)
        {
            // Attempt to get the matching object
            var o = m.CustomerGetById(id.GetValueOrDefault());

            if (o == null)
            {
                return HttpNotFound();
            }
            else
            {
                // Pass the object to the view
                return View(o);
            }
        }

        // GET: Customers/Create
        public ActionResult Create()
        {
            // At your option, create and send an object to the view
            return View();
        }

        // POST: Customers/Create
        [HttpPost]
        public ActionResult Create(CustomerAdd newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                return View(newItem);
            }

            // Process the input
            var addedItem = m.CustomerAdd(newItem);

            if (addedItem == null)
            {
                return View(newItem);
            }
            else
            {
                return RedirectToAction("details", new { id = addedItem.CustomerId });
            }
        }

        // GET: Customers/Edit/5
        public ActionResult Edit(int? id)
        {
            // Attempt to fetch the matching object
            var o = m.CustomerGetById(id.GetValueOrDefault());

            if (o == null)
            {
                return HttpNotFound();
            }
            else
            {
                // Create and configure an "edit form"

                // Notice that o is a CustomerBase object
                // We must map it to a CustomerEditContactInfoForm object
                var editForm = m.mapper.Map<CustomerEditContactInfoForm>(o);

                return View(editForm);
            }
        }

        // POST: Customers/Edit/5
        [HttpPost]
        public ActionResult Edit(int? id, CustomerEditContactInfo newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                // Our "version 1" approach is to display the "edit form" again
                return RedirectToAction("edit", new { id = newItem.CustomerId });
            }

            if (id.GetValueOrDefault() != newItem.CustomerId)
            {
                // This appears to be data tampering, so redirect the user away
                return RedirectToAction("index");
            }

            // Attention 16 - Error - cause a validation error when saving to the store
            // At this point in the method, newItem has passed the initial validation test
            // Set a breakpoint at line 139 below
            // So, let's invalidate some of its values (null or string too long),
            // and pass it to the manager, which will attempt to save it to the data store
            // Then, BOOM!, a DbEntity validation error will appear

            // Set a required value to null
            newItem.Email = null;

            // Set another to a too-long value
            newItem.Phone = "This string is too long. It exceeds the 24-character limit.";

            // Attempt to do the update
            var editedItem = m.CustomerEditContactInfo(newItem);

            if (editedItem == null)
            {
                // There was a problem updating the object
                // Our "version 1" approach is to display the "edit form" again
                return RedirectToAction("edit", new { id = newItem.CustomerId });
            }
            else
            {
                // Show the details view, which will have the updated data
                return RedirectToAction("details", new { id = newItem.CustomerId });
            }
        }

        // GET: Customers/Delete/5
        public ActionResult Delete(int? id)
        {
            var itemToDelete = m.CustomerGetById(id.GetValueOrDefault());

            if (itemToDelete == null)
            {
                // Don't leak info about the delete attempt
                // Simply redirect
                return RedirectToAction("index");
            }
            else
            {
                return View(itemToDelete);
            }
        }

        // POST: Customers/Delete/5
        [HttpPost]
        public ActionResult Delete(int? id, FormCollection collection)
        {
            var result = m.CustomerDelete(id.GetValueOrDefault());

            // "result" will be true or false
            // We probably won't do much with the result, because
            // we don't want to leak info about the delete attempt

            // In the end, we should just redirect to the list view
            return RedirectToAction("index");
        }
    }
}


text:
> ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-configs.html) for [XO](https://github.com/sindresorhus/xo) with 2-space indent, key spacing and multi spaces.

This is for advanced users. You probably want to use XO directly.

## Install

```
$ npm install --save-dev eslint-config-xo-multi-spaces
```

## Usage

Add some ESLint config to your `package.json`:

```json
{
  "name": "my-awesome-project",
  "eslintConfig": {
    "extends": "xo-multi-spaces"
  }
}
```

Or to `.eslintrc`:

```json
{
  "extends": "xo-multi-spaces"
}
```

This package also exposes [`xo-multi-spaces/esnext`](esnext.js) if you want ES2015 support and rules:

```json
{
  "extends": "xo-multi-spaces/esnext"
}
```

And [`xo-multi-spaces/browser`](browser.js) if you're in the browser:

```json
{
  "extends": "xo-multi-spaces/browser"
}
```

## License

MIT © [Fredrik Forsmo](http://forsmo.me)


text:
namespace base {
class FilePath;
}  // namespace base

namespace sql {

class Database;

class DatabaseTestPeer {
 public:
  static bool AttachDatabase(Database* db,
                             const base::FilePath& other_db_path,
                             const char* attachment_point);
  static bool DetachDatabase(Database* db, const char* attachment_point);

  static bool EnableRecoveryExtension(Database* db);
};

}  // namespace sql

#endif  // SQL_TEST_DATABASE_TEST_PEER_H_


text:
import babel from 'rollup-plugin-babel';
import replace from 'rollup-plugin-replace';
import manifest  from '../package.json';
import fs  from 'fs';
import moment  from 'moment';

const project = 'parsley';

const banner = fs.readFileSync('src/header.js', 'utf8')
  .replace('VERSION', manifest.version)
  .replace('NOW', moment().format('ddd, MMM Do YYYY, h:mm a'));

function rollupOptions({
  input=`./src/${project}.js`,
  suffix='',
  file=`./dist/${project}${suffix}.js`,
  extraPlugins=[],
}) {
  return {
    input,
    external: ['jquery'],
    plugins: [
      replace({ VERSION: manifest.version }),
      babel(),
      ...extraPlugins
    ],
    output: {
      file,
      format: 'umd',
      banner: banner,
      name: project,
      sourcemap: true,
      globals: { jquery: 'jQuery' },
      interop: false,
    }
  };
}

export {rollupOptions};


text:
<!DOCTYPE html>

    <title>aadm: articles by Alessandro Amato del Monte</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="http://aadm.github.io/favicon.png" rel="icon">

        <meta name="author" content="Alessandro Amato del Monte" />

        <meta property="og:site_name" content="aadm" />
        <meta property="og:type" content="website"/>
        <meta property="og:title" content="aadm"/>
        <meta property="og:url" content="http://aadm.github.io"/>
        <meta property="og:description" content="aadm"/>

        <link rel="stylesheet" href="http://aadm.github.io/theme/css/bootstrap.journal.min.css" type="text/css"/>
    <link href="http://aadm.github.io/theme/css/font-awesome.min.css" rel="stylesheet">

    <link href="http://aadm.github.io/theme/css/pygments/tango.css" rel="stylesheet">
        <link href="http://aadm.github.io/theme/css/typogrify.css" rel="stylesheet">
    <link rel="stylesheet" href="http://aadm.github.io/theme/css/style.css" type="text/css"/>
        <link href="http://aadm.github.io/static/custom.css" rel="stylesheet">

        <link href="http://aadm.github.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate"
              title="aadm ATOM Feed"/>

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                Toggle navigation

            </button>

aadm

    archives / tags

berkeley

    Date

        <time datetime="2012-10-13T00:00:00+02:00"> 2012-10-13</time>

Tags
	photo

Simili ma non uguali. Questo è quello che tiravamo fuori io e Dylan bighellonando per Berkeley un paio di settimane fa.

Dylan ed io abbiamo lavorato assieme per quattro anni a Londra, e siamo diventati amici. Siamo rientrati in Italia quasi contemporaneamente ma io a Milano, lui a Trento. E …

                          more ...

olympus c(r)ap lens

    Date

        <time datetime="2012-10-12T00:00:00+02:00"> 2012-10-12</time>

Tags
	photo
        /
	gear
        /
	links

It might be quirky and it might be cool but I would argue this is something which should not appeal to anybody apart from facebook photographers.

I'm talking about the 15mm Olympus body c(r)ap lens.

The reasons are two:

judging from the shots which you can see …

                          more ...

weekly snaps 8

    Date

        <time datetime="2012-10-11T00:00:00+02:00"> 2012-10-11</time>

Tags
	photo

Special edition today, featuring only iPhone photos.

Tiles, Parma. iPhone 4S, Instagram.

Morning breakfast. iPhone 4S, Snapseed.

Haunted house #1, Boschi di Carrega, Sala Baganza (PR). iPhone 4S, Snapseed.

Haunted house #2, Boschi di Carrega, Sala Baganza (PR). iPhone 4S, Snapseed.

Stefano. iPhone 4S, Instagram.

                          more ...

io giulia valentina e la bici

    Date

        <time datetime="2012-10-07T00:00:00+02:00"> 2012-10-07</time>

Tags
	cycling

Qualche giorno fa Valentina ha compiuto due mesi, e oggi ha fatto la sua prima escursione in montagna.

Saliamo sul Monte Canto io, Giulia, Valentina e la bici; io ho dietro uno zaino con focaccia, acqua, brugole e una camera d'aria; davanti un marsupio con la bambina; la bici …

                          more ...

weekly snaps 7

    Date

        <time datetime="2012-09-22T00:00:00+02:00"> 2012-09-22</time>

Tags
	photo

Random photos this time. Some are very old, and I can't even recall which lens I used. The last two are reminders that today was Giulia's birthday (and this year there was nothing really which could compete with that special gift we're enjoying together since the 4th …

                          more ...

thoughts on d7000

    Date

        <time datetime="2012-09-21T00:00:00+02:00"> 2012-09-21</time>

Tags
	photo
        /
	gear

It's almost a year now that I have the Nikon D7000. It's time to write something up about this camera.

I arrived at the Nikon D7000 after a long apprenticeship. I started with a Yashica FX-3 and its 50mm f/1.8, then I moved to a Nikon F70 (we're still in the ancient film era). After a few crappy compact digital cameras (and one less crappy than others, the Canon G5) I got my first DSLR (a Nikon D70s) which was excellent until it broke down.

Since I was always traveling and hiking and biking I wanted a smaller camera so I bought a Panasonic GF-1 that I still have (and will keep for many more years to come; it's still much better than any compact camera and only marginally larger).

                          more ...

xkcd click and drag wallpapers

    Date

        <time datetime="2012-09-21T00:00:00+02:00"> 2012-09-21</time>

Tags
	misc

Click and Drag, the amazing xkcd cartoon that went online a few days ago, was fascinating and threw me back to the worlds I used to explore when I was a kid (through videogames obviously).

I selected a few places and made 1920x1080 captures to use as wallpapers for my …

                          more ...

weekly snaps 6

    Date

        <time datetime="2012-09-14T00:00:00+02:00"> 2012-09-14</time>

Tags
	photo

I did a few experiments with the camera over the past two weekends. Thought to share a few pictures here, even if they are not particularly inspired shots. But if you're trying to find how damn good is the D7000 sensor, just look at the green tomato shot.

All …

                          more ...

24h finale ligure

    Date

        <time datetime="2012-09-08T00:00:00+02:00"> 2012-09-08</time>

Tags
	cycling
        /
	photo

Quando andavo in moto mi hanno sempre appassionato le gare di endurance; 6 ore di Sebring, 24 ore di Les Mans, fari nella lunga notte, tutte cose che mi affascinavano.

Ho smesso di andare in moto ma le gare di durata non hanno mai smesso di attirarmi.  E quest'anno …

                          more ...

rosamarina

    Date

        <time datetime="2012-09-05T00:00:00+02:00"> 2012-09-05</time>

Tags
	photo

I find it difficult to take interesting/compelling/creative photos of familiar places. So what I did this time was just to take random snaps, without thinking too much, without trying to sample all the possible aspects of a place.

They may not show what the true Rosamarina is: to …

                          more ...

«

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

»

© 2005-2019 Alessandro Amato del Monte

  Creative Commons Attribution 4.0 International License

 TOP


text:
export ANDROID_SDK_ROOT=/usr/local/opt/android-sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT


text:
1

var = ģ 塲 ㎉


text:
package me.ronggenliu.dp.construction.composite;

public class Client {

	public static void main(String[] args) {
		Worker employe1 =  new Employe("employe1");
		employe1.doAction();
		Worker employe2 = new Employe("employ2");
		employe2.doAction();
		Worker employe3 = new Employe("employe3");
		employe3.doAction();
		Worker leader1 = new Leader("leader1");
		leader1.add(employe1);
		leader1.add(employe2);
		leader1.doAction();
	}

}


text:
use std::io::IoResult;
use std::io::net::ip::SocketAddr;

/// A trait for the concept of opening a stream connected to a IP socket address.
///
/// Why is this here? So that we can implement things which must make
/// connections in terms of *anything* that can make such a connection rather
/// than in terms of `TcpStream` only. This is handy for testing and for SSL.
pub trait Connecter {
    fn connect(addr: SocketAddr, host: &str, use_ssl: bool) -> IoResult<Self>;
}


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

package com.twitter.heron.spi.common;

import java.util.logging.Logger;

import org.junit.Assert;
import org.junit.Test;

public class MiscTest {
  private static final Logger LOG = Logger.getLogger(MiscTest.class.getName());

  /**
   * Test if the ${HERON_HOME} variable can be substituted
   */
  @Test
  public void testHeronHome() {
    // check no occurrence
    Assert.assertEquals(
        "./bin",
        Misc.substitute("/usr/local/heron", "./bin")
    );

    // check a single subsitution at the begining
    Assert.assertEquals(
        "/usr/local/heron/bin",
        Misc.substitute("/usr/local/heron", "${HERON_HOME}/bin")
    );

    // check a single subsitution at the begining with relative path
    Assert.assertEquals(
        "./usr/local/heron/bin",
        Misc.substitute("/usr/local/heron", "./${HERON_HOME}/bin")
    );

    // check a single substitution at the end
    Assert.assertEquals(
        "/bin/usr/local/heron",
        Misc.substitute("/usr/local/heron", "/bin/${HERON_HOME}")
    );

    // check a single substitution at the end with relative path
    Assert.assertEquals(
        "./bin/usr/local/heron",
        Misc.substitute("/usr/local/heron", "./bin/${HERON_HOME}")
    );

    // check a single substitution in the middle
    Assert.assertEquals(
        "/bin/usr/local/heron/etc",
        Misc.substitute("/usr/local/heron", "/bin/${HERON_HOME}/etc")
    );

    // check a single substitution in the middle with relative path
    Assert.assertEquals(
        "./bin/usr/local/heron/etc",
        Misc.substitute("/usr/local/heron", "./bin/${HERON_HOME}/etc")
    );
  }

  @Test
  public void testURL() {
    Assert.assertTrue(
        Misc.isURL("file:///users/john/afile.txt")
    );
    Assert.assertFalse(
        Misc.isURL("/users/john/afile.txt")
    );
    Assert.assertTrue(
        Misc.isURL("https://gotoanywebsite.net/afile.html")
    );
    Assert.assertFalse(
        Misc.isURL("https//gotoanywebsite.net//afile.html")
    );
  }
}


text:
package org.lwjgl.opengl.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.cocoa.NSNotificationCenter;
import org.eclipse.swt.internal.cocoa.NSOpenGLContext;
import org.eclipse.swt.internal.cocoa.NSOpenGLPixelFormat;
import org.eclipse.swt.internal.cocoa.NSView;
import org.eclipse.swt.internal.cocoa.OS;
import org.eclipse.swt.widgets.Listener;
import org.lwjgl.opengl.swt.GLData.Profile;

/**
 * OSX-specific implementation of methods for GLCanvas.
 */
class PlatformMacOSXGLCanvas extends AbstractPlatformGLCanvas {

	private NSOpenGLContext context;
	private NSOpenGLPixelFormat pixelFormat;

	private static final int MAX_ATTRIB = 32;
	private static final String GLCONTEXT_KEY = "org.eclipse.swt.internal.cocoa.glcontext"; //$NON-NLS-1$

	private NSView view;

	static final int NSOpenGLPFAOpenGLProfile = 99;
	static final int NSOpenGLProfileVersion3_2Core = 0x3200;
	static final int NSOpenGLProfileVersionLegacy = 0x1000;
	static final int NSOpenGLProfileVersion4_1Core = 0x4100;

	@Override
	/*
	 * IMPORTANT: NSOpenGL/CoreOpenGL only supports specifying the total number
	 * of bits in the size of the color component -> effective.redSize,
	 * effective.blueSize and effective.greenSize won't be set !
	 *
	 * IMPORTANT: NSOpenGL/CoreOpenGL only supports specifying the total number
	 * of bits in the size of the color accumulator component. ->
	 * effective.accumRedSize, effective.accumBlueSize, effective.accumGreenSize
	 * and effective.accumAlphaSize won't be set !
	 */
	public long create(GLCanvas canvas, GLData data, GLData effective) {

		if (data == null)
			SWT.error(SWT.ERROR_NULL_ARGUMENT);
		this.view = canvas.view;

		int[] attrib = new int[MAX_ATTRIB];
		int pos = 0;

		if (data.doubleBuffer)
			attrib[pos++] = OS.NSOpenGLPFADoubleBuffer;

		if (data.stereo)
			attrib[pos++] = OS.NSOpenGLPFAStereo;

		/*
		 * Feature in Cocoa: NSOpenGL/CoreOpenGL only supports specifying the
		 * total number of bits in the size of the color component. If
		 * specified, the color size is the sum of the red, green and blue
		 * values in the GLData.
		 */
		if ((data.redSize + data.blueSize + data.greenSize) > 0) {
			attrib[pos++] = OS.NSOpenGLPFAColorSize;
			attrib[pos++] = data.redSize + data.greenSize + data.blueSize;
		}

		if (data.alphaSize > 0) {
			attrib[pos++] = OS.NSOpenGLPFAAlphaSize;
			attrib[pos++] = data.alphaSize;
		}

		if (data.depthSize > 0) {
			attrib[pos++] = OS.NSOpenGLPFADepthSize;
			attrib[pos++] = data.depthSize;
		}

		if (data.stencilSize > 0) {
			attrib[pos++] = OS.NSOpenGLPFAStencilSize;
			attrib[pos++] = data.stencilSize;
		}

		if (data.profile == Profile.CORE) {
			attrib[pos++] = NSOpenGLPFAOpenGLProfile;
			attrib[pos++] = NSOpenGLProfileVersion3_2Core;
		}
		if (data.profile == Profile.COMPATIBILITY) {
			attrib[pos++] = NSOpenGLPFAOpenGLProfile;
			attrib[pos++] = NSOpenGLProfileVersionLegacy;
		} else {
			if (data.majorVersion >= 4) {
				attrib[pos++] = NSOpenGLPFAOpenGLProfile;
				attrib[pos++] = NSOpenGLProfileVersion4_1Core;
			} else if (data.majorVersion >= 3) {
				attrib[pos++] = NSOpenGLPFAOpenGLProfile;
				attrib[pos++] = NSOpenGLProfileVersion3_2Core;
			} else {
				attrib[pos++] = NSOpenGLPFAOpenGLProfile;
				attrib[pos++] = NSOpenGLProfileVersionLegacy;
			}
		}

		/*
		 * Feature in Cocoa: NSOpenGL/CoreOpenGL only supports specifying the
		 * total number of bits in the size of the color accumulator component.
		 * If specified, the color size is the sum of the red, green, blue and
		 * alpha accum values in the GLData.
		 */
		if ((data.accumRedSize + data.accumBlueSize + data.accumGreenSize) > 0) {
			attrib[pos++] = OS.NSOpenGLPFAAccumSize;
			attrib[pos++] = data.accumRedSize + data.accumGreenSize + data.accumBlueSize + data.accumAlphaSize;
		}

		if (data.sampleBuffers > 0) {
			attrib[pos++] = OS.NSOpenGLPFASampleBuffers;
			attrib[pos++] = data.sampleBuffers;
		}

		if (data.samples > 0) {
			attrib[pos++] = OS.NSOpenGLPFASamples;
			attrib[pos++] = data.samples;
		}

		attrib[pos] = 0;

		pixelFormat = (NSOpenGLPixelFormat) new NSOpenGLPixelFormat().alloc();

		if (pixelFormat == null) {
			canvas.dispose();
			SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
		}
		pixelFormat.initWithAttributes(attrib);

		NSOpenGLContext ctx = data.shareContext != null ? new NSOpenGLContext(data.shareContext.context) : null;
		context = (NSOpenGLContext) new NSOpenGLContext().alloc();
		if (context == null) {
			canvas.dispose();
			SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
		}
		context = context.initWithFormat(pixelFormat, ctx);

		context.setValues(new int[] { -1 }, OS.NSOpenGLCPSurfaceOrder);
		canvas.setData(GLCONTEXT_KEY, context);
		NSNotificationCenter.defaultCenter().addObserver(view, OS.sel_updateOpenGLContext_, OS.NSViewGlobalFrameDidChangeNotification, view);

		Listener listener = event -> {
			if (event.type == SWT.Dispose) {
				canvas.setData(GLCONTEXT_KEY, null);
				NSNotificationCenter.defaultCenter().removeObserver(view);

				if (context != null) {
					context.clearDrawable();
					context.release();
				}
				context = null;
				if (pixelFormat != null)
					pixelFormat.release();
				pixelFormat = null;
			}
		};
		canvas.addListener(SWT.Dispose, listener);

		long[] longptr = new long[1];
		pixelFormat.getValues(longptr, OS.NSOpenGLPFAAlphaSize, 0);
		effective.alphaSize = (int) longptr[0];
		pixelFormat.getValues(longptr, OS.NSOpenGLPFADepthSize, 0);
		effective.depthSize = (int) longptr[0];
		pixelFormat.getValues(longptr, OS.NSOpenGLPFAStencilSize, 0);
		effective.stencilSize = (int) longptr[0];
		pixelFormat.getValues(longptr, OS.NSOpenGLPFADoubleBuffer, 0);
		effective.doubleBuffer = longptr[0] == 1;
		pixelFormat.getValues(longptr, OS.NSOpenGLPFAStereo, 0);
		effective.stereo = longptr[0] == 1;

		pixelFormat.getValues(longptr, NSOpenGLPFAOpenGLProfile, 0);
		if (longptr[0] == NSOpenGLProfileVersion3_2Core) {
			effective.majorVersion = 3;
			effective.minorVersion = 2;
			effective.profile = Profile.CORE;
		} else if (longptr[0] == NSOpenGLProfileVersionLegacy) {
			effective.profile = Profile.COMPATIBILITY;
		} else if (longptr[0] == NSOpenGLProfileVersion4_1Core) {
			effective.majorVersion = 4;
			effective.minorVersion = 1;
			effective.profile = Profile.CORE;
		}

		pixelFormat.getValues(longptr, OS.NSOpenGLPFASampleBuffers, 0);
		data.sampleBuffers = (int) longptr[0];

		pixelFormat.getValues(longptr, OS.NSOpenGLPFASamples, 0);
		data.samples = (int) longptr[0];

		return context.id;
	}

	@Override
	public boolean isCurrent(long context) {
		NSOpenGLContext current = NSOpenGLContext.currentContext();
		return current != null && current.id == context;
	}

	@Override
	public boolean makeCurrent(GLCanvas canvas, long context) {
		new NSOpenGLContext(context).makeCurrentContext();
		return true;
	}

	@Override
	public boolean deleteContext(GLCanvas canvas, long context) {
		canvas.setData(GLCONTEXT_KEY, null);
		NSNotificationCenter.defaultCenter().removeObserver(view);
		NSOpenGLContext ctx = new NSOpenGLContext(context);
		ctx.clearDrawable();
		ctx.release();

		if (pixelFormat != null) {
			pixelFormat.release();
		}
		pixelFormat = null;
		return true;
	}

	@Override
	public boolean swapBuffers(GLCanvas canvas) {
		new NSOpenGLContext(canvas.context).flushBuffer();
		return true;
	}

	@Override
	public boolean delayBeforeSwapNV(GLCanvas canvas, float seconds) {
		// It seems that there's no support for this on OSX
		//https://github.com/LWJGL/lwjgl3/commit/c82cf46050ea6e1b891756cfec392c66186e87b1
		return false;
	}
}


text:
/* jshint strict: false, sub: true */
/* global print */
'use strict';

// //////////////////////////////////////////////////////////////////////////////
// / DISCLAIMER
// /
// / Copyright 2016 ArangoDB GmbH, Cologne, Germany
// / Copyright 2014 triagens GmbH, Cologne, Germany
// /
// / 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.
// /
// / Copyright holder is ArangoDB GmbH, Cologne, Germany
// /
// / @author Max Neunhoeffer
// //////////////////////////////////////////////////////////////////////////////

const functionsDocumentation = {
  'fail': 'this job will always produce a failed result'
};
const optionsDocumentation = [
];
function fail (options) {
  return {
    failSuite: {
      status: false,
      total: 1,
      message: 'this suite will always fail.',
      duration: 2,
      failed: 1,
      failTest: {
        status: false,
        total: 1,
        duration: 1,
        message: 'this testcase will always fail.'
      },
      failSuccessTest: {
        status: true,
        duration: 1,
        message: 'this testcase will always succeed, though its in the fail testsuite.'
      }
    },
    successSuite: {
      status: true,
      total: 1,
      message: 'this suite will always be successfull',
      duration: 1,
      failed: 0,
      success: {
        status: true,
        message: 'this testcase will always be successfull',
        duration: 1
      }
    }
  };
};

function setup (testFns, defaultFns, opts, fnDocs, optionsDoc) {
  testFns['fail'] = fail;
  for (var attrname in functionsDocumentation) { fnDocs[attrname] = functionsDocumentation[attrname]; }
  for (var i = 0; i < optionsDocumentation.length; i++) { optionsDoc.push(optionsDocumentation[i]); }
}

exports.setup = setup;