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>
    <parent>
        <groupId>com.stratio.decision</groupId>
        <artifactId>stratio-decision</artifactId>
        <version>1.2.0-SNAPSHOT</version>
    </parent>
    <artifactId>shell</artifactId>
    <name>Decision shell</name>
    <packaging>jar</packaging>
    <properties>
        <spring.shell.version>1.1.0.RELEASE</spring.shell.version>
        <jar.mainclass>org.springframework.shell.Bootstrap</jar.mainclass>
        <outputFileName>stratio-decision-shell</outputFileName>
        <log4j.version>1.2.17</log4j.version>
        <junit.version>4.11</junit.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>16.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>${spring.shell.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit-dep</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.kubek2k</groupId>
            <artifactId>springockito</artifactId>
            <version>1.0.9</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.stratio.decision</groupId>
            <artifactId>api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.1</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>package</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>appassembler-maven-plugin</artifactId>
                        <version>1.8.1</version>
                        <configuration>
                            <configurationDirectory>config</configurationDirectory>
                            <copyConfigurationDirectory>true</copyConfigurationDirectory>
                            <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
                            <assembleDirectory>target/appassembler</assembleDirectory>
                            <extraJvmArguments>$SHELL_OPTS -Xms128m -Xmx128m</extraJvmArguments>
                            <programs>
                                <program>
                                    <mainClass>${jar.mainclass}</mainClass>
                                    <name>shell</name>
                                </program>
                            </programs>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>assemble</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>com.stratio.mojo.unix</groupId>
                        <artifactId>unix-maven-plugin</artifactId>
                        <version>1.2.0</version>
                        <extensions>true</extensions>
                        <inherited>false</inherited>
                        <configuration>
                            <outputFileName>stratio-decision-shell</outputFileName>
                            <contact>
                                <![CDATA[Stratio Decision<decision@stratio.com>]]>
                            </contact>
                            <contactEmail>decision@stratio.com</contactEmail>
                            <deb>

devel

                            </deb>
                            <rpm>
                                <group>stratio</group>
                                <requires>bash</requires>
                            </rpm>
                            <name>Decision Shell</name>
                            <excludeDirectoryAttributes>
                                <dir>/etc</dir>
                                <dir>/etc/init.d</dir>
                                <dir>/etc/default</dir>
                                <dir>/var</dir>
                                <dir>/var/run</dir>
                                <dir>/var/log</dir>
                                <dir>/opt</dir>
                                <dir>/usr</dir>
                                <dir>/bin</dir>
                            </excludeDirectoryAttributes>
                            <defaults>
                                <directoryAttributes>
                                    <user>decision</user>
                                    <group>stratio</group>
                                    <mode>0755</mode>
                                </directoryAttributes>
                                <fileAttributes>
                                    <user>decision</user>
                                    <group>stratio</group>
                                    <mode>0644</mode>
                                </fileAttributes>
                            </defaults>
                            <assembly>
                                <mkdirs>
                                    <path>/etc/sds</path>
                                    <attributes>
                                        <user>root</user>
                                        <group>stratio</group>
                                        <mode>0775</mode>
                                    </attributes>
                                </mkdirs>
                                <mkdirs>
                                    <path>/var/log/sds</path>
                                    <attributes>
                                        <user>root</user>
                                        <group>stratio</group>
                                        <mode>0775</mode>
                                    </attributes>
                                </mkdirs>
                                <mkdirs>
                                    <path>/opt/sds</path>
                                    <attributes>
                                        <user>root</user>
                                        <group>stratio</group>
                                        <mode>0775</mode>
                                    </attributes>
                                </mkdirs>
                                <mkdirs>
                                    <path>/opt/sds/decision-shell</path>
                                    <attributes>
                                        <user>decision</user>
                                        <group>stratio</group>
                                    </attributes>
                                </mkdirs>
                                <mkdirs>
                                    <path>/var/run/sds</path>
                                    <attributes>
                                        <user>root</user>
                                        <group>stratio</group>
                                        <mode>0775</mode>
                                    </attributes>
                                </mkdirs>
                                <copyDirectory>
                                    <from>target/appassembler/bin</from>
                                    <to>/opt/sds/decision-shell/bin</to>
                                </copyDirectory>
                                <copyDirectory>
                                    <from>target/appassembler/repo</from>
                                    <to>/opt/sds/decision-shell/repo</to>
                                </copyDirectory>
                                <copyDirectory>
                                    <from>target/appassembler/config/</from>
                                    <to>/opt/sds/decision-shell/config</to>
                                </copyDirectory>
                                <copyDirectory>
                                    <from>../examples/target/examples</from>
                                    <to>/opt/sds/decision-shell/examples</to>
                                    <directoryAttributes>
                                        <user>decision</user>
                                        <group>stratio</group>
                                    </directoryAttributes>
                                </copyDirectory>
                            </assembly>
                        </configuration>
                        <executions>
                            <execution>
                                <id>deb</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>package-deb</goal>
                                </goals>
                                <configuration>
                                    <architecture>all</architecture>
                                </configuration>
                            </execution>
                            <execution>
                                <id>rpm</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>package-rpm</goal>
                                </goals>
                                <configuration>
                                    <architecture>noarch</architecture>
                                </configuration>
                            </execution>
                            <execution>
                                <id>zip</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>package-zip</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

            </plugins>
            </build>
        </profile>
    </profiles>
</project>


text:
"""
Copyright 2015 Logvinenko Maksim

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.
"""

class typed_dict(dict):
    def __init__(self, key_type, value_type, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.key_type = key_type
        self.value_type = value_type

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;

namespace Cachacus.Tests {
	internal interface IPersonRepository {
		IEnumerable<Person> GetPeopleNamed(string name);
		Person GetPersonWithId(int id);
		IEnumerable<Person> GetAllPeople();
	}
}


text:
<img src="<?= $this->url->dir() ?>plugins/Sendgrid/sendgrid-icon.png"/> Sendgrid

    <input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->href('WebhookController', 'receiver', array('plugin' => 'sendgrid', 'token' => $values['webhook_token']), false, '', true) ?>">

    <?= $this->form->label(t('Sendgrid API key'), 'sendgrid_api_key') ?>
    <?= $this->form->password('sendgrid_api_key', $values) ?>

<?= t('Help on Sendgrid integration') ?>

        <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">


text:
@class ALAssetsFilter;

#define TSSizeValue(width,height) [NSValue valueWithCGSize:CGSizeMake(width,height)]

@interface TSSizePredicate : NSObject

+ (instancetype)matchSizes:(NSArray *)sizes;
+ (instancetype)matchSize:(CGSize)size;
+ (instancetype)matchSizeLessThan:(CGSize)size orEqual:(BOOL)equal;
+ (instancetype)matchSizeGreaterThan:(CGSize)size orEqual:(BOOL)equal;

- (BOOL)isSizeMatch:(CGSize)size;

@end


text:
sass-responsive
===============

A library of variables, mixins and formulas geared towards Responsive Web Design using Sass.

## Breakpoints

Breakpoints, coupled with media queries, are the crux of responsive web design.  Breakpoints are the points in your design where something changes, and those changes are made in CSS, along the lines of:

    @media only all and (max-width: 800px) {
        /* Your new CSS here */
    }

Setting your breakpoints as variables in one place keeps them organized and consistent throughout your CSS.

## Contexts

Fluid grids, another key aspect of responsive web design, rely on percentages, rather than fixed pixels, to denote horizontal measurement.  Yet, your web designers are likely to give you a Photoshop document where everything is in fixed, unchanging pixels.

Contexts are the variable in the equation:

    $percentage = $target / $context

So, for example, if you have a comp where the main column occupies 600 pixels of a total 960 pixel width, you would figure out the percentage by calculating something like:

    62.5% = 600px / 960px

where `960px` is the context. (We'll make actual functions you can use in Sass further down in this document.) Often you're using the same value over and over as the context for a variety of situations, so like the breakpoints, you can keep them all here for easy reference and better consistency.

## Mixins

### responsive

The main mixin that you'll use for most of your responsive Sass coding.  It can either be used outside of any other styling blocks, as such:

    $breakpoint: "max-width: 900px";

    @include responsive($breakpoint) {
        .some-selector {
            background-color: #FFFFFF;
            color: #000000;
        }
    }

**Output:**

    @media only all and (max-width: 900px) {
        .some-selector {
            background-color: #FFFFFF;
            color: #000000;
        }
    }

or inside a styling block, taking advantage of Sass' "[media query bubbling](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#media)," like so:

    $breakpoint: "max-width: 900px";

    .some-selector {
        float: left;

        @include responsive($breakpoint) {
            float: none;
        }
    }

**Output:**

    .some-selector {
        float: left;
    }

    @media only all and (max-width: 900px) {
        .some-selector {
            float: none;
        }
    }

### hidpi

HiDPI displays (you might know this better as Retina displays) are the high pixel density displays found in devices such as the iPhone 5.  When using background images, you can specify a larger image file, then shrink it down using the `background-sizing` property, to achieve crisper looking graphics than you would get with standard graphics.  To easily facilitate this, use the `hidpi` mixin like so:

    .some-selector {
        background-image: bg.png;

        @include hidpi {
            background-image: bg@2x.png;
            background-size: 50% auto;
        }
    }

**Output:**

    .some-selector {
        background-image: bg.png;
    }

    @media only all and (-webkit-min-device-pixel-ratio: 1.3),
		only all and (min--moz-device-pixel-ratio: 1.3),
		only all and (-o-min-device-pixel-ratio: 1.3/1),
		only all and (min-device-pixel-ratio: 1.3),
		only all and (min-resolution: 1.3dppx) {

        .some-selector {
		    background-image: bg@2x.png;
		    background-size: 50% auto;
		}
	}

### retina

If you prefer to use the Apple proprietary term "retina," I've made it an alias to the hidpi mixin, and it is used the same way.

### rem

Fixed pixels are bad! Relative rems are good! But some browsers (ahem, IE<9) don't understand rems. So if you have to support such ancient technology, but still want to use rems, use this mixin to return the same property in _both_ pixel and rem formats.

    .some-selector {
        @include rem(font-size, 13px);
    }

**Output:**

    .some-selector {
        font-size: 13px;
        font-size: 0.8125rem;
    }

_(assuming a default font size of 16px)_

Note: this will not work for properties that take multiple values, such as the padding shorthand, for example. For that, you would need to explicitly state a pixel version, followed by a rem version:

    .some-selector {
        padding: 16px 0 32px 0;
        padding: cr(16px) 0 cr(32px) 0;
    }

**Output:**

    .some-selector {
        padding: 16px 0 32px 0;
        padding: 1rem 0 2rem 0;
    }

_(assuming a default font size of 16px)_

## Functions

### calc-rem()

A way to calculate `rem` (relative em units), based on a context. I've set the default context to be a default font size, specified as 16px, and since most often you are going to use the font size set on the `<HTML>` element, you are unlikely to ever need to add the context to this particular function.

To change your default font size, set the variable $default-font-size elsewhere in your Sass stylesheets.

### cr()

Simply a shorthand alias for calc-rem(), used exactly the same way.

### calc-percent()

The same basic function as calc-rem(), but for percentages instead. This is used mainly in horizontal measurements.  Unlike calc-rem(), you will always need to specify a context.  As illustrated above, you can set a variety of often-used $context variables above to make your site more consistent.

### cp()

A shorthand alias for calc-percent().

### hidpi-sprite-adjustment

When using Sass & Compass to generate sprites, there are issues with calculating the position of the HiDPI sprites. See http://blog.teamtreehouse.com/?p=20925 (I'll update this documentation when I get a chance to later.)  This function makes the necessary adjustment for you.

### retina-sprite-adjustment

For those who prefer the term "retina" over "hidpi".


text:
[:version, :string, :hash, :new, :install, :reflect, :helpers].each { |lib| require "mirror-db/#{lib}" }

module MirrorDB
  # If true the mirror wont generate custom fk,pk & table references
  @rails_pattern

  def rails_pattern
    @rails_pattern
  end

  def rails_pattern=rails_pattern
    @rails_pattern=rails_pattern
  end
end


text:
#ifndef DB_UTILS_HPP_
#define DB_UTILS_HPP_

#include "common/common.hpp"
#include "codec.hpp"
#include "context.hpp"
#include "thread/thread_local.hpp"
#include "thread/thread_mutex_lock.hpp"
#include "thread/spin_rwlock.hpp"
#include "thread/thread_mutex_lock.hpp"
#include "thread/event_condition.hpp"
#include "util/concurrent_queue.hpp"

#define ENGINE_ERR(err)  (kEngineNotFound == err ? ERR_ENTRY_NOT_EXIST:(0 == err ? 0 :(err + STORAGE_ENGINE_ERR_OFFSET)))
#define ENGINE_NERR(err)  (kEngineNotFound == err ? 0:(0 == err ? 0 :(err + STORAGE_ENGINE_ERR_OFFSET)))

OP_NAMESPACE_BEGIN

    struct DBLocalContext
    {
            Buffer encode_buffer_cache;
            std::string string_cache;
            Buffer& GetEncodeBufferCache();
            Slice GetSlice(const KeyObject& key);
            void GetSlices(const KeyObject& key, const ValueObject& val, Slice ss[2]);
            std::string& GetStringCache()
            {
                string_cache.clear();
                return string_cache;
            }
            virtual ~DBLocalContext()
            {
            }
    };

    /*
     *  A multi thread db writer, which could do db write operations by several threads to increase
     *  write performance.
     *  It's used in loading snapshot.
     */
    class DBWriterWorker;
    class DBWriter
    {
        private:
            std::vector<DBWriterWorker*> m_workers;
            ThreadMutexLock m_queue_lock;
            std::deque<RedisCommandFrame*> m_queue;
            void Enqueue(RedisCommandFrame& cmd);
            RedisCommandFrame* Dequeue(int timeout);
            friend class DBWriterWorker;
        public:
            DBWriter();
            void Init(int workers);
            int Put(Context& ctx, const Data& ns, const Slice& key, const Slice& value);
            int Put(Context& ctx, const KeyObject& k, const ValueObject& value);
            int Put(Context& ctx,RedisCommandFrame& cmd);
            void SetNamespace(Context& ctx, const std::string& ns);
            void SetDefaulFlags(CallFlags flags);
            void SetMasterClient(Context& ctx);
            int64 QueueSize();
            void Stop();
            void Clear();
            ~DBWriter();
    };

OP_NAMESPACE_END

#endif /* SRC_DB_DB_UTILS_HPP_ */


text:
from __future__ import print_function
import sys
import unittest
from fontParts.test import test_normalizers
from fontParts.test import test_font
from fontParts.test import test_info
from fontParts.test import test_groups
from fontParts.test import test_kerning
from fontParts.test import test_features
from fontParts.test import test_layer
from fontParts.test import test_glyph
from fontParts.test import test_contour
from fontParts.test import test_segment
from fontParts.test import test_bPoint
from fontParts.test import test_point
from fontParts.test import test_component
from fontParts.test import test_anchor
from fontParts.test import test_image
from fontParts.test import test_lib
from fontParts.test import test_guideline
from fontParts.test import test_deprecated
from fontParts.test import test_color
from fontParts.test import test_world

def testEnvironment(objectGenerator, inApp=False, verbosity=1):
    modules = [
        test_normalizers,
        test_font,
        test_info,
        test_groups,
        test_kerning,
        test_features,
        test_layer,
        test_glyph,
        test_contour,
        test_segment,
        test_bPoint,
        test_point,
        test_component,
        test_anchor,
        test_image,
        test_lib,
        test_guideline,
        test_deprecated,
        test_color,
        test_world
    ]
    globalSuite = unittest.TestSuite()
    loader = unittest.TestLoader()
    for module in modules:
        suite = loader.loadTestsFromModule(module)
        _setObjectGenerator(suite, objectGenerator)
        globalSuite.addTest(suite)
    runner = unittest.TextTestRunner(verbosity=verbosity)
    succes = runner.run(globalSuite).wasSuccessful()
    if not inApp:
        sys.exit(not succes)
    else:
        return succes  # pragma: no cover

def _setObjectGenerator(suite, objectGenerator):
    for i in suite:
        if isinstance(i, unittest.TestSuite):
            _setObjectGenerator(i, objectGenerator)
        else:
            i.objectGenerator = objectGenerator


text:
import expect from 'expect';
import { put, call } from 'redux-saga/effects';

import { handleForgotPasswordRequest } from '../sagas';
import { sendingRequest } from '../../RequestHandler/actions';
import { forgotPasswordRequestSent } from '../actions';

import { postRequest } from '../../../utils/request';

describe('handleForgotPasswordRequest Saga', () => {
  const email = 'test@mail.com';

  const params = {
    email,
  };

  const body = {
    data: {
      type: 'reset-password-token',
      attributes: {
        email,
      },
    },
  };

  const generator = handleForgotPasswordRequest(params);

  it('sends a sending request action', () => {
    const descriptor = generator.next();
    expect(descriptor.value).toEqual(put(sendingRequest(true)));
  });

  it('calls the forgot password route', () => {
    const descriptor = generator.next();
    expect(descriptor.value).toEqual(call(postRequest, '/forgot_password', body));
  });

  it('tells that the forgot password request was sent', () => {
    const descriptor = generator.next();
    expect(descriptor.value).toEqual(put(forgotPasswordRequestSent(email)));
  });
});


text:
package com.microsoft.azure.batch.protocol.models;

import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Information about an Azure Batch subtask.
 */
public class SubtaskInformation {
    /**
     * The ID of the subtask.
     */
    @JsonProperty(value = "id")
    private Integer id;

    /**
     * Information about the Compute Node on which the subtask ran.
     */
    @JsonProperty(value = "nodeInfo")
    private ComputeNodeInformation nodeInfo;

    /**
     * The time at which the subtask started running. If the subtask has been
     * restarted or retried, this is the most recent time at which the subtask
     * started running.
     */
    @JsonProperty(value = "startTime")
    private DateTime startTime;

    /**
     * The time at which the subtask completed.
     * This property is set only if the subtask is in the Completed state.
     */
    @JsonProperty(value = "endTime")
    private DateTime endTime;

    /**
     * The exit code of the program specified on the subtask command line.
     * This property is set only if the subtask is in the completed state. In
     * general, the exit code for a process reflects the specific convention
     * implemented by the application developer for that process. If you use
     * the exit code value to make decisions in your code, be sure that you
     * know the exit code convention used by the application process. However,
     * if the Batch service terminates the subtask (due to timeout, or user
     * termination via the API) you may see an operating system-defined exit
     * code.
     */
    @JsonProperty(value = "exitCode")
    private Integer exitCode;

    /**
     * Information about the container under which the Task is executing.
     * This property is set only if the Task runs in a container context.
     */
    @JsonProperty(value = "containerInfo")
    private TaskContainerExecutionInformation containerInfo;

    /**
     * Information describing the Task failure, if any.
     * This property is set only if the Task is in the completed state and
     * encountered a failure.
     */
    @JsonProperty(value = "failureInfo")
    private TaskFailureInformation failureInfo;

    /**
     * The current state of the subtask.
     * Possible values include: 'preparing', 'running', 'completed'.
     */
    @JsonProperty(value = "state")
    private SubtaskState state;

    /**
     * The time at which the subtask entered its current state.
     */
    @JsonProperty(value = "stateTransitionTime")
    private DateTime stateTransitionTime;

    /**
     * The previous state of the subtask.
     * This property is not set if the subtask is in its initial running state.
     * Possible values include: 'preparing', 'running', 'completed'.
     */
    @JsonProperty(value = "previousState")
    private SubtaskState previousState;

    /**
     * The time at which the subtask entered its previous state.
     * This property is not set if the subtask is in its initial running state.
     */
    @JsonProperty(value = "previousStateTransitionTime")
    private DateTime previousStateTransitionTime;

    /**
     * The result of the Task execution.
     * If the value is 'failed', then the details of the failure can be found
     * in the failureInfo property. Possible values include: 'success',
     * 'failure'.
     */
    @JsonProperty(value = "result")
    private TaskExecutionResult result;

    /**
     * Get the id value.
     *
     * @return the id value
     */
    public Integer id() {
        return this.id;
    }

    /**
     * Set the id value.
     *
     * @param id the id value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withId(Integer id) {
        this.id = id;
        return this;
    }

    /**
     * Get the nodeInfo value.
     *
     * @return the nodeInfo value
     */
    public ComputeNodeInformation nodeInfo() {
        return this.nodeInfo;
    }

    /**
     * Set the nodeInfo value.
     *
     * @param nodeInfo the nodeInfo value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withNodeInfo(ComputeNodeInformation nodeInfo) {
        this.nodeInfo = nodeInfo;
        return this;
    }

    /**
     * Get the startTime value.
     *
     * @return the startTime value
     */
    public DateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime value.
     *
     * @param startTime the startTime value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withStartTime(DateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get this property is set only if the subtask is in the Completed state.
     *
     * @return the endTime value
     */
    public DateTime endTime() {
        return this.endTime;
    }

    /**
     * Set this property is set only if the subtask is in the Completed state.
     *
     * @param endTime the endTime value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withEndTime(DateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get this property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code.
     *
     * @return the exitCode value
     */
    public Integer exitCode() {
        return this.exitCode;
    }

    /**
     * Set this property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code.
     *
     * @param exitCode the exitCode value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withExitCode(Integer exitCode) {
        this.exitCode = exitCode;
        return this;
    }

    /**
     * Get this property is set only if the Task runs in a container context.
     *
     * @return the containerInfo value
     */
    public TaskContainerExecutionInformation containerInfo() {
        return this.containerInfo;
    }

    /**
     * Set this property is set only if the Task runs in a container context.
     *
     * @param containerInfo the containerInfo value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) {
        this.containerInfo = containerInfo;
        return this;
    }

    /**
     * Get this property is set only if the Task is in the completed state and encountered a failure.
     *
     * @return the failureInfo value
     */
    public TaskFailureInformation failureInfo() {
        return this.failureInfo;
    }

    /**
     * Set this property is set only if the Task is in the completed state and encountered a failure.
     *
     * @param failureInfo the failureInfo value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withFailureInfo(TaskFailureInformation failureInfo) {
        this.failureInfo = failureInfo;
        return this;
    }

    /**
     * Get possible values include: 'preparing', 'running', 'completed'.
     *
     * @return the state value
     */
    public SubtaskState state() {
        return this.state;
    }

    /**
     * Set possible values include: 'preparing', 'running', 'completed'.
     *
     * @param state the state value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withState(SubtaskState state) {
        this.state = state;
        return this;
    }

    /**
     * Get the stateTransitionTime value.
     *
     * @return the stateTransitionTime value
     */
    public DateTime stateTransitionTime() {
        return this.stateTransitionTime;
    }

    /**
     * Set the stateTransitionTime value.
     *
     * @param stateTransitionTime the stateTransitionTime value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withStateTransitionTime(DateTime stateTransitionTime) {
        this.stateTransitionTime = stateTransitionTime;
        return this;
    }

    /**
     * Get this property is not set if the subtask is in its initial running state. Possible values include: 'preparing', 'running', 'completed'.
     *
     * @return the previousState value
     */
    public SubtaskState previousState() {
        return this.previousState;
    }

    /**
     * Set this property is not set if the subtask is in its initial running state. Possible values include: 'preparing', 'running', 'completed'.
     *
     * @param previousState the previousState value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withPreviousState(SubtaskState previousState) {
        this.previousState = previousState;
        return this;
    }

    /**
     * Get this property is not set if the subtask is in its initial running state.
     *
     * @return the previousStateTransitionTime value
     */
    public DateTime previousStateTransitionTime() {
        return this.previousStateTransitionTime;
    }

    /**
     * Set this property is not set if the subtask is in its initial running state.
     *
     * @param previousStateTransitionTime the previousStateTransitionTime value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withPreviousStateTransitionTime(DateTime previousStateTransitionTime) {
        this.previousStateTransitionTime = previousStateTransitionTime;
        return this;
    }

    /**
     * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'.
     *
     * @return the result value
     */
    public TaskExecutionResult result() {
        return this.result;
    }

    /**
     * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'.
     *
     * @param result the result value to set
     * @return the SubtaskInformation object itself.
     */
    public SubtaskInformation withResult(TaskExecutionResult result) {
        this.result = result;
        return this;
    }

}


text:
package net.clanwolf.c3.client.gui.panes.map;

import net.clanwolf.c3.client.action.ACTIONS;
import net.clanwolf.c3.client.action.ActionManager;
import net.clanwolf.c3.client.gui.panes.AbstractC3Pane;

/**
 * Login scene to log into the database.
 *
 * @author Meldric
 * @version 1.0
 */
public final class MapPane extends AbstractC3Pane {
	/**
	 * Constructor
	 */
	public MapPane() {
		super("/fxml/MapPane.fxml", false, false);
	}

	/**
	 * Create Content
	 */
	@Override
	public void createContent() {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Fire event: Pane construction begins
	 */
	@Override
	public void firePaneConstructionBeginsEvent() {
		ActionManager.getAction(ACTIONS.PANE_CREATION_BEGINS).execute(this);
	}

	/**
	 * Fire event: Pane construction
	 */
	@Override
	public void firePaneConstructionEvent() {
		ActionManager.getAction(ACTIONS.PANE_CREATION_FINISHED).execute(this);
	}

	/**
	 * Fire event: Pane destruction
	 */
	@Override
	public void firePaneDestructionEvent() {
		ActionManager.getAction(ACTIONS.PANE_DESTRUCTION_FINISHED).execute(this);
	}

	/**
	 * Get pane name
	 *
	 * @return String name
	 */
	@Override
	public String getPaneName() {
		return "MapPane";
	}

	/**
	 * Get modal state
	 *
	 * @return boolean modal
	 */
	@Override
	public boolean isModal() {
		return false;
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>

Loading...

  description
  PEAR2::Console::CommandLine::Renderer_Default

  dispatchAction

    HypoConf::ConfigParser::Setting\dispatchAction()
    PEAR2::Console::CommandLine::Option\dispatchAction()

  displayError
  PEAR2::Console::CommandLine

  displayUsage
  PEAR2::Console::CommandLine

  displayVersion
  PEAR2::Console::CommandLine

  doMove

    Symfony::Component::HttpFoundation::File::File\doMove()
    Symfony::Component::HttpFoundation::File::UploadedFile\doMove()

  dump

    Symfony::Component::Yaml::Dumper\dump()
    Symfony::Component::Yaml::Inline\dump()
    Symfony::Component::Yaml::Yaml\dump()

  dumpArray
  Symfony::Component::Yaml::Inline

  duplicate
  Symfony::Component::HttpFoundation::Request

Searching...

No Matches


text:
'''
 ====================================================================
 Copyright (c) 2016 Barry A Scott.  All rights reserved.

 This software is licensed as described in the file LICENSE.txt,
 which you should have received as part of this distribution.

 ====================================================================

    wb_hg_commit_dialog.py

'''
from PyQt5 import QtWidgets
from PyQt5 import QtCore

import wb_main_window
import wb_tracked_qwidget
import wb_ui_components

import wb_scm_table_view

#
#   add tool bars and menu for use in the commit window
#
class HgCommitWindowComponents(wb_ui_components.WbMainWindowComponents):
    def __init__( self, factory ):
        super().__init__( 'hg', factory )

    def setupTableContextMenu( self, m, addMenu ):
        super().setupTableContextMenu( m, addMenu )

        act = self.ui_actions

        m.addSection( T_('Diff') )
        addMenu( m, T_('Diff HEAD vs. Working'), act.tableActionHgDiffHeadVsWorking, act.enablerHgDiffHeadVsWorking, 'toolbar_images/diff.png' )

        m.addSection( T_('Hg Actions') )
        addMenu( m, T_('Add'), act.tableActionHgAdd_Bg, act.enablerHgFilesAdd, 'toolbar_images/include.png' )
        m.addSeparator()
        addMenu( m, T_('Revert'), act.tableActionHgRevert_Bg, act.enablerHgFilesRevert, 'toolbar_images/revert.png' )
        addMenu( m, T_('Delete…'), act.tableActionHgDelete_Bg, act.main_window.table_view.enablerTableFilesExists )

    def setupToolBarAtLeft( self, addToolBar, addTool ):
        t = addToolBar( T_('hg logo'), style='font-size: 20pt; width: 40px; color: #cc0000' )
        self.all_toolbars.append( t )

        addTool( t, 'Hg', self.main_window.projectActionSettings )

    def setupToolBarAtRight( self, addToolBar, addTool ):
        act = self.ui_actions

        # ----------------------------------------
        t = addToolBar( T_('hg info') )
        self.all_toolbars.append( t )

        addTool( t, T_('Diff'), act.tableActionHgDiffSmart, act.enablerHgDiffSmart, 'toolbar_images/diff.png' )
        addTool( t, T_('Commit History'), act.tableActionHgLogHistory_Bg, act.enablerHgLogHistory, 'toolbar_images/history.png' )

        # ----------------------------------------
        t = addToolBar( T_('hg state') )
        self.all_toolbars.append( t )

        addTool( t, T_('Add'), act.tableActionHgAdd_Bg, act.enablerHgFilesAdd, 'toolbar_images/include.png' )
        addTool( t, T_('Revert'), act.tableActionHgRevert_Bg, act.enablerHgFilesRevert, 'toolbar_images/revert.png' )

class WbHgCommitDialog(wb_main_window.WbMainWindow, wb_tracked_qwidget.WbTrackedModeless):
    commitAccepted = QtCore.pyqtSignal()
    commitClosed = QtCore.pyqtSignal()

    def __init__( self, app, hg_project ):
        self.__pyqt_bug_already_closed_why_call_close_event_again = False

        self.app = app
        self.hg_project = hg_project
        self.table_view = None

        super().__init__( app, app.debug_options.debugLogMainWindow )

        self.ui_component = HgCommitWindowComponents( self.app.getScmFactory( 'hg' ) )

        self.setWindowTitle( T_('Commit %(project_name)s - %(app_name)s') %
                                {'project_name': hg_project.projectName()
                                ,'app_name': ' '.join( app.app_name_parts )} )
        self.setWindowIcon( self.app.getAppQIcon() )

        # on Qt on macOS table will trigger selectionChanged that needs table_model
        self.table_view = wb_scm_table_view.WbScmTableView( self.app, self )

        self.all_included_files = set()
        self.table_view.setIncludedFilesSet( self.all_included_files )

        # unchanged files should not be interesting for a commit
        self.table_view.setShowControlledAndNotChangedFiles( False )

        self.ui_component.setTopWindow( self.app.top_window )
        self.ui_component.setMainWindow( self, self.table_view )

        # setup the chrome
        self.setupMenuBar( self.menuBar() )
        self.setupToolBar()
        self.__setupTableContextMenu()

        # ----------------------------------------
        self.filter_text = QtWidgets.QLineEdit()
        self.filter_text.setClearButtonEnabled( True )
        self.filter_text.setMaxLength( 256 )
        self.filter_text.setPlaceholderText( T_('Filter by name') )

        self.filter_text.textChanged.connect( self.table_view.table_sortfilter.setFilterText )

        self.h_filter_layout = QtWidgets.QHBoxLayout()
        self.h_filter_widget = QtWidgets.QWidget()
        self.h_filter_widget.setLayout( self.h_filter_layout )

        self.h_filter_layout.addWidget( QtWidgets.QLabel( T_('Filter:') ), 0 )
        self.h_filter_layout.addWidget( self.filter_text, 1 )

        self.v_table_layout = QtWidgets.QVBoxLayout()
        self.v_table_layout.addWidget( self.h_filter_widget )
        self.v_table_layout.addWidget( self.table_view )

        self.v_table_widget = QtWidgets.QWidget()
        self.v_table_widget.setLayout( self.v_table_layout )

        self.label_message = QtWidgets.QLabel( T_('Commit Log Message') )
        self.message = QtWidgets.QPlainTextEdit( '' )

        self.v_message_layout = QtWidgets.QVBoxLayout()
        self.v_message_layout.addWidget( self.label_message )
        self.v_message_layout.addWidget( self.message )
        self.v_message_widget = QtWidgets.QWidget()
        self.v_message_widget.setLayout( self.v_message_layout )

        self.buttons = QtWidgets.QDialogButtonBox()
        self.ok_button = self.buttons.addButton( self.buttons.Ok )
        self.buttons.addButton( self.buttons.Cancel )

        # ----------------------------------------
        self.v_split = QtWidgets.QSplitter()
        self.v_split.setOrientation( QtCore.Qt.Vertical )
        self.v_split.addWidget( self.v_table_widget )
        self.v_split.addWidget( self.v_message_widget )

        # ----------------------------------------
        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget( self.v_split )
        self.layout.addWidget( self.buttons )

        # ----------------------------------------
        self.widget = QtWidgets.QWidget()
        self.widget.setLayout( self.layout )

        self.setCentralWidget( self.widget )

        em = self.app.fontMetrics().width( 'm' )
        ex = self.app.fontMetrics().lineSpacing()
        self.resize( 100*em, 50*ex )

        self.ok_button.setEnabled( False )

        # connections
        self.buttons.accepted.connect( self.handleAccepted )
        self.buttons.rejected.connect( self.close )

        self.message.textChanged.connect( self.enableOkButton )

    def completeInit( self ):
        self.debugLog( 'completeInit()' )

        # set focus
        self.message.setFocus()

        self.updateTableView()

        # Qt has a habit of resetting the column widths
        # completeInit will set to the designed width
        self.table_view.completeInit()

        # set splitter position
        table_size_ratio = 0.7
        height = sum( self.v_split.sizes() )
        table_height = int( height * table_size_ratio )
        message_height = height - table_height
        self.v_split.setSizes( [table_height, message_height] )

        self.updateActionEnabledStates()

    def setupMenuBar( self, mb ):
        m = mb.addMenu( T_('&View') )
        tv = self.table_view
        self._addMenu( m, T_('Show Controlled and Changed files'), tv.setShowControlledAndChangedFiles, checker=tv.checkerShowControlledAndChangedFiles )
        self._addMenu( m, T_('Show Controlled and Not Changed files'), tv.setShowControlledAndNotChangedFiles, checker=tv.checkerShowControlledAndNotChangedFiles )
        self._addMenu( m, T_('Show Uncontrolled files'), tv.setShowUncontrolledFiles, checker=tv.checkerShowUncontrolledFiles )
        self._addMenu( m, T_('Show Ignored files'), tv.setShowIgnoredFiles, checker=tv.checkerShowIgnoredFiles )

        m = mb.addMenu( T_('File &Actions') )
        self._addMenu( m, T_('Edit'), self.table_view.tableActionEdit, self.table_view.enablerTableFilesExists, 'toolbar_images/edit.png' )
        self._addMenu( m, T_('Open'), self.table_view.tableActionOpen, self.table_view.enablerTableFilesExists, 'toolbar_images/open.png' )

        self.ui_component.setupMenuBar( mb, self._addMenu )

    def __setupTableContextMenu( self ):
        self.debugLog( '__setupTableContextMenu' )

        # --- setup scm_type specific menu

        m = QtWidgets.QMenu( self )

        m.addSection( T_('File Actions') )
        self._addMenu( m, T_('Edit'), self.table_view.tableActionEdit, self.table_view.enablerTableFilesExists, 'toolbar_images/edit.png' )
        self._addMenu( m, T_('Open'), self.table_view.tableActionOpen, self.table_view.enablerTableFilesExists, 'toolbar_images/open.png' )

        self.ui_component.setupTableContextMenu( m, self._addMenu )

    def tableContextMenu( self, global_pos ):
        self.debugLog( 'tableContextMenu( %r )' % (global_pos,) )

        self.ui_component.getTableContextMenu().exec_( global_pos )

    def setupToolBar( self ):
        # --- setup common toolbars
        t = self.tool_bar_table = self._addToolBar( T_('table') )
        self._addTool( t, T_('Edit'), self.table_view.tableActionEdit, self.table_view.enablerTableFilesExists, 'toolbar_images/edit.png' )
        self._addTool( t, T_('Open'), self.table_view.tableActionOpen, self.table_view.enablerTableFilesExists, 'toolbar_images/open.png' )

        # --- setup scm_type specific tool bars
        self.ui_component.setupToolBarAtRight( self._addToolBar, self._addTool )

    def closeEvent( self, event ):
        super().closeEvent( event )

        if self.__pyqt_bug_already_closed_why_call_close_event_again:
            return

        self.__pyqt_bug_already_closed_why_call_close_event_again = True

        self.commitClosed.emit()

    def handleAccepted( self ):
        self.commitAccepted.emit()

    def enableOkButton( self ):
        text = self.message.toPlainText()
        self.ok_button.setEnabled( text.strip() != '' and self.hg_project.numModifiedFiles() != 0 )

    def getMessage( self ):
        return self.message.toPlainText().strip()

    def updateSingleton( self ):
        self.updateTableView()

    def updateTableView( self ):
        # caller will have updated the hg project state already
        self.table_view.setScmProjectTreeNode( self.hg_project.flat_tree )

    def isScmTypeActive( self, scm_type ):
        return scm_type == 'hg'

    def updateActionEnabledStates( self ):
        # can be called during __init__ on macOS version
        if self.table_view is None or self.table_view.table_model is None:
            return

        self.updateEnableStates()
        self.enableOkButton()


text:
package org.spring.batch.infrastructure.writers;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.annotation.BeforeStep;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ItemStreamWriter;

import java.util.List;

/**
 * Created by iurii.dziuban on 11.08.2016.
 *
 * Writer with checking if parameter "Name" exists
 */
public class PassingParamToFutureStepWriter<T> implements ItemStreamWriter<T> {

    private static final Log LOGGER = LogFactory.getLog(PassingParamToFutureStepWriter.class);

    private StepExecution stepExecution;

    @BeforeStep
    public void saveStepExecution(StepExecution stepExecution) {
        this.stepExecution = stepExecution;
    }

    @Override
    public void write(List<? extends T> items) throws Exception {
        LOGGER.info(items);
        LOGGER.info("Name = " + stepExecution.getExecutionContext().get("Name"));
    }

    @Override
    public void open(ExecutionContext executionContext) throws ItemStreamException {
        LOGGER.info("PassingParamToFutureStepWriter open connection invoked");
    }

    @Override
    public void update(ExecutionContext executionContext) throws ItemStreamException {
        LOGGER.info("PassingParamToFutureStepWriter update invoked to persist state");
    }

    @Override
    public void close() throws ItemStreamException {
        LOGGER.info("PassingParamToFutureStepWriter close connection invoked");
    }

}


text:
wp-widget-template
==================

Template to create Wordpress widget plug-ins.

By: [@AlexWhedbee](https://github.com/alexwhedbee)


text:
using System;
using System.Net.Sockets;
using FlexibleProxy.Settings;

namespace FlexibleProxy.Networking
{
    public class OutgoingTcpConnector : IOutgoingConnector
    {
        private TcpClient Connection { get; set; }
        private Channel ChannelSettings { get; set; }

        public OutgoingTcpConnector(Channel channelSettings)
        {
            Connection = new TcpClient();
            ChannelSettings = channelSettings;
        }

        public void Activate()
        {
            Connection.BeginConnect(ChannelSettings.DestinationHost, ChannelSettings.DestinationPort, ReceiveData, null);
        }

        public void Deactivate()
        {
            Connection.Close();
        }

        private void ReceiveData(IAsyncResult result)
        {
            //byte[] data = result.
            if (OnDataReceived != null)
            {
                OnDataReceived(null);
            }
        }

        public event Action<byte[]> OnDataReceived;

        public void SendData(byte[] data)
        {
            var stream = Connection.GetStream();
            stream.Write(data, 0, data.Length);
        }
    }
}


text:
package capital.scalable.restdocs.constraints;

import java.util.Collections;
import java.util.List;

import org.springframework.core.MethodParameter;
import org.springframework.restdocs.constraints.Constraint;

public class NoOpMethodParameterConstraintResolver implements MethodParameterConstraintResolver {
    @Override
    public List<Constraint> resolveForParameter(MethodParameter param) {
        return Collections.emptyList();
    }

    @Override
    public List<Constraint> resolveForProperty(String property, Class<?> clazz) {
        return Collections.emptyList();
    }
}


text:
APPNAME="PlexConnect.py"

## prevent OSX plist boot errors to allow plist to function properly
sleep 1

# Determine if the network is up by looking for any non-loopback network interfaces.
# Currently supports only OSX "Darwin" OS
CheckForNetwork()
{
    local test

    if [ -z "${NETWORKUP:=}" ]; then
        test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
        if [ "${test}" -gt 0 ]; then
            NETWORKUP="-YES-"
        else
            NETWORKUP="-NO-"
        fi
    fi
}

# Wait for network readiness.
# This avoids the binding of PlexConnect to the loopback address which may otherwise occur
# if the bash script is called from a LaunchDaemon/plist file at boot time.

CheckForNetwork
while [ "${NETWORKUP}" != "-YES-" ]
do
    sleep 5
    NETWORKUP=
    CheckForNetwork
done

# Add 10.6 support
export PATH=/usr/local/git/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH

# Start PlexConnect
./${APPNAME}


text:
#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "libfreenect_sync.h"

typedef struct buffer_ring {
	pthread_mutex_t lock;
	pthread_cond_t cb_cond;
	void *bufs[3];
	uint32_t timestamp;
	int valid; // True if middle buffer is valid
	int fmt;
} buffer_ring_t;

typedef struct sync_kinect {
	freenect_device *dev;
	buffer_ring_t video;
	buffer_ring_t depth;
} sync_kinect_t;

typedef int (*set_buffer_t)(freenect_device *dev, void *buf);

#define MAX_KINECTS 64
static sync_kinect_t *kinects[MAX_KINECTS] = {};
static freenect_context *ctx;
static int thread_running = 0;
static pthread_t thread;
static pthread_mutex_t runloop_lock = PTHREAD_MUTEX_INITIALIZER;
static int pending_runloop_tasks = 0;
static pthread_mutex_t pending_runloop_tasks_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t pending_runloop_tasks_cond = PTHREAD_COND_INITIALIZER;

/* Locking Convention
   Rules:
       - if you need more than one lock on a line, get them from left to right
       - do not mix locks on different lines
       - if you need to change the lock rules, make sure you check everything and update this
   Lock Families:
       - pending_runloop_tasks_lock
       - runloop_lock, buffer_ring_t.lock (NOTE: You may only have one)
*/

static int alloc_buffer_ring_video(freenect_video_format fmt, buffer_ring_t *buf)
{
	int sz, i;
	switch (fmt) {
		case FREENECT_VIDEO_RGB:
			sz = FREENECT_VIDEO_RGB_SIZE;
			break;
		case FREENECT_VIDEO_BAYER:
			sz = FREENECT_VIDEO_BAYER_SIZE;
			break;
		case FREENECT_VIDEO_IR_8BIT:
			sz = FREENECT_VIDEO_IR_8BIT_SIZE;
			break;
		case FREENECT_VIDEO_IR_10BIT:
			sz = FREENECT_VIDEO_IR_10BIT;
			break;
		case FREENECT_VIDEO_IR_10BIT_PACKED:
			sz = FREENECT_VIDEO_IR_10BIT_PACKED_SIZE;
			break;
		default:
			printf("Invalid video format %d\n", fmt);
			return -1;
	}
	for (i = 0; i < 3; ++i)
		buf->bufs[i] = malloc(sz);
	buf->timestamp = 0;
	buf->valid = 0;
	buf->fmt = fmt;
	return 0;
}

static int alloc_buffer_ring_depth(freenect_depth_format fmt, buffer_ring_t *buf)
{
	int sz, i;
	switch (fmt) {
		case FREENECT_DEPTH_11BIT:
			sz = FREENECT_DEPTH_11BIT_SIZE;
			break;
		case FREENECT_DEPTH_10BIT:
			sz = FREENECT_DEPTH_10BIT_SIZE;
			break;
		case FREENECT_DEPTH_11BIT_PACKED:
			sz = FREENECT_DEPTH_11BIT_PACKED_SIZE;
			break;
		case FREENECT_DEPTH_10BIT_PACKED:
			sz = FREENECT_DEPTH_10BIT_PACKED_SIZE;
			break;
		default:
			printf("Invalid depth format %d\n", fmt);
			return -1;
	}
	for (i = 0; i < 3; ++i)
		buf->bufs[i] = malloc(sz);
	buf->timestamp = 0;
	buf->valid = 0;
	buf->fmt = fmt;
	return 0;
}

static void free_buffer_ring(buffer_ring_t *buf)
{
	int i;
	for (i = 0; i < 3; ++i) {
		free(buf->bufs[i]);
		buf->bufs[i] = NULL;
	}
	buf->timestamp = 0;
	buf->valid = 0;
	buf->fmt = -1;
}

static void producer_cb_inner(freenect_device *dev, void *data, uint32_t timestamp, buffer_ring_t *buf, set_buffer_t set_buffer)
{
	pthread_mutex_lock(&buf->lock);
	assert(data == buf->bufs[2]);
	void *temp_buf = buf->bufs[1];
	buf->bufs[1] = buf->bufs[2];
	buf->bufs[2] = temp_buf;
	set_buffer(dev, temp_buf);
	buf->timestamp = timestamp;
	buf->valid = 1;
	pthread_cond_signal(&buf->cb_cond);
	pthread_mutex_unlock(&buf->lock);
}

static void video_producer_cb(freenect_device *dev, void *data, uint32_t timestamp)
{
	producer_cb_inner(dev, data, timestamp, &((sync_kinect_t *)freenect_get_user(dev))->video, freenect_set_video_buffer);
}

static void depth_producer_cb(freenect_device *dev, void *data, uint32_t timestamp)
{
	producer_cb_inner(dev, data, timestamp, &((sync_kinect_t *)freenect_get_user(dev))->depth, freenect_set_depth_buffer);
}

/* You should only use these functions to manipulate the pending_runloop_tasks_lock*/
static void pending_runloop_tasks_inc(void)
{
	pthread_mutex_lock(&pending_runloop_tasks_lock);
	assert(pending_runloop_tasks >= 0);
	++pending_runloop_tasks;
	pthread_mutex_unlock(&pending_runloop_tasks_lock);
}

static void pending_runloop_tasks_dec(void)
{
	pthread_mutex_lock(&pending_runloop_tasks_lock);
	--pending_runloop_tasks;
	assert(pending_runloop_tasks >= 0);
	if (!pending_runloop_tasks)
		pthread_cond_signal(&pending_runloop_tasks_cond);
	pthread_mutex_unlock(&pending_runloop_tasks_lock);
}

static void pending_runloop_tasks_wait_zero(void)
{
	pthread_mutex_lock(&pending_runloop_tasks_lock);
	while (pending_runloop_tasks)
		pthread_cond_wait(&pending_runloop_tasks_cond, &pending_runloop_tasks_lock);
	pthread_mutex_unlock(&pending_runloop_tasks_lock);
}

static void *init(void *unused)
{
	pending_runloop_tasks_wait_zero();
	pthread_mutex_lock(&runloop_lock);
	while (thread_running && freenect_process_events(ctx) >= 0) {
		pthread_mutex_unlock(&runloop_lock);
		// NOTE: This lets you run tasks while process_events isn't running
		pending_runloop_tasks_wait_zero();
		pthread_mutex_lock(&runloop_lock);
	}
	// Go through each device, call stop video, close device
	int i;
	for (i = 0; i < MAX_KINECTS; ++i) {
		if (kinects[i]) {
			freenect_stop_video(kinects[i]->dev);
			freenect_stop_depth(kinects[i]->dev);
			freenect_set_user(kinects[i]->dev, NULL);
			freenect_close_device(kinects[i]->dev);
			free_buffer_ring(&kinects[i]->video);
			free_buffer_ring(&kinects[i]->depth);
			free(kinects[i]);
			kinects[i] = NULL;
		}
	}
	freenect_shutdown(ctx);
	pthread_mutex_unlock(&runloop_lock);
	return NULL;
}

static void init_thread(void)
{
	thread_running = 1;
	freenect_init(&ctx, 0);
	pthread_create(&thread, NULL, init, NULL);
}

static int change_video_format(sync_kinect_t *kinect, freenect_video_format fmt)
{
	freenect_stop_video(kinect->dev);
	free_buffer_ring(&kinect->video);
	if (alloc_buffer_ring_video(fmt, &kinect->video))
		return -1;
	freenect_set_video_format(kinect->dev, fmt);
	freenect_set_video_buffer(kinect->dev, kinect->video.bufs[2]);
	freenect_start_video(kinect->dev);
	return 0;
}

static int change_depth_format(sync_kinect_t *kinect, freenect_depth_format fmt)
{
	freenect_stop_depth(kinect->dev);
	free_buffer_ring(&kinect->depth);
	if (alloc_buffer_ring_depth(fmt, &kinect->depth))
		return -1;
	freenect_set_depth_format(kinect->dev, fmt);
	freenect_set_depth_buffer(kinect->dev, kinect->depth.bufs[2]);
	freenect_start_depth(kinect->dev);
	return 0;
}

static sync_kinect_t *alloc_kinect(int index)
{
	sync_kinect_t *kinect = malloc(sizeof(sync_kinect_t));
	if (freenect_open_device(ctx, &kinect->dev, index)) {
		free(kinect);
		return NULL;
	}
	int i;
	for (i = 0; i < 3; ++i) {
		kinect->video.bufs[i] = NULL;
		kinect->depth.bufs[i] = NULL;
	}
	kinect->video.fmt = -1;
	kinect->depth.fmt = -1;
	freenect_set_video_callback(kinect->dev, video_producer_cb);
	freenect_set_depth_callback(kinect->dev, depth_producer_cb);
	pthread_mutex_init(&kinect->video.lock, NULL);
	pthread_mutex_init(&kinect->depth.lock, NULL);
	pthread_cond_init(&kinect->video.cb_cond, NULL);
	pthread_cond_init(&kinect->depth.cb_cond, NULL);
	return kinect;
}

static int setup_kinect(int index, int fmt, int is_depth)
{
	pending_runloop_tasks_inc();
	pthread_mutex_lock(&runloop_lock);
	int thread_running_prev = thread_running;
	if (!thread_running)
		init_thread();
	if (!kinects[index]) {
		kinects[index] = alloc_kinect(index);
	}
	if (!kinects[index]) {
		printf("Error: Invalid index [%d]\n", index);
		// If we started the thread, we need to bring it back
		if (!thread_running_prev) {
			thread_running = 0;
			pthread_mutex_unlock(&runloop_lock);
			pending_runloop_tasks_dec();
			pthread_join(thread, NULL);
		} else {
			pthread_mutex_unlock(&runloop_lock);
			pending_runloop_tasks_dec();
		}
		return -1;
	}
	freenect_set_user(kinects[index]->dev, kinects[index]);
	buffer_ring_t *buf;
	if (is_depth)
		buf = &kinects[index]->depth;
	else
		buf = &kinects[index]->video;
	pthread_mutex_lock(&buf->lock);
	if (buf->fmt != fmt) {
		if (is_depth)
			change_depth_format(kinects[index], fmt);
		else
			change_video_format(kinects[index], fmt);
	}
	pthread_mutex_unlock(&buf->lock);
	pthread_mutex_unlock(&runloop_lock);
	pending_runloop_tasks_dec();
	return 0;
}

static int sync_get(void **data, uint32_t *timestamp, buffer_ring_t *buf)
{
	pthread_mutex_lock(&buf->lock);
	// If there isn't a frame ready for us
	while (!buf->valid)
		pthread_cond_wait(&buf->cb_cond, &buf->lock);
	void *temp_buf = buf->bufs[0];
	*data = buf->bufs[0] = buf->bufs[1];
	buf->bufs[1] = temp_buf;
	buf->valid = 0;
	*timestamp = buf->timestamp;
	pthread_mutex_unlock(&buf->lock);
	return 0;
}

int freenect_sync_get_video(void **video, uint32_t *timestamp, int index, freenect_video_format fmt)
{
	if (index < 0 || index >= MAX_KINECTS) {
		printf("Error: Invalid index [%d]\n", index);
		return -1;
	}
	if (!thread_running || !kinects[index] || kinects[index]->video.fmt != fmt)
		if (setup_kinect(index, fmt, 0))
			return -1;
	sync_get(video, timestamp, &kinects[index]->video);
	return 0;
}

int freenect_sync_get_depth(void **depth, uint32_t *timestamp, int index, freenect_depth_format fmt)
{
	if (index < 0 || index >= MAX_KINECTS) {
		printf("Error: Invalid index [%d]\n", index);
		return -1;
	}
	if (!thread_running || !kinects[index] || kinects[index]->depth.fmt != fmt)
		if (setup_kinect(index, fmt, 1))
			return -1;
	sync_get(depth, timestamp, &kinects[index]->depth);
	return 0;
}

void freenect_sync_stop(void)
{
	if (thread_running) {
		thread_running = 0;
		pthread_join(thread, NULL);
	}
}


text: rackup config.ru --port 8080


text:
const path = require("path");
const Promise = require("bluebird");
let log = {};
let fileutils = {};

function FileIndex (config, filerecognizer, publisher, generator, logger, fileUtils) {
    this.config = config;
    this.file_recognizer = filerecognizer;
    this.publisher = publisher;
    this.generator = generator;
    this.packages = {};
    log = logger || require("../services/logger.service");
    fileutils = fileUtils || require("./fileUtils");
    setInterval(this.check_expired_packages.bind(this), config.CHECK_PACKAGE_INTERVAL);
    setInterval(this.retry_failed_packages.bind(this), config.RETRY_PACKAGE_INTERVAL);
}

FileIndex.prototype.determine_file_type = function(filepath) {
    const filename = path.basename(filepath);
    if (this.config['ESSENCE_FILE_TYPE'] && this.file_recognizer.is_essence(filename)) {
        return "essence";
    } else if (this.config['SIDECAR_FILE_TYPE'] && this.file_recognizer.is_sidecar(filename)){
        return "sidecar";
    } else if (this.config['IGNORE_FILE_TYPE'] && this.file_recognizer.is_ignored(filename)) {
        return "ignore";
    } else if (this.config['COLLATERAL_FILE_TYPE'] && this.file_recognizer.is_collateral(filename)) {
        return "collateral";
    }
    return "other";
};

FileIndex.prototype.add_file = function (filepath, file_type) {
    return new Promise((resolve, reject) => {
        const filename = path.basename(filepath);
        const currentTime = new Date();
        const currentTimeMillis = currentTime.getTime();
        if (file_type === 'ignore') {
            log.info('Ignored file: ' + filename);
        } else if (file_type !== 'other') {
            const lookupKey = filename.replace(/\.[^/.]+$/, "");
            if (this.packages[lookupKey]) {
                log.info('Accepted file for existing package: ' + filename);
                this.packages[lookupKey].files.push(
                    {
                        file_type: file_type,
                        file_path: fileutils.getFolder(filepath),
                        file_name: fileutils.getFileName(filepath),
                        timestamp: currentTime

                    });
            } else {
                log.info('Accepted file for new package: ' + filename);
                this.packages[lookupKey] = {
                    files: [
                        {
                            file_type: file_type,
                            file_path: fileutils.getFolder(filepath),
                            file_name: fileutils.getFileName(filepath),
                            timestamp: currentTime
                        }
                    ]
                }
            }
            this.packages[lookupKey].lastModificationDate = currentTimeMillis;
            if (this.is_package_complete(lookupKey)) {
                // Avoid discarding once complete
                this.packages[lookupKey].isComplete = true;
                this.acceptPackage(lookupKey, this);
            }
            resolve(this.packages[lookupKey]);
        } else {
            log.info('Refused file for package handling: ' + filename);
            this.refuseFile(filepath, reject);
        }
        resolve();
    });
};

FileIndex.prototype.is_package_complete = function(key) {
    let has_essence = false;
    let has_sidecar = false;
    let has_collateral = false;
    let nr_of_collaterals = 0;

    this.packages[key].files.forEach((file) => {
        if (file.file_type === 'essence') has_essence = true;
        if (file.file_type === 'sidecar') has_sidecar = true;
        if (file.file_type === 'collateral') {
            has_collateral = true;
            nr_of_collaterals++;
        }
    });

    let complete = true;
    if (this.config['ESSENCE_FILE_TYPE']) {
        complete &= has_essence;
    }
    if (this.config['COLLATERAL_FILE_TYPE']) {
        complete &= has_collateral && nr_of_collaterals === this.config['NR_OF_COLLATERALS'];
    }
    if (this.config['SIDECAR_FILE_TYPE']) {
        complete &= has_sidecar;
    }
    return complete;
};

FileIndex.prototype.check_expired_packages = function() {
    log.info('Checking packages that are expired');
    const currentTime = new Date().getTime();
    for (let key in this.packages) {
        if (!this.packages[key].isComplete && this.packages[key].lastModificationDate + (this.config.CHECK_PACKAGE_INTERVAL * this.config.CHECK_PACKAGE_AMOUNT) < currentTime) {
            log.warn('Package ' + key + ' is too old. Deleting this entry and making it as incomplete.');
            this.discardPackage(key);
        }
    }
};

FileIndex.prototype.retry_failed_packages = function() {
    for (let key in this.packages) {
        if (this.packages[key].isComplete && this.packages[key].failed) {
            log.warn('Package ' + key + ' failed. Trying to publish message again.');
            this.sendCompleteMessage(key)
                .then( () => { return this.deleteEntry(key) })
                .catch(error => this.handle_failed_packages(error, key));
        }
    }
};

FileIndex.prototype.handle_failed_packages = function(error, key) {
    this.packages[key].failed = true;
    log.error(error + ' - Keeping package in memory');
};

/** Package is incomplete **/
FileIndex.prototype.discardPackage = function(key) {
    log.info('Discarding package with key: ' + key);
    this.movePackage(key, this.config.INCOMPLETE_FOLDER_NAME)
        .then( () => { this.deleteEntry(key) })
        .catch(error => {
            log.error(error);
        });
};

/** Package is complete **/
FileIndex.prototype.acceptPackage = function(key) {
    log.info('Package ' + key + ' is complete.');
    this.movePackage(key, this.config.PROCESSING_FOLDER_NAME)
        .then( () => { return this.sendCompleteMessage(key) })
        .then( () => { return this.deleteEntry(key) })
        .catch(error => {
            this.packages[key].failed = true;
            log.error(error + ' - Keeping package in memory');
        });
};

FileIndex.prototype.refuseFile = function (path, reject) {
    fileutils.moveFile(path, fileutils.createFullPath(fileutils.appendFolder(
        fileutils.getFolder(path), this.config.REFUSED_FOLDER_NAME), fileutils.getFileName(path)), (err) => {
        if (err) {
            reject(err);
        }
    });
};

FileIndex.prototype.movePackage = function(key, folder) {
    return new Promise((resolve, reject) => {
        this.packages[key].files.forEach((file) => {
            fileutils.moveFile(fileutils.createFullPath(file.file_path, file.file_name),
                fileutils.createFullPath(fileutils.appendFolder(
                    file.file_path, folder), file.file_name), (err) => {
                    if (err) {
                        reject(err);
                    }
                });
        });
        resolve();
    });
};

FileIndex.prototype.deleteEntry = function(key) {
    return new Promise((resolve, reject) => {
        try {
            log.info('Deleting entry: ' + key);
            delete this.packages[key];
            resolve();
        } catch (error) {
            reject(error);
        }
    });
};

FileIndex.prototype.sendCompleteMessage = function(key) {
    return this.publisher.publishMessage(this.generator.generate(this.packages[key], this.config.PROCESSING_FOLDER_NAME), key);
};

module.exports = FileIndex;


text:
package uk.co.jamesmcguigan.algorithms;

public class CompressedStrings {

    public String expandIt(final String x) {

        StringBuffer stringBuffer = new StringBuffer();
        char[] t = x.toCharArray();

        for (int i = 0; i < t.length; i++) {
            if (Character.isLetter(t[i])) {
                stringBuffer.append(t[i]);

            } else {
                int multiple = Integer.parseInt(String.valueOf(t[i])) - 1;
                char value = t[i - 1];
                for (int j = 0; j < multiple; j++) {
                    stringBuffer.append(value);
                }
            }
        }
        return stringBuffer.toString();
    }
}


text:
package technology.mainthread.apps.moment.common.data.db;

import android.os.AsyncTask;

import java.util.List;

import technology.mainthread.apps.moment.common.data.vo.Friend;

public class AsyncFriendsTable implements FriendsTable {

    private final FriendsTable syncFriendsTable;

    public AsyncFriendsTable(FriendsTable syncFriendsTable) {
        this.syncFriendsTable = syncFriendsTable;
    }

    @Override
    public void add(final Friend friend) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                syncFriendsTable.add(friend);
                return null;
            }
        }.execute();
    }

    @Override
    public Friend get(long index) {
        return syncFriendsTable.get(index);
    }

    @Override
    public List<Friend> getAll() {
        return syncFriendsTable.getAll();
    }

    @Override
    public void addOrUpdate(final Friend friend) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                syncFriendsTable.addOrUpdate(friend);
                return null;
            }
        }.execute();
    }

    @Override
    public void update(final Friend friend) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                syncFriendsTable.update(friend);
                return null;
            }
        }.execute();
    }

    @Override
    public boolean delete(final long index) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                syncFriendsTable.delete(index);
                return null;
            }
        }.execute();
        return true;
    }

    @Override
    public boolean deleteAll() {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                syncFriendsTable.deleteAll();
                return null;
            }
        }.execute();
        return true;
    }

    @Override
    public boolean hasFriends() {
        return syncFriendsTable.hasFriends();
    }
}


text:
<toaster-container toaster-options="{'position-class': 'toast-bottom-right', 'close-button':true}"></toaster-container>

Push Notifications
    Filter users and send push notifications

            <input type="text" ng-model="matchIdFilter" placeholder="Match ID is required" class="form-control mb"/>

                <button type="button" class="pull-left btn btn-default">Filtered users: {{filteredUsers.length}}
                </button>

                        <input id="inlineCheckbox20" type="checkbox" value="option2" ng-model="kickoff"/>
                        Visited after kick off

                        <input id="inlineCheckbox30" type="checkbox" value="option3" ng-model="last_action"/>
                        Action in the last 20 min

                <paneltool tool-refresh="line back-and-forth grow"></paneltool>
                <dir-pagination-controls></dir-pagination-controls>

{{item.userid}}

                                    Last match visited:
                                        {{item.last_match_visited}} -

                                    Last action at: {{FormatDate(item.last_action_time)}}

                                        [{{item.pushtoken}}]

Push Notifications

        <ui-select ng-model="pushService.selected" theme="bootstrap" on-select="onServiceSelected($item,$model)"
                   ng-disabled="disabled">
            <ui-select-match placeholder="Select message template">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices repeat="pushService in pushServices | propsFilter: {name: $select.search}">

                {{pushService.id}}
            </ui-select-choices>
        </ui-select>

            <ui-select ng-model="template.selected" theme="bootstrap" on-select="onSelected($item,$model)"
                       ng-disabled="disabled">
                <ui-select-match placeholder="Select message template">{{$select.selected.name}}</ui-select-match>
                <ui-select-choices repeat="template in templates | propsFilter: {name: $select.search}">

                    {{template.data}}
                </ui-select-choices>
            </ui-select>

            <textarea ng-model="push.message" style="height: 180px;" placeholder="{{demomessage}}" rows="7"
                      aria-multiline="true" tabindex="0" aria-invalid="false"
                      class="mda-form-control ng-pristine ng-valid ng-touched"
                      style="margin-top: 0px; margin-bottom: 0px; height: 139px;"></textarea>
            Message
            Any message here

            <ui-select ng-model="templateData.selected" theme="bootstrap" on-select="onDataSelected($item,$model)"
                       ng-disabled="disabled">
                <ui-select-match placeholder="Select data template">{{$select.selected.name}}</ui-select-match>
                <ui-select-choices repeat="templateData in templatesData | propsFilter: {name: $select.search}">

                    {{templateData.data}}
                </ui-select-choices>
            </ui-select>

            <textarea ng-model="push.data" placeholder="{{demodata}}" rows="4" aria-multiline="true" tabindex="0"
                      aria-invalid="false" class="mda-form-control ng-pristine ng-valid ng-touched"
                      style="margin-top: 0px; margin-bottom: 0px; height: 139px;"></textarea>
            Data
            Any message here

        <button ladda="pushLoading" data-style="expand-left"
                ng-click="pushRequest(filteredUsers,push.message,push.data)" class="btn btn-success pull-right btn-lg">
            Send Push
        </button>


text:
import React from 'react';
import styled from 'styled-components';

import rem from '../../utils/rem';
import { navbarHeight } from '../../utils/sizes';
import NavSeparator from './NavSeparator';
import Link from '../Link';

const Wrapper = styled.nav`
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: ${rem(30)};
`;

const NavLink = styled(Link).attrs((/* props */) => ({
  unstyled: true,
}))`
  flex: 0 0 auto;
  display: inline-block;
  line-height: ${rem(navbarHeight)};
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;

  letter-spacing: ${rem(0.4)};
  color: currentColor;

  &:hover,
  &:focus {
    opacity: 0.8;
  }

  &:active {
    transform: scale(0.95);
    opacity: 0.6;
  }
`;

const NavLinks = () => (
  <Wrapper>
    <NavLink href="/docs">Documentation</NavLink>
    <NavSeparator />
    <NavLink href="/showcase">Showcase</NavLink>
    <NavSeparator />
    <NavLink href="/ecosystem">Ecosystem</NavLink>
    <NavSeparator />
    <NavLink href="/releases">Releases</NavLink>
  </Wrapper>
);

export default NavLinks;


text:
 # -*- coding: utf-8 -*-

import numpy as np

from pyfr.backends.base import ComputeKernel
from pyfr.backends.mic.provider import MICKernelProvider

class MICCBLASKernels(MICKernelProvider):
    def mul(self, a, b, out, alpha=1.0, beta=0.0):
        # Ensure the matrices are compatible
        if a.nrow != out.nrow or a.ncol != b.nrow or b.ncol != out.ncol:
            raise ValueError('Incompatible matrices for out = a*b')

        m, n, k = a.nrow, b.ncol, a.ncol

        # Data type
        if a.dtype == np.float64:
            cblas_gemm = 'cblas_dgemm'
        else:
            cblas_gemm = 'cblas_sgemm'

        # Render the kernel template
        tpl = self.backend.lookup.get_template('gemm')
        src = tpl.render(cblas_gemm=cblas_gemm)

        # Argument types for gemm
        argt = [
            np.intp, np.int32, np.int32, np.int32,
            a.dtype, np.intp, np.int32, np.intp, np.int32,
            a.dtype, np.intp, np.int32
        ]

        # Build
        gemm = self._build_kernel('gemm', src, argt)

        class MulKernel(ComputeKernel):
            def run(self, queue):
                queue.mic_stream_comp.invoke(
                    gemm, m, n, k, a.data, b.data, out.data, a.leaddim,
                    b.leaddim, out.leaddim, alpha, beta
                )

        return MulKernel()


text:
#if SQLITE_TEST          /* This file is used for testing only */

#include "sqlite3.h"
#include "sqliteInt.h"

/*
** Maximum pathname length supported by the devsym backend.
*/
#define DEVSYM_MAX_PATHNAME 512

/*
** Name used to identify this VFS.
*/
#define DEVSYM_VFS_NAME "devsym"
#define WRITECRASH_NAME "writecrash"

typedef struct devsym_file devsym_file;
struct devsym_file {
  sqlite3_file base;
  sqlite3_file *pReal;
};

/*
** Method declarations for devsym_file.
*/
static int devsymClose(sqlite3_file*);
static int devsymRead(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
static int devsymWrite(sqlite3_file*,const void*,int iAmt, sqlite3_int64 iOfst);
static int devsymTruncate(sqlite3_file*, sqlite3_int64 size);
static int devsymSync(sqlite3_file*, int flags);
static int devsymFileSize(sqlite3_file*, sqlite3_int64 *pSize);
static int devsymLock(sqlite3_file*, int);
static int devsymUnlock(sqlite3_file*, int);
static int devsymCheckReservedLock(sqlite3_file*, int *);
static int devsymFileControl(sqlite3_file*, int op, void *pArg);
static int devsymSectorSize(sqlite3_file*);
static int devsymDeviceCharacteristics(sqlite3_file*);
static int devsymShmLock(sqlite3_file*,int,int,int);
static int devsymShmMap(sqlite3_file*,int,int,int, void volatile **);
static void devsymShmBarrier(sqlite3_file*);
static int devsymShmUnmap(sqlite3_file*,int);

/*
** Method declarations for devsym_vfs.
*/
static int devsymOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
static int devsymDelete(sqlite3_vfs*, const char *zName, int syncDir);
static int devsymAccess(sqlite3_vfs*, const char *zName, int flags, int *);
static int devsymFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
static void *devsymDlOpen(sqlite3_vfs*, const char *zFilename);
static void devsymDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
static void (*devsymDlSym(sqlite3_vfs*,void*, const char *zSymbol))(void);
static void devsymDlClose(sqlite3_vfs*, void*);
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
static int devsymRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int devsymSleep(sqlite3_vfs*, int microseconds);
static int devsymCurrentTime(sqlite3_vfs*, double*);

struct DevsymGlobal {
  sqlite3_vfs *pVfs;
  int iDeviceChar;
  int iSectorSize;
  int nWriteCrash;
};
struct DevsymGlobal g = {0, 0, 512, 0};

/*
** Close an devsym-file.
*/
static int devsymClose(sqlite3_file *pFile){
  devsym_file *p = (devsym_file *)pFile;
  sqlite3OsClose(p->pReal);
  return SQLITE_OK;
}

/*
** Read data from an devsym-file.
*/
static int devsymRead(
  sqlite3_file *pFile,
  void *zBuf,
  int iAmt,
  sqlite_int64 iOfst
){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst);
}

/*
** Write data to an devsym-file.
*/
static int devsymWrite(
  sqlite3_file *pFile,
  const void *zBuf,
  int iAmt,
  sqlite_int64 iOfst
){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);
}

/*
** Truncate an devsym-file.
*/
static int devsymTruncate(sqlite3_file *pFile, sqlite_int64 size){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsTruncate(p->pReal, size);
}

/*
** Sync an devsym-file.
*/
static int devsymSync(sqlite3_file *pFile, int flags){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsSync(p->pReal, flags);
}

/*
** Return the current file-size of an devsym-file.
*/
static int devsymFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsFileSize(p->pReal, pSize);
}

/*
** Lock an devsym-file.
*/
static int devsymLock(sqlite3_file *pFile, int eLock){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsLock(p->pReal, eLock);
}

/*
** Unlock an devsym-file.
*/
static int devsymUnlock(sqlite3_file *pFile, int eLock){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsUnlock(p->pReal, eLock);
}

/*
** Check if another file-handle holds a RESERVED lock on an devsym-file.
*/
static int devsymCheckReservedLock(sqlite3_file *pFile, int *pResOut){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsCheckReservedLock(p->pReal, pResOut);
}

/*
** File control method. For custom operations on an devsym-file.
*/
static int devsymFileControl(sqlite3_file *pFile, int op, void *pArg){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsFileControl(p->pReal, op, pArg);
}

/*
** Return the sector-size in bytes for an devsym-file.
*/
static int devsymSectorSize(sqlite3_file *pFile){
  return g.iSectorSize;
}

/*
** Return the device characteristic flags supported by an devsym-file.
*/
static int devsymDeviceCharacteristics(sqlite3_file *pFile){
  return g.iDeviceChar;
}

/*
** Shared-memory methods are all pass-thrus.
*/
static int devsymShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsShmLock(p->pReal, ofst, n, flags);
}
static int devsymShmMap(
  sqlite3_file *pFile,
  int iRegion,
  int szRegion,
  int isWrite,
  void volatile **pp
){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsShmMap(p->pReal, iRegion, szRegion, isWrite, pp);
}
static void devsymShmBarrier(sqlite3_file *pFile){
  devsym_file *p = (devsym_file *)pFile;
  sqlite3OsShmBarrier(p->pReal);
}
static int devsymShmUnmap(sqlite3_file *pFile, int delFlag){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsShmUnmap(p->pReal, delFlag);
}

/*
** Open an devsym file handle.
*/
static int devsymOpen(
  sqlite3_vfs *pVfs,
  const char *zName,
  sqlite3_file *pFile,
  int flags,
  int *pOutFlags
){
static sqlite3_io_methods devsym_io_methods = {
  2,                                /* iVersion */
  devsymClose,                      /* xClose */
  devsymRead,                       /* xRead */
  devsymWrite,                      /* xWrite */
  devsymTruncate,                   /* xTruncate */
  devsymSync,                       /* xSync */
  devsymFileSize,                   /* xFileSize */
  devsymLock,                       /* xLock */
  devsymUnlock,                     /* xUnlock */
  devsymCheckReservedLock,          /* xCheckReservedLock */
  devsymFileControl,                /* xFileControl */
  devsymSectorSize,                 /* xSectorSize */
  devsymDeviceCharacteristics,      /* xDeviceCharacteristics */
  devsymShmMap,                     /* xShmMap */
  devsymShmLock,                    /* xShmLock */
  devsymShmBarrier,                 /* xShmBarrier */
  devsymShmUnmap                    /* xShmUnmap */
};

  int rc;
  devsym_file *p = (devsym_file *)pFile;
  p->pReal = (sqlite3_file *)&p[1];
  rc = sqlite3OsOpen(g.pVfs, zName, p->pReal, flags, pOutFlags);
  if( p->pReal->pMethods ){
    pFile->pMethods = &devsym_io_methods;
  }
  return rc;
}

/*
** Delete the file located at zPath. If the dirSync argument is true,
** ensure the file-system modifications are synced to disk before
** returning.
*/
static int devsymDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
  return sqlite3OsDelete(g.pVfs, zPath, dirSync);
}

/*
** Test for access permissions. Return true if the requested permission
** is available, or false otherwise.
*/
static int devsymAccess(
  sqlite3_vfs *pVfs,
  const char *zPath,
  int flags,
  int *pResOut
){
  return sqlite3OsAccess(g.pVfs, zPath, flags, pResOut);
}

/*
** Populate buffer zOut with the full canonical pathname corresponding
** to the pathname in zPath. zOut is guaranteed to point to a buffer
** of at least (DEVSYM_MAX_PATHNAME+1) bytes.
*/
static int devsymFullPathname(
  sqlite3_vfs *pVfs,
  const char *zPath,
  int nOut,
  char *zOut
){
  return sqlite3OsFullPathname(g.pVfs, zPath, nOut, zOut);
}

#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Open the dynamic library located at zPath and return a handle.
*/
static void *devsymDlOpen(sqlite3_vfs *pVfs, const char *zPath){
  return sqlite3OsDlOpen(g.pVfs, zPath);
}

/*
** Populate the buffer zErrMsg (size nByte bytes) with a human readable
** utf-8 string describing the most recent error encountered associated
** with dynamic libraries.
*/
static void devsymDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
  sqlite3OsDlError(g.pVfs, nByte, zErrMsg);
}

/*
** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
*/
static void (*devsymDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
  return sqlite3OsDlSym(g.pVfs, p, zSym);
}

/*
** Close the dynamic library handle pHandle.
*/
static void devsymDlClose(sqlite3_vfs *pVfs, void *pHandle){
  sqlite3OsDlClose(g.pVfs, pHandle);
}
#endif /* SQLITE_OMIT_LOAD_EXTENSION */

/*
** Populate the buffer pointed to by zBufOut with nByte bytes of
** random data.
*/
static int devsymRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
  return sqlite3OsRandomness(g.pVfs, nByte, zBufOut);
}

/*
** Sleep for nMicro microseconds. Return the number of microseconds
** actually slept.
*/
static int devsymSleep(sqlite3_vfs *pVfs, int nMicro){
  return sqlite3OsSleep(g.pVfs, nMicro);
}

/*
** Return the current time as a Julian Day number in *pTimeOut.
*/
static int devsymCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
  return g.pVfs->xCurrentTime(g.pVfs, pTimeOut);
}

/*
** Return the sector-size in bytes for an writecrash-file.
*/
static int writecrashSectorSize(sqlite3_file *pFile){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsSectorSize(p->pReal);
}

/*
** Return the device characteristic flags supported by an writecrash-file.
*/
static int writecrashDeviceCharacteristics(sqlite3_file *pFile){
  devsym_file *p = (devsym_file *)pFile;
  return sqlite3OsDeviceCharacteristics(p->pReal);
}

/*
** Write data to an writecrash-file.
*/
static int writecrashWrite(
  sqlite3_file *pFile,
  const void *zBuf,
  int iAmt,
  sqlite_int64 iOfst
){
  devsym_file *p = (devsym_file *)pFile;
  if( g.nWriteCrash>0 ){
    g.nWriteCrash--;
    if( g.nWriteCrash==0 ) abort();
  }
  return sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);
}

/*
** Open an writecrash file handle.
*/
static int writecrashOpen(
  sqlite3_vfs *pVfs,
  const char *zName,
  sqlite3_file *pFile,
  int flags,
  int *pOutFlags
){
static sqlite3_io_methods writecrash_io_methods = {
  2,                                /* iVersion */
  devsymClose,                      /* xClose */
  devsymRead,                       /* xRead */
  writecrashWrite,                  /* xWrite */
  devsymTruncate,                   /* xTruncate */
  devsymSync,                       /* xSync */
  devsymFileSize,                   /* xFileSize */
  devsymLock,                       /* xLock */
  devsymUnlock,                     /* xUnlock */
  devsymCheckReservedLock,          /* xCheckReservedLock */
  devsymFileControl,                /* xFileControl */
  writecrashSectorSize,             /* xSectorSize */
  writecrashDeviceCharacteristics,  /* xDeviceCharacteristics */
  devsymShmMap,                     /* xShmMap */
  devsymShmLock,                    /* xShmLock */
  devsymShmBarrier,                 /* xShmBarrier */
  devsymShmUnmap                    /* xShmUnmap */
};

  int rc;
  devsym_file *p = (devsym_file *)pFile;
  p->pReal = (sqlite3_file *)&p[1];
  rc = sqlite3OsOpen(g.pVfs, zName, p->pReal, flags, pOutFlags);
  if( p->pReal->pMethods ){
    pFile->pMethods = &writecrash_io_methods;
  }
  return rc;
}

static sqlite3_vfs devsym_vfs = {
  2,                     /* iVersion */
  sizeof(devsym_file),      /* szOsFile */
  DEVSYM_MAX_PATHNAME,      /* mxPathname */
  0,                     /* pNext */
  DEVSYM_VFS_NAME,          /* zName */
  0,                     /* pAppData */
  devsymOpen,               /* xOpen */
  devsymDelete,             /* xDelete */
  devsymAccess,             /* xAccess */
  devsymFullPathname,       /* xFullPathname */
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  devsymDlOpen,             /* xDlOpen */
  devsymDlError,            /* xDlError */
  devsymDlSym,              /* xDlSym */
  devsymDlClose,            /* xDlClose */
#else
  0,                        /* xDlOpen */
  0,                        /* xDlError */
  0,                        /* xDlSym */
  0,                        /* xDlClose */
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
  devsymRandomness,         /* xRandomness */
  devsymSleep,              /* xSleep */
  devsymCurrentTime,        /* xCurrentTime */
  0,                        /* xGetLastError */
  0                         /* xCurrentTimeInt64 */
};

static sqlite3_vfs writecrash_vfs = {
  2,                     /* iVersion */
  sizeof(devsym_file),      /* szOsFile */
  DEVSYM_MAX_PATHNAME,      /* mxPathname */
  0,                     /* pNext */
  WRITECRASH_NAME,          /* zName */
  0,                     /* pAppData */
  writecrashOpen,           /* xOpen */
  devsymDelete,             /* xDelete */
  devsymAccess,             /* xAccess */
  devsymFullPathname,       /* xFullPathname */
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  devsymDlOpen,             /* xDlOpen */
  devsymDlError,            /* xDlError */
  devsymDlSym,              /* xDlSym */
  devsymDlClose,            /* xDlClose */
#else
  0,                        /* xDlOpen */
  0,                        /* xDlError */
  0,                        /* xDlSym */
  0,                        /* xDlClose */
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
  devsymRandomness,         /* xRandomness */
  devsymSleep,              /* xSleep */
  devsymCurrentTime,        /* xCurrentTime */
  0,                        /* xGetLastError */
  0                         /* xCurrentTimeInt64 */
};

/*
** This procedure registers the devsym vfs with SQLite. If the argument is
** true, the devsym vfs becomes the new default vfs. It is the only publicly
** available function in this file.
*/
void devsym_register(int iDeviceChar, int iSectorSize){

  if( g.pVfs==0 ){
    g.pVfs = sqlite3_vfs_find(0);
    devsym_vfs.szOsFile += g.pVfs->szOsFile;
    writecrash_vfs.szOsFile += g.pVfs->szOsFile;
    sqlite3_vfs_register(&devsym_vfs, 0);
    sqlite3_vfs_register(&writecrash_vfs, 0);
  }
  if( iDeviceChar>=0 ){
    g.iDeviceChar = iDeviceChar;
  }else{
    g.iDeviceChar = 0;
  }
  if( iSectorSize>=0 ){
    g.iSectorSize = iSectorSize;
  }else{
    g.iSectorSize = 512;
  }
}

void devsym_unregister(){
  sqlite3_vfs_unregister(&devsym_vfs);
  sqlite3_vfs_unregister(&writecrash_vfs);
  g.pVfs = 0;
  g.iDeviceChar = 0;
  g.iSectorSize = 0;
}

void devsym_crash_on_write(int nWrite){
  if( g.pVfs==0 ){
    g.pVfs = sqlite3_vfs_find(0);
    devsym_vfs.szOsFile += g.pVfs->szOsFile;
    writecrash_vfs.szOsFile += g.pVfs->szOsFile;
    sqlite3_vfs_register(&devsym_vfs, 0);
    sqlite3_vfs_register(&writecrash_vfs, 0);
  }
  g.nWriteCrash = nWrite;
}

#endif


text:
<?
//Used on both page and file attributes
$c = Page::getCurrentPage();

$sets = array();
if (is_object($category) && $category->allowAttributeSets()) {
	$sets = $category->getAttributeSets();
}
?>

<form class="form-horizontal">

	<? $form = Loader::helper('form'); ?>

	<? if (count($sets) > 0) { ?>

	<?=$form->label('asGroupAttributes', t('View'))?>

	<select class="span3" onchange="window.location.href='<?=Loader::helper('navigation')->getLinkToCollection($c)?>?asGroupAttributes=' + this.value" id="asGroupAttributes" name="asGroupAttributes">
		<option value="1" <? if ($_REQUEST['asGroupAttributes'] !== '0') { ?> selected <? } ?>><?=t('Grouped by set')?></option>
		<option value="0" <? if ($_REQUEST['asGroupAttributes'] === '0') { ?> selected <? } ?>><?=t('In one list')?></option>
	</select>

	<? } ?>
	<a href="<?=$this->url('/dashboard/system/attributes/sets', 'category', $category->getAttributeKeyCategoryID())?>" id="ccm-list-view-customize-top"><?=t('Manage Sets')?>

</form>

<?
if (count($attribs) > 0) { ?>

	<?
	$ih = Loader::helper('concrete/interface');
	$valt = Loader::helper('validation/token');

	if (count($sets) > 0 && ($_REQUEST['asGroupAttributes'] !== '0')) { ?>

		<?

		foreach($sets as $as) { ?>

<?=$as->getAttributeSetDisplayName()?>

		<?

		$setattribs = $as->getAttributeKeys();
		if (count($setattribs) == 0) { ?>

<?=t('No attributes defined.')?>

		<? } else { ?>

			<div class="ccm-attribute-sortable-set-list ccm-attribute-list-wrapper" attribute-set-id="<?=$as->getAttributeSetID()?>" id="asID_<?=$as->getAttributeSetID()?>">

			<?

			foreach($setattribs as $ak) { ?>

			<div class="ccm-attribute" id="akID_<?=$as->getAttributeSetID()?>_<?=$ak->getAttributeKeyID()?>">
				<img class="ccm-attribute-icon" src="<?=$ak->getAttributeKeyIconSRC()?>" width="16" height="16" /><a href="<?=$this->url($editURL, 'edit', $ak->getAttributeKeyID())?>"><?=$ak->getAttributeKeyDisplayName()?>

			<? } ?>

			<? } ?>

		<? }

		$unsetattribs = $category->getUnassignedAttributeKeys();
		if (count($unsetattribs) > 0) { ?>

<?=t('Other')?>

			<?
			foreach($unsetattribs as $ak) { ?>

			<div class="ccm-attribute" id="akID_<?=$as->getAttributeSetID()?>_<?=$ak->getAttributeKeyID()?>">
				<img class="ccm-attribute-icon" src="<?=$ak->getAttributeKeyIconSRC()?>" width="16" height="16" /><a href="<?=$this->url($editURL, 'edit', $ak->getAttributeKeyID())?>"><?=$ak->getAttributeKeyDisplayName()?>

			<? } ?>

		<?

		}

	} else { ?>

		<?
		foreach($attribs as $ak) { ?>
		<div class="ccm-attribute" id="akID_<?=$ak->getAttributeKeyID()?>">
			<img class="ccm-attribute-icon" src="<?=$ak->getAttributeKeyIconSRC()?>" width="16" height="16" /><a href="<?=$this->url($editURL, 'edit', $ak->getAttributeKeyID())?>"><?=$ak->getAttributeKeyDisplayName()?>

		<? } ?>

	<? } ?>

<? } else { ?>

		<?
	 echo t('No attributes defined.');
		?>

<? } ?>


text:
PYTHONIC_NS_BEGIN

namespace numpy
{
  template <class T>
  typename std::enable_if<
      types::is_dtype<T>::value,
      types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
                                      std::integral_constant<long, 1>>>>::type
  atleast_2d(T t)
  {
    return {types::pshape<std::integral_constant<long, 1>,
                          std::integral_constant<long, 1>>(),
            t};
  }

  template <class T>
          auto atleast_2d(T const &t) ->
          typename std::enable_if < (!types::is_dtype<T>::value) &&
      T::value<2, types::ndarray<
                      typename T::dtype,
                      types::pshape<std::integral_constant<long, 1>,
                                    typename std::tuple_element<
                                        0, typename T::shape_t>::type>>>::type
  {
    return t.reshape(types::pshape<
        std::integral_constant<long, 1>,
        typename std::tuple_element<0, typename T::shape_t>::type>(
        std::integral_constant<long, 1>(), t.template shape<0>()));
  }

  template <class T>
  auto atleast_2d(T &&t) -> typename std::enable_if<
      (!types::is_dtype<typename std::remove_cv<
          typename std::remove_reference<T>::type>::type>::value) &&
          std::decay<T>::type::value >= 2,
      decltype(std::forward<T>(t))>::type
  {
    return std::forward<T>(t);
  }
}
PYTHONIC_NS_END

#endif