text:
package org.mifos.security.activity;

import junit.framework.Assert;

import org.hibernate.Query;
import org.hibernate.Session;
import org.junit.Test;
import org.mifos.application.master.business.LookUpValueLocaleEntity;
import org.mifos.application.master.business.LookUpEntity;
import org.mifos.application.master.persistence.MasterPersistence;
import org.mifos.framework.MifosIntegrationTestCase;
import org.mifos.framework.exceptions.PersistenceException;
import org.mifos.framework.hibernate.helper.StaticHibernateUtil;
import org.mifos.framework.persistence.DatabaseMigrator;
import org.mifos.security.rolesandpermission.business.ActivityEntity;
import org.mifos.security.rolesandpermission.business.RoleBO;
import org.mifos.security.rolesandpermission.persistence.RolesPermissionsPersistence;
import org.mifos.security.rolesandpermission.util.helpers.RolesAndPermissionConstants;
import org.mifos.security.rolesandpermission.utils.ActivityTestUtil;

public class ActivityGeneratorIntegrationTest extends MifosIntegrationTestCase {

    @Test
    public void testShouldInsertSuccessActivity() throws Exception {
        Session session = StaticHibernateUtil.getSessionTL();

        ActivityGenerator activityGenerator = new ActivityGenerator();
        LookUpEntity lookUpEntity = new LookUpEntity();
        lookUpEntity.setEntityId((short) LookUpEntity.ACTIVITY);

        short parentId = 13;

        activityGenerator.upgradeUsingHQL(DynamicLookUpValueCreationTypes.BirtReport, parentId, "abcd");
        int lookUpId = activityGenerator.getLookUpId();
       Assert.assertEquals("abcd", activityGenerator.getLookUpValueLocaleEntity(DatabaseMigrator.ENGLISH_LOCALE,
                lookUpId).getLookUpValue());
       Assert.assertEquals(ActivityGenerator.calculateDynamicActivityId(), (int) activityGenerator
                .getActivityEntity(lookUpId).getId() - 1);
        Query query = session.createQuery("from RoleActivityEntity r where r.activity = :activity and r.role = :role");
        query.setParameter("activity", activityGenerator.getActivityEntity(lookUpId));
        RoleBO roleBo = (RoleBO) session.load(RoleBO.class, (short) RolesAndPermissionConstants.ADMIN_ROLE);
        query.setParameter("role", roleBo);
       Assert.assertEquals(1, query.list().size());

    }

    @Test
    public void testShouldSuccessWhenChangeActivityParent() throws PersistenceException {
        RolesPermissionsPersistence rpp = new RolesPermissionsPersistence();
        ActivityEntity activity = (ActivityEntity) rpp.getPersistentObject(ActivityEntity.class, Short
                .valueOf((short) 2));
       Assert.assertEquals(1, activity.getParent().getId().shortValue());
        ActivityGenerator.reparentActivityUsingHibernate((short) 2, (short) 13);
        activity = (ActivityEntity) rpp.getPersistentObject(ActivityEntity.class, Short.valueOf((short) 2));
       Assert.assertEquals(13, activity.getParent().getId().shortValue());
        ActivityGenerator.reparentActivityUsingHibernate((short) 2, (short) 1);
    }

    @Test
    public void testShouldSuccessWhenChangeActivityMessage() throws Exception {
        RolesPermissionsPersistence rpp = new RolesPermissionsPersistence();
        MasterPersistence mp = new MasterPersistence();
        ActivityEntity activityEntity = (ActivityEntity) rpp.getPersistentObject(ActivityEntity.class, Short
                .valueOf((short) 3));
        Integer lookUpId = activityEntity.getActivityNameLookupValues().getLookUpId();
       Assert.assertEquals(373, lookUpId.intValue());

        short localeId = DatabaseMigrator.ENGLISH_LOCALE;
        LookUpValueLocaleEntity lookUpValueLocaleEntity = mp.retrieveOneLookUpValueLocaleEntity(localeId, lookUpId
                .intValue());
        Assert.assertNull(lookUpValueLocaleEntity.getLookUpValue());

        ActivityGenerator.changeActivityMessage((short) 3, localeId, "wahaha");
        lookUpValueLocaleEntity = mp.retrieveOneLookUpValueLocaleEntity(localeId, lookUpId.intValue());

       Assert.assertEquals("wahaha", lookUpValueLocaleEntity.getLookUpValue());
        ActivityGenerator.changeActivityMessage((short) 3, localeId, null);

    }

    @Test
    public void testShouldGenerateMinActivityIdWhenCalculate() throws Exception {
        short minActivityId = -32767;
        ActivityEntity activity = ActivityTestUtil.insertActivityForTest(minActivityId);
       Assert.assertEquals(minActivityId - 1, ActivityGenerator.calculateDynamicActivityId());
        ActivityTestUtil.deleteActivityForTest(activity);
    }

}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class profile extends CI_Controller {

	function index()
	{
            $dados = $this->inicial();
            $this->load->helper('file');

            $this->load->view('meu_perfil', $dados);

	}

        function cadastro(){
            $dados = $this->inicial();
            $this->load->helper('file');

            //FAZ A VALIDAÇÃO DO FORMULÁRIO, ANTES DE CADASTRAR
            $this->load->library('form_validation');
            $this->form_validation->set_rules('SenhaAtual', 'SenhaAtual','required|callback__check_senha');
            $this->form_validation->set_rules('Senha', 'Senha','required|min_length[5]|md5');
            $this->form_validation->set_rules('Confirmacao', 'Confirmacao','required|md5|matches[Senha]');

            //SE PASSAR NA VALIDAÇÃO INSERE DADOS DO DB
            if($this->form_validation->run() == TRUE){

                $config['upload_path']          = './uploads/';
                $config['allowed_types']        = 'gif|jpg|png';

                $this->load->library('upload', $config);

                if ($this->upload->do_upload('Arquivo')){
                        $data = array('upload_data' => $this->upload->data());
                }

                if(isset($data['upload_data'])){
                    $DadosForm['Foto']=$data['upload_data']['file_name'];
                }
                $DadosForm['Id']=$this->input->post('Id');
                $DadosForm['Senha']=$this->input->post('Senha');

                $this->usuario->insere($DadosForm);

                redirect('profile?ok=true');
           }else{
                $this->load->view('meu_perfil', $dados);
           }
        }

        function _check_senha(){
            if($this->input->post('Id')){
                $user = $this->usuario->dados($this->input->post('Id'));
                if($user->Senha == md5($this->input->post('SenhaAtual'))){
                    return true;
                }
            }
            $this->form_validation->set_message('_check_senha', 'A senha atual não corresponde a digitada!');
            return false;
        }

        function inicial(){
            $this->load->helper('check_login');
            check_login($this->session->has_userdata('UsuarioId'));
            $UsuarioId = $this->session->userdata('UsuarioId');
            $usuario = $this->usuario->dados($UsuarioId);
            $empresa = $this->empresa->dados($usuario->EmpresaId);
            $dados = carrega_dados($usuario, $empresa);
            return $dados;
        }
}

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace Megalopolis
{
    namespace LossFunctions
    {
        // Cross-entropy loss function for binary classification
        public class BinaryCrossEntropy : ILossFunction
        {
            public double Function(double y, double t)
            {
                return -t * Math.Log(y + 1e-7, Math.E) - (1.0 - t) * Math.Log(1.0 - t + 1e-7, Math.E);
            }

            public double Derivative(double y, double t)
            {
                return (y - t) / (y * (1.0 - y));
            }
        }
    }
}


text:
<!doctype html>

<title>4chan /b/ Scrubber, v3.0</title>

<canvas height="100%" width="100%" id="c"></canvas>


text:
def name():
    return 'orange'


text:
<!DOCTYPE html>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>README - RDoc Documentation</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

    Home
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Table of Contents

Matrixfamily

Enunciado

Desarrollo

Pages

Gemfile

Gemfile.lock~

Guardfile

LICENSE

README

Rakefile

created.rid

matrixfamily-0.0.1

matrixfamily.gemspec

Class and Module Index

Fraccion

Matrixfamily

Matriz

Matrizdensa

Matrizdispersa

Object

Vectordisperso

Matrixfamily¶ ↑

Nuestra jerarquía de clases para implementar las matrices será: - Una
matriz madre - Dos matrices hijas (Densa y Dispersa)

Enunciado¶ ↑

    1.- Utilizar bundle para crear la estructura estándar de una gema.
    Véanse railcast: gems with bundler y el blog polishing rubies
            bundle gem nombre
    2.- Partiendo de la implementación que se ha realizado en prácticas anteriores para las Fracciones y las Matrices reorganizar el código.
    3.- Escribir un conjunto de pruebas unitarias (Unit Testing)
            test/tc_nombre.rb
    4.- Escribir un fichero de espectativas de comportamiento (TDD)
            spec/nombre_spec.rb
    5.- Realizar un seguimiento continuo de las pruebas (Continuous Testing)
            guard
    6.- Comprobar el correcto funcionamiento en distintas plataformas (Continuous Integration)
            travis
    7.- Indique la URL del repositorio en el que se ha desarrollado.

Desarrollo¶ ↑

    Alejandro Morales Pérez
    Daniel Mateos Peláez

[Validate]

Generated by RDoc 4.0.1.

Generated with the Darkfish Rdoc Generator 3.


text:
<?php
namespace Payum\Core\Tests\Action;

use Payum\Core\Action\PayoutPayoutAction;
use Payum\Core\GatewayAwareInterface;
use Payum\Core\Model\Payout as PayoutModel;
use Payum\Core\Model\PayoutInterface;
use Payum\Core\Request\Payout;
use Payum\Core\Request\Convert;
use Payum\Core\Request\GetHumanStatus;
use Payum\Core\Security\TokenInterface;
use Payum\Core\Tests\GenericActionTest;

class PayoutPayoutActionTest extends GenericActionTest
{
    protected $requestClass = Payout::class;

    protected $actionClass = PayoutPayoutAction::class;

    public function provideSupportedRequests()
    {
        $payout = new $this->requestClass($this->getMock(TokenInterface::class));
        $payout->setModel($this->getMock(PayoutInterface::class));

        return array(
            array(new $this->requestClass(new PayoutModel())),
            array($payout),
        );
    }

    /**
     * @test
     */
    public function shouldImplementGatewayAwareInterface()
    {
        $rc = new \ReflectionClass($this->actionClass);

        $this->assertTrue($rc->implementsInterface(GatewayAwareInterface::class));
    }

    /**
     * @test
     */
    public function shouldExecuteConvertRequestIfStatusNew()
    {
        $payoutModel = new PayoutModel();

        $testCase = $this;

        $gatewayMock = $this->createGatewayMock();
        $gatewayMock
            ->expects($this->at(0))
            ->method('execute')
            ->with($this->isInstanceOf(GetHumanStatus::class))
            ->will($this->returnCallback(function (GetHumanStatus $request) {
                $request->markNew();
            }))
        ;
        $gatewayMock
            ->expects($this->at(1))
            ->method('execute')
            ->with($this->isInstanceOf(Convert::class))
            ->will($this->returnCallback(function (Convert $request) use ($testCase, $payoutModel) {
                $testCase->assertSame($payoutModel, $request->getSource());
                $testCase->assertSame('array', $request->getTo());
                $testCase->assertNull($request->getToken());

                $request->setResult(array());
            }))
        ;

        $action = new PayoutPayoutAction();
        $action->setGateway($gatewayMock);

        $action->execute($payout = new Payout($payoutModel));

        $this->assertSame($payoutModel, $payout->getFirstModel());
        $this->assertInstanceOf('ArrayAccess', $payout->getModel());
        $this->assertNull($payout->getToken());
    }

    /**
     * @test
     */
    public function shouldSetConvertedResultToPayoutAsDetails()
    {
        $payoutModel = new PayoutModel();

        $testCase = $this;

        $gatewayMock = $this->createGatewayMock();
        $gatewayMock
            ->expects($this->at(0))
            ->method('execute')
            ->with($this->isInstanceOf(GetHumanStatus::class))
            ->will($this->returnCallback(function (GetHumanStatus $request) {
                $request->markNew();
            }))
        ;
        $gatewayMock
            ->expects($this->at(1))
            ->method('execute')
            ->with($this->isInstanceOf(Convert::class))
            ->will($this->returnCallback(function (Convert $request) use ($testCase, $payoutModel) {
                $details['foo'] = 'fooVal';

                $request->setResult(array(
                    'foo' => 'fooVal',
                ));
            }))
        ;

        $action = new PayoutPayoutAction();
        $action->setGateway($gatewayMock);

        $action->execute($payout = new Payout($payoutModel));

        $this->assertSame($payoutModel, $payout->getFirstModel());
        $this->assertInstanceOf('ArrayAccess', $payout->getModel());

        $details = $payoutModel->getDetails();
        $this->assertNotEmpty($details);

        $this->assertArrayHasKey('foo', $details);
        $this->assertEquals('fooVal', $details['foo']);
    }

    /**
     * @test
     */
    public function shouldExecuteConvertRequestWithTokenIfOnePresent()
    {
        $payoutModel = new PayoutModel();
        $token = $this->createTokenMock();

        $testCase = $this;

        $gatewayMock = $this->createGatewayMock();
        $gatewayMock
            ->expects($this->at(0))
            ->method('execute')
            ->with($this->isInstanceOf(GetHumanStatus::class))
            ->will($this->returnCallback(function (GetHumanStatus $request) {
                $request->markNew();
            }))
        ;
        $gatewayMock
            ->expects($this->at(1))
            ->method('execute')
            ->with($this->isInstanceOf(Convert::class))
            ->will($this->returnCallback(function (Convert $request) use ($testCase, $payoutModel, $token) {
                $testCase->assertSame($payoutModel, $request->getSource());
                $testCase->assertSame($token, $request->getToken());

                $request->setResult(array());
            }))
        ;

        $action = new PayoutPayoutAction();
        $action->setGateway($gatewayMock);

        $payout = new Payout($token);
        $payout->setModel($payoutModel);

        $action->execute($payout);

        $this->assertSame($payoutModel, $payout->getFirstModel());
        $this->assertInstanceOf('ArrayAccess', $payout->getModel());
        $this->assertSame($token, $payout->getToken());
    }

    /**
     * @test
     */
    public function shouldSetDetailsBackToPayoutAfterPayoutDetailsExecution()
    {
        $expectedDetails = array('foo' => 'fooVal');

        $payoutModel = new PayoutModel();
        $payoutModel->setDetails($expectedDetails);

        $testCase = $this;

        $gatewayMock = $this->createGatewayMock();
        $gatewayMock
            ->expects($this->at(0))
            ->method('execute')
            ->with($this->isInstanceOf(GetHumanStatus::class))
            ->will($this->returnCallback(function (GetHumanStatus $request) {
                $request->markPending();
            }))
        ;
        $gatewayMock
            ->expects($this->at(1))
            ->method('execute')
            ->with($this->isInstanceOf(Payout::class))
            ->will($this->returnCallback(function (Payout $request) use ($testCase, $expectedDetails) {
                $details = $request->getModel();

                $testCase->assertInstanceOf('ArrayAccess', $details);
                $testCase->assertEquals($expectedDetails, iterator_to_array($details));

                $details['bar'] = 'barVal';
            }))
        ;

        $action = new PayoutPayoutAction();
        $action->setGateway($gatewayMock);

        $action->execute($payout = new Payout($payoutModel));

        $this->assertSame($payoutModel, $payout->getFirstModel());
        $this->assertInstanceOf('ArrayAccess', $payout->getModel());
        $this->assertEquals(array('foo' => 'fooVal', 'bar' => 'barVal'), $payoutModel->getDetails());
    }

    /**
     * @test
     */
    public function shouldSetDetailsBackToPayoutEvenIfExceptionThrown()
    {
        $expectedDetails = array('foo' => 'fooVal');

        $payoutModel = new PayoutModel();
        $payoutModel->setDetails($expectedDetails);

        $gatewayMock = $this->createGatewayMock();
        $gatewayMock
            ->expects($this->at(0))
            ->method('execute')
            ->with($this->isInstanceOf(GetHumanStatus::class))
            ->will($this->returnCallback(function (GetHumanStatus $request) {
                $request->markPending();
            }))
        ;
        $gatewayMock
            ->expects($this->at(1))
            ->method('execute')
            ->with($this->isInstanceOf(Payout::class))
            ->will($this->returnCallback(function (Payout $request) {
                $details = $request->getModel();
                $details['bar'] = 'barVal';

                throw new \Exception();
            }))
        ;

        $action = new PayoutPayoutAction();
        $action->setGateway($gatewayMock);

        $this->setExpectedException('Exception');
        $action->execute($payout = new Payout($payoutModel));

        $this->assertSame($payoutModel, $payout->getFirstModel());
        $this->assertInstanceOf('ArrayAccess', $payout->getModel());
        $this->assertEquals(array('foo' => 'fooVal', 'bar' => 'barVal'), $payoutModel->getDetails());
    }
}


text:
#ifndef BITCOIN_CHAINPARAMSSEEDS_H
#define BITCOIN_CHAINPARAMSSEEDS_H
/**
 * List of fixed seed nodes for the bitcoin network
 * AUTOGENERATED by share/seeds/generate-seeds.py
 *
 * Each line contains a 16-byte IPv6 address and a port.
 * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
 */
static SeedSpec6 pnSeed6_main[] = {
//    {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2e,0x69,0x6a,0x7e}, 8333},
};

static SeedSpec6 pnSeed6_test[] = {
};
#endif // BITCOIN_CHAINPARAMSSEEDS_H


text:
#ifndef XMLTokenizer_h
#define XMLTokenizer_h

#ifdef __cplusplus

#include <deque>

#include <sbml/xml/XMLExtern.h>
#include <sbml/xml/XMLHandler.h>

LIBSBML_CPP_NAMESPACE_BEGIN

class LIBLAX_EXTERN XMLToken;

class LIBSBML_EXTERN XMLTokenizer : public XMLHandler
{
public:

  /**
   * Creates a new XMLTokenizer.
   */
  XMLTokenizer ();

  /**
   * Copy Constructor
   */
  XMLTokenizer (const XMLTokenizer& other);

  /**
   * Destroys this XMLTokenizer.
   */
  virtual ~XMLTokenizer ();

  /**
   * Returns the encoding of the underlying XML document.
   *
   * @return the encoding of the underlying XML document.
   */
  const std::string& getEncoding ();

  /**
   * Returns the xml version of the underlying XML document.
   *
   * @return the xml version of the underlying XML document.
   */
  const std::string& getVersion ();

  /**
   * Returns true if this XMLTokenizer has at least one XMLToken ready to
   * deliver, false otherwise.
   *
   * Note that hasNext() == false does not imply isEOF() == true.  The
   * XMLTokenizer may simply be waiting for the XMLParser to parse more of
   * the document.
   *
   * @return true if this XMLTokenizer has at least one XMLToken ready to
   * deliver, false otherwise.
   */
  bool hasNext () const;

  /**
   * @return true if the end of the XML file (document) has been reached
   * and there are no more tokens to consume, false otherwise.
   */
  bool isEOF () const;

  /**
   * Consume the next XMLToken and return it.
   *
   * @return the next XMLToken.
   */
  XMLToken next ();

  /**
   * Returns the next XMLToken without consuming it.  A subsequent call to
   * either peek() or next() will return the same token.
   *
   * @return the next XMLToken.
   */
  const XMLToken& peek ();

  /**
   * Prints a string representation of the underlying token stream, for
   * debugging purposes.
   */
  std::string toString ();

  /**
   * Receive notification of the XML declaration, i.e.
   * <?xml version="1.0" encoding="UTF-8"?>
   */
  virtual void XML (const std::string& version, const std::string& encoding);

  /**
   * Receive notification of the start of an element.
   */
  virtual void startElement (const XMLToken& element);

  /**
   * Receive notification of the end of the document.
   */
  virtual void endDocument ();

  /**
   * Receive notification of the end of an element.
   */
  virtual void endElement (const XMLToken& element);

  /**
   * Receive notification of character data inside an element.
   */
  virtual void characters (const XMLToken& data);

protected:

  unsigned int determineNumberChildren(bool & valid,
                                       const std::string& element = "");

  unsigned int determineNumSpecificChildren(bool & valid,
               const std::string& qualifier,  const std::string& container);

  bool containsChild(bool & valid,
               const std::string& qualifier,  const std::string& container);

  bool mInChars;
  bool mInStart;
  bool mEOFSeen;

  std::string mEncoding;
  std::string mVersion;

  XMLToken             mCurrent;
  std::deque<XMLToken> mTokens;

  friend class XMLInputStream;

};

LIBSBML_CPP_NAMESPACE_END

#endif  /* __cplusplus */
#endif  /* XMLTokenizer_h */
/** @endcond */


text:
const NSInteger kBarItemTagAdd = 150;
const NSInteger kBarItemTagRemove = 300;
const NSInteger kBarItemTagCustomized = 111;

@interface NIToolbarPhotoViewController (InheritedPrivate)

- (void)updateToolbarItems;

@end

@interface ADBMediaDetailController () {
    @protected
    NSInteger _initialIndex;
    @private
    BOOL _firstLoadCompleted;
}

@property (nonatomic, weak) MPMoviePlayerController *movieController;

//notifications
- (void)receivedAssetStoreCountUpdate:(NSNotification *)notif;

@end

@implementation ADBMediaDetailController

- (id)initWithSelectedItem:(ADBAssetItem *)item inItems:(NSArray *)items {
    self = [super init];
    if (self) {
        NSUInteger centerIndex = [items indexOfObject:item];
        _dataSource = [[ADBMediaDetailDataSource alloc] initWithItems:items];
        _dataSource.controller = self;
        _initialIndex = centerIndex;

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(receivedAssetStoreCountUpdate:)
                                                     name:kNotificationSendAssetsUpdated
                                                   object:nil];
    }

    return self;
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (NSString *)title {
    NSString *selectedTitle = [[ADBAssetStore instance] selectedTitleString];
    return selectedTitle;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setAutomaticallyAdjustsScrollViewInsets:NO];
    self.toolbarIsTranslucent = YES;
    self.photoAlbumView.photoViewBackgroundColor = [UIColor whiteColor];
    self.photoAlbumView.dataSource = self.dataSource;

    [self.photoAlbumView reloadData];

    self.photoScrubberView.dataSource = self.dataSource;
    [self.photoScrubberView reloadData];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    self.toolbar.barStyle = UIBarStyleDefault;
    self.toolbar.translucent = YES;
    self.toolbar.barTintColor = [UIColor blueColor];
    self.toolbar.tintColor = [UIColor whiteColor];

    //FIXME: if this is called in viewDidLoad in landscape
    //rotation breaks because the the page frames are calculated incorrectly
    //thus, we have to maintain state whether it's the controller's first load
    if (!_firstLoadCompleted) {
        [self.photoAlbumView moveToPageAtIndex:_initialIndex animated:NO];
        [self.photoScrubberView setSelectedPhotoIndex:_initialIndex animated:NO];
        _firstLoadCompleted = YES;
    } else {
        //this catches the above rotation bug, but moves us to last index rather than initial
        //eg, play movie, rotate to landscape, go back to detail controller
        [self.photoAlbumView moveToPageAtIndex:self.photoAlbumView.centerPageIndex animated:NO];
    }
}

#pragma mark -
#pragma mark ADBMediaDetailController

- (ADBAssetItem *)currentCenterItem {
    NSUInteger centerIndex = (NSUInteger) self.photoAlbumView.centerPageIndex;
    return self.dataSource.items[centerIndex];
}

- (void)movieOverlayTapped {
    ADBAssetItem *currentItem = self.currentCenterItem;
    NSURL *itemUrl = currentItem.defaultAssetURL;
    if (currentItem.type != ADBAssetTypeVideo || !itemUrl) return;

    //apple framework bug?
    //http://stackoverflow.com/questions/13203336/iphone-mpmovieplayerviewcontroller-cgcontext-errors/14669166#14669166
    //fake graphics context prevents errors
    UIGraphicsBeginImageContext(CGSizeMake(1.f, 1.f));
    MPMoviePlayerViewController *movieController = [[MPMoviePlayerViewController alloc] initWithContentURL:itemUrl];
    self.movieController = movieController.moviePlayer;
    UIGraphicsEndImageContext();

    [movieController.moviePlayer prepareToPlay];
    [self presentMoviePlayerViewControllerAnimated:movieController];
}

#pragma mark Notifications

- (void)receivedAssetStoreCountUpdate:(NSNotification *)notif {
    //assets added or removed, change title
    self.title = self.title;
}

#pragma mark - NIPhotoScrubberViewDelegate

- (void)photoScrubberViewDidChangeSelection:(NIPhotoScrubberView *)photoScrubberView {
    NSInteger selectedIndex = photoScrubberView.selectedPhotoIndex;
    [self.photoAlbumView moveToPageAtIndex:selectedIndex animated:YES];
}

@end


text:
'use strict';

// MODULES //

var tape = require( 'tape' );
var round = require( 'math-round' );
var proxyquire = require( 'proxyquire' );
var resolve = require( './../lib/resolve.js' );

// FUNCTIONS //

/**
* FUNCTION: options()
*	Returns mock request options.
*
* @private
* @returns {Object} mock request options
*/
function options() {
	return {
		'method': 'GET',
		'protocol': 'https',
		'hostname': 'api.beep.com',
		'port': 443,
		'pathname': '/api/v3/user/repos',
		'page': 1,
		'per_page': 1,
		'last_page': 1,
		'useragent': 'beepboopbop',
		'accept': 'application/vnd.github.v3+json',
		'token': 'abcdef123!'
	};
} // end FUNCTION options()

/**
* FUNCTION: headers()
*	Returns mock response headers.
*
* @private
* @returns {Object} mock response headers
*/
function headers() {
	return {
		'x-ratelimit-limit': '5000',
		'x-ratelimit-remaining': '4999',
		'x-ratelimit-reset': ( round( Date.now()/1000 ) ).toString()
	};
} // end FUNCTION headers()

/**
* FUNCTION: request( error[, headers, body] )
*	Returns a mock request function.
*
* @private
* @param {Error|Object|Null} error - an error object or null
* @param {Object|Null} headers - response headers or null
* @param {Object|Array|Null} body - response body or null
* @returns {Function} mock request
*/
function request( error, headers, body ) {
	if ( arguments.length === 1 ) {
		return req1;
	}
	return req2;

	function req1( opts, clbk ) {
		setTimeout( onTimeout, 0 );
		function onTimeout() {
			var err;
			if ( error instanceof Error ) {
				err = {
					'status': 500,
					'message': error.message
				};
			} else {
				err = error;
			}
			clbk( err );
		}
	}
	function req2( opts, clbk ) {
		setTimeout( onTimeout, 0 );
		function onTimeout() {
			var err;
			var res;
			if ( error instanceof Error ) {
				err = {
					'status': 500,
					'message': error.message
				};
				return clbk( err );
			} else {
				err = error;
			}
			res = {};
			res.headers = headers;
			clbk( err, res, body );
		}
	}
} // end FUNCTION request()

/**
* FUNCTION: multirequest( args )
*	Returns a mock request function capable of being called multiple times, each time with different arguments.
*
* @private
* @param {Array[]} args - array of argument arrays
* @returns {Function} request mock capable of being called multiple times
*/
function multirequest( args ) {
	var reqs;
	var i;
	reqs = new Array( args.length );
	for ( i = 0; i < reqs.length; i++ ) {
		reqs[ i ] = request.apply( null, args[i] );
	}
	i = -1;
	return function multirequest( opts, clbk ) {
		i += 1;
		reqs[ i ]( opts, clbk );
	};
} // end FUNCTION multirequest()

// VARIABLES //

var link1 = '<https://api.github.com/user/9287/repos?page=2&per_page=1>; rel="next", <https://api.github.com/user/9287/repos?page=3&per_page=1>; rel="last"';

var link2 = '<https://api.github.com/user/9287/repos?page=1&per_page=1>; rel="first", <https://api.github.com/user/9287/repos?page=3&per_page=1>; rel="next", <https://api.github.com/user/9287/repos?page=1&per_page=1>; rel="prev", <https://api.github.com/user/9287/repos?page=3&per_page=1>; rel="last"';

var link3 = '<https://api.github.com/user/9287/repos?page=1&per_page=1>; rel="first", <https://api.github.com/user/9287/repos?page=2&per_page=1>; rel="prev", <https://api.github.com/user/9287/repos?page=3&per_page=1>; rel="last"';

// TESTS //

tape( 'the main export is a function', function test( t ) {
	t.equal( typeof resolve, 'function', 'main export is a function' );
	t.end();
});

tape( 'if an initial request encounters an application error, the error is returned to the provided callback', function test( t ) {
	var resolve;
	var mock;
	var err;

	err = new Error( 'ENOTFOUND' );

	mock = request( err );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	resolve( options(), done );

	function done( error ) {
		t.equal( error.status, 500, '500 status' );
		t.equal( error.message, err.message, 'equal message' );
		t.end();
	}
});

tape( 'if a paginated request encounters an application error (e.g., network goes down after an initial request), the error is returned to the provided callback with rate limit information', function test( t ) {
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link1;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [{'beep':'boop'}];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = new Error( 'ENOTFOUND' );
	arr[ 1 ] = null;
	arr[ 2 ] = null;
	args.push( arr );

	// Third request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link3;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [{'boop':'beep'}];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();

	// Set the `last_page` option to 'last' to instruct `resolve` to resolve multiple pages:
	opts.last_page = 'last';

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error.status, 500, '500 status' );
		t.equal( error.message, args[1][0].message, 'equal message' );

		t.equal( data, null, 'no response data' );

		t.ok( info, 'has ratelimit info' );
		t.equal( info.remaining, +args[2][1][ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );

		t.end();
	}
});

tape( 'for some downstream errors, the error is returned to the provided callback with rate limit information', function test( t ) {
	var resolve;
	var mock;
	var err;
	var h;

	err = {
		'status': 502,
		'message': 'unable to parse response as JSON'
	};

	h = headers();
	mock = request( err, h, null );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	resolve( options(), done );

	function done( error, data, info ) {
		t.equal( error.status, err.status, 'equal status' );
		t.equal( error.message, err.message, 'equal message' );

		t.equal( data, null, 'no response data' );

		t.ok( info, 'has rate limit info' );
		t.equal( info.remaining, +h[ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );

		t.end();
	}
});

tape( 'for some downstream errors, rate limit information may not be available', function test( t ) {
	// e.g., corrupted response, Github service interruption, etc, where rate limit info headers are not set. Rate limit info values should be NaN.
	var resolve;
	var mock;
	var err;

	err = {
		'status': 503,
		'message': 'service down for maintenance'
	};

	mock = request( err, {}, null );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	resolve( options(), done );

	function done( error, data, info ) {
		t.equal( error.status, err.status, 'equal status' );
		t.equal( error.message, err.message, 'equal message' );

		t.equal( data, null, 'no response data' );

		t.ok( info, 'has rate limit info arg' );
		t.ok( info.remaining !== info.remaining, 'remaining is NaN' );
		t.ok( info.reset !== info.reset, 'reset is NaN' );
		t.ok( info.limit !== info.limit, 'limit is NaN' );

		t.end();
	}
});

tape( 'the function supports basic (non-paginated) requests', function test( t ) {
	// e.g., https://api.github.com/
	var resolve;
	var mock;
	var body;
	var h;

	h = headers();

	body = {
		'beep': 'boop'
	};

	mock = request( null, h, body );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	resolve( options(), done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, body, 'equal response data' );

		t.equal( info.remaining, +h[ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +h[ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +h[ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'if a request is successful, the function returns rate limit information', function test( t ) {
	var resolve;
	var mock;
	var body;
	var h;

	h = headers();
	body = [ {'beep': 'boop'} ];

	mock = request( null, h, body );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	resolve( options(), done );

	function done( error, data, info ) {
		t.equal( info.remaining, +h[ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +h[ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +h[ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'the function returns paginated results as a flat object array', function test( t ) {
	var expected;
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	expected = [
		1,
		2,
		3
	];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link1;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [ expected[0] ];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link2;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [ expected[1] ];
	args.push( arr );

	// Third request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link3;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4997';
	arr[ 2 ] = [ expected[2] ];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.last_page = 'last';

	resolve( opts, done );

	function done( error, data, info ) {
		t.deepEqual( data, expected, 'expected response data' );
		t.end();
	}
});

tape( 'the function supports resolving multiple pages', function test( t ) {
	var expected;
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	expected = [
		{'beep':'boop'},
		{'beep':'bop'}
	];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link1;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [ expected[0] ];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link2;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [ expected[1] ];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.last_page = 2;

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, expected, 'expected response data' );

		t.ok( info, 'has ratelimit info' );
		t.equal( info.remaining, +args[1][1][ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +args[0][1][ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +args[0][1][ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'the function supports resolving all pages', function test( t ) {
	var expected;
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	expected = [
		{'beep':'boop'},
		{'beep':'bop'},
		{'beep':'bap'}
	];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link1;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [ expected[0] ];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link2;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [ expected[1] ];
	args.push( arr );

	// Third request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link3;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4997';
	arr[ 2 ] = [ expected[2] ];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.last_page = 'last';

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, expected, 'expected response data' );

		t.ok( info, 'has ratelimit info' );
		t.equal( info.remaining, +args[2][1][ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +args[0][1][ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +args[0][1][ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'the function supports resolving an arbitrary subset of pages', function test( t ) {
	var expected;
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	expected = [
		{'beep':'bop'},
		{'beep':'bap'}
	];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link2;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [ expected[0] ];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link3;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [ expected[1] ];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.page = 2;
	opts.last_page = 3;

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, expected, 'expected response data' );

		t.ok( info, 'has ratelimit info' );
		t.equal( info.remaining, +args[1][1][ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +args[0][1][ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +args[0][1][ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'if provided a `last_page` option exceeding the total number of available pages, the function ignores the option and only resolves the available pages', function test( t ) {
	var expected;
	var resolve;
	var mock;
	var opts;
	var args;
	var arr;

	args = [];

	expected = [
		{'beep':'boop'},
		{'beep':'bop'},
		{'beep':'bap'}
	];

	// First request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link1;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4999';
	arr[ 2 ] = [ expected[0] ];
	args.push( arr );

	// Second request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link2;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4998';
	arr[ 2 ] = [ expected[1] ];
	args.push( arr );

	// Third request call:
	arr = new Array( 3 );
	arr[ 0 ] = null;
	arr[ 1 ] = headers();
	arr[ 1 ].link = link3;
	arr[ 1 ][ 'x-ratelimit-remaining' ] = '4997';
	arr[ 2 ] = [ expected[2] ];
	args.push( arr );

	mock = multirequest( args );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.last_page = 999999999999;

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, expected, 'expected response data' );

		t.ok( info, 'has ratelimit info' );
		t.equal( info.remaining, +args[2][1][ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +args[0][1][ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +args[0][1][ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'the function handles the case where a user wants multiple pages, but only a single page exists (no link header)', function test( t ) {
	// e.g., https://api.github.com/ where not possible to return multiple pages
	var resolve;
	var mock;
	var body;
	var opts;
	var h;

	h = headers();

	body = {
		'beep': 'boop'
	};

	mock = request( null, h, body );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.last_page = 'last';

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, body, 'equal response data' );

		t.equal( info.remaining, +h[ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +h[ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +h[ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});

tape( 'the function handles the case where a user wants multiple pages, but only a single page exists (no link header)', function test( t ) {
	// e.g., https://api.github.com/user/repos, where possible to return multiple pages, but page size exceeds total number of results
	var resolve;
	var mock;
	var body;
	var opts;
	var h;

	h = headers();

	body = [
		{ 'beep': 'boop' },
		{ 'a': 5 },
		{ 'b': 6 }
	];

	mock = request( null, h, body );

	resolve = proxyquire( './../lib/resolve.js', {
		'./request.js': mock
	});

	opts = options();
	opts.per_page = 100;
	opts.last_page = 'last';

	resolve( opts, done );

	function done( error, data, info ) {
		t.equal( error, null, 'error is null' );

		t.deepEqual( data, body, 'equal response data' );

		t.equal( info.remaining, +h[ 'x-ratelimit-remaining' ], 'equal rate limit remaining' );
		t.equal( info.reset, +h[ 'x-ratelimit-reset' ], 'equal rate limit reset' );
		t.equal( info.limit, +h[ 'x-ratelimit-limit' ], 'equal rate limit limit' );

		t.end();
	}
});


text:
<?php
if ($screenname != 'welcome')
{
?>
    <button id="moveprevbtn" name="move2" value="<?php eT('Previous') ?>" type="button" accesskey="p" class="submit"><?php eT('Previous') ?></button>
<?php
}
?>
<button id="movenextbtn" name="move2" value="<?php eT('Next') ?>" accesskey="n" type="submit" class="submit"><?php eT('Next') ?></button>


text:
package org.wso2.carbon.identity.oidc.dcr.util;

import java.util.regex.Pattern;

/**
 * This class holds the constants used by DynamicClientRegistration component.
 */
public final class OIDCDCRConstants {
    public static final Pattern OIDC_DCR_ENDPOINT_REGISTER_URL_PATTERN =
            Pattern.compile("(.*)/identity/connect/register/?");
}


text:
package mu.nu.nullpo.util;

import java.io.FileInputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import org.apache.log4j.Logger;

import mu.nu.nullpo.game.component.Piece;
import mu.nu.nullpo.game.component.RuleOptions;
import mu.nu.nullpo.game.subsystem.ai.DummyAI;
import mu.nu.nullpo.game.subsystem.wallkick.Wallkick;
import net.omegaboshi.nullpomino.game.subsystem.randomizer.Randomizer;

/**
 * Generic static utils
 */
public class GeneralUtil {
	/** Log */
	static Logger log = Logger.getLogger(GeneralUtil.class);

	/**
	 * Converts play time into a String
	 * @param t Play time
	 * @return String for play time
	 */
	public static String getTime(int t) {
		if(t < 0) return "--:--.--";

		return String.format("%02d:%02d.%02d", t / 3600, (t / 60) % 60, (t % 60) * 5 / 3);
	}

	/**
	 * Returns ON if b is true, OFF if b is false
	 * @param b Boolean variable to be checked
	 * @return ON if b is true, OFF if b is false
	 */
	public static String getONorOFF(boolean b) {
		if(b == true) return "ON";
		return "OFF";
	}

	/**
	 * Returns ○ if b is true, × if b is false
	 * @param b Boolean variable to be checked
	 * @return ○ if b is true, × if b is false
	 */
	public static String getOorX(boolean b) {
		if(b == true) return "c";
		return "e";
	}

	/**
	 * Fetches the filename for a replay
	 * @return Replay's filename
	 */
	public static String getReplayFilename() {
		Calendar c = Calendar.getInstance();
		DateFormat dfm = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
		String filename = dfm.format(c.getTime()) + ".rep";
		return filename;
	}

	/**
	 * Get date and time from a Calendar
	 * @param c Calendar
	 * @return Date and Time String
	 */
	public static String getCalendarString(Calendar c) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return dfm.format(c.getTime());
	}

	/**
	 * Get date and time from a Calendar with specific TimeZone
	 * @param c Calendar
	 * @param z TimeZone
	 * @return Date and Time String
	 */
	public static String getCalendarString(Calendar c, TimeZone z) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		dfm.setTimeZone(z);
		return dfm.format(c.getTime());
	}

	/**
	 * Get date from a Calendar
	 * @param c Calendar
	 * @return Date String
	 */
	public static String getCalendarStringDate(Calendar c) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd");
		return dfm.format(c.getTime());
	}

	/**
	 * Get date from a Calendar with specific TimeZone
	 * @param c Calendar
	 * @param z TimeZone
	 * @return Date String
	 */
	public static String getCalendarStringDate(Calendar c, TimeZone z) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd");
		dfm.setTimeZone(z);
		return dfm.format(c.getTime());
	}

	/**
	 * Get time from a Calendar
	 * @param c Calendar
	 * @return Time String
	 */
	public static String getCalendarStringTime(Calendar c) {
		DateFormat dfm = new SimpleDateFormat("HH:mm:ss");
		return dfm.format(c.getTime());
	}

	/**
	 * Get time from a Calendar with specific TimeZone
	 * @param c Calendar
	 * @param z TimeZone
	 * @return Time String
	 */
	public static String getCalendarStringTime(Calendar c, TimeZone z) {
		DateFormat dfm = new SimpleDateFormat("HH:mm:ss");
		dfm.setTimeZone(z);
		return dfm.format(c.getTime());
	}

	/**
	 * Export a Calendar to a String for saving/sending. TimeZone is always GMT. Time is based on current time.
	 * @return Calendar String (Each field is separated with a hyphen '-')
	 */
	public static String exportCalendarString() {
		Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
		return exportCalendarString(c);
	}

	/**
	 * Export a Calendar to a String for saving/sending. TimeZone is always GMT.
	 * @param c Calendar
	 * @return Calendar String (Each field is separated with a hyphen '-')
	 */
	public static String exportCalendarString(Calendar c) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
		dfm.setTimeZone(TimeZone.getTimeZone("GMT"));
		return dfm.format(c.getTime());
	}

	/**
	 * Create a Calendar by using a String that came from exportCalendarString. TimeZone is always GMT.
	 * @param s String (Each field is separated with a hyphen '-')
	 * @return Calendar (null if fails)
	 */
	public static Calendar importCalendarString(String s) {
		DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
		dfm.setTimeZone(TimeZone.getTimeZone("GMT"));

		Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

		try {
			Date date = dfm.parse(s);
			c.setTime(date);
		} catch (Exception e) {
			return null;
		}

		return c;
	}

	/**
	 * Get the number of piece types can appear
	 * @param pieceEnable Piece enable flags
	 * @return Number of piece types can appear (In the normal Tetromino games, it returns 7)
	 */
	public static int getNumberOfPiecesCanAppear(boolean[] pieceEnable) {
		if(pieceEnable == null) return Piece.PIECE_COUNT;

		int count = 0;

		for(int i = 0; i < pieceEnable.length; i++) {
			if(pieceEnable[i]) count++;
		}

		return count;
	}

	/**
	 * Returns true if enabled piece types are S,Z,O only.
	 * @param pieceEnable Piece enable flags
	 * @return true if enabled piece types are S,Z,O only.
	 */
	public static boolean isPieceSZOOnly(boolean[] pieceEnable) {
		if(pieceEnable == null) return false;

		for(int i = 0; i < pieceEnable.length; i++) {
			if((pieceEnable[i] == true) && (i != Piece.PIECE_S) && (i != Piece.PIECE_Z) && (i != Piece.PIECE_O))
				return false;
		}

		return true;
	}

	/**
	 * Create piece ID array from a String
	 * @param strSrc String
	 * @return Piece ID array
	 */
	public static int[] createNextPieceArrayFromNumberString(String strSrc) {
		int len = strSrc.length();
		if(len < 1) return null;

		int[] nextArray = new int[len];
		for(int i = 0; i < len; i++) {
			int pieceID = Piece.PIECE_I;

			try {
				pieceID = Integer.parseInt(strSrc.substring(i, i + 1));
			} catch (NumberFormatException e) {}

			if((pieceID < 0) || (pieceID >= Piece.PIECE_COUNT)) pieceID = Piece.PIECE_I;

			nextArray[i] = pieceID;
		}

		return nextArray;
	}

	/**
	 * Load rule file
	 * @param filename Filename
	 * @return RuleOptions
	 */
	public static RuleOptions loadRule(String filename) {
		CustomProperties prop = new CustomProperties();

		try {
			FileInputStream in = new FileInputStream(filename);
			prop.load(in);
			in.close();
		} catch (Exception e) {
			log.warn("Failed to load rule from " + filename, e);
		}

		RuleOptions ruleopt = new RuleOptions();
		ruleopt.readProperty(prop, 0);

		return ruleopt;
	}

	/**
	 * Load Randomizer
	 * @param filename Classpath of the randomizer
	 * @return Randomizer (null if something fails)
	 */
	public static Randomizer loadRandomizer(String filename) {
		Class<?> randomizerClass = null;
		Randomizer randomizerObject = null;

		try {
			randomizerClass = Class.forName(filename);
			randomizerObject = (Randomizer) randomizerClass.newInstance();
		} catch (Exception e) {
			log.warn("Failed to load Randomizer from " + filename, e);
		}

		return randomizerObject;
	}

	/**
	 * Load Wallkick
	 * @param filename Classpath of the wallkick
	 * @return Wallkick (null if something fails)
	 */
	public static Wallkick loadWallkick(String filename) {
		Class<?> wallkickClass = null;
		Wallkick wallkickObject = null;

		try {
			wallkickClass = Class.forName(filename);
			wallkickObject = (Wallkick) wallkickClass.newInstance();
		} catch (Exception e) {
			log.warn("Failed to load Wallkick from " + filename, e);
		}

		return wallkickObject;
	}

	/**
	 * Load AI
	 * @param filename Classpath of the AI
	 * @return The instance of AI (null if something fails)
	 */
	public static DummyAI loadAIPlayer(String filename) {
		Class<?> aiClass = null;
		DummyAI aiObject = null;

		try {
			aiClass = Class.forName(filename);
			aiObject = (DummyAI) aiClass.newInstance();
		} catch (Exception e) {
			log.warn("Failed to load AIPlayer from " + filename, e);
		}

		return aiObject;
	}

	/**
	 * Combine array of strings
	 * @param strings Array of strings
	 * @param separator Separator used for combine
	 * @param startIndex First element which will be combined
	 * @return Combined string
	 */
	public static String StringCombine(String[] strings, String separator,
			int startIndex)
	{
		String res = "";
		for (int i = startIndex; i<strings.length; i++) {
			res+= strings[i];
			if (i != strings.length-1)
				res+= separator;
		}

		return res;
	}
}


text:
<?php

namespace ASF\WebsiteBundle\Event;

use Symfony\Component\EventDispatcher\Event;

use Knp\Menu\FactoryInterface;
use Knp\Menu\MenuItem;

/**
 * Primary Menu Event
 *
 * @author Nicolas Claverie <info@artscore-studio.fr>
 *
 */
class PrimaryMenuEvent extends Event
{
	/**
	 * @var MenuItem
	 */
	protected $menu;

	/**
	 * @var FactoryInterface
	 */
	protected $factory;

	/**
	 * @param MenuItem $menu
	 * @param FactoryInterface $factory
	 */
	public function __construct($menu, FactoryInterface $factory)
	{
		$this->menu = $menu;
		$this->factory = $factory;
	}

	/**
	 * @return MenuItem
	 */
	public function getMenu()
	{
		return $this->menu;
	}

	/**
	 * @return FactoryInterface
	 */
	public function getFactory()
	{
		return $this->factory;
	}
}


text:
'use strict';
var efte = require('efte');
var env = require('../lib/env');
var $ = require('zepto-fix-issue');
var nut = require('nut-hui');
var util = require('../lib/util');
var validator = require("../util/validator");
var _ = require('underscore');
var moment = require('moment');
var backAction = util.backAction;

var dftTimePeriod = {
    dayRange: [],
    timeRange: []
};

var timeOpt = [];
for (var i = 0; i <= 23; i++) {
    ['00', '15', '30', '45'].forEach(function(j){
        var t = (i < 10 ? '0' + i : i) + ':' + j;
        timeOpt.push({
            text: t,
            value: t
        });
    });
}
// timeOpt.shift();
// timeOpt.push({
//     text: '24:00',
//     value: '24:00'
// });
// var nextTimeOpt = timeOpt.map(function(time){
//     return {
//         text: '次日' + time.text,
//         value: time.value == "00:00" ? "24:00" : time.value
//     }
// });

var nextTimeOpt = timeOpt.concat({
            text: '24:00',
            value: '24:00'
        });
nextTimeOpt.shift();
var timeRange = timeOpt.map(function(time, i){
    return _.extend({}, time, {
        children: nextTimeOpt
    });
});

var weekday = [{
    text: '周一',
    value: 2
}, {
    text: '周二',
    value: 3
}, {
    text: '周三',
    value: 4
}, {
    text: '周四',
    value: 5
}, {
    text: '周五',
    value: 6
}, {
    text: '周六',
    value: 7
}, {
    text: '周日',
    value: 1
}];

var nextWeekday = weekday.map(function(d){
    return {
        text: '第二周' + d.text,
        value: d.value
    };
});

var weekdayRange = weekday.map(function(d, i){
    return {
        text: d.text,
        value: d.value,
        children: weekday.slice(i).concat(nextWeekday.slice(0, i))
    }
});

module.exports = {
    init: function() {
        var self = this;
        this.models =[];
        efte.action.get(function(query) {
            self.topic = query.topic;
            efte.setTitle(query.title || '时间区间');
            self.timePeriods = self.genShowData(query.data);
            self.readOnly = query.readOnly;
            self.outdated = query.data.length > 1;
            if (self.timePeriods.length === 0) {
                self.addTimePeriod();
            } else {
                self.timePeriods.forEach(function(it, i) {
                    self.addTimePeriod(it);
                });
            }
            !self.readOnly && self.setButtons();
        });
    },
    addTimePeriod: function(timePeriod) {
        timePeriod = _.extend({}, dftTimePeriod, timePeriod);
        var self = this;
        var i = this.models.length;
        var container = $('

').appendTo('body');
        var model = new(nut.property.Composite.extend({
            mapping: {
                dayRange: nut.control.MultipleLevelSelect.extend({
                    label: '日期范围',
                    options: weekdayRange,
                    required: true,
                    setValue: function(values){
                        if (values.length === 1) {
                            values.push(values[0]);
                        }
                        this.values = values || [];
                        var text = [];
                        var days = weekdayRange;
                        this.values.forEach(function(v){
                            days.some(function(day){
                                if (day.value == v) {
                                    text.push(day.text);
                                    days = day.children;
                                    return true;
                                }
                            });
                        });
                        var str = '未设置';
                        if (values.length === 2) {
                            str = values[0] == values[1] ? text[0] : text.join('至');
                        }
                        this.b.text(str);
                    }
                }),
                timeRange: nut.control.MultipleLevelSelect.extend(function(){
                    this.addValidator(function(value){
                        if (value.length === 1) {
                            return '请填写完整';
                        }
                    });
                }, {
                    label: '时间范围',
                    options: timeRange,
                    required: true,
                    setValue: function(values){
                        this.values = values || [];
                        var text = [];
                        var time = timeRange;
                        this.values.forEach(function(v){
                            time.some(function(t){
                                if (t.value === v) {
                                    text.push(t.text);
                                    time = t.children;
                                    return true;
                                }
                            });
                        });
                        if (text.length === 1) {
                            text.push(' ?');
                        }
                        this.b.html(text.join('至') || '未设置');
                    }
                }),
                deleteTimePeriod: nut.control.AbstractLink.extend(
                function(){
                    this.el.addClass('no-icon-next text-center');
                }, {
                    label: '删除本时段',
                    onTap: function(){
                        if (!window.confirm('确认删除此时段吗?')) return;
                        self.deleteTimePeriod(model);
                    },
                    setValue: function(){},
                    getValue: function(){}
                })
            }
        }));
        this.models.push(model);
        model.container = container;
        nut.generate(this.models[i], [{
            title: '时间段',
            children: ['dayRange', 'timeRange'].concat(this.readOnly || i === 0 ? [] : 'deleteTimePeriod')
        }], container);
        model.value(timePeriod);
        model.forEach(function(control, name) {
            if (name === 'deleteTimePeriod') {
                control[self.readOnly ? 'disable' : 'enable']();
            } else {
                control[(self.readOnly || self.outdated) ? 'disable' : 'enable']();
            }
        });
    },
    deleteTimePeriod: function(model) {
        var index = this.models.indexOf(model);
        if (index < 0) return;
        model.container.remove();
        this.models.splice(index, 1);
        if (this.models.length === 1 && this.outdated) {
            this.outdated = false;
            if (!this.readOnly) {
                this.models[0].forEach(function(control){
                    control.enable();
                });
            }
        }
    },
    genShowData: function(data) {
        return data.map(function(period){
            return {
                dayRange: _.compact([period.beginDay, period.endDay]),
                timeRange: _.compact([period.beginTime, period.endTime])
            };
        });
    },
    genAjaxData: function() { // sum(timeInterval * repeat)
        var self = this;
        var timePeriods = [];
        debugger
        for (var j = 0; j < self.models.length; j++) {
            var thisData = self.models[j].value();
            timePeriods.push({
                beginDay: thisData.dayRange[0],
                endDay: thisData.dayRange[1],
                beginTime: thisData.timeRange[0],
                endTime: thisData.timeRange[1]
            });
        }
        return timePeriods;
    },
    setButtons: function() {
        var self = this;
        backAction(function(back) {
            if (!validator(self.models[0])) return;
            efte.publish(self.topic, self.genAjaxData());
            back();
        });
    }
};


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="lang:clipboard.copy" content="Copy to clipboard">
  <meta name="lang:clipboard.copied" content="Copied to clipboard">
  <meta name="lang:search.language" content="en">
  <meta name="lang:search.pipeline.stopwords" content="True">
  <meta name="lang:search.pipeline.trimmer" content="True">
  <meta name="lang:search.result.none" content="No matching documents">
  <meta name="lang:search.result.one" content="1 matching document">
  <meta name="lang:search.result.other" content="# matching documents">
  <meta name="lang:search.tokenizer" content="[\s\-]+">

    <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
    <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">

  <link rel="stylesheet" href="_static/stylesheets/application.css"/>
  <link rel="stylesheet" href="_static/stylesheets/application-palette.css"/>
  <link rel="stylesheet" href="_static/stylesheets/application-fixes.css"/>

  <link rel="stylesheet" href="_static/fonts/material-icons.css"/>

  <meta name="theme-color" content="#3f51b5">

    <title>Distributions — statsmodels</title>
  <link rel="icon" type="image/png" sizes="32x32" href="_static/icons/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="_static/icons/favicon-16x16.png">
  <link rel="manifest" href="_static/icons/site.webmanifest">
  <link rel="mask-icon" href="_static/icons/safari-pinned-tab.svg" color="#919191">
  <meta name="msapplication-TileColor" content="#2b5797">
  <meta name="msapplication-config" content="_static/icons/browserconfig.xml">
  <link rel="stylesheet" href="_static/stylesheets/examples.css">
  <link rel="stylesheet" href="_static/stylesheets/deprecation.css">
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/material.css" />
    <link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="_static/plot_directive.css" />

    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="author" title="About these documents" href="about.html" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="statsmodels.distributions.empirical_distribution.ECDF" href="generated/statsmodels.distributions.empirical_distribution.ECDF.html" />
    <link rel="prev" title="statsmodels.emplike.descriptive.DescStatMV.test_corr" href="generated/statsmodels.emplike.descriptive.DescStatMV.test_corr.html" />

  <svg class="md-svg">
    <defs data-children-count="0">

      <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>

    </defs>
  </svg>

  <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
  <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">

   Skip to content

          statsmodels v0.13.0
           Distributions

    <form class="md-search__form" action="search.html" method="get" name="search">
      <input type="text" class="md-search__input" name="q" placeholder="Search"
             autocapitalize="off" autocomplete="off" spellcheck="false"
             data-md-component="query" data-md-state="active">

      <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
        
      </button>
    </form>

            Type to start searching

      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
        <use xlink:href="#__github" width="24" height="24"></use>
      </svg>

    statsmodels

User Guide

    statsmodels v0.13.0

      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
        <use xlink:href="#__github" width="24" height="24"></use>
      </svg>

    statsmodels

      Installing statsmodels

      Getting started

      User Guide

      Background

      Regression and Linear Models

      Time Series Analysis

      Other Models

      Statistics and Tools

      Statistics stats

      Contingency tables

      Multiple Imputation with Chained Equations

      Empirical Likelihood emplike

    <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
     Distributions

      Distributions

    Contents

Distributions

Empirical Distributions

Count Distributions

Copula

Distribution Extras

Univariate Distributions by non-linear Transformations

Helper Functions

Show Source

      Graphics

      Input-Output iolib

      Tools

      Working with Large Data Sets

      Optimization

      Data Sets

      Sandbox

      Examples

      API Reference

      About statsmodels

      Developer Page

      Release Notes

    Contents

Distributions

Empirical Distributions

Count Distributions

Copula

Distribution Extras

Univariate Distributions by non-linear Transformations

Helper Functions

Show Source

Distributions¶

This section collects various additional functions and methods for statistical
distributions.

Empirical Distributions¶

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

ECDF(x[, side])

Return the Empirical CDF of an array as a step function.

StepFunction(x, y[, ival, sorted, side])

A basic step function.

monotone_fn_inverter(fn, x[, vectorized])

Given a monotone function fn (no checking is done to verify monotonicity) and a set of x values, return an linearly interpolated approximation to its inverse from its values on x.

Count Distributions¶

The discrete module contains classes for count distributions that are based
on discretizing a continuous distribution, and specific count distributions
that are not available in scipy.distributions like generalized poisson and
zero-inflated count models.

The latter are mainly in support of the corresponding models in
statsmodels.discrete. Some methods are not specifically implemented and will
use potentially slow inherited generic methods.

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

DiscretizedCount(*args, **kwds)

Count distribution based on discretized distribution

DiscretizedModel(endog[, exog, distr])

experimental model to fit discretized distribution

genpoisson_p

Generalized Poisson distribution

zigenpoisson

Zero Inflated Generalized Poisson distribution

zinegbin

Zero Inflated Generalized Negative Binomial distribution

zipoisson

Zero Inflated Poisson distribution

Copula¶

The copula sub-module provides classes to model the dependence between
parameters. Copulae are used to construct a multivariate joint distribution and
provide a set of functions like sampling, PDF, CDF.

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

CopulaDistribution(copula, marginals[, cop_args])

Multivariate copula distribution

ArchimedeanCopula(transform[, args, k_dim])

Base class for Archimedean copulas

FrankCopula([theta, k_dim])

Frank copula.

ClaytonCopula([theta, k_dim])

Clayton copula.

GumbelCopula([theta, k_dim])

Gumbel copula.

GaussianCopula([corr, k_dim])

Gaussian copula.

StudentTCopula([corr, df, k_dim])

Student t copula.

ExtremeValueCopula(transform[, args, k_dim])

Extreme value copula constructed from Pickand's dependence function.

IndependenceCopula([k_dim])

Independence copula.

Distribution Extras¶

Skew Distributions

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

SkewNorm_gen()

univariate Skew-Normal distribution of Azzalini

SkewNorm2_gen([momtype, a, b, xtol, …])

univariate Skew-Normal distribution of Azzalini

ACSkewT_gen()

univariate Skew-T distribution of Azzalini

skewnorm2

univariate Skew-Normal distribution of Azzalini

Distributions based on Gram-Charlier expansion

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

pdf_moments_st(cnt)

Return the Gaussian expanded pdf function given the list of central moments (first one is mean).

pdf_mvsk(mvsk)

Return the Gaussian expanded pdf function given the list of 1st, 2nd moment and skew and Fisher (excess) kurtosis.

pdf_moments(cnt)

Return the Gaussian expanded pdf function given the list of central moments (first one is mean).

NormExpan_gen(args, **kwds)

Gram-Charlier Expansion of Normal distribution

cdf of multivariate normal wrapper for scipy.stats

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

mvstdnormcdf(lower, upper, corrcoef, **kwds)

standardized multivariate normal cumulative distribution function

mvnormcdf(upper, mu, cov[, lower])

multivariate normal cumulative distribution function

Univariate Distributions by non-linear Transformations¶

Univariate distributions can be generated from a non-linear transformation of an
existing univariate distribution. Transf_gen is a class that can generate a new
distribution from a monotonic transformation, TransfTwo_gen can use hump-shaped
or u-shaped transformation, such as abs or square. The remaining objects are
special cases.

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

TransfTwo_gen(kls, func, funcinvplus, …)

Distribution based on a non-monotonic (u- or hump-shaped transformation)

Transf_gen(kls, func, funcinv, *args, **kwargs)

a class for non-linear monotonic transformation of a continuous random variable

ExpTransf_gen(kls, *args, **kwargs)

Distribution based on log/exp transformation

LogTransf_gen(kls, *args, **kwargs)

Distribution based on log/exp transformation

SquareFunc()

class to hold quadratic function with inverse function and derivative

absnormalg

Distribution based on a non-monotonic (u- or hump-shaped transformation)

invdnormalg

a class for non-linear monotonic transformation of a continuous random variable

loggammaexpg

univariate distribution of a non-linear monotonic transformation of a random variable

lognormalg

a class for non-linear monotonic transformation of a continuous random variable

negsquarenormalg

Distribution based on a non-monotonic (u- or hump-shaped transformation)

squarenormalg

Distribution based on a non-monotonic (u- or hump-shaped transformation)

squaretg

Distribution based on a non-monotonic (u- or hump-shaped transformation)

Helper Functions¶

<colgroup>
<col style="width: 10%"/>
<col style="width: 90%"/>
</colgroup>

check_random_state([seed])

Turn seed into a random number generator.

                   Previous  statsmodels.emplike.descriptive.DescStatMV.test_corr

  Next  statsmodels.distributions.empirical_distribution.ECDF

              © Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.

            Last updated on
              Oct 06, 2021.

            Created using
            Sphinx 4.0.3.
             and
            Material for
              Sphinx


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.kl.categorypro.CategoryPro" table="category_pro" catalog="rain">
        <id name="categoryPId" type="short">
            <column name="category_p_id" />
            <generator class="increment" />
        </id>
        <property name="categoryPName" type="string">
            <column name="category_p_name" length="50" not-null="true" />
        </property>
        <property name="lastUpdate" type="timestamp">
            <column name="last_update" length="19" not-null="true" />
        </property>
        <property name="userId" type="integer">
            <column name="user_id" not-null="true" />
        </property>
    </class>
</hibernate-mapping>


text:
#region Nequeo Pty Ltd License
/*
    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use,
    copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
*/
#endregion

using System;

namespace Nequeo.Wpf.Messaging
{
    /// <summary>
    /// Provides a message class with a built-in callback. When the recipient
    /// is done processing the message, it can execute the callback to
    /// notify the sender that it is done. Use the <see cref="Execute" />
    /// method to execute the callback. The callback method has one parameter.
    /// <seealso cref="NotificationMessageAction"/> and
    /// <seealso cref="NotificationMessageAction<TCallbackParameter>"/>.
    /// </summary>
    ////[ClassInfo(typeof(Messenger))]
    public class NotificationMessageWithCallback : NotificationMessage
    {
        private readonly Delegate _callback;

        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationMessageWithCallback" /> class.
        /// </summary>
        /// <param name="notification">An arbitrary string that will be
        /// carried by the message.</param>
        /// <param name="callback">The callback method that can be executed
        /// by the recipient to notify the sender that the message has been
        /// processed.</param>
        public NotificationMessageWithCallback(string notification, Delegate callback)
            : base(notification)
        {
            CheckCallback(callback);
            _callback = callback;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationMessageWithCallback" /> class.
        /// </summary>
        /// <param name="sender">The message's sender.</param>
        /// <param name="notification">An arbitrary string that will be
        /// carried by the message.</param>
        /// <param name="callback">The callback method that can be executed
        /// by the recipient to notify the sender that the message has been
        /// processed.</param>
        public NotificationMessageWithCallback(object sender, string notification, Delegate callback)
            : base(sender, notification)
        {
            CheckCallback(callback);
            _callback = callback;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationMessageWithCallback" /> class.
        /// </summary>
        /// <param name="sender">The message's sender.</param>
        /// <param name="target">The message's intended target. This parameter can be used
        /// to give an indication as to whom the message was intended for. Of course
        /// this is only an indication, amd may be null.</param>
        /// <param name="notification">An arbitrary string that will be
        /// carried by the message.</param>
        /// <param name="callback">The callback method that can be executed
        /// by the recipient to notify the sender that the message has been
        /// processed.</param>
        public NotificationMessageWithCallback(object sender, object target, string notification, Delegate callback)
            : base(sender, target, notification)
        {
            CheckCallback(callback);
            _callback = callback;
        }

        /// <summary>
        /// Executes the callback that was provided with the message with an
        /// arbitrary number of parameters.
        /// </summary>
        /// <param name="arguments">A  number of parameters that will
        /// be passed to the callback method.</param>
        /// <returns>The object returned by the callback method.</returns>
        public virtual object Execute(params object[] arguments)
        {
            return _callback.DynamicInvoke(arguments);
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="callback"></param>
        private static void CheckCallback(Delegate callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback", "Callback may not be null");
            }
        }
    }
}


text:
<!DOCTYPE html>
<html>
	<head>
		<title>RequireJS Example</title>
		<meta charset="UTF-8">
		<script data-main="config" src="../assets/vendors/jrburke/js/require.js"></script>
	</head>
	<body/>
</html>


text:
require 'generators/backbonify/resource_helpers'

module Backbonify
  module Generators
    class ModelGenerator < Rails::Generators::NamedBase
      include Backbonify::Generators::ResourceHelpers

      source_root File.expand_path("../templates", __FILE__)
      desc "This generator creates a backbone model"

      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      def create_backbone_model
        template "model.js", "#{backbone_path}/models/#{file_name}.js"
      end

    end
  end
end


text:
package ch.alv.components.web.api.config;

import org.junit.Test;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
 * Unit tests for the {@link ch.alv.components.web.api.config.ResourceConfiguration} class.
 *
 * @since 1.0.0
 */
public class BaseParameterTest {

    private BaseParameter param = new BaseParameterTestHelper();

    private String name = "testName";
    private String example = "testExample";
    private ParameterType parameterType = ParameterType.STRING;
    private boolean required = true;

    @Test
    public void testParamConstructor() {
        BaseParameter parameter = new BaseParameterTestHelper(name, parameterType, required);
        assertEquals(name, parameter.getName());
        assertEquals(ParameterType.STRING, parameter.getType());
        assertEquals(required, parameter.isRequired());
    }

    @Test
    public void testName() {
        param.setName(name);
        assertEquals(name, param.getName());
    }

    @Test
    public void testExample() {
        param.setExample(example);
        assertEquals(example, param.getExample());
    }

    @Test
    public void testRepeat() {
        param.setRepeat(true);
        assertTrue(param.isRepeat());
    }

    @Test
    public void testDefaultValue() {
        param.setDefaultValue("value");
        assertEquals("value", param.getDefaultValue());
    }

    @Test
    public void testEnumeration() {
        List<String> enumeration = new ArrayList<>();
        param.setEnumeration(enumeration);
        assertEquals(enumeration, param.getEnumeration());
    }

    @Test
    public void testMinimum() {
        param.setMinimum(new BigDecimal(11));
        assertEquals(new BigDecimal(11), param.getMinimum());
    }

    @Test
    public void testMaximum() {
        param.setMaximum(new BigDecimal(88));
        assertEquals(new BigDecimal(88), param.getMaximum());
    }

    @Test
    public void testMinLength() {
        param.setMinLength(5);
        assertEquals((Integer) 5, param.getMinLength());
    }

    @Test
    public void testMaxLength() {
        param.setMaxLength(77);
        assertEquals((Integer) 77, param.getMaxLength());
    }

    private class BaseParameterTestHelper extends BaseParameter {
        private static final long serialVersionUID = -1729010725602766030L;

        private BaseParameterTestHelper() { }
        private BaseParameterTestHelper(String name, ParameterType type, boolean required) { super(name, type, required); }
    }

}


text:
@interface EnemyBuilder : NSObject {

	float lastInitializePositionY;
	int gameLevel;	// 0: Easy	1: Medium	2: Hard
}

-(SolidCharacter *) build:(EnemyDefinition *) definition;
-(SolidCharacter *) build:(EnemyClarification)clarification Type:(int)type;

-(Enemy *) LuanEnemy:(int)type;
-(Supply *) BulletSupply:(int)type;
-(Supply *) FriendSupply:(int)type;

// This is deprecated, should use ChaseAction instead
-(CGPoint) getTraceSpeedX:(float)x Y:(float)y Base:(float)base;

-(float) getTopEdge:(Enemy *)enemy;
-(float) getBottomEdge:(Enemy *)enemy;
-(float) getLeftEdge:(Enemy *)enemy;
-(float) getRightEdge:(Enemy *)enemy;

-(float) getLastInitializePositionY;
-(void) setLastInitializePositionY:(float)val;

@end


text:
package org.scalatest.fixture

import org.scalatest._
import SharedHelpers._
import org.scalatest
import org.scalatest.funsuite

class TestDataFixtureSpec extends scalatest.funspec.AnyFunSpec {
  describe("A TestDataFixture") {
    it("should pass the test data to each test") {
      val myConfigMap = ConfigMap("hello" -> "world", "salt" -> "pepper")
      class MySuite extends funsuite.FixtureAnyFunSuite with TestDataFixture {
        var testDataPassed = false
        test("something") { (td: TestData) =>
          if (td.configMap == myConfigMap && td.name == "something")
            testDataPassed = true
        }
      }
      val suite = new MySuite
      suite.run(None, Args(SilentReporter, Stopper.default, Filter(), myConfigMap, None, new Tracker, Set.empty))
      assert(suite.testDataPassed)
    }
  }
}


text:
namespace app_list {

AppResult::AppResult(Profile* profile,
                     const std::string& app_id,
                     AppListControllerDelegate* controller)
    : profile_(profile),
      app_id_(app_id),
      controller_(controller) {
  set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id_).spec());

  const extensions::Extension* extension =
      extensions::ExtensionSystem::Get(profile_)->extension_service()
          ->GetInstalledExtension(app_id_);
  DCHECK(extension);

  is_platform_app_ = extension->is_platform_app();

  icon_.reset(new extensions::IconImage(
      profile_,
      extension,
      extensions::IconsInfo::GetIcons(extension),
      extension_misc::EXTENSION_ICON_SMALL,
      extensions::IconsInfo::GetDefaultAppIcon(),
      this));
  SetIcon(icon_->image_skia());
}
AppResult::~AppResult() {}

void AppResult::UpdateFromMatch(const TokenizedString& title,
                                const TokenizedStringMatch& match) {
  const TokenizedStringMatch::Hits& hits = match.hits();

  Tags tags;
  tags.reserve(hits.size());
  for (size_t i = 0; i < hits.size(); ++i)
    tags.push_back(Tag(Tag::MATCH, hits[i].start(), hits[i].end()));

  set_title(title.text());
  set_title_tags(tags);
  set_relevance(match.relevance());
}

void AppResult::Open(int event_flags) {
  const extensions::Extension* extension =
      extensions::ExtensionSystem::Get(profile_)->extension_service()
          ->GetInstalledExtension(app_id_);
  if (!extension)
    return;

  AppLauncherHandler::RecordAppListSearchLaunch(extension);
  content::RecordAction(
      content::UserMetricsAction("AppList_ClickOnAppFromSearch"));

  controller_->ActivateApp(profile_, extension, event_flags);
}

void AppResult::InvokeAction(int action_index, int event_flags) {}

scoped_ptr<ChromeSearchResult> AppResult::Duplicate() {
  scoped_ptr<ChromeSearchResult> copy(
      new AppResult(profile_, app_id_, controller_));
  copy->set_title(title());
  copy->set_title_tags(title_tags());

  return copy.Pass();
}

ui::MenuModel* AppResult::GetContextMenuModel() {
  if (!context_menu_) {
    context_menu_.reset(new AppContextMenu(
        this, profile_, app_id_, controller_, is_platform_app_));
  }

  return context_menu_->GetMenuModel();
}

void AppResult::OnExtensionIconImageChanged(
    extensions::IconImage* image) {
  DCHECK_EQ(icon_.get(), image);
  SetIcon(icon_->image_skia());
}

void AppResult::ExecuteLaunchCommand(int event_flags) {
  Open(event_flags);
}

}  // namespace app_list


text:
<?php

class m140313_090944_add_gig_currency extends CDbMigration
{
    public function up()
    {
        $this->addColumn('gig', 'currency', 'tinyint(1) DEFAULT 1');
    }

    public function down()
    {
        $this->dropColumn('gig', 'currency');
    }
}


text:
const _            = require('lodash');
const Stock        = require('./index.js');
const Candidates   = require('./candidates.js');

const sic = '1531';

// Stock.createStocks(sic)
//   .then(console.log)
//   .catch(console.log)

// Stock.crawlUnexploredStock(sic)
//   .then(content => JSON.stringify(content, null, 2))
//   .then(console.log)
//   .catch(console.log)

// Stock.getStats(sic)
//   .then(console.log)
//   .catch(console.log)

// Stock.filterInteractiveStocks('1000', 5)
//   .then(content => content.length)
//   .then(console.log)
//   .catch(console.log)

// Candidates.createCandidates()
//   .then(console.log)
//   .catch(console.log)

// Candidates.findCandidateWithoutTicker()
//   .then(console.log)
//   .catch(console.log)

// const candidate = { cik: '0000858470', ticker: 'COG' };
// Candidates.updateStock(candidate)
//   .then(console.log)
//   .catch(console.log)

// Candidates.getCandidates()
//   .then(_.values)
//   .then(_.first)
//   .then(console.log)
//   .catch(console.log)

// Candidates.findAllCandidatesWithTicker()
//   .then(content => content.length)
//   .then(console.log)
//   .catch(console.log)

Candidates.findAllNoneCreatedStockCandidates()
  // .then(_.first)
  // .then((candidate) => {
  //   if(candidate) {
  //     return Candidates.crawlStocks([candidate]);
  //   }
  // })
  .then((candidates) => {
    if(candidates) {
      return Candidates.crawlStocks(candidates);
    }
  })
  .then(console.log)
  .catch(console.log)


text:
module Markup
  class << self
    attr_accessor :engine_list

    def use_engine(name, text)
      @engine_list.each do |engine|
        return engine[2].call(text).html_safe if engine[0] == name
      end
      text.html_safe
    end
  end

  @engine_list = [
    ['html', 'HTML', ->(text) { text }],
    ['kramdown', 'Markdown (Kramdown)',
     lambda do |text|
       Kramdown::Document.new(text,
         coderay_line_numbers: nil,
         coderay_css: :class).to_html
     end],
    ['redcloth', 'Textile (Redcloth)',
     ->(text) { RedCloth.new(text).to_html }],
    ['redcarpet', 'Markdown (redcarpet)',
     lambda do |text|
       Redcarpet::Markdown.new(
         Redcarpet::Render::HTML,
         no_intra_emphasis: true,
         fenced_code_blocks: true,
         autolink: true,
         tables: true,
         superscript: true,
         space_after_headers: true
       ).render(text)
     end]
  ]
end


text:
"""app.py
revision: 0.1 24.4.2014 initial by David Levy

Tornado server for mongodb tornado angular tutorial
"""
import os
import sys
import tornado
import pymongo
from tornado.options import  options
from tornado import ioloop, web

from handlers.blog_handler import BlogHandler
from handlers.entry_handler import EntryHandler
from handlers.index_handler import IndexHandler

#adding local directory to path
sys.path.append(os.path.dirname(os.path.realpath(__file__)))

"""
Loading default setting files
"""
import settings

"""
searching for a local_setting.py file that overrides default configuration
"""
try:
    tornado.options.parse_config_file(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),'local_settings.py'),
        False)
except Exception as e:
    #print ('local settings: {}'.format(str(e)))
    #TODO: handle different exceptions
    print ('local_settings.py not defined, using default settings')

"""
Connecting to the mongodb database
"""
mongo_client = pymongo.MongoClient(options.mongodb_host)
db = mongo_client[options.mongodb_name]

def init_db(db):
    try:
        db.create_collection('blog')
    except:
        pass
    db['blog'].ensure_index('slug', unique=True)
    db['blog'].ensure_index('_id', unique=True)
    try:
        db.create_collection('user')
    except:
        pass
    try:
        db['user'].insert({'username':'admin','password':'admin','role':'admin'})
    except:
        pass
    db['user'].ensure_index('username', unique=True)
    db['user'].ensure_index('_id', unique=True)

if options.mobile_version:
    static_path = options.mobile_static_path
else:
    static_path = options.static_path

app = tornado.web.Application([
                          (r'/', IndexHandler),
                          #api prefix means that we load json data
                          (r'/api/blog', BlogHandler, dict(db=db)),
                          (r'/api/entry', EntryHandler, dict(db=db)),
                      ],
                      static_path=static_path,
                      autoreload=True
)

if __name__ == '__main__':
    #read settings from commandline
    options.parse_command_line()
    if options.init_db:
        init_db(db)
    print ('server running on http://localhost:{}'.format(options.port))
    app.listen(options.port,xheaders=True)
    ioloop = tornado.ioloop.IOLoop.instance()
    ioloop.start()


text:
int hslua_getlfield(lua_State *L, int index, const char *k, size_t len);

int hslua_setfield(lua_State *L, int index, const char *k);


text:
<?php
namespace Crossjoin\Css\Format\Rule;

trait TraitRules
{
    /**
     * @var array Array to save CSS rules
     */
    protected $rules = [];

    /**
     * Sets CSS rules.
     *
     * @param RuleAbstract[]|RuleAbstract $rules
     * @return $this
     */
    public function setRules($rules)
    {
        $this->rules = [];
        if (!is_array($rules)) {
            $rules = [$rules];
        }
        foreach ($rules as $rule) {
            $this->addRule($rule);
        }

        return $this;
    }

    /**
     * Adds a CSS rule.
     *
     * @param RuleAbstract $rule
     * @return $this
     */
    public function addRule(RuleAbstract $rule)
    {
        $this->rules[] = $rule;

        return $this;
    }

    /**
     * Gets CSS rules.
     *
     * @return RuleAbstract[]
     */
    public function getRules()
    {
        return $this->rules;
    }
}


text:
'use strict';

var marble = require('marble');

module.exports = {
  metalComponents: ['electric-marble-components'],
  sassOptions: {
    includePaths: ['node_modules', marble.src]
  },
  vendorSrc: ['node_modules/marble/build/fonts/**'],
  deployOptions: { branch: 'gh-pages' }
};


text:
module Fastlane
  module Actions
    class MakeChangelogFromJenkinsAction < Action
      def self.run(params)
        require 'json'
        require 'net/http'

        changelog = ""

        if Helper.is_ci? || Helper.is_test?
          # The "BUILD_URL" environment variable is set automatically by Jenkins in every build
          jenkins_api_url = URI(ENV["BUILD_URL"] + "api/json\?wrapper\=changes\&xpath\=//changeSet//comment")
          begin
            json = JSON.parse(Net::HTTP.get(jenkins_api_url))
            json['changeSet']['items'].each do |item|
              comment = params[:include_commit_body] ? item['comment'] : item['msg']
              changelog << comment.strip + "\n"
            end
          rescue => ex
            UI.error("Unable to read/parse changelog from jenkins: #{ex.message}")
          end
        end

        Actions.lane_context[SharedValues::FL_CHANGELOG] = changelog.strip.length > 0 ? changelog : params[:fallback_changelog]
      end

      def self.description
        "Generate a changelog using the Changes section from the current Jenkins build"
      end

      def self.details
        "This is useful when deploying automated builds. The changelog from Jenkins lists all the commit messages since the last build."
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :fallback_changelog,
                                       description: "Fallback changelog if there is not one on Jenkins, or it couldn't be read",
                                       optional: true,
                                       default_value: ""),
          FastlaneCore::ConfigItem.new(key: :include_commit_body,
                                       description: "Include the commit body along with the summary",
                                       optional: true,
                                       is_string: false,
                                       default_value: true)
        ]
      end

      def self.output
        [
          ['FL_CHANGELOG', 'The changelog generated by Jenkins']
        ]
      end

      def self.authors
        ["mandrizzle"]
      end

      def self.is_supported?(platform)
        true
      end

      def self.example_code
        [
          'make_changelog_from_jenkins(
            # Optional, lets you set a changelog in the case is not generated on Jenkins or if ran outside of Jenkins
            fallback_changelog: "Bug fixes and performance enhancements"
          )'
        ]
      end

      def self.category
        :misc
      end
    end
  end
end


text:
namespace SampleFramework11
{
}


text:
'use strict';

(function () {
    angular
        .module('gnap-example-app')
        .config(stateConfiguration);

    var stateSettings = {
        name: 'main.forbidden',
        state: {
            url: '/forbidden',
            templateUrl: 'app/main/forbidden/forbidden.html',
            controller: 'MainForbiddenController as vm'
        },
        title: {
            textTranslationId: 'main.forbidden.title'
        },
        breadcrumb: {
            titleTranslationId: 'main.forbidden.breadcrumb'
        },
        translations: 'app/main/forbidden'
    };

    stateSettings.state.onEnter = onEnter;
    stateSettings.state.onExit = onExit;

    stateConfiguration.$inject = ['$stateProvider'];

    function stateConfiguration($stateProvider) {
        $stateProvider.state(stateSettings.name, stateSettings.state);
    }

    onEnter.$inject = ['titleService', 'breadcrumbsService'];

    function onEnter(titleService, breadcrumbsService) {
        titleService.appendTitle(stateSettings.title);

        breadcrumbsService.addBreadcrumb(stateSettings.breadcrumb);
    }

    onExit.$inject = ['titleService', 'breadcrumbsService'];

    function onExit(titleService, breadcrumbsService) {
        titleService.removeLastTitle();

        breadcrumbsService.removeLastBreadcrumb();
    }

    if (stateSettings.translations) {
        stateSettings.state.resolve = stateSettings.state.resolve || {};
        stateSettings.state.resolve.translations = refreshTranslations;
    }

    refreshTranslations.$inject = ['$translatePartialLoader', '$translate'];

    function refreshTranslations($translatePartialLoader, $translate) {
        $translatePartialLoader.addPart(stateSettings.translations);
        return $translate.refresh();
    }
})();