text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>nl.remco</groupId>
    <artifactId>Flowable</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Flowable</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.projectreactor</groupId>
                <artifactId>reactor-bom</artifactId>
                <version>Bismuth-RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.reactivex.rxjava2</groupId>
            <artifactId>rxjava</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.reactivestreams</groupId>
            <artifactId>reactive-streams</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>

    </build>
</project>


text:
'use strict';

if (require.main !== module) { return; }

require('../../../lib/cli');

process.send({ modules: Object.keys(require.cache) });

redpajama_set_name: RedPajamaGithub


text:
package panda.utilities;

import panda.std.stream.PandaStream;

import java.util.Arrays;
import java.util.Stack;
import java.util.function.Predicate;

public final class StackTraceUtils {

    private StackTraceUtils() { }

    public static StackTraceElement[] startsWith(StackTraceElement[] stackTrace, Predicate<StackTraceElement> condition) {
        return PandaStream.of(stackTrace)
                .takeWhile(element -> !condition.test(element))
                .toArray(StackTraceElement[]::new);
    }

    public static StackTraceElement[] filter(StackTraceElement[] stackTrace, Class<?>... ignored) {
        return filter(stackTrace,  Arrays.stream(ignored)
                .map(Class::getName)
                .toArray(String[]::new)
        );
    }

    public static StackTraceElement[] filter(StackTraceElement[] stacktrace, String... ignored) {
        return filter(stacktrace, element -> Arrays.stream(ignored).anyMatch(ignoredName -> element.getClassName().startsWith(ignoredName)));
    }

    private static StackTraceElement[] filter(StackTraceElement[] stacktrace, Predicate<StackTraceElement> filter) {
        Stack<StackTraceElement> filtered = new Stack<>();

        for (StackTraceElement element : stacktrace) {
            if (!filter.test(element)) {
                filtered.push(element);
            }
        }

        return filtered.toArray(new StackTraceElement[0]);
    }

}


text:
class Admin::TapePostsController < Admin::BaseController
  mongosteen

  def new
    TapeSubscriptionsService.new.fetch()
    render nothing: true
  end

end


text:
<title>ECMAScript v1 function object tests</title>

Netscape ECMAScript v1 function object tests

Done


text:
<?php

namespace Jimdo\Logbook\Web;

use PHPUnit\Framework\TestCase;
use Jimdo\Logbook\Web\View as View;

class ViewTest extends TestCase
{
    /**
     * @test
     */
    public function itShouldRenderGivenTemplates()
    {
        $view = new View('tests/Web/ViewFixture.php');
        $view->name = $expectedName = 'Horst';
        $view->content = $expectedContent = 'ABC';
        $expected = "test 123\n
$expectedName
\n
$expectedContent
\n
$expectedName
\n";
        $this->assertEquals($expected, $view->render());
    }
}


text:
package org.cruise.umple.eclipse.plugin.editors;

import org.eclipse.swt.graphics.RGB;

public interface IUMPColorConstants {
	RGB UMP_COMMENT = new RGB(0, 128, 0);
	RGB STRING = new RGB(0, 0, 255);
	RGB KEYWOED = new RGB(128, 0, 0);

	RGB DEFAULT = new RGB(0, 0, 0);
}


text:
class Marty::ImportTypeView < Marty::Grid
  has_marty_permissions \
    create: :admin,
    read: :any,
    update: :admin,
    delete: :admin

  def configure(c)
    super

    c.title   = I18n.t('import_type', default: 'ImportType')
    c.model   = 'Marty::ImportType'
    c.attributes =
      [
        :name,
        :role,
        :db_model_name,
        :cleaner_function,
        :validation_function,
        :preprocess_function,
      ]
    c.store_config.merge!(sorters: [{ property: :name, direction: 'ASC' }])
  end

  attribute :name do |c|
    c.flex = 1
  end

  attribute :role do |c|
    c.width = 150

    store = ::Marty::RoleType.get_all.sort

    c.editor_config = {
      multi_select: false,
      store:        store,
      type:         :string,
      xtype:        :combo,
    }
  end

  attribute :db_model_name do |c|
    c.flex = 1
  end

  attribute :cleaner_function do |c|
    c.flex = 1
  end

  attribute :validation_function do |c|
    c.flex = 1
  end

  attribute :preprocess_function do |c|
    c.flex = 1
  end
end

ImportTypeView = Marty::ImportTypeView


text:
import * as types from '../constants/actionTypes'

export function addTodo(text) {
  return { type: types.ADD_TODO, text }
}

export function completeTodo(id) {
  return { type: types.COMPLETE_TODO, id }
}


text:
<?php
namespace PMS\ProjectBundle\Entity\Repository;

use Gedmo\Sortable\Entity\Repository\SortableRepository;

class CategoryRepository extends SortableRepository
{
    public function findAllOrderedByUpdated()
    {
        return $this->getEntityManager()
                    ->createQuery('SELECT c FROM PMSProjectBundle:Category c ORDER BY c.updated ASC')
                    ->getResult();
    }
}


text:
export class HomeBase{

  name: string;
  description: string;

  applyEffect(userMage){
    console.log("Failed to Override");
  }

  removeEffect(userMage){
    console.log("Failed to Override");
  }
}


text:
package org.simpleflatmapper.csv.getter;

import org.simpleflatmapper.converter.Context;
import org.simpleflatmapper.csv.CsvRow;
import org.simpleflatmapper.csv.mapper.CsvRowGetterFactory;
import org.simpleflatmapper.map.getter.ContextualGetter;
import org.simpleflatmapper.map.getter.FloatContextualGetter;
import org.simpleflatmapper.map.getter.OptimizableIndexedContextualGetter;

public class CsvFloatGetter implements ContextualGetter<CsvRow, Float>, FloatContextualGetter<CsvRow>, OptimizableIndexedContextualGetter {
    public final int index;

    public CsvFloatGetter(int index) {
        this.index = index;
    }

    @Override
    public Float get(CsvRow target, Context context)  {
        return CsvFloatGetter.this.get(target, context, index);
    }

    public static Float get(CsvRow target, Context context, int index) {
        return target.getFloat(index);
    }

    @Override
    public float getFloat(CsvRow target, Context context)  {
        return getFloat(target, context, index);
    }

    public static float getFloat(CsvRow target, Context context, int index) {
        return target.getFloat(index);
    }
}


text:
/*** General Global Variable ***/
var rootURL = "/NDM/Builders/api/public";
/*** Login Part ***/
var indexURL = "/NDM/Builders";


text:
This project provides a [Noe](https://github.com/blambeau/noe) template for
creating a sinatra web application.

## Install

* You'll need Noe to use this template, see: https://github.com/blambeau/noe
* You'll also need bundler, see http://gembundler.com/
* Copy the whole folder in your noe skeleton folder (defaults to ~/.noe)

In other words

    [sudo] gem install noe bundler
    cp {this whole folder} ~/.noe

### Creating a ruby project

    # Prepare generation
    noe prepare --template=sinatra foo
    cd foo

    # Edit specific information about your project
    edit foo.noespec

    # Let Noe generate your project
    noe go

    # Install your ruby dependencies
    ./script/bootstrap


text:
efform_onload = function ()
{
  efbutton.setButtonStatus("F6", false);
  //efregion.show("ef_region_inqu");
  //efregion.toggleShow("ef_region_inqu");
}

button_f2_onclick = function ()
{
    if (efvalidateForm(ef.get("EDFA61"))) {
      efgrid.submitInqu( "ef_grid_result", "ed","EDFA61","query");
    }

}

button_f3_onclick = function ()
{
	efgrid.submitForm( "ef_grid_result", "ed","EDFA61","update",true );
}

button_f4_onclick = function ()
{
  	efgrid.submitForm( "ef_grid_result", "ed","EDFA61","delete", true );
}

button_f6_onclick = function ()
{
	efgrid.submitForm( "ef_grid_result", "ed","EDFA61","insert",true );
}

efgrid_onAddNewRow = function( grid_id )
{
  efbutton.setButtonStatus("F6", true);
  efbutton.setButtonStatus("F3", false);
  return true;
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Brython documentation</title>
<link rel="stylesheet" href="../doc_brython.css">


text:
require 'test_helper'

module Jigashira
  class RootControllerTest < ActionController::TestCase
    setup do
      @routes = Engine.routes
    end

    test "should get index" do
      get :index
      assert_response :success
    end

  end
end


text:
/*
 * File:   Texture.h
 * Author: Suyash Mohan
 *
 * Created on 3 May, 2014, 3:15 PM
 */

#ifndef TEXTURE_H
#define	TEXTURE_H

#include <SDL.h>
#include "Renderer.h"
#include "Typedefs.h"
#include <string>

namespace Sirius
{
    class Texture {
    public:
        Texture();
        Texture(RendererPtr renderer,std::string file);
        virtual ~Texture();
        void loadTexture(RendererPtr renderer,std::string file);
        void drawTexture(RendererPtr renderer, int x,int y);
    private:
        SDL_Texture *m_texture;
        int m_width;
        int m_height;
        std::string path;
    };
}

#endif	/* TEXTURE_H */


text:
//
//   Copyright 2016 Andrew Hunter
//
//   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.
//

//!
//! If a pattern needs to be matched against many different things, it can be prepared in order to generate an object that can
//! be used many times without the delay of generating a DFA.
//!
//! ```
//! # use concordance::*;
//! let match_abcs      = exactly("abc").prepare_to_match();
//! let match_many_abcs = exactly("abc").repeat_forever(1).prepare_to_match();
//!
//! if matches_prepared("abcabc", &match_many_abcs).is_some() { /* ... */ }
//! # assert!(matches_prepared("abcabc", &match_many_abcs).is_some());
//! ```
//!

use super::countable::*;
use super::symbol_range::*;
use super::state_machine::*;
use super::regular_pattern::*;
use super::symbol_range_dfa::*;
use super::dfa_compiler::*;

///
/// Can be applied to patterns and other objects in order to match them
///
pub trait PrepareToMatch<As> where As: Sized {
    fn prepare_to_match(self) -> As;
}

impl<'a, InputSymbol: Clone+Ord+Countable, OutputSymbol: Ord+Clone> PrepareToMatch<SymbolRangeDfa<InputSymbol, OutputSymbol>>
for Box<StateMachine<SymbolRange<InputSymbol>, OutputSymbol>+'a> {
    #[inline]
    fn prepare_to_match(self) -> SymbolRangeDfa<InputSymbol, OutputSymbol> {
        let builder       = SymbolRangeDfaBuilder::new();
        let state_machine = DfaCompiler::build(self, builder);

        state_machine
    }
}

impl<InputSymbol: Clone+Ord+Countable+'static> PrepareToMatch<SymbolRangeDfa<InputSymbol, ()>>
for Pattern<InputSymbol> {
    #[inline]
    fn prepare_to_match(self) -> SymbolRangeDfa<InputSymbol, ()> {
        let ndfa = self.to_ndfa(());

        ndfa.prepare_to_match()
    }
}

impl<'a, InputSymbol: Clone+Ord+Countable+'static> PrepareToMatch<SymbolRangeDfa<InputSymbol, ()>>
for &'a ToPattern<InputSymbol> {
    #[inline]
    fn prepare_to_match(self) -> SymbolRangeDfa<InputSymbol, ()> {
        let pattern = self.to_pattern();

        pattern.prepare_to_match()
    }
}

impl<InputSymbol: Clone+Ord+Countable, OutputSymbol> PrepareToMatch<SymbolRangeDfa<InputSymbol, OutputSymbol>> for SymbolRangeDfa<InputSymbol, OutputSymbol> {
    #[inline]
    fn prepare_to_match(self) -> SymbolRangeDfa<InputSymbol, OutputSymbol> {
        self
    }
}

impl<'a> PrepareToMatch<SymbolRangeDfa<char, ()>>
for &'a str {
    #[inline]
    fn prepare_to_match(self) -> SymbolRangeDfa<char, ()> {
        let pattern = self.to_pattern();

        pattern.prepare_to_match()
    }
}


text:
function fxp_num = fxp_add(aadd, badd, wl)
%
% Function to perform a fixed point addition out = a + b;
%
% Function: [fxp_num] = fxp_add(aadd,badd,wl)
%
% Where:
% aadd is fixed point input
% badd is fixed point input
% wl is fractional word lenght
%
% return result of summing the inputs
%
% Federal University of Amazonas
% May 15, 2017
% Manaus, Brazil

fxp_aadd= fxp_rounding(aadd,wl);
fxp_badd= fxp_rounding(badd,wl);

fxp_num = fxp_rounding(fxp_aadd + fxp_badd, wl);

end


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.apache.hadoop.lib.servlet (Apache Hadoop HttpFS 2.6.0-cdh5.4.2 API)</title>
<meta name="date" content="2015-05-19">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.apache.hadoop.lib.servlet

Class Summary

Class
Description

FileSystemReleaseFilter

The FileSystemReleaseFilter releases back to the
 FileSystemAccess service a FileSystem instance.

HostnameFilter

Filter that resolves the requester hostname.

MDCFilter

Filter that sets request contextual information for the slf4j MDC.

ServerWebApp

Server subclass that implements ServletContextListener
 and uses its lifecycle to start and stop the server.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2015 Apache Software Foundation. All Rights Reserved.


text:
/**
 *     This code was auto-generated by a Codezu.
 *
 *     Changes to this file may cause incorrect behavior and will be lost if
 *     the code is regenerated.
 */
package com.mozu.api.resources.commerce.customer.credits;

import com.mozu.api.ApiContext;
import java.util.List;
import java.util.ArrayList;
import com.mozu.api.MozuClient;
import com.mozu.api.MozuClientFactory;
import com.mozu.api.MozuUrl;
import com.mozu.api.Headers;
import org.joda.time.DateTime;
import com.mozu.api.AsyncCallback;
import java.util.concurrent.CountDownLatch;
import com.mozu.api.security.AuthTicket;
import org.apache.commons.lang.StringUtils;

/**
 * Use the Customer Credit Audit Entries subresource to retrieve entries logged in the audit report of a store credit or gift card applied to a customer account. The system creates a new audit entry when the credit is created, deleted, activated, or deactivated. The system then creates a new audit entry each time the credit is updated or redeemed in a transaction.
 *
 */
public class CreditAuditEntryResource {
	///
	/// <see cref="Mozu.Api.ApiContext"/>
	///
	private ApiContext _apiContext;

	public CreditAuditEntryResource(ApiContext apiContext)
	{
		_apiContext = apiContext;
	}

	/**
	 * Retrieves the list of audit entries for the credit, according to any filter or sort criteria specified in the request.
	 *

	 *	CreditAuditEntry creditauditentry = new CreditAuditEntry();
	 *	CreditAuditEntryCollection creditAuditEntryCollection = creditauditentry.getAuditEntries( code);
	 *

	 * @param code User-defined code that uniqely identifies the channel group.
	 * @return com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 * @see com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 */
	public com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(String code) throws Exception
	{
		return getAuditEntries( code,  null,  null,  null,  null,  null);
	}

	/**
	 * Retrieves the list of audit entries for the credit, according to any filter or sort criteria specified in the request.
	 *

	 *	CreditAuditEntry creditauditentry = new CreditAuditEntry();
	 *	CountDownLatch latch = creditauditentry.getAuditEntries( code, callback );
	 *	latch.await()	 *

	 * @param code User-defined code that uniqely identifies the channel group.
	 * @param  callback callback handler for asynchronous operations
	 * @return com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 * @see com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 */
	public CountDownLatch getAuditEntriesAsync(String code, AsyncCallback<com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection> callback) throws Exception
	{
		return getAuditEntriesAsync( code,  null,  null,  null,  null,  null, callback);
	}

	/**
	 * Retrieves the list of audit entries for the credit, according to any filter or sort criteria specified in the request.
	 *

	 *	CreditAuditEntry creditauditentry = new CreditAuditEntry();
	 *	CreditAuditEntryCollection creditAuditEntryCollection = creditauditentry.getAuditEntries( code,  startIndex,  pageSize,  sortBy,  filter,  responseFields);
	 *

	 * @param code User-defined code that uniqely identifies the channel group.
	 * @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
	 * @param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
	 * @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
	 * @return com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 * @see com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 */
	public com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception
	{
		MozuClient<com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection> client = com.mozu.api.clients.commerce.customer.credits.CreditAuditEntryClient.getAuditEntriesClient( code,  startIndex,  pageSize,  sortBy,  filter,  responseFields);
		client.setContext(_apiContext);
		client.executeRequest();
		return client.getResult();

	}

	/**
	 * Retrieves the list of audit entries for the credit, according to any filter or sort criteria specified in the request.
	 *

	 *	CreditAuditEntry creditauditentry = new CreditAuditEntry();
	 *	CountDownLatch latch = creditauditentry.getAuditEntries( code,  startIndex,  pageSize,  sortBy,  filter,  responseFields, callback );
	 *	latch.await()	 *

	 * @param code User-defined code that uniqely identifies the channel group.
	 * @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
	 * @param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
	 * @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
	 * @param  callback callback handler for asynchronous operations
	 * @return com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 * @see com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection
	 */
	public CountDownLatch getAuditEntriesAsync(String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, AsyncCallback<com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection> callback) throws Exception
	{
		MozuClient<com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection> client = com.mozu.api.clients.commerce.customer.credits.CreditAuditEntryClient.getAuditEntriesClient( code,  startIndex,  pageSize,  sortBy,  filter,  responseFields);
		client.setContext(_apiContext);
		return client.executeRequest(callback);

	}

}


text:
<?php

namespace KoolKode\View\Express\Komponent;

use KoolKode\Config\Configuration;
use KoolKode\Util\Filesystem;
use KoolKode\View\Express\ExpressViewFactory;

use Psr\Log\LoggerInterface;

/**
 * @author Martin Schröder
 */
class ExpressViewFactoryFactory
{
	protected $logger;

	public function __construct(LoggerInterface $logger = NULL)
	{
		$this->logger = $logger;
	}

	public function create(Configuration $config)
	{
		$cachePath = $config->getString('cachePath', NULL);
		$createFolder = $config->getBoolean('createFolder', false);

		if($cachePath !== NULL)
		{
			if(!is_dir($cachePath))
			{
				if(!$createFolder)
				{
					throw new \RuntimeException(sprintf('Cache directory not found: "%s"', $cachePath));
				}

				$cachePath = Filesystem::createDirectory($cachePath);
			}

			if(!is_readable($cachePath))
			{
				throw new \RuntimeException(sprintf('Cache directory not readable: "%s"', $cachePath));
			}

			if(!is_writable($cachePath))
			{
				throw new \RuntimeException(sprintf('Cache directory not writable: "%s"', $cachePath));
			}
		}

		return new ExpressViewFactory($cachePath, $this->logger);
	}
}


text:
<Title>Boost Graph Library: EventVisitor</Title>

EventVisitor Concept

This concept defines the interface for single-event visitors. An
EventVisitor has an apply member function (<tt>operator()</tt>) which
is invoked within the graph algorithm at the event-point specified by
the <tt>event_filter</tt> typedef within the
EventVisitor. EventVisitor's can be combined into an EventVistorList.

The following is the list of event tags that can be invoked in BGL
algorithms. Each tag corresponds to a member function of the visitor
for an algorithm. For example, the BFSVisitor of <tt>breadth_first_search()</tt>
has a <tt>cycle_edge()</tt> member function. The corresponding tag is
<tt>on_cycle_edge</tt>. The first argument is the event visitor's
<tt>operator()</tt> must be either an edge or vertex descriptor
depending on the event tag.

namespace boost {
  struct on_initialize_vertex { };
  struct on_start_vertex { };
  struct on_discover_vertex { };
  struct on_examine_edge { };
  struct on_tree_edge { };
  struct on_cycle_edge { };
  struct on_finish_vertex { };
  struct on_forward_or_cross_edge { };
  struct on_back_edge { };
  struct on_edge_relaxed { };
  struct on_edge_not_relaxed { };
  struct on_edge_minimized { };
  struct on_edge_not_minimized { };
} // namespace boost

Refinement of

Copy Constructible
(copying a visitor should be a lightweight operation).

Notation

<tt>G</tt>
A type that is a model of Graph.

<tt>g</tt>
An object of type <tt>G</tt>.

<tt>V</tt>
A type that is a model of EventVisitor.

<tt>vis</tt>
An object of type <tt>V</tt>.

<tt>x</tt>
An object of type
<tt>boost::graph_traits<G>::vertex_descriptor</tt>
or <tt>boost::graph_traits<G>::edge_descriptor</tt>.

Associated Types

Event Filter
<TT>V::event_filter</TT>

A tag struct to specify on which event the visitor should be invoked.

Valid Expressions

Name	Expression	Return Type	Description

Apply Visitor
<TT>vis(x, g)</TT>
<TT>void</TT>

Invokes the visitor operation on object <tt>x</tt>, which is
either a vertex or edge descriptor of the graph.

Models

<tt>predecessor_recorder</tt>

<tt>distance_recorder</tt>

<tt>time_stamper</tt>

<tt>property_writer</tt>

<tt>null_visitor</tt>

See Also

EventVisitorList,
Visitor concepts

Copyright © 2000-2001
Jeremy Siek,
Indiana University (jsiek@osl.iu.edu)

Lie-Quan Lee, Indiana University (llee@cs.indiana.edu)

Andrew Lumsdaine,
Indiana University (lums@osl.iu.edu)


text:
  color:#1a292b;
  height:30px;
  min-width:265px;
}
#pinion-backend .pinion-backend-renderer-SimpleRuleRenderer:after {
  content:".";
  display:block;
  clear:both;
  visibility:hidden;
  line-height:0;
  height:0;
}
#pinion-backend .pinion-backend-renderer-SimpleRuleRenderer .pinion-backend-icon-rule {
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-720px 0;
  width:15px;
  height:12px;
  position:absolute;
  top:9px;
  left:9px;
}
#pinion-backend .pinion-backend-renderer-SimpleRuleRenderer .rule-name {
  position:absolute;
  top:9px;
  left:30px;
  font-size:12px;
  font-weight:900;
}
#pinion-backend .pinion-backend-renderer-SimpleRuleRenderer.dirty .pinion-backend-icon-dirty {
  position:absolute;
  top:5px;
  right:5px;
}


text:
<?php

bx_import('BxDolModule');
$oModule = BxDolModule::getInstance('bx_antispam');
bx_import('DNSBlacklists', $oModule->_aModule);

/**
 * Test DNSURI black lists in Antispam module
 */
class BxAntispamDNSBlacklistsTest extends BxDolTestCase
{
    protected $_oDNSBlacklists;

    protected function setUp(): void
    {
        $oModule = BxDolModule::getInstance('bx_antispam');
        $this->_oDNSBlacklists = bx_instance('BxAntispamDNSBlacklists', array(), $oModule->_aModule);
    }

    protected function tearDown(): void
    {
        unset($this->_oDNSBlacklists);
    }

    public function providerForIsSpam()
    {
        // it is assumed that sbl.spamhaus.org. rule is enabled
        return array(
            array(BX_DOL_DNSBL_CHAIN_SPAMMERS, '127.0.0.1', BX_DOL_DNSBL_NEGATIVE), // 127.0.0.1 is always NOT listed
            array(BX_DOL_DNSBL_CHAIN_SPAMMERS, '127.0.0.2', BX_DOL_DNSBL_POSITIVE), // 127.0.0.2 is always listed
        );
    }

    /**
     * @dataProvider providerForIsSpam
     */
    public function test_dnsbl_lookup_ip($mixedChain, $sIp, $bRes)
    {
        if (!$this->isSpamhaus())
            $this->markTestSkipped('sbl.spamhaus.org is not enabled.');
        else
            $this->assertEquals($bRes, $this->_oDNSBlacklists->dnsbl_lookup_ip($mixedChain, $sIp));
    }

    protected function isSpamhaus()
    {
        $aRules = $this->_oDNSBlacklists->getRules(array(BX_DOL_DNSBL_CHAIN_SPAMMERS));
        foreach ($aRules as $aRule)
            if ('sbl.spamhaus.org.' == $aRule['zonedomain'])
                return true;
        return false;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Qr by @RomelSan</title>

    <link href="bootstrap-3.3.2-dist/css/bootstrap.min.css" rel="stylesheet">
	<link href="bootstrap-3.3.2-dist/css/bootstrap-theme.min.css" rel="stylesheet">
	<link href="footer.css" rel="stylesheet">

			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menu-principal">
			Toggle navigation

			</button>
			QR v0.1

Simple (current)

URL

Email

Wifi

Mecard

SMS

GeoLocation

Google Android App

		Lat
		<input id="Latitude" type="text" class="form-control" placeholder="" aria-describedby="basic-addon1" value="-1.7929665">

		Lon
		<input id="Longitude" type="text" class="form-control" placeholder="" aria-describedby="basic-addon1" value="-78.1368875">

		Alt
		<input id="Altitude" type="text" class="form-control" placeholder="" aria-describedby="basic-addon1" value="3000">

QR project by @RomelSan - 2015


text:
import cocos

from package.helper import ProjectHelper

class FrameworkAdd(cocos.CCPlugin):
    @staticmethod
    def plugin_name():
        return "add-framework"

    @staticmethod
    def brief_description():
        return "Adds a new framework to an existing project"

    # parse arguments
    def parse_args(self, argv):
        from argparse import ArgumentParser

        parser = ArgumentParser(prog="cocos %s" % self.__class__.plugin_name(),
                                description=self.__class__.brief_description())
        parser.add_argument("name", metavar="NAME", help="Specifies the package name")
        return parser.parse_args(argv)

    def run(self, argv):
        args = self.parse_args(argv)
        name = args.name

        project = ProjectHelper.get_current_project()
        ProjectHelper.add_framework(project, name)


text:
/**
**  @file tcScrollBar.cpp
*/
/*
**  Copyright (c) 2014, GCBLUE PROJECT
**  All rights reserved.
**
**  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
**
**  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
**
**  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
**     documentation and/or other materials provided with the distribution.
**
**  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from
**     this software without specific prior written permission.
**
**  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
**  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
**  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
**  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
**  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
**  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "stdwx.h" // precompiled header file

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "tcScrollBar.h"
#include "tcTime.h"
#include "tcTexture2D.h"
#include "wxcommands.h"
#include <iostream>

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

/**
* Drawing Graphics object is based on parent's window since
* button is sharing a surface with the parent.
* This also allows the button to draw outside of its wxWindow
* screen area.
*/
void tcScrollBar::Draw()
{
    if (!mbActive) return;
    //if ((!mbActive) || (barFraction > 1)) return;

    StartDraw();

	UpdateAutoScroll();

	float w = float(mnWidth);
	float h = float(mnHeight);

	//DrawRectangle(0, 0, w, h, Vec4(0, 0, 0, 1), FILL_ON);

	if (!overArrowUp)
	{
		DrawImageR(arrowUp.get(), 0, 0, w, w, ALIGN_BOTTOM_LEFT);
	}
	else
	{
		DrawImageR(arrowUpOver.get(), 0, 0, w, w, ALIGN_BOTTOM_LEFT);
	}

	if (!overArrowDown)
	{
		DrawImageR(arrowDown.get(), 0, h-w, w, w, ALIGN_BOTTOM_LEFT);
	}
	else
	{
		DrawImageR(arrowDownOver.get(), 0, h-w, w, w, ALIGN_BOTTOM_LEFT);
	}

	Vec4 barColor;

    if (!scrollDrag)
    {
		if (!overScrollBar)
		{
			barColor = Vec4(0.4f, 0.4f, 0.5f, backgroundAlpha);
		}
		else
		{
			barColor = Vec4(0.85f, 0.85f, 0.9f, backgroundAlpha);
		}
    }
    else
    {
        barColor = Vec4(1, 1, 1, backgroundAlpha);
    }

	Vec4 baseColor(0.3f, 0.3f, 0.4f, backgroundAlpha);

	//DrawRectangle(0, w, mnWidth, mnHeight-w, backgroundColor, FILL_ON);
	DrawRectangle(0, 0, w, h, baseColor, FILL_OFF);

	DrawLine(0, w, w, w, baseColor);

	DrawLine(0, h-w, w, h-w, baseColor);

	// draw scroll bar rectangle
	float barHeight = barFraction*(h - 2*w);
	barRect.Set(0, w, w+ybar, w+ybar+barHeight);

	buttonUpRect.Set(0, w, 0, w);
	buttonDownRect.Set(0, w, h-w, h);

	DrawRectangleR(barRect, barColor, FILL_ON);

	FinishDraw();
}

void tcScrollBar::LoadImages()
{
 //   arrowUp = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("up_arrow.png"));
	//arrowDown = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("down_arrow.png"));
	//arrowUpOver = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("up_arrow_over.png"));
	//arrowDownOver = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("down_arrow_over.png"));

    arrowUp = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("arrow_up.jpg"));
	arrowDown = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("arrow_down.jpg"));
	arrowUpOver = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("arrow_up_over.jpg"));
	arrowDownOver = boost::shared_ptr<tcTexture2D>(tc3DWindow2::LoadTexture("arrow_down_over.jpg"));

}

/**
*
*/
void tcScrollBar::OnEnterWindow(wxMouseEvent& event)
{
    isMouseOver = true;
}

/**
* Treat double click as single click
*/
void tcScrollBar::OnLButtonDClick(wxMouseEvent& event)
{
    OnLButtonDown(event);
}

/**
*
*/
void tcScrollBar::OnLButtonDown(wxMouseEvent& event)
{
    wxPoint pos = event.GetPosition();

	autoScrollIncrement = 0;

    leftButtonDown = true;

	if (barRect.ContainsPoint(pos.x, pos.y))
	{
		scrollDrag = true;
		scrollDragStart = pos;
		ybarStart = ybar;
		CaptureMouse();
	}
	else if ((buttonUpRect.ContainsPoint(pos.x, pos.y)) || (pos.y < (int)barRect.GetTop()))
	{
		UpdateYbar(ybar - clickScrollAmount);
		buttonDownTime = tcTime::Get()->Get30HzCount();
		autoScrollIncrement = -clickScrollAmount;
	}
	else if ((buttonDownRect.ContainsPoint(pos.x, pos.y)) || (pos.y > (int)barRect.GetBottom()))
	{
		UpdateYbar(ybar + clickScrollAmount);
		buttonDownTime = tcTime::Get()->Get30HzCount();
		autoScrollIncrement = clickScrollAmount;
	}

	SendRedrawMessage();
}

/**
*
*/
void tcScrollBar::OnLButtonUp(wxMouseEvent& event)
{
	if (scrollDrag)
	{
		ReleaseMouse();
	}

    leftButtonDown = false;
	scrollDrag = false;
	autoScrollIncrement = 0;
	autoScroll = false;

	SendRedrawMessage();
}

/**
*
*/
void tcScrollBar::OnLeaveWindow(wxMouseEvent& event)
{
	autoScrollIncrement = 0;
	autoScroll = false;

	overScrollBar = false;
	overArrowUp = false;
	overArrowDown = false;

	SendRedrawMessage();
}

/**
*
*/
void tcScrollBar::OnMouseMove(wxMouseEvent& event)
{
	wxPoint pos = event.GetPosition();

	overScrollBar = false;
	overArrowUp = false;
	overArrowDown = false;

	if (barRect.ContainsPoint(pos.x, pos.y))
	{
		overScrollBar = true;
	}
	else if (buttonUpRect.ContainsPoint(pos.x, pos.y))
	{
		overArrowUp = true;
	}
	else if (buttonDownRect.ContainsPoint(pos.x, pos.y))
	{
		overArrowDown = true;
	}

	if (scrollDrag)
	{
		float dy = float(pos.y - scrollDragStart.y);

		UpdateYbar(ybarStart + dy);
	}

	SendRedrawMessage();
}

void tcScrollBar::OnMouseWheel(wxMouseEvent& event)
{
    int zDelta = event.GetWheelRotation();

    if (zDelta > 0)
    {
        UpdateYbar(ybar - clickScrollAmount);
    }
    else if (zDelta < 0)
    {
        UpdateYbar(ybar + clickScrollAmount);
    }
}

void tcScrollBar::SendScrollbarUpdated()
{
	if (ybar == lastybar) return;
	lastybar = ybar;

    wxCommandEvent cmd(wxEVT_COMMAND_SCROLLBAR_UPDATED, 1);
    cmd.SetEventObject(this);

	if (scrollFromBottom)
	{
		float rectHeight = float(mnHeight) - 2*float(mnWidth);
		float barHeight = barFraction*rectHeight;

		//cmd.m_extraLong = long((rectHeight - barHeight - ybar)* 4.0f / barFraction * (float(mnHeight)/rectHeight)); // 2.6.3
        long extraLong = long((rectHeight - barHeight - ybar)* 4.0f / barFraction * (float(mnHeight)/rectHeight));
        if (extraLong < 0) extraLong = 0;
        cmd.SetExtraLong(extraLong);
	}
	else
	{
		float rectHeight = float(mnHeight) - 2*float(mnWidth);
		//cmd.m_extraLong = long(ybar * 4.0f / barFraction * (float(mnHeight)/rectHeight)); // 2.6.3
        cmd.SetExtraLong(long(ybar * 4.0f / barFraction * (float(mnHeight)/rectHeight)));
        // DEC 2011, max returned appears to be 4x ((1-barFract)/barFract) * scrollbar height (??)
	}

    AddPendingEvent(cmd);
}

void tcScrollBar::SetActive(bool abActive)
{
	if (barFraction >= 1.0)
	{
		tc3DWindow2::SetActive(false);
	}
	else
	{
		tc3DWindow2::SetActive(abActive);
	}
}

/**
*
*/
void tcScrollBar::SetBackgroundAlpha(float val)
{
    backgroundAlpha = val;
}

void tcScrollBar::SetBarFraction(float val)
{
	if (barFraction == val) return;

	float barFractionPrev = barFraction;

	barFraction = val;
	if (barFraction < 0.005f) barFraction = 0.005f;
	else if (barFraction > 1.0) barFraction = 1.0;

	SetActive(barFraction < 1.0);

	float ybar_adjust = 0;
	if (scrollFromBottom)
	{
		float rectHeight = float(mnHeight) - 2*float(mnWidth);
		ybar_adjust = (barFractionPrev - barFraction) * rectHeight;
	}

	UpdateYbar(ybar + ybar_adjust);

    clickScrollAmount = 0.07f * barFraction * float(mnHeight);
}

/**
* Does not send message
*/
void tcScrollBar::SetBarPosition(float scrollAmount, float showSize)
{
    float rectHeight = float(mnHeight) - 2*float(mnWidth);
	ybar = (scrollAmount / showSize) * barFraction * rectHeight;
}

void tcScrollBar::SendRedrawMessage()
{
	if (!sendRedraw) return;

	wxCommandEvent cmd(wxEVT_COMMAND_BUTTON_CLICKED, ID_BUTTONREDRAW);
    cmd.SetEventObject(this);

    AddPendingEvent(cmd);
}

void tcScrollBar::SetScrollFromBottom(bool state)
{
	scrollFromBottom = state;

	if (scrollFromBottom)
	{
		ybar = 99999.9f;
	}
	else
	{
		ybar = 0;
	}
}

void tcScrollBar::SetSendRedraw(bool state)
{
	sendRedraw = state;
}

/**
* Check if mouse button down long enough and
* periodically increment / decrement val if so
* Allows user to change value quickly by holding mouse
* button down.
*
* Similar to method in tcNumberWidget
* @see tcNumberWidget::UpdateAutoChange
*/
void tcScrollBar::UpdateAutoScroll()
{
	if (autoScrollIncrement == 0) return;

    unsigned currentTime = tcTime::Get()->Get30HzCount();

    if (currentTime - buttonDownTime > 20)
    {
        autoScroll = true;
    }

    if (autoScroll)
    {
        UpdateYbar(ybar + autoScrollIncrement);
    }
}

void tcScrollBar::UpdateYbar(float ynew)
{
	ybar = ynew;

	float ybarMax = (float(mnHeight) - float(2*mnWidth))*(1.0-barFraction);

	if (ybar < 0) ybar = 0;
	else if (ybar > ybarMax) ybar = ybarMax;

	SendScrollbarUpdated();
}

/**
*
*/
tcScrollBar::tcScrollBar(tc3DWindow2 *parent, const wxPoint& pos, const wxSize& size,
                   const wxString& name) :
    tc3DWindow2(parent, pos, size, name, parent),
    isMouseOver(false),
    leftButtonDown(false),
	overArrowUp(false),
	overArrowDown(false),
	overScrollBar(false),
	scrollDrag(false),
    backgroundAlpha(0.8f),
	barFraction(1.234f),
	ybar(0),
	lastybar(9999.9f),
	clickScrollAmount(2.0f),
    autoScroll(false),
    autoScrollIncrement(0),
	buttonDownTime(0),
	sendRedraw(false),
	scrollFromBottom(false),
	barRect(0, 0, 0, 0)
{
    LoadImages();

	SetBaseRenderBin(parent->GetBaseRenderBin() + 10);
	wxWindow::Raise();

	SetActive(false);
}

tcScrollBar::~tcScrollBar()
{
#ifdef _DEBUG
    fprintf(stdout, "Destroying tcScrollBar\n");
#endif
}


text:
import { Map as map } from 'immutable';

import reducer from '../reducer';
import { LOAD } from '../constants';

describe('reducer', () => {
    it('should do nothing for non LOAD actions', () => {
        const spy = sinon.spy();
        const oldState = {};
        const action = { type: 'SOMETHING', payload: {} };

        reducer(spy)(oldState, action);

        spy.should.have.been.calledWith(oldState, action);
    });

    it('should merge newState into oldState', () => {
        const spy = sinon.spy();
        const oldState = { x: 0, y: 0 };
        const action = { type: LOAD, payload: { y: 42 } };

        reducer(spy)(oldState, action);

        spy.should.have.been.calledWith({ x: 0, y: 42 }, action);
    });

    it('should use mergeDeep on immutable structs', () => {
        const spy = sinon.spy();
        const oldState = map({ x: 0, y: 0 });
        const action = { type: LOAD, payload: { y: 42 } };

        reducer(spy)(oldState, action);

        spy.should.have.been.calledWith(map({ x: 0, y: 42 }), action);
    });

    describe('issue #45 - arrays are converted to objects', () => {
        it('should not convert arrays to objects', () => {
            const spy = sinon.spy();
            const oldState = {};
            const action = { type: LOAD, payload: { arr: [1, 2] } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ arr: [1, 2] }, action);
        });

        it('should overwrite changed arrays', () => {
            const spy = sinon.spy();
            const oldState = { arr: [1, 2] };
            const action = { type: LOAD, payload: { arr: [3, 4] } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ arr: [3, 4] }, action);
        });
    });

    it('should use mergeDeep even if only newState is immutable', () => {
        const spy = sinon.spy();
        const oldState = { x: 0, y: 0 };
        const action = { type: LOAD, payload: map({ y: 42 }) };

        reducer(spy)(oldState, action);

        spy.should.have.been.calledWith(map({ x: 0, y: 42 }), action);
    });

    describe('issue #8 - ImmutableJS deprecated warnings', () => {
        it('should properly merge nested immutables', () => {
            const spy = sinon.spy();
            const oldState = { nested: map({ x: 42 }) };
            const action = { type: LOAD, payload: { nested: { x: 1337 } } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ nested: map({ x: 1337 }) }, action);
        });

        it('should properly merge nested immutables - switched sides', () => {
            const spy = sinon.spy();
            const oldState = { nested: { x: 42 } };
            const action = { type: LOAD, payload: { nested: map({ x: 1337 }) } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ nested: map({ x: 1337 }) }, action);
        });

        it('should properly merge nested non-immutable objects', () => {
            const spy = sinon.spy();
            const oldState = { nested: { x: 42 } };
            const action = { type: LOAD, payload: { nested: { x: 1337 } } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ nested: { x: 1337 } }, action);
        });

        it('should properly merge nested non-objects', () => {
            const spy = sinon.spy();
            const oldState = { x: 42 };
            const action = { type: LOAD, payload: { x: 1337 } };

            reducer(spy)(oldState, action);

            spy.should.have.been.calledWith({ x: 1337 }, action);
        });
    });
});


text:
title: One Way vs. Two Way Doors
category: life
layout: post
tags:
- life
- decision
---

Something I've been thinking about a lot recently is the concept of one way vs. two way doors. I first heard of this from one of Jeff Bezos's Amazon [shareholder letters](https://www.sec.gov/Archives/edgar/data/1018724/000119312516530910/d168744dex991.htm):

> Some decisions are consequential and irreversible or nearly irreversible – one-way doors – and these decisions must be made methodically, carefully, slowly, with great deliberation and consultation. If you walk through and don't like what you see on the other side, you can't get back to where you were before. We can call these Type 1 decisions. But most decisions aren't like that – they are changeable, reversible – they're two-way doors. If you've made a suboptimal Type 2 decision, you don't have to live with the consequences for that long. You can reopen the door and go back through. Type 2 decisions can and should be made quickly by high judgment individuals or small groups.

This simple idea makes a lot of sense. Basically don't rush into anything that can't be undone; and don't over deliberate what can be undone.

What isn't so simple is figuring out if a decision is a one way or a two way door. Unfortunately I don't have any great insight on how to tell the difference. But what I have found helpful is simply remembering to consider this framing before any serious decision helps avoid making obvious mistakes.


text:
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2;

/**
 * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2
 * @xmlType AddressLineType
 * @xmlName AddressLine
 * @var oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2\AddressLine
 */
class AddressLine extends AddressLineType
{
} // end class AddressLine


text:
<?php

namespace Anax\View;

/**
 * View to create a new book.
 */
// Show all incoming variables/functions
//var_dump(get_defined_functions());
//echo showEnvironment(get_defined_vars());

// Gather incoming variables and use default values if not set
$items = isset($items) ? $items : null;

// Create urls for navigation
$urlToViewItems = url("book");

?>
Skapa ett objekt

<?= $form ?>

    <a href="<?= $urlToViewItems ?>">Visa alla


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.purbon.pdfwriter.table.PDFTable (PDFWriter 0.2.3 API)</title>
<meta name="date" content="2014-04-15">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
com.purbon.pdfwriter.table.PDFTable

Packages that use PDFTable

Package
Description

com.purbon.pdfwriter

Basic PDF creation capabilities.

Uses of PDFTable in com.purbon.pdfwriter

Fields in com.purbon.pdfwriter declared as PDFTable

Modifier and Type
Field and Description

protected PDFTable<Float>
DefaultPDFWriter.table

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014. All rights reserved.


text:
/* Module dependencies */
var angularGenerator = require('../lib/angular-generator.js');

/* Functions */
var rangeArg          = angularGenerator.rangeArg;
var functionsFromPath = angularGenerator.functionsFromPath;

/* Tests */
describe('rangeArg(lengthArray)', function () {
	it('when 2 is passed should return ["arg0", "arg1"].', function () {
		expect(rangeArg(2)).toEqual(['arg0', 'arg1']);
	});

	it('when 0 is passed should return an empty.', function () {
		expect(rangeArg(0)).toEqual([]);
	})
});

describe('functionsFromPath(functionsPath)', function () {
	it('should work (it assumes that rangeArg works as it should).', function () {
		var requestsUrl = '/katia-requests-test';
		var expected = [
			{
				name : 'add',
				params : ['arg0', 'arg1'],
				requestsUrl : requestsUrl
			},
			{
				name : 'multiply',
				params : ['arg0', 'arg1'],
				requestsUrl : requestsUrl
			},
			{
				name : 'pi',
				params : [],
				requestsUrl : requestsUrl
			}
		];
		expect(functionsFromPath(__dirname + '/assets/functionsServerSide.js', requestsUrl)).toEqual(expected);
	});
});

describe('renderScript(functions) & makeFile(functionsPath)', function () {
	//Cannot be tested directly on the server. However, we can make tests on the rendered script on the client.
});


text:
package de.kopis.timeclicker.utils;

import java.util.Calendar;
import java.util.Date;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class WorkdayCalculatorTest {

  @Test
  public void testGetWorkingDaysBetweenTwoDates() throws Exception {
    final Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2015);
    cal.set(Calendar.MONTH, Calendar.DECEMBER);
    cal.set(Calendar.DAY_OF_MONTH, 14);
    // 2015-12-14
    final Date date1 = cal.getTime();
    cal.set(Calendar.DAY_OF_MONTH, 23);
    // 2015-12-23
    final Date date2 = cal.getTime();

    final int workdays = WorkdayCalculator.getWorkingDays(date1.toInstant(), date2.toInstant());
    assertEquals(8, workdays);
  }

  @Test
  public void testGetWorkingDaysOnFirstDayOfMonth() throws Exception {
    final Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2016);
    cal.set(Calendar.MONTH, Calendar.FEBRUARY);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    // 2016-02-01
    final Date date1 = cal.getTime();
    cal.set(Calendar.DAY_OF_MONTH, 1);
    // 2016-02-01
    final Date date2 = cal.getTime();

    final int workdays = WorkdayCalculator.getWorkingDays(date1.toInstant(), date2.toInstant());
    assertEquals(1, workdays);
  }

  @Test
  public void testGetWorkingDaysForSept2015() throws Exception {
    final Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2015);
    cal.set(Calendar.MONTH, Calendar.SEPTEMBER);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    // 2015-09-01
    final Date date1 = cal.getTime();
    // 2015-09-30
    cal.set(Calendar.DAY_OF_MONTH, 30);
    final Date date2 = cal.getTime();

    final int workdays = WorkdayCalculator.getWorkingDays(date1.toInstant(), date2.toInstant());
    assertEquals(22, workdays);
  }

  @Test
  public void testGetWorkingDaysForWeek() {
    //does not yet take into account holidays
    assertEquals(5, WorkdayCalculator.getWorkingDaysForCurrentWeek());
  }
}


text:
param (
  [switch]$AutoStart = $false
)

Write-Host "AutoStart: $AutoStart"

# setup openssh
$ssh_download_url = "http://www.mls-software.com/files/setupssh-7.3p1-2.exe"

if (!(Test-Path "C:\Program Files\OpenSSH\bin\ssh.exe")) {
    Write-Host "Downloading $ssh_download_url"
    (New-Object System.Net.WebClient).DownloadFile($ssh_download_url, "C:\Windows\Temp\openssh.exe")
    Start-Process "C:\Windows\Temp\openssh.exe" "/S /port=22 /privsep=1 /password=D@rj33l1ng" -NoNewWindow -Wait
}

Stop-Service "OpenSSHd" -Force

# ensure vagrant can log in
Write-Host "Setting vagrant user file permissions"
New-Item -ItemType Directory -Force -Path "C:\Users\vagrant\.ssh"
C:\Windows\System32\icacls.exe "C:\Users\vagrant" /grant "vagrant:(OI)(CI)F"
C:\Windows\System32\icacls.exe "C:\Program Files\OpenSSH\bin" /grant "vagrant:(OI)RX"
C:\Windows\System32\icacls.exe "C:\Program Files\OpenSSH\usr\sbin" /grant "vagrant:(OI)RX"

Write-Host "Setting SSH home directories"
    (Get-Content "C:\Program Files\OpenSSH\etc\passwd") |
    Foreach-Object { $_ -replace '/home/(\w+)', '/cygdrive/c/Users/$1' } |
    Set-Content 'C:\Program Files\OpenSSH\etc\passwd'

# disabled for vcloud to make vagrant-serverspec work
# Set shell to /bin/sh to return exit status
# $passwd_file = Get-Content 'C:\Program Files\OpenSSH\etc\passwd'
# $passwd_file = $passwd_file -replace '/bin/bash', '/bin/sh'
# Set-Content 'C:\Program Files\OpenSSH\etc\passwd' $passwd_file

# fix opensshd to not be strict
Write-Host "Setting OpenSSH to be non-strict"
$sshd_config = Get-Content "C:\Program Files\OpenSSH\etc\sshd_config"
$sshd_config = $sshd_config -replace 'StrictModes yes', 'StrictModes no'
$sshd_config = $sshd_config -replace '#PubkeyAuthentication yes', 'PubkeyAuthentication yes'
$sshd_config = $sshd_config -replace '#PermitUserEnvironment no', 'PermitUserEnvironment yes'
# disable the use of DNS to speed up the time it takes to establish a connection
$sshd_config = $sshd_config -replace '#UseDNS yes', 'UseDNS no'
# disable the login banner
$sshd_config = $sshd_config -replace 'Banner /etc/banner.txt', '#Banner /etc/banner.txt'
Set-Content "C:\Program Files\OpenSSH\etc\sshd_config" $sshd_config

Write-Host "Removing ed25519 key as Vagrant net-ssh 2.9.1 does not support it"
Remove-Item -Force -ErrorAction SilentlyContinue "C:\Program Files\OpenSSH\etc\ssh_host_ed25519_key"
Remove-Item -Force -ErrorAction SilentlyContinue "C:\Program Files\OpenSSH\etc\ssh_host_ed25519_key.pub"

# use c:\Windows\Temp as /tmp location
Write-Host "Setting temp directory location"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "C:\Program Files\OpenSSH\tmp"
C:\Program` Files\OpenSSH\bin\junction.exe /accepteula "C:\Program Files\OpenSSH\tmp" "C:\Windows\Temp"
C:\Windows\System32\icacls.exe "C:\Windows\Temp" /grant "vagrant:(OI)(CI)F"

# add 64 bit environment variables missing from SSH
Write-Host "Setting SSH environment"
$sshenv = "TEMP=C:\Windows\Temp"
if ($is_64bit) {
    $env_vars = "ProgramFiles(x86)=C:\Program Files (x86)", `
        "ProgramW6432=C:\Program Files", `
        "CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files", `
        "CommonProgramW6432=C:\Program Files\Common Files"
    $sshenv = $sshenv + "`r`n" + ($env_vars -join "`r`n")
}
Set-Content C:\Users\vagrant\.ssh\environment $sshenv

# record the path for provisioners (without the newline)
Write-Host "Recording PATH for provisioners"
Set-Content C:\Windows\Temp\PATH ([byte[]][char[]] $env:PATH) -Encoding Byte

# configure firewall
Write-Host "Configuring firewall"
netsh advfirewall firewall add rule name="SSHD" dir=in action=allow service=OpenSSHd enable=yes
netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="C:\Program Files\OpenSSH\usr\sbin\sshd.exe" enable=yes
netsh advfirewall firewall add rule name="ssh" dir=in action=allow protocol=TCP localport=22

if ($AutoStart -eq $true) {
    Start-Service "OpenSSHd"
}


text:
package gen

import (
	"path"
	"testing"

	"github.com/muka/go-bluetooth/gen/filters"
	"github.com/muka/go-bluetooth/gen/util"
	"github.com/stretchr/testify/assert"
)

func TestParse(t *testing.T) {
	api, err := Parse("../src/bluez/doc", []filters.Filter{}, false)
	if err != nil {
		t.Fatal(err)
	}
	assert.NotEmpty(t, api.Version)
	assert.NotEmpty(t, api.Api)
}

func TestSerialization(t *testing.T) {

	api, err := Parse("../src/bluez/doc", []filters.Filter{}, false)
	if err != nil {
		t.Fatal(err)
	}

	destDir := "../test/"
	jsonFile := path.Join(destDir, "test.json")

	err = util.Mkdir(destDir)
	if err != nil {
		t.Fatal(err)
	}

	err = api.Serialize(jsonFile)
	if err != nil {
		t.Fatal(err)
	}

	api1, err := LoadJSON(jsonFile)
	if err != nil {
		t.Fatal(err)
	}

	assert.Equal(t, api.Version, api1.Version)
}


text:
import d3 from 'd3'
import R from 'ramda'

function createBar(data) {
  // console.log(data)
  const playerA = data[0].batsman
  const playerB = data[1].batsman
  const runs = data.map(x => x.runs)
  const balls = data.map(x => x.balls)
  const fours = data.map(x => x.fours)
  const sixes = data.map(x => x.sixes)
  const boundaryRate = data.map(x => ((x.sixes + x.fours) / x.balls) * 100)

  const width = 400
  const height = 500
  const barHeight = 25

  let color = [
    'tomato',
    'steelblue'
  ]
//Title-------------------------------------------------------------------------
  const title = d3.select('.search-placeholder').append('div')
    .attr('class', 'search-title-block')
    title.append('h2')
    .text(playerA + ' vs ' + playerB)
    .attr('class', 'child')

    title.append('div')
      .attr('class', 'color-block')
      .style('background-color', color[0])
    title.append('p')
      .text(playerA)

      title.append('div')
        .attr('class', 'color-block')
        .style('background-color', color[1])
      title.append('p')
        .text(playerB)

//Runs--------------------------------------------------------------------------
  const runsHeader = d3.select('.search-placeholder').append('h3')
    .text('Runs')
    .attr('class', 'child')
  const runsContainer = d3.select('.search-placeholder').append('svg')
  .attr({
    'width': width,
    'height': barHeight * runs.length
  })
  .attr('class', 'child')

  const xRuns = d3.scale.linear()
    .domain([0, d3.max(runs)])
    .range([0, width]);

  const runsBar = runsContainer.selectAll('g')
    .data(runs)
    .enter().append('g')
    .attr("transform", (d, i) => "translate(0," + i * barHeight + ")")

    runsBar.append("rect")
    .attr("width", xRuns)
    .attr("height", barHeight - 1)
    .attr('class', 'child')
    .style('fill', (d, i) => color[i])

//Balls-------------------------------------------------------------------------
  const ballsHeader = d3.select('.search-placeholder').append('h3')
    .text('Balls Faced')
    .attr('class', 'child')

  const ballsContainer = d3.select('.search-placeholder').append('svg')
    .attr({
      'width': width,
      'height': barHeight * balls.length
    })
    .attr('class', 'child')

  const xBalls = d3.scale.linear()
    .domain([0, d3.max(balls)])
    .range([0, width]);

  const ballsBar = ballsContainer.selectAll('g')
    .data(balls)
    .enter().append('g')
    .attr("transform", (d, i) => "translate(0," + i * barHeight + ")")
    .attr('class', 'child')

    ballsBar.append("rect")
    .attr("width", xBalls)
    .attr("height", barHeight - 1)
    .style('fill', (d, i) => color[i])
    .attr('class', 'child')

//Fours--------------------------------------------------------------------------
  const foursHeader = d3.select('.search-placeholder').append('h3')
    .text('Fours')
    .attr('class', 'child')

  const foursContainer = d3.select('.search-placeholder').append('svg')
    .attr({
      'width': width,
      'height': barHeight * fours.length
    })
    .attr('class', 'child')

  const xFours = d3.scale.linear()
    .domain([0, d3.max(fours)])
    .range([0, width]);

  const foursBar = foursContainer.selectAll('g')
    .data(fours)
    .enter().append('g')
    .attr("transform", (d, i) => "translate(0," + i * barHeight + ")")
    .attr('class', 'child')

    foursBar.append("rect")
    .attr("width", xFours)
    .attr("height", barHeight - 1)
    .style('fill', (d, i) => color[i])
    .attr('class', 'child')

//Sixes--------------------------------------------------------------------------
  const sixesHeader = d3.select('.search-placeholder').append('h3')
  .text('Sixes')
  .attr('class', 'child')

  const sixesContainer = d3.select('.search-placeholder').append('svg')
    .attr({
      'width': width,
      'height': barHeight * sixes.length
    })
    .attr('class', 'child')

  const xSixes = d3.scale.linear()
    .domain([0, d3.max(sixes)])
    .range([0, width]);

  const sixesBar = sixesContainer.selectAll('g')
    .data(sixes)
    .enter().append('g')
    .attr("transform", (d, i) => "translate(0," + i * barHeight + ")")
    .attr('class', 'child')

    sixesBar.append("rect")
    .attr("width", xSixes)
    .attr("height", barHeight - 1)
    .style('fill', (d, i) => color[i])
    .attr('class', 'child')

//Boundary Rate--------------------------------------------------------------------------
  const brHeader = d3.select('.search-placeholder').append('h3')
    .text('Boundary Rate: ')
    .attr('class', 'child')

  const brContainer = d3.select('.search-placeholder').append('svg')
    .attr({
      'width': width,
      'height': barHeight * boundaryRate.length
    })
    .attr('class', 'child')

  const xBoundaryRate = d3.scale.linear()
    .domain([0, d3.max(boundaryRate)])
    .range([0, width]);

  const boundaryRateBar = brContainer.selectAll('g')
    .data(boundaryRate)
    .enter().append('g')
    .attr("transform", (d, i) => "translate(0," + i * barHeight + ")")
    .attr('class', 'child')

    boundaryRateBar.append("rect")
    .attr("width", xBoundaryRate)
    .attr("height", barHeight - 1)
    .style('fill', (d, i) => color[i])
    .attr('class', 'child')

//---------------------------------------------------------------------------------

}

export {
  createBar
}


text:
namespace xwalk {

TizenDataFetcherSharedMemory::TizenDataFetcherSharedMemory()
    : motion_buffer_(NULL),
      orientation_buffer_(NULL) {
}

TizenDataFetcherSharedMemory::~TizenDataFetcherSharedMemory() {
  Stop(content::CONSUMER_TYPE_MOTION);
  Stop(content::CONSUMER_TYPE_ORIENTATION);
}

void TizenDataFetcherSharedMemory::OnAccelerationChanged(
    float raw_x, float raw_y, float raw_z,
    float x, float y, float z) {
  if (!motion_buffer_)
    return;

  motion_buffer_->seqlock.WriteBegin();
  motion_buffer_->data.accelerationIncludingGravityX = raw_x;
  motion_buffer_->data.hasAccelerationIncludingGravityX = true;
  motion_buffer_->data.accelerationIncludingGravityY = raw_y;
  motion_buffer_->data.hasAccelerationIncludingGravityY = true;
  motion_buffer_->data.accelerationIncludingGravityZ = raw_z;
  motion_buffer_->data.hasAccelerationIncludingGravityZ = true;
  if (x != FP_NAN) {
    motion_buffer_->data.accelerationX = x;
    motion_buffer_->data.hasAccelerationX = true;
  }
  if (y != FP_NAN) {
    motion_buffer_->data.accelerationY = y;
    motion_buffer_->data.hasAccelerationY = true;
  }
  if (z != FP_NAN) {
    motion_buffer_->data.accelerationZ = z;
    motion_buffer_->data.hasAccelerationZ = true;
  }
  motion_buffer_->data.allAvailableSensorsAreActive = true;
  motion_buffer_->seqlock.WriteEnd();
}

void TizenDataFetcherSharedMemory::OnOrientationChanged(float alpha,
                                                        float beta,
                                                        float gamma) {
  if (!orientation_buffer_)
    return;

  orientation_buffer_->seqlock.WriteBegin();
  orientation_buffer_->data.alpha = alpha;
  orientation_buffer_->data.hasAlpha = true;
  orientation_buffer_->data.beta = beta;
  orientation_buffer_->data.hasBeta = true;
  orientation_buffer_->data.gamma = gamma;
  orientation_buffer_->data.hasGamma = true;
  orientation_buffer_->data.allAvailableSensorsAreActive = true;
  orientation_buffer_->seqlock.WriteEnd();
}

void TizenDataFetcherSharedMemory::OnRotationRateChanged(float alpha,
                                                         float beta,
                                                         float gamma) {
  if (!motion_buffer_)
    return;

  motion_buffer_->seqlock.WriteBegin();
  motion_buffer_->data.rotationRateAlpha = alpha;
  motion_buffer_->data.hasRotationRateAlpha = true;
  motion_buffer_->data.rotationRateBeta = beta;
  motion_buffer_->data.hasRotationRateBeta = true;
  motion_buffer_->data.rotationRateGamma = gamma;
  motion_buffer_->data.hasRotationRateGamma = true;
  motion_buffer_->data.allAvailableSensorsAreActive = true;
  motion_buffer_->seqlock.WriteEnd();
}

bool TizenDataFetcherSharedMemory::Start(content::ConsumerType type,
                                         void* buffer) {
  DCHECK(buffer);

  bool started = (motion_buffer_ || orientation_buffer_);
  switch (type) {
    case content::CONSUMER_TYPE_MOTION:
      motion_buffer_ =
          static_cast<content::DeviceMotionHardwareBuffer*>(buffer);
      break;
    case content::CONSUMER_TYPE_ORIENTATION:
      orientation_buffer_ =
          static_cast<content::DeviceOrientationHardwareBuffer*>(buffer);
      break;
    default:
      NOTREACHED();
      return false;
  }

  if (!started && SensorProvider::GetInstance()->connected())
    SensorProvider::GetInstance()->AddObserver(this);

  return true;
}

bool TizenDataFetcherSharedMemory::Stop(content::ConsumerType type) {
  switch (type) {
    case content::CONSUMER_TYPE_MOTION:
      if (motion_buffer_) {
        motion_buffer_->seqlock.WriteBegin();
        motion_buffer_->data.allAvailableSensorsAreActive = false;
        motion_buffer_->seqlock.WriteEnd();
        motion_buffer_ = NULL;
      }
      break;
    case content::CONSUMER_TYPE_ORIENTATION:
      if (orientation_buffer_) {
        orientation_buffer_->seqlock.WriteBegin();
        orientation_buffer_->data.allAvailableSensorsAreActive = false;
        orientation_buffer_->seqlock.WriteEnd();
        orientation_buffer_ = NULL;
      }
      break;
    default:
      NOTREACHED();
      return false;
  }

  if (!motion_buffer_ && !orientation_buffer_ &&
      SensorProvider::GetInstance()->connected())
    SensorProvider::GetInstance()->RemoveObserver(this);

  return true;
}

}  // namespace xwalk


text:
class AddRelationBetweenComponentAndAssetThroughAttachedComponents < ActiveRecord::Migration
  def change
    add_column :attached_components, :asset_id, :integer
    add_foreign_key :attached_components, :assets, on_delete: :cascade
    add_column :attached_components, :component_id, :integer
    add_foreign_key :attached_components, :components, on_delete: :cascade
  end
end


text:
var createHash = require('crypto').createHash;

function get_header(header, credentials, opts) {
  var type = header.split(' ')[0],
      user = credentials[0],
      pass = credentials[1];

  if (type == 'Digest') {
    return digest.generate(header, user, pass, opts.method, opts.path);
  } else if (type == 'Basic') {
    return basic(user, pass);
  }
}

////////////////////
// basic

function md5(string) {
  return createHash('md5').update(string).digest('hex');
}

function basic(user, pass) {
  var str  = typeof pass == 'undefined' ? user : [user, pass].join(':');
  return 'Basic ' + Buffer.from(str).toString('base64');
}

////////////////////
// digest
// logic inspired from https://github.com/simme/node-http-digest-client

var digest = {};

digest.parse_header = function(header) {
  var challenge = {},
      matches   = header.match(/([a-z0-9_-]+)="?([a-z0-9_=\/\.@\s-\+:)()]+)"?/gi);

  for (var i = 0, l = matches.length; i < l; i++) {
    var parts = matches[i].split('='),
        key   = parts.shift(),
        val   = parts.join('=').replace(/^"/, '').replace(/"$/, '');

    challenge[key] = val;
  }

  return challenge;
}

digest.update_nc = function(nc) {
  var max = 99999999;
  nc++;

  if (nc > max)
    nc = 1;

  var padding = new Array(8).join('0') + '';
  nc = nc + '';
  return padding.substr(0, 8 - nc.length) + nc;
}

digest.generate = function(header, user, pass, method, path) {

  var nc        = 1,
      cnonce    = null,
      challenge = digest.parse_header(header);

  var ha1  = md5(user + ':' + challenge.realm + ':' + pass),
      ha2  = md5(method.toUpperCase() + ':' + path),
      resp = [ha1, challenge.nonce];

  if (typeof challenge.qop === 'string') {
    cnonce = md5(Math.random().toString(36)).substr(0, 8);
    nc     = digest.update_nc(nc);
    resp   = resp.concat(nc, cnonce);
    resp   = resp.concat(challenge.qop, ha2);
  } else {
    resp   = resp.concat(ha2);
  }

  var params = {
    uri      : path,
    realm    : challenge.realm,
    nonce    : challenge.nonce,
    username : user,
    response : md5(resp.join(':'))
  }

  if (challenge.qop) {
    params.qop = challenge.qop;
  }

  if (challenge.opaque) {
    params.opaque = challenge.opaque;
  }

  if (cnonce) {
    params.nc = nc;
    params.cnonce = cnonce;
  }

  header = []
  for (var k in params)
    header.push(k + '="' + params[k] + '"')

  return 'Digest ' + header.join(', ');
}

module.exports = {
  header : get_header,
  basic  : basic,
  digest : digest.generate
}


text:
package raw;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.lfk.justwetools.View.CodeView.OnCodeChangedListener;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;

public class CodeView extends WebView{

    //常量表
    private final String STYLE_DIR = "file:///android_asset/";      //样式保存地址
    private final String JS_COMMAND_READ = "javascript:window.reader.read(document.body.innerText);";
    private final String JS_COMMAND_WRITE = "javascript:window.writer.write(document.body.innerText);";
    private final String JS_COMMAND_EDITABLE = "javascript:document.body.contentEditable = true;";
    private final String JS_COMMAND_UNEDITABLE = "javascript:document.body.contentEditable = false;";
    private final String JS_VAR_READ = "reader";
    private final String JS_VAR_WRITE = "writer";

    private boolean editEnable = false;

    private ProgressDialog progressDialog = null;
    private final JSContentReader reader = new JSContentReader();
    private final JSContentWriter writer = new JSContentWriter();
    private OnCodeChangedListener listener = null;
    private File codeFile = null;
    private Context context;

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////      CONSTRUCTOR     ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    public CodeView(Context context) {
        super(context);
        init(context);
    }

    public CodeView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public CodeView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    public CodeView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
        super(context, attrs, defStyle, privateBrowsing);
        init(context);
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////      INITIALIZE      ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    /**
     *  初始化,添加回调,以后只要运行reload就会自动执行回调
     */
    private void init(final Context context) {
        this.context = context;

        //初始化等待Dialog
        progressDialog = ProgressDialog.show(context, "请等待", "正在载入...", true);

        //初始化CodeView的样式
        this.setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);
        this.getSettings().setBuiltInZoomControls(true);
        this.getSettings().setDisplayZoomControls(false);
        this.getSettings().setJavaScriptEnabled(true);

        //给网页添加一个JS回调变量,名字叫"reader",通过loadURL载入JS命令执行回调
        this.addJavascriptInterface(reader, JS_VAR_READ);
        this.addJavascriptInterface(writer, JS_VAR_WRITE);
        this.setWebViewClient(new WebViewClient());
        this.setWebChromeClient(new WebChromeClient(){
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                if(newProgress >= 100 && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                }
            }
        });
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////        READER        ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    /**
     *  JS网页信息回调监听器。注意,4.2以后必须加 @JavascriptInterface 否则无法获取信息
     *  更新信息后写出到文件
     *  获取到信息后发送信息到Listener(如果存在)
     */
    class JSContentReader{
        @JavascriptInterface
        public void read(final String data){
            if(listener != null) {
                listener.onCodeChanged(data);
            }
        }
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////        WRITER        ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    class JSContentWriter {
        @JavascriptInterface
        public void write(final String data) {
            try {
                FileOutputStream out = new FileOutputStream(codeFile);
                out.write(data.getBytes());
                out.flush();
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            //激活Handler在主线程处理刷新事件
            handler.sendEmptyMessage(0);
        }
    }

    private Handler handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            setDirSource(codeFile);
        }
    };

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////        SOURCE        ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    /**
     *  设置文件源,以代码形式载入文件信息
     *
     *  @param dir   文件路径。注意,必须是路径形式。
     *               例:new File("dir/cache/source.java");
     *               错:new File("dir/cache/", "source.java");
     */
    public void setDirSource(File dir) {

        //先启动等待Dialog
        progressDialog.show();

        //更新文件对象
        this.codeFile = dir;
        String content = "";

        /////////////////
        //// Read File
        try {
            FileInputStream in = new FileInputStream(dir);
            ByteArrayOutputStream bufferOut = new ByteArrayOutputStream();

            byte[] buffer = new byte[1024];

            for(int i = in.read(buffer, 0, buffer.length); i > 0 ; i = in.read(buffer, 0, buffer.length)) {
                bufferOut.write(buffer, 0, i);
            }
            content = new String(bufferOut.toByteArray(), Charset.forName("utf-8"));

        } catch (IOException e) {
            e.printStackTrace();
        }

        /////////////////
        //// Load File
//        try {
//            Log.e("PATH----->", content);
//            this.loadUrl(dir.toURI().toURL().toString());
            this.loadDataWithBaseURL(STYLE_DIR, HTMLcode.HTMLHEAD + content + HTMLcode.HTMLTAIL, "text/html", null, null);
//        } catch (MalformedURLException e) {
//            e.printStackTrace();
//        }
    }

    public void requestContentReader(){
        loadUrl(JS_COMMAND_READ);
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////       EDITABLE       ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    /**
     * 通过JS修改代码域"可编辑"属性
     *
     * @param enable 使能状态    True for Editable       False for UnEditable
     *                          关闭编辑模式时存储改变后内容
     */
    public void setContentEditable(boolean enable){
        editEnable = enable;

        if(editEnable)
            this.loadUrl(JS_COMMAND_EDITABLE);
        else {
            this.loadUrl(JS_COMMAND_UNEDITABLE);
            this.loadUrl(JS_COMMAND_WRITE);
        }
    }

    public boolean isEditable() {
        return editEnable;
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////       LISTENER       ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    public void setListener(OnCodeChangedListener listener) {
        this.listener = listener;
    }

    /////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////         HTML         ///////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////

    public static class HTMLcode {
        public static String HTMLHEAD = "  " +
                "<link href=\"code.css\" rel=\"stylesheet\"> " +
                "" +
                " " +
                "
";

        public static String HTMLTAIL = "
";
    }

}


text:
package User::Identity::System;
use vars '$VERSION';
$VERSION = '0.92';
use base 'User::Identity::Item';

use strict;
use warnings;

use User::Identity;
use Scalar::Util 'weaken';

sub type { "network" }

sub init($)
{   my ($self, $args) = @_;

    $self->SUPER::init($args);
    exists $args->{$_} && ($self->{'UIS_'.$_} = delete $args->{$_})
        foreach qw/hostname location os password username/;

   $self->{UIS_hostname} ||= 'localhost';
   $self;
}

sub hostname() { shift->{UIS_hostname} }

sub username() { shift->{UIS_username} }

sub os() { shift->{UIS_os} }

sub password() { shift->{UIS_password} }

sub location()
{   my $self      = shift;
    my $location  = $self->{MI_location} or return;

    unless(ref $location)
    {   my $user  = $self->user or return;
        $location = $user->find(location => $location);
    }

    $location;
}

1;


text:
<?php

namespace PHPPdf;

use PHPPdf\Exception\BadMethodCallException;

/**
 * Class with generic util functions
 *
 * @author Piotr Śliwa <peter.pl7@gmail.com>
 */
final class Util
{
    private function __construct()
    {
        throw new BadMethodCallException(sprintf('Object of "%s" class can not be created.', __CLASS__));
    }

    public static function convertBooleanValue($value)
    {
        $knownValues = array('true' => true, 'false' => false, 1 => true, 0 => false, '1' => true, '0' => false, 'yes' => true, 'no' => false);

        return isset($knownValues[$value]) ? $knownValues[$value] : (boolean) $value;
    }

    /**
     * Converts angle value to radians.
     *
     * When value is "deg" suffixed, it means value is in degrees.
     *
     * @return float|null angle in radians or null
     */
    public static function convertAngleValue($value)
    {
        if($value !== null && strpos($value, 'deg') !== false)
        {
            $value = (float) $value;
            $value = deg2rad($value);
        }

        return $value !== null ? ((float) $value) : null;
    }

    public static function calculateDependantSizes($width, $height, $ratio)
    {
        if(!$width && $height)
        {
            $width = $ratio * $height;
        }

        if(!$height && $width)
        {
            $height = 1/$ratio * $width;
        }

        return array($width, $height);
    }
}


text:
cask "mactracker" do
  version "7.10.7"
  sha256 "7a9422796c0f8e9fad93768ae2016f62a1357d0a222a19d063a9f5fa9c59f942"

  url "https://www.mactracker.ca/downloads/Mactracker_#{version}.zip"
  name "Mactracker"
  desc "Detailed information on every Apple product ever made"
  homepage "https://mactracker.ca/"

  livecheck do
    url "https://update.mactracker.ca/appcast-b.xml"
    strategy :sparkle
  end

  auto_updates true

  app "Mactracker.app"

  zap trash: [
    "~/Library/Application Support/com.mactrackerapp.Mactracker",
    "~/Library/Caches/com.mactrackerapp.Mactracker",
    "~/Library/Preferences/com.mactrackerapp.Mactracker.plist",
    "~/Library/Saved Application State/com.mactrackerapp.Mactracker.savedState",
  ]
end


text:
             Add Widget
             Clear

{{ widget.name }}

                            <nvd3 options="widget.chart.options" data="widget.chart.data" api="widget.chart.api" config="config" events="events"></nvd3>


text:
package br.com.objectos.comuns.io.csv;

import static com.google.common.collect.Lists.transform;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;

import br.com.objectos.comuns.io.Entity;
import br.com.objectos.comuns.io.EntityToString;
import br.com.objectos.comuns.io.FakeEntities;
import br.com.objectos.comuns.io.LineEntityBuilder;
import br.com.objectos.core.collections.MoreCollectors;

import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * @author aline.heredia@objectos.com.br (Aline Heredia)
 */
public class CsvFileSemiTest {

  private List<Entity> entities;

  @BeforeClass
  public void setUp() throws URISyntaxException {
    URL url = Resources.getResource(getClass(), "/csv/SEMI.TXT");
    File file = new File(url.toURI());
    entities = CsvFile.parse(file)
        .skipFirstLines(1)
        .onSemicolons()
        .getLines()
        .stream()
        .map(line -> new LineEntityBuilder(line).build())
        .collect(MoreCollectors.toImmutableList());
  }

  @Test
  public void test() {
    List<Entity> fakes = ImmutableList.of(FakeEntities.LINE_1, FakeEntities.LINE_2);
    List<String> expected = transform(fakes, new EntityToString());

    List<String> res = transform(entities, new EntityToString());
    assertThat(res.size(), equalTo(2));
    assertThat(res, equalTo(expected));
  }

}


text:
#include "generator/affiliation.hpp"

#include "transit/world_feed/color_picker.hpp"
#include "transit/world_feed/subway_converter.hpp"
#include "transit/world_feed/world_feed.hpp"

#include "platform/platform.hpp"

#include "base/assert.hpp"
#include "base/file_name_utils.hpp"
#include "base/logging.hpp"
#include "base/timer.hpp"

#include "3party/gflags/src/gflags/gflags.h"

DEFINE_string(
    path_mapping, "",
    "Path to the mapping file of TransitId to GTFS hash for all transit entities except edges");
DEFINE_string(path_mapping_edges, "",
              "Path to the mapping file of TransitId to GTFS hash for edges");
// One of these two paths should be specified: |path_gtfs_feeds| and/or |path_subway_json|.
DEFINE_string(path_gtfs_feeds, "", "Directory with GTFS feeds subdirectories");
DEFINE_string(path_subway_json, "", "MAPS.ME json file with subway data from OSM");
DEFINE_string(path_json, "", "Output directory for dumping json files");
DEFINE_string(path_resources, "", "MAPS.ME resources directory");
DEFINE_string(start_feed, "", "Optional. Feed directory from which the process continues");
DEFINE_string(stop_feed, "", "Optional. Feed directory on which to stop the process");

// Finds subdirectories with feeds.
Platform::FilesList GetGtfsFeedsInDirectory(std::string const & path)
{
  Platform::FilesList res;
  Platform::TFilesWithType gtfsList;
  Platform::GetFilesByType(path, Platform::FILE_TYPE_DIRECTORY, gtfsList);

  for (auto const & item : gtfsList)
  {
    auto const & gtfsFeedDir = item.first;
    if (gtfsFeedDir != "." && gtfsFeedDir != "..")
      res.push_back(base::JoinPath(path, gtfsFeedDir));
  }

  return res;
}

// Handles the case when the directory consists of a single subdirectory with GTFS files.
void ExtendPath(std::string & path)
{
  Platform::TFilesWithType csvFiles;
  Platform::GetFilesByType(path, Platform::FILE_TYPE_REGULAR, csvFiles);
  if (!csvFiles.empty())
    return;

  Platform::TFilesWithType subdirs;
  Platform::GetFilesByType(path, Platform::FILE_TYPE_DIRECTORY, subdirs);

  // If there are more subdirectories then ".", ".." and directory with feed, the feed is most
  // likely corrupted.
  if (subdirs.size() > 3)
    return;

  for (auto const & item : subdirs)
  {
    auto const & subdir = item.first;
    if (subdir != "." && subdir != "..")
    {
      path = base::JoinPath(path, subdir);
      LOG(LDEBUG, ("Found subdirectory with feed", path));
      return;
    }
  }
}

bool SkipFeed(std::string const & feedPath, bool & pass)
{
  if (!FLAGS_start_feed.empty() && pass)
  {
    if (base::GetNameFromFullPath(feedPath) != FLAGS_start_feed)
      return true;
    pass = false;
  }
  return false;
}

bool StopOnFeed(std::string const & feedPath)
{
  if (!FLAGS_stop_feed.empty() && base::GetNameFromFullPath(feedPath) == FLAGS_stop_feed)
  {
    LOG(LINFO, ("Stop on", feedPath));
    return true;
  }
  return false;
}

enum class FeedStatus
{
  OK = 0,
  CORRUPTED,
  NO_SHAPES
};

FeedStatus ReadFeed(gtfs::Feed & feed)
{
  // First we read shapes. If there are no shapes in feed we do not need to read all the required
  // files - agencies, stops, etc.
  if (auto res = feed.read_shapes(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not get shapes.", res.message));
    return FeedStatus::NO_SHAPES;
  }

  if (feed.get_shapes().empty())
    return FeedStatus::NO_SHAPES;

  // We try to parse required for json files and return error in case of invalid file content.
  if (auto res = feed.read_agencies(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not parse agencies.", res.message));
    return FeedStatus::CORRUPTED;
  }

  if (auto res = feed.read_routes(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not parse routes.", res.message));
    return FeedStatus::CORRUPTED;
  }

  if (auto res = feed.read_trips(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not parse trips.", res.message));
    return FeedStatus::CORRUPTED;
  }

  if (auto res = feed.read_stops(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not parse stops.", res.message));
    return FeedStatus::CORRUPTED;
  }

  if (auto res = feed.read_stop_times(); res != gtfs::ResultCode::OK)
  {
    LOG(LWARNING, ("Could not parse stop times.", res.message));
    return FeedStatus::CORRUPTED;
  }

  // We try to parse optional for json files and do not return error in case of invalid file
  // content, only log warning message.
  if (auto res = feed.read_calendar(); gtfs::ErrorParsingOptionalFile(res))
    LOG(LINFO, ("Could not parse calendar.", res.message));

  if (auto res = feed.read_calendar_dates(); gtfs::ErrorParsingOptionalFile(res))
    LOG(LINFO, ("Could not parse calendar dates.", res.message));

  if (auto res = feed.read_frequencies(); gtfs::ErrorParsingOptionalFile(res))
    LOG(LINFO, ("Could not parse frequencies.", res.message));

  if (auto res = feed.read_transfers(); gtfs::ErrorParsingOptionalFile(res))
    LOG(LINFO, ("Could not parse transfers.", res.message));

  if (feed.read_feed_info() == gtfs::ResultCode::OK)
    LOG(LINFO, ("Feed info is present."));

  return FeedStatus::OK;
}

// Reads GTFS feeds from directories in |FLAGS_path_gtfs_feeds|. Converts each feed to the WorldFeed
// object and saves to the |FLAGS_path_json| path in the new transit line-by-line json format.
bool ConvertFeeds(transit::IdGenerator & generator, transit::IdGenerator & generatorEdges,
                  transit::ColorPicker & colorPicker,
                  feature::CountriesFilesAffiliation & mwmMatcher)
{
  auto const gtfsFeeds = GetGtfsFeedsInDirectory(FLAGS_path_gtfs_feeds);

  if (gtfsFeeds.empty())
  {
    LOG(LERROR, ("No subdirectories with GTFS feeds found in", FLAGS_path_gtfs_feeds));
    return false;
  }

  std::vector<std::string> invalidFeeds;

  size_t feedsWithNoShapesCount = 0;
  size_t feedsNotDumpedCount = 0;
  size_t feedsDumped = 0;
  size_t feedsTotal = gtfsFeeds.size();
  bool pass = true;

  for (size_t i = 0; i < gtfsFeeds.size(); ++i)
  {
    base::Timer feedTimer;
    auto feedPath = gtfsFeeds[i];

    if (SkipFeed(feedPath, pass))
    {
      ++feedsTotal;
      LOG(LINFO, ("Skipped", feedPath));
      continue;
    }

    bool stop = StopOnFeed(feedPath);
    if (stop)
      feedsTotal -= (gtfsFeeds.size() - i - 1);

    ExtendPath(feedPath);
    LOG(LINFO, ("Handling feed", feedPath));

    gtfs::Feed feed(feedPath);

    if (auto const res = ReadFeed(feed); res != FeedStatus::OK)
    {
      if (res == FeedStatus::NO_SHAPES)
        feedsWithNoShapesCount++;
      else
        invalidFeeds.push_back(feedPath);

      if (stop)
        break;
      continue;
    }

    transit::WorldFeed globalFeed(generator, generatorEdges, colorPicker, mwmMatcher);

    if (!globalFeed.SetFeed(std::move(feed)))
    {
      LOG(LINFO, ("Error transforming feed for json representation."));
      ++feedsNotDumpedCount;
      if (stop)
        break;
      continue;
    }

    bool const saved = globalFeed.Save(FLAGS_path_json, i == 0 /* overwrite */);
    if (saved)
      ++feedsDumped;
    else
      ++feedsNotDumpedCount;

    LOG(LINFO, ("Merged:", saved ? "yes" : "no", "time", feedTimer.ElapsedSeconds(), "s"));

    if (stop)
      break;
  }

  LOG(LINFO, ("Corrupted feeds paths:", invalidFeeds));
  LOG(LINFO, ("Corrupted feeds:", invalidFeeds.size(), "/", feedsTotal));
  LOG(LINFO, ("Feeds with no shapes:", feedsWithNoShapesCount, "/", feedsTotal));
  LOG(LINFO, ("Feeds parsed but not dumped:", feedsNotDumpedCount, "/", feedsTotal));
  LOG(LINFO, ("Total dumped feeds:", feedsDumped, "/", feedsTotal));

  return true;
}

// Reads subway json from |FLAGS_path_subway_json|, converts it to the WorldFeed object and saves
// to the |FLAGS_path_json| path in the new transit line-by-line json format.
bool ConvertSubway(transit::IdGenerator & generator, transit::IdGenerator & generatorEdges,
                   transit::ColorPicker & colorPicker,
                   feature::CountriesFilesAffiliation & mwmMatcher, bool overwrite)
{
  transit::WorldFeed globalFeed(generator, generatorEdges, colorPicker, mwmMatcher);
  transit::SubwayConverter converter(FLAGS_path_subway_json, globalFeed);

  if (!converter.Convert())
    return false;

  globalFeed.Save(FLAGS_path_json, overwrite);

  return true;
}

int main(int argc, char ** argv)
{
  google::SetUsageMessage("Reads GTFS feeds or subway transit.json, produces json with global ids for generator.");
  google::ParseCommandLineFlags(&argc, &argv, true);
  auto const toolName = base::GetNameFromFullPath(argv[0]);

  if (FLAGS_path_gtfs_feeds.empty() && FLAGS_path_subway_json.empty())
  {
    LOG(LWARNING, ("Path to GTFS feeds directory or path to the subways json must be specified."));
    google::ShowUsageWithFlagsRestrict(argv[0], toolName.c_str());
    return EXIT_FAILURE;
  }

  if (FLAGS_path_mapping.empty() || FLAGS_path_mapping_edges.empty() || FLAGS_path_json.empty())
  {
    LOG(LWARNING, ("Some of the required options are not present."));
    google::ShowUsageWithFlagsRestrict(argv[0], toolName.c_str());
    return EXIT_FAILURE;
  }

  if ((!FLAGS_path_gtfs_feeds.empty() && !Platform::IsDirectory(FLAGS_path_gtfs_feeds)) ||
      !Platform::IsDirectory(FLAGS_path_json) || !Platform::IsDirectory(FLAGS_path_resources) ||
      (!FLAGS_path_subway_json.empty() &&
       !Platform::IsFileExistsByFullPath(FLAGS_path_subway_json)))
  {
    LOG(LWARNING, ("Some paths set in options are not valid. Check the directories:",
                   FLAGS_path_gtfs_feeds, FLAGS_path_json, FLAGS_path_resources));
    google::ShowUsageWithFlagsRestrict(argv[0], toolName.c_str());
    return EXIT_FAILURE;
  }

  transit::IdGenerator generator(FLAGS_path_mapping);
  transit::IdGenerator generatorEdges(FLAGS_path_mapping_edges);

  GetPlatform().SetResourceDir(FLAGS_path_resources);
  transit::ColorPicker colorPicker;

  feature::CountriesFilesAffiliation mwmMatcher(GetPlatform().ResourcesDir(),
                                                false /* haveBordersForWholeWorld */);

  // We convert GTFS feeds to the json format suitable for generator_tool and save it to the
  // corresponding directory.
  if (!FLAGS_path_gtfs_feeds.empty() &&
      !ConvertFeeds(generator, generatorEdges, colorPicker, mwmMatcher))
    return EXIT_FAILURE;

  // We mixin data in our "old transit" (in fact subway-only) json format to the resulting files
  // in experimental line-by-line json format which is processed by generator_tool for building
  // experimental transit section. We use the same id |generator| so ids of subway and GTFS
  // itineraries will not conflict.
  if (!FLAGS_path_subway_json.empty() &&
      !ConvertSubway(generator, generatorEdges, colorPicker, mwmMatcher,
                     FLAGS_path_gtfs_feeds.empty() /* overwrite */))
  {
    return EXIT_FAILURE;
  }

  generator.Save();

  return EXIT_SUCCESS;
}


text:
use std::comm;
use std::os;
use std::task;
use std::uint;

fn child_generation(gens_left: uint, tx: comm::Sender<()>) {
    // This used to be O(n^2) in the number of generations that ever existed.
    // With this code, only as many generations are alive at a time as tasks
    // alive at a time,
    spawn(proc() {
        if gens_left & 1 == 1 {
            task::deschedule(); // shake things up a bit
        }
        if gens_left > 0 {
            child_generation(gens_left - 1, tx); // recurse
        } else {
            tx.send(())
        }
    });
}

fn main() {
    let args = os::args();
    let args = if os::getenv("RUST_BENCH").is_some() {
        vec!("".to_string(), "100000".to_string())
    } else if args.len() <= 1 {
        vec!("".to_string(), "100".to_string())
    } else {
        args.clone().move_iter().collect()
    };

    let (tx, rx) = channel();
    child_generation(from_str::<uint>(args.get(1).as_slice()).unwrap(), tx);
    if rx.recv_opt().is_err() {
        fail!("it happened when we slumbered");
    }
}


text:
<title>pca_lap :: Functions (Hytool Toolbox)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="hytool.css">

HYTOOL Function Reference

pca_lap

 PapadopulosCooper Function in Laplace domain in the aquifer.

Syntax

s = pca_lap( x, p)

    x(1) = Cd
    x(2) = dimensionless radius
    p = Laplace parameter

See Also

pca_dls

    Published output in the Help browser
       showdemo pca_lap

Hytool

© 1998-2017 Philppe Renard and Co.
<tt class="minicdot">•</tt> Terms of Use
<tt class="minicdot">•</tt> Acknowledgments


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <!-- Assuming whole width is 16dp defined in @dimen/viewpager_page_margin-->

  <item
      android:drawable="@color/viewpager_separator_background"
      android:width="@dimen/viewpager_page_margin"
      />

  <item android:width="4dp">
    <shape
        android:shape="rectangle">
      <gradient
          android:angle="0"
          android:endColor="#00000000"
          android:startColor="#A1A1A1"
          android:type="linear"/>
    </shape>
  </item>

  <item
      android:left="12dp"
      android:width="4dp">
    <shape
        android:shape="rectangle">
      <gradient
          android:angle="180"
          android:endColor="#00000000"
          android:startColor="#A1A1A1"
          android:type="linear"/>
    </shape>
  </item>

</layer-list>