text:
from enum import Enum
from vnc_kubernetes_config import VncKubernetesConfig as vnc_kube_config

class LabelCache(object):

    def __init__(self):
        self.ns_label_cache = {}
        self.pod_label_cache = {}
        self.service_selector_cache = {}

    def _get_key(self, label):
        key = label[0] + ':' + label[1]
        return key

    def _get_namespace_label(self, namespace):
        label = {'namespace': namespace}
        return label

    def _locate_label(self, key, cache, label, uuid):
        key = label[0] + ':' + label[1]
        if key not in cache:
            cache[key] = set()
        cache[key].add(uuid)

    def _remove_label(self, key, cache, label, uuid):
        key = label[0] + ':' + label[1]
        if key in cache:
            try:
                cache[key].remove(uuid)
                if not len(cache[key]):
                    del cache[key]
            except KeyError:
                pass

class XLabelCache(object):
    """
    K8s Label Management.

    This class processes lables in K8s events and manages the relationship
    between labels in differnt K8s objects.

    Any K8s object type can avail the services of this class by instantiating
    it and using this class instance to feed labels on its events.

    This class mantains the following mapping:
    1. A labels to all K8s object (i.e their guids) that reference the lable.
    2. A K8s object( i.e its guid) to labels on the object.

    This class also allows for registration of notify methods for a label add
    or a delete event. An add event is triggered when a label is referenced for
    the first time by a K8s object. A delete event is triggered when there are
    no more references to a k8s object.

    """

    # Label to refencing Guid's mapping.
    k8s_label_to_guid_cache = {}

    # Guid to its labels mapping.
    k8s_guid_to_label_cache = {}

    # Registered Add callback method.
    label_add_cb = None

    # Registered Delete callback method.
    label_delete_cb = None

    class PredefinedTags(Enum):
        # Tags that have special meaning to Contrail.
        APPLICATION = 'application'
        TIER = "tier"

    def __init__(self, resource_type):

        self.resource_type = resource_type
        if resource_type in XLabelCache.k8s_label_to_guid_cache:
            return

        XLabelCache.k8s_label_to_guid_cache[resource_type] = {}

    def reset_resource(self):
        XLabelCache.k8s_label_to_guid_cache[self.resource_type] = {}

    @classmethod
    def get_key(cls, k, v):
        return k + ':' + v

    def get_key_value(self, label):
        kv = label.split(':')
        return kv[0], kv[1]

    def _update_label_to_guid_cache(self, key, value, obj_uuid):

        # Construct the label key.
        label_key = self.get_key(key, value)

        # If an entry exists for this label, add guid to the existing entry.
        # If not, create one.
        ltg_cache = XLabelCache.k8s_label_to_guid_cache[self.resource_type]
        if label_key in ltg_cache:
            ltg_cache[label_key].add(obj_uuid)
        else:
            ltg_cache[label_key] = {obj_uuid}
            XLabelCache.label_add_cb(key, value)

        return label_key

    def process(self, obj_uuid, curr_labels={}, list_curr_labels_dict=[]):
        """
        Process addition/update/deletion of labels on an object.

        This is the main interface for label management in this class.
        This method requires all current labels on an object to  be specified.
        This method compares the current and previous labels on an object
        and adds/removes label association with the object as needed.

        curr_labels: Labels that are to be associated with the object.
        list_curr_labels_dict: Labels that are to be associated with the
                               object in a list format.
        """
        all_labels = set()

        # Update label to k8s guid cache.
        if curr_labels:
            for key, value in curr_labels.iteritems():

                # Construct the label key.
                label_key = self._update_label_to_guid_cache(key, value, obj_uuid)

                # Construct a set of all input label keys.
                all_labels.add(label_key)

        if list_curr_labels_dict:
            for labels_dict in list_curr_labels_dict:
                for key, value in labels_dict.iteritems():
                    # Construct the label key.
                    label_key = self._update_label_to_guid_cache(key, value, obj_uuid)
                    # Construct a set of all input label keys.
                    all_labels.add(label_key)

        # Update the k8s guid to label cache.
        gtl_cache = XLabelCache.k8s_guid_to_label_cache

        # If an entry exists for the k8s guid, then determine if there is
        # a modification to the existing labels on the guid.
        # if yes: Update the this and add/remove entries by label to guid cache
        # as needed.
        if obj_uuid not in gtl_cache:
            gtl_cache[obj_uuid] = all_labels
        else:
            # Add any new labels that may been added to thie object.
            gtl_cache[obj_uuid] = gtl_cache[obj_uuid].union(all_labels)

            # Some labels got removed from this object.
            # Invoke delete to disassociate the guid from removed labels.
            removed_labels = gtl_cache[obj_uuid].difference(all_labels)

            if len(removed_labels):
                # Some labels got removed from this object.
                # Invoke delete to disassociate the guid from removed labels.
                self._delete(obj_uuid, removed_labels)
                gtl_cache[obj_uuid] = gtl_cache[obj_uuid].difference(removed_labels)

    def _delete(self, obj_uuid, labels):
        """
        Delete labels from an object.
        """
        for label in labels:
            res_labels = XLabelCache.k8s_label_to_guid_cache[self.resource_type]
            if label in res_labels:
                k,v = self.get_key_value(label)

                # Hack: Need an efficient way to skip namespace label delete
                # by other resouce types.
                if k == 'namespace' and self.resource_type != "Namespace":
                    continue

                res_labels[label].remove(obj_uuid)
                if not len(res_labels[label]):
                    del res_labels[label]

                    XLabelCache.label_delete_cb(k, v)

    def append(self, obj_guid, label):
        """
        Convience api to add a label to an existing object.

        This method differs from the process() method in that, process()
        method requires all labels on the object to be provided to it can
        deduce latest label associations on the object.

        This append() method provides an interface to add a specific label
        to an object. It does not require all current labels on that object
        to be specified.
        """
        curr_labels = self.get_labels(obj_guid)
        new_labels = {}
        for curr_label in curr_labels:
            k,v = self.get_key_value(curr_label)
            new_labels[k] = v
        new_labels.update(dict(label))
        self.process(obj_guid, new_labels)

    def remove(self, obj_guid, removed_labels):
        """ Convience api to remove a label from an existing object. """
        curr_labels = self.get_labels(obj_guid)
        new_labels = {}
        for curr_label in curr_labels:
            k,v = self.get_key_value(curr_label)
            if k in removed_labels and removed_labels[k] == v:
                continue
            new_labels[k] = v
        self.process(obj_guid, new_labels)

    @classmethod
    def register_label_add_callback(cls, cb_func):
        cls.label_add_cb = cb_func

    @classmethod
    def register_label_delete_callback(cls, cb_func):
        cls.label_delete_cb = cb_func

    @classmethod
    def get_labels(cls, obj_uuid):
        return XLabelCache.k8s_guid_to_label_cache.get(obj_uuid, {})

    @classmethod
    def get_namespace_label(self, namespace):
        """ Construct a namespace label. """
        label = {'namespace': namespace}
        return label

    @classmethod
    def get_namespace_label_kv(self, namespace):
        return 'namespace', namespace

    @classmethod
    def get_service_label(self, service_name):
        """ Construct a service label. """
        key = "-".join([vnc_kube_config.cluster_name(), 'svc'])
        value = service_name
        return {key: value}

    @classmethod
    def get_service_member_label(self, service_name):
        """ Construct a service memner label. """
        svc_label = self.get_service_label(service_name)
        svc_member_label_dict = {}
        for k,v in svc_label.iteritems():
            member_key = "-".join([k, "member"])
            svc_member_label_dict[member_key] = v
        return svc_member_label_dict

    @classmethod
    def get_cluster_label(self, cluster_name):
        """ Construct a cluster label. """
        label = {'application': cluster_name}
        return label

    @classmethod
    def get_ingress_label(self, ingress_name):
        """ Construct a ingress label. """
        label = {'ingress': ingress_name}
        return label

    def get_labels_dict(self, obj_guid, no_value=False):
        """ Construct labels in Contrail format. """
        labels_dict = {}
        predefined_values = [item.value for item in self.PredefinedTags]
        curr_labels = self.get_labels(obj_guid)
        is_global = vnc_kube_config.is_global_tags()
        for label in curr_labels:
            k,v = self.get_key_value(label)

            # TBD: uncomment if custom is different from predefined.
            # if k in predefined_values:

            labels_dict[k] = {
                                 'is_global': is_global,
                                  'value': v if no_value == False else None
                             }

        return labels_dict

    def get_delete_labels_dict(self, labels):
        """ Construct labels for delete in Contrail format. """
        labels_dict = {}
        for k in labels.iterkeys():
            labels_dict[k] = None
        return labels_dict


text:
package com.intellij.openapi.vcs.annotate;

import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileAdapter;
import com.intellij.openapi.vfs.VirtualFileEvent;
import com.intellij.openapi.vfs.VirtualFilePropertyEvent;

public class VFSForAnnotationListener extends VirtualFileAdapter {
  private final VirtualFile myFile;
  private final FileAnnotation myFileAnnotation;

  public VFSForAnnotationListener(final VirtualFile file, final FileAnnotation fileAnnotation) {
    myFileAnnotation = fileAnnotation;
    myFile = file;
  }

  @Override
  public void propertyChanged(VirtualFilePropertyEvent event) {
    if (! Comparing.equal(myFile, event.getFile())) return;
    if (! event.isFromRefresh()) return;

    if (VirtualFile.PROP_WRITABLE.equals(event.getPropertyName())) {
      if (((Boolean)event.getOldValue()).booleanValue()) {
        myFileAnnotation.close();
      }
    }
  }

  @Override
  public void contentsChanged(VirtualFileEvent event) {
    if (! Comparing.equal(myFile, event.getFile())) return;
    if (! event.isFromRefresh()) return;
    if (! myFile.isWritable()) {
      myFileAnnotation.close();
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.finra.datagenerator.scaffolding.messaging.config

import java.time.Duration

import org.finra.datagenerator.scaffolding.messaging.Replies
import org.finra.datagenerator.scaffolding.messaging.response.Response

/**
  * Created by dkopel on 9/8/16.
  */
case class MaxDurationResponse(
                                                                        override val _handler: Function[Replies, Response[_]],
                                                                        private val maxDuration: Duration
                                                            ) extends ResponseConfigurationBuilder(true, _handler, (t) => t.getElapsed >= maxDuration.toMillis)


text:
from django.conf.urls import patterns, url
from django.views import generic

from stats import views

REGEX_CLASSIFICATION_COMPETITION_SEASON =\
    '(?P<classification>[^/]+)/(?P<competition>[^/]+)/(?P<season>[^/]+)?/?$'

urlpatterns = patterns('',
    url(r'^/?$',
        generic.TemplateView.as_view(template_name='stats/home.html'),
        name='home'
    ),
    url(r'^login/',
        views.login_view,
        name='login'
    ),
    url(r'^logout/',
        views.logout_view,
        name='logout'
    ),
    url(r'^team/(?P<team>.*)/$',
        views.TeamTemplateView.as_view(),
        name='team'
    ),
    url(r'^game/(?P<pk>\d+)/$',
        views.GameDetailView.as_view(),
        name='game'
    ),
    url(r'^game/(?P<pk>\d+)/update/$',
        views.update_game_view,
        name='update_game'
    ),
    url(r'^overview/' + REGEX_CLASSIFICATION_COMPETITION_SEASON,
        views.OverviewTemplateView.as_view(),
        name='overview'
    ),
    url(r'^standings/' + REGEX_CLASSIFICATION_COMPETITION_SEASON,
        views.StandingsTemplateView.as_view(),
        name='standings'
    ),
    url(r'^schedule/' + REGEX_CLASSIFICATION_COMPETITION_SEASON,
        views.MatchdayListView.as_view(),
        name='schedule'
    ),
    url(r'^disciplinary/' + REGEX_CLASSIFICATION_COMPETITION_SEASON,
        views.DisciplinaryListView.as_view(),
        name='disciplinary'
    ),
    url(r'^goals/' + REGEX_CLASSIFICATION_COMPETITION_SEASON,
        views.GoalsListView.as_view(),
        name='goals'
    ),
)


text:
// Copyright (C) 2012  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#undef DLIB_FULL_OBJECT_DeTECTION_ABSTRACT_Hh_
#ifdef DLIB_FULL_OBJECT_DeTECTION_ABSTRACT_Hh_

#include <vector>
#include "../geometry.h"
#include "../serialize.h"

namespace dlib
{

// ----------------------------------------------------------------------------------------

    const static point OBJECT_PART_NOT_PRESENT(0x7FFFFFFF,
                                               0x7FFFFFFF);

// ----------------------------------------------------------------------------------------

    class full_object_detection
    {
        /*!
            WHAT THIS OBJECT REPRESENTS
                This object represents the location of an object in an image along with the
                positions of each of its constituent parts.
        !*/

    public:

        full_object_detection(
            const rectangle& rect,
            const std::vector<point>& parts
        );
        /*!
            ensures
                - #get_rect() == rect
                - #num_parts() == parts.size()
                - for all valid i:
                    - part(i) == parts[i]
        !*/

        full_object_detection(
        );
        /*!
            ensures
                - #get_rect().is_empty() == true
                - #num_parts() == 0
        !*/

        explicit full_object_detection(
            const rectangle& rect
        );
        /*!
            ensures
                - #get_rect() == rect
                - #num_parts() == 0
        !*/

        const rectangle& get_rect(
        ) const;
        /*!
            ensures
                - returns the rectangle that indicates where this object is.  In general,
                  this should be the bounding box for the object.
        !*/

        rectangle& get_rect(
        );
        /*!
            ensures
                - returns the rectangle that indicates where this object is.  In general,
                  this should be the bounding box for the object.
        !*/

        unsigned long num_parts(
        ) const;
        /*!
            ensures
                - returns the number of parts in this object.
        !*/

        const point& part(
            unsigned long idx
        ) const;
        /*!
            requires
                - idx < num_parts()
            ensures
                - returns the location of the center of the idx-th part of this object.
                  Note that it is valid for a part to be "not present".  This is indicated
                  when the return value of part() is equal to OBJECT_PART_NOT_PRESENT.
                  This is useful for modeling object parts that are not always observed.
        !*/

        point& part(
            unsigned long idx
        );
        /*!
            requires
                - idx < num_parts()
            ensures
                - returns the location of the center of the idx-th part of this object.
                  Note that it is valid for a part to be "not present".  This is indicated
                  when the return value of part() is equal to OBJECT_PART_NOT_PRESENT.
                  This is useful for modeling object parts that are not always observed.
        !*/

        bool operator==(
            const full_object_detection& rhs
        ) const;
        /*!
            ensures
                - returns true if and only if *this and rhs have identical state.
        !*/
    };

// ----------------------------------------------------------------------------------------

    void serialize (
        const full_object_detection& item,
        std::ostream& out
    );
    /*!
        provides serialization support
    !*/

    void deserialize (
        full_object_detection& item,
        std::istream& in
    );
    /*!
        provides deserialization support
    !*/

// ----------------------------------------------------------------------------------------

    bool all_parts_in_rect (
        const full_object_detection& obj
    );
    /*!
        ensures
            - returns true if all the parts in obj are contained within obj.get_rect().
              That is, returns true if and only if, for all valid i, the following is
              always true:
                obj.get_rect().contains(obj.part(i)) == true || obj.part(i) == OBJECT_PART_NOT_PRESENT
    !*/

// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------

    struct mmod_rect
    {
        /*!
            WHAT THIS OBJECT REPRESENTS
                This is a simple struct that is used to give training data and receive detections
                from the Max-Margin Object Detection loss layer loss_mmod_ object.
        !*/

        mmod_rect() = default;
        mmod_rect(const rectangle& r) : rect(r) {}
        mmod_rect(const rectangle& r, double score) : rect(r),detection_confidence(score) {}

        rectangle rect;
        double detection_confidence = 0;
        bool ignore = false;

        operator rectangle() const { return rect; }
    };

    mmod_rect ignored_mmod_rect(
        const rectangle& r
    );
    /*!
        ensures
            - returns a mmod_rect R such that:
                - R.rect == r
                - R.ignore == true
                - R.detection_confidence == 0
    !*/

    void serialize(const mmod_rect& item, std::ostream& out);
    void deserialize(mmod_rect& item, std::istream& in);
    /*!
        provides serialization support
    !*/

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_FULL_OBJECT_DeTECTION_ABSTRACT_Hh_


text:
/*!
 * \file graspdb.h
 * \brief All-inclusive include file for the graspdb library.
 *
 * The graspdb library is a standalone C++ library for communicating with the PostgreSQL grasp database.
 *
 * \author Russell Toris, WPI - russell.toris@gmail.com
 * \date March 3, 2015
 */

#ifndef RAIL_PICK_AND_PLACE_GRASPDB_GRASPDB_H_
#define RAIL_PICK_AND_PLACE_GRASPDB_GRASPDB_H_

#include "Client.h"
#include "Entity.h"
#include "Grasp.h"
#include "GraspDemonstration.h"
#include "GraspModel.h"
#include "Orientation.h"
#include "Pose.h"
#include "Position.h"

#endif


text:
import json

from django.utils.http import urlencode

import mock
import requests

from olympia.amo.tests import AMOPaths, TestCase
from olympia.amo.urlresolvers import reverse
from olympia.files.models import FileUpload
from olympia.github.tests.test_github import (
    GithubBaseTestCase, example_pull_request)

class TestGithubView(AMOPaths, GithubBaseTestCase, TestCase):

    def setUp(self):
        super(TestGithubView, self).setUp()
        self.url = reverse('v3:github.validate')

    def post(self, data, header=None, data_type=None):
        data_type = data_type or 'application/json'
        if (data_type == 'application/json'):
            data = json.dumps(data)
        elif (data_type == 'application/x-www-form-urlencoded'):
            data = urlencode({'payload': json.dumps(data)})
        return self.client.post(
            self.url, data=data,
            content_type=data_type,
            HTTP_X_GITHUB_EVENT=header or 'pull_request'
        )

    def complete(self):
        pending, success = self.requests.post.call_args_list
        self.check_status(
            'pending',
            call=pending,
            url='https://api.github.com/repos/org/repo/statuses/abc'
        )
        self.check_status(
            'success',
            call=success,
            url='https://api.github.com/repos/org/repo/statuses/abc',
            target_url=mock.ANY
        )

        assert FileUpload.objects.get()

    def test_not_pull_request(self):
        assert self.post({}, header='meh').status_code == 200

    def test_bad_pull_request(self):
        assert self.post({'pull_request': {}}).status_code == 422

    def setup_xpi(self):
        self.response = mock.Mock()
        self.response.content = open(self.xpi_path('github-repo')).read()
        self.requests.get.return_value = self.response

    def test_pending_fails(self):
        self.setup_xpi()

        post = mock.Mock()
        # GitHub returns a 404 when the addons-robot account does not
        # have write access.
        post.status_code = 404
        post.raise_for_status.side_effect = requests.HTTPError(response=post)
        self.requests.post.return_value = post

        res = self.post(example_pull_request)
        assert 'write access' in json.loads(res.content)['details']

    def test_good_not_json(self):
        self.setup_xpi()
        assert self.post(
            example_pull_request,
            data_type='application/x-www-form-urlencoded').status_code == 201
        self.complete()

    def test_good(self):
        self.setup_xpi()
        assert self.post(example_pull_request).status_code == 201
        self.complete()


text:
#include "log.h"

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

/**
 * @brief Trims the leading/trailing whitespaces
 *
 * @param str The string from which the whitespaces need to be trimmed
 *
 * @return Returns the modified string
 */
char *trimWhiteSpaces(char *str)
{
    //Trim from the beginning
    while(*str == ' ')
        str++;

    //Case of all spaces
    if(*str == 0)
        return str;

    //Trim from the end
    char *end = str + (strlen(str) - 1);
    while(end > str && *end == ' ')
        end--;

    *(end + 1) = '\0';

    return str;
}

char **parseCommandAndFillArgs(char *command)
{
    //Copy the command to use with strtok() in the second run
    char *commandCopy = (char *)malloc((strlen(command)+1) * sizeof(char));
    strcpy(commandCopy, command);

    char **args = NULL;
    int counter = 0;
    char *token;
    int i = 0;

    //First run to count the number of tokens
    token = strtok(command, " ");
    while(token != NULL)
    {
        counter++;
        token = strtok(NULL, " ");
    }

    //Second run to fill args
    args = (char **)malloc((counter+1) * sizeof(char *));
    token = strtok(commandCopy, " ");
    while(token != NULL)
    {
        *(args+i) = (char *)malloc((strlen(token)+1) * sizeof(char));
        strcpy(*(args+i), token);
        token = strtok(NULL, " ");
        i++;
    }

    //Assign NULL to the last pointer in args
    *(args + counter) = NULL;

    //Free the memory allocated for commandCopy
    free(commandCopy);

    return args;
}

/**
 * @brief Executes the non built-in commands
 *
 * @param command The command to execute
 *
 * @return On success, it returns 0 and 1 on failure.
 */
int executeNonBuiltInCommand(char *command)
{
    char **argsToExec = parseCommandAndFillArgs(command);

    int childStatus;
    pid_t waitPid;
    pid_t childPid = fork();
    if(childPid >= 0)
    {
        if(childPid == 0) //child process
        {
            //pid_t parentPid = getppid();
            //printf("Parent pid = %d", parentPid);
            int execRetval = execvp(argsToExec[0], argsToExec);
            if(execRetval == -1)
            {
                return 1;
            }
        }
        else //parent process
        {
            //printf("Child pid = %d", childPid);
            //Wait for the child to terminate
            waitPid = wait(&childStatus);
            if(waitPid == -1)
            {
                perror("wait() failed");
                exit(1);
            }
            else
            {
                printf("Command executed by child with pid=%d\n", waitPid);
            }
        }
    }
    else
    {
        printf("fork() failed.\n");
        exit(1);
    }

    return 0;
}

int main(int argc, char **argv)
{
    log l;
    logConstructor(&l);

    pid_t simpleShellPid = getpid();
    char buff[PATH_MAX+1];
    char *cwd = NULL;

    while(1)
    {
        cwd = getcwd(buff, PATH_MAX+1);
        if(cwd == NULL)
        {
            cwd = "/dummy/path";
        }

        //Print a command prompt
        printf("(pid=%d)%s$ ", simpleShellPid, cwd);

        //Read the command from the stdin
        char *command = NULL;
        size_t commandLen = 0;
        ssize_t nBytesRead;
        nBytesRead = getline(&command, &commandLen, stdin);
        *(command + (nBytesRead-1)) = '\0';

        //Remove the leading/trailing whitespaces from the command
        char *trimmedCommand = trimWhiteSpaces(command);

        /*
         * Execute the command: built-in command and non built-in command.
         * Built-in commands are executed without creating a new process, whereas
         * a non built-in command is executed by creating a new process to execute the program for that
         * particular command.
         *
         * Built-in commands: cd, exit and two commands (!# and !) based on a history feature.
         *     !#: Prints a list of all the commands saved in the history separated by newlines.
         *     !query: Re-executes the last command whose prefix matches query
         *
         * Non built-in commands: ls, pwd, ps, echo hello, and etc.
         */
        if(strncmp(trimmedCommand, "exit", 4) == 0)
        {
            exit(0);
        }
        else if(strncmp(trimmedCommand, "cd", 2) == 0)
        {
            char *path = NULL;
            int error;
            if((nBytesRead-1) == 2)
            {
                //Change to home directory
                path = getenv("HOME");
                error = chdir(path);
            }
            else
            {
                //Change to the specified directory
                path = trimmedCommand + 3;
                error = chdir(path);
            }

            if(error == -1)
            {
                perror("Error while changing directory");
            }
            else
            {
                //Add the command to the log
                logInsert(&l, trimmedCommand);
            }
        }
        else if((strncmp(trimmedCommand, "!", 1) == 0) && ((nBytesRead-1) == 1))
        {
            printf("%s: illegal command.\n", trimmedCommand);
            exit(1);
        }
        else if((strncmp(trimmedCommand, "!#", 2) == 0) && ((nBytesRead-1) == 2))
        {
            unsigned int sizeOfLog = logSize(&l);
            if(sizeOfLog == 0)
            {
                printf("Nothing in the log history yet.\n");
            }

            for(int i = (sizeOfLog-1); i>=0; --i)
            {
                printf("%s\n", logAt(&l, i));
            }
        }
        else if((strncmp(trimmedCommand, "!", 1) == 0) && (*(trimmedCommand+1) != '#') && ((nBytesRead-1) > 1))
        {
            char *retCommand = logSearch(&l, trimmedCommand+1);

            if(retCommand != NULL)
            {
                //Create a copy of retCommand to be used with executeNonBuiltInCommand()
                char *copyForExecuting = (char *)malloc((strlen(retCommand)+1) * sizeof(char));
                strcpy(copyForExecuting, retCommand);

                printf("%s matches %s\n", (trimmedCommand+1), copyForExecuting);

                int retVal = executeNonBuiltInCommand(copyForExecuting);
                if(retVal == 0) //success
                {
                    //Add the command to the log
                    logInsert(&l, retCommand);
                }
                else
                {
                    printf("%s: not found.\n", retCommand);
                }
            }
            else
            {
                printf("Nothing in the log history yet or no match found.\n");
            }
        }
        else
        {
            //Create a copy so that we can add it to the log on success, this is because trimmedCommand gets modified in executeNonBuiltInCommand()
            char *copyForLog = (char *)malloc((strlen(trimmedCommand)+1) * sizeof(char));
            strcpy(copyForLog, trimmedCommand);

            int retVal = executeNonBuiltInCommand(trimmedCommand);
            if(retVal == 0) //success
            {
                //Add the command to the log
                logInsert(&l, copyForLog);
            }
            else
            {
                printf("%s: not found.\n", copyForLog);
            }
        }
    }

    return 0;
}


text:
package br.uff.ic.gems.peixeespadacliente.tool;

import br.uff.ic.gems.peixeespadacliente.exception.RefactoringException;
import br.uff.ic.gems.peixeespadacliente.model.ProjectVCS;
import br.uff.ic.gems.peixeespadacliente.resolution.ExtractInterfaceResolution;
import br.uff.ic.gems.peixeespadacliente.resolution.Resolution;
import br.uff.ic.gems.peixeespadacliente.symptom.ExtractInterfaceSymptom;
import br.uff.ic.gems.peixeespadacliente.symptom.Symptom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.sf.refactorit.classmodel.BinCIType;
import net.sf.refactorit.classmodel.BinCITypeRef;
import net.sf.refactorit.classmodel.BinField;
import net.sf.refactorit.classmodel.BinMember;
import net.sf.refactorit.classmodel.BinTypeRef;
import net.sf.refactorit.commonIDE.IDEController;
import net.sf.refactorit.refactorings.RefactoringStatus;
import net.sf.refactorit.refactorings.extractsuper.ExtractSuper;
import net.sf.refactorit.refactorings.usesupertype.UseSuperTypeRefactoring;
import net.sf.refactorit.test.refactorings.NullContext;
import translation.Translate;

/**
 *
 * @author João Felipe
 */
public class ExtractInterfaces extends AbstractRefactoringTool {

    private ExtractSuper extractor = null;
    private BinTypeRef currentClassRef = null;
    private BinCIType currentClass = null;

    public ExtractInterfaces(ProjectVCS projectVCS) {
        super(projectVCS);
    }

    public boolean reloadRefactoring() {
        try {
            extractor = new ExtractSuper(new NullContext(getProject()), currentClassRef);

            extractor.setNewPackageName(currentClass.getPackage().getQualifiedName());

            List<BinMember> extractableMembers = interfaceExtractableMembers(currentClass);
            List membersToExtract = new ArrayList();
            Set abstractMethods = new HashSet();
            for (BinMember binMember : extractableMembers) {
                membersToExtract.add(binMember);
                abstractMethods.add(binMember);
            }
            this.extractor.setMembersToExtract(membersToExtract);
            this.extractor.setExplicitlyAbstractMethods(abstractMethods);

            return true;
        } catch (NullPointerException e) {
            return false;
        }
    }

    @Override
    public boolean prepareSymptom(Symptom symptom) throws RefactoringException {
        loadEnvironment();
//        reloadEnv();

        ExtractInterfaceSymptom extractInterfaceSymptom = (ExtractInterfaceSymptom) symptom;

        currentClassRef = getProject().getTypeRefForSourceName(extractInterfaceSymptom.getClassQualifiedName());
        currentClass = currentClassRef.getBinCIType();

        return reloadRefactoring();
    }

    private List<BinMember> interfaceExtractableMembers(BinCIType bcitr) {
        List<BinMember> result = new ArrayList<BinMember>();
        List members = new ArrayList();
        members.addAll(Arrays.asList(bcitr.getDeclaredFields()));
        members.addAll(Arrays.asList(bcitr.getDeclaredMethods()));
        // searching for at least one member satisfying our conditions
        for (int i = 0, max = members.size(); i < max; i++) {
            final BinMember member = (BinMember) members.get(i);
            // members must be public
            if (!member.isPublic()) {
                continue;
            }
            // fields should be public static final
            if (member instanceof BinField) {
                if (!member.isFinal() || !member.isStatic()) {
                    continue;
                }
            }
            //
            result.add(member);
        }

        return result;
    }

    @Override
    public List<Symptom> findAllSymptoms() throws RefactoringException {
        if (!loadEnvironment()) {
            return null;
        }

        List<Symptom> result = new ArrayList<Symptom>();

        for (Object object : getProject().getDefinedTypes()) {
            BinCITypeRef binCITypeRef = (BinCITypeRef) object;
            BinCIType bcitr = binCITypeRef.getBinCIType();

            if (bcitr.isInterface()) {
                continue;
            }

            if (interfaceExtractableMembers(bcitr).isEmpty()) {
                continue;
            }

            Symptom symptom = new ExtractInterfaceSymptom(bcitr, this);
            result.add(symptom);
        }
        return result;
    }

    @Override
    public boolean applyCheckingPreAndPosCondictions(Resolution resolution) throws RefactoringException {
        Translate translate = Translate.getTranslate();
        ExtractInterfaceResolution eiResolution = (ExtractInterfaceResolution) resolution;
        extractor.setNewTypeName(eiResolution.getNewTypeName());
        extractor.setExtractClass(eiResolution.getExtractClass());
        extractor.setForceExtractMethodsAbstract(eiResolution.getForceExtractMethodsAbstract());
        extractor.setExtractWithOldName(eiResolution.getExtractWithOldName());

        refactoring = extractor;
        RefactoringStatus status = checkPreconditions();
        if (status.isErrorOrFatal()) {
            throw new RefactoringException(translate.notRefactored(status.getAllMessages()));
        }
        status.merge(checkUserInput());
        status.merge(extractor.apply());
        if (!status.isOk()) {
            throw new RefactoringException(translate.error(status.getAllMessages()));
        }
        System.out.println(status.getAllMessages());
        return !status.isErrorOrFatal() && useSuperTypeWhereIsPossible(status);
//        return !status.isErrorOrFatal();
        /* Talvez usar o método useSuperTypeWhereIsPossible dificulte a aplicação com sucesso */
    }

    public boolean useSuperTypeWhereIsPossible(RefactoringStatus status) {
        loadEnvironment();
//        context.rebuildAndUpdateEnvironment();

        String supertypeName = extractor.getSupertypeQualifiedName();
        String subtypeName = extractor.getSubtypeQualifiedName();

        BinTypeRef subtypeRef = getProject().findTypeRefForName(subtypeName);
        BinTypeRef supertypeRef = getProject().findTypeRefForName(supertypeName);

        if (subtypeRef == null) {
          //DialogManager.getInstance().showCustomError(context, "Type " + subtypeName + " not found after rebuild");
            return false;
        }

        if (supertypeRef == null) {
          //DialogManager.getInstance().showCustomError(context, "Type " + supertypeName + " not found after rebuild");
            return false;
        }

        final UseSuperTypeRefactoring ust = new UseSuperTypeRefactoring(
            supertypeRef.getBinCIType(),
            IDEController.getInstance().createProjectContext()){

            @Override
            public String getDescription() {
                return extractor.getDescription() + " and use it where possible";
            }

            @Override
            public String getName(){
                return extractor.getName();
            }
        };

        ust.getTransformationManager().getEditorManager().setPersistantLineManager(true);
        ust.setSupertype(supertypeRef);
        ust.setSubtypes(Collections.singletonList(subtypeRef));
        ust.setUseInstanceOf(false);

        status.addEntry(ust.checkPreconditions());
        status.addEntry(ust.checkUserInput());
        if (status != null && status.isOk()){
          // FIXME: temporary solution to RIM-765 just to make RIT stable
          /*LineManager lineManager = extractor.getTransformationManager()
              .getEditorManager().getLineManager();
          lineManager.remapSources(context);
          ust.getTransformationManager().getEditorManager().setLineManager(
              lineManager);*/
            status.addEntry(ust.apply());
        }
        return status != null && status.isOk();
    }

}


text:
<?php
namespace Airmotion\RedmineReminder;

use Symfony\Component\Console\Application;
use Airmotion\RedmineReminder\Command\ListResolvedIssuesCommand;
use Airmotion\RedmineReminder\Command\SendResolvedIssuesCommand;
use Airmotion\RedmineReminder\Configuration;
/**
 * RedmineReminder application.
 *
 * @author Fridolin Koch <fridolin.koch@airmotion.de>
 */
class Reminder extends Application
{

    /**
     * Reminder constructor.
     *
     * @param array $config
     */
    public function __construct($config)
    {
        parent::__construct('Airmotion Redmine Reminder', '1.1.1');

        //load config
        Configuration::getInstance()->loadFromArray($config);

        //init twig
        $loader = new \Twig_Loader_Filesystem(__DIR__ . '/Resources/Emails');

        //set twig
        Configuration::getInstance()->setTwig(new \Twig_Environment($loader));

        //add command
        $this->add(new ListResolvedIssuesCommand());
        $this->add(new SendResolvedIssuesCommand());
    }
}


text:
layout: post
title: My new blog
description: "A review of what I hope to achieve with my new blog"
modified: 2016-02-08
tags: [jekyll]
---

Thanks for looking at my new blog.

I wanted to start a blog to help me keep track of all the things I learn and any useful resources I have used along the way.
If anyone else is able to find anything useful on here then all the better.

### Blog platform
So I've used blogging platforms before, such as Umbraco and Wordpress.
I wanted my new blog to be something simple to manage and something that would make me want to write rather than working on the blog.
So that pretty much ruled out Umbraco and Wordpress :)

Plus I wanted to learn something new. I've been teaching myself Node recently so Ghost looked pretty interesting.
However I ran in to some issues during testing with hosting Ghost. I ran in to dependency hell on Azure; that coupled with having to
pay to be able to use a custom domain put me off Azure. Ghost's own hosting looked pretty good but at $8/month, a bit more than I wanted
to pay ideally.

So I settled on Jekyll.

Being able to create posts in markdown looked like a massive benefit to me. Not only so all my posts would be
nicely source controlled. Hosting the blog on github pages is also another massive plus point.

### Setup
After reading the docs for Jekyll i was pretty disappointed. Not in Jekyll but in Windows. Jekyll is yet another tool that is not
fully supported on Windows.

I made the big decision to install Ubuntu on to my old laptop. As a Windows user through and through, I'm sure Ubuntu in itself
is going to be a learning experience and give me lots to blog about.

Setting up Jekyll itself is super straightforward, with a few commands you have your skeleton and Github pages up and running.
You can find the install instructions [here](https://help.github.com/articles/using-jekyll-with-pages/)

The only pain point I had was with the dependency on Ruby. Using the standard apt-get on Ubuntu I could only figure out how to install 1.9.
But for Jekyll I needed 2 or higher. From looking through Stack Overflow I could have downloaded the source and complied it but as a
Linux newbie that seemed a little too far off the beaten track for me yet.

Then I found that Brightbox cloud hosting have provided more up to date Ruby packages. Even I was able to follow the instructions they provide [here](https://www.brightbox.com/docs/ruby/ubuntu/)

### Next Steps
I want to keep improving this blog

* Maybe add a theme
* Add new posts on what I've been learning
* Use this blog to help me improve my front end technologies

Thanks for reading,
Martin


text:
layout: docs
title: Utility API
description: The utility API is a Sass based tool to generate utility classes.
group: utilities
aliases: "/docs/5.0/utilities/"
toc: true
---

The bootstrap utilities are generated with the utility API which can be used to change or extend Bootstrap's utility classes. If you don't have any idea what Sass maps are, you can consult the [official docs](https://sass-lang.com/documentation/values/maps) to get started.

The `$utilities` map contains all utilities and is later merged with your custom `$utilities` map if present. The utility map contains a keyed list of utility groups which accept the following options:

- `property`: Name of the property, this can be a string or an array of strings (needed for eg. horizontal paddings or margins).
- `responsive` _(optional)_: Boolean indicating if responsive classes need to be generated. `false` by default.
- `rfs` _(optional)_: Variable to enable fluid rescaling. Have a look at the [RFS]({{< docsref "/getting-started/rfs" >}}) page to find out how this works. `false` by default.
- `class` _(optional)_: Variable to change the class name if you don't want it to be the same as the property. In case you don't provide the `class` key and `property` key is an array of strings, the class name will be the first element of the `property` array.
- `values`: This can be a list of values or a map if you don't want the class name to be the same as the value. If null is used as map key, it isn't rendered.
- `print` _(optional)_: Boolean indicating if print classes need to be generated. `false` by default.

## Adding utilities to the utility API

All utility variables are added to the `$utilities` variable. Custom utility groups can added like this:

```scss
$utilities: (
  "opacity": (
    property: opacity,
    values: (
      0: 0,
      25: .25,
      50: .5,
      100: 1,
    )
  )
 );
```

Output:

```css
.opacity-0 {
  opacity: 0;
}
.opacity-25 {
  opacity: .25;
}
.opacity-75 {
  opacity: .75;
}
.opacity-100 {
  opacity: 1;
}
```

## Changing the class prefix

With the `class` option, the class prefix can be changed:

```scss
$utilities: (
  "opacity": (
    property: opacity,
    class: o,
    values: (
      0: 0,
      25: .25,
      50: .5,
      100: 1,
    )
  )
 );
```

Output:

```css
.o-0 {
  opacity: 0;
}
.o-25 {
  opacity: .25;
}
.o-75 {
  opacity: .75;
}
.o-100 {
  opacity: 1;
}
```

## Responsive utilities

With the `responsive` option, responsive utility classes can be generated:

```scss
$utilities: (
  "opacity": (
    property: opacity,
    responsive: true,
    values: (
      0: 0,
      25: .25,
      50: .5,
      100: 1,
    )
  )
 );
```

Output:

```css
.opacity-0 {
  opacity: 0;
}
.opacity-25 {
  opacity: .25;
}
.opacity-75 {
  opacity: .75;
}
.opacity-100 {
  opacity: 1;
}
@media (min-width: 576px) {
  .opacity-sm-0 {
    opacity: 0;
  }
  .opacity-sm-25 {
    opacity: .25;
  }
  .opacity-sm-75 {
    opacity: .75;
  }
  .opacity-sm-100 {
    opacity: 1;
  }
}
@media (min-width: 768px) {
  .opacity-md-0 {
    opacity: 0;
  }
  .opacity-md-25 {
    opacity: .25;
  }
  .opacity-md-75 {
    opacity: .75;
  }
  .opacity-md-100 {
    opacity: 1;
  }
}
@media (min-width: 992px) {
  .opacity-lg-0 {
    opacity: 0;
  }
  .opacity-lg-25 {
    opacity: .25;
  }
  .opacity-lg-75 {
    opacity: .75;
  }
  .opacity-lg-100 {
    opacity: 1;
  }
}
@media (min-width: 1200px) {
  .opacity-xl-0 {
    opacity: 0;
  }
  .opacity-xl-25 {
    opacity: .25;
  }
  .opacity-xl-75 {
    opacity: .75;
  }
  .opacity-xl-100 {
    opacity: 1;
  }
}
```

## Changing utilities

Overriding excising utilities is possible by using the same key. For example if you want more responsive overflow
utility classes you can do this:

```scss
$utilities: (
  "overflow": (
    responsive: true,
    property: overflow,
    values: visible hidden scroll auto,
  ),
);
```

## Print utilities

Enabling the `print` option will **also** generate utility classes for print.

```scss
$utilities: (
  "opacity": (
    property: opacity,
    class: o,
    print: true,
    values: (
      0: 0,
      25: .25,
      50: .5,
      100: 1,
    )
  )
 );
```

Output:

```css
.o-0 {
  opacity: 0;
}
.o-25 {
  opacity: .25;
}
.o-75 {
  opacity: .75;
}
.o-100 {
  opacity: 1;
}

@media print {
  .o-print-0 {
    opacity: 0;
  }
  .o-print-25 {
    opacity: .25;
  }
  .o-print-75 {
    opacity: .75;
  }
  .o-print-100 {
    opacity: 1;
  }
}
```

## Removing utilities

Utilities can also be removed by changing the group key to `null`:

```scss
$utilities: (
  "float": null,
);
```


text:
./deploy_scripts/push_images.sh
# ssh -o "StrictHostKeyChecking no" -i deploy_key $DEPLOY_HOST ./deploy.sh


text:
#ifndef SQLTransactionBackend_h
#define SQLTransactionBackend_h

#include "modules/webdatabase/DatabaseBasicTypes.h"
#include "modules/webdatabase/SQLStatement.h"
#include "modules/webdatabase/SQLTransactionStateMachine.h"
#include "platform/heap/Handle.h"
#include "wtf/Deque.h"
#include "wtf/Forward.h"
#include "wtf/ThreadingPrimitives.h"

namespace blink {

class Database;
class SQLErrorData;
class SQLiteTransaction;
class SQLStatementBackend;
class SQLTransaction;
class SQLTransactionBackend;
class SQLValue;

class SQLTransactionWrapper : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<SQLTransactionWrapper> {
public:
    virtual ~SQLTransactionWrapper() { }
    virtual void trace(Visitor*) { }
    virtual bool performPreflight(SQLTransactionBackend*) = 0;
    virtual bool performPostflight(SQLTransactionBackend*) = 0;
    virtual SQLErrorData* sqlError() const = 0;
    virtual void handleCommitFailedAfterPostflight(SQLTransactionBackend*) = 0;
};

class SQLTransactionBackend FINAL : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<SQLTransactionBackend>, public SQLTransactionStateMachine<SQLTransactionBackend> {
public:
    static PassRefPtrWillBeRawPtr<SQLTransactionBackend> create(Database*,
        PassRefPtrWillBeRawPtr<SQLTransaction>, PassRefPtrWillBeRawPtr<SQLTransactionWrapper>, bool readOnly);

    virtual ~SQLTransactionBackend();
    void trace(Visitor*);

    void lockAcquired();
    void performNextStep();

    Database* database() { return m_database.get(); }
    bool isReadOnly() { return m_readOnly; }
    void notifyDatabaseThreadIsShuttingDown();

    // APIs called from the frontend published:
    void requestTransitToState(SQLTransactionState);
    SQLErrorData* transactionError();
    SQLStatement* currentStatement();
    void setShouldRetryCurrentStatement(bool);
    void executeSQL(PassOwnPtrWillBeRawPtr<SQLStatement>, const String& statement,
        const Vector<SQLValue>& arguments, int permissions);

private:
    SQLTransactionBackend(Database*, PassRefPtrWillBeRawPtr<SQLTransaction>,
        PassRefPtrWillBeRawPtr<SQLTransactionWrapper>, bool readOnly);

    void doCleanup();

    void enqueueStatementBackend(PassRefPtrWillBeRawPtr<SQLStatementBackend>);

    // State Machine functions:
    virtual StateFunction stateFunctionFor(SQLTransactionState) OVERRIDE;
    void computeNextStateAndCleanupIfNeeded();

    // State functions:
    SQLTransactionState acquireLock();
    SQLTransactionState openTransactionAndPreflight();
    SQLTransactionState runStatements();
    SQLTransactionState postflightAndCommit();
    SQLTransactionState cleanupAndTerminate();
    SQLTransactionState cleanupAfterTransactionErrorCallback();

    SQLTransactionState unreachableState();
    SQLTransactionState sendToFrontendState();

    SQLTransactionState nextStateForCurrentStatementError();
    SQLTransactionState nextStateForTransactionError();
    SQLTransactionState runCurrentStatementAndGetNextState();

    void getNextStatement();

    RefPtrWillBeMember<SQLTransaction> m_frontend; // Has a reference cycle, and will break in doCleanup().
    RefPtrWillBeMember<SQLStatementBackend> m_currentStatementBackend;

    RefPtrWillBeMember<Database> m_database;
    RefPtrWillBeMember<SQLTransactionWrapper> m_wrapper;
    OwnPtr<SQLErrorData> m_transactionError;

    bool m_hasCallback;
    bool m_hasSuccessCallback;
    bool m_hasErrorCallback;
    bool m_shouldRetryCurrentStatement;
    bool m_modifiedDatabase;
    bool m_lockAcquired;
    bool m_readOnly;
    bool m_hasVersionMismatch;

    Mutex m_statementMutex;
    Deque<RefPtrWillBeMember<SQLStatementBackend> > m_statementQueue;

    OwnPtr<SQLiteTransaction> m_sqliteTransaction;
};

} // namespace blink

#endif // SQLTransactionBackend_h


text:
'use strict'

const pkg = require('../package.json')
const year = new Date().getFullYear()

function getBanner(pluginFilename) {
  return ``
}

module.exports = getBanner


text:
'use strict';

// Setting up route
angular.module('core').config(['$stateProvider', '$urlRouterProvider',
	function($stateProvider, $urlRouterProvider) {
		// Redirect to home view when route not found
		$urlRouterProvider.otherwise('/');

		// Home state routing
		$stateProvider
		.state('home', {
			url: '/',
			controller: 'HomeController as home',
			templateUrl: 'modules/core/views/home.client.view.html'
		})

		.state('about', {
			url: '/about',
			controller: 'HeaderController as hee',
			templateUrl: 'modules/core/views/about.client.view.html'
		});
	}
]);


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

<ivy-module version="2.0">
 <info organisation="CAE-Visualization-Components" module="SGL" revision="6.2.34.7" status="Development" publication="20090424220207">
  <license name="CAE Proprietary"/>
  <ivyauthor name="SGL - CAE Visualization Products" url="http://www.cae.com"/>
  <repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
  <repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true"/>
  <description homepage="http://www.cae.com"> SGL 6.2.34.7 Release Notes</description>
 </info>
 <publications>
  <artifact name="SGL" type="zip"/>
 </publications>
 <configurations>
  <conf name="BuildTimeDependencies"/>
  <conf name="RunTimeDependencies"/>
  <conf name="TestingDependencies"/>
 </configurations>
 <dependencies>
 </dependencies>
</ivy-module>


text:
<?php
namespace AccessManager\Radius\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use AccessManager\Radius\Account\Account;
use AccessManager\Radius\UserAccount;

class AccountCommand extends command {

	protected function configure()
	{
		$this->setName("am:account")
			->setDescription("Takes care of accounting user's data.")
			->addArgument("params",InputArgument::REQUIRED, "Require params for Accounting.");
	}

	protected function execute(InputInterface $input, OutputInterface $output)
	{
		 $z = $input->getArgument('params');
		$attributes = parseAttributes($z);
		$params = ['User-Name','Acct-Session-Id','Acct-Unique-Session-Id',
					'Acct-Input-Octets','Acct-Output-Octets','Acct-Input-Gigawords',
					'Acct-Output-Gigawords','Acct-Session-Time','Acct-Status-Type'];
		foreach($params as $param) {
			if( ! array_key_exists($param, $attributes)) {
				$output->writeln("Insufficient/Invalid parameters provided.");
				exit();
			}
		}
		$requestType = $attributes['Acct-Status-Type'];
		if( $requestType == 'Start')	exit(0);

	 		 $username = $attributes['User-Name'];
		$acctsessionid = $attributes['Acct-Session-Id'];
		 $acctuniqueid = $attributes['Acct-Unique-Session-Id'];
		  $sessiontime = $attributes['Acct-Session-Time'];
		  $inputoctets = $attributes['Acct-Input-Octets'];
		 $outputoctets = $attributes['Acct-Output-Octets'];
			$inputgigs = $attributes['Acct-Input-Gigawords'];
		   $outputgigs = $attributes['Acct-Output-Gigawords'];

		   $user = new UserAccount($username);
			$plan = $user->getActivePlan();
			$plan->fetchPlanDetails($acctsessionid, $acctuniqueid);

		$account = new Account($plan);

		$account->takeTime($sessiontime)
				->takeData($inputoctets, $inputgigs, $outputoctets, $outputgigs)
				->setupAccounting()
				->countTime()
				->countData()
				->updateDatabase();
		if( $requestType != 'Stop' )
		{
			$account->disconnectExpired();
		}
	}

}

//end of file AccountCommand.php