text:
package org.sakaiproject.evaluation.logic.entity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.azeckoski.reflectutils.ReflectUtils;
import org.sakaiproject.entitybroker.EntityReference;
import org.sakaiproject.entitybroker.entityprovider.CoreEntityProvider;
import org.sakaiproject.entitybroker.entityprovider.capabilities.AutoRegisterEntityProvider;
import org.sakaiproject.entitybroker.entityprovider.capabilities.RESTful;
import org.sakaiproject.entitybroker.entityprovider.extension.Formats;
import org.sakaiproject.entitybroker.entityprovider.search.Restriction;
import org.sakaiproject.entitybroker.entityprovider.search.Search;
import org.sakaiproject.evaluation.logic.EvalCommonLogic;
import org.sakaiproject.evaluation.logic.EvalEvaluationService;
import org.sakaiproject.evaluation.logic.EvalEvaluationSetupService;
import org.sakaiproject.evaluation.logic.entity.AssignGroupEntityProvider;
import org.sakaiproject.evaluation.model.EvalAssignGroup;

/**
 * Implementation for the entity provider for evaluation groups
 *
 * @author Aaron Zeckoski (aaronz@vt.edu)
 */
public class AssignGroupEntityProviderImpl implements AssignGroupEntityProvider, CoreEntityProvider, RESTful, AutoRegisterEntityProvider {

    private EvalCommonLogic commonLogic;
    public void setCommonLogic(EvalCommonLogic commonLogic) {
        this.commonLogic = commonLogic;
    }

    private EvalEvaluationService evaluationService;
    public void setEvaluationService(EvalEvaluationService evaluationService) {
        this.evaluationService = evaluationService;
    }

    private EvalEvaluationSetupService evaluationSetupService;
    public void setEvaluationSetupService(EvalEvaluationSetupService evaluationSetupService) {
        this.evaluationSetupService = evaluationSetupService;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybroker.entityprovider.EntityProvider#getEntityPrefix()
     */
    public String getEntityPrefix() {
        return AssignGroupEntityProvider.ENTITY_PREFIX;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybroker.entityprovider.CoreEntityProvider#entityExists(java.lang.String)
     */
    public boolean entityExists(String id) {
        Long assignGroupId;
        try {
            assignGroupId = new Long(id);
            if (evaluationService.getAssignGroupById(assignGroupId) != null) {
                return true;
            }
        } catch (NumberFormatException e) {
            // invalid number so roll through to the false
        }
        return false;
    }

    public String createEntity(EntityReference ref, Object entity, Map<String, Object> params) {
        EvalAssignGroup assignGroup = (EvalAssignGroup) entity;
        String userId = commonLogic.getCurrentUserId();
        evaluationSetupService.saveAssignGroup(assignGroup, userId);
        return assignGroup.getId().toString();
    }

    public Object getSampleEntity() {
        return new EvalAssignGroup();
    }

    public void updateEntity(EntityReference ref, Object entity, Map<String, Object> params) {
        EvalAssignGroup assignGroup = (EvalAssignGroup) entity;
        String userId = commonLogic.getCurrentUserId();
        evaluationSetupService.saveAssignGroup(assignGroup, userId);
    }

    public Object getEntity(EntityReference ref) {
        Long assignGroupId = getIdFromRef(ref);
        EvalAssignGroup assignGroup = evaluationService.getAssignGroupById(assignGroupId);
        EvalAssignGroup clone = cloneEAG(assignGroup);
        return clone;
    }

    public void deleteEntity(EntityReference ref, Map<String, Object> params) {
        Long assignGroupId = getIdFromRef(ref);
        String userId = commonLogic.getCurrentUserId();
        evaluationSetupService.deleteAssignGroup(assignGroupId, userId);
    }

    public List<?> getEntities(EntityReference ref, Search search) {
        Restriction r = search.getRestrictionByProperties(new String[] {"eval","evaluation","evalId","evaluationId"});
        if (r == null) {
            throw new IllegalArgumentException("Must specify an evaluation id (evalId param) in order to fetch assign groups");
        }
        Long evaluationId = ReflectUtils.getInstance().convert(r.getStringValue(), Long.class);
        List<EvalAssignGroup> assignGroups = evaluationService.getAssignGroupsForEvals(new Long[] {evaluationId}, true, true).get(evaluationId);
        List<EvalAssignGroup> groups = new ArrayList<EvalAssignGroup>(assignGroups.size());
        for (EvalAssignGroup evalAssignGroup : assignGroups) {
            EvalAssignGroup clone = cloneEAG(evalAssignGroup);
            groups.add(clone);
        }
        return groups;
    }

    public String[] getHandledOutputFormats() {
        return new String[] {Formats.JSON, Formats.XML}; // have to not use HTML because it stops the access provider
    }

    public String[] getHandledInputFormats() {
        return new String[] {Formats.JSON, Formats.XML}; // have to not use HTML because it stops the access provider
    }

    // Added for compatibility with 1.3.3
    public String createEntity(EntityReference ref, Object entity) {
        return createEntity(ref, entity, new HashMap<String, Object>(0));
    }

    public void updateEntity(EntityReference ref, Object entity) {
        updateEntity(ref, entity, new HashMap<String, Object>(0));
    }

    public void deleteEntity(EntityReference ref) {
        deleteEntity(ref, new HashMap<String, Object>(0));
    }

    /**
     * Cloning is required to break us out of the hibernate weirdness,
     * if hibernate goes away then we can avoid doing this
     * @param assignGroup
     * @return the clone of the assign group
     */
    protected EvalAssignGroup cloneEAG(EvalAssignGroup assignGroup) {
        return ReflectUtils.getInstance().clone(assignGroup, 1, new String[] {"evaluation"});
    }

    /**
     * Extract a numeric id from the ref if possible
     * @param ref the entity reference
     * @return the Long number version of the id
     * @throws IllegalArgumentException if the number cannot be extracted
     */
    protected Long getIdFromRef(EntityReference ref) {
        Long id = null;
        String refId = ref.getId();
        if (refId != null) {
            try {
                id = Long.valueOf(refId);
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException("Invalid number found in reference ("+ref+") id: " + e);
            }
        } else {
            throw new IllegalArgumentException("No id in reference ("+ref+") id, cannot extract numeric id");
        }
        return id;
    }

}


text:
from llvmlite import ir
import type
import names

class TypeWrapper(object):
    def __init__(self, type):
        self.type = type

class Function(object):
    def __init__(self, name, args, result, module):
        self._name = name
        self.args = args

        mangled = names.mangle(name, [a.type.name for a in args])

        self.func_type = ir.FunctionType(result.type.irtype, (a.type.irtype for a in args), False)
        self.func = ir.Function(module, self.func_type, mangled)

    def typecheck(self, symboltable):
        pass

    def typecheck_body(self, symboltable):
        pass

    def call(self, builder, stack):
        count = len(self.func.args)
        if count > 0:
            args = stack[-count:]
            del stack[-count:]
        else:
            args = []
        stack.append(builder.call(self.func, args))

    def __repr__(self):
        return 'stdfunc %s' % (self._name)

def int_cmp(name, op, symboltable, dependencies, module):
    bool_type = TypeWrapper(type.BoolType)
    num_type = TypeWrapper(type.Int32Type)

    f = Function(name, (num_type, num_type), bool_type, module)

    block = f.func.append_basic_block('entry')
    builder = ir.IRBuilder(block)
    e = builder.icmp_signed(op, f.func.args[0], f.func.args[1])
    builder.ret(e)

    symboltable.put(name, f)
    dependencies.append((f, []))

def standard_library(symboltable, dependencies, module):
    int_cmp('__eq__', '==', symboltable, dependencies, module)
    int_cmp('__neq__', '!=', symboltable, dependencies, module)

redpajama_set_name: RedPajamaGithub


text:
@extends('base')

@section('content')

{{ trans('entities.chapters_edit') }}

        <form action="{{  $chapter->getUrl() }}" method="POST">
            <input type="hidden" name="_method" value="PUT">
            @include('chapters/form', ['model' => $chapter])
        </form>

@stop


text:
namespace {

bool IsUnaffiliatedCrostiniAllowedByPolicy() {
  bool unaffiliated_crostini_allowed;
  if (ash::CrosSettings::Get()->GetBoolean(
          ash::kDeviceUnaffiliatedCrostiniAllowed,
          &unaffiliated_crostini_allowed)) {
    return unaffiliated_crostini_allowed;
  }
  // If device policy is not set, allow Crostini.
  return true;
}

bool IsArcManagedAdbSideloadingAllowedByUserPolicy(
    crostini::CrostiniArcAdbSideloadingUserAllowanceMode user_policy) {
  if (user_policy ==
      crostini::CrostiniArcAdbSideloadingUserAllowanceMode::kAllow) {
    return true;
  }

  DVLOG(1) << "adb sideloading is not allowed by the user policy";
  return false;
}

using CanChangeAdbSideloadingCallback =
    crostini::CrostiniFeatures::CanChangeAdbSideloadingCallback;

// Reads the value of DeviceCrostiniArcAdbSideloadingAllowed. If the value is
// temporarily untrusted the |callback| will be invoked later when trusted
// values are available.
void CanChangeAdbSideloadingOnManagedDevice(
    CanChangeAdbSideloadingCallback callback,
    bool is_profile_enterprise_managed,
    bool is_affiliated_user,
    crostini::CrostiniArcAdbSideloadingUserAllowanceMode user_policy) {
  // Split |callback| in 2 OnceCallbacks. This is necessary to cater to the
  // somewhat awkward PrepareTrustedValues interface, which for some return
  // values invokes the callback passed to it, and for others requires the code
  // here to do so.
  auto split_callback = base::SplitOnceCallback(std::move(callback));

  auto* const cros_settings = ash::CrosSettings::Get();
  auto status = cros_settings->PrepareTrustedValues(base::BindOnce(
      &CanChangeAdbSideloadingOnManagedDevice, std::move(split_callback.first),
      is_profile_enterprise_managed, is_affiliated_user, user_policy));

  if (status != ash::CrosSettingsProvider::TRUSTED) {
    return;
  }

  // Get the updated policy.
  int crostini_arc_abd_sideloading_device_allowance_mode = -1;
  if (!cros_settings->GetInteger(
          ash::kDeviceCrostiniArcAdbSideloadingAllowed,
          &crostini_arc_abd_sideloading_device_allowance_mode)) {
    // If the device policy is not set, adb sideloading is not allowed
    DVLOG(1) << "adb sideloading device policy is not set, therefore "
                "sideloading is not allowed";
    std::move(split_callback.second).Run(false);
    return;
  }

  using Mode =
      enterprise_management::DeviceCrostiniArcAdbSideloadingAllowedProto;

  bool is_adb_sideloading_allowed_by_device_policy;
  switch (crostini_arc_abd_sideloading_device_allowance_mode) {
    case Mode::DISALLOW:
    case Mode::DISALLOW_WITH_POWERWASH:
      is_adb_sideloading_allowed_by_device_policy = false;
      break;
    case Mode::ALLOW_FOR_AFFILIATED_USERS:
      is_adb_sideloading_allowed_by_device_policy = true;
      break;
    default:
      is_adb_sideloading_allowed_by_device_policy = false;
      break;
  }

  if (is_adb_sideloading_allowed_by_device_policy) {
    if (is_profile_enterprise_managed) {
      if (!is_affiliated_user) {
        DVLOG(1) << "adb sideloading not allowed because user is not "
                    "affiliated with the device";
        std::move(split_callback.second).Run(false);
        return;
      }
      std::move(split_callback.second)
          .Run(IsArcManagedAdbSideloadingAllowedByUserPolicy(user_policy));
      return;
    }

    DVLOG(1) << "adb sideloading is unsupported for this managed device";
    std::move(split_callback.second).Run(false);
    return;
  }

  DVLOG(1) << "adb sideloading is not allowed by the device policy";
  std::move(split_callback.second).Run(false);
}

void CanChangeManagedAdbSideloading(
    bool is_device_enterprise_managed,
    bool is_profile_enterprise_managed,
    bool is_owner_profile,
    bool is_affiliated_user,
    crostini::CrostiniArcAdbSideloadingUserAllowanceMode user_policy,
    CanChangeAdbSideloadingCallback callback) {
  DCHECK(is_device_enterprise_managed || is_profile_enterprise_managed);

  if (!base::FeatureList::IsEnabled(
          chromeos::features::kArcManagedAdbSideloadingSupport)) {
    DVLOG(1) << "adb sideloading is disabled by a feature flag";
    std::move(callback).Run(false);
    return;
  }

  if (is_device_enterprise_managed) {
    CanChangeAdbSideloadingOnManagedDevice(std::move(callback),
                                           is_profile_enterprise_managed,
                                           is_affiliated_user, user_policy);
    return;
  }

  if (is_owner_profile) {
    // We know here that the profile is enterprise-managed so no need to check
    std::move(callback).Run(
        IsArcManagedAdbSideloadingAllowedByUserPolicy(user_policy));
    return;
  }

  DVLOG(1) << "Only the owner can change adb sideloading status";
  std::move(callback).Run(false);
}

}  // namespace

namespace crostini {

static CrostiniFeatures* g_crostini_features = nullptr;

CrostiniFeatures* CrostiniFeatures::Get() {
  if (!g_crostini_features) {
    g_crostini_features = new CrostiniFeatures();
  }
  return g_crostini_features;
}

void CrostiniFeatures::SetForTesting(CrostiniFeatures* features) {
  g_crostini_features = features;
}

CrostiniFeatures::CrostiniFeatures() = default;

CrostiniFeatures::~CrostiniFeatures() = default;

bool CrostiniFeatures::CouldBeAllowed(Profile* profile, std::string* reason) {
  if (!base::FeatureList::IsEnabled(features::kCrostini)) {
    VLOG(1) << "Crostini is not enabled in feature list.";
    *reason = "Crostini is not supported on this device";
    return false;
  }

  if (!crostini::CrostiniManager::IsDevKvmPresent()) {
    // Hardware is physically incapable, no matter what the user wants.
    VLOG(1) << "Cannot run crostini because /dev/kvm is not present.";
    *reason = "Crostini is not supported on this device";
    return false;
  }

  if (!ash::ProfileHelper::IsPrimaryProfile(profile)) {
    VLOG(1) << "Crostini UI is not allowed on non-primary profiles.";
    *reason = "Crostini is only allowed in primary user sessions";
    return false;
  }

  if (!profile || profile->IsChild() || profile->IsOffTheRecord() ||
      ash::ProfileHelper::IsEphemeralUserProfile(profile) ||
      ash::ProfileHelper::IsLockScreenAppProfile(profile)) {
    VLOG(1) << "Profile is not allowed to run crostini.";
    *reason = "This user session is not allowed to run crostini";
    return false;
  }

  bool kernelnext = base::CommandLine::ForCurrentProcess()->HasSwitch(
      ash::switches::kKernelnextRestrictVMs);
  bool kernelnext_override =
      base::FeatureList::IsEnabled(features::kKernelnextVMs);
  if (kernelnext && !kernelnext_override) {
    // The host kernel is on an experimental version. In future updates this
    // device may not have VM support, so we allow enabling VMs, but guard them
    // on a chrome://flags switch (enable-experimental-kernel-vm-support).
    VLOG(1) << "Cannot run crostini on experimental kernel without "
            << "--enable-experimental-kernel-vm-support.";
    *reason = "Crostini can not run on experimental kernel by default";
    return false;
  }

  return true;
}

bool CrostiniFeatures::CouldBeAllowed(Profile* profile) {
  std::string reason;
  return CouldBeAllowed(profile, &reason);
}

bool CrostiniFeatures::IsAllowedNow(Profile* profile, std::string* reason) {
  if (!CouldBeAllowed(profile, reason)) {
    return false;
  }

  const user_manager::User* user =
      ash::ProfileHelper::Get()->GetUserByProfile(profile);
  if (!IsUnaffiliatedCrostiniAllowedByPolicy() && !user->IsAffiliated()) {
    VLOG(1) << "Policy blocks unaffiliated user from running Crostini.";
    *reason = "Crostini for unaffiliated users is disabled by policy";
    return false;
  }

  const PrefService::Preference* crostini_allowed_by_policy =
      profile->GetPrefs()->FindPreference(
          crostini::prefs::kUserCrostiniAllowedByPolicy);
  if (!crostini_allowed_by_policy->GetValue()->GetBool()) {
    VLOG(1) << "kUserCrostiniAllowedByPolicy preference is false.";
    *reason = "Crostini is disabled by policy";
    return false;
  }
  if (!crostini_allowed_by_policy->IsManaged() && user->IsAffiliated()) {
    VLOG(1) << "Affiliated user is not allowed to run Crostini by default.";
    *reason = "Affiliated user is not allowed to run Crostini by default.";
    return false;
  }

  if (!virtual_machines::AreVirtualMachinesAllowedByPolicy()) {
    VLOG(1)
        << "Crostini cannot run as virtual machines are not allowed by policy.";
    *reason = "Virtual Machines are disabled by policy";
    return false;
  }

  return true;
}

bool CrostiniFeatures::IsAllowedNow(Profile* profile) {
  std::string reason;
  return IsAllowedNow(profile, &reason);
}

bool CrostiniFeatures::IsEnabled(Profile* profile) {
  return g_crostini_features->IsAllowedNow(profile) &&
         profile->GetPrefs()->GetBoolean(crostini::prefs::kCrostiniEnabled);
}

bool CrostiniFeatures::IsExportImportUIAllowed(Profile* profile) {
  return g_crostini_features->IsAllowedNow(profile) &&
         profile->GetPrefs()->GetBoolean(
             crostini::prefs::kUserCrostiniExportImportUIAllowedByPolicy);
}

bool CrostiniFeatures::IsRootAccessAllowed(Profile* profile) {
  if (base::FeatureList::IsEnabled(features::kCrostiniAdvancedAccessControls)) {
    return profile->GetPrefs()->GetBoolean(
        crostini::prefs::kUserCrostiniRootAccessAllowedByPolicy);
  }
  return true;
}

bool CrostiniFeatures::IsContainerUpgradeUIAllowed(Profile* profile) {
  return g_crostini_features->IsAllowedNow(profile);
}

void CrostiniFeatures::CanChangeAdbSideloading(
    Profile* profile,
    CanChangeAdbSideloadingCallback callback) {
  // First rule out a child account as it is a special case - a child can be an
  // owner, but ADB sideloading is currently not supported for this case
  if (profile->IsChild()) {
    DVLOG(1) << "adb sideloading is currently unsupported for child accounts";
    std::move(callback).Run(false);
    return;
  }

  // Check the managed device and/or user case
  auto* connector =
      g_browser_process->platform_part()->browser_policy_connector_ash();
  bool is_device_enterprise_managed = connector->IsDeviceEnterpriseManaged();
  bool is_profile_enterprise_managed =
      profile->GetProfilePolicyConnector()->IsManaged();
  bool is_owner_profile = ash::ProfileHelper::IsOwnerProfile(profile);
  if (is_device_enterprise_managed || is_profile_enterprise_managed) {
    auto user_policy =
        static_cast<crostini::CrostiniArcAdbSideloadingUserAllowanceMode>(
            profile->GetPrefs()->GetInteger(
                crostini::prefs::kCrostiniArcAdbSideloadingUserPref));

    const auto* user = ash::ProfileHelper::Get()->GetUserByProfile(profile);
    bool is_affiliated_user = user && user->IsAffiliated();

    CanChangeManagedAdbSideloading(
        is_device_enterprise_managed, is_profile_enterprise_managed,
        is_owner_profile, is_affiliated_user, user_policy, std::move(callback));
    return;
  }

  // Here we are sure that the user is not enterprise-managed and we therefore
  // only check whether the user is the owner
  if (!is_owner_profile) {
    DVLOG(1) << "Only the owner can change adb sideloading status";
    std::move(callback).Run(false);
    return;
  }

  std::move(callback).Run(true);
}

bool CrostiniFeatures::IsPortForwardingAllowed(Profile* profile) {
  if (!profile->GetPrefs()->GetBoolean(
          crostini::prefs::kCrostiniPortForwardingAllowedByPolicy)) {
    VLOG(1) << "kCrostiniPortForwardingAllowedByPolicy preference is false.";
    return false;
  }
  // If kCrostiniPortForwardingAllowedByPolicy is not false, then we know that
  // the user is either unmanaged, the policy is not set or the policy is set
  // as true. In either of those 3 cases, port forwarding is allowed.
  return true;
}

bool CrostiniFeatures::IsMultiContainerAllowed(Profile* profile) {
  return g_crostini_features->IsAllowedNow(profile) &&
         base::FeatureList::IsEnabled(ash::features::kCrostiniMultiContainer);
}

}  // namespace crostini


text:
package ubic.basecode.util.r;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Get a connection to R, somehow (if possible).
 *
 * @author Paul
 *
 */
public class RConnectionFactory {

    private static Logger log = LoggerFactory.getLogger( RConnectionFactory.class );

    /**
     * Get connection; if Rserve is used, connect to localhost.
     *
     * @return
     */
    public static RClient getRConnection() {
        return getRConnection( "localhost" );
    }

    /**
     * @param hostName The host to use for rserve connections, used only for RServe
     * @return
     */
    public static RClient getRConnection( String hostName ) {

        RClient rc = null;

        try {
            rc = new RServeClient( hostName );
        } catch ( Exception e ) {
            // OK, just that RServe is not available.
        }

        if ( rc == null ) {
            rc = getJRIClient();
            if ( rc != null ) {
                return rc;
            }
        }

        return rc;
    }

    /**
     * @return
     */
    private static RClient getJRIClient() {
        RClient j = new JRIClient();
        log.debug( "Got JRI connection" );
        return j;
    }

}


text:
layout: single
title: 13 octobre - Demande de sursoir à la création de STECAL
author_profile: false
sidebar:
  - image: Illustration_MurBrique.jpg
    text: Mur de brique rose
---

### Toulouse Métropole est le porteur du PLU

Ce jour, le comité de quartier croix de pierre et notre collectif ont envoyé une [lettre AR]({{site.url}}/assets/Sursoir_RevisionPlu_Stecal.pdf)
au président de l'agglomération.

Puisque la consultation de l'enquête publique s'est arrêté le 9 juin et que des évènements de nature à
modifier les conclusions du rapport d'enquête n'ont pas été portés à la connaissance de la commission
d'enquête, nous demandons de sursoir à la création de STECAL dans la révision du PLU.


text:
package net.volcore.wtvmaster;

//imports
    // slf4j
        import org.slf4j.*;
    // volcore libs
        import net.volcore.util.*;

public class ShutdownThread extends Thread
{
    static Logger   logger = LoggerFactory.getLogger( "ShutdownThread" );
    Stoppable trigger;

    ShutdownThread( Stoppable trigger )
    {
        this.trigger = trigger;
    }

    public void run( )
    {
        logger.info( "Shutdown command received, terminating." );
        trigger.stop( );
        //doShutdown = true;
        final int wait = 3000;
        try{
            // wait at most 3 seconds, then forcefully terminate.
            Thread.sleep( wait );
            logger.error( "Timed out waiting "+wait+"ms for main thread to shut down, forcefully terminating." );
        }catch( Exception e ){ }
    }
}


text:
<?php
namespace PhalconX\Console\Commands\Db;

use Phalcon\Config;
use PhalconX\Console\Command;
use PhalconX\Console\Annotations\Option;
use PhalconX\Helper\Mixin;
use PhalconX\Db\DbHelper;

abstract class BaseCommand extends Command
{
    /**
     * @Option(required, shortcut='-c', desc='Connection service name or dsn')
     */
    public $connection = 'db';

    private $db;

    protected function getConnection()
    {
        if (!$this->db) {
            $di = $this->getDi();
            if ($di->has($this->connection)) {
                $this->db = Mixin::create($di->get($this->connection), new DbHelper);
            } else {
                $di = $this->getDi();
                if ($di->has('config')
                    && isset($this->config->databases[$this->connection])) {
                    $dsn = $this->config['databases'][$this->connection];
                    if ($dsn instanceof Config) {
                        $dsn = $dsn->toArray();
                    }
                    $this->db = DbHelper::getConnection($dsn);
                } else {
                    $this->db = DbHelper::getConnection($this->connection);
                }
            }
        }
        return $this->db;
    }
}


text:
package org.apache.batik.dom.svg;

import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.PathIterator;

import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
import org.apache.batik.parser.DefaultPathHandler;
import org.apache.batik.parser.ParseException;
import org.apache.batik.parser.PathParser;
import org.w3c.dom.svg.SVGPathSeg;

/**
 * This class is the implementation of the normalized
 * SVGPathSegList.
 *
 * @author Andres Toussaint
 * @version $Id: AbstractSVGNormPathSegList.java 2005-07-28$
 */
public abstract class AbstractSVGNormPathSegList extends AbstractSVGPathSegList {

    /**
     * Creates a new SVGNormPathSegList.
     */
    protected AbstractSVGNormPathSegList() {
        super();
    }

    /**
     * Parse the 'd' attribute.
     *
     * @param value 'd' attribute value
     * @param handler : list handler
     */
    protected void doParse(String value, ListHandler handler) throws ParseException {
        PathParser pathParser = new PathParser();

        NormalizedPathSegListBuilder builder = new NormalizedPathSegListBuilder(handler);

        pathParser.setPathHandler(builder);
        pathParser.parse(value);
    }

    protected class NormalizedPathSegListBuilder extends DefaultPathHandler {

        protected ListHandler listHandler;
        protected SVGPathSegGenericItem lastAbs;

        public NormalizedPathSegListBuilder(ListHandler listHandler){
            this.listHandler  = listHandler;
        }
        /**
         * Implements {@link org.apache.batik.parser.PathHandler#startPath()}.
         */
        public void startPath() throws ParseException {
            listHandler.startList();
            lastAbs = new SVGPathSegGenericItem(SVGPathSeg.PATHSEG_MOVETO_ABS,
                    PATHSEG_MOVETO_ABS_LETTER, 0,0,0,0,0,0);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#endPath()}.
         */
        public void endPath() throws ParseException {
            listHandler.endList();
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#movetoRel(float,float)}.
         */
        public void movetoRel(float x, float y) throws ParseException {
            movetoAbs(lastAbs.getX() + x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#movetoAbs(float,float)}.
         */
        public void movetoAbs(float x, float y) throws ParseException {
            listHandler.item(new SVGPathSegMovetoLinetoItem
                    (SVGPathSeg.PATHSEG_MOVETO_ABS,PATHSEG_MOVETO_ABS_LETTER,
                            x,y));
            lastAbs.setX(x);
            lastAbs.setY(y);
            lastAbs.setPathSegType(SVGPathSeg.PATHSEG_MOVETO_ABS);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#closePath()}.
         */
        public void closePath() throws ParseException {
            listHandler.item(new SVGPathSegItem
                    (SVGPathSeg.PATHSEG_CLOSEPATH,PATHSEG_CLOSEPATH_LETTER));
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoRel(float,float)}.
         */
        public void linetoRel(float x, float y) throws ParseException {
            linetoAbs(lastAbs.getX() + x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoAbs(float,float)}.
         */
        public void linetoAbs(float x, float y) throws ParseException {
            listHandler.item(new SVGPathSegMovetoLinetoItem
                    (SVGPathSeg.PATHSEG_LINETO_ABS,PATHSEG_LINETO_ABS_LETTER,
                            x,y));
            lastAbs.setX(x);
            lastAbs.setY(y);
            lastAbs.setPathSegType(SVGPathSeg.PATHSEG_LINETO_ABS);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoHorizontalRel(float)}.
         */
        public void linetoHorizontalRel(float x) throws ParseException {
            linetoAbs(lastAbs.getX() + x, lastAbs.getY());
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoHorizontalAbs(float)}.
         */
        public void linetoHorizontalAbs(float x) throws ParseException {
            linetoAbs(x, lastAbs.getY());
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoVerticalRel(float)}.
         */
        public void linetoVerticalRel(float y) throws ParseException {
            linetoAbs(lastAbs.getX(), lastAbs.getY() + y);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#linetoVerticalAbs(float)}.
         */
        public void linetoVerticalAbs(float y) throws ParseException {
            linetoAbs(lastAbs.getX(), y);
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoCubicRel(float,float,float,float,float,float)}.
         */
        public void curvetoCubicRel(float x1, float y1,
                float x2, float y2,
                float x, float y) throws ParseException {
            curvetoCubicAbs(lastAbs.getX() +x1, lastAbs.getY() + y1,
                    lastAbs.getX() +x2, lastAbs.getY() + y2,
                    lastAbs.getX() +x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoCubicAbs(float,float,float,float,float,float)}.
         */
        public void curvetoCubicAbs(float x1, float y1,
                float x2, float y2,
                float x, float y) throws ParseException {
            listHandler.item(new SVGPathSegCurvetoCubicItem
                    (SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,PATHSEG_CURVETO_CUBIC_ABS_LETTER,
                            x1,y1,x2,y2,x,y));
            lastAbs.setValue(x1,y1,x2,y2,x,y);
            lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS);
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoCubicSmoothRel(float,float,float,float)}.
         */
        public void curvetoCubicSmoothRel(float x2, float y2,
                float x, float y) throws ParseException {
            curvetoCubicSmoothAbs(lastAbs.getX() + x2, lastAbs.getY() + y2,
                    lastAbs.getX() + x, lastAbs.getY() + y);

        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoCubicSmoothAbs(float,float,float,float)}.
         */
        public void curvetoCubicSmoothAbs(float x2, float y2,
                float x, float y) throws ParseException {
            if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
                curvetoCubicAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX2()),
                        lastAbs.getY() + (lastAbs.getY() - lastAbs.getY2()),
                        x2, y2, x, y);
            } else {
                curvetoCubicAbs(lastAbs.getX(), lastAbs.getY(), x2, y2, x, y);
            }
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoQuadraticRel(float,float,float,float)}.
         */
        public void curvetoQuadraticRel(float x1, float y1,
                float x, float y) throws ParseException {
            curvetoQuadraticAbs(lastAbs.getX() + x1, lastAbs.getY() + y1,
                    lastAbs.getX() + x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#curvetoQuadraticAbs(float,float,float,float)}.
         */
        public void curvetoQuadraticAbs(float x1, float y1,
                float x, float y) throws ParseException {
                        curvetoCubicAbs(lastAbs.getX() + 2 * (x1 - lastAbs.getX()) / 3,
                                                        lastAbs.getY() + 2 * (y1 - lastAbs.getY()) / 3,
                                                        x + 2 * (x1 - x) / 3,
                                                        y + 2 * (y1 - y) / 3,
                                                        x, y);
                        lastAbs.setX1(x1);
                        lastAbs.setY1(y1);
                        lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothRel(float,float)}.
         */
        public void curvetoQuadraticSmoothRel(float x, float y)
        throws ParseException {
            curvetoQuadraticSmoothAbs(lastAbs.getX() + x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothAbs(float,float)}.
         */
        public void curvetoQuadraticSmoothAbs(float x, float y)
        throws ParseException {
            if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS) {
                curvetoQuadraticAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX1()),
                        lastAbs.getY() + (lastAbs.getY() - lastAbs.getY1()),
                        x, y);
            } else {
                curvetoQuadraticAbs(lastAbs.getX(), lastAbs.getY(), x, y);
            }

        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#arcRel(float,float,float,boolean,boolean,float,float)}.
         */
        public void arcRel(float rx, float ry,
                float xAxisRotation,
                boolean largeArcFlag, boolean sweepFlag,
                float x, float y) throws ParseException {
            arcAbs(rx,ry,xAxisRotation, largeArcFlag, sweepFlag, lastAbs.getX() + x, lastAbs.getY() + y);
        }

        /**
         * Implements {@link
         * org.apache.batik.parser.PathHandler#arcAbs(float,float,float,boolean,boolean,float,float)}.
         */
        public void arcAbs(float rx, float ry,
                float xAxisRotation,
                boolean largeArcFlag, boolean sweepFlag,
                float x, float y) throws ParseException {

                        //         Ensure radii are valid
                        if (rx == 0 || ry == 0) {
                                linetoAbs(x, y);
                                return;
                        }

                        // Get the current (x, y) coordinates of the path
                        double x0 = lastAbs.getX();
                        double y0 = lastAbs.getY();
                        if (x0 == x && y0 == y) {
                                // If the endpoints (x, y) and (x0, y0) are identical, then this
                                // is equivalent to omitting the elliptical arc segment entirely.
                                return;
                        }

                        Arc2D arc = ExtendedGeneralPath.computeArc(x0, y0, rx, ry, xAxisRotation,
                                        largeArcFlag, sweepFlag, x, y);
                        if (arc == null) return;

                        AffineTransform t = AffineTransform.getRotateInstance
                        (Math.toRadians(xAxisRotation), arc.getCenterX(), arc.getCenterY());
                        Shape s = t.createTransformedShape(arc);

                        PathIterator pi = s.getPathIterator(new AffineTransform());
                        float[] d = {0,0,0,0,0,0};
                        int i = -1;

                        while (!pi.isDone()) {
                                i = pi.currentSegment(d);

                                switch (i) {
                                case PathIterator.SEG_CUBICTO:
                                        curvetoCubicAbs(d[0],d[1],d[2],d[3],d[4],d[5]);
                                        break;
                                }
                                pi.next();
                        }
                        lastAbs.setPathSegType(SVGPathSeg.PATHSEG_ARC_ABS);
        }
    }

    protected class SVGPathSegGenericItem extends SVGPathSegItem {

        public SVGPathSegGenericItem(short type, String letter,
                float x1, float y1, float x2, float y2, float x, float y){
            super(type,letter);
            this.x1 = x2;
            this.y1 = y2;
            this.x2 = x2;
            this.y2 = y2;
            this.x = x;
            this.y = y;
        }

        public void setValue(float x1, float y1, float x2, float y2, float x, float y) {
            this.x1 = x2;
            this.y1 = y2;
            this.x2 = x2;
            this.y2 = y2;
            this.x = x;
            this.y = y;
        }

        public void setValue(float x, float y) {
            this.x = x;
            this.y = y;
        }

        public void setPathSegType(short type) {
            this.type = type;
        }

        public float getX(){
            return x;
        }
        public float getY(){
            return y;
        }

        public void setX(float x){
            this.x = x;
        }
        public void setY(float y){
            this.y = y;
        }

        public float getX1(){
            return x1;
        }
        public float getY1(){
            return y1;
        }

        public void setX1(float x){
            this.x1 = x;
        }
        public void setY1(float y){
            this.y1 = y;
        }
        public float getX2(){
            return x2;
        }
        public float getY2(){
            return y2;
        }

        public void setX2(float x){
            this.x2 = x;
        }
        public void setY2(float y){
            this.y2 = y;
        }
    }
}


text:
// source:

package test;

import javax.swing.JFrame;

import nl.uva.vlet.exception.VRLSyntaxException;
import nl.uva.vlet.gui.UIGlobal;
import nl.uva.vlet.gui.compareviewer.DirCompareController;
import nl.uva.vlet.gui.compareviewer.DirComparePanel;
import nl.uva.vlet.gui.proxynode.impl.direct.ProxyVNodeFactory;
import nl.uva.vlet.vrl.VRL;

public class TestCompareViewer
{
	public static void main(String args[])
	{
		UIGlobal.init();
		ProxyVNodeFactory.initPlatform();

		JFrame frame=new JFrame();
		DirComparePanel dcPanel = new DirComparePanel(true);

		frame.add(dcPanel);
		frame.pack();
		frame.setVisible(true);

		DirCompareController controller=dcPanel.getController();

		try
		{
			controller.compareLocations(new VRL("file:///home/ptdeboer"),new VRL("file:///home/ptdeboer"));
		}
		catch (VRLSyntaxException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}


text:
							Post Title

							Username

							13

Post Meta

Post Title

							Username

							13

Post Meta

Post Title

							Username

							13

Post Meta

Sidebar


text:
module myApp {

  let app = angular.module("myApp");

  class HomeController {
    static $inject: Array<string> = [];
    welcomeMessage = "Welcome to the Wingtip Product Manager";
    topic1Title = "Add a new product";
    topic1Copy = "Click the Add Product link on the navbar aboive to add a new product.";
    topic2Title = "See the Product Showcase";
    topic2Copy = "Click Product Showcase link in the navbar to see the full set of Wingtip products.";
    constructor() { }
  }

  app.controller('homeController', HomeController);

  class ProductsController {
    static $inject: Array<string> = ['$location', 'ProductDataService'];
    products: Product[];
    productCategories: string[];
    constructor(private $location: ng.ILocationService,
      private ProductDataService: IProductDataServiceAsync) {
      ProductDataService.GetAllProductsAsync()
        .then((result: Product[]) => {
          this.products = result;
        });
      ProductDataService.GetProductCategoriesAsync()
        .then((result: string[]) => {
          this.productCategories = result;
        });
    }

    deleteProduct(id: number) {
      this.ProductDataService.DeleteProductAsync(id)
        .then(() => {
          this.ProductDataService.GetAllProductsAsync()
            .then((result: Product[]) => {
              this.products = result;
            });
        });
    }
  }

  app.controller('productsController', ProductsController);

  class AddProductController {
    static $inject: Array<string> = ['$location', 'ProductDataService'];
    product: Product = new Product();
    productCategories: string[];
    userMessage: string;
    constructor(private $location: ng.ILocationService, private ProductDataService: IProductDataServiceAsync) {
      ProductDataService.GetProductCategoriesAsync()
        .then((result: string[]) => {
          this.productCategories = result;
        });
    }

    addProduct() {
      this.ProductDataService.AddProductAsync(this.product)
        .then(() => {
          this.$location.path("/products");
        });
    }
  }
  app.controller('addProductController', AddProductController);

  interface IProductRouteParams extends ng.route.IRouteParamsService {
    id: string;
  }

  class ViewProductController {
    static $inject: Array<string> = ['$routeParams', 'ProductDataService'];
    product: Product;
    constructor($routeParams: IProductRouteParams, ProductDataService: IProductDataServiceAsync) {
      var id: number = parseInt($routeParams.id);
      ProductDataService.GetProductAsync(id)
        .then((result: Product) => {
          this.product = result;
        });
    }
  }

  app.controller('viewProductController', ViewProductController);

  class EditProductController {
    static $inject: Array<string> = ['$routeParams', '$location', 'ProductDataService'];
    product: Product;
    productCategories: string[];
    constructor(private $routeParams: IProductRouteParams,
      private $location: ng.ILocationService,
      private ProductDataService: IProductDataServiceAsync) {

      var id: number = parseInt($routeParams.id);
      ProductDataService.GetProductAsync(id)
        .then((result: Product) => {
          this.product = result;
        });

      ProductDataService.GetProductCategoriesAsync()
        .then((result: string[]) => {
          this.productCategories = result;
        });
    }

    updateProduct() {
      this.ProductDataService.UpdateProductAsync(this.product)
        .then(() => { this.$location.path("/products"); });
    }
  }

  app.controller('editProductController', EditProductController);

  class ProductShowcaseController {
    static $inject: Array<string> = ['$location', 'ProductDataService'];
    products: Product[];
    constructor(private $location: ng.ILocationService, private ProductDataService: IProductDataServiceAsync) {

      let categoryFilter: string = $location.search().category;

      if (categoryFilter === undefined) {
        ProductDataService.GetAllProductsAsync()
          .then((result: Product[]) => {
            this.products = result;
          });
      }
      else {
        ProductDataService.GetProductsByCategoryAsync(categoryFilter)
          .then((result: Product[]) => {
            this.products = result;
          });
      }
    }
  }

  app.controller('productShowcaseController', ProductShowcaseController);
}


text:
Paket allows one to automatically manage the linking of files from HTTP resources into your projects.

## Referencing a single file

You can reference a single file from a HTTP resource simply by specifying the url in the [`paket.dependencies` file](dependencies-file.html):

    http http://www.fssnip.net/raw/1M/test1.fs

If you run the [`paket update` command](paket-update.html), it will add a new section to your [`paket.lock` file](lock-file.html):

    HTTP
      remote: http://www.fssnip.net/raw/1M/test1.fs
      specs:
        test1.fs

If you want to reference the file in one of your project files then add an entry to the project's [`paket.references` file.](references-files.html):

    File:test1.fs

This will reference the linked file directly into your project.
By default the linked file will be visible under ``paket-files`` folder in project.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;
using System.Threading.Tasks;

namespace ArangoDB.Client.Utility
{
    // from http://stackoverflow.com/a/8860265/1271333
    public static class TaskUtils
    {
        public static void WaitSynchronizer(this Task task)
        {
            try
            {
                task.Wait();
            }
            catch (AggregateException ex)
            {
                ExceptionDispatchInfo.Capture(ex.Flatten().InnerExceptions.First()).Throw();
            }
        }

        public static T ResultSynchronizer<T>(this Task<T> task)
        {
            try
            {
                return task.Result;
            }
            catch (AggregateException ex)
            {
                ExceptionDispatchInfo.Capture(ex.Flatten().InnerExceptions.First()).Throw();
            }

            return default(T);
        }
    }
}


text:
import pytest

@pytest.fixture
def zanarkand():
    from api.scrapers.free_company import scrape_free_company
    return scrape_free_company('9229142273877347770')

def test_scrape_free_company_basic_info(zanarkand):
    assert zanarkand.name == 'Zanarkand'
    assert zanarkand.server == 'Zalera'

def test_item_invalid_lodestone_id(client):
    response = client.get('/scrape/free_company/000000000001111111111122222222222222')

    assert response.status_code == 403
    assert response.json == {
        'error': 'Invalid Request',
        'message': 'Lodestone ID does not exist'
    }

def test_free_company_json(client):
    response = client.get('/scrape/free_company/9229142273877347770')

    assert response.status_code == 200
    assert response.json['slogan'] == 'Burning shit since 2013.'
    assert response.json['tag'] == 'CHAOS'

def test_character_illegal_lodestone_id(client):
    response = client.get('/scrape/free_company/123abc456def')

    assert response.status_code == 403
    assert response.json == {
        'error': 'Invalid Request',
        'message': 'Illegal characters in requested ID'
    }

def test_free_company_repr(zanarkand):
    assert repr(zanarkand) == '<FreeCompany name=Zanarkand id=9229142273877347770>'


text:
package collections;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class ListeTestZwei {

    public static void main(String[] args) {
        System.out.println("\n\nEinige Tests fuer die Methode konkateniere() :");
        List<Integer> liste = new LinkedList<>();
        List<Integer> liste2 = new LinkedList<>();
        liste2.add(0, new Integer(2));
        liste2.add(0, new Integer(1));
        liste.addAll(liste2);
        System.out.println("liste sollte jetzt die Elemente 1, 2 enthalten.");
        System.out.println(liste);

        liste2 = new LinkedList<>();
        liste2.add(0, new Integer(2));
        liste2.add(0, new Integer(1));

        liste.add(new Integer(3));
        liste.add(new Integer(4));
        liste.add(new Integer(5));
        liste.addAll(liste2);
        System.out.println("liste sollte jetzt die Elemente 1, 2, 3, 4, 5, 1, 2 enthalten.");
        System.out.println(liste);

/*
      // Die folgenden beiden Zeilen fuehren zu einer unendlichen Schleife. Warum?
      liste.konkateniere(liste2);
      liste.durchlaufe();
*/

        System.out.println("\n\nEinige Tests fuer die Methode spiegeln() :");
        liste = new LinkedList<>();
        System.out.println(liste);

        Collections.reverse(liste);
        System.out.println(liste);

        liste.add(new Integer(1));
        System.out.println(liste);

        Collections.reverse(liste);
        System.out.println(liste);

        liste.add(new Integer(2));
        System.out.println(liste);
        Collections.reverse(liste);
        System.out.println(liste);
        Collections.reverse(liste);
        System.out.println(liste);

        liste.add(new Integer(3));
        liste.add(new Integer(4));
        liste.add(new Integer(5));

        System.out.println(liste);
        Collections.reverse(liste);
        System.out.println(liste);

        System.out.println("\n\nEinige Tests fuer die Methode vergleiche() :");
        liste = new LinkedList<>();
        liste2 = new LinkedList<>();
        System.out.println(liste.equals(liste2));
        System.out.println();

        liste.add(0, new Integer(111));
        System.out.println(liste.equals(liste2));
        liste2.add(new Integer(111));
        System.out.println(liste.equals(liste2));
        System.out.println();

        liste2.add(new Integer(222));
        System.out.println(liste.equals(liste2));
        liste.add(new Integer(222));
        System.out.println(liste.equals(liste2));
        System.out.println();

        liste2.add(new Integer(333));
        System.out.println(liste.equals(liste2));
        liste.add(new Integer(444));
        System.out.println(liste.equals(liste2));
        liste.remove(liste.size() - 1);
        liste.add(new Integer(333));
        System.out.println(liste.equals(liste2));
    }

}


text:
SPEC_BEGIN(URLHelperSpec)

describe(@"URLHelper", ^{

    context(@"when get URL for specifiy resource path - 'v1/city/latlng'", ^{
        it(@"should return correct URL", ^{
            NSString *result = [URLHelper URLWithResourcePath:@"/v1/city/latlng"];

            [[result should] equal:[NSString stringWithFormat:@"%@%@", MTWMBaseURL, @"/v1/city/latlng"]];
        });
    });

});

SPEC_END


text:
import { Components, registerComponent } from '../../lib/vulcan-lib';
import React from 'react';
import { useLocation } from '../../lib/routeUtil';
import * as _ from 'underscore';

const AllComments = () => {
  const { query } = useLocation();
  const { SingleColumnSection, RecentComments, SectionTitle } = Components
  const terms = _.isEmpty(query) ? {view: 'recentComments', limit: 100} : query;

  return (
    <SingleColumnSection>
      <SectionTitle title="All Comments"/>
      <RecentComments terms={terms} />
    </SingleColumnSection>
  )
};

const AllCommentsComponent = registerComponent('AllComments', AllComments);

declare global {
  interface ComponentTypes {
    AllComments: typeof AllCommentsComponent,
  }
}


text:
Metrics in H2O
==============

.. automodule:: h2o.model.metrics_base
      :members:
      :undoc-members:
      :show-inheritance:


text:
package com.intrack.executor.connection;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author intrack
 */
public interface ConnectionPool {

    Connection getConnection() throws SQLException;

    void release(Connection connection);

}


text:
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>View Test</title>
	<link rel="stylesheet" href="../wrath.css" type="text/css">
	<link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.css" type="text/css">
	<style type="text/css" media="screen">
		.view .navbar{
			position:relative;
		}
	</style>
</head>
<body>
	<UIView left="__back__" title="hello">
		<View>
		</View>
	</UIView>
	<script type="text/javascript" charset="utf-8" src="../bower_components/requirejs/require.js"></script>
	<script type="text/javascript" charset="utf-8" src="../wrath.js"></script>
	<script type="text/javascript">
		requirejs.config({
			shim: {
				jquery: {
					exports: '$'
				}
			}
		});

		require(['jquery', 'wrath/UI/View', 'wrath/UI/UIView'], function ($, View, UIView) {
		});
	</script>
</body>
</html>


text:
module Azure::StorSimple8000Series::Mgmt::V2017_06_01
  module Models
    #
    # Represents the eligibility of a device as a failover target device.
    #
    class FailoverTarget

      include MsRestAzure

      # @return [String] The path ID of the device.
      attr_accessor :device_id

      # @return [DeviceStatus] The status of the device. Possible values
      # include: 'Unknown', 'Online', 'Offline', 'Deactivated',
      # 'RequiresAttention', 'MaintenanceMode', 'Creating', 'Provisioning',
      # 'Deactivating', 'Deleted', 'ReadyToSetup'
      attr_accessor :device_status

      # @return [String] The model number of the device.
      attr_accessor :model_description

      # @return [String] The software version of the device.
      attr_accessor :device_software_version

      # @return [Integer] The count of datacontainers on the device.
      attr_accessor :data_containers_count

      # @return [Integer] The count of volumes on the device.
      attr_accessor :volumes_count

      # @return [Integer] The amount of free local storage available on the
      # device in bytes.
      attr_accessor :available_local_storage_in_bytes

      # @return [Integer] The amount of free tiered storage available for the
      # device in bytes.
      attr_accessor :available_tiered_storage_in_bytes

      # @return [String] The geo location (applicable only for cloud
      # appliances) of the device.
      attr_accessor :device_location

      # @return [String] The friendly name for the current version of software
      # on the device.
      attr_accessor :friendly_device_software_version

      # @return [TargetEligibilityResult] The eligibility result of the device,
      # as a failover target device.
      attr_accessor :eligibility_result

      #
      # Mapper for FailoverTarget class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'FailoverTarget',
          type: {
            name: 'Composite',
            class_name: 'FailoverTarget',
            model_properties: {
              device_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'deviceId',
                type: {
                  name: 'String'
                }
              },
              device_status: {
                client_side_validation: true,
                required: false,
                serialized_name: 'deviceStatus',
                type: {
                  name: 'Enum',
                  module: 'DeviceStatus'
                }
              },
              model_description: {
                client_side_validation: true,
                required: false,
                serialized_name: 'modelDescription',
                type: {
                  name: 'String'
                }
              },
              device_software_version: {
                client_side_validation: true,
                required: false,
                serialized_name: 'deviceSoftwareVersion',
                type: {
                  name: 'String'
                }
              },
              data_containers_count: {
                client_side_validation: true,
                required: false,
                serialized_name: 'dataContainersCount',
                type: {
                  name: 'Number'
                }
              },
              volumes_count: {
                client_side_validation: true,
                required: false,
                serialized_name: 'volumesCount',
                type: {
                  name: 'Number'
                }
              },
              available_local_storage_in_bytes: {
                client_side_validation: true,
                required: false,
                serialized_name: 'availableLocalStorageInBytes',
                type: {
                  name: 'Number'
                }
              },
              available_tiered_storage_in_bytes: {
                client_side_validation: true,
                required: false,
                serialized_name: 'availableTieredStorageInBytes',
                type: {
                  name: 'Number'
                }
              },
              device_location: {
                client_side_validation: true,
                required: false,
                serialized_name: 'deviceLocation',
                type: {
                  name: 'String'
                }
              },
              friendly_device_software_version: {
                client_side_validation: true,
                required: false,
                serialized_name: 'friendlyDeviceSoftwareVersion',
                type: {
                  name: 'String'
                }
              },
              eligibility_result: {
                client_side_validation: true,
                required: false,
                serialized_name: 'eligibilityResult',
                type: {
                  name: 'Composite',
                  class_name: 'TargetEligibilityResult'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link href="css/ajaxui.css" rel="stylesheet" type="text/css"/>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
</head>
<body bgcolor="black">
Testing Dev...

<form method="get" action="https://api.github.com/zen" class="ajaxui-form">
    <input type="submit" value="Ejecutar">
</form>

<script src="js/ajaxui.js" type="text/javascript"></script>
<script src="js/app.js" type="text/javascript"></script>

<script type="text/javascript">

</script>
</body>
</html>


text:
package com.door43.tools.reporting;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;

/**
 * Created by joel on 3/25/2016.
 */
public class FileUtils {

    /**
     * Converts an input stream into a string
     * @param is
     * @return
     * @throws Exception
     */
    public static String readStreamToString(InputStream is) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line).append("\n");
        }
        return sb.toString();
    }

    /**
     * Returns the contents of a file as a string
     * @param file
     * @return
     * @throws Exception
     */
    public static String readFileToString(File file) throws IOException {
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(file);
            String contents = readStreamToString(fis);
            fis.close();
            return contents;
        } finally {
            if(fis != null) {
                fis.close();
            }
        }
    }

    /**
     * Writes a string to a file
     * @param file
     * @param contents
     * @throws IOException
     */
    public static void writeStringToFile(File file, String contents) throws IOException {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(file.getAbsolutePath());
            fos.write(contents.getBytes());
        } finally {
            if(fos != null) {
                fos.close();
            }
        }
    }
}


text:
    #include "include/clSPARSE-2x.hpp"
#else
    #include "include/clSPARSE-1x.hpp"
#endif

clsparseStatus
csr2dense_transform(const clsparseCsrMatrixPrivate* pCsr,
                    cldenseMatrixPrivate* pA,
                    const std::string& params,
                    const cl_uint group_size,
                    const cl_uint subwave_size,
                    clsparseControl control)
{
    cl::Kernel kernel = KernelCache::get(control->queue,"csr2dense", "csr2dense", params);

    KernelWrap kWrapper(kernel);

    kWrapper << pCsr->num_rows << pCsr->num_cols
             << pCsr->rowOffsets << pCsr->colIndices << pCsr->values
             << pA->values;

    // subwave takes care of each row in matrix;
    // predicted number of subwaves to be executed;
    cl_uint predicted = subwave_size * pCsr->num_rows;

    //cl::NDRange local(group_size);
    //cl::NDRange global(predicted > local[0] ? predicted : local[0]);

    cl_uint global_work_size =
            group_size* ((predicted + group_size - 1 ) / group_size);
    cl::NDRange local(group_size);
    cl::NDRange global(global_work_size > local[0] ? global_work_size : local[0]);

    cl_int status = kWrapper.run(control, global, local);

    if (status != CL_SUCCESS)
    {
        return clsparseInvalidKernelExecution;
    }

    pA->num_rows = pCsr->num_rows;
    pA->num_cols = pCsr->num_cols;

    return clsparseSuccess;

}

clsparseStatus
clsparseScsr2dense(const clsparseCsrMatrix* csr,
                    cldenseMatrix* A,
                  const clsparseControl control)
{
    const clsparseCsrMatrixPrivate* pCsr = static_cast<const clsparseCsrMatrixPrivate*>(csr);
    cldenseMatrixPrivate* pA = static_cast<cldenseMatrixPrivate*>( A );

    if (!clsparseInitialized)
    {
        return clsparseNotInitialized;
    }

    //check opencl elements
    if (control == nullptr)
    {
        return clsparseInvalidControlObject;
    }

    clsparseStatus status;

    //validate cl_mem objects
    status = validateMemObject(pA->values, sizeof(cl_float)*pCsr->num_cols*pCsr->num_rows);
    if(status != clsparseSuccess)
        return status;

    //validate cl_mem sizes
    //TODO: ask about validateMemObjectSize
    cl_uint nnz_per_row = pCsr->nnz_per_row(); //average num_nonzeros per row
    cl_uint wave_size = control->wavefront_size;
    cl_uint group_size = 256; //wave_size * 8;    // 256 gives best performance!
    cl_uint subwave_size = wave_size;

    // adjust subwave_size according to nnz_per_row;
    // each wavefron will be assigned to the row of the csr matrix
    if(wave_size > 32)
    {
        //this apply only for devices with wavefront > 32 like AMD(64)
        if (nnz_per_row < 64) {  subwave_size = 32;  }
    }
    if (nnz_per_row < 32) {  subwave_size = 16;  }
    if (nnz_per_row < 16) {  subwave_size = 8;  }
    if (nnz_per_row < 8)  {  subwave_size = 4;  }
    if (nnz_per_row < 4)  {  subwave_size = 2;  }

    const std::string params = std::string() +
            "-DINDEX_TYPE=" + OclTypeTraits<cl_int>::type
            + " -DVALUE_TYPE=" + OclTypeTraits<cl_float>::type
            + " -DSIZE_TYPE=" + OclTypeTraits<cl_ulong>::type
            + " -DWG_SIZE=" + std::to_string(group_size)
            + " -DWAVE_SIZE=" + std::to_string(wave_size)
            + " -DSUBWAVE_SIZE=" + std::to_string(subwave_size);

    //fill the buffer A with zeros
    cl_float pattern = 0.0f;
#if (BUILD_CLVERSION >= 200)
    clEnqueueSVMMemFill(control->queue(), pA->values, &pattern, sizeof(cl_float),
                        sizeof(cl_float) * pCsr->num_rows * pCsr->num_cols, 0, NULL, NULL);
#else
    clEnqueueFillBuffer(control->queue(), pA->values, &pattern, sizeof(cl_float), 0,
                        sizeof(cl_float) * pCsr->num_rows * pCsr->num_cols, 0, NULL, NULL);
#endif

    return csr2dense_transform(pCsr,
                               pA,
                               params,
                               group_size,
                               subwave_size,
                               control);

}

clsparseStatus
clsparseDcsr2dense(const clsparseCsrMatrix* csr,
cldenseMatrix* A,
                   const clsparseControl control)
{
    const clsparseCsrMatrixPrivate* pCsr = static_cast<const clsparseCsrMatrixPrivate*>(csr);
    cldenseMatrixPrivate* pA = static_cast<cldenseMatrixPrivate*>( A );

    if (!clsparseInitialized)
    {
        return clsparseNotInitialized;
    }

    //check opencl elements
    if (control == nullptr)
    {
        return clsparseInvalidControlObject;
    }

    clsparseStatus status;

    //validate cl_mem objects
    status = validateMemObject(pA->values, sizeof(cl_double)*pCsr->num_cols*pCsr->num_rows);
    if(status != clsparseSuccess)
        return status;

    //validate cl_mem sizes
    //TODO: ask about validateMemObjectSize

    cl_uint nnz_per_row = pCsr->nnz_per_row(); //average num_nonzeros per row
    cl_uint wave_size = control->wavefront_size;
    cl_uint group_size = wave_size * 4;    // 256 gives best performance!
    cl_uint subwave_size = wave_size;

    // adjust subwave_size according to nnz_per_row;
    // each wavefron will be assigned to the row of the csr matrix
    if(wave_size > 32)
    {
        //this apply only for devices with wavefront > 32 like AMD(64)
        if (nnz_per_row < 64) {  subwave_size = 32;  }
    }
    if (nnz_per_row < 32) {  subwave_size = 16;  }
    if (nnz_per_row < 16) {  subwave_size = 8;  }
    if (nnz_per_row < 8)  {  subwave_size = 4;  }
    if (nnz_per_row < 4)  {  subwave_size = 2;  }

    const std::string params = std::string() +
            "-DINDEX_TYPE=" + OclTypeTraits<cl_int>::type
            + " -DVALUE_TYPE=" + OclTypeTraits<cl_double>::type
            + " -DSIZE_TYPE=" + OclTypeTraits<cl_ulong>::type
            + " -DWG_SIZE=" + std::to_string(group_size)
            + " -DWAVE_SIZE=" + std::to_string(wave_size)
            + " -DSUBWAVE_SIZE=" + std::to_string(subwave_size);

    //fill the buffer A with zeros
    cl_double pattern = 0.0f;

#if (BUILD_CLVERSION >= 200)
    clEnqueueSVMMemFill(control->queue(), pA->values, &pattern, sizeof(cl_double),
                        sizeof(cl_double) * pCsr->num_rows * pCsr->num_cols, 0, NULL, NULL);
#else
    clEnqueueFillBuffer(control->queue(), pA->values, &pattern, sizeof(cl_double), 0,
                        sizeof(cl_double) * pCsr->num_rows * pCsr->num_cols, 0, NULL, NULL);
#endif
    return csr2dense_transform(pCsr,
                               pA,
                               params,
                               group_size,
                               subwave_size,
                               control);

}


text:
package hex.genmodel.algos.deepwater;

import deepwater.backends.BackendModel;
import deepwater.backends.BackendParams;
import deepwater.backends.BackendTrain;
import deepwater.backends.RuntimeOptions;
import deepwater.datasets.ImageDataSet;
import hex.genmodel.GenModel;
import hex.genmodel.MojoModel;

public class DeepwaterMojoModel extends MojoModel {
  public String _problem_type;
  public int _mini_batch_size;
  public int _height;
  public int _width;
  public int _channels;

  public int _nums;
  public int _cats;
  public int[] _catOffsets;
  public double[] _normMul;
  public double[] _normSub;
  public double[] _normRespMul;
  public double[] _normRespSub;
  public boolean _useAllFactorLevels;

  transient byte[] _network;
  transient byte[] _parameters;
  public transient float[] _meanImageData;

  BackendTrain _backend; //interface provider
  BackendModel _model;  //pointer to C++ process
  ImageDataSet _imageDataSet; //interface provider
  RuntimeOptions _opts;
  BackendParams _backendParams;

  DeepwaterMojoModel(String[] columns, String[][] domains) {
    super(columns, domains);
  }

  /**
   * Corresponds to `hex.DeepWater.score0()`
   */
  @Override
  public final double[] score0(double[] doubles, double offset, double[] preds) {
    assert(doubles != null) : "doubles are null";
    float[] floats;
    int cats = _catOffsets == null ? 0 : _catOffsets[_cats];
    if (_nums > 0) {
      floats = new float[_nums + cats]; //TODO: use thread-local storage
      GenModel.setInput(doubles, floats, _nums, _cats, _catOffsets, _normMul, _normSub, _useAllFactorLevels);
    } else {
      floats = new float[doubles.length];
      for (int i=0; i<floats.length; ++i) {
        floats[i] = (float) doubles[i] - (_meanImageData == null ? 0 : _meanImageData[i]);
      }
    }
    float[] predFloats = _backend.predict(_model, floats);
    assert(_nclasses == predFloats.length) : "nclasses " + _nclasses + " predFloats.length " + predFloats.length;
    if (_nclasses > 1) {
      for (int i = 0; i < predFloats.length; ++i)
        preds[1 + i] = predFloats[i];
      if (_balanceClasses)
        GenModel.correctProbabilities(preds, _priorClassDistrib, _modelClassDistrib);
      preds[0] = GenModel.getPrediction(preds, _priorClassDistrib, doubles, _defaultThreshold);
    } else {
      if (_normRespMul!=null && _normRespSub!=null)
        preds[0] = predFloats[0] * _normRespMul[0] + _normRespSub[0];
      else
        preds[0] = predFloats[0];
    }
    return preds;
  }

  @Override
  public double[] score0(double[] row, double[] preds) {
    return score0(row, 0.0, preds);
  }

  static public BackendTrain createDeepWaterBackend(String backend) {
    try {
      if (backend.equals("mxnet"))      backend="deepwater.backends.mxnet.MXNetBackend";
      if (backend.equals("tensorflow")) backend="deepwater.backends.tensorflow.TensorflowBackend";
      if (backend.equals("caffe")) backend="deepwater.backends.caffe.CaffeBackend";
      return (BackendTrain)(Class.forName(backend).newInstance());
    } catch (Exception ignored) {}
    return null;
  }
}


text:
'use strict';

const fs = require('fs');
const misc = require('../../misc');
const wait = require('../../wait');

describe('Asset Tests', () => {
    const teraslice = misc.teraslice();

    /**
         * Uploads the specified asset file and then submits the specified job spec
         * it then waits for the job to enter the running state, then waits for
         * the requested number of workers to enter the joined state.  Then that has
         * happened it tests to see that the number of workers joined is the number
         * of workers requested.  This reasoning is a bit circular, but a worker
         * won't enter the `joined` state if it fails to load its assets.
         *
         * @param {string}   jobSpecName the name of job to run
         * @param {string}   assetPath   the relative path to the asset file
         */
    function submitAndValidateAssetJob(jobSpecName, assetPath) {
        const fileStream = fs.createReadStream(assetPath);
        const jobSpec = misc.newJob(jobSpecName);
        const { workers } = jobSpec; // save for comparison

        return teraslice.assets.post(fileStream)
            .then((result) => {
                // NOTE: In this case, the asset is referenced by the ID
                // assigned by teraslice and not it's name.
                jobSpec.assets = [JSON.parse(result)._id];
                return teraslice.jobs.submit(jobSpec)
                    .then(job =>
                        job.waitForStatus('running')
                            .then(() => wait.forWorkersJoined(job.id(), workers, 20))
                            .then((r) => {
                                expect(r).toEqual(workers);
                                return job.stop();
                            }));
            });
    }
    it('After uploading an asset, it can be deleted', (done) => {
        const testStream = fs.createReadStream('spec/fixtures/assets/example_asset_1.zip');

        teraslice.assets.post(testStream)
            .then((result) => {
                // save the asset ID that was submitted to terslice
                const assetId = JSON.parse(result)._id;
                return teraslice.assets.delete(assetId)
                    .then((response) => {
                        // ensure the deleted asset's ID matches that of
                        // the saved asset
                        expect(assetId).toEqual(JSON.parse(response).assetId);
                        // TODO: verify that this asset no longer
                        // appears in /txt/assets
                        return response;
                    });
            })
            .catch(fail)
            .finally(done);
    });

    // Test a bad asset
    // curl -XPOST -H "Content-Type: application/octet-stream"
    //   localhost:45678/assets --data-binary spec/fixtures/assets/example_assets_1.zip
    // {"error":"asset.json was not found in root directory of asset bundle
    //    nor any immediate sub directory"}
    it('Uploading a bad asset returns an error', (done) => {
        const testStream = fs.createReadStream('spec/fixtures/assets/example_bad_asset_1.zip');

        teraslice.assets.post(testStream)
            .then(result => expect(JSON.parse(result).error).toMatch('asset.json was not found'))
            .catch(fail)
            .finally(done);
    });

    // Type 1 Asset - asset.json at top level of zipfile
    // example_assets/
    // example_assets/drop_property/
    // example_assets/drop_property/index.js
    // asset.json
    it('After starting a job with a Type 1 asset specified by ID should eventually have all workers joined', (done) => {
        const assetPath = 'spec/fixtures/assets/example_asset_1.zip';
        submitAndValidateAssetJob('generator-asset', assetPath)
            .catch(fail)
            .finally(done);
    });

    // Type 2 Asset - asset.json in subdirectory of zipfile
    // example_assets/
    // example_assets/asset.json
    // example_assets/drop_property/
    // example_assets/drop_property/index.js
    it('After starting a job with a Type 2 asset specified by ID should eventually have all workers joined', (done) => {
        const assetPath = 'spec/fixtures/assets/example_asset_2.zip';
        submitAndValidateAssetJob('generator-asset', assetPath)
            .catch(fail)
            .finally(done);
    });
});


text:
namespace GoF {
namespace AbstractFactory {

    std::unique_ptr<PanelInterface> IOSFactory::createPanel()
    {
        return std::make_unique<IOSPanel>();
    }

    std::unique_ptr<LabelInterface> IOSFactory::createLabel()
    {
        return std::make_unique<IOSLabel>();
    }

    std::unique_ptr<ButtonInterface> IOSFactory::createButton()
    {
        return std::make_unique<IOSButton>();
    }

} }