text:
// Copyright Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using HoloToolkit.Unity;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.WSA.Input;

namespace GalaxyExplorer
{
    public class HandInput : SingleInstance<HandInput>
    {
        public struct HandState
        {
            public bool valid;
            public uint id;
            public bool isTappingDown;
            public float tapPressedStartTime;
            public Vector3 latestTapStartPosition;
            public Vector3 latestObservedPosition;
        }

        private HandState[] handStates = new HandState[2];

        private enum QueuedActionType
        {
            HandEnter,
            HandExit,
            HandMoved,
            TapPressed,
            TapReleased
        }

        private struct QueuedAction
        {
            public QueuedActionType actionType;
            public uint id;
            public Vector3 position;
            public float timestamp;
        }

        private Queue<QueuedAction> actionQueue = new Queue<QueuedAction>();

        public bool HandsInFOV
        {
            get
            {
                for (int i = 0; i < handStates.Length; ++i)
                {
                    if (handStates[i].valid)
                    {
                        return true;
                    }
                }

                return false;
            }
        }

        public event System.Action<bool> HandInFOVChanged;

        protected void Awake()
        {
            if (MyAppPlatformManager.Platform != MyAppPlatformManager.PlatformId.HoloLens)
            {
                DestroyObject(this);
                return;
            }
            // Start out with a clean state by resetting both hand structures.
            for (int i = 0; i < handStates.Length; ++i)
            {
                UnregisterHandByIndex(i);
            }
        }

        private bool eventsAreRegistered = false;

        private void TryToRegisterEvents()
        {
            if (!eventsAreRegistered)
            {
                InteractionManager.InteractionSourceDetected += OtherThread_OnInteractionSourceDetected;
                InteractionManager.InteractionSourceUpdated += OtherThread_OnInteractionSourceUpdated;
                InteractionManager.InteractionSourceLost += OtherThread_OnInteractionSourceLost;
                InteractionManager.InteractionSourcePressed += OtherThread_InteractionSourcePressed;
                InteractionManager.InteractionSourceReleased += OtherThread_InteractionSourceReleased;
                eventsAreRegistered = true;
            }
        }

        private void TryToUnregisterEvents()
        {
            if (eventsAreRegistered)
            {
                InteractionManager.InteractionSourceDetected -= OtherThread_OnInteractionSourceDetected;
                InteractionManager.InteractionSourceUpdated -= OtherThread_OnInteractionSourceUpdated;
                InteractionManager.InteractionSourceLost -= OtherThread_OnInteractionSourceLost;
                InteractionManager.InteractionSourcePressed -= OtherThread_InteractionSourcePressed;
                InteractionManager.InteractionSourceReleased -= OtherThread_InteractionSourceReleased;
                eventsAreRegistered = false;
            }
        }

        private void Start()
        {
            if (PlayerInputManager.Instance == null)
            {
                Debug.LogWarning("No active PlayerInputManager found. Not all HandInput functionality will be available.");
            }

            TryToRegisterEvents();
        }

        protected override void OnDestroy()
        {
            TryToUnregisterEvents();

            // Reset active state for both hands.
            for (int i = 0; i < handStates.Length; ++i)
            {
                UnregisterHandByIndex(i);
            }
            base.OnDestroy();
        }

        private void OnEnable()
        {
            TryToRegisterEvents();
        }

        private void OnDisable()
        {
            TryToUnregisterEvents();
        }

        private void Update()
        {
            lock (actionQueue)
            {
                while (actionQueue.Count > 0)
                {
                    QueuedAction queuedAction = actionQueue.Dequeue();

                    switch (queuedAction.actionType)
                    {
                        case QueuedActionType.HandEnter:
                            OnHandEnter(queuedAction.id, queuedAction.position);
                            break;

                        case QueuedActionType.HandExit:
                            OnHandExit(queuedAction.id, queuedAction.position);
                            break;

                        case QueuedActionType.HandMoved:
                            OnHandMoved(queuedAction.id, queuedAction.position, queuedAction.timestamp);
                            break;

                        case QueuedActionType.TapPressed:
                            OnHandTapPressed(queuedAction.id, queuedAction.position);
                            break;

                        case QueuedActionType.TapReleased:
                            OnHandTapReleased(queuedAction.id, queuedAction.position);
                            break;
                    }
                }
            }
        }

        private bool GetHandState(int index, ref HandState handState)
        {
            if (index >= 0 && index < handStates.Length)
            {
                handState = handStates[index];
                return true;
            }

            return false;
        }

        private void OnHandEnter(uint id, Vector3 position)
        {
            if (HandInFOVChanged != null && !HandsInFOV)
            {
                HandInFOVChanged(true);
            }

            RegisterHand(id, position);
        }

        private void OnHandExit(uint id, Vector3 position)
        {
            int index = RegisterHand(id, position);
            if (index != -1)
            {
                if (handStates[index].isTappingDown && PlayerInputManager.Instance != null)
                {
                    PlayerInputManager.Instance.TriggerTapRelease();
                }
            }

            UnregisterHandById(id);

            if (HandInFOVChanged != null && !HandsInFOV)
            {
                HandInFOVChanged(false);
            }
        }

        private void OnHandMoved(uint id, Vector3 position, float timestamp)
        {
            RegisterHand(id, position);
        }

        private void OnHandTapPressed(uint id, Vector3 position)
        {
            int index = RegisterHand(id, position);
            if (index != -1)
            {
                handStates[index].isTappingDown = true;
                handStates[index].tapPressedStartTime = Time.time;
                handStates[index].latestTapStartPosition = position;

                if (PlayerInputManager.Instance != null)
                {
                    PlayerInputManager.Instance.TriggerTapPress();
                }
            }
            else
            {
                Debug.Log("HandInput.OnHandTapPressed() - RegisterHand() failed!");
            }
        }

        private void OnHandTapReleased(uint id, Vector3 position)
        {
            int index = RegisterHand(id, position);
            if (index != -1)
            {
                if (handStates[index].isTappingDown)
                {
                    handStates[index].isTappingDown = false;

                    if (PlayerInputManager.Instance != null)
                    {
                        PlayerInputManager.Instance.TriggerTapRelease();
                    }
                }
            }
            else
            {
                Debug.Log("HandInput.OnHandTapReleased() - RegisterHand() failed!");
            }
        }

        // Hand State utilities
        #region Hand Registration
        private int RegisterHand(uint id, Vector3 position)
        {
            int handIndex = GetRegisteredHandIndex(id);

            if (handIndex != -1)
            {
                // Item already exists.  Update its properties.
                handStates[handIndex].latestObservedPosition = position;
            }
            else
            {
                // New item.  Find the first available slot and add it.
                for (int i = 0; i < handStates.Length; ++i)
                {
                    if (!handStates[i].valid)
                    {
                        handStates[i].valid = true;
                        handStates[i].id = id;
                        handStates[i].isTappingDown = false;
                        handStates[i].tapPressedStartTime = 0.0f;
                        handStates[i].latestTapStartPosition = Vector3.zero;
                        handStates[i].latestObservedPosition = position;

                        handIndex = i;

                        break;
                    }
                }

                if (handIndex == -1)
                {
                    Debug.LogError("HandInput failed to find open slot for id " + id + " (existing ids: " + handStates[0].id + " and " + handStates[1].id + ")");
                }
            }

            return handIndex;
        }

        private void UnregisterHandById(uint id)
        {
            for (int i = 0; i < handStates.Length; ++i)
            {
                if (handStates[i].id == id)
                {
                    UnregisterHandByIndex(i);
                    break;
                }
            }
        }

        private void UnregisterHandByIndex(int index)
        {
            if (index >= 0 && index < handStates.Length)
            {
                handStates[index].valid = false;
                handStates[index].id = uint.MaxValue;
                handStates[index].isTappingDown = false;
                handStates[index].latestTapStartPosition = Vector3.zero;
                handStates[index].latestObservedPosition = Vector3.zero;
            }
        }

        private int GetRegisteredHandIndex(uint id)
        {
            int index = -1;

            for (int i = 0; i < handStates.Length; ++i)
            {
                if (handStates[i].valid && handStates[i].id == id)
                {
                    index = i;
                    break;
                }
            }

            return index;
        }

        #endregion

        #region OtherThread

        // IMPORTANT
        // Everything below this point is executed on a separate thread.  For thread safety,
        // the only code these functions should execute is pushing a task into a synchronized
        // queue for later analysis on the main thread.
        private void OtherThread_OnInteractionSourceDetected(InteractionSourceDetectedEventArgs args)
        {
            Vector3 handPosition;

            if (args.state.source.kind == InteractionSourceKind.Hand && args.state.sourcePose.TryGetPosition(out handPosition))
            {
                Vector3 position = Camera.main.transform.rotation * handPosition;

                QueuedAction newAction = new QueuedAction { actionType = QueuedActionType.HandEnter, id = args.state.source.id, position = position, timestamp = Time.time };

                lock (actionQueue)
                {
                    actionQueue.Enqueue(newAction);
                }
            }
        }

        private void OtherThread_OnInteractionSourceUpdated(InteractionSourceUpdatedEventArgs args)
        {
            Vector3 handPosition;

            if (args.state.source.kind == InteractionSourceKind.Hand && args.state.sourcePose.TryGetPosition(out handPosition))
            {
                Vector3 position = Camera.main.transform.rotation * handPosition;
                QueuedAction newAction = new QueuedAction { actionType = QueuedActionType.HandMoved, id = args.state.source.id, position = position, timestamp = Time.time };

                lock (actionQueue)
                {
                    actionQueue.Enqueue(newAction);
                }
            }
        }

        private void OtherThread_OnInteractionSourceLost(InteractionSourceLostEventArgs args)
        {
            Vector3 handPosition;

            if (args.state.source.kind == InteractionSourceKind.Hand && args.state.sourcePose.TryGetPosition(out handPosition))
            {
                Vector3 position = Camera.main.transform.rotation * handPosition;
                QueuedAction newAction = new QueuedAction { actionType = QueuedActionType.HandExit, id = args.state.source.id, position = position, timestamp = Time.time };

                lock (actionQueue)
                {
                    actionQueue.Enqueue(newAction);
                }
            }
        }

        private void OtherThread_InteractionSourcePressed(InteractionSourcePressedEventArgs args)
        {
            Vector3 handPosition;

            if (args.state.source.kind == InteractionSourceKind.Hand && args.state.sourcePose.TryGetPosition(out handPosition))
            {
                QueuedAction newAction = new QueuedAction { actionType = QueuedActionType.TapPressed, id = args.state.source.id, position = handPosition, timestamp = Time.time };

                lock (actionQueue)
                {
                    actionQueue.Enqueue(newAction);
                }
            }
        }

        private void OtherThread_InteractionSourceReleased(InteractionSourceReleasedEventArgs args)
        {
            Vector3 handPosition;

            if (args.state.source.kind == InteractionSourceKind.Hand && args.state.sourcePose.TryGetPosition(out handPosition))
            {
                QueuedAction newAction = new QueuedAction { actionType = QueuedActionType.TapReleased, id = args.state.source.id, position = handPosition, timestamp = Time.time };

                lock (actionQueue)
                {
                    actionQueue.Enqueue(newAction);
                }
            }
        }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/myWindowBackground"
    android:gravity="center_horizontal"
    android:orientation="vertical" >

<include layout="@layout/menu"/>

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

		<Button
            android:id="@+id/button_contexto"
            style="@style/bt_customizado3"
            android:gravity="center_vertical"
            android:layout_width="match_parent"
			android:drawableLeft="@drawable/ic_back2"
            android:layout_height="wrap_content"
            android:text="" />
		</LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="10dp" >

        <TextView
            android:id="@+id/tv_contexto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/myGrayColor"
            android:gravity="center_horizontal|center_vertical"
            android:text="Novo Projeto"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@android:color/white" />

         <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal" >

                        <ImageView
                            android:id="@+id/ic_salvar"
                            android:layout_width="55dp"
                            android:layout_height="55dp"
                            android:src="@drawable/ic_salvar"
                            android:layout_weight="1"
                            style="@style/bt_imagem"/>

                         <ImageView
                        android:id="@+id/ic_excluir"
                        style="@style/bt_imagem"
                        android:layout_width="55dp"
                        android:layout_height="55dp"
                        android:layout_weight="1"
                        android:src="@drawable/ic_excluir"
                        android:visibility="gone"/>

                </LinearLayout>

        <TextView
            android:id="@+id/tv_nome"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="5dp"
            android:visibility="gone"
            android:text="Nome:"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/myGrayColor" />

        <EditText
            android:id="@+id/proj_nome"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/apptheme_textfield_default_holo_light"
            android:hint="Nome"
            android:inputType="textCapSentences" />

        <TextView
            android:id="@+id/tv_prazo"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="5dp"
             android:visibility="gone"
            android:text="Prazo:"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/myGrayColor" />

        <EditText
            android:id="@+id/proj_prazo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/apptheme_textfield_default_holo_light"
            android:hint="Prazo (dd/mm/yyyy)"
            android:inputType="date" />

        <TextView
            android:id="@+id/tv_list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="5dp"
            android:text="Selecione os Membros que farão parte do Projeto:"
            android:textColor="@color/myGrayColor" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

</LinearLayout>

redpajama_set_name: RedPajamaGithub


text:
using UnityEditor;
using UnityEngine;
using System.IO;
using System;

namespace Halodi.Models.Editor
{
    internal class ImportModels
    {

        internal static readonly string PackageDirectory = Path.Combine(new String[] { Application.dataPath, "..", "Packages", "halodi-robot-models", "Runtime", "Halodi", "Models" });
        internal static readonly string MainProjectPath = new DirectoryInfo(Application.dataPath).Parent.Parent.FullName;

        [MenuItem("Halodi/Update Halodi Robot Models")] //creates a new menu tab
        internal static void EditPackageConfiguration()
        {
            string MainProjectPath = new DirectoryInfo(Application.dataPath).Parent.Parent.FullName;

            ImportHalodiRobotModels.ImportRobotModels(MainProjectPath, PackageDirectory);
        }

    }
}


text:
Generate yUML diagrams and other stuff from Gherkin Cucumber feature files

Sample output: http://kalapun.com/portfolio/tmp/gherkin/

## Installation

You need `ruby-yuml`, which is currently not published on ruby-gems, so to install it use  `specific_install`

    gem install specific_install
    gem specific_install -l https://github.com/xslim/ruby-yuml.git

Add this line to your application's Gemfile:

    gem 'gherkify', :git => "https://github.com/xslim/gherkify.git"

And then execute:

    $ bundle

Or install it yourself as:

    //$ gem install gherkify
    gem specific_install -l https://github.com/xslim/gherkify.git

## Usage

Usage: `gherkify path_to_features -d output_directory`

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
package se.cygni.snake.api.event;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import se.cygni.snake.api.GameMessage;
import se.cygni.snake.api.model.GameSettings;
import se.cygni.snake.api.type.GameMessageType;

@GameMessageType
public class GameStartingEvent extends GameMessage {

    private final String gameId;
    private final int noofPlayers;
    private final int width;
    private final int height;
    private final GameSettings gameSettings;

    @JsonCreator
    public GameStartingEvent(
            @JsonProperty("gameId") String gameId,
            @JsonProperty("noofPlayers") int noofPlayers,
            @JsonProperty("width") int width,
            @JsonProperty("height") int gameHeight,
            @JsonProperty("gameSettings") GameSettings gameSettings) {

        this.gameId = gameId;
        this.noofPlayers = noofPlayers;
        this.width = width;
        this.height = gameHeight;
        this.gameSettings = gameSettings;
    }

    public GameStartingEvent(GameStartingEvent gse) {
        this.gameId = gse.getGameId();
        this.noofPlayers = gse.getNoofPlayers();
        this.width = gse.getWidth();
        this.height = gse.getHeight();
        this.gameSettings = gse.gameSettings;
    }

    public String getGameId() {
        return gameId;
    }

    public int getNoofPlayers() {
        return noofPlayers;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public GameSettings getGameSettings() {
        return gameSettings;
    }

    @Override
    public String toString() {
        return "GameStartingEvent{" +
                "gameId='" + gameId + '\'' +
                ", noofPlayers=" + noofPlayers +
                ", width=" + width +
                ", height=" + height +
                '}';
    }
}


text:
[![Build Status](https://travis-ci.org/facebook/KVOController.png?branch=master)](https://travis-ci.org/facebook/KVOController)
[![Version](https://cocoapod-badges.herokuapp.com/v/KVOController/badge.png)](http://cocoadocs.org/docsets/KVOController)
[![Platform](https://cocoapod-badges.herokuapp.com/p/KVOController/badge.png)](http://cocoadocs.org/docsets/KVOController)

Key-value observing is a particularly useful technique for communicating between layers in a Model-View-Controller application. KVOController builds on Cocoa's time-tested key-value observing implementation. It offers a simple, modern API, that is also thread safe. Benefits include:

- Notification using blocks, custom actions, or NSKeyValueObserving callback.
- No exceptions on observer removal.
- Implicit observer removal on controller dealloc.
- Thread-safety with special guards against observer resurrection – [rdar://15985376](http://openradar.appspot.com/radar?id=5305010728468480).

For more information on KVO, see Apple's [Introduction to Key-Value Observing](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html).

## Usage

Example apps for iOS and OS X are included with the project. Here is one simple usage pattern:

```objective-c
// create KVO controller with observer
FBKVOController *KVOController = [FBKVOController controllerWithObserver:self];

// observe clock date property
[KVOController observe:clock keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew block:^(ClockView *clockView, Clock *clock, NSDictionary *change) {

  // update clock view with new value
  clockView.date = change[NSKeyValueChangeNewKey];
}];
```

While simple, the above example is complete. A clock view creates a KVO controller to observe the clock date property. A block callback is used to handle initial and change notification. Unobservation happens implicitly on controller deallocation.

To automatically remove observers on observer dealloc, add a strong reference between observer and KVO controller.

```objective-c
// Observer with KVO controller instance variable
@implementation ClockView
{
  FBKVOController *_KVOController;
}

- (id)init
{
  ...
  // create KVO controller with observer
  FBKVOController *KVOController = [FBKVOController controllerWithObserver:self];

  // add strong reference from observer to KVO controller
  _KVOController = KVOController;

```
Note: the observer specified must support weak references. The zeroing weak reference guards against notification of a deallocated observer instance.

## Prerequisites

KVOController takes advantage of recent Objective-C runtime advances, including ARC and weak collections. It requires:

- iOS 6 or later.
- OS X 10.7 or later.

## Installation

To install using CocoaPods, add the following to your project Podfile:

```ruby
pod 'KVOController'
```

Alternatively, drag and drop FBKVOController.h and FBKVOController.m into your Xcode project, agreeing to copy files if needed. For iOS applications, you can choose to link against the static library target of the KVOController project.

Having installed using CocoaPods, add the following to import in Objective-C:
```objective-c
#import <KVOController/FBKVOController.h>
```

## Testing

The unit tests included use CocoaPods for managing dependencies. Install CocoaPods if you haven't already done so. Then, at the command line, navigate to the root KVOController directory and type:

```sh
pod install
```

This will install and add test dependencies on OCHamcrest and OCMockito. Re-open the Xcode KVOController workspace and Test, ⌘U.

## Licence

KVOController is released under a BSD License. See LICENSE file for details.


text:
using System;
using System.Diagnostics;
using System.Web;

namespace Pour.Client.Library
{
    internal static class Utility
    {
        internal const string OdataTypeKeySuffix = "@odata.type";

        internal const string OdataTypeValuePrefix = "Edm.";

        internal const string JsonDataFormat = "\"{0}{1}\": \"Edm.{2}\", \"{0}\": \"{3}\"";

        internal const string JsonDataFormatWithoutType = "\"{0}\": \"{1}\"";

        internal const string PartitionKey = "PartitionKey";

        internal const string RowKey = "RowKey";

        internal const string Separator = ",";

        internal enum Level
        {
            Critical = 0,
            Error = 1,
            Warning = 2,
            Info = 3,
            Verbose = 4
        }

        internal static string GetContextName(string name)
        {
            return name?.Replace(" ", string.Empty) ?? string.Empty;
        }

        internal static string GetJsonRepresentation(string name, object value)
        {
            name.RequireNonEmpty("name");
            return string.Format(JsonDataFormat, name, OdataTypeKeySuffix, value.GetType().Name, value);
        }

        internal static string GetJsonRepresentation(string name, string value)
        {
            name.RequireNonEmpty("name");
            string escapedString = HttpUtility.JavaScriptStringEncode(value);
            return string.Format(JsonDataFormatWithoutType, name, escapedString);
        }

        internal static string GetJsonRepresentation(string name, DateTime value)
        {
            name.RequireNonEmpty("name");
            return string.Format(JsonDataFormat, name, OdataTypeKeySuffix, value.GetType().Name, value.ToString("O"));
        }

        internal static string Join(params string[] values)
        {
            return string.Join(Separator, values);
        }

        internal static string GetPartitionKey(string rowKey)
        {
            return rowKey.Substring(0, 5);
        }

        internal static string GetJsonWithoutType(string key, string value)
        {
            return string.Format(JsonDataFormatWithoutType, key, value);
        }

        internal static void RequireNotNull(this object value, string name, string message = "")
        {
            if (value == null)
            {
                throw new ArgumentNullException(string.Format("{0} is null. {1}", name, message));
            }
        }

        internal static void RequireNonEmpty(this string value, string name, string message = "")
        {
            value.RequireNotNull(name);

            if (string.IsNullOrEmpty(value))
            {
                throw new ArgumentException(string.Format("{0} is empty. {1}", name, message));
            }

            if (string.IsNullOrWhiteSpace(value))
            {
                throw new ArgumentException(string.Format("{0} is white space. {1}", name, message));
            }
        }

        internal static void Output(string message, params object[] args)
        {
            string formattedMessage;

            try
            {
                formattedMessage = string.Format(message, args);
            }
            catch (Exception e)
            {
                Output("Message formatting is failed for message {0}. Exception: {1}", message, e.Message);
                formattedMessage = message;
            }

            OutputToDebug(formattedMessage);
            OutputToTrace(formattedMessage);
        }

        [Conditional("DEBUG")]
        private static void OutputToDebug(string message)
        {
            Debug.WriteLine(message);
        }

        [Conditional("TRACE")]
        private static void OutputToTrace(string message)
        {
            Trace.WriteLine(message);
        }
    }
}


text:
//*******************************************************************************************//
//                                                                                //
// Download Free Evaluation Version From: https://bytescout.com/download/web-installer       //
//                                                                                //
// Also available as Web API! Get Your Free API Key: https://app.pdf.co/signup               //
//                                                                                //
// Copyright © 2017-2020 ByteScout, Inc. All rights reserved.                                //
// https://www.bytescout.com                                                                 //
// https://pdf.co                                                                            //
//                                                                                //
//*******************************************************************************************//

#include "stdafx.h"

//
// This example demonstrates how to provide password for protected PDF files.
//

using namespace System;
using Bytescout::PDFExtractor::DocumentMerger;

// `PasswordRequired` event handler
void OnPasswordRequired(System::Object ^sender, System::String ^document, System::String ^%password);

int main(array<System::String ^> ^args)
{
	String^ input1(".\\encrypted1 (password is 'password').pdf");
	String^ input2(".\\encrypted2 (password is 'password').pdf");
	String^ output(".\\result.pdf");

	// Create DocumentMerger instance
	DocumentMerger^ merger = gcnew DocumentMerger("demo", "demo");

	// Handle `PasswordRequired` event
	merger->PasswordRequired += gcnew Bytescout::PDFExtractor::PasswordEventHandler(&OnPasswordRequired);

	// Ignore document permissions
	merger->CheckPermissions = false;

	// Merge documents
	array<String^>^ files = gcnew array<String^>(2) { input1, input2 };
	merger->Merge(files, output);

	delete merger;

	// Open the output document in default associated application (for demonstration)
	Diagnostics::Process::Start(output);

    return 0;
}

// `PasswordRequired` event handler
void OnPasswordRequired(System::Object ^sender, System::String ^document, System::String ^%password)
{
	// Ask user for password and put it to `Password` property.
	password = "password";
}


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateAdsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ads', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users');
            $table->integer('adstatus_id')->unsigned()->index();
            $table->foreign('adstatus_id')->references('id')->on('adstatuses');
            $table->integer('adtype_id')->unsigned()->index();
            $table->foreign('adtype_id')->references('id')->on('adtypes');
            $table->integer('category_id')->unsigned()->index();
            $table->foreign('category_id')->references('id')->on('categories');
            $table->bigInteger('views')->default(0);
            $table->timestamp('expired_at')->nullable();
            $table->timestamp('published_at')->nullable();
            $table->timestamp('cached_at')->useCurrent();
            $table->nullableTimestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('ads');
    }
}


text:
/**
 * Module dependencies.
 */

var debug = require('debug')('wpcom:me');

/**
 * Create a `Me` instance
 *
 * @param {WPCOM} wpcom
 * @api public
 */

function Me(wpcom) {
  if (!(this instanceof Me)) {
    return new Me(wpcom);
  }

  this.wpcom = wpcom;
}

/**
 * Meta data about auth token's User
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

Me.prototype.get = function (query, fn) {
  return this.wpcom.req.get('/me', query, fn);
};

/**
 * A list of the current user's sites
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api private
 */

Me.prototype.sites = function (query, fn) {
  return this.wpcom.req.get('/me/sites', query, fn);
};

/**
 * List the currently authorized user's likes
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

Me.prototype.likes = function (query, fn) {
  return this.wpcom.req.get('/me/likes', query, fn);
};

/**
 * A list of the current user's group
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

Me.prototype.groups = function (query, fn) {
  return this.wpcom.req.get('/me/groups', query, fn);
};

/**
 * A list of the current user's connections to third-party services
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

Me.prototype.connections = function (query, fn) {
  return this.wpcom.req.get('/me/connections', query, fn);
};

/**
 * Expose `Me` module
 */

module.exports = Me;


text:
//===========================================================================//
// Copyright (C) Microsoft Corporation. All rights reserved.                 //
//===========================================================================//

#pragma once

#ifndef TGAWND_H
#define TGAWND_H

//----------------------------------------------------------------------------
//
// TGaWnd.h - window that displays a targa with a given window name
//
// FASA Interactive Technologies
//
// Copyright (c) 1998 FASA Interactive Technologies
//
//---------------------------------------------------------------------------

class TGAWnd : public CStatic
{
	// Construction
public:
	TGAWnd(void);
	void SetTGAFileName(const CString& str);
	void SetTGAFileData(uint8_t* data, int32_t size);

	const std::wstring_view& GetImageData() { return m_pImage; }

	//{{AFX_VIRTUAL(TGAWnd)
	//}}AFX_VIRTUAL

public:
	virtual ~TGAWnd(void);

protected:
	//{{AFX_MSG(TGAWnd)
	afx_msg void OnPaint(void);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

	CString m_FileName;
	bool m_bTGAChanged;
	const std::wstring_view& m_pImage;
	BITMAPINFO* m_pBmi;
	HBITMAP m_hBitmap;
	PVOID m_pBits;
	CDC* m_pMemDC;
	CPalette* m_Palette;
	HBITMAP m_hSplashBitMap;
	bool bThisIsInitialized;
};

/**************************************************************************************************
CLASS DESCRIPTION
TACMapTGA:
**************************************************************************************************/
class TacMapTGA : public TGAWnd
{
public:
	afx_msg void OnPaint(void);
	void refreshBmp(void);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}

#endif // TGAWND_H


text:
      recursive
     *subroutine hybrd(fcn,n,x,fvec,xtol,maxfev,ml,mu,epsfcn,diag,
     *                 mode,factor,nprint,info,nfev,fjac,ldfjac,r,lr,
     *                 qtf,wa1,wa2,wa3,wa4)
      integer n,maxfev,ml,mu,mode,nprint,info,nfev,ldfjac,lr
      double precision xtol,epsfcn,factor
      double precision x(n),fvec(n),diag(n),fjac(ldfjac,n),r(lr),
     *                 qtf(n),wa1(n),wa2(n),wa3(n),wa4(n)
      external fcn
c     **********
c
c     subroutine hybrd
c
c     the purpose of hybrd is to find a zero of a system of
c     n nonlinear functions in n variables by a modification
c     of the powell hybrid method. the user must provide a
c     subroutine which calculates the functions. the jacobian is
c     then calculated by a forward-difference approximation.
c
c     the subroutine statement is
c
c       subroutine hybrd(fcn,n,x,fvec,xtol,maxfev,ml,mu,epsfcn,
c                        diag,mode,factor,nprint,info,nfev,fjac,
c                        ldfjac,r,lr,qtf,wa1,wa2,wa3,wa4)
c
c     where
c
c       fcn is the name of the user-supplied subroutine which
c         calculates the functions. fcn must be declared
c         in an external statement in the user calling
c         program, and should be written as follows.
c
c         subroutine fcn(n,x,fvec,iflag)
c         integer n,iflag
c         double precision x(n),fvec(n)
c         ----------
c         calculate the functions at x and
c         return this vector in fvec.
c         ---------
c         return
c         end
c
c         the value of iflag should not be changed by fcn unless
c         the user wants to terminate execution of hybrd.
c         in this case set iflag to a negative integer.
c
c       n is a positive integer input variable set to the number
c         of functions and variables.
c
c       x is an array of length n. on input x must contain
c         an initial estimate of the solution vector. on output x
c         contains the final estimate of the solution vector.
c
c       fvec is an output array of length n which contains
c         the functions evaluated at the output x.
c
c       xtol is a nonnegative input variable. termination
c         occurs when the relative error between two consecutive
c         iterates is at most xtol.
c
c       maxfev is a positive integer input variable. termination
c         occurs when the number of calls to fcn is at least maxfev
c         by the end of an iteration.
c
c       ml is a nonnegative integer input variable which specifies
c         the number of subdiagonals within the band of the
c         jacobian matrix. if the jacobian is not banded, set
c         ml to at least n - 1.
c
c       mu is a nonnegative integer input variable which specifies
c         the number of superdiagonals within the band of the
c         jacobian matrix. if the jacobian is not banded, set
c         mu to at least n - 1.
c
c       epsfcn is an input variable used in determining a suitable
c         step length for the forward-difference approximation. this
c         approximation assumes that the relative errors in the
c         functions are of the order of epsfcn. if epsfcn is less
c         than the machine precision, it is assumed that the relative
c         errors in the functions are of the order of the machine
c         precision.
c
c       diag is an array of length n. if mode = 1 (see
c         below), diag is internally set. if mode = 2, diag
c         must contain positive entries that serve as
c         multiplicative scale factors for the variables.
c
c       mode is an integer input variable. if mode = 1, the
c         variables will be scaled internally. if mode = 2,
c         the scaling is specified by the input diag. other
c         values of mode are equivalent to mode = 1.
c
c       factor is a positive input variable used in determining the
c         initial step bound. this bound is set to the product of
c         factor and the euclidean norm of diag*x if nonzero, or else
c         to factor itself. in most cases factor should lie in the
c         interval (.1,100.). 100. is a generally recommended value.
c
c       nprint is an integer input variable that enables controlled
c         printing of iterates if it is positive. in this case,
c         fcn is called with iflag = 0 at the beginning of the first
c         iteration and every nprint iterations thereafter and
c         immediately prior to return, with x and fvec available
c         for printing. if nprint is not positive, no special calls
c         of fcn with iflag = 0 are made.
c
c       info is an integer output variable. if the user has
c         terminated execution, info is set to the (negative)
c         value of iflag. see description of fcn. otherwise,
c         info is set as follows.
c
c         info = 0   improper input parameters.
c
c         info = 1   relative error between two consecutive iterates
c                    is at most xtol.
c
c         info = 2   number of calls to fcn has reached or exceeded
c                    maxfev.
c
c         info = 3   xtol is too small. no further improvement in
c                    the approximate solution x is possible.
c
c         info = 4   iteration is not making good progress, as
c                    measured by the improvement from the last
c                    five jacobian evaluations.
c
c         info = 5   iteration is not making good progress, as
c                    measured by the improvement from the last
c                    ten iterations.
c
c       nfev is an integer output variable set to the number of
c         calls to fcn.
c
c       fjac is an output n by n array which contains the
c         orthogonal matrix q produced by the qr factorization
c         of the final approximate jacobian.
c
c       ldfjac is a positive integer input variable not less than n
c         which specifies the leading dimension of the array fjac.
c
c       r is an output array of length lr which contains the
c         upper triangular matrix produced by the qr factorization
c         of the final approximate jacobian, stored rowwise.
c
c       lr is a positive integer input variable not less than
c         (n*(n+1))/2.
c
c       qtf is an output array of length n which contains
c         the vector (q transpose)*fvec.
c
c       wa1, wa2, wa3, and wa4 are work arrays of length n.
c
c     subprograms called
c
c       user-supplied ...... fcn
c
c       minpack-supplied ... dogleg,dpmpar,enorm,fdjac1,
c                            qform,qrfac,r1mpyq,r1updt
c
c       fortran-supplied ... dabs,dmax1,dmin1,min0,mod
c
c     argonne national laboratory. minpack project. march 1980.
c     burton s. garbow, kenneth e. hillstrom, jorge j. more
c
c     **********
      integer i,iflag,iter,j,jm1,l,msum,ncfail,ncsuc,nslow1,nslow2
      integer iwa(1)
      logical jeval,sing
      double precision actred,delta,epsmch,fnorm,fnorm1,one,pnorm,
     *                 prered,p1,p5,p001,p0001,ratio,sum,temp,xnorm,
     *                 zero
      double precision dpmpar,enorm
      data one,p1,p5,p001,p0001,zero
     *     /1.0d0,1.0d-1,5.0d-1,1.0d-3,1.0d-4,0.0d0/
c
c     epsmch is the machine precision.
c
      epsmch = dpmpar(1)
c
      info = 0
      iflag = 0
      nfev = 0
c
c     check the input parameters for errors.
c
      if (n .le. 0 .or. xtol .lt. zero .or. maxfev .le. 0
     *    .or. ml .lt. 0 .or. mu .lt. 0 .or. factor .le. zero
     *    .or. ldfjac .lt. n .or. lr .lt. (n*(n + 1))/2) go to 300
      if (mode .ne. 2) go to 20
      do 10 j = 1, n
         if (diag(j) .le. zero) go to 300
   10    continue
   20 continue
c
c     evaluate the function at the starting point
c     and calculate its norm.
c
      iflag = 1
      call fcn(n,x,fvec,iflag)
      nfev = 1
      if (iflag .lt. 0) go to 300
      fnorm = enorm(n,fvec)
c
c     determine the number of calls to fcn needed to compute
c     the jacobian matrix.
c
      msum = min0(ml+mu+1,n)
c
c     initialize iteration counter and monitors.
c
      iter = 1
      ncsuc = 0
      ncfail = 0
      nslow1 = 0
      nslow2 = 0
c
c     beginning of the outer loop.
c
   30 continue
         jeval = .true.
c
c        calculate the jacobian matrix.
c
         iflag = 2
         call fdjac1(fcn,n,x,fvec,fjac,ldfjac,iflag,ml,mu,epsfcn,wa1,
     *               wa2)
         nfev = nfev + msum
         if (iflag .lt. 0) go to 300
c
c        compute the qr factorization of the jacobian.
c
         call qrfac(n,n,fjac,ldfjac,.false.,iwa,1,wa1,wa2,wa3)
c
c        on the first iteration and if mode is 1, scale according
c        to the norms of the columns of the initial jacobian.
c
         if (iter .ne. 1) go to 70
         if (mode .eq. 2) go to 50
         do 40 j = 1, n
            diag(j) = wa2(j)
            if (wa2(j) .eq. zero) diag(j) = one
   40       continue
   50    continue
c
c        on the first iteration, calculate the norm of the scaled x
c        and initialize the step bound delta.
c
         do 60 j = 1, n
            wa3(j) = diag(j)*x(j)
   60       continue
         xnorm = enorm(n,wa3)
         delta = factor*xnorm
         if (delta .eq. zero) delta = factor
   70    continue
c
c        form (q transpose)*fvec and store in qtf.
c
         do 80 i = 1, n
            qtf(i) = fvec(i)
   80       continue
         do 120 j = 1, n
            if (fjac(j,j) .eq. zero) go to 110
            sum = zero
            do 90 i = j, n
               sum = sum + fjac(i,j)*qtf(i)
   90          continue
            temp = -sum/fjac(j,j)
            do 100 i = j, n
               qtf(i) = qtf(i) + fjac(i,j)*temp
  100          continue
  110       continue
  120       continue
c
c        copy the triangular factor of the qr factorization into r.
c
         sing = .false.
         do 150 j = 1, n
            l = j
            jm1 = j - 1
            if (jm1 .lt. 1) go to 140
            do 130 i = 1, jm1
               r(l) = fjac(i,j)
               l = l + n - i
  130          continue
  140       continue
            r(l) = wa1(j)
            if (wa1(j) .eq. zero) sing = .true.
  150       continue
c
c        accumulate the orthogonal factor in fjac.
c
         call qform(n,n,fjac,ldfjac,wa1)
c
c        rescale if necessary.
c
         if (mode .eq. 2) go to 170
         do 160 j = 1, n
            diag(j) = dmax1(diag(j),wa2(j))
  160       continue
  170    continue
c
c        beginning of the inner loop.
c
  180    continue
c
c           if requested, call fcn to enable printing of iterates.
c
            if (nprint .le. 0) go to 190
            iflag = 0
            if (mod(iter-1,nprint) .eq. 0) call fcn(n,x,fvec,iflag)
            if (iflag .lt. 0) go to 300
  190       continue
c
c           determine the direction p.
c
            call dogleg(n,r,lr,diag,qtf,delta,wa1,wa2,wa3)
c
c           store the direction p and x + p. calculate the norm of p.
c
            do 200 j = 1, n
               wa1(j) = -wa1(j)
               wa2(j) = x(j) + wa1(j)
               wa3(j) = diag(j)*wa1(j)
  200          continue
            pnorm = enorm(n,wa3)
c
c           on the first iteration, adjust the initial step bound.
c
            if (iter .eq. 1) delta = dmin1(delta,pnorm)
c
c           evaluate the function at x + p and calculate its norm.
c
            iflag = 1
            call fcn(n,wa2,wa4,iflag)
            nfev = nfev + 1
            if (iflag .lt. 0) go to 300
            fnorm1 = enorm(n,wa4)
c
c           compute the scaled actual reduction.
c
            actred = -one
            if (fnorm1 .lt. fnorm) actred = one - (fnorm1/fnorm)**2
c
c           compute the scaled predicted reduction.
c
            l = 1
            do 220 i = 1, n
               sum = zero
               do 210 j = i, n
                  sum = sum + r(l)*wa1(j)
                  l = l + 1
  210             continue
               wa3(i) = qtf(i) + sum
  220          continue
            temp = enorm(n,wa3)
            prered = zero
            if (temp .lt. fnorm) prered = one - (temp/fnorm)**2
c
c           compute the ratio of the actual to the predicted
c           reduction.
c
            ratio = zero
            if (prered .gt. zero) ratio = actred/prered
c
c           update the step bound.
c
            if (ratio .ge. p1) go to 230
               ncsuc = 0
               ncfail = ncfail + 1
               delta = p5*delta
               go to 240
  230       continue
               ncfail = 0
               ncsuc = ncsuc + 1
               if (ratio .ge. p5 .or. ncsuc .gt. 1)
     *            delta = dmax1(delta,pnorm/p5)
               if (dabs(ratio-one) .le. p1) delta = pnorm/p5
  240       continue
c
c           test for successful iteration.
c
            if (ratio .lt. p0001) go to 260
c
c           successful iteration. update x, fvec, and their norms.
c
            do 250 j = 1, n
               x(j) = wa2(j)
               wa2(j) = diag(j)*x(j)
               fvec(j) = wa4(j)
  250          continue
            xnorm = enorm(n,wa2)
            fnorm = fnorm1
            iter = iter + 1
  260       continue
c
c           determine the progress of the iteration.
c
            nslow1 = nslow1 + 1
            if (actred .ge. p001) nslow1 = 0
            if (jeval) nslow2 = nslow2 + 1
            if (actred .ge. p1) nslow2 = 0
c
c           test for convergence.
c
            if (delta .le. xtol*xnorm .or. fnorm .eq. zero) info = 1
            if (info .ne. 0) go to 300
c
c           tests for termination and stringent tolerances.
c
            if (nfev .ge. maxfev) info = 2
            if (p1*dmax1(p1*delta,pnorm) .le. epsmch*xnorm) info = 3
            if (nslow2 .eq. 5) info = 4
            if (nslow1 .eq. 10) info = 5
            if (info .ne. 0) go to 300
c
c           criterion for recalculating jacobian approximation
c           by forward differences.
c
            if (ncfail .eq. 2) go to 290
c
c           calculate the rank one modification to the jacobian
c           and update qtf if necessary.
c
            do 280 j = 1, n
               sum = zero
               do 270 i = 1, n
                  sum = sum + fjac(i,j)*wa4(i)
  270             continue
               wa2(j) = (sum - wa3(j))/pnorm
               wa1(j) = diag(j)*((diag(j)*wa1(j))/pnorm)
               if (ratio .ge. p0001) qtf(j) = sum
  280          continue
c
c           compute the qr factorization of the updated jacobian.
c
            call r1updt(n,n,r,lr,wa1,wa2,wa3,sing)
            call r1mpyq(n,n,fjac,ldfjac,wa2,wa3)
            call r1mpyq(1,n,qtf,1,wa2,wa3)
c
c           end of the inner loop.
c
            jeval = .false.
            go to 180
  290    continue
c
c        end of the outer loop.
c
         go to 30
  300 continue
c
c     termination, either normal or user imposed.
c
      if (iflag .lt. 0) info = iflag
      iflag = 0
      if (nprint .gt. 0) call fcn(n,x,fvec,iflag)
      return
c
c     last card of subroutine hybrd.
c
      end


text:
Generating HTML containing highlighted code with CodeMirror

## Installation

	npm install codemirror-highlight

## Example

```javascript
var assert = require('assert');
var CodeMirror = require('codemirror-highlight');

CodeMirror.loadMode('javascript');
var html = CodeMirror.highlight('1', { mode: 'javascript' });

assert.equal(html, '<span class="cm-number">1</span>');
```

## API

### CodeMirror.loadMode(mode)

* `mode` - a string containing the mode name

Load `mode` shipped with CodeMirror. A list of modes can be found [here](https://github.com/marijnh/CodeMirror/tree/master/mode).

### CodeMirror.highlight(code, options)

* `code` - a string of code to be highlighted
* `options` - an object literal supporting these options:
	* `mode` - the same as the mode `option` you should pass to vanilla CodeMirror
	* `tabSize` - the width of a tab character. Defaults to 4.

Return the HTML containing highlighted code


text: <svg class="fingerboard"></svg>


text:
#ifndef VICE_UITFE_H
#define VICE_UITFE_H

#ifdef HAVE_TFE
extern void ui_tfe_settings_dialog(HWND hwnd);

#endif // #ifdef HAVE_TFE

#endif


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');

require_once($CFG->dirroot . '/backup/cc/entities.class.php');
require_once($CFG->dirroot . '/backup/cc/entity.label.class.php');
require_once($CFG->dirroot . '/backup/cc/entity.resource.class.php');
require_once($CFG->dirroot . '/backup/cc/entity.forum.class.php');
require_once($CFG->dirroot . '/backup/cc/entity.quiz.class.php');

class cc2moodle {

    const CC_TYPE_FORUM              = 'imsdt_xmlv1p0';
    const CC_TYPE_QUIZ               = 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment';
    const CC_TYPE_QUESTION_BANK      = 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank';
    const CC_TYPE_WEBLINK            = 'imswl_xmlv1p0';
    const CC_TYPE_WEBCONTENT         = 'webcontent';
    const CC_TYPE_ASSOCIATED_CONTENT = 'associatedcontent/imscc_xmlv1p0/learning-application-resource';
    const CC_TYPE_EMPTY              = '';

    public static $restypes = array('associatedcontent/imscc_xmlv1p0/learning-application-resource', 'webcontent');
    public static $forumns  = array('dt' => 'http://www.imsglobal.org/xsd/imsdt_v1p0');
    public static $quizns   = array('xmlns' => 'http://www.imsglobal.org/xsd/ims_qtiasiv1p2');
    public static $resourcens = array('wl' => 'http://www.imsglobal.org/xsd/imswl_v1p0');
    /**
     *
     * @return array
     */
    public static function getquizns() {
        return static::$quizns;
    }

    /**
     *
     * @return array
     */
    public static function getforumns() {
        return static::$forumns;
    }

    /**
     *
     * @return array
     */
    public static function getresourcens() {
        return static::$resourcens;
    }

    public static function get_manifest($folder) {
        if (!is_dir($folder)) {
            return false;
        }

        // Before iterate over directories, try to find one manifest at top level
        if (file_exists($folder . '/imsmanifest.xml')) {
            return $folder . '/imsmanifest.xml';
        }

        $result = false;
        try {
            $dirIter = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::KEY_AS_PATHNAME);
            $recIter = new RecursiveIteratorIterator($dirIter, RecursiveIteratorIterator::CHILD_FIRST);
            foreach ($recIter as $info) {
                if ($info->isFile() && ($info->getFilename() == 'imsmanifest.xml')) {
                    $result = $info->getPathname();
                    break;
                }
            }
        } catch (Exception $e) {}

        return $result;
    }

    public static $instances = array();
    public static $manifest;
    public static $path_to_manifest_folder;

    public static $namespaces = array('imscc'    => 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1',
                                      'lomimscc' => 'http://ltsc.ieee.org/xsd/imscc/LOM',
                                      'lom'      => 'http://ltsc.ieee.org/xsd/LOM',
                                      'voc'      => 'http://ltsc.ieee.org/xsd/LOM/vocab',
                                      'xsi'      => 'http://www.w3.org/2001/XMLSchema-instance',
                                      'cc'       => 'http://www.imsglobal.org/xsd/imsccauth_v1p0');

    function __construct ($path_to_manifest) {

        static::$manifest = new DOMDocument();
        static::$manifest->validateOnParse = false;

        static::$path_to_manifest_folder = dirname($path_to_manifest);

        static::log_action('Proccess start');
        static::log_action('Load the manifest file: ' . $path_to_manifest);

        if (!static::$manifest->load($path_to_manifest, LIBXML_NONET)) {
            static::log_action('Cannot load the manifest file: ' . $path_to_manifest, true);
        }
    }

    public function is_auth () {

        $xpath = static::newx_path(static::$manifest, static::$namespaces);

        $count_auth = $xpath->evaluate('count(/imscc:manifest/cc:authorizations)');

        if ($count_auth > 0) {
            $response = true;
        } else {
            $response = false;
        }

        return $response;
    }

    protected function get_metadata ($section, $key) {

        $xpath = static::newx_path(static::$manifest, static::$namespaces);

        $metadata = $xpath->query('/imscc:manifest/imscc:metadata/lomimscc:lom/lomimscc:' . $section . '/lomimscc:' . $key . '/lomimscc:string');
        $value = !empty($metadata->item(0)->nodeValue) ? $metadata->item(0)->nodeValue : '';

        return $value;
    }

    public function generate_moodle_xml () {

        global $CFG;

        $cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files';

        if (!file_exists($cdir)) {
            mkdir($cdir);
        }

        $sheet_base = static::loadsheet(SHEET_BASE);

        // MOODLE_BACKUP / INFO / DETAILS / MOD
        $node_info_details_mod = $this->create_code_info_details_mod();

        // MOODLE_BACKUP / BLOCKS / BLOCK
        $node_course_blocks_block = $this->create_node_course_blocks_block();

        // MOODLE_BACKUP / COURSES / SECTIONS / SECTION
        $node_course_sections_section = $this->create_node_course_sections_section();

        // MOODLE_BACKUP / COURSES / QUESTION_CATEGORIES
        $node_course_question_categories = $this->create_node_question_categories();

        // MOODLE_BACKUP / COURSES / MODULES / MOD
        $node_course_modules_mod = $this->create_node_course_modules_mod();

        // MOODLE_BACKUP / COURSE / HEADER
        $node_course_header = $this->create_node_course_header();

        // GENERAL INFO
        $filename = optional_param('file', 'not_available.zip', PARAM_RAW);
        $filename = basename($filename);

        $www_root = $CFG->wwwroot;

        $find_tags = array('[#zip_filename#]',
                           '[#www_root#]',
                           '[#node_course_header#]',
                           '[#node_info_details_mod#]',
                           '[#node_course_blocks_block#]',
                           '[#node_course_sections_section#]',
                           '[#node_course_question_categories#]',
                           '[#node_course_modules#]');

        $replace_values = array($filename,
                                $www_root,
                                $node_course_header,
                                $node_info_details_mod,
                                $node_course_blocks_block,
                                $node_course_sections_section,
                                $node_course_question_categories,
                                $node_course_modules_mod);

        $result_xml = str_replace($find_tags, $replace_values, $sheet_base);

        // COPY RESOURSE FILES
        $entities = new entities();

        $entities->move_all_files();

        if (array_key_exists("index", self::$instances)) {

            if (!file_put_contents(static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) {
                static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_tmp_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
            } else {
                $status = true;
            }

        } else {
            $status = false;
            notify('The course is empty');
            static::log_action('The course is empty', false);
        }

        return $status;

    }

    protected function get_sections_numbers ($instances) {

        $count = 0;

        if (array_key_exists("index", $instances)) {
            foreach ($instances["index"] as $instance) {
                if ($instance["deep"] == ROOT_DEEP) {
                    $count++;
                }
            }
        }

        return $count;
    }

    protected function create_node_course_header () {

        $node_course_header = '';
        $sheet_course_header = static::loadsheet(SHEET_COURSE_HEADER);

        $course_title = trim($this->get_metadata('general', 'title'));
        $course_title = empty($course_title) ? 'Untitled Course' : $course_title;
        $course_description = $this->get_metadata('general', 'description');
        $section_count = $this->get_sections_numbers(static::$instances) - 1;

        if ($section_count == -1) {
            $section_count = 0;
        }

        if (empty($course_title)) {
            $this->log_action('The course title not found', true);
        }

        $course_short_name = $this->create_course_code($course_title);

        $find_tags = array('[#course_name#]',
                           '[#course_short_name#]',
                           '[#course_description#]',
                           '[#date_now#]',
                           '[#section_count#]');

        $replace_values = array(entities::safexml($course_title),
                                entities::safexml($course_short_name),
                                entities::safexml($course_description),
                                time(),
                                $section_count);

        $node_course_header = str_replace($find_tags, $replace_values, $sheet_course_header);

        return $node_course_header;
    }

    protected function create_node_question_categories () {

        $quiz = new cc_quiz();

        static::log_action('Creating node: QUESTION_CATEGORIES');

        $node_course_question_categories = $quiz->generate_node_question_categories();

        return $node_course_question_categories;
    }

    protected function create_node_course_modules_mod () {

        $labels = new cc_label();
        $resources = new cc_resource();
        $forums = new cc_forum();
        $quiz = new cc_quiz();

        static::log_action('Creating node: COURSE/MODULES/MOD');

        // LABELS
        $node_course_modules_mod_label = $labels->generate_node();

        // RESOURCES (WEB CONTENT AND WEB LINK)
        $node_course_modules_mod_resource = $resources->generate_node();

        // FORUMS
        $node_course_modules_mod_forum = $forums->generate_node();

        // QUIZ
        $node_course_modules_mod_quiz = $quiz->generate_node_course_modules_mod();
        //TODO: label
        $node_course_modules = $node_course_modules_mod_label . $node_course_modules_mod_resource . $node_course_modules_mod_forum . $node_course_modules_mod_quiz;

        return $node_course_modules;
    }

    protected function create_node_course_sections_section () {

        static::log_action('Creating node: COURSE/SECTIONS/SECTION');

        $node_course_sections_section = '';
        $sheet_course_sections_section = static::loadsheet(SHEET_COURSE_SECTIONS_SECTION);

        $topics = $this->get_nodes_by_criteria('deep', ROOT_DEEP);

        $i = 0;

        if (!empty($topics)) {

            foreach ($topics as $topic) {

                $i++;
                $node_node_course_sections_section_mods_mod = $this->create_node_course_sections_section_mods_mod($topic['index']);

                if ($topic['moodle_type'] == MOODLE_TYPE_LABEL) {

                    $find_tags = array('[#section_id#]',
                                       '[#section_number#]',
                                       '[#section_summary#]',
                                       '[#node_course_sections_section_mods_mod#]');

                    $replace_values = array($i,
                                            $i - 1,
                                            $topic['title'],
                                            $node_node_course_sections_section_mods_mod);

                } else {

                    $find_tags = array('[#section_id#]',
                                       '[#section_number#]',
                                       '[#section_summary#]',
                                       '[#node_course_sections_section_mods_mod#]');

                    $replace_values = array($i,
                                            $i - 1,
                                            '',
                                            $node_node_course_sections_section_mods_mod);

                }

                $node_course_sections_section .= str_replace($find_tags, $replace_values, $sheet_course_sections_section);
            }
        }

        return $node_course_sections_section;
    }

    protected function create_node_course_blocks_block () {

        global $CFG;

        static::log_action('Creating node: COURSE/BLOCKS/BLOCK');

        $sheet_course_blocks_block = static::loadsheet(SHEET_COURSE_BLOCKS_BLOCK);
        $node_course_blocks_block = '';

        $format_config = $CFG->dirroot . '/course/format/weeks/config.php';

        if (@is_file($format_config) && is_readable($format_config)) {
            require ($format_config);
        }

        if (!empty($format['defaultblocks'])) {
            $blocknames = $format['defaultblocks'];
        } else {
            if (!empty($CFG->defaultblocks)) {
                $blocknames = $CFG->defaultblocks;
            } else {
                $blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
            }
        }

        $blocknames = explode(':', $blocknames);
        $blocks_left = explode(',', $blocknames[0]);
        $blocks_right = explode(',', $blocknames[1]);

        $find_tags = array('[#block_id#]',
                           '[#block_name#]',
                           '[#block_position#]',
                           '[#block_weight#]');

        $i = 0;
        $weight = 0;

        foreach ($blocks_left as $block) {
            $i++;
            $weight++;

            $replace_values = array($i,
                                    $block,
                                    'l',
                                    $weight);

            $node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block);
        }

        $weight = 0;

        foreach ($blocks_right as $block) {

            $i++;
            $weight ++;

            $replace_values = array($i,
                                    $block,
                                    'r',
                                    $weight);

            $node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block);
        }

        return $node_course_blocks_block;

    }

    /**
    *
    * Is activity visible or not
    * @param string $identifier
    * @return number
    */
    protected function get_module_visible($identifier) {
        //Should item be hidden or not
        $mod_visible = 1;
        if (!empty($identifier)) {
            $xpath = static::newx_path(static::$manifest, static::$namespaces);
            $query  = '/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]';
            $query .= '//lom:intendedEndUserRole/voc:vocabulary/lom:value';
            $intendeduserrole = $xpath->query($query);
            if (!empty($intendeduserrole) && ($intendeduserrole->length > 0)) {
                $role = trim($intendeduserrole->item(0)->nodeValue);
                if (strcasecmp('Instructor', $role) == 0) {
                    $mod_visible = 0;
                }
            }
        }
        return $mod_visible;
    }

    protected function create_node_course_sections_section_mods_mod ($root_parent) {

        $sheet_course_sections_section_mods_mod = static::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD);
        $childs = $this->get_nodes_by_criteria('root_parent', $root_parent);

        if ($childs) {

            $node_course_sections_section_mods_mod = '';

            foreach ($childs as $child) {

                if ($child['moodle_type'] == MOODLE_TYPE_LABEL) {
                    if ($child['index'] == $child['root_parent']) {
                        $is_summary = true;
                    } else {
                        $is_summary = false;
                    }
                } else {
                    $is_summary = false;
                }

                if (!$is_summary) {

                    $indent = $child['deep'] - ROOT_DEEP;

                    if ($indent > 0) {
                        $indent = $indent - 1;
                    }

                    $find_tags = array('[#mod_id#]',
                                       '[#mod_instance_id#]',
                                       '[#mod_type#]',
                                       '[#date_now#]',
                                       '[#mod_indent#]',
                                       '[#mod_visible#]');

                    $replace_values = array($child['index'],
                                            $child['instance'],
                                            $child['moodle_type'],
                                            time(),
                                            $indent,
                                            $this->get_module_visible($child['resource_indentifier']));

                    $node_course_sections_section_mods_mod .= str_replace($find_tags, $replace_values, $sheet_course_sections_section_mods_mod);
                }
            }

            $response = $node_course_sections_section_mods_mod;

        } else {
            $response = '';
        }

        return $response;

    }

    public function get_nodes_by_criteria ($key, $value) {

        $response = array();

        if (array_key_exists('index', static::$instances)) {
            foreach (static::$instances['index'] as $item) {
                if ($item[$key] == $value) {
                    $response[] = $item;
                }
            }
        }

        return $response;
    }

    //Modified here
    protected function create_code_info_details_mod () {

        static::log_action('Creating node: INFO/DETAILS/MOD');

        $xpath = static::newx_path(static::$manifest, static::$namespaces);

        $items = $xpath->query('/imscc:manifest/imscc:organizations/imscc:organization/imscc:item | /imscc:manifest/imscc:resources/imscc:resource[@type="' . static::CC_TYPE_QUESTION_BANK . '"]');

        $this->create_instances($items);

        $count_quiz = $this->count_instances(MOODLE_TYPE_QUIZ);
        $count_forum = $this->count_instances(MOODLE_TYPE_FORUM);
        $count_resource = $this->count_instances(MOODLE_TYPE_RESOURCE);
        $count_label = $this->count_instances(MOODLE_TYPE_LABEL);

        $sheet_info_details_mod_instances_instance = static::loadsheet(SHEET_INFO_DETAILS_MOD_INSTANCE);

        if ($count_resource > 0) {
            $resource_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_resource, static::$instances['instances'][MOODLE_TYPE_RESOURCE]);
        }
        if ($count_quiz > 0) {
            $quiz_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_quiz, static::$instances['instances'][MOODLE_TYPE_QUIZ]);
        }
        if ($count_forum > 0) {
            $forum_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_forum, static::$instances['instances'][MOODLE_TYPE_FORUM]);
        }
        if ($count_label > 0) {
            $label_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_label, static::$instances['instances'][MOODLE_TYPE_LABEL]);
        }

        $resource_mod = $count_resource ? $this->create_mod_info_details_mod(MOODLE_TYPE_RESOURCE, $resource_instance) : '';
        $quiz_mod = $count_quiz ? $this->create_mod_info_details_mod(MOODLE_TYPE_QUIZ, $quiz_instance) : '';
        $forum_mod = $count_forum ? $this->create_mod_info_details_mod(MOODLE_TYPE_FORUM, $forum_instance) : '';
        $label_mod = $count_label ? $this->create_mod_info_details_mod(MOODLE_TYPE_LABEL, $label_instance) : '';

        //TODO: label
        return $label_mod . $resource_mod . $quiz_mod . $forum_mod;

    }

    protected function create_mod_info_details_mod ($mod_type, $node_info_details_mod_instances_instance) {

        $sheet_info_details_mod = static::loadsheet(SHEET_INFO_DETAILS_MOD);

        $find_tags = array('[#mod_type#]' ,'[#node_info_details_mod_instances_instance#]');
        $replace_values = array($mod_type , $node_info_details_mod_instances_instance);

        return str_replace($find_tags, $replace_values, $sheet_info_details_mod);
    }

    protected function create_mod_info_details_mod_instances_instance ($sheet, $instances_quantity, $instances) {

        $instance = '';

        $find_tags = array('[#mod_instance_id#]',
                           '[#mod_name#]',
                           '[#mod_user_info#]');

        for ($i = 1; $i <= $instances_quantity; $i++) {

            $user_info = ($instances[$i - 1]['common_cartriedge_type'] == static::CC_TYPE_FORUM) ? 'true' : 'false';
            if ($instances[$i - 1]['common_cartriedge_type'] == static::CC_TYPE_EMPTY) {
                if ($instances[$i - 1]['deep'] <= ROOT_DEEP ) {
                    continue;
                }
            }

            $replace_values = array($instances[$i - 1]['instance'],
                                    entities::safexml($instances[$i - 1]['title']),
                                    $user_info);

            $instance .= str_replace($find_tags, $replace_values, $sheet);
        }

        return $instance;

    }

    protected function create_instances ($items, $level = 0, &$array_index = 0, $index_root = 0) {

        $level++;
        $i = 1;

        if ($items) {

            $xpath = self::newx_path(static::$manifest, static::$namespaces);

            foreach ($items as $item) {

                $array_index++;

                if ($item->nodeName == "item")  {
                    $identifierref = '';
                    if ($item->hasAttribute('identifierref')) {
                      $identifierref = $item->getAttribute('identifierref');
                    }

                    $title = '';
                    $titles = $xpath->query('imscc:title', $item);
                    if ($titles->length > 0) {
                        $title = $titles->item(0)->nodeValue;
                    }

                    $cc_type = $this->get_item_cc_type($identifierref);
                    $moodle_type = $this->convert_to_moodle_type($cc_type);
                    //Fix the label issue - MDL-33523
                    if (empty($identifierref) && empty($title)) {
                      $moodle_type = TYPE_UNKNOWN;
                    }
                }
                elseif ($item->nodeName == "resource")  {

                    $identifierref = $xpath->query('@identifier', $item);
                    $identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : '';

                    $cc_type = $this->get_item_cc_type($identifierref);
                    $moodle_type = $this->convert_to_moodle_type($cc_type);

                    $title = 'Quiz Bank ' . ($this->count_instances($moodle_type) + 1);

                }

                if ($level == ROOT_DEEP) {
                    $index_root = $array_index;
                }

                static::$instances['index'][$array_index]['common_cartriedge_type'] = $cc_type;
                static::$instances['index'][$array_index]['moodle_type'] = $moodle_type;
                static::$instances['index'][$array_index]['title'] = $title ? $title : '';
                static::$instances['index'][$array_index]['root_parent'] = $index_root;
                static::$instances['index'][$array_index]['index'] = $array_index;
                static::$instances['index'][$array_index]['deep'] = $level;
                static::$instances['index'][$array_index]['instance'] = $this->count_instances($moodle_type);
                static::$instances['index'][$array_index]['resource_indentifier'] = $identifierref;

                static::$instances['instances'][$moodle_type][] = array('title' => $title,
                                                                        'instance' => static::$instances['index'][$array_index]['instance'],
                                                                        'common_cartriedge_type' => $cc_type,
                                                                        'resource_indentifier' => $identifierref,
                                                                        'deep' => $level);

                $more_items = $xpath->query('imscc:item', $item);

                if ($more_items->length > 0) {
                    $this->create_instances($more_items, $level, $array_index, $index_root);
                }

                $i++;

            }
        }
    }

    public function count_instances ($type) {

        $quantity = 0;

        if (array_key_exists('index', static::$instances)) {
            if (static::$instances['index'] && $type) {

                foreach (static::$instances['index'] as $instance) {
                    if (!empty($instance['moodle_type'])) {
                        $types[] = $instance['moodle_type'];
                    }
                }

                $quantity_instances = array_count_values($types);
                $quantity = array_key_exists($type, $quantity_instances) ? $quantity_instances[$type] : 0;
            }
        }

        return $quantity;
    }

    public function convert_to_moodle_type ($cc_type) {
        $type = TYPE_UNKNOWN;

        if ($cc_type == static::CC_TYPE_FORUM) {
            $type = MOODLE_TYPE_FORUM;
        }

        if ($cc_type == static::CC_TYPE_QUIZ) {
            $type = MOODLE_TYPE_QUIZ;
        }

        if ($cc_type == static::CC_TYPE_WEBLINK) {
            $type = MOODLE_TYPE_RESOURCE;
        }

        if ($cc_type == static::CC_TYPE_WEBCONTENT) {
            $type = MOODLE_TYPE_RESOURCE;
        }

        if ($cc_type == static::CC_TYPE_ASSOCIATED_CONTENT) {
            $type = MOODLE_TYPE_RESOURCE;
        }

        if ($cc_type == static::CC_TYPE_QUESTION_BANK) {
            $type = MOODLE_TYPE_QUESTION_BANK;
        }
        //TODO: label
        if ($cc_type == static::CC_TYPE_EMPTY) {
            $type = MOODLE_TYPE_LABEL;
        }

        return $type;
    }

    public function get_item_cc_type ($identifier) {

        $xpath = static::newx_path(static::$manifest, static::$namespaces);

        $nodes = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]/@type');

        if ($nodes && !empty($nodes->item(0)->nodeValue)) {
            return $nodes->item(0)->nodeValue;
        } else {
            return '';
        }
    }

    public static function newx_path (DOMDocument $manifest, $namespaces = '') {

        $xpath = new DOMXPath($manifest);

        if (!empty($namespaces)) {
            foreach ($namespaces as $prefix => $ns) {
                if (!$xpath->registerNamespace($prefix, $ns)) {
                    static::log_action('Cannot register the namespace: ' . $prefix . ':' . $ns, true);
                }
            }
        }

        return $xpath;
    }

    public static function loadsheet ($file) {

        $content = (is_readable($file) && ($content = file_get_contents($file))) ? $content : false;

        static::log_action('Loading sheet: ' . $file);

        if (!$content) {
            static::log_action('Cannot load the xml sheet: ' . $file, true);
        }

        static::log_action('Load OK!');

        return $content;
    }

    public static function log_file() {
        return static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'cc2moodle.log';
    }

    public static function log_action ($text, $critical_error = false) {

        $full_message = strtoupper(date("j/n/Y g:i:s a")) . " - " . $text . "\r";

        file_put_contents(static::log_file(), $full_message, FILE_APPEND);

        if ($critical_error) {
            static::critical_error($text);
        }
    }

    protected function critical_error ($text) {

        $path_to_log = static::log_file();

        echo '

        <p>
        <hr />A critical error has been found!

        <p>' . $text . '</p>

        <p>
        The process has been stopped. Please see the <a href="' . $path_to_log . '">log file</a> for more information.</p>

        <p>Log: ' . $path_to_log . '</p>

        <hr />

        </p>
        ';

        die();
    }

    protected function create_course_code ($title) {
        //Making sure that text of the short name does not go over the DB limit.
        //and leaving the space to add additional characters by the platform
        $code = substr(strtoupper(str_replace(' ', '', trim($title))),0,94);
        return $code;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:color="@color/common_signin_btn_dark_text_pressed" />
    <item
        android:state_enabled="false"
        android:state_focused="true"
        android:color="@color/common_signin_btn_dark_text_disabled" />
    <item
        android:state_focused="true"
        android:color="@color/common_signin_btn_dark_text_focused" />
    <item
        android:state_enabled="false"
        android:color="@color/common_signin_btn_dark_text_disabled" />
    <item
        android:color="@color/common_signin_btn_dark_text_default" />
</selector>
<!-- From: file:/Users/Nish/Source/nishanil-git/googleio/android/build/exploded-bundles/ComGoogleAndroidGmsPlayServices3265.aar/res/color/common_signin_btn_text_dark.xml -->


text:
require 'spec_helper'

describe Api::V1 do
  describe 'sectors listing' do
    it_behaves_like 'Filter Criteria endpoint for', :sectors
  end
end


text:
import React from "react";

import {Provider} from "react-redux";
import { BrowserRouter as Router, Route } from "react-router-dom";

import Store from "./store/AppStore";

// All our components
import Home from "./components/Home";
import WaitForPlayers from "./components/WaitForPlayers";
import GameCenter from "./components/GameCenter";
const App = () => (
  <Provider store={Store}>
  <Router>

      {/*

<link to="/" />Home

<link to="/about" />About

<link to="/topics/1" />Topics

*/}

      <Route exact path="/" component={Home} />
      <Route exact path="/MatchMaking" component={WaitForPlayers} />
      <Route exact path="/Game_Center" component={GameCenter} />

       Made as an experiment to learn React.js, Redux and Firebase by
         Lokesh Inumpudi.
        Source at
         Github

  </Router>
  </Provider>
);

export default App;


text:
package ru0xdc.samsung.ril.multiclient.app;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import java.util.List;

import ru0xdc.samsung.ril.multiclient.app.rilexecutor.DetectResult;
import ru0xdc.ssp.samsumrilmulticlient.app.R;

public class MainActivity extends Activity {
    private static final String TAG = "MainActivity";

    boolean mBound = false;
    MainService mService = null;

    private TextView mCpSwVersion, mFtaSwVersion, mFtaHwVersion, mVersionTextView,
            mBasicInfoTextView, mNeighboursTextView, mCipheringInfoTextView;
    private ProgressBar mProgress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mCpSwVersion = (TextView) findViewById(R.id.cpSwVersion);
        mFtaSwVersion = (TextView) findViewById(R.id.ftaSwVersion);
        mFtaHwVersion = (TextView) findViewById(R.id.ftaHwVersion);
        mVersionTextView = (TextView) findViewById(R.id.versionAll);
        mBasicInfoTextView = (TextView) findViewById(R.id.basic_info);
        mNeighboursTextView = (TextView) findViewById(R.id.neighbours);
        mCipheringInfoTextView = (TextView) findViewById(R.id.ciphering_info);
        mProgress = (ProgressBar) findViewById(R.id.progress);
    }

    @Override
    protected void onStart() {
        super.onStart();
        Intent intent = new Intent(this, MainService.class);
        bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    }

    @Override
    protected void onStop() {
        super.onStop();
        // Unbind from the service
        if (mBound) {
            unbindService(mConnection);
            mBound = false;
        }
    }

    public void runTest(View v) {
        if (!mBound) return;

        TextView errorTextView = (TextView)findViewById(R.id.error);
        DetectResult rilStatus = mService.getRilExecutorStatus();
        if (!rilStatus.available) {
            errorTextView.setText(rilStatus.error);
            errorTextView.setVisibility(View.VISIBLE);
        } else {
            errorTextView.setVisibility(View.GONE);
            new RequestOemInfoTask().execute();
        }
    }

    void updateCipherInfo() {
        final List<String> info = mService.getCipheringInfo();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (info == null) {
                    mCipheringInfoTextView.setText("null");
                } else {
                    mCipheringInfoTextView.setText(TextUtils.join("\n", info));
                }
            }
        });
    }

    void updateMainVersion() {
        final List<String> cpSwVersion = mService.getCpSwVersion();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mCpSwVersion.setText("CP SW version: " + cpSwVersion.get(0)
                                + "\nCompile date: " + cpSwVersion.get(1)
                                + "\nCompile time: " + cpSwVersion.get(2)
                );

                mFtaHwVersion.setText("FTA HW Version: " + mService.getFtaHwVersion());
                mFtaSwVersion.setText("FTA SW Version: " + mService.getFtaSwVersion());
            }
        });
    }

    void updateAllVersion() {
        final List<String> info = mService.getAllVersion();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (info == null) {
                    mVersionTextView.setText("null");
                } else {
                    mVersionTextView.setText(TextUtils.join("\n", info));
                }
            }
        });
    }

    void updateNeighbours() {
        final List<String> info = mService.getNeighbours();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (info == null) {
                    mNeighboursTextView.setText("null");
                } else {
                    mNeighboursTextView.setText(TextUtils.join("\n", info));
                }
            }
        });
    }

    void updateBasicInfo() {
        final List<String> info = mService.getBasicInfo();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (info == null) {
                    mBasicInfoTextView.setText("null");
                } else {
                    mBasicInfoTextView.setText(TextUtils.join("\n", info));
                }
            }
        });
    }

    private ServiceConnection mConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName className,
                                       IBinder service) {
            // We've bound to LocalService, cast the IBinder and get LocalService instance
            MainService.LocalBinder binder = (MainService.LocalBinder) service;
            mService = binder.getService();
            mBound = true;
        }

        @Override
        public void onServiceDisconnected(ComponentName arg0) {
            mService = null;
            mBound = false;
        }
    };

    private class RequestOemInfoTask extends AsyncTask<Void, Integer, Void> {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            mProgress.setMax(5);
            mProgress.setProgress(0);
            findViewById(R.id.button_load).setEnabled(false);
        }

        @Override
        protected Void doInBackground(Void... params) {
            if (!mBound) return null;

            updateMainVersion();
            publishProgress(1);

            updateAllVersion();
            publishProgress(2);

            updateBasicInfo();
            publishProgress(3);

            updateNeighbours();
            publishProgress(4);

            updateCipherInfo();
            publishProgress(5);

            return null;
        }

        protected void onProgressUpdate(Integer... progress) {
            mProgress.setProgress(progress[0]);
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            super.onPostExecute(aVoid);
            mProgress.setProgress(0);
            findViewById(R.id.button_load).setEnabled(true);
        }
    }
}


text:
package eu.ehealth.db.wservices.externalservices;

import java.util.ArrayList;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import eu.ehealth.Globals;
import eu.ehealth.StorageComponentMain;
import eu.ehealth.db.DbStorageComponent;
import eu.ehealth.db.xsd.ExternalService;
import eu.ehealth.db.xsd.OperationResult;
import eu.ehealth.util.NullChecker;

/**
 *
 *
 * @author a572832
 * @date 19/03/2014.
 *
 */
public class CreateExternalService extends DbStorageComponent<OperationResult, Object>
{

	/**
	 *
	 * @param session
	 */
	public CreateExternalService(Session session)
	{
		super(session);
	}

	@Override
	protected OperationResult dbStorageFunction(ArrayList<Object> lo)
	{
		try
		{
			ExternalService data = (ExternalService) lo.get(0);
			String userId = (String) lo.get(1);

			// DEBUG - TRACE
			StorageComponentMain.scLog("DEBUG", "METHOD : CreateExternalService");

			OperationResult res = new OperationResult();

			NullChecker nc = new NullChecker();

			userId = nc.check(userId, String.class);
			data = nc.check(data, ExternalService.class);

			if (!checkUserPermissions("", userId, U_CLINICIAN, U_ADMIN))
			{
				// set OperationResult values
				return Globals.getOpResult(Globals.ResponseCode.PERMISSION_ERROR.getCode(), "");
			}

			try
			{
				_session.beginTransaction();

				eu.ehealth.db.db.ExternalService es = new eu.ehealth.db.db.ExternalService();

				es.setAddress(data.getAddress());
				es.setDescription(data.getDescription());
				es.setType(data.getType());
				_session.save(es);

				_session.getTransaction().commit();

				// set OperationResult values
				res = Globals.getOpResult("" + es.getId().toString(), "");
			}
			catch (HibernateException e)
			{
				rollbackSession();

				StorageComponentMain.logException(e);

				// set OperationResult values
				res = Globals.getOpResult(Globals.ResponseCode.DATABASE_ERROR_1.getCode(), " : " + e.toString());
			}

			return res;
		}
		catch (Exception ex)
		{
			StorageComponentMain.logException(ex);
			// set OperationResult values
			return Globals.getOpResult(Globals.ResponseCode.UNKNOWN_ERROR.getCode(), " : " + ex.toString());
		}
	}

}


text:
(function() {

	var $spoilers = $('[data-spoiler-target]');

	if ($spoilers.isset()) {
		$spoilers.each(function() {
			var $spoiler = $(this);
			var targetId = $spoiler.data('spoiler-target');
			var $target = $('[data-spoiler-id="' + targetId + '"]');
			var animationSpeed = 300;

			$target.hide();

			$spoiler.click(function() {
				$target.slideToggle(animationSpeed);
			});
		});
	}

})();


text:
@interface SXStackViewController : UIViewController

@end


text:
package spec.cuba.web.screens.injection;

import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.HasValue;
import com.haulmont.cuba.gui.components.SplitPanel;
import com.haulmont.cuba.gui.screen.Screen;
import com.haulmont.cuba.gui.screen.Subscribe;

public class ScreenBindSubscribe extends Screen {
    @Subscribe
    private void init(InitEvent event) {

    }

    // private is also supported
    @Subscribe("btn1")
    private void onBtn1Click(Button.ClickEvent event) {

    }

    @Subscribe("textField1")
    private void onValueChange(HasValue.ValueChangeEvent<String> event) {

    }

    @Subscribe("split1")
    private void onSplitChange(SplitPanel.SplitPositionChangeEvent event) {

    }

    @Subscribe("commit")
    protected void onCommit(Action.ActionPerformedEvent event) {

    }
}