text:
#ifndef WebVTTParser_h
#define WebVTTParser_h

#if ENABLE(VIDEO_TRACK)

#include "BufferedLineReader.h"
#include "DocumentFragment.h"
#include "HTMLNames.h"
#include "TextResourceDecoder.h"
#include "VTTRegion.h"
#include "WebVTTTokenizer.h"
#include <memory>
#include <wtf/MediaTime.h>
#include <wtf/text/StringBuilder.h>

namespace WebCore {

using namespace HTMLNames;

class Document;
class ISOWebVTTCue;
class VTTScanner;

class WebVTTParserClient {
public:
    virtual ~WebVTTParserClient() { }

    virtual void newCuesParsed() = 0;
    virtual void newRegionsParsed() = 0;
    virtual void fileFailedToParse() = 0;
};

class WebVTTCueData final : public RefCounted<WebVTTCueData> {
public:

    static Ref<WebVTTCueData> create() { return adoptRef(*new WebVTTCueData()); }
    ~WebVTTCueData() { }

    MediaTime startTime() const { return m_startTime; }
    void setStartTime(const MediaTime& startTime) { m_startTime = startTime; }

    MediaTime endTime() const { return m_endTime; }
    void setEndTime(const MediaTime& endTime) { m_endTime = endTime; }

    String id() const { return m_id; }
    void setId(String id) { m_id = id; }

    String content() const { return m_content; }
    void setContent(String content) { m_content = content; }

    String settings() const { return m_settings; }
    void setSettings(String settings) { m_settings = settings; }

    MediaTime originalStartTime() const { return m_originalStartTime; }
    void setOriginalStartTime(const MediaTime& time) { m_originalStartTime = time; }

private:
    WebVTTCueData() { }

    MediaTime m_startTime;
    MediaTime m_endTime;
    MediaTime m_originalStartTime;
    String m_id;
    String m_content;
    String m_settings;
};

class WebVTTParser final {
public:
    enum ParseState {
        Initial,
        Header,
        Id,
        TimingsAndSettings,
        CueText,
        BadCue,
        Finished
    };

    WebVTTParser(WebVTTParserClient*, ScriptExecutionContext*);

    static inline bool isRecognizedTag(const AtomicString& tagName)
    {
        return tagName == iTag
            || tagName == bTag
            || tagName == uTag
            || tagName == rubyTag
            || tagName == rtTag;
    }

    static inline bool isValidSettingDelimiter(UChar c)
    {
        // ... a WebVTT cue consists of zero or more of the following components, in any order, separated from each other by one or more
        // U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters.
        return c == ' ' || c == '\t';
    }
    static bool collectTimeStamp(const String&, MediaTime&);

    // Useful functions for parsing percentage settings.
    static bool parseFloatPercentageValue(VTTScanner& valueScanner, float&);
    static bool parseFloatPercentageValuePair(VTTScanner& valueScanner, char, FloatPoint&);

    // Input data to the parser to parse.
    void parseBytes(const char*, unsigned);
    void parseFileHeader(const String&);
    void parseCueData(const ISOWebVTTCue&);
    void flush();
    void fileFinished();

    // Transfers ownership of last parsed cues to caller.
    void getNewCues(Vector<RefPtr<WebVTTCueData>>&);
    void getNewRegions(Vector<RefPtr<VTTRegion>>&);

    // Create the DocumentFragment representation of the WebVTT cue text.
    static Ref<DocumentFragment> createDocumentFragmentFromCueText(Document&, const String&);

protected:
    ScriptExecutionContext* m_scriptExecutionContext;
    ParseState m_state;

private:
    void parse();
    void flushPendingCue();
    bool hasRequiredFileIdentifier(const String&);
    ParseState collectCueId(const String&);
    ParseState collectTimingsAndSettings(const String&);
    ParseState collectCueText(const String&);
    ParseState recoverCue(const String&);
    ParseState ignoreBadCue(const String&);

    void createNewCue();
    void resetCueValues();

    void collectMetadataHeader(const String&);
    void createNewRegion(const String& headerValue);

    static bool collectTimeStamp(VTTScanner& input, MediaTime& timeStamp);

    BufferedLineReader m_lineReader;
    RefPtr<TextResourceDecoder> m_decoder;
    String m_currentId;
    MediaTime m_currentStartTime;
    MediaTime m_currentEndTime;
    StringBuilder m_currentContent;
    String m_currentSettings;

    WebVTTParserClient* m_client;

    Vector<RefPtr<WebVTTCueData>> m_cuelist;
    Vector<RefPtr<VTTRegion>> m_regionList;
};

} // namespace WebCore

#endif
#endif


text:
from integriot import *

led1Status = False

init("localhost")  # use the MQTT broker on localhost

prefix("led")  # all actors below are prefixed with /led

led1 = publisher("led1")

def button1Callback(msg):
    global led1Status

    print("received: [button]", msg)

    if (msg == "down"):
        led1Status = not led1Status  # toggle status of led

        if (led1Status):
            led1.publish("set", "on")  # publish updated state
            print("sending: [led1]", "on")
        else:
            led1.publish("set", "off")
            print("sending: [led1]", "of")

prefix("button")  # all sensors below are prefixed with /button

button1 = subscriber("button1")
button1.subscribe_change(callback=button1Callback)

run()

redpajama_set_name: RedPajamaGithub


text: for const key in obj {}


text:
package me.thehutch.fusion.api.component;

/**
 * @author thehutch
 */
public interface IComponent {
}


text:
package mocks

import (
	"fmt"

	"github.com/bivas/rivi/pkg/types"
	"github.com/bivas/rivi/pkg/util"
)

type MockData struct {
	Number            int
	Title             string
	Description       string
	State             string
	Owner             string
	Repo              string
	Ref               string
	Origin            types.Origin
	Assignees         []string
	AddedAssignees    []string
	RemovedAssignees  []string
	Labels            []string
	AddedLabels       []string
	RemovedLabels     []string
	FileNames         []string
	FileExtensions    []string
	Comments          []types.Comment
	AddedComments     []string
	ChangedFiles      int
	ChangesAdd        int
	ChangesRemove     int
	Provider          string
	RawPayload        []byte
	Collaborators     []string
	AvailableLabels   []string
	RulesFileContent  string
	EventType         string
	StatusDescription string
	StatusState       types.State
}

func (m *MockData) SetStatus(desc string, state types.State) {
	m.StatusDescription = desc
	m.StatusState = state
}

func (m *MockData) GetRawType() string {
	return m.EventType
}

func (m *MockData) GetCollaborators() []string {
	return m.Collaborators
}

func (m *MockData) IsCollaborator(name string) bool {
	for _, collaborator := range m.Collaborators {
		if name == collaborator {
			return true
		}
	}
	return false
}

func (m *MockData) GetAvailableLabels() []string {
	return m.AvailableLabels
}

func (m *MockData) GetRulesFile() string {
	return m.RulesFileContent
}

func (m *MockData) GetRepository() types.Repository {
	return m
}

func (m *MockData) GetProvider() string {
	return m.Provider
}

func (m *MockData) GetShortName() string {
	return fmt.Sprintf("%s/%s#%d", m.Owner, m.Repo, m.Number)
}

func (m *MockData) GetLongName() string {
	return fmt.Sprintf("%s/%s#%d [%s]", m.Owner, m.Repo, m.Number, m.Title)
}

func (m *MockData) GetRawPayload() []byte {
	return m.RawPayload
}

func (m *MockData) GetNumber() int {
	return m.Number
}

func (m *MockData) GetTitle() string {
	return m.Title
}

func (m *MockData) GetDescription() string {
	return m.Description
}

func (m *MockData) GetState() string {
	return m.State
}

func (m *MockData) GetOrigin() types.Origin {
	return m.Origin
}

func (m *MockData) GetOwner() string {
	return m.Owner
}

func (m *MockData) GetRepo() string {
	return m.Repo
}

func (m *MockData) GetRef() string {
	return m.Ref
}

func (m *MockData) GetLabels() []string {
	return m.Labels
}

func (m *MockData) HasLabel(label string) bool {
	for _, search := range m.Labels {
		if search == label {
			return true
		}
	}
	return false
}

func (m *MockData) AddLabel(label string) {
	m.AddedLabels = append(m.AddedLabels, label)
	m.Labels = append(m.Labels, label)
}

func (m *MockData) RemoveLabel(label string) {
	m.RemovedLabels = append(m.RemovedLabels, label)
	set := util.StringSet{}
	set.AddAll(m.Labels).Remove(label)
	m.Labels = set.Values()
}

func (m *MockData) GetAssignees() []string {
	return m.Assignees
}

func (m *MockData) HasAssignee(assignee string) bool {
	for _, search := range m.Assignees {
		if search == assignee {
			return true
		}
	}
	return false
}

func (m *MockData) AddAssignees(assignees ...string) {
	m.AddedAssignees = append(m.AddedAssignees, assignees...)
	m.Assignees = append(m.Assignees, assignees...)
}

func (m *MockData) RemoveAssignees(assignees ...string) {
	m.RemovedLabels = append(m.RemovedLabels, assignees...)
}

func (m *MockData) GetComments() []types.Comment {
	return m.Comments
}

func (m *MockData) AddComment(comment string) {
	m.AddedComments = append(m.AddedComments, comment)
	m.Comments = append(m.Comments, types.Comment{Commenter: "mock", Comment: comment})
}

func (m *MockData) GetFileNames() []string {
	return m.FileNames
}

func (m *MockData) GetChangedFiles() int {
	return m.ChangedFiles
}

func (m *MockData) GetFileExtensions() []string {
	return m.FileExtensions
}

func (m *MockData) GetChanges() (int, int) {
	return m.ChangesAdd, m.ChangesRemove
}


text:
[//]: # (title: Test code using JUnit in JVM – tutorial)

This tutorial will show you how to write a simple unit test and run it with the Gradle build tool.

The example in the tutorial has the [kotlin.test](https://kotlinlang.org/api/latest/kotlin.test/index.html) library under the hood and runs the test using JUnit.

To get started, first download and install the latest version of [IntelliJ IDEA](https://www.jetbrains.com/idea/download/index.html).

## Add dependencies

1. Open a Kotlin project in IntelliJ IDEA. If you don't already have a project, [create one](jvm-get-started.md#create-an-application).

   > Specify **JUnit 5** as your test framework when creating your project.
   >
   {type="note"}

2. Open the `build.gradle(.kts)` file and add the following dependency to the Gradle configuration. This dependency will allow you to work with `kotlin.test` and `JUnit`:

    <tabs group="build-script">
    <tab title="Kotlin" group-key="kotlin">

   ```kotlin
   dependencies {
       // Other dependencies.
       testImplementation(kotlin("test"))
   }
   ```

    </tab>
    <tab title="Groovy" group-key="groovy">

   ```groovy
   dependencies {
       // Other dependencies.
       testImplementation 'org.jetbrains.kotlin:kotlin-test'
   }
   ```

   </tab>
   </tabs>

3. Add the `test` task to the `build.gradle(.kts)` file:

    <tabs group="build-script">
    <tab title="Kotlin" group-key="kotlin">

   ```kotlin
   tasks.test {
       useJUnitPlatform()
   }
   ```

    </tab>
    <tab title="Groovy" group-key="groovy">

   ```groovy
   test {
       useJUnitPlatform()
   }
   ```

   </tab>
   </tabs>

   > If you created the project using the **New Project** wizard, the task will be added automatically.
   >
   {type="note"}

## Add the code to test it

1. Open the `main.kt` file in `src/main/kotlin`.

   The `src` directory contains Kotlin source files and resources. The `main.kt` file contains sample code that will print `Hello, World!`.

2. Create the `Sample` class with the `sum()` function that adds two integers together:

   ```kotlin
   class Sample() {

       fun sum(a: Int, b: Int): Int {
           return a + b
       }
   }
   ```

## Create a test

1. In IntelliJ IDEA, select **Code** | **Generate** | **Test...** for the `Sample` class.

   ![Create a test](create-test.png)

2. Specify the name of the test class. For example, `SampleTest`.

   IntelliJ IDEA creates the `SampleTest.kt` file in the `test` directory. This directory contains Kotlin test source files and resources.

   > You can also manually create a `*.kt` file for tests in `src/test/kotlin`.
   >
   {type="note"}

2. Add the test code for the `sum()` function in `SampleTest.kt`:

   * Define the test `testSum()` function using the [@Test annotation](https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/-test/index.html).
   * Check that the `sum()` function returns the expected value by using the [assertEquals()](https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/assert-equals.html) function.

   ```kotlin
   import kotlin.test.Test
   import kotlin.test.assertEquals

   internal class SampleTest {

       private val testSample: Sample = Sample()

       @Test
       fun testSum() {
           val expected = 42
           assertEquals(expected, testSample.sum(40, 2))
       }
   }
   ```

## Run a test

1. Run the test using the gutter icon.

   ![Run the test](run-test.png)

   > You can also run all project tests via the command-line interface using the `./gradlew check` command.
   >
   {type="note"}

2. Check the result in the **Run** tool window:

   ![Check the test result. The test passed successfully](check-the-result.png)

   The test function was executed successfully.

3. Make sure that the test works correctly by changing the `expected` variable value to 43:

   ```kotlin
   @Test
   fun testSum() {
       val expected = 43
       assertEquals(expected, classForTesting.sum(40, 2))
   }
   ```

4. Run the test again and check the result:

   ![Check the test result. The test has been failed](check-the-result-2.png)

   The test execution failed.

## What's next

Once you've finished your first test, you can:

* Try to write another test using other [kotlin.test](https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/) functions. For example, you could use the [`assertNotEquals()`](https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/assert-not-equals.html) function.
* [Create your first application](jvm-spring-boot-restful.md) with Kotlin and Spring Boot.
* Watch [these video tutorials](https://www.youtube.com/playlist?list=PL6gx4Cwl9DGDPsneZWaOFg0H2wsundyGr) on YouTube, which demonstrate how to use Spring Boot with Kotlin and JUnit 5.


text:
package com.jivesoftware.addon.example.tile;

import com.google.common.collect.Lists;
import com.jivesoftware.sdk.api.entity.TileInstance;
import com.jivesoftware.sdk.api.tile.JiveCalendarTile;
import com.jivesoftware.sdk.api.tile.data.CalendarEvent;
import com.jivesoftware.sdk.api.tile.data.CalendarTile;
import com.jivesoftware.sdk.api.tile.data.TileAction;
import com.jivesoftware.sdk.client.JiveClientException;
import com.jivesoftware.sdk.event.TileInstanceEvent;
import com.jivesoftware.sdk.event.TileInstanceEventListener;
import com.jivesoftware.sdk.utils.DateTimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Singleton;
import java.util.Date;
import java.util.List;
import java.util.TimerTask;

/**
 * Created by rrutan on 2/4/14.
 */
@Singleton
public class MyExampleCalendarTile extends JiveCalendarTile implements TileInstanceEventListener {
    private static final Logger log = LoggerFactory.getLogger(MyExampleCalendarTile.class);

    public static final String NAME = "jersey-example-calendar";

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

    @Override
    public boolean accepts(TileInstanceEvent event) {
        boolean accept = (event.getTileName().equals(getName()) &&
                (
                        TileInstanceEvent.Type.RegisterSuccess.equals(event.getType()) ||
                        TileInstanceEvent.Type.Unregister.equals(event.getType())
                )
        );
        if (log.isTraceEnabled()) { log.trace("accepts[name="+event.getTileName()+"], type=["+event.getType()+"] => "+accept); }
        return accept;
    } // end accepts

    @Override
    public void process(TileInstanceEvent event) throws TileInstanceEventException {
        if (log.isDebugEnabled()) { log.debug("process[name=" + getName() + "] ...");   }
        if (event.getType().equals(TileInstanceEvent.Type.RegisterSuccess)) {
            onRegisterEvent(event);
        } else if (event.getType().equals(TileInstanceEvent.Type.Unregister)) {
            onUnregisterEvent(event);
        } // end if
    } // end process

    private void onRegisterEvent(TileInstanceEvent event) {
        TileInstance tileInstance = (TileInstance)event.getContext();

        new Thread(new TileTimerTask(tileInstance)).start();
    } // end onRegisterEvent

    private void onUnregisterEvent(TileInstanceEvent event) {
        if (log.isDebugEnabled()) { log.debug("onUnregisterEvent[name="+getName()+"] ..."); }

    } // end onUnregisterEvent

    /******
     *
     ******/

    class TileTimerTask extends TimerTask {

        private TileInstance tileInstance = null;

        TileTimerTask(TileInstance tileInstance) {
            this.tileInstance = tileInstance;
        } // end constructor

        @Override
        public void run() {
            for (int x=0; x<8; x++) {
                if (log.isDebugEnabled()) { log.debug("pushing data"); }

                /*** PUSH DATA TO TILE ***/
                try {
                    pushData(tileInstance, getBogusPush(tileInstance,(x+1)));
                } catch (JiveClientException jce) {
                    log.error("Unable to Post to Tile",jce);
                } // end try/catch

                /*** PAUSE BETWEEN PUSHES TILE ***/
                try {
                    Thread.currentThread().sleep(8000);
                } catch (InterruptedException ie) {
                    /**** WOKE-UP *****/
                } // end try/catch

            } // end for
        } // end run

    } // end class

    private CalendarTile getBogusPush(TileInstance tileInstance, int index) {
        String section = tileInstance.getConfig().get("section");

        CalendarTile calendarTile = new CalendarTile();
        calendarTile.setTitle("Example Calendar - "+new Date().getTime());

        calendarTile.setLocationDisplay(false);

        List<CalendarEvent> events = Lists.newArrayList();

        CalendarEvent event = new CalendarEvent();
        event.setStart(DateTimeUtils.dateToTileIso(new Date(System.currentTimeMillis()+(1000*60*60*24*(index+5)))));
        event.setDuration("01:00:00");
        event.setLocation("Somewhere ["+section+"]");
        event.setTitle("Event Title");
        event.setDescription("Example Description");

        TileAction action = new TileAction();
        action.setText("Developers Community");
        action.setUrl("https://developer.jivesoftware.com");
        event.setAction(action);

        events.add(event);

        calendarTile.setEvents(events);

        return calendarTile;

    } // end getBogusPush

    private CalendarTile getBogusFetch(TileInstance tileInstance) {
        return getBogusPush(tileInstance,1);
    } // end getBogusFetch

} // end class


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class org.hibernate.event.def.AbstractVisitor (Hibernate API Documentation)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../jdstyle.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
org.hibernate.event.def.AbstractVisitor

Packages that use AbstractVisitor

org.hibernate.event.def

	This package defines a default set of event listeners that
	implements the default behaviors of Hibernate.

Uses of AbstractVisitor in org.hibernate.event.def

Subclasses of AbstractVisitor in org.hibernate.event.def

 class
DirtyCollectionSearchVisitor

          Do we have a dirty collection here?
 1.

 class
EvictVisitor

          Evict any collections referenced by the object from the session cache.

 class
FlushVisitor

          Process collections reachable from an entity.

 class
OnLockVisitor

          When a transient entity is passed to lock(), we must inspect all its collections and
 1.

 class
OnReplicateVisitor

          When an entity is passed to replicate(), and there is an existing row, we must
 inspect all its collections and
 1.

 class
OnUpdateVisitor

          When an entity is passed to update(), we must inspect all its collections and
 1.

 class
ProxyVisitor

          Reassociates uninitialized proxies with the session

 class
ReattachVisitor

          Abstract superclass of visitors that reattach collections

 class
WrapVisitor

          Wrap collections in a Hibernate collection
 wrapper.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
'use strict';

angular.module('angularPassportApp')
 .controller('BlitzCtrl', function ($scope, $http, Blitz, $location, $routeParams, $rootScope) {

		$scope.kyung_arr = [];
		$scope.mina_arr = [];
		$scope.jess_arr = [];
		$scope.vic_arr = [];
		$scope.tagline = '';

	   $scope.test = {};
	   $scope.test.t1 = [];
	   $scope.test.t2 = [];

		var ka = [];
		var ma = [];
		var ja =[];
		var va = [];

		var getarr  = function(arr)
		{
			var a = [];
	        for (var i = 0; i < arr.length; ++i) {
	            a.push(arr[i]);
	        }
	        return a;
		}

		$scope.getkyung = function () {

		        return getarr(ka);
		    };
		$scope.getmina = function () {

		        return getarr(ma);
		    };
		$scope.getjess = function () {

		        return getarr(ja);
		    };
		$scope.getvic = function () {

		        return getarr(va);
		    };

			Blitz.get().success(function(data) {

				for(var i=0;i<data.length;i++)
				{
					var kyung_total = 0;
					var mina_total = 0;
					var jess_total = 0;
					var vic_total = 0;
					for(var j=0;j<data[i].kyung.length;j++) kyung_total+=data[i].kyung[j];
					for(var j=0;j<data[i].mina.length;j++) mina_total+=data[i].mina[j];
					for(var j=0;j<data[i].jess.length;j++) jess_total+=data[i].jess[j];
					for(var j=0;j<data[i].vic.length;j++) vic_total+=data[i].vic[j];
					data[i].kyung_total=kyung_total;
					data[i].mina_total=mina_total;
					data[i].jess_total=jess_total;
					data[i].vic_total=vic_total;

				}

				$scope.blitzposts = data;

			});

		$scope.change_one_round_blitz = function()
		{
			var round, kyung_delta, mina_delta, jess_delta, vic_delta;

			round = parseInt($scope.which_round)-1;
			if($scope.which_round==="last") round = ka.length-1;
			if($scope.which_round===undefined) round = ka.length-1;

			if($scope.kyung_change_one_round === undefined) kyung_delta = ka[round];
			else kyung_delta = parseInt($scope.kyung_change_one_round);

			if($scope.mina_change_one_round === undefined) mina_delta = ma[round];
			else mina_delta = parseInt($scope.mina_change_one_round);

			if($scope.jess_change_one_round === undefined) jess_delta = ja[round];
			else jess_delta = parseInt($scope.jess_change_one_round);

			if($scope.vic_change_one_round === undefined) vic_delta = va[round];
			else vic_delta = parseInt($scope.vic_change_one_round);

		    ka.splice(round,1);
		    ma.splice(round,1);
		    ja.splice(round,1);
		    va.splice(round,1);

		    ka.splice(round, 0, kyung_delta);
		    ma.splice(round, 0, mina_delta);
		    ja.splice(round, 0, jess_delta);
		    va.splice(round, 0, vic_delta);

		    $scope.kyung_change_one_round = undefined;
		    $scope.mina_change_one_round = undefined;
		    $scope.jess_change_one_round = undefined;
		    $scope.vic_change_one_round = undefined;
		    $scope.which_round = undefined;

			var kyung_total = 0;
			var mina_total = 0;
			var jess_total = 0;
			var vic_total = 0;
			for(var j=0;j<ka.length;j++)
			{
				kyung_total+=parseInt(ka[j]);
				mina_total+=parseInt(ma[j]);
				jess_total+=parseInt(ja[j]);
				vic_total+=parseInt(va[j]);
			}
			// for(var j=0;j<$scope.mina_arr.length;j++) mina_total+=parseInt($scope.mina_arr[j]);
			// for(var j=0;j<$scope.jess_arr.length;j++) jess_total+=parseInt($scope.jess_arr[j]);
			// for(var j=0;j<$scope.vic_arr.length;j++) vic_total+=parseInt($scope.vic_arr[j]);

				var current =  {
				kyung:ka,
				mina:ma,
				jess:ja,
				vic:va,
				kyung_total:kyung_total,
				mina_total:mina_total,
				jess_total:jess_total,
				vic_total:vic_total
			};

			$scope.currentblitz = current;

		}
		$scope.enter_one_round_blitz = function(){
					$scope.test.t1.push('1');
					$scope.test.t2.push('1');
					var newBlitz = {
						"kyung":parseInt($scope.kyung_one_round),
						"mina":parseInt($scope.mina_one_round),
						"jess":parseInt($scope.jess_one_round),
						"vic":parseInt($scope.vic_one_round)
					};
						// $scope.kyung_arr.push(newBlitz.kyung);
						// $scope.mina_arr.push(newBlitz.mina);
						// $scope.jess_arr.push(newBlitz.jess);
						// $scope.vic_arr.push(newBlitz.vic);

					ka.push(parseInt($scope.kyung_one_round));
					ma.push(parseInt($scope.mina_one_round));
					ja.push(parseInt($scope.jess_one_round));
					va.push(parseInt($scope.vic_one_round));

					var kyung_total = 0;
					var mina_total = 0;
					var jess_total = 0;
					var vic_total = 0;
					for(var j=0;j<ka.length;j++)

					{

						kyung_total+=parseInt(ka[j]);
						mina_total+=parseInt(ma[j]);
						jess_total+=parseInt(ja[j]);
						vic_total+=parseInt(va[j]);

					}
					// for(var j=0;j<$scope.mina_arr.length;j++) mina_total+=parseInt($scope.mina_arr[j]);
					// for(var j=0;j<$scope.jess_arr.length;j++) jess_total+=parseInt($scope.jess_arr[j]);
					// for(var j=0;j<$scope.vic_arr.length;j++) vic_total+=parseInt($scope.vic_arr[j]);

						var current =  {
						kyung:ka,
						mina:ma,
						jess:ja,
						vic:va,
						kyung_total:kyung_total,
						mina_total:mina_total,
						jess_total:jess_total,
						vic_total:vic_total
					};

					    $scope.currentblitz = current;

					  // $scope.kyung_arr.push($scope.kyung_one_round);
					  // $scope.mina_arr.push($scope.mina_one_round);
					  // $scope.jess_arr.push($scope.jess_one_round);
					  // $scope.vic_arr.push($scope.vic_one_round);

					  // $scope.kyung_total = kyung_total;
					  // $scope.mina_total = mina_total;
					  // $scope.jess_total = jess_total;
					  // $scope.vic_total = vic_total;
					  $scope.tagline = current;
						$scope.kyung_one_round = "";
						$scope.mina_one_round = "";
						$scope.jess_one_round ="";
						$scope.vic_one_round = "";

$scope.$digest();

		};

		// CREATE ==================================================================
		// when submitting the add form, send the text to the node API
		$scope.createBlitz = function() {

	    var time = new Date();
	    var dd_month = (1+time.getMonth()).toString();
	    var dd_date = (time.getDate()).toString();

	    if(dd_month.length < 2) dd_month = '0'+dd_month;
	    if(dd_date.length < 2) dd_date = '0'+dd_date;

	    var gametime = dd_month+'-'+dd_date+'-'+time.getFullYear()
	                        +'-'+time.getHours()+'-'+time.getMinutes();

	    if($scope.gametime!=null)gametime+='-'+$scope.gametime;

			// validate the formData to make sure that something is there
			// if form is empty, nothing will happen
			// people can't just hold enter to keep adding the same to-do anymore

				var newBlitz = {"gametime":gametime,
						"kyung":ka,
						"mina":ma,
						"jess":ja,
						"vic":va};

				// // call the create function from our service (returns a promise object)
				Blitz.create(newBlitz)

					// if successful creation, call our get function to get all the new todos
					.success(function(data) {
					 //$scope.tagline = newBlitz;

					var kyung_total = 0;
					var mina_total = 0;
					var jess_total = 0;
					var vic_total = 0;
					for(var j=0;j<newBlitz.kyung.length;j++) kyung_total+=parseInt(newBlitz.kyung[j]);
					for(var j=0;j<newBlitz.mina.length;j++) mina_total+=parseInt(newBlitz.mina[j]);
					for(var j=0;j<newBlitz.jess.length;j++) jess_total+=parseInt(newBlitz.jess[j]);
					for(var j=0;j<newBlitz.vic.length;j++) vic_total+=parseInt(newBlitz.vic[j]);
					newBlitz.kyung_total=kyung_total;
					newBlitz.mina_total=mina_total;
					newBlitz.jess_total=jess_total;
					newBlitz.vic_total=vic_total;

					  $scope.blitzposts.push({
					    gametime:gametime,
						kyung:ka,
						mina:ma,
						jess:ja,
						vic:va,
						kyung_total:kyung_total,
						mina_total:mina_total,
						jess_total:jess_total,
						vic_total:vic_total
					  });
					ka = [];
					ma = [];
					ja = [];
					va = [];
					$scope.currentblitz = "";
		$scope.kyung_arr = [];
		$scope.mina_arr = [];
		$scope.jess_arr = [];
		$scope.vic_arr = [];

					});

		};

});


text:
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package com.google.protobuf;

import com.google.protobuf.testing.Proto2TestingLite;
import com.google.protobuf.testing.Proto2TestingLite.Proto2EmptyLite;
import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLite;
import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLiteWithExtensions;
import com.google.protobuf.testing.Proto2TestingLite.Proto2MessageLiteWithMaps;
import com.google.protobuf.testing.Proto3TestingLite.Proto3EmptyLite;
import com.google.protobuf.testing.Proto3TestingLite.Proto3MessageLite;
import com.google.protobuf.testing.Proto3TestingLite.Proto3MessageLiteWithMaps;

/** Schemas to support testing. */
public final class TestSchemasLite {

  public static final Schema<Proto2MessageLite> genericProto2LiteSchema =
      new ManifestSchemaFactory().createSchema(Proto2MessageLite.class);
  public static final Schema<Proto3MessageLite> genericProto3LiteSchema =
      new ManifestSchemaFactory().createSchema(Proto3MessageLite.class);

  public static void registerGenericProto2LiteSchemas() {
    registerProto2LiteSchemas();
  }

  public static void registerGenericProto3LiteSchemas() {
    registerProto3LiteSchemas();
  }

  private static void registerProto2LiteSchemas() {
    Protobuf protobuf = Protobuf.getInstance();
    ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(
        Proto2MessageLite.class, factory.createSchema(Proto2MessageLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup49.class,
        factory.createSchema(Proto2MessageLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroupList51.class,
        factory.createSchema(Proto2MessageLite.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup69.class,
        factory.createSchema(Proto2MessageLite.FieldGroup69.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.RequiredNestedMessage.class,
        factory.createSchema(Proto2MessageLite.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldRequiredGroup88.class,
        factory.createSchema(Proto2MessageLite.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(
        Proto2EmptyLite.class, factory.createSchema(Proto2EmptyLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLiteWithExtensions.class,
        factory.createSchema(Proto2MessageLiteWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2TestingLite.FieldGroup49.class,
        factory.createSchema(Proto2TestingLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2TestingLite.FieldGroupList51.class,
        factory.createSchema(Proto2TestingLite.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLiteWithMaps.class, factory.createSchema(Proto2MessageLiteWithMaps.class));
  }

  private static void registerProto3LiteSchemas() {
    Protobuf protobuf = Protobuf.getInstance();
    ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(
        Proto3MessageLite.class, factory.createSchema(Proto3MessageLite.class));
    protobuf.registerSchemaOverride(
        Proto3EmptyLite.class, factory.createSchema(Proto3EmptyLite.class));
    protobuf.registerSchemaOverride(
        Proto3MessageLiteWithMaps.class, factory.createSchema(Proto3MessageLiteWithMaps.class));
  }
}


text:
package co.cask.cdap.api.dataset.lib;

/**
 * Represents key value pair
 * @param <KEY_TYPE> type of the key
 * @param <VALUE_TYPE> type of the value
 */
public class KeyValue<KEY_TYPE, VALUE_TYPE> {
  private final KEY_TYPE key;
  private final VALUE_TYPE value;

  public KeyValue(KEY_TYPE key, VALUE_TYPE value) {
    this.key = key;
    this.value = value;
  }

  public KEY_TYPE getKey() {
    return key;
  }

  public VALUE_TYPE getValue() {
    return value;
  }
}


text:
const int kCellNumber = 81;
std::string SolveSudoku(const std::string puzzle);

#endif // NETLIB_EXAMPLE_SUDOKU_SUDOKU_H_


text:
'use strict';

const
    bodyParser = require('body-parser'),
    config = require('config'),
    crypto = require('crypto'),
    express = require('express'),
    https = require('https'),
    request = require('request'),
    apiai = require("apiai"),
    mongodb = require("mongodb"),
    _ = require('lodash'),
    async = require('async'),
    infoService = require("./module/infoService"),
    dotenv = require('dotenv'),
    path = require('path'),
    moment = require('moment');

/**
 * Load environment variables from .env file, where API keys and passwords are configured.
 */
dotenv.load({path: '.env'});

var app = express();
app.set('port', process.env.PORT || 5000);
app.use(express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(bodyParser.json({verify: verifyRequestSignature}));

// App Secret can be retrieved from the App Dashboard
const APP_SECRET = (process.env.MESSENGER_APP_SECRET) ?
    process.env.MESSENGER_APP_SECRET :
    config.get('appSecret');

// Arbitrary value used to validate a webhook
const VALIDATION_TOKEN = (process.env.MESSENGER_VALIDATION_TOKEN) ?
    (process.env.MESSENGER_VALIDATION_TOKEN) :
    config.get('validationToken');

// Generate a page access token for your page from the App Dashboard
const PAGE_ACCESS_TOKEN = (process.env.PAGE_ACCESS_TOKEN) ?
    (process.env.PAGE_ACCESS_TOKEN) :
    config.get('pageAccessToken');

// URL where the app is running (include protocol). Used to point to scripts and
// assets located at this address.
const SERVER_URL = (process.env.SERVER_URL) ?
    (process.env.SERVER_URL) :
    config.get('serverURL');

const API_AI_SCCESS_TOKEN = (process.env.API_AI_ACCESS_TOKEN) ?
    (process.env.API_AI_ACCESS_TOKEN) :
    config.get('apiAiAccessToken');

if (!(APP_SECRET && VALIDATION_TOKEN && PAGE_ACCESS_TOKEN && SERVER_URL)) {
    console.error("Missing config values");
    process.exit(1);
}
let chatbot = apiai(API_AI_SCCESS_TOKEN);

let YES_OR_NO = {
        YES: "Ja",
        NO: "Nein"
    }
    ;

let INTENTS_WITH_BUTTONS = [
    "000-start",
    "bonus-no",
    "bonus-yes",
    "km-no",
    "km-yes",
    "recht-yes",
    "recht-no",
    "security-yes",
    "security-no",
    "unfall-yes",
    "unfall-no",
    "vollkasko-yes",
    "vollkasko-no"
];

let GREETINGS = [
    "hallo Mona",
    "hallo",
    "Hallo",
    "Hei",
    "Hallo Mona",
    "hallo mona",
    "Hallo mona"
];

app.get('/webhook', function (req, res) {
    if (req.query['hub.mode'] === 'subscribe' &&
        req.query['hub.verify_token'] === VALIDATION_TOKEN) {
        console.log("Validating webhook");
        res.status(200).send(req.query['hub.challenge']);
    } else {
        console.error("Failed validation. Make sure the validation tokens match.");
        res.sendStatus(403);
    }
});

app.post('/webhook', function (req, res) {
    var data = req.body;

    // Make sure this is a page subscription
    if (data.object == 'page') {
        // Iterate over each entry
        // There may be multiple if batched
        data.entry.forEach(function (pageEntry) {
            var pageID = pageEntry.id;
            var timeOfEvent = pageEntry.time;

            // Iterate over each messaging event
            pageEntry.messaging.forEach(function (messagingEvent) {
                if (messagingEvent.optin) {
                    receivedAuthentication(messagingEvent);
                } else if (messagingEvent.message) {
                    receivedMessage(messagingEvent);
                } else if (messagingEvent.delivery) {
                    receivedDeliveryConfirmation(messagingEvent);
                } else if (messagingEvent.postback) {
                    receivedPostback(messagingEvent);
                } else if (messagingEvent.read) {
                    receivedMessageRead(messagingEvent);
                } else if (messagingEvent.account_linking) {
                    receivedAccountLink(messagingEvent);
                } else if (messagingEvent.referral) {
                    receivedReferral(messagingEvent);
                } else {
                    console.log("Webhook received unknown messagingEvent: ", messagingEvent);
                }
            });
        });

        // Assume all went well.
        //
        // You must send back a 200, within 20 seconds, to let us know you've
        // successfully received the callback. Otherwise, the request will time out.
        res.sendStatus(200);
    }
});

function verifyRequestSignature(req, res, buf) {
    var signature = req.headers["x-hub-signature"];

    if (!signature) {
        // For testing, let's log an error. In production, you should throw an
        // error.
        console.error("Couldn't validate the signature.");
    } else {
        var elements = signature.split('=');
        var method = elements[0];
        var signatureHash = elements[1];

        var expectedHash = crypto.createHmac('sha1', APP_SECRET)
            .update(buf)
            .digest('hex');

        if (signatureHash != expectedHash) {
            throw new Error("Couldn't validate the request signature.");
        }
    }
}

function receivedReferral(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;
    var ref = event.referral.ref;

    if (ref === "START_CONVERSATION") {
        /*   async.series([
         function (callback) {
         sendCarMessage(senderID, callback);
         }, function (callback) {
         sendStarterMessage(senderID, " Ich bin Mona und möchte dir noch ein paar Fragen stellen um dir eine massgeschneiderte Versicherung zu deinem Auto anbieten zu können 👩 📝", callback);
         }], function (err) { //This is the final callback
         if (err) return console.log("ERROR OCCUREED______________________________________________" + err);
         console.log('Both a and b are saved now');
         });*/

    }
}

function receivedAuthentication(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;
    var timeOfAuth = event.timestamp;

    // The 'ref' field is set in the 'Send to Messenger' plugin, in the 'data-ref'
    // The developer can set this to an arbitrary value to associate the
    // authentication callback with the 'Send to Messenger' click event. This is
    // a way to do account linking when the user clicks the 'Send to Messenger'
    // plugin.
    var passThroughParam = event.optin.ref;

    console.log("Received authentication for user %d and page %d with pass " +
        "through param '%s' at %d", senderID, recipientID, passThroughParam,
        timeOfAuth);

    // When an authentication is received, we'll send a message back to the sender
    // to let them know it was successful.
    sendTextMessage(senderID, "Authentication successful");
}

function receivedMessage(event) {
    var senderID = event.sender.id;
    // senderID to use user data
    var recipientID = event.recipient.id;
    var timeOfMessage = event.timestamp;
    var message = event.message;

    // db.collection(SENDER_COLLECTION).insertOne({age: 17}, {$set:{name:"Naomi"}}, function(err, doc) {
    //     if (err) {
    //         handleError(res, err.message, "Failed to create new sender.");
    //     } else {
    //         res.status(201).json(doc.ops[0]);
    //     }
    // });

    console.log("Received message for user %d and page %d at %d with message:",
        senderID, recipientID, timeOfMessage);
    console.log(JSON.stringify(message));

    var isEcho = message.is_echo;
    var messageId = message.mid;
    var appId = message.app_id;
    var metadata = message.metadata;

    // You may get a text or attachment but not both
    var messageText = message.text;
    var messageAttachments = message.attachments;
    var quickReply = message.quick_reply;

    if (isEcho) {
        // Just logging message echoes to console
        console.log("Received echo for message %s and app %d with metadata %s",
            messageId, appId, metadata);
        return;
    } else if (quickReply) {
        var quickReplyPayload = quickReply.payload;
        console.log("Quick reply for message %s with payload %s",
            messageId, quickReplyPayload);

        processApiDotAiRequest(quickReply.payload, senderID);
        // if (_.includes(FAVOURITE_DESTINATIONS, quickReply.payload) ||) {
        // } else if (_.includes(FAVOURITE_TIMES, quickReply.payload)) {
        //     processApiDotAiRequest(quickReply.payload, senderID);
        // } else {
        //     sendTextMessage(senderID, "Quick reply tapped");
        // }
        return;
    }

    if (messageText) {

        // If we receive a text message, check to see if it matches any special
        // keywords and send back the corresponding example. Otherwise, just echo
        // the text we received.
        switch (messageText) {
            case 'image':
                sendImageMessage(senderID);
                break;

            case 'gif':
                sendGifMessage(senderID);
                break;

            case 'audio':
                sendAudioMessage(senderID);
                break;

            case 'video':
                sendVideoMessage(senderID);
                break;

            case 'file':
                sendFileMessage(senderID);
                break;
            case 'logout':
                sendLogoutMessage(senderID);
                break;

            case 'receipt':
                sendReceiptMessage(senderID);
                break;
            case 'ticket':
                sendTicket(senderID);
                break;
            case 'quick reply':
                sendQuickReply(senderID);
                break;
            case 'button':
                addButtons(senderID, "test");
                break;
            case 'extension':
                sendExtension(senderID);
                break;
            case 'read receipt':
                sendReadReceipt(senderID);
                break;

            case 'typing on':
                sendTypingOn(senderID);
                break;

            case 'prevention':
                sendPreventionsMessage(senderID);
                break;

            case 'typing off':
                sendTypingOff(senderID);
                break;

            case 'account linking':
                sendAccountLinking(senderID);
                break;

            default:
                if (_.includes(GREETINGS, messageText)) {
                    async.series([
                        function (callback) {
                            sendCarMessage(senderID, callback);
                        }, function (callback) {
                            sendStarterMessage(senderID, " Ich bin Mona und möchte dir noch ein paar Fragen stellen um dir eine massgeschneiderte Versicherung zu deinem Auto anbieten zu können 👩 📝", callback);
                        }], function (err) { //This is the final callback
                        if (err) return console.log("error occured" + err);
                        console.log('async series completed');
                    });
                } else {

                    processApiDotAiRequest(messageText, senderID);

                }

        }
    } else if (messageAttachments) {
        console.log(messageAttachments);
        if (messageAttachments[0].type === "image") {

        }

    }
}

function processApiDotAiRequest(messageText, senderID) {

    var requestBot = chatbot.textRequest(messageText, {sessionId: senderID});
    requestBot.on('response', function (response) {
        console.log("Here you got the answer: ");
        console.log(response);

        let params = response.result.parameters;
        if (response.result.metadata.intentName === "rating") {
            sendRatingSuggestions(senderID, response.result.fulfillment.speech);
        }
        else if (_.includes(INTENTS_WITH_BUTTONS, response.result.metadata.intentName)) {
            let feedback = getFeedbackFromResponse(response.result.fulfillment.speech);
            let questions = getQuestionFromResponse(response.result.fulfillment.speech);
            async.series([
                function (callback) {
                    // call callback when done
                    sendTextMessage(senderID, feedback, callback);
                }, function (callback) {
                    if (_.includes(["km-no", "km-yes"], response.result.metadata.intentName)) {
                        addYesButton(senderID, questions, callback);
                    }
                    else {
                        addButtons(senderID, questions, callback, response.result.metadata.intentName);
                    }
                }], function (err) { //This is the final callback
                if (err) return console.log("error occured" + err);
                console.log('async series completed');
            });
        }
        else if (response.result.metadata.intentName === "offer") {
            addYesButton(senderID);
        }
        else {
            sendTextMessage(senderID, response.result.fulfillment.speech);
        }

    });

    requestBot.on('error', function (error) {
        console.log(error);
    });

    requestBot.end();

}

function sendPreventionsMessage(senderId) {
    async.series([
        function (callback) {
            sendTextMessage(senderId, "Hallo Marc 😃. Der Winter ist nicht mehr weit und wir erwarten nächste Woche Temperaturen unter 7°C ⛄ Hast du die Winterpneus bereits montiert? ", callback);
        },
        function (callback) {
            sendGaragenMessage(senderId, callback);
        }], function (err) { //This is the final callback
        if (err) return console.log("error occured" + err);
        console.log('async series completed');
    });
}

function getFeedbackFromResponse(speech) {

    // split string by %%
    var values = speech.split('%%');
    return values[0];

}

function getQuestionFromResponse(speech) {

    // split string by %%
    var values = speech.split('%%');
    return values[1];

}

function receivedDeliveryConfirmation(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;
    var delivery = event.delivery;
    var messageIDs = delivery.mids;
    var watermark = delivery.watermark;
    var sequenceNumber = delivery.seq;

    if (messageIDs) {
        messageIDs.forEach(function (messageID) {
            console.log("Received delivery confirmation for message ID: %s",
                messageID);
        });
    }

    console.log("All message before %d were delivered.", watermark);
}

function receivedPostback(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;
    var timeOfPostback = event.timestamp;

    // The 'payload' param is a developer-defined field which is set in a postback
    // button for Structured Messages.
    var payload = event.postback.payload;

    if (payload === "START_CONVERSATION") {
        async.series([
            function (callback) {
                sendCarMessage(senderID, callback);
            }, function (callback) {
                sendStarterMessage(senderID, " Ich bin Mona und möchte dir noch ein paar Fragen stellen um dir eine massgeschneiderte Versicherung zu deinem Auto anbieten zu können 👩 📝", callback);
            }], function (err) { //This is the final callback
            if (err) return console.log("error occured" + err);
            console.log('async series completed');
        });
    }
    else if (payload === "START") {
        processApiDotAiRequest("START", senderID);
    }
    else if (payload === "SHOW_OFFER") {
        sendOffer(senderID);
    }
    else if (payload === "CALL_AGENT") {
        sendBeraterMessage(senderID);

    }
    else if (_.includes(YES_OR_NO, payload)) {
        processApiDotAiRequest(payload, senderID);
    }
    else if (_.includes(YES_OR_NO, payload)) {
        processApiDotAiRequest(payload, senderID);
    }
    else {

        console.log("Received postback for user %d and page %d with payload '%s' " +
            "at %d", senderID, recipientID, payload, timeOfPostback);

        // When a postback is called, we'll send a message back to the sender to
        // let them know it was successful
        sendTextMessage(senderID, "Postback called");

    }

}

function receivedMessageRead(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;

    // All messages before watermark (a timestamp) or sequence have been seen.
    var watermark = event.read.watermark;
    var sequenceNumber = event.read.seq;

    console.log("Received message read event for watermark %d and sequence " +
        "number %d", watermark, sequenceNumber);
}

function receivedAccountLink(event) {
    var senderID = event.sender.id;
    var recipientID = event.recipient.id;

    var status = event.account_linking.status;
    var authCode = event.account_linking.authorization_code;

    console.log("Received account link event with for user %d with status %s " +
        "and auth code %s ", senderID, status, authCode);

    if (status === "linked") {
        //TODO LOGIN COMPLETE
    }

}

/*
 * Send an image using the Send API.
 *
 */
function sendImageMessage(recipientId, path, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "image",
                payload: {
                    url: SERVER_URL + path
                }
            }
        }
    };

    callSendAPI(messageData, callback);
}

/*
 * Send a Gif using the Send API.
 *
 */
function sendGifMessage(recipientId) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "image",
                payload: {
                    url: SERVER_URL + "/assets/giphy.gif"
                }
            }
        }
    };

    callSendAPI(messageData);
}

/*
 * Send a video using the Send API.
 *
 */
function sendVideoMessage(recipientId) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "video",
                payload: {
                    url: SERVER_URL + "/assets/allofus480.mov"
                }
            }
        }
    };

    callSendAPI(messageData);
}

/*
 * Send a video using the Send API.
 *
 */
function sendFileMessage(recipientId) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "file",
                payload: {
                    url: SERVER_URL + "/assets/offerte_18_11_2016.pdf"
                }
            }
        }
    };

    callSendAPI(messageData);
}

/*
 * Send a text message using the Send API.
 *
 */
function sendTextMessage(recipientId, messageText, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            text: messageText,
            metadata: "DEVELOPER_DEFINED_METADATA"
        }
    };

    callSendAPI(messageData, callback);
}

function addButtons(recipientId, result, callback, intentName) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: result,
                    buttons: [{
                        type: "postback",
                        title: "Ja",
                        payload: "Ja"
                    }, {
                        type: "postback",
                        title: "Nein",
                        payload: "Nein"
                    },
                        {
                            type: "web_url",
                            url: SERVER_URL + "/info?intentName=" + intentName,
                            title: "Mehr Infos",
                            webview_height_ratio: "tall"
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
}

function sendRatingSuggestions(recipientId, apiAiText) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            text: apiAiText,
            metadata: "DEVELOPER_DEFINED_METADATA",
            quick_replies: [
                {
                    "content_type": "text",
                    "title": "👍",
                    "payload": "THUMB_UP"
                },
                {
                    "content_type": "text",
                    "title": "❤",
                    "payload": "LOVE"
                },
                {
                    "content_type": "text",
                    "title": "😂",
                    "payload": "HAHA"
                },
                {
                    "content_type": "text",
                    "title": "😯",
                    "payload": "WOW"
                },
                {
                    "content_type": "text",
                    "title": "😢",
                    "payload": "SAD"
                },
                {
                    "content_type": "text",
                    "title": "😡",
                    "payload": "ANGRY"
                }

            ]
        }
    };

    callSendAPI(messageData);
}

function addYesButton(recipientId, result, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: result,
                    buttons: [
                        {
                            type: "web_url",
                            url: SERVER_URL + "/offer",
                            title: "Hell yeah! 😊",
                            webview_height_ratio: "full",
                            messenger_extensions: true,
                            fallback_url: SERVER_URL + "/offer"
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
}

function sendBeraterMessage(recipientId, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "generic",
                    elements: [
                        {
                            title: "Dein vertrauter Versicherungsberater:",
                            subtitle: "Urs Meier",
                            image_url: SERVER_URL + "/assets/berater.jpg",
                            buttons: [
                                {
                                    type: "phone_number",
                                    title: "Urs anrufen 📞",
                                    payload: "+15105551234"
                                }, {
                                    type: "postback",
                                    title: "E-Mail senden 📧",
                                    payload: "EMAIL"
                                }

                            ]
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
}

function sendGaragenMessage(recipientId, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "generic",
                    elements: [
                        {
                            title: "Winterpneus montiert?",
                            image_url: SERVER_URL + "/assets/winter.png",
                                buttons: [
        {
                                    type: "postback",
                                    title: "Ja, bereits gemacht",
                                    payload: "PNEU_DONE"
                                }, {
                                    type: "postback",
                                    title: "Nein, Garage finden",
                                    payload: "PNEU_PENDING"
                                }

                            ]
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
}

function sendOffer(recipientId, callback) {

    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "generic",
                    elements: [
                        {
                            title: "Dein massgeschneidertes Angebot",
                            subtitle: "Vollkasko, Unfallversicherung",
                            image_url: SERVER_URL + "/assets/mobi.png",
                            buttons: [
                                {
                                    type: "web_url",
                                    url: SERVER_URL + "/offer",
                                    title: "Anzeigen",
                                    webview_height_ratio: "tall"
                                },
                                {
                                    type: "element_share"
                                }

                            ]
                        }
                    ]
                }
            }
        }
    };
    callSendAPI(messageData, callback);
}

function sendTicket(recipientId, result, callback) {

    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "generic",
                    elements: [
                        {
                            title: "Dein Ticket",
                            subtitle: result.ticket.from + " nach " + result.ticket.to + " 15:30 05.11.2016.",
                            image_url: SERVER_URL + "/assets/qr.png",
                            buttons: [
                                {
                                    type: "web_url",
                                    url: SERVER_URL + "/ticket",
                                    title: "Anzeigen",
                                    webview_height_ratio: "tall"
                                },
                                {
                                    type: "element_share"
                                }

                            ]
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
};

/*
 * Send a message with Quick Reply buttons.
 *
 */
function sendQuickReply(recipientId) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            text: "What's your favorite movie genre?",
            metadata: "DEVELOPER_DEFINED_METADATA",
            quick_replies: [
                {
                    "content_type": "text",
                    "title": "Action",
                    "payload": "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_ACTION"
                },
                {
                    "content_type": "text",
                    "title": "Comedy",
                    "payload": "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_COMEDY"
                },
                {
                    "content_type": "text",
                    "title": "Drama",
                    "payload": "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DRAMA"
                }
            ]
        }
    };

    callSendAPI(messageData);
}

function sendExtension(recipientId) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: "get your ticket?",
                    buttons: [
                        {
                            type: "web_url",
                            url: SERVER_URL + "/ticket",
                            title: "Select Criteria",
                            webview_height_ratio: "full",
                            messenger_extensions: true,
                            fallback_url: SERVER_URL + "/tester"
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData);
}

/*
 * Send a read receipt to indicate the message has been read
 *
 */
function sendReadReceipt(recipientId) {
    console.log("Sending a read receipt to mark message as seen");

    var messageData = {
        recipient: {
            id: recipientId
        },
        sender_action: "mark_seen"
    };

    callSendAPI(messageData);
}

/*
 * Turn typing indicator on
 *
 */
function sendTypingOn(recipientId) {
    console.log("Turning typing indicator on");

    var messageData = {
        recipient: {
            id: recipientId
        },
        sender_action: "typing_on"
    };

    callSendAPI(messageData);
}

/*
 * Turn typing indicator off
 *
 */
function sendTypingOff(recipientId) {
    console.log("Turning typing indicator off");

    var messageData = {
        recipient: {
            id: recipientId
        },
        sender_action: "typing_off"
    };

    callSendAPI(messageData);
}

app.get('/test', function (req, res) {
    console.log("TEST INTERFACE -------------------------------------------------------------");
    infoService.getShopInfos({searchquery: "organic"}, function (result) {
        // Here you have access to your variable

    });
});

app.get('/push', function (req, res) {
    console.log("sending push -----------------------------------------------------");
    async.series([
        function (callback) {
            sendCarMessage(req.query.id, callback);
        }, function (callback) {
            sendStarterMessage(req.query.id, " Ich bin Mona und möchte dir noch ein paar Fragen stellen um dir eine massgeschneiderte Versicherung zu deinem Auto anbieten zu können 👩 📝", callback);
        }], function (err) { //This is the final callback
        if (err) return console.log("error occured" + err);
        console.log('async series completed');
    });

    res.sendStatus(200);
});

app.get('/authorize', function (req, res) {
    var accountLinkingToken = req.query['account_linking_token'];
    var redirectURI = req.query['redirect_uri'];

    // Authorization Code should be generated per user by the developer. This will
    // be passed to the Account Linking callback.
    var authCode = "1234567890";

    // Redirect users to this URI on successful login
    var redirectURISuccess = redirectURI + "&authorization_code=" + authCode;

    res.render('authorize', {
        accountLinkingToken: accountLinkingToken,
        redirectURI: redirectURI,
        redirectURISuccess: redirectURISuccess
    });
});

app.get('/start', function (req, res) {

    res.render('tester');
});

app.get('/ticket', function (req, res) {
    var accountLinkingToken = req.query['from'];
    var redirectURI = req.query['to'];
    var from = "Bern";
    var to = "Wengen";

    res.render('ticket', {
        from: from,
        to: to
    });
});

app.get('/info', function (req, res) {
    res.render('info', {
        intentName: req.query['intentName'],
    });
});

app.get('/offer', function (req, res) {
    res.render('offer', {});
});

app.get('/done', function (req, res) {
    if (req.query.id) {
        if (req.query.type === "ABSCHLUSS") {
            var data = {
                recipient: {
                    id: req.query.id
                },
                message: {
                    text: "Geschafft! 🎉 Wir schicken dir die Unterlagen zu und übermitteln die Daten direkt dem Strassenverkehrsamt. Damit kannst du dein Auto gleich einlösen und losfahren. "
                }
            };

            async.series([
                function (callback) {
                    sendImageMessage(req.query.id, "/assets/trophy.png", callback);
                }, function (callback) {
                    callSendAPI(data, callback);
                }], function (err) { //This is the final callback
                if (err) return console.log("ERROR OCCUREED______________________________________________" + err);
                console.log('ERROR calling series:' + err);
            });

            res.sendStatus(200);
        } else if (req.query.type === "BERATER") {
            sendBeraterMessage(req.query.id);
            res.sendStatus(200);
        } else if (req.query.type === "PDF") {
            sendFileMessage(req.query.id);
            res.sendStatus(200);
        }
    }
    else {
        console.log("---------ID NOT FOUND -----------------");
        res.sendStatus(500);
    }
});

/*
 * Call the Send API. The message data goes in the body. If successful, we'll
 * get the message id in a response
 *
 */
function callSendAPI(messageData, callback) {
    request({
        uri: 'https://graph.facebook.com/v2.6/me/messages',
        qs: {access_token: PAGE_ACCESS_TOKEN},
        method: 'POST',
        json: messageData

    }, function (error, response, body) {
        if (!error && response.statusCode == 200) {
            var recipientId = body.recipient_id;
            var messageId = body.message_id;

            if (messageId) {
                console.log("Successfully sent message with id %s to recipient %s",
                    messageId, recipientId);
                console.log(messageData);
            } else {
                console.log("Successfully called Send API for recipient %s",
                    recipientId);
            }
            if (callback) {
                callback();
            }
        } else {
            console.error(response.error);
            if (callback) {
                callback(response.error);
            }
        }
    });
}

function sendStarterMessage(recipientId, msg, callback) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: msg,
                    buttons: [{
                        type: "postback",
                        title: "Unterhaltung starten",
                        payload: "START"
                    }]
                }
            }
        }
    };
    callSendAPI(messageData, callback);
    console.log("------------------------Sent buttons");
}

function sendCarMessage(recipientId, callback) {

    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            attachment: {
                type: "template",
                payload: {
                    template_type: "generic",
                    elements: [
                        {
                            title: "Hei Marc. Gratuliere zu deinem neuen Golf GTI!.",
                            item_url: "https://www.autoscout24.ch",
                            image_url: SERVER_URL + "/assets/golf.jpg",
                        }
                    ]
                }
            }
        }
    };

    callSendAPI(messageData, callback);
};

// Start server
// Webhooks must be available via SSL with a certificate signed by a valid
// certificate authority.
app.listen(app.get('port'), function () {
    console.log('Node app is running on port', app.get('port'));
});

module.exports = app;


text:
{% extends 'layout.html' %}

{% block title %}{{sitetitle}}{% endblock %}
{% block content %}
    <form id="s" class="form-inline">
        <input type="text" class="form-control search" placeholder="Type Keyword to search entry. ex: npm" />
        <button type="submit" class="btn btn-primary">Search</button>
    </form>

        {% for index, item in items %}

                    {{item.content}}

                     >>

        {% endfor %}

        {% if pre %}
            << Pre
        {% endif %}

        {% if next %}
            Next >>

        {% endif %}
{% endblock %}


text:
A toy chat server spec and some sample implementations,
to help you choose among the many ways to write code to perform concurrent I/O.

## specification

The server is an executable with a single command-line argument indicating an IP address on which to listen.
The server runs forever, accepting and handling TCP connections arriving on that address.

When the server is ready to receive connections, it prints a single line to stdout, of the form
"listening on [address]".

The purpose of the server is to forward messages to all connected clients.
There can be any number of connected clients active at a time.
Each message received from any client should be sent to all clients, including the sender.

A message is a sequence of bytes consisting of a 1-byte header
and a variable-length body. The body's length is equal to the value of the header byte
interpreted as an unsigned 8-bit integer.

Clients must receive messages in an order that is sequentially consistent with
the order that they were sent.

The server is allowed to drop messages -- i.e. to not send them to some senders.
Doing so may be necessary to prevent unbounded buffering in the case where the
server receives messages faster than it can send them out.
However, dropping too many messages may cause the server to receive lower scores in benchmark tests.

## contributing

Implementations live in the [impls](https://github.com/dwrensha/zillions/tree/master/impls)
directory. Please submit a pull request to add your own!

## testing

This repo includes some tools to allow you to test implementations and to compare
their performance.

```
$ cargo build --release
$ cd impls/gjio && cargo build --release && cd ../..
$ ./target/release/stresstest -a 127.0.0.1:55555 ./impls/gjio/target/release/server
```

```
cargo run --release --bin commandline-client
```

## wish list

Our goal is to collect many different implementations of the server spec to
illustrate a wide variety of concurrency styles. Below are listed some
libraries that might be particularly interesting to try.

- Rust
  * raw [mio](https://github.com/carllerche/mio)
  * [amy](https://github.com/andrewjstone/amy)
  * [libfringe](https://github.com/nathan7/libfringe)
  * [mioco](https://github.com/dpc/mioco)
- other languages
  * [curio](https://github.com/dabeaz/curio)
  * C\# [async/await](https://msdn.microsoft.com/en-us/library/mt674882.aspx)
  * Goroutines
  * [libmill](http://libmill.org/)
  * Haskell


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>V2TBSCertListGenerator (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.bouncycastle.asn1.x509

Class V2TBSCertListGenerator

java.lang.Object

org.bouncycastle.asn1.x509.V2TBSCertListGenerator

public class V2TBSCertListGenerator
extends java.lang.Object

Generator for Version 2 TBSCertList structures.

  TBSCertList  ::=  SEQUENCE  {
       version                 Version OPTIONAL,
                                    -- if present, shall be v2
       signature               AlgorithmIdentifier,
       issuer                  Name,
       thisUpdate              Time,
       nextUpdate              Time OPTIONAL,
       revokedCertificates     SEQUENCE OF SEQUENCE  {
            userCertificate         CertificateSerialNumber,
            revocationDate          Time,
            crlEntryExtensions      Extensions OPTIONAL
                                          -- if present, shall be v2
                                 }  OPTIONAL,
       crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
                                          -- if present, shall be v2
                                 }

 Note: This class may be subject to change

Constructor Summary

Constructors

Constructor and Description

V2TBSCertListGenerator()

Method Summary

Methods

Modifier and Type
Method and Description

void
addCRLEntry(ASN1Integer userCertificate,
           ASN1UTCTime revocationDate,
           int reason)

void
addCRLEntry(ASN1Integer userCertificate,
           Time revocationDate,
           Extensions extensions)

void
addCRLEntry(ASN1Integer userCertificate,
           Time revocationDate,
           int reason)

void
addCRLEntry(ASN1Integer userCertificate,
           Time revocationDate,
           int reason,
           ASN1GeneralizedTime invalidityDate)

void
addCRLEntry(ASN1Sequence crlEntry)

TBSCertList
generateTBSCertList()

void
setExtensions(Extensions extensions)

void
setExtensions(X509Extensions extensions)

void
setIssuer(X500Name issuer)

void
setIssuer(X509Name issuer)

Deprecated.

use X500Name method

void
setNextUpdate(ASN1UTCTime nextUpdate)

void
setNextUpdate(Time nextUpdate)

void
setSignature(AlgorithmIdentifier signature)

void
setThisUpdate(ASN1UTCTime thisUpdate)

void
setThisUpdate(Time thisUpdate)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

V2TBSCertListGenerator

public V2TBSCertListGenerator()

Method Detail

setSignature

public void setSignature(AlgorithmIdentifier signature)

setIssuer

public void setIssuer(X509Name issuer)

Deprecated. use X500Name method

setIssuer

public void setIssuer(X500Name issuer)

setThisUpdate

public void setThisUpdate(ASN1UTCTime thisUpdate)

setNextUpdate

public void setNextUpdate(ASN1UTCTime nextUpdate)

setThisUpdate

public void setThisUpdate(Time thisUpdate)

setNextUpdate

public void setNextUpdate(Time nextUpdate)

addCRLEntry

public void addCRLEntry(ASN1Sequence crlEntry)

addCRLEntry

public void addCRLEntry(ASN1Integer userCertificate,
               ASN1UTCTime revocationDate,
               int reason)

addCRLEntry

public void addCRLEntry(ASN1Integer userCertificate,
               Time revocationDate,
               int reason)

addCRLEntry

public void addCRLEntry(ASN1Integer userCertificate,
               Time revocationDate,
               int reason,
               ASN1GeneralizedTime invalidityDate)

addCRLEntry

public void addCRLEntry(ASN1Integer userCertificate,
               Time revocationDate,
               Extensions extensions)

setExtensions

public void setExtensions(X509Extensions extensions)

setExtensions

public void setExtensions(Extensions extensions)

generateTBSCertList

public TBSCertList generateTBSCertList()

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
namespace notifier {

// static
ChromeNotifierService* ChromeNotifierServiceFactory::GetForProfile(
    Profile* profile, Profile::ServiceAccessType service_access_type) {
  return static_cast<ChromeNotifierService*>(
      GetInstance()->GetServiceForBrowserContext(profile, true));
}

// static
ChromeNotifierServiceFactory* ChromeNotifierServiceFactory::GetInstance() {
  return Singleton<ChromeNotifierServiceFactory>::get();
}

// static
bool ChromeNotifierServiceFactory::UseSyncedNotifications(
    CommandLine* command_line) {
  if (command_line->HasSwitch(switches::kDisableSyncSyncedNotifications))
    return false;
  if (command_line->HasSwitch(switches::kEnableSyncSyncedNotifications))
    return true;

  // enable it by default for canary and dev
  chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
  if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN ||
      channel == chrome::VersionInfo::CHANNEL_DEV ||
      channel == chrome::VersionInfo::CHANNEL_CANARY)
    return true;

  return false;
}

ChromeNotifierServiceFactory::ChromeNotifierServiceFactory()
    : BrowserContextKeyedServiceFactory(
          "ChromeNotifierService",
          BrowserContextDependencyManager::GetInstance()) {
  // Mark this service as depending on the SyncedNotificationAppInfoService.
  // Marking it provides a guarantee that the other service will alwasys be
  // running whenever the ChromeNotifierServiceFactory is.
  DependsOn(SyncedNotificationAppInfoServiceFactory::GetInstance());
}

ChromeNotifierServiceFactory::~ChromeNotifierServiceFactory() {
}

KeyedService* ChromeNotifierServiceFactory::BuildServiceInstanceFor(
    content::BrowserContext* profile) const {
  NotificationUIManager* notification_manager =
      g_browser_process->notification_ui_manager();
  ChromeNotifierService* chrome_notifier_service =
      new ChromeNotifierService(static_cast<Profile*>(profile),
                                notification_manager);
  return chrome_notifier_service;
}

}  // namespace notifier


text:
package org.owgis.model;

/**
 * This class contains static properties of the paths of the proyect. For example
 * it contains the path where the images of the proyect are stored.
 * @author Olmo Zavala Romero
 */
public class Globals {

    //JS
    public static String JS_PATH = "/common/JS/";
    //images
    public static String IMG_PATH="/common/images/";
    //CSS
    public static String CSS_PATH="/common/CSS/";
    //fLASH
    public static String FL_PATH="common/flash/";
    //Pages path
    public static String PAGES_PATH="/Pages/";

	public String getImagesPath(){
		return IMG_PATH;
	}

}


text:
import HTMLParser
import json
import logging
import urllib2
import urlparse

class _HRefParser(HTMLParser.HTMLParser):
  def __init__(self):
    HTMLParser.HTMLParser.__init__(self)
    self.hrefs = []

  def handle_starttag(self, tag, attrs):
    if tag == "a":
      for name, value in attrs:
        if name == "href":
          self.hrefs.append(value)

def _AbsoluteUrlHasSaneScheme(absolute_url):
  if len(absolute_url) < 4:
    return False
  return absolute_url[0:4] == 'http'

def GenerateSafeUrls():
  """Prints a list of safe urls.

  Generates a safe list of urls from a seed list. Each href in the HTML
  fetched from the url from the seed list is placed into the safe list. The
  safe list contains unsanitized urls.
  """
  # A list of websites whose hrefs are unlikely to link to sites that contain
  # malware.
  seed_urls = [
    "http://www.cnn.com",
    "https://www.youtube.com",
    "https://www.facebook.com",
    "https://www.twitter.com",
    "https://www.yahoo.com",
    "https://www.amazon.com",
    "https://www.wikipedia.com",
    "https://www.bing.com",
    "https://www.dailymotion.com",
    "https://www.stackoverflow.com",
    "https://www.google.com/#q=dumpling",
    "http://www.baidu.com/s?wd=rice",
    "http://www.baidu.com/s?wd=cow",
    "https://www.google.com/#q=fox",
    "http://www.yahoo.co.jp/",
    "http://www.yandex.ru/",
    "https://www.imdb.com/",
    "http://www.huffingtonpost.com/",
    "https://www.deviantart.com/",
    "http://www.wsj.com/",
  ]

  safe_urls = set()

  for url in seed_urls:
    try:
      # Fetch and parse the HTML.
      response = urllib2.urlopen(url)
      encoding = response.headers.getparam('charset')
      html = response.read()
      if encoding:
        html = html.decode(encoding)

      parser = _HRefParser()
      parser.feed(html)
    except:
      logging.exception("Error fetching or parsing url: %s", url)
      raise

    # Looks for all hrefs.
    for relative_url in parser.hrefs:
      if not relative_url:
        continue

      absolute_url = urlparse.urljoin(url, relative_url)
      if not _AbsoluteUrlHasSaneScheme(absolute_url):
        continue
      safe_urls.add(absolute_url)

  # Sort the urls, to make them easier to view in bulk.
  safe_urls_list = list(safe_urls)
  safe_urls_list.sort()

  print json.dumps(safe_urls_list, indent=2, separators=(",", ":"))

if __name__ == "__main__":
  GenerateSafeUrls()


text:
START_ATF_NAMESPACE
    typedef _PORT_INFO_3A *PPORT_INFO_3;
END_ATF_NAMESPACE


text:
// Copyright (c) 2013-2016, niXman (i dotty nixman doggy gmail dotty com)
// All rights reserved.
//
// This file is part of YARMI(https://github.com/niXman/yarmi) project.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   Redistributions of source code must retain the above copyright notice, this
//   list of conditions and the following disclaimer.
//
//   Redistributions in binary form must reproduce the above copyright notice, this
//   list of conditions and the following disclaimer in the documentation and/or
//   other materials provided with the distribution.
//
//   Neither the name of the {organization} nor the names of its
//   contributors may be used to endorse or promote products derived from
//   this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "user_context.hpp"
#include "global_context.hpp"

#include <yarmi/invoke.hpp>

#include <boost/filesystem.hpp>

#include <vector>
#include <algorithm>

#include <fstream>
#include <sstream>
#include <iostream>

#include <fnmatch.h>

/***************************************************************************/

struct user_context::impl {
	impl(global_context<user_context> &gc)
		:gc(gc)
		,cwd(gc.root())
	{}

	int fnmatch(const std::string &name) {
		if ( name.empty() ) return 0;
		const int res = ::fnmatch((gc.root() + "/*").c_str(), name.c_str(), 0);
		return (0==res ? 0 : errno);
	}

	global_context<user_context> &gc;
	std::string cwd;
};

/***************************************************************************/

user_context::user_context(const yarmi::socket_ptr &socket, yarmi::server_base &sb, global_context<user_context> &gc)
	:yarmi::session(socket, sb)
	,yarmi::server_side<user_context>(*this, *this)
	,pimpl(new impl(gc))
{}

user_context::~user_context()
{ delete pimpl; }

/***************************************************************************/

void user_context::on_connected() {}
void user_context::on_disconnected() {}

/***************************************************************************/

void user_context::on_received(const yarmi::call_id_type call_id, const yarmi::buffer_pair &buffer) {
	YARMI_TRY(invoke_flag) {
		if ( !yarmi::invoke(call_id, buffer, *this) ) {
			std::cerr << "no handler for call_id=" << call_id << std::endl;
		}
	} YARMI_CATCH_LOG(invoke_flag, std::cerr)
}

/***************************************************************************/

void user_context::on_pwd() {
	pwd(0, "", pimpl->cwd);
}

void user_context::on_mkdir(const std::string &name) {
	int ec = pimpl->fnmatch(name);
	std::cout << "on_mkdir(): cwd=\"" << pimpl->cwd << "\", name=\"" << name << "\", ec=" << ec << std::endl;
	if ( ec ) {
		const std::string em = ::strerror(ec);
		mkdir(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
	} else {
		boost::system::error_code ec;
		boost::filesystem::create_directories(pimpl->cwd + "/" + name, ec);
		if ( ec ) {
			mkdir(ec.value(), ec.message(), ""); // >>>>>>>>>>>>>>>>>>>
		} else {
			mkdir(0, "", ""); // >>>>>>>>>>>>>>>>>>>
		}
	}
}

void user_context::on_touch(const std::string &name) {
	int ec = pimpl->fnmatch(name);
	std::cout << "on_touch(): cwd=\"" << pimpl->cwd << "\", name=\"" << name << "\", ec=" << ec << std::endl;
	if ( ec ) {
		const std::string em = ::strerror(ec);
		touch(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
	} else {
		std::ofstream file(pimpl->cwd + "/" + name);
		if ( !file ) {
			const int error = errno;
			const std::string em = ::strerror(error);
			touch(error, em, ""); // >>>>>>>>>>>>>>>>>>>
		} else {
			touch(0, "", ""); // >>>>>>>>>>>>>>>>>>>
		}
	}
}

void user_context::on_rm(const std::string &name) {
	int ec = pimpl->fnmatch(name);
	std::cout << "on_rm(): cwd=\"" << pimpl->cwd << "\", name=\"" << name << "\", ec=" << ec << std::endl;
	if ( ec ) {
		const std::string em = ::strerror(ec);
		rm(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
	} else {
		boost::system::error_code ec;
		if ( !boost::filesystem::exists(pimpl->cwd + "/" + name, ec) ) {
			rm(ec.value(), ec.message(), ""); // >>>>>>>>>>>>>>>>>>>
		} else {
			boost::system::error_code ec;
			boost::filesystem::remove(pimpl->cwd + "/" + name, ec);
			rm(ec.value(), ec.message(), ""); // >>>>>>>>>>>>>>>>>>>
		}
	}
}

void user_context::on_ls(const std::string &name) {
	int ec = pimpl->fnmatch(name);
	std::cout << "on_ls(): cwd=\"" << pimpl->cwd << "\", name=\"" << name << "\", ec=" << ec << std::endl;
	if ( ec ) {
		const std::string em = ::strerror(ec);
		ls(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
	} else {
		std::ostringstream os;
		std::vector<boost::filesystem::path> vec(
			 (boost::filesystem::directory_iterator((name.empty() ? pimpl->cwd : pimpl->cwd + "/" + name)))
			,(boost::filesystem::directory_iterator())
		);
		const std::size_t max = std::max_element(vec.begin(), vec.end()
			,[](const boost::filesystem::path &l, const boost::filesystem::path &r) {
				return l.string().length() < r.string().length();
			}
		)->string().length();

		auto cur = vec.begin(), end = vec.end();
		for ( ; cur != end; ++cur ) {
			boost::system::error_code ec;
			std::size_t size = 0;
			const bool isdir = boost::filesystem::is_directory(*cur, ec);
			if ( ec ) throw ec;
			const bool isfile = boost::filesystem::is_regular_file(*cur, ec);
			if ( ec ) throw ec;
			if ( isfile ) {
				size = boost::filesystem::file_size(*cur, ec);
				if ( ec ) throw ec;
			}

			os
			<< cur->string()
			<< std::string((max+1) - cur->string().length(), ' ')
			<< "| " << (isdir ? "d" : "f") << " | "
			<< (isfile ? std::to_string(size) : "---")
			<< std::endl;
		}

		ls(0, "", os.str()); // >>>>>>>>>>>>>>>>>>>
	}
}

void user_context::on_cd(const std::string &name) {
	int ec = pimpl->fnmatch(name);
	std::cout << "on_cd(): cwd=\"" << pimpl->cwd << "\", name=\"" << name << "\", ec=" << ec << std::endl;
	if ( ec ) {
		const std::string em = ::strerror(ec);
		cd(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
	} else {
		boost::system::error_code ec;
		if ( -1 == ::chdir((pimpl->cwd + "/" + name).c_str()) ) {
			const int ec = errno;
			const std::string em = ::strerror(ec);
			cd(ec, em, ""); // >>>>>>>>>>>>>>>>>>>
		} else {
			pimpl->cwd = boost::filesystem::current_path(ec).string();
			cd(ec.value(), ec.message(), "");
		}
	}
}

/***************************************************************************/


text:
@interface LJOnlineServiceViewController : LJBaseViewController

@end