text:
package org.apache.kafka.streams.kstream.internals;

import org.apache.kafka.streams.processor.api.ContextualProcessor;
import org.apache.kafka.streams.processor.api.Processor;
import org.apache.kafka.streams.processor.api.ProcessorContext;
import org.apache.kafka.streams.processor.api.ProcessorSupplier;
import org.apache.kafka.streams.processor.api.Record;
import org.apache.kafka.streams.state.WindowStore;

class KStreamJoinWindow<K, V> implements ProcessorSupplier<K, V, K, V> {

    private final String windowName;

    KStreamJoinWindow(final String windowName) {
        this.windowName = windowName;
    }

    @Override
    public Processor<K, V, K, V> get() {
        return new KStreamJoinWindowProcessor();
    }

    private class KStreamJoinWindowProcessor extends ContextualProcessor<K, V, K, V> {

        private WindowStore<K, V> window;

        @Override
        public void init(final ProcessorContext<K, V> context) {
            super.init(context);

            window = context.getStateStore(windowName);
        }

        @Override
        public void process(final Record<K, V> record) {
            // if the key is null, we do not need to put the record into window store
            // since it will never be considered for join operations
            if (record.key() != null) {
                context().forward(record);
                // Every record basically starts a new window. We're using a window store mostly for the retention.
                window.put(record.key(), record.value(), record.timestamp());
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
    /**
     *
     */
    class Admin extends CI_Controller {

        public function index() {

        }

        public function do_Comment()
        {
        	$comment = $this->input->post('tb_comment');
            $ticket_id = $this->input->post('tb_ticketid');
            $auth_id = $this->session->userdata('user_id');
            $this->load->model('admin_model');
            $this->admin_model->insertcomment($ticket_id, $auth_id, $comment);
            return 'page/';
        }

        public function do_Updatestatus()
        {
        	$data = $this->input->post('tb_status');
        	$this->load->model('admin_model');
        	$this->admin_model->updatestatus($data);
        }

        public function do_CHangeLevel()
        {
        	$data = $this->input->post('tb_level');
        	$this->load->model('admin_model');
        	$this->admin_model->changelevel($data);
        }

    }

?>


text:
#ifndef TOBJECT_H
#define TOBJECT_H

#include "QQmlAutoPropertyHelpers.h"

#include <QDebug>
#include <QObject>
#include <QVector3D>

class TObject : public QObject
{
    Q_OBJECT
    QML_WRITABLE_AUTO_PROPERTY(QString, typeName)
    QML_WRITABLE_AUTO_PROPERTY(int, object_id)
    QML_WRITABLE_AUTO_PROPERTY(QVector3D, location)
    QML_WRITABLE_AUTO_PROPERTY(qreal, mass)
    QML_WRITABLE_AUTO_PROPERTY(QVector3D, engineForce)
    QML_WRITABLE_AUTO_PROPERTY(QVector3D, speed)
    QML_WRITABLE_AUTO_PROPERTY(QVector3D, acceleration)
    QML_WRITABLE_AUTO_PROPERTY(qreal, criticalRadius)
    QML_WRITABLE_AUTO_PROPERTY(bool, acceptNewPoints)

    Q_PROPERTY(QVector3D force READ force WRITE set_force NOTIFY forceChanged)

public:
    explicit TObject(const uint id,
                     const QVector3D &initialLocation = QVector3D(),
                     QObject *parent = 0);
    virtual ~TObject();

    virtual void computeActingForces();

    Q_INVOKABLE void addVisibleObject(TObject *point);
    Q_INVOKABLE const QList<TObject *> &visibleObjects() const;
    Q_INVOKABLE void clearVisibleObjectsList();

    QVector3D force();
    bool set_force(const QVector3D &newForce);

private:
    QVector3D m_force;
    QList<TObject *> m_visibleObjects;

Q_SIGNALS:
    void forceChanged();
};

#endif  // TOBJECT_H


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>写perl的注释和说明 | Yao He's Awesome Site</title>
<link href="../../assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="../../rss.xml">
<link rel="canonical" href="https://stephen0921.github.io/posts/2017-07-07-perl-comment/">
<meta name="author" content="Yao He">
<link rel="prev" href="../2017-07-04-file-glob/" title="perl中的glob函数" type="text/html">
<link rel="next" href="../2017-07-13-perl-misc0/" title="Perl tips series 0" type="text/html">
<meta property="og:site_name" content="Yao He's Awesome Site">
<meta property="og:title" content="写perl的注释和说明">
<meta property="og:url" content="https://stephen0921.github.io/posts/2017-07-07-perl-comment/">
<meta property="og:description" content='perl里的注释

为了让代码更具有可读性,注释必不可少。

my $h; # $h is hash reference

在perl里面有更漂亮的注释或者文档写法,就是POD格式,一些主流的编辑器都能识别这个格式。比如vim,emacs,sublime。

<img src="../../images/pod_emacs.png" class="img-thumbnail" wid'>
<meta property="og:type" content="article">
<meta property="article:published_time" content="2017-07-07T16:53:44+08:00">

Skip to main content

                        Yao He's Awesome Site

            ☰

Archive

Tags

RSS feed

写perl的注释和说明

                    Yao He

                    <time class="published dt-published" datetime="2017-07-07T16:53:44+08:00" itemprop="datePublished" title="2017-07-07 16:53">2017-07-07 16:53</time>

perl里的注释

为了让代码更具有可读性,注释必不可少。

my $h; # $h is hash reference

在perl里面有更漂亮的注释或者文档写法,就是POD格式,一些主流的编辑器都能识别这个格式。比如vim,emacs,sublime。

<img src="../../images/pod_emacs.png" class="img-thumbnail" width="60%">

在perl程序中,以"="开头,一些关键字比如head1,head2然后紧跟着一个空行,都被认为是pod格式的说明注释,可以看到"my $err = '';"这一段也被注释掉了,因为perl默认会去找关键字"=cut"作为pod注释的结束标志。

我们在shell里运行这个文件,比如我们把它命名为pod.pl。

perldoc pod.pl

我们能得到我们的注释和说明如下:

<img src="../../images/pod_sh.png"
class="img-thumbnail"
width="60%"
</img>

另外使用其他工具,比如pod2text,pod2html,pod2latex等,可以把我们的注释转成多种格式。

<img src="../../images/pod_trans.png"
class="img-thumbnail"
width="60%"
</img>

                Previous post

                Next post

<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">

        <button class="btn btn-fab btn-raised btn-material-green btn-footer" data-toggle="modal" data-target="#footer-dialog">

        </button>

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Yao He's Awesome Site credits

                    Contents © 2018         Yao He - Powered by         Nikola

                <button class="btn btn-primary" data-dismiss="modal">Ok</button>


text:
package stock.undirected;

import java.io.*;
import java.util.*;
import stock.edge.StockEdge;
import stock.util.StockData;
import stock.util.StockGroundTruth;
import stock.vertex.StockVertex;
import utility.*;
import edu.uci.ics.jung.graph.*;

public class StockUndirectedGraph extends UndirectedSparseGraph<StockVertex, StockEdge> implements Serializable {

	private static final long serialVersionUID = 5507466311745266148L;

	// For speedup
	HashMap<String, StockVertex> codeToVertex = new HashMap<String, StockVertex>();
	HashMap<String, StockVertex> nameToVertex = new HashMap<String, StockVertex>();

	public StockVertex getVertexByCode(String code) {
		return codeToVertex.get(code);
	}

	public StockVertex getVertexByName(String name) {
		return nameToVertex.get(name);
	}

	public boolean addVertex(StockVertex v) {
		if(!v.getCode().equalsIgnoreCase("")) {
			codeToVertex.put(v.getCode(), v);
		}
		nameToVertex.put(v.getName(), v);
		return super.addVertex(v);
	}

	public StockVertex addNewVertex(String name) {
		StockVertex sv = getVertexByName(name);
		if(sv == null) {
			sv = StockVertex.generateVertex("", name, 0, StockVertex.TYPE_UNKNOWN);
			addVertex(sv);
		}
		return sv;
	}

	public StockVertex addNewVertex(String name, long stock) {
		StockVertex sv = getVertexByName(name);
		if(sv == null) {
			sv = StockVertex.generateVertex("", name, stock, StockVertex.TYPE_UNKNOWN);
			addVertex(sv);
		}
		else {
			sv.setStock(sv.getStock() + stock);
		}
		return sv;
	}

	public StockEdge addNewEdge(StockVertex source, StockVertex destination, long stock, int type) {
		StockEdge se = StockEdge.generateEdge(stock, source.getName(), destination.getName(), type);
		boolean added = addEdge(se, source, destination);
		if(added == true) {
			return se;
		}
		else {
			return null;
		}

	}

	public boolean removeVertex(StockVertex v) {
		codeToVertex.remove(v.getCode());
		nameToVertex.remove(v.getName());
		return super.removeVertex(v);
	}

	public int getPublicCount() {
		return codeToVertex.size();
	}

	public static StockUndirectedGraph load(String vertexFileName, String edgeFileName, int minDegree) throws Exception {
		StockUndirectedGraph graph = load(vertexFileName, edgeFileName);
		StockUndirectedGraphSampler.sample(graph, minDegree);
		return graph;
	}

	public static StockUndirectedGraph load(String vertexFileName, String edgeFileName) throws Exception {
		StockUndirectedGraph graph = new StockUndirectedGraph();

		// Vertex
		FileReader frv = new FileReader(vertexFileName);
		LineNumberReader lnrv = new LineNumberReader(frv);
		String sv = null;
		while ((sv=lnrv.readLine()) != null) {
			StockVertex v = StockVertex.generateVertex(sv);
			graph.addVertex(v);
		}
		lnrv.close();
		frv.close();

		// Edge
		FileReader fre = new FileReader(edgeFileName);
		LineNumberReader lnre = new LineNumberReader(fre);
		String se = null;
		while ((se=lnre.readLine()) != null) {
			StockEdge e = StockEdge.generateEdge(se);
			StockVertex source = graph.getVertexByName(e.getSourceName());
			StockVertex destination = graph.getVertexByName(e.getDestinationName());
			graph.addEdge(e, source, destination);
		}
		lnre.close();
		fre.close();

		return graph;
	}

	public StockUndirectedGraph clone() {
		StockUndirectedGraph g = new StockUndirectedGraph();

		// Vertex
		for(Iterator<StockVertex> iv = getVertices().iterator(); iv.hasNext(); ) {
			StockVertex sv = iv.next();
			StockVertex v = StockVertex.generateVertex(sv.toFileString());
			v.setGround(sv.getGround());
			v.setEnglish(sv.getEnglish());
			g.addVertex(v);
		}

		// Edge
		for(Iterator<StockEdge> ie = getEdges().iterator(); ie.hasNext(); ) {
			StockEdge se = ie.next();
			StockEdge e = StockEdge.generateEdge(se.toFileString());
			e.setValue(se.getValue());
			StockVertex source = g.getVertexByName(e.getSourceName());
			StockVertex destination = g.getVertexByName(e.getDestinationName());
			g.addEdge(e, source, destination);
		}

		return g;
	}

	public void labelVerticesUsingGroundTruth(StockGroundTruth ground) {
		for(Iterator<String> it = ground.getCodeToRevenueMap().keySet().iterator(); it.hasNext(); ) {
			String code = it.next();
			int result = ground.getCodeToRevenueMap().get(code);
			StockVertex sv = getVertexByCode(code);
			if(sv != null) {
				sv.setGround(result);
			}
		}
	}

	public HashSet<String> getPublicVertexCodes() {
		HashSet<String> publicVertexCodes = new HashSet<String>();
		for(StockVertex sv : codeToVertex.values()) {
			publicVertexCodes.add(sv.getCode());
		}
		return publicVertexCodes;
	}

	public double getCC(StockVertex v) {
		int triangles = 0;
		int triples = 0;
		Collection<StockVertex> neighbors = getNeighbors(v);
		for(StockVertex vi : neighbors) {
			for(StockVertex vj : neighbors) {
				if(findEdge(vi, vj) != null) {
					triangles++;
				}
				triples++;
			}
		}
		if(triples == 0) {
			return 0;
		}
		double cc = (double)triangles/(double)triples;
		return cc;
	}

	public void setVertexEnglishs(StockData sd) {
		for(StockVertex v : getVertices()) {
			String english = sd.getEnglish(v.getCode());
			if(english != null) {
				v.setEnglish(english);
			}
		}
	}

	public StockVertex getRandomVertex() {
		Random random = new Random();
		int number = random.nextInt(getVertexCount());
		int count = 0;
		StockVertex result = null;
		for(StockVertex v : getVertices()) {
			result = v;
			if(count == number) {
				break;
			}
			count++;
		}
		return result;
	}

	public void removeBanks(String fileName) throws Exception {
		Vector<String> banks = Utility.loadVector("bank.txt");
		TreeSet<StockVertex> removeSet = new TreeSet<StockVertex>();

		for (StockVertex v : getVertices()) {
			if (banks.contains(v.getName())) {
				removeSet.add(v);
			}
		}

		for (StockVertex v: removeSet) {
			removeVertex(v);
		}
	}
}


text:
from __future__ import unicode_literals, print_function, absolute_import
from .. import GitHubCommand
from giles.utils import get_input

import chalk

class PullRequestBase(GitHubCommand):
    """
    Pull request review interface
        https://developer.github.com/v3/pulls/reviews/
    """
    abstract = True
    _continue = True

    def add_base_arguments(self):
        self.parser.add_argument(
            'number',
            type=int,
            nargs='?',
            default=None,
            help='Pull request number'
        )
        self.parser.add_argument(
            '--fetch',
            help='fetch all before running anything',
            action='store_true'
        )
        self.parser.add_argument(
            '--details',
            help='details of the pull request',
            action='store_true'
        )
        self.parser.add_argument(
            '--diff',
            help='print out the diff',
            action='store_true'
        )
        self.parser.add_argument(
            '-q',
            '--quiet',
            help='silence listing of reviews',
            action='store_true'
        )
        self.parser.add_argument(
            '-m',
            dest='comment',
            help='add a comment to the pull request'
        )

    def base_run(self, args):
        if args.fetch:
            self.git.fetch('--all')

        if args.number is None:
            self._continue = False
            return {'table': self.parent.list.render_pull_requests()}

        self.pr = self.repo.get_pull(args.number)

        if args.details:
            self._continue = False
            return self.format_details()
        if args.diff:
            self._continue = False
            return self.print_diff()

    def reviews(self):
        resp = self.client.get(self.pr.url + '/reviews')
        resp.raise_for_status()
        return resp.json()

    def format_reviews(self):
        reviews = self.reviews()
        return {
            'table': {
                'heading': ['ID', 'STATE', 'USER'],
                'data': [
                    (review['id'], review['state'], review['user']['login'])
                    for review in reviews
                ]
            }
        }

    def format_details(self):
        return {
            'table': {
                'heading': [
                    '{} PR: {}  by {} | {} -> {}'.format(
                        self.pr.state.upper(),
                        self.pr.number,
                        self.pr.user.login,
                        self.pr.head.ref,
                        self.pr.base.ref,
                    )
                ],
                'data': [
                    (self.pr.html_url + '/files\n',),
                    (
                        'COMMENTS: {}'.format(self.pr.comments),
                        'REVIEWS: {}'.format(len(self.reviews()))
                    ),
                    ('TITLE:',),
                    ('', self.pr.title,),
                    ('BODY:',),
                    ('', self.pr.body,)
                ],
                'width': 6
            },
        }

    def checkout_remotes(self):
        _branch_name = self.giles.repo.active_branch.name
        self.checkout_remote('origin/' + self.pr.head.ref, silent=True)
        self.checkout_remote('origin/' + self.pr.base.ref, silent=True)
        self.git.checkout(_branch_name)

    def print_diff(self):
        self.checkout_remotes()
        diff = self.git.diff(self.pr.base.sha, self.pr.head.sha)
        if not diff:
            return

        sep = 'diff --'
        files = diff[6:].split(sep)
        chalk.magenta(
            '######\n\nHit Enter for the next file\n\n######',
            opts=['bold']
        )
        try:
            while True:
                _file = files.pop(0)
                print(self.format_diff(sep + _file))
                if files:
                    get_input('===')
        except KeyboardInterrupt:
            chalk.red('\nExit', opts=['bold'])
        except IndexError as err:
            chalk.magenta('\n\n######\n\nDiff Completed', opts=['bold'])


text:
function image = subsindex(obj, index)
    image = obj.getImage(index);
end


text:
package OpenXPKI::Test::WorkflowMock;
use Moose;
use utf8;

# CPAN modules
use Workflow::Context;
use Workflow::Factory qw( FACTORY );
=head1 NAME

OpenXPKI::Test::WorkflowMock - Mock object that pretends to be a workflow an just provides the context object

=cut

has context => (
    is => 'rw',
    isa => 'Workflow::Context',
    lazy => 1,
    default => sub { Workflow::Context->new() },
);

has state => (
    is => 'rw',
    isa => 'Str',
    lazy => 1,
    default => 'INITIAL',
);

sub _factory { FACTORY }

__PACKAGE__->meta->make_immutable;


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="">
    <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">

    <title>No quiero ser un feeder </title>

    <link rel="stylesheet" href="{{url_for('static', filename = 'css/bootstrap.css')}}">

    <link href="{{url_for('static', filename = 'css/main.css')}}" rel="stylesheet">

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

          </button>
          NO QUIERO SER UN FEEDER

<<<<<<< HEAD:static/NOFEEDER/work.html

Sobre Nosotros

Contáctanos

=======

Ayuda

Sobre Nosotros

Contáctanos

>>>>>>> 878968768daf8514b588a3710f95a5443b7c038e:templates/work.html

  Cómo hacer una consulta?

No quiero ser Feeder

						Beaucheff 851,

						+569 75675256,

						Santiago, Chile.

Buscanos en Redes Sociales

						Instagram

						Twitter

						Facebook

¡Saca el Challenger que llevas dentro!

Nuestra misión es que dejes de ser manco


text:
package com.gueei.demos.markupDemo.contentProvider;
/**
 * User: =ra=
 * Date: 18.07.11
 * Time: 22:04
 */

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.text.TextUtils;

import java.util.HashMap;

public class mdContentProvider extends ContentProvider {

	private static final String DATABASE_NAME                        = "markupDemo.db";
	private static final int    DATABASE_VERSION                     = 1;
	private static final int    MASTER_TABLE_GROUPS_COUNT            = 20;
	private static final int    DETAIL_RECORD_COUNT_FOR_MASTER_GROUP = 2;

	/**
	 * This class helps open, create, and upgrade the database file.
	 */
	private static class DatabaseHelper extends SQLiteOpenHelper {

		private final Context sContext;

		DatabaseHelper(Context context) {
			super(context, DATABASE_NAME, null, DATABASE_VERSION);
			sContext = context;
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			db.beginTransaction();
			try {
				db.execSQL("CREATE TABLE master(_ID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE " +
						   "NOT " + "NULL," + "Name TEXT," +
						   "detailsCount INTEGER NOT NULL DEFAULT 0)");
				db.execSQL("CREATE TABLE detail(_ID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE " +
						   "NOT " + "NULL," + "" + "" + "Name TEXT," +
						   "masterID INTEGER NOT NULL)");
				db.execSQL(
						"CREATE TRIGGER masterReCalcDelete AFTER DELETE ON detail FOR EACH ROW " +
						"BEGIN " +
						"UPDATE master Set detailsCount=(select count(*) from detail where " +
						"detail.masterID=OLD" + ".masterID)" + "WHERE master._ID=OLD.masterID;" +
						"END");
				db.execSQL(
						"CREATE TRIGGER masterReCalcInsert AFTER INSERT ON detail FOR EACH ROW " +
						"BEGIN " +
						"UPDATE master Set detailsCount=(select count(*) from detail where " +
						"detail.masterID=NEW" + ".masterID)" + "WHERE  master._ID=NEW.masterID;" +
						"DELETE from detail WHERE NOT EXISTS (SELECT 1 FROM master WHERE detail" +
						".masterID=master" + "._ID);END");
				db.execSQL(
						"CREATE TRIGGER masterReCalcUpdate AFTER UPDATE ON detail FOR EACH ROW " +
						"WHEN NEW" + ".masterID!=OLD.masterID " +
						"BEGIN UPDATE master Set detailsCount=(select count(*) from detail " +
						"where detail" + ".masterID=NEW.masterID)" +
						"WHERE master._ID=NEW.masterID;" +
						"UPDATE master Set detailsCount=(select count(*) from detail where " +
						"detail.masterID=OLD" + ".masterID)" +
						"WHERE  master._ID=OLD.masterID;END");
				db.execSQL("CREATE TRIGGER masterInsert  AFTER INSERT ON master FOR EACH ROW " +
						   "BEGIN " +
						   "UPDATE master Set detailsCount=(select count(*) from detail where " +
						   "detail.masterID=NEW" + "._ID)" + "WHERE  master._ID=NEW._ID;END");
				fillWithData(db);
				db.setTransactionSuccessful();
			}
			catch (Exception ex) {
				ex.printStackTrace();
			}
			finally {
				db.endTransaction();
			}
		}

		@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		}

		public void fillWithData(SQLiteDatabase db) {
			// master
			db.execSQL("delete from detail");
			String master =
					"insert or replace into master (Name,_ID) values ('Group [GRP]'," + "[GRP])";
			String detail = "insert into detail (Name,masterID) values ('Item [GRP].[ITEM]'," +
							"[GRP])";
			for (int group = 1; group <= MASTER_TABLE_GROUPS_COUNT; ++group) {
				String grpInsCmd = master.replace("[GRP]", ((Integer) group).toString());
				db.execSQL(grpInsCmd);
				for (int item = 1; item <= DETAIL_RECORD_COUNT_FOR_MASTER_GROUP; ++item) {
					String itmInsCmd = detail.replace("[GRP]", ((Integer) group).toString());
					itmInsCmd = itmInsCmd.replace("[ITEM]", ((Integer) item).toString());
					db.execSQL(itmInsCmd);
				}
			}
		}
	}

	private DatabaseHelper mOpenHelper;

	@Override public boolean onCreate() {
		mOpenHelper = new DatabaseHelper(getContext());
		return true;
	}

	@Override
	public Cursor query(final Uri uri, final String[] projection, final String selection,
						final String[] selectionArgs, final String sortOrder) {
		SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
		String orderBy = null;
		String groupBy = null;
		String having = null;
		switch (sUriMatcher.match(uri)) {
		case DETAIL_ITEM:
			qb.appendWhere("detail._ID=" + uri.getPathSegments().get(1));
		case DETAIL_DIR:
			qb.setTables("detail");
			qb.setProjectionMap(sDetailProjectionMap);
			orderBy = DETAIL_SORT_ORDER;
			break;
		case DETAIL_MASTER_DIR:
			qb.appendWhere("detail.masterID=" + uri.getPathSegments().get(2));
			qb.setTables("detail");
			qb.setProjectionMap(sDetailProjectionMap);
			orderBy = DETAIL_SORT_ORDER;
			break;
		case MASTER_ITEM:
			qb.appendWhere("master._ID=" + uri.getPathSegments().get(1));
		case MASTER_DIR:
			qb.setTables("master");
			qb.setProjectionMap(sMasterProjectionMap);
			orderBy = MASTER_SORT_ORDER;
			break;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
		if (!TextUtils.isEmpty(sortOrder)) {
			orderBy = sortOrder;
		}
		// Get the database and run the query
		SQLiteDatabase db = mOpenHelper.getReadableDatabase();
		Cursor cursor =
				qb.query(db, projection, selection, selectionArgs, groupBy, having, orderBy);
		// Tell the cursor what uri to watch, so it knows when its source data changes
		cursor.setNotificationUri(getContext().getContentResolver(), uri);

		return cursor;
	}

	@Override public String getType(final Uri uri) {
		switch (sUriMatcher.match(uri)) {
		case DETAIL_ITEM:
			return CONTENT_TYPE_PART_ITEM + "detail";
		case DETAIL_DIR:
		case DETAIL_MASTER_DIR:
			return CONTENT_TYPE_PART_DIR + "detail";
		case MASTER_ITEM:
			return CONTENT_TYPE_PART_ITEM + "master";
		case MASTER_DIR:
			return CONTENT_TYPE_PART_DIR + "master";
		case RESTORE_ALL:
			return CONTENT_TYPE_PART_ITEM + "restore";
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
	}

	@Override public Uri insert(final Uri uri, final ContentValues initialValues) {
		ContentValues values;
		if (initialValues != null) {
			values = new ContentValues(initialValues);
		}
		else {
			values = new ContentValues();
		}
		if (values.containsKey("_ID") == true) {
			values.remove("_ID");
		}
		if (values.containsKey("Name") == false) {
			values.put("Name", "Wasn't set");
		}
		SQLiteDatabase db = mOpenHelper.getWritableDatabase();
		long rowId = 0;
		switch (sUriMatcher.match(uri)) {
		case DETAIL_DIR:
			if (values.containsKey("masterID") == false) {
				throw new SQLException(
						"detail.masterID is not set. Failed to insert row into " + uri);
			}
			rowId = db.insert("detail", null, values);
			if (rowId > 0) {
				Uri xUri = Uri.parse(
						"content://" + AUTHORITY + "/detail/" + ((Long) rowId).toString());
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/detail/#"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/details"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/details/master/#"),
									  null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/master/#"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/masters"), null);
				return xUri;
			}
			else {
				throw new SQLException("Failed to insert row into " + uri);
			}
		case MASTER_DIR:
			if (values.containsKey("detailsCount") == true) {
				values.remove("detailsCount");
			}
			rowId = db.insert("master", null, values);
			if (rowId > 0) {
				Uri xUri = Uri.parse(
						"content://" + AUTHORITY + "/master/" + ((Long) rowId).toString());
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/master/#"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/masters"), null);
				return xUri;
			}
			else {
				throw new SQLException("Failed to insert row into " + uri);
			}
		case RESTORE_ALL:
			db.beginTransaction();
			try {
				mOpenHelper.fillWithData(db);
				db.setTransactionSuccessful();
				Uri xUri = Uri.parse("content://" + AUTHORITY + "/restore/1");
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/detail/#"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/details"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/details/master/#"),
									  null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/master/#"), null);
				getContext().getContentResolver()
						.notifyChange(Uri.parse("content://" + AUTHORITY + "/masters"), null);
				return xUri;
			}
			catch (Exception ex) {
				ex.printStackTrace();
			}
			finally {
				db.endTransaction();
			}
		default:
			throw new IllegalArgumentException("Insert: Unknown URI " + uri);
		}
	}

	@Override
	public int delete(final Uri uri, final String selection, final String[] selectionArgs) {
		int count = 0;
		SQLiteDatabase db = mOpenHelper.getWritableDatabase();
		String where = null;
		switch (sUriMatcher.match(uri)) {
		case DETAIL_ITEM: {
			where = "detail._ID=" + uri.getPathSegments().get(1);
		}
		case DETAIL_DIR:
			if (null != where) {
				where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			}
			else {
				where = selection;
			}
			count = db.delete("detail", where, selectionArgs);
			break;
		case DETAIL_MASTER_DIR:
			where = "detail.masterID=" + uri.getPathSegments().get(2);
			where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			count = db.delete("detail", where, selectionArgs);
			break;
		case MASTER_ITEM: {
			where = "master._ID=" + uri.getPathSegments().get(1);
		}
		case MASTER_DIR:
			if (null != where) {
				where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			}
			else {
				where = selection;
			}
			count = db.delete("master", where, selectionArgs);
			break;
		default:
			throw new IllegalArgumentException("Delete: Unknown URI " + uri);
		}
		if (count > 0) {
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/detail/#"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/details"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/details/master/#"),
								  null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/master/#"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/masters"), null);
		}
		return count;
	}

	@Override
	public int update(final Uri uri, final ContentValues initialValues, final String selection,
					  final String[] selectionArgs) {
		SQLiteDatabase db = mOpenHelper.getWritableDatabase();
		int count = 0;
		ContentValues values;
		if (initialValues != null) {
			values = new ContentValues(initialValues);
		}
		else {
			values = new ContentValues();
		}
		if (values.containsKey("_ID") == true) {
			throw new SQLException(
					"Value <_ID> shouldn't be changed. Failed to update row in " + uri);
		}
		if (values.containsKey("detailsCount") == true) {
			values.remove("detailsCount");
		}
		String where = null;
		switch (sUriMatcher.match(uri)) {
		case DETAIL_ITEM: {
			where = "detail._ID=" + uri.getPathSegments().get(1);
		}
		case DETAIL_DIR:
			if (null != where) {
				where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			}
			else {
				where = selection;
			}
			count = db.update("detail", values, where, selectionArgs);
			break;
		case DETAIL_MASTER_DIR:
			where = "detail.masterID=" + uri.getPathSegments().get(2);
			where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			count = db.update("detail", values, where, selectionArgs);
			break;
		case MASTER_ITEM: {
			where = "master._ID=" + uri.getPathSegments().get(1);
		}
		case MASTER_DIR:
			if (null != where) {
				where += (!TextUtils.isEmpty(selection) ? " AND (" + selection + ")" : "");
			}
			else {
				where = selection;
			}
			count = db.update("master", values, where, selectionArgs);
			break;
		default:
			throw new IllegalArgumentException("Update: Unknown URI " + uri);
		}
		if (count > 0) {
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/detail/#"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/details"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/details/master/#"),
								  null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/master/#"), null);
			getContext().getContentResolver()
					.notifyChange(Uri.parse("content://" + AUTHORITY + "/masters"), null);
		}
		return count;
	}

	private static final String CONTENT_TYPE_PART_DIR  = "vnd.android.cursor.dir/com.gueei" +
														 ".demos.";
	private static final String CONTENT_TYPE_PART_ITEM =
			"vnd.android.cursor.item/com.gueei" + ".demos.";
	public static final  String AUTHORITY              = "com.gueei.demos";
	// URIs constants
	private static final int    DETAIL_ITEM            = 0;
	private static final int    DETAIL_DIR             = 1;
	private static final int    DETAIL_MASTER_DIR      = 2;
	private static final int    MASTER_ITEM            = 3;
	private static final int    MASTER_DIR             = 4;
	private static final int    RESTORE_ALL            = 5;
	// Sort Orders
	private static final String DETAIL_SORT_ORDER      = "detail.masterID ASC,detail._ID ASC";
	private static final String MASTER_SORT_ORDER      = "master._ID ASC";
	// Uri Matcher
	private static final UriMatcher sUriMatcher;
	// projections
	private static HashMap<String, String> sDetailProjectionMap = new HashMap<String, String>();
	private static HashMap<String, String> sMasterProjectionMap = new HashMap<String, String>();

	static {
		sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
		sUriMatcher.addURI(AUTHORITY, "detail/#", DETAIL_ITEM);
		sUriMatcher.addURI(AUTHORITY, "details", DETAIL_DIR);
		sUriMatcher.addURI(AUTHORITY, "details/master/#", DETAIL_MASTER_DIR);
		sUriMatcher.addURI(AUTHORITY, "master/#", MASTER_ITEM);
		sUriMatcher.addURI(AUTHORITY, "masters", MASTER_DIR);
		sUriMatcher.addURI(AUTHORITY, "restore", RESTORE_ALL);
		//projection detail
		sDetailProjectionMap.put("_ID", "_ID");
		sDetailProjectionMap.put("Name", "Name");
		sDetailProjectionMap.put("masterID", "masterID");
		//projection master
		sMasterProjectionMap.put("_ID", "_ID");
		sMasterProjectionMap.put("Name", "Name");
		sMasterProjectionMap.put("detailsCount", "detailsCount");
	}
}


text:
<!DOCTYPE HTML>

	<meta charset="utf-8">
    <title>How to use jQuery in your web pages</title>
    <link rel="stylesheet" type="text/css" href="styles/main.css">

Welcome to jQuery!

    Visit Murach's Web Site


text:
<?= label('tituloPersonas'); ?>

                                                    <a href="<?= base_url() ?>proveedores/agregar"
                                                       class="btn btn-default"><?= label('agregar_persona'); ?>

                                                                <input class="filled-in checkbox checkall" type="checkbox"
                                                                       id="checkbox-all"
                                                                       onclick="toggleChecked(this.checked)"/>

                                                            <?= label('Persona_tablaTipo'); ?>
                                                            <?= label('Persona_tablaTipoPersona'); ?>
                                                            <?= label('Persona_tablaIdentificacion'); ?>
                                                            <?= label('Persona_tablaNombre'); ?>
                                                            <?= label('Persona_tablaCorreo'); ?>
                                                            <?= label('Persona_tablaOpciones'); ?>

                                                        <?php
                                                            if(isset($lista)) {
                                                                if($lista != false) {
                                                                    $contador = 0;
                                                                    foreach ($lista as $fila) {
                                                                        $idEncriptado = encryptIt($fila['idProveedor']);
                                                                        $empleado = $fila['empleado'];
                                                                        $juridico = $fila['juridico'];
                                                                        $tipo = '';
                                                                        $tipoPersona = '';
                                                                        $nombre = '';
                                                                        if($empleado) {
                                                                            $tipo = 'Empleado';
                                                                            $tipoPersona = 'Fisico';
                                                                            $nombre = $fila['nombre'].' '.$fila['primerApellido'].' '.$fila['segundoApellido'];
                                                                        } else {
                                                                            $tipo = 'Proveedor';
                                                                            if($juridico) {
                                                                                $tipoPersona = 'Juridico';
                                                                                $nombre = $fila['nombre'];
                                                                            } else {
                                                                                $tipoPersona = 'Fisico';
                                                                                $nombre = $fila['nombre'].' '.$fila['primerApellido'].' '.$fila['segundoApellido'];
                                                                            }
                                                                        }
                                                        ?>
                                                        <tr id="fila<?= $contador ?>" data-idElemento="<?= $idEncriptado ?>">

                                                                <input type="checkbox" class="filled-in checkbox"
                                                                       id="<?= $idEncriptado; ?>"/>
                                                                <label for="<?= $idEncriptado; ?>">

                                                            <?= $tipo; ?>
                                                            <?= $tipoPersona; ?>
                                                            <?= $fila['identificacion']; ?>
                                                            <a href="<?= base_url() ?>proveedores/editar/<?= $idEncriptado; ?>#tab-informacion"><?= $nombre; ?>
                                                            <?= $fila['correo']; ?>

                                                                <ul id="dropdown-proveedor<?= $contador; ?>" class="dropdown-content">

                                                                        <a href="<?= base_url(); ?>proveedores/editar/<?= $idEncriptado; ?>#tab-informacion"
                                                                           class="-text"><?= label('menuOpciones_ver') ?>

                                                                        <a href="<?= base_url(); ?>proveedores/editar/<?= $idEncriptado; ?>#tab-edicion"
                                                                           class="-text"><?= label('menuOpciones_editar') ?>

                                                                        <a href="#eliminarProveedor" class="-text modal-trigger confirmarEliminar" data-id-eliminar="<?= $idEncriptado ?>"
                                                                           data-fila-eliminar="fila<?= $contador?>"><?= label('menuOpciones_eliminar') ?>

                                                                <a class="boton-opciones btn-flat dropdown-button waves-effect white-text"
                                                                   href="#" data-activates="dropdown-proveedor<?= $contador++; ?>">
                                                                    <?= label('menuOpciones_seleccionar') ?>

                                                        <?php
                                                                    }
                                                                }
                                                            }
                                                        ?>

                                                    <a id="opciones-seleccionados-print"
                                                       class="black-text opciones-seleccionados option-print-table"
                                                       style="visibility: hidden;"
                                                       href="#" data-toggle="tooltip"
                                                       title="<?= label('opciones_seleccionadosImprimir') ?>">

                                                            <?= label('opciones_seleccionadosExportarPdf') ?>

                                                            <?= label('opciones_seleccionadosExportarExcel') ?>

                                                    <a id="opciones-seleccionados-export"
                                                       style="visibility: hidden;"
                                                       class="opciones-seleccionados boton-opciones black-text dropdown-button option-export-table"
                                                       href="#" data-toggle="tooltip"
                                                       title="<?= label('opciones_seleccionadosExportar') ?>"
                                                       data-activates="dropdown-exportar">

                                                    <a id="opciones-seleccionados-delete"
                                                       class="modal-trigger black-text opciones-seleccionados option-delete-elements"
                                                       style="visibility: hidden;"
                                                       href="#eliminarElementosSeleccionados" data-toggle="tooltip"
                                                       title="<?= label('opciones_seleccionadosEliminar') ?>">

    <?php
    $this->load->view('layout/default/menu-crear.php');
    ?>

<?= label('nombreSistema'); ?>

<?= label('errorLeerDatos'); ?>

        <?= label('aceptar'); ?>

<?= label('nombreSistema'); ?>

<?= label('errorEliminar'); ?>

        <?= label('aceptar'); ?>

<?= label('nombreSistema'); ?>

<?= label('confirmarDesactivarProveedor'); ?>

        <?= label('aceptar'); ?>

<?= label('nombreSistema'); ?>

<?= label('confirmarEliminarProveedor'); ?>

        <?= label('aceptar'); ?>

<?= label('nombreSistema'); ?>

<?= label('clientes_archivosSeleccionadosEliminar'); ?>

            <?= label('aceptar'); ?>


text:
package com.nwalsh.xalan;

import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
import org.apache.xml.utils.DOMBuilder;
import com.nwalsh.xalan.Callout;
import org.apache.xml.utils.AttList;

public class FormatUnicodeCallout extends FormatCallout {
  int unicodeMax = 0;
  int unicodeStart = 0;
  String unicodeFont = "";

  public FormatUnicodeCallout(String font, int start, int max, boolean fo) {
    unicodeFont = font;
    unicodeMax = max;
    unicodeStart = start;
    stylesheetFO = fo;
  }

  public void formatCallout(DOMBuilder rtf,
			    Callout callout) {
    Element area = callout.getArea();
    int num = callout.getCallout();
    String label = areaLabel(area);

    try {
      if (label == null && num <= unicodeMax) {
	AttributesImpl inAttr = new AttributesImpl();
	String ns = "";
	String prefix = "";
	String inName = "";

	if (!unicodeFont.equals("")) {
	  if (stylesheetFO) {
	    ns = foURI;
	    prefix = "fo:";
	    inName = "inline";
	    inAttr.addAttribute("", "", "font-family", "CDATA", unicodeFont);
	  } else {
	    inName = "font";
	    inAttr.addAttribute("", "", "face", "CDATA", unicodeFont);
	  }
	}

	char chars[] = new char[1];
	chars[0] = (char) (unicodeStart + num - 1);

	startSpan(rtf);
	if (!unicodeFont.equals("")) {
	  rtf.startElement(ns, inName, prefix+inName, inAttr);
	}
	rtf.characters(chars, 0, 1);
	if (!unicodeFont.equals("")) {
	  rtf.endElement(ns, inName, prefix+inName);
	}
	endSpan(rtf);
      } else {
	formatTextCallout(rtf, callout);
      }
    } catch (SAXException e) {
      System.out.println("SAX Exception in unicode formatCallout");
    }
  }
}


text:
<?php

namespace CheckTimer\AdBundle\DQL;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\Lexer;

/**
 * RAND() function
 *
 * This function returns a random number.
 *
 * NOTE: It isn't fully implemented!
 *
 * @author Alessandro Desantis <desa.alessandro@gmail.com>
 */
class RandFunction extends FunctionNode
{
    public function getSql(SqlWalker $sqlWalker)
    {
        return 'RAND()';
    }

    public function parse(Parser $parser)
    {
        $parser->match(Lexer::T_IDENTIFIER);
        $parser->match(Lexer::T_OPEN_PARENTHESIS);
        $parser->match(Lexer::T_CLOSE_PARENTHESIS);
    }
}


text:
//
//  AKAdScrollView.m
//  AKAdScrollView
//
//  Created by Aston K Mac on 15/9/10.
//  Copyright (c) 2015年 UYAC. All rights reserved.
//

#import "AKAdScrollView.h"
#import "AKAdImageCell.h"
#import "UIImageView+XHURLDownload.h"

NSInteger const kNumberSections = 3;

NSTimeInterval const kDefaultScrollDuration = 3;

@interface AKAdScrollView ()<UICollectionViewDataSource, UICollectionViewDelegate, UIScrollViewDelegate>

@property (nonatomic, strong) UICollectionView *colView;

@property (nonatomic, assign) NSInteger numberItems;

@property (nonatomic, strong) NSTimer *timer;

@property (nonatomic, assign) NSTimeInterval duration;

@property (nonatomic, strong) UIPageControl *pageControl;

@end

@implementation AKAdScrollView{
    BOOL _isDragging ;
    BOOL _isWaitting;
}

#pragma mark -
#pragma mark ---------SetUp
- (void)willMoveToSuperview:(UIView *)newSuperview
{
    [super willMoveToSuperview:newSuperview];
//    if (_delegate != nil) {
        if (_colView == nil ) {
            [self builUI];
            [self activiTimer];
        }
//    }
}

- (void)builUI
{
    UICollectionViewFlowLayout *layout =  [[UICollectionViewFlowLayout alloc] init];
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    layout.itemSize = self.bounds.size;
    layout.minimumLineSpacing = 0.f;
    layout.minimumInteritemSpacing = 0;
    layout.sectionInset = UIEdgeInsetsZero;
    _colView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:layout];
    _colView.delegate = self;
    _colView.dataSource  = self;
    _colView.pagingEnabled = YES;
    _colView.showsHorizontalScrollIndicator = NO;
    [_colView registerNib:[UINib nibWithNibName:@"AKAdImageCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"AKAdImageCell"];
    [self addSubview:_colView];

    NSInteger number = 0;
    number = [self ak_numberOfItems];
    _pageControl = [[UIPageControl alloc] init];
    _pageControl.bounds = CGRectMake(0, 0, 20 * number, 25);
    _pageControl.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMaxY(self.bounds)-8);
    _pageControl.numberOfPages = number;
    _pageControl.currentPage  = 0;
    _pageControl.hidesForSinglePage = YES;
    [self addSubview:_pageControl];
    [self bringSubviewToFront:_pageControl];

        [_colView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:kNumberSections/2] atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
}

- (NSInteger)numberItems
{
    if (_numberItems <= 0) {
        _numberItems = [self ak_numberOfItems];
    }
    return _numberItems;
}

#pragma mark -
#pragma mark ---------NSTimer
- (void)activiTimer
{

        // 告诉主线程在忙其他事时,分点空间

        _duration = [self ak_scrollDuration];
        NSTimer *timer =  [NSTimer scheduledTimerWithTimeInterval:_duration target:self selector:@selector(nextImage) userInfo:nil repeats:YES];
        [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
        self.timer = timer;

}

- (void)stopTimer
{
    // 停止定时器
    [self.timer invalidate];
    self.timer = nil;
}

- (void)nextImage
{
    if (_isDragging == YES) {
        return;
    }
    // 获取当前显示页 (indexPathsForVisibleItems 返回当前可见的items)
    NSIndexPath *currentIndexPath = [[self.colView indexPathsForVisibleItems] lastObject];

    //中间的section 该元素对应位置
    NSIndexPath *reCurrentIndexPath = [NSIndexPath indexPathForItem:currentIndexPath.item inSection:kNumberSections/2];
    //不被发觉的滚动到位置
    [self.colView scrollToItemAtIndexPath:reCurrentIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];

    // 获取下一显示页
    NSInteger nextItem = reCurrentIndexPath.item + 1;
    NSInteger nextSection = reCurrentIndexPath.section;
    if (nextItem == self.numberItems) {
        nextItem = 0;
        nextSection ++;
    }

    NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:nextItem inSection:nextSection];

    [self.colView scrollToItemAtIndexPath:nextIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES];

    // 显示页码
//    self.pageContol.currentPage = nextItem;
}

#pragma mark -
#pragma mark ---------UICollectionViewDataSource

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
        return self.numberItems;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return kNumberSections;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

    BOOL useLocal = (self.delegate && [self.delegate respondsToSelector:@selector(adScrollView:imageforIndex:)]) || self.imageForIndex;
    BOOL useURL = (self.delegate && [self.delegate respondsToSelector:@selector(adScrollView:imageUrlForIndex:)]) || self.urlForIndex;

    BOOL isBoth = useLocal && useURL;

    BOOL isOne = useURL || useLocal ;

    NSAssert(isBoth == NO, @"AKAdScrollView  Warning ! Delegate should Not Implet Two DataSource Methods At the Same Time !!!");
    NSAssert(isOne == YES, @"AKAdScrollView  Warning ! At Least Implent One DataSource Mthod !!!");

    AKAdImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AKAdImageCell" forIndexPath:indexPath];

    NSInteger row = indexPath.row;

    if (useLocal) {
        UIImage *image = [self ak_ImageForIndex:row];
        cell.adImageView.image = image;
    }else{
        NSString *url = [self ak_UrlForIndex:row];
        UIImage *placeHolder = nil;
        NSString *placeHolderName = [self ak_placeHolderForIndex:row];
        if (placeHolderName != nil && placeHolderName.length > 0) {
            placeHolder = [UIImage imageNamed:placeHolderName];
        }else {
             NSLog(@"AKAdScrollView Warning ! No valid ScrollView");
        }

        //如果使用SDWebImage 直接替换这句代码
        [cell.adImageView loadWithURL:[NSURL URLWithString:url] placeholer:placeHolder showActivityIndicatorView:NO];
    }
    return cell;
}

#pragma mark -
#pragma mark ---------UICollectionViewDelegate

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{

    if (self.didClickItemAtIndex) {
        self.didClickItemAtIndex(self, indexPath.row);
        return;
    }

    if ([self.delegate respondsToSelector:@selector(adScrollView:didSelectIndex:)]) {
        [self.delegate adScrollView:self didSelectIndex:indexPath.row%self.numberItems];
        return;
    }

     NSLog(@"You Have not subscribe click Event");
}

#pragma mark -
#pragma mark ---------UIScrollViewDelgate

/*
关于[self stopTimer];  [self activiTimer];
 目前用手拖动的时候是用_isDragging 当是否执行定时器绑定方法的开关,当拖动之后有可能产生3~6s的延迟才会继续滚动,
 如果对时间敏感的,可以解注释这两个方法,并注释掉 _isDragging
*/

/**
 *  当用户 拖拽的时候开始调用
 */
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
//    [self stopTimer];
    _isDragging = YES;
}

/**
 *  当用户拖拽结束的时候开始调用
 */
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
//    [self activiTimer];
}

//timer调用滑动结束的时候出发这个方法
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
    [self resetScrollWhenScrollEnd];
}

//手动滑动结束的时候出发这个方法
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    [self resetScrollWhenScrollEnd];
}

- (void)resetScrollWhenScrollEnd
{

    if (_isDragging) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_duration* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (_isDragging) {
                _isDragging = NO;
            }
        });
    }

    NSIndexPath *currentIndexPath = [[self.colView indexPathsForVisibleItems] lastObject];

    if (currentIndexPath.section != kNumberSections /2 ) {
        //中间的section 该元素对应位置
        NSIndexPath *reCurrentIndexPath = [NSIndexPath indexPathForItem:currentIndexPath.item inSection:kNumberSections/2];
        //不被发觉的滚动到位置
        [self.colView scrollToItemAtIndexPath:reCurrentIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
    }

    CGFloat oneSectionWidth = self.numberItems * self.colView.frame.size.width;

    NSInteger curPage =  0;

    if ((int)self.colView.contentOffset.x % (int)oneSectionWidth == 0) {
        curPage = 0;
    }else {
       curPage =  (self.colView.contentOffset.x - oneSectionWidth) / self.colView.frame.size.width ;
    }

    self.pageControl.currentPage = curPage;
}

#pragma mark -
#pragma mark ---------PublicMethods

- (void)reloadData
{
    _numberItems = [self ak_numberOfItems];
    self.pageControl.bounds = CGRectMake(0, 0, _numberItems * 20 , 30);
    _pageControl.currentPage = 0;
    _pageControl.numberOfPages = _numberItems;

    [self.colView reloadData];
    [self.colView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:kNumberSections/2] atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];

}

#pragma mark -
#pragma mark ---------PrivateMethods

- (NSUInteger)ak_numberOfItems{

    if (self.numberOfImages) {
        return self.numberOfImages(self);
    }

    if (self.delegate && [self.delegate respondsToSelector:@selector(adScrollViewNumberOfItems:)]) {
            return    [self.delegate adScrollViewNumberOfItems:self];
    }

    NSAssert(false, @"Warning !! AKAdScrollView At Least Implement A Block or Delegate Method ");

    return 0;
}

- (NSString *)ak_placeHolderForIndex:(NSUInteger)index
{
    if (self.placeHolderImageForIndex) {
        return self.placeHolderImageForIndex(self, index);
    }

    if (self.delegate && [self.delegate respondsToSelector:@selector(adScrollViewPlaceHolderImageForIndex:)]) {
        return    [self.delegate adScrollViewPlaceHolderImageForIndex:index];
    }

    NSAssert(false, @"Warning !! AKAdScrollView At Least Implement A Block or Delegate Method  ");
    return nil;
}

- (NSTimeInterval)ak_scrollDuration
{
    if (self.scrollDuration) {
       return   self.scrollDuration(self);
    }

    if (self.delegate && [self.delegate respondsToSelector:@selector(adScrollViewScrollDuration)]) {
    return   [self.delegate adScrollViewScrollDuration];
    }

    return kDefaultScrollDuration;
}

- (UIImage *)ak_ImageForIndex:(NSUInteger)index
{
    if (self.imageForIndex) {
        return self.imageForIndex(self,index);
    }

    if (self.delegate && [self.delegate respondsToSelector:@selector(adScrollView:imageforIndex:)]) {
     return   [self.delegate adScrollView:self imageforIndex:index];
    }
    return nil;
}

- (NSString *)ak_UrlForIndex:(NSUInteger)index
{
    if (self.urlForIndex) {
        return self.urlForIndex(self, index);
    }

    if (self.delegate && [self.delegate respondsToSelector:@selector(adScrollView:imageUrlForIndex:)]) {
        return   [self.delegate adScrollView:self imageUrlForIndex:index];
    }

    return nil;
}

@end


text:
Created with https://github.com/auduno/clmtrackr project.

It's a chrome extension that follow your face expression. If you are smiling or suprising, while typing in a textarea on a webpage, it's put a smiley on it.

Logo come from https://dribbble.com/shots/1605447-Smile-Construct?list=searches&offset=5

Input configuration come from https://github.com/aterrien/jQuery-Knob/


text:
package eu.bcvsolutions.idm.acc.event.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Description;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import eu.bcvsolutions.idm.acc.AccModuleDescriptor;
import eu.bcvsolutions.idm.acc.event.ProvisioningEvent;
import eu.bcvsolutions.idm.acc.service.api.ProvisioningService;
import eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto;
import eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor;
import eu.bcvsolutions.idm.core.api.event.DefaultEventResult;
import eu.bcvsolutions.idm.core.api.event.EntityEvent;
import eu.bcvsolutions.idm.core.api.event.EventResult;
import eu.bcvsolutions.idm.core.model.event.TreeNodeEvent.TreeNodeEventType;
import eu.bcvsolutions.idm.core.security.api.domain.Enabled;

/**
 * Run provisioning after tree node was saved.
 *
 * @author Svanda
 * @author Radek Tomiška
 */
@Component(TreeNodeSaveProcessor.PROCESSOR_NAME)
@Enabled(AccModuleDescriptor.MODULE_ID)
@Description("Executes provisioning after tree node is saved.")
public class TreeNodeSaveProcessor extends AbstractEntityEventProcessor<IdmTreeNodeDto> {

	public static final String PROCESSOR_NAME = "acc-tree-node-save-processor";
	private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(TreeNodeSaveProcessor.class);
	private ProvisioningService provisioningService;
	private final ApplicationContext applicationContext;

	@Autowired
	public TreeNodeSaveProcessor(ApplicationContext applicationContext) {
		super(TreeNodeEventType.NOTIFY);
		//
		Assert.notNull(applicationContext, "Context is required.");
		//
		this.applicationContext = applicationContext;
	}

	@Override
	public String getName() {
		return PROCESSOR_NAME;
	}

	@Override
	public boolean conditional(EntityEvent<IdmTreeNodeDto> event) {
		// Skip provisioning
		return !this.getBooleanProperty(ProvisioningService.SKIP_PROVISIONING, event.getProperties());
	}

	@Override
	public EventResult<IdmTreeNodeDto> process(EntityEvent<IdmTreeNodeDto> event) {
		doProvisioning(event.getContent());
		//
		return new DefaultEventResult<>(event, this);
	}

	private void doProvisioning(IdmTreeNodeDto node) {
		LOG.debug("Call account managment (create accounts for all systems) for tree node [{}]", node.getCode());
		getProvisioningService().accountManagement(node);
		LOG.debug("Call provisioning for tree node [{}]", node.getCode());
		getProvisioningService().doProvisioning(node);
	}

	@Override
	public int getOrder() {
		return ProvisioningEvent.DEFAULT_PROVISIONING_ORDER;
	}

	/**
	 * provisioningService has dependency everywhere - so we need lazy init ...
	 *
	 * @return
	 */
	private ProvisioningService getProvisioningService() {
		if (provisioningService == null) {
			provisioningService = applicationContext.getBean(ProvisioningService.class);
		}
		return provisioningService;
	}

}


text:
import { pluralize } from '../common/strings';

const MINUTE = 60;
const HOUR = MINUTE * 60;
const DAY = HOUR * 24;
const WEEK = DAY * 7;
const MONTH = DAY * 30;
const YEAR = DAY * 365;

export const getTimeSinceToday = date => {
  const updateTimeSeconds = new Date(date).getTime();
  const currentTimeSeconds = new Date().getTime();

  let seconds = Math.abs(currentTimeSeconds - updateTimeSeconds) / 1000;
  seconds = seconds > 0 ? seconds : 1;

  let [value, unit] =
    seconds < MINUTE
      ? [Math.round(seconds), 'second']
      : seconds < HOUR
        ? [Math.round(seconds / MINUTE), 'minute']
        : seconds < DAY
          ? [Math.round(seconds / HOUR), 'hour']
          : seconds < WEEK
            ? [Math.round(seconds / DAY), 'day']
            : seconds < MONTH
              ? [Math.round(seconds / WEEK), 'week']
              : seconds < YEAR
                ? [Math.round(seconds / MONTH), 'month']
                : [Math.round(seconds / YEAR), 'year'];

  unit = pluralize(unit, value);

  return `${value} ${unit} ago`;
};


text:
package org.apache.hadoop.yarn.logaggregation.filecontroller.ifile;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.logaggregation.ContainerLogMeta;
import org.apache.hadoop.yarn.logaggregation.ContainerLogsRequest;
import org.apache.hadoop.yarn.logaggregation.LogAggregationUtils;
import org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogKey;
import org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogValue;
import org.apache.hadoop.yarn.logaggregation.ContainerLogFileInfo;
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController;
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext;
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerFactory;
import org.apache.hadoop.yarn.util.Clock;
import org.apache.hadoop.yarn.util.ControlledClock;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Function test for {@link LogAggregationIndexFileController}.
 *
 */
public class TestLogAggregationIndexFileController {

  private final String rootLocalLogDir = "target/LocalLogs";
  private final Path rootLocalLogDirPath = new Path(rootLocalLogDir);
  private final String remoteLogDir = "target/remote-app";
  private static final FsPermission LOG_FILE_UMASK = FsPermission
      .createImmutable((short) (0777));
  private static final UserGroupInformation USER_UGI = UserGroupInformation
      .createRemoteUser("testUser");
  private FileSystem fs;
  private Configuration conf;
  private ApplicationId appId;
  private ContainerId containerId;
  private NodeId nodeId;

  private ByteArrayOutputStream sysOutStream;
  private PrintStream sysOut;

  private ByteArrayOutputStream sysErrStream;
  private PrintStream sysErr;

  @Before
  public void setUp() throws IOException {
    appId = ApplicationId.newInstance(123456, 1);
    ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
        appId, 1);
    containerId = ContainerId.newContainerId(attemptId, 1);
    nodeId = NodeId.newInstance("localhost", 9999);
    conf = new Configuration();
    conf.set("yarn.log-aggregation.Indexed.remote-app-log-dir",
        remoteLogDir);
    conf.set("yarn.log-aggregation.Indexed.remote-app-log-dir-suffix",
        "logs");
    conf.set(YarnConfiguration.NM_LOG_AGG_COMPRESSION_TYPE, "gz");
    fs = FileSystem.get(conf);
    sysOutStream = new ByteArrayOutputStream();
    sysOut =  new PrintStream(sysOutStream);
    System.setOut(sysOut);

    sysErrStream = new ByteArrayOutputStream();
    sysErr = new PrintStream(sysErrStream);
    System.setErr(sysErr);
  }

  @After
  public void teardown() throws Exception {
    fs.delete(rootLocalLogDirPath, true);
    fs.delete(new Path(remoteLogDir), true);
  }

  @Test(timeout = 15000)
  public void testLogAggregationIndexFileFormat() throws Exception {
    if (fs.exists(rootLocalLogDirPath)) {
      fs.delete(rootLocalLogDirPath, true);
    }
    assertTrue(fs.mkdirs(rootLocalLogDirPath));

    Path appLogsDir = new Path(rootLocalLogDirPath, appId.toString());
    if (fs.exists(appLogsDir)) {
      fs.delete(appLogsDir, true);
    }
    assertTrue(fs.mkdirs(appLogsDir));

    List<String> logTypes = new ArrayList<String>();
    logTypes.add("syslog");
    logTypes.add("stdout");
    logTypes.add("stderr");

    Set<File> files = new HashSet<>();

    LogKey key1 = new LogKey(containerId.toString());

    for(String logType : logTypes) {
      File file = createAndWriteLocalLogFile(containerId, appLogsDir,
          logType);
      files.add(file);
    }
    LogValue value = mock(LogValue.class);
    when(value.getPendingLogFilesToUploadForThisContainer()).thenReturn(files);

    final ControlledClock clock = new ControlledClock();
    clock.setTime(System.currentTimeMillis());
    LogAggregationIndexedFileController fileFormat
        = new LogAggregationIndexedFileController() {
          private int rollOverCheck = 0;
          @Override
          public Clock getSystemClock() {
            return clock;
          }

          @Override
          public boolean isRollover(final FileContext fc,
              final Path candidate) throws IOException {
            rollOverCheck++;
            if (rollOverCheck >= 3) {
              return true;
            }
            return false;
          }
        };

    fileFormat.initialize(conf, "Indexed");

    Map<ApplicationAccessType, String> appAcls = new HashMap<>();
    Path appDir = fileFormat.getRemoteAppLogDir(appId,
        USER_UGI.getShortUserName());
    if (fs.exists(appDir)) {
      fs.delete(appDir, true);
    }
    assertTrue(fs.mkdirs(appDir));

    Path logPath = fileFormat.getRemoteNodeLogFileForApp(
        appId, USER_UGI.getShortUserName(), nodeId);
    LogAggregationFileControllerContext context =
        new LogAggregationFileControllerContext(
            logPath, logPath, true, 1000, appId, appAcls, nodeId, USER_UGI);
    // initialize the writer
    fileFormat.initializeWriter(context);

    fileFormat.write(key1, value);
    fileFormat.postWrite(context);
    fileFormat.closeWriter();

    ContainerLogsRequest logRequest = new ContainerLogsRequest();
    logRequest.setAppId(appId);
    logRequest.setNodeId(nodeId.toString());
    logRequest.setAppOwner(USER_UGI.getShortUserName());
    logRequest.setContainerId(containerId.toString());
    logRequest.setBytes(Long.MAX_VALUE);
    List<ContainerLogMeta> meta = fileFormat.readAggregatedLogsMeta(
        logRequest);
    Assert.assertTrue(meta.size() == 1);
    List<String> fileNames = new ArrayList<>();
    for (ContainerLogMeta log : meta) {
      Assert.assertTrue(log.getContainerId().equals(containerId.toString()));
      Assert.assertTrue(log.getNodeId().equals(nodeId.toString()));
      Assert.assertTrue(log.getContainerLogMeta().size() == 3);
      for (ContainerLogFileInfo file : log.getContainerLogMeta()) {
        fileNames.add(file.getFileName());
      }
    }
    fileNames.removeAll(logTypes);
    Assert.assertTrue(fileNames.isEmpty());

    boolean foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : logTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    sysOutStream.reset();

    Configuration factoryConf = new Configuration(conf);
    factoryConf.set("yarn.log-aggregation.file-formats", "Indexed");
    factoryConf.set("yarn.log-aggregation.file-controller.Indexed.class",
        "org.apache.hadoop.yarn.logaggregation.filecontroller.ifile"
        + ".LogAggregationIndexedFileController");
    LogAggregationFileControllerFactory factory =
        new LogAggregationFileControllerFactory(factoryConf);
    LogAggregationFileController fileController = factory
        .getFileControllerForRead(appId, USER_UGI.getShortUserName());
    Assert.assertTrue(fileController instanceof
        LogAggregationIndexedFileController);
    foundLogs = fileController.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : logTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    sysOutStream.reset();

    // create a checksum file
    Path checksumFile = new Path(fileFormat.getRemoteAppLogDir(
        appId, USER_UGI.getShortUserName()),
        LogAggregationUtils.getNodeString(nodeId)
        + LogAggregationIndexedFileController.CHECK_SUM_FILE_SUFFIX);
    FSDataOutputStream fInput = null;
    try {
      String nodeName = logPath.getName() + "_" + clock.getTime();
      fInput = FileSystem.create(fs, checksumFile, LOG_FILE_UMASK);
      fInput.writeInt(nodeName.length());
      fInput.write(nodeName.getBytes(
          Charset.forName("UTF-8")));
      fInput.writeLong(0);
    } finally {
      IOUtils.closeQuietly(fInput);
    }
    meta = fileFormat.readAggregatedLogsMeta(
        logRequest);
    Assert.assertTrue(meta.size() == 0);
    foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertFalse(foundLogs);
    sysOutStream.reset();
    fs.delete(checksumFile, false);
    Assert.assertFalse(fs.exists(checksumFile));

    List<String> newLogTypes = new ArrayList<>(logTypes);
    files.clear();
    newLogTypes.add("test1");
    files.add(createAndWriteLocalLogFile(containerId, appLogsDir,
        "test1"));
    newLogTypes.add("test2");
    files.add(createAndWriteLocalLogFile(containerId, appLogsDir,
        "test2"));
    LogValue value2 = mock(LogValue.class);
    when(value2.getPendingLogFilesToUploadForThisContainer())
        .thenReturn(files);

    // initialize the writer
    fileFormat.initializeWriter(context);
    fileFormat.write(key1, value2);
    fileFormat.closeWriter();

    // We did not call postWriter which we would keep the checksum file.
    // We can only get the logs/logmeta from the first write.
    meta = fileFormat.readAggregatedLogsMeta(
        logRequest);
    Assert.assertEquals(meta.size(), 1);
    for (ContainerLogMeta log : meta) {
      Assert.assertTrue(log.getContainerId().equals(containerId.toString()));
      Assert.assertTrue(log.getNodeId().equals(nodeId.toString()));
      Assert.assertTrue(log.getContainerLogMeta().size() == 3);
      for (ContainerLogFileInfo file : log.getContainerLogMeta()) {
        fileNames.add(file.getFileName());
      }
    }
    fileNames.removeAll(logTypes);
    Assert.assertTrue(fileNames.isEmpty());
    foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : logTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    Assert.assertFalse(sysOutStream.toString().contains(logMessage(
        containerId, "test1")));
    Assert.assertFalse(sysOutStream.toString().contains(logMessage(
        containerId, "test2")));
    sysOutStream.reset();

    // Call postWrite and we should get all logs/logmetas for both
    // first write and second write
    fileFormat.initializeWriter(context);
    fileFormat.write(key1, value2);
    fileFormat.postWrite(context);
    fileFormat.closeWriter();
    meta = fileFormat.readAggregatedLogsMeta(
            logRequest);
    Assert.assertEquals(meta.size(), 2);
    for (ContainerLogMeta log : meta) {
      Assert.assertTrue(log.getContainerId().equals(containerId.toString()));
      Assert.assertTrue(log.getNodeId().equals(nodeId.toString()));
      for (ContainerLogFileInfo file : log.getContainerLogMeta()) {
        fileNames.add(file.getFileName());
      }
    }
    fileNames.removeAll(newLogTypes);
    Assert.assertTrue(fileNames.isEmpty());
    foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : newLogTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    sysOutStream.reset();

    // start to roll over old logs
    clock.setTime(System.currentTimeMillis());
    fileFormat.initializeWriter(context);
    fileFormat.write(key1, value2);
    fileFormat.postWrite(context);
    fileFormat.closeWriter();
    FileStatus[] status = fs.listStatus(logPath.getParent());
    Assert.assertTrue(status.length == 2);
    meta = fileFormat.readAggregatedLogsMeta(
        logRequest);
    Assert.assertEquals(meta.size(), 3);
    for (ContainerLogMeta log : meta) {
      Assert.assertTrue(log.getContainerId().equals(containerId.toString()));
      Assert.assertTrue(log.getNodeId().equals(nodeId.toString()));
      for (ContainerLogFileInfo file : log.getContainerLogMeta()) {
        fileNames.add(file.getFileName());
      }
    }
    fileNames.removeAll(newLogTypes);
    Assert.assertTrue(fileNames.isEmpty());
    foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : newLogTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    sysOutStream.reset();
  }

  @Test(timeout = 15000)
  public void testFetchApplictionLogsHar() throws Exception {
    List<String> newLogTypes = new ArrayList<>();
    newLogTypes.add("syslog");
    newLogTypes.add("stdout");
    newLogTypes.add("stderr");
    newLogTypes.add("test1");
    newLogTypes.add("test2");
    URL harUrl = ClassLoader.getSystemClassLoader()
        .getResource("application_123456_0001.har");
    assertNotNull(harUrl);

    Path path = new Path(remoteLogDir + "/" + USER_UGI.getShortUserName()
        + "/logs/application_123456_0001");
    if (fs.exists(path)) {
      fs.delete(path, true);
    }
    assertTrue(fs.mkdirs(path));
    Path harPath = new Path(path, "application_123456_0001.har");
    fs.copyFromLocalFile(false, new Path(harUrl.toURI()), harPath);
    assertTrue(fs.exists(harPath));
    LogAggregationIndexedFileController fileFormat
        = new LogAggregationIndexedFileController();
    fileFormat.initialize(conf, "Indexed");
    ContainerLogsRequest logRequest = new ContainerLogsRequest();
    logRequest.setAppId(appId);
    logRequest.setNodeId(nodeId.toString());
    logRequest.setAppOwner(USER_UGI.getShortUserName());
    logRequest.setContainerId(containerId.toString());
    logRequest.setBytes(Long.MAX_VALUE);
    List<ContainerLogMeta> meta = fileFormat.readAggregatedLogsMeta(
        logRequest);
    Assert.assertEquals(meta.size(), 3);
    List<String> fileNames = new ArrayList<>();
    for (ContainerLogMeta log : meta) {
      Assert.assertTrue(log.getContainerId().equals(containerId.toString()));
      Assert.assertTrue(log.getNodeId().equals(nodeId.toString()));
      for (ContainerLogFileInfo file : log.getContainerLogMeta()) {
        fileNames.add(file.getFileName());
      }
    }
    fileNames.removeAll(newLogTypes);
    Assert.assertTrue(fileNames.isEmpty());
    boolean foundLogs = fileFormat.readAggregatedLogs(logRequest, System.out);
    Assert.assertTrue(foundLogs);
    for (String logType : newLogTypes) {
      Assert.assertTrue(sysOutStream.toString().contains(logMessage(
          containerId, logType)));
    }
    sysOutStream.reset();
  }

  private File createAndWriteLocalLogFile(ContainerId containerId,
      Path localLogDir, String logType) throws IOException {
    File file = new File(localLogDir.toString(), logType);
    if (file.exists()) {
      file.delete();
    }
    file.createNewFile();
    Writer writer = null;
    try {
      writer = new FileWriter(file);
      writer.write(logMessage(containerId, logType));
      writer.close();
      return file;
    } finally {
      IOUtils.closeQuietly(writer);
    }
  }

  private String logMessage(ContainerId containerId, String logType) {
    StringBuilder sb = new StringBuilder();
    sb.append("Hello " + containerId + " in " + logType + "!");
    return sb.toString();
  }
}


text:
Reset Password - {{::resetPasswordDialogCtl.user.name}}

  <form
     novalidate
     class="forms"
     name="resetPasswordDialogCtl.form"
     ng-submit="resetPasswordDialogCtl.submit()">

          'Password' and 'Confirm Password' do not match

          {{resetPasswordDialogCtl.errors}}

{{value}}

        Current Password
        <input
           type="password"
           id="password_new"
           ng-model="resetPasswordDialogCtl.user.currentPassword"
           autocorrect="off"
           spellcheck="false"
           mn-autocomplete-off
           autocapitalize="off">

        New Password
        <input
           type="password"
           id="password_new"
           name="passwordNew"
           ng-model="resetPasswordDialogCtl.user.password"
           autocorrect="off"
           spellcheck="false"
           mn-equal="{{resetPasswordDialogCtl.user.confirmPassword}}"
           mn-autocomplete-off
           autocapitalize="off">

        Confirm Password
        <input
           type="password"
           id="password_confirm"
           ng-model="resetPasswordDialogCtl.user.confirmPassword"
           autocorrect="off"
           spellcheck="false"
           mn-autocomplete-off
           autocapitalize="off">

      Cancel
      <button type="submit">Save</button>

  </form>


text:
package org.jboss.resteasy.reactive.common.providers.serialisers.jsonp;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

import javax.json.JsonValue;
import javax.json.JsonWriter;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;

public class JsonValueHandler implements MessageBodyReader<JsonValue>, MessageBodyWriter<JsonValue> {
    public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return JsonValue.class.isAssignableFrom(type);
    }

    public void writeTo(JsonValue jsonValue, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
            MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
        try (JsonWriter writer = JsonpUtil.writer(entityStream, mediaType)) {
            writer.write(jsonValue);
        }
    }

    @Override
    public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return JsonValue.class.isAssignableFrom(type);
    }

    @Override
    public JsonValue readFrom(Class<JsonValue> type, Type genericType, Annotation[] annotations, MediaType mediaType,
            MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
        return JsonpUtil.reader(entityStream, mediaType).readValue();
    }
}


text:
namespace {
#if defined(__GNUC__) || defined(__clang__)
uint64_t double_up(const uint64_t x) __attribute__((const));
#endif
uint64_t double_up(const uint64_t x) { return x * 2; }
}

int main(int, char* []) {
  // this test verifies compilation of DoNotOptimize() for some types

  char buffer8[8];
  benchmark::DoNotOptimize(buffer8);

  char buffer20[20];
  benchmark::DoNotOptimize(buffer20);

  char buffer1024[1024];
  benchmark::DoNotOptimize(buffer1024);
  benchmark::DoNotOptimize(&buffer1024[0]);

  int x = 123;
  benchmark::DoNotOptimize(x);
  benchmark::DoNotOptimize(&x);
  benchmark::DoNotOptimize(x += 42);

  benchmark::DoNotOptimize(double_up(x));

  return 0;
}