text:
SEQAN_BEGIN_TESTSUITE(test_seeds)
{
    // Test indirect iterator.
    // SEQAN_CALL_TEST(test_seeds_basic_iter_indirect_constructors);
    // SEQAN_CALL_TEST(test_seeds_basic_iter_indirect_metafunctions);
    // SEQAN_CALL_TEST(test_seeds_basic_iter_indirect_basic_functions);

    // Tests for seed diagonals.
    SEQAN_CALL_TEST(test_seeds_seed_diagonal_constructors);
    SEQAN_CALL_TEST(test_seeds_seed_diagonal_metafunctions);

    // Tests for seeds.
    SEQAN_CALL_TEST(test_seeds_seed_base_constructors_simple);
    SEQAN_CALL_TEST(test_seeds_seed_base_metafunctions_simple);
    SEQAN_CALL_TEST(test_seeds_seed_base_getters_setters_simple);
    SEQAN_CALL_TEST(test_seeds_seed_base_basic_functions_simple);
    SEQAN_CALL_TEST(test_seeds_seed_base_assign_simple);
    SEQAN_CALL_TEST(test_seeds_seed_base_constructors_chained);
    SEQAN_CALL_TEST(test_seeds_seed_base_metafunctions_chained);
    SEQAN_CALL_TEST(test_seeds_seed_base_getters_setters_chained);
    SEQAN_CALL_TEST(test_seeds_seed_base_basic_functions_chained);
    SEQAN_CALL_TEST(test_seeds_seed_base_assign_chained);

    SEQAN_CALL_TEST(test_seeds_seed_chained_assign);
    SEQAN_CALL_TEST(test_seeds_seed_chained_metafunctions);
    SEQAN_CALL_TEST(test_seeds_seed_chained_append_diagonal);
    SEQAN_CALL_TEST(test_seeds_seed_chained_truncate_diagonals);
    SEQAN_CALL_TEST(test_seeds_seed_chained_iterators);
    SEQAN_CALL_TEST(test_seeds_seed_chained_front_back);

    SEQAN_CALL_TEST(test_seeds_seed_simple_constructors);
    SEQAN_CALL_TEST(test_seeds_seed_simple_setters);

    // Tests for the combination of seeds.
    SEQAN_CALL_TEST(test_seeds_combination_seeds_combineable_merge_chained);
    SEQAN_CALL_TEST(test_seeds_combination_seeds_combineable_simple_chaining_chained);
    SEQAN_CALL_TEST(test_seeds_combination_seeds_combineable_simple_chaos_chaining_chained);
    SEQAN_CALL_TEST(test_seeds_combination_combine_seeds_merge_chained);
    SEQAN_CALL_TEST(test_seeds_combination_combine_seeds_simple_chaining_chained);
    SEQAN_CALL_TEST(test_seeds_combination_combine_seeds_simple_chaos_chaining_chained);

    // Tests for unordered seed sets and simple seeds.
    SEQAN_CALL_TEST(test_seeds_seed_set_base_container_functions_simple_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_not_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_reached_score_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_not_reached_score_simple_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_right_merging_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_impossible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_not_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_not_reached_scored_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_reached_scored_simple_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_right_chaining_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_impossible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_possible_threshold_not_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_possible_threshold_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_possible_threshold_not_reached_scored_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_simple_chain_left_chaining_possible_threshold_reached_scored_simple_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_right_chaining_possible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_impossible_no_threshold_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_not_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_reached_length_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_not_reached_scored_simple_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_reached_scored_simple_unordered);

    // Tests for unordered seed sets and chained seeds.
    SEQAN_CALL_TEST(test_seeds_seed_set_base_container_functions_chained_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_not_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_reached_score_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_single_threshold_not_reached_score_chained_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_right_merging_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_impossible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_not_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_not_reached_scored_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_merge_left_merging_possible_threshold_reached_scored_chained_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_right_chaining_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_impossible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_possible_threshold_not_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_possible_threshold_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_possible_threshold_not_reached_scored_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chained_chain_left_chaining_possible_threshold_reached_scored_chained_unordered);

    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_right_chaining_possible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_impossible_no_threshold_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_not_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_reached_length_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_not_reached_scored_chained_unordered);
    SEQAN_CALL_TEST(test_seeds_seed_set_base_add_seed_chaos_left_chaining_possible_threshold_reached_scored_chained_unordered);

    // Tests for seed algorithms
    SEQAN_CALL_TEST(test_seeds_extension_match_extension_simple);
    SEQAN_CALL_TEST(test_seeds_extension_ungapped_xdrop_extension_simple);
    SEQAN_CALL_TEST(test_seeds_extension_gapped_xdrop_extension_simple);
    SEQAN_CALL_TEST(test_seeds_extension_match_extension_chained);
    SEQAN_CALL_TEST(test_seeds_extension_ungapped_xdrop_extension_chained);
    // Disabled the test for now.  Extension function contains a
    // force-failure assertion and instruction show to implement this.
    // See http://trac.mi.fu-berlin.de/seqan/ticket/344 for details.
    //
    // TODO(holtgrew): Implement this.
    //
    // SEQAN_CALL_TEST(test_seeds_extension_gapped_xdrop_extension_chained);

    // Tests for the banded chain alignment algorithms.
    SEQAN_CALL_TEST(test_align_chain_banded_compute_upper_left_overlap);
    SEQAN_CALL_TEST(test_align_chain_banded_compute_lower_right_overlap);
    SEQAN_CALL_TEST(test_align_chain_banded_align_linear);
    // TODO(holtgrew): Not testing banded chain alignment with affine gap costs for now.
    // SEQAN_CALL_TEST(test_align_chain_banded_align_affine);

    // Tests for the classic NW dynamic programming.
    SEQAN_CALL_TEST(test_align_dynprog_linear_resize_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_linear_init_gutter_free);
    SEQAN_CALL_TEST(test_align_dynprog_linear_init_gutter_not_free);
    SEQAN_CALL_TEST(test_align_dynprog_linear_fill_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_linear_traceback);
    // Tests for the banded NW dynamic programming.
    SEQAN_CALL_TEST(test_align_dynprog_banded_linear_resize_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_banded_linear_init_gutter_free);
    SEQAN_CALL_TEST(test_align_dynprog_banded_linear_init_gutter_not_free);
    SEQAN_CALL_TEST(test_align_dynprog_banded_linear_fill_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_banded_linear_traceback);

    // Tests for the classic Gotoh dynamic programming.
    SEQAN_CALL_TEST(test_align_dynprog_affine_resize_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_affine_init_gutter_free);
    SEQAN_CALL_TEST(test_align_dynprog_affine_init_gutter_not_free);
    SEQAN_CALL_TEST(test_align_dynprog_affine_fill_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_affine_traceback);
    // Tests for the banded Gotoh dynamic programming.
    SEQAN_CALL_TEST(test_align_dynprog_banded_affine_resize_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_banded_affine_init_gutter_free);
    SEQAN_CALL_TEST(test_align_dynprog_banded_affine_init_gutter_not_free);
    SEQAN_CALL_TEST(test_align_dynprog_banded_affine_fill_matrix);
    SEQAN_CALL_TEST(test_align_dynprog_banded_affine_traceback);

    // Test global chaining of seeds.
    SEQAN_CALL_TEST(test_seeds_global_chaining_sparse_length);
}
SEQAN_END_TESTSUITE


text:
package org.apache.flink.table.sources;

import org.apache.flink.annotation.PublicEvolving;

/**
 * Adds support for projection push-down to a {@link TableSource}.
 *
 *
A {@link TableSource} extending this interface is able to project the fields of the returned
 * {@code DataSet} if it is a {@code BatchTableSource} or {@code DataStream} if it is a
 * {@code StreamTableSource}.
 *
 * @param <T> The return type of the {@link TableSource}.
 */
@PublicEvolving
public interface ProjectableTableSource<T> {

	/**
	 * Creates a copy of the {@link TableSource} that projects its output to the given field indexes.
	 * The field indexes relate to the physical poduced data type ({@link TableSource#getProducedDataType()})
	 * and not to the table schema ({@link TableSource#getTableSchema} of the {@link TableSource}.
	 *
	 *
The table schema ({@link TableSource#getTableSchema} of the {@link TableSource} copy must not be
	 * modified by this method, but only the produced data type ({@link TableSource#getProducedDataType()})
	 * and the produced {@code DataSet} ({@code BatchTableSource#getDataSet(}) or {@code DataStream}
	 * ({@code StreamTableSource#getDataStream}).
	 *
	 *
If the {@link TableSource} implements the {@link DefinedFieldMapping} interface, it might
	 * be necessary to adjust the mapping as well.
	 *
	 *
IMPORTANT: This method must return a true copy and must not modify the original table
	 * source object.
	 *
	 * @param fields The indexes of the fields to return.
	 * @return A copy of the {@link TableSource} that projects its output.
	 */
	TableSource<T> projectFields(int[] fields);
}

redpajama_set_name: RedPajamaGithub


text:
package jpl.mipl.io.plugins;

import javax.imageio.ImageReadParam;

/* 4-24-2014 srl*/

public class VicarImageReadParam extends ImageReadParam {
    private String directoryPath = null;
    private int tileSize = 256;
    private int tileSizeX = 256;
    private int tileSizeY = 256;

    public void setDirectoryPath(String path) {
        this.directoryPath = path;
    }

    public String getDirectoryPath() {
        return this.directoryPath;
    }

    public void setTileSize(int t) {
        this.tileSize = t;
    }

    public int getTileSize() {
        return this.tileSize;
    }

    public void setTileSizeX(int t) {
        this.tileSizeX = t;
    }

    public int getTileSizeX() {
        return this.tileSizeX;
    }

    public void setTileSizeY(int t) {
        this.tileSizeY = t;
    }

    public int getTileSizeY() {
        return this.tileSizeY;
    }

}


text:
<?php

namespace CgmConfigAdmin\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\Mvc\Controller\Plugin\FlashMessenger;

class CgmFlashMessages extends AbstractHelper
{
    /**
     * @var FlashMessenger
     */
    protected $flashMessenger;

    public function __construct(FlashMessenger $plugin)
    {
        $this->flashMessenger = $plugin;
    }

    public function __invoke()
    {
        $output = '';
        $this->flashMessenger->setNamespace('cgmconfigadmin');
        if (count($this->flashMessenger)) {
            foreach ($this->flashMessenger as $msg) {
                $class = (isset($msg['type'])) ? "alert-{$msg['type']}" : '';
                $output .= '
';
                $output .= '<button type="button" class="close" data-dismiss="alert">×</button>';
                $output .= $msg['message'];
                $output .= '
';
            }
        }
        $this->flashMessenger->setNamespace('default');
        return $output;
    }
}


text:
package com.faforever.client.game;

import com.faforever.client.domain.GameBean;
import com.faforever.client.domain.PlayerBean;
import com.faforever.client.fx.Controller;
import com.faforever.client.fx.JavaFxUtil;
import com.faforever.client.fx.contextmenu.ContextMenuBuilder;
import com.faforever.client.i18n.I18n;
import com.faforever.client.map.MapService;
import com.faforever.client.map.MapService.PreviewSize;
import com.faforever.client.mod.ModService;
import com.faforever.client.theme.UiService;
import com.faforever.client.util.PopupUtil;
import com.faforever.client.util.RatingUtil;
import com.faforever.client.util.TimeService;
import com.faforever.client.vault.replay.WatchButtonController;
import com.faforever.commons.lobby.GameStatus;
import com.google.common.annotations.VisibleForTesting;
import javafx.animation.Animation.Status;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.beans.InvalidationListener;
import javafx.beans.WeakInvalidationListener;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.util.Duration;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Component
@Slf4j
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequiredArgsConstructor
public class GameDetailController implements Controller<Pane> {

  private final I18n i18n;
  private final MapService mapService;
  private final ModService modService;
  private final TimeService timeService;
  private final UiService uiService;
  private final JoinGameHelper joinGameHelper;
  private final ContextMenuBuilder contextMenuBuilder;

  public Pane gameDetailRoot;
  public Label gameTypeLabel;
  public Label mapLabel;
  public Label numberOfPlayersLabel;
  public Label hostLabel;
  public VBox teamListPane;
  public StackPane mapPreviewContainer;
  public ImageView mapImageView;
  public Label gameTitleLabel;
  public Label playtimeLabel;
  public Node joinButton;
  public WatchButtonController watchButtonController;
  public Node watchButton;

  private GameBean game;
  private boolean playtimeVisible;
  private Timeline playTimeTimeline;

  private InvalidationListener teamsInvalidationListener;
  private InvalidationListener gameStatusInvalidationListener;
  private InvalidationListener gamePropertiesInvalidationListener;
  private InvalidationListener featuredModInvalidationListener;
  private InvalidationListener startTimeInvalidationListener;

  public void initialize() {
    contextMenuBuilder.addCopyLabelContextMenu(gameTitleLabel, mapLabel, gameTypeLabel);
    JavaFxUtil.bindManagedToVisible(joinButton, watchButton, gameTitleLabel, hostLabel, mapLabel, numberOfPlayersLabel,
        mapPreviewContainer, gameTypeLabel, playtimeLabel);
    JavaFxUtil.bind(mapPreviewContainer.visibleProperty(), mapImageView.imageProperty().isNotNull());
    gameDetailRoot.parentProperty().addListener(observable -> {
      if (!(gameDetailRoot.getParent() instanceof Pane)) {
        return;
      }
      gameDetailRoot.maxWidthProperty().bind(((Pane) gameDetailRoot.getParent()).widthProperty());
    });
  }

  private void onGameStatusChanged() {
    JavaFxUtil.runLater(() -> {
      if (game != null) {
        switch (game.getStatus()) {
          case PLAYING -> {
            joinButton.setVisible(false);
            calculatePlaytime(game);
          }
          case OPEN -> joinButton.setVisible(true);
          case UNKNOWN, CLOSED -> {
            hideGameDetail();
            stopPlaytime();
          }
        }
      } else {
        stopPlaytime();
      }
    });
  }

  private void calculatePlaytime(GameBean game) {
    if (playtimeVisible && (playTimeTimeline == null || playTimeTimeline.getStatus() == Status.STOPPED)) {
      playtimeLabel.setVisible(true);
      playTimeTimeline = new Timeline(new KeyFrame(Duration.ZERO, event -> {
        if (game.getStatus() == GameStatus.PLAYING && game.getStartTime() != null) {
          updatePlaytimeValue(game.getStartTime());
        }
      }), new KeyFrame(Duration.seconds(1)));
      playTimeTimeline.setCycleCount(Timeline.INDEFINITE);
      playTimeTimeline.play();
    }
  }

  private void stopPlaytime() {
    if (playTimeTimeline != null) {
      playTimeTimeline.stop();
    }
    JavaFxUtil.runLater(() -> playtimeLabel.setVisible(false));
  }

  private void updatePlaytimeValue(OffsetDateTime gameStartTime) {
    JavaFxUtil.runLater(() -> playtimeLabel.setText(timeService.shortDuration(java.time.Duration.between(gameStartTime, OffsetDateTime.now()))));
  }

  public void dispose() {
    stopPlaytime();
  }

  private void onGamePropertyChanged() {
    if (game != null) {
      JavaFxUtil.runLater(() -> {
        gameTitleLabel.setText(StringUtils.normalizeSpace(game.getTitle()));
        hostLabel.setText(game.getHost());
        mapLabel.setText(game.getMapFolderName());
        mapImageView.setImage(mapService.loadPreview(game.getMapFolderName(), PreviewSize.LARGE));
      });
    }
  }

  private void onNumPlayersChanged() {
    JavaFxUtil.runLater(() -> {
      if (game != null) {
        numberOfPlayersLabel.setText(i18n.get("game.detail.players.format", game.getNumActivePlayers(), game.getMaxPlayers()));
      }
    });
  }

  public void setGame(GameBean game) {
    resetListeners();

    this.game = game;
    if (game == null || game.getStatus() == GameStatus.CLOSED) {
      hideGameDetail();
      return;
    }

    showGameDetail();

    WeakInvalidationListener weakTeamListener = new WeakInvalidationListener(teamsInvalidationListener);
    WeakInvalidationListener weakGameStatusListener = new WeakInvalidationListener(gameStatusInvalidationListener);
    WeakInvalidationListener weakGamePropertiesListener = new WeakInvalidationListener(gamePropertiesInvalidationListener);
    WeakInvalidationListener weakStartTimeListener = new WeakInvalidationListener(startTimeInvalidationListener);

    JavaFxUtil.addAndTriggerListener(game.featuredModProperty(), new WeakInvalidationListener(featuredModInvalidationListener));
    JavaFxUtil.addListener(game.maxPlayersProperty(), weakTeamListener);
    JavaFxUtil.addAndTriggerListener(game.teamsProperty(), weakTeamListener);
    JavaFxUtil.addAndTriggerListener(game.statusProperty(), weakGameStatusListener);
    JavaFxUtil.addAndTriggerListener(game.titleProperty(), weakGamePropertiesListener);
    JavaFxUtil.addListener(game.mapFolderNameProperty(), weakGamePropertiesListener);
    JavaFxUtil.addListener(game.hostProperty(), weakGamePropertiesListener);
    JavaFxUtil.addAndTriggerListener(game.startTimeProperty(), weakStartTimeListener);
  }

  public void resetListeners() {
    featuredModInvalidationListener = observable -> onFeaturedModChanged();
    gameStatusInvalidationListener = observable -> onGameStatusChanged();
    teamsInvalidationListener = observable -> {
      createTeams();
      onNumPlayersChanged();
    };
    gamePropertiesInvalidationListener = observable -> onGamePropertyChanged();
    startTimeInvalidationListener = observable -> onStartTimeChanged();
  }

  private void onStartTimeChanged() {
    JavaFxUtil.runLater(() -> {
      if (game != null && game.getStatus() == GameStatus.PLAYING) {
        OffsetDateTime startTime = game.getStartTime();
        if (startTime != null) {
          watchButtonController.setGame(game);
          joinButton.setVisible(false);
        }
        watchButton.setVisible(startTime != null);
      } else {
        joinButton.setVisible(game != null && game.getStatus() == GameStatus.OPEN);
        watchButton.setVisible(false);
      }
    });
  }

  private void onFeaturedModChanged() {
    modService.getFeaturedMod(game.getFeaturedMod())
        .thenAccept(featuredMod -> {
          String fullName = featuredMod != null ? featuredMod.getDisplayName() : null;
          JavaFxUtil.runLater(() -> gameTypeLabel.setText(StringUtils.defaultString(fullName)));
        });
  }

  private void createTeams() {
    List<Node> teamCardPanes = new ArrayList<>();
    if (game != null) {
      for (Map.Entry<Integer, List<PlayerBean>> entry : game.getTeams().entrySet()) {
        Integer team = entry.getKey();

        if (team != null) {
          TeamCardController teamCardController = uiService.loadFxml("theme/team_card.fxml");
          teamCardController.setPlayersInTeam(team, entry.getValue(),
              player -> RatingUtil.getLeaderboardRating(player, game.getLeaderboard()), null, RatingPrecision.ROUNDED);
          teamCardPanes.add(teamCardController.getRoot());
        }
      }
    }
    JavaFxUtil.runLater(() -> teamListPane.getChildren().setAll(teamCardPanes));
  }

  private void showGameDetail() {
    JavaFxUtil.runLater(() -> getRoot().setVisible(true));
  }

  private void hideGameDetail() {
    JavaFxUtil.runLater(() -> getRoot().setVisible(false));
  }

  public void setPlaytimeVisible(boolean visible) {
    playtimeVisible = visible;
  }

  @Override
  public Pane getRoot() {
    return gameDetailRoot;
  }

  public void onJoinButtonClicked() {
    joinGameHelper.join(game);
  }

  public void onMapPreviewImageClicked() {
    if (game != null) {
      PopupUtil.showImagePopup(mapService.loadPreview(game.getMapFolderName(), PreviewSize.LARGE));
    }
  }

  @VisibleForTesting
  protected Timeline getPlayTimeTimeline() {
    return playTimeTimeline;
  }
}


text:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/services/Tgm.php');

/*
 * remove wp-embed javascript, since it's included in webpack build
 */
add_action('wp_print_scripts', function() {
    wp_deregister_script('wp-embed');
}, 100);

add_filter('neochic_woodlets_twig', function ($twig) {
    return $twig;
});


text:
<?php

namespace Integrated\Bundle\MenuBundle\Provider;

use Integrated\Bundle\PageBundle\Breadcrumb\BreadcrumbResolver;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Knp\Menu\Provider\MenuProviderInterface;

class BreadcrumbMenuProvider implements MenuProviderInterface
{
    /**
     * @var FactoryInterface
     */
    protected $menuFactory;

    /**
     * @var BreadcrumbResolver
     */
    private $breadcrumbResolver;

    /**
     * @param FactoryInterface   $menuFactory
     * @param BreadcrumbResolver $breadcrumbResolver
     */
    public function __construct(FactoryInterface $menuFactory, BreadcrumbResolver $breadcrumbResolver)
    {
        $this->menuFactory = $menuFactory;
        $this->breadcrumbResolver = $breadcrumbResolver;
    }

    /**
     * {@inheritdoc}
     */
    public function get(string $name, array $options = []): ItemInterface
    {
        if ($name !== 'breadcrumb') {
            throw new \InvalidArgumentException('This provider can be used for menu "breadcrumb" only');
        }
        $menu = $this->menuFactory->createItem($name, $options);

        foreach ($this->breadcrumbResolver->getBreadcrumb() as $breadcrumbItem) {
            $menu->addChild(
                $breadcrumbItem->getName(),
                ['uri' => $breadcrumbItem->getUrl()]
            );
        }

        return $menu;
    }

    /**
     * {@inheritdoc}
     */
    public function has(string $name, array $options = []): bool
    {
        return $name === 'breadcrumb';
    }
}


text:
module.exports = Event

function Event(family) {}

Event.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {
    this.type = type
    this.bubbles = bubbles
    this.cancelable = cancelable
}

Event.prototype.preventDefault = function _Event_preventDefault() {

}


text:
<?php

namespace uk\ac\ox\oppf\www\WSPlate;

class supportsPriority
{

    /**
     * @var Robot $robot
     * @access public
     */
    public $robot = null;

}


text:
module SimplyStore
  module Storage
    def self.included(base)
      base.extend(ClassMethods)
      base.class_eval do
        cattr_accessor :_s3_options
      end
    end

    def s3_connection
      @_s3_connection ||= RightAws::S3.new(AWS_CONFIG[:aws_access_key_id], AWS_CONFIG[:aws_secret_access_key], :multi_thread => true)
    end

    def s3_bucket(name)
      if !@_s3_bucket
        @_s3_bucket = s3_connection.bucket(_s3_options[name][:bucket])
        @_s3_bucket = s3_connection.bucket(_s3_options[name][:bucket], true, 'private') if @_s3_bucket.nil? # create it if it didn't exist, do not do it the first time as the ACL get modified
      end
      @_s3_bucket
    rescue Exception => e
      raise ArgumentError, "Could not access/create S3 bucket '#{name}': #{e} #{e.backtrace.join("\n")}"
    end

    def save
      if ret = super
        save_attachments
      end
      ret
    end

    def save_attachments
      if @_attachments
        @_attachments.each do |name, attachment|
          if attachment[:dirty]
            value = attachment[:value].is_a?(String) ? attachment[:value] : attachment[:value].to_json
            s3_bucket(name).put(s3_attachment_key(name), value, {}, _s3_options[name][:permissions])
            attachment[:dirty] = false
          end
        end
      end
    end

    def s3_attachment_key(name)
      "#{self.class.name.tableize}/#{name}/#{id}"
    end

    module ClassMethods
      def has_s3_attachment(name, options = {})
        name = name.to_sym
        raise ArgumentError, "No bucket name specified for attachment #{name}" if options[:bucket].blank?
        options.update(:permissions => 'private', :ssl => true)
        self._s3_options ||= {}
        self._s3_options[name] = options

        define_attachment_accessors(name)
        attr_reader :_attachments
      end

      def define_attachment_accessors(name)
        define_method(name) do
          unless @_attachments and @_attachments[name]
            @_attachments = {name => {}}
            @_attachments[name][:value] = s3_bucket(name).get(s3_attachment_key(name))
          end
          @_attachments[name][:value]
        end

        define_method("#{name}=") do |value|
          @_attachments ||= {}
          @_attachments[name] ||= {}
          @_attachments[name].update(:value => value, :dirty => true)
          value
        end

        define_method("#{name}_url") do
          if _s3_options[name][:permissions] == 'private'
            RightAws::S3Generator.new(AWS_CONFIG[:aws_access_key_id], AWS_CONFIG[:aws_secret_access_key], :multi_thread => true).bucket(_s3_options[name][:bucket]).get(s3_attachment_key(name), 5.minutes)
          else
            "http://#{_s3_options[name][:bucket].to_s}.s3.amazonaws.com/#{s3_attachment_key(name)}"
          end
        end
      end
    end
  end
end


text:
`$ npm install --save nilssongames-dragonfly`

```js
import NilssongamesDragonfly from 'nilssongames-dragonfly';

export default function Dragonfly() {
  return <NilssongamesDragonfly />;
}
```

# Development
- `$ npm run dev`

# Sprite sheets & assets
- Sprite sheet data should be in JSON format in the `src` folder.
- `meta.image` should be base64 encoded in the sprite sheet JSON.
- There's an `assets` folder but it is *not* used directly in the app, only for saving assets to create/edit sprite sheet JSON.

# Publish
- `$ npm version major|minor|patch`
- `$ npm publish`


text:
<?php
namespace Procure\Infrastructure\Persistence\Helper;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Procure\Infrastructure\Contract\SqlFilterInterface;
use Procure\Infrastructure\Persistence\Filter\QrReportSqlFilter;
use Procure\Infrastructure\Persistence\Reporting\SQL\QrReportSQL;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class QrReportHelper
{

    /**
     *
     * @param EntityManager $doctrineEM
     * @param SqlFilterInterface $filter
     * @param string $sort_by
     * @param string $sort
     * @param int $limit
     * @param int $offset
     * @return NULL|array|mixed|\Doctrine\DBAL\Driver\Statement|NULL
     */
    static public function getList(EntityManager $doctrineEM, SqlFilterInterface $filter, $sort_by, $sort, $limit, $offset)
    {
        if (! $doctrineEM instanceof EntityManager) {
            return null;
        }

        if (! $filter instanceof QrReportSqlFilter) {
            return null;
        }

        $sql = QrReportSQL::QR_LIST;

        if ($filter->getDocStatus() == "all") {
            $filter->docStatus = null;
        }

        if ($filter->getIsActive() == 1) {
            $sql = $sql . " AND nmt_procure_qo.is_active=  1";
        } elseif ($filter->getIsActive() == - 1) {
            $sql = $sql . " AND nmt_procure_qo.is_active = 0";
        }

        if ($filter->getCurrentState() != null) {
            $sql = $sql . " AND nmt_procure_qo.current_state = '" . $filter->getCurrentState() . "'";
        }

        if ($filter->getDocStatus() != null) {
            $sql = $sql . " AND nmt_procure_qo.doc_status = '" . $filter->getDocStatus() . "'";
        }

        $sql = $sql . " GROUP BY nmt_procure_qo.id";

        switch ($sort_by) {
            case "sysNumber":
                $sql = $sql . " ORDER BY nmt_procure_qo.sys_number " . $sort;
                break;

            case "docDate":
                $sql = $sql . " ORDER BY nmt_procure_qo.doc_date " . $sort;
                break;
            case "grossAmount":
                $sql = $sql . " ORDER BY SUM(CASE WHEN nmt_procure_qo_row.is_active =1 THEN (nmt_procure_qo_row.gross_amount) ELSE 0 END) " . $sort;
                break;
            case "createdOn":
                $sql = $sql . " ORDER BY nmt_procure_qo.created_on " . $sort;
                break;
            case "vendorName":
                $sql = $sql . " ORDER BY nmt_procure_qo.vendor_name " . $sort;
                break;
            case "currencyCode":
                $sql = $sql . " ORDER BY nmt_procure_qo.currency_iso3 " . $sort;
                break;
        }

        if ($limit > 0) {
            $sql = $sql . " LIMIT " . $limit;
        }

        if ($offset > 0) {
            $sql = $sql . " OFFSET " . $offset;
        }
        $sql = $sql . ";";

        // echo $sql;
        try {
            $rsm = new ResultSetMappingBuilder($doctrineEM);
            $rsm->addRootEntityFromClassMetadata('\Application\Entity\NmtProcureQo', 'nmt_procure_qo');
            $rsm->addScalarResult("active_row", "active_row");
            $rsm->addScalarResult("total_row", "total_row");
            $rsm->addScalarResult("max_row_number", "max_row_number");
            $rsm->addScalarResult("net_amount", "net_amount");
            $rsm->addScalarResult("tax_amount", "tax_amount");
            $rsm->addScalarResult("gross_amount", "gross_amount");
            $rsm->addScalarResult("gross_discount_amount", "gross_discount_amount");

            $query = $doctrineEM->createNativeQuery($sql, $rsm);

            $result = $query->getResult();
            return $result;
        } catch (NoResultException $e) {
            return null;
        }
    }

    /**
     *
     * @param EntityManager $doctrineEM
     * @param SqlFilterInterface $filter
     * @return NULL|number
     */
    static public function getListTotal(EntityManager $doctrineEM, SqlFilterInterface $filter)
    {
        if (! $doctrineEM instanceof EntityManager) {
            return null;
        }

        if (! $filter instanceof QrReportSqlFilter) {
            return null;
        }

        $sql = QrReportSQL::QR_LIST;

        $sql = QrReportSQL::QR_LIST;

        if ($filter->getDocStatus() == "all") {
            $filter->docStatus = null;
        }

        if ($filter->getIsActive() == 1) {
            $sql = $sql . " AND nmt_procure_qo.is_active=  1";
        } elseif ($filter->getIsActive() == - 1) {
            $sql = $sql . " AND nmt_procure_qo.is_active = 0";
        }

        if ($filter->getCurrentState() != null) {
            $sql = $sql . " AND nmt_procure_qo.current_state = '" . $filter->getCurrentState() . "'";
        }

        if ($filter->getDocStatus() != null) {
            $sql = $sql . " AND nmt_procure_qo.doc_status = '" . $filter->getDocStatus() . "'";
        }

        $sql = $sql . " GROUP BY nmt_procure_qo.id";

        try {
            $rsm = new ResultSetMappingBuilder($doctrineEM);
            $rsm->addRootEntityFromClassMetadata('\Application\Entity\NmtProcureQo', 'nmt_procure_qo');
            $query = $doctrineEM->createNativeQuery($sql, $rsm);
            $result = $query->getResult();
            return count($result);
        } catch (NoResultException $e) {
            return 0;
        }
    }

    /**
     *
     * @param EntityManager $doctrineEM
     * @param SqlFilterInterface $filter
     * @param string $sort_by
     * @param string $sort
     * @param int $limit
     * @param int $offset
     * @return NULL|object
     */
    static public function getAllRow(EntityManager $doctrineEM, SqlFilterInterface $filter, $sort_by, $sort, $limit, $offset)
    {
        if (! $doctrineEM instanceof EntityManager) {
            return null;
        }

        if (! $filter instanceof QrReportSqlFilter) {
            return null;
        }

        $sql = QrReportSQL::ALL_QR_ROW;

        $sql_tmp = '';

        if ($filter->getDocYear() > 0) {
            $sql = $sql . " AND YEAR(nmt_procure_qo.doc_date)=" . $filter->getDocYear();
        }

        if ($filter->getDocMonth() > 0) {
            $sql = $sql . " AND MONTH(nmt_procure_qo.doc_date)=" . $filter->getDocMonth();
        }
        if ($filter->getVendorId() != null) {
            $sql_tmp = $sql_tmp . \sprintf(' AND nmt_procure_qo.vendor_id = %s', $filter->getVendorId());
        }

        switch ($sort_by) {
            case "vendorName":
                $sql = $sql . " ORDER BY nmt_procure_qo.vendor_name " . $sort;
                break;
        }

        if ($limit > 0) {
            $sql = $sql . " LIMIT " . $limit;
        }

        if ($offset > 0) {
            $sql = $sql . " OFFSET " . $offset;
        }

        // echo $sql;

        try {
            $rsm = new ResultSetMappingBuilder($doctrineEM);
            $rsm->addRootEntityFromClassMetadata('\Application\Entity\NmtProcureQoRow', 'nmt_procure_qo_row');
            $query = $doctrineEM->createNativeQuery($sql, $rsm);
            $resulst = $query->getResult();
            return $resulst;
        } catch (NoResultException $e) {
            return null;
        }
    }

    /**
     *
     * @param EntityManager $doctrineEM
     * @param SqlFilterInterface $filter
     * @return NULL|number
     */
    static public function getAllRowTotal(EntityManager $doctrineEM, SqlFilterInterface $filter)
    {
        if (! $doctrineEM instanceof EntityManager) {
            return null;
        }

        if (! $filter instanceof QrReportSqlFilter) {
            return null;
        }

        $sql = QrReportSQL::ALL_QR_ROW;

        $sql_tmp = '';

        if ($filter->getDocYear() > 0) {
            $sql = $sql . " AND YEAR(nmt_procure_qo.doc_date)=" . $filter->getDocYear();
        }

        if ($filter->getDocMonth() > 0) {
            $sql = $sql . " AND MONTH(nmt_procure_qo.doc_date)=" . $filter->getDocMonth();
        }

        if ($filter->getVendorId() != null) {
            $sql_tmp = $sql_tmp . \sprintf(' AND nmt_procure_qo.vendor_id = %s', $filter->getVendorId());
        }

        // echo $sql;

        try {
            $rsm = new ResultSetMappingBuilder($doctrineEM);
            $rsm->addRootEntityFromClassMetadata('\Application\Entity\NmtProcureQoRow', 'nmt_procure_qo_row');
            $query = $doctrineEM->createNativeQuery($sql, $rsm);
            $resulst = $query->getResult();
            return count($resulst);
        } catch (NoResultException $e) {
            return null;
        }
    }
}


text:
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.0.0//EN" "http://www.liferay.com/dtd/liferay-display_6_0_0.dtd">

<display>
    <category name="Oskari">
        <portlet id="Oskari Map" />
    </category>
</display>


text:
<component name="libraryTable">
  <library name="espresso-idling-resource-2.2.2">
    <CLASSES>
      <root url="file://$USER_HOME$/.android/build-cache/af45413974a66070e4585fba26ff25e7ffd26662/output/res" />
      <root url="jar://$USER_HOME$/.android/build-cache/af45413974a66070e4585fba26ff25e7ffd26662/output/jars/classes.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/espresso/espresso-idling-resource/2.2.2/espresso-idling-resource-2.2.2-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
package org.springframework.data.elasticsearch.core;

import java.io.IOException;

/**
 * @author Artur Konczak
 * @author Mohsin Husen
 */
public class CustomEntityMapper implements EntityMapper {

	public CustomEntityMapper() {
		//custom configuration/implementation (e.g. FasterXML/jackson)
	}

	@Override
	public String mapToString(Object object) throws IOException {
		//mapping Object to text
		return null;
	}

	@Override
	public <T> T mapToObject(String source, Class<T> clazz) throws IOException {
		//mapping text to Object
		return null;
	}
}


text:
title: "Visualizing when I'm most productive during the day"
subtitle: "Analyzing my (and others') git activity"
tags: [rstats, shiny]
date: 2016-08-19 11:00:00 -0700
share-img: https://daattali.com/shiny/visualize-git-commits-time/dean-git-plot.png
permalink: /blog/visualize-git-commits-time/
carbonads-sm-horizontal: true
---

Click here to explore the data yourself

Yesterday I saw [this retweet](https://t.co/u3uHy6a9d4) from [@timelyportfolio](https://twitter.com/timelyportfolio) that links to a [gist by @gka](https://gist.github.com/gka/393f5ab2b95e927d305eb6e14767180e).

The gist gave a few short scripts that can show you when your git commits take place during the day. I thought that was cool, so I took it a step (or five) further by writing it all up in R code and made nice wrapper functions for it and added interactive visualizations and made a shiny app... I just had a bit of fun. This is the result.

Note that all commit times are reported as PST timezone.

**TL;DR: I'm dead before 10am --- My prime working time is 2am --- My supervisor Jenny Bryan has a very compatible schedule to mine --- Hadley somehow learned in the past 3 years to be so productive that he doesn't even work on weekends**

This post shows a few plots and discusses them, but it can be more fun to [play with the data yourself](https://daattali.com/shiny/visualize-git-commits-time/).

## Table of contents

- [Explore the data interactively yourself](https://daattali.com/shiny/visualize-git-commits-time/)
- [My work hours since first learning R](#dean-commits)
- [My work hours in the past 6 months](#dean-6-months)
- [Adding marginal density plots to see exactly what times are alive/dead](#dean-density)
- [How's my (ex) supervisor Jenny Bryan doing?](#jenny-commits)
- [And the grand finale: the R master Hadley](#hadley-commits)
- [Working on weekends](#weekends)
- [R code used to generate this data](#code)

# My work hours since first learning R {#dean-commits}

This plot shows the times of all my git commits since Sept 2013, colour-coded by git repo (aka project). If you go the [app hosting this data](https://daattali.com/shiny/visualize-git-commits-time/), you'll see this plot as fully interactive: you can zoom, move, or remove all observations from a specific repo by clicking on the repo name in the legend.

[![Dean commits all](/assets/img/blog/git-commits-time/dean-commits-100.png)](/assets/img/blog/git-commits-time/dean-commits-100.png)

September 2013 is when I first learned R in the beginning of my masters degree, and the project I was working on then ([statsTerrorismProject](https://github.com/daattali/statsTerrorismProject)) was my final project for STAT545.

After taking my introductory R course, I spent the next year on my other masters courses and didn't do any R-ing and coding, hence the giant gap. The next time I used git was when I took the second half of STAT545 in 2014, and that's where I learned how to write a package -- [rsalad](https://github.com/daattali/rsalad) was my first R package, developed as homework. Then I didn't do any open source work for a few months because I was working in a lab that wasn't very supportive of that... And in January 2015 I started working with Jenny as my supervisor, and as you can see, I was pretty much busy with just about everything in the world except for my actual masters project! :)

### A few things that are easy to notice:

- I refuse to work before 10am
- It looks like I work until 2am-4am fairly consistently
- I did a LOT of work on my website ([dattali.github.io](https://daattali.github.io)) around March 2015 (which is when I got the idea to make a website and when I released it)
- There were a few days in July 2015 where I started coding at 6am! Nope, that's a lie, I was in Toronto that week so that's actually 9am...
- It's cool to see when I work on which projects. You can very clearly see the two-week effort on [timevis](https://github.com/daattali/timevis) in July 2016 for example

# My work hours in the past 6 months {#dean-6-months}

[![Dean commits 6 months](/assets/img/blog/git-commits-time/dean-commits-6.png)](/assets/img/blog/git-commits-time/dean-commits-6.png)

### Observations

It's interesting to see how my commits very closely relate to what's going on in my life :)

- During Feb-March I was writing my masters thesis on my package [ddpcr](https://github.com/daattali/ddpcr) and you can see how I had one last burst of work on the package at the end of Feb, and then I completely stopped coding for a few weeks while I focused on writing. I was such a good boy.
- June seems like a dead month. I was in Toronto, Berkeley and Stanford for conferences and didn't code at all. It's cool how clearly that shows up!
- It's nice to see that [shinyjs](https://github.com/daattali/shinyjs) has reached a fairly stable state and I don't have to spend much time on it anymore

# Adding marginal density plots to see exactly what times are alive/dead {#dean-density}

Just for fun, I can use my [ggMarginal()](https://github.com/daattali/ggExtra) function to add marginal density plots, to make it more clear when most of my commits take place.

[![Dean density plot](/assets/img/blog/git-commits-time/dean-density.png)](/assets/img/blog/git-commits-time/dean-density.png)

# How's my (ex) supervisor Jenny Bryan doing? {#jenny-commits}

After working with Jenny for a couple years, I learned that we have very compatible schedules. It was very normal for us to exchange emails past midnight when we had a 9am class the following morning, and I'd often see her making commits at 1-2am when I was just getting in the zone!

With this graph we can see that our schedules really are very similar, although she is shifted 2 hours from me: I work 10am-4am, she works 8am-2am. What an early bird.

[![Jenny commits all](/assets/img/blog/git-commits-time/jenny-commits-100.png)](/assets/img/blog/git-commits-time/jenny-commits-100.png)

# And the grand finale: the R master Hadley {#hadley-commits}

No introduction needed, the name speaks for itself. (Note these are all PST times)

Just one thing I'd like to note: we've all heard "this is going to be the year of 'ggvis'!", yet it looks like 2013 was the year-est of 'ggvis' so far :)

[![Hadley commits all](/assets/img/blog/git-commits-time/hadley-commits-100.png)](/assets/img/blog/git-commits-time/hadley-commits-100.png)

# Working on weekends {#weekends}

If you look at day of the week, you'll see that weekends and weekdays are essentially the same to me.

[![Dean day of week](/assets/img/blog/git-commits-time/dean-days.png)](/assets/img/blog/git-commits-time/dean-days.png)

But what's amazing is that if you look at Hadley, he seems to be such a good time manager that he manages to almost never work on weekends in the past 3 years, despite producing output at a speed of a dozen adults. That discipline of not working on weekends is commendable.

[![Hadley day of week](/assets/img/blog/git-commits-time/hadley-days.png)](/assets/img/blog/git-commits-time/hadley-days.png)

# R code used to generate this data {#code}

If you want to replicate these kinds of plots, here is the exact R code that was used to generate all the plots. The two functions you need to call are `create_git_log_file()` to generate the data file, and then `plot_git_commits()` to visualize the data.

I know this code isn't amazing and could be optimized some more (I especially don't love that I'm using system calls) but I wanted to get this out ASAP because I have real projects I need to work on :)

```r
#' Plot the time or date of your git commits
#'
#' IMPORTANT: Before calling this function, you must use the `create_git_log_file()` function
#' to generate the data file that is used to make the plot!
#' You also need to have 'dplyr', 'git2r', 'ggplot2', 'ggExtra' and 'scales' packages installed.
#'
#' @param logfile The output from `create_git_log_file()`. This is a file containing all the
#'   necessary info for generating the activity plots. You must call `create_git_log_file()`
#'   first to create the data file, and then you can call this plot function to
#'   plot the data based on that file
#' @param num_months How many months back to look at your commits
#' @param plot_type What type of plot to output ("plotly", "ggplot", or "density")
#'   if you choose "density" then the result will be a ggplot2 plot with marginal density plots
#' @param x The variable to plot along the x axis (one of "repo", "time", "date", or "weekday")
#' @param y The variable to plot along the y axis (one of "repo", "time", "date", or "weekday")
plot_git_commits <- function(logfile, num_months = 6,
                             plot_type = c("plotly", "ggplot", "density"),
                             x = "date", y = "time") {
  if (!requireNamespace("dplyr", quietly = TRUE)) {
    stop("You need to install the 'dplyr' package", call. = FALSE)
  }
  if (!requireNamespace("ggplot2", quietly = TRUE)) {
    stop("You need to install the 'ggplot2' package", call. = FALSE)
  }
  if (!requireNamespace("scales", quietly = TRUE)) {
    stop("You need to install the 'scales' package", call. = FALSE)
  }
  if (!requireNamespace("ggExtra", quietly = TRUE)) {
    stop("You need to install the 'ggExtra' package", call. = FALSE)
  }

  plot_type <- match.arg(plot_type)

  if (!file.exists(logfile)) {
    stop("The git log file was not found", call. = FALSE)
  }

  if (!is.numeric(num_months) || num_months < 1) {
    stop("num_months must be a positive integer", call. = FALSE)
  }

  if (x == y || !all(c(x, y) %in% c("repo", "time", "date", "weekday"))) {
    stop('x and y must each be one of "repo", "time", "date" or "weekday" and must be unique', call. = FALSE)
  }

  # read the logfile and transform it into a useful dataframe
  gitdata <- get_git_df(logfile, num_months)

  # plot the result
  plot_git_commits_helper(gitdata, plot_type, x, y)
}

#' Create a data file with all the git commit info of a particular user for some repos
#'
#' In order to create this data file, all the git repos specified have to be cloned to your
#' local machine (this happens automatically). The result of this function is a data file with
#' information about git commits, and this file can be used as input for `plot_git_commit_time()`
#' (which will visualize the times of day commits were made)
#'
#' @param username The git name of the peson to track their commits (if you
#'   commit to git under multiple names, you can pass a vector of names)
#' @param repos A list of all the GitHub repos you want to analyze (all these
#'   repos will get cloned locally
#' @param dir The directory where all the git repos will
#' @param logfile THe name of the data file (the file with all the git lgs
create_git_log_file <- function(
  username = c("Dean Attali", "daattali"),
  repos = c("daattali/beautiful-jekyll",
            "daattali/shinyjs",
            "daattali/timevis",
            "jennybc/bingo"),
  dir ="git_repos_vis",
  logfile = "project-logs.csv") {

  if (!requireNamespace("git2r", quietly = TRUE)) {
    stop("You need to install the 'git2r' package", call. = FALSE)
  }

  if (!dir.exists(dir)) {
    dir.create(dir, recursive = TRUE, showWarnings = FALSE)
  }

  dir <- normalizePath(dir)

  # clone all the git repos into one folder and get their commit messages
  logs <- lapply(repos, function(repo) {
    # get the unique repo
    if (!grepl("/", repo)) {
      stop(repo, " is not a valid repo name (you forgot to specify the user)", call. = FALSE)
    }
    repo_name <- sub(".*/(.*)", replacement = "\\1", repo)
    repo_dir <- file.path(dir, repo_name)

    # clone the repo
    if (dir.exists(repo_dir)) {
      message("Note: Not cloning ", repo, " because a folder with that name already exists")
    } else {
      message("Cloning ", repo)
      repo_url <- paste0("https://github.com/", repo)
      git2r::clone(url = repo_url, local_path = repo_dir,
                   progress = FALSE)
    }

    # get the git log
    repo <- git2r::repository(repo_dir)
    commits <- git2r::commits(repo)

    dates <- unlist(lapply(commits, function(commit) {
      if (commit@author@name %in% username) {
        as.character(as.POSIXlt(commit@author@when@time, origin = "1970-01-01"))
      } else {
        NULL
      }
    }))
    data.frame(project = rep(repo_name, length(dates)),
               timestamp = dates,
               stringsAsFactors = FALSE)
  })

  # write the logs to a file
  logs <- do.call(rbind, logs)
  logfile <- file.path(dir, logfile)
  write.csv(logs, logfile, quote = FALSE, row.names = FALSE)

  if (file.exists(logfile)) {
    message("Created logfile at ", normalizePath(logfile))
  } else {
    stop("The git log file could not get creatd for some reason", call. = FALSE)
  }

  return(logfile)
}

#--- Helper functions ---#

get_git_df <- function(logfile, num_months) {
  library(dplyr)

  date_cutoff <- as.POSIXct(seq(Sys.Date(), length = 2, by = paste0(-num_months, " months"))[2])
  gitdata <- read.csv(logfile, stringsAsFactors = FALSE) %>%
    dplyr::filter(project != "") %>%
    dplyr::mutate(ts = as.POSIXct(timestamp)) %>%
    dplyr::filter(ts >= date_cutoff) %>%
    dplyr::mutate(
      repo = as.factor(project),
      date = as.Date(ts),
      time_short = strftime(ts, format = "%H:%M"),
      time = as.POSIXct(time_short, format = "%H:%M", tz = "UTC"),
      weekday = factor(weekdays(date),
                       levels = c("Monday", "Tuesday", "Wednesday",
                                  "Thursday", "Friday", "Saturday", "Sunday"))
    ) %>%
    dplyr::select(repo, date, time_short, time, weekday) %>%
    droplevels()
  gitdata
}

plot_git_commits_helper <- function(gitdata, plot_type = "plotly", x = "repo", y = "time") {
  # Define a large set of distinct colours
  all_cols <- c(
    "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059", "#000000",
    "#FFDBE5", "#7A4900", "#0000A6", "#B79762", "#004D43", "#8FB0FF", "#63FFAC", "#997D87",
    "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80",
    "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100",
    "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F",
    "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09",
    "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66",
    "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C",
    "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81",
    "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00",
    "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700",
    "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329",
    "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C")

  library(ggplot2)

  p <- ggplot(gitdata, aes_string(x, y, label = "time_short")) +
    geom_point(aes(fill = repo), col = "#555555", size = 5,
               shape = 21, position = position_jitter()) +
    theme_bw(20) +
    xlab(NULL) + ylab(NULL) +
    scale_fill_manual(values = all_cols[seq_along(unique(gitdata$repo))]) +
    theme(legend.position = "bottom")

  if (x == "date") {
    p <- p +
      scale_x_date()
  } else if (x == "time") {
    p <- p +
      scale_x_datetime(labels = scales::date_format("%H:00"), date_breaks = "2 hour")
  } else {
    p <- p + ggExtra::rotateTextX()
  }

  if (y == "date") {
    p <- p +
      scale_y_date()
  } else if (y == "time") {
    p <- p +
      scale_y_datetime(labels = scales::date_format("%H:00"), date_breaks = "2 hour")
  }

  if (plot_type == "plotly") {
    if (!requireNamespace("plotly", quietly = TRUE)) {
      stop("You need to install the 'plotly' package", call. = FALSE)
    }
    if (x == "time") {
      tooltip <- c("fill", "label", "y")
    } else if (y == "time") {
      tooltip <- c("fill", "x", "label")
    } else {
      tooltip <- c("fill", "x", "y")
    }

    p <- plotly::ggplotly(p, tooltip = tooltip)
  } else if (plot_type == "density") {
    p <- ggExtra::ggMarginal(p)
  }

  p
}
```


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import time

from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCase
from mcrouter.test.mock_servers import MockServer

class TimeoutServer(MockServer):
    """A server that responds to requests with 'END' after reading expected
    amount of bytes and waiting for timeout seconds"""
    def __init__(self, expected_key, timeout):
        super(TimeoutServer, self).__init__()
        self.expected_bytes = len("get \r\n")
        self.expected_bytes += len(expected_key)
        self.timeout = timeout
        self.seenRequests = 0

    def runServer(self, client_socket, client_address):
        while not self.is_stopped():
            client_socket.recv(self.expected_bytes)
            self.seenRequests = self.seenRequests + 1
            time.sleep(self.timeout)
            client_socket.send('END\r\n')

    def getSeenRequests(self):
        return self.seenRequests

class TestServerStatsOutstandingRequests(McrouterTestCase):
    config = './mcrouter/test/test_max_shadow_requests.json'
    extra_args = ['-t', '1000000', '--target-max-shadow-requests', '2']

    def setUp(self):
        # The order here must corresponds to the order of hosts in the .json
        self.add_server(Memcached())
        self.timeoutServer = TimeoutServer('test', 0.5)
        self.add_server(self.timeoutServer)
        self.mcrouter = self.add_mcrouter(
            self.config, extra_args=self.extra_args
        )

    def test_max_shadow_requests(self):
        for i in range(0, 10):
            self.mcrouter.get('test')

        time.sleep(1.5)
        self.assertEqual(self.timeoutServer.getSeenRequests(), 2)


text:
<?php

namespace Backend\Modules\ContentBlocks\Tests\Action;

use Common\WebTestCase;

class AddTest extends WebTestCase
{
    public function testAuthenticationIsNeeded(): void
    {
        $client = static::createClient();
        $this->logout($client);

        $client->setMaxRedirects(1);
        $client->request('GET', '/private/en/content_blocks/index');

        // we should get redirected to authentication with a reference to blog index in our url
        self::assertStringEndsWith(
            '/private/en/authentication?querystring=%2Fprivate%2Fen%2Fcontent_blocks%2Findex',
            $client->getHistory()->current()->getUri()
        );
    }

    public function testFormIsDisplayed(): void
    {
        $client = static::createClient();
        $this->login($client);

        $client->request('GET', '/private/en/content_blocks/add');
        self::assertContains(
            'Title<abbr data-toggle="tooltip" aria-label="Required field" title="Required field">*</abbr>',
            $client->getResponse()->getContent()
        );
        self::assertContains(
            'Visible on site',
            $client->getResponse()->getContent()
        );
        self::assertContains(
            'Add content block',
            $client->getResponse()->getContent()
        );
    }
}


text:
if [ X"$PKG_PATH" == X"" ]; then
  export PKG_PATH=http://ftp.OpenBSD.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
fi

case $1 in

  (install):
    echo "Installing packages"
    mkdir /var/db/spamassassin 2>/dev/null
    cat <<__EOT

You will be prompted to install a postfix version. The recommendation is to install
the first version.

Fetching versions:

__EOT
    pkg_add -v -m -i postfix--mysql

    pkg_add -v -m clamav \
     p5-Mail-SpamAssassin \
     ruby-rails \
     ruby-rrd \
     ruby-mysql \
     ruby-mongrel \
     ruby-fastercsv \
     ruby-highline \
     dovecot-mysql \
     dovecot-pigeonhole \
     mysql-server \
     sqlgrey \
     nginx-- \
     god \
     gtar--

   pkg_add -v -m -i php \
     php-mysql \
     php-fastcgi
     ;;

esac


text:
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}

module Stack.PrettyPrint
    (
      -- * Pretty printing functions
      displayPlain, displayWithColor
      -- * Logging based on pretty-print typeclass
    , prettyDebug, prettyInfo, prettyWarn, prettyError
    , debugBracket
      -- * Color utils
      -- | These are preferred to colors directly, so that we can
      -- encourage consistency of color meanings.
    , errorRed, goodGreen, shellMagenta
    , displayTargetPkgId, displayCurrentPkgId, displayErrorPkgId
    , displayMilliseconds
      -- * Formatting utils
    , bulletedList
      -- * Re-exports from "Text.PrettyPrint.Leijen.Extended"
    , Display(..), AnsiDoc, AnsiAnn(..), HasAnsiAnn(..), Doc
    , nest, line, linebreak, group, softline, softbreak
    , align, hang, indent, encloseSep
    , (<+>)
    , hsep, vsep, fillSep, sep, hcat, vcat, fillCat, cat, punctuate
    , fill, fillBreak
    , enclose, squotes, dquotes, parens, angles, braces, brackets
    ) where

import           Control.Exception.Lifted
import           Control.Monad.Logger
import           Control.Monad.Reader
import           Data.List (intersperse)
import           Data.Monoid
import           Data.String (fromString)
import qualified Data.Text as T
import           Language.Haskell.TH
import           Path
import           Stack.Types.Internal
import           Stack.Types.Package
import           Stack.Types.PackageIdentifier
import           Stack.Types.PackageName
import           Stack.Types.Version
import qualified System.Clock as Clock
import           Text.PrettyPrint.Leijen.Extended

displayWithColor
    :: (HasLogOptions env, MonadReader env m, Display a, HasAnsiAnn (Ann a))
    => a -> m T.Text
displayWithColor x = do
    useAnsi <- liftM logUseColor $ view logOptionsL
    return $ if useAnsi then displayAnsi x else displayPlain x

-- TODO: switch to using implicit callstacks once 7.8 support is dropped

prettyDebug :: Q Exp
prettyDebug = do
    loc <- location
    [e| monadLoggerLog loc "" LevelDebug <=< displayWithColor |]

prettyInfo :: Q Exp
prettyInfo = do
    loc <- location
    [e| monadLoggerLog loc "" LevelInfo <=< displayWithColor |]

prettyWarn :: Q Exp
prettyWarn = do
    loc <- location
    [e| monadLoggerLog loc "" LevelWarn <=< displayWithColor . (line <>) . (warningYellow "Warning:" <+>) |]

prettyError :: Q Exp
prettyError = do
    loc <- location
    [e| monadLoggerLog loc "" LevelError <=< displayWithColor . (line <>) . (errorRed "Error:" <+>) |]

debugBracket :: Q Exp
debugBracket = do
    loc <- location
    [e| \msg f -> do
            let output = monadLoggerLog loc "" LevelDebug <=< displayWithColor
            output $ "Start: " <> msg
            start <- liftIO $ Clock.getTime Clock.Monotonic
            x <- f `catch` \ex -> do
                end <- liftIO $ Clock.getTime Clock.Monotonic
                let diff = Clock.diffTimeSpec start end
                output $ "Finished with exception in" <+> displayMilliseconds diff <> ":" <+>
                    msg <> line <>
                    "Exception thrown: " <> fromString (show ex)
                throw (ex :: SomeException)
            end <- liftIO $ Clock.getTime Clock.Monotonic
            let diff = Clock.diffTimeSpec start end
            output $ "Finished in" <+> displayMilliseconds diff <> ":" <+> msg
            return x
      |]

errorRed :: AnsiDoc -> AnsiDoc
errorRed = dullred

warningYellow :: AnsiDoc -> AnsiDoc
warningYellow = yellow

goodGreen :: AnsiDoc -> AnsiDoc
goodGreen = green

shellMagenta :: AnsiDoc -> AnsiDoc
shellMagenta = magenta

displayTargetPkgId :: PackageIdentifier -> AnsiDoc
displayTargetPkgId = cyan . display

displayCurrentPkgId :: PackageIdentifier -> AnsiDoc
displayCurrentPkgId = yellow . display

displayErrorPkgId :: PackageIdentifier -> AnsiDoc
displayErrorPkgId = errorRed . display

instance Display PackageName where
    display = fromString . packageNameString

instance Display PackageIdentifier where
    display = fromString . packageIdentifierString

instance Display Version where
    display = fromString . versionString

instance Display (Path b File) where
    display = bold . white . fromString . toFilePath

instance Display (Path b Dir) where
    display = bold . blue . fromString . toFilePath

instance Display (PackageName, NamedComponent) where
    display = cyan . fromString . T.unpack . renderPkgComponent

-- Display milliseconds.
displayMilliseconds :: Clock.TimeSpec -> AnsiDoc
displayMilliseconds t = goodGreen $
    (fromString . show . (`div` 10^(6 :: Int)) . Clock.toNanoSecs) t <> "ms"

bulletedList :: [AnsiDoc] -> AnsiDoc
bulletedList = mconcat . intersperse line . map ("*" <+>)


text:
cask "font-andika" do
  version "6.101"
  sha256 "8595a879054a540b24fa942a2621efcd194a9f6468d9cf2541ae693e496b8dd4"

  url "https://software.sil.org/downloads/r/andika/Andika-#{version}.zip"
  name "Andika"
  desc "Sans-serif font family designed and optimized for literacy use"
  homepage "https://software.sil.org/andika/"

  livecheck do
    url "https://software.sil.org/andika/download/"
    regex(/href=.*Andika[._-]v?(\d+(?:\.\d+)+)\.zip/i)
  end

  font "Andika-#{version}/Andika-Bold.ttf"
  font "Andika-#{version}/Andika-BoldItalic.ttf"
  font "Andika-#{version}/Andika-Italic.ttf"
  font "Andika-#{version}/Andika-Regular.ttf"
end


text:
I want to thank everyone for attending the our kickoff meeting. I would like to formally change the name to CCOG (Charlotte Container Orchestration Group), which will allow us to talk about the various container orchestration platforms; Docker Swarm, Kubernetes and Mesos to name a few. Eventually, I will be inviting vendors to discuss their solutions to the general group. One of our first vendors in February is Docker, who will speak about their upcoming Universal Control Plane (formally Orca).

# Meetup Format

The format for the meetups will be simple:
Each meeting will be roughly one hour. The first 20-30 minutes will be presentation-based. The remainder of the time will be dedicated towards leader-lead walkthroughs. My goal is to have everyone walking away with code, a POC, demonstration, trial (from a vendor) or some other tangible take-away from the Meetup. Additionally, I would like the "leader-lead" sessions to be informative, but not too complex. If it can be coded easily for the rest of the group, that would be great!

Please bring questions! Some of the material is high level. Some information could be repeated from other presentations; that's perfectly fine. I would like to strengthen our Charlotte community, and I think this is a great way to get everyone on the same level quickly (referring to the tangible walk-throughs)

## Agenda

The agenda today is going to cover a lot, because we have a wide-range of interest. The audience is mixed with Application Developers (who are already familiar with Docker), Network Engineers, Network Security Engineers and Staffing Resources who want to know more about this technology, so they know how to better place talent when tasked with the requirements.

Towards the end of the meeting, I would like to cover a few things:
* Reoccurring Meetup times (ex. First Weds of the month)
* Next months speaker (if nobody, then I would like to determine a topic that would be useful for the group)
* Host for next months Meetup
* Possible vendor that could speak with the group at large

Taking this into consideration, here are some details on the slide presentation and tangible take-aways:

##### Presentation:
**TITLE:** Container Orchestration - How a Network Security Architect Started to Use and Deploy Containers
**AUDIENCE:** Application Developers working with their Network Security Architecture team to deliver a secure container orchestration platform

* Overview of Docker
* Docker Popularity (in Production)
* Light Overview on How to Create Containers
* Container Networking and Security Considerations
 * Deeper Look at Docker Networking
 * Understanding the Impacts and Predictive Control Points
* The Orchestration Stack (key elements that make up the stack)
* How Containers are used in Production
* Overview of the Orchestration Stack Workflow
* Looking at the Container Support Stack

We will discuss a general Kubernetes HA Deployment, like the one pictured below:

![Kubernetes HA Deployment Architecture](https://github.com/v1k0d3n/meetup-ccog/blob/master/001/Kubernetes-HA-Deployment.png)

##### Walk-through Material:
The walk-through will show a Terraform Deployment of a Kubernetes Stack in Openstack, and deep-dive into the Kubernetes architecture, with a focus on the networking/firewall aspects of the hosts/containers.

##### Take-Away Material:
You'll have a few things after the meetup.
1. Consul Docker Container: I built a consul service discovery container, and uploaded this up Docker Hub for your use.
2. Shipyard Docker Containers: I will show you how to launch and use Shipyard.
3. Kubernetes-Terraform Deployment on Openstack: For those of you with access to Openstack, I have created a terraform deployment that you can use to launch a Kubernetes deployment (and modify it to your needs).
4. Kubernetes-Docker via Hyerkube: I will show others how to launch hyperkube and run a k8s cluster by just using a standard Docker host.

That's all we have this meeting! That's a lot of information.

Brandon


text:
#include "tensorflow/dtensor/mlir/spmd_expander.h"

#include <climits>
#include <cstdint>
#include <iterator>
#include <memory>
#include <string>

#include "absl/container/flat_hash_map.h"
#include "absl/strings/str_cat.h"
#include "absl/types/optional.h"
#include "mlir/IR/BuiltinTypes.h"  // from @llvm-project
#include "mlir/IR/OperationSupport.h"  // from @llvm-project
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h"
#include "tensorflow/core/platform/errors.h"
#include "tensorflow/dtensor/cc/constants.h"
#include "tensorflow/dtensor/cc/dstatus.h"
#include "tensorflow/dtensor/cc/tensor_layout.h"
#include "tensorflow/dtensor/mlir/collectives.h"
#include "tensorflow/dtensor/mlir/ir/tf_dtensor.h"
#include "tensorflow/dtensor/mlir/layout_parsing.h"
#include "tensorflow/dtensor/mlir/op_utils.h"
#include "tensorflow/dtensor/mlir/shape_utils.h"
#include "tensorflow/dtensor/mlir/spmd_expander_common.h"
#include "tensorflow/dtensor/proto/layout.pb.h"

namespace tensorflow {
namespace dtensor {

// static
SPMDExpanderRegistry* SPMDExpanderRegistry::Global() {
  static SPMDExpanderRegistry* registry = new SPMDExpanderRegistry();
  return registry;
}

SPMDExpanderBase* SPMDExpanderRegistry::GetPropagateFnForOp(
    mlir::Operation* op) {
  auto key = OpName(op);
  auto fn = op_to_propagate_fn_map_.find(key);
  if (fn == op_to_propagate_fn_map_.end()) return nullptr;
  return fn->second.get();
}

InitOnStartupMarker SPMDExpanderRegistry::RegisterPropagateFn(
    std::string opName, std::unique_ptr<SPMDExpanderBase> prop) {
  CHECK(op_to_propagate_fn_map_  // Crash ok
            .insert_or_assign(opName, std::move(prop))
            .second);
  return {};
}

Status SPMDExpanderBase::ExpandOpAndSetLayout(mlir::Operation* op,
                                              mlir::Operation** output) {
  TF_ASSIGN_OR_RETURN(std::vector<absl::optional<Layout>> computed_layout,
                      ExtractLayoutFromOp(op));

  if (computed_layout.empty() && op->getNumResults() != 0) {
    return errors::InvalidArgument(
        absl::StrCat("No attachced layout found for op : ", OpName(op),
                     " This might be due to an error in layout propagation.")
            .c_str());
  }

  // `op` may be removed/replaced from the graph during SPMD expansion, so
  // extract the global output shape before expansion.
  llvm::SmallVector<llvm::SmallVector<int64_t, 4>, 4> global_output_shapes;
  global_output_shapes.reserve(op->getNumResults());
  for (auto output_value : op->getResults()) {
    auto maybe_ranked =
        output_value.getType().dyn_cast<mlir::RankedTensorType>();
    // Do not extract global shape if the shape isn't statically known.
    //
    // This is a bit subtle and relies on the check of static shape of output
    // value below when extracting local_shape. We probably should consider a
    // placeholder for unknown shapes to avoid surprises in the future.
    //
    // Given the nature of RestoreV2 op and its output ranks, we only special
    // case for RestoreV2 for now.
    if (llvm::isa<mlir::TF::RestoreV2Op, mlir::TF::DTensorRestoreV2Op>(op) &&
        (!maybe_ranked || !maybe_ranked.hasStaticShape()))
      continue;
    TF_ASSIGN_OR_RETURN(auto global_shape,
                        ExtractGlobalOutputShape(output_value));
    global_output_shapes.emplace_back(llvm::SmallVector<int64_t, 4>{
        global_shape.begin(), global_shape.end()});
  }

  TF_ASSIGN_OR_RETURN(*output, this->ExpandOp(op));

  // TODO(hthu): Use ToString() instead.
  SetLayoutOnOp(*output, absl::Span<absl::optional<Layout>>(
                             computed_layout.data(), computed_layout.size()));

  // Verify the local shape of the expanded operation matches the shape expected
  // from the layout. Note that this does **not** catch all errors. When tensor
  // dimension is sharded in a wrong mesh with the same device cardinality as
  // the correct/expected mesh, this check will still pass.
  for (const auto& output_layout_and_index :
       llvm::enumerate(llvm::zip((*output)->getResults(), computed_layout))) {
    const int index = output_layout_and_index.index();
    const auto& output_and_layout = output_layout_and_index.value();

    auto output_value = std::get<0>(output_and_layout);
    // Extract the static shape of `output_value` if possible, otherwise ignore
    // this output.
    auto local_expanded_shape_or_status = GetShapeOfValue(output_value);
    if (!local_expanded_shape_or_status.ok()) continue;

    const auto local_expanded_shape =
        local_expanded_shape_or_status.ValueOrDie();
    const auto& layout = std::get<1>(output_and_layout);
    const auto expected_global_shape =
        layout->GlobalShapeFromLocalShape(local_expanded_shape);

    for (const auto& expanded_and_true_global_shape :
         llvm::zip(global_output_shapes[index], expected_global_shape)) {
      const auto expanded_shape = std::get<0>(expanded_and_true_global_shape);
      const auto expected_shape = std::get<1>(expanded_and_true_global_shape);
      // If any of the shape has unknown dimension, do not check/validate the
      // shape.
      if (expanded_shape <= 0 || expected_shape <= 0) continue;

      if (expanded_shape != expected_shape) {
        return errors::Internal(
            "SPMD expansion resulted in op output inconsistent with the "
            "provided layout.");
      }
    }
  }

  return Status::OK();
}

StatusOr<llvm::DenseMap<int, Layout>> SPMDExpanderBase::ComputeLayoutForward(
    mlir::Operation* op, const llvm::DenseMap<int, Layout>& input_layouts) {
  return errors::Unimplemented(
      "ComputeLayoutForward API must be implemented via the subclass.");
}

StatusOr<llvm::DenseMap<int, Layout>> SPMDExpanderBase::ComputeLayoutForward(
    mlir::Operation* op, const llvm::DenseMap<int, Layout>& input_layouts,
    const llvm::DenseMap<int, Layout>& output_layouts) {
  return ComputeLayoutForward(op, input_layouts);
}

StatusOr<llvm::DenseMap<int, Layout>> SPMDExpanderBase::ComputeLayoutBackward(
    mlir::Operation* op, const llvm::DenseMap<int, Layout>& output_layouts) {
  return errors::Unimplemented(
      "ComputeLayoutBackward API must be implemented via the subclass.");
}

StatusOr<llvm::DenseMap<int, Layout>> SPMDExpanderBase::ComputeLayoutBackward(
    mlir::Operation* op, const llvm::DenseMap<int, Layout>& input_layouts,
    const llvm::DenseMap<int, Layout>& output_layouts) {
  return ComputeLayoutBackward(op, output_layouts);
}

Status RunSPMDExpansion(mlir::Operation* op, mlir::Operation** output) {
  SPMDExpanderBase* expander =
      SPMDExpanderRegistry::Global()->GetPropagateFnForOp(op);
  if (expander != nullptr) {
    return expander->ExpandOpAndSetLayout(op, output);
  } else {
    VLOG(1) << "No expansion found for " << OpName(op) << "\n";
    *output = op;
  }
  return Status::OK();
}

}  // namespace dtensor
}  // namespace tensorflow


text:
\begin {figure}[hbtp]
\centering
\includegraphics[width=\textwidth]{output/R4_1000_ONLY_1_OVER_NCORES/plot_R4_1000_bestmodels.eps}
\caption{Completion time vs ncores for query R4 with datasize 1000GB}
\label{fig:all_nonlinear_R4_1000}
\end {figure}


text:
<?php

abstract class ImageViewColumn extends AbstractWrappedDatasetFieldViewColumn
{
    private $imageHintTemplate = '';
    private $enablePictureZoom = true;

    public function __construct($fieldName, $datasetFieldName, $caption, $dataset, $enablePictureZoom = true)
    {
        parent::__construct($fieldName, $datasetFieldName, $caption, $dataset, false);
        $this->enablePictureZoom = $enablePictureZoom;
    }

    public function GetEnablePictureZoom()
    {
        return $this->enablePictureZoom;
    }

    public function SetEnablePictureZoom($value)
    {
        $this->enablePictureZoom = $value;
    }

    public function SetImageHintTemplate($value)
    {
        $this->imageHintTemplate = $value;
    }

    public function GetImageHintTemplate()
    {
        return $this->imageHintTemplate;
    }

    abstract public function GetImageLink();

    public function GetFullImageLink()
    {
        return $this->getImageLink();
    }

    public function GetImageHint()
    {
        return $this->imageHintTemplate;
    }

    public function generateImageSizeString() {
        return '';
    }

}


text:
<?php defined('BASEPATH')OR exit('akses di tolak');
/**
 *
 */
class User_proyek extends CI_Controller
{

  function __construct()
  {
    parent::__construct();
  }

  public function index()
  {
    $this->load->view('attribute/header_user');
    $this->load->view('user/project');
    $this->load->view('attribute/footer_user');
  }
}
 ?>


text:
package com.cloudera.sqoop.manager;

import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.Formatter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.hadoop.conf.Configuration;
import com.cloudera.sqoop.SqoopOptions;
import com.cloudera.sqoop.testutil.ManagerCompatTestCase;
import org.junit.Test;

import static org.junit.Assert.fail;

/**
 * Test the basic Oracle connection manager with the various column types.
 */
public class OracleCompatTest extends ManagerCompatTestCase {

  public static final Log LOG = LogFactory.getLog(
      OracleCompatTest.class.getName());

  @Override
  protected Log getLogger() {
    return LOG;
  }

  @Override
  protected String getDbFriendlyName() {
    return "Oracle";
  }

  @Override
  protected String getConnectString() {
    return OracleUtils.CONNECT_STRING;
  }

  @Override
  protected SqoopOptions getSqoopOptions(Configuration conf) {
    SqoopOptions opts = new SqoopOptions(conf);
    OracleUtils.setOracleAuth(opts);
    return opts;

  }

  @Override
  protected void dropTableIfExists(String table) throws SQLException {
    OracleUtils.dropTable(table, getManager());
  }

  @Override
  public void tearDown() {
    super.tearDown();

    // If we actually ran the test, we'll need to 'cool off' afterwards.
    if (!skipped) {
      // Oracle XE will block connections if you create new ones too quickly.
      // See http://forums.oracle.com/forums/thread.jspa?messageID=1145120
      LOG.info("Sleeping to wait for Oracle connection cache clear...");
      try {
        Thread.sleep(250);
      } catch (InterruptedException ie) {
        // This delay may run a bit short.. no problem.
      }
    }
  }

  @Override
  protected String getDoubleType() {
    return "DOUBLE PRECISION";
  }

  @Override
  protected String getVarBinaryType() {
    return "RAW(12)";
  }

  // Oracle does not provide a BOOLEAN type.
  @Override
  protected boolean supportsBoolean() {
    return false;
  }

  // Oracle does not provide a BIGINT type.
  @Override
  protected boolean supportsBigInt() {
    return false;
  }

  // Oracle does not provide a TINYINT type.
  @Override
  protected boolean supportsTinyInt() {
    return false;
  }

  // Oracle does not provide a LONGVARCHAR type.
  @Override
  protected boolean supportsLongVarChar() {
    return false;
  }

  // Oracle does not provide a TIME type. We test DATE and TIMESTAMP
  @Override
  protected boolean supportsTime() {
    return false;
  }

  @Override
  protected String getDateInsertStr(String dateStr) {
    return "TO_DATE(" + dateStr + ", 'YYYY-MM-DD')";
  }

  @Override
  protected String getTimestampInsertStr(String tsStr) {
    return "TO_TIMESTAMP(" + tsStr + ", 'YYYY-MM-DD HH24:MI:SS.FF')";
  }

  @Override
  protected String getDateSeqOutput(String asInserted) {
    // DATE is actually a TIMESTAMP in Oracle; add a time component.
    return asInserted + " 00:00:00.0";
  }

  @Override
  protected String getFixedCharSeqOut(int fieldWidth, String asInserted) {
    return padString(fieldWidth, asInserted);
  }

  @Override
  protected String getRealSeqOutput(String realAsInserted) {
    return realAsInserted;
  }

  @Override
  protected String getFloatSeqOutput(String floatAsInserted) {
    return floatAsInserted;
  }

  @Override
  protected String getDoubleSeqOutput(String doubleAsInserted) {
    return doubleAsInserted;
  }

  @Override
  protected String getVarBinarySeqOutput(String asInserted) {
    return toLowerHexString(asInserted);
  }

  @Override
  protected String getBlobInsertStr(String blobData) {
    // Oracle wants blob data encoded as hex (e.g. '01fca3b5').

    StringBuilder sb = new StringBuilder();
    sb.append("'");

    Formatter fmt = new Formatter(sb);
    try {
      for (byte b : blobData.getBytes("UTF-8")) {
        fmt.format("%02X", b);
      }
    } catch (UnsupportedEncodingException uee) {
      // Should not happen; Java always supports UTF-8.
      fail("Could not get utf-8 bytes for blob string");
      return null;
    }
    sb.append("'");
    return sb.toString();
  }

  protected String getBinaryFloatInsertStr(float f) {
    return "TO_BINARY_FLOAT('" + f + "')";
  }

  protected String getBinaryDoubleInsertStr(double d) {
    return "TO_BINARY_DOUBLE('" + d + "')";
  }

  // Disable this test since Oracle isn't ANSI compliant.
  @Override
  @Test
  public void testEmptyStringCol() {
    this.skipped = true;
    LOG.info(
        "Oracle treats empty strings as null (non-ANSI compliant). Skipping.");
  }

  @Override
  @Test
  public void testTimestamp1() {
    verifyType(getTimestampType(),
        getTimestampInsertStr("'2009-04-24 18:24:00'"),
        "2009-04-24 18:24:00.0");
  }

  @Override
  @Test
  public void testTimestamp2() {
    verifyType(getTimestampType(),
        getTimestampInsertStr("'2009-04-24 18:24:00.0002'"),
        "2009-04-24 18:24:00.0002");
  }

  @Override
  @Test
  public void testDate1() {
    verifyType("DATE", getDateInsertStr("'2009-01-12'"),
        getDateSeqOutput("2009-01-12"));
  }

  @Override
  @Test
  public void testDate2() {
    verifyType("DATE", getDateInsertStr("'2009-04-24'"),
        getDateSeqOutput("2009-04-24"));
  }

  @Test
  public void testRawVal() {
    verifyType("RAW(8)", "'12ABCD'", getVarBinarySeqOutput("12ABCD"), true);
  }

  @Test
  public void testBinaryFloat() {
    verifyType("BINARY_FLOAT", getBinaryFloatInsertStr(25f), "25.0");
    verifyType("BINARY_FLOAT", getBinaryFloatInsertStr(+6.34f), "6.34");

    // Max and min are from Oracle DB SQL reference for 10g release 2
    float max = 3.40282E+38F;
    verifyType("BINARY_FLOAT", getBinaryFloatInsertStr(max), "3.40282E38");
    float min = 1.17549E-38F;
    verifyType("BINARY_FLOAT", getBinaryFloatInsertStr(min), "1.17549E-38");
  }

  @Test
  public void testBinaryDouble() {
    verifyType("BINARY_DOUBLE", getBinaryDoubleInsertStr(0.5d), "0.5");
    verifyType("BINARY_DOUBLE", getBinaryDoubleInsertStr(-1d), "-1.0");

    // Max and min are from Oracle DB SQL reference for 10g release 2
    double max = 1.79769313486231E+308;
    verifyType("BINARY_DOUBLE", getBinaryDoubleInsertStr(max),
        "1.79769313486231E308");
    double min = 2.22507485850720E-308;
    verifyType("BINARY_DOUBLE", getBinaryDoubleInsertStr(min),
        "2.2250748585072E-308");
  }
}