text:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <sstream>

#include "dirent.h"
#include <getopt.h>
#include <chrono>
// This is the JSON header
#include "jsoncpp/json/json.h"

#include <mosquittopp.h>

#include "common/utils.h"
#include "common/mqtt_wrapper.h"

#include "sysfs_w1.h"

using namespace std;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::steady_clock;

class TMQTTOnewireHandler : public TMQTTWrapper
{
    //~ typedef pair<TGpioDesc, TSysfsGpio> TChannelDesc;

	public:
        TMQTTOnewireHandler(const TMQTTOnewireHandler::TConfig& mqtt_config);
		~TMQTTOnewireHandler();

		void OnConnect(int rc);
		void OnMessage(const struct mosquitto_message *message);
		void OnSubscribe(int mid, int qos_count, const int *granted_qos);

        inline string GetChannelTopic(const TSysfsOnewireDevice& device);
        void RescanBus();

        void UpdateChannelValues();
        inline void SetPrepareInit(bool b) { PrepareInit = b; }// changing bool PrepareInit
        inline bool GetPrepareInit() { return PrepareInit; }
    private:
        vector<TSysfsOnewireDevice> Channels;
        bool PrepareInit;// needed for cleaning mqtt messages before start working
        string Retained_hack;// we need some message to be sure, that we got all retained messages in starting

};

TMQTTOnewireHandler::TMQTTOnewireHandler(const TMQTTOnewireHandler::TConfig& mqtt_config)
    : TMQTTWrapper(mqtt_config)
    , PrepareInit(true)
{
	Connect();

    Retained_hack = string("/tmp/") + MQTTConfig.Id + "/retained_hack";

}

TMQTTOnewireHandler::~TMQTTOnewireHandler() {}

void TMQTTOnewireHandler::OnConnect(int rc)
{
	printf("Connected with code %d.\n", rc);
	if(rc == 0){
                // Meta
        string path = string("/devices/") + MQTTConfig.Id + "/meta/name";
        Publish(NULL, path, "1-wire Thermometers", 0, true);

        if (PrepareInit){
            string controls = string("/devices/") + MQTTConfig.Id + "/controls/+";
            Subscribe(NULL, controls);
            Subscribe(NULL, Retained_hack);
            Publish(NULL, Retained_hack, "1", 0, false);
         }else{
            RescanBus();
         }
	}
}

template<typename T>
void UnorderedVectorDifference(const vector<T> &first, const vector<T>& second, vector<T> & result)
{
    for (auto & el_first: first) {
        bool found = false;
        for (auto & el_second: second) {
            if (el_first == el_second) {
                found = true;
                break;
            }
        }

        if (!found) {
            result.push_back(el_first);
        }
    }
}

void TMQTTOnewireHandler::RescanBus()
{
    vector<TSysfsOnewireDevice> current_channels;

    DIR *dir;
    struct dirent *ent;
    string entry_name;
    if ((dir = opendir (SysfsOnewireDevicesPath.c_str())) != NULL) {
        /* print all the files and directories within directory */
        while ((ent = readdir (dir)) != NULL) {
            printf ("%s\n", ent->d_name);
            entry_name = ent->d_name;
            if (StringStartsWith(entry_name, "28-") or StringStartsWith(entry_name, "10-")) {
                    current_channels.emplace_back(entry_name);
            }
        }
        closedir (dir);
    } else {
        cerr << "ERROR: could not open directory " << SysfsOnewireDevicesPath << endl;
    }

    vector<TSysfsOnewireDevice> new_channels;
    UnorderedVectorDifference(current_channels, Channels, new_channels);

    vector<TSysfsOnewireDevice> absent_channels;
    UnorderedVectorDifference(Channels, current_channels, absent_channels);

    Channels.swap(current_channels);

    for (const TSysfsOnewireDevice& device: new_channels) {
        Publish(NULL, GetChannelTopic(device) + "/meta/type", "temperature", 0, true);
    }

    //delete retained messages for absent channels
    for (const TSysfsOnewireDevice& device: absent_channels) {
        Publish(NULL, GetChannelTopic(device) + "/meta/type", "", 0, true);
        Publish(NULL, GetChannelTopic(device), "", 0, true);
    }
}

void TMQTTOnewireHandler::OnMessage(const struct mosquitto_message *message)
{
    string topic = message->topic;
    string controls_prefix = string("/devices/") + MQTTConfig.Id + "/controls/";
    if (topic == Retained_hack) {// if we get hack_message it means that we've read all retained messages
        Publish(NULL, Retained_hack, "", 0, true);
        unsubscribe(NULL, Retained_hack.c_str());
        unsubscribe(NULL, (controls_prefix + "+").c_str());
        PrepareInit = false;
    }else {
        string device = topic.substr(controls_prefix.length(), topic.length());
        for (auto& current : Channels)
            if (device == current.GetDeviceId())
                return;
        Channels.emplace_back(device);
    }

}

void TMQTTOnewireHandler::OnSubscribe(int mid, int qos_count, const int *granted_qos)
{
	printf("Subscription succeeded.\n");
}

string TMQTTOnewireHandler::GetChannelTopic(const TSysfsOnewireDevice& device) {
    static string controls_prefix = string("/devices/") + MQTTConfig.Id + "/controls/";
    return (controls_prefix + device.GetDeviceId());
}

void TMQTTOnewireHandler::UpdateChannelValues() {

    for (const TSysfsOnewireDevice& device: Channels) {
        auto result = device.ReadTemperature();
        if (result.Defined()) {
            Publish(NULL, GetChannelTopic(device), to_string(*result), 0, true); // Publish current value (make retained)
        }

    }
}

int main(int argc, char *argv[])
{
	int rc;
    TMQTTOnewireHandler::TConfig mqtt_config;
    mqtt_config.Host = "localhost";
    mqtt_config.Port = 1883;
    int poll_interval = 10 * 1000; //milliseconds

    int c;
    //~ int digit_optind = 0;
    //~ int aopt = 0, bopt = 0;
    //~ char *copt = 0, *dopt = 0;
    while ( (c = getopt(argc, argv, "c:h:p:i:")) != -1) {
        //~ int this_option_optind = optind ? optind : 1;
        switch (c) {
        //~ case 'c':
            //~ printf ("option c with value '%s'\n", optarg);
            //~ config_fname = optarg;
            //~ break;
        case 'p':
            printf ("option p with value '%s'\n", optarg);
            mqtt_config.Port = stoi(optarg);
            break;
        case 'h':
            printf ("option h with value '%s'\n", optarg);
            mqtt_config.Host = optarg;
            break;
        case 'i':
			poll_interval = stoi(optarg) * 1000;
        case '?':
            break;
        default:
            printf ("?? getopt returned character code 0%o ??\n", c);
        }
    }
	mosqpp::lib_init();

    mqtt_config.Id = "wb-w1";

    std::shared_ptr<TMQTTOnewireHandler> mqtt_handler(new TMQTTOnewireHandler(mqtt_config));
    mqtt_handler->Init();
    string topic = string("/devices/") + mqtt_config.Id + "/controls/+";

	auto time_last_published = steady_clock::now();
    while(1){
		rc = mqtt_handler->loop(poll_interval);
        //~ cout << "break in a loop! " << rc << endl;
		if(rc != 0) {
			mqtt_handler->reconnect();
		} else {
            // update current values
            if (!mqtt_handler->GetPrepareInit()){
				int time_elapsed = duration_cast<milliseconds>(steady_clock::now() - time_last_published).count() ;
				if (time_elapsed >= poll_interval ) { //checking is it time to look through all gpios
	                mqtt_handler->RescanBus();
	                mqtt_handler->UpdateChannelValues();
	                time_last_published = steady_clock::now();
				}
            }
        }
	}

	mosqpp::lib_cleanup();

	return 0;
}


text:
/**
 *  Implementation of a the segment intersection algorithm ReportCuts.
 *
 *  Assignment 03, Advanced Algorithms & Data Structures, Summer term 2016.
 *  Department of Computer Sciences, University of Salzburg.
 *
 *  @author Daniel Kocher, 0926293
 */

import java.util.Scanner;
import java.util.regex.Pattern;

import java.util.Map;
import java.util.HashMap;
import java.util.Comparator;
import java.util.Arrays;

public class Segments {
  /**
   *  Main function.
   *  Processes the command-line arguments and calls the ReportCuts method.
   *
   *  @param args A List of 4-tuples each of which consists of 4 Double values
   */
  public static void main (String[] args) {
    Segments segments = new Segments();
    List<Point> s = readSegments();

    //System.out.println("Trivial Check: ");
    //String trivString = segments.trivialCheck(s);
    //System.out.println(trivString);

    try {
      segments.reportCuts(s);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }

  public Map<List<Point>, List<Point>> mapL = null;
  public Map<List<Point>, List<Point>> mapR = null;
  public Map<List<Point>, List<Point>> mapV = null;

  public Segments () {
    mapL = new HashMap<List<Point>, List<Point>>();
    mapR = new HashMap<List<Point>, List<Point>>();
    mapV = new HashMap<List<Point>, List<Point>>();
  }

  /**
   *
   */
  public static List<Point> readSegments () {
    Scanner scanner = new Scanner(System.in);
    List<Point> segments = new List<Point>(new Point.ComparatorX());
    Point[] associates = new Point[2];
    double[] values = new double[4];
    int idx = 0;
    while (scanner.hasNext()) {
      // parse values in line
      idx = 0;
      for (String s: scanner.nextLine().split("\\s")) {
        try {
          values[idx++] = Double.parseDouble(s);
        } catch (NumberFormatException nfe) {
          nfe.printStackTrace();
        }
      }

      // x coordinates are equal => vertical segment
      if (values[0] == values[2]) {
        segments.insert(new VSegment(values[0], values[1], values[2], values[3]));
        continue;
      }

      // y coordinates are equal => horizontal segment
      associates[0] = new Point(values[0], values[1], null);
      associates[1] = new Point(values[2], values[3], associates[0]);
      associates[0].setAssociate(associates[1]);
      segments.insert(associates[0]);
      segments.insert(associates[1]);
    }

    return segments;
  }

  /**
   *
   */
  public String trivialCheck (List<Point> s) {
    java.util.List<Point> hs = new java.util.LinkedList<Point>();
    java.util.List<VSegment> vs = new java.util.LinkedList<VSegment>();

    List<Point>.Node<Point> current = s.getHead();
    while (current != null) {
      if (current.data instanceof VSegment) {
        vs.add((VSegment)current.data);
      } else {
        hs.add(current.data);
      }
        current = current.next;
    }

    java.util.List<double[]> reported = new java.util.LinkedList<double[]>();
    String ret = "";
    for (Point h: hs) {
      for (VSegment v: vs) {
        if (h.lowerX() <= v.x() && h.upperX() >= v.x() &&
            h.y() >= v.lowerY() && h.y() <= v.upperY())
        {
          double[] a = new double[] { v.x(), h.y() };
          boolean found = false;
          for (double[] p: reported) {
            if (p[0] == a[0] && p[1] == a[1]) {
              found = true;
              break;
            }
          }

          if (!found) {
            ret += v.x() + " " + h.y() + "\n";
            reported.add(a);
          }
        }
      }
    }

    return ret;
  }

  /**
   *
   */
  public void reportCuts (List<Point> s) {
    if (s.size() <= 0) {
      return;
    }

    if (s.size() <= 1) {
      Point p = s.getHead().data;
      List<Point> l = new List<Point>(new Point.ComparatorY());
      l.insert(p);
      if (p instanceof VSegment) {
        mapV.put(s, l);
      } else if (p instanceof Point && p.x1 == p.lowerX()) {
        mapL.put(s, l);
      } else if (p instanceof Point && p.x1 == p.upperX()) {
        mapR.put(s, l);
      }
      return;
    }

    // split vertically
    List<Point> s1 = new List<Point>(new Point.ComparatorX());
    List<Point> s2 = new List<Point>(new Point.ComparatorX());
    int half = (s.size() % 2 == 0 ? (int)(s.size() / 2) : (int)(Math.ceil(s.size() / 2)));
    List<Point>.Node<Point> current = s.getHead();
    int counter = 0;
    while (current != null) {
      if (counter < half) {
        s1.insert(current.data);
      } else {
        s2.insert(current.data);
      }

      current = current.next;
      ++counter;
    }

    // recursive calls
    reportCuts(s1);
    reportCuts(s2);

    // report intersections
    List<Point> h1 = new List<Point>(new Point.ComparatorY());
    List<Point> v1 = new List<Point>(new Point.ComparatorY());
    h1.insert(mapR.get(s2));
    deleteIfAssociateExists(h1, mapL.get(s1));
    v1.insert(mapV.get(s1));
    intersectAndReport(h1, v1);

    List<Point> h2 = new List<Point>(new Point.ComparatorY());
    List<Point> v2 = new List<Point>(new Point.ComparatorY());
    h2.insert(mapL.get(s1));
    deleteIfAssociateExists(h2, mapR.get(s2));
    v2.insert(mapV.get(s2));
    intersectAndReport(h2, v2);

    // update L, R, V
    List<Point> newL = new List<Point>(new Point.ComparatorY());
    // first statement is equivalent to the following sequence of statements:
    // newL.insert(mapL.get(s1)); deleteIfAssociateExists(newL, mapR.get(s2));
    newL.insert(h2);
    newL.insert(mapL.get(s2));
    mapL.put(s, newL);

    List<Point> newR = new List<Point>(new Point.ComparatorY());
    // first statement is equivalent to the following sequence of statements:
    // newR.insert(mapR.get(s2)); deleteIfAssociateExists(newR, mapL.get(s1));
    newR.insert(h1);
    newR.insert(mapR.get(s1));
    mapR.put(s, newR);

    List<Point> newV = new List<Point>(new Point.ComparatorY());
    newV.insert(mapV.get(s1));
    newV.insert(mapV.get(s2));
    mapV.put(s, newV);
  }

  /**
   *
   */
  public void deleteIfAssociateExists (List<Point> s1, List<Point> s2) {
    if (s1 == null || s2 == null || s2.isEmpty()) {
      return;
    }

    List<Point>.Node<Point> current = s2.getHead();
    while (current != null) {
      if (s1.search(current.data.associate) != null) {
        s1.delete(current.data);
      }
      current = current.next;
    }
  }

  /**
   *
   */
  public void intersectAndReport (List<Point> h, List<Point> v) {
    if (h.isEmpty() || v.isEmpty()) {
      return;
    }

    List<Point>.Node<Point> currH = h.getHead();
    List<Point>.Node<Point> currV = v.getHead();
    List<Point>.Node<Point> tmpH = null;
    while (currV != null && currH != null) {
      if (currH.data.y() > ((VSegment)currV.data).upperY()) {
        currV = currV.next;
        continue;
      }

      if (currH.data.y() >= ((VSegment)currV.data).lowerY()) {
        System.out.println(currV.data.x() + " " + currH.data.y());

        tmpH = currH.next;
        while ( tmpH != null &&
                tmpH.data.y() < ((VSegment)currV.data).upperY())
        {
          System.out.println(currV.data.x() + " " + tmpH.data.y());
          tmpH = tmpH.next;
        }

        currV = currV.next;
      } else {
        if (currV != null) {
          currH = currH.next;
        }
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
module LimesurveyRails
  class GenericError < StandardError; end
  class RemoteControlError < GenericError;  end
  class WrongArgumentError < GenericError;  end
  class InconsistentParticipantsError < GenericError;  end
  class MultipleParticipationsToSurveyError < GenericError;  end
end


text:
FROM golang:alpine AS builder

# git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0

############################
# STEP 2 build node image
############################
FROM alpine:latest

COPY --from=builder /go/bin/cosmovisor /usr/bin/

# test user
ARG TEST_USER
ENV TEST_USER=${TEST_USER:-dcl}

#ARG TEST_USER_GROUP
#ENV TEST_USER_GROUP=${TEST_USER_GROUP:-dcl}

ARG TEST_UID
ENV TEST_UID=${TEST_UID:-1000}
#ARG gid=1000
RUN adduser -D -u ${TEST_UID} -h /var/lib/${TEST_USER} -g 'DCLedger user' ${TEST_USER}

ENV DAEMON_HOME=/var/lib/${TEST_USER}/.dcl
ENV DAEMON_NAME=dcld

VOLUME /var/lib/${TEST_USER}

EXPOSE 26656 26657 1317 26660 8888

STOPSIGNAL SIGTERM

USER ${TEST_USER}

ENV PATH=$PATH:${DAEMON_HOME}/cosmovisor/current/bin

WORKDIR /var/lib/${TEST_USER}


text:
package me.archdev

import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import me.archdev.RouteActor.{Connect, Disconnect}
import me.archdev.TweetRoomActor.{Subscribe, TweetRoomCommand, UnSubscribe}
import me.archdev.api.internal.{Command, ErrorMessageShowed, ShowErrorMessage}

class RouteActor(tweetRoomActor: ActorRef) extends Actor {

  var connectedUsers: Map[String, ActorRef] = Map()

  override def receive: Receive = {
    case command: TweetRoomCommand =>
      tweetRoomActor ! command

    // Smth like constructor and destructor for our system
    case Connect(userId, userActor) =>
      connectedUsers = connectedUsers + (userId -> userActor)
      tweetRoomActor ! Subscribe(userId, userActor)
    case Disconnect(userId) =>
      connectedUsers = connectedUsers - userId
      tweetRoomActor ! UnSubscribe(userId)

    case ShowErrorMessage(userId, message) =>
      connectedUsers(userId) ! ErrorMessageShowed(message)
  }

}

object RouteActor {

  def apply(tweetRoomActor: ActorRef)(implicit actorSystem: ActorSystem) =
    actorSystem.actorOf(Props(classOf[RouteActor], tweetRoomActor))

  sealed trait RouterCommand extends Command
  case class Connect(userId: String, userActor: ActorRef) extends RouterCommand
  case class Disconnect(userId: String) extends RouterCommand

}


text:
/*
 * spiral_reference_line_smoother.h
 */

#ifndef MODULES_PLANNING_REFERENCE_LINE_SPIRAL_REFERENCE_LINE_SMOOTHER_H_
#define MODULES_PLANNING_REFERENCE_LINE_SPIRAL_REFERENCE_LINE_SMOOTHER_H_

#include <vector>

#include "Eigen/Dense"

#include "modules/planning/proto/planning.pb.h"

#include "modules/planning/reference_line/reference_line.h"
#include "modules/planning/reference_line/reference_point.h"

namespace apollo {
namespace planning {

class SpiralReferenceLineSmoother {
 public:
  SpiralReferenceLineSmoother() = default;

  virtual ~SpiralReferenceLineSmoother() = default;

  void set_max_point_deviation(const double d);

  bool Smooth(const ReferenceLine& raw_reference_line,
              ReferenceLine* const smoothed_reference_line) const;

 private:
  bool Smooth(std::vector<Eigen::Vector2d> point2d,
              std::vector<common::PathPoint>* ptr_smoothed_point2d) const;

  std::vector<common::PathPoint> to_path_points(
      const double start_x, const double start_y, const double start_s,
      const double theta0, const double kappa0, const double dkappa0,
      const double theta1, const double kappa1, const double dkappa1,
      const double delta_s, const double resolution) const;

  common::PathPoint to_path_point(const double x, const double y,
                                  const double s, const double theta,
                                  const double kappa,
                                  const double dkappa) const;

  double max_point_deviation_ = 0.0;
};

}  // namespace planning
}  // namespace apollo

#endif  // MODULES_PLANNING_REFERENCE_LINE_SPIRAL_REFERENCE_LINE_SMOOTHER_H_


text:
@interface I {
  String fo<caret>o() default "foo";
}


text:
/**
 * @providesModule Root
 * @flow
 */

module.exports = 'Root';


text:
FOUNDATION_EXPORT double Pods_ALSwift_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_ALSwift_TestsVersionString[];


text:
// -----------------------------------------------------------------------
// <copyright file="PreApprovedCustomersRepository.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace Microsoft.Store.PartnerCenter.Storefront.BusinessLogic
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Models;
    using Newtonsoft.Json;
    using PartnerCenter.Enumerators;
    using PartnerCenter.Models;
    using PartnerCenter.Models.Customers;
    using PartnerCenter.Models.Query;
    using WindowsAzure.Storage.Blob;

    /// <summary>
    /// Manages persistence for PreApprovedCustomersRepository configuration options.
    /// </summary>
    public class PreApprovedCustomersRepository : DomainObject
    {
        /// <summary>
        /// The PreApprovedCustomers key in the cache.
        /// </summary>
        private const string PreApprovedCustomersCacheKey = "PreApprovedCustomers";

        /// <summary>
        /// The Azure BLOB name for the portal PreApprovedCustomers configuration.
        /// </summary>
        private const string PreApprovedCustomersBlobName = "preapprovedcustomers";

        /// <summary>
        /// Initializes a new instance of the <see cref="PreApprovedCustomersRepository"/> class.
        /// </summary>
        /// <param name="applicationDomain">An application domain instance.</param>
        public PreApprovedCustomersRepository(ApplicationDomain applicationDomain) : base(applicationDomain)
        {
        }

        /// <summary>
        /// Retrieves the PreApproved Customers for rendering in UX.
        /// </summary>
        /// <returns>The PreApproved Customers.</returns>
        public async Task<PreApprovedCustomersViewModel> RetrieveCustomerDetailsAsync()
        {
            // retrieve the list of customers from Partner Center.
            IAggregatePartner sdkClient = ApplicationDomain.Instance.PartnerCenterClient;
            List<Customer> allCustomers = new List<Customer>();

            // create a customer enumerator which will aid us in traversing the customer pages
            IResourceCollectionEnumerator<SeekBasedResourceCollection<Customer>> customersEnumerator = sdkClient.Enumerators.Customers.Create(sdkClient.Customers.Query(QueryFactory.Instance.BuildIndexedQuery(100)));

            while (customersEnumerator.HasValue)
            {
                foreach (Customer c in customersEnumerator.Current.Items)
                {
                    allCustomers.Add(c);
                }

                await customersEnumerator.NextAsync().ConfigureAwait(false);
            }

            // if all customers are preapproved then every customer's IsPreApproved is true.
            bool allCustomersPreApproved = false;
            PreApprovedCustomersList currentPreApprovedCustomers = await RetrieveAsync().ConfigureAwait(false);

            if (currentPreApprovedCustomers.CustomerIds != null)
            {
                // Find if the all customers approved entry is present.
                allCustomersPreApproved = currentPreApprovedCustomers.CustomerIds.Any(cid => cid == Guid.Empty.ToString());
            }

            // populate portal customer list.
            List<PortalCustomer> preApprovedCustomerDetails = (from customer in allCustomers
                                                               select new PortalCustomer()
                                                               {
                                                                   TenantId = customer.Id,
                                                                   CompanyName = customer.CompanyProfile.CompanyName,
                                                                   Domain = customer.CompanyProfile.Domain,
                                                                   IsPreApproved = false
                                                               }).ToList();

            // identify the customers who are preapproved and update them.
            if (!allCustomersPreApproved && (currentPreApprovedCustomers.CustomerIds != null))
            {
                foreach (string customerId in currentPreApprovedCustomers.CustomerIds)
                {
                    try
                    {
                        // can raise an exception if a customer has been removed from PartnerCenter although preapproved in the portal.
                        preApprovedCustomerDetails.FirstOrDefault(customer => customer.TenantId == customerId).IsPreApproved = true;
                    }
                    catch (NullReferenceException)
                    {
                        // This has been intentionally left empty.
                    }
                }
            }

            PreApprovedCustomersViewModel viewModel = new PreApprovedCustomersViewModel
            {
                IsEveryCustomerPreApproved = allCustomersPreApproved,
                Items = preApprovedCustomerDetails.OrderBy(customer => customer.CompanyName)
            };

            if (!allCustomersPreApproved && currentPreApprovedCustomers.CustomerIds != null)
            {
                viewModel.CustomerIds = new List<string>();
                viewModel.CustomerIds.AddRange(currentPreApprovedCustomers.CustomerIds.ToList());
            }

            return viewModel;
        }

        /// <summary>
        /// Updates the PreApproved Customers configuration.
        /// </summary>
        /// <param name="preApprovedCustomers">The new list of PreApproved Customers.</param>
        /// <returns>The updated PreApprovedCustomers configuration.</returns>
        public async Task<PreApprovedCustomersViewModel> UpdateAsync(PreApprovedCustomersViewModel preApprovedCustomers)
        {
            preApprovedCustomers.AssertNotNull(nameof(preApprovedCustomers));

            PreApprovedCustomersList customerList = new PreApprovedCustomersList();

            if (preApprovedCustomers.IsEveryCustomerPreApproved)
            {
                string[] ids = new string[] { Guid.Empty.ToString() };
                customerList.CustomerIds = ids.ToList();
            }
            else
            {
                customerList.CustomerIds = preApprovedCustomers.CustomerIds;
            }

            CloudBlockBlob preApprovedCustomersBlob = await GetPreApprovedCustomersBlob().ConfigureAwait(false);
            await preApprovedCustomersBlob.UploadTextAsync(JsonConvert.SerializeObject(customerList)).ConfigureAwait(false);

            // invalidate the cache, we do not update it to avoid race condition between web instances
            await ApplicationDomain.CachingService.ClearAsync(PreApprovedCustomersCacheKey).ConfigureAwait(false);

            return await RetrieveCustomerDetailsAsync().ConfigureAwait(false);
        }

        /// <summary>
        /// Checks whether given customer id is of a pre approved customer or not.
        /// </summary>
        /// <param name="customerId">The customer who is transacting.</param>
        /// <returns>True if customer is pre approved else false.</returns>
        public async Task<bool> IsCustomerPreApprovedAsync(string customerId)
        {
            customerId.AssertNotEmpty(nameof(customerId));

            bool isCustomerPreApproved = false;

            PreApprovedCustomersList existingCustomers = await RetrieveAsync().ConfigureAwait(false);
            if (existingCustomers.CustomerIds != null)
            {
                // Find if the all customers approved entry is present.
                int allCustomersApproved = existingCustomers.CustomerIds.Count(cid => cid == Guid.Empty.ToString());
                if (allCustomersApproved > 0)
                {
                    isCustomerPreApproved = true;
                }
                else
                {
                    // check if current customer is in the pre approved list.
                    int currentCustomerApproved = existingCustomers.CustomerIds.Count(cid => cid == customerId);
                    isCustomerPreApproved = currentCustomerApproved > 0;
                }
            }

            return isCustomerPreApproved;
        }

        /// <summary>
        /// Retrieves the portal PreApproved Customers configuration BLOB reference.
        /// </summary>
        /// <returns>The portal PreApproved Customers BLOB.</returns>
        private async Task<CloudBlockBlob> GetPreApprovedCustomersBlob()
        {
            CloudBlobContainer portalAssetsBlobContainer = await ApplicationDomain.AzureStorageService.GetPrivateCustomerPortalAssetsBlobContainerAsync().ConfigureAwait(false);

            return portalAssetsBlobContainer.GetBlockBlobReference(PreApprovedCustomersBlobName);
        }

        /// <summary>
        /// Retrieves the PreApproved Customers from persistence.
        /// </summary>
        /// <returns>The PreApproved Customers.</returns>
        private async Task<PreApprovedCustomersList> RetrieveAsync()
        {
            PreApprovedCustomersList preApprovedCustomersList = await ApplicationDomain.CachingService
                .FetchAsync<PreApprovedCustomersList>(PreApprovedCustomersCacheKey).ConfigureAwait(false);

            if (preApprovedCustomersList == null)
            {
                CloudBlockBlob preApprovedCustomersBlob = await GetPreApprovedCustomersBlob().ConfigureAwait(false);
                preApprovedCustomersList = new PreApprovedCustomersList();

                if (await preApprovedCustomersBlob.ExistsAsync().ConfigureAwait(false))
                {
                    preApprovedCustomersList = JsonConvert.DeserializeObject<PreApprovedCustomersList>(await preApprovedCustomersBlob.DownloadTextAsync().ConfigureAwait(false));

                    // cache the preapproved customers configuration
                    await ApplicationDomain.CachingService.StoreAsync(
                        PreApprovedCustomersCacheKey,
                        preApprovedCustomersList).ConfigureAwait(false);
                }
            }

            return preApprovedCustomersList;
        }

        /// <summary>
        /// The Pre Approved customers list model.
        /// </summary>
        private class PreApprovedCustomersList
        {
            /// <summary>
            /// Gets or sets the customer ids who are preapproved.
            /// </summary>
            public IEnumerable<string> CustomerIds { get; set; }
        }
    }
}


text:
class RemoveVersionFromDependencies < ActiveRecord::Migration
  def self.up
    remove_column :dependencies, :version_id
  end

  def self.down
    add_column :dependencies, :version_id, :integer
  end
end


text:
"""
Scraper for requesting, caching and parsing http://house.mo.gov/billlist.aspx.
"""
import os
import re
from scraper.interpreters import BaseInterpreter

class AlecBillInterpreter(BaseInterpreter):

    def __init__(self, url, **kwargs):
        """
        Initialize an object for scraping the bills list page.
        """
        super(AlecBillInterpreter, self).__init__(
            url=url,
            sleep_count=3,
            **kwargs
        )

    @property
    def name(self):
        header = self.soup.find_all('h2',
                                    class_='hero__title--underline-bar')[0]

        return header.string

    @property
    def summary(self):
        try:
            element = self.soup.find_all('h2',
                                     string=re.compile("Summary"))[0].find_next_siblings("p")[0]
            return element.get_text()
        except:
            return None

    @property
    def text(self):
        split_text = re.split("Model\s[\s]+\n", self.full_page_text)
        if len(split_text) <= 2:
            return split_text[-1]
        else:
            return "\n".join(split_text[1:])

    @property
    def full_page_text(self):
        elements = []
        content_elements = self.soup.find_all('div',class_="the-content")
        for ce in content_elements:
            elements = elements + ce.find_all(['p', 'li'])
        return "\n".join([el.get_text() for el in elements])


text:
package org.apache.geronimo.tomcat.cluster;

import java.util.Map;

import org.apache.catalina.Valve;
import org.apache.catalina.cluster.CatalinaCluster;
import org.apache.catalina.cluster.ClusterDeployer;
import org.apache.catalina.cluster.ClusterReceiver;
import org.apache.catalina.cluster.ClusterSender;
import org.apache.catalina.cluster.MembershipService;
import org.apache.catalina.cluster.MessageListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.tomcat.BaseGBean;
import org.apache.geronimo.tomcat.ObjectRetriever;
import org.apache.geronimo.tomcat.ValveGBean;

/**
* @version $Rev$ $Date$
*/
public class CatalinaClusterGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {

   private static final Log log = LogFactory.getLog(CatalinaClusterGBean.class);

   public static final String J2EE_TYPE = "Cluster";

   private final CatalinaCluster cluster;

   public CatalinaClusterGBean(){
       cluster=null;
   }

   public CatalinaClusterGBean(String className,
           Map initParams,
           MembershipServiceGBean membership,
           ReceiverGBean receiver,
           SenderGBean sender,
           MessageListenerGBean messageListenerChain,
           ValveGBean tomcatValveChain,
           ClusterDeployerGBean deployer) throws Exception {

       super(); // TODO: make it an attribute

       //Validate
       if (className == null){
           throw new IllegalArgumentException("Must have a 'className' attribute.");
       }

       //Create the CatalinaCluster object
       cluster = (CatalinaCluster)Class.forName(className).newInstance();

       //Set the parameters
       setParameters(cluster, initParams);

       //Add the MembershipService
       if (membership != null){
           cluster.setMembershipService((MembershipService)membership.getInternalObject());
       }

       //Add Receiver
       if (receiver != null){
           cluster.setClusterReceiver((ClusterReceiver)receiver.getInternalObject());
       }

       //Add Sender
       if (sender != null){
           cluster.setClusterSender((ClusterSender)sender.getInternalObject());
       }

       //Add the message listeners list
       if (messageListenerChain != null){
           MessageListenerGBean messageListenerGBean = messageListenerChain;
           while(messageListenerGBean != null){
               cluster.addClusterListener((MessageListener)messageListenerGBean.getInternalObject());
               messageListenerGBean = messageListenerGBean.getNextValve();
           }
       }

       //Add the valve list
       if (tomcatValveChain != null){
           ValveGBean valveGBean = tomcatValveChain;
           while(valveGBean != null){
               cluster.addValve((Valve)valveGBean.getInternalObject());
               valveGBean = valveGBean.getNextValve();
           }
       }

       //Add deployer
       if (deployer != null){
           cluster.setClusterDeployer((ClusterDeployer)deployer.getInternalObject());
       }
   }

   public Object getInternalObject() {
       return cluster;
   }

   public void doFail() {
       log.warn("Failed");
   }

   public void doStart() throws Exception {
       log.debug("Started cluster gbean.");
   }

   public void doStop() throws Exception {
       log.debug("Stopped cluster gbean.");
   }

   public static final GBeanInfo GBEAN_INFO;

   static {
       GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("CatalinaCluster", CatalinaClusterGBean.class, J2EE_TYPE);
       infoFactory.addAttribute("className", String.class, true);
       infoFactory.addAttribute("initParams", Map.class, true);
       infoFactory.addReference("Membership", MembershipServiceGBean.class, MembershipServiceGBean.J2EE_TYPE);
       infoFactory.addReference("Receiver", ReceiverGBean.class, ReceiverGBean.J2EE_TYPE);
       infoFactory.addReference("Sender", SenderGBean.class, SenderGBean.J2EE_TYPE);
       infoFactory.addReference("MessageListenerChain", MessageListenerGBean.class, MessageListenerGBean.J2EE_TYPE);
       infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
       infoFactory.addReference("ClusterDeployer", ClusterDeployerGBean.class, ClusterDeployerGBean.J2EE_TYPE);
       infoFactory.addOperation("getInternalObject");
       infoFactory.setConstructor(new String[] {
               "className",
               "initParams",
               "Membership",
               "Receiver",
               "Sender",
               "MessageListenerChain",
               "TomcatValveChain",
               "ClusterDeployer" });
       GBEAN_INFO = infoFactory.getBeanInfo();
   }

   public static GBeanInfo getGBeanInfo() {
       return GBEAN_INFO;
   }
}


text:
using System.Web.UI;
using EPiServer.Commerce.Sample.BaseControls;
using EPiServer.Core;
using EPiServer.ServiceLocation;
using EPiServer.Web;
using EPiServer.Web.Routing;
using Mediachase.Commerce.Catalog;
using Mediachase.Commerce.Catalog.Managers;

using EPiServer.DataAnnotations;
using EPiServer.Commerce.Sample.Templates.Sample.PageTypes;
using System.Collections.Generic;
using EPiServer.Commerce.Sample.Models.MetaDataClasses;
using System.Collections;
using System.Collections.Specialized;

namespace EPiServer.Commerce.Sample.Templates.Sample.Pages.ProductDetail
{
    public partial class MediaProductDetail : RendererBase<MediaProductContent>
    {
    }
}


text:
var _ = require('lodash');
var jwt = require('jwt-simple');
var debug = require('debug')('4front:http-host:dev-sandbox');

require('simple-errors');

var defaultDevOptions = {
  port: '3000', // The localhost port
  buildType: 'debug',
  autoReload: '0'
};

module.exports = function(options) {
  options = _.defaults(options || {}, {
    cookieName: '_dev',
    queryParam: '_dev',
    sandboxFlashCookie: '_sandboxPage',
    showBanner: true
  });

  return function(req, res, next) {
    debug('executing');

    // Bypass simulator if the virtualEnv is not 'local'
    if (req.ext.virtualEnv !== 'local') return next();

    var token;
    var devOptions;
    var devCookieName = (req.app.settings.cookiePrefix || '') + options.cookieName;

    // Special login path used to initialize the developer sandbox. Just copy
    // the query parameters to the _dev cookie and redirect to the root of the app.
    // Subsequent requests will read from the _dev cookie.
    if (req.path === '/__login') {
      debug('writing devOptions to cookie');

      // Clear the sandbox flash cookie
      res.clearCookie(req.app.settings.cookiePrefix + options.sandboxFlashCookie);

      devOptions = _.pick(req.query, _.keys(defaultDevOptions).concat('token'));

      token = validateDevToken(devOptions.token, req.app.settings.jwtTokenSecret);
      if (_.isError(token)) return next(token);

      res.cookie(devCookieName, devOptions, {httpOnly: true});
      return res.redirect('/');
    }

    // Load the dev options from the dev cookie
    var devCookie = req.cookies[devCookieName];

    if (!devCookie) {
      return next(Error.http(401, 'No ' + devCookieName + ' cookie set.', {
        help: 'Try running \'4front dev\' again.',
        code: 'missingDevCookie',
        bypassCustomErrorPage: true
      }));
    }

    // Load the developer's personal options from the _dev cookie
    // Apply the default dev options to the values from the cookie
    devOptions = _.extend(_.defaults({}, devCookie, defaultDevOptions), {
      cookieName: options.sandboxFlashCookie
    });

    token = validateDevToken(devOptions.token, req.app.settings.jwtTokenSecret);
    if (_.isError(token)) return next(token);

    // Store the 4front userId of the current developer
    req.ext.developerId = token.iss;
    req.ext.clientConfig.sandbox = true;

    // Get the app manifest from cache
    var manifestCacheKey = req.ext.developerId + '/' + req.ext.virtualApp.appId + '/_manifest';
    req.app.settings.cache.get(manifestCacheKey, function(err, manifestJson) {
      if (err) return next(err);

      var manifest = null;
      try {
        manifest = JSON.parse(manifestJson);
      } catch (jsonErr) {
        manifest = null;
      }

      if (manifest === null) {
        return next(Error.http(400, 'Invalid JSON manifest', {
          bypassCustomErrorPage: true,
          help: 'Try re-starting the dev sandbox with the command \'4front dev\'',
          code: 'invalidJsonManifest'
        }));
      }

      _.merge(req.ext, {
        // Specify custom middleware to handle loading the html page stream.
        // This will override the default behavior of loading from the
        // app.settings.storage object.
        devOptions: devOptions,
        loadPageMiddleware: require('./dev-sandbox-page')(devOptions),
        virtualAppVersion: {
          versionId: 'sandbox',
          name: 'sandbox',
          manifest: manifest
        },
        versionAssetPath: '//localhost:' + devOptions.port,
        buildType: devOptions.buildType,
        // Override the cache-control. We never want to cache pages served by the dev sandbox
        cacheControl: 'no-cache',
        htmlOptions: {
          autoReload: devOptions.autoReload === '1',
          // Run autoReload on the same port as the sandbox
          sandboxPort: devOptions.port,
          assetPath: '//localhost:' + devOptions.port,
          inject: {}
        }
      });

      next();
    });
  };

  // Validate the devOptions are valid
  function validateDevToken(encodedToken, tokenSecret) {
    // Validate the auth token
    if (_.isEmpty(encodedToken)) {
      return Error.http(401, 'Missing dev token.', {
        bypassCustomErrorPage: true,
        code: 'missingDevToken',
        help: 'Try re-starting the dev sandbox with \'4front dev\''
      });
    }

    var token;
    if (_.isEmpty(encodedToken) === false) {
      debug('decoding token %s', encodedToken);
      try {
        token = jwt.decode(encodedToken, tokenSecret);
      } catch (err) {
        return Error.http(401, 'Invalid dev token.', {
          bypassCustomErrorPage: true,
          code: 'invalidDevToken',
          help: 'Try re-starting the dev sandbox with \'4front dev\''
        });
      }
    }

    if (token.exp < Date.now()) {
      debug('token expired at %s', token.exp);

      return Error.http(401, 'Token expired', {
        bypassCustomErrorPage: true,
        code: 'expiredDevToken',
        help: 'Please re-start the dev sandbox with the `4front dev` command.'
      });
    }

    return token;
  }
};


text:
'use strict';

function User(){
  this.emailAddress = '';
  this.firstName = '';
  this.lastName = '';
}

module.exports = User;


text:
"""
1. Even Tree
Given a tree (simple graph with no cycles), remove as many edges form the tree as
possible to obtain a forest while: Each connected component of the forest should
contain an even number of vertices. Find out the number of removed edges
--
input format:
    two integers means two vertices, and a edge betweens them
    Vertices list: V, Edges list: E
Forest:
    A forest is an undirected graph, all of whose connected components are trees; in other words, the graph consists of a disjoint union of trees. Equivalently, a forest is an undirected cycle-free graph. As special cases, an empty graph, a single tree, and the discrete graph on a set of vertices (that is, the graph with these vertices that has no edges), all are examples of forests.
"""
# Create a list of size (n+1), store the children numbers of each node.
# Counting the nodes in list with even childrens.
def eventree(V, E): # E is a list of items like (v1, v2),
    # helper to find all children of nth vertex
    def find_children(n):
        children = []
        for x in xrange(len(E)):
            if E[x][1] == n:
                children.append(E[x][0])
                # Recursively find grand childerens
                g_children = find_children(E[x][0])
                for child in g_children:
                    children.append(child)
        return children

    # build a tree, store children numbers
    tree = []
    for x in xrange(len(V)):
        tree.append(find_children(x))
    # if a vertex has odd number of children, cut it and count it
    count = 0
    for x in xrange(len(V)):
        if len(tree[x]) %2 == 1:
            count += 1
    return count-1 # NOTE: count is the tree number, removed edge number should -1

"""
2. Longest path problem: find a longest path of a directed acyclic graph
"""

"""
3. Traveling Salesman Problem (TSP)
Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route that visits every city exactly once and returns to the starting point.

NOTE: We already know that Hamiltonian Tour exists here
"""
# 1. Naive solution
"""
1. iterrate each city as start
2. generage all (n-1)! factorial permutations of cities, find the minimum one
Big-Omega(n!) time !!!
"""
# 2. DP solution
# O(n^2 * 2^n) time, much less than O(n!), space is also exponential
"""
1. Consider
"""

"""
4. Dijkstra's shortest path (Greedy)
Thie code for all verteice to src, but can modify to specify vertex
O(V^2) time with this matrix representation
Dijkstra DOES NOT work for negative weight graph.
"""
# a. create an empty shortest path tree set
# b. assign source vertex as 0, others as infinite
# c. while sptSet does not inlcude all vertices:
#       1. pick a vertex u that not in sptSet has min distance value
#       2. include u to sptSet
#       3. update distance value of all adjacent vertices of u
def min_dist(dist, sptSet):
    min_v = max_int
    for v in xrange(len(dist)):
        if sptSet[v] == 0 and dist[v] <= min_v:
            min_v = dist[v]
            min_index = v
    return min_index

def dijkstra(graph, src):
    # graph use matrix as [V][V]
    dist = [max_int] * V # output, hold the shortest path form src to i
    dist[src] = 0
    sptSet = [0] * V

    for x in xrange(V):
        u = min_dist(dist, sptSet)
        sptSet[u] = 1
        for v in xrange(V):
            if sptSet[v] == 0 and graph[u][v] != 0 \
                    and dist[u] != max_int \
                    and dist[u] + graph[u][v] < dist[v]:
                dist[v] = dist[u] + graph[u][v]

# Can be reduced to O(E log V) is use adjacency list
# With the help of min-heap, put all vertices into heap

"""
5. Prim's Minimum Spanning Tree, MST, Greedy
Spanning tree means all vertices must be connected. MST is with min weight edges
"""
# a. mstSet keep vertices already included
# b. mark src value as 0, others as infinite
# c. while mstSet doesn't include all vertices:
#       (same as Dijkstra, but D is dist to src, MST is for know vertices)

"""
6. Clone Graph
Given a undirected node (node in the graph contains a label and a list of its neighbors), return a undirected graph node.
A serialized graph represented as {0,1,2#1,2#2,2}

# Definition for a undirected graph node
class UndirectedGraphNode:
    def __init__(self, x):
        self.label = x
        self.neighbors = []
"""
#   a. DFS
#   Use a dict to map all nodes and their clones {node: clone}
def cloneGraph(self, node):
    if node is None:
        return None
    node_map = {}
    return cloneNode(node, node_map)

def cloneNode(self, node, node_map):
    if node is None:
        return None
    if node in node_map:
        return node_map[node]
    clone = UndirectedGraphNode(node.label)
    for neighbor in node.neighbors:
        clone.neighbors.append(self.cloneNode(neighbor, node_map))
# b. BFS
# Use a queue and a dict
import Queue
def cloneGraph(self, node):
    if node is None:
        return None
    queue = Queue.Queue()
    new_node = UndirectedGraphNode(node.label)
    queue.put(node)
    map = {}
    map[node] = new_node
    while not queue.empty():
        curr = queue.get()
        for nb in curr.neighbors:
            if nb not in map:
                queue.put(nb)
                clone = UndirectedGraphNode(curr.label)
                map[curr].neighbors.append(clone)
                map[nb] = clone
            else:
                # Turn directed graph to undirected graph
                map[curr].neighbors.append(map[nb])
    return new_node


text:
"""
Testing some internals of the template processing. These are *not* examples to be copied in user code.
"""

token_parsing=r"""
Tests for TokenParser behavior in the face of quoted strings with spaces.

>>> from django.template import TokenParser

Test case 1: {% tag thevar|filter sometag %}

>>> p = TokenParser("tag thevar|filter sometag")
>>> p.tagname
'tag'
>>> p.value()
'thevar|filter'
>>> p.more()
True
>>> p.tag()
'sometag'
>>> p.more()
False

Test case 2: {% tag "a value"|filter sometag %}

>>> p = TokenParser('tag "a value"|filter sometag')
>>> p.tagname
'tag'
>>> p.value()
'"a value"|filter'
>>> p.more()
True
>>> p.tag()
'sometag'
>>> p.more()
False

Test case 3: {% tag 'a value'|filter sometag %}

>>> p = TokenParser("tag 'a value'|filter sometag")
>>> p.tagname
'tag'
>>> p.value()
"'a value'|filter"
>>> p.more()
True
>>> p.tag()
'sometag'
>>> p.more()
False
"""

filter_parsing = r"""
>>> from django.template import FilterExpression, Parser

>>> c = {'article': {'section': u'News'}}
>>> p = Parser("")
>>> def fe_test(s): return FilterExpression(s, p).resolve(c)

>>> fe_test('article.section')
u'News'
>>> fe_test('article.section|upper')
u'NEWS'
>>> fe_test(u'"News"')
u'News'
>>> fe_test(u"'News'")
u'News'
>>> fe_test(ur'"Some \"Good\" News"')
u'Some "Good" News'
>>> fe_test(ur"'Some \'Bad\' News'")
u"Some 'Bad' News"

>>> fe = FilterExpression(ur'"Some \"Good\" News"', p)
>>> fe.filters
[]
>>> fe.var
u'Some "Good" News'

Filtered variables should reject access of attributes beginning with underscores.

>>> FilterExpression('article._hidden|upper', p)
Traceback (most recent call last):
...
TemplateSyntaxError: Variables and attributes may not begin with underscores: 'article._hidden'
"""

variable_parsing = r"""
>>> from django.template import Variable

>>> c = {'article': {'section': u'News'}}
>>> Variable('article.section').resolve(c)
u'News'
>>> Variable(u'"News"').resolve(c)
u'News'
>>> Variable(u"'News'").resolve(c)
u'News'

Translated strings are handled correctly.

>>> Variable('_(article.section)').resolve(c)
u'News'
>>> Variable('_("Good News")').resolve(c)
u'Good News'
>>> Variable("_('Better News')").resolve(c)
u'Better News'

Escaped quotes work correctly as well.

>>> Variable(ur'"Some \"Good\" News"').resolve(c)
u'Some "Good" News'
>>> Variable(ur"'Some \'Better\' News'").resolve(c)
u"Some 'Better' News"

Variables should reject access of attributes beginning with underscores.

>>> Variable('article._hidden')
Traceback (most recent call last):
...
TemplateSyntaxError: Variables and attributes may not begin with underscores: 'article._hidden'
"""


text:
```sh
$ knife environment from file environments/foo.rb
```

```sh
$ fork environment upload foo
```

## Role

```sh
$ knife role from file roles/foo.rb
```

```sh
$ fork role upload foo
```

## DataBag

```sh
$ knife data bag from file foo data_bags/foo/bar.json
```

```sh
$ fork databag upload foo bar
```

## Cookbook

```sh
$ knife cookbook upload foo
```

```sh
$ fork cookbook upload foo
```


text:
package whisk.core.cli.test

import akka.http.scaladsl.model.StatusCodes.OK

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import spray.json.JsObject

import common.rest.WskRest
import common.rest.RestResult
import common.TestUtils.RunResult

/**
 * Tests for testing the CLI "api" subcommand.  Most of these tests require a deployed backend.
 */
@RunWith(classOf[JUnitRunner])
class ApiGwRestTests extends ApiGwTests {
  override lazy val wsk = new WskRest
  override lazy val createCode = OK.intValue

  override def verifyBadCommands(rr: RunResult, badpath: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val error = RestResult.getField(apiResultRest.respBody, "error")
    error should include("Error: Resource path must begin with '/'.")
  }

  override def verifyBadCommandsDelete(rr: RunResult, badpath: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val error = RestResult.getField(apiResultRest.respBody, "error")
    error should include(s"API deletion failure: API '/basepath' does not exist")
  }

  override def verifyBadCommandsList(rr: RunResult, badpath: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val apis = apiResultRest.getFieldListJsObject("apis")
    apis.size shouldBe 0
  }

  override def verifyInvalidCommands(rr: RunResult, badverb: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val error = apiResultRest.getField("error")
    error should include(s"Error: Resource verb '${badverb}' not supported")
  }

  override def verifyInvalidCommandsDelete(rr: RunResult, badverb: String): Unit = {
    verifyBadCommandsDelete(rr, badverb)
  }

  override def verifyInvalidCommandsList(rr: RunResult, badverb: String): Unit = {
    verifyBadCommandsList(rr, badverb)
  }

  override def verifyNonJsonSwagger(rr: RunResult, filename: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val error = apiResultRest.getField("error")
    error should include(s"swagger field cannot be parsed. Ensure it is valid JSON")
  }

  override def verifyMissingField(rr: RunResult): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val error = apiResultRest.getField("error")
    error should include(s"swagger is missing the basePath field.")
  }

  override def verifyApiCreated(rr: RunResult): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    apiResultRest.statusCode shouldBe OK
  }

  def verifyList(rr: RunResult,
                 namespace: String,
                 actionName: String,
                 testurlop: String,
                 testbasepath: String,
                 testrelpath: String,
                 testapiname: String,
                 newEndpoint: String = ""): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val apiValue = RestResult.getFieldJsObject(apiResultRest.getFieldListJsObject("apis")(0), "value")
    val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")
    val basepath = RestResult.getField(apidoc, "basePath")
    basepath shouldBe testbasepath

    val paths = RestResult.getFieldJsObject(apidoc, "paths")
    paths.fields.contains(testrelpath) shouldBe true

    val info = RestResult.getFieldJsObject(apidoc, "info")
    val title = RestResult.getField(info, "title")
    title shouldBe testapiname

    verifyPaths(paths, testrelpath, testurlop, actionName, namespace)

    if (newEndpoint != "") {
      verifyPaths(paths, newEndpoint, testurlop, actionName, namespace)
    }
  }

  def verifyPaths(paths: JsObject,
                  testrelpath: String,
                  testurlop: String,
                  actionName: String,
                  namespace: String = "") = {
    val relpath = RestResult.getFieldJsObject(paths, testrelpath)
    val urlop = RestResult.getFieldJsObject(relpath, testurlop)
    val openwhisk = RestResult.getFieldJsObject(urlop, "x-openwhisk")
    val actionN = RestResult.getField(openwhisk, "action")
    actionN shouldBe actionName

    if (namespace != "") {
      val namespaceS = RestResult.getField(openwhisk, "namespace")
      namespaceS shouldBe namespace
    }
  }

  override def verifyApiList(rr: RunResult,
                             clinamespace: String,
                             actionName: String,
                             testurlop: String,
                             testbasepath: String,
                             testrelpath: String,
                             testapiname: String): Unit = {
    verifyList(rr, clinamespace, actionName, testurlop, testbasepath, testrelpath, testapiname)
  }

  override def verifyApiGet(rr: RunResult): Unit = {
    rr.stdout should include regex (s""""operationId":"getPathWithSub_pathsInIt"""")
  }

  override def verifyApiFullList(rr: RunResult,
                                 clinamespace: String,
                                 actionName: String,
                                 testurlop: String,
                                 testbasepath: String,
                                 testrelpath: String,
                                 testapiname: String): Unit = {
    verifyList(rr, clinamespace, actionName, testurlop, testbasepath, testrelpath, testapiname)
  }

  override def verifyApiFullListDouble(rr: RunResult,
                                       clinamespace: String,
                                       actionName: String,
                                       testurlop: String,
                                       testbasepath: String,
                                       testrelpath: String,
                                       testapiname: String,
                                       newEndpoint: String): Unit = {
    verifyList(rr, clinamespace, actionName, testurlop, testbasepath, testrelpath, testapiname, newEndpoint)
  }

  override def verifyApiDeleted(rr: RunResult): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    apiResultRest.statusCode shouldBe OK
  }

  override def verifyApiDeletedRelpath(rr: RunResult,
                                       testrelpath: String,
                                       testbasepath: String,
                                       op: String = ""): Unit = {
    verifyApiDeleted(rr)
  }

  override def verifyApiNameGet(rr: RunResult,
                                testbasepath: String,
                                actionName: String,
                                responseType: String = "json"): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]

    val apiValue = RestResult.getFieldJsObject(apiResultRest.getFieldListJsObject("apis")(0), "value")
    val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")

    val config = RestResult.getFieldJsObject(apidoc, "x-ibm-configuration")

    val cors = RestResult.getFieldJsObject(config, "cors")
    val enabled = RestResult.getFieldJsValue(cors, "enabled").toString()
    enabled shouldBe "true"

    val basepath = RestResult.getField(apidoc, "basePath")
    basepath shouldBe testbasepath

    val paths = RestResult.getFieldJsObject(apidoc, "paths")
    val relpath = RestResult.getFieldJsObject(paths, "/path")
    val urlop = RestResult.getFieldJsObject(relpath, "get")
    val openwhisk = RestResult.getFieldJsObject(urlop, "x-openwhisk")
    val actionN = RestResult.getField(openwhisk, "action")
    actionN shouldBe actionName
    rr.stdout should include regex (s""""target-url":".*${actionName}.${responseType}"""")
  }

  override def verifyInvalidSwagger(rr: RunResult): Unit = {
    verifyMissingField(rr)
  }

  override def verifyApiOp(rr: RunResult, testurlop: String, testapiname: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val apiValue = RestResult.getFieldJsObject(apiResultRest.getFieldListJsObject("apis")(0), "value")
    val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")
    val info = RestResult.getFieldJsObject(apidoc, "info")
    val title = RestResult.getField(info, "title")
    title shouldBe testapiname
    val paths = RestResult.getFieldJsObject(apidoc, "paths")
    val relpath = RestResult.getFieldJsObject(paths, "/")
    val urlop = RestResult.getFieldJsObject(relpath, testurlop)
    relpath.fields.contains(testurlop) shouldBe true
  }

  override def verifyApiBaseRelPath(rr: RunResult, testbasepath: String, testrelpath: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val apiValue = RestResult.getFieldJsObject(apiResultRest.getFieldListJsObject("apis")(0), "value")
    val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")
    val basepath = RestResult.getField(apidoc, "basePath")
    basepath shouldBe testbasepath

    val paths = RestResult.getFieldJsObject(apidoc, "paths")
    paths.fields.contains(testrelpath) shouldBe true
  }

  override def verifyApiOpVerb(rr: RunResult, testurlop: String): Unit = {
    val apiResultRest = rr.asInstanceOf[RestResult]
    val apiValue = RestResult.getFieldJsObject(apiResultRest.getFieldListJsObject("apis")(0), "value")
    val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")
    val paths = RestResult.getFieldJsObject(apidoc, "paths")
    val relpath = RestResult.getFieldJsObject(paths, "/")
    val urlop = RestResult.getFieldJsObject(relpath, testurlop)
    relpath.fields.contains(testurlop) shouldBe true
  }

  override def verifyInvalidKey(rr: RunResult): Unit = {
    rr.stderr should include("A valid auth key is required")
  }

}


text:
$(document).ready(function(){

	$('a').click(function(e){
		alert('you are in admin section');
		e.preventDefault();
	})

});


text:
cask "canva" do
  version "1.39.0"
  sha256 "9787c6a8a97279c88c42d57a97d489cc2395fdf75bb9e956274afd09651f2666"

  url "https://desktop-release.canva-deploy.com/Canva-#{version}.dmg",
      verified: "desktop-release.canva-deploy.com/"
  name "Canva"
  desc "Design tool"
  homepage "https://www.canva.com/"

  livecheck do
    url "https://desktop-release.canva-deploy.com/latest-mac.yml"
    strategy :electron_builder
  end

  auto_updates true

  app "Canva.app"

  zap trash: [
    "~/Library/Application Support/Canva",
    "~/Library/Caches/com.canva.CanvaDesktop",
    "~/Library/Caches/com.canva.CanvaDesktop.ShipIt",
    "~/Library/Logs/Canva",
    "~/Library/Preferences/com.canva.CanvaDesktop.plist",
    "~/Library/Saved Application State/com.canva.CanvaDesktop.savedState",
  ]
end


text:
require 'date'
require 'time'

require 'metior/collections/actor_collection'
require 'metior/collections/collection'

module Metior

  # This class implements a collection of commits and provides functionality
  # specific to commits.
  #
  # @author Sebastian Staudt
  # @see Commit
  class CommitCollection < Collection

    # Creates a new collection with the given commits
    #
    # @param [Array<Commit>] commits The commits that should be initially
    #        inserted into the collection
    def initialize(commits = [], range = nil)
      @additions = nil
      @deletions = nil
      @range     = range

      commits_with_stats = commits.select { |c| c.line_stats? }
      unless commits_with_stats.empty?
        @additions = 0
        @deletions = 0
        commits_with_stats.each do |commit|
          @additions += commit.additions
          @deletions += commit.deletions
        end
      end

      super commits
    end

    # Adds a commit to this collection
    #
    # @param [Commit] commit The commit to add to this collection
    # @return [CommitCollection] The collection itself
    def <<(commit)
      return self if key? commit.id

      if @additions.nil? && empty? && commit.line_stats?
        @additions = commit.additions
        @deletions = commit.deletions
      elsif !@additions.nil?
        @additions += commit.additions
        @deletions += commit.deletions
      end

      super
    end

    # Calculate some predefined activity statistics for the commits in this
    # collection
    #
    # @return [Hash<Symbol, Object>] The calculated statistics for the commits
    #         in this collection
    # @see Commit#committed_date
    def activity
      activity = {}
      return activity if empty?

      commit_count = values.size

      active_days = {}
      each do |commit|
        date = commit.committed_date.utc
        day  = Time.utc(date.year, date.month, date.day).send :to_date
        if active_days.key? day
          active_days[day] += 1
        else
          active_days[day] = 1
        end
      end

      most_active_day = active_days.sort_by { |day, count| count }.last.first

      activity[:first_commit_date] = last.committed_date
      activity[:last_commit_date]  = first.committed_date

      age_in_days = (Time.now - activity[:first_commit_date]) / 86400.0

      activity[:active_days]            = active_days
      activity[:most_active_day]        = most_active_day
      activity[:commits_per_day]        = commit_count / age_in_days
      activity[:commits_per_active_day] = commit_count.to_f / active_days.size

      activity
    end

    # Returns the lines of code that have been added by the commits in this
    # collection
    #
    # This will load the line stats from the commits if not done yet.
    #
    # @return [Fixnum] The lines of code that have been added
    # @see #load_line_stats
    def additions
      support! :line_stats

      load_line_stats if @additions.nil?
      @additions
    end

    # Returns the commits in this collection that have been committed after the
    # given time
    #
    # @param [Time, Date, DateTime, String] date The time to use as the lower
    #        limit to filter the commits
    # @return [CommitCollection] The commits that have been committed after the
    #         given date
    # @see Commit#committed_date
    # @see Time.parse
    def after(date)
      date = Time.parse date if date.is_a? String
      commits = CommitCollection.new
      each do |commit|
        commits << commit if commit.committed_date > date
      end
      commits
    end
    alias_method :newer, :after

    # Returns the authors of all or a specific commit in this collection
    #
    # @param [Object] commit_id The ID of the commit, if only the author of a
    #        specific commit should be returned
    # @return [ActorCollection] All authors of the commits in this collection
    #         or the author of a specific commit
    # @see Commit#author
    def authors(commit_id = nil)
      authors = ActorCollection.new
      if commit_id.nil?
        each { |commit| authors << commit.author }
      elsif key? commit_id
        authors << self[commit_id].author
      end
      authors
    end

    # Returns the commits in this collection that have been committed before
    # the given time
    #
    # @param [Time, Date, DateTime, String] date The time to use as the upper
    #        limit to filter the commits
    # @return [CommitCollection] The commits that have been committed after the
    #         given date
    # @see Commit#committed_date
    # @see Time.parse
    def before(date)
      date = Time.parse date if date.is_a? String
      commits = CommitCollection.new
      each do |commit|
        commits << commit if commit.committed_date < date
      end
      commits
    end
    alias_method :older, :before

    # Returns the list of commits that have been authored by the given authors
    #
    # @param [Array<Actor, Object>] author_ids One or more actual `Actor`
    #        instances or IDs of the authors that the commits should be
    #        filtered by
    # @return [CommitCollection] The commits that have been authored by the
    #         given authors
    # @see Commit#author
    def by(*author_ids)
      author_ids = author_ids.flatten.map do |author_id|
        author_id.is_a?(Actor) ? author_id.id : author_id
      end
      commits = CommitCollection.new
      each do |commit|
        commits << commit if author_ids.include? commit.author.id
      end
      commits
    end

    # Returns the commits in this collection that change any of the given files
    #
    # @param [Array<String>] files The path of the files to filter commits by
    # @return [CommitCollection] The commits that contain changes to the given
    #         files
    # @see Commit#added_files
    # @see Commit#deleted_files
    # @see Commit#modified_files
    def changing(*files)
      support! :file_stats

      commits = CommitCollection.new
      each do |commit|
        commit_files = commit.added_files + commit.deleted_files + commit.modified_files
        commits << commit unless (commit_files & files).empty?
      end
      commits
    end
    alias_method :touching, :changing

    # Returns the committers of all or a specific commit in this collection
    #
    # @param [Object] commit_id The ID of the commit, if only the committer of
    #        a specific commit should be returned
    # @return [ActorCollection] All committers of the commits in this
    #         collection or the committer of a specific commit
    # @see Commit#committer
    def committers(commit_id = nil)
      committers = ActorCollection.new
      if commit_id.nil?
        each { |commit| committers << commit.committer }
      elsif key? commit_id
        committers << self[commit_id].committer
      end
      committers
    end

    # Returns the lines of code that have been deleted by the commits in this
    # collection
    #
    # This will load the line stats from the commits if not done yet.
    #
    # @return [Fixnum] The lines of code that have been deleted
    # @see #load_line_stats
    def deletions
      support! :line_stats

      load_line_stats if @deletions.nil?
      @deletions
    end

    # This evaluates the changed lines in each commit of this collection
    #
    # For easier use, the values are stored in separate arrays where each
    # number represents the number of changed (i.e. added or deleted) lines in
    # one commit.
    #
    # @example
    #  commits.line_history
    #  => { :additions => [10, 5, 0], :deletions => [0, -2, -1] }
    # @return [Hash<Symbol, Array>] Added lines are returned in an `Array`
    #         assigned to key `:additions`, deleted lines are assigned to
    #         `:deletions`
    # @see Commit#additions
    # @see Commit#deletions
    def line_history
      support! :line_stats

      history = { :additions => [], :deletions => [] }
      values.reverse.each do |commit|
        history[:additions] <<  commit.additions
        history[:deletions] << -commit.deletions
      end

      history
    end

    # Returns the total of lines changed by the commits in this collection
    #
    # @return [Fixnum] The total number of lines changed
    # @see #additions
    # @see #deletions
    def modifications
      additions + deletions
    end

    # Returns the given number of commits with most line changes on the
    # repository
    #
    # @param [Numeric] count The number of commits to return
    # @return [CommitCollection] The given number of commits ordered by impact
    # @see Commit#modifications
    def most_significant(count = 10)
      support! :line_stats

      commits = CommitCollection.new
      sort_by { |commit| -commit.modifications }.each do |commit|
        commits << commit
        break if commits.size == count
      end
      commits
    end
    alias_method :top, :most_significant

    # Returns the commits in this collection that change at least the given
    # number of lines
    #
    # @param [Numeric] line_count The number of lines that should be
    #        changed at least by the commits
    # @return [CommitCollection] The commits that change at least the given
    #         number of lines
    # @see Commit#modifications
    def with_impact(line_count)
      support! :line_stats

      commits = CommitCollection.new
      each do |commit|
        commits << commit if commit.modifications >= line_count
      end
      commits
    end

    private

    # Loads the line stats for the commits in this collection
    #
    # For collections holding a specific range of commits, this always gets the
    # line stats for all commits. For other, lets say fragmented, collections
    # this loads the line stats for all commits that are missing their stats.
    #
    # @see Commit#additions
    # @see Commit#deletions
    # @see Commit#line_stats?
    # @see Repository#line_stats
    def load_line_stats
      @additions = 0
      @deletions = 0

      return if empty?

      line_stats = nil
      if @range.nil?
        ids = values.reject { |c| c.line_stats? }.map { |c| c.id }
        line_stats = first.repo.load_line_stats ids unless ids.empty?
      else
        line_stats = first.repo.load_line_stats @range
      end
      unless line_stats.nil?
        line_stats.each do |id, stats|
          commit = self[id]
          commit.line_stats = stats
        end
      end

      each do |commit|
        @additions += commit.additions
        @deletions += commit.deletions
      end
    end

  end

end


text: package bites


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>src/utils/Utils.js - p2.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">

            API Docs for: 0.6.1

APIs

Classes

Modules

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

AABB

AngleLockEquation

Body

Broadphase

Capsule

Circle

Constraint

ContactEquation

ContactMaterial

Convex

DistanceConstraint

Equation

EventEmitter

FrictionEquation

GearConstraint

GridBroadphase

GSSolver

Heightfield

Island

IslandManager

IslandNode

Line

LinearSpring

LockConstraint

Material

NaiveBroadphase

Narrowphase

OverlapKeeper

OverlapKeeperRecord

Particle

Plane

PrismaticConstraint

Ray

RaycastResult

Rectangle

RevoluteConstraint

RotationalLockEquation

RotationalSpring

RotationalVelocityEquation

SAPBroadphase

Shape

Solver

Spring

TupleDictionary

Utils

vec2

World

                    Show:

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

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

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

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

File: src/utils/Utils.js

/* global P2_ARRAY_TYPE */

module.exports = Utils;

/**
 * Misc utility functions
 * @class Utils
 * @constructor
 */
function Utils(){}

/**
 * Append the values in array b to the array a. See <a href="http://stackoverflow.com/questions/1374126/how-to-append-an-array-to-an-existing-javascript-array/1374131#1374131">this</a> for an explanation.
 * @method appendArray
 * @static
 * @param  {Array} a
 * @param  {Array} b
 */
Utils.appendArray = function(a,b){
    if (b.length < 150000) {
        a.push.apply(a, b);
    } else {
        for (var i = 0, len = b.length; i !== len; ++i) {
            a.push(b[i]);
        }
    }
};

/**
 * Garbage free Array.splice(). Does not allocate a new array.
 * @method splice
 * @static
 * @param  {Array} array
 * @param  {Number} index
 * @param  {Number} howmany
 */
Utils.splice = function(array,index,howmany){
    howmany = howmany || 1;
    for (var i=index, len=array.length-howmany; i < len; i++){
        array[i] = array[i + howmany];
    }
    array.length = len;
};

/**
 * The array type to use for internal numeric computations throughout the library. Float32Array is used if it is available, but falls back on Array. If you want to set array type manually, inject it via the global variable P2_ARRAY_TYPE. See example below.
 * @static
 * @property {function} ARRAY_TYPE
 * @example
 *     <script>
 *         <!-- Inject your preferred array type before loading p2.js -->
 *         P2_ARRAY_TYPE = Array;
 *     </script>
 *     <script src="p2.js"></script>
 */
if(typeof P2_ARRAY_TYPE !== 'undefined') {
    Utils.ARRAY_TYPE = P2_ARRAY_TYPE;
} else if (typeof Float32Array !== 'undefined'){
    Utils.ARRAY_TYPE = Float32Array;
} else {
    Utils.ARRAY_TYPE = Array;
}

/**
 * Extend an object with the properties of another
 * @static
 * @method extend
 * @param  {object} a
 * @param  {object} b
 */
Utils.extend = function(a,b){
    for(var key in b){
        a[key] = b[key];
    }
};

/**
 * Extend an options object with default values.
 * @static
 * @method defaults
 * @param  {object} options The options object. May be falsy: in this case, a new object is created and returned.
 * @param  {object} defaults An object containing default values.
 * @return {object} The modified options object.
 */
Utils.defaults = function(options, defaults){
    options = options || {};
    for(var key in defaults){
        if(!(key in options)){
            options[key] = defaults[key];
        }
    }
    return options;
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>analytics-dashboard</artifactId>
        <groupId>org.wso2.carbon.analytics-common</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.analytics.dashboard.batch.admin</artifactId>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - Batch Analytics Dashboard Admin</name>
    <description>Batch Analytics Dashboard Admin</description>

    <dependencies>
        <!-- carbon -->
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
        </dependency>
        <!--carbon-analytics -->
        <dependency>
            <groupId>org.wso2.carbon.analytics</groupId>
            <artifactId>org.wso2.carbon.analytics.dataservice</artifactId>
            <version>1.0.3-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics</groupId>
            <artifactId>org.wso2.carbon.analytics.datasource.commons</artifactId>
            <version>1.0.3-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics</groupId>
            <artifactId>org.wso2.carbon.analytics.dataservice.commons</artifactId>
            <version>1.0.3-SNAPSHOT</version>
        </dependency>
        <!-- Jackson -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>1.8.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.8.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>1.8.6</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>1.7.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Carbon-Component>UIBundle</Carbon-Component>
                        <Export-Package>
                            org.wso2.carbon.analytics.dashboard.batch.admin.*,
                        </Export-Package>
                        <Import-Package>
                            org.wso2.carbon.utils,
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Rugaciuni Crestin Ortodoxe</title>
<link href="../style.css" rel="stylesheet" type="text/css">
<link href="../jquery-mobile/jquery.mobile.theme-1.0.min.css" rel="stylesheet" type="text/css"/>
<link href="../jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css"/>

Rugagiunea sotului pentru sotia sa