text:
package com.heaven7.java.data.mediator.support.gson;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.heaven7.java.base.util.SparseArray;
import com.heaven7.java.data.mediator.FieldFlags;
import com.heaven7.java.data.mediator.Property;

import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.heaven7.java.data.mediator.support.gson.SupportUtils.isBoxedClass;
import static com.heaven7.java.data.mediator.support.gson.SupportUtils.setValue;
import static com.heaven7.java.data.mediator.support.gson.SupportUtils.writePrimitiveOrItsBox;

/**
 * the type handler help us read and write object for gson.
 * @author heaven7
 */
public abstract class TypeHandler {

    private static final TypeHandler PRIMITVE = new PrimitiveTypeHandler();
    private static final SparseArray<TypeHandler> sHandlers;
    private static final Map<Type, TypeAdapter<?>> sTypeAdapterMap;

    static {
        sHandlers = new SparseArray<>();
        sTypeAdapterMap = new HashMap<>();
    }

    /**
     * write the value to the writer.
     * @param out the json out writer
     * @param property the gson property
     * @param value the value to write
     * @throws IOException when gson exception occurs
     */
    public abstract void write(JsonWriter out, GsonProperty property, Object value) throws IOException;

    /**
     * read the object to the target t .
     * @param in the json reader
     * @param property the gson property
     * @param t the object to set to.
     * @throws IOException when gson exception occurs
     */
    public abstract void read(JsonReader in, GsonProperty property, Object t) throws IOException;

    //==================================================================================================

    //if is java.lang.Object....

    /**
     * register the type adapter
     * @param type the type.
     * @param adapter the type adapter
     * @param <T> the object type.
     */
    public static <T> void registerTypeAdapter(Type type, TypeAdapter<? super T> adapter){
        sTypeAdapterMap.put(type, adapter);
    }

    public static TypeHandler getTypeHandler(Property prop){
        if(prop.getComplexType() == 0){
            if(prop.getType().isPrimitive() || isBoxedClass(prop.getType())){
                return PRIMITVE;
            }
        }
        return getTypeHandlerInternal(prop.getComplexType());
    }

    public static TypeAdapter getTypeAdapter(Type type){
        return  sTypeAdapterMap.get(type);
    }
    private static TypeHandler getTypeHandlerInternal(int complexType) {
        TypeHandler handler = sHandlers.get(complexType);
        if(handler == null){
            switch (complexType){
                case FieldFlags.COMPLEX_LIST:
                    handler = new ListTypeHandler();
                    break;

                case FieldFlags.COMPLEX_ARRAY:
                    handler = new ArrayTypeHandler();
                    break;

                case FieldFlags.COMPLEX_SPARSE_ARRAY:
                    handler = new SparseArrayTypeHandler();
                    break;

                case 0:
                    handler = new SimpleTypeHandler();
                    break;

                default:
                    throw new UnsupportedOperationException();
            }
            sHandlers.put(complexType, handler);
        }
        return handler;
    }

    private static class SimpleTypeHandler extends TypeHandler {
        @Override
        public void write(JsonWriter out, GsonProperty property, Object value) throws IOException {
               getTypeAdapter(property.getType()).write(out, value);
        }
        @Override
        public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
            Object val = getTypeAdapter(property.getType()).read(in);
            setValue(property, t, val);
        }
    }

    private static class PrimitiveTypeHandler extends TypeHandler {
        @Override
        public void write(JsonWriter writer, GsonProperty property, Object value) throws IOException {
            writePrimitiveOrItsBox(writer, property.getType(), value);
        }
        @Override
        public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
            Object val = SupportUtils.readPrimitiveOrItsBox(in, property);
            setValue(property, t, val);
        }
    }
    private static class SparseArrayTypeHandler extends TypeHandler {
        @Override
        public void write(JsonWriter out,  GsonProperty property, Object value) throws IOException {
            final Class<?> simpleType = property.getType();
            out.beginObject();
            if(value != null) {
                final SparseArray sa = (SparseArray) value;
                if(simpleType.isPrimitive() || isBoxedClass(simpleType)){
                    for (int size = sa.size(), i = size - 1; i >= 0; i--) {
                        out.name(sa.keyAt(i) + "");
                        writePrimitiveOrItsBox(out, simpleType, sa.valueAt(i));
                    }
                }else {
                    TypeAdapter adapter = getTypeAdapter(simpleType);
                    for (int size = sa.size(), i = size - 1; i >= 0; i--) {
                        out.name(sa.keyAt(i) + "");
                        adapter.write(out, sa.valueAt(i));
                    }
                }
            }
            out.endObject();
        }

        @Override
        public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
            final Class<?> simpleType = property.getType();
            final SparseArray sa = new SparseArray();

            in.beginObject();
            if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
                while (in.hasNext()) {
                    int key = Integer.parseInt(in.nextName());
                    sa.put(key, SupportUtils.readPrimitiveOrItsBox(in, property));
                }
            }else{
                TypeAdapter adapter = getTypeAdapter(simpleType);
                while (in.hasNext()) {
                    int key = Integer.parseInt(in.nextName());
                    Object val = adapter.read(in);
                    if (val != null) {
                        sa.put(key, val);
                    }
                }
            }
            setValue(property, t, sa);
            in.endObject();
        }
    }

    private static class ArrayTypeHandler extends TypeHandler {
        @Override
        public void write(JsonWriter out, GsonProperty property, Object value) throws IOException {
            final Class<?> simpleType = property.getType();
            out.beginArray();
            int length = Array.getLength(value);
            if(length > 0) {
                if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
                    for (int i = 0; i < length; i++) {
                        writePrimitiveOrItsBox(out, simpleType, Array.get(value, i));
                    }
                } else {
                    TypeAdapter adapter = getTypeAdapter(simpleType);
                    for (int i = 0; i < length; i++) {
                        adapter.write(out, Array.get(value, i));
                    }
                }
            }
            out.endArray();
        }

        @Override
        public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
            final Class<?> simpleType = property.getType();

            List list = new ArrayList();
            in.beginArray();
            if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
                while (in.hasNext()){
                    list.add(SupportUtils.readPrimitiveOrItsBox(in, property));
                }
            }else{
                TypeAdapter adapter = getTypeAdapter(simpleType);
                while (in.hasNext()){
                    list.add(adapter.read(in));
                }
            }
            //copy to array
            Object array = Array.newInstance(simpleType, list.size());
            for(int i = 0, size = list.size() ; i < size ; i ++){
                Array.set(array, i, list.get(i));
            }
            setValue(property, t, array);
            in.endArray();
        }
    }

    private static class ListTypeHandler extends TypeHandler {
        @Override
        public void write(JsonWriter out,  GsonProperty property, Object value) throws IOException {
            final Class<?> simpleType = property.getType();
            out.beginArray();
            List list = (List) value;
            if (!list.isEmpty()) {
                if (simpleType.isPrimitive()|| isBoxedClass(simpleType)) {
                    for (Object item : list) {
                        writePrimitiveOrItsBox(out, simpleType, item);
                    }
                } else {
                    TypeAdapter adapter = getTypeAdapter(simpleType);
                    for (Object item : list) {
                        adapter.write(out, item);
                    }
                }
            }
            out.endArray();
        }

        @Override
        public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
            final Class<?> simpleType = property.getType();

            List list = new ArrayList();
            in.beginArray();
            if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
                while (in.hasNext()){
                    list.add(SupportUtils.readPrimitiveOrItsBox(in, property));
                }
            }else{
                TypeAdapter adapter = getTypeAdapter(simpleType);
                while (in.hasNext()){
                    list.add(adapter.read(in));
                }
            }
            setValue(property, t, list);
            in.endArray();
        }
    }
}


text:
#include <QToolButton>

#include "brushstylewidget.h"

class BrushStyleButton : public QToolButton
{
	Q_OBJECT

public:
	BrushStyleButton(QWidget *parent);
	~BrushStyleButton();

	BrushStyleWidget *getStyleWidget();
	QColor getColor() const;

public slots:
	void setColor(const QColor &color);

protected slots:
	virtual void onToggled(bool toggled);
	void onStyleWidgetClosed();

protected:
	void updateIcon();

	BrushStyleWidget *styleWidget;
};

class BrushSizeButton : public BrushStyleButton
{
	Q_OBJECT

public:
	BrushSizeButton(QWidget *parent);

	qreal getSize() const;

public slots:
	void setSize(qreal size);

signals:
	void sizeSelected(qreal size);
};

class BrushAlphaButton : public BrushStyleButton
{
	Q_OBJECT

public:
	BrushAlphaButton(QWidget *parent);

	qreal getAlpha() const;

public slots:
	void setAlpha(qreal alpha);
	void setSize(qreal size);

signals:
	void alphaSelected(qreal alpha);
};

#endif // BRUSHSTYLEBUTTON_H

redpajama_set_name: RedPajamaGithub


text:
require 'test_helper'
require 'roar/decorator'
require 'active_support/core_ext/object/to_query'

class PageRepresenterTest < MiniTest::Spec
  let(:songs) do
    [
      OpenStruct.new(:name => 'Thriller'),
      OpenStruct.new(:name => 'One More Time'),
      OpenStruct.new(:name => 'Good Vibrations')
    ]
  end

  class SongRepresenter < Roar::Decorator
    include Roar::JSON

    property :name
  end

  class SongsRepresenter < Roar::Decorator
    include Roar::JSON
    include Roar::Contrib::Decorator::PageRepresenter

    collection :songs,
      :exec_context => :decorator,
      :decorator => SongRepresenter

    def songs
      represented
    end

    def page_url(args)
      "http://www.roar-contrib.com/songs?#{args.to_query}"
    end
  end

  describe 'without #page_url defined' do
    class NotImplementedSongsRepresenter < Roar::Decorator
      include Roar::JSON
      include Roar::Contrib::Decorator::PageRepresenter

      collection :songs,
        :exec_context => :decorator,
        :decorator => SongRepresenter

      def songs
        represented
      end
    end

    it 'raises NotImplementedError' do
      proc {
        NotImplementedSongsRepresenter.prepare(songs.paginate()).to_json
      }.must_raise NotImplementedError
    end
  end

  describe 'without CollectionRepresenter' do
    describe 'using WillPaginate' do
      require "will_paginate/array"

      it 'renders a paginated response with no previous or next page' do
        SongsRepresenter
          .prepare(songs.paginate())
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=1&per_page=30"}],"songs":[{"name":"Thriller"},{"name":"One More Time"},{"name":"Good Vibrations"}]}'
      end

      it 'renders a paginated response with a previous and next page' do
        SongsRepresenter
          .prepare(songs.paginate(:page => 2, :per_page => 1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"},{"rel":"next","href":"http://www.roar-contrib.com/songs?page=3&per_page=1"},{"rel":"previous","href":"http://www.roar-contrib.com/songs?page=1&per_page=1"}],"songs":[{"name":"One More Time"}]}'
      end

      it 'renders a paginated response with a previous and no next page' do
        SongsRepresenter
          .prepare(songs.paginate(:page => 3, :per_page => 1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=3&per_page=1"},{"rel":"previous","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"}],"songs":[{"name":"Good Vibrations"}]}'
      end

      it 'renders a paginated response with a next page and no previous page' do
        SongsRepresenter
          .prepare(songs.paginate(:page => 1, :per_page => 1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=1&per_page=1"},{"rel":"next","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"}],"songs":[{"name":"Thriller"}]}'
      end
    end

    describe 'using Kaminari' do
      require 'kaminari/config'
      require 'kaminari/helpers/paginator'
      require 'kaminari/models/page_scope_methods'
      require 'kaminari/models/configuration_methods'
      require 'kaminari/models/array_extension'

      it 'renders a paginated response with no previous or next page' do
        SongsRepresenter
          .prepare(Kaminari.paginate_array(songs).page)
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=1&per_page=25"}],"songs":[{"name":"Thriller"},{"name":"One More Time"},{"name":"Good Vibrations"}]}'
      end

      it 'renders a paginated response with a previous and next page' do
        SongsRepresenter
          .prepare(Kaminari.paginate_array(songs).page(2).per(1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"},{"rel":"next","href":"http://www.roar-contrib.com/songs?page=3&per_page=1"},{"rel":"previous","href":"http://www.roar-contrib.com/songs?page=1&per_page=1"}],"songs":[{"name":"One More Time"}]}'
      end

      it 'renders a paginated response with a previous and no next page' do
        SongsRepresenter
          .prepare(Kaminari.paginate_array(songs).page(3).per(1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=3&per_page=1"},{"rel":"previous","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"}],"songs":[{"name":"Good Vibrations"}]}'
      end

      it 'renders a paginated response with a next page and no previous page' do
        SongsRepresenter
          .prepare(Kaminari.paginate_array(songs).page(1).per(1))
          .to_json
          .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=1&per_page=1"},{"rel":"next","href":"http://www.roar-contrib.com/songs?page=2&per_page=1"}],"songs":[{"name":"Thriller"}]}'
      end
    end
  end

  describe 'HAL' do
    require "will_paginate/array"

    class HalSongsRepresenter < Roar::Decorator
      include Roar::JSON::HAL
      include Roar::Contrib::Decorator::PageRepresenter

      collection :songs,
        :exec_context => :decorator,
        :decorator => SongRepresenter

      def songs
        represented
      end

      def page_url(args)
        "http://www.roar-contrib.com/songs?#{args.to_query}"
      end
    end

    it 'renders a paginated response with no previous or next page' do
      HalSongsRepresenter
        .prepare(songs.paginate())
        .to_json
        .must_equal '{"total_entries":3,"_links":{"self":{"href":"http://www.roar-contrib.com/songs?page=1&per_page=30"}},"songs":[{"name":"Thriller"},{"name":"One More Time"},{"name":"Good Vibrations"}]}'
    end
  end

  describe 'with CollectionRepresenter' do
    require "will_paginate/array"

    class TopSongRepresenter < Roar::Decorator
      include Roar::JSON

      property :name
    end

    class TopSongsRepresenter < Roar::Decorator
      include Roar::JSON
      include Roar::Contrib::Decorator::PageRepresenter
      include Roar::Contrib::Decorator::CollectionRepresenter

      def page_url(args)
        "http://www.roar-contrib.com/songs?#{args.to_query}"
      end
    end

    it 'renders a paginated response with no previous or next page' do
      TopSongsRepresenter
        .prepare(songs.paginate())
        .to_json
        .must_equal '{"total_entries":3,"links":[{"rel":"self","href":"http://www.roar-contrib.com/songs?page=1&per_page=30"}],"top_songs":[{"name":"Thriller"},{"name":"One More Time"},{"name":"Good Vibrations"}]}'
    end
  end
end


text:
    <title>Sample Classroom Page</title>
    <link
      href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
      rel="stylesheet"
    />

    <meta
      name="google-signin-client_id"
      content="532482101496-tmijs31sk91ohop17lmaq9br96oi758m.apps.googleusercontent.com"
    />

            Sign in to Get Started

              <svg
                class="text-red-400"
                fill="currentColor"
                width="24"
                height="24"
                viewBox="0 0 24 24"
              >
                <path
                  d="M12.979 3.055c4.508.489 8.021 4.306 8.021 8.945.001 2.698-1.194 5.113-3.075 6.763l-1.633-1.245c1.645-1.282 2.709-3.276 2.708-5.518 0-3.527-2.624-6.445-6.021-6.923v2.923l-5.25-4 5.25-4v3.055zm-1.979 15.865c-3.387-.486-6-3.401-6.001-6.92 0-2.237 1.061-4.228 2.697-5.509l-1.631-1.245c-1.876 1.65-3.066 4.061-3.065 6.754-.001 4.632 3.502 8.444 8 8.942v3.058l5.25-4-5.25-4v2.92z"
                />
              </svg>

            Checking enrollment status


text:
from setuptools import setup

setup(name='msrapi',
      version='0.1',
      description='Interact with the MotorsportsReg.com API using the python requests module and json',
      url='https://github.com/lx-88/MSRApi',
      author='GeomaticsResearch',
      author_email='info@geomaticsresearch.com',
      license='MIT',
      packages=['msrapi'],
      zip_safe=False)


text:
using System;
using MindTouch.Deki.Script.Expr;
using MindTouch.Dream;

namespace MindTouch.Deki.Script.Runtime.TargetInvocation {
    public class DekiScriptRemoteInvocationTarget : ADekiScriptInvocationTarget {

        //--- Fields ---
        private readonly XUri _endpoint;

        //--- Constructors ---
        public DekiScriptRemoteInvocationTarget(XUri endpoint) {
            if(endpoint == null) {
                throw new ArgumentNullException("endpoint");
            }
            _endpoint = endpoint;
        }

        //--- Methods ---
        public override DekiScriptLiteral InvokeList(DekiScriptRuntime runtime, DekiScriptList args) {

            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);
            plug = runtime.PreparePlug(plug);

            // make web-request
            DreamMessage response = plug.Post(args.ToXml(), new Tasking.Result<DreamMessage>()).Wait();
            if(!response.IsSuccessful) {
                if(response.HasDocument) {
                    var error = response.ToDocument();
                    var message = error["message"];
                    if(error.HasName("exception") && !message.IsEmpty) {
                        throw new DekiScriptRemoteException(Location.None, message.Contents);
                    }
                }
                throw new DreamResponseException(response);
            }

            // convert response to literal
            DekiScriptLiteral list;
            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch(ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if(list.ScriptType != DekiScriptType.LIST) {
                throw new DekiScriptBadTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return ((DekiScriptList)list)[0];
        }

        public override DekiScriptLiteral InvokeMap(DekiScriptRuntime runtime, DekiScriptMap args) {

            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);
            plug = runtime.PreparePlug(plug);

            // make web-request
            DreamMessage response = plug.Post(args.ToXml(), new Tasking.Result<DreamMessage>()).Wait();
            if(!response.IsSuccessful) {
                if(response.HasDocument) {
                    var error = response.ToDocument();
                    var message = error["message"];
                    if(error.HasName("exception") && !message.IsEmpty) {
                        throw new DekiScriptRemoteException(Location.None, message.Contents);
                    }
                }
                throw new DreamResponseException(response);
            }

            // convert response to literal
            DekiScriptLiteral list;
            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch(ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if(list.ScriptType != DekiScriptType.LIST) {
                throw new DekiScriptBadTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return ((DekiScriptList)list)[0];
        }
    }
}


text:
@interface PhotoModel : NSObject

-(id) initWithFetchedDictionary:(NSDictionary *)fetchedDictionary;
-(NSString *)categoryName;

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *photographerName;
@property (nonatomic, retain) NSString *createdDate;
@property (nonatomic, retain) NSString *imageURL;
@property (nonatomic, retain) NSString *rating;

@property (nonatomic, assign) int identifier;
@property (nonatomic, assign) int category;

@end


text:
				<button type="button" class="close" ng-click="close()" aria-hidden="true">×</button>

						Request prints -
						Select your pickup location

						Please select below the distribution counter where you want to collect
						your documents:

            <button type="button" class="btn btn-default btn-xxl location"
                ng-class="{ 'active': $parent.selectedLocation==location.code }"
                ng-click="selectLocation(location.code)"
                ng-style="{ 'background-image' : 'url(\'/app/images/printsmart/'+location.code+'.jpg\')' }">

              {{location.title}}

              {{location.description}}

              {{location.location}}

            </button>

						Due to the great size of the venue and the distance between the
						the two meeting rooms, two document distribution counters are available
						for your convenience.

				<button type="button" class="btn btn-default" ng-click="back()" ng-if="!viewOnly"> Back</button>
				<button type="button" class="btn btn-primary" ng-click="print()" ng-disabled="!selectedLocation"> Continue</button>
				<button type="button" class="btn btn-default" ng-click="close()"> Close</button>


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\DocumentSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'id') ?>

    <?= $form->field($model, 'number') ?>

    <?= $form->field($model, 'date') ?>

    <?= $form->field($model, 'expiration_date') ?>

    <?= $form->field($model, 'image_url') ?>

        <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
package org.apereo.cas.impl.account;

import org.apereo.cas.api.PasswordlessUserAccountStore;
import org.apereo.cas.impl.BasePasswordlessUserAccountStoreTests;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is {@link RestfulPasswordlessUserAccountStoreTests}.
 *
 * @author Misagh Moayyed
 * @since 5.3.0
 */
@TestPropertySource(properties = {
    "cas.authn.passwordless.accounts.simple.casuser=1234567890",
    "cas.authn.passwordless.tokens.crypto.enabled=false"
})
@Tag("Simple")
public class SimplePasswordlessUserAccountStoreTests extends BasePasswordlessUserAccountStoreTests {
    @Autowired
    @Qualifier("passwordlessUserAccountStore")
    private PasswordlessUserAccountStore passwordlessUserAccountStore;

    @Test
    public void verifyAction() {
        assertTrue(passwordlessUserAccountStore.findUser("casuser").isPresent());
        assertTrue(passwordlessUserAccountStore.findUser("other").isEmpty());
    }
}


text:
module DCA
  module Models
    class BaseModel
      extend  ActiveModel::Naming
      extend  ActiveModel::Translation
      include ActiveModel::Validations
      include ActiveModel::Conversion
      include ActiveModel::Serialization
      include Binder
      include DCA::Storage

      establish_connection

      set_callback :validate, :before, :validate_associations

      attr_accessor :id, :base_id, :created_at, :updated_at

                    def initialize(params={})
        params.each { |attr, value| self.instance_variable_set "@#{attr}", value } if params
      end

      def persisted?
        true
      end

      def to_hash
        include = []
        self.class.associations(true).each { |field, options| include << field.to_s}
        self.serializable_hash include: include
      end

      def attributes
        return @attributes unless @attributes.nil?

        @attributes = Hash[instance_variables.map { |var| [var.to_s.delete('@'), instance_variable_get(var)]}]
        @attributes.delete 'errors'
        @attributes.delete 'validation_context'

        @attributes
      end

      def before_update
        self.updated_at = Time.now.utc
      end

      def before_create
        self.created_at = Time.now.utc
      end

      def validate_associations
        self.class.associations.each do |field, options|
          object = self.send(field)
          next if object.nil?

          if object.is_a? Array
            object.each { |item| validate_child item, field }
          else
            validate_child object, field
          end
        end
      end

      private

      def validate_child object, field
        if object.respond_to?(:invalid?) && object.invalid?
          self.errors.add field, object.errors.full_messages
        end
      end

    end
  end
end


text:
require 'state_flow'
module StateFlow

  class State
    include EventClient
    include GuardClient
    include ActionClient
    include ElementVisitable

    attr_reader :name, :flow, :parent
    attr_accessor :termination
    def initialize(flow_or_parent, name, &block)
      @name = name
      @parent = flow_or_parent if flow_or_parent.is_a?(State)
      @flow = flow_or_parent.is_a?(State) ? flow_or_parent.flow : flow_or_parent
      @concreate = @flow.state_cd_by_key(@name)
      instance_eval(&block) if block
    end

    def state(name, &block)
      result = State.new(self, name, &block)
      children << result
      result
    end
    alias_method :from, :state
    alias_method :group, :state
    alias_method :state_group, :state

    def termination(name = nil)
      result = name ? state(name) : self
      result.termination = true
      result
    end

    def children
      @children ||= []
    end

    def descendants
      [self, children.map{|c|c.descendants}].flatten
    end

    def include?(state_or_name)
      name = state_or_name.is_a?(State) ? state_or_name.name : state_or_name
      descendants.any?{|state| state.name == name}
    end

    def concrete?
      @concreate
    end

    private
    # for EventClient
    def origin
      self
    end

    public
    def process(context)
      context.trace(self)
      exception_handling(context) do
        guard = guard_for(context)
        return guard.process(context) if guard
        return action.process(context) if action
      end
    end

    # override ExceptionHandlerClient#exception_handlers
    def exception_handlers
      result = events.select{|ev| ev.is_a?(ExceptionHandler)}
      result.concat(parent.exception_handlers) if parent
      result
    end

    def name_path(separator = '>')
      result = []
      current = self
      while current
        result << current.name
        current = current.parent
      end
      result.reverse.join(separator)
    end

    def inspect
      "#<%s:%#x @name=%s>" % [self.class.name, self.object_id, name_path.inspect]
    end

  end

end


text:
package org.apache.torque.task;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.torque.engine.EngineException;
import org.apache.torque.engine.database.model.Database;
import org.apache.torque.engine.database.transform.XmlToAppData;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.apache.velocity.texen.ant.TexenTask;

/**
 * A base torque task that uses either a single XML schema
 * representing a data model, or a <fileset> of XML schemas.
 * We are making the assumption that an XML schema representing
 * a data model contains tables for a single
 * database.
 *
 * @author Jason van Zyl
 * @author Daniel Rall
 */
public class TorqueDataModelTask extends TexenTask
{
    /**
     * XML that describes the database model, this is transformed
     * into the application model object.
     */
    protected String xmlFile;

    /** Fileset of XML schemas which represent our data models. */
    protected List filesets = new ArrayList();

    /** Data models that we collect. One from each XML schema file. */
    protected List dataModels = new ArrayList();

    /** Velocity context which exposes our objects in the templates. */
    protected Context context;

    /**
     * Map of data model name to database name.
     * Should probably stick to the convention of them being the same but
     * I know right now in a lot of cases they won't be.
     */
    protected Hashtable dataModelDbMap;

    /**
     * Hashtable containing the names of all the databases
     * in our collection of schemas.
     */
    protected Hashtable databaseNames;

    //!! This is probably a crappy idea having the sql file -> db map
    // here. I can't remember why I put it here at the moment ...
    // maybe I was going to map something else. It can probably
    // move into the SQL task.

    /**
     * Name of the properties file that maps an SQL file
     * to a particular database.
     */
    protected String sqldbmap;

    /** The target database(s) we are generating SQL for. */
    private String targetDatabase;

    /** Target Java package to place the generated files in. */
    private String targetPackage;

    /**
     * Set the sqldbmap.
     *
     * @param sqldbmap th db map
     */
    public void setSqlDbMap(String sqldbmap)
    {
        //!! Make all these references files not strings.
        this.sqldbmap = getProject().resolveFile(sqldbmap).toString();
    }

    /**
     * Get the sqldbmap.
     *
     * @return String sqldbmap.
     */
    public String getSqlDbMap()
    {
        return sqldbmap;
    }

    /**
     * Return the data models that have been processed.
     *
     * @return List data models
     */
    public List getDataModels()
    {
        return dataModels;
    }

    /**
     * Return the data model to database name map.
     *
     * @return Hashtable data model name to database name map.
     */
    public Hashtable getDataModelDbMap()
    {
        return dataModelDbMap;
    }

    /**
     * Get the xml schema describing the application model.
     *
     * @return  String xml schema file.
     */
    public String getXmlFile()
    {
        return xmlFile;
    }

    /**
     * Set the xml schema describing the application model.
     *
     * @param xmlFile The new XmlFile value
     */
    public void setXmlFile(String xmlFile)
    {
        this.xmlFile = getProject().resolveFile(xmlFile).toString();
    }

    /**
     * Adds a set of xml schema files (nested fileset attribute).
     *
     * @param set a Set of xml schema files
     */
    public void addFileset(FileSet set)
    {
        filesets.add(set);
    }

    /**
     * Get the current target database.
     *
     * @return String target database(s)
     */
    public String getTargetDatabase()
    {
        return targetDatabase;
    }

    /**
     * Set the current target database. (e.g. mysql, oracle, ..)
     *
     * @param v target database(s)
     */
    public void setTargetDatabase(String v)
    {
        targetDatabase = v;
    }

    /**
     * Get the current target package.
     *
     * @return return target java package.
     */
    public String getTargetPackage()
    {
        return targetPackage;
    }

    /**
     * Set the current target package. This is where generated java classes will
     * live.
     *
     * @param v target java package.
     */
    public void setTargetPackage(String v)
    {
        targetPackage = v;
    }

    /**
     * Set up the initial context for generating the SQL from the XML schema.
     *
     * @return the context
     * @throws Exception
     */
    public Context initControlContext() throws Exception
    {
        XmlToAppData xmlParser;

        if (xmlFile == null && filesets.isEmpty())
        {
            throw new BuildException("You must specify an XML schema or "
                    + "fileset of XML schemas!");
        }

        try
        {
            if (xmlFile != null)
            {
                // Transform the XML database schema into
                // data model object.
                xmlParser = new XmlToAppData(getTargetDatabase(),
                        getTargetPackage());
                Database ad = xmlParser.parseFile(xmlFile);
                ad.setFileName(grokName(xmlFile));
                dataModels.add(ad);
            }
            else
            {
                // Deal with the filesets.
                for (int i = 0; i < filesets.size(); i++)
                {
                    FileSet fs = (FileSet) filesets.get(i);
                    DirectoryScanner ds = fs.getDirectoryScanner(getProject());
                    File srcDir = fs.getDir(getProject());

                    String[] dataModelFiles = ds.getIncludedFiles();

                    // Make a transaction for each file
                    for (int j = 0; j < dataModelFiles.length; j++)
                    {
                        File f = new File(srcDir, dataModelFiles[j]);
                        xmlParser = new XmlToAppData(getTargetDatabase(),
                                getTargetPackage());
                        Database ad = xmlParser.parseFile(f.toString());
                        ad.setFileName(grokName(f.toString()));
                        dataModels.add(ad);
                    }
                }
            }

            Iterator i = dataModels.iterator();
            databaseNames = new Hashtable();
            dataModelDbMap = new Hashtable();

            // Different datamodels may state the same database
            // names, we just want the unique names of databases.
            while (i.hasNext())
            {
                Database database = (Database) i.next();
                databaseNames.put(database.getName(), database.getName());
                dataModelDbMap.put(database.getFileName(), database.getName());
            }
        }
        catch (EngineException ee)
        {
            throw new BuildException(ee);
        }

        context = new VelocityContext();

        // Place our set of data models into the context along
        // with the names of the databases as a convenience for now.
        context.put("dataModels", dataModels);
        context.put("databaseNames", databaseNames);
        context.put("targetDatabase", targetDatabase);
        context.put("targetPackage", targetPackage);

        return context;
    }

    /**
     * Change type of "now" to java.util.Date
     *
     * @see org.apache.velocity.texen.ant.TexenTask#populateInitialContext(org.apache.velocity.context.Context)
     */
    protected void populateInitialContext(Context context) throws Exception
    {
        super.populateInitialContext(context);
        context.put("now", new Date());
    }

    /**
     * Gets a name to use for the application's data model.
     *
     * @param xmlFile The path to the XML file housing the data model.
     * @return The name to use for the AppData.
     */
    private String grokName(String xmlFile)
    {
        // This can't be set from the file name as it is an unreliable
        // method of naming the descriptor. Not everyone uses the same
        // method as I do in the TDK. jvz.

        String name = "data-model";
        int i = xmlFile.lastIndexOf(System.getProperty("file.separator"));
        if (i != -1)
        {
            // Creep forward to the start of the file name.
            i++;

            int j = xmlFile.lastIndexOf('.');
            if (i < j)
            {
                name = xmlFile.substring(i, j);
            }
            else
            {
                // Weirdo
                name = xmlFile.substring(i);
            }
        }
        return name;
    }

    /**
     * Override Texen's context properties to map the
     * torque.xxx properties (including defaults set by the
     * org/apache/torque/defaults.properties) to just xxx.
     *
     *

     * Also, move xxx.yyy properties to xxxYyy as Velocity
     * doesn't like the xxx.yyy syntax.
     *

     *
     * @param file the file to read the properties from
     */
    public void setContextProperties(String file)
    {
        super.setContextProperties(file);

        // Map the torque.xxx elements from the env to the contextProperties
        Hashtable env = super.getProject().getProperties();
        for (Iterator i = env.entrySet().iterator(); i.hasNext();)
        {
            Map.Entry entry = (Map.Entry) i.next();
            String key = (String) entry.getKey();
            if (key.startsWith("torque."))
            {
                String newKey = key.substring("torque.".length());
                int j = newKey.indexOf(".");
                while (j != -1)
                {
                    newKey =
                        newKey.substring(0, j)
                        +  StringUtils.capitalize(newKey.substring(j + 1));
                    j = newKey.indexOf(".");
                }

                contextProperties.setProperty(newKey, entry.getValue());
            }
        }
    }
}


text:
package org.jetbrains.java.decompiler;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.zip.ZipFile;

import static org.jetbrains.java.decompiler.DecompilerTestFixture.assertFilesEqual;

public class BulkDecompilationTest {
  private DecompilerTestFixture fixture;

  @Before
  public void setUp() throws IOException {
    fixture = new DecompilerTestFixture();
    fixture.setUp(Map.of());
  }

  @After
  public void tearDown() throws IOException {
    fixture.tearDown();
    fixture = null;
  }

  @Test
  public void testDirectory() {
    var classes = fixture.getTempDir().resolve("classes");
    unpack(fixture.getTestDataDir().resolve("bulk.jar"), classes);

    var decompiler = fixture.getDecompiler();
    decompiler.addSource(classes.toFile());
    decompiler.decompileContext();

    assertFilesEqual(fixture.getTestDataDir().resolve("bulk"), fixture.getTargetDir());
  }

  @Test
  public void testJar() {
    doTestJar("bulk");
  }

  @Test
  public void testKtJar() {
    doTestJar("kt25937");
  }

  @Test
  public void testObfuscated() {
    doTestJar("obfuscated");
  }

  private void doTestJar(String name) {
    var decompiler = fixture.getDecompiler();
    var jarName = name + ".jar";
    decompiler.addSource(fixture.getTestDataDir().resolve(jarName).toFile());
    decompiler.decompileContext();

    var unpacked = fixture.getTempDir().resolve("unpacked");
    unpack(fixture.getTargetDir().resolve(jarName), unpacked);

    assertFilesEqual(fixture.getTestDataDir().resolve(name), unpacked);
  }

  private static void unpack(Path archive, Path targetDir) {
    try (var zip = new ZipFile(archive.toFile())) {
      var entries = zip.entries();
      while (entries.hasMoreElements()) {
        var entry = entries.nextElement();
        if (!entry.isDirectory()) {
          if (entry.getName().contains("..")) throw new IllegalArgumentException("Invalid entry: " + entry.getName());
          var file = targetDir.resolve(entry.getName());
          Files.createDirectories(file.getParent());
          try (InputStream in = zip.getInputStream(entry)) {
            Files.copy(in, file);
          }
        }
      }
    }
    catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
}


text:
package openshiftapiserver

import (
	corev1informers "k8s.io/client-go/informers/core/v1"
	rbacinformers "k8s.io/client-go/informers/rbac/v1"
	"k8s.io/client-go/kubernetes"
	restclient "k8s.io/client-go/rest"
	rbacauthorizer "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac"

	quotainformer "github.com/openshift/client-go/quota/informers/externalversions/quota/v1"
	projectauth "github.com/openshift/origin/pkg/project/auth"
	projectcache "github.com/openshift/origin/pkg/project/cache"
	"github.com/openshift/origin/pkg/quota/controller/clusterquotamapping"
)

func NewClusterQuotaMappingController(nsInternalInformer corev1informers.NamespaceInformer, clusterQuotaInformer quotainformer.ClusterResourceQuotaInformer) *clusterquotamapping.ClusterQuotaMappingController {
	return clusterquotamapping.NewClusterQuotaMappingController(nsInternalInformer, clusterQuotaInformer)
}

func NewProjectCache(nsInformer corev1informers.NamespaceInformer, privilegedLoopbackConfig *restclient.Config, defaultNodeSelector string) (*projectcache.ProjectCache, error) {
	kubeClient, err := kubernetes.NewForConfig(privilegedLoopbackConfig)
	if err != nil {
		return nil, err
	}
	return projectcache.NewProjectCache(
			nsInformer.Informer(),
			kubeClient.CoreV1().Namespaces(),
			defaultNodeSelector),
		nil
}

func NewProjectAuthorizationCache(subjectLocator rbacauthorizer.SubjectLocator, namespaces corev1informers.NamespaceInformer, rbacInformers rbacinformers.Interface) *projectauth.AuthorizationCache {
	return projectauth.NewAuthorizationCache(
		namespaces.Lister(),
		namespaces.Informer(),
		projectauth.NewAuthorizerReviewer(subjectLocator),
		rbacInformers,
	)
}


text:
<?xml version="1.0" encoding="ISO-8859-15"?>
<!--
  Licensed to the AOS Community (AOS) under one or more
  contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The AOS licenses this file
  to you 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.
-->
<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/maven-v4_0_0.xsd">
  <parent>
    <groupId>io.aos</groupId>
    <artifactId>t4f-data-hbase</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>..</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>t4f-data-hbase-mapreduce</artifactId>
  <name>T4F Data HBase MapReduce</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-server</artifactId>
      <scope>test</scope>
     </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-server</artifactId>
      <type>test-jar</type>
    </dependency>
  </dependencies>
</project>


text:
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import * as actions from '../datafiles';
import * as types from '../../constants/actionTypes';
import { API } from '../../constants/api';
import nock from 'nock';
import expect from 'expect';

const middlewares = [ thunk ];
const mockStore = configureMockStore(middlewares);

import { datafile } from './fixtures';

describe('Actions::Datafiles', () => {
  afterEach(() => {
    nock.cleanAll();
  });

  it('fetches data files successfully', () => {
    nock(API)
      .get('/data')
      .reply(200, [datafile]);

    const expectedActions = [
      { type: types.FETCH_DATAFILES_REQUEST },
      { type: types.FETCH_DATAFILES_SUCCESS, files: [datafile] }
    ];

    const store = mockStore({ files: [] });

    return store.dispatch(actions.fetchDataFiles())
      .then(() => { // return of async actions
        expect(store.getActions()).toEqual(expectedActions);
      });
  });

  it('creates FETCH_DATAFILES_FAILURE when fetching datafiles failed', () => {
    nock(API)
      .get('/data')
      .replyWithError('Something gone wrong');

    const expectedActions = [
      { type: types.FETCH_DATAFILES_REQUEST },
      { type: types.FETCH_DATAFILES_FAILURE }
    ];

    const store = mockStore({ files: [] });

    return store.dispatch(actions.fetchDataFiles())
      .then(() => { // return of async actions
        expect(store.getActions()[1].type).toEqual(expectedActions[1].type);
      });
  });

  it('fetches a data file successfully', () => {
    nock(API)
      .get('/data/data_file.yml')
      .reply(200, datafile);

    const expectedActions = [
      { type: types.FETCH_DATAFILE_REQUEST },
      { type: types.FETCH_DATAFILE_SUCCESS, file: datafile }
    ];

    const store = mockStore({ currentFile: {} });

    return store.dispatch(actions.fetchDataFile('data_file.yml'))
      .then(() => { // return of async actions
        expect(store.getActions()).toEqual(expectedActions);
      });
  });

  it('creates FETCH_DATAFILE_FAILURE when fetching a datafile failed', () => {
    nock(API)
      .get('/data/data_file.yml')
      .replyWithError('Something gone wrong');

    const expectedActions = [
      { type: types.FETCH_DATAFILE_REQUEST },
      { type: types.FETCH_DATAFILE_FAILURE }
    ];

    const store = mockStore({ currentFile: {} });

    return store.dispatch(actions.fetchDataFile('data_file.yml'))
      .then(() => { // return of async actions
        expect(store.getActions()[1].type).toEqual(expectedActions[1].type);
      });
  });

  it('updates a data file successfully', () => {
    nock(API)
      .put('/data/data_file.json', { raw_content: { foo: "bar" } } )
      .reply(200, datafile);

    const expectedAction = [
      { type: types.CLEAR_ERRORS },
      { type: types.PUT_DATAFILE_SUCCESS, file: datafile }
    ];

    const store = mockStore({ currentFile: {} });

    return store.dispatch(actions.putDataFile('data_file.json', { foo: "bar" }))
      .then(() => { // return of async actions
        expect(store.getActions()).toEqual(expectedAction);
      });
  });

  it('creates PUT_DATAFILE_FAILURE when updating a datafile failed', () => {
    nock(API)
      .put('/data/data_file.yml', datafile)
      .replyWithError('something awful happened');

    const expectedActions = [
      { type: types.CLEAR_ERRORS },
      { type: types.PUT_DATAFILE_FAILURE }
    ];

    const store = mockStore({ currentFile: {} });

    return store.dispatch(actions.putDataFile('data_file.yml', datafile))
      .then(() => { // return of async actions
        expect(store.getActions()[1].type).toEqual(expectedActions[1].type);
      });
  });

  it('deletes a data file successfully', () => {
    nock(API)
      .delete('/data/data_file.yml')
      .reply(200);

    const expectedAction = [
      { type: types.DELETE_DATAFILE_SUCCESS },
      { type: types.FETCH_DATAFILES_REQUEST }
    ];

    const store = mockStore({ files: [] });

    return store.dispatch(actions.deleteDataFile('data_file.yml'))
      .then(() => { // return of async actions
        expect(store.getActions()).toEqual(expectedAction);
      });
  });

  it('creates DELETE_DATAFILE_FAILURE when deleting a datafile failed', () => {
    nock(API)
      .delete('/data/data_file.yml')
      .replyWithError('something awful happened');

    const expectedAction = {
      type: types.DELETE_DATAFILE_FAILURE
    };

    const store = mockStore({ currentFile: {} });

    return store.dispatch(actions.deleteDataFile('data_file.yml'))
      .then(() => { // return of async actions
        expect(store.getActions()[0].type).toEqual(expectedAction.type);
      });
  });

  it('creates VALIDATION_ERROR if required field is not provided.', () => {
    const expectedActions = [
      {
        type: types.VALIDATION_ERROR,
        errors: [
          'The filename is required.',
          'The content is required.'
        ]
      }
    ];

    const store = mockStore({currentFile: {}});

    store.dispatch(actions.putDataFile());
    expect(store.getActions()).toEqual(expectedActions);
  });
});


text:
require 'rubygems'
require 'bundler'
Bundler.setup
require 'rspec'
require 'rspec/autorun'
require 'webmock/rspec'
require 'rack/test'
require 'omniauth/core'
require 'omniauth/test'
require 'omniauth/openid'

RSpec.configure do |config|
  config.include WebMock
  config.include Rack::Test::Methods
  config.extend  OmniAuth::Test::StrategyMacros, :type => :strategy
end

WebMock.disable_net_connect!


text:
(function ($) {
    var font = window.fnt,
        m = window.measure,
        x = window.cxa;

    function drawDebug() {
        var orig =  -3 * m.full.x;

        x.globalAlpha = 1;
        x.textAlign = "center";
        x.fillStyle = "#000";
        x.font = font("header");
        x.fillText("Contact", m.delta.x - orig, m.delta.y);
    }

    window.slide3 = function (only) {
        drawDebug();
    };

    window.slide3Pointers = function drawPointerLabels() {
        window.pointerLabel(window.pgLabels.slide3top);
        window.pointerLabel(window.pgLabels.slide3bottom, true);
    }
}(jQuery));


text:
package org.apache.orc.impl.writer;

import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.ColumnVector;
import org.apache.orc.TypeDescription;
import org.apache.orc.impl.Utf8Utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * Under the covers, varchar is written to ORC the same way as string.
 */
public class VarcharTreeWriter extends StringBaseTreeWriter {
  private final int maxLength;

  VarcharTreeWriter(int columnId,
                    TypeDescription schema,
                    WriterContext writer,
                    boolean nullable) throws IOException {
    super(columnId, schema, writer, nullable);
    maxLength = schema.getMaxLength();
  }

  @Override
  public void writeBatch(ColumnVector vector, int offset,
                         int length) throws IOException {
    super.writeBatch(vector, offset, length);
    BytesColumnVector vec = (BytesColumnVector) vector;
    if (vector.isRepeating) {
      if (vector.noNulls || !vector.isNull[0]) {
        // 0, length times
        writeTruncated(vec, 0, length);
      }
    } else {
      for(int i=0; i < length; ++i) {
        if (vec.noNulls || !vec.isNull[i + offset]) {
          // offset + i, once per loop
          writeTruncated(vec, i + offset, 1);
        }
      }
    }
  }

  private void writeTruncated(BytesColumnVector vec, int row, int repeats)
      throws IOException {
    int itemLength =
        Utf8Utils.truncateBytesTo(maxLength, vec.vector[row], vec.start[row], vec.length[row]);
    if (useDictionaryEncoding) {
      int id = dictionary.add(vec.vector[row], vec.start[row], itemLength);
      for (int i = 0; i < repeats; ++i) {
        rows.add(id);
      }
    } else {
      for (int i = 0; i < repeats; ++i) {
        directStreamOutput.write(vec.vector[row], vec.start[row], itemLength);
        lengthOutput.write(itemLength);
      }
    }
    indexStatistics.updateString(vec.vector[row], vec.start[row], itemLength, repeats);
    if (createBloomFilter) {
      if (bloomFilter != null) {
        // translate from UTF-8 to the default charset
        bloomFilter.addString(new String(vec.vector[row], vec.start[row], itemLength,
            StandardCharsets.UTF_8));
      }
      bloomFilterUtf8.addBytes(vec.vector[row], vec.start[row], itemLength);
    }
  }
}


text:
<?php

//raportera error
error_reporting(-1);              // Report all type of errors
ini_set('display_errors', 1);     // Display all errors
ini_set('output_buffering', 0);   // Do not buffer outputs, write directly

//path
define('PROT_INSTALL_PATH', __DIR__ . '/..');
define('PROT_THEME_PATH', PROT_INSTALL_PATH . '/theme/render.php');

//bootstrapping
include(PROT_INSTALL_PATH . '/src/bootstrap.php');

session_name(preg_replace('/[^a-z\d]/i', '', __DIR__));
session_start();

$prot = array();
/**
 * Settings for the database.
 *
 */

// för localhost
$prot['database']['dsn']            = 'mysql:host=localhost;dbname=Movie;';
$prot['database']['username']       = 'root';
$prot['database']['password']       = 'root';
$prot['database']['driver_options'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'");

/*
$prot['database']['dsn']            = 'mysql:host=blu-ray.student.bth.se;dbname=guhu14;';
$prot['database']['username']       = 'guhu14';
$prot['database']['password']       = '5v38d7J=';
$prot['database']['driver_options'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'");
*/
/**
 * Site wide settings.
 *
 */

$anv = new CUser(new CDatabase($prot['database']));
$prot['lang']         = 'sv';
$prot['title_append'] = ' | Protein Rental Movies';

$prot['header'] = <<<EOD

Protein Rental Movies
Watch some Movies and drink some Protein

<form action="movie_view.php" method="get">

Filmsök: <input type='search' name='title'/><input type='submit' name='search' value='Sök'/>

</form>

EOD;
if($anv->IsAuthenticated()){
    $output = "Du är inloggad som: {$anv->GetAcronym()}";
}
else {
    $output = "Du är ej inloggad, logga in här";

}
$prot['footer'] = <<<EOD

Copyright (c) Guanglei Huang (guanglei.huang@gmail.com) | Protein på GitHub | Unicorn | $output

EOD;

$prot['stylesheets'] = array('css/style.css','css/dice.css','css/navbar.css','css/figure.css', 'css/gallery.css', 'css/breadcrumb.css', 'css/forms.css');
$prot['favicon']    = 'favicon.ico';

$prot['navbar'] = array(
  'class' => 'nb-plain',
  'items' => array(
    'hem'         => array('text'=>'Start',         'url'=>'index.php', 'title' => 'Startsidan'),

    'movie'      => array('text'=>'Filmer', 'url'=>'movie_view.php', 'title' => 'Alla Filmer',
    //sub ))
        'submenu' => array(
            'items' => array(

            'item 1' => array('text'=>'Uppdatera Filmer', 'url'=>'movie_view_edit.php', 'title' => 'Updatera Film Information'),
            'item 2' => array('text'=>'Skapa', 'url'=>'movie_create.php', 'title' => 'Lägga till en Film'),
            'item 3' => array('text'=>'Radera', 'url'=>'movie_view_delete.php', 'title' => 'Radera en Film'),
        ), ), ),

          'content'     => array('text'=>'Nyheter',     'url'=>'view.php',      'title' => 'Se innehåll',

         'submenu' => array(
             'items' => array(
     'item 1'      => array('text'=>'Rea', 'url'=>'view.php?rea', 'title' => 'Rea produkter'),
     'item 2'      => array('text'=>'Nyheter från Protein RM', 'url'=>'view.php?nyheter', 'title' => 'Allt om Protein RM!'),
     'item 3'      => array('text'=>'Lägga till', 'url'=>'create.php', 'title' => 'Skapa ett Inlägg'),
     ), ), ),
    'dice' => array('text'=>'Tävling', 'url'=>'dice.php', 'title' => 'Tärningsspelet 100'),

    'about'     => array('text'=>'Om oss',     'url'=>'about.php', 'title' => 'Om Protein RM'),
    'login' => array('text'=>'Mitt Konto', 'url'=>'login.php', 'title' => 'Inloggning',
     //sub ))
        'submenu' => array(
            'items' => array(
    'item 1' => array('text'=>'Återställa FilmDB', 'url'=>'movie_reset.php', 'title' => 'Återställa Film Databas'),
    'item 2' => array('text'=>'Återställa NyheterDB', 'url'=>'content_reset.php', 'title' => 'Återställa Blogg Databas'),
    'item 3' => array('text'=>'Registrera dig', 'url'=>'register.php', 'title' => 'Skapa ett nytt användarkonto'),
    'item 4' => array('text'=>'Alla användare', 'url'=>'users.php', 'title' => 'Lista ut alla användare'),
    'item 5' => array('text'=>'Logga ut', 'url'=>'logout.php', 'title' => 'Logga ut'),
  ), ), ),

  ),

  'callback' => function($url) {
    if(basename($_SERVER['SCRIPT_FILENAME']) == $url) {
      return true;
    }
  }
);


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
// ReSharper disable InconsistentNaming

namespace IdmNet.Models
{
    /// <summary>
    /// HomepageConfiguration - These resources drive the homepage appearance in FIM Portal.
    /// </summary>
    public class HomepageConfiguration : IdmResource
    {
        /// <summary>
        /// Parameterless CTOR
        /// </summary>
        public HomepageConfiguration()
        {
            ObjectType = ForcedObjType = "HomepageConfiguration";
        }

        /// <summary>
        /// Build a HomepageConfiguration object from a IdmResource object
        /// </summary>
        /// <param name="resource">base class</param>
        public HomepageConfiguration(IdmResource resource)
        {
            Attributes = resource.Attributes;
            ObjectType = ForcedObjType = "HomepageConfiguration";
            if (resource.Creator == null)
                return;
            Creator = resource.Creator;
        }

        readonly string ForcedObjType;

        /// <summary>
        /// Object Type (can only be HomepageConfiguration)
        /// </summary>
        [Required]
        public override sealed string ObjectType
        {
            get { return GetAttrValue("ObjectType"); }
            set
            {
                if (value != ForcedObjType)
                    throw new InvalidOperationException("Object Type of HomepageConfiguration can only be 'HomepageConfiguration'");
                SetAttrValue("ObjectType", value);
            }
        }

        /// <summary>
        /// Image Url - Image url for the a given element.
        /// </summary>
        public string ImageUrl
        {
            get { return GetAttrValue("ImageUrl"); }
            set {
                SetAttrValue("ImageUrl", value);
            }
        }

        /// <summary>
        /// Is Configuration Type - This is an indication that this resource is a configuration resource.
        /// </summary>
        public bool? IsConfigurationType
        {
            get { return AttrToNullableBool("IsConfigurationType"); }
            set {
                SetAttrValue("IsConfigurationType", value.ToString());
            }
        }

        /// <summary>
        /// Navigation Url - URL for navigation when user clicks this item.
        /// </summary>
        [Required]
        public string NavigationUrl
        {
            get { return GetAttrValue("NavigationUrl"); }
            set {
                SetAttrValue("NavigationUrl", value);
            }
        }

        /// <summary>
        /// Order - Precedence of this item within a parent grouping
        /// </summary>
        [Required]
        public int Order
        {
            get { return AttrToInteger("Order"); }
            set {
                SetAttrValue("Order", value.ToString());
            }
        }

        /// <summary>
        /// Parent Order - Parent grouping for this home page resource.
        /// </summary>
        [Required]
        public int ParentOrder
        {
            get { return AttrToInteger("ParentOrder"); }
            set {
                SetAttrValue("ParentOrder", value.ToString());
            }
        }

        /// <summary>
        /// Region - Specifies where the item will be shown in the UI.
        /// </summary>
        [Required]
        public int Region
        {
            get { return AttrToInteger("Region"); }
            set {
                SetAttrValue("Region", value.ToString());
            }
        }

        /// <summary>
        /// Resource Count - Count resources associated with this item (optional)
        /// </summary>
        public string CountXPath
        {
            get { return GetAttrValue("CountXPath"); }
            set {
                SetAttrValue("CountXPath", value);
            }
        }

        /// <summary>
        /// Usage Keyword -
        /// </summary>
        public List<string> UsageKeyword
        {
            get { return GetAttrValues("UsageKeyword"); }
            set {
                SetAttrValues("UsageKeyword", value);
            }
        }

    }
}


text:
package com.fil.ap.springboot.constants;

public class Constants {

    public static final String PARAM_CONSUME = "consumer";

    private Constants() {

    }
}


text:
<?php
/**
 * CONTROLADOR en que cada usuario puede modificar su cuenta en la aplicación.
 *
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class UserModify extends CI_Controller {

    public function __construct() {
        parent::__construct();

        $this->load->helper('Formulario');
        $this->load->model('M_Provincias');
        $this->load->model('M_User');
        $this->load->library('form_validation');
        $this->load->library('L_Cart', 0, 'myCart');
    }

    /**
     * Muestra el formulario para modificar un usuario
     */
    public function index() {

        if (!SesionIniciadaCheck()) {
            redirect("404", 'Location', 301);
            return; //Sale de la función
        }

        $provincias = $this->M_Provincias->getProvincias();
        $datos = $this->M_User->getDatosModificar($this->session->userdata('username'));

        $select = CreaSelectMod($provincias, 'cod_provincia', $datos['cod_provincia']);

        $cuerpo = $this->load->view('V_UserModify', array(
                                                            'select' => $select,
                                                            'datos' => $datos), true);

        $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo, 'titulo' => 'Modificar Usuario', 'homeactive' => 'active'));
    }

    /**
     * Modifica un usuario si se han introducido correctamente los datos
     */
    public function Modificar() {

        if (SesionIniciadaCheck()) {
            $todocorrecto = TRUE;
            $cambiarclave = FALSE;

            $provincias = $this->M_Provincias->getProvincias();
            $select = CreaSelect($provincias, 'cod_provincia');

            $datos = $this->M_User->getDatosModificar($this->session->userdata('username'));

            //Establecemos los mensajes de errores
            $this->setMensajesErrores();
            //Establecemos reglas de validación para el formulario
            $this->setReglasValidacion();

            if ($this->form_validation->run() == FALSE) {//Validación de datos incorrecta
                $cuerpo = $this->load->view('V_UserModify', array(
                    'select' => $select,
                    'datos' => $datos), true);

                $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo,
                    'titulo' => 'Modificar Usuario',
                    'homeactive' => 'active'));

                $todocorrecto = FALSE;
            } else {

                if ($this->setRVcalven() == FALSE) {

                    $errorclavenuevo = '
¡Error!  Las contraseñas no pueden estar vacias1
';
                    $cuerpo = $this->load->view('V_UserModify', array(
                        'select' => $select,
                        'errorclavenuevo' => $errorclavenuevo,
                        'datos' => $datos), true);
                    $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo, 'titulo' => 'Modificar Usuario',
                        'homeactive' => 'active'));

                    $todocorrecto = FALSE;
                }
                if ($this->setRVcalverep() == FALSE) {

                    $errorclaverep = '
¡Error!  Las contraseñas no pueden estar vacias2
';
                    $cuerpo = $this->load->view('V_UserModify', array(
                        'select' => $select,
                        'errorclaverep' => $errorclaverep,
                        'datos' => $datos), true);
                    $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo, 'titulo' => 'Modificar Usuario',
                        'homeactive' => 'active'));

                    $todocorrecto = FALSE;
                }

                $cambiarclave = TRUE;
                if (!claves_check($this->input->post('clave_nueva'), $this->input->post('rep_clave_nueva'))) {

                    $errorclave = '
¡Error!  Las contraseñas no son iguales
';
                    $cuerpo = $this->load->view('V_UserModify', array(
                        'select' => $select,
                        'errorclave' => $errorclave,
                        'datos' => $datos), true);
                    $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo, 'titulo' => 'Modificar Usuario',
                        'homeactive' => 'active'));

                    $todocorrecto = FALSE;
                }

                if ($todocorrecto) {

                    //Crea el array de los datos a insertar en la tabla usuario
                    foreach ($this->input->post() as $key => $value) {
                        if ($key == 'clave_nueva' && $cambiarclave) {
                            $data['clave'] = password_hash($value, PASSWORD_DEFAULT);
                        } else if ($key == 'clave' && !$cambiarclave) {
                            $data['clave'] = password_hash($value, PASSWORD_DEFAULT);
                        }

                        if ($key != 'rep_clave_nueva' && $key != 'GuardarUsuario' && $key != 'clave_nueva' && $key != 'clave') {
                            $data[$key] = $value;
                        }
                    }
                    print_r('Nombre usuario:'.$this->input->post('nombre_usu'));

                    $datos = array('username'=>$this->input->post('nombre_usu'));
                    print_r($datos);
                    $this->session->set_userdata($datos);
                    $this->M_User->updateUsuario($this->session->userdata('userid'),$data); //Inserta en la tabla usuario
                    $cuerpo = $this->load->view('V_UserModifyok', array(), true);
                    $this->load->view('V_Plantilla', Array('cuerpo' => $cuerpo, 'titulo' => 'Modificar Usuario',
                        'homeactive' => 'active'));
                }
            }
        }
    }

    /**
     * Devuelve si un nombre de usuario ya está guardado en la base de datos
     * @param String $nombre_usu Nombre del usuario
     * @return boolean
     */
    function nombreUsuRepetido_check($nombre_usu) {

        $countNomUsuario = $this->M_User->getCount_NombreUsuarioModificar($nombre_usu, $this->session->userdata('userid'));

        if ($countNomUsuario == 0) {//No existen nombres guardados
            return TRUE;
        } else {
            return FALSE;
        }
    }

    /**
     * Devuelve si la clave introducida corresponde con la guardada en la base de datos
     * @return boolean
     */
    function clavecorrecta_check() {

        if (password_verify($this->input->post('clave'), $this->M_User->getClave($this->session->userdata('username'))))
            return TRUE;
        else
            return FALSE;
    }

    /**
     * Establece los mensajes de error que se mostrarán si no se valida correctamente el formulario
     */
    function setMensajesErrores() {
        $this->form_validation->set_error_delimiters('
¡Error! ', '
');
        $this->form_validation->set_message('required', 'El campo %s está vacío');
        $this->form_validation->set_message('valid_email', 'Formato de correo electrónico incorrecto');
        $this->form_validation->set_message('integer', 'El campo %s debe ser un número de 5 dígitos');
        $this->form_validation->set_message('exact_length', 'El campo %s debe tener %s caracteres');
        $this->form_validation->set_message('integer', 'El campo %s debe ser númerico');
        $this->form_validation->set_message('nombreUsuRepetido_check', 'El nombre de usuario ya existe');
        $this->form_validation->set_message('clavecorrecta_check', 'La contraseña es incorrecta');
    }

    /**
     * Establece las reglas que deben seguir cada campo del formulario
     */
    function setReglasValidacion() {
        $this->form_validation->set_rules('nombre_usu', 'nombre de usuario', 'required|callback_nombreUsuRepetido_check');
        $this->form_validation->set_rules('clave', 'contraseña', 'required|callback_clavecorrecta_check');
        $this->form_validation->set_rules('correo', 'correo electrónico', 'required|valid_email');
        $this->form_validation->set_rules('direccion', 'dirección', 'required');
        $this->form_validation->set_rules('cp', 'CP', 'required|integer|exact_length[5]');
        $this->form_validation->set_rules('cod_provincia', 'provincia', 'required');
    }

    public function setRVcalven(){

       $this->form_validation->set_rules('clave_nueva', 'Contraseña Nueva', 'required');
       if($this->form_validation->run() == FALSE){
           return FALSE;
       }else{
           return TRUE;
       }
    }
    public function setRVcalverep(){

      $this->form_validation->set_rules('rep_clave_nueva', 'Repita Contraseña Nueva', 'required');
       if($this->form_validation->run() == FALSE){
           return FALSE;
       }else{
           return TRUE;
       }
    }

}


text:
<!DOCTYPE html>

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

    <title>Ian Nei's Portfolio</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/landing-page.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                Ian Nei

                        Top

                        Portfolio

                        Contact

Ian Nei

Full Stack Web Developer

SmartBART

A compilation of self-updating BART arrival times sorted by individual station or route that prunes itself of arrival times which have already passed. Users can view live tweets from BART's twitter and leave general tips about stations or lines as well as leave real time messages to inform other users of line specific incidents.

Source of Truth

A programmer's Rosetta Stone where anyone can see how to write basic programming statements in various programming languages. Links to coding conventions as well as basic info on statements are included for further learning.

Combo Database

A more user friendly database of combos for fighting game fans. Users can easily create detailed and well formatted entries.

Contact Me:

                             Email

                             Github

                             Linkedin


text:
namespace Google.Cloud.PubSub.V1.Snippets
{
    // [START pubsub_v1_generated_SubscriberServiceApi_CreateSnapshot_sync_flattened]
    using Google.Cloud.PubSub.V1;

    public sealed partial class GeneratedSubscriberServiceApiClientSnippets
    {
        /// <summary>Snippet for CreateSnapshot</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateSnapshot()
        {
            // Create client
            SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
            string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
            // Make the request
            Snapshot response = subscriberServiceApiClient.CreateSnapshot(name, subscription);
        }
    }
    // [END pubsub_v1_generated_SubscriberServiceApi_CreateSnapshot_sync_flattened]
}


text:
import { Component } from '@angular/core';

@Component({
  selector: 'sky-test-cmp',
  template: ''
})
export class CardTestComponent {
  public cardSelected = false;

  public showCheckbox = true;
}


text:
import requests
from bs4 import BeautifulSoup

url = "http://ssb.mtsu.edu/pls/PROD/bwskfcls.p_sel_crse_search"
r = requests.get(url)
soup = BeautifulSoup(r.content)

print soup.prettify()


text:
dalek-browser-phantomjs
=======================

> DalekJS browser plugin for PhantomJS

[![Build Status](https://travis-ci.org/dalekjs/dalek-browser-phantomjs.png)](https://travis-ci.org/dalekjs/dalek-browser-phantomjs)
[![Build Status](https://drone.io/github.com/dalekjs/dalek-browser-phantomjs/status.png)](https://drone.io/github.com/dalekjs/dalek-browser-phantomjs/latest)
[![Dependency Status](https://david-dm.org/dalekjs/dalek-browser-phantomjs.png)](https://david-dm.org/dalekjs/dalek-browser-phantomjs)
[![devDependency Status](https://david-dm.org/dalekjs/dalek-browser-phantomjs/dev-status.png)](https://david-dm.org/dalekjs/dalek-browser-phantomjs#info=devDependencies)
[![NPM version](https://badge.fury.io/js/dalek-browser-phantomjs.png)](http://badge.fury.io/js/dalek-browser-phantomjs)
[![Coverage](http://dalekjs.com/package/dalek-browser-phantomjs/master/coverage/coverage.png)](http://dalekjs.com/package/dalek-browser-phantomjs/master/coverage/index.html)
[![unstable](https://rawgithub.com/hughsk/stability-badges/master/dist/unstable.svg)](http://github.com/hughsk/stability-badges)
[![Stories in Ready](https://badge.waffle.io/dalekjs/dalek-browser-phantomjs.png?label=ready)](https://waffle.io/dalekjs/dalek-browser-phantomjs)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dalekjs/dalek-browser-phantomjs/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)

[![NPM](https://nodei.co/npm/dalek-browser-phantomjs.png)](https://nodei.co/npm/dalek-browser-phantomjs/)
[![NPM](https://nodei.co/npm-dl/dalek-browser-phantomjs.png)](https://nodei.co/npm/dalek-browser-phantomjs/)

## Ressources

[API Docs](http://dalekjs.com/package/dalek-browser-phantomjs/master/api/index.html) -
[Trello](https://trello.com/b/UjcpWj7v/dalek-browser-phantomjs) -
[Code coverage](http://dalekjs.com/package/dalek-browser-phantomjs/master/coverage/index.html) -
[Code complexity](http://dalekjs.com/package/dalek-browser-phantomjs/master/complexity/index.html) -
[Contributing](https://github.com/dalekjs/dalek-browser-phantomjs/blob/master/CONTRIBUTING.md) -
[User Docs](http://dalekjs.com/docs/phantomjs.html) -
[Homepage](http://dalekjs.com) -
[Twitter](http://twitter.com/dalekjs)

## Docs
This module is a browser plugin for [DalekJS](//github.com/dalekjs/dalek).
It provides a browser launcher as well the PhantomJS browser itself.

The browser plugin comes bundled with the DalekJS base framework.

You can use the browser plugin beside others (it is the default)
by adding a config option to the your Dalekfile:

```js
"browsers": ["phantomjs", "chrome"]
```

Or you can tell Dalek that it should test in this & another browser via the command line:

```
$ dalek mytest.js -b phantomjs,chrome
```

## Help Is Just A Click Away

### #dalekjs on FreeNode.net IRC

Join the `#daleksjs` channel on [FreeNode.net](http://freenode.net) to ask questions and get help.

### [Google Group Mailing List](https://groups.google.com/forum/#!forum/dalekjs)

Get announcements for new releases, share your projects and ideas that are
using DalekJS, and join in open-ended discussion that does not fit in
to the Github issues list or StackOverflow Q&A.

**For help with syntax, specific questions on how to implement a feature
using DalekJS, and other Q&A items, use StackOverflow.**

### [StackOverflow](http://stackoverflow.com/questions/tagged/dalekjs)

Ask questions about using DalekJS in specific scenarios, with
specific features. For example, help with syntax, understanding how a feature works and
how to override that feature, browser specific problems and so on.

Questions on StackOverflow often turn in to blog posts or issues.

### [Github Issues](//github.com/dalekjs/dalek-browser-phantomjs/issues)

Report issues with DalekJS, submit pull requests to fix problems, or to
create summarized and documented feature requests (preferably with pull
requests that implement the feature).

**Please don't ask questions or seek help in the issues list.** There are
other, better channels for seeking assistance, like StackOverflow and the
Google Groups mailing list.

![DalekJS](https://raw.github.com/dalekjs/dalekjs.com/master/img/logo.png)

## Legal FooBar (MIT License)

Copyright (c) 2013 Sebastian Golasch

Distributed under [MIT license](https://github.com/dalekjs/dalek-browser-phantomjs/blob/master/LICENSE-MIT)


text:
/**
 * Module dependencies.
 */

// default port
var defaultPort = 3000;

// include essential modules
var express = require('express'),
	http = require('http'),
	path = require('path'),
	user = require('./routes/user'),
	msg = require('./routes/msg'),
	project = require('./routes/project');

// connect to database
var db = require('mongoskin').db('mongodb://localhost/todo');

// create socket, listening port #3001
// var socketio = require('socket.io').listen(3001);

// initialize express
var app = express();

// all environments
app.set('port', process.env.PORT || defaultPort);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
	app.use(express.errorHandler());
}

app.get('/', function(req, res) {
	res.sendfile(__dirname + '/public/index.html');
});

// create server, listening to port #3000
http.createServer(app).listen(app.get('port'), function() {
	console.log('Express server listening on port ' + app.get('port'));
});

// RESTFUL API
app.get("/user", user.getUserList(db));
app.get("/user/:uid", user.getUser(db));
app.post("/user", user.addUser(db));
app.put("/user/:uid", user.updateUser(db));
app.del("/user/:uid", user.deleteUser(db));

app.get("/project", project.getProjectList(db));
app.get("/project/:pid", project.getProject(db));
app.get("/project/user/:uid", project.getProjectListByUid(db));
app.post("/project", project.addProject(db));
app.put("/project/:pid", project.updateProject(db));
app.del("/project/:pid", project.deleteProject(db));

app.get("/project/:pid/:sid", project.getStage(db));
app.post("/project/:pid", project.addStage(db));
app.put("/project/:pid/:sid", project.updateStage(db));
app.del("/project/:pid/:sid", project.deleteStage(db));

app.get("/project/:pid/:sid/:tid", project.getTask(db));
app.post("/project/:pid/:sid", project.addTask(db));
app.put("/project/:pid/:sid/:tid", project.updateTask(db));
app.del("/project/:pid/:sid/:tid", project.deleteTask(db));

app.get("/msg/:uid", msg.getMsgList(db));
app.post("/msg", msg.addMsg(db));


text:
``` shell

sh ./build/build-rpm.sh

mkdir ~/devsuite-repo

cp ~/rpmbuild/RPMS/*.rpm ~/devsuite-repo

createrepo ~/devsuite-repo

sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms

sudo cat > /etc/yum.repos.d/rh-eclipse46-devstudio.repo <<END \
[rh-eclipse46-devstudio-stable-10.x]
name=rh-eclipse46-devstudio-stable-10.x
baseurl=https://devstudio.redhat.com/static/10.0/stable/rpms/x86_64/
enabled=1
gpgcheck=1
upgrade_requirements_on_install=1
metadata_expire=24h
END

sudo cat > /etc/yum.repos.d/devsuite.repo <<END \
[devsuite]
name=Red Hat Development Suite Repository
baseurl=file:///home/eskimo/devsuite-repo
gpgkey=https://www.redhat.com/security/data/a5787476.txt
enabled=1
gpgcheck=1
END

sudo yum install devsuite
```

[1] https://access.redhat.com/sites/default/files/attachments/rpm_building_practice_10082013.pdf
[2] http://tools.jboss.org/blog/10.2.0.rpm-installation.html


text:
package com.sun.jini.test.share;

import net.jini.core.lease.Lease;
import com.sun.jini.qa.harness.QAConfig;

/**
 * TrackingOwner for leases who have a membership expiration of
 * Lease.FOREVER
 */
public class ForeverOwner extends TrackingOwner {
    /**
     * True if the associated lease should be added to the set with
     * the two arg form of renewFor
     */
    final private boolean isTwoArg;

    /**
     * Simple constructor
     * @param initialExpiration Initial expiration time for lease.
     * @param maxExtension Maximum time this owner will be willing to extend
     *                     the lease
     * @param slop Allowable variance from desired expiration when making a
     *             renewal request.
     * @param desiredRenewal
     *             Expect value of the renewDuration parameter
     * @param notifyOnFailure
     *             Object to notify if there is a failure
     * @param isTwoArg Should the assocated lease be registered
     *             with the one or two arg form
     * @param config QAConfig object
     */
    public ForeverOwner(long initialExpiration, long maxExtension,
			long slop, long desiredRenewal, Object notifyOnFailure,
			boolean isTwoArg, QAConfig config)
    {
	super(initialExpiration, maxExtension, Lease.FOREVER,
	      slop, desiredRenewal, notifyOnFailure, config);

	this.isTwoArg = isTwoArg;
    }

    // Inherit java doc from super type
    boolean isTwoArg() {
	return isTwoArg;
    }

    // Inherit java doc from super type
    protected boolean isValidExtension(long extension) {
	// Since the desired expiration is forever, the LRS
	// should always be asking for exactly desiredRenewal, or
	// something when added to now is close to Long.MAX_VALUE
	if (extension == desiredRenewal) {
	    return true;
	}

	final long requestedExpiration = now + extension;
	if (requestedExpiration < 0)
	    // They asked for at least FOREVER
	    return true;

	if ((Long.MAX_VALUE - requestedExpiration) < slop)
	    return true;

	setRsltIfNeeded("Forever Owner:LRS asked for " + extension +
			" when it should have asked for " + desiredRenewal);
	return false;
    }
}


text:
/**
 * Generated bundle index. Do not edit.
 */
export * from './index';
export { COMPILER_PROVIDERS as ɵangular_packages_platform_browser_dynamic_testing_testing_a, TestingCompilerFactoryImpl as ɵangular_packages_platform_browser_dynamic_testing_testing_b } from './src/compiler_factory';


text:
git flux rc start|finish|review <name> [-h]

# rc

handle lifecycle of release-candidates.

## available actions

start <name> [-h]

start a release-candidate; create a local branch and push it to the remote.

the branch name will be composed of the pre-configured release-candidate prefix and the passed name.

it is advised that name will be the next version, e.g. '1.1.0'.

finish <name> [-h]

finish an existing release-candidate; delete its local and remote branches, for good.

review <name> [-h]

open a pull request from the release-candidate branch to its base branch, i.e. the integration branch, for review in github.

---
created with styli.sh


text:
/*global define*/
///////////////////////////////////////////////////////////////////////////
// Copyright © 2015 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define({
  "units": {
    "miles": {
      "displayText": "Milje",
      "acronym": "mi"
    },
    "kilometers": {
      "displayText": "Kilometri",
      "acronym": "km"
    },
    "feet": {
      "displayText": "Stope",
      "acronym": "ft"
    },
    "meters": {
      "displayText": "Metri",
      "acronym": "m"
    }
  },
  "searchSetting": {
    "searchSettingTabTitle": "Postavke pretrage",
    "defaultBufferDistanceLabel": "Postavi podrazumevano rastojanje zone bliskosti",
    "maxBufferDistanceLabel": "Postavi maksimalno rastojanje zone bliskosti",
    "bufferDistanceUnitLabel": "Jedinice rastojanja zone bliskosti",
    "defaultBufferHintLabel": "Napomena: postavite podrazumevanu vrednost za klizač zone bliskosti",
    "maxBufferHintLabel": "Napomena: postavite maksimalnu vrednost za klizač zone bliskosti",
    "bufferUnitLabel": "Napomena: definišite jedinicu za kreiranje zone bliskosti",
    "selectGraphicLocationSymbol": "Simbol adresa ili lokacije",
    "graphicLocationSymbolHintText": "Napomena: Simbol za traženu adresu ili lokaciju na koju je kliknuto",
    "fontColorLabel": "Izaberite boju fonta za rezultate pretrage",
    "fontColorHintText": "Napomena: boja fonta za rezultate pretrage",
    "zoomToSelectedFeature": "Zumiraj do izabranog geooobjekta",
    "zoomToSelectedFeatureHintText": "Napomena: zumirajte do izabranog geoobjekta umesto zone bliskosti",
    "intersectSearchLocation": "Vrati poligon(e) koji se seku",
    "intersectSearchLocationHintText": "Napomena: vratite poligon(e) koji sadrži(e) traženu lokaciju, pre poligona u okviru zone bliskosti",
    "bufferVisibilityLabel": "Podesi vidljivost zone bliskosti",
    "bufferVisibilityHintText": "Napomena: zona bliskosti će biti prikazana na mapi",
    "bufferColorLabel": "Podesi simbol zone bliskosti",
    "bufferColorHintText": "Napomena: izaberite boju i prozirnost zone bliskosti",
    "searchLayerResultLabel": "Nacrtaj samo rezultate izabranog sloja",
    "searchLayerResultHint": "Napomena: samo izabrani sloj u rezultatima pretrage će se iscrtati na mapi"
  },
  "layerSelector": {
    "selectLayerLabel": "Izaberite sloj(eve) pretrage",
    "layerSelectionHint": "Napomena: koristite dugme postavke da biste izabrali sloj(eve)",
    "addLayerButton": "Postavi"
  },
  "routeSetting": {
    "routeSettingTabTitle": "Postavke smernica",
    "routeServiceUrl": "Servis za rutiranje",
    "buttonSet": "Postavi",
    "routeServiceUrlHintText": "Napomena: kliknite na 'Postavi' da biste potražili i izabrali servis za rutiranje",
    "directionLengthUnit": "Jedinice dužine pravca",
    "unitsForRouteHintText": "Napomena: koristi se za prikazivanje jedinica za rutiranje",
    "selectRouteSymbol": "Izaberite simbol za prikaz rute",
    "routeSymbolHintText": "Napomena: koristi se za prikaz simbola linije rute",
    "routingDisabledMsg": "Da biste omogućili uputstva za navigaciju postarajte se da je rutiranje omogućeno u stavci ArcGIS Online."
  },
  "networkServiceChooser": {
    "arcgislabel": "Dodaj iz ArcGIS Online",
    "serviceURLabel": "Dodaj URL adresu servisa",
    "routeURL": "URL adresa rutiranja",
    "validateRouteURL": "Proveri valjanost",
    "exampleText": "Primer",
    "hintRouteURL1": "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/",
    "hintRouteURL2": "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",
    "invalidRouteServiceURL": "Navedite važeći servis za rutiranje.",
    "rateLimitExceeded": "Prekoračeno je ograničenje stope. Pokušajte ponovo kasnije.",
    "errorInvokingService": "Korisničko ime ili lozinka su nevažeći."
  },
  "errorStrings": {
    "bufferErrorString": "Unesite važeću numeričku vrednost.",
    "selectLayerErrorString": "Izaberite sloj(eve) za pretragu.",
    "invalidDefaultValue": "Podrazumevano rastojanje zone bliskosti ne može da bude prazno. Navedite rastojanje zone bliskosti",
    "invalidMaximumValue": "Maksimalno rstojanje zone bliskosti ne može da bude prazno. Navedite rastojanje zone bliskosti",
    "defaultValueLessThanMax": "Navedite podrazumevano rastojanje zone bliskosti unutar maksimalnog ograničenja",
    "defaultBufferValueGreaterThanZero": "Navedite podrazumevano rastojanje zone bliskosti veće od 0",
    "maximumBufferValueGreaterThanZero": "Navedite maksimalno rastojanje zone bliskosti veće od 0"
  },
  "symbolPickerPreviewText": "Pregledaj:"
});


text:
<!DOCTYPE html>

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

    <title>Children's City - n montano</title>
    <meta name="description" content="…shivering, so cold…    …rising up, he could      see–Trussaydn. And the smiling face of Destinee. Bed moderately warmer. Sank down      below…    …bed much ...">

    <link href='https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,900,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="/css/main.css">
    <link rel="canonical" href="http://erikradio.github.io/2011/12/Children's-City">
    <link rel="alternate" type="application/rss+xml" title="n montano" href="http://erikradio.github.io/feed.xml">

        *

Children's City

<time datetime="2011-12-19T00:00:00-06:00" itemprop="datePublished">Dec 19, 2011</time>

…shivering, so cold…    …rising up, he could
      see–Trussaydn. And the smiling face of Destinee. Bed moderately warmer. Sank down
      below…    …bed much warmer now. The children are helping, making
      cardboard houses, a city spread out across the bed, around the convalescent Montano. Sinking
      below again…    …a neighborhood. Hmong, Spanish, and Somali. With each
      turn of the head, a new neighborhood. Bed is on fire. The victory of heat. Sinking…    …what is this bed? How strange, how foreign. What are these strange lands?
      But at least I can speak Hmong. Black quilts of cloud. I am a stranger and this is not a
      bed.

© erik radio 2016