text:
package com.toboehm.dhdevtest.views.listener;

import android.util.Log;
import android.widget.AbsListView;

/**
 * Created by Tobias Boehm on 22.09.2015.
 */
public abstract class AutoLoadScrollListener implements AbsListView.OnScrollListener {

    private static final int VISIBLE_THRESHOLD = 48;

    private int previousTotal = 0;
    private boolean loading = true;

    @Override
    public void onScroll(final AbsListView view, final int firstVisibleItem,
                         final int visibleItemCount, final int totalItemCount) {
        if (loading) {
            if (totalItemCount > previousTotal) {
                loading = false;
                previousTotal = totalItemCount;
                Log.d("onScroll", "TotalCount " + totalItemCount + " > PreviousTotal " + previousTotal + " -> loading = false");
            }
        }
        if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + VISIBLE_THRESHOLD)) {

            Log.d("onScroll", "(!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + VISIBLE_THRESHOLD))" +
                    " -> asyncLoadNextPage() and loading = true" );
            asyncLoadNextPage();
            loading = true;
        }
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {
    }

    protected abstract void asyncLoadNextPage();
}


text:
function ensureType(template: any, obj: any): any {
  if (Array.isArray(template)){
    if (Array.isArray(obj)) {
      if (template.length == 0) {
        return obj
      } else {
        return obj.map(e => ensureType(template[0], e)).filter(e => e !== undefined)
      }
    } else {
      return undefined
    }
  }
  if ('number' == typeof template) {
    return ('number' == typeof obj) ? obj : undefined
  }
  if ('string' == typeof template) {
    return ('string' == typeof obj) ? obj : undefined
  }
  if ('boolean' == typeof template) {
    return ('boolean' == typeof obj) ? obj : undefined
  }
  if ('object' == typeof template) {
    if ('object' == typeof obj) {
      for (var key in template) {
        if (ensureType(template[key], obj[key]) === undefined)
          return undefined
      }
      return obj
    }
  }
  return undefined
}

function assert(actual: any) {
  return { equal(expected: any) { equal(actual, expected) } }
}

function equal(a: any, b: any) {
  if (a === b) return
  var as = JSON.stringify(a)
  var bs = JSON.stringify(b)
  if (as !== bs)
    throw new Error(as + ' != ' + bs)
}

function test_ensureType() {
  assert(ensureType([], [])).equal([])
  assert(ensureType([], [0])).equal([0])
  assert(ensureType([0], [])).equal([])
  assert(ensureType([0], [0])).equal([0])
  assert(ensureType({a:''}, {a:''})).equal({a:''})
  assert(ensureType({a:''}, {a:0})).equal(undefined)
  assert(ensureType([{a:''}], [{a:0}])).equal([])
}

redpajama_set_name: RedPajamaGithub


text:
:tocdepth: 2

.. index:: introduction

Introduction
############

What is Slick?
--------------

Slick is `Typesafe <http://www.typesafe.com>`_'s Functional Relational Mapping (FRM) library for
Scala that makes it easy to work with relational databases. It allows you to work with stored
data almost as if you were using Scala collections while at the same time giving you full control
over when a database access happens and which data is transferred. You can also use SQL directly.
Execution of database actions is done asynchronously, making Slick a perfect fit for your reactive
applications based on Play_ and Akka_.

.. includecode:: code/GettingStartedOverview.scala#what-is-slick-micro-example

When using Scala instead of raw SQL for your queries you benefit from compile-time safety
and compositionality. Slick can generate queries for different back-end databases including
your own, using its extensible query compiler.

Get started learning Slick in minutes using the `Hello Slick template`_ in Typesafe Activator_.

Features
--------

Scala
_____
* Queries, Table & Column Mappings, and types are plain Scala

.. includecode:: code/GettingStartedOverview.scala#quick-schema

* Data access APIs similar to Scala collections

.. includecode:: code/GettingStartedOverview.scala#features-scala-collections

Type-Safe
_________
* Let your IDE help you write your code
* Find problems at compile-time instead of at runtime

.. includecode:: code/GettingStartedOverview.scala#features-type-safe

Composable
__________
* Queries are functions that can be composed and reused

.. includecode:: code/GettingStartedOverview.scala#features-composable

.. _supported-dbs:

.. index::
   pair: database; supported
.. index:: Derby, JavaDB, H2, HSQLDB, HyperSQL, Access, MySQL, PostgreSQL, SQLite

Supported database systems
--------------------------

* DB2 (via :doc:`slick-extensions <extensions>`)
* Derby/JavaDB
* H2
* HSQLDB/HyperSQL
* Microsoft Access
* Microsoft SQL Server (via :doc:`slick-extensions <extensions>`)
* MySQL
* Oracle (via :doc:`slick-extensions <extensions>`)
* PostgreSQL
* SQLite

Other SQL databases can be accessed right away with a reduced feature set.
Writing a fully featured plugin for your own SQL-based backend can be achieved
with a reasonable amount of work. Support for other backends (like NoSQL) is
under development but not yet available.

The following capabilities are supported by the drivers. "Yes" means that a
capability is fully supported. In other cases it may be partially supported or
not at all. See the individual driver's API documentation for details.

.. csv-table:: Driver Capabilities
   :header-rows: 1
   :file: capabilities.csv

.. index:: license

License
-------

Slick is released under a BSD-Style free and open source software :slick:`license <LICENSE.txt>`.
See the chapter on the commercial :doc:`Slick Extensions <extensions>` add-on
package for details on licensing the Slick drivers for the big commercial
database systems.

.. index::
   pair: source; compatibility
   pair: binary; compatibility

Compatibility Policy
--------------------

Slick requires Scala 2.10 or 2.11. (For Scala 2.9 please use ScalaQuery_, the predecessor of Slick).

Slick version numbers consist of an epoch, a major and minor version, and possibly a qualifier
(for milestone, RC and SNAPSHOT versions).

For release versions (i.e. versions without a qualifier), backward binary compatibility is
guaranteed between releases with the same epoch and major version (e.g. you could use 2.1.2 as a
drop-in relacement for 2.1.0 but not for 2.0.0). :doc:`Slick Extensions <extensions>` requires at
least the same minor version of Slick (e.g. Slick Extensions 2.1.2 can be used with Slick 2.1.2 but
not with Slick 2.1.1). Binary compatibility is not preserved for `slick-codegen`, which is generally
used at compile-time.

We do not guarantee source compatibility but we try to preserve it within the same major release.
Upgrading to a new major release may require some changes to your sources. We generally deprecate
old features and keep them around for a full major release cycle (i.e. features which become
deprecated in 2.1.0 will not be removed before 2.2.0) but this is not possible for all kinds of
changes.

Release candidates have the same compatibility guarantees as the final versions to which they
lead. There are *no compatibility guarantees* whatsoever for milestones and snapshots.

.. index:: APIs

Query APIs
----------

The *Lifted Embedding* is the standard API for type-safe queries and updates
in Slick. Please see :doc:`gettingstarted` for an introduction. Most of this
user manual focuses on the *Lifted Embedding*.

For writing your own SQL statements you can use the :doc:`Plain SQL<sql>` API.

The experimental :doc:`Direct Embedding <direct-embedding>` is available as an
alternative to the *Lifted Embedding*.

.. _lifted-embedding:
.. index:: lifted

Lifted Embedding
----------------

The name *Lifted Embedding* refers to the fact that you are not working with
standard Scala types (as in the :doc:`direct embedding <direct-embedding>`)
but with types that are *lifted* into a :api:`scala.slick.lifted.Rep` type
constructor. This becomes clear when you compare the types of a simple
Scala collections example

.. includecode:: code/LiftedEmbedding.scala#plaintypes

... with the types of similar code using the lifted embedding:

.. includecode:: code/LiftedEmbedding.scala#reptypes

All plain types are lifted into ``Rep``. The same is true for the table row
type ``Coffees`` which is a subtype of ``Rep[(String, Double)]``.
Even the literal ``8.0`` is automatically lifted to a ``Rep[Double]`` by an
implicit conversion because that is what the ``>`` operator on
``Rep[Double]`` expects for the right-hand side. This lifting is necessary
because the lifted types allow us to generate a syntax tree that captures
the query computations. Getting plain Scala functions and values would not
give us enough information for translating those computations to SQL.


text:
package org.pentaho.di.www.jaxrs;

import java.util.UUID;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.pentaho.di.core.Const;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.logging.KettleLogStore;
import org.pentaho.di.core.logging.LoggingObjectType;
import org.pentaho.di.core.logging.SimpleLoggingObject;
import org.pentaho.di.job.Job;
import org.pentaho.di.job.JobAdapter;
import org.pentaho.di.job.JobConfiguration;
import org.pentaho.di.job.JobExecutionConfiguration;
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.www.CarteObjectEntry;
import org.pentaho.di.www.CarteSingleton;

@Path( "/carte/job" )
public class JobResource {

  public JobResource() {
  }

  @GET
  @Path( "/log/{id : .+}" )
  @Produces( { MediaType.TEXT_PLAIN } )
  public String getJobLog( @PathParam( "id" ) String id ) {
    return getJobLog( id, 0 );
  }

  @GET
  @Path( "/log/{id : .+}/{logStart : .+}" )
  @Produces( { MediaType.TEXT_PLAIN } )
  public String getJobLog( @PathParam( "id" ) String id, @PathParam( "logStart" ) int startLineNr ) {
    int lastLineNr = KettleLogStore.getLastBufferLineNr();
    Job job = CarteResource.getJob( id );
    String logText =
      KettleLogStore.getAppender().getBuffer(
        job.getLogChannel().getLogChannelId(), false, startLineNr, lastLineNr ).toString();
    return logText;
  }

  @GET
  @Path( "/status/{id : .+}" )
  @Produces( { MediaType.APPLICATION_JSON } )
  public JobStatus getJobStatus( @PathParam( "id" ) String id ) {
    JobStatus status = new JobStatus();
    // find job
    Job job = CarteResource.getJob( id );
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id );

    status.setId( entry.getId() );
    status.setName( entry.getName() );
    status.setStatus( job.getStatus() );

    return status;
  }

  // change from GET to UPDATE/POST for proper REST method
  @GET
  @Path( "/start/{id : .+}" )
  @Produces( { MediaType.APPLICATION_JSON } )
  public JobStatus startJob( @PathParam( "id" ) String id ) {
    Job job = CarteResource.getJob( id );
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id );
    try {
      if ( job.isInitialized() && !job.isActive() ) {
        // Re-create the job from the jobMeta
        //
        // We might need to re-connect to the repository
        //
        if ( job.getRep() != null && !job.getRep().isConnected() ) {
          if ( job.getRep().getUserInfo() != null ) {
            job.getRep().connect( job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword() );
          } else {
            job.getRep().connect( null, null );
          }
        }

        // Create a new job object to start from a sane state. Then replace
        // the new job in the job map
        //
        synchronized ( CarteSingleton.getInstance().getJobMap() ) {
          JobConfiguration jobConfiguration = CarteSingleton.getInstance().getJobMap().getConfiguration( entry );

          String carteObjectId = UUID.randomUUID().toString();
          SimpleLoggingObject servletLoggingObject =
            new SimpleLoggingObject( getClass().getName(), LoggingObjectType.CARTE, null );
          servletLoggingObject.setContainerObjectId( carteObjectId );

          Job newJob = new Job( job.getRep(), job.getJobMeta(), servletLoggingObject );
          newJob.setLogLevel( job.getLogLevel() );

          // Discard old log lines from the old job
          //
          KettleLogStore.discardLines( job.getLogChannelId(), true );

          CarteSingleton.getInstance().getJobMap().replaceJob( entry, newJob, jobConfiguration );
          job = newJob;
        }
      }
      job.start();
    } catch ( KettleException e ) {
      e.printStackTrace();
    }
    return getJobStatus( id );
  }

  @GET
  @Path( "/stop/{id : .+}" )
  @Produces( { MediaType.APPLICATION_JSON } )
  public JobStatus stopJob( @PathParam( "id" ) String id ) {
    Job job = CarteResource.getJob( id );
    job.stopAll();
    return getJobStatus( id );
  }

  @GET
  @Path( "/remove/{id : .+}" )
  public Response removeJob( @PathParam( "id" ) String id ) {
    Job job = CarteResource.getJob( id );
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id );
    KettleLogStore.discardLines( job.getLogChannelId(), true );
    CarteSingleton.getInstance().getJobMap().removeJob( entry );
    return Response.ok().build();
  }

  @PUT
  @Path( "/add" )
  @Produces( { MediaType.APPLICATION_JSON } )
  public JobStatus addJob( String xml ) {

    // Parse the XML, create a job configuration
    //
    // System.out.println(xml);
    //
    JobConfiguration jobConfiguration;
    try {
      jobConfiguration = JobConfiguration.fromXML( xml.toString() );
      JobMeta jobMeta = jobConfiguration.getJobMeta();
      JobExecutionConfiguration jobExecutionConfiguration = jobConfiguration.getJobExecutionConfiguration();
      jobMeta.setLogLevel( jobExecutionConfiguration.getLogLevel() );
      jobMeta.injectVariables( jobExecutionConfiguration.getVariables() );

      // If there was a repository, we know about it at this point in time.
      //
      final Repository repository = jobConfiguration.getJobExecutionConfiguration().getRepository();

      String carteObjectId = UUID.randomUUID().toString();
      SimpleLoggingObject servletLoggingObject =
        new SimpleLoggingObject( getClass().getName(), LoggingObjectType.CARTE, null );
      servletLoggingObject.setContainerObjectId( carteObjectId );
      servletLoggingObject.setLogLevel( jobExecutionConfiguration.getLogLevel() );

      // Create the transformation and store in the list...
      //
      final Job job = new Job( repository, jobMeta, servletLoggingObject );

      // Setting variables
      //
      job.initializeVariablesFrom( null );
      job.getJobMeta().setInternalKettleVariables( job );
      job.injectVariables( jobConfiguration.getJobExecutionConfiguration().getVariables() );
      job.setArguments( jobExecutionConfiguration.getArgumentStrings() );

      // Also copy the parameters over...
      //
      job.copyParametersFrom( jobMeta );
      job.clearParameters();
      String[] parameterNames = job.listParameters();
      for ( int idx = 0; idx < parameterNames.length; idx++ ) {
        // Grab the parameter value set in the job entry
        //
        String thisValue = jobExecutionConfiguration.getParams().get( parameterNames[idx] );
        if ( !Const.isEmpty( thisValue ) ) {
          // Set the value as specified by the user in the job entry
          //
          jobMeta.setParameterValue( parameterNames[idx], thisValue );
        }
      }
      jobMeta.activateParameters();

      job.setSocketRepository( CarteSingleton.getInstance().getSocketRepository() );

      CarteSingleton.getInstance().getJobMap().addJob( job.getJobname(), carteObjectId, job, jobConfiguration );

      // Make sure to disconnect from the repository when the job finishes.
      //
      if ( repository != null ) {
        job.addJobListener( new JobAdapter() {
          public void jobFinished( Job job ) {
            repository.disconnect();
          }
        } );
      }
      return getJobStatus( carteObjectId );
    } catch ( KettleException e ) {
      e.printStackTrace();
    }
    return null;
  }
}


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

	<artifactId>tomcat-last-access-time-command</artifactId>
	<packaging>jar</packaging>

	<name>tomcat-last-access-time-command</name>
	<description>Simple Utility Class that connects to a JVM via a pid, and dumps the last accessed resource</description>

	<parent>
		<groupId>org.greencheek</groupId>
		<artifactId>tomcat-last-access-time</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>

	<properties>
	</properties>
	<dependencies>
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>tomcat-last-access-time-domain</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sun</groupId>
			<artifactId>tools</artifactId>
			<version>1.6</version>
			<scope>system</scope>
			<systemPath>${toolsjar}</systemPath>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>0.9.26</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>log4j-over-slf4j</artifactId>
			<version>1.6.1</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>1.6.1</version>
		</dependency>

		<!-- This is provided by the XXX library, as a transient dependency -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.1</version>
		</dependency>
	</dependencies>
	<profiles>
		<profile>
			<id>default-tools-profile</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<file>
					<exists>${java.home}/../lib/tools.jar</exists>
				</file>
			</activation>
			<properties>
				<toolsjar>${java.home}/../lib/tools.jar</toolsjar>
				<jdijar>${java.home}/../lib/sa-jdi.jar</jdijar>
			</properties>
		</profile>
		<profile>
			<id>mac-tools-profile</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<file>
					<exists>${java.home}/../Classes/classes.jar</exists>
				</file>
			</activation>
			<properties>
				<toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
				<jdijar>${java.home}/lib/sa-jdi.jar</jdijar>
			</properties>
		</profile>
	</profiles>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>1.6</version>
				<executions>
					<execution>
						<id>shade</id>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<shadedArtifactAttached>true</shadedArtifactAttached>
							<shadedClassifierName>shade</shadedClassifierName>
							<transformers>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<manifestEntries>
										<Main-Class>org.greencheek.tomcat.lastaccesstime.command.application.TomcatLastAccessResourceOutputter</Main-Class>
									</manifestEntries>
								</transformer>
							</transformers>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Chapter 1. Introduction</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with Berkeley DB, Java Edition Transaction Processing" />
    <link rel="up" href="index.html" title="Getting Started with Berkeley DB, Java Edition Transaction Processing" />
    <link rel="prev" href="preface.html" title="Preface" />
    <link rel="next" href="sysfailure.html" title="A Note on System Failure" />

          Chapter 1. Introduction

          Prev

           Next

Chapter 1. Introduction

          Table of Contents

              Transaction Benefits

              A Note on System Failure

              Application Requirements

              Multi-threaded

        Applications

              Recoverability

              Performance Tuning

    This book provides a thorough introduction and discussion on transactions as
    used with Berkeley DB, Java Edition (JE).

        Both the base API as well as the Direct Persistence Layer API is used in this
        manual.

    It begins by offering a general overview to
    transactions, the guarantees they provide, and the general application
    infrastructure required to obtain full transactional protection for your
    data.

    This book also provides detailed examples on how to write a
    transactional application. Both single threaded and multi-threaded  are discussed. A detailed description of various
    backup and recovery strategies is included in this manual, as is a
    discussion on performance considerations for your transactional application.

    You should understand the concepts from the

            Getting Started with Berkeley DB, Java Edition

     guide before reading this book.

Transaction Benefits

        Transactions offer your application's data protection from
        application or system failures.  That is, JE transactions offer
        your application full ACID support:

                Atomicity

                Multiple database operations are treated as a single unit of
                work.  Once committed, all write operations performed under
                the protection of the transaction are saved to your databases.
                Further, in the event that you abort a transaction, all write
                operations performed during the transaction are discarded.
                In this event, your database is left in the state it was in
                before the transaction began, regardless of the number or
                type of write operations you may have performed during the
                course of the transaction.

                Note that JE transactions can span one or more
                database handles.

                Consistency

                Your databases will never see a partially completed
                transaction. This is true even if your application fails while there are
                in-progress transactions. If the application or system fails,
                then either all of the database changes appear when the
                application next runs, or none of them appear.

                In other words, whatever consistency requirements your application has will never be violated by JE.
                If, for example, your application requires every record to include an employee ID, and your
                code faithfully adds that ID to its database records, then JE will never
                violate that consistency requirement. The ID will remain in the database records until such a time as your
                application chooses to delete it.

                Isolation

                While a transaction is in progress, your databases will appear
                to the transaction as if there are no other operations
                occurring outside of the transaction. That is, operations
                wrapped inside a transaction will always have a clean and
                consistent view of your databases. They never have to see
                updates currently in progress under the protection of another transaction.
                Note, however, that isolation guarantees can be

                 increased and

                 relaxed from the default setting.   See
                Isolation
                for more information.

                Durability

                Once committed to your databases, your modifications will
                persist even in the event of an application or system failure.
                Note that like isolation, your durability guarantee can be
                relaxed. See Non-Durable Transactions
                for more information.

          Prev

           Next

          Preface

            Home

           A Note on System Failure


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>/Applications/MAMP/htdocs/chat_nodejs/www/modules/clients/socketclient.js - Documentation de l'outil de démonstration JavaScript du Gaia-Project</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            API Docs for: 1.0

APIs

Classes

Modules

                            <input type="search" id="api-filter" placeholder="Type to filter APIs">

app

app.client.socketclient

app.controllers.chatservice

app.controllers.login

app.modules.servers.SocketServer

app.objects.email

app.objects.user

app.security.diffie-helman

app.servers.HTTPServer

app.services.chat

app.services.login

app.storage.mongodb

app.storage.mysql

app.storage.query

app.utils.checkers

app.utils.date

config

ConfigModel

KeyboardServices

LanguageModel

LeapMotionController

resize

                    Show:

                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited

                        <input type="checkbox" id="api-show-protected">
                        Protected

                        <input type="checkbox" id="api-show-private">
                        Private

                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated

File: /Applications/MAMP/htdocs/chat_nodejs/www/modules/clients/socketclient.js

                        /**
                         * Module responsible of the data exchange between C++ and JavaScript
                         * @class app.client.socketclient
                         * @required socket.io.client
                         */
                        var io = require('socket.io-client');
                        //192.168.2.2:

                        /**
                         * Launch the connection on a private network to the C++ network module
                         * @method start
                         * @param {String} url Default : 'http://192.168.2.2'
                         */
                        exports.start = function(url) {
                            if (typeof url === 'undefined')
                                url = 'http://192.168.2.2';
                            this.socket = io.connect(url);
                        }

                        /**
                         * Encrypt the data to send to the C++ network module
                         * @method encrypt
                         * @param {string} text
                         * @return {string} encrypted
                         */
                        function encrypt(text) {
                            var encrypted_text = "";
                            return encrypted_text;
                        }

                        /**
                         * Decrypt the data received from the C++ network module
                         * @method decrypt
                         * @param {string} text
                         * @return {string} decrypt
                         */
                        function decrypt(text) {
                            return text;
                        }

                        /**
                         * Send data to the server, executes the callback "handler" if it succeed in else throws an error
                         * @method send
                         * @param {String} event
                         * @param {Object} data
                         * @param {Function} handler
                         * @return void
                         */
                        function send(event, data, handler) {
                        }

                        /**
                         * Received data from the server, executes the callback "handler" if it succeed in else throws an error
                         * @method received
                         * @param {string} eventName
                         * @param {Function} handler
                         * @return void
                         */
                        function received(eventName, handler) {
                        }


text:
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
//
// Arjuna Technologies Ltd.,
// Newcastle upon Tyne,
// Tyne and Wear,
// UK
//

package org.jboss.jbossts.qa.CrashRecovery05Servers;

/*
 * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
 *
 * HP Arjuna Labs,
 * Newcastle upon Tyne,
 * Tyne and Wear,
 * UK.
 *
 * $Id: Server02.java,v 1.4 2003/07/15 15:33:11 jcoleman Exp $
 */

/*
 * Try to get around the differences between Ansi CPP and
 * K&R cpp with concatenation.
 */

/*
 * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
 *
 * HP Arjuna Labs,
 * Newcastle upon Tyne,
 * Tyne and Wear,
 * UK.
 *
 * $Id: Server02.java,v 1.4 2003/07/15 15:33:11 jcoleman Exp $
 */

import org.jboss.jbossts.qa.CrashRecovery05.*;
import org.jboss.jbossts.qa.CrashRecovery05Impls.AfterCrashServiceImpl01;
import org.jboss.jbossts.qa.Utils.OAInterface;
import org.jboss.jbossts.qa.Utils.ORBInterface;
import org.jboss.jbossts.qa.Utils.ServerIORStore;

public class Server02
{
	public static void main(String args[])
	{
		try
		{
			if (ORBInterface.getORB() == null) {
				ORBInterface.initORB(args, null);
				OAInterface.initOA();
			}

			AfterCrashServiceImpl01 afterCrashServiceImpl = new AfterCrashServiceImpl01(args[args.length - 2].hashCode(), 0);
			AfterCrashServicePOATie servant = new AfterCrashServicePOATie(afterCrashServiceImpl);

			OAInterface.objectIsReady(servant);
			AfterCrashService afterCrashService = AfterCrashServiceHelper.narrow(OAInterface.corbaReference(servant));

			ServerIORStore.storeIOR(args[args.length - 1], ORBInterface.orb().object_to_string(afterCrashService));

			System.out.println("Ready");

			ORBInterface.run();
		}
		catch (Exception exception)
		{
			System.err.println("Server02.main: " + exception);
			exception.printStackTrace(System.err);
		}
	}
}


text:
layout: post
title: "Näidisprojekt"
author: "Andmeteadlane Jossu"
---

### Üldine tutvustus

Tekst. Veel teksti.

![](/2016/images/reiting_diskonto.png)


text:
<?php

namespace Suplink\HomeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
	public function indexAction()
	{
		if ($this->get('security.context')->isGranted('ROLE_USER')) {
			$user = $this->get('security.context')->getToken()->getUser();
			return $this->render('SuplinkHomeBundle:Default:index.html.twig',array(
				'user' => $user,
				));
		}
		return $this->render('SuplinkHomeBundle:Default:index.html.twig');
	}

	public function aboutAction()
	{
		$firstname = "Mehdi";
		$lastname = "Aïssani";
		$idnumber = 151929;
		return $this->render('SuplinkHomeBundle:Default:about.html.twig',array(
			'firstname' => $firstname,
			'lastname' => $lastname,
			'idnumber' => $idnumber,
			));
	}
}


text:
<?php

use BergclubPlugin\MVC\Menu;

$assets = [
    '//cdn.datatables.net/v/dt/dt-1.10.13/r-2.1.1/datatables.min.css',
    '//cdn.jsdelivr.net/sweetalert2/6.4.4/sweetalert2.min.css',
    '//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css',
    plugins_url('assets/css/app.css', __FILE__),
    '//cdn.datatables.net/v/dt/dt-1.10.13/r-2.1.1/datatables.min.js',
    '//cdn.jsdelivr.net/sweetalert2/6.4.4/sweetalert2.min.js',
    '//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js',
    plugins_url('assets/js/de/datepicker.js', __FILE__),
];

// create admin menu "Adressen"
$adminMenu = new Menu('Adressen', 'adressen_read', 'BergclubPlugin\\Adressverwaltung\\Controllers\\MainController', $assets, 'dashicons-admin-users');


text:
'use strict';

var mssql = require('mssql'),
    express = require('express'),
    router  = express.Router();

module.exports = function(connection) {
  router.post('/', function(req, res) {
    var q = req.body.query,
        f = false,
        request = new mssql.Request(connection);
    var ret = {
      row: [ ],
      recordset: undefined,
      done: {
        status: undefined,
        val: undefined
      },
      error: undefined
    };
    request.query(q);
    request.on('row', function(row) {
      ret.row.push(row);
    });
    request.on('recordset', function(columns) {
      ret.recordset = columns;
      for(var i in columns) {
        if(columns[i].type) {
          ret.recordset[i].type = {
            declaration: columns[i].type.declaration
          };
        }
        else {
          ret.recordset[i].type.declaration = "";
        }
      }
    });
    request.on('done', function(returnValue) {
      ret.done.status = true;
      ret.done.val = returnValue;
      if(!f) {
        res.json(ret);
        f = true;
      }
    });
    request.on('error', function(err) {
      ret.error = err;
      if(!f) {
        res.json(ret);
        f = true;
      }
    });
  });
  return router;
};


text:
.class Lcom/android/settings/SettingsActivity$24;
.super Ljava/lang/Object;
.source "SettingsActivity.java"

# interfaces
.implements Landroid/view/View$OnLongClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/settings/SettingsActivity;->initMainScreenSearchView(Landroid/view/View;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/settings/SettingsActivity;

# direct methods
.method constructor <init>(Lcom/android/settings/SettingsActivity;)V
    .locals 0

    iput-object p1, p0, Lcom/android/settings/SettingsActivity$24;->this$0:Lcom/android/settings/SettingsActivity;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onLongClick(Landroid/view/View;)Z
    .locals 2

    iget-object v0, p0, Lcom/android/settings/SettingsActivity$24;->this$0:Lcom/android/settings/SettingsActivity;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/android/settings/SettingsActivity;->-set1(Lcom/android/settings/SettingsActivity;Z)Z

    const/4 v0, 0x0

    return v0
.end method


text:
require "sidekiq"

module Sidekiq
  # Sidekiq, by default, lets the JSON library decide how to encode objects,
  # including how to encode non-ASCII strings. This causes encoding problems
  # if the client is dumping jobs as UTF-8 (which it will do with UTF-8 strings
  # by default) and the worker is trying to load them as ASCII (which it does
  # by default when reading from a socket). We can get around this problem
  # entirely by forcing ASCII-only encoding (using "\uxxxx" escape sequences).
  def self.dump_json(object)
    JSON.generate(object, ascii_only: true)
  end
end


text:
// Karma configuration
// Generated on Sat Mar 19 2016 22:02:38 GMT+0100 (CET)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: './',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
        {pattern: "tests/**/*.jpg", watched: false, served: true, included: false},
        {pattern: 'dist/js/imagecrop.min.js', included: true},
        {pattern: 'dist/css/imagecrop.min.css', included: true},
        {pattern: 'tests/**/*.test.js', included: true},
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    plugins: [
        // Karma will require() these plugins
        'karma-jasmine',
        'karma-phantomjs-launcher'
    ],

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}


text:
<?php

require_once 'PHPUnit/TextUI/ResultPrinter.php';

/**
 * CakeBaseReporter contains common reporting features used in the CakePHP Test suite
 *
 * @package       Cake.TestSuite.Reporter
 */
class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {

	protected $_headerSent = false;

/**
 * Array of request parameters.  Usually parsed GET params.
 *
 * @var array
 */
	public $params = array();

/**
 * Character set for the output of test reporting.
 *
 * @var string
 */
	protected $_characterSet;

/**
* The number of assertions done for a test suite
*/
	protected $numAssertions = 0;

/**
 * Does nothing yet. The first output will
 * be sent on the first test start.
 *
 * ### Params
 *
 * - show_passes - Should passes be shown
 * - plugin - Plugin test being run?
 * - core - Core test being run.
 * - case - The case being run
 * - codeCoverage - Whether the case/group being run is being code covered.
 *
 * @param string $charset The character set to output with. Defaults to UTF-8
 * @param array $params Array of request parameters the reporter should use. See above.
 */
	public function __construct($charset = 'utf-8', $params = array()) {
		if (!$charset) {
			$charset = 'utf-8';
		}
		$this->_characterSet = $charset;
		$this->params = $params;
	}

/**
 * Retrieves a list of test cases from the active Manager class,
 * displaying it in the correct format for the reporter subclass
 *
 * @return mixed
 */
	public function testCaseList() {
		$testList = CakeTestLoader::generateTestList($this->params);
		return $testList;
	}

/**
 * Paints the start of the response from the test suite.
 * Used to paint things like head elements in an html page.
 *
 * @return void
 */
	public function paintDocumentStart() {

	}

/**
 * Paints the end of the response from the test suite.
 * Used to paint things like </body> in an html page.
 *
 * @return void
 */
	public function paintDocumentEnd() {

	}

/**
 * Paint a list of test sets, core, app, and plugin test sets
 * available.
 *
 * @return void
 */
	public function paintTestMenu() {

	}

/**
 * Get the baseUrl if one is available.
 *
 * @return string The base url for the request.
 */
	public function baseUrl() {
		if (!empty($_SERVER['PHP_SELF'])) {
			return $_SERVER['PHP_SELF'];
		}
		return '';
	}

	public function printResult(PHPUnit_Framework_TestResult $result) {
		$this->paintFooter($result);
	}

	public function paintResult(PHPUnit_Framework_TestResult $result) {
		$this->paintFooter($result);
	}

/**
* An error occurred.
*
* @param  PHPUnit_Framework_Test $test
* @param  Exception              $e
* @param  float                  $time
*/
	public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
		$this->paintException($e, $test);
	}

/**
* A failure occurred.
*
* @param  PHPUnit_Framework_Test $test
* @param  PHPUnit_Framework_AssertionFailedError $e
* @param  float $time
*/
	public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
		$this->paintFail($e, $test);
	}

/**
* Incomplete test.
*
* @param  PHPUnit_Framework_Test $test
* @param  Exception $e
* @param  float $time
*/
	public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
		$this->paintSkip($e, $test);
	}

/**
* Skipped test.
*
* @param  PHPUnit_Framework_Test $test
* @param  Exception $e
* @param  float $time
*/
	public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
		$this->paintSkip($e, $test);
	}

/**
 * A test suite started.
 *
 * @param  PHPUnit_Framework_TestSuite $suite
 */
	public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
		if (!$this->_headerSent) {
			echo $this->paintHeader();
		}
		echo __d('cake_dev', 'Running  %s', $suite->getName()) . "\n";
	}

/**
 * A test suite ended.
 *
 * @param  PHPUnit_Framework_TestSuite $suite
 */
	public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
	}

/**
 * A test started.
 *
 * @param  PHPUnit_Framework_Test $test
 */
	public function startTest(PHPUnit_Framework_Test $test) {
	}

/**
 * A test ended.
 *
 * @param  PHPUnit_Framework_Test $test
 * @param  float $time
 */
	public function endTest(PHPUnit_Framework_Test $test, $time) {
		$this->numAssertions += $test->getNumAssertions();
		$this->paintPass($test, $time);
	}

}


text:
<?php

/**
 * Slackify package builder
 *
 * @author Ivan Klimchuk <ivan@klimchuk.com>
 * @package slackNotify
 * @subpackage build
 */

set_time_limit(0);

ini_set('date.timezone', 'Europe/Minsk');

define('PKG_NAME', 'Slackify');
define('PKG_NAME_LOWER', strtolower(PKG_NAME));
define('PKG_VERSION', '0.8.0');
define('PKG_RELEASE', 'pl');

require_once 'xpdo/xpdo/xpdo.class.php';
require_once 'xpdo/xpdo/transport/xpdotransport.class.php';

$xpdo = xPDO::getInstance('db', [
    xPDO::OPT_CACHE_PATH => __DIR__ . '/../cache/',
    xPDO::OPT_HYDRATE_FIELDS => true,
    xPDO::OPT_HYDRATE_RELATED_OBJECTS => true,
    xPDO::OPT_HYDRATE_ADHOC_FIELDS => true,
    xPDO::OPT_CONNECTIONS => [
        [
            'dsn' => 'mysql:host=localhost;dbname=xpdotest;charset=utf8',
            'username' => 'test',
            'password' => 'test',
            'options' => [xPDO::OPT_CONN_MUTABLE => true],
            'driverOptions' => [],
        ]
    ]
]);

$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO);
$xpdo->setLogTarget();

class modNamespace extends xPDOObject {}
class modCategory extends xPDOObject {
    public function getFKDefinition($alias)
    {
        $aggregates = [
            'Plugins' => [
                'class' => 'modPlugin',
                'local' => 'id',
                'foreign' => 'category',
                'cardinality' => 'many',
                'owner' => 'local',
            ]
        ];

        return isset($aggregates[$alias]) ? $aggregates[$alias] : [];
    }
}
class modSystemSetting extends xPDOObject {}
class modPlugin extends xPDOObject {
    public function getFKDefinition($alias)
    {
        $aggregates = [
            'PluginEvents' => [
                'class' => 'modPluginEvent',
                'local' => 'id',
                'foreign' => 'pluginid',
                'cardinality' => 'one',
                'owner' => 'local',
            ]
        ];

        return isset($aggregates[$alias]) ? $aggregates[$alias] : [];
    }
}
class modPluginEvent extends xPDOObject {}

/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = [
    'build' => $root . '_build/',
    'data' => $root . '_build/data/',
    'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/',
    'docs' => $root . 'docs/',
    'resolvers' => $root . '_build/resolvers/',
    'validators' => $root . '_build/validators/',
    'core' => [
        'components/slackify/',
    ],
];

$signature = join('-', [PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE]);
$directory = $root . '_packages/';
//$directory = __DIR__ . '/../../../core/packages/'; // local place
$filename = $directory . $signature . '.transport.zip';

if (file_exists($filename)) {
    unlink($filename);
}
if (file_exists($directory . $signature) && is_dir($directory . $signature)) {
    $cacheManager = $xpdo->getCacheManager();
    if ($cacheManager) {
        $cacheManager->deleteTree($directory . $signature, true, false, []);
    }
}

$package = new xPDOTransport($xpdo, $signature, $directory);

$namespace = new modNamespace($xpdo);
$namespace->fromArray([
    'id' => PKG_NAME_LOWER,
    'name' => PKG_NAME_LOWER,
    'path' => '{core_path}components/' . PKG_NAME_LOWER . '/',
]);

$package->put($namespace, [
    xPDOTransport::UNIQUE_KEY => 'name',
    xPDOTransport::PRESERVE_KEYS => true,
    xPDOTransport::UPDATE_OBJECT => true,
    xPDOTransport::RESOLVE_FILES => true,
    xPDOTransport::RESOLVE_PHP => true,
    xPDOTransport::NATIVE_KEY => PKG_NAME_LOWER,
    'namespace' => PKG_NAME_LOWER,
    'package' => 'modx',
    'resolve' => null,
    'validate' => null
]);

$settings = include $sources['data'] . 'transport.settings.php';
foreach ($settings as $setting) {
    $package->put($setting, [
        xPDOTransport::UNIQUE_KEY => 'key',
        xPDOTransport::PRESERVE_KEYS => true,
        xPDOTransport::UPDATE_OBJECT => true,
        'class' => 'modSystemSetting',
        'resolve' => null,
        'validate' => null,
        'package' => 'modx',
    ]);
}

$validators = [];
array_push($validators, [
    'type' => 'php',
    'source' => $sources['validators'] . 'validate.phpversion.php'
]);

$resolvers = [];
foreach ($sources['core'] as $file) {
    $directory = dirname($file);
    array_push($resolvers, [
        'type' => 'file',
        'source' => $root . 'core/' . $file,
        'target' => "return MODX_CORE_PATH . '$directory/';"
    ]);
}
array_push($resolvers,
    ['type' => 'php', 'source' => $sources['resolvers'] . 'resolve.extension.php'],
    ['type' => 'php', 'source' => $sources['resolvers'] . 'resolve.settings.php']
);

$category = new modCategory($xpdo);
$category->fromArray([
    'id' => 1,
    'category' => PKG_NAME,
    'parent' => 0,
]);

$plugins = include $sources['data'] . 'transport.plugins.php';
if (is_array($plugins)) {
    $category->addMany($plugins, 'Plugins');
}

$package->put($category, [
    xPDOTransport::UNIQUE_KEY => 'category',
    xPDOTransport::PRESERVE_KEYS => false,
    xPDOTransport::UPDATE_OBJECT => true,
    xPDOTransport::ABORT_INSTALL_ON_VEHICLE_FAIL => true,
    xPDOTransport::RELATED_OBJECTS => true,
    xPDOTransport::RELATED_OBJECT_ATTRIBUTES => [
        'Plugins' => [
            xPDOTransport::UNIQUE_KEY => 'name',
            xPDOTransport::PRESERVE_KEYS => false,
            xPDOTransport::UPDATE_OBJECT => false,
            xPDOTransport::RELATED_OBJECTS => true
        ],
        'PluginEvents' => [
            xPDOTransport::UNIQUE_KEY => ['pluginid', 'event'],
            xPDOTransport::PRESERVE_KEYS => true,
            xPDOTransport::UPDATE_OBJECT => false,
            xPDOTransport::RELATED_OBJECTS => true
        ]
    ],
    xPDOTransport::NATIVE_KEY => true,
    'package' => 'modx',
    'validate' => $validators,
    'resolve' => $resolvers
]);

$package->setAttribute('changelog', file_get_contents($sources['docs'] . 'changelog.txt'));
$package->setAttribute('license', file_get_contents($sources['docs'] . 'license.txt'));
$package->setAttribute('readme', file_get_contents($sources['docs'] . 'readme.txt'));
$package->setAttribute('requires', ['php' => '>=5.4']);
$package->setAttribute('setup-options', ['source' => $sources['build'] . 'setup.options.php']);

if ($package->pack()) {
    $xpdo->log(xPDO::LOG_LEVEL_INFO, "Package built");
}