text:
<?xml version="1.0" encoding="utf-8"?>
<CrawlItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Text>dojam je da je ovdje i obična riza svaki put sve ukusnija</Text>
  <Rating>6</Rating>
  <Source>http://pauza.hr/menu/halo-maksimirski-zmaj</Source>
</CrawlItem>

redpajama_set_name: RedPajamaGithub


text:
package io.wcm.handler.media.impl;

import org.apache.sling.api.adapter.Adaptable;
import org.apache.sling.api.adapter.AdapterFactory;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

import io.wcm.handler.media.spi.MediaHandlerConfig;
import io.wcm.sling.commons.caservice.ContextAwareServiceResolver;

/**
 * Adapts resources or requests to {@link MediaHandlerConfig} via {@link ContextAwareServiceResolver}.
 */
@Component(service = AdapterFactory.class,
    property = {
        AdapterFactory.ADAPTABLE_CLASSES + "=org.apache.sling.api.resource.Resource",
        AdapterFactory.ADAPTABLE_CLASSES + "=org.apache.sling.api.SlingHttpServletRequest",
        AdapterFactory.ADAPTER_CLASSES + "=io.wcm.handler.media.spi.MediaHandlerConfig"
    })
public class MediaHandlerConfigAdapterFactory implements AdapterFactory {

  @Reference
  private ContextAwareServiceResolver serviceResolver;

  @SuppressWarnings({ "unchecked", "null" })
  @Override
  public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
    if (type == MediaHandlerConfig.class) {
      return (AdapterType)serviceResolver.resolve(MediaHandlerConfig.class, (Adaptable)adaptable);
    }
    return null;
  }

}


text:
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "province".
 *
 * @property integer $provinceId
 * @property string $name
 * @property string $code
 * @property string $remark
 */
class Province extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'province';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name'], 'string', 'max' => 50],
            [['code'], 'string', 'max' => 10],
            [['remark'], 'string', 'max' => 100]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'provinceId' => 'Province ID',
            'name' => 'Name',
            'code' => 'Code',
            'remark' => 'Remark',
        ];
    }

    /**
     * 查询所有省份,返回object
     * @return \common\models\Province[]
     */
    public static function findAllForObject(){
        $provinces = Province::find()->all();
        return $provinces;
    }

    /**
     * 查询所有省份,返回json
     * @return string||json
     */
    public static function findAllForJson(){
        $provinces = Province::find()
            ->select(['provinceId as value','name as text'])
            ->asArray()
            ->all();
        return json_encode($provinces);
    }
}


text:
package de.danoeh.antennapodsp.fragment;

import android.app.Activity;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.PopupMenu;
import android.util.Log;
import android.util.TypedValue;
import android.view.*;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.*;
import de.danoeh.antennapodsp.AppConfig;
import de.danoeh.antennapodsp.R;
import de.danoeh.antennapodsp.activity.MainActivity;
import de.danoeh.antennapodsp.asynctask.ImageLoader;
import de.danoeh.antennapodsp.feed.Chapter;
import de.danoeh.antennapodsp.service.playback.PlaybackService;
import de.danoeh.antennapodsp.util.ChapterUtils;
import de.danoeh.antennapodsp.util.Converter;
import de.danoeh.antennapodsp.util.ShownotesProvider;
import de.danoeh.antennapodsp.util.playback.Playable;
import de.danoeh.antennapodsp.util.playback.PlaybackController;
import org.apache.commons.lang3.StringEscapeUtils;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * Fragment which is supposed to be displayed outside of the MediaplayerActivity
 * if the PlaybackService is running
 */
public class ExternalPlayerFragment extends Fragment {
    private static final String TAG = "ExternalPlayerFragment";

    public static final String ARG_INITIAL_STATE = "argInitialState";
    public static final int ARG_INIT_EPXANDED = 1;
    public static final int ARG_INIT_ANCHORED = 0;

    public static enum FragmentState {EXPANDED, ANCHORED}

    // expanded layout components
    private LinearLayout topviewExpanded;
    private RelativeLayout layoutInfoExpanded;
    private ImageView imgvCoverExpanded;
    private TextView txtvTitleExpanded;
    private ImageButton butActionExpanded;
    private ImageButton butPlayExpanded;
    private ImageButton butRevExpanded;
    private ImageButton butFFExpanded;
    private ImageButton butShowChapters;
    private Button butSleep;
    private TextView txtvPositionExpanded;
    private TextView txtvLengthExpanded;
    private WebView webvDescription;
    private SeekBar sbPositionExanded;

    private PopupMenu chaptersMenu;

    // anchored layout components
    private LinearLayout topViewAnchored;
    private ImageView imgvCoverAnchored;
    private ViewGroup layoutInfoAnchored;
    private TextView txtvTitleAnchored;
    private ImageButton butPlayAnchored;

    private PlaybackController controller;

    private FragmentState fragmentState;

    public static ExternalPlayerFragment newInstance(int initialState) {
        if (initialState != ARG_INIT_ANCHORED && initialState != ARG_INIT_EPXANDED)
            throw new IllegalArgumentException("invalid initial state");

        Bundle b = new Bundle();
        b.putInt(ARG_INITIAL_STATE, initialState);
        ExternalPlayerFragment f = new ExternalPlayerFragment();
        f.setArguments(b);
        return f;
    }

    public void setFragmentState(FragmentState fs) {
        boolean stateChanged = fs != fragmentState;
        fragmentState = fs;
        if (topViewAnchored != null && topviewExpanded != null) {
            if (fs == FragmentState.ANCHORED) {
                topviewExpanded.setVisibility(View.GONE);
                topViewAnchored.setVisibility(View.VISIBLE);
            } else {
                topViewAnchored.setVisibility(View.GONE);
                topviewExpanded.setVisibility(View.VISIBLE);
            }
        }
        if (stateChanged && controller != null) {
            controller.repeatHandleStatus();
        }

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int state = getArguments().getInt(ARG_INITIAL_STATE);
        if (state == ARG_INIT_ANCHORED) {
            fragmentState = FragmentState.ANCHORED;
        } else if (state == ARG_INIT_EPXANDED) {
            fragmentState = FragmentState.EXPANDED;
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.external_player_fragment,
                container, false);
        // Expanded components
        topviewExpanded = (LinearLayout) root.findViewById(R.id.topviewExpanded);
        imgvCoverExpanded = (ImageView) root.findViewById(R.id.imgvCoverExpanded);
        txtvTitleExpanded = (TextView) root.findViewById(R.id.txtvTitleExpanded);
        butActionExpanded = (ImageButton) root.findViewById(R.id.butActionExpanded);
        butPlayExpanded = (ImageButton) root.findViewById(R.id.butPlayExpanded);
        butRevExpanded = (ImageButton) root.findViewById(R.id.butRevExpanded);
        butFFExpanded = (ImageButton) root.findViewById(R.id.butFFExpanded);
        butShowChapters = (ImageButton) root.findViewById(R.id.butShowChapters);
        butSleep = (Button) root.findViewById(R.id.butSleep);
        txtvPositionExpanded = (TextView) root.findViewById(R.id.txtvPositionExpanded);
        txtvLengthExpanded = (TextView) root.findViewById(R.id.txtvLengthExpanded);
        sbPositionExanded = (SeekBar) root.findViewById(R.id.sbPositionExpanded);
        webvDescription = (WebView) root.findViewById(R.id.webvDescription);
        layoutInfoExpanded = (RelativeLayout) root.findViewById(R.id.layoutInfo_expanded);

        chaptersMenu = new PopupMenu(container.getContext(), butShowChapters);

        // Anchored components
        topViewAnchored = (LinearLayout) root.findViewById(R.id.topviewAnchored);
        imgvCoverAnchored = (ImageView) root.findViewById(R.id.imgvCoverAnchored);
        layoutInfoAnchored = (ViewGroup) root.findViewById(R.id.layoutInfo_anchored);
        txtvTitleAnchored = (TextView) root.findViewById(R.id.txtvTitleAnchored);
        butPlayAnchored = (ImageButton) root.findViewById(R.id.butPlayAnchored);

        layoutInfoAnchored.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (AppConfig.DEBUG)
                    Log.d(TAG, "layoutInfo was clicked");

                if (controller.getMedia() != null) {
                    startActivity(PlaybackService.getPlayerActivityIntent(
                            getActivity(), controller.getMedia()));
                }
            }
        });

        butShowChapters.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                setupChaptersMenu();
                chaptersMenu.show();
            }
        });
        chaptersMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem menuItem) {
                if (controller == null) {
                    return true;
                }
                Playable p = controller.getMedia();
                if (p == null) {
                    return true;
                }
                List<Chapter> chs = p.getChapters();
                if (chs == null) {
                    return true;
                }
                final int id = menuItem.getItemId();
                if (id >= 0 && id < chs.size()) {
                    controller.seekToChapter(chs.get(id));
                }

                return true;
            }
        });

        ((MainActivity) getActivity()).onPlayerFragmentCreated(this, fragmentState);
        return root;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        controller = setupPlaybackController();
        butPlayExpanded.setOnClickListener(controller.newOnPlayButtonClickListener());
        butPlayAnchored.setOnClickListener(controller.newOnPlayButtonClickListener());

        sbPositionExanded.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            float prog = 0;

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                prog = controller.onSeekBarProgressChanged(seekBar, progress, fromUser, txtvPositionExpanded);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                controller.onSeekBarStartTrackingTouch(seekBar);
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                controller.onSeekBarStopTrackingTouch(seekBar, prog);
                prog = 0;
            }
        });

        butRevExpanded.setOnClickListener(controller.newOnRevButtonClickListener());
        butFFExpanded.setOnClickListener(controller.newOnFFButtonClickListener());
        butSleep.setOnClickListener(controller.newOnSleepButtonClickListener());

        butActionExpanded.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Playable media;
                if (controller != null && (media = controller.getMedia()) != null && media.getWebsiteLink() != null) {
                    Uri uri = Uri.parse(media.getWebsiteLink());
                    startActivity(new Intent(Intent.ACTION_VIEW, uri));
                }
            }
        });

        setFragmentState(fragmentState);
    }

    public void setButSleepText(String text) {
        butSleep.setText(text);
    }

    private void updateTimeDisplay() {
        int duration = controller.getDuration();
        int position = controller.getPosition();
        if (duration != PlaybackController.INVALID_TIME
                && position != PlaybackController.INVALID_TIME) {
            txtvPositionExpanded.setText(Converter.getDurationStringLong(position));
            txtvLengthExpanded.setText(Converter.getDurationStringLong(duration));
            setProgressBarProgress(position, duration);

        }
        if (controller.sleepTimerActive()) {
            int sleepLeft = (int) controller.getSleepTimerTimeLeft();
            butSleep.setText(Converter.getDurationStringLong(sleepLeft));
        } else {
            butSleep.setText("");
        }
    }

    private PlaybackController setupPlaybackController() {
        return new PlaybackController(getActivity(), true) {

            @Override
            public void setupGUI() {
            }

            @Override
            public void onPositionObserverUpdate() {
                updateTimeDisplay();
            }

            @Override
            public void onReloadNotification(int code) {
            }

            @Override
            public void onBufferStart() {
                // TODO Auto-generated method stub

            }

            @Override
            public void onBufferEnd() {
                // TODO Auto-generated method stub

            }

            @Override
            public void onBufferUpdate(float progress) {
            }

            @Override
            public void onSleepTimerUpdate() {
            }

            @Override
            public void handleError(int code) {
            }

            @Override
            public ImageButton getPlayButton() {
                if (fragmentState == FragmentState.EXPANDED)
                    return butPlayExpanded;
                else
                    return butPlayAnchored;

            }

            @Override
            public void postStatusMsg(int msg) {
            }

            @Override
            public void clearStatusMsg() {
            }

            @Override
            public boolean loadMediaInfo() {
                ExternalPlayerFragment fragment = ExternalPlayerFragment.this;
                if (fragment != null) {
                    return fragment.loadMediaInfo();
                } else {
                    return false;
                }
            }

            @Override
            public void onAwaitingVideoSurface() {
            }

            @Override
            public void onServiceQueried() {
            }

            @Override
            public void onShutdownNotification() {
                ((MainActivity) getActivity()).resetPlayer();
                setFragmentState(FragmentState.ANCHORED);
                resetLayout();
            }

            @Override
            public void onPlaybackEnd() {
                ((MainActivity) getActivity()).resetPlayer();
                setFragmentState(FragmentState.ANCHORED);
                resetLayout();
            }

            @Override
            public void onPlaybackSpeedChange() {
                // TODO Auto-generated method stub

            }
        };
    }

    @Override
    public void onResume() {
        super.onResume();
        controller.init();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (AppConfig.DEBUG)
            Log.d(TAG, "Fragment is about to be destroyed");
        if (controller != null) {
            controller.release();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (controller != null) {
            controller.pause();
        }
    }

    private boolean loadMediaInfo() {
        if (AppConfig.DEBUG)
            Log.d(TAG, "Loading media info");
        if (controller.serviceAvailable()) {
            Playable media = controller.getMedia();
            if (media != null) {
                txtvTitleExpanded.setText(media.getEpisodeTitle());
                txtvTitleAnchored.setText(media.getEpisodeTitle());
                ImageLoader.getInstance().loadThumbnailBitmap(
                        media,
                        imgvCoverExpanded,
                        (int) getActivity().getResources().getDimension(
                                R.dimen.external_player_height)
                );
                ImageLoader.getInstance().loadThumbnailBitmap(
                        media,
                        imgvCoverAnchored,
                        (int) getActivity().getResources().getDimension(
                                R.dimen.external_player_height)
                );

                txtvPositionExpanded.setText(Converter.getDurationStringLong(media.getPosition()));
                txtvLengthExpanded.setText(Converter.getDurationStringLong(media.getDuration()));
                if (controller.sleepTimerActive()) {
                    butSleep.setText(Converter.getDurationStringLong((int) controller.getSleepTimerTimeLeft()));
                } else {
                    butSleep.setText("");
                }
                loadDescriptionWebview(media);

                if (media.getWebsiteLink() == null) {
                    butActionExpanded.setVisibility(View.INVISIBLE);
                } else {
                    butActionExpanded.setVisibility(View.VISIBLE);
                }
                setProgressBarProgress(media.getPosition(), media.getDuration());

                if (media.getChapters() != null) {
                    butShowChapters.setVisibility(View.VISIBLE);
                    setupChaptersMenu();
                } else {
                    butShowChapters.setVisibility(View.INVISIBLE);
                }
                /*
                if (controller.isPlayingVideo()) {
                    butPlay.setVisibility(View.GONE);
                } else {
                    butPlay.setVisibility(View.VISIBLE);
                }
                */
                ((MainActivity) getActivity()).openPlayer(fragmentState);
                return true;
            } else {
                Log.w(TAG,
                        "loadMediaInfo was called while the media object of playbackService was null!");
                return false;
            }
        } else {
            Log.w(TAG,
                    "loadMediaInfo was called while playbackService was null!");
            return false;
        }
    }

    public View getExpandView() {
        return layoutInfoAnchored;
    }

    public View getCollapseView() {
        return layoutInfoExpanded;
    }

    private void setProgressBarProgress(int position, int duration) {
        float progress = ((float) position) / duration;
        sbPositionExanded.setProgress((int) (progress * sbPositionExanded.getMax()));
    }

    private void resetLayout() {
        imgvCoverExpanded.setImageBitmap(null);
        imgvCoverAnchored.setImageBitmap(null);
        txtvTitleExpanded.setText(getString(R.string.no_media_playing_label));
        txtvTitleAnchored.setText(getString(R.string.no_media_playing_label));
        txtvPositionExpanded.setText("");
        txtvLengthExpanded.setText("");
        butSleep.setText("");
        webvDescription.clearView();
    }

    /**
     * Creates the content of the chapter menu.
     *
     * @return true if a menu was created, false otherwise
     */
    private boolean setupChaptersMenu() {
        if (chaptersMenu == null || controller == null) {
            Log.e(TAG, "setupChaptersMenu was called while chaptersMenu or controller was null");
            return false;
        }
        chaptersMenu.getMenu().clear();
        Playable p = controller.getMedia();

        if (p == null || p.getChapters() == null) {
            return false;
        }

        Menu menu = chaptersMenu.getMenu();
        final String currentChapterPrefix = "\u25B6 ";
        final Chapter currentChapter = ChapterUtils.getCurrentChapter(p);
        for (int i = 0; i < p.getChapters().size(); i++) {
            Chapter ch = p.getChapters().get(i);
            String menuText = ((ch == currentChapter) ? currentChapterPrefix : "") + ch.getTitle();
            menu.add(Menu.NONE, i, Menu.NONE, menuText);
        }
        return true;
    }

    private void loadDescriptionWebview(final ShownotesProvider shownotesProvider) {
        AsyncTask<Void, Void, Void> loadTask = new AsyncTask<Void, Void, Void>() {
            String data;

            private String applyWebviewStyle(String textColor, String data) {
                final String WEBVIEW_STYLE = "%s";
                final int pageMargin = (int) TypedValue.applyDimension(
                        TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
                                .getDisplayMetrics()
                );
                return String.format(WEBVIEW_STYLE, textColor, "100%", pageMargin,
                        pageMargin, pageMargin, pageMargin, data);
            }

            @Override
            protected void onPostExecute(Void result) {
                super.onPostExecute(result);
                // /webvDescription.loadData(url, "text/html", "utf-8");
                if (ExternalPlayerFragment.this.isAdded() && webvDescription != null) {
                    webvDescription.loadDataWithBaseURL(null, data, "text/html",
                            "utf-8", "about:blank");
                    if (getActivity() != null) {
                        ((ActionBarActivity) getActivity())
                                .setSupportProgressBarIndeterminateVisibility(false);
                    }
                    if (AppConfig.DEBUG)
                        Log.d(TAG, "Webview loaded");
                }
            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                if (getActivity() != null) {
                    ((ActionBarActivity) getActivity())
                            .setSupportProgressBarIndeterminateVisibility(false);
                }
            }

            @Override
            protected Void doInBackground(Void... params) {
                if (AppConfig.DEBUG)
                    Log.d(TAG, "Loading Webview");
                try {
                    Callable<String> shownotesLoadTask = shownotesProvider.loadShownotes();
                    final String shownotes = shownotesLoadTask.call();

                    data = StringEscapeUtils.unescapeHtml4(shownotes);
                    Activity activity = getActivity();
                    if (activity != null) {
                        TypedArray res = activity
                                .getTheme()
                                .obtainStyledAttributes(
                                        new int[]{android.R.attr.textColorPrimary});
                        int colorResource = res.getColor(0, 0);
                        String colorString = String.format("#%06X",
                                0xFFFFFF & colorResource);
                        Log.i(TAG, "text color: " + colorString);
                        res.recycle();
                        data = applyWebviewStyle(colorString, data);
                    } else {
                        cancel(true);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }

        };
        if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
            loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        } else {
            loadTask.execute();
        }
    }
}


text:
{{'title' | translate}}

{{'youreventsadded' | translate}}

{{'addmore' | translate}}

                    <button type="button" class="btn btn-default" ng-click="successState.restart()">Zum Anfang</button>
                    Kalendar öffnen

                                Kalenderfreigaben von {{successState.selectedCalendar.summary}}

                                    {{'calRole.' + item.role | translate}}

                                    {{'acl.emptylist' | translate}}

                                            <input class="form-control" type="text" name="aclUsr" id="aclUsr" ng-model="successState.aclUsr" placeholder="{{'aclAddUserPlaceholder' | translate}}" />

                                                <button type="button" class="btn btn-default" ng-click="successState.addAcl()">{{'addacl' | translate}}</button>

                        Fehler: {{successState.failureText}}

                        Die Berechtigungen wurden aktualisiert.


text:
cask 'imo' do
  version :latest
  sha256 :no_check

  url 'https://imo.im/macosapp/current/Imo.dmg'
  name 'Imo Messanger'
  homepage 'https://imo.im/'

  app 'Imo.app'
end


text:
const hFlex = require("../reaks/hFlex")
const displayIf = require("../reaks/displayIf")
const value = require("../core/value")
const ctxAssign = require("../core/assign")
const withResponsiveSize = require("./withResponsiveSize")

module.exports = ({ master, detail, breakWidth }) => {
  return withResponsiveSize(
    breakWidth,
    hFlex([
      [
        {
          weight: ctx => () =>
            ctx.activeItem()
              ? ctx.responsiveSize() === "narrow" ? 0 : null
              : 1,
        },
        ctxAssign({ open: ctx => itemId => ctx.activeItem(itemId) }, master),
      ],
      [
        { weight: ctx => () => (ctx.activeItem() ? 1 : 0) },
        displayIf(
          ctx => ctx.activeItem,
          value(
            ctx => ctx.activeItem,
            ctxAssign({ close: ctx => () => ctx.activeItem(null) }, detail)
          )
        ),
      ],
    ])
  )
}


text:
from git.repo import Repo
from gitdb.exc import BadObject
from kenja.detection.extract_method import detect_extract_method
from kenja.detection.extract_method import detect_extract_method_from_commit
import argparse
import csv
import sys
import json

class RefactoringDetectionCommandParser:
    def __init__(self):
        self.parser = argparse.ArgumentParser(description='Kenja a refactoring detection tool')
        self.parser.add_argument('--format', help='output format', default='csv')
        self.subparsers = self.parser.add_subparsers()

        self.add_all_command()
        self.add_commits_command()

    def parse_and_execute_command(self):
        args = self.parser.parse_args()
        args.func(args)

    def add_all_command(self):
        help_str = 'detect refactoring from all commits in the Historage'
        subparser = self.subparsers.add_parser('all', help=help_str)

        help_str = 'path of Historage dir'
        subparser.add_argument('historage_dir', help=help_str)

        subparser.set_defaults(func=self.detect_all)

    def detect_all(self, args):
        historage = Repo(args.historage_dir)
        extract_method_candidates = detect_extract_method(historage)
        self.print_candidates(extract_method_candidates, args.format)

    def print_candidates(self, candidates, format):
        if format == 'csv':
            self.print_csv(candidates)
        elif format == 'umldiff':
            self.print_umldiff(candidates)
        elif format == 'json':
            self.print_json(candidates)

    def print_csv(self, candidates):
        fieldnames = ('a_commit',
                      'b_commit',
                      'b_org_commit',
                      'a_package',
                      'target_class',
                      'target_method',
                      'b_package',
                      'extracted_method',
                      'similarity',
                      'extracted_body',
                      'target_before_body',
                      'target_after_body',
                      'target_deleted_lines',
                      'target_method_path',
                      'extracted_method_path'
                      )
        for candidate in candidates:
            candidate['target_deleted_lines'] = '\n'.join(candidate['target_deleted_lines'])

        writer = csv.DictWriter(sys.stdout, fieldnames)
        writer.writeheader()
        writer.writerows(candidates)

    def print_umldiff(self, candidates):
        candidate_revisions = set()
        writer = csv.writer(sys.stdout)
        for candidate in candidates:
            candidate_revisions.add(candidate['b_commit'])
            writer.writerow(self.format_for_umldiff(candidate, 'jedit'))

        print 'candidates:', len(candidates)
        print 'candidate revisions:', len(candidate_revisions)

    def print_json(self, candidates):
        print json.dumps(candidates, encoding='utf_8', indent=4)

    def format_for_umldiff(self, extract_method_information, package_prefix=None):
        target_method_path = extract_method_information['target_method_path']
        extracted_method_path = extract_method_information['extracted_method_path']
        target_method = self.get_method_full_name(package_prefix,
                                                  extract_method_information['a_package'],
                                                  target_method_path
                                                  )
        extracted_method = self.get_method_full_name(package_prefix,
                                                     extract_method_information['b_package'],
                                                     extracted_method_path
                                                     )

        split_path = target_method_path.split('/')
        target_method_is_inner = split_path.count('[CN]') > 1
        target_method_is_constructor = '[CS]' in split_path

        split_path = extracted_method_path.split('/')
        extracted_method_is_inner = split_path.count('[CN]') > 1
        extracted_method_is_constructor = '[CS]' in split_path

        a_commit = extract_method_information['a_commit']
        b_commit = extract_method_information['b_commit']
        org_commit = extract_method_information['b_org_commit']
        sim = extract_method_information['similarity']
        return [a_commit, b_commit, org_commit,
                target_method, target_method_is_inner, target_method_is_constructor,
                extracted_method, extracted_method_is_inner, extracted_method_is_constructor,
                sim]

    def get_method_full_name(self, prefix, package, path_of_method):
        info = [prefix, package]

        split_path = path_of_method.split('/')

        target_path = ['[CN]', '[MT]', '[CS]']
        for i, p in enumerate(split_path):
            if p in target_path:
                info.append(split_path[i+1])

        return '.'.join([s for s in info if s is not None])

    def join_method_name(self, prefix, package, class_name, method):
        info = [prefix, package, class_name, method]
        return '.'.join([s for s in info if s is not None])

    def add_commits_command(self):
        help_str = 'detect refactoring from commits in the csv'
        subparser = self.subparsers.add_parser('commits', help=help_str)

        help_str = 'path of Historage dir'
        subparser.add_argument('historage_dir', help=help_str)

        help_str = 'comma separated commits list. please write a_commit hash and b_commit hash per line'
        subparser.add_argument('commits_list', help=help_str)

        subparser.set_defaults(func=self.detect_from_commits_list)

    def detect_from_commits_list(self, args):
        historage = Repo(args.historage_dir)
        extract_method_information = []
        try:
            for a_commit_hash, b_commit_hash in csv.reader(open(args.commits_list)):
                a_commit = historage.commit(a_commit_hash)
                b_commit = historage.commit(b_commit_hash)
                extract_method_information.extend(detect_extract_method_from_commit(a_commit, b_commit))
        except ValueError:
            print "Invalid input."
            return
        except BadObject, name:
            print "Invalid hash of the commit:", name.message

        self.print_candidates(extract_method_information, args.format)

def main():
    parser = RefactoringDetectionCommandParser()
    parser.parse_and_execute_command()

if __name__ == '__main__':
    main()


text:
define(['modules/shared/PaginationLoader'], function (PaginationLoader) {
    'use strict';
    return ['$scope', 'Restangular', '$state', 'shared.services.create-or-update-modal', function($scope, Restangular, $state, createOrUpdateModalService) {
        var paginationLoader = new PaginationLoader(Restangular.all('employees'), 'employees', 'lastName', $scope, 10);

        $scope.setPage = function() {
            paginationLoader.loadPage($scope.employees.page.number);
        };

        //initially load all employees
        paginationLoader.loadPage();

        $scope.addNew = function() {
            var $modalInstance = createOrUpdateModalService
                .showModal('trackr.administration.employees.newController as ctrl',
                'src/modules/trackr/administration/employees/newOrEdit.tpl.html',
                'EMPLOYEE.CREATE_NEW'
            );

            $modalInstance.result.then(function(employee) {
                paginationLoader.loadPage();
                $state.go('app.trackr.administration.employees.edit', {id: employee.id});
            });
        };
    }];
});


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/events/firebase/analytics/v1/data.proto

namespace Google\Events\Firebase\Analytics\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * User's geographic informaiton.
 *
 * Generated from protobuf message google.events.firebase.analytics.v1.GeoInfo
 */
class GeoInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The geographic continent.
     * Eg. Americas
     *
     * Generated from protobuf field string continent = 1;
     */
    protected $continent = '';
    /**
     * The geographic country.
     * Eg. Brazil
     *
     * Generated from protobuf field string country = 2;
     */
    protected $country = '';
    /**
     * The geographic region.
     * Eg. State of Sao Paulo
     *
     * Generated from protobuf field string region = 3;
     */
    protected $region = '';
    /**
     * The geographic city.
     * Eg. Sao Paulo
     *
     * Generated from protobuf field string city = 4;
     */
    protected $city = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $continent
     *           The geographic continent.
     *           Eg. Americas
     *     @type string $country
     *           The geographic country.
     *           Eg. Brazil
     *     @type string $region
     *           The geographic region.
     *           Eg. State of Sao Paulo
     *     @type string $city
     *           The geographic city.
     *           Eg. Sao Paulo
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Events\Firebase\Analytics\V1\Data::initOnce();
        parent::__construct($data);
    }

    /**
     * The geographic continent.
     * Eg. Americas
     *
     * Generated from protobuf field string continent = 1;
     * @return string
     */
    public function getContinent()
    {
        return $this->continent;
    }

    /**
     * The geographic continent.
     * Eg. Americas
     *
     * Generated from protobuf field string continent = 1;
     * @param string $var
     * @return $this
     */
    public function setContinent($var)
    {
        GPBUtil::checkString($var, True);
        $this->continent = $var;

        return $this;
    }

    /**
     * The geographic country.
     * Eg. Brazil
     *
     * Generated from protobuf field string country = 2;
     * @return string
     */
    public function getCountry()
    {
        return $this->country;
    }

    /**
     * The geographic country.
     * Eg. Brazil
     *
     * Generated from protobuf field string country = 2;
     * @param string $var
     * @return $this
     */
    public function setCountry($var)
    {
        GPBUtil::checkString($var, True);
        $this->country = $var;

        return $this;
    }

    /**
     * The geographic region.
     * Eg. State of Sao Paulo
     *
     * Generated from protobuf field string region = 3;
     * @return string
     */
    public function getRegion()
    {
        return $this->region;
    }

    /**
     * The geographic region.
     * Eg. State of Sao Paulo
     *
     * Generated from protobuf field string region = 3;
     * @param string $var
     * @return $this
     */
    public function setRegion($var)
    {
        GPBUtil::checkString($var, True);
        $this->region = $var;

        return $this;
    }

    /**
     * The geographic city.
     * Eg. Sao Paulo
     *
     * Generated from protobuf field string city = 4;
     * @return string
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * The geographic city.
     * Eg. Sao Paulo
     *
     * Generated from protobuf field string city = 4;
     * @param string $var
     * @return $this
     */
    public function setCity($var)
    {
        GPBUtil::checkString($var, True);
        $this->city = $var;

        return $this;
    }

}


text:
package org.apache.cassandra.db.filter;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.function.Consumer;

import com.google.common.base.Throwables;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.ColumnDefinition;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.ColumnIdentifier;
import org.apache.cassandra.db.PartitionColumns;
import org.apache.cassandra.db.marshal.Int32Type;
import org.apache.cassandra.db.marshal.SetType;
import org.apache.cassandra.db.rows.CellPath;
import org.apache.cassandra.dht.Murmur3Partitioner;
import org.apache.cassandra.gms.Gossiper;
import org.apache.cassandra.io.util.DataInputBuffer;
import org.apache.cassandra.io.util.DataInputPlus;
import org.apache.cassandra.io.util.DataOutputBuffer;
import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.utils.ByteBufferUtil;

import static org.junit.Assert.assertEquals;

@RunWith(Parameterized.class)
public class ColumnFilterTest
{
    private static final ColumnFilter.Serializer serializer = new ColumnFilter.Serializer();

    private final CFMetaData metadata = CFMetaData.Builder.create("ks", "table")
                                                          .withPartitioner(Murmur3Partitioner.instance)
                                                          .addPartitionKey("pk", Int32Type.instance)
                                                          .addClusteringColumn("ck", Int32Type.instance)
                                                          .addStaticColumn("s1", Int32Type.instance)
                                                          .addStaticColumn("s2", SetType.getInstance(Int32Type.instance, true))
                                                          .addRegularColumn("v1", Int32Type.instance)
                                                          .addRegularColumn("v2", SetType.getInstance(Int32Type.instance, true))
                                                          .addRegularColumn(ColumnIdentifier.getInterned("Escaped Name", true), Int32Type.instance)
                                                          .build();

    private final ColumnDefinition s1 = metadata.getColumnDefinition(ByteBufferUtil.bytes("s1"));
    private final ColumnDefinition s2 = metadata.getColumnDefinition(ByteBufferUtil.bytes("s2"));
    private final ColumnDefinition v1 = metadata.getColumnDefinition(ByteBufferUtil.bytes("v1"));
    private final ColumnDefinition v2 = metadata.getColumnDefinition(ByteBufferUtil.bytes("v2"));
    private final ColumnDefinition escaped = metadata.getColumnDefinition(ByteBufferUtil.bytes("Escaped Name"));
    private final CellPath path0 = CellPath.create(ByteBufferUtil.bytes(0));
    private final CellPath path1 = CellPath.create(ByteBufferUtil.bytes(1));
    private final CellPath path2 = CellPath.create(ByteBufferUtil.bytes(2));
    private final CellPath path3 = CellPath.create(ByteBufferUtil.bytes(3));
    private final CellPath path4 = CellPath.create(ByteBufferUtil.bytes(4));

    @Parameterized.Parameter
    public boolean anyNodeOn30;

    @Parameterized.Parameters(name = "{index}: anyNodeOn30={0}")
    public static Collection<Object[]> data()
    {
        return Arrays.asList(new Object[]{ true }, new Object[]{ false });
    }

    @BeforeClass
    public static void beforeClass()
    {
        DatabaseDescriptor.clientInitialization();
    }

    @Before
    public void before()
    {
        Gossiper.instance.setAnyNodeOn30(anyNodeOn30);
    }

    // Select all

    @Test
    public void testSelectAll()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("*/*", filter.toString());
            assertEquals("*", filter.toCQLString());
            assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
            assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.all(metadata));
        check.accept(ColumnFilter.allColumnsBuilder(metadata).build());
    }

    // Selections

    @Test
    public void testSelectNothing()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[]", filter.toString());
            assertEquals("*", filter.toCQLString());
            assertFetchedQueried(false, false, filter, v1, v2, s1, s2);
            assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.NONE));
        check.accept(ColumnFilter.selectionBuilder().build());
    }

    @Test
    public void testSelectSimpleColumn()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[v1]", filter.toString());
            assertEquals("v1", filter.toCQLString());
            assertFetchedQueried(true, true, filter, v1);
            assertFetchedQueried(false, false, filter, v2, s1, s2);
            assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v1).build()));
        check.accept(ColumnFilter.selectionBuilder().add(v1).build());
    }

    @Test
    public void testSelectEscapedColumn()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[Escaped Name]", filter.toString());
            assertEquals("\"Escaped Name\"", filter.toCQLString());
            assertFetchedQueried(true, true, filter, escaped);
            assertFetchedQueried(false, false, filter, v2, s1, s2);
            assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(escaped).build()));
        check.accept(ColumnFilter.selectionBuilder().add(escaped).build());
    }

    @Test
    public void testSelectComplexColumn()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[v2]", filter.toString());
            assertEquals("v2", filter.toCQLString());
            assertFetchedQueried(true, true, filter, v2);
            assertFetchedQueried(false, false, filter, v1, s1, s2);
            assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v2).build()));
        check.accept(ColumnFilter.selectionBuilder().add(v2).build());
    }

    @Test
    public void testSelectStaticColumn()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[s1]", filter.toString());
            assertEquals("s1", filter.toCQLString());
            assertFetchedQueried(true, true, filter, s1);
            assertFetchedQueried(false, false, filter, v1, v2, s2);
            assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(s1).build()));
        check.accept(ColumnFilter.selectionBuilder().add(s1).build());
    }

    @Test
    public void testSelectStaticComplexColumn()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[s2]", filter.toString());
            assertEquals("s2", filter.toCQLString());
            assertFetchedQueried(true, true, filter, s2);
            assertFetchedQueried(false, false, filter, v1, v2, s1);
            assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(s2).build()));
        check.accept(ColumnFilter.selectionBuilder().add(s2).build());
    }

    @Test
    public void testSelectColumns()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertEquals("[s1, s2, v1, v2]", filter.toString());
            assertEquals("s1, s2, v1, v2", filter.toCQLString());
            assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
            assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
        };

        check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v1).add(v2).add(s1).add(s2).build()));
        check.accept(ColumnFilter.selectionBuilder().add(v1).add(v2).add(s1).add(s2).build());
    }

    @Test
    public void testSelectIndividualCells()
    {
        ColumnFilter filter = ColumnFilter.selectionBuilder().select(v2, path1).select(v2, path3).build();
        testRoundTrips(filter);
        assertEquals("[v2[1], v2[3]]", filter.toString());
        assertEquals("v2[1], v2[3]", filter.toCQLString());
        assertFetchedQueried(true, true, filter, v2);
        assertFetchedQueried(false, false, filter, v1, s1, s2);
        assertCellFetchedQueried(true, true, filter, v2, path1, path3);
        assertCellFetchedQueried(false, false, filter, v2, path0, path2, path4);
        assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
    }

    @Test
    public void testSelectIndividualCellsFromStatic()
    {
        ColumnFilter filter = ColumnFilter.selectionBuilder().select(s2, path1).select(s2, path3).build();
        testRoundTrips(filter);
        assertEquals("[s2[1], s2[3]]", filter.toString());
        assertEquals("s2[1], s2[3]", filter.toCQLString());
        assertFetchedQueried(true, true, filter, s2);
        assertFetchedQueried(false, false, filter, v1, v2, s1);
        assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
        assertCellFetchedQueried(true, true, filter, s2, path1, path3);
        assertCellFetchedQueried(false, false, filter, s2, path0, path2, path4);
    }

    @Test
    public void testSelectCellSlice()
    {
        ColumnFilter filter = ColumnFilter.selectionBuilder().slice(v2, path1, path3).build();
        testRoundTrips(filter);
        assertEquals("[v2[1:3]]", filter.toString());
        assertEquals("v2[1:3]", filter.toCQLString());
        assertFetchedQueried(true, true, filter, v2);
        assertFetchedQueried(false, false, filter, v1, s1, s2);
        assertCellFetchedQueried(true, true, filter, v2, path1, path2, path3);
        assertCellFetchedQueried(false, false, filter, v2, path0, path4);
        assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
    }

    @Test
    public void testSelectCellSliceFromStatic()
    {
        ColumnFilter filter = ColumnFilter.selectionBuilder().slice(s2, path1, path3).build();
        testRoundTrips(filter);
        assertEquals("[s2[1:3]]", filter.toString());
        assertEquals("s2[1:3]", filter.toCQLString());
        assertFetchedQueried(true, true, filter, s2);
        assertFetchedQueried(false, false, filter, v1, v2, s1);
        assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4);
        assertCellFetchedQueried(true, true, filter, s2, path1, path2, path3);
        assertCellFetchedQueried(false, false, filter, s2, path0, path4);
    }

    @Test
    public void testSelectColumnsWithCellsAndSlices()
    {
        ColumnFilter filter = ColumnFilter.selectionBuilder()
                                          .add(v1)
                                          .add(s1)
                                          .slice(v2, path0, path2)
                                          .select(v2, path4)
                                          .select(s2, path0)
                                          .slice(s2, path2, path4)
                                          .build();
        testRoundTrips(filter);
        assertEquals("[s1, s2[0], s2[2:4], v1, v2[0:2], v2[4]]", filter.toString());
        assertEquals("s1, s2[0], s2[2:4], v1, v2[0:2], v2[4]", filter.toCQLString());
        assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
        assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path4);
        assertCellFetchedQueried(false, false, filter, v2, path3);
        assertCellFetchedQueried(true, true, filter, s2, path0, path2, path3, path4);
        assertCellFetchedQueried(false, false, filter, s2, path1);
    }

    // select with metadata

    @Test
    public void testSelectSimpleColumnWithMetadata()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertFetchedQueried(true, true, filter, v1);
            if (anyNodeOn30)
            {
                assertEquals("*/*", filter.toString());
                assertEquals("*", filter.toCQLString());
                assertFetchedQueried(true, true, filter, s1, s2, v2);
                assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
                assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
            }
            else
            {
                assertEquals("*/[v1]", filter.toString());
                assertEquals("v1", filter.toCQLString());
                assertFetchedQueried(true, false, filter, s1, s2, v2);
                assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4);
                assertCellFetchedQueried(true, false, filter, s2, path0, path1, path2, path3, path4);
            }
        };

        check.accept(ColumnFilter.selection(metadata, PartitionColumns.builder().add(v1).build()));
        check.accept(ColumnFilter.allColumnsBuilder(metadata).add(v1).build());
    }

    @Test
    public void testSelectStaticColumnWithMetadata()
    {
        Consumer<ColumnFilter> check = filter -> {
            testRoundTrips(filter);
            assertFetchedQueried(true, true, filter, s1);
            if (anyNodeOn30)
            {
                assertEquals("*/*", filter.toString());
                assertEquals("*", filter.toCQLString());
                assertFetchedQueried(true, true, filter, v1, v2, s2);
                assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
                assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
            }
            else
            {
                assertEquals("*/[s1]", filter.toString());
                assertEquals("s1", filter.toCQLString());
                assertFetchedQueried(true, false, filter, v1, v2, s2);
                assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4);
                assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4);
            }
        };

        check.accept(ColumnFilter.selection(metadata, PartitionColumns.builder().add(s1).build()));
        check.accept(ColumnFilter.allColumnsBuilder(metadata).add(s1).build());
    }

    @Test
    public void testSelectCellWithMetadata()
    {
        ColumnFilter filter = ColumnFilter.allColumnsBuilder(metadata).select(v2, path1).build();
        testRoundTrips(filter);
        assertFetchedQueried(true, true, filter, v2);
        if (anyNodeOn30)
        {
            assertEquals("*/*", filter.toString());
            assertEquals("*", filter.toCQLString());
            assertFetchedQueried(true, true, filter, s1, s2, v1);
            assertCellFetchedQueried(true, true, filter, v2, path1);
            assertCellFetchedQueried(true, false, filter, v2, path0, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4);
        }
        else
        {
            assertEquals("*/[v2[1]]", filter.toString());
            assertEquals("v2[1]", filter.toCQLString());
            assertFetchedQueried(true, false, filter, s1, s2, v1);
            assertCellFetchedQueried(true, true, filter, v2, path1);
            assertCellFetchedQueried(true, false, filter, v2, path0, path2, path3, path4);
            assertCellFetchedQueried(true, false, filter, s2, path0, path1, path2, path3, path4);
        }
    }

    @Test
    public void testSelectStaticColumnCellWithMetadata()
    {
        ColumnFilter filter = ColumnFilter.allColumnsBuilder(metadata).select(s2, path1).build();
        testRoundTrips(filter);
        assertFetchedQueried(true, true, filter, s2);
        if (anyNodeOn30)
        {
            assertEquals("*/*", filter.toString());
            assertEquals("*", filter.toCQLString());
            assertFetchedQueried(true, true, filter, v1, v2, s1);
            assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path1);
            assertCellFetchedQueried(true, false, filter, s2, path0, path2, path3, path4);
        }
        else
        {
            assertEquals("*/[s2[1]]", filter.toString());
            assertEquals("s2[1]", filter.toCQLString());
            assertFetchedQueried(true, false, filter, v1, v2, s1);
            assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4);
            assertCellFetchedQueried(true, true, filter, s2, path1);
            assertCellFetchedQueried(true, false, filter, s2, path0, path2, path3, path4);
        }
    }

    private void testRoundTrips(ColumnFilter cf)
    {
        testRoundTrip(cf, MessagingService.VERSION_30);
        testRoundTrip(cf, MessagingService.VERSION_3014);
    }

    private void testRoundTrip(ColumnFilter columnFilter, int version)
    {
        try
        {
            DataOutputBuffer output = new DataOutputBuffer();
            serializer.serialize(columnFilter, output, version);
            Assert.assertEquals(serializer.serializedSize(columnFilter, version), output.position());
            DataInputPlus input = new DataInputBuffer(output.buffer(), false);
            ColumnFilter deserialized = serializer.deserialize(input, version, metadata);
            Assert.assertEquals(deserialized, columnFilter);
        }
        catch (IOException e)
        {
            throw Throwables.propagate(e);
        }
    }

    private static void assertFetchedQueried(boolean expectedFetched,
                                             boolean expectedQueried,
                                             ColumnFilter filter,
                                             ColumnDefinition... columns)
    {
        for (ColumnDefinition column : columns)
        {
            assertEquals(String.format("Expected fetches(%s) to be %s", column.name, expectedFetched),
                         expectedFetched, filter.fetches(column));
            if (expectedFetched)
                assertEquals(String.format("Expected fetchedColumnIsQueried(%s) to be %s", column.name, expectedQueried),
                             expectedQueried, filter.fetchedColumnIsQueried(column));
        }
    }

    private static void assertCellFetchedQueried(boolean expectedFetched,
                                                 boolean expectedQueried,
                                                 ColumnFilter filter,
                                                 ColumnDefinition column,
                                                 CellPath... paths)
    {
        ColumnFilter.Tester tester = filter.newTester(column);

        for (CellPath path : paths)
        {
            int p = ByteBufferUtil.toInt(path.get(0));
            if (expectedFetched)
                assertEquals(String.format("Expected fetchedCellIsQueried(%s:%s) to be %s", column.name, p, expectedQueried),
                             expectedQueried, filter.fetchedCellIsQueried(column, path));

            if (tester != null)
            {
                assertEquals(String.format("Expected tester.fetches(%s:%s) to be %s", column.name, p, expectedFetched),
                             expectedFetched, tester.fetches(path));
                if (expectedFetched)
                    assertEquals(String.format("Expected tester.fetchedCellIsQueried(%s:%s) to be %s", column.name, p, expectedQueried),
                                 expectedQueried, tester.fetchedCellIsQueried(path));
            }
        }
    }
}


text:
require('user.options')
require('user.keymap')

-- TODO: Enable spellcheck on Markdown files


text:
package com.opencredo.concursus.domain.events.indexing;

import com.opencredo.concursus.domain.common.AggregateId;
import com.opencredo.concursus.domain.time.StreamTimestamp;

import java.util.Set;
import java.util.stream.Collectors;

/**
 * An in-memory event index that indexes aggregate ids by most recently-observed event property values.
 */
public final class InMemoryEventIndex implements EventIndexer, EventIndex {

    /**
     * Create a new in-memory event index.
     * @return The constructed {@link InMemoryEventIndex}.
     */
    public static InMemoryEventIndex create() {
        return new InMemoryEventIndex(InMemoryTimestampedTable.create());
    }

    private InMemoryEventIndex(InMemoryTimestampedTable<AggregateIdParameterName, ParameterNameAndValue, StreamTimestamp> valueTable) {
        this.valueTable = valueTable;
    }

    private final InMemoryTimestampedTable<AggregateIdParameterName, ParameterNameAndValue, StreamTimestamp> valueTable;

    @Override
    public Set<AggregateId> findAggregates(String parameterName, Object parameterValue) {
        return valueTable.getIndexed(ParameterNameAndValue.of(parameterName, parameterValue))
                .stream().map(AggregateIdParameterName::getAggregateId).collect(Collectors.toSet());
    }

    @Override
    public void index(AggregateId aggregateId, StreamTimestamp timestamp, String parameterName, Object parameterValue) {
        valueTable.update(
                AggregateIdParameterName.of(aggregateId, parameterName),
                ParameterNameAndValue.of(parameterName, parameterValue),
                timestamp);
    }

}


text:
var app = angular.module('js');

app.controller('ActivityContactCtrl', function($scope, $routeParams, $route, $location, NotificationSvc, ActivitiesSvc) {

    $scope.title = 'Kontakte verwalten';

    $scope.inlineEdit = false;

    $scope.toggleInlineEdit = function() {
        $scope.inlineEdit = !$scope.inlineEdit;
    }

    $scope.updateContact = function(contact) {
        ActivitiesSvc.updateContact(contact._id, contact.phoneNumber, contact.email)
            .success(function(ev) {
                    NotificationSvc.notify("Kontakt wurde erfolgreich geändert");
                    $route.reload();
            })
            .error(function(errC) {
                NotificationSvc.warn("Kontakt konnte nicht geändert werden");
            });
    }

    $scope.options = {
        shadowInput: false,
        highlightFirst: true,
        searchMethod: "search",
        onSelect: "onContactSelect"
    };

    $scope.isNewContactFormVisible = false;

    $scope.toggleVisibility = function() {
        $scope.isNewContactFormVisible = !$scope.isNewContactFormVisible;
    }

    $scope.onContactSelect = function(sel) {
        $scope.searchResultId = sel.id;
    }

    $scope.search = function(query, deferred) {
        var result = [];
        for(var i=0; i < $scope.allContacts.length; i++) {
            var c = $scope.allContacts[i];
            if(c.firstName.indexOf(query) !== -1 || c.lastName.indexOf(query) !== -1)
                result.push({value: c.lastName + ' ' + c.firstName, id: c._id});
        }

        deferred.resolve({results: result});
    }

    $scope.saveContact = function() {
        //console.log($scope.firstName, $scope.lastName, $scope.phoneNumber, $scope.email, $scope.role);
        ActivitiesSvc.createContact({
            firstName: $scope.firstName,
            lastName: $scope.lastName,
            phoneNumber: $scope.phoneNumber,
            email: $scope.email
       })
       .success(function(c) {
            ActivitiesSvc.addContact($routeParams.activityId, c._id, $scope.role)
                .success(function(act) {
                    NotificationSvc.notify("Kontakt wurde erfolgreich gespeichert");
                    $route.reload();
                })
                .error(function(errC) {
                    NotificationSvc.warn("Kontakt konnte nicht hinzugefügt werden");
                });
       })
       .error(function(err) {
            if(err.indexOf('duplicate key error index') > -1) {
				NotificationSvc.warn("Kontakt " + $scope.firstName + " " + $scope.lastName + " existiert bereits");
			} else {
                NotificationSvc.warn("Kontakt konnte nicht gespeichert werden");
            }
       });
    }

    $scope.addContact = function() {
        ActivitiesSvc.addContact($routeParams.activityId, $scope.searchResultId, $scope.contactRole)
            .success(function(act) {
                NotificationSvc.notify("Kontakt wurde gespeichert");
            })
            .error(function(err) {
                NotificationSvc.warn("Kontakt konnte nicht gespeichert werden");
            });
        $route.reload();
    }

    $scope.removeContact = function(contactId, role) {
        ActivitiesSvc.removeContact($routeParams.activityId, contactId, role)
            .success(function(act) {
                NotificationSvc.notify("Kontakt wurde entfernt");
            })
            .error(function(err) {
                NotificationSvc.warn("Kontakt konnte nicht entfernt werden");
            });
        $route.reload();
    }

    ActivitiesSvc.getAllContacts().success(function(cs) {
        $scope.allContacts = cs;
    });

    ActivitiesSvc.getContacts($routeParams.activityId).success(function(c) {
        $scope.assignedContacts = c.contactRels;
    });
});


text:
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.85);
  transition: opacity 300ms;
  -webkit-transition: opacity 300ms;
  -moz-transition: opacity 300ms;
  -ms-transition: opacity 300ms;
  -o-transition: opacity 300ms;
  z-index: 500;
  opacity: 0;
}

#overlay.show {
  opacity: 1;
}

.zoom-image-clone {
  position: fixed;
  -moz-transition: -moz-transform 0.23s linear;
  -ms-transition: -ms-transform 0.23s linear;
  -webkit-transition: -webkit-transform 0.23s linear;
  transition: transform 0.23s linear;
  z-index: 500;
  cursor: -webkit-zoom-out;
  cursor: -moz-zoom-out;
  cursor: -ms-zoom-out;
  cursor: zoom-out;
}

#overlay {
  transition: opacity 300ms;
  -webkit-transition: opacity 300ms;
  -moz-transition: opacity 300ms;
  -ms-transition: opacity 300ms;
  -o-transition: opacity 300ms;
  background-color: rgba(104, 104, 104, 0.97);
}


text:
published: true
title: Eigenstyle
tags: eigen-value math image
---
> Any set of images can be broken down with [Principal Component Analysis](http://setosa.io/ev/principal-component-analysis/). This has been done pretty successfully with [faces](https://en.wikipedia.org/wiki/Eigenface). Here we'll take a look at style.- [Principal Component Analysis and Fashion](https://medium.com/hackerati/eigenstyle-8c52cc979029)

- [github](https://github.com/graceavery/Eigenstyle)


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { LySliderModule } from '@alyle/ui/slider';
import { LyCheckboxModule } from '@alyle/ui/checkbox';
import { LyFieldModule } from '@alyle/ui/field';
import { LyRadioModule } from '@alyle/ui/radio';

import { SliderPlaygroundComponent } from './slider-playground.component';

@NgModule({
  declarations: [SliderPlaygroundComponent],
  imports: [
    CommonModule,
    FormsModule,
    LySliderModule,
    LyCheckboxModule,
    LyFieldModule,
    LyRadioModule
  ],
  exports: [SliderPlaygroundComponent]
})
export class SliderPlaygroundModule { }


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GrPPI: grppi::worker_pool Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

GrPPI
    1.0

Generic and Reusable Parallel Pattern Interface

grppi

worker_pool

Public Member Functions |
List of all members

grppi::worker_pool Class Reference

Pool of worker threads. This class offers a simple pool of worker threads.
 More...

#include <worker_pool.h>

Public Member Functions

 	worker_pool (int num_threads) noexcept

 	Creates a worker pool with a number of threads.  More...

 	~worker_pool () noexcept

 	Destructs the worker pool after joining with all threads in the pool.  More...

 	worker_pool (worker_pool &&) noexcept=default

worker_pool & 	operator= (worker_pool &&) noexcept=default

template<typename E , typename F , typename ... Args>

void 	launch (const E &ex, F f, Args &&... args)

 	Launch a function in the pool.  More...

template<typename E , typename F , typename ... Args>

void 	launch_tasks (const E &ex, F &&f, Args &&... args)

void 	wait () noexcept

 	Wait until all launched tasks have been completed.  More...

Detailed Description

Pool of worker threads. This class offers a simple pool of worker threads.

Note

Current version does not support more threads than the initially set number of threads.

Constructor & Destructor Documentation

◆ worker_pool() [1/2]

          grppi::worker_pool::worker_pool
          (
          int
          num_threads	)

inlinenoexcept

Creates a worker pool with a number of threads.

Parameters

num_threads	Number of threads for the pool.

◆ ~worker_pool()

          grppi::worker_pool::~worker_pool
          (
          	)

inlinenoexcept

Destructs the worker pool after joining with all threads in the pool.

◆ worker_pool() [2/2]

          grppi::worker_pool::worker_pool
          (
          worker_pool &&
          	)

defaultnoexcept

Member Function Documentation

◆ launch()

template<typename E , typename F , typename ... Args>

          void grppi::worker_pool::launch
          (
          const E &
          ex,

          F
          f,

          Args &&...
          args

          )

inline

Launch a function in the pool.

Template Parameters

E	Execution policy type.

F	Type for launched function.

Args	Type for launched function arguments.

Parameters

ex	Execution policy.

f	Function to be launched.

args	Arguments for launched function.

◆ launch_tasks()

template<typename E , typename F , typename ... Args>

          void grppi::worker_pool::launch_tasks
          (
          const E &
          ex,

          F &&
          f,

          Args &&...
          args

          )

inline

◆ operator=()

          worker_pool& grppi::worker_pool::operator=
          (
          worker_pool &&
          	)

defaultnoexcept

◆ wait()

          void grppi::worker_pool::wait
          (
          	)

inlinenoexcept

Wait until all launched tasks have been completed.

Postcondition

Number of workers is 0.

The documentation for this class was generated from the following file:

worker_pool.h

<address class="footer">
Generated by  1.9.2
</address>


text:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Cognifide.PowerShell.Core.Modules;
using Cognifide.PowerShell.Core.Settings;
using Sitecore.Configuration;
using Sitecore.Data;

namespace Cognifide.PowerShell.Core.Host
{
    public static class CommandHelp
    {
        public static IEnumerable<string> GetHelp(ScriptSession session, string command)
        {
            Collection<PSParseError> errors;
            var tokens = PSParser.Tokenize(command, out errors);
            var lastPsToken = tokens.LastOrDefault(t => t.Type == PSTokenType.Command);
            if (lastPsToken != null)
            {
                session.Output.Clear();
                var lastToken = lastPsToken.Content;
                session.SetVariable("helpFor", lastToken);
                var platformmodule = ModuleManager.GetModule("Platform");
                var scriptItem = Database.GetDatabase(platformmodule.Database)
                    .GetItem(platformmodule.Path + "/Internal/Context Help/Command Help");
                if (scriptItem == null)
                {
                    scriptItem = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb)
                        .GetItem(ApplicationSettings.ScriptLibraryPath + "Internal/Context Help/Command Help");
                }
                session.ExecuteScriptPart(scriptItem[ScriptItemFieldNames.Script], true, true);
                var sb = new StringBuilder("
X
");
                if (session.Output.Count == 0 || session.Output[0].LineType == OutputLineType.Error)
                {
                    return new[]
                    {
                        "

No Command in line or help information found

Cannot provide help in this context.
"
                    };
                }
                session.Output.ForEach(l => sb.Append(l.Text));
                session.Output.Clear();
                var result = new[] {sb.ToString()};
                return result;
            }
            return new[] {"No Command in line found - cannot provide help in this context."};
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Azure.Analytics.Synapse.Artifacts.Models
{
    /// <summary> HDInsight streaming activity type. </summary>
    public partial class HDInsightStreamingActivity : ExecutionActivity
    {
        /// <summary> Initializes a new instance of HDInsightStreamingActivity. </summary>
        /// <param name="name"> Activity name. </param>
        /// <param name="mapper"> Mapper executable name. Type: string (or Expression with resultType string). </param>
        /// <param name="reducer"> Reducer executable name. Type: string (or Expression with resultType string). </param>
        /// <param name="input"> Input blob path. Type: string (or Expression with resultType string). </param>
        /// <param name="output"> Output blob path. Type: string (or Expression with resultType string). </param>
        /// <param name="filePaths"> Paths to streaming job files. Can be directories. </param>
        public HDInsightStreamingActivity(string name, object mapper, object reducer, object input, object output, IEnumerable<object> filePaths) : base(name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }
            if (reducer == null)
            {
                throw new ArgumentNullException(nameof(reducer));
            }
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }
            if (filePaths == null)
            {
                throw new ArgumentNullException(nameof(filePaths));
            }

            Mapper = mapper;
            Reducer = reducer;
            Input = input;
            Output = output;
            FilePaths = filePaths.ToList();
            Type = "HDInsightStreaming";
        }

        /// <summary> Initializes a new instance of HDInsightStreamingActivity. </summary>
        /// <param name="name"> Activity name. </param>
        /// <param name="type"> Type of activity. </param>
        /// <param name="description"> Activity description. </param>
        /// <param name="dependsOn"> Activity depends on condition. </param>
        /// <param name="userProperties"> Activity user properties. </param>
        /// <param name="additionalProperties"> . </param>
        /// <param name="linkedServiceName"> Linked service reference. </param>
        /// <param name="policy"> Activity policy. </param>
        /// <param name="storageLinkedServices"> Storage linked service references. </param>
        /// <param name="arguments"> User specified arguments to HDInsightActivity. </param>
        /// <param name="getDebugInfo"> Debug info option. </param>
        /// <param name="mapper"> Mapper executable name. Type: string (or Expression with resultType string). </param>
        /// <param name="reducer"> Reducer executable name. Type: string (or Expression with resultType string). </param>
        /// <param name="input"> Input blob path. Type: string (or Expression with resultType string). </param>
        /// <param name="output"> Output blob path. Type: string (or Expression with resultType string). </param>
        /// <param name="filePaths"> Paths to streaming job files. Can be directories. </param>
        /// <param name="fileLinkedService"> Linked service reference where the files are located. </param>
        /// <param name="combiner"> Combiner executable name. Type: string (or Expression with resultType string). </param>
        /// <param name="commandEnvironment"> Command line environment values. </param>
        /// <param name="defines"> Allows user to specify defines for streaming job request. </param>
        internal HDInsightStreamingActivity(string name, string type, string description, IList<ActivityDependency> dependsOn, IList<UserProperty> userProperties, IDictionary<string, object> additionalProperties, LinkedServiceReference linkedServiceName, ActivityPolicy policy, IList<LinkedServiceReference> storageLinkedServices, IList<object> arguments, HDInsightActivityDebugInfoOption? getDebugInfo, object mapper, object reducer, object input, object output, IList<object> filePaths, LinkedServiceReference fileLinkedService, object combiner, IList<object> commandEnvironment, IDictionary<string, object> defines) : base(name, type, description, dependsOn, userProperties, additionalProperties, linkedServiceName, policy)
        {
            StorageLinkedServices = storageLinkedServices;
            Arguments = arguments;
            GetDebugInfo = getDebugInfo;
            Mapper = mapper;
            Reducer = reducer;
            Input = input;
            Output = output;
            FilePaths = filePaths ?? new List<object>();
            FileLinkedService = fileLinkedService;
            Combiner = combiner;
            CommandEnvironment = commandEnvironment;
            Defines = defines;
            Type = type ?? "HDInsightStreaming";
        }

        /// <summary> Storage linked service references. </summary>
        public IList<LinkedServiceReference> StorageLinkedServices { get; set; }
        /// <summary> User specified arguments to HDInsightActivity. </summary>
        public IList<object> Arguments { get; set; }
        /// <summary> Debug info option. </summary>
        public HDInsightActivityDebugInfoOption? GetDebugInfo { get; set; }
        /// <summary> Mapper executable name. Type: string (or Expression with resultType string). </summary>
        public object Mapper { get; set; }
        /// <summary> Reducer executable name. Type: string (or Expression with resultType string). </summary>
        public object Reducer { get; set; }
        /// <summary> Input blob path. Type: string (or Expression with resultType string). </summary>
        public object Input { get; set; }
        /// <summary> Output blob path. Type: string (or Expression with resultType string). </summary>
        public object Output { get; set; }
        /// <summary> Paths to streaming job files. Can be directories. </summary>
        public IList<object> FilePaths { get; }
        /// <summary> Linked service reference where the files are located. </summary>
        public LinkedServiceReference FileLinkedService { get; set; }
        /// <summary> Combiner executable name. Type: string (or Expression with resultType string). </summary>
        public object Combiner { get; set; }
        /// <summary> Command line environment values. </summary>
        public IList<object> CommandEnvironment { get; set; }
        /// <summary> Allows user to specify defines for streaming job request. </summary>
        public IDictionary<string, object> Defines { get; set; }
    }
}


text:
namespace operations_research {

bool CheckConstraintSatisfaction(
    const std::vector<FapConstraint>& data_constraints,
    const std::vector<int>& variables,
    const std::map<int, int>& index_from_key) {
  bool status = true;
  for (const FapConstraint& ct : data_constraints) {
    const int index1 = FindOrDie(index_from_key, ct.variable1);
    const int index2 = FindOrDie(index_from_key, ct.variable2);
    CHECK_LT(index1, variables.size());
    CHECK_LT(index2, variables.size());
    const int var1 = variables[index1];
    const int var2 = variables[index2];
    const int absolute_difference = abs(var1 - var2);

    if ((ct.operation == ">") && (absolute_difference <= ct.value)) {
      LOG(INFO) << "  Violation of contraint between variable " << ct.variable1
                << " and variable " << ct.variable2 << ".";
      LOG(INFO) << "  Expected |" << var1 << " - " << var2
                << "| (= " << absolute_difference << ") >  " << ct.value
                << ".";
      status = false;
    } else if ((ct.operation == "=") && (absolute_difference != ct.value)) {
      LOG(INFO) << "  Violation of contraint between variable " << ct.variable1
                << " and variable " << ct.variable2 << ".";
      LOG(INFO) << "  Expected |" << var1 << " - " << var2
                << "| (= " << absolute_difference << ") =  " << ct.value
                << ".";
      status = false;
    }
  }
  return status;
}

bool CheckVariablePosition(const std::map<int, FapVariable>& data_variables,
                           const std::vector<int>& variables,
                           const std::map<int, int>& index_from_key) {
  bool status = true;
  for (const auto& it : data_variables) {
    const int index = FindOrDie(index_from_key, it.first);
    CHECK_LT(index, variables.size());
    const int var = variables[index];

    if (it.second.hard && (it.second.initial_position != -1) &&
        (var != it.second.initial_position)) {
      LOG(INFO) << "  Change of position of hard variable " << it.first << ".";
      LOG(INFO) << "  Expected " << it.second.initial_position
                << " instead of given " << var << ".";
      status = false;
    }
  }
  return status;
}

int NumberOfAssignedValues(const std::vector<int>& variables) {
  std::set<int> assigned(variables.begin(), variables.end());
  return static_cast<int>(assigned.size());
}

void PrintElapsedTime(const int64 time1, const int64 time2) {
  LOG(INFO) << "End of solving process.";
  LOG(INFO) << "The Solve method took " << (time2 - time1) / 1000.0
            << " seconds.";
}

void PrintResultsHard(SolutionCollector* const collector,
                      const std::vector<IntVar*>& variables,
                      IntVar* const objective_var,
                      const std::map<int, FapVariable>& data_variables,
                      const std::vector<FapConstraint>& data_constraints,
                      const std::map<int, int>& index_from_key,
                      const std::vector<int>& key_from_index) {
  LOG(INFO) << "Printing...";
  LOG(INFO) << "Number of Solutions: " << collector->solution_count();
  for (int solution_index = 0; solution_index < collector->solution_count();
       ++solution_index) {
    Assignment* const solution = collector->solution(solution_index);
    std::vector<int> results(variables.size());
    LOG(INFO) << "------------------------------------------------------------";
    LOG(INFO) << "Solution " << solution_index + 1;
    LOG(INFO) << "Cost: " << solution->Value(objective_var);
    for (int i = 0; i < variables.size(); ++i) {
      results[i] = solution->Value(variables[i]);
      LOG(INFO) << "  Variable " << key_from_index[i] << ": " << results[i];
    }
    if (CheckConstraintSatisfaction(data_constraints, results,
                                    index_from_key)) {
      LOG(INFO) << "All hard constraints satisfied.";
    } else {
      LOG(INFO) << "Warning! Hard constraint violation detected.";
    }
    if (CheckVariablePosition(data_variables, results, index_from_key)) {
      LOG(INFO) << "All hard variables stayed unharmed.";
    } else {
      LOG(INFO) << "Warning! Hard variable modification detected.";
    }

    LOG(INFO) << "Values used: " << NumberOfAssignedValues(results);
    LOG(INFO) << "Maximum value used: "
              << *std::max_element(results.begin(), results.end());
    LOG(INFO) << "  Failures: " << collector->failures(solution_index);
  }
  LOG(INFO) << "  ============================================================";
}

void PrintResultsSoft(SolutionCollector* const collector,
                      const std::vector<IntVar*>& variables,
                      IntVar* const total_cost,
                      const std::map<int, FapVariable>& hard_variables,
                      const std::vector<FapConstraint>& hard_constraints,
                      const std::map<int, FapVariable>& soft_variables,
                      const std::vector<FapConstraint>& soft_constraints,
                      const std::map<int, int>& index_from_key,
                      const std::vector<int>& key_from_index) {
  LOG(INFO) << "Printing...";
  LOG(INFO) << "Number of Solutions: " << collector->solution_count();
  for (int solution_index = 0; solution_index < collector->solution_count();
       ++solution_index) {
    Assignment* const solution = collector->solution(solution_index);
    std::vector<int> results(variables.size());
    LOG(INFO) << "------------------------------------------------------------";
    LOG(INFO) << "Solution";
    for (int i = 0; i < variables.size(); ++i) {
      results[i] = solution->Value(variables[i]);
      LOG(INFO) << "  Variable " << key_from_index[i] << ": " << results[i];
    }
    if (CheckConstraintSatisfaction(hard_constraints, results,
                                    index_from_key)) {
      LOG(INFO) << "All hard constraints satisfied.";
    } else {
      LOG(INFO) << "Warning! Hard constraint violation detected.";
    }
    if (CheckVariablePosition(hard_variables, results, index_from_key)) {
      LOG(INFO) << "All hard variables stayed unharmed.";
    } else {
      LOG(INFO) << "Warning! Hard constraint violation detected.";
    }

    if (CheckConstraintSatisfaction(soft_constraints, results,
                                    index_from_key) &&
        CheckVariablePosition(soft_variables, results, index_from_key)) {
      LOG(INFO) << "Problem feasible: "
                   "Soft constraints and soft variables satisfied.";
      LOG(INFO) << "  Weighted Sum: " << solution->Value(total_cost);
    } else {
      LOG(INFO) << "Problem unfeasible. Optimized weighted sum of violations.";
      LOG(INFO) << "  Weighted Sum: " << solution->Value(total_cost);
    }

    LOG(INFO) << "Values used: " << NumberOfAssignedValues(results);
    LOG(INFO) << "Maximum value used: "
              << *std::max_element(results.begin(), results.end());
    LOG(INFO) << "  Failures: " << collector->failures(solution_index);
  }
  LOG(INFO) << "  ============================================================";
}

}  // namespace operations_research


text:
<readable><title>397601572_9587a39291</title><content>
The back of two men 's heads riding on a train .
The backs of the heads of two men that are plugging their ears while riding the subway .
Two guys are sharing headphones and are listening to music on a subway .
Two men on a busy subway , seen from behind ,
Two people sitting together on a subway listening to earphones .
</content></readable>


text:
<!DOCTYPE html>
<html>
    <head>
    	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    	<script src="../lib/jquery.min.js"></script>
        <script src="../js/background.js"></script>
    </head>
    <body>
    	<textarea></textarea>
    </body>
</html>


text:
package com.spotify.heroic.aggregation;

import com.spotify.heroic.grammar.AggregationValue;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public abstract class AbstractAggregationDSL implements AggregationDSL {
    private final AggregationFactory factory;

    protected Aggregation asAggregation(final AggregationValue value) {
        return value.build(factory);
    }
}


text:
pytest-flask-example
====================

An example of developing pytest test for a fairly complex flask app

###During this step:

 + this git repo was initialized (README.md, .gitignore, LICENSE)
 + python modules flask and pytest were installed `pip install flask pytest`
 + requirements.txt was generated via `pip freeze > requirements.txt`
 + folder structure was laid out (./flask_app/ and ./tests/)
 + setup.cfg was created to configure the pytest module.
 + added \_\_init\_\_.py files to both new directories

###Coding Flow Guide:

1. Start at branch step_00
1. Develop new test
1. Commit new test
1. 'Increment step' by branching to step_01
1. Develop code
1. When all tests pass, commit code
1. 'Increment step' by branching to step_02
1. Update master branch to latest step
1. Repeat


text:
package com.vaadin.tests.components.optiongroup;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.v7.ui.OptionGroup;

/**
 * Testcase for #10451
 *
 * @author Vaadin Ltd
 */
public class OptionGroupRetainFocusKeyboardValueChange
        extends AbstractReindeerTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final OptionGroup optiongroup = new OptionGroup();
        optiongroup.addItem(1);
        optiongroup.addItem(2);
        optiongroup.addItem(3);
        optiongroup.setItemCaption(1, "A");
        optiongroup.setItemCaption(2, "B");
        optiongroup.setItemCaption(3, "C");
        optiongroup.setImmediate(true);

        optiongroup.addValueChangeListener(event -> {
            if (optiongroup.isSelected(2)) {
                optiongroup.setItemCaption(1, "A+");
            } else if (optiongroup.isSelected(3)) {
                optiongroup.removeItem(2);
                optiongroup.addItem(2);
                optiongroup.setItemCaption(2, "B");
            }
        });

        addComponent(optiongroup);

        optiongroup.focus();
    }

    @Override
    protected String getTestDescription() {
        return "OptionGroup should retain focus after it's value being changed with keyboard";
    }

    @Override
    protected Integer getTicketNumber() {
        return 10451;
    }
}


text:
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

Apache Maven 3 is required to build Apache Commons Weaver, using Java 8.

### Site building issues
Apache Commons Weaver uses the japicmp report for API compatibility reporting.
This requires that the `package` goal be invoked in the same Maven run as the
`site` goal.


text:
module BWAPI
  class Client
    module Admin
      module Clients
        module Users
          # Sharing module for admin/users/sharing endpoints
          module Sharing

            # Get a list of project shares for user
            #
            # @param client_id [Integer] Id of the client
            # @param user_id [Integer] Id of the user
            # @return [Hashie::Mash] All shares for client user
            def client_users_sharing client_id, user_id
              get "admin/client/#{client_id}/users/#{user_id}/sharing"
            end
            alias :users_sharing :client_users_sharing

            # Update a list of project shares for user
            #
            # @param client_id [Integer] Id of the client
            # @param user_id [Integer] Id of the user
            # @param opts [Hash] options Hash of parameters
            # @option opts [Array] ProjectShareDTO The shares of the user
            # @return [Hashie::Mash] Updated shares for client user
            def update_client_users_sharing client_id, user_id, opts
              get "admin/client/#{client_id}/users/#{user_id}/sharing", opts
            end
            alias :update_users_sharing :update_client_users_sharing

          end
        end
      end
    end
  end
end


text:
function getStatus(url) {
    var request = new XMLHttpRequest();
    request.open("GET", url, true);
    request.send();

    request.onreadystatechange = function() {
        if (request.readyState == 4) {
            return(request.responseText);
        }
    }
}