text:
namespace ui {
namespace ime {

class CandidateView;
class InformationTextArea;

// CandidateWindowView is the main container of the candidate window UI.
class UI_CHROMEOS_EXPORT CandidateWindowView
    : public views::BubbleDialogDelegateView,
      public views::ButtonListener {
 public:
  // The object can be monitored by the observer.
  class Observer {
   public:
    virtual ~Observer() {}
    // The function is called when a candidate is committed.
    virtual void OnCandidateCommitted(int index) = 0;
  };

  explicit CandidateWindowView(gfx::NativeView parent);
  ~CandidateWindowView() override;
  views::Widget* InitWidget();

  // Adds the given observer. The ownership is not transferred.
  void AddObserver(Observer* observer) {
    observers_.AddObserver(observer);
  }

  // Removes the given observer.
  void RemoveObserver(Observer* observer) {
    observers_.RemoveObserver(observer);
  }

  // Hides the lookup table.
  void HideLookupTable();

  // Hides the auxiliary text.
  void HideAuxiliaryText();

  // Hides the preedit text.
  void HidePreeditText();

  // Shows the lookup table.
  void ShowLookupTable();

  // Shows the auxiliary text.
  void ShowAuxiliaryText();

  // Shows the preedit text.
  void ShowPreeditText();

  // Updates the preedit text.
  void UpdatePreeditText(const base::string16& text);

  // Updates candidates of the candidate window from |candidate_window|.
  // Candidates are arranged per |orientation|.
  void UpdateCandidates(const ui::CandidateWindow& candidate_window);

  void SetCursorBounds(const gfx::Rect& cursor_bounds,
                       const gfx::Rect& composition_head);

 private:
  friend class CandidateWindowViewTest;

  // views::BubbleDialogDelegateView:
  const char* GetClassName() const override;

  // Overridden from views::ButtonListener:
  void ButtonPressed(views::Button* sender, const ui::Event& event) override;

  void SelectCandidateAt(int index_in_page);
  void UpdateVisibility();

  // Initializes the candidate views if needed.
  void MaybeInitializeCandidateViews(
      const ui::CandidateWindow& candidate_window);

  // The candidate window data model.
  ui::CandidateWindow candidate_window_;

  // The index in the current page of the candidate currently being selected.
  int selected_candidate_index_in_page_;

  // The observers of the object.
  base::ObserverList<Observer>::Unchecked observers_;

  // Views created in the class will be part of tree of |this|, so these
  // child views will be deleted when |this| is deleted.
  InformationTextArea* auxiliary_text_;
  InformationTextArea* preedit_;
  views::View* candidate_area_;

  // The candidate views are used for rendering candidates.
  std::vector<std::unique_ptr<CandidateView>> candidate_views_;

  // Current columns size in |candidate_area_|.
  gfx::Size previous_shortcut_column_size_;
  gfx::Size previous_candidate_column_size_;
  gfx::Size previous_annotation_column_size_;

  // The last cursor bounds.
  gfx::Rect cursor_bounds_;

  // The last composition head bounds.
  gfx::Rect composition_head_bounds_;

  // True if the candidate window should be shown with aligning with composition
  // text as opposed to the cursor.
  bool should_show_at_composition_head_;

  // True if the candidate window should be shown on the upper side of
  // composition text.
  bool should_show_upper_side_;

  // True if the candidate window was open.  This is used to determine when to
  // send OnCandidateWindowOpened and OnCandidateWindowClosed events.
  bool was_candidate_window_open_;

  DISALLOW_COPY_AND_ASSIGN(CandidateWindowView);
};

}  // namespace ime
}  // namespace ui

#endif  // UI_CHROMEOS_IME_CANDIDATE_WINDOW_VIEW_H_


text:
import sys

PY3 = sys.version_info[0] == 3

if PY3:
    string_type = str
else:
    string_type = basestring  # noqa: F821

try:  # pragma: no cover
    # FIXME: This import must be kept to avoid a breaking change in environments
    # that install `simplejson`, even in newer Python versions.
    import simplejson as json
except ImportError:
    import json  # noqa: F401

try:
    from urllib.parse import (
        urlparse,
        urljoin,
    )
except ImportError:
    from urlparse import (  # noqa: F401
        urlparse,
        urljoin,
    )

redpajama_set_name: RedPajamaGithub


text:
These notes document the initial redrock scaling tests performed on NERSC
Cori during August 2017.

Stephen Bailey<br/>
Lawrence Berkeley National Lab

## Initial setup

Create basic conda environment
```
module load python/3.5-anaconda
conda create -n rrtest python=3 numpy scipy astropy numba ipython matplotlib hdf5
source activate rrtest
```

Add non-conda dependencies
```
cd $SCRATCH/rrtest
pip install speclite
for x in desiutil desispec; do
    git clone https://github.com/desihub/$x
    cd $x && python setup.py install && cd ..
done
```

Install redrock & redrock templates
```
git clone https://github.com/desihub/redrock-templates
export RR_TEMPLATE_DIR=$(pwd)/redrock-templates
git clone https://github.com/desihub/redrock
cd redrock
python setup.py develop
cd ..
```

Get some test data
```
wget http://portal.nersc.gov/project/desi/users/sjbailey/austin/spectra-64-4674.fits
```

## Basic setup

After doing the initial setup once, this is what you need to run whenever
starting a new shell:
```
module load python/3.5-anaconda
source activate rrtest
export RR_TEMPLATE_DIR=$SCRATCH/rrtest/redrock-templates
cd $SCRATCH/rrtest
```

## Example job scripts for benchmarks

Getting interactive nodes on cori:
```
salloc -N 1 -C haswell --qos interactive -t 1:00:00
salloc -N 1 -C knl --qos interactive -t 1:00:00
```

Running on Haswell:
```
#- NOTE: not setting OMP_PLACES and OMP_PROC_BIND has best performance
OMP_PLACES=sockets is ok, but cores or threads is 3-4x worse

unset OMP_PLACES
unset OMP_PROC_BIND
export OMP_NUM_THREADS=1
export MPICH_GNI_FORK_MODE=FULLCOPY

time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 4 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 8 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 16 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 32 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 64 --ntarget 64

time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 16 --ntarget 32
time rrdesi spectra-64-4674.fits --zbest blat.fits --ncpu 16 --ntarget 128
```

KNL environment variables: use KMP_AFFINITY instead of OMP_PLACES and OMP_PROC_BIND
```
export OMP_NUM_THREADS=1
export KMP_AFFINITY=disabled
export MPICH_GNI_FORK_MODE=FULLCOPY

time rrdesi spectra-64-4674.fits --zbest foo.fits --ncpu 16 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest foo.fits --ncpu 32 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest foo.fits --ncpu 64 --ntarget 64
time rrdesi spectra-64-4674.fits --zbest foo.fits --ncpu 128 --ntarget 64
```

## Results

```
cpu   ncpu   ntarg  time
hsw   4      64     123
hsw   8      64     85
hsw   16     64     68
hsw   32     64     68
hsw   64     64     76

hsw   16     32     50
hsw   16     128    102
hsw   16     256    169

knl   16     64     380
knl   64     64     315
knl   128    64     337

knl   64     128    408
knl   64     256    598
```

![redshift rate vs. cores](orig_rate_vs_cores.png)
![redshift rate vs. number of targets](orig_rate_vs_ntargets.png)

## Warnings on KNL

These appeared only on KNL runs, not Haswell runs, and should be investigated.
```
<cori rrtest> time rrdesi spectra-64-4674.fits --zbest foo.fits --ncpu 16 --ntarget 64
/global/cscratch1/sd/sjbailey/rrtest/redrock/py/redrock/dataobj.py:161: RuntimeWarning: divide by zero encountered in true_divide
  Winv = scipy.sparse.dia_matrix((1/(weights+isbad), [0,]), (n,n))
```
Note that `isbad = (weights == 0)` so in principle `1/(weights+isbad)`
should never be a divide by zero.

but this earlier line didn't cause a warning:
```
flux = weightedflux / (weights + isbad)
```

**TODO**: check KNL vs. HSW outputs for consistency despite that message


text:
import random

from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User

from ...models import (
    TranscriptPhrase,
    TranscriptPhraseCorrection
)

phrase_positive_limit = settings.TRANSCRIPT_PHRASE_POSITIVE_CONFIDENCE_LIMIT
phrase_negative_limit = settings.TRANSCRIPT_PHRASE_NEGATIVE_CONFIDENCE_LIMIT
correction_lower_limit = settings.TRANSCRIPT_PHRASE_CORRECTION_LOWER_LIMIT
correction_upper_limit = settings.TRANSCRIPT_PHRASE_CORRECTION_UPPER_LIMIT

class Command(BaseCommand):
    help = 'Creates random(ish) corrections for 100 phrases.'

    def handle(self, *args, **options):
        users = User.objects.all()
        phrases = TranscriptPhrase.objects.filter(
            confidence__lte=phrase_negative_limit,
            num_corrections__lt=3
        )[:100]
        for phrase in phrases:
            for i in range(3):
                corrected_text = phrase.text
                options = {
                    0: corrected_text.upper(),
                    1: '{} - {}'.format(
                        corrected_text, random.choice(
                            ['ping!', 'boing boing', 'ribbit', 'PLOP']
                        )
                    ),
                    2: corrected_text.title()
                }
                user = random.choice(users)
                TranscriptPhraseCorrection.objects.create(
                    correction=options[i],
                    user=user,
                    transcript_phrase=phrase
                )
                print(
                    'Created correction:\nUser:{}\nCorrection:{}'.format(
                        user, options[i]
                    )
                )


text:
package com.assist.dg.androidassist.util;

import com.assist.dg.androidassist.fragment.BaseFragment;
import com.assist.dg.androidassist.fragment.CollegeListFragment;
import com.assist.dg.androidassist.fragment.MajorListFragment;
import com.assist.dg.androidassist.fragment.UniversityListFragment;

/**
 * Created by Spencer Do on 2015. 11. 20..
 */
public enum FragmentType {

  INIT(null),
  COLLEGE_LIST(CollegeListFragment.class),
  UNIVERSITY_LIST(UniversityListFragment.class),
  MAJOR_LIST(MajorListFragment.class);

  private Class<? extends BaseFragment> mFragmentClass;
  private String mTitle;

  FragmentType(Class<? extends BaseFragment> frag) {
    mFragmentClass = frag;
  }

  public Class<? extends BaseFragment> getFragmentClass() {
    return mFragmentClass;
  }

  public int getValue() {
    return ordinal();
  }
}


text:
<html>
<head>
	<title>Article not available</title>
</head>
<body>

Article 03 from issue July 16, 2011 is currently not available.

</body>
</html>


text:
<!--- Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> -->

# Guidelines for writing Play documentation

The Play documentation is written in Markdown format, with code samples extracted from compiled, run and tested source files.

There are a few guidelines that must be adhered to when writing Play documentation.

## Gender-neutral language and names

The Play community honors gender diversity. When writing examples in the documentation, please use [gender-neutral language](https://en.wikipedia.org/wiki/Gender-neutral_language) and [unisex names](https://en.wikipedia.org/wiki/Unisex_name) whenever possible. Ask your reviewer(s) for help if you are unsure of the right wording.

## Markdown

All markdown files must have unique names across the entire documentation, regardless of what folders they are in.  Play uses a wiki style of linking and rendering documentation.

Newline characters in the middle of paragraphs are considered hard wraps, similar to GitHub flavored markdown, and are rendered as line breaks.  Paragraphs should therefore be contained on a single line.

### Links

Links to other pages in the documentation should be created using wiki markup syntax, for example:

    [[Optional description|ScalaRouting]]

Images should also use the above syntax.

> **Note:** external links should not use the above syntax, but rather, should use the standard Markdown link syntax.

## Code samples

All supported code samples should be imported from external compiled files.  The syntax for doing this is:

    @[some-label](code/SomeFeature.scala)

The file should then delimit the lines that need to be extracted using `#some-label`, for example:

```scala
object SomeFeatureSpec extends Specification {
  "some feature" should {
    "do something" in {
      //#some-label
      val msg = Seq("Hello", "world").mkString(" ")
      //#some-label
      msg must_== "Hello world"
    }
  }
}
```

In the above case, the ``val msg = ...`` line will be extracted and rendered as code in the page.  All code samples should be checked to ensure they compile, run, and if it makes sense, ensure that it does what the documentation says it does.  It should not try to test the features themselves.

All scala/java/routes/templates code samples get run on the same classloader.  Consequently, they must all be well namespaced, within a package that corresponds to the part of the documentation they are associated with.

In some cases, it may not be possible for the code that should appear in the documentation to exactly match the code that you can write given the above guidelines.  In particular, some code samples require the use of package names like `controllers`.  As a last resort if there are no other ways around this, there are a number of directives you can put in the code to instruct the code samples extractor to modify the sample.  These are:

* `###replace: foo` — Replace the next line with `foo`.  You may optionally terminate this command with `###`
* `###insert: foo` — Insert `foo` before the next line.  You may optionally terminate this command with `###`
* `###skip` — Skip the current line
* `###skip: n` — Skip the next n lines

For example:

```scala
//#controller
//###replace: package controllers
package foo.bar.controllers

import javax.inject.Inject
import play.api.mvc._

class HomeController @Inject()(cc:ControllerComponents)
 extends AbstractController(cc) {
  ...
}
//#controller
```

> These directives must only be used as a last resort, since the point of pulling code samples out into external files is that the very code that is in the documentation is also compiled and tested.  Directives break this.

It's also important to be aware of the current context of the code samples, to ensure that the appropriate import statements are documented.  However, it doesn't make sense to necessarily include all import statements in every code sample, so discretion must be shown here.

Guidelines for specific types of code samples are below.

### Scala

All scala code samples should be tested using specs, and the code sample, if possible, should be inside the spec.  Local classes and method definitions are encouraged where appropriate.  Scoping import statements within blocks are also encouraged.

### Java

All Java code samples should be tested using JUnit.  Simple code samples are usually simple to include inside the JUnit test, but when the code sample is a method or a class, it gets harder.  Preference should be shown to use local and inner classes, but this may not be possible, for example, a static method can only appear on a static inner class, but that means adding the static modifier to the class, which would not appear if it was an outer class.  Consequently, it may be necessary in some cases to pull Java code samples out into their own files.

### Scala Templates

Scala template code samples should be tested either with Specs in Scala or JUnit in Java.  Note that templates are compiled with different default imports, depending on whether they live in the Scala documentation or the Java documentation.  It is therefore also important to test them in the right context.

Where possible, template code samples should be consolidated in a single file, but this may not always be possible, for example if the code sample contains a parameter declaration.

### Routes files

Routes files should be tested either with Specs in Scala or JUnit in Java.  Routes files should be named with the full package name, for example, `scalaguide.http.routing.routes`, to ensure that they are isolated from other routes code samples.

The routes compiler used by the documentation runs in a special mode that generates the reverse router inside the namespace declared by that file.  This means that although a routes code sample may appear to use absolute references to classes, it is actually relative to the namespace of the router.  Thus in the above routes file, if you have a route called `controllers.Application`, it will actually refer to a controller called `scalaguide.http.routing.controllers.Application`.

### sbt code

sbt code samples should be extracted to `*.sbt` files.  These files get tested separately by the `evaluateSbtFiles` task, which compiles and runs them — by load, it means it runs the settings definitions (ie, builds a `Seq[Setting[_]]`, but doesn't actually run the tasks or settings declared.  The classloader used to run these files is the same as the sbt classloader, so any plugins that the code snippets require need to be plugins to the sbt project.

### Other code

Other code may or may not be testable.  It may make sense to test Javascript code by running an integration test using HTMLUnit.  It may make sense to test configuration by loading it.  Common sense should be used here.

## Testing the docs

To build the docs, you'll first need to build and publish Play locally. You can do this by running `sbt publishLocal` from within the root directory of the `playframework` repository.

To ensure that the docs render correctly, run `sbt run` from within the `documentation` directory.  This will start a small Play server that does nothing but serve the documentation.

To ensure that the code samples compile, run and tests pass, run `sbt test`.

To validate that the documentation is structurally sound, run `sbt validateDocs`.  This checks that there are no broken wiki links, code references or resource links, ensures that all documentation markdown filenames are unique, and ensures that there are no orphaned pages.


text:
namespace views
{

	class VIEWS_EXPORT WebBrowserView : public views::View, public AxHostDelegate
    {
    public:
        explicit WebBrowserView();
        virtual ~WebBrowserView();

        IWebBrowser2* webbrowser() const { return webbrowser_; }
        bool Navigate(const std::wstring& url);
		virtual HWND GetAxHostWindow() const;
    protected:
        // Overridden from View:
        virtual void Layout();
        virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
        virtual void VisibilityChanged(View* starting_from, bool is_visible);
		virtual void SetVisible(bool visible);
        // Overridden from AxHostDelegate:

        virtual void OnAxCreate(AxHost* host);
        virtual void OnAxInvalidate(const gfx::Rect& rect);

    private:
        scoped_ptr<AxHost> ax_host_;
        base::win::ScopedComPtr<IWebBrowser2> webbrowser_;

        bool initialized_;
    };

} //namespace view

#endif //__view_webbrowser_view_h__


text:
<?php

namespace Zend\Mvc\Console\View;

use Zend\EventManager\AbstractListenerAggregate;
use Zend\EventManager\EventManagerInterface as Events;
use Zend\Mvc\Console\View\ViewModel as ConsoleModel;
use Zend\Mvc\MvcEvent;
use Zend\Stdlib\ArrayUtils;

class CreateViewModelListener extends AbstractListenerAggregate
{
    /**
     * {@inheritDoc}
     */
    public function attach(Events $events, $priority = 1)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'createViewModelFromString'], -80);
        $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'createViewModelFromArray'], -80);
        $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'createViewModelFromNull'], -80);
    }

    /**
     * Inspect the result, and cast it to a ViewModel if a string is detected
     *
     * @param MvcEvent $e
     * @return void
    */
    public function createViewModelFromString(MvcEvent $e)
    {
        $result = $e->getResult();
        if (! is_string($result)) {
            return;
        }

        // create Console model
        $model = new ConsoleModel;

        // store the result in a model variable
        $model->setVariable(ConsoleModel::RESULT, $result);
        $e->setResult($model);
    }

    /**
     * Inspect the result, and cast it to a ViewModel if an assoc array is detected
     *
     * @param  MvcEvent $e
     * @return void
     */
    public function createViewModelFromArray(MvcEvent $e)
    {
        $result = $e->getResult();
        if (! ArrayUtils::hasStringKeys($result, true)) {
            return;
        }

        $model = new ConsoleModel($result);
        $e->setResult($model);
    }

    /**
     * Inspect the result, and cast it to a ViewModel if null is detected
     *
     * @param MvcEvent $e
     * @return void
    */
    public function createViewModelFromNull(MvcEvent $e)
    {
        $result = $e->getResult();
        if (null !== $result) {
            return;
        }

        $model = new ConsoleModel;
        $e->setResult($model);
    }
}


text:
package press;

public class StyleFileManager extends SourceFileManager {
    public StyleFileManager() {
        super("CSS", StyleCompressor.EXTENSION, "#{press.stylesheet}", "#{press.compressed-stylesheet}", PluginConfig.css.srcDir);
    }
}


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

@Injectable()
export class ToastService {
  message: string;

  private toastCount: number;

  hide() {
    this.toastCount--;
    this.log();
  }

  show() {
    this.toastCount++;
    this.log();
  }

  private log() {
    console.log(this.message);
  }
}
// #enddocregion example


text:
package org.saiku.web.rest.resources;

import org.saiku.repository.IRepositoryObject;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;

public interface ISaikuRepository {

	/**
	 * Get Saved Queries.
	 * @return A list of SavedQuery Objects.
	 */
	@GET
	@Produces({ "application/json" })
	public List<IRepositoryObject> getRepository(
			@QueryParam("path") String path, @QueryParam("type") String type);

	/**
	 * Load a resource.
	 * @param file - The name of the repository file to load.
	 * @return A Repository File Object.
	 */
	@GET
	@Produces({ "text/plain" })
	@Path("/resource")
	public Response getResource(@QueryParam("file") String file);

	/**
	 * Save a resource.
	 * @param file - The name of the repository file to load.
	 * @param content - The content to save.
	 * @return Status
	 */
	@POST
	@Path("/resource")
	public Response saveResource(@FormParam("file") String file,
			@FormParam("content") String content);

	/**
	 * Delete a resource.
	 * @param file - The name of the repository file to load.
	 * @return Status
	 */
	@DELETE
	@Path("/resource")
	public Response deleteResource(@QueryParam("file") String file);

}


text:
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET FOREIGN_KEY_CHECKS=0 */;

DROP PROCEDURE IF EXISTS `sp_LoadProfaneNames`;
DELIMITER //
CREATE PROCEDURE `sp_LoadProfaneNames`()
BEGIN
SELECT * FROM `name_profane`;
END//
DELIMITER ;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;


text: raise NotImplementedError("pprint is not yet implemented in Skulpt")


text:
namespace BGB.Models
{
    using System;

    public abstract class Ad
    {
        public int Id { get; set; }

        public string Author { get; set; }

        public string Title { get; set; }

        public string Content { get; set; }

        public DateTime PublishedDate { get; set; }

        public AdType Type { get; set; }
    }
}


text:
/*Óû§ÖÐÐÄ*/
.userlj{font-size:16px; height:80px; line-height:80px;}
.userlj a{color:#252525;}
.userlj a:hover{color:#7d03e4;}

.usercon{width:1197px; border:1px solid #dedede; padding:22px; background-color:#fff; overflow:hidden;}
.usercon205{width:205px;}
.usercon205tit{width:184px; height:63px; background-color:#7d03e4; font-size:24px; color:#fff; line-height:63px; padding-left:21px;}
.usercon205con{width:185px; height:1000px; padding:20px 20px 20px 0px; background-color:#f0f0f0; color:#666666;}
.usercon205con dl{margin-bottom:28px;}
.usercon205con dt{color:#7d03e4; font-size:18px; margin-bottom:20px; margin-left:20px;}
.usercon205con dt img{margin-right:9px; margin-bottom:-3px;}
.usercon205con dd{hegith:34px; line-height:34px; text-indent:54px; font-size:14px; color:#666; width:100%; display:inline-block;}
.usercon205con dd.current{width:217px; height:34px; background:url(img/user01.png) no-repeat;}
.usercon205con dd a{color:#666;}
.usercon205con dd a:hover{color:#7d03e4;}
.usercon205con dd.current a{color:#fff;}
.usercon205con dd.current a:hover{color:#fff;}

.usercon981{width:961px;}
.usercon981tit{width:100%; margin-top:20px; color:#7d03e4; font-size:24px;}
.usercon981titline{width:939px; margin-top:20px; margin-bottom:40px;}
.usercon981info{width:670px;}
.usercon981pic{width:205px; height:205px; position:relative;}
.usercon981pic span{position:absolute;left:0px;bottom:0px;width:100%;height:33px;z-index:1;background:#000;filter:alpha(opacity=50); /*IEÂ˾µ£¬Í¸Ã÷¶È50%*/-moz-opacity:0.5; /*Firefox˽ÓУ¬Í¸Ã÷¶È50%*/opacity:0.5;/*ÆäËû£¬Í¸Ã÷¶È50%*/}
.usercon981pic em{font-size:14px; color:#fff; font-style:normal; position:absolute; left:0px; bottom:0px; z-index:2; line-height:33px; text-align:center; width:100%;}
.usercon981pic em a{color:#fff;}
.usercon981pic em a:hover{color:#fff;}

.usercon981text{padding-left:43px; width:400px;}
.usercon981text dt{font-size:24px; line-height:50px; width:400px; float:left;}
.usercon981text dd{font-size:14px; line-height:30px; width:400px; float:left;}
.usercon981text dd img{margin-left:10px; margin-top:8px;}
.usercon981con{width:600px; margin-bottom:25px;}
.usercon981con span{display:block; width:600px; height:25px; font-size:14px; font-weight:bolder;}
.usercon981con input{width:256px; height:40px; border:0px; background-color:#f0f0f0; padding-left:4px;}
.usercon981con em {margin-left:20px; font-style:normal;font-size:14px; }
.usercon981con em a{color:#666;}
.usercon981con em a:hover{color:#7d03e4;}

.usercon981con li{width:70px; height:40px; border:1px solid #eee; float:left; margin-right:10px; text-align:center; line-height:40px; font-size:16px; }
.usercon981con li.current a{width:70px; height:40px; display:inline-block; background-color:#7d03e4; color:#fff;}

.usercon981jinbi{width:600px; margin-bottom:25px;  font-size:14px;}
.usercon981jinbi span{ color:#f8b62a; font-size:16px;}

.usercon981bg{margin-top:20px; line-height:20px; width:900px; color:#666;}
.usercon981bg table{ border-collapse:collapse; width:100%; text-align:center; border:1px solid #eee;}
.usercon981bghd{ display:table-row; border-color:inherit; background-color:#f0f0f0; height:40px; line-height:40x; border:1px solid #eee; }
.usercon981bgcon{border:1px solid #eee; height:40px; line-height:40px; }
.usercon981bgcon_td{border-right:1px solid #eee; border-bottom:1px solid #eee;}
.usercon981bgcon_hs{ color:#f8b62a;}
.bgtime{width:212px;}
.bgfangshi{width:140px;}
.bgchongzhi{width:140px;}
.bgjinbi{width:160px;}

.usercon981fy{width:900px; margin-top:40px; }
.usercon981fy ul{float:right;}
.usercon981fy li{float:left; min-width:35px; height:35px; line-height: 35px;  text-align:center; margin-left:10px; cursor:pointer; border-radius:3px;}
.usercon981fy_dot{background-color:#fff; cursor:default; color:#898989;}
.usercon981fy_tit{width:90px; background-color:#f1f1f1; color:#898989;}
.usercon981fy_act{background-color:#790fd4; color:#fff;}
.usercon981fy_item{background-color:#f1f1f1; color:#898989;}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>pymatgen.io.aiida module — pymatgen 2019.7.2 documentation</title>
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />

Navigation

          index

          modules |

pymatgen 2019.7.2 documentation »

pymatgen.io.aiida module¶

This module provides conversion between AiiDA StructureData object and
pymatgen Molecule/Structure objects.

AiidaStructureAdaptor()[source]¶

Adaptor serves as a bridge between AiiDA StructureData and pymatgen
Molecule/Structure objects.

Navigation

          index

          modules |

pymatgen 2019.7.2 documentation »

        © Copyright 2011, Pymatgen Development Team.
      Created using Sphinx 2.0.1.

This page uses
Google Analytics to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.


text:
import React, { Component, PropTypes } from "react";
import LocaleUtils from "react-day-picker/lib/addons/LocaleUtils";

const keys = {
  LEFT: 37,
  RIGHT: 39,
  ENTER: 13,
  SPACE: 32
};

class WeekdayPicker extends Component {

  static propTypes = {

    className: PropTypes.string,
    style: PropTypes.object,
    tabIndex: PropTypes.number,

    modifiers: PropTypes.object,

    locale: PropTypes.string,
    localeUtils: PropTypes.shape({
      formatWeekdayShort: PropTypes.func.isRequired,
      formatWeekdayLong: PropTypes.func.isRequired
    }),

    onWeekdayClick: PropTypes.func,
    onWeekdayTouchTap: PropTypes.func,
    onWeekdayMouseEnter: PropTypes.func,
    onWeekdayMouseLeave: PropTypes.func

  }

  static defaultProps = {
    tabIndex: 0,
    locale: "en",
    localeUtils: LocaleUtils
  }

  getModifiersForDay(d, modifierFunctions) {
    const modifiers = [];
    if (modifierFunctions) {
      for (const modifier in modifierFunctions) {
        const func = modifierFunctions[modifier];
        if (func(d)) {
          modifiers.push(modifier);
        }
      }
    }
    return modifiers;
  }

  constructor(props) {
    super(props);
  }

  render() {
    const { locale, style, tabIndex } = this.props;
    let className = `WeekdayPicker DayPicker DayPicker--${locale}`;

    if (!this.props.onWeekdayClick && !this.props.onWeekdayTouchTap) {
      className = `${className} WeekdayPicker--InteractionDisabled`;
    }
    if (this.props.className) {
      className = `${className} ${this.props.className}`;
    }

    return (

        { this.renderWeekDays() }

    );
  }

  renderWeekDays() {
    let weekdays = [];
    for (let i = 0; i < 7; i++) {
      weekdays.push(this.renderWeekday(i));
    }
    return (

            { weekdays }

    );
  }

  renderWeekday(weekday) {
    const { locale, localeUtils, modifiers: modifierFunctions } = this.props;

    let className = "DayPicker-Weekday";
    let modifiers = [];

    if (modifierFunctions) {
      const customModifiers = this.getModifiersForDay(weekday, modifierFunctions);
      modifiers = [...modifiers, ...customModifiers];
    }

    className += modifiers.map(modifier => ` ${className}--${modifier}`).join("");

    const { onWeekdayMouseEnter, onWeekdayMouseLeave, onWeekdayTouchTap, onWeekdayClick }
      = this.props;
    let tabIndex = null;
    if (onWeekdayTouchTap || onWeekdayClick) {
      tabIndex = -1;
      // Focus on the first day of the week
      if (weekday === 0) {
        tabIndex = this.props.tabIndex;
      }
    }
    return (
      <button key={weekday} className={className} tabIndex={ tabIndex }
        onKeyDown= { (e) => this.handleDayKeyDown(e, weekday, modifiers) }
        onMouseEnter= { onWeekdayMouseEnter ?
          (e) => this.handleWeekdayMouseEnter(e, weekday, modifiers) : null }
        onMouseLeave= { onWeekdayMouseLeave ?
          (e) => this.handleWeekdayMouseLeave(e, weekday, modifiers) : null }
        onClick= { onWeekdayClick ?
          (e) => this.handleWeekdayClick(e, weekday, modifiers) : null }
        onTouchTap= { onWeekdayTouchTap ?
          (e) => this.handleWeekdayTouchTap(e, weekday, modifiers) : null }
      >
        <attr title={localeUtils.formatWeekdayLong(weekday, locale)}>
          { localeUtils.formatWeekdayShort(weekday, locale) }
        </attr>
      </button>
    );
  }

  focusPreviousDay(dayNode) {
    const body = dayNode.parentNode.parentNode.parentNode.parentNode;
    let dayNodes = body.querySelectorAll(".DayPicker-Weekday:not(.DayPicker-Weekday--outside)");
    let nodeIndex;
    for (let i = 0; i < dayNodes.length; i++) {
      if (dayNodes[i] === dayNode) {
        nodeIndex = i;
        break;
      }
    }
    if (nodeIndex !== 0) {
      dayNodes[nodeIndex - 1].focus();
    }
  }

  focusNextDay(dayNode) {
    const body = dayNode.parentNode.parentNode.parentNode.parentNode;
    let dayNodes = body.querySelectorAll(".DayPicker-Weekday:not(.DayPicker-Weekday--outside)");
    let nodeIndex;
    for (let i = 0; i < dayNodes.length; i++) {
      if (dayNodes[i] === dayNode) {
        nodeIndex = i;
        break;
      }
    }

    if (nodeIndex !== dayNodes.length - 1) {
      dayNodes[nodeIndex + 1].focus();
    }
  }

  // Event handlers

  handleDayKeyDown(e, day, modifiers) {
    e.persist();
    switch (e.keyCode) {
      case keys.LEFT:
        e.preventDefault();
        e.stopPropagation();
        this.focusPreviousDay(e.target);
      break;
      case keys.RIGHT:
        e.preventDefault();
        e.stopPropagation();
        this.focusNextDay(e.target);
      break;
      case keys.ENTER:
      case keys.SPACE:
        e.preventDefault();
        e.stopPropagation();
        if (this.props.onWeekdayClick) {
          this.handleWeekdayClick(e, day, modifiers);
        }
        if (this.props.onWeekdayTouchTap) {
          this.handleWeekdayTouchTap(e, day, modifiers);
        }
      break;
    }
  }

  handleWeekdayTouchTap(e, weekday, modifiers) {
    e.persist();
    this.props.onWeekdayTouchTap(e, weekday, modifiers);
  }

  handleWeekdayClick(e, weekday, modifiers) {
    e.persist();
    this.props.onWeekdayClick(e, weekday, modifiers);
  }

  handleWeekdayMouseEnter(e, weekday, modifiers) {
    e.persist();
    this.props.onWeekdayMouseEnter(e, weekday, modifiers);
  }

  handleWeekdayMouseLeave(e, weekday, modifiers) {
    e.persist();
    this.props.onWeekdayMouseLeave(e, weekday, modifiers);
  }

}

export default WeekdayPicker;


text:
<?php

$config = array(
    'DB' => array(
        'host' => 'localhost', //*required for mysql data source: hostname
        'database' => 'gogetrich_db', //*required for mysql data source: database name
        'database-username' => 'gogetrich', //*required for mysql data source: database username
        'database-password' => 'gogetrich'       //*required for mysql data source: database user password
    )
        )
?>


text:
export default {
  // MongoDB connection options
  profileName: 'development',

  // Logger config
  log: {
    level: 'DEBUG'
  },

  mongo: {
    uri:      'mongodb://localhost:27017/seed-dev',
    logLevel: 'debug'
  },

  seedDB: true
}


text:
void BNAConvertHEXStringToVBool(std::string &in, std::vector<BNABit> &vars, int size);
std::string BNAConvertVBoolHEXString(std::vector<BNABit> &vars);
std::string BNAConvertCharToHexCode(unsigned char c);
std::string BNAConvertHexToBin(std::string sHex);
std::string BNAConvertBinToHex(std::string sBin);

class BNAStatCalcResults {
    public:
        BNAStatCalcResults(int nOutputSize);
        const std::vector<int> &getPrevCounters() const;
        const std::vector<int> &getPrevCountersPercents() const;
        int getAllPrevCountersPercents() const;
        void setPrevCounters(const std::vector<int> &vValues);
        const std::vector<int> &getCurrentCounters() const;
        const std::vector<int> &getCurrentCountersPercents() const;
        int getAllCurrentCountersPercents() const;
        void setCurrentCounters(const std::vector<int> &vValues);
        void resetCurrentCounters();
        void incrementCurrentCounter(int nIndex);
        void calcPercents(int nDataTestsSize);
        int getSummaryDiff();

    private:
        std::string TAG;
        int m_nOutputSize;
        int m_nDataTestsSize;
        std::vector<int> m_vPrevCounters;
        std::vector<int> m_vPrevCountersPercents;
        int m_nAllPrevCountersPercents;
        std::vector<int> m_vCurrentCounters;
        std::vector<int> m_vCurrentCountersPercents;
        int m_nAllCurrentCountersPercents;
        int m_nSummaryDiff;
};

class BNAModificationModel {
    public:
        BNAModificationModel();
        BNAModificationModel(int nMutationCicles, int nAddCicles, int nRemoveCicles);
        void update(int nMutationCicles, int nAddCicles, int nRemoveCicles);
        void reset();
        int getMutationCicles() const;
        int getAddCicles() const;
        int getRemoveCicles() const;
        void print() const;

    private:
        int m_nMutationCicles;
        int m_nAddCicles;
        int m_nRemoveCicles;
};

class BNA {
	public:
		BNA();
        BNA(int nInput, int nOutput);
        ~BNA();
		bool load(const std::string &sFilename);
		bool save(const std::string &sFilename);
		void randomGenerate(int nInput, int nOutput, int nSize);
        int addNode(int nInX, int nInY, const std::string &sOperType);
        bool compile();

		bool exportToDot(std::string filename, std::string graphname);
		bool exportToCpp(std::string filename, std::string funcname);

        const std::vector<BNANodeInput *> &getNodesInput();
        const std::vector<BNANode *> &getNodes();
        const std::vector<BNANodeOutput *> &getNodesOutput();
        int calculateDepth(int n);

        // QByteArray exportToByteArray();
        // void importFromByteArray(QByteArray data);
		nlohmann::json toJson();
        void randomModify(const BNAModificationModel *pModel);
        BNABit calc(const std::vector<BNABit> &vInputs, int nOutput);

        unsigned int getInputSize();
        unsigned int getNodesSize();
        unsigned int getOutputSize();
        void compare(BNA &bna);

	private:
        std::string TAG;
        bool m_bCompiled;
        int m_nBnaVersion;
        int m_nBnaRevision;
        bool readFromFileBna(std::ifstream &file);
        int readParam(std::ifstream &file, const std::string &sParamName);
        bool writeToFileBna(std::ofstream &file);

        bool registryOperationType(IBNAOper<BNABit> *pOper);
        std::map<std::string, IBNAOper<BNABit> *> m_vOperations;
        std::vector<IBNAOper<BNABit> *> m_vOperationList;
        int m_nOperSize;

        void clearResources();
        std::vector<BNANodeInput *> m_vNodesInput;
        std::vector<BNANode *> m_vNodes;
        std::vector<BNANodeOutput *> m_vNodesOutput;

        void clearCalcExprsVars();
        void normalizeNodes();
        BNAVar<BNABit> *getVarByIndex(int nIndex);
        std::vector<BNAExpression<BNABit> *> m_vCalcExprs;
        std::vector<BNAVar<BNABit> *> m_vCalcInputVars;
        std::vector<BNAVar<BNABit> *> m_vCalcVars;
        std::vector<BNAVar<BNABit> *> m_vCalcOutVars;
};

class BNAMemoryItem {
    public:
        BNAMemoryItem(int nInputBits, int nOutputBits);
        char* input;
        char* output;

    private:
        std::string TAG;
        int m_nInputBits;
        int m_nOutputBits;
        std::vector<BNABit> m_vInput;
        std::vector<BNABit> m_vOutput;
};

class BNAMemory {
    public:
        BNAMemory(int nInputBits, int nOutputBits);
        void load(std::string filename);
        void save(std::string filename);
        int size();
        BNAMemoryItem *at(int i);
        BNAMemoryItem *createItem();
        void append(BNAMemoryItem *pItem);
        void printData();
    private:
        std::string TAG;
        int m_nInputBits;
        int m_nOutputBits;
        std::vector<BNAMemoryItem *> m_vItems;
};

class BNAProject {

    public:
        BNAProject();
        bool open(std::string sDirPath);
        void setInputBits(int nInputBits);
        int getInputBits();
        void setOutputBits(int nOutputBits);
        int getOutputBits();
        void setDefaultCountNodes(int nDefaultCountNodes);
        bool create(std::string sDirPath);
        BNAMemory *getBNAMemory();
        void saveBNAMemory();
        int calculate(int bitid, bool bEnableSleep = false);
        void saveResult(int bitid, int nSuccess);
        int loadResult(int bitid);
        std::map<int,int> &getResults();
        BNA *getBNA(int bitid);
        void saveBNA(int bitid);

    private:
        std::string TAG;
        std::string prepareName(int bitid);
        std::string prepareSubdir(int bitid);
        void saveProjFile();
        void loadProjFile();

        std::string m_sDirPath;
        BNAMemory *m_pBNAMemory;
        int m_nInputBits;
        int m_nOutputBits;
        int m_nDefaultCountNodes;
        std::string m_sMemoryFileName;
        std::map<int,BNA *> m_mBNA;
        std::map<int,int> m_mapResults;
};

#endif // BNA_H


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace mko.Euklid.UnitTest
{
    [TestClass]
    public class MatrixTest
    {
        const int RoundDigits = 6;

        [TestMethod]
        public void TestInvertieren()
        {

            Transformations.Matrix M = new Transformations.Matrix(2, 2);
            M.SetLine(0, 1, 0);
            M.SetLine(1, 0, 1);

            Transformations.Matrix Iinv;
            if (!M.Invert(out Iinv))
                Assert.Fail("Einheitsmatrix konnte nicht invertiert werden");

            if(!Iinv.Round(RoundDigits).Equals(Transformations.Matrix.CreateIdentityMatrix(2).Round(RoundDigits)))
                Assert.Fail("Invertieren der Einheitsmatrix liefert falsches Ergebnis");

            Transformations.Matrix M3 = new Transformations.Matrix(3, 3);
            M3.SetLine(0, 1, 2, 1);
            M3.SetLine(1, 1, 0, 2);
            M3.SetLine(2, 1, -1, 1);

            Transformations.Matrix M3inv;
            if(!M3.Invert(out M3inv))
                Assert.Fail("Die reguläre Testmatrix konnte nicht invertiert werden");

            Transformations.Matrix M3invSoll = new Transformations.Matrix(3, 3);
            M3invSoll.SetLine(0, 2.0/3.0, -1.0, 4.0/3.0);
            M3invSoll.SetLine(1, 1.0/3.0, 0.0, -1.0/3.0);
            M3invSoll.SetLine(2, -1.0/3.0, 1.0, -2.0/3.0);

            if(!M3inv.Round(RoundDigits).Equals(M3invSoll.Round(RoundDigits)))
                Assert.Fail("Invertierte Testmatrix stimmt nicht mit dem Sollergebnis überein");

        }
    }
}


text:
require 'cf_spec_helper'

describe 'For all supported Ruby versions', if: ENV['CF_CI_ENV'] == "true" do
  shared_examples 'a Sinatra app' do
    let(:app) { Machete.deploy_app("rubies/tmp/#{ruby_version}/sinatra") }
    let(:browser) { Machete::Browser.new(app) }

    specify do
      generate_app('sinatra', ruby_version, engine, engine_version)
      assert_ruby_version_installed(ruby_version)

      unless engine == 'ruby'
        assert_ruby_version_and_engine_installed(ruby_version, engine, engine_version)
      end

      assert_root_contains('Hello, World')
      assert_offline_mode_has_no_traffic
    end
  end

  shared_examples 'a Rails 4 app' do
    let(:app) { Machete.deploy_app("rubies/tmp/#{ruby_version}/rails4", with_pg: true) }
    let(:browser) { Machete::Browser.new(app) }

    specify do
      generate_app('rails4', ruby_version, engine, engine_version)
      assert_ruby_version_installed(ruby_version)

      unless engine == 'ruby'
        assert_ruby_version_and_engine_installed(ruby_version, engine, engine_version)
      end

      assert_root_contains('The Kessel Run')
      assert_offline_mode_has_no_traffic
    end
  end

  context 'Ruby 1.9.3' do
    let(:ruby_version) { '1.9.3' }
    let(:engine) { 'ruby' }
    let(:engine_version) { ruby_version }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'Ruby 2.0.0' do
    let(:ruby_version) { '2.0.0' }
    let(:engine) { 'ruby' }
    let(:engine_version) { ruby_version }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'Ruby 2.1.5' do
    let(:ruby_version) { '2.1.5' }
    let(:engine) { 'ruby' }
    let(:engine_version) { ruby_version }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'Ruby 2.2.0' do
    let(:ruby_version) { '2.2.0' }
    let(:engine) { 'ruby' }
    let(:engine_version) { ruby_version }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'JRuby 1.7.11 Ruby 2.0.0' do
    let(:ruby_version) { '2.0.0' }
    let(:engine) { 'jruby' }
    let(:engine_version) { '1.7.11' }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'JRuby 1.7.11 Ruby 1.9.3' do
    let(:ruby_version) { '1.9.3' }
    let(:engine) { 'jruby' }
    let(:engine_version) { '1.7.11' }

    it_behaves_like 'a Sinatra app'
    it_behaves_like 'a Rails 4 app'
  end

  context 'JRuby 1.7.11 Ruby 1.8.7' do
    let(:ruby_version) { '1.8.7' }
    let(:engine) { 'jruby' }
    let(:engine_version) { '1.7.11' }

    it_behaves_like 'a Sinatra app'
    # Rails app not tested here - requires a minimum of Ruby 1.9.3
  end

  def evaluate_erb(file_path, our_binding)
    template = File.read(file_path)
    f = File.open(file_path, 'w')
    f << ERB.new(template).result(our_binding)
    f.close
  end

  def assert_offline_mode_has_no_traffic
    expect(app.host).not_to have_internet_traffic if Machete::BuildpackMode.offline?
  end

  def generate_app(app_name, ruby_version, engine, engine_version)
    origin_template_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'rubies', app_name)
    copied_template_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'rubies', 'tmp', ruby_version, app_name)
    FileUtils.rm_rf(copied_template_path)
    FileUtils.mkdir_p(File.dirname(copied_template_path))
    FileUtils.cp_r(origin_template_path, copied_template_path)

    ['Gemfile', 'package.sh', '.jrubyrc'].each do |file|
      evaluate_erb(File.join(copied_template_path, file), binding)
    end
  end

  def assert_ruby_version_installed(ruby_version)
    expect(app).to be_running
    expect(app).to have_logged "Using Ruby version: ruby-#{ruby_version}"
  end

  def assert_ruby_version_and_engine_installed(ruby_version, engine, engine_version)
    expect(app).to be_running
    expect(app).to have_logged "Using Ruby version: ruby-#{ruby_version}-#{engine}-#{engine_version}"
  end

  def assert_root_contains(text)
    browser.visit_path('/')
    expect(browser).to have_body(text)
  end
end


text:
Accounts.emailTemplates.siteName =  i18n("common.site_name");
Accounts.emailTemplates.from = "Kadira <no-reply@kadira.io>";
Accounts.emailTemplates.resetPassword.subject = function () {
  return i18n("emails.reset_password_subject");
};


text:
img {
    border: 1px solid lightgrey;
}


text:
--TEST--
Check for reserve
--SKIPIF--
<?php if (!extension_loaded("beanstalk")) print "skip"; ?>
--FILE--
<?php
$arrConfig = include __DIR__ . '/../include/config.inc';
$b = beanstalk_connect( $arrConfig['host'], $arrConfig['port'] );
$jobID = beanstalk_put( $b, 'msg2' );
$job = beanstalk_reserve( $b );
$strData = var_export( $job, true );
var_dump( preg_match( "/array/", $strData ));
var_dump( beanstalk_release( $b, $job['id'] ));
beanstalk_delete( $b, $jobID );
beanstalk_close( $b );

/*
	you can add regression tests for your extension here

  the output of your test code has to be equal to the
  text in the --EXPECT-- section below for the tests
  to pass, differences between the output and the
  expected text are interpreted as failure

	see php5/README.TESTING for further information on
  writing regression tests
done
*/
?>
--EXPECTF--
int(1)
bool(true)


text:
Yitheme::Engine.routes.draw do
end


text:
        Type in a GitHub username
        <input type="text" ng-model="username" placeholder="Enter a GitHub username like a user" />

{{ events }}


text:
package com.simple.cloudfoundry.broker;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Created by Tomasz_Kozlowski on 3/8/2017.
 */
@SpringBootApplication
public class ServiceBrokerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ServiceBrokerApplication.class, args);
    }
}


text:
#import "CCRendererBasicTypes.h"
#import "CCRenderer_Private.h"
#import "CCCache.h"

//MARK: Blend Option Keys.
NSString * const CCRenderStateBlendMode = @"CCRenderStateBlendMode";
NSString * const CCRenderStateShader = @"CCRenderStateShader";
NSString * const CCRenderStateShaderUniforms = @"CCRenderStateShaderUniforms";

NSString * const CCBlendFuncSrcColor = @"CCBlendFuncSrcColor";
NSString * const CCBlendFuncDstColor = @"CCBlendFuncDstColor";
NSString * const CCBlendEquationColor = @"CCBlendEquationColor";
NSString * const CCBlendFuncSrcAlpha = @"CCBlendFuncSrcAlpha";
NSString * const CCBlendFuncDstAlpha = @"CCBlendFuncDstAlpha";
NSString * const CCBlendEquationAlpha = @"CCBlendEquationAlpha";

//MARK: Blend Modes.
@interface CCBlendMode()

-(instancetype)initWithOptions:(NSDictionary *)options;

@end

@interface CCBlendModeCache : CCCache
@end

@implementation CCBlendModeCache

-(id)objectForKey:(id<NSCopying>)options
{
	CCBlendMode *blendMode = [self rawObjectForKey:options];
	if(blendMode) return blendMode;

	// Normalize the blending mode to use for the key.
	id src = (options[CCBlendFuncSrcColor] ?: @(GL_ONE));
	id dst = (options[CCBlendFuncDstColor] ?: @(GL_ZERO));
	id equation = (options[CCBlendEquationColor] ?: @(GL_FUNC_ADD));

	NSDictionary *normalized = @{
		CCBlendFuncSrcColor: src,
		CCBlendFuncDstColor: dst,
		CCBlendEquationColor: equation,

		// Assume they meant non-separate blending if they didn't fill in the keys.
		CCBlendFuncSrcAlpha: (options[CCBlendFuncSrcAlpha] ?: src),
		CCBlendFuncDstAlpha: (options[CCBlendFuncDstAlpha] ?: dst),
		CCBlendEquationAlpha: (options[CCBlendEquationAlpha] ?: equation),
	};

	// Create the key using the normalized blending mode.
	blendMode = [super objectForKey:normalized];

	// Make an alias for the unnormalized version
	[self makeAlias:options forKey:normalized];

	return blendMode;
}

-(id)createSharedDataForKey:(NSDictionary *)options
{
	return options;
}

-(id)createPublicObjectForSharedData:(NSDictionary *)options
{
	return [[CCBlendMode alloc] initWithOptions:options];
}

// Nothing special
-(void)disposeOfSharedData:(id)data {}

-(void)flush
{
	// Since blending modes are used for keys, need to wrap the flush call in a pool.
	@autoreleasepool {
		[super flush];
	}
}

@end

@implementation CCBlendMode

-(instancetype)initWithOptions:(NSDictionary *)options
{
	if((self = [super init])){
		_options = options;
	}

	return self;
}

static CCBlendModeCache *CCBLENDMODE_CACHE = nil;

// Default modes
static CCBlendMode *CCBLEND_DISABLED = nil;
static CCBlendMode *CCBLEND_ALPHA = nil;
static CCBlendMode *CCBLEND_PREMULTIPLIED_ALPHA = nil;
static CCBlendMode *CCBLEND_ADD = nil;
static CCBlendMode *CCBLEND_MULTIPLY = nil;

static CCBlendMode *CCBLEND_ADD_WITH_ALPHA = nil;
static CCBlendMode *CCBLEND_SCREEN = nil;
static CCBlendMode *CCBLEND_MULTIPLICATIVE = nil;
static CCBlendMode *CCBLEND_DODGE = nil;

NSDictionary *CCBLEND_DISABLED_OPTIONS = nil;

+(void)initialize
{
	// +initialize may be called due to loading a subclass.
	if(self != [CCBlendMode class]) return;

	CCBLENDMODE_CACHE = [[CCBlendModeCache alloc] init];

	// Add the default modes
	CCBLEND_DISABLED = [self blendModeWithOptions:@{}];
	CCBLEND_DISABLED_OPTIONS = CCBLEND_DISABLED.options;

	CCBLEND_ALPHA = [self blendModeWithOptions:@{
		CCBlendFuncSrcColor: @(GL_SRC_ALPHA),
		CCBlendFuncDstColor: @(GL_ONE_MINUS_SRC_ALPHA),
	}];

	CCBLEND_PREMULTIPLIED_ALPHA = [self blendModeWithOptions:@{
		CCBlendFuncSrcColor: @(GL_ONE),
		CCBlendFuncDstColor: @(GL_ONE_MINUS_SRC_ALPHA),
	}];

	CCBLEND_ADD = [self blendModeWithOptions:@{
		CCBlendFuncSrcColor: @(GL_ONE),
		CCBlendFuncDstColor: @(GL_ONE),
	}];

	CCBLEND_MULTIPLY = [self blendModeWithOptions:@{
		CCBlendFuncSrcColor: @(GL_DST_COLOR),
		CCBlendFuncDstColor: @(GL_ZERO),
	}];

    CCBLEND_ADD_WITH_ALPHA = [self blendModeWithOptions:@{
        CCBlendFuncSrcColor: @(GL_SRC_ALPHA),
        CCBlendFuncDstColor: @(GL_ZERO),
    }];

    CCBLEND_SCREEN = [self blendModeWithOptions:@{
        CCBlendFuncSrcColor: @(GL_ONE_MINUS_DST_COLOR),
        CCBlendFuncDstColor: @(GL_ONE),
    }];

    CCBLEND_MULTIPLICATIVE = [self blendModeWithOptions:@{
        CCBlendFuncSrcColor: @(GL_DST_COLOR),
        CCBlendFuncDstColor: @(GL_ONE_MINUS_SRC_ALPHA),
    }];

    CCBLEND_DODGE = [self blendModeWithOptions:@{
        CCBlendFuncSrcColor: @(GL_ONE_MINUS_SRC_ALPHA),
        CCBlendFuncDstColor: @(GL_ONE),
    }];
}

+(void)flushCache
{
	[CCBLENDMODE_CACHE flush];
}

+(CCBlendMode *)blendModeWithOptions:(NSDictionary *)options
{
	return [CCBLENDMODE_CACHE objectForKey:options];
}

+(CCBlendMode *)disabledMode
{
	return CCBLEND_DISABLED;
}

+(CCBlendMode *)alphaMode
{
	return CCBLEND_ALPHA;
}

+(CCBlendMode *)premultipliedAlphaMode
{
	return CCBLEND_PREMULTIPLIED_ALPHA;
}

+(CCBlendMode *)addMode
{
	return CCBLEND_ADD;
}

+(CCBlendMode *)multiplyMode
{
	return CCBLEND_MULTIPLY;
}

+(CCBlendMode *)multiplicativeMode
{
    return CCBLEND_MULTIPLICATIVE;
}

+(CCBlendMode *)addWithAlphaMode
{
    return CCBLEND_ADD_WITH_ALPHA;
}

+(CCBlendMode *)screenMode
{
    return CCBLEND_SCREEN;
}

+(CCBlendMode *)dodgeMode
{
    return CCBLEND_DODGE;
}

@end

//MARK: Render States.

/// A simple key class for tracking render states.
/// ivars are unretained so that it doesn't force textures to stay in memory.
@interface CCRenderStateCacheKey : NSObject<NSCopying> @end
@implementation CCRenderStateCacheKey {
	@public
	__unsafe_unretained CCBlendMode *_blendMode;
	__unsafe_unretained CCShader *_shader;
	__unsafe_unretained CCTexture *_mainTexture;
}

-(instancetype)initWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader mainTexture:(CCTexture *)mainTexture
{
	if((self = [super init])){
		_blendMode = blendMode;
		_shader = shader;
		_mainTexture = mainTexture;
	}

	return self;
}

-(NSUInteger)hash
{
	// Not great, but acceptable. All values are unique by pointer.
	return ((NSUInteger)_blendMode ^ (NSUInteger)_shader ^ (NSUInteger)_mainTexture);
}

-(BOOL)isEqual:(id)object
{
	CCRenderStateCacheKey *other = object;

	return (
		[other isKindOfClass:[CCRenderStateCacheKey class]] &&
		_blendMode == other->_blendMode &&
		_shader == other->_shader &&
		_mainTexture == other->_mainTexture
	);
}

-(id)copyWithZone:(NSZone *)zone
{
	// Object is immutable.
	return self;
}

@end

@interface CCRenderStateCache : CCCache
@end

@implementation CCRenderStateCache

-(id)createSharedDataForKey:(CCRenderStateCacheKey *)key
{
	return key;
}

-(id)createPublicObjectForSharedData:(CCRenderStateCacheKey *)key
{
	// Although the key ivars are unretained, this method is only ever called when a key has been freshly constructed using strong references to the necessary objects.
	return [CCRenderStateClass renderStateWithBlendMode:key->_blendMode shader:key->_shader shaderUniforms:@{CCShaderUniformMainTexture:key->_mainTexture} copyUniforms:YES];
}

// Nothing special
-(void)disposeOfSharedData:(id)data {}

-(void)flush
{
	// Since render states are used for keys, need to wrap the flush call in a pool.
	@autoreleasepool {
		[super flush];
	}
}

@end

@implementation CCRenderState

static CCRenderStateCache *CCRENDERSTATE_CACHE = nil;
static CCRenderState *CCRENDERSTATE_DEBUGCOLOR = nil;

+(void)initialize
{
	// +initialize may be called due to loading a subclass.
	if(self != [CCRenderState class]) return;

	CCRENDERSTATE_CACHE = [[CCRenderStateCache alloc] init];
	CCRENDERSTATE_DEBUGCOLOR = [[CCRenderStateClass alloc] initWithBlendMode:CCBLEND_DISABLED shader:[CCShader positionColorShader] shaderUniforms:@{}];
}

+(void)flushCache
{
	[CCRENDERSTATE_CACHE flush];
}

-(instancetype)initWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader shaderUniforms:(NSDictionary *)shaderUniforms
{
	// Allocate a new instance of the correct class instead of self. (This method was already deprecated).
	return [[CCRenderStateClass alloc] initWithBlendMode:blendMode shader:shader shaderUniforms:shaderUniforms copyUniforms:NO];
}

-(instancetype)initWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader shaderUniforms:(NSDictionary *)shaderUniforms copyUniforms:(BOOL)copyUniforms
{
	if((self = [super init])){
		NSAssert(blendMode, @"CCRenderState: Blending mode is nil");
		NSAssert(shader, @"CCRenderState: Shader is nil");
		NSAssert(shaderUniforms, @"CCRenderState: shader uniform dictionary is nil.");

		_blendMode = blendMode;
		_shader = shader;
		_shaderUniforms = (copyUniforms ? [shaderUniforms copy] : shaderUniforms);

		// The renderstate as a whole is immutable if the uniforms are copied.
		_immutable = copyUniforms;
	}

	return self;
}

+(instancetype)renderStateWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader mainTexture:(CCTexture *)mainTexture;
{
	if(mainTexture == nil){
		CCLOGWARN(@"nil Texture passed to CCRenderState");
		mainTexture = [CCTexture none];
	}

	return [CCRENDERSTATE_CACHE objectForKey:[[CCRenderStateCacheKey alloc] initWithBlendMode:blendMode shader:shader mainTexture:mainTexture]];
}

+(instancetype)renderStateWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader shaderUniforms:(NSDictionary *)shaderUniforms copyUniforms:(BOOL)copyUniforms
{
	return [[CCRenderStateClass alloc] initWithBlendMode:blendMode shader:shader shaderUniforms:shaderUniforms copyUniforms:copyUniforms];
}

-(id)copyWithZone:(NSZone *)zone
{
	if(_immutable){
		return self;
	} else {
		return [[CCRenderStateClass allocWithZone:zone] initWithBlendMode:_blendMode shader:_shader shaderUniforms:_shaderUniforms copyUniforms:YES];
	}
}

+(instancetype)debugColor
{
	return CCRENDERSTATE_DEBUGCOLOR;
}

-(void)transitionRenderer:(CCRenderer *)renderer FromState:(CCRenderer *)previous
{
	NSAssert(NO, @"Must be overridden.");
}

@end

// MARK: CCGraphicsBuffer

@implementation CCGraphicsBuffer

-(instancetype)initWithCapacity:(NSUInteger)capacity elementSize:(size_t)elementSize type:(CCGraphicsBufferType)type
{
	if((self = [super init])){
		_count = 0;
		_capacity = capacity;
		_elementSize = elementSize;
	}

	return self;
}

-(void)resize:(size_t)newCapacity
{NSAssert(NO, @"Must be overridden.");}

-(void)destroy
{NSAssert(NO, @"Must be overridden.");}

-(void)prepare
{NSAssert(NO, @"Must be overridden.");}

-(void)commit
{NSAssert(NO, @"Must be overridden.");}

-(void)dealloc
{
	[self destroy];
}

@end

//MARK: CCGraphicsBufferBindings

@implementation CCGraphicsBufferBindings

// Base implementation does nothing.
-(void)bind:(BOOL)bind vertexPage:(NSUInteger)vertexPage {}

-(void)prepare
{
	[_vertexBuffer prepare];
	[_indexBuffer prepare];
	[_uniformBuffer prepare];
}

-(void)commit
{
	[_vertexBuffer commit];
	[_indexBuffer commit];
	[_uniformBuffer commit];
}

@end

//MARK: Framebuffer bindings.

@implementation CCFrameBufferObject

-(instancetype)initWithTexture:(CCTexture *)texture depthStencilFormat:(GLuint)depthStencilFormat
{
	if((self = [super init])){
		_texture = texture;

		_sizeInPixels = texture.contentSizeInPixels;
		_contentScale = texture.contentScale;

		_depthStencilFormat = depthStencilFormat;
	}

	return self;
}

-(void)bindWithClear:(GLbitfield)mask color:(GLKVector4)color4 depth:(GLclampf)depth stencil:(GLint)stencil
{NSAssert(NO, @"Must be overridden.");}

-(void)syncWithView:(CC_VIEW<CCDirectorView> *)view;
{
	CCDirector *director = [CCDirector sharedDirector];
	self.sizeInPixels = director.viewSizeInPixels;
	self.contentScale = director.contentScaleFactor;
}

@end


text:
namespace local_discovery {

TestServiceDiscoveryClient::TestServiceDiscoveryClient() {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}

TestServiceDiscoveryClient::~TestServiceDiscoveryClient() {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}

void TestServiceDiscoveryClient::Start() {
  mdns_client_.reset(new net::MDnsClientImpl());
  service_discovery_client_impl_.reset(new ServiceDiscoveryClientImpl(
      mdns_client_.get()));
  int result = mdns_client_->StartListening(&mock_socket_factory_);
  DCHECK_EQ(net::OK, result);

  EXPECT_CALL(mock_socket_factory_, OnSendTo(testing::_))
      .Times(testing::AnyNumber())
      .WillRepeatedly(testing::Invoke(this,
                                      &TestServiceDiscoveryClient::OnSendTo));
}

std::unique_ptr<ServiceWatcher>
TestServiceDiscoveryClient::CreateServiceWatcher(
    const std::string& service_type,
    ServiceWatcher::UpdatedCallback callback) {
  return service_discovery_client_impl_->CreateServiceWatcher(
      service_type, std::move(callback));
}

std::unique_ptr<ServiceResolver>
TestServiceDiscoveryClient::CreateServiceResolver(
    const std::string& service_name,
    ServiceResolver::ResolveCompleteCallback callback) {
  return service_discovery_client_impl_->CreateServiceResolver(
      service_name, std::move(callback));
}

std::unique_ptr<LocalDomainResolver>
TestServiceDiscoveryClient::CreateLocalDomainResolver(
    const std::string& domain,
    net::AddressFamily address_family,
    LocalDomainResolver::IPAddressCallback callback) {
  return service_discovery_client_impl_->CreateLocalDomainResolver(
      domain, address_family, std::move(callback));
}

void TestServiceDiscoveryClient::SimulateReceive(const uint8_t* packet,
                                                 int size) {
  mock_socket_factory_.SimulateReceive(packet, size);
}

}  // namespace local_discovery


text:
<?php

declare(strict_types=1);

namespace Dotenv\Tests\Repository\Adapter;

use Dotenv\Repository\Adapter\PutenvAdapter;
use PHPUnit\Framework\TestCase;

final class PutenvAdapterTest extends TestCase
{
    public function testGoodRead()
    {
        \putenv('CONST_TEST=foo bar baz');
        $value = self::createAdapter()->read('CONST_TEST');
        self::assertTrue($value->isDefined());
        self::assertSame('foo bar baz', $value->get());
    }

    public function testUndefinedRead()
    {
        \putenv('CONST_TEST');
        $value = self::createAdapter()->read('CONST_TEST');
        self::assertFalse($value->isDefined());
    }

    public function testGoodWrite()
    {
        self::assertTrue(self::createAdapter()->write('CONST_TEST', 'foo'));
        self::assertSame('foo', \getenv('CONST_TEST'));
    }

    public function testEmptyWrite()
    {
        self::assertTrue(self::createAdapter()->write('CONST_TEST', ''));
        self::assertSame('', \getenv('CONST_TEST'));
    }

    public function testGoodDelete()
    {
        self::assertTrue(self::createAdapter()->delete('CONST_TEST'));
        self::assertFalse(\getenv('CONST_TEST'));
    }

    /**
     * @return \Dotenv\Repository\Adapter\AdapterInterface
     */
    private static function createAdapter()
    {
        return PutenvAdapter::create()->get();
    }
}


text:
/* $NetBSD: fsm.h,v 1.4 2013/07/11 05:45:23 kefren Exp $ */

/*-
 * Copyright (c) 2010 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Mihai Chelaru <kefren@NetBSD.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _FSM_H_
#define _FSM_H_

#include "tlv.h"
#include "pdu.h"

void	run_ldp_hello(const struct ldp_pdu *, const struct hello_tlv *,
		const struct sockaddr *, const struct in_addr *, int, bool);
struct address_list_tlv *	build_address_list_tlv(void);
int	set_my_ldp_id(void);

#endif /* !_FSM_H_ */


text:
import { mount } from '@test'
import CompositionComponent from '~/components/editor/Composition.vue'
import Composition from '~/models/Composition.js'

describe('CompositionComponent', () => {
  let vm, wrapper
  beforeEach(() => {
    let wrapper = mount(CompositionComponent)
    vm = wrapper.vm
  })

  it('should contain a composition model by default', () => {
    expect(vm.text instanceof Composition).to.equal(true)
  })
})


text:
<?php

namespace Guzzle\Tests\Service\Command\LocationVisitor\Response;

use Guzzle\Service\Description\Parameter;
use Guzzle\Http\Message\Response;
use Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor as Visitor;

/**
 * @covers Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor
 */
class XmlVisitorTest extends AbstractResponseVisitorTest
{
    public function testBeforeMethodParsesXml()
    {
        $visitor = new Visitor();
        $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand')
            ->setMethods(array('getResponse'))
            ->getMockForAbstractClass();
        $command->expects($this->once())
            ->method('getResponse')
            ->will($this->returnValue(new Response(200, null, '<foo><Bar>test</Bar></foo>')));
        $result = array();
        $visitor->before($command, $result);
        $this->assertEquals(array('Bar' => 'test'), $result);
    }

    public function testBeforeMethodParsesXmlWithNamespace()
    {
        $this->markTestSkipped("Response/XmlVisitor cannot accept 'xmlns' in response, see #368 (http://git.io/USa1mA).");

        $visitor = new Visitor();
        $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand')
            ->setMethods(array('getResponse'))
            ->getMockForAbstractClass();
        $command->expects($this->once())
            ->method('getResponse')
            ->will($this->returnValue(new Response(200, null, '<foo xmlns="urn:foo"><bar:Bar xmlns:bar="urn:bar">test</bar:Bar></foo>')));
        $result = array();
        $visitor->before($command, $result);
        $this->assertEquals(array('Bar' => 'test'), $result);
    }

    public function testBeforeMethodParsesNestedXml()
    {
        $visitor = new Visitor();
        $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand')
            ->setMethods(array('getResponse'))
            ->getMockForAbstractClass();
        $command->expects($this->once())
            ->method('getResponse')
            ->will($this->returnValue(new Response(200, null, '<foo><Items><Bar>test</Bar></Items></foo>')));
        $result = array();
        $visitor->before($command, $result);
        $this->assertEquals(array('Items' => array('Bar' => 'test')), $result);
    }

    public function testCanExtractAndRenameTopLevelXmlValues()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'location' => 'xml',
            'name'     => 'foo',
            'sentAs'   => 'Bar'
        ));
        $value = array('Bar' => 'test');
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertArrayHasKey('foo', $value);
        $this->assertEquals('test', $value['foo']);
    }

    public function testEnsuresRepeatedArraysAreInCorrectLocations()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'location' => 'xml',
            'name'     => 'foo',
            'sentAs'   => 'Foo',
            'type'     => 'array',
            'items'    => array(
                'type' => 'object',
                'properties' => array(
                    'Bar' => array('type' => 'string'),
                    'Baz' => array('type' => 'string'),
                    'Bam' => array('type' => 'string')
                )
            )
        ));

        $xml = new \SimpleXMLElement('<Test><Foo><Bar>1</Bar><Baz>2</Baz></Foo></Test>');
        $value = json_decode(json_encode($xml), true);
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertEquals(array(
            'foo' => array(
                array (
                    'Bar' => '1',
                    'Baz' => '2'
                )
            )
        ), $value);
    }

    public function testEnsuresFlatArraysAreFlat()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'location' => 'xml',
            'name'     => 'foo',
            'type'     => 'array',
            'items'    => array('type' => 'string')
        ));

        $value = array('foo' => array('bar', 'baz'));
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertEquals(array('foo' => array('bar', 'baz')), $value);

        $value = array('foo' => 'bar');
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertEquals(array('foo' => array('bar')), $value);
    }

    public function xmlDataProvider()
    {
        $param = new Parameter(array(
            'location' => 'xml',
            'name'     => 'Items',
            'type'     => 'array',
            'items'    => array(
                'type' => 'object',
                'name' => 'Item',
                'properties' => array(
                    'Bar' => array('type' => 'string'),
                    'Baz' => array('type' => 'string')
                )
            )
        ));

        return array(
            array($param, '<Test><Items><Item><Bar>1</Bar></Item><Item><Bar>2</Bar></Item></Items></Test>', array(
                'Items' => array(
                    array('Bar' => 1),
                    array('Bar' => 2)
                )
            )),
            array($param, '<Test><Items><Item><Bar>1</Bar></Item></Items></Test>', array(
                'Items' => array(
                    array('Bar' => 1)
                )
            )),
            array($param, '<Test><Items /></Test>', array(
                'Items' => array()
            ))
        );
    }

    /**
     * @dataProvider xmlDataProvider
     */
    public function testEnsuresWrappedArraysAreInCorrectLocations($param, $xml, $result)
    {
        $visitor = new Visitor();
        $xml = new \SimpleXMLElement($xml);
        $value = json_decode(json_encode($xml), true);
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertEquals($result, $value);
    }

    public function testCanRenameValues()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'name'     => 'TerminatingInstances',
            'type'     => 'array',
            'location' => 'xml',
            'sentAs'   => 'instancesSet',
            'items'    => array(
                'name' => 'item',
                'type' => 'object',
                'sentAs' => 'item',
                'properties' => array(
                    'InstanceId' => array(
                        'type'   => 'string',
                        'sentAs' => 'instanceId',
                    ),
                    'CurrentState' => array(
                        'type'   => 'object',
                        'sentAs' => 'currentState',
                        'properties' => array(
                            'Code' => array(
                                'type' => 'numeric',
                                'sentAs' => 'code',
                            ),
                            'Name' => array(
                                'type' => 'string',
                                'sentAs' => 'name',
                            ),
                        ),
                    ),
                    'PreviousState' => array(
                        'type'   => 'object',
                        'sentAs' => 'previousState',
                        'properties' => array(
                            'Code' => array(
                                'type' => 'numeric',
                                'sentAs' => 'code',
                            ),
                            'Name' => array(
                                'type' => 'string',
                                'sentAs' => 'name',
                            ),
                        ),
                    ),
                ),
            )
        ));

        $value = array(
            'instancesSet' => array (
                'item' => array (
                    'instanceId' => 'i-3ea74257',
                    'currentState' => array(
                        'code' => '32',
                        'name' => 'shutting-down',
                    ),
                    'previousState' => array(
                        'code' => '16',
                        'name' => 'running',
                    ),
                ),
            )
        );

        $visitor->visit($this->command, $this->response, $param, $value);

        $this->assertEquals(array(
            'TerminatingInstances' => array(
                array(
                    'InstanceId' => 'i-3ea74257',
                    'CurrentState' => array(
                        'Code' => '32',
                        'Name' => 'shutting-down',
                    ),
                    'PreviousState' => array(
                        'Code' => '16',
                        'Name' => 'running',
                    )
                )
            )
        ), $value);
    }

    public function testCanRenameAttributes()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'name'     => 'RunningQueues',
            'type'     => 'array',
            'location' => 'xml',
            'items'    => array(
                'type' => 'object',
                'sentAs' => 'item',
                'properties' => array(
                    'QueueId' => array(
                        'type'   => 'string',
                        'sentAs' => 'queue_id',
                        'data'   => array(
                            'xmlAttribute' => true,
                        ),
                    ),
                    'CurrentState' => array(
                        'type'       => 'object',
                        'properties' => array(
                            'Code' => array(
                                'type'   => 'numeric',
                                'sentAs' => 'code',
                                'data'   => array(
                                    'xmlAttribute' => true,
                                ),
                            ),
                            'Name' => array(
                                'sentAs' => 'name',
                                'data'   => array(
                                    'xmlAttribute' => true,
                                ),
                            ),
                        ),
                    ),
                    'PreviousState' => array(
                        'type'       => 'object',
                        'properties' => array(
                            'Code' => array(
                                'type'   => 'numeric',
                                'sentAs' => 'code',
                                'data'   => array(
                                    'xmlAttribute' => true,
                                ),
                            ),
                            'Name' => array(
                                'sentAs' => 'name',
                                'data'   => array(
                                    'xmlAttribute' => true,
                                ),
                            ),
                        ),
                    ),
                ),
            )
        ));

        $xml = '<wrap><RunningQueues><item queue_id="q-3ea74257"><CurrentState code="32" name="processing" /><PreviousState code="16" name="wait" /></item></RunningQueues></wrap>';
        $value = json_decode(json_encode(new \SimpleXMLElement($xml)), true);
        $visitor->visit($this->command, $this->response, $param, $value);

        $this->assertEquals(array(
            'RunningQueues' => array(
                array(
                    'QueueId' => 'q-3ea74257',
                    'CurrentState' => array(
                        'Code' => '32',
                        'Name' => 'processing',
                    ),
                    'PreviousState' => array(
                        'Code' => '16',
                        'Name' => 'wait',
                    ),
                ),
            )
        ), $value);
    }

    public function testAddsEmptyArraysWhenValueIsMissing()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'name'     => 'Foo',
            'type'     => 'array',
            'location' => 'xml',
            'items' => array(
                'type' => 'object',
                'properties' => array(
                    'Baz' => array('type' => 'array'),
                    'Bar' => array(
                        'type'   => 'object',
                        'properties' => array(
                            'Baz' => array('type' => 'array'),
                         )
                    )
                )
            )
        ));

        $value = array();
        $visitor->visit($this->command, $this->response, $param, $value);

        $value = array(
            'Foo' => array(
                'Bar' => array()
            )
        );
        $visitor->visit($this->command, $this->response, $param, $value);
        $this->assertEquals(array(
            'Foo' => array(
                array(
                    'Bar' => array()
                )
            )
        ), $value);
    }

    /**
     * @group issue-399
     * @link  https://github.com/guzzle/guzzle/issues/399
     */
    public function testDiscardingUnknownProperties()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'name'                 => 'foo',
            'type'                 => 'object',
            'additionalProperties' => false,
            'properties'           => array(
                'bar' => array(
                    'type' => 'string',
                    'name' => 'bar',
                ),
            ),
        ));
        $this->value = array('foo' => array('bar' => 15, 'unknown' => 'Unknown'));
        $visitor->visit($this->command, $this->response, $param, $this->value);
        $this->assertEquals(array('foo' => array('bar' => 15)), $this->value);
    }

    /**
     * @group issue-399
     * @link  https://github.com/guzzle/guzzle/issues/399
     */
    public function testDiscardingUnknownPropertiesWithAliasing()
    {
        $visitor = new Visitor();
        $param = new Parameter(array(
            'name'                 => 'foo',
            'type'                 => 'object',
            'additionalProperties' => false,
            'properties'           => array(
                'bar' => array(
                    'name'   => 'bar',
                    'sentAs' => 'baz',
                ),
            ),
        ));
        $this->value = array('foo' => array('baz' => 15, 'unknown' => 'Unknown'));
        $visitor->visit($this->command, $this->response, $param, $this->value);
        $this->assertEquals(array('foo' => array('bar' => 15)), $this->value);
    }
}


text:
frappe.query_reports["Addresses And Contacts"] = {
	"filters": [
		{
			"reqd": 1,
			"fieldname":"reference_doctype",
			"label": __("Entity Type"),
			"fieldtype": "Link",
			"options": "DocType",
			"get_query": function() {
				return {
					"filters": {
						"name": ["in", "Contact, Address"],
					}
				}
			}
		},
		{
			"fieldname":"reference_name",
			"label": __("Entity Name"),
			"fieldtype": "Dynamic Link",
			"get_options": function() {
				let reference_doctype = frappe.query_report.get_filter_value('reference_doctype');
				if(!reference_doctype) {
					frappe.throw(__("Please select Entity Type first"));
				}
				return reference_doctype;
			}
		}
	]
}


text:
package jira

import (
	"encoding/base64"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strings"

	"github.com/amencarini/jirhub/config"
)

func GetTicket(key string, conf config.Configuration) Ticket {
	ticket := Ticket{Key: key}

	credentials := strings.Join([]string{conf.Username, conf.Password}, ":")

	encryptedCredentials := base64.StdEncoding.EncodeToString([]byte(credentials))

	url := fmt.Sprintf("https://%s/rest/api/2/issue/%s", conf.JiraHost, ticket.Key)

	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encryptedCredentials))

	client := &http.Client{}
	resp, err := client.Do(req)

	if err != nil {
		log.Fatal(err)
	}

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		log.Fatal(err)
	}

	json.Unmarshal(body, &ticket)

	return ticket
}


text:
require 'spec_helper'
require 'repository/fixtures'

module Fountain::Repository
  describe BaseRepository do
    subject { StubRepository.new(StubAggregate) }

    before(:each) do
      Fountain::Session::Unit.start
    end

    after(:each) do
      Fountain::Session::UnitStack.rollback_all
    end

    describe '#add' do
      it 'accepts aggregates with the correct type' do
        subject.add(StubAggregate.new)
      end

      it 'rejects aggregates without the correct type' do
        expect {
          subject.add(SomeOtherAggregate.new)
        }.to raise_error(ArgumentError)
      end

      it 'rejects existing aggregates' do
        expect {
          subject.add(StubAggregate.new(SecureRandom.uuid, 1))
        }.to raise_error(ArgumentError)
      end
    end
  end

  class StubRepository < BaseRepository
    private

    def perform_load(aggregate_id, expected_version)
    end

    def perform_save(aggregate)
    end

    def perform_delete(aggregate)
    end
  end
end


text:
package com.google.api.ads.dfp.jaxws.v201508;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             {@code LineItem} is an advertiser's commitment to purchase a specific number
 *             of ad impressions, clicks, or time.
 *
 *
 *
Java class for LineItem complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="LineItem">
 *   <complexContent>
 *     <extension base="{https://www.google.com/apis/ads/publisher/v201508}LineItemSummary">
 *       <sequence>
 *         <element name="targeting" type="{https://www.google.com/apis/ads/publisher/v201508}Targeting" minOccurs="0"/>
 *         <element name="creativeTargetings" type="{https://www.google.com/apis/ads/publisher/v201508}CreativeTargeting" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LineItem", propOrder = {
    "targeting",
    "creativeTargetings"
})
public class LineItem
    extends LineItemSummary
{

    protected Targeting targeting;
    protected List<CreativeTargeting> creativeTargetings;

    /**
     * Gets the value of the targeting property.
     *
     * @return
     *     possible object is
     *     {@link Targeting }
     *
     */
    public Targeting getTargeting() {
        return targeting;
    }

    /**
     * Sets the value of the targeting property.
     *
     * @param value
     *     allowed object is
     *     {@link Targeting }
     *
     */
    public void setTargeting(Targeting value) {
        this.targeting = value;
    }

    /**
     * Gets the value of the creativeTargetings property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the creativeTargetings property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getCreativeTargetings().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CreativeTargeting }
     *
     *
     */
    public List<CreativeTargeting> getCreativeTargetings() {
        if (creativeTargetings == null) {
            creativeTargetings = new ArrayList<CreativeTargeting>();
        }
        return this.creativeTargetings;
    }

}


text:
/*
 * James A. Feister jfeister@udel.edu, openjaf@gmail.com
 * Project located at www.github.com/thegreatpissant/gemini.git
 * Class: CISC 360 - Computer Architecture
 * Instructor: Seth Morecraft
 * Web: http://www.cis.udel.edu/~morecraf/cisc360/
 *
 * Project 1: Gemini architecture, Implement the following
 * - GUI: Showing registers and instruction
 * - Parsing of program for syntax errors: Alert user of failure
 * - Running of program instructions, non bytecode translation
 * - Detection of memory access errors, Alert user of failure
 * - This is the base of the project.
 */

#include "validator.h"
#include "gemini_parser.h"
#include "gemini_types.h"

/*
 * The VALIDATOR!! - The Compiler, comming soon.
 */

//  User our parser and types to validate and translate the source
//  file from what they think it is into a pseudo byte_code form, and
//  return error if it is not.  Linking is done later in gemini.cpp.
Error_lines validate_source (Source_code source_code, std::shared_ptr<Operand_code> operand_code)
{
    Error_lines error_lines;

    for ( std::size_t i = 0; i < source_code.size(); i++ )
    {
        Gemini_operand *operand = Gemini_parser::parse_instruction(source_code[i]);
        if ( operand->op== Gemini_op::INVALID )
            error_lines.push_back (i);
        if ( operand->op != Gemini_op::EMPTY )
            operand_code->push_back (*operand);
    }
    return error_lines;  // HA, HA.
}


text:
ARG_DEFS=(
)

echo "##### "
echo "##### app-base/publish.sh"
echo "#####"

function init {
  APPBASE_DIR=$HOME/ionic-app-base
  APPBASE_LIB_DIR=$APPBASE_DIR/www/lib/ionic

  ../clone/clone.sh --repository="driftyco/ionic-app-base" \
    --directory="$APPBASE_DIR" \
    --branch="master"
}

function run {
  cd ../..

  VERSION=$(readJsonProp "package.json" "version")

  echo "-- Updating files..."

  rm -rf $APPBASE_LIB_DIR
  mkdir -p $APPBASE_LIB_DIR

  node_modules/.bin/gulp build --release --dist=$APPBASE_LIB_DIR
  cp -Rf scss $APPBASE_LIB_DIR

  echo "-- Updating bower dependency..."
  replaceJsonProp "$APPBASE_DIR/bower.json" "ionic" "driftyco\/ionic-bower#$VERSION"

  cd $APPBASE_DIR

  git add -A
  git commit -am "release: update ionic to v$VERSION"
  git push -q origin master

  echo "-- ionic-app-base published v$VERSION successfully!"
}

source $(dirname $0)/../utils.inc


text:
package com.shade.entities.monster;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Circle;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.state.StateBasedGame;

import com.crash.Body;
import com.shade.base.Entity;
import com.shade.base.Level;
import com.shade.base.util.StateManager;
import com.shade.controls.DayPhaseTimer;
import com.shade.crash.CrashLevel;
import com.shade.crash.Repelable;
import com.shade.entities.Basket;
import com.shade.entities.Player;
import com.shade.entities.Roles;
import com.shade.entities.mushroom.Mushroom;
import com.shade.levels.Model;
import com.shade.lighting.LuminousEntity;

/**
 * The real deal; this mole is the sum of different mole states.
 *
 * No I haven't heard of encapsulation.
 *
 * @author Jonathan Jou <j.j@duke.edu>
 */
public final class Monster extends Body implements LuminousEntity{

    protected enum States {
        PROWLING, SLEEPING, LOST, CHASING, WANDERING, SNIFFING
    }

    protected CrashLevel level;
    protected StateManager manager;
    protected Mushroom target;
    protected float heading;
    protected float range;
    protected float speed;

    private float luminosity;

    public Monster(int x, int y, int range, float speed) throws SlickException {
        heading = (float) (Math.PI);
        this.range = range;
        this.speed = speed;
        initShape(x, y);
        initStates();
    }

    private void initShape(float x, float y) {
        shape = new Circle(x, y, 18f);
    }

    private void initStates() throws SlickException {
        manager = new StateManager();
        manager.add(new ProwlingMonster(this));
        manager.add(new ChasingMonster(this));
        manager.add(new SleepingMonster(this));
        manager.add(new LostMonster(this));
        manager.add(new SniffingMonster(this));
        manager.add(new WanderingMonster(this));
    }

    protected void kill() {
        level.remove(this);
    }

    public void move(double rate){
    	float x = (float)(Math.cos(heading-Math.PI/2)*speed*rate);
    	float y = (float)(Math.sin(heading-Math.PI/2)*speed*rate);
    	nudge(x,y);
    }

    public float getLuminosity() {
        return luminosity;
    }

    public void setLuminosity(float l) {
        luminosity = l;
    }

    public void addToLevel(Level < ? > l) {
        level = (CrashLevel) l;
    }

    public int getRole() {
        return Roles.MONSTER.ordinal();
    }

    public void onCollision(Entity obstacle) {
        manager.onCollision(obstacle);
        if (obstacle.getRole() == Roles.OBSTACLE.ordinal()) {
            Repelable b = (Repelable) obstacle;
            b.repel(this);
        }
    }

    public boolean canChase(){
    	return playerInSight() && playerInRange();
    }

    public boolean playerInSight(){
    	Player p = (Player)level.getEntitiesByRole(Roles.PLAYER.ordinal())[0];
    	return level.lineOfSight(this,p, this,(Basket)level.getEntitiesByRole(Roles.BASKET.ordinal())[0]) && p.getLuminosity()>0.6;
    }

    public boolean playerInRange(){
    	Player p = (Player)level.getEntitiesByRole(Roles.PLAYER.ordinal())[0];
    	float distx = p.getXCenter()-getXCenter();
    	float disty = p.getYCenter()-getYCenter();
    	return Math.sqrt(distx*distx+disty*disty)<range;
    }

    public void render(StateBasedGame game, Graphics g) {
        g.rotate(getXCenter(), getYCenter(), (float) Math.toDegrees(heading));
        manager.render(game, g);
        g.resetTransform();
    }

    public void yawn(){
    	Model mode = (Model)level;
    	if(mode.getTimer().getDaylightStatus()==DayPhaseTimer.DayLightStatus.NIGHT){
        	manager.enter(States.SLEEPING);
        }
    }

    public void wake(){
    	Model mode = (Model)level;
    	if(mode.getTimer().getDaylightStatus()==DayPhaseTimer.DayLightStatus.DAWN){
        	manager.enter(States.PROWLING);
        }
    }

    public void update(StateBasedGame game, int delta) {
        manager.update(game, delta);
        testAndWrap();

    }

    /**
     * Checks whether a linkable is over the edge of the screen and wraps it if
     * it is.
     */
    protected void testAndWrap() {
        if (getXCenter() <= 5) {
            shape.setCenterX(795);
        }
        if (getXCenter() > 795) {
            shape.setCenterX(5);
        }
        if (getYCenter() <= 5) {
            shape.setCenterY(595);
        }
        if (getYCenter() > 595) {
            shape.setCenterY(5);
        }
    }

    public Shape castShadow(float direction, float depth) {
        return null;
    }

    public int getZIndex() {
        return 2;
    }

    public int compareTo(LuminousEntity l) {
        return getZIndex() - l.getZIndex();
    }

	public void removeFromLevel(Level<?> l) {
		level.remove(this);

	}
}


text:
module hxy.JsGame {
    export class GameManager {
        private _spriteManager: SpriteManager;
        private _player: ConcreteSprite.PlayerTank;

        constructor(spriteManager: SpriteManager) {
            this._spriteManager = spriteManager;
        }

        Initialize() {
            this._player = this._spriteManager.AddAPlayer();
            for (var i = 0; i < 5; i++) {
                this._spriteManager.AddAEnemy().Fire();
            }
            setInterval(() => this.ThreadRun(), 20);
            setInterval(() => this.UpdateExplosionFrame(), 150);

            document.addEventListener("keydown", e => this.KeyDown(e));
            document.addEventListener("keyup", e => this.KeyUp(e));
        }
        ThreadRun() {
            for (var i = 0; i < this._spriteManager.allSprites.length; i++) {
                var sprite = this._spriteManager.allSprites[i];
                sprite.Move();

                this.DealCollideSprites(sprite);

                //change enemy direction by a random time span
                if (Math.random() * 100 < 1 &&
                    sprite.collisionType == Enum.CollisionType.EnemyTank) {
                    sprite.ChangeARandomDirection();
                }
            }
        }
        UpdateExplosionFrame() {
            this._spriteManager.explosions.forEach(function (explosion: ConcreteSprite.Explosion) {
                if (explosion.isVisible) {
                    explosion.UpdateFrame();
                }
            });
        }
        DealCollideSprites(sprite: Common.SpriteBase) {
            //Don't detect a collision generated by a explosion
            if (sprite.collisionType == Enum.CollisionType.Explosion) {
                return;
            }
            var allSprites = this._spriteManager.allSprites;

            for (var j = 0; j < allSprites.length; j++) {
                var target = allSprites[j];
                //Is Need To Detect Collision between sprite and target
                if (this.IsNeedToDetectCollision(sprite, target)) {
                    if (sprite.IsCollided(target)) {
                        sprite.OnCollided(target.rectangle, target.collisionType, true);
                        target.OnCollided(sprite.rectangle, sprite.collisionType, false);
                        //need return!
                        //otherwise occurs the same type collision
                        return;
                    }
                }
            }
        }
        IsNeedToDetectCollision(sprite1: Common.SpriteBase, sprite2: Common.SpriteBase) {
            if (sprite1 == sprite2) {
                return false;
            }
            if (sprite1.collisionType == Enum.CollisionType.Explosion ||
                sprite2.collisionType == Enum.CollisionType.Explosion) {
                return false;
            }
            if (sprite1 instanceof ConcreteSprite.Shell && sprite1.myTank == sprite2) {
                return false;
            }
            if (sprite2 instanceof ConcreteSprite.Shell && sprite2.myTank == sprite1) {
                return false;
            }
            return true;
        }
        KeyDown(e: KeyboardEvent) {
            switch (e.keyCode) {
                case KeyCodes.left:
                    this._player.direction = Enum.Direction.Left;
                    this._player.isActive = true;
                    break;
                case KeyCodes.up:
                    this._player.direction = Enum.Direction.Up;
                    this._player.isActive = true;
                    break;
                case KeyCodes.right:
                    this._player.direction = Enum.Direction.Right;
                    this._player.isActive = true;
                    break;
                case KeyCodes.down:
                    this._player.direction = Enum.Direction.Down;
                    this._player.isActive = true;
                    break;
            }
        }
        KeyUp(e) {
            this._player.isActive = false;
            switch (e.keyCode) {
                case KeyCodes.space:
                    this._player.Fire();
                    break;
            }
        }
    }
}