text:
<?php

namespace Laminas\View\Helper;

use Laminas\View\Exception;
use Laminas\View\Model\ModelInterface as Model;

/**
 * Helper for rendering child view models
 *
 * Finds children matching "capture-to" values, and renders them using the
 * composed view instance.
 */
class RenderChildModel extends AbstractHelper
{
    /**
     * Current view model
     *
     * @var Model
     */
    protected $current;

    /**
     * View model helper instance
     *
     * @var ViewModel
     */
    protected $viewModelHelper;

    /**
     * Invoke as a function
     *
     * Proxies to {render()}.
     *
     * @param  string $child
     * @return string
     */
    public function __invoke($child)
    {
        return $this->render($child);
    }

    /**
     * Render a model
     *
     * If a matching child model is found, it is rendered. If not, an empty
     * string is returned.
     *
     * @param  string $child
     * @return string
     */
    public function render($child)
    {
        $model = $this->findChild($child);
        if (! $model) {
            return '';
        }

        $current = $this->current;
        $view    = $this->getView();
        $return  = $view->render($model);
        $helper  = $this->getViewModelHelper();
        $helper->setCurrent($current);

        return $return;
    }

    /**
     * Find the named child model
     *
     * Iterates through the current view model, looking for a child model that
     * has a captureTo value matching the requested $child. If found, that child
     * model is returned; otherwise, a boolean false is returned.
     *
     * @param  string $child
     * @return false|Model
     */
    protected function findChild($child)
    {
        $this->current = $model = $this->getCurrent();
        foreach ($model->getChildren() as $childModel) {
            if ($childModel->captureTo() == $child) {
                return $childModel;
            }
        }

        return false;
    }

    /**
     * Get the current view model
     *
     * @throws Exception\RuntimeException
     * @return null|Model
     */
    protected function getCurrent()
    {
        $helper = $this->getViewModelHelper();
        if (! $helper->hasCurrent()) {
            throw new Exception\RuntimeException(sprintf(
                '%s: no view model currently registered in renderer; cannot query for children',
                __METHOD__
            ));
        }

        return $helper->getCurrent();
    }

    /**
     * Retrieve the view model helper
     *
     * @return ViewModel
     */
    protected function getViewModelHelper()
    {
        if ($this->viewModelHelper) {
            return $this->viewModelHelper;
        }

        if (method_exists($this->getView(), 'plugin')) {
            $this->viewModelHelper = $this->view->plugin('view_model');
        }

        return $this->viewModelHelper;
    }
}


text:
using System.Collections.Generic;
using Azure.Core;

namespace Azure.ResourceManager.DataMigration.Models
{
    /// <summary> Properties for the task that collects user tables for the given list of databases. </summary>
    public partial class GetUserTablesSqlTaskProperties : ProjectTaskProperties
    {
        /// <summary> Initializes a new instance of GetUserTablesSqlTaskProperties. </summary>
        public GetUserTablesSqlTaskProperties()
        {
            Output = new ChangeTrackingList<GetUserTablesSqlTaskOutput>();
            TaskType = TaskType.GetUserTablesSql;
        }

        /// <summary> Initializes a new instance of GetUserTablesSqlTaskProperties. </summary>
        /// <param name="taskType"> Task type. </param>
        /// <param name="errors"> Array of errors. This is ignored if submitted. </param>
        /// <param name="state"> The state of the task. This is ignored if submitted. </param>
        /// <param name="commands">
        /// Array of command properties.
        /// Please note <see cref="CommandProperties"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
        /// The available derived classes include <see cref="MigrateMISyncCompleteCommandProperties"/>, <see cref="MigrateSyncCompleteCommandProperties"/>, <see cref="MongoDBCancelCommand"/>, <see cref="MongoDBFinishCommand"/> and <see cref="MongoDBRestartCommand"/>.
        /// </param>
        /// <param name="clientData"> Key value pairs of client data to attach meta data information to task. </param>
        /// <param name="input"> Task input. </param>
        /// <param name="output"> Task output. This is ignored if submitted. </param>
        /// <param name="taskId"> Task id. </param>
        internal GetUserTablesSqlTaskProperties(TaskType taskType, IReadOnlyList<ODataError> errors, TaskState? state, IReadOnlyList<CommandProperties> commands, IDictionary<string, string> clientData, GetUserTablesSqlTaskInput input, IReadOnlyList<GetUserTablesSqlTaskOutput> output, string taskId) : base(taskType, errors, state, commands, clientData)
        {
            Input = input;
            Output = output;
            TaskId = taskId;
            TaskType = taskType;
        }

        /// <summary> Task input. </summary>
        public GetUserTablesSqlTaskInput Input { get; set; }
        /// <summary> Task output. This is ignored if submitted. </summary>
        public IReadOnlyList<GetUserTablesSqlTaskOutput> Output { get; }
        /// <summary> Task id. </summary>
        public string TaskId { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
require("dotenv").config();
var assert = require("assert");

function getEnv (variableName, required) {
    if (required && process.env.NODE_ENV !== "test") {
        assert(process.env[variableName], `Envrironment variable ${variableName} must be defined`);
    }
    return process.env[variableName];
}

export const LOG_DIR = getEnv("LOG_DIR") || "log/";
export const LOG_LEVEL = getEnv("LOG_LEVEL") || "info";
export const STRAVA_CLIENT_ID = getEnv("STRAVA_CLIENT_ID", true);
export const STRAVA_ACCESS_TOKEN = getEnv("STRAVA_ACCESS_TOKEN", true);
export const STRAVA_CLIENT_SECRET = getEnv("STRAVA_CLIENT_SECRET", true);
export const STRAVA_REDIRECT_URI = getEnv("STRAVA_REDIRECT_URI", true);
export const SLACK_TOKEN = getEnv("SLACK_TOKEN", true);
export const DB_URL = getEnv("DB_URL", true);
export const TOKEN_EXPIRE_MINUTES = getEnv("TOKEN_EXPIRE_MINUTES") || 5;


text:
package com.vmware.vim25;

/**
 * @author Steve Jin (http://www.doublecloud.org)
 * @version 5.1
 */

@SuppressWarnings("all")
public class BlockedByFirewall extends HostConfigFault {
}


text:
package com.intellij.codeInsight.generation.actions;

import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.impl.LaterInvocator;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;

public class GenerateAction extends DumbAwareAction {
  @Override
  public void actionPerformed(@NotNull final AnActionEvent e) {
    DataContext dataContext = e.getDataContext();

    Project project = Objects.requireNonNull(getEventProject(e));
    final ListPopup popup =
      JBPopupFactory.getInstance().createActionGroupPopup(
          CodeInsightBundle.message("generate.list.popup.title"),
                                                          wrapGroup(getGroup(), dataContext, project),
                                                          dataContext,
                                                          JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                                                          false);

    popup.showInBestPositionFor(dataContext);
  }

  @Override
  public void update(@NotNull AnActionEvent event){
    Presentation presentation = event.getPresentation();
    if (ActionPlaces.isPopupPlace(event.getPlace())) {
      presentation.setEnabledAndVisible(isEnabled(event));
    }
    else {
      presentation.setEnabled(isEnabled(event));
    }
  }

  private static boolean isEnabled(@NotNull AnActionEvent event) {
    Project project = event.getProject();
    if (project == null) {
      return false;
    }

    Editor editor = event.getData(CommonDataKeys.EDITOR);
    if (editor == null) {
      return false;
    }

    boolean groupEmpty = ActionGroupUtil.isGroupEmpty(getGroup(), event, LaterInvocator.isInModalContext());
    return !groupEmpty;
  }

  private static DefaultActionGroup getGroup() {
    return (DefaultActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_GENERATE);
  }

  private static DefaultActionGroup wrapGroup(DefaultActionGroup actionGroup, DataContext dataContext, @NotNull Project project) {
    final DefaultActionGroup copy = new DefaultActionGroup();
    for (final AnAction action : actionGroup.getChildren(null)) {
      if (DumbService.isDumb(project) && !action.isDumbAware()) {
        continue;
      }

      if (action instanceof GenerateActionPopupTemplateInjector) {
        final AnAction editTemplateAction = ((GenerateActionPopupTemplateInjector)action).createEditTemplateAction(dataContext);
        if (editTemplateAction != null) {
          copy.add(new GenerateWrappingGroup(action, editTemplateAction));
          continue;
        }
      }
      if (action instanceof DefaultActionGroup) {
        copy.add(wrapGroup((DefaultActionGroup)action, dataContext, project));
      }
      else {
        copy.add(action);
      }
    }
    return copy;
  }

  private static class GenerateWrappingGroup extends ActionGroup {

    private final AnAction myAction;
    private final AnAction myEditTemplateAction;

    GenerateWrappingGroup(AnAction action, AnAction editTemplateAction) {
      myAction = action;
      myEditTemplateAction = editTemplateAction;
      copyFrom(action);
      setPopup(true);
    }

    @Override
    public boolean canBePerformed(@NotNull DataContext context) {
      return true;
    }

    @Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
      return new AnAction[] {myEditTemplateAction};
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      DumbService.getInstance(Objects.requireNonNull(getEventProject(e)))
        .withAlternativeResolveEnabled(() -> myAction.actionPerformed(e));
    }

    @Override
    public void update(@NotNull AnActionEvent e) {
      myAction.update(e);
    }
  }
}


text:
//
//  PassWordTextView.h
//  YuWaShop
//
//  Created by double on 17/3/23.
//  Copyright © 2017年 Shanghai DuRui Information Technology Company. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface PassWordTextView : UIView
/**
 the password is user inputed
 */
@property (nonatomic, copy) void(^passwordDidChangeBlock)(NSString *password);

@property (nonatomic,copy) void(^passWordTextViewBlock)();
/**
 set element count, default is 4, remove all elements and creat new elemets when it was set
 */
@property (nonatomic, assign) NSInteger elementCount;

/**
 set element color, default is balck color
 */
@property (nonatomic, strong) UIColor *elementBorderColor;

/**
 set element margein, default is 4 point
 */
@property (nonatomic, assign) CGFloat elementMargin;

/**
 auto hide the keyboard when input password was completed, default is YES
 */
@property (nonatomic, assign) BOOL autoHideKeyboard;

/**
 set element border width, default's 1 point
 */
@property (nonatomic, assign) CGFloat elementBorderWidth;

/**
 clear all password
 */
- (void)clearPassword;

- (void)showKeyboard;

- (void)hideKeyboard;
@end


text:
using namespace ATL;

// CMyAddIn

// AddIn GUID Must be unique!
// {3CE1FCC9-6345-4367-94D4-31C701B06AEC}
DEFINE_GUID(CLSID_MyAddIn, 0x3ce1fcc9, 0x6345, 0x4367, 0x94, 0xd4, 0x31, 0xc7, 0x1, 0xb0, 0x6a, 0xec);

class ATL_NO_VTABLE CMyAddIn :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CMyAddIn, &CLSID_MyAddIn>,
	public ISolidEdgeAddIn,
	//public ISEAddInEvents, public SolidEdgeCommunity::CEventSink<ISEAddInEvents>,
	public ISEAddInEventsEx, public SolidEdgeCommunity::CEventSink<ISEAddInEventsEx>, // Added in ST6
	public ISEApplicationEvents, public SolidEdgeCommunity::CEventSink<ISEApplicationEvents>
	//public ISEApplicationWindowEvents, public CEventSink<ISEApplicationWindowEvents>,
	//public ISEFeatureLibraryEvents, public CEventSink<ISEFeatureLibraryEvents>,
	//public ISEFileUIEvents, public CEventSink<ISEFileUIEvents>,
	//public ISENewFileUIEvents, public CEventSink<ISENewFileUIEvents>,
	//public ISEECEvents, public CEventSink<ISEECEvents>,
	//public ISEShortCutMenuEvents, public CEventSink<ISEShortCutMenuEvents>
{
public:
	CMyAddIn() :
		//CEventSink<ISEAddInEvents>(this),
		CEventSink<ISEAddInEventsEx>(this),
		CEventSink<ISEApplicationEvents>(this)
		//CEventSink<ISEApplicationWindowEvents>(this),
		//CEventSink<ISEFeatureLibraryEvents>(this),
		//CEventSink<ISEFileUIEvents>(this),
		//CEventSink<ISENewFileUIEvents>(this),
		//CEventSink<ISEECEvents>(this),
		//CEventSink<ISEShortCutMenuEvents>(this)
	{
	}

	DECLARE_REGISTRY_RESOURCEID(IDR_MYADDIN)

	BEGIN_COM_MAP(CMyAddIn)
		COM_INTERFACE_ENTRY(ISolidEdgeAddIn)
		//COM_INTERFACE_ENTRY(ISEAddInEvents)
		COM_INTERFACE_ENTRY(ISEAddInEventsEx)
		COM_INTERFACE_ENTRY(ISEApplicationEvents)
		//COM_INTERFACE_ENTRY(ISEApplicationWindowEvents)
		//COM_INTERFACE_ENTRY(ISEFeatureLibraryEvents)
		//COM_INTERFACE_ENTRY(ISEFileUIEvents)
		//COM_INTERFACE_ENTRY(ISENewFileUIEvents)
		//COM_INTERFACE_ENTRY(ISEECEvents)
		//COM_INTERFACE_ENTRY(ISEShortCutMenuEvents)
	END_COM_MAP()

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		AFX_MANAGE_STATE(AfxGetStaticModuleState());

#pragma region ResourceFilename

		// Build path to .dll that contains the resources.
		HINSTANCE hInstance = AfxGetResourceHandle();
		TCHAR ResourceFilename[MAX_PATH];
		GetModuleFileName(hInstance, ResourceFilename, sizeof(ResourceFilename));

		m_strResourceFilename = ResourceFilename;

#pragma endregion

#pragma region CommandPrefix

		// Build the command prefix for uniqueness.
		const int GUID_STRING_LENGTH = 40;
		OLECHAR szGuid[GUID_STRING_LENGTH] = { 0 };
		::StringFromGUID2(CLSID_MyAddIn, szGuid, GUID_STRING_LENGTH);
		CString csGuid(szGuid);
		m_strCommandPrefix = csGuid.Mid(1, 8);

#pragma endregion

		m_bBoundingBox = false;
		m_bOpenGLBoxes = false;

		return S_OK;
	}

	void FinalRelease()
	{
	}

private:
	ApplicationPtr m_pApplication;
	AddInPtr m_pAddIn;
	ISEAddInExPtr m_pSEAddInEx;
	CString m_strResourceFilename;
	CString m_strCommandPrefix;
	bool m_bBoundingBox;
	bool m_bOpenGLBoxes;

protected:

public:

	static void OnDllRegisterServer();
	static void OnDllUnregisterServer();

#pragma region ISolidEdgeAddIn

	STDMETHOD (raw_OnConnection) (LPDISPATCH Application, SeConnectMode ConnectMode, AddIn * AddInInstance);
	STDMETHOD (raw_OnConnectToEnvironment) (BSTR EnvCatID, LPDISPATCH pEnvironmentDispatch, VARIANT_BOOL bFirstTime);
	STDMETHOD (raw_OnDisconnection) (SeDisconnectMode DisconnectMode);

#pragma endregion

#pragma region ISEAddInEvents

	//STDMETHOD (raw_OnCommand) (long nCmdID);
	//STDMETHOD (raw_OnCommandHelp) (long hFrameWnd, long uHelpCommand, long nCmdID);
	//STDMETHOD (raw_OnCommandUpdateUI) (long nCmdID, long *lCmdFlags, BSTR *MenuItemText, long *nIDBitmap);

#pragma endregion

#pragma region ISEAddInEventsEx

	STDMETHOD (raw_OnCommand) (long nCmdID );
	STDMETHOD (raw_OnCommandHelp) (long hFrameWnd, long uHelpCommand, long nCmdID);
	STDMETHOD (raw_OnCommandUpdateUI) (long nCmdID,  long *lCmdFlags, BSTR *MenuItemText, long *nIDBitmap);
	STDMETHOD (raw_OnCommandOnLineHelp) (long uHelpCommand, long nCmdID, BSTR* HelpURL);

#pragma endregion

#pragma region ISEApplicationEvents

	STDMETHOD (raw_AfterActiveDocumentChange) (LPDISPATCH theDocument);
	STDMETHOD (raw_AfterCommandRun) (long theCommandID);
	STDMETHOD (raw_AfterDocumentOpen) (LPDISPATCH theDocument);
	STDMETHOD (raw_AfterDocumentPrint) (LPDISPATCH theDocument, long hDC, double *ModelToDC, long *Rect);
	STDMETHOD (raw_AfterDocumentSave) (LPDISPATCH theDocument);
	STDMETHOD (raw_AfterEnvironmentActivate) (LPDISPATCH theEnvironment);
	STDMETHOD (raw_AfterNewDocumentOpen) (LPDISPATCH theDocument);
	STDMETHOD (raw_AfterNewWindow) (LPDISPATCH theWindow);
	STDMETHOD (raw_AfterWindowActivate) (LPDISPATCH theWindow);
	STDMETHOD (raw_BeforeCommandRun) (long theCommandID);
	STDMETHOD (raw_BeforeDocumentClose) (LPDISPATCH theDocument);
	STDMETHOD (raw_BeforeDocumentPrint) (LPDISPATCH theDocument, long hDC, double *ModelToDC, long *Rect);
	STDMETHOD (raw_BeforeEnvironmentDeactivate) (LPDISPATCH theEnvironment);
	STDMETHOD (raw_BeforeWindowDeactivate) (LPDISPATCH theWindow);
	STDMETHOD (raw_BeforeQuit) (void);
	STDMETHOD (raw_BeforeDocumentSave) (LPDISPATCH theDocument);

#pragma endregion

#pragma region ISEApplicationWindowEvents

	STDMETHOD (raw_WindowProc) (long hWnd, long nMsg, long wParam, long lParam);

#pragma endregion

#pragma region ISEFeatureLibraryEvents

      STDMETHOD (raw_AfterFeatureLibraryDocumentCreated) (BSTR Name);
      STDMETHOD (raw_AfterFeatureLibraryDocumentRenamed) (BSTR NewName, BSTR OldName);
      STDMETHOD (raw_AfterFeatureLibraryDocumentDeleted) (BSTR Name);

#pragma endregion

#pragma region ISEFileUIEvents

      STDMETHOD (raw_OnFileOpenUI) (BSTR * Filename, BSTR * AppendToTitle);
      STDMETHOD (raw_OnFileSaveAsUI) (BSTR * Filename, BSTR * AppendToTitle);
      STDMETHOD (raw_OnFileNewUI) (BSTR * Filename, BSTR * AppendToTitle);
      STDMETHOD (raw_OnFileSaveAsImageUI) (BSTR * Filename, BSTR * AppendToTitle, long * Width, long * Height, enum SeImageQualityType * ImageQuality);
      STDMETHOD (raw_OnPlacePartUI) (BSTR * Filename, BSTR * AppendToTitle);
      STDMETHOD (raw_OnCreateInPlacePartUI) (BSTR * Filename, BSTR * AppendToTitle, BSTR * Template);

#pragma endregion

#pragma region ISENewFileUIEvents

      STDMETHOD (raw_OnNewFileUI) (enum DocumentTypeConstants DocumentType, BSTR * Filename, BSTR * AppendToTitle);

#pragma endregion

#pragma region ISEECEvents

      STDMETHOD (raw_SEEC_IsPreCPDEventSupported) (VARIANT_BOOL * pvbPreCPDEventSupported);
      STDMETHOD (raw_SEEC_BeforeCPDDisplay) (IDispatch * pCPDInitializer, enum eCPDMode eCPDMode);
      STDMETHOD (raw_PDM_OnFileOpenUI) (BSTR * bstrFilename);

#pragma endregion

#pragma region ISEShortCutMenuEvents

      STDMETHOD (raw_BuildMenu) (BSTR EnvCatID, enum ShortCutMenuContextConstants Context, IDispatch * pGraphicDispatch, SAFEARRAY * * MenuStrings, SAFEARRAY * * CommandIDs);

#pragma endregion

private:

#pragma region CMyAddIn private methods

	HRESULT CreateRibbon(GUID environmentGuid, EnvironmentPtr pEnvironment, VARIANT_BOOL bFirstTime);

#pragma endregion

protected:
	CEdgeBarControllerObj* m_pEdgeBarController;
	CMyViewOverlayObj* m_pMyViewOverlay;
};

OBJECT_ENTRY_AUTO(CLSID_MyAddIn, CMyAddIn)


text:
package org.wso2.carbon.stream.processor.statistics.internal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.config.ConfigurationException;
import org.wso2.carbon.config.provider.ConfigProvider;
import org.wso2.carbon.kernel.config.model.CarbonConfiguration;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * This is a bean class for keeping the worker general details.
 */
public class WorkerGeneralDetails {
    private static final Log logger = LogFactory.getLog(WorkerGeneralDetails.class);
    private static WorkerGeneralDetails instance = new WorkerGeneralDetails();
    private String carbonId;
    private String javaRuntimeName;
    private String javaVMVersion;
    private String javaVMVendor;
    private String javaHome;
    private String javaVersion;
    private String osName;
    private String osVersion;
    private String userHome;
    private String userTimezone;
    private String userName;
    private String userCountry;
    private String repoLocation;
    private String serverStartTime;

    private WorkerGeneralDetails() {
        init();
    }

    public static WorkerGeneralDetails getInstance(){
        return instance;
    }

    private void init() {
        SimpleDateFormat dateFormatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z");
        repoLocation = System.getProperty("carbon.home") + "/deployment";
        serverStartTime = dateFormatter.format(new Date(Long.parseLong(System.getProperty("carbon.start.time"))));
        javaRuntimeName = System.getProperty("java.runtime.name");
        javaVMVersion = System.getProperty("java.vm.version");
        javaVMVendor = System.getProperty("java.vm.vendor");
        javaVersion = System.getProperty("java.version");
        userCountry = System.getProperty("user.country");
        userHome = System.getProperty("user.home");
        userTimezone = System.getProperty("user.timezone");
        userName = System.getProperty("user.name");
        osName = System.getProperty("os.name");
        osVersion = System.getProperty("os.version");
        javaHome = System.getProperty("java.home");
        carbonId = getCarbonID();
    }

    private String getCarbonID() {
        try {
            ConfigProvider configProvider = StreamProcessorStatisticDataHolder.getInstance().getConfigProvider();
            CarbonConfiguration carbonConfiguration = configProvider.getConfigurationObject(CarbonConfiguration.class);
            return carbonConfiguration.getId();
        } catch (ConfigurationException e) {
            logger.error("Error in fetching data from carbon config provider.",e);
        }

        return getDefaultSource();
    }

    /**
     * A utility method to provide a default source value
     *
     * @return The default source, if it is available, otherwise return the hostname. If the hostname is also not
     * available, it will return "Carbon".
     */
    private static String getDefaultSource() {
            // Use host name if available
            String hostname = null;
            try {
                hostname = InetAddress.getLocalHost().getHostName();
            } catch (UnknownHostException e) {
                // Ignore exception
            }
            if (hostname == null || hostname.trim().length() == 0) {
               return  "Carbon";
            } else {
                return hostname;
            }
    }

    public String getJavaRuntimeName() {
        return javaRuntimeName;
    }

    public String getJavaVMVersion() {
        return javaVMVersion;
    }

    public String getJavaVMVendor() {
        return javaVMVendor;
    }

    public String getJavaHome() {
        return javaHome;
    }

    public String getJavaVersion() {
        return javaVersion;
    }

    public String getOsName() {
        return osName;
    }

    public String getOsVersion() {
        return osVersion;
    }

    public String getUserHome() {
        return userHome;
    }

    public String getUserTimezone() {
        return userTimezone;
    }

    public String getUserName() {
        return userName;
    }

    public String getUserCountry() {
        return userCountry;
    }

    public String getRepoLocation() {
        return repoLocation;
    }

    public String getServerStartTime() {
        return serverStartTime;
    }

    public String getCarbonId() {
        return carbonId;
    }

    public void setCarbonId(String carbonId) {
        this.carbonId = carbonId;
    }

    public String toString() {
        return "JVM Name='" + javaRuntimeName + '\'' +
                ", JVM Version='" + javaVMVersion + '\'' +
                ", JVM Vendor='" + javaVMVendor + '\'' +
                ", Java Home='" + javaHome + '\'' +
                ", OS Name='" + osName + '\'' +
                ", OS Version='" + osVersion + '\'' +
                ", User Home='" + userHome + '\'' +
                ", User Timezone='" + userTimezone + '\'' +
                ", Username='" + userName + '\'' +
                ", User Country='" + userCountry + '\'' +
                ", Repository Location='" + repoLocation + '\'';
    }

}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using FoxyEcomm.Orm.Attributes;
using FoxyEcomm.Orm.Extensions;
using FoxyEcomm.Orm.Helpers;
using FoxyEcomm.Orm.Interfaces;
using FoxyEcomm.Orm.Models;

namespace FoxyEcomm.Orm.SqlGenerator
{
    public class SqlGenerator<TEntity> : ISqlGenerator<TEntity> where TEntity : class
    {
        public PropertyInfo[] AllProperties { get; protected set; }

        public bool HasUpdatedAt => UpdatedAtProperty != null;

        public PropertyInfo UpdatedAtProperty { get; protected set; }

        public bool IsIdentity => IdentitySqlProperty != null;

        public string TableName { get; protected set; }

        public SqlPropertyMetadata IdentitySqlProperty { get; protected set; }

        public SqlPropertyMetadata[] KeySqlProperties { get; protected set; }

        public SqlPropertyMetadata[] SqlProperties { get; protected set; }

        public SqlGeneratorConfig Config { get; protected set; }

        #region Insert

        public virtual SqlQuery GetInsert(TEntity entity)
        {
            var properties = (IsIdentity ? SqlProperties.Where(p => !p.PropertyName.Equals(IdentitySqlProperty.PropertyName, StringComparison.OrdinalIgnoreCase)) : SqlProperties).ToList();

            if (HasUpdatedAt)
                UpdatedAtProperty.SetValue(entity, DateTime.UtcNow);

            var query = new SqlQuery(entity);

            query.SqlBuilder.Append(
                "INSERT INTO " + TableName
                + "(" + string.Join(", ", properties.Select(p => p.ColumnName)) + ")"
                + " VALUES  (" + string.Join(", ", properties.Select(p => "@" + p.PropertyName)) + ")");

            if (IsIdentity)
                switch (Config.SqlConnector)
                {
                    case ESqlConnector.Mssql:
                        query.SqlBuilder.Append("SELECT SCOPE_IDENTITY() AS " + IdentitySqlProperty.ColumnName);
                        break;

                    case ESqlConnector.MySql:
                        query.SqlBuilder.Append("; SELECT CONVERT(LAST_INSERT_ID(), SIGNED INTEGER) AS " + IdentitySqlProperty.ColumnName);
                        break;

                    case ESqlConnector.PostgreSql:
                        query.SqlBuilder.Append("RETURNING " + IdentitySqlProperty.ColumnName);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                }

            return query;
        }

        #endregion Insert

        #region Update

        public virtual SqlQuery GetUpdate(TEntity entity)
        {
            var properties = SqlProperties.Where(p => !KeySqlProperties.Any(k => k.PropertyName.Equals(p.PropertyName, StringComparison.OrdinalIgnoreCase)));

            if (HasUpdatedAt)
                UpdatedAtProperty.SetValue(entity, DateTime.UtcNow);

            var query = new SqlQuery(entity);
            query.SqlBuilder.Append("UPDATE " + TableName + " SET " + string.Join(", ", properties.Select(p => p.ColumnName + " = @" + p.PropertyName)) + " WHERE " + string.Join(" AND ", KeySqlProperties.Select(p => p.ColumnName + " = @" + p.PropertyName)));

            return query;
        }

        #endregion Update

        #region Logic delete

        public bool LogicalDelete { get; protected set; }

        public string StatusPropertyName { get; protected set; }

        public object LogicalDeleteValue { get; protected set; }

        #endregion Logic delete

        #region Init

        public SqlGenerator()
            : this(new SqlGeneratorConfig { SqlConnector = ESqlConnector.Mssql, UseQuotationMarks = false })
        {
        }

        public SqlGenerator(ESqlConnector sqlConnector, bool useQuotationMarks = false)
            : this(new SqlGeneratorConfig { SqlConnector = sqlConnector, UseQuotationMarks = useQuotationMarks })
        {
        }

        public SqlGenerator(SqlGeneratorConfig sqlGeneratorConfig)
        {
            InitProperties();
            InitConfig(sqlGeneratorConfig);
            InitLogicalDeleted();
        }

        private void InitProperties()
        {
            var entityType = typeof(TEntity);
            TableName = GetTableNameOrAlias(entityType);

            AllProperties = entityType.GetProperties().Where(q => q.CanWrite).ToArray();
            var props = AllProperties.Where(ExpressionHelper.GetPrimitivePropertiesPredicate()).ToArray();

            SqlProperties = props.Where(p => !p.GetCustomAttributes<NotMappedAttribute>().Any()).Select(p => new SqlPropertyMetadata(p)).ToArray();

            KeySqlProperties = props.Where(p => p.GetCustomAttributes<KeyAttribute>().Any()).Select(p => new SqlPropertyMetadata(p)).ToArray();

            var identityProperty = props.FirstOrDefault(p => p.GetCustomAttributes<IdentityAttribute>().Any());
            IdentitySqlProperty = identityProperty != null ? new SqlPropertyMetadata(identityProperty) : null;

            var dateChangedProperty = props.FirstOrDefault(p => p.GetCustomAttributes<UpdatedAtAttribute>().Count() == 1);
            if (dateChangedProperty != null && (dateChangedProperty.PropertyType == typeof(DateTime) || dateChangedProperty.PropertyType == typeof(DateTime?)))
                UpdatedAtProperty = props.FirstOrDefault(p => p.GetCustomAttributes<UpdatedAtAttribute>().Any());
        }

        private void InitConfig(SqlGeneratorConfig sqlGeneratorConfig)
        {
            Config = sqlGeneratorConfig;

            if (Config.UseQuotationMarks)
                switch (Config.SqlConnector)
                {
                    case ESqlConnector.Mssql:
                        TableName = "[" + TableName + "]";

                        foreach (var propertyMetadata in SqlProperties)
                            propertyMetadata.ColumnName = "[" + propertyMetadata.ColumnName + "]";

                        foreach (var propertyMetadata in KeySqlProperties)
                            propertyMetadata.ColumnName = "[" + propertyMetadata.ColumnName + "]";
                        break;

                    case ESqlConnector.MySql:
                        TableName = "`" + TableName + "`";

                        foreach (var propertyMetadata in SqlProperties)
                            propertyMetadata.ColumnName = "`" + propertyMetadata.ColumnName + "`";

                        foreach (var propertyMetadata in KeySqlProperties)
                            propertyMetadata.ColumnName = "`" + propertyMetadata.ColumnName + "`";
                        break;

                    case ESqlConnector.PostgreSql:
                        TableName = "\"" + TableName + "\"";

                        foreach (var propertyMetadata in SqlProperties)
                            propertyMetadata.ColumnName = "\"" + propertyMetadata.ColumnName + "\"";

                        foreach (var propertyMetadata in KeySqlProperties)
                            propertyMetadata.ColumnName = "\"" + propertyMetadata.ColumnName + "\"";
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(Config.SqlConnector));
                }
        }

        private static string GetTableNameOrAlias(Type type)
        {
            var entityTypeInfo = type.GetTypeInfo();
            var tableAliasAttribute = entityTypeInfo.GetCustomAttribute<TableAttribute>();
            return tableAliasAttribute != null ? tableAliasAttribute.Name : entityTypeInfo.Name;
        }

        private void InitLogicalDeleted()
        {
            var statusProperty =
                SqlProperties.FirstOrDefault(x => x.PropertyInfo.GetCustomAttributes<StatusAttribute>().Any());

            if (statusProperty == null) return;
            StatusPropertyName = statusProperty.ColumnName;

            if (statusProperty.PropertyInfo.PropertyType.IsBool())
            {
                var deleteProperty = AllProperties.FirstOrDefault(p => p.GetCustomAttributes<DeletedAttribute>().Any());
                if (deleteProperty == null) return;

                LogicalDelete = true;
                LogicalDeleteValue = 1;
            }
            else if (statusProperty.PropertyInfo.PropertyType.IsEnum())
            {
                var deleteOption = statusProperty.PropertyInfo.PropertyType.GetFields().FirstOrDefault(f => f.GetCustomAttribute<DeletedAttribute>() != null);

                if (deleteOption == null) return;

                var enumValue = Enum.Parse(statusProperty.PropertyInfo.PropertyType, deleteOption.Name);

                if (enumValue != null)
                    LogicalDeleteValue = Convert.ChangeType(enumValue, Enum.GetUnderlyingType(statusProperty.PropertyInfo.PropertyType));

                LogicalDelete = true;
            }
        }

        #endregion Init

        #region Select

        private SqlQuery InitBuilderSelect(bool firstOnly)
        {
            var query = new SqlQuery();
            query.SqlBuilder.Append("SELECT " + (firstOnly && Config.SqlConnector == ESqlConnector.Mssql ? "TOP 1 " : "") + GetFieldsSelect(TableName, SqlProperties));
            return query;
        }

        public virtual SqlQuery GetSelectFirst(Expression<Func<TEntity, bool>> predicate, params Expression<Func<TEntity, object>>[] includes)
        {
            return GetSelect(predicate, true, includes);
        }

        public virtual SqlQuery GetSelectAll(Expression<Func<TEntity, bool>> predicate, params Expression<Func<TEntity, object>>[] includes)
        {
            return GetSelect(predicate, false, includes);
        }

        private string AppendJoinToSelect(SqlQuery originalBuilder, params Expression<Func<TEntity, object>>[] includes)
        {
            var joinBuilder = new StringBuilder();

            var joinedProperties = new List<PropertyInfo>();
            foreach (var include in includes)
            {
                var propertyName = ExpressionHelper.GetFullPropertyName(include);
                var joinProperty = AllProperties.Concat(joinedProperties).First(x =>
                {
                    if (x.DeclaringType != null)
                        return x.DeclaringType.FullName + "." + x.Name == propertyName;
                    return false;
                });

                var tableName = GetTableNameOrAlias(joinProperty.DeclaringType);

                var attrJoin = joinProperty.GetCustomAttribute<JoinAttributeBase>();

                if (attrJoin == null) continue;

                var joinString = "";
                if (attrJoin is LeftJoinAttribute)
                    joinString = "LEFT JOIN";
                else if (attrJoin is InnerJoinAttribute)
                    joinString = "INNER JOIN";
                else if (attrJoin is RightJoinAttribute)
                    joinString = "RIGHT JOIN";

                var joinType = joinProperty.PropertyType.IsGenericType() ? joinProperty.PropertyType.GenericTypeArguments[0] : joinProperty.PropertyType;
                joinedProperties.AddRange(joinType.GetProperties().Where(p => !p.GetCustomAttributes<NotMappedAttribute>().Any()));
                var properties = joinType.GetProperties().Where(ExpressionHelper.GetPrimitivePropertiesPredicate());
                var props = properties.Where(p => !p.GetCustomAttributes<NotMappedAttribute>().Any()).Select(p => new SqlPropertyMetadata(p)).ToArray();

                if (Config.UseQuotationMarks)
                    switch (Config.SqlConnector)
                    {
                        case ESqlConnector.Mssql:
                            tableName = "[" + tableName + "]";
                            attrJoin.TableName = "[" + attrJoin.TableName + "]";
                            attrJoin.Key = "[" + attrJoin.Key + "]";
                            attrJoin.ExternalKey = "[" + attrJoin.ExternalKey + "]";
                            foreach (var prop in props)
                                prop.ColumnName = "[" + prop.ColumnName + "]";
                            break;

                        case ESqlConnector.MySql:
                            tableName = "`" + tableName + "`";
                            attrJoin.TableName = "`" + attrJoin.TableName + "`";
                            attrJoin.Key = "`" + attrJoin.Key + "`";
                            attrJoin.ExternalKey = "`" + attrJoin.ExternalKey + "`";
                            foreach (var prop in props)
                                prop.ColumnName = "`" + prop.ColumnName + "`";
                            break;

                        case ESqlConnector.PostgreSql:
                            tableName = "\"" + tableName + "\"";
                            attrJoin.TableName = "\"" + attrJoin.TableName + "\"";
                            attrJoin.Key = "\"" + attrJoin.Key + "\"";
                            attrJoin.ExternalKey = "\"" + attrJoin.ExternalKey + "\"";
                            foreach (var prop in props)
                                prop.ColumnName = "\"" + prop.ColumnName + "\"";
                            break;

                        default:
                            throw new ArgumentOutOfRangeException(nameof(Config.SqlConnector));
                    }

                originalBuilder.SqlBuilder.Append(", " + GetFieldsSelect(attrJoin.TableName, props));
                joinBuilder.Append(joinString + " " + attrJoin.TableName + " ON " + tableName + "." + attrJoin.Key + " = " + attrJoin.TableName + "." + attrJoin.ExternalKey + " ");
            }
            return joinBuilder.ToString();
        }

        private static string GetFieldsSelect(string tableName, IEnumerable<SqlPropertyMetadata> properties)
        {
            Func<SqlPropertyMetadata, string> projectionFunction = p => !string.IsNullOrEmpty(p.Alias)
                ? tableName + "." + p.ColumnName + " AS " + p.PropertyName
                : tableName + "." + p.ColumnName;

            return string.Join(", ", properties.Select(projectionFunction));
        }

        private SqlQuery GetSelect(Expression<Func<TEntity, bool>> predicate, bool firstOnly, params Expression<Func<TEntity, object>>[] includes)
        {
            var sqlQuery = InitBuilderSelect(firstOnly);

            if (includes.Any())
            {
                var joinsBuilder = AppendJoinToSelect(sqlQuery, includes);
                sqlQuery.SqlBuilder.Append(" FROM " + TableName + " ");
                sqlQuery.SqlBuilder.Append(joinsBuilder);
            }
            else
            {
                sqlQuery.SqlBuilder.Append(" FROM " + TableName + " ");
            }

            IDictionary<string, object> dictionary = new Dictionary<string, object>();

            if (predicate != null)
            {
                var queryProperties = new List<QueryParameter>();
                FillQueryProperties(ExpressionHelper.GetBinaryExpression(predicate.Body), ExpressionType.Default, ref queryProperties);

                sqlQuery.SqlBuilder.Append("WHERE ");

                for (var i = 0; i < queryProperties.Count; i++)
                {
                    var item = queryProperties[i];
                    var columnName = SqlProperties.First(x => x.PropertyName == item.PropertyName).ColumnName;

                    if (!string.IsNullOrEmpty(item.LinkingOperator) && i > 0)
                        sqlQuery.SqlBuilder.Append(item.LinkingOperator + " ");

                    if (item.PropertyValue == null)
                        sqlQuery.SqlBuilder.Append(TableName + "." + columnName + " " + (item.QueryOperator == "=" ? "IS" : "IS NOT") + " NULL ");
                    else
                        sqlQuery.SqlBuilder.Append(TableName + "." + columnName + " " + item.QueryOperator + " @" + item.PropertyName + " ");

                    dictionary[item.PropertyName] = item.PropertyValue;
                }

                if (LogicalDelete)
                    sqlQuery.SqlBuilder.Append("AND " + TableName + "." + StatusPropertyName + " != " + LogicalDeleteValue + " ");
            }
            else
            {
                if (LogicalDelete)
                    sqlQuery.SqlBuilder.Append("WHERE " + TableName + "." + StatusPropertyName + " != " + LogicalDeleteValue + " ");
            }

            if (firstOnly && (Config.SqlConnector == ESqlConnector.MySql || Config.SqlConnector == ESqlConnector.PostgreSql))
                sqlQuery.SqlBuilder.Append("LIMIT 1");

            sqlQuery.SetParam(dictionary);
            return sqlQuery;
        }

        public virtual SqlQuery GetSelectBetween(object from, object to, Expression<Func<TEntity, object>> btwField, Expression<Func<TEntity, bool>> expression = null)
        {
            var fieldName = ExpressionHelper.GetPropertyName(btwField);
            var columnName = SqlProperties.First(x => x.PropertyName == fieldName).ColumnName;
            var query = GetSelectAll(expression);

            query.SqlBuilder.Append((expression == null && !LogicalDelete ? "WHERE" : "AND") + " " + TableName + "." + columnName + " BETWEEN '" + from + "' AND '" + to + "'");

            return query;
        }

        public virtual SqlQuery GetDelete(TEntity entity)
        {
            var sqlQuery = new SqlQuery(entity);
            var whereSql = " WHERE " + string.Join(" AND ", KeySqlProperties.Select(p => p.ColumnName + " = @" + p.PropertyName));
            if (!LogicalDelete)
            {
                sqlQuery.SqlBuilder.Append("DELETE FROM " + TableName + whereSql);
            }
            else
            {
                if (HasUpdatedAt)
                    UpdatedAtProperty.SetValue(entity, DateTime.UtcNow);
                sqlQuery.SqlBuilder.Append("UPDATE " + TableName + " SET " + StatusPropertyName + " = " + LogicalDeleteValue + whereSql);
            }

            return sqlQuery;
        }

        private void FillQueryProperties(BinaryExpression body, ExpressionType linkingType, ref List<QueryParameter> queryProperties)
        {
            if (body.NodeType != ExpressionType.AndAlso && body.NodeType != ExpressionType.OrElse)
            {
                var propertyName = ExpressionHelper.GetPropertyName(body);

                if (!SqlProperties.Select(x => x.PropertyName).Contains(propertyName))
                    throw new NotImplementedException("predicate can't parse");

                var propertyValue = ExpressionHelper.GetValue(body.Right);
                var opr = ExpressionHelper.GetSqlOperator(body.NodeType);
                var link = ExpressionHelper.GetSqlOperator(linkingType);

                queryProperties.Add(new QueryParameter(link, propertyName, propertyValue, opr));
            }
            else
            {
                FillQueryProperties(ExpressionHelper.GetBinaryExpression(body.Left), body.NodeType, ref queryProperties);
                FillQueryProperties(ExpressionHelper.GetBinaryExpression(body.Right), body.NodeType, ref queryProperties);
            }
        }

        #endregion Select
    }
}


text:
package com.comcast.viper.flume2storm.connection;

import java.net.InetAddress;
import java.net.UnknownHostException;

import junit.framework.Assert;

import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.Test;

import com.comcast.viper.flume2storm.F2SConfigurationException;
import com.comcast.viper.flume2storm.connection.parameters.KryoNetConnectionParameters;
import com.comcast.viper.flume2storm.utility.test.TestUtils;

/**
 * Tests for {@link KryoNetConnectionParameters}
 */
public class KryoNetConnectionParametersTest {
  /**
   * Test {@link KryoNetConnectionParameters} with empty configuration
   *
   * @throws F2SConfigurationException
   *           If the configuration is invalid
   */
  @Test
  public void testEmpty() throws F2SConfigurationException {
    KryoNetConnectionParameters params = KryoNetConnectionParameters.from(new BaseConfiguration());
    String localAddress;
    try {
      localAddress = InetAddress.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {
      localAddress = KryoNetConnectionParameters.ADDRESS_DEFAULT;
    }
    Assert.assertEquals(localAddress, params.getAddress());
    Assert.assertEquals(KryoNetConnectionParameters.PORT_DEFAULT, params.getPort());
    Assert.assertEquals(KryoNetConnectionParameters.OBJECT_BUFFER_SIZE_DEFAULT, params.getObjectBufferSize());
    Assert.assertEquals(KryoNetConnectionParameters.WRITE_BUFFER_SIZE_DEFAULT, params.getWriteBufferSize());
  }

  /**
   * Test {@link KryoNetConnectionParameters} with a full configuration
   *
   * @throws F2SConfigurationException
   *           If the configuration is invalid
   */
  @Test
  public void testFromConfiguration() throws F2SConfigurationException {
    String hostname = RandomStringUtils.randomAlphabetic(10);
    int port = TestUtils.getRandomPositiveInt(65000);
    int objectBufferSize = TestUtils.getRandomPositiveInt(100000);
    int writeBufferSize = TestUtils.getRandomPositiveInt(100000);
    Configuration config = new BaseConfiguration();
    config.addProperty(KryoNetConnectionParameters.ADDRESS, hostname);
    config.addProperty(KryoNetConnectionParameters.PORT, port);
    config.addProperty(KryoNetConnectionParameters.OBJECT_BUFFER_SZ, objectBufferSize);
    config.addProperty(KryoNetConnectionParameters.WRITE_BUFFER_SZ, writeBufferSize);
    KryoNetConnectionParameters params = KryoNetConnectionParameters.from(config);
    Assert.assertEquals(hostname, params.getAddress());
    Assert.assertEquals(port, params.getPort());
    Assert.assertEquals(objectBufferSize, params.getObjectBufferSize());
    Assert.assertEquals(writeBufferSize, params.getWriteBufferSize());
  }

  /**
   * Test {@link KryoNetConnectionParameters} using the default constructor
   *
   * @throws F2SConfigurationException
   *           If the configuration is invalid
   */
  @Test
  public void testFromScratch() throws F2SConfigurationException {
    KryoNetConnectionParameters params = new KryoNetConnectionParameters();
    String strValue = RandomStringUtils.randomAlphabetic(10);
    params.setAddress(strValue);
    Assert.assertEquals(strValue, params.getAddress());
    int value = TestUtils.getRandomPositiveInt(65000);
    params.setServerPort(value);
    Assert.assertEquals(value, params.getPort());
    value = TestUtils.getRandomPositiveInt(100000);
    params.setObjectBufferSize(value);
    Assert.assertEquals(value, params.getObjectBufferSize());
    value = TestUtils.getRandomPositiveInt(100000);
    params.setWriteBufferSize(value);
    Assert.assertEquals(value, params.getWriteBufferSize());
  }

  /**
   * Test {@link KryoNetConnectionParameters} with invalid port
   */
  @Test(expected = IllegalArgumentException.class)
  public void invalidPort1() {
    new KryoNetConnectionParameters().setServerPort(-1);
  }

  /**
   * Test {@link KryoNetConnectionParameters} with invalid port
   */
  @Test(expected = IllegalArgumentException.class)
  public void invalidPort2() {
    new KryoNetConnectionParameters().setServerPort(65536);
  }

  /**
   * Test {@link KryoNetConnectionParameters} with object buffer size
   */
  @Test(expected = IllegalArgumentException.class)
  public void invalidObjectBufferSize() {
    new KryoNetConnectionParameters().setObjectBufferSize(-1);
  }

  /**
   * Test {@link KryoNetConnectionParameters} with write buffer size
   */
  @Test(expected = IllegalArgumentException.class)
  public void invalidWriteBufferSize() {
    new KryoNetConnectionParameters().setWriteBufferSize(-1);
  }
}


text:
'use strict';

angular.module('shelfiFormBuilder', [])
	.config(["sfFormBuilderProvider", function (sfFormBuilderProvider) {
		sfFormBuilderProvider.add('row', '' +
			'
' +
				'
' +
					'<sf-form-builder structure="item" ng-model="data" form="form"></sf-form-builder>' +
				'
' +
			'
'
		);
		sfFormBuilderProvider.add('column', '' +
			'
' +
				'
' +
					'<sf-form-builder structure="item" ng-model="data" form="form"></sf-form-builder>' +
				'
' +
			'
'
		);
		sfFormBuilderProvider.add('inputContainer', '' +
			'<md-input-container>' +
				'{{ label }}' +
				'<sf-input attrs="input" ng-model="data" form="form"></sf-input>' +
			'</md-input-container>'
		);
		sfFormBuilderProvider.add('lines', '' +
			'
' +
				'
{{ title }}
' +
				'<sf-form-builder ng-repeat="item in data[items]" structure="repeat" ng-model="item" form="form"></sf-form-builder>' +
				'<md-button ng-click="add()">Add</md-button>' +
				'<md-button ng-click="removeAll()">Remove all</md-button>' +
			'
'
		);
	}])
	.provider('sfFormBuilder', function () {
		var template = {};
		this.add = function (name, tmpl) {
			template[name] = tmpl;
		};
		this.$get = ['$templateCache', function ($templateCache) {
			return {
				getTemplate: function (name) {
					var tmpl = template[name];
					if (!tmpl) {
						tmpl = $templateCache.get(name);
						if(!tmpl) {
							//http://stackoverflow.com/questions/15458876/check-if-a-string-is-html-or-not
							if (/<[a-z][\s\S]*>/i.test(name)) {
								return name;
							}
							throw 'Error: Template not found! Template name: ' + name;
						}
					}
					return tmpl;
				}
			};
		}];
	})
	.directive('sfFormBuilder', ["$compile", "sfFormBuilder", function ($compile, sfFormBuilder) {
		return {
			restrict: 'E',
			scope: {
				structure: '=',
				data: '=ngModel',
				form: '=',
				live: '@'
			},
			link: function (scope, element) {
				var compileTemplate = function (key, val) {
					if (!angular.isObject(val)) {
						//console.log('returned', key, val);
						return;
					}
					//console.log('------------------');
					//console.log(key, val, scope);
					var template = '<sf-input attrs="structure" ng-model="data" form="form"></sf-input>';
					if (key !== 'input') {
						template = sfFormBuilder.getTemplate(key);
					}
					var childScope = scope.$new(true);
					angular.forEach(val, function (scopeVal, scopeKey) {
						childScope[scopeKey] = scopeVal;
					});
					childScope.structure = val;
					childScope.data = scope.data;
					scope.$watch('data', function (v) {
						childScope.data = v;
					}, true);
					childScope.form = scope.form;
					if (key === 'lines') {
						childScope.add = function () {
							childScope.data[val.items].push({});
						};
						childScope.removeAll = function () {
							childScope.data[val.items] = [];
						};
						childScope.remove = function (index) {
							childScope.data[val.items].splice(index, 1);
						};
					}
					var el = angular.element(template);
					element.append(el);
					$compile(el)(childScope);
					//console.log('------------------');
					//console.log('renderrr');
					//console.log(template);
					//console.log(childScope);
				};
				var render = function () {
					element.html('');
					//console.log('====================');
					//console.log(scope.structure);
					angular.forEach(scope.structure, function (structureVal, structureKey) {
						//console.log('------------------------');
						//console.log(structureKey, structureVal);
						if (angular.isArray(structureVal) && structureKey !== 'row' && structureKey !== 'column') {
							angular.forEach(structureVal, function (arrayVal) {
								compileTemplate(structureKey, arrayVal);
							});
						}
						else {
							compileTemplate(structureKey, structureVal);
						}
					});
				};
				if (!scope.live) {
					scope.live = 'false';
				}
				if (scope.live === 'true') {
					scope.$watch('structure', function () {
						render();
					}, true);
				}
				else {
					render();
				}
			}
		};
	}]);
'use strict';

angular.module('shelfiFormBuilder')
	.config(["sfInputProvider", function (sfInputProvider) {
		sfInputProvider.add('text', '<input type="text">');
		sfInputProvider.add('hidden', '<input type="hidden">');
		sfInputProvider.add('password', '<input type="password">');
		sfInputProvider.add('checkbox', '<input type="checkbox">');
		sfInputProvider.add('file', '<input type="file">');
		sfInputProvider.add('email', '<input type="email">');
		sfInputProvider.add('date', '<input type="date">');
		sfInputProvider.add('datetime', '<input type="datetime">');
		sfInputProvider.add('datetimeLocal', '<input type="datetime-local">');
		sfInputProvider.add('month', '<input type="month">');
		sfInputProvider.add('number', '<input type="number">');
		sfInputProvider.add('range', '<input type="range">');
		sfInputProvider.add('search', '<input type="search">');
		sfInputProvider.add('tel', '<input type="tel">');
		sfInputProvider.add('time', '<input type="time">');
		sfInputProvider.add('url', '<input type="url">');
		sfInputProvider.add('week', '<input type="week">');
		sfInputProvider.add('color', '<input type="color">');
		sfInputProvider.add('textarea', '<textarea></textarea>');
		sfInputProvider.add('radio', '<input type="radio">');
		sfInputProvider.add('select', '<select></select>');
		//sfInputProvider.add('select', '<md-select></md-select>');
		//sfInputProvider.add('row', 'asd');
	}])
	.provider('sfInput', function () {
		var input = {};
		this.add = function (name, tmpl) {
			input[name] = tmpl;
		};
		this.$get = function () {
			return {
				getTemplate: function (name) {
					if (!input[name]) {
						throw 'Error: Input not found! Input name: ' + name;
					}
					return input[name];
				},
				getElement: function (attrs) {
					var t = this.getTemplate(attrs.type);
					var c = angular.element('
');
					var e = angular.element(t);
					//console.log('-------------------');
					//console.log(attrs);
					angular.forEach(attrs, function (val, key) {
						if (['type', 'multi'].indexOf(key) === -1 && (angular.isString(val) || angular.isFunction(val))) {
							//camelCase to hyphen-case
							//http://stackoverflow.com/questions/8955533/javascript-jquery-split-camelcase-string-and-add-hyphen-rather-than-space
							//http://stackoverflow.com/questions/3673138/javascript-regex-camel-to-file-case
							//str.replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase()
							e.attr(key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(), angular.isFunction(val) ? 'event_' + key + '()' : val);
						}
						/*
						else if (attrs.name === 'cvc' && angular.isFunction(val)) {
							//console.log('isFunction', key, val);
							//e.bind(key, val);
							e.attr(key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(), 'event_' + key + '()');
						}
						*/
					});
					c.append(e);
					if (attrs.validationTexts) {
						angular.forEach(attrs.validationTexts, function (val, key) {
							//console.log(key, val);
							var code = angular.element('');
							code.attr('ng-show', 'form.' + attrs.name + '.$error.' + key);
							code.html('{{ "' + val + '" }}'); // TODO: translate filter will be added
							c.append(code);
						});
					}
					return {
						multi: false,
						element: c.children()
					};
				}
			};
		};
	})
	.directive('sfInput', ["$compile", "sfInput", function ($compile, sfInput) {
		return {
			restrict: 'E',
			scope: {
				attrs: '=',
				data: '=ngModel',
				form: '='
			},
			link: function (scope, element) {
				angular.forEach(scope.attrs, function (val, key) {
					if (angular.isFunction(val)) {
						scope['event_' + key] = val;
					}
				});
				var input = sfInput.getElement(scope.attrs);
				element.replaceWith(input.element);
				$compile(input.element)(scope);
			}
		};
	}]);


text:
using System.Collections.Generic;
using BigTwo.Types;

namespace BigTwo.Shufflers
{
    public interface IShuffle
    {
        void Shuffle(Card[] deck);
    }
}


text:
from plenum.common.constants import TRUSTEE, STEWARD

from indy_common.auth import Authoriser
from indy_common.constants import NAME, TGB, TRUST_ANCHOR, SCHEMA

def test_schema_adding():
    roles = {TRUSTEE, STEWARD, TRUST_ANCHOR}
    for role in roles:
        r, msg = _authorised_for_schemas(role)
        assert r and not msg

def test_schema_adding_without_permission():
    roles = {TGB, None}
    for role in roles:
        r, msg = _authorised_for_schemas(role)
        assert not r and msg

def _authorised_for_schemas(role):
    return Authoriser.authorised(typ=SCHEMA,
                                 actorRole=role)


text:
using namespace std;

struct Interval {
    int start;
    int end;
    Interval() : start(0), end(0) {}
    Interval(int s, int e) : start(s), end(e) {}
};

class Solution {
public:
    vector<Interval> merge(vector<Interval>& intervals) {
        if (intervals.size() == 0) {
            return vector<Interval>();
        }
        sort(intervals.begin(), intervals.end(), [](Interval a, Interval b) { return a.start <= b.start;});
        vector<Interval> output;
        output.push_back(intervals[0]);

        for (int i = 1; i < intervals.size(); i++) {
            if (output.back().end >= intervals[i].start) {
                output.back().end = max(intervals[i].end, output.back().end);
            }
            else {
                output.push_back(intervals[i]);
            }
        }
        return output;
    }
};


text:
use strict;
use warnings;
use FindBin qw($Bin);
use lib ("$Bin/../lib", "$Bin/../lib/perl5");
use RUM::Script;
RUM::Script->run_with_logging("RUM::Script::FinalCleanup");

=head1 NAME

RUM_finalcleanup.pl

=head1 SYNOPSIS

RUM_finalcleanup.pl [OPTIONS] --unique-in <rum_unique> --non-unique-in <rum_nu> --unique-out <cleaned rum_unique outfile> --non-unique-out <cleaned rum_nu outfile> --genome <genome seq> --sam-header <sam header>

=head1 DESCRIPTION

This script modifies the RUM_Unique and RUM_NU files to clean
up things like mismatches at the ends of alignments.

=head1 OPTIONS

=over 4

=item B<--unique-in> I<rum_unique>

=item B<--non-unique-in> I<rum_nu>

Input files of unique non-unique mappers, respectively.

=item B<--genome> I<genome_seq>

File containing genome sequence.

=item B<--unique-out> I<cleaned_rum_unique_outfile>

=item B<--non-unique-out> I<cleaned_rum_nu_outfile>

Files to write cleaned unique and non-unique mappers, respectively.

=item B<--sam-header> I<sam_header>

File to write sam header.

=item B<--faok>

The fasta file already has sequence all on one line.

=item B<--match-length-cutoff> I<n>

Set this min length alignment to be reported.

=item B<-h>, B<--help>

=item B<-v>, B<--verbose>

=item B<-q>, B<--quiet>

=back

=head1 AUTHOR

Gregory Grant (ggrant@grant.org)

=head1 COPYRIGHT

Copyright 2012 University of Pennsylvania

=cut


text:
class AddPartialIndexToCiBuildsArtifactsFile < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'.freeze

  disable_ddl_transaction!

  def up
    add_concurrent_index(:ci_builds, :id, where: "artifacts_file <> ''", name: INDEX_NAME)
  end

  def down
    remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
  end
end


text:
from datetime import date

from dateutil.easter import easter
from dateutil.relativedelta import relativedelta as rd, MO

from holidays.constants import JAN, MAY, AUG, OCT, \
    NOV, DEC
from holidays.holiday_base import HolidayBase

class Austria(HolidayBase):
    PROVINCES = ['B', 'K', 'N', 'O', 'S', 'ST', 'T', 'V', 'W']

    def __init__(self, **kwargs):
        self.country = 'AT'
        self.prov = kwargs.pop('prov', kwargs.pop('state', 'W'))
        HolidayBase.__init__(self, **kwargs)

    def _populate(self, year):
        # public holidays
        self[date(year, JAN, 1)] = "Neujahr"
        self[date(year, JAN, 6)] = "Heilige Drei Könige"
        self[easter(year) + rd(weekday=MO)] = "Ostermontag"
        self[date(year, MAY, 1)] = "Staatsfeiertag"
        self[easter(year) + rd(days=39)] = "Christi Himmelfahrt"
        self[easter(year) + rd(days=50)] = "Pfingstmontag"
        self[easter(year) + rd(days=60)] = "Fronleichnam"
        self[date(year, AUG, 15)] = "Mariä Himmelfahrt"
        if 1919 <= year <= 1934:
            self[date(year, NOV, 12)] = "Nationalfeiertag"
        if year >= 1967:
            self[date(year, OCT, 26)] = "Nationalfeiertag"
        self[date(year, NOV, 1)] = "Allerheiligen"
        self[date(year, DEC, 8)] = "Mariä Empfängnis"
        self[date(year, DEC, 25)] = "Christtag"
        self[date(year, DEC, 26)] = "Stefanitag"

class AT(Austria):
    pass

class AUT(Austria):
    pass


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<TITLE>
	: Package comafra.display.base
</TITLE>

	Implementation of the Base Classes for for a Multiple Document Interface (MDI)
	Every Main-Panel is displayed in a Internal Frame


text:
/**
 * Simple example with one sensor connected either to I2C bus 0 or
 * SPI bus 1.
 *
 * Harware configuration:
 *
 *   I2C
 *
 *   +-----------------+   +----------+
 *   | ESP8266 / ESP32 |   | BME680   |
 *   |                 |   |          |
 *   |   GPIO 14 (SCL) ----> SCL      |
 *   |   GPIO 13 (SDA) <---> SDA      |
 *   +-----------------+   +----------+
 *
 *   SPI
 *
 *   +-----------------+   +----------+      +-----------------+   +----------+
 *   | ESP8266         |   | BME680   |      | ESP32           |   | BME680   |
 *   |                 |   |          |      |                 |   |          |
 *   |   GPIO 14 (SCK) ----> SCK      |      |   GPIO 16 (SCK) ----> SCK      |
 *   |   GPIO 13 (MOSI)----> SDI      |      |   GPIO 17 (MOSI)----> SDI      |
 *   |   GPIO 12 (MISO)<---- SDO      |      |   GPIO 18 (MISO)<---- SDO      |
 *   |   GPIO 2  (CS)  ----> CS       |      |   GPIO 19 (CS)  ----> CS       |
 *   +-----------------+    +---------+      +-----------------+   +----------+
 */

/* -- use following constants to define the example mode ----------- */

// #define SPI_USED

/* -- includes ----------------------------------------------------- */

#include "bme680.h"

/* -- platform dependent definitions ------------------------------- */

#ifdef ESP_PLATFORM  // ESP32 (ESP-IDF)

// user task stack depth for ESP32
#define TASK_STACK_DEPTH 2048

// SPI interface definitions for ESP32
#define SPI_BUS       HSPI_HOST
#define SPI_SCK_GPIO  16
#define SPI_MOSI_GPIO 17
#define SPI_MISO_GPIO 18
#define SPI_CS_GPIO   19

#else  // ESP8266 (esp-open-rtos)

// user task stack depth for ESP8266
#define TASK_STACK_DEPTH 256

// SPI interface definitions for ESP8266
#define SPI_BUS       1
#define SPI_SCK_GPIO  14
#define SPI_MOSI_GPIO 13
#define SPI_MISO_GPIO 12
#define SPI_CS_GPIO   2   // GPIO 15, the default CS of SPI bus 1, can't be used

#endif  // ESP_PLATFORM

// I2C interface defintions for ESP32 and ESP8266
#define I2C_BUS       0
#define I2C_SCL_PIN   14
#define I2C_SDA_PIN   13
#define I2C_FREQ      I2C_FREQ_100K

/* -- user tasks --------------------------------------------------- */

static bme680_sensor_t* sensor = 0;

/*
 * User task that triggers measurements of sensor every seconds. It uses
 * function *vTaskDelay* to wait for measurement results. Busy wating
 * alternative is shown in comments
 */
void user_task(void *pvParameters)
{
    bme680_values_float_t values;

    TickType_t last_wakeup = xTaskGetTickCount();

    // as long as sensor configuration isn't changed, duration is constant
    uint32_t duration = bme680_get_measurement_duration(sensor);

    while (1)
    {
        // trigger the sensor to start one TPHG measurement cycle
        if (bme680_force_measurement (sensor))
        {
            // passive waiting until measurement results are available
            vTaskDelay (duration);

            // alternatively: busy waiting until measurement results are available
            // while (bme680_is_measuring (sensor)) ;

            // get the results and do something with them
            if (bme680_get_results_float (sensor, &values))
                printf("%.3f BME680 Sensor: %.2f °C, %.2f %%, %.2f hPa, %.2f Ohm\n",
                       (double)sdk_system_get_time()*1e-3,
                       values.temperature, values.humidity,
                       values.pressure, values.gas_resistance);
        }
        // passive waiting until 1 second is over
        vTaskDelayUntil(&last_wakeup, 1000 / portTICK_PERIOD_MS);
    }
}

/* -- main program ------------------------------------------------- */

void user_init(void)
{
    // Set UART Parameter.
    uart_set_baud(0, 115200);
    // Give the UART some time to settle
    vTaskDelay(1);

    /** -- MANDATORY PART -- */

    #ifdef SPI_USED

    spi_bus_init (SPI_BUS, SPI_SCK_GPIO, SPI_MISO_GPIO, SPI_MOSI_GPIO);

    // init the sensor connected to SPI_BUS with SPI_CS_GPIO as chip select.
    sensor = bme680_init_sensor (SPI_BUS, 0, SPI_CS_GPIO);

    #else  // I2C

    // Init all I2C bus interfaces at which BME680 sensors are connected
    i2c_init(I2C_BUS, I2C_SCL_PIN, I2C_SDA_PIN, I2C_FREQ);

    // init the sensor with slave address BME680_I2C_ADDRESS_2 connected to I2C_BUS.
    sensor = bme680_init_sensor (I2C_BUS, BME680_I2C_ADDRESS_2, 0);

    #endif  // SPI_USED

    if (sensor)
    {
        /** -- SENSOR CONFIGURATION PART (optional) --- */

        // Changes the oversampling rates to 4x oversampling for temperature
        // and 2x oversampling for humidity. Pressure measurement is skipped.
        bme680_set_oversampling_rates(sensor, osr_4x, osr_none, osr_2x);

        // Change the IIR filter size for temperature and pressure to 7.
        bme680_set_filter_size(sensor, iir_size_7);

        // Change the heater profile 0 to 200 degree Celcius for 100 ms.
        bme680_set_heater_profile (sensor, 0, 200, 100);
        bme680_use_heater_profile (sensor, 0);

        // Set ambient temperature to 10 degree Celsius
        bme680_set_ambient_temperature (sensor, 10);

        /** -- TASK CREATION PART --- */

        // must be done last to avoid concurrency situations with the sensor
        // configuration part

        // Create a task that uses the sensor
        xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, NULL);
    }
    else
        printf("Could not initialize BME680 sensor\n");
}


text:
var util = require('util');

var ValidaInvalidError = module.exports = function ValidaInvalidError (validationErrors) {
  var message = 'validaInvalidError';

  Error.call(this);

  this.name = this.constructor.name;
  this.validationErrors = validationErrors;

  Object.defineProperty(
    this,
    'message',
    {
      enumerable: false,
      value: message,
      writable: true,
    }
  );

  if (Error.hasOwnProperty('captureStackTrace')) {
    Error.captureStackTrace(this, this.constructor);
    return;
  }

  Object.defineProperty(
    this,
    'stack',
    {
      enumerable: false,
      value: (new Error(message)).stack,
    }
  );
};

util.inherits(ValidaInvalidError, Error);


text:
define(['jquery', 'backbone'], function($, Backbone){
    var View = Backbone.View.extend({
        el: '#mmx-notifications',
        initialize: function(options){
            var me = this;
            me.options = options;
            me.options.eventPubSub.bind('initMMXProjectnotifications', function(model){
                me.model = model;
                me.render();
            });
            $.fn.datepicker.defaults = {
                date : new Date(),
                momentConfig : {
                    culture    : 'en',
                    formatCode : 'L'
                },
                dropdownWidth  : 170,
                allowPastDates : true
            };
        },
        events: {
            'change .repeater-header-left select[name="searchby"]': 'changeSearchBy',
            'click .mmx-messagelist-refresh-btn': 'refresh'
        },
        render: function(){
            var me = this;
            me.sorts = {};
            if(me.rendered) return me.refresh();
            me.rendered = true;
            me.$el.find('.view-container').html(_.template($('#MessagingNotificationsListTmpl').html(), {
                filters : me.filters
            }));
            me.list = $('#mmx-notifications-list');
            me.list.repeater({
                dataSource       : function(options, cb){
                    me.buildList(options, cb)
                },
                list_selectable  : false,
                list_noItemsHTML : '',
                stretchHeight    : false
            });
            me.list.find('.tooltipped-ctrl').tooltip();
        },
        filters : {
            sent : {
                title : 'Date Sent',
                type  : 'daterange'
            },
            deviceId : {
                title : 'Recipient Device Id',
                type  : 'search'
            },
            state : {
                title : 'State',
                type  : 'enum',
                props : [
                    {key:'ACKNOWLEDGED', val:'ACKNOWLEDGED'},
                    {key:'PUSHED', val:'PUSHED'}
                ]
            }
        },
        changeSearchBy: function(e){
            utils.changeSearchBy(this, $(e.currentTarget).val());
        },
        refresh: function(){
            this.list.repeater('render');
        },
        retrieve: function(options, cb){
            var me = this;
            var filters = utils.collectFilters(me.$el);
            var params = {};
            for(var i=0;i<filters.length;++i){
                params = typeof filters[i].val == 'object' ? filters[i].val : {search : filters[i].val};
                params.searchby = filters[i].name;
            }
            var query = {};
            if(options.pageIndex !== 0) query.offset = options.pageIndex !== 0 ? (options.pageSize * options.pageIndex) : 1;
            query.size = options.pageSize || 10;
//            if(params.searchby && (params.fromDt || params.toDt || params.search || options.search)) query.searchby = params.searchby;
            if(params.fromDt) query.sentSince = new Date(params.fromDt.replace(/-/g, '/')).getTime() / 1000;
            if(params.toDt && params.toDt.length){
                var toDateTime = new Date(params.toDt.replace(/-/g, '/'));
                toDateTime = new Date(toDateTime.getFullYear(), toDateTime.getMonth(), toDateTime.getDate(), 23, 59, 59);
                query.sentUntil = toDateTime.getTime() / 1000;
            }
            if(params.search || options.search) query[params.searchby] = params.search || options.search;
            if(options.sortDirection && options.sortProperty){
                me.sorts = {
                    sortby    : options.sortProperty,
                    sortorder : options.sortDirection,
                    index     : utils.getIndexByAttr(me.columns, 'property', options.sortProperty)
                };
                if(options.sortProperty == 'dateSent') options.sortProperty = 'SENT';
                if(options.sortProperty == 'dateAcknowledged') options.sortProperty = 'ACK';
                if(options.sortProperty == 'deviceId') options.sortProperty = 'DEVICEID';
                if(options.sortProperty == 'state') options.sortProperty = 'STATE';
                query.sortby = options.sortProperty;
                query.sortorder = options.sortDirection == 'asc' ? 'ASCENDING' : 'DESCENDING';
            }else{
                query.sortby = 'SENT';
                query.sortorder = 'DESCENDING';
            }
            var qs = '';
            for(var key in query){
                qs += '&'+key+'='+query[key];
            }
            qs = qs.replace('&', '?');
            AJAX('apps/'+me.model.attributes.id+'/notifications'+qs, 'GET', 'application/x-www-form-urlencoded', null, function(res, status, xhr){
                if(res && res.results){
                    for(var i=0;i<res.results.length;++i){
                        if(res.results[i].dateSent) res.results[i].dateSent = moment(res.results[i].dateSent).format('lll');
                        if(res.results[i].dateAcknowledged) res.results[i].dateAcknowledged = moment(res.results[i].dateAcknowledged).format('lll');
                        res.results[i].state = '<img src="images/icons/mmx_state_'+res.results[i].state+'.png" data-toggle="tooltip" data-placement="right" title="'+me.deliveryStates[res.results[i].state]+'" />';
                    }
                }
                cb(res);
            }, function(xhr, status, thrownError){
                cb();
                alert(xhr.responseText || 'Server is not responding.');
            }, [{
                name : 'appAPIKey',
                val  : me.model.attributes.appAPIKey
            }]);
        },
        deliveryStates: {
            'ACKNOWLEDGED' : 'Acknowledged',
            'PUSHED'       : 'Pushed'
        },
        buildList: function(options, callback){
            var me = this;
            me.retrieve(options, function(res){
                res = res || {
                    total  : 0,
                    offset : 0
                };
                var data = {
                    count   : res.total,
                    items   : res.results,
                    page    : (res.offset / options.pageSize),
                    columns : me.columns
                };
                data.pages = Math.ceil(data.count / options.pageSize);
                data.start = data.page * options.pageSize;
                data.end = data.start + options.pageSize;
                data.end = (data.end <= data.count) ? data.end : data.count;
                data.start = data.start + 1;
                setTimeout(function(){
                    $('#mmx-notifications-list .repeater-list-header tr').addClass('head').detach().prependTo('#mmx-notifications-list .repeater-list-items tbody');
                    if(!$.isEmptyObject(me.sorts)){
                        $('#mmx-notifications-list .repeater-list-items tbody tr:first td').each(function(i){
                            var td = $(this);
                            var glyph = 'glyphicon';
                            if(me.sorts.index === i){
                                td.addClass('sorted');
                                if(me.sorts.sortorder == 'asc'){
                                    td.find('.'+glyph).removeClass(glyph+'-chevron-down').addClass(glyph+'-chevron-up');
                                }else{
                                    td.find('.'+glyph).removeClass(glyph+'-chevron-up').addClass(glyph+'-chevron-down');
                                }
                            }
                        });
                    }
                    $('#mmx-notifications-list').find('img').tooltip();
                }, 20);
                callback(data);
            });
        },
        columns: [
            {
                label    : 'State',
                property : 'state',
                sortable : true
            },
            {
                label    : 'Date Sent',
                property : 'dateSent',
                sortable : true
            },
            {
                label    : 'Date Acknowledged',
                property : 'dateAcknowledged',
                sortable : true
            },
            {
                label    : 'Type',
                property : 'type',
                sortable : false
            },
            {
                label    : 'Recipient Device Id',
                property : 'deviceId',
                sortable : true
            },
            {
                label    : 'Message Id',
                property : 'messageId',
                sortable : false
            }
        ]
    });
    return View;
});


text:
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models
import django.utils.timezone

class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(db_index=True, error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 255 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid phone number or email. ', 'invalid')], verbose_name='email or phone')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email')),
                ('phone', models.CharField(blank=True, max_length=255, verbose_name='phone')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name_plural': 'users',
                'verbose_name': 'user',
                'abstract': False,
                'swappable': 'AUTH_USER_MODEL',
            },
        ),
        migrations.CreateModel(
            name='PhoneToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phone_number', models.CharField(blank=True, max_length=255, verbose_name='phone')),
                ('otp', models.CharField(editable=False, max_length=40)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('attempts', models.IntegerField(default=0)),
                ('used', models.BooleanField(default=False)),
            ],
            options={
                'verbose_name_plural': 'Tokens',
                'verbose_name': 'Token',
            },
        ),
    ]


text:
import os
import re
import sys
from setuptools import setup, find_packages

def get_version(package):
    '''
    Return package version as listed in `__version__` in `init.py`.
    '''
    init_py = open(os.path.join(package, '__init__.py')).read()
    return re.search(
        '^__version__ = [\'"]([^\'"]+)[\'"]', init_py, re.MULTILINE
    ).group(1)

version = get_version('filemaker')

if sys.argv[-1] == 'publish':
    os.system('python setup.py sdist upload')
    args = {'version': version}
    print('You probably want to also tag the version now:')
    print(' git tag -a release/{version} -m \'version {version}\''.format(
        **args))
    print(' git push --tags')
    sys.exit()

setup(
    name='django-filemaker',
    version=version,
    url='http://github.com/TitanEntertainmentGroup/django-filemaker',
    license='BSD',
    description='FileMaker access and integration with Django',
    author='Luke Pomfrey',
    author_email='luke.pomfrey@titanemail.com',
    packages=find_packages(exclude='test_project'),
    install_requires=[
        'django',
        'django-appconf',
        'lxml',
        'python-dateutil',
        'pytz',
        'requests',
        'urlobject',
    ],
    tests_require=['mock', 'httpretty'],
    test_suite='runtests.runtests',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP'
    ]
)


text:
var React = require('react');
var _ = require('../underscore_ext').default;

var isChild = x => x === null || typeof x === 'string' || React.isValidElement(x);
// Render tag with list of children, and optional props as first argument.
export var el = type => (...args) =>
	args.length === 0 ? React.createElement(type, {}) :
	isChild(args[0]) ? React.createElement(type, {}, ...args) :
	React.createElement(type, args[0], ...args.slice(1));

export var a = el('a');
export var b = el('b');
export var canvas = el('canvas');
export var div = el('div');
export var h1 = el('h1');
export var h2 = el('h2');
export var h3 = el('h3');
export var i = el('i');
export var img = el('img');
export var label = el('label');
export var option = el('option');
export var p = el('p');
export var select = el('select');
export var span = el('span');
export var table = el('table');
export var tbody = el('tbody');
export var td = el('td');
export var textNode = _.identity;
export var tr = el('tr');


text:
FROM python:3.10

WORKDIR setup

COPY ./requirements.txt .
COPY ./run_linter.sh .

# Install dependencies.
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

WORKDIR app

ENTRYPOINT ["/setup/run_linter.sh"]


text:
/* Theme: Classic Theme */
console.log('bar')
console.log('omg')
(function() {
  console.log('dang');

}).call(this);


text:
cask :v1 => 'balsamiq-mockups' do
  version :latest
  sha256 :no_check

  # amazonaws is the official download host per the vendor homepage
  url 'http://s3.amazonaws.com/build_production/mockups-desktop/MockupsForDesktop.dmg'
  name 'Balsamiq Mockups'
  homepage 'http://balsamiq.com/'
  license :commercial

  app 'Balsamiq Mockups.app'
end


text:
#ifndef MUTEXPOSIXIMPL_H
#define MUTEXPOSIXIMPL_H

#include "dtoolbase.h"
#include "selectThreadImpl.h"

#ifdef HAVE_POSIX_THREADS

#include <pthread.h>
#include <errno.h>
#include <assert.h>

/**
 * Uses Posix threads to implement a mutex.
 */
class EXPCL_DTOOL MutexPosixImpl {
public:
  CONSTEXPR MutexPosixImpl() NOEXCEPT;
  INLINE ~MutexPosixImpl();

private:
  MutexPosixImpl(const MutexPosixImpl &copy) DELETED;
  MutexPosixImpl &operator = (const MutexPosixImpl &copy) DELETED_ASSIGN;

public:
  INLINE void acquire();
  INLINE bool try_acquire();
  INLINE void release();

  INLINE pthread_mutex_t *get_posix_lock();

private:
  pthread_mutex_t _lock;
  friend class ConditionVarPosixImpl;
};

/**
 * Uses Posix threads to implement a reentrant mutex.
 */
class EXPCL_DTOOL ReMutexPosixImpl {
public:
#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
  CONSTEXPR ReMutexPosixImpl() NOEXCEPT;
#else
  INLINE ReMutexPosixImpl();
#endif
  INLINE ~ReMutexPosixImpl();

private:
  ReMutexPosixImpl(const ReMutexPosixImpl &copy) DELETED;
  ReMutexPosixImpl &operator = (const ReMutexPosixImpl &copy) DELETED;

public:
  INLINE void acquire();
  INLINE bool try_acquire();
  INLINE void release();

  INLINE pthread_mutex_t *get_posix_lock();

private:
  pthread_mutex_t _lock;
};

#include "mutexPosixImpl.I"

#endif  // HAVE_POSIX_THREADS

#endif


text:
""" Module to determine the pywikipedia version (tag, revision and date) """
#
# (C) Merlijn 'valhallasw' van Deen
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id: version.py 7033 2009-07-09 02:32:41Z alexsh $'

import os
import time
import sys
import wikipediatools

cache = None

class ParseError(Exception):
    """ Parsing went wrong """

def getversion():
    return '%(tag)s (r%(rev)s, %(date)s)' % getversiondict()

def getversiondict():
    global cache
    if cache:
      return cache
    try:
        (tag, rev, date) = getversion_svn()
    except Exception, e:
        try:
            (tag, rev, date) = getversion_nightly()
        except Exception, e:
            import wikipedia
            version = wikipedia.__version__
            if len(version) == 4:
                # the value is most likely '$Id' + '$', it means that
                # wikipedia.py got imported without using svn at all
                cache = dict(tag='', rev='-1 (unknown)', date='0 (unknown)')
                return cache

            id, file, rev, date, ts, author, dollar = version.split(' ')
            tag = ''
            date = time.strptime('%sT%s' % (date, ts), '%Y-%m-%dT%H:%M:%SZ')
            rev += ' (wikipedia.py)'
    datestring = time.strftime('%Y/%m/%d, %H:%M:%S', date)
    cache = dict(tag=tag, rev=rev, date=datestring)
    return cache

def getversion_svn():
    entries = open(os.path.join(wikipediatools.get_base_dir(), '.svn/entries'))
    for i in range(4):
        entries.readline()
    tag = entries.readline().strip()
    t = tag.split('://')
    t[1] = t[1].replace('svn.wikimedia.org/svnroot/pywikipedia/', '')
    tag = '[%s] %s' % (t[0], t[1])
    for i in range(4):
        entries.readline()
    date = time.strptime(entries.readline()[:19],'%Y-%m-%dT%H:%M:%S')
    rev = entries.readline()[:-1]
    if not date or not tag or not rev:
        raise ParseError
    return (tag, rev, date)

def getversion_nightly():
    data = open(os.path.join(wikipediatools.get_base_dir(), 'version'))
    tag = data.readline().strip()
    date = time.strptime(data.readline()[:19],'%Y-%m-%dT%H:%M:%S')
    rev = data.readline().strip()
    if not date or not tag or not rev:
        raise ParseError
    return (tag, rev, date)

if __name__ == '__main__':
    print 'Pywikipedia %s' % getversion()
    print 'Python %s' % sys.version


text:
@implementation ASPOSETASKSRetrieveTaskInfoResponse

+ (JSONKeyMapper*)keyMapper {
    NSDictionary *map = @{@"Task" : @"task",
                          @"Code" : @"code",
                          @"Status" : @"status",
                          @"Message" : @"message"};

    return [[JSONKeyMapper alloc] initWithDictionary:map];
}

@end


text:
Users

{{ $ctrl.user.displayName }}

Edit

Users

New

{{$ctrl.user.displayName}}

New user

              <form ng-submit="$ctrl.saveUser($ctrl.user)" class="form-horizontal" name="account" method="post" autocomplete="off">

                    Username

                      <input type="text" ng-model="$ctrl.user.username" class="form-control" ng-disabled="$ctrl.user.id && $ctrl.user.authentication.type === local"/>

                    Display Name

                      <input type="text" placeholder="Johnny Appleseed" ng-model="$ctrl.user.displayName" name="displayName" class="form-control">

                    Email

                      <input type="text" placeholder="johnny@appleseed.com" ng-model="$ctrl.user.email" name="email" class="form-control">

                    Phone

                      <input type="text" placeholder="(xxx) xxx-xxxx" ng-model="$ctrl.user.phones[0].number" name="phone" class="form-control">

                    Password

                      <input type="password" ng-model="$ctrl.user.password" name="password" class="form-control">
                      {{$ctrl.passwordStatus.msg}}

                    Confirm Password

                      <input type="password" ng-model="$ctrl.user.passwordconfirm" name="passwordconfirm" class="form-control">
                      {{$ctrl.passwordStatus.msg}}

                    Role

                      <select class="form-control" ng-model="$ctrl.user.role.id" ng-options="role.id as role.name for role in $ctrl.roles" ng-disabled="!$ctrl.canEditRole"></select>

                    Avatar

                      <user-avatar-edit user="$ctrl.user" on-avatar-changed="$ctrl.avatarChanged($event)"/>

                    Map Icon

                        <input type="radio" name="inlineRadioOptions" value="none" ng-model="$ctrl.iconMetadata.type" ng-change="$ctrl.iconTypeChanged($ctrl.iconMetadata)"> None

                        <input type="radio" name="inlineRadioOptions" value="create" ng-model="$ctrl.iconMetadata.type" ng-change="$ctrl.iconTypeChanged($ctrl.iconMetadata)"> Create

                        <input type="radio" name="inlineRadioOptions" value="upload" ng-model="$ctrl.iconMetadata.type" ng-change="$ctrl.iconTypeChanged($ctrl.iconMetadata)"> Upload

                        <map-icon icon="$ctrl.iconMetadata"></map-icon>

                          <input class="form-control user-map-icon" type="text" ng-model="$ctrl.iconMetadata.text" maxlength="2">

                          <input minicolors="minicolorSettings" class="form-control" type="text" ng-model="$ctrl.iconMetadata.color">

                      <user-icon-edit user="$ctrl.user" on-icon-changed="$ctrl.iconChanged($event)"></user-icon-edit>

                      Cancel
                      <button type="submit" class="btn btn-success" ng-class="{'disabled': $ctrl.saving}"> Save</button>

              </form>

Update Password

Reset users password

              <button class="btn btn-default pull-right" ng-click="$ctrl.editPassword = !$ctrl.editPassword">{{$ctrl.editPassword ? 'Close' : 'Edit'}}</button>

            <form ng-submit="$ctrl.updatePassword(authentication)" name="authentication" class="form-horizontal clearfix" autocomplete="off" method="post" novalidate>

                Password

                  <input type="password" ng-model="$ctrl.user.password" ng-change="$ctrl.passwordChanged($ctrl.user.password)" name="password" class="form-control" required>

Password is required

                Re-type Password

                  <input type="password" ng-model="$ctrl.user.passwordconfirm" name="passwordconfirm" class="form-control" required>

New password confirmation is required

Passwords do not match

Password Strength: {{$ctrl.passwordStrength}}

                  <uib-progressbar max="5" value="$ctrl.passwordStrengthScore" type="{{$ctrl.passwordStrengthType}}"></uib-progressbar>

                  <button type="submit" class="btn btn-primary pull-right">Change password</button>

{{$ctrl.passwordStatus.msg}}

            </form>

Error Saving User

        {{$ctrl.error}}


text:
package de.oliver_heger.linedj.radio

import akka.actor.{Actor, ActorRef, Props}
import de.oliver_heger.linedj.platform.app.ClientApplication
import de.oliver_heger.linedj.platform.app.support.ActorManagement
import org.mockito.ArgumentMatchers.{any, anyString}
import org.mockito.Mockito._
import org.mockito.invocation.InvocationOnMock
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatestplus.mockito.MockitoSugar

/**
  * Test class for ''RadioPlayerFactory''.
  */
class RadioPlayerFactorySpec extends AnyFlatSpec with Matchers with MockitoSugar {
  /**
    * Creates a mock ActorManagement object.
    * @return the mock
    */
  private def createActorManagement(): ActorManagement = {
    val management = mock[ActorManagement]
    when(management.createAndRegisterActor(any(classOf[Props]), anyString()))
      .thenAnswer((_: InvocationOnMock) => mock[ActorRef])
    management
  }

  "A RadioPlayerFactory" should "use meaningful configuration settings" in {
    val factory = new RadioPlayerFactory

    val player = factory createRadioPlayer createActorManagement()
    player.config.inMemoryBufferSize should be(65536)
    player.config.bufferChunkSize should be(4096)
    player.config.playbackContextLimit should be(8192)
    player.config.mediaManagerActor should be(null)
    player.config.blockingDispatcherName.get should be(ClientApplication.BlockingDispatcherName)
  }

  it should "specify a correct actor creation function" in {
    val management = createActorManagement()
    val factory = new RadioPlayerFactory

    val player = factory createRadioPlayer management
    val mockActor = mock[ActorRef]
    val props = Props(new Actor {
      override def receive: Receive = Actor.emptyBehavior
    })
    val name = "someActor"
    when(management.createAndRegisterActor(props, name)).thenReturn(mockActor)
    player.config.actorCreator(props, name) should be(mockActor)
    verify(management).createAndRegisterActor(props, name)
  }
}