text:
<?php

namespace PHPExiftool\Driver\Tag\DICOM;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class DetectorDescription extends AbstractTag
{

    protected $Id = '0018,7006';

    protected $Name = 'DetectorDescription';

    protected $FullName = 'DICOM::Main';

    protected $GroupName = 'DICOM';

    protected $g0 = 'DICOM';

    protected $g1 = 'DICOM';

    protected $g2 = 'Image';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Detector Description';

}

redpajama_set_name: RedPajamaGithub


text:
1) Logging Fundamentals
-----------------------

Resources:

http://architects.dzone.com/articles/high-performance-and-smarter
http://blog.codinghorror.com/the-problem-with-logging/
http://www.javacodegeeks.com/2011/01/10-tips-proper-application-logging.html
https://segment.io/docs/tutorials/client-side-vs-server-side/

Logging is considered as a Non Functional Requirements (NFRs) and often relegated to a back-burner/background/not-so-important activity while architecting, designing, developing and debugging applications, or even when enhancing applications.

After the application is ready, you deploy it to a production environment. Your application now is out of the development environment - and that means not having a nice IDE debugger at your service. It is now that you realize the importance of logs if you have not been using them before but rather just a nice IDE/tool debuger.

You start then logging your application but as you wade through a huge set of logs trying to debug any problem with your application, you realize that it is not a trivial task. It is boring, tedious and time-taking, and many times you feel as finding a needle in a haystack of logs! Or possibly you off-load this activity to your sub-ordinates workmates or an application maintenance team who equally curse you for their tedious and thankless job! Or possibly they would just throw up their hands, and you the specialized "architect/engineer" would get involved, muttering under your breath how your skills are being wasted away. Logging information can serve different purposes, as for example:

  * When a user encounters a critical error, I want to be warned immediatly with an email. I should also be able to trace the source of the error, and retrieve all the needed data to reproduce it.

  * When a new account is created, I want to be warned immediatly, so I can check that everything is alright.

  * When a new ticket is sold, keep me informed just to make sure all is right.

  * ...

Most of us know the basics about logging:

  * there are various logging levels which can be turned on or off at will
  * there are log categories that allow you to organize your logs
  * there are logging frameworks that can direct logs to various destinations such as Files, Databases, ... etc.

But  What about planning our logs content and format? What about understanding how logging affects our system quality attributes as performance? What about setting up access rules to logs? What about stablishing a clear workflow when dealing with logs (logging discipline)? Some important points about logging are:

  * Logs content and format

    It's important to define the format your logs will be exposing so it can be then easily parsed by other tools. A very common format is that of using a JSON record per line in the log which can be understood by many logging parsers out there. Another important point is the content your going to include within your logs. Try avoid verbose logs, for instance log ID's objects instead of full object content. Avoid logging falsy values as null, undefined, false, ... when in most of cases they say nothing. Be concise and descriptive.

  * Performance

    Nearly 90% of the applications, excessive logging has been found to have a very detrimental effect on performance. Logging is an I/O intensive activity and can get in the way of the application's performance, particularly when logging is done in the traditional way, that is, synchronously. Use performance benchmarking exercise to determine logging levels you should use at production environment. At production environment never use debug level. Resist the temptation to log source location information at runtime as linenumber, method, class name, ...etc. Use error codes instead of error messages. Then set a static file to map what those error codes actually mean. Avoid recording errors with long stack traces repeatedly. Do not use logging as a replacement for other time monitoring strategies., use performance benchmarking instead.

  * Security

    Audit logs are a special class of logs that enable security auditing of the application, and are used to track actions of users. This is an example of how logging aids security practices. However, if logs carry sensitive information such as passwords of user accounts, they may expose a system vulnerability. Logging may aid developer's monitoring and debugging of an application but may also expose the internal architecture of the application which is certainly not desirable. In today's cloud application environments, where applications may be hosted on public clouds, such vulnerabilities can pose risks to the Intellectual Property of the application owner. Also remember to set rules to determine who can access your logs.

  * Scalability and high availability

    When an application is scaled out or is enabled for an active-passive configuration for availability, there are multiple instances of the application and the strategy of logging becomes important. Would the application support or development team like to gather logs from 10 different machines or directories or have a centralized location for collecting logs? This is where centralized distributed logging becomes essential. In a clustered environment, logs should reflect the components, modules, subsystems and even process instances from where they emerged. This would also have the extremely beneficial side effect of moving the I/O to a separate machine so that the performance of the application is not impeded by logging I/O.

  * Recoverability

    Major databases like Oracle already use redo logs to ensure recoverability of database failures. Applications may also borrow a leaf on redo logs and use them for system recoverability if required.

  * Error Handling and Fault tolerance

    In most applications, logging is one of the, or sometimes only measure taken for error handling. In cases of recurrent errors such as unavailability of Mail server or even database for long periods of time, there is no benefit gained and even much harm incurred by logging the error repeatedly and frequently, especially with huge exception stack traces, due to increased I/O activity. In the process, one may discover that important logs that were important for analyzing a week old frustrating issue have been rolled over. This approach only makes a bad situation worse. Other point to consider is, What is the logging frameworks or some logging message itself is not working? Avoid logging exceptions

  * Storage Capacity

    While doing capacity sizing of an application, architects would do well to consider the size of logs that would be generated by the application during production and estimate the disk space required, the provisioning of centralized file system and so on. For centralized logging in a distributed environment, it is also relevant to estimate the size of log objects distributed over the network to a remote machine.

  ------------------
  1.1) Tips
  ------------------

    1) Avoid "let's log everything we possibly can". Excessive is bad, same as for excessive comments, you should log good enough, but avoid excessive logging.

    2) The more you log, the less you can find.

    3) "If it's worth saving to a logfile, it's worth showing in the user interface": Use some kind of GUI!

    4) Logging isn't free (performance hits)

    5) Logging means more code

    6) Categorize logs with the same care as you would do for modularizing your application

    7) Make everyone on your team to agree on the exact definitions of FATAL, ERROR, DEBUG, INFO, and whatever other logging levels you have defined.

    8) For production try to only log the most heinous serial-killer mass-murderer type issues.

-----------------------
2) Logging Frameworks
-----------------------

log4js: https://github.com/nomiddlename/log4js-node
winston: https://github.com/flatiron/winston
bunyan: https://github.com/trentm/node-bunyan
logmagic: https://github.com/pquerna/node-logmagic
ln: https://github.com/wood1986/ln
...

Lets identify a few requirements which we can use to pit the frameworks against each other:

  * Timestamp each log line. This one is pretty self explanatory – you should be able to tell when each log entry occured.

  * Logging format should be easily digestible by humans as well as machines.

  * Allows for multiple configurable destination streams. For example, you might be writing trace logs to one file but when an error is encountered, write to the same file, and then send an email at the same time.

  * Transport add-ons available. You want to move from one stream to another in the future. For instance, you want to move from loggly to logstrash. If the framework support transport plugins you can do it totally transparent.

Winston cons:

  * Formatting
  * Performance (check benchmarks)
  * Dissasters when rotating files in cluster

Winston profits:

  * Transporters (even IRC transporter)
  * Profiling
  * Querying
  * Logs Categories

bunyan cons:

  * Transporters (not so many as with winston)
  * Dissasters when rotating files in cluster

bunyan profits:

  * Formatting
  * Serializers
  * DTrace
  * Logs Categories & Child logs
  * CLI

-----------------------------
3) Logging Strategies Adopted
-----------------------------

  A) One log per application scope (core, store, tickets, shell, ... etc)

  B) Only 2 levels: DEBUG, ERROR

     DEBUG – Developers stuff. I will discuss later what sort of information deserves to be logged.

     ERROR – something terribly wrong had happened, that must be investigated immediately. No system can tolerate items logged on this level. Example: NPE, database unavailable, mission critical use case cannot be continued.

     Other possible levels not used for now:

     WARN – the process might be continued, but take extra caution. Actually I always wanted to have two levels here: one for obvious problems where work-around exists (for example: "Current data unavailable, using cached values") and second (name it: ATTENTION) for potential problems and suggestions. Example: "Application running in development mode" or "Administration console is not secured with a password". The application can tolerate warning messages, but they should always be justified and examined.

     INFO – Important business process has finished. In ideal world, administrator or advanced user should be able to understand INFO messages and quickly find out what the application is doing. For example if an application is all about booking airplane tickets, there should be only one INFO statement per each ticket saying "[Who] booked ticket from [Where] to [Where]". Other definition of INFO message: each action that changes the state of the application significantly (database update, external system request).

  C) Avoid verbose and much logs

  D) Do not use log for comments and do not use excessive comments - rely on code to tell the story instead of relying on comments to tell the story.

  E) Bunyan framework (though it can change in the future)

  F) Other logs (nginx, crontab, mongodb, ...etc) centralised with application logs

  G) Who is going to access logs? Create an specific user just for reading logs?

  H) Maximun size for logs 10MB, then rotate

  -----------------------------
  3.1) Development
  -----------------------------

  * Every log uses DEBUG level
  * console + file as streams/transporters for all levels.
  * GUI: Logio.org for real time GUI

  -----------------------------
  3.2) Production
  -----------------------------

  * Every log uses ERROR level
  * loggly or file + email as streams/transporters for ERROR level.
  * GUI: loggly (free plan)

-----------------------------
4) Futher Logging Strategies
-----------------------------

In production we could change the production logging configuration to support Logstash + Elasticsearch + Redis + Kibana (http://tips4admin.com/blog/2013/10/how-to-centralize-your-log-with-logstash-elasticsearch-redis-kibana-in-ubuntu-server/). We just need to change the stream to bunyan-logstrash in our node application and remove email stream since logstash will handle email for us.

Check also node-logstash (https://github.com/bpaquet/node-logstash) and bunyan-logstash(https://github.com/sheknows/bunyan-logstash)

Logstash is a log indexer built on top of elasticsearch. It aggregates logs from multiple sources and allows you to query them using the Apache Lucene query parser syntax.

In a different machine where our node application lives, we set up logstash server mode:

* set up redis-server
* set up elasticsearch
* set up logstash
* configure logstash

vim /etc/logstash/indexer.conf

# This is the logstash server index configuration.
# This file will be put in the same folder with logtash.jar file in the
# /etc/logtash/
# This takes information straight from redis and loads it into elasticsearch.

input {
  redis {
    host => "127.0.0.1"
    type => "redis-input"
    threads => 4
    # these settings should match the output of the agent
    data_type => "list"
    key => "logstash"

    # We use json_event here since the sender is a logstash agent
    format => "json_event"
  }
}

output {
  elasticsearch {
    host => "127.0.0.1"
  }
}

In the machine where our node application lives, we set up logstash client mode:

* set up logstash
* configure logstash

vim /etc/logtash/shipper.conf

input {
  stdin {
    type => "test"
  }
}

output {
  stdout { codec => rubydebug }
  redis { host => "logging.tips4admin.com" data_type => "list" key => "logstash" }
}

The Logstash configuration file above is really simple. It just get the log from console(stdin) and send to redis server(logging.tips4admin.com)

-----------------------------
5) Audit (Event Tracking)
-----------------------------

  * Note: Only in production environment

  -----------------------------
  5.1) Client Side
  -----------------------------

    * ga.js (Google Analytics)
    * HummingBird (http://hummingbirdstats.com/, https://github.com/mnutt/hummingbird)

  -----------------------------
  5.1) Server Side
  -----------------------------

    Note: Remember, tracking server side is suitable when dealing with: payment events, getting data from database, sensitive information, ... etc.

    A) Create a new log level called audit or reuse log level info as audit
    B) Use mongodb as stream to filter it later easily(here is when winston comes handly):

      https://gist.github.com/oroce/4052571
      https://github.com/Raynos/mongo-stream

      Example:

      var mongoCol = require( "mongo-col" ),
          mongoStream = require( "mongo-stream" ),
          restify = require( "restify" ),
          mongoInsertStream = mongoStream( mongoCol( "piped-collection", null, {
              dbOptions:{
                   safe: true
              }
          })),
          Logger = require( "bunyan" ),
          server = restify.createServer();

      var logger = new Logger({
          name: "pipe-into-mongodb",
          streams: [{
              type: "raw",
              stream: mongoInsertStream.insert({
                  safe: true
              })
          }]
      });

      server.on( "after", restify.auditLogger({
          log: logger
      }));

-----------------------------
6) Profiling
-----------------------------

In software engineering, profiling ("program profiling", "software profiling") is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. Most commonly, profiling information serves to aid program optimization.

-----------------------------
7) Others resources
-----------------------------

  * Sentry
  ...


text:
<?php

declare(strict_types=1);

namespace FluentDOM\DOM\Node {

  use FluentDOM\DOM\Element;
  use FluentDOM\DOM\Node;

  /**
   * Interface ParentNode
   * @property-read Element $firstElementChild
   * @property-read Element $lastElementChild
   * @property-read int $childElementCount
   */
  interface ParentNode extends Node, QuerySelector {

    public function prepend(...$nodes): void;

    public function append(...$nodes): void;
  }
}


text:
class AddZipToUserAddresses < ActiveRecord::Migration[6.0]
  def change
    add_column :user_addresses, :zip, :string
  end
end


text:
'''
Tests for gtfutils / query

- Slightly redundant with fetch test in test_gtf.py, but that's okay :)
'''

import os
import unittest

import ngsutils.gtf.query
from ngsutils.gtf import GTF

fname = os.path.join(os.path.dirname(__file__), 'test1.gtf')

class GTFQueryTest(unittest.TestCase):
    def testQuery(self):
        genes = list(ngsutils.gtf.query.gtf_query(GTF(fname, cache_enabled=False), 'chr1', 1000, 2000))
        self.assertEquals(str(genes[0]), 'foo1(iso1) chr1:1000-2500[+]')

if __name__ == '__main__':
    unittest.main()


text:
module Challah
  # A base class for storing session data in a browser cookie.
  #
  # To use a different storage method for persisting a session, just create
  # a new class that responds to +read+, +save+ and +destroy+
  class SimpleCookieStore

    def initialize(session)
      @session = session
    end

    def destroy
      clear
    end

    def inspect
      "#<SimpleCookieStore:0x#{ object_id.to_s(16) } valid=#{ existing? }>"
    end

    def read
      existing? ? cookie_values : nil
    end

    def save(token, user_id)
      @token = token
      @user_id = user_id

      write_cookies!
    end

    private

      def clear
        cookies.delete(session_cookie_name, domain: domain)
        cookies.delete(validation_cookie_name, domain: domain)
      end

      def cookie_values
        session_cookie && session_cookie.to_s.split(joiner)
      end

      def cookies
        request.cookie_jar
      end

      def default_cookie_prefix
        Challah.options[:cookie_prefix]
      end

      def domain
        request.session_options[:domain]
      end

      # Do the cookies exist, and are they valid?
      def existing?
        exists = false

        if session_cookie && validation_cookie
          session_tmp = session_cookie.to_s
          validation_tmp = validation_cookie.to_s

          if validation_tmp == validation_cookie_value(session_tmp)
            exists = true
          end
        end

        exists
      end

      def expiration
        @expiration ||= 1.month.from_now
      end

      def joiner
        "@"
      end

      def prefix
        @prefix ||= [ default_cookie_prefix, user_model_id ].compact.join("-")
      end

      def request
        raise "No Request Provided" unless @session && @session.request
        @session.request
      end

      def session_cookie
        cookies[session_cookie_name]
      end

      def session_cookie_name
        "#{ prefix }-s"
      end

      def session_cookie_value
        "#@token#{ joiner }#@user_id"
      end

      def user_model_id
        if @session && @session.user_model && @session.user_model.table_name != "users"
          Encrypter.md5(@session.user_model.table_name).slice(0..5)
        end
      end

      def validation_cookie
        cookies[validation_cookie_name]
      end

      def validation_cookie_name
        "#{ prefix }-v"
      end

      def validation_cookie_value(value = nil)
        value = session_cookie_value unless value
        Encrypter.md5(value)
      end

      def write_cookies!
        cookies[session_cookie_name] = {
          value:      session_cookie_value,
          expires:    expiration,
          secure:     false,
          httponly:   true,
          domain:     domain
        }

        cookies[validation_cookie_name] = {
          value:      validation_cookie_value,
          expires:    expiration,
          secure:     false,
          httponly:   true,
          domain:     domain
        }
      end

  end
end


text:
define(['config/config', 'logger', 'underscore', 'jquery', 'backbone',
        'data/EntityData',
        'utils/SystemMessages', 'utils/LocalMessages', 'utils/InputValidation', 'utils/EntityHelpers',
        'text!templates/modal/link_add_modal.tpl'], function(appConfig, Logger, _, $, Backbone, EntityData, SystemMessages, LocalMessages, InputValidation, EntityHelpers, LinkAddTemplate){
    return Backbone.View.extend({
        events: {
            'submit form' : 'submitForm',
            'hide.bs.modal' : 'hideBsModal',
            'click .btn-primary' : 'submitForm',
            'keyup input#linkLabel' : 'revalidateLabel',
            'keyup textarea#linkDescription' : 'revalidateDescription',
            'shown.bs.modal' : 'triggerAutofocus'
        },
        LOG: Logger.get('LinkAddModalView'),
        initialize: function() {
            this.localMessagesSelector = '.localMessages';
            this.linkAddModalSelector = '#linkAddModal';
            this.uriSelector = '#linkUri';
            this.labelInputSelector = '#linkLabel';
            this.descriptionSelector = '#linkDescription';
            this.descriptionMaxLength = appConfig.entityDescriptionMaxLength;
        },
        render: function() {
            this.$el.html(_.template(LinkAddTemplate, {
                rows: appConfig.modalDescriptionRows,
                descriptionMaxLength: this.descriptionMaxLength
            }));

            return this;
        },
        showModal: function() {
            this.$el.find(this.linkAddModalSelector).modal('show');
        },
        hideModal: function() {
            this.$el.find(this.linkAddModalSelector).modal('hide');
        },
        submitForm: function(e) {
            e.preventDefault();

            this.disableDialog();

            var that = this;

            LocalMessages.clearMessages(this.$el.find(this.localMessagesSelector));

            var validateSuccess = true;

            if ( !this.validateUri() ) {
                validateSuccess = false;
            }
            if ( !this.validateLabel() ) {
                validateSuccess = false;
            }
            if ( !this.validateDescription() ) {
                validateSuccess = false;
            }

            if ( !validateSuccess ) {
                this.enableDialog();
                return false;
            }

            var uri = this.$el.find(this.uriSelector).val(),
                label = this.$el.find(this.labelInputSelector).val(),
                description = this.$el.find(this.descriptionSelector).val(),
                promise = null;

            promise = EntityData.addLink({
                link: uri,
                label: label,
                description: description
            });

            promise.done(function(result) {
                that.enableDialog();
                that.hideModal();
                SystemMessages.addSuccessMessage('New Link has been added.');

                EntityHelpers.triggerEntityAddedEvent(result);
            }).fail(function(f) {
                that.enableDialog();
                LocalMessages.addDangerMessage(that.$el.find(that.localMessagesSelector), 'A Link could not be added!');
            });
        },
        hideBsModal: function(e) {
            if ( this.formDisabled === true ) {
                e.preventDefault();
            } else {
                this.cleanForm();
            }
        },
        cleanForm: function() {
            var uriElement = this.$el.find(this.uriSelector),
                labelElement = this.$el.find(this.labelInputSelector),
                descriptionElement = this.$el.find(this.descriptionSelector);

            LocalMessages.clearMessages(this.$el.find(this.localMessagesSelector));

            uriElement.val('');
            labelElement.val('');
            descriptionElement.val('');

            InputValidation.removeAlertsFromParent(uriElement);
            InputValidation.removeValidationStateFromParent(uriElement);

            InputValidation.removeAlertsFromParent(labelElement);
            InputValidation.removeValidationStateFromParent(labelElement);

            InputValidation.removeAlertsFromParent(descriptionElement);
            InputValidation.removeValidationStateFromParent(descriptionElement);
        },
        validateUri: function() {
            var element = this.$el.find(this.uriSelector),
                alertText = 'Url is required and sould be a valid URL!';

            return InputValidation.validateUrlInput(element, alertText);
        },
        validateLabel: function() {
            var element = this.$el.find(this.labelInputSelector),
                alertText = 'Label is required!';

            return InputValidation.validateTextInput(element, alertText);
        },
        revalidateLabel: function() {
            this.validateLabel();
        },
        validateDescription: function() {
            var element = this.$el.find(this.descriptionSelector),
                alertText = 'Maximum number of allowed characters exceeded!';

            return InputValidation.validateTextInputLength(element, this.descriptionMaxLength, alertText);
        },
        revalidateDescription: function() {
            this.validateDescription();
        },
        disableDialog: function() {
            this.formDisabled = true;
            this.$el.find('.modal-footer').find('button').prop('disabled', true);
            this.$el.find('.fa-spinner').show();
        },
        enableDialog: function() {
            this.formDisabled = false;
            this.$el.find('.modal-footer').find('button').prop('disabled', false);
            this.$el.find('.fa-spinner').hide();
        },
        triggerAutofocus: function() {
            this.$el.find(this.uriSelector).trigger('focus');
        }
    });
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2019 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<shadow oid="c0c010c0-d34d-b44f-f11d-333222444566"
    xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
    xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff">
    <name>uid=drake,ou=People,dc=example,dc=com</name>
    <resourceRef oid="ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff" />
    <objectClass>ri:inetOrgPerson</objectClass>
    <attributes>
        <ri:dn>uid=drake,ou=People,dc=example,dc=com</ri:dn>
        <ri:uid>drake</ri:uid>
        <ri:cn>Sir Francis Drake</ri:cn>
        <ri:givenName>Francis</ri:givenName>
        <ri:sn>Drake</ri:sn>
    </attributes>
</shadow>


text:
package com.hazelcast.hotrestart;

/**
 * Empty implementation of HotRestartService to avoid null checks. This will provide default behaviour when hot restart is
 * not available or not enabled.
 */
public class NoOpHotRestartService implements HotRestartService {
    private static final BackupTaskStatus NO_TASK_BACKUP_STATUS = new BackupTaskStatus(BackupTaskState.NO_TASK, 0, 0);

    @Override
    public void backup() {
    }

    @Override
    public void backup(long backupSeq) {
    }

    @Override
    public BackupTaskStatus getBackupTaskStatus() {
        return NO_TASK_BACKUP_STATUS;
    }

    @Override
    public void interruptLocalBackupTask() {
    }

    @Override
    public void interruptBackupTask() {
    }

    @Override
    public boolean isHotBackupEnabled() {
        return false;
    }
}


text:
<?php

namespace App\Modules\Events\Http\Controllers;

use App\Modules\Events\Event;
use BackController;
use Hover;
use HTML;
use ModelHandlerTrait;

class AdminEventsController extends BackController
{

    use ModelHandlerTrait;

    protected $icon = 'map-marker';

    public function __construct()
    {
        $this->modelClass = Event::class;

        parent::__construct();
    }

    public function index()
    {
        $this->indexPage([
            'sortby'    => 'starts_at',
            'tableHead' => [
                trans('app.id')         => 'id',
                trans('app.title')      => 'title',
                trans('app.starts_at')  => 'starts_at',
            ],
            'tableRow' => function(Event $event)
            {
                return [
                    $event->id,
                    raw(Hover::modelAttributes($event, ['creator', 'updated_at'])->pull()
                        .HTML::link('events/'.$event->id.'/'.$event->slug, $event->title)),
                    $event->starts_at,
                ];
            }
        ]);
    }
}


text:
/**
 */
package org.afplib.afplib;

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

import org.eclipse.emf.common.util.Enumerator;

/**
 *
 * A representation of the literals of the enumeration 'Mapping Option Map Value',
 * and utility methods for working with them.
 *
 * @see org.afplib.afplib.AfplibPackage#getMappingOptionMapValue()
 * @model
 * @generated
 */
public enum MappingOptionMapValue implements Enumerator {
	/**
	 * The 'Const Position' literal object.
	 *
	 *
	 * @see #CONST_POSITION_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_POSITION(0, "ConstPosition", "ConstPosition"),

	/**
	 * The 'Const Positionandtrim' literal object.
	 *
	 *
	 * @see #CONST_POSITIONANDTRIM_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_POSITIONANDTRIM(16, "ConstPositionandtrim", "ConstPositionandtrim"),

	/**
	 * The 'Const Scaletofit' literal object.
	 *
	 *
	 * @see #CONST_SCALETOFIT_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_SCALETOFIT(32, "ConstScaletofit", "ConstScaletofit"),

	/**
	 * The 'Const Centerandtrim' literal object.
	 *
	 *
	 * @see #CONST_CENTERANDTRIM_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_CENTERANDTRIM(48, "ConstCenterandtrim", "ConstCenterandtrim"),

	/**
	 * The 'Const Imagepointtopel' literal object.
	 *
	 *
	 * @see #CONST_IMAGEPOINTTOPEL_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_IMAGEPOINTTOPEL(65, "ConstImagepointtopel", "ConstImagepointtopel"),

	/**
	 * The 'Const Imagepointtopelwithdoubledot' literal object.
	 *
	 *
	 * @see #CONST_IMAGEPOINTTOPELWITHDOUBLEDOT_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_IMAGEPOINTTOPELWITHDOUBLEDOT(66, "ConstImagepointtopelwithdoubledot", "ConstImagepointtopelwithdoubledot"),

	/**
	 * The 'Const Replicateandtrim' literal object.
	 *
	 *
	 * @see #CONST_REPLICATEANDTRIM_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_REPLICATEANDTRIM(80, "ConstReplicateandtrim", "ConstReplicateandtrim"),

	/**
	 * The 'Const Scaletofill' literal object.
	 *
	 *
	 * @see #CONST_SCALETOFILL_VALUE
	 * @generated
	 * @ordered
	 */
	CONST_SCALETOFILL(96, "ConstScaletofill", "ConstScaletofill");

	/**
	 * The 'Const Position' literal value.
	 *
	 *

	 * If the meaning of 'Const Position' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_POSITION
	 * @model name="ConstPosition"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_POSITION_VALUE = 0;

	/**
	 * The 'Const Positionandtrim' literal value.
	 *
	 *

	 * If the meaning of 'Const Positionandtrim' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_POSITIONANDTRIM
	 * @model name="ConstPositionandtrim"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_POSITIONANDTRIM_VALUE = 16;

	/**
	 * The 'Const Scaletofit' literal value.
	 *
	 *

	 * If the meaning of 'Const Scaletofit' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_SCALETOFIT
	 * @model name="ConstScaletofit"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_SCALETOFIT_VALUE = 32;

	/**
	 * The 'Const Centerandtrim' literal value.
	 *
	 *

	 * If the meaning of 'Const Centerandtrim' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_CENTERANDTRIM
	 * @model name="ConstCenterandtrim"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_CENTERANDTRIM_VALUE = 48;

	/**
	 * The 'Const Imagepointtopel' literal value.
	 *
	 *

	 * If the meaning of 'Const Imagepointtopel' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_IMAGEPOINTTOPEL
	 * @model name="ConstImagepointtopel"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_IMAGEPOINTTOPEL_VALUE = 65;

	/**
	 * The 'Const Imagepointtopelwithdoubledot' literal value.
	 *
	 *

	 * If the meaning of 'Const Imagepointtopelwithdoubledot' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_IMAGEPOINTTOPELWITHDOUBLEDOT
	 * @model name="ConstImagepointtopelwithdoubledot"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_IMAGEPOINTTOPELWITHDOUBLEDOT_VALUE = 66;

	/**
	 * The 'Const Replicateandtrim' literal value.
	 *
	 *

	 * If the meaning of 'Const Replicateandtrim' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_REPLICATEANDTRIM
	 * @model name="ConstReplicateandtrim"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_REPLICATEANDTRIM_VALUE = 80;

	/**
	 * The 'Const Scaletofill' literal value.
	 *
	 *

	 * If the meaning of 'Const Scaletofill' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #CONST_SCALETOFILL
	 * @model name="ConstScaletofill"
	 * @generated
	 * @ordered
	 */
	public static final int CONST_SCALETOFILL_VALUE = 96;

	/**
	 * An array of all the 'Mapping Option Map Value' enumerators.
	 *
	 *
	 * @generated
	 */
	private static final MappingOptionMapValue[] VALUES_ARRAY =
		new MappingOptionMapValue[] {
			CONST_POSITION,
			CONST_POSITIONANDTRIM,
			CONST_SCALETOFIT,
			CONST_CENTERANDTRIM,
			CONST_IMAGEPOINTTOPEL,
			CONST_IMAGEPOINTTOPELWITHDOUBLEDOT,
			CONST_REPLICATEANDTRIM,
			CONST_SCALETOFILL,
		};

	/**
	 * A public read-only list of all the 'Mapping Option Map Value' enumerators.
	 *
	 *
	 * @generated
	 */
	public static final List<MappingOptionMapValue> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));

	/**
	 * Returns the 'Mapping Option Map Value' literal with the specified literal value.
	 *
	 *
	 * @param literal the literal.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MappingOptionMapValue get(String literal) {
		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
			MappingOptionMapValue result = VALUES_ARRAY[i];
			if (result.toString().equals(literal)) {
				return result;
			}
		}
		return null;
	}

	/**
	 * Returns the 'Mapping Option Map Value' literal with the specified name.
	 *
	 *
	 * @param name the name.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MappingOptionMapValue getByName(String name) {
		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
			MappingOptionMapValue result = VALUES_ARRAY[i];
			if (result.getName().equals(name)) {
				return result;
			}
		}
		return null;
	}

	/**
	 * Returns the 'Mapping Option Map Value' literal with the specified integer value.
	 *
	 *
	 * @param value the integer value.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MappingOptionMapValue get(int value) {
		switch (value) {
			case CONST_POSITION_VALUE: return CONST_POSITION;
			case CONST_POSITIONANDTRIM_VALUE: return CONST_POSITIONANDTRIM;
			case CONST_SCALETOFIT_VALUE: return CONST_SCALETOFIT;
			case CONST_CENTERANDTRIM_VALUE: return CONST_CENTERANDTRIM;
			case CONST_IMAGEPOINTTOPEL_VALUE: return CONST_IMAGEPOINTTOPEL;
			case CONST_IMAGEPOINTTOPELWITHDOUBLEDOT_VALUE: return CONST_IMAGEPOINTTOPELWITHDOUBLEDOT;
			case CONST_REPLICATEANDTRIM_VALUE: return CONST_REPLICATEANDTRIM;
			case CONST_SCALETOFILL_VALUE: return CONST_SCALETOFILL;
		}
		return null;
	}

	/**
	 *
	 *
	 * @generated
	 */
	private final int value;

	/**
	 *
	 *
	 * @generated
	 */
	private final String name;

	/**
	 *
	 *
	 * @generated
	 */
	private final String literal;

	/**
	 * Only this class can construct instances.
	 *
	 *
	 * @generated
	 */
	private MappingOptionMapValue(int value, String name, String literal) {
		this.value = value;
		this.name = name;
		this.literal = literal;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public int getValue() {
	  return value;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public String getName() {
	  return name;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public String getLiteral() {
	  return literal;
	}

	/**
	 * Returns the literal value of the enumerator, which is its string representation.
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		return literal;
	}

} //MappingOptionMapValue


text:
Trello-changelog summarizes your Trello-board.
It uses your done list to make a changelog of your Trello-board, which includes a count of new tickets, done tickets, archived tickets and a summarization of bugs, features etc...
It's possible to use your own Trello labels.

Example output:

--------
![trello-changelog-img](http://i.imgur.com/01Hxjmt.png)

--------

## Installation
-----------

Install the gem:

`gem install trello-changelog`

## Configuration
---------

There are two options:

1. Create a file named '.trello-changelog.rb' in your ~home directory, it should contain the following:

```ruby
module Variables
  DEVKEY = 'abcde'
  MEM_TOKEN = 'abcde'
  BOARD = '1a2b3b4'
  DONE_LIST_NAME = 'Done'
  LABELS = %w(
    bug
    feature
    postmortem
  )
end
```

2. Add all the required options to the changelog command:

`trello-changelog print --devkey=abc --mem_token=def --board=ghi --done_list_name=jkl --labels=foo bar`

 * **DEVKEY**: get this from [trello.com/app-key](http://trello.com/app-key)
 * **MEM_TOKEN**: go to [trello.com/1/authorize?key=DEVKEY&response_type=token&expiration=never](http://trello.com/1/authorize?key=DEVKEY&response_type=token&expiration=never) (replace DEVKEY with your devkey)
 * **BOARD**: you can find your board ID in the url of your board (should be something like soZ9XlDB)
 * **DONE_LIST_NAME**: the name of the column you use for done tickets (case sensitive)
 * **LABELS**: labels you use in your board and want to use for categorization (case sensitive)

## Usage
----------

If you want to summarize this week (6 days back, we use this gem on a friday by default):

`trello-changelog print`

If you want to summarize since a certain date:

`trello-changelog print --start_date=2015-02-20`

Run and copy to pasteboard (OS X):

`trello-changelog print | pbcopy`

## Contributing
----------

Bug reports, feature requests and test implementations are more than welcome. Please use our [Github account](https://github.com/openminds/trello-changelog) for this.


text:
package main

import (
	"flag"
	"log"
	"os"
	"os/exec"
	"runtime"
	"strings"
	"time"

	"github.com/ncw/rclone/fs"
	_ "github.com/ncw/rclone/fs/all" // import all fs
	"github.com/ncw/rclone/fstest"
)

var (
	remotes = []string{
		"TestSwift:",
		"TestS3:",
		"TestDrive:",
		"TestGoogleCloudStorage:",
		"TestDropbox:",
		"TestAmazonCloudDrive:",
		"TestOneDrive:",
		"TestHubic:",
		"TestB2:",
		"TestYandex:",
	}
	binary = "fs.test"
	// Flags
	maxTries = flag.Int("maxtries", 3, "Number of times to try each test")
	runTests = flag.String("run", "", "Comma separated list of remotes to test, eg 'TestSwift:,TestS3'")
	verbose  = flag.Bool("verbose", false, "Run the tests with -v")
	clean    = flag.Bool("clean", false, "Instead of testing, clean all left over test directories")
)

// test holds info about a running test
type test struct {
	remote    string
	subdir    bool
	cmdLine   []string
	cmdString string
	try       int
	err       error
	output    []byte
}

// newTest creates a new test
func newTest(remote string, subdir bool) *test {
	t := &test{
		remote:  remote,
		subdir:  subdir,
		cmdLine: []string{"./" + binary, "-remote", remote},
		try:     1,
	}
	if *verbose {
		t.cmdLine = append(t.cmdLine, "-test.v")
	}
	if subdir {
		t.cmdLine = append(t.cmdLine, "-subdir")
	}
	t.cmdString = strings.Join(t.cmdLine, " ")
	return t
}

// trial runs a single test
func (t *test) trial() {
	log.Printf("%q - Starting (try %d/%d)", t.cmdString, t.try, *maxTries)
	cmd := exec.Command(t.cmdLine[0], t.cmdLine[1:]...)
	start := time.Now()
	t.output, t.err = cmd.CombinedOutput()
	duration := time.Since(start)
	if t.passed() {
		log.Printf("%q - Finished OK in %v (try %d/%d)", t.cmdString, duration, t.try, *maxTries)
	} else {
		log.Printf("%q - Finished ERROR in %v (try %d/%d): %v", t.cmdString, duration, t.try, *maxTries, t.err)
	}
}

// cleanFs runs a single clean fs for left over directories
func (t *test) cleanFs() error {
	f, err := fs.NewFs(t.remote)
	if err != nil {
		return err
	}
	for dir := range f.ListDir() {
		if fstest.MatchTestRemote.MatchString(dir.Name) {
			log.Printf("Purging %s%s", t.remote, dir.Name)
			dir, err := fs.NewFs(t.remote + dir.Name)
			if err != nil {
				return err
			}
			err = fs.Purge(dir)
			if err != nil {
				return err
			}
		}
	}
	return nil
}

// clean runs a single clean on a fs for left over directories
func (t *test) clean() {
	log.Printf("%q - Starting clean (try %d/%d)", t.remote, t.try, *maxTries)
	start := time.Now()
	t.err = t.cleanFs()
	if t.err != nil {
		log.Printf("%q - Failed to purge %v", t.remote, t.err)
	}
	duration := time.Since(start)
	if t.passed() {
		log.Printf("%q - Finished OK in %v (try %d/%d)", t.cmdString, duration, t.try, *maxTries)
	} else {
		log.Printf("%q - Finished ERROR in %v (try %d/%d): %v", t.cmdString, duration, t.try, *maxTries, t.err)
	}
}

// passed returns true if the test passed
func (t *test) passed() bool {
	return t.err == nil
}

// run runs all the trials for this test
func (t *test) run(result chan<- *test) {
	for t.try = 1; t.try <= *maxTries; t.try++ {
		if *clean {
			if !t.subdir {
				t.clean()
			}
		} else {
			t.trial()
		}
		if t.passed() {
			break
		}
	}
	if !t.passed() {
		log.Println("------------------------------------------------------------")
		log.Println(string(t.output))
		log.Println("------------------------------------------------------------")
	}
	result <- t
}

// makeTestBinary makes the binary we will run
func makeTestBinary() {
	if runtime.GOOS == "windows" {
		binary += ".exe"
	}
	log.Printf("Making test binary %q", binary)
	err := exec.Command("go", "test", "-c", "-o", binary).Run()
	if err != nil {
		log.Fatalf("Failed to make test binary: %v", err)
	}
	if _, err := os.Stat(binary); err != nil {
		log.Fatalf("Couldn't find test binary %q", binary)
	}
}

// removeTestBinary removes the binary made in makeTestBinary
func removeTestBinary() {
	err := os.Remove(binary) // Delete the binary when finished
	if err != nil {
		log.Printf("Error removing test binary %q: %v", binary, err)
	}
}

func main() {
	flag.Parse()
	if *runTests != "" {
		remotes = strings.Split(*runTests, ",")
	}
	log.Printf("Testing remotes: %s", strings.Join(remotes, ", "))

	start := time.Now()
	if *clean {
		fs.LoadConfig()
	} else {
		makeTestBinary()
		defer removeTestBinary()
	}

	// start the tests
	results := make(chan *test, 8)
	awaiting := 0
	for _, remote := range remotes {
		awaiting += 2
		go newTest(remote, false).run(results)
		go newTest(remote, true).run(results)
	}

	// Wait for the tests to finish
	var failed []*test
	for ; awaiting > 0; awaiting-- {
		t := <-results
		if !t.passed() {
			failed = append(failed, t)
		}
	}
	duration := time.Since(start)

	// Summarise results
	if len(failed) == 0 {
		log.Printf("PASS: All tests finished OK in %v", duration)
	} else {
		log.Printf("FAIL: %d tests failed in %v", len(failed), duration)
		for _, t := range failed {
			log.Printf("  * %s", t.cmdString)
		}
		os.Exit(1)
	}
}


text:
using SharpHaven.Graphics;

namespace SharpHaven.UI
{
	public class Drag
	{
		public Drag(Drawable image, object tag)
		{
			Image = image;
			Tag = tag;
		}

		public Drawable Image { get; }

		public object Tag { get; }
	}
}


text:
<title>
How a billionaire buffoon took NYC
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

WHAT WE THINK

How a billionaire buffoon took NYC

November 16, 2001 | Page 3

AFTER EIGHT miserable years of Rudolph Giuliani, the question wasn't whether the next mayor of New York City would be a Democrat but which one. But on November 7, Republican billionaire Michael Bloomberg walked away with a victory in one of the nastiest and most expensive mayoral elections ever.

Bloomberg, a media mogul who has never held public office, trailed by double digits in opinion polls a few weeks before the vote. Yet the arrogance, incompetence and racism of Democratic candidate Mark Green handed the election to this buffoon.

Green–who in a former life was a liberal activist trained by Ralph Nader–was the early favorite to win the Democratic nomination. Bronx Borough President Fernando Ferrer jumped in the polls after winning the endorsement of civil rights leader Rev. Al Sharpton.

After the endorsement, racist fliers began appearing, depicting Ferrer as Sharpton's puppet. The Green campaign promised to investigate where the fliers came from, but never did–and meanwhile continued to press a message designed to play on the fears of conservative white voters. Green eked out a primary victory over Ferrer, but Black and Latino leaders sat on their hands for the general election.

Bloomberg took full advantage of the opening. He appeared almost daily on Black radio–while Green refused invitations for on-air interviews.

Giuliani's long-delayed endorsement of Bloomberg wouldn't have been much help before September 11. But transformed into a hero by the media, Giuliani was able to turn out voters.

Bloomberg spent $60 million of his $4 billion fortune on the race, prompting Newsday columnist Jimmy Breslin to write that Bloomberg "bought the office like a cup of coffee." But Bloomberg's money was only decisive because of Green's self-destruction.

That a Republican billionaire could get away with posing as an antiracist and friend of working New Yorkers is an indictment of Green's campaign–which mirrored the conventional wisdom among mainstream Democrats that candidates have to suck up to big business and slap down "special interests."

Democrats won governor's races in New Jersey and Virginia on Election Day, prompting happy talk from party leaders. But the real lesson was in New York.

Green's miserable campaign shows why the Democrats aren't the "friends of working people" that they claim to be–and why we need a real alternative to the two parties of big business.

<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>

<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=1024, user-scalable=no">

  <title>Recommended: deck.js-starterkit</title>

            The recommended "boilerplate" for using deck.js with these extensions can be found in the deck.js-starterkit repository.

            You can preview what you get with the starterkit.

            The original deck.js boilerplate is still available in the original deck.js repository


text:
package com.sop4j.base.apache.compress.archivers.cpio;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;

import com.sop4j.base.apache.compress.archivers.ArchiveEntry;
import com.sop4j.base.apache.compress.archivers.ArchiveInputStream;
import com.sop4j.base.apache.compress.archivers.zip.ZipEncoding;
import com.sop4j.base.apache.compress.archivers.zip.ZipEncodingHelper;
import com.sop4j.base.apache.compress.utils.ArchiveUtils;
import com.sop4j.base.apache.compress.utils.CharsetNames;
import com.sop4j.base.apache.compress.utils.IOUtils;

/**
 * CPIOArchiveInputStream is a stream for reading cpio streams. All formats of
 * cpio are supported (old ascii, old binary, new portable format and the new
 * portable format with crc).
 *

 *

 * The stream can be read by extracting a cpio entry (containing all
 * informations about a entry) and afterwards reading from the stream the file
 * specified by the entry.
 *

 *

 * CPIOArchiveInputStream cpioIn = new CPIOArchiveInputStream(
 *         new FileInputStream(new File("test.cpio")));
 * CPIOArchiveEntry cpioEntry;
 *

 * while ((cpioEntry = cpioIn.getNextEntry()) != null) {
 *     System.out.println(cpioEntry.getName());
 *     int tmp;
 *     StringBuilder buf = new StringBuilder();
 *     while ((tmp = cpIn.read()) != -1) {
 *         buf.append((char) tmp);
 *     }
 *     System.out.println(buf.toString());
 * }
 * cpioIn.close();
 *

 *

 * Note: This implementation should be compatible to cpio 2.5
 *
 * This class uses mutable fields and is not considered to be threadsafe.
 *
 * Based on code from the jRPM project (jrpm.sourceforge.net)
 */

public class CpioArchiveInputStream extends ArchiveInputStream implements
        CpioConstants {

    private boolean closed = false;

    private CpioArchiveEntry entry;

    private long entryBytesRead = 0;

    private boolean entryEOF = false;

    private final byte tmpbuf[] = new byte[4096];

    private long crc = 0;

    private final InputStream in;

    // cached buffers - must only be used locally in the class (COMPRESS-172 - reduce garbage collection)
    private final byte[] TWO_BYTES_BUF = new byte[2];
    private final byte[] FOUR_BYTES_BUF = new byte[4];
    private final byte[] SIX_BYTES_BUF = new byte[6];

    private final int blockSize;

    /**
     * The encoding to use for filenames and labels.
     */
    private final ZipEncoding encoding;

    /**
     * Construct the cpio input stream with a blocksize of {@link
     * CpioConstants#BLOCK_SIZE BLOCK_SIZE} and expecting ASCII file
     * names.
     *
     * @param in
     *            The cpio stream
     */
    public CpioArchiveInputStream(final InputStream in) {
        this(in, BLOCK_SIZE, CharsetNames.US_ASCII);
    }

    /**
     * Construct the cpio input stream with a blocksize of {@link
     * CpioConstants#BLOCK_SIZE BLOCK_SIZE}.
     *
     * @param in
     *            The cpio stream
     * @param encoding
     *            The encoding of file names to expect - use null for
     *            the platform's default.
     * @since 1.6
     */
    public CpioArchiveInputStream(final InputStream in, String encoding) {
        this(in, BLOCK_SIZE, encoding);
    }

    /**
     * Construct the cpio input stream with a blocksize of {@link
     * CpioConstants#BLOCK_SIZE BLOCK_SIZE} expecting ASCII file
     * names.
     *
     * @param in
     *            The cpio stream
     * @param blockSize
     *            The block size of the archive.
     * @since 1.5
     */
    public CpioArchiveInputStream(final InputStream in, int blockSize) {
        this(in, blockSize, CharsetNames.US_ASCII);
    }

    /**
     * Construct the cpio input stream with a blocksize of {@link CpioConstants#BLOCK_SIZE BLOCK_SIZE}.
     *
     * @param in
     *            The cpio stream
     * @param blockSize
     *            The block size of the archive.
     * @param encoding
     *            The encoding of file names to expect - use null for
     *            the platform's default.
     * @since 1.6
     */
    public CpioArchiveInputStream(final InputStream in, int blockSize, String encoding) {
        this.in = in;
        this.blockSize = blockSize;
        this.encoding = ZipEncodingHelper.getZipEncoding(encoding);
    }

    /**
     * Returns 0 after EOF has reached for the current entry data, otherwise
     * always return 1.
     *

     * Programs should not count on this method to return the actual number of
     * bytes that could be read without blocking.
     *
     * @return 1 before EOF and 0 after EOF has reached for current entry.
     * @throws IOException
     *             if an I/O error has occurred or if a CPIO file error has
     *             occurred
     */
    @Override
    public int available() throws IOException {
        ensureOpen();
        if (this.entryEOF) {
            return 0;
        }
        return 1;
    }

    /**
     * Closes the CPIO input stream.
     *
     * @throws IOException
     *             if an I/O error has occurred
     */
    @Override
    public void close() throws IOException {
        if (!this.closed) {
            in.close();
            this.closed = true;
        }
    }

    /**
     * Closes the current CPIO entry and positions the stream for reading the
     * next entry.
     *
     * @throws IOException
     *             if an I/O error has occurred or if a CPIO file error has
     *             occurred
     */
    private void closeEntry() throws IOException {
        ensureOpen();
        while (read(this.tmpbuf, 0, this.tmpbuf.length) != -1) { // NOPMD
            // do nothing
        }

        this.entryEOF = true;
    }

    /**
     * Check to make sure that this stream has not been closed
     *
     * @throws IOException
     *             if the stream is already closed
     */
    private void ensureOpen() throws IOException {
        if (this.closed) {
            throw new IOException("Stream closed");
        }
    }

    /**
     * Reads the next CPIO file entry and positions stream at the beginning of
     * the entry data.
     *
     * @return the CPIOArchiveEntry just read
     * @throws IOException
     *             if an I/O error has occurred or if a CPIO file error has
     *             occurred
     */
    public CpioArchiveEntry getNextCPIOEntry() throws IOException {
        ensureOpen();
        if (this.entry != null) {
            closeEntry();
        }
        readFully(TWO_BYTES_BUF, 0, TWO_BYTES_BUF.length);
        if (CpioUtil.byteArray2long(TWO_BYTES_BUF, false) == MAGIC_OLD_BINARY) {
            this.entry = readOldBinaryEntry(false);
        } else if (CpioUtil.byteArray2long(TWO_BYTES_BUF, true)
                   == MAGIC_OLD_BINARY) {
            this.entry = readOldBinaryEntry(true);
        } else {
            System.arraycopy(TWO_BYTES_BUF, 0, SIX_BYTES_BUF, 0,
                             TWO_BYTES_BUF.length);
            readFully(SIX_BYTES_BUF, TWO_BYTES_BUF.length,
                      FOUR_BYTES_BUF.length);
            String magicString = ArchiveUtils.toAsciiString(SIX_BYTES_BUF);
            if (magicString.equals(MAGIC_NEW)) {
                this.entry = readNewEntry(false);
            } else if (magicString.equals(MAGIC_NEW_CRC)) {
                this.entry = readNewEntry(true);
            } else if (magicString.equals(MAGIC_OLD_ASCII)) {
                this.entry = readOldAsciiEntry();
            } else {
                throw new IOException("Unknown magic [" + magicString + "]. Occured at byte: " + getBytesRead());
            }
        }

        this.entryBytesRead = 0;
        this.entryEOF = false;
        this.crc = 0;

        if (this.entry.getName().equals(CPIO_TRAILER)) {
            this.entryEOF = true;
            skipRemainderOfLastBlock();
            return null;
        }
        return this.entry;
    }

    private void skip(int bytes) throws IOException{
        // bytes cannot be more than 3 bytes
        if (bytes > 0) {
            readFully(FOUR_BYTES_BUF, 0, bytes);
        }
    }

    /**
     * Reads from the current CPIO entry into an array of bytes. Blocks until
     * some input is available.
     *
     * @param b
     *            the buffer into which the data is read
     * @param off
     *            the start offset of the data
     * @param len
     *            the maximum number of bytes read
     * @return the actual number of bytes read, or -1 if the end of the entry is
     *         reached
     * @throws IOException
     *             if an I/O error has occurred or if a CPIO file error has
     *             occurred
     */
    @Override
    public int read(final byte[] b, final int off, final int len)
            throws IOException {
        ensureOpen();
        if (off < 0 || len < 0 || off > b.length - len) {
            throw new IndexOutOfBoundsException();
        } else if (len == 0) {
            return 0;
        }

        if (this.entry == null || this.entryEOF) {
            return -1;
        }
        if (this.entryBytesRead == this.entry.getSize()) {
            skip(entry.getDataPadCount());
            this.entryEOF = true;
            if (this.entry.getFormat() == FORMAT_NEW_CRC
                && this.crc != this.entry.getChksum()) {
                throw new IOException("CRC Error. Occured at byte: "
                                      + getBytesRead());
            }
            return -1; // EOF for this entry
        }
        int tmplength = (int) Math.min(len, this.entry.getSize()
                - this.entryBytesRead);
        if (tmplength < 0) {
            return -1;
        }

        int tmpread = readFully(b, off, tmplength);
        if (this.entry.getFormat() == FORMAT_NEW_CRC) {
            for (int pos = 0; pos < tmpread; pos++) {
                this.crc += b[pos] & 0xFF;
            }
        }
        this.entryBytesRead += tmpread;

        return tmpread;
    }

    private final int readFully(final byte[] b, final int off, final int len)
            throws IOException {
        int count = IOUtils.readFully(in, b, off, len);
        count(count);
        if (count < len) {
            throw new EOFException();
        }
        return count;
    }

    private long readBinaryLong(final int length, final boolean swapHalfWord)
            throws IOException {
        byte tmp[] = new byte[length];
        readFully(tmp, 0, tmp.length);
        return CpioUtil.byteArray2long(tmp, swapHalfWord);
    }

    private long readAsciiLong(final int length, final int radix)
            throws IOException {
        byte tmpBuffer[] = new byte[length];
        readFully(tmpBuffer, 0, tmpBuffer.length);
        return Long.parseLong(ArchiveUtils.toAsciiString(tmpBuffer), radix);
    }

    private CpioArchiveEntry readNewEntry(final boolean hasCrc)
            throws IOException {
        CpioArchiveEntry ret;
        if (hasCrc) {
            ret = new CpioArchiveEntry(FORMAT_NEW_CRC);
        } else {
            ret = new CpioArchiveEntry(FORMAT_NEW);
        }

        ret.setInode(readAsciiLong(8, 16));
        long mode = readAsciiLong(8, 16);
        if (CpioUtil.fileType(mode) != 0){ // mode is initialised to 0
            ret.setMode(mode);
        }
        ret.setUID(readAsciiLong(8, 16));
        ret.setGID(readAsciiLong(8, 16));
        ret.setNumberOfLinks(readAsciiLong(8, 16));
        ret.setTime(readAsciiLong(8, 16));
        ret.setSize(readAsciiLong(8, 16));
        ret.setDeviceMaj(readAsciiLong(8, 16));
        ret.setDeviceMin(readAsciiLong(8, 16));
        ret.setRemoteDeviceMaj(readAsciiLong(8, 16));
        ret.setRemoteDeviceMin(readAsciiLong(8, 16));
        long namesize = readAsciiLong(8, 16);
        ret.setChksum(readAsciiLong(8, 16));
        String name = readCString((int) namesize);
        ret.setName(name);
        if (CpioUtil.fileType(mode) == 0 && !name.equals(CPIO_TRAILER)){
            throw new IOException("Mode 0 only allowed in the trailer. Found entry name: "+name + " Occured at byte: " + getBytesRead());
        }
        skip(ret.getHeaderPadCount());

        return ret;
    }

    private CpioArchiveEntry readOldAsciiEntry() throws IOException {
        CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_ASCII);

        ret.setDevice(readAsciiLong(6, 8));
        ret.setInode(readAsciiLong(6, 8));
        final long mode = readAsciiLong(6, 8);
        if (CpioUtil.fileType(mode) != 0) {
            ret.setMode(mode);
        }
        ret.setUID(readAsciiLong(6, 8));
        ret.setGID(readAsciiLong(6, 8));
        ret.setNumberOfLinks(readAsciiLong(6, 8));
        ret.setRemoteDevice(readAsciiLong(6, 8));
        ret.setTime(readAsciiLong(11, 8));
        long namesize = readAsciiLong(6, 8);
        ret.setSize(readAsciiLong(11, 8));
        final String name = readCString((int) namesize);
        ret.setName(name);
        if (CpioUtil.fileType(mode) == 0 && !name.equals(CPIO_TRAILER)){
            throw new IOException("Mode 0 only allowed in the trailer. Found entry: "+ name + " Occured at byte: " + getBytesRead());
        }

        return ret;
    }

    private CpioArchiveEntry readOldBinaryEntry(final boolean swapHalfWord)
            throws IOException {
        CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_BINARY);

        ret.setDevice(readBinaryLong(2, swapHalfWord));
        ret.setInode(readBinaryLong(2, swapHalfWord));
        final long mode = readBinaryLong(2, swapHalfWord);
        if (CpioUtil.fileType(mode) != 0){
            ret.setMode(mode);
        }
        ret.setUID(readBinaryLong(2, swapHalfWord));
        ret.setGID(readBinaryLong(2, swapHalfWord));
        ret.setNumberOfLinks(readBinaryLong(2, swapHalfWord));
        ret.setRemoteDevice(readBinaryLong(2, swapHalfWord));
        ret.setTime(readBinaryLong(4, swapHalfWord));
        long namesize = readBinaryLong(2, swapHalfWord);
        ret.setSize(readBinaryLong(4, swapHalfWord));
        final String name = readCString((int) namesize);
        ret.setName(name);
        if (CpioUtil.fileType(mode) == 0 && !name.equals(CPIO_TRAILER)){
            throw new IOException("Mode 0 only allowed in the trailer. Found entry: "+name + "Occured at byte: " + getBytesRead());
        }
        skip(ret.getHeaderPadCount());

        return ret;
    }

    private String readCString(final int length) throws IOException {
        // don't include trailing NUL in file name to decode
        byte tmpBuffer[] = new byte[length - 1];
        readFully(tmpBuffer, 0, tmpBuffer.length);
        this.in.read();
        return encoding.decode(tmpBuffer);
    }

    /**
     * Skips specified number of bytes in the current CPIO entry.
     *
     * @param n
     *            the number of bytes to skip
     * @return the actual number of bytes skipped
     * @throws IOException
     *             if an I/O error has occurred
     * @throws IllegalArgumentException
     *             if n < 0
     */
    @Override
    public long skip(final long n) throws IOException {
        if (n < 0) {
            throw new IllegalArgumentException("negative skip length");
        }
        ensureOpen();
        int max = (int) Math.min(n, Integer.MAX_VALUE);
        int total = 0;

        while (total < max) {
            int len = max - total;
            if (len > this.tmpbuf.length) {
                len = this.tmpbuf.length;
            }
            len = read(this.tmpbuf, 0, len);
            if (len == -1) {
                this.entryEOF = true;
                break;
            }
            total += len;
        }
        return total;
    }

    @Override
    public ArchiveEntry getNextEntry() throws IOException {
        return getNextCPIOEntry();
    }

    /**
     * Skips the padding zeros written after the TRAILER!!! entry.
     */
    private void skipRemainderOfLastBlock() throws IOException {
        long readFromLastBlock = getBytesRead() % blockSize;
        long remainingBytes = readFromLastBlock == 0 ? 0
            : blockSize - readFromLastBlock;
        while (remainingBytes > 0) {
            long skipped = skip(blockSize - readFromLastBlock);
            if (skipped <= 0) {
                break;
            }
            remainingBytes -= skipped;
        }
    }

    /**
     * Checks if the signature matches one of the following magic values:
     *
     * Strings:
     *
     * "070701" - MAGIC_NEW
     * "070702" - MAGIC_NEW_CRC
     * "070707" - MAGIC_OLD_ASCII
     *
     * Octal Binary value:
     *
     * 070707 - MAGIC_OLD_BINARY (held as a short) = 0x71C7 or 0xC771
     */
    public static boolean matches(byte[] signature, int length) {
        if (length < 6) {
            return false;
        }

        // Check binary values
        if (signature[0] == 0x71 && (signature[1] & 0xFF) == 0xc7) {
            return true;
        }
        if (signature[1] == 0x71 && (signature[0] & 0xFF) == 0xc7) {
            return true;
        }

        // Check Ascii (String) values
        // 3037 3037 30nn
        if (signature[0] != 0x30) {
            return false;
        }
        if (signature[1] != 0x37) {
            return false;
        }
        if (signature[2] != 0x30) {
            return false;
        }
        if (signature[3] != 0x37) {
            return false;
        }
        if (signature[4] != 0x30) {
            return false;
        }
        // Check last byte
        if (signature[5] == 0x31) {
            return true;
        }
        if (signature[5] == 0x32) {
            return true;
        }
        if (signature[5] == 0x37) {
            return true;
        }

        return false;
    }
}


text:
.loading {
  position: fixed;
  top: 48%;
  left: 48%;
  width: 90px;
  height: 90px;
  background: #111;
  border-radius: 10px;
}

.loading-dot {
  position: absolute;
  top: 42.5px;
  left: 43px;
  display: block;
  width: 4px;
  height: 5px;
  background: transparent;
  border-radius: 0;
  -webkit-transform: translateX(30px);
  -ms-transform: translateX(30px);
  -o-transform: translateX(30px);
  transform: translateX(30px);
  -webkit-animation-duration: 1s;
  -o-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-iteration-count: infinite;
  -o-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  -webkit-animation-name: chase;
  -o-animation-name: chase;
  animation-name: chase;
  -webkit-animation-timing-function: ease-in-out;
  -o-animation-timing-function: ease-in-out;
  animation-timing-function: ease-in-out;
}

@-webkit-keyframes chase {
  28.6% {
    background-color: #ffffaa;
  }

  42.9% {
    background-color: #aaffaa;
  }

  57.1% {
    background-color: #aaffff;
  }

  71.4% {
    background-color: #aaaaff;
  }

  85.7% {
    background-color: #ffaaff;
  }

  0% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }

  50% {
    box-shadow: 0px 0px 8px white;
  }

  100% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }
}

@-o-keyframes chase {
  28.6% {
    background-color: #ffffaa;
  }

  42.9% {
    background-color: #aaffaa;
  }

  57.1% {
    background-color: #aaffff;
  }

  71.4% {
    background-color: #aaaaff;
  }

  85.7% {
    background-color: #ffaaff;
  }

  0% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }

  50% {
    box-shadow: 0px 0px 8px white;
  }

  100% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }
}

@keyframes chase {
  28.6% {
    background-color: #ffffaa;
  }

  42.9% {
    background-color: #aaffaa;
  }

  57.1% {
    background-color: #aaffff;
  }

  71.4% {
    background-color: #aaaaff;
  }

  85.7% {
    background-color: #ffaaff;
  }

  0% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }

  50% {
    box-shadow: 0px 0px 8px white;
  }

  100% {
    box-shadow: 0px 0px 0px white;
    background-color: #ffaaaa;
  }
}

.loading-dot:nth-child(2) {
  -webkit-transform: rotate(10deg) translateX(30px);
  -ms-transform: rotate(10deg) translateX(30px);
  -o-transform: rotate(10deg) translateX(30px);
  transform: rotate(10deg) translateX(30px);
  -webkit-animation-delay: 0.0s;
  -o-animation-delay: 0.0s;
  animation-delay: 0.0s;
}

.loading-dot:nth-child(3) {
  -webkit-transform: rotate(20deg) translateX(30px);
  -ms-transform: rotate(20deg) translateX(30px);
  -o-transform: rotate(20deg) translateX(30px);
  transform: rotate(20deg) translateX(30px);
  -webkit-animation-delay: 0.1s;
  -o-animation-delay: 0.1s;
  animation-delay: 0.1s;
}

.loading-dot:nth-child(4) {
  -webkit-transform: rotate(30deg) translateX(30px);
  -ms-transform: rotate(30deg) translateX(30px);
  -o-transform: rotate(30deg) translateX(30px);
  transform: rotate(30deg) translateX(30px);
  -webkit-animation-delay: 0.1s;
  -o-animation-delay: 0.1s;
  animation-delay: 0.1s;
}

.loading-dot:nth-child(5) {
  -webkit-transform: rotate(40deg) translateX(30px);
  -ms-transform: rotate(40deg) translateX(30px);
  -o-transform: rotate(40deg) translateX(30px);
  transform: rotate(40deg) translateX(30px);
  -webkit-animation-delay: 0.1s;
  -o-animation-delay: 0.1s;
  animation-delay: 0.1s;
}

.loading-dot:nth-child(6) {
  -webkit-transform: rotate(50deg) translateX(30px);
  -ms-transform: rotate(50deg) translateX(30px);
  -o-transform: rotate(50deg) translateX(30px);
  transform: rotate(50deg) translateX(30px);
  -webkit-animation-delay: 0.1s;
  -o-animation-delay: 0.1s;
  animation-delay: 0.1s;
}

.loading-dot:nth-child(7) {
  -webkit-transform: rotate(60deg) translateX(30px);
  -ms-transform: rotate(60deg) translateX(30px);
  -o-transform: rotate(60deg) translateX(30px);
  transform: rotate(60deg) translateX(30px);
  -webkit-animation-delay: 0.2s;
  -o-animation-delay: 0.2s;
  animation-delay: 0.2s;
}

.loading-dot:nth-child(8) {
  -webkit-transform: rotate(70deg) translateX(30px);
  -ms-transform: rotate(70deg) translateX(30px);
  -o-transform: rotate(70deg) translateX(30px);
  transform: rotate(70deg) translateX(30px);
  -webkit-animation-delay: 0.2s;
  -o-animation-delay: 0.2s;
  animation-delay: 0.2s;
}

.loading-dot:nth-child(9) {
  -webkit-transform: rotate(80deg) translateX(30px);
  -ms-transform: rotate(80deg) translateX(30px);
  -o-transform: rotate(80deg) translateX(30px);
  transform: rotate(80deg) translateX(30px);
  -webkit-animation-delay: 0.2s;
  -o-animation-delay: 0.2s;
  animation-delay: 0.2s;
}

.loading-dot:nth-child(10) {
  -webkit-transform: rotate(90deg) translateX(30px);
  -ms-transform: rotate(90deg) translateX(30px);
  -o-transform: rotate(90deg) translateX(30px);
  transform: rotate(90deg) translateX(30px);
  -webkit-animation-delay: 0.3s;
  -o-animation-delay: 0.3s;
  animation-delay: 0.3s;
}

.loading-dot:nth-child(11) {
  -webkit-transform: rotate(100deg) translateX(30px);
  -ms-transform: rotate(100deg) translateX(30px);
  -o-transform: rotate(100deg) translateX(30px);
  transform: rotate(100deg) translateX(30px);
  -webkit-animation-delay: 0.3s;
  -o-animation-delay: 0.3s;
  animation-delay: 0.3s;
}

.loading-dot:nth-child(12) {
  -webkit-transform: rotate(110deg) translateX(30px);
  -ms-transform: rotate(110deg) translateX(30px);
  -o-transform: rotate(110deg) translateX(30px);
  transform: rotate(110deg) translateX(30px);
  -webkit-animation-delay: 0.3s;
  -o-animation-delay: 0.3s;
  animation-delay: 0.3s;
}

.loading-dot:nth-child(13) {
  -webkit-transform: rotate(120deg) translateX(30px);
  -ms-transform: rotate(120deg) translateX(30px);
  -o-transform: rotate(120deg) translateX(30px);
  transform: rotate(120deg) translateX(30px);
  -webkit-animation-delay: 0.3s;
  -o-animation-delay: 0.3s;
  animation-delay: 0.3s;
}

.loading-dot:nth-child(14) {
  -webkit-transform: rotate(130deg) translateX(30px);
  -ms-transform: rotate(130deg) translateX(30px);
  -o-transform: rotate(130deg) translateX(30px);
  transform: rotate(130deg) translateX(30px);
  -webkit-animation-delay: 0.4s;
  -o-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.loading-dot:nth-child(15) {
  -webkit-transform: rotate(140deg) translateX(30px);
  -ms-transform: rotate(140deg) translateX(30px);
  -o-transform: rotate(140deg) translateX(30px);
  transform: rotate(140deg) translateX(30px);
  -webkit-animation-delay: 0.4s;
  -o-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.loading-dot:nth-child(16) {
  -webkit-transform: rotate(150deg) translateX(30px);
  -ms-transform: rotate(150deg) translateX(30px);
  -o-transform: rotate(150deg) translateX(30px);
  transform: rotate(150deg) translateX(30px);
  -webkit-animation-delay: 0.4s;
  -o-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.loading-dot:nth-child(17) {
  -webkit-transform: rotate(160deg) translateX(30px);
  -ms-transform: rotate(160deg) translateX(30px);
  -o-transform: rotate(160deg) translateX(30px);
  transform: rotate(160deg) translateX(30px);
  -webkit-animation-delay: 0.4s;
  -o-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.loading-dot:nth-child(18) {
  -webkit-transform: rotate(170deg) translateX(30px);
  -ms-transform: rotate(170deg) translateX(30px);
  -o-transform: rotate(170deg) translateX(30px);
  transform: rotate(170deg) translateX(30px);
  -webkit-animation-delay: 0.5s;
  -o-animation-delay: 0.5s;
  animation-delay: 0.5s;
}

.loading-dot:nth-child(19) {
  -webkit-transform: rotate(180deg) translateX(30px);
  -ms-transform: rotate(180deg) translateX(30px);
  -o-transform: rotate(180deg) translateX(30px);
  transform: rotate(180deg) translateX(30px);
  -webkit-animation-delay: 0.5s;
  -o-animation-delay: 0.5s;
  animation-delay: 0.5s;
}

.loading-dot:nth-child(20) {
  -webkit-transform: rotate(190deg) translateX(30px);
  -ms-transform: rotate(190deg) translateX(30px);
  -o-transform: rotate(190deg) translateX(30px);
  transform: rotate(190deg) translateX(30px);
  -webkit-animation-delay: 0.5s;
  -o-animation-delay: 0.5s;
  animation-delay: 0.5s;
}

.loading-dot:nth-child(21) {
  -webkit-transform: rotate(200deg) translateX(30px);
  -ms-transform: rotate(200deg) translateX(30px);
  -o-transform: rotate(200deg) translateX(30px);
  transform: rotate(200deg) translateX(30px);
  -webkit-animation-delay: 0.6s;
  -o-animation-delay: 0.6s;
  animation-delay: 0.6s;
}

.loading-dot:nth-child(22) {
  -webkit-transform: rotate(210deg) translateX(30px);
  -ms-transform: rotate(210deg) translateX(30px);
  -o-transform: rotate(210deg) translateX(30px);
  transform: rotate(210deg) translateX(30px);
  -webkit-animation-delay: 0.6s;
  -o-animation-delay: 0.6s;
  animation-delay: 0.6s;
}

.loading-dot:nth-child(23) {
  -webkit-transform: rotate(220deg) translateX(30px);
  -ms-transform: rotate(220deg) translateX(30px);
  -o-transform: rotate(220deg) translateX(30px);
  transform: rotate(220deg) translateX(30px);
  -webkit-animation-delay: 0.6s;
  -o-animation-delay: 0.6s;
  animation-delay: 0.6s;
}

.loading-dot:nth-child(24) {
  -webkit-transform: rotate(230deg) translateX(30px);
  -ms-transform: rotate(230deg) translateX(30px);
  -o-transform: rotate(230deg) translateX(30px);
  transform: rotate(230deg) translateX(30px);
  -webkit-animation-delay: 0.6s;
  -o-animation-delay: 0.6s;
  animation-delay: 0.6s;
}

.loading-dot:nth-child(25) {
  -webkit-transform: rotate(240deg) translateX(30px);
  -ms-transform: rotate(240deg) translateX(30px);
  -o-transform: rotate(240deg) translateX(30px);
  transform: rotate(240deg) translateX(30px);
  -webkit-animation-delay: 0.7s;
  -o-animation-delay: 0.7s;
  animation-delay: 0.7s;
}

.loading-dot:nth-child(26) {
  -webkit-transform: rotate(250deg) translateX(30px);
  -ms-transform: rotate(250deg) translateX(30px);
  -o-transform: rotate(250deg) translateX(30px);
  transform: rotate(250deg) translateX(30px);
  -webkit-animation-delay: 0.7s;
  -o-animation-delay: 0.7s;
  animation-delay: 0.7s;
}

.loading-dot:nth-child(27) {
  -webkit-transform: rotate(260deg) translateX(30px);
  -ms-transform: rotate(260deg) translateX(30px);
  -o-transform: rotate(260deg) translateX(30px);
  transform: rotate(260deg) translateX(30px);
  -webkit-animation-delay: 0.7s;
  -o-animation-delay: 0.7s;
  animation-delay: 0.7s;
}

.loading-dot:nth-child(28) {
  -webkit-transform: rotate(270deg) translateX(30px);
  -ms-transform: rotate(270deg) translateX(30px);
  -o-transform: rotate(270deg) translateX(30px);
  transform: rotate(270deg) translateX(30px);
  -webkit-animation-delay: 0.8s;
  -o-animation-delay: 0.8s;
  animation-delay: 0.8s;
}

.loading-dot:nth-child(29) {
  -webkit-transform: rotate(280deg) translateX(30px);
  -ms-transform: rotate(280deg) translateX(30px);
  -o-transform: rotate(280deg) translateX(30px);
  transform: rotate(280deg) translateX(30px);
  -webkit-animation-delay: 0.8s;
  -o-animation-delay: 0.8s;
  animation-delay: 0.8s;
}

.loading-dot:nth-child(30) {
  -webkit-transform: rotate(290deg) translateX(30px);
  -ms-transform: rotate(290deg) translateX(30px);
  -o-transform: rotate(290deg) translateX(30px);
  transform: rotate(290deg) translateX(30px);
  -webkit-animation-delay: 0.8s;
  -o-animation-delay: 0.8s;
  animation-delay: 0.8s;
}

.loading-dot:nth-child(31) {
  -webkit-transform: rotate(300deg) translateX(30px);
  -ms-transform: rotate(300deg) translateX(30px);
  -o-transform: rotate(300deg) translateX(30px);
  transform: rotate(300deg) translateX(30px);
  -webkit-animation-delay: 0.8s;
  -o-animation-delay: 0.8s;
  animation-delay: 0.8s;
}

.loading-dot:nth-child(32) {
  -webkit-transform: rotate(310deg) translateX(30px);
  -ms-transform: rotate(310deg) translateX(30px);
  -o-transform: rotate(310deg) translateX(30px);
  transform: rotate(310deg) translateX(30px);
  -webkit-animation-delay: 0.9s;
  -o-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

.loading-dot:nth-child(33) {
  -webkit-transform: rotate(320deg) translateX(30px);
  -ms-transform: rotate(320deg) translateX(30px);
  -o-transform: rotate(320deg) translateX(30px);
  transform: rotate(320deg) translateX(30px);
  -webkit-animation-delay: 0.9s;
  -o-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

.loading-dot:nth-child(34) {
  -webkit-transform: rotate(330deg) translateX(30px);
  -ms-transform: rotate(330deg) translateX(30px);
  -o-transform: rotate(330deg) translateX(30px);
  transform: rotate(330deg) translateX(30px);
  -webkit-animation-delay: 0.9s;
  -o-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

.loading-dot:nth-child(35) {
  -webkit-transform: rotate(340deg) translateX(30px);
  -ms-transform: rotate(340deg) translateX(30px);
  -o-transform: rotate(340deg) translateX(30px);
  transform: rotate(340deg) translateX(30px);
  -webkit-animation-delay: 0.9s;
  -o-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

.loading-dot:nth-child(36) {
  -webkit-transform: rotate(350deg) translateX(30px);
  -ms-transform: rotate(350deg) translateX(30px);
  -o-transform: rotate(350deg) translateX(30px);
  transform: rotate(350deg) translateX(30px);
  -webkit-animation-delay: 1.0s;
  -o-animation-delay: 1.0s;
  animation-delay: 1.0s;
}


text:
from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse
from tracker_device.models import TrackerDevice

class TrackerProfileTestCase(TestCase):
    """Create test class for TrackerProfile model."""

    def setUp(self):
        """Set up a fake user and profile."""
        self.user = User(username='test')
        self.user.set_password('test')
        self.user.save()

    def test_user_exists(self):
        """Test the user exists."""
        self.assertTrue(self.user is not None)

    def test_username(self):
        """Test the username is correct."""
        self.assertEqual(self.user.username, 'test', 'wrong username')

    def test_profile_exists(self):
        """Test that the user has a profile."""
        self.assertTrue(self.user.profile is not None)

    def test_profile_attached_to_right_user(self):
        """Test profile is attached to right user."""
        self.assertEqual(self.user.profile.user.username, 'test')

class TrackerProfileViewTestCase(TestCase):
    """Test view for tracker profile view."""

    def setUp(self):
        """Set up fake user and log in."""
        self.username = "test"
        self.user = User(username=self.username)
        self.user.save()
        self.biography = "biography"
        self.user.profile.bio = self.biography
        self.user.profile.save()
        self.client.force_login(self.user)
        self.device = TrackerDevice(user=self.user)
        self.device.save()
        self.response = self.client.get(reverse('profile'))

    def test_profile_status_code(self):
        """Test status code for authenticated user."""
        self.assertTrue(self.response.status_code, 200)

    def test_profile_shows_username(self):
        """Test status code for authenticated user."""
        self.assertContains(self.response, self.username)

    def test_profile_shows_biography(self):
        """Test status code for authenticated user."""
        self.assertContains(self.response, self.biography)

    def test_device_detail_link(self):
        """Test that provfile view renders device detail view links."""
        url = reverse('detail_device', args=[self.device.pk])
        self.assertContains(self.response, url)

    def test_profile_login_required(self):
        """Test profile redirects to login."""
        self.client.logout()
        response = self.client.get(reverse('profile'))
        self.assertEqual(response.status_code, 302)

class TrackerProfileEditViewTestCase(TestCase):
    """Test profile editing."""

    def setUp(self):
        """Create a user to edit."""
        self.username = "test"
        self.user = User(username=self.username)
        self.user.save()
        self.client.force_login(self.user)
        self.response = self.client.get(reverse('edit_profile'))

    def test_edit_profile_status_code(self):
        """Test status code of edit profile view is 200."""
        self.assertEqual(self.response.status_code, 200)

    def test_edit_profile_bio(self):
        """Test status code of edit profile view is 200."""
        expected_bio = 'foo'
        data = dict(bio=expected_bio)
        response = self.client.post(reverse('edit_profile'), data)
        self.assertEqual(response.status_code, 302)
        actual_bio = User.objects.first().profile.bio
        self.assertEqual(actual_bio, expected_bio)

    def test_edit_profile_login_required(self):
        """Test profile redirects to login."""
        self.client.logout()
        response = self.client.get(reverse('edit_profile'))
        self.assertEqual(response.status_code, 302)


text:
def apply_tags(item, job, params):
    params['BUILD_TAGS'] = ' '.join(sorted(job.tags))


text:
<?php

//New Test
class QuickstartCheckBoxListTestCase extends PradoGenericSelenium2Test
{
	function test ()
	{
		$this->url("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBoxList.Home&notheme=true&lang=en");

		// Check box list with default settings:
		$this->byXPath("//input[@name='ctl0\$body\$ctl0\$c0' and @value='value 1']")->click();

		// Check box list with customized cellpadding, cellspacing, color and text alignment:
		$this->byXPath("//input[@name='ctl0\$body\$ctl1\$c1' and @value='value 2']")->click();

		// *** Currently unable to test the following cases:
		// Check box list with vertical (default) repeat direction
		// Check box list with horizontal repeat direction
		// Check box list with flow layout and vertical (default) repeat direction
		// Check box list with flow layout and horizontal repeat direction:

		// Check box list's behavior upon postback
		$this->byXPath("//input[@name='ctl0\$body\$CheckBoxList\$c2' and @value='value 3']")->click();
		$this->byXPath("//input[@type='submit' and @value='Submit']")->click();
		$this->pause(50);
		$this->assertContains("Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 4, Value: value 5, Text: item 5)", $this->source());

		// Auto postback check box list
		$this->byXPath("//input[@name='ctl0\$body\$ctl7\$c1' and @value='value 2']")->click();
		$this->pause(50);
		$this->assertContains("Your selection is: (Index: 4, Value: value 5, Text: item 5)", $this->source());

		// Databind to an integer-indexed array
		$this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList1\$c1' and @value='1']")->click();
		$this->pause(50);
		$this->assertContains("Your selection is: (Index: 1, Value: 1, Text: item 2)", $this->source());

		// Databind to an associative array:
		$this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList2\$c1' and @value='key 2']")->click();
		$this->pause(50);
		$this->assertContains("Your selection is: (Index: 1, Value: key 2, Text: item 2)", $this->source());

		// Databind with DataTextField and DataValueField specified
		$this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList3\$c2' and @value='003']")->click();
		$this->pause(50);
		$this->assertContains("Your selection is: (Index: 2, Value: 003, Text: Cary)", $this->source());

		// CheckBox list causing validation
		$this->assertNotVisible('ctl0_body_ctl8');
		$this->byXPath("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']")->click();
		$this->assertVisible('ctl0_body_ctl8');
		$this->type("ctl0\$body\$TextBox", "test");
		$this->byXPath("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']")->click();
		$this->assertNotVisible('ctl0_body_ctl8');
	}
}


text:
<?php

namespace App\Http\Controllers;

use App\Review;
use App\Http\Requests\ReviewRequest;
use App\ReviewItem;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class ReviewController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param ReviewRequest $request
     * @return Response
     */
    public function store(ReviewRequest $request)
    {
        $review = Review::create($request->all());
        with(new ReviewItem())->handle($review);

        flash()->success('Sua revisão foi salva!')->important();

        return redirect()->back();
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function update(Review $review, ReviewRequest $request)
    {
        $review->update($request->all());
        with(new ReviewItem())->handle($review);

        flash()->success('A revisão foi editada!');

        return redirect()->back();
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function destroy($id)
    {
        //
    }
}


text:
Module("block.ui.role", function () {
    Role("Connectable", {

    })
})


text:
package at.kc.tugraz.ss.serv.datatypes.learnep.datatypes;

import at.tugraz.sss.serv.datatype.SSEntity;
import java.util.ArrayList;
import java.util.List;

public class SSLearnEpDailySummaryReminderEntry extends SSLearnEpDailySummaryEntry{

  public List<SSEntity> oneWeekAgoEntities    = new ArrayList<>();
  public List<SSEntity> twoWeeksAgoEntities   = new ArrayList<>();
  public List<SSEntity> threeWeeksAgoEntities = new ArrayList<>();
  public List<SSEntity> fourWeeksAgoEntities  = new ArrayList<>();
}


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.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>MUC Chart Room</title>

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

    <link href="css/justified-nav.css" rel="stylesheet">

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

        </button>
        Muc Demo

Home

Create Room

            <input type='hidden' id='myname' />

            Disconnect

      <form class="form-signin" role="form">

Please sign in

        <input type="text" class="form-control" id='jid' placeholder="Email address" required autofocus>
        <input type="password" class="form-control" placeholder="Password" required id='password'>
      </form>

          chat log

        <input size=30 /><button class='btn btn-mini'>submit</button>

     <form>
       <fieldset>
         Name
         <input type="text" name="name" class="name" class="text ui-widget-content ui-corner-all">
       </fieldset>
     </form>

© Company 2013


text:
@implementation UICollectionViewMock

- (instancetype)init
{
    if (self = [super initWithFrame:CGRectMake(0, 0, 320, 480) collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]]) {
        _operationStrings = [NSMutableArray new];
    }
    return self;
}

- (void)reloadData
{
    [self.operationStrings addObject:[self stringForReloadData]];
}

- (NSString *)stringForReloadData
{
    return [NSString stringWithFormat:@"reloadData on %@", [self stringForQueue]];
}

- (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    [self.operationStrings addObject:[self stringForInsertItemsAtIndexPaths:indexPaths]];
}

- (NSString *)stringForInsertItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    return [NSString stringWithFormat:@"insertItemsAtIndexPaths:[%@] on %@",
            [self stringForIndexPaths:indexPaths],
            [self stringForQueue]];
}

- (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    [self.operationStrings addObject:[self stringForDeleteItemsAtIndexPaths:indexPaths]];
}

- (NSString *)stringForDeleteItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    return [NSString stringWithFormat:@"deleteItemsAtIndexPaths:[%@] on %@",
            [self stringForIndexPaths:indexPaths],
            [self stringForQueue]];
}

- (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    [self.operationStrings addObject:[self stringForReloadItemsAtIndexPaths:indexPaths]];
}

- (NSString *)stringForReloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
    return [NSString stringWithFormat:@"reloadItemsAtIndexPaths:[%@] on %@",
            [self stringForIndexPaths:indexPaths],
            [self stringForQueue]];
}

- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
{
    [self.operationStrings addObject:[self stringForMoveItemAtIndexPath:indexPath toIndexPath:newIndexPath]];
}

- (NSString *)stringForMoveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
{
    return [NSString stringWithFormat:@"moveItemAtIndexPaths:[%@] toIndexPath:[%@] on %@",
            [self stringForIndexPath:indexPath],
            [self stringForIndexPath:newIndexPath],
            [self stringForQueue]];
}

#pragma mark - Helpers

- (NSString *)stringForIndexPath:(NSIndexPath *)indexPath
{
    return [NSString stringWithFormat:@"%@.%@", @(indexPath.section), @(indexPath.row)];
}

- (NSString *)stringForIndexPaths:(NSArray <NSIndexPath *> *)indexPaths
{
    NSMutableArray *strings = [NSMutableArray new];
    [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {
        [strings addObject:[self stringForIndexPath:indexPath]];
    }];
    return [strings componentsJoinedByString:@", "];
}

- (NSString *)stringForQueue
{
    return [NSString stringWithUTF8String:dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)];
}

@end


text:
'use strict';
var isUUID = require('../lib/is-uuid');

describe('is-uuid', function() {
    describe('v4', function() {
        it('should return true for valid v4 uuid', function() {
            require('./support/v4-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid)).toEqual(true);
            });
        });

        it('should return true for valid v4 uuid as when using capital A-F', function() {
            require('./support/v4-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid.toUpperCase())).toEqual(true);
            });
        });

        it ('should return false for invalid v4 uuid', function() {
            expect(isUUID.v4(true)).toEqual(false);
            expect(isUUID.v4(false)).toEqual(false);
            expect(isUUID.v4(null)).toEqual(false);
            expect(isUUID.v4([])).toEqual(false);
            expect(isUUID.v4(function() {})).toEqual(false);
            expect(isUUID.v4(Number.NaN)).toEqual(false);
            expect(isUUID.v4({})).toEqual(false);
            expect(isUUID.v4('not-a-uuid')).toEqual(false);
            expect(isUUID.v4()).toEqual(false);
        });

        it('should return false when querying a v1 uuid', function() {
            require('./support/v1-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid)).toEqual(false);
            });
        });

        it('should return false when querying a v2 uuid', function() {
            require('./support/v2-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid)).toEqual(false);
            });
        });

        it('should return false when querying a v3 uuid', function() {
            require('./support/v3-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid)).toEqual(false);
            });
        });

        it('should return false when querying a v5 uuid', function() {
            require('./support/v5-uuids').forEach(function(uuid) {
                expect(isUUID.v4(uuid)).toEqual(false);
            });
        });
    });
});


text:
JavaScript-based Java parser.  Outputs an abstract syntax tree as specified by the
[Mozilla Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API).

## Language Support

Java is the target language.

## Using Cashew

Cashew ("cashew.js" file) is the Java transpiller. To run it simply serve the html and js files or install it using "npm install cashew-js".
then call function "Parse" with the code as parameter.

    var cashew  = require('cashew-js');
    var ast = cashew.Parse(stringCode);

Cashew provides a runtime "___JavaRuntime" with functions used by the transpilled code to run. The parser will automatically include the call of the "main method" from the first class of the code. You can also wrap the AST in a function with a static call of your choice (or keep the original call to the 'first main') by "cashew.wrapFunction" specifying the ast, a functionName, (a className, and a  staticCall if you want to override the call for the 'first main')

### How cashew works?
Cashew uses [jison](http://zaach.github.io/jison/)  to transpile Java code into JavaScript. The grammar used by cashew is "coco-java.jison" (read more about jison grammars [here](http://zaach.github.io/jison/docs/#specifying-a-language) ).
You can also find the compiled parser in the coco-java.js file and more details about it. Cashew use a embeded version of [UNDERSCORE](http://underscorejs.org/)  to do some tricks with the ast nodes.

Cashew web uses [ESCODEGEN](https://github.com/estools/escodegen) in the web interface to generate the JavaScript code from the AST produced by the parser.

## Testing

You can test basics [here](https://rawgit.com/codecombat/cashew/master/cashew-worker.html)!

## Get in touch

Please use the [GitHub issues](https://github.com/codecombat/cashew/issues), or [email Lucas](mailto:farias.jlucas@gmail.com)