text:
Template.hipaaRibbon.events({
  'keyup #hipaaSearchFilter': function () {
    Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val());
  },
  "change #beginDateInput": function (event, template) {
    Session.set("beginDateFilter", $('#beginDateInput').val() + "T00:00:00.000Z");
  },
  "change #endDateInput": function (event, template) {
    Session.set("endDateFilter", $('#endDateInput').val() + "T00:00:00.000Z");
  },
  'change #actionFilter': function(e) {
      var actionType = e.currentTarget.value;
    Session.set("hipaaTypeFilter", actionType);
  },
  'click #filterCreatedButton': function () {
    Session.set("hipaaTypeFilter", 'create');
  },
  'click #filterModifiedButton': function () {
    Session.set("hipaaTypeFilter", 'modify');
  },
  'click #filterViewedButton': function () {
    Session.set("hipaaTypeFilter", 'viewed');
  },
  'click #filterAllButton': function () {
    Session.set("hipaaTypeFilter", '');
  },
  'click #searchClear': function() {
    Session.set("hipaaSearchFilter", '');
  }
});

var ribbonBreakPoint = 760;

Meteor.startup(function(){
  $(window).resize(function(evt) {
    Session.set("ribbonWidth", $('#hipaaRibbon').width());
  });
});

Template.hipaaRibbon.helpers({
  getRibbonClass: function () {
    var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
    if (hipaaAuditLog && hipaaAuditLog.classes) {
      return hipaaAuditLog.classes.ribbon;
    } else {
      return null;
    }
  },
  getSelectClass: function () {
    var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
    if (hipaaAuditLog && hipaaAuditLog.classes) {
      return hipaaAuditLog.classes.select;
    } else {
      return null;
    }
  },
  getInputClass: function () {
    var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
    if (hipaaAuditLog && hipaaAuditLog.classes) {
      return hipaaAuditLog.classes.input;
    } else {
      return null;
    }
  },
  getHipaaSearchFilter: function () {
    return Session.get('hipaaSearchFilter');
  },
  getBeginDate: function () {
    return moment(Session.get("beginDateFilter")).format("YYYY-MM-DD");
  },
  getEndDate: function () {
    return moment(Session.get("endDateFilter")).format("YYYY-MM-DD");
  }
});


text:
  + Serves vector features
  + Can be transactional
  + Good for large datasets

redpajama_set_name: RedPajamaGithub


text:
package com.bbva.arq.devops.ae.mirrorgate.repository;

import com.bbva.arq.devops.ae.mirrorgate.model.Issue;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

public interface IssueRepository extends CrudRepository<Issue, String>, IssueRepositoryCustom {

    @Query(value = "{$or:[{projectName: {$in: ?0 }},{keywords:{$elemMatch:{$in: ?0 }}}], sprintAssetState: 'ACTIVE'}")
    List<Issue> findActiveUserStoriesByBoards(final List<String> boards, final Sort sort);

    List<Issue> findAllByTypeAndPiNames(final String type, final String piName);

    Issue findFirstByIssueIdAndCollectorId(final String issueId, final String collectorId);

    List<Issue> findAllByParentsKeysIn(final List<String> keys);

    List<Issue> findAllByNumberInAndType(final List<String> keys, final String type);

    void deleteByIssueIdAndCollectorId(final String id, final String collectorId);

    List<Issue> findByKeywordsInAndTypeAndStatusNot(final List<String> boards, final String type, final String status);
}


text:
require 'active_support/inflector'

module SmartAnswer
  class Node
    attr_accessor :flow
    attr_reader :name, :calculations, :precalculations

    def initialize(flow, name, &block)
      @flow = flow
      @name = name
      @on_response_blocks = []
      @calculations = []
      @precalculations = []
      instance_eval(&block) if block_given?
    end

    def to_sym
      name.to_sym
    end

    def to_s
      name.to_s
    end

    def filesystem_friendly_name
      to_s.sub(/\?$/, '')
    end

    def on_response(&block)
      @on_response_blocks << Block.new(&block)
    end

    def calculate(variable_name, &block)
      @calculations << Calculation.new(variable_name, &block)
    end

    def precalculate(variable_name, &block)
      @precalculations << Calculation.new(variable_name, &block)
    end

    def evaluate_precalculations(current_state)
      new_state = current_state.dup
      @precalculations.each do |calculation|
        new_state = calculation.evaluate(new_state)
      end
      new_state
    end

    def outcome?
      false
    end

    def question?
      false
    end

    def template_directory
      load_path = FlowRegistry.instance.load_path
      Pathname.new(load_path).join(String(@flow.name))
    end

    def flow_name
      @flow.name
    end
  end
end


text:
#pragma once
#include "ofxDatGuiLabel.h"
#include "ofxDatGuiButton.h"
#include "ofxDatGuiSlider.h"
#include "ofxDatGuiTextInput.h"
#include "ofxDatGuiFRM.h"
#include "ofxDatGui2dPad.h"
#include "ofxDatGuiColorPicker.h"
#include "ofxDatGuiMatrix.h"
#include "ofxDatGuiTimeGraph.h"
#include "ofxDatGuiScrollView.h"

class ofxDatGuiGroup : public ofxDatGuiButton {

    public:

        ofxDatGuiGroup(string label) : ofxDatGuiButton(label)
        {
            mIsExpanded = false;
        }

        void setPosition(int x, int y)
        {
            ofxDatGuiComponent::setPosition(x, y);
            layout();
        }

        void expand()
        {
            mIsExpanded = true;
            layout();
        }

        void collapse()
        {
            mIsExpanded = false;
            layout();
        }

        int getHeight()
        {
            return mHeight;
        }

        bool getIsExpanded()
        {
            return mIsExpanded;
        }

        void draw()
        {
            if (mVisible){
                ofPushStyle();
                ofxDatGuiButton::draw();
                ofSetColor(mIcon.color);
                mImage.draw(x+mIcon.x, y+mIcon.y, mIcon.size, mIcon.size);
                if (mIsExpanded) {
                    int mHeight = mStyle.height;
                    ofSetColor(mStyle.guiBackground, mStyle.opacity);
                    ofDrawRectangle(x, y+mHeight, mStyle.width, mStyle.vMargin);
                    for(int i=0; i<children.size(); i++) {
                        mHeight += mStyle.vMargin;
                        children[i]->draw();
                        mHeight += children[i]->getHeight();
                        if (i == children.size()-1) break;
                        ofSetColor(mStyle.guiBackground, mStyle.opacity);
                        ofDrawRectangle(x, y+mHeight, mStyle.width, mStyle.vMargin);
                    }
                    for(int i=0; i<children.size(); i++) children[i]->drawColorPicker();
                }
                ofPopStyle();
            }
        }

    protected:

        void layout()
        {
            mHeight = mStyle.height + mStyle.vMargin;
            for (int i=0; i<children.size(); i++) {
                if (children[i]->getVisible() == false) continue;
                if (mIsExpanded == false){
                    children[i]->setPosition(x, y + mHeight);
                }   else{
                    children[i]->setPosition(x, y + mHeight);
                    mHeight += children[i]->getHeight() + mStyle.vMargin;
                }
                if (i == children.size()-1) mHeight -= mStyle.vMargin;
            }
        }

        void onMouseRelease(ofPoint m)
        {
            if (mFocused){
            // open & close the group when its header is clicked //
                ofxDatGuiComponent::onFocusLost();
                ofxDatGuiComponent::onMouseRelease(m);
                mIsExpanded ? collapse() : expand();
            // dispatch an event out to the gui panel to adjust its children //
                if (internalEventCallback != nullptr){
                    ofxDatGuiInternalEvent e(ofxDatGuiEventType::DROPDOWN_TOGGLED, mIndex);
                    internalEventCallback(e);
                }
            }
        }

        void dispatchInternalEvent(ofxDatGuiInternalEvent e)
        {
            if (e.type == ofxDatGuiEventType::VISIBILITY_CHANGED) layout();
            internalEventCallback(e);
        }

        int mHeight;
        ofImage mImage;
        bool mIsExpanded;

};

class ofxDatGuiFolder : public ofxDatGuiGroup {

    public:

        ofxDatGuiFolder(string label, ofColor color = ofColor::white) : ofxDatGuiGroup(label)
        {
        // all items within a folder share the same stripe color //
            mStyle.stripe.color = color;
            mType = ofxDatGuiType::FOLDER;
            setTheme(ofxDatGuiComponent::theme.get());
        }

        void setTheme(ofxDatGuiTheme* theme)
        {
            setComponentStyle(theme);
            mImage.load(theme->icon.dropdown);
            setWidth(theme->layout.width, theme->layout.labelWidth);
        // reassign folder color to all components //
            for(auto i:children) i->setStripeColor(mStyle.stripe.color);
        }

        void setWidth(int width, float labelWidth = 1)
        {
            ofxDatGuiComponent::setWidth(width, labelWidth);
            mLabel.width = mStyle.width;
            mLabel.rightAlignedXpos = mIcon.x - mLabel.margin;
            ofxDatGuiComponent::positionLabel();
        }

        void drawColorPicker()
        {
            for(int i=0; i<pickers.size(); i++) pickers[i]->drawColorPicker();
        }

        void dispatchButtonEvent(ofxDatGuiButtonEvent e)
        {
            if (buttonEventCallback != nullptr) {
                buttonEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatchSliderEvent(ofxDatGuiSliderEvent e)
        {
            if (sliderEventCallback != nullptr) {
                sliderEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatchTextInputEvent(ofxDatGuiTextInputEvent e)
        {
            if (textInputEventCallback != nullptr) {
                textInputEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatchColorPickerEvent(ofxDatGuiColorPickerEvent e)
        {
            if (colorPickerEventCallback != nullptr) {
                colorPickerEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatch2dPadEvent(ofxDatGui2dPadEvent e)
        {
            if (pad2dEventCallback != nullptr) {
                pad2dEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatchMatrixEvent(ofxDatGuiMatrixEvent e)
        {
            if (matrixEventCallback != nullptr) {
                matrixEventCallback(e);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        void dispatchFolderEvent(ofxDatGuiFolderEvent e)
    {
        if(folderEventCallback != nullptr) {
            folderEventCallback(e);
        } else {
            ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
        }
    }

    /*
        component add methods
    */

        ofxDatGuiLabel* addLabel(string label)
        {
            ofxDatGuiLabel* lbl = new ofxDatGuiLabel(label);
            lbl->setStripeColor(mStyle.stripe.color);
            attachItem(lbl);
            return lbl;
        }

        ofxDatGuiButton* addButton(string label)
        {
            ofxDatGuiButton* button = new ofxDatGuiButton(label);
            button->setStripeColor(mStyle.stripe.color);
            button->onButtonEvent(this, &ofxDatGuiFolder::dispatchButtonEvent);
            attachItem(button);
            return button;
        }

        ofxDatGuiToggle* addToggle(string label, bool enabled = false)
        {
            ofxDatGuiToggle* toggle = new ofxDatGuiToggle(label, enabled);
            toggle->setStripeColor(mStyle.stripe.color);
            toggle->onButtonEvent(this, &ofxDatGuiFolder::dispatchButtonEvent);
            attachItem(toggle);
            return toggle;
        }

        ofxDatGuiSlider* addSlider(string label, float min, float max)
        {
            ofxDatGuiSlider* slider = addSlider(label, min, max, (max+min)/2);
            return slider;
        }

        ofxDatGuiSlider* addSlider(string label, float min, float max, float val)
        {
            ofxDatGuiSlider* slider = new ofxDatGuiSlider(label, min, max, val);
            slider->setStripeColor(mStyle.stripe.color);
            slider->onSliderEvent(this, &ofxDatGuiFolder::dispatchSliderEvent);
            attachItem(slider);
            return slider;
        }

        ofxDatGuiSlider* addSlider(ofParameter<int> & p){
            ofxDatGuiSlider* slider = new ofxDatGuiSlider(p);
            slider->setStripeColor(mStyle.stripe.color);
            slider->onSliderEvent(this, &ofxDatGuiFolder::dispatchSliderEvent);
            attachItem(slider);
            return slider;
        }

        ofxDatGuiSlider* addSlider(ofParameter<float> & p){
            ofxDatGuiSlider* slider = new ofxDatGuiSlider(p);
            slider->setStripeColor(mStyle.stripe.color);
            slider->onSliderEvent(this, &ofxDatGuiFolder::dispatchSliderEvent);
            attachItem(slider);
            return slider;
        }

        ofxDatGuiTextInput* addTextInput(string label, string value)
        {
            ofxDatGuiTextInput* input = new ofxDatGuiTextInput(label, value);
            input->setStripeColor(mStyle.stripe.color);
            input->onTextInputEvent(this, &ofxDatGuiFolder::dispatchTextInputEvent);
            attachItem(input);
            return input;
        }

        ofxDatGuiColorPicker* addColorPicker(string label, ofColor color = ofColor::black)
        {
            shared_ptr<ofxDatGuiColorPicker> picker(new ofxDatGuiColorPicker(label, color));
            picker->setStripeColor(mStyle.stripe.color);
            picker->onColorPickerEvent(this, &ofxDatGuiFolder::dispatchColorPickerEvent);
            attachItem(picker.get());
            pickers.push_back(picker);
            return picker.get();
        }

        ofxDatGuiFRM* addFRM(float refresh = 1.0f)
        {
            ofxDatGuiFRM* monitor = new ofxDatGuiFRM(refresh);
            monitor->setStripeColor(mStyle.stripe.color);
            attachItem(monitor);
            return monitor;
        }

        ofxDatGuiBreak* addBreak()
        {
            ofxDatGuiBreak* brk = new ofxDatGuiBreak();
            attachItem(brk);
            return brk;
        }

        ofxDatGui2dPad* add2dPad(string label)
        {
            ofxDatGui2dPad* pad = new ofxDatGui2dPad(label);
            pad->setStripeColor(mStyle.stripe.color);
            pad->on2dPadEvent(this, &ofxDatGuiFolder::dispatch2dPadEvent);
            attachItem(pad);
            return pad;
        }

        ofxDatGuiMatrix* addMatrix(string label, int numButtons, bool showLabels = false)
        {
            ofxDatGuiMatrix* matrix = new ofxDatGuiMatrix(label, numButtons, showLabels);
            matrix->setStripeColor(mStyle.stripe.color);
            matrix->onMatrixEvent(this, &ofxDatGuiFolder::dispatchMatrixEvent);
            attachItem(matrix);
            return matrix;
        }

        ofxDatGuiWaveMonitor* addWaveMonitor(string label, float frequency, float amplitude)
        {
            ofxDatGuiWaveMonitor* monitor = new ofxDatGuiWaveMonitor(label, frequency, amplitude);
            monitor->setStripeColor(mStyle.stripe.color);
            attachItem(monitor);
            return monitor;
        }

        ofxDatGuiValuePlotter* addValuePlotter(string label, float min, float max)
        {
            ofxDatGuiValuePlotter* plotter = new ofxDatGuiValuePlotter(label, min, max);
            plotter->setStripeColor(mStyle.stripe.color);
            attachItem(plotter);
            return plotter;
        }

        void attachItem(ofxDatGuiComponent* item)
        {
            item->setIndex(children.size());
            item->onInternalEvent(this, &ofxDatGuiFolder::dispatchInternalEvent);
            children.push_back(item);
        }

        ofxDatGuiComponent* getComponent(ofxDatGuiType type, string label)
        {
            for (int i=0; i<children.size(); i++) {
                if (children[i]->getType() == type){
                    if (children[i]->is(label)) return children[i];
                }
            }
            return NULL;
        }

        static ofxDatGuiFolder* getInstance() { return new ofxDatGuiFolder("X"); }

    protected:

        vector<shared_ptr<ofxDatGuiColorPicker>> pickers;

    void onMouseRelease(ofPoint m)
    {
        if (mFocused){
            // open & close the group when its header is clicked //
            ofxDatGuiGroup::onMouseRelease(m);
                // dispatch event out to main application //
                if (folderEventCallback != nullptr) {
                    ofxDatGuiFolderEvent e(this, mIsExpanded);
                    folderEventCallback(e);
                }   else{
                    ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
                }
        }
    }

    private:

    void onFolderChanged(ofxDatGuiFolderEvent e)
    {
        if (folderEventCallback != nullptr) {
            ofxDatGuiFolderEvent e1(this, mIsExpanded);
            folderEventCallback(e1);
        }   else{
            ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
        }
    }

};

class ofxDatGuiDropdownOption : public ofxDatGuiButton {

    public:

        ofxDatGuiDropdownOption(string label) : ofxDatGuiButton(label)
        {
            mType = ofxDatGuiType::DROPDOWN_OPTION;
            setTheme(ofxDatGuiComponent::theme.get());
        }

        void setTheme(ofxDatGuiTheme* theme)
        {
            ofxDatGuiButton::setTheme(theme);
            mStyle.stripe.color = theme->stripe.dropdown;
        }

        void setWidth(int width, float labelWidth = 1)
        {
            ofxDatGuiComponent::setWidth(width, labelWidth);
            mLabel.width = mStyle.width;
            mLabel.rightAlignedXpos = mIcon.x - mLabel.margin;
            ofxDatGuiComponent::positionLabel();
        }

};

class ofxDatGuiDropdown : public ofxDatGuiGroup {

    public:

        ofxDatGuiDropdown(string label, const vector<string>& options = vector<string>()) : ofxDatGuiGroup(label)
        {
            mOption = 0;
            mType = ofxDatGuiType::DROPDOWN;
            for(int i=0; i<options.size(); i++){
                ofxDatGuiDropdownOption* opt = new ofxDatGuiDropdownOption(options[i]);
                opt->setIndex(children.size());
                opt->onButtonEvent(this, &ofxDatGuiDropdown::onOptionSelected);
                children.push_back(opt);
            }
            setTheme(ofxDatGuiComponent::theme.get());
        }

        void setTheme(ofxDatGuiTheme* theme)
        {
            setComponentStyle(theme);
            mImage.load(theme->icon.dropdown);
            mStyle.stripe.color = theme->stripe.dropdown;
            setWidth(theme->layout.width, theme->layout.labelWidth);
        }

        void setWidth(int width, float labelWidth = 1)
        {
            ofxDatGuiComponent::setWidth(width, labelWidth);
            mLabel.width = mStyle.width;
            mLabel.rightAlignedXpos = mIcon.x - mLabel.margin;
            ofxDatGuiComponent::positionLabel();
        }

        void select(int cIndex)
        {
        // ensure value is in range //
            if (cIndex < 0 || cIndex >= children.size()){
                ofLogError() << "ofxDatGuiDropdown->select("<<cIndex<<") is out of range";
            }   else{
                setLabel(children[cIndex]->getLabel());
            }
        }

        int size()
        {
            return children.size();
        }

        ofxDatGuiDropdownOption* getChildAt(int index)
        {
            return static_cast<ofxDatGuiDropdownOption*>(children[index]);
        }

        ofxDatGuiDropdownOption* getSelected()
        {
            return static_cast<ofxDatGuiDropdownOption*>(children[mOption]);
        }

        static ofxDatGuiDropdown* getInstance() { return new ofxDatGuiDropdown("X"); }

    private:

        void onOptionSelected(ofxDatGuiButtonEvent e)
        {
            for(int i=0; i<children.size(); i++) if (e.target == children[i]) mOption = i;
            setLabel(children[mOption]->getLabel());
            collapse();
            if (internalEventCallback != nullptr){
                ofxDatGuiInternalEvent e(ofxDatGuiEventType::DROPDOWN_TOGGLED, mIndex);
                internalEventCallback(e);
            }
            if (dropdownEventCallback != nullptr) {
                ofxDatGuiDropdownEvent e1(this, mIndex, mOption);
                dropdownEventCallback(e1);
            }   else{
                ofxDatGuiLog::write(ofxDatGuiMsg::EVENT_HANDLER_NULL);
            }
        }

        int mOption;

};


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.document;

/**
 * The rank type of a field. For now this is just a container of a string name.
 * This class is immutable.
 *
 * @author  bratseth
 */
public enum RankType {

    /** *implicit* default: No type has been set. */
    DEFAULT,

    // Rank types which can be set explicitly. These are defined for Vespa in NativeRankTypeDefinitionSet
    IDENTITY, ABOUT, TAGS, EMPTY;

    @Override
    public String toString() {
        return "rank type " + name().toLowerCase();
    }

    /**
     * Returns the rank type from a string, regardless of its case.
     *
     * @param  rankTypeName a rank type name in any casing
     * @return the rank type found
     * @throws IllegalArgumentException if not found
     */
    public static RankType fromString(String rankTypeName) {
        try {
            return RankType.valueOf(rankTypeName.toUpperCase());
        }
        catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("Unknown rank type '" + rankTypeName + "'. Supported rank types are " +
                                               "'identity', 'about', 'tags' and 'empty'.");
        }
    }

}


text:
title: "What influenced and inspired you to learn how to code?"
date: 2015-04-26
categories:
  - blog
description: Take the time to think through this question and become comfortable and confident answering it. Was there a problem you were looking to solve or change? Do you enjoy problem solving?
image: https://i.stack.imgur.com/7cBUc.jpg
---

## What influenced and inspired you to learn how to code?

### Take the time to think through this question and become comfortable and confident answering it. Was there a problem you were looking to solve or change? Do you enjoy problem solving?

When I was in elementary school, my goal was to become a vet. I was 10, I had just gotten my first dog, Nefer, and I was just hooked. Before this period, I had never considered a formal career choice. It hadn't even crossed my mind. But when I found out I could take care of them for a living, I thought I was set. I realized later I don't actually like every animal out there (like cats, for example) and I realized vets had to like all kinds of animals. It became out of the question.

So, later in middle school, I turned to focus on biology. I was sure I wanted to become a biologist, venture into the unexplored fields of pathology and find the next great vaccine. It also didn't hurt that my biology professor was so inspiring.

However, in high school, biology alone felt like it had a limited scope, and so once again, I pivoted my attention to bioinformatics, the combination of biology and computer science. "This is where all the innovation is happening!", I thought.

And that would be that.

Or so I thought.

As much as I loved the field of biology (and I still do), I couldn't actually see myself getting a bachelor's degree in biology.

To me, a bachelor's in biology would equate to 4 years of drudgery involving busy work where I would be competing with a whole bunch of aspiring medical school zombie students.

Also, I was starting to resent the overall formal education system even though I doing well academically by my family's standards.

My junior year of high school, I figured, well, why don't I just major in computer science? It's the other half of bioinformatics that I have little to no experience in. And once I finished my degree in CS, I could still do on to work in bioinformatics. It was a win, win!

So I went out on my quest to learn how to code. The holy grail in question was enough programming experience to be able to fly through my freshman year in college. And fly I did. Through the learning, anyways.

I realized after roughly a year of venturing into the land of Lisp (that's a joke), Python, JavaScript`, HTML, and CSS all on my own virtually that I LOVE CODING.

I loved feeling like this kind of digital wizard that could literally create something out of thin air (or with a good text editor).

Computer science turned into something I wanted to do for the long-term, not just this stepping stone to a higher learning quest.

This big change in mindset had small beginnings, but it's changed me for the better, and I find myself delving deeper into the infinite cave that is covered with digital hieroglyphics.

**There are no regrets.** **I'm not looking back.** **There is no pivot.**


text:
import React from 'react'
import styled from 'styled-components'
import * as styles from 'styles'
import sword from 'icons/swords.svg'

const StyledWieldButton = styled.div`
    color: black;
    cursor: pointer;
    border-radius: 30px;
`

const StyledWieldButtonWithHover = styled.div`
    color: black;
    cursor: pointer;
    border-radius: 30px;
    ${styles.buttonHover('Wield', -2)}
`

export default function WieldButton (props) {
    if (props.hover) {
        return (

        )
    } else {
        return (

        )
    }
}


text:
using System.Linq;
using MVCForum.Domain.DomainModel;
using MVCForum.Domain.DomainModel.Attributes;
using MVCForum.Domain.Interfaces.API;
using MVCForum.Domain.Interfaces.Badges;

namespace Badges.VoteUp
{
    [Id("2ac1fc11-2f9e-4d5a-9df4-29715f10b6d1")]
    [Name("PosterVoteUp")]
    [DisplayName("First Vote Up Received")]
    [Description("This badge is awarded to users after they receive their first vote up from another user.")]
    [Image("PosterVoteUpBadge.png")]
    public class PosterVoteUpBadge : IVoteUpBadge
    {
        public bool Rule(MembershipUser user, IMVCForumAPI api)
        {
            return user.Posts != null && user.Posts.Any(post => post.Votes.Count > 0);
        }
    }
}


text:
package net.lospi.juno.estimation.proposal.ccp.delete;

import net.lospi.juno.estimation.proposal.ChainSegment;
import net.lospi.juno.estimation.proposal.Modification;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

@Test(groups="unit")
public class CcpDeletionModificationBuilderTest {
    private ChainSegment replacement;

    @BeforeMethod
    public void setUp(){
        replacement = mock(ChainSegment.class);
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildBeforeSettingAnyValues() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().build();
    }

    @Test(expectedExceptionsMessageRegExp = "You cannot set properties for an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingStartIdentity() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().start(5).identity().build();
    }

    @Test(expectedExceptionsMessageRegExp = "You cannot set properties for an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingEndIdentity() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().end(5).identity().build();
    }

    @Test(expectedExceptionsMessageRegExp = "You cannot set properties for an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingProbabilityIdentity() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().logAlterSelectionProbability(5).identity().build();
    }

    @Test(expectedExceptionsMessageRegExp = "You cannot set properties for an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingReplancementIdentity() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().replacement(replacement).identity().build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingProbabilityOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().logAlterSelectionProbability(5).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingStartOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().start(5).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingReplacementOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().replacement(replacement).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingEndOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().end(5).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingStartEndOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().start(5).end(10).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingStartEndReplacementOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().start(5).end(10).replacement(replacement).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildSettingStartEndProbOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().start(5).end(10).logAlterSelectionProbability(-.123).build();
    }

    @Test(expectedExceptionsMessageRegExp = "You must set either properties or an identity modification.", expectedExceptions = IllegalStateException.class)
    public void buildReplacementProbOnly() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        builder.with().replacement(replacement).logAlterSelectionProbability(-.123).build();
    }

    public void deletion() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        Modification result = builder.with().start(5).end(10).logAlterSelectionProbability(-20).replacement(replacement).build();
        assertThat(result).isOfAnyClassIn(CcpDeletionModification.class);
        assertThat(((CcpDeletionModification)result).getStart()).isEqualTo(5);
        assertThat(((CcpDeletionModification)result).getEnd()).isEqualTo(10);
        assertThat(((CcpDeletionModification)result).getLogAlterSelectionProbability()).isEqualTo(-20);
        assertThat(((CcpDeletionModification)result).getReplacement()).isEqualTo(replacement);
        assertThat(result.isIdentity()).isFalse();
    }

        public void testIdentity() throws Exception {
        CcpDeletionModificationBuilder builder = new CcpDeletionModificationBuilder();
        Modification result = builder.with().identity().build();
        assertThat(result.isIdentity()).isTrue();
    }
}


text:
<?php

use \Reshi\Constraints\Equals;

class EqualsTest extends PHPUnit_Framework_TestCase
{
    protected $equals;

    /**
     * @dataProvider arrayProvider
     */
    public function testEvaluate($paramOne, $paramTwo)
    {
        $this->equals = new Equals($paramTwo);
        $this->assertTrue($this->equals->evaluate($paramOne), "Failed to assert that the array is of the expected size");
    }

    public function testEvaluateWithWrongData()
    {
        $this->equals = new Equals(null);
        $this->assertFalse($this->equals->evaluate("hello"), "Failed to assert that 'null' is not equal to 'hello'");
    }

    public function arrayProvider()
    {
        return array(
            array(0, 0),
            array(1.0, 1.0),
            array("hello", "hello"),
            array(TRUE, TRUE),
            array(FALSE, FALSE),
            array(NULL, NULL),
            array(new StdClass, new StdClass),
        );
    }

    public function testGetName()
    {
        $this->equals = new Equals(0);
        $this->assertEquals($this->equals->getName(), "EQUALS", "Failed to assert COUNT is the constraint name.");
    }
}


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

<title>org.voltdb (VoltDB Server APIs)</title>
<meta name="date" content="2013-12-09">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

org.voltdb

Classes

SQLStmt

VoltProcedure

VoltTable

VoltTable.ColumnInfo

VoltTableRow

Enums

VoltType

Exceptions

VoltProcedure.VoltAbortException

Annotation Types

ProcInfo


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/secureboot/trusted/tpmLogMgr.C $                      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2021                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* 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.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 * @file TpmLogMgr.C
 *
 * @brief TPM Event log manager
 */

/////////////////////////////////////////////////////////////////
// NOTE: This file is exportable as TSS-Lite for skiboot/PHYP  //
/////////////////////////////////////////////////////////////////

// ----------------------------------------------
// Includes
// ----------------------------------------------
#include <string.h>
#include <endian.h>
#include "tpmLogMgr.H"
#ifdef __HOSTBOOT_MODULE
#include <sys/mm.h>
#include <util/align.H>
#include <secureboot/trustedboot_reasoncodes.H>
#else
#include "trustedboot_reasoncodes.H"
#endif
#include "trustedbootUtils.H"
#include "trustedboot.H"
#include "trustedTypes.H"

#ifdef __cplusplus
namespace TRUSTEDBOOT
{
#endif

    uint32_t TCG_EfiSpecIdEventStruct_size(TCG_EfiSpecIdEventStruct* val)
    {
        return (sizeof(TCG_EfiSpecIdEventStruct) + val->vendorInfoSize);
    }

#ifdef __HOSTBOOT_MODULE
    void TpmLogMgr_initialize(TpmLogMgr* i_val)
    {
        assert(i_val != nullptr, "TpmLogMgr_initialize was passed a nullptr");
        const char vendorInfo[] = "IBM";
        const char eventSignature[] = "Spec ID Event03";
        TCG_EfiSpecIdEventStruct* eventData = NULL;

        TCG_PCR_EVENT eventLogEntry;

        TRACUCOMP( g_trac_trustedboot, ">>initialize()");

        memset(i_val, 0, sizeof(TpmLogMgr));
        i_val->logMaxSize = TPMLOG_BUFFER_SIZE;

        mutex_init( &i_val->logMutex );
        mutex_lock( &i_val->logMutex );

        // Assign our new event pointer to the start
        i_val->newEventPtr = i_val->eventLog;
        memset(i_val->eventLog, 0, TPMLOG_BUFFER_SIZE);

        memset(&eventLogEntry, 0, sizeof(eventLogEntry));
        eventData = (TCG_EfiSpecIdEventStruct*) eventLogEntry.event;

        // Add the header event log
        // Values here come from the PC ClientSpecificPlatformProfile spec
        eventLogEntry.eventType = EV_NO_ACTION;
        eventLogEntry.pcrIndex = 0;
        eventLogEntry.eventSize = sizeof(TCG_EfiSpecIdEventStruct) +
            sizeof(vendorInfo);

        memcpy(eventData->signature, eventSignature,
                sizeof(eventSignature));
        eventData->platformClass = htole32(TPM_PLATFORM_SERVER);
        eventData->specVersionMinor = TPM_SPEC_MINOR;
        eventData->specVersionMajor = TPM_SPEC_MAJOR;
        eventData->specErrata = TPM_SPEC_ERRATA;
        eventData->uintnSize = 1;
        eventData->numberOfAlgorithms = htole32(HASH_COUNT);
        eventData->digestSizes[0].algorithmId = htole16(TPM_ALG_SHA256);
        eventData->digestSizes[0].digestSize = htole16(TPM_ALG_SHA256_SIZE);
#if HASH_COUNT > 1
        // Replace with valid algorithm ID and algorithm size if hash count > 1
        // ever used, and update trustedbootTest.H's testcases that depend on
        // HASH_COUNT > 1
        eventData->digestSizes[1].algorithmId = htole16(TPM_ALG_INVALID_ID);
        eventData->digestSizes[1].digestSize = htole16(0);
#endif
        eventData->vendorInfoSize = sizeof(vendorInfo);
        memcpy(eventData->vendorInfo, vendorInfo, sizeof(vendorInfo));
        i_val->newEventPtr = TCG_PCR_EVENT_logMarshal(&eventLogEntry,
                                                      i_val->newEventPtr);

        // Done, move our pointers
        i_val->logSize += TCG_PCR_EVENT_marshalSize(&eventLogEntry);

        mutex_unlock( &i_val->logMutex );

        // Debug display of raw data
        TRACUBIN(g_trac_trustedboot, "tpmInitialize: Header Entry",
                  i_val->eventLog, i_val->logSize);

        TRACUCOMP( g_trac_trustedboot,
                    "<<initialize() Log Size:%d",
                    i_val->logSize);
    }
#endif

    errlHndl_t TpmLogMgr_initializeUsingExistingLog(TpmLogMgr* i_val,
                                                    uint8_t* i_eventLogPtr,
                                                    uint32_t i_eventLogSize)
    {
        errlHndl_t err = TB_SUCCESS;
        TRACUCOMP( g_trac_trustedboot,
                   ">>initializeUsingExistingLog()");

        do
        {

            mutex_init( &i_val->logMutex );
            mutex_lock( &i_val->logMutex );

            i_val->logMaxSize = i_eventLogSize;
            i_val->eventLogInMem = i_eventLogPtr;

            // Ok, walk the log to figure out how big this is
            i_val->logSize = TpmLogMgr_calcLogSize(i_val);

            if (0 == i_val->logSize)
            {
                TRACFCOMP( g_trac_trustedboot,
                       "TPM LOG INIT WALK FAIL");
                /*@
                 * @errortype
                 * @reasoncode     RC_TPMLOGMGR_LOGWALKFAIL
                 * @severity       ERRL_SEV_UNRECOVERABLE
                 * @moduleid       MOD_TPMLOGMGR_INITIALIZEEXISTLOG
                 * @userdata1      0
                 * @userdata2      0
                 * @devdesc        TPM log header entry is missing.
                 * @custdesc       TPM log invalid format
                 */
                err = tpmCreateErrorLog(MOD_TPMLOGMGR_INITIALIZEEXISTLOG,
                                        RC_TPMLOGMGR_LOGWALKFAIL,
                                        0,
                                        0);
                break;
            }
            // We are good, let's move the newEventLogPtr
            i_val->newEventPtr = i_val->eventLogInMem + i_val->logSize;

        }
        while(0);

        if (TB_SUCCESS != err)
        {
            i_val->eventLogInMem = NULL;
            i_val->newEventPtr = NULL;
            i_val->logMaxSize = 0;
            i_val->logSize = 0;
        }

        mutex_unlock( &i_val->logMutex );

        return err;
    }

    errlHndl_t TpmLogMgr_addEvent(TpmLogMgr* i_val,
                                  TCG_PCR_EVENT2* i_logEvent)
    {
        errlHndl_t err = TB_SUCCESS;
        size_t newLogSize = TCG_PCR_EVENT2_marshalSize(i_logEvent);

        TRACUCOMP( g_trac_trustedboot,
                   ">>tpmAddEvent() PCR:%d Type:%d Size:%d. "
                   "(Current LS(%d) Max LS(%d))",
                   i_logEvent->pcrIndex,
                   i_logEvent->eventType,
                   static_cast<int>(newLogSize),
                   static_cast<int>(i_val->logSize),
                   static_cast<int>(i_val->logMaxSize));

        mutex_lock( &i_val->logMutex );

        do
        {
            // Need to ensure we have room for the new event
            // We have to leave room for the log full event as well
            if ((NULL == i_val->newEventPtr) ||
                (i_val->logSize + newLogSize > i_val->logMaxSize) ||
                (newLogSize > MAX_TPM_LOG_MSG))
            {
                TRACFCOMP( g_trac_trustedboot,
                           "TPM LOG ADD FAIL PNULL(%d) LS(%d) New LS(%d)"
                           " Max LS(%d) Max LMS(%d)",
                           (NULL == i_val->newEventPtr ? 0 : 1),
                           (int)i_val->logSize, (int)newLogSize,
                           (int)i_val->logMaxSize, MAX_TPM_LOG_MSG);

                /*@
                 * @errortype
                 * @reasoncode     RC_TPMLOGMGR_ADDEVENT_FAIL
                 * @severity       ERRL_SEV_UNRECOVERABLE
                 * @moduleid       MOD_TPMLOGMGR_ADDEVENT
                 * @userdata1[0:31]  Max log size
                 * @userdata1[32:63] Log buffer NULL
                 * @userdata2[0:15]  Current Log Size
                 * @userdata2[16:31] Max TPM Log Message Size
                 * @userdata2[32:63] New entry size
                 * @devdesc        TPM log buffer add failure.
                 * @custdesc       TPM log overflow
                 */
                err = tpmCreateErrorLog( MOD_TPMLOGMGR_ADDEVENT,
                                         RC_TPMLOGMGR_ADDEVENT_FAIL,
                                         static_cast<uint64_t>(
                                           i_val->logMaxSize) << 32 |
                                         (NULL == i_val->newEventPtr ? 0 : 1),
                                         TWO_UINT16_ONE_UINT32_TO_UINT64(
                                           static_cast<uint16_t>(
                                             i_val->logSize),
                                           MAX_TPM_LOG_MSG,
                                           newLogSize));

                break;
            }

            i_val->newEventPtr = TCG_PCR_EVENT2_logMarshal(i_logEvent,
                                                           i_val->newEventPtr);

            if (NULL == i_val->newEventPtr)
            {
                TRACFCOMP( g_trac_trustedboot,
                           "TPM LOG MARSHAL Fail");

                /*@
                 * @errortype
                 * @reasoncode     RC_TPMLOGMGR_ADDEVENTMARSH_FAIL
                 * @severity       ERRL_SEV_UNRECOVERABLE
                 * @moduleid       MOD_TPMLOGMGR_ADDEVENT
                 * @userdata1      0
                 * @userdata2      0
                 * @devdesc        log buffer marshal failure.
                 * @custdesc       TPM log operation failure
                 */
                err = tpmCreateErrorLog( MOD_TPMLOGMGR_ADDEVENT,
                                         RC_TPMLOGMGR_ADDEVENTMARSH_FAIL,
                                         0,
                                         0);
                break;
            }

            i_val->logSize += newLogSize;

        } while ( 0 );

        TRACUCOMP( g_trac_trustedboot,
                   "<<tpmAddEvent() LS:%d - %s",
                   (int)i_val->logSize,
                   ((TB_SUCCESS == err) ? "No Error" : "With Error") );

        mutex_unlock( &i_val->logMutex );
        return err;
    }

    uint32_t TpmLogMgr_getLogSize(TpmLogMgr* i_val)
    {
        return i_val->logSize;
    }

    void TpmLogMgr_dumpLog(TpmLogMgr* i_val)
    {

        // Debug display of raw data
        TRACUCOMP(g_trac_trustedboot, "tpmDumpLog Size : %d",
                  (int)i_val->logSize);

#ifdef __HOSTBOOT_MODULE
        // Debug display of raw data
        if (NULL == i_val->eventLogInMem)
        {
            TRACUBIN(g_trac_trustedboot, "tpmDumpLog",
                     i_val->eventLog, i_val->logSize);
        }
        else
        {
#endif
            TRACUBIN(g_trac_trustedboot, "tpmDumpLog From Memory",
                     i_val->eventLogInMem, i_val->logSize);
#ifdef __HOSTBOOT_MODULE
        }
#endif
    }

    uint32_t TpmLogMgr_calcLogSize(TpmLogMgr* i_val)
    {
        uint32_t logSize = 0;
        TCG_PCR_EVENT event;
        TCG_PCR_EVENT2 event2;
        bool errorFound = false;
        const uint8_t* prevLogHandle = NULL;
        const uint8_t* nextLogHandle = NULL;

        TRACUCOMP( g_trac_trustedboot, ">>calcLogSize");

        // Start walking events
        prevLogHandle = TpmLogMgr_getLogStartPtr(i_val);
        do
        {

            // First need to deal with the header entry
            nextLogHandle = TCG_PCR_EVENT_logUnmarshal(&event,
                                                       prevLogHandle,
                                                       sizeof(TCG_PCR_EVENT),
                                                       &errorFound);

            if (NULL == nextLogHandle || errorFound ||
                EV_NO_ACTION != event.eventType ||
                0 == event.eventSize)
            {
                TRACFCOMP( g_trac_trustedboot, "Header Marshal Failure");
                prevLogHandle = NULL;
                break;
            }

            if (( nextLogHandle - TpmLogMgr_getLogStartPtr(i_val)) >
                i_val->logMaxSize)
            {
                TRACFCOMP( g_trac_trustedboot, "calcLogSize overflow");
                prevLogHandle = NULL;
                break;
            }
            prevLogHandle = nextLogHandle;

            // Now iterate through all the other events
            while (NULL != prevLogHandle)
            {
                nextLogHandle = TCG_PCR_EVENT2_logUnmarshal(
                                               &event2,
                                               prevLogHandle,
                                               sizeof(TCG_PCR_EVENT2),
                                               &errorFound);
                if (NULL == nextLogHandle || errorFound)
                {
                    // Failed parsing so we must have hit the end of log
                    break;
                }
                if (( nextLogHandle - TpmLogMgr_getLogStartPtr(i_val)) >
                    i_val->logMaxSize)
                {
                    TRACFCOMP( g_trac_trustedboot, "calcLogSize overflow");
                    prevLogHandle = NULL;
                    break;
                }
                prevLogHandle = nextLogHandle;
            }
        }
        while (0);

        if (NULL == prevLogHandle)
        {
            logSize = 0;
        }
        else
        {
            logSize = (prevLogHandle - TpmLogMgr_getLogStartPtr(i_val));
        }
        TRACUCOMP( g_trac_trustedboot, "<<calcLogSize : %d", logSize);

        return logSize;
    }

    const uint8_t* TpmLogMgr_getFirstEvent(TpmLogMgr* i_val)
    {
        TCG_PCR_EVENT event;
        bool err = false;
        const uint8_t* result = NULL;

        // Header event in the log is always first, we skip over that
        const uint8_t* firstEvent = TpmLogMgr_getLogStartPtr(i_val);
        memset(&event, 0, sizeof(TCG_PCR_EVENT));

        firstEvent = TCG_PCR_EVENT_logUnmarshal(&event, firstEvent,
                                                sizeof(TCG_PCR_EVENT),
                                                &err);
        if (NULL != firstEvent && !err &&
            firstEvent < i_val->newEventPtr)
        {
            result = firstEvent;
        }

        return result;
    }

    const uint8_t* TpmLogMgr_getNextEvent(TpmLogMgr* i_val,
                                          const uint8_t* i_handle,
                                          TCG_PCR_EVENT2* i_eventLog,
                                          bool* o_err)
    {
        const uint8_t* l_resultPtr = NULL;
        if (NULL == i_handle)
        {
            *o_err = true;
        }
        else
        {
            memset(i_eventLog, 0, sizeof(TCG_PCR_EVENT2));
            TRACUCOMP( g_trac_trustedboot, "TPM getNextEvent 0x%p", i_handle);
            l_resultPtr = TCG_PCR_EVENT2_logUnmarshal(i_eventLog, i_handle,
                                                      sizeof(TCG_PCR_EVENT2),
                                                      o_err);
            if (NULL == l_resultPtr)
            {
                // An error was detected, ensure o_err is set
                *o_err = true;
            }
            else if (l_resultPtr >= i_val->newEventPtr)
            {
                l_resultPtr = NULL;
            }
        }

        return l_resultPtr;
    }

    TCG_PCR_EVENT2 TpmLogMgr_genLogEventPcrExtend(TPM_Pcr i_pcr,
                                                  EventTypes i_eventType,
                                                  TPM_Alg_Id i_algId_1,
                                                  const uint8_t* i_digest_1,
                                                  size_t i_digestSize_1,
                                                  TPM_Alg_Id i_algId_2,
                                                  const uint8_t* i_digest_2,
                                                  size_t i_digestSize_2,
                                                  const uint8_t* i_logMsg,
                                                  const size_t i_logMsgSize)
    {
        TCG_PCR_EVENT2 eventLog;
        size_t fullDigestSize_1 = 0;

        fullDigestSize_1 = getDigestSize(i_algId_1);

        memset(&eventLog, 0, sizeof(eventLog));
        eventLog.pcrIndex = i_pcr;
        eventLog.eventType = i_eventType;

        // Update digest information
        eventLog.digests.count = 1;
        eventLog.digests.digests[0].algorithmId = i_algId_1;
        memcpy(&(eventLog.digests.digests[0].digest),
               i_digest_1,
               (i_digestSize_1 < fullDigestSize_1 ?
                i_digestSize_1 : fullDigestSize_1));

// If only 1 hash algorithm is supported, this branch is not able to compile
#if HASH_COUNT > 1
        if (NULL != i_digest_2)
        {
            size_t fullDigestSize_2 = getDigestSize(i_algId_2);
            eventLog.digests.count = 2;
            eventLog.digests.digests[1].algorithmId = i_algId_2;
            memcpy(&(eventLog.digests.digests[1].digest),
                   i_digest_2,
                   (i_digestSize_2 < fullDigestSize_2 ?
                    i_digestSize_2 : fullDigestSize_2));
        }
#endif
        // Event field data
        eventLog.event.eventSize = i_logMsgSize;
        memset(eventLog.event.event, 0, sizeof(eventLog.event.event));
        memcpy(eventLog.event.event, i_logMsg,
               (i_logMsgSize > MAX_TPM_LOG_MSG ?
                MAX_TPM_LOG_MSG : i_logMsgSize));

        return eventLog;
    }

    uint8_t* TpmLogMgr_getLogStartPtr(TpmLogMgr* i_val)
    {
#ifdef __HOSTBOOT_MODULE
        return (i_val->eventLogInMem == NULL ?
           reinterpret_cast<uint8_t*>(&(i_val->eventLog)) :
                i_val->eventLogInMem);
#else
        return i_val->eventLogInMem;
#endif
    }

#ifdef __HOSTBOOT_MODULE
    errlHndl_t TpmLogMgr_getDevtreeInfo(TpmLogMgr* i_val,
                                        uint64_t & io_logAddr,
                                        size_t & o_allocationSize,
                                        uint64_t & o_xscomAddr,
                                        uint32_t & o_spiControllerOffset)
    {
        errlHndl_t err = NULL;

        mutex_lock( &i_val->logMutex );

        assert(io_logAddr != 0, "Invalid starting log address");
        assert(i_val->eventLogInMem == NULL,
               "getDevtreeInfo can only be called once");

        io_logAddr -= ALIGN_PAGE(TPMLOG_DEVTREE_SIZE);
        // Align to 64KB for Opal
        io_logAddr = ALIGN_DOWN_X(io_logAddr,64*KILOBYTE);

        i_val->inMemlogBaseAddr = io_logAddr;
        o_allocationSize = TPMLOG_DEVTREE_SIZE;
        o_xscomAddr = i_val->devtreeXscomAddr;
        o_spiControllerOffset = i_val->devtreeSpiControllerOffset;

        // Copy image.
        i_val->eventLogInMem = (uint8_t*)(mm_block_map(
                                 (void*)(io_logAddr),
                                 ALIGN_PAGE(TPMLOG_DEVTREE_SIZE)));
        // Copy log into new location
        memset(i_val->eventLogInMem, 0, TPMLOG_DEVTREE_SIZE);
        memcpy(i_val->eventLogInMem, i_val->eventLog, i_val->logSize);
        i_val->newEventPtr = i_val->eventLogInMem + i_val->logSize;

        mutex_unlock( &i_val->logMutex );

        TRACUCOMP( g_trac_trustedboot,
                   "<<getDevtreeInfo() Addr:%lX - %s",
                   io_logAddr,
                   ((TB_SUCCESS == err) ? "No Error" : "With Error") );
        return err;
    }

    void TpmLogMgr_setTpmDevtreeInfo(TpmLogMgr* i_val,
                                     uint64_t i_xscomAddr,
                                     uint32_t i_spiControllerOffset)
    {
        i_val->devtreeXscomAddr = i_xscomAddr;
        i_val->devtreeSpiControllerOffset = i_spiControllerOffset;
    }

    void TpmLogMgr_relocateTpmLog(TpmLogMgr* i_val,
                                  uint8_t* i_newLog,
                                  size_t i_maxSize)
    {
        mutex_lock( &i_val->logMutex );

        TRACUCOMP( g_trac_trustedboot,
                   ">>relocateTpmLog() LogSize:%d MaxSize:%d",
                   i_val->logSize, i_maxSize);

        assert(i_newLog != NULL, "Bug! Log start address is nullptr");
        assert(i_val->logSize < i_maxSize,
               "Logsize is greater than maxsize");

        if(i_val->eventLogInMem)
        {
            // The log had been expanded previously. Need to copy over the log
            // memory to the new location and delete the pointer before
            // reassigning
            memcpy(i_newLog, i_val->eventLogInMem, i_val->logSize);
            delete[](i_val->eventLogInMem);
            i_val->eventLogInMem = i_newLog;
        }
        else
        {
            // Point logMgr to new location
            i_val->eventLogInMem = i_newLog;

            // Copy log into new location
            memset(i_val->eventLogInMem, 0, i_maxSize);
            memcpy(i_val->eventLogInMem, i_val->eventLog, i_val->logSize);
        }

        i_val->newEventPtr = i_val->eventLogInMem + i_val->logSize;
        i_val->logMaxSize = i_maxSize;

        mutex_unlock( &i_val->logMutex );

        TRACUCOMP( g_trac_trustedboot,
                   "<<relocateTpmLog() Addr:%p",
                   i_newLog);
        return;
    }

#endif

#ifdef __cplusplus
} // end TRUSTEDBOOT
#endif


text:
mod textbuffer;
pub use crate::textbuffer::*;
mod codeeditor;
pub use crate::codeeditor::*;
mod textcursor;
pub use crate::textcursor::*;
mod rusteditor;
pub use crate::rusteditor::*;
pub mod codeicon;
pub use crate::codeicon::*;
mod jseditor;
pub use crate::jseditor::*;
mod plaineditor;
pub use crate::plaineditor::*;
mod editortheme;
pub use crate::editortheme::*;
//mod texteditor;
//pub use crate::texteditor::*;


text:
LANG_DISK_SPACE=Disk Space (mb)
LANG_BANDWIDTH=Bandwidth (gb)
LANG_DOMAINS=Domains
LANG_USERS=Users
LANG_RESELLERS=Resellers


text:
import {HTTPRequest} from './vo/metrics/HTTPRequest';
import FactoryMaker from '../core/FactoryMaker';
import MediaPlayerModel from './models/MediaPlayerModel';
import ErrorHandler from './utils/ErrorHandler.js';

/**
 * @module XHRLoader
 * @description Manages download of resources via HTTP.
 * @param {Object} cfg - dependancies from parent
 */
function XHRLoader(cfg) {
    const context = this.context;

    //const log = Debug(context).getInstance().log;
    const mediaPlayerModel = MediaPlayerModel(context).getInstance();

    const errHandler = cfg.errHandler;
    const metricsModel = cfg.metricsModel;
    const requestModifier = cfg.requestModifier;

    let instance;
    let xhrs;
    let delayedXhrs;
    let retryTimers;
    let downloadErrorToRequestTypeMap;

    function setup() {
        xhrs = [];
        delayedXhrs = [];
        retryTimers = [];

        downloadErrorToRequestTypeMap = {
            [HTTPRequest.MPD_TYPE]:                         ErrorHandler.DOWNLOAD_ERROR_ID_MANIFEST,
            [HTTPRequest.XLINK_EXPANSION_TYPE]:             ErrorHandler.DOWNLOAD_ERROR_ID_XLINK,
            [HTTPRequest.INIT_SEGMENT_TYPE]:                ErrorHandler.DOWNLOAD_ERROR_ID_INITIALIZATION,
            [HTTPRequest.MEDIA_SEGMENT_TYPE]:               ErrorHandler.DOWNLOAD_ERROR_ID_CONTENT,
            [HTTPRequest.INDEX_SEGMENT_TYPE]:               ErrorHandler.DOWNLOAD_ERROR_ID_CONTENT,
            [HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]: ErrorHandler.DOWNLOAD_ERROR_ID_CONTENT,
            [HTTPRequest.OTHER_TYPE]:                       ErrorHandler.DOWNLOAD_ERROR_ID_CONTENT
        };
    }

    function internalLoad(config, remainingAttempts) {

        var request = config.request;
        var xhr = new XMLHttpRequest();
        var traces = [];
        var firstProgress = true;
        var needFailureReport = true;
        const requestStartTime = new Date();
        var lastTraceTime = requestStartTime;
        var lastTraceReceivedCount = 0;

        const handleLoaded = function (success) {
            needFailureReport = false;

            request.requestStartDate = requestStartTime;
            request.requestEndDate = new Date();
            request.firstByteDate = request.firstByteDate || requestStartTime;

            if (!request.checkExistenceOnly) {
                metricsModel.addHttpRequest(
                    request.mediaType,
                    null,
                    request.type,
                    request.url,
                    xhr.responseURL || null,
                    request.serviceLocation || null,
                    request.range || null,
                    request.requestStartDate,
                    request.firstByteDate,
                    request.requestEndDate,
                    xhr.status,
                    request.duration,
                    xhr.getAllResponseHeaders(),
                    success ? traces : null
                );
            }
        };

        const onloadend = function () {
            if (xhrs.indexOf(xhr) === -1) {
                return;
            } else {
                xhrs.splice(xhrs.indexOf(xhr), 1);
            }

            if (needFailureReport) {
                handleLoaded(false);

                if (remainingAttempts > 0) {
                    remainingAttempts--;
                    retryTimers.push(
                        setTimeout(function () {
                            internalLoad(config, remainingAttempts);
                        }, mediaPlayerModel.getRetryIntervalForType(request.type))
                    );
                } else {
                    errHandler.downloadError(
                        downloadErrorToRequestTypeMap[request.type],
                        request.url,
                        request
                    );

                    if (config.error) {
                        config.error(request, 'error', xhr.statusText);
                    }

                    if (config.complete) {
                        config.complete(request, xhr.statusText);
                    }
                }
            }
        };

        const progress = function (event) {
            var currentTime = new Date();

            if (firstProgress) {
                firstProgress = false;
                if (!event.lengthComputable ||
                    (event.lengthComputable && event.total !== event.loaded)) {
                    request.firstByteDate = currentTime;
                }
            }

            if (event.lengthComputable) {
                request.bytesLoaded = event.loaded;
                request.bytesTotal = event.total;
            }

            traces.push({
                s: lastTraceTime,
                d: currentTime.getTime() - lastTraceTime.getTime(),
                b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0]
            });

            lastTraceTime = currentTime;
            lastTraceReceivedCount = event.loaded;

            if (config.progress) {
                config.progress();
            }
        };

        const onload = function () {
            if (xhr.status >= 200 && xhr.status <= 299) {
                handleLoaded(true);

                if (config.success) {
                    config.success(xhr.response, xhr.statusText, xhr);
                }

                if (config.complete) {
                    config.complete(request, xhr.statusText);
                }
            }
        };

        try {
            const modifiedUrl = requestModifier.modifyRequestURL(request.url);
            const verb = request.checkExistenceOnly ? 'HEAD' : 'GET';

            xhr.open(verb, modifiedUrl, true);

            if (request.responseType) {
                xhr.responseType = request.responseType;
            }

            if (request.range) {
                xhr.setRequestHeader('Range', 'bytes=' + request.range);
            }

            if (!request.requestStartDate) {
                request.requestStartDate = requestStartTime;
            }

            xhr = requestModifier.modifyRequestHeader(xhr);

            xhr.withCredentials = mediaPlayerModel.getXHRWithCredentials();

            xhr.onload = onload;
            xhr.onloadend = onloadend;
            xhr.onerror = onloadend;
            xhr.onprogress = progress;

            // Adds the ability to delay single fragment loading time to control buffer.
            let now = new Date().getTime();
            if (isNaN(request.delayLoadingTime) || now >= request.delayLoadingTime) {
                // no delay - just send xhr

                xhrs.push(xhr);
                xhr.send();
            } else {
                // delay
                let delayedXhr = {xhr: xhr};
                delayedXhrs.push(delayedXhr);
                delayedXhr.delayTimeout = setTimeout(function () {
                    if (delayedXhrs.indexOf(delayedXhr) === -1) {
                        return;
                    } else {
                        delayedXhrs.splice(delayedXhrs.indexOf(delayedXhr), 1);
                    }
                    try {
                        xhrs.push(delayedXhr.xhr);
                        delayedXhr.xhr.send();
                    } catch (e) {
                        delayedXhr.xhr.onerror();
                    }
                }, (request.delayLoadingTime - now));
            }

        } catch (e) {
            xhr.onerror();
        }
    }

    /**
     * Initiates a download of the resource described by config.request
     * @param {Object} config - contains request (FragmentRequest or derived type), and callbacks
     * @memberof module:XHRLoader
     * @instance
     */
    function load(config) {
        if (config.request) {
            internalLoad(
                config,
                mediaPlayerModel.getRetryAttemptsForType(
                    config.request.type
                )
            );
        }
    }

    /**
     * Aborts any inflight downloads
     * @memberof module:XHRLoader
     * @instance
     */
    function abort() {
        retryTimers.forEach(t => clearTimeout(t));
        retryTimers = [];

        delayedXhrs.forEach(x => clearTimeout(x.delayTimeout));
        delayedXhrs = [];

        xhrs.forEach(x => {
            // abort will trigger onloadend which we don't want
            // when deliberately aborting inflight requests -
            // set them to undefined so they are not called
            x.onloadend = x.onerror = x.onprogress = undefined;
            x.abort();
        });
        xhrs = [];
    }

    instance = {
        load: load,
        abort: abort
    };

    setup();

    return instance;
}

XHRLoader.__dashjs_factory_name = 'XHRLoader';

const factory = FactoryMaker.getClassFactory(XHRLoader);
export default factory;


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>example</title>

    <button ng-click="dialog={open: true}">普通对话框</button>
    <dialog ng-if="dialog.open" close="dialog.open=false">

消息

hello world

    </dialog>

    <button ng-click="dialog2={open: true}">模态对话框</button>
    <dialog ng-if="dialog2.open" modal close="dialog2.open=false">

消息

hello world

    </dialog>

    <button id="btn-dialog-3" ng-click="dialog3={open: true}">箭头对话框</button>
    <dialog ng-if="dialog3.open" for="btn-dialog-3" close="dialog3.open=false" close-action="esc timeout outerchick">

消息

hello world

    </dialog>

    <button ng-click="dialog4={open: true}">无标题的对话框</button>
    <dialog ng-if="dialog4.open" close="dialog4.open=false" close-action="esc timeout outerchick">

hello world

    </dialog>

    <button ng-click="dialog5={open: true}">无关闭按钮的对话框</button>
    <dialog ng-if="dialog5.open">

消息

hello world<button ng-click="dialog5.open=false">关闭</button>

    </dialog>

    <button ng-click="dialog6={open: true}">有按钮区的对话框</button>
    <dialog ng-if="dialog6.open" close="dialog6.open=false">

消息

hello world

<button autofocus>确定</button><button ng-click="$close()">取消</button>

    </dialog>

    <button ng-click="dialog7={open: true}">fixed定位的对话框</button>
    <dialog ng-if="dialog7.open" fixed close="dialog7.open=false">

消息

下拉页面滚动条查看效果

    </dialog>

    <button ng-click="dialog8={open: true}">有状态栏的对话框</button>
    <dialog ng-if="dialog8.open" close="dialog8.open=false">

消息

hello world

<button autofocus>确定</button><button ng-click="$close()">取消</button>

<input type="checkbox">下次不再显示

    </dialog>

    <button ng-click="dialog9={open: true}">定时关闭的对话框</button>
    <dialog ng-if="dialog9.open" duration="2000" close="dialog9.open=false">

消息

hello world

    </dialog>

    <button id="btn-bubble" ng-click="bubble.open = true">普通气泡</button>
    <bubble ng-if="bubble.open" for="btn-bubble" close="bubble.open=false">hello world</bubble>

    <button id="btn-bubble2" ng-click="bubble2.open = true">定时关闭的气泡</button>
    <bubble ng-if="bubble2.open" duration="2000" for="btn-bubble2" close="bubble2.open=false">hello world</bubble>

    <button ng-click="notice={open: true}">普通消息条</button>
    <notice ng-if="notice.open" duration="2000" fixed close="notice.open=false">
        hello world
    </notice>

    <button ng-click="notice2={open: true}">模态消息条</button>
    <notice ng-if="notice2.open" modal duration="2000" fixed close="notice2.open=false">
        hello world
    </notice>

    <button ng-click="popup={open: true}">普通自定义浮层</button>
    <popup ng-if="popup.open" close="popup.open=false" close-action="esc timeout outerchick">

hello world

    </popup>

    <button ng-click="popup2={open: true}">模态自定义浮层</button>
    <popup ng-if="popup2.open" modal close="popup2.open=false" close-action="esc timeout outerchick">

hello world

    </popup>

    <button id="btn-popup3" ng-click="popup3={open: true}">被固定到元素附近的自定义浮层</button>
    <popup ng-if="popup3.open" for="btn-popup3" close="popup3.open=false" close-action="esc timeout outerchick">

hello world

    </popup>

    <button ng-click="popup4={open: $event}">被固定到事件源附近的自定义浮层</button>
    <popup ng-if="popup4.open" close="popup4.open=false" close-action="esc timeout outerchick">

hello world

    </popup>


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="bully">
        <note>
            Frames file for 'bully' based on sentences in wsj.  Verbnet entry
            29.8, Framenet entry Suasion4.  How many Suasions are there?  29.8
            refers to "lifestyle" verbs rather than PAS.
        </note>

        <roleset id="bully.01" name="force into an action with   threat of violence" vncls="29.8">
            <roles>
                <role descr="bully" n="0">
                    <vnrole vncls="29.8" vntheta="Agent"/>
                </role>
                <role descr="victim, impelled agent" n="1">
                    <vnrole vncls="29.8" vntheta="Theme"/>
                </role>
                <role descr="impelled action (often unstated)" n="2"/>
            </roles>

            <example name="unstated action">
                <inflection aspect="ns" form="full" person="ns" tense="past" voice="active"/>
                <text>
                    According to testimony in a public, 80-page grand-jury report
                    handed up to the state attorney general, Judge O'Kicki extorted
                    cash from lawyers, muscled favorable loans from banks and bullied
                    local businesses for more than a decade.
                </text>
                <arg n="0">Judge O'Kicki</arg>
                <rel>bullied</rel>
                <arg n="1">local businesses</arg>
                <arg f="TMP" n="M">for more than a decade</arg>
            </example>

            <example name="with action">
                <inflection aspect="ns" form="full" person="third" tense="present" voice="active"/>
                <text>
                    Her sister-in-law (Amy Wright) is a sniveling prude afraid that
                    Kate will seduce all the married men in town, including a
                    particularly loathsome fellow named Tucker, whose idea of fun is
                    to leave his wife at home tending to her bruises and cigarette
                    burns, while he bullies Kate into a dance that consists of
                    drooling on her while trying to break her ribs.
                </text>
                <arg n="0">he</arg>
                <rel>bullies</rel>
                <arg n="1">Kate</arg>
                <arg n="2">into a dance that consists of drooling on her
                    while trying to break her ribs
                </arg>
            </example>

            <note>
            </note>

        </roleset>
    </predicate>
</frameset>


text:
package scenarios

import (
	"bytes"
	"fmt"
	"os"
	"os/exec"
)

func BuildV2Ray() error {
	genTestBinaryPath()
	if _, err := os.Stat(testBinaryPath); err == nil {
		return nil
	}

	fmt.Printf("Building V2Ray into path (%s)\n", testBinaryPath)
	cmd := exec.Command("go", "build", "-o="+testBinaryPath, GetSourcePath())
	return cmd.Run()
}

func RunV2RayProtobuf(config []byte) *exec.Cmd {
	genTestBinaryPath()
	proc := exec.Command(testBinaryPath, "-config=stdin:", "-format=pb")
	proc.Stdin = bytes.NewBuffer(config)
	proc.Stderr = os.Stderr
	proc.Stdout = os.Stdout

	return proc
}


text:
namespace Topshelf.HostConfigurators
{
    using System.Collections.Generic;
    using Builders;
    using Configurators;

    public class CommandConfigurator :
        HostBuilderConfigurator
    {
        readonly int _command;

        public CommandConfigurator(int command)
        {
            _command = command;
        }

        public IEnumerable<ValidateResult> Validate()
        {
            if (_command < 128 || _command > 256)
                yield return this.Failure("Command", "must be between 128 and 256");
        }

        public HostBuilder Configure(HostBuilder builder)
        {
            return new CommandBuilder(builder, _command);
        }
    }
}


text:
#include "config.h"

#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

#include <linux/input.h>
#include <cairo.h>

#include "shared/helpers.h"
#include "window.h"

struct stacking {
	struct display *display;
	struct window *root_window;
};

static void
button_handler(struct widget *widget,
               struct input *input, uint32_t time,
               uint32_t button,
               enum wl_pointer_button_state state, void *data);
static void
key_handler(struct window *window,
            struct input *input, uint32_t time,
            uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
            void *data);
static void
keyboard_focus_handler(struct window *window,
		       struct input *device, void *data);
static void
fullscreen_handler(struct window *window, void *data);
static void
redraw_handler(struct widget *widget, void *data);

/* Iff parent_window is set, the new window will be transient. */
static struct window *
new_window(struct stacking *stacking, struct window *parent_window)
{
	struct window *new_window;
	struct widget *new_widget;

	new_window = window_create(stacking->display);
	window_set_parent(new_window, parent_window);

	new_widget = window_frame_create(new_window, new_window);

	window_set_title(new_window, "Stacking Test");
	window_set_key_handler(new_window, key_handler);
	window_set_keyboard_focus_handler(new_window, keyboard_focus_handler);
	window_set_fullscreen_handler(new_window, fullscreen_handler);
	widget_set_button_handler(new_widget, button_handler);
	widget_set_redraw_handler(new_widget, redraw_handler);
	window_set_user_data(new_window, stacking);

	window_schedule_resize(new_window, 300, 300);

	return new_window;
}

static void
show_popup_cb(void *data, struct input *input, int index)
{
	/* Ignore the selected menu item. */
}

static void
show_popup(struct stacking *stacking, struct input *input, uint32_t time,
           struct window *window)
{
	int32_t x, y;
	static const char *entries[] = {
		"Test Entry",
		"Another Test Entry",
	};

	input_get_position(input, &x, &y);
	window_show_menu(stacking->display, input, time, window, x, y,
	                 show_popup_cb, entries, ARRAY_LENGTH(entries));
}

static void
button_handler(struct widget *widget,
               struct input *input, uint32_t time,
               uint32_t button,
               enum wl_pointer_button_state state, void *data)
{
	struct stacking *stacking = data;

	switch (button) {
	case BTN_RIGHT:
		if (state == WL_POINTER_BUTTON_STATE_PRESSED)
			show_popup(stacking, input, time,
			           widget_get_user_data(widget));
		break;

	case BTN_LEFT:
	default:
		break;
	}
}

static void
key_handler(struct window *window,
            struct input *input, uint32_t time,
            uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
            void *data)
{
	struct stacking *stacking = data;

	if (state != WL_KEYBOARD_KEY_STATE_PRESSED)
		return;

	switch (sym) {
	case XKB_KEY_f:
		fullscreen_handler(window, data);
		break;

	case XKB_KEY_m:
		window_set_maximized(window, !window_is_maximized(window));
		break;

	case XKB_KEY_n:
		/* New top-level window. */
		new_window(stacking, NULL);
		break;

	case XKB_KEY_p:
		show_popup(stacking, input, time, window);
		break;

	case XKB_KEY_q:
		exit (0);
		break;

	case XKB_KEY_t:
		/* New transient window. */
		new_window(stacking, window);
		break;

	default:
		break;
	}
}

static void
keyboard_focus_handler(struct window *window,
		       struct input *device, void *data)
{
	window_schedule_redraw(window);
}

static void
fullscreen_handler(struct window *window, void *data)
{
	window_set_fullscreen(window, !window_is_fullscreen(window));
}

static void
draw_string(cairo_t *cr,
            const char *fmt, ...) __attribute__((format (gnu_printf, 2, 3)));

static void
draw_string(cairo_t *cr,
            const char *fmt, ...)
{
	char buffer[4096];
	char *p, *end;
	va_list argp;
	cairo_text_extents_t text_extents;
	cairo_font_extents_t font_extents;

	cairo_save(cr);

	cairo_select_font_face(cr, "sans",
	                       CAIRO_FONT_SLANT_NORMAL,
	                       CAIRO_FONT_WEIGHT_NORMAL);
	cairo_set_font_size(cr, 14);

	cairo_font_extents(cr, &font_extents);

	va_start(argp, fmt);

	vsnprintf(buffer, sizeof(buffer), fmt, argp);

	p = buffer;
	while (*p) {
		end = strchr(p, '\n');
		if (end)
			*end = 0;

		cairo_show_text(cr, p);
		cairo_text_extents(cr, p, &text_extents);
		cairo_rel_move_to(cr, -text_extents.x_advance, font_extents.height);

		if (end)
			p = end + 1;
		else
			break;
	}

	va_end(argp);

	cairo_restore(cr);
}

static void
set_window_background_colour(cairo_t *cr, struct window *window)
{
	if (window_get_parent(window))
		cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.4);
	else if (window_is_maximized(window))
		cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 0.6);
	else if (window_is_fullscreen(window))
		cairo_set_source_rgba(cr, 0.0, 1.0, 1.0, 0.6);
	else
		cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);
}

static void
redraw_handler(struct widget *widget, void *data)
{
	struct window *window;
	struct rectangle allocation;
	cairo_t *cr;

	widget_get_allocation(widget, &allocation);
	window = widget_get_user_data(widget);

	cr = widget_cairo_create(widget);
	cairo_translate(cr, allocation.x, allocation.y);

	/* Draw background. */
	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
	set_window_background_colour(cr, window);
	cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
	cairo_fill(cr);

	/* Print the instructions. */
	cairo_move_to(cr, 5, 15);
	cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);

	draw_string(cr,
	            "Window: %p\n"
	            "Fullscreen? %u\n"
	            "Maximized? %u\n"
	            "Transient? %u\n"
	            "Keys: (f)ullscreen, (m)aximize,\n"
	            "      (n)ew window, (p)opup,\n"
	            "      (q)uit, (t)ransient window\n",
	            window, window_is_fullscreen(window),
	            window_is_maximized(window), window_get_parent(window) ? 1 : 0);

	cairo_destroy(cr);
}

int
main(int argc, char *argv[])
{
	struct stacking stacking;

	memset(&stacking, 0, sizeof stacking);

#ifdef HAVE_PANGO
	g_type_init();
#endif

	stacking.display = display_create(&argc, argv);
	if (stacking.display == NULL) {
		fprintf(stderr, "Failed to create display: %m\n");
		return -1;
	}

	display_set_user_data(stacking.display, &stacking);

	stacking.root_window = new_window(&stacking, NULL);

	display_run(stacking.display);

	window_destroy(stacking.root_window);
	display_destroy(stacking.display);

	return 0;
}


text:
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("conferences", "0010_auto_20150713_2331"),
        ("proposals", "0012_auto_20150709_0842"),
    ]

    operations = [
        migrations.CreateModel(
            name="ScheduleItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="Created At"),
                ),
                (
                    "modified_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Last Modified At"
                    ),
                ),
                ("event_date", models.DateField(db_index=True)),
                ("start_time", models.TimeField(db_index=True)),
                ("end_time", models.TimeField()),
                ("alt_name", models.CharField(max_length=100, blank=True)),
                (
                    "type",
                    models.CharField(
                        default=b"TALK",
                        max_length=20,
                        choices=[
                            (b"TALK", b"Talk"),
                            (b"LUNCH", b"Lunch"),
                            (b"BREAK", b"Break"),
                        ],
                    ),
                ),
                (
                    "conference",
                    models.ForeignKey(
                        to="conferences.Conference", on_delete=models.deletion.CASCADE,
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        related_name="created_scheduleitem_set",
                        verbose_name="Created By",
                        blank=True,
                        on_delete=models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        null=True,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        related_name="updated_scheduleitem_set",
                        verbose_name="Modified By",
                        blank=True,
                        on_delete=models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        null=True,
                    ),
                ),
                (
                    "room",
                    models.ForeignKey(
                        to="conferences.Room",
                        null=True,
                        on_delete=models.deletion.CASCADE,
                    ),
                ),
                (
                    "session",
                    models.ForeignKey(
                        to="proposals.Proposal",
                        null=True,
                        on_delete=models.deletion.CASCADE,
                    ),
                ),
            ],
            options={},
            bases=(models.Model,),
        ),
        migrations.AlterIndexTogether(
            name="scheduleitem", index_together=set([("event_date", "start_time")]),
        ),
    ]


text:
<resources>
    <string name="coptic_app_name">Coptic for AnySoftKeyboard</string>
</resources>


text:
<?php

namespace PlentymarketsAdapter\ReadApi;

use DateTimeImmutable;
use PlentymarketsAdapter\Client\Client;
use PlentymarketsAdapter\Client\Iterator\Iterator;
use PlentymarketsAdapter\Helper\LanguageHelperInterface;
use PlentymarketsAdapter\ReadApi\Item\Variation as VariationApi;

/**
 * Class Item
 */
class Item extends ApiAbstract
{
    /**
     * @var VariationApi
     */
    private $itemsVariationsApi;

    /**
     * @var LanguageHelperInterface
     */
    private $languageHelper;

    /**
     * @var string
     */
    private $includes = 'itemProperties.valueTexts,itemCrossSelling,itemImages';

    /**
     * Item constructor.
     *
     * @param Client                  $client
     * @param VariationApi            $itemsVariationsApi
     * @param LanguageHelperInterface $languageHelper
     */
    public function __construct(
        Client $client,
        VariationApi $itemsVariationsApi,
        LanguageHelperInterface $languageHelper
    ) {
        parent::__construct($client);

        $this->itemsVariationsApi = $itemsVariationsApi;
        $this->languageHelper = $languageHelper;
    }

    /**
     * @param $productId
     *
     * @return array
     */
    public function findOne($productId)
    {
        $result = $this->client->request('GET', 'items/' . $productId, [
            'lang' => $this->languageHelper->getLanguagesQueryString(),
            'with' => $this->includes,
        ]);

        if (empty($result)) {
            return $result;
        }

        $result['variations'] = $this->itemsVariationsApi->findBy(['itemId' => $result['id']]);
        $result['shippingProfiles'] = $this->getProductShippingProfiles($result['id']);

        return $result;
    }

    /**
     * @return Iterator
     */
    public function findAll()
    {
        return $this->client->getIterator('items', [
            'lang' => $this->languageHelper->getLanguagesQueryString(),
            'with' => $this->includes,
        ], function (array $elements) {
            $this->addAdditionalData($elements);

            return $elements;
        });
    }

    /**
     * @param $startTimestamp
     * @param $endTimestamp
     *
     * @return Iterator
     */
    public function findChanged(DateTimeImmutable $startTimestamp, DateTimeImmutable $endTimestamp)
    {
        $start = $startTimestamp->format(DATE_W3C);
        $end = $endTimestamp->format(DATE_W3C);

        return $this->client->getIterator('items', [
            'lang' => $this->languageHelper->getLanguagesQueryString(),
            'updatedBetween' => $start . ',' . $end,
            'with' => $this->includes,
        ], function (array $elements) {
            $this->addAdditionalData($elements);

            return $elements;
        });
    }

    /**
     * @param array $elements
     */
    private function addAdditionalData(array &$elements)
    {
        if (empty($elements)) {
            return;
        }

        $items = array_column($elements, 'id');

        $variations = $this->itemsVariationsApi->findBy(['itemId' => implode(',', $items)]);

        foreach ($elements as $key => $element) {
            $elements[$key]['variations'] = array_filter($variations, function (array $variation) use ($element) {
                return $element['id'] === $variation['itemId'];
            });

            $elements[$key]['shippingProfiles'] = $this->getProductShippingProfiles($element['id']);
        }
    }

    /**
     * @param int $id
     *
     * @return array
     */
    private function getProductShippingProfiles($id)
    {
        return $this->client->request('GET', 'items/' . $id . '/item_shipping_profiles', [
            'with' => 'names',
            'lang' => $this->languageHelper->getLanguagesQueryString(),
        ]);
    }
}


text:
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_

#include <sys/cdefs.h>
#include <sys/types.h>
#include <asm/mman.h>

__BEGIN_DECLS

#ifndef MAP_ANON
#define MAP_ANON  MAP_ANONYMOUS
#endif

#define MAP_FAILED ((void *)-1)

#define MREMAP_MAYMOVE  1
#define MREMAP_FIXED    2

extern void* mmap(void*, size_t, int, int, int, off_t);
extern void* mmap64(void*, size_t, int, int, int, off64_t);
extern int munmap(void*, size_t);
extern int msync(const void*, size_t, int);
extern int mprotect(const void*, size_t, int);
extern void* mremap(void*, size_t, size_t, unsigned long);

extern int mlockall(int);
extern int munlockall(void);
extern int mlock(const void*, size_t);
extern int munlock(const void*, size_t);
extern int madvise(const void*, size_t, int);

extern int mlock(const void*, size_t);
extern int munlock(const void*, size_t);

extern int mincore(void*, size_t, unsigned char*);

__END_DECLS

#endif /* _SYS_MMAN_H_ */