text:
import {getWindowScrollTop, hasClass, getWindowScrollLeft} from './../../helpers/dom/element';
import BasePlugin from './../_base';
import {EventManager} from './../../eventManager';
import {registerPlugin} from './../../plugins';

/**
 * @private
 * @class MultipleSelectionHandles
 * @plugin MultipleSelectionHandles
 */

class MultipleSelectionHandles extends BasePlugin {
  /**
   * @param {Object} hotInstance
   */
  constructor(hotInstance) {
    super(hotInstance);
    /**
     * @type {Array}
     */
    this.dragged = [];
    /**
     * Instance of EventManager.
     *
     * @type {EventManager}
     */
    this.eventManager = null;
    /**
     * @type {null}
     */
    this.lastSetCell = null;
  }

  /**
   * Check if the plugin is enabled in the handsontable settings.
   *
   * @returns {Boolean}
   */
  isEnabled() {
    return Handsontable.mobileBrowser;
  }

  /**
   * Enable plugin for this Handsontable instance.
   */
  enablePlugin() {
    if (this.enabled) {
      return;
    }
    if (!this.eventManager) {
      this.eventManager = new EventManager(this);
    }
    this.registerListeners();
    super.enablePlugin();
  }

  /**
   * Bind the touch events
   * @private
   */
  registerListeners() {
    var _this = this;

    function removeFromDragged(query) {

      if (_this.dragged.length === 1) {
        // clear array
        _this.dragged.splice(0, _this.dragged.length);

        return true;
      }

      var entryPosition = _this.dragged.indexOf(query);

      if (entryPosition == -1) {
        return false;
      } else if (entryPosition === 0) {
        _this.dragged = _this.dragged.slice(0, 1);
      } else if (entryPosition == 1) {
        _this.dragged = _this.dragged.slice(-1);
      }
    }

    this.eventManager.addEventListener(this.hot.rootElement, 'touchstart', function(event) {
      let selectedRange;

      if (hasClass(event.target, "topLeftSelectionHandle-HitArea")) {
        selectedRange = _this.hot.getSelectedRange();

        _this.dragged.push("topLeft");

        _this.touchStartRange = {
          width: selectedRange.getWidth(),
          height: selectedRange.getHeight(),
          direction: selectedRange.getDirection()
        };

        event.preventDefault();
        return false;

      } else if (hasClass(event.target, "bottomRightSelectionHandle-HitArea")) {
        selectedRange = _this.hot.getSelectedRange();

        _this.dragged.push("bottomRight");

        _this.touchStartRange = {
          width: selectedRange.getWidth(),
          height: selectedRange.getHeight(),
          direction: selectedRange.getDirection()
        };

        event.preventDefault();
        return false;
      }
    });

    this.eventManager.addEventListener(this.hot.rootElement, 'touchend', function(event) {
      if (hasClass(event.target, "topLeftSelectionHandle-HitArea")) {
        removeFromDragged.call(_this, "topLeft");

        _this.touchStartRange = void 0;

        event.preventDefault();
        return false;

      } else if (hasClass(event.target, "bottomRightSelectionHandle-HitArea")) {
        removeFromDragged.call(_this, "bottomRight");

        _this.touchStartRange = void 0;

        event.preventDefault();
        return false;
      }
    });

    this.eventManager.addEventListener(this.hot.rootElement, 'touchmove', function(event) {
      let scrollTop = getWindowScrollTop(),
        scrollLeft = getWindowScrollLeft(),
        endTarget,
        targetCoords,
        selectedRange,
        rangeWidth,
        rangeHeight,
        rangeDirection,
        newRangeCoords;

      if (_this.dragged.length === 0) {
        return;
      }

      endTarget = document.elementFromPoint(
        event.touches[0].screenX - scrollLeft,
        event.touches[0].screenY - scrollTop);

      if (!endTarget || endTarget === _this.lastSetCell) {
        return;
      }

      if (endTarget.nodeName == "TD" || endTarget.nodeName == "TH") {
        targetCoords = _this.hot.getCoords(endTarget);

        if (targetCoords.col == -1) {
          targetCoords.col = 0;
        }

        selectedRange = _this.hot.getSelectedRange();
        rangeWidth = selectedRange.getWidth();
        rangeHeight = selectedRange.getHeight();
        rangeDirection = selectedRange.getDirection();

        if (rangeWidth == 1 && rangeHeight == 1) {
          _this.hot.selection.setRangeEnd(targetCoords);
        }

        newRangeCoords = _this.getCurrentRangeCoords(selectedRange, targetCoords, _this.touchStartRange.direction, rangeDirection, _this.dragged[0]);

        if (newRangeCoords.start !== null) {
          _this.hot.selection.setRangeStart(newRangeCoords.start);
        }

        _this.hot.selection.setRangeEnd(newRangeCoords.end);

        _this.lastSetCell = endTarget;

      }

      event.preventDefault();
    });
  }

  getCurrentRangeCoords(selectedRange, currentTouch, touchStartDirection, currentDirection, draggedHandle) {
    var topLeftCorner = selectedRange.getTopLeftCorner(),
      bottomRightCorner = selectedRange.getBottomRightCorner(),
      bottomLeftCorner = selectedRange.getBottomLeftCorner(),
      topRightCorner = selectedRange.getTopRightCorner();

    var newCoords = {
      start: null,
      end: null
    };

    switch (touchStartDirection) {
      case "NE-SW":
        switch (currentDirection) {
          case "NE-SW":
          case "NW-SE":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: new WalkontableCellCoords(currentTouch.row, selectedRange.highlight.col),
                end: new WalkontableCellCoords(bottomLeftCorner.row, currentTouch.col)
              };
            } else {
              newCoords = {
                start: new WalkontableCellCoords(selectedRange.highlight.row, currentTouch.col),
                end: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col)
              };
            }
            break;
          case "SE-NW":
            if (draggedHandle == "bottomRight") {
              newCoords = {
                start: new WalkontableCellCoords(bottomRightCorner.row, currentTouch.col),
                end: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col)
              };
            }
            break;
          //case "SW-NE":
          //  break;
        }
        break;
      case "NW-SE":
        switch (currentDirection) {
          case "NE-SW":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: currentTouch,
                end: bottomLeftCorner
              };
            } else {
              newCoords.end = currentTouch;
            }
            break;
          case "NW-SE":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: currentTouch,
                end: bottomRightCorner
              };
            } else {
              newCoords.end = currentTouch;
            }
            break;
          case "SE-NW":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: currentTouch,
                end: topLeftCorner
              };
            } else {
              newCoords.end = currentTouch;
            }
            break;
          case "SW-NE":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: currentTouch,
                end: topRightCorner
              };
            } else {
              newCoords.end = currentTouch;
            }
            break;
        }
        break;
      case "SW-NE":
        switch (currentDirection) {
          case "NW-SE":
            if (draggedHandle == "bottomRight") {
              newCoords = {
                start: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col),
                end: new WalkontableCellCoords(bottomLeftCorner.row, currentTouch.col)
              };
            } else {
              newCoords = {
                start: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col),
                end: new WalkontableCellCoords(currentTouch.row, bottomRightCorner.col)
              };
            }
            break;
          //case "NE-SW":
          //
          //  break;
          case "SW-NE":
            if (draggedHandle == "topLeft") {
              newCoords = {
                start: new WalkontableCellCoords(selectedRange.highlight.row, currentTouch.col),
                end: new WalkontableCellCoords(currentTouch.row, bottomRightCorner.col)
              };
            } else {
              newCoords = {
                start: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col),
                end: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col)
              };
            }
            break;
          case "SE-NW":
            if (draggedHandle == "bottomRight") {
              newCoords = {
                start: new WalkontableCellCoords(currentTouch.row, topRightCorner.col),
                end: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col)
              };
            } else if (draggedHandle == "topLeft") {
              newCoords = {
                start: bottomLeftCorner,
                end: currentTouch
              };
            }
            break;
        }
        break;
      case "SE-NW":
        switch (currentDirection) {
          case "NW-SE":
          case "NE-SW":
          case "SW-NE":
            if (draggedHandle == "topLeft") {
              newCoords.end = currentTouch;
            }
            break;
          case "SE-NW":
            if (draggedHandle == "topLeft") {
              newCoords.end = currentTouch;
            } else {
              newCoords = {
                start: currentTouch,
                end: topLeftCorner
              };
            }
            break;
        }
        break;
    }

    return newCoords;
  }

  /**
   * Check if user is currently dragging the handle.
   *
   * @returns {boolean} Dragging state
   */
  isDragged() {
    return this.dragged.length > 0;
  }
}

export {MultipleSelectionHandles};

registerPlugin('multipleSelectionHandles', MultipleSelectionHandles);


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Omphalodes moupinensis Franch.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using WebApplication.Models;

namespace WebApplication.Controllers
{
    [ResponseCache(Location = ResponseCacheLocation.None, NoStore = true, Duration = -1)]
    public class PersonsController : Controller
    {
        private List<Person> People = new List<Person>
        {
            new Person{Name = "Max Musterman", City="Naustadt", Dob=new DateTime(1978, 07, 29)},
            new Person{Name = "Maria Musterfrau", City="London", Dob=new DateTime(1979, 08, 30)},
            new Person{Name = "John Doe", City="Los Angeles", Dob=new DateTime(1980, 09, 01)}
        };

        [Route("api/persons")]
        [HttpGet]
        public IEnumerable<Person> GetPersons()
        {
            return new List<Person>
            {
                new Person{Name = "Max Musterman", City="Naustadt", Dob=new DateTime(1978, 07, 29)},
                new Person{Name = "Maria Musterfrau", City="London", Dob=new DateTime(1979, 08, 30)},
                new Person{Name = "John Doe", City="Los Angeles", Dob=new DateTime(1980, 09, 01)}
            };
        }

        [Route("api/persons/{index}")]
        [HttpGet]
        public ActionResult GetPerson(int index)
        {
            if (index < 0 || index >= People.Count)
                return NotFound();

            return Ok(People[index]);
        }

        [Route("api/persons")]
        [AcceptVerbs("POST", "PUT")]
        public ActionResult AddPerson([FromBody] Person person)
        {
            Console.WriteLine($"New Person: {person.Name}");
            return Ok(person);
        }
    }
}


text:
## Objectives:
1. Create phyloseq objects using raw OTU table and taxonomy table.
2. Eliminate ambiguous rare OTUs that summed up to less than 5 across all samples.
3. Generate a histogram to evaluate sample sequencing depths.
4. Calculate the Good's Estimate of Coverage for each sample.
5. Generate a histogram to evaluate sample coverage from sequencing.
6. Save any output that could be used downstream directly.

### 1. Bacterial:
### 1. This step does all of the above and generates 3 different directories. In terminal, type:
```bash
cd ~/pit_foaming_manuscript
Rscript codes/R_scripts/community_sample_processing_phyloseq.R raw_data/otu_table.txt raw_data/taxa_table.txt
```

### 2. Sample trimming in `R` (from outputs generated from step 1):
```R
library(ggplot2)

# import the sample coverage data:
C <- read.delim("Text_outputs/data.taxmin5.sample_goods_coverage.txt")

# quick plot to visual the sequencing depth and coverage:
pdf("Figures/bacteria_seqdepth_vs_C.pdf")
ggplot(C, aes(x=sample_sums, y=C)) +
	ylim(0, 1) +
	geom_point() +
	geom_vline(xintercept=10000)
dev.off()
```

We can see that a sequencing depth greater and equal to 10000 good quality reads yielded a minimal coverage of 97% and the community coverages plateued. Therefore, we will remove samples that had less than 10000 sequences.

```R
library(phyloseq)

# import phyloseq object from step 1:
data.phy <- readRDS("RDS_objects/taxsum_min5_sequence_phyloseq.RDS")
```

    ## > data.phy
    ## phyloseq-class experiment-level object
    ## otu_table()   OTU Table:         [ 8338 taxa and 547 samples ]
    ## tax_table()   Taxonomy Table:    [ 8338 taxa by 6 taxonomic ranks ]

```R
# removing sample with total sequences less than 10000. Also remove the taxa that are all 0 across samples:
data.min10k <- prune_samples(sample_sums(data.phy) >= 10000, data.phy)
```

    ## > data.min10k
    ## phyloseq-class experiment-level object
    ## otu_table()   OTU Table:         [ 8338 taxa and 503 samples ]
    ## tax_table()   Taxonomy Table:    [ 8338 taxa by 6 taxonomic ranks ]

```R
data.min10k <- prune_taxa(taxa_sums(data.min10k) > 0, data.min10k)
```
    ## > data.min10k
    ## phyloseq-class experiment-level object
    ## otu_table()   OTU Table:         [ 8336 taxa and 503 samples ]
    ## tax_table()   Taxonomy Table:    [ 8336 taxa by 6 taxonomic ranks ]

### 3. Incorporating sample metadata (samples without any metadata will be removed):
```R
si <- read.delim("raw_data/sample_meta_data.txt")
```

    ##  > dim(si)
    ## [1] 488 112

```R
# add row names to sample metadata
row.names(si) <- si$SAMPLES
# add metadata to phyloseq object
sample_data(data.min10k) <- si
# because some samples were removed, remove OTUs that summed up 0 across all samples
data.min10k <- prune_taxa(taxa_sums(data.min10k) > 0, data.min10k)
```

    ## > data.min10k
    ## phyloseq-class experiment-level object
    ## otu_table()   OTU Table:         [ 8328 taxa and 488 samples ]
    ## sample_data() Sample Data:       [ 488 samples by 112 sample variables ]
    ## tax_table()   Taxonomy Table:    [ 8328 taxa by 6 taxonomic ranks ]

### 4. Creating relative abundance phyloseq object:
```R
# standardizing by total sequence reads. Because the resulted fractions introduce many 0's and it's difficult to read.
# therefore, we times the final fraction by 1e5.
data.min10k.1e5 <- transform_sample_counts(data.min10k, function(x) 1e5 * x / sum(x))
```
    ## > data.min10k.1e5
    ## phyloseq-class experiment-level object
    ## otu_table()   OTU Table:         [ 8328 taxa and 488 samples ]
    ## sample_data() Sample Data:       [ 488 samples by 112 sample variables ]
    ## tax_table()   Taxonomy Table:    [ 8328 taxa by 6 taxonomic ranks ]

### note to Fan ###
```
load("~/Box Sync/Manure Foaming/Manuscript/sorting_things_out.RData")
library(phyloseq)
library(ggplot2)

save.image("~/Box Sync/Manure Foaming/Manuscript/sorting_things_out.R")
ls()
getwd()

subset_taxa(data.min10k, domain!="Archaea" & domain!="unclassified_Root")
data.min10k

```


text:
using Marten.Linq.Fields;
using Marten.Linq.SqlGeneration;
using Weasel.Postgresql;
using Marten.Util;

namespace Marten.Linq.Filters
{
    public class BooleanFieldIsTrue: IReversibleWhereFragment
    {
        private readonly IField _field;

        public BooleanFieldIsTrue(IField field)
        {
            _field = field;
        }

        public void Apply(CommandBuilder builder)
        {
            builder.Append("(");
            builder.Append(_field.RawLocator);
            builder.Append(" is not null and ");
            builder.Append(_field.TypedLocator);
            builder.Append(" = True)");
        }

        public bool Contains(string sqlText)
        {
            return _field.RawLocator.Contains(sqlText);
        }

        public ISqlFragment Reverse()
        {
            return new BooleanFieldIsFalse(_field);
        }
    }
}


text:
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand

readme = open('README.rst').read()
history = open('HISTORY.rst').read()

def parse_requirements():
    with open('requirements.txt') as req:
        return req.readlines()

class Tox(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        # import here, cause outside the eggs aren't loaded
        import tox
        errcode = tox.cmdline(self.test_args)
        sys.exit(errcode)

setup(name='flotsam',
      version='0.1.2',
      description='Miscellaneous utilities',
      long_description=readme + '\n\n' + history,
      author='Bernhard (Bernd) Biskup',
      author_email='bbiskup@gmx.de',
      url='https://github.com/bbiskup',
      package_dir={'flotsam': 'flotsam'},
      packages=['flotsam'],
      zip_safe=False,
      include_package_data=True,
      install_requires=parse_requirements(),
      classifiers=[
          'Development Status :: 2 - Pre-Alpha',
          'Environment :: Console',
          'Intended Audience :: Developers',
          # Topic :: Software Development :: Libraries :: Python Modules',
          'License :: OSI Approved :: MIT License',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3.5',
      ],
      license='The MIT License (MIT)',
      keywords='flotsam utilities',
      tests_require=['tox'],
      cmdclass={'test': Tox}
      )


text:
package org.jugbd.mnet.web.controller;

import org.jugbd.mnet.domain.MedicalHistory;
import org.jugbd.mnet.domain.Register;
import org.jugbd.mnet.domain.enums.Gender;
import org.jugbd.mnet.service.MedicalHistoryService;
import org.jugbd.mnet.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.validation.Valid;

/**
 * @author Bazlur Rahman Rokon
 * @date 11/27/2014.
 */
@Controller
@Secured({"ROLE_ADMIN", "ROLE_USER"})
@RequestMapping("/medicalhistory")
public class MedicalHistoryController {
    public static final String MEDICAL_HISTORY_CREATE_PAGE = "medicalhistory/create";
    public static final String REDIRECT_REGISTER_MEDICAL_HISTORY_PAGE = "redirect:/register/medicalhistory/";
    public static final String MEDICAL_HISTORY_SHOW_PAGE = "medicalhistory/show";
    public static final String MEDICAL_HISTORY_EDIT_PAGE = "medicalhistory/edit";

    @Autowired
    private MedicalHistoryService medicalHistoryService;

    @Autowired
    private RegisterService registerService;

    @RequestMapping(value = "create/{registerId}", method = RequestMethod.GET)
    public String create(@PathVariable Long registerId, MedicalHistory medicalHistory, Model uiModel) {

        Register register = registerService.findOne(registerId);
        medicalHistory.setRegister(register);

        Gender gender = register.getPatient().getGender();
        boolean isFemale = gender == Gender.FEMALE;
        uiModel.addAttribute("isFemale", isFemale);

        return MEDICAL_HISTORY_CREATE_PAGE;
    }

    @RequestMapping(value = "create", method = RequestMethod.POST)
    public String save(@Valid MedicalHistory medicalHistory,
                       BindingResult result,
                       RedirectAttributes redirectAttributes) {

        if (result.hasErrors()) {

            return MEDICAL_HISTORY_CREATE_PAGE;
        }

        MedicalHistory saveMedicalHistory = medicalHistoryService.save(medicalHistory);
        redirectAttributes.addFlashAttribute("message", "Medical History successfully created");

        return REDIRECT_REGISTER_MEDICAL_HISTORY_PAGE + saveMedicalHistory.getRegister().getId();
    }

    @RequestMapping(value = "show/{id}", method = RequestMethod.GET)
    public String show(@PathVariable Long id, Model uiModel) {
        uiModel.addAttribute("medicalHistory", medicalHistoryService.findOne(id));

        return MEDICAL_HISTORY_SHOW_PAGE;
    }

    @RequestMapping(value = "edit/{id}", method = RequestMethod.GET)
    public String edit(@PathVariable Long id, Model uiModel) {
        MedicalHistory medicalHistory = medicalHistoryService.findOne(id);

        uiModel.addAttribute("medicalHistory", medicalHistory);

        Gender gender = medicalHistory.getRegister().getPatient().getGender();
        boolean isFemale = gender == Gender.FEMALE;
        uiModel.addAttribute("isFemale", isFemale);

        return MEDICAL_HISTORY_EDIT_PAGE;
    }

    @RequestMapping(value = "edit", method = RequestMethod.POST)
    public String update(@Valid MedicalHistory medicalHistory,
                         BindingResult result,
                         RedirectAttributes redirectAttributes) {

        if (result.hasErrors()) {

            return MEDICAL_HISTORY_EDIT_PAGE;
        }

        MedicalHistory saveMedicalHistory = medicalHistoryService.save(medicalHistory);
        redirectAttributes.addFlashAttribute("message", "Medical History successfully updated");

        return REDIRECT_REGISTER_MEDICAL_HISTORY_PAGE + saveMedicalHistory.getRegister().getId();
    }

    @RequestMapping(value = "cancel/{registerId}", method = RequestMethod.GET)
    public String cancel(@PathVariable Long registerId) {

        return "redirect:/patient/show/" + registerService.findOne(registerId).getPatient().getId();
    }
}


text:
#include "elf_code_container.hpp"

using namespace elf;

ELFCodeContainer::ELFCodeContainer(ELFFile *file, const std::pair<int, int> &interval,
                                   unsigned int index) :
    CodeContainer(file, interval), index(index)
{
    injectionPossible = false;
}

unsigned int ELFCodeContainer::addressToOffset(unsigned long long address)
{
    ELFFile *efile = dynamic_cast<ELFFile *>(getFile());
#ifdef DEBUG
    assert(efile != nullptr);
#endif
    ELFIO::elfio *interpretor = efile->getELFIO();
    ELFIO::section *currentSection = interpretor->sections[index];

    unsigned long long baseAddress = currentSection->get_address();
    if (address >= baseAddress && (baseAddress + currentSection->get_size()) > address)
        return currentSection->get_offset() + address - baseAddress;

    else
        return -1;
}

void ELFCodeContainer::getContent(std::vector<std::pair<unsigned long long, std::string>> &content)
{
    std::map<std::string, unsigned long long> labels;
    std::vector<asmInstr> instructions;

    FileAssembly::disassembleSection(getFile()->getOpenFileName(), getSectionName(),
                                      labels, instructions);

    for (unsigned int i = 0; i < instructions.size(); i++)
    {
        content.push_back(std::make_pair(instructions[i].address,
                          std::string(instructions[i].assembled + "^"+
                                      instructions[i].opcode + " " + instructions[i].args)));
    }

    /*char inst1[] = {0x41, 0x57};
    char inst2[] = {0x89, 0x85, 0x24, 0xff, 0xff, 0xff};
    char inst3[] = {0x4c, 0x29, 0xe5};
    char inst4[] = {0x53};
    char inst5[] = {0x8b, 0x85, 0x24, 0xff, 0xff, 0xff};

    content.push_back(std::make_pair(0x406637, std::string(inst1, 2)));
    content.push_back(std::make_pair(0x406639, std::string(inst2, 6)));
    content.push_back(std::make_pair(0x40663f, std::string(inst3, 3)));
    content.push_back(std::make_pair(0x406642, std::string(inst4, 1)));
    content.push_back(std::make_pair(0x406643, std::string(inst5, 6)));*/
}

void ELFCodeContainer::overwrite(unsigned long long address, std::string newMachineCode)
{
    ELFFile *efile = dynamic_cast<ELFFile *>(getFile());
#ifdef DEBUG
    assert(efile != nullptr);
#endif

    ELFIO::elfio *interpretor = efile->getELFIO();
    ELFIO::section *currentSection = interpretor->sections[index];

    if (currentSection->get_address() <= address &&
                    currentSection->get_address() + currentSection->get_size() > address)
    {
        currentSection->set_data(newMachineCode.c_str(), address, newMachineCode.size());
    }
}

std::string ELFCodeContainer::getSectionName()
{
    ELFFile *efile = dynamic_cast<ELFFile *>(getFile());
#ifdef DEBUG
    assert(efile != nullptr);
#endif

    ELFIO::elfio *interpretor = efile->getELFIO();
    ELFIO::section *currentSection = interpretor->sections[index];

    return currentSection->get_name();
}

ELFCodeContainer::~ELFCodeContainer() {}


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>nhlscrapi.games.playbyplay — nhlscrapi  documentation</title>

    <link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

    <link rel="top" title="nhlscrapi  documentation" href="../../../index.html" />
    <link rel="up" title="Module code" href="../../index.html" />

  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

Source code for nhlscrapi.games.playbyplay

from nhlscrapi._tools import build_enum

from nhlscrapi.scrapr.rtss import RTSS
from nhlscrapi.games.repscrwrap import RepScrWrap

Strength = build_enum('Even', 'PP', 'SH')
"""Enum indicating play strength."""

class Play(object):

[docs]    """Contains base level of state info about a given play."""
    def __init__(self,
            play_num=0, period=0, strength=Strength.Even, time={ "min": 20, "sec": 0 },
            vis_on_ice = { }, home_on_ice = { }, event=None):

        self.play_num = play_num
        """Number of player who made the play"""

        self.period = period
        """Current period"""

        self.strength = strength
        """Enum of type :py:class:`.Strength` indicating either even strength, shorthanded, or power play"""

        self.time = time
        """Time remaining in the period"""

        self.vis_on_ice = vis_on_ice
        """Visiting skaters on the ice. ``{ num: [position, name] }``"""

        self.home_on_ice = home_on_ice
        """Home skaters on the ice. ``{ num: [position, name] }``"""

        self.event = event
        """
        An object that inherits from :py:class:`.Event` that contains other specifics related to
        the given type of play
        """

class PlayByPlay(RepScrWrap):

[docs]    """
    Aggregator of :py:class:`.Play` objects that maintains the play-by-play data for a given game. Allows for
    custom stats of type :py:class:`.AccumulateStats` to be computed for the game.

    :Example:

    .. code:: python

        from nhlscrapi.games.game import GameKey
        from nhlscrapi.games.cumstats import ShotCt
        from nhlscrapi.games.playbyplay import PlayByPlay

        # define the game of interest and a stat accumulator
        pbp = PlayByPlay(
            game_key=GameKey(2015, 3, 224),
            cum_stats={ 'ShotCount': ShotCt() }
        )

        # compute and print results
        shot_cts = pbp.compute_stats()['ShotCount']
        print('Final Score:\t{}'.format(shot_cts.total))
    """

    def __init__(self, game_key, cum_stats = {}, init_cs_teams=True):
        super(PlayByPlay, self).__init__(game_key, RTSS(game_key))

        self.cum_stats = cum_stats
        """Dictionary of :py:class:`.AccumulateStats` to be computed"""

        self.init_cs_teams = init_cs_teams
        """Boolean, (default) True if the :py:class:`.AccumulateStats` objects should have team names initialized."""

        self.__have_stats = False
        self.__wrapped_plays = []

    # doesn't need to be dispatched
    # this is managed by compute_stats
    @property
    def plays(self):
        """List of :py:class:`.Play` objects."""
        self.compute_stats()
        return self.__wrapped_plays

    def compute_stats(self):

[docs]        """
        Compute the stats defined in ``self.cum_stats``.

        :returns: collection of all computed :py:class:`.AccumulateStats`
        :rtype: dict
        """
        if not self.__have_stats:
            if self.init_cs_teams and self.cum_stats:
                self.__init_cs_teams()

            for play in self._rep_reader.parse_plays_stream():
                p = Play(**play)
                self.__wrapped_plays.append(p)
                if self.cum_stats:
                    self.__process(p, self.cum_stats, 'update')
                self.__have_stats = True

        return self.cum_stats

    def __process(self, play, d, meth):

        for name, m in d.iteritems():
            getattr(m, meth)(play)

    def __init_cs_teams(self):
        teams = [ self.matchup['home'], self.matchup['away'] ]
        for _, cs in self.cum_stats.items():
            cs.initialize_teams(teams)

Related Topics

Documentation overview

Module code

Quick search

    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

      ©2015, Author.

      |
      Powered by Sphinx 1.3.1
      & Alabaster 0.7.6


text:
patch -p1 < $(dirname ${BASH_SOURCE[0]})/pulseaudio.diff

# The configure script enforces FORTIFY_SOURCE=2, but we can't live with that.
sed -i "s/-D_FORTIFY_SOURCE=2/-U_FORTIFY_SOURCE/g" ./configure


text:
import {FeaturedArt} from './_featuredart';

const META_SPACING = 30;
const META_MAX_WIDTH = 300;
const META_SIDE_MIN_WIDTH = 200;
const META_STACKED_MAX_HEIGHT = 68;

class TodayController {
  constructor() {
    this.$loadingSpinner = $('.loading-spinner');
    this.$artworkContainer = $('.artwork-container');
    this.$artwork = $('.artwork');
    this.$artworkLink = $('.artwork-link');
    this.$meta = $('.meta');
    this.setLoaded(false);
    FeaturedArt.get().then(data => this.load(data));
    $(window).on('resize', e => this.resize());
  }

  setLoaded(loaded) {
    $(document.body).toggleClass('loaded', !!loaded);
  }

  load(data) {
    let uri = data.imageUri;
    loadImage_(uri).then(img => {
      this.artworkAspectRatio = img.naturalWidth / Math.max(1, img.naturalHeight);
      this.$artwork.css('background-image', `url('${uri}')`);
      this.$artworkLink.attr('href', data.detailsUri);
      this.$meta.find('.title').html(data.title);
      this.$meta.find('.byline').text(data.byline);
      this.$meta.find('.attribution').text(data.attribution);
      this.resize();
      this.setLoaded(true);
    });
  }

  resize() {
    if (!this.artworkAspectRatio) {
      return;
    }

    let containerWidth = this.$artworkContainer.outerWidth();
    let containerHeight = Math.max(1, this.$artworkContainer.outerHeight());

    let artworkHeight = containerHeight;
    let artworkWidth = this.artworkAspectRatio * artworkHeight;

    // layouts in order of preference
    // 1. artwork horizontally centered, meta to right
    // 2. artwork as horizontally centered as possible, meta to right
    // 3. artwork horizontally centered, meta below
    // 4. artwork vertically centered, meta below
    // 5. artwork as vertically centered as possible, meta below

    // start with layout #1
    let artworkRect = {
      left: (containerWidth - artworkWidth) / 2,
      top: (containerHeight - artworkHeight) / 2,
      width: Math.round(artworkWidth),
      height: Math.round(artworkHeight)
    };

    let metaRect = {
      left: artworkRect.left + artworkWidth + META_SPACING,
      top: artworkRect.top,
      maxWidth: META_MAX_WIDTH
    };

    let metaDistToRightEdge = containerWidth - (metaRect.left + META_SIDE_MIN_WIDTH);

    if (metaDistToRightEdge < 0) {
      // switch to layout #2
      metaRect.left += metaDistToRightEdge;
      artworkRect.left += metaDistToRightEdge;

      if (artworkRect.left < 0) {
        // switch to layout #3
        let metaHeight = computeElementHeightAtWidth_(this.$meta, META_MAX_WIDTH);

        artworkHeight = containerHeight - (metaHeight + META_SPACING);
        artworkWidth = this.artworkAspectRatio * artworkHeight;

        artworkRect = {
          left: (containerWidth - artworkWidth) / 2,
          top: (containerHeight - (artworkHeight + metaHeight + META_SPACING)) / 2,
          width: Math.round(artworkWidth),
          height: Math.round(artworkHeight)
        };

        metaRect = {
          left: artworkRect.left,
          top: artworkRect.top + artworkHeight + META_SPACING
        };

        if (artworkRect.left < 0) {
          // switch to layout #4
          artworkWidth = containerWidth;
          artworkHeight = artworkWidth / this.artworkAspectRatio;

          artworkRect = {
            left: 0,
            top: (containerHeight - artworkHeight) / 2,
            width: Math.round(artworkWidth),
            height: Math.round(artworkHeight)
          };

          metaRect = {
            left: artworkRect.left,
            top: artworkRect.top + artworkHeight + META_SPACING
          };

          let metaDistToBottomEdge = containerHeight - (metaRect.top + metaHeight);
          if (metaDistToBottomEdge < 0) {
            // switch to layout #5
            metaRect.top += metaDistToBottomEdge;
            artworkRect.top += metaDistToBottomEdge;
          }
        }
      }
    }

    this.$artwork.css(artworkRect);
    this.$meta.css(metaRect);
  }
};

function computeElementHeightAtWidth_(el, width) {
  let $clone = $(el)
      .clone()
      .css({
        width: width,
        position: 'fixed',
        left: -9999
      })
      .appendTo(document.body);
  let height = $clone.outerHeight();
  $clone.remove();
  return height;
}

function loadImage_(url) {
  return new Promise((resolve, reject) => {
    let img = document.createElement('img');
    img.onload = e => {
      resolve(img);
    };
    img.onerror = e => {
      reject(e);
    };
    img.src = url;
  });
}

new TodayController();


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ClickMode_1 = require("../../Enums/Modes/ClickMode");
var HoverMode_1 = require("../../Enums/Modes/HoverMode");
var OutMode_1 = require("../../Enums/OutMode");
var Utils_1 = require("../Utils/Utils");
var DivMode_1 = require("../../Enums/Modes/DivMode");
var Constants_1 = require("../Utils/Constants");
var Repulser = (function () {
    function Repulser(container, particle) {
        this.container = container;
        this.particle = particle;
    }
    Repulser.prototype.repulse = function () {
        var container = this.container;
        var options = container.options;
        var hoverEnabled = options.interactivity.events.onHover.enable;
        var clickEnabled = options.interactivity.events.onClick.enable;
        var mouseMoveStatus = container.interactivity.status === Constants_1.Constants.mouseMoveEvent;
        var hoverMode = options.interactivity.events.onHover.mode;
        var clickMode = options.interactivity.events.onClick.mode;
        var divMode = options.interactivity.events.onDiv.mode;
        if (mouseMoveStatus && hoverEnabled && Utils_1.Utils.isInArray(HoverMode_1.HoverMode.repulse, hoverMode)) {
            this.hoverRepulse();
        }
        else if (clickEnabled && Utils_1.Utils.isInArray(ClickMode_1.ClickMode.repulse, clickMode)) {
            this.clickRepulse();
        }
        else if (options.interactivity.events.onDiv.enable && Utils_1.Utils.isInArray(DivMode_1.DivMode.repulse, divMode)) {
            this.divRepulse();
        }
    };
    Repulser.prototype.divRepulse = function () {
        var container = this.container;
        var options = container.options;
        var particle = this.particle;
        var elem = document.getElementById(options.interactivity.events.onDiv.elementId);
        var pos = {
            x: (elem.offsetLeft + elem.offsetWidth / 2),
            y: (elem.offsetTop + elem.offsetHeight / 2),
        };
        var divWidth = elem.offsetWidth / 2;
        if (container.retina.isRetina) {
            pos.x *= container.retina.pxRatio;
            pos.y *= container.retina.pxRatio;
            divWidth *= container.retina.pxRatio;
        }
        var dxDiv = particle.position.x - pos.x;
        var dyDiv = particle.position.y - pos.y;
        var distDiv = Math.sqrt(dxDiv * dxDiv + dyDiv * dyDiv);
        var normVec = {
            x: dxDiv / distDiv,
            y: dyDiv / distDiv,
        };
        var repulseRadius = divWidth;
        var velocity = 100;
        var repulseFactor = Utils_1.Utils.clamp((-Math.pow(distDiv / repulseRadius, 4) + 1) * velocity, 0, 50);
        this.particle.position.x += normVec.x * repulseFactor;
        this.particle.position.y += normVec.y * repulseFactor;
    };
    Repulser.prototype.clickRepulse = function () {
        var container = this.container;
        var particle = this.particle;
        if (!container.repulse.finish) {
            if (!container.repulse.count) {
                container.repulse.count = 0;
            }
            container.repulse.count++;
            if (container.repulse.count === container.particles.count) {
                container.repulse.finish = true;
            }
        }
        if (container.repulse.clicking) {
            var repulseDistance = container.retina.repulseModeDistance;
            var repulseRadius = Math.pow(repulseDistance / 6, 3);
            var mouseClickPos = container.interactivity.mouse.clickPosition || { x: 0, y: 0 };
            var dx = mouseClickPos.x - particle.position.x;
            var dy = mouseClickPos.y - particle.position.y;
            var d = dx * dx + dy * dy;
            var force = -repulseRadius / d;
            if (d <= repulseRadius) {
                this.processRepulse(dx, dy, force);
            }
        }
        else if (container.repulse.clicking === false) {
            particle.velocity.horizontal = particle.initialVelocity.horizontal;
            particle.velocity.vertical = particle.initialVelocity.vertical;
        }
    };
    Repulser.prototype.hoverRepulse = function () {
        var container = this.container;
        var options = container.options;
        var particle = this.particle;
        var mousePos = container.interactivity.mouse.position || { x: 0, y: 0 };
        var dxMouse = particle.position.x - mousePos.x;
        var dyMouse = particle.position.y - mousePos.y;
        var distMouse = Math.sqrt(dxMouse * dxMouse + dyMouse * dyMouse);
        var normVec = { x: dxMouse / distMouse, y: dyMouse / distMouse };
        var repulseRadius = container.retina.repulseModeDistance;
        var velocity = 100;
        var repulseFactor = Utils_1.Utils.clamp((1 - Math.pow(distMouse / repulseRadius, 2)) * velocity, 0, 50);
        var pos = {
            x: particle.position.x + normVec.x * repulseFactor,
            y: particle.position.y + normVec.y * repulseFactor,
        };
        var outMode = options.particles.move.outMode;
        if (outMode === OutMode_1.OutMode.bounce || outMode === OutMode_1.OutMode.bounceVertical || outMode === OutMode_1.OutMode.bounceHorizontal) {
            var isInside = {
                horizontal: pos.x - particle.radius > 0 && pos.x + particle.radius < container.canvas.dimension.width,
                vertical: pos.y - particle.radius > 0 && pos.y + particle.radius < container.canvas.dimension.height,
            };
            if (outMode === OutMode_1.OutMode.bounceVertical || isInside.horizontal) {
                particle.position.x = pos.x;
            }
            if (outMode === OutMode_1.OutMode.bounceHorizontal || isInside.vertical) {
                particle.position.y = pos.y;
            }
        }
        else {
            particle.position.x = pos.x;
            particle.position.y = pos.y;
        }
    };
    Repulser.prototype.processRepulse = function (dx, dy, force) {
        var container = this.container;
        var options = container.options;
        var particle = this.particle;
        var f = Math.atan2(dy, dx);
        particle.velocity.horizontal = force * Math.cos(f);
        particle.velocity.vertical = force * Math.sin(f);
        var outMode = options.particles.move.outMode;
        if (outMode === OutMode_1.OutMode.bounce || outMode === OutMode_1.OutMode.bounceHorizontal || outMode === OutMode_1.OutMode.bounceVertical) {
            var pos = {
                x: particle.position.x + particle.velocity.horizontal,
                y: particle.position.y + particle.velocity.vertical,
            };
            if (outMode !== OutMode_1.OutMode.bounceVertical) {
                if (pos.x + particle.radius > container.canvas.dimension.width || pos.x - particle.radius < 0) {
                    particle.velocity.horizontal = -particle.velocity.horizontal;
                }
            }
            if (outMode !== OutMode_1.OutMode.bounceHorizontal) {
                if (pos.y + particle.radius > container.canvas.dimension.height || pos.y - particle.radius < 0) {
                    particle.velocity.vertical = -particle.velocity.vertical;
                }
            }
        }
    };
    return Repulser;
}());
exports.Repulser = Repulser;


text:
/* Name: Microbeam_test.java
 * Project: Laser microdissection of dorsal closure
 * Version: 2.0
 * Author: Shane Hutson
 * Maintained by: Albert Mao
 * Date: 11/19/2004
 * Description: This plugin demonstrates some simple operations with the microbeam, and can be used to test the microbeam system.
 */

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import java.awt.event.*;
import ij.plugin.filter.*;
import java.io.*;
import java.util.*;
import javax.comm.*;
import plugins.LaserMicrosurgery.laserj.*;

public class Microbeam_test implements PlugInFilter {

	String ls;
	ImagePlus imp;
	ImageWindow win;
	ImageCanvas canvas;

	public int setup(String arg, ImagePlus imp) {
		this.imp = imp;
		if (imp!=null) {
			win = imp.getWindow();
			win.running = true;
		}
		ls = System.getProperty("line.separator");
		return DOES_ALL+NO_CHANGES;
	}

	public void run(ImageProcessor ip) {
		IJ.setColumnHeadings("");

		Microbeam microbeam = new Microbeam(Microbeam.CONFIG_FILENAME);
		if(!microbeam.isSetupOK()) return;

		// Perform the microbeam operations
		microbeam.setMirrorVelocity(0.05);
		microbeam.openShutter();
		microbeam.moveToMM(0.1,0.1);
		IJ.wait(1000);
		microbeam.moveToMM(0.00,0.00);
		microbeam.closeShutter();
		IJ.wait(1000);
		microbeam.openShutter();
		microbeam.moveToPIXELS(200, 200, ip, 1);
		IJ.wait(1000);
		microbeam.moveToPIXELS(256, 256, ip, 1);

		microbeam.closeShutter();

		// Release the microbeam
		microbeam.off();
		IJ.write("\nDONE\n");
	}

}


text:
int TwoChQS_SetSingleSite(CNRGbasisarray* pSingleSite);

#endif

#ifndef _TWOCHQSSETH0ANDERSON_
#define _TWOCHQSSETH0ANDERSON_

int TwoChQS_SetH0Anderson(vector<double> Params,CNRGbasisarray* pSingleSite,CNRGarray* pAeig,CNRGbasisarray* pAbasis);

void TwoChQS_SetH0CMphonon(vector<double> Params,CNRGbasisarray* pSingleSite,CNRGarray* pAeig,CNRGbasisarray* pAbasisH0,CNRGmatrix* NRGMats);

void TwoChQS_SetH0Kondo(vector<double> Params,CNRGbasisarray* pSingleSite,CNRGarray* pAeig,CNRGbasisarray* pAbasisH0,CNRGmatrix* MatArray);

void TwoChQS_SetH0Chain(vector<double> Params,CNRGbasisarray* pSingleSite,CNRGarray* pAeig,CNRGbasisarray* pAbasis);

void TwoChQS_SetH0CMphononwTransf(vector<double> Params,CNRGbasisarray* pSingleSite,CNRGarray* pAeig,CNRGbasisarray* pAbasisH0,CNRGmatrix* NRGMats);

#endif

#ifndef _TWOCHQS_UPDATEMATRICES_
#define _TWOCHQS_UPDATEMATRICES_

void TwoChQS_UpdateQm1fQ(CNRGbasisarray* pSingleSite, CNRGarray* pAeig,
			  CNRGbasisarray* pAbasis,CNRGmatrix* Qm1fNQ);

void TwoChQS_UpdateMatrixAfterCutting(CNRGbasisarray* pSingleSite,
				       CNRGbasisarray* pAeigCut,
				       CNRGbasisarray* pAbasis,
				       CNRGmatrix* Qm1fNQ,
				       CNRGmatrix* pMQQp1);

#endif

#ifndef _TWOCHQSDIAGHN_
#define _TWOCHQSDIAGHN_

void TwoChQS_DiagHN(vector<double> Params,
		     CNRGbasisarray* pAbasis,CNRGbasisarray* pSingleSite,
		     CNRGmatrix* Qm1fNQ, CNRGarray* pAeig);
#endif

#ifndef _TWOCHQS_OPMATRULES_
#define _TWOCHQS_OPMATRULES_

bool TwoChQS_cd_check(CNRGbasisarray *pAeigCut, int iblock1, int iblock2);

bool TwoChQSP_fA_check(CNRGbasisarray *pAeigCut, int iblock1, int iblock2);

double TwoChQS_d_fd_MatEl(vector<double> Params,
			  CNRGbasisarray* pAbasis,
			  CNRGbasisarray* pSingleSite,
			  CNRGmatrix* MatArray,
			  int ist, int jst);

double TwoChQS_H0ph_MatEl(vector<double> Params,
			  CNRGbasisarray* pAbasis,
			  CNRGbasisarray* pSingleSite,
			  CNRGmatrix* MatArray,
			  int ist, int jst);

double TwoChQS_H0phwTransf_MatEl(vector<double> Params,
			  CNRGbasisarray* pAbasis,
			  CNRGbasisarray* pSingleSite,
			  CNRGmatrix* MatArray,
			  int ist, int jst);

double TwoChQS_H0Kondo_MatEl(vector<double> Params,
			  CNRGbasisarray* pAbasis,
			  CNRGbasisarray* pSingleSite,
			  CNRGmatrix* MatArray,
			     int ist, int jst);

double TwoChQS_HN_MatEl(vector<double> Params,
			  CNRGbasisarray* pAbasis,
			  CNRGbasisarray* pSingleSite,
			  CNRGmatrix* MatArray,
			int ist, int jst);

double TwoChQS_cdPhonon_MatEl(CNRGbasisarray* pAbasis,
			      CNRGbasisarray* pSingleSite,
			      int ist, int jst, int ich);

double TwoChQS_cd_ich1_Phonon_MatEl(CNRGbasisarray* pAbasis,
				    CNRGbasisarray* pSingleSite,
				    int ist, int jst);

double TwoChQS_cd_ich2_Phonon_MatEl(CNRGbasisarray* pAbasis,
				    CNRGbasisarray* pSingleSite,
				    int ist, int jst);

double TwoChQS_fN_MatEl(CNRGbasisarray* pAbasis,
		       CNRGbasisarray* pSingleSite,
			int ist, int jst, int ich);

double TwoChQS_fNch1_MatEl(CNRGbasisarray* pAbasis,
		       CNRGbasisarray* pSingleSite,
			   int ist, int jst);

double TwoChQS_fNch2_MatEl(CNRGbasisarray* pAbasis,
		       CNRGbasisarray* pSingleSite,
			   int ist, int jst);

#endif

#ifndef _TWOCHQS_OPTABLES_
#define _TWOCHQS_OPTABLES_

double TwoChQS_fd_table(int channel, int sigma, int type_i, int type_j);

double TwoChQS_SpSm_table(int type_i, int type_j);

double TwoChQS_fdupfdn_table(int channel,
			     int type_i, int type_j);

double TwoChQS_Szch_table(int channel, int type_i);

#endif

#ifndef _TWOCHQSPSETSINGLESITE_
#define _TWOCHQSPSETSINGLESITE_

int TwoChQSP_SetSingleSite(CNRGbasisarray* pSingleSite);

#endif


text:
import { Injectable } from '@angular/core';

@Injectable()
export class TeamService {

  constructor() {}

}


text:
FROM java:8

RUN mkdir -p /opt/secor
ADD target/secor-*-bin.tar.gz /opt/secor/

COPY src/main/scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]


text:
Melange [SPICE]

Skein+SHA2 Proof of Work

Maximum of 1,000,000 total Coins

18 Coins Per Block

4 Minute Block Targets

8 Block Difficulty Retarget Window

Halving at 20,000 Block Intervals

Minimal Reward of .001 Coin

Default P2P Port: 1986

Default RPC Port: 1987

Console based mining via 'minespice true'
OR 'setgenerate true n' where 'n' is the number of processor cores to use, -1 is unlimited i.e. the equivalent to 'minespice true'.

Addresses begin with 'M' / Public Key 50

QR Code Support / LevelDB Support

%appdata%\spice\spice.conf

----------------------------------------

CHANGELOG

Version 0.9.0-Herbert (inital release). A tribute to Frank Herbert, now you can mine spice!


text:
package com.prolificinteractive.parallaxpager;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import java.util.Arrays;
import java.util.List;

public class ParallaxFactory {

  private final List<OnViewCreatedListener> otherListeners;

  public ParallaxFactory(OnViewCreatedListener... others) {
    otherListeners = Arrays.asList(others);
  }

  /**
   * Handle the created view
   *
   * @param view nullable.
   * @param context shouldn't be null.
   * @param attrs shouldn't be null.
   * @return null if null is passed in.
   */

  public View onViewCreated(View view, Context context, AttributeSet attrs) {
    if (view == null) {
      return null;
    }

    view = onViewCreatedInternal(view, context, attrs);
    for (OnViewCreatedListener listener : otherListeners) {
      if (listener != null) {
        view = listener.onViewCreated(view, context, attrs);
      }
    }
    return view;
  }

  private View onViewCreatedInternal(View view, final Context context, AttributeSet attrs) {

    int[] attrIds =
        { R.attr.a_in, R.attr.a_out, R.attr.x_in, R.attr.x_out, R.attr.y_in, R.attr.y_out, R.attr.override_visibility };

    TypedArray a = context.obtainStyledAttributes(attrs, attrIds);

    if (a != null) {
      if (a.length() > 0) {
        ParallaxViewTag tag = new ParallaxViewTag();
        tag.alphaIn = a.getFloat(0, 0f);
        tag.alphaOut = a.getFloat(1, 0f);
        tag.xIn = a.getFloat(2, 0f);
        tag.xOut = a.getFloat(3, 0f);
        tag.yIn = a.getFloat(4, 0f);
        tag.yOut = a.getFloat(5, 0f);
        tag.overrideVisibility = a.getBoolean(6, false);
        view.setTag(R.id.parallax_view_tag, tag);
      }
      a.recycle();
    }

    return view;
  }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Trimestriel Acad. Malgache ser. 2, 10:20. 1927

#### Original name
null

### Remarks
null


text:
using System;
using System.Text;

class PrintAllCardsDeck
{
    static void Main()
    {
        /*
         Problem 4. Print a Deck of 52 Cards
            Write a program that generates and prints all possible cards from a standard deck of 52 cards (without the jokers). The cards should be printed using the classical notation (like 5 of spades, A of hearts, 9 of clubs; and K of diamonds).
            The card faces should start from 2 to A.
            Print each card face in its four possible suits: clubs, diamonds, hearts and spades. Use 2 nested for-loops and a switch-case statement.
         */
        Console.WriteLine(" Print All Standart Cards \n");
        Console.OutputEncoding = Encoding.Unicode;

        for (int cardNum = 2; cardNum < 15; cardNum++)
        {
            for(int cardSymbol = 3; cardSymbol < 7; cardSymbol++)
            {
                if (cardNum < 11)
                {
                    switch (cardSymbol)
                    {
                        case 3: Console.Write(" {0}{1}, ", cardNum, (char)cardSymbol); break;
                        case 4: Console.Write(" {0}{1}, ", cardNum, (char)cardSymbol); break;
                        case 5: Console.Write(" {0}{1}, ", cardNum, (char)cardSymbol); break;
                        case 6: Console.Write(" {0}{1}, ", cardNum, (char)cardSymbol); break;
                    }
                }
                else
                {
                    switch (cardNum)
                    {
                        case 11: Console.Write(" J{0}, ", (char)cardSymbol); break;
                        case 12: Console.Write(" Q{0}, ", (char)cardSymbol); break;
                        case 13: Console.Write(" K{0}, ", (char)cardSymbol); break;
                        case 14: Console.Write(" A{0}, ", (char)cardSymbol); break;
                    }
                }
            }
            Console.WriteLine();
        }
        Console.WriteLine();
    }
}


text:
package com.alibaba.rocketmq.tools.command.message;

import com.alibaba.rocketmq.store.ConsumeQueue;
import com.alibaba.rocketmq.store.MapedFile;
import com.alibaba.rocketmq.store.MapedFileQueue;
import com.alibaba.rocketmq.store.SelectMapedBufferResult;
import com.alibaba.rocketmq.store.config.StorePathConfigHelper;

import java.io.File;
import java.nio.ByteBuffer;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @auther lansheng.zj
 */
public class Store {

    // 每个消息对应的MAGIC CODE daa320a7
    public final static int MessageMagicCode = 0xAABBCCDD ^ 1880681586 + 8;
    // 文件末尾空洞对应的MAGIC CODE cbd43194
    private final static int BlankMagicCode = 0xBBCCDDEE ^ 1880681586 + 8;
    // 存储消息的队列
    private MapedFileQueue mapedFileQueue;
    // ConsumeQueue集合
    private ConcurrentHashMap<String/* topic */, ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>> consumeQueueTable;

    private String cStorePath;
    private int cSize;
    private String lStorePath;
    private int lSize;

    public Store(String cStorePath, int cSize, String lStorePath, int lSize) {
        this.cStorePath = cStorePath;
        this.cSize = cSize;
        this.lStorePath = lStorePath;
        this.lSize = lSize;
        mapedFileQueue = new MapedFileQueue(cStorePath, cSize, null);
        consumeQueueTable =
                new ConcurrentHashMap<String/* topic */, ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>>();
    }

    public boolean load() {
        boolean result = this.mapedFileQueue.load();
        System.out.println("load commit log " + (result ? "OK" : "Failed"));
        if (result) {
            result = loadConsumeQueue();
        }
        System.out.println("load logics log " + (result ? "OK" : "Failed"));
        return result;
    }

    private boolean loadConsumeQueue() {
        File dirLogic = new File(StorePathConfigHelper.getStorePathConsumeQueue(lStorePath));
        File[] fileTopicList = dirLogic.listFiles();
        if (fileTopicList != null) {
            // TOPIC 遍历
            for (File fileTopic : fileTopicList) {
                String topic = fileTopic.getName();
                // TOPIC 下队列遍历
                File[] fileQueueIdList = fileTopic.listFiles();
                if (fileQueueIdList != null) {
                    for (File fileQueueId : fileQueueIdList) {
                        int queueId = Integer.parseInt(fileQueueId.getName());
                        ConsumeQueue logic = new ConsumeQueue(//
                                topic,//
                                queueId,//
                                StorePathConfigHelper.getStorePathConsumeQueue(lStorePath),//
                                lSize,//
                                null);
                        this.putConsumeQueue(topic, queueId, logic);
                        if (!logic.load()) {
                            return false;
                        }
                    }
                }
            }
        }
        System.out.println("load logics queue all over, OK");
        return true;
    }

    private void putConsumeQueue(final String topic, final int queueId, final ConsumeQueue consumeQueue) {
        ConcurrentHashMap<Integer/* queueId */, ConsumeQueue> map = this.consumeQueueTable.get(topic);
        if (null == map) {
            map = new ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>();
            map.put(queueId, consumeQueue);
            this.consumeQueueTable.put(topic, map);
        } else {
            map.put(queueId, consumeQueue);
        }
    }

    public ConsumeQueue findConsumeQueue(String topic, int queueId) {
        ConcurrentHashMap<Integer, ConsumeQueue> map = consumeQueueTable.get(topic);
        if (null == map) {
            ConcurrentHashMap<Integer, ConsumeQueue> newMap =
                    new ConcurrentHashMap<Integer, ConsumeQueue>(128);
            ConcurrentHashMap<Integer, ConsumeQueue> oldMap = consumeQueueTable.putIfAbsent(topic, newMap);
            if (oldMap != null) {
                map = oldMap;
            } else {
                map = newMap;
            }
        }
        ConsumeQueue logic = map.get(queueId);
        if (null == logic) {
            ConsumeQueue newLogic = new ConsumeQueue(//
                    topic,//
                    queueId,//
                    StorePathConfigHelper.getStorePathConsumeQueue(lStorePath),//
                    lSize,//
                    null);
            ConsumeQueue oldLogic = map.putIfAbsent(queueId, newLogic);
            if (oldLogic != null) {
                logic = oldLogic;
            } else {
                logic = newLogic;
            }
        }
        return logic;
    }

    public void traval(boolean openAll) {
        boolean success = true;
        byte[] bytesContent = new byte[1024];
        List<MapedFile> mapedFiles = this.mapedFileQueue.getMapedFiles();
        ALL:
        for (MapedFile mapedFile : mapedFiles) {
            long startOffset = mapedFile.getFileFromOffset();
            int position = 0;
            int msgCount = 0;
            int errorCount = 0;

            System.out.println("start travel " + mapedFile.getFileName());
            long startTime = System.currentTimeMillis();
            ByteBuffer byteBuffer = mapedFile.sliceByteBuffer();
            while (byteBuffer.hasRemaining()) {
                // 1 TOTALSIZE
                int totalSize = byteBuffer.getInt();
                // 2 MAGICCODE
                int magicCode = byteBuffer.getInt();
                if (BlankMagicCode == magicCode) {
                    position = byteBuffer.limit();
                    break;
                }
                // 3 BODYCRC
                int bodyCRC = byteBuffer.getInt();

                // 4 QUEUEID
                int queueId = byteBuffer.getInt();

                // 5 FLAG
                int flag = byteBuffer.getInt();
                flag = flag + 0;

                // 6 QUEUEOFFSET
                long queueOffset = byteBuffer.getLong();

                // 7 PHYSICALOFFSET
                long physicOffset = byteBuffer.getLong();

                // 8 SYSFLAG
                int sysFlag = byteBuffer.getInt();

                // 9 BORNTIMESTAMP
                long bornTimeStamp = byteBuffer.getLong();
                bornTimeStamp = bornTimeStamp + 0;

                // 10 BORNHOST(IP+PORT)
                byteBuffer.position(byteBuffer.position() + 8);

                // 11 STORETIMESTAMP
                long storeTimestamp = byteBuffer.getLong();

                // 12 STOREHOST(IP+PORT)
                byteBuffer.position(byteBuffer.position() + 8);

                // 13 RECONSUMETIMES
                int reconsumeTimes = byteBuffer.getInt();

                // 14 Prepared Transaction Offset
                long preparedTransactionOffset = byteBuffer.getLong();

                // 15 BODY
                int bodyLen = byteBuffer.getInt();
                if (bodyLen > 0) {
                    byteBuffer.position(byteBuffer.position() + bodyLen);
                }

                // 16 TOPIC
                byte topicLen = byteBuffer.get();
                byteBuffer.get(bytesContent, 0, topicLen);
                String topic = new String(bytesContent, 0, topicLen);

                Date storeTime = new Date(storeTimestamp);

                // 计算出来当前消息的偏移量
                long currentPhyOffset = startOffset + position;
                if (physicOffset != currentPhyOffset) {
                    System.out.println(storeTime
                            + " [fetal error] physicOffset != currentPhyOffset. position=" + position
                            + ", msgCount=" + msgCount + ", physicOffset=" + physicOffset
                            + ", currentPhyOffset=" + currentPhyOffset);
                    errorCount++;
                    if (!openAll) {
                        success = false;
                        break ALL;
                    }
                }

                ConsumeQueue consumeQueue = findConsumeQueue(topic, queueId);
                SelectMapedBufferResult smb = consumeQueue.getIndexBuffer(queueOffset);
                try {
                    long offsetPy = smb.getByteBuffer().getLong();
                    int sizePy = smb.getByteBuffer().getInt();
                    if (physicOffset != offsetPy) {
                        System.out.println(storeTime + " [fetal error] physicOffset != offsetPy. position="
                                + position + ", msgCount=" + msgCount + ", physicOffset=" + physicOffset
                                + ", offsetPy=" + offsetPy);
                        errorCount++;
                        if (!openAll) {
                            success = false;
                            break ALL;
                        }
                    }
                    if (totalSize != sizePy) {
                        System.out.println(storeTime + " [fetal error] totalSize != sizePy. position="
                                + position + ", msgCount=" + msgCount + ", totalSize=" + totalSize
                                + ", sizePy=" + sizePy);
                        errorCount++;
                        if (!openAll) {
                            success = false;
                            break ALL;
                        }
                    }
                } finally {
                    smb.release();
                }

                msgCount++;
                position += totalSize;
                byteBuffer.position(position);
            }

            System.out.println("end travel " + mapedFile.getFileName() + ", total msg=" + msgCount
                    + ", error count=" + errorCount + ", cost:" + (System.currentTimeMillis() - startTime));
        }

        System.out.println("travel " + (success ? "ok" : "fail"));
    }
}


text:
package org.pathwayeditor.visualeditor.selection;

import java.util.Iterator;

import org.pathwayeditor.figure.geometry.ConvexHullCalculator;
import org.pathwayeditor.figure.geometry.Envelope;
import org.pathwayeditor.figure.geometry.IConvexHull;
import org.pathwayeditor.figure.geometry.IConvexHullCalculator;
import org.pathwayeditor.figure.geometry.LineSegment;
import org.pathwayeditor.figure.geometry.Point;
import org.pathwayeditor.figure.geometry.Vector;
import org.pathwayeditor.visualeditor.controller.ILinkController;

public class LinkMidPointSelectionHandle extends SelectionHandle implements ILinkMidLineHandleShape {
	private static final double HANDLE_OFFSET = 6.0;
//	private static final double HANDLE_WIDTH = HANDLE_OFFSET*2;
//	private static final double HANDLE_HEIGHT = HANDLE_OFFSET*2;

	private IConvexHull diamondHull;

	public LinkMidPointSelectionHandle(ISelection selection, ILinkController nodeController, LineSegment lineSegment, int lineSegmentIdx){
		super(nodeController, SelectionHandleType.LinkMidPoint, selection, lineSegmentIdx);
		Point bisection = lineSegment.getMidPoint();
		IConvexHullCalculator builder = new ConvexHullCalculator();
		Vector leftNormal = lineSegment.getVector();
		Vector scaledLeftNormal = leftNormal.scale(HANDLE_OFFSET/leftNormal.magnitude());
		builder.addPoint(bisection.translate(scaledLeftNormal.getIMagnitude(), scaledLeftNormal.getJMagnitude()));
		builder.addPoint(bisection.translate(-scaledLeftNormal.getJMagnitude(), scaledLeftNormal.getIMagnitude()));
		builder.addPoint(bisection.translate(-scaledLeftNormal.getIMagnitude(), -scaledLeftNormal.getJMagnitude()));
		builder.addPoint(bisection.translate(scaledLeftNormal.getJMagnitude(), -scaledLeftNormal.getIMagnitude()));
		builder.calculate();
		this.diamondHull = builder.getConvexHull();
	}

	@Override
	public boolean containsPoint(Point point) {
		return this.diamondHull.containsPoint(point);
	}

	@Override
	public Envelope getBounds() {
		return this.diamondHull.getEnvelope();
	}

	@Override
	public int compareTo(ISelectionHandle o) {
		return this.getDrawingPrimitiveController().compareTo(o.getDrawingPrimitiveController());
	}

	@Override
	public void translate(Point delta) {
		Envelope newEnvelope = this.diamondHull.getEnvelope().translate(delta);
		this.diamondHull = this.diamondHull.changeEnvelope(newEnvelope);
	}

	@Override
	public void drawShape(IHandleShapeDrawer drawer) {
		drawer.drawHandle(this);
	}

	@Override
	public Iterator<Point> pointIterator() {
		return this.diamondHull.pointIterator();
	}

}


text:
from .index.drivers.alchemy import SQLAlchemyIndexDriver
from .alias.drivers.alchemy import SQLAlchemyAliasDriver
from .auth.drivers.alchemy import SQLAlchemyAuthDriver

CONFIG = {}

CONFIG["JSONIFY_PRETTYPRINT_REGULAR"] = False
AUTO_MIGRATE = True

# - DEFAULT_PREFIX: prefix to be prepended.
# - PREPEND_PREFIX: the prefix is preprended to the generated GUID when a
#   new record is created WITHOUT a provided GUID.
# - ADD_PREFIX_ALIAS: aliases are created for new records - "<PREFIX><GUID>".
# Do NOT set both ADD_PREFIX_ALIAS and PREPEND_PREFIX to True, or aliases
# will be created as "<PREFIX><PREFIX><GUID>".
CONFIG["INDEX"] = {
    "driver": SQLAlchemyIndexDriver(
        "sqlite:///index.sq3",
        auto_migrate=AUTO_MIGRATE,
        echo=True,
        index_config={
            "DEFAULT_PREFIX": "testprefix:",
            "PREPEND_PREFIX": True,
            "ADD_PREFIX_ALIAS": False,
        },
    )
}

CONFIG["ALIAS"] = {
    "driver": SQLAlchemyAliasDriver(
        "sqlite:///alias.sq3", auto_migrate=AUTO_MIGRATE, echo=True
    )
}

CONFIG["DIST"] = [
    {
        "name": "Other IndexD",
        "host": "https://indexd.example.io/index/",
        "hints": [".*ROCKS.*"],
        "type": "indexd",
    },
    {"name": "DX DOI", "host": "https://doi.org/", "hints": ["10\..*"], "type": "doi"},
    {
        "name": "DOS System",
        "host": "https://example.com/api/ga4gh/dos/v1/",
        "hints": [],
        "type": "dos",
    },
    {
        "name": "DRS System",
        "host": "https://example.com/api/ga4gh/drs/v1/",
        "hints": [],
        "type": "drs",
    },
]

AUTH = SQLAlchemyAuthDriver("sqlite:///auth.sq3")

settings = {"config": CONFIG, "auth": AUTH}


text:
<!doctype html>

    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" />

    <link rel="stylesheet" href="styles/main.css">
    <link rel="stylesheet" href="styles/sb-admin-2.css">
    <link rel="stylesheet" href="styles/timeline.css">
    <link rel="stylesheet" href="bower_components/metisMenu/dist/metisMenu.min.css">
    <link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.min.css">
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css" type="text/css">

       Deus está aqui, ele está aqui.......


text:
CREATE TABLE [dbo].[carrot_Widget] (
    [Root_WidgetID]   UNIQUEIDENTIFIER CONSTRAINT [DF_carrot_Widget_Root_WidgetID] DEFAULT (newid()) NOT NULL,
    [Root_ContentID]  UNIQUEIDENTIFIER NOT NULL,
    [WidgetOrder]     INT              NOT NULL,
    [PlaceholderName] NVARCHAR (256)   NOT NULL,
    [ControlPath]     NVARCHAR (512)   NOT NULL,
    [WidgetActive]    BIT              NOT NULL,
    [GoLiveDate]      DATETIME         NOT NULL,
    [RetireDate]      DATETIME         NOT NULL,
    CONSTRAINT [PK_carrot_Widget] PRIMARY KEY CLUSTERED ([Root_WidgetID] ASC),
    CONSTRAINT [carrot_RootContent_carrot_Widget_FK] FOREIGN KEY ([Root_ContentID]) REFERENCES [dbo].[carrot_RootContent] ([Root_ContentID])
);


text:
namespace views {

// static
AXAuraObjCache* AXAuraObjCache::GetInstance() {
  return Singleton<AXAuraObjCache>::get();
}

AXAuraObjWrapper* AXAuraObjCache::GetOrCreate(View* view) {
  return CreateInternal<AXViewObjWrapper>(view, view_to_id_map_);
}

AXAuraObjWrapper* AXAuraObjCache::GetOrCreate(Widget* widget) {
  return CreateInternal<AXWidgetObjWrapper>(widget, widget_to_id_map_);
}

AXAuraObjWrapper* AXAuraObjCache::GetOrCreate(aura::Window* window) {
  return CreateInternal<AXWindowObjWrapper>(window, window_to_id_map_);
}

int32 AXAuraObjCache::GetID(View* view) {
  return GetIDInternal(view, view_to_id_map_);
}

int32 AXAuraObjCache::GetID(Widget* widget) {
  return GetIDInternal(widget, widget_to_id_map_);
}

int32 AXAuraObjCache::GetID(aura::Window* window) {
  return GetIDInternal(window, window_to_id_map_);
}

void AXAuraObjCache::Remove(View* view) {
  RemoveInternal(view, view_to_id_map_);
}

void AXAuraObjCache::Remove(Widget* widget) {
  RemoveInternal(widget, widget_to_id_map_);
}

void AXAuraObjCache::Remove(aura::Window* window) {
  RemoveInternal(window, window_to_id_map_);
}

AXAuraObjWrapper* AXAuraObjCache::Get(int32 id) {
  std::map<int32, AXAuraObjWrapper*>::iterator it = cache_.find(id);

  if (it == cache_.end())
    return NULL;

  return it->second;
}

void AXAuraObjCache::Remove(int32 id) {
  AXAuraObjWrapper* obj = Get(id);

  if (id == -1 || !obj)
    return;

  cache_.erase(id);
  delete obj;
}

AXAuraObjCache::AXAuraObjCache() : current_id_(1), is_destroying_(false) {
}

AXAuraObjCache::~AXAuraObjCache() {
  is_destroying_ = true;
  STLDeleteContainerPairSecondPointers(cache_.begin(), cache_.end());
  cache_.clear();
}

template <typename AuraViewWrapper, typename AuraView>
AXAuraObjWrapper* AXAuraObjCache::CreateInternal(
    AuraView* aura_view, std::map<AuraView*, int32>& aura_view_to_id_map) {
  if (!aura_view)
    return NULL;

  typename std::map<AuraView*, int32>::iterator it =
      aura_view_to_id_map.find(aura_view);

  if (it != aura_view_to_id_map.end())
    return Get(it->second);

  AXAuraObjWrapper* wrapper = new AuraViewWrapper(aura_view);
  aura_view_to_id_map[aura_view] = current_id_;
  cache_[current_id_] = wrapper;
  current_id_++;
  return wrapper;
}

template<typename AuraView> int32 AXAuraObjCache::GetIDInternal(
    AuraView* aura_view, std::map<AuraView*, int32>& aura_view_to_id_map) {
  if (!aura_view)
    return -1;

  typename std::map<AuraView*, int32>::iterator it =
      aura_view_to_id_map.find(aura_view);

  if (it != aura_view_to_id_map.end())
    return it->second;

  return -1;
}

template<typename AuraView>
void AXAuraObjCache::RemoveInternal(
    AuraView* aura_view, std::map<AuraView*, int32>& aura_view_to_id_map) {
  int32 id = GetID(aura_view);
  if (id == -1)
    return;
  aura_view_to_id_map.erase(aura_view);
  Remove(id);
}

}  // namespace views


text:
=Scenes=

 - Scenes/ZerothSystem.scene
   = Contains solar system-wide simulation of the Zeroth system. Includes stars (binary system), planets (manually placed with seed), moons (manually places with seed), comets (manually placed with seed), astroids (procedural), artificial satelites (procedural).


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.whatdoyouwanttodo.ActiveListeningActivity" >

</menu>


text:
  Verifikasi akun Anda terlebih dahulu dengan membuka tautan yang terdapat di pesan masuk Email Anda

  Tidak ada di email ? <a href="<?=site_url('siswa/resend');?>">Kirim ulang link verifikasi


text:
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.multireducerWrapAction = multireducerWrapAction;
exports.default = multireducerBindActionCreators;

var _key = require('./key');

var _key2 = _interopRequireDefault(_key);

var _redux = require('redux');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function multireducerWrapAction(action, multireducerKey) {
  var markTypeWitKey = function markTypeWitKey(type) {
    return type + _key2.default + multireducerKey;
  };

  if (action.types) {
    return _extends({}, action, {
      types: action.types.map(markTypeWitKey)
    });
  }
  return _extends({}, action, {
    type: markTypeWitKey(action.type)
  });
}

function multireducerBindActionCreators(multireducerKey, actionCreators, dispatch) {
  var wrappingDispatch = function wrappingDispatch(action) {
    if (typeof action === 'function') {
      var wrappedThunk = function wrappedThunk(globalDispatch, getState) {
        return action(wrappingDispatch, getState, globalDispatch, multireducerKey);
      };
      return dispatch(wrappedThunk);
    } else if ((typeof action === 'undefined' ? 'undefined' : _typeof(action)) === 'object') {
      return dispatch(multireducerWrapAction(action, multireducerKey));
    }
  };

  return (0, _redux.bindActionCreators)(actionCreators, wrappingDispatch);
}


text:
package main.view;

public interface IFView {
    public void update();
}


text:
package org.agnostic.config;

import org.hibernate.ejb.HibernatePersistence;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;
import java.util.Properties;

/**
 * SpringConfig Class.
 * User: ggomes
 * Date: 30/08/13
 * Time: 18:15
 */
@Configuration
@EnableJpaRepositories("org.agnostic.persistence")
@EnableTransactionManagement
@PropertySource(value = {"classpath:database.properties"})
@ComponentScan(basePackages = {"org.agnostic.persistence","org.agnostic.util","org.agnostic.error"})
public class PersistenceConfig {

    private static final String PROPERTY_NAME_DATABASE_URL = "jdbc.url";
    private static final String PROPERTY_NAME_DATABASE_DRIVER = "jdbc.driver";
    private static final String PROPERTY_NAME_DATABASE_PASSWORD = "jdbc.password";
    private static final String PROPERTY_NAME_DATABASE_USERNAME = "jdbc.username";

    private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "hibernate.dialect";
    private static final String PROPERTY_NAME_HIBERNATE_FORMAT_SQL = "hibernate.format_sql";
    private static final String PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY = "hibernate.ejb.naming_strategy";
    private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "hibernate.show_sql";
    private static final String PROPERTY_NAME_HIBERNATE_GENDDL = "hibernate.hbm2ddl.auto";
    private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "entitymanager.packages.to.scan";

    @javax.annotation.Resource
    private org.springframework.core.env.Environment environment;

    @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setUrl(environment.getRequiredProperty(PROPERTY_NAME_DATABASE_URL));
        dataSource.setDriverClassName(environment.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER));
        dataSource.setUsername(environment.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME));
        dataSource.setPassword(environment.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD));

        return dataSource;
    }

    @Bean
    public JpaTransactionManager transactionManager() throws ClassNotFoundException {
        JpaTransactionManager transactionManager = new JpaTransactionManager();

        transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());

        return transactionManager;
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws ClassNotFoundException {
        LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

        entityManagerFactoryBean.setDataSource(dataSource());
        entityManagerFactoryBean.setPackagesToScan(environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
        entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);

        Properties jpaProperties = new Properties();
        jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
        jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL));
        jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY));
        jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
        jpaProperties.put(PROPERTY_NAME_HIBERNATE_GENDDL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_GENDDL));

        entityManagerFactoryBean.setJpaProperties(jpaProperties);

        return entityManagerFactoryBean;
    }
}


text:
<?php echo $this->alert->flash(['error', 'success']); ?>

 Kullanıcılar

                <?php if ($this->permission('user-delete')): ?>
                     Hepsini Seç
                    <a class="btn btn-sm btn-danger deleteall" href="<?php echo moduleUri('userDelete') ?>">
                <?php endif; ?>
                <?php if ($this->permission('user-insert')): ?>
                    <a class="btn btn-sm btn-success" href="<?php echo moduleUri('userInsert') ?>"> Yeni Kayıt
                <?php endif; ?>

                <?php $this->view('filter') ?>

            #
            Kullanıcı Adı
            Grubu
            İşlem

        <?php foreach ($records as $item): ?>

            <input type="checkbox" class="checkall-item" value="<?php echo $item->id ?>" />
            <?php echo $item->id ?>
            <?php echo $item->username ?>
            <?php echo $item->groupName ?>

                <?php if ($this->permission('user-update')): ?>
                    <a class="btn btn-xs btn-primary" href="<?php echo moduleUri('userUpdate', $item->id)?>">
                <?php endif; ?>
                <?php if ($this->permission('user-delete')): ?>
                    <a class="btn btn-xs btn-danger confirm-delete" href="<?php echo moduleUri('userDelete', $item->id) ?>">
                <?php endif; ?>

        <?php endforeach; ?>

    <?php if (! empty($paginate)): ?>

            <?php echo $paginate['pagination'] ?>

    <?php endif; ?>


text:
package com.planet_ink.coffee_mud.WebMacros;

import com.planet_ink.coffee_web.interfaces.*;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class FactionName extends StdWebMacro
{
	@Override
	public String name()
	{
		return "FactionName";
	}

	@Override
	public String runMacro(final HTTPRequest httpReq, final String parm, final HTTPResponse httpResp)
	{
		final String last=httpReq.getUrlParameter("FACTION");
		if(last==null)
			return " @break@";
		if(last.length()>0)
		{
			final Faction F=CMLib.factions().getFaction(last);
			if(F!=null)
				return clearWebMacros(F.name());
		}
		return "";
	}
}


text:
MPL_TEST_CASE()
{
    typedef list<int,long,char,char[50],double> types;
    typedef max_element<
          transform_view< types, sizeof_<_> >
        >::type iter;

    MPL_ASSERT_RELATION( deref<iter>::type::value, ==, 50 );
}


text:
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.TestHost
{
    internal class AsyncStreamWrapper : Stream
    {
        private readonly Stream _inner;
        private readonly Func<bool> _allowSynchronousIO;

        internal AsyncStreamWrapper(Stream inner, Func<bool> allowSynchronousIO)
        {
            _inner = inner;
            _allowSynchronousIO = allowSynchronousIO;
        }

        public override bool CanRead => _inner.CanRead;

        public override bool CanSeek => false;

        public override bool CanWrite => _inner.CanWrite;

        public override long Length => throw new NotSupportedException("The stream is not seekable.");

        public override long Position
        {
            get => throw new NotSupportedException("The stream is not seekable.");
            set => throw new NotSupportedException("The stream is not seekable.");
        }

        public override void Flush()
        {
            // Not blocking Flush because things like StreamWriter.Dispose() always call it.
            _inner.Flush();
        }

        public override Task FlushAsync(CancellationToken cancellationToken)
        {
            return _inner.FlushAsync(cancellationToken);
        }

        public override int Read(byte[] buffer, int offset, int count)
        {
            if (!_allowSynchronousIO())
            {
                throw new InvalidOperationException("Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true.");
            }

            return _inner.Read(buffer, offset, count);
        }

        public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
        {
            return _inner.ReadAsync(buffer, offset, count, cancellationToken);
        }

        public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
        {
            return _inner.ReadAsync(buffer, cancellationToken);
        }

        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
        {
            return _inner.BeginRead(buffer, offset, count, callback, state);
        }

        public override int EndRead(IAsyncResult asyncResult)
        {
            return _inner.EndRead(asyncResult);
        }

        public override long Seek(long offset, SeekOrigin origin)
        {
            throw new NotSupportedException("The stream is not seekable.");
        }

        public override void SetLength(long value)
        {
            throw new NotSupportedException("The stream is not seekable.");
        }

        public override void Write(byte[] buffer, int offset, int count)
        {
            if (!_allowSynchronousIO())
            {
                throw new InvalidOperationException("Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true.");
            }

            _inner.Write(buffer, offset, count);
        }

        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
        {
            return _inner.BeginWrite(buffer, offset, count, callback, state);
        }

        public override void EndWrite(IAsyncResult asyncResult)
        {
            _inner.EndWrite(asyncResult);
        }

        public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
        {
            return _inner.WriteAsync(buffer, offset, count, cancellationToken);
        }

        public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
        {
            return _inner.WriteAsync(buffer, cancellationToken);
        }

        public override void Close()
        {
            // Don't dispose the inner stream, we don't want to impact the client stream
        }

        protected override void Dispose(bool disposing)
        {
            // Don't dispose the inner stream, we don't want to impact the client stream
        }

        public override ValueTask DisposeAsync()
        {
            // Don't dispose the inner stream, we don't want to impact the client stream
            return default;
        }
    }
}


text:
namespace mojo {
namespace core {

Watch::Watch(const scoped_refptr<WatcherDispatcher>& watcher,
             const scoped_refptr<Dispatcher>& dispatcher,
             uintptr_t context,
             MojoHandleSignals signals,
             MojoTriggerCondition condition)
    : watcher_(watcher),
      dispatcher_(dispatcher),
      context_(context),
      signals_(signals),
      condition_(condition) {}

bool Watch::NotifyState(const HandleSignalsState& state,
                        bool allowed_to_call_callback) {
  AssertWatcherLockAcquired();

  // NOTE: This method must NEVER call into |dispatcher_| directly, because it
  // may be called while |dispatcher_| holds a lock.
  MojoResult rv = MOJO_RESULT_SHOULD_WAIT;
  RequestContext* const request_context = RequestContext::current();
  const bool notify_success =
      (state.satisfies_any(signals_) &&
       condition_ == MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED) ||
      (!state.satisfies_all(signals_) &&
       condition_ == MOJO_TRIGGER_CONDITION_SIGNALS_UNSATISFIED);
  if (notify_success) {
    rv = MOJO_RESULT_OK;
    if (allowed_to_call_callback && rv != last_known_result_) {
      request_context->AddWatchNotifyFinalizer(this, MOJO_RESULT_OK, state);
    }
  } else if (condition_ == MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED &&
             !state.can_satisfy_any(signals_)) {
    rv = MOJO_RESULT_FAILED_PRECONDITION;
    if (allowed_to_call_callback && rv != last_known_result_) {
      request_context->AddWatchNotifyFinalizer(
          this, MOJO_RESULT_FAILED_PRECONDITION, state);
    }
  }

  last_known_signals_state_ =
      *static_cast<const MojoHandleSignalsState*>(&state);
  last_known_result_ = rv;
  return ready();
}

void Watch::Cancel() {
  RequestContext::current()->AddWatchCancelFinalizer(this);
}

void Watch::InvokeCallback(MojoResult result,
                           const HandleSignalsState& state,
                           MojoTrapEventFlags flags) {
  // We hold the lock through invocation to ensure that only one notification
  // callback runs for this context at any given time.
  base::AutoLock lock(notification_lock_);

  // Ensure that no notifications are dispatched beyond cancellation.
  if (is_cancelled_)
    return;

  if (result == MOJO_RESULT_CANCELLED)
    is_cancelled_ = true;

  // NOTE: This will acquire |watcher_|'s internal lock. It's safe because a
  // thread can only enter InvokeCallback() from within a RequestContext
  // destructor where no dispatcher locks are held.
  watcher_->InvokeWatchCallback(context_, result, state, flags);
}

Watch::~Watch() = default;

#if DCHECK_IS_ON()
void Watch::AssertWatcherLockAcquired() const {
  watcher_->lock_.AssertAcquired();
}
#endif

}  // namespace core
}  // namespace mojo


text:
/*
  Defines a library wide registration system for classes.
*/
#ifndef SRC_AFF4_REGISTRY_H_
#define SRC_AFF4_REGISTRY_H_

#include "config.h"

#include <glog/logging.h>

#include <unordered_map>
#include <memory>
#include <string>
#include <iostream>

//using std::string;
//using std::unique_ptr;
//using std::unordered_map;
//using std::function;

class DataStore;
class URN;

template<class T>
class ClassFactory {
  public:
    std::unordered_map<
    std::string, std::function<T* (DataStore*, const URN*)> > factoryFunctionRegistry;

    std::unique_ptr<T> CreateInstance(char* name, DataStore* resolver,
                                      const URN* urn = nullptr) {
        return CreateInstance(std::string(name), resolver, urn);
    }

    std::unique_ptr<T> CreateInstance(std::string name, DataStore* data,
                                      const URN* urn = nullptr) {
        T* instance = nullptr;

        // find name in the registry and call factory method.
        auto it = factoryFunctionRegistry.find(name);
        if (it != factoryFunctionRegistry.end()) {
            instance = it->second(data, urn);
        }

        return std::unique_ptr<T>(instance);
    }

    void RegisterFactoryFunction(
        std::string name, std::function<
        T*(DataStore*, const URN*)> classFactoryFunction) {
        // register the class factory function
        factoryFunctionRegistry[name] = classFactoryFunction;
    }
};

#endif  // SRC_AFF4_REGISTRY_H_


text:
import Variable from './variable';

/**
 * @class Definition
 */
export default class Definition {
    constructor(type, name, node, parent, index, kind) {
        /**
         * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
         */
        this.type = type;
        /**
         * @member {esprima.Identifier} Definition#name - the identifier AST node of the occurrence.
         */
        this.name = name;
        /**
         * @member {esprima.Node} Definition#node - the enclosing node of the identifier.
         */
        this.node = node;
        /**
         * @member {esprima.Node?} Definition#parent - the enclosing statement node of the identifier.
         */
        this.parent = parent;
        /**
         * @member {Number?} Definition#index - the index in the declaration statement.
         */
        this.index = index;
        /**
         * @member {String?} Definition#kind - the kind of the declaration statement.
         */
        this.kind = kind;
    }
}

/**
 * @class ParameterDefinition
 */
class ParameterDefinition extends Definition {
    constructor(name, node, index, rest) {
        super(Variable.Parameter, name, node, null, index, null);
        /**
         * Whether the parameter definition is a part of a rest parameter.
         * @member {boolean} ParameterDefinition#rest
         */
        this.rest = rest;
    }
}

export {
    ParameterDefinition,
    Definition
}

/* vim: set sw=4 ts=4 et tw=80 : */


text:
Blog app based on djangogirls tutorial to help teach young dev at ho@djangogirls.org

# How to Run

Obtain your api key from  newsapi.org
export newskey=newsapi_key

./manage.py makemigrations; ./manage.py migrate

./manage.py createsuperuser


text:
graph-sandbox
=============

An interactive graph editor that runs in the browser.

License
=======

This software is released under the FreeBSD (2-clause BSD) license. See the LICENSE file for details.

This software is built on (and is distributed with) `Paper.js <http://paperjs.com/>`_, which is released under the MIT license. See the lib/paper/LICENSE.txt file for details.

This software is tested with (and is distributed with) `QUnit <http://qunitjs.com/>`_, which is released under the MIT license. See the test/lib/qunit/MIT-LICENSE.txt file for details.


text:
#include <aws/ssm/model/ResourceDataSyncS3Format.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace SSM
  {
    namespace Model
    {
      namespace ResourceDataSyncS3FormatMapper
      {

        static const int JsonSerDe_HASH = HashingUtils::HashString("JsonSerDe");

        ResourceDataSyncS3Format GetResourceDataSyncS3FormatForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == JsonSerDe_HASH)
          {
            return ResourceDataSyncS3Format::JsonSerDe;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<ResourceDataSyncS3Format>(hashCode);
          }

          return ResourceDataSyncS3Format::NOT_SET;
        }

        Aws::String GetNameForResourceDataSyncS3Format(ResourceDataSyncS3Format enumValue)
        {
          switch(enumValue)
          {
          case ResourceDataSyncS3Format::JsonSerDe:
            return "JsonSerDe";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return "";
          }
        }

      } // namespace ResourceDataSyncS3FormatMapper
    } // namespace Model
  } // namespace SSM
} // namespace Aws